From 641f2e298dc948197b8e51bebbd6b29450c3f00e Mon Sep 17 00:00:00 2001 From: xiewme Date: Fri, 29 Nov 2019 16:40:02 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E4=B8=80=E4=BA=9B=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dist/index.js | 2 +- dist/preview.js | 2 +- package.json | 2 +- src/blots/image.ts | 10 +++++++++- src/blots/video.ts | 2 +- src/common.ts | 2 -- src/index.ts | 26 +++++++++++++------------- src/uploader.ts | 1 - 8 files changed, 26 insertions(+), 21 deletions(-) diff --git a/dist/index.js b/dist/index.js index 7c2abff..8e5cb48 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1 +1 @@ -!function(n){var t=window.webpackHotUpdate;window.webpackHotUpdate=function(n,e){!function(n,t){if(!A[n]||!m[n])return;for(var e in m[n]=!1,t)Object.prototype.hasOwnProperty.call(t,e)&&(o[e]=t[e]);0==--G&&0===Z&&h()}(n,e),t&&t(n,e)};var e,g=!0,I="915a2690719f51871caa",l=1e4,c={},B=[],i=[];function b(n){var t=V[n];if(!t)return W;var g=function(g){return t.hot.active?(V[g]?-1===V[g].parents.indexOf(n)&&V[g].parents.push(n):(B=[n],e=g),-1===t.children.indexOf(g)&&t.children.push(g)):(console.warn("[HMR] unexpected require("+g+") from disposed module "+n),B=[]),W(g)},I=function(n){return{configurable:!0,enumerable:!0,get:function(){return W[n]},set:function(t){W[n]=t}}};for(var l in W)Object.prototype.hasOwnProperty.call(W,l)&&"e"!==l&&"t"!==l&&Object.defineProperty(g,l,I(l));return g.e=function(n){return"ready"===u&&C("prepare"),Z++,W.e(n).then(t,(function(n){throw t(),n}));function t(){Z--,"prepare"===u&&(Q[n]||p(n),0===Z&&0===G&&h())}},g.t=function(n,t){return 1&t&&(n=g(n)),W.t(n,-2&t)},g}function d(n){var t={_acceptedDependencies:{},_declinedDependencies:{},_selfAccepted:!1,_selfDeclined:!1,_disposeHandlers:[],_main:e!==n,active:!0,accept:function(n,e){if(void 0===n)t._selfAccepted=!0;else if("function"==typeof n)t._selfAccepted=n;else if("object"==typeof n)for(var g=0;g=0&&t._disposeHandlers.splice(e,1)},check:F,apply:y,status:function(n){if(!n)return u;a.push(n)},addStatusHandler:function(n){a.push(n)},removeStatusHandler:function(n){var t=a.indexOf(n);t>=0&&a.splice(t,1)},data:c[n]};return e=void 0,t}var a=[],u="idle";function C(n){u=n;for(var t=0;t0;){var I=g.pop(),l=I.id,c=I.chain;if((i=V[l])&&!i.hot._selfAccepted){if(i.hot._selfDeclined)return{type:"self-declined",chain:c,moduleId:l};if(i.hot._main)return{type:"unaccepted",chain:c,moduleId:l};for(var B=0;B ")),F.type){case"self-declined":t.onDeclined&&t.onDeclined(F),t.ignoreDeclined||(p=new Error("Aborted because of self decline: "+F.moduleId+U));break;case"declined":t.onDeclined&&t.onDeclined(F),t.ignoreDeclined||(p=new Error("Aborted because of declined dependency: "+F.moduleId+" in "+F.parentId+U));break;case"unaccepted":t.onUnaccepted&&t.onUnaccepted(F),t.ignoreUnaccepted||(p=new Error("Aborted because "+b+" is not accepted"+U));break;case"accepted":t.onAccepted&&t.onAccepted(F),h=!0;break;case"disposed":t.onDisposed&&t.onDisposed(F),y=!0;break;default:throw new Error("Unexception type "+F.type)}if(p)return C("abort"),Promise.reject(p);if(h)for(b in Z[b]=o[b],a(G,F.outdatedModules),F.outdatedDependencies)Object.prototype.hasOwnProperty.call(F.outdatedDependencies,b)&&(r[b]||(r[b]=[]),a(r[b],F.outdatedDependencies[b]));y&&(a(G,[F.moduleId]),Z[b]=Q)}var N,x=[];for(g=0;g0;)if(b=Y.pop(),i=V[b]){var H={},v=i.hot._disposeHandlers;for(l=0;l=0&&T.parents.splice(N,1))}}for(b in r)if(Object.prototype.hasOwnProperty.call(r,b)&&(i=V[b]))for(R=r[b],l=0;l=0&&i.children.splice(N,1);for(b in C("apply"),I=s,Z)Object.prototype.hasOwnProperty.call(Z,b)&&(n[b]=Z[b]);var J=null;for(b in r)if(Object.prototype.hasOwnProperty.call(r,b)&&(i=V[b])){R=r[b];var S=[];for(g=0;g undefined\n * typeof document -> undefined\n *\n * react-native:\n * navigator.product -> 'ReactNative'\n * nativescript\n * navigator.product -> 'NativeScript' or 'NS'\n */\nfunction isStandardBrowserEnv() {\n if (typeof navigator !== 'undefined' && (navigator.product === 'ReactNative' ||\n navigator.product === 'NativeScript' ||\n navigator.product === 'NS')) {\n return false;\n }\n return (\n typeof window !== 'undefined' &&\n typeof document !== 'undefined'\n );\n}\n\n/**\n * Iterate over an Array or an Object invoking a function for each item.\n *\n * If `obj` is an Array callback will be called passing\n * the value, index, and complete array for each item.\n *\n * If 'obj' is an Object callback will be called passing\n * the value, key, and complete object for each property.\n *\n * @param {Object|Array} obj The object to iterate\n * @param {Function} fn The callback to invoke for each item\n */\nfunction forEach(obj, fn) {\n // Don't bother if no value provided\n if (obj === null || typeof obj === 'undefined') {\n return;\n }\n\n // Force an array if not already something iterable\n if (typeof obj !== 'object') {\n /*eslint no-param-reassign:0*/\n obj = [obj];\n }\n\n if (isArray(obj)) {\n // Iterate over array values\n for (var i = 0, l = obj.length; i < l; i++) {\n fn.call(null, obj[i], i, obj);\n }\n } else {\n // Iterate over object keys\n for (var key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) {\n fn.call(null, obj[key], key, obj);\n }\n }\n }\n}\n\n/**\n * Accepts varargs expecting each argument to be an object, then\n * immutably merges the properties of each object and returns result.\n *\n * When multiple objects contain the same key the later object in\n * the arguments list will take precedence.\n *\n * Example:\n *\n * ```js\n * var result = merge({foo: 123}, {foo: 456});\n * console.log(result.foo); // outputs 456\n * ```\n *\n * @param {Object} obj1 Object to merge\n * @returns {Object} Result of all merge properties\n */\nfunction merge(/* obj1, obj2, obj3, ... */) {\n var result = {};\n function assignValue(val, key) {\n if (typeof result[key] === 'object' && typeof val === 'object') {\n result[key] = merge(result[key], val);\n } else {\n result[key] = val;\n }\n }\n\n for (var i = 0, l = arguments.length; i < l; i++) {\n forEach(arguments[i], assignValue);\n }\n return result;\n}\n\n/**\n * Function equal to merge with the difference being that no reference\n * to original objects is kept.\n *\n * @see merge\n * @param {Object} obj1 Object to merge\n * @returns {Object} Result of all merge properties\n */\nfunction deepMerge(/* obj1, obj2, obj3, ... */) {\n var result = {};\n function assignValue(val, key) {\n if (typeof result[key] === 'object' && typeof val === 'object') {\n result[key] = deepMerge(result[key], val);\n } else if (typeof val === 'object') {\n result[key] = deepMerge({}, val);\n } else {\n result[key] = val;\n }\n }\n\n for (var i = 0, l = arguments.length; i < l; i++) {\n forEach(arguments[i], assignValue);\n }\n return result;\n}\n\n/**\n * Extends object a by mutably adding to it the properties of object b.\n *\n * @param {Object} a The object to be extended\n * @param {Object} b The object to copy properties from\n * @param {Object} thisArg The object to bind function to\n * @return {Object} The resulting value of object a\n */\nfunction extend(a, b, thisArg) {\n forEach(b, function assignValue(val, key) {\n if (thisArg && typeof val === 'function') {\n a[key] = bind(val, thisArg);\n } else {\n a[key] = val;\n }\n });\n return a;\n}\n\nmodule.exports = {\n isArray: isArray,\n isArrayBuffer: isArrayBuffer,\n isBuffer: isBuffer,\n isFormData: isFormData,\n isArrayBufferView: isArrayBufferView,\n isString: isString,\n isNumber: isNumber,\n isObject: isObject,\n isUndefined: isUndefined,\n isDate: isDate,\n isFile: isFile,\n isBlob: isBlob,\n isFunction: isFunction,\n isStream: isStream,\n isURLSearchParams: isURLSearchParams,\n isStandardBrowserEnv: isStandardBrowserEnv,\n forEach: forEach,\n merge: merge,\n deepMerge: deepMerge,\n extend: extend,\n trim: trim\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMC5qcyIsInNvdXJjZXMiOlsid2VicGFjazovLy8uL25vZGVfbW9kdWxlcy9heGlvcy9saWIvdXRpbHMuanM/YzUzMiJdLCJzb3VyY2VzQ29udGVudCI6WyIndXNlIHN0cmljdC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QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTsiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///0\n")},function(module,__webpack_exports__,__webpack_require__){"use strict";eval("\n// EXTERNAL MODULE: ./node_modules/axios/index.js\nvar axios = __webpack_require__(2);\nvar axios_default = /*#__PURE__*/__webpack_require__.n(axios);\n\n// EXTERNAL MODULE: ./node_modules/spark-md5/spark-md5.js\nvar spark_md5 = __webpack_require__(5);\nvar spark_md5_default = /*#__PURE__*/__webpack_require__.n(spark_md5);\n\n// CONCATENATED MODULE: ./src/uploader.ts\nvar __assign = (undefined && undefined.__assign) || function () {\r\n __assign = Object.assign || function(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\r\n t[p] = s[p];\r\n }\r\n return t;\r\n };\r\n return __assign.apply(this, arguments);\r\n};\r\nvar __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n};\r\nvar __generator = (undefined && undefined.__generator) || function (thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n};\r\n\r\n\r\nvar userToken = '';\r\nvar apiV2BaseUrl = '';\r\nvar storage = { channel: 'public' };\r\ntry {\r\n var sp = new URL(window.location.href).searchParams;\r\n userToken = sp.get('user_token') || '';\r\n apiV2BaseUrl = sp.get('api_v2_base_url') || '';\r\n var uploadStorage = sp.get('upload_storage');\r\n if (uploadStorage) {\r\n storage = JSON.parse(uploadStorage);\r\n }\r\n}\r\ncatch (err) {\r\n //\r\n}\r\nwindow.setUploaderOptions = function (options) {\r\n if (typeof options === 'string') {\r\n options = JSON.parse(options);\r\n }\r\n userToken = options.userToken || '';\r\n apiV2BaseUrl = options.apiV2BaseUrl || '';\r\n if (options.storage) {\r\n storage = options.storage;\r\n }\r\n};\r\nvar uploadFuncNames = [\r\n 'chooseImage',\r\n 'removeImage',\r\n 'reinsertImage',\r\n 'reuploadImage',\r\n 'insertRemoteImage',\r\n 'chooseVideo',\r\n 'removeVideo',\r\n 'reinsertVideo',\r\n 'reuploadVideo',\r\n];\r\nfunction tryHijackUploadCall(funcName, params) {\r\n if (!uploadFuncNames.includes(funcName)) {\r\n return false;\r\n }\r\n if (funcName.startsWith('choose')) {\r\n chooseAndUpload(funcName.substr(6).toLowerCase());\r\n }\r\n else if (funcName.startsWith('remove')) {\r\n handleRemove(funcName.substr(6).toLowerCase(), params);\r\n }\r\n else if (funcName.startsWith('reinsert')) {\r\n handleReinsert(funcName.substr(8).toLowerCase(), params);\r\n }\r\n else if (funcName.startsWith('reupload')) {\r\n handleReupload(funcName.substr(8).toLowerCase(), params);\r\n }\r\n else if (funcName === 'insertRemoteImage') {\r\n uploadRemoteImage(params);\r\n }\r\n return true;\r\n}\r\nvar uploadFiles = new Map();\r\nvar fileCounter = 1;\r\nfunction chooseAndUpload(type) {\r\n var input = document.createElement('input');\r\n input.setAttribute('type', 'file');\r\n if (type === 'image') {\r\n input.setAttribute('multiple', '');\r\n input.setAttribute('accept', 'image/*');\r\n }\r\n else if (type === 'video') {\r\n input.setAttribute('accept', 'video/mp4');\r\n }\r\n input.addEventListener('change', function () {\r\n var length = input.files.length;\r\n if (!length) {\r\n return;\r\n }\r\n var promises = [];\r\n var _loop_1 = function (i) {\r\n var file = input.files.item(i);\r\n if (!file ||\r\n (type === 'image' && !file.type.startsWith('image/')) ||\r\n (type === 'video' && file.type !== 'video/mp4')) {\r\n return \"continue\";\r\n }\r\n var id = \"\" + fileCounter++;\r\n promises.push(getMediaInfo(file).then(function (mf) {\r\n return __assign(__assign({}, mf), { id: id, useCounter: 1 });\r\n }));\r\n };\r\n for (var i = 0; i < length; i++) {\r\n _loop_1(i);\r\n }\r\n Promise.all(promises)\r\n .then(function (list) {\r\n var params = list\r\n .sort(function (a, b) { return Number(a.id) - Number(b.id); })\r\n .map(function (uf) {\r\n var param = {\r\n id: uf.id,\r\n url: uf.image.url,\r\n width: uf.image.width,\r\n height: uf.image.height,\r\n };\r\n if (type === 'video') {\r\n param.url = uf.video.url;\r\n param.poster = uf.image.url;\r\n }\r\n return param;\r\n });\r\n window.postMessage({\r\n funcName: type + \"PreviewReceiver\",\r\n params: type === 'image' ? params : params[0],\r\n }, '*');\r\n list.forEach(function (uf) {\r\n uploadFiles.set(uf.id, uf);\r\n handleUpload(type, uf.id);\r\n });\r\n })\r\n .catch(console.log);\r\n });\r\n input.click();\r\n}\r\nfunction getMediaInfo(file) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var mf, promises, imageFileType_1, imageFilename_1, setBuffAndHash;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n mf = {\r\n image: {\r\n file: file,\r\n buff: new ArrayBuffer(0),\r\n hash: '',\r\n url: '',\r\n width: 0,\r\n height: 0,\r\n },\r\n };\r\n promises = [];\r\n if (!file.type.startsWith('video/')) return [3 /*break*/, 2];\r\n mf.video = {\r\n file: file,\r\n buff: new ArrayBuffer(0),\r\n hash: '',\r\n url: URL.createObjectURL(file),\r\n width: 0,\r\n height: 0,\r\n };\r\n imageFileType_1 = \"image/png\";\r\n imageFilename_1 = file.name + \".png\";\r\n return [4 /*yield*/, new Promise(function (resolve, reject) {\r\n var video = document.createElement('video');\r\n video.addEventListener('loadeddata', function () {\r\n video.pause();\r\n video.currentTime = 0;\r\n mf.video.width = mf.image.width = video.videoWidth;\r\n mf.video.height = mf.image.height = video.videoHeight;\r\n var canvas = document.createElement('canvas');\r\n canvas.setAttribute('width', \"\" + mf.image.width);\r\n canvas.setAttribute('height', \"\" + mf.image.height);\r\n var ctx = canvas.getContext('2d');\r\n if (!ctx) {\r\n reject(new Error('无法提取到视频封面'));\r\n }\r\n else {\r\n ctx.drawImage(video, 0, 0, mf.image.width, mf.image.height);\r\n canvas.toBlob(function (blob) {\r\n if (!blob || blob.size <= 0) {\r\n reject(new Error('无法提取到视频封面'));\r\n }\r\n else {\r\n var file_1 = new File([blob], imageFilename_1, { type: blob.type });\r\n mf.image.url = URL.createObjectURL(file_1);\r\n mf.image.file = file_1;\r\n resolve();\r\n }\r\n }, imageFileType_1);\r\n }\r\n });\r\n video.autoplay = true;\r\n video.muted = true;\r\n video.src = mf.video.url;\r\n })];\r\n case 1:\r\n _a.sent();\r\n return [3 /*break*/, 3];\r\n case 2:\r\n mf.image.url = URL.createObjectURL(mf.image.file);\r\n promises.push(new Promise(function (resolve, reject) {\r\n var img = document.createElement('img');\r\n img.addEventListener('load', function () {\r\n mf.image.width = img.naturalWidth;\r\n mf.image.height = img.naturalHeight;\r\n resolve();\r\n });\r\n img.addEventListener('error', function () {\r\n reject(new Error('图片加载异常'));\r\n });\r\n img.src = mf.image.url;\r\n }));\r\n _a.label = 3;\r\n case 3:\r\n setBuffAndHash = function (info) {\r\n return new Promise(function (resolve, reject) {\r\n var reader = new FileReader();\r\n reader.addEventListener('load', function () {\r\n var spark = new spark_md5_default.a.ArrayBuffer();\r\n info.buff = reader.result;\r\n info.hash = spark.append(info.buff).end();\r\n resolve();\r\n });\r\n reader.addEventListener('error', function () {\r\n reject(new Error('读取文件异常'));\r\n });\r\n reader.readAsArrayBuffer(info.file);\r\n });\r\n };\r\n promises.push(setBuffAndHash(mf.image));\r\n if (mf.video) {\r\n promises.push(setBuffAndHash(mf.video));\r\n }\r\n return [4 /*yield*/, Promise.all(promises)];\r\n case 4:\r\n _a.sent();\r\n return [2 /*return*/, mf];\r\n }\r\n });\r\n });\r\n}\r\nfunction uploadRemoteImage(params) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var id, contentType_1, filename_1, _a, blob, file, buff, spark, hash, error_1, buff;\r\n return __generator(this, function (_b) {\r\n switch (_b.label) {\r\n case 0:\r\n id = \"\" + fileCounter++;\r\n window.postMessage({\r\n funcName: \"uploadRemoteImage\",\r\n params: { id: id, remoteId: params.remoteId },\r\n }, '*');\r\n _b.label = 1;\r\n case 1:\r\n _b.trys.push([1, 3, , 4]);\r\n contentType_1 = 'image/png';\r\n filename_1 = Date.now() + \".png\";\r\n return [4 /*yield*/, new Promise(function (resolve, reject) {\r\n var img = document.createElement('img');\r\n img.addEventListener('load', function () {\r\n console.log('here');\r\n var canvas = document.createElement('canvas');\r\n canvas.setAttribute('width', \"\" + params.width);\r\n canvas.setAttribute('height', \"\" + params.height);\r\n var ctx = canvas.getContext('2d');\r\n ctx.drawImage(img, 0, 0, params.width, params.height);\r\n canvas.toBlob(function (blob) {\r\n if (!blob) {\r\n return reject();\r\n }\r\n var reader = new FileReader();\r\n reader.addEventListener('load', function () {\r\n var buff = reader.result;\r\n var file = new File([blob], filename_1, { type: contentType_1 });\r\n resolve({ blob: blob, file: file, buff: buff });\r\n });\r\n reader.addEventListener('error', function () { return reject(); });\r\n reader.readAsArrayBuffer(blob);\r\n }, contentType_1);\r\n });\r\n img.addEventListener('error', function () { return reject(); });\r\n img.crossOrigin = 'anonymous';\r\n img.src = params.src;\r\n })];\r\n case 2:\r\n _a = _b.sent(), blob = _a.blob, file = _a.file, buff = _a.buff;\r\n spark = new spark_md5_default.a.ArrayBuffer();\r\n hash = spark.append(buff).end();\r\n uploadFiles.set(id, {\r\n id: id,\r\n useCounter: 1,\r\n image: {\r\n file: file,\r\n buff: buff,\r\n hash: hash,\r\n url: params.src,\r\n width: params.width,\r\n height: params.height,\r\n },\r\n });\r\n return [3 /*break*/, 4];\r\n case 3:\r\n error_1 = _b.sent();\r\n buff = new ArrayBuffer(0);\r\n uploadFiles.set(id, {\r\n id: id,\r\n useCounter: 1,\r\n image: {\r\n file: new File([buff], 'empty'),\r\n buff: buff,\r\n hash: '',\r\n url: params.src,\r\n width: params.width,\r\n height: params.height,\r\n },\r\n error: '无法下载远程图片,请手动上传',\r\n });\r\n return [3 /*break*/, 4];\r\n case 4:\r\n handleUpload('image', id);\r\n return [2 /*return*/];\r\n }\r\n });\r\n });\r\n}\r\nfunction handleUpload(type, id) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var uf, upload, params, _a, node, url, results, video, poster, e_1, message;\r\n var _this = this;\r\n return __generator(this, function (_b) {\r\n switch (_b.label) {\r\n case 0:\r\n uf = uploadFiles.get(id);\r\n if (!uf || (uf.status && ['UPLOADING', 'SUCCESS'].includes(uf.status))) {\r\n return [2 /*return*/];\r\n }\r\n _b.label = 1;\r\n case 1:\r\n _b.trys.push([1, 6, , 7]);\r\n if (uf.error) {\r\n throw new Error(uf.error);\r\n }\r\n upload = function (info) { return __awaiter(_this, void 0, void 0, function () {\r\n var source, _a, uri, method, headers, form, fileKey, data, keys, _b, node, url;\r\n return __generator(this, function (_c) {\r\n switch (_c.label) {\r\n case 0:\r\n source = axios_default.a.CancelToken.source();\r\n uf.cancelUpload = source.cancel.bind(source);\r\n return [4 /*yield*/, axios_default.a.post('storage', {\r\n hash: info.hash,\r\n storage: storage,\r\n size: info.file.size,\r\n filename: info.file.name,\r\n mime_type: info.file.type,\r\n }, {\r\n headers: {\r\n Authorization: userToken,\r\n Accept: 'application/json, */*',\r\n },\r\n baseURL: apiV2BaseUrl,\r\n validateStatus: function (s) { return s === 200 || s === 201; },\r\n cancelToken: source.token,\r\n })];\r\n case 1:\r\n _a = (_c.sent()).data, uri = _a.uri, method = _a.method, headers = _a.headers, form = _a.form, fileKey = _a.file_key;\r\n data = info.buff;\r\n if (form || fileKey) {\r\n data = new FormData();\r\n data.append(fileKey, info.file);\r\n keys = Object.keys(form || {});\r\n if (keys.length) {\r\n keys.forEach(function (key) { return data.append(key, form[key]); });\r\n }\r\n }\r\n source = axios_default.a.CancelToken.source();\r\n uf.cancelUpload = source.cancel.bind(source);\r\n return [4 /*yield*/, axios_default.a.request({\r\n url: uri,\r\n method: method,\r\n headers: headers,\r\n data: data,\r\n onUploadProgress: function (pe) {\r\n if (pe.lengthComputable) {\r\n if (type === 'image' || info.file.type.startsWith('video/')) {\r\n window.postMessage({\r\n funcName: type + \"ProgressReceiver\",\r\n params: { id: id, progress: (pe.loaded * 100) / pe.total },\r\n }, '*');\r\n }\r\n }\r\n },\r\n validateStatus: function (s) { return s === 200 || s === 201; },\r\n cancelToken: source.token,\r\n })];\r\n case 2:\r\n _b = (_c.sent()).data, node = _b.node, url = _b.uri;\r\n return [2 /*return*/, { node: node, url: url, fileType: info.file.type }];\r\n }\r\n });\r\n }); };\r\n uf.status = 'UPLOADING';\r\n params = { id: id };\r\n if (!(type === 'image')) return [3 /*break*/, 3];\r\n return [4 /*yield*/, upload(uf.image)];\r\n case 2:\r\n _a = _b.sent(), node = _a.node, url = _a.url;\r\n params.url = url;\r\n params.node = node;\r\n return [3 /*break*/, 5];\r\n case 3:\r\n if (!(type === 'video')) return [3 /*break*/, 5];\r\n return [4 /*yield*/, Promise.all([upload(uf.image), upload(uf.video)])];\r\n case 4:\r\n results = _b.sent();\r\n video = void 0, poster = void 0;\r\n if (results[0].fileType.startsWith('video/')) {\r\n video = results[0];\r\n poster = results[1];\r\n }\r\n else {\r\n video = results[1];\r\n poster = results[0];\r\n }\r\n params.url = video.url;\r\n params.urlNode = video.node;\r\n params.poster = poster.url;\r\n params.posterNode = poster.node;\r\n _b.label = 5;\r\n case 5:\r\n window.postMessage({ funcName: type + \"UrlReceiver\", params: params }, '*');\r\n return [3 /*break*/, 7];\r\n case 6:\r\n e_1 = _b.sent();\r\n /* eslint require-atomic-updates: */\r\n if (axios_default.a.isCancel(e_1)) {\r\n uf.status = 'CANCEL';\r\n }\r\n else {\r\n uf.status = 'ERROR';\r\n message = e_1.message || '网络异常导致上传失败';\r\n if (e_1.response && e_1.response.data) {\r\n message = e_1.response.data.message;\r\n if (Array.isArray(message)) {\r\n message = message[0];\r\n }\r\n message = message || '服务异常导致上传失败';\r\n }\r\n window.postMessage({\r\n funcName: type + \"FailedReceiver\",\r\n params: { id: id, error: message },\r\n }, '*');\r\n }\r\n return [3 /*break*/, 7];\r\n case 7: return [2 /*return*/];\r\n }\r\n });\r\n });\r\n}\r\nfunction handleRemove(type, params) {\r\n var status = params.status;\r\n if (status !== 'UPLOADING') {\r\n return;\r\n }\r\n var uf = uploadFiles.get(params.id);\r\n if (uf && uf.useCounter > 0) {\r\n uf.useCounter -= 1;\r\n if (uf.useCounter === 0 && uf.status === 'UPLOADING') {\r\n uf.cancelUpload();\r\n }\r\n }\r\n}\r\nfunction handleReinsert(type, params) {\r\n var status = params.status;\r\n if (status !== 'UPLOADING') {\r\n return;\r\n }\r\n var uf = uploadFiles.get(params.id);\r\n if (uf) {\r\n uf.useCounter += 1;\r\n if (uf.useCounter === 1 && uf.status === 'CANCEL') {\r\n handleUpload(type, params.id);\r\n }\r\n }\r\n}\r\nfunction handleReupload(type, params) {\r\n handleUpload(type, params.id);\r\n}\r\n\n// CONCATENATED MODULE: ./src/caller.ts\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"a\", function() { return callMethod; });\n\r\n/**\r\n * 调用客户端函数的方法\r\n *\r\n * @param fnName 调用的方法名\r\n * @param params 调用方法传参\r\n */\r\nfunction callMethod(fnName, params) {\r\n if (params === void 0) { params = undefined; }\r\n if (window.debug) {\r\n console.log('debug callMethod', fnName, params); // eslint-disable-line no-console\r\n }\r\n if (window.launcher) {\r\n // in Android\r\n if (typeof window.launcher[fnName] === 'function') {\r\n if (params) {\r\n window.launcher[fnName](JSON.stringify(params));\r\n }\r\n else {\r\n window.launcher[fnName]();\r\n }\r\n }\r\n }\r\n else if (window.webkit && window.webkit.messageHandlers) {\r\n // in IOS\r\n window.webkit.messageHandlers.MobilePhoneCall.postMessage({ funcName: fnName, params: params });\r\n }\r\n else if (window.self != window.parent) {\r\n // in iframe\r\n if (!tryHijackUploadCall(fnName, params)) {\r\n window.parent.postMessage({ funcName: fnName, params: params }, '*');\r\n }\r\n }\r\n else {\r\n // not in webview\r\n tryHijackUploadCall(fnName, params);\r\n return false;\r\n }\r\n return true;\r\n}\r\nvar FuncName;\r\n(function (FuncName) {\r\n FuncName[\"setUploaderOptions\"] = \"setUploaderOptions\";\r\n FuncName[\"setContentReceiver\"] = \"setContentReceiver\";\r\n FuncName[\"imagePreviewReceiver\"] = \"imagePreviewReceiver\";\r\n FuncName[\"imageProgressReceiver\"] = \"imageProgressReceiver\";\r\n FuncName[\"imageUrlReceiver\"] = \"imageUrlReceiver\";\r\n FuncName[\"imageFailedReceiver\"] = \"imageFailedReceiver\";\r\n FuncName[\"videoPreviewReceiver\"] = \"videoPreviewReceiver\";\r\n FuncName[\"videoProgressReceiver\"] = \"videoProgressReceiver\";\r\n FuncName[\"videoUrlReceiver\"] = \"videoUrlReceiver\";\r\n FuncName[\"videoFailedReceiver\"] = \"videoFailedReceiver\";\r\n FuncName[\"editorSubmitReceiver\"] = \"editorSubmitReceiver\";\r\n FuncName[\"changePlaceholder\"] = \"changePlaceholder\";\r\n FuncName[\"pageHiddenReceiver\"] = \"pageHiddenReceiver\";\r\n})(FuncName || (FuncName = {}));\r\nvar postMessage = window.postMessage;\r\nwindow.postMessage = function (message, targetOrigin, transfer) {\r\n if (targetOrigin === void 0) { targetOrigin = '*'; }\r\n postMessage(message, targetOrigin, transfer);\r\n};\r\nwindow.addEventListener('message', function (e) {\r\n var funcName = (e.data || {}).funcName;\r\n if (funcName && typeof window[funcName] === 'function') {\r\n var params = (e.data || {}).params;\r\n if (!['changePlaceholder', 'setContentReceiver'].includes(funcName)) {\r\n params = params && JSON.stringify(params);\r\n }\r\n window[funcName](params);\r\n }\r\n});\r\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMS5qcyIsInNvdXJjZXMiOlsid2VicGFjazovLy8uL3NyY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aWQpIC0gTnVtYmVyKGIuaWQpKVxuICAgICAgICAgIC5tYXAodWYgPT4ge1xuICAgICAgICAgICAgY29uc3QgcGFyYW06IGFueSA9IHtcbiAgICAgICAgICAgICAgaWQ6IHVmLmlkLFxuICAgICAgICAgICAgICB1cmw6IHVmLmltYWdlLnVybCxcbiAgICAgICAgICAgICAgd2lkdGg6IHVmLmltYWdlLndpZHRoLFxuICAgICAgICAgICAgICBoZWlnaHQ6IHVmLmltYWdlLmhlaWdodCxcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmICh0eXBlID09PSAndmlkZW8nKSB7XG4gICAgICAgICAgICAgIHBhcmFtLnVybCA9IHVmLnZpZGVvIS51cmxcbiAgICAgICAgICAgICAgcGFyYW0ucG9zdGVyID0gdWYuaW1hZ2UudXJsXG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHJldHVybiBwYXJhbVxuICAgICAgICAgIH0pXG5cbiAgICAgICAgd2luZG93LnBvc3RNZXNzYWdlKFxuICAgICAgICAgIHtcbiAgICAgICAgICAgIGZ1bmNOYW1lOiBgJHt0eXBlfVByZXZpZXdSZWNlaXZlcmAsXG4gICAgICAgICAgICBwYXJhbXM6IHR5cGUgPT09ICdpbWFnZScgPyBwYXJhbXMgOiBwYXJhbXNbMF0sXG4gICAgICAgICAgfSxcbiAgICAgICAgICAnKicsXG4gICAgICAgIClcblxuICAgICAgICBsaXN0LmZvckVhY2godWYgPT4ge1xuICAgICAgICAgIHVwbG9hZEZpbGVzLnNldCh1Zi5pZCwgdWYpXG4gICAgICAgICAgaGFuZGxlVXBsb2FkKHR5cGUsIHVmLmlkKVxuICAgICAgICB9KVxuICAgICAgfSlcbiAgICAgIC5jYXRjaChjb25zb2xlLmxvZylcbiAgfSlcblxuICBpbnB1dC5jbGljaygpXG59XG5cbmFzeW5jIGZ1bmN0aW9uIGdldE1lZGlhSW5mbyhmaWxlOiBGaWxlKSB7XG4gIGNvbnN0IG1mOiBNZWRpYUZpbGUgPSB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maWxlIjoiMi5qcyIsInNvdXJjZXMiOlsid2VicGFjazovLy8uL25vZGVfbW9kdWxlcy9heGlvcy9pbmRleC5qcz9iYzNhIl0sInNvdXJjZXNDb250ZW50IjpbIm1vZHVsZS5leHBvcnRzID0gcmVxdWlyZSgnLi9saWIvYXhpb3MnKTsiXSwibWFwcGluZ3MiOiJBQUFBIiwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///2\n")},function(module,exports,__webpack_require__){eval("/* WEBPACK VAR INJECTION */(function(Buffer) {/*!\n * Quill Editor v1.3.7\n * https://quilljs.com/\n * Copyright (c) 2014, Jason Chen\n * Copyright (c) 2013, salesforce.com\n */\n(function webpackUniversalModuleDefinition(root, factory) {\n\tif(true)\n\t\tmodule.exports = factory();\n\telse {}\n})(typeof self !== 'undefined' ? self : this, function() {\nreturn /******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, {\n/******/ \t\t\t\tconfigurable: false,\n/******/ \t\t\t\tenumerable: true,\n/******/ \t\t\t\tget: getter\n/******/ \t\t\t});\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = 109);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar container_1 = __webpack_require__(17);\nvar format_1 = __webpack_require__(18);\nvar leaf_1 = __webpack_require__(19);\nvar scroll_1 = __webpack_require__(45);\nvar inline_1 = __webpack_require__(46);\nvar block_1 = __webpack_require__(47);\nvar embed_1 = __webpack_require__(48);\nvar text_1 = __webpack_require__(49);\nvar attributor_1 = __webpack_require__(12);\nvar class_1 = __webpack_require__(32);\nvar style_1 = __webpack_require__(33);\nvar store_1 = __webpack_require__(31);\nvar Registry = __webpack_require__(1);\nvar Parchment = {\n Scope: Registry.Scope,\n create: Registry.create,\n find: Registry.find,\n query: Registry.query,\n register: Registry.register,\n Container: container_1.default,\n Format: format_1.default,\n Leaf: leaf_1.default,\n Embed: embed_1.default,\n Scroll: scroll_1.default,\n Block: block_1.default,\n Inline: inline_1.default,\n Text: text_1.default,\n Attributor: {\n Attribute: attributor_1.default,\n Class: class_1.default,\n Style: style_1.default,\n Store: store_1.default,\n },\n};\nexports.default = Parchment;\n\n\n/***/ }),\n/* 1 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar ParchmentError = /** @class */ (function (_super) {\n __extends(ParchmentError, _super);\n function ParchmentError(message) {\n var _this = this;\n message = '[Parchment] ' + message;\n _this = _super.call(this, message) || this;\n _this.message = message;\n _this.name = _this.constructor.name;\n return _this;\n }\n return ParchmentError;\n}(Error));\nexports.ParchmentError = ParchmentError;\nvar attributes = {};\nvar classes = {};\nvar tags = {};\nvar types = {};\nexports.DATA_KEY = '__blot';\nvar Scope;\n(function (Scope) {\n Scope[Scope[\"TYPE\"] = 3] = \"TYPE\";\n Scope[Scope[\"LEVEL\"] = 12] = \"LEVEL\";\n Scope[Scope[\"ATTRIBUTE\"] = 13] = \"ATTRIBUTE\";\n Scope[Scope[\"BLOT\"] = 14] = \"BLOT\";\n Scope[Scope[\"INLINE\"] = 7] = \"INLINE\";\n Scope[Scope[\"BLOCK\"] = 11] = \"BLOCK\";\n Scope[Scope[\"BLOCK_BLOT\"] = 10] = \"BLOCK_BLOT\";\n Scope[Scope[\"INLINE_BLOT\"] = 6] = \"INLINE_BLOT\";\n Scope[Scope[\"BLOCK_ATTRIBUTE\"] = 9] = \"BLOCK_ATTRIBUTE\";\n Scope[Scope[\"INLINE_ATTRIBUTE\"] = 5] = \"INLINE_ATTRIBUTE\";\n Scope[Scope[\"ANY\"] = 15] = \"ANY\";\n})(Scope = exports.Scope || (exports.Scope = {}));\nfunction create(input, value) {\n var match = query(input);\n if (match == null) {\n throw new ParchmentError(\"Unable to create \" + input + \" blot\");\n }\n var BlotClass = match;\n var node = \n // @ts-ignore\n input instanceof Node || input['nodeType'] === Node.TEXT_NODE ? input : BlotClass.create(value);\n return new BlotClass(node, value);\n}\nexports.create = create;\nfunction find(node, bubble) {\n if (bubble === void 0) { bubble = false; }\n if (node == null)\n return null;\n // @ts-ignore\n if (node[exports.DATA_KEY] != null)\n return node[exports.DATA_KEY].blot;\n if (bubble)\n return find(node.parentNode, bubble);\n return null;\n}\nexports.find = find;\nfunction query(query, scope) {\n if (scope === void 0) { scope = Scope.ANY; }\n var match;\n if (typeof query === 'string') {\n match = types[query] || attributes[query];\n // @ts-ignore\n }\n else if (query instanceof Text || query['nodeType'] === Node.TEXT_NODE) {\n match = types['text'];\n }\n else if (typeof query === 'number') {\n if (query & Scope.LEVEL & Scope.BLOCK) {\n match = types['block'];\n }\n else if (query & Scope.LEVEL & Scope.INLINE) {\n match = types['inline'];\n }\n }\n else if (query instanceof HTMLElement) {\n var names = (query.getAttribute('class') || '').split(/\\s+/);\n for (var i in names) {\n match = classes[names[i]];\n if (match)\n break;\n }\n match = match || tags[query.tagName];\n }\n if (match == null)\n return null;\n // @ts-ignore\n if (scope & Scope.LEVEL & match.scope && scope & Scope.TYPE & match.scope)\n return match;\n return null;\n}\nexports.query = query;\nfunction register() {\n var Definitions = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n Definitions[_i] = arguments[_i];\n }\n if (Definitions.length > 1) {\n return Definitions.map(function (d) {\n return register(d);\n });\n }\n var Definition = Definitions[0];\n if (typeof Definition.blotName !== 'string' && typeof Definition.attrName !== 'string') {\n throw new ParchmentError('Invalid definition');\n }\n else if (Definition.blotName === 'abstract') {\n throw new ParchmentError('Cannot register abstract class');\n }\n types[Definition.blotName || Definition.attrName] = Definition;\n if (typeof Definition.keyName === 'string') {\n attributes[Definition.keyName] = Definition;\n }\n else {\n if (Definition.className != null) {\n classes[Definition.className] = Definition;\n }\n if (Definition.tagName != null) {\n if (Array.isArray(Definition.tagName)) {\n Definition.tagName = Definition.tagName.map(function (tagName) {\n return tagName.toUpperCase();\n });\n }\n else {\n Definition.tagName = Definition.tagName.toUpperCase();\n }\n var tagNames = Array.isArray(Definition.tagName) ? Definition.tagName : [Definition.tagName];\n tagNames.forEach(function (tag) {\n if (tags[tag] == null || Definition.className == null) {\n tags[tag] = Definition;\n }\n });\n }\n }\n return Definition;\n}\nexports.register = register;\n\n\n/***/ }),\n/* 2 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar diff = __webpack_require__(51);\nvar equal = __webpack_require__(11);\nvar extend = __webpack_require__(3);\nvar op = __webpack_require__(20);\n\n\nvar NULL_CHARACTER = String.fromCharCode(0); // Placeholder char for embed in diff()\n\n\nvar Delta = function (ops) {\n // Assume we are given a well formed ops\n if (Array.isArray(ops)) {\n this.ops = ops;\n } else if (ops != null && Array.isArray(ops.ops)) {\n this.ops = ops.ops;\n } else {\n this.ops = [];\n }\n};\n\n\nDelta.prototype.insert = function (text, attributes) {\n var newOp = {};\n if (text.length === 0) return this;\n newOp.insert = text;\n if (attributes != null && typeof attributes === 'object' && Object.keys(attributes).length > 0) {\n newOp.attributes = attributes;\n }\n return this.push(newOp);\n};\n\nDelta.prototype['delete'] = function (length) {\n if (length <= 0) return this;\n return this.push({ 'delete': length });\n};\n\nDelta.prototype.retain = function (length, attributes) {\n if (length <= 0) return this;\n var newOp = { retain: length };\n if (attributes != null && typeof attributes === 'object' && Object.keys(attributes).length > 0) {\n newOp.attributes = attributes;\n }\n return this.push(newOp);\n};\n\nDelta.prototype.push = function (newOp) {\n var index = this.ops.length;\n var lastOp = this.ops[index - 1];\n newOp = extend(true, {}, newOp);\n if (typeof lastOp === 'object') {\n if (typeof newOp['delete'] === 'number' && typeof lastOp['delete'] === 'number') {\n this.ops[index - 1] = { 'delete': lastOp['delete'] + newOp['delete'] };\n return this;\n }\n // Since it does not matter if we insert before or after deleting at the same index,\n // always prefer to insert first\n if (typeof lastOp['delete'] === 'number' && newOp.insert != null) {\n index -= 1;\n lastOp = this.ops[index - 1];\n if (typeof lastOp !== 'object') {\n this.ops.unshift(newOp);\n return this;\n }\n }\n if (equal(newOp.attributes, lastOp.attributes)) {\n if (typeof newOp.insert === 'string' && typeof lastOp.insert === 'string') {\n this.ops[index - 1] = { insert: lastOp.insert + newOp.insert };\n if (typeof newOp.attributes === 'object') this.ops[index - 1].attributes = newOp.attributes\n return this;\n } else if (typeof newOp.retain === 'number' && typeof lastOp.retain === 'number') {\n this.ops[index - 1] = { retain: lastOp.retain + newOp.retain };\n if (typeof newOp.attributes === 'object') this.ops[index - 1].attributes = newOp.attributes\n return this;\n }\n }\n }\n if (index === this.ops.length) {\n this.ops.push(newOp);\n } else {\n this.ops.splice(index, 0, newOp);\n }\n return this;\n};\n\nDelta.prototype.chop = function () {\n var lastOp = this.ops[this.ops.length - 1];\n if (lastOp && lastOp.retain && !lastOp.attributes) {\n this.ops.pop();\n }\n return this;\n};\n\nDelta.prototype.filter = function (predicate) {\n return this.ops.filter(predicate);\n};\n\nDelta.prototype.forEach = function (predicate) {\n this.ops.forEach(predicate);\n};\n\nDelta.prototype.map = function (predicate) {\n return this.ops.map(predicate);\n};\n\nDelta.prototype.partition = function (predicate) {\n var passed = [], failed = [];\n this.forEach(function(op) {\n var target = predicate(op) ? passed : failed;\n target.push(op);\n });\n return [passed, failed];\n};\n\nDelta.prototype.reduce = function (predicate, initial) {\n return this.ops.reduce(predicate, initial);\n};\n\nDelta.prototype.changeLength = function () {\n return this.reduce(function (length, elem) {\n if (elem.insert) {\n return length + op.length(elem);\n } else if (elem.delete) {\n return length - elem.delete;\n }\n return length;\n }, 0);\n};\n\nDelta.prototype.length = function () {\n return this.reduce(function (length, elem) {\n return length + op.length(elem);\n }, 0);\n};\n\nDelta.prototype.slice = function (start, end) {\n start = start || 0;\n if (typeof end !== 'number') end = Infinity;\n var ops = [];\n var iter = op.iterator(this.ops);\n var index = 0;\n while (index < end && iter.hasNext()) {\n var nextOp;\n if (index < start) {\n nextOp = iter.next(start - index);\n } else {\n nextOp = iter.next(end - index);\n ops.push(nextOp);\n }\n index += op.length(nextOp);\n }\n return new Delta(ops);\n};\n\n\nDelta.prototype.compose = function (other) {\n var thisIter = op.iterator(this.ops);\n var otherIter = op.iterator(other.ops);\n var ops = [];\n var firstOther = otherIter.peek();\n if (firstOther != null && typeof firstOther.retain === 'number' && firstOther.attributes == null) {\n var firstLeft = firstOther.retain;\n while (thisIter.peekType() === 'insert' && thisIter.peekLength() <= firstLeft) {\n firstLeft -= thisIter.peekLength();\n ops.push(thisIter.next());\n }\n if (firstOther.retain - firstLeft > 0) {\n otherIter.next(firstOther.retain - firstLeft);\n }\n }\n var delta = new Delta(ops);\n while (thisIter.hasNext() || otherIter.hasNext()) {\n if (otherIter.peekType() === 'insert') {\n delta.push(otherIter.next());\n } else if (thisIter.peekType() === 'delete') {\n delta.push(thisIter.next());\n } else {\n var length = Math.min(thisIter.peekLength(), otherIter.peekLength());\n var thisOp = thisIter.next(length);\n var otherOp = otherIter.next(length);\n if (typeof otherOp.retain === 'number') {\n var newOp = {};\n if (typeof thisOp.retain === 'number') {\n newOp.retain = length;\n } else {\n newOp.insert = thisOp.insert;\n }\n // Preserve null when composing with a retain, otherwise remove it for inserts\n var attributes = op.attributes.compose(thisOp.attributes, otherOp.attributes, typeof thisOp.retain === 'number');\n if (attributes) newOp.attributes = attributes;\n delta.push(newOp);\n\n // Optimization if rest of other is just retain\n if (!otherIter.hasNext() && equal(delta.ops[delta.ops.length - 1], newOp)) {\n var rest = new Delta(thisIter.rest());\n return delta.concat(rest).chop();\n }\n\n // Other op should be delete, we could be an insert or retain\n // Insert + delete cancels out\n } else if (typeof otherOp['delete'] === 'number' && typeof thisOp.retain === 'number') {\n delta.push(otherOp);\n }\n }\n }\n return delta.chop();\n};\n\nDelta.prototype.concat = function (other) {\n var delta = new Delta(this.ops.slice());\n if (other.ops.length > 0) {\n delta.push(other.ops[0]);\n delta.ops = delta.ops.concat(other.ops.slice(1));\n }\n return delta;\n};\n\nDelta.prototype.diff = function (other, index) {\n if (this.ops === other.ops) {\n return new Delta();\n }\n var strings = [this, other].map(function (delta) {\n return delta.map(function (op) {\n if (op.insert != null) {\n return typeof op.insert === 'string' ? op.insert : NULL_CHARACTER;\n }\n var prep = (delta === other) ? 'on' : 'with';\n throw new Error('diff() called ' + prep + ' non-document');\n }).join('');\n });\n var delta = new Delta();\n var diffResult = diff(strings[0], strings[1], index);\n var thisIter = op.iterator(this.ops);\n var otherIter = op.iterator(other.ops);\n diffResult.forEach(function (component) {\n var length = component[1].length;\n while (length > 0) {\n var opLength = 0;\n switch (component[0]) {\n case diff.INSERT:\n opLength = Math.min(otherIter.peekLength(), length);\n delta.push(otherIter.next(opLength));\n break;\n case diff.DELETE:\n opLength = Math.min(length, thisIter.peekLength());\n thisIter.next(opLength);\n delta['delete'](opLength);\n break;\n case diff.EQUAL:\n opLength = Math.min(thisIter.peekLength(), otherIter.peekLength(), length);\n var thisOp = thisIter.next(opLength);\n var otherOp = otherIter.next(opLength);\n if (equal(thisOp.insert, otherOp.insert)) {\n delta.retain(opLength, op.attributes.diff(thisOp.attributes, otherOp.attributes));\n } else {\n delta.push(otherOp)['delete'](opLength);\n }\n break;\n }\n length -= opLength;\n }\n });\n return delta.chop();\n};\n\nDelta.prototype.eachLine = function (predicate, newline) {\n newline = newline || '\\n';\n var iter = op.iterator(this.ops);\n var line = new Delta();\n var i = 0;\n while (iter.hasNext()) {\n if (iter.peekType() !== 'insert') return;\n var thisOp = iter.peek();\n var start = op.length(thisOp) - iter.peekLength();\n var index = typeof thisOp.insert === 'string' ?\n thisOp.insert.indexOf(newline, start) - start : -1;\n if (index < 0) {\n line.push(iter.next());\n } else if (index > 0) {\n line.push(iter.next(index));\n } else {\n if (predicate(line, iter.next(1).attributes || {}, i) === false) {\n return;\n }\n i += 1;\n line = new Delta();\n }\n }\n if (line.length() > 0) {\n predicate(line, {}, i);\n }\n};\n\nDelta.prototype.transform = function (other, priority) {\n priority = !!priority;\n if (typeof other === 'number') {\n return this.transformPosition(other, priority);\n }\n var thisIter = op.iterator(this.ops);\n var otherIter = op.iterator(other.ops);\n var delta = new Delta();\n while (thisIter.hasNext() || otherIter.hasNext()) {\n if (thisIter.peekType() === 'insert' && (priority || otherIter.peekType() !== 'insert')) {\n delta.retain(op.length(thisIter.next()));\n } else if (otherIter.peekType() === 'insert') {\n delta.push(otherIter.next());\n } else {\n var length = Math.min(thisIter.peekLength(), otherIter.peekLength());\n var thisOp = thisIter.next(length);\n var otherOp = otherIter.next(length);\n if (thisOp['delete']) {\n // Our delete either makes their delete redundant or removes their retain\n continue;\n } else if (otherOp['delete']) {\n delta.push(otherOp);\n } else {\n // We retain either their retain or insert\n delta.retain(length, op.attributes.transform(thisOp.attributes, otherOp.attributes, priority));\n }\n }\n }\n return delta.chop();\n};\n\nDelta.prototype.transformPosition = function (index, priority) {\n priority = !!priority;\n var thisIter = op.iterator(this.ops);\n var offset = 0;\n while (thisIter.hasNext() && offset <= index) {\n var length = thisIter.peekLength();\n var nextType = thisIter.peekType();\n thisIter.next();\n if (nextType === 'delete') {\n index -= Math.min(length, index - offset);\n continue;\n } else if (nextType === 'insert' && (offset < index || !priority)) {\n index += length;\n }\n offset += length;\n }\n return index;\n};\n\n\nmodule.exports = Delta;\n\n\n/***/ }),\n/* 3 */\n/***/ (function(module, exports) {\n\n'use strict';\n\nvar hasOwn = Object.prototype.hasOwnProperty;\nvar toStr = Object.prototype.toString;\nvar defineProperty = Object.defineProperty;\nvar gOPD = Object.getOwnPropertyDescriptor;\n\nvar isArray = function isArray(arr) {\n\tif (typeof Array.isArray === 'function') {\n\t\treturn Array.isArray(arr);\n\t}\n\n\treturn toStr.call(arr) === '[object Array]';\n};\n\nvar isPlainObject = function isPlainObject(obj) {\n\tif (!obj || toStr.call(obj) !== '[object Object]') {\n\t\treturn false;\n\t}\n\n\tvar hasOwnConstructor = hasOwn.call(obj, 'constructor');\n\tvar hasIsPrototypeOf = obj.constructor && obj.constructor.prototype && hasOwn.call(obj.constructor.prototype, 'isPrototypeOf');\n\t// Not own constructor property must be Object\n\tif (obj.constructor && !hasOwnConstructor && !hasIsPrototypeOf) {\n\t\treturn false;\n\t}\n\n\t// Own properties are enumerated firstly, so to speed up,\n\t// if last one is own, then all properties are own.\n\tvar key;\n\tfor (key in obj) { /**/ }\n\n\treturn typeof key === 'undefined' || hasOwn.call(obj, key);\n};\n\n// If name is '__proto__', and Object.defineProperty is available, define __proto__ as an own property on target\nvar setProperty = function setProperty(target, options) {\n\tif (defineProperty && options.name === '__proto__') {\n\t\tdefineProperty(target, options.name, {\n\t\t\tenumerable: true,\n\t\t\tconfigurable: true,\n\t\t\tvalue: options.newValue,\n\t\t\twritable: true\n\t\t});\n\t} else {\n\t\ttarget[options.name] = options.newValue;\n\t}\n};\n\n// Return undefined instead of __proto__ if '__proto__' is not an own property\nvar getProperty = function getProperty(obj, name) {\n\tif (name === '__proto__') {\n\t\tif (!hasOwn.call(obj, name)) {\n\t\t\treturn void 0;\n\t\t} else if (gOPD) {\n\t\t\t// In early versions of node, obj['__proto__'] is buggy when obj has\n\t\t\t// __proto__ as an own property. Object.getOwnPropertyDescriptor() works.\n\t\t\treturn gOPD(obj, name).value;\n\t\t}\n\t}\n\n\treturn obj[name];\n};\n\nmodule.exports = function extend() {\n\tvar options, name, src, copy, copyIsArray, clone;\n\tvar target = arguments[0];\n\tvar i = 1;\n\tvar length = arguments.length;\n\tvar deep = false;\n\n\t// Handle a deep copy situation\n\tif (typeof target === 'boolean') {\n\t\tdeep = target;\n\t\ttarget = arguments[1] || {};\n\t\t// skip the boolean and the target\n\t\ti = 2;\n\t}\n\tif (target == null || (typeof target !== 'object' && typeof target !== 'function')) {\n\t\ttarget = {};\n\t}\n\n\tfor (; i < length; ++i) {\n\t\toptions = arguments[i];\n\t\t// Only deal with non-null/undefined values\n\t\tif (options != null) {\n\t\t\t// Extend the base object\n\t\t\tfor (name in options) {\n\t\t\t\tsrc = getProperty(target, name);\n\t\t\t\tcopy = getProperty(options, name);\n\n\t\t\t\t// Prevent never-ending loop\n\t\t\t\tif (target !== copy) {\n\t\t\t\t\t// Recurse if we're merging plain objects or arrays\n\t\t\t\t\tif (deep && copy && (isPlainObject(copy) || (copyIsArray = isArray(copy)))) {\n\t\t\t\t\t\tif (copyIsArray) {\n\t\t\t\t\t\t\tcopyIsArray = false;\n\t\t\t\t\t\t\tclone = src && isArray(src) ? src : [];\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tclone = src && isPlainObject(src) ? src : {};\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Never move original objects, clone them\n\t\t\t\t\t\tsetProperty(target, { name: name, newValue: extend(deep, clone, copy) });\n\n\t\t\t\t\t// Don't bring in undefined values\n\t\t\t\t\t} else if (typeof copy !== 'undefined') {\n\t\t\t\t\t\tsetProperty(target, { name: name, newValue: copy });\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Return the modified object\n\treturn target;\n};\n\n\n/***/ }),\n/* 4 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = exports.BlockEmbed = exports.bubbleFormats = undefined;\n\nvar _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; }; }();\n\nvar _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if (\"value\" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };\n\nvar _extend = __webpack_require__(3);\n\nvar _extend2 = _interopRequireDefault(_extend);\n\nvar _quillDelta = __webpack_require__(2);\n\nvar _quillDelta2 = _interopRequireDefault(_quillDelta);\n\nvar _parchment = __webpack_require__(0);\n\nvar _parchment2 = _interopRequireDefault(_parchment);\n\nvar _break = __webpack_require__(16);\n\nvar _break2 = _interopRequireDefault(_break);\n\nvar _inline = __webpack_require__(6);\n\nvar _inline2 = _interopRequireDefault(_inline);\n\nvar _text = __webpack_require__(7);\n\nvar _text2 = _interopRequireDefault(_text);\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 _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nvar NEWLINE_LENGTH = 1;\n\nvar BlockEmbed = function (_Parchment$Embed) {\n _inherits(BlockEmbed, _Parchment$Embed);\n\n function BlockEmbed() {\n _classCallCheck(this, BlockEmbed);\n\n return _possibleConstructorReturn(this, (BlockEmbed.__proto__ || Object.getPrototypeOf(BlockEmbed)).apply(this, arguments));\n }\n\n _createClass(BlockEmbed, [{\n key: 'attach',\n value: function attach() {\n _get(BlockEmbed.prototype.__proto__ || Object.getPrototypeOf(BlockEmbed.prototype), 'attach', this).call(this);\n this.attributes = new _parchment2.default.Attributor.Store(this.domNode);\n }\n }, {\n key: 'delta',\n value: function delta() {\n return new _quillDelta2.default().insert(this.value(), (0, _extend2.default)(this.formats(), this.attributes.values()));\n }\n }, {\n key: 'format',\n value: function format(name, value) {\n var attribute = _parchment2.default.query(name, _parchment2.default.Scope.BLOCK_ATTRIBUTE);\n if (attribute != null) {\n this.attributes.attribute(attribute, value);\n }\n }\n }, {\n key: 'formatAt',\n value: function formatAt(index, length, name, value) {\n this.format(name, value);\n }\n }, {\n key: 'insertAt',\n value: function insertAt(index, value, def) {\n if (typeof value === 'string' && value.endsWith('\\n')) {\n var block = _parchment2.default.create(Block.blotName);\n this.parent.insertBefore(block, index === 0 ? this : this.next);\n block.insertAt(0, value.slice(0, -1));\n } else {\n _get(BlockEmbed.prototype.__proto__ || Object.getPrototypeOf(BlockEmbed.prototype), 'insertAt', this).call(this, index, value, def);\n }\n }\n }]);\n\n return BlockEmbed;\n}(_parchment2.default.Embed);\n\nBlockEmbed.scope = _parchment2.default.Scope.BLOCK_BLOT;\n// It is important for cursor behavior BlockEmbeds use tags that are block level elements\n\n\nvar Block = function (_Parchment$Block) {\n _inherits(Block, _Parchment$Block);\n\n function Block(domNode) {\n _classCallCheck(this, Block);\n\n var _this2 = _possibleConstructorReturn(this, (Block.__proto__ || Object.getPrototypeOf(Block)).call(this, domNode));\n\n _this2.cache = {};\n return _this2;\n }\n\n _createClass(Block, [{\n key: 'delta',\n value: function delta() {\n if (this.cache.delta == null) {\n this.cache.delta = this.descendants(_parchment2.default.Leaf).reduce(function (delta, leaf) {\n if (leaf.length() === 0) {\n return delta;\n } else {\n return delta.insert(leaf.value(), bubbleFormats(leaf));\n }\n }, new _quillDelta2.default()).insert('\\n', bubbleFormats(this));\n }\n return this.cache.delta;\n }\n }, {\n key: 'deleteAt',\n value: function deleteAt(index, length) {\n _get(Block.prototype.__proto__ || Object.getPrototypeOf(Block.prototype), 'deleteAt', this).call(this, index, length);\n this.cache = {};\n }\n }, {\n key: 'formatAt',\n value: function formatAt(index, length, name, value) {\n if (length <= 0) return;\n if (_parchment2.default.query(name, _parchment2.default.Scope.BLOCK)) {\n if (index + length === this.length()) {\n this.format(name, value);\n }\n } else {\n _get(Block.prototype.__proto__ || Object.getPrototypeOf(Block.prototype), 'formatAt', this).call(this, index, Math.min(length, this.length() - index - 1), name, value);\n }\n this.cache = {};\n }\n }, {\n key: 'insertAt',\n value: function insertAt(index, value, def) {\n if (def != null) return _get(Block.prototype.__proto__ || Object.getPrototypeOf(Block.prototype), 'insertAt', this).call(this, index, value, def);\n if (value.length === 0) return;\n var lines = value.split('\\n');\n var text = lines.shift();\n if (text.length > 0) {\n if (index < this.length() - 1 || this.children.tail == null) {\n _get(Block.prototype.__proto__ || Object.getPrototypeOf(Block.prototype), 'insertAt', this).call(this, Math.min(index, this.length() - 1), text);\n } else {\n this.children.tail.insertAt(this.children.tail.length(), text);\n }\n this.cache = {};\n }\n var block = this;\n lines.reduce(function (index, line) {\n block = block.split(index, true);\n block.insertAt(0, line);\n return line.length;\n }, index + text.length);\n }\n }, {\n key: 'insertBefore',\n value: function insertBefore(blot, ref) {\n var head = this.children.head;\n _get(Block.prototype.__proto__ || Object.getPrototypeOf(Block.prototype), 'insertBefore', this).call(this, blot, ref);\n if (head instanceof _break2.default) {\n head.remove();\n }\n this.cache = {};\n }\n }, {\n key: 'length',\n value: function length() {\n if (this.cache.length == null) {\n this.cache.length = _get(Block.prototype.__proto__ || Object.getPrototypeOf(Block.prototype), 'length', this).call(this) + NEWLINE_LENGTH;\n }\n return this.cache.length;\n }\n }, {\n key: 'moveChildren',\n value: function moveChildren(target, ref) {\n _get(Block.prototype.__proto__ || Object.getPrototypeOf(Block.prototype), 'moveChildren', this).call(this, target, ref);\n this.cache = {};\n }\n }, {\n key: 'optimize',\n value: function optimize(context) {\n _get(Block.prototype.__proto__ || Object.getPrototypeOf(Block.prototype), 'optimize', this).call(this, context);\n this.cache = {};\n }\n }, {\n key: 'path',\n value: function path(index) {\n return _get(Block.prototype.__proto__ || Object.getPrototypeOf(Block.prototype), 'path', this).call(this, index, true);\n }\n }, {\n key: 'removeChild',\n value: function removeChild(child) {\n _get(Block.prototype.__proto__ || Object.getPrototypeOf(Block.prototype), 'removeChild', this).call(this, child);\n this.cache = {};\n }\n }, {\n key: 'split',\n value: function split(index) {\n var force = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n\n if (force && (index === 0 || index >= this.length() - NEWLINE_LENGTH)) {\n var clone = this.clone();\n if (index === 0) {\n this.parent.insertBefore(clone, this);\n return this;\n } else {\n this.parent.insertBefore(clone, this.next);\n return clone;\n }\n } else {\n var next = _get(Block.prototype.__proto__ || Object.getPrototypeOf(Block.prototype), 'split', this).call(this, index, force);\n this.cache = {};\n return next;\n }\n }\n }]);\n\n return Block;\n}(_parchment2.default.Block);\n\nBlock.blotName = 'block';\nBlock.tagName = 'P';\nBlock.defaultChild = 'break';\nBlock.allowedChildren = [_inline2.default, _parchment2.default.Embed, _text2.default];\n\nfunction bubbleFormats(blot) {\n var formats = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n if (blot == null) return formats;\n if (typeof blot.formats === 'function') {\n formats = (0, _extend2.default)(formats, blot.formats());\n }\n if (blot.parent == null || blot.parent.blotName == 'scroll' || blot.parent.statics.scope !== blot.statics.scope) {\n return formats;\n }\n return bubbleFormats(blot.parent, formats);\n}\n\nexports.bubbleFormats = bubbleFormats;\nexports.BlockEmbed = BlockEmbed;\nexports.default = Block;\n\n/***/ }),\n/* 5 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = exports.overload = exports.expandConfig = undefined;\n\nvar _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; };\n\nvar _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_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\"]) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); } }; }();\n\nvar _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; }; }();\n\n__webpack_require__(50);\n\nvar _quillDelta = __webpack_require__(2);\n\nvar _quillDelta2 = _interopRequireDefault(_quillDelta);\n\nvar _editor = __webpack_require__(14);\n\nvar _editor2 = _interopRequireDefault(_editor);\n\nvar _emitter3 = __webpack_require__(8);\n\nvar _emitter4 = _interopRequireDefault(_emitter3);\n\nvar _module = __webpack_require__(9);\n\nvar _module2 = _interopRequireDefault(_module);\n\nvar _parchment = __webpack_require__(0);\n\nvar _parchment2 = _interopRequireDefault(_parchment);\n\nvar _selection = __webpack_require__(15);\n\nvar _selection2 = _interopRequireDefault(_selection);\n\nvar _extend = __webpack_require__(3);\n\nvar _extend2 = _interopRequireDefault(_extend);\n\nvar _logger = __webpack_require__(10);\n\nvar _logger2 = _interopRequireDefault(_logger);\n\nvar _theme = __webpack_require__(34);\n\nvar _theme2 = _interopRequireDefault(_theme);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\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 _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nvar debug = (0, _logger2.default)('quill');\n\nvar Quill = function () {\n _createClass(Quill, null, [{\n key: 'debug',\n value: function debug(limit) {\n if (limit === true) {\n limit = 'log';\n }\n _logger2.default.level(limit);\n }\n }, {\n key: 'find',\n value: function find(node) {\n return node.__quill || _parchment2.default.find(node);\n }\n }, {\n key: 'import',\n value: function _import(name) {\n if (this.imports[name] == null) {\n debug.error('Cannot import ' + name + '. Are you sure it was registered?');\n }\n return this.imports[name];\n }\n }, {\n key: 'register',\n value: function register(path, target) {\n var _this = this;\n\n var overwrite = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;\n\n if (typeof path !== 'string') {\n var name = path.attrName || path.blotName;\n if (typeof name === 'string') {\n // register(Blot | Attributor, overwrite)\n this.register('formats/' + name, path, target);\n } else {\n Object.keys(path).forEach(function (key) {\n _this.register(key, path[key], target);\n });\n }\n } else {\n if (this.imports[path] != null && !overwrite) {\n debug.warn('Overwriting ' + path + ' with', target);\n }\n this.imports[path] = target;\n if ((path.startsWith('blots/') || path.startsWith('formats/')) && target.blotName !== 'abstract') {\n _parchment2.default.register(target);\n } else if (path.startsWith('modules') && typeof target.register === 'function') {\n target.register();\n }\n }\n }\n }]);\n\n function Quill(container) {\n var _this2 = this;\n\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n _classCallCheck(this, Quill);\n\n this.options = expandConfig(container, options);\n this.container = this.options.container;\n if (this.container == null) {\n return debug.error('Invalid Quill container', container);\n }\n if (this.options.debug) {\n Quill.debug(this.options.debug);\n }\n var html = this.container.innerHTML.trim();\n this.container.classList.add('ql-container');\n this.container.innerHTML = '';\n this.container.__quill = this;\n this.root = this.addContainer('ql-editor');\n this.root.classList.add('ql-blank');\n this.root.setAttribute('data-gramm', false);\n this.scrollingContainer = this.options.scrollingContainer || this.root;\n this.emitter = new _emitter4.default();\n this.scroll = _parchment2.default.create(this.root, {\n emitter: this.emitter,\n whitelist: this.options.formats\n });\n this.editor = new _editor2.default(this.scroll);\n this.selection = new _selection2.default(this.scroll, this.emitter);\n this.theme = new this.options.theme(this, this.options);\n this.keyboard = this.theme.addModule('keyboard');\n this.clipboard = this.theme.addModule('clipboard');\n this.history = this.theme.addModule('history');\n this.theme.init();\n this.emitter.on(_emitter4.default.events.EDITOR_CHANGE, function (type) {\n if (type === _emitter4.default.events.TEXT_CHANGE) {\n _this2.root.classList.toggle('ql-blank', _this2.editor.isBlank());\n }\n });\n this.emitter.on(_emitter4.default.events.SCROLL_UPDATE, function (source, mutations) {\n var range = _this2.selection.lastRange;\n var index = range && range.length === 0 ? range.index : undefined;\n modify.call(_this2, function () {\n return _this2.editor.update(null, mutations, index);\n }, source);\n });\n var contents = this.clipboard.convert('
' + html + '


');\n this.setContents(contents);\n this.history.clear();\n if (this.options.placeholder) {\n this.root.setAttribute('data-placeholder', this.options.placeholder);\n }\n if (this.options.readOnly) {\n this.disable();\n }\n }\n\n _createClass(Quill, [{\n key: 'addContainer',\n value: function addContainer(container) {\n var refNode = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;\n\n if (typeof container === 'string') {\n var className = container;\n container = document.createElement('div');\n container.classList.add(className);\n }\n this.container.insertBefore(container, refNode);\n return container;\n }\n }, {\n key: 'blur',\n value: function blur() {\n this.selection.setRange(null);\n }\n }, {\n key: 'deleteText',\n value: function deleteText(index, length, source) {\n var _this3 = this;\n\n var _overload = overload(index, length, source);\n\n var _overload2 = _slicedToArray(_overload, 4);\n\n index = _overload2[0];\n length = _overload2[1];\n source = _overload2[3];\n\n return modify.call(this, function () {\n return _this3.editor.deleteText(index, length);\n }, source, index, -1 * length);\n }\n }, {\n key: 'disable',\n value: function disable() {\n this.enable(false);\n }\n }, {\n key: 'enable',\n value: function enable() {\n var enabled = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;\n\n this.scroll.enable(enabled);\n this.container.classList.toggle('ql-disabled', !enabled);\n }\n }, {\n key: 'focus',\n value: function focus() {\n var scrollTop = this.scrollingContainer.scrollTop;\n this.selection.focus();\n this.scrollingContainer.scrollTop = scrollTop;\n this.scrollIntoView();\n }\n }, {\n key: 'format',\n value: function format(name, value) {\n var _this4 = this;\n\n var source = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _emitter4.default.sources.API;\n\n return modify.call(this, function () {\n var range = _this4.getSelection(true);\n var change = new _quillDelta2.default();\n if (range == null) {\n return change;\n } else if (_parchment2.default.query(name, _parchment2.default.Scope.BLOCK)) {\n change = _this4.editor.formatLine(range.index, range.length, _defineProperty({}, name, value));\n } else if (range.length === 0) {\n _this4.selection.format(name, value);\n return change;\n } else {\n change = _this4.editor.formatText(range.index, range.length, _defineProperty({}, name, value));\n }\n _this4.setSelection(range, _emitter4.default.sources.SILENT);\n return change;\n }, source);\n }\n }, {\n key: 'formatLine',\n value: function formatLine(index, length, name, value, source) {\n var _this5 = this;\n\n var formats = void 0;\n\n var _overload3 = overload(index, length, name, value, source);\n\n var _overload4 = _slicedToArray(_overload3, 4);\n\n index = _overload4[0];\n length = _overload4[1];\n formats = _overload4[2];\n source = _overload4[3];\n\n return modify.call(this, function () {\n return _this5.editor.formatLine(index, length, formats);\n }, source, index, 0);\n }\n }, {\n key: 'formatText',\n value: function formatText(index, length, name, value, source) {\n var _this6 = this;\n\n var formats = void 0;\n\n var _overload5 = overload(index, length, name, value, source);\n\n var _overload6 = _slicedToArray(_overload5, 4);\n\n index = _overload6[0];\n length = _overload6[1];\n formats = _overload6[2];\n source = _overload6[3];\n\n return modify.call(this, function () {\n return _this6.editor.formatText(index, length, formats);\n }, source, index, 0);\n }\n }, {\n key: 'getBounds',\n value: function getBounds(index) {\n var length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n\n var bounds = void 0;\n if (typeof index === 'number') {\n bounds = this.selection.getBounds(index, length);\n } else {\n bounds = this.selection.getBounds(index.index, index.length);\n }\n var containerBounds = this.container.getBoundingClientRect();\n return {\n bottom: bounds.bottom - containerBounds.top,\n height: bounds.height,\n left: bounds.left - containerBounds.left,\n right: bounds.right - containerBounds.left,\n top: bounds.top - containerBounds.top,\n width: bounds.width\n };\n }\n }, {\n key: 'getContents',\n value: function getContents() {\n var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;\n var length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.getLength() - index;\n\n var _overload7 = overload(index, length);\n\n var _overload8 = _slicedToArray(_overload7, 2);\n\n index = _overload8[0];\n length = _overload8[1];\n\n return this.editor.getContents(index, length);\n }\n }, {\n key: 'getFormat',\n value: function getFormat() {\n var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.getSelection(true);\n var length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n\n if (typeof index === 'number') {\n return this.editor.getFormat(index, length);\n } else {\n return this.editor.getFormat(index.index, index.length);\n }\n }\n }, {\n key: 'getIndex',\n value: function getIndex(blot) {\n return blot.offset(this.scroll);\n }\n }, {\n key: 'getLength',\n value: function getLength() {\n return this.scroll.length();\n }\n }, {\n key: 'getLeaf',\n value: function getLeaf(index) {\n return this.scroll.leaf(index);\n }\n }, {\n key: 'getLine',\n value: function getLine(index) {\n return this.scroll.line(index);\n }\n }, {\n key: 'getLines',\n value: function getLines() {\n var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;\n var length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Number.MAX_VALUE;\n\n if (typeof index !== 'number') {\n return this.scroll.lines(index.index, index.length);\n } else {\n return this.scroll.lines(index, length);\n }\n }\n }, {\n key: 'getModule',\n value: function getModule(name) {\n return this.theme.modules[name];\n }\n }, {\n key: 'getSelection',\n value: function getSelection() {\n var focus = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;\n\n if (focus) this.focus();\n this.update(); // Make sure we access getRange with editor in consistent state\n return this.selection.getRange()[0];\n }\n }, {\n key: 'getText',\n value: function getText() {\n var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;\n var length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.getLength() - index;\n\n var _overload9 = overload(index, length);\n\n var _overload10 = _slicedToArray(_overload9, 2);\n\n index = _overload10[0];\n length = _overload10[1];\n\n return this.editor.getText(index, length);\n }\n }, {\n key: 'hasFocus',\n value: function hasFocus() {\n return this.selection.hasFocus();\n }\n }, {\n key: 'insertEmbed',\n value: function insertEmbed(index, embed, value) {\n var _this7 = this;\n\n var source = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : Quill.sources.API;\n\n return modify.call(this, function () {\n return _this7.editor.insertEmbed(index, embed, value);\n }, source, index);\n }\n }, {\n key: 'insertText',\n value: function insertText(index, text, name, value, source) {\n var _this8 = this;\n\n var formats = void 0;\n\n var _overload11 = overload(index, 0, name, value, source);\n\n var _overload12 = _slicedToArray(_overload11, 4);\n\n index = _overload12[0];\n formats = _overload12[2];\n source = _overload12[3];\n\n return modify.call(this, function () {\n return _this8.editor.insertText(index, text, formats);\n }, source, index, text.length);\n }\n }, {\n key: 'isEnabled',\n value: function isEnabled() {\n return !this.container.classList.contains('ql-disabled');\n }\n }, {\n key: 'off',\n value: function off() {\n return this.emitter.off.apply(this.emitter, arguments);\n }\n }, {\n key: 'on',\n value: function on() {\n return this.emitter.on.apply(this.emitter, arguments);\n }\n }, {\n key: 'once',\n value: function once() {\n return this.emitter.once.apply(this.emitter, arguments);\n }\n }, {\n key: 'pasteHTML',\n value: function pasteHTML(index, html, source) {\n this.clipboard.dangerouslyPasteHTML(index, html, source);\n }\n }, {\n key: 'removeFormat',\n value: function removeFormat(index, length, source) {\n var _this9 = this;\n\n var _overload13 = overload(index, length, source);\n\n var _overload14 = _slicedToArray(_overload13, 4);\n\n index = _overload14[0];\n length = _overload14[1];\n source = _overload14[3];\n\n return modify.call(this, function () {\n return _this9.editor.removeFormat(index, length);\n }, source, index);\n }\n }, {\n key: 'scrollIntoView',\n value: function scrollIntoView() {\n this.selection.scrollIntoView(this.scrollingContainer);\n }\n }, {\n key: 'setContents',\n value: function setContents(delta) {\n var _this10 = this;\n\n var source = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _emitter4.default.sources.API;\n\n return modify.call(this, function () {\n delta = new _quillDelta2.default(delta);\n var length = _this10.getLength();\n var deleted = _this10.editor.deleteText(0, length);\n var applied = _this10.editor.applyDelta(delta);\n var lastOp = applied.ops[applied.ops.length - 1];\n if (lastOp != null && typeof lastOp.insert === 'string' && lastOp.insert[lastOp.insert.length - 1] === '\\n') {\n _this10.editor.deleteText(_this10.getLength() - 1, 1);\n applied.delete(1);\n }\n var ret = deleted.compose(applied);\n return ret;\n }, source);\n }\n }, {\n key: 'setSelection',\n value: function setSelection(index, length, source) {\n if (index == null) {\n this.selection.setRange(null, length || Quill.sources.API);\n } else {\n var _overload15 = overload(index, length, source);\n\n var _overload16 = _slicedToArray(_overload15, 4);\n\n index = _overload16[0];\n length = _overload16[1];\n source = _overload16[3];\n\n this.selection.setRange(new _selection.Range(index, length), source);\n if (source !== _emitter4.default.sources.SILENT) {\n this.selection.scrollIntoView(this.scrollingContainer);\n }\n }\n }\n }, {\n key: 'setText',\n value: function setText(text) {\n var source = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _emitter4.default.sources.API;\n\n var delta = new _quillDelta2.default().insert(text);\n return this.setContents(delta, source);\n }\n }, {\n key: 'update',\n value: function update() {\n var source = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _emitter4.default.sources.USER;\n\n var change = this.scroll.update(source); // Will update selection before selection.update() does if text changes\n this.selection.update(source);\n return change;\n }\n }, {\n key: 'updateContents',\n value: function updateContents(delta) {\n var _this11 = this;\n\n var source = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _emitter4.default.sources.API;\n\n return modify.call(this, function () {\n delta = new _quillDelta2.default(delta);\n return _this11.editor.applyDelta(delta, source);\n }, source, true);\n }\n }]);\n\n return Quill;\n}();\n\nQuill.DEFAULTS = {\n bounds: null,\n formats: null,\n modules: {},\n placeholder: '',\n readOnly: false,\n scrollingContainer: null,\n strict: true,\n theme: 'default'\n};\nQuill.events = _emitter4.default.events;\nQuill.sources = _emitter4.default.sources;\n// eslint-disable-next-line no-undef\nQuill.version = false ? undefined : \"1.3.7\";\n\nQuill.imports = {\n 'delta': _quillDelta2.default,\n 'parchment': _parchment2.default,\n 'core/module': _module2.default,\n 'core/theme': _theme2.default\n};\n\nfunction expandConfig(container, userConfig) {\n userConfig = (0, _extend2.default)(true, {\n container: container,\n modules: {\n clipboard: true,\n keyboard: true,\n history: true\n }\n }, userConfig);\n if (!userConfig.theme || userConfig.theme === Quill.DEFAULTS.theme) {\n userConfig.theme = _theme2.default;\n } else {\n userConfig.theme = Quill.import('themes/' + userConfig.theme);\n if (userConfig.theme == null) {\n throw new Error('Invalid theme ' + userConfig.theme + '. Did you register it?');\n }\n }\n var themeConfig = (0, _extend2.default)(true, {}, userConfig.theme.DEFAULTS);\n [themeConfig, userConfig].forEach(function (config) {\n config.modules = config.modules || {};\n Object.keys(config.modules).forEach(function (module) {\n if (config.modules[module] === true) {\n config.modules[module] = {};\n }\n });\n });\n var moduleNames = Object.keys(themeConfig.modules).concat(Object.keys(userConfig.modules));\n var moduleConfig = moduleNames.reduce(function (config, name) {\n var moduleClass = Quill.import('modules/' + name);\n if (moduleClass == null) {\n debug.error('Cannot load ' + name + ' module. Are you sure you registered it?');\n } else {\n config[name] = moduleClass.DEFAULTS || {};\n }\n return config;\n }, {});\n // Special case toolbar shorthand\n if (userConfig.modules != null && userConfig.modules.toolbar && userConfig.modules.toolbar.constructor !== Object) {\n userConfig.modules.toolbar = {\n container: userConfig.modules.toolbar\n };\n }\n userConfig = (0, _extend2.default)(true, {}, Quill.DEFAULTS, { modules: moduleConfig }, themeConfig, userConfig);\n ['bounds', 'container', 'scrollingContainer'].forEach(function (key) {\n if (typeof userConfig[key] === 'string') {\n userConfig[key] = document.querySelector(userConfig[key]);\n }\n });\n userConfig.modules = Object.keys(userConfig.modules).reduce(function (config, name) {\n if (userConfig.modules[name]) {\n config[name] = userConfig.modules[name];\n }\n return config;\n }, {});\n return userConfig;\n}\n\n// Handle selection preservation and TEXT_CHANGE emission\n// common to modification APIs\nfunction modify(modifier, source, index, shift) {\n if (this.options.strict && !this.isEnabled() && source === _emitter4.default.sources.USER) {\n return new _quillDelta2.default();\n }\n var range = index == null ? null : this.getSelection();\n var oldDelta = this.editor.delta;\n var change = modifier();\n if (range != null) {\n if (index === true) index = range.index;\n if (shift == null) {\n range = shiftRange(range, change, source);\n } else if (shift !== 0) {\n range = shiftRange(range, index, shift, source);\n }\n this.setSelection(range, _emitter4.default.sources.SILENT);\n }\n if (change.length() > 0) {\n var _emitter;\n\n var args = [_emitter4.default.events.TEXT_CHANGE, change, oldDelta, source];\n (_emitter = this.emitter).emit.apply(_emitter, [_emitter4.default.events.EDITOR_CHANGE].concat(args));\n if (source !== _emitter4.default.sources.SILENT) {\n var _emitter2;\n\n (_emitter2 = this.emitter).emit.apply(_emitter2, args);\n }\n }\n return change;\n}\n\nfunction overload(index, length, name, value, source) {\n var formats = {};\n if (typeof index.index === 'number' && typeof index.length === 'number') {\n // Allow for throwaway end (used by insertText/insertEmbed)\n if (typeof length !== 'number') {\n source = value, value = name, name = length, length = index.length, index = index.index;\n } else {\n length = index.length, index = index.index;\n }\n } else if (typeof length !== 'number') {\n source = value, value = name, name = length, length = 0;\n }\n // Handle format being object, two format name/value strings or excluded\n if ((typeof name === 'undefined' ? 'undefined' : _typeof(name)) === 'object') {\n formats = name;\n source = value;\n } else if (typeof name === 'string') {\n if (value != null) {\n formats[name] = value;\n } else {\n source = name;\n }\n }\n // Handle optional source\n source = source || _emitter4.default.sources.API;\n return [index, length, formats, source];\n}\n\nfunction shiftRange(range, index, length, source) {\n if (range == null) return null;\n var start = void 0,\n end = void 0;\n if (index instanceof _quillDelta2.default) {\n var _map = [range.index, range.index + range.length].map(function (pos) {\n return index.transformPosition(pos, source !== _emitter4.default.sources.USER);\n });\n\n var _map2 = _slicedToArray(_map, 2);\n\n start = _map2[0];\n end = _map2[1];\n } else {\n var _map3 = [range.index, range.index + range.length].map(function (pos) {\n if (pos < index || pos === index && source === _emitter4.default.sources.USER) return pos;\n if (length >= 0) {\n return pos + length;\n } else {\n return Math.max(index, pos + length);\n }\n });\n\n var _map4 = _slicedToArray(_map3, 2);\n\n start = _map4[0];\n end = _map4[1];\n }\n return new _selection.Range(start, end - start);\n}\n\nexports.expandConfig = expandConfig;\nexports.overload = overload;\nexports.default = Quill;\n\n/***/ }),\n/* 6 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _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; }; }();\n\nvar _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if (\"value\" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };\n\nvar _text = __webpack_require__(7);\n\nvar _text2 = _interopRequireDefault(_text);\n\nvar _parchment = __webpack_require__(0);\n\nvar _parchment2 = _interopRequireDefault(_parchment);\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 _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nvar Inline = function (_Parchment$Inline) {\n _inherits(Inline, _Parchment$Inline);\n\n function Inline() {\n _classCallCheck(this, Inline);\n\n return _possibleConstructorReturn(this, (Inline.__proto__ || Object.getPrototypeOf(Inline)).apply(this, arguments));\n }\n\n _createClass(Inline, [{\n key: 'formatAt',\n value: function formatAt(index, length, name, value) {\n if (Inline.compare(this.statics.blotName, name) < 0 && _parchment2.default.query(name, _parchment2.default.Scope.BLOT)) {\n var blot = this.isolate(index, length);\n if (value) {\n blot.wrap(name, value);\n }\n } else {\n _get(Inline.prototype.__proto__ || Object.getPrototypeOf(Inline.prototype), 'formatAt', this).call(this, index, length, name, value);\n }\n }\n }, {\n key: 'optimize',\n value: function optimize(context) {\n _get(Inline.prototype.__proto__ || Object.getPrototypeOf(Inline.prototype), 'optimize', this).call(this, context);\n if (this.parent instanceof Inline && Inline.compare(this.statics.blotName, this.parent.statics.blotName) > 0) {\n var parent = this.parent.isolate(this.offset(), this.length());\n this.moveChildren(parent);\n parent.wrap(this);\n }\n }\n }], [{\n key: 'compare',\n value: function compare(self, other) {\n var selfIndex = Inline.order.indexOf(self);\n var otherIndex = Inline.order.indexOf(other);\n if (selfIndex >= 0 || otherIndex >= 0) {\n return selfIndex - otherIndex;\n } else if (self === other) {\n return 0;\n } else if (self < other) {\n return -1;\n } else {\n return 1;\n }\n }\n }]);\n\n return Inline;\n}(_parchment2.default.Inline);\n\nInline.allowedChildren = [Inline, _parchment2.default.Embed, _text2.default];\n// Lower index means deeper in the DOM tree, since not found (-1) is for embeds\nInline.order = ['cursor', 'inline', // Must be lower\n'underline', 'strike', 'italic', 'bold', 'script', 'link', 'code' // Must be higher\n];\n\nexports.default = Inline;\n\n/***/ }),\n/* 7 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _parchment = __webpack_require__(0);\n\nvar _parchment2 = _interopRequireDefault(_parchment);\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 _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nvar TextBlot = function (_Parchment$Text) {\n _inherits(TextBlot, _Parchment$Text);\n\n function TextBlot() {\n _classCallCheck(this, TextBlot);\n\n return _possibleConstructorReturn(this, (TextBlot.__proto__ || Object.getPrototypeOf(TextBlot)).apply(this, arguments));\n }\n\n return TextBlot;\n}(_parchment2.default.Text);\n\nexports.default = TextBlot;\n\n/***/ }),\n/* 8 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _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; }; }();\n\nvar _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if (\"value\" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };\n\nvar _eventemitter = __webpack_require__(54);\n\nvar _eventemitter2 = _interopRequireDefault(_eventemitter);\n\nvar _logger = __webpack_require__(10);\n\nvar _logger2 = _interopRequireDefault(_logger);\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 _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nvar debug = (0, _logger2.default)('quill:events');\n\nvar EVENTS = ['selectionchange', 'mousedown', 'mouseup', 'click'];\n\nEVENTS.forEach(function (eventName) {\n document.addEventListener(eventName, function () {\n for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n [].slice.call(document.querySelectorAll('.ql-container')).forEach(function (node) {\n // TODO use WeakMap\n if (node.__quill && node.__quill.emitter) {\n var _node$__quill$emitter;\n\n (_node$__quill$emitter = node.__quill.emitter).handleDOM.apply(_node$__quill$emitter, args);\n }\n });\n });\n});\n\nvar Emitter = function (_EventEmitter) {\n _inherits(Emitter, _EventEmitter);\n\n function Emitter() {\n _classCallCheck(this, Emitter);\n\n var _this = _possibleConstructorReturn(this, (Emitter.__proto__ || Object.getPrototypeOf(Emitter)).call(this));\n\n _this.listeners = {};\n _this.on('error', debug.error);\n return _this;\n }\n\n _createClass(Emitter, [{\n key: 'emit',\n value: function emit() {\n debug.log.apply(debug, arguments);\n _get(Emitter.prototype.__proto__ || Object.getPrototypeOf(Emitter.prototype), 'emit', this).apply(this, arguments);\n }\n }, {\n key: 'handleDOM',\n value: function handleDOM(event) {\n for (var _len2 = arguments.length, args = Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {\n args[_key2 - 1] = arguments[_key2];\n }\n\n (this.listeners[event.type] || []).forEach(function (_ref) {\n var node = _ref.node,\n handler = _ref.handler;\n\n if (event.target === node || node.contains(event.target)) {\n handler.apply(undefined, [event].concat(args));\n }\n });\n }\n }, {\n key: 'listenDOM',\n value: function listenDOM(eventName, node, handler) {\n if (!this.listeners[eventName]) {\n this.listeners[eventName] = [];\n }\n this.listeners[eventName].push({ node: node, handler: handler });\n }\n }]);\n\n return Emitter;\n}(_eventemitter2.default);\n\nEmitter.events = {\n EDITOR_CHANGE: 'editor-change',\n SCROLL_BEFORE_UPDATE: 'scroll-before-update',\n SCROLL_OPTIMIZE: 'scroll-optimize',\n SCROLL_UPDATE: 'scroll-update',\n SELECTION_CHANGE: 'selection-change',\n TEXT_CHANGE: 'text-change'\n};\nEmitter.sources = {\n API: 'api',\n SILENT: 'silent',\n USER: 'user'\n};\n\nexports.default = Emitter;\n\n/***/ }),\n/* 9 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nvar Module = function Module(quill) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n _classCallCheck(this, Module);\n\n this.quill = quill;\n this.options = options;\n};\n\nModule.DEFAULTS = {};\n\nexports.default = Module;\n\n/***/ }),\n/* 10 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nvar levels = ['error', 'warn', 'log', 'info'];\nvar level = 'warn';\n\nfunction debug(method) {\n if (levels.indexOf(method) <= levels.indexOf(level)) {\n var _console;\n\n for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n args[_key - 1] = arguments[_key];\n }\n\n (_console = console)[method].apply(_console, args); // eslint-disable-line no-console\n }\n}\n\nfunction namespace(ns) {\n return levels.reduce(function (logger, method) {\n logger[method] = debug.bind(console, method, ns);\n return logger;\n }, {});\n}\n\ndebug.level = namespace.level = function (newLevel) {\n level = newLevel;\n};\n\nexports.default = namespace;\n\n/***/ }),\n/* 11 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar pSlice = Array.prototype.slice;\nvar objectKeys = __webpack_require__(52);\nvar isArguments = __webpack_require__(53);\n\nvar deepEqual = module.exports = function (actual, expected, opts) {\n if (!opts) opts = {};\n // 7.1. All identical values are equivalent, as determined by ===.\n if (actual === expected) {\n return true;\n\n } else if (actual instanceof Date && expected instanceof Date) {\n return actual.getTime() === expected.getTime();\n\n // 7.3. Other pairs that do not both pass typeof value == 'object',\n // equivalence is determined by ==.\n } else if (!actual || !expected || typeof actual != 'object' && typeof expected != 'object') {\n return opts.strict ? actual === expected : actual == expected;\n\n // 7.4. For all other Object pairs, including Array objects, equivalence is\n // determined by having the same number of owned properties (as verified\n // with Object.prototype.hasOwnProperty.call), the same set of keys\n // (although not necessarily the same order), equivalent values for every\n // corresponding key, and an identical 'prototype' property. Note: this\n // accounts for both named and indexed properties on Arrays.\n } else {\n return objEquiv(actual, expected, opts);\n }\n}\n\nfunction isUndefinedOrNull(value) {\n return value === null || value === undefined;\n}\n\nfunction isBuffer (x) {\n if (!x || typeof x !== 'object' || typeof x.length !== 'number') return false;\n if (typeof x.copy !== 'function' || typeof x.slice !== 'function') {\n return false;\n }\n if (x.length > 0 && typeof x[0] !== 'number') return false;\n return true;\n}\n\nfunction objEquiv(a, b, opts) {\n var i, key;\n if (isUndefinedOrNull(a) || isUndefinedOrNull(b))\n return false;\n // an identical 'prototype' property.\n if (a.prototype !== b.prototype) return false;\n //~~~I've managed to break Object.keys through screwy arguments passing.\n // Converting to array solves the problem.\n if (isArguments(a)) {\n if (!isArguments(b)) {\n return false;\n }\n a = pSlice.call(a);\n b = pSlice.call(b);\n return deepEqual(a, b, opts);\n }\n if (isBuffer(a)) {\n if (!isBuffer(b)) {\n return false;\n }\n if (a.length !== b.length) return false;\n for (i = 0; i < a.length; i++) {\n if (a[i] !== b[i]) return false;\n }\n return true;\n }\n try {\n var ka = objectKeys(a),\n kb = objectKeys(b);\n } catch (e) {//happens when one is a string literal and the other isn't\n return false;\n }\n // having the same number of owned properties (keys incorporates\n // hasOwnProperty)\n if (ka.length != kb.length)\n return false;\n //the same set of keys (although not necessarily the same order),\n ka.sort();\n kb.sort();\n //~~~cheap key test\n for (i = ka.length - 1; i >= 0; i--) {\n if (ka[i] != kb[i])\n return false;\n }\n //equivalent values for every corresponding key, and\n //~~~possibly expensive deep test\n for (i = ka.length - 1; i >= 0; i--) {\n key = ka[i];\n if (!deepEqual(a[key], b[key], opts)) return false;\n }\n return typeof a === typeof b;\n}\n\n\n/***/ }),\n/* 12 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar Registry = __webpack_require__(1);\nvar Attributor = /** @class */ (function () {\n function Attributor(attrName, keyName, options) {\n if (options === void 0) { options = {}; }\n this.attrName = attrName;\n this.keyName = keyName;\n var attributeBit = Registry.Scope.TYPE & Registry.Scope.ATTRIBUTE;\n if (options.scope != null) {\n // Ignore type bits, force attribute bit\n this.scope = (options.scope & Registry.Scope.LEVEL) | attributeBit;\n }\n else {\n this.scope = Registry.Scope.ATTRIBUTE;\n }\n if (options.whitelist != null)\n this.whitelist = options.whitelist;\n }\n Attributor.keys = function (node) {\n return [].map.call(node.attributes, function (item) {\n return item.name;\n });\n };\n Attributor.prototype.add = function (node, value) {\n if (!this.canAdd(node, value))\n return false;\n node.setAttribute(this.keyName, value);\n return true;\n };\n Attributor.prototype.canAdd = function (node, value) {\n var match = Registry.query(node, Registry.Scope.BLOT & (this.scope | Registry.Scope.TYPE));\n if (match == null)\n return false;\n if (this.whitelist == null)\n return true;\n if (typeof value === 'string') {\n return this.whitelist.indexOf(value.replace(/[\"']/g, '')) > -1;\n }\n else {\n return this.whitelist.indexOf(value) > -1;\n }\n };\n Attributor.prototype.remove = function (node) {\n node.removeAttribute(this.keyName);\n };\n Attributor.prototype.value = function (node) {\n var value = node.getAttribute(this.keyName);\n if (this.canAdd(node, value) && value) {\n return value;\n }\n return '';\n };\n return Attributor;\n}());\nexports.default = Attributor;\n\n\n/***/ }),\n/* 13 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = exports.Code = undefined;\n\nvar _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_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\"]) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); } }; }();\n\nvar _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; }; }();\n\nvar _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if (\"value\" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };\n\nvar _quillDelta = __webpack_require__(2);\n\nvar _quillDelta2 = _interopRequireDefault(_quillDelta);\n\nvar _parchment = __webpack_require__(0);\n\nvar _parchment2 = _interopRequireDefault(_parchment);\n\nvar _block = __webpack_require__(4);\n\nvar _block2 = _interopRequireDefault(_block);\n\nvar _inline = __webpack_require__(6);\n\nvar _inline2 = _interopRequireDefault(_inline);\n\nvar _text = __webpack_require__(7);\n\nvar _text2 = _interopRequireDefault(_text);\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 _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nvar Code = function (_Inline) {\n _inherits(Code, _Inline);\n\n function Code() {\n _classCallCheck(this, Code);\n\n return _possibleConstructorReturn(this, (Code.__proto__ || Object.getPrototypeOf(Code)).apply(this, arguments));\n }\n\n return Code;\n}(_inline2.default);\n\nCode.blotName = 'code';\nCode.tagName = 'CODE';\n\nvar CodeBlock = function (_Block) {\n _inherits(CodeBlock, _Block);\n\n function CodeBlock() {\n _classCallCheck(this, CodeBlock);\n\n return _possibleConstructorReturn(this, (CodeBlock.__proto__ || Object.getPrototypeOf(CodeBlock)).apply(this, arguments));\n }\n\n _createClass(CodeBlock, [{\n key: 'delta',\n value: function delta() {\n var _this3 = this;\n\n var text = this.domNode.textContent;\n if (text.endsWith('\\n')) {\n // Should always be true\n text = text.slice(0, -1);\n }\n return text.split('\\n').reduce(function (delta, frag) {\n return delta.insert(frag).insert('\\n', _this3.formats());\n }, new _quillDelta2.default());\n }\n }, {\n key: 'format',\n value: function format(name, value) {\n if (name === this.statics.blotName && value) return;\n\n var _descendant = this.descendant(_text2.default, this.length() - 1),\n _descendant2 = _slicedToArray(_descendant, 1),\n text = _descendant2[0];\n\n if (text != null) {\n text.deleteAt(text.length() - 1, 1);\n }\n _get(CodeBlock.prototype.__proto__ || Object.getPrototypeOf(CodeBlock.prototype), 'format', this).call(this, name, value);\n }\n }, {\n key: 'formatAt',\n value: function formatAt(index, length, name, value) {\n if (length === 0) return;\n if (_parchment2.default.query(name, _parchment2.default.Scope.BLOCK) == null || name === this.statics.blotName && value === this.statics.formats(this.domNode)) {\n return;\n }\n var nextNewline = this.newlineIndex(index);\n if (nextNewline < 0 || nextNewline >= index + length) return;\n var prevNewline = this.newlineIndex(index, true) + 1;\n var isolateLength = nextNewline - prevNewline + 1;\n var blot = this.isolate(prevNewline, isolateLength);\n var next = blot.next;\n blot.format(name, value);\n if (next instanceof CodeBlock) {\n next.formatAt(0, index - prevNewline + length - isolateLength, name, value);\n }\n }\n }, {\n key: 'insertAt',\n value: function insertAt(index, value, def) {\n if (def != null) return;\n\n var _descendant3 = this.descendant(_text2.default, index),\n _descendant4 = _slicedToArray(_descendant3, 2),\n text = _descendant4[0],\n offset = _descendant4[1];\n\n text.insertAt(offset, value);\n }\n }, {\n key: 'length',\n value: function length() {\n var length = this.domNode.textContent.length;\n if (!this.domNode.textContent.endsWith('\\n')) {\n return length + 1;\n }\n return length;\n }\n }, {\n key: 'newlineIndex',\n value: function newlineIndex(searchIndex) {\n var reverse = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n\n if (!reverse) {\n var offset = this.domNode.textContent.slice(searchIndex).indexOf('\\n');\n return offset > -1 ? searchIndex + offset : -1;\n } else {\n return this.domNode.textContent.slice(0, searchIndex).lastIndexOf('\\n');\n }\n }\n }, {\n key: 'optimize',\n value: function optimize(context) {\n if (!this.domNode.textContent.endsWith('\\n')) {\n this.appendChild(_parchment2.default.create('text', '\\n'));\n }\n _get(CodeBlock.prototype.__proto__ || Object.getPrototypeOf(CodeBlock.prototype), 'optimize', this).call(this, context);\n var next = this.next;\n if (next != null && next.prev === this && next.statics.blotName === this.statics.blotName && this.statics.formats(this.domNode) === next.statics.formats(next.domNode)) {\n next.optimize(context);\n next.moveChildren(this);\n next.remove();\n }\n }\n }, {\n key: 'replace',\n value: function replace(target) {\n _get(CodeBlock.prototype.__proto__ || Object.getPrototypeOf(CodeBlock.prototype), 'replace', this).call(this, target);\n [].slice.call(this.domNode.querySelectorAll('*')).forEach(function (node) {\n var blot = _parchment2.default.find(node);\n if (blot == null) {\n node.parentNode.removeChild(node);\n } else if (blot instanceof _parchment2.default.Embed) {\n blot.remove();\n } else {\n blot.unwrap();\n }\n });\n }\n }], [{\n key: 'create',\n value: function create(value) {\n var domNode = _get(CodeBlock.__proto__ || Object.getPrototypeOf(CodeBlock), 'create', this).call(this, value);\n domNode.setAttribute('spellcheck', false);\n return domNode;\n }\n }, {\n key: 'formats',\n value: function formats() {\n return true;\n }\n }]);\n\n return CodeBlock;\n}(_block2.default);\n\nCodeBlock.blotName = 'code-block';\nCodeBlock.tagName = 'PRE';\nCodeBlock.TAB = ' ';\n\nexports.Code = Code;\nexports.default = CodeBlock;\n\n/***/ }),\n/* 14 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _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; };\n\nvar _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_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\"]) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); } }; }();\n\nvar _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; }; }();\n\nvar _quillDelta = __webpack_require__(2);\n\nvar _quillDelta2 = _interopRequireDefault(_quillDelta);\n\nvar _op = __webpack_require__(20);\n\nvar _op2 = _interopRequireDefault(_op);\n\nvar _parchment = __webpack_require__(0);\n\nvar _parchment2 = _interopRequireDefault(_parchment);\n\nvar _code = __webpack_require__(13);\n\nvar _code2 = _interopRequireDefault(_code);\n\nvar _cursor = __webpack_require__(24);\n\nvar _cursor2 = _interopRequireDefault(_cursor);\n\nvar _block = __webpack_require__(4);\n\nvar _block2 = _interopRequireDefault(_block);\n\nvar _break = __webpack_require__(16);\n\nvar _break2 = _interopRequireDefault(_break);\n\nvar _clone = __webpack_require__(21);\n\nvar _clone2 = _interopRequireDefault(_clone);\n\nvar _deepEqual = __webpack_require__(11);\n\nvar _deepEqual2 = _interopRequireDefault(_deepEqual);\n\nvar _extend = __webpack_require__(3);\n\nvar _extend2 = _interopRequireDefault(_extend);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\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 _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nvar ASCII = /^[ -~]*$/;\n\nvar Editor = function () {\n function Editor(scroll) {\n _classCallCheck(this, Editor);\n\n this.scroll = scroll;\n this.delta = this.getDelta();\n }\n\n _createClass(Editor, [{\n key: 'applyDelta',\n value: function applyDelta(delta) {\n var _this = this;\n\n var consumeNextNewline = false;\n this.scroll.update();\n var scrollLength = this.scroll.length();\n this.scroll.batchStart();\n delta = normalizeDelta(delta);\n delta.reduce(function (index, op) {\n var length = op.retain || op.delete || op.insert.length || 1;\n var attributes = op.attributes || {};\n if (op.insert != null) {\n if (typeof op.insert === 'string') {\n var text = op.insert;\n if (text.endsWith('\\n') && consumeNextNewline) {\n consumeNextNewline = false;\n text = text.slice(0, -1);\n }\n if (index >= scrollLength && !text.endsWith('\\n')) {\n consumeNextNewline = true;\n }\n _this.scroll.insertAt(index, text);\n\n var _scroll$line = _this.scroll.line(index),\n _scroll$line2 = _slicedToArray(_scroll$line, 2),\n line = _scroll$line2[0],\n offset = _scroll$line2[1];\n\n var formats = (0, _extend2.default)({}, (0, _block.bubbleFormats)(line));\n if (line instanceof _block2.default) {\n var _line$descendant = line.descendant(_parchment2.default.Leaf, offset),\n _line$descendant2 = _slicedToArray(_line$descendant, 1),\n leaf = _line$descendant2[0];\n\n formats = (0, _extend2.default)(formats, (0, _block.bubbleFormats)(leaf));\n }\n attributes = _op2.default.attributes.diff(formats, attributes) || {};\n } else if (_typeof(op.insert) === 'object') {\n var key = Object.keys(op.insert)[0]; // There should only be one key\n if (key == null) return index;\n _this.scroll.insertAt(index, key, op.insert[key]);\n }\n scrollLength += length;\n }\n Object.keys(attributes).forEach(function (name) {\n _this.scroll.formatAt(index, length, name, attributes[name]);\n });\n return index + length;\n }, 0);\n delta.reduce(function (index, op) {\n if (typeof op.delete === 'number') {\n _this.scroll.deleteAt(index, op.delete);\n return index;\n }\n return index + (op.retain || op.insert.length || 1);\n }, 0);\n this.scroll.batchEnd();\n return this.update(delta);\n }\n }, {\n key: 'deleteText',\n value: function deleteText(index, length) {\n this.scroll.deleteAt(index, length);\n return this.update(new _quillDelta2.default().retain(index).delete(length));\n }\n }, {\n key: 'formatLine',\n value: function formatLine(index, length) {\n var _this2 = this;\n\n var formats = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n\n this.scroll.update();\n Object.keys(formats).forEach(function (format) {\n if (_this2.scroll.whitelist != null && !_this2.scroll.whitelist[format]) return;\n var lines = _this2.scroll.lines(index, Math.max(length, 1));\n var lengthRemaining = length;\n lines.forEach(function (line) {\n var lineLength = line.length();\n if (!(line instanceof _code2.default)) {\n line.format(format, formats[format]);\n } else {\n var codeIndex = index - line.offset(_this2.scroll);\n var codeLength = line.newlineIndex(codeIndex + lengthRemaining) - codeIndex + 1;\n line.formatAt(codeIndex, codeLength, format, formats[format]);\n }\n lengthRemaining -= lineLength;\n });\n });\n this.scroll.optimize();\n return this.update(new _quillDelta2.default().retain(index).retain(length, (0, _clone2.default)(formats)));\n }\n }, {\n key: 'formatText',\n value: function formatText(index, length) {\n var _this3 = this;\n\n var formats = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n\n Object.keys(formats).forEach(function (format) {\n _this3.scroll.formatAt(index, length, format, formats[format]);\n });\n return this.update(new _quillDelta2.default().retain(index).retain(length, (0, _clone2.default)(formats)));\n }\n }, {\n key: 'getContents',\n value: function getContents(index, length) {\n return this.delta.slice(index, index + length);\n }\n }, {\n key: 'getDelta',\n value: function getDelta() {\n return this.scroll.lines().reduce(function (delta, line) {\n return delta.concat(line.delta());\n }, new _quillDelta2.default());\n }\n }, {\n key: 'getFormat',\n value: function getFormat(index) {\n var length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n\n var lines = [],\n leaves = [];\n if (length === 0) {\n this.scroll.path(index).forEach(function (path) {\n var _path = _slicedToArray(path, 1),\n blot = _path[0];\n\n if (blot instanceof _block2.default) {\n lines.push(blot);\n } else if (blot instanceof _parchment2.default.Leaf) {\n leaves.push(blot);\n }\n });\n } else {\n lines = this.scroll.lines(index, length);\n leaves = this.scroll.descendants(_parchment2.default.Leaf, index, length);\n }\n var formatsArr = [lines, leaves].map(function (blots) {\n if (blots.length === 0) return {};\n var formats = (0, _block.bubbleFormats)(blots.shift());\n while (Object.keys(formats).length > 0) {\n var blot = blots.shift();\n if (blot == null) return formats;\n formats = combineFormats((0, _block.bubbleFormats)(blot), formats);\n }\n return formats;\n });\n return _extend2.default.apply(_extend2.default, formatsArr);\n }\n }, {\n key: 'getText',\n value: function getText(index, length) {\n return this.getContents(index, length).filter(function (op) {\n return typeof op.insert === 'string';\n }).map(function (op) {\n return op.insert;\n }).join('');\n }\n }, {\n key: 'insertEmbed',\n value: function insertEmbed(index, embed, value) {\n this.scroll.insertAt(index, embed, value);\n return this.update(new _quillDelta2.default().retain(index).insert(_defineProperty({}, embed, value)));\n }\n }, {\n key: 'insertText',\n value: function insertText(index, text) {\n var _this4 = this;\n\n var formats = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n\n text = text.replace(/\\r\\n/g, '\\n').replace(/\\r/g, '\\n');\n this.scroll.insertAt(index, text);\n Object.keys(formats).forEach(function (format) {\n _this4.scroll.formatAt(index, text.length, format, formats[format]);\n });\n return this.update(new _quillDelta2.default().retain(index).insert(text, (0, _clone2.default)(formats)));\n }\n }, {\n key: 'isBlank',\n value: function isBlank() {\n if (this.scroll.children.length == 0) return true;\n if (this.scroll.children.length > 1) return false;\n var block = this.scroll.children.head;\n if (block.statics.blotName !== _block2.default.blotName) return false;\n if (block.children.length > 1) return false;\n return block.children.head instanceof _break2.default;\n }\n }, {\n key: 'removeFormat',\n value: function removeFormat(index, length) {\n var text = this.getText(index, length);\n\n var _scroll$line3 = this.scroll.line(index + length),\n _scroll$line4 = _slicedToArray(_scroll$line3, 2),\n line = _scroll$line4[0],\n offset = _scroll$line4[1];\n\n var suffixLength = 0,\n suffix = new _quillDelta2.default();\n if (line != null) {\n if (!(line instanceof _code2.default)) {\n suffixLength = line.length() - offset;\n } else {\n suffixLength = line.newlineIndex(offset) - offset + 1;\n }\n suffix = line.delta().slice(offset, offset + suffixLength - 1).insert('\\n');\n }\n var contents = this.getContents(index, length + suffixLength);\n var diff = contents.diff(new _quillDelta2.default().insert(text).concat(suffix));\n var delta = new _quillDelta2.default().retain(index).concat(diff);\n return this.applyDelta(delta);\n }\n }, {\n key: 'update',\n value: function update(change) {\n var mutations = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];\n var cursorIndex = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined;\n\n var oldDelta = this.delta;\n if (mutations.length === 1 && mutations[0].type === 'characterData' && mutations[0].target.data.match(ASCII) && _parchment2.default.find(mutations[0].target)) {\n // Optimization for character changes\n var textBlot = _parchment2.default.find(mutations[0].target);\n var formats = (0, _block.bubbleFormats)(textBlot);\n var index = textBlot.offset(this.scroll);\n var oldValue = mutations[0].oldValue.replace(_cursor2.default.CONTENTS, '');\n var oldText = new _quillDelta2.default().insert(oldValue);\n var newText = new _quillDelta2.default().insert(textBlot.value());\n var diffDelta = new _quillDelta2.default().retain(index).concat(oldText.diff(newText, cursorIndex));\n change = diffDelta.reduce(function (delta, op) {\n if (op.insert) {\n return delta.insert(op.insert, formats);\n } else {\n return delta.push(op);\n }\n }, new _quillDelta2.default());\n this.delta = oldDelta.compose(change);\n } else {\n this.delta = this.getDelta();\n if (!change || !(0, _deepEqual2.default)(oldDelta.compose(change), this.delta)) {\n change = oldDelta.diff(this.delta, cursorIndex);\n }\n }\n return change;\n }\n }]);\n\n return Editor;\n}();\n\nfunction combineFormats(formats, combined) {\n return Object.keys(combined).reduce(function (merged, name) {\n if (formats[name] == null) return merged;\n if (combined[name] === formats[name]) {\n merged[name] = combined[name];\n } else if (Array.isArray(combined[name])) {\n if (combined[name].indexOf(formats[name]) < 0) {\n merged[name] = combined[name].concat([formats[name]]);\n }\n } else {\n merged[name] = [combined[name], formats[name]];\n }\n return merged;\n }, {});\n}\n\nfunction normalizeDelta(delta) {\n return delta.reduce(function (delta, op) {\n if (op.insert === 1) {\n var attributes = (0, _clone2.default)(op.attributes);\n delete attributes['image'];\n return delta.insert({ image: op.attributes.image }, attributes);\n }\n if (op.attributes != null && (op.attributes.list === true || op.attributes.bullet === true)) {\n op = (0, _clone2.default)(op);\n if (op.attributes.list) {\n op.attributes.list = 'ordered';\n } else {\n op.attributes.list = 'bullet';\n delete op.attributes.bullet;\n }\n }\n if (typeof op.insert === 'string') {\n var text = op.insert.replace(/\\r\\n/g, '\\n').replace(/\\r/g, '\\n');\n return delta.insert(text, op.attributes);\n }\n return delta.push(op);\n }, new _quillDelta2.default());\n}\n\nexports.default = Editor;\n\n/***/ }),\n/* 15 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = exports.Range = undefined;\n\nvar _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_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\"]) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); } }; }();\n\nvar _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; }; }();\n\nvar _parchment = __webpack_require__(0);\n\nvar _parchment2 = _interopRequireDefault(_parchment);\n\nvar _clone = __webpack_require__(21);\n\nvar _clone2 = _interopRequireDefault(_clone);\n\nvar _deepEqual = __webpack_require__(11);\n\nvar _deepEqual2 = _interopRequireDefault(_deepEqual);\n\nvar _emitter3 = __webpack_require__(8);\n\nvar _emitter4 = _interopRequireDefault(_emitter3);\n\nvar _logger = __webpack_require__(10);\n\nvar _logger2 = _interopRequireDefault(_logger);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nvar debug = (0, _logger2.default)('quill:selection');\n\nvar Range = function Range(index) {\n var length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n\n _classCallCheck(this, Range);\n\n this.index = index;\n this.length = length;\n};\n\nvar Selection = function () {\n function Selection(scroll, emitter) {\n var _this = this;\n\n _classCallCheck(this, Selection);\n\n this.emitter = emitter;\n this.scroll = scroll;\n this.composing = false;\n this.mouseDown = false;\n this.root = this.scroll.domNode;\n this.cursor = _parchment2.default.create('cursor', this);\n // savedRange is last non-null range\n this.lastRange = this.savedRange = new Range(0, 0);\n this.handleComposition();\n this.handleDragging();\n this.emitter.listenDOM('selectionchange', document, function () {\n if (!_this.mouseDown) {\n setTimeout(_this.update.bind(_this, _emitter4.default.sources.USER), 1);\n }\n });\n this.emitter.on(_emitter4.default.events.EDITOR_CHANGE, function (type, delta) {\n if (type === _emitter4.default.events.TEXT_CHANGE && delta.length() > 0) {\n _this.update(_emitter4.default.sources.SILENT);\n }\n });\n this.emitter.on(_emitter4.default.events.SCROLL_BEFORE_UPDATE, function () {\n if (!_this.hasFocus()) return;\n var native = _this.getNativeRange();\n if (native == null) return;\n if (native.start.node === _this.cursor.textNode) return; // cursor.restore() will handle\n // TODO unclear if this has negative side effects\n _this.emitter.once(_emitter4.default.events.SCROLL_UPDATE, function () {\n try {\n _this.setNativeRange(native.start.node, native.start.offset, native.end.node, native.end.offset);\n } catch (ignored) {}\n });\n });\n this.emitter.on(_emitter4.default.events.SCROLL_OPTIMIZE, function (mutations, context) {\n if (context.range) {\n var _context$range = context.range,\n startNode = _context$range.startNode,\n startOffset = _context$range.startOffset,\n endNode = _context$range.endNode,\n endOffset = _context$range.endOffset;\n\n _this.setNativeRange(startNode, startOffset, endNode, endOffset);\n }\n });\n this.update(_emitter4.default.sources.SILENT);\n }\n\n _createClass(Selection, [{\n key: 'handleComposition',\n value: function handleComposition() {\n var _this2 = this;\n\n this.root.addEventListener('compositionstart', function () {\n _this2.composing = true;\n });\n this.root.addEventListener('compositionend', function () {\n _this2.composing = false;\n if (_this2.cursor.parent) {\n var range = _this2.cursor.restore();\n if (!range) return;\n setTimeout(function () {\n _this2.setNativeRange(range.startNode, range.startOffset, range.endNode, range.endOffset);\n }, 1);\n }\n });\n }\n }, {\n key: 'handleDragging',\n value: function handleDragging() {\n var _this3 = this;\n\n this.emitter.listenDOM('mousedown', document.body, function () {\n _this3.mouseDown = true;\n });\n this.emitter.listenDOM('mouseup', document.body, function () {\n _this3.mouseDown = false;\n _this3.update(_emitter4.default.sources.USER);\n });\n }\n }, {\n key: 'focus',\n value: function focus() {\n if (this.hasFocus()) return;\n this.root.focus();\n this.setRange(this.savedRange);\n }\n }, {\n key: 'format',\n value: function format(_format, value) {\n if (this.scroll.whitelist != null && !this.scroll.whitelist[_format]) return;\n this.scroll.update();\n var nativeRange = this.getNativeRange();\n if (nativeRange == null || !nativeRange.native.collapsed || _parchment2.default.query(_format, _parchment2.default.Scope.BLOCK)) return;\n if (nativeRange.start.node !== this.cursor.textNode) {\n var blot = _parchment2.default.find(nativeRange.start.node, false);\n if (blot == null) return;\n // TODO Give blot ability to not split\n if (blot instanceof _parchment2.default.Leaf) {\n var after = blot.split(nativeRange.start.offset);\n blot.parent.insertBefore(this.cursor, after);\n } else {\n blot.insertBefore(this.cursor, nativeRange.start.node); // Should never happen\n }\n this.cursor.attach();\n }\n this.cursor.format(_format, value);\n this.scroll.optimize();\n this.setNativeRange(this.cursor.textNode, this.cursor.textNode.data.length);\n this.update();\n }\n }, {\n key: 'getBounds',\n value: function getBounds(index) {\n var length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n\n var scrollLength = this.scroll.length();\n index = Math.min(index, scrollLength - 1);\n length = Math.min(index + length, scrollLength - 1) - index;\n var node = void 0,\n _scroll$leaf = this.scroll.leaf(index),\n _scroll$leaf2 = _slicedToArray(_scroll$leaf, 2),\n leaf = _scroll$leaf2[0],\n offset = _scroll$leaf2[1];\n if (leaf == null) return null;\n\n var _leaf$position = leaf.position(offset, true);\n\n var _leaf$position2 = _slicedToArray(_leaf$position, 2);\n\n node = _leaf$position2[0];\n offset = _leaf$position2[1];\n\n var range = document.createRange();\n if (length > 0) {\n range.setStart(node, offset);\n\n var _scroll$leaf3 = this.scroll.leaf(index + length);\n\n var _scroll$leaf4 = _slicedToArray(_scroll$leaf3, 2);\n\n leaf = _scroll$leaf4[0];\n offset = _scroll$leaf4[1];\n\n if (leaf == null) return null;\n\n var _leaf$position3 = leaf.position(offset, true);\n\n var _leaf$position4 = _slicedToArray(_leaf$position3, 2);\n\n node = _leaf$position4[0];\n offset = _leaf$position4[1];\n\n range.setEnd(node, offset);\n return range.getBoundingClientRect();\n } else {\n var side = 'left';\n var rect = void 0;\n if (node instanceof Text) {\n if (offset < node.data.length) {\n range.setStart(node, offset);\n range.setEnd(node, offset + 1);\n } else {\n range.setStart(node, offset - 1);\n range.setEnd(node, offset);\n side = 'right';\n }\n rect = range.getBoundingClientRect();\n } else {\n rect = leaf.domNode.getBoundingClientRect();\n if (offset > 0) side = 'right';\n }\n return {\n bottom: rect.top + rect.height,\n height: rect.height,\n left: rect[side],\n right: rect[side],\n top: rect.top,\n width: 0\n };\n }\n }\n }, {\n key: 'getNativeRange',\n value: function getNativeRange() {\n var selection = document.getSelection();\n if (selection == null || selection.rangeCount <= 0) return null;\n var nativeRange = selection.getRangeAt(0);\n if (nativeRange == null) return null;\n var range = this.normalizeNative(nativeRange);\n debug.info('getNativeRange', range);\n return range;\n }\n }, {\n key: 'getRange',\n value: function getRange() {\n var normalized = this.getNativeRange();\n if (normalized == null) return [null, null];\n var range = this.normalizedToRange(normalized);\n return [range, normalized];\n }\n }, {\n key: 'hasFocus',\n value: function hasFocus() {\n return document.activeElement === this.root;\n }\n }, {\n key: 'normalizedToRange',\n value: function normalizedToRange(range) {\n var _this4 = this;\n\n var positions = [[range.start.node, range.start.offset]];\n if (!range.native.collapsed) {\n positions.push([range.end.node, range.end.offset]);\n }\n var indexes = positions.map(function (position) {\n var _position = _slicedToArray(position, 2),\n node = _position[0],\n offset = _position[1];\n\n var blot = _parchment2.default.find(node, true);\n var index = blot.offset(_this4.scroll);\n if (offset === 0) {\n return index;\n } else if (blot instanceof _parchment2.default.Container) {\n return index + blot.length();\n } else {\n return index + blot.index(node, offset);\n }\n });\n var end = Math.min(Math.max.apply(Math, _toConsumableArray(indexes)), this.scroll.length() - 1);\n var start = Math.min.apply(Math, [end].concat(_toConsumableArray(indexes)));\n return new Range(start, end - start);\n }\n }, {\n key: 'normalizeNative',\n value: function normalizeNative(nativeRange) {\n if (!contains(this.root, nativeRange.startContainer) || !nativeRange.collapsed && !contains(this.root, nativeRange.endContainer)) {\n return null;\n }\n var range = {\n start: { node: nativeRange.startContainer, offset: nativeRange.startOffset },\n end: { node: nativeRange.endContainer, offset: nativeRange.endOffset },\n native: nativeRange\n };\n [range.start, range.end].forEach(function (position) {\n var node = position.node,\n offset = position.offset;\n while (!(node instanceof Text) && node.childNodes.length > 0) {\n if (node.childNodes.length > offset) {\n node = node.childNodes[offset];\n offset = 0;\n } else if (node.childNodes.length === offset) {\n node = node.lastChild;\n offset = node instanceof Text ? node.data.length : node.childNodes.length + 1;\n } else {\n break;\n }\n }\n position.node = node, position.offset = offset;\n });\n return range;\n }\n }, {\n key: 'rangeToNative',\n value: function rangeToNative(range) {\n var _this5 = this;\n\n var indexes = range.collapsed ? [range.index] : [range.index, range.index + range.length];\n var args = [];\n var scrollLength = this.scroll.length();\n indexes.forEach(function (index, i) {\n index = Math.min(scrollLength - 1, index);\n var node = void 0,\n _scroll$leaf5 = _this5.scroll.leaf(index),\n _scroll$leaf6 = _slicedToArray(_scroll$leaf5, 2),\n leaf = _scroll$leaf6[0],\n offset = _scroll$leaf6[1];\n var _leaf$position5 = leaf.position(offset, i !== 0);\n\n var _leaf$position6 = _slicedToArray(_leaf$position5, 2);\n\n node = _leaf$position6[0];\n offset = _leaf$position6[1];\n\n args.push(node, offset);\n });\n if (args.length < 2) {\n args = args.concat(args);\n }\n return args;\n }\n }, {\n key: 'scrollIntoView',\n value: function scrollIntoView(scrollingContainer) {\n var range = this.lastRange;\n if (range == null) return;\n var bounds = this.getBounds(range.index, range.length);\n if (bounds == null) return;\n var limit = this.scroll.length() - 1;\n\n var _scroll$line = this.scroll.line(Math.min(range.index, limit)),\n _scroll$line2 = _slicedToArray(_scroll$line, 1),\n first = _scroll$line2[0];\n\n var last = first;\n if (range.length > 0) {\n var _scroll$line3 = this.scroll.line(Math.min(range.index + range.length, limit));\n\n var _scroll$line4 = _slicedToArray(_scroll$line3, 1);\n\n last = _scroll$line4[0];\n }\n if (first == null || last == null) return;\n var scrollBounds = scrollingContainer.getBoundingClientRect();\n if (bounds.top < scrollBounds.top) {\n scrollingContainer.scrollTop -= scrollBounds.top - bounds.top;\n } else if (bounds.bottom > scrollBounds.bottom) {\n scrollingContainer.scrollTop += bounds.bottom - scrollBounds.bottom;\n }\n }\n }, {\n key: 'setNativeRange',\n value: function setNativeRange(startNode, startOffset) {\n var endNode = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : startNode;\n var endOffset = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : startOffset;\n var force = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;\n\n debug.info('setNativeRange', startNode, startOffset, endNode, endOffset);\n if (startNode != null && (this.root.parentNode == null || startNode.parentNode == null || endNode.parentNode == null)) {\n return;\n }\n var selection = document.getSelection();\n if (selection == null) return;\n if (startNode != null) {\n if (!this.hasFocus()) this.root.focus();\n var native = (this.getNativeRange() || {}).native;\n if (native == null || force || startNode !== native.startContainer || startOffset !== native.startOffset || endNode !== native.endContainer || endOffset !== native.endOffset) {\n\n if (startNode.tagName == \"BR\") {\n startOffset = [].indexOf.call(startNode.parentNode.childNodes, startNode);\n startNode = startNode.parentNode;\n }\n if (endNode.tagName == \"BR\") {\n endOffset = [].indexOf.call(endNode.parentNode.childNodes, endNode);\n endNode = endNode.parentNode;\n }\n var range = document.createRange();\n range.setStart(startNode, startOffset);\n range.setEnd(endNode, endOffset);\n selection.removeAllRanges();\n selection.addRange(range);\n }\n } else {\n selection.removeAllRanges();\n this.root.blur();\n document.body.focus(); // root.blur() not enough on IE11+Travis+SauceLabs (but not local VMs)\n }\n }\n }, {\n key: 'setRange',\n value: function setRange(range) {\n var force = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n var source = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _emitter4.default.sources.API;\n\n if (typeof force === 'string') {\n source = force;\n force = false;\n }\n debug.info('setRange', range);\n if (range != null) {\n var args = this.rangeToNative(range);\n this.setNativeRange.apply(this, _toConsumableArray(args).concat([force]));\n } else {\n this.setNativeRange(null);\n }\n this.update(source);\n }\n }, {\n key: 'update',\n value: function update() {\n var source = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _emitter4.default.sources.USER;\n\n var oldRange = this.lastRange;\n\n var _getRange = this.getRange(),\n _getRange2 = _slicedToArray(_getRange, 2),\n lastRange = _getRange2[0],\n nativeRange = _getRange2[1];\n\n this.lastRange = lastRange;\n if (this.lastRange != null) {\n this.savedRange = this.lastRange;\n }\n if (!(0, _deepEqual2.default)(oldRange, this.lastRange)) {\n var _emitter;\n\n if (!this.composing && nativeRange != null && nativeRange.native.collapsed && nativeRange.start.node !== this.cursor.textNode) {\n this.cursor.restore();\n }\n var args = [_emitter4.default.events.SELECTION_CHANGE, (0, _clone2.default)(this.lastRange), (0, _clone2.default)(oldRange), source];\n (_emitter = this.emitter).emit.apply(_emitter, [_emitter4.default.events.EDITOR_CHANGE].concat(args));\n if (source !== _emitter4.default.sources.SILENT) {\n var _emitter2;\n\n (_emitter2 = this.emitter).emit.apply(_emitter2, args);\n }\n }\n }\n }]);\n\n return Selection;\n}();\n\nfunction contains(parent, descendant) {\n try {\n // Firefox inserts inaccessible nodes around video elements\n descendant.parentNode;\n } catch (e) {\n return false;\n }\n // IE11 has bug with Text nodes\n // https://connect.microsoft.com/IE/feedback/details/780874/node-contains-is-incorrect\n if (descendant instanceof Text) {\n descendant = descendant.parentNode;\n }\n return parent.contains(descendant);\n}\n\nexports.Range = Range;\nexports.default = Selection;\n\n/***/ }),\n/* 16 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _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; }; }();\n\nvar _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if (\"value\" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };\n\nvar _parchment = __webpack_require__(0);\n\nvar _parchment2 = _interopRequireDefault(_parchment);\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 _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nvar Break = function (_Parchment$Embed) {\n _inherits(Break, _Parchment$Embed);\n\n function Break() {\n _classCallCheck(this, Break);\n\n return _possibleConstructorReturn(this, (Break.__proto__ || Object.getPrototypeOf(Break)).apply(this, arguments));\n }\n\n _createClass(Break, [{\n key: 'insertInto',\n value: function insertInto(parent, ref) {\n if (parent.children.length === 0) {\n _get(Break.prototype.__proto__ || Object.getPrototypeOf(Break.prototype), 'insertInto', this).call(this, parent, ref);\n } else {\n this.remove();\n }\n }\n }, {\n key: 'length',\n value: function length() {\n return 0;\n }\n }, {\n key: 'value',\n value: function value() {\n return '';\n }\n }], [{\n key: 'value',\n value: function value() {\n return undefined;\n }\n }]);\n\n return Break;\n}(_parchment2.default.Embed);\n\nBreak.blotName = 'break';\nBreak.tagName = 'BR';\n\nexports.default = Break;\n\n/***/ }),\n/* 17 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar linked_list_1 = __webpack_require__(44);\nvar shadow_1 = __webpack_require__(30);\nvar Registry = __webpack_require__(1);\nvar ContainerBlot = /** @class */ (function (_super) {\n __extends(ContainerBlot, _super);\n function ContainerBlot(domNode) {\n var _this = _super.call(this, domNode) || this;\n _this.build();\n return _this;\n }\n ContainerBlot.prototype.appendChild = function (other) {\n this.insertBefore(other);\n };\n ContainerBlot.prototype.attach = function () {\n _super.prototype.attach.call(this);\n this.children.forEach(function (child) {\n child.attach();\n });\n };\n ContainerBlot.prototype.build = function () {\n var _this = this;\n this.children = new linked_list_1.default();\n // Need to be reversed for if DOM nodes already in order\n [].slice\n .call(this.domNode.childNodes)\n .reverse()\n .forEach(function (node) {\n try {\n var child = makeBlot(node);\n _this.insertBefore(child, _this.children.head || undefined);\n }\n catch (err) {\n if (err instanceof Registry.ParchmentError)\n return;\n else\n throw err;\n }\n });\n };\n ContainerBlot.prototype.deleteAt = function (index, length) {\n if (index === 0 && length === this.length()) {\n return this.remove();\n }\n this.children.forEachAt(index, length, function (child, offset, length) {\n child.deleteAt(offset, length);\n });\n };\n ContainerBlot.prototype.descendant = function (criteria, index) {\n var _a = this.children.find(index), child = _a[0], offset = _a[1];\n if ((criteria.blotName == null && criteria(child)) ||\n (criteria.blotName != null && child instanceof criteria)) {\n return [child, offset];\n }\n else if (child instanceof ContainerBlot) {\n return child.descendant(criteria, offset);\n }\n else {\n return [null, -1];\n }\n };\n ContainerBlot.prototype.descendants = function (criteria, index, length) {\n if (index === void 0) { index = 0; }\n if (length === void 0) { length = Number.MAX_VALUE; }\n var descendants = [];\n var lengthLeft = length;\n this.children.forEachAt(index, length, function (child, index, length) {\n if ((criteria.blotName == null && criteria(child)) ||\n (criteria.blotName != null && child instanceof criteria)) {\n descendants.push(child);\n }\n if (child instanceof ContainerBlot) {\n descendants = descendants.concat(child.descendants(criteria, index, lengthLeft));\n }\n lengthLeft -= length;\n });\n return descendants;\n };\n ContainerBlot.prototype.detach = function () {\n this.children.forEach(function (child) {\n child.detach();\n });\n _super.prototype.detach.call(this);\n };\n ContainerBlot.prototype.formatAt = function (index, length, name, value) {\n this.children.forEachAt(index, length, function (child, offset, length) {\n child.formatAt(offset, length, name, value);\n });\n };\n ContainerBlot.prototype.insertAt = function (index, value, def) {\n var _a = this.children.find(index), child = _a[0], offset = _a[1];\n if (child) {\n child.insertAt(offset, value, def);\n }\n else {\n var blot = def == null ? Registry.create('text', value) : Registry.create(value, def);\n this.appendChild(blot);\n }\n };\n ContainerBlot.prototype.insertBefore = function (childBlot, refBlot) {\n if (this.statics.allowedChildren != null &&\n !this.statics.allowedChildren.some(function (child) {\n return childBlot instanceof child;\n })) {\n throw new Registry.ParchmentError(\"Cannot insert \" + childBlot.statics.blotName + \" into \" + this.statics.blotName);\n }\n childBlot.insertInto(this, refBlot);\n };\n ContainerBlot.prototype.length = function () {\n return this.children.reduce(function (memo, child) {\n return memo + child.length();\n }, 0);\n };\n ContainerBlot.prototype.moveChildren = function (targetParent, refNode) {\n this.children.forEach(function (child) {\n targetParent.insertBefore(child, refNode);\n });\n };\n ContainerBlot.prototype.optimize = function (context) {\n _super.prototype.optimize.call(this, context);\n if (this.children.length === 0) {\n if (this.statics.defaultChild != null) {\n var child = Registry.create(this.statics.defaultChild);\n this.appendChild(child);\n child.optimize(context);\n }\n else {\n this.remove();\n }\n }\n };\n ContainerBlot.prototype.path = function (index, inclusive) {\n if (inclusive === void 0) { inclusive = false; }\n var _a = this.children.find(index, inclusive), child = _a[0], offset = _a[1];\n var position = [[this, index]];\n if (child instanceof ContainerBlot) {\n return position.concat(child.path(offset, inclusive));\n }\n else if (child != null) {\n position.push([child, offset]);\n }\n return position;\n };\n ContainerBlot.prototype.removeChild = function (child) {\n this.children.remove(child);\n };\n ContainerBlot.prototype.replace = function (target) {\n if (target instanceof ContainerBlot) {\n target.moveChildren(this);\n }\n _super.prototype.replace.call(this, target);\n };\n ContainerBlot.prototype.split = function (index, force) {\n if (force === void 0) { force = false; }\n if (!force) {\n if (index === 0)\n return this;\n if (index === this.length())\n return this.next;\n }\n var after = this.clone();\n this.parent.insertBefore(after, this.next);\n this.children.forEachAt(index, this.length(), function (child, offset, length) {\n child = child.split(offset, force);\n after.appendChild(child);\n });\n return after;\n };\n ContainerBlot.prototype.unwrap = function () {\n this.moveChildren(this.parent, this.next);\n this.remove();\n };\n ContainerBlot.prototype.update = function (mutations, context) {\n var _this = this;\n var addedNodes = [];\n var removedNodes = [];\n mutations.forEach(function (mutation) {\n if (mutation.target === _this.domNode && mutation.type === 'childList') {\n addedNodes.push.apply(addedNodes, mutation.addedNodes);\n removedNodes.push.apply(removedNodes, mutation.removedNodes);\n }\n });\n removedNodes.forEach(function (node) {\n // Check node has actually been removed\n // One exception is Chrome does not immediately remove IFRAMEs\n // from DOM but MutationRecord is correct in its reported removal\n if (node.parentNode != null &&\n // @ts-ignore\n node.tagName !== 'IFRAME' &&\n document.body.compareDocumentPosition(node) & Node.DOCUMENT_POSITION_CONTAINED_BY) {\n return;\n }\n var blot = Registry.find(node);\n if (blot == null)\n return;\n if (blot.domNode.parentNode == null || blot.domNode.parentNode === _this.domNode) {\n blot.detach();\n }\n });\n addedNodes\n .filter(function (node) {\n return node.parentNode == _this.domNode;\n })\n .sort(function (a, b) {\n if (a === b)\n return 0;\n if (a.compareDocumentPosition(b) & Node.DOCUMENT_POSITION_FOLLOWING) {\n return 1;\n }\n return -1;\n })\n .forEach(function (node) {\n var refBlot = null;\n if (node.nextSibling != null) {\n refBlot = Registry.find(node.nextSibling);\n }\n var blot = makeBlot(node);\n if (blot.next != refBlot || blot.next == null) {\n if (blot.parent != null) {\n blot.parent.removeChild(_this);\n }\n _this.insertBefore(blot, refBlot || undefined);\n }\n });\n };\n return ContainerBlot;\n}(shadow_1.default));\nfunction makeBlot(node) {\n var blot = Registry.find(node);\n if (blot == null) {\n try {\n blot = Registry.create(node);\n }\n catch (e) {\n blot = Registry.create(Registry.Scope.INLINE);\n [].slice.call(node.childNodes).forEach(function (child) {\n // @ts-ignore\n blot.domNode.appendChild(child);\n });\n if (node.parentNode) {\n node.parentNode.replaceChild(blot.domNode, node);\n }\n blot.attach();\n }\n }\n return blot;\n}\nexports.default = ContainerBlot;\n\n\n/***/ }),\n/* 18 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar attributor_1 = __webpack_require__(12);\nvar store_1 = __webpack_require__(31);\nvar container_1 = __webpack_require__(17);\nvar Registry = __webpack_require__(1);\nvar FormatBlot = /** @class */ (function (_super) {\n __extends(FormatBlot, _super);\n function FormatBlot(domNode) {\n var _this = _super.call(this, domNode) || this;\n _this.attributes = new store_1.default(_this.domNode);\n return _this;\n }\n FormatBlot.formats = function (domNode) {\n if (typeof this.tagName === 'string') {\n return true;\n }\n else if (Array.isArray(this.tagName)) {\n return domNode.tagName.toLowerCase();\n }\n return undefined;\n };\n FormatBlot.prototype.format = function (name, value) {\n var format = Registry.query(name);\n if (format instanceof attributor_1.default) {\n this.attributes.attribute(format, value);\n }\n else if (value) {\n if (format != null && (name !== this.statics.blotName || this.formats()[name] !== value)) {\n this.replaceWith(name, value);\n }\n }\n };\n FormatBlot.prototype.formats = function () {\n var formats = this.attributes.values();\n var format = this.statics.formats(this.domNode);\n if (format != null) {\n formats[this.statics.blotName] = format;\n }\n return formats;\n };\n FormatBlot.prototype.replaceWith = function (name, value) {\n var replacement = _super.prototype.replaceWith.call(this, name, value);\n this.attributes.copy(replacement);\n return replacement;\n };\n FormatBlot.prototype.update = function (mutations, context) {\n var _this = this;\n _super.prototype.update.call(this, mutations, context);\n if (mutations.some(function (mutation) {\n return mutation.target === _this.domNode && mutation.type === 'attributes';\n })) {\n this.attributes.build();\n }\n };\n FormatBlot.prototype.wrap = function (name, value) {\n var wrapper = _super.prototype.wrap.call(this, name, value);\n if (wrapper instanceof FormatBlot && wrapper.statics.scope === this.statics.scope) {\n this.attributes.move(wrapper);\n }\n return wrapper;\n };\n return FormatBlot;\n}(container_1.default));\nexports.default = FormatBlot;\n\n\n/***/ }),\n/* 19 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar shadow_1 = __webpack_require__(30);\nvar Registry = __webpack_require__(1);\nvar LeafBlot = /** @class */ (function (_super) {\n __extends(LeafBlot, _super);\n function LeafBlot() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n LeafBlot.value = function (domNode) {\n return true;\n };\n LeafBlot.prototype.index = function (node, offset) {\n if (this.domNode === node ||\n this.domNode.compareDocumentPosition(node) & Node.DOCUMENT_POSITION_CONTAINED_BY) {\n return Math.min(offset, 1);\n }\n return -1;\n };\n LeafBlot.prototype.position = function (index, inclusive) {\n var offset = [].indexOf.call(this.parent.domNode.childNodes, this.domNode);\n if (index > 0)\n offset += 1;\n return [this.parent.domNode, offset];\n };\n LeafBlot.prototype.value = function () {\n var _a;\n return _a = {}, _a[this.statics.blotName] = this.statics.value(this.domNode) || true, _a;\n };\n LeafBlot.scope = Registry.Scope.INLINE_BLOT;\n return LeafBlot;\n}(shadow_1.default));\nexports.default = LeafBlot;\n\n\n/***/ }),\n/* 20 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar equal = __webpack_require__(11);\nvar extend = __webpack_require__(3);\n\n\nvar lib = {\n attributes: {\n compose: function (a, b, keepNull) {\n if (typeof a !== 'object') a = {};\n if (typeof b !== 'object') b = {};\n var attributes = extend(true, {}, b);\n if (!keepNull) {\n attributes = Object.keys(attributes).reduce(function (copy, key) {\n if (attributes[key] != null) {\n copy[key] = attributes[key];\n }\n return copy;\n }, {});\n }\n for (var key in a) {\n if (a[key] !== undefined && b[key] === undefined) {\n attributes[key] = a[key];\n }\n }\n return Object.keys(attributes).length > 0 ? attributes : undefined;\n },\n\n diff: function(a, b) {\n if (typeof a !== 'object') a = {};\n if (typeof b !== 'object') b = {};\n var attributes = Object.keys(a).concat(Object.keys(b)).reduce(function (attributes, key) {\n if (!equal(a[key], b[key])) {\n attributes[key] = b[key] === undefined ? null : b[key];\n }\n return attributes;\n }, {});\n return Object.keys(attributes).length > 0 ? attributes : undefined;\n },\n\n transform: function (a, b, priority) {\n if (typeof a !== 'object') return b;\n if (typeof b !== 'object') return undefined;\n if (!priority) return b; // b simply overwrites us without priority\n var attributes = Object.keys(b).reduce(function (attributes, key) {\n if (a[key] === undefined) attributes[key] = b[key]; // null is a valid value\n return attributes;\n }, {});\n return Object.keys(attributes).length > 0 ? attributes : undefined;\n }\n },\n\n iterator: function (ops) {\n return new Iterator(ops);\n },\n\n length: function (op) {\n if (typeof op['delete'] === 'number') {\n return op['delete'];\n } else if (typeof op.retain === 'number') {\n return op.retain;\n } else {\n return typeof op.insert === 'string' ? op.insert.length : 1;\n }\n }\n};\n\n\nfunction Iterator(ops) {\n this.ops = ops;\n this.index = 0;\n this.offset = 0;\n};\n\nIterator.prototype.hasNext = function () {\n return this.peekLength() < Infinity;\n};\n\nIterator.prototype.next = function (length) {\n if (!length) length = Infinity;\n var nextOp = this.ops[this.index];\n if (nextOp) {\n var offset = this.offset;\n var opLength = lib.length(nextOp)\n if (length >= opLength - offset) {\n length = opLength - offset;\n this.index += 1;\n this.offset = 0;\n } else {\n this.offset += length;\n }\n if (typeof nextOp['delete'] === 'number') {\n return { 'delete': length };\n } else {\n var retOp = {};\n if (nextOp.attributes) {\n retOp.attributes = nextOp.attributes;\n }\n if (typeof nextOp.retain === 'number') {\n retOp.retain = length;\n } else if (typeof nextOp.insert === 'string') {\n retOp.insert = nextOp.insert.substr(offset, length);\n } else {\n // offset should === 0, length should === 1\n retOp.insert = nextOp.insert;\n }\n return retOp;\n }\n } else {\n return { retain: Infinity };\n }\n};\n\nIterator.prototype.peek = function () {\n return this.ops[this.index];\n};\n\nIterator.prototype.peekLength = function () {\n if (this.ops[this.index]) {\n // Should never return 0 if our index is being managed correctly\n return lib.length(this.ops[this.index]) - this.offset;\n } else {\n return Infinity;\n }\n};\n\nIterator.prototype.peekType = function () {\n if (this.ops[this.index]) {\n if (typeof this.ops[this.index]['delete'] === 'number') {\n return 'delete';\n } else if (typeof this.ops[this.index].retain === 'number') {\n return 'retain';\n } else {\n return 'insert';\n }\n }\n return 'retain';\n};\n\nIterator.prototype.rest = function () {\n if (!this.hasNext()) {\n return [];\n } else if (this.offset === 0) {\n return this.ops.slice(this.index);\n } else {\n var offset = this.offset;\n var index = this.index;\n var next = this.next();\n var rest = this.ops.slice(this.index);\n this.offset = offset;\n this.index = index;\n return [next].concat(rest);\n }\n};\n\n\nmodule.exports = lib;\n\n\n/***/ }),\n/* 21 */\n/***/ (function(module, exports) {\n\nvar clone = (function() {\n'use strict';\n\nfunction _instanceof(obj, type) {\n return type != null && obj instanceof type;\n}\n\nvar nativeMap;\ntry {\n nativeMap = Map;\n} catch(_) {\n // maybe a reference error because no `Map`. Give it a dummy value that no\n // value will ever be an instanceof.\n nativeMap = function() {};\n}\n\nvar nativeSet;\ntry {\n nativeSet = Set;\n} catch(_) {\n nativeSet = function() {};\n}\n\nvar nativePromise;\ntry {\n nativePromise = Promise;\n} catch(_) {\n nativePromise = function() {};\n}\n\n/**\n * Clones (copies) an Object using deep copying.\n *\n * This function supports circular references by default, but if you are certain\n * there are no circular references in your object, you can save some CPU time\n * by calling clone(obj, false).\n *\n * Caution: if `circular` is false and `parent` contains circular references,\n * your program may enter an infinite loop and crash.\n *\n * @param `parent` - the object to be cloned\n * @param `circular` - set to true if the object to be cloned may contain\n * circular references. (optional - true by default)\n * @param `depth` - set to a number if the object is only to be cloned to\n * a particular depth. (optional - defaults to Infinity)\n * @param `prototype` - sets the prototype to be used when cloning an object.\n * (optional - defaults to parent prototype).\n * @param `includeNonEnumerable` - set to true if the non-enumerable properties\n * should be cloned as well. Non-enumerable properties on the prototype\n * chain will be ignored. (optional - false by default)\n*/\nfunction clone(parent, circular, depth, prototype, includeNonEnumerable) {\n if (typeof circular === 'object') {\n depth = circular.depth;\n prototype = circular.prototype;\n includeNonEnumerable = circular.includeNonEnumerable;\n circular = circular.circular;\n }\n // maintain two arrays for circular references, where corresponding parents\n // and children have the same index\n var allParents = [];\n var allChildren = [];\n\n var useBuffer = typeof Buffer != 'undefined';\n\n if (typeof circular == 'undefined')\n circular = true;\n\n if (typeof depth == 'undefined')\n depth = Infinity;\n\n // recurse this function so we don't reset allParents and allChildren\n function _clone(parent, depth) {\n // cloning null always returns null\n if (parent === null)\n return null;\n\n if (depth === 0)\n return parent;\n\n var child;\n var proto;\n if (typeof parent != 'object') {\n return parent;\n }\n\n if (_instanceof(parent, nativeMap)) {\n child = new nativeMap();\n } else if (_instanceof(parent, nativeSet)) {\n child = new nativeSet();\n } else if (_instanceof(parent, nativePromise)) {\n child = new nativePromise(function (resolve, reject) {\n parent.then(function(value) {\n resolve(_clone(value, depth - 1));\n }, function(err) {\n reject(_clone(err, depth - 1));\n });\n });\n } else if (clone.__isArray(parent)) {\n child = [];\n } else if (clone.__isRegExp(parent)) {\n child = new RegExp(parent.source, __getRegExpFlags(parent));\n if (parent.lastIndex) child.lastIndex = parent.lastIndex;\n } else if (clone.__isDate(parent)) {\n child = new Date(parent.getTime());\n } else if (useBuffer && Buffer.isBuffer(parent)) {\n if (Buffer.allocUnsafe) {\n // Node.js >= 4.5.0\n child = Buffer.allocUnsafe(parent.length);\n } else {\n // Older Node.js versions\n child = new Buffer(parent.length);\n }\n parent.copy(child);\n return child;\n } else if (_instanceof(parent, Error)) {\n child = Object.create(parent);\n } else {\n if (typeof prototype == 'undefined') {\n proto = Object.getPrototypeOf(parent);\n child = Object.create(proto);\n }\n else {\n child = Object.create(prototype);\n proto = prototype;\n }\n }\n\n if (circular) {\n var index = allParents.indexOf(parent);\n\n if (index != -1) {\n return allChildren[index];\n }\n allParents.push(parent);\n allChildren.push(child);\n }\n\n if (_instanceof(parent, nativeMap)) {\n parent.forEach(function(value, key) {\n var keyChild = _clone(key, depth - 1);\n var valueChild = _clone(value, depth - 1);\n child.set(keyChild, valueChild);\n });\n }\n if (_instanceof(parent, nativeSet)) {\n parent.forEach(function(value) {\n var entryChild = _clone(value, depth - 1);\n child.add(entryChild);\n });\n }\n\n for (var i in parent) {\n var attrs;\n if (proto) {\n attrs = Object.getOwnPropertyDescriptor(proto, i);\n }\n\n if (attrs && attrs.set == null) {\n continue;\n }\n child[i] = _clone(parent[i], depth - 1);\n }\n\n if (Object.getOwnPropertySymbols) {\n var symbols = Object.getOwnPropertySymbols(parent);\n for (var i = 0; i < symbols.length; i++) {\n // Don't need to worry about cloning a symbol because it is a primitive,\n // like a number or string.\n var symbol = symbols[i];\n var descriptor = Object.getOwnPropertyDescriptor(parent, symbol);\n if (descriptor && !descriptor.enumerable && !includeNonEnumerable) {\n continue;\n }\n child[symbol] = _clone(parent[symbol], depth - 1);\n if (!descriptor.enumerable) {\n Object.defineProperty(child, symbol, {\n enumerable: false\n });\n }\n }\n }\n\n if (includeNonEnumerable) {\n var allPropertyNames = Object.getOwnPropertyNames(parent);\n for (var i = 0; i < allPropertyNames.length; i++) {\n var propertyName = allPropertyNames[i];\n var descriptor = Object.getOwnPropertyDescriptor(parent, propertyName);\n if (descriptor && descriptor.enumerable) {\n continue;\n }\n child[propertyName] = _clone(parent[propertyName], depth - 1);\n Object.defineProperty(child, propertyName, {\n enumerable: false\n });\n }\n }\n\n return child;\n }\n\n return _clone(parent, depth);\n}\n\n/**\n * Simple flat clone using prototype, accepts only objects, usefull for property\n * override on FLAT configuration object (no nested props).\n *\n * USE WITH CAUTION! This may not behave as you wish if you do not know how this\n * works.\n */\nclone.clonePrototype = function clonePrototype(parent) {\n if (parent === null)\n return null;\n\n var c = function () {};\n c.prototype = parent;\n return new c();\n};\n\n// private utility functions\n\nfunction __objToStr(o) {\n return Object.prototype.toString.call(o);\n}\nclone.__objToStr = __objToStr;\n\nfunction __isDate(o) {\n return typeof o === 'object' && __objToStr(o) === '[object Date]';\n}\nclone.__isDate = __isDate;\n\nfunction __isArray(o) {\n return typeof o === 'object' && __objToStr(o) === '[object Array]';\n}\nclone.__isArray = __isArray;\n\nfunction __isRegExp(o) {\n return typeof o === 'object' && __objToStr(o) === '[object RegExp]';\n}\nclone.__isRegExp = __isRegExp;\n\nfunction __getRegExpFlags(re) {\n var flags = '';\n if (re.global) flags += 'g';\n if (re.ignoreCase) flags += 'i';\n if (re.multiline) flags += 'm';\n return flags;\n}\nclone.__getRegExpFlags = __getRegExpFlags;\n\nreturn clone;\n})();\n\nif (typeof module === 'object' && module.exports) {\n module.exports = clone;\n}\n\n\n/***/ }),\n/* 22 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_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\"]) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); } }; }();\n\nvar _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; }; }();\n\nvar _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if (\"value\" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };\n\nvar _parchment = __webpack_require__(0);\n\nvar _parchment2 = _interopRequireDefault(_parchment);\n\nvar _emitter = __webpack_require__(8);\n\nvar _emitter2 = _interopRequireDefault(_emitter);\n\nvar _block = __webpack_require__(4);\n\nvar _block2 = _interopRequireDefault(_block);\n\nvar _break = __webpack_require__(16);\n\nvar _break2 = _interopRequireDefault(_break);\n\nvar _code = __webpack_require__(13);\n\nvar _code2 = _interopRequireDefault(_code);\n\nvar _container = __webpack_require__(25);\n\nvar _container2 = _interopRequireDefault(_container);\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 _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nfunction isLine(blot) {\n return blot instanceof _block2.default || blot instanceof _block.BlockEmbed;\n}\n\nvar Scroll = function (_Parchment$Scroll) {\n _inherits(Scroll, _Parchment$Scroll);\n\n function Scroll(domNode, config) {\n _classCallCheck(this, Scroll);\n\n var _this = _possibleConstructorReturn(this, (Scroll.__proto__ || Object.getPrototypeOf(Scroll)).call(this, domNode));\n\n _this.emitter = config.emitter;\n if (Array.isArray(config.whitelist)) {\n _this.whitelist = config.whitelist.reduce(function (whitelist, format) {\n whitelist[format] = true;\n return whitelist;\n }, {});\n }\n // Some reason fixes composition issues with character languages in Windows/Chrome, Safari\n _this.domNode.addEventListener('DOMNodeInserted', function () {});\n _this.optimize();\n _this.enable();\n return _this;\n }\n\n _createClass(Scroll, [{\n key: 'batchStart',\n value: function batchStart() {\n this.batch = true;\n }\n }, {\n key: 'batchEnd',\n value: function batchEnd() {\n this.batch = false;\n this.optimize();\n }\n }, {\n key: 'deleteAt',\n value: function deleteAt(index, length) {\n var _line = this.line(index),\n _line2 = _slicedToArray(_line, 2),\n first = _line2[0],\n offset = _line2[1];\n\n var _line3 = this.line(index + length),\n _line4 = _slicedToArray(_line3, 1),\n last = _line4[0];\n\n _get(Scroll.prototype.__proto__ || Object.getPrototypeOf(Scroll.prototype), 'deleteAt', this).call(this, index, length);\n if (last != null && first !== last && offset > 0) {\n if (first instanceof _block.BlockEmbed || last instanceof _block.BlockEmbed) {\n this.optimize();\n return;\n }\n if (first instanceof _code2.default) {\n var newlineIndex = first.newlineIndex(first.length(), true);\n if (newlineIndex > -1) {\n first = first.split(newlineIndex + 1);\n if (first === last) {\n this.optimize();\n return;\n }\n }\n } else if (last instanceof _code2.default) {\n var _newlineIndex = last.newlineIndex(0);\n if (_newlineIndex > -1) {\n last.split(_newlineIndex + 1);\n }\n }\n var ref = last.children.head instanceof _break2.default ? null : last.children.head;\n first.moveChildren(last, ref);\n first.remove();\n }\n this.optimize();\n }\n }, {\n key: 'enable',\n value: function enable() {\n var enabled = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;\n\n this.domNode.setAttribute('contenteditable', enabled);\n }\n }, {\n key: 'formatAt',\n value: function formatAt(index, length, format, value) {\n if (this.whitelist != null && !this.whitelist[format]) return;\n _get(Scroll.prototype.__proto__ || Object.getPrototypeOf(Scroll.prototype), 'formatAt', this).call(this, index, length, format, value);\n this.optimize();\n }\n }, {\n key: 'insertAt',\n value: function insertAt(index, value, def) {\n if (def != null && this.whitelist != null && !this.whitelist[value]) return;\n if (index >= this.length()) {\n if (def == null || _parchment2.default.query(value, _parchment2.default.Scope.BLOCK) == null) {\n var blot = _parchment2.default.create(this.statics.defaultChild);\n this.appendChild(blot);\n if (def == null && value.endsWith('\\n')) {\n value = value.slice(0, -1);\n }\n blot.insertAt(0, value, def);\n } else {\n var embed = _parchment2.default.create(value, def);\n this.appendChild(embed);\n }\n } else {\n _get(Scroll.prototype.__proto__ || Object.getPrototypeOf(Scroll.prototype), 'insertAt', this).call(this, index, value, def);\n }\n this.optimize();\n }\n }, {\n key: 'insertBefore',\n value: function insertBefore(blot, ref) {\n if (blot.statics.scope === _parchment2.default.Scope.INLINE_BLOT) {\n var wrapper = _parchment2.default.create(this.statics.defaultChild);\n wrapper.appendChild(blot);\n blot = wrapper;\n }\n _get(Scroll.prototype.__proto__ || Object.getPrototypeOf(Scroll.prototype), 'insertBefore', this).call(this, blot, ref);\n }\n }, {\n key: 'leaf',\n value: function leaf(index) {\n return this.path(index).pop() || [null, -1];\n }\n }, {\n key: 'line',\n value: function line(index) {\n if (index === this.length()) {\n return this.line(index - 1);\n }\n return this.descendant(isLine, index);\n }\n }, {\n key: 'lines',\n value: function lines() {\n var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;\n var length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Number.MAX_VALUE;\n\n var getLines = function getLines(blot, index, length) {\n var lines = [],\n lengthLeft = length;\n blot.children.forEachAt(index, length, function (child, index, length) {\n if (isLine(child)) {\n lines.push(child);\n } else if (child instanceof _parchment2.default.Container) {\n lines = lines.concat(getLines(child, index, lengthLeft));\n }\n lengthLeft -= length;\n });\n return lines;\n };\n return getLines(this, index, length);\n }\n }, {\n key: 'optimize',\n value: function optimize() {\n var mutations = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];\n var context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n if (this.batch === true) return;\n _get(Scroll.prototype.__proto__ || Object.getPrototypeOf(Scroll.prototype), 'optimize', this).call(this, mutations, context);\n if (mutations.length > 0) {\n this.emitter.emit(_emitter2.default.events.SCROLL_OPTIMIZE, mutations, context);\n }\n }\n }, {\n key: 'path',\n value: function path(index) {\n return _get(Scroll.prototype.__proto__ || Object.getPrototypeOf(Scroll.prototype), 'path', this).call(this, index).slice(1); // Exclude self\n }\n }, {\n key: 'update',\n value: function update(mutations) {\n if (this.batch === true) return;\n var source = _emitter2.default.sources.USER;\n if (typeof mutations === 'string') {\n source = mutations;\n }\n if (!Array.isArray(mutations)) {\n mutations = this.observer.takeRecords();\n }\n if (mutations.length > 0) {\n this.emitter.emit(_emitter2.default.events.SCROLL_BEFORE_UPDATE, source, mutations);\n }\n _get(Scroll.prototype.__proto__ || Object.getPrototypeOf(Scroll.prototype), 'update', this).call(this, mutations.concat([])); // pass copy\n if (mutations.length > 0) {\n this.emitter.emit(_emitter2.default.events.SCROLL_UPDATE, source, mutations);\n }\n }\n }]);\n\n return Scroll;\n}(_parchment2.default.Scroll);\n\nScroll.blotName = 'scroll';\nScroll.className = 'ql-editor';\nScroll.tagName = 'DIV';\nScroll.defaultChild = 'block';\nScroll.allowedChildren = [_block2.default, _block.BlockEmbed, _container2.default];\n\nexports.default = Scroll;\n\n/***/ }),\n/* 23 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.SHORTKEY = exports.default = undefined;\n\nvar _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; };\n\nvar _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_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\"]) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); } }; }();\n\nvar _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; }; }();\n\nvar _clone = __webpack_require__(21);\n\nvar _clone2 = _interopRequireDefault(_clone);\n\nvar _deepEqual = __webpack_require__(11);\n\nvar _deepEqual2 = _interopRequireDefault(_deepEqual);\n\nvar _extend = __webpack_require__(3);\n\nvar _extend2 = _interopRequireDefault(_extend);\n\nvar _quillDelta = __webpack_require__(2);\n\nvar _quillDelta2 = _interopRequireDefault(_quillDelta);\n\nvar _op = __webpack_require__(20);\n\nvar _op2 = _interopRequireDefault(_op);\n\nvar _parchment = __webpack_require__(0);\n\nvar _parchment2 = _interopRequireDefault(_parchment);\n\nvar _quill = __webpack_require__(5);\n\nvar _quill2 = _interopRequireDefault(_quill);\n\nvar _logger = __webpack_require__(10);\n\nvar _logger2 = _interopRequireDefault(_logger);\n\nvar _module = __webpack_require__(9);\n\nvar _module2 = _interopRequireDefault(_module);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\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 _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nvar debug = (0, _logger2.default)('quill:keyboard');\n\nvar SHORTKEY = /Mac/i.test(navigator.platform) ? 'metaKey' : 'ctrlKey';\n\nvar Keyboard = function (_Module) {\n _inherits(Keyboard, _Module);\n\n _createClass(Keyboard, null, [{\n key: 'match',\n value: function match(evt, binding) {\n binding = normalize(binding);\n if (['altKey', 'ctrlKey', 'metaKey', 'shiftKey'].some(function (key) {\n return !!binding[key] !== evt[key] && binding[key] !== null;\n })) {\n return false;\n }\n return binding.key === (evt.which || evt.keyCode);\n }\n }]);\n\n function Keyboard(quill, options) {\n _classCallCheck(this, Keyboard);\n\n var _this = _possibleConstructorReturn(this, (Keyboard.__proto__ || Object.getPrototypeOf(Keyboard)).call(this, quill, options));\n\n _this.bindings = {};\n Object.keys(_this.options.bindings).forEach(function (name) {\n if (name === 'list autofill' && quill.scroll.whitelist != null && !quill.scroll.whitelist['list']) {\n return;\n }\n if (_this.options.bindings[name]) {\n _this.addBinding(_this.options.bindings[name]);\n }\n });\n _this.addBinding({ key: Keyboard.keys.ENTER, shiftKey: null }, handleEnter);\n _this.addBinding({ key: Keyboard.keys.ENTER, metaKey: null, ctrlKey: null, altKey: null }, function () {});\n if (/Firefox/i.test(navigator.userAgent)) {\n // Need to handle delete and backspace for Firefox in the general case #1171\n _this.addBinding({ key: Keyboard.keys.BACKSPACE }, { collapsed: true }, handleBackspace);\n _this.addBinding({ key: Keyboard.keys.DELETE }, { collapsed: true }, handleDelete);\n } else {\n _this.addBinding({ key: Keyboard.keys.BACKSPACE }, { collapsed: true, prefix: /^.?$/ }, handleBackspace);\n _this.addBinding({ key: Keyboard.keys.DELETE }, { collapsed: true, suffix: /^.?$/ }, handleDelete);\n }\n _this.addBinding({ key: Keyboard.keys.BACKSPACE }, { collapsed: false }, handleDeleteRange);\n _this.addBinding({ key: Keyboard.keys.DELETE }, { collapsed: false }, handleDeleteRange);\n _this.addBinding({ key: Keyboard.keys.BACKSPACE, altKey: null, ctrlKey: null, metaKey: null, shiftKey: null }, { collapsed: true, offset: 0 }, handleBackspace);\n _this.listen();\n return _this;\n }\n\n _createClass(Keyboard, [{\n key: 'addBinding',\n value: function addBinding(key) {\n var context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n var handler = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n\n var binding = normalize(key);\n if (binding == null || binding.key == null) {\n return debug.warn('Attempted to add invalid keyboard binding', binding);\n }\n if (typeof context === 'function') {\n context = { handler: context };\n }\n if (typeof handler === 'function') {\n handler = { handler: handler };\n }\n binding = (0, _extend2.default)(binding, context, handler);\n this.bindings[binding.key] = this.bindings[binding.key] || [];\n this.bindings[binding.key].push(binding);\n }\n }, {\n key: 'listen',\n value: function listen() {\n var _this2 = this;\n\n this.quill.root.addEventListener('keydown', function (evt) {\n if (evt.defaultPrevented) return;\n var which = evt.which || evt.keyCode;\n var bindings = (_this2.bindings[which] || []).filter(function (binding) {\n return Keyboard.match(evt, binding);\n });\n if (bindings.length === 0) return;\n var range = _this2.quill.getSelection();\n if (range == null || !_this2.quill.hasFocus()) return;\n\n var _quill$getLine = _this2.quill.getLine(range.index),\n _quill$getLine2 = _slicedToArray(_quill$getLine, 2),\n line = _quill$getLine2[0],\n offset = _quill$getLine2[1];\n\n var _quill$getLeaf = _this2.quill.getLeaf(range.index),\n _quill$getLeaf2 = _slicedToArray(_quill$getLeaf, 2),\n leafStart = _quill$getLeaf2[0],\n offsetStart = _quill$getLeaf2[1];\n\n var _ref = range.length === 0 ? [leafStart, offsetStart] : _this2.quill.getLeaf(range.index + range.length),\n _ref2 = _slicedToArray(_ref, 2),\n leafEnd = _ref2[0],\n offsetEnd = _ref2[1];\n\n var prefixText = leafStart instanceof _parchment2.default.Text ? leafStart.value().slice(0, offsetStart) : '';\n var suffixText = leafEnd instanceof _parchment2.default.Text ? leafEnd.value().slice(offsetEnd) : '';\n var curContext = {\n collapsed: range.length === 0,\n empty: range.length === 0 && line.length() <= 1,\n format: _this2.quill.getFormat(range),\n offset: offset,\n prefix: prefixText,\n suffix: suffixText\n };\n var prevented = bindings.some(function (binding) {\n if (binding.collapsed != null && binding.collapsed !== curContext.collapsed) return false;\n if (binding.empty != null && binding.empty !== curContext.empty) return false;\n if (binding.offset != null && binding.offset !== curContext.offset) return false;\n if (Array.isArray(binding.format)) {\n // any format is present\n if (binding.format.every(function (name) {\n return curContext.format[name] == null;\n })) {\n return false;\n }\n } else if (_typeof(binding.format) === 'object') {\n // all formats must match\n if (!Object.keys(binding.format).every(function (name) {\n if (binding.format[name] === true) return curContext.format[name] != null;\n if (binding.format[name] === false) return curContext.format[name] == null;\n return (0, _deepEqual2.default)(binding.format[name], curContext.format[name]);\n })) {\n return false;\n }\n }\n if (binding.prefix != null && !binding.prefix.test(curContext.prefix)) return false;\n if (binding.suffix != null && !binding.suffix.test(curContext.suffix)) return false;\n return binding.handler.call(_this2, range, curContext) !== true;\n });\n if (prevented) {\n evt.preventDefault();\n }\n });\n }\n }]);\n\n return Keyboard;\n}(_module2.default);\n\nKeyboard.keys = {\n BACKSPACE: 8,\n TAB: 9,\n ENTER: 13,\n ESCAPE: 27,\n LEFT: 37,\n UP: 38,\n RIGHT: 39,\n DOWN: 40,\n DELETE: 46\n};\n\nKeyboard.DEFAULTS = {\n bindings: {\n 'bold': makeFormatHandler('bold'),\n 'italic': makeFormatHandler('italic'),\n 'underline': makeFormatHandler('underline'),\n 'indent': {\n // highlight tab or tab at beginning of list, indent or blockquote\n key: Keyboard.keys.TAB,\n format: ['blockquote', 'indent', 'list'],\n handler: function handler(range, context) {\n if (context.collapsed && context.offset !== 0) return true;\n this.quill.format('indent', '+1', _quill2.default.sources.USER);\n }\n },\n 'outdent': {\n key: Keyboard.keys.TAB,\n shiftKey: true,\n format: ['blockquote', 'indent', 'list'],\n // highlight tab or tab at beginning of list, indent or blockquote\n handler: function handler(range, context) {\n if (context.collapsed && context.offset !== 0) return true;\n this.quill.format('indent', '-1', _quill2.default.sources.USER);\n }\n },\n 'outdent backspace': {\n key: Keyboard.keys.BACKSPACE,\n collapsed: true,\n shiftKey: null,\n metaKey: null,\n ctrlKey: null,\n altKey: null,\n format: ['indent', 'list'],\n offset: 0,\n handler: function handler(range, context) {\n if (context.format.indent != null) {\n this.quill.format('indent', '-1', _quill2.default.sources.USER);\n } else if (context.format.list != null) {\n this.quill.format('list', false, _quill2.default.sources.USER);\n }\n }\n },\n 'indent code-block': makeCodeBlockHandler(true),\n 'outdent code-block': makeCodeBlockHandler(false),\n 'remove tab': {\n key: Keyboard.keys.TAB,\n shiftKey: true,\n collapsed: true,\n prefix: /\\t$/,\n handler: function handler(range) {\n this.quill.deleteText(range.index - 1, 1, _quill2.default.sources.USER);\n }\n },\n 'tab': {\n key: Keyboard.keys.TAB,\n handler: function handler(range) {\n this.quill.history.cutoff();\n var delta = new _quillDelta2.default().retain(range.index).delete(range.length).insert('\\t');\n this.quill.updateContents(delta, _quill2.default.sources.USER);\n this.quill.history.cutoff();\n this.quill.setSelection(range.index + 1, _quill2.default.sources.SILENT);\n }\n },\n 'list empty enter': {\n key: Keyboard.keys.ENTER,\n collapsed: true,\n format: ['list'],\n empty: true,\n handler: function handler(range, context) {\n this.quill.format('list', false, _quill2.default.sources.USER);\n if (context.format.indent) {\n this.quill.format('indent', false, _quill2.default.sources.USER);\n }\n }\n },\n 'checklist enter': {\n key: Keyboard.keys.ENTER,\n collapsed: true,\n format: { list: 'checked' },\n handler: function handler(range) {\n var _quill$getLine3 = this.quill.getLine(range.index),\n _quill$getLine4 = _slicedToArray(_quill$getLine3, 2),\n line = _quill$getLine4[0],\n offset = _quill$getLine4[1];\n\n var formats = (0, _extend2.default)({}, line.formats(), { list: 'checked' });\n var delta = new _quillDelta2.default().retain(range.index).insert('\\n', formats).retain(line.length() - offset - 1).retain(1, { list: 'unchecked' });\n this.quill.updateContents(delta, _quill2.default.sources.USER);\n this.quill.setSelection(range.index + 1, _quill2.default.sources.SILENT);\n this.quill.scrollIntoView();\n }\n },\n 'header enter': {\n key: Keyboard.keys.ENTER,\n collapsed: true,\n format: ['header'],\n suffix: /^$/,\n handler: function handler(range, context) {\n var _quill$getLine5 = this.quill.getLine(range.index),\n _quill$getLine6 = _slicedToArray(_quill$getLine5, 2),\n line = _quill$getLine6[0],\n offset = _quill$getLine6[1];\n\n var delta = new _quillDelta2.default().retain(range.index).insert('\\n', context.format).retain(line.length() - offset - 1).retain(1, { header: null });\n this.quill.updateContents(delta, _quill2.default.sources.USER);\n this.quill.setSelection(range.index + 1, _quill2.default.sources.SILENT);\n this.quill.scrollIntoView();\n }\n },\n 'list autofill': {\n key: ' ',\n collapsed: true,\n format: { list: false },\n prefix: /^\\s*?(\\d+\\.|-|\\*|\\[ ?\\]|\\[x\\])$/,\n handler: function handler(range, context) {\n var length = context.prefix.length;\n\n var _quill$getLine7 = this.quill.getLine(range.index),\n _quill$getLine8 = _slicedToArray(_quill$getLine7, 2),\n line = _quill$getLine8[0],\n offset = _quill$getLine8[1];\n\n if (offset > length) return true;\n var value = void 0;\n switch (context.prefix.trim()) {\n case '[]':case '[ ]':\n value = 'unchecked';\n break;\n case '[x]':\n value = 'checked';\n break;\n case '-':case '*':\n value = 'bullet';\n break;\n default:\n value = 'ordered';\n }\n this.quill.insertText(range.index, ' ', _quill2.default.sources.USER);\n this.quill.history.cutoff();\n var delta = new _quillDelta2.default().retain(range.index - offset).delete(length + 1).retain(line.length() - 2 - offset).retain(1, { list: value });\n this.quill.updateContents(delta, _quill2.default.sources.USER);\n this.quill.history.cutoff();\n this.quill.setSelection(range.index - length, _quill2.default.sources.SILENT);\n }\n },\n 'code exit': {\n key: Keyboard.keys.ENTER,\n collapsed: true,\n format: ['code-block'],\n prefix: /\\n\\n$/,\n suffix: /^\\s+$/,\n handler: function handler(range) {\n var _quill$getLine9 = this.quill.getLine(range.index),\n _quill$getLine10 = _slicedToArray(_quill$getLine9, 2),\n line = _quill$getLine10[0],\n offset = _quill$getLine10[1];\n\n var delta = new _quillDelta2.default().retain(range.index + line.length() - offset - 2).retain(1, { 'code-block': null }).delete(1);\n this.quill.updateContents(delta, _quill2.default.sources.USER);\n }\n },\n 'embed left': makeEmbedArrowHandler(Keyboard.keys.LEFT, false),\n 'embed left shift': makeEmbedArrowHandler(Keyboard.keys.LEFT, true),\n 'embed right': makeEmbedArrowHandler(Keyboard.keys.RIGHT, false),\n 'embed right shift': makeEmbedArrowHandler(Keyboard.keys.RIGHT, true)\n }\n};\n\nfunction makeEmbedArrowHandler(key, shiftKey) {\n var _ref3;\n\n var where = key === Keyboard.keys.LEFT ? 'prefix' : 'suffix';\n return _ref3 = {\n key: key,\n shiftKey: shiftKey,\n altKey: null\n }, _defineProperty(_ref3, where, /^$/), _defineProperty(_ref3, 'handler', function handler(range) {\n var index = range.index;\n if (key === Keyboard.keys.RIGHT) {\n index += range.length + 1;\n }\n\n var _quill$getLeaf3 = this.quill.getLeaf(index),\n _quill$getLeaf4 = _slicedToArray(_quill$getLeaf3, 1),\n leaf = _quill$getLeaf4[0];\n\n if (!(leaf instanceof _parchment2.default.Embed)) return true;\n if (key === Keyboard.keys.LEFT) {\n if (shiftKey) {\n this.quill.setSelection(range.index - 1, range.length + 1, _quill2.default.sources.USER);\n } else {\n this.quill.setSelection(range.index - 1, _quill2.default.sources.USER);\n }\n } else {\n if (shiftKey) {\n this.quill.setSelection(range.index, range.length + 1, _quill2.default.sources.USER);\n } else {\n this.quill.setSelection(range.index + range.length + 1, _quill2.default.sources.USER);\n }\n }\n return false;\n }), _ref3;\n}\n\nfunction handleBackspace(range, context) {\n if (range.index === 0 || this.quill.getLength() <= 1) return;\n\n var _quill$getLine11 = this.quill.getLine(range.index),\n _quill$getLine12 = _slicedToArray(_quill$getLine11, 1),\n line = _quill$getLine12[0];\n\n var formats = {};\n if (context.offset === 0) {\n var _quill$getLine13 = this.quill.getLine(range.index - 1),\n _quill$getLine14 = _slicedToArray(_quill$getLine13, 1),\n prev = _quill$getLine14[0];\n\n if (prev != null && prev.length() > 1) {\n var curFormats = line.formats();\n var prevFormats = this.quill.getFormat(range.index - 1, 1);\n formats = _op2.default.attributes.diff(curFormats, prevFormats) || {};\n }\n }\n // Check for astral symbols\n var length = /[\\uD800-\\uDBFF][\\uDC00-\\uDFFF]$/.test(context.prefix) ? 2 : 1;\n this.quill.deleteText(range.index - length, length, _quill2.default.sources.USER);\n if (Object.keys(formats).length > 0) {\n this.quill.formatLine(range.index - length, length, formats, _quill2.default.sources.USER);\n }\n this.quill.focus();\n}\n\nfunction handleDelete(range, context) {\n // Check for astral symbols\n var length = /^[\\uD800-\\uDBFF][\\uDC00-\\uDFFF]/.test(context.suffix) ? 2 : 1;\n if (range.index >= this.quill.getLength() - length) return;\n var formats = {},\n nextLength = 0;\n\n var _quill$getLine15 = this.quill.getLine(range.index),\n _quill$getLine16 = _slicedToArray(_quill$getLine15, 1),\n line = _quill$getLine16[0];\n\n if (context.offset >= line.length() - 1) {\n var _quill$getLine17 = this.quill.getLine(range.index + 1),\n _quill$getLine18 = _slicedToArray(_quill$getLine17, 1),\n next = _quill$getLine18[0];\n\n if (next) {\n var curFormats = line.formats();\n var nextFormats = this.quill.getFormat(range.index, 1);\n formats = _op2.default.attributes.diff(curFormats, nextFormats) || {};\n nextLength = next.length();\n }\n }\n this.quill.deleteText(range.index, length, _quill2.default.sources.USER);\n if (Object.keys(formats).length > 0) {\n this.quill.formatLine(range.index + nextLength - 1, length, formats, _quill2.default.sources.USER);\n }\n}\n\nfunction handleDeleteRange(range) {\n var lines = this.quill.getLines(range);\n var formats = {};\n if (lines.length > 1) {\n var firstFormats = lines[0].formats();\n var lastFormats = lines[lines.length - 1].formats();\n formats = _op2.default.attributes.diff(lastFormats, firstFormats) || {};\n }\n this.quill.deleteText(range, _quill2.default.sources.USER);\n if (Object.keys(formats).length > 0) {\n this.quill.formatLine(range.index, 1, formats, _quill2.default.sources.USER);\n }\n this.quill.setSelection(range.index, _quill2.default.sources.SILENT);\n this.quill.focus();\n}\n\nfunction handleEnter(range, context) {\n var _this3 = this;\n\n if (range.length > 0) {\n this.quill.scroll.deleteAt(range.index, range.length); // So we do not trigger text-change\n }\n var lineFormats = Object.keys(context.format).reduce(function (lineFormats, format) {\n if (_parchment2.default.query(format, _parchment2.default.Scope.BLOCK) && !Array.isArray(context.format[format])) {\n lineFormats[format] = context.format[format];\n }\n return lineFormats;\n }, {});\n this.quill.insertText(range.index, '\\n', lineFormats, _quill2.default.sources.USER);\n // Earlier scroll.deleteAt might have messed up our selection,\n // so insertText's built in selection preservation is not reliable\n this.quill.setSelection(range.index + 1, _quill2.default.sources.SILENT);\n this.quill.focus();\n Object.keys(context.format).forEach(function (name) {\n if (lineFormats[name] != null) return;\n if (Array.isArray(context.format[name])) return;\n if (name === 'link') return;\n _this3.quill.format(name, context.format[name], _quill2.default.sources.USER);\n });\n}\n\nfunction makeCodeBlockHandler(indent) {\n return {\n key: Keyboard.keys.TAB,\n shiftKey: !indent,\n format: { 'code-block': true },\n handler: function handler(range) {\n var CodeBlock = _parchment2.default.query('code-block');\n var index = range.index,\n length = range.length;\n\n var _quill$scroll$descend = this.quill.scroll.descendant(CodeBlock, index),\n _quill$scroll$descend2 = _slicedToArray(_quill$scroll$descend, 2),\n block = _quill$scroll$descend2[0],\n offset = _quill$scroll$descend2[1];\n\n if (block == null) return;\n var scrollIndex = this.quill.getIndex(block);\n var start = block.newlineIndex(offset, true) + 1;\n var end = block.newlineIndex(scrollIndex + offset + length);\n var lines = block.domNode.textContent.slice(start, end).split('\\n');\n offset = 0;\n lines.forEach(function (line, i) {\n if (indent) {\n block.insertAt(start + offset, CodeBlock.TAB);\n offset += CodeBlock.TAB.length;\n if (i === 0) {\n index += CodeBlock.TAB.length;\n } else {\n length += CodeBlock.TAB.length;\n }\n } else if (line.startsWith(CodeBlock.TAB)) {\n block.deleteAt(start + offset, CodeBlock.TAB.length);\n offset -= CodeBlock.TAB.length;\n if (i === 0) {\n index -= CodeBlock.TAB.length;\n } else {\n length -= CodeBlock.TAB.length;\n }\n }\n offset += line.length + 1;\n });\n this.quill.update(_quill2.default.sources.USER);\n this.quill.setSelection(index, length, _quill2.default.sources.SILENT);\n }\n };\n}\n\nfunction makeFormatHandler(format) {\n return {\n key: format[0].toUpperCase(),\n shortKey: true,\n handler: function handler(range, context) {\n this.quill.format(format, !context.format[format], _quill2.default.sources.USER);\n }\n };\n}\n\nfunction normalize(binding) {\n if (typeof binding === 'string' || typeof binding === 'number') {\n return normalize({ key: binding });\n }\n if ((typeof binding === 'undefined' ? 'undefined' : _typeof(binding)) === 'object') {\n binding = (0, _clone2.default)(binding, false);\n }\n if (typeof binding.key === 'string') {\n if (Keyboard.keys[binding.key.toUpperCase()] != null) {\n binding.key = Keyboard.keys[binding.key.toUpperCase()];\n } else if (binding.key.length === 1) {\n binding.key = binding.key.toUpperCase().charCodeAt(0);\n } else {\n return null;\n }\n }\n if (binding.shortKey) {\n binding[SHORTKEY] = binding.shortKey;\n delete binding.shortKey;\n }\n return binding;\n}\n\nexports.default = Keyboard;\nexports.SHORTKEY = SHORTKEY;\n\n/***/ }),\n/* 24 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_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\"]) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); } }; }();\n\nvar _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if (\"value\" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };\n\nvar _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; }; }();\n\nvar _parchment = __webpack_require__(0);\n\nvar _parchment2 = _interopRequireDefault(_parchment);\n\nvar _text = __webpack_require__(7);\n\nvar _text2 = _interopRequireDefault(_text);\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 _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nvar Cursor = function (_Parchment$Embed) {\n _inherits(Cursor, _Parchment$Embed);\n\n _createClass(Cursor, null, [{\n key: 'value',\n value: function value() {\n return undefined;\n }\n }]);\n\n function Cursor(domNode, selection) {\n _classCallCheck(this, Cursor);\n\n var _this = _possibleConstructorReturn(this, (Cursor.__proto__ || Object.getPrototypeOf(Cursor)).call(this, domNode));\n\n _this.selection = selection;\n _this.textNode = document.createTextNode(Cursor.CONTENTS);\n _this.domNode.appendChild(_this.textNode);\n _this._length = 0;\n return _this;\n }\n\n _createClass(Cursor, [{\n key: 'detach',\n value: function detach() {\n // super.detach() will also clear domNode.__blot\n if (this.parent != null) this.parent.removeChild(this);\n }\n }, {\n key: 'format',\n value: function format(name, value) {\n if (this._length !== 0) {\n return _get(Cursor.prototype.__proto__ || Object.getPrototypeOf(Cursor.prototype), 'format', this).call(this, name, value);\n }\n var target = this,\n index = 0;\n while (target != null && target.statics.scope !== _parchment2.default.Scope.BLOCK_BLOT) {\n index += target.offset(target.parent);\n target = target.parent;\n }\n if (target != null) {\n this._length = Cursor.CONTENTS.length;\n target.optimize();\n target.formatAt(index, Cursor.CONTENTS.length, name, value);\n this._length = 0;\n }\n }\n }, {\n key: 'index',\n value: function index(node, offset) {\n if (node === this.textNode) return 0;\n return _get(Cursor.prototype.__proto__ || Object.getPrototypeOf(Cursor.prototype), 'index', this).call(this, node, offset);\n }\n }, {\n key: 'length',\n value: function length() {\n return this._length;\n }\n }, {\n key: 'position',\n value: function position() {\n return [this.textNode, this.textNode.data.length];\n }\n }, {\n key: 'remove',\n value: function remove() {\n _get(Cursor.prototype.__proto__ || Object.getPrototypeOf(Cursor.prototype), 'remove', this).call(this);\n this.parent = null;\n }\n }, {\n key: 'restore',\n value: function restore() {\n if (this.selection.composing || this.parent == null) return;\n var textNode = this.textNode;\n var range = this.selection.getNativeRange();\n var restoreText = void 0,\n start = void 0,\n end = void 0;\n if (range != null && range.start.node === textNode && range.end.node === textNode) {\n var _ref = [textNode, range.start.offset, range.end.offset];\n restoreText = _ref[0];\n start = _ref[1];\n end = _ref[2];\n }\n // Link format will insert text outside of anchor tag\n while (this.domNode.lastChild != null && this.domNode.lastChild !== this.textNode) {\n this.domNode.parentNode.insertBefore(this.domNode.lastChild, this.domNode);\n }\n if (this.textNode.data !== Cursor.CONTENTS) {\n var text = this.textNode.data.split(Cursor.CONTENTS).join('');\n if (this.next instanceof _text2.default) {\n restoreText = this.next.domNode;\n this.next.insertAt(0, text);\n this.textNode.data = Cursor.CONTENTS;\n } else {\n this.textNode.data = text;\n this.parent.insertBefore(_parchment2.default.create(this.textNode), this);\n this.textNode = document.createTextNode(Cursor.CONTENTS);\n this.domNode.appendChild(this.textNode);\n }\n }\n this.remove();\n if (start != null) {\n var _map = [start, end].map(function (offset) {\n return Math.max(0, Math.min(restoreText.data.length, offset - 1));\n });\n\n var _map2 = _slicedToArray(_map, 2);\n\n start = _map2[0];\n end = _map2[1];\n\n return {\n startNode: restoreText,\n startOffset: start,\n endNode: restoreText,\n endOffset: end\n };\n }\n }\n }, {\n key: 'update',\n value: function update(mutations, context) {\n var _this2 = this;\n\n if (mutations.some(function (mutation) {\n return mutation.type === 'characterData' && mutation.target === _this2.textNode;\n })) {\n var range = this.restore();\n if (range) context.range = range;\n }\n }\n }, {\n key: 'value',\n value: function value() {\n return '';\n }\n }]);\n\n return Cursor;\n}(_parchment2.default.Embed);\n\nCursor.blotName = 'cursor';\nCursor.className = 'ql-cursor';\nCursor.tagName = 'span';\nCursor.CONTENTS = '\\uFEFF'; // Zero width no break space\n\n\nexports.default = Cursor;\n\n/***/ }),\n/* 25 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _parchment = __webpack_require__(0);\n\nvar _parchment2 = _interopRequireDefault(_parchment);\n\nvar _block = __webpack_require__(4);\n\nvar _block2 = _interopRequireDefault(_block);\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 _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nvar Container = function (_Parchment$Container) {\n _inherits(Container, _Parchment$Container);\n\n function Container() {\n _classCallCheck(this, Container);\n\n return _possibleConstructorReturn(this, (Container.__proto__ || Object.getPrototypeOf(Container)).apply(this, arguments));\n }\n\n return Container;\n}(_parchment2.default.Container);\n\nContainer.allowedChildren = [_block2.default, _block.BlockEmbed, Container];\n\nexports.default = Container;\n\n/***/ }),\n/* 26 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.ColorStyle = exports.ColorClass = exports.ColorAttributor = undefined;\n\nvar _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; }; }();\n\nvar _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if (\"value\" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };\n\nvar _parchment = __webpack_require__(0);\n\nvar _parchment2 = _interopRequireDefault(_parchment);\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 _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nvar ColorAttributor = function (_Parchment$Attributor) {\n _inherits(ColorAttributor, _Parchment$Attributor);\n\n function ColorAttributor() {\n _classCallCheck(this, ColorAttributor);\n\n return _possibleConstructorReturn(this, (ColorAttributor.__proto__ || Object.getPrototypeOf(ColorAttributor)).apply(this, arguments));\n }\n\n _createClass(ColorAttributor, [{\n key: 'value',\n value: function value(domNode) {\n var value = _get(ColorAttributor.prototype.__proto__ || Object.getPrototypeOf(ColorAttributor.prototype), 'value', this).call(this, domNode);\n if (!value.startsWith('rgb(')) return value;\n value = value.replace(/^[^\\d]+/, '').replace(/[^\\d]+$/, '');\n return '#' + value.split(',').map(function (component) {\n return ('00' + parseInt(component).toString(16)).slice(-2);\n }).join('');\n }\n }]);\n\n return ColorAttributor;\n}(_parchment2.default.Attributor.Style);\n\nvar ColorClass = new _parchment2.default.Attributor.Class('color', 'ql-color', {\n scope: _parchment2.default.Scope.INLINE\n});\nvar ColorStyle = new ColorAttributor('color', 'color', {\n scope: _parchment2.default.Scope.INLINE\n});\n\nexports.ColorAttributor = ColorAttributor;\nexports.ColorClass = ColorClass;\nexports.ColorStyle = ColorStyle;\n\n/***/ }),\n/* 27 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.sanitize = exports.default = undefined;\n\nvar _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; }; }();\n\nvar _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if (\"value\" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };\n\nvar _inline = __webpack_require__(6);\n\nvar _inline2 = _interopRequireDefault(_inline);\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 _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nvar Link = function (_Inline) {\n _inherits(Link, _Inline);\n\n function Link() {\n _classCallCheck(this, Link);\n\n return _possibleConstructorReturn(this, (Link.__proto__ || Object.getPrototypeOf(Link)).apply(this, arguments));\n }\n\n _createClass(Link, [{\n key: 'format',\n value: function format(name, value) {\n if (name !== this.statics.blotName || !value) return _get(Link.prototype.__proto__ || Object.getPrototypeOf(Link.prototype), 'format', this).call(this, name, value);\n value = this.constructor.sanitize(value);\n this.domNode.setAttribute('href', value);\n }\n }], [{\n key: 'create',\n value: function create(value) {\n var node = _get(Link.__proto__ || Object.getPrototypeOf(Link), 'create', this).call(this, value);\n value = this.sanitize(value);\n node.setAttribute('href', value);\n node.setAttribute('rel', 'noopener noreferrer');\n node.setAttribute('target', '_blank');\n return node;\n }\n }, {\n key: 'formats',\n value: function formats(domNode) {\n return domNode.getAttribute('href');\n }\n }, {\n key: 'sanitize',\n value: function sanitize(url) {\n return _sanitize(url, this.PROTOCOL_WHITELIST) ? url : this.SANITIZED_URL;\n }\n }]);\n\n return Link;\n}(_inline2.default);\n\nLink.blotName = 'link';\nLink.tagName = 'A';\nLink.SANITIZED_URL = 'about:blank';\nLink.PROTOCOL_WHITELIST = ['http', 'https', 'mailto', 'tel'];\n\nfunction _sanitize(url, protocols) {\n var anchor = document.createElement('a');\n anchor.href = url;\n var protocol = anchor.href.slice(0, anchor.href.indexOf(':'));\n return protocols.indexOf(protocol) > -1;\n}\n\nexports.default = Link;\nexports.sanitize = _sanitize;\n\n/***/ }),\n/* 28 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _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; };\n\nvar _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; }; }();\n\nvar _keyboard = __webpack_require__(23);\n\nvar _keyboard2 = _interopRequireDefault(_keyboard);\n\nvar _dropdown = __webpack_require__(107);\n\nvar _dropdown2 = _interopRequireDefault(_dropdown);\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\nvar optionsCounter = 0;\n\nfunction toggleAriaAttribute(element, attribute) {\n element.setAttribute(attribute, !(element.getAttribute(attribute) === 'true'));\n}\n\nvar Picker = function () {\n function Picker(select) {\n var _this = this;\n\n _classCallCheck(this, Picker);\n\n this.select = select;\n this.container = document.createElement('span');\n this.buildPicker();\n this.select.style.display = 'none';\n this.select.parentNode.insertBefore(this.container, this.select);\n\n this.label.addEventListener('mousedown', function () {\n _this.togglePicker();\n });\n this.label.addEventListener('keydown', function (event) {\n switch (event.keyCode) {\n // Allows the \"Enter\" key to open the picker\n case _keyboard2.default.keys.ENTER:\n _this.togglePicker();\n break;\n\n // Allows the \"Escape\" key to close the picker\n case _keyboard2.default.keys.ESCAPE:\n _this.escape();\n event.preventDefault();\n break;\n default:\n }\n });\n this.select.addEventListener('change', this.update.bind(this));\n }\n\n _createClass(Picker, [{\n key: 'togglePicker',\n value: function togglePicker() {\n this.container.classList.toggle('ql-expanded');\n // Toggle aria-expanded and aria-hidden to make the picker accessible\n toggleAriaAttribute(this.label, 'aria-expanded');\n toggleAriaAttribute(this.options, 'aria-hidden');\n }\n }, {\n key: 'buildItem',\n value: function buildItem(option) {\n var _this2 = this;\n\n var item = document.createElement('span');\n item.tabIndex = '0';\n item.setAttribute('role', 'button');\n\n item.classList.add('ql-picker-item');\n if (option.hasAttribute('value')) {\n item.setAttribute('data-value', option.getAttribute('value'));\n }\n if (option.textContent) {\n item.setAttribute('data-label', option.textContent);\n }\n item.addEventListener('click', function () {\n _this2.selectItem(item, true);\n });\n item.addEventListener('keydown', function (event) {\n switch (event.keyCode) {\n // Allows the \"Enter\" key to select an item\n case _keyboard2.default.keys.ENTER:\n _this2.selectItem(item, true);\n event.preventDefault();\n break;\n\n // Allows the \"Escape\" key to close the picker\n case _keyboard2.default.keys.ESCAPE:\n _this2.escape();\n event.preventDefault();\n break;\n default:\n }\n });\n\n return item;\n }\n }, {\n key: 'buildLabel',\n value: function buildLabel() {\n var label = document.createElement('span');\n label.classList.add('ql-picker-label');\n label.innerHTML = _dropdown2.default;\n label.tabIndex = '0';\n label.setAttribute('role', 'button');\n label.setAttribute('aria-expanded', 'false');\n this.container.appendChild(label);\n return label;\n }\n }, {\n key: 'buildOptions',\n value: function buildOptions() {\n var _this3 = this;\n\n var options = document.createElement('span');\n options.classList.add('ql-picker-options');\n\n // Don't want screen readers to read this until options are visible\n options.setAttribute('aria-hidden', 'true');\n options.tabIndex = '-1';\n\n // Need a unique id for aria-controls\n options.id = 'ql-picker-options-' + optionsCounter;\n optionsCounter += 1;\n this.label.setAttribute('aria-controls', options.id);\n\n this.options = options;\n\n [].slice.call(this.select.options).forEach(function (option) {\n var item = _this3.buildItem(option);\n options.appendChild(item);\n if (option.selected === true) {\n _this3.selectItem(item);\n }\n });\n this.container.appendChild(options);\n }\n }, {\n key: 'buildPicker',\n value: function buildPicker() {\n var _this4 = this;\n\n [].slice.call(this.select.attributes).forEach(function (item) {\n _this4.container.setAttribute(item.name, item.value);\n });\n this.container.classList.add('ql-picker');\n this.label = this.buildLabel();\n this.buildOptions();\n }\n }, {\n key: 'escape',\n value: function escape() {\n var _this5 = this;\n\n // Close menu and return focus to trigger label\n this.close();\n // Need setTimeout for accessibility to ensure that the browser executes\n // focus on the next process thread and after any DOM content changes\n setTimeout(function () {\n return _this5.label.focus();\n }, 1);\n }\n }, {\n key: 'close',\n value: function close() {\n this.container.classList.remove('ql-expanded');\n this.label.setAttribute('aria-expanded', 'false');\n this.options.setAttribute('aria-hidden', 'true');\n }\n }, {\n key: 'selectItem',\n value: function selectItem(item) {\n var trigger = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n\n var selected = this.container.querySelector('.ql-selected');\n if (item === selected) return;\n if (selected != null) {\n selected.classList.remove('ql-selected');\n }\n if (item == null) return;\n item.classList.add('ql-selected');\n this.select.selectedIndex = [].indexOf.call(item.parentNode.children, item);\n if (item.hasAttribute('data-value')) {\n this.label.setAttribute('data-value', item.getAttribute('data-value'));\n } else {\n this.label.removeAttribute('data-value');\n }\n if (item.hasAttribute('data-label')) {\n this.label.setAttribute('data-label', item.getAttribute('data-label'));\n } else {\n this.label.removeAttribute('data-label');\n }\n if (trigger) {\n if (typeof Event === 'function') {\n this.select.dispatchEvent(new Event('change'));\n } else if ((typeof Event === 'undefined' ? 'undefined' : _typeof(Event)) === 'object') {\n // IE11\n var event = document.createEvent('Event');\n event.initEvent('change', true, true);\n this.select.dispatchEvent(event);\n }\n this.close();\n }\n }\n }, {\n key: 'update',\n value: function update() {\n var option = void 0;\n if (this.select.selectedIndex > -1) {\n var item = this.container.querySelector('.ql-picker-options').children[this.select.selectedIndex];\n option = this.select.options[this.select.selectedIndex];\n this.selectItem(item);\n } else {\n this.selectItem(null);\n }\n var isActive = option != null && option !== this.select.querySelector('option[selected]');\n this.label.classList.toggle('ql-active', isActive);\n }\n }]);\n\n return Picker;\n}();\n\nexports.default = Picker;\n\n/***/ }),\n/* 29 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _parchment = __webpack_require__(0);\n\nvar _parchment2 = _interopRequireDefault(_parchment);\n\nvar _quill = __webpack_require__(5);\n\nvar _quill2 = _interopRequireDefault(_quill);\n\nvar _block = __webpack_require__(4);\n\nvar _block2 = _interopRequireDefault(_block);\n\nvar _break = __webpack_require__(16);\n\nvar _break2 = _interopRequireDefault(_break);\n\nvar _container = __webpack_require__(25);\n\nvar _container2 = _interopRequireDefault(_container);\n\nvar _cursor = __webpack_require__(24);\n\nvar _cursor2 = _interopRequireDefault(_cursor);\n\nvar _embed = __webpack_require__(35);\n\nvar _embed2 = _interopRequireDefault(_embed);\n\nvar _inline = __webpack_require__(6);\n\nvar _inline2 = _interopRequireDefault(_inline);\n\nvar _scroll = __webpack_require__(22);\n\nvar _scroll2 = _interopRequireDefault(_scroll);\n\nvar _text = __webpack_require__(7);\n\nvar _text2 = _interopRequireDefault(_text);\n\nvar _clipboard = __webpack_require__(55);\n\nvar _clipboard2 = _interopRequireDefault(_clipboard);\n\nvar _history = __webpack_require__(42);\n\nvar _history2 = _interopRequireDefault(_history);\n\nvar _keyboard = __webpack_require__(23);\n\nvar _keyboard2 = _interopRequireDefault(_keyboard);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n_quill2.default.register({\n 'blots/block': _block2.default,\n 'blots/block/embed': _block.BlockEmbed,\n 'blots/break': _break2.default,\n 'blots/container': _container2.default,\n 'blots/cursor': _cursor2.default,\n 'blots/embed': _embed2.default,\n 'blots/inline': _inline2.default,\n 'blots/scroll': _scroll2.default,\n 'blots/text': _text2.default,\n\n 'modules/clipboard': _clipboard2.default,\n 'modules/history': _history2.default,\n 'modules/keyboard': _keyboard2.default\n});\n\n_parchment2.default.register(_block2.default, _break2.default, _cursor2.default, _inline2.default, _scroll2.default, _text2.default);\n\nexports.default = _quill2.default;\n\n/***/ }),\n/* 30 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar Registry = __webpack_require__(1);\nvar ShadowBlot = /** @class */ (function () {\n function ShadowBlot(domNode) {\n this.domNode = domNode;\n // @ts-ignore\n this.domNode[Registry.DATA_KEY] = { blot: this };\n }\n Object.defineProperty(ShadowBlot.prototype, \"statics\", {\n // Hack for accessing inherited static methods\n get: function () {\n return this.constructor;\n },\n enumerable: true,\n configurable: true\n });\n ShadowBlot.create = function (value) {\n if (this.tagName == null) {\n throw new Registry.ParchmentError('Blot definition missing tagName');\n }\n var node;\n if (Array.isArray(this.tagName)) {\n if (typeof value === 'string') {\n value = value.toUpperCase();\n if (parseInt(value).toString() === value) {\n value = parseInt(value);\n }\n }\n if (typeof value === 'number') {\n node = document.createElement(this.tagName[value - 1]);\n }\n else if (this.tagName.indexOf(value) > -1) {\n node = document.createElement(value);\n }\n else {\n node = document.createElement(this.tagName[0]);\n }\n }\n else {\n node = document.createElement(this.tagName);\n }\n if (this.className) {\n node.classList.add(this.className);\n }\n return node;\n };\n ShadowBlot.prototype.attach = function () {\n if (this.parent != null) {\n this.scroll = this.parent.scroll;\n }\n };\n ShadowBlot.prototype.clone = function () {\n var domNode = this.domNode.cloneNode(false);\n return Registry.create(domNode);\n };\n ShadowBlot.prototype.detach = function () {\n if (this.parent != null)\n this.parent.removeChild(this);\n // @ts-ignore\n delete this.domNode[Registry.DATA_KEY];\n };\n ShadowBlot.prototype.deleteAt = function (index, length) {\n var blot = this.isolate(index, length);\n blot.remove();\n };\n ShadowBlot.prototype.formatAt = function (index, length, name, value) {\n var blot = this.isolate(index, length);\n if (Registry.query(name, Registry.Scope.BLOT) != null && value) {\n blot.wrap(name, value);\n }\n else if (Registry.query(name, Registry.Scope.ATTRIBUTE) != null) {\n var parent = Registry.create(this.statics.scope);\n blot.wrap(parent);\n parent.format(name, value);\n }\n };\n ShadowBlot.prototype.insertAt = function (index, value, def) {\n var blot = def == null ? Registry.create('text', value) : Registry.create(value, def);\n var ref = this.split(index);\n this.parent.insertBefore(blot, ref);\n };\n ShadowBlot.prototype.insertInto = function (parentBlot, refBlot) {\n if (refBlot === void 0) { refBlot = null; }\n if (this.parent != null) {\n this.parent.children.remove(this);\n }\n var refDomNode = null;\n parentBlot.children.insertBefore(this, refBlot);\n if (refBlot != null) {\n refDomNode = refBlot.domNode;\n }\n if (this.domNode.parentNode != parentBlot.domNode ||\n this.domNode.nextSibling != refDomNode) {\n parentBlot.domNode.insertBefore(this.domNode, refDomNode);\n }\n this.parent = parentBlot;\n this.attach();\n };\n ShadowBlot.prototype.isolate = function (index, length) {\n var target = this.split(index);\n target.split(length);\n return target;\n };\n ShadowBlot.prototype.length = function () {\n return 1;\n };\n ShadowBlot.prototype.offset = function (root) {\n if (root === void 0) { root = this.parent; }\n if (this.parent == null || this == root)\n return 0;\n return this.parent.children.offset(this) + this.parent.offset(root);\n };\n ShadowBlot.prototype.optimize = function (context) {\n // TODO clean up once we use WeakMap\n // @ts-ignore\n if (this.domNode[Registry.DATA_KEY] != null) {\n // @ts-ignore\n delete this.domNode[Registry.DATA_KEY].mutations;\n }\n };\n ShadowBlot.prototype.remove = function () {\n if (this.domNode.parentNode != null) {\n this.domNode.parentNode.removeChild(this.domNode);\n }\n this.detach();\n };\n ShadowBlot.prototype.replace = function (target) {\n if (target.parent == null)\n return;\n target.parent.insertBefore(this, target.next);\n target.remove();\n };\n ShadowBlot.prototype.replaceWith = function (name, value) {\n var replacement = typeof name === 'string' ? Registry.create(name, value) : name;\n replacement.replace(this);\n return replacement;\n };\n ShadowBlot.prototype.split = function (index, force) {\n return index === 0 ? this : this.next;\n };\n ShadowBlot.prototype.update = function (mutations, context) {\n // Nothing to do by default\n };\n ShadowBlot.prototype.wrap = function (name, value) {\n var wrapper = typeof name === 'string' ? Registry.create(name, value) : name;\n if (this.parent != null) {\n this.parent.insertBefore(wrapper, this.next);\n }\n wrapper.appendChild(this);\n return wrapper;\n };\n ShadowBlot.blotName = 'abstract';\n return ShadowBlot;\n}());\nexports.default = ShadowBlot;\n\n\n/***/ }),\n/* 31 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar attributor_1 = __webpack_require__(12);\nvar class_1 = __webpack_require__(32);\nvar style_1 = __webpack_require__(33);\nvar Registry = __webpack_require__(1);\nvar AttributorStore = /** @class */ (function () {\n function AttributorStore(domNode) {\n this.attributes = {};\n this.domNode = domNode;\n this.build();\n }\n AttributorStore.prototype.attribute = function (attribute, value) {\n // verb\n if (value) {\n if (attribute.add(this.domNode, value)) {\n if (attribute.value(this.domNode) != null) {\n this.attributes[attribute.attrName] = attribute;\n }\n else {\n delete this.attributes[attribute.attrName];\n }\n }\n }\n else {\n attribute.remove(this.domNode);\n delete this.attributes[attribute.attrName];\n }\n };\n AttributorStore.prototype.build = function () {\n var _this = this;\n this.attributes = {};\n var attributes = attributor_1.default.keys(this.domNode);\n var classes = class_1.default.keys(this.domNode);\n var styles = style_1.default.keys(this.domNode);\n attributes\n .concat(classes)\n .concat(styles)\n .forEach(function (name) {\n var attr = Registry.query(name, Registry.Scope.ATTRIBUTE);\n if (attr instanceof attributor_1.default) {\n _this.attributes[attr.attrName] = attr;\n }\n });\n };\n AttributorStore.prototype.copy = function (target) {\n var _this = this;\n Object.keys(this.attributes).forEach(function (key) {\n var value = _this.attributes[key].value(_this.domNode);\n target.format(key, value);\n });\n };\n AttributorStore.prototype.move = function (target) {\n var _this = this;\n this.copy(target);\n Object.keys(this.attributes).forEach(function (key) {\n _this.attributes[key].remove(_this.domNode);\n });\n this.attributes = {};\n };\n AttributorStore.prototype.values = function () {\n var _this = this;\n return Object.keys(this.attributes).reduce(function (attributes, name) {\n attributes[name] = _this.attributes[name].value(_this.domNode);\n return attributes;\n }, {});\n };\n return AttributorStore;\n}());\nexports.default = AttributorStore;\n\n\n/***/ }),\n/* 32 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar attributor_1 = __webpack_require__(12);\nfunction match(node, prefix) {\n var className = node.getAttribute('class') || '';\n return className.split(/\\s+/).filter(function (name) {\n return name.indexOf(prefix + \"-\") === 0;\n });\n}\nvar ClassAttributor = /** @class */ (function (_super) {\n __extends(ClassAttributor, _super);\n function ClassAttributor() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n ClassAttributor.keys = function (node) {\n return (node.getAttribute('class') || '').split(/\\s+/).map(function (name) {\n return name\n .split('-')\n .slice(0, -1)\n .join('-');\n });\n };\n ClassAttributor.prototype.add = function (node, value) {\n if (!this.canAdd(node, value))\n return false;\n this.remove(node);\n node.classList.add(this.keyName + \"-\" + value);\n return true;\n };\n ClassAttributor.prototype.remove = function (node) {\n var matches = match(node, this.keyName);\n matches.forEach(function (name) {\n node.classList.remove(name);\n });\n if (node.classList.length === 0) {\n node.removeAttribute('class');\n }\n };\n ClassAttributor.prototype.value = function (node) {\n var result = match(node, this.keyName)[0] || '';\n var value = result.slice(this.keyName.length + 1); // +1 for hyphen\n return this.canAdd(node, value) ? value : '';\n };\n return ClassAttributor;\n}(attributor_1.default));\nexports.default = ClassAttributor;\n\n\n/***/ }),\n/* 33 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar attributor_1 = __webpack_require__(12);\nfunction camelize(name) {\n var parts = name.split('-');\n var rest = parts\n .slice(1)\n .map(function (part) {\n return part[0].toUpperCase() + part.slice(1);\n })\n .join('');\n return parts[0] + rest;\n}\nvar StyleAttributor = /** @class */ (function (_super) {\n __extends(StyleAttributor, _super);\n function StyleAttributor() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n StyleAttributor.keys = function (node) {\n return (node.getAttribute('style') || '').split(';').map(function (value) {\n var arr = value.split(':');\n return arr[0].trim();\n });\n };\n StyleAttributor.prototype.add = function (node, value) {\n if (!this.canAdd(node, value))\n return false;\n // @ts-ignore\n node.style[camelize(this.keyName)] = value;\n return true;\n };\n StyleAttributor.prototype.remove = function (node) {\n // @ts-ignore\n node.style[camelize(this.keyName)] = '';\n if (!node.getAttribute('style')) {\n node.removeAttribute('style');\n }\n };\n StyleAttributor.prototype.value = function (node) {\n // @ts-ignore\n var value = node.style[camelize(this.keyName)];\n return this.canAdd(node, value) ? value : '';\n };\n return StyleAttributor;\n}(attributor_1.default));\nexports.default = StyleAttributor;\n\n\n/***/ }),\n/* 34 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _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; }; }();\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nvar Theme = function () {\n function Theme(quill, options) {\n _classCallCheck(this, Theme);\n\n this.quill = quill;\n this.options = options;\n this.modules = {};\n }\n\n _createClass(Theme, [{\n key: 'init',\n value: function init() {\n var _this = this;\n\n Object.keys(this.options.modules).forEach(function (name) {\n if (_this.modules[name] == null) {\n _this.addModule(name);\n }\n });\n }\n }, {\n key: 'addModule',\n value: function addModule(name) {\n var moduleClass = this.quill.constructor.import('modules/' + name);\n this.modules[name] = new moduleClass(this.quill, this.options.modules[name] || {});\n return this.modules[name];\n }\n }]);\n\n return Theme;\n}();\n\nTheme.DEFAULTS = {\n modules: {}\n};\nTheme.themes = {\n 'default': Theme\n};\n\nexports.default = Theme;\n\n/***/ }),\n/* 35 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _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; }; }();\n\nvar _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if (\"value\" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };\n\nvar _parchment = __webpack_require__(0);\n\nvar _parchment2 = _interopRequireDefault(_parchment);\n\nvar _text = __webpack_require__(7);\n\nvar _text2 = _interopRequireDefault(_text);\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 _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nvar GUARD_TEXT = '\\uFEFF';\n\nvar Embed = function (_Parchment$Embed) {\n _inherits(Embed, _Parchment$Embed);\n\n function Embed(node) {\n _classCallCheck(this, Embed);\n\n var _this = _possibleConstructorReturn(this, (Embed.__proto__ || Object.getPrototypeOf(Embed)).call(this, node));\n\n _this.contentNode = document.createElement('span');\n _this.contentNode.setAttribute('contenteditable', false);\n [].slice.call(_this.domNode.childNodes).forEach(function (childNode) {\n _this.contentNode.appendChild(childNode);\n });\n _this.leftGuard = document.createTextNode(GUARD_TEXT);\n _this.rightGuard = document.createTextNode(GUARD_TEXT);\n _this.domNode.appendChild(_this.leftGuard);\n _this.domNode.appendChild(_this.contentNode);\n _this.domNode.appendChild(_this.rightGuard);\n return _this;\n }\n\n _createClass(Embed, [{\n key: 'index',\n value: function index(node, offset) {\n if (node === this.leftGuard) return 0;\n if (node === this.rightGuard) return 1;\n return _get(Embed.prototype.__proto__ || Object.getPrototypeOf(Embed.prototype), 'index', this).call(this, node, offset);\n }\n }, {\n key: 'restore',\n value: function restore(node) {\n var range = void 0,\n textNode = void 0;\n var text = node.data.split(GUARD_TEXT).join('');\n if (node === this.leftGuard) {\n if (this.prev instanceof _text2.default) {\n var prevLength = this.prev.length();\n this.prev.insertAt(prevLength, text);\n range = {\n startNode: this.prev.domNode,\n startOffset: prevLength + text.length\n };\n } else {\n textNode = document.createTextNode(text);\n this.parent.insertBefore(_parchment2.default.create(textNode), this);\n range = {\n startNode: textNode,\n startOffset: text.length\n };\n }\n } else if (node === this.rightGuard) {\n if (this.next instanceof _text2.default) {\n this.next.insertAt(0, text);\n range = {\n startNode: this.next.domNode,\n startOffset: text.length\n };\n } else {\n textNode = document.createTextNode(text);\n this.parent.insertBefore(_parchment2.default.create(textNode), this.next);\n range = {\n startNode: textNode,\n startOffset: text.length\n };\n }\n }\n node.data = GUARD_TEXT;\n return range;\n }\n }, {\n key: 'update',\n value: function update(mutations, context) {\n var _this2 = this;\n\n mutations.forEach(function (mutation) {\n if (mutation.type === 'characterData' && (mutation.target === _this2.leftGuard || mutation.target === _this2.rightGuard)) {\n var range = _this2.restore(mutation.target);\n if (range) context.range = range;\n }\n });\n }\n }]);\n\n return Embed;\n}(_parchment2.default.Embed);\n\nexports.default = Embed;\n\n/***/ }),\n/* 36 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.AlignStyle = exports.AlignClass = exports.AlignAttribute = undefined;\n\nvar _parchment = __webpack_require__(0);\n\nvar _parchment2 = _interopRequireDefault(_parchment);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar config = {\n scope: _parchment2.default.Scope.BLOCK,\n whitelist: ['right', 'center', 'justify']\n};\n\nvar AlignAttribute = new _parchment2.default.Attributor.Attribute('align', 'align', config);\nvar AlignClass = new _parchment2.default.Attributor.Class('align', 'ql-align', config);\nvar AlignStyle = new _parchment2.default.Attributor.Style('align', 'text-align', config);\n\nexports.AlignAttribute = AlignAttribute;\nexports.AlignClass = AlignClass;\nexports.AlignStyle = AlignStyle;\n\n/***/ }),\n/* 37 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.BackgroundStyle = exports.BackgroundClass = undefined;\n\nvar _parchment = __webpack_require__(0);\n\nvar _parchment2 = _interopRequireDefault(_parchment);\n\nvar _color = __webpack_require__(26);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar BackgroundClass = new _parchment2.default.Attributor.Class('background', 'ql-bg', {\n scope: _parchment2.default.Scope.INLINE\n});\nvar BackgroundStyle = new _color.ColorAttributor('background', 'background-color', {\n scope: _parchment2.default.Scope.INLINE\n});\n\nexports.BackgroundClass = BackgroundClass;\nexports.BackgroundStyle = BackgroundStyle;\n\n/***/ }),\n/* 38 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.DirectionStyle = exports.DirectionClass = exports.DirectionAttribute = undefined;\n\nvar _parchment = __webpack_require__(0);\n\nvar _parchment2 = _interopRequireDefault(_parchment);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar config = {\n scope: _parchment2.default.Scope.BLOCK,\n whitelist: ['rtl']\n};\n\nvar DirectionAttribute = new _parchment2.default.Attributor.Attribute('direction', 'dir', config);\nvar DirectionClass = new _parchment2.default.Attributor.Class('direction', 'ql-direction', config);\nvar DirectionStyle = new _parchment2.default.Attributor.Style('direction', 'direction', config);\n\nexports.DirectionAttribute = DirectionAttribute;\nexports.DirectionClass = DirectionClass;\nexports.DirectionStyle = DirectionStyle;\n\n/***/ }),\n/* 39 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.FontClass = exports.FontStyle = undefined;\n\nvar _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; }; }();\n\nvar _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if (\"value\" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };\n\nvar _parchment = __webpack_require__(0);\n\nvar _parchment2 = _interopRequireDefault(_parchment);\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 _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nvar config = {\n scope: _parchment2.default.Scope.INLINE,\n whitelist: ['serif', 'monospace']\n};\n\nvar FontClass = new _parchment2.default.Attributor.Class('font', 'ql-font', config);\n\nvar FontStyleAttributor = function (_Parchment$Attributor) {\n _inherits(FontStyleAttributor, _Parchment$Attributor);\n\n function FontStyleAttributor() {\n _classCallCheck(this, FontStyleAttributor);\n\n return _possibleConstructorReturn(this, (FontStyleAttributor.__proto__ || Object.getPrototypeOf(FontStyleAttributor)).apply(this, arguments));\n }\n\n _createClass(FontStyleAttributor, [{\n key: 'value',\n value: function value(node) {\n return _get(FontStyleAttributor.prototype.__proto__ || Object.getPrototypeOf(FontStyleAttributor.prototype), 'value', this).call(this, node).replace(/[\"']/g, '');\n }\n }]);\n\n return FontStyleAttributor;\n}(_parchment2.default.Attributor.Style);\n\nvar FontStyle = new FontStyleAttributor('font', 'font-family', config);\n\nexports.FontStyle = FontStyle;\nexports.FontClass = FontClass;\n\n/***/ }),\n/* 40 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.SizeStyle = exports.SizeClass = undefined;\n\nvar _parchment = __webpack_require__(0);\n\nvar _parchment2 = _interopRequireDefault(_parchment);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar SizeClass = new _parchment2.default.Attributor.Class('size', 'ql-size', {\n scope: _parchment2.default.Scope.INLINE,\n whitelist: ['small', 'large', 'huge']\n});\nvar SizeStyle = new _parchment2.default.Attributor.Style('size', 'font-size', {\n scope: _parchment2.default.Scope.INLINE,\n whitelist: ['10px', '18px', '32px']\n});\n\nexports.SizeClass = SizeClass;\nexports.SizeStyle = SizeStyle;\n\n/***/ }),\n/* 41 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nmodule.exports = {\n 'align': {\n '': __webpack_require__(76),\n 'center': __webpack_require__(77),\n 'right': __webpack_require__(78),\n 'justify': __webpack_require__(79)\n },\n 'background': __webpack_require__(80),\n 'blockquote': __webpack_require__(81),\n 'bold': __webpack_require__(82),\n 'clean': __webpack_require__(83),\n 'code': __webpack_require__(58),\n 'code-block': __webpack_require__(58),\n 'color': __webpack_require__(84),\n 'direction': {\n '': __webpack_require__(85),\n 'rtl': __webpack_require__(86)\n },\n 'float': {\n 'center': __webpack_require__(87),\n 'full': __webpack_require__(88),\n 'left': __webpack_require__(89),\n 'right': __webpack_require__(90)\n },\n 'formula': __webpack_require__(91),\n 'header': {\n '1': __webpack_require__(92),\n '2': __webpack_require__(93)\n },\n 'italic': __webpack_require__(94),\n 'image': __webpack_require__(95),\n 'indent': {\n '+1': __webpack_require__(96),\n '-1': __webpack_require__(97)\n },\n 'link': __webpack_require__(98),\n 'list': {\n 'ordered': __webpack_require__(99),\n 'bullet': __webpack_require__(100),\n 'check': __webpack_require__(101)\n },\n 'script': {\n 'sub': __webpack_require__(102),\n 'super': __webpack_require__(103)\n },\n 'strike': __webpack_require__(104),\n 'underline': __webpack_require__(105),\n 'video': __webpack_require__(106)\n};\n\n/***/ }),\n/* 42 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.getLastChangeIndex = exports.default = undefined;\n\nvar _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; }; }();\n\nvar _parchment = __webpack_require__(0);\n\nvar _parchment2 = _interopRequireDefault(_parchment);\n\nvar _quill = __webpack_require__(5);\n\nvar _quill2 = _interopRequireDefault(_quill);\n\nvar _module = __webpack_require__(9);\n\nvar _module2 = _interopRequireDefault(_module);\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 _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nvar History = function (_Module) {\n _inherits(History, _Module);\n\n function History(quill, options) {\n _classCallCheck(this, History);\n\n var _this = _possibleConstructorReturn(this, (History.__proto__ || Object.getPrototypeOf(History)).call(this, quill, options));\n\n _this.lastRecorded = 0;\n _this.ignoreChange = false;\n _this.clear();\n _this.quill.on(_quill2.default.events.EDITOR_CHANGE, function (eventName, delta, oldDelta, source) {\n if (eventName !== _quill2.default.events.TEXT_CHANGE || _this.ignoreChange) return;\n if (!_this.options.userOnly || source === _quill2.default.sources.USER) {\n _this.record(delta, oldDelta);\n } else {\n _this.transform(delta);\n }\n });\n _this.quill.keyboard.addBinding({ key: 'Z', shortKey: true }, _this.undo.bind(_this));\n _this.quill.keyboard.addBinding({ key: 'Z', shortKey: true, shiftKey: true }, _this.redo.bind(_this));\n if (/Win/i.test(navigator.platform)) {\n _this.quill.keyboard.addBinding({ key: 'Y', shortKey: true }, _this.redo.bind(_this));\n }\n return _this;\n }\n\n _createClass(History, [{\n key: 'change',\n value: function change(source, dest) {\n if (this.stack[source].length === 0) return;\n var delta = this.stack[source].pop();\n this.stack[dest].push(delta);\n this.lastRecorded = 0;\n this.ignoreChange = true;\n this.quill.updateContents(delta[source], _quill2.default.sources.USER);\n this.ignoreChange = false;\n var index = getLastChangeIndex(delta[source]);\n this.quill.setSelection(index);\n }\n }, {\n key: 'clear',\n value: function clear() {\n this.stack = { undo: [], redo: [] };\n }\n }, {\n key: 'cutoff',\n value: function cutoff() {\n this.lastRecorded = 0;\n }\n }, {\n key: 'record',\n value: function record(changeDelta, oldDelta) {\n if (changeDelta.ops.length === 0) return;\n this.stack.redo = [];\n var undoDelta = this.quill.getContents().diff(oldDelta);\n var timestamp = Date.now();\n if (this.lastRecorded + this.options.delay > timestamp && this.stack.undo.length > 0) {\n var delta = this.stack.undo.pop();\n undoDelta = undoDelta.compose(delta.undo);\n changeDelta = delta.redo.compose(changeDelta);\n } else {\n this.lastRecorded = timestamp;\n }\n this.stack.undo.push({\n redo: changeDelta,\n undo: undoDelta\n });\n if (this.stack.undo.length > this.options.maxStack) {\n this.stack.undo.shift();\n }\n }\n }, {\n key: 'redo',\n value: function redo() {\n this.change('redo', 'undo');\n }\n }, {\n key: 'transform',\n value: function transform(delta) {\n this.stack.undo.forEach(function (change) {\n change.undo = delta.transform(change.undo, true);\n change.redo = delta.transform(change.redo, true);\n });\n this.stack.redo.forEach(function (change) {\n change.undo = delta.transform(change.undo, true);\n change.redo = delta.transform(change.redo, true);\n });\n }\n }, {\n key: 'undo',\n value: function undo() {\n this.change('undo', 'redo');\n }\n }]);\n\n return History;\n}(_module2.default);\n\nHistory.DEFAULTS = {\n delay: 1000,\n maxStack: 100,\n userOnly: false\n};\n\nfunction endsWithNewlineChange(delta) {\n var lastOp = delta.ops[delta.ops.length - 1];\n if (lastOp == null) return false;\n if (lastOp.insert != null) {\n return typeof lastOp.insert === 'string' && lastOp.insert.endsWith('\\n');\n }\n if (lastOp.attributes != null) {\n return Object.keys(lastOp.attributes).some(function (attr) {\n return _parchment2.default.query(attr, _parchment2.default.Scope.BLOCK) != null;\n });\n }\n return false;\n}\n\nfunction getLastChangeIndex(delta) {\n var deleteLength = delta.reduce(function (length, op) {\n length += op.delete || 0;\n return length;\n }, 0);\n var changeIndex = delta.length() - deleteLength;\n if (endsWithNewlineChange(delta)) {\n changeIndex -= 1;\n }\n return changeIndex;\n}\n\nexports.default = History;\nexports.getLastChangeIndex = getLastChangeIndex;\n\n/***/ }),\n/* 43 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = exports.BaseTooltip = undefined;\n\nvar _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; }; }();\n\nvar _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if (\"value\" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };\n\nvar _extend = __webpack_require__(3);\n\nvar _extend2 = _interopRequireDefault(_extend);\n\nvar _quillDelta = __webpack_require__(2);\n\nvar _quillDelta2 = _interopRequireDefault(_quillDelta);\n\nvar _emitter = __webpack_require__(8);\n\nvar _emitter2 = _interopRequireDefault(_emitter);\n\nvar _keyboard = __webpack_require__(23);\n\nvar _keyboard2 = _interopRequireDefault(_keyboard);\n\nvar _theme = __webpack_require__(34);\n\nvar _theme2 = _interopRequireDefault(_theme);\n\nvar _colorPicker = __webpack_require__(59);\n\nvar _colorPicker2 = _interopRequireDefault(_colorPicker);\n\nvar _iconPicker = __webpack_require__(60);\n\nvar _iconPicker2 = _interopRequireDefault(_iconPicker);\n\nvar _picker = __webpack_require__(28);\n\nvar _picker2 = _interopRequireDefault(_picker);\n\nvar _tooltip = __webpack_require__(61);\n\nvar _tooltip2 = _interopRequireDefault(_tooltip);\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 _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nvar ALIGNS = [false, 'center', 'right', 'justify'];\n\nvar COLORS = [\"#000000\", \"#e60000\", \"#ff9900\", \"#ffff00\", \"#008a00\", \"#0066cc\", \"#9933ff\", \"#ffffff\", \"#facccc\", \"#ffebcc\", \"#ffffcc\", \"#cce8cc\", \"#cce0f5\", \"#ebd6ff\", \"#bbbbbb\", \"#f06666\", \"#ffc266\", \"#ffff66\", \"#66b966\", \"#66a3e0\", \"#c285ff\", \"#888888\", \"#a10000\", \"#b26b00\", \"#b2b200\", \"#006100\", \"#0047b2\", \"#6b24b2\", \"#444444\", \"#5c0000\", \"#663d00\", \"#666600\", \"#003700\", \"#002966\", \"#3d1466\"];\n\nvar FONTS = [false, 'serif', 'monospace'];\n\nvar HEADERS = ['1', '2', '3', false];\n\nvar SIZES = ['small', false, 'large', 'huge'];\n\nvar BaseTheme = function (_Theme) {\n _inherits(BaseTheme, _Theme);\n\n function BaseTheme(quill, options) {\n _classCallCheck(this, BaseTheme);\n\n var _this = _possibleConstructorReturn(this, (BaseTheme.__proto__ || Object.getPrototypeOf(BaseTheme)).call(this, quill, options));\n\n var listener = function listener(e) {\n if (!document.body.contains(quill.root)) {\n return document.body.removeEventListener('click', listener);\n }\n if (_this.tooltip != null && !_this.tooltip.root.contains(e.target) && document.activeElement !== _this.tooltip.textbox && !_this.quill.hasFocus()) {\n _this.tooltip.hide();\n }\n if (_this.pickers != null) {\n _this.pickers.forEach(function (picker) {\n if (!picker.container.contains(e.target)) {\n picker.close();\n }\n });\n }\n };\n quill.emitter.listenDOM('click', document.body, listener);\n return _this;\n }\n\n _createClass(BaseTheme, [{\n key: 'addModule',\n value: function addModule(name) {\n var module = _get(BaseTheme.prototype.__proto__ || Object.getPrototypeOf(BaseTheme.prototype), 'addModule', this).call(this, name);\n if (name === 'toolbar') {\n this.extendToolbar(module);\n }\n return module;\n }\n }, {\n key: 'buildButtons',\n value: function buildButtons(buttons, icons) {\n buttons.forEach(function (button) {\n var className = button.getAttribute('class') || '';\n className.split(/\\s+/).forEach(function (name) {\n if (!name.startsWith('ql-')) return;\n name = name.slice('ql-'.length);\n if (icons[name] == null) return;\n if (name === 'direction') {\n button.innerHTML = icons[name][''] + icons[name]['rtl'];\n } else if (typeof icons[name] === 'string') {\n button.innerHTML = icons[name];\n } else {\n var value = button.value || '';\n if (value != null && icons[name][value]) {\n button.innerHTML = icons[name][value];\n }\n }\n });\n });\n }\n }, {\n key: 'buildPickers',\n value: function buildPickers(selects, icons) {\n var _this2 = this;\n\n this.pickers = selects.map(function (select) {\n if (select.classList.contains('ql-align')) {\n if (select.querySelector('option') == null) {\n fillSelect(select, ALIGNS);\n }\n return new _iconPicker2.default(select, icons.align);\n } else if (select.classList.contains('ql-background') || select.classList.contains('ql-color')) {\n var format = select.classList.contains('ql-background') ? 'background' : 'color';\n if (select.querySelector('option') == null) {\n fillSelect(select, COLORS, format === 'background' ? '#ffffff' : '#000000');\n }\n return new _colorPicker2.default(select, icons[format]);\n } else {\n if (select.querySelector('option') == null) {\n if (select.classList.contains('ql-font')) {\n fillSelect(select, FONTS);\n } else if (select.classList.contains('ql-header')) {\n fillSelect(select, HEADERS);\n } else if (select.classList.contains('ql-size')) {\n fillSelect(select, SIZES);\n }\n }\n return new _picker2.default(select);\n }\n });\n var update = function update() {\n _this2.pickers.forEach(function (picker) {\n picker.update();\n });\n };\n this.quill.on(_emitter2.default.events.EDITOR_CHANGE, update);\n }\n }]);\n\n return BaseTheme;\n}(_theme2.default);\n\nBaseTheme.DEFAULTS = (0, _extend2.default)(true, {}, _theme2.default.DEFAULTS, {\n modules: {\n toolbar: {\n handlers: {\n formula: function formula() {\n this.quill.theme.tooltip.edit('formula');\n },\n image: function image() {\n var _this3 = this;\n\n var fileInput = this.container.querySelector('input.ql-image[type=file]');\n if (fileInput == null) {\n fileInput = document.createElement('input');\n fileInput.setAttribute('type', 'file');\n fileInput.setAttribute('accept', 'image/png, image/gif, image/jpeg, image/bmp, image/x-icon');\n fileInput.classList.add('ql-image');\n fileInput.addEventListener('change', function () {\n if (fileInput.files != null && fileInput.files[0] != null) {\n var reader = new FileReader();\n reader.onload = function (e) {\n var range = _this3.quill.getSelection(true);\n _this3.quill.updateContents(new _quillDelta2.default().retain(range.index).delete(range.length).insert({ image: e.target.result }), _emitter2.default.sources.USER);\n _this3.quill.setSelection(range.index + 1, _emitter2.default.sources.SILENT);\n fileInput.value = \"\";\n };\n reader.readAsDataURL(fileInput.files[0]);\n }\n });\n this.container.appendChild(fileInput);\n }\n fileInput.click();\n },\n video: function video() {\n this.quill.theme.tooltip.edit('video');\n }\n }\n }\n }\n});\n\nvar BaseTooltip = function (_Tooltip) {\n _inherits(BaseTooltip, _Tooltip);\n\n function BaseTooltip(quill, boundsContainer) {\n _classCallCheck(this, BaseTooltip);\n\n var _this4 = _possibleConstructorReturn(this, (BaseTooltip.__proto__ || Object.getPrototypeOf(BaseTooltip)).call(this, quill, boundsContainer));\n\n _this4.textbox = _this4.root.querySelector('input[type=\"text\"]');\n _this4.listen();\n return _this4;\n }\n\n _createClass(BaseTooltip, [{\n key: 'listen',\n value: function listen() {\n var _this5 = this;\n\n this.textbox.addEventListener('keydown', function (event) {\n if (_keyboard2.default.match(event, 'enter')) {\n _this5.save();\n event.preventDefault();\n } else if (_keyboard2.default.match(event, 'escape')) {\n _this5.cancel();\n event.preventDefault();\n }\n });\n }\n }, {\n key: 'cancel',\n value: function cancel() {\n this.hide();\n }\n }, {\n key: 'edit',\n value: function edit() {\n var mode = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'link';\n var preview = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;\n\n this.root.classList.remove('ql-hidden');\n this.root.classList.add('ql-editing');\n if (preview != null) {\n this.textbox.value = preview;\n } else if (mode !== this.root.getAttribute('data-mode')) {\n this.textbox.value = '';\n }\n this.position(this.quill.getBounds(this.quill.selection.savedRange));\n this.textbox.select();\n this.textbox.setAttribute('placeholder', this.textbox.getAttribute('data-' + mode) || '');\n this.root.setAttribute('data-mode', mode);\n }\n }, {\n key: 'restoreFocus',\n value: function restoreFocus() {\n var scrollTop = this.quill.scrollingContainer.scrollTop;\n this.quill.focus();\n this.quill.scrollingContainer.scrollTop = scrollTop;\n }\n }, {\n key: 'save',\n value: function save() {\n var value = this.textbox.value;\n switch (this.root.getAttribute('data-mode')) {\n case 'link':\n {\n var scrollTop = this.quill.root.scrollTop;\n if (this.linkRange) {\n this.quill.formatText(this.linkRange, 'link', value, _emitter2.default.sources.USER);\n delete this.linkRange;\n } else {\n this.restoreFocus();\n this.quill.format('link', value, _emitter2.default.sources.USER);\n }\n this.quill.root.scrollTop = scrollTop;\n break;\n }\n case 'video':\n {\n value = extractVideoUrl(value);\n } // eslint-disable-next-line no-fallthrough\n case 'formula':\n {\n if (!value) break;\n var range = this.quill.getSelection(true);\n if (range != null) {\n var index = range.index + range.length;\n this.quill.insertEmbed(index, this.root.getAttribute('data-mode'), value, _emitter2.default.sources.USER);\n if (this.root.getAttribute('data-mode') === 'formula') {\n this.quill.insertText(index + 1, ' ', _emitter2.default.sources.USER);\n }\n this.quill.setSelection(index + 2, _emitter2.default.sources.USER);\n }\n break;\n }\n default:\n }\n this.textbox.value = '';\n this.hide();\n }\n }]);\n\n return BaseTooltip;\n}(_tooltip2.default);\n\nfunction extractVideoUrl(url) {\n var match = url.match(/^(?:(https?):\\/\\/)?(?:(?:www|m)\\.)?youtube\\.com\\/watch.*v=([a-zA-Z0-9_-]+)/) || url.match(/^(?:(https?):\\/\\/)?(?:(?:www|m)\\.)?youtu\\.be\\/([a-zA-Z0-9_-]+)/);\n if (match) {\n return (match[1] || 'https') + '://www.youtube.com/embed/' + match[2] + '?showinfo=0';\n }\n if (match = url.match(/^(?:(https?):\\/\\/)?(?:www\\.)?vimeo\\.com\\/(\\d+)/)) {\n // eslint-disable-line no-cond-assign\n return (match[1] || 'https') + '://player.vimeo.com/video/' + match[2] + '/';\n }\n return url;\n}\n\nfunction fillSelect(select, values) {\n var defaultValue = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;\n\n values.forEach(function (value) {\n var option = document.createElement('option');\n if (value === defaultValue) {\n option.setAttribute('selected', 'selected');\n } else {\n option.setAttribute('value', value);\n }\n select.appendChild(option);\n });\n}\n\nexports.BaseTooltip = BaseTooltip;\nexports.default = BaseTheme;\n\n/***/ }),\n/* 44 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar LinkedList = /** @class */ (function () {\n function LinkedList() {\n this.head = this.tail = null;\n this.length = 0;\n }\n LinkedList.prototype.append = function () {\n var nodes = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n nodes[_i] = arguments[_i];\n }\n this.insertBefore(nodes[0], null);\n if (nodes.length > 1) {\n this.append.apply(this, nodes.slice(1));\n }\n };\n LinkedList.prototype.contains = function (node) {\n var cur, next = this.iterator();\n while ((cur = next())) {\n if (cur === node)\n return true;\n }\n return false;\n };\n LinkedList.prototype.insertBefore = function (node, refNode) {\n if (!node)\n return;\n node.next = refNode;\n if (refNode != null) {\n node.prev = refNode.prev;\n if (refNode.prev != null) {\n refNode.prev.next = node;\n }\n refNode.prev = node;\n if (refNode === this.head) {\n this.head = node;\n }\n }\n else if (this.tail != null) {\n this.tail.next = node;\n node.prev = this.tail;\n this.tail = node;\n }\n else {\n node.prev = null;\n this.head = this.tail = node;\n }\n this.length += 1;\n };\n LinkedList.prototype.offset = function (target) {\n var index = 0, cur = this.head;\n while (cur != null) {\n if (cur === target)\n return index;\n index += cur.length();\n cur = cur.next;\n }\n return -1;\n };\n LinkedList.prototype.remove = function (node) {\n if (!this.contains(node))\n return;\n if (node.prev != null)\n node.prev.next = node.next;\n if (node.next != null)\n node.next.prev = node.prev;\n if (node === this.head)\n this.head = node.next;\n if (node === this.tail)\n this.tail = node.prev;\n this.length -= 1;\n };\n LinkedList.prototype.iterator = function (curNode) {\n if (curNode === void 0) { curNode = this.head; }\n // TODO use yield when we can\n return function () {\n var ret = curNode;\n if (curNode != null)\n curNode = curNode.next;\n return ret;\n };\n };\n LinkedList.prototype.find = function (index, inclusive) {\n if (inclusive === void 0) { inclusive = false; }\n var cur, next = this.iterator();\n while ((cur = next())) {\n var length = cur.length();\n if (index < length ||\n (inclusive && index === length && (cur.next == null || cur.next.length() !== 0))) {\n return [cur, index];\n }\n index -= length;\n }\n return [null, 0];\n };\n LinkedList.prototype.forEach = function (callback) {\n var cur, next = this.iterator();\n while ((cur = next())) {\n callback(cur);\n }\n };\n LinkedList.prototype.forEachAt = function (index, length, callback) {\n if (length <= 0)\n return;\n var _a = this.find(index), startNode = _a[0], offset = _a[1];\n var cur, curIndex = index - offset, next = this.iterator(startNode);\n while ((cur = next()) && curIndex < index + length) {\n var curLength = cur.length();\n if (index > curIndex) {\n callback(cur, index - curIndex, Math.min(length, curIndex + curLength - index));\n }\n else {\n callback(cur, 0, Math.min(curLength, index + length - curIndex));\n }\n curIndex += curLength;\n }\n };\n LinkedList.prototype.map = function (callback) {\n return this.reduce(function (memo, cur) {\n memo.push(callback(cur));\n return memo;\n }, []);\n };\n LinkedList.prototype.reduce = function (callback, memo) {\n var cur, next = this.iterator();\n while ((cur = next())) {\n memo = callback(memo, cur);\n }\n return memo;\n };\n return LinkedList;\n}());\nexports.default = LinkedList;\n\n\n/***/ }),\n/* 45 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar container_1 = __webpack_require__(17);\nvar Registry = __webpack_require__(1);\nvar OBSERVER_CONFIG = {\n attributes: true,\n characterData: true,\n characterDataOldValue: true,\n childList: true,\n subtree: true,\n};\nvar MAX_OPTIMIZE_ITERATIONS = 100;\nvar ScrollBlot = /** @class */ (function (_super) {\n __extends(ScrollBlot, _super);\n function ScrollBlot(node) {\n var _this = _super.call(this, node) || this;\n _this.scroll = _this;\n _this.observer = new MutationObserver(function (mutations) {\n _this.update(mutations);\n });\n _this.observer.observe(_this.domNode, OBSERVER_CONFIG);\n _this.attach();\n return _this;\n }\n ScrollBlot.prototype.detach = function () {\n _super.prototype.detach.call(this);\n this.observer.disconnect();\n };\n ScrollBlot.prototype.deleteAt = function (index, length) {\n this.update();\n if (index === 0 && length === this.length()) {\n this.children.forEach(function (child) {\n child.remove();\n });\n }\n else {\n _super.prototype.deleteAt.call(this, index, length);\n }\n };\n ScrollBlot.prototype.formatAt = function (index, length, name, value) {\n this.update();\n _super.prototype.formatAt.call(this, index, length, name, value);\n };\n ScrollBlot.prototype.insertAt = function (index, value, def) {\n this.update();\n _super.prototype.insertAt.call(this, index, value, def);\n };\n ScrollBlot.prototype.optimize = function (mutations, context) {\n var _this = this;\n if (mutations === void 0) { mutations = []; }\n if (context === void 0) { context = {}; }\n _super.prototype.optimize.call(this, context);\n // We must modify mutations directly, cannot make copy and then modify\n var records = [].slice.call(this.observer.takeRecords());\n // Array.push currently seems to be implemented by a non-tail recursive function\n // so we cannot just mutations.push.apply(mutations, this.observer.takeRecords());\n while (records.length > 0)\n mutations.push(records.pop());\n // TODO use WeakMap\n var mark = function (blot, markParent) {\n if (markParent === void 0) { markParent = true; }\n if (blot == null || blot === _this)\n return;\n if (blot.domNode.parentNode == null)\n return;\n // @ts-ignore\n if (blot.domNode[Registry.DATA_KEY].mutations == null) {\n // @ts-ignore\n blot.domNode[Registry.DATA_KEY].mutations = [];\n }\n if (markParent)\n mark(blot.parent);\n };\n var optimize = function (blot) {\n // Post-order traversal\n if (\n // @ts-ignore\n blot.domNode[Registry.DATA_KEY] == null ||\n // @ts-ignore\n blot.domNode[Registry.DATA_KEY].mutations == null) {\n return;\n }\n if (blot instanceof container_1.default) {\n blot.children.forEach(optimize);\n }\n blot.optimize(context);\n };\n var remaining = mutations;\n for (var i = 0; remaining.length > 0; i += 1) {\n if (i >= MAX_OPTIMIZE_ITERATIONS) {\n throw new Error('[Parchment] Maximum optimize iterations reached');\n }\n remaining.forEach(function (mutation) {\n var blot = Registry.find(mutation.target, true);\n if (blot == null)\n return;\n if (blot.domNode === mutation.target) {\n if (mutation.type === 'childList') {\n mark(Registry.find(mutation.previousSibling, false));\n [].forEach.call(mutation.addedNodes, function (node) {\n var child = Registry.find(node, false);\n mark(child, false);\n if (child instanceof container_1.default) {\n child.children.forEach(function (grandChild) {\n mark(grandChild, false);\n });\n }\n });\n }\n else if (mutation.type === 'attributes') {\n mark(blot.prev);\n }\n }\n mark(blot);\n });\n this.children.forEach(optimize);\n remaining = [].slice.call(this.observer.takeRecords());\n records = remaining.slice();\n while (records.length > 0)\n mutations.push(records.pop());\n }\n };\n ScrollBlot.prototype.update = function (mutations, context) {\n var _this = this;\n if (context === void 0) { context = {}; }\n mutations = mutations || this.observer.takeRecords();\n // TODO use WeakMap\n mutations\n .map(function (mutation) {\n var blot = Registry.find(mutation.target, true);\n if (blot == null)\n return null;\n // @ts-ignore\n if (blot.domNode[Registry.DATA_KEY].mutations == null) {\n // @ts-ignore\n blot.domNode[Registry.DATA_KEY].mutations = [mutation];\n return blot;\n }\n else {\n // @ts-ignore\n blot.domNode[Registry.DATA_KEY].mutations.push(mutation);\n return null;\n }\n })\n .forEach(function (blot) {\n if (blot == null ||\n blot === _this ||\n //@ts-ignore\n blot.domNode[Registry.DATA_KEY] == null)\n return;\n // @ts-ignore\n blot.update(blot.domNode[Registry.DATA_KEY].mutations || [], context);\n });\n // @ts-ignore\n if (this.domNode[Registry.DATA_KEY].mutations != null) {\n // @ts-ignore\n _super.prototype.update.call(this, this.domNode[Registry.DATA_KEY].mutations, context);\n }\n this.optimize(mutations, context);\n };\n ScrollBlot.blotName = 'scroll';\n ScrollBlot.defaultChild = 'block';\n ScrollBlot.scope = Registry.Scope.BLOCK_BLOT;\n ScrollBlot.tagName = 'DIV';\n return ScrollBlot;\n}(container_1.default));\nexports.default = ScrollBlot;\n\n\n/***/ }),\n/* 46 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar format_1 = __webpack_require__(18);\nvar Registry = __webpack_require__(1);\n// Shallow object comparison\nfunction isEqual(obj1, obj2) {\n if (Object.keys(obj1).length !== Object.keys(obj2).length)\n return false;\n // @ts-ignore\n for (var prop in obj1) {\n // @ts-ignore\n if (obj1[prop] !== obj2[prop])\n return false;\n }\n return true;\n}\nvar InlineBlot = /** @class */ (function (_super) {\n __extends(InlineBlot, _super);\n function InlineBlot() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n InlineBlot.formats = function (domNode) {\n if (domNode.tagName === InlineBlot.tagName)\n return undefined;\n return _super.formats.call(this, domNode);\n };\n InlineBlot.prototype.format = function (name, value) {\n var _this = this;\n if (name === this.statics.blotName && !value) {\n this.children.forEach(function (child) {\n if (!(child instanceof format_1.default)) {\n child = child.wrap(InlineBlot.blotName, true);\n }\n _this.attributes.copy(child);\n });\n this.unwrap();\n }\n else {\n _super.prototype.format.call(this, name, value);\n }\n };\n InlineBlot.prototype.formatAt = function (index, length, name, value) {\n if (this.formats()[name] != null || Registry.query(name, Registry.Scope.ATTRIBUTE)) {\n var blot = this.isolate(index, length);\n blot.format(name, value);\n }\n else {\n _super.prototype.formatAt.call(this, index, length, name, value);\n }\n };\n InlineBlot.prototype.optimize = function (context) {\n _super.prototype.optimize.call(this, context);\n var formats = this.formats();\n if (Object.keys(formats).length === 0) {\n return this.unwrap(); // unformatted span\n }\n var next = this.next;\n if (next instanceof InlineBlot && next.prev === this && isEqual(formats, next.formats())) {\n next.moveChildren(this);\n next.remove();\n }\n };\n InlineBlot.blotName = 'inline';\n InlineBlot.scope = Registry.Scope.INLINE_BLOT;\n InlineBlot.tagName = 'SPAN';\n return InlineBlot;\n}(format_1.default));\nexports.default = InlineBlot;\n\n\n/***/ }),\n/* 47 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar format_1 = __webpack_require__(18);\nvar Registry = __webpack_require__(1);\nvar BlockBlot = /** @class */ (function (_super) {\n __extends(BlockBlot, _super);\n function BlockBlot() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n BlockBlot.formats = function (domNode) {\n var tagName = Registry.query(BlockBlot.blotName).tagName;\n if (domNode.tagName === tagName)\n return undefined;\n return _super.formats.call(this, domNode);\n };\n BlockBlot.prototype.format = function (name, value) {\n if (Registry.query(name, Registry.Scope.BLOCK) == null) {\n return;\n }\n else if (name === this.statics.blotName && !value) {\n this.replaceWith(BlockBlot.blotName);\n }\n else {\n _super.prototype.format.call(this, name, value);\n }\n };\n BlockBlot.prototype.formatAt = function (index, length, name, value) {\n if (Registry.query(name, Registry.Scope.BLOCK) != null) {\n this.format(name, value);\n }\n else {\n _super.prototype.formatAt.call(this, index, length, name, value);\n }\n };\n BlockBlot.prototype.insertAt = function (index, value, def) {\n if (def == null || Registry.query(value, Registry.Scope.INLINE) != null) {\n // Insert text or inline\n _super.prototype.insertAt.call(this, index, value, def);\n }\n else {\n var after = this.split(index);\n var blot = Registry.create(value, def);\n after.parent.insertBefore(blot, after);\n }\n };\n BlockBlot.prototype.update = function (mutations, context) {\n if (navigator.userAgent.match(/Trident/)) {\n this.build();\n }\n else {\n _super.prototype.update.call(this, mutations, context);\n }\n };\n BlockBlot.blotName = 'block';\n BlockBlot.scope = Registry.Scope.BLOCK_BLOT;\n BlockBlot.tagName = 'P';\n return BlockBlot;\n}(format_1.default));\nexports.default = BlockBlot;\n\n\n/***/ }),\n/* 48 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar leaf_1 = __webpack_require__(19);\nvar EmbedBlot = /** @class */ (function (_super) {\n __extends(EmbedBlot, _super);\n function EmbedBlot() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n EmbedBlot.formats = function (domNode) {\n return undefined;\n };\n EmbedBlot.prototype.format = function (name, value) {\n // super.formatAt wraps, which is what we want in general,\n // but this allows subclasses to overwrite for formats\n // that just apply to particular embeds\n _super.prototype.formatAt.call(this, 0, this.length(), name, value);\n };\n EmbedBlot.prototype.formatAt = function (index, length, name, value) {\n if (index === 0 && length === this.length()) {\n this.format(name, value);\n }\n else {\n _super.prototype.formatAt.call(this, index, length, name, value);\n }\n };\n EmbedBlot.prototype.formats = function () {\n return this.statics.formats(this.domNode);\n };\n return EmbedBlot;\n}(leaf_1.default));\nexports.default = EmbedBlot;\n\n\n/***/ }),\n/* 49 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar leaf_1 = __webpack_require__(19);\nvar Registry = __webpack_require__(1);\nvar TextBlot = /** @class */ (function (_super) {\n __extends(TextBlot, _super);\n function TextBlot(node) {\n var _this = _super.call(this, node) || this;\n _this.text = _this.statics.value(_this.domNode);\n return _this;\n }\n TextBlot.create = function (value) {\n return document.createTextNode(value);\n };\n TextBlot.value = function (domNode) {\n var text = domNode.data;\n // @ts-ignore\n if (text['normalize'])\n text = text['normalize']();\n return text;\n };\n TextBlot.prototype.deleteAt = function (index, length) {\n this.domNode.data = this.text = this.text.slice(0, index) + this.text.slice(index + length);\n };\n TextBlot.prototype.index = function (node, offset) {\n if (this.domNode === node) {\n return offset;\n }\n return -1;\n };\n TextBlot.prototype.insertAt = function (index, value, def) {\n if (def == null) {\n this.text = this.text.slice(0, index) + value + this.text.slice(index);\n this.domNode.data = this.text;\n }\n else {\n _super.prototype.insertAt.call(this, index, value, def);\n }\n };\n TextBlot.prototype.length = function () {\n return this.text.length;\n };\n TextBlot.prototype.optimize = function (context) {\n _super.prototype.optimize.call(this, context);\n this.text = this.statics.value(this.domNode);\n if (this.text.length === 0) {\n this.remove();\n }\n else if (this.next instanceof TextBlot && this.next.prev === this) {\n this.insertAt(this.length(), this.next.value());\n this.next.remove();\n }\n };\n TextBlot.prototype.position = function (index, inclusive) {\n if (inclusive === void 0) { inclusive = false; }\n return [this.domNode, index];\n };\n TextBlot.prototype.split = function (index, force) {\n if (force === void 0) { force = false; }\n if (!force) {\n if (index === 0)\n return this;\n if (index === this.length())\n return this.next;\n }\n var after = Registry.create(this.domNode.splitText(index));\n this.parent.insertBefore(after, this.next);\n this.text = this.statics.value(this.domNode);\n return after;\n };\n TextBlot.prototype.update = function (mutations, context) {\n var _this = this;\n if (mutations.some(function (mutation) {\n return mutation.type === 'characterData' && mutation.target === _this.domNode;\n })) {\n this.text = this.statics.value(this.domNode);\n }\n };\n TextBlot.prototype.value = function () {\n return this.text;\n };\n TextBlot.blotName = 'text';\n TextBlot.scope = Registry.Scope.INLINE_BLOT;\n return TextBlot;\n}(leaf_1.default));\nexports.default = TextBlot;\n\n\n/***/ }),\n/* 50 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar elem = document.createElement('div');\nelem.classList.toggle('test-class', false);\nif (elem.classList.contains('test-class')) {\n var _toggle = DOMTokenList.prototype.toggle;\n DOMTokenList.prototype.toggle = function (token, force) {\n if (arguments.length > 1 && !this.contains(token) === !force) {\n return force;\n } else {\n return _toggle.call(this, token);\n }\n };\n}\n\nif (!String.prototype.startsWith) {\n String.prototype.startsWith = function (searchString, position) {\n position = position || 0;\n return this.substr(position, searchString.length) === searchString;\n };\n}\n\nif (!String.prototype.endsWith) {\n String.prototype.endsWith = function (searchString, position) {\n var subjectString = this.toString();\n if (typeof position !== 'number' || !isFinite(position) || Math.floor(position) !== position || position > subjectString.length) {\n position = subjectString.length;\n }\n position -= searchString.length;\n var lastIndex = subjectString.indexOf(searchString, position);\n return lastIndex !== -1 && lastIndex === position;\n };\n}\n\nif (!Array.prototype.find) {\n Object.defineProperty(Array.prototype, \"find\", {\n value: function value(predicate) {\n if (this === null) {\n throw new TypeError('Array.prototype.find called on null or undefined');\n }\n if (typeof predicate !== 'function') {\n throw new TypeError('predicate must be a function');\n }\n var list = Object(this);\n var length = list.length >>> 0;\n var thisArg = arguments[1];\n var value;\n\n for (var i = 0; i < length; i++) {\n value = list[i];\n if (predicate.call(thisArg, value, i, list)) {\n return value;\n }\n }\n return undefined;\n }\n });\n}\n\ndocument.addEventListener(\"DOMContentLoaded\", function () {\n // Disable resizing in Firefox\n document.execCommand(\"enableObjectResizing\", false, false);\n // Disable automatic linkifying in IE11\n document.execCommand(\"autoUrlDetect\", false, false);\n});\n\n/***/ }),\n/* 51 */\n/***/ (function(module, exports) {\n\n/**\n * This library modifies the diff-patch-match library by Neil Fraser\n * by removing the patch and match functionality and certain advanced\n * options in the diff function. The original license is as follows:\n *\n * ===\n *\n * Diff Match and Patch\n *\n * Copyright 2006 Google Inc.\n * http://code.google.com/p/google-diff-match-patch/\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n\n/**\n * The data structure representing a diff is an array of tuples:\n * [[DIFF_DELETE, 'Hello'], [DIFF_INSERT, 'Goodbye'], [DIFF_EQUAL, ' world.']]\n * which means: delete 'Hello', add 'Goodbye' and keep ' world.'\n */\nvar DIFF_DELETE = -1;\nvar DIFF_INSERT = 1;\nvar DIFF_EQUAL = 0;\n\n\n/**\n * Find the differences between two texts. Simplifies the problem by stripping\n * any common prefix or suffix off the texts before diffing.\n * @param {string} text1 Old string to be diffed.\n * @param {string} text2 New string to be diffed.\n * @param {Int} cursor_pos Expected edit position in text1 (optional)\n * @return {Array} Array of diff tuples.\n */\nfunction diff_main(text1, text2, cursor_pos) {\n // Check for equality (speedup).\n if (text1 == text2) {\n if (text1) {\n return [[DIFF_EQUAL, text1]];\n }\n return [];\n }\n\n // Check cursor_pos within bounds\n if (cursor_pos < 0 || text1.length < cursor_pos) {\n cursor_pos = null;\n }\n\n // Trim off common prefix (speedup).\n var commonlength = diff_commonPrefix(text1, text2);\n var commonprefix = text1.substring(0, commonlength);\n text1 = text1.substring(commonlength);\n text2 = text2.substring(commonlength);\n\n // Trim off common suffix (speedup).\n commonlength = diff_commonSuffix(text1, text2);\n var commonsuffix = text1.substring(text1.length - commonlength);\n text1 = text1.substring(0, text1.length - commonlength);\n text2 = text2.substring(0, text2.length - commonlength);\n\n // Compute the diff on the middle block.\n var diffs = diff_compute_(text1, text2);\n\n // Restore the prefix and suffix.\n if (commonprefix) {\n diffs.unshift([DIFF_EQUAL, commonprefix]);\n }\n if (commonsuffix) {\n diffs.push([DIFF_EQUAL, commonsuffix]);\n }\n diff_cleanupMerge(diffs);\n if (cursor_pos != null) {\n diffs = fix_cursor(diffs, cursor_pos);\n }\n diffs = fix_emoji(diffs);\n return diffs;\n};\n\n\n/**\n * Find the differences between two texts. Assumes that the texts do not\n * have any common prefix or suffix.\n * @param {string} text1 Old string to be diffed.\n * @param {string} text2 New string to be diffed.\n * @return {Array} Array of diff tuples.\n */\nfunction diff_compute_(text1, text2) {\n var diffs;\n\n if (!text1) {\n // Just add some text (speedup).\n return [[DIFF_INSERT, text2]];\n }\n\n if (!text2) {\n // Just delete some text (speedup).\n return [[DIFF_DELETE, text1]];\n }\n\n var longtext = text1.length > text2.length ? text1 : text2;\n var shorttext = text1.length > text2.length ? text2 : text1;\n var i = longtext.indexOf(shorttext);\n if (i != -1) {\n // Shorter text is inside the longer text (speedup).\n diffs = [[DIFF_INSERT, longtext.substring(0, i)],\n [DIFF_EQUAL, shorttext],\n [DIFF_INSERT, longtext.substring(i + shorttext.length)]];\n // Swap insertions for deletions if diff is reversed.\n if (text1.length > text2.length) {\n diffs[0][0] = diffs[2][0] = DIFF_DELETE;\n }\n return diffs;\n }\n\n if (shorttext.length == 1) {\n // Single character string.\n // After the previous speedup, the character can't be an equality.\n return [[DIFF_DELETE, text1], [DIFF_INSERT, text2]];\n }\n\n // Check to see if the problem can be split in two.\n var hm = diff_halfMatch_(text1, text2);\n if (hm) {\n // A half-match was found, sort out the return data.\n var text1_a = hm[0];\n var text1_b = hm[1];\n var text2_a = hm[2];\n var text2_b = hm[3];\n var mid_common = hm[4];\n // Send both pairs off for separate processing.\n var diffs_a = diff_main(text1_a, text2_a);\n var diffs_b = diff_main(text1_b, text2_b);\n // Merge the results.\n return diffs_a.concat([[DIFF_EQUAL, mid_common]], diffs_b);\n }\n\n return diff_bisect_(text1, text2);\n};\n\n\n/**\n * Find the 'middle snake' of a diff, split the problem in two\n * and return the recursively constructed diff.\n * See Myers 1986 paper: An O(ND) Difference Algorithm and Its Variations.\n * @param {string} text1 Old string to be diffed.\n * @param {string} text2 New string to be diffed.\n * @return {Array} Array of diff tuples.\n * @private\n */\nfunction diff_bisect_(text1, text2) {\n // Cache the text lengths to prevent multiple calls.\n var text1_length = text1.length;\n var text2_length = text2.length;\n var max_d = Math.ceil((text1_length + text2_length) / 2);\n var v_offset = max_d;\n var v_length = 2 * max_d;\n var v1 = new Array(v_length);\n var v2 = new Array(v_length);\n // Setting all elements to -1 is faster in Chrome & Firefox than mixing\n // integers and undefined.\n for (var x = 0; x < v_length; x++) {\n v1[x] = -1;\n v2[x] = -1;\n }\n v1[v_offset + 1] = 0;\n v2[v_offset + 1] = 0;\n var delta = text1_length - text2_length;\n // If the total number of characters is odd, then the front path will collide\n // with the reverse path.\n var front = (delta % 2 != 0);\n // Offsets for start and end of k loop.\n // Prevents mapping of space beyond the grid.\n var k1start = 0;\n var k1end = 0;\n var k2start = 0;\n var k2end = 0;\n for (var d = 0; d < max_d; d++) {\n // Walk the front path one step.\n for (var k1 = -d + k1start; k1 <= d - k1end; k1 += 2) {\n var k1_offset = v_offset + k1;\n var x1;\n if (k1 == -d || (k1 != d && v1[k1_offset - 1] < v1[k1_offset + 1])) {\n x1 = v1[k1_offset + 1];\n } else {\n x1 = v1[k1_offset - 1] + 1;\n }\n var y1 = x1 - k1;\n while (x1 < text1_length && y1 < text2_length &&\n text1.charAt(x1) == text2.charAt(y1)) {\n x1++;\n y1++;\n }\n v1[k1_offset] = x1;\n if (x1 > text1_length) {\n // Ran off the right of the graph.\n k1end += 2;\n } else if (y1 > text2_length) {\n // Ran off the bottom of the graph.\n k1start += 2;\n } else if (front) {\n var k2_offset = v_offset + delta - k1;\n if (k2_offset >= 0 && k2_offset < v_length && v2[k2_offset] != -1) {\n // Mirror x2 onto top-left coordinate system.\n var x2 = text1_length - v2[k2_offset];\n if (x1 >= x2) {\n // Overlap detected.\n return diff_bisectSplit_(text1, text2, x1, y1);\n }\n }\n }\n }\n\n // Walk the reverse path one step.\n for (var k2 = -d + k2start; k2 <= d - k2end; k2 += 2) {\n var k2_offset = v_offset + k2;\n var x2;\n if (k2 == -d || (k2 != d && v2[k2_offset - 1] < v2[k2_offset + 1])) {\n x2 = v2[k2_offset + 1];\n } else {\n x2 = v2[k2_offset - 1] + 1;\n }\n var y2 = x2 - k2;\n while (x2 < text1_length && y2 < text2_length &&\n text1.charAt(text1_length - x2 - 1) ==\n text2.charAt(text2_length - y2 - 1)) {\n x2++;\n y2++;\n }\n v2[k2_offset] = x2;\n if (x2 > text1_length) {\n // Ran off the left of the graph.\n k2end += 2;\n } else if (y2 > text2_length) {\n // Ran off the top of the graph.\n k2start += 2;\n } else if (!front) {\n var k1_offset = v_offset + delta - k2;\n if (k1_offset >= 0 && k1_offset < v_length && v1[k1_offset] != -1) {\n var x1 = v1[k1_offset];\n var y1 = v_offset + x1 - k1_offset;\n // Mirror x2 onto top-left coordinate system.\n x2 = text1_length - x2;\n if (x1 >= x2) {\n // Overlap detected.\n return diff_bisectSplit_(text1, text2, x1, y1);\n }\n }\n }\n }\n }\n // Diff took too long and hit the deadline or\n // number of diffs equals number of characters, no commonality at all.\n return [[DIFF_DELETE, text1], [DIFF_INSERT, text2]];\n};\n\n\n/**\n * Given the location of the 'middle snake', split the diff in two parts\n * and recurse.\n * @param {string} text1 Old string to be diffed.\n * @param {string} text2 New string to be diffed.\n * @param {number} x Index of split point in text1.\n * @param {number} y Index of split point in text2.\n * @return {Array} Array of diff tuples.\n */\nfunction diff_bisectSplit_(text1, text2, x, y) {\n var text1a = text1.substring(0, x);\n var text2a = text2.substring(0, y);\n var text1b = text1.substring(x);\n var text2b = text2.substring(y);\n\n // Compute both diffs serially.\n var diffs = diff_main(text1a, text2a);\n var diffsb = diff_main(text1b, text2b);\n\n return diffs.concat(diffsb);\n};\n\n\n/**\n * Determine the common prefix of two strings.\n * @param {string} text1 First string.\n * @param {string} text2 Second string.\n * @return {number} The number of characters common to the start of each\n * string.\n */\nfunction diff_commonPrefix(text1, text2) {\n // Quick check for common null cases.\n if (!text1 || !text2 || text1.charAt(0) != text2.charAt(0)) {\n return 0;\n }\n // Binary search.\n // Performance analysis: http://neil.fraser.name/news/2007/10/09/\n var pointermin = 0;\n var pointermax = Math.min(text1.length, text2.length);\n var pointermid = pointermax;\n var pointerstart = 0;\n while (pointermin < pointermid) {\n if (text1.substring(pointerstart, pointermid) ==\n text2.substring(pointerstart, pointermid)) {\n pointermin = pointermid;\n pointerstart = pointermin;\n } else {\n pointermax = pointermid;\n }\n pointermid = Math.floor((pointermax - pointermin) / 2 + pointermin);\n }\n return pointermid;\n};\n\n\n/**\n * Determine the common suffix of two strings.\n * @param {string} text1 First string.\n * @param {string} text2 Second string.\n * @return {number} The number of characters common to the end of each string.\n */\nfunction diff_commonSuffix(text1, text2) {\n // Quick check for common null cases.\n if (!text1 || !text2 ||\n text1.charAt(text1.length - 1) != text2.charAt(text2.length - 1)) {\n return 0;\n }\n // Binary search.\n // Performance analysis: http://neil.fraser.name/news/2007/10/09/\n var pointermin = 0;\n var pointermax = Math.min(text1.length, text2.length);\n var pointermid = pointermax;\n var pointerend = 0;\n while (pointermin < pointermid) {\n if (text1.substring(text1.length - pointermid, text1.length - pointerend) ==\n text2.substring(text2.length - pointermid, text2.length - pointerend)) {\n pointermin = pointermid;\n pointerend = pointermin;\n } else {\n pointermax = pointermid;\n }\n pointermid = Math.floor((pointermax - pointermin) / 2 + pointermin);\n }\n return pointermid;\n};\n\n\n/**\n * Do the two texts share a substring which is at least half the length of the\n * longer text?\n * This speedup can produce non-minimal diffs.\n * @param {string} text1 First string.\n * @param {string} text2 Second string.\n * @return {Array.} Five element Array, containing the prefix of\n * text1, the suffix of text1, the prefix of text2, the suffix of\n * text2 and the common middle. Or null if there was no match.\n */\nfunction diff_halfMatch_(text1, text2) {\n var longtext = text1.length > text2.length ? text1 : text2;\n var shorttext = text1.length > text2.length ? text2 : text1;\n if (longtext.length < 4 || shorttext.length * 2 < longtext.length) {\n return null; // Pointless.\n }\n\n /**\n * Does a substring of shorttext exist within longtext such that the substring\n * is at least half the length of longtext?\n * Closure, but does not reference any external variables.\n * @param {string} longtext Longer string.\n * @param {string} shorttext Shorter string.\n * @param {number} i Start index of quarter length substring within longtext.\n * @return {Array.} Five element Array, containing the prefix of\n * longtext, the suffix of longtext, the prefix of shorttext, the suffix\n * of shorttext and the common middle. Or null if there was no match.\n * @private\n */\n function diff_halfMatchI_(longtext, shorttext, i) {\n // Start with a 1/4 length substring at position i as a seed.\n var seed = longtext.substring(i, i + Math.floor(longtext.length / 4));\n var j = -1;\n var best_common = '';\n var best_longtext_a, best_longtext_b, best_shorttext_a, best_shorttext_b;\n while ((j = shorttext.indexOf(seed, j + 1)) != -1) {\n var prefixLength = diff_commonPrefix(longtext.substring(i),\n shorttext.substring(j));\n var suffixLength = diff_commonSuffix(longtext.substring(0, i),\n shorttext.substring(0, j));\n if (best_common.length < suffixLength + prefixLength) {\n best_common = shorttext.substring(j - suffixLength, j) +\n shorttext.substring(j, j + prefixLength);\n best_longtext_a = longtext.substring(0, i - suffixLength);\n best_longtext_b = longtext.substring(i + prefixLength);\n best_shorttext_a = shorttext.substring(0, j - suffixLength);\n best_shorttext_b = shorttext.substring(j + prefixLength);\n }\n }\n if (best_common.length * 2 >= longtext.length) {\n return [best_longtext_a, best_longtext_b,\n best_shorttext_a, best_shorttext_b, best_common];\n } else {\n return null;\n }\n }\n\n // First check if the second quarter is the seed for a half-match.\n var hm1 = diff_halfMatchI_(longtext, shorttext,\n Math.ceil(longtext.length / 4));\n // Check again based on the third quarter.\n var hm2 = diff_halfMatchI_(longtext, shorttext,\n Math.ceil(longtext.length / 2));\n var hm;\n if (!hm1 && !hm2) {\n return null;\n } else if (!hm2) {\n hm = hm1;\n } else if (!hm1) {\n hm = hm2;\n } else {\n // Both matched. Select the longest.\n hm = hm1[4].length > hm2[4].length ? hm1 : hm2;\n }\n\n // A half-match was found, sort out the return data.\n var text1_a, text1_b, text2_a, text2_b;\n if (text1.length > text2.length) {\n text1_a = hm[0];\n text1_b = hm[1];\n text2_a = hm[2];\n text2_b = hm[3];\n } else {\n text2_a = hm[0];\n text2_b = hm[1];\n text1_a = hm[2];\n text1_b = hm[3];\n }\n var mid_common = hm[4];\n return [text1_a, text1_b, text2_a, text2_b, mid_common];\n};\n\n\n/**\n * Reorder and merge like edit sections. Merge equalities.\n * Any edit section can move as long as it doesn't cross an equality.\n * @param {Array} diffs Array of diff tuples.\n */\nfunction diff_cleanupMerge(diffs) {\n diffs.push([DIFF_EQUAL, '']); // Add a dummy entry at the end.\n var pointer = 0;\n var count_delete = 0;\n var count_insert = 0;\n var text_delete = '';\n var text_insert = '';\n var commonlength;\n while (pointer < diffs.length) {\n switch (diffs[pointer][0]) {\n case DIFF_INSERT:\n count_insert++;\n text_insert += diffs[pointer][1];\n pointer++;\n break;\n case DIFF_DELETE:\n count_delete++;\n text_delete += diffs[pointer][1];\n pointer++;\n break;\n case DIFF_EQUAL:\n // Upon reaching an equality, check for prior redundancies.\n if (count_delete + count_insert > 1) {\n if (count_delete !== 0 && count_insert !== 0) {\n // Factor out any common prefixies.\n commonlength = diff_commonPrefix(text_insert, text_delete);\n if (commonlength !== 0) {\n if ((pointer - count_delete - count_insert) > 0 &&\n diffs[pointer - count_delete - count_insert - 1][0] ==\n DIFF_EQUAL) {\n diffs[pointer - count_delete - count_insert - 1][1] +=\n text_insert.substring(0, commonlength);\n } else {\n diffs.splice(0, 0, [DIFF_EQUAL,\n text_insert.substring(0, commonlength)]);\n pointer++;\n }\n text_insert = text_insert.substring(commonlength);\n text_delete = text_delete.substring(commonlength);\n }\n // Factor out any common suffixies.\n commonlength = diff_commonSuffix(text_insert, text_delete);\n if (commonlength !== 0) {\n diffs[pointer][1] = text_insert.substring(text_insert.length -\n commonlength) + diffs[pointer][1];\n text_insert = text_insert.substring(0, text_insert.length -\n commonlength);\n text_delete = text_delete.substring(0, text_delete.length -\n commonlength);\n }\n }\n // Delete the offending records and add the merged ones.\n if (count_delete === 0) {\n diffs.splice(pointer - count_insert,\n count_delete + count_insert, [DIFF_INSERT, text_insert]);\n } else if (count_insert === 0) {\n diffs.splice(pointer - count_delete,\n count_delete + count_insert, [DIFF_DELETE, text_delete]);\n } else {\n diffs.splice(pointer - count_delete - count_insert,\n count_delete + count_insert, [DIFF_DELETE, text_delete],\n [DIFF_INSERT, text_insert]);\n }\n pointer = pointer - count_delete - count_insert +\n (count_delete ? 1 : 0) + (count_insert ? 1 : 0) + 1;\n } else if (pointer !== 0 && diffs[pointer - 1][0] == DIFF_EQUAL) {\n // Merge this equality with the previous one.\n diffs[pointer - 1][1] += diffs[pointer][1];\n diffs.splice(pointer, 1);\n } else {\n pointer++;\n }\n count_insert = 0;\n count_delete = 0;\n text_delete = '';\n text_insert = '';\n break;\n }\n }\n if (diffs[diffs.length - 1][1] === '') {\n diffs.pop(); // Remove the dummy entry at the end.\n }\n\n // Second pass: look for single edits surrounded on both sides by equalities\n // which can be shifted sideways to eliminate an equality.\n // e.g: ABAC -> ABAC\n var changes = false;\n pointer = 1;\n // Intentionally ignore the first and last element (don't need checking).\n while (pointer < diffs.length - 1) {\n if (diffs[pointer - 1][0] == DIFF_EQUAL &&\n diffs[pointer + 1][0] == DIFF_EQUAL) {\n // This is a single edit surrounded by equalities.\n if (diffs[pointer][1].substring(diffs[pointer][1].length -\n diffs[pointer - 1][1].length) == diffs[pointer - 1][1]) {\n // Shift the edit over the previous equality.\n diffs[pointer][1] = diffs[pointer - 1][1] +\n diffs[pointer][1].substring(0, diffs[pointer][1].length -\n diffs[pointer - 1][1].length);\n diffs[pointer + 1][1] = diffs[pointer - 1][1] + diffs[pointer + 1][1];\n diffs.splice(pointer - 1, 1);\n changes = true;\n } else if (diffs[pointer][1].substring(0, diffs[pointer + 1][1].length) ==\n diffs[pointer + 1][1]) {\n // Shift the edit over the next equality.\n diffs[pointer - 1][1] += diffs[pointer + 1][1];\n diffs[pointer][1] =\n diffs[pointer][1].substring(diffs[pointer + 1][1].length) +\n diffs[pointer + 1][1];\n diffs.splice(pointer + 1, 1);\n changes = true;\n }\n }\n pointer++;\n }\n // If shifts were made, the diff needs reordering and another shift sweep.\n if (changes) {\n diff_cleanupMerge(diffs);\n }\n};\n\n\nvar diff = diff_main;\ndiff.INSERT = DIFF_INSERT;\ndiff.DELETE = DIFF_DELETE;\ndiff.EQUAL = DIFF_EQUAL;\n\nmodule.exports = diff;\n\n/*\n * Modify a diff such that the cursor position points to the start of a change:\n * E.g.\n * cursor_normalize_diff([[DIFF_EQUAL, 'abc']], 1)\n * => [1, [[DIFF_EQUAL, 'a'], [DIFF_EQUAL, 'bc']]]\n * cursor_normalize_diff([[DIFF_INSERT, 'new'], [DIFF_DELETE, 'xyz']], 2)\n * => [2, [[DIFF_INSERT, 'new'], [DIFF_DELETE, 'xy'], [DIFF_DELETE, 'z']]]\n *\n * @param {Array} diffs Array of diff tuples\n * @param {Int} cursor_pos Suggested edit position. Must not be out of bounds!\n * @return {Array} A tuple [cursor location in the modified diff, modified diff]\n */\nfunction cursor_normalize_diff (diffs, cursor_pos) {\n if (cursor_pos === 0) {\n return [DIFF_EQUAL, diffs];\n }\n for (var current_pos = 0, i = 0; i < diffs.length; i++) {\n var d = diffs[i];\n if (d[0] === DIFF_DELETE || d[0] === DIFF_EQUAL) {\n var next_pos = current_pos + d[1].length;\n if (cursor_pos === next_pos) {\n return [i + 1, diffs];\n } else if (cursor_pos < next_pos) {\n // copy to prevent side effects\n diffs = diffs.slice();\n // split d into two diff changes\n var split_pos = cursor_pos - current_pos;\n var d_left = [d[0], d[1].slice(0, split_pos)];\n var d_right = [d[0], d[1].slice(split_pos)];\n diffs.splice(i, 1, d_left, d_right);\n return [i + 1, diffs];\n } else {\n current_pos = next_pos;\n }\n }\n }\n throw new Error('cursor_pos is out of bounds!')\n}\n\n/*\n * Modify a diff such that the edit position is \"shifted\" to the proposed edit location (cursor_position).\n *\n * Case 1)\n * Check if a naive shift is possible:\n * [0, X], [ 1, Y] -> [ 1, Y], [0, X] (if X + Y === Y + X)\n * [0, X], [-1, Y] -> [-1, Y], [0, X] (if X + Y === Y + X) - holds same result\n * Case 2)\n * Check if the following shifts are possible:\n * [0, 'pre'], [ 1, 'prefix'] -> [ 1, 'pre'], [0, 'pre'], [ 1, 'fix']\n * [0, 'pre'], [-1, 'prefix'] -> [-1, 'pre'], [0, 'pre'], [-1, 'fix']\n * ^ ^\n * d d_next\n *\n * @param {Array} diffs Array of diff tuples\n * @param {Int} cursor_pos Suggested edit position. Must not be out of bounds!\n * @return {Array} Array of diff tuples\n */\nfunction fix_cursor (diffs, cursor_pos) {\n var norm = cursor_normalize_diff(diffs, cursor_pos);\n var ndiffs = norm[1];\n var cursor_pointer = norm[0];\n var d = ndiffs[cursor_pointer];\n var d_next = ndiffs[cursor_pointer + 1];\n\n if (d == null) {\n // Text was deleted from end of original string,\n // cursor is now out of bounds in new string\n return diffs;\n } else if (d[0] !== DIFF_EQUAL) {\n // A modification happened at the cursor location.\n // This is the expected outcome, so we can return the original diff.\n return diffs;\n } else {\n if (d_next != null && d[1] + d_next[1] === d_next[1] + d[1]) {\n // Case 1)\n // It is possible to perform a naive shift\n ndiffs.splice(cursor_pointer, 2, d_next, d)\n return merge_tuples(ndiffs, cursor_pointer, 2)\n } else if (d_next != null && d_next[1].indexOf(d[1]) === 0) {\n // Case 2)\n // d[1] is a prefix of d_next[1]\n // We can assume that d_next[0] !== 0, since d[0] === 0\n // Shift edit locations..\n ndiffs.splice(cursor_pointer, 2, [d_next[0], d[1]], [0, d[1]]);\n var suffix = d_next[1].slice(d[1].length);\n if (suffix.length > 0) {\n ndiffs.splice(cursor_pointer + 2, 0, [d_next[0], suffix]);\n }\n return merge_tuples(ndiffs, cursor_pointer, 3)\n } else {\n // Not possible to perform any modification\n return diffs;\n }\n }\n}\n\n/*\n * Check diff did not split surrogate pairs.\n * Ex. [0, '\\uD83D'], [-1, '\\uDC36'], [1, '\\uDC2F'] -> [-1, '\\uD83D\\uDC36'], [1, '\\uD83D\\uDC2F']\n * '\\uD83D\\uDC36' === '🐶', '\\uD83D\\uDC2F' === '🐯'\n *\n * @param {Array} diffs Array of diff tuples\n * @return {Array} Array of diff tuples\n */\nfunction fix_emoji (diffs) {\n var compact = false;\n var starts_with_pair_end = function(str) {\n return str.charCodeAt(0) >= 0xDC00 && str.charCodeAt(0) <= 0xDFFF;\n }\n var ends_with_pair_start = function(str) {\n return str.charCodeAt(str.length-1) >= 0xD800 && str.charCodeAt(str.length-1) <= 0xDBFF;\n }\n for (var i = 2; i < diffs.length; i += 1) {\n if (diffs[i-2][0] === DIFF_EQUAL && ends_with_pair_start(diffs[i-2][1]) &&\n diffs[i-1][0] === DIFF_DELETE && starts_with_pair_end(diffs[i-1][1]) &&\n diffs[i][0] === DIFF_INSERT && starts_with_pair_end(diffs[i][1])) {\n compact = true;\n\n diffs[i-1][1] = diffs[i-2][1].slice(-1) + diffs[i-1][1];\n diffs[i][1] = diffs[i-2][1].slice(-1) + diffs[i][1];\n\n diffs[i-2][1] = diffs[i-2][1].slice(0, -1);\n }\n }\n if (!compact) {\n return diffs;\n }\n var fixed_diffs = [];\n for (var i = 0; i < diffs.length; i += 1) {\n if (diffs[i][1].length > 0) {\n fixed_diffs.push(diffs[i]);\n }\n }\n return fixed_diffs;\n}\n\n/*\n * Try to merge tuples with their neigbors in a given range.\n * E.g. [0, 'a'], [0, 'b'] -> [0, 'ab']\n *\n * @param {Array} diffs Array of diff tuples.\n * @param {Int} start Position of the first element to merge (diffs[start] is also merged with diffs[start - 1]).\n * @param {Int} length Number of consecutive elements to check.\n * @return {Array} Array of merged diff tuples.\n */\nfunction merge_tuples (diffs, start, length) {\n // Check from (start-1) to (start+length).\n for (var i = start + length - 1; i >= 0 && i >= start - 1; i--) {\n if (i + 1 < diffs.length) {\n var left_d = diffs[i];\n var right_d = diffs[i+1];\n if (left_d[0] === right_d[1]) {\n diffs.splice(i, 2, [left_d[0], left_d[1] + right_d[1]]);\n }\n }\n }\n return diffs;\n}\n\n\n/***/ }),\n/* 52 */\n/***/ (function(module, exports) {\n\nexports = module.exports = typeof Object.keys === 'function'\n ? Object.keys : shim;\n\nexports.shim = shim;\nfunction shim (obj) {\n var keys = [];\n for (var key in obj) keys.push(key);\n return keys;\n}\n\n\n/***/ }),\n/* 53 */\n/***/ (function(module, exports) {\n\nvar supportsArgumentsClass = (function(){\n return Object.prototype.toString.call(arguments)\n})() == '[object Arguments]';\n\nexports = module.exports = supportsArgumentsClass ? supported : unsupported;\n\nexports.supported = supported;\nfunction supported(object) {\n return Object.prototype.toString.call(object) == '[object Arguments]';\n};\n\nexports.unsupported = unsupported;\nfunction unsupported(object){\n return object &&\n typeof object == 'object' &&\n typeof object.length == 'number' &&\n Object.prototype.hasOwnProperty.call(object, 'callee') &&\n !Object.prototype.propertyIsEnumerable.call(object, 'callee') ||\n false;\n};\n\n\n/***/ }),\n/* 54 */\n/***/ (function(module, exports) {\n\n'use strict';\n\nvar has = Object.prototype.hasOwnProperty\n , prefix = '~';\n\n/**\n * Constructor to create a storage for our `EE` objects.\n * An `Events` instance is a plain object whose properties are event names.\n *\n * @constructor\n * @api private\n */\nfunction Events() {}\n\n//\n// We try to not inherit from `Object.prototype`. In some engines creating an\n// instance in this way is faster than calling `Object.create(null)` directly.\n// If `Object.create(null)` is not supported we prefix the event names with a\n// character to make sure that the built-in object properties are not\n// overridden or used as an attack vector.\n//\nif (Object.create) {\n Events.prototype = Object.create(null);\n\n //\n // This hack is needed because the `__proto__` property is still inherited in\n // some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5.\n //\n if (!new Events().__proto__) prefix = false;\n}\n\n/**\n * Representation of a single event listener.\n *\n * @param {Function} fn The listener function.\n * @param {Mixed} context The context to invoke the listener with.\n * @param {Boolean} [once=false] Specify if the listener is a one-time listener.\n * @constructor\n * @api private\n */\nfunction EE(fn, context, once) {\n this.fn = fn;\n this.context = context;\n this.once = once || false;\n}\n\n/**\n * Minimal `EventEmitter` interface that is molded against the Node.js\n * `EventEmitter` interface.\n *\n * @constructor\n * @api public\n */\nfunction EventEmitter() {\n this._events = new Events();\n this._eventsCount = 0;\n}\n\n/**\n * Return an array listing the events for which the emitter has registered\n * listeners.\n *\n * @returns {Array}\n * @api public\n */\nEventEmitter.prototype.eventNames = function eventNames() {\n var names = []\n , events\n , name;\n\n if (this._eventsCount === 0) return names;\n\n for (name in (events = this._events)) {\n if (has.call(events, name)) names.push(prefix ? name.slice(1) : name);\n }\n\n if (Object.getOwnPropertySymbols) {\n return names.concat(Object.getOwnPropertySymbols(events));\n }\n\n return names;\n};\n\n/**\n * Return the listeners registered for a given event.\n *\n * @param {String|Symbol} event The event name.\n * @param {Boolean} exists Only check if there are listeners.\n * @returns {Array|Boolean}\n * @api public\n */\nEventEmitter.prototype.listeners = function listeners(event, exists) {\n var evt = prefix ? prefix + event : event\n , available = this._events[evt];\n\n if (exists) return !!available;\n if (!available) return [];\n if (available.fn) return [available.fn];\n\n for (var i = 0, l = available.length, ee = new Array(l); i < l; i++) {\n ee[i] = available[i].fn;\n }\n\n return ee;\n};\n\n/**\n * Calls each of the listeners registered for a given event.\n *\n * @param {String|Symbol} event The event name.\n * @returns {Boolean} `true` if the event had listeners, else `false`.\n * @api public\n */\nEventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {\n var evt = prefix ? prefix + event : event;\n\n if (!this._events[evt]) return false;\n\n var listeners = this._events[evt]\n , len = arguments.length\n , args\n , i;\n\n if (listeners.fn) {\n if (listeners.once) this.removeListener(event, listeners.fn, undefined, true);\n\n switch (len) {\n case 1: return listeners.fn.call(listeners.context), true;\n case 2: return listeners.fn.call(listeners.context, a1), true;\n case 3: return listeners.fn.call(listeners.context, a1, a2), true;\n case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true;\n case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;\n case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;\n }\n\n for (i = 1, args = new Array(len -1); i < len; i++) {\n args[i - 1] = arguments[i];\n }\n\n listeners.fn.apply(listeners.context, args);\n } else {\n var length = listeners.length\n , j;\n\n for (i = 0; i < length; i++) {\n if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true);\n\n switch (len) {\n case 1: listeners[i].fn.call(listeners[i].context); break;\n case 2: listeners[i].fn.call(listeners[i].context, a1); break;\n case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break;\n case 4: listeners[i].fn.call(listeners[i].context, a1, a2, a3); break;\n default:\n if (!args) for (j = 1, args = new Array(len -1); j < len; j++) {\n args[j - 1] = arguments[j];\n }\n\n listeners[i].fn.apply(listeners[i].context, args);\n }\n }\n }\n\n return true;\n};\n\n/**\n * Add a listener for a given event.\n *\n * @param {String|Symbol} event The event name.\n * @param {Function} fn The listener function.\n * @param {Mixed} [context=this] The context to invoke the listener with.\n * @returns {EventEmitter} `this`.\n * @api public\n */\nEventEmitter.prototype.on = function on(event, fn, context) {\n var listener = new EE(fn, context || this)\n , evt = prefix ? prefix + event : event;\n\n if (!this._events[evt]) this._events[evt] = listener, this._eventsCount++;\n else if (!this._events[evt].fn) this._events[evt].push(listener);\n else this._events[evt] = [this._events[evt], listener];\n\n return this;\n};\n\n/**\n * Add a one-time listener for a given event.\n *\n * @param {String|Symbol} event The event name.\n * @param {Function} fn The listener function.\n * @param {Mixed} [context=this] The context to invoke the listener with.\n * @returns {EventEmitter} `this`.\n * @api public\n */\nEventEmitter.prototype.once = function once(event, fn, context) {\n var listener = new EE(fn, context || this, true)\n , evt = prefix ? prefix + event : event;\n\n if (!this._events[evt]) this._events[evt] = listener, this._eventsCount++;\n else if (!this._events[evt].fn) this._events[evt].push(listener);\n else this._events[evt] = [this._events[evt], listener];\n\n return this;\n};\n\n/**\n * Remove the listeners of a given event.\n *\n * @param {String|Symbol} event The event name.\n * @param {Function} fn Only remove the listeners that match this function.\n * @param {Mixed} context Only remove the listeners that have this context.\n * @param {Boolean} once Only remove one-time listeners.\n * @returns {EventEmitter} `this`.\n * @api public\n */\nEventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) {\n var evt = prefix ? prefix + event : event;\n\n if (!this._events[evt]) return this;\n if (!fn) {\n if (--this._eventsCount === 0) this._events = new Events();\n else delete this._events[evt];\n return this;\n }\n\n var listeners = this._events[evt];\n\n if (listeners.fn) {\n if (\n listeners.fn === fn\n && (!once || listeners.once)\n && (!context || listeners.context === context)\n ) {\n if (--this._eventsCount === 0) this._events = new Events();\n else delete this._events[evt];\n }\n } else {\n for (var i = 0, events = [], length = listeners.length; i < length; i++) {\n if (\n listeners[i].fn !== fn\n || (once && !listeners[i].once)\n || (context && listeners[i].context !== context)\n ) {\n events.push(listeners[i]);\n }\n }\n\n //\n // Reset the array, or remove it completely if we have no more listeners.\n //\n if (events.length) this._events[evt] = events.length === 1 ? events[0] : events;\n else if (--this._eventsCount === 0) this._events = new Events();\n else delete this._events[evt];\n }\n\n return this;\n};\n\n/**\n * Remove all listeners, or those of the specified event.\n *\n * @param {String|Symbol} [event] The event name.\n * @returns {EventEmitter} `this`.\n * @api public\n */\nEventEmitter.prototype.removeAllListeners = function removeAllListeners(event) {\n var evt;\n\n if (event) {\n evt = prefix ? prefix + event : event;\n if (this._events[evt]) {\n if (--this._eventsCount === 0) this._events = new Events();\n else delete this._events[evt];\n }\n } else {\n this._events = new Events();\n this._eventsCount = 0;\n }\n\n return this;\n};\n\n//\n// Alias methods names because people roll like that.\n//\nEventEmitter.prototype.off = EventEmitter.prototype.removeListener;\nEventEmitter.prototype.addListener = EventEmitter.prototype.on;\n\n//\n// This function doesn't apply anymore.\n//\nEventEmitter.prototype.setMaxListeners = function setMaxListeners() {\n return this;\n};\n\n//\n// Expose the prefix.\n//\nEventEmitter.prefixed = prefix;\n\n//\n// Allow `EventEmitter` to be imported as module namespace.\n//\nEventEmitter.EventEmitter = EventEmitter;\n\n//\n// Expose the module.\n//\nif ('undefined' !== typeof module) {\n module.exports = EventEmitter;\n}\n\n\n/***/ }),\n/* 55 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.matchText = exports.matchSpacing = exports.matchNewline = exports.matchBlot = exports.matchAttributor = exports.default = undefined;\n\nvar _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; };\n\nvar _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_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\"]) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); } }; }();\n\nvar _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; }; }();\n\nvar _extend2 = __webpack_require__(3);\n\nvar _extend3 = _interopRequireDefault(_extend2);\n\nvar _quillDelta = __webpack_require__(2);\n\nvar _quillDelta2 = _interopRequireDefault(_quillDelta);\n\nvar _parchment = __webpack_require__(0);\n\nvar _parchment2 = _interopRequireDefault(_parchment);\n\nvar _quill = __webpack_require__(5);\n\nvar _quill2 = _interopRequireDefault(_quill);\n\nvar _logger = __webpack_require__(10);\n\nvar _logger2 = _interopRequireDefault(_logger);\n\nvar _module = __webpack_require__(9);\n\nvar _module2 = _interopRequireDefault(_module);\n\nvar _align = __webpack_require__(36);\n\nvar _background = __webpack_require__(37);\n\nvar _code = __webpack_require__(13);\n\nvar _code2 = _interopRequireDefault(_code);\n\nvar _color = __webpack_require__(26);\n\nvar _direction = __webpack_require__(38);\n\nvar _font = __webpack_require__(39);\n\nvar _size = __webpack_require__(40);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\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 _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nvar debug = (0, _logger2.default)('quill:clipboard');\n\nvar DOM_KEY = '__ql-matcher';\n\nvar CLIPBOARD_CONFIG = [[Node.TEXT_NODE, matchText], [Node.TEXT_NODE, matchNewline], ['br', matchBreak], [Node.ELEMENT_NODE, matchNewline], [Node.ELEMENT_NODE, matchBlot], [Node.ELEMENT_NODE, matchSpacing], [Node.ELEMENT_NODE, matchAttributor], [Node.ELEMENT_NODE, matchStyles], ['li', matchIndent], ['b', matchAlias.bind(matchAlias, 'bold')], ['i', matchAlias.bind(matchAlias, 'italic')], ['style', matchIgnore]];\n\nvar ATTRIBUTE_ATTRIBUTORS = [_align.AlignAttribute, _direction.DirectionAttribute].reduce(function (memo, attr) {\n memo[attr.keyName] = attr;\n return memo;\n}, {});\n\nvar STYLE_ATTRIBUTORS = [_align.AlignStyle, _background.BackgroundStyle, _color.ColorStyle, _direction.DirectionStyle, _font.FontStyle, _size.SizeStyle].reduce(function (memo, attr) {\n memo[attr.keyName] = attr;\n return memo;\n}, {});\n\nvar Clipboard = function (_Module) {\n _inherits(Clipboard, _Module);\n\n function Clipboard(quill, options) {\n _classCallCheck(this, Clipboard);\n\n var _this = _possibleConstructorReturn(this, (Clipboard.__proto__ || Object.getPrototypeOf(Clipboard)).call(this, quill, options));\n\n _this.quill.root.addEventListener('paste', _this.onPaste.bind(_this));\n _this.container = _this.quill.addContainer('ql-clipboard');\n _this.container.setAttribute('contenteditable', true);\n _this.container.setAttribute('tabindex', -1);\n _this.matchers = [];\n CLIPBOARD_CONFIG.concat(_this.options.matchers).forEach(function (_ref) {\n var _ref2 = _slicedToArray(_ref, 2),\n selector = _ref2[0],\n matcher = _ref2[1];\n\n if (!options.matchVisual && matcher === matchSpacing) return;\n _this.addMatcher(selector, matcher);\n });\n return _this;\n }\n\n _createClass(Clipboard, [{\n key: 'addMatcher',\n value: function addMatcher(selector, matcher) {\n this.matchers.push([selector, matcher]);\n }\n }, {\n key: 'convert',\n value: function convert(html) {\n if (typeof html === 'string') {\n this.container.innerHTML = html.replace(/\\>\\r?\\n +\\<'); // Remove spaces between tags\n return this.convert();\n }\n var formats = this.quill.getFormat(this.quill.selection.savedRange.index);\n if (formats[_code2.default.blotName]) {\n var text = this.container.innerText;\n this.container.innerHTML = '';\n return new _quillDelta2.default().insert(text, _defineProperty({}, _code2.default.blotName, formats[_code2.default.blotName]));\n }\n\n var _prepareMatching = this.prepareMatching(),\n _prepareMatching2 = _slicedToArray(_prepareMatching, 2),\n elementMatchers = _prepareMatching2[0],\n textMatchers = _prepareMatching2[1];\n\n var delta = traverse(this.container, elementMatchers, textMatchers);\n // Remove trailing newline\n if (deltaEndsWith(delta, '\\n') && delta.ops[delta.ops.length - 1].attributes == null) {\n delta = delta.compose(new _quillDelta2.default().retain(delta.length() - 1).delete(1));\n }\n debug.log('convert', this.container.innerHTML, delta);\n this.container.innerHTML = '';\n return delta;\n }\n }, {\n key: 'dangerouslyPasteHTML',\n value: function dangerouslyPasteHTML(index, html) {\n var source = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _quill2.default.sources.API;\n\n if (typeof index === 'string') {\n this.quill.setContents(this.convert(index), html);\n this.quill.setSelection(0, _quill2.default.sources.SILENT);\n } else {\n var paste = this.convert(html);\n this.quill.updateContents(new _quillDelta2.default().retain(index).concat(paste), source);\n this.quill.setSelection(index + paste.length(), _quill2.default.sources.SILENT);\n }\n }\n }, {\n key: 'onPaste',\n value: function onPaste(e) {\n var _this2 = this;\n\n if (e.defaultPrevented || !this.quill.isEnabled()) return;\n var range = this.quill.getSelection();\n var delta = new _quillDelta2.default().retain(range.index);\n var scrollTop = this.quill.scrollingContainer.scrollTop;\n this.container.focus();\n this.quill.selection.update(_quill2.default.sources.SILENT);\n setTimeout(function () {\n delta = delta.concat(_this2.convert()).delete(range.length);\n _this2.quill.updateContents(delta, _quill2.default.sources.USER);\n // range.length contributes to delta.length()\n _this2.quill.setSelection(delta.length() - range.length, _quill2.default.sources.SILENT);\n _this2.quill.scrollingContainer.scrollTop = scrollTop;\n _this2.quill.focus();\n }, 1);\n }\n }, {\n key: 'prepareMatching',\n value: function prepareMatching() {\n var _this3 = this;\n\n var elementMatchers = [],\n textMatchers = [];\n this.matchers.forEach(function (pair) {\n var _pair = _slicedToArray(pair, 2),\n selector = _pair[0],\n matcher = _pair[1];\n\n switch (selector) {\n case Node.TEXT_NODE:\n textMatchers.push(matcher);\n break;\n case Node.ELEMENT_NODE:\n elementMatchers.push(matcher);\n break;\n default:\n [].forEach.call(_this3.container.querySelectorAll(selector), function (node) {\n // TODO use weakmap\n node[DOM_KEY] = node[DOM_KEY] || [];\n node[DOM_KEY].push(matcher);\n });\n break;\n }\n });\n return [elementMatchers, textMatchers];\n }\n }]);\n\n return Clipboard;\n}(_module2.default);\n\nClipboard.DEFAULTS = {\n matchers: [],\n matchVisual: true\n};\n\nfunction applyFormat(delta, format, value) {\n if ((typeof format === 'undefined' ? 'undefined' : _typeof(format)) === 'object') {\n return Object.keys(format).reduce(function (delta, key) {\n return applyFormat(delta, key, format[key]);\n }, delta);\n } else {\n return delta.reduce(function (delta, op) {\n if (op.attributes && op.attributes[format]) {\n return delta.push(op);\n } else {\n return delta.insert(op.insert, (0, _extend3.default)({}, _defineProperty({}, format, value), op.attributes));\n }\n }, new _quillDelta2.default());\n }\n}\n\nfunction computeStyle(node) {\n if (node.nodeType !== Node.ELEMENT_NODE) return {};\n var DOM_KEY = '__ql-computed-style';\n return node[DOM_KEY] || (node[DOM_KEY] = window.getComputedStyle(node));\n}\n\nfunction deltaEndsWith(delta, text) {\n var endText = \"\";\n for (var i = delta.ops.length - 1; i >= 0 && endText.length < text.length; --i) {\n var op = delta.ops[i];\n if (typeof op.insert !== 'string') break;\n endText = op.insert + endText;\n }\n return endText.slice(-1 * text.length) === text;\n}\n\nfunction isLine(node) {\n if (node.childNodes.length === 0) return false; // Exclude embed blocks\n var style = computeStyle(node);\n return ['block', 'list-item'].indexOf(style.display) > -1;\n}\n\nfunction traverse(node, elementMatchers, textMatchers) {\n // Post-order\n if (node.nodeType === node.TEXT_NODE) {\n return textMatchers.reduce(function (delta, matcher) {\n return matcher(node, delta);\n }, new _quillDelta2.default());\n } else if (node.nodeType === node.ELEMENT_NODE) {\n return [].reduce.call(node.childNodes || [], function (delta, childNode) {\n var childrenDelta = traverse(childNode, elementMatchers, textMatchers);\n if (childNode.nodeType === node.ELEMENT_NODE) {\n childrenDelta = elementMatchers.reduce(function (childrenDelta, matcher) {\n return matcher(childNode, childrenDelta);\n }, childrenDelta);\n childrenDelta = (childNode[DOM_KEY] || []).reduce(function (childrenDelta, matcher) {\n return matcher(childNode, childrenDelta);\n }, childrenDelta);\n }\n return delta.concat(childrenDelta);\n }, new _quillDelta2.default());\n } else {\n return new _quillDelta2.default();\n }\n}\n\nfunction matchAlias(format, node, delta) {\n return applyFormat(delta, format, true);\n}\n\nfunction matchAttributor(node, delta) {\n var attributes = _parchment2.default.Attributor.Attribute.keys(node);\n var classes = _parchment2.default.Attributor.Class.keys(node);\n var styles = _parchment2.default.Attributor.Style.keys(node);\n var formats = {};\n attributes.concat(classes).concat(styles).forEach(function (name) {\n var attr = _parchment2.default.query(name, _parchment2.default.Scope.ATTRIBUTE);\n if (attr != null) {\n formats[attr.attrName] = attr.value(node);\n if (formats[attr.attrName]) return;\n }\n attr = ATTRIBUTE_ATTRIBUTORS[name];\n if (attr != null && (attr.attrName === name || attr.keyName === name)) {\n formats[attr.attrName] = attr.value(node) || undefined;\n }\n attr = STYLE_ATTRIBUTORS[name];\n if (attr != null && (attr.attrName === name || attr.keyName === name)) {\n attr = STYLE_ATTRIBUTORS[name];\n formats[attr.attrName] = attr.value(node) || undefined;\n }\n });\n if (Object.keys(formats).length > 0) {\n delta = applyFormat(delta, formats);\n }\n return delta;\n}\n\nfunction matchBlot(node, delta) {\n var match = _parchment2.default.query(node);\n if (match == null) return delta;\n if (match.prototype instanceof _parchment2.default.Embed) {\n var embed = {};\n var value = match.value(node);\n if (value != null) {\n embed[match.blotName] = value;\n delta = new _quillDelta2.default().insert(embed, match.formats(node));\n }\n } else if (typeof match.formats === 'function') {\n delta = applyFormat(delta, match.blotName, match.formats(node));\n }\n return delta;\n}\n\nfunction matchBreak(node, delta) {\n if (!deltaEndsWith(delta, '\\n')) {\n delta.insert('\\n');\n }\n return delta;\n}\n\nfunction matchIgnore() {\n return new _quillDelta2.default();\n}\n\nfunction matchIndent(node, delta) {\n var match = _parchment2.default.query(node);\n if (match == null || match.blotName !== 'list-item' || !deltaEndsWith(delta, '\\n')) {\n return delta;\n }\n var indent = -1,\n parent = node.parentNode;\n while (!parent.classList.contains('ql-clipboard')) {\n if ((_parchment2.default.query(parent) || {}).blotName === 'list') {\n indent += 1;\n }\n parent = parent.parentNode;\n }\n if (indent <= 0) return delta;\n return delta.compose(new _quillDelta2.default().retain(delta.length() - 1).retain(1, { indent: indent }));\n}\n\nfunction matchNewline(node, delta) {\n if (!deltaEndsWith(delta, '\\n')) {\n if (isLine(node) || delta.length() > 0 && node.nextSibling && isLine(node.nextSibling)) {\n delta.insert('\\n');\n }\n }\n return delta;\n}\n\nfunction matchSpacing(node, delta) {\n if (isLine(node) && node.nextElementSibling != null && !deltaEndsWith(delta, '\\n\\n')) {\n var nodeHeight = node.offsetHeight + parseFloat(computeStyle(node).marginTop) + parseFloat(computeStyle(node).marginBottom);\n if (node.nextElementSibling.offsetTop > node.offsetTop + nodeHeight * 1.5) {\n delta.insert('\\n');\n }\n }\n return delta;\n}\n\nfunction matchStyles(node, delta) {\n var formats = {};\n var style = node.style || {};\n if (style.fontStyle && computeStyle(node).fontStyle === 'italic') {\n formats.italic = true;\n }\n if (style.fontWeight && (computeStyle(node).fontWeight.startsWith('bold') || parseInt(computeStyle(node).fontWeight) >= 700)) {\n formats.bold = true;\n }\n if (Object.keys(formats).length > 0) {\n delta = applyFormat(delta, formats);\n }\n if (parseFloat(style.textIndent || 0) > 0) {\n // Could be 0.5in\n delta = new _quillDelta2.default().insert('\\t').concat(delta);\n }\n return delta;\n}\n\nfunction matchText(node, delta) {\n var text = node.data;\n // Word represents empty line with  \n if (node.parentNode.tagName === 'O:P') {\n return delta.insert(text.trim());\n }\n if (text.trim().length === 0 && node.parentNode.classList.contains('ql-clipboard')) {\n return delta;\n }\n if (!computeStyle(node.parentNode).whiteSpace.startsWith('pre')) {\n // eslint-disable-next-line func-style\n var replacer = function replacer(collapse, match) {\n match = match.replace(/[^\\u00a0]/g, ''); // \\u00a0 is nbsp;\n return match.length < 1 && collapse ? ' ' : match;\n };\n text = text.replace(/\\r\\n/g, ' ').replace(/\\n/g, ' ');\n text = text.replace(/\\s\\s+/g, replacer.bind(replacer, true)); // collapse whitespace\n if (node.previousSibling == null && isLine(node.parentNode) || node.previousSibling != null && isLine(node.previousSibling)) {\n text = text.replace(/^\\s+/, replacer.bind(replacer, false));\n }\n if (node.nextSibling == null && isLine(node.parentNode) || node.nextSibling != null && isLine(node.nextSibling)) {\n text = text.replace(/\\s+$/, replacer.bind(replacer, false));\n }\n }\n return delta.insert(text);\n}\n\nexports.default = Clipboard;\nexports.matchAttributor = matchAttributor;\nexports.matchBlot = matchBlot;\nexports.matchNewline = matchNewline;\nexports.matchSpacing = matchSpacing;\nexports.matchText = matchText;\n\n/***/ }),\n/* 56 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _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; }; }();\n\nvar _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if (\"value\" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };\n\nvar _inline = __webpack_require__(6);\n\nvar _inline2 = _interopRequireDefault(_inline);\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 _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nvar Bold = function (_Inline) {\n _inherits(Bold, _Inline);\n\n function Bold() {\n _classCallCheck(this, Bold);\n\n return _possibleConstructorReturn(this, (Bold.__proto__ || Object.getPrototypeOf(Bold)).apply(this, arguments));\n }\n\n _createClass(Bold, [{\n key: 'optimize',\n value: function optimize(context) {\n _get(Bold.prototype.__proto__ || Object.getPrototypeOf(Bold.prototype), 'optimize', this).call(this, context);\n if (this.domNode.tagName !== this.statics.tagName[0]) {\n this.replaceWith(this.statics.blotName);\n }\n }\n }], [{\n key: 'create',\n value: function create() {\n return _get(Bold.__proto__ || Object.getPrototypeOf(Bold), 'create', this).call(this);\n }\n }, {\n key: 'formats',\n value: function formats() {\n return true;\n }\n }]);\n\n return Bold;\n}(_inline2.default);\n\nBold.blotName = 'bold';\nBold.tagName = ['STRONG', 'B'];\n\nexports.default = Bold;\n\n/***/ }),\n/* 57 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.addControls = exports.default = undefined;\n\nvar _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_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\"]) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); } }; }();\n\nvar _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; }; }();\n\nvar _quillDelta = __webpack_require__(2);\n\nvar _quillDelta2 = _interopRequireDefault(_quillDelta);\n\nvar _parchment = __webpack_require__(0);\n\nvar _parchment2 = _interopRequireDefault(_parchment);\n\nvar _quill = __webpack_require__(5);\n\nvar _quill2 = _interopRequireDefault(_quill);\n\nvar _logger = __webpack_require__(10);\n\nvar _logger2 = _interopRequireDefault(_logger);\n\nvar _module = __webpack_require__(9);\n\nvar _module2 = _interopRequireDefault(_module);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\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 _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nvar debug = (0, _logger2.default)('quill:toolbar');\n\nvar Toolbar = function (_Module) {\n _inherits(Toolbar, _Module);\n\n function Toolbar(quill, options) {\n _classCallCheck(this, Toolbar);\n\n var _this = _possibleConstructorReturn(this, (Toolbar.__proto__ || Object.getPrototypeOf(Toolbar)).call(this, quill, options));\n\n if (Array.isArray(_this.options.container)) {\n var container = document.createElement('div');\n addControls(container, _this.options.container);\n quill.container.parentNode.insertBefore(container, quill.container);\n _this.container = container;\n } else if (typeof _this.options.container === 'string') {\n _this.container = document.querySelector(_this.options.container);\n } else {\n _this.container = _this.options.container;\n }\n if (!(_this.container instanceof HTMLElement)) {\n var _ret;\n\n return _ret = debug.error('Container required for toolbar', _this.options), _possibleConstructorReturn(_this, _ret);\n }\n _this.container.classList.add('ql-toolbar');\n _this.controls = [];\n _this.handlers = {};\n Object.keys(_this.options.handlers).forEach(function (format) {\n _this.addHandler(format, _this.options.handlers[format]);\n });\n [].forEach.call(_this.container.querySelectorAll('button, select'), function (input) {\n _this.attach(input);\n });\n _this.quill.on(_quill2.default.events.EDITOR_CHANGE, function (type, range) {\n if (type === _quill2.default.events.SELECTION_CHANGE) {\n _this.update(range);\n }\n });\n _this.quill.on(_quill2.default.events.SCROLL_OPTIMIZE, function () {\n var _this$quill$selection = _this.quill.selection.getRange(),\n _this$quill$selection2 = _slicedToArray(_this$quill$selection, 1),\n range = _this$quill$selection2[0]; // quill.getSelection triggers update\n\n\n _this.update(range);\n });\n return _this;\n }\n\n _createClass(Toolbar, [{\n key: 'addHandler',\n value: function addHandler(format, handler) {\n this.handlers[format] = handler;\n }\n }, {\n key: 'attach',\n value: function attach(input) {\n var _this2 = this;\n\n var format = [].find.call(input.classList, function (className) {\n return className.indexOf('ql-') === 0;\n });\n if (!format) return;\n format = format.slice('ql-'.length);\n if (input.tagName === 'BUTTON') {\n input.setAttribute('type', 'button');\n }\n if (this.handlers[format] == null) {\n if (this.quill.scroll.whitelist != null && this.quill.scroll.whitelist[format] == null) {\n debug.warn('ignoring attaching to disabled format', format, input);\n return;\n }\n if (_parchment2.default.query(format) == null) {\n debug.warn('ignoring attaching to nonexistent format', format, input);\n return;\n }\n }\n var eventName = input.tagName === 'SELECT' ? 'change' : 'click';\n input.addEventListener(eventName, function (e) {\n var value = void 0;\n if (input.tagName === 'SELECT') {\n if (input.selectedIndex < 0) return;\n var selected = input.options[input.selectedIndex];\n if (selected.hasAttribute('selected')) {\n value = false;\n } else {\n value = selected.value || false;\n }\n } else {\n if (input.classList.contains('ql-active')) {\n value = false;\n } else {\n value = input.value || !input.hasAttribute('value');\n }\n e.preventDefault();\n }\n _this2.quill.focus();\n\n var _quill$selection$getR = _this2.quill.selection.getRange(),\n _quill$selection$getR2 = _slicedToArray(_quill$selection$getR, 1),\n range = _quill$selection$getR2[0];\n\n if (_this2.handlers[format] != null) {\n _this2.handlers[format].call(_this2, value);\n } else if (_parchment2.default.query(format).prototype instanceof _parchment2.default.Embed) {\n value = prompt('Enter ' + format);\n if (!value) return;\n _this2.quill.updateContents(new _quillDelta2.default().retain(range.index).delete(range.length).insert(_defineProperty({}, format, value)), _quill2.default.sources.USER);\n } else {\n _this2.quill.format(format, value, _quill2.default.sources.USER);\n }\n _this2.update(range);\n });\n // TODO use weakmap\n this.controls.push([format, input]);\n }\n }, {\n key: 'update',\n value: function update(range) {\n var formats = range == null ? {} : this.quill.getFormat(range);\n this.controls.forEach(function (pair) {\n var _pair = _slicedToArray(pair, 2),\n format = _pair[0],\n input = _pair[1];\n\n if (input.tagName === 'SELECT') {\n var option = void 0;\n if (range == null) {\n option = null;\n } else if (formats[format] == null) {\n option = input.querySelector('option[selected]');\n } else if (!Array.isArray(formats[format])) {\n var value = formats[format];\n if (typeof value === 'string') {\n value = value.replace(/\\\"/g, '\\\\\"');\n }\n option = input.querySelector('option[value=\"' + value + '\"]');\n }\n if (option == null) {\n input.value = ''; // TODO make configurable?\n input.selectedIndex = -1;\n } else {\n option.selected = true;\n }\n } else {\n if (range == null) {\n input.classList.remove('ql-active');\n } else if (input.hasAttribute('value')) {\n // both being null should match (default values)\n // '1' should match with 1 (headers)\n var isActive = formats[format] === input.getAttribute('value') || formats[format] != null && formats[format].toString() === input.getAttribute('value') || formats[format] == null && !input.getAttribute('value');\n input.classList.toggle('ql-active', isActive);\n } else {\n input.classList.toggle('ql-active', formats[format] != null);\n }\n }\n });\n }\n }]);\n\n return Toolbar;\n}(_module2.default);\n\nToolbar.DEFAULTS = {};\n\nfunction addButton(container, format, value) {\n var input = document.createElement('button');\n input.setAttribute('type', 'button');\n input.classList.add('ql-' + format);\n if (value != null) {\n input.value = value;\n }\n container.appendChild(input);\n}\n\nfunction addControls(container, groups) {\n if (!Array.isArray(groups[0])) {\n groups = [groups];\n }\n groups.forEach(function (controls) {\n var group = document.createElement('span');\n group.classList.add('ql-formats');\n controls.forEach(function (control) {\n if (typeof control === 'string') {\n addButton(group, control);\n } else {\n var format = Object.keys(control)[0];\n var value = control[format];\n if (Array.isArray(value)) {\n addSelect(group, format, value);\n } else {\n addButton(group, format, value);\n }\n }\n });\n container.appendChild(group);\n });\n}\n\nfunction addSelect(container, format, values) {\n var input = document.createElement('select');\n input.classList.add('ql-' + format);\n values.forEach(function (value) {\n var option = document.createElement('option');\n if (value !== false) {\n option.setAttribute('value', value);\n } else {\n option.setAttribute('selected', 'selected');\n }\n input.appendChild(option);\n });\n container.appendChild(input);\n}\n\nToolbar.DEFAULTS = {\n container: null,\n handlers: {\n clean: function clean() {\n var _this3 = this;\n\n var range = this.quill.getSelection();\n if (range == null) return;\n if (range.length == 0) {\n var formats = this.quill.getFormat();\n Object.keys(formats).forEach(function (name) {\n // Clean functionality in existing apps only clean inline formats\n if (_parchment2.default.query(name, _parchment2.default.Scope.INLINE) != null) {\n _this3.quill.format(name, false);\n }\n });\n } else {\n this.quill.removeFormat(range, _quill2.default.sources.USER);\n }\n },\n direction: function direction(value) {\n var align = this.quill.getFormat()['align'];\n if (value === 'rtl' && align == null) {\n this.quill.format('align', 'right', _quill2.default.sources.USER);\n } else if (!value && align === 'right') {\n this.quill.format('align', false, _quill2.default.sources.USER);\n }\n this.quill.format('direction', value, _quill2.default.sources.USER);\n },\n indent: function indent(value) {\n var range = this.quill.getSelection();\n var formats = this.quill.getFormat(range);\n var indent = parseInt(formats.indent || 0);\n if (value === '+1' || value === '-1') {\n var modifier = value === '+1' ? 1 : -1;\n if (formats.direction === 'rtl') modifier *= -1;\n this.quill.format('indent', indent + modifier, _quill2.default.sources.USER);\n }\n },\n link: function link(value) {\n if (value === true) {\n value = prompt('Enter link URL:');\n }\n this.quill.format('link', value, _quill2.default.sources.USER);\n },\n list: function list(value) {\n var range = this.quill.getSelection();\n var formats = this.quill.getFormat(range);\n if (value === 'check') {\n if (formats['list'] === 'checked' || formats['list'] === 'unchecked') {\n this.quill.format('list', false, _quill2.default.sources.USER);\n } else {\n this.quill.format('list', 'unchecked', _quill2.default.sources.USER);\n }\n } else {\n this.quill.format('list', value, _quill2.default.sources.USER);\n }\n }\n }\n};\n\nexports.default = Toolbar;\nexports.addControls = addControls;\n\n/***/ }),\n/* 58 */\n/***/ (function(module, exports) {\n\nmodule.exports = \" \";\n\n/***/ }),\n/* 59 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _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; }; }();\n\nvar _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if (\"value\" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };\n\nvar _picker = __webpack_require__(28);\n\nvar _picker2 = _interopRequireDefault(_picker);\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 _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nvar ColorPicker = function (_Picker) {\n _inherits(ColorPicker, _Picker);\n\n function ColorPicker(select, label) {\n _classCallCheck(this, ColorPicker);\n\n var _this = _possibleConstructorReturn(this, (ColorPicker.__proto__ || Object.getPrototypeOf(ColorPicker)).call(this, select));\n\n _this.label.innerHTML = label;\n _this.container.classList.add('ql-color-picker');\n [].slice.call(_this.container.querySelectorAll('.ql-picker-item'), 0, 7).forEach(function (item) {\n item.classList.add('ql-primary');\n });\n return _this;\n }\n\n _createClass(ColorPicker, [{\n key: 'buildItem',\n value: function buildItem(option) {\n var item = _get(ColorPicker.prototype.__proto__ || Object.getPrototypeOf(ColorPicker.prototype), 'buildItem', this).call(this, option);\n item.style.backgroundColor = option.getAttribute('value') || '';\n return item;\n }\n }, {\n key: 'selectItem',\n value: function selectItem(item, trigger) {\n _get(ColorPicker.prototype.__proto__ || Object.getPrototypeOf(ColorPicker.prototype), 'selectItem', this).call(this, item, trigger);\n var colorLabel = this.label.querySelector('.ql-color-label');\n var value = item ? item.getAttribute('data-value') || '' : '';\n if (colorLabel) {\n if (colorLabel.tagName === 'line') {\n colorLabel.style.stroke = value;\n } else {\n colorLabel.style.fill = value;\n }\n }\n }\n }]);\n\n return ColorPicker;\n}(_picker2.default);\n\nexports.default = ColorPicker;\n\n/***/ }),\n/* 60 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _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; }; }();\n\nvar _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if (\"value\" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };\n\nvar _picker = __webpack_require__(28);\n\nvar _picker2 = _interopRequireDefault(_picker);\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 _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nvar IconPicker = function (_Picker) {\n _inherits(IconPicker, _Picker);\n\n function IconPicker(select, icons) {\n _classCallCheck(this, IconPicker);\n\n var _this = _possibleConstructorReturn(this, (IconPicker.__proto__ || Object.getPrototypeOf(IconPicker)).call(this, select));\n\n _this.container.classList.add('ql-icon-picker');\n [].forEach.call(_this.container.querySelectorAll('.ql-picker-item'), function (item) {\n item.innerHTML = icons[item.getAttribute('data-value') || ''];\n });\n _this.defaultItem = _this.container.querySelector('.ql-selected');\n _this.selectItem(_this.defaultItem);\n return _this;\n }\n\n _createClass(IconPicker, [{\n key: 'selectItem',\n value: function selectItem(item, trigger) {\n _get(IconPicker.prototype.__proto__ || Object.getPrototypeOf(IconPicker.prototype), 'selectItem', this).call(this, item, trigger);\n item = item || this.defaultItem;\n this.label.innerHTML = item.innerHTML;\n }\n }]);\n\n return IconPicker;\n}(_picker2.default);\n\nexports.default = IconPicker;\n\n/***/ }),\n/* 61 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _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; }; }();\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nvar Tooltip = function () {\n function Tooltip(quill, boundsContainer) {\n var _this = this;\n\n _classCallCheck(this, Tooltip);\n\n this.quill = quill;\n this.boundsContainer = boundsContainer || document.body;\n this.root = quill.addContainer('ql-tooltip');\n this.root.innerHTML = this.constructor.TEMPLATE;\n if (this.quill.root === this.quill.scrollingContainer) {\n this.quill.root.addEventListener('scroll', function () {\n _this.root.style.marginTop = -1 * _this.quill.root.scrollTop + 'px';\n });\n }\n this.hide();\n }\n\n _createClass(Tooltip, [{\n key: 'hide',\n value: function hide() {\n this.root.classList.add('ql-hidden');\n }\n }, {\n key: 'position',\n value: function position(reference) {\n var left = reference.left + reference.width / 2 - this.root.offsetWidth / 2;\n // root.scrollTop should be 0 if scrollContainer !== root\n var top = reference.bottom + this.quill.root.scrollTop;\n this.root.style.left = left + 'px';\n this.root.style.top = top + 'px';\n this.root.classList.remove('ql-flip');\n var containerBounds = this.boundsContainer.getBoundingClientRect();\n var rootBounds = this.root.getBoundingClientRect();\n var shift = 0;\n if (rootBounds.right > containerBounds.right) {\n shift = containerBounds.right - rootBounds.right;\n this.root.style.left = left + shift + 'px';\n }\n if (rootBounds.left < containerBounds.left) {\n shift = containerBounds.left - rootBounds.left;\n this.root.style.left = left + shift + 'px';\n }\n if (rootBounds.bottom > containerBounds.bottom) {\n var height = rootBounds.bottom - rootBounds.top;\n var verticalShift = reference.bottom - reference.top + height;\n this.root.style.top = top - verticalShift + 'px';\n this.root.classList.add('ql-flip');\n }\n return shift;\n }\n }, {\n key: 'show',\n value: function show() {\n this.root.classList.remove('ql-editing');\n this.root.classList.remove('ql-hidden');\n }\n }]);\n\n return Tooltip;\n}();\n\nexports.default = Tooltip;\n\n/***/ }),\n/* 62 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_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\"]) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); } }; }();\n\nvar _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if (\"value\" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };\n\nvar _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; }; }();\n\nvar _extend = __webpack_require__(3);\n\nvar _extend2 = _interopRequireDefault(_extend);\n\nvar _emitter = __webpack_require__(8);\n\nvar _emitter2 = _interopRequireDefault(_emitter);\n\nvar _base = __webpack_require__(43);\n\nvar _base2 = _interopRequireDefault(_base);\n\nvar _link = __webpack_require__(27);\n\nvar _link2 = _interopRequireDefault(_link);\n\nvar _selection = __webpack_require__(15);\n\nvar _icons = __webpack_require__(41);\n\nvar _icons2 = _interopRequireDefault(_icons);\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 _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nvar TOOLBAR_CONFIG = [[{ header: ['1', '2', '3', false] }], ['bold', 'italic', 'underline', 'link'], [{ list: 'ordered' }, { list: 'bullet' }], ['clean']];\n\nvar SnowTheme = function (_BaseTheme) {\n _inherits(SnowTheme, _BaseTheme);\n\n function SnowTheme(quill, options) {\n _classCallCheck(this, SnowTheme);\n\n if (options.modules.toolbar != null && options.modules.toolbar.container == null) {\n options.modules.toolbar.container = TOOLBAR_CONFIG;\n }\n\n var _this = _possibleConstructorReturn(this, (SnowTheme.__proto__ || Object.getPrototypeOf(SnowTheme)).call(this, quill, options));\n\n _this.quill.container.classList.add('ql-snow');\n return _this;\n }\n\n _createClass(SnowTheme, [{\n key: 'extendToolbar',\n value: function extendToolbar(toolbar) {\n toolbar.container.classList.add('ql-snow');\n this.buildButtons([].slice.call(toolbar.container.querySelectorAll('button')), _icons2.default);\n this.buildPickers([].slice.call(toolbar.container.querySelectorAll('select')), _icons2.default);\n this.tooltip = new SnowTooltip(this.quill, this.options.bounds);\n if (toolbar.container.querySelector('.ql-link')) {\n this.quill.keyboard.addBinding({ key: 'K', shortKey: true }, function (range, context) {\n toolbar.handlers['link'].call(toolbar, !context.format.link);\n });\n }\n }\n }]);\n\n return SnowTheme;\n}(_base2.default);\n\nSnowTheme.DEFAULTS = (0, _extend2.default)(true, {}, _base2.default.DEFAULTS, {\n modules: {\n toolbar: {\n handlers: {\n link: function link(value) {\n if (value) {\n var range = this.quill.getSelection();\n if (range == null || range.length == 0) return;\n var preview = this.quill.getText(range);\n if (/^\\S+@\\S+\\.\\S+$/.test(preview) && preview.indexOf('mailto:') !== 0) {\n preview = 'mailto:' + preview;\n }\n var tooltip = this.quill.theme.tooltip;\n tooltip.edit('link', preview);\n } else {\n this.quill.format('link', false);\n }\n }\n }\n }\n }\n});\n\nvar SnowTooltip = function (_BaseTooltip) {\n _inherits(SnowTooltip, _BaseTooltip);\n\n function SnowTooltip(quill, bounds) {\n _classCallCheck(this, SnowTooltip);\n\n var _this2 = _possibleConstructorReturn(this, (SnowTooltip.__proto__ || Object.getPrototypeOf(SnowTooltip)).call(this, quill, bounds));\n\n _this2.preview = _this2.root.querySelector('a.ql-preview');\n return _this2;\n }\n\n _createClass(SnowTooltip, [{\n key: 'listen',\n value: function listen() {\n var _this3 = this;\n\n _get(SnowTooltip.prototype.__proto__ || Object.getPrototypeOf(SnowTooltip.prototype), 'listen', this).call(this);\n this.root.querySelector('a.ql-action').addEventListener('click', function (event) {\n if (_this3.root.classList.contains('ql-editing')) {\n _this3.save();\n } else {\n _this3.edit('link', _this3.preview.textContent);\n }\n event.preventDefault();\n });\n this.root.querySelector('a.ql-remove').addEventListener('click', function (event) {\n if (_this3.linkRange != null) {\n var range = _this3.linkRange;\n _this3.restoreFocus();\n _this3.quill.formatText(range, 'link', false, _emitter2.default.sources.USER);\n delete _this3.linkRange;\n }\n event.preventDefault();\n _this3.hide();\n });\n this.quill.on(_emitter2.default.events.SELECTION_CHANGE, function (range, oldRange, source) {\n if (range == null) return;\n if (range.length === 0 && source === _emitter2.default.sources.USER) {\n var _quill$scroll$descend = _this3.quill.scroll.descendant(_link2.default, range.index),\n _quill$scroll$descend2 = _slicedToArray(_quill$scroll$descend, 2),\n link = _quill$scroll$descend2[0],\n offset = _quill$scroll$descend2[1];\n\n if (link != null) {\n _this3.linkRange = new _selection.Range(range.index - offset, link.length());\n var preview = _link2.default.formats(link.domNode);\n _this3.preview.textContent = preview;\n _this3.preview.setAttribute('href', preview);\n _this3.show();\n _this3.position(_this3.quill.getBounds(_this3.linkRange));\n return;\n }\n } else {\n delete _this3.linkRange;\n }\n _this3.hide();\n });\n }\n }, {\n key: 'show',\n value: function show() {\n _get(SnowTooltip.prototype.__proto__ || Object.getPrototypeOf(SnowTooltip.prototype), 'show', this).call(this);\n this.root.removeAttribute('data-mode');\n }\n }]);\n\n return SnowTooltip;\n}(_base.BaseTooltip);\n\nSnowTooltip.TEMPLATE = ['', '', '', ''].join('');\n\nexports.default = SnowTheme;\n\n/***/ }),\n/* 63 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _core = __webpack_require__(29);\n\nvar _core2 = _interopRequireDefault(_core);\n\nvar _align = __webpack_require__(36);\n\nvar _direction = __webpack_require__(38);\n\nvar _indent = __webpack_require__(64);\n\nvar _blockquote = __webpack_require__(65);\n\nvar _blockquote2 = _interopRequireDefault(_blockquote);\n\nvar _header = __webpack_require__(66);\n\nvar _header2 = _interopRequireDefault(_header);\n\nvar _list = __webpack_require__(67);\n\nvar _list2 = _interopRequireDefault(_list);\n\nvar _background = __webpack_require__(37);\n\nvar _color = __webpack_require__(26);\n\nvar _font = __webpack_require__(39);\n\nvar _size = __webpack_require__(40);\n\nvar _bold = __webpack_require__(56);\n\nvar _bold2 = _interopRequireDefault(_bold);\n\nvar _italic = __webpack_require__(68);\n\nvar _italic2 = _interopRequireDefault(_italic);\n\nvar _link = __webpack_require__(27);\n\nvar _link2 = _interopRequireDefault(_link);\n\nvar _script = __webpack_require__(69);\n\nvar _script2 = _interopRequireDefault(_script);\n\nvar _strike = __webpack_require__(70);\n\nvar _strike2 = _interopRequireDefault(_strike);\n\nvar _underline = __webpack_require__(71);\n\nvar _underline2 = _interopRequireDefault(_underline);\n\nvar _image = __webpack_require__(72);\n\nvar _image2 = _interopRequireDefault(_image);\n\nvar _video = __webpack_require__(73);\n\nvar _video2 = _interopRequireDefault(_video);\n\nvar _code = __webpack_require__(13);\n\nvar _code2 = _interopRequireDefault(_code);\n\nvar _formula = __webpack_require__(74);\n\nvar _formula2 = _interopRequireDefault(_formula);\n\nvar _syntax = __webpack_require__(75);\n\nvar _syntax2 = _interopRequireDefault(_syntax);\n\nvar _toolbar = __webpack_require__(57);\n\nvar _toolbar2 = _interopRequireDefault(_toolbar);\n\nvar _icons = __webpack_require__(41);\n\nvar _icons2 = _interopRequireDefault(_icons);\n\nvar _picker = __webpack_require__(28);\n\nvar _picker2 = _interopRequireDefault(_picker);\n\nvar _colorPicker = __webpack_require__(59);\n\nvar _colorPicker2 = _interopRequireDefault(_colorPicker);\n\nvar _iconPicker = __webpack_require__(60);\n\nvar _iconPicker2 = _interopRequireDefault(_iconPicker);\n\nvar _tooltip = __webpack_require__(61);\n\nvar _tooltip2 = _interopRequireDefault(_tooltip);\n\nvar _bubble = __webpack_require__(108);\n\nvar _bubble2 = _interopRequireDefault(_bubble);\n\nvar _snow = __webpack_require__(62);\n\nvar _snow2 = _interopRequireDefault(_snow);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n_core2.default.register({\n 'attributors/attribute/direction': _direction.DirectionAttribute,\n\n 'attributors/class/align': _align.AlignClass,\n 'attributors/class/background': _background.BackgroundClass,\n 'attributors/class/color': _color.ColorClass,\n 'attributors/class/direction': _direction.DirectionClass,\n 'attributors/class/font': _font.FontClass,\n 'attributors/class/size': _size.SizeClass,\n\n 'attributors/style/align': _align.AlignStyle,\n 'attributors/style/background': _background.BackgroundStyle,\n 'attributors/style/color': _color.ColorStyle,\n 'attributors/style/direction': _direction.DirectionStyle,\n 'attributors/style/font': _font.FontStyle,\n 'attributors/style/size': _size.SizeStyle\n}, true);\n\n_core2.default.register({\n 'formats/align': _align.AlignClass,\n 'formats/direction': _direction.DirectionClass,\n 'formats/indent': _indent.IndentClass,\n\n 'formats/background': _background.BackgroundStyle,\n 'formats/color': _color.ColorStyle,\n 'formats/font': _font.FontClass,\n 'formats/size': _size.SizeClass,\n\n 'formats/blockquote': _blockquote2.default,\n 'formats/code-block': _code2.default,\n 'formats/header': _header2.default,\n 'formats/list': _list2.default,\n\n 'formats/bold': _bold2.default,\n 'formats/code': _code.Code,\n 'formats/italic': _italic2.default,\n 'formats/link': _link2.default,\n 'formats/script': _script2.default,\n 'formats/strike': _strike2.default,\n 'formats/underline': _underline2.default,\n\n 'formats/image': _image2.default,\n 'formats/video': _video2.default,\n\n 'formats/list/item': _list.ListItem,\n\n 'modules/formula': _formula2.default,\n 'modules/syntax': _syntax2.default,\n 'modules/toolbar': _toolbar2.default,\n\n 'themes/bubble': _bubble2.default,\n 'themes/snow': _snow2.default,\n\n 'ui/icons': _icons2.default,\n 'ui/picker': _picker2.default,\n 'ui/icon-picker': _iconPicker2.default,\n 'ui/color-picker': _colorPicker2.default,\n 'ui/tooltip': _tooltip2.default\n}, true);\n\nexports.default = _core2.default;\n\n/***/ }),\n/* 64 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.IndentClass = undefined;\n\nvar _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; }; }();\n\nvar _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if (\"value\" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };\n\nvar _parchment = __webpack_require__(0);\n\nvar _parchment2 = _interopRequireDefault(_parchment);\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 _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nvar IdentAttributor = function (_Parchment$Attributor) {\n _inherits(IdentAttributor, _Parchment$Attributor);\n\n function IdentAttributor() {\n _classCallCheck(this, IdentAttributor);\n\n return _possibleConstructorReturn(this, (IdentAttributor.__proto__ || Object.getPrototypeOf(IdentAttributor)).apply(this, arguments));\n }\n\n _createClass(IdentAttributor, [{\n key: 'add',\n value: function add(node, value) {\n if (value === '+1' || value === '-1') {\n var indent = this.value(node) || 0;\n value = value === '+1' ? indent + 1 : indent - 1;\n }\n if (value === 0) {\n this.remove(node);\n return true;\n } else {\n return _get(IdentAttributor.prototype.__proto__ || Object.getPrototypeOf(IdentAttributor.prototype), 'add', this).call(this, node, value);\n }\n }\n }, {\n key: 'canAdd',\n value: function canAdd(node, value) {\n return _get(IdentAttributor.prototype.__proto__ || Object.getPrototypeOf(IdentAttributor.prototype), 'canAdd', this).call(this, node, value) || _get(IdentAttributor.prototype.__proto__ || Object.getPrototypeOf(IdentAttributor.prototype), 'canAdd', this).call(this, node, parseInt(value));\n }\n }, {\n key: 'value',\n value: function value(node) {\n return parseInt(_get(IdentAttributor.prototype.__proto__ || Object.getPrototypeOf(IdentAttributor.prototype), 'value', this).call(this, node)) || undefined; // Don't return NaN\n }\n }]);\n\n return IdentAttributor;\n}(_parchment2.default.Attributor.Class);\n\nvar IndentClass = new IdentAttributor('indent', 'ql-indent', {\n scope: _parchment2.default.Scope.BLOCK,\n whitelist: [1, 2, 3, 4, 5, 6, 7, 8]\n});\n\nexports.IndentClass = IndentClass;\n\n/***/ }),\n/* 65 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _block = __webpack_require__(4);\n\nvar _block2 = _interopRequireDefault(_block);\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 _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nvar Blockquote = function (_Block) {\n _inherits(Blockquote, _Block);\n\n function Blockquote() {\n _classCallCheck(this, Blockquote);\n\n return _possibleConstructorReturn(this, (Blockquote.__proto__ || Object.getPrototypeOf(Blockquote)).apply(this, arguments));\n }\n\n return Blockquote;\n}(_block2.default);\n\nBlockquote.blotName = 'blockquote';\nBlockquote.tagName = 'blockquote';\n\nexports.default = Blockquote;\n\n/***/ }),\n/* 66 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _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; }; }();\n\nvar _block = __webpack_require__(4);\n\nvar _block2 = _interopRequireDefault(_block);\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 _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nvar Header = function (_Block) {\n _inherits(Header, _Block);\n\n function Header() {\n _classCallCheck(this, Header);\n\n return _possibleConstructorReturn(this, (Header.__proto__ || Object.getPrototypeOf(Header)).apply(this, arguments));\n }\n\n _createClass(Header, null, [{\n key: 'formats',\n value: function formats(domNode) {\n return this.tagName.indexOf(domNode.tagName) + 1;\n }\n }]);\n\n return Header;\n}(_block2.default);\n\nHeader.blotName = 'header';\nHeader.tagName = ['H1', 'H2', 'H3', 'H4', 'H5', 'H6'];\n\nexports.default = Header;\n\n/***/ }),\n/* 67 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = exports.ListItem = undefined;\n\nvar _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; }; }();\n\nvar _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if (\"value\" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };\n\nvar _parchment = __webpack_require__(0);\n\nvar _parchment2 = _interopRequireDefault(_parchment);\n\nvar _block = __webpack_require__(4);\n\nvar _block2 = _interopRequireDefault(_block);\n\nvar _container = __webpack_require__(25);\n\nvar _container2 = _interopRequireDefault(_container);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\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 _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nvar ListItem = function (_Block) {\n _inherits(ListItem, _Block);\n\n function ListItem() {\n _classCallCheck(this, ListItem);\n\n return _possibleConstructorReturn(this, (ListItem.__proto__ || Object.getPrototypeOf(ListItem)).apply(this, arguments));\n }\n\n _createClass(ListItem, [{\n key: 'format',\n value: function format(name, value) {\n if (name === List.blotName && !value) {\n this.replaceWith(_parchment2.default.create(this.statics.scope));\n } else {\n _get(ListItem.prototype.__proto__ || Object.getPrototypeOf(ListItem.prototype), 'format', this).call(this, name, value);\n }\n }\n }, {\n key: 'remove',\n value: function remove() {\n if (this.prev == null && this.next == null) {\n this.parent.remove();\n } else {\n _get(ListItem.prototype.__proto__ || Object.getPrototypeOf(ListItem.prototype), 'remove', this).call(this);\n }\n }\n }, {\n key: 'replaceWith',\n value: function replaceWith(name, value) {\n this.parent.isolate(this.offset(this.parent), this.length());\n if (name === this.parent.statics.blotName) {\n this.parent.replaceWith(name, value);\n return this;\n } else {\n this.parent.unwrap();\n return _get(ListItem.prototype.__proto__ || Object.getPrototypeOf(ListItem.prototype), 'replaceWith', this).call(this, name, value);\n }\n }\n }], [{\n key: 'formats',\n value: function formats(domNode) {\n return domNode.tagName === this.tagName ? undefined : _get(ListItem.__proto__ || Object.getPrototypeOf(ListItem), 'formats', this).call(this, domNode);\n }\n }]);\n\n return ListItem;\n}(_block2.default);\n\nListItem.blotName = 'list-item';\nListItem.tagName = 'LI';\n\nvar List = function (_Container) {\n _inherits(List, _Container);\n\n _createClass(List, null, [{\n key: 'create',\n value: function create(value) {\n var tagName = value === 'ordered' ? 'OL' : 'UL';\n var node = _get(List.__proto__ || Object.getPrototypeOf(List), 'create', this).call(this, tagName);\n if (value === 'checked' || value === 'unchecked') {\n node.setAttribute('data-checked', value === 'checked');\n }\n return node;\n }\n }, {\n key: 'formats',\n value: function formats(domNode) {\n if (domNode.tagName === 'OL') return 'ordered';\n if (domNode.tagName === 'UL') {\n if (domNode.hasAttribute('data-checked')) {\n return domNode.getAttribute('data-checked') === 'true' ? 'checked' : 'unchecked';\n } else {\n return 'bullet';\n }\n }\n return undefined;\n }\n }]);\n\n function List(domNode) {\n _classCallCheck(this, List);\n\n var _this2 = _possibleConstructorReturn(this, (List.__proto__ || Object.getPrototypeOf(List)).call(this, domNode));\n\n var listEventHandler = function listEventHandler(e) {\n if (e.target.parentNode !== domNode) return;\n var format = _this2.statics.formats(domNode);\n var blot = _parchment2.default.find(e.target);\n if (format === 'checked') {\n blot.format('list', 'unchecked');\n } else if (format === 'unchecked') {\n blot.format('list', 'checked');\n }\n };\n\n domNode.addEventListener('touchstart', listEventHandler);\n domNode.addEventListener('mousedown', listEventHandler);\n return _this2;\n }\n\n _createClass(List, [{\n key: 'format',\n value: function format(name, value) {\n if (this.children.length > 0) {\n this.children.tail.format(name, value);\n }\n }\n }, {\n key: 'formats',\n value: function formats() {\n // We don't inherit from FormatBlot\n return _defineProperty({}, this.statics.blotName, this.statics.formats(this.domNode));\n }\n }, {\n key: 'insertBefore',\n value: function insertBefore(blot, ref) {\n if (blot instanceof ListItem) {\n _get(List.prototype.__proto__ || Object.getPrototypeOf(List.prototype), 'insertBefore', this).call(this, blot, ref);\n } else {\n var index = ref == null ? this.length() : ref.offset(this);\n var after = this.split(index);\n after.parent.insertBefore(blot, after);\n }\n }\n }, {\n key: 'optimize',\n value: function optimize(context) {\n _get(List.prototype.__proto__ || Object.getPrototypeOf(List.prototype), 'optimize', this).call(this, context);\n var next = this.next;\n if (next != null && next.prev === this && next.statics.blotName === this.statics.blotName && next.domNode.tagName === this.domNode.tagName && next.domNode.getAttribute('data-checked') === this.domNode.getAttribute('data-checked')) {\n next.moveChildren(this);\n next.remove();\n }\n }\n }, {\n key: 'replace',\n value: function replace(target) {\n if (target.statics.blotName !== this.statics.blotName) {\n var item = _parchment2.default.create(this.statics.defaultChild);\n target.moveChildren(item);\n this.appendChild(item);\n }\n _get(List.prototype.__proto__ || Object.getPrototypeOf(List.prototype), 'replace', this).call(this, target);\n }\n }]);\n\n return List;\n}(_container2.default);\n\nList.blotName = 'list';\nList.scope = _parchment2.default.Scope.BLOCK_BLOT;\nList.tagName = ['OL', 'UL'];\nList.defaultChild = 'list-item';\nList.allowedChildren = [ListItem];\n\nexports.ListItem = ListItem;\nexports.default = List;\n\n/***/ }),\n/* 68 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _bold = __webpack_require__(56);\n\nvar _bold2 = _interopRequireDefault(_bold);\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 _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nvar Italic = function (_Bold) {\n _inherits(Italic, _Bold);\n\n function Italic() {\n _classCallCheck(this, Italic);\n\n return _possibleConstructorReturn(this, (Italic.__proto__ || Object.getPrototypeOf(Italic)).apply(this, arguments));\n }\n\n return Italic;\n}(_bold2.default);\n\nItalic.blotName = 'italic';\nItalic.tagName = ['EM', 'I'];\n\nexports.default = Italic;\n\n/***/ }),\n/* 69 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _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; }; }();\n\nvar _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if (\"value\" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };\n\nvar _inline = __webpack_require__(6);\n\nvar _inline2 = _interopRequireDefault(_inline);\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 _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nvar Script = function (_Inline) {\n _inherits(Script, _Inline);\n\n function Script() {\n _classCallCheck(this, Script);\n\n return _possibleConstructorReturn(this, (Script.__proto__ || Object.getPrototypeOf(Script)).apply(this, arguments));\n }\n\n _createClass(Script, null, [{\n key: 'create',\n value: function create(value) {\n if (value === 'super') {\n return document.createElement('sup');\n } else if (value === 'sub') {\n return document.createElement('sub');\n } else {\n return _get(Script.__proto__ || Object.getPrototypeOf(Script), 'create', this).call(this, value);\n }\n }\n }, {\n key: 'formats',\n value: function formats(domNode) {\n if (domNode.tagName === 'SUB') return 'sub';\n if (domNode.tagName === 'SUP') return 'super';\n return undefined;\n }\n }]);\n\n return Script;\n}(_inline2.default);\n\nScript.blotName = 'script';\nScript.tagName = ['SUB', 'SUP'];\n\nexports.default = Script;\n\n/***/ }),\n/* 70 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _inline = __webpack_require__(6);\n\nvar _inline2 = _interopRequireDefault(_inline);\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 _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nvar Strike = function (_Inline) {\n _inherits(Strike, _Inline);\n\n function Strike() {\n _classCallCheck(this, Strike);\n\n return _possibleConstructorReturn(this, (Strike.__proto__ || Object.getPrototypeOf(Strike)).apply(this, arguments));\n }\n\n return Strike;\n}(_inline2.default);\n\nStrike.blotName = 'strike';\nStrike.tagName = 'S';\n\nexports.default = Strike;\n\n/***/ }),\n/* 71 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _inline = __webpack_require__(6);\n\nvar _inline2 = _interopRequireDefault(_inline);\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 _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nvar Underline = function (_Inline) {\n _inherits(Underline, _Inline);\n\n function Underline() {\n _classCallCheck(this, Underline);\n\n return _possibleConstructorReturn(this, (Underline.__proto__ || Object.getPrototypeOf(Underline)).apply(this, arguments));\n }\n\n return Underline;\n}(_inline2.default);\n\nUnderline.blotName = 'underline';\nUnderline.tagName = 'U';\n\nexports.default = Underline;\n\n/***/ }),\n/* 72 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _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; }; }();\n\nvar _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if (\"value\" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };\n\nvar _parchment = __webpack_require__(0);\n\nvar _parchment2 = _interopRequireDefault(_parchment);\n\nvar _link = __webpack_require__(27);\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 _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nvar ATTRIBUTES = ['alt', 'height', 'width'];\n\nvar Image = function (_Parchment$Embed) {\n _inherits(Image, _Parchment$Embed);\n\n function Image() {\n _classCallCheck(this, Image);\n\n return _possibleConstructorReturn(this, (Image.__proto__ || Object.getPrototypeOf(Image)).apply(this, arguments));\n }\n\n _createClass(Image, [{\n key: 'format',\n value: function format(name, value) {\n if (ATTRIBUTES.indexOf(name) > -1) {\n if (value) {\n this.domNode.setAttribute(name, value);\n } else {\n this.domNode.removeAttribute(name);\n }\n } else {\n _get(Image.prototype.__proto__ || Object.getPrototypeOf(Image.prototype), 'format', this).call(this, name, value);\n }\n }\n }], [{\n key: 'create',\n value: function create(value) {\n var node = _get(Image.__proto__ || Object.getPrototypeOf(Image), 'create', this).call(this, value);\n if (typeof value === 'string') {\n node.setAttribute('src', this.sanitize(value));\n }\n return node;\n }\n }, {\n key: 'formats',\n value: function formats(domNode) {\n return ATTRIBUTES.reduce(function (formats, attribute) {\n if (domNode.hasAttribute(attribute)) {\n formats[attribute] = domNode.getAttribute(attribute);\n }\n return formats;\n }, {});\n }\n }, {\n key: 'match',\n value: function match(url) {\n return (/\\.(jpe?g|gif|png)$/.test(url) || /^data:image\\/.+;base64/.test(url)\n );\n }\n }, {\n key: 'sanitize',\n value: function sanitize(url) {\n return (0, _link.sanitize)(url, ['http', 'https', 'data']) ? url : '//:0';\n }\n }, {\n key: 'value',\n value: function value(domNode) {\n return domNode.getAttribute('src');\n }\n }]);\n\n return Image;\n}(_parchment2.default.Embed);\n\nImage.blotName = 'image';\nImage.tagName = 'IMG';\n\nexports.default = Image;\n\n/***/ }),\n/* 73 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _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; }; }();\n\nvar _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if (\"value\" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };\n\nvar _block = __webpack_require__(4);\n\nvar _link = __webpack_require__(27);\n\nvar _link2 = _interopRequireDefault(_link);\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 _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nvar ATTRIBUTES = ['height', 'width'];\n\nvar Video = function (_BlockEmbed) {\n _inherits(Video, _BlockEmbed);\n\n function Video() {\n _classCallCheck(this, Video);\n\n return _possibleConstructorReturn(this, (Video.__proto__ || Object.getPrototypeOf(Video)).apply(this, arguments));\n }\n\n _createClass(Video, [{\n key: 'format',\n value: function format(name, value) {\n if (ATTRIBUTES.indexOf(name) > -1) {\n if (value) {\n this.domNode.setAttribute(name, value);\n } else {\n this.domNode.removeAttribute(name);\n }\n } else {\n _get(Video.prototype.__proto__ || Object.getPrototypeOf(Video.prototype), 'format', this).call(this, name, value);\n }\n }\n }], [{\n key: 'create',\n value: function create(value) {\n var node = _get(Video.__proto__ || Object.getPrototypeOf(Video), 'create', this).call(this, value);\n node.setAttribute('frameborder', '0');\n node.setAttribute('allowfullscreen', true);\n node.setAttribute('src', this.sanitize(value));\n return node;\n }\n }, {\n key: 'formats',\n value: function formats(domNode) {\n return ATTRIBUTES.reduce(function (formats, attribute) {\n if (domNode.hasAttribute(attribute)) {\n formats[attribute] = domNode.getAttribute(attribute);\n }\n return formats;\n }, {});\n }\n }, {\n key: 'sanitize',\n value: function sanitize(url) {\n return _link2.default.sanitize(url);\n }\n }, {\n key: 'value',\n value: function value(domNode) {\n return domNode.getAttribute('src');\n }\n }]);\n\n return Video;\n}(_block.BlockEmbed);\n\nVideo.blotName = 'video';\nVideo.className = 'ql-video';\nVideo.tagName = 'IFRAME';\n\nexports.default = Video;\n\n/***/ }),\n/* 74 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = exports.FormulaBlot = undefined;\n\nvar _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; }; }();\n\nvar _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if (\"value\" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };\n\nvar _embed = __webpack_require__(35);\n\nvar _embed2 = _interopRequireDefault(_embed);\n\nvar _quill = __webpack_require__(5);\n\nvar _quill2 = _interopRequireDefault(_quill);\n\nvar _module = __webpack_require__(9);\n\nvar _module2 = _interopRequireDefault(_module);\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 _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nvar FormulaBlot = function (_Embed) {\n _inherits(FormulaBlot, _Embed);\n\n function FormulaBlot() {\n _classCallCheck(this, FormulaBlot);\n\n return _possibleConstructorReturn(this, (FormulaBlot.__proto__ || Object.getPrototypeOf(FormulaBlot)).apply(this, arguments));\n }\n\n _createClass(FormulaBlot, null, [{\n key: 'create',\n value: function create(value) {\n var node = _get(FormulaBlot.__proto__ || Object.getPrototypeOf(FormulaBlot), 'create', this).call(this, value);\n if (typeof value === 'string') {\n window.katex.render(value, node, {\n throwOnError: false,\n errorColor: '#f00'\n });\n node.setAttribute('data-value', value);\n }\n return node;\n }\n }, {\n key: 'value',\n value: function value(domNode) {\n return domNode.getAttribute('data-value');\n }\n }]);\n\n return FormulaBlot;\n}(_embed2.default);\n\nFormulaBlot.blotName = 'formula';\nFormulaBlot.className = 'ql-formula';\nFormulaBlot.tagName = 'SPAN';\n\nvar Formula = function (_Module) {\n _inherits(Formula, _Module);\n\n _createClass(Formula, null, [{\n key: 'register',\n value: function register() {\n _quill2.default.register(FormulaBlot, true);\n }\n }]);\n\n function Formula() {\n _classCallCheck(this, Formula);\n\n var _this2 = _possibleConstructorReturn(this, (Formula.__proto__ || Object.getPrototypeOf(Formula)).call(this));\n\n if (window.katex == null) {\n throw new Error('Formula module requires KaTeX.');\n }\n return _this2;\n }\n\n return Formula;\n}(_module2.default);\n\nexports.FormulaBlot = FormulaBlot;\nexports.default = Formula;\n\n/***/ }),\n/* 75 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = exports.CodeToken = exports.CodeBlock = undefined;\n\nvar _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; }; }();\n\nvar _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if (\"value\" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };\n\nvar _parchment = __webpack_require__(0);\n\nvar _parchment2 = _interopRequireDefault(_parchment);\n\nvar _quill = __webpack_require__(5);\n\nvar _quill2 = _interopRequireDefault(_quill);\n\nvar _module = __webpack_require__(9);\n\nvar _module2 = _interopRequireDefault(_module);\n\nvar _code = __webpack_require__(13);\n\nvar _code2 = _interopRequireDefault(_code);\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 _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nvar SyntaxCodeBlock = function (_CodeBlock) {\n _inherits(SyntaxCodeBlock, _CodeBlock);\n\n function SyntaxCodeBlock() {\n _classCallCheck(this, SyntaxCodeBlock);\n\n return _possibleConstructorReturn(this, (SyntaxCodeBlock.__proto__ || Object.getPrototypeOf(SyntaxCodeBlock)).apply(this, arguments));\n }\n\n _createClass(SyntaxCodeBlock, [{\n key: 'replaceWith',\n value: function replaceWith(block) {\n this.domNode.textContent = this.domNode.textContent;\n this.attach();\n _get(SyntaxCodeBlock.prototype.__proto__ || Object.getPrototypeOf(SyntaxCodeBlock.prototype), 'replaceWith', this).call(this, block);\n }\n }, {\n key: 'highlight',\n value: function highlight(_highlight) {\n var text = this.domNode.textContent;\n if (this.cachedText !== text) {\n if (text.trim().length > 0 || this.cachedText == null) {\n this.domNode.innerHTML = _highlight(text);\n this.domNode.normalize();\n this.attach();\n }\n this.cachedText = text;\n }\n }\n }]);\n\n return SyntaxCodeBlock;\n}(_code2.default);\n\nSyntaxCodeBlock.className = 'ql-syntax';\n\nvar CodeToken = new _parchment2.default.Attributor.Class('token', 'hljs', {\n scope: _parchment2.default.Scope.INLINE\n});\n\nvar Syntax = function (_Module) {\n _inherits(Syntax, _Module);\n\n _createClass(Syntax, null, [{\n key: 'register',\n value: function register() {\n _quill2.default.register(CodeToken, true);\n _quill2.default.register(SyntaxCodeBlock, true);\n }\n }]);\n\n function Syntax(quill, options) {\n _classCallCheck(this, Syntax);\n\n var _this2 = _possibleConstructorReturn(this, (Syntax.__proto__ || Object.getPrototypeOf(Syntax)).call(this, quill, options));\n\n if (typeof _this2.options.highlight !== 'function') {\n throw new Error('Syntax module requires highlight.js. Please include the library on the page before Quill.');\n }\n var timer = null;\n _this2.quill.on(_quill2.default.events.SCROLL_OPTIMIZE, function () {\n clearTimeout(timer);\n timer = setTimeout(function () {\n _this2.highlight();\n timer = null;\n }, _this2.options.interval);\n });\n _this2.highlight();\n return _this2;\n }\n\n _createClass(Syntax, [{\n key: 'highlight',\n value: function highlight() {\n var _this3 = this;\n\n if (this.quill.selection.composing) return;\n this.quill.update(_quill2.default.sources.USER);\n var range = this.quill.getSelection();\n this.quill.scroll.descendants(SyntaxCodeBlock).forEach(function (code) {\n code.highlight(_this3.options.highlight);\n });\n this.quill.update(_quill2.default.sources.SILENT);\n if (range != null) {\n this.quill.setSelection(range, _quill2.default.sources.SILENT);\n }\n }\n }]);\n\n return Syntax;\n}(_module2.default);\n\nSyntax.DEFAULTS = {\n highlight: function () {\n if (window.hljs == null) return null;\n return function (text) {\n var result = window.hljs.highlightAuto(text);\n return result.value;\n };\n }(),\n interval: 1000\n};\n\nexports.CodeBlock = SyntaxCodeBlock;\nexports.CodeToken = CodeToken;\nexports.default = Syntax;\n\n/***/ }),\n/* 76 */\n/***/ (function(module, exports) {\n\nmodule.exports = \" \";\n\n/***/ }),\n/* 77 */\n/***/ (function(module, exports) {\n\nmodule.exports = \" \";\n\n/***/ }),\n/* 78 */\n/***/ (function(module, exports) {\n\nmodule.exports = \" \";\n\n/***/ }),\n/* 79 */\n/***/ (function(module, exports) {\n\nmodule.exports = \" \";\n\n/***/ }),\n/* 80 */\n/***/ (function(module, exports) {\n\nmodule.exports = \" \";\n\n/***/ }),\n/* 81 */\n/***/ (function(module, exports) {\n\nmodule.exports = \" \";\n\n/***/ }),\n/* 82 */\n/***/ (function(module, exports) {\n\nmodule.exports = \" \";\n\n/***/ }),\n/* 83 */\n/***/ (function(module, exports) {\n\nmodule.exports = \" \";\n\n/***/ }),\n/* 84 */\n/***/ (function(module, exports) {\n\nmodule.exports = \" \";\n\n/***/ }),\n/* 85 */\n/***/ (function(module, exports) {\n\nmodule.exports = \" \";\n\n/***/ }),\n/* 86 */\n/***/ (function(module, exports) {\n\nmodule.exports = \" \";\n\n/***/ }),\n/* 87 */\n/***/ (function(module, exports) {\n\nmodule.exports = \" \";\n\n/***/ }),\n/* 88 */\n/***/ (function(module, exports) {\n\nmodule.exports = \" \";\n\n/***/ }),\n/* 89 */\n/***/ (function(module, exports) {\n\nmodule.exports = \" \";\n\n/***/ }),\n/* 90 */\n/***/ (function(module, exports) {\n\nmodule.exports = \" \";\n\n/***/ }),\n/* 91 */\n/***/ (function(module, exports) {\n\nmodule.exports = \" \";\n\n/***/ }),\n/* 92 */\n/***/ (function(module, exports) {\n\nmodule.exports = \" \";\n\n/***/ }),\n/* 93 */\n/***/ (function(module, exports) {\n\nmodule.exports = \" \";\n\n/***/ }),\n/* 94 */\n/***/ (function(module, exports) {\n\nmodule.exports = \" \";\n\n/***/ }),\n/* 95 */\n/***/ (function(module, exports) {\n\nmodule.exports = \" \";\n\n/***/ }),\n/* 96 */\n/***/ (function(module, exports) {\n\nmodule.exports = \" \";\n\n/***/ }),\n/* 97 */\n/***/ (function(module, exports) {\n\nmodule.exports = \" \";\n\n/***/ }),\n/* 98 */\n/***/ (function(module, exports) {\n\nmodule.exports = \" \";\n\n/***/ }),\n/* 99 */\n/***/ (function(module, exports) {\n\nmodule.exports = \" \";\n\n/***/ }),\n/* 100 */\n/***/ (function(module, exports) {\n\nmodule.exports = \" \";\n\n/***/ }),\n/* 101 */\n/***/ (function(module, exports) {\n\nmodule.exports = \" \";\n\n/***/ }),\n/* 102 */\n/***/ (function(module, exports) {\n\nmodule.exports = \" \";\n\n/***/ }),\n/* 103 */\n/***/ (function(module, exports) {\n\nmodule.exports = \" \";\n\n/***/ }),\n/* 104 */\n/***/ (function(module, exports) {\n\nmodule.exports = \" \";\n\n/***/ }),\n/* 105 */\n/***/ (function(module, exports) {\n\nmodule.exports = \" \";\n\n/***/ }),\n/* 106 */\n/***/ (function(module, exports) {\n\nmodule.exports = \" \";\n\n/***/ }),\n/* 107 */\n/***/ (function(module, exports) {\n\nmodule.exports = \" \";\n\n/***/ }),\n/* 108 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = exports.BubbleTooltip = undefined;\n\nvar _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if (\"value\" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };\n\nvar _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; }; }();\n\nvar _extend = __webpack_require__(3);\n\nvar _extend2 = _interopRequireDefault(_extend);\n\nvar _emitter = __webpack_require__(8);\n\nvar _emitter2 = _interopRequireDefault(_emitter);\n\nvar _base = __webpack_require__(43);\n\nvar _base2 = _interopRequireDefault(_base);\n\nvar _selection = __webpack_require__(15);\n\nvar _icons = __webpack_require__(41);\n\nvar _icons2 = _interopRequireDefault(_icons);\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 _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nvar TOOLBAR_CONFIG = [['bold', 'italic', 'link'], [{ header: 1 }, { header: 2 }, 'blockquote']];\n\nvar BubbleTheme = function (_BaseTheme) {\n _inherits(BubbleTheme, _BaseTheme);\n\n function BubbleTheme(quill, options) {\n _classCallCheck(this, BubbleTheme);\n\n if (options.modules.toolbar != null && options.modules.toolbar.container == null) {\n options.modules.toolbar.container = TOOLBAR_CONFIG;\n }\n\n var _this = _possibleConstructorReturn(this, (BubbleTheme.__proto__ || Object.getPrototypeOf(BubbleTheme)).call(this, quill, options));\n\n _this.quill.container.classList.add('ql-bubble');\n return _this;\n }\n\n _createClass(BubbleTheme, [{\n key: 'extendToolbar',\n value: function extendToolbar(toolbar) {\n this.tooltip = new BubbleTooltip(this.quill, this.options.bounds);\n this.tooltip.root.appendChild(toolbar.container);\n this.buildButtons([].slice.call(toolbar.container.querySelectorAll('button')), _icons2.default);\n this.buildPickers([].slice.call(toolbar.container.querySelectorAll('select')), _icons2.default);\n }\n }]);\n\n return BubbleTheme;\n}(_base2.default);\n\nBubbleTheme.DEFAULTS = (0, _extend2.default)(true, {}, _base2.default.DEFAULTS, {\n modules: {\n toolbar: {\n handlers: {\n link: function link(value) {\n if (!value) {\n this.quill.format('link', false);\n } else {\n this.quill.theme.tooltip.edit();\n }\n }\n }\n }\n }\n});\n\nvar BubbleTooltip = function (_BaseTooltip) {\n _inherits(BubbleTooltip, _BaseTooltip);\n\n function BubbleTooltip(quill, bounds) {\n _classCallCheck(this, BubbleTooltip);\n\n var _this2 = _possibleConstructorReturn(this, (BubbleTooltip.__proto__ || Object.getPrototypeOf(BubbleTooltip)).call(this, quill, bounds));\n\n _this2.quill.on(_emitter2.default.events.EDITOR_CHANGE, function (type, range, oldRange, source) {\n if (type !== _emitter2.default.events.SELECTION_CHANGE) return;\n if (range != null && range.length > 0 && source === _emitter2.default.sources.USER) {\n _this2.show();\n // Lock our width so we will expand beyond our offsetParent boundaries\n _this2.root.style.left = '0px';\n _this2.root.style.width = '';\n _this2.root.style.width = _this2.root.offsetWidth + 'px';\n var lines = _this2.quill.getLines(range.index, range.length);\n if (lines.length === 1) {\n _this2.position(_this2.quill.getBounds(range));\n } else {\n var lastLine = lines[lines.length - 1];\n var index = _this2.quill.getIndex(lastLine);\n var length = Math.min(lastLine.length() - 1, range.index + range.length - index);\n var _bounds = _this2.quill.getBounds(new _selection.Range(index, length));\n _this2.position(_bounds);\n }\n } else if (document.activeElement !== _this2.textbox && _this2.quill.hasFocus()) {\n _this2.hide();\n }\n });\n return _this2;\n }\n\n _createClass(BubbleTooltip, [{\n key: 'listen',\n value: function listen() {\n var _this3 = this;\n\n _get(BubbleTooltip.prototype.__proto__ || Object.getPrototypeOf(BubbleTooltip.prototype), 'listen', this).call(this);\n this.root.querySelector('.ql-close').addEventListener('click', function () {\n _this3.root.classList.remove('ql-editing');\n });\n this.quill.on(_emitter2.default.events.SCROLL_OPTIMIZE, function () {\n // Let selection be restored by toolbar handlers before repositioning\n setTimeout(function () {\n if (_this3.root.classList.contains('ql-hidden')) return;\n var range = _this3.quill.getSelection();\n if (range != null) {\n _this3.position(_this3.quill.getBounds(range));\n }\n }, 1);\n });\n }\n }, {\n key: 'cancel',\n value: function cancel() {\n this.show();\n }\n }, {\n key: 'position',\n value: function position(reference) {\n var shift = _get(BubbleTooltip.prototype.__proto__ || Object.getPrototypeOf(BubbleTooltip.prototype), 'position', this).call(this, reference);\n var arrow = this.root.querySelector('.ql-tooltip-arrow');\n arrow.style.marginLeft = '';\n if (shift === 0) return shift;\n arrow.style.marginLeft = -1 * shift - arrow.offsetWidth / 2 + 'px';\n }\n }]);\n\n return BubbleTooltip;\n}(_base.BaseTooltip);\n\nBubbleTooltip.TEMPLATE = ['', '
', '', '', '
'].join('');\n\nexports.BubbleTooltip = BubbleTooltip;\nexports.default = BubbleTheme;\n\n/***/ }),\n/* 109 */\n/***/ (function(module, exports, __webpack_require__) {\n\nmodule.exports = __webpack_require__(63);\n\n\n/***/ })\n/******/ ])[\"default\"];\n});\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(34).Buffer))//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMy5qcyIsInNvdXJjZXMiOlsid2VicGFjazovLy8uL25vZGVfbW9kdWxlcy9xdWlsbC9kaXN0L3F1aWxsLmpzPzkzMzkiXSwic291cmNlc0NvbnRlbnQiOlsiLyohXG4gKiBRdWlsbCBFZGl0b3IgdjEuMy43XG4gKiBodHRwczovL3F1aWxsanMuY29tL1xuICogQ29weXJpZ2h0IChjKSAyMDE0LCBKYXNvbiBDaGVuXG4gKiBDb3B5cmlnaHQgKGMpIDIwMTMsIHNhbGVzZm9yY2UuY29tXG4gKi9cbihmdW5jdGlvbiB3ZWJwYWNrVW5pdmVyc2FsTW9kdWxlRGVmaW5pdGlvbihyb290LCBmYWN0b3J5KSB7XG5cdGlmKHR5cGVvZiBleHBvcnRzID09PSAnb2JqZWN0JyAmJiB0eXBlb2YgbW9kdWxlID09PSAnb2JqZWN0Jylcblx0XHRtb2R1bGUuZXhwb3J0cyA9IGZhY3RvcnkoKTtcblx0ZWxzZSBpZih0eXBlb2YgZGVmaW5lID09PSAnZnVuY3Rpb24nICYmIGRlZmluZS5hbWQpXG5cdFx0ZGVmaW5lKFtdLCBmYWN0b3J5KTtcblx0ZWxzZSBpZih0eXBlb2YgZXhwb3J0cyA9PT0gJ29iamVjdCcpXG5cdFx0ZXhwb3J0c1tcIlF1aWxsXCJdID0gZmFjdG9yeSgpO1xuXHRlbHNlXG5cdFx0cm9vdFtcIlF1aWxsXCJdID0gZmFjdG9yeSgpO1xufSkodHlwZW9mIHNlbGYgIT09ICd1bmRlZmluZWQnID8gc2VsZiA6IHRoaXMsIGZ1bmN0aW9uKCkge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ByZWdpc3RlciBhYnN0cmFjdCBjbGFzcycpO1xuICAgIH1cbiAgICB0eXBlc1tEZWZpbml0aW9uLmJsb3ROYW1lIHx8IERlZmluaXRpb24uYXR0ck5hbWVdID0gRGVmaW5pdGlvbjtcbiAgICBpZiAodHlwZW9mIERlZmluaXRpb24ua2V5TmFtZSA9PT0gJ3N0cmluZycpIHtcbiAgICAgICAgYXR0cmlidXRlc1tEZWZpbml0aW9uLmtleU5hbWVdID0gRGVmaW5pdGlvbjtcbiAgICB9XG4gICAgZWxzZSB7XG4gICAgICAgIGlmIChEZWZpbml0aW9uLmNsYXNzTmFtZSAhPSBudWxsKSB7XG4gICAgICAgICAgICBjbGFzc2VzW0RlZmluaXRpb24uY2xhc3NOYW1lXSA9IERlZmluaXRpb247XG4gICAgICAgIH1cbiAgICAgICAgaWYgKERlZmluaXRpb24udGFnTmFtZSAhPSBudWxsKSB7XG4gICAgICAgICAgICBpZiAoQXJyYXkuaXNBcnJheShEZWZpbml0aW9uLnRhZ05hbWUpKSB7XG4gICAgICAgICAgICAgICAgRGVmaW5pdGlvbi50YWdOYW1lID0gRGVmaW5pdGlvbi50YWdOYW1lLm1hcChmdW5jdGlvbiAodGFnTmFtZSkge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGFnTmFtZS50b1VwcGVyQ2FzZSgpO1xuICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgRGVmaW5pdGlvbi50YWdOYW1lID0gRGVmaW5pdGlvbi50YWdOYW1lLnRvVXBwZXJDYXNlKCk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICB2YXIgdGFnTmFtZXMgPSBBcnJheS5pc0FycmF5KERlZmluaXRpb24udGFnTmFtZSkgPyBEZWZpbml0aW9uLnRhZ05hbWUgOiBbRGVmaW5pdGlvbi50YWdOYW1lXTtcbiAgICAgICAgICAgIHRhZ05hbWVzLmZvckVhY2goZnVuY3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AgICAgICAgICAgICBjb25zdW1lTmV4dE5ld2xpbmUgPSBmYWxzZTtcbiAgICAgICAgICAgICAgdGV4dCA9IHRleHQuc2xpY2UoMCwgLTEpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKGluZGV4ID49IHNjcm9sbExlbmd0aCAmJiAhdGV4dC5lbmRzV2l0aCgnXFxuJykpIHtcbiAgICAgICAgICAgICAgY29uc3VtZU5leHROZXdsaW5lID0gdHJ1ZTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIF90aGlzLnNjcm9sbC5pbnNlcnRBdChpbmRleCwgdGV4dCk7XG5cbiAgICAgICAgICAgIHZhciBfc2Nyb2xsJGxpbmUgPSBfdGhpcy5zY3JvbGwubGluZShpbmRleCksXG4gICAgICAgICAgICAgICAgX3Njcm9sbCRsaW5lMiA9IF9zbGljZWRUb0FycmF5KF9zY3JvbGwkbGluZSwgMiksXG4gICAgICAgICAgICAgICAgbGluZSA9IF9zY3JvbGwkbGluZTJbMF0sXG4gICAgICAgICAgICAgICAgb2Zmc2V0ID0gX3Njcm9sbCRsaW5lMlsxXTtcblxuICAgICAgICAgICAgdmFyIGZvcm1hdHMgPSAoMCwgX2V4dGVuZDIuZGVmYXVsdCkoe30sICgwLCBfYmxvY2suYnViYmxlRm9ybWF0cykobGluZSkpO1xuICAgICAgICAgICAgaWYgKGxpbmUgaW5zdGFuY2VvZiBfYmxvY2syLmRlZmF1bHQpIHtcbiAgICAgICAgICAgICAgdmFyIF9saW5lJGRlc2NlbmRhbnQgPSBsaW5lLmRlc2NlbmRhbnQoX3BhcmNobWVudDIuZGVmYXVsdC5MZWFmLCBvZmZzZXQpLFxuICAgICAgICAgICAgICAgICAgX2xpbmUkZGVzY2VuZGFudDIgPSBfc2xpY2VkVG9BcnJheShfbGluZSRkZXNjZW5kYW50LCAxKSxcbiAgICAgICAgICAgICAgICAgIGxlYWYgPSBfbGluZSRkZXNjZW5kYW50MlswXTtcblxuICAgICAgICAgICAgICBm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gYXJndW1lbnRzLmxlbmd0aCA+IDEgJiYgYXJndW1lbnRzWzFdICE9PSB1bmRlZmluZWQgPyBhcmd1bWVudHNbMV0gOiAwO1xuXG4gICAgICB2YXIgbGluZXMgPSBbXSxcbiAgICAgICAgICBsZWF2ZXMgPSBbXTtcbiAgICAgIGlmIChsZW5ndGggPT09IDApIHtcbiAgICAgICAgdGhpcy5zY3JvbGwucGF0aChpbmRleCkuZm9yRWFjaChmdW5jdGlvbiAocGF0aCkge1xuICAgICAgICAgIHZhciBfcGF0aCA9IF9zbGljZWRUb0FycmF5KHBhdGgsIDEpLFxuICAgICAgICAgICAgICBibG90ID0gX3BhdGhbMF07XG5cbiAgICAgICAgICBpZiAoYmxvdCBpbnN0YW5jZW9mIF9ibG9jazIuZGVmYXVsdCkge1xuICAgICAgICAgICAgbGluZXMucHVzaChibG90KTtcbiAgICAgICAgICB9IGVsc2UgaWYgKGJsb3QgaW5zdGFuY2VvZiBfcGFyY2htZW50Mi5kZWZhdWx0LkxlYWYpIHtcbiAgICAgICAgICAgIGxlYXZlcy5wdXNoKGJsb3QpO1xuICAgICAgICAgIH1cbiAgICAgICAgfSk7XG4gICAgICB9IGVsc2Uge1xuICAgICAgICBsaW5lcyA9IHRoaXMuc2Nyb2xsLmxpbmVzKGluZGV4LCBsZW5ndGgpO1xuICAgICAgICBsZWF2ZXMgPSB0aGlzLnNjcm9sbC5kZXNjZW5kYW50cyhfcGFyY2htZW50Mi5kZWZhdWx0LkxlYWYsIGluZGV4LCBsZW5ndGgpO1xuICAgICAgfVxuICAgICAgdmFyIGZvcm1hdHNBcnIgPSBbbGluZXMsIGxlYXZlc10ubWFwKGZ1bmN0aW9uIChibG90cykge1xuICAgICAgICBpZiAoYmxvdHMubGVuZ3RoID09PSAwKSByZXR1cm4ge307XG4gICAgICAgIHZhciBmb3JtYXRzID0gKDAsIF9ibG9jay5idWJibGVGb3JtYXRzKShibG90cy5zaGlmdCgpKTtcbiAgICAgICAgd2hpbGUgKE9iamV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aGlzO1xuICAgICAgICB0aGlzLmNoaWxkcmVuID0gbmV3IGxpbmtlZF9saXN0XzEuZGVmYXVsdCgpO1xuICAgICAgICAvLyBOZWVkIHRvIGJlIHJldmVyc2VkIGZvciBpZiBET00gbm9kZXMgYWxyZWFkeSBpbiBvcmRlclxuICAgICAgICBbXS5zbGljZVxuICAgICAgICAgICAgLmNhbGwodGhpcy5kb21Ob2RlLmNoaWxkTm9kZXMpXG4gICAgICAgICAgICAucmV2ZXJzZSgpXG4gICAgICAgICAgICAuZm9yRWFjaChmdW5jdGlvbiAobm9kZSkge1xuICAgICAgICAgICAgdHJ5IHtcbiAgICAgICAgICAgICAgICB2YXIgY2hpbGQgPSBtYWtlQmxvdChub2RlKTtcbiAgICAgICAgICAgICAgICBfdGhpcy5pbnNlcnRCZWZvcmUoY2hpbGQsIF90aGlzLmNoaWxkcmVuLmhlYWQgfHwgdW5kZWZpbmVkKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGNhdGNoIChlcnIpIHtcbiAgICAgICAgICAgICAgICBpZiAoZXJyIGluc3RhbmNlb2YgUmVnaXN0cnkuUGFyY2htZW50RXJyb3IpXG4gICAgICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgICAgICBlbHNlXG4gICAgICAgICAgICAgICAgICAgIHRocm93IGVycjtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSk7XG4gICAgfTtcbiAgICBDb250YWluZXJCbG90LnByb3RvdHlwZS5kZWxldGVBdCA9IGZ1bmN0aW9uIChpbmRleCwgbGVuZ3RoKSB7XG4gICAgICAgIGlmIChpbmRleCA9PT0gMCAmJiBsZW5ndGggPT09IHRoaXMubGVuZ3RoKCkpIHtcbiAgICAgICAgICAgIHJldHVybiB0aGlzLnJlbW92ZSgpO1xuICAgICAgICB9XG4gICAgICAgIHRoaXMuY2hpbGRyZW4uZm9yRWFjaEF0KGluZGV4LCBsZW5ndGgsIGZ1bmN0aW9uIChjaGlsZCwgb2Zmc2V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ByZW1vdmFsXG4gICAgICAgICAgICBpZiAobm9kZS5wYXJlbnROb2RlICE9IG51bGwgJiZcbiAgICAgICAgICAgICAgICAvLyBAdHMtaWdub3JlXG4gICAgICAgICAgICAgICAgbm9kZS50YWdOYW1lICE9PSAnSUZSQU1FJyAmJlxuICAgICAgICAgICAgICAgIGRvY3VtZW50LmJvZHkuY29tcGFyZURvY3VtZW50UG9zaXRpb24obm9kZSkgJiBOb2RlLkRPQ1VNRU5UX1BPU0lUSU9OX0NPTlRBSU5FRF9CWSkge1xuICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHZhciBibG90ID0gUmVnaXN0cnkuZmluZChub2RlKTtcbiAgICAgICAgICAgIGlmIChibG90ID09IG51bGwpXG4gICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgaWYgKGJsb3QuZG9tTm9kZS5wYXJlbnROb2RlID09IG51bGwgfHwgYmxvdC5kb21Ob2RlLnBhcmVudE5vZGUgPT09IF90aGlzLmRvbU5vZGUpIHtcbiAgICAgICAgICAgICAgICBibG90LmRldGFjaCgpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9KTtcbiAgICAgICAgYWRkZWROb2Rlc1xuICAgICAgICAgICAgLmZpbHRlcihmdW5jdGlvbiAobm9kZSkge1xuICAgICAgICAgICAgcmV0dXJuIG5vZGUucGFyZW50Tm9kZSA9PSBfdGhpcy5kb21Ob2RlO1xuICAgICAgICB9KVxuICAgICAgICAgICAgLnNvcnQoZnVuY3Rpb24gKGEsIGIpIHtcbiAgICAgICAgICAgIGlmIChhID09PSBiKVxuICAgICAgICAgICAgICAgIHJldHVybiAwO1xuICAgICAgICAgICAgaWYgKGEuY29tcGFyZURvY3VtZW50UG9zaXRpb24oYikgJiBOb2RlLkRPQ1VNRU5UX1BPU0lUSU9OX0ZPTExPV0lORykge1xuICAgICAgICAgICAgICAgIHJldHVybiAxO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgcmV0dXJuIC0xO1xuICAgICAgICB9KVxuICAgICAgICAgICAgLmZvckVhY2goZnVuY3Rpb24gKG5vZGUpIHtcbiAgICAgICAgICAgIHZhciByZWZCbG90ID0gbnVsbDtcbiAgICAgICAgICAgIGlmIChub2RlLm5leHRTaWJsaW5nICE9IG51bGwpIHtcbiAgICAgICAgICAgICAgICByZWZCbG90ID0gUmVnaXN0cnkuZmluZChub2RlLm5leHRTaWJsaW5nKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHZhciBibG90ID0gbWFrZUJsb3Qobm9kZSk7XG4gICAgICAgICAgICBpZiAoYmxvdC5uZXh0ICE9IHJlZkJsb3QgfHwgYmxvdC5uZXh0ID09IG51bGwpIHtcbiAgICAgICAgICAgICAgICBpZiAoYmxvdC5wYXJlbnQgIT0gbnVsbCkge1xuICAgICAgICAgICAgICAgICAgICBibG90LnBhcmVudC5yZW1vdmVDaGlsZChfdGhpcyk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIF90aGlzLmluc2VydEJlZm9yZShibG90LCByZWZCbG90IHx8IHVuZGVmaW5lZCk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0pO1xuICAgIH07XG4gICAgcmV0dXJuIENvbnRhaW5lckJsb3Q7XG59KHNoYWRvd18xLmRlZmF1bHQpKTtcbmZ1bmN0aW9uIG1ha2VCbG90KG5vZGUpIHtcbiAgICB2YXIgYmxvdCA9IFJlZ2lzdHJ5LmZpbmQobm9kZSk7XG4gICAgaWYgKGJsb3QgPT0gbnVsbCkge1xuICAgICAgICB0cnkge1xuICAgICAgICAgICAgYmxvdCA9IFJlZ2lzdHJ5LmNyZWF0ZShub2RlKTtcbiAgICAgICAgfVxuICAgICAgICBjYXRjaCAoZSkge1xuICAgICAgICAgICAgYmxvdCA9IFJlZ2lzdHJ5LmNyZWF0ZShSZWdpc3RyeS5TY29wZS5JTkxJTkUpO1xuICAgICAgICAgICAgW10uc2xpY2UuY2FsbChub2RlLm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mZzZXQgPSBfbGluZTJbMV07XG5cbiAgICAgIHZhciBfbGluZTMgPSB0aGlzLmxpbmUoaW5kZXggKyBsZW5ndGgpLFxuICAgICAgICAgIF9saW5lNCA9IF9zbGljZWRUb0FycmF5KF9saW5lMywgMSksXG4gICAgICAgICAgbGFzdCA9IF9saW5lNFswXTtcblxuICAgICAgX2dldChTY3JvbGwucHJvdG90eXBlLl9fcHJvdG9fXyB8fCBPYmplY3QuZ2V0UHJvdG90eXBlT2YoU2Nyb2xsLnByb3RvdHlwZSksICdkZWxldGVBdCcsIHRoaXMpLmNhbGwodGhpcywgaW5kZXgsIGxlbmd0aCk7XG4gICAgICBpZiAobGFzdCAhPSBudWxsICYmIGZpcnN0ICE9PSBsYXN0ICYmIG9mZnNldCA+IDApIHtcbiAgICAgICAgaWYgKGZpcnN0IGluc3RhbmNlb2YgX2Jsb2NrLkJsb2NrRW1iZWQgfHwgbGFzdCBpbnN0YW5jZW9mIF9ibG9jay5CbG9ja0VtYmVkKSB7XG4gICAgICAgICAgdGhpcy5vcHRpbWl6ZSgpO1xuICAgICAgICAgIHJldHVybjtcbiAgICAgICAgfVxuICAgICAgICBpZiAoZmlyc3QgaW5zdGFuY2VvZiBfY29kZTIuZGVmYXVsdCkge1xuICAgICAgICAgIHZhciBuZXdsaW5lSW5kZXggPSBmaXJzdC5uZXdsaW5lSW5kZXgoZmlyc3QubGVuZ3RoKCksIHRydWUpO1xuICAgICAgICAgIGlmIChuZXdsaW5lSW5kZXggPiAtMSkge1xuICAgICAgICAgICAgZmlyc3QgPSBmaXJzdC5zcGxpdChuZXdsaW5lSW5kZXggKyAxKTtcbiAgICAgICAgICAgIGlmIChmaXJzdCA9PT0gbGFzdCkge1xuICAgICAgICAgICAgICB0aGlzLm9wdGltaXplKCk7XG4gICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9XG4gICAgICAgIH0gZWxzZSBpZiAobGFzdCBpbnN0YW5jZW9mIF9jb2Rl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VjdC5rZXlzKGJpbmRpbmcuZm9ybWF0KS5ldmVyeShmdW5jdGlvbiAobmFtZSkge1xuICAgICAgICAgICAgICBpZiAoYmluZGluZy5mb3JtYXRbbmFtZV0gPT09IHRydWUpIHJldHVybiBjdXJDb250ZXh0LmZvcm1hdFtuYW1lXSAhPSBudWxsO1xuICAgICAgICAgICAgICBpZiAoYmluZGluZy5mb3JtYXRbbmFtZV0gPT09IGZhbHNlKSByZXR1cm4gY3VyQ29udGV4dC5mb3JtYXRbbmFtZV0gPT0gbnVsbDtcbiAgICAgICAgICAgICAgcmV0dXJuICgwLCBfZGVlcEVxdWFsMi5kZWZhdWx0KShiaW5kaW5nLmZvcm1hdFtuYW1lXSwgY3VyQ29udGV4dC5mb3JtYXRbbmFtZV0pO1xuICAgICAgICAgICAgfSkpIHtcbiAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlO1xuICAgICAgICAgICAgfVxuICAgICAgICAgIH1cbiAgICAgICAgICBpZiAoYmluZGluZy5wcmVmaXggIT0gbnVsbCAmJiAhYmluZGluZy5wcmVmaXgudGVzdChjdXJDb250ZXh0LnByZWZpeCkpIHJldHVybiBmYWxzZTtcbiAgICAgICAgICBpZiAoYmluZGluZy5zdWZmaXggIT0gbnVsbCAmJiAhYmluZGluZy5zdWZmaXgudGVzdChjdXJDb250ZXh0LnN1ZmZpeCkpIHJldHVybiBmYWxzZTtcbiAgICAgICAgICByZXR1cm4gYmluZGluZy5oYW5kbGVyLmNhbGwoX3RoaXMyLCByYW5nZSwgY3VyQ29udGV4dCkgIT09IHRydWU7XG4gICAgICAgIH0pO1xuICAgICAgICBpZiAocHJldmVudGVkKSB7XG4gICAgICAgICAgZXZ0LnByZXZlbnREZWZhdWx0KCk7XG4gICAgICAgIH1cbiAgICAgIH0pO1xuICAgIH1cbiAgfV0pO1xuXG4gIHJldHVybiBLZXlib2FyZDtcbn0oX21vZHVsZTIuZGVmYXVsdCk7XG5cbktleWJvYXJkLmtleXMgPSB7XG4gIEJBQ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biAgICAgICAgICAgICAgICB2YWx1ZSA9IHZhbHVlLnRvVXBwZXJDYXNlKCk7XG4gICAgICAgICAgICAgICAgaWYgKHBhcnNlSW50KHZhbHVlKS50b1N0cmluZygpID09PSB2YWx1ZSkge1xuICAgICAgICAgICAgICAgICAgICB2YWx1ZSA9IHBhcnNlSW50KHZhbHVlKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAodHlwZW9mIHZhbHVlID09PSAnbnVtYmVyJykge1xuICAgICAgICAgICAgICAgIG5vZGUgPSBkb2N1bWVudC5jcmVhdGVFbGVtZW50KHRoaXMudGFnTmFtZVt2YWx1ZSAtIDFdKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGVsc2UgaWYgKHRoaXMudGFnTmFtZS5pbmRleE9mKHZhbHVlKSA+IC0xKSB7XG4gICAgICAgICAgICAgICAgbm9kZSA9IGRvY3VtZW50LmNyZWF0ZUVsZW1lbnQodmFsdWUpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgbm9kZSA9IGRvY3VtZW50LmNyZWF0ZUVsZW1lbnQodGhpcy50YWdOYW1lWzBdKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgIG5vZGUgPSBkb2N1bWVudC5jcmVhdGVFbGVtZW50KHRoaXMudGFnTmFtZSk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKHRoaXMuY2xhc3NOYW1lKSB7XG4gICAgICAgICAgICBub2RlLmNsYXNzTGlzdC5hZGQodGhpcy5jbGFzc05hbWUpO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiBub2RlO1xuICAgIH07XG4gICAgU2hhZG93QmxvdC5wcm90b3R5cGUuYXR0YWNoID0gZnVuY3Rpb24gKCkge1xuICAgICAgICBpZiAodGhpcy5wYXJlbnQgIT0gbnVsbCkge1xuICAgICAgICAg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XAsIGltYWdlL3gtaWNvbicpO1xuICAgICAgICAgICAgZmlsZUlucHV0LmNsYXNzTGlzdC5hZGQoJ3FsLWltYWdlJyk7XG4gICAgICAgICAgICBmaWxlSW5wdXQuYWRkRXZlbnRMaXN0ZW5lcignY2hhbmdlJywgZnVuY3Rpb24gKCkge1xuICAgICAgICAgICAgICBpZiAoZmlsZUlucHV0LmZpbGVzICE9IG51bGwgJiYgZmlsZUlucHV0LmZpbGVzWzBdICE9IG51bGwpIHtcbiAgICAgICAgICAgICAgICB2YXIgcmVhZGVyID0gbmV3IEZpbGVSZWFkZXIoKTtcbiAgICAgICAgICAgICAgICByZWFkZXIub25sb2FkID0gZnVuY3Rpb24gKGUpIHtcbiAgICAgICAgICAgICAgICAgIHZhciByYW5nZSA9IF90aGlzMy5xdWlsbC5nZXRTZWxlY3Rpb24odHJ1ZSk7XG4gICAgICAgICAgICAgICAgICBfdGhpczMucXVpbGwudXBkYXRlQ29udGVudHMobmV3IF9xdWlsbERlbHRhMi5kZWZhdWx0KCkucmV0YWluKHJhbmdlLmluZGV4KS5kZWxldGUocmFuZ2UubGVuZ3RoKS5pbnNlcnQoeyBpbWFnZTogZS50YXJnZXQucmVzdWx0IH0pLCBfZW1pdHRlcjIuZGVmYXVsdC5zb3VyY2VzLlVTRVIpO1xuICAgICAgICAgICAgICAgICAgX3RoaXMzLnF1aWxsLnNldFNlbGVjdGlvbihyYW5nZS5pbmRleCArIDEsIF9lbWl0dGVyMi5kZWZhdWx0LnNvdXJjZXMuU0lMRU5UKTtcbiAgICAgICAgICAgICAgICAgIGZpbGVJbnB1dC52YWx1ZSA9IFwiXCI7XG4gICAgICAgICAgICAgICAgfTtcbiAgICAgICAgICAgICAgICByZWFkZXIucmVhZEFzRGF0YVVSTChmaWxlSW5wdXQuZmlsZXNbMF0pO1xuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIHRoaXMuY29udGFpbmVyLmFwcGVuZENoaWxkKGZpbGV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zZXJ0QmVmb3JlID0gZnVuY3Rpb24gKG5vZGUsIHJlZk5vZGUpIHtcbiAgICAgICAgaWYgKCFub2RlKVxuICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICBub2RlLm5leHQgPSByZWZOb2RlO1xuICAgICAgICBpZiAocmVmTm9kZSAhPSBudWxsKSB7XG4gICAgICAgICAgICBub2RlLnByZXYgPSByZWZOb2RlLnByZXY7XG4gICAgICAgICAgICBpZiAocmVmTm9kZS5wcmV2ICE9IG51bGwpIHtcbiAgICAgICAgICAgICAgICByZWZOb2RlLnByZXYubmV4dCA9IG5vZGU7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByZWZOb2RlLnByZXYgPSBub2RlO1xuICAgICAgICAgICAgaWYgKHJlZk5vZGUgPT09IHRoaXMuaGVhZCkge1xuICAgICAgICAgICAgICAgIHRoaXMuaGVhZCA9IG5vZGU7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgZWxzZSBpZiAodGhpcy50YWlsICE9IG51bGwpIHtcbiAgICAgICAgICAgIHRoaXMudGFpbC5uZXh0ID0gbm9kZTtcbiAgICAgICAgICAgIG5vZGUucHJldiA9IHRoaXMudGFpbDtcbiAgICAgICAgICAgIHRoaXMudGFpbCA9IG5vZGU7XG4gICAgICAgIH1cbiAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICBub2RlLnByZXYgPSBudWxsO1xuICAgICAgICAgICAgdGhpcy5oZWFkID0gdGhpcy50YWlsID0gbm9kZTtcbiAgICAgICAgfVxuICAgICAgICB0aGlzLmxlbmd0aCArPSAxO1xuICAgIH07XG4gICAgTGlua2VkTGlzdC5wcm90b3R5cGUub2Zmc2V0ID0gZnVuY3Rpb24gKHRhcmdldCkge1xuICAgICAgICB2YXIgaW5kZXggPSAwLCBjdXIgPSB0aGlzLmhlYWQ7XG4gICAgICAgIHdoaWxlIChjdXIgIT0gbnVsbCkge1xuICAgICAgICAgICAgaWYgKGN1ciA9PT0gdGFyZ2V0KVxuICAgICAgICAgICAgICAgIHJldHVybiBpbmRleDtcbiAgICAgICAgICAgIGluZGV4ICs9IGN1ci5sZW5ndGgoKTtcbiAgICAgICAgICAgIGN1ciA9IGN1ci5uZXh0O1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiAtMTtcbiAgICB9O1xuICAgIExpbmtlZExpc3QucHJvdG90eXBlLnJlbW92ZSA9IGZ1bmN0aW9uIChub2RlKSB7XG4gICAgICAgIGlmICghdGhpcy5jb250YWlucyhub2RlKSlcbiAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgaWYgKG5vZGUucHJldiAhPSBudWxsKVxuICAgICAgICAgICAgbm9kZS5wcmV2Lm5leHQgPSBub2RlLm5leHQ7XG4gICAgICAgIGlmIChub2RlLm5leHQgIT0gbnVsbClcbiAgICAgICAgICAgIG5vZGUubmV4dC5wcmV2ID0gbm9kZS5wcmV2O1xuICAgICAgICBpZiAobm9kZSA9PT0gdGhpcy5oZWFkKVxuICAgICAgICAgICAgdGhpcy5oZWFkID0gbm9kZS5uZXh0O1xuICAgICAgICBpZiAobm9kZSA9PT0gdGhpcy50YWlsKVxuICAgICAgICAgICAgdGhpcy50YWlsID0gbm9kZS5wcmV2O1xuICAgICAgICB0aGlzLmxlbmd0aCAtPSAxO1xuICAgIH07XG4gICAgTGlua2VkTGlzdC5wcm90b3R5cGUuaXRlcmF0b3IgPSBmdW5jdGlvbiAoY3VyTm9kZSkge1xuICAgICAgICBpZiAoY3VyTm9kZSA9PT0gdm9pZCAwKSB7IGN1ck5vZGUgPSB0aGlzLmhlYWQ7IH1cbiAgICAgICAgLy8gVE9ETyB1c2UgeWllbGQgd2hlbiB3ZSBjYW5cbiAgICAgICAgcmV0dXJuIGZ1bmN0aW9uICgpIHtcbiAgICAgICAgICAgIHZhciByZXQgPSBjdXJOb2RlO1xuICAgICAgICAgICAgaWYgKGN1ck5vZGUgIT0gbnVsbClcbiAgICAgICAgICAgICAgICBjdXJOb2RlID0gY3VyTm9kZS5uZ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gICAgIHJldHVybjtcbiAgICAgICAgdmFyIF9hID0gdGhpcy5maW5kKGluZGV4KSwgc3RhcnROb2RlID0gX2FbMF0sIG9mZnNldCA9IF9hWzFdO1xuICAgICAgICB2YXIgY3VyLCBjdXJJbmRleCA9IGluZGV4IC0gb2Zmc2V0LCBuZXh0ID0gdGhpcy5pdGVyYXRvcihzdGFydE5vZGUpO1xuICAgICAgICB3aGlsZSAoKGN1ciA9IG5leHQoKSkgJiYgY3VySW5kZXggPCBpbmRleCArIGxlbmd0aCkge1xuICAgICAgICAgICAgdmFyIGN1ckxlbmd0aCA9IGN1ci5sZW5ndGgoKTtcbiAgICAgICAgICAgIGlmIChpbmRleCA+IGN1ckluZGV4KSB7XG4gICAgICAgICAgICAgICAgY2FsbGJhY2soY3VyLCBpbmRleCAtIGN1ckluZGV4LCBNYXRoLm1pbihsZW5ndGgsIGN1ckluZGV4ICsgY3VyTGVuZ3RoIC0gaW5kZXgpKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgIGNhbGxiYWNrKGN1ciwgMCwgTWF0aC5taW4oY3VyTGVuZ3RoLCBpbmRleCArIGxlbmd0aCAtIGN1ckluZGV4KSk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBjdXJJbmRleCArPSBjdXJMZW5ndGg7XG4gICAgICAgIH1cbiAgICB9O1xuICAgIExpbmtlZExpc3QucHJvdG90eXBlLm1hcCA9IGZ1bmN0aW9uIChjYWxsYmFjaykge1xuICAgICAgICByZXR1cm4gdGhpcy5yZWR1Y2UoZnVuY3Rpb24gKG1lbW8sIGN1cikge1xuICAgICAgICAgICAgbWVtby5wdXNoKGNhbGxiYWNrKGN1cikpO1xuICAgICAgICAgICAgcmV0dXJuIG1lbW87XG4gICAgICAgIH0sIFtdKTtcbiAgICB9O1xuICAgIExpbmtlZExpc3QucHJvdG90eXBlLnJlZHVjZSA9IGZ1bmN0aW9uIChjYWxsYmFjaywgbWVtbykge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b3QgPT09IF90aGlzKVxuICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgIGlmIChibG90LmRvbU5vZGUucGFyZW50Tm9kZSA9PSBudWxsKVxuICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgIC8vIEB0cy1pZ25vcmVcbiAgICAgICAgICAgIGlmIChibG90LmRvbU5vZGVbUmVnaXN0cnkuREFUQV9LRVldLm11dGF0aW9ucyA9PSBudWxsKSB7XG4gICAgICAgICAgICAgICAgLy8gQHRzLWlnbm9yZVxuICAgICAgICAgICAgICAgIGJsb3QuZG9tTm9kZVtSZWdpc3RyeS5EQVRBX0tFWV0ubXV0YXRpb25zID0gW107XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAobWFya1BhcmVudClcbiAgICAgICAgICAgICAgICBtYXJrKGJsb3QucGFyZW50KTtcbiAgICAgICAgfTtcbiAgICAgICAgdmFyIG9wdGltaXplID0gZnVuY3Rpb24gKGJsb3QpIHtcbiAgICAgICAgICAgIC8vIFBvc3Qtb3JkZXIgdHJhdmVyc2FsXG4gICAgICAgICAgICBpZiAoXG4gICAgICAgICAgICAvLyBAdHMtaWdub3JlXG4gICAgICAgICAgICBibG90LmRvbU5vZGVbUmVnaXN0cnkuREFUQV9LRVldID09IG51bGwgfHxcbiAgICAgICAgICAgICAgICAvLyBAdHMtaWdub3JlXG4gICAgICAgICAgICAgICAgYmxvdC5kb21Ob2RlW1JlZ2lzdHJ5LkRBVEFfS0VZXS5tdXRhdGlvbnMgPT0gbnVsbCkge1xuICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmIChibG90IGluc3RhbmNlb2YgY29udGFpbmVyXzEuZGVmYXVsdCkge1xuICAgICAgICAgICAgICAgIGJsb3QuY2hpbGRyZW4uZm9yRWFjaChvcHRpbWl6ZSk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBibG90Lm9wdGltaXplKGNvbnRleHQpO1xuICAgICAgICB9O1xuICAgICAgICB2YXIgcmVtYWluaW5nID0gbXV0YXRpb25zO1xuICAgICAgICBmb3IgKHZhciBpID0gMDsgcmVtYWluaW5nLmxlbmd0aCA+IDA7IGkgKz0gMSkge1xuICAgICAgICAgICAgaWYgKGkgPj0gTUFYX09QVElNSVpFX0lURVJBVElPTlMpIHtcbiAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoJ1tQYXJjaG1lbnRdIE1heGltdW0gb3B0aW1pemUgaXRlcmF0aW9ucyByZWFjaGVkJyk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByZW1haW5pbmcuZm9yRWFjaChmdW5jdGlvbiAobXV0YXRpb24pIHtcbiAgICAgICAgICAgICAgICB2YXIgYmxvdCA9IFJlZ2lzdHJ5LmZpbmQobXV0YXRpb24udGFyZ2V0LCB0cnVlKTtcbiAgICAgICAgICAgICAgICBpZiAoYmxvdCA9PSBudWxsKVxuICAgICAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICAgICAgaWYgKGJsb3QuZG9tTm9kZSA9PT0gbXV0YXRpb24udGFyZ2V0KSB7XG4gICAgICAgICAgICAgICAgICAgIGlmIChtdXRhdGlvbi50eXBlID09PSAnY2hpbGRMaXN0Jykge1xuICAgICAgICAgICAgICAgICAgICAgICAgbWFyayhSZWdpc3RyeS5maW5kKG11dGF0aW9uLnByZXZpb3VzU2libGluZywgZmFsc2UpKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIFtdLmZvckVhY2guY2FsbChtdXRhdGlvbi5hZGRlZE5vZGVzLCBmdW5jdGlvbiAobm9kZSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBjaGlsZCA9IFJlZ2lzdHJ5LmZpbmQobm9kZSwgZmFsc2UpO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1hcmsoY2hpbGQsIGZhbHNlKTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoY2hpbGQgaW5zdGFuY2VvZiBjb250YWluZXJfMS5kZWZhdWx0KSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNoaWxkLmNoaWxkcmVuLmZvckVhY2goZnVuY3Rpb24gKGdyYW5kQ2hpbGQpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1hcmsoZ3JhbmRDaGlsZCwgZmFsc2UpO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBlbHNlIGlmIChtdXRhdGlvbi50eXBlID09PSAnYXR0cmlidXRlcycpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIG1hcmsoYmxvdC5wcmV2KTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBtYXJrKGJsb3QpO1xuICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICB0aGlzLmNoaWxkcmVuLmZvckVhY2gob3B0aW1pemUpO1xuICAgICAgICAgICAgcmVtYWluaW5nID0gW10uc2xpY2UuY2FsbCh0aGlzLm9ic2VydmVyLnRha2VSZWNvcmRzKCkpO1xuICAgICAgICAgICAgcmVjb3JkcyA9IHJlbWFpbmluZy5zbGljZSgpO1xuICAgICAgICAgICAgd2hpbGUgKHJlY29yZHMubGVuZ3RoID4gMClcbiAgICAgICAgICAgICAgICBtdXRhdGlvbnMucHVzaChyZWNvcmRzLnBvcCgpKTtcbiAgICAgICAgfVxuICAgIH07XG4gICAgU2Nyb2xsQmxvdC5wcm90b3R5cGUudXBkYXRlID0gZnVuY3Rpb24gKG11dGF0aW9ucywgY29udGV4dCkge1xuICAgICAgICB2YXIgX3RoaXMgPSB0aGlzO1xuICAgICAgICBpZiAoY29udGV4dCA9PT0gdm9pZCAwKSB7IGNvbnRleHQgPSB7fTsgfVxuICAgICAgICBtdXRhdGlvbnMgPSBtdXRhdGlvbnMgfHwgdGhpcy5vYnNlcnZlci50YWtlUmVjb3JkcygpO1xuICAgICAgICAvLyBUT0RPIHVzZSBXZWFrTWFwXG4gICAgICAgIG11dGF0aW9uc1xuICAgICAgICAgICAgLm1hcChmdW5jdGlvbiAobXV0YXRpb24pIHtcbiAgICAgICAgICAgIHZhciBibG90ID0gUmVnaXN0cnkuZmluZChtdXRhdGlvbi50YXJnZXQsIHRydWUpO1xuICAgICAgICAgICAgaWYgKGJsb3QgPT0gbnVsbClcbiAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDtcbiAgICAgICAgICAgIC8vIEB0cy1pZ25vcmVcbiAgICAgICAgICAgIGlmIChibG90LmRvbU5vZGVbUmVnaXN0cnkuREFUQV9LRVldLm11dGF0aW9ucyA9PSBudWxsKSB7XG4gICAgICAgICAgICAgICAgLy8gQHRzLWlnbm9yZVxuICAgICAgICAgICAgICAgIGJsb3QuZG9tTm9kZVtSZWdpc3RyeS5EQVRBX0tFWV0ubXV0YXRpb25zID0gW211dGF0aW9uXTtcbiAgICAgICAgICAgICAgICByZXR1cm4gYmxvdDtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgIC8vIEB0cy1pZ25vcmVcbiAgICAgICAgICAgICAgICBibG90LmRvbU5vZGVbUmVnaXN0cnkuREFUQV9LRVldLm11dGF0aW9ucy5wdXNoKG11dGF0aW9uKTtcbiAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSlcbiAgICAgICAgICAgIC5mb3JFYWNoKGZ1bmN0aW9uIChibG90KSB7XG4gICAgICAgICAgICBpZiAoYmxvdCA9PSBudWxsIHx8XG4gICAgICAgICAgICAgICAgYmxvdCA9PT0gX3RoaXMgfHxcbiAgICAgICAgICAgICAgICAvL0B0cy1pZ25vcmVcbiAgICAgICAgICA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JlYWs7XG4gICAgICBjYXNlIERJRkZfREVMRVRFOlxuICAgICAgICBjb3VudF9kZWxldGUrKztcbiAgICAgICAgdGV4dF9kZWxldGUgKz0gZGlmZnNbcG9pbnRlcl1bMV07XG4gICAgICAgIHBvaW50ZXIrKztcbiAgICAgICAgYnJlYWs7XG4gICAgICBjYXNlIERJRkZfRVFVQUw6XG4gICAgICAgIC8vIFVwb24gcmVhY2hpbmcgYW4gZXF1YWxpdHksIGNoZWNrIGZvciBwcmlvciByZWR1bmRhbmNpZXMuXG4gICAgICAgIGlmIChjb3VudF9kZWxldGUgKyBjb3VudF9pbnNlcnQgPiAxKSB7XG4gICAgICAgICAgaWYgKGNvdW50X2RlbGV0ZSAhPT0gMCAmJiBjb3VudF9pbnNlcnQgIT09IDApIHtcbiAgICAgICAgICAgIC8vIEZhY3RvciBvdXQgYW55IGNvbW1vbiBwcmVmaXhpZXMuXG4gICAgICAgICAgICBjb21tb25sZW5ndGggPSBkaWZmX2NvbW1vblByZWZpeCh0ZXh0X2luc2VydCwgdGV4dF9kZWxldGUpO1xuICAgICAgICAgICAgaWYgKGNvbW1vbmxlbmd0aCAhPT0gMCkge1xuICAgICAgICAgICAgICBpZiAoKHBvaW50ZXIgLSBjb3VudF9kZWxldGUgLSBjb3VudF9pbnNlcnQpID4gMCAmJlxuICAgICAgICAgICAgICAgICAgZGlmZnNbcG9pbnRlciAtIGNvdW50X2RlbGV0ZSAtIGNvdW50X2luc2VydCAtIDFdWzBdID09XG4gICAgICAgICAgICAgICAgICBESUZGX0VRVUFMKSB7XG4gICAgICAgICAgICAgICAgZGlmZnNbcG9pbnRlciAtIGNvdW50X2RlbGV0ZSAtIGNvdW50X2luc2VydCAtIDFdWzFdICs9XG4gICAgICAgICAgICAgICAgICAgIHRleHRfaW5zZXJ0LnN1YnN0cmluZygwLCBjb21tb25sZW5ndGgpO1xuICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIGRpZmZzLnNwbGljZSgwLCAwLCBbRElGRl9FUVVBTCxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRleHRfaW5zZXJ0LnN1YnN0cmluZygwLCBjb21tb25sZW5ndGgpXSk7XG4gICAgICAgICAgICAgICAgcG9pbnRlcisrO1xuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgIHRleHRfaW5zZXJ0ID0gdGV4dF9pbnNlcnQuc3Vic3RyaW5nKGNvbW1vbmxlbmd0aCk7XG4gICAgICAgICAgICAgIHRleHRfZGVsZXRlID0gdGV4dF9kZWxldGUuc3Vic3RyaW5nKGNvbW1vbmxlbmd0aCk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICAvLyBGYWN0b3Igb3V0IGFueSBjb21tb24gc3VmZml4aWVzLlxuICAgICAgICAgICAgY29tbW9ubGVuZ3RoID0gZGlmZl9jb21tb25TdWZmaXgodGV4dF9pbnNlcnQsIHRleHRfZGVsZXRlKTtcbiAgICAgICAgICAgIGlmIChjb21tb25sZW5ndGggIT09IDApIHtcbiAgICAgICAgICAgICAgZGlmZnNbcG9pbnRlcl1bMV0gPSB0ZXh0X2luc2VydC5zdWJzdHJpbmcodGV4dF9pbnNlcnQubGVuZ3RoIC1cbiAgICAgICAgICAgICAgICAgIGNvbW1vbmxlbmd0aCkgKyBkaWZmc1twb2ludGVyXVsxXTtcbiAgICAgICAgICAgICAgdGV4dF9pbnNlcnQgPSB0ZXh0X2luc2VydC5zdWJzdHJpbmcoMCwgdGV4dF9pbnNlcnQubGVuZ3RoIC1cbiAgICAgICAgICAgICAgICAgIGNvbW1vbmxlbmd0aCk7XG4gICAgICAgICAgICAgIHRleHRfZGVsZXRlID0gdGV4dF9kZWxldGUuc3Vic3RyaW5nKDAsIHRleHRfZGVsZXRlLmxlbmd0aCAtXG4gICAgICAgICAgICAgICAgICBjb21tb25sZW5ndGgpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgIH1cbiAgICAgICAgICAvLyBEZWxldGUgdGhlIG9mZmVuZGluZyByZWNvcmRzIGFuZCBhZGQgdGhlIG1lcmdlZCBvbmVzLlxuICAgICAgICAgIGlmIChjb3VudF9kZWxldGUgPT09IDApIHtcbiAgICAgICAgICAgIGRpZmZzLnNwbGljZShwb2ludGVyIC0gY291bnRfaW5zZXJ0LFxuICAgICAgICAgICAgICAgIGNvdW50X2RlbGV0ZSArIGNvdW50X2luc2VydCwgW0RJRkZfSU5TRVJULCB0ZXh0X2luc2VydF0pO1xuICAgICAgICAgIH0gZWxzZSBpZiAoY291bnRfaW5zZXJ0ID09PSAwKSB7XG4gICAgICAgICAgICBkaWZmcy5zcGxpY2UocG9pbnRlciAtIGNvdW50X2RlbGV0ZSxcbiAgICAgICAgICAgICAgICBjb3VudF9kZWxldGUgKyBjb3VudF9pbnNlcnQsIFtESUZGX0RFTEVURSwgdGV4dF9kZWxldGVdKTtcbiAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgZGlmZnMuc3BsaWNlKHBvaW50ZXIgLSBjb3VudF9kZWxldGUgLSBjb3VudF9pbnNlcnQsXG4gICAgICAgICAgICAgICAgY291bnRfZGVsZXRlICsgY291bnRfaW5zZXJ0LCBbRElGRl9ERUxFVEUsIHRleHRfZGVsZXRlXSxcbiAgICAgICAgICAgICAgICBbRElGRl9JTlNFUlQsIHRleHRfaW5zZXJ0XSk7XG4gICAgICAgICAgfVxuICAgICAgICAgIHBvaW50ZXIgPSBwb2ludGVyIC0gY291bnRfZGVsZXRlIC0gY291bnRfaW5zZXJ0ICtcbiAgICAgICAgICAgICAgICAgICAgKGNvdW50X2RlbGV0ZSA/IDEgOiAwKSArIChjb3VudF9pbnNlcnQgPyAxIDogMCkgKyAxO1xuICAgICAgICB9IGVsc2UgaWYgKHBvaW50ZXIgIT09IDAgJiYgZGlmZnNbcG9pbnRlciAtIDFdWzBdID09IERJRkZfRVFVQUwpIHtcbiAgICAgICAgICAvLyBNZXJnZSB0aGlzIGVxdWFsaXR5IHdpdGggdGhlIHByZXZpb3VzIG9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MoKTtcbiAgICAgIH0sIDEpO1xuICAgIH1cbiAgfSwge1xuICAgIGtleTogJ3ByZXBhcmVNYXRjaGluZycsXG4gICAgdmFsdWU6IGZ1bmN0aW9uIHByZXBhcmVNYXRjaGluZygpIHtcbiAgICAgIHZhciBfdGhpczMgPSB0aGlzO1xuXG4gICAgICB2YXIgZWxlbWVudE1hdGNoZXJzID0gW10sXG4gICAgICAgICAgdGV4dE1hdGNoZXJzID0gW107XG4gICAgICB0aGlzLm1hdGNoZXJzLmZvckVhY2goZnVuY3Rpb24gKHBhaXIpIHtcbiAgICAgICAgdmFyIF9wYWlyID0gX3NsaWNlZFRvQXJyYXkocGFpciwgMiksXG4gICAgICAgICAgICBzZWxlY3RvciA9IF9wYWlyWzBdLFxuICAgICAgICAgICAgbWF0Y2hlciA9IF9wYWlyWzFdO1xuXG4gICAgICAgIHN3aXRjaCAoc2VsZWN0b3IpIHtcbiAgICAgICAgICBjYXNlIE5vZGUuVEVYVF9OT0RFOlxuICAgICAgICAgICAgdGV4dE1hdGNoZXJzLnB1c2gobWF0Y2hlcik7XG4gICAgICAgICAgICBicmVhaztcbiAgICAgICAgICBjYXNlIE5vZGUuRUxFTUVOVF9OT0RFOlxuICAgICAgICAgICAgZWxlbWVudE1hdGNoZXJzLnB1c2gobWF0Y2hlcik7XG4gICAgICAgICAgICBicmVhaztcbiAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgW10uZm9yRWFjaC5jYWxsKF90aGlzMy5jb250YWluZXIucXVlcnlTZWxlY3RvckFsbChzZWxlY3RvciksIGZ1bmN0aW9uIChub2RlKSB7XG4gICAgICAgICAgICAgIC8vIFRPRE8gdXNlIHdlYWttYXBcbiAgICAgICAgICAgICAgbm9kZVtET01fS0VZXSA9IG5vZGVbRE9NX0tFWV0gfHwgW107XG4gICAgICAgICAgICAgIG5vZGVbRE9NX0tFWV0ucHVzaChtYXRjaGVyKTtcbiAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgYnJlYWs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GtleTogJ0snLCBzaG9ydEtleTogdHJ1ZSB9LCBmdW5jdGlvbiAocmFuZ2UsIGNvbnRleHQpIHtcbiAgICAgICAgICB0b29sYmFyLmhhbmRsZXJzWydsaW5rJ10uY2FsbCh0b29sYmFyLCAhY29udGV4dC5mb3JtYXQubGluayk7XG4gICAgICAgIH0pO1xuICAgICAgfVxuICAgIH1cbiAgfV0pO1xuXG4gIHJldHVybiBTbm93VGhlbWU7XG59KF9iYXNlMi5kZWZhdWx0KTtcblxuU25vd1RoZW1lLkRFRkFVTFRTID0gKDAsIF9leHRlbmQyLmRlZmF1bHQpKHRydWUsIHt9LCBfYmFzZTIuZGVmYXVsdC5ERUZBVUxUUywge1xuICBtb2R1bGVzOiB7XG4gICAgdG9vbGJhcjoge1xuICAgICAgaGFuZGxlcnM6IHtcbiAgICAgICAgbGluazogZnVuY3Rpb24gbGluayh2YWx1ZSkge1xuICAgICAgICAgIGlmICh2YWx1ZSkge1xuICAgICAgICAgICAgdmFyIHJhbmdlID0gdGhpcy5xdWlsbC5nZXRTZWxlY3Rpb24oKTtcbiAgICAgICAgICAgIGlmIChyYW5nZSA9PSBudWxsIHx8IHJhbmdlLmxlbmd0aCA9PSAwKSByZXR1cm47XG4gICAgICAgICAgICB2YXIgcHJldmlldyA9IHRoaXMucXVpbGwuZ2V0VGV4dChyYW5nZSk7XG4gICAgICAgICAgICBpZiAoL15cXFMrQFxcUytcXC5cXFMrJC8udGVzdChwcmV2aWV3KSAmJiBwcmV2aWV3LmluZGV4T2YoJ21haWx0bzonKSAhPT0gMCkge1xuICAgICAgICAgICAgICBwcmV2aWV3ID0gJ21haWx0bzonICsgcHJldmlldztcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHZhciB0b29sdGlwID0gdGhpcy5xdWlsbC50aGVtZS50b29sdGlwO1xuICAgICAgICAgICAgdG9vbHRpcC5lZGl0KCdsaW5rJywgcHJldmlldyk7XG4gICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIH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0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBIiwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///3\n")},function(module,__webpack_exports__,__webpack_require__){"use strict";eval("/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"d\", function() { return getViewElement; });\n/* unused harmony export getViewWidth */\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"a\", function() { return fixImageSize; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"c\", function() { return fixVideoSize; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"b\", function() { return fixSize; });\nfunction getViewElement() {\r\n return document.querySelector('div.ql-editor');\r\n}\r\nfunction getViewWidth() {\r\n var view = getViewElement();\r\n if (view) {\r\n var width = view.clientWidth;\r\n var style = getComputedStyle(view);\r\n if (style.paddingLeft) {\r\n width -= parseFloat(style.paddingLeft);\r\n }\r\n if (style.paddingRight) {\r\n width -= parseFloat(style.paddingRight);\r\n }\r\n if (width > 0) {\r\n return width;\r\n }\r\n }\r\n return 0;\r\n}\r\nfunction fixImageSize() {\r\n getViewElement()\r\n .querySelectorAll('img')\r\n .forEach(function (img) {\r\n var viewWidth = getViewWidth();\r\n var width = Number(img.dataset.width);\r\n var height = Number(img.dataset.height);\r\n if (!viewWidth || !width || !height)\r\n return;\r\n if (width > viewWidth) {\r\n height = (viewWidth / width) * height;\r\n width = viewWidth;\r\n }\r\n img.style.width = width + \"px\";\r\n img.style.height = height + \"px\";\r\n });\r\n}\r\nfunction onPalyVideo(e) {\r\n getViewElement()\r\n .querySelectorAll('video,audio')\r\n .forEach(function (media) {\r\n if (media !== e.target) {\r\n media.pause();\r\n }\r\n });\r\n}\r\nfunction fixVideoSize() {\r\n getViewElement()\r\n .querySelectorAll('video')\r\n .forEach(function (video) {\r\n video.setAttribute('controls', '');\r\n video.setAttribute('preload', 'auto');\r\n video.setAttribute('webkit-playsinline', '');\r\n video.setAttribute('playsinline', '');\r\n video.setAttribute('x5-playsinline', '');\r\n video.setAttribute('controlsList', 'nodownload');\r\n video.removeAttribute('autopaly');\r\n video.removeAttribute('loop');\r\n video.removeEventListener('playing', onPalyVideo);\r\n video.addEventListener('playing', onPalyVideo);\r\n console.log(video.shadowRoot);\r\n var viewWidth = getViewWidth();\r\n if (!viewWidth)\r\n return;\r\n var width = Number(video.dataset.width);\r\n var height = Number(video.dataset.height);\r\n if (!width || !height || width < height) {\r\n width = viewWidth;\r\n height = viewWidth;\r\n }\r\n else {\r\n height = (viewWidth / width) * height;\r\n width = viewWidth;\r\n }\r\n video.style.width = width + \"px\";\r\n video.style.height = height + \"px\";\r\n });\r\n}\r\nwindow.pageHiddenReceiver = function (data) {\r\n document.querySelectorAll('video,audio').forEach(function (media) {\r\n media.pause();\r\n });\r\n};\r\nfunction fixSize() {\r\n fixImageSize();\r\n fixVideoSize();\r\n}\r\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNC5qcyIsInNvdXJjZXMiOlsid2VicGFjazovLy8uL3NyYy9jb21tb24udHM/ODA0OSJdLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgZnVuY3Rpb24gZ2V0Vmlld0VsZW1lbnQoKSB7XG4gIHJldHVybiBkb2N1bWVudC5xdWVyeVNlbGVjdG9yPEhUTUxEaXZFb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b1NpemUoKVxufVxuIl0sIm1hcHBpbmdzIjoiQUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFDQTtBQUNBO0FBRUE7QUFDQTtBQUVBO0FBQ0E7QUFDQTtBQUVBO0FBQ0E7QUFDQTtBQUVBO0FBQ0E7QUFDQTtBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBRUE7QUFDQTtBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBRUE7QUFBQTtBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFFQTtBQUNBO0FBRUE7QUFFQTtBQUNBO0FBQUE7QUFFQTtBQUNBO0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUVBO0FBQ0E7QUFDQTtBQUNBOyIsInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///4\n")},function(module,exports,__webpack_require__){eval("(function (factory) {\n if (true) {\n // Node/CommonJS\n module.exports = factory();\n } else { var glob; }\n}(function (undefined) {\n\n 'use strict';\n\n /*\n * Fastest md5 implementation around (JKM md5).\n * Credits: Joseph Myers\n *\n * @see http://www.myersdaily.org/joseph/javascript/md5-text.html\n * @see http://jsperf.com/md5-shootout/7\n */\n\n /* this function is much faster,\n so if possible we use it. Some IEs\n are the only ones I know of that\n need the idiotic second function,\n generated by an if clause. */\n var add32 = function (a, b) {\n return (a + b) & 0xFFFFFFFF;\n },\n hex_chr = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'];\n\n\n function cmn(q, a, b, x, s, t) {\n a = add32(add32(a, q), add32(x, t));\n return add32((a << s) | (a >>> (32 - s)), b);\n }\n\n function md5cycle(x, k) {\n var a = x[0],\n b = x[1],\n c = x[2],\n d = x[3];\n\n a += (b & c | ~b & d) + k[0] - 680876936 | 0;\n a = (a << 7 | a >>> 25) + b | 0;\n d += (a & b | ~a & c) + k[1] - 389564586 | 0;\n d = (d << 12 | d >>> 20) + a | 0;\n c += (d & a | ~d & b) + k[2] + 606105819 | 0;\n c = (c << 17 | c >>> 15) + d | 0;\n b += (c & d | ~c & a) + k[3] - 1044525330 | 0;\n b = (b << 22 | b >>> 10) + c | 0;\n a += (b & c | ~b & d) + k[4] - 176418897 | 0;\n a = (a << 7 | a >>> 25) + b | 0;\n d += (a & b | ~a & c) + k[5] + 1200080426 | 0;\n d = (d << 12 | d >>> 20) + a | 0;\n c += (d & a | ~d & b) + k[6] - 1473231341 | 0;\n c = (c << 17 | c >>> 15) + d | 0;\n b += (c & d | ~c & a) + k[7] - 45705983 | 0;\n b = (b << 22 | b >>> 10) + c | 0;\n a += (b & c | ~b & d) + k[8] + 1770035416 | 0;\n a = (a << 7 | a >>> 25) + b | 0;\n d += (a & b | ~a & c) + k[9] - 1958414417 | 0;\n d = (d << 12 | d >>> 20) + a | 0;\n c += (d & a | ~d & b) + k[10] - 42063 | 0;\n c = (c << 17 | c >>> 15) + d | 0;\n b += (c & d | ~c & a) + k[11] - 1990404162 | 0;\n b = (b << 22 | b >>> 10) + c | 0;\n a += (b & c | ~b & d) + k[12] + 1804603682 | 0;\n a = (a << 7 | a >>> 25) + b | 0;\n d += (a & b | ~a & c) + k[13] - 40341101 | 0;\n d = (d << 12 | d >>> 20) + a | 0;\n c += (d & a | ~d & b) + k[14] - 1502002290 | 0;\n c = (c << 17 | c >>> 15) + d | 0;\n b += (c & d | ~c & a) + k[15] + 1236535329 | 0;\n b = (b << 22 | b >>> 10) + c | 0;\n\n a += (b & d | c & ~d) + k[1] - 165796510 | 0;\n a = (a << 5 | a >>> 27) + b | 0;\n d += (a & c | b & ~c) + k[6] - 1069501632 | 0;\n d = (d << 9 | d >>> 23) + a | 0;\n c += (d & b | a & ~b) + k[11] + 643717713 | 0;\n c = (c << 14 | c >>> 18) + d | 0;\n b += (c & a | d & ~a) + k[0] - 373897302 | 0;\n b = (b << 20 | b >>> 12) + c | 0;\n a += (b & d | c & ~d) + k[5] - 701558691 | 0;\n a = (a << 5 | a >>> 27) + b | 0;\n d += (a & c | b & ~c) + k[10] + 38016083 | 0;\n d = (d << 9 | d >>> 23) + a | 0;\n c += (d & b | a & ~b) + k[15] - 660478335 | 0;\n c = (c << 14 | c >>> 18) + d | 0;\n b += (c & a | d & ~a) + k[4] - 405537848 | 0;\n b = (b << 20 | b >>> 12) + c | 0;\n a += (b & d | c & ~d) + k[9] + 568446438 | 0;\n a = (a << 5 | a >>> 27) + b | 0;\n d += (a & c | b & ~c) + k[14] - 1019803690 | 0;\n d = (d << 9 | d >>> 23) + a | 0;\n c += (d & b | a & ~b) + k[3] - 187363961 | 0;\n c = (c << 14 | c >>> 18) + d | 0;\n b += (c & a | d & ~a) + k[8] + 1163531501 | 0;\n b = (b << 20 | b >>> 12) + c | 0;\n a += (b & d | c & ~d) + k[13] - 1444681467 | 0;\n a = (a << 5 | a >>> 27) + b | 0;\n d += (a & c | b & ~c) + k[2] - 51403784 | 0;\n d = (d << 9 | d >>> 23) + a | 0;\n c += (d & b | a & ~b) + k[7] + 1735328473 | 0;\n c = (c << 14 | c >>> 18) + d | 0;\n b += (c & a | d & ~a) + k[12] - 1926607734 | 0;\n b = (b << 20 | b >>> 12) + c | 0;\n\n a += (b ^ c ^ d) + k[5] - 378558 | 0;\n a = (a << 4 | a >>> 28) + b | 0;\n d += (a ^ b ^ c) + k[8] - 2022574463 | 0;\n d = (d << 11 | d >>> 21) + a | 0;\n c += (d ^ a ^ b) + k[11] + 1839030562 | 0;\n c = (c << 16 | c >>> 16) + d | 0;\n b += (c ^ d ^ a) + k[14] - 35309556 | 0;\n b = (b << 23 | b >>> 9) + c | 0;\n a += (b ^ c ^ d) + k[1] - 1530992060 | 0;\n a = (a << 4 | a >>> 28) + b | 0;\n d += (a ^ b ^ c) + k[4] + 1272893353 | 0;\n d = (d << 11 | d >>> 21) + a | 0;\n c += (d ^ a ^ b) + k[7] - 155497632 | 0;\n c = (c << 16 | c >>> 16) + d | 0;\n b += (c ^ d ^ a) + k[10] - 1094730640 | 0;\n b = (b << 23 | b >>> 9) + c | 0;\n a += (b ^ c ^ d) + k[13] + 681279174 | 0;\n a = (a << 4 | a >>> 28) + b | 0;\n d += (a ^ b ^ c) + k[0] - 358537222 | 0;\n d = (d << 11 | d >>> 21) + a | 0;\n c += (d ^ a ^ b) + k[3] - 722521979 | 0;\n c = (c << 16 | c >>> 16) + d | 0;\n b += (c ^ d ^ a) + k[6] + 76029189 | 0;\n b = (b << 23 | b >>> 9) + c | 0;\n a += (b ^ c ^ d) + k[9] - 640364487 | 0;\n a = (a << 4 | a >>> 28) + b | 0;\n d += (a ^ b ^ c) + k[12] - 421815835 | 0;\n d = (d << 11 | d >>> 21) + a | 0;\n c += (d ^ a ^ b) + k[15] + 530742520 | 0;\n c = (c << 16 | c >>> 16) + d | 0;\n b += (c ^ d ^ a) + k[2] - 995338651 | 0;\n b = (b << 23 | b >>> 9) + c | 0;\n\n a += (c ^ (b | ~d)) + k[0] - 198630844 | 0;\n a = (a << 6 | a >>> 26) + b | 0;\n d += (b ^ (a | ~c)) + k[7] + 1126891415 | 0;\n d = (d << 10 | d >>> 22) + a | 0;\n c += (a ^ (d | ~b)) + k[14] - 1416354905 | 0;\n c = (c << 15 | c >>> 17) + d | 0;\n b += (d ^ (c | ~a)) + k[5] - 57434055 | 0;\n b = (b << 21 |b >>> 11) + c | 0;\n a += (c ^ (b | ~d)) + k[12] + 1700485571 | 0;\n a = (a << 6 | a >>> 26) + b | 0;\n d += (b ^ (a | ~c)) + k[3] - 1894986606 | 0;\n d = (d << 10 | d >>> 22) + a | 0;\n c += (a ^ (d | ~b)) + k[10] - 1051523 | 0;\n c = (c << 15 | c >>> 17) + d | 0;\n b += (d ^ (c | ~a)) + k[1] - 2054922799 | 0;\n b = (b << 21 |b >>> 11) + c | 0;\n a += (c ^ (b | ~d)) + k[8] + 1873313359 | 0;\n a = (a << 6 | a >>> 26) + b | 0;\n d += (b ^ (a | ~c)) + k[15] - 30611744 | 0;\n d = (d << 10 | d >>> 22) + a | 0;\n c += (a ^ (d | ~b)) + k[6] - 1560198380 | 0;\n c = (c << 15 | c >>> 17) + d | 0;\n b += (d ^ (c | ~a)) + k[13] + 1309151649 | 0;\n b = (b << 21 |b >>> 11) + c | 0;\n a += (c ^ (b | ~d)) + k[4] - 145523070 | 0;\n a = (a << 6 | a >>> 26) + b | 0;\n d += (b ^ (a | ~c)) + k[11] - 1120210379 | 0;\n d = (d << 10 | d >>> 22) + a | 0;\n c += (a ^ (d | ~b)) + k[2] + 718787259 | 0;\n c = (c << 15 | c >>> 17) + d | 0;\n b += (d ^ (c | ~a)) + k[9] - 343485551 | 0;\n b = (b << 21 | b >>> 11) + c | 0;\n\n x[0] = a + x[0] | 0;\n x[1] = b + x[1] | 0;\n x[2] = c + x[2] | 0;\n x[3] = d + x[3] | 0;\n }\n\n function md5blk(s) {\n var md5blks = [],\n i; /* Andy King said do it this way. */\n\n for (i = 0; i < 64; i += 4) {\n md5blks[i >> 2] = s.charCodeAt(i) + (s.charCodeAt(i + 1) << 8) + (s.charCodeAt(i + 2) << 16) + (s.charCodeAt(i + 3) << 24);\n }\n return md5blks;\n }\n\n function md5blk_array(a) {\n var md5blks = [],\n i; /* Andy King said do it this way. */\n\n for (i = 0; i < 64; i += 4) {\n md5blks[i >> 2] = a[i] + (a[i + 1] << 8) + (a[i + 2] << 16) + (a[i + 3] << 24);\n }\n return md5blks;\n }\n\n function md51(s) {\n var n = s.length,\n state = [1732584193, -271733879, -1732584194, 271733878],\n i,\n length,\n tail,\n tmp,\n lo,\n hi;\n\n for (i = 64; i <= n; i += 64) {\n md5cycle(state, md5blk(s.substring(i - 64, i)));\n }\n s = s.substring(i - 64);\n length = s.length;\n tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];\n for (i = 0; i < length; i += 1) {\n tail[i >> 2] |= s.charCodeAt(i) << ((i % 4) << 3);\n }\n tail[i >> 2] |= 0x80 << ((i % 4) << 3);\n if (i > 55) {\n md5cycle(state, tail);\n for (i = 0; i < 16; i += 1) {\n tail[i] = 0;\n }\n }\n\n // Beware that the final length might not fit in 32 bits so we take care of that\n tmp = n * 8;\n tmp = tmp.toString(16).match(/(.*?)(.{0,8})$/);\n lo = parseInt(tmp[2], 16);\n hi = parseInt(tmp[1], 16) || 0;\n\n tail[14] = lo;\n tail[15] = hi;\n\n md5cycle(state, tail);\n return state;\n }\n\n function md51_array(a) {\n var n = a.length,\n state = [1732584193, -271733879, -1732584194, 271733878],\n i,\n length,\n tail,\n tmp,\n lo,\n hi;\n\n for (i = 64; i <= n; i += 64) {\n md5cycle(state, md5blk_array(a.subarray(i - 64, i)));\n }\n\n // Not sure if it is a bug, however IE10 will always produce a sub array of length 1\n // containing the last element of the parent array if the sub array specified starts\n // beyond the length of the parent array - weird.\n // https://connect.microsoft.com/IE/feedback/details/771452/typed-array-subarray-issue\n a = (i - 64) < n ? a.subarray(i - 64) : new Uint8Array(0);\n\n length = a.length;\n tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];\n for (i = 0; i < length; i += 1) {\n tail[i >> 2] |= a[i] << ((i % 4) << 3);\n }\n\n tail[i >> 2] |= 0x80 << ((i % 4) << 3);\n if (i > 55) {\n md5cycle(state, tail);\n for (i = 0; i < 16; i += 1) {\n tail[i] = 0;\n }\n }\n\n // Beware that the final length might not fit in 32 bits so we take care of that\n tmp = n * 8;\n tmp = tmp.toString(16).match(/(.*?)(.{0,8})$/);\n lo = parseInt(tmp[2], 16);\n hi = parseInt(tmp[1], 16) || 0;\n\n tail[14] = lo;\n tail[15] = hi;\n\n md5cycle(state, tail);\n\n return state;\n }\n\n function rhex(n) {\n var s = '',\n j;\n for (j = 0; j < 4; j += 1) {\n s += hex_chr[(n >> (j * 8 + 4)) & 0x0F] + hex_chr[(n >> (j * 8)) & 0x0F];\n }\n return s;\n }\n\n function hex(x) {\n var i;\n for (i = 0; i < x.length; i += 1) {\n x[i] = rhex(x[i]);\n }\n return x.join('');\n }\n\n // In some cases the fast add32 function cannot be used..\n if (hex(md51('hello')) !== '5d41402abc4b2a76b9719d911017c592') {\n add32 = function (x, y) {\n var lsw = (x & 0xFFFF) + (y & 0xFFFF),\n msw = (x >> 16) + (y >> 16) + (lsw >> 16);\n return (msw << 16) | (lsw & 0xFFFF);\n };\n }\n\n // ---------------------------------------------------\n\n /**\n * ArrayBuffer slice polyfill.\n *\n * @see https://github.com/ttaubert/node-arraybuffer-slice\n */\n\n if (typeof ArrayBuffer !== 'undefined' && !ArrayBuffer.prototype.slice) {\n (function () {\n function clamp(val, length) {\n val = (val | 0) || 0;\n\n if (val < 0) {\n return Math.max(val + length, 0);\n }\n\n return Math.min(val, length);\n }\n\n ArrayBuffer.prototype.slice = function (from, to) {\n var length = this.byteLength,\n begin = clamp(from, length),\n end = length,\n num,\n target,\n targetArray,\n sourceArray;\n\n if (to !== undefined) {\n end = clamp(to, length);\n }\n\n if (begin > end) {\n return new ArrayBuffer(0);\n }\n\n num = end - begin;\n target = new ArrayBuffer(num);\n targetArray = new Uint8Array(target);\n\n sourceArray = new Uint8Array(this, begin, num);\n targetArray.set(sourceArray);\n\n return target;\n };\n })();\n }\n\n // ---------------------------------------------------\n\n /**\n * Helpers.\n */\n\n function toUtf8(str) {\n if (/[\\u0080-\\uFFFF]/.test(str)) {\n str = unescape(encodeURIComponent(str));\n }\n\n return str;\n }\n\n function utf8Str2ArrayBuffer(str, returnUInt8Array) {\n var length = str.length,\n buff = new ArrayBuffer(length),\n arr = new Uint8Array(buff),\n i;\n\n for (i = 0; i < length; i += 1) {\n arr[i] = str.charCodeAt(i);\n }\n\n return returnUInt8Array ? arr : buff;\n }\n\n function arrayBuffer2Utf8Str(buff) {\n return String.fromCharCode.apply(null, new Uint8Array(buff));\n }\n\n function concatenateArrayBuffers(first, second, returnUInt8Array) {\n var result = new Uint8Array(first.byteLength + second.byteLength);\n\n result.set(new Uint8Array(first));\n result.set(new Uint8Array(second), first.byteLength);\n\n return returnUInt8Array ? result : result.buffer;\n }\n\n function hexToBinaryString(hex) {\n var bytes = [],\n length = hex.length,\n x;\n\n for (x = 0; x < length - 1; x += 2) {\n bytes.push(parseInt(hex.substr(x, 2), 16));\n }\n\n return String.fromCharCode.apply(String, bytes);\n }\n\n // ---------------------------------------------------\n\n /**\n * SparkMD5 OOP implementation.\n *\n * Use this class to perform an incremental md5, otherwise use the\n * static methods instead.\n */\n\n function SparkMD5() {\n // call reset to init the instance\n this.reset();\n }\n\n /**\n * Appends a string.\n * A conversion will be applied if an utf8 string is detected.\n *\n * @param {String} str The string to be appended\n *\n * @return {SparkMD5} The instance itself\n */\n SparkMD5.prototype.append = function (str) {\n // Converts the string to utf8 bytes if necessary\n // Then append as binary\n this.appendBinary(toUtf8(str));\n\n return this;\n };\n\n /**\n * Appends a binary string.\n *\n * @param {String} contents The binary string to be appended\n *\n * @return {SparkMD5} The instance itself\n */\n SparkMD5.prototype.appendBinary = function (contents) {\n this._buff += contents;\n this._length += contents.length;\n\n var length = this._buff.length,\n i;\n\n for (i = 64; i <= length; i += 64) {\n md5cycle(this._hash, md5blk(this._buff.substring(i - 64, i)));\n }\n\n this._buff = this._buff.substring(i - 64);\n\n return this;\n };\n\n /**\n * Finishes the incremental computation, reseting the internal state and\n * returning the result.\n *\n * @param {Boolean} raw True to get the raw string, false to get the hex string\n *\n * @return {String} The result\n */\n SparkMD5.prototype.end = function (raw) {\n var buff = this._buff,\n length = buff.length,\n i,\n tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n ret;\n\n for (i = 0; i < length; i += 1) {\n tail[i >> 2] |= buff.charCodeAt(i) << ((i % 4) << 3);\n }\n\n this._finish(tail, length);\n ret = hex(this._hash);\n\n if (raw) {\n ret = hexToBinaryString(ret);\n }\n\n this.reset();\n\n return ret;\n };\n\n /**\n * Resets the internal state of the computation.\n *\n * @return {SparkMD5} The instance itself\n */\n SparkMD5.prototype.reset = function () {\n this._buff = '';\n this._length = 0;\n this._hash = [1732584193, -271733879, -1732584194, 271733878];\n\n return this;\n };\n\n /**\n * Gets the internal state of the computation.\n *\n * @return {Object} The state\n */\n SparkMD5.prototype.getState = function () {\n return {\n buff: this._buff,\n length: this._length,\n hash: this._hash\n };\n };\n\n /**\n * Gets the internal state of the computation.\n *\n * @param {Object} state The state\n *\n * @return {SparkMD5} The instance itself\n */\n SparkMD5.prototype.setState = function (state) {\n this._buff = state.buff;\n this._length = state.length;\n this._hash = state.hash;\n\n return this;\n };\n\n /**\n * Releases memory used by the incremental buffer and other additional\n * resources. If you plan to use the instance again, use reset instead.\n */\n SparkMD5.prototype.destroy = function () {\n delete this._hash;\n delete this._buff;\n delete this._length;\n };\n\n /**\n * Finish the final calculation based on the tail.\n *\n * @param {Array} tail The tail (will be modified)\n * @param {Number} length The length of the remaining buffer\n */\n SparkMD5.prototype._finish = function (tail, length) {\n var i = length,\n tmp,\n lo,\n hi;\n\n tail[i >> 2] |= 0x80 << ((i % 4) << 3);\n if (i > 55) {\n md5cycle(this._hash, tail);\n for (i = 0; i < 16; i += 1) {\n tail[i] = 0;\n }\n }\n\n // Do the final computation based on the tail and length\n // Beware that the final length may not fit in 32 bits so we take care of that\n tmp = this._length * 8;\n tmp = tmp.toString(16).match(/(.*?)(.{0,8})$/);\n lo = parseInt(tmp[2], 16);\n hi = parseInt(tmp[1], 16) || 0;\n\n tail[14] = lo;\n tail[15] = hi;\n md5cycle(this._hash, tail);\n };\n\n /**\n * Performs the md5 hash on a string.\n * A conversion will be applied if utf8 string is detected.\n *\n * @param {String} str The string\n * @param {Boolean} raw True to get the raw string, false to get the hex string\n *\n * @return {String} The result\n */\n SparkMD5.hash = function (str, raw) {\n // Converts the string to utf8 bytes if necessary\n // Then compute it using the binary function\n return SparkMD5.hashBinary(toUtf8(str), raw);\n };\n\n /**\n * Performs the md5 hash on a binary string.\n *\n * @param {String} content The binary string\n * @param {Boolean} raw True to get the raw string, false to get the hex string\n *\n * @return {String} The result\n */\n SparkMD5.hashBinary = function (content, raw) {\n var hash = md51(content),\n ret = hex(hash);\n\n return raw ? hexToBinaryString(ret) : ret;\n };\n\n // ---------------------------------------------------\n\n /**\n * SparkMD5 OOP implementation for array buffers.\n *\n * Use this class to perform an incremental md5 ONLY for array buffers.\n */\n SparkMD5.ArrayBuffer = function () {\n // call reset to init the instance\n this.reset();\n };\n\n /**\n * Appends an array buffer.\n *\n * @param {ArrayBuffer} arr The array to be appended\n *\n * @return {SparkMD5.ArrayBuffer} The instance itself\n */\n SparkMD5.ArrayBuffer.prototype.append = function (arr) {\n var buff = concatenateArrayBuffers(this._buff.buffer, arr, true),\n length = buff.length,\n i;\n\n this._length += arr.byteLength;\n\n for (i = 64; i <= length; i += 64) {\n md5cycle(this._hash, md5blk_array(buff.subarray(i - 64, i)));\n }\n\n this._buff = (i - 64) < length ? new Uint8Array(buff.buffer.slice(i - 64)) : new Uint8Array(0);\n\n return this;\n };\n\n /**\n * Finishes the incremental computation, reseting the internal state and\n * returning the result.\n *\n * @param {Boolean} raw True to get the raw string, false to get the hex string\n *\n * @return {String} The result\n */\n SparkMD5.ArrayBuffer.prototype.end = function (raw) {\n var buff = this._buff,\n length = buff.length,\n tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n i,\n ret;\n\n for (i = 0; i < length; i += 1) {\n tail[i >> 2] |= buff[i] << ((i % 4) << 3);\n }\n\n this._finish(tail, length);\n ret = hex(this._hash);\n\n if (raw) {\n ret = hexToBinaryString(ret);\n }\n\n this.reset();\n\n return ret;\n };\n\n /**\n * Resets the internal state of the computation.\n *\n * @return {SparkMD5.ArrayBuffer} The instance itself\n */\n SparkMD5.ArrayBuffer.prototype.reset = function () {\n this._buff = new Uint8Array(0);\n this._length = 0;\n this._hash = [1732584193, -271733879, -1732584194, 271733878];\n\n return this;\n };\n\n /**\n * Gets the internal state of the computation.\n *\n * @return {Object} The state\n */\n SparkMD5.ArrayBuffer.prototype.getState = function () {\n var state = SparkMD5.prototype.getState.call(this);\n\n // Convert buffer to a string\n state.buff = arrayBuffer2Utf8Str(state.buff);\n\n return state;\n };\n\n /**\n * Gets the internal state of the computation.\n *\n * @param {Object} state The state\n *\n * @return {SparkMD5.ArrayBuffer} The instance itself\n */\n SparkMD5.ArrayBuffer.prototype.setState = function (state) {\n // Convert string to buffer\n state.buff = utf8Str2ArrayBuffer(state.buff, true);\n\n return SparkMD5.prototype.setState.call(this, state);\n };\n\n SparkMD5.ArrayBuffer.prototype.destroy = SparkMD5.prototype.destroy;\n\n SparkMD5.ArrayBuffer.prototype._finish = SparkMD5.prototype._finish;\n\n /**\n * Performs the md5 hash on an array buffer.\n *\n * @param {ArrayBuffer} arr The array buffer\n * @param {Boolean} raw True to get the raw string, false to get the hex one\n *\n * @return {String} The result\n */\n SparkMD5.ArrayBuffer.hash = function (arr, raw) {\n var hash = md51_array(new Uint8Array(arr)),\n ret = hex(hash);\n\n return raw ? hexToBinaryString(ret) : ret;\n };\n\n return SparkMD5;\n}));\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNS5qcyIsInNvdXJjZXMiOlsid2VicGFjazovLy8uL25vZGVfbW9kdWxlcy9zcGFyay1tZDUvc3BhcmstbWQ1LmpzPzY5YTAiXSwic291cmNlc0NvbnRlbnQiOlsiKGZ1bmN0aW9uIChmYWN0b3J5KSB7XG4gICAgaWYgKHR5cGVvZiBleHBvcnRzID09P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GlvbiAoeCwgeSkge1xuICAgICAgICAgICAgdmFyIGxzdyA9ICh4ICYgMHhGRkZGKSArICh5ICYgMHhGRkZGKSxcbiAgICAgICAgICAgICAgICBtc3cgPSAoeCA+PiAxNikgKyAoeSA+PiAxNikgKyAobHN3ID4+IDE2KTtcbiAgICAgICAgICAgIHJldHVybiAobXN3IDw8IDE2KSB8IChsc3cgJiAweEZGRkYpO1xuICAgICAgICB9O1xuICAgIH1cblxuICAgIC8vIC0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLVxuXG4gICAgLyoqXG4gICAgICogQXJyYXlCdWZmZXIgc2xpY2UgcG9seWZpbGwuXG4gICAgICpcbiAgICAgKiBAc2VlIGh0dHBzOi8vZ2l0aHViLmNvbS90dGF1YmVydC9ub2RlLWFycmF5YnVmZmVyLXNsaWNlXG4gICAgICovXG5cbiAgICBpZiAodHlwZW9mIEFycmF5QnVmZmVyICE9PSAndW5kZWZpbmVkJyAmJiAhQXJyYXlCdWZmZXIucHJvdG90eXBlLnNsaWNlKSB7XG4gICAgICAgIChmdW5jdGlvbiAoKSB7XG4gICAgICAgICAgICBmdW5jdGlvbiBjbGFtcCh2YWwsIGxlbmd0aCkge1xuICAgICAgICAgICAgICAgIHZhbCA9ICh2YWwgfCAwKSB8fCAwO1xuXG4gICAgICAgICAgICAgICAgaWYgKHZhbCA8IDApIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE1hdGgubWF4KHZhbCArIGxlbmd0aCwgMCk7XG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgcmV0dXJuIE1hdGgubWluKHZhbCwgbGVuZ3RoKTtcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgQXJyYXlCdWZmZXIucHJvdG90eXBlLnNsaWNlID0gZnVuY3Rpb24gKGZyb20sIHRvKSB7XG4gICAgICAgICAgICAgICAgdmFyIGxlbmd0aCA9IHRoaXMuYnl0ZUxlbmd0aCxcbiAgICAgICAgICAgICAgICAgICAgYmVnaW4gPSBjbGFtcChmcm9tLCBsZW5ndGgpLFxuICAgICAgICAgICAgICAgICAgICBlbmQgPSBsZW5ndGgsXG4gICAgICAgICAgICAgICAgICAgIG51bSxcbiAgICAgICAgICAgICAgICAgICAgdGFyZ2V0LFxuICAgICAgICAgICAgICAgICAgICB0YXJnZXRBcnJheSxcbiAgICAgICAgICAgICAgICAgICAgc291cmNlQXJyYXk7XG5cbiAgICAgICAgICAgICAgICBpZiAodG8gIT09IHVuZGVmaW5lZCkge1xuICAgICAgICAgICAgICAgICAgICBlbmQgPSBjbGFtcCh0bywgbGVuZ3RoKTtcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICBpZiAoYmVnaW4gPiBlbmQpIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG5ldyBBcnJheUJ1ZmZlcigwKTtcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICBudW0gPSBlbmQgLSBiZWdpbjtcbiAgICAgICAgICAgICAgICB0YXJnZXQgPSBuZXcgQXJyYXlCdWZmZXIobnVtKTtcbiAgICAgICAgICAgICAgICB0YXJnZXRBcnJheSA9IG5ldyBVaW50OEFycmF5KHRhcmdldCk7XG5cbiAgICAgICAgICAgICAgICBzb3VyY2VBcnJheSA9IG5ldyBVaW50OEFycmF5KHRoaXMsIGJlZ2luLCBudW0pO1xuICAgICAgICAgICAgICAgIHRhcmdldEFycmF5LnNldChzb3VyY2VBcnJheSk7XG5cbiAgICAgICAgICAgICAgICByZXR1cm4gdGFyZ2V0O1xuICAgICAgICAgICAgfTtcbiAgICAgICAgfSkoKTtcbiAgICB9XG5cbiAgICAvLyAtLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS1cblxuICAgIC8qKlxuICAgICAqIEhlbHBlcnMuXG4gICAgICovXG5cbiAgICBmdW5jdGlv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gICAgICAgaWYgKHJhdykge1xuICAgICAgICAgICAgcmV0ID0gaGV4VG9CaW5hcnlTdHJpbmcocmV0KTtcbiAgICAgICAgfVxuXG4gICAgICAgIHRoaXMucmVzZXQoKTtcblxuICAgICAgICByZXR1cm4gcmV0O1xuICAgIH07XG5cbiAgICAvKipcbiAgICAgKiBSZXNldHMgdGhlIGludGVybmFsIHN0YXRlIG9mIHRoZSBjb21wdXRhdGlvbi5cbiAgICAgKlxuICAgICAqIEByZXR1cm4ge1NwYXJrTUQ1fSBUaGUgaW5zdGFuY2UgaXRzZWxmXG4gICAgICovXG4gICAgU3BhcmtNRDUucHJvdG90eXBlLnJlc2V0ID0gZnVuY3Rpb24gKCkge1xuICAgICAgICB0aGlzLl9idWZmID0gJyc7XG4gICAgICAgIHRoaXMuX2xlbmd0aCA9IDA7XG4gICAgICAgIHRoaXMuX2hhc2ggPSBbMTczMjU4NDE5MywgLTI3MTczMzg3OSwgLTE3MzI1ODQxOTQsIDI3MTczMzg3OF07XG5cbiAgICAgICAgcmV0dXJuIHRoaXM7XG4gICAgfTtcblxuICAgIC8qKlxuICAgICAqIEdldHMgdGhlIGludGVybmFsIHN0YXRlIG9mIHRoZSBjb21wdXRhdGlvbi5cbiAgICAgKlxuICAgICAqIEByZXR1cm4ge09iamVjdH0gVGhlIHN0YXRlXG4gICAgICovXG4gICAgU3BhcmtNRDUucHJvdG90eXBlLmdldFN0YXRlID0gZnVuY3Rpb24gKCkge1xuICAgICAgICByZXR1cm4ge1xuICAgICAgICAgICAgYnVmZjogdGhpcy5fYnVmZixcbiAgICAgICAgICAgIGxlbmd0aDogdGhpcy5fbGVuZ3RoLFxuICAgICAgICAgICAgaGFzaDogdGhpcy5faGFzaFxuICAgICAgICB9O1xuICAgIH07XG5cbiAgICAvKipcbiAgICAgKiBHZXRzIHRoZSBpbnRlcm5hbCBzdGF0ZSBvZiB0aGUgY29tcHV0YXRpb24uXG4gICAgICpcbiAgICAgKiBAcGFyYW0ge09iamVjdH0g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FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTsiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///5\n")},function(module,exports,__webpack_require__){"use strict";eval("\n\nmodule.exports = function bind(fn, thisArg) {\n return function wrap() {\n var args = new Array(arguments.length);\n for (var i = 0; i < args.length; i++) {\n args[i] = arguments[i];\n }\n return fn.apply(thisArg, args);\n };\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNi5qcyIsInNvdXJjZXMiOlsid2VicGFjazovLy8uL25vZGVfbW9kdWxlcy9heGlvcy9saWIvaGVscGVycy9iaW5kLmpzPzFkMmIiXSwic291cmNlc0NvbnRlbnQiOlsiJ3VzZSBzdHJpY3QnO1xuXG5tb2R1bGUuZXhwb3J0cyA9IGZ1bmN0aW9uIGJpbmQoZm4sIHRoaXNBcmcpIHtcbiAgcmV0dXJuIGZ1bmN0aW9uIHdyYXAoKSB7XG4gICAgdmFyIGFyZ3MgPSBuZXcgQXJyYXkoYXJndW1lbnRzLmxlbmd0aCk7XG4gICAgZm9yICh2YXIgaSA9IDA7IGkgPCBhcmdzLmxlbmd0aDsgaSsrKSB7XG4gICAgICBhcmdzW2ldID0gYXJndW1lbnRzW2ldO1xuICAgIH1cbiAgICByZXR1cm4gZm4uYXBwbHkodGhpc0FyZywgYXJncyk7XG4gIH07XG59O1xuIl0sIm1hcHBpbmdzIjoiQUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOyIsInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///6\n")},function(module,exports,__webpack_require__){"use strict";eval("\n\nvar utils = __webpack_require__(0);\n\nfunction encode(val) {\n return encodeURIComponent(val).\n replace(/%40/gi, '@').\n replace(/%3A/gi, ':').\n replace(/%24/g, '$').\n replace(/%2C/gi, ',').\n replace(/%20/g, '+').\n replace(/%5B/gi, '[').\n replace(/%5D/gi, ']');\n}\n\n/**\n * Build a URL by appending params to the end\n *\n * @param {string} url The base of the url (e.g., http://www.google.com)\n * @param {object} [params] The params to be appended\n * @returns {string} The formatted url\n */\nmodule.exports = function buildURL(url, params, paramsSerializer) {\n /*eslint no-param-reassign:0*/\n if (!params) {\n return url;\n }\n\n var serializedParams;\n if (paramsSerializer) {\n serializedParams = paramsSerializer(params);\n } else if (utils.isURLSearchParams(params)) {\n serializedParams = params.toString();\n } else {\n var parts = [];\n\n utils.forEach(params, function serialize(val, key) {\n if (val === null || typeof val === 'undefined') {\n return;\n }\n\n if (utils.isArray(val)) {\n key = key + '[]';\n } else {\n val = [val];\n }\n\n utils.forEach(val, function parseValue(v) {\n if (utils.isDate(v)) {\n v = v.toISOString();\n } else if (utils.isObject(v)) {\n v = JSON.stringify(v);\n }\n parts.push(encode(key) + '=' + encode(v));\n });\n });\n\n serializedParams = parts.join('&');\n }\n\n if (serializedParams) {\n var hashmarkIndex = url.indexOf('#');\n if (hashmarkIndex !== -1) {\n url = url.slice(0, hashmarkIndex);\n }\n\n url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;\n }\n\n return url;\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNy5qcyIsInNvdXJjZXMiOlsid2VicGFjazovLy8uL25vZGVfbW9kdWxlcy9heGlvcy9saWIvaGVscGVycy9idWlsZFVSTC5qcz8zMGI1Il0sInNvdXJjZXNDb250ZW50IjpbIid1c2Ugc3RyaWN0JztcblxudmFyIHV0aWxzID0gcmVxdWlyZSgnLi8uLi91dGlscycpO1xuXG5mdW5jdGlvbiBlbmNvZGUodmFsKSB7XG4gIHJldHVybiBlbmNvZGVVUklDb21wb25lbnQodmFsKS5cbiAgICByZXBsYWNlKC8lNDAvZ2ksICdAJykuXG4gICAgcmVwbGFjZSgvJTNBL2dpLCAnOicpLlxuICAgIHJlcGxhY2UoLyUyNC9nLCAnJCcpLlxuICAgIHJlcGxhY2UoLyUyQy9naSwgJywnKS5cbiAgICByZXBsYWNlKC8lMjAvZywgJysnKS5cbiAgICByZXBsYWNlKC8lNUIvZ2ksICdbJykuXG4gICAgcmVwbGFjZSgvJTVEL2dpLCAnXScpO1xufVxuXG4vKipcbiAqIEJ1aWxkIGEgVVJMIGJ5IGFwcGVuZGluZyBwYXJhbXMgdG8gdGhlIGVuZFxuICpcbiAqIEBwYXJhbSB7c3RyaW5nfSB1cmwgVGhlIGJhc2Ugb2YgdGhlIHVybCAoZS5nLiwgaHR0cDovL3d3dy5nb29nbGUuY29tKVxuICogQHBhcmFtIHtvYmplY3R9IFtwYXJhbXNdIFRoZSBwYXJhbXMgdG8gYmUgYXBwZW5kZWRcbiAqIEByZXR1cm5zIHtzdHJpbmd9IFRoZSBmb3JtYXR0ZWQgdXJsXG4gKi9cbm1vZHVsZS5leHBvcnRzID0gZnVu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ports = function isCancel(value) {\n return !!(value && value.__CANCEL__);\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiOC5qcyIsInNvdXJjZXMiOlsid2VicGFjazovLy8uL25vZGVfbW9kdWxlcy9heGlvcy9saWIvY2FuY2VsL2lzQ2FuY2VsLmpzPzJlNjciXSwic291cmNlc0NvbnRlbnQiOlsiJ3VzZSBzdHJpY3QnO1xuXG5tb2R1bGUuZXhwb3J0cyA9IGZ1bmN0aW9uIGlzQ2FuY2VsKHZhbHVlKSB7XG4gIHJldHVybiAhISh2YWx1ZSAmJiB2YWx1ZS5fX0NBTkNFTF9fKTtcbn07XG4iXSwibWFwcGluZ3MiOiJBQUFBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7Iiwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///8\n")},function(module,exports,__webpack_require__){"use strict";eval("/* WEBPACK VAR INJECTION */(function(process) {\n\nvar utils = __webpack_require__(0);\nvar normalizeHeaderName = __webpack_require__(24);\n\nvar DEFAULT_CONTENT_TYPE = {\n 'Content-Type': 'application/x-www-form-urlencoded'\n};\n\nfunction setContentTypeIfUnset(headers, value) {\n if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) {\n headers['Content-Type'] = value;\n }\n}\n\nfunction getDefaultAdapter() {\n var adapter;\n // Only Node.JS has a process variable that is of [[Class]] process\n if (typeof process !== 'undefined' && Object.prototype.toString.call(process) === '[object process]') {\n // For node use HTTP adapter\n adapter = __webpack_require__(10);\n } else if (typeof XMLHttpRequest !== 'undefined') {\n // For browsers use XHR adapter\n adapter = __webpack_require__(10);\n }\n return adapter;\n}\n\nvar defaults = {\n adapter: getDefaultAdapter(),\n\n transformRequest: [function transformRequest(data, headers) {\n normalizeHeaderName(headers, 'Accept');\n normalizeHeaderName(headers, 'Content-Type');\n if (utils.isFormData(data) ||\n utils.isArrayBuffer(data) ||\n utils.isBuffer(data) ||\n utils.isStream(data) ||\n utils.isFile(data) ||\n utils.isBlob(data)\n ) {\n return data;\n }\n if (utils.isArrayBufferView(data)) {\n return data.buffer;\n }\n if (utils.isURLSearchParams(data)) {\n setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8');\n return data.toString();\n }\n if (utils.isObject(data)) {\n setContentTypeIfUnset(headers, 'application/json;charset=utf-8');\n return JSON.stringify(data);\n }\n return data;\n }],\n\n transformResponse: [function transformResponse(data) {\n /*eslint no-param-reassign:0*/\n if (typeof data === 'string') {\n try {\n data = JSON.parse(data);\n } catch (e) { /* Ignore */ }\n }\n return data;\n }],\n\n /**\n * A timeout in milliseconds to abort a request. If set to 0 (default) a\n * timeout is not created.\n */\n timeout: 0,\n\n xsrfCookieName: 'XSRF-TOKEN',\n xsrfHeaderName: 'X-XSRF-TOKEN',\n\n maxContentLength: -1,\n\n validateStatus: function validateStatus(status) {\n return status >= 200 && status < 300;\n }\n};\n\ndefaults.headers = {\n common: {\n 'Accept': 'application/json, text/plain, */*'\n }\n};\n\nutils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {\n defaults.headers[method] = {};\n});\n\nutils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {\n defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);\n});\n\nmodule.exports = defaults;\n\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(23)))//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiOS5qcyIsInNvdXJjZXMiOlsid2VicGFjazovLy8uL25vZGVfbW9kdWxlcy9heGlvcy9saWIvZGVmYXVsdHMuanM/MjQ0NCJdLCJzb3VyY2VzQ29udGVudCI6WyIndXNlIHN0cmljdCc7XG5cbnZhciB1dGlscyA9IHJlcXVpcmUoJy4vdXRpbHMnKTtcbnZhciBub3JtYWxpemVIZWFkZXJOYW1lID0gcmVxdWlyZSgnLi9oZWxw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ports,__webpack_require__){"use strict";eval("\n\nvar utils = __webpack_require__(0);\nvar settle = __webpack_require__(25);\nvar buildURL = __webpack_require__(7);\nvar parseHeaders = __webpack_require__(27);\nvar isURLSameOrigin = __webpack_require__(28);\nvar createError = __webpack_require__(11);\n\nmodule.exports = function xhrAdapter(config) {\n return new Promise(function dispatchXhrRequest(resolve, reject) {\n var requestData = config.data;\n var requestHeaders = config.headers;\n\n if (utils.isFormData(requestData)) {\n delete requestHeaders['Content-Type']; // Let the browser set it\n }\n\n var request = new XMLHttpRequest();\n\n // HTTP basic authentication\n if (config.auth) {\n var username = config.auth.username || '';\n var password = config.auth.password || '';\n requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password);\n }\n\n request.open(config.method.toUpperCase(), buildURL(config.url, config.params, config.paramsSerializer), true);\n\n // Set the request timeout in MS\n request.timeout = config.timeout;\n\n // Listen for ready state\n request.onreadystatechange = function handleLoad() {\n if (!request || request.readyState !== 4) {\n return;\n }\n\n // The request errored out and we didn't get a response, this will be\n // handled by onerror instead\n // With one exception: request that using file: protocol, most browsers\n // will return status as 0 even though it's a successful request\n if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {\n return;\n }\n\n // Prepare the response\n var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null;\n var responseData = !config.responseType || config.responseType === 'text' ? request.responseText : request.response;\n var response = {\n data: responseData,\n status: request.status,\n statusText: request.statusText,\n headers: responseHeaders,\n config: config,\n request: request\n };\n\n settle(resolve, reject, response);\n\n // Clean up request\n request = null;\n };\n\n // Handle browser request cancellation (as opposed to a manual cancellation)\n request.onabort = function handleAbort() {\n if (!request) {\n return;\n }\n\n reject(createError('Request aborted', config, 'ECONNABORTED', request));\n\n // Clean up request\n request = null;\n };\n\n // Handle low level network errors\n request.onerror = function handleError() {\n // Real errors are hidden from us by the browser\n // onerror should only fire if it's a network error\n reject(createError('Network Error', config, null, request));\n\n // Clean up request\n request = null;\n };\n\n // Handle timeout\n request.ontimeout = function handleTimeout() {\n reject(createError('timeout of ' + config.timeout + 'ms exceeded', config, 'ECONNABORTED',\n request));\n\n // Clean up request\n request = null;\n };\n\n // Add xsrf header\n // This is only done if running in a standard browser environment.\n // Specifically not if we're in a web worker, or react-native.\n if (utils.isStandardBrowserEnv()) {\n var cookies = __webpack_require__(29);\n\n // Add xsrf header\n var xsrfValue = (config.withCredentials || isURLSameOrigin(config.url)) && config.xsrfCookieName ?\n cookies.read(config.xsrfCookieName) :\n undefined;\n\n if (xsrfValue) {\n requestHeaders[config.xsrfHeaderName] = xsrfValue;\n }\n }\n\n // Add headers to the request\n if ('setRequestHeader' in request) {\n utils.forEach(requestHeaders, function setRequestHeader(val, key) {\n if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') {\n // Remove Content-Type if data is undefined\n delete requestHeaders[key];\n } else {\n // Otherwise add header to the request\n request.setRequestHeader(key, val);\n }\n });\n }\n\n // Add withCredentials to request if needed\n if (config.withCredentials) {\n request.withCredentials = true;\n }\n\n // Add responseType to request if needed\n if (config.responseType) {\n try {\n request.responseType = config.responseType;\n } catch (e) {\n // Expected DOMException thrown by browsers not compatible XMLHttpRequest Level 2.\n // But, this can be suppressed for 'json' type as it can be parsed by default 'transformResponse' function.\n if (config.responseType !== 'json') {\n throw e;\n }\n }\n }\n\n // Handle progress if needed\n if (typeof config.onDownloadProgress === 'function') {\n request.addEventListener('progress', config.onDownloadProgress);\n }\n\n // Not all browsers support upload events\n if (typeof config.onUploadProgress === 'function' && request.upload) {\n request.upload.addEventListener('progress', config.onUploadProgress);\n }\n\n if (config.cancelToken) {\n // Handle cancellation\n config.cancelToken.promise.then(function onCanceled(cancel) {\n if (!request) {\n return;\n }\n\n request.abort();\n reject(cancel);\n // Clean up request\n request = null;\n });\n }\n\n if (requestData === undefined) {\n requestData = null;\n }\n\n // Send the request\n request.send(requestData);\n });\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2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0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOyIsInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///10\n")},function(module,exports,__webpack_require__){"use strict";eval("\n\nvar enhanceError = __webpack_require__(26);\n\n/**\n * Create an Error with the specified message, config, error code, request and response.\n *\n * @param {string} message The error message.\n * @param {Object} config The config.\n * @param {string} [code] The error code (for example, 'ECONNABORTED').\n * @param {Object} [request] The request.\n * @param {Object} [response] The response.\n * @returns {Error} The created error.\n */\nmodule.exports = function createError(message, config, code, request, response) {\n var error = new Error(message);\n return enhanceError(error, config, code, request, response);\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMTEuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYXhpb3MvbGliL2NvcmUvY3JlYXRlRXJyb3IuanM/MmQ4MyJdLCJzb3VyY2VzQ29udGVudCI6WyIndXNlIHN0cmljdCc7XG5cbnZhciBlbmhhbmNlRXJyb3IgPSByZXF1aXJlKCcuL2VuaGFuY2VFcnJvcicpO1xuXG4vKipcbiAqIENyZWF0ZSBhbiBFcnJvciB3aXRoIHRoZSBzcGVjaWZpZWQgbWVzc2FnZSwgY29uZmlnLCBlcnJvciBjb2RlLCByZXF1ZXN0IGFuZCByZXNwb25zZS5cbiAqXG4gKiBAcGFyYW0ge3N0cmluZ30gbWVzc2FnZSBUaGUgZXJyb3IgbWVzc2FnZS5cbiAqIEBwYXJhbSB7T2JqZWN0fSBjb25maWcgVGhlIGNvbmZpZy5cbiAqIEBwYXJhbSB7c3RyaW5nfSBbY29kZV0gVGhlIGVycm9yIGNvZGUgKGZvciBleGFtcGxlLCAnRUNPTk5BQk9SVEVEJykuXG4gKiBAcGFyYW0ge09iamVjdH0gW3JlcXVlc3RdIFRoZSByZXF1ZXN0LlxuICogQHBhcmFtIHtPYmplY3R9IFtyZXNwb25zZV0gVGhlIHJlc3BvbnNlLlxuICogQHJldHVybnMge0Vycm9yfSBUaGUgY3JlYXRlZCBlcnJvci5cbiAqL1xubW9kdWxlLmV4cG9ydHMgPSBmdW5jdGlvbiBjcmVhdGVFcnJvcihtZXNzYWdlLCBjb25maWcsIGNvZGUsIHJlcXVlc3QsIHJlc3BvbnNlKSB7XG4gIHZhciBlcnJvciA9IG5ldyBFcnJvcihtZXNzYWdlKTtcbiAgcmV0dXJuIGVuaGFuY2VFcnJvcihlcnJvciwgY29uZmlnLCBjb2RlLCByZXF1ZXN0LCByZXNwb25zZSk7XG59O1xuIl0sIm1hcHBpbmdzIjoiQUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7Iiwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///11\n")},function(module,exports,__webpack_require__){"use strict";eval("\n\nvar utils = __webpack_require__(0);\n\n/**\n * Config-specific merge-function which creates a new config-object\n * by merging two configuration objects together.\n *\n * @param {Object} config1\n * @param {Object} config2\n * @returns {Object} New object resulting from merging config2 to config1\n */\nmodule.exports = function mergeConfig(config1, config2) {\n // eslint-disable-next-line no-param-reassign\n config2 = config2 || {};\n var config = {};\n\n utils.forEach(['url', 'method', 'params', 'data'], function valueFromConfig2(prop) {\n if (typeof config2[prop] !== 'undefined') {\n config[prop] = config2[prop];\n }\n });\n\n utils.forEach(['headers', 'auth', 'proxy'], function mergeDeepProperties(prop) {\n if (utils.isObject(config2[prop])) {\n config[prop] = utils.deepMerge(config1[prop], config2[prop]);\n } else if (typeof config2[prop] !== 'undefined') {\n config[prop] = config2[prop];\n } else if (utils.isObject(config1[prop])) {\n config[prop] = utils.deepMerge(config1[prop]);\n } else if (typeof config1[prop] !== 'undefined') {\n config[prop] = config1[prop];\n }\n });\n\n utils.forEach([\n 'baseURL', 'transformRequest', 'transformResponse', 'paramsSerializer',\n 'timeout', 'withCredentials', 'adapter', 'responseType', 'xsrfCookieName',\n 'xsrfHeaderName', 'onUploadProgress', 'onDownloadProgress', 'maxContentLength',\n 'validateStatus', 'maxRedirects', 'httpAgent', 'httpsAgent', 'cancelToken',\n 'socketPath'\n ], function defaultToConfig2(prop) {\n if (typeof config2[prop] !== 'undefined') {\n config[prop] = config2[prop];\n } else if (typeof config1[prop] !== 'undefined') {\n config[prop] = config1[prop];\n }\n });\n\n return config;\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMTIuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYXhpb3MvbGliL2NvcmUvbWVyZ2VDb25maWcuanM/NGE3YiJdLCJzb3VyY2VzQ29udGVudCI6WyIndXNlIHN0cmljdCc7XG5cbnZhciB1dGlscyA9IHJlcXVpcmUoJy4uL3V0aWxzJyk7XG5cbi8qKlxuICogQ29uZmlnLXNwZWNpZmljIG1lcmdlLWZ1bmN0aW9uIHdoaWNoIGNyZWF0ZXMgYSBuZXcgY29uZmlnLW9iamVjdFxuICogYnkgbWVyZ2luZyB0d28gY29uZmlndXJhdGlvbiBvYmplY3RzIHRvZ2V0aGVyLlxuICpcbiAqIEBwYXJhbSB7T2JqZWN0fSBjb25maWcxXG4gKiBAcGFyYW0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0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7Iiwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///12\n")},function(module,exports,__webpack_require__){"use strict";eval("\n\n/**\n * A `Cancel` is an object that is thrown when an operation is canceled.\n *\n * @class\n * @param {string=} message The message.\n */\nfunction Cancel(message) {\n this.message = message;\n}\n\nCancel.prototype.toString = function toString() {\n return 'Cancel' + (this.message ? ': ' + this.message : '');\n};\n\nCancel.prototype.__CANCEL__ = true;\n\nmodule.exports = Cancel;\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMTMuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYXhpb3MvbGliL2NhbmNlbC9DYW5jZWwuanM/N2E3NyJdLCJzb3VyY2VzQ29udGVudCI6WyIndXNlIHN0cmljdCc7XG5cbi8qKlxuICogQSBgQ2FuY2VsYCBpcyBhbiBvYmplY3QgdGhhdCBpcyB0aHJvd24gd2hlbiBhbiBvcGVyYXRpb24gaXMgY2FuY2VsZWQuXG4gKlxuICogQGNsYXNzXG4gKiBAcGFyYW0ge3N0cmluZz19IG1lc3NhZ2UgVGhlIG1lc3NhZ2UuXG4gKi9cbmZ1bmN0aW9uIENhbmNlbChtZXNzYWdlKSB7XG4gIHRoaXMubWVzc2FnZSA9IG1lc3NhZ2U7XG59XG5cbkNhbmNlbC5wcm90b3R5cGUudG9TdHJpbmcgPSBmdW5jdGlvbiB0b1N0cmluZygpIHtcbiAgcmV0dXJuICdDYW5jZWwnICsgKHRoaXMubWVzc2FnZSA/ICc6ICcgKyB0aGlzLm1lc3NhZ2UgOiAnJyk7XG59O1xuXG5DYW5jZWwucHJvdG90eXBlLl9fQ0FOQ0VMX18gPSB0cnVlO1xuXG5tb2R1bGUuZXhwb3J0cyA9IENhbmNlbDtcbiJdLCJtYXBwaW5ncyI6IkFBQUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7Iiwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///13\n")},function(module,exports,__webpack_require__){"use strict";eval("\n\nvar has = Object.prototype.hasOwnProperty\n , prefix = '~';\n\n/**\n * Constructor to create a storage for our `EE` objects.\n * An `Events` instance is a plain object whose properties are event names.\n *\n * @constructor\n * @private\n */\nfunction Events() {}\n\n//\n// We try to not inherit from `Object.prototype`. In some engines creating an\n// instance in this way is faster than calling `Object.create(null)` directly.\n// If `Object.create(null)` is not supported we prefix the event names with a\n// character to make sure that the built-in object properties are not\n// overridden or used as an attack vector.\n//\nif (Object.create) {\n Events.prototype = Object.create(null);\n\n //\n // This hack is needed because the `__proto__` property is still inherited in\n // some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5.\n //\n if (!new Events().__proto__) prefix = false;\n}\n\n/**\n * Representation of a single event listener.\n *\n * @param {Function} fn The listener function.\n * @param {*} context The context to invoke the listener with.\n * @param {Boolean} [once=false] Specify if the listener is a one-time listener.\n * @constructor\n * @private\n */\nfunction EE(fn, context, once) {\n this.fn = fn;\n this.context = context;\n this.once = once || false;\n}\n\n/**\n * Add a listener for a given event.\n *\n * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn The listener function.\n * @param {*} context The context to invoke the listener with.\n * @param {Boolean} once Specify if the listener is a one-time listener.\n * @returns {EventEmitter}\n * @private\n */\nfunction addListener(emitter, event, fn, context, once) {\n if (typeof fn !== 'function') {\n throw new TypeError('The listener must be a function');\n }\n\n var listener = new EE(fn, context || emitter, once)\n , evt = prefix ? prefix + event : event;\n\n if (!emitter._events[evt]) emitter._events[evt] = listener, emitter._eventsCount++;\n else if (!emitter._events[evt].fn) emitter._events[evt].push(listener);\n else emitter._events[evt] = [emitter._events[evt], listener];\n\n return emitter;\n}\n\n/**\n * Clear event by name.\n *\n * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.\n * @param {(String|Symbol)} evt The Event name.\n * @private\n */\nfunction clearEvent(emitter, evt) {\n if (--emitter._eventsCount === 0) emitter._events = new Events();\n else delete emitter._events[evt];\n}\n\n/**\n * Minimal `EventEmitter` interface that is molded against the Node.js\n * `EventEmitter` interface.\n *\n * @constructor\n * @public\n */\nfunction EventEmitter() {\n this._events = new Events();\n this._eventsCount = 0;\n}\n\n/**\n * Return an array listing the events for which the emitter has registered\n * listeners.\n *\n * @returns {Array}\n * @public\n */\nEventEmitter.prototype.eventNames = function eventNames() {\n var names = []\n , events\n , name;\n\n if (this._eventsCount === 0) return names;\n\n for (name in (events = this._events)) {\n if (has.call(events, name)) names.push(prefix ? name.slice(1) : name);\n }\n\n if (Object.getOwnPropertySymbols) {\n return names.concat(Object.getOwnPropertySymbols(events));\n }\n\n return names;\n};\n\n/**\n * Return the listeners registered for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @returns {Array} The registered listeners.\n * @public\n */\nEventEmitter.prototype.listeners = function listeners(event) {\n var evt = prefix ? prefix + event : event\n , handlers = this._events[evt];\n\n if (!handlers) return [];\n if (handlers.fn) return [handlers.fn];\n\n for (var i = 0, l = handlers.length, ee = new Array(l); i < l; i++) {\n ee[i] = handlers[i].fn;\n }\n\n return ee;\n};\n\n/**\n * Return the number of listeners listening to a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @returns {Number} The number of listeners.\n * @public\n */\nEventEmitter.prototype.listenerCount = function listenerCount(event) {\n var evt = prefix ? prefix + event : event\n , listeners = this._events[evt];\n\n if (!listeners) return 0;\n if (listeners.fn) return 1;\n return listeners.length;\n};\n\n/**\n * Calls each of the listeners registered for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @returns {Boolean} `true` if the event had listeners, else `false`.\n * @public\n */\nEventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {\n var evt = prefix ? prefix + event : event;\n\n if (!this._events[evt]) return false;\n\n var listeners = this._events[evt]\n , len = arguments.length\n , args\n , i;\n\n if (listeners.fn) {\n if (listeners.once) this.removeListener(event, listeners.fn, undefined, true);\n\n switch (len) {\n case 1: return listeners.fn.call(listeners.context), true;\n case 2: return listeners.fn.call(listeners.context, a1), true;\n case 3: return listeners.fn.call(listeners.context, a1, a2), true;\n case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true;\n case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;\n case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;\n }\n\n for (i = 1, args = new Array(len -1); i < len; i++) {\n args[i - 1] = arguments[i];\n }\n\n listeners.fn.apply(listeners.context, args);\n } else {\n var length = listeners.length\n , j;\n\n for (i = 0; i < length; i++) {\n if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true);\n\n switch (len) {\n case 1: listeners[i].fn.call(listeners[i].context); break;\n case 2: listeners[i].fn.call(listeners[i].context, a1); break;\n case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break;\n case 4: listeners[i].fn.call(listeners[i].context, a1, a2, a3); break;\n default:\n if (!args) for (j = 1, args = new Array(len -1); j < len; j++) {\n args[j - 1] = arguments[j];\n }\n\n listeners[i].fn.apply(listeners[i].context, args);\n }\n }\n }\n\n return true;\n};\n\n/**\n * Add a listener for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn The listener function.\n * @param {*} [context=this] The context to invoke the listener with.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.on = function on(event, fn, context) {\n return addListener(this, event, fn, context, false);\n};\n\n/**\n * Add a one-time listener for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn The listener function.\n * @param {*} [context=this] The context to invoke the listener with.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.once = function once(event, fn, context) {\n return addListener(this, event, fn, context, true);\n};\n\n/**\n * Remove the listeners of a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn Only remove the listeners that match this function.\n * @param {*} context Only remove the listeners that have this context.\n * @param {Boolean} once Only remove one-time listeners.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) {\n var evt = prefix ? prefix + event : event;\n\n if (!this._events[evt]) return this;\n if (!fn) {\n clearEvent(this, evt);\n return this;\n }\n\n var listeners = this._events[evt];\n\n if (listeners.fn) {\n if (\n listeners.fn === fn &&\n (!once || listeners.once) &&\n (!context || listeners.context === context)\n ) {\n clearEvent(this, evt);\n }\n } else {\n for (var i = 0, events = [], length = listeners.length; i < length; i++) {\n if (\n listeners[i].fn !== fn ||\n (once && !listeners[i].once) ||\n (context && listeners[i].context !== context)\n ) {\n events.push(listeners[i]);\n }\n }\n\n //\n // Reset the array, or remove it completely if we have no more listeners.\n //\n if (events.length) this._events[evt] = events.length === 1 ? events[0] : events;\n else clearEvent(this, evt);\n }\n\n return this;\n};\n\n/**\n * Remove all listeners, or those of the specified event.\n *\n * @param {(String|Symbol)} [event] The event name.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.removeAllListeners = function removeAllListeners(event) {\n var evt;\n\n if (event) {\n evt = prefix ? prefix + event : event;\n if (this._events[evt]) clearEvent(this, evt);\n } else {\n this._events = new Events();\n this._eventsCount = 0;\n }\n\n return this;\n};\n\n//\n// Alias methods names because people roll like that.\n//\nEventEmitter.prototype.off = EventEmitter.prototype.removeListener;\nEventEmitter.prototype.addListener = EventEmitter.prototype.on;\n\n//\n// Expose the prefix.\n//\nEventEmitter.prefixed = prefix;\n\n//\n// Allow `EventEmitter` to be imported as module namespace.\n//\nEventEmitter.EventEmitter = EventEmitter;\n\n//\n// Expose the module.\n//\nif (true) {\n module.exports = EventEmitter;\n}\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMTQuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvZXZlbnRlbWl0dGVyMy9pbmRleC5qcz9iYTEwIl0sInNvdXJjZXNDb250ZW50IjpbIid1c2Ugc3RyaWN0JztcblxudmFyIGhhcyA9IE9iamVjdC5wcm90b3R5cGUuaGFzT3duUHJvcGVydHlcbiAgLCBwcmVmaXggPSAnfic7XG5cbi8qKlxuICogQ29uc3RydWN0b3IgdG8gY3JlYXRlIGEgc3RvcmFnZSBmb3Igb3VyIGBFRWAgb2JqZWN0cy5cbiAqIEFuIGBFdmVudHNgIGluc3RhbmNlIGlzIGEgcGxhaW4gb2JqZWN0IHdob3NlIHByb3BlcnRpZXMgYXJlIGV2ZW50IG5hbWVzLlxuICpcbiAqIEBjb25zdHJ1Y3RvclxuICogQHByaXZhdGVcbiAqL1xuZnVuY3Rpb24gRXZlbnRzKCkge31cblxuLy9cbi8vIFdlIHRyeSB0byBub3QgaW5oZXJpdCBmcm9tIGBPYmplY3QucHJvdG90eXBlYC4gSW4gc29tZSBlbmdpbmVzIGNyZWF0aW5nIGFuXG4vLyBpbnN0YW5jZSBpbiB0aGlzIHdheSBpcyBmYXN0ZXIgdGhhbiBjYWxsaW5nIGBPYmplY3QuY3JlYXRlKG51bGwpYCBkaXJlY3RseS5cbi8vIElmIGBPYmplY3QuY3JlYXRlKG51bGwpYCBpcyBub3Qgc3VwcG9ydGVkIHdlIHByZWZpeCB0aGUgZXZlbnQgbmFtZXMgd2l0aCBhXG4v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UNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOyIsInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///14\n")},function(module,exports,__webpack_require__){eval("// extracted by mini-css-extract-plugin//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMTUuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvcXVpbGwvYXNzZXRzL3Nub3cuc3R5bD80NjE5Il0sInNvdXJjZXNDb250ZW50IjpbIi8vIGV4dHJhY3RlZCBieSBtaW5pLWNzcy1leHRyYWN0LXBsdWdpbiJdLCJtYXBwaW5ncyI6IkFBQUEiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///15\n")},function(module,exports,__webpack_require__){eval("// extracted by mini-css-extract-plugin//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMTYuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9zcmMvcHJldmlldy5zdHlsPzFkMTMiXSwic291cmNlc0NvbnRlbnQiOlsiLy8gZXh0cmFjdGVkIGJ5IG1pbmktY3NzLWV4dHJhY3QtcGx1Z2luIl0sIm1hcHBpbmdzIjoiQUFBQSIsInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///16\n")},function(module,exports,__webpack_require__){"use strict";eval("\n\nvar utils = __webpack_require__(0);\nvar bind = __webpack_require__(6);\nvar Axios = __webpack_require__(19);\nvar mergeConfig = __webpack_require__(12);\nvar defaults = __webpack_require__(9);\n\n/**\n * Create an instance of Axios\n *\n * @param {Object} defaultConfig The default config for the instance\n * @return {Axios} A new instance of Axios\n */\nfunction createInstance(defaultConfig) {\n var context = new Axios(defaultConfig);\n var instance = bind(Axios.prototype.request, context);\n\n // Copy axios.prototype to instance\n utils.extend(instance, Axios.prototype, context);\n\n // Copy context to instance\n utils.extend(instance, context);\n\n return instance;\n}\n\n// Create the default instance to be exported\nvar axios = createInstance(defaults);\n\n// Expose Axios class to allow class inheritance\naxios.Axios = Axios;\n\n// Factory for creating new instances\naxios.create = function create(instanceConfig) {\n return createInstance(mergeConfig(axios.defaults, instanceConfig));\n};\n\n// Expose Cancel & CancelToken\naxios.Cancel = __webpack_require__(13);\naxios.CancelToken = __webpack_require__(32);\naxios.isCancel = __webpack_require__(8);\n\n// Expose all/spread\naxios.all = function all(promises) {\n return Promise.all(promises);\n};\naxios.spread = __webpack_require__(33);\n\nmodule.exports = axios;\n\n// Allow use of default import syntax in TypeScript\nmodule.exports.default = axios;\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMTcuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYXhpb3MvbGliL2F4aW9zLmpzP2NlZTQiXSwic291cmNlc0NvbnRlbnQiOlsiJ3VzZSBzdHJpY3QnO1xuXG52YXIgdXRpbHMgPSByZXF1aXJlKCcuL3V0aWxzJyk7XG52YXIgYmluZCA9IHJlcXVpcmUoJy4vaGVscGVycy9iaW5kJyk7XG52YXIg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BQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOyIsInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///17\n")},function(module,exports){eval("/*!\n * Determine if an object is a Buffer\n *\n * @author Feross Aboukhadijeh \n * @license MIT\n */\n\nmodule.exports = function isBuffer (obj) {\n return obj != null && obj.constructor != null &&\n typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj)\n}\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMTguanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYXhpb3Mvbm9kZV9tb2R1bGVzL2lzLWJ1ZmZlci9pbmRleC5qcz9jN2NlIl0sInNvdXJjZXNDb250ZW50IjpbIi8qIVxuICogRGV0ZXJtaW5lIGlmIGFuIG9iamVjdCBpcyBhIEJ1ZmZlclxuICpcbiAqIEBhdXRob3IgICBGZXJvc3MgQWJvdWtoYWRpamVoIDxodHRwczovL2Zlcm9zcy5vcmc+XG4gKiBAbGljZW5zZSAgTUlUXG4gKi9cblxubW9kdWxlLmV4cG9ydHMgPSBmdW5jdGlvbiBpc0J1ZmZlciAob2JqKSB7XG4gIHJldHVybiBvYmogIT0gbnVsbCAmJiBvYmouY29uc3RydWN0b3IgIT0gbnVsbCAmJlxuICAgIHR5cGVvZiBvYmouY29uc3RydWN0b3IuaXNCdWZmZXIgPT09ICdmdW5jdGlvbicgJiYgb2JqLmNvbnN0cnVjdG9yLmlzQnVmZmVyKG9iailcbn1cbiJdLCJtYXBwaW5ncyI6IkFBQUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTsiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///18\n")},function(module,exports,__webpack_require__){"use strict";eval("\n\nvar utils = __webpack_require__(0);\nvar buildURL = __webpack_require__(7);\nvar InterceptorManager = __webpack_require__(20);\nvar dispatchRequest = __webpack_require__(21);\nvar mergeConfig = __webpack_require__(12);\n\n/**\n * Create a new instance of Axios\n *\n * @param {Object} instanceConfig The default config for the instance\n */\nfunction Axios(instanceConfig) {\n this.defaults = instanceConfig;\n this.interceptors = {\n request: new InterceptorManager(),\n response: new InterceptorManager()\n };\n}\n\n/**\n * Dispatch a request\n *\n * @param {Object} config The config specific for this request (merged with this.defaults)\n */\nAxios.prototype.request = function request(config) {\n /*eslint no-param-reassign:0*/\n // Allow for axios('example/url'[, config]) a la fetch API\n if (typeof config === 'string') {\n config = arguments[1] || {};\n config.url = arguments[0];\n } else {\n config = config || {};\n }\n\n config = mergeConfig(this.defaults, config);\n config.method = config.method ? config.method.toLowerCase() : 'get';\n\n // Hook up interceptors middleware\n var chain = [dispatchRequest, undefined];\n var promise = Promise.resolve(config);\n\n this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {\n chain.unshift(interceptor.fulfilled, interceptor.rejected);\n });\n\n this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {\n chain.push(interceptor.fulfilled, interceptor.rejected);\n });\n\n while (chain.length) {\n promise = promise.then(chain.shift(), chain.shift());\n }\n\n return promise;\n};\n\nAxios.prototype.getUri = function getUri(config) {\n config = mergeConfig(this.defaults, config);\n return buildURL(config.url, config.params, config.paramsSerializer).replace(/^\\?/, '');\n};\n\n// Provide aliases for supported request methods\nutils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {\n /*eslint func-names:0*/\n Axios.prototype[method] = function(url, config) {\n return this.request(utils.merge(config || {}, {\n method: method,\n url: url\n }));\n };\n});\n\nutils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {\n /*eslint func-names:0*/\n Axios.prototype[method] = function(url, data, config) {\n return this.request(utils.merge(config || {}, {\n method: method,\n url: url,\n data: data\n }));\n };\n});\n\nmodule.exports = Axios;\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMTkuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYXhpb3MvbGliL2NvcmUvQXhpb3MuanM/MGEwNiJdLCJzb3VyY2VzQ29udGVudCI6WyIndXNlIHN0cmljdCc7XG5cbnZhciB1dGlscyA9IHJlcXVpcmUoJy4vLi4vdXRpbHMnKTtcbnZhciBidWlsZFVSTCA9IHJlcXVpcmUoJy4uL2hlbHBlcnMvYnVpbGRVUkwnKTtcbnZhciBJbnRlcmNlcHRvck1hbmFnZXIgPSByZXF1aXJlKCcuL0ludGVyY2VwdG9yTWFuYWdlcicpO1xudmFyIGRpc3BhdGNoUmVxdWVzdCA9IHJlcXVpcmUoJy4vZGlzcGF0Y2hSZXF1ZXN0Jyk7XG52YXIgbWVyZ2VDb25maWcgPSByZXF1aXJlKCcuL21lcmdlQ29uZmlnJyk7XG5cbi8qKlxuICogQ3JlYXRlIGEgbmV3IGluc3RhbmNlIG9mIEF4aW9zXG4gKlxuICogQHBhcmFtIHtPYmplY3R9IGluc3RhbmNlQ29uZmlnIFRoZSBkZWZhdWx0IGNvbmZpZyBmb3IgdGhlIGluc3RhbmNlXG4gKi9cbmZ1bmN0aW9uIEF4aW9zKGluc3RhbmNlQ29uZmlnKSB7XG4gIHRoaXMuZGVmYXVsdHMgPSBpbnN0YW5jZUNvbmZpZztcbiAgdGhpcy5pbnRlcmNlcHRvcnMgPSB7XG4gICAgcmVxdWVzdDogbmV3IEludGVyY2VwdG9yTWFuYWdlcigpLFxuICAgIHJlc3BvbnNlOiBuZXcgSW50ZXJjZXB0b3JNYW5hZ2VyKClcbiAgfTtcbn1cblxuLyoqXG4gKiBEaXNwYXRjaCBhIHJlcXVlc3RcbiAqXG4gKiBAcGFyYW0ge09iamVjd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\n")},function(module,exports,__webpack_require__){"use strict";eval("\n\nvar utils = __webpack_require__(0);\n\nfunction InterceptorManager() {\n this.handlers = [];\n}\n\n/**\n * Add a new interceptor to the stack\n *\n * @param {Function} fulfilled The function to handle `then` for a `Promise`\n * @param {Function} rejected The function to handle `reject` for a `Promise`\n *\n * @return {Number} An ID used to remove interceptor later\n */\nInterceptorManager.prototype.use = function use(fulfilled, rejected) {\n this.handlers.push({\n fulfilled: fulfilled,\n rejected: rejected\n });\n return this.handlers.length - 1;\n};\n\n/**\n * Remove an interceptor from the stack\n *\n * @param {Number} id The ID that was returned by `use`\n */\nInterceptorManager.prototype.eject = function eject(id) {\n if (this.handlers[id]) {\n this.handlers[id] = null;\n }\n};\n\n/**\n * Iterate over all the registered interceptors\n *\n * This method is particularly useful for skipping over any\n * interceptors that may have become `null` calling `eject`.\n *\n * @param {Function} fn The function to call for each interceptor\n */\nInterceptorManager.prototype.forEach = function forEach(fn) {\n utils.forEach(this.handlers, function forEachHandler(h) {\n if (h !== null) {\n fn(h);\n }\n });\n};\n\nmodule.exports = InterceptorManager;\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMjAuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYXhpb3MvbGliL2NvcmUvSW50ZXJjZXB0b3JNYW5hZ2VyLmpzP2Y2YjQiXSwic291cmNlc0NvbnRlbnQiOlsiJ3VzZSBzdHJpY3QnO1xuXG52YXIgdXRpbHMgPSByZXF1aXJlKCcuLy4uL3V0aWxzJyk7XG5cbmZ1bmN0aW9uIEludGVyY2VwdG9yTWFuYWdlcigpIHtcbiAgdGhpcy5oYW5kbGVycyA9IFtdO1xufVxuXG4vKipcbiAqIEFkZCBhIG5ldyBpbnRlcmNlcHRvciB0byB0aGUgc3RhY2tcbiAqXG4gKiBAcGFyYW0ge0Z1bmN0aW9ufSBmdWxmaWxsZWQg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WplY3RgLlxuICpcbiAqIEBwYXJhbSB7RnVuY3Rpb259IGZuIFRoZSBmdW5jdGlvbiB0byBjYWxsIGZvciBlYWNoIGludGVyY2VwdG9yXG4gKi9cbkludGVyY2VwdG9yTWFuYWdlci5wcm90b3R5cGUuZm9yRWFjaCA9IGZ1bmN0aW9uIGZvckVhY2goZm4pIHtcbiAgdXRpbHMuZm9yRWFjaCh0aGlzLmhhbmRsZXJzLCBmdW5jdGlvbiBmb3JFYWNoSGFuZGxlcihoKSB7XG4gICAgaWYgKGggIT09IG51bGwpIHtcbiAgICAgIGZuKGgpO1xuICAgIH1cbiAgfSk7XG59O1xuXG5tb2R1bGUuZXhwb3J0cyA9IEludGVyY2VwdG9yTWFuYWdlcjtcbiJdLCJtYXBwaW5ncyI6IkFBQUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7Iiwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///20\n")},function(module,exports,__webpack_require__){"use strict";eval("\n\nvar utils = __webpack_require__(0);\nvar transformData = __webpack_require__(22);\nvar isCancel = __webpack_require__(8);\nvar defaults = __webpack_require__(9);\nvar isAbsoluteURL = __webpack_require__(30);\nvar combineURLs = __webpack_require__(31);\n\n/**\n * Throws a `Cancel` if cancellation has been requested.\n */\nfunction throwIfCancellationRequested(config) {\n if (config.cancelToken) {\n config.cancelToken.throwIfRequested();\n }\n}\n\n/**\n * Dispatch a request to the server using the configured adapter.\n *\n * @param {object} config The config that is to be used for the request\n * @returns {Promise} The Promise to be fulfilled\n */\nmodule.exports = function dispatchRequest(config) {\n throwIfCancellationRequested(config);\n\n // Support baseURL config\n if (config.baseURL && !isAbsoluteURL(config.url)) {\n config.url = combineURLs(config.baseURL, config.url);\n }\n\n // Ensure headers exist\n config.headers = config.headers || {};\n\n // Transform request data\n config.data = transformData(\n config.data,\n config.headers,\n config.transformRequest\n );\n\n // Flatten headers\n config.headers = utils.merge(\n config.headers.common || {},\n config.headers[config.method] || {},\n config.headers || {}\n );\n\n utils.forEach(\n ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],\n function cleanHeaderConfig(method) {\n delete config.headers[method];\n }\n );\n\n var adapter = config.adapter || defaults.adapter;\n\n return adapter(config).then(function onAdapterResolution(response) {\n throwIfCancellationRequested(config);\n\n // Transform response data\n response.data = transformData(\n response.data,\n response.headers,\n config.transformResponse\n );\n\n return response;\n }, function onAdapterRejection(reason) {\n if (!isCancel(reason)) {\n throwIfCancellationRequested(config);\n\n // Transform response data\n if (reason && reason.response) {\n reason.response.data = transformData(\n reason.response.data,\n reason.response.headers,\n config.transformResponse\n );\n }\n }\n\n return Promise.reject(reason);\n });\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMjEuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYXhpb3MvbGliL2NvcmUvZGlzcGF0Y2hSZXF1ZXN0LmpzPzUyNzAiXSwic291cmNlc0NvbnRlbnQiOlsiJ3VzZSBzdHJpY3QnO1xuXG52YXIgdXRpbHMgPSByZXF1aXJlKCcuLy4uL3V0aWxzJyk7XG52YXIgdHJhbnNmb3JtRGF0YSA9IHJlcXVpcmUoJy4vdHJhbnNmb3JtRGF0YScpO1xudmFyIGlzQ2FuY2VsID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UNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7Iiwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///21\n")},function(module,exports,__webpack_require__){"use strict";eval("\n\nvar utils = __webpack_require__(0);\n\n/**\n * Transform the data for a request or a response\n *\n * @param {Object|String} data The data to be transformed\n * @param {Array} headers The headers for the request or response\n * @param {Array|Function} fns A single function or Array of functions\n * @returns {*} The resulting transformed data\n */\nmodule.exports = function transformData(data, headers, fns) {\n /*eslint no-param-reassign:0*/\n utils.forEach(fns, function transform(fn) {\n data = fn(data, headers);\n });\n\n return data;\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMjIuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYXhpb3MvbGliL2NvcmUvdHJhbnNmb3JtRGF0YS5qcz9jNDAxIl0sInNvdXJjZXNDb250ZW50IjpbIid1c2Ugc3RyaWN0JztcblxudmFyIHV0aWxzID0gcmVxdWlyZSgnLi8uLi91dGlscycpO1xuXG4vKipcbiAqIFRyYW5zZm9ybSB0aGUgZGF0YSBmb3IgYSByZXF1ZXN0IG9yIGEgcmVzcG9uc2VcbiAqXG4gKiBAcGFyYW0ge09iamVjdHxTdHJpbmd9IGRhdGEgVGhlIGRhdGEgdG8gYmUgdHJhbnNmb3JtZWRcbiAqIEBwYXJhbSB7QXJyYXl9IGhlYWRlcnMgVGhlIGhlYWRlcnMgZm9yIHRoZSByZXF1ZXN0IG9yIHJlc3BvbnNlXG4gKiBAcGFyYW0ge0FycmF5fEZ1bmN0aW9ufSBmbnMgQSBzaW5nbGUgZnVuY3Rpb24gb3IgQXJyYXkgb2YgZnVuY3Rpb25zXG4gKiBAcmV0dXJucyB7Kn0gVGhlIHJlc3VsdGluZyB0cmFuc2Zvcm1lZCBkYXRhXG4gKi9cbm1vZHVsZS5leHBvcnRzID0gZnVuY3Rpb24gdHJhbnNmb3JtRGF0YShkYXRhLCBoZWFkZXJzLCBmbnMpIHtcbiAgLyplc2xpbnQgbm8tcGFyYW0tcmVhc3NpZ246MCovXG4gIHV0aWxzLmZvckVhY2goZm5zLCBmdW5jdGlvbiB0cmFuc2Zvcm0oZm4pIHtcbiAgICBkYXRhID0gZm4oZGF0YSwgaGVhZGVycyk7XG4gIH0pO1xuXG4gIHJldHVybiBkYXRhO1xufTtcbiJdLCJtYXBwaW5ncyI6IkFBQUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTsiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///22\n")},function(module,exports){eval("// shim for using process in browser\nvar process = module.exports = {};\n\n// cached from whatever global is present so that test runners that stub it\n// don't break things. But we need to wrap it in a try catch in case it is\n// wrapped in strict mode code which doesn't define any globals. It's inside a\n// function because try/catches deoptimize in certain engines.\n\nvar cachedSetTimeout;\nvar cachedClearTimeout;\n\nfunction defaultSetTimout() {\n throw new Error('setTimeout has not been defined');\n}\nfunction defaultClearTimeout () {\n throw new Error('clearTimeout has not been defined');\n}\n(function () {\n try {\n if (typeof setTimeout === 'function') {\n cachedSetTimeout = setTimeout;\n } else {\n cachedSetTimeout = defaultSetTimout;\n }\n } catch (e) {\n cachedSetTimeout = defaultSetTimout;\n }\n try {\n if (typeof clearTimeout === 'function') {\n cachedClearTimeout = clearTimeout;\n } else {\n cachedClearTimeout = defaultClearTimeout;\n }\n } catch (e) {\n cachedClearTimeout = defaultClearTimeout;\n }\n} ())\nfunction runTimeout(fun) {\n if (cachedSetTimeout === setTimeout) {\n //normal enviroments in sane situations\n return setTimeout(fun, 0);\n }\n // if setTimeout wasn't available but was latter defined\n if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {\n cachedSetTimeout = setTimeout;\n return setTimeout(fun, 0);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedSetTimeout(fun, 0);\n } catch(e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedSetTimeout.call(null, fun, 0);\n } catch(e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error\n return cachedSetTimeout.call(this, fun, 0);\n }\n }\n\n\n}\nfunction runClearTimeout(marker) {\n if (cachedClearTimeout === clearTimeout) {\n //normal enviroments in sane situations\n return clearTimeout(marker);\n }\n // if clearTimeout wasn't available but was latter defined\n if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {\n cachedClearTimeout = clearTimeout;\n return clearTimeout(marker);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedClearTimeout(marker);\n } catch (e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedClearTimeout.call(null, marker);\n } catch (e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.\n // Some versions of I.E. have different rules for clearTimeout vs setTimeout\n return cachedClearTimeout.call(this, marker);\n }\n }\n\n\n\n}\nvar queue = [];\nvar draining = false;\nvar currentQueue;\nvar queueIndex = -1;\n\nfunction cleanUpNextTick() {\n if (!draining || !currentQueue) {\n return;\n }\n draining = false;\n if (currentQueue.length) {\n queue = currentQueue.concat(queue);\n } else {\n queueIndex = -1;\n }\n if (queue.length) {\n drainQueue();\n }\n}\n\nfunction drainQueue() {\n if (draining) {\n return;\n }\n var timeout = runTimeout(cleanUpNextTick);\n draining = true;\n\n var len = queue.length;\n while(len) {\n currentQueue = queue;\n queue = [];\n while (++queueIndex < len) {\n if (currentQueue) {\n currentQueue[queueIndex].run();\n }\n }\n queueIndex = -1;\n len = queue.length;\n }\n currentQueue = null;\n draining = false;\n runClearTimeout(timeout);\n}\n\nprocess.nextTick = function (fun) {\n var args = new Array(arguments.length - 1);\n if (arguments.length > 1) {\n for (var i = 1; i < arguments.length; i++) {\n args[i - 1] = arguments[i];\n }\n }\n queue.push(new Item(fun, args));\n if (queue.length === 1 && !draining) {\n runTimeout(drainQueue);\n }\n};\n\n// v8 likes predictible objects\nfunction Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}\nItem.prototype.run = function () {\n this.fun.apply(null, this.array);\n};\nprocess.title = 'browser';\nprocess.browser = true;\nprocess.env = {};\nprocess.argv = [];\nprocess.version = ''; // empty string to avoid regexp issues\nprocess.versions = {};\n\nfunction noop() {}\n\nprocess.on = noop;\nprocess.addListener = noop;\nprocess.once = noop;\nprocess.off = noop;\nprocess.removeListener = noop;\nprocess.removeAllListeners = noop;\nprocess.emit = noop;\nprocess.prependListener = noop;\nprocess.prependOnceListener = noop;\n\nprocess.listeners = function (name) { return [] }\n\nprocess.binding = function (name) {\n throw new Error('process.binding is not supported');\n};\n\nprocess.cwd = function () { return '/' };\nprocess.chdir = function (dir) {\n throw new Error('process.chdir is not supported');\n};\nprocess.umask = function() { return 0; };\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMjMuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvcHJvY2Vzcy9icm93c2VyLmpzP2YyOGMiXSwic291cmNlc0NvbnRlbnQiOlsiLy8gc2hpbSBmb3IgdXNpbmcgcHJvY2VzcyBpbiBicm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BQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7Iiwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///23\n")},function(module,exports,__webpack_require__){"use strict";eval("\n\nvar utils = __webpack_require__(0);\n\nmodule.exports = function normalizeHeaderName(headers, normalizedName) {\n utils.forEach(headers, function processHeader(value, name) {\n if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) {\n headers[normalizedName] = value;\n delete headers[name];\n }\n });\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMjQuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYXhpb3MvbGliL2hlbHBlcnMvbm9ybWFsaXplSGVhZGVyTmFtZS5qcz9jOGFmIl0sInNvdXJjZXNDb250ZW50IjpbIid1c2Ugc3RyaWN0JztcblxudmFyIHV0aWxzID0gcmVxdWlyZSgnLi4vdXRpbHMnKTtcblxubW9kdWxlLmV4cG9ydHMgPSBmdW5jdGlvbiBub3JtYWxpemVIZWFkZXJOYW1lKGhlYWRlcnMsIG5vcm1hbGl6ZWROYW1lKSB7XG4gIHV0aWxzLmZvckVhY2goaGVhZGVycywgZnVuY3Rpb24gcHJvY2Vzc0hlYWRlcih2YWx1ZSwgbmFtZSkge1xuICAgIGlmIChuYW1lICE9PSBub3JtYWxpemVkTmFtZSAmJiBuYW1lLnRvVXBwZXJDYXNlKCkgPT09IG5vcm1hbGl6ZWROYW1lLnRvVXBwZXJDYXNlKCkpIHtcbiAgICAgIGhlYWRlcnNbbm9ybWFsaXplZE5hbWVdID0gdmFsdWU7XG4gICAgICBkZWxldGUgaGVhZGVyc1tuYW1lXTtcbiAgICB9XG4gIH0pO1xufTtcbiJdLCJtYXBwaW5ncyI6IkFBQUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOyIsInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///24\n")},function(module,exports,__webpack_require__){"use strict";eval("\n\nvar createError = __webpack_require__(11);\n\n/**\n * Resolve or reject a Promise based on response status.\n *\n * @param {Function} resolve A function that resolves the promise.\n * @param {Function} reject A function that rejects the promise.\n * @param {object} response The response.\n */\nmodule.exports = function settle(resolve, reject, response) {\n var validateStatus = response.config.validateStatus;\n if (!validateStatus || validateStatus(response.status)) {\n resolve(response);\n } else {\n reject(createError(\n 'Request failed with status code ' + response.status,\n response.config,\n null,\n response.request,\n response\n ));\n }\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMjUuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYXhpb3MvbGliL2NvcmUvc2V0dGxlLmpzPzQ2N2YiXSwic291cmNlc0NvbnRlbnQiOlsiJ3VzZSBzdHJpY3QnO1xuXG52YXIgY3JlYXRlRXJyb3IgPSByZXF1aXJlKCcuL2NyZWF0ZUVycm9yJyk7XG5cbi8qKlxuICogUmVzb2x2ZSBvciByZWplY3QgYSBQcm9taXNlIGJhc2VkIG9uIHJlc3BvbnNlIHN0YXR1cy5cbiAqXG4gKiBAcGFyYW0ge0Z1bmN0aW9ufSByZXNvbHZlIEEgZnVuY3Rpb24gdGhhdCByZXNvbHZlcyB0aGUgcHJvbWlzZS5cbiAqIEBwYXJhbSB7RnVuY3Rpb259IHJlamVjdCBBIGZ1bmN0aW9uIHRoYXQgcmVqZWN0cyB0aGUgcHJvbWlzZS5cbiAqIEBwYXJhbSB7b2JqZWN0fSByZXNwb25zZSBUaGUgcmVzcG9uc2UuXG4gKi9cbm1vZHVsZS5leHBvcnRzID0gZnVuY3Rpb24gc2V0dGxlKHJlc29sdmUsIHJlamVjdCwgcmVzcG9uc2UpIHtcbiAgdmFyIHZhbGlkYXRlU3RhdHVzID0gcmVzcG9uc2UuY29uZmlnLnZhbGlkYXRlU3RhdHVzO1xuICBpZiAoIXZhbGlkYXRlU3RhdHVzIHx8IHZhbGlkYXRlU3RhdHVzKHJlc3BvbnNlLnN0YXR1cykpIHtcbiAgICByZXNvbHZlKHJlc3BvbnNlKTtcbiAgfSBlbHNlIHtcbiAgICByZWplY3QoY3JlYXRlRXJyb3IoXG4gICAgICAnUmVxdWVzdCBmYWlsZWQgd2l0aCBzdGF0dXMgY29kZSAnICsgcmVzcG9uc2Uuc3RhdHVzLFxuICAgICAgcmVzcG9uc2UuY29uZmlnLFxuICAgICAgbnVsbCxcbiAgICAgIHJlc3BvbnNlLnJlcXVlc3QsXG4gICAgICByZXNwb25zZVxuICAgICkpO1xuICB9XG59O1xuIl0sIm1hcHBpbmdzIjoiQUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTsiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///25\n")},function(module,exports,__webpack_require__){"use strict";eval("\n\n/**\n * Update an Error with the specified config, error code, and response.\n *\n * @param {Error} error The error to update.\n * @param {Object} config The config.\n * @param {string} [code] The error code (for example, 'ECONNABORTED').\n * @param {Object} [request] The request.\n * @param {Object} [response] The response.\n * @returns {Error} The error.\n */\nmodule.exports = function enhanceError(error, config, code, request, response) {\n error.config = config;\n if (code) {\n error.code = code;\n }\n\n error.request = request;\n error.response = response;\n error.isAxiosError = true;\n\n error.toJSON = function() {\n return {\n // Standard\n message: this.message,\n name: this.name,\n // Microsoft\n description: this.description,\n number: this.number,\n // Mozilla\n fileName: this.fileName,\n lineNumber: this.lineNumber,\n columnNumber: this.columnNumber,\n stack: this.stack,\n // Axios\n config: this.config,\n code: this.code\n };\n };\n return error;\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMjYuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYXhpb3MvbGliL2NvcmUvZW5oYW5jZUVycm9yLmpzPzM4N2YiXSwic291cmNlc0NvbnRlbnQiOlsiJ3VzZSBzdHJpY3QnO1xuXG4vKipcbiAqIFVwZGF0ZSBhbiBFcnJvciB3aXRoIHRoZSBzcGVjaWZpZWQgY29uZmlnLCBlcnJvciBjb2RlLCBhbmQgcmVzcG9uc2UuXG4gKlxuICogQHBhcmFtIHtFcnJvcn0gZXJyb3IgVGhlIGVycm9yIHRvIHVwZGF0ZS5cbiAqIEBwYXJhbSB7T2JqZWN0fSBjb25maWcgVGhlIGNvbmZpZy5cbiAqIEBwYXJhbSB7c3RyaW5nfSBbY29kZV0gVGhlIGVycm9yIGNvZGUgKGZvciBleGFtcGxlLCAnRUNPTk5BQk9SVEVEJykuXG4gKiBAcGFyYW0ge09iamVjdH0gW3JlcXVlc3RdIFRoZSByZXF1ZXN0LlxuICogQHBhcmFtIHtPYmplY3R9IFtyZXNwb25zZV0gVGhlIHJlc3BvbnNlLlxuICogQHJldHVybnMge0Vycm9yfSBUaGUgZXJyb3IuXG4gKi9cbm1vZHVsZS5leHBvcnRzID0gZnVuY3Rpb24gZW5oYW5jZUVycm9yKGVycm9yLCBjb25maWcsIGNvZGUsIHJlcXVlc3QsIHJlc3BvbnNlKSB7XG4gIGVycm9yLmNvbmZpZyA9IGNvbmZpZztcbiAgaWYgKGNvZGUpIHtcbiAgICBlcnJvci5jb2RlID0gY29kZTtcbiAgfVxuXG4gIGVycm9yLnJlcXVlc3QgPSByZXF1ZXN0O1xuICBlcnJvci5yZXNwb25zZSA9IHJlc3BvbnNlO1xuICBlcnJvci5pc0F4aW9zRXJyb3IgPSB0cnVlO1xuXG4gIGVycm9yLnRvSlNPTiA9IGZ1bmN0aW9uKCkge1xuICAgIHJldHVybiB7XG4gICAgICAvLyBTdGFuZGFyZFxuICAgICAgbWVzc2FnZTogdGhpcy5tZXNzYWdlLFxuICAgICAgbmFtZTogdGhpcy5uYW1lLFxuICAgICAgLy8gTWljcm9zb2Z0XG4gICAgICBkZXNjcmlwdGlvbjogdGhpcy5kZXNjcmlwdGlvbixcbiAgICAgIG51bWJlcjogdGhpcy5udW1iZXIsXG4gICAgICAvLyBNb3ppbGxhXG4gICAgICBmaWxlTmFtZTogdGhpcy5maWxlTmFtZSxcbiAgICAgIGxpbmVOdW1iZXI6IHRoaXMubGluZU51bWJlcixcbiAgICAgIGNvbHVtbk51bWJlcjogdGhpcy5jb2x1bW5OdW1iZXIsXG4gICAgICBzdGFjazogdGhpcy5zdGFjayxcbiAgICAgIC8vIEF4aW9zXG4gICAgICBjb25maWc6IHRoaXMuY29uZmlnLFxuICAgICAgY29kZTogdGhpcy5jb2RlXG4gICAgfTtcbiAgfTtcbiAgcmV0dXJuIGVycm9yO1xufTtcbiJdLCJtYXBwaW5ncyI6IkFBQUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOyIsInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///26\n")},function(module,exports,__webpack_require__){"use strict";eval("\n\nvar utils = __webpack_require__(0);\n\n// Headers whose duplicates are ignored by node\n// c.f. https://nodejs.org/api/http.html#http_message_headers\nvar ignoreDuplicateOf = [\n 'age', 'authorization', 'content-length', 'content-type', 'etag',\n 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',\n 'last-modified', 'location', 'max-forwards', 'proxy-authorization',\n 'referer', 'retry-after', 'user-agent'\n];\n\n/**\n * Parse headers into an object\n *\n * ```\n * Date: Wed, 27 Aug 2014 08:58:49 GMT\n * Content-Type: application/json\n * Connection: keep-alive\n * Transfer-Encoding: chunked\n * ```\n *\n * @param {String} headers Headers needing to be parsed\n * @returns {Object} Headers parsed into an object\n */\nmodule.exports = function parseHeaders(headers) {\n var parsed = {};\n var key;\n var val;\n var i;\n\n if (!headers) { return parsed; }\n\n utils.forEach(headers.split('\\n'), function parser(line) {\n i = line.indexOf(':');\n key = utils.trim(line.substr(0, i)).toLowerCase();\n val = utils.trim(line.substr(i + 1));\n\n if (key) {\n if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) {\n return;\n }\n if (key === 'set-cookie') {\n parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]);\n } else {\n parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;\n }\n }\n });\n\n return parsed;\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMjcuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYXhpb3MvbGliL2hlbHBlcnMvcGFyc2VIZWFkZXJzLmpzP2MzNDUiXSwic291cmNlc0NvbnRlbnQiOlsiJ3VzZSBzdHJpY3QnO1xuXG52YXIgdXRpbHMgPSByZXF1aXJlKCcuLy4uL3V0aWxzJyk7XG5cbi8vIEhlYWRlcnMgd2hvc2UgZHVwbGljYXRlcyBhcmUgaWdub3JlZCBieSBub2RlXG4vLyBjLmYuIGh0dHBzOi8vbm9kZWpzLm9yZy9hcGkvaHR0cC5odG1sI2h0dHBfbWVzc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";eval("\n\nvar utils = __webpack_require__(0);\n\nmodule.exports = (\n utils.isStandardBrowserEnv() ?\n\n // Standard browser envs have full support of the APIs needed to test\n // whether the request URL is of the same origin as current location.\n (function standardBrowserEnv() {\n var msie = /(msie|trident)/i.test(navigator.userAgent);\n var urlParsingNode = document.createElement('a');\n var originURL;\n\n /**\n * Parse a URL to discover it's components\n *\n * @param {String} url The URL to be parsed\n * @returns {Object}\n */\n function resolveURL(url) {\n var href = url;\n\n if (msie) {\n // IE needs attribute set twice to normalize properties\n urlParsingNode.setAttribute('href', href);\n href = urlParsingNode.href;\n }\n\n urlParsingNode.setAttribute('href', href);\n\n // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils\n return {\n href: urlParsingNode.href,\n protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',\n host: urlParsingNode.host,\n search: urlParsingNode.search ? urlParsingNode.search.replace(/^\\?/, '') : '',\n hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',\n hostname: urlParsingNode.hostname,\n port: urlParsingNode.port,\n pathname: (urlParsingNode.pathname.charAt(0) === '/') ?\n urlParsingNode.pathname :\n '/' + urlParsingNode.pathname\n };\n }\n\n originURL = resolveURL(window.location.href);\n\n /**\n * Determine if a URL shares the same origin as the current location\n *\n * @param {String} requestURL The URL to test\n * @returns {boolean} True if URL shares the same origin, otherwise false\n */\n return function isURLSameOrigin(requestURL) {\n var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;\n return (parsed.protocol === originURL.protocol &&\n parsed.host === originURL.host);\n };\n })() :\n\n // Non standard browser envs (web workers, react-native) lack needed support.\n (function nonStandardBrowserEnv() {\n return function isURLSameOrigin() {\n return true;\n };\n })()\n);\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMjguanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZH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QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTsiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///28\n")},function(module,exports,__webpack_require__){"use strict";eval("\n\nvar utils = __webpack_require__(0);\n\nmodule.exports = (\n utils.isStandardBrowserEnv() ?\n\n // Standard browser envs support document.cookie\n (function standardBrowserEnv() {\n return {\n write: function write(name, value, expires, path, domain, secure) {\n var cookie = [];\n cookie.push(name + '=' + encodeURIComponent(value));\n\n if (utils.isNumber(expires)) {\n cookie.push('expires=' + new Date(expires).toGMTString());\n }\n\n if (utils.isString(path)) {\n cookie.push('path=' + path);\n }\n\n if (utils.isString(domain)) {\n cookie.push('domain=' + domain);\n }\n\n if (secure === true) {\n cookie.push('secure');\n }\n\n document.cookie = cookie.join('; ');\n },\n\n read: function read(name) {\n var match = document.cookie.match(new RegExp('(^|;\\\\s*)(' + name + ')=([^;]*)'));\n return (match ? decodeURIComponent(match[3]) : null);\n },\n\n remove: function remove(name) {\n this.write(name, '', Date.now() - 86400000);\n }\n };\n })() :\n\n // Non standard browser env (web workers, react-native) lack needed support.\n (function nonStandardBrowserEnv() {\n return {\n write: function write() {},\n read: function read() { return null; },\n remove: function remove() {}\n };\n })()\n);\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMjkuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYXhpb3MvbGliL2hlbHBlcnMvY29va2llcy5qcz83YWFjIl0sInNvdXJjZXNDb250ZW50IjpbIid1c2Ugc3RyaWN0JztcblxudmFyIHV0aWxzID0gcmVxdWlyZSgnLi8uLi91dGlscycpO1xuXG5tb2R1bGUuZXhwb3J0cyA9IChcbiAgdXRpbHMuaXNTdGFuZGFyZEJyb3dzZXJFbnYoKSA/XG5cbiAgLy8gU3RhbmRhcmQgYnJvd3NlciBlbnZzIHN1cHBvcnQgZG9jdW1lbnQuY29va2llXG4gICAgKGZ1bmN0aW9uIHN0YW5kYXJkQnJvd3NlckVudigpIHtcbiAgICAgIHJldHVybiB7XG4gICAgICAgIHdyaXRlOiBmdW5jdGlvbiB3cml0ZShuYW1lLCB2YWx1ZSwgZXhwaXJlcywgcGF0aCwgZG9tYWluLCBzZWN1cmUpIHtcbiAgICAgICAgICB2YXIgY29va2llID0gW107XG4gICAgICAgICAgY29va2llLnB1c2gobmFtZSArICc9JyArIGVuY29kZVVSSUNvbXBvbmVudCh2YWx1ZSkpO1xuXG4gICAgICAgICAgaWYgKHV0aWxzLmlzTnVtYmVyKGV4cGlyZXMpKSB7XG4gICAgICAgICAgICBjb29raWUucHVzaCgnZXhwaXJlcz0nICsgbmV3IERhdGUoZXhwaXJlcykudG9HTVRTdHJpbmcoKSk7XG4gICAgICAgICAgfVxuXG4gICAgICAgICAgaWYgKHV0aWxzLmlzU3RyaW5nKHBhdGgpKSB7XG4gICAgICAgICAgICBjb29raWUucHVzaCgncGF0aD0nICsgcGF0aCk7XG4gICAgICAgICAgfVxuXG4gICAgICAgICAgaWYgKHV0aWxzLmlzU3RyaW5nKGRvbWFpbikpIHtcbiAgICAgICAgICA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oiQUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOyIsInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///29\n")},function(module,exports,__webpack_require__){"use strict";eval('\n\n/**\n * Determines whether the specified URL is absolute\n *\n * @param {string} url The URL to test\n * @returns {boolean} True if the specified URL is absolute, otherwise false\n */\nmodule.exports = function isAbsoluteURL(url) {\n // A URL is considered absolute if it begins with "://" or "//" (protocol-relative URL).\n // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed\n // by any combination of letters, digits, plus, period, or hyphen.\n return /^([a-z][a-z\\d\\+\\-\\.]*:)?\\/\\//i.test(url);\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMzAuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYXhpb3MvbGliL2hlbHBlcnMvaXNBYnNvbHV0ZVVSTC5qcz9kOTI1Il0sInNvdXJjZXNDb250ZW50IjpbIid1c2Ugc3RyaWN0JztcblxuLyoqXG4gKiBEZXRlcm1pbmVzIHdoZXRoZXIgdGhlIHNwZWNpZmllZCBVUkwgaXMgYWJzb2x1dGVcbiAqXG4gKiBAcGFyYW0ge3N0cmluZ30gdXJsIFRoZSBVUkwgdG8gdGVzdFxuICogQHJldHVybnMge2Jvb2xlYW59IFRydWUgaWYgdGhlIHNwZWNpZmllZCBVUkwgaXMgYWJzb2x1dGUsIG90aGVyd2lzZSBmYWxzZVxuICovXG5tb2R1bGUuZXhwb3J0cyA9IGZ1bmN0aW9uIGlzQWJzb2x1dGVVUkwodXJsKSB7XG4gIC8vIEEgVVJMIGlzIGNvbnNpZGVyZWQgYWJzb2x1dGUgaWYgaXQgYmVnaW5zIHdpdGggXCI8c2NoZW1lPjovL1wiIG9yIFwiLy9cIiAocHJvdG9jb2wtcmVsYXRpdmUgVVJMKS5cbiAgLy8gUkZDIDM5ODYgZGVmaW5lcyBzY2hlbWUgbmFtZSBhcyBhIHNlcXVlbmNlIG9mIGNoYXJhY3RlcnMgYmVnaW5uaW5nIHdpdGggYSBsZXR0ZXIgYW5kIGZvbGxvd2VkXG4gIC8vIGJ5IGFueSBjb21iaW5hdGlvbiBvZiBsZXR0ZXJzLCBkaWdpdHMsIHBsdXMsIHBlcmlvZCwgb3IgaHlwaGVuLlxuICByZXR1cm4gL14oW2Etel1bYS16XFxkXFwrXFwtXFwuXSo6KT9cXC9cXC8vaS50ZXN0KHVybCk7XG59O1xuIl0sIm1hcHBpbmdzIjoiQUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOyIsInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///30\n')},function(module,exports,__webpack_require__){"use strict";eval("\n\n/**\n * Creates a new URL by combining the specified URLs\n *\n * @param {string} baseURL The base URL\n * @param {string} relativeURL The relative URL\n * @returns {string} The combined URL\n */\nmodule.exports = function combineURLs(baseURL, relativeURL) {\n return relativeURL\n ? baseURL.replace(/\\/+$/, '') + '/' + relativeURL.replace(/^\\/+/, '')\n : baseURL;\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMzEuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYXhpb3MvbGliL2hlbHBlcnMvY29tYmluZVVSTHMuanM/ZTY4MyJdLCJzb3VyY2VzQ29udGVudCI6WyIndXNlIHN0cmljdCc7XG5cbi8qKlxuICogQ3JlYXRlcyBhIG5ldyBVUkwgYnkgY29tYmluaW5nIHRoZSBzcGVjaWZpZWQgVVJMc1xuICpcbiAqIEBwYXJhbSB7c3RyaW5nfSBiYXNlVVJMIFRoZSBiYXNlIFVSTFxuICogQHBhcmFtIHtzdHJpbmd9IHJlbGF0aXZlVVJMIFRoZSByZWxhdGl2ZSBVUkxcbiAqIEByZXR1cm5zIHtzdHJpbmd9IFRoZSBjb21iaW5lZCBVUkxcbiAqL1xubW9kdWxlLmV4cG9ydHMgPSBmdW5jdGlvbiBjb21iaW5lVVJMcyhiYXNlVVJMLCByZWxhdGl2ZVVSTCkge1xuICByZXR1cm4gcmVsYXRpdmVVUkxcbiAgICA/IGJhc2VVUkwucmVwbGFjZSgvXFwvKyQvLCAnJykgKyAnLycgKyByZWxhdGl2ZVVSTC5yZXBsYWNlKC9eXFwvKy8sICcnKVxuICAgIDogYmFzZVVSTDtcbn07XG4iXSwibWFwcGluZ3MiOiJBQUFBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7Iiwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///31\n")},function(module,exports,__webpack_require__){"use strict";eval("\n\nvar Cancel = __webpack_require__(13);\n\n/**\n * A `CancelToken` is an object that can be used to request cancellation of an operation.\n *\n * @class\n * @param {Function} executor The executor function.\n */\nfunction CancelToken(executor) {\n if (typeof executor !== 'function') {\n throw new TypeError('executor must be a function.');\n }\n\n var resolvePromise;\n this.promise = new Promise(function promiseExecutor(resolve) {\n resolvePromise = resolve;\n });\n\n var token = this;\n executor(function cancel(message) {\n if (token.reason) {\n // Cancellation has already been requested\n return;\n }\n\n token.reason = new Cancel(message);\n resolvePromise(token.reason);\n });\n}\n\n/**\n * Throws a `Cancel` if cancellation has been requested.\n */\nCancelToken.prototype.throwIfRequested = function throwIfRequested() {\n if (this.reason) {\n throw this.reason;\n }\n};\n\n/**\n * Returns an object that contains a new `CancelToken` and a function that, when called,\n * cancels the `CancelToken`.\n */\nCancelToken.source = function source() {\n var cancel;\n var token = new CancelToken(function executor(c) {\n cancel = c;\n });\n return {\n token: token,\n cancel: cancel\n };\n};\n\nmodule.exports = CancelToken;\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMzIuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYXhpb3MvbGliL2NhbmNlbC9DYW5jZWxUb2tlbi5qcz84ZGY0Il0sInNvdXJjZXNDb250ZW50IjpbIid1c2Ugc3RyaWN0JztcblxudmFyIENhbmNlbCA9IHJlcXVpcmUoJy4vQ2FuY2VsJyk7XG5cbi8qKlxuICogQSBgQ2FuY2VsVG9rZW5gIGlzIGFuIG9iamVjdCB0aGF0IGNhbiBiZSB1c2VkIHRvIHJlcXVlc3QgY2FuY2VsbGF0aW9uIG9mIGFuIG9wZXJhdGlvbi5cbiAqXG4gKiBAY2xhc3NcbiAqIEBwYXJhbSB7RnVuY3Rpb259IGV4ZWN1dG9yIFRoZSBleGVjdXRvciBmdW5jdGlvbi5cbiAqL1xuZnVuY3Rpb24gQ2FuY2VsVG9rZW4oZXhlY3V0b3IpIHtcbiAgaWYgKHR5cGVvZiBleGVjdXRvciAhPT0gJ2Z1bmN0aW9uJykge1xuICAgIHRocm93IG5ldyBUeXBlRXJyb3IoJ2V4ZWN1dG9yIG11c3QgYmUgYSBmdW5jdGlvbi4nKTtcbiAgfVxuXG4gIHZhciByZXN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biAgICBjYW5jZWwgPSBjO1xuICB9KTtcbiAgcmV0dXJuIHtcbiAgICB0b2tlbjogdG9rZW4sXG4gICAgY2FuY2VsOiBjYW5jZWxcbiAgfTtcbn07XG5cbm1vZHVsZS5leHBvcnRzID0gQ2FuY2VsVG9rZW47XG4iXSwibWFwcGluZ3MiOiJBQUFBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTsiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///32\n")},function(module,exports,__webpack_require__){"use strict";eval("\n\n/**\n * Syntactic sugar for invoking a function and expanding an array for arguments.\n *\n * Common use case would be to use `Function.prototype.apply`.\n *\n * ```js\n * function f(x, y, z) {}\n * var args = [1, 2, 3];\n * f.apply(null, args);\n * ```\n *\n * With `spread` this example can be re-written.\n *\n * ```js\n * spread(function(x, y, z) {})([1, 2, 3]);\n * ```\n *\n * @param {Function} callback\n * @returns {Function}\n */\nmodule.exports = function spread(callback) {\n return function wrap(arr) {\n return callback.apply(null, arr);\n };\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMzMuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYXhpb3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7Iiwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///33\n")},function(module,exports,__webpack_require__){"use strict";eval("/* WEBPACK VAR INJECTION */(function(global) {/*!\n * The buffer module from node.js, for the browser.\n *\n * @author Feross Aboukhadijeh \n * @license MIT\n */\n/* eslint-disable no-proto */\n\n\n\nvar base64 = __webpack_require__(36)\nvar ieee754 = __webpack_require__(37)\nvar isArray = __webpack_require__(38)\n\nexports.Buffer = Buffer\nexports.SlowBuffer = SlowBuffer\nexports.INSPECT_MAX_BYTES = 50\n\n/**\n * If `Buffer.TYPED_ARRAY_SUPPORT`:\n * === true Use Uint8Array implementation (fastest)\n * === false Use Object implementation (most compatible, even IE6)\n *\n * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,\n * Opera 11.6+, iOS 4.2+.\n *\n * Due to various browser bugs, sometimes the Object implementation will be used even\n * when the browser supports typed arrays.\n *\n * Note:\n *\n * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,\n * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.\n *\n * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.\n *\n * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of\n * incorrect length in some situations.\n\n * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they\n * get the Object implementation, which is slower but behaves correctly.\n */\nBuffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined\n ? global.TYPED_ARRAY_SUPPORT\n : typedArraySupport()\n\n/*\n * Export kMaxLength after typed array support is determined.\n */\nexports.kMaxLength = kMaxLength()\n\nfunction typedArraySupport () {\n try {\n var arr = new Uint8Array(1)\n arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}\n return arr.foo() === 42 && // typed array instances can be augmented\n typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`\n arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`\n } catch (e) {\n return false\n }\n}\n\nfunction kMaxLength () {\n return Buffer.TYPED_ARRAY_SUPPORT\n ? 0x7fffffff\n : 0x3fffffff\n}\n\nfunction createBuffer (that, length) {\n if (kMaxLength() < length) {\n throw new RangeError('Invalid typed array length')\n }\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n // Return an augmented `Uint8Array` instance, for best performance\n that = new Uint8Array(length)\n that.__proto__ = Buffer.prototype\n } else {\n // Fallback: Return an object instance of the Buffer class\n if (that === null) {\n that = new Buffer(length)\n }\n that.length = length\n }\n\n return that\n}\n\n/**\n * The Buffer constructor returns instances of `Uint8Array` that have their\n * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of\n * `Uint8Array`, so the returned instances will have all the node `Buffer` methods\n * and the `Uint8Array` methods. Square bracket notation works as expected -- it\n * returns a single octet.\n *\n * The `Uint8Array` prototype remains unmodified.\n */\n\nfunction Buffer (arg, encodingOrOffset, length) {\n if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {\n return new Buffer(arg, encodingOrOffset, length)\n }\n\n // Common case.\n if (typeof arg === 'number') {\n if (typeof encodingOrOffset === 'string') {\n throw new Error(\n 'If encoding is specified then the first argument must be a string'\n )\n }\n return allocUnsafe(this, arg)\n }\n return from(this, arg, encodingOrOffset, length)\n}\n\nBuffer.poolSize = 8192 // not used by this implementation\n\n// TODO: Legacy, not needed anymore. Remove in next major version.\nBuffer._augment = function (arr) {\n arr.__proto__ = Buffer.prototype\n return arr\n}\n\nfunction from (that, value, encodingOrOffset, length) {\n if (typeof value === 'number') {\n throw new TypeError('\"value\" argument must not be a number')\n }\n\n if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {\n return fromArrayBuffer(that, value, encodingOrOffset, length)\n }\n\n if (typeof value === 'string') {\n return fromString(that, value, encodingOrOffset)\n }\n\n return fromObject(that, value)\n}\n\n/**\n * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError\n * if value is a number.\n * Buffer.from(str[, encoding])\n * Buffer.from(array)\n * Buffer.from(buffer)\n * Buffer.from(arrayBuffer[, byteOffset[, length]])\n **/\nBuffer.from = function (value, encodingOrOffset, length) {\n return from(null, value, encodingOrOffset, length)\n}\n\nif (Buffer.TYPED_ARRAY_SUPPORT) {\n Buffer.prototype.__proto__ = Uint8Array.prototype\n Buffer.__proto__ = Uint8Array\n if (typeof Symbol !== 'undefined' && Symbol.species &&\n Buffer[Symbol.species] === Buffer) {\n // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97\n Object.defineProperty(Buffer, Symbol.species, {\n value: null,\n configurable: true\n })\n }\n}\n\nfunction assertSize (size) {\n if (typeof size !== 'number') {\n throw new TypeError('\"size\" argument must be a number')\n } else if (size < 0) {\n throw new RangeError('\"size\" argument must not be negative')\n }\n}\n\nfunction alloc (that, size, fill, encoding) {\n assertSize(size)\n if (size <= 0) {\n return createBuffer(that, size)\n }\n if (fill !== undefined) {\n // Only pay attention to encoding if it's a string. This\n // prevents accidentally sending in a number that would\n // be interpretted as a start offset.\n return typeof encoding === 'string'\n ? createBuffer(that, size).fill(fill, encoding)\n : createBuffer(that, size).fill(fill)\n }\n return createBuffer(that, size)\n}\n\n/**\n * Creates a new filled Buffer instance.\n * alloc(size[, fill[, encoding]])\n **/\nBuffer.alloc = function (size, fill, encoding) {\n return alloc(null, size, fill, encoding)\n}\n\nfunction allocUnsafe (that, size) {\n assertSize(size)\n that = createBuffer(that, size < 0 ? 0 : checked(size) | 0)\n if (!Buffer.TYPED_ARRAY_SUPPORT) {\n for (var i = 0; i < size; ++i) {\n that[i] = 0\n }\n }\n return that\n}\n\n/**\n * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.\n * */\nBuffer.allocUnsafe = function (size) {\n return allocUnsafe(null, size)\n}\n/**\n * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.\n */\nBuffer.allocUnsafeSlow = function (size) {\n return allocUnsafe(null, size)\n}\n\nfunction fromString (that, string, encoding) {\n if (typeof encoding !== 'string' || encoding === '') {\n encoding = 'utf8'\n }\n\n if (!Buffer.isEncoding(encoding)) {\n throw new TypeError('\"encoding\" must be a valid string encoding')\n }\n\n var length = byteLength(string, encoding) | 0\n that = createBuffer(that, length)\n\n var actual = that.write(string, encoding)\n\n if (actual !== length) {\n // Writing a hex string, for example, that contains invalid characters will\n // cause everything after the first invalid character to be ignored. (e.g.\n // 'abxxcd' will be treated as 'ab')\n that = that.slice(0, actual)\n }\n\n return that\n}\n\nfunction fromArrayLike (that, array) {\n var length = array.length < 0 ? 0 : checked(array.length) | 0\n that = createBuffer(that, length)\n for (var i = 0; i < length; i += 1) {\n that[i] = array[i] & 255\n }\n return that\n}\n\nfunction fromArrayBuffer (that, array, byteOffset, length) {\n array.byteLength // this throws if `array` is not a valid ArrayBuffer\n\n if (byteOffset < 0 || array.byteLength < byteOffset) {\n throw new RangeError('\\'offset\\' is out of bounds')\n }\n\n if (array.byteLength < byteOffset + (length || 0)) {\n throw new RangeError('\\'length\\' is out of bounds')\n }\n\n if (byteOffset === undefined && length === undefined) {\n array = new Uint8Array(array)\n } else if (length === undefined) {\n array = new Uint8Array(array, byteOffset)\n } else {\n array = new Uint8Array(array, byteOffset, length)\n }\n\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n // Return an augmented `Uint8Array` instance, for best performance\n that = array\n that.__proto__ = Buffer.prototype\n } else {\n // Fallback: Return an object instance of the Buffer class\n that = fromArrayLike(that, array)\n }\n return that\n}\n\nfunction fromObject (that, obj) {\n if (Buffer.isBuffer(obj)) {\n var len = checked(obj.length) | 0\n that = createBuffer(that, len)\n\n if (that.length === 0) {\n return that\n }\n\n obj.copy(that, 0, 0, len)\n return that\n }\n\n if (obj) {\n if ((typeof ArrayBuffer !== 'undefined' &&\n obj.buffer instanceof ArrayBuffer) || 'length' in obj) {\n if (typeof obj.length !== 'number' || isnan(obj.length)) {\n return createBuffer(that, 0)\n }\n return fromArrayLike(that, obj)\n }\n\n if (obj.type === 'Buffer' && isArray(obj.data)) {\n return fromArrayLike(that, obj.data)\n }\n }\n\n throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')\n}\n\nfunction checked (length) {\n // Note: cannot use `length < kMaxLength()` here because that fails when\n // length is NaN (which is otherwise coerced to zero.)\n if (length >= kMaxLength()) {\n throw new RangeError('Attempt to allocate Buffer larger than maximum ' +\n 'size: 0x' + kMaxLength().toString(16) + ' bytes')\n }\n return length | 0\n}\n\nfunction SlowBuffer (length) {\n if (+length != length) { // eslint-disable-line eqeqeq\n length = 0\n }\n return Buffer.alloc(+length)\n}\n\nBuffer.isBuffer = function isBuffer (b) {\n return !!(b != null && b._isBuffer)\n}\n\nBuffer.compare = function compare (a, b) {\n if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {\n throw new TypeError('Arguments must be Buffers')\n }\n\n if (a === b) return 0\n\n var x = a.length\n var y = b.length\n\n for (var i = 0, len = Math.min(x, y); i < len; ++i) {\n if (a[i] !== b[i]) {\n x = a[i]\n y = b[i]\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\nBuffer.isEncoding = function isEncoding (encoding) {\n switch (String(encoding).toLowerCase()) {\n case 'hex':\n case 'utf8':\n case 'utf-8':\n case 'ascii':\n case 'latin1':\n case 'binary':\n case 'base64':\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return true\n default:\n return false\n }\n}\n\nBuffer.concat = function concat (list, length) {\n if (!isArray(list)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n }\n\n if (list.length === 0) {\n return Buffer.alloc(0)\n }\n\n var i\n if (length === undefined) {\n length = 0\n for (i = 0; i < list.length; ++i) {\n length += list[i].length\n }\n }\n\n var buffer = Buffer.allocUnsafe(length)\n var pos = 0\n for (i = 0; i < list.length; ++i) {\n var buf = list[i]\n if (!Buffer.isBuffer(buf)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n }\n buf.copy(buffer, pos)\n pos += buf.length\n }\n return buffer\n}\n\nfunction byteLength (string, encoding) {\n if (Buffer.isBuffer(string)) {\n return string.length\n }\n if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&\n (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {\n return string.byteLength\n }\n if (typeof string !== 'string') {\n string = '' + string\n }\n\n var len = string.length\n if (len === 0) return 0\n\n // Use a for loop to avoid recursion\n var loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'ascii':\n case 'latin1':\n case 'binary':\n return len\n case 'utf8':\n case 'utf-8':\n case undefined:\n return utf8ToBytes(string).length\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return len * 2\n case 'hex':\n return len >>> 1\n case 'base64':\n return base64ToBytes(string).length\n default:\n if (loweredCase) return utf8ToBytes(string).length // assume utf8\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\nBuffer.byteLength = byteLength\n\nfunction slowToString (encoding, start, end) {\n var loweredCase = false\n\n // No need to verify that \"this.length <= MAX_UINT32\" since it's a read-only\n // property of a typed array.\n\n // This behaves neither like String nor Uint8Array in that we set start/end\n // to their upper/lower bounds if the value passed is out of range.\n // undefined is handled specially as per ECMA-262 6th Edition,\n // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.\n if (start === undefined || start < 0) {\n start = 0\n }\n // Return early if start > this.length. Done here to prevent potential uint32\n // coercion fail below.\n if (start > this.length) {\n return ''\n }\n\n if (end === undefined || end > this.length) {\n end = this.length\n }\n\n if (end <= 0) {\n return ''\n }\n\n // Force coersion to uint32. This will also coerce falsey/NaN values to 0.\n end >>>= 0\n start >>>= 0\n\n if (end <= start) {\n return ''\n }\n\n if (!encoding) encoding = 'utf8'\n\n while (true) {\n switch (encoding) {\n case 'hex':\n return hexSlice(this, start, end)\n\n case 'utf8':\n case 'utf-8':\n return utf8Slice(this, start, end)\n\n case 'ascii':\n return asciiSlice(this, start, end)\n\n case 'latin1':\n case 'binary':\n return latin1Slice(this, start, end)\n\n case 'base64':\n return base64Slice(this, start, end)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return utf16leSlice(this, start, end)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = (encoding + '').toLowerCase()\n loweredCase = true\n }\n }\n}\n\n// The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect\n// Buffer instances.\nBuffer.prototype._isBuffer = true\n\nfunction swap (b, n, m) {\n var i = b[n]\n b[n] = b[m]\n b[m] = i\n}\n\nBuffer.prototype.swap16 = function swap16 () {\n var len = this.length\n if (len % 2 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 16-bits')\n }\n for (var i = 0; i < len; i += 2) {\n swap(this, i, i + 1)\n }\n return this\n}\n\nBuffer.prototype.swap32 = function swap32 () {\n var len = this.length\n if (len % 4 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 32-bits')\n }\n for (var i = 0; i < len; i += 4) {\n swap(this, i, i + 3)\n swap(this, i + 1, i + 2)\n }\n return this\n}\n\nBuffer.prototype.swap64 = function swap64 () {\n var len = this.length\n if (len % 8 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 64-bits')\n }\n for (var i = 0; i < len; i += 8) {\n swap(this, i, i + 7)\n swap(this, i + 1, i + 6)\n swap(this, i + 2, i + 5)\n swap(this, i + 3, i + 4)\n }\n return this\n}\n\nBuffer.prototype.toString = function toString () {\n var length = this.length | 0\n if (length === 0) return ''\n if (arguments.length === 0) return utf8Slice(this, 0, length)\n return slowToString.apply(this, arguments)\n}\n\nBuffer.prototype.equals = function equals (b) {\n if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')\n if (this === b) return true\n return Buffer.compare(this, b) === 0\n}\n\nBuffer.prototype.inspect = function inspect () {\n var str = ''\n var max = exports.INSPECT_MAX_BYTES\n if (this.length > 0) {\n str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')\n if (this.length > max) str += ' ... '\n }\n return ''\n}\n\nBuffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {\n if (!Buffer.isBuffer(target)) {\n throw new TypeError('Argument must be a Buffer')\n }\n\n if (start === undefined) {\n start = 0\n }\n if (end === undefined) {\n end = target ? target.length : 0\n }\n if (thisStart === undefined) {\n thisStart = 0\n }\n if (thisEnd === undefined) {\n thisEnd = this.length\n }\n\n if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {\n throw new RangeError('out of range index')\n }\n\n if (thisStart >= thisEnd && start >= end) {\n return 0\n }\n if (thisStart >= thisEnd) {\n return -1\n }\n if (start >= end) {\n return 1\n }\n\n start >>>= 0\n end >>>= 0\n thisStart >>>= 0\n thisEnd >>>= 0\n\n if (this === target) return 0\n\n var x = thisEnd - thisStart\n var y = end - start\n var len = Math.min(x, y)\n\n var thisCopy = this.slice(thisStart, thisEnd)\n var targetCopy = target.slice(start, end)\n\n for (var i = 0; i < len; ++i) {\n if (thisCopy[i] !== targetCopy[i]) {\n x = thisCopy[i]\n y = targetCopy[i]\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\n// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,\n// OR the last index of `val` in `buffer` at offset <= `byteOffset`.\n//\n// Arguments:\n// - buffer - a Buffer to search\n// - val - a string, Buffer, or number\n// - byteOffset - an index into `buffer`; will be clamped to an int32\n// - encoding - an optional encoding, relevant is val is a string\n// - dir - true for indexOf, false for lastIndexOf\nfunction bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {\n // Empty buffer means no match\n if (buffer.length === 0) return -1\n\n // Normalize byteOffset\n if (typeof byteOffset === 'string') {\n encoding = byteOffset\n byteOffset = 0\n } else if (byteOffset > 0x7fffffff) {\n byteOffset = 0x7fffffff\n } else if (byteOffset < -0x80000000) {\n byteOffset = -0x80000000\n }\n byteOffset = +byteOffset // Coerce to Number.\n if (isNaN(byteOffset)) {\n // byteOffset: it it's undefined, null, NaN, \"foo\", etc, search whole buffer\n byteOffset = dir ? 0 : (buffer.length - 1)\n }\n\n // Normalize byteOffset: negative offsets start from the end of the buffer\n if (byteOffset < 0) byteOffset = buffer.length + byteOffset\n if (byteOffset >= buffer.length) {\n if (dir) return -1\n else byteOffset = buffer.length - 1\n } else if (byteOffset < 0) {\n if (dir) byteOffset = 0\n else return -1\n }\n\n // Normalize val\n if (typeof val === 'string') {\n val = Buffer.from(val, encoding)\n }\n\n // Finally, search either indexOf (if dir is true) or lastIndexOf\n if (Buffer.isBuffer(val)) {\n // Special case: looking for empty string/buffer always fails\n if (val.length === 0) {\n return -1\n }\n return arrayIndexOf(buffer, val, byteOffset, encoding, dir)\n } else if (typeof val === 'number') {\n val = val & 0xFF // Search for a byte value [0-255]\n if (Buffer.TYPED_ARRAY_SUPPORT &&\n typeof Uint8Array.prototype.indexOf === 'function') {\n if (dir) {\n return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)\n } else {\n return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)\n }\n }\n return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)\n }\n\n throw new TypeError('val must be string, number or Buffer')\n}\n\nfunction arrayIndexOf (arr, val, byteOffset, encoding, dir) {\n var indexSize = 1\n var arrLength = arr.length\n var valLength = val.length\n\n if (encoding !== undefined) {\n encoding = String(encoding).toLowerCase()\n if (encoding === 'ucs2' || encoding === 'ucs-2' ||\n encoding === 'utf16le' || encoding === 'utf-16le') {\n if (arr.length < 2 || val.length < 2) {\n return -1\n }\n indexSize = 2\n arrLength /= 2\n valLength /= 2\n byteOffset /= 2\n }\n }\n\n function read (buf, i) {\n if (indexSize === 1) {\n return buf[i]\n } else {\n return buf.readUInt16BE(i * indexSize)\n }\n }\n\n var i\n if (dir) {\n var foundIndex = -1\n for (i = byteOffset; i < arrLength; i++) {\n if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {\n if (foundIndex === -1) foundIndex = i\n if (i - foundIndex + 1 === valLength) return foundIndex * indexSize\n } else {\n if (foundIndex !== -1) i -= i - foundIndex\n foundIndex = -1\n }\n }\n } else {\n if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength\n for (i = byteOffset; i >= 0; i--) {\n var found = true\n for (var j = 0; j < valLength; j++) {\n if (read(arr, i + j) !== read(val, j)) {\n found = false\n break\n }\n }\n if (found) return i\n }\n }\n\n return -1\n}\n\nBuffer.prototype.includes = function includes (val, byteOffset, encoding) {\n return this.indexOf(val, byteOffset, encoding) !== -1\n}\n\nBuffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, true)\n}\n\nBuffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, false)\n}\n\nfunction hexWrite (buf, string, offset, length) {\n offset = Number(offset) || 0\n var remaining = buf.length - offset\n if (!length) {\n length = remaining\n } else {\n length = Number(length)\n if (length > remaining) {\n length = remaining\n }\n }\n\n // must be an even number of digits\n var strLen = string.length\n if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')\n\n if (length > strLen / 2) {\n length = strLen / 2\n }\n for (var i = 0; i < length; ++i) {\n var parsed = parseInt(string.substr(i * 2, 2), 16)\n if (isNaN(parsed)) return i\n buf[offset + i] = parsed\n }\n return i\n}\n\nfunction utf8Write (buf, string, offset, length) {\n return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nfunction asciiWrite (buf, string, offset, length) {\n return blitBuffer(asciiToBytes(string), buf, offset, length)\n}\n\nfunction latin1Write (buf, string, offset, length) {\n return asciiWrite(buf, string, offset, length)\n}\n\nfunction base64Write (buf, string, offset, length) {\n return blitBuffer(base64ToBytes(string), buf, offset, length)\n}\n\nfunction ucs2Write (buf, string, offset, length) {\n return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nBuffer.prototype.write = function write (string, offset, length, encoding) {\n // Buffer#write(string)\n if (offset === undefined) {\n encoding = 'utf8'\n length = this.length\n offset = 0\n // Buffer#write(string, encoding)\n } else if (length === undefined && typeof offset === 'string') {\n encoding = offset\n length = this.length\n offset = 0\n // Buffer#write(string, offset[, length][, encoding])\n } else if (isFinite(offset)) {\n offset = offset | 0\n if (isFinite(length)) {\n length = length | 0\n if (encoding === undefined) encoding = 'utf8'\n } else {\n encoding = length\n length = undefined\n }\n // legacy write(string, encoding, offset, length) - remove in v0.13\n } else {\n throw new Error(\n 'Buffer.write(string, encoding, offset[, length]) is no longer supported'\n )\n }\n\n var remaining = this.length - offset\n if (length === undefined || length > remaining) length = remaining\n\n if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {\n throw new RangeError('Attempt to write outside buffer bounds')\n }\n\n if (!encoding) encoding = 'utf8'\n\n var loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'hex':\n return hexWrite(this, string, offset, length)\n\n case 'utf8':\n case 'utf-8':\n return utf8Write(this, string, offset, length)\n\n case 'ascii':\n return asciiWrite(this, string, offset, length)\n\n case 'latin1':\n case 'binary':\n return latin1Write(this, string, offset, length)\n\n case 'base64':\n // Warning: maxLength not taken into account in base64Write\n return base64Write(this, string, offset, length)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return ucs2Write(this, string, offset, length)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\n\nBuffer.prototype.toJSON = function toJSON () {\n return {\n type: 'Buffer',\n data: Array.prototype.slice.call(this._arr || this, 0)\n }\n}\n\nfunction base64Slice (buf, start, end) {\n if (start === 0 && end === buf.length) {\n return base64.fromByteArray(buf)\n } else {\n return base64.fromByteArray(buf.slice(start, end))\n }\n}\n\nfunction utf8Slice (buf, start, end) {\n end = Math.min(buf.length, end)\n var res = []\n\n var i = start\n while (i < end) {\n var firstByte = buf[i]\n var codePoint = null\n var bytesPerSequence = (firstByte > 0xEF) ? 4\n : (firstByte > 0xDF) ? 3\n : (firstByte > 0xBF) ? 2\n : 1\n\n if (i + bytesPerSequence <= end) {\n var secondByte, thirdByte, fourthByte, tempCodePoint\n\n switch (bytesPerSequence) {\n case 1:\n if (firstByte < 0x80) {\n codePoint = firstByte\n }\n break\n case 2:\n secondByte = buf[i + 1]\n if ((secondByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)\n if (tempCodePoint > 0x7F) {\n codePoint = tempCodePoint\n }\n }\n break\n case 3:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)\n if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {\n codePoint = tempCodePoint\n }\n }\n break\n case 4:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n fourthByte = buf[i + 3]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)\n if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {\n codePoint = tempCodePoint\n }\n }\n }\n }\n\n if (codePoint === null) {\n // we did not generate a valid codePoint so insert a\n // replacement char (U+FFFD) and advance only 1 byte\n codePoint = 0xFFFD\n bytesPerSequence = 1\n } else if (codePoint > 0xFFFF) {\n // encode to utf16 (surrogate pair dance)\n codePoint -= 0x10000\n res.push(codePoint >>> 10 & 0x3FF | 0xD800)\n codePoint = 0xDC00 | codePoint & 0x3FF\n }\n\n res.push(codePoint)\n i += bytesPerSequence\n }\n\n return decodeCodePointsArray(res)\n}\n\n// Based on http://stackoverflow.com/a/22747272/680742, the browser with\n// the lowest limit is Chrome, with 0x10000 args.\n// We go 1 magnitude less, for safety\nvar MAX_ARGUMENTS_LENGTH = 0x1000\n\nfunction decodeCodePointsArray (codePoints) {\n var len = codePoints.length\n if (len <= MAX_ARGUMENTS_LENGTH) {\n return String.fromCharCode.apply(String, codePoints) // avoid extra slice()\n }\n\n // Decode in chunks to avoid \"call stack size exceeded\".\n var res = ''\n var i = 0\n while (i < len) {\n res += String.fromCharCode.apply(\n String,\n codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)\n )\n }\n return res\n}\n\nfunction asciiSlice (buf, start, end) {\n var ret = ''\n end = Math.min(buf.length, end)\n\n for (var i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i] & 0x7F)\n }\n return ret\n}\n\nfunction latin1Slice (buf, start, end) {\n var ret = ''\n end = Math.min(buf.length, end)\n\n for (var i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i])\n }\n return ret\n}\n\nfunction hexSlice (buf, start, end) {\n var len = buf.length\n\n if (!start || start < 0) start = 0\n if (!end || end < 0 || end > len) end = len\n\n var out = ''\n for (var i = start; i < end; ++i) {\n out += toHex(buf[i])\n }\n return out\n}\n\nfunction utf16leSlice (buf, start, end) {\n var bytes = buf.slice(start, end)\n var res = ''\n for (var i = 0; i < bytes.length; i += 2) {\n res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)\n }\n return res\n}\n\nBuffer.prototype.slice = function slice (start, end) {\n var len = this.length\n start = ~~start\n end = end === undefined ? len : ~~end\n\n if (start < 0) {\n start += len\n if (start < 0) start = 0\n } else if (start > len) {\n start = len\n }\n\n if (end < 0) {\n end += len\n if (end < 0) end = 0\n } else if (end > len) {\n end = len\n }\n\n if (end < start) end = start\n\n var newBuf\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n newBuf = this.subarray(start, end)\n newBuf.__proto__ = Buffer.prototype\n } else {\n var sliceLen = end - start\n newBuf = new Buffer(sliceLen, undefined)\n for (var i = 0; i < sliceLen; ++i) {\n newBuf[i] = this[i + start]\n }\n }\n\n return newBuf\n}\n\n/*\n * Need to make sure that buffer isn't trying to write out of bounds.\n */\nfunction checkOffset (offset, ext, length) {\n if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n}\n\nBuffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var val = this[offset]\n var mul = 1\n var i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) {\n checkOffset(offset, byteLength, this.length)\n }\n\n var val = this[offset + --byteLength]\n var mul = 1\n while (byteLength > 0 && (mul *= 0x100)) {\n val += this[offset + --byteLength] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 1, this.length)\n return this[offset]\n}\n\nBuffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n return this[offset] | (this[offset + 1] << 8)\n}\n\nBuffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n return (this[offset] << 8) | this[offset + 1]\n}\n\nBuffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return ((this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16)) +\n (this[offset + 3] * 0x1000000)\n}\n\nBuffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] * 0x1000000) +\n ((this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n this[offset + 3])\n}\n\nBuffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var val = this[offset]\n var mul = 1\n var i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var i = byteLength\n var mul = 1\n var val = this[offset + --i]\n while (i > 0 && (mul *= 0x100)) {\n val += this[offset + --i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readInt8 = function readInt8 (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 1, this.length)\n if (!(this[offset] & 0x80)) return (this[offset])\n return ((0xff - this[offset] + 1) * -1)\n}\n\nBuffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n var val = this[offset] | (this[offset + 1] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n var val = this[offset + 1] | (this[offset] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16) |\n (this[offset + 3] << 24)\n}\n\nBuffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] << 24) |\n (this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n (this[offset + 3])\n}\n\nBuffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, true, 23, 4)\n}\n\nBuffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, false, 23, 4)\n}\n\nBuffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, true, 52, 8)\n}\n\nBuffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, false, 52, 8)\n}\n\nfunction checkInt (buf, value, offset, ext, max, min) {\n if (!Buffer.isBuffer(buf)) throw new TypeError('\"buffer\" argument must be a Buffer instance')\n if (value > max || value < min) throw new RangeError('\"value\" argument is out of bounds')\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n}\n\nBuffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) {\n var maxBytes = Math.pow(2, 8 * byteLength) - 1\n checkInt(this, value, offset, byteLength, maxBytes, 0)\n }\n\n var mul = 1\n var i = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) {\n var maxBytes = Math.pow(2, 8 * byteLength) - 1\n checkInt(this, value, offset, byteLength, maxBytes, 0)\n }\n\n var i = byteLength - 1\n var mul = 1\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)\n if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nfunction objectWriteUInt16 (buf, value, offset, littleEndian) {\n if (value < 0) value = 0xffff + value + 1\n for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {\n buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>\n (littleEndian ? i : 1 - i) * 8\n }\n}\n\nBuffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n } else {\n objectWriteUInt16(this, value, offset, true)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n } else {\n objectWriteUInt16(this, value, offset, false)\n }\n return offset + 2\n}\n\nfunction objectWriteUInt32 (buf, value, offset, littleEndian) {\n if (value < 0) value = 0xffffffff + value + 1\n for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {\n buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff\n }\n}\n\nBuffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset + 3] = (value >>> 24)\n this[offset + 2] = (value >>> 16)\n this[offset + 1] = (value >>> 8)\n this[offset] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, true)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, false)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) {\n var limit = Math.pow(2, 8 * byteLength - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n var i = 0\n var mul = 1\n var sub = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {\n sub = 1\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) {\n var limit = Math.pow(2, 8 * byteLength - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n var i = byteLength - 1\n var mul = 1\n var sub = 0\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {\n sub = 1\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)\n if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)\n if (value < 0) value = 0xff + value + 1\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nBuffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n } else {\n objectWriteUInt16(this, value, offset, true)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n } else {\n objectWriteUInt16(this, value, offset, false)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n this[offset + 2] = (value >>> 16)\n this[offset + 3] = (value >>> 24)\n } else {\n objectWriteUInt32(this, value, offset, true)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n if (value < 0) value = 0xffffffff + value + 1\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, false)\n }\n return offset + 4\n}\n\nfunction checkIEEE754 (buf, value, offset, ext, max, min) {\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n if (offset < 0) throw new RangeError('Index out of range')\n}\n\nfunction writeFloat (buf, value, offset, littleEndian, noAssert) {\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)\n }\n ieee754.write(buf, value, offset, littleEndian, 23, 4)\n return offset + 4\n}\n\nBuffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {\n return writeFloat(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {\n return writeFloat(this, value, offset, false, noAssert)\n}\n\nfunction writeDouble (buf, value, offset, littleEndian, noAssert) {\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)\n }\n ieee754.write(buf, value, offset, littleEndian, 52, 8)\n return offset + 8\n}\n\nBuffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {\n return writeDouble(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {\n return writeDouble(this, value, offset, false, noAssert)\n}\n\n// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)\nBuffer.prototype.copy = function copy (target, targetStart, start, end) {\n if (!start) start = 0\n if (!end && end !== 0) end = this.length\n if (targetStart >= target.length) targetStart = target.length\n if (!targetStart) targetStart = 0\n if (end > 0 && end < start) end = start\n\n // Copy 0 bytes; we're done\n if (end === start) return 0\n if (target.length === 0 || this.length === 0) return 0\n\n // Fatal error conditions\n if (targetStart < 0) {\n throw new RangeError('targetStart out of bounds')\n }\n if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')\n if (end < 0) throw new RangeError('sourceEnd out of bounds')\n\n // Are we oob?\n if (end > this.length) end = this.length\n if (target.length - targetStart < end - start) {\n end = target.length - targetStart + start\n }\n\n var len = end - start\n var i\n\n if (this === target && start < targetStart && targetStart < end) {\n // descending copy from end\n for (i = len - 1; i >= 0; --i) {\n target[i + targetStart] = this[i + start]\n }\n } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {\n // ascending copy from start\n for (i = 0; i < len; ++i) {\n target[i + targetStart] = this[i + start]\n }\n } else {\n Uint8Array.prototype.set.call(\n target,\n this.subarray(start, start + len),\n targetStart\n )\n }\n\n return len\n}\n\n// Usage:\n// buffer.fill(number[, offset[, end]])\n// buffer.fill(buffer[, offset[, end]])\n// buffer.fill(string[, offset[, end]][, encoding])\nBuffer.prototype.fill = function fill (val, start, end, encoding) {\n // Handle string cases:\n if (typeof val === 'string') {\n if (typeof start === 'string') {\n encoding = start\n start = 0\n end = this.length\n } else if (typeof end === 'string') {\n encoding = end\n end = this.length\n }\n if (val.length === 1) {\n var code = val.charCodeAt(0)\n if (code < 256) {\n val = code\n }\n }\n if (encoding !== undefined && typeof encoding !== 'string') {\n throw new TypeError('encoding must be a string')\n }\n if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {\n throw new TypeError('Unknown encoding: ' + encoding)\n }\n } else if (typeof val === 'number') {\n val = val & 255\n }\n\n // Invalid ranges are not set to a default, so can range check early.\n if (start < 0 || this.length < start || this.length < end) {\n throw new RangeError('Out of range index')\n }\n\n if (end <= start) {\n return this\n }\n\n start = start >>> 0\n end = end === undefined ? this.length : end >>> 0\n\n if (!val) val = 0\n\n var i\n if (typeof val === 'number') {\n for (i = start; i < end; ++i) {\n this[i] = val\n }\n } else {\n var bytes = Buffer.isBuffer(val)\n ? val\n : utf8ToBytes(new Buffer(val, encoding).toString())\n var len = bytes.length\n for (i = 0; i < end - start; ++i) {\n this[i + start] = bytes[i % len]\n }\n }\n\n return this\n}\n\n// HELPER FUNCTIONS\n// ================\n\nvar INVALID_BASE64_RE = /[^+\\/0-9A-Za-z-_]/g\n\nfunction base64clean (str) {\n // Node strips out invalid characters like \\n and \\t from the string, base64-js does not\n str = stringtrim(str).replace(INVALID_BASE64_RE, '')\n // Node converts strings with length < 2 to ''\n if (str.length < 2) return ''\n // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not\n while (str.length % 4 !== 0) {\n str = str + '='\n }\n return str\n}\n\nfunction stringtrim (str) {\n if (str.trim) return str.trim()\n return str.replace(/^\\s+|\\s+$/g, '')\n}\n\nfunction toHex (n) {\n if (n < 16) return '0' + n.toString(16)\n return n.toString(16)\n}\n\nfunction utf8ToBytes (string, units) {\n units = units || Infinity\n var codePoint\n var length = string.length\n var leadSurrogate = null\n var bytes = []\n\n for (var i = 0; i < length; ++i) {\n codePoint = string.charCodeAt(i)\n\n // is surrogate component\n if (codePoint > 0xD7FF && codePoint < 0xE000) {\n // last char was a lead\n if (!leadSurrogate) {\n // no lead yet\n if (codePoint > 0xDBFF) {\n // unexpected trail\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n } else if (i + 1 === length) {\n // unpaired lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n }\n\n // valid lead\n leadSurrogate = codePoint\n\n continue\n }\n\n // 2 leads in a row\n if (codePoint < 0xDC00) {\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n leadSurrogate = codePoint\n continue\n }\n\n // valid surrogate pair\n codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000\n } else if (leadSurrogate) {\n // valid bmp char, but last char was a lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n }\n\n leadSurrogate = null\n\n // encode utf8\n if (codePoint < 0x80) {\n if ((units -= 1) < 0) break\n bytes.push(codePoint)\n } else if (codePoint < 0x800) {\n if ((units -= 2) < 0) break\n bytes.push(\n codePoint >> 0x6 | 0xC0,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x10000) {\n if ((units -= 3) < 0) break\n bytes.push(\n codePoint >> 0xC | 0xE0,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x110000) {\n if ((units -= 4) < 0) break\n bytes.push(\n codePoint >> 0x12 | 0xF0,\n codePoint >> 0xC & 0x3F | 0x80,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else {\n throw new Error('Invalid code point')\n }\n }\n\n return bytes\n}\n\nfunction asciiToBytes (str) {\n var byteArray = []\n for (var i = 0; i < str.length; ++i) {\n // Node's code seems to be doing this and not & 0x7F..\n byteArray.push(str.charCodeAt(i) & 0xFF)\n }\n return byteArray\n}\n\nfunction utf16leToBytes (str, units) {\n var c, hi, lo\n var byteArray = []\n for (var i = 0; i < str.length; ++i) {\n if ((units -= 2) < 0) break\n\n c = str.charCodeAt(i)\n hi = c >> 8\n lo = c % 256\n byteArray.push(lo)\n byteArray.push(hi)\n }\n\n return byteArray\n}\n\nfunction base64ToBytes (str) {\n return base64.toByteArray(base64clean(str))\n}\n\nfunction blitBuffer (src, dst, offset, length) {\n for (var i = 0; i < length; ++i) {\n if ((i + offset >= dst.length) || (i >= src.length)) break\n dst[i + offset] = src[i]\n }\n return i\n}\n\nfunction isnan (val) {\n return val !== val // eslint-disable-line no-self-compare\n}\n\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(35)))//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMzQuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYnVmZmVyL2luZGV4LmpzP2I2MzkiXSwic291cmNlc0NvbnRlbnQiOlsiLyohXG4gKiBUaGUgYnVmZmVyIG1vZHVsZSBmcm9tIG5vZGUuanMsIGZvciB0aGUgYnJvd3Nlci5cbiAqXG4gKiBAYXV0aG9yICAgRmVyb3NzIEFib3VraGFkaWplaCA8ZmVyb3NzQGZlcm9zcy5vcmc+IDxodHRwOi8vZmVyb3NzLm9yZz5cbiAqIEBsaWNlbnNlICBNSVRcbiAqL1xuLyogZXNsaW50LWRpc2FibGUgbm8tcHJvdG8gKi9cblxuJ3VzZSBzdHJpY3QnXG5cbnZhciBiYXNlNjQgPSByZXF1aXJlK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QUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QSIsInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///34\n")},function(module,exports){eval('var g;\n\n// This works in non-strict mode\ng = (function() {\n\treturn this;\n})();\n\ntry {\n\t// This works if eval is allowed (see CSP)\n\tg = g || new Function("return this")();\n} catch (e) {\n\t// This works if the window reference is available\n\tif (typeof window === "object") g = window;\n}\n\n// g can still be undefined, but nothing to do about it...\n// We return undefined, instead of nothing here, so it\'s\n// easier to handle this case. if(!global) { ...}\n\nmodule.exports = g;\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMzUuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vKHdlYnBhY2spL2J1aWxkaW4vZ2xvYmFsLmpzP2NkMDAiXSwic291cmNlc0NvbnRlbnQiOlsidmFyIGc7XG5cbi8vIFRoaXMgd29ya3MgaW4gbm9uLXN0cmljdCBtb2RlXG5nID0gKGZ1bmN0aW9uKCkge1xuXHRyZXR1cm4gdGhpcztcbn0pKCk7XG5cbnRyeSB7XG5cdC8vIFRoaXMgd29ya3MgaWYgZXZhbCBpcyBhbGxvd2VkIChzZWUgQ1NQKVxuXHRnID0gZyB8fCBuZXcgRnVuY3Rpb24oXCJyZXR1cm4gdGhpc1wiKSgpO1xufSBjYXRjaCAoZSkge1xuXHQvLyBUaGlzIHdvcmtzIGlmIHRoZSB3aW5kb3cgcmVmZXJlbmNlIGlzIGF2YWlsYWJsZVxuXHRpZiAodHlwZW9mIHdpbmRvdyA9PT0gXCJvYmplY3RcIikgZyA9IHdpbmRvdztcbn1cblxuLy8gZyBjYW4gc3RpbGwgYmUgdW5kZWZpbmVkLCBidXQgbm90aGluZyB0byBkbyBhYm91dCBpdC4uLlxuLy8gV2UgcmV0dXJuIHVuZGVmaW5lZCwgaW5zdGVhZCBvZiBub3RoaW5nIGhlcmUsIHNvIGl0J3Ncbi8vIGVhc2llciB0byBoYW5kbGUgdGhpcyBjYXNlLiBpZighZ2xvYmFsKSB7IC4uLn1cblxubW9kdWxlLmV4cG9ydHMgPSBnO1xuIl0sIm1hcHBpbmdzIjoiQUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOyIsInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///35\n')},function(module,exports,__webpack_require__){"use strict";eval("\n\nexports.byteLength = byteLength\nexports.toByteArray = toByteArray\nexports.fromByteArray = fromByteArray\n\nvar lookup = []\nvar revLookup = []\nvar Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array\n\nvar code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'\nfor (var i = 0, len = code.length; i < len; ++i) {\n lookup[i] = code[i]\n revLookup[code.charCodeAt(i)] = i\n}\n\n// Support decoding URL-safe base64 strings, as Node.js does.\n// See: https://en.wikipedia.org/wiki/Base64#URL_applications\nrevLookup['-'.charCodeAt(0)] = 62\nrevLookup['_'.charCodeAt(0)] = 63\n\nfunction getLens (b64) {\n var len = b64.length\n\n if (len % 4 > 0) {\n throw new Error('Invalid string. Length must be a multiple of 4')\n }\n\n // Trim off extra bytes after placeholder bytes are found\n // See: https://github.com/beatgammit/base64-js/issues/42\n var validLen = b64.indexOf('=')\n if (validLen === -1) validLen = len\n\n var placeHoldersLen = validLen === len\n ? 0\n : 4 - (validLen % 4)\n\n return [validLen, placeHoldersLen]\n}\n\n// base64 is 4/3 + up to two characters of the original data\nfunction byteLength (b64) {\n var lens = getLens(b64)\n var validLen = lens[0]\n var placeHoldersLen = lens[1]\n return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen\n}\n\nfunction _byteLength (b64, validLen, placeHoldersLen) {\n return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen\n}\n\nfunction toByteArray (b64) {\n var tmp\n var lens = getLens(b64)\n var validLen = lens[0]\n var placeHoldersLen = lens[1]\n\n var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))\n\n var curByte = 0\n\n // if there are placeholders, only get up to the last complete 4 chars\n var len = placeHoldersLen > 0\n ? validLen - 4\n : validLen\n\n var i\n for (i = 0; i < len; i += 4) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 18) |\n (revLookup[b64.charCodeAt(i + 1)] << 12) |\n (revLookup[b64.charCodeAt(i + 2)] << 6) |\n revLookup[b64.charCodeAt(i + 3)]\n arr[curByte++] = (tmp >> 16) & 0xFF\n arr[curByte++] = (tmp >> 8) & 0xFF\n arr[curByte++] = tmp & 0xFF\n }\n\n if (placeHoldersLen === 2) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 2) |\n (revLookup[b64.charCodeAt(i + 1)] >> 4)\n arr[curByte++] = tmp & 0xFF\n }\n\n if (placeHoldersLen === 1) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 10) |\n (revLookup[b64.charCodeAt(i + 1)] << 4) |\n (revLookup[b64.charCodeAt(i + 2)] >> 2)\n arr[curByte++] = (tmp >> 8) & 0xFF\n arr[curByte++] = tmp & 0xFF\n }\n\n return arr\n}\n\nfunction tripletToBase64 (num) {\n return lookup[num >> 18 & 0x3F] +\n lookup[num >> 12 & 0x3F] +\n lookup[num >> 6 & 0x3F] +\n lookup[num & 0x3F]\n}\n\nfunction encodeChunk (uint8, start, end) {\n var tmp\n var output = []\n for (var i = start; i < end; i += 3) {\n tmp =\n ((uint8[i] << 16) & 0xFF0000) +\n ((uint8[i + 1] << 8) & 0xFF00) +\n (uint8[i + 2] & 0xFF)\n output.push(tripletToBase64(tmp))\n }\n return output.join('')\n}\n\nfunction fromByteArray (uint8) {\n var tmp\n var len = uint8.length\n var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes\n var parts = []\n var maxChunkLength = 16383 // must be multiple of 3\n\n // go through the array every three bytes, we'll deal with trailing stuff later\n for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {\n parts.push(encodeChunk(\n uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)\n ))\n }\n\n // pad the end with zeros, but make sure to not forget the extra bytes\n if (extraBytes === 1) {\n tmp = uint8[len - 1]\n parts.push(\n lookup[tmp >> 2] +\n lookup[(tmp << 4) & 0x3F] +\n '=='\n )\n } else if (extraBytes === 2) {\n tmp = (uint8[len - 2] << 8) + uint8[len - 1]\n parts.push(\n lookup[tmp >> 10] +\n lookup[(tmp >> 4) & 0x3F] +\n lookup[(tmp << 2) & 0x3F] +\n '='\n )\n }\n\n return parts.join('')\n}\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMzYuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYmFzZTY0LWpzL2luZGV4LmpzPzFmYjUiXSwic291cmNlc0NvbnRlbnQiOlsiJ3VzZSBzdHJpY3QnXG5cbmV4cG9ydHMuYnl0ZUxlbmd0aCA9IGJ5dGVMZW5ndGhcbmV4cG9ydHMudG9CeXRlQXJyYXkgPSB0b0J5dGVBcnJheVxuZXhwb3J0cy5mcm9tQnl0ZUFycmF5ID0gZnJvbUJ5dGVBcnJheVxuXG52YXIgbG9va3VwID0g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es) {\n var e, m\n var eLen = (nBytes * 8) - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var nBits = -7\n var i = isLE ? (nBytes - 1) : 0\n var d = isLE ? -1 : 1\n var s = buffer[offset + i]\n\n i += d\n\n e = s & ((1 << (-nBits)) - 1)\n s >>= (-nBits)\n nBits += eLen\n for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}\n\n m = e & ((1 << (-nBits)) - 1)\n e >>= (-nBits)\n nBits += mLen\n for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}\n\n if (e === 0) {\n e = 1 - eBias\n } else if (e === eMax) {\n return m ? NaN : ((s ? -1 : 1) * Infinity)\n } else {\n m = m + Math.pow(2, mLen)\n e = e - eBias\n }\n return (s ? -1 : 1) * m * Math.pow(2, e - mLen)\n}\n\nexports.write = function (buffer, value, offset, isLE, mLen, nBytes) {\n var e, m, c\n var eLen = (nBytes * 8) - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)\n var i = isLE ? 0 : (nBytes - 1)\n var d = isLE ? 1 : -1\n var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0\n\n value = Math.abs(value)\n\n if (isNaN(value) || value === Infinity) {\n m = isNaN(value) ? 1 : 0\n e = eMax\n } else {\n e = Math.floor(Math.log(value) / Math.LN2)\n if (value * (c = Math.pow(2, -e)) < 1) {\n e--\n c *= 2\n }\n if (e + eBias >= 1) {\n value += rt / c\n } else {\n value += rt * Math.pow(2, 1 - eBias)\n }\n if (value * c >= 2) {\n e++\n c /= 2\n }\n\n if (e + eBias >= eMax) {\n m = 0\n e = eMax\n } else if (e + eBias >= 1) {\n m = ((value * c) - 1) * Math.pow(2, mLen)\n e = e + eBias\n } else {\n m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)\n e = 0\n }\n }\n\n for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}\n\n e = (e << mLen) | m\n eLen += mLen\n for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}\n\n buffer[offset + i - d] |= s * 128\n}\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMzcuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvaWVlZTc1NC9pbmRleC5qcz85MTUyIl0sInNvdXJjZXNDb250ZW50IjpbImV4cG9ydHMucmVhZCA9IGZ1bmN0aW9uIChidWZmZXIsIG9mZnNldCwgaXNMRSwgbUxlbiwgbkJ5dGVzKSB7XG4gIHZhciBlLCBtXG4gIHZhciBlTGVuID0gKG5CeXRlcyAqIDgpIC0gbUxlbiAtIDFcbiAgdmFyIGVNYXggPSAoMSA8PCBlTGVuKSAtIDFcbiAgdmFyIGVCaWFzID0gZU1heCA+PiAxXG4gIHZhciBuQml0cyA9IC03XG4gIHZhciBpID0gaXNMRSA/IChuQnl0ZXMgLSAxKSA6IDBcbiAgdmFyIGQgPSBpc0xFID8gLTEgOiAxXG4gIHZhciBzID0gYnVmZmVyW29mZnNldCArIGldXG5cbiAgaSArPSBkXG5cbiAgZSA9IHMgJiAoKDEgPDwgKC1uQml0cykpIC0gMSlcbiAgcyA+Pj0gKC1uQml0cylcbiAgbkJpdHMgKz0gZUxlblxuICBmb3IgKDsgbkJpdHMgPiAwOyBlID0gKGUgKiAyNTYpICsgYnVmZmVyW29mZnNldCArIGldLCBpICs9IGQsIG5CaXRzIC09IDgpIHt9XG5cbiAgbSA9IGUgJiAoKDEgPDwgKC1uQml0cykpIC0gMSlcbiAgZSA+Pj0gKC1uQml0cylcbiAgbkJpdHMgKz0gbUxlblxuICBmb3IgKDsgbkJpdHMgPiAwOyBtID0gKG0gKiAyNTYpICsgYnVmZmVyW29mZnNldCArIGldLCBpICs9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BO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOyIsInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///37\n")},function(module,exports){eval("var toString = {}.toString;\n\nmodule.exports = Array.isArray || function (arr) {\n return toString.call(arr) == '[object Array]';\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMzguanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvaXNhcnJheS9pbmRleC5qcz9lM2RiIl0sInNvdXJjZXNDb250ZW50IjpbInZhciB0b1N0cmluZyA9IHt9LnRvU3RyaW5nO1xuXG5tb2R1bGUuZXhwb3J0cyA9IEFycmF5LmlzQXJyYXkgfHwgZnVuY3Rpb24gKGFycikge1xuICByZXR1cm4gdG9TdHJpbmcuY2FsbChhcnIpID09ICdbb2JqZWN0IEFycmF5XSc7XG59O1xuIl0sIm1hcHBpbmdzIjoiQUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOyIsInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///38\n")},function(module,exports,__webpack_require__){eval("// extracted by mini-css-extract-plugin//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMzkuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9zcmMvaW5kZXguc3R5bD80YmQ3Il0sInNvdXJjZXNDb250ZW50IjpbIi8vIGV4dHJhY3RlZCBieSBtaW5pLWNzcy1leHRyYWN0LXBsdWdpbiJdLCJtYXBwaW5ncyI6IkFBQUEiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///39\n")},,function(module,__webpack_exports__,__webpack_require__){"use strict";eval("__webpack_require__.r(__webpack_exports__);\n\n// EXTERNAL MODULE: ./node_modules/quill/dist/quill.js\nvar quill = __webpack_require__(3);\nvar quill_default = /*#__PURE__*/__webpack_require__.n(quill);\n\n// EXTERNAL MODULE: ./node_modules/quill/assets/snow.styl\nvar snow = __webpack_require__(15);\n\n// EXTERNAL MODULE: ./src/index.styl\nvar src_0 = __webpack_require__(39);\n\n// EXTERNAL MODULE: ./src/preview.styl\nvar preview = __webpack_require__(16);\n\n// CONCATENATED MODULE: ./src/blots/divider.ts\nvar __extends = (undefined && undefined.__extends) || (function () {\r\n var extendStatics = function (d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n };\r\n return function (d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n };\r\n})();\r\n\r\nvar BlockEmbed = quill_default.a.import('blots/block/embed');\r\nvar DividerBlot = /** @class */ (function (_super) {\r\n __extends(DividerBlot, _super);\r\n function DividerBlot() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n return DividerBlot;\r\n}(BlockEmbed));\r\nDividerBlot.blotName = 'divider';\r\nDividerBlot.tagName = 'hr';\r\nquill_default.a.register(DividerBlot);\r\n\n// EXTERNAL MODULE: ./node_modules/eventemitter3/index.js\nvar eventemitter3 = __webpack_require__(14);\nvar eventemitter3_default = /*#__PURE__*/__webpack_require__.n(eventemitter3);\n\n// CONCATENATED MODULE: ./src/blots/image.ts\nvar image_extends = (undefined && undefined.__extends) || (function () {\r\n var extendStatics = function (d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n };\r\n return function (d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n };\r\n})();\r\nvar __read = (undefined && undefined.__read) || function (o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n};\r\nvar __spread = (undefined && undefined.__spread) || function () {\r\n for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n};\r\n\r\n\r\nvar image_BlockEmbed = quill_default.a.import('blots/block/embed');\r\nvar image_ImageBlot = /** @class */ (function (_super) {\r\n image_extends(ImageBlot, _super);\r\n function ImageBlot(node) {\r\n var _this = _super.call(this, node) || this;\r\n node.addEventListener('click', function (e) {\r\n if (ImageBlot.quill.hasFocus()) {\r\n ImageBlot.quill.blur();\r\n }\r\n });\r\n var _a = ImageBlot.getImgAndValue(node), img = _a.img, _b = _a.value, id = _b.id, src = _b.src, srcNode = _b.srcNode, _c = _b.width, width = _c === void 0 ? 0 : _c, _d = _b.height, height = _d === void 0 ? 0 : _d;\r\n if (id) {\r\n node.classList.add(\"image-\" + id);\r\n var status_1 = ImageBlot.uploadStatus[id];\r\n if (status_1) {\r\n ImageBlot.eventEmitter.emit('reinsert', {\r\n id: id,\r\n status: status_1.status || 'UPLOADING',\r\n });\r\n }\r\n else {\r\n ImageBlot.uploadStatus[id] = {};\r\n }\r\n }\r\n if (img && src) {\r\n var appendEls_1 = function (width, height) {\r\n var wrap = node.querySelector('.image-wrap');\r\n if (width >= 50 && height >= 50) {\r\n if (!node.querySelector('.remove')) {\r\n var div = ImageBlot.createDiv('remove');\r\n div.addEventListener('click', function () {\r\n _this.remove();\r\n });\r\n wrap.appendChild(div);\r\n }\r\n }\r\n if (id) {\r\n ImageBlot.refreshUpload(id);\r\n }\r\n else if (!srcNode) {\r\n var remoteId = \"remote-\" + ImageBlot.remoteCounter++;\r\n node.classList.add(remoteId);\r\n ImageBlot.eventEmitter.emit('insertRemoteImage', {\r\n remoteId: remoteId,\r\n src: src,\r\n width: width,\r\n height: height,\r\n });\r\n }\r\n };\r\n if (width && height) {\r\n appendEls_1(width, height);\r\n }\r\n else {\r\n img.addEventListener('load', function (e) {\r\n if (img.naturalWidth && img.naturalHeight) {\r\n img.dataset.width = \"\" + img.naturalWidth;\r\n img.dataset.height = \"\" + img.naturalHeight;\r\n }\r\n appendEls_1(img.naturalWidth, img.naturalHeight);\r\n });\r\n }\r\n }\r\n return _this;\r\n }\r\n ImageBlot.refreshUpload = function (id) {\r\n setTimeout(function () {\r\n var _a = ImageBlot.uploadStatus[id] || {}, status = _a.status, progress = _a.progress, error = _a.error, src = _a.src, srcNode = _a.srcNode;\r\n if (status === 'UPLOADING') {\r\n ImageBlot.updateUploadProgress(id, progress);\r\n }\r\n else if (status === 'SUCCESS') {\r\n ImageBlot.setUploadSuccess(id, src, srcNode);\r\n }\r\n else if (status === 'ERROR') {\r\n ImageBlot.setUploadError(id, error);\r\n }\r\n }, 0);\r\n };\r\n ImageBlot.uploadRemoteImage = function (remoteId, id) {\r\n if (ImageBlot.uploadStatus[id])\r\n return;\r\n var node = document.querySelector(\"div.\" + remoteId);\r\n if (node) {\r\n ImageBlot.uploadStatus[id] = {};\r\n node.classList.add(\"image-\" + id);\r\n node.classList.remove(remoteId);\r\n node.querySelector('img.image').dataset.id = id;\r\n }\r\n };\r\n ImageBlot.updateUploadProgress = function (id, progress) {\r\n if ((ImageBlot.uploadStatus[id] || {}).status === 'SUCCESS')\r\n return;\r\n ImageBlot.uploadStatus[id] = { status: 'UPLOADING', progress: Math.round(progress) };\r\n document.querySelectorAll(\"div.image-\" + id).forEach(function (node) {\r\n node.classList.remove('fail');\r\n var wrap = node.querySelector('.image-wrap');\r\n if (!wrap.querySelector('.progress-bar')) {\r\n var div = ImageBlot.createDiv('progress-bar');\r\n var child = ImageBlot.createDiv('progress');\r\n child.style.width = Math.round(progress) + \"%\";\r\n div.appendChild(child);\r\n wrap.appendChild(div);\r\n }\r\n else {\r\n var child = wrap.querySelector('.progress');\r\n child.style.width = Math.round(progress) + \"%\";\r\n }\r\n });\r\n };\r\n ImageBlot.setUploadError = function (id, error) {\r\n if ((ImageBlot.uploadStatus[id] || {}).status === 'SUCCESS')\r\n return;\r\n ImageBlot.uploadStatus[id] = { status: 'ERROR', error: error };\r\n document.querySelectorAll(\"div.image-\" + id).forEach(function (node) {\r\n if (!node.classList.contains('fail'))\r\n node.classList.add('fail');\r\n var wrap = node.querySelector('.image-wrap');\r\n var div = wrap.querySelector('div.error');\r\n if (!div) {\r\n div = ImageBlot.createDiv('error');\r\n div.addEventListener('click', function () {\r\n node.classList.remove('fail');\r\n ImageBlot.uploadStatus[id] = {};\r\n ImageBlot.eventEmitter.emit('reupload', { id: id });\r\n });\r\n wrap.appendChild(div);\r\n }\r\n var html = '上传失败,点击重试';\r\n if (error) {\r\n html += \"\" + error + \"\";\r\n }\r\n div.innerHTML = html;\r\n });\r\n };\r\n ImageBlot.setUploadSuccess = function (id, src, srcNode) {\r\n ImageBlot.uploadStatus[id] = { status: 'SUCCESS', src: src };\r\n document.querySelectorAll(\"div.image-\" + id).forEach(function (node) {\r\n var p = node.querySelector('div.progress-bar');\r\n var e = node.querySelector('div.error');\r\n if (p)\r\n p.remove();\r\n if (e)\r\n e.remove();\r\n var img = node.querySelector('img.image');\r\n if (img) {\r\n // img.setAttribute('src', src) 将导致图片闪动\r\n if (srcNode) {\r\n img.dataset.srcNode = srcNode;\r\n }\r\n img.dataset.src = src;\r\n }\r\n node.classList.remove(\"image-\" + id);\r\n });\r\n };\r\n ImageBlot.createDiv = function () {\r\n var _a;\r\n var classNames = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n classNames[_i] = arguments[_i];\r\n }\r\n var div = document.createElement('div');\r\n div.setAttribute('contenteditable', 'false');\r\n if (classNames.length > 0) {\r\n (_a = div.classList).add.apply(_a, __spread(classNames));\r\n }\r\n return div;\r\n };\r\n ImageBlot.create = function (value) {\r\n if (typeof value === 'string') {\r\n value = { src: value };\r\n }\r\n var node = _super.create.call(this);\r\n node.setAttribute('contenteditable', 'false');\r\n var wrap = ImageBlot.createDiv('image-wrap');\r\n node.appendChild(wrap);\r\n var img = document.createElement('img');\r\n img.classList.add('image');\r\n if (value.id) {\r\n img.dataset.id = value.id;\r\n }\r\n if (value.width && value.height) {\r\n img.dataset.width = \"\" + value.width;\r\n img.dataset.height = \"\" + value.height;\r\n }\r\n if (value.srcNode) {\r\n img.dataset.srcNode = value.srcNode;\r\n }\r\n img.setAttribute('src', value.src);\r\n wrap.appendChild(img);\r\n return node;\r\n };\r\n ImageBlot.getImgAndValue = function (node) {\r\n var img = node.tagName.toUpperCase() === 'IMG'\r\n ? node\r\n : node.querySelector('img.image');\r\n var value = {\r\n src: (img && img.getAttribute('src')) || '',\r\n };\r\n if (img) {\r\n if (img.dataset.id) {\r\n value.id = img.dataset.id;\r\n }\r\n var width = Number(img.dataset.width);\r\n var height = Number(img.dataset.height);\r\n if (width && height) {\r\n value.width = width;\r\n value.height = height;\r\n }\r\n if (img.dataset.srcNode) {\r\n value.srcNode = img.dataset.srcNode;\r\n }\r\n }\r\n return { img: img, value: value };\r\n };\r\n ImageBlot.value = function (node) {\r\n return ImageBlot.getImgAndValue(node).value;\r\n };\r\n ImageBlot.prototype.remove = function () {\r\n var id = ImageBlot.value(this.domNode).id;\r\n if (id) {\r\n var status_2 = ImageBlot.uploadStatus[id];\r\n ImageBlot.eventEmitter.emit('remove', {\r\n id: id,\r\n status: status_2.status || 'UPLOADING',\r\n });\r\n }\r\n _super.prototype.remove.call(this);\r\n };\r\n ImageBlot.pendingImages = function () {\r\n return Object.keys(ImageBlot.uploadStatus).filter(function (id) {\r\n return ImageBlot.uploadStatus[id].status !== 'SUCCESS';\r\n });\r\n };\r\n ImageBlot.buildHtml = function (node) {\r\n node.querySelectorAll('div.image-container').forEach(function (el) {\r\n var img = el.querySelector('img.image');\r\n if (img && (!img.dataset.id || img.dataset.src)) {\r\n if (img.dataset.src) {\r\n img.setAttribute('src', img.dataset.src);\r\n delete img.dataset.src;\r\n }\r\n delete img.dataset.id;\r\n img.removeAttribute('class');\r\n img.removeAttribute('style');\r\n el.parentNode.insertBefore(img, el.nextSibling);\r\n }\r\n el.remove();\r\n });\r\n return node;\r\n };\r\n ImageBlot.tagName = 'div';\r\n ImageBlot.blotName = 'image';\r\n ImageBlot.className = 'image-container';\r\n ImageBlot.remoteCounter = 1;\r\n ImageBlot.eventEmitter = new eventemitter3_default.a();\r\n ImageBlot.uploadStatus = {};\r\n return ImageBlot;\r\n}(image_BlockEmbed));\r\n\r\nquill_default.a.register(image_ImageBlot);\r\n\n// CONCATENATED MODULE: ./src/blots/video.ts\nvar video_extends = (undefined && undefined.__extends) || (function () {\r\n var extendStatics = function (d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n };\r\n return function (d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n };\r\n})();\r\nvar video_read = (undefined && undefined.__read) || function (o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n};\r\nvar video_spread = (undefined && undefined.__spread) || function () {\r\n for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(video_read(arguments[i]));\r\n return ar;\r\n};\r\n\r\n\r\nvar video_BlockEmbed = quill_default.a.import('blots/block/embed');\r\nvar video_VideoBlot = /** @class */ (function (_super) {\r\n video_extends(VideoBlot, _super);\r\n function VideoBlot(node) {\r\n var _this = _super.call(this, node) || this;\r\n node.addEventListener('click', function (e) {\r\n if (VideoBlot.quill.hasFocus()) {\r\n VideoBlot.quill.blur();\r\n }\r\n });\r\n var _a = VideoBlot.getVideoAndValue(node), video = _a.video, _b = _a.value, id = _b.id, src = _b.src, width = _b.width, height = _b.height;\r\n if (id) {\r\n node.classList.add(\"video-\" + id);\r\n var status_1 = VideoBlot.uploadStatus[id];\r\n if (status_1) {\r\n VideoBlot.eventEmitter.emit('reinsert', {\r\n id: id,\r\n status: status_1.status || 'UPLOADING',\r\n });\r\n }\r\n else {\r\n VideoBlot.uploadStatus[id] = {};\r\n }\r\n }\r\n if (video && src) {\r\n if (id && !node.querySelector('.progress-bar')) {\r\n var div = VideoBlot.createDiv('progress-bar');\r\n div.appendChild(VideoBlot.createDiv('progress'));\r\n node.appendChild(div);\r\n }\r\n if (id && !node.querySelector('.error')) {\r\n var div = VideoBlot.createDiv('error');\r\n div.addEventListener('click', function () {\r\n VideoBlot.uploadStatus[id] = {};\r\n _this.domNode.classList.remove('fail');\r\n VideoBlot.eventEmitter.emit('reupload', { id: id });\r\n });\r\n node.appendChild(div);\r\n }\r\n if (!node.querySelector('.remove')) {\r\n var div = VideoBlot.createDiv('remove');\r\n div.addEventListener('click', function () {\r\n _this.remove();\r\n });\r\n node.appendChild(div);\r\n }\r\n if (id)\r\n VideoBlot.refreshUpload(id);\r\n }\r\n return _this;\r\n }\r\n VideoBlot.refreshUpload = function (id) {\r\n setTimeout(function () {\r\n var _a = VideoBlot.uploadStatus[id] || {}, status = _a.status, progress = _a.progress, error = _a.error, src = _a.src, srcNode = _a.srcNode, poster = _a.poster, posterNode = _a.posterNode;\r\n if (status === 'UPLOADING') {\r\n VideoBlot.updateUploadProgress(id, progress);\r\n }\r\n else if (status === 'SUCCESS') {\r\n VideoBlot.setUploadSuccess(id, { src: src, srcNode: srcNode, poster: poster, posterNode: posterNode });\r\n }\r\n else if (status === 'ERROR') {\r\n VideoBlot.setUploadError(id, error);\r\n }\r\n }, 0);\r\n };\r\n VideoBlot.updateUploadProgress = function (id, progress) {\r\n if ((VideoBlot.uploadStatus[id] || {}).status === 'SUCCESS')\r\n return;\r\n VideoBlot.uploadStatus[id] = { status: 'UPLOADING', progress: Math.round(progress) };\r\n document.querySelectorAll(\"div.video-\" + id).forEach(function (node) {\r\n node.classList.remove('fail');\r\n node.querySelector('div.progress').style.width = Math.round(progress) + \"%\";\r\n });\r\n };\r\n VideoBlot.setUploadError = function (id, error) {\r\n if ((VideoBlot.uploadStatus[id] || {}).status === 'SUCCESS')\r\n return;\r\n VideoBlot.uploadStatus[id] = { status: 'ERROR', error: error };\r\n document.querySelectorAll(\"div.video-\" + id).forEach(function (node) {\r\n if (!node.classList.contains('fail'))\r\n node.classList.add('fail');\r\n var div = node.querySelector('div.error');\r\n if (div) {\r\n var html = '上传失败,点击重试';\r\n if (error) {\r\n html += \"\" + error + \"\";\r\n }\r\n div.innerHTML = html;\r\n }\r\n });\r\n };\r\n VideoBlot.setUploadSuccess = function (id, options) {\r\n var src = options.src, srcNode = options.srcNode, poster = options.poster, posterNode = options.posterNode;\r\n VideoBlot.uploadStatus[id] = { status: 'SUCCESS', src: src, poster: poster };\r\n if (srcNode) {\r\n VideoBlot.uploadStatus[id].srcNode = srcNode;\r\n }\r\n if (posterNode) {\r\n VideoBlot.uploadStatus[id].posterNode = posterNode;\r\n }\r\n document.querySelectorAll(\"div.video-\" + id).forEach(function (node) {\r\n node.querySelector('div.progress-bar').remove();\r\n node.querySelector('div.error').remove();\r\n var video = node.querySelector('video');\r\n if (video) {\r\n video.dataset.src = src;\r\n video.dataset.poster = poster;\r\n if (srcNode) {\r\n video.dataset.srcNode = srcNode;\r\n }\r\n if (posterNode) {\r\n video.dataset.posterNode = posterNode;\r\n }\r\n }\r\n node.classList.remove(\"video-\" + id);\r\n });\r\n };\r\n VideoBlot.createDiv = function () {\r\n var _a;\r\n var classNames = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n classNames[_i] = arguments[_i];\r\n }\r\n var div = document.createElement('div');\r\n div.setAttribute('contenteditable', 'false');\r\n if (classNames.length > 0) {\r\n (_a = div.classList).add.apply(_a, video_spread(classNames));\r\n }\r\n return div;\r\n };\r\n VideoBlot.create = function (value) {\r\n var node = _super.create.call(this);\r\n node.setAttribute('contenteditable', 'false');\r\n var video = document.createElement('video');\r\n if (value.id) {\r\n video.dataset.id = value.id;\r\n }\r\n if (value.width && value.height) {\r\n video.dataset.width = \"\" + value.width;\r\n video.dataset.height = \"\" + value.height;\r\n }\r\n else {\r\n video.dataset.width = '0';\r\n video.dataset.height = '0';\r\n }\r\n if (value.srcNode) {\r\n video.dataset.srcNode = value.srcNode;\r\n }\r\n if (value.posterNode) {\r\n video.dataset.posterNode = value.posterNode;\r\n }\r\n video.setAttribute('src', value.src);\r\n video.setAttribute('poster', value.poster);\r\n node.appendChild(video);\r\n return node;\r\n };\r\n VideoBlot.getVideoAndValue = function (node) {\r\n var video = node.tagName.toUpperCase() === 'VIDEO'\r\n ? node\r\n : node.querySelector('video');\r\n var value = {\r\n src: (video && video.getAttribute('src')) || '',\r\n poster: (video && video.getAttribute('poster')) || '',\r\n };\r\n if (video) {\r\n if (video.dataset.id) {\r\n value.id = video.dataset.id;\r\n }\r\n var width = Number(video.dataset.width);\r\n var height = Number(video.dataset.height);\r\n if (width && height) {\r\n value.width = width;\r\n value.height = height;\r\n }\r\n if (video.dataset.srcNode) {\r\n value.srcNode = video.dataset.srcNode;\r\n }\r\n if (video.dataset.posterNode) {\r\n value.posterNode = video.dataset.posterNode;\r\n }\r\n }\r\n return { video: video, value: value };\r\n };\r\n VideoBlot.value = function (node) {\r\n return VideoBlot.getVideoAndValue(node).value;\r\n };\r\n VideoBlot.prototype.remove = function () {\r\n var id = VideoBlot.value(this.domNode).id;\r\n if (id) {\r\n var status_2 = VideoBlot.uploadStatus[id];\r\n VideoBlot.eventEmitter.emit('remove', {\r\n id: id,\r\n status: status_2.status || 'UPLOADING',\r\n });\r\n }\r\n _super.prototype.remove.call(this);\r\n };\r\n VideoBlot.pendingVideos = function () {\r\n return Object.keys(VideoBlot.uploadStatus).filter(function (id) {\r\n return VideoBlot.uploadStatus[id].status !== 'SUCCESS';\r\n });\r\n };\r\n VideoBlot.buildHtml = function (node) {\r\n node.querySelectorAll('div.video-container').forEach(function (el) {\r\n var video = el.querySelector('video');\r\n if (video && (!video.dataset.id || video.dataset.src)) {\r\n if (video.dataset.src) {\r\n video.setAttribute('src', video.dataset.src);\r\n delete video.dataset.src;\r\n }\r\n if (video.dataset.poster) {\r\n video.setAttribute('poster', video.dataset.poster);\r\n delete video.dataset.poster;\r\n }\r\n delete video.dataset.id;\r\n video.removeAttribute('class');\r\n video.removeAttribute('style');\r\n el.parentNode.insertBefore(video, el.nextSibling);\r\n }\r\n el.remove();\r\n });\r\n return node;\r\n };\r\n VideoBlot.tagName = 'div';\r\n VideoBlot.blotName = 'video';\r\n VideoBlot.className = 'video-container';\r\n VideoBlot.eventEmitter = new eventemitter3_default.a();\r\n VideoBlot.uploadStatus = {};\r\n return VideoBlot;\r\n}(video_BlockEmbed));\r\n\r\nquill_default.a.register(video_VideoBlot);\r\n\n// EXTERNAL MODULE: ./src/caller.ts + 1 modules\nvar caller = __webpack_require__(1);\n\n// EXTERNAL MODULE: ./src/common.ts\nvar common = __webpack_require__(4);\n\n// CONCATENATED MODULE: ./src/index.ts\nvar __values = (undefined && undefined.__values) || function(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n};\r\n\r\n\r\n\r\n\r\n// import blots\r\n\r\n\r\n\r\n\r\n\r\nvar Header = quill_default.a.import('formats/header');\r\nHeader.tagName = ['H1'];\r\nvar quillSelection;\r\nvar src_quill = new quill_default.a('#editor', {\r\n debug: false,\r\n theme: 'snow',\r\n placeholder: '',\r\n formats: ['bold', 'header', 'blockquote', 'link', 'image', 'video'],\r\n modules: {\r\n toolbar: {\r\n container: '#toolbar',\r\n handlers: {\r\n // 分隔符\r\n divider: function () {\r\n var range = this.quill.getSelection(true);\r\n this.quill.insertText(range.index, '\\n', 'user');\r\n this.quill.insertEmbed(range.index + 1, 'divider', true, 'user');\r\n this.quill.setSelection(range.index + 2, 0, 'silent');\r\n },\r\n // 插入图片\r\n image: function () {\r\n quillSelection = src_quill.getSelection(true);\r\n src_quill.blur();\r\n if (!Object(caller[\"a\" /* callMethod */])('chooseImage')) {\r\n console.log('chooseImage');\r\n }\r\n },\r\n video: function () {\r\n quillSelection = src_quill.getSelection(true);\r\n src_quill.blur();\r\n if (!Object(caller[\"a\" /* callMethod */])('chooseVideo')) {\r\n console.log('chooseVideo');\r\n }\r\n },\r\n undo: function () {\r\n // @ts-ignore\r\n src_quill.history.undo();\r\n },\r\n redo: function () {\r\n // @ts-ignore\r\n src_quill.history.redo();\r\n },\r\n },\r\n },\r\n clipboard: {\r\n matchers: [\r\n [\r\n 'IMG',\r\n function (node, delta) {\r\n var src = node.getAttribute('src');\r\n delta.forEach(function (op) {\r\n if (op.insert && op.insert.image === src) {\r\n op.insert = { image: image_ImageBlot.value(node) };\r\n }\r\n });\r\n return delta;\r\n },\r\n ],\r\n [\r\n 'VIDEO',\r\n function (node, delta) {\r\n return delta.delete(delta.length()).insert({\r\n video: video_VideoBlot.value(node),\r\n });\r\n },\r\n ],\r\n // 粘贴时提取纯文本\r\n [\r\n Node.TEXT_NODE,\r\n function (node, delta) {\r\n var ops = [];\r\n delta.ops.forEach(function (op) {\r\n if (op.insert && typeof op.insert === 'string') {\r\n ops.push({\r\n insert: op.insert,\r\n });\r\n }\r\n });\r\n delta.ops = ops;\r\n return delta;\r\n },\r\n ],\r\n ],\r\n },\r\n },\r\n});\r\n/** 设置编辑器内容 */\r\nwindow.setContentReceiver = function (data) {\r\n src_quill.clipboard.dangerouslyPasteHTML(data);\r\n setTimeout(common[\"b\" /* fixSize */], 0);\r\n};\r\nimage_ImageBlot.quill = src_quill;\r\nimage_ImageBlot.eventEmitter.on('remove', function (data) {\r\n if (!Object(caller[\"a\" /* callMethod */])('removeImage', data)) {\r\n console.log('removeImage', data);\r\n }\r\n});\r\nimage_ImageBlot.eventEmitter.on('reinsert', function (data) {\r\n if (!Object(caller[\"a\" /* callMethod */])('reinsertImage', data)) {\r\n console.log('reinsertImage', data);\r\n }\r\n});\r\nimage_ImageBlot.eventEmitter.on('reupload', function (data) {\r\n if (!Object(caller[\"a\" /* callMethod */])('reuploadImage', data)) {\r\n console.log('reuploadImage', data);\r\n }\r\n});\r\nimage_ImageBlot.eventEmitter.on('insertRemoteImage', function (data) {\r\n if (!Object(caller[\"a\" /* callMethod */])('insertRemoteImage', data)) {\r\n console.log('insertRemoteImage', data);\r\n }\r\n});\r\n/** 收到图片后预览 */\r\nwindow.imagePreviewReceiver = function (data) {\r\n var e_1, _a;\r\n var srcList = JSON.parse(data);\r\n var index = quillSelection.index;\r\n try {\r\n for (var srcList_1 = __values(srcList), srcList_1_1 = srcList_1.next(); !srcList_1_1.done; srcList_1_1 = srcList_1.next()) {\r\n var item = srcList_1_1.value;\r\n src_quill.insertEmbed(index++, 'image', {\r\n id: \"\" + (item.id || ''),\r\n src: \"\" + item.url,\r\n width: +item.width,\r\n height: +item.height,\r\n }, 'user');\r\n }\r\n }\r\n catch (e_1_1) { e_1 = { error: e_1_1 }; }\r\n finally {\r\n try {\r\n if (srcList_1_1 && !srcList_1_1.done && (_a = srcList_1.return)) _a.call(srcList_1);\r\n }\r\n finally { if (e_1) throw e_1.error; }\r\n }\r\n setTimeout(common[\"a\" /* fixImageSize */], 0);\r\n};\r\nwindow.uploadRemoteImage = function (data) {\r\n var _a = JSON.parse(data) || {}, id = _a.id, remoteId = _a.remoteId;\r\n if (remoteId && \"\" + (id || '')) {\r\n image_ImageBlot.uploadRemoteImage(remoteId, \"\" + id);\r\n }\r\n};\r\n/** 更新图片上传进度 */\r\nwindow.imageProgressReceiver = function (data) {\r\n var _a = JSON.parse(data) || {}, id = _a.id, progress = _a.progress;\r\n image_ImageBlot.updateUploadProgress(\"\" + id, Number(progress));\r\n};\r\n/** 设置图片上传成功 */\r\nwindow.imageUrlReceiver = function (data) {\r\n var _a = JSON.parse(data) || {}, id = _a.id, url = _a.url, node = _a.node;\r\n image_ImageBlot.setUploadSuccess(\"\" + id, \"\" + url, \"\" + (node || ''));\r\n};\r\n/** 设置图片上传失败 */\r\nwindow.imageFailedReceiver = function (data) {\r\n var _a = JSON.parse(data) || {}, id = _a.id, error = _a.error;\r\n image_ImageBlot.setUploadError(\"\" + id, \"\" + (error || ''));\r\n};\r\nvideo_VideoBlot.quill = src_quill;\r\nvideo_VideoBlot.eventEmitter.on('remove', function (data) {\r\n if (!Object(caller[\"a\" /* callMethod */])('removeVideo', data)) {\r\n console.log('removeVideo', data);\r\n }\r\n});\r\nvideo_VideoBlot.eventEmitter.on('reinsert', function (data) {\r\n if (!Object(caller[\"a\" /* callMethod */])('reinsertVideo', data)) {\r\n console.log('reinsertVideo', data);\r\n }\r\n});\r\nvideo_VideoBlot.eventEmitter.on('reupload', function (data) {\r\n if (!Object(caller[\"a\" /* callMethod */])('reuploadVideo', data)) {\r\n console.log('reuploadVideo', data);\r\n }\r\n});\r\n/** 收到视频后预览 */\r\nwindow.videoPreviewReceiver = function (data) {\r\n var item = JSON.parse(data);\r\n var index = quillSelection.index;\r\n src_quill.insertEmbed(index++, 'video', {\r\n id: \"\" + (item.id || ''),\r\n src: \"\" + item.url,\r\n poster: \"\" + item.poster,\r\n width: +item.width,\r\n height: +item.height,\r\n }, 'user');\r\n setTimeout(common[\"c\" /* fixVideoSize */], 0);\r\n};\r\n/** 更新视频上传进度 */\r\nwindow.videoProgressReceiver = function (data) {\r\n var _a = JSON.parse(data) || {}, id = _a.id, progress = _a.progress;\r\n video_VideoBlot.updateUploadProgress(\"\" + id, Number(progress));\r\n};\r\n/** 设置视频上传成功 */\r\nwindow.videoUrlReceiver = function (data) {\r\n var _a = JSON.parse(data) || {}, id = _a.id, url = _a.url, urlNode = _a.urlNode, poster = _a.poster, posterNode = _a.posterNode;\r\n video_VideoBlot.setUploadSuccess(\"\" + id, {\r\n src: \"\" + url,\r\n srcNode: \"\" + (urlNode || ''),\r\n poster: \"\" + poster,\r\n posterNode: \"\" + (posterNode || ''),\r\n });\r\n};\r\n/** 设置视频上传失败 */\r\nwindow.videoFailedReceiver = function (data) {\r\n var _a = JSON.parse(data) || {}, id = _a.id, error = _a.error;\r\n video_VideoBlot.setUploadError(\"\" + id, \"\" + (error || ''));\r\n};\r\nwindow.changePlaceholder = function (text) {\r\n var el = document.querySelector(\".ql-editor,.ql-blank\");\r\n if (el) {\r\n el.setAttribute('data-placeholder', text);\r\n }\r\n};\r\nwindow.editorSubmitReceiver = function () {\r\n var html = src_quill.root.innerHTML;\r\n var div;\r\n div = document.createElement('div');\r\n div.innerHTML = html;\r\n div = video_VideoBlot.buildHtml(image_ImageBlot.buildHtml(div));\r\n var isEmpty = !(src_quill.getText() || div.querySelector('video,img'));\r\n var pendingImages = image_ImageBlot.pendingImages();\r\n var pendingVideos = video_VideoBlot.pendingVideos();\r\n var medias = [];\r\n div.querySelectorAll('img, video').forEach(function (el) {\r\n var tagName = el.tagName.toUpperCase();\r\n var _a = el.dataset, srcNode = _a.srcNode, posterNode = _a.posterNode;\r\n if (tagName === 'IMG' && srcNode) {\r\n medias.push({ image: srcNode });\r\n }\r\n else if (tagName === 'VIDEO' && srcNode && posterNode) {\r\n medias.push({ image: posterNode, video: srcNode });\r\n }\r\n });\r\n html = div.innerHTML;\r\n div = null;\r\n if (!Object(caller[\"a\" /* callMethod */])('sendContentHTML', { html: html, medias: medias, pendingImages: pendingImages, pendingVideos: pendingVideos, isEmpty: isEmpty })) {\r\n console.log('sendContentHTML', { html: html, medias: medias, pendingImages: pendingImages, pendingVideos: pendingVideos, isEmpty: isEmpty });\r\n }\r\n};\r\nwindow.quill = src_quill;\r\nwindow.addEventListener('resize', function () {\r\n var range = src_quill.getSelection();\r\n if (range && src_quill.hasFocus()) {\r\n src_quill.setSelection(range);\r\n }\r\n});\r\n/* harmony default export */ var src_1 = __webpack_exports__[\"default\"] = (src_quill);\r\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNDEuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9zcmMvYmxvdHMvZGl2aWRlci50cz80MzljIiwid2VicGFjazovLy8uL3NyYy9ibG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xsOiBRdWlsbCB9KSB7XG4gICAgICAgICAgLy8gQHRzLWlnbm9yZVxuICAgICAgICAgIHF1aWxsLmhpc3RvcnkhLnJlZG8oKVxuICAgICAgICB9LFxuICAgICAgfSxcbiAgICB9LFxuICAgIGNsaXBib2FyZDoge1xuICAgICAgbWF0Y2hlcnM6IFtcbiAgICAgICAgW1xuICAgICAgICAgICdJTUcnLFxuICAgICAgICAgIChub2RlOiBIVE1MSW1hZ2VFbGVtZW50LCBkZWx0YTogRGVsdGEpOiBEZWx0YSA9PiB7XG4gICAgICAgICAgICBjb25zdCBzcmMgPSBub2RlLmdldEF0dHJpYnV0ZSgnc3JjJylcblxuICAgICAgICAgICAgZGVsdGEuZm9yRWFjaCgob3A6IGFueSkgPT4ge1xuICAgICAgICAgICAgICBpZiAob3AuaW5zZXJ0ICYmIG9wLmluc2VydC5pbWFnZSA9PT0gc3JjKSB7XG4gICAgICAgICAgICAgICAgb3AuaW5zZXJ0ID0geyBpbWFnZTogSW1hZ2VCbG90LnZhbHVlKG5vZGUpIH1cbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSlcblxuICAgICAgICAgICAgcmV0dXJuIGRlbHRhXG4gICAgICAgICAgfSxcbiAgICAgICAgXSxcblxuICAgICAgICBbXG4gICAgICAgICAgJ1ZJREVPJyxcbiAgICAgICAgICAobm9kZTogSFRNTFZpZGVvRWxlbWVudCwgZGVsdGE6IERlbHRhKTogRGVsdGEgPT4ge1xuICAgICAgICAgICAgcmV0dXJuIGRlbHRhLmRlbGV0ZShkZWx0YS5sZW5ndGgoKSkuaW5zZXJ0KHtcbiAgICAgICAgICAgICAgdmlkZW86IFZpZGVvQmxvdC52YWx1ZShub2RlKSxcbiAgICAgICAgICAgIH0pXG4gICAgICAgICAgfSxcbiAgICAgICAgXSxcblxuICAgICAgICAvLyDnspjotLTml7bmj5Dlj5bnuq/mlofmnKxcbiAgICAgICAgW1xuICAgICAgICAgIE5vZGUuVEVYVF9OT0RFLFxuICAgICAgIC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NBO0FBQ0E7QUFDQTtBQUVBOyIsInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///41\n")}]); \ No newline at end of file +!function(n){var t=window.webpackHotUpdate;window.webpackHotUpdate=function(n,e){!function(n,t){if(!A[n]||!m[n])return;for(var e in m[n]=!1,t)Object.prototype.hasOwnProperty.call(t,e)&&(o[e]=t[e]);0==--G&&0===Z&&h()}(n,e),t&&t(n,e)};var e,g=!0,I="95de5ca476bc628f02cb",l=1e4,c={},B=[],i=[];function b(n){var t=V[n];if(!t)return W;var g=function(g){return t.hot.active?(V[g]?-1===V[g].parents.indexOf(n)&&V[g].parents.push(n):(B=[n],e=g),-1===t.children.indexOf(g)&&t.children.push(g)):(console.warn("[HMR] unexpected require("+g+") from disposed module "+n),B=[]),W(g)},I=function(n){return{configurable:!0,enumerable:!0,get:function(){return W[n]},set:function(t){W[n]=t}}};for(var l in W)Object.prototype.hasOwnProperty.call(W,l)&&"e"!==l&&"t"!==l&&Object.defineProperty(g,l,I(l));return g.e=function(n){return"ready"===C&&u("prepare"),Z++,W.e(n).then(t,(function(n){throw t(),n}));function t(){Z--,"prepare"===C&&(Q[n]||p(n),0===Z&&0===G&&h())}},g.t=function(n,t){return 1&t&&(n=g(n)),W.t(n,-2&t)},g}function d(n){var t={_acceptedDependencies:{},_declinedDependencies:{},_selfAccepted:!1,_selfDeclined:!1,_disposeHandlers:[],_main:e!==n,active:!0,accept:function(n,e){if(void 0===n)t._selfAccepted=!0;else if("function"==typeof n)t._selfAccepted=n;else if("object"==typeof n)for(var g=0;g=0&&t._disposeHandlers.splice(e,1)},check:F,apply:y,status:function(n){if(!n)return C;a.push(n)},addStatusHandler:function(n){a.push(n)},removeStatusHandler:function(n){var t=a.indexOf(n);t>=0&&a.splice(t,1)},data:c[n]};return e=void 0,t}var a=[],C="idle";function u(n){C=n;for(var t=0;t0;){var I=g.pop(),l=I.id,c=I.chain;if((i=V[l])&&!i.hot._selfAccepted){if(i.hot._selfDeclined)return{type:"self-declined",chain:c,moduleId:l};if(i.hot._main)return{type:"unaccepted",chain:c,moduleId:l};for(var B=0;B ")),F.type){case"self-declined":t.onDeclined&&t.onDeclined(F),t.ignoreDeclined||(p=new Error("Aborted because of self decline: "+F.moduleId+U));break;case"declined":t.onDeclined&&t.onDeclined(F),t.ignoreDeclined||(p=new Error("Aborted because of declined dependency: "+F.moduleId+" in "+F.parentId+U));break;case"unaccepted":t.onUnaccepted&&t.onUnaccepted(F),t.ignoreUnaccepted||(p=new Error("Aborted because "+b+" is not accepted"+U));break;case"accepted":t.onAccepted&&t.onAccepted(F),h=!0;break;case"disposed":t.onDisposed&&t.onDisposed(F),y=!0;break;default:throw new Error("Unexception type "+F.type)}if(p)return u("abort"),Promise.reject(p);if(h)for(b in Z[b]=o[b],a(G,F.outdatedModules),F.outdatedDependencies)Object.prototype.hasOwnProperty.call(F.outdatedDependencies,b)&&(r[b]||(r[b]=[]),a(r[b],F.outdatedDependencies[b]));y&&(a(G,[F.moduleId]),Z[b]=Q)}var N,x=[];for(g=0;g0;)if(b=H.pop(),i=V[b]){var Y={},v=i.hot._disposeHandlers;for(l=0;l=0&&T.parents.splice(N,1))}}for(b in r)if(Object.prototype.hasOwnProperty.call(r,b)&&(i=V[b]))for(R=r[b],l=0;l=0&&i.children.splice(N,1);for(b in u("apply"),I=s,Z)Object.prototype.hasOwnProperty.call(Z,b)&&(n[b]=Z[b]);var J=null;for(b in r)if(Object.prototype.hasOwnProperty.call(r,b)&&(i=V[b])){R=r[b];var S=[];for(g=0;g undefined\n * typeof document -> undefined\n *\n * react-native:\n * navigator.product -> 'ReactNative'\n * nativescript\n * navigator.product -> 'NativeScript' or 'NS'\n */\nfunction isStandardBrowserEnv() {\n if (typeof navigator !== 'undefined' && (navigator.product === 'ReactNative' ||\n navigator.product === 'NativeScript' ||\n navigator.product === 'NS')) {\n return false;\n }\n return (\n typeof window !== 'undefined' &&\n typeof document !== 'undefined'\n );\n}\n\n/**\n * Iterate over an Array or an Object invoking a function for each item.\n *\n * If `obj` is an Array callback will be called passing\n * the value, index, and complete array for each item.\n *\n * If 'obj' is an Object callback will be called passing\n * the value, key, and complete object for each property.\n *\n * @param {Object|Array} obj The object to iterate\n * @param {Function} fn The callback to invoke for each item\n */\nfunction forEach(obj, fn) {\n // Don't bother if no value provided\n if (obj === null || typeof obj === 'undefined') {\n return;\n }\n\n // Force an array if not already something iterable\n if (typeof obj !== 'object') {\n /*eslint no-param-reassign:0*/\n obj = [obj];\n }\n\n if (isArray(obj)) {\n // Iterate over array values\n for (var i = 0, l = obj.length; i < l; i++) {\n fn.call(null, obj[i], i, obj);\n }\n } else {\n // Iterate over object keys\n for (var key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) {\n fn.call(null, obj[key], key, obj);\n }\n }\n }\n}\n\n/**\n * Accepts varargs expecting each argument to be an object, then\n * immutably merges the properties of each object and returns result.\n *\n * When multiple objects contain the same key the later object in\n * the arguments list will take precedence.\n *\n * Example:\n *\n * ```js\n * var result = merge({foo: 123}, {foo: 456});\n * console.log(result.foo); // outputs 456\n * ```\n *\n * @param {Object} obj1 Object to merge\n * @returns {Object} Result of all merge properties\n */\nfunction merge(/* obj1, obj2, obj3, ... */) {\n var result = {};\n function assignValue(val, key) {\n if (typeof result[key] === 'object' && typeof val === 'object') {\n result[key] = merge(result[key], val);\n } else {\n result[key] = val;\n }\n }\n\n for (var i = 0, l = arguments.length; i < l; i++) {\n forEach(arguments[i], assignValue);\n }\n return result;\n}\n\n/**\n * Function equal to merge with the difference being that no reference\n * to original objects is kept.\n *\n * @see merge\n * @param {Object} obj1 Object to merge\n * @returns {Object} Result of all merge properties\n */\nfunction deepMerge(/* obj1, obj2, obj3, ... */) {\n var result = {};\n function assignValue(val, key) {\n if (typeof result[key] === 'object' && typeof val === 'object') {\n result[key] = deepMerge(result[key], val);\n } else if (typeof val === 'object') {\n result[key] = deepMerge({}, val);\n } else {\n result[key] = val;\n }\n }\n\n for (var i = 0, l = arguments.length; i < l; i++) {\n forEach(arguments[i], assignValue);\n }\n return result;\n}\n\n/**\n * Extends object a by mutably adding to it the properties of object b.\n *\n * @param {Object} a The object to be extended\n * @param {Object} b The object to copy properties from\n * @param {Object} thisArg The object to bind function to\n * @return {Object} The resulting value of object a\n */\nfunction extend(a, b, thisArg) {\n forEach(b, function assignValue(val, key) {\n if (thisArg && typeof val === 'function') {\n a[key] = bind(val, thisArg);\n } else {\n a[key] = val;\n }\n });\n return a;\n}\n\nmodule.exports = {\n isArray: isArray,\n isArrayBuffer: isArrayBuffer,\n isBuffer: isBuffer,\n isFormData: isFormData,\n isArrayBufferView: isArrayBufferView,\n isString: isString,\n isNumber: isNumber,\n isObject: isObject,\n isUndefined: isUndefined,\n isDate: isDate,\n isFile: isFile,\n isBlob: isBlob,\n isFunction: isFunction,\n isStream: isStream,\n isURLSearchParams: isURLSearchParams,\n isStandardBrowserEnv: isStandardBrowserEnv,\n forEach: forEach,\n merge: merge,\n deepMerge: deepMerge,\n extend: extend,\n trim: trim\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMC5qcyIsInNvdXJjZXMiOlsid2VicGFjazovLy8uL25vZGVfbW9kdWxlcy9heGlvcy9saWIvdXRpbHMuanM/YzUzMiJdLCJzb3VyY2VzQ29udGVudCI6WyIndXNlIHN0cmljdCc7XG5cbnZhciBiaW5kID0gcmVxdWlyZSgnLi9oZWxwZXJzL2JpbmQnKTtcbnZhciBpc0J1ZmZlciA9IHJlcXVpcmUoJ2lzLWJ1ZmZlcicpO1xuXG4vKmdsb2JhbCB0b1N0cmluZzp0cnVlKi9cblxuLy8gdXRpbHMgaXMgYSBsaWJyYXJ5IG9mIGdlbmVyaWMgaGVscGVyIGZ1bmN0aW9ucyBub24tc3BlY2lmaWMgdG8gYXhpb3NcblxudmFyIHRvU3RyaW5nID0gT2JqZWN0LnByb3RvdHlwZS50b1N0cmluZztcblxuLyoqXG4gKiBEZXR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webpack-internal:///0\n")},function(module,__webpack_exports__,__webpack_require__){"use strict";eval("\n// EXTERNAL MODULE: ./node_modules/axios/index.js\nvar axios = __webpack_require__(2);\nvar axios_default = /*#__PURE__*/__webpack_require__.n(axios);\n\n// EXTERNAL MODULE: ./node_modules/spark-md5/spark-md5.js\nvar spark_md5 = __webpack_require__(5);\nvar spark_md5_default = /*#__PURE__*/__webpack_require__.n(spark_md5);\n\n// CONCATENATED MODULE: ./src/uploader.ts\nvar __assign = (undefined && undefined.__assign) || function () {\r\n __assign = Object.assign || function(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\r\n t[p] = s[p];\r\n }\r\n return t;\r\n };\r\n return __assign.apply(this, arguments);\r\n};\r\nvar __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n};\r\nvar __generator = (undefined && undefined.__generator) || function (thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n};\r\n\r\n\r\nvar userToken = '';\r\nvar apiV2BaseUrl = '';\r\nvar storage = { channel: 'public' };\r\ntry {\r\n var sp = new URL(window.location.href).searchParams;\r\n userToken = sp.get('user_token') || '';\r\n apiV2BaseUrl = sp.get('api_v2_base_url') || '';\r\n var uploadStorage = sp.get('upload_storage');\r\n if (uploadStorage) {\r\n storage = JSON.parse(uploadStorage);\r\n }\r\n}\r\ncatch (err) {\r\n //\r\n}\r\nwindow.setUploaderOptions = function (options) {\r\n if (typeof options === 'string') {\r\n options = JSON.parse(options);\r\n }\r\n userToken = options.userToken || '';\r\n apiV2BaseUrl = options.apiV2BaseUrl || '';\r\n if (options.storage) {\r\n storage = options.storage;\r\n }\r\n};\r\nvar uploadFuncNames = [\r\n 'chooseImage',\r\n 'removeImage',\r\n 'reinsertImage',\r\n 'reuploadImage',\r\n 'insertRemoteImage',\r\n 'chooseVideo',\r\n 'removeVideo',\r\n 'reinsertVideo',\r\n 'reuploadVideo',\r\n];\r\nfunction tryHijackUploadCall(funcName, params) {\r\n if (!uploadFuncNames.includes(funcName)) {\r\n return false;\r\n }\r\n if (funcName.startsWith('choose')) {\r\n chooseAndUpload(funcName.substr(6).toLowerCase());\r\n }\r\n else if (funcName.startsWith('remove')) {\r\n handleRemove(funcName.substr(6).toLowerCase(), params);\r\n }\r\n else if (funcName.startsWith('reinsert')) {\r\n handleReinsert(funcName.substr(8).toLowerCase(), params);\r\n }\r\n else if (funcName.startsWith('reupload')) {\r\n handleReupload(funcName.substr(8).toLowerCase(), params);\r\n }\r\n else if (funcName === 'insertRemoteImage') {\r\n uploadRemoteImage(params);\r\n }\r\n return true;\r\n}\r\nvar uploadFiles = new Map();\r\nvar fileCounter = 1;\r\nfunction chooseAndUpload(type) {\r\n var input = document.createElement('input');\r\n input.setAttribute('type', 'file');\r\n if (type === 'image') {\r\n input.setAttribute('multiple', '');\r\n input.setAttribute('accept', 'image/*');\r\n }\r\n else if (type === 'video') {\r\n input.setAttribute('accept', 'video/mp4');\r\n }\r\n input.addEventListener('change', function () {\r\n var length = input.files.length;\r\n if (!length) {\r\n return;\r\n }\r\n var promises = [];\r\n var _loop_1 = function (i) {\r\n var file = input.files.item(i);\r\n if (!file ||\r\n (type === 'image' && !file.type.startsWith('image/')) ||\r\n (type === 'video' && file.type !== 'video/mp4')) {\r\n return \"continue\";\r\n }\r\n var id = \"\" + fileCounter++;\r\n promises.push(getMediaInfo(file).then(function (mf) {\r\n return __assign(__assign({}, mf), { id: id, useCounter: 1 });\r\n }));\r\n };\r\n for (var i = 0; i < length; i++) {\r\n _loop_1(i);\r\n }\r\n Promise.all(promises)\r\n .then(function (list) {\r\n var params = list\r\n .sort(function (a, b) { return Number(a.id) - Number(b.id); })\r\n .map(function (uf) {\r\n var param = {\r\n id: uf.id,\r\n url: uf.image.url,\r\n width: uf.image.width,\r\n height: uf.image.height,\r\n };\r\n if (type === 'video') {\r\n param.url = uf.video.url;\r\n param.poster = uf.image.url;\r\n }\r\n return param;\r\n });\r\n window.postMessage({\r\n funcName: type + \"PreviewReceiver\",\r\n params: type === 'image' ? params : params[0],\r\n }, '*');\r\n list.forEach(function (uf) {\r\n uploadFiles.set(uf.id, uf);\r\n handleUpload(type, uf.id);\r\n });\r\n })\r\n .catch(console.log);\r\n });\r\n input.click();\r\n}\r\nfunction getMediaInfo(file) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var mf, promises, imageFileType_1, imageFilename_1, setBuffAndHash;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n mf = {\r\n image: {\r\n file: file,\r\n buff: new ArrayBuffer(0),\r\n hash: '',\r\n url: '',\r\n width: 0,\r\n height: 0,\r\n },\r\n };\r\n promises = [];\r\n if (!file.type.startsWith('video/')) return [3 /*break*/, 2];\r\n mf.video = {\r\n file: file,\r\n buff: new ArrayBuffer(0),\r\n hash: '',\r\n url: URL.createObjectURL(file),\r\n width: 0,\r\n height: 0,\r\n };\r\n imageFileType_1 = \"image/png\";\r\n imageFilename_1 = file.name + \".png\";\r\n return [4 /*yield*/, new Promise(function (resolve, reject) {\r\n var video = document.createElement('video');\r\n video.addEventListener('loadeddata', function () {\r\n video.pause();\r\n video.currentTime = 0;\r\n mf.video.width = mf.image.width = video.videoWidth;\r\n mf.video.height = mf.image.height = video.videoHeight;\r\n var canvas = document.createElement('canvas');\r\n canvas.setAttribute('width', \"\" + mf.image.width);\r\n canvas.setAttribute('height', \"\" + mf.image.height);\r\n var ctx = canvas.getContext('2d');\r\n if (!ctx) {\r\n reject(new Error('无法提取到视频封面'));\r\n }\r\n else {\r\n ctx.drawImage(video, 0, 0, mf.image.width, mf.image.height);\r\n canvas.toBlob(function (blob) {\r\n if (!blob || blob.size <= 0) {\r\n reject(new Error('无法提取到视频封面'));\r\n }\r\n else {\r\n var file_1 = new File([blob], imageFilename_1, { type: blob.type });\r\n mf.image.url = URL.createObjectURL(file_1);\r\n mf.image.file = file_1;\r\n resolve();\r\n }\r\n }, imageFileType_1);\r\n }\r\n });\r\n video.autoplay = true;\r\n video.muted = true;\r\n video.src = mf.video.url;\r\n })];\r\n case 1:\r\n _a.sent();\r\n return [3 /*break*/, 3];\r\n case 2:\r\n mf.image.url = URL.createObjectURL(mf.image.file);\r\n promises.push(new Promise(function (resolve, reject) {\r\n var img = document.createElement('img');\r\n img.addEventListener('load', function () {\r\n mf.image.width = img.naturalWidth;\r\n mf.image.height = img.naturalHeight;\r\n resolve();\r\n });\r\n img.addEventListener('error', function () {\r\n reject(new Error('图片加载异常'));\r\n });\r\n img.src = mf.image.url;\r\n }));\r\n _a.label = 3;\r\n case 3:\r\n setBuffAndHash = function (info) {\r\n return new Promise(function (resolve, reject) {\r\n var reader = new FileReader();\r\n reader.addEventListener('load', function () {\r\n var spark = new spark_md5_default.a.ArrayBuffer();\r\n info.buff = reader.result;\r\n info.hash = spark.append(info.buff).end();\r\n resolve();\r\n });\r\n reader.addEventListener('error', function () {\r\n reject(new Error('读取文件异常'));\r\n });\r\n reader.readAsArrayBuffer(info.file);\r\n });\r\n };\r\n promises.push(setBuffAndHash(mf.image));\r\n if (mf.video) {\r\n promises.push(setBuffAndHash(mf.video));\r\n }\r\n return [4 /*yield*/, Promise.all(promises)];\r\n case 4:\r\n _a.sent();\r\n return [2 /*return*/, mf];\r\n }\r\n });\r\n });\r\n}\r\nfunction uploadRemoteImage(params) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var id, contentType_1, filename_1, _a, blob, file, buff, spark, hash, error_1, buff;\r\n return __generator(this, function (_b) {\r\n switch (_b.label) {\r\n case 0:\r\n id = \"\" + fileCounter++;\r\n window.postMessage({\r\n funcName: \"uploadRemoteImage\",\r\n params: { id: id, remoteId: params.remoteId },\r\n }, '*');\r\n _b.label = 1;\r\n case 1:\r\n _b.trys.push([1, 3, , 4]);\r\n contentType_1 = 'image/png';\r\n filename_1 = Date.now() + \".png\";\r\n return [4 /*yield*/, new Promise(function (resolve, reject) {\r\n var img = document.createElement('img');\r\n img.addEventListener('load', function () {\r\n var canvas = document.createElement('canvas');\r\n canvas.setAttribute('width', \"\" + params.width);\r\n canvas.setAttribute('height', \"\" + params.height);\r\n var ctx = canvas.getContext('2d');\r\n ctx.drawImage(img, 0, 0, params.width, params.height);\r\n canvas.toBlob(function (blob) {\r\n if (!blob) {\r\n return reject();\r\n }\r\n var reader = new FileReader();\r\n reader.addEventListener('load', function () {\r\n var buff = reader.result;\r\n var file = new File([blob], filename_1, { type: contentType_1 });\r\n resolve({ blob: blob, file: file, buff: buff });\r\n });\r\n reader.addEventListener('error', function () { return reject(); });\r\n reader.readAsArrayBuffer(blob);\r\n }, contentType_1);\r\n });\r\n img.addEventListener('error', function () { return reject(); });\r\n img.crossOrigin = 'anonymous';\r\n img.src = params.src;\r\n })];\r\n case 2:\r\n _a = _b.sent(), blob = _a.blob, file = _a.file, buff = _a.buff;\r\n spark = new spark_md5_default.a.ArrayBuffer();\r\n hash = spark.append(buff).end();\r\n uploadFiles.set(id, {\r\n id: id,\r\n useCounter: 1,\r\n image: {\r\n file: file,\r\n buff: buff,\r\n hash: hash,\r\n url: params.src,\r\n width: params.width,\r\n height: params.height,\r\n },\r\n });\r\n return [3 /*break*/, 4];\r\n case 3:\r\n error_1 = _b.sent();\r\n buff = new ArrayBuffer(0);\r\n uploadFiles.set(id, {\r\n id: id,\r\n useCounter: 1,\r\n image: {\r\n file: new File([buff], 'empty'),\r\n buff: buff,\r\n hash: '',\r\n url: params.src,\r\n width: params.width,\r\n height: params.height,\r\n },\r\n error: '无法下载远程图片,请手动上传',\r\n });\r\n return [3 /*break*/, 4];\r\n case 4:\r\n handleUpload('image', id);\r\n return [2 /*return*/];\r\n }\r\n });\r\n });\r\n}\r\nfunction handleUpload(type, id) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var uf, upload, params, _a, node, url, results, video, poster, e_1, message;\r\n var _this = this;\r\n return __generator(this, function (_b) {\r\n switch (_b.label) {\r\n case 0:\r\n uf = uploadFiles.get(id);\r\n if (!uf || (uf.status && ['UPLOADING', 'SUCCESS'].includes(uf.status))) {\r\n return [2 /*return*/];\r\n }\r\n _b.label = 1;\r\n case 1:\r\n _b.trys.push([1, 6, , 7]);\r\n if (uf.error) {\r\n throw new Error(uf.error);\r\n }\r\n upload = function (info) { return __awaiter(_this, void 0, void 0, function () {\r\n var source, _a, uri, method, headers, form, fileKey, data, keys, _b, node, url;\r\n return __generator(this, function (_c) {\r\n switch (_c.label) {\r\n case 0:\r\n source = axios_default.a.CancelToken.source();\r\n uf.cancelUpload = source.cancel.bind(source);\r\n return [4 /*yield*/, axios_default.a.post('storage', {\r\n hash: info.hash,\r\n storage: storage,\r\n size: info.file.size,\r\n filename: info.file.name,\r\n mime_type: info.file.type,\r\n }, {\r\n headers: {\r\n Authorization: userToken,\r\n Accept: 'application/json, */*',\r\n },\r\n baseURL: apiV2BaseUrl,\r\n validateStatus: function (s) { return s === 200 || s === 201; },\r\n cancelToken: source.token,\r\n })];\r\n case 1:\r\n _a = (_c.sent()).data, uri = _a.uri, method = _a.method, headers = _a.headers, form = _a.form, fileKey = _a.file_key;\r\n data = info.buff;\r\n if (form || fileKey) {\r\n data = new FormData();\r\n data.append(fileKey, info.file);\r\n keys = Object.keys(form || {});\r\n if (keys.length) {\r\n keys.forEach(function (key) { return data.append(key, form[key]); });\r\n }\r\n }\r\n source = axios_default.a.CancelToken.source();\r\n uf.cancelUpload = source.cancel.bind(source);\r\n return [4 /*yield*/, axios_default.a.request({\r\n url: uri,\r\n method: method,\r\n headers: headers,\r\n data: data,\r\n onUploadProgress: function (pe) {\r\n if (pe.lengthComputable) {\r\n if (type === 'image' || info.file.type.startsWith('video/')) {\r\n window.postMessage({\r\n funcName: type + \"ProgressReceiver\",\r\n params: { id: id, progress: (pe.loaded * 100) / pe.total },\r\n }, '*');\r\n }\r\n }\r\n },\r\n validateStatus: function (s) { return s === 200 || s === 201; },\r\n cancelToken: source.token,\r\n })];\r\n case 2:\r\n _b = (_c.sent()).data, node = _b.node, url = _b.uri;\r\n return [2 /*return*/, { node: node, url: url, fileType: info.file.type }];\r\n }\r\n });\r\n }); };\r\n uf.status = 'UPLOADING';\r\n params = { id: id };\r\n if (!(type === 'image')) return [3 /*break*/, 3];\r\n return [4 /*yield*/, upload(uf.image)];\r\n case 2:\r\n _a = _b.sent(), node = _a.node, url = _a.url;\r\n params.url = url;\r\n params.node = node;\r\n return [3 /*break*/, 5];\r\n case 3:\r\n if (!(type === 'video')) return [3 /*break*/, 5];\r\n return [4 /*yield*/, Promise.all([upload(uf.image), upload(uf.video)])];\r\n case 4:\r\n results = _b.sent();\r\n video = void 0, poster = void 0;\r\n if (results[0].fileType.startsWith('video/')) {\r\n video = results[0];\r\n poster = results[1];\r\n }\r\n else {\r\n video = results[1];\r\n poster = results[0];\r\n }\r\n params.url = video.url;\r\n params.urlNode = video.node;\r\n params.poster = poster.url;\r\n params.posterNode = poster.node;\r\n _b.label = 5;\r\n case 5:\r\n window.postMessage({ funcName: type + \"UrlReceiver\", params: params }, '*');\r\n return [3 /*break*/, 7];\r\n case 6:\r\n e_1 = _b.sent();\r\n /* eslint require-atomic-updates: */\r\n if (axios_default.a.isCancel(e_1)) {\r\n uf.status = 'CANCEL';\r\n }\r\n else {\r\n uf.status = 'ERROR';\r\n message = e_1.message || '网络异常导致上传失败';\r\n if (e_1.response && e_1.response.data) {\r\n message = e_1.response.data.message;\r\n if (Array.isArray(message)) {\r\n message = message[0];\r\n }\r\n message = message || '服务异常导致上传失败';\r\n }\r\n window.postMessage({\r\n funcName: type + \"FailedReceiver\",\r\n params: { id: id, error: message },\r\n }, '*');\r\n }\r\n return [3 /*break*/, 7];\r\n case 7: return [2 /*return*/];\r\n }\r\n });\r\n });\r\n}\r\nfunction handleRemove(type, params) {\r\n var status = params.status;\r\n if (status !== 'UPLOADING') {\r\n return;\r\n }\r\n var uf = uploadFiles.get(params.id);\r\n if (uf && uf.useCounter > 0) {\r\n uf.useCounter -= 1;\r\n if (uf.useCounter === 0 && uf.status === 'UPLOADING') {\r\n uf.cancelUpload();\r\n }\r\n }\r\n}\r\nfunction handleReinsert(type, params) {\r\n var status = params.status;\r\n if (status !== 'UPLOADING') {\r\n return;\r\n }\r\n var uf = uploadFiles.get(params.id);\r\n if (uf) {\r\n uf.useCounter += 1;\r\n if (uf.useCounter === 1 && uf.status === 'CANCEL') {\r\n handleUpload(type, params.id);\r\n }\r\n }\r\n}\r\nfunction handleReupload(type, params) {\r\n handleUpload(type, params.id);\r\n}\r\n\n// CONCATENATED MODULE: ./src/caller.ts\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"a\", function() { return callMethod; });\n\r\n/**\r\n * 调用客户端函数的方法\r\n *\r\n * @param fnName 调用的方法名\r\n * @param params 调用方法传参\r\n */\r\nfunction callMethod(fnName, params) {\r\n if (params === void 0) { params = undefined; }\r\n if (window.debug) {\r\n console.log('debug callMethod', fnName, params); // eslint-disable-line no-console\r\n }\r\n if (window.launcher) {\r\n // in Android\r\n if (typeof window.launcher[fnName] === 'function') {\r\n if (params) {\r\n window.launcher[fnName](JSON.stringify(params));\r\n }\r\n else {\r\n window.launcher[fnName]();\r\n }\r\n }\r\n }\r\n else if (window.webkit && window.webkit.messageHandlers) {\r\n // in IOS\r\n window.webkit.messageHandlers.MobilePhoneCall.postMessage({ funcName: fnName, params: params });\r\n }\r\n else if (window.self != window.parent) {\r\n // in iframe\r\n if (!tryHijackUploadCall(fnName, params)) {\r\n window.parent.postMessage({ funcName: fnName, params: params }, '*');\r\n }\r\n }\r\n else {\r\n // not in webview\r\n // tryHijackUploadCall(fnName, params)\r\n return false;\r\n }\r\n return true;\r\n}\r\nvar FuncName;\r\n(function (FuncName) {\r\n FuncName[\"setUploaderOptions\"] = \"setUploaderOptions\";\r\n FuncName[\"setContentReceiver\"] = \"setContentReceiver\";\r\n FuncName[\"imagePreviewReceiver\"] = \"imagePreviewReceiver\";\r\n FuncName[\"imageProgressReceiver\"] = \"imageProgressReceiver\";\r\n FuncName[\"imageUrlReceiver\"] = \"imageUrlReceiver\";\r\n FuncName[\"imageFailedReceiver\"] = \"imageFailedReceiver\";\r\n FuncName[\"videoPreviewReceiver\"] = \"videoPreviewReceiver\";\r\n FuncName[\"videoProgressReceiver\"] = \"videoProgressReceiver\";\r\n FuncName[\"videoUrlReceiver\"] = \"videoUrlReceiver\";\r\n FuncName[\"videoFailedReceiver\"] = \"videoFailedReceiver\";\r\n FuncName[\"editorSubmitReceiver\"] = \"editorSubmitReceiver\";\r\n FuncName[\"changePlaceholder\"] = \"changePlaceholder\";\r\n FuncName[\"pageHiddenReceiver\"] = \"pageHiddenReceiver\";\r\n})(FuncName || (FuncName = {}));\r\nvar postMessage = window.postMessage;\r\nwindow.postMessage = function (message, targetOrigin, transfer) {\r\n if (targetOrigin === void 0) { targetOrigin = '*'; }\r\n postMessage(message, targetOrigin, transfer);\r\n};\r\nwindow.addEventListener('message', function (e) {\r\n var funcName = (e.data || {}).funcName;\r\n if (funcName && typeof window[funcName] === 'function') {\r\n var params = (e.data || {}).params;\r\n if (!['changePlaceholder', 'setContentReceiver'].includes(funcName)) {\r\n params = params && JSON.stringify(params);\r\n }\r\n window[funcName](params);\r\n }\r\n});\r\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMS5qcyIsInNvdXJjZXMiOlsid2VicGFjazovLy8uL3NyYy91cGxvYWRlci50cz9iM2IwIiwid2VicGFjazovLy8uL3NyYy9jYWxsZXIudHM/ZDU2ZCJdLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgYXhpb3MgZnJvbSAnYXhpb3MnXG5pbXBvcnQgU3BhcmsgZnJvbSAnc3BhcmstbWQ1J1xuXG5sZXQgdXNlclRva2VuOiBzdHJpbmcgPSAnJ1xubGV0IGFwaVYyQmFzZVVybDogc3RyaW5nID0gJydcbmxldCBzdG9yYWdlID0geyBjaGFubmVsOiAncHVibGljJyB9XG5cbnRyeSB7XG4gIGNvbnN0IHNwID0gbmV3IFVST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ICBmb3IgKGxldCBpID0gMDsgaSA8IGxlbmd0aDsgaSsrKSB7XG4gICAgICBjb25zdCBmaWxlID0gaW5wdXQuZmlsZXMhLml0ZW0oaSlcblxuICAgICAgaWYgKFxuICAgICAgICAhZmlsZSB8fFxuICAgICAgICAodHlwZSA9PT0gJ2ltYWdlJyAmJiAhZmlsZS50eXBlLnN0YXJ0c1dpdGgoJ2ltYWdlLycpKSB8fFxuICAgICAgICAodHlwZSA9PT0gJ3ZpZGVvJyAmJiBmaWxlLnR5cGUgIT09ICd2aWRlby9tcDQnKVxuICAgICAgKSB7XG4gICAgICAgIGNvbnRpbnVlXG4gICAgICB9XG5cbiAgICAgIGNvbnN0IGlkID0gYCR7ZmlsZUNvdW50ZXIrK31gXG4gICAgICBwcm9taXNlcy5wdXNoKFxuICAgICAgICBnZXRNZWRpYUluZm8oZmlsZSkudGhlbihtZiA9PiB7XG4gICAgICAgICAgcmV0dXJuIHsgLi4ubWYsIGlkLCB1c2VDb3VudGVyOiAxIH1cbiAgICAgICAgfSksXG4gICAgICApXG4gICAgfVxuXG4gICAgUHJvbWlzZS5hbGwocHJvbWlzZXMpXG4gICAgICAudGhlbihsaXN0ID0+IHtcbiAgICAgICAgY29uc3QgcGFyYW1zOiBhbnlbXSA9IGxpc3RcbiAgICAgICAgICAuc29ydCgoYSwgYikgPT4gTnVtYmVyKGEuaWQpIC0gTnVtYmVyKGIuaWQpKVxuICAgICAgICAgIC5tYXAodWYgPT4ge1xuICAgICAgICAgICAgY29uc3QgcGFyYW06IGFueSA9IHtcbiAgICAgICAgICAgICAgaWQ6IHVmLmlkLFxuICAgICAgICAgICAgICB1cmw6IHVmLmltYWdlLnVybCxcbiAgICAgICAgICAgICAgd2lkdGg6IHVmLmltYWdlLndpZHRoLFxuICAgICAgICAgICAgICBoZWlnaHQ6IHVmLmltYWdlLmhlaWdodCxcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmICh0eXBlID09PSAndmlkZW8nKSB7XG4gICAgICAgICAgICAgIHBhcmFtLnVybCA9IHVmLnZpZGVvIS51cmxcbiAgICAgICAgICAgICAgcGFyYW0ucG9zdGVyID0gdWYuaW1hZ2UudXJsXG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHJldHVybiBwYXJhbVxuICAgICAgICAgIH0pXG5cbiAgICAgICAgd2luZG93LnBvc3RNZXNzYWdlKFxuICAgICAgICAgIHtcbiAgICAgICAgICAgIGZ1bmNOYW1lOiBgJHt0eXBlfVByZXZpZXdSZWNlaXZlcmAsXG4gICAgICAgICAgICBwYXJhbXM6IHR5cGUgPT09ICdpbWFnZScgPyBwYXJhbXMgOiBwYXJhbXNbMF0sXG4gICAgICAgICAgfSxcbiAgICAgICAgICAnKicsXG4gICAgICAgIClcblxuICAgICAgICBsaXN0LmZvckVhY2godWYgPT4ge1xuICAgICAgICAgIHVwbG9hZEZpbGVzLnNldCh1Zi5pZCwgdWYpXG4gICAgICAgICAgaGFuZGxlVXBsb2FkKHR5cGUsIHVmLmlkKVxuICAgICAgICB9KVxuICAgICAgfSlcbiAgICAgIC5jYXRjaChjb25zb2xlLmxvZylcbiAgfSlcblxuICBpbnB1dC5jbGljaygpXG59XG5cbmFzeW5jIGZ1bmN0aW9uIGdldE1lZGlhSW5mbyhmaWxlOiBGaWxlKSB7XG4gIGNvbnN0IG1mOiBNZWRpYUZpbGUgPSB7XG4gICAgaW1hZ2U6IHtcbiAgICAgIGZpbGU6IGZpbGUsXG4gICAgICBidWZmOiBuZXcgQXJyYXlCdWZmZXIoMCksXG4gICAgICBoYXNoOiAnJyxcbiAgICAgIHVybDogJycsXG4gICAgICB3aWR0aDogMCxcbiAgICAgIGhlaWdodDogMCxcbiAgICB9LFxuICB9XG5cbiAgY29uc3QgcHJvbWlzZXMgPSBbXVxuXG4gIGlmIChmaWxlLnR5cGUuc3RhcnRzV2l0aCgndmlkZW8vJykpIHtcbiAgICBtZi52aWRlbyA9IHtcbiAgICAgIGZpbGU6IGZpbGUsXG4gICAgICBidW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MuZ2V0KGlkKVxuXG4gIGlmICghdWYgfHwgKHVmLnN0YXR1cyAmJiBbJ1VQTE9BRElORycsICdTVUNDRVNTJ10uaW5jbHVkZXModWYuc3RhdHVzKSkpIHtcbiAgICByZXR1cm5cbiAgfVxuXG4gIHRyeSB7XG4gICAgaWYgKHVmLmVycm9yKSB7XG4gICAgICB0aHJvdyBuZXcgRXJyb3IodWYuZXJyb3IpXG4gICAgfVxuXG4gICAgY29uc3QgdXBsb2FkID0gYXN5bmMgKGluZm86IE1lZGlhRmlsZUluZm8pID0+IHtcbiAgICAgIGxldCBzb3VyY2UgPSBheGlvcy5DYW5jZWxUb2tlbi5zb3VyY2UoKVxuICAgICAgdWYuY2FuY2VsVXBsb2FkID0gc291cmNlLmNhbmNlbC5iaW5kKHNvdXJjZSlcblxuICAgICAgY29uc3Qge1xuICAgICAgICBkYXRhOiB7IHVyaSwgbWV0aG9kLCBoZWFkZXJzLCBmb3JtLCBmaWxlX2tleTogZmlsZUtleSB9LFxuICAgICAgfSA9IGF3YWl0IGF4aW9zLnBvc3QoXG4gICAgICAgICdzdG9yYWdlJyxcbiAgICAgICAge1xuICAgICAgICAgIGhhc2g6IGluZm8uaGFzaCxcbiAgICAgICAgICBzdG9yYWdlLFxuICAgICAgICAgIHNpemU6IGluZm8uZmlsZS5zaXplLFxuICAgICAgICAgIGZpbGVuYW1lOiBpbmZvLmZpbGUubmFtZSxcbiAgICAgICAgICBtaW1lX3R5cGU6IGluZm8uZmlsZS50eXBlLFxuICAgICAgICB9LFxuICAgICAgICB7XG4gICAgICAgICAgaGVhZGVyczoge1xuICAgICAgICAgICAgQXV0aG9yaXphdGlvbjogdXNlclRva2VuLFxuICAgICAgICAgICAgQWNjZXB0OiAnYXBwbGljYXRpb24vanNvbiwgKi8qJyxcbiAgICAgICAgICB9LFxuICAgICAgICAgIGJhc2VVUkw6IGFwaVYyQmFzZVVybCxcbiAgICAgICAgICB2YWxpZGF0ZVN0YXR1czogcyA9PiBzID09PSAyMD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b3cucG9zdE1lc3NhZ2UoXG4gICAgICAgICAgICAgICAge1xuICAgICAgICAgICAgICAgICAgZnVuY05hbWU6IGAke3R5cGV9UHJvZ3Jlc3NSZWNlaXZlcmAsXG4gICAgICAgICAgICAgICAgICBwYXJhbXM6IHsgaWQsIHByb2dyZXNzOiAocGUubG9hZGVkICogMTAwKSAvIHBlLnRvdGFsIH0sXG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICAnKicsXG4gICAgICAgICAgICAgIClcbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9XG4gICAgICAgIH0sXG4gICAgICAgIHZhbGlkYXRlU3RhdHVzOiBzID0+IHMgPT09IDIwMCB8fCBzID09PSAyMDEsXG4gICAgICAgIGNhbmNlbFRva2VuOiBzb3VyY2UudG9rZW4sXG4gICAgICB9KVxuXG4gICAgICByZXR1cm4geyBub2RlLCB1cmwsIGZpbGVUeXBlOiBpbmZvLmZpbGUudHlwZSB9XG4gICAgfVxuXG4gICAgdWYuc3RhdHVzID0gJ1VQTE9BRElORydcbiAgICBjb25zdCBwYXJhbXM6IGFueSA9IHsgaWQgfVxuICAgIGlmICh0eXBlID09PSAnaW1hZ2UnKSB7XG4gICAgICBjb25zdCB7IG5vZGUsIHVybCB9ID0gYXdhaXQgdXBsb2FkKHVmLmltYWdlKVxuICAgICAgcGFyYW1zLnVybCA9IHVybFxuICAgICAgcGFyYW1zLm5vZGUgPSBub2RlXG4gICAgfSBlbHNlIGlmICh0eXBlID09PSAndmlkZW8nKSB7XG4gICAgICBjb25zdCByZXN1bHRzID0gYXdhaXQgUHJvbWlzZS5hbGwoW3VwbG9hZCh1Zi5pbWFnZSksIHVwbG9hZCh1Zi52aWRlbyEpXSlcbiAgICAgIGxldCB2aWRlbywgcG9zdGVyXG4gICAgICBpZiAocmVzdWx0c1swXS5maWxlVHlwZS5zdGFydHNXaXRoKCd2aWRlby8nKSkge1xuICAgICAgICB2aWRlbyA9IHJlc3VsdHNbMF1cbiAgICAgIC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UNBOzs7QUNuaEJBO0FBQUE7QUFFQTs7Ozs7QUFLQTtBQUNBO0FBQUE7QUFDQTtBQUNBO0FBQ0E7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQUE7QUFDQTtBQUNBO0FBQ0E7QUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBRUE7QUFDQTtBQUVBO0FBQUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBRUE7QUFDQTtBQUVBO0FBR0E7QUFDQTtBQUVBO0FBQ0E7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOyIsInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///1\n")},function(module,exports,__webpack_require__){eval("module.exports = __webpack_require__(18);//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMi5qcyIsInNvdXJjZXMiOlsid2VicGFjazovLy8uL25vZGVfbW9kdWxlcy9heGlvcy9pbmRleC5qcz9iYzNhIl0sInNvdXJjZXNDb250ZW50IjpbIm1vZHVsZS5leHBvcnRzID0gcmVxdWlyZSgnLi9saWIvYXhpb3MnKTsiXSwibWFwcGluZ3MiOiJBQUFBIiwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///2\n")},function(module,exports,__webpack_require__){eval("/* WEBPACK VAR INJECTION */(function(Buffer) {/*!\n * Quill Editor v1.3.7\n * https://quilljs.com/\n * Copyright (c) 2014, Jason Chen\n * Copyright (c) 2013, salesforce.com\n */\n(function webpackUniversalModuleDefinition(root, factory) {\n\tif(true)\n\t\tmodule.exports = factory();\n\telse {}\n})(typeof self !== 'undefined' ? self : this, function() {\nreturn /******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, {\n/******/ \t\t\t\tconfigurable: false,\n/******/ \t\t\t\tenumerable: true,\n/******/ \t\t\t\tget: getter\n/******/ \t\t\t});\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = 109);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar container_1 = __webpack_require__(17);\nvar format_1 = __webpack_require__(18);\nvar leaf_1 = __webpack_require__(19);\nvar scroll_1 = __webpack_require__(45);\nvar inline_1 = __webpack_require__(46);\nvar block_1 = __webpack_require__(47);\nvar embed_1 = __webpack_require__(48);\nvar text_1 = __webpack_require__(49);\nvar attributor_1 = __webpack_require__(12);\nvar class_1 = __webpack_require__(32);\nvar style_1 = __webpack_require__(33);\nvar store_1 = __webpack_require__(31);\nvar Registry = __webpack_require__(1);\nvar Parchment = {\n Scope: Registry.Scope,\n create: Registry.create,\n find: Registry.find,\n query: Registry.query,\n register: Registry.register,\n Container: container_1.default,\n Format: format_1.default,\n Leaf: leaf_1.default,\n Embed: embed_1.default,\n Scroll: scroll_1.default,\n Block: block_1.default,\n Inline: inline_1.default,\n Text: text_1.default,\n Attributor: {\n Attribute: attributor_1.default,\n Class: class_1.default,\n Style: style_1.default,\n Store: store_1.default,\n },\n};\nexports.default = Parchment;\n\n\n/***/ }),\n/* 1 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar ParchmentError = /** @class */ (function (_super) {\n __extends(ParchmentError, _super);\n function ParchmentError(message) {\n var _this = this;\n message = '[Parchment] ' + message;\n _this = _super.call(this, message) || this;\n _this.message = message;\n _this.name = _this.constructor.name;\n return _this;\n }\n return ParchmentError;\n}(Error));\nexports.ParchmentError = ParchmentError;\nvar attributes = {};\nvar classes = {};\nvar tags = {};\nvar types = {};\nexports.DATA_KEY = '__blot';\nvar Scope;\n(function (Scope) {\n Scope[Scope[\"TYPE\"] = 3] = \"TYPE\";\n Scope[Scope[\"LEVEL\"] = 12] = \"LEVEL\";\n Scope[Scope[\"ATTRIBUTE\"] = 13] = \"ATTRIBUTE\";\n Scope[Scope[\"BLOT\"] = 14] = \"BLOT\";\n Scope[Scope[\"INLINE\"] = 7] = \"INLINE\";\n Scope[Scope[\"BLOCK\"] = 11] = \"BLOCK\";\n Scope[Scope[\"BLOCK_BLOT\"] = 10] = \"BLOCK_BLOT\";\n Scope[Scope[\"INLINE_BLOT\"] = 6] = \"INLINE_BLOT\";\n Scope[Scope[\"BLOCK_ATTRIBUTE\"] = 9] = \"BLOCK_ATTRIBUTE\";\n Scope[Scope[\"INLINE_ATTRIBUTE\"] = 5] = \"INLINE_ATTRIBUTE\";\n Scope[Scope[\"ANY\"] = 15] = \"ANY\";\n})(Scope = exports.Scope || (exports.Scope = {}));\nfunction create(input, value) {\n var match = query(input);\n if (match == null) {\n throw new ParchmentError(\"Unable to create \" + input + \" blot\");\n }\n var BlotClass = match;\n var node = \n // @ts-ignore\n input instanceof Node || input['nodeType'] === Node.TEXT_NODE ? input : BlotClass.create(value);\n return new BlotClass(node, value);\n}\nexports.create = create;\nfunction find(node, bubble) {\n if (bubble === void 0) { bubble = false; }\n if (node == null)\n return null;\n // @ts-ignore\n if (node[exports.DATA_KEY] != null)\n return node[exports.DATA_KEY].blot;\n if (bubble)\n return find(node.parentNode, bubble);\n return null;\n}\nexports.find = find;\nfunction query(query, scope) {\n if (scope === void 0) { scope = Scope.ANY; }\n var match;\n if (typeof query === 'string') {\n match = types[query] || attributes[query];\n // @ts-ignore\n }\n else if (query instanceof Text || query['nodeType'] === Node.TEXT_NODE) {\n match = types['text'];\n }\n else if (typeof query === 'number') {\n if (query & Scope.LEVEL & Scope.BLOCK) {\n match = types['block'];\n }\n else if (query & Scope.LEVEL & Scope.INLINE) {\n match = types['inline'];\n }\n }\n else if (query instanceof HTMLElement) {\n var names = (query.getAttribute('class') || '').split(/\\s+/);\n for (var i in names) {\n match = classes[names[i]];\n if (match)\n break;\n }\n match = match || tags[query.tagName];\n }\n if (match == null)\n return null;\n // @ts-ignore\n if (scope & Scope.LEVEL & match.scope && scope & Scope.TYPE & match.scope)\n return match;\n return null;\n}\nexports.query = query;\nfunction register() {\n var Definitions = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n Definitions[_i] = arguments[_i];\n }\n if (Definitions.length > 1) {\n return Definitions.map(function (d) {\n return register(d);\n });\n }\n var Definition = Definitions[0];\n if (typeof Definition.blotName !== 'string' && typeof Definition.attrName !== 'string') {\n throw new ParchmentError('Invalid definition');\n }\n else if (Definition.blotName === 'abstract') {\n throw new ParchmentError('Cannot register abstract class');\n }\n types[Definition.blotName || Definition.attrName] = Definition;\n if (typeof Definition.keyName === 'string') {\n attributes[Definition.keyName] = Definition;\n }\n else {\n if (Definition.className != null) {\n classes[Definition.className] = Definition;\n }\n if (Definition.tagName != null) {\n if (Array.isArray(Definition.tagName)) {\n Definition.tagName = Definition.tagName.map(function (tagName) {\n return tagName.toUpperCase();\n });\n }\n else {\n Definition.tagName = Definition.tagName.toUpperCase();\n }\n var tagNames = Array.isArray(Definition.tagName) ? Definition.tagName : [Definition.tagName];\n tagNames.forEach(function (tag) {\n if (tags[tag] == null || Definition.className == null) {\n tags[tag] = Definition;\n }\n });\n }\n }\n return Definition;\n}\nexports.register = register;\n\n\n/***/ }),\n/* 2 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar diff = __webpack_require__(51);\nvar equal = __webpack_require__(11);\nvar extend = __webpack_require__(3);\nvar op = __webpack_require__(20);\n\n\nvar NULL_CHARACTER = String.fromCharCode(0); // Placeholder char for embed in diff()\n\n\nvar Delta = function (ops) {\n // Assume we are given a well formed ops\n if (Array.isArray(ops)) {\n this.ops = ops;\n } else if (ops != null && Array.isArray(ops.ops)) {\n this.ops = ops.ops;\n } else {\n this.ops = [];\n }\n};\n\n\nDelta.prototype.insert = function (text, attributes) {\n var newOp = {};\n if (text.length === 0) return this;\n newOp.insert = text;\n if (attributes != null && typeof attributes === 'object' && Object.keys(attributes).length > 0) {\n newOp.attributes = attributes;\n }\n return this.push(newOp);\n};\n\nDelta.prototype['delete'] = function (length) {\n if (length <= 0) return this;\n return this.push({ 'delete': length });\n};\n\nDelta.prototype.retain = function (length, attributes) {\n if (length <= 0) return this;\n var newOp = { retain: length };\n if (attributes != null && typeof attributes === 'object' && Object.keys(attributes).length > 0) {\n newOp.attributes = attributes;\n }\n return this.push(newOp);\n};\n\nDelta.prototype.push = function (newOp) {\n var index = this.ops.length;\n var lastOp = this.ops[index - 1];\n newOp = extend(true, {}, newOp);\n if (typeof lastOp === 'object') {\n if (typeof newOp['delete'] === 'number' && typeof lastOp['delete'] === 'number') {\n this.ops[index - 1] = { 'delete': lastOp['delete'] + newOp['delete'] };\n return this;\n }\n // Since it does not matter if we insert before or after deleting at the same index,\n // always prefer to insert first\n if (typeof lastOp['delete'] === 'number' && newOp.insert != null) {\n index -= 1;\n lastOp = this.ops[index - 1];\n if (typeof lastOp !== 'object') {\n this.ops.unshift(newOp);\n return this;\n }\n }\n if (equal(newOp.attributes, lastOp.attributes)) {\n if (typeof newOp.insert === 'string' && typeof lastOp.insert === 'string') {\n this.ops[index - 1] = { insert: lastOp.insert + newOp.insert };\n if (typeof newOp.attributes === 'object') this.ops[index - 1].attributes = newOp.attributes\n return this;\n } else if (typeof newOp.retain === 'number' && typeof lastOp.retain === 'number') {\n this.ops[index - 1] = { retain: lastOp.retain + newOp.retain };\n if (typeof newOp.attributes === 'object') this.ops[index - 1].attributes = newOp.attributes\n return this;\n }\n }\n }\n if (index === this.ops.length) {\n this.ops.push(newOp);\n } else {\n this.ops.splice(index, 0, newOp);\n }\n return this;\n};\n\nDelta.prototype.chop = function () {\n var lastOp = this.ops[this.ops.length - 1];\n if (lastOp && lastOp.retain && !lastOp.attributes) {\n this.ops.pop();\n }\n return this;\n};\n\nDelta.prototype.filter = function (predicate) {\n return this.ops.filter(predicate);\n};\n\nDelta.prototype.forEach = function (predicate) {\n this.ops.forEach(predicate);\n};\n\nDelta.prototype.map = function (predicate) {\n return this.ops.map(predicate);\n};\n\nDelta.prototype.partition = function (predicate) {\n var passed = [], failed = [];\n this.forEach(function(op) {\n var target = predicate(op) ? passed : failed;\n target.push(op);\n });\n return [passed, failed];\n};\n\nDelta.prototype.reduce = function (predicate, initial) {\n return this.ops.reduce(predicate, initial);\n};\n\nDelta.prototype.changeLength = function () {\n return this.reduce(function (length, elem) {\n if (elem.insert) {\n return length + op.length(elem);\n } else if (elem.delete) {\n return length - elem.delete;\n }\n return length;\n }, 0);\n};\n\nDelta.prototype.length = function () {\n return this.reduce(function (length, elem) {\n return length + op.length(elem);\n }, 0);\n};\n\nDelta.prototype.slice = function (start, end) {\n start = start || 0;\n if (typeof end !== 'number') end = Infinity;\n var ops = [];\n var iter = op.iterator(this.ops);\n var index = 0;\n while (index < end && iter.hasNext()) {\n var nextOp;\n if (index < start) {\n nextOp = iter.next(start - index);\n } else {\n nextOp = iter.next(end - index);\n ops.push(nextOp);\n }\n index += op.length(nextOp);\n }\n return new Delta(ops);\n};\n\n\nDelta.prototype.compose = function (other) {\n var thisIter = op.iterator(this.ops);\n var otherIter = op.iterator(other.ops);\n var ops = [];\n var firstOther = otherIter.peek();\n if (firstOther != null && typeof firstOther.retain === 'number' && firstOther.attributes == null) {\n var firstLeft = firstOther.retain;\n while (thisIter.peekType() === 'insert' && thisIter.peekLength() <= firstLeft) {\n firstLeft -= thisIter.peekLength();\n ops.push(thisIter.next());\n }\n if (firstOther.retain - firstLeft > 0) {\n otherIter.next(firstOther.retain - firstLeft);\n }\n }\n var delta = new Delta(ops);\n while (thisIter.hasNext() || otherIter.hasNext()) {\n if (otherIter.peekType() === 'insert') {\n delta.push(otherIter.next());\n } else if (thisIter.peekType() === 'delete') {\n delta.push(thisIter.next());\n } else {\n var length = Math.min(thisIter.peekLength(), otherIter.peekLength());\n var thisOp = thisIter.next(length);\n var otherOp = otherIter.next(length);\n if (typeof otherOp.retain === 'number') {\n var newOp = {};\n if (typeof thisOp.retain === 'number') {\n newOp.retain = length;\n } else {\n newOp.insert = thisOp.insert;\n }\n // Preserve null when composing with a retain, otherwise remove it for inserts\n var attributes = op.attributes.compose(thisOp.attributes, otherOp.attributes, typeof thisOp.retain === 'number');\n if (attributes) newOp.attributes = attributes;\n delta.push(newOp);\n\n // Optimization if rest of other is just retain\n if (!otherIter.hasNext() && equal(delta.ops[delta.ops.length - 1], newOp)) {\n var rest = new Delta(thisIter.rest());\n return delta.concat(rest).chop();\n }\n\n // Other op should be delete, we could be an insert or retain\n // Insert + delete cancels out\n } else if (typeof otherOp['delete'] === 'number' && typeof thisOp.retain === 'number') {\n delta.push(otherOp);\n }\n }\n }\n return delta.chop();\n};\n\nDelta.prototype.concat = function (other) {\n var delta = new Delta(this.ops.slice());\n if (other.ops.length > 0) {\n delta.push(other.ops[0]);\n delta.ops = delta.ops.concat(other.ops.slice(1));\n }\n return delta;\n};\n\nDelta.prototype.diff = function (other, index) {\n if (this.ops === other.ops) {\n return new Delta();\n }\n var strings = [this, other].map(function (delta) {\n return delta.map(function (op) {\n if (op.insert != null) {\n return typeof op.insert === 'string' ? op.insert : NULL_CHARACTER;\n }\n var prep = (delta === other) ? 'on' : 'with';\n throw new Error('diff() called ' + prep + ' non-document');\n }).join('');\n });\n var delta = new Delta();\n var diffResult = diff(strings[0], strings[1], index);\n var thisIter = op.iterator(this.ops);\n var otherIter = op.iterator(other.ops);\n diffResult.forEach(function (component) {\n var length = component[1].length;\n while (length > 0) {\n var opLength = 0;\n switch (component[0]) {\n case diff.INSERT:\n opLength = Math.min(otherIter.peekLength(), length);\n delta.push(otherIter.next(opLength));\n break;\n case diff.DELETE:\n opLength = Math.min(length, thisIter.peekLength());\n thisIter.next(opLength);\n delta['delete'](opLength);\n break;\n case diff.EQUAL:\n opLength = Math.min(thisIter.peekLength(), otherIter.peekLength(), length);\n var thisOp = thisIter.next(opLength);\n var otherOp = otherIter.next(opLength);\n if (equal(thisOp.insert, otherOp.insert)) {\n delta.retain(opLength, op.attributes.diff(thisOp.attributes, otherOp.attributes));\n } else {\n delta.push(otherOp)['delete'](opLength);\n }\n break;\n }\n length -= opLength;\n }\n });\n return delta.chop();\n};\n\nDelta.prototype.eachLine = function (predicate, newline) {\n newline = newline || '\\n';\n var iter = op.iterator(this.ops);\n var line = new Delta();\n var i = 0;\n while (iter.hasNext()) {\n if (iter.peekType() !== 'insert') return;\n var thisOp = iter.peek();\n var start = op.length(thisOp) - iter.peekLength();\n var index = typeof thisOp.insert === 'string' ?\n thisOp.insert.indexOf(newline, start) - start : -1;\n if (index < 0) {\n line.push(iter.next());\n } else if (index > 0) {\n line.push(iter.next(index));\n } else {\n if (predicate(line, iter.next(1).attributes || {}, i) === false) {\n return;\n }\n i += 1;\n line = new Delta();\n }\n }\n if (line.length() > 0) {\n predicate(line, {}, i);\n }\n};\n\nDelta.prototype.transform = function (other, priority) {\n priority = !!priority;\n if (typeof other === 'number') {\n return this.transformPosition(other, priority);\n }\n var thisIter = op.iterator(this.ops);\n var otherIter = op.iterator(other.ops);\n var delta = new Delta();\n while (thisIter.hasNext() || otherIter.hasNext()) {\n if (thisIter.peekType() === 'insert' && (priority || otherIter.peekType() !== 'insert')) {\n delta.retain(op.length(thisIter.next()));\n } else if (otherIter.peekType() === 'insert') {\n delta.push(otherIter.next());\n } else {\n var length = Math.min(thisIter.peekLength(), otherIter.peekLength());\n var thisOp = thisIter.next(length);\n var otherOp = otherIter.next(length);\n if (thisOp['delete']) {\n // Our delete either makes their delete redundant or removes their retain\n continue;\n } else if (otherOp['delete']) {\n delta.push(otherOp);\n } else {\n // We retain either their retain or insert\n delta.retain(length, op.attributes.transform(thisOp.attributes, otherOp.attributes, priority));\n }\n }\n }\n return delta.chop();\n};\n\nDelta.prototype.transformPosition = function (index, priority) {\n priority = !!priority;\n var thisIter = op.iterator(this.ops);\n var offset = 0;\n while (thisIter.hasNext() && offset <= index) {\n var length = thisIter.peekLength();\n var nextType = thisIter.peekType();\n thisIter.next();\n if (nextType === 'delete') {\n index -= Math.min(length, index - offset);\n continue;\n } else if (nextType === 'insert' && (offset < index || !priority)) {\n index += length;\n }\n offset += length;\n }\n return index;\n};\n\n\nmodule.exports = Delta;\n\n\n/***/ }),\n/* 3 */\n/***/ (function(module, exports) {\n\n'use strict';\n\nvar hasOwn = Object.prototype.hasOwnProperty;\nvar toStr = Object.prototype.toString;\nvar defineProperty = Object.defineProperty;\nvar gOPD = Object.getOwnPropertyDescriptor;\n\nvar isArray = function isArray(arr) {\n\tif (typeof Array.isArray === 'function') {\n\t\treturn Array.isArray(arr);\n\t}\n\n\treturn toStr.call(arr) === '[object Array]';\n};\n\nvar isPlainObject = function isPlainObject(obj) {\n\tif (!obj || toStr.call(obj) !== '[object Object]') {\n\t\treturn false;\n\t}\n\n\tvar hasOwnConstructor = hasOwn.call(obj, 'constructor');\n\tvar hasIsPrototypeOf = obj.constructor && obj.constructor.prototype && hasOwn.call(obj.constructor.prototype, 'isPrototypeOf');\n\t// Not own constructor property must be Object\n\tif (obj.constructor && !hasOwnConstructor && !hasIsPrototypeOf) {\n\t\treturn false;\n\t}\n\n\t// Own properties are enumerated firstly, so to speed up,\n\t// if last one is own, then all properties are own.\n\tvar key;\n\tfor (key in obj) { /**/ }\n\n\treturn typeof key === 'undefined' || hasOwn.call(obj, key);\n};\n\n// If name is '__proto__', and Object.defineProperty is available, define __proto__ as an own property on target\nvar setProperty = function setProperty(target, options) {\n\tif (defineProperty && options.name === '__proto__') {\n\t\tdefineProperty(target, options.name, {\n\t\t\tenumerable: true,\n\t\t\tconfigurable: true,\n\t\t\tvalue: options.newValue,\n\t\t\twritable: true\n\t\t});\n\t} else {\n\t\ttarget[options.name] = options.newValue;\n\t}\n};\n\n// Return undefined instead of __proto__ if '__proto__' is not an own property\nvar getProperty = function getProperty(obj, name) {\n\tif (name === '__proto__') {\n\t\tif (!hasOwn.call(obj, name)) {\n\t\t\treturn void 0;\n\t\t} else if (gOPD) {\n\t\t\t// In early versions of node, obj['__proto__'] is buggy when obj has\n\t\t\t// __proto__ as an own property. Object.getOwnPropertyDescriptor() works.\n\t\t\treturn gOPD(obj, name).value;\n\t\t}\n\t}\n\n\treturn obj[name];\n};\n\nmodule.exports = function extend() {\n\tvar options, name, src, copy, copyIsArray, clone;\n\tvar target = arguments[0];\n\tvar i = 1;\n\tvar length = arguments.length;\n\tvar deep = false;\n\n\t// Handle a deep copy situation\n\tif (typeof target === 'boolean') {\n\t\tdeep = target;\n\t\ttarget = arguments[1] || {};\n\t\t// skip the boolean and the target\n\t\ti = 2;\n\t}\n\tif (target == null || (typeof target !== 'object' && typeof target !== 'function')) {\n\t\ttarget = {};\n\t}\n\n\tfor (; i < length; ++i) {\n\t\toptions = arguments[i];\n\t\t// Only deal with non-null/undefined values\n\t\tif (options != null) {\n\t\t\t// Extend the base object\n\t\t\tfor (name in options) {\n\t\t\t\tsrc = getProperty(target, name);\n\t\t\t\tcopy = getProperty(options, name);\n\n\t\t\t\t// Prevent never-ending loop\n\t\t\t\tif (target !== copy) {\n\t\t\t\t\t// Recurse if we're merging plain objects or arrays\n\t\t\t\t\tif (deep && copy && (isPlainObject(copy) || (copyIsArray = isArray(copy)))) {\n\t\t\t\t\t\tif (copyIsArray) {\n\t\t\t\t\t\t\tcopyIsArray = false;\n\t\t\t\t\t\t\tclone = src && isArray(src) ? src : [];\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tclone = src && isPlainObject(src) ? src : {};\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Never move original objects, clone them\n\t\t\t\t\t\tsetProperty(target, { name: name, newValue: extend(deep, clone, copy) });\n\n\t\t\t\t\t// Don't bring in undefined values\n\t\t\t\t\t} else if (typeof copy !== 'undefined') {\n\t\t\t\t\t\tsetProperty(target, { name: name, newValue: copy });\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Return the modified object\n\treturn target;\n};\n\n\n/***/ }),\n/* 4 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = exports.BlockEmbed = exports.bubbleFormats = undefined;\n\nvar _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; }; }();\n\nvar _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if (\"value\" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };\n\nvar _extend = __webpack_require__(3);\n\nvar _extend2 = _interopRequireDefault(_extend);\n\nvar _quillDelta = __webpack_require__(2);\n\nvar _quillDelta2 = _interopRequireDefault(_quillDelta);\n\nvar _parchment = __webpack_require__(0);\n\nvar _parchment2 = _interopRequireDefault(_parchment);\n\nvar _break = __webpack_require__(16);\n\nvar _break2 = _interopRequireDefault(_break);\n\nvar _inline = __webpack_require__(6);\n\nvar _inline2 = _interopRequireDefault(_inline);\n\nvar _text = __webpack_require__(7);\n\nvar _text2 = _interopRequireDefault(_text);\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 _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nvar NEWLINE_LENGTH = 1;\n\nvar BlockEmbed = function (_Parchment$Embed) {\n _inherits(BlockEmbed, _Parchment$Embed);\n\n function BlockEmbed() {\n _classCallCheck(this, BlockEmbed);\n\n return _possibleConstructorReturn(this, (BlockEmbed.__proto__ || Object.getPrototypeOf(BlockEmbed)).apply(this, arguments));\n }\n\n _createClass(BlockEmbed, [{\n key: 'attach',\n value: function attach() {\n _get(BlockEmbed.prototype.__proto__ || Object.getPrototypeOf(BlockEmbed.prototype), 'attach', this).call(this);\n this.attributes = new _parchment2.default.Attributor.Store(this.domNode);\n }\n }, {\n key: 'delta',\n value: function delta() {\n return new _quillDelta2.default().insert(this.value(), (0, _extend2.default)(this.formats(), this.attributes.values()));\n }\n }, {\n key: 'format',\n value: function format(name, value) {\n var attribute = _parchment2.default.query(name, _parchment2.default.Scope.BLOCK_ATTRIBUTE);\n if (attribute != null) {\n this.attributes.attribute(attribute, value);\n }\n }\n }, {\n key: 'formatAt',\n value: function formatAt(index, length, name, value) {\n this.format(name, value);\n }\n }, {\n key: 'insertAt',\n value: function insertAt(index, value, def) {\n if (typeof value === 'string' && value.endsWith('\\n')) {\n var block = _parchment2.default.create(Block.blotName);\n this.parent.insertBefore(block, index === 0 ? this : this.next);\n block.insertAt(0, value.slice(0, -1));\n } else {\n _get(BlockEmbed.prototype.__proto__ || Object.getPrototypeOf(BlockEmbed.prototype), 'insertAt', this).call(this, index, value, def);\n }\n }\n }]);\n\n return BlockEmbed;\n}(_parchment2.default.Embed);\n\nBlockEmbed.scope = _parchment2.default.Scope.BLOCK_BLOT;\n// It is important for cursor behavior BlockEmbeds use tags that are block level elements\n\n\nvar Block = function (_Parchment$Block) {\n _inherits(Block, _Parchment$Block);\n\n function Block(domNode) {\n _classCallCheck(this, Block);\n\n var _this2 = _possibleConstructorReturn(this, (Block.__proto__ || Object.getPrototypeOf(Block)).call(this, domNode));\n\n _this2.cache = {};\n return _this2;\n }\n\n _createClass(Block, [{\n key: 'delta',\n value: function delta() {\n if (this.cache.delta == null) {\n this.cache.delta = this.descendants(_parchment2.default.Leaf).reduce(function (delta, leaf) {\n if (leaf.length() === 0) {\n return delta;\n } else {\n return delta.insert(leaf.value(), bubbleFormats(leaf));\n }\n }, new _quillDelta2.default()).insert('\\n', bubbleFormats(this));\n }\n return this.cache.delta;\n }\n }, {\n key: 'deleteAt',\n value: function deleteAt(index, length) {\n _get(Block.prototype.__proto__ || Object.getPrototypeOf(Block.prototype), 'deleteAt', this).call(this, index, length);\n this.cache = {};\n }\n }, {\n key: 'formatAt',\n value: function formatAt(index, length, name, value) {\n if (length <= 0) return;\n if (_parchment2.default.query(name, _parchment2.default.Scope.BLOCK)) {\n if (index + length === this.length()) {\n this.format(name, value);\n }\n } else {\n _get(Block.prototype.__proto__ || Object.getPrototypeOf(Block.prototype), 'formatAt', this).call(this, index, Math.min(length, this.length() - index - 1), name, value);\n }\n this.cache = {};\n }\n }, {\n key: 'insertAt',\n value: function insertAt(index, value, def) {\n if (def != null) return _get(Block.prototype.__proto__ || Object.getPrototypeOf(Block.prototype), 'insertAt', this).call(this, index, value, def);\n if (value.length === 0) return;\n var lines = value.split('\\n');\n var text = lines.shift();\n if (text.length > 0) {\n if (index < this.length() - 1 || this.children.tail == null) {\n _get(Block.prototype.__proto__ || Object.getPrototypeOf(Block.prototype), 'insertAt', this).call(this, Math.min(index, this.length() - 1), text);\n } else {\n this.children.tail.insertAt(this.children.tail.length(), text);\n }\n this.cache = {};\n }\n var block = this;\n lines.reduce(function (index, line) {\n block = block.split(index, true);\n block.insertAt(0, line);\n return line.length;\n }, index + text.length);\n }\n }, {\n key: 'insertBefore',\n value: function insertBefore(blot, ref) {\n var head = this.children.head;\n _get(Block.prototype.__proto__ || Object.getPrototypeOf(Block.prototype), 'insertBefore', this).call(this, blot, ref);\n if (head instanceof _break2.default) {\n head.remove();\n }\n this.cache = {};\n }\n }, {\n key: 'length',\n value: function length() {\n if (this.cache.length == null) {\n this.cache.length = _get(Block.prototype.__proto__ || Object.getPrototypeOf(Block.prototype), 'length', this).call(this) + NEWLINE_LENGTH;\n }\n return this.cache.length;\n }\n }, {\n key: 'moveChildren',\n value: function moveChildren(target, ref) {\n _get(Block.prototype.__proto__ || Object.getPrototypeOf(Block.prototype), 'moveChildren', this).call(this, target, ref);\n this.cache = {};\n }\n }, {\n key: 'optimize',\n value: function optimize(context) {\n _get(Block.prototype.__proto__ || Object.getPrototypeOf(Block.prototype), 'optimize', this).call(this, context);\n this.cache = {};\n }\n }, {\n key: 'path',\n value: function path(index) {\n return _get(Block.prototype.__proto__ || Object.getPrototypeOf(Block.prototype), 'path', this).call(this, index, true);\n }\n }, {\n key: 'removeChild',\n value: function removeChild(child) {\n _get(Block.prototype.__proto__ || Object.getPrototypeOf(Block.prototype), 'removeChild', this).call(this, child);\n this.cache = {};\n }\n }, {\n key: 'split',\n value: function split(index) {\n var force = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n\n if (force && (index === 0 || index >= this.length() - NEWLINE_LENGTH)) {\n var clone = this.clone();\n if (index === 0) {\n this.parent.insertBefore(clone, this);\n return this;\n } else {\n this.parent.insertBefore(clone, this.next);\n return clone;\n }\n } else {\n var next = _get(Block.prototype.__proto__ || Object.getPrototypeOf(Block.prototype), 'split', this).call(this, index, force);\n this.cache = {};\n return next;\n }\n }\n }]);\n\n return Block;\n}(_parchment2.default.Block);\n\nBlock.blotName = 'block';\nBlock.tagName = 'P';\nBlock.defaultChild = 'break';\nBlock.allowedChildren = [_inline2.default, _parchment2.default.Embed, _text2.default];\n\nfunction bubbleFormats(blot) {\n var formats = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n if (blot == null) return formats;\n if (typeof blot.formats === 'function') {\n formats = (0, _extend2.default)(formats, blot.formats());\n }\n if (blot.parent == null || blot.parent.blotName == 'scroll' || blot.parent.statics.scope !== blot.statics.scope) {\n return formats;\n }\n return bubbleFormats(blot.parent, formats);\n}\n\nexports.bubbleFormats = bubbleFormats;\nexports.BlockEmbed = BlockEmbed;\nexports.default = Block;\n\n/***/ }),\n/* 5 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = exports.overload = exports.expandConfig = undefined;\n\nvar _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; };\n\nvar _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_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\"]) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); } }; }();\n\nvar _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; }; }();\n\n__webpack_require__(50);\n\nvar _quillDelta = __webpack_require__(2);\n\nvar _quillDelta2 = _interopRequireDefault(_quillDelta);\n\nvar _editor = __webpack_require__(14);\n\nvar _editor2 = _interopRequireDefault(_editor);\n\nvar _emitter3 = __webpack_require__(8);\n\nvar _emitter4 = _interopRequireDefault(_emitter3);\n\nvar _module = __webpack_require__(9);\n\nvar _module2 = _interopRequireDefault(_module);\n\nvar _parchment = __webpack_require__(0);\n\nvar _parchment2 = _interopRequireDefault(_parchment);\n\nvar _selection = __webpack_require__(15);\n\nvar _selection2 = _interopRequireDefault(_selection);\n\nvar _extend = __webpack_require__(3);\n\nvar _extend2 = _interopRequireDefault(_extend);\n\nvar _logger = __webpack_require__(10);\n\nvar _logger2 = _interopRequireDefault(_logger);\n\nvar _theme = __webpack_require__(34);\n\nvar _theme2 = _interopRequireDefault(_theme);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\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 _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nvar debug = (0, _logger2.default)('quill');\n\nvar Quill = function () {\n _createClass(Quill, null, [{\n key: 'debug',\n value: function debug(limit) {\n if (limit === true) {\n limit = 'log';\n }\n _logger2.default.level(limit);\n }\n }, {\n key: 'find',\n value: function find(node) {\n return node.__quill || _parchment2.default.find(node);\n }\n }, {\n key: 'import',\n value: function _import(name) {\n if (this.imports[name] == null) {\n debug.error('Cannot import ' + name + '. Are you sure it was registered?');\n }\n return this.imports[name];\n }\n }, {\n key: 'register',\n value: function register(path, target) {\n var _this = this;\n\n var overwrite = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;\n\n if (typeof path !== 'string') {\n var name = path.attrName || path.blotName;\n if (typeof name === 'string') {\n // register(Blot | Attributor, overwrite)\n this.register('formats/' + name, path, target);\n } else {\n Object.keys(path).forEach(function (key) {\n _this.register(key, path[key], target);\n });\n }\n } else {\n if (this.imports[path] != null && !overwrite) {\n debug.warn('Overwriting ' + path + ' with', target);\n }\n this.imports[path] = target;\n if ((path.startsWith('blots/') || path.startsWith('formats/')) && target.blotName !== 'abstract') {\n _parchment2.default.register(target);\n } else if (path.startsWith('modules') && typeof target.register === 'function') {\n target.register();\n }\n }\n }\n }]);\n\n function Quill(container) {\n var _this2 = this;\n\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n _classCallCheck(this, Quill);\n\n this.options = expandConfig(container, options);\n this.container = this.options.container;\n if (this.container == null) {\n return debug.error('Invalid Quill container', container);\n }\n if (this.options.debug) {\n Quill.debug(this.options.debug);\n }\n var html = this.container.innerHTML.trim();\n this.container.classList.add('ql-container');\n this.container.innerHTML = '';\n this.container.__quill = this;\n this.root = this.addContainer('ql-editor');\n this.root.classList.add('ql-blank');\n this.root.setAttribute('data-gramm', false);\n this.scrollingContainer = this.options.scrollingContainer || this.root;\n this.emitter = new _emitter4.default();\n this.scroll = _parchment2.default.create(this.root, {\n emitter: this.emitter,\n whitelist: this.options.formats\n });\n this.editor = new _editor2.default(this.scroll);\n this.selection = new _selection2.default(this.scroll, this.emitter);\n this.theme = new this.options.theme(this, this.options);\n this.keyboard = this.theme.addModule('keyboard');\n this.clipboard = this.theme.addModule('clipboard');\n this.history = this.theme.addModule('history');\n this.theme.init();\n this.emitter.on(_emitter4.default.events.EDITOR_CHANGE, function (type) {\n if (type === _emitter4.default.events.TEXT_CHANGE) {\n _this2.root.classList.toggle('ql-blank', _this2.editor.isBlank());\n }\n });\n this.emitter.on(_emitter4.default.events.SCROLL_UPDATE, function (source, mutations) {\n var range = _this2.selection.lastRange;\n var index = range && range.length === 0 ? range.index : undefined;\n modify.call(_this2, function () {\n return _this2.editor.update(null, mutations, index);\n }, source);\n });\n var contents = this.clipboard.convert('
' + html + '


');\n this.setContents(contents);\n this.history.clear();\n if (this.options.placeholder) {\n this.root.setAttribute('data-placeholder', this.options.placeholder);\n }\n if (this.options.readOnly) {\n this.disable();\n }\n }\n\n _createClass(Quill, [{\n key: 'addContainer',\n value: function addContainer(container) {\n var refNode = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;\n\n if (typeof container === 'string') {\n var className = container;\n container = document.createElement('div');\n container.classList.add(className);\n }\n this.container.insertBefore(container, refNode);\n return container;\n }\n }, {\n key: 'blur',\n value: function blur() {\n this.selection.setRange(null);\n }\n }, {\n key: 'deleteText',\n value: function deleteText(index, length, source) {\n var _this3 = this;\n\n var _overload = overload(index, length, source);\n\n var _overload2 = _slicedToArray(_overload, 4);\n\n index = _overload2[0];\n length = _overload2[1];\n source = _overload2[3];\n\n return modify.call(this, function () {\n return _this3.editor.deleteText(index, length);\n }, source, index, -1 * length);\n }\n }, {\n key: 'disable',\n value: function disable() {\n this.enable(false);\n }\n }, {\n key: 'enable',\n value: function enable() {\n var enabled = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;\n\n this.scroll.enable(enabled);\n this.container.classList.toggle('ql-disabled', !enabled);\n }\n }, {\n key: 'focus',\n value: function focus() {\n var scrollTop = this.scrollingContainer.scrollTop;\n this.selection.focus();\n this.scrollingContainer.scrollTop = scrollTop;\n this.scrollIntoView();\n }\n }, {\n key: 'format',\n value: function format(name, value) {\n var _this4 = this;\n\n var source = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _emitter4.default.sources.API;\n\n return modify.call(this, function () {\n var range = _this4.getSelection(true);\n var change = new _quillDelta2.default();\n if (range == null) {\n return change;\n } else if (_parchment2.default.query(name, _parchment2.default.Scope.BLOCK)) {\n change = _this4.editor.formatLine(range.index, range.length, _defineProperty({}, name, value));\n } else if (range.length === 0) {\n _this4.selection.format(name, value);\n return change;\n } else {\n change = _this4.editor.formatText(range.index, range.length, _defineProperty({}, name, value));\n }\n _this4.setSelection(range, _emitter4.default.sources.SILENT);\n return change;\n }, source);\n }\n }, {\n key: 'formatLine',\n value: function formatLine(index, length, name, value, source) {\n var _this5 = this;\n\n var formats = void 0;\n\n var _overload3 = overload(index, length, name, value, source);\n\n var _overload4 = _slicedToArray(_overload3, 4);\n\n index = _overload4[0];\n length = _overload4[1];\n formats = _overload4[2];\n source = _overload4[3];\n\n return modify.call(this, function () {\n return _this5.editor.formatLine(index, length, formats);\n }, source, index, 0);\n }\n }, {\n key: 'formatText',\n value: function formatText(index, length, name, value, source) {\n var _this6 = this;\n\n var formats = void 0;\n\n var _overload5 = overload(index, length, name, value, source);\n\n var _overload6 = _slicedToArray(_overload5, 4);\n\n index = _overload6[0];\n length = _overload6[1];\n formats = _overload6[2];\n source = _overload6[3];\n\n return modify.call(this, function () {\n return _this6.editor.formatText(index, length, formats);\n }, source, index, 0);\n }\n }, {\n key: 'getBounds',\n value: function getBounds(index) {\n var length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n\n var bounds = void 0;\n if (typeof index === 'number') {\n bounds = this.selection.getBounds(index, length);\n } else {\n bounds = this.selection.getBounds(index.index, index.length);\n }\n var containerBounds = this.container.getBoundingClientRect();\n return {\n bottom: bounds.bottom - containerBounds.top,\n height: bounds.height,\n left: bounds.left - containerBounds.left,\n right: bounds.right - containerBounds.left,\n top: bounds.top - containerBounds.top,\n width: bounds.width\n };\n }\n }, {\n key: 'getContents',\n value: function getContents() {\n var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;\n var length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.getLength() - index;\n\n var _overload7 = overload(index, length);\n\n var _overload8 = _slicedToArray(_overload7, 2);\n\n index = _overload8[0];\n length = _overload8[1];\n\n return this.editor.getContents(index, length);\n }\n }, {\n key: 'getFormat',\n value: function getFormat() {\n var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.getSelection(true);\n var length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n\n if (typeof index === 'number') {\n return this.editor.getFormat(index, length);\n } else {\n return this.editor.getFormat(index.index, index.length);\n }\n }\n }, {\n key: 'getIndex',\n value: function getIndex(blot) {\n return blot.offset(this.scroll);\n }\n }, {\n key: 'getLength',\n value: function getLength() {\n return this.scroll.length();\n }\n }, {\n key: 'getLeaf',\n value: function getLeaf(index) {\n return this.scroll.leaf(index);\n }\n }, {\n key: 'getLine',\n value: function getLine(index) {\n return this.scroll.line(index);\n }\n }, {\n key: 'getLines',\n value: function getLines() {\n var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;\n var length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Number.MAX_VALUE;\n\n if (typeof index !== 'number') {\n return this.scroll.lines(index.index, index.length);\n } else {\n return this.scroll.lines(index, length);\n }\n }\n }, {\n key: 'getModule',\n value: function getModule(name) {\n return this.theme.modules[name];\n }\n }, {\n key: 'getSelection',\n value: function getSelection() {\n var focus = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;\n\n if (focus) this.focus();\n this.update(); // Make sure we access getRange with editor in consistent state\n return this.selection.getRange()[0];\n }\n }, {\n key: 'getText',\n value: function getText() {\n var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;\n var length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.getLength() - index;\n\n var _overload9 = overload(index, length);\n\n var _overload10 = _slicedToArray(_overload9, 2);\n\n index = _overload10[0];\n length = _overload10[1];\n\n return this.editor.getText(index, length);\n }\n }, {\n key: 'hasFocus',\n value: function hasFocus() {\n return this.selection.hasFocus();\n }\n }, {\n key: 'insertEmbed',\n value: function insertEmbed(index, embed, value) {\n var _this7 = this;\n\n var source = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : Quill.sources.API;\n\n return modify.call(this, function () {\n return _this7.editor.insertEmbed(index, embed, value);\n }, source, index);\n }\n }, {\n key: 'insertText',\n value: function insertText(index, text, name, value, source) {\n var _this8 = this;\n\n var formats = void 0;\n\n var _overload11 = overload(index, 0, name, value, source);\n\n var _overload12 = _slicedToArray(_overload11, 4);\n\n index = _overload12[0];\n formats = _overload12[2];\n source = _overload12[3];\n\n return modify.call(this, function () {\n return _this8.editor.insertText(index, text, formats);\n }, source, index, text.length);\n }\n }, {\n key: 'isEnabled',\n value: function isEnabled() {\n return !this.container.classList.contains('ql-disabled');\n }\n }, {\n key: 'off',\n value: function off() {\n return this.emitter.off.apply(this.emitter, arguments);\n }\n }, {\n key: 'on',\n value: function on() {\n return this.emitter.on.apply(this.emitter, arguments);\n }\n }, {\n key: 'once',\n value: function once() {\n return this.emitter.once.apply(this.emitter, arguments);\n }\n }, {\n key: 'pasteHTML',\n value: function pasteHTML(index, html, source) {\n this.clipboard.dangerouslyPasteHTML(index, html, source);\n }\n }, {\n key: 'removeFormat',\n value: function removeFormat(index, length, source) {\n var _this9 = this;\n\n var _overload13 = overload(index, length, source);\n\n var _overload14 = _slicedToArray(_overload13, 4);\n\n index = _overload14[0];\n length = _overload14[1];\n source = _overload14[3];\n\n return modify.call(this, function () {\n return _this9.editor.removeFormat(index, length);\n }, source, index);\n }\n }, {\n key: 'scrollIntoView',\n value: function scrollIntoView() {\n this.selection.scrollIntoView(this.scrollingContainer);\n }\n }, {\n key: 'setContents',\n value: function setContents(delta) {\n var _this10 = this;\n\n var source = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _emitter4.default.sources.API;\n\n return modify.call(this, function () {\n delta = new _quillDelta2.default(delta);\n var length = _this10.getLength();\n var deleted = _this10.editor.deleteText(0, length);\n var applied = _this10.editor.applyDelta(delta);\n var lastOp = applied.ops[applied.ops.length - 1];\n if (lastOp != null && typeof lastOp.insert === 'string' && lastOp.insert[lastOp.insert.length - 1] === '\\n') {\n _this10.editor.deleteText(_this10.getLength() - 1, 1);\n applied.delete(1);\n }\n var ret = deleted.compose(applied);\n return ret;\n }, source);\n }\n }, {\n key: 'setSelection',\n value: function setSelection(index, length, source) {\n if (index == null) {\n this.selection.setRange(null, length || Quill.sources.API);\n } else {\n var _overload15 = overload(index, length, source);\n\n var _overload16 = _slicedToArray(_overload15, 4);\n\n index = _overload16[0];\n length = _overload16[1];\n source = _overload16[3];\n\n this.selection.setRange(new _selection.Range(index, length), source);\n if (source !== _emitter4.default.sources.SILENT) {\n this.selection.scrollIntoView(this.scrollingContainer);\n }\n }\n }\n }, {\n key: 'setText',\n value: function setText(text) {\n var source = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _emitter4.default.sources.API;\n\n var delta = new _quillDelta2.default().insert(text);\n return this.setContents(delta, source);\n }\n }, {\n key: 'update',\n value: function update() {\n var source = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _emitter4.default.sources.USER;\n\n var change = this.scroll.update(source); // Will update selection before selection.update() does if text changes\n this.selection.update(source);\n return change;\n }\n }, {\n key: 'updateContents',\n value: function updateContents(delta) {\n var _this11 = this;\n\n var source = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _emitter4.default.sources.API;\n\n return modify.call(this, function () {\n delta = new _quillDelta2.default(delta);\n return _this11.editor.applyDelta(delta, source);\n }, source, true);\n }\n }]);\n\n return Quill;\n}();\n\nQuill.DEFAULTS = {\n bounds: null,\n formats: null,\n modules: {},\n placeholder: '',\n readOnly: false,\n scrollingContainer: null,\n strict: true,\n theme: 'default'\n};\nQuill.events = _emitter4.default.events;\nQuill.sources = _emitter4.default.sources;\n// eslint-disable-next-line no-undef\nQuill.version = false ? undefined : \"1.3.7\";\n\nQuill.imports = {\n 'delta': _quillDelta2.default,\n 'parchment': _parchment2.default,\n 'core/module': _module2.default,\n 'core/theme': _theme2.default\n};\n\nfunction expandConfig(container, userConfig) {\n userConfig = (0, _extend2.default)(true, {\n container: container,\n modules: {\n clipboard: true,\n keyboard: true,\n history: true\n }\n }, userConfig);\n if (!userConfig.theme || userConfig.theme === Quill.DEFAULTS.theme) {\n userConfig.theme = _theme2.default;\n } else {\n userConfig.theme = Quill.import('themes/' + userConfig.theme);\n if (userConfig.theme == null) {\n throw new Error('Invalid theme ' + userConfig.theme + '. Did you register it?');\n }\n }\n var themeConfig = (0, _extend2.default)(true, {}, userConfig.theme.DEFAULTS);\n [themeConfig, userConfig].forEach(function (config) {\n config.modules = config.modules || {};\n Object.keys(config.modules).forEach(function (module) {\n if (config.modules[module] === true) {\n config.modules[module] = {};\n }\n });\n });\n var moduleNames = Object.keys(themeConfig.modules).concat(Object.keys(userConfig.modules));\n var moduleConfig = moduleNames.reduce(function (config, name) {\n var moduleClass = Quill.import('modules/' + name);\n if (moduleClass == null) {\n debug.error('Cannot load ' + name + ' module. Are you sure you registered it?');\n } else {\n config[name] = moduleClass.DEFAULTS || {};\n }\n return config;\n }, {});\n // Special case toolbar shorthand\n if (userConfig.modules != null && userConfig.modules.toolbar && userConfig.modules.toolbar.constructor !== Object) {\n userConfig.modules.toolbar = {\n container: userConfig.modules.toolbar\n };\n }\n userConfig = (0, _extend2.default)(true, {}, Quill.DEFAULTS, { modules: moduleConfig }, themeConfig, userConfig);\n ['bounds', 'container', 'scrollingContainer'].forEach(function (key) {\n if (typeof userConfig[key] === 'string') {\n userConfig[key] = document.querySelector(userConfig[key]);\n }\n });\n userConfig.modules = Object.keys(userConfig.modules).reduce(function (config, name) {\n if (userConfig.modules[name]) {\n config[name] = userConfig.modules[name];\n }\n return config;\n }, {});\n return userConfig;\n}\n\n// Handle selection preservation and TEXT_CHANGE emission\n// common to modification APIs\nfunction modify(modifier, source, index, shift) {\n if (this.options.strict && !this.isEnabled() && source === _emitter4.default.sources.USER) {\n return new _quillDelta2.default();\n }\n var range = index == null ? null : this.getSelection();\n var oldDelta = this.editor.delta;\n var change = modifier();\n if (range != null) {\n if (index === true) index = range.index;\n if (shift == null) {\n range = shiftRange(range, change, source);\n } else if (shift !== 0) {\n range = shiftRange(range, index, shift, source);\n }\n this.setSelection(range, _emitter4.default.sources.SILENT);\n }\n if (change.length() > 0) {\n var _emitter;\n\n var args = [_emitter4.default.events.TEXT_CHANGE, change, oldDelta, source];\n (_emitter = this.emitter).emit.apply(_emitter, [_emitter4.default.events.EDITOR_CHANGE].concat(args));\n if (source !== _emitter4.default.sources.SILENT) {\n var _emitter2;\n\n (_emitter2 = this.emitter).emit.apply(_emitter2, args);\n }\n }\n return change;\n}\n\nfunction overload(index, length, name, value, source) {\n var formats = {};\n if (typeof index.index === 'number' && typeof index.length === 'number') {\n // Allow for throwaway end (used by insertText/insertEmbed)\n if (typeof length !== 'number') {\n source = value, value = name, name = length, length = index.length, index = index.index;\n } else {\n length = index.length, index = index.index;\n }\n } else if (typeof length !== 'number') {\n source = value, value = name, name = length, length = 0;\n }\n // Handle format being object, two format name/value strings or excluded\n if ((typeof name === 'undefined' ? 'undefined' : _typeof(name)) === 'object') {\n formats = name;\n source = value;\n } else if (typeof name === 'string') {\n if (value != null) {\n formats[name] = value;\n } else {\n source = name;\n }\n }\n // Handle optional source\n source = source || _emitter4.default.sources.API;\n return [index, length, formats, source];\n}\n\nfunction shiftRange(range, index, length, source) {\n if (range == null) return null;\n var start = void 0,\n end = void 0;\n if (index instanceof _quillDelta2.default) {\n var _map = [range.index, range.index + range.length].map(function (pos) {\n return index.transformPosition(pos, source !== _emitter4.default.sources.USER);\n });\n\n var _map2 = _slicedToArray(_map, 2);\n\n start = _map2[0];\n end = _map2[1];\n } else {\n var _map3 = [range.index, range.index + range.length].map(function (pos) {\n if (pos < index || pos === index && source === _emitter4.default.sources.USER) return pos;\n if (length >= 0) {\n return pos + length;\n } else {\n return Math.max(index, pos + length);\n }\n });\n\n var _map4 = _slicedToArray(_map3, 2);\n\n start = _map4[0];\n end = _map4[1];\n }\n return new _selection.Range(start, end - start);\n}\n\nexports.expandConfig = expandConfig;\nexports.overload = overload;\nexports.default = Quill;\n\n/***/ }),\n/* 6 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _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; }; }();\n\nvar _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if (\"value\" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };\n\nvar _text = __webpack_require__(7);\n\nvar _text2 = _interopRequireDefault(_text);\n\nvar _parchment = __webpack_require__(0);\n\nvar _parchment2 = _interopRequireDefault(_parchment);\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 _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nvar Inline = function (_Parchment$Inline) {\n _inherits(Inline, _Parchment$Inline);\n\n function Inline() {\n _classCallCheck(this, Inline);\n\n return _possibleConstructorReturn(this, (Inline.__proto__ || Object.getPrototypeOf(Inline)).apply(this, arguments));\n }\n\n _createClass(Inline, [{\n key: 'formatAt',\n value: function formatAt(index, length, name, value) {\n if (Inline.compare(this.statics.blotName, name) < 0 && _parchment2.default.query(name, _parchment2.default.Scope.BLOT)) {\n var blot = this.isolate(index, length);\n if (value) {\n blot.wrap(name, value);\n }\n } else {\n _get(Inline.prototype.__proto__ || Object.getPrototypeOf(Inline.prototype), 'formatAt', this).call(this, index, length, name, value);\n }\n }\n }, {\n key: 'optimize',\n value: function optimize(context) {\n _get(Inline.prototype.__proto__ || Object.getPrototypeOf(Inline.prototype), 'optimize', this).call(this, context);\n if (this.parent instanceof Inline && Inline.compare(this.statics.blotName, this.parent.statics.blotName) > 0) {\n var parent = this.parent.isolate(this.offset(), this.length());\n this.moveChildren(parent);\n parent.wrap(this);\n }\n }\n }], [{\n key: 'compare',\n value: function compare(self, other) {\n var selfIndex = Inline.order.indexOf(self);\n var otherIndex = Inline.order.indexOf(other);\n if (selfIndex >= 0 || otherIndex >= 0) {\n return selfIndex - otherIndex;\n } else if (self === other) {\n return 0;\n } else if (self < other) {\n return -1;\n } else {\n return 1;\n }\n }\n }]);\n\n return Inline;\n}(_parchment2.default.Inline);\n\nInline.allowedChildren = [Inline, _parchment2.default.Embed, _text2.default];\n// Lower index means deeper in the DOM tree, since not found (-1) is for embeds\nInline.order = ['cursor', 'inline', // Must be lower\n'underline', 'strike', 'italic', 'bold', 'script', 'link', 'code' // Must be higher\n];\n\nexports.default = Inline;\n\n/***/ }),\n/* 7 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _parchment = __webpack_require__(0);\n\nvar _parchment2 = _interopRequireDefault(_parchment);\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 _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nvar TextBlot = function (_Parchment$Text) {\n _inherits(TextBlot, _Parchment$Text);\n\n function TextBlot() {\n _classCallCheck(this, TextBlot);\n\n return _possibleConstructorReturn(this, (TextBlot.__proto__ || Object.getPrototypeOf(TextBlot)).apply(this, arguments));\n }\n\n return TextBlot;\n}(_parchment2.default.Text);\n\nexports.default = TextBlot;\n\n/***/ }),\n/* 8 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _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; }; }();\n\nvar _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if (\"value\" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };\n\nvar _eventemitter = __webpack_require__(54);\n\nvar _eventemitter2 = _interopRequireDefault(_eventemitter);\n\nvar _logger = __webpack_require__(10);\n\nvar _logger2 = _interopRequireDefault(_logger);\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 _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nvar debug = (0, _logger2.default)('quill:events');\n\nvar EVENTS = ['selectionchange', 'mousedown', 'mouseup', 'click'];\n\nEVENTS.forEach(function (eventName) {\n document.addEventListener(eventName, function () {\n for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n [].slice.call(document.querySelectorAll('.ql-container')).forEach(function (node) {\n // TODO use WeakMap\n if (node.__quill && node.__quill.emitter) {\n var _node$__quill$emitter;\n\n (_node$__quill$emitter = node.__quill.emitter).handleDOM.apply(_node$__quill$emitter, args);\n }\n });\n });\n});\n\nvar Emitter = function (_EventEmitter) {\n _inherits(Emitter, _EventEmitter);\n\n function Emitter() {\n _classCallCheck(this, Emitter);\n\n var _this = _possibleConstructorReturn(this, (Emitter.__proto__ || Object.getPrototypeOf(Emitter)).call(this));\n\n _this.listeners = {};\n _this.on('error', debug.error);\n return _this;\n }\n\n _createClass(Emitter, [{\n key: 'emit',\n value: function emit() {\n debug.log.apply(debug, arguments);\n _get(Emitter.prototype.__proto__ || Object.getPrototypeOf(Emitter.prototype), 'emit', this).apply(this, arguments);\n }\n }, {\n key: 'handleDOM',\n value: function handleDOM(event) {\n for (var _len2 = arguments.length, args = Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {\n args[_key2 - 1] = arguments[_key2];\n }\n\n (this.listeners[event.type] || []).forEach(function (_ref) {\n var node = _ref.node,\n handler = _ref.handler;\n\n if (event.target === node || node.contains(event.target)) {\n handler.apply(undefined, [event].concat(args));\n }\n });\n }\n }, {\n key: 'listenDOM',\n value: function listenDOM(eventName, node, handler) {\n if (!this.listeners[eventName]) {\n this.listeners[eventName] = [];\n }\n this.listeners[eventName].push({ node: node, handler: handler });\n }\n }]);\n\n return Emitter;\n}(_eventemitter2.default);\n\nEmitter.events = {\n EDITOR_CHANGE: 'editor-change',\n SCROLL_BEFORE_UPDATE: 'scroll-before-update',\n SCROLL_OPTIMIZE: 'scroll-optimize',\n SCROLL_UPDATE: 'scroll-update',\n SELECTION_CHANGE: 'selection-change',\n TEXT_CHANGE: 'text-change'\n};\nEmitter.sources = {\n API: 'api',\n SILENT: 'silent',\n USER: 'user'\n};\n\nexports.default = Emitter;\n\n/***/ }),\n/* 9 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nvar Module = function Module(quill) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n _classCallCheck(this, Module);\n\n this.quill = quill;\n this.options = options;\n};\n\nModule.DEFAULTS = {};\n\nexports.default = Module;\n\n/***/ }),\n/* 10 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nvar levels = ['error', 'warn', 'log', 'info'];\nvar level = 'warn';\n\nfunction debug(method) {\n if (levels.indexOf(method) <= levels.indexOf(level)) {\n var _console;\n\n for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n args[_key - 1] = arguments[_key];\n }\n\n (_console = console)[method].apply(_console, args); // eslint-disable-line no-console\n }\n}\n\nfunction namespace(ns) {\n return levels.reduce(function (logger, method) {\n logger[method] = debug.bind(console, method, ns);\n return logger;\n }, {});\n}\n\ndebug.level = namespace.level = function (newLevel) {\n level = newLevel;\n};\n\nexports.default = namespace;\n\n/***/ }),\n/* 11 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar pSlice = Array.prototype.slice;\nvar objectKeys = __webpack_require__(52);\nvar isArguments = __webpack_require__(53);\n\nvar deepEqual = module.exports = function (actual, expected, opts) {\n if (!opts) opts = {};\n // 7.1. All identical values are equivalent, as determined by ===.\n if (actual === expected) {\n return true;\n\n } else if (actual instanceof Date && expected instanceof Date) {\n return actual.getTime() === expected.getTime();\n\n // 7.3. Other pairs that do not both pass typeof value == 'object',\n // equivalence is determined by ==.\n } else if (!actual || !expected || typeof actual != 'object' && typeof expected != 'object') {\n return opts.strict ? actual === expected : actual == expected;\n\n // 7.4. For all other Object pairs, including Array objects, equivalence is\n // determined by having the same number of owned properties (as verified\n // with Object.prototype.hasOwnProperty.call), the same set of keys\n // (although not necessarily the same order), equivalent values for every\n // corresponding key, and an identical 'prototype' property. Note: this\n // accounts for both named and indexed properties on Arrays.\n } else {\n return objEquiv(actual, expected, opts);\n }\n}\n\nfunction isUndefinedOrNull(value) {\n return value === null || value === undefined;\n}\n\nfunction isBuffer (x) {\n if (!x || typeof x !== 'object' || typeof x.length !== 'number') return false;\n if (typeof x.copy !== 'function' || typeof x.slice !== 'function') {\n return false;\n }\n if (x.length > 0 && typeof x[0] !== 'number') return false;\n return true;\n}\n\nfunction objEquiv(a, b, opts) {\n var i, key;\n if (isUndefinedOrNull(a) || isUndefinedOrNull(b))\n return false;\n // an identical 'prototype' property.\n if (a.prototype !== b.prototype) return false;\n //~~~I've managed to break Object.keys through screwy arguments passing.\n // Converting to array solves the problem.\n if (isArguments(a)) {\n if (!isArguments(b)) {\n return false;\n }\n a = pSlice.call(a);\n b = pSlice.call(b);\n return deepEqual(a, b, opts);\n }\n if (isBuffer(a)) {\n if (!isBuffer(b)) {\n return false;\n }\n if (a.length !== b.length) return false;\n for (i = 0; i < a.length; i++) {\n if (a[i] !== b[i]) return false;\n }\n return true;\n }\n try {\n var ka = objectKeys(a),\n kb = objectKeys(b);\n } catch (e) {//happens when one is a string literal and the other isn't\n return false;\n }\n // having the same number of owned properties (keys incorporates\n // hasOwnProperty)\n if (ka.length != kb.length)\n return false;\n //the same set of keys (although not necessarily the same order),\n ka.sort();\n kb.sort();\n //~~~cheap key test\n for (i = ka.length - 1; i >= 0; i--) {\n if (ka[i] != kb[i])\n return false;\n }\n //equivalent values for every corresponding key, and\n //~~~possibly expensive deep test\n for (i = ka.length - 1; i >= 0; i--) {\n key = ka[i];\n if (!deepEqual(a[key], b[key], opts)) return false;\n }\n return typeof a === typeof b;\n}\n\n\n/***/ }),\n/* 12 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar Registry = __webpack_require__(1);\nvar Attributor = /** @class */ (function () {\n function Attributor(attrName, keyName, options) {\n if (options === void 0) { options = {}; }\n this.attrName = attrName;\n this.keyName = keyName;\n var attributeBit = Registry.Scope.TYPE & Registry.Scope.ATTRIBUTE;\n if (options.scope != null) {\n // Ignore type bits, force attribute bit\n this.scope = (options.scope & Registry.Scope.LEVEL) | attributeBit;\n }\n else {\n this.scope = Registry.Scope.ATTRIBUTE;\n }\n if (options.whitelist != null)\n this.whitelist = options.whitelist;\n }\n Attributor.keys = function (node) {\n return [].map.call(node.attributes, function (item) {\n return item.name;\n });\n };\n Attributor.prototype.add = function (node, value) {\n if (!this.canAdd(node, value))\n return false;\n node.setAttribute(this.keyName, value);\n return true;\n };\n Attributor.prototype.canAdd = function (node, value) {\n var match = Registry.query(node, Registry.Scope.BLOT & (this.scope | Registry.Scope.TYPE));\n if (match == null)\n return false;\n if (this.whitelist == null)\n return true;\n if (typeof value === 'string') {\n return this.whitelist.indexOf(value.replace(/[\"']/g, '')) > -1;\n }\n else {\n return this.whitelist.indexOf(value) > -1;\n }\n };\n Attributor.prototype.remove = function (node) {\n node.removeAttribute(this.keyName);\n };\n Attributor.prototype.value = function (node) {\n var value = node.getAttribute(this.keyName);\n if (this.canAdd(node, value) && value) {\n return value;\n }\n return '';\n };\n return Attributor;\n}());\nexports.default = Attributor;\n\n\n/***/ }),\n/* 13 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = exports.Code = undefined;\n\nvar _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_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\"]) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); } }; }();\n\nvar _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; }; }();\n\nvar _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if (\"value\" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };\n\nvar _quillDelta = __webpack_require__(2);\n\nvar _quillDelta2 = _interopRequireDefault(_quillDelta);\n\nvar _parchment = __webpack_require__(0);\n\nvar _parchment2 = _interopRequireDefault(_parchment);\n\nvar _block = __webpack_require__(4);\n\nvar _block2 = _interopRequireDefault(_block);\n\nvar _inline = __webpack_require__(6);\n\nvar _inline2 = _interopRequireDefault(_inline);\n\nvar _text = __webpack_require__(7);\n\nvar _text2 = _interopRequireDefault(_text);\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 _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nvar Code = function (_Inline) {\n _inherits(Code, _Inline);\n\n function Code() {\n _classCallCheck(this, Code);\n\n return _possibleConstructorReturn(this, (Code.__proto__ || Object.getPrototypeOf(Code)).apply(this, arguments));\n }\n\n return Code;\n}(_inline2.default);\n\nCode.blotName = 'code';\nCode.tagName = 'CODE';\n\nvar CodeBlock = function (_Block) {\n _inherits(CodeBlock, _Block);\n\n function CodeBlock() {\n _classCallCheck(this, CodeBlock);\n\n return _possibleConstructorReturn(this, (CodeBlock.__proto__ || Object.getPrototypeOf(CodeBlock)).apply(this, arguments));\n }\n\n _createClass(CodeBlock, [{\n key: 'delta',\n value: function delta() {\n var _this3 = this;\n\n var text = this.domNode.textContent;\n if (text.endsWith('\\n')) {\n // Should always be true\n text = text.slice(0, -1);\n }\n return text.split('\\n').reduce(function (delta, frag) {\n return delta.insert(frag).insert('\\n', _this3.formats());\n }, new _quillDelta2.default());\n }\n }, {\n key: 'format',\n value: function format(name, value) {\n if (name === this.statics.blotName && value) return;\n\n var _descendant = this.descendant(_text2.default, this.length() - 1),\n _descendant2 = _slicedToArray(_descendant, 1),\n text = _descendant2[0];\n\n if (text != null) {\n text.deleteAt(text.length() - 1, 1);\n }\n _get(CodeBlock.prototype.__proto__ || Object.getPrototypeOf(CodeBlock.prototype), 'format', this).call(this, name, value);\n }\n }, {\n key: 'formatAt',\n value: function formatAt(index, length, name, value) {\n if (length === 0) return;\n if (_parchment2.default.query(name, _parchment2.default.Scope.BLOCK) == null || name === this.statics.blotName && value === this.statics.formats(this.domNode)) {\n return;\n }\n var nextNewline = this.newlineIndex(index);\n if (nextNewline < 0 || nextNewline >= index + length) return;\n var prevNewline = this.newlineIndex(index, true) + 1;\n var isolateLength = nextNewline - prevNewline + 1;\n var blot = this.isolate(prevNewline, isolateLength);\n var next = blot.next;\n blot.format(name, value);\n if (next instanceof CodeBlock) {\n next.formatAt(0, index - prevNewline + length - isolateLength, name, value);\n }\n }\n }, {\n key: 'insertAt',\n value: function insertAt(index, value, def) {\n if (def != null) return;\n\n var _descendant3 = this.descendant(_text2.default, index),\n _descendant4 = _slicedToArray(_descendant3, 2),\n text = _descendant4[0],\n offset = _descendant4[1];\n\n text.insertAt(offset, value);\n }\n }, {\n key: 'length',\n value: function length() {\n var length = this.domNode.textContent.length;\n if (!this.domNode.textContent.endsWith('\\n')) {\n return length + 1;\n }\n return length;\n }\n }, {\n key: 'newlineIndex',\n value: function newlineIndex(searchIndex) {\n var reverse = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n\n if (!reverse) {\n var offset = this.domNode.textContent.slice(searchIndex).indexOf('\\n');\n return offset > -1 ? searchIndex + offset : -1;\n } else {\n return this.domNode.textContent.slice(0, searchIndex).lastIndexOf('\\n');\n }\n }\n }, {\n key: 'optimize',\n value: function optimize(context) {\n if (!this.domNode.textContent.endsWith('\\n')) {\n this.appendChild(_parchment2.default.create('text', '\\n'));\n }\n _get(CodeBlock.prototype.__proto__ || Object.getPrototypeOf(CodeBlock.prototype), 'optimize', this).call(this, context);\n var next = this.next;\n if (next != null && next.prev === this && next.statics.blotName === this.statics.blotName && this.statics.formats(this.domNode) === next.statics.formats(next.domNode)) {\n next.optimize(context);\n next.moveChildren(this);\n next.remove();\n }\n }\n }, {\n key: 'replace',\n value: function replace(target) {\n _get(CodeBlock.prototype.__proto__ || Object.getPrototypeOf(CodeBlock.prototype), 'replace', this).call(this, target);\n [].slice.call(this.domNode.querySelectorAll('*')).forEach(function (node) {\n var blot = _parchment2.default.find(node);\n if (blot == null) {\n node.parentNode.removeChild(node);\n } else if (blot instanceof _parchment2.default.Embed) {\n blot.remove();\n } else {\n blot.unwrap();\n }\n });\n }\n }], [{\n key: 'create',\n value: function create(value) {\n var domNode = _get(CodeBlock.__proto__ || Object.getPrototypeOf(CodeBlock), 'create', this).call(this, value);\n domNode.setAttribute('spellcheck', false);\n return domNode;\n }\n }, {\n key: 'formats',\n value: function formats() {\n return true;\n }\n }]);\n\n return CodeBlock;\n}(_block2.default);\n\nCodeBlock.blotName = 'code-block';\nCodeBlock.tagName = 'PRE';\nCodeBlock.TAB = ' ';\n\nexports.Code = Code;\nexports.default = CodeBlock;\n\n/***/ }),\n/* 14 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _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; };\n\nvar _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_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\"]) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); } }; }();\n\nvar _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; }; }();\n\nvar _quillDelta = __webpack_require__(2);\n\nvar _quillDelta2 = _interopRequireDefault(_quillDelta);\n\nvar _op = __webpack_require__(20);\n\nvar _op2 = _interopRequireDefault(_op);\n\nvar _parchment = __webpack_require__(0);\n\nvar _parchment2 = _interopRequireDefault(_parchment);\n\nvar _code = __webpack_require__(13);\n\nvar _code2 = _interopRequireDefault(_code);\n\nvar _cursor = __webpack_require__(24);\n\nvar _cursor2 = _interopRequireDefault(_cursor);\n\nvar _block = __webpack_require__(4);\n\nvar _block2 = _interopRequireDefault(_block);\n\nvar _break = __webpack_require__(16);\n\nvar _break2 = _interopRequireDefault(_break);\n\nvar _clone = __webpack_require__(21);\n\nvar _clone2 = _interopRequireDefault(_clone);\n\nvar _deepEqual = __webpack_require__(11);\n\nvar _deepEqual2 = _interopRequireDefault(_deepEqual);\n\nvar _extend = __webpack_require__(3);\n\nvar _extend2 = _interopRequireDefault(_extend);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\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 _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nvar ASCII = /^[ -~]*$/;\n\nvar Editor = function () {\n function Editor(scroll) {\n _classCallCheck(this, Editor);\n\n this.scroll = scroll;\n this.delta = this.getDelta();\n }\n\n _createClass(Editor, [{\n key: 'applyDelta',\n value: function applyDelta(delta) {\n var _this = this;\n\n var consumeNextNewline = false;\n this.scroll.update();\n var scrollLength = this.scroll.length();\n this.scroll.batchStart();\n delta = normalizeDelta(delta);\n delta.reduce(function (index, op) {\n var length = op.retain || op.delete || op.insert.length || 1;\n var attributes = op.attributes || {};\n if (op.insert != null) {\n if (typeof op.insert === 'string') {\n var text = op.insert;\n if (text.endsWith('\\n') && consumeNextNewline) {\n consumeNextNewline = false;\n text = text.slice(0, -1);\n }\n if (index >= scrollLength && !text.endsWith('\\n')) {\n consumeNextNewline = true;\n }\n _this.scroll.insertAt(index, text);\n\n var _scroll$line = _this.scroll.line(index),\n _scroll$line2 = _slicedToArray(_scroll$line, 2),\n line = _scroll$line2[0],\n offset = _scroll$line2[1];\n\n var formats = (0, _extend2.default)({}, (0, _block.bubbleFormats)(line));\n if (line instanceof _block2.default) {\n var _line$descendant = line.descendant(_parchment2.default.Leaf, offset),\n _line$descendant2 = _slicedToArray(_line$descendant, 1),\n leaf = _line$descendant2[0];\n\n formats = (0, _extend2.default)(formats, (0, _block.bubbleFormats)(leaf));\n }\n attributes = _op2.default.attributes.diff(formats, attributes) || {};\n } else if (_typeof(op.insert) === 'object') {\n var key = Object.keys(op.insert)[0]; // There should only be one key\n if (key == null) return index;\n _this.scroll.insertAt(index, key, op.insert[key]);\n }\n scrollLength += length;\n }\n Object.keys(attributes).forEach(function (name) {\n _this.scroll.formatAt(index, length, name, attributes[name]);\n });\n return index + length;\n }, 0);\n delta.reduce(function (index, op) {\n if (typeof op.delete === 'number') {\n _this.scroll.deleteAt(index, op.delete);\n return index;\n }\n return index + (op.retain || op.insert.length || 1);\n }, 0);\n this.scroll.batchEnd();\n return this.update(delta);\n }\n }, {\n key: 'deleteText',\n value: function deleteText(index, length) {\n this.scroll.deleteAt(index, length);\n return this.update(new _quillDelta2.default().retain(index).delete(length));\n }\n }, {\n key: 'formatLine',\n value: function formatLine(index, length) {\n var _this2 = this;\n\n var formats = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n\n this.scroll.update();\n Object.keys(formats).forEach(function (format) {\n if (_this2.scroll.whitelist != null && !_this2.scroll.whitelist[format]) return;\n var lines = _this2.scroll.lines(index, Math.max(length, 1));\n var lengthRemaining = length;\n lines.forEach(function (line) {\n var lineLength = line.length();\n if (!(line instanceof _code2.default)) {\n line.format(format, formats[format]);\n } else {\n var codeIndex = index - line.offset(_this2.scroll);\n var codeLength = line.newlineIndex(codeIndex + lengthRemaining) - codeIndex + 1;\n line.formatAt(codeIndex, codeLength, format, formats[format]);\n }\n lengthRemaining -= lineLength;\n });\n });\n this.scroll.optimize();\n return this.update(new _quillDelta2.default().retain(index).retain(length, (0, _clone2.default)(formats)));\n }\n }, {\n key: 'formatText',\n value: function formatText(index, length) {\n var _this3 = this;\n\n var formats = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n\n Object.keys(formats).forEach(function (format) {\n _this3.scroll.formatAt(index, length, format, formats[format]);\n });\n return this.update(new _quillDelta2.default().retain(index).retain(length, (0, _clone2.default)(formats)));\n }\n }, {\n key: 'getContents',\n value: function getContents(index, length) {\n return this.delta.slice(index, index + length);\n }\n }, {\n key: 'getDelta',\n value: function getDelta() {\n return this.scroll.lines().reduce(function (delta, line) {\n return delta.concat(line.delta());\n }, new _quillDelta2.default());\n }\n }, {\n key: 'getFormat',\n value: function getFormat(index) {\n var length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n\n var lines = [],\n leaves = [];\n if (length === 0) {\n this.scroll.path(index).forEach(function (path) {\n var _path = _slicedToArray(path, 1),\n blot = _path[0];\n\n if (blot instanceof _block2.default) {\n lines.push(blot);\n } else if (blot instanceof _parchment2.default.Leaf) {\n leaves.push(blot);\n }\n });\n } else {\n lines = this.scroll.lines(index, length);\n leaves = this.scroll.descendants(_parchment2.default.Leaf, index, length);\n }\n var formatsArr = [lines, leaves].map(function (blots) {\n if (blots.length === 0) return {};\n var formats = (0, _block.bubbleFormats)(blots.shift());\n while (Object.keys(formats).length > 0) {\n var blot = blots.shift();\n if (blot == null) return formats;\n formats = combineFormats((0, _block.bubbleFormats)(blot), formats);\n }\n return formats;\n });\n return _extend2.default.apply(_extend2.default, formatsArr);\n }\n }, {\n key: 'getText',\n value: function getText(index, length) {\n return this.getContents(index, length).filter(function (op) {\n return typeof op.insert === 'string';\n }).map(function (op) {\n return op.insert;\n }).join('');\n }\n }, {\n key: 'insertEmbed',\n value: function insertEmbed(index, embed, value) {\n this.scroll.insertAt(index, embed, value);\n return this.update(new _quillDelta2.default().retain(index).insert(_defineProperty({}, embed, value)));\n }\n }, {\n key: 'insertText',\n value: function insertText(index, text) {\n var _this4 = this;\n\n var formats = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n\n text = text.replace(/\\r\\n/g, '\\n').replace(/\\r/g, '\\n');\n this.scroll.insertAt(index, text);\n Object.keys(formats).forEach(function (format) {\n _this4.scroll.formatAt(index, text.length, format, formats[format]);\n });\n return this.update(new _quillDelta2.default().retain(index).insert(text, (0, _clone2.default)(formats)));\n }\n }, {\n key: 'isBlank',\n value: function isBlank() {\n if (this.scroll.children.length == 0) return true;\n if (this.scroll.children.length > 1) return false;\n var block = this.scroll.children.head;\n if (block.statics.blotName !== _block2.default.blotName) return false;\n if (block.children.length > 1) return false;\n return block.children.head instanceof _break2.default;\n }\n }, {\n key: 'removeFormat',\n value: function removeFormat(index, length) {\n var text = this.getText(index, length);\n\n var _scroll$line3 = this.scroll.line(index + length),\n _scroll$line4 = _slicedToArray(_scroll$line3, 2),\n line = _scroll$line4[0],\n offset = _scroll$line4[1];\n\n var suffixLength = 0,\n suffix = new _quillDelta2.default();\n if (line != null) {\n if (!(line instanceof _code2.default)) {\n suffixLength = line.length() - offset;\n } else {\n suffixLength = line.newlineIndex(offset) - offset + 1;\n }\n suffix = line.delta().slice(offset, offset + suffixLength - 1).insert('\\n');\n }\n var contents = this.getContents(index, length + suffixLength);\n var diff = contents.diff(new _quillDelta2.default().insert(text).concat(suffix));\n var delta = new _quillDelta2.default().retain(index).concat(diff);\n return this.applyDelta(delta);\n }\n }, {\n key: 'update',\n value: function update(change) {\n var mutations = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];\n var cursorIndex = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined;\n\n var oldDelta = this.delta;\n if (mutations.length === 1 && mutations[0].type === 'characterData' && mutations[0].target.data.match(ASCII) && _parchment2.default.find(mutations[0].target)) {\n // Optimization for character changes\n var textBlot = _parchment2.default.find(mutations[0].target);\n var formats = (0, _block.bubbleFormats)(textBlot);\n var index = textBlot.offset(this.scroll);\n var oldValue = mutations[0].oldValue.replace(_cursor2.default.CONTENTS, '');\n var oldText = new _quillDelta2.default().insert(oldValue);\n var newText = new _quillDelta2.default().insert(textBlot.value());\n var diffDelta = new _quillDelta2.default().retain(index).concat(oldText.diff(newText, cursorIndex));\n change = diffDelta.reduce(function (delta, op) {\n if (op.insert) {\n return delta.insert(op.insert, formats);\n } else {\n return delta.push(op);\n }\n }, new _quillDelta2.default());\n this.delta = oldDelta.compose(change);\n } else {\n this.delta = this.getDelta();\n if (!change || !(0, _deepEqual2.default)(oldDelta.compose(change), this.delta)) {\n change = oldDelta.diff(this.delta, cursorIndex);\n }\n }\n return change;\n }\n }]);\n\n return Editor;\n}();\n\nfunction combineFormats(formats, combined) {\n return Object.keys(combined).reduce(function (merged, name) {\n if (formats[name] == null) return merged;\n if (combined[name] === formats[name]) {\n merged[name] = combined[name];\n } else if (Array.isArray(combined[name])) {\n if (combined[name].indexOf(formats[name]) < 0) {\n merged[name] = combined[name].concat([formats[name]]);\n }\n } else {\n merged[name] = [combined[name], formats[name]];\n }\n return merged;\n }, {});\n}\n\nfunction normalizeDelta(delta) {\n return delta.reduce(function (delta, op) {\n if (op.insert === 1) {\n var attributes = (0, _clone2.default)(op.attributes);\n delete attributes['image'];\n return delta.insert({ image: op.attributes.image }, attributes);\n }\n if (op.attributes != null && (op.attributes.list === true || op.attributes.bullet === true)) {\n op = (0, _clone2.default)(op);\n if (op.attributes.list) {\n op.attributes.list = 'ordered';\n } else {\n op.attributes.list = 'bullet';\n delete op.attributes.bullet;\n }\n }\n if (typeof op.insert === 'string') {\n var text = op.insert.replace(/\\r\\n/g, '\\n').replace(/\\r/g, '\\n');\n return delta.insert(text, op.attributes);\n }\n return delta.push(op);\n }, new _quillDelta2.default());\n}\n\nexports.default = Editor;\n\n/***/ }),\n/* 15 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = exports.Range = undefined;\n\nvar _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_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\"]) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); } }; }();\n\nvar _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; }; }();\n\nvar _parchment = __webpack_require__(0);\n\nvar _parchment2 = _interopRequireDefault(_parchment);\n\nvar _clone = __webpack_require__(21);\n\nvar _clone2 = _interopRequireDefault(_clone);\n\nvar _deepEqual = __webpack_require__(11);\n\nvar _deepEqual2 = _interopRequireDefault(_deepEqual);\n\nvar _emitter3 = __webpack_require__(8);\n\nvar _emitter4 = _interopRequireDefault(_emitter3);\n\nvar _logger = __webpack_require__(10);\n\nvar _logger2 = _interopRequireDefault(_logger);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nvar debug = (0, _logger2.default)('quill:selection');\n\nvar Range = function Range(index) {\n var length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n\n _classCallCheck(this, Range);\n\n this.index = index;\n this.length = length;\n};\n\nvar Selection = function () {\n function Selection(scroll, emitter) {\n var _this = this;\n\n _classCallCheck(this, Selection);\n\n this.emitter = emitter;\n this.scroll = scroll;\n this.composing = false;\n this.mouseDown = false;\n this.root = this.scroll.domNode;\n this.cursor = _parchment2.default.create('cursor', this);\n // savedRange is last non-null range\n this.lastRange = this.savedRange = new Range(0, 0);\n this.handleComposition();\n this.handleDragging();\n this.emitter.listenDOM('selectionchange', document, function () {\n if (!_this.mouseDown) {\n setTimeout(_this.update.bind(_this, _emitter4.default.sources.USER), 1);\n }\n });\n this.emitter.on(_emitter4.default.events.EDITOR_CHANGE, function (type, delta) {\n if (type === _emitter4.default.events.TEXT_CHANGE && delta.length() > 0) {\n _this.update(_emitter4.default.sources.SILENT);\n }\n });\n this.emitter.on(_emitter4.default.events.SCROLL_BEFORE_UPDATE, function () {\n if (!_this.hasFocus()) return;\n var native = _this.getNativeRange();\n if (native == null) return;\n if (native.start.node === _this.cursor.textNode) return; // cursor.restore() will handle\n // TODO unclear if this has negative side effects\n _this.emitter.once(_emitter4.default.events.SCROLL_UPDATE, function () {\n try {\n _this.setNativeRange(native.start.node, native.start.offset, native.end.node, native.end.offset);\n } catch (ignored) {}\n });\n });\n this.emitter.on(_emitter4.default.events.SCROLL_OPTIMIZE, function (mutations, context) {\n if (context.range) {\n var _context$range = context.range,\n startNode = _context$range.startNode,\n startOffset = _context$range.startOffset,\n endNode = _context$range.endNode,\n endOffset = _context$range.endOffset;\n\n _this.setNativeRange(startNode, startOffset, endNode, endOffset);\n }\n });\n this.update(_emitter4.default.sources.SILENT);\n }\n\n _createClass(Selection, [{\n key: 'handleComposition',\n value: function handleComposition() {\n var _this2 = this;\n\n this.root.addEventListener('compositionstart', function () {\n _this2.composing = true;\n });\n this.root.addEventListener('compositionend', function () {\n _this2.composing = false;\n if (_this2.cursor.parent) {\n var range = _this2.cursor.restore();\n if (!range) return;\n setTimeout(function () {\n _this2.setNativeRange(range.startNode, range.startOffset, range.endNode, range.endOffset);\n }, 1);\n }\n });\n }\n }, {\n key: 'handleDragging',\n value: function handleDragging() {\n var _this3 = this;\n\n this.emitter.listenDOM('mousedown', document.body, function () {\n _this3.mouseDown = true;\n });\n this.emitter.listenDOM('mouseup', document.body, function () {\n _this3.mouseDown = false;\n _this3.update(_emitter4.default.sources.USER);\n });\n }\n }, {\n key: 'focus',\n value: function focus() {\n if (this.hasFocus()) return;\n this.root.focus();\n this.setRange(this.savedRange);\n }\n }, {\n key: 'format',\n value: function format(_format, value) {\n if (this.scroll.whitelist != null && !this.scroll.whitelist[_format]) return;\n this.scroll.update();\n var nativeRange = this.getNativeRange();\n if (nativeRange == null || !nativeRange.native.collapsed || _parchment2.default.query(_format, _parchment2.default.Scope.BLOCK)) return;\n if (nativeRange.start.node !== this.cursor.textNode) {\n var blot = _parchment2.default.find(nativeRange.start.node, false);\n if (blot == null) return;\n // TODO Give blot ability to not split\n if (blot instanceof _parchment2.default.Leaf) {\n var after = blot.split(nativeRange.start.offset);\n blot.parent.insertBefore(this.cursor, after);\n } else {\n blot.insertBefore(this.cursor, nativeRange.start.node); // Should never happen\n }\n this.cursor.attach();\n }\n this.cursor.format(_format, value);\n this.scroll.optimize();\n this.setNativeRange(this.cursor.textNode, this.cursor.textNode.data.length);\n this.update();\n }\n }, {\n key: 'getBounds',\n value: function getBounds(index) {\n var length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n\n var scrollLength = this.scroll.length();\n index = Math.min(index, scrollLength - 1);\n length = Math.min(index + length, scrollLength - 1) - index;\n var node = void 0,\n _scroll$leaf = this.scroll.leaf(index),\n _scroll$leaf2 = _slicedToArray(_scroll$leaf, 2),\n leaf = _scroll$leaf2[0],\n offset = _scroll$leaf2[1];\n if (leaf == null) return null;\n\n var _leaf$position = leaf.position(offset, true);\n\n var _leaf$position2 = _slicedToArray(_leaf$position, 2);\n\n node = _leaf$position2[0];\n offset = _leaf$position2[1];\n\n var range = document.createRange();\n if (length > 0) {\n range.setStart(node, offset);\n\n var _scroll$leaf3 = this.scroll.leaf(index + length);\n\n var _scroll$leaf4 = _slicedToArray(_scroll$leaf3, 2);\n\n leaf = _scroll$leaf4[0];\n offset = _scroll$leaf4[1];\n\n if (leaf == null) return null;\n\n var _leaf$position3 = leaf.position(offset, true);\n\n var _leaf$position4 = _slicedToArray(_leaf$position3, 2);\n\n node = _leaf$position4[0];\n offset = _leaf$position4[1];\n\n range.setEnd(node, offset);\n return range.getBoundingClientRect();\n } else {\n var side = 'left';\n var rect = void 0;\n if (node instanceof Text) {\n if (offset < node.data.length) {\n range.setStart(node, offset);\n range.setEnd(node, offset + 1);\n } else {\n range.setStart(node, offset - 1);\n range.setEnd(node, offset);\n side = 'right';\n }\n rect = range.getBoundingClientRect();\n } else {\n rect = leaf.domNode.getBoundingClientRect();\n if (offset > 0) side = 'right';\n }\n return {\n bottom: rect.top + rect.height,\n height: rect.height,\n left: rect[side],\n right: rect[side],\n top: rect.top,\n width: 0\n };\n }\n }\n }, {\n key: 'getNativeRange',\n value: function getNativeRange() {\n var selection = document.getSelection();\n if (selection == null || selection.rangeCount <= 0) return null;\n var nativeRange = selection.getRangeAt(0);\n if (nativeRange == null) return null;\n var range = this.normalizeNative(nativeRange);\n debug.info('getNativeRange', range);\n return range;\n }\n }, {\n key: 'getRange',\n value: function getRange() {\n var normalized = this.getNativeRange();\n if (normalized == null) return [null, null];\n var range = this.normalizedToRange(normalized);\n return [range, normalized];\n }\n }, {\n key: 'hasFocus',\n value: function hasFocus() {\n return document.activeElement === this.root;\n }\n }, {\n key: 'normalizedToRange',\n value: function normalizedToRange(range) {\n var _this4 = this;\n\n var positions = [[range.start.node, range.start.offset]];\n if (!range.native.collapsed) {\n positions.push([range.end.node, range.end.offset]);\n }\n var indexes = positions.map(function (position) {\n var _position = _slicedToArray(position, 2),\n node = _position[0],\n offset = _position[1];\n\n var blot = _parchment2.default.find(node, true);\n var index = blot.offset(_this4.scroll);\n if (offset === 0) {\n return index;\n } else if (blot instanceof _parchment2.default.Container) {\n return index + blot.length();\n } else {\n return index + blot.index(node, offset);\n }\n });\n var end = Math.min(Math.max.apply(Math, _toConsumableArray(indexes)), this.scroll.length() - 1);\n var start = Math.min.apply(Math, [end].concat(_toConsumableArray(indexes)));\n return new Range(start, end - start);\n }\n }, {\n key: 'normalizeNative',\n value: function normalizeNative(nativeRange) {\n if (!contains(this.root, nativeRange.startContainer) || !nativeRange.collapsed && !contains(this.root, nativeRange.endContainer)) {\n return null;\n }\n var range = {\n start: { node: nativeRange.startContainer, offset: nativeRange.startOffset },\n end: { node: nativeRange.endContainer, offset: nativeRange.endOffset },\n native: nativeRange\n };\n [range.start, range.end].forEach(function (position) {\n var node = position.node,\n offset = position.offset;\n while (!(node instanceof Text) && node.childNodes.length > 0) {\n if (node.childNodes.length > offset) {\n node = node.childNodes[offset];\n offset = 0;\n } else if (node.childNodes.length === offset) {\n node = node.lastChild;\n offset = node instanceof Text ? node.data.length : node.childNodes.length + 1;\n } else {\n break;\n }\n }\n position.node = node, position.offset = offset;\n });\n return range;\n }\n }, {\n key: 'rangeToNative',\n value: function rangeToNative(range) {\n var _this5 = this;\n\n var indexes = range.collapsed ? [range.index] : [range.index, range.index + range.length];\n var args = [];\n var scrollLength = this.scroll.length();\n indexes.forEach(function (index, i) {\n index = Math.min(scrollLength - 1, index);\n var node = void 0,\n _scroll$leaf5 = _this5.scroll.leaf(index),\n _scroll$leaf6 = _slicedToArray(_scroll$leaf5, 2),\n leaf = _scroll$leaf6[0],\n offset = _scroll$leaf6[1];\n var _leaf$position5 = leaf.position(offset, i !== 0);\n\n var _leaf$position6 = _slicedToArray(_leaf$position5, 2);\n\n node = _leaf$position6[0];\n offset = _leaf$position6[1];\n\n args.push(node, offset);\n });\n if (args.length < 2) {\n args = args.concat(args);\n }\n return args;\n }\n }, {\n key: 'scrollIntoView',\n value: function scrollIntoView(scrollingContainer) {\n var range = this.lastRange;\n if (range == null) return;\n var bounds = this.getBounds(range.index, range.length);\n if (bounds == null) return;\n var limit = this.scroll.length() - 1;\n\n var _scroll$line = this.scroll.line(Math.min(range.index, limit)),\n _scroll$line2 = _slicedToArray(_scroll$line, 1),\n first = _scroll$line2[0];\n\n var last = first;\n if (range.length > 0) {\n var _scroll$line3 = this.scroll.line(Math.min(range.index + range.length, limit));\n\n var _scroll$line4 = _slicedToArray(_scroll$line3, 1);\n\n last = _scroll$line4[0];\n }\n if (first == null || last == null) return;\n var scrollBounds = scrollingContainer.getBoundingClientRect();\n if (bounds.top < scrollBounds.top) {\n scrollingContainer.scrollTop -= scrollBounds.top - bounds.top;\n } else if (bounds.bottom > scrollBounds.bottom) {\n scrollingContainer.scrollTop += bounds.bottom - scrollBounds.bottom;\n }\n }\n }, {\n key: 'setNativeRange',\n value: function setNativeRange(startNode, startOffset) {\n var endNode = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : startNode;\n var endOffset = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : startOffset;\n var force = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;\n\n debug.info('setNativeRange', startNode, startOffset, endNode, endOffset);\n if (startNode != null && (this.root.parentNode == null || startNode.parentNode == null || endNode.parentNode == null)) {\n return;\n }\n var selection = document.getSelection();\n if (selection == null) return;\n if (startNode != null) {\n if (!this.hasFocus()) this.root.focus();\n var native = (this.getNativeRange() || {}).native;\n if (native == null || force || startNode !== native.startContainer || startOffset !== native.startOffset || endNode !== native.endContainer || endOffset !== native.endOffset) {\n\n if (startNode.tagName == \"BR\") {\n startOffset = [].indexOf.call(startNode.parentNode.childNodes, startNode);\n startNode = startNode.parentNode;\n }\n if (endNode.tagName == \"BR\") {\n endOffset = [].indexOf.call(endNode.parentNode.childNodes, endNode);\n endNode = endNode.parentNode;\n }\n var range = document.createRange();\n range.setStart(startNode, startOffset);\n range.setEnd(endNode, endOffset);\n selection.removeAllRanges();\n selection.addRange(range);\n }\n } else {\n selection.removeAllRanges();\n this.root.blur();\n document.body.focus(); // root.blur() not enough on IE11+Travis+SauceLabs (but not local VMs)\n }\n }\n }, {\n key: 'setRange',\n value: function setRange(range) {\n var force = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n var source = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _emitter4.default.sources.API;\n\n if (typeof force === 'string') {\n source = force;\n force = false;\n }\n debug.info('setRange', range);\n if (range != null) {\n var args = this.rangeToNative(range);\n this.setNativeRange.apply(this, _toConsumableArray(args).concat([force]));\n } else {\n this.setNativeRange(null);\n }\n this.update(source);\n }\n }, {\n key: 'update',\n value: function update() {\n var source = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _emitter4.default.sources.USER;\n\n var oldRange = this.lastRange;\n\n var _getRange = this.getRange(),\n _getRange2 = _slicedToArray(_getRange, 2),\n lastRange = _getRange2[0],\n nativeRange = _getRange2[1];\n\n this.lastRange = lastRange;\n if (this.lastRange != null) {\n this.savedRange = this.lastRange;\n }\n if (!(0, _deepEqual2.default)(oldRange, this.lastRange)) {\n var _emitter;\n\n if (!this.composing && nativeRange != null && nativeRange.native.collapsed && nativeRange.start.node !== this.cursor.textNode) {\n this.cursor.restore();\n }\n var args = [_emitter4.default.events.SELECTION_CHANGE, (0, _clone2.default)(this.lastRange), (0, _clone2.default)(oldRange), source];\n (_emitter = this.emitter).emit.apply(_emitter, [_emitter4.default.events.EDITOR_CHANGE].concat(args));\n if (source !== _emitter4.default.sources.SILENT) {\n var _emitter2;\n\n (_emitter2 = this.emitter).emit.apply(_emitter2, args);\n }\n }\n }\n }]);\n\n return Selection;\n}();\n\nfunction contains(parent, descendant) {\n try {\n // Firefox inserts inaccessible nodes around video elements\n descendant.parentNode;\n } catch (e) {\n return false;\n }\n // IE11 has bug with Text nodes\n // https://connect.microsoft.com/IE/feedback/details/780874/node-contains-is-incorrect\n if (descendant instanceof Text) {\n descendant = descendant.parentNode;\n }\n return parent.contains(descendant);\n}\n\nexports.Range = Range;\nexports.default = Selection;\n\n/***/ }),\n/* 16 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _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; }; }();\n\nvar _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if (\"value\" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };\n\nvar _parchment = __webpack_require__(0);\n\nvar _parchment2 = _interopRequireDefault(_parchment);\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 _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nvar Break = function (_Parchment$Embed) {\n _inherits(Break, _Parchment$Embed);\n\n function Break() {\n _classCallCheck(this, Break);\n\n return _possibleConstructorReturn(this, (Break.__proto__ || Object.getPrototypeOf(Break)).apply(this, arguments));\n }\n\n _createClass(Break, [{\n key: 'insertInto',\n value: function insertInto(parent, ref) {\n if (parent.children.length === 0) {\n _get(Break.prototype.__proto__ || Object.getPrototypeOf(Break.prototype), 'insertInto', this).call(this, parent, ref);\n } else {\n this.remove();\n }\n }\n }, {\n key: 'length',\n value: function length() {\n return 0;\n }\n }, {\n key: 'value',\n value: function value() {\n return '';\n }\n }], [{\n key: 'value',\n value: function value() {\n return undefined;\n }\n }]);\n\n return Break;\n}(_parchment2.default.Embed);\n\nBreak.blotName = 'break';\nBreak.tagName = 'BR';\n\nexports.default = Break;\n\n/***/ }),\n/* 17 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar linked_list_1 = __webpack_require__(44);\nvar shadow_1 = __webpack_require__(30);\nvar Registry = __webpack_require__(1);\nvar ContainerBlot = /** @class */ (function (_super) {\n __extends(ContainerBlot, _super);\n function ContainerBlot(domNode) {\n var _this = _super.call(this, domNode) || this;\n _this.build();\n return _this;\n }\n ContainerBlot.prototype.appendChild = function (other) {\n this.insertBefore(other);\n };\n ContainerBlot.prototype.attach = function () {\n _super.prototype.attach.call(this);\n this.children.forEach(function (child) {\n child.attach();\n });\n };\n ContainerBlot.prototype.build = function () {\n var _this = this;\n this.children = new linked_list_1.default();\n // Need to be reversed for if DOM nodes already in order\n [].slice\n .call(this.domNode.childNodes)\n .reverse()\n .forEach(function (node) {\n try {\n var child = makeBlot(node);\n _this.insertBefore(child, _this.children.head || undefined);\n }\n catch (err) {\n if (err instanceof Registry.ParchmentError)\n return;\n else\n throw err;\n }\n });\n };\n ContainerBlot.prototype.deleteAt = function (index, length) {\n if (index === 0 && length === this.length()) {\n return this.remove();\n }\n this.children.forEachAt(index, length, function (child, offset, length) {\n child.deleteAt(offset, length);\n });\n };\n ContainerBlot.prototype.descendant = function (criteria, index) {\n var _a = this.children.find(index), child = _a[0], offset = _a[1];\n if ((criteria.blotName == null && criteria(child)) ||\n (criteria.blotName != null && child instanceof criteria)) {\n return [child, offset];\n }\n else if (child instanceof ContainerBlot) {\n return child.descendant(criteria, offset);\n }\n else {\n return [null, -1];\n }\n };\n ContainerBlot.prototype.descendants = function (criteria, index, length) {\n if (index === void 0) { index = 0; }\n if (length === void 0) { length = Number.MAX_VALUE; }\n var descendants = [];\n var lengthLeft = length;\n this.children.forEachAt(index, length, function (child, index, length) {\n if ((criteria.blotName == null && criteria(child)) ||\n (criteria.blotName != null && child instanceof criteria)) {\n descendants.push(child);\n }\n if (child instanceof ContainerBlot) {\n descendants = descendants.concat(child.descendants(criteria, index, lengthLeft));\n }\n lengthLeft -= length;\n });\n return descendants;\n };\n ContainerBlot.prototype.detach = function () {\n this.children.forEach(function (child) {\n child.detach();\n });\n _super.prototype.detach.call(this);\n };\n ContainerBlot.prototype.formatAt = function (index, length, name, value) {\n this.children.forEachAt(index, length, function (child, offset, length) {\n child.formatAt(offset, length, name, value);\n });\n };\n ContainerBlot.prototype.insertAt = function (index, value, def) {\n var _a = this.children.find(index), child = _a[0], offset = _a[1];\n if (child) {\n child.insertAt(offset, value, def);\n }\n else {\n var blot = def == null ? Registry.create('text', value) : Registry.create(value, def);\n this.appendChild(blot);\n }\n };\n ContainerBlot.prototype.insertBefore = function (childBlot, refBlot) {\n if (this.statics.allowedChildren != null &&\n !this.statics.allowedChildren.some(function (child) {\n return childBlot instanceof child;\n })) {\n throw new Registry.ParchmentError(\"Cannot insert \" + childBlot.statics.blotName + \" into \" + this.statics.blotName);\n }\n childBlot.insertInto(this, refBlot);\n };\n ContainerBlot.prototype.length = function () {\n return this.children.reduce(function (memo, child) {\n return memo + child.length();\n }, 0);\n };\n ContainerBlot.prototype.moveChildren = function (targetParent, refNode) {\n this.children.forEach(function (child) {\n targetParent.insertBefore(child, refNode);\n });\n };\n ContainerBlot.prototype.optimize = function (context) {\n _super.prototype.optimize.call(this, context);\n if (this.children.length === 0) {\n if (this.statics.defaultChild != null) {\n var child = Registry.create(this.statics.defaultChild);\n this.appendChild(child);\n child.optimize(context);\n }\n else {\n this.remove();\n }\n }\n };\n ContainerBlot.prototype.path = function (index, inclusive) {\n if (inclusive === void 0) { inclusive = false; }\n var _a = this.children.find(index, inclusive), child = _a[0], offset = _a[1];\n var position = [[this, index]];\n if (child instanceof ContainerBlot) {\n return position.concat(child.path(offset, inclusive));\n }\n else if (child != null) {\n position.push([child, offset]);\n }\n return position;\n };\n ContainerBlot.prototype.removeChild = function (child) {\n this.children.remove(child);\n };\n ContainerBlot.prototype.replace = function (target) {\n if (target instanceof ContainerBlot) {\n target.moveChildren(this);\n }\n _super.prototype.replace.call(this, target);\n };\n ContainerBlot.prototype.split = function (index, force) {\n if (force === void 0) { force = false; }\n if (!force) {\n if (index === 0)\n return this;\n if (index === this.length())\n return this.next;\n }\n var after = this.clone();\n this.parent.insertBefore(after, this.next);\n this.children.forEachAt(index, this.length(), function (child, offset, length) {\n child = child.split(offset, force);\n after.appendChild(child);\n });\n return after;\n };\n ContainerBlot.prototype.unwrap = function () {\n this.moveChildren(this.parent, this.next);\n this.remove();\n };\n ContainerBlot.prototype.update = function (mutations, context) {\n var _this = this;\n var addedNodes = [];\n var removedNodes = [];\n mutations.forEach(function (mutation) {\n if (mutation.target === _this.domNode && mutation.type === 'childList') {\n addedNodes.push.apply(addedNodes, mutation.addedNodes);\n removedNodes.push.apply(removedNodes, mutation.removedNodes);\n }\n });\n removedNodes.forEach(function (node) {\n // Check node has actually been removed\n // One exception is Chrome does not immediately remove IFRAMEs\n // from DOM but MutationRecord is correct in its reported removal\n if (node.parentNode != null &&\n // @ts-ignore\n node.tagName !== 'IFRAME' &&\n document.body.compareDocumentPosition(node) & Node.DOCUMENT_POSITION_CONTAINED_BY) {\n return;\n }\n var blot = Registry.find(node);\n if (blot == null)\n return;\n if (blot.domNode.parentNode == null || blot.domNode.parentNode === _this.domNode) {\n blot.detach();\n }\n });\n addedNodes\n .filter(function (node) {\n return node.parentNode == _this.domNode;\n })\n .sort(function (a, b) {\n if (a === b)\n return 0;\n if (a.compareDocumentPosition(b) & Node.DOCUMENT_POSITION_FOLLOWING) {\n return 1;\n }\n return -1;\n })\n .forEach(function (node) {\n var refBlot = null;\n if (node.nextSibling != null) {\n refBlot = Registry.find(node.nextSibling);\n }\n var blot = makeBlot(node);\n if (blot.next != refBlot || blot.next == null) {\n if (blot.parent != null) {\n blot.parent.removeChild(_this);\n }\n _this.insertBefore(blot, refBlot || undefined);\n }\n });\n };\n return ContainerBlot;\n}(shadow_1.default));\nfunction makeBlot(node) {\n var blot = Registry.find(node);\n if (blot == null) {\n try {\n blot = Registry.create(node);\n }\n catch (e) {\n blot = Registry.create(Registry.Scope.INLINE);\n [].slice.call(node.childNodes).forEach(function (child) {\n // @ts-ignore\n blot.domNode.appendChild(child);\n });\n if (node.parentNode) {\n node.parentNode.replaceChild(blot.domNode, node);\n }\n blot.attach();\n }\n }\n return blot;\n}\nexports.default = ContainerBlot;\n\n\n/***/ }),\n/* 18 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar attributor_1 = __webpack_require__(12);\nvar store_1 = __webpack_require__(31);\nvar container_1 = __webpack_require__(17);\nvar Registry = __webpack_require__(1);\nvar FormatBlot = /** @class */ (function (_super) {\n __extends(FormatBlot, _super);\n function FormatBlot(domNode) {\n var _this = _super.call(this, domNode) || this;\n _this.attributes = new store_1.default(_this.domNode);\n return _this;\n }\n FormatBlot.formats = function (domNode) {\n if (typeof this.tagName === 'string') {\n return true;\n }\n else if (Array.isArray(this.tagName)) {\n return domNode.tagName.toLowerCase();\n }\n return undefined;\n };\n FormatBlot.prototype.format = function (name, value) {\n var format = Registry.query(name);\n if (format instanceof attributor_1.default) {\n this.attributes.attribute(format, value);\n }\n else if (value) {\n if (format != null && (name !== this.statics.blotName || this.formats()[name] !== value)) {\n this.replaceWith(name, value);\n }\n }\n };\n FormatBlot.prototype.formats = function () {\n var formats = this.attributes.values();\n var format = this.statics.formats(this.domNode);\n if (format != null) {\n formats[this.statics.blotName] = format;\n }\n return formats;\n };\n FormatBlot.prototype.replaceWith = function (name, value) {\n var replacement = _super.prototype.replaceWith.call(this, name, value);\n this.attributes.copy(replacement);\n return replacement;\n };\n FormatBlot.prototype.update = function (mutations, context) {\n var _this = this;\n _super.prototype.update.call(this, mutations, context);\n if (mutations.some(function (mutation) {\n return mutation.target === _this.domNode && mutation.type === 'attributes';\n })) {\n this.attributes.build();\n }\n };\n FormatBlot.prototype.wrap = function (name, value) {\n var wrapper = _super.prototype.wrap.call(this, name, value);\n if (wrapper instanceof FormatBlot && wrapper.statics.scope === this.statics.scope) {\n this.attributes.move(wrapper);\n }\n return wrapper;\n };\n return FormatBlot;\n}(container_1.default));\nexports.default = FormatBlot;\n\n\n/***/ }),\n/* 19 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar shadow_1 = __webpack_require__(30);\nvar Registry = __webpack_require__(1);\nvar LeafBlot = /** @class */ (function (_super) {\n __extends(LeafBlot, _super);\n function LeafBlot() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n LeafBlot.value = function (domNode) {\n return true;\n };\n LeafBlot.prototype.index = function (node, offset) {\n if (this.domNode === node ||\n this.domNode.compareDocumentPosition(node) & Node.DOCUMENT_POSITION_CONTAINED_BY) {\n return Math.min(offset, 1);\n }\n return -1;\n };\n LeafBlot.prototype.position = function (index, inclusive) {\n var offset = [].indexOf.call(this.parent.domNode.childNodes, this.domNode);\n if (index > 0)\n offset += 1;\n return [this.parent.domNode, offset];\n };\n LeafBlot.prototype.value = function () {\n var _a;\n return _a = {}, _a[this.statics.blotName] = this.statics.value(this.domNode) || true, _a;\n };\n LeafBlot.scope = Registry.Scope.INLINE_BLOT;\n return LeafBlot;\n}(shadow_1.default));\nexports.default = LeafBlot;\n\n\n/***/ }),\n/* 20 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar equal = __webpack_require__(11);\nvar extend = __webpack_require__(3);\n\n\nvar lib = {\n attributes: {\n compose: function (a, b, keepNull) {\n if (typeof a !== 'object') a = {};\n if (typeof b !== 'object') b = {};\n var attributes = extend(true, {}, b);\n if (!keepNull) {\n attributes = Object.keys(attributes).reduce(function (copy, key) {\n if (attributes[key] != null) {\n copy[key] = attributes[key];\n }\n return copy;\n }, {});\n }\n for (var key in a) {\n if (a[key] !== undefined && b[key] === undefined) {\n attributes[key] = a[key];\n }\n }\n return Object.keys(attributes).length > 0 ? attributes : undefined;\n },\n\n diff: function(a, b) {\n if (typeof a !== 'object') a = {};\n if (typeof b !== 'object') b = {};\n var attributes = Object.keys(a).concat(Object.keys(b)).reduce(function (attributes, key) {\n if (!equal(a[key], b[key])) {\n attributes[key] = b[key] === undefined ? null : b[key];\n }\n return attributes;\n }, {});\n return Object.keys(attributes).length > 0 ? attributes : undefined;\n },\n\n transform: function (a, b, priority) {\n if (typeof a !== 'object') return b;\n if (typeof b !== 'object') return undefined;\n if (!priority) return b; // b simply overwrites us without priority\n var attributes = Object.keys(b).reduce(function (attributes, key) {\n if (a[key] === undefined) attributes[key] = b[key]; // null is a valid value\n return attributes;\n }, {});\n return Object.keys(attributes).length > 0 ? attributes : undefined;\n }\n },\n\n iterator: function (ops) {\n return new Iterator(ops);\n },\n\n length: function (op) {\n if (typeof op['delete'] === 'number') {\n return op['delete'];\n } else if (typeof op.retain === 'number') {\n return op.retain;\n } else {\n return typeof op.insert === 'string' ? op.insert.length : 1;\n }\n }\n};\n\n\nfunction Iterator(ops) {\n this.ops = ops;\n this.index = 0;\n this.offset = 0;\n};\n\nIterator.prototype.hasNext = function () {\n return this.peekLength() < Infinity;\n};\n\nIterator.prototype.next = function (length) {\n if (!length) length = Infinity;\n var nextOp = this.ops[this.index];\n if (nextOp) {\n var offset = this.offset;\n var opLength = lib.length(nextOp)\n if (length >= opLength - offset) {\n length = opLength - offset;\n this.index += 1;\n this.offset = 0;\n } else {\n this.offset += length;\n }\n if (typeof nextOp['delete'] === 'number') {\n return { 'delete': length };\n } else {\n var retOp = {};\n if (nextOp.attributes) {\n retOp.attributes = nextOp.attributes;\n }\n if (typeof nextOp.retain === 'number') {\n retOp.retain = length;\n } else if (typeof nextOp.insert === 'string') {\n retOp.insert = nextOp.insert.substr(offset, length);\n } else {\n // offset should === 0, length should === 1\n retOp.insert = nextOp.insert;\n }\n return retOp;\n }\n } else {\n return { retain: Infinity };\n }\n};\n\nIterator.prototype.peek = function () {\n return this.ops[this.index];\n};\n\nIterator.prototype.peekLength = function () {\n if (this.ops[this.index]) {\n // Should never return 0 if our index is being managed correctly\n return lib.length(this.ops[this.index]) - this.offset;\n } else {\n return Infinity;\n }\n};\n\nIterator.prototype.peekType = function () {\n if (this.ops[this.index]) {\n if (typeof this.ops[this.index]['delete'] === 'number') {\n return 'delete';\n } else if (typeof this.ops[this.index].retain === 'number') {\n return 'retain';\n } else {\n return 'insert';\n }\n }\n return 'retain';\n};\n\nIterator.prototype.rest = function () {\n if (!this.hasNext()) {\n return [];\n } else if (this.offset === 0) {\n return this.ops.slice(this.index);\n } else {\n var offset = this.offset;\n var index = this.index;\n var next = this.next();\n var rest = this.ops.slice(this.index);\n this.offset = offset;\n this.index = index;\n return [next].concat(rest);\n }\n};\n\n\nmodule.exports = lib;\n\n\n/***/ }),\n/* 21 */\n/***/ (function(module, exports) {\n\nvar clone = (function() {\n'use strict';\n\nfunction _instanceof(obj, type) {\n return type != null && obj instanceof type;\n}\n\nvar nativeMap;\ntry {\n nativeMap = Map;\n} catch(_) {\n // maybe a reference error because no `Map`. Give it a dummy value that no\n // value will ever be an instanceof.\n nativeMap = function() {};\n}\n\nvar nativeSet;\ntry {\n nativeSet = Set;\n} catch(_) {\n nativeSet = function() {};\n}\n\nvar nativePromise;\ntry {\n nativePromise = Promise;\n} catch(_) {\n nativePromise = function() {};\n}\n\n/**\n * Clones (copies) an Object using deep copying.\n *\n * This function supports circular references by default, but if you are certain\n * there are no circular references in your object, you can save some CPU time\n * by calling clone(obj, false).\n *\n * Caution: if `circular` is false and `parent` contains circular references,\n * your program may enter an infinite loop and crash.\n *\n * @param `parent` - the object to be cloned\n * @param `circular` - set to true if the object to be cloned may contain\n * circular references. (optional - true by default)\n * @param `depth` - set to a number if the object is only to be cloned to\n * a particular depth. (optional - defaults to Infinity)\n * @param `prototype` - sets the prototype to be used when cloning an object.\n * (optional - defaults to parent prototype).\n * @param `includeNonEnumerable` - set to true if the non-enumerable properties\n * should be cloned as well. Non-enumerable properties on the prototype\n * chain will be ignored. (optional - false by default)\n*/\nfunction clone(parent, circular, depth, prototype, includeNonEnumerable) {\n if (typeof circular === 'object') {\n depth = circular.depth;\n prototype = circular.prototype;\n includeNonEnumerable = circular.includeNonEnumerable;\n circular = circular.circular;\n }\n // maintain two arrays for circular references, where corresponding parents\n // and children have the same index\n var allParents = [];\n var allChildren = [];\n\n var useBuffer = typeof Buffer != 'undefined';\n\n if (typeof circular == 'undefined')\n circular = true;\n\n if (typeof depth == 'undefined')\n depth = Infinity;\n\n // recurse this function so we don't reset allParents and allChildren\n function _clone(parent, depth) {\n // cloning null always returns null\n if (parent === null)\n return null;\n\n if (depth === 0)\n return parent;\n\n var child;\n var proto;\n if (typeof parent != 'object') {\n return parent;\n }\n\n if (_instanceof(parent, nativeMap)) {\n child = new nativeMap();\n } else if (_instanceof(parent, nativeSet)) {\n child = new nativeSet();\n } else if (_instanceof(parent, nativePromise)) {\n child = new nativePromise(function (resolve, reject) {\n parent.then(function(value) {\n resolve(_clone(value, depth - 1));\n }, function(err) {\n reject(_clone(err, depth - 1));\n });\n });\n } else if (clone.__isArray(parent)) {\n child = [];\n } else if (clone.__isRegExp(parent)) {\n child = new RegExp(parent.source, __getRegExpFlags(parent));\n if (parent.lastIndex) child.lastIndex = parent.lastIndex;\n } else if (clone.__isDate(parent)) {\n child = new Date(parent.getTime());\n } else if (useBuffer && Buffer.isBuffer(parent)) {\n if (Buffer.allocUnsafe) {\n // Node.js >= 4.5.0\n child = Buffer.allocUnsafe(parent.length);\n } else {\n // Older Node.js versions\n child = new Buffer(parent.length);\n }\n parent.copy(child);\n return child;\n } else if (_instanceof(parent, Error)) {\n child = Object.create(parent);\n } else {\n if (typeof prototype == 'undefined') {\n proto = Object.getPrototypeOf(parent);\n child = Object.create(proto);\n }\n else {\n child = Object.create(prototype);\n proto = prototype;\n }\n }\n\n if (circular) {\n var index = allParents.indexOf(parent);\n\n if (index != -1) {\n return allChildren[index];\n }\n allParents.push(parent);\n allChildren.push(child);\n }\n\n if (_instanceof(parent, nativeMap)) {\n parent.forEach(function(value, key) {\n var keyChild = _clone(key, depth - 1);\n var valueChild = _clone(value, depth - 1);\n child.set(keyChild, valueChild);\n });\n }\n if (_instanceof(parent, nativeSet)) {\n parent.forEach(function(value) {\n var entryChild = _clone(value, depth - 1);\n child.add(entryChild);\n });\n }\n\n for (var i in parent) {\n var attrs;\n if (proto) {\n attrs = Object.getOwnPropertyDescriptor(proto, i);\n }\n\n if (attrs && attrs.set == null) {\n continue;\n }\n child[i] = _clone(parent[i], depth - 1);\n }\n\n if (Object.getOwnPropertySymbols) {\n var symbols = Object.getOwnPropertySymbols(parent);\n for (var i = 0; i < symbols.length; i++) {\n // Don't need to worry about cloning a symbol because it is a primitive,\n // like a number or string.\n var symbol = symbols[i];\n var descriptor = Object.getOwnPropertyDescriptor(parent, symbol);\n if (descriptor && !descriptor.enumerable && !includeNonEnumerable) {\n continue;\n }\n child[symbol] = _clone(parent[symbol], depth - 1);\n if (!descriptor.enumerable) {\n Object.defineProperty(child, symbol, {\n enumerable: false\n });\n }\n }\n }\n\n if (includeNonEnumerable) {\n var allPropertyNames = Object.getOwnPropertyNames(parent);\n for (var i = 0; i < allPropertyNames.length; i++) {\n var propertyName = allPropertyNames[i];\n var descriptor = Object.getOwnPropertyDescriptor(parent, propertyName);\n if (descriptor && descriptor.enumerable) {\n continue;\n }\n child[propertyName] = _clone(parent[propertyName], depth - 1);\n Object.defineProperty(child, propertyName, {\n enumerable: false\n });\n }\n }\n\n return child;\n }\n\n return _clone(parent, depth);\n}\n\n/**\n * Simple flat clone using prototype, accepts only objects, usefull for property\n * override on FLAT configuration object (no nested props).\n *\n * USE WITH CAUTION! This may not behave as you wish if you do not know how this\n * works.\n */\nclone.clonePrototype = function clonePrototype(parent) {\n if (parent === null)\n return null;\n\n var c = function () {};\n c.prototype = parent;\n return new c();\n};\n\n// private utility functions\n\nfunction __objToStr(o) {\n return Object.prototype.toString.call(o);\n}\nclone.__objToStr = __objToStr;\n\nfunction __isDate(o) {\n return typeof o === 'object' && __objToStr(o) === '[object Date]';\n}\nclone.__isDate = __isDate;\n\nfunction __isArray(o) {\n return typeof o === 'object' && __objToStr(o) === '[object Array]';\n}\nclone.__isArray = __isArray;\n\nfunction __isRegExp(o) {\n return typeof o === 'object' && __objToStr(o) === '[object RegExp]';\n}\nclone.__isRegExp = __isRegExp;\n\nfunction __getRegExpFlags(re) {\n var flags = '';\n if (re.global) flags += 'g';\n if (re.ignoreCase) flags += 'i';\n if (re.multiline) flags += 'm';\n return flags;\n}\nclone.__getRegExpFlags = __getRegExpFlags;\n\nreturn clone;\n})();\n\nif (typeof module === 'object' && module.exports) {\n module.exports = clone;\n}\n\n\n/***/ }),\n/* 22 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_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\"]) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); } }; }();\n\nvar _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; }; }();\n\nvar _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if (\"value\" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };\n\nvar _parchment = __webpack_require__(0);\n\nvar _parchment2 = _interopRequireDefault(_parchment);\n\nvar _emitter = __webpack_require__(8);\n\nvar _emitter2 = _interopRequireDefault(_emitter);\n\nvar _block = __webpack_require__(4);\n\nvar _block2 = _interopRequireDefault(_block);\n\nvar _break = __webpack_require__(16);\n\nvar _break2 = _interopRequireDefault(_break);\n\nvar _code = __webpack_require__(13);\n\nvar _code2 = _interopRequireDefault(_code);\n\nvar _container = __webpack_require__(25);\n\nvar _container2 = _interopRequireDefault(_container);\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 _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nfunction isLine(blot) {\n return blot instanceof _block2.default || blot instanceof _block.BlockEmbed;\n}\n\nvar Scroll = function (_Parchment$Scroll) {\n _inherits(Scroll, _Parchment$Scroll);\n\n function Scroll(domNode, config) {\n _classCallCheck(this, Scroll);\n\n var _this = _possibleConstructorReturn(this, (Scroll.__proto__ || Object.getPrototypeOf(Scroll)).call(this, domNode));\n\n _this.emitter = config.emitter;\n if (Array.isArray(config.whitelist)) {\n _this.whitelist = config.whitelist.reduce(function (whitelist, format) {\n whitelist[format] = true;\n return whitelist;\n }, {});\n }\n // Some reason fixes composition issues with character languages in Windows/Chrome, Safari\n _this.domNode.addEventListener('DOMNodeInserted', function () {});\n _this.optimize();\n _this.enable();\n return _this;\n }\n\n _createClass(Scroll, [{\n key: 'batchStart',\n value: function batchStart() {\n this.batch = true;\n }\n }, {\n key: 'batchEnd',\n value: function batchEnd() {\n this.batch = false;\n this.optimize();\n }\n }, {\n key: 'deleteAt',\n value: function deleteAt(index, length) {\n var _line = this.line(index),\n _line2 = _slicedToArray(_line, 2),\n first = _line2[0],\n offset = _line2[1];\n\n var _line3 = this.line(index + length),\n _line4 = _slicedToArray(_line3, 1),\n last = _line4[0];\n\n _get(Scroll.prototype.__proto__ || Object.getPrototypeOf(Scroll.prototype), 'deleteAt', this).call(this, index, length);\n if (last != null && first !== last && offset > 0) {\n if (first instanceof _block.BlockEmbed || last instanceof _block.BlockEmbed) {\n this.optimize();\n return;\n }\n if (first instanceof _code2.default) {\n var newlineIndex = first.newlineIndex(first.length(), true);\n if (newlineIndex > -1) {\n first = first.split(newlineIndex + 1);\n if (first === last) {\n this.optimize();\n return;\n }\n }\n } else if (last instanceof _code2.default) {\n var _newlineIndex = last.newlineIndex(0);\n if (_newlineIndex > -1) {\n last.split(_newlineIndex + 1);\n }\n }\n var ref = last.children.head instanceof _break2.default ? null : last.children.head;\n first.moveChildren(last, ref);\n first.remove();\n }\n this.optimize();\n }\n }, {\n key: 'enable',\n value: function enable() {\n var enabled = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;\n\n this.domNode.setAttribute('contenteditable', enabled);\n }\n }, {\n key: 'formatAt',\n value: function formatAt(index, length, format, value) {\n if (this.whitelist != null && !this.whitelist[format]) return;\n _get(Scroll.prototype.__proto__ || Object.getPrototypeOf(Scroll.prototype), 'formatAt', this).call(this, index, length, format, value);\n this.optimize();\n }\n }, {\n key: 'insertAt',\n value: function insertAt(index, value, def) {\n if (def != null && this.whitelist != null && !this.whitelist[value]) return;\n if (index >= this.length()) {\n if (def == null || _parchment2.default.query(value, _parchment2.default.Scope.BLOCK) == null) {\n var blot = _parchment2.default.create(this.statics.defaultChild);\n this.appendChild(blot);\n if (def == null && value.endsWith('\\n')) {\n value = value.slice(0, -1);\n }\n blot.insertAt(0, value, def);\n } else {\n var embed = _parchment2.default.create(value, def);\n this.appendChild(embed);\n }\n } else {\n _get(Scroll.prototype.__proto__ || Object.getPrototypeOf(Scroll.prototype), 'insertAt', this).call(this, index, value, def);\n }\n this.optimize();\n }\n }, {\n key: 'insertBefore',\n value: function insertBefore(blot, ref) {\n if (blot.statics.scope === _parchment2.default.Scope.INLINE_BLOT) {\n var wrapper = _parchment2.default.create(this.statics.defaultChild);\n wrapper.appendChild(blot);\n blot = wrapper;\n }\n _get(Scroll.prototype.__proto__ || Object.getPrototypeOf(Scroll.prototype), 'insertBefore', this).call(this, blot, ref);\n }\n }, {\n key: 'leaf',\n value: function leaf(index) {\n return this.path(index).pop() || [null, -1];\n }\n }, {\n key: 'line',\n value: function line(index) {\n if (index === this.length()) {\n return this.line(index - 1);\n }\n return this.descendant(isLine, index);\n }\n }, {\n key: 'lines',\n value: function lines() {\n var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;\n var length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Number.MAX_VALUE;\n\n var getLines = function getLines(blot, index, length) {\n var lines = [],\n lengthLeft = length;\n blot.children.forEachAt(index, length, function (child, index, length) {\n if (isLine(child)) {\n lines.push(child);\n } else if (child instanceof _parchment2.default.Container) {\n lines = lines.concat(getLines(child, index, lengthLeft));\n }\n lengthLeft -= length;\n });\n return lines;\n };\n return getLines(this, index, length);\n }\n }, {\n key: 'optimize',\n value: function optimize() {\n var mutations = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];\n var context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n if (this.batch === true) return;\n _get(Scroll.prototype.__proto__ || Object.getPrototypeOf(Scroll.prototype), 'optimize', this).call(this, mutations, context);\n if (mutations.length > 0) {\n this.emitter.emit(_emitter2.default.events.SCROLL_OPTIMIZE, mutations, context);\n }\n }\n }, {\n key: 'path',\n value: function path(index) {\n return _get(Scroll.prototype.__proto__ || Object.getPrototypeOf(Scroll.prototype), 'path', this).call(this, index).slice(1); // Exclude self\n }\n }, {\n key: 'update',\n value: function update(mutations) {\n if (this.batch === true) return;\n var source = _emitter2.default.sources.USER;\n if (typeof mutations === 'string') {\n source = mutations;\n }\n if (!Array.isArray(mutations)) {\n mutations = this.observer.takeRecords();\n }\n if (mutations.length > 0) {\n this.emitter.emit(_emitter2.default.events.SCROLL_BEFORE_UPDATE, source, mutations);\n }\n _get(Scroll.prototype.__proto__ || Object.getPrototypeOf(Scroll.prototype), 'update', this).call(this, mutations.concat([])); // pass copy\n if (mutations.length > 0) {\n this.emitter.emit(_emitter2.default.events.SCROLL_UPDATE, source, mutations);\n }\n }\n }]);\n\n return Scroll;\n}(_parchment2.default.Scroll);\n\nScroll.blotName = 'scroll';\nScroll.className = 'ql-editor';\nScroll.tagName = 'DIV';\nScroll.defaultChild = 'block';\nScroll.allowedChildren = [_block2.default, _block.BlockEmbed, _container2.default];\n\nexports.default = Scroll;\n\n/***/ }),\n/* 23 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.SHORTKEY = exports.default = undefined;\n\nvar _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; };\n\nvar _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_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\"]) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); } }; }();\n\nvar _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; }; }();\n\nvar _clone = __webpack_require__(21);\n\nvar _clone2 = _interopRequireDefault(_clone);\n\nvar _deepEqual = __webpack_require__(11);\n\nvar _deepEqual2 = _interopRequireDefault(_deepEqual);\n\nvar _extend = __webpack_require__(3);\n\nvar _extend2 = _interopRequireDefault(_extend);\n\nvar _quillDelta = __webpack_require__(2);\n\nvar _quillDelta2 = _interopRequireDefault(_quillDelta);\n\nvar _op = __webpack_require__(20);\n\nvar _op2 = _interopRequireDefault(_op);\n\nvar _parchment = __webpack_require__(0);\n\nvar _parchment2 = _interopRequireDefault(_parchment);\n\nvar _quill = __webpack_require__(5);\n\nvar _quill2 = _interopRequireDefault(_quill);\n\nvar _logger = __webpack_require__(10);\n\nvar _logger2 = _interopRequireDefault(_logger);\n\nvar _module = __webpack_require__(9);\n\nvar _module2 = _interopRequireDefault(_module);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\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 _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nvar debug = (0, _logger2.default)('quill:keyboard');\n\nvar SHORTKEY = /Mac/i.test(navigator.platform) ? 'metaKey' : 'ctrlKey';\n\nvar Keyboard = function (_Module) {\n _inherits(Keyboard, _Module);\n\n _createClass(Keyboard, null, [{\n key: 'match',\n value: function match(evt, binding) {\n binding = normalize(binding);\n if (['altKey', 'ctrlKey', 'metaKey', 'shiftKey'].some(function (key) {\n return !!binding[key] !== evt[key] && binding[key] !== null;\n })) {\n return false;\n }\n return binding.key === (evt.which || evt.keyCode);\n }\n }]);\n\n function Keyboard(quill, options) {\n _classCallCheck(this, Keyboard);\n\n var _this = _possibleConstructorReturn(this, (Keyboard.__proto__ || Object.getPrototypeOf(Keyboard)).call(this, quill, options));\n\n _this.bindings = {};\n Object.keys(_this.options.bindings).forEach(function (name) {\n if (name === 'list autofill' && quill.scroll.whitelist != null && !quill.scroll.whitelist['list']) {\n return;\n }\n if (_this.options.bindings[name]) {\n _this.addBinding(_this.options.bindings[name]);\n }\n });\n _this.addBinding({ key: Keyboard.keys.ENTER, shiftKey: null }, handleEnter);\n _this.addBinding({ key: Keyboard.keys.ENTER, metaKey: null, ctrlKey: null, altKey: null }, function () {});\n if (/Firefox/i.test(navigator.userAgent)) {\n // Need to handle delete and backspace for Firefox in the general case #1171\n _this.addBinding({ key: Keyboard.keys.BACKSPACE }, { collapsed: true }, handleBackspace);\n _this.addBinding({ key: Keyboard.keys.DELETE }, { collapsed: true }, handleDelete);\n } else {\n _this.addBinding({ key: Keyboard.keys.BACKSPACE }, { collapsed: true, prefix: /^.?$/ }, handleBackspace);\n _this.addBinding({ key: Keyboard.keys.DELETE }, { collapsed: true, suffix: /^.?$/ }, handleDelete);\n }\n _this.addBinding({ key: Keyboard.keys.BACKSPACE }, { collapsed: false }, handleDeleteRange);\n _this.addBinding({ key: Keyboard.keys.DELETE }, { collapsed: false }, handleDeleteRange);\n _this.addBinding({ key: Keyboard.keys.BACKSPACE, altKey: null, ctrlKey: null, metaKey: null, shiftKey: null }, { collapsed: true, offset: 0 }, handleBackspace);\n _this.listen();\n return _this;\n }\n\n _createClass(Keyboard, [{\n key: 'addBinding',\n value: function addBinding(key) {\n var context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n var handler = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n\n var binding = normalize(key);\n if (binding == null || binding.key == null) {\n return debug.warn('Attempted to add invalid keyboard binding', binding);\n }\n if (typeof context === 'function') {\n context = { handler: context };\n }\n if (typeof handler === 'function') {\n handler = { handler: handler };\n }\n binding = (0, _extend2.default)(binding, context, handler);\n this.bindings[binding.key] = this.bindings[binding.key] || [];\n this.bindings[binding.key].push(binding);\n }\n }, {\n key: 'listen',\n value: function listen() {\n var _this2 = this;\n\n this.quill.root.addEventListener('keydown', function (evt) {\n if (evt.defaultPrevented) return;\n var which = evt.which || evt.keyCode;\n var bindings = (_this2.bindings[which] || []).filter(function (binding) {\n return Keyboard.match(evt, binding);\n });\n if (bindings.length === 0) return;\n var range = _this2.quill.getSelection();\n if (range == null || !_this2.quill.hasFocus()) return;\n\n var _quill$getLine = _this2.quill.getLine(range.index),\n _quill$getLine2 = _slicedToArray(_quill$getLine, 2),\n line = _quill$getLine2[0],\n offset = _quill$getLine2[1];\n\n var _quill$getLeaf = _this2.quill.getLeaf(range.index),\n _quill$getLeaf2 = _slicedToArray(_quill$getLeaf, 2),\n leafStart = _quill$getLeaf2[0],\n offsetStart = _quill$getLeaf2[1];\n\n var _ref = range.length === 0 ? [leafStart, offsetStart] : _this2.quill.getLeaf(range.index + range.length),\n _ref2 = _slicedToArray(_ref, 2),\n leafEnd = _ref2[0],\n offsetEnd = _ref2[1];\n\n var prefixText = leafStart instanceof _parchment2.default.Text ? leafStart.value().slice(0, offsetStart) : '';\n var suffixText = leafEnd instanceof _parchment2.default.Text ? leafEnd.value().slice(offsetEnd) : '';\n var curContext = {\n collapsed: range.length === 0,\n empty: range.length === 0 && line.length() <= 1,\n format: _this2.quill.getFormat(range),\n offset: offset,\n prefix: prefixText,\n suffix: suffixText\n };\n var prevented = bindings.some(function (binding) {\n if (binding.collapsed != null && binding.collapsed !== curContext.collapsed) return false;\n if (binding.empty != null && binding.empty !== curContext.empty) return false;\n if (binding.offset != null && binding.offset !== curContext.offset) return false;\n if (Array.isArray(binding.format)) {\n // any format is present\n if (binding.format.every(function (name) {\n return curContext.format[name] == null;\n })) {\n return false;\n }\n } else if (_typeof(binding.format) === 'object') {\n // all formats must match\n if (!Object.keys(binding.format).every(function (name) {\n if (binding.format[name] === true) return curContext.format[name] != null;\n if (binding.format[name] === false) return curContext.format[name] == null;\n return (0, _deepEqual2.default)(binding.format[name], curContext.format[name]);\n })) {\n return false;\n }\n }\n if (binding.prefix != null && !binding.prefix.test(curContext.prefix)) return false;\n if (binding.suffix != null && !binding.suffix.test(curContext.suffix)) return false;\n return binding.handler.call(_this2, range, curContext) !== true;\n });\n if (prevented) {\n evt.preventDefault();\n }\n });\n }\n }]);\n\n return Keyboard;\n}(_module2.default);\n\nKeyboard.keys = {\n BACKSPACE: 8,\n TAB: 9,\n ENTER: 13,\n ESCAPE: 27,\n LEFT: 37,\n UP: 38,\n RIGHT: 39,\n DOWN: 40,\n DELETE: 46\n};\n\nKeyboard.DEFAULTS = {\n bindings: {\n 'bold': makeFormatHandler('bold'),\n 'italic': makeFormatHandler('italic'),\n 'underline': makeFormatHandler('underline'),\n 'indent': {\n // highlight tab or tab at beginning of list, indent or blockquote\n key: Keyboard.keys.TAB,\n format: ['blockquote', 'indent', 'list'],\n handler: function handler(range, context) {\n if (context.collapsed && context.offset !== 0) return true;\n this.quill.format('indent', '+1', _quill2.default.sources.USER);\n }\n },\n 'outdent': {\n key: Keyboard.keys.TAB,\n shiftKey: true,\n format: ['blockquote', 'indent', 'list'],\n // highlight tab or tab at beginning of list, indent or blockquote\n handler: function handler(range, context) {\n if (context.collapsed && context.offset !== 0) return true;\n this.quill.format('indent', '-1', _quill2.default.sources.USER);\n }\n },\n 'outdent backspace': {\n key: Keyboard.keys.BACKSPACE,\n collapsed: true,\n shiftKey: null,\n metaKey: null,\n ctrlKey: null,\n altKey: null,\n format: ['indent', 'list'],\n offset: 0,\n handler: function handler(range, context) {\n if (context.format.indent != null) {\n this.quill.format('indent', '-1', _quill2.default.sources.USER);\n } else if (context.format.list != null) {\n this.quill.format('list', false, _quill2.default.sources.USER);\n }\n }\n },\n 'indent code-block': makeCodeBlockHandler(true),\n 'outdent code-block': makeCodeBlockHandler(false),\n 'remove tab': {\n key: Keyboard.keys.TAB,\n shiftKey: true,\n collapsed: true,\n prefix: /\\t$/,\n handler: function handler(range) {\n this.quill.deleteText(range.index - 1, 1, _quill2.default.sources.USER);\n }\n },\n 'tab': {\n key: Keyboard.keys.TAB,\n handler: function handler(range) {\n this.quill.history.cutoff();\n var delta = new _quillDelta2.default().retain(range.index).delete(range.length).insert('\\t');\n this.quill.updateContents(delta, _quill2.default.sources.USER);\n this.quill.history.cutoff();\n this.quill.setSelection(range.index + 1, _quill2.default.sources.SILENT);\n }\n },\n 'list empty enter': {\n key: Keyboard.keys.ENTER,\n collapsed: true,\n format: ['list'],\n empty: true,\n handler: function handler(range, context) {\n this.quill.format('list', false, _quill2.default.sources.USER);\n if (context.format.indent) {\n this.quill.format('indent', false, _quill2.default.sources.USER);\n }\n }\n },\n 'checklist enter': {\n key: Keyboard.keys.ENTER,\n collapsed: true,\n format: { list: 'checked' },\n handler: function handler(range) {\n var _quill$getLine3 = this.quill.getLine(range.index),\n _quill$getLine4 = _slicedToArray(_quill$getLine3, 2),\n line = _quill$getLine4[0],\n offset = _quill$getLine4[1];\n\n var formats = (0, _extend2.default)({}, line.formats(), { list: 'checked' });\n var delta = new _quillDelta2.default().retain(range.index).insert('\\n', formats).retain(line.length() - offset - 1).retain(1, { list: 'unchecked' });\n this.quill.updateContents(delta, _quill2.default.sources.USER);\n this.quill.setSelection(range.index + 1, _quill2.default.sources.SILENT);\n this.quill.scrollIntoView();\n }\n },\n 'header enter': {\n key: Keyboard.keys.ENTER,\n collapsed: true,\n format: ['header'],\n suffix: /^$/,\n handler: function handler(range, context) {\n var _quill$getLine5 = this.quill.getLine(range.index),\n _quill$getLine6 = _slicedToArray(_quill$getLine5, 2),\n line = _quill$getLine6[0],\n offset = _quill$getLine6[1];\n\n var delta = new _quillDelta2.default().retain(range.index).insert('\\n', context.format).retain(line.length() - offset - 1).retain(1, { header: null });\n this.quill.updateContents(delta, _quill2.default.sources.USER);\n this.quill.setSelection(range.index + 1, _quill2.default.sources.SILENT);\n this.quill.scrollIntoView();\n }\n },\n 'list autofill': {\n key: ' ',\n collapsed: true,\n format: { list: false },\n prefix: /^\\s*?(\\d+\\.|-|\\*|\\[ ?\\]|\\[x\\])$/,\n handler: function handler(range, context) {\n var length = context.prefix.length;\n\n var _quill$getLine7 = this.quill.getLine(range.index),\n _quill$getLine8 = _slicedToArray(_quill$getLine7, 2),\n line = _quill$getLine8[0],\n offset = _quill$getLine8[1];\n\n if (offset > length) return true;\n var value = void 0;\n switch (context.prefix.trim()) {\n case '[]':case '[ ]':\n value = 'unchecked';\n break;\n case '[x]':\n value = 'checked';\n break;\n case '-':case '*':\n value = 'bullet';\n break;\n default:\n value = 'ordered';\n }\n this.quill.insertText(range.index, ' ', _quill2.default.sources.USER);\n this.quill.history.cutoff();\n var delta = new _quillDelta2.default().retain(range.index - offset).delete(length + 1).retain(line.length() - 2 - offset).retain(1, { list: value });\n this.quill.updateContents(delta, _quill2.default.sources.USER);\n this.quill.history.cutoff();\n this.quill.setSelection(range.index - length, _quill2.default.sources.SILENT);\n }\n },\n 'code exit': {\n key: Keyboard.keys.ENTER,\n collapsed: true,\n format: ['code-block'],\n prefix: /\\n\\n$/,\n suffix: /^\\s+$/,\n handler: function handler(range) {\n var _quill$getLine9 = this.quill.getLine(range.index),\n _quill$getLine10 = _slicedToArray(_quill$getLine9, 2),\n line = _quill$getLine10[0],\n offset = _quill$getLine10[1];\n\n var delta = new _quillDelta2.default().retain(range.index + line.length() - offset - 2).retain(1, { 'code-block': null }).delete(1);\n this.quill.updateContents(delta, _quill2.default.sources.USER);\n }\n },\n 'embed left': makeEmbedArrowHandler(Keyboard.keys.LEFT, false),\n 'embed left shift': makeEmbedArrowHandler(Keyboard.keys.LEFT, true),\n 'embed right': makeEmbedArrowHandler(Keyboard.keys.RIGHT, false),\n 'embed right shift': makeEmbedArrowHandler(Keyboard.keys.RIGHT, true)\n }\n};\n\nfunction makeEmbedArrowHandler(key, shiftKey) {\n var _ref3;\n\n var where = key === Keyboard.keys.LEFT ? 'prefix' : 'suffix';\n return _ref3 = {\n key: key,\n shiftKey: shiftKey,\n altKey: null\n }, _defineProperty(_ref3, where, /^$/), _defineProperty(_ref3, 'handler', function handler(range) {\n var index = range.index;\n if (key === Keyboard.keys.RIGHT) {\n index += range.length + 1;\n }\n\n var _quill$getLeaf3 = this.quill.getLeaf(index),\n _quill$getLeaf4 = _slicedToArray(_quill$getLeaf3, 1),\n leaf = _quill$getLeaf4[0];\n\n if (!(leaf instanceof _parchment2.default.Embed)) return true;\n if (key === Keyboard.keys.LEFT) {\n if (shiftKey) {\n this.quill.setSelection(range.index - 1, range.length + 1, _quill2.default.sources.USER);\n } else {\n this.quill.setSelection(range.index - 1, _quill2.default.sources.USER);\n }\n } else {\n if (shiftKey) {\n this.quill.setSelection(range.index, range.length + 1, _quill2.default.sources.USER);\n } else {\n this.quill.setSelection(range.index + range.length + 1, _quill2.default.sources.USER);\n }\n }\n return false;\n }), _ref3;\n}\n\nfunction handleBackspace(range, context) {\n if (range.index === 0 || this.quill.getLength() <= 1) return;\n\n var _quill$getLine11 = this.quill.getLine(range.index),\n _quill$getLine12 = _slicedToArray(_quill$getLine11, 1),\n line = _quill$getLine12[0];\n\n var formats = {};\n if (context.offset === 0) {\n var _quill$getLine13 = this.quill.getLine(range.index - 1),\n _quill$getLine14 = _slicedToArray(_quill$getLine13, 1),\n prev = _quill$getLine14[0];\n\n if (prev != null && prev.length() > 1) {\n var curFormats = line.formats();\n var prevFormats = this.quill.getFormat(range.index - 1, 1);\n formats = _op2.default.attributes.diff(curFormats, prevFormats) || {};\n }\n }\n // Check for astral symbols\n var length = /[\\uD800-\\uDBFF][\\uDC00-\\uDFFF]$/.test(context.prefix) ? 2 : 1;\n this.quill.deleteText(range.index - length, length, _quill2.default.sources.USER);\n if (Object.keys(formats).length > 0) {\n this.quill.formatLine(range.index - length, length, formats, _quill2.default.sources.USER);\n }\n this.quill.focus();\n}\n\nfunction handleDelete(range, context) {\n // Check for astral symbols\n var length = /^[\\uD800-\\uDBFF][\\uDC00-\\uDFFF]/.test(context.suffix) ? 2 : 1;\n if (range.index >= this.quill.getLength() - length) return;\n var formats = {},\n nextLength = 0;\n\n var _quill$getLine15 = this.quill.getLine(range.index),\n _quill$getLine16 = _slicedToArray(_quill$getLine15, 1),\n line = _quill$getLine16[0];\n\n if (context.offset >= line.length() - 1) {\n var _quill$getLine17 = this.quill.getLine(range.index + 1),\n _quill$getLine18 = _slicedToArray(_quill$getLine17, 1),\n next = _quill$getLine18[0];\n\n if (next) {\n var curFormats = line.formats();\n var nextFormats = this.quill.getFormat(range.index, 1);\n formats = _op2.default.attributes.diff(curFormats, nextFormats) || {};\n nextLength = next.length();\n }\n }\n this.quill.deleteText(range.index, length, _quill2.default.sources.USER);\n if (Object.keys(formats).length > 0) {\n this.quill.formatLine(range.index + nextLength - 1, length, formats, _quill2.default.sources.USER);\n }\n}\n\nfunction handleDeleteRange(range) {\n var lines = this.quill.getLines(range);\n var formats = {};\n if (lines.length > 1) {\n var firstFormats = lines[0].formats();\n var lastFormats = lines[lines.length - 1].formats();\n formats = _op2.default.attributes.diff(lastFormats, firstFormats) || {};\n }\n this.quill.deleteText(range, _quill2.default.sources.USER);\n if (Object.keys(formats).length > 0) {\n this.quill.formatLine(range.index, 1, formats, _quill2.default.sources.USER);\n }\n this.quill.setSelection(range.index, _quill2.default.sources.SILENT);\n this.quill.focus();\n}\n\nfunction handleEnter(range, context) {\n var _this3 = this;\n\n if (range.length > 0) {\n this.quill.scroll.deleteAt(range.index, range.length); // So we do not trigger text-change\n }\n var lineFormats = Object.keys(context.format).reduce(function (lineFormats, format) {\n if (_parchment2.default.query(format, _parchment2.default.Scope.BLOCK) && !Array.isArray(context.format[format])) {\n lineFormats[format] = context.format[format];\n }\n return lineFormats;\n }, {});\n this.quill.insertText(range.index, '\\n', lineFormats, _quill2.default.sources.USER);\n // Earlier scroll.deleteAt might have messed up our selection,\n // so insertText's built in selection preservation is not reliable\n this.quill.setSelection(range.index + 1, _quill2.default.sources.SILENT);\n this.quill.focus();\n Object.keys(context.format).forEach(function (name) {\n if (lineFormats[name] != null) return;\n if (Array.isArray(context.format[name])) return;\n if (name === 'link') return;\n _this3.quill.format(name, context.format[name], _quill2.default.sources.USER);\n });\n}\n\nfunction makeCodeBlockHandler(indent) {\n return {\n key: Keyboard.keys.TAB,\n shiftKey: !indent,\n format: { 'code-block': true },\n handler: function handler(range) {\n var CodeBlock = _parchment2.default.query('code-block');\n var index = range.index,\n length = range.length;\n\n var _quill$scroll$descend = this.quill.scroll.descendant(CodeBlock, index),\n _quill$scroll$descend2 = _slicedToArray(_quill$scroll$descend, 2),\n block = _quill$scroll$descend2[0],\n offset = _quill$scroll$descend2[1];\n\n if (block == null) return;\n var scrollIndex = this.quill.getIndex(block);\n var start = block.newlineIndex(offset, true) + 1;\n var end = block.newlineIndex(scrollIndex + offset + length);\n var lines = block.domNode.textContent.slice(start, end).split('\\n');\n offset = 0;\n lines.forEach(function (line, i) {\n if (indent) {\n block.insertAt(start + offset, CodeBlock.TAB);\n offset += CodeBlock.TAB.length;\n if (i === 0) {\n index += CodeBlock.TAB.length;\n } else {\n length += CodeBlock.TAB.length;\n }\n } else if (line.startsWith(CodeBlock.TAB)) {\n block.deleteAt(start + offset, CodeBlock.TAB.length);\n offset -= CodeBlock.TAB.length;\n if (i === 0) {\n index -= CodeBlock.TAB.length;\n } else {\n length -= CodeBlock.TAB.length;\n }\n }\n offset += line.length + 1;\n });\n this.quill.update(_quill2.default.sources.USER);\n this.quill.setSelection(index, length, _quill2.default.sources.SILENT);\n }\n };\n}\n\nfunction makeFormatHandler(format) {\n return {\n key: format[0].toUpperCase(),\n shortKey: true,\n handler: function handler(range, context) {\n this.quill.format(format, !context.format[format], _quill2.default.sources.USER);\n }\n };\n}\n\nfunction normalize(binding) {\n if (typeof binding === 'string' || typeof binding === 'number') {\n return normalize({ key: binding });\n }\n if ((typeof binding === 'undefined' ? 'undefined' : _typeof(binding)) === 'object') {\n binding = (0, _clone2.default)(binding, false);\n }\n if (typeof binding.key === 'string') {\n if (Keyboard.keys[binding.key.toUpperCase()] != null) {\n binding.key = Keyboard.keys[binding.key.toUpperCase()];\n } else if (binding.key.length === 1) {\n binding.key = binding.key.toUpperCase().charCodeAt(0);\n } else {\n return null;\n }\n }\n if (binding.shortKey) {\n binding[SHORTKEY] = binding.shortKey;\n delete binding.shortKey;\n }\n return binding;\n}\n\nexports.default = Keyboard;\nexports.SHORTKEY = SHORTKEY;\n\n/***/ }),\n/* 24 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_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\"]) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); } }; }();\n\nvar _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if (\"value\" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };\n\nvar _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; }; }();\n\nvar _parchment = __webpack_require__(0);\n\nvar _parchment2 = _interopRequireDefault(_parchment);\n\nvar _text = __webpack_require__(7);\n\nvar _text2 = _interopRequireDefault(_text);\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 _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nvar Cursor = function (_Parchment$Embed) {\n _inherits(Cursor, _Parchment$Embed);\n\n _createClass(Cursor, null, [{\n key: 'value',\n value: function value() {\n return undefined;\n }\n }]);\n\n function Cursor(domNode, selection) {\n _classCallCheck(this, Cursor);\n\n var _this = _possibleConstructorReturn(this, (Cursor.__proto__ || Object.getPrototypeOf(Cursor)).call(this, domNode));\n\n _this.selection = selection;\n _this.textNode = document.createTextNode(Cursor.CONTENTS);\n _this.domNode.appendChild(_this.textNode);\n _this._length = 0;\n return _this;\n }\n\n _createClass(Cursor, [{\n key: 'detach',\n value: function detach() {\n // super.detach() will also clear domNode.__blot\n if (this.parent != null) this.parent.removeChild(this);\n }\n }, {\n key: 'format',\n value: function format(name, value) {\n if (this._length !== 0) {\n return _get(Cursor.prototype.__proto__ || Object.getPrototypeOf(Cursor.prototype), 'format', this).call(this, name, value);\n }\n var target = this,\n index = 0;\n while (target != null && target.statics.scope !== _parchment2.default.Scope.BLOCK_BLOT) {\n index += target.offset(target.parent);\n target = target.parent;\n }\n if (target != null) {\n this._length = Cursor.CONTENTS.length;\n target.optimize();\n target.formatAt(index, Cursor.CONTENTS.length, name, value);\n this._length = 0;\n }\n }\n }, {\n key: 'index',\n value: function index(node, offset) {\n if (node === this.textNode) return 0;\n return _get(Cursor.prototype.__proto__ || Object.getPrototypeOf(Cursor.prototype), 'index', this).call(this, node, offset);\n }\n }, {\n key: 'length',\n value: function length() {\n return this._length;\n }\n }, {\n key: 'position',\n value: function position() {\n return [this.textNode, this.textNode.data.length];\n }\n }, {\n key: 'remove',\n value: function remove() {\n _get(Cursor.prototype.__proto__ || Object.getPrototypeOf(Cursor.prototype), 'remove', this).call(this);\n this.parent = null;\n }\n }, {\n key: 'restore',\n value: function restore() {\n if (this.selection.composing || this.parent == null) return;\n var textNode = this.textNode;\n var range = this.selection.getNativeRange();\n var restoreText = void 0,\n start = void 0,\n end = void 0;\n if (range != null && range.start.node === textNode && range.end.node === textNode) {\n var _ref = [textNode, range.start.offset, range.end.offset];\n restoreText = _ref[0];\n start = _ref[1];\n end = _ref[2];\n }\n // Link format will insert text outside of anchor tag\n while (this.domNode.lastChild != null && this.domNode.lastChild !== this.textNode) {\n this.domNode.parentNode.insertBefore(this.domNode.lastChild, this.domNode);\n }\n if (this.textNode.data !== Cursor.CONTENTS) {\n var text = this.textNode.data.split(Cursor.CONTENTS).join('');\n if (this.next instanceof _text2.default) {\n restoreText = this.next.domNode;\n this.next.insertAt(0, text);\n this.textNode.data = Cursor.CONTENTS;\n } else {\n this.textNode.data = text;\n this.parent.insertBefore(_parchment2.default.create(this.textNode), this);\n this.textNode = document.createTextNode(Cursor.CONTENTS);\n this.domNode.appendChild(this.textNode);\n }\n }\n this.remove();\n if (start != null) {\n var _map = [start, end].map(function (offset) {\n return Math.max(0, Math.min(restoreText.data.length, offset - 1));\n });\n\n var _map2 = _slicedToArray(_map, 2);\n\n start = _map2[0];\n end = _map2[1];\n\n return {\n startNode: restoreText,\n startOffset: start,\n endNode: restoreText,\n endOffset: end\n };\n }\n }\n }, {\n key: 'update',\n value: function update(mutations, context) {\n var _this2 = this;\n\n if (mutations.some(function (mutation) {\n return mutation.type === 'characterData' && mutation.target === _this2.textNode;\n })) {\n var range = this.restore();\n if (range) context.range = range;\n }\n }\n }, {\n key: 'value',\n value: function value() {\n return '';\n }\n }]);\n\n return Cursor;\n}(_parchment2.default.Embed);\n\nCursor.blotName = 'cursor';\nCursor.className = 'ql-cursor';\nCursor.tagName = 'span';\nCursor.CONTENTS = '\\uFEFF'; // Zero width no break space\n\n\nexports.default = Cursor;\n\n/***/ }),\n/* 25 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _parchment = __webpack_require__(0);\n\nvar _parchment2 = _interopRequireDefault(_parchment);\n\nvar _block = __webpack_require__(4);\n\nvar _block2 = _interopRequireDefault(_block);\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 _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nvar Container = function (_Parchment$Container) {\n _inherits(Container, _Parchment$Container);\n\n function Container() {\n _classCallCheck(this, Container);\n\n return _possibleConstructorReturn(this, (Container.__proto__ || Object.getPrototypeOf(Container)).apply(this, arguments));\n }\n\n return Container;\n}(_parchment2.default.Container);\n\nContainer.allowedChildren = [_block2.default, _block.BlockEmbed, Container];\n\nexports.default = Container;\n\n/***/ }),\n/* 26 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.ColorStyle = exports.ColorClass = exports.ColorAttributor = undefined;\n\nvar _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; }; }();\n\nvar _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if (\"value\" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };\n\nvar _parchment = __webpack_require__(0);\n\nvar _parchment2 = _interopRequireDefault(_parchment);\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 _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nvar ColorAttributor = function (_Parchment$Attributor) {\n _inherits(ColorAttributor, _Parchment$Attributor);\n\n function ColorAttributor() {\n _classCallCheck(this, ColorAttributor);\n\n return _possibleConstructorReturn(this, (ColorAttributor.__proto__ || Object.getPrototypeOf(ColorAttributor)).apply(this, arguments));\n }\n\n _createClass(ColorAttributor, [{\n key: 'value',\n value: function value(domNode) {\n var value = _get(ColorAttributor.prototype.__proto__ || Object.getPrototypeOf(ColorAttributor.prototype), 'value', this).call(this, domNode);\n if (!value.startsWith('rgb(')) return value;\n value = value.replace(/^[^\\d]+/, '').replace(/[^\\d]+$/, '');\n return '#' + value.split(',').map(function (component) {\n return ('00' + parseInt(component).toString(16)).slice(-2);\n }).join('');\n }\n }]);\n\n return ColorAttributor;\n}(_parchment2.default.Attributor.Style);\n\nvar ColorClass = new _parchment2.default.Attributor.Class('color', 'ql-color', {\n scope: _parchment2.default.Scope.INLINE\n});\nvar ColorStyle = new ColorAttributor('color', 'color', {\n scope: _parchment2.default.Scope.INLINE\n});\n\nexports.ColorAttributor = ColorAttributor;\nexports.ColorClass = ColorClass;\nexports.ColorStyle = ColorStyle;\n\n/***/ }),\n/* 27 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.sanitize = exports.default = undefined;\n\nvar _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; }; }();\n\nvar _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if (\"value\" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };\n\nvar _inline = __webpack_require__(6);\n\nvar _inline2 = _interopRequireDefault(_inline);\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 _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nvar Link = function (_Inline) {\n _inherits(Link, _Inline);\n\n function Link() {\n _classCallCheck(this, Link);\n\n return _possibleConstructorReturn(this, (Link.__proto__ || Object.getPrototypeOf(Link)).apply(this, arguments));\n }\n\n _createClass(Link, [{\n key: 'format',\n value: function format(name, value) {\n if (name !== this.statics.blotName || !value) return _get(Link.prototype.__proto__ || Object.getPrototypeOf(Link.prototype), 'format', this).call(this, name, value);\n value = this.constructor.sanitize(value);\n this.domNode.setAttribute('href', value);\n }\n }], [{\n key: 'create',\n value: function create(value) {\n var node = _get(Link.__proto__ || Object.getPrototypeOf(Link), 'create', this).call(this, value);\n value = this.sanitize(value);\n node.setAttribute('href', value);\n node.setAttribute('rel', 'noopener noreferrer');\n node.setAttribute('target', '_blank');\n return node;\n }\n }, {\n key: 'formats',\n value: function formats(domNode) {\n return domNode.getAttribute('href');\n }\n }, {\n key: 'sanitize',\n value: function sanitize(url) {\n return _sanitize(url, this.PROTOCOL_WHITELIST) ? url : this.SANITIZED_URL;\n }\n }]);\n\n return Link;\n}(_inline2.default);\n\nLink.blotName = 'link';\nLink.tagName = 'A';\nLink.SANITIZED_URL = 'about:blank';\nLink.PROTOCOL_WHITELIST = ['http', 'https', 'mailto', 'tel'];\n\nfunction _sanitize(url, protocols) {\n var anchor = document.createElement('a');\n anchor.href = url;\n var protocol = anchor.href.slice(0, anchor.href.indexOf(':'));\n return protocols.indexOf(protocol) > -1;\n}\n\nexports.default = Link;\nexports.sanitize = _sanitize;\n\n/***/ }),\n/* 28 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _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; };\n\nvar _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; }; }();\n\nvar _keyboard = __webpack_require__(23);\n\nvar _keyboard2 = _interopRequireDefault(_keyboard);\n\nvar _dropdown = __webpack_require__(107);\n\nvar _dropdown2 = _interopRequireDefault(_dropdown);\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\nvar optionsCounter = 0;\n\nfunction toggleAriaAttribute(element, attribute) {\n element.setAttribute(attribute, !(element.getAttribute(attribute) === 'true'));\n}\n\nvar Picker = function () {\n function Picker(select) {\n var _this = this;\n\n _classCallCheck(this, Picker);\n\n this.select = select;\n this.container = document.createElement('span');\n this.buildPicker();\n this.select.style.display = 'none';\n this.select.parentNode.insertBefore(this.container, this.select);\n\n this.label.addEventListener('mousedown', function () {\n _this.togglePicker();\n });\n this.label.addEventListener('keydown', function (event) {\n switch (event.keyCode) {\n // Allows the \"Enter\" key to open the picker\n case _keyboard2.default.keys.ENTER:\n _this.togglePicker();\n break;\n\n // Allows the \"Escape\" key to close the picker\n case _keyboard2.default.keys.ESCAPE:\n _this.escape();\n event.preventDefault();\n break;\n default:\n }\n });\n this.select.addEventListener('change', this.update.bind(this));\n }\n\n _createClass(Picker, [{\n key: 'togglePicker',\n value: function togglePicker() {\n this.container.classList.toggle('ql-expanded');\n // Toggle aria-expanded and aria-hidden to make the picker accessible\n toggleAriaAttribute(this.label, 'aria-expanded');\n toggleAriaAttribute(this.options, 'aria-hidden');\n }\n }, {\n key: 'buildItem',\n value: function buildItem(option) {\n var _this2 = this;\n\n var item = document.createElement('span');\n item.tabIndex = '0';\n item.setAttribute('role', 'button');\n\n item.classList.add('ql-picker-item');\n if (option.hasAttribute('value')) {\n item.setAttribute('data-value', option.getAttribute('value'));\n }\n if (option.textContent) {\n item.setAttribute('data-label', option.textContent);\n }\n item.addEventListener('click', function () {\n _this2.selectItem(item, true);\n });\n item.addEventListener('keydown', function (event) {\n switch (event.keyCode) {\n // Allows the \"Enter\" key to select an item\n case _keyboard2.default.keys.ENTER:\n _this2.selectItem(item, true);\n event.preventDefault();\n break;\n\n // Allows the \"Escape\" key to close the picker\n case _keyboard2.default.keys.ESCAPE:\n _this2.escape();\n event.preventDefault();\n break;\n default:\n }\n });\n\n return item;\n }\n }, {\n key: 'buildLabel',\n value: function buildLabel() {\n var label = document.createElement('span');\n label.classList.add('ql-picker-label');\n label.innerHTML = _dropdown2.default;\n label.tabIndex = '0';\n label.setAttribute('role', 'button');\n label.setAttribute('aria-expanded', 'false');\n this.container.appendChild(label);\n return label;\n }\n }, {\n key: 'buildOptions',\n value: function buildOptions() {\n var _this3 = this;\n\n var options = document.createElement('span');\n options.classList.add('ql-picker-options');\n\n // Don't want screen readers to read this until options are visible\n options.setAttribute('aria-hidden', 'true');\n options.tabIndex = '-1';\n\n // Need a unique id for aria-controls\n options.id = 'ql-picker-options-' + optionsCounter;\n optionsCounter += 1;\n this.label.setAttribute('aria-controls', options.id);\n\n this.options = options;\n\n [].slice.call(this.select.options).forEach(function (option) {\n var item = _this3.buildItem(option);\n options.appendChild(item);\n if (option.selected === true) {\n _this3.selectItem(item);\n }\n });\n this.container.appendChild(options);\n }\n }, {\n key: 'buildPicker',\n value: function buildPicker() {\n var _this4 = this;\n\n [].slice.call(this.select.attributes).forEach(function (item) {\n _this4.container.setAttribute(item.name, item.value);\n });\n this.container.classList.add('ql-picker');\n this.label = this.buildLabel();\n this.buildOptions();\n }\n }, {\n key: 'escape',\n value: function escape() {\n var _this5 = this;\n\n // Close menu and return focus to trigger label\n this.close();\n // Need setTimeout for accessibility to ensure that the browser executes\n // focus on the next process thread and after any DOM content changes\n setTimeout(function () {\n return _this5.label.focus();\n }, 1);\n }\n }, {\n key: 'close',\n value: function close() {\n this.container.classList.remove('ql-expanded');\n this.label.setAttribute('aria-expanded', 'false');\n this.options.setAttribute('aria-hidden', 'true');\n }\n }, {\n key: 'selectItem',\n value: function selectItem(item) {\n var trigger = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n\n var selected = this.container.querySelector('.ql-selected');\n if (item === selected) return;\n if (selected != null) {\n selected.classList.remove('ql-selected');\n }\n if (item == null) return;\n item.classList.add('ql-selected');\n this.select.selectedIndex = [].indexOf.call(item.parentNode.children, item);\n if (item.hasAttribute('data-value')) {\n this.label.setAttribute('data-value', item.getAttribute('data-value'));\n } else {\n this.label.removeAttribute('data-value');\n }\n if (item.hasAttribute('data-label')) {\n this.label.setAttribute('data-label', item.getAttribute('data-label'));\n } else {\n this.label.removeAttribute('data-label');\n }\n if (trigger) {\n if (typeof Event === 'function') {\n this.select.dispatchEvent(new Event('change'));\n } else if ((typeof Event === 'undefined' ? 'undefined' : _typeof(Event)) === 'object') {\n // IE11\n var event = document.createEvent('Event');\n event.initEvent('change', true, true);\n this.select.dispatchEvent(event);\n }\n this.close();\n }\n }\n }, {\n key: 'update',\n value: function update() {\n var option = void 0;\n if (this.select.selectedIndex > -1) {\n var item = this.container.querySelector('.ql-picker-options').children[this.select.selectedIndex];\n option = this.select.options[this.select.selectedIndex];\n this.selectItem(item);\n } else {\n this.selectItem(null);\n }\n var isActive = option != null && option !== this.select.querySelector('option[selected]');\n this.label.classList.toggle('ql-active', isActive);\n }\n }]);\n\n return Picker;\n}();\n\nexports.default = Picker;\n\n/***/ }),\n/* 29 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _parchment = __webpack_require__(0);\n\nvar _parchment2 = _interopRequireDefault(_parchment);\n\nvar _quill = __webpack_require__(5);\n\nvar _quill2 = _interopRequireDefault(_quill);\n\nvar _block = __webpack_require__(4);\n\nvar _block2 = _interopRequireDefault(_block);\n\nvar _break = __webpack_require__(16);\n\nvar _break2 = _interopRequireDefault(_break);\n\nvar _container = __webpack_require__(25);\n\nvar _container2 = _interopRequireDefault(_container);\n\nvar _cursor = __webpack_require__(24);\n\nvar _cursor2 = _interopRequireDefault(_cursor);\n\nvar _embed = __webpack_require__(35);\n\nvar _embed2 = _interopRequireDefault(_embed);\n\nvar _inline = __webpack_require__(6);\n\nvar _inline2 = _interopRequireDefault(_inline);\n\nvar _scroll = __webpack_require__(22);\n\nvar _scroll2 = _interopRequireDefault(_scroll);\n\nvar _text = __webpack_require__(7);\n\nvar _text2 = _interopRequireDefault(_text);\n\nvar _clipboard = __webpack_require__(55);\n\nvar _clipboard2 = _interopRequireDefault(_clipboard);\n\nvar _history = __webpack_require__(42);\n\nvar _history2 = _interopRequireDefault(_history);\n\nvar _keyboard = __webpack_require__(23);\n\nvar _keyboard2 = _interopRequireDefault(_keyboard);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n_quill2.default.register({\n 'blots/block': _block2.default,\n 'blots/block/embed': _block.BlockEmbed,\n 'blots/break': _break2.default,\n 'blots/container': _container2.default,\n 'blots/cursor': _cursor2.default,\n 'blots/embed': _embed2.default,\n 'blots/inline': _inline2.default,\n 'blots/scroll': _scroll2.default,\n 'blots/text': _text2.default,\n\n 'modules/clipboard': _clipboard2.default,\n 'modules/history': _history2.default,\n 'modules/keyboard': _keyboard2.default\n});\n\n_parchment2.default.register(_block2.default, _break2.default, _cursor2.default, _inline2.default, _scroll2.default, _text2.default);\n\nexports.default = _quill2.default;\n\n/***/ }),\n/* 30 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar Registry = __webpack_require__(1);\nvar ShadowBlot = /** @class */ (function () {\n function ShadowBlot(domNode) {\n this.domNode = domNode;\n // @ts-ignore\n this.domNode[Registry.DATA_KEY] = { blot: this };\n }\n Object.defineProperty(ShadowBlot.prototype, \"statics\", {\n // Hack for accessing inherited static methods\n get: function () {\n return this.constructor;\n },\n enumerable: true,\n configurable: true\n });\n ShadowBlot.create = function (value) {\n if (this.tagName == null) {\n throw new Registry.ParchmentError('Blot definition missing tagName');\n }\n var node;\n if (Array.isArray(this.tagName)) {\n if (typeof value === 'string') {\n value = value.toUpperCase();\n if (parseInt(value).toString() === value) {\n value = parseInt(value);\n }\n }\n if (typeof value === 'number') {\n node = document.createElement(this.tagName[value - 1]);\n }\n else if (this.tagName.indexOf(value) > -1) {\n node = document.createElement(value);\n }\n else {\n node = document.createElement(this.tagName[0]);\n }\n }\n else {\n node = document.createElement(this.tagName);\n }\n if (this.className) {\n node.classList.add(this.className);\n }\n return node;\n };\n ShadowBlot.prototype.attach = function () {\n if (this.parent != null) {\n this.scroll = this.parent.scroll;\n }\n };\n ShadowBlot.prototype.clone = function () {\n var domNode = this.domNode.cloneNode(false);\n return Registry.create(domNode);\n };\n ShadowBlot.prototype.detach = function () {\n if (this.parent != null)\n this.parent.removeChild(this);\n // @ts-ignore\n delete this.domNode[Registry.DATA_KEY];\n };\n ShadowBlot.prototype.deleteAt = function (index, length) {\n var blot = this.isolate(index, length);\n blot.remove();\n };\n ShadowBlot.prototype.formatAt = function (index, length, name, value) {\n var blot = this.isolate(index, length);\n if (Registry.query(name, Registry.Scope.BLOT) != null && value) {\n blot.wrap(name, value);\n }\n else if (Registry.query(name, Registry.Scope.ATTRIBUTE) != null) {\n var parent = Registry.create(this.statics.scope);\n blot.wrap(parent);\n parent.format(name, value);\n }\n };\n ShadowBlot.prototype.insertAt = function (index, value, def) {\n var blot = def == null ? Registry.create('text', value) : Registry.create(value, def);\n var ref = this.split(index);\n this.parent.insertBefore(blot, ref);\n };\n ShadowBlot.prototype.insertInto = function (parentBlot, refBlot) {\n if (refBlot === void 0) { refBlot = null; }\n if (this.parent != null) {\n this.parent.children.remove(this);\n }\n var refDomNode = null;\n parentBlot.children.insertBefore(this, refBlot);\n if (refBlot != null) {\n refDomNode = refBlot.domNode;\n }\n if (this.domNode.parentNode != parentBlot.domNode ||\n this.domNode.nextSibling != refDomNode) {\n parentBlot.domNode.insertBefore(this.domNode, refDomNode);\n }\n this.parent = parentBlot;\n this.attach();\n };\n ShadowBlot.prototype.isolate = function (index, length) {\n var target = this.split(index);\n target.split(length);\n return target;\n };\n ShadowBlot.prototype.length = function () {\n return 1;\n };\n ShadowBlot.prototype.offset = function (root) {\n if (root === void 0) { root = this.parent; }\n if (this.parent == null || this == root)\n return 0;\n return this.parent.children.offset(this) + this.parent.offset(root);\n };\n ShadowBlot.prototype.optimize = function (context) {\n // TODO clean up once we use WeakMap\n // @ts-ignore\n if (this.domNode[Registry.DATA_KEY] != null) {\n // @ts-ignore\n delete this.domNode[Registry.DATA_KEY].mutations;\n }\n };\n ShadowBlot.prototype.remove = function () {\n if (this.domNode.parentNode != null) {\n this.domNode.parentNode.removeChild(this.domNode);\n }\n this.detach();\n };\n ShadowBlot.prototype.replace = function (target) {\n if (target.parent == null)\n return;\n target.parent.insertBefore(this, target.next);\n target.remove();\n };\n ShadowBlot.prototype.replaceWith = function (name, value) {\n var replacement = typeof name === 'string' ? Registry.create(name, value) : name;\n replacement.replace(this);\n return replacement;\n };\n ShadowBlot.prototype.split = function (index, force) {\n return index === 0 ? this : this.next;\n };\n ShadowBlot.prototype.update = function (mutations, context) {\n // Nothing to do by default\n };\n ShadowBlot.prototype.wrap = function (name, value) {\n var wrapper = typeof name === 'string' ? Registry.create(name, value) : name;\n if (this.parent != null) {\n this.parent.insertBefore(wrapper, this.next);\n }\n wrapper.appendChild(this);\n return wrapper;\n };\n ShadowBlot.blotName = 'abstract';\n return ShadowBlot;\n}());\nexports.default = ShadowBlot;\n\n\n/***/ }),\n/* 31 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar attributor_1 = __webpack_require__(12);\nvar class_1 = __webpack_require__(32);\nvar style_1 = __webpack_require__(33);\nvar Registry = __webpack_require__(1);\nvar AttributorStore = /** @class */ (function () {\n function AttributorStore(domNode) {\n this.attributes = {};\n this.domNode = domNode;\n this.build();\n }\n AttributorStore.prototype.attribute = function (attribute, value) {\n // verb\n if (value) {\n if (attribute.add(this.domNode, value)) {\n if (attribute.value(this.domNode) != null) {\n this.attributes[attribute.attrName] = attribute;\n }\n else {\n delete this.attributes[attribute.attrName];\n }\n }\n }\n else {\n attribute.remove(this.domNode);\n delete this.attributes[attribute.attrName];\n }\n };\n AttributorStore.prototype.build = function () {\n var _this = this;\n this.attributes = {};\n var attributes = attributor_1.default.keys(this.domNode);\n var classes = class_1.default.keys(this.domNode);\n var styles = style_1.default.keys(this.domNode);\n attributes\n .concat(classes)\n .concat(styles)\n .forEach(function (name) {\n var attr = Registry.query(name, Registry.Scope.ATTRIBUTE);\n if (attr instanceof attributor_1.default) {\n _this.attributes[attr.attrName] = attr;\n }\n });\n };\n AttributorStore.prototype.copy = function (target) {\n var _this = this;\n Object.keys(this.attributes).forEach(function (key) {\n var value = _this.attributes[key].value(_this.domNode);\n target.format(key, value);\n });\n };\n AttributorStore.prototype.move = function (target) {\n var _this = this;\n this.copy(target);\n Object.keys(this.attributes).forEach(function (key) {\n _this.attributes[key].remove(_this.domNode);\n });\n this.attributes = {};\n };\n AttributorStore.prototype.values = function () {\n var _this = this;\n return Object.keys(this.attributes).reduce(function (attributes, name) {\n attributes[name] = _this.attributes[name].value(_this.domNode);\n return attributes;\n }, {});\n };\n return AttributorStore;\n}());\nexports.default = AttributorStore;\n\n\n/***/ }),\n/* 32 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar attributor_1 = __webpack_require__(12);\nfunction match(node, prefix) {\n var className = node.getAttribute('class') || '';\n return className.split(/\\s+/).filter(function (name) {\n return name.indexOf(prefix + \"-\") === 0;\n });\n}\nvar ClassAttributor = /** @class */ (function (_super) {\n __extends(ClassAttributor, _super);\n function ClassAttributor() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n ClassAttributor.keys = function (node) {\n return (node.getAttribute('class') || '').split(/\\s+/).map(function (name) {\n return name\n .split('-')\n .slice(0, -1)\n .join('-');\n });\n };\n ClassAttributor.prototype.add = function (node, value) {\n if (!this.canAdd(node, value))\n return false;\n this.remove(node);\n node.classList.add(this.keyName + \"-\" + value);\n return true;\n };\n ClassAttributor.prototype.remove = function (node) {\n var matches = match(node, this.keyName);\n matches.forEach(function (name) {\n node.classList.remove(name);\n });\n if (node.classList.length === 0) {\n node.removeAttribute('class');\n }\n };\n ClassAttributor.prototype.value = function (node) {\n var result = match(node, this.keyName)[0] || '';\n var value = result.slice(this.keyName.length + 1); // +1 for hyphen\n return this.canAdd(node, value) ? value : '';\n };\n return ClassAttributor;\n}(attributor_1.default));\nexports.default = ClassAttributor;\n\n\n/***/ }),\n/* 33 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar attributor_1 = __webpack_require__(12);\nfunction camelize(name) {\n var parts = name.split('-');\n var rest = parts\n .slice(1)\n .map(function (part) {\n return part[0].toUpperCase() + part.slice(1);\n })\n .join('');\n return parts[0] + rest;\n}\nvar StyleAttributor = /** @class */ (function (_super) {\n __extends(StyleAttributor, _super);\n function StyleAttributor() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n StyleAttributor.keys = function (node) {\n return (node.getAttribute('style') || '').split(';').map(function (value) {\n var arr = value.split(':');\n return arr[0].trim();\n });\n };\n StyleAttributor.prototype.add = function (node, value) {\n if (!this.canAdd(node, value))\n return false;\n // @ts-ignore\n node.style[camelize(this.keyName)] = value;\n return true;\n };\n StyleAttributor.prototype.remove = function (node) {\n // @ts-ignore\n node.style[camelize(this.keyName)] = '';\n if (!node.getAttribute('style')) {\n node.removeAttribute('style');\n }\n };\n StyleAttributor.prototype.value = function (node) {\n // @ts-ignore\n var value = node.style[camelize(this.keyName)];\n return this.canAdd(node, value) ? value : '';\n };\n return StyleAttributor;\n}(attributor_1.default));\nexports.default = StyleAttributor;\n\n\n/***/ }),\n/* 34 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _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; }; }();\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nvar Theme = function () {\n function Theme(quill, options) {\n _classCallCheck(this, Theme);\n\n this.quill = quill;\n this.options = options;\n this.modules = {};\n }\n\n _createClass(Theme, [{\n key: 'init',\n value: function init() {\n var _this = this;\n\n Object.keys(this.options.modules).forEach(function (name) {\n if (_this.modules[name] == null) {\n _this.addModule(name);\n }\n });\n }\n }, {\n key: 'addModule',\n value: function addModule(name) {\n var moduleClass = this.quill.constructor.import('modules/' + name);\n this.modules[name] = new moduleClass(this.quill, this.options.modules[name] || {});\n return this.modules[name];\n }\n }]);\n\n return Theme;\n}();\n\nTheme.DEFAULTS = {\n modules: {}\n};\nTheme.themes = {\n 'default': Theme\n};\n\nexports.default = Theme;\n\n/***/ }),\n/* 35 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _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; }; }();\n\nvar _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if (\"value\" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };\n\nvar _parchment = __webpack_require__(0);\n\nvar _parchment2 = _interopRequireDefault(_parchment);\n\nvar _text = __webpack_require__(7);\n\nvar _text2 = _interopRequireDefault(_text);\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 _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nvar GUARD_TEXT = '\\uFEFF';\n\nvar Embed = function (_Parchment$Embed) {\n _inherits(Embed, _Parchment$Embed);\n\n function Embed(node) {\n _classCallCheck(this, Embed);\n\n var _this = _possibleConstructorReturn(this, (Embed.__proto__ || Object.getPrototypeOf(Embed)).call(this, node));\n\n _this.contentNode = document.createElement('span');\n _this.contentNode.setAttribute('contenteditable', false);\n [].slice.call(_this.domNode.childNodes).forEach(function (childNode) {\n _this.contentNode.appendChild(childNode);\n });\n _this.leftGuard = document.createTextNode(GUARD_TEXT);\n _this.rightGuard = document.createTextNode(GUARD_TEXT);\n _this.domNode.appendChild(_this.leftGuard);\n _this.domNode.appendChild(_this.contentNode);\n _this.domNode.appendChild(_this.rightGuard);\n return _this;\n }\n\n _createClass(Embed, [{\n key: 'index',\n value: function index(node, offset) {\n if (node === this.leftGuard) return 0;\n if (node === this.rightGuard) return 1;\n return _get(Embed.prototype.__proto__ || Object.getPrototypeOf(Embed.prototype), 'index', this).call(this, node, offset);\n }\n }, {\n key: 'restore',\n value: function restore(node) {\n var range = void 0,\n textNode = void 0;\n var text = node.data.split(GUARD_TEXT).join('');\n if (node === this.leftGuard) {\n if (this.prev instanceof _text2.default) {\n var prevLength = this.prev.length();\n this.prev.insertAt(prevLength, text);\n range = {\n startNode: this.prev.domNode,\n startOffset: prevLength + text.length\n };\n } else {\n textNode = document.createTextNode(text);\n this.parent.insertBefore(_parchment2.default.create(textNode), this);\n range = {\n startNode: textNode,\n startOffset: text.length\n };\n }\n } else if (node === this.rightGuard) {\n if (this.next instanceof _text2.default) {\n this.next.insertAt(0, text);\n range = {\n startNode: this.next.domNode,\n startOffset: text.length\n };\n } else {\n textNode = document.createTextNode(text);\n this.parent.insertBefore(_parchment2.default.create(textNode), this.next);\n range = {\n startNode: textNode,\n startOffset: text.length\n };\n }\n }\n node.data = GUARD_TEXT;\n return range;\n }\n }, {\n key: 'update',\n value: function update(mutations, context) {\n var _this2 = this;\n\n mutations.forEach(function (mutation) {\n if (mutation.type === 'characterData' && (mutation.target === _this2.leftGuard || mutation.target === _this2.rightGuard)) {\n var range = _this2.restore(mutation.target);\n if (range) context.range = range;\n }\n });\n }\n }]);\n\n return Embed;\n}(_parchment2.default.Embed);\n\nexports.default = Embed;\n\n/***/ }),\n/* 36 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.AlignStyle = exports.AlignClass = exports.AlignAttribute = undefined;\n\nvar _parchment = __webpack_require__(0);\n\nvar _parchment2 = _interopRequireDefault(_parchment);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar config = {\n scope: _parchment2.default.Scope.BLOCK,\n whitelist: ['right', 'center', 'justify']\n};\n\nvar AlignAttribute = new _parchment2.default.Attributor.Attribute('align', 'align', config);\nvar AlignClass = new _parchment2.default.Attributor.Class('align', 'ql-align', config);\nvar AlignStyle = new _parchment2.default.Attributor.Style('align', 'text-align', config);\n\nexports.AlignAttribute = AlignAttribute;\nexports.AlignClass = AlignClass;\nexports.AlignStyle = AlignStyle;\n\n/***/ }),\n/* 37 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.BackgroundStyle = exports.BackgroundClass = undefined;\n\nvar _parchment = __webpack_require__(0);\n\nvar _parchment2 = _interopRequireDefault(_parchment);\n\nvar _color = __webpack_require__(26);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar BackgroundClass = new _parchment2.default.Attributor.Class('background', 'ql-bg', {\n scope: _parchment2.default.Scope.INLINE\n});\nvar BackgroundStyle = new _color.ColorAttributor('background', 'background-color', {\n scope: _parchment2.default.Scope.INLINE\n});\n\nexports.BackgroundClass = BackgroundClass;\nexports.BackgroundStyle = BackgroundStyle;\n\n/***/ }),\n/* 38 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.DirectionStyle = exports.DirectionClass = exports.DirectionAttribute = undefined;\n\nvar _parchment = __webpack_require__(0);\n\nvar _parchment2 = _interopRequireDefault(_parchment);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar config = {\n scope: _parchment2.default.Scope.BLOCK,\n whitelist: ['rtl']\n};\n\nvar DirectionAttribute = new _parchment2.default.Attributor.Attribute('direction', 'dir', config);\nvar DirectionClass = new _parchment2.default.Attributor.Class('direction', 'ql-direction', config);\nvar DirectionStyle = new _parchment2.default.Attributor.Style('direction', 'direction', config);\n\nexports.DirectionAttribute = DirectionAttribute;\nexports.DirectionClass = DirectionClass;\nexports.DirectionStyle = DirectionStyle;\n\n/***/ }),\n/* 39 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.FontClass = exports.FontStyle = undefined;\n\nvar _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; }; }();\n\nvar _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if (\"value\" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };\n\nvar _parchment = __webpack_require__(0);\n\nvar _parchment2 = _interopRequireDefault(_parchment);\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 _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nvar config = {\n scope: _parchment2.default.Scope.INLINE,\n whitelist: ['serif', 'monospace']\n};\n\nvar FontClass = new _parchment2.default.Attributor.Class('font', 'ql-font', config);\n\nvar FontStyleAttributor = function (_Parchment$Attributor) {\n _inherits(FontStyleAttributor, _Parchment$Attributor);\n\n function FontStyleAttributor() {\n _classCallCheck(this, FontStyleAttributor);\n\n return _possibleConstructorReturn(this, (FontStyleAttributor.__proto__ || Object.getPrototypeOf(FontStyleAttributor)).apply(this, arguments));\n }\n\n _createClass(FontStyleAttributor, [{\n key: 'value',\n value: function value(node) {\n return _get(FontStyleAttributor.prototype.__proto__ || Object.getPrototypeOf(FontStyleAttributor.prototype), 'value', this).call(this, node).replace(/[\"']/g, '');\n }\n }]);\n\n return FontStyleAttributor;\n}(_parchment2.default.Attributor.Style);\n\nvar FontStyle = new FontStyleAttributor('font', 'font-family', config);\n\nexports.FontStyle = FontStyle;\nexports.FontClass = FontClass;\n\n/***/ }),\n/* 40 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.SizeStyle = exports.SizeClass = undefined;\n\nvar _parchment = __webpack_require__(0);\n\nvar _parchment2 = _interopRequireDefault(_parchment);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar SizeClass = new _parchment2.default.Attributor.Class('size', 'ql-size', {\n scope: _parchment2.default.Scope.INLINE,\n whitelist: ['small', 'large', 'huge']\n});\nvar SizeStyle = new _parchment2.default.Attributor.Style('size', 'font-size', {\n scope: _parchment2.default.Scope.INLINE,\n whitelist: ['10px', '18px', '32px']\n});\n\nexports.SizeClass = SizeClass;\nexports.SizeStyle = SizeStyle;\n\n/***/ }),\n/* 41 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nmodule.exports = {\n 'align': {\n '': __webpack_require__(76),\n 'center': __webpack_require__(77),\n 'right': __webpack_require__(78),\n 'justify': __webpack_require__(79)\n },\n 'background': __webpack_require__(80),\n 'blockquote': __webpack_require__(81),\n 'bold': __webpack_require__(82),\n 'clean': __webpack_require__(83),\n 'code': __webpack_require__(58),\n 'code-block': __webpack_require__(58),\n 'color': __webpack_require__(84),\n 'direction': {\n '': __webpack_require__(85),\n 'rtl': __webpack_require__(86)\n },\n 'float': {\n 'center': __webpack_require__(87),\n 'full': __webpack_require__(88),\n 'left': __webpack_require__(89),\n 'right': __webpack_require__(90)\n },\n 'formula': __webpack_require__(91),\n 'header': {\n '1': __webpack_require__(92),\n '2': __webpack_require__(93)\n },\n 'italic': __webpack_require__(94),\n 'image': __webpack_require__(95),\n 'indent': {\n '+1': __webpack_require__(96),\n '-1': __webpack_require__(97)\n },\n 'link': __webpack_require__(98),\n 'list': {\n 'ordered': __webpack_require__(99),\n 'bullet': __webpack_require__(100),\n 'check': __webpack_require__(101)\n },\n 'script': {\n 'sub': __webpack_require__(102),\n 'super': __webpack_require__(103)\n },\n 'strike': __webpack_require__(104),\n 'underline': __webpack_require__(105),\n 'video': __webpack_require__(106)\n};\n\n/***/ }),\n/* 42 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.getLastChangeIndex = exports.default = undefined;\n\nvar _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; }; }();\n\nvar _parchment = __webpack_require__(0);\n\nvar _parchment2 = _interopRequireDefault(_parchment);\n\nvar _quill = __webpack_require__(5);\n\nvar _quill2 = _interopRequireDefault(_quill);\n\nvar _module = __webpack_require__(9);\n\nvar _module2 = _interopRequireDefault(_module);\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 _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nvar History = function (_Module) {\n _inherits(History, _Module);\n\n function History(quill, options) {\n _classCallCheck(this, History);\n\n var _this = _possibleConstructorReturn(this, (History.__proto__ || Object.getPrototypeOf(History)).call(this, quill, options));\n\n _this.lastRecorded = 0;\n _this.ignoreChange = false;\n _this.clear();\n _this.quill.on(_quill2.default.events.EDITOR_CHANGE, function (eventName, delta, oldDelta, source) {\n if (eventName !== _quill2.default.events.TEXT_CHANGE || _this.ignoreChange) return;\n if (!_this.options.userOnly || source === _quill2.default.sources.USER) {\n _this.record(delta, oldDelta);\n } else {\n _this.transform(delta);\n }\n });\n _this.quill.keyboard.addBinding({ key: 'Z', shortKey: true }, _this.undo.bind(_this));\n _this.quill.keyboard.addBinding({ key: 'Z', shortKey: true, shiftKey: true }, _this.redo.bind(_this));\n if (/Win/i.test(navigator.platform)) {\n _this.quill.keyboard.addBinding({ key: 'Y', shortKey: true }, _this.redo.bind(_this));\n }\n return _this;\n }\n\n _createClass(History, [{\n key: 'change',\n value: function change(source, dest) {\n if (this.stack[source].length === 0) return;\n var delta = this.stack[source].pop();\n this.stack[dest].push(delta);\n this.lastRecorded = 0;\n this.ignoreChange = true;\n this.quill.updateContents(delta[source], _quill2.default.sources.USER);\n this.ignoreChange = false;\n var index = getLastChangeIndex(delta[source]);\n this.quill.setSelection(index);\n }\n }, {\n key: 'clear',\n value: function clear() {\n this.stack = { undo: [], redo: [] };\n }\n }, {\n key: 'cutoff',\n value: function cutoff() {\n this.lastRecorded = 0;\n }\n }, {\n key: 'record',\n value: function record(changeDelta, oldDelta) {\n if (changeDelta.ops.length === 0) return;\n this.stack.redo = [];\n var undoDelta = this.quill.getContents().diff(oldDelta);\n var timestamp = Date.now();\n if (this.lastRecorded + this.options.delay > timestamp && this.stack.undo.length > 0) {\n var delta = this.stack.undo.pop();\n undoDelta = undoDelta.compose(delta.undo);\n changeDelta = delta.redo.compose(changeDelta);\n } else {\n this.lastRecorded = timestamp;\n }\n this.stack.undo.push({\n redo: changeDelta,\n undo: undoDelta\n });\n if (this.stack.undo.length > this.options.maxStack) {\n this.stack.undo.shift();\n }\n }\n }, {\n key: 'redo',\n value: function redo() {\n this.change('redo', 'undo');\n }\n }, {\n key: 'transform',\n value: function transform(delta) {\n this.stack.undo.forEach(function (change) {\n change.undo = delta.transform(change.undo, true);\n change.redo = delta.transform(change.redo, true);\n });\n this.stack.redo.forEach(function (change) {\n change.undo = delta.transform(change.undo, true);\n change.redo = delta.transform(change.redo, true);\n });\n }\n }, {\n key: 'undo',\n value: function undo() {\n this.change('undo', 'redo');\n }\n }]);\n\n return History;\n}(_module2.default);\n\nHistory.DEFAULTS = {\n delay: 1000,\n maxStack: 100,\n userOnly: false\n};\n\nfunction endsWithNewlineChange(delta) {\n var lastOp = delta.ops[delta.ops.length - 1];\n if (lastOp == null) return false;\n if (lastOp.insert != null) {\n return typeof lastOp.insert === 'string' && lastOp.insert.endsWith('\\n');\n }\n if (lastOp.attributes != null) {\n return Object.keys(lastOp.attributes).some(function (attr) {\n return _parchment2.default.query(attr, _parchment2.default.Scope.BLOCK) != null;\n });\n }\n return false;\n}\n\nfunction getLastChangeIndex(delta) {\n var deleteLength = delta.reduce(function (length, op) {\n length += op.delete || 0;\n return length;\n }, 0);\n var changeIndex = delta.length() - deleteLength;\n if (endsWithNewlineChange(delta)) {\n changeIndex -= 1;\n }\n return changeIndex;\n}\n\nexports.default = History;\nexports.getLastChangeIndex = getLastChangeIndex;\n\n/***/ }),\n/* 43 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = exports.BaseTooltip = undefined;\n\nvar _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; }; }();\n\nvar _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if (\"value\" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };\n\nvar _extend = __webpack_require__(3);\n\nvar _extend2 = _interopRequireDefault(_extend);\n\nvar _quillDelta = __webpack_require__(2);\n\nvar _quillDelta2 = _interopRequireDefault(_quillDelta);\n\nvar _emitter = __webpack_require__(8);\n\nvar _emitter2 = _interopRequireDefault(_emitter);\n\nvar _keyboard = __webpack_require__(23);\n\nvar _keyboard2 = _interopRequireDefault(_keyboard);\n\nvar _theme = __webpack_require__(34);\n\nvar _theme2 = _interopRequireDefault(_theme);\n\nvar _colorPicker = __webpack_require__(59);\n\nvar _colorPicker2 = _interopRequireDefault(_colorPicker);\n\nvar _iconPicker = __webpack_require__(60);\n\nvar _iconPicker2 = _interopRequireDefault(_iconPicker);\n\nvar _picker = __webpack_require__(28);\n\nvar _picker2 = _interopRequireDefault(_picker);\n\nvar _tooltip = __webpack_require__(61);\n\nvar _tooltip2 = _interopRequireDefault(_tooltip);\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 _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nvar ALIGNS = [false, 'center', 'right', 'justify'];\n\nvar COLORS = [\"#000000\", \"#e60000\", \"#ff9900\", \"#ffff00\", \"#008a00\", \"#0066cc\", \"#9933ff\", \"#ffffff\", \"#facccc\", \"#ffebcc\", \"#ffffcc\", \"#cce8cc\", \"#cce0f5\", \"#ebd6ff\", \"#bbbbbb\", \"#f06666\", \"#ffc266\", \"#ffff66\", \"#66b966\", \"#66a3e0\", \"#c285ff\", \"#888888\", \"#a10000\", \"#b26b00\", \"#b2b200\", \"#006100\", \"#0047b2\", \"#6b24b2\", \"#444444\", \"#5c0000\", \"#663d00\", \"#666600\", \"#003700\", \"#002966\", \"#3d1466\"];\n\nvar FONTS = [false, 'serif', 'monospace'];\n\nvar HEADERS = ['1', '2', '3', false];\n\nvar SIZES = ['small', false, 'large', 'huge'];\n\nvar BaseTheme = function (_Theme) {\n _inherits(BaseTheme, _Theme);\n\n function BaseTheme(quill, options) {\n _classCallCheck(this, BaseTheme);\n\n var _this = _possibleConstructorReturn(this, (BaseTheme.__proto__ || Object.getPrototypeOf(BaseTheme)).call(this, quill, options));\n\n var listener = function listener(e) {\n if (!document.body.contains(quill.root)) {\n return document.body.removeEventListener('click', listener);\n }\n if (_this.tooltip != null && !_this.tooltip.root.contains(e.target) && document.activeElement !== _this.tooltip.textbox && !_this.quill.hasFocus()) {\n _this.tooltip.hide();\n }\n if (_this.pickers != null) {\n _this.pickers.forEach(function (picker) {\n if (!picker.container.contains(e.target)) {\n picker.close();\n }\n });\n }\n };\n quill.emitter.listenDOM('click', document.body, listener);\n return _this;\n }\n\n _createClass(BaseTheme, [{\n key: 'addModule',\n value: function addModule(name) {\n var module = _get(BaseTheme.prototype.__proto__ || Object.getPrototypeOf(BaseTheme.prototype), 'addModule', this).call(this, name);\n if (name === 'toolbar') {\n this.extendToolbar(module);\n }\n return module;\n }\n }, {\n key: 'buildButtons',\n value: function buildButtons(buttons, icons) {\n buttons.forEach(function (button) {\n var className = button.getAttribute('class') || '';\n className.split(/\\s+/).forEach(function (name) {\n if (!name.startsWith('ql-')) return;\n name = name.slice('ql-'.length);\n if (icons[name] == null) return;\n if (name === 'direction') {\n button.innerHTML = icons[name][''] + icons[name]['rtl'];\n } else if (typeof icons[name] === 'string') {\n button.innerHTML = icons[name];\n } else {\n var value = button.value || '';\n if (value != null && icons[name][value]) {\n button.innerHTML = icons[name][value];\n }\n }\n });\n });\n }\n }, {\n key: 'buildPickers',\n value: function buildPickers(selects, icons) {\n var _this2 = this;\n\n this.pickers = selects.map(function (select) {\n if (select.classList.contains('ql-align')) {\n if (select.querySelector('option') == null) {\n fillSelect(select, ALIGNS);\n }\n return new _iconPicker2.default(select, icons.align);\n } else if (select.classList.contains('ql-background') || select.classList.contains('ql-color')) {\n var format = select.classList.contains('ql-background') ? 'background' : 'color';\n if (select.querySelector('option') == null) {\n fillSelect(select, COLORS, format === 'background' ? '#ffffff' : '#000000');\n }\n return new _colorPicker2.default(select, icons[format]);\n } else {\n if (select.querySelector('option') == null) {\n if (select.classList.contains('ql-font')) {\n fillSelect(select, FONTS);\n } else if (select.classList.contains('ql-header')) {\n fillSelect(select, HEADERS);\n } else if (select.classList.contains('ql-size')) {\n fillSelect(select, SIZES);\n }\n }\n return new _picker2.default(select);\n }\n });\n var update = function update() {\n _this2.pickers.forEach(function (picker) {\n picker.update();\n });\n };\n this.quill.on(_emitter2.default.events.EDITOR_CHANGE, update);\n }\n }]);\n\n return BaseTheme;\n}(_theme2.default);\n\nBaseTheme.DEFAULTS = (0, _extend2.default)(true, {}, _theme2.default.DEFAULTS, {\n modules: {\n toolbar: {\n handlers: {\n formula: function formula() {\n this.quill.theme.tooltip.edit('formula');\n },\n image: function image() {\n var _this3 = this;\n\n var fileInput = this.container.querySelector('input.ql-image[type=file]');\n if (fileInput == null) {\n fileInput = document.createElement('input');\n fileInput.setAttribute('type', 'file');\n fileInput.setAttribute('accept', 'image/png, image/gif, image/jpeg, image/bmp, image/x-icon');\n fileInput.classList.add('ql-image');\n fileInput.addEventListener('change', function () {\n if (fileInput.files != null && fileInput.files[0] != null) {\n var reader = new FileReader();\n reader.onload = function (e) {\n var range = _this3.quill.getSelection(true);\n _this3.quill.updateContents(new _quillDelta2.default().retain(range.index).delete(range.length).insert({ image: e.target.result }), _emitter2.default.sources.USER);\n _this3.quill.setSelection(range.index + 1, _emitter2.default.sources.SILENT);\n fileInput.value = \"\";\n };\n reader.readAsDataURL(fileInput.files[0]);\n }\n });\n this.container.appendChild(fileInput);\n }\n fileInput.click();\n },\n video: function video() {\n this.quill.theme.tooltip.edit('video');\n }\n }\n }\n }\n});\n\nvar BaseTooltip = function (_Tooltip) {\n _inherits(BaseTooltip, _Tooltip);\n\n function BaseTooltip(quill, boundsContainer) {\n _classCallCheck(this, BaseTooltip);\n\n var _this4 = _possibleConstructorReturn(this, (BaseTooltip.__proto__ || Object.getPrototypeOf(BaseTooltip)).call(this, quill, boundsContainer));\n\n _this4.textbox = _this4.root.querySelector('input[type=\"text\"]');\n _this4.listen();\n return _this4;\n }\n\n _createClass(BaseTooltip, [{\n key: 'listen',\n value: function listen() {\n var _this5 = this;\n\n this.textbox.addEventListener('keydown', function (event) {\n if (_keyboard2.default.match(event, 'enter')) {\n _this5.save();\n event.preventDefault();\n } else if (_keyboard2.default.match(event, 'escape')) {\n _this5.cancel();\n event.preventDefault();\n }\n });\n }\n }, {\n key: 'cancel',\n value: function cancel() {\n this.hide();\n }\n }, {\n key: 'edit',\n value: function edit() {\n var mode = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'link';\n var preview = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;\n\n this.root.classList.remove('ql-hidden');\n this.root.classList.add('ql-editing');\n if (preview != null) {\n this.textbox.value = preview;\n } else if (mode !== this.root.getAttribute('data-mode')) {\n this.textbox.value = '';\n }\n this.position(this.quill.getBounds(this.quill.selection.savedRange));\n this.textbox.select();\n this.textbox.setAttribute('placeholder', this.textbox.getAttribute('data-' + mode) || '');\n this.root.setAttribute('data-mode', mode);\n }\n }, {\n key: 'restoreFocus',\n value: function restoreFocus() {\n var scrollTop = this.quill.scrollingContainer.scrollTop;\n this.quill.focus();\n this.quill.scrollingContainer.scrollTop = scrollTop;\n }\n }, {\n key: 'save',\n value: function save() {\n var value = this.textbox.value;\n switch (this.root.getAttribute('data-mode')) {\n case 'link':\n {\n var scrollTop = this.quill.root.scrollTop;\n if (this.linkRange) {\n this.quill.formatText(this.linkRange, 'link', value, _emitter2.default.sources.USER);\n delete this.linkRange;\n } else {\n this.restoreFocus();\n this.quill.format('link', value, _emitter2.default.sources.USER);\n }\n this.quill.root.scrollTop = scrollTop;\n break;\n }\n case 'video':\n {\n value = extractVideoUrl(value);\n } // eslint-disable-next-line no-fallthrough\n case 'formula':\n {\n if (!value) break;\n var range = this.quill.getSelection(true);\n if (range != null) {\n var index = range.index + range.length;\n this.quill.insertEmbed(index, this.root.getAttribute('data-mode'), value, _emitter2.default.sources.USER);\n if (this.root.getAttribute('data-mode') === 'formula') {\n this.quill.insertText(index + 1, ' ', _emitter2.default.sources.USER);\n }\n this.quill.setSelection(index + 2, _emitter2.default.sources.USER);\n }\n break;\n }\n default:\n }\n this.textbox.value = '';\n this.hide();\n }\n }]);\n\n return BaseTooltip;\n}(_tooltip2.default);\n\nfunction extractVideoUrl(url) {\n var match = url.match(/^(?:(https?):\\/\\/)?(?:(?:www|m)\\.)?youtube\\.com\\/watch.*v=([a-zA-Z0-9_-]+)/) || url.match(/^(?:(https?):\\/\\/)?(?:(?:www|m)\\.)?youtu\\.be\\/([a-zA-Z0-9_-]+)/);\n if (match) {\n return (match[1] || 'https') + '://www.youtube.com/embed/' + match[2] + '?showinfo=0';\n }\n if (match = url.match(/^(?:(https?):\\/\\/)?(?:www\\.)?vimeo\\.com\\/(\\d+)/)) {\n // eslint-disable-line no-cond-assign\n return (match[1] || 'https') + '://player.vimeo.com/video/' + match[2] + '/';\n }\n return url;\n}\n\nfunction fillSelect(select, values) {\n var defaultValue = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;\n\n values.forEach(function (value) {\n var option = document.createElement('option');\n if (value === defaultValue) {\n option.setAttribute('selected', 'selected');\n } else {\n option.setAttribute('value', value);\n }\n select.appendChild(option);\n });\n}\n\nexports.BaseTooltip = BaseTooltip;\nexports.default = BaseTheme;\n\n/***/ }),\n/* 44 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar LinkedList = /** @class */ (function () {\n function LinkedList() {\n this.head = this.tail = null;\n this.length = 0;\n }\n LinkedList.prototype.append = function () {\n var nodes = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n nodes[_i] = arguments[_i];\n }\n this.insertBefore(nodes[0], null);\n if (nodes.length > 1) {\n this.append.apply(this, nodes.slice(1));\n }\n };\n LinkedList.prototype.contains = function (node) {\n var cur, next = this.iterator();\n while ((cur = next())) {\n if (cur === node)\n return true;\n }\n return false;\n };\n LinkedList.prototype.insertBefore = function (node, refNode) {\n if (!node)\n return;\n node.next = refNode;\n if (refNode != null) {\n node.prev = refNode.prev;\n if (refNode.prev != null) {\n refNode.prev.next = node;\n }\n refNode.prev = node;\n if (refNode === this.head) {\n this.head = node;\n }\n }\n else if (this.tail != null) {\n this.tail.next = node;\n node.prev = this.tail;\n this.tail = node;\n }\n else {\n node.prev = null;\n this.head = this.tail = node;\n }\n this.length += 1;\n };\n LinkedList.prototype.offset = function (target) {\n var index = 0, cur = this.head;\n while (cur != null) {\n if (cur === target)\n return index;\n index += cur.length();\n cur = cur.next;\n }\n return -1;\n };\n LinkedList.prototype.remove = function (node) {\n if (!this.contains(node))\n return;\n if (node.prev != null)\n node.prev.next = node.next;\n if (node.next != null)\n node.next.prev = node.prev;\n if (node === this.head)\n this.head = node.next;\n if (node === this.tail)\n this.tail = node.prev;\n this.length -= 1;\n };\n LinkedList.prototype.iterator = function (curNode) {\n if (curNode === void 0) { curNode = this.head; }\n // TODO use yield when we can\n return function () {\n var ret = curNode;\n if (curNode != null)\n curNode = curNode.next;\n return ret;\n };\n };\n LinkedList.prototype.find = function (index, inclusive) {\n if (inclusive === void 0) { inclusive = false; }\n var cur, next = this.iterator();\n while ((cur = next())) {\n var length = cur.length();\n if (index < length ||\n (inclusive && index === length && (cur.next == null || cur.next.length() !== 0))) {\n return [cur, index];\n }\n index -= length;\n }\n return [null, 0];\n };\n LinkedList.prototype.forEach = function (callback) {\n var cur, next = this.iterator();\n while ((cur = next())) {\n callback(cur);\n }\n };\n LinkedList.prototype.forEachAt = function (index, length, callback) {\n if (length <= 0)\n return;\n var _a = this.find(index), startNode = _a[0], offset = _a[1];\n var cur, curIndex = index - offset, next = this.iterator(startNode);\n while ((cur = next()) && curIndex < index + length) {\n var curLength = cur.length();\n if (index > curIndex) {\n callback(cur, index - curIndex, Math.min(length, curIndex + curLength - index));\n }\n else {\n callback(cur, 0, Math.min(curLength, index + length - curIndex));\n }\n curIndex += curLength;\n }\n };\n LinkedList.prototype.map = function (callback) {\n return this.reduce(function (memo, cur) {\n memo.push(callback(cur));\n return memo;\n }, []);\n };\n LinkedList.prototype.reduce = function (callback, memo) {\n var cur, next = this.iterator();\n while ((cur = next())) {\n memo = callback(memo, cur);\n }\n return memo;\n };\n return LinkedList;\n}());\nexports.default = LinkedList;\n\n\n/***/ }),\n/* 45 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar container_1 = __webpack_require__(17);\nvar Registry = __webpack_require__(1);\nvar OBSERVER_CONFIG = {\n attributes: true,\n characterData: true,\n characterDataOldValue: true,\n childList: true,\n subtree: true,\n};\nvar MAX_OPTIMIZE_ITERATIONS = 100;\nvar ScrollBlot = /** @class */ (function (_super) {\n __extends(ScrollBlot, _super);\n function ScrollBlot(node) {\n var _this = _super.call(this, node) || this;\n _this.scroll = _this;\n _this.observer = new MutationObserver(function (mutations) {\n _this.update(mutations);\n });\n _this.observer.observe(_this.domNode, OBSERVER_CONFIG);\n _this.attach();\n return _this;\n }\n ScrollBlot.prototype.detach = function () {\n _super.prototype.detach.call(this);\n this.observer.disconnect();\n };\n ScrollBlot.prototype.deleteAt = function (index, length) {\n this.update();\n if (index === 0 && length === this.length()) {\n this.children.forEach(function (child) {\n child.remove();\n });\n }\n else {\n _super.prototype.deleteAt.call(this, index, length);\n }\n };\n ScrollBlot.prototype.formatAt = function (index, length, name, value) {\n this.update();\n _super.prototype.formatAt.call(this, index, length, name, value);\n };\n ScrollBlot.prototype.insertAt = function (index, value, def) {\n this.update();\n _super.prototype.insertAt.call(this, index, value, def);\n };\n ScrollBlot.prototype.optimize = function (mutations, context) {\n var _this = this;\n if (mutations === void 0) { mutations = []; }\n if (context === void 0) { context = {}; }\n _super.prototype.optimize.call(this, context);\n // We must modify mutations directly, cannot make copy and then modify\n var records = [].slice.call(this.observer.takeRecords());\n // Array.push currently seems to be implemented by a non-tail recursive function\n // so we cannot just mutations.push.apply(mutations, this.observer.takeRecords());\n while (records.length > 0)\n mutations.push(records.pop());\n // TODO use WeakMap\n var mark = function (blot, markParent) {\n if (markParent === void 0) { markParent = true; }\n if (blot == null || blot === _this)\n return;\n if (blot.domNode.parentNode == null)\n return;\n // @ts-ignore\n if (blot.domNode[Registry.DATA_KEY].mutations == null) {\n // @ts-ignore\n blot.domNode[Registry.DATA_KEY].mutations = [];\n }\n if (markParent)\n mark(blot.parent);\n };\n var optimize = function (blot) {\n // Post-order traversal\n if (\n // @ts-ignore\n blot.domNode[Registry.DATA_KEY] == null ||\n // @ts-ignore\n blot.domNode[Registry.DATA_KEY].mutations == null) {\n return;\n }\n if (blot instanceof container_1.default) {\n blot.children.forEach(optimize);\n }\n blot.optimize(context);\n };\n var remaining = mutations;\n for (var i = 0; remaining.length > 0; i += 1) {\n if (i >= MAX_OPTIMIZE_ITERATIONS) {\n throw new Error('[Parchment] Maximum optimize iterations reached');\n }\n remaining.forEach(function (mutation) {\n var blot = Registry.find(mutation.target, true);\n if (blot == null)\n return;\n if (blot.domNode === mutation.target) {\n if (mutation.type === 'childList') {\n mark(Registry.find(mutation.previousSibling, false));\n [].forEach.call(mutation.addedNodes, function (node) {\n var child = Registry.find(node, false);\n mark(child, false);\n if (child instanceof container_1.default) {\n child.children.forEach(function (grandChild) {\n mark(grandChild, false);\n });\n }\n });\n }\n else if (mutation.type === 'attributes') {\n mark(blot.prev);\n }\n }\n mark(blot);\n });\n this.children.forEach(optimize);\n remaining = [].slice.call(this.observer.takeRecords());\n records = remaining.slice();\n while (records.length > 0)\n mutations.push(records.pop());\n }\n };\n ScrollBlot.prototype.update = function (mutations, context) {\n var _this = this;\n if (context === void 0) { context = {}; }\n mutations = mutations || this.observer.takeRecords();\n // TODO use WeakMap\n mutations\n .map(function (mutation) {\n var blot = Registry.find(mutation.target, true);\n if (blot == null)\n return null;\n // @ts-ignore\n if (blot.domNode[Registry.DATA_KEY].mutations == null) {\n // @ts-ignore\n blot.domNode[Registry.DATA_KEY].mutations = [mutation];\n return blot;\n }\n else {\n // @ts-ignore\n blot.domNode[Registry.DATA_KEY].mutations.push(mutation);\n return null;\n }\n })\n .forEach(function (blot) {\n if (blot == null ||\n blot === _this ||\n //@ts-ignore\n blot.domNode[Registry.DATA_KEY] == null)\n return;\n // @ts-ignore\n blot.update(blot.domNode[Registry.DATA_KEY].mutations || [], context);\n });\n // @ts-ignore\n if (this.domNode[Registry.DATA_KEY].mutations != null) {\n // @ts-ignore\n _super.prototype.update.call(this, this.domNode[Registry.DATA_KEY].mutations, context);\n }\n this.optimize(mutations, context);\n };\n ScrollBlot.blotName = 'scroll';\n ScrollBlot.defaultChild = 'block';\n ScrollBlot.scope = Registry.Scope.BLOCK_BLOT;\n ScrollBlot.tagName = 'DIV';\n return ScrollBlot;\n}(container_1.default));\nexports.default = ScrollBlot;\n\n\n/***/ }),\n/* 46 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar format_1 = __webpack_require__(18);\nvar Registry = __webpack_require__(1);\n// Shallow object comparison\nfunction isEqual(obj1, obj2) {\n if (Object.keys(obj1).length !== Object.keys(obj2).length)\n return false;\n // @ts-ignore\n for (var prop in obj1) {\n // @ts-ignore\n if (obj1[prop] !== obj2[prop])\n return false;\n }\n return true;\n}\nvar InlineBlot = /** @class */ (function (_super) {\n __extends(InlineBlot, _super);\n function InlineBlot() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n InlineBlot.formats = function (domNode) {\n if (domNode.tagName === InlineBlot.tagName)\n return undefined;\n return _super.formats.call(this, domNode);\n };\n InlineBlot.prototype.format = function (name, value) {\n var _this = this;\n if (name === this.statics.blotName && !value) {\n this.children.forEach(function (child) {\n if (!(child instanceof format_1.default)) {\n child = child.wrap(InlineBlot.blotName, true);\n }\n _this.attributes.copy(child);\n });\n this.unwrap();\n }\n else {\n _super.prototype.format.call(this, name, value);\n }\n };\n InlineBlot.prototype.formatAt = function (index, length, name, value) {\n if (this.formats()[name] != null || Registry.query(name, Registry.Scope.ATTRIBUTE)) {\n var blot = this.isolate(index, length);\n blot.format(name, value);\n }\n else {\n _super.prototype.formatAt.call(this, index, length, name, value);\n }\n };\n InlineBlot.prototype.optimize = function (context) {\n _super.prototype.optimize.call(this, context);\n var formats = this.formats();\n if (Object.keys(formats).length === 0) {\n return this.unwrap(); // unformatted span\n }\n var next = this.next;\n if (next instanceof InlineBlot && next.prev === this && isEqual(formats, next.formats())) {\n next.moveChildren(this);\n next.remove();\n }\n };\n InlineBlot.blotName = 'inline';\n InlineBlot.scope = Registry.Scope.INLINE_BLOT;\n InlineBlot.tagName = 'SPAN';\n return InlineBlot;\n}(format_1.default));\nexports.default = InlineBlot;\n\n\n/***/ }),\n/* 47 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar format_1 = __webpack_require__(18);\nvar Registry = __webpack_require__(1);\nvar BlockBlot = /** @class */ (function (_super) {\n __extends(BlockBlot, _super);\n function BlockBlot() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n BlockBlot.formats = function (domNode) {\n var tagName = Registry.query(BlockBlot.blotName).tagName;\n if (domNode.tagName === tagName)\n return undefined;\n return _super.formats.call(this, domNode);\n };\n BlockBlot.prototype.format = function (name, value) {\n if (Registry.query(name, Registry.Scope.BLOCK) == null) {\n return;\n }\n else if (name === this.statics.blotName && !value) {\n this.replaceWith(BlockBlot.blotName);\n }\n else {\n _super.prototype.format.call(this, name, value);\n }\n };\n BlockBlot.prototype.formatAt = function (index, length, name, value) {\n if (Registry.query(name, Registry.Scope.BLOCK) != null) {\n this.format(name, value);\n }\n else {\n _super.prototype.formatAt.call(this, index, length, name, value);\n }\n };\n BlockBlot.prototype.insertAt = function (index, value, def) {\n if (def == null || Registry.query(value, Registry.Scope.INLINE) != null) {\n // Insert text or inline\n _super.prototype.insertAt.call(this, index, value, def);\n }\n else {\n var after = this.split(index);\n var blot = Registry.create(value, def);\n after.parent.insertBefore(blot, after);\n }\n };\n BlockBlot.prototype.update = function (mutations, context) {\n if (navigator.userAgent.match(/Trident/)) {\n this.build();\n }\n else {\n _super.prototype.update.call(this, mutations, context);\n }\n };\n BlockBlot.blotName = 'block';\n BlockBlot.scope = Registry.Scope.BLOCK_BLOT;\n BlockBlot.tagName = 'P';\n return BlockBlot;\n}(format_1.default));\nexports.default = BlockBlot;\n\n\n/***/ }),\n/* 48 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar leaf_1 = __webpack_require__(19);\nvar EmbedBlot = /** @class */ (function (_super) {\n __extends(EmbedBlot, _super);\n function EmbedBlot() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n EmbedBlot.formats = function (domNode) {\n return undefined;\n };\n EmbedBlot.prototype.format = function (name, value) {\n // super.formatAt wraps, which is what we want in general,\n // but this allows subclasses to overwrite for formats\n // that just apply to particular embeds\n _super.prototype.formatAt.call(this, 0, this.length(), name, value);\n };\n EmbedBlot.prototype.formatAt = function (index, length, name, value) {\n if (index === 0 && length === this.length()) {\n this.format(name, value);\n }\n else {\n _super.prototype.formatAt.call(this, index, length, name, value);\n }\n };\n EmbedBlot.prototype.formats = function () {\n return this.statics.formats(this.domNode);\n };\n return EmbedBlot;\n}(leaf_1.default));\nexports.default = EmbedBlot;\n\n\n/***/ }),\n/* 49 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar leaf_1 = __webpack_require__(19);\nvar Registry = __webpack_require__(1);\nvar TextBlot = /** @class */ (function (_super) {\n __extends(TextBlot, _super);\n function TextBlot(node) {\n var _this = _super.call(this, node) || this;\n _this.text = _this.statics.value(_this.domNode);\n return _this;\n }\n TextBlot.create = function (value) {\n return document.createTextNode(value);\n };\n TextBlot.value = function (domNode) {\n var text = domNode.data;\n // @ts-ignore\n if (text['normalize'])\n text = text['normalize']();\n return text;\n };\n TextBlot.prototype.deleteAt = function (index, length) {\n this.domNode.data = this.text = this.text.slice(0, index) + this.text.slice(index + length);\n };\n TextBlot.prototype.index = function (node, offset) {\n if (this.domNode === node) {\n return offset;\n }\n return -1;\n };\n TextBlot.prototype.insertAt = function (index, value, def) {\n if (def == null) {\n this.text = this.text.slice(0, index) + value + this.text.slice(index);\n this.domNode.data = this.text;\n }\n else {\n _super.prototype.insertAt.call(this, index, value, def);\n }\n };\n TextBlot.prototype.length = function () {\n return this.text.length;\n };\n TextBlot.prototype.optimize = function (context) {\n _super.prototype.optimize.call(this, context);\n this.text = this.statics.value(this.domNode);\n if (this.text.length === 0) {\n this.remove();\n }\n else if (this.next instanceof TextBlot && this.next.prev === this) {\n this.insertAt(this.length(), this.next.value());\n this.next.remove();\n }\n };\n TextBlot.prototype.position = function (index, inclusive) {\n if (inclusive === void 0) { inclusive = false; }\n return [this.domNode, index];\n };\n TextBlot.prototype.split = function (index, force) {\n if (force === void 0) { force = false; }\n if (!force) {\n if (index === 0)\n return this;\n if (index === this.length())\n return this.next;\n }\n var after = Registry.create(this.domNode.splitText(index));\n this.parent.insertBefore(after, this.next);\n this.text = this.statics.value(this.domNode);\n return after;\n };\n TextBlot.prototype.update = function (mutations, context) {\n var _this = this;\n if (mutations.some(function (mutation) {\n return mutation.type === 'characterData' && mutation.target === _this.domNode;\n })) {\n this.text = this.statics.value(this.domNode);\n }\n };\n TextBlot.prototype.value = function () {\n return this.text;\n };\n TextBlot.blotName = 'text';\n TextBlot.scope = Registry.Scope.INLINE_BLOT;\n return TextBlot;\n}(leaf_1.default));\nexports.default = TextBlot;\n\n\n/***/ }),\n/* 50 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar elem = document.createElement('div');\nelem.classList.toggle('test-class', false);\nif (elem.classList.contains('test-class')) {\n var _toggle = DOMTokenList.prototype.toggle;\n DOMTokenList.prototype.toggle = function (token, force) {\n if (arguments.length > 1 && !this.contains(token) === !force) {\n return force;\n } else {\n return _toggle.call(this, token);\n }\n };\n}\n\nif (!String.prototype.startsWith) {\n String.prototype.startsWith = function (searchString, position) {\n position = position || 0;\n return this.substr(position, searchString.length) === searchString;\n };\n}\n\nif (!String.prototype.endsWith) {\n String.prototype.endsWith = function (searchString, position) {\n var subjectString = this.toString();\n if (typeof position !== 'number' || !isFinite(position) || Math.floor(position) !== position || position > subjectString.length) {\n position = subjectString.length;\n }\n position -= searchString.length;\n var lastIndex = subjectString.indexOf(searchString, position);\n return lastIndex !== -1 && lastIndex === position;\n };\n}\n\nif (!Array.prototype.find) {\n Object.defineProperty(Array.prototype, \"find\", {\n value: function value(predicate) {\n if (this === null) {\n throw new TypeError('Array.prototype.find called on null or undefined');\n }\n if (typeof predicate !== 'function') {\n throw new TypeError('predicate must be a function');\n }\n var list = Object(this);\n var length = list.length >>> 0;\n var thisArg = arguments[1];\n var value;\n\n for (var i = 0; i < length; i++) {\n value = list[i];\n if (predicate.call(thisArg, value, i, list)) {\n return value;\n }\n }\n return undefined;\n }\n });\n}\n\ndocument.addEventListener(\"DOMContentLoaded\", function () {\n // Disable resizing in Firefox\n document.execCommand(\"enableObjectResizing\", false, false);\n // Disable automatic linkifying in IE11\n document.execCommand(\"autoUrlDetect\", false, false);\n});\n\n/***/ }),\n/* 51 */\n/***/ (function(module, exports) {\n\n/**\n * This library modifies the diff-patch-match library by Neil Fraser\n * by removing the patch and match functionality and certain advanced\n * options in the diff function. The original license is as follows:\n *\n * ===\n *\n * Diff Match and Patch\n *\n * Copyright 2006 Google Inc.\n * http://code.google.com/p/google-diff-match-patch/\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n\n/**\n * The data structure representing a diff is an array of tuples:\n * [[DIFF_DELETE, 'Hello'], [DIFF_INSERT, 'Goodbye'], [DIFF_EQUAL, ' world.']]\n * which means: delete 'Hello', add 'Goodbye' and keep ' world.'\n */\nvar DIFF_DELETE = -1;\nvar DIFF_INSERT = 1;\nvar DIFF_EQUAL = 0;\n\n\n/**\n * Find the differences between two texts. Simplifies the problem by stripping\n * any common prefix or suffix off the texts before diffing.\n * @param {string} text1 Old string to be diffed.\n * @param {string} text2 New string to be diffed.\n * @param {Int} cursor_pos Expected edit position in text1 (optional)\n * @return {Array} Array of diff tuples.\n */\nfunction diff_main(text1, text2, cursor_pos) {\n // Check for equality (speedup).\n if (text1 == text2) {\n if (text1) {\n return [[DIFF_EQUAL, text1]];\n }\n return [];\n }\n\n // Check cursor_pos within bounds\n if (cursor_pos < 0 || text1.length < cursor_pos) {\n cursor_pos = null;\n }\n\n // Trim off common prefix (speedup).\n var commonlength = diff_commonPrefix(text1, text2);\n var commonprefix = text1.substring(0, commonlength);\n text1 = text1.substring(commonlength);\n text2 = text2.substring(commonlength);\n\n // Trim off common suffix (speedup).\n commonlength = diff_commonSuffix(text1, text2);\n var commonsuffix = text1.substring(text1.length - commonlength);\n text1 = text1.substring(0, text1.length - commonlength);\n text2 = text2.substring(0, text2.length - commonlength);\n\n // Compute the diff on the middle block.\n var diffs = diff_compute_(text1, text2);\n\n // Restore the prefix and suffix.\n if (commonprefix) {\n diffs.unshift([DIFF_EQUAL, commonprefix]);\n }\n if (commonsuffix) {\n diffs.push([DIFF_EQUAL, commonsuffix]);\n }\n diff_cleanupMerge(diffs);\n if (cursor_pos != null) {\n diffs = fix_cursor(diffs, cursor_pos);\n }\n diffs = fix_emoji(diffs);\n return diffs;\n};\n\n\n/**\n * Find the differences between two texts. Assumes that the texts do not\n * have any common prefix or suffix.\n * @param {string} text1 Old string to be diffed.\n * @param {string} text2 New string to be diffed.\n * @return {Array} Array of diff tuples.\n */\nfunction diff_compute_(text1, text2) {\n var diffs;\n\n if (!text1) {\n // Just add some text (speedup).\n return [[DIFF_INSERT, text2]];\n }\n\n if (!text2) {\n // Just delete some text (speedup).\n return [[DIFF_DELETE, text1]];\n }\n\n var longtext = text1.length > text2.length ? text1 : text2;\n var shorttext = text1.length > text2.length ? text2 : text1;\n var i = longtext.indexOf(shorttext);\n if (i != -1) {\n // Shorter text is inside the longer text (speedup).\n diffs = [[DIFF_INSERT, longtext.substring(0, i)],\n [DIFF_EQUAL, shorttext],\n [DIFF_INSERT, longtext.substring(i + shorttext.length)]];\n // Swap insertions for deletions if diff is reversed.\n if (text1.length > text2.length) {\n diffs[0][0] = diffs[2][0] = DIFF_DELETE;\n }\n return diffs;\n }\n\n if (shorttext.length == 1) {\n // Single character string.\n // After the previous speedup, the character can't be an equality.\n return [[DIFF_DELETE, text1], [DIFF_INSERT, text2]];\n }\n\n // Check to see if the problem can be split in two.\n var hm = diff_halfMatch_(text1, text2);\n if (hm) {\n // A half-match was found, sort out the return data.\n var text1_a = hm[0];\n var text1_b = hm[1];\n var text2_a = hm[2];\n var text2_b = hm[3];\n var mid_common = hm[4];\n // Send both pairs off for separate processing.\n var diffs_a = diff_main(text1_a, text2_a);\n var diffs_b = diff_main(text1_b, text2_b);\n // Merge the results.\n return diffs_a.concat([[DIFF_EQUAL, mid_common]], diffs_b);\n }\n\n return diff_bisect_(text1, text2);\n};\n\n\n/**\n * Find the 'middle snake' of a diff, split the problem in two\n * and return the recursively constructed diff.\n * See Myers 1986 paper: An O(ND) Difference Algorithm and Its Variations.\n * @param {string} text1 Old string to be diffed.\n * @param {string} text2 New string to be diffed.\n * @return {Array} Array of diff tuples.\n * @private\n */\nfunction diff_bisect_(text1, text2) {\n // Cache the text lengths to prevent multiple calls.\n var text1_length = text1.length;\n var text2_length = text2.length;\n var max_d = Math.ceil((text1_length + text2_length) / 2);\n var v_offset = max_d;\n var v_length = 2 * max_d;\n var v1 = new Array(v_length);\n var v2 = new Array(v_length);\n // Setting all elements to -1 is faster in Chrome & Firefox than mixing\n // integers and undefined.\n for (var x = 0; x < v_length; x++) {\n v1[x] = -1;\n v2[x] = -1;\n }\n v1[v_offset + 1] = 0;\n v2[v_offset + 1] = 0;\n var delta = text1_length - text2_length;\n // If the total number of characters is odd, then the front path will collide\n // with the reverse path.\n var front = (delta % 2 != 0);\n // Offsets for start and end of k loop.\n // Prevents mapping of space beyond the grid.\n var k1start = 0;\n var k1end = 0;\n var k2start = 0;\n var k2end = 0;\n for (var d = 0; d < max_d; d++) {\n // Walk the front path one step.\n for (var k1 = -d + k1start; k1 <= d - k1end; k1 += 2) {\n var k1_offset = v_offset + k1;\n var x1;\n if (k1 == -d || (k1 != d && v1[k1_offset - 1] < v1[k1_offset + 1])) {\n x1 = v1[k1_offset + 1];\n } else {\n x1 = v1[k1_offset - 1] + 1;\n }\n var y1 = x1 - k1;\n while (x1 < text1_length && y1 < text2_length &&\n text1.charAt(x1) == text2.charAt(y1)) {\n x1++;\n y1++;\n }\n v1[k1_offset] = x1;\n if (x1 > text1_length) {\n // Ran off the right of the graph.\n k1end += 2;\n } else if (y1 > text2_length) {\n // Ran off the bottom of the graph.\n k1start += 2;\n } else if (front) {\n var k2_offset = v_offset + delta - k1;\n if (k2_offset >= 0 && k2_offset < v_length && v2[k2_offset] != -1) {\n // Mirror x2 onto top-left coordinate system.\n var x2 = text1_length - v2[k2_offset];\n if (x1 >= x2) {\n // Overlap detected.\n return diff_bisectSplit_(text1, text2, x1, y1);\n }\n }\n }\n }\n\n // Walk the reverse path one step.\n for (var k2 = -d + k2start; k2 <= d - k2end; k2 += 2) {\n var k2_offset = v_offset + k2;\n var x2;\n if (k2 == -d || (k2 != d && v2[k2_offset - 1] < v2[k2_offset + 1])) {\n x2 = v2[k2_offset + 1];\n } else {\n x2 = v2[k2_offset - 1] + 1;\n }\n var y2 = x2 - k2;\n while (x2 < text1_length && y2 < text2_length &&\n text1.charAt(text1_length - x2 - 1) ==\n text2.charAt(text2_length - y2 - 1)) {\n x2++;\n y2++;\n }\n v2[k2_offset] = x2;\n if (x2 > text1_length) {\n // Ran off the left of the graph.\n k2end += 2;\n } else if (y2 > text2_length) {\n // Ran off the top of the graph.\n k2start += 2;\n } else if (!front) {\n var k1_offset = v_offset + delta - k2;\n if (k1_offset >= 0 && k1_offset < v_length && v1[k1_offset] != -1) {\n var x1 = v1[k1_offset];\n var y1 = v_offset + x1 - k1_offset;\n // Mirror x2 onto top-left coordinate system.\n x2 = text1_length - x2;\n if (x1 >= x2) {\n // Overlap detected.\n return diff_bisectSplit_(text1, text2, x1, y1);\n }\n }\n }\n }\n }\n // Diff took too long and hit the deadline or\n // number of diffs equals number of characters, no commonality at all.\n return [[DIFF_DELETE, text1], [DIFF_INSERT, text2]];\n};\n\n\n/**\n * Given the location of the 'middle snake', split the diff in two parts\n * and recurse.\n * @param {string} text1 Old string to be diffed.\n * @param {string} text2 New string to be diffed.\n * @param {number} x Index of split point in text1.\n * @param {number} y Index of split point in text2.\n * @return {Array} Array of diff tuples.\n */\nfunction diff_bisectSplit_(text1, text2, x, y) {\n var text1a = text1.substring(0, x);\n var text2a = text2.substring(0, y);\n var text1b = text1.substring(x);\n var text2b = text2.substring(y);\n\n // Compute both diffs serially.\n var diffs = diff_main(text1a, text2a);\n var diffsb = diff_main(text1b, text2b);\n\n return diffs.concat(diffsb);\n};\n\n\n/**\n * Determine the common prefix of two strings.\n * @param {string} text1 First string.\n * @param {string} text2 Second string.\n * @return {number} The number of characters common to the start of each\n * string.\n */\nfunction diff_commonPrefix(text1, text2) {\n // Quick check for common null cases.\n if (!text1 || !text2 || text1.charAt(0) != text2.charAt(0)) {\n return 0;\n }\n // Binary search.\n // Performance analysis: http://neil.fraser.name/news/2007/10/09/\n var pointermin = 0;\n var pointermax = Math.min(text1.length, text2.length);\n var pointermid = pointermax;\n var pointerstart = 0;\n while (pointermin < pointermid) {\n if (text1.substring(pointerstart, pointermid) ==\n text2.substring(pointerstart, pointermid)) {\n pointermin = pointermid;\n pointerstart = pointermin;\n } else {\n pointermax = pointermid;\n }\n pointermid = Math.floor((pointermax - pointermin) / 2 + pointermin);\n }\n return pointermid;\n};\n\n\n/**\n * Determine the common suffix of two strings.\n * @param {string} text1 First string.\n * @param {string} text2 Second string.\n * @return {number} The number of characters common to the end of each string.\n */\nfunction diff_commonSuffix(text1, text2) {\n // Quick check for common null cases.\n if (!text1 || !text2 ||\n text1.charAt(text1.length - 1) != text2.charAt(text2.length - 1)) {\n return 0;\n }\n // Binary search.\n // Performance analysis: http://neil.fraser.name/news/2007/10/09/\n var pointermin = 0;\n var pointermax = Math.min(text1.length, text2.length);\n var pointermid = pointermax;\n var pointerend = 0;\n while (pointermin < pointermid) {\n if (text1.substring(text1.length - pointermid, text1.length - pointerend) ==\n text2.substring(text2.length - pointermid, text2.length - pointerend)) {\n pointermin = pointermid;\n pointerend = pointermin;\n } else {\n pointermax = pointermid;\n }\n pointermid = Math.floor((pointermax - pointermin) / 2 + pointermin);\n }\n return pointermid;\n};\n\n\n/**\n * Do the two texts share a substring which is at least half the length of the\n * longer text?\n * This speedup can produce non-minimal diffs.\n * @param {string} text1 First string.\n * @param {string} text2 Second string.\n * @return {Array.} Five element Array, containing the prefix of\n * text1, the suffix of text1, the prefix of text2, the suffix of\n * text2 and the common middle. Or null if there was no match.\n */\nfunction diff_halfMatch_(text1, text2) {\n var longtext = text1.length > text2.length ? text1 : text2;\n var shorttext = text1.length > text2.length ? text2 : text1;\n if (longtext.length < 4 || shorttext.length * 2 < longtext.length) {\n return null; // Pointless.\n }\n\n /**\n * Does a substring of shorttext exist within longtext such that the substring\n * is at least half the length of longtext?\n * Closure, but does not reference any external variables.\n * @param {string} longtext Longer string.\n * @param {string} shorttext Shorter string.\n * @param {number} i Start index of quarter length substring within longtext.\n * @return {Array.} Five element Array, containing the prefix of\n * longtext, the suffix of longtext, the prefix of shorttext, the suffix\n * of shorttext and the common middle. Or null if there was no match.\n * @private\n */\n function diff_halfMatchI_(longtext, shorttext, i) {\n // Start with a 1/4 length substring at position i as a seed.\n var seed = longtext.substring(i, i + Math.floor(longtext.length / 4));\n var j = -1;\n var best_common = '';\n var best_longtext_a, best_longtext_b, best_shorttext_a, best_shorttext_b;\n while ((j = shorttext.indexOf(seed, j + 1)) != -1) {\n var prefixLength = diff_commonPrefix(longtext.substring(i),\n shorttext.substring(j));\n var suffixLength = diff_commonSuffix(longtext.substring(0, i),\n shorttext.substring(0, j));\n if (best_common.length < suffixLength + prefixLength) {\n best_common = shorttext.substring(j - suffixLength, j) +\n shorttext.substring(j, j + prefixLength);\n best_longtext_a = longtext.substring(0, i - suffixLength);\n best_longtext_b = longtext.substring(i + prefixLength);\n best_shorttext_a = shorttext.substring(0, j - suffixLength);\n best_shorttext_b = shorttext.substring(j + prefixLength);\n }\n }\n if (best_common.length * 2 >= longtext.length) {\n return [best_longtext_a, best_longtext_b,\n best_shorttext_a, best_shorttext_b, best_common];\n } else {\n return null;\n }\n }\n\n // First check if the second quarter is the seed for a half-match.\n var hm1 = diff_halfMatchI_(longtext, shorttext,\n Math.ceil(longtext.length / 4));\n // Check again based on the third quarter.\n var hm2 = diff_halfMatchI_(longtext, shorttext,\n Math.ceil(longtext.length / 2));\n var hm;\n if (!hm1 && !hm2) {\n return null;\n } else if (!hm2) {\n hm = hm1;\n } else if (!hm1) {\n hm = hm2;\n } else {\n // Both matched. Select the longest.\n hm = hm1[4].length > hm2[4].length ? hm1 : hm2;\n }\n\n // A half-match was found, sort out the return data.\n var text1_a, text1_b, text2_a, text2_b;\n if (text1.length > text2.length) {\n text1_a = hm[0];\n text1_b = hm[1];\n text2_a = hm[2];\n text2_b = hm[3];\n } else {\n text2_a = hm[0];\n text2_b = hm[1];\n text1_a = hm[2];\n text1_b = hm[3];\n }\n var mid_common = hm[4];\n return [text1_a, text1_b, text2_a, text2_b, mid_common];\n};\n\n\n/**\n * Reorder and merge like edit sections. Merge equalities.\n * Any edit section can move as long as it doesn't cross an equality.\n * @param {Array} diffs Array of diff tuples.\n */\nfunction diff_cleanupMerge(diffs) {\n diffs.push([DIFF_EQUAL, '']); // Add a dummy entry at the end.\n var pointer = 0;\n var count_delete = 0;\n var count_insert = 0;\n var text_delete = '';\n var text_insert = '';\n var commonlength;\n while (pointer < diffs.length) {\n switch (diffs[pointer][0]) {\n case DIFF_INSERT:\n count_insert++;\n text_insert += diffs[pointer][1];\n pointer++;\n break;\n case DIFF_DELETE:\n count_delete++;\n text_delete += diffs[pointer][1];\n pointer++;\n break;\n case DIFF_EQUAL:\n // Upon reaching an equality, check for prior redundancies.\n if (count_delete + count_insert > 1) {\n if (count_delete !== 0 && count_insert !== 0) {\n // Factor out any common prefixies.\n commonlength = diff_commonPrefix(text_insert, text_delete);\n if (commonlength !== 0) {\n if ((pointer - count_delete - count_insert) > 0 &&\n diffs[pointer - count_delete - count_insert - 1][0] ==\n DIFF_EQUAL) {\n diffs[pointer - count_delete - count_insert - 1][1] +=\n text_insert.substring(0, commonlength);\n } else {\n diffs.splice(0, 0, [DIFF_EQUAL,\n text_insert.substring(0, commonlength)]);\n pointer++;\n }\n text_insert = text_insert.substring(commonlength);\n text_delete = text_delete.substring(commonlength);\n }\n // Factor out any common suffixies.\n commonlength = diff_commonSuffix(text_insert, text_delete);\n if (commonlength !== 0) {\n diffs[pointer][1] = text_insert.substring(text_insert.length -\n commonlength) + diffs[pointer][1];\n text_insert = text_insert.substring(0, text_insert.length -\n commonlength);\n text_delete = text_delete.substring(0, text_delete.length -\n commonlength);\n }\n }\n // Delete the offending records and add the merged ones.\n if (count_delete === 0) {\n diffs.splice(pointer - count_insert,\n count_delete + count_insert, [DIFF_INSERT, text_insert]);\n } else if (count_insert === 0) {\n diffs.splice(pointer - count_delete,\n count_delete + count_insert, [DIFF_DELETE, text_delete]);\n } else {\n diffs.splice(pointer - count_delete - count_insert,\n count_delete + count_insert, [DIFF_DELETE, text_delete],\n [DIFF_INSERT, text_insert]);\n }\n pointer = pointer - count_delete - count_insert +\n (count_delete ? 1 : 0) + (count_insert ? 1 : 0) + 1;\n } else if (pointer !== 0 && diffs[pointer - 1][0] == DIFF_EQUAL) {\n // Merge this equality with the previous one.\n diffs[pointer - 1][1] += diffs[pointer][1];\n diffs.splice(pointer, 1);\n } else {\n pointer++;\n }\n count_insert = 0;\n count_delete = 0;\n text_delete = '';\n text_insert = '';\n break;\n }\n }\n if (diffs[diffs.length - 1][1] === '') {\n diffs.pop(); // Remove the dummy entry at the end.\n }\n\n // Second pass: look for single edits surrounded on both sides by equalities\n // which can be shifted sideways to eliminate an equality.\n // e.g: ABAC -> ABAC\n var changes = false;\n pointer = 1;\n // Intentionally ignore the first and last element (don't need checking).\n while (pointer < diffs.length - 1) {\n if (diffs[pointer - 1][0] == DIFF_EQUAL &&\n diffs[pointer + 1][0] == DIFF_EQUAL) {\n // This is a single edit surrounded by equalities.\n if (diffs[pointer][1].substring(diffs[pointer][1].length -\n diffs[pointer - 1][1].length) == diffs[pointer - 1][1]) {\n // Shift the edit over the previous equality.\n diffs[pointer][1] = diffs[pointer - 1][1] +\n diffs[pointer][1].substring(0, diffs[pointer][1].length -\n diffs[pointer - 1][1].length);\n diffs[pointer + 1][1] = diffs[pointer - 1][1] + diffs[pointer + 1][1];\n diffs.splice(pointer - 1, 1);\n changes = true;\n } else if (diffs[pointer][1].substring(0, diffs[pointer + 1][1].length) ==\n diffs[pointer + 1][1]) {\n // Shift the edit over the next equality.\n diffs[pointer - 1][1] += diffs[pointer + 1][1];\n diffs[pointer][1] =\n diffs[pointer][1].substring(diffs[pointer + 1][1].length) +\n diffs[pointer + 1][1];\n diffs.splice(pointer + 1, 1);\n changes = true;\n }\n }\n pointer++;\n }\n // If shifts were made, the diff needs reordering and another shift sweep.\n if (changes) {\n diff_cleanupMerge(diffs);\n }\n};\n\n\nvar diff = diff_main;\ndiff.INSERT = DIFF_INSERT;\ndiff.DELETE = DIFF_DELETE;\ndiff.EQUAL = DIFF_EQUAL;\n\nmodule.exports = diff;\n\n/*\n * Modify a diff such that the cursor position points to the start of a change:\n * E.g.\n * cursor_normalize_diff([[DIFF_EQUAL, 'abc']], 1)\n * => [1, [[DIFF_EQUAL, 'a'], [DIFF_EQUAL, 'bc']]]\n * cursor_normalize_diff([[DIFF_INSERT, 'new'], [DIFF_DELETE, 'xyz']], 2)\n * => [2, [[DIFF_INSERT, 'new'], [DIFF_DELETE, 'xy'], [DIFF_DELETE, 'z']]]\n *\n * @param {Array} diffs Array of diff tuples\n * @param {Int} cursor_pos Suggested edit position. Must not be out of bounds!\n * @return {Array} A tuple [cursor location in the modified diff, modified diff]\n */\nfunction cursor_normalize_diff (diffs, cursor_pos) {\n if (cursor_pos === 0) {\n return [DIFF_EQUAL, diffs];\n }\n for (var current_pos = 0, i = 0; i < diffs.length; i++) {\n var d = diffs[i];\n if (d[0] === DIFF_DELETE || d[0] === DIFF_EQUAL) {\n var next_pos = current_pos + d[1].length;\n if (cursor_pos === next_pos) {\n return [i + 1, diffs];\n } else if (cursor_pos < next_pos) {\n // copy to prevent side effects\n diffs = diffs.slice();\n // split d into two diff changes\n var split_pos = cursor_pos - current_pos;\n var d_left = [d[0], d[1].slice(0, split_pos)];\n var d_right = [d[0], d[1].slice(split_pos)];\n diffs.splice(i, 1, d_left, d_right);\n return [i + 1, diffs];\n } else {\n current_pos = next_pos;\n }\n }\n }\n throw new Error('cursor_pos is out of bounds!')\n}\n\n/*\n * Modify a diff such that the edit position is \"shifted\" to the proposed edit location (cursor_position).\n *\n * Case 1)\n * Check if a naive shift is possible:\n * [0, X], [ 1, Y] -> [ 1, Y], [0, X] (if X + Y === Y + X)\n * [0, X], [-1, Y] -> [-1, Y], [0, X] (if X + Y === Y + X) - holds same result\n * Case 2)\n * Check if the following shifts are possible:\n * [0, 'pre'], [ 1, 'prefix'] -> [ 1, 'pre'], [0, 'pre'], [ 1, 'fix']\n * [0, 'pre'], [-1, 'prefix'] -> [-1, 'pre'], [0, 'pre'], [-1, 'fix']\n * ^ ^\n * d d_next\n *\n * @param {Array} diffs Array of diff tuples\n * @param {Int} cursor_pos Suggested edit position. Must not be out of bounds!\n * @return {Array} Array of diff tuples\n */\nfunction fix_cursor (diffs, cursor_pos) {\n var norm = cursor_normalize_diff(diffs, cursor_pos);\n var ndiffs = norm[1];\n var cursor_pointer = norm[0];\n var d = ndiffs[cursor_pointer];\n var d_next = ndiffs[cursor_pointer + 1];\n\n if (d == null) {\n // Text was deleted from end of original string,\n // cursor is now out of bounds in new string\n return diffs;\n } else if (d[0] !== DIFF_EQUAL) {\n // A modification happened at the cursor location.\n // This is the expected outcome, so we can return the original diff.\n return diffs;\n } else {\n if (d_next != null && d[1] + d_next[1] === d_next[1] + d[1]) {\n // Case 1)\n // It is possible to perform a naive shift\n ndiffs.splice(cursor_pointer, 2, d_next, d)\n return merge_tuples(ndiffs, cursor_pointer, 2)\n } else if (d_next != null && d_next[1].indexOf(d[1]) === 0) {\n // Case 2)\n // d[1] is a prefix of d_next[1]\n // We can assume that d_next[0] !== 0, since d[0] === 0\n // Shift edit locations..\n ndiffs.splice(cursor_pointer, 2, [d_next[0], d[1]], [0, d[1]]);\n var suffix = d_next[1].slice(d[1].length);\n if (suffix.length > 0) {\n ndiffs.splice(cursor_pointer + 2, 0, [d_next[0], suffix]);\n }\n return merge_tuples(ndiffs, cursor_pointer, 3)\n } else {\n // Not possible to perform any modification\n return diffs;\n }\n }\n}\n\n/*\n * Check diff did not split surrogate pairs.\n * Ex. [0, '\\uD83D'], [-1, '\\uDC36'], [1, '\\uDC2F'] -> [-1, '\\uD83D\\uDC36'], [1, '\\uD83D\\uDC2F']\n * '\\uD83D\\uDC36' === '🐶', '\\uD83D\\uDC2F' === '🐯'\n *\n * @param {Array} diffs Array of diff tuples\n * @return {Array} Array of diff tuples\n */\nfunction fix_emoji (diffs) {\n var compact = false;\n var starts_with_pair_end = function(str) {\n return str.charCodeAt(0) >= 0xDC00 && str.charCodeAt(0) <= 0xDFFF;\n }\n var ends_with_pair_start = function(str) {\n return str.charCodeAt(str.length-1) >= 0xD800 && str.charCodeAt(str.length-1) <= 0xDBFF;\n }\n for (var i = 2; i < diffs.length; i += 1) {\n if (diffs[i-2][0] === DIFF_EQUAL && ends_with_pair_start(diffs[i-2][1]) &&\n diffs[i-1][0] === DIFF_DELETE && starts_with_pair_end(diffs[i-1][1]) &&\n diffs[i][0] === DIFF_INSERT && starts_with_pair_end(diffs[i][1])) {\n compact = true;\n\n diffs[i-1][1] = diffs[i-2][1].slice(-1) + diffs[i-1][1];\n diffs[i][1] = diffs[i-2][1].slice(-1) + diffs[i][1];\n\n diffs[i-2][1] = diffs[i-2][1].slice(0, -1);\n }\n }\n if (!compact) {\n return diffs;\n }\n var fixed_diffs = [];\n for (var i = 0; i < diffs.length; i += 1) {\n if (diffs[i][1].length > 0) {\n fixed_diffs.push(diffs[i]);\n }\n }\n return fixed_diffs;\n}\n\n/*\n * Try to merge tuples with their neigbors in a given range.\n * E.g. [0, 'a'], [0, 'b'] -> [0, 'ab']\n *\n * @param {Array} diffs Array of diff tuples.\n * @param {Int} start Position of the first element to merge (diffs[start] is also merged with diffs[start - 1]).\n * @param {Int} length Number of consecutive elements to check.\n * @return {Array} Array of merged diff tuples.\n */\nfunction merge_tuples (diffs, start, length) {\n // Check from (start-1) to (start+length).\n for (var i = start + length - 1; i >= 0 && i >= start - 1; i--) {\n if (i + 1 < diffs.length) {\n var left_d = diffs[i];\n var right_d = diffs[i+1];\n if (left_d[0] === right_d[1]) {\n diffs.splice(i, 2, [left_d[0], left_d[1] + right_d[1]]);\n }\n }\n }\n return diffs;\n}\n\n\n/***/ }),\n/* 52 */\n/***/ (function(module, exports) {\n\nexports = module.exports = typeof Object.keys === 'function'\n ? Object.keys : shim;\n\nexports.shim = shim;\nfunction shim (obj) {\n var keys = [];\n for (var key in obj) keys.push(key);\n return keys;\n}\n\n\n/***/ }),\n/* 53 */\n/***/ (function(module, exports) {\n\nvar supportsArgumentsClass = (function(){\n return Object.prototype.toString.call(arguments)\n})() == '[object Arguments]';\n\nexports = module.exports = supportsArgumentsClass ? supported : unsupported;\n\nexports.supported = supported;\nfunction supported(object) {\n return Object.prototype.toString.call(object) == '[object Arguments]';\n};\n\nexports.unsupported = unsupported;\nfunction unsupported(object){\n return object &&\n typeof object == 'object' &&\n typeof object.length == 'number' &&\n Object.prototype.hasOwnProperty.call(object, 'callee') &&\n !Object.prototype.propertyIsEnumerable.call(object, 'callee') ||\n false;\n};\n\n\n/***/ }),\n/* 54 */\n/***/ (function(module, exports) {\n\n'use strict';\n\nvar has = Object.prototype.hasOwnProperty\n , prefix = '~';\n\n/**\n * Constructor to create a storage for our `EE` objects.\n * An `Events` instance is a plain object whose properties are event names.\n *\n * @constructor\n * @api private\n */\nfunction Events() {}\n\n//\n// We try to not inherit from `Object.prototype`. In some engines creating an\n// instance in this way is faster than calling `Object.create(null)` directly.\n// If `Object.create(null)` is not supported we prefix the event names with a\n// character to make sure that the built-in object properties are not\n// overridden or used as an attack vector.\n//\nif (Object.create) {\n Events.prototype = Object.create(null);\n\n //\n // This hack is needed because the `__proto__` property is still inherited in\n // some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5.\n //\n if (!new Events().__proto__) prefix = false;\n}\n\n/**\n * Representation of a single event listener.\n *\n * @param {Function} fn The listener function.\n * @param {Mixed} context The context to invoke the listener with.\n * @param {Boolean} [once=false] Specify if the listener is a one-time listener.\n * @constructor\n * @api private\n */\nfunction EE(fn, context, once) {\n this.fn = fn;\n this.context = context;\n this.once = once || false;\n}\n\n/**\n * Minimal `EventEmitter` interface that is molded against the Node.js\n * `EventEmitter` interface.\n *\n * @constructor\n * @api public\n */\nfunction EventEmitter() {\n this._events = new Events();\n this._eventsCount = 0;\n}\n\n/**\n * Return an array listing the events for which the emitter has registered\n * listeners.\n *\n * @returns {Array}\n * @api public\n */\nEventEmitter.prototype.eventNames = function eventNames() {\n var names = []\n , events\n , name;\n\n if (this._eventsCount === 0) return names;\n\n for (name in (events = this._events)) {\n if (has.call(events, name)) names.push(prefix ? name.slice(1) : name);\n }\n\n if (Object.getOwnPropertySymbols) {\n return names.concat(Object.getOwnPropertySymbols(events));\n }\n\n return names;\n};\n\n/**\n * Return the listeners registered for a given event.\n *\n * @param {String|Symbol} event The event name.\n * @param {Boolean} exists Only check if there are listeners.\n * @returns {Array|Boolean}\n * @api public\n */\nEventEmitter.prototype.listeners = function listeners(event, exists) {\n var evt = prefix ? prefix + event : event\n , available = this._events[evt];\n\n if (exists) return !!available;\n if (!available) return [];\n if (available.fn) return [available.fn];\n\n for (var i = 0, l = available.length, ee = new Array(l); i < l; i++) {\n ee[i] = available[i].fn;\n }\n\n return ee;\n};\n\n/**\n * Calls each of the listeners registered for a given event.\n *\n * @param {String|Symbol} event The event name.\n * @returns {Boolean} `true` if the event had listeners, else `false`.\n * @api public\n */\nEventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {\n var evt = prefix ? prefix + event : event;\n\n if (!this._events[evt]) return false;\n\n var listeners = this._events[evt]\n , len = arguments.length\n , args\n , i;\n\n if (listeners.fn) {\n if (listeners.once) this.removeListener(event, listeners.fn, undefined, true);\n\n switch (len) {\n case 1: return listeners.fn.call(listeners.context), true;\n case 2: return listeners.fn.call(listeners.context, a1), true;\n case 3: return listeners.fn.call(listeners.context, a1, a2), true;\n case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true;\n case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;\n case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;\n }\n\n for (i = 1, args = new Array(len -1); i < len; i++) {\n args[i - 1] = arguments[i];\n }\n\n listeners.fn.apply(listeners.context, args);\n } else {\n var length = listeners.length\n , j;\n\n for (i = 0; i < length; i++) {\n if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true);\n\n switch (len) {\n case 1: listeners[i].fn.call(listeners[i].context); break;\n case 2: listeners[i].fn.call(listeners[i].context, a1); break;\n case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break;\n case 4: listeners[i].fn.call(listeners[i].context, a1, a2, a3); break;\n default:\n if (!args) for (j = 1, args = new Array(len -1); j < len; j++) {\n args[j - 1] = arguments[j];\n }\n\n listeners[i].fn.apply(listeners[i].context, args);\n }\n }\n }\n\n return true;\n};\n\n/**\n * Add a listener for a given event.\n *\n * @param {String|Symbol} event The event name.\n * @param {Function} fn The listener function.\n * @param {Mixed} [context=this] The context to invoke the listener with.\n * @returns {EventEmitter} `this`.\n * @api public\n */\nEventEmitter.prototype.on = function on(event, fn, context) {\n var listener = new EE(fn, context || this)\n , evt = prefix ? prefix + event : event;\n\n if (!this._events[evt]) this._events[evt] = listener, this._eventsCount++;\n else if (!this._events[evt].fn) this._events[evt].push(listener);\n else this._events[evt] = [this._events[evt], listener];\n\n return this;\n};\n\n/**\n * Add a one-time listener for a given event.\n *\n * @param {String|Symbol} event The event name.\n * @param {Function} fn The listener function.\n * @param {Mixed} [context=this] The context to invoke the listener with.\n * @returns {EventEmitter} `this`.\n * @api public\n */\nEventEmitter.prototype.once = function once(event, fn, context) {\n var listener = new EE(fn, context || this, true)\n , evt = prefix ? prefix + event : event;\n\n if (!this._events[evt]) this._events[evt] = listener, this._eventsCount++;\n else if (!this._events[evt].fn) this._events[evt].push(listener);\n else this._events[evt] = [this._events[evt], listener];\n\n return this;\n};\n\n/**\n * Remove the listeners of a given event.\n *\n * @param {String|Symbol} event The event name.\n * @param {Function} fn Only remove the listeners that match this function.\n * @param {Mixed} context Only remove the listeners that have this context.\n * @param {Boolean} once Only remove one-time listeners.\n * @returns {EventEmitter} `this`.\n * @api public\n */\nEventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) {\n var evt = prefix ? prefix + event : event;\n\n if (!this._events[evt]) return this;\n if (!fn) {\n if (--this._eventsCount === 0) this._events = new Events();\n else delete this._events[evt];\n return this;\n }\n\n var listeners = this._events[evt];\n\n if (listeners.fn) {\n if (\n listeners.fn === fn\n && (!once || listeners.once)\n && (!context || listeners.context === context)\n ) {\n if (--this._eventsCount === 0) this._events = new Events();\n else delete this._events[evt];\n }\n } else {\n for (var i = 0, events = [], length = listeners.length; i < length; i++) {\n if (\n listeners[i].fn !== fn\n || (once && !listeners[i].once)\n || (context && listeners[i].context !== context)\n ) {\n events.push(listeners[i]);\n }\n }\n\n //\n // Reset the array, or remove it completely if we have no more listeners.\n //\n if (events.length) this._events[evt] = events.length === 1 ? events[0] : events;\n else if (--this._eventsCount === 0) this._events = new Events();\n else delete this._events[evt];\n }\n\n return this;\n};\n\n/**\n * Remove all listeners, or those of the specified event.\n *\n * @param {String|Symbol} [event] The event name.\n * @returns {EventEmitter} `this`.\n * @api public\n */\nEventEmitter.prototype.removeAllListeners = function removeAllListeners(event) {\n var evt;\n\n if (event) {\n evt = prefix ? prefix + event : event;\n if (this._events[evt]) {\n if (--this._eventsCount === 0) this._events = new Events();\n else delete this._events[evt];\n }\n } else {\n this._events = new Events();\n this._eventsCount = 0;\n }\n\n return this;\n};\n\n//\n// Alias methods names because people roll like that.\n//\nEventEmitter.prototype.off = EventEmitter.prototype.removeListener;\nEventEmitter.prototype.addListener = EventEmitter.prototype.on;\n\n//\n// This function doesn't apply anymore.\n//\nEventEmitter.prototype.setMaxListeners = function setMaxListeners() {\n return this;\n};\n\n//\n// Expose the prefix.\n//\nEventEmitter.prefixed = prefix;\n\n//\n// Allow `EventEmitter` to be imported as module namespace.\n//\nEventEmitter.EventEmitter = EventEmitter;\n\n//\n// Expose the module.\n//\nif ('undefined' !== typeof module) {\n module.exports = EventEmitter;\n}\n\n\n/***/ }),\n/* 55 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.matchText = exports.matchSpacing = exports.matchNewline = exports.matchBlot = exports.matchAttributor = exports.default = undefined;\n\nvar _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; };\n\nvar _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_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\"]) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); } }; }();\n\nvar _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; }; }();\n\nvar _extend2 = __webpack_require__(3);\n\nvar _extend3 = _interopRequireDefault(_extend2);\n\nvar _quillDelta = __webpack_require__(2);\n\nvar _quillDelta2 = _interopRequireDefault(_quillDelta);\n\nvar _parchment = __webpack_require__(0);\n\nvar _parchment2 = _interopRequireDefault(_parchment);\n\nvar _quill = __webpack_require__(5);\n\nvar _quill2 = _interopRequireDefault(_quill);\n\nvar _logger = __webpack_require__(10);\n\nvar _logger2 = _interopRequireDefault(_logger);\n\nvar _module = __webpack_require__(9);\n\nvar _module2 = _interopRequireDefault(_module);\n\nvar _align = __webpack_require__(36);\n\nvar _background = __webpack_require__(37);\n\nvar _code = __webpack_require__(13);\n\nvar _code2 = _interopRequireDefault(_code);\n\nvar _color = __webpack_require__(26);\n\nvar _direction = __webpack_require__(38);\n\nvar _font = __webpack_require__(39);\n\nvar _size = __webpack_require__(40);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\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 _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nvar debug = (0, _logger2.default)('quill:clipboard');\n\nvar DOM_KEY = '__ql-matcher';\n\nvar CLIPBOARD_CONFIG = [[Node.TEXT_NODE, matchText], [Node.TEXT_NODE, matchNewline], ['br', matchBreak], [Node.ELEMENT_NODE, matchNewline], [Node.ELEMENT_NODE, matchBlot], [Node.ELEMENT_NODE, matchSpacing], [Node.ELEMENT_NODE, matchAttributor], [Node.ELEMENT_NODE, matchStyles], ['li', matchIndent], ['b', matchAlias.bind(matchAlias, 'bold')], ['i', matchAlias.bind(matchAlias, 'italic')], ['style', matchIgnore]];\n\nvar ATTRIBUTE_ATTRIBUTORS = [_align.AlignAttribute, _direction.DirectionAttribute].reduce(function (memo, attr) {\n memo[attr.keyName] = attr;\n return memo;\n}, {});\n\nvar STYLE_ATTRIBUTORS = [_align.AlignStyle, _background.BackgroundStyle, _color.ColorStyle, _direction.DirectionStyle, _font.FontStyle, _size.SizeStyle].reduce(function (memo, attr) {\n memo[attr.keyName] = attr;\n return memo;\n}, {});\n\nvar Clipboard = function (_Module) {\n _inherits(Clipboard, _Module);\n\n function Clipboard(quill, options) {\n _classCallCheck(this, Clipboard);\n\n var _this = _possibleConstructorReturn(this, (Clipboard.__proto__ || Object.getPrototypeOf(Clipboard)).call(this, quill, options));\n\n _this.quill.root.addEventListener('paste', _this.onPaste.bind(_this));\n _this.container = _this.quill.addContainer('ql-clipboard');\n _this.container.setAttribute('contenteditable', true);\n _this.container.setAttribute('tabindex', -1);\n _this.matchers = [];\n CLIPBOARD_CONFIG.concat(_this.options.matchers).forEach(function (_ref) {\n var _ref2 = _slicedToArray(_ref, 2),\n selector = _ref2[0],\n matcher = _ref2[1];\n\n if (!options.matchVisual && matcher === matchSpacing) return;\n _this.addMatcher(selector, matcher);\n });\n return _this;\n }\n\n _createClass(Clipboard, [{\n key: 'addMatcher',\n value: function addMatcher(selector, matcher) {\n this.matchers.push([selector, matcher]);\n }\n }, {\n key: 'convert',\n value: function convert(html) {\n if (typeof html === 'string') {\n this.container.innerHTML = html.replace(/\\>\\r?\\n +\\<'); // Remove spaces between tags\n return this.convert();\n }\n var formats = this.quill.getFormat(this.quill.selection.savedRange.index);\n if (formats[_code2.default.blotName]) {\n var text = this.container.innerText;\n this.container.innerHTML = '';\n return new _quillDelta2.default().insert(text, _defineProperty({}, _code2.default.blotName, formats[_code2.default.blotName]));\n }\n\n var _prepareMatching = this.prepareMatching(),\n _prepareMatching2 = _slicedToArray(_prepareMatching, 2),\n elementMatchers = _prepareMatching2[0],\n textMatchers = _prepareMatching2[1];\n\n var delta = traverse(this.container, elementMatchers, textMatchers);\n // Remove trailing newline\n if (deltaEndsWith(delta, '\\n') && delta.ops[delta.ops.length - 1].attributes == null) {\n delta = delta.compose(new _quillDelta2.default().retain(delta.length() - 1).delete(1));\n }\n debug.log('convert', this.container.innerHTML, delta);\n this.container.innerHTML = '';\n return delta;\n }\n }, {\n key: 'dangerouslyPasteHTML',\n value: function dangerouslyPasteHTML(index, html) {\n var source = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _quill2.default.sources.API;\n\n if (typeof index === 'string') {\n this.quill.setContents(this.convert(index), html);\n this.quill.setSelection(0, _quill2.default.sources.SILENT);\n } else {\n var paste = this.convert(html);\n this.quill.updateContents(new _quillDelta2.default().retain(index).concat(paste), source);\n this.quill.setSelection(index + paste.length(), _quill2.default.sources.SILENT);\n }\n }\n }, {\n key: 'onPaste',\n value: function onPaste(e) {\n var _this2 = this;\n\n if (e.defaultPrevented || !this.quill.isEnabled()) return;\n var range = this.quill.getSelection();\n var delta = new _quillDelta2.default().retain(range.index);\n var scrollTop = this.quill.scrollingContainer.scrollTop;\n this.container.focus();\n this.quill.selection.update(_quill2.default.sources.SILENT);\n setTimeout(function () {\n delta = delta.concat(_this2.convert()).delete(range.length);\n _this2.quill.updateContents(delta, _quill2.default.sources.USER);\n // range.length contributes to delta.length()\n _this2.quill.setSelection(delta.length() - range.length, _quill2.default.sources.SILENT);\n _this2.quill.scrollingContainer.scrollTop = scrollTop;\n _this2.quill.focus();\n }, 1);\n }\n }, {\n key: 'prepareMatching',\n value: function prepareMatching() {\n var _this3 = this;\n\n var elementMatchers = [],\n textMatchers = [];\n this.matchers.forEach(function (pair) {\n var _pair = _slicedToArray(pair, 2),\n selector = _pair[0],\n matcher = _pair[1];\n\n switch (selector) {\n case Node.TEXT_NODE:\n textMatchers.push(matcher);\n break;\n case Node.ELEMENT_NODE:\n elementMatchers.push(matcher);\n break;\n default:\n [].forEach.call(_this3.container.querySelectorAll(selector), function (node) {\n // TODO use weakmap\n node[DOM_KEY] = node[DOM_KEY] || [];\n node[DOM_KEY].push(matcher);\n });\n break;\n }\n });\n return [elementMatchers, textMatchers];\n }\n }]);\n\n return Clipboard;\n}(_module2.default);\n\nClipboard.DEFAULTS = {\n matchers: [],\n matchVisual: true\n};\n\nfunction applyFormat(delta, format, value) {\n if ((typeof format === 'undefined' ? 'undefined' : _typeof(format)) === 'object') {\n return Object.keys(format).reduce(function (delta, key) {\n return applyFormat(delta, key, format[key]);\n }, delta);\n } else {\n return delta.reduce(function (delta, op) {\n if (op.attributes && op.attributes[format]) {\n return delta.push(op);\n } else {\n return delta.insert(op.insert, (0, _extend3.default)({}, _defineProperty({}, format, value), op.attributes));\n }\n }, new _quillDelta2.default());\n }\n}\n\nfunction computeStyle(node) {\n if (node.nodeType !== Node.ELEMENT_NODE) return {};\n var DOM_KEY = '__ql-computed-style';\n return node[DOM_KEY] || (node[DOM_KEY] = window.getComputedStyle(node));\n}\n\nfunction deltaEndsWith(delta, text) {\n var endText = \"\";\n for (var i = delta.ops.length - 1; i >= 0 && endText.length < text.length; --i) {\n var op = delta.ops[i];\n if (typeof op.insert !== 'string') break;\n endText = op.insert + endText;\n }\n return endText.slice(-1 * text.length) === text;\n}\n\nfunction isLine(node) {\n if (node.childNodes.length === 0) return false; // Exclude embed blocks\n var style = computeStyle(node);\n return ['block', 'list-item'].indexOf(style.display) > -1;\n}\n\nfunction traverse(node, elementMatchers, textMatchers) {\n // Post-order\n if (node.nodeType === node.TEXT_NODE) {\n return textMatchers.reduce(function (delta, matcher) {\n return matcher(node, delta);\n }, new _quillDelta2.default());\n } else if (node.nodeType === node.ELEMENT_NODE) {\n return [].reduce.call(node.childNodes || [], function (delta, childNode) {\n var childrenDelta = traverse(childNode, elementMatchers, textMatchers);\n if (childNode.nodeType === node.ELEMENT_NODE) {\n childrenDelta = elementMatchers.reduce(function (childrenDelta, matcher) {\n return matcher(childNode, childrenDelta);\n }, childrenDelta);\n childrenDelta = (childNode[DOM_KEY] || []).reduce(function (childrenDelta, matcher) {\n return matcher(childNode, childrenDelta);\n }, childrenDelta);\n }\n return delta.concat(childrenDelta);\n }, new _quillDelta2.default());\n } else {\n return new _quillDelta2.default();\n }\n}\n\nfunction matchAlias(format, node, delta) {\n return applyFormat(delta, format, true);\n}\n\nfunction matchAttributor(node, delta) {\n var attributes = _parchment2.default.Attributor.Attribute.keys(node);\n var classes = _parchment2.default.Attributor.Class.keys(node);\n var styles = _parchment2.default.Attributor.Style.keys(node);\n var formats = {};\n attributes.concat(classes).concat(styles).forEach(function (name) {\n var attr = _parchment2.default.query(name, _parchment2.default.Scope.ATTRIBUTE);\n if (attr != null) {\n formats[attr.attrName] = attr.value(node);\n if (formats[attr.attrName]) return;\n }\n attr = ATTRIBUTE_ATTRIBUTORS[name];\n if (attr != null && (attr.attrName === name || attr.keyName === name)) {\n formats[attr.attrName] = attr.value(node) || undefined;\n }\n attr = STYLE_ATTRIBUTORS[name];\n if (attr != null && (attr.attrName === name || attr.keyName === name)) {\n attr = STYLE_ATTRIBUTORS[name];\n formats[attr.attrName] = attr.value(node) || undefined;\n }\n });\n if (Object.keys(formats).length > 0) {\n delta = applyFormat(delta, formats);\n }\n return delta;\n}\n\nfunction matchBlot(node, delta) {\n var match = _parchment2.default.query(node);\n if (match == null) return delta;\n if (match.prototype instanceof _parchment2.default.Embed) {\n var embed = {};\n var value = match.value(node);\n if (value != null) {\n embed[match.blotName] = value;\n delta = new _quillDelta2.default().insert(embed, match.formats(node));\n }\n } else if (typeof match.formats === 'function') {\n delta = applyFormat(delta, match.blotName, match.formats(node));\n }\n return delta;\n}\n\nfunction matchBreak(node, delta) {\n if (!deltaEndsWith(delta, '\\n')) {\n delta.insert('\\n');\n }\n return delta;\n}\n\nfunction matchIgnore() {\n return new _quillDelta2.default();\n}\n\nfunction matchIndent(node, delta) {\n var match = _parchment2.default.query(node);\n if (match == null || match.blotName !== 'list-item' || !deltaEndsWith(delta, '\\n')) {\n return delta;\n }\n var indent = -1,\n parent = node.parentNode;\n while (!parent.classList.contains('ql-clipboard')) {\n if ((_parchment2.default.query(parent) || {}).blotName === 'list') {\n indent += 1;\n }\n parent = parent.parentNode;\n }\n if (indent <= 0) return delta;\n return delta.compose(new _quillDelta2.default().retain(delta.length() - 1).retain(1, { indent: indent }));\n}\n\nfunction matchNewline(node, delta) {\n if (!deltaEndsWith(delta, '\\n')) {\n if (isLine(node) || delta.length() > 0 && node.nextSibling && isLine(node.nextSibling)) {\n delta.insert('\\n');\n }\n }\n return delta;\n}\n\nfunction matchSpacing(node, delta) {\n if (isLine(node) && node.nextElementSibling != null && !deltaEndsWith(delta, '\\n\\n')) {\n var nodeHeight = node.offsetHeight + parseFloat(computeStyle(node).marginTop) + parseFloat(computeStyle(node).marginBottom);\n if (node.nextElementSibling.offsetTop > node.offsetTop + nodeHeight * 1.5) {\n delta.insert('\\n');\n }\n }\n return delta;\n}\n\nfunction matchStyles(node, delta) {\n var formats = {};\n var style = node.style || {};\n if (style.fontStyle && computeStyle(node).fontStyle === 'italic') {\n formats.italic = true;\n }\n if (style.fontWeight && (computeStyle(node).fontWeight.startsWith('bold') || parseInt(computeStyle(node).fontWeight) >= 700)) {\n formats.bold = true;\n }\n if (Object.keys(formats).length > 0) {\n delta = applyFormat(delta, formats);\n }\n if (parseFloat(style.textIndent || 0) > 0) {\n // Could be 0.5in\n delta = new _quillDelta2.default().insert('\\t').concat(delta);\n }\n return delta;\n}\n\nfunction matchText(node, delta) {\n var text = node.data;\n // Word represents empty line with  \n if (node.parentNode.tagName === 'O:P') {\n return delta.insert(text.trim());\n }\n if (text.trim().length === 0 && node.parentNode.classList.contains('ql-clipboard')) {\n return delta;\n }\n if (!computeStyle(node.parentNode).whiteSpace.startsWith('pre')) {\n // eslint-disable-next-line func-style\n var replacer = function replacer(collapse, match) {\n match = match.replace(/[^\\u00a0]/g, ''); // \\u00a0 is nbsp;\n return match.length < 1 && collapse ? ' ' : match;\n };\n text = text.replace(/\\r\\n/g, ' ').replace(/\\n/g, ' ');\n text = text.replace(/\\s\\s+/g, replacer.bind(replacer, true)); // collapse whitespace\n if (node.previousSibling == null && isLine(node.parentNode) || node.previousSibling != null && isLine(node.previousSibling)) {\n text = text.replace(/^\\s+/, replacer.bind(replacer, false));\n }\n if (node.nextSibling == null && isLine(node.parentNode) || node.nextSibling != null && isLine(node.nextSibling)) {\n text = text.replace(/\\s+$/, replacer.bind(replacer, false));\n }\n }\n return delta.insert(text);\n}\n\nexports.default = Clipboard;\nexports.matchAttributor = matchAttributor;\nexports.matchBlot = matchBlot;\nexports.matchNewline = matchNewline;\nexports.matchSpacing = matchSpacing;\nexports.matchText = matchText;\n\n/***/ }),\n/* 56 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _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; }; }();\n\nvar _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if (\"value\" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };\n\nvar _inline = __webpack_require__(6);\n\nvar _inline2 = _interopRequireDefault(_inline);\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 _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nvar Bold = function (_Inline) {\n _inherits(Bold, _Inline);\n\n function Bold() {\n _classCallCheck(this, Bold);\n\n return _possibleConstructorReturn(this, (Bold.__proto__ || Object.getPrototypeOf(Bold)).apply(this, arguments));\n }\n\n _createClass(Bold, [{\n key: 'optimize',\n value: function optimize(context) {\n _get(Bold.prototype.__proto__ || Object.getPrototypeOf(Bold.prototype), 'optimize', this).call(this, context);\n if (this.domNode.tagName !== this.statics.tagName[0]) {\n this.replaceWith(this.statics.blotName);\n }\n }\n }], [{\n key: 'create',\n value: function create() {\n return _get(Bold.__proto__ || Object.getPrototypeOf(Bold), 'create', this).call(this);\n }\n }, {\n key: 'formats',\n value: function formats() {\n return true;\n }\n }]);\n\n return Bold;\n}(_inline2.default);\n\nBold.blotName = 'bold';\nBold.tagName = ['STRONG', 'B'];\n\nexports.default = Bold;\n\n/***/ }),\n/* 57 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.addControls = exports.default = undefined;\n\nvar _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_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\"]) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); } }; }();\n\nvar _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; }; }();\n\nvar _quillDelta = __webpack_require__(2);\n\nvar _quillDelta2 = _interopRequireDefault(_quillDelta);\n\nvar _parchment = __webpack_require__(0);\n\nvar _parchment2 = _interopRequireDefault(_parchment);\n\nvar _quill = __webpack_require__(5);\n\nvar _quill2 = _interopRequireDefault(_quill);\n\nvar _logger = __webpack_require__(10);\n\nvar _logger2 = _interopRequireDefault(_logger);\n\nvar _module = __webpack_require__(9);\n\nvar _module2 = _interopRequireDefault(_module);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\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 _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nvar debug = (0, _logger2.default)('quill:toolbar');\n\nvar Toolbar = function (_Module) {\n _inherits(Toolbar, _Module);\n\n function Toolbar(quill, options) {\n _classCallCheck(this, Toolbar);\n\n var _this = _possibleConstructorReturn(this, (Toolbar.__proto__ || Object.getPrototypeOf(Toolbar)).call(this, quill, options));\n\n if (Array.isArray(_this.options.container)) {\n var container = document.createElement('div');\n addControls(container, _this.options.container);\n quill.container.parentNode.insertBefore(container, quill.container);\n _this.container = container;\n } else if (typeof _this.options.container === 'string') {\n _this.container = document.querySelector(_this.options.container);\n } else {\n _this.container = _this.options.container;\n }\n if (!(_this.container instanceof HTMLElement)) {\n var _ret;\n\n return _ret = debug.error('Container required for toolbar', _this.options), _possibleConstructorReturn(_this, _ret);\n }\n _this.container.classList.add('ql-toolbar');\n _this.controls = [];\n _this.handlers = {};\n Object.keys(_this.options.handlers).forEach(function (format) {\n _this.addHandler(format, _this.options.handlers[format]);\n });\n [].forEach.call(_this.container.querySelectorAll('button, select'), function (input) {\n _this.attach(input);\n });\n _this.quill.on(_quill2.default.events.EDITOR_CHANGE, function (type, range) {\n if (type === _quill2.default.events.SELECTION_CHANGE) {\n _this.update(range);\n }\n });\n _this.quill.on(_quill2.default.events.SCROLL_OPTIMIZE, function () {\n var _this$quill$selection = _this.quill.selection.getRange(),\n _this$quill$selection2 = _slicedToArray(_this$quill$selection, 1),\n range = _this$quill$selection2[0]; // quill.getSelection triggers update\n\n\n _this.update(range);\n });\n return _this;\n }\n\n _createClass(Toolbar, [{\n key: 'addHandler',\n value: function addHandler(format, handler) {\n this.handlers[format] = handler;\n }\n }, {\n key: 'attach',\n value: function attach(input) {\n var _this2 = this;\n\n var format = [].find.call(input.classList, function (className) {\n return className.indexOf('ql-') === 0;\n });\n if (!format) return;\n format = format.slice('ql-'.length);\n if (input.tagName === 'BUTTON') {\n input.setAttribute('type', 'button');\n }\n if (this.handlers[format] == null) {\n if (this.quill.scroll.whitelist != null && this.quill.scroll.whitelist[format] == null) {\n debug.warn('ignoring attaching to disabled format', format, input);\n return;\n }\n if (_parchment2.default.query(format) == null) {\n debug.warn('ignoring attaching to nonexistent format', format, input);\n return;\n }\n }\n var eventName = input.tagName === 'SELECT' ? 'change' : 'click';\n input.addEventListener(eventName, function (e) {\n var value = void 0;\n if (input.tagName === 'SELECT') {\n if (input.selectedIndex < 0) return;\n var selected = input.options[input.selectedIndex];\n if (selected.hasAttribute('selected')) {\n value = false;\n } else {\n value = selected.value || false;\n }\n } else {\n if (input.classList.contains('ql-active')) {\n value = false;\n } else {\n value = input.value || !input.hasAttribute('value');\n }\n e.preventDefault();\n }\n _this2.quill.focus();\n\n var _quill$selection$getR = _this2.quill.selection.getRange(),\n _quill$selection$getR2 = _slicedToArray(_quill$selection$getR, 1),\n range = _quill$selection$getR2[0];\n\n if (_this2.handlers[format] != null) {\n _this2.handlers[format].call(_this2, value);\n } else if (_parchment2.default.query(format).prototype instanceof _parchment2.default.Embed) {\n value = prompt('Enter ' + format);\n if (!value) return;\n _this2.quill.updateContents(new _quillDelta2.default().retain(range.index).delete(range.length).insert(_defineProperty({}, format, value)), _quill2.default.sources.USER);\n } else {\n _this2.quill.format(format, value, _quill2.default.sources.USER);\n }\n _this2.update(range);\n });\n // TODO use weakmap\n this.controls.push([format, input]);\n }\n }, {\n key: 'update',\n value: function update(range) {\n var formats = range == null ? {} : this.quill.getFormat(range);\n this.controls.forEach(function (pair) {\n var _pair = _slicedToArray(pair, 2),\n format = _pair[0],\n input = _pair[1];\n\n if (input.tagName === 'SELECT') {\n var option = void 0;\n if (range == null) {\n option = null;\n } else if (formats[format] == null) {\n option = input.querySelector('option[selected]');\n } else if (!Array.isArray(formats[format])) {\n var value = formats[format];\n if (typeof value === 'string') {\n value = value.replace(/\\\"/g, '\\\\\"');\n }\n option = input.querySelector('option[value=\"' + value + '\"]');\n }\n if (option == null) {\n input.value = ''; // TODO make configurable?\n input.selectedIndex = -1;\n } else {\n option.selected = true;\n }\n } else {\n if (range == null) {\n input.classList.remove('ql-active');\n } else if (input.hasAttribute('value')) {\n // both being null should match (default values)\n // '1' should match with 1 (headers)\n var isActive = formats[format] === input.getAttribute('value') || formats[format] != null && formats[format].toString() === input.getAttribute('value') || formats[format] == null && !input.getAttribute('value');\n input.classList.toggle('ql-active', isActive);\n } else {\n input.classList.toggle('ql-active', formats[format] != null);\n }\n }\n });\n }\n }]);\n\n return Toolbar;\n}(_module2.default);\n\nToolbar.DEFAULTS = {};\n\nfunction addButton(container, format, value) {\n var input = document.createElement('button');\n input.setAttribute('type', 'button');\n input.classList.add('ql-' + format);\n if (value != null) {\n input.value = value;\n }\n container.appendChild(input);\n}\n\nfunction addControls(container, groups) {\n if (!Array.isArray(groups[0])) {\n groups = [groups];\n }\n groups.forEach(function (controls) {\n var group = document.createElement('span');\n group.classList.add('ql-formats');\n controls.forEach(function (control) {\n if (typeof control === 'string') {\n addButton(group, control);\n } else {\n var format = Object.keys(control)[0];\n var value = control[format];\n if (Array.isArray(value)) {\n addSelect(group, format, value);\n } else {\n addButton(group, format, value);\n }\n }\n });\n container.appendChild(group);\n });\n}\n\nfunction addSelect(container, format, values) {\n var input = document.createElement('select');\n input.classList.add('ql-' + format);\n values.forEach(function (value) {\n var option = document.createElement('option');\n if (value !== false) {\n option.setAttribute('value', value);\n } else {\n option.setAttribute('selected', 'selected');\n }\n input.appendChild(option);\n });\n container.appendChild(input);\n}\n\nToolbar.DEFAULTS = {\n container: null,\n handlers: {\n clean: function clean() {\n var _this3 = this;\n\n var range = this.quill.getSelection();\n if (range == null) return;\n if (range.length == 0) {\n var formats = this.quill.getFormat();\n Object.keys(formats).forEach(function (name) {\n // Clean functionality in existing apps only clean inline formats\n if (_parchment2.default.query(name, _parchment2.default.Scope.INLINE) != null) {\n _this3.quill.format(name, false);\n }\n });\n } else {\n this.quill.removeFormat(range, _quill2.default.sources.USER);\n }\n },\n direction: function direction(value) {\n var align = this.quill.getFormat()['align'];\n if (value === 'rtl' && align == null) {\n this.quill.format('align', 'right', _quill2.default.sources.USER);\n } else if (!value && align === 'right') {\n this.quill.format('align', false, _quill2.default.sources.USER);\n }\n this.quill.format('direction', value, _quill2.default.sources.USER);\n },\n indent: function indent(value) {\n var range = this.quill.getSelection();\n var formats = this.quill.getFormat(range);\n var indent = parseInt(formats.indent || 0);\n if (value === '+1' || value === '-1') {\n var modifier = value === '+1' ? 1 : -1;\n if (formats.direction === 'rtl') modifier *= -1;\n this.quill.format('indent', indent + modifier, _quill2.default.sources.USER);\n }\n },\n link: function link(value) {\n if (value === true) {\n value = prompt('Enter link URL:');\n }\n this.quill.format('link', value, _quill2.default.sources.USER);\n },\n list: function list(value) {\n var range = this.quill.getSelection();\n var formats = this.quill.getFormat(range);\n if (value === 'check') {\n if (formats['list'] === 'checked' || formats['list'] === 'unchecked') {\n this.quill.format('list', false, _quill2.default.sources.USER);\n } else {\n this.quill.format('list', 'unchecked', _quill2.default.sources.USER);\n }\n } else {\n this.quill.format('list', value, _quill2.default.sources.USER);\n }\n }\n }\n};\n\nexports.default = Toolbar;\nexports.addControls = addControls;\n\n/***/ }),\n/* 58 */\n/***/ (function(module, exports) {\n\nmodule.exports = \" \";\n\n/***/ }),\n/* 59 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _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; }; }();\n\nvar _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if (\"value\" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };\n\nvar _picker = __webpack_require__(28);\n\nvar _picker2 = _interopRequireDefault(_picker);\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 _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nvar ColorPicker = function (_Picker) {\n _inherits(ColorPicker, _Picker);\n\n function ColorPicker(select, label) {\n _classCallCheck(this, ColorPicker);\n\n var _this = _possibleConstructorReturn(this, (ColorPicker.__proto__ || Object.getPrototypeOf(ColorPicker)).call(this, select));\n\n _this.label.innerHTML = label;\n _this.container.classList.add('ql-color-picker');\n [].slice.call(_this.container.querySelectorAll('.ql-picker-item'), 0, 7).forEach(function (item) {\n item.classList.add('ql-primary');\n });\n return _this;\n }\n\n _createClass(ColorPicker, [{\n key: 'buildItem',\n value: function buildItem(option) {\n var item = _get(ColorPicker.prototype.__proto__ || Object.getPrototypeOf(ColorPicker.prototype), 'buildItem', this).call(this, option);\n item.style.backgroundColor = option.getAttribute('value') || '';\n return item;\n }\n }, {\n key: 'selectItem',\n value: function selectItem(item, trigger) {\n _get(ColorPicker.prototype.__proto__ || Object.getPrototypeOf(ColorPicker.prototype), 'selectItem', this).call(this, item, trigger);\n var colorLabel = this.label.querySelector('.ql-color-label');\n var value = item ? item.getAttribute('data-value') || '' : '';\n if (colorLabel) {\n if (colorLabel.tagName === 'line') {\n colorLabel.style.stroke = value;\n } else {\n colorLabel.style.fill = value;\n }\n }\n }\n }]);\n\n return ColorPicker;\n}(_picker2.default);\n\nexports.default = ColorPicker;\n\n/***/ }),\n/* 60 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _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; }; }();\n\nvar _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if (\"value\" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };\n\nvar _picker = __webpack_require__(28);\n\nvar _picker2 = _interopRequireDefault(_picker);\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 _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nvar IconPicker = function (_Picker) {\n _inherits(IconPicker, _Picker);\n\n function IconPicker(select, icons) {\n _classCallCheck(this, IconPicker);\n\n var _this = _possibleConstructorReturn(this, (IconPicker.__proto__ || Object.getPrototypeOf(IconPicker)).call(this, select));\n\n _this.container.classList.add('ql-icon-picker');\n [].forEach.call(_this.container.querySelectorAll('.ql-picker-item'), function (item) {\n item.innerHTML = icons[item.getAttribute('data-value') || ''];\n });\n _this.defaultItem = _this.container.querySelector('.ql-selected');\n _this.selectItem(_this.defaultItem);\n return _this;\n }\n\n _createClass(IconPicker, [{\n key: 'selectItem',\n value: function selectItem(item, trigger) {\n _get(IconPicker.prototype.__proto__ || Object.getPrototypeOf(IconPicker.prototype), 'selectItem', this).call(this, item, trigger);\n item = item || this.defaultItem;\n this.label.innerHTML = item.innerHTML;\n }\n }]);\n\n return IconPicker;\n}(_picker2.default);\n\nexports.default = IconPicker;\n\n/***/ }),\n/* 61 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _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; }; }();\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nvar Tooltip = function () {\n function Tooltip(quill, boundsContainer) {\n var _this = this;\n\n _classCallCheck(this, Tooltip);\n\n this.quill = quill;\n this.boundsContainer = boundsContainer || document.body;\n this.root = quill.addContainer('ql-tooltip');\n this.root.innerHTML = this.constructor.TEMPLATE;\n if (this.quill.root === this.quill.scrollingContainer) {\n this.quill.root.addEventListener('scroll', function () {\n _this.root.style.marginTop = -1 * _this.quill.root.scrollTop + 'px';\n });\n }\n this.hide();\n }\n\n _createClass(Tooltip, [{\n key: 'hide',\n value: function hide() {\n this.root.classList.add('ql-hidden');\n }\n }, {\n key: 'position',\n value: function position(reference) {\n var left = reference.left + reference.width / 2 - this.root.offsetWidth / 2;\n // root.scrollTop should be 0 if scrollContainer !== root\n var top = reference.bottom + this.quill.root.scrollTop;\n this.root.style.left = left + 'px';\n this.root.style.top = top + 'px';\n this.root.classList.remove('ql-flip');\n var containerBounds = this.boundsContainer.getBoundingClientRect();\n var rootBounds = this.root.getBoundingClientRect();\n var shift = 0;\n if (rootBounds.right > containerBounds.right) {\n shift = containerBounds.right - rootBounds.right;\n this.root.style.left = left + shift + 'px';\n }\n if (rootBounds.left < containerBounds.left) {\n shift = containerBounds.left - rootBounds.left;\n this.root.style.left = left + shift + 'px';\n }\n if (rootBounds.bottom > containerBounds.bottom) {\n var height = rootBounds.bottom - rootBounds.top;\n var verticalShift = reference.bottom - reference.top + height;\n this.root.style.top = top - verticalShift + 'px';\n this.root.classList.add('ql-flip');\n }\n return shift;\n }\n }, {\n key: 'show',\n value: function show() {\n this.root.classList.remove('ql-editing');\n this.root.classList.remove('ql-hidden');\n }\n }]);\n\n return Tooltip;\n}();\n\nexports.default = Tooltip;\n\n/***/ }),\n/* 62 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_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\"]) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); } }; }();\n\nvar _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if (\"value\" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };\n\nvar _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; }; }();\n\nvar _extend = __webpack_require__(3);\n\nvar _extend2 = _interopRequireDefault(_extend);\n\nvar _emitter = __webpack_require__(8);\n\nvar _emitter2 = _interopRequireDefault(_emitter);\n\nvar _base = __webpack_require__(43);\n\nvar _base2 = _interopRequireDefault(_base);\n\nvar _link = __webpack_require__(27);\n\nvar _link2 = _interopRequireDefault(_link);\n\nvar _selection = __webpack_require__(15);\n\nvar _icons = __webpack_require__(41);\n\nvar _icons2 = _interopRequireDefault(_icons);\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 _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nvar TOOLBAR_CONFIG = [[{ header: ['1', '2', '3', false] }], ['bold', 'italic', 'underline', 'link'], [{ list: 'ordered' }, { list: 'bullet' }], ['clean']];\n\nvar SnowTheme = function (_BaseTheme) {\n _inherits(SnowTheme, _BaseTheme);\n\n function SnowTheme(quill, options) {\n _classCallCheck(this, SnowTheme);\n\n if (options.modules.toolbar != null && options.modules.toolbar.container == null) {\n options.modules.toolbar.container = TOOLBAR_CONFIG;\n }\n\n var _this = _possibleConstructorReturn(this, (SnowTheme.__proto__ || Object.getPrototypeOf(SnowTheme)).call(this, quill, options));\n\n _this.quill.container.classList.add('ql-snow');\n return _this;\n }\n\n _createClass(SnowTheme, [{\n key: 'extendToolbar',\n value: function extendToolbar(toolbar) {\n toolbar.container.classList.add('ql-snow');\n this.buildButtons([].slice.call(toolbar.container.querySelectorAll('button')), _icons2.default);\n this.buildPickers([].slice.call(toolbar.container.querySelectorAll('select')), _icons2.default);\n this.tooltip = new SnowTooltip(this.quill, this.options.bounds);\n if (toolbar.container.querySelector('.ql-link')) {\n this.quill.keyboard.addBinding({ key: 'K', shortKey: true }, function (range, context) {\n toolbar.handlers['link'].call(toolbar, !context.format.link);\n });\n }\n }\n }]);\n\n return SnowTheme;\n}(_base2.default);\n\nSnowTheme.DEFAULTS = (0, _extend2.default)(true, {}, _base2.default.DEFAULTS, {\n modules: {\n toolbar: {\n handlers: {\n link: function link(value) {\n if (value) {\n var range = this.quill.getSelection();\n if (range == null || range.length == 0) return;\n var preview = this.quill.getText(range);\n if (/^\\S+@\\S+\\.\\S+$/.test(preview) && preview.indexOf('mailto:') !== 0) {\n preview = 'mailto:' + preview;\n }\n var tooltip = this.quill.theme.tooltip;\n tooltip.edit('link', preview);\n } else {\n this.quill.format('link', false);\n }\n }\n }\n }\n }\n});\n\nvar SnowTooltip = function (_BaseTooltip) {\n _inherits(SnowTooltip, _BaseTooltip);\n\n function SnowTooltip(quill, bounds) {\n _classCallCheck(this, SnowTooltip);\n\n var _this2 = _possibleConstructorReturn(this, (SnowTooltip.__proto__ || Object.getPrototypeOf(SnowTooltip)).call(this, quill, bounds));\n\n _this2.preview = _this2.root.querySelector('a.ql-preview');\n return _this2;\n }\n\n _createClass(SnowTooltip, [{\n key: 'listen',\n value: function listen() {\n var _this3 = this;\n\n _get(SnowTooltip.prototype.__proto__ || Object.getPrototypeOf(SnowTooltip.prototype), 'listen', this).call(this);\n this.root.querySelector('a.ql-action').addEventListener('click', function (event) {\n if (_this3.root.classList.contains('ql-editing')) {\n _this3.save();\n } else {\n _this3.edit('link', _this3.preview.textContent);\n }\n event.preventDefault();\n });\n this.root.querySelector('a.ql-remove').addEventListener('click', function (event) {\n if (_this3.linkRange != null) {\n var range = _this3.linkRange;\n _this3.restoreFocus();\n _this3.quill.formatText(range, 'link', false, _emitter2.default.sources.USER);\n delete _this3.linkRange;\n }\n event.preventDefault();\n _this3.hide();\n });\n this.quill.on(_emitter2.default.events.SELECTION_CHANGE, function (range, oldRange, source) {\n if (range == null) return;\n if (range.length === 0 && source === _emitter2.default.sources.USER) {\n var _quill$scroll$descend = _this3.quill.scroll.descendant(_link2.default, range.index),\n _quill$scroll$descend2 = _slicedToArray(_quill$scroll$descend, 2),\n link = _quill$scroll$descend2[0],\n offset = _quill$scroll$descend2[1];\n\n if (link != null) {\n _this3.linkRange = new _selection.Range(range.index - offset, link.length());\n var preview = _link2.default.formats(link.domNode);\n _this3.preview.textContent = preview;\n _this3.preview.setAttribute('href', preview);\n _this3.show();\n _this3.position(_this3.quill.getBounds(_this3.linkRange));\n return;\n }\n } else {\n delete _this3.linkRange;\n }\n _this3.hide();\n });\n }\n }, {\n key: 'show',\n value: function show() {\n _get(SnowTooltip.prototype.__proto__ || Object.getPrototypeOf(SnowTooltip.prototype), 'show', this).call(this);\n this.root.removeAttribute('data-mode');\n }\n }]);\n\n return SnowTooltip;\n}(_base.BaseTooltip);\n\nSnowTooltip.TEMPLATE = ['', '', '', ''].join('');\n\nexports.default = SnowTheme;\n\n/***/ }),\n/* 63 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _core = __webpack_require__(29);\n\nvar _core2 = _interopRequireDefault(_core);\n\nvar _align = __webpack_require__(36);\n\nvar _direction = __webpack_require__(38);\n\nvar _indent = __webpack_require__(64);\n\nvar _blockquote = __webpack_require__(65);\n\nvar _blockquote2 = _interopRequireDefault(_blockquote);\n\nvar _header = __webpack_require__(66);\n\nvar _header2 = _interopRequireDefault(_header);\n\nvar _list = __webpack_require__(67);\n\nvar _list2 = _interopRequireDefault(_list);\n\nvar _background = __webpack_require__(37);\n\nvar _color = __webpack_require__(26);\n\nvar _font = __webpack_require__(39);\n\nvar _size = __webpack_require__(40);\n\nvar _bold = __webpack_require__(56);\n\nvar _bold2 = _interopRequireDefault(_bold);\n\nvar _italic = __webpack_require__(68);\n\nvar _italic2 = _interopRequireDefault(_italic);\n\nvar _link = __webpack_require__(27);\n\nvar _link2 = _interopRequireDefault(_link);\n\nvar _script = __webpack_require__(69);\n\nvar _script2 = _interopRequireDefault(_script);\n\nvar _strike = __webpack_require__(70);\n\nvar _strike2 = _interopRequireDefault(_strike);\n\nvar _underline = __webpack_require__(71);\n\nvar _underline2 = _interopRequireDefault(_underline);\n\nvar _image = __webpack_require__(72);\n\nvar _image2 = _interopRequireDefault(_image);\n\nvar _video = __webpack_require__(73);\n\nvar _video2 = _interopRequireDefault(_video);\n\nvar _code = __webpack_require__(13);\n\nvar _code2 = _interopRequireDefault(_code);\n\nvar _formula = __webpack_require__(74);\n\nvar _formula2 = _interopRequireDefault(_formula);\n\nvar _syntax = __webpack_require__(75);\n\nvar _syntax2 = _interopRequireDefault(_syntax);\n\nvar _toolbar = __webpack_require__(57);\n\nvar _toolbar2 = _interopRequireDefault(_toolbar);\n\nvar _icons = __webpack_require__(41);\n\nvar _icons2 = _interopRequireDefault(_icons);\n\nvar _picker = __webpack_require__(28);\n\nvar _picker2 = _interopRequireDefault(_picker);\n\nvar _colorPicker = __webpack_require__(59);\n\nvar _colorPicker2 = _interopRequireDefault(_colorPicker);\n\nvar _iconPicker = __webpack_require__(60);\n\nvar _iconPicker2 = _interopRequireDefault(_iconPicker);\n\nvar _tooltip = __webpack_require__(61);\n\nvar _tooltip2 = _interopRequireDefault(_tooltip);\n\nvar _bubble = __webpack_require__(108);\n\nvar _bubble2 = _interopRequireDefault(_bubble);\n\nvar _snow = __webpack_require__(62);\n\nvar _snow2 = _interopRequireDefault(_snow);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n_core2.default.register({\n 'attributors/attribute/direction': _direction.DirectionAttribute,\n\n 'attributors/class/align': _align.AlignClass,\n 'attributors/class/background': _background.BackgroundClass,\n 'attributors/class/color': _color.ColorClass,\n 'attributors/class/direction': _direction.DirectionClass,\n 'attributors/class/font': _font.FontClass,\n 'attributors/class/size': _size.SizeClass,\n\n 'attributors/style/align': _align.AlignStyle,\n 'attributors/style/background': _background.BackgroundStyle,\n 'attributors/style/color': _color.ColorStyle,\n 'attributors/style/direction': _direction.DirectionStyle,\n 'attributors/style/font': _font.FontStyle,\n 'attributors/style/size': _size.SizeStyle\n}, true);\n\n_core2.default.register({\n 'formats/align': _align.AlignClass,\n 'formats/direction': _direction.DirectionClass,\n 'formats/indent': _indent.IndentClass,\n\n 'formats/background': _background.BackgroundStyle,\n 'formats/color': _color.ColorStyle,\n 'formats/font': _font.FontClass,\n 'formats/size': _size.SizeClass,\n\n 'formats/blockquote': _blockquote2.default,\n 'formats/code-block': _code2.default,\n 'formats/header': _header2.default,\n 'formats/list': _list2.default,\n\n 'formats/bold': _bold2.default,\n 'formats/code': _code.Code,\n 'formats/italic': _italic2.default,\n 'formats/link': _link2.default,\n 'formats/script': _script2.default,\n 'formats/strike': _strike2.default,\n 'formats/underline': _underline2.default,\n\n 'formats/image': _image2.default,\n 'formats/video': _video2.default,\n\n 'formats/list/item': _list.ListItem,\n\n 'modules/formula': _formula2.default,\n 'modules/syntax': _syntax2.default,\n 'modules/toolbar': _toolbar2.default,\n\n 'themes/bubble': _bubble2.default,\n 'themes/snow': _snow2.default,\n\n 'ui/icons': _icons2.default,\n 'ui/picker': _picker2.default,\n 'ui/icon-picker': _iconPicker2.default,\n 'ui/color-picker': _colorPicker2.default,\n 'ui/tooltip': _tooltip2.default\n}, true);\n\nexports.default = _core2.default;\n\n/***/ }),\n/* 64 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.IndentClass = undefined;\n\nvar _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; }; }();\n\nvar _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if (\"value\" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };\n\nvar _parchment = __webpack_require__(0);\n\nvar _parchment2 = _interopRequireDefault(_parchment);\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 _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nvar IdentAttributor = function (_Parchment$Attributor) {\n _inherits(IdentAttributor, _Parchment$Attributor);\n\n function IdentAttributor() {\n _classCallCheck(this, IdentAttributor);\n\n return _possibleConstructorReturn(this, (IdentAttributor.__proto__ || Object.getPrototypeOf(IdentAttributor)).apply(this, arguments));\n }\n\n _createClass(IdentAttributor, [{\n key: 'add',\n value: function add(node, value) {\n if (value === '+1' || value === '-1') {\n var indent = this.value(node) || 0;\n value = value === '+1' ? indent + 1 : indent - 1;\n }\n if (value === 0) {\n this.remove(node);\n return true;\n } else {\n return _get(IdentAttributor.prototype.__proto__ || Object.getPrototypeOf(IdentAttributor.prototype), 'add', this).call(this, node, value);\n }\n }\n }, {\n key: 'canAdd',\n value: function canAdd(node, value) {\n return _get(IdentAttributor.prototype.__proto__ || Object.getPrototypeOf(IdentAttributor.prototype), 'canAdd', this).call(this, node, value) || _get(IdentAttributor.prototype.__proto__ || Object.getPrototypeOf(IdentAttributor.prototype), 'canAdd', this).call(this, node, parseInt(value));\n }\n }, {\n key: 'value',\n value: function value(node) {\n return parseInt(_get(IdentAttributor.prototype.__proto__ || Object.getPrototypeOf(IdentAttributor.prototype), 'value', this).call(this, node)) || undefined; // Don't return NaN\n }\n }]);\n\n return IdentAttributor;\n}(_parchment2.default.Attributor.Class);\n\nvar IndentClass = new IdentAttributor('indent', 'ql-indent', {\n scope: _parchment2.default.Scope.BLOCK,\n whitelist: [1, 2, 3, 4, 5, 6, 7, 8]\n});\n\nexports.IndentClass = IndentClass;\n\n/***/ }),\n/* 65 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _block = __webpack_require__(4);\n\nvar _block2 = _interopRequireDefault(_block);\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 _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nvar Blockquote = function (_Block) {\n _inherits(Blockquote, _Block);\n\n function Blockquote() {\n _classCallCheck(this, Blockquote);\n\n return _possibleConstructorReturn(this, (Blockquote.__proto__ || Object.getPrototypeOf(Blockquote)).apply(this, arguments));\n }\n\n return Blockquote;\n}(_block2.default);\n\nBlockquote.blotName = 'blockquote';\nBlockquote.tagName = 'blockquote';\n\nexports.default = Blockquote;\n\n/***/ }),\n/* 66 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _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; }; }();\n\nvar _block = __webpack_require__(4);\n\nvar _block2 = _interopRequireDefault(_block);\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 _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nvar Header = function (_Block) {\n _inherits(Header, _Block);\n\n function Header() {\n _classCallCheck(this, Header);\n\n return _possibleConstructorReturn(this, (Header.__proto__ || Object.getPrototypeOf(Header)).apply(this, arguments));\n }\n\n _createClass(Header, null, [{\n key: 'formats',\n value: function formats(domNode) {\n return this.tagName.indexOf(domNode.tagName) + 1;\n }\n }]);\n\n return Header;\n}(_block2.default);\n\nHeader.blotName = 'header';\nHeader.tagName = ['H1', 'H2', 'H3', 'H4', 'H5', 'H6'];\n\nexports.default = Header;\n\n/***/ }),\n/* 67 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = exports.ListItem = undefined;\n\nvar _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; }; }();\n\nvar _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if (\"value\" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };\n\nvar _parchment = __webpack_require__(0);\n\nvar _parchment2 = _interopRequireDefault(_parchment);\n\nvar _block = __webpack_require__(4);\n\nvar _block2 = _interopRequireDefault(_block);\n\nvar _container = __webpack_require__(25);\n\nvar _container2 = _interopRequireDefault(_container);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\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 _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nvar ListItem = function (_Block) {\n _inherits(ListItem, _Block);\n\n function ListItem() {\n _classCallCheck(this, ListItem);\n\n return _possibleConstructorReturn(this, (ListItem.__proto__ || Object.getPrototypeOf(ListItem)).apply(this, arguments));\n }\n\n _createClass(ListItem, [{\n key: 'format',\n value: function format(name, value) {\n if (name === List.blotName && !value) {\n this.replaceWith(_parchment2.default.create(this.statics.scope));\n } else {\n _get(ListItem.prototype.__proto__ || Object.getPrototypeOf(ListItem.prototype), 'format', this).call(this, name, value);\n }\n }\n }, {\n key: 'remove',\n value: function remove() {\n if (this.prev == null && this.next == null) {\n this.parent.remove();\n } else {\n _get(ListItem.prototype.__proto__ || Object.getPrototypeOf(ListItem.prototype), 'remove', this).call(this);\n }\n }\n }, {\n key: 'replaceWith',\n value: function replaceWith(name, value) {\n this.parent.isolate(this.offset(this.parent), this.length());\n if (name === this.parent.statics.blotName) {\n this.parent.replaceWith(name, value);\n return this;\n } else {\n this.parent.unwrap();\n return _get(ListItem.prototype.__proto__ || Object.getPrototypeOf(ListItem.prototype), 'replaceWith', this).call(this, name, value);\n }\n }\n }], [{\n key: 'formats',\n value: function formats(domNode) {\n return domNode.tagName === this.tagName ? undefined : _get(ListItem.__proto__ || Object.getPrototypeOf(ListItem), 'formats', this).call(this, domNode);\n }\n }]);\n\n return ListItem;\n}(_block2.default);\n\nListItem.blotName = 'list-item';\nListItem.tagName = 'LI';\n\nvar List = function (_Container) {\n _inherits(List, _Container);\n\n _createClass(List, null, [{\n key: 'create',\n value: function create(value) {\n var tagName = value === 'ordered' ? 'OL' : 'UL';\n var node = _get(List.__proto__ || Object.getPrototypeOf(List), 'create', this).call(this, tagName);\n if (value === 'checked' || value === 'unchecked') {\n node.setAttribute('data-checked', value === 'checked');\n }\n return node;\n }\n }, {\n key: 'formats',\n value: function formats(domNode) {\n if (domNode.tagName === 'OL') return 'ordered';\n if (domNode.tagName === 'UL') {\n if (domNode.hasAttribute('data-checked')) {\n return domNode.getAttribute('data-checked') === 'true' ? 'checked' : 'unchecked';\n } else {\n return 'bullet';\n }\n }\n return undefined;\n }\n }]);\n\n function List(domNode) {\n _classCallCheck(this, List);\n\n var _this2 = _possibleConstructorReturn(this, (List.__proto__ || Object.getPrototypeOf(List)).call(this, domNode));\n\n var listEventHandler = function listEventHandler(e) {\n if (e.target.parentNode !== domNode) return;\n var format = _this2.statics.formats(domNode);\n var blot = _parchment2.default.find(e.target);\n if (format === 'checked') {\n blot.format('list', 'unchecked');\n } else if (format === 'unchecked') {\n blot.format('list', 'checked');\n }\n };\n\n domNode.addEventListener('touchstart', listEventHandler);\n domNode.addEventListener('mousedown', listEventHandler);\n return _this2;\n }\n\n _createClass(List, [{\n key: 'format',\n value: function format(name, value) {\n if (this.children.length > 0) {\n this.children.tail.format(name, value);\n }\n }\n }, {\n key: 'formats',\n value: function formats() {\n // We don't inherit from FormatBlot\n return _defineProperty({}, this.statics.blotName, this.statics.formats(this.domNode));\n }\n }, {\n key: 'insertBefore',\n value: function insertBefore(blot, ref) {\n if (blot instanceof ListItem) {\n _get(List.prototype.__proto__ || Object.getPrototypeOf(List.prototype), 'insertBefore', this).call(this, blot, ref);\n } else {\n var index = ref == null ? this.length() : ref.offset(this);\n var after = this.split(index);\n after.parent.insertBefore(blot, after);\n }\n }\n }, {\n key: 'optimize',\n value: function optimize(context) {\n _get(List.prototype.__proto__ || Object.getPrototypeOf(List.prototype), 'optimize', this).call(this, context);\n var next = this.next;\n if (next != null && next.prev === this && next.statics.blotName === this.statics.blotName && next.domNode.tagName === this.domNode.tagName && next.domNode.getAttribute('data-checked') === this.domNode.getAttribute('data-checked')) {\n next.moveChildren(this);\n next.remove();\n }\n }\n }, {\n key: 'replace',\n value: function replace(target) {\n if (target.statics.blotName !== this.statics.blotName) {\n var item = _parchment2.default.create(this.statics.defaultChild);\n target.moveChildren(item);\n this.appendChild(item);\n }\n _get(List.prototype.__proto__ || Object.getPrototypeOf(List.prototype), 'replace', this).call(this, target);\n }\n }]);\n\n return List;\n}(_container2.default);\n\nList.blotName = 'list';\nList.scope = _parchment2.default.Scope.BLOCK_BLOT;\nList.tagName = ['OL', 'UL'];\nList.defaultChild = 'list-item';\nList.allowedChildren = [ListItem];\n\nexports.ListItem = ListItem;\nexports.default = List;\n\n/***/ }),\n/* 68 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _bold = __webpack_require__(56);\n\nvar _bold2 = _interopRequireDefault(_bold);\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 _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nvar Italic = function (_Bold) {\n _inherits(Italic, _Bold);\n\n function Italic() {\n _classCallCheck(this, Italic);\n\n return _possibleConstructorReturn(this, (Italic.__proto__ || Object.getPrototypeOf(Italic)).apply(this, arguments));\n }\n\n return Italic;\n}(_bold2.default);\n\nItalic.blotName = 'italic';\nItalic.tagName = ['EM', 'I'];\n\nexports.default = Italic;\n\n/***/ }),\n/* 69 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _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; }; }();\n\nvar _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if (\"value\" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };\n\nvar _inline = __webpack_require__(6);\n\nvar _inline2 = _interopRequireDefault(_inline);\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 _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nvar Script = function (_Inline) {\n _inherits(Script, _Inline);\n\n function Script() {\n _classCallCheck(this, Script);\n\n return _possibleConstructorReturn(this, (Script.__proto__ || Object.getPrototypeOf(Script)).apply(this, arguments));\n }\n\n _createClass(Script, null, [{\n key: 'create',\n value: function create(value) {\n if (value === 'super') {\n return document.createElement('sup');\n } else if (value === 'sub') {\n return document.createElement('sub');\n } else {\n return _get(Script.__proto__ || Object.getPrototypeOf(Script), 'create', this).call(this, value);\n }\n }\n }, {\n key: 'formats',\n value: function formats(domNode) {\n if (domNode.tagName === 'SUB') return 'sub';\n if (domNode.tagName === 'SUP') return 'super';\n return undefined;\n }\n }]);\n\n return Script;\n}(_inline2.default);\n\nScript.blotName = 'script';\nScript.tagName = ['SUB', 'SUP'];\n\nexports.default = Script;\n\n/***/ }),\n/* 70 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _inline = __webpack_require__(6);\n\nvar _inline2 = _interopRequireDefault(_inline);\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 _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nvar Strike = function (_Inline) {\n _inherits(Strike, _Inline);\n\n function Strike() {\n _classCallCheck(this, Strike);\n\n return _possibleConstructorReturn(this, (Strike.__proto__ || Object.getPrototypeOf(Strike)).apply(this, arguments));\n }\n\n return Strike;\n}(_inline2.default);\n\nStrike.blotName = 'strike';\nStrike.tagName = 'S';\n\nexports.default = Strike;\n\n/***/ }),\n/* 71 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _inline = __webpack_require__(6);\n\nvar _inline2 = _interopRequireDefault(_inline);\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 _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nvar Underline = function (_Inline) {\n _inherits(Underline, _Inline);\n\n function Underline() {\n _classCallCheck(this, Underline);\n\n return _possibleConstructorReturn(this, (Underline.__proto__ || Object.getPrototypeOf(Underline)).apply(this, arguments));\n }\n\n return Underline;\n}(_inline2.default);\n\nUnderline.blotName = 'underline';\nUnderline.tagName = 'U';\n\nexports.default = Underline;\n\n/***/ }),\n/* 72 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _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; }; }();\n\nvar _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if (\"value\" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };\n\nvar _parchment = __webpack_require__(0);\n\nvar _parchment2 = _interopRequireDefault(_parchment);\n\nvar _link = __webpack_require__(27);\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 _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nvar ATTRIBUTES = ['alt', 'height', 'width'];\n\nvar Image = function (_Parchment$Embed) {\n _inherits(Image, _Parchment$Embed);\n\n function Image() {\n _classCallCheck(this, Image);\n\n return _possibleConstructorReturn(this, (Image.__proto__ || Object.getPrototypeOf(Image)).apply(this, arguments));\n }\n\n _createClass(Image, [{\n key: 'format',\n value: function format(name, value) {\n if (ATTRIBUTES.indexOf(name) > -1) {\n if (value) {\n this.domNode.setAttribute(name, value);\n } else {\n this.domNode.removeAttribute(name);\n }\n } else {\n _get(Image.prototype.__proto__ || Object.getPrototypeOf(Image.prototype), 'format', this).call(this, name, value);\n }\n }\n }], [{\n key: 'create',\n value: function create(value) {\n var node = _get(Image.__proto__ || Object.getPrototypeOf(Image), 'create', this).call(this, value);\n if (typeof value === 'string') {\n node.setAttribute('src', this.sanitize(value));\n }\n return node;\n }\n }, {\n key: 'formats',\n value: function formats(domNode) {\n return ATTRIBUTES.reduce(function (formats, attribute) {\n if (domNode.hasAttribute(attribute)) {\n formats[attribute] = domNode.getAttribute(attribute);\n }\n return formats;\n }, {});\n }\n }, {\n key: 'match',\n value: function match(url) {\n return (/\\.(jpe?g|gif|png)$/.test(url) || /^data:image\\/.+;base64/.test(url)\n );\n }\n }, {\n key: 'sanitize',\n value: function sanitize(url) {\n return (0, _link.sanitize)(url, ['http', 'https', 'data']) ? url : '//:0';\n }\n }, {\n key: 'value',\n value: function value(domNode) {\n return domNode.getAttribute('src');\n }\n }]);\n\n return Image;\n}(_parchment2.default.Embed);\n\nImage.blotName = 'image';\nImage.tagName = 'IMG';\n\nexports.default = Image;\n\n/***/ }),\n/* 73 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _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; }; }();\n\nvar _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if (\"value\" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };\n\nvar _block = __webpack_require__(4);\n\nvar _link = __webpack_require__(27);\n\nvar _link2 = _interopRequireDefault(_link);\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 _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nvar ATTRIBUTES = ['height', 'width'];\n\nvar Video = function (_BlockEmbed) {\n _inherits(Video, _BlockEmbed);\n\n function Video() {\n _classCallCheck(this, Video);\n\n return _possibleConstructorReturn(this, (Video.__proto__ || Object.getPrototypeOf(Video)).apply(this, arguments));\n }\n\n _createClass(Video, [{\n key: 'format',\n value: function format(name, value) {\n if (ATTRIBUTES.indexOf(name) > -1) {\n if (value) {\n this.domNode.setAttribute(name, value);\n } else {\n this.domNode.removeAttribute(name);\n }\n } else {\n _get(Video.prototype.__proto__ || Object.getPrototypeOf(Video.prototype), 'format', this).call(this, name, value);\n }\n }\n }], [{\n key: 'create',\n value: function create(value) {\n var node = _get(Video.__proto__ || Object.getPrototypeOf(Video), 'create', this).call(this, value);\n node.setAttribute('frameborder', '0');\n node.setAttribute('allowfullscreen', true);\n node.setAttribute('src', this.sanitize(value));\n return node;\n }\n }, {\n key: 'formats',\n value: function formats(domNode) {\n return ATTRIBUTES.reduce(function (formats, attribute) {\n if (domNode.hasAttribute(attribute)) {\n formats[attribute] = domNode.getAttribute(attribute);\n }\n return formats;\n }, {});\n }\n }, {\n key: 'sanitize',\n value: function sanitize(url) {\n return _link2.default.sanitize(url);\n }\n }, {\n key: 'value',\n value: function value(domNode) {\n return domNode.getAttribute('src');\n }\n }]);\n\n return Video;\n}(_block.BlockEmbed);\n\nVideo.blotName = 'video';\nVideo.className = 'ql-video';\nVideo.tagName = 'IFRAME';\n\nexports.default = Video;\n\n/***/ }),\n/* 74 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = exports.FormulaBlot = undefined;\n\nvar _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; }; }();\n\nvar _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if (\"value\" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };\n\nvar _embed = __webpack_require__(35);\n\nvar _embed2 = _interopRequireDefault(_embed);\n\nvar _quill = __webpack_require__(5);\n\nvar _quill2 = _interopRequireDefault(_quill);\n\nvar _module = __webpack_require__(9);\n\nvar _module2 = _interopRequireDefault(_module);\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 _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nvar FormulaBlot = function (_Embed) {\n _inherits(FormulaBlot, _Embed);\n\n function FormulaBlot() {\n _classCallCheck(this, FormulaBlot);\n\n return _possibleConstructorReturn(this, (FormulaBlot.__proto__ || Object.getPrototypeOf(FormulaBlot)).apply(this, arguments));\n }\n\n _createClass(FormulaBlot, null, [{\n key: 'create',\n value: function create(value) {\n var node = _get(FormulaBlot.__proto__ || Object.getPrototypeOf(FormulaBlot), 'create', this).call(this, value);\n if (typeof value === 'string') {\n window.katex.render(value, node, {\n throwOnError: false,\n errorColor: '#f00'\n });\n node.setAttribute('data-value', value);\n }\n return node;\n }\n }, {\n key: 'value',\n value: function value(domNode) {\n return domNode.getAttribute('data-value');\n }\n }]);\n\n return FormulaBlot;\n}(_embed2.default);\n\nFormulaBlot.blotName = 'formula';\nFormulaBlot.className = 'ql-formula';\nFormulaBlot.tagName = 'SPAN';\n\nvar Formula = function (_Module) {\n _inherits(Formula, _Module);\n\n _createClass(Formula, null, [{\n key: 'register',\n value: function register() {\n _quill2.default.register(FormulaBlot, true);\n }\n }]);\n\n function Formula() {\n _classCallCheck(this, Formula);\n\n var _this2 = _possibleConstructorReturn(this, (Formula.__proto__ || Object.getPrototypeOf(Formula)).call(this));\n\n if (window.katex == null) {\n throw new Error('Formula module requires KaTeX.');\n }\n return _this2;\n }\n\n return Formula;\n}(_module2.default);\n\nexports.FormulaBlot = FormulaBlot;\nexports.default = Formula;\n\n/***/ }),\n/* 75 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = exports.CodeToken = exports.CodeBlock = undefined;\n\nvar _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; }; }();\n\nvar _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if (\"value\" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };\n\nvar _parchment = __webpack_require__(0);\n\nvar _parchment2 = _interopRequireDefault(_parchment);\n\nvar _quill = __webpack_require__(5);\n\nvar _quill2 = _interopRequireDefault(_quill);\n\nvar _module = __webpack_require__(9);\n\nvar _module2 = _interopRequireDefault(_module);\n\nvar _code = __webpack_require__(13);\n\nvar _code2 = _interopRequireDefault(_code);\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 _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nvar SyntaxCodeBlock = function (_CodeBlock) {\n _inherits(SyntaxCodeBlock, _CodeBlock);\n\n function SyntaxCodeBlock() {\n _classCallCheck(this, SyntaxCodeBlock);\n\n return _possibleConstructorReturn(this, (SyntaxCodeBlock.__proto__ || Object.getPrototypeOf(SyntaxCodeBlock)).apply(this, arguments));\n }\n\n _createClass(SyntaxCodeBlock, [{\n key: 'replaceWith',\n value: function replaceWith(block) {\n this.domNode.textContent = this.domNode.textContent;\n this.attach();\n _get(SyntaxCodeBlock.prototype.__proto__ || Object.getPrototypeOf(SyntaxCodeBlock.prototype), 'replaceWith', this).call(this, block);\n }\n }, {\n key: 'highlight',\n value: function highlight(_highlight) {\n var text = this.domNode.textContent;\n if (this.cachedText !== text) {\n if (text.trim().length > 0 || this.cachedText == null) {\n this.domNode.innerHTML = _highlight(text);\n this.domNode.normalize();\n this.attach();\n }\n this.cachedText = text;\n }\n }\n }]);\n\n return SyntaxCodeBlock;\n}(_code2.default);\n\nSyntaxCodeBlock.className = 'ql-syntax';\n\nvar CodeToken = new _parchment2.default.Attributor.Class('token', 'hljs', {\n scope: _parchment2.default.Scope.INLINE\n});\n\nvar Syntax = function (_Module) {\n _inherits(Syntax, _Module);\n\n _createClass(Syntax, null, [{\n key: 'register',\n value: function register() {\n _quill2.default.register(CodeToken, true);\n _quill2.default.register(SyntaxCodeBlock, true);\n }\n }]);\n\n function Syntax(quill, options) {\n _classCallCheck(this, Syntax);\n\n var _this2 = _possibleConstructorReturn(this, (Syntax.__proto__ || Object.getPrototypeOf(Syntax)).call(this, quill, options));\n\n if (typeof _this2.options.highlight !== 'function') {\n throw new Error('Syntax module requires highlight.js. Please include the library on the page before Quill.');\n }\n var timer = null;\n _this2.quill.on(_quill2.default.events.SCROLL_OPTIMIZE, function () {\n clearTimeout(timer);\n timer = setTimeout(function () {\n _this2.highlight();\n timer = null;\n }, _this2.options.interval);\n });\n _this2.highlight();\n return _this2;\n }\n\n _createClass(Syntax, [{\n key: 'highlight',\n value: function highlight() {\n var _this3 = this;\n\n if (this.quill.selection.composing) return;\n this.quill.update(_quill2.default.sources.USER);\n var range = this.quill.getSelection();\n this.quill.scroll.descendants(SyntaxCodeBlock).forEach(function (code) {\n code.highlight(_this3.options.highlight);\n });\n this.quill.update(_quill2.default.sources.SILENT);\n if (range != null) {\n this.quill.setSelection(range, _quill2.default.sources.SILENT);\n }\n }\n }]);\n\n return Syntax;\n}(_module2.default);\n\nSyntax.DEFAULTS = {\n highlight: function () {\n if (window.hljs == null) return null;\n return function (text) {\n var result = window.hljs.highlightAuto(text);\n return result.value;\n };\n }(),\n interval: 1000\n};\n\nexports.CodeBlock = SyntaxCodeBlock;\nexports.CodeToken = CodeToken;\nexports.default = Syntax;\n\n/***/ }),\n/* 76 */\n/***/ (function(module, exports) {\n\nmodule.exports = \" \";\n\n/***/ }),\n/* 77 */\n/***/ (function(module, exports) {\n\nmodule.exports = \" \";\n\n/***/ }),\n/* 78 */\n/***/ (function(module, exports) {\n\nmodule.exports = \" \";\n\n/***/ }),\n/* 79 */\n/***/ (function(module, exports) {\n\nmodule.exports = \" \";\n\n/***/ }),\n/* 80 */\n/***/ (function(module, exports) {\n\nmodule.exports = \" \";\n\n/***/ }),\n/* 81 */\n/***/ (function(module, exports) {\n\nmodule.exports = \" \";\n\n/***/ }),\n/* 82 */\n/***/ (function(module, exports) {\n\nmodule.exports = \" \";\n\n/***/ }),\n/* 83 */\n/***/ (function(module, exports) {\n\nmodule.exports = \" \";\n\n/***/ }),\n/* 84 */\n/***/ (function(module, exports) {\n\nmodule.exports = \" \";\n\n/***/ }),\n/* 85 */\n/***/ (function(module, exports) {\n\nmodule.exports = \" \";\n\n/***/ }),\n/* 86 */\n/***/ (function(module, exports) {\n\nmodule.exports = \" \";\n\n/***/ }),\n/* 87 */\n/***/ (function(module, exports) {\n\nmodule.exports = \" \";\n\n/***/ }),\n/* 88 */\n/***/ (function(module, exports) {\n\nmodule.exports = \" \";\n\n/***/ }),\n/* 89 */\n/***/ (function(module, exports) {\n\nmodule.exports = \" \";\n\n/***/ }),\n/* 90 */\n/***/ (function(module, exports) {\n\nmodule.exports = \" \";\n\n/***/ }),\n/* 91 */\n/***/ (function(module, exports) {\n\nmodule.exports = \" \";\n\n/***/ }),\n/* 92 */\n/***/ (function(module, exports) {\n\nmodule.exports = \" \";\n\n/***/ }),\n/* 93 */\n/***/ (function(module, exports) {\n\nmodule.exports = \" \";\n\n/***/ }),\n/* 94 */\n/***/ (function(module, exports) {\n\nmodule.exports = \" \";\n\n/***/ }),\n/* 95 */\n/***/ (function(module, exports) {\n\nmodule.exports = \" \";\n\n/***/ }),\n/* 96 */\n/***/ (function(module, exports) {\n\nmodule.exports = \" \";\n\n/***/ }),\n/* 97 */\n/***/ (function(module, exports) {\n\nmodule.exports = \" \";\n\n/***/ }),\n/* 98 */\n/***/ (function(module, exports) {\n\nmodule.exports = \" \";\n\n/***/ }),\n/* 99 */\n/***/ (function(module, exports) {\n\nmodule.exports = \" \";\n\n/***/ }),\n/* 100 */\n/***/ (function(module, exports) {\n\nmodule.exports = \" \";\n\n/***/ }),\n/* 101 */\n/***/ (function(module, exports) {\n\nmodule.exports = \" \";\n\n/***/ }),\n/* 102 */\n/***/ (function(module, exports) {\n\nmodule.exports = \" \";\n\n/***/ }),\n/* 103 */\n/***/ (function(module, exports) {\n\nmodule.exports = \" \";\n\n/***/ }),\n/* 104 */\n/***/ (function(module, exports) {\n\nmodule.exports = \" \";\n\n/***/ }),\n/* 105 */\n/***/ (function(module, exports) {\n\nmodule.exports = \" \";\n\n/***/ }),\n/* 106 */\n/***/ (function(module, exports) {\n\nmodule.exports = \" \";\n\n/***/ }),\n/* 107 */\n/***/ (function(module, exports) {\n\nmodule.exports = \" \";\n\n/***/ }),\n/* 108 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = exports.BubbleTooltip = undefined;\n\nvar _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if (\"value\" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };\n\nvar _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; }; }();\n\nvar _extend = __webpack_require__(3);\n\nvar _extend2 = _interopRequireDefault(_extend);\n\nvar _emitter = __webpack_require__(8);\n\nvar _emitter2 = _interopRequireDefault(_emitter);\n\nvar _base = __webpack_require__(43);\n\nvar _base2 = _interopRequireDefault(_base);\n\nvar _selection = __webpack_require__(15);\n\nvar _icons = __webpack_require__(41);\n\nvar _icons2 = _interopRequireDefault(_icons);\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 _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nvar TOOLBAR_CONFIG = [['bold', 'italic', 'link'], [{ header: 1 }, { header: 2 }, 'blockquote']];\n\nvar BubbleTheme = function (_BaseTheme) {\n _inherits(BubbleTheme, _BaseTheme);\n\n function BubbleTheme(quill, options) {\n _classCallCheck(this, BubbleTheme);\n\n if (options.modules.toolbar != null && options.modules.toolbar.container == null) {\n options.modules.toolbar.container = TOOLBAR_CONFIG;\n }\n\n var _this = _possibleConstructorReturn(this, (BubbleTheme.__proto__ || Object.getPrototypeOf(BubbleTheme)).call(this, quill, options));\n\n _this.quill.container.classList.add('ql-bubble');\n return _this;\n }\n\n _createClass(BubbleTheme, [{\n key: 'extendToolbar',\n value: function extendToolbar(toolbar) {\n this.tooltip = new BubbleTooltip(this.quill, this.options.bounds);\n this.tooltip.root.appendChild(toolbar.container);\n this.buildButtons([].slice.call(toolbar.container.querySelectorAll('button')), _icons2.default);\n this.buildPickers([].slice.call(toolbar.container.querySelectorAll('select')), _icons2.default);\n }\n }]);\n\n return BubbleTheme;\n}(_base2.default);\n\nBubbleTheme.DEFAULTS = (0, _extend2.default)(true, {}, _base2.default.DEFAULTS, {\n modules: {\n toolbar: {\n handlers: {\n link: function link(value) {\n if (!value) {\n this.quill.format('link', false);\n } else {\n this.quill.theme.tooltip.edit();\n }\n }\n }\n }\n }\n});\n\nvar BubbleTooltip = function (_BaseTooltip) {\n _inherits(BubbleTooltip, _BaseTooltip);\n\n function BubbleTooltip(quill, bounds) {\n _classCallCheck(this, BubbleTooltip);\n\n var _this2 = _possibleConstructorReturn(this, (BubbleTooltip.__proto__ || Object.getPrototypeOf(BubbleTooltip)).call(this, quill, bounds));\n\n _this2.quill.on(_emitter2.default.events.EDITOR_CHANGE, function (type, range, oldRange, source) {\n if (type !== _emitter2.default.events.SELECTION_CHANGE) return;\n if (range != null && range.length > 0 && source === _emitter2.default.sources.USER) {\n _this2.show();\n // Lock our width so we will expand beyond our offsetParent boundaries\n _this2.root.style.left = '0px';\n _this2.root.style.width = '';\n _this2.root.style.width = _this2.root.offsetWidth + 'px';\n var lines = _this2.quill.getLines(range.index, range.length);\n if (lines.length === 1) {\n _this2.position(_this2.quill.getBounds(range));\n } else {\n var lastLine = lines[lines.length - 1];\n var index = _this2.quill.getIndex(lastLine);\n var length = Math.min(lastLine.length() - 1, range.index + range.length - index);\n var _bounds = _this2.quill.getBounds(new _selection.Range(index, length));\n _this2.position(_bounds);\n }\n } else if (document.activeElement !== _this2.textbox && _this2.quill.hasFocus()) {\n _this2.hide();\n }\n });\n return _this2;\n }\n\n _createClass(BubbleTooltip, [{\n key: 'listen',\n value: function listen() {\n var _this3 = this;\n\n _get(BubbleTooltip.prototype.__proto__ || Object.getPrototypeOf(BubbleTooltip.prototype), 'listen', this).call(this);\n this.root.querySelector('.ql-close').addEventListener('click', function () {\n _this3.root.classList.remove('ql-editing');\n });\n this.quill.on(_emitter2.default.events.SCROLL_OPTIMIZE, function () {\n // Let selection be restored by toolbar handlers before repositioning\n setTimeout(function () {\n if (_this3.root.classList.contains('ql-hidden')) return;\n var range = _this3.quill.getSelection();\n if (range != null) {\n _this3.position(_this3.quill.getBounds(range));\n }\n }, 1);\n });\n }\n }, {\n key: 'cancel',\n value: function cancel() {\n this.show();\n }\n }, {\n key: 'position',\n value: function position(reference) {\n var shift = _get(BubbleTooltip.prototype.__proto__ || Object.getPrototypeOf(BubbleTooltip.prototype), 'position', this).call(this, reference);\n var arrow = this.root.querySelector('.ql-tooltip-arrow');\n arrow.style.marginLeft = '';\n if (shift === 0) return shift;\n arrow.style.marginLeft = -1 * shift - arrow.offsetWidth / 2 + 'px';\n }\n }]);\n\n return BubbleTooltip;\n}(_base.BaseTooltip);\n\nBubbleTooltip.TEMPLATE = ['', '
', '', '', '
'].join('');\n\nexports.BubbleTooltip = BubbleTooltip;\nexports.default = BubbleTheme;\n\n/***/ }),\n/* 109 */\n/***/ (function(module, exports, __webpack_require__) {\n\nmodule.exports = __webpack_require__(63);\n\n\n/***/ })\n/******/ ])[\"default\"];\n});\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(43).Buffer))//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMy5qcyIsInNvdXJjZXMiOlsid2VicGFjazovLy8uL25vZGVfbW9kdWxlcy9xdWlsbC9kaXN0L3F1aWxsLmpzPzkzMzkiXSwic291cmNlc0NvbnRlbnQiOlsiLyohXG4gKiBRdWlsbCBFZGl0b3IgdjEuMy43XG4gKiBodHRwczovL3F1aWxsanMuY29tL1xuICogQ29weXJpZ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247XG4gICAgICAgIH1cbiAgICAgICAgaWYgKERlZmluaXRpb24udGFnTmFtZSAhPSBudWxsKSB7XG4gICAgICAgICAgICBpZiAoQXJyYXkuaXNBcnJheShEZWZpbml0aW9uLnRhZ05hbWUpKSB7XG4gICAgICAgICAgICAgICAgRGVmaW5pdGlvbi50YWdOYW1lID0gRGVmaW5pdGlvbi50YWdOYW1lLm1hcChmdW5jdGlvbiAodGFnTmFtZSkge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGFnTmFtZS50b1VwcGVyQ2FzZSgpO1xuICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgRGVmaW5pdGlvbi50YWdOYW1lID0gRGVmaW5pdGlvbi50YWdOYW1lLnRvVXBwZXJDYXNlKCk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICB2YXIgdGFnTmFtZXMgPSBBcnJheS5pc0FycmF5KERlZmluaXRpb24udGFnTmFtZSkgPyBEZWZpbml0aW9uLnRhZ05hbWUgOiBbRGVmaW5pdGlvbi50YWdOYW1lXTtcbiAgICAgICAgICAgIHRhZ05hbWVzLmZvckVhY2goZnVuY3Rpb24gKHRhZykge1xuICAgICAgICAgICAgICAgIGlmICh0YWdzW3RhZ10gPT0gbnVsbCB8fCBEZWZpbml0aW9uLmNsYXNzTmFtZSA9PSBudWxsKSB7XG4gICAgICAgICAgICAgICAgICAgIHRhZ3NbdGFnXSA9IERlZmluaXRpb247XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSk7XG4gICAgICAgIH1cbiAgICB9XG4gICAgcmV0dXJuIERlZmluaXRpb247XG59XG5leHBvcnRzLnJlZ2lzdGVyID0gcmVnaXN0ZXI7XG5cblxuLyoqKi8gfSksXG4vKiAyICovXG4vKioqLyAoZnVuY3Rpb24obW9kdWxlLCBleHBvcnRzLCBfX3dlYnBhY2tfcmVxdWlyZV9fKSB7XG5cbnZhciBka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AgICAgICAgICAgICAgX3Njcm9sbCRsaW5lMiA9IF9zbGljZWRUb0FycmF5KF9zY3JvbGwkbGluZSwgMiksXG4gICAgICAgICAgICAgICAgbGluZSA9IF9zY3JvbGwkbGluZTJbMF0sXG4gICAgICAgICAgICAgICAgb2Zmc2V0ID0gX3Njcm9sbCRsaW5lMlsxXTtcblxuICAgICAgICAgICAgdmFyIGZvcm1hdHMgPSAoMCwgX2V4dGVuZDIuZGVmYXVsdCkoe30sICgwLCBfYmxvY2suYnViYmxlRm9ybWF0cykobGluZSkpO1xuICAgICAgICAgICAgaWYgKGxpbmUgaW5zdGFuY2VvZiBfYmxvY2syLmRlZmF1bHQpIHtcbiAgICAgICAgICAgICAgdmFyIF9saW5lJGRlc2NlbmRhbnQgPSBsaW5lLmRlc2NlbmRhbnQoX3BhcmNobWVudDIuZGVmYXVsdC5MZWFmLCBvZmZzZXQpLFxuICAgICAgICAgICAgICAgICAgX2xpbmUkZGVzY2VuZGFudDIgPSBfc2xpY2VkVG9BcnJheShfbGluZSRkZXNjZW5kYW50LCAxKSxcbiAgICAgICAgICAgICAgICAgIGxlYWYgPSBfbGluZSRkZXNjZW5kYW50MlswXTtcblxuICAgICAgICAgICAgICBmb3JtYXRzID0gKDAsIF9leHRlbmQyLmRlZmF1bHQpKGZvcm1hdHMsICgwLCBfYmxvY2suYnViYmxlRm9ybWF0cykobGVhZikpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgYXR0cmlidXRlcyA9IF9vcDIuZGVmYXVsdC5hdHRyaWJ1dGVzLmRpZmYoZm9ybWF0cywgYXR0cmlidXRlcykgfHwge307XG4gICAgICAgICAgfSBlbHNlIGlmIChfdHlwZW9mKG9wLmluc2VydCkgPT09ICdvYmplY3QnKSB7XG4gICAgICAgICAgICB2YXIga2V5ID0gT2JqZWN0LmtleXMob3AuaW5zZXJ0KVswXTsgLy8gVGhlcmUgc2hvdWxkIG9ubHkgYmUgb25lIGtleVxuICAgICAgICAgICAgaWYgKGtleS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jdGlvbiBDb250YWluZXJCbG90KGRvbU5vZGUpIHtcbiAgICAgICAgdmFyIF90aGlzID0gX3N1cGVyLmNhbGwodGhpcywgZG9tTm9kZSkgfHwgdGhpcztcbiAgICAgICAgX3RoaXMuYnVpbGQoKTtcbiAgICAgICAgcmV0dXJuIF90aGlzO1xuICAgIH1cbiAgICBDb250YWluZXJCbG90LnByb3RvdHlwZS5hcHBlbmRDaGlsZCA9IGZ1bmN0aW9uIChvdGhlcikge1xuICAgICAgICB0aGlzLmluc2VydEJlZm9yZShvdGhlcik7XG4gICAgfTtcbiAgICBDb250YWluZXJCbG90LnByb3RvdHlwZS5hdHRhY2ggPSBmdW5jdGlvbiAoKSB7XG4gICAgICAgIF9zdXBlci5wcm90b3R5cGUuYXR0YWNoLmNhbGwodGhpcyk7XG4gICAgICAgIHRoaXMuY2hpbGRyZW4uZm9yRWFjaChmdW5jdGlvbiAoY2hpbGQpIHtcbiAgICAgICAgICAgIGNoaWxkLmF0dGFjaCgpO1xuICAgICAgICB9KTtcbiAgICB9O1xuICAgIENvbnRhaW5lckJsb3QucHJvdG90eXBlLmJ1aWxkID0gZnVuY3Rpb24gKCkge1xuICAgICAgICB2YXIgX3RoaXMgPSB0aGlzO1xuICAgICAgICB0aGlzLmNoaWxkcmVuID0gbmV3IGxpbmtlZF9saXN0XzEuZGVmYXVsdCgpO1xuICAgICAgICAvLyBOZWVkIHRvIGJlIHJldmVyc2VkIGZvciBpZiBET00gbm9kZXMgYWxyZWFkeSBpbiBvcmRlclxuICAgICAgICBbXS5zbGljZVxuICAgICAgICAgICAgLmNhbGwodGhpcy5kb21Ob2RlLmNoaWxkTm9kZXMpXG4gICAgICAgICAgICAucmV2ZXJzZSgpXG4gICAgICAgICAgICAuZm9yRWFjaChmdW5jdGlvbiAobm9kZSkge1xuICAgICAgICAgICAgdHJ5IHtcbiAgICAgICAgICAgICAgICB2YXIgY2hpbGQgPSBtYWtlQmxvdChub2RlKTtcbiAgICAgICAgICAgICAgICBfdG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IGlmIChtdXRhdGlvbi50YXJnZXQgPT09IF90aGlzLmRvbU5vZGUgJiYgbXV0YXRpb24udHlwZSA9PT0gJ2NoaWxkTGlzdCcpIHtcbiAgICAgICAgICAgICAgICBhZGRlZE5vZGVzLnB1c2guYXBwbHkoYWRkZWROb2RlcywgbXV0YXRpb24uYWRkZWROb2Rlcyk7XG4gICAgICAgICAgICAgICAgcmVtb3ZlZE5vZGVzLnB1c2guYXBwbHkocmVtb3ZlZE5vZGVzLCBtdXRhdGlvbi5yZW1vdmVkTm9kZXMpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9KTtcbiAgICAgICAgcmVtb3ZlZE5vZGVzLmZvckVhY2goZnVuY3Rpb24gKG5vZGUpIHtcbiAgICAgICAgICAgIC8vIENoZWNrIG5vZGUgaGFzIGFjdHVhbGx5IGJlZW4gcmVtb3ZlZFxuICAgICAgICAgICAgLy8gT25lIGV4Y2VwdGlvbiBpcyBDaHJvbWUgZG9lcyBub3QgaW1tZWRpYXRlbHkgcmVtb3ZlIElGUkFNRXNcbiAgICAgICAgICAgIC8vIGZyb20gRE9NIGJ1dCBNdXRhdGlvblJlY29yZCBpcyBjb3JyZWN0IGluIGl0cyByZXBvcnRlZCByZW1vdmFsXG4gICAgICAgICAgICBpZiAobm9kZS5wYXJlbnROb2RlICE9IG51bGwgJiZcbiAgICAgICAgICAgICAgICAvLyBAdHMtaWdub3JlXG4gICAgICAgICAgICAgICAgbm9kZS50YWdOYW1lICE9PSAnSUZSQU1FJyAmJlxuICAgICAgICAgICAgICAgIGRvY3VtZW50LmJvZHkuY29tcGFyZURvY3VtZW50UG9zaXRpb24obm9kZSkgJiBOb2RlLkRPQ1VNRU5UX1BPU0lUSU9OX0NPTlRBSU5FRF9CWSkge1xuICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHZhciBibG90ID0gUmVnaXN0cnkuZmluZChub2RlKTtcbiAgICAgICAgICAgIGlmIChibG90ID09IG51bGwpXG4gICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgaWYgKGJsb3QuZG9tTm9kZS5wYXJlbnROb2RlID09IG51bGwgfHwgYmxvdC5kb21Ob2RlLnBhcmVudE5vZGUgPT09IF90aGlzLmRvbU5vZGUpIHtcbiAgICAgICAgICAgICAgICBibG90LmRldGFjaCgpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9KTtcbiAgICAgICAgYWRkZWROb2Rlc1xuICAgICAgICAgICAgLmZpbHRlcihmdW5jdGlvbiAobm9kZSkge1xuICAgICAgICAgICAgcmV0dXJuIG5vZGUucGFyZW50Tm9kZSA9PSBfdGhpcy5kb21Ob2RlO1xuICAgICAgICB9KVxuICAgICAgICAgICAgLnNvcnQoZnVuY3Rpb24gKGEsIGIpIHtcbiAgICAgICAgICAgIGlmIChhID09PSBiKVxuICAgICAgICAgICAgICAgIHJldHVybiAwO1xuICAgICAgICAgICAgaWYgKGEuY29tcGFyZURvY3VtZW50UG9zaXRpb24oYikgJiBOb2RlLkRPQ1VNRU5UX1BPU0lUSU9OX0ZPTExPV0lORykge1xuICAgICAgICAgICAgICAgIHJldHVybiAxO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgcmV0dXJuIC0xO1xuICAgICAgICB9KVxuICAgICAgICAgICAgLmZvckVhY2goZnVuY3Rpb24gKG5vZGUpIHtcbiAgICAgICAgICAgIHZhciByZWZCbG90ID0gbnVsbDtcbiAgICAgICAgICAgIGlmIChub2RlLm5leHRTaWJsaW5nICE9IG51bGwpIHtcbiAgICAgICAgICAgICAgICByZWZCbG90ID0gUmVnaXN0cnkuZmluZChub2RlLm5leHRTaWJsaW5nKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHZhciBibG90ID0gbWFrZUJsb3Qobm9kZSk7XG4gICAgICAgICAgICBpZiAoYmxvdC5uZXh0ICE9IHJlZkJsb3QgfHwgYmxvdC5uZXh0ID09IG51bGwpIHtcbiAgICAgICAgICAgICAgICBpZiAoYmxvdC5wYXJlbnQgIT0gbnVsbCkge1xuICAgICAgICAgICAgICAgICAgICBibG90LnBhcmVudC5yZW1vdmVDaGlsZChfdGhpcyk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIF90aGlzLmluc2VydEJlZm9yZShibG90LCByZWZCbG90IHx8IHVuZGVmaW5lZCk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0pO1xuICAgIH07XG4gICAgcmV0dXJuIENvbnRhaW5lckJsb3Q7XG59KHNoYWRvd18xLmRlZmF1bHQpKTtcbmZ1bmN0aW9uIG1ha2VCbG90KG5vZGUpIHtcbiAgICB2YXIgYmxvdCA9IFJlZ2lzdHJ5LmZpbmQobm9kZSk7XG4gICAgaWYgKGJsb3QgPT0gbnVsbCkge1xuICAgICAgICB0cnkge1xuICAgICAgICAgICAgYmxvdCA9IFJlZ2lzdHJ5LmNyZWF0ZShub2RlKTtcbiAgICAgICAgfVxuICAgICAgICBjYXRjaCAoZSkge1xuICAgICAgICAgICAgYmxvdCA9IFJlZ2lzdHJ5LmNyZWF0ZShSZWdpc3RyeS5TY29wZS5JTkxJTkUpO1xuICAgICAgICAgICAgW10uc2xpY2UuY2FsbChub2RlLmNoaWxkTm9kZXMpLmZvckVhY2goZnVuY3Rpb24gKGNoaWxkKSB7XG4gICAgICAgICAgICAgICAgLy8gQHRzLWlnbm9yZVxuICAgICAgICAgICAgICAgIGJsb3QuZG9tTm9kZS5hcHBlbmRDaGlsZChjaGlsZCk7XG4gICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIGlmIChub2RlLnBhcmVudE5vZGUpIHtcbiAgICAgICAgICAgICAgICBub2RlLnBhcmVudE5vZGUucmVwbGFjZUNoaWxkKGJsb3QuZG9tTm9kZSwgbm9kZSk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBibG90LmF0dGFjaCgpO1xuICAgICAgICB9XG4gICAgfVxuICAgIHJldHVybiBibG90O1xufVxuZXhwb3J0cy5kZWZhdWx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1xuICAgICAgICAgICAgfSkpIHtcbiAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlO1xuICAgICAgICAgICAgfVxuICAgICAgICAgIH1cbiAgICAgICAgICBpZiAoYmluZGluZy5wcmVmaXggIT0gbnVsbCAmJiAhYmluZGluZy5wcmVmaXgudGVzdChjdXJDb250ZXh0LnByZWZpeCkpIHJldHVybiBmYWxzZTtcbiAgICAgICAgICBpZiAoYmluZGluZy5zdWZmaXggIT0gbnVsbCAmJiAhYmluZGluZy5zdWZmaXgudGVzdChjdXJDb250ZXh0LnN1ZmZpeCkpIHJldHVybiBmYWxzZTtcbiAgICAgICAgICByZXR1cm4gYmluZGluZy5oYW5kbGVyLmNhbGwoX3RoaXMyLCByYW5nZSwgY3VyQ29udGV4dCkgIT09IHRydWU7XG4gICAgICAgIH0pO1xuICAgICAgICBpZiAocHJldmVudGVkKSB7XG4gICAgICAgICAgZXZ0LnByZXZlbnREZWZhdWx0KCk7XG4gICAgICAgIH1cbiAgICAgIH0pO1xuICAgIH1cbiAgfV0pO1xuXG4gIHJldHVybiBLZXlib2FyZDtcbn0oX21vZHVsZTIuZGVmYXVsdCk7XG5cbktleWJvYXJkLmtleXMgPSB7XG4gIEJBQ0tTUEFDRTogOCxcbiAgVEFCOiA5LFxuICBFTlRFUjogMTMsXG4gIEVTQ0FQRTogMjcsXG4gIExFRlQ6IDM3LFxuICBVUDogMzgsXG4gIFJJR0hUOiAzOSxcbiAgRE9XTjogNDAsXG4gIERFTEVURTogNDZcbn07XG5cbktleWJvYXJkLkRFRkFVTFRTID0ge1xuICBiaW5kaW5nczoge1xuICAgICdib2xkJzogbWFrZUZvcm1hdEhhbmRsZXIoJ2JvbGQnKSxcbiAgICAnaXRhbGljJzogbWFrZUZvcm1hdEhhbmRsZXIoJ2l0YWxpYycpLFxuICAgICd1bmRlcmxpbmUnOiBtYWtlRm9ybWF0SGFuZGxlcigndW5kZXJsaW5lJyksXG4gICAgJ2luZGVudCc6IHtcbiAgICAgIC8v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gaWYgKHRoaXMudGFnTmFtZS5pbmRleE9mKHZhbHVlKSA+IC0xKSB7XG4gICAgICAgICAgICAgICAgbm9kZSA9IGRvY3VtZW50LmNyZWF0ZUVsZW1lbnQodmFsdWUpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgbm9kZSA9IGRvY3VtZW50LmNyZWF0ZUVsZW1lbnQodGhpcy50YWdOYW1lWzBdKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgIG5vZGUgPSBkb2N1bWVudC5jcmVhdGVFbGVtZW50KHRoaXMudGFnTmFtZSk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKHRoaXMuY2xhc3NOYW1lKSB7XG4gICAgICAgICAgICBub2RlLmNsYXNzTGlzdC5hZGQodGhpcy5jbGFzc05hbWUpO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiBub2RlO1xuICAgIH07XG4gICAgU2hhZG93QmxvdC5wcm90b3R5cGUuYXR0YWNoID0gZnVuY3Rpb24gKCkge1xuICAgICAgICBpZiAodGhpcy5wYXJlbnQgIT0gbnVsbCkge1xuICAgICAgICAgICAgdGhpcy5zY3JvbGwgPSB0aGlzLnBhcmVudC5zY3JvbGw7XG4gICAgICAgIH1cbiAgICB9O1xuICAgIFNoYWRvd0Jsb3QucHJvdG90eXBlLmNsb25lID0gZnVuY3Rpb24gKCkge1xuICAgICAgICB2YXIgZG9tTm9kZSA9IHRoaXMuZG9tTm9kZS5jbG9uZU5vZGUoZmFsc2UpO1xuICAgICAgICByZXR1cm4gUmVnaXN0cnkuY3JlYXRlKGRvbU5vZGUpO1xuICAgIH07XG4gICAgU2hhZG93QmxvdC5wcm90b3R5cGUuZGV0YWNoID0gZnVuY3Rpb24gKCkge1xuICAgICAgICBpZiAodGhpcy5wYXJlbnQgIT0gbnVsbClcbiAgICAgICAgICAgIHRoaXMucGFyZW50LnJlbW92ZUNo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gIGZvciAodmFyIF9pID0gMDsgX2kgPCBhcmd1bWVudHMubGVuZ3RoOyBfaSsrKSB7XG4gICAgICAgICAgICBub2Rlc1tfaV0gPSBhcmd1bWVudHNbX2ldO1xuICAgICAgICB9XG4gICAgICAgIHRoaXMuaW5zZXJ0QmVmb3JlKG5vZGVzWzBdLCBudWxsKTtcbiAgICAgICAgaWYgKG5vZGVzLmxlbmd0aCA+IDEpIHtcbiAgICAgICAgICAgIHRoaXMuYXBwZW5kLmFwcGx5KHRoaXMsIG5vZGVzLnNsaWNlKDEpKTtcbiAgICAgICAgfVxuICAgIH07XG4gICAgTGlua2VkTGlzdC5wcm90b3R5cGUuY29udGFpbnMgPSBmdW5jdGlvbiAobm9kZSkge1xuICAgICAgICB2YXIgY3VyLCBuZXh0ID0gdGhpcy5pdGVyYXRvcigpO1xuICAgICAgICB3aGlsZSAoKGN1ciA9IG5leHQoKSkpIHtcbiAgICAgICAgICAgIGlmIChjdXIgPT09IG5vZGUpXG4gICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIGZhbHNlO1xuICAgIH07XG4gICAgTGlua2VkTGlzdC5wcm90b3R5cGUuaW5zZXJ0QmVmb3JlID0gZnVuY3Rpb24gKG5vZGUsIHJlZk5vZGUpIHtcbiAgICAgICAgaWYgKCFub2RlKVxuICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICBub2RlLm5leHQgPSByZWZOb2RlO1xuICAgICAgICBpZiAocmVmTm9kZSAhPSBudWxsKSB7XG4gICAgICAgICAgICBub2RlLnByZXYgPSByZWZOb2RlLnByZXY7XG4gICAgICAgICAgICBpZiAocmVmTm9kZS5wcmV2ICE9IG51bGwpIHtcbiAgICAgICAgICAgICAgICByZWZOb2RlLnByZXYubmV4dCA9IG5vZGU7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByZWZOb2RlLnByZXYgPSBub2RlO1xuICAgICAgICAgICAgaWYgKHJlZk5vZGUgPT09IHRoaXMuaGVhZCkge1xuICAgICAgICAgICAgICAgIHRoaXMuaGVhZCA9IG5vZGU7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgZWxzZSBpZiAodGhpcy50YWlsICE9IG51bGwpIHtcbiAgICAgICAgICAgIHRoaXMudGFpbC5uZXh0ID0gbm9kZTtcbiAgICAgICAgICAgIG5vZGUucHJldiA9IHRoaXMudGFpbDtcbiAgICAgICAgICAgIHRoaXMudGFpbCA9IG5vZGU7XG4gICAgICAgIH1cbiAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICBub2RlLnByZXYgPSBudWxsO1xuICAgICAgICAgICAgdGhpcy5oZWFkID0gdGhpcy50YWlsID0gbm9kZTtcbiAgICAgICAgfVxuICAgICAgICB0aGlzLmxlbmd0aCArPSAxO1xuICAgIH07XG4gICAgTGlua2VkTGlzdC5wcm90b3R5cGUub2Zmc2V0ID0gZnVuY3Rpb24gKHRhcmdldCkge1xuICAgICAgICB2YXIgaW5kZXggPSAwLCBjdXIgPSB0aGlzLmhlYWQ7XG4gICAgICAgIHdoaWxlIChjdXIgIT0gbnVsbCkge1xuICAgICAgICAgICAgaWYgKGN1ciA9PT0gdGFyZ2V0KVxuICAgICAgICAgICAgICAgIHJldHVybiBpbmRleDtcbiAgICAgICAgICAgIGluZGV4ICs9IGN1ci5sZW5ndGgoKTtcbiAgICAgICAgICAgIGN1ciA9IGN1ci5uZXh0O1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiAtMTtcbiAgICB9O1xuICAgIExpbmtlZExpc3QucHJvdG90eXBlLnJlbW92ZSA9IGZ1bmN0aW9uIChub2RlKSB7XG4gICAgICAgIGlmICghdGhpcy5jb250YWlucyhub2RlKSlcbiAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgaWYgKG5vZGUucHJldiAhPSBudWxsKVxuICAgICAgICAgICAgbm9kZS5wcmV2Lm5leHQgPSBub2RlLm5leHQ7XG4gICAgICAgIGlmIChub2RlLm5leHQ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AgICAgICAgICAgICAgKGluY2x1c2l2ZSAmJiBpbmRleCA9PT0gbGVuZ3RoICYmIChjdXIubmV4dCA9PSBudWxsIHx8IGN1ci5uZXh0Lmxlbmd0aCgpICE9PSAwKSkpIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gW2N1ciwgaW5kZXhdO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaW5kZXggLT0gbGVuZ3RoO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiBbbnVsbCwgMF07XG4gICAgfTtcbiAgICBMaW5rZWRMaXN0LnByb3RvdHlwZS5mb3JFYWNoID0gZnVuY3Rpb24gKGNhbGxiYWNrKSB7XG4gICAgICAgIHZhciBjdXIsIG5leHQgPSB0aGlzLml0ZXJhdG9yKCk7XG4gICAgICAgIHdoaWxlICgoY3VyID0gbmV4dCgpKSkge1xuICAgICAgICAgICAgY2FsbGJhY2soY3VyKTtcbiAgICAgICAgfVxuICAgIH07XG4gICAgTGlua2VkTGlzdC5wcm90b3R5cGUuZm9yRWFjaEF0ID0gZnVuY3Rpb24gKGluZGV4LCBsZW5ndGgsIGNhbGxiYWNrKSB7XG4gICAgICAgIGlmIChsZW5ndGggPD0gMClcbiAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgdmFyIF9hID0gdGhpcy5maW5kKGluZGV4KSwgc3RhcnROb2RlID0gX2FbMF0sIG9mZnNldCA9IF9hWzFdO1xuICAgICAgICB2YXIgY3VyLCBjdXJJbmRleCA9IGluZGV4IC0gb2Zmc2V0LCBuZXh0ID0gdGhpcy5pdGVyYXRvcihzdGFydE5vZGUpO1xuICAgICAgICB3aGlsZSAoKGN1ciA9IG5leHQoKSkgJiYgY3VySW5kZXggPCBpbmRleCArIGxlbmd0aCkge1xuICAgICAgICAgICAgdmFyIGN1ckxlbmd0aCA9IGN1ci5sZW5ndGgoKTtcbiAgICAgICAgICAgIGlmIChpbmRleCA+IGN1ckluZGV4KSB7XG4gICAgICAgICAgICAgICAgY2FsbGJhY2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aWZ5XG4gICAgICAgIHZhciByZWNvcmRzID0gW10uc2xpY2UuY2FsbCh0aGlzLm9ic2VydmVyLnRha2VSZWNvcmRzKCkpO1xuICAgICAgICAvLyBBcnJheS5wdXNoIGN1cnJlbnRseSBzZWVtcyB0byBiZSBpbXBsZW1lbnRlZCBieSBhIG5vbi10YWlsIHJlY3Vyc2l2ZSBmdW5jdGlvblxuICAgICAgICAvLyBzbyB3ZSBjYW5ub3QganVzdCBtdXRhdGlvbnMucHVzaC5hcHBseShtdXRhdGlvbnMsIHRoaXMub2JzZXJ2ZXIudGFrZVJlY29yZHMoKSk7XG4gICAgICAgIHdoaWxlIChyZWNvcmRzLmxlbmd0aCA+IDApXG4gICAgICAgICAgICBtdXRhdGlvbnMucHVzaChyZWNvcmRzLnBvcCgpKTtcbiAgICAgICAgLy8gVE9ETyB1c2UgV2Vha01hcFxuICAgICAgICB2YXIgbWFyayA9IGZ1bmN0aW9uIChibG90LCBtYXJrUGFyZW50KSB7XG4gICAgICAgICAgICBpZiAobWFya1BhcmVudCA9PT0gdm9pZCAwKSB7IG1hcmtQYXJlbnQgPSB0cnVlOyB9XG4gICAgICAgICAgICBpZiAoYmxvdCA9PSBudWxsIHx8IGJsb3QgPT09IF90aGlzKVxuICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgIGlmIChibG90LmRvbU5vZGUucGFyZW50Tm9kZSA9PSBudWxsKVxuICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgIC8vIEB0cy1pZ25vcmVcbiAgICAgICAgICAgIGlmIChibG90LmRvbU5vZGVbUmVnaXN0cnkuREFUQV9LRVldLm11dGF0aW9ucyA9PSBudWxsKSB7XG4gICAgICAgICAgICAgICAgLy8gQHRzLWlnbm9yZVxuICAgICAgICAgICAgICAgIGJsb3QuZG9tTm9kZVtSZWdpc3RyeS5EQVRBX0tFWV0ubXV0YXRpb25zID0gW107XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAobWFya1BhcmVudClcbiAgICAgICAgICAgICAgICBtYXJrKGJsb3QucGFyZW50KTtcbiAgICAgICAgfTtcbiAgICAgICAgdmFyIG9wdGltaXplID0gZnVuY3Rpb24gKGJsb3QpIHtcbiAgICAgICAgICAgIC8vIFBvc3Qtb3JkZXIgdHJhdmVyc2FsXG4gICAgICAgICAgICBpZiAoXG4gICAgICAgICAgICAvLyBAdHMtaWdub3JlXG4gICAgICAgICAgICBibG90LmRvbU5vZGVbUmVnaXN0cnkuREFUQV9LRVldID09IG51bGwgfHxcbiAgICAgICAgICAgICAgICAvLyBAdHMtaWdub3JlXG4gICAgICAgICAgICAgICAgYmxvdC5kb21Ob2RlW1JlZ2lzdHJ5LkRBVEFfS0VZXS5tdXRhdGlvbnMgPT0gbnVsbCkge1xuICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmIChibG90IGluc3RhbmNlb2YgY29udGFpbmVyXzEuZGVmYXVsdCkge1xuICAgICAgICAgICAgICAgIGJsb3QuY2hpbGRyZW4uZm9yRWFjaChvcHRpbWl6ZSk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBibG90Lm9wdGltaXplKGNvbnRleHQpO1xuICAgICAgICB9O1xuICAgICAgICB2YXIgcmVtYWluaW5nID0gbXV0YXRpb25zO1xuICAgICAgICBmb3IgKHZhciBpID0gMDsgcmVtYWluaW5nLmxlbmd0aCA+IDA7IGkgKz0gMSkge1xuICAgICAgICAgICAgaWYgKGkgPj0gTUFYX09QVElNSVpFX0lURVJBVElPTlMpIHtcbiAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoJ1tQYXJjaG1lbnRdIE1heGltdW0gb3B0aW1pemUgaXRlcmF0aW9ucyByZWFjaGVkJyk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByZW1haW5pbmcuZm9yRWFjaChmdW5jdGlvbiAobXV0YXRpb24pIHtcbiAgICAgICAgICAgICAgICB2YXIgYmxvdCA9IFJlZ2lzdHJ5LmZpbmQobXV0YXRpb24udGFyZ2V0LCB0cnVlKTtcbiAgICAgICAgICAgICAgICBpZiAoYmxvdCA9PSBudWxsKVxuICAgICAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICAgICAgaWYgKGJsb3QuZG9tTm9kZSA9PT0gbXV0YXRpb24udGFyZ2V0KSB7XG4gICAgICAgICAgICAgICAgICAgIGlmIChtdXRhdGlvbi50eXBlID09PSAnY2hpbGRMaXN0Jykge1xuICAgICAgICAgICAgICAgICAgICAgICAgbWFyayhSZWdpc3RyeS5maW5kKG11dGF0aW9uLnByZXZpb3VzU2libGluZywgZmFsc2UpKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIFtdLmZvckVhY2guY2FsbChtdXRhdGlvbi5hZGRlZE5vZGVzLCBmdW5jdGlvbiAobm9kZSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBjaGlsZCA9IFJlZ2lzdHJ5LmZpbmQobm9kZSwgZmFsc2UpO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1hcmsoY2hpbGQsIGZhbHNlKTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoY2hpbGQgaW5zdGFuY2VvZiBjb250YWluZXJfMS5kZWZhdWx0KSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNoaWxkLmNoaWxkcmVuLmZvckVhY2goZnVuY3Rpb24gKGdyYW5kQ2hpbGQpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1hcmsoZ3JhbmRDaGlsZCwgZmFsc2UpO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBlbHNlIGlmIChtdXRhdGlvbi50eXBlID09PSAnYXR0cmlidXRlcycpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIG1hcmsoYmxvdC5wcmV2KTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBtYXJrKGJsb3QpO1xuICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICB0aGlzLmNoaWxkcmVuLmZvckVhY2gob3B0aW1pemUpO1xuICAgICAgICAgICAgcmVtYWluaW5nID0gW10uc2xpY2UuY2FsbCh0aGlzLm9ic2VydmVyLnRha2VSZWNvcmRzKCkpO1xuICAgICAgICAgICAgcmVjb3JkcyA9IHJlbWFpbmluZy5zbGljZSgpO1xuICAgICAgICAgICAgd2hpbGUgKHJlY29yZHMubGVuZ3RoID4gMClcbiAgICAgICAgICAgICAgICBtdXRhdGlvbnMucHVzaChyZWNvcmRzLnBvcCgpKTtcbiAgICAgICAgfVxuICAgIH07XG4gICAgU2Nyb2xsQmxvdC5wcm90b3R5cGUudXBkYXRlID0gZnVuY3Rpb24gKG11dGF0aW9ucywgY29udGV4dCkge1xuICAgICAgICB2YXIgX3RoaXMgPSB0aGlzO1xuICAgICAgICBpZiAoY29udGV4dCA9PT0gdm9pZCAwKSB7IGNvbnRleHQgPSB7fTsgfVxuICAgICAgICBtdXRhdGlvbnMgPSBtdXRhdGlvbnMgfHwgdGhpcy5vYnNlcnZlci50YWtlUmVjb3JkcygpO1xuICAgICAgICAvLyBUT0RPIHVzZSBXZWFrTWFwXG4gICAgICAgIG11dGF0aW9uc1xuICAgICAgICAgICAgLm1hcChmdW5jdGlvbiAobXV0YXRpb24pIHtcbiAgICAgICAgICAgIHZhciBibG90ID0gUmVnaXN0cnkuZmluZChtdXRhdGlvbi50YXJnZXQsIHRydWUpO1xuICAgICAgICAgICAgaWYgKGJsb3QgPT0gbnVsbClcbiAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDtcbiAgICAgICAgICAgIC8vIEB0cy1pZ25vcmVcbiAgICAgICAgICAgIGlmIChibG90LmRvbU5vZGVbUmVnaXN0cnkuREFUQV9LRVldLm11dGF0aW9ucyA9PSBudWxsKSB7XG4gICAgICAgICAgICAgICAgLy8gQHRzLWlnbm9yZVxuICAgICAgICAgICAgICAgIGJsb3QuZG9tTm9kZVtSZWdpc3RyeS5EQVRBX0tFWV0ubXV0YXRpb25zID0gW211dGF0aW9uXTtcbiAgICAgICAgICAgICAgICByZXR1cm4gYmxvdDtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgIC8vIEB0cy1pZ25vcmVcbiAgICAgICAgICAgICAgICBibG90LmRvbU5vZGVbUmVnaXN0cnkuREFUQV9LRVldLm11dGF0aW9ucy5wdXNoKG11dGF0aW9uKTtcbiAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSlcbiAgICAgICAgICAgIC5mb3JFYWNoKGZ1bmN0aW9uIChibG90KSB7XG4gICAgICAgICAgICBpZiAoYmxvdCA9PSBudWxsIHx8XG4gICAgICAgICAgICAgICAgYmxvdCA9PT0gX3RoaXMgfHxcbiAgICAgICAgICAgICAgICAvL0B0cy1pZ25vcmVcbiAgICAgICAgICAgICAgICBibG90LmRvbU5vZGVbUmVnaXN0cnkuREFUQV9LRVldID09IG51bGwpXG4gICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgLy8gQHRzLWlnbm9yZVxuICAgICAgICAgICAgYmxvdC51cGRhdGUoYmxvdC5kb21Ob2RlW1JlZ2lzdHJ5LkRBVEFfS0VZXS5tdXRhdGlvbnMgfHwgW10sIGNvbnRleHQpO1xuICAgICAgICB9KTtcbiAgICAgICAgLy8gQHRzLWlnbm9yZVxuICAgICAgICBpZiAodGhpcy5kb21Ob2RlW1JlZ2lzdHJ5LkRBVEFfS0VZXS5tdXRhdGlvbnMgIT0gbnVsbCkge1xuICAgICAgICAgICAgLy8gQHRzLWlnbm9yZVxuICAgICAgICAgICAgX3N1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IDApIHtcbiAgICAgICAgICAgIC8vIEZhY3RvciBvdXQgYW55IGNvbW1vbiBwcmVmaXhpZXMuXG4gICAgICAgICAgICBjb21tb25sZW5ndGggPSBkaWZmX2NvbW1vblByZWZpeCh0ZXh0X2luc2VydCwgdGV4dF9kZWxldGUpO1xuICAgICAgICAgICAgaWYgKGNvbW1vbmxlbmd0aCAhPT0gMCkge1xuICAgICAgICAgICAgICBpZiAoKHBvaW50ZXIgLSBjb3VudF9kZWxldGUgLSBjb3VudF9pbnNlcnQpID4gMCAmJlxuICAgICAgICAgICAgICAgICAgZGlmZnNbcG9pbnRlciAtIGNvdW50X2RlbGV0ZSAtIGNvdW50X2luc2VydCAtIDFdWzBdID09XG4gICAgICAgICAgICAgICAgICBESUZGX0VRVUFMKSB7XG4gICAgICAgICAgICAgICAgZGlmZnNbcG9pbnRlciAtIGNvdW50X2RlbGV0ZSAtIGNvdW50X2luc2VydCAtIDFdWzFdICs9XG4gICAgICAgICAgICAgICAgICAgIHRleHRfaW5zZXJ0LnN1YnN0cmluZygwLCBjb21tb25sZW5ndGgpO1xuICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIGRpZmZzLnNwbGljZSgwLCAwLCBbRElGRl9FUVVBTCxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRleHRfaW5zZXJ0LnN1YnN0cmluZygwLCBjb21tb25sZW5ndGgpXSk7XG4gICAgICAgICAgICAgICAgcG9pbnRlcisrO1xuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgIHRleHRfaW5zZXJ0ID0gdGV4dF9pbnNlcnQuc3Vic3RyaW5nKGNvbW1vbmxlbmd0aCk7XG4gICAgICAgICAgICAgIHRleHRfZGVsZXRlID0gdGV4dF9kZWxldGUuc3Vic3RyaW5nKGNvbW1vbmxlbmd0aCk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICAvLyBGYWN0b3Igb3V0IGFueSBjb21tb24gc3VmZml4aWVzLlxuICAgICAgICAgICAgY29tbW9ubGVuZ3RoID0gZGlmZl9jb21tb25TdWZmaXgodGV4dF9pbnNlcnQsIHRleHRfZGVsZXRlKTtcbiAgICAgICAgICAgIGlmIChjb21tb25sZW5ndGggIT09IDApIHtcbiAgICAgICAgICAgICAgZGlmZnNbcG9pbnRlcl1bMV0gPSB0ZXh0X2luc2VydC5zdWJzdHJpbmcodGV4dF9pbnNlcnQubGVuZ3RoIC1cbiAgICAgICAgICAgICAgICAgIGNvbW1vbmxlbmd0aCkgKyBkaWZmc1twb2ludGVyXVsxXTtcbiAgICAgICAgICAgICAgdGV4dF9pbnNlcnQgPSB0ZXh0X2luc2VydC5zdWJzdHJpbmcoMCwgdGV4dF9pbnNlcnQubGVuZ3RoIC1cbiAgICAgICAgICAgICAgICAgIGNvbW1vbmxlbmd0aCk7XG4gICAgICAgICAgICAgIHRleHRfZGVsZXRlID0gdGV4dF9kZWxldGUuc3Vic3RyaW5nKDAsIHRleHRfZGVsZXRlLmxlbmd0aCAtXG4gICAgICAgICAgICAgICAgICBjb21tb25sZW5ndGgpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgIH1cbiAgICAgICAgICAvLyBEZWxldGUgdGhlIG9mZmVuZGluZyByZWNvcmRzIGFuZCBhZGQgdGhlIG1lcmdlZCBvbmVzLlxuICAgICAgICAgIGlmIChjb3VudF9kZWxldGUgPT09IDApIHtcbiAgICAgICAgICAgIGRpZmZzLnNwbGljZShwb2ludGVyIC0gY291bnRfaW5zZXJ0LFxuICAgICAgICAgICAgICAgIGNvdW50X2RlbGV0ZSArIGNvdW50X2luc2VydCwgW0RJRkZfSU5TRVJULCB0ZXh0X2luc2VydF0pO1xuICAgICAgICAgIH0gZWxzZSBpZiAoY291bnRfaW5zZXJ0ID09PSAwKSB7XG4gICAgICAgICAgICBkaWZmcy5zcGxpY2UocG9pbnRlciAtIGNvdW50X2RlbGV0ZSxcbiAgICAgICAgICAgICAgICBjb3VudF9kZWxldGUgKyBjb3VudF9pbnNlcnQsIFtESUZGX0RFTEVURSwgdGV4dF9kZWxldGVdKTtcbiAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgZGlmZnMuc3BsaWNlKHBvaW50ZXIgLSBjb3VudF9kZWxldGUgLSBjb3VudF9pbnNlcnQsXG4gICAgICAgICAgICAgICAgY291bnRfZGVsZXRlICsgY291bnRfaW5zZXJ0LCBbRElGRl9ERUxFVEUsIHRleHRfZGVsZXRlXSxcbiAgICAgICAgICAgICAgICBbRElGRl9JTlNFUlQsIHRleHRfaW5zZXJ0XSk7XG4gICAgICAgICAgfVxuICAgICAgICAgIHBvaW50ZXIgPSBwb2ludGVyIC0gY291bnRfZGVsZXRlIC0gY291bnRfaW5zZXJ0ICtcbiAgICAgICAgICAgICAgICAgICAgKGNvdW50X2RlbGV0ZSA/IDEgOiAwKSArIChjb3VudF9pbnNlcnQgPyAxIDogMCkgKyAxO1xuICAgICAgICB9IGVsc2UgaWYgKHBvaW50ZXIgIT09IDAgJiYgZGlmZnNbcG9pbnRlciAtIDFdWzBdID09IERJRkZfRVFVQUwpIHtcbiAgICAgICAgICAvLyBNZXJnZSB0aGlzIGVxdWFsaXR5IHdpdGggdGhlIHByZXZpb3VzIG9uZS5cbiAgICAgICAgICBkaWZmc1twb2ludGVyIC0gMV1bMV0gKz0gZGlmZnNbcG9pbnRlcl1bMV07XG4gICAgICAgICAgZGlmZnMuc3BsaWNlKHBvaW50ZXIsIDEpO1xuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgIHBvaW50ZXIrKztcbiAgICAgICAgfVxuICAgICAgICBjb3VudF9pbnNlcnQgPSAwO1xuICAgICAgICBjb3VudF9kZWxldGUgPSAwO1xuICAgICAgICB0ZXh0X2RlbGV0ZSA9ICcnO1xuICAgICAgICB0ZXh0X2luc2VydCA9ICcnO1xuICAgICAgICBicmVhaztcbiAgICB9XG4gIH1cbiAgaWYgKGRpZmZzW2RpZmZzLmxlbmd0aCAtIDFdWzFdID09PSAnJykge1xuICAg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Ryb2xzLmZvckVhY2goZnVuY3Rpb24gKHBhaXIpIHtcbiAgICAgICAgdmFyIF9wYWlyID0gX3NsaWNlZFRvQXJyYXkocGFpciwgMiksXG4gICAgICAgICAgICBmb3JtYXQgPSBfcGFpclswXSxcbiAgICAgICAgICAgIGlucHV0ID0gX3BhaXJbMV07XG5cbiAgICAgICAgaWYgKGlucHV0LnRhZ05hbWUgPT09ICdTRUxFQ1QnKSB7XG4gICAgICAgICAgdmFyIG9wdGlvbiA9IHZvaWQgMDtcbiAgICAgICAgICBpZiAocmFuZ2UgPT0gbnVsbCkge1xuICAgICAgICAgICAgb3B0aW9uID0gbnVsbDtcbiAgICAgICAgICB9IGVsc2UgaWYgKGZvcm1hdHNbZm9ybWF0XSA9PSBudWxsKSB7XG4gICAgICAgICAgICBvcHRpb24gPSBpbnB1dC5xdWVyeVNlbGVjdG9yKCdvcHRpb25bc2VsZWN0ZWRdJyk7XG4gICAgICAgICAgfSBlbHNlIGlmICghQXJyYXkuaXNBcnJheShmb3JtYXRzW2Zvcm1hdF0pKSB7XG4gICAgICAgICAgICB2YXIgdmFsdWUgPSBmb3JtYXRzW2Zvcm1hdF07XG4gICAgICAgICAgICBpZiAodHlwZW9mIHZhbHVlID09PSAnc3RyaW5nJykge1xuICAgICAgICAgICAgICB2YWx1ZSA9IHZhbHVlLnJlcGxhY2UoL1xcXCIvZywgJ1xcXFxcIicpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgb3B0aW9uID0gaW5wdXQucXVlcnlTZWxlY3Rvcignb3B0aW9uW3ZhbHVlPVwiJyArIHZhbHVlICsgJ1wiXScpO1xuICAgICAgICAgIH1cbiAgICAgICAgICBpZiAob3B0aW9uID09IG51bGwpIHtcbiAgICAgICAgICAgIGlucHV0LnZhbHVlID0gJyc7IC8vIFRPRE8gbWFrZSBjb25maWd1cmFibGU/XG4gICAgICAgICAgICBpbnB1dC5zZWxlY3RlZEluZGV4ID0gLTE7XG4gICAgICAgICAgfSBlbHNlIHt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ICAgICAgaGFuZGxlcnM6IHtcbiAgICAgICAgbGluazogZnVuY3Rpb24gbGluayh2YWx1ZSkge1xuICAgICAgICAgIGlmICh2YWx1ZSkge1xuICAgICAgICAgICAgdmFyIHJhbmdlID0gdGhpcy5xdWlsbC5nZXRTZWxlY3Rpb24oKTtcbiAgICAgICAgICAgIGlmIChyYW5nZSA9PSBudWxsIHx8IHJhbmdlLmxlbmd0aCA9PSAwKSByZXR1cm47XG4gICAgICAgICAgICB2YXIgcHJldmlldyA9IHRoaXMucXVpbGwuZ2V0VGV4dChyYW5nZSk7XG4gICAgICAgICAgICBpZiAoL15cXFMrQFxcUytcXC5cXFMrJC8udGVzdChwcmV2aWV3KSAmJiBwcmV2aWV3LmluZGV4T2YoJ21haWx0bzonKSAhPT0gMCkge1xuICAgICAgICAgICAgICBwcmV2aWV3ID0gJ21haWx0bzonICsgcHJldmlldztcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHZhciB0b29sdGlwID0gdGhpcy5xdWlsbC50aGVtZS50b29sdGlwO1xuICAgICAgICAgICAgdG9vbHRpcC5lZGl0KCdsaW5rJywgcHJldmlldyk7XG4gICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIHRoaXMucXVpbGwuZm9ybWF0KCdsaW5rJywgZmFsc2UpO1xuICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgfVxuICAgIH1cbiAgfVxufSk7XG5cbnZhciBTbm93VG9vbHRpcCA9IGZ1bmN0aW9uIChfQmFzZVRvb2x0aXApIHtcbiAgX2luaGVyaXRzKFNub3dUb29sdGlwLCBfQmFzZVRvb2x0aXApO1xuXG4gIGZ1bmN0aW9uIFNub3dUb29sdGlwKHF1aWxsLCBib3VuZHMpIHtcbiAgICBfY2xhc3NDYWxsQ2hlY2sodGhpcywgU25vd1Rvb2x0aXApO1xuXG4gICAgdmFyIF90aGlzMiA9IF9wb3NzaWJsZUNvbnN0cnVjdG9yUmV0dXJuKHRoaXMsIChTbm93VG9vbHR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(module,__webpack_exports__,__webpack_require__){"use strict";eval("/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"d\", function() { return getViewElement; });\n/* unused harmony export getViewWidth */\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"a\", function() { return fixImageSize; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"c\", function() { return fixVideoSize; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"b\", function() { return fixSize; });\nfunction getViewElement() {\r\n return document.querySelector('div.ql-editor');\r\n}\r\nfunction getViewWidth() {\r\n var view = getViewElement();\r\n if (view) {\r\n var width = view.clientWidth;\r\n var style = getComputedStyle(view);\r\n if (style.paddingLeft) {\r\n width -= parseFloat(style.paddingLeft);\r\n }\r\n if (style.paddingRight) {\r\n width -= parseFloat(style.paddingRight);\r\n }\r\n if (width > 0) {\r\n return width;\r\n }\r\n }\r\n return 0;\r\n}\r\nfunction fixImageSize() {\r\n getViewElement()\r\n .querySelectorAll('img')\r\n .forEach(function (img) {\r\n var viewWidth = getViewWidth();\r\n var width = Number(img.dataset.width);\r\n var height = Number(img.dataset.height);\r\n if (!viewWidth || !width || !height)\r\n return;\r\n if (width > viewWidth) {\r\n height = (viewWidth / width) * height;\r\n width = viewWidth;\r\n }\r\n img.style.width = width + \"px\";\r\n img.style.height = height + \"px\";\r\n });\r\n}\r\nfunction onPalyVideo(e) {\r\n getViewElement()\r\n .querySelectorAll('video,audio')\r\n .forEach(function (media) {\r\n if (media !== e.target) {\r\n media.pause();\r\n }\r\n });\r\n}\r\nfunction fixVideoSize() {\r\n getViewElement()\r\n .querySelectorAll('video')\r\n .forEach(function (video) {\r\n video.setAttribute('controls', '');\r\n video.setAttribute('preload', 'auto');\r\n video.setAttribute('webkit-playsinline', '');\r\n video.setAttribute('playsinline', '');\r\n video.setAttribute('x5-playsinline', '');\r\n video.setAttribute('controlsList', 'nodownload');\r\n video.removeAttribute('autopaly');\r\n video.removeAttribute('loop');\r\n video.removeEventListener('playing', onPalyVideo);\r\n video.addEventListener('playing', onPalyVideo);\r\n var viewWidth = getViewWidth();\r\n if (!viewWidth)\r\n return;\r\n var width = Number(video.dataset.width);\r\n var height = Number(video.dataset.height);\r\n if (!width || !height || width < height) {\r\n width = viewWidth;\r\n height = viewWidth;\r\n }\r\n else {\r\n height = (viewWidth / width) * height;\r\n width = viewWidth;\r\n }\r\n video.style.width = width + \"px\";\r\n video.style.height = height + \"px\";\r\n });\r\n}\r\nwindow.pageHiddenReceiver = function (data) {\r\n document.querySelectorAll('video,audio').forEach(function (media) {\r\n media.pause();\r\n });\r\n};\r\nfunction fixSize() {\r\n fixImageSize();\r\n fixVideoSize();\r\n}\r\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNC5qcyIsInNvdXJjZXMiOlsid2VicGFjazovLy8uL3NyYy9jb21tb24udHM/ODA0OSJdLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgZnVuY3Rpb24gZ2V0Vmlld0VsZW1lbnQoKSB7XG4gIHJldHVybiBkb2N1bWVudC5xdWVyeVNlbGVjdG9yPEhUTUxEaXZFbGVtZW50PignZGl2LnFsLWVkaXRvcicpXG59XG5cbmV4cG9ydCBmdW5jdGlvbiBnZXRWaWV3V2lkdGgoKSB7XG4gIGNvbnN0IHZpZXcgPSBnZXRWaWV3RWxlbWVudCgpXG5cbiAgaWYgKHZpZXcpIHtcbiAgICBsZXQgd2lkdGggPSB2aWV3LmNsaWVudFdpZHRoXG4gICAgY29uc3Qgc3R5bGUgPSBnZXRDb21wdXRlZFN0eWxlKHZpZXcpXG5cbiAgICBpZiAoc3R5bGUucGFkZGluZ0xlZnQpIHtcbiAgICAgIHdpZHRoIC09IHBhcnNlRmxvYXQoc3R5bGUucGFkZGluZ0xlZnQpXG4gICAgfVxuXG4gICAgaWYgKHN0eWxlLnBhZGRpbmdSaWdodCkge1xuICAgICAgd2lkdGggLT0gcGFyc2V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0FBQ0E7QUFFQTtBQUNBO0FBRUE7QUFDQTtBQUFBO0FBRUE7QUFDQTtBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQUE7QUFDQTtBQUNBO0FBQ0E7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFFQTtBQUNBO0FBQ0E7QUFDQTsiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///4\n")},function(module,exports,__webpack_require__){eval("(function (factory) {\n if (true) {\n // Node/CommonJS\n module.exports = factory();\n } else { var glob; }\n}(function (undefined) {\n\n 'use strict';\n\n /*\n * Fastest md5 implementation around (JKM md5).\n * Credits: Joseph Myers\n *\n * @see http://www.myersdaily.org/joseph/javascript/md5-text.html\n * @see http://jsperf.com/md5-shootout/7\n */\n\n /* this function is much faster,\n so if possible we use it. Some IEs\n are the only ones I know of that\n need the idiotic second function,\n generated by an if clause. */\n var add32 = function (a, b) {\n return (a + b) & 0xFFFFFFFF;\n },\n hex_chr = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'];\n\n\n function cmn(q, a, b, x, s, t) {\n a = add32(add32(a, q), add32(x, t));\n return add32((a << s) | (a >>> (32 - s)), b);\n }\n\n function md5cycle(x, k) {\n var a = x[0],\n b = x[1],\n c = x[2],\n d = x[3];\n\n a += (b & c | ~b & d) + k[0] - 680876936 | 0;\n a = (a << 7 | a >>> 25) + b | 0;\n d += (a & b | ~a & c) + k[1] - 389564586 | 0;\n d = (d << 12 | d >>> 20) + a | 0;\n c += (d & a | ~d & b) + k[2] + 606105819 | 0;\n c = (c << 17 | c >>> 15) + d | 0;\n b += (c & d | ~c & a) + k[3] - 1044525330 | 0;\n b = (b << 22 | b >>> 10) + c | 0;\n a += (b & c | ~b & d) + k[4] - 176418897 | 0;\n a = (a << 7 | a >>> 25) + b | 0;\n d += (a & b | ~a & c) + k[5] + 1200080426 | 0;\n d = (d << 12 | d >>> 20) + a | 0;\n c += (d & a | ~d & b) + k[6] - 1473231341 | 0;\n c = (c << 17 | c >>> 15) + d | 0;\n b += (c & d | ~c & a) + k[7] - 45705983 | 0;\n b = (b << 22 | b >>> 10) + c | 0;\n a += (b & c | ~b & d) + k[8] + 1770035416 | 0;\n a = (a << 7 | a >>> 25) + b | 0;\n d += (a & b | ~a & c) + k[9] - 1958414417 | 0;\n d = (d << 12 | d >>> 20) + a | 0;\n c += (d & a | ~d & b) + k[10] - 42063 | 0;\n c = (c << 17 | c >>> 15) + d | 0;\n b += (c & d | ~c & a) + k[11] - 1990404162 | 0;\n b = (b << 22 | b >>> 10) + c | 0;\n a += (b & c | ~b & d) + k[12] + 1804603682 | 0;\n a = (a << 7 | a >>> 25) + b | 0;\n d += (a & b | ~a & c) + k[13] - 40341101 | 0;\n d = (d << 12 | d >>> 20) + a | 0;\n c += (d & a | ~d & b) + k[14] - 1502002290 | 0;\n c = (c << 17 | c >>> 15) + d | 0;\n b += (c & d | ~c & a) + k[15] + 1236535329 | 0;\n b = (b << 22 | b >>> 10) + c | 0;\n\n a += (b & d | c & ~d) + k[1] - 165796510 | 0;\n a = (a << 5 | a >>> 27) + b | 0;\n d += (a & c | b & ~c) + k[6] - 1069501632 | 0;\n d = (d << 9 | d >>> 23) + a | 0;\n c += (d & b | a & ~b) + k[11] + 643717713 | 0;\n c = (c << 14 | c >>> 18) + d | 0;\n b += (c & a | d & ~a) + k[0] - 373897302 | 0;\n b = (b << 20 | b >>> 12) + c | 0;\n a += (b & d | c & ~d) + k[5] - 701558691 | 0;\n a = (a << 5 | a >>> 27) + b | 0;\n d += (a & c | b & ~c) + k[10] + 38016083 | 0;\n d = (d << 9 | d >>> 23) + a | 0;\n c += (d & b | a & ~b) + k[15] - 660478335 | 0;\n c = (c << 14 | c >>> 18) + d | 0;\n b += (c & a | d & ~a) + k[4] - 405537848 | 0;\n b = (b << 20 | b >>> 12) + c | 0;\n a += (b & d | c & ~d) + k[9] + 568446438 | 0;\n a = (a << 5 | a >>> 27) + b | 0;\n d += (a & c | b & ~c) + k[14] - 1019803690 | 0;\n d = (d << 9 | d >>> 23) + a | 0;\n c += (d & b | a & ~b) + k[3] - 187363961 | 0;\n c = (c << 14 | c >>> 18) + d | 0;\n b += (c & a | d & ~a) + k[8] + 1163531501 | 0;\n b = (b << 20 | b >>> 12) + c | 0;\n a += (b & d | c & ~d) + k[13] - 1444681467 | 0;\n a = (a << 5 | a >>> 27) + b | 0;\n d += (a & c | b & ~c) + k[2] - 51403784 | 0;\n d = (d << 9 | d >>> 23) + a | 0;\n c += (d & b | a & ~b) + k[7] + 1735328473 | 0;\n c = (c << 14 | c >>> 18) + d | 0;\n b += (c & a | d & ~a) + k[12] - 1926607734 | 0;\n b = (b << 20 | b >>> 12) + c | 0;\n\n a += (b ^ c ^ d) + k[5] - 378558 | 0;\n a = (a << 4 | a >>> 28) + b | 0;\n d += (a ^ b ^ c) + k[8] - 2022574463 | 0;\n d = (d << 11 | d >>> 21) + a | 0;\n c += (d ^ a ^ b) + k[11] + 1839030562 | 0;\n c = (c << 16 | c >>> 16) + d | 0;\n b += (c ^ d ^ a) + k[14] - 35309556 | 0;\n b = (b << 23 | b >>> 9) + c | 0;\n a += (b ^ c ^ d) + k[1] - 1530992060 | 0;\n a = (a << 4 | a >>> 28) + b | 0;\n d += (a ^ b ^ c) + k[4] + 1272893353 | 0;\n d = (d << 11 | d >>> 21) + a | 0;\n c += (d ^ a ^ b) + k[7] - 155497632 | 0;\n c = (c << 16 | c >>> 16) + d | 0;\n b += (c ^ d ^ a) + k[10] - 1094730640 | 0;\n b = (b << 23 | b >>> 9) + c | 0;\n a += (b ^ c ^ d) + k[13] + 681279174 | 0;\n a = (a << 4 | a >>> 28) + b | 0;\n d += (a ^ b ^ c) + k[0] - 358537222 | 0;\n d = (d << 11 | d >>> 21) + a | 0;\n c += (d ^ a ^ b) + k[3] - 722521979 | 0;\n c = (c << 16 | c >>> 16) + d | 0;\n b += (c ^ d ^ a) + k[6] + 76029189 | 0;\n b = (b << 23 | b >>> 9) + c | 0;\n a += (b ^ c ^ d) + k[9] - 640364487 | 0;\n a = (a << 4 | a >>> 28) + b | 0;\n d += (a ^ b ^ c) + k[12] - 421815835 | 0;\n d = (d << 11 | d >>> 21) + a | 0;\n c += (d ^ a ^ b) + k[15] + 530742520 | 0;\n c = (c << 16 | c >>> 16) + d | 0;\n b += (c ^ d ^ a) + k[2] - 995338651 | 0;\n b = (b << 23 | b >>> 9) + c | 0;\n\n a += (c ^ (b | ~d)) + k[0] - 198630844 | 0;\n a = (a << 6 | a >>> 26) + b | 0;\n d += (b ^ (a | ~c)) + k[7] + 1126891415 | 0;\n d = (d << 10 | d >>> 22) + a | 0;\n c += (a ^ (d | ~b)) + k[14] - 1416354905 | 0;\n c = (c << 15 | c >>> 17) + d | 0;\n b += (d ^ (c | ~a)) + k[5] - 57434055 | 0;\n b = (b << 21 |b >>> 11) + c | 0;\n a += (c ^ (b | ~d)) + k[12] + 1700485571 | 0;\n a = (a << 6 | a >>> 26) + b | 0;\n d += (b ^ (a | ~c)) + k[3] - 1894986606 | 0;\n d = (d << 10 | d >>> 22) + a | 0;\n c += (a ^ (d | ~b)) + k[10] - 1051523 | 0;\n c = (c << 15 | c >>> 17) + d | 0;\n b += (d ^ (c | ~a)) + k[1] - 2054922799 | 0;\n b = (b << 21 |b >>> 11) + c | 0;\n a += (c ^ (b | ~d)) + k[8] + 1873313359 | 0;\n a = (a << 6 | a >>> 26) + b | 0;\n d += (b ^ (a | ~c)) + k[15] - 30611744 | 0;\n d = (d << 10 | d >>> 22) + a | 0;\n c += (a ^ (d | ~b)) + k[6] - 1560198380 | 0;\n c = (c << 15 | c >>> 17) + d | 0;\n b += (d ^ (c | ~a)) + k[13] + 1309151649 | 0;\n b = (b << 21 |b >>> 11) + c | 0;\n a += (c ^ (b | ~d)) + k[4] - 145523070 | 0;\n a = (a << 6 | a >>> 26) + b | 0;\n d += (b ^ (a | ~c)) + k[11] - 1120210379 | 0;\n d = (d << 10 | d >>> 22) + a | 0;\n c += (a ^ (d | ~b)) + k[2] + 718787259 | 0;\n c = (c << 15 | c >>> 17) + d | 0;\n b += (d ^ (c | ~a)) + k[9] - 343485551 | 0;\n b = (b << 21 | b >>> 11) + c | 0;\n\n x[0] = a + x[0] | 0;\n x[1] = b + x[1] | 0;\n x[2] = c + x[2] | 0;\n x[3] = d + x[3] | 0;\n }\n\n function md5blk(s) {\n var md5blks = [],\n i; /* Andy King said do it this way. */\n\n for (i = 0; i < 64; i += 4) {\n md5blks[i >> 2] = s.charCodeAt(i) + (s.charCodeAt(i + 1) << 8) + (s.charCodeAt(i + 2) << 16) + (s.charCodeAt(i + 3) << 24);\n }\n return md5blks;\n }\n\n function md5blk_array(a) {\n var md5blks = [],\n i; /* Andy King said do it this way. */\n\n for (i = 0; i < 64; i += 4) {\n md5blks[i >> 2] = a[i] + (a[i + 1] << 8) + (a[i + 2] << 16) + (a[i + 3] << 24);\n }\n return md5blks;\n }\n\n function md51(s) {\n var n = s.length,\n state = [1732584193, -271733879, -1732584194, 271733878],\n i,\n length,\n tail,\n tmp,\n lo,\n hi;\n\n for (i = 64; i <= n; i += 64) {\n md5cycle(state, md5blk(s.substring(i - 64, i)));\n }\n s = s.substring(i - 64);\n length = s.length;\n tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];\n for (i = 0; i < length; i += 1) {\n tail[i >> 2] |= s.charCodeAt(i) << ((i % 4) << 3);\n }\n tail[i >> 2] |= 0x80 << ((i % 4) << 3);\n if (i > 55) {\n md5cycle(state, tail);\n for (i = 0; i < 16; i += 1) {\n tail[i] = 0;\n }\n }\n\n // Beware that the final length might not fit in 32 bits so we take care of that\n tmp = n * 8;\n tmp = tmp.toString(16).match(/(.*?)(.{0,8})$/);\n lo = parseInt(tmp[2], 16);\n hi = parseInt(tmp[1], 16) || 0;\n\n tail[14] = lo;\n tail[15] = hi;\n\n md5cycle(state, tail);\n return state;\n }\n\n function md51_array(a) {\n var n = a.length,\n state = [1732584193, -271733879, -1732584194, 271733878],\n i,\n length,\n tail,\n tmp,\n lo,\n hi;\n\n for (i = 64; i <= n; i += 64) {\n md5cycle(state, md5blk_array(a.subarray(i - 64, i)));\n }\n\n // Not sure if it is a bug, however IE10 will always produce a sub array of length 1\n // containing the last element of the parent array if the sub array specified starts\n // beyond the length of the parent array - weird.\n // https://connect.microsoft.com/IE/feedback/details/771452/typed-array-subarray-issue\n a = (i - 64) < n ? a.subarray(i - 64) : new Uint8Array(0);\n\n length = a.length;\n tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];\n for (i = 0; i < length; i += 1) {\n tail[i >> 2] |= a[i] << ((i % 4) << 3);\n }\n\n tail[i >> 2] |= 0x80 << ((i % 4) << 3);\n if (i > 55) {\n md5cycle(state, tail);\n for (i = 0; i < 16; i += 1) {\n tail[i] = 0;\n }\n }\n\n // Beware that the final length might not fit in 32 bits so we take care of that\n tmp = n * 8;\n tmp = tmp.toString(16).match(/(.*?)(.{0,8})$/);\n lo = parseInt(tmp[2], 16);\n hi = parseInt(tmp[1], 16) || 0;\n\n tail[14] = lo;\n tail[15] = hi;\n\n md5cycle(state, tail);\n\n return state;\n }\n\n function rhex(n) {\n var s = '',\n j;\n for (j = 0; j < 4; j += 1) {\n s += hex_chr[(n >> (j * 8 + 4)) & 0x0F] + hex_chr[(n >> (j * 8)) & 0x0F];\n }\n return s;\n }\n\n function hex(x) {\n var i;\n for (i = 0; i < x.length; i += 1) {\n x[i] = rhex(x[i]);\n }\n return x.join('');\n }\n\n // In some cases the fast add32 function cannot be used..\n if (hex(md51('hello')) !== '5d41402abc4b2a76b9719d911017c592') {\n add32 = function (x, y) {\n var lsw = (x & 0xFFFF) + (y & 0xFFFF),\n msw = (x >> 16) + (y >> 16) + (lsw >> 16);\n return (msw << 16) | (lsw & 0xFFFF);\n };\n }\n\n // ---------------------------------------------------\n\n /**\n * ArrayBuffer slice polyfill.\n *\n * @see https://github.com/ttaubert/node-arraybuffer-slice\n */\n\n if (typeof ArrayBuffer !== 'undefined' && !ArrayBuffer.prototype.slice) {\n (function () {\n function clamp(val, length) {\n val = (val | 0) || 0;\n\n if (val < 0) {\n return Math.max(val + length, 0);\n }\n\n return Math.min(val, length);\n }\n\n ArrayBuffer.prototype.slice = function (from, to) {\n var length = this.byteLength,\n begin = clamp(from, length),\n end = length,\n num,\n target,\n targetArray,\n sourceArray;\n\n if (to !== undefined) {\n end = clamp(to, length);\n }\n\n if (begin > end) {\n return new ArrayBuffer(0);\n }\n\n num = end - begin;\n target = new ArrayBuffer(num);\n targetArray = new Uint8Array(target);\n\n sourceArray = new Uint8Array(this, begin, num);\n targetArray.set(sourceArray);\n\n return target;\n };\n })();\n }\n\n // ---------------------------------------------------\n\n /**\n * Helpers.\n */\n\n function toUtf8(str) {\n if (/[\\u0080-\\uFFFF]/.test(str)) {\n str = unescape(encodeURIComponent(str));\n }\n\n return str;\n }\n\n function utf8Str2ArrayBuffer(str, returnUInt8Array) {\n var length = str.length,\n buff = new ArrayBuffer(length),\n arr = new Uint8Array(buff),\n i;\n\n for (i = 0; i < length; i += 1) {\n arr[i] = str.charCodeAt(i);\n }\n\n return returnUInt8Array ? arr : buff;\n }\n\n function arrayBuffer2Utf8Str(buff) {\n return String.fromCharCode.apply(null, new Uint8Array(buff));\n }\n\n function concatenateArrayBuffers(first, second, returnUInt8Array) {\n var result = new Uint8Array(first.byteLength + second.byteLength);\n\n result.set(new Uint8Array(first));\n result.set(new Uint8Array(second), first.byteLength);\n\n return returnUInt8Array ? result : result.buffer;\n }\n\n function hexToBinaryString(hex) {\n var bytes = [],\n length = hex.length,\n x;\n\n for (x = 0; x < length - 1; x += 2) {\n bytes.push(parseInt(hex.substr(x, 2), 16));\n }\n\n return String.fromCharCode.apply(String, bytes);\n }\n\n // ---------------------------------------------------\n\n /**\n * SparkMD5 OOP implementation.\n *\n * Use this class to perform an incremental md5, otherwise use the\n * static methods instead.\n */\n\n function SparkMD5() {\n // call reset to init the instance\n this.reset();\n }\n\n /**\n * Appends a string.\n * A conversion will be applied if an utf8 string is detected.\n *\n * @param {String} str The string to be appended\n *\n * @return {SparkMD5} The instance itself\n */\n SparkMD5.prototype.append = function (str) {\n // Converts the string to utf8 bytes if necessary\n // Then append as binary\n this.appendBinary(toUtf8(str));\n\n return this;\n };\n\n /**\n * Appends a binary string.\n *\n * @param {String} contents The binary string to be appended\n *\n * @return {SparkMD5} The instance itself\n */\n SparkMD5.prototype.appendBinary = function (contents) {\n this._buff += contents;\n this._length += contents.length;\n\n var length = this._buff.length,\n i;\n\n for (i = 64; i <= length; i += 64) {\n md5cycle(this._hash, md5blk(this._buff.substring(i - 64, i)));\n }\n\n this._buff = this._buff.substring(i - 64);\n\n return this;\n };\n\n /**\n * Finishes the incremental computation, reseting the internal state and\n * returning the result.\n *\n * @param {Boolean} raw True to get the raw string, false to get the hex string\n *\n * @return {String} The result\n */\n SparkMD5.prototype.end = function (raw) {\n var buff = this._buff,\n length = buff.length,\n i,\n tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n ret;\n\n for (i = 0; i < length; i += 1) {\n tail[i >> 2] |= buff.charCodeAt(i) << ((i % 4) << 3);\n }\n\n this._finish(tail, length);\n ret = hex(this._hash);\n\n if (raw) {\n ret = hexToBinaryString(ret);\n }\n\n this.reset();\n\n return ret;\n };\n\n /**\n * Resets the internal state of the computation.\n *\n * @return {SparkMD5} The instance itself\n */\n SparkMD5.prototype.reset = function () {\n this._buff = '';\n this._length = 0;\n this._hash = [1732584193, -271733879, -1732584194, 271733878];\n\n return this;\n };\n\n /**\n * Gets the internal state of the computation.\n *\n * @return {Object} The state\n */\n SparkMD5.prototype.getState = function () {\n return {\n buff: this._buff,\n length: this._length,\n hash: this._hash\n };\n };\n\n /**\n * Gets the internal state of the computation.\n *\n * @param {Object} state The state\n *\n * @return {SparkMD5} The instance itself\n */\n SparkMD5.prototype.setState = function (state) {\n this._buff = state.buff;\n this._length = state.length;\n this._hash = state.hash;\n\n return this;\n };\n\n /**\n * Releases memory used by the incremental buffer and other additional\n * resources. If you plan to use the instance again, use reset instead.\n */\n SparkMD5.prototype.destroy = function () {\n delete this._hash;\n delete this._buff;\n delete this._length;\n };\n\n /**\n * Finish the final calculation based on the tail.\n *\n * @param {Array} tail The tail (will be modified)\n * @param {Number} length The length of the remaining buffer\n */\n SparkMD5.prototype._finish = function (tail, length) {\n var i = length,\n tmp,\n lo,\n hi;\n\n tail[i >> 2] |= 0x80 << ((i % 4) << 3);\n if (i > 55) {\n md5cycle(this._hash, tail);\n for (i = 0; i < 16; i += 1) {\n tail[i] = 0;\n }\n }\n\n // Do the final computation based on the tail and length\n // Beware that the final length may not fit in 32 bits so we take care of that\n tmp = this._length * 8;\n tmp = tmp.toString(16).match(/(.*?)(.{0,8})$/);\n lo = parseInt(tmp[2], 16);\n hi = parseInt(tmp[1], 16) || 0;\n\n tail[14] = lo;\n tail[15] = hi;\n md5cycle(this._hash, tail);\n };\n\n /**\n * Performs the md5 hash on a string.\n * A conversion will be applied if utf8 string is detected.\n *\n * @param {String} str The string\n * @param {Boolean} raw True to get the raw string, false to get the hex string\n *\n * @return {String} The result\n */\n SparkMD5.hash = function (str, raw) {\n // Converts the string to utf8 bytes if necessary\n // Then compute it using the binary function\n return SparkMD5.hashBinary(toUtf8(str), raw);\n };\n\n /**\n * Performs the md5 hash on a binary string.\n *\n * @param {String} content The binary string\n * @param {Boolean} raw True to get the raw string, false to get the hex string\n *\n * @return {String} The result\n */\n SparkMD5.hashBinary = function (content, raw) {\n var hash = md51(content),\n ret = hex(hash);\n\n return raw ? hexToBinaryString(ret) : ret;\n };\n\n // ---------------------------------------------------\n\n /**\n * SparkMD5 OOP implementation for array buffers.\n *\n * Use this class to perform an incremental md5 ONLY for array buffers.\n */\n SparkMD5.ArrayBuffer = function () {\n // call reset to init the instance\n this.reset();\n };\n\n /**\n * Appends an array buffer.\n *\n * @param {ArrayBuffer} arr The array to be appended\n *\n * @return {SparkMD5.ArrayBuffer} The instance itself\n */\n SparkMD5.ArrayBuffer.prototype.append = function (arr) {\n var buff = concatenateArrayBuffers(this._buff.buffer, arr, true),\n length = buff.length,\n i;\n\n this._length += arr.byteLength;\n\n for (i = 64; i <= length; i += 64) {\n md5cycle(this._hash, md5blk_array(buff.subarray(i - 64, i)));\n }\n\n this._buff = (i - 64) < length ? new Uint8Array(buff.buffer.slice(i - 64)) : new Uint8Array(0);\n\n return this;\n };\n\n /**\n * Finishes the incremental computation, reseting the internal state and\n * returning the result.\n *\n * @param {Boolean} raw True to get the raw string, false to get the hex string\n *\n * @return {String} The result\n */\n SparkMD5.ArrayBuffer.prototype.end = function (raw) {\n var buff = this._buff,\n length = buff.length,\n tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n i,\n ret;\n\n for (i = 0; i < length; i += 1) {\n tail[i >> 2] |= buff[i] << ((i % 4) << 3);\n }\n\n this._finish(tail, length);\n ret = hex(this._hash);\n\n if (raw) {\n ret = hexToBinaryString(ret);\n }\n\n this.reset();\n\n return ret;\n };\n\n /**\n * Resets the internal state of the computation.\n *\n * @return {SparkMD5.ArrayBuffer} The instance itself\n */\n SparkMD5.ArrayBuffer.prototype.reset = function () {\n this._buff = new Uint8Array(0);\n this._length = 0;\n this._hash = [1732584193, -271733879, -1732584194, 271733878];\n\n return this;\n };\n\n /**\n * Gets the internal state of the computation.\n *\n * @return {Object} The state\n */\n SparkMD5.ArrayBuffer.prototype.getState = function () {\n var state = SparkMD5.prototype.getState.call(this);\n\n // Convert buffer to a string\n state.buff = arrayBuffer2Utf8Str(state.buff);\n\n return state;\n };\n\n /**\n * Gets the internal state of the computation.\n *\n * @param {Object} state The state\n *\n * @return {SparkMD5.ArrayBuffer} The instance itself\n */\n SparkMD5.ArrayBuffer.prototype.setState = function (state) {\n // Convert string to buffer\n state.buff = utf8Str2ArrayBuffer(state.buff, true);\n\n return SparkMD5.prototype.setState.call(this, state);\n };\n\n SparkMD5.ArrayBuffer.prototype.destroy = SparkMD5.prototype.destroy;\n\n SparkMD5.ArrayBuffer.prototype._finish = SparkMD5.prototype._finish;\n\n /**\n * Performs the md5 hash on an array buffer.\n *\n * @param {ArrayBuffer} arr The array buffer\n * @param {Boolean} raw True to get the raw string, false to get the hex one\n *\n * @return {String} The result\n */\n SparkMD5.ArrayBuffer.hash = function (arr, raw) {\n var hash = md51_array(new Uint8Array(arr)),\n ret = hex(hash);\n\n return raw ? hexToBinaryString(ret) : ret;\n };\n\n return SparkMD5;\n}));\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNS5qcyIsInNvdXJjZXMiOlsid2VicGFjazovLy8uL25vZGVfbW9kdWxlcy9zcGFyay1tZDUvc3BhcmstbWQ1LmpzPzY5YTAiXSwic291cmNlc0NvbnRlbnQiOlsiKGZ1bmN0aW9uIChmYWN0b3J5KSB7XG4gICAgaWYgKHR5cGVvZiBleHBvcnRzID09PSAnb2JqZWN0Jykge1xuICAgICAgICAvLyBOb2RlL0NvbW1vbkpTXG4gICAgICAgIG1vZHVsZS5leHBvcnRzID0gZmFjdG9yeSgpO1xuICAgIH0gZWxzZSBpZiAodHlwZW9mIGRlZmluZSA9PT0gJ2Z1bmN0aW9uJyAmJiBkZWZpbmUuYW1kKSB7XG4gICAgICAgIC8vIEFNRFxuICAgICAgICBkZWZpbmUoZmFjdG9yeSk7XG4gICAgfSBlbHNlIHtcbiAgICAgICAgLy8gQnJvd3NlciBnbG9iYWxzICh3aXRoIHN1cHBvcnQgZm9yIHdlYiB3b3JrZXJzKVxuICAgICAgICB2YXIgZ2xvYjtcblxuICAgICAgICB0cnkge1xuICAgICAgICAgICAgZ2xvYiA9IHdpbmRvdztcbiAgICAgICAgfSBjYXRjaCAoZSkge1xuICAgICAgICAgICAgZ2xvYiA9IHNlbGY7XG4gICAgICAgIH1cblxu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XG5cbiAgICBpZiAodHlwZW9mIEFycmF5QnVmZmVyICE9PSAndW5kZWZpbmVkJyAmJiAhQXJyYXlCdWZmZXIucHJvdG90eXBlLnNsaWNlKSB7XG4gICAgICAgIChmdW5jdGlvbiAoKSB7XG4gICAgICAgICAgICBmdW5jdGlvbiBjbGFtcCh2YWwsIGxlbmd0aCkge1xuICAgICAgICAgICAgICAgIHZhbCA9ICh2YWwgfCAwKSB8fCAwO1xuXG4gICAgICAgICAgICAgICAgaWYgKHZhbCA8IDApIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE1hdGgubWF4KHZhbCArIGxlbmd0aCwgMCk7XG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgcmV0dXJuIE1hdGgubWluKHZhbCwgbGVuZ3RoKTtcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgQXJyYXlCdWZmZXIucHJvdG90eXBlLnNsaWNlID0gZnVuY3Rpb24gKGZyb20sIHRvKSB7XG4gICAgICAgICAgICAgICAgdmFyIGxlbmd0aCA9IHRoaXMuYnl0ZUxlbmd0aCxcbiAgICAgICAgICAgICAgICAgICAgYmVnaW4gPSBjbGFtcChmcm9tLCBsZW5ndGgpLFxuICAgICAgICAgICAgICAgICAgICBlbmQgPSBsZW5ndGgsXG4gICAgICAgICAgICAgICAgICAgIG51bSxcbiAgICAgICAgICAgICAgICAgICAgdGFyZ2V0LFxuICAgICAgICAgICAgICAgICAgICB0YXJnZXRBcnJheSxcbiAgICAgICAgICAgICAgICAgICAgc291cmNlQXJyYXk7XG5cbiAgICAgICAgICAgICAgICBpZiAodG8gIT09IHVuZGVmaW5lZCkge1xuICAgICAgICAgICAgICAgICAgICBlbmQgPSBjbGFtcCh0bywgbGVuZ3RoKTtcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICBpZiAoYmVnaW4gPiBlbmQpIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG5ldyBBcnJheUJ1ZmZlcigwKTtcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICBudW0gPSBlbmQgLSBiZWdpbjtcbiAgICAgICAgICAgICAgICB0YXJnZXQgPSBuZXcgQXJyYXlCdWZmZXIobnVtKTtcbiAgICAgICAgICAgICAgICB0YXJnZXRBcnJheSA9IG5ldyBVaW50OEFycmF5KHRhcmdldCk7XG5cbiAgICAgICAgICAgICAgICBzb3VyY2VBcnJheSA9IG5ldyBVaW50OEFycmF5KHRoaXMsIGJlZ2luLCBudW0pO1xuICAgICAgICAgICAgICAgIHRhcmdldEFycmF5LnNldChzb3VyY2VBcnJheSk7XG5cbiAgICAgICAgICAgICAgICByZXR1cm4gdGFyZ2V0O1xuICAgICAgICAgICAgfTtcbiAgICAgICAgfSkoKTtcbiAgICB9XG5cbiAgICAvLyAtLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS1cblxuICAgIC8qKlxuICAgICAqIEhlbHBlcnMuXG4gICAgICovXG5cbiAgICBmdW5jdGlvbiB0b1V0Zjgoc3RyKSB7XG4gICAgICAgIGlmICgvW1xcdTAwODAtXFx1RkZGRl0vLnRlc3Qoc3RyKSkge1xuICAgICAgICAgICAgc3RyID0gdW5lc2NhcGUoZW5jb2RlVVJJQ29tcG9uZW50KHN0cikpO1xuICAgICAgICB9XG5cbiAgICAgICAgcmV0dXJuIHN0cjtcbiAgICB9XG5cbiAgICBmdW5jdGlvbiB1dGY4U3RyMkFycmF5QnVmZmVyKHN0ciwgcmV0dXJuVUludDhBcnJheSkge1xuICAgICAgICB2YXIgbGVuZ3RoID0gc3RyLmxlbmd0aCxcbiAgICAgICAgICAgYnVmZiA9IG5ldyBBcnJheUJ1ZmZlcihsZW5ndGgpLFxuICAgICAgICAgICBhcnIgPSBuZXcgVWludDhBcnJheShidWZmKSxcbiAgICAgICAgICAgaTtcblxuICAgICAgICBmb3IgKGkgPSAwOyBpIDwgbGVuZ3R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7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTsiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///5\n")},function(module,exports,__webpack_require__){"use strict";eval("\n\nmodule.exports = function bind(fn, thisArg) {\n return function wrap() {\n var args = new Array(arguments.length);\n for (var i = 0; i < args.length; i++) {\n args[i] = arguments[i];\n }\n return fn.apply(thisArg, args);\n };\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNi5qcyIsInNvdXJjZXMiOlsid2VicGFjazovLy8uL25vZGVfbW9kdWxlcy9heGlvcy9saWIvaGVscGVycy9iaW5kLmpzPzFkMmIiXSwic291cmNlc0NvbnRlbnQiOlsiJ3VzZSBzdHJpY3QnO1xuXG5tb2R1bGUuZXhwb3J0cyA9IGZ1bmN0aW9uIGJpbmQoZm4sIHRoaXNBcmcpIHtcbiAgcmV0dXJuIGZ1bmN0aW9uIHdyYXAoKSB7XG4gICAgdmFyIGFyZ3MgPSBuZXcgQXJyYXkoYXJndW1lbnRzLmxlbmd0aCk7XG4gICAgZm9yICh2YXIgaSA9IDA7IGkgPCBhcmdzLmxlbmd0aDsgaSsrKSB7XG4gICAgICBhcmdzW2ldID0gYXJndW1lbnRzW2ldO1xuICAgIH1cbiAgICByZXR1cm4gZm4uYXBwbHkodGhpc0FyZywgYXJncyk7XG4gIH07XG59O1xuIl0sIm1hcHBpbmdzIjoiQUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOyIsInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///6\n")},function(module,exports,__webpack_require__){"use strict";eval("\n\nvar utils = __webpack_require__(0);\n\nfunction encode(val) {\n return encodeURIComponent(val).\n replace(/%40/gi, '@').\n replace(/%3A/gi, ':').\n replace(/%24/g, '$').\n replace(/%2C/gi, ',').\n replace(/%20/g, '+').\n replace(/%5B/gi, '[').\n replace(/%5D/gi, ']');\n}\n\n/**\n * Build a URL by appending params to the end\n *\n * @param {string} url The base of the url (e.g., http://www.google.com)\n * @param {object} [params] The params to be appended\n * @returns {string} The formatted url\n */\nmodule.exports = function buildURL(url, params, paramsSerializer) {\n /*eslint no-param-reassign:0*/\n if (!params) {\n return url;\n }\n\n var serializedParams;\n if (paramsSerializer) {\n serializedParams = paramsSerializer(params);\n } else if (utils.isURLSearchParams(params)) {\n serializedParams = params.toString();\n } else {\n var parts = [];\n\n utils.forEach(params, function serialize(val, key) {\n if (val === null || typeof val === 'undefined') {\n return;\n }\n\n if (utils.isArray(val)) {\n key = key + '[]';\n } else {\n val = [val];\n }\n\n utils.forEach(val, function parseValue(v) {\n if (utils.isDate(v)) {\n v = v.toISOString();\n } else if (utils.isObject(v)) {\n v = JSON.stringify(v);\n }\n parts.push(encode(key) + '=' + encode(v));\n });\n });\n\n serializedParams = parts.join('&');\n }\n\n if (serializedParams) {\n var hashmarkIndex = url.indexOf('#');\n if (hashmarkIndex !== -1) {\n url = url.slice(0, hashmarkIndex);\n }\n\n url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;\n }\n\n return url;\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNy5qcyIsInNvdXJjZXMiOlsid2VicGFjazovLy8uL25vZGVfbW9kdWxlcy9heGlvcy9saWIvaGVscGVycy9idWlsZFVSTC5qcz8zMGI1Il0sInNvdXJjZXNDb250ZW50IjpbIid1c2Ugc3RyaWN0JztcblxudmFyIHV0aWxzID0gcmVxdWlyZSgnLi8uLi91dGlscycpO1xuXG5mdW5jdGlvbiBlbmNvZGUodmFsKSB7XG4gIHJldHVybiBlbmNvZGVVUklDb21wb25lbnQodmFsKS5cbiAgICByZXBsYWNlKC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7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOyIsInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///7\n")},function(module,exports,__webpack_require__){"use strict";eval("\n\nmodule.exports = function isCancel(value) {\n return !!(value && value.__CANCEL__);\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiOC5qcyIsInNvdXJjZXMiOlsid2VicGFjazovLy8uL25vZGVfbW9kdWxlcy9heGlvcy9saWIvY2FuY2VsL2lzQ2FuY2VsLmpzPzJlNjciXSwic291cmNlc0NvbnRlbnQiOlsiJ3VzZSBzdHJpY3QnO1xuXG5tb2R1bGUuZXhwb3J0cyA9IGZ1bmN0aW9uIGlzQ2FuY2VsKHZhbHVlKSB7XG4gIHJldHVybiAhISh2YWx1ZSAmJiB2YWx1ZS5fX0NBTkNFTF9fKTtcbn07XG4iXSwibWFwcGluZ3MiOiJBQUFBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7Iiwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///8\n")},function(module,exports,__webpack_require__){"use strict";eval("/* WEBPACK VAR INJECTION */(function(process) {\n\nvar utils = __webpack_require__(0);\nvar normalizeHeaderName = __webpack_require__(25);\n\nvar DEFAULT_CONTENT_TYPE = {\n 'Content-Type': 'application/x-www-form-urlencoded'\n};\n\nfunction setContentTypeIfUnset(headers, value) {\n if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) {\n headers['Content-Type'] = value;\n }\n}\n\nfunction getDefaultAdapter() {\n var adapter;\n // Only Node.JS has a process variable that is of [[Class]] process\n if (typeof process !== 'undefined' && Object.prototype.toString.call(process) === '[object process]') {\n // For node use HTTP adapter\n adapter = __webpack_require__(10);\n } else if (typeof XMLHttpRequest !== 'undefined') {\n // For browsers use XHR adapter\n adapter = __webpack_require__(10);\n }\n return adapter;\n}\n\nvar defaults = {\n adapter: getDefaultAdapter(),\n\n transformRequest: [function transformRequest(data, headers) {\n normalizeHeaderName(headers, 'Accept');\n normalizeHeaderName(headers, 'Content-Type');\n if (utils.isFormData(data) ||\n utils.isArrayBuffer(data) ||\n utils.isBuffer(data) ||\n utils.isStream(data) ||\n utils.isFile(data) ||\n utils.isBlob(data)\n ) {\n return data;\n }\n if (utils.isArrayBufferView(data)) {\n return data.buffer;\n }\n if (utils.isURLSearchParams(data)) {\n setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8');\n return data.toString();\n }\n if (utils.isObject(data)) {\n setContentTypeIfUnset(headers, 'application/json;charset=utf-8');\n return JSON.stringify(data);\n }\n return data;\n }],\n\n transformResponse: [function transformResponse(data) {\n /*eslint no-param-reassign:0*/\n if (typeof data === 'string') {\n try {\n data = JSON.parse(data);\n } catch (e) { /* Ignore */ }\n }\n return data;\n }],\n\n /**\n * A timeout in milliseconds to abort a request. If set to 0 (default) a\n * timeout is not created.\n */\n timeout: 0,\n\n xsrfCookieName: 'XSRF-TOKEN',\n xsrfHeaderName: 'X-XSRF-TOKEN',\n\n maxContentLength: -1,\n\n validateStatus: function validateStatus(status) {\n return status >= 200 && status < 300;\n }\n};\n\ndefaults.headers = {\n common: {\n 'Accept': 'application/json, text/plain, */*'\n }\n};\n\nutils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {\n defaults.headers[method] = {};\n});\n\nutils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {\n defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);\n});\n\nmodule.exports = defaults;\n\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(24)))//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiOS5qcyIsInNvdXJjZXMiOlsid2VicGFjazovLy8uL25vZGVfbW9kdWxlcy9heGlvcy9saWIvZGVmYXVsdHMuanM/MjQ0NCJdLCJzb3VyY2VzQ29udGVudCI6WyIndXNlIHN0cmljdCc7XG5cbnZhciB1dGlscyA9IHJlcXVpcmUoJy4vdXRpbHMnKTtcbnZhciBub3JtYWxpemVIZWFkZXJOYW1lID0gcmVxdWlyZSgnLi9oZWxwZXJzL25vcm1hbGl6ZUhlYWRlck5hbWUnKTtcblxudmFyIERFRkFVTFRfQ09OVEVOVF9UWVBFID0ge1xuICAnQ29udGVudC1UeXBlJzogJ2FwcGxpY2F0aW9uL3gtd3d3LWZvcm0tdXJsZW5jb2RlZCdcbn07XG5cbmZ1bmN0aW9uIHNldENvbnRlbnRUeXBlSWZVbnNldChoZWFkZXJzLCB2YWx1ZSkge1xuICBpZiAoIXV0aWxzLmlzVW5kZWZpbmVkKGhlYWRlcnMpICYmIHV0aWxzLmlzVW5kZWZpbmVkKGhlYWRlcnNbJ0NvbnRlbnQtVHlwZSddKSkge1xuICAgIGhlYWRlcnNbJ0NvbnRlbnQtVHlwZSddID0gdmFsdWU7XG4gIH1cbn1cblxuZnVuY3Rpb24gZ2V0RGVmYXVsdEFkYXB0ZXIoKSB7XG4gIHZhciBhZGFwdGVyO1xuICAvLyBPbmx5IE5vZG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0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBIiwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///9\n")},function(module,exports,__webpack_require__){"use strict";eval("\n\nvar utils = __webpack_require__(0);\nvar settle = __webpack_require__(26);\nvar buildURL = __webpack_require__(7);\nvar parseHeaders = __webpack_require__(28);\nvar isURLSameOrigin = __webpack_require__(29);\nvar createError = __webpack_require__(11);\n\nmodule.exports = function xhrAdapter(config) {\n return new Promise(function dispatchXhrRequest(resolve, reject) {\n var requestData = config.data;\n var requestHeaders = config.headers;\n\n if (utils.isFormData(requestData)) {\n delete requestHeaders['Content-Type']; // Let the browser set it\n }\n\n var request = new XMLHttpRequest();\n\n // HTTP basic authentication\n if (config.auth) {\n var username = config.auth.username || '';\n var password = config.auth.password || '';\n requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password);\n }\n\n request.open(config.method.toUpperCase(), buildURL(config.url, config.params, config.paramsSerializer), true);\n\n // Set the request timeout in MS\n request.timeout = config.timeout;\n\n // Listen for ready state\n request.onreadystatechange = function handleLoad() {\n if (!request || request.readyState !== 4) {\n return;\n }\n\n // The request errored out and we didn't get a response, this will be\n // handled by onerror instead\n // With one exception: request that using file: protocol, most browsers\n // will return status as 0 even though it's a successful request\n if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {\n return;\n }\n\n // Prepare the response\n var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null;\n var responseData = !config.responseType || config.responseType === 'text' ? request.responseText : request.response;\n var response = {\n data: responseData,\n status: request.status,\n statusText: request.statusText,\n headers: responseHeaders,\n config: config,\n request: request\n };\n\n settle(resolve, reject, response);\n\n // Clean up request\n request = null;\n };\n\n // Handle browser request cancellation (as opposed to a manual cancellation)\n request.onabort = function handleAbort() {\n if (!request) {\n return;\n }\n\n reject(createError('Request aborted', config, 'ECONNABORTED', request));\n\n // Clean up request\n request = null;\n };\n\n // Handle low level network errors\n request.onerror = function handleError() {\n // Real errors are hidden from us by the browser\n // onerror should only fire if it's a network error\n reject(createError('Network Error', config, null, request));\n\n // Clean up request\n request = null;\n };\n\n // Handle timeout\n request.ontimeout = function handleTimeout() {\n reject(createError('timeout of ' + config.timeout + 'ms exceeded', config, 'ECONNABORTED',\n request));\n\n // Clean up request\n request = null;\n };\n\n // Add xsrf header\n // This is only done if running in a standard browser environment.\n // Specifically not if we're in a web worker, or react-native.\n if (utils.isStandardBrowserEnv()) {\n var cookies = __webpack_require__(30);\n\n // Add xsrf header\n var xsrfValue = (config.withCredentials || isURLSameOrigin(config.url)) && config.xsrfCookieName ?\n cookies.read(config.xsrfCookieName) :\n undefined;\n\n if (xsrfValue) {\n requestHeaders[config.xsrfHeaderName] = xsrfValue;\n }\n }\n\n // Add headers to the request\n if ('setRequestHeader' in request) {\n utils.forEach(requestHeaders, function setRequestHeader(val, key) {\n if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') {\n // Remove Content-Type if data is undefined\n delete requestHeaders[key];\n } else {\n // Otherwise add header to the request\n request.setRequestHeader(key, val);\n }\n });\n }\n\n // Add withCredentials to request if needed\n if (config.withCredentials) {\n request.withCredentials = true;\n }\n\n // Add responseType to request if needed\n if (config.responseType) {\n try {\n request.responseType = config.responseType;\n } catch (e) {\n // Expected DOMException thrown by browsers not compatible XMLHttpRequest Level 2.\n // But, this can be suppressed for 'json' type as it can be parsed by default 'transformResponse' function.\n if (config.responseType !== 'json') {\n throw e;\n }\n }\n }\n\n // Handle progress if needed\n if (typeof config.onDownloadProgress === 'function') {\n request.addEventListener('progress', config.onDownloadProgress);\n }\n\n // Not all browsers support upload events\n if (typeof config.onUploadProgress === 'function' && request.upload) {\n request.upload.addEventListener('progress', config.onUploadProgress);\n }\n\n if (config.cancelToken) {\n // Handle cancellation\n config.cancelToken.promise.then(function onCanceled(cancel) {\n if (!request) {\n return;\n }\n\n request.abort();\n reject(cancel);\n // Clean up request\n request = null;\n });\n }\n\n if (requestData === undefined) {\n requestData = null;\n }\n\n // Send the request\n request.send(requestData);\n });\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMTAuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYXhpb3MvbGliL2FkYXB0ZXJzL3hoci5qcz9iNTBkIl0sInNvdXJjZXNDb250ZW50IjpbIid1c2Ugc3RyaWN0JztcblxudmFyIHV0aWxzID0gcmVxdWlyZSgnLi8uLi91dGlscycpO1xudmFyIHNldHRsZSA9IHJlcXVpcmUoJy4vLi4vY29yZS9zZXR0bGUnKTtcbnZhciBidWlsZFVSTCA9IHJlcXVpcmUoJy4vLi4vaGVscGVycy9idWlsZFVSTCcpO1xudmFyIHBhcnNlSGVhZGVycyA9IHJlcXVpcmUoJy4vLi4vaGVscGVycy9wYXJzZUhlYWRlcnMnKTtcbnZhciBpc1VSTFNhbWVPcmlnaW4gPSByZXF1aXJlKCcuLy4uL2hlbHBlcnMvaXNVUkxTYW1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DQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOyIsInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///10\n")},function(module,exports,__webpack_require__){"use strict";eval("\n\nvar enhanceError = __webpack_require__(27);\n\n/**\n * Create an Error with the specified message, config, error code, request and response.\n *\n * @param {string} message The error message.\n * @param {Object} config The config.\n * @param {string} [code] The error code (for example, 'ECONNABORTED').\n * @param {Object} [request] The request.\n * @param {Object} [response] The response.\n * @returns {Error} The created error.\n */\nmodule.exports = function createError(message, config, code, request, response) {\n var error = new Error(message);\n return enhanceError(error, config, code, request, response);\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMTEuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYXhpb3MvbGliL2NvcmUvY3JlYXRlRXJyb3IuanM/MmQ4MyJdLCJzb3VyY2VzQ29udGVudCI6WyIndXNlIHN0cmljdCc7XG5cbnZhciBlbmhhbmNlRXJyb3IgPSByZXF1aXJlKCcuL2VuaGFuY2VFcnJvcicpO1xuXG4vKipcbiAqIENyZWF0ZSBhbiBFcnJvciB3aXRoIHRoZSBzcGVjaWZpZWQgbWVzc2FnZSwgY29uZmlnLCBlcnJvciBjb2RlLCByZXF1ZXN0IGFuZCByZXNwb25zZS5cbiAqXG4gKiBAcGFyYW0ge3N0cmluZ30gbWVzc2FnZSBUaGUgZXJyb3IgbWVzc2FnZS5cbiAqIEBwYXJhbSB7T2JqZWN0fSBjb25maWcgVGhlIGNvbmZpZy5cbiAqIEBwYXJhbSB7c3RyaW5nfSBbY29kZV0gVGhlIGVycm9yIGNvZGUgKGZvciBleGFtcGxlLCAnRUNPTk5BQk9SVEVEJykuXG4gKiBAcGFyYW0ge09iamVjdH0gW3JlcXVlc3RdIFRoZSByZXF1ZXN0LlxuICogQHBhcmFtIHtPYmplY3R9IFtyZXNwb25zZV0gVGhlIHJlc3BvbnNlLlxuICogQHJldHVybnMge0Vycm9yfSBUaGUgY3JlYXRlZCBlcnJvci5cbiAqL1xubW9kdWxlLmV4cG9ydHMgPSBmdW5jdGlvbiBjcmVhdGVFcnJvcihtZXNzYWdlLCBjb25maWcsIGNvZGUsIHJlcXVlc3QsIHJlc3BvbnNlKSB7XG4gIHZhciBlcnJvciA9IG5ldyBFcnJvcihtZXNzYWdlKTtcbiAgcmV0dXJuIGVuaGFuY2VFcnJvcihlcnJvciwgY29uZmlnLCBjb2RlLCByZXF1ZXN0LCByZXNwb25zZSk7XG59O1xuIl0sIm1hcHBpbmdzIjoiQUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7Iiwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///11\n")},function(module,exports,__webpack_require__){"use strict";eval("\n\nvar utils = __webpack_require__(0);\n\n/**\n * Config-specific merge-function which creates a new config-object\n * by merging two configuration objects together.\n *\n * @param {Object} config1\n * @param {Object} config2\n * @returns {Object} New object resulting from merging config2 to config1\n */\nmodule.exports = function mergeConfig(config1, config2) {\n // eslint-disable-next-line no-param-reassign\n config2 = config2 || {};\n var config = {};\n\n utils.forEach(['url', 'method', 'params', 'data'], function valueFromConfig2(prop) {\n if (typeof config2[prop] !== 'undefined') {\n config[prop] = config2[prop];\n }\n });\n\n utils.forEach(['headers', 'auth', 'proxy'], function mergeDeepProperties(prop) {\n if (utils.isObject(config2[prop])) {\n config[prop] = utils.deepMerge(config1[prop], config2[prop]);\n } else if (typeof config2[prop] !== 'undefined') {\n config[prop] = config2[prop];\n } else if (utils.isObject(config1[prop])) {\n config[prop] = utils.deepMerge(config1[prop]);\n } else if (typeof config1[prop] !== 'undefined') {\n config[prop] = config1[prop];\n }\n });\n\n utils.forEach([\n 'baseURL', 'transformRequest', 'transformResponse', 'paramsSerializer',\n 'timeout', 'withCredentials', 'adapter', 'responseType', 'xsrfCookieName',\n 'xsrfHeaderName', 'onUploadProgress', 'onDownloadProgress', 'maxContentLength',\n 'validateStatus', 'maxRedirects', 'httpAgent', 'httpsAgent', 'cancelToken',\n 'socketPath'\n ], function defaultToConfig2(prop) {\n if (typeof config2[prop] !== 'undefined') {\n config[prop] = config2[prop];\n } else if (typeof config1[prop] !== 'undefined') {\n config[prop] = config1[prop];\n }\n });\n\n return config;\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMTIuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYXhpb3MvbGliL2NvcmUvbWVyZ2VDb25maWcuanM/NGE3YiJdLCJzb3VyY2VzQ29udGVudCI6WyIndXNlIHN0cmljdCc7XG5cbnZhciB1dGlscyA9IHJlcXVpcmUoJy4uL3V0aWxzJyk7XG5cbi8qKlxuICogQ29uZmlnLXNwZWNpZmljIG1lcmdlLWZ1bmN0aW9uIHdoaWNoIGNyZWF0ZXMgYSBuZXcgY29uZmlnLW9iamVjdFxuICogYnkgbWVyZ2luZyB0d28gY29uZmlndXJhdGlvbiBvYmplY3RzIHRvZ2V0aGVyLlxuICpcbiAqIEBwYXJhbSB7T2JqZWN0fSBjb25maWcxXG4gKiBAcGFyYW0ge09iamVjdH0gY29uZmlnMlxuICogQHJldHVybnMge09iamVjdH0gTmV3IG9iamVjdCByZXN1bHRpbmcgZnJvbSBtZXJnaW5nIGNvbmZpZzIgdG8gY29uZmlnMVxuICovXG5tb2R1bGUuZXhwb3J0cyA9IGZ1bmN0aW9uIG1lcmdlQ29uZmlnKGNvbmZpZzEsIGNvbmZpZzIpIHtcbiAgLy8gZXNsaW50LWRpc2FibGUtbmV4dC1saW5lIG5vLXBhcmFtLXJlYXNzaWduXG4gIGNvbmZpZzIgPSBjb25maWcyIHx8IHt9O1xuICB2YXIgY29uZmlnID0ge307XG5cbiAgdXRpbHMuZm9yRWFjaChbJ3VybCcsICdtZXRob2QnLCAncGFyYW1zJywgJ2RhdGEnXSwgZnVuY3Rpb24gdmFsdWVGcm9tQ29uZmlnMihwcm9wKSB7XG4gICAgaWYgKHR5cGVvZiBjb25maWcyW3Byb3BdICE9PS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yxcbiAgICAndmFsaWRhdGVTdGF0dXMnLCAnbWF4UmVkaXJlY3RzJywgJ2h0dHBBZ2VudCcsICdodHRwc0FnZW50JywgJ2NhbmNlbFRva2VuJyxcbiAgICAnc29ja2V0UGF0aCdcbiAgXSwgZnVuY3Rpb24gZGVmYXVsdFRvQ29uZmlnMihwcm9wKSB7XG4gICAgaWYgKHR5cGVvZiBjb25maWcyW3Byb3BdICE9PSAndW5kZWZpbmVkJykge1xuICAgICAgY29uZmlnW3Byb3BdID0gY29uZmlnMltwcm9wXTtcbiAgICB9IGVsc2UgaWYgKHR5cGVvZiBjb25maWcxW3Byb3BdICE9PSAndW5kZWZpbmVkJykge1xuICAgICAgY29uZmlnW3Byb3BdID0gY29uZmlnMVtwcm9wXTtcbiAgICB9XG4gIH0pO1xuXG4gIHJldHVybiBjb25maWc7XG59O1xuIl0sIm1hcHBpbmdzIjoiQUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7Iiwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///12\n")},function(module,exports,__webpack_require__){"use strict";eval("\n\n/**\n * A `Cancel` is an object that is thrown when an operation is canceled.\n *\n * @class\n * @param {string=} message The message.\n */\nfunction Cancel(message) {\n this.message = message;\n}\n\nCancel.prototype.toString = function toString() {\n return 'Cancel' + (this.message ? ': ' + this.message : '');\n};\n\nCancel.prototype.__CANCEL__ = true;\n\nmodule.exports = Cancel;\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMTMuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYXhpb3MvbGliL2NhbmNlbC9DYW5jZWwuanM/N2E3NyJdLCJzb3VyY2VzQ29udGVudCI6WyIndXNlIHN0cmljdCc7XG5cbi8qKlxuICogQSBgQ2FuY2VsYCBpcyBhbiBvYmplY3QgdGhhdCBpcyB0aHJvd24gd2hlbiBhbiBvcGVyYXRpb24gaXMgY2FuY2VsZWQuXG4gKlxuICogQGNsYXNzXG4gKiBAcGFyYW0ge3N0cmluZz19IG1lc3NhZ2UgVGhlIG1lc3NhZ2UuXG4gKi9cbmZ1bmN0aW9uIENhbmNlbChtZXNzYWdlKSB7XG4gIHRoaXMubWVzc2FnZSA9IG1lc3NhZ2U7XG59XG5cbkNhbmNlbC5wcm90b3R5cGUudG9TdHJpbmcgPSBmdW5jdGlvbiB0b1N0cmluZygpIHtcbiAgcmV0dXJuICdDYW5jZWwnICsgKHRoaXMubWVzc2FnZSA/ICc6ICcgKyB0aGlzLm1lc3NhZ2UgOiAnJyk7XG59O1xuXG5DYW5jZWwucHJvdG90eXBlLl9fQ0FOQ0VMX18gPSB0cnVlO1xuXG5tb2R1bGUuZXhwb3J0cyA9IENhbmNlbDtcbiJdLCJtYXBwaW5ncyI6IkFBQUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7Iiwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///13\n")},function(module,exports,__webpack_require__){"use strict";eval("\n\nvar has = Object.prototype.hasOwnProperty\n , prefix = '~';\n\n/**\n * Constructor to create a storage for our `EE` objects.\n * An `Events` instance is a plain object whose properties are event names.\n *\n * @constructor\n * @private\n */\nfunction Events() {}\n\n//\n// We try to not inherit from `Object.prototype`. In some engines creating an\n// instance in this way is faster than calling `Object.create(null)` directly.\n// If `Object.create(null)` is not supported we prefix the event names with a\n// character to make sure that the built-in object properties are not\n// overridden or used as an attack vector.\n//\nif (Object.create) {\n Events.prototype = Object.create(null);\n\n //\n // This hack is needed because the `__proto__` property is still inherited in\n // some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5.\n //\n if (!new Events().__proto__) prefix = false;\n}\n\n/**\n * Representation of a single event listener.\n *\n * @param {Function} fn The listener function.\n * @param {*} context The context to invoke the listener with.\n * @param {Boolean} [once=false] Specify if the listener is a one-time listener.\n * @constructor\n * @private\n */\nfunction EE(fn, context, once) {\n this.fn = fn;\n this.context = context;\n this.once = once || false;\n}\n\n/**\n * Add a listener for a given event.\n *\n * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn The listener function.\n * @param {*} context The context to invoke the listener with.\n * @param {Boolean} once Specify if the listener is a one-time listener.\n * @returns {EventEmitter}\n * @private\n */\nfunction addListener(emitter, event, fn, context, once) {\n if (typeof fn !== 'function') {\n throw new TypeError('The listener must be a function');\n }\n\n var listener = new EE(fn, context || emitter, once)\n , evt = prefix ? prefix + event : event;\n\n if (!emitter._events[evt]) emitter._events[evt] = listener, emitter._eventsCount++;\n else if (!emitter._events[evt].fn) emitter._events[evt].push(listener);\n else emitter._events[evt] = [emitter._events[evt], listener];\n\n return emitter;\n}\n\n/**\n * Clear event by name.\n *\n * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.\n * @param {(String|Symbol)} evt The Event name.\n * @private\n */\nfunction clearEvent(emitter, evt) {\n if (--emitter._eventsCount === 0) emitter._events = new Events();\n else delete emitter._events[evt];\n}\n\n/**\n * Minimal `EventEmitter` interface that is molded against the Node.js\n * `EventEmitter` interface.\n *\n * @constructor\n * @public\n */\nfunction EventEmitter() {\n this._events = new Events();\n this._eventsCount = 0;\n}\n\n/**\n * Return an array listing the events for which the emitter has registered\n * listeners.\n *\n * @returns {Array}\n * @public\n */\nEventEmitter.prototype.eventNames = function eventNames() {\n var names = []\n , events\n , name;\n\n if (this._eventsCount === 0) return names;\n\n for (name in (events = this._events)) {\n if (has.call(events, name)) names.push(prefix ? name.slice(1) : name);\n }\n\n if (Object.getOwnPropertySymbols) {\n return names.concat(Object.getOwnPropertySymbols(events));\n }\n\n return names;\n};\n\n/**\n * Return the listeners registered for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @returns {Array} The registered listeners.\n * @public\n */\nEventEmitter.prototype.listeners = function listeners(event) {\n var evt = prefix ? prefix + event : event\n , handlers = this._events[evt];\n\n if (!handlers) return [];\n if (handlers.fn) return [handlers.fn];\n\n for (var i = 0, l = handlers.length, ee = new Array(l); i < l; i++) {\n ee[i] = handlers[i].fn;\n }\n\n return ee;\n};\n\n/**\n * Return the number of listeners listening to a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @returns {Number} The number of listeners.\n * @public\n */\nEventEmitter.prototype.listenerCount = function listenerCount(event) {\n var evt = prefix ? prefix + event : event\n , listeners = this._events[evt];\n\n if (!listeners) return 0;\n if (listeners.fn) return 1;\n return listeners.length;\n};\n\n/**\n * Calls each of the listeners registered for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @returns {Boolean} `true` if the event had listeners, else `false`.\n * @public\n */\nEventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {\n var evt = prefix ? prefix + event : event;\n\n if (!this._events[evt]) return false;\n\n var listeners = this._events[evt]\n , len = arguments.length\n , args\n , i;\n\n if (listeners.fn) {\n if (listeners.once) this.removeListener(event, listeners.fn, undefined, true);\n\n switch (len) {\n case 1: return listeners.fn.call(listeners.context), true;\n case 2: return listeners.fn.call(listeners.context, a1), true;\n case 3: return listeners.fn.call(listeners.context, a1, a2), true;\n case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true;\n case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;\n case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;\n }\n\n for (i = 1, args = new Array(len -1); i < len; i++) {\n args[i - 1] = arguments[i];\n }\n\n listeners.fn.apply(listeners.context, args);\n } else {\n var length = listeners.length\n , j;\n\n for (i = 0; i < length; i++) {\n if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true);\n\n switch (len) {\n case 1: listeners[i].fn.call(listeners[i].context); break;\n case 2: listeners[i].fn.call(listeners[i].context, a1); break;\n case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break;\n case 4: listeners[i].fn.call(listeners[i].context, a1, a2, a3); break;\n default:\n if (!args) for (j = 1, args = new Array(len -1); j < len; j++) {\n args[j - 1] = arguments[j];\n }\n\n listeners[i].fn.apply(listeners[i].context, args);\n }\n }\n }\n\n return true;\n};\n\n/**\n * Add a listener for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn The listener function.\n * @param {*} [context=this] The context to invoke the listener with.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.on = function on(event, fn, context) {\n return addListener(this, event, fn, context, false);\n};\n\n/**\n * Add a one-time listener for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn The listener function.\n * @param {*} [context=this] The context to invoke the listener with.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.once = function once(event, fn, context) {\n return addListener(this, event, fn, context, true);\n};\n\n/**\n * Remove the listeners of a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn Only remove the listeners that match this function.\n * @param {*} context Only remove the listeners that have this context.\n * @param {Boolean} once Only remove one-time listeners.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) {\n var evt = prefix ? prefix + event : event;\n\n if (!this._events[evt]) return this;\n if (!fn) {\n clearEvent(this, evt);\n return this;\n }\n\n var listeners = this._events[evt];\n\n if (listeners.fn) {\n if (\n listeners.fn === fn &&\n (!once || listeners.once) &&\n (!context || listeners.context === context)\n ) {\n clearEvent(this, evt);\n }\n } else {\n for (var i = 0, events = [], length = listeners.length; i < length; i++) {\n if (\n listeners[i].fn !== fn ||\n (once && !listeners[i].once) ||\n (context && listeners[i].context !== context)\n ) {\n events.push(listeners[i]);\n }\n }\n\n //\n // Reset the array, or remove it completely if we have no more listeners.\n //\n if (events.length) this._events[evt] = events.length === 1 ? events[0] : events;\n else clearEvent(this, evt);\n }\n\n return this;\n};\n\n/**\n * Remove all listeners, or those of the specified event.\n *\n * @param {(String|Symbol)} [event] The event name.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.removeAllListeners = function removeAllListeners(event) {\n var evt;\n\n if (event) {\n evt = prefix ? prefix + event : event;\n if (this._events[evt]) clearEvent(this, evt);\n } else {\n this._events = new Events();\n this._eventsCount = 0;\n }\n\n return this;\n};\n\n//\n// Alias methods names because people roll like that.\n//\nEventEmitter.prototype.off = EventEmitter.prototype.removeListener;\nEventEmitter.prototype.addListener = EventEmitter.prototype.on;\n\n//\n// Expose the prefix.\n//\nEventEmitter.prefixed = prefix;\n\n//\n// Allow `EventEmitter` to be imported as module namespace.\n//\nEventEmitter.EventEmitter = EventEmitter;\n\n//\n// Expose the module.\n//\nif (true) {\n module.exports = EventEmitter;\n}\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMTQuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvZXZlbnRlbWl0dGVyMy9pbmRleC5qcz9iYTEwIl0sInNvdXJjZXNDb250ZW50IjpbIid1c2Ugc3RyaWN0JztcblxudmFyIGhhcyA9IE9iamVjdC5wcm90b3R5cGUuaGFzT3duUHJvcGVydHlcbiAgLCBwcmVmaXggPSAnfic7XG5cbi8qKlxuICogQ29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strict";eval("\n\nvar keys = __webpack_require__(37);\nvar hasSymbols = typeof Symbol === 'function' && typeof Symbol('foo') === 'symbol';\n\nvar toStr = Object.prototype.toString;\nvar concat = Array.prototype.concat;\nvar origDefineProperty = Object.defineProperty;\n\nvar isFunction = function (fn) {\n\treturn typeof fn === 'function' && toStr.call(fn) === '[object Function]';\n};\n\nvar arePropertyDescriptorsSupported = function () {\n\tvar obj = {};\n\ttry {\n\t\torigDefineProperty(obj, 'x', { enumerable: false, value: obj });\n\t\t// eslint-disable-next-line no-unused-vars, no-restricted-syntax\n\t\tfor (var _ in obj) { // jscs:ignore disallowUnusedVariables\n\t\t\treturn false;\n\t\t}\n\t\treturn obj.x === obj;\n\t} catch (e) { /* this is IE 8. */\n\t\treturn false;\n\t}\n};\nvar supportsDescriptors = origDefineProperty && arePropertyDescriptorsSupported();\n\nvar defineProperty = function (object, name, value, predicate) {\n\tif (name in object && (!isFunction(predicate) || !predicate())) {\n\t\treturn;\n\t}\n\tif (supportsDescriptors) {\n\t\torigDefineProperty(object, name, {\n\t\t\tconfigurable: true,\n\t\t\tenumerable: false,\n\t\t\tvalue: value,\n\t\t\twritable: true\n\t\t});\n\t} else {\n\t\tobject[name] = value;\n\t}\n};\n\nvar defineProperties = function (object, map) {\n\tvar predicates = arguments.length > 2 ? arguments[2] : {};\n\tvar props = keys(map);\n\tif (hasSymbols) {\n\t\tprops = concat.call(props, Object.getOwnPropertySymbols(map));\n\t}\n\tfor (var i = 0; i < props.length; i += 1) {\n\t\tdefineProperty(object, props[i], map[props[i]], predicates[props[i]]);\n\t}\n};\n\ndefineProperties.supportsDescriptors = !!supportsDescriptors;\n\nmodule.exports = defineProperties;\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMTUuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvZGVmaW5lLXByb3BlcnRpZXMvaW5kZXguanM/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HJlZGljYXRlc1twcm9wc1tpXV0pO1xuXHR9XG59O1xuXG5kZWZpbmVQcm9wZXJ0aWVzLnN1cHBvcnRzRGVzY3JpcHRvcnMgPSAhIXN1cHBvcnRzRGVzY3JpcHRvcnM7XG5cbm1vZHVsZS5leHBvcnRzID0gZGVmaW5lUHJvcGVydGllcztcbiJdLCJtYXBwaW5ncyI6IkFBQUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7Iiwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///15\n")},function(module,exports,__webpack_require__){eval("// extracted by mini-css-extract-plugin//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMTYuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvcXVpbGwvYXNzZXRzL3Nub3cuc3R5bD80NjE5Il0sInNvdXJjZXNDb250ZW50IjpbIi8vIGV4dHJhY3RlZCBieSBtaW5pLWNzcy1leHRyYWN0LXBsdWdpbiJdLCJtYXBwaW5ncyI6IkFBQUEiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///16\n")},function(module,exports,__webpack_require__){eval("// extracted by mini-css-extract-plugin//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMTcuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9zcmMvcHJldmlldy5zdHlsPzFkMTMiXSwic291cmNlc0NvbnRlbnQiOlsiLy8gZXh0cmFjdGVkIGJ5IG1pbmktY3NzLWV4dHJhY3QtcGx1Z2luIl0sIm1hcHBpbmdzIjoiQUFBQSIsInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///17\n")},function(module,exports,__webpack_require__){"use strict";eval("\n\nvar utils = __webpack_require__(0);\nvar bind = __webpack_require__(6);\nvar Axios = __webpack_require__(20);\nvar mergeConfig = __webpack_require__(12);\nvar defaults = __webpack_require__(9);\n\n/**\n * Create an instance of Axios\n *\n * @param {Object} defaultConfig The default config for the instance\n * @return {Axios} A new instance of Axios\n */\nfunction createInstance(defaultConfig) {\n var context = new Axios(defaultConfig);\n var instance = bind(Axios.prototype.request, context);\n\n // Copy axios.prototype to instance\n utils.extend(instance, Axios.prototype, context);\n\n // Copy context to instance\n utils.extend(instance, context);\n\n return instance;\n}\n\n// Create the default instance to be exported\nvar axios = createInstance(defaults);\n\n// Expose Axios class to allow class inheritance\naxios.Axios = Axios;\n\n// Factory for creating new instances\naxios.create = function create(instanceConfig) {\n return createInstance(mergeConfig(axios.defaults, instanceConfig));\n};\n\n// Expose Cancel & CancelToken\naxios.Cancel = __webpack_require__(13);\naxios.CancelToken = __webpack_require__(33);\naxios.isCancel = __webpack_require__(8);\n\n// Expose all/spread\naxios.all = function all(promises) {\n return Promise.all(promises);\n};\naxios.spread = __webpack_require__(34);\n\nmodule.exports = axios;\n\n// Allow use of default import syntax in TypeScript\nmodule.exports.default = axios;\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMTguanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8v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DQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOyIsInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///18\n")},function(module,exports){eval("/*!\n * Determine if an object is a Buffer\n *\n * @author Feross Aboukhadijeh \n * @license MIT\n */\n\nmodule.exports = function isBuffer (obj) {\n return obj != null && obj.constructor != null &&\n typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj)\n}\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMTkuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYXhpb3Mvbm9kZV9tb2R1bGVzL2lzLWJ1ZmZlci9pbmRleC5qcz9jN2NlIl0sInNvdXJjZXNDb250ZW50IjpbIi8qIVxuICogRGV0ZXJtaW5lIGlmIGFuIG9iamVjdCBpcyBhIEJ1ZmZlclxuICpcbiAqIEBhdXRob3IgICBGZXJvc3MgQWJvdWtoYWRpamVoIDxodHRwczovL2Zlcm9zcy5vcmc+XG4gKiBAbGljZW5zZSAgTUlUXG4gKi9cblxubW9kdWxlLmV4cG9ydHMgPSBmdW5jdGlvbiBpc0J1ZmZlciAob2JqKSB7XG4gIHJldHVybiBvYmogIT0gbnVsbCAmJiBvYmouY29uc3RydWN0b3IgIT0gbnVsbCAmJlxuICAgIHR5cGVvZiBvYmouY29uc3RydWN0b3IuaXNCdWZmZXIgPT09ICdmdW5jdGlvbicgJiYgb2JqLmNvbnN0cnVjdG9yLmlzQnVmZmVyKG9iailcbn1cbiJdLCJtYXBwaW5ncyI6IkFBQUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTsiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///19\n")},function(module,exports,__webpack_require__){"use strict";eval("\n\nvar utils = __webpack_require__(0);\nvar buildURL = __webpack_require__(7);\nvar InterceptorManager = __webpack_require__(21);\nvar dispatchRequest = __webpack_require__(22);\nvar mergeConfig = __webpack_require__(12);\n\n/**\n * Create a new instance of Axios\n *\n * @param {Object} instanceConfig The default config for the instance\n */\nfunction Axios(instanceConfig) {\n this.defaults = instanceConfig;\n this.interceptors = {\n request: new InterceptorManager(),\n response: new InterceptorManager()\n };\n}\n\n/**\n * Dispatch a request\n *\n * @param {Object} config The config specific for this request (merged with this.defaults)\n */\nAxios.prototype.request = function request(config) {\n /*eslint no-param-reassign:0*/\n // Allow for axios('example/url'[, config]) a la fetch API\n if (typeof config === 'string') {\n config = arguments[1] || {};\n config.url = arguments[0];\n } else {\n config = config || {};\n }\n\n config = mergeConfig(this.defaults, config);\n config.method = config.method ? config.method.toLowerCase() : 'get';\n\n // Hook up interceptors middleware\n var chain = [dispatchRequest, undefined];\n var promise = Promise.resolve(config);\n\n this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {\n chain.unshift(interceptor.fulfilled, interceptor.rejected);\n });\n\n this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {\n chain.push(interceptor.fulfilled, interceptor.rejected);\n });\n\n while (chain.length) {\n promise = promise.then(chain.shift(), chain.shift());\n }\n\n return promise;\n};\n\nAxios.prototype.getUri = function getUri(config) {\n config = mergeConfig(this.defaults, config);\n return buildURL(config.url, config.params, config.paramsSerializer).replace(/^\\?/, '');\n};\n\n// Provide aliases for supported request methods\nutils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {\n /*eslint func-names:0*/\n Axios.prototype[method] = function(url, config) {\n return this.request(utils.merge(config || {}, {\n method: method,\n url: url\n }));\n };\n});\n\nutils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {\n /*eslint func-names:0*/\n Axios.prototype[method] = function(url, data, config) {\n return this.request(utils.merge(config || {}, {\n method: method,\n url: url,\n data: data\n }));\n };\n});\n\nmodule.exports = Axios;\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMjAuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYXhpb3MvbGliL2NvcmUvQXhpb3MuanM/MGEwNiJdLCJzb3VyY2VzQ29udGVudCI6WyIndXNlIHN0cmljdCc7XG5cbnZhciB1dGlscyA9IHJlcXVpcmUoJy4vLi4vdXRpbHMnKTtcbnZhciBidWlsZFVSTCA9IHJlcXVpcmUoJy4uL2hlbHBlcnMvYnVpbGRVUkwnKTtcbnZhciBJbnRlcmNlcHRvck1hbmFnZXIgPSByZXF1aXJlKCcuL0ludGVyY2VwdG9yTWFuYWdlcicpO1xudmFyIGRpc3BhdGNoUmVxdWVzdCA9IHJlcXVpcmUoJy4vZGlzcGF0Y2hSZXF1ZXN0Jyk7XG52YXIgbWVyZ2VDb25maWcgPSByZXF1aXJlKCcuL21lcmdlQ29uZmlnJyk7XG5cbi8qKlxuICogQ3JlYXRlIGEgbmV3IGluc3RhbmNlIG9mIEF4aW9zXG4gKlxuICogQHBhcmFtIHtPYmplY3R9IGluc3RhbmNlQ29uZmlnIFRoZSBkZWZhdWx0IGNvbmZpZyBmb3IgdGhlIGluc3RhbmNlXG4gKi9cbmZ1bmN0aW9uIEF4aW9zKGluc3RhbmNlQ29uZmlnKSB7XG4gIHRoaXMuZGVmYXVsdHMgPSBpbnN0YW5jZUNvbmZpZztcbiAgdGhpcy5pbnRlcm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NBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOyIsInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///20\n")},function(module,exports,__webpack_require__){"use strict";eval("\n\nvar utils = __webpack_require__(0);\n\nfunction InterceptorManager() {\n this.handlers = [];\n}\n\n/**\n * Add a new interceptor to the stack\n *\n * @param {Function} fulfilled The function to handle `then` for a `Promise`\n * @param {Function} rejected The function to handle `reject` for a `Promise`\n *\n * @return {Number} An ID used to remove interceptor later\n */\nInterceptorManager.prototype.use = function use(fulfilled, rejected) {\n this.handlers.push({\n fulfilled: fulfilled,\n rejected: rejected\n });\n return this.handlers.length - 1;\n};\n\n/**\n * Remove an interceptor from the stack\n *\n * @param {Number} id The ID that was returned by `use`\n */\nInterceptorManager.prototype.eject = function eject(id) {\n if (this.handlers[id]) {\n this.handlers[id] = null;\n }\n};\n\n/**\n * Iterate over all the registered interceptors\n *\n * This method is particularly useful for skipping over any\n * interceptors that may have become `null` calling `eject`.\n *\n * @param {Function} fn The function to call for each interceptor\n */\nInterceptorManager.prototype.forEach = function forEach(fn) {\n utils.forEach(this.handlers, function forEachHandler(h) {\n if (h !== null) {\n fn(h);\n }\n });\n};\n\nmodule.exports = InterceptorManager;\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMjEuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYXhpb3MvbGliL2NvcmUvSW50ZXJjZXB0b3JNYW5hZ2VyLmpzP2Y2YjQiXSwic291cmNlc0NvbnRlbnQiOlsiJ3VzZSBzdHJpY3QnO1xuXG52YXIgdXRpbHMgPSByZXF1aXJlKCcuLy4uL3V0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ict";eval("\n\nvar utils = __webpack_require__(0);\nvar transformData = __webpack_require__(23);\nvar isCancel = __webpack_require__(8);\nvar defaults = __webpack_require__(9);\nvar isAbsoluteURL = __webpack_require__(31);\nvar combineURLs = __webpack_require__(32);\n\n/**\n * Throws a `Cancel` if cancellation has been requested.\n */\nfunction throwIfCancellationRequested(config) {\n if (config.cancelToken) {\n config.cancelToken.throwIfRequested();\n }\n}\n\n/**\n * Dispatch a request to the server using the configured adapter.\n *\n * @param {object} config The config that is to be used for the request\n * @returns {Promise} The Promise to be fulfilled\n */\nmodule.exports = function dispatchRequest(config) {\n throwIfCancellationRequested(config);\n\n // Support baseURL config\n if (config.baseURL && !isAbsoluteURL(config.url)) {\n config.url = combineURLs(config.baseURL, config.url);\n }\n\n // Ensure headers exist\n config.headers = config.headers || {};\n\n // Transform request data\n config.data = transformData(\n config.data,\n config.headers,\n config.transformRequest\n );\n\n // Flatten headers\n config.headers = utils.merge(\n config.headers.common || {},\n config.headers[config.method] || {},\n config.headers || {}\n );\n\n utils.forEach(\n ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],\n function cleanHeaderConfig(method) {\n delete config.headers[method];\n }\n );\n\n var adapter = config.adapter || defaults.adapter;\n\n return adapter(config).then(function onAdapterResolution(response) {\n throwIfCancellationRequested(config);\n\n // Transform response data\n response.data = transformData(\n response.data,\n response.headers,\n config.transformResponse\n );\n\n return response;\n }, function onAdapterRejection(reason) {\n if (!isCancel(reason)) {\n throwIfCancellationRequested(config);\n\n // Transform response data\n if (reason && reason.response) {\n reason.response.data = transformData(\n reason.response.data,\n reason.response.headers,\n config.transformResponse\n );\n }\n }\n\n return Promise.reject(reason);\n });\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMjIuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYXhpb3MvbGliL2NvcmUvZGlzcGF0Y2hSZX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QTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7Iiwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///22\n")},function(module,exports,__webpack_require__){"use strict";eval("\n\nvar utils = __webpack_require__(0);\n\n/**\n * Transform the data for a request or a response\n *\n * @param {Object|String} data The data to be transformed\n * @param {Array} headers The headers for the request or response\n * @param {Array|Function} fns A single function or Array of functions\n * @returns {*} The resulting transformed data\n */\nmodule.exports = function transformData(data, headers, fns) {\n /*eslint no-param-reassign:0*/\n utils.forEach(fns, function transform(fn) {\n data = fn(data, headers);\n });\n\n return data;\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMjMuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYXhpb3MvbGliL2NvcmUvdHJhbnNmb3JtRGF0YS5qcz9jNDAxIl0sInNvdXJjZXNDb250ZW50IjpbIid1c2Ugc3RyaWN0JztcblxudmFyIHV0aWxzID0gcmVxdWlyZSgnLi8uLi91dGlscycpO1xuXG4vKipcbiAqIFRyYW5zZm9ybSB0aGUgZGF0YSBmb3IgYSByZXF1ZXN0IG9yIGEgcmVzcG9uc2VcbiAqXG4gKiBAcGFyYW0ge09iamVjdHxTdHJpbmd9IGRhdGEgVGhlIGRhdGEgdG8gYmUgdHJhbnNmb3JtZWRcbiAqIEBwYXJhbSB7QXJyYXl9IGhlYWRlcnMgVGhlIGhlYWRlcnMgZm9yIHRoZSByZXF1ZXN0IG9yIHJlc3BvbnNlXG4gKiBAcGFyYW0ge0FycmF5fEZ1bmN0aW9ufSBmbnMgQSBzaW5nbGUgZnVuY3Rpb24gb3IgQXJyYXkgb2YgZnVuY3Rpb25zXG4gKiBAcmV0dXJucyB7Kn0gVGhlIHJlc3VsdGluZyB0cmFuc2Zvcm1lZCBkYXRhXG4gKi9cbm1vZHVsZS5leHBvcnRzID0gZnVuY3Rpb24gdHJhbnNmb3JtRGF0YShkYXRhLCBoZWFkZXJzLCBmbnMpIHtcbiAgLyplc2xpbnQgbm8tcGFyYW0tcmVhc3NpZ246MCovXG4gIHV0aWxzLmZvckVhY2goZm5zLCBmdW5jdGlvbiB0cmFuc2Zvcm0oZm4pIHtcbiAgICBkYXRhID0gZm4oZGF0YSwgaGVhZGVycyk7XG4gIH0pO1xuXG4gIHJldHVybiBkYXRhO1xufTtcbiJdLCJtYXBwaW5ncyI6IkFBQUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTsiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///23\n")},function(module,exports){eval("// shim for using process in browser\nvar process = module.exports = {};\n\n// cached from whatever global is present so that test runners that stub it\n// don't break things. But we need to wrap it in a try catch in case it is\n// wrapped in strict mode code which doesn't define any globals. It's inside a\n// function because try/catches deoptimize in certain engines.\n\nvar cachedSetTimeout;\nvar cachedClearTimeout;\n\nfunction defaultSetTimout() {\n throw new Error('setTimeout has not been defined');\n}\nfunction defaultClearTimeout () {\n throw new Error('clearTimeout has not been defined');\n}\n(function () {\n try {\n if (typeof setTimeout === 'function') {\n cachedSetTimeout = setTimeout;\n } else {\n cachedSetTimeout = defaultSetTimout;\n }\n } catch (e) {\n cachedSetTimeout = defaultSetTimout;\n }\n try {\n if (typeof clearTimeout === 'function') {\n cachedClearTimeout = clearTimeout;\n } else {\n cachedClearTimeout = defaultClearTimeout;\n }\n } catch (e) {\n cachedClearTimeout = defaultClearTimeout;\n }\n} ())\nfunction runTimeout(fun) {\n if (cachedSetTimeout === setTimeout) {\n //normal enviroments in sane situations\n return setTimeout(fun, 0);\n }\n // if setTimeout wasn't available but was latter defined\n if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {\n cachedSetTimeout = setTimeout;\n return setTimeout(fun, 0);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedSetTimeout(fun, 0);\n } catch(e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedSetTimeout.call(null, fun, 0);\n } catch(e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error\n return cachedSetTimeout.call(this, fun, 0);\n }\n }\n\n\n}\nfunction runClearTimeout(marker) {\n if (cachedClearTimeout === clearTimeout) {\n //normal enviroments in sane situations\n return clearTimeout(marker);\n }\n // if clearTimeout wasn't available but was latter defined\n if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {\n cachedClearTimeout = clearTimeout;\n return clearTimeout(marker);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedClearTimeout(marker);\n } catch (e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedClearTimeout.call(null, marker);\n } catch (e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.\n // Some versions of I.E. have different rules for clearTimeout vs setTimeout\n return cachedClearTimeout.call(this, marker);\n }\n }\n\n\n\n}\nvar queue = [];\nvar draining = false;\nvar currentQueue;\nvar queueIndex = -1;\n\nfunction cleanUpNextTick() {\n if (!draining || !currentQueue) {\n return;\n }\n draining = false;\n if (currentQueue.length) {\n queue = currentQueue.concat(queue);\n } else {\n queueIndex = -1;\n }\n if (queue.length) {\n drainQueue();\n }\n}\n\nfunction drainQueue() {\n if (draining) {\n return;\n }\n var timeout = runTimeout(cleanUpNextTick);\n draining = true;\n\n var len = queue.length;\n while(len) {\n currentQueue = queue;\n queue = [];\n while (++queueIndex < len) {\n if (currentQueue) {\n currentQueue[queueIndex].run();\n }\n }\n queueIndex = -1;\n len = queue.length;\n }\n currentQueue = null;\n draining = false;\n runClearTimeout(timeout);\n}\n\nprocess.nextTick = function (fun) {\n var args = new Array(arguments.length - 1);\n if (arguments.length > 1) {\n for (var i = 1; i < arguments.length; i++) {\n args[i - 1] = arguments[i];\n }\n }\n queue.push(new Item(fun, args));\n if (queue.length === 1 && !draining) {\n runTimeout(drainQueue);\n }\n};\n\n// v8 likes predictible objects\nfunction Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}\nItem.prototype.run = function () {\n this.fun.apply(null, this.array);\n};\nprocess.title = 'browser';\nprocess.browser = true;\nprocess.env = {};\nprocess.argv = [];\nprocess.version = ''; // empty string to avoid regexp issues\nprocess.versions = {};\n\nfunction noop() {}\n\nprocess.on = noop;\nprocess.addListener = noop;\nprocess.once = noop;\nprocess.off = noop;\nprocess.removeListener = noop;\nprocess.removeAllListeners = noop;\nprocess.emit = noop;\nprocess.prependListener = noop;\nprocess.prependOnceListener = noop;\n\nprocess.listeners = function (name) { return [] }\n\nprocess.binding = function (name) {\n throw new Error('process.binding is not supported');\n};\n\nprocess.cwd = function () { return '/' };\nprocess.chdir = function (dir) {\n throw new Error('process.chdir is not supported');\n};\nprocess.umask = function() { return 0; };\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;char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FDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7Iiwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///24\n")},function(module,exports,__webpack_require__){"use strict";eval("\n\nvar utils = __webpack_require__(0);\n\nmodule.exports = function normalizeHeaderName(headers, normalizedName) {\n utils.forEach(headers, function processHeader(value, name) {\n if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) {\n headers[normalizedName] = value;\n delete headers[name];\n }\n });\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMjUuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYXhpb3MvbGliL2hlbHBlcnMvbm9ybWFsaXplSGVhZGVyTmFtZS5qcz9jOGFmIl0sInNvdXJjZXNDb250ZW50IjpbIid1c2Ugc3RyaWN0JztcblxudmFyIHV0aWxzID0gcmVxdWlyZSgnLi4vdXRpbHMnKTtcblxubW9kdWxlLmV4cG9ydHMgPSBmdW5jdGlvbiBub3JtYWxpemVIZWFkZXJOYW1lKGhlYWRlcnMsIG5vcm1hbGl6ZWROYW1lKSB7XG4gIHV0aWxzLmZvckVhY2goaGVhZGVycywgZnVuY3Rpb24gcHJvY2Vzc0hlYWRlcih2YWx1ZSwgbmFtZSkge1xuICAgIGlmIChuYW1lICE9PSBub3JtYWxpemVkTmFtZSAmJiBuYW1lLnRvVXBwZXJDYXNlKCkgPT09IG5vcm1hbGl6ZWROYW1lLnRvVXBwZXJDYXNlKCkpIHtcbiAgICAgIGhlYWRlcnNbbm9ybWFsaXplZE5hbWVdID0gdmFsdWU7XG4gICAgICBkZWxldGUgaGVhZGVyc1tuYW1lXTtcbiAgICB9XG4gIH0pO1xufTtcbiJdLCJtYXBwaW5ncyI6IkFBQUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOyIsInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///25\n")},function(module,exports,__webpack_require__){"use strict";eval("\n\nvar createError = __webpack_require__(11);\n\n/**\n * Resolve or reject a Promise based on response status.\n *\n * @param {Function} resolve A function that resolves the promise.\n * @param {Function} reject A function that rejects the promise.\n * @param {object} response The response.\n */\nmodule.exports = function settle(resolve, reject, response) {\n var validateStatus = response.config.validateStatus;\n if (!validateStatus || validateStatus(response.status)) {\n resolve(response);\n } else {\n reject(createError(\n 'Request failed with status code ' + response.status,\n response.config,\n null,\n response.request,\n response\n ));\n }\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMjYuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYXhpb3MvbGliL2NvcmUvc2V0dGxlLmpzPzQ2N2YiXSwic291cmNlc0NvbnRlbnQiOlsiJ3VzZSBzdHJpY3QnO1xuXG52YXIgY3JlYXRlRXJyb3IgPSByZXF1aXJlKCcuL2NyZWF0ZUVycm9yJyk7XG5cbi8qKlxuICogUmVzb2x2ZSBvciByZWplY3QgYSBQcm9taXNlIGJhc2VkIG9uIHJlc3BvbnNlIHN0YXR1cy5cbiAqXG4gKiBAcGFyYW0ge0Z1bmN0aW9ufSByZXNvbHZlIEEgZnVuY3Rpb24gdGhhdCByZXNvbHZlcyB0aGUgcHJvbWlzZS5cbiAqIEBwYXJhbSB7RnVuY3Rpb259IHJlamVjdCBBIGZ1bmN0aW9uIHRoYXQgcmVqZWN0cyB0aGUgcHJvbWlzZS5cbiAqIEBwYXJhbSB7b2JqZWN0fSByZXNwb25zZSBUaGUgcmVzcG9uc2UuXG4gKi9cbm1vZHVsZS5leHBvcnRzID0gZnVuY3Rpb24gc2V0dGxlKHJlc29sdmUsIHJlamVjdCwgcmVzcG9uc2UpIHtcbiAgdmFyIHZhbGlkYXRlU3RhdHVzID0gcmVzcG9uc2UuY29uZmlnLnZhbGlkYXRlU3RhdHVzO1xuICBpZiAoIXZhbGlkYXRlU3RhdHVzIHx8IHZhbGlkYXRlU3RhdHVzKHJlc3BvbnNlLnN0YXR1cykpIHtcbiAgICByZXNvbHZlKHJlc3BvbnNlKTtcbiAgfSBlbHNlIHtcbiAgICByZWplY3QoY3JlYXRlRXJyb3IoXG4gICAgICAnUmVxdWVzdCBmYWlsZWQgd2l0aCBzdGF0dXMgY29kZSAnICsgcmVzcG9uc2Uuc3RhdHVzLFxuICAgICAgcmVzcG9uc2UuY29uZmlnLFxuICAgICAgbnVsbCxcbiAgICAgIHJlc3BvbnNlLnJlcXVlc3QsXG4gICAgICByZXNwb25zZVxuICAgICkpO1xuICB9XG59O1xuIl0sIm1hcHBpbmdzIjoiQUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTsiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///26\n")},function(module,exports,__webpack_require__){"use strict";eval("\n\n/**\n * Update an Error with the specified config, error code, and response.\n *\n * @param {Error} error The error to update.\n * @param {Object} config The config.\n * @param {string} [code] The error code (for example, 'ECONNABORTED').\n * @param {Object} [request] The request.\n * @param {Object} [response] The response.\n * @returns {Error} The error.\n */\nmodule.exports = function enhanceError(error, config, code, request, response) {\n error.config = config;\n if (code) {\n error.code = code;\n }\n\n error.request = request;\n error.response = response;\n error.isAxiosError = true;\n\n error.toJSON = function() {\n return {\n // Standard\n message: this.message,\n name: this.name,\n // Microsoft\n description: this.description,\n number: this.number,\n // Mozilla\n fileName: this.fileName,\n lineNumber: this.lineNumber,\n columnNumber: this.columnNumber,\n stack: this.stack,\n // Axios\n config: this.config,\n code: this.code\n };\n };\n return error;\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMjcuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYXhpb3MvbGliL2NvcmUvZW5oYW5jZUVycm9yLmpzPzM4N2YiXSwic291cmNlc0NvbnRlbnQiOlsiJ3VzZSBzdHJpY3QnO1xuXG4vKipcbiAqIFVwZGF0ZSBhbiBFcnJvciB3aXRoIHRoZSBzcGVjaWZpZWQgY29uZmlnLCBlcnJvciBjb2RlLCBhbmQgcmVzcG9uc2UuXG4gKlxuICogQHBhcmFtIHtFcnJvcn0gZXJyb3IgVGhlIGVycm9yIHRvIHVwZGF0ZS5cbiAqIEBwYXJhbSB7T2JqZWN0fSBjb25maWcgVGhlIGNvbmZpZy5cbiAqIEBwYXJhbSB7c3RyaW5nfSBbY29kZV0gVGhlIGVycm9yIGNvZGUgKGZvciBleGFtcGxlLCAnRUNPTk5BQk9SVEVEJykuXG4gKiBAcGFyYW0ge09iamVjdH0gW3JlcXVlc3RdIFRoZSByZXF1ZXN0LlxuICogQHBhcmFtIHtPYmplY3R9IFtyZXNwb25zZV0gVGhlIHJlc3BvbnNlLlxuICogQHJldHVybnMge0Vycm9yfSBUaGUgZXJyb3IuXG4gKi9cbm1vZHVsZS5leHBvcnRzID0gZnVuY3Rpb24gZW5oYW5jZUVycm9yKGVycm9yLCBjb25maWcsIG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BO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOyIsInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///27\n")},function(module,exports,__webpack_require__){"use strict";eval("\n\nvar utils = __webpack_require__(0);\n\n// Headers whose duplicates are ignored by node\n// c.f. https://nodejs.org/api/http.html#http_message_headers\nvar ignoreDuplicateOf = [\n 'age', 'authorization', 'content-length', 'content-type', 'etag',\n 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',\n 'last-modified', 'location', 'max-forwards', 'proxy-authorization',\n 'referer', 'retry-after', 'user-agent'\n];\n\n/**\n * Parse headers into an object\n *\n * ```\n * Date: Wed, 27 Aug 2014 08:58:49 GMT\n * Content-Type: application/json\n * Connection: keep-alive\n * Transfer-Encoding: chunked\n * ```\n *\n * @param {String} headers Headers needing to be parsed\n * @returns {Object} Headers parsed into an object\n */\nmodule.exports = function parseHeaders(headers) {\n var parsed = {};\n var key;\n var val;\n var i;\n\n if (!headers) { return parsed; }\n\n utils.forEach(headers.split('\\n'), function parser(line) {\n i = line.indexOf(':');\n key = utils.trim(line.substr(0, i)).toLowerCase();\n val = utils.trim(line.substr(i + 1));\n\n if (key) {\n if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) {\n return;\n }\n if (key === 'set-cookie') {\n parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]);\n } else {\n parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;\n }\n }\n });\n\n return parsed;\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMjguanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYXhpb3MvbGliL2hlbHBlcnMvcGFyc2VIZWFkZXJzLmpzP2MzNDUiXSwic291cmNlc0NvbnRlbnQiOlsiJ3VzZ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TtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTsiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///28\n")},function(module,exports,__webpack_require__){"use strict";eval("\n\nvar utils = __webpack_require__(0);\n\nmodule.exports = (\n utils.isStandardBrowserEnv() ?\n\n // Standard browser envs have full support of the APIs needed to test\n // whether the request URL is of the same origin as current location.\n (function standardBrowserEnv() {\n var msie = /(msie|trident)/i.test(navigator.userAgent);\n var urlParsingNode = document.createElement('a');\n var originURL;\n\n /**\n * Parse a URL to discover it's components\n *\n * @param {String} url The URL to be parsed\n * @returns {Object}\n */\n function resolveURL(url) {\n var href = url;\n\n if (msie) {\n // IE needs attribute set twice to normalize properties\n urlParsingNode.setAttribute('href', href);\n href = urlParsingNode.href;\n }\n\n urlParsingNode.setAttribute('href', href);\n\n // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils\n return {\n href: urlParsingNode.href,\n protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',\n host: urlParsingNode.host,\n search: urlParsingNode.search ? urlParsingNode.search.replace(/^\\?/, '') : '',\n hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',\n hostname: urlParsingNode.hostname,\n port: urlParsingNode.port,\n pathname: (urlParsingNode.pathname.charAt(0) === '/') ?\n urlParsingNode.pathname :\n '/' + urlParsingNode.pathname\n };\n }\n\n originURL = resolveURL(window.location.href);\n\n /**\n * Determine if a URL shares the same origin as the current location\n *\n * @param {String} requestURL The URL to test\n * @returns {boolean} True if URL shares the same origin, otherwise false\n */\n return function isURLSameOrigin(requestURL) {\n var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;\n return (parsed.protocol === originURL.protocol &&\n parsed.host === originURL.host);\n };\n })() :\n\n // Non standard browser envs (web workers, react-native) lack needed support.\n (function nonStandardBrowserEnv() {\n return function isURLSameOrigin() {\n return true;\n };\n })()\n);\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMjkuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYXhpb3MvbGliL2hlbHBlcnMvaXNVUkxTYW1lT3JpZ2luLmpzPzM5MzQiXSwic291cmNlc0NvbnRlbnQiOlsiJ3VzZSBzdHJpY3QnO1xuXG52YXIgdXRpbHMgPSByZXF1aXJlKCcuLy4uL3V0aWxzJyk7XG5cbm1vZHVsZS5leHBvcnRzID0gKFxuICB1dGlscy5pc1N0YW5kYXJkQnJvd3NlckVudigpID9cblxuICAvLyBTdGFuZGFyZCBicm93c2VyIGVudnMgaGF2ZSBmdWxsIHN1cHBvcnQgb2YgdGhlIEFQSXMgbmVlZGVkIHRvIHRlc3RcbiAgLy8gd2hldGhlciB0aGUgcmVxdWVzdCBVUkwgaXMgb2YgdGhlIHNhbWUgb3JpZ2luIGFzIGN1cnJlbnQgbG9jYXRpb24uXG4gICAgKGZ1bmN0aW9uIHN0YW5kYXJkQnJvd3NlckVudigpIHtcbiAgICAgIHZhciBtc2llID0gLyhtc2llfHRyaWRlbnQpL2kudGVzdChuYXZpZ2F0b3IudXNlckFnZW50KTtcbiAgICAgIHZhciB1cmxQYXJzaW5nTm9kZSA9IGRvY3VtZW50LmNyZWF0ZUVsZW1lbnQoJ2EnKTtcbiAgICAgIHZhciBvcmlnaW5VUkw7XG5cbiAgICAgIC8qKlxuICAgICogUGFyc2UgYSBVUkwgdG8gZGlzY292ZXIgaXQncyBjb21wb25lbnRzXG4gICAgKlxuICAgICogQHBhcmFtIHtTdHJpbmd9IHVybCBUaGUgVVJMIHRvIGJlIHBhcnNlZFxuICAgICogQHJldHVybnMge09iamVjdH1cbiAgICAqL1xuICAgICAgZnVuY3Rpb24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biBub25TdGFuZGFyZEJyb3dzZXJFbnYoKSB7XG4gICAgICByZXR1cm4gZnVuY3Rpb24gaXNVUkxTYW1lT3JpZ2luKCkge1xuICAgICAgICByZXR1cm4gdHJ1ZTtcbiAgICAgIH07XG4gICAgfSkoKVxuKTtcbiJdLCJtYXBwaW5ncyI6IkFBQUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTsiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///29\n")},function(module,exports,__webpack_require__){"use strict";eval("\n\nvar utils = __webpack_require__(0);\n\nmodule.exports = (\n utils.isStandardBrowserEnv() ?\n\n // Standard browser envs support document.cookie\n (function standardBrowserEnv() {\n return {\n write: function write(name, value, expires, path, domain, secure) {\n var cookie = [];\n cookie.push(name + '=' + encodeURIComponent(value));\n\n if (utils.isNumber(expires)) {\n cookie.push('expires=' + new Date(expires).toGMTString());\n }\n\n if (utils.isString(path)) {\n cookie.push('path=' + path);\n }\n\n if (utils.isString(domain)) {\n cookie.push('domain=' + domain);\n }\n\n if (secure === true) {\n cookie.push('secure');\n }\n\n document.cookie = cookie.join('; ');\n },\n\n read: function read(name) {\n var match = document.cookie.match(new RegExp('(^|;\\\\s*)(' + name + ')=([^;]*)'));\n return (match ? decodeURIComponent(match[3]) : null);\n },\n\n remove: function remove(name) {\n this.write(name, '', Date.now() - 86400000);\n }\n };\n })() :\n\n // Non standard browser env (web workers, react-native) lack needed support.\n (function nonStandardBrowserEnv() {\n return {\n write: function write() {},\n read: function read() { return null; },\n remove: function remove() {}\n };\n })()\n);\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMzAuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYXhpb3MvbGliL2hlbHBlcnMvY29va2llcy5qcz83YWFjIl0sInNvdXJjZXNDb250ZW50IjpbIid1c2Ugc3RyaWN0JztcblxudmFyIHV0aWxzID0gcmVxdWlyZSgnLi8uLi91dGlscycpO1xuXG5tb2R1bGUuZXhwb3J0cyA9IChcbiAgdXRpbHMuaXNTdGFuZGFyZEJyb3dzZXJFbnYoKSA/XG5cbiAgLy8gU3RhbmRhcmQgYnJvd3NlciBlbnZzIHN1cHBvcnQgZG9jdW1lbnQuY29va2llXG4gICAgKGZ1bmN0aW9uIHN0YW5kYXJkQnJvd3NlckVudigpIHtcbiAgICAgIHJldHVybiB7XG4gICAgICAgIHdyaXRlOiBmdW5jdGlvbiB3cml0ZShuYW1lLCB2YWx1ZSwgZXhwaXJlcywgcGF0aCwgZG9tYWluLCBzZWN1cmUpIHtcbiAgICAgICAgICB2YXIgY29va2llID0gW107XG4gICAgICAgICAgY29va2llLnB1c2gobmFtZSArICc9JyArIGVuY29kZVVSSUNvbXBvbmVudCh2YWx1ZSkpO1xuXG4gICAgICAgICAgaWYgKHV0aWxzLmlzTnVtYmVyKGV4cGlyZXMpKSB7XG4gICAgICAgICAgICBjb29raWUucHVzaCgnZXhwaXJlcz0nICsgbmV3IERhdGUoZXhwaXJlcykudG9HTVRTdHJpbmcoKSk7XG4gICAgICAgICAgfVxuXG4gICAgICAgICAgaWYgKHV0aWxzLmlzU3RyaW5nKHBhdGgpKSB7XG4gICAgICAgICAgICBjb29raWUucHVzaCgncGF0aD0nICsgcGF0aCk7XG4gICAgICAgICAgfVxuXG4gICAgICAgICAgaWYgKHV0aWxzLmlzU3RyaW5nKGRvbWFpbikpIHtcbiAgICAgICAgICAgIGNvb2tpZS5wdXNoKCdkb21haW49JyArIGRvbWFpbik7XG4gICAgICAgICAgfVxuXG4gICAgICAgICAgaWYgKHNlY3VyZSA9PT0gdHJ1ZSkge1xuICAgICAgICAgICAgY29va2llLnB1c2goJ3NlY3VyZScpO1xuICAgICAgICAgIH1cblxuICAgICAgICAgIGRvY3VtZW50LmNvb2tpZSA9IGNvb2tpZS5qb2luKCc7ICcpO1xuICAgICAgICB9LFxuXG4gICAgICAgIHJlYWQ6IGZ1bmN0aW9uIHJlYWQobmFtZSkge1xuICAgICAgICAgIHZhciBtYXRjaCA9IGRvY3VtZW50LmNvb2tpZS5tYXRjaChuZXcgUmVnRXhwKCcoXnw7XFxcXHMqKSgnICsgbmFtZSArICcpPShbXjtdKiknKSk7XG4gICAgICAgICAgcmV0dXJuIChtYXRjaCA/IGRlY29kZVVSSUNvbXBvbmVudChtYXRjaFszXSkgOiBudWxsKTtcbiAgICAgICAgfSxcblxuICAgICAgICByZW1vdmU6IGZ1bmN0aW9uIHJlbW92ZShuYW1lKSB7XG4gICAgICAgICAgdGhpcy53cml0ZShuYW1lLCAnJywgRGF0ZS5ub3coKSAtIDg2NDAwMDAwKTtcbiAgICAgICAgfVxuICAgICAgfTtcbiAgICB9KSgpIDpcblxuICAvLyBOb24gc3RhbmRhcmQgYnJvd3NlciBlbnYgKHdlYiB3b3JrZXJzLCByZWFjdC1uYXRpdmUpIGxhY2sgbmVlZGVkIHN1cHBvcnQuXG4gICAgKGZ1bmN0aW9uIG5vblN0YW5kYXJkQnJvd3NlckVudigpIHtcbiAgICAgIHJldHVybiB7XG4gICAgICAgIHdyaXRlOiBmdW5jdGlvbiB3cml0ZSgpIHt9LFxuICAgICAgICByZWFkOiBmdW5jdGlvbiByZWFkKCkgeyByZXR1cm4gbnVsbDsgfSxcbiAgICAgICAgcmVtb3ZlOiBmdW5jdGlvbiByZW1vdmUoKSB7fVxuICAgICAgfTtcbiAgICB9KSgpXG4pO1xuIl0sIm1hcHBpbmdzIjoiQUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOyIsInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///30\n")},function(module,exports,__webpack_require__){"use strict";eval('\n\n/**\n * Determines whether the specified URL is absolute\n *\n * @param {string} url The URL to test\n * @returns {boolean} True if the specified URL is absolute, otherwise false\n */\nmodule.exports = function isAbsoluteURL(url) {\n // A URL is considered absolute if it begins with "://" or "//" (protocol-relative URL).\n // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed\n // by any combination of letters, digits, plus, period, or hyphen.\n return /^([a-z][a-z\\d\\+\\-\\.]*:)?\\/\\//i.test(url);\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMzEuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYXhpb3MvbGliL2hlbHBlcnMvaXNBYnNvbHV0ZVVSTC5qcz9kOTI1Il0sInNvdXJjZXNDb250ZW50IjpbIid1c2Ugc3RyaWN0JztcblxuLyoqXG4gKiBEZXRlcm1pbmVzIHdoZXRoZXIgdGhlIHNwZWNpZmllZCBVUkwgaXMgYWJzb2x1dGVcbiAqXG4gKiBAcGFyYW0ge3N0cmluZ30gdXJsIFRoZSBVUkwgdG8gdGVzdFxuICogQHJldHVybnMge2Jvb2xlYW59IFRydWUgaWYgdGhlIHNwZWNpZmllZCBVUkwgaXMgYWJzb2x1dGUsIG90aGVyd2lzZSBmYWxzZVxuICovXG5tb2R1bGUuZXhwb3J0cyA9IGZ1bmN0aW9uIGlzQWJzb2x1dGVVUkwodXJsKSB7XG4gIC8vIEEgVVJMIGlzIGNvbnNpZGVyZWQgYWJzb2x1dGUgaWYgaXQgYmVnaW5zIHdpdGggXCI8c2NoZW1lPjovL1wiIG9yIFwiLy9cIiAocHJvdG9jb2wtcmVsYXRpdmUgVVJMKS5cbiAgLy8gUkZDIDM5ODYgZGVmaW5lcyBzY2hlbWUgbmFtZSBhcyBhIHNlcXVlbmNlIG9mIGNoYXJhY3RlcnMgYmVnaW5uaW5nIHdpdGggYSBsZXR0ZXIgYW5kIGZvbGxvd2VkXG4gIC8vIGJ5IGFueSBjb21iaW5hdGlvbiBvZiBsZXR0ZXJzLCBkaWdpdHMsIHBsdXMsIHBlcmlvZCwgb3IgaHlwaGVuLlxuICByZXR1cm4gL14oW2Etel1bYS16XFxkXFwrXFwtXFwuXSo6KT9cXC9cXC8vaS50ZXN0KHVybCk7XG59O1xuIl0sIm1hcHBpbmdzIjoiQUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOyIsInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///31\n')},function(module,exports,__webpack_require__){"use strict";eval("\n\n/**\n * Creates a new URL by combining the specified URLs\n *\n * @param {string} baseURL The base URL\n * @param {string} relativeURL The relative URL\n * @returns {string} The combined URL\n */\nmodule.exports = function combineURLs(baseURL, relativeURL) {\n return relativeURL\n ? baseURL.replace(/\\/+$/, '') + '/' + relativeURL.replace(/^\\/+/, '')\n : baseURL;\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMzIuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYXhpb3MvbGliL2hlbHBlcnMvY29tYmluZVVSTHMuanM/ZTY4MyJdLCJzb3VyY2VzQ29udGVudCI6WyIndXNlIHN0cmljdCc7XG5cbi8qKlxuICogQ3JlYXRlcyBhIG5ldyBVUkwgYnkgY29tYmluaW5nIHRoZSBzcGVjaWZpZWQgVVJMc1xuICpcbiAqIEBwYXJhbSB7c3RyaW5nfSBiYXNlVVJMIFRoZSBiYXNlIFVSTFxuICogQHBhcmFtIHtzdHJpbmd9IHJlbGF0aXZlVVJMIFRoZSByZWxhdGl2ZSBVUkxcbiAqIEByZXR1cm5zIHtzdHJpbmd9IFRoZSBjb21iaW5lZCBVUkxcbiAqL1xubW9kdWxlLmV4cG9ydHMgPSBmdW5jdGlvbiBjb21iaW5lVVJMcyhiYXNlVVJMLCByZWxhdGl2ZVVSTCkge1xuICByZXR1cm4gcmVsYXRpdmVVUkxcbiAgICA/IGJhc2VVUkwucmVwbGFjZSgvXFwvKyQvLCAnJykgKyAnLycgKyByZWxhdGl2ZVVSTC5yZXBsYWNlKC9eXFwvKy8sICcnKVxuICAgIDogYmFzZVVSTDtcbn07XG4iXSwibWFwcGluZ3MiOiJBQUFBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7Iiwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///32\n")},function(module,exports,__webpack_require__){"use strict";eval("\n\nvar Cancel = __webpack_require__(13);\n\n/**\n * A `CancelToken` is an object that can be used to request cancellation of an operation.\n *\n * @class\n * @param {Function} executor The executor function.\n */\nfunction CancelToken(executor) {\n if (typeof executor !== 'function') {\n throw new TypeError('executor must be a function.');\n }\n\n var resolvePromise;\n this.promise = new Promise(function promiseExecutor(resolve) {\n resolvePromise = resolve;\n });\n\n var token = this;\n executor(function cancel(message) {\n if (token.reason) {\n // Cancellation has already been requested\n return;\n }\n\n token.reason = new Cancel(message);\n resolvePromise(token.reason);\n });\n}\n\n/**\n * Throws a `Cancel` if cancellation has been requested.\n */\nCancelToken.prototype.throwIfRequested = function throwIfRequested() {\n if (this.reason) {\n throw this.reason;\n }\n};\n\n/**\n * Returns an object that contains a new `CancelToken` and a function that, when called,\n * cancels the `CancelToken`.\n */\nCancelToken.source = function source() {\n var cancel;\n var token = new CancelToken(function executor(c) {\n cancel = c;\n });\n return {\n token: token,\n cancel: cancel\n };\n};\n\nmodule.exports = CancelToken;\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMzMuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYXhpb3MvbGliL2NhbmNlbC9DYW5jZWxUb2tlbi5qcz84ZGY0Il0sInNvdXJjZXNDb250ZW50IjpbIid1c2Ugc3RyaWN0JztcblxudmFyIENhbmNlbCA9IHJlcXVpcmUoJy4vQ2FuY2VsJyk7XG5cbi8qKlxuICogQSBgQ2FuY2VsVG9rZW5gIGlzIGFuIG9iamVjdCB0aGF0IGNhbiBiZSB1c2VkIHRvIHJlcXVlc3QgY2FuY2VsbGF0aW9uIG9mIGFuIG9wZXJhdGlvbi5cbiAqXG4gKiBAY2xhc3NcbiAqIEBwYXJhbSB7RnVuY3Rpb259IGV4ZWN1dG9yIFRoZSBleGVjdXRvciBmdW5jdGlvbi5cbiAqL1xu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biAqIGNhbmNlbHMgdGhlIGBDYW5jZWxUb2tlbmAuXG4gKi9cbkNhbmNlbFRva2VuLnNvdXJjZSA9IGZ1bmN0aW9uIHNvdXJjZSgpIHtcbiAgdmFyIGNhbmNlbDtcbiAgdmFyIHRva2VuID0gbmV3IENhbmNlbFRva2VuKGZ1bmN0aW9uIGV4ZWN1dG9yKGMpIHtcbiAgICBjYW5jZWwgPSBjO1xuICB9KTtcbiAgcmV0dXJuIHtcbiAgICB0b2tlbjogdG9rZW4sXG4gICAgY2FuY2VsOiBjYW5jZWxcbiAgfTtcbn07XG5cbm1vZHVsZS5leHBvcnRzID0gQ2FuY2VsVG9rZW47XG4iXSwibWFwcGluZ3MiOiJBQUFBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTsiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///33\n")},function(module,exports,__webpack_require__){"use strict";eval("\n\n/**\n * Syntactic sugar for invoking a function and expanding an array for arguments.\n *\n * Common use case would be to use `Function.prototype.apply`.\n *\n * ```js\n * function f(x, y, z) {}\n * var args = [1, 2, 3];\n * f.apply(null, args);\n * ```\n *\n * With `spread` this example can be re-written.\n *\n * ```js\n * spread(function(x, y, z) {})([1, 2, 3]);\n * ```\n *\n * @param {Function} callback\n * @returns {Function}\n */\nmodule.exports = function spread(callback) {\n return function wrap(arr) {\n return callback.apply(null, arr);\n };\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMzQuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYXhpb3MvbGliL2hlbHBlcnMvc3ByZWFkLmpzPzBkZjYiXSwic291cmNlc0NvbnRlbnQiOlsiJ3VzZSBzdHJpY3QnO1xuXG4vKipcbiAqIFN5bnRhY3RpYyBzdWdhciBmb3IgaW52b2tpbmcgYSBmdW5jdGlvbiBhbmQgZXhwYW5kaW5nIGFuIGFycmF5IGZvciBhcmd1bWVudHMuXG4gKlxuICogQ29tbW9uIHVzZSBjYXNlIHdvdWxkIGJlIHRvIHVzZSBgRnVuY3Rpb24ucHJvdG90eXBlLmFwcGx5YC5cbiAqXG4gKiAgYGBganNcbiAqICBmdW5jdGlvbiBmKHgsIHksIHopIHt9XG4gKiAgdmFyIGFyZ3MgPSBbMSwgMiwgM107XG4gKiAgZi5hcHBseShudWxsLCBhcmdzKTtcbiAqICBgYGBcbiAqXG4gKiBXaXRoIGBzcHJlYWRgIHRoaXMgZXhhbXBsZSBjYW4gYmUgcmUtd3JpdHRlbi5cbiAqXG4gKiAgYGBganNcbiAqICBzcHJlYWQoZnVuY3Rpb24oeCwgeSwgeikge30pKFsxLCAyLCAzXSk7XG4gKiAgYGBgXG4gKlxuICogQHBhcmFtIHtGdW5jdGlvbn0gY2FsbGJhY2tcbiAqIEByZXR1cm5zIHtGdW5jdGlvbn1cbiAqL1xubW9kdWxlLmV4cG9ydHMgPSBmdW5jdGlvbiBzcHJlYWQoY2FsbGJhY2spIHtcbiAgcmV0dXJuIGZ1bmN0aW9uIHdyYXAoYXJyKSB7XG4gICAgcmV0dXJuIGNhbGxiYWNrLmFwcGx5KG51bGwsIGFycik7XG4gIH07XG59O1xuIl0sIm1hcHBpbmdzIjoiQUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7Iiwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///34\n")},function(module,exports,__webpack_require__){"use strict";eval("\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nvar deep_equal_1 = __importDefault(__webpack_require__(36));\nvar extend_1 = __importDefault(__webpack_require__(41));\nvar fast_diff_1 = __importDefault(__webpack_require__(58));\nvar AttributeMap_1 = __importDefault(__webpack_require__(59));\nvar Op_1 = __importDefault(__webpack_require__(42));\nvar NULL_CHARACTER = String.fromCharCode(0); // Placeholder char for embed in diff()\nvar Delta = /** @class */ (function () {\n function Delta(ops) {\n // Assume we are given a well formed ops\n if (Array.isArray(ops)) {\n this.ops = ops;\n }\n else if (ops != null && Array.isArray(ops.ops)) {\n this.ops = ops.ops;\n }\n else {\n this.ops = [];\n }\n }\n Delta.prototype.insert = function (arg, attributes) {\n var newOp = {};\n if (typeof arg === 'string' && arg.length === 0) {\n return this;\n }\n newOp.insert = arg;\n if (attributes != null &&\n typeof attributes === 'object' &&\n Object.keys(attributes).length > 0) {\n newOp.attributes = attributes;\n }\n return this.push(newOp);\n };\n Delta.prototype.delete = function (length) {\n if (length <= 0) {\n return this;\n }\n return this.push({ delete: length });\n };\n Delta.prototype.retain = function (length, attributes) {\n if (length <= 0) {\n return this;\n }\n var newOp = { retain: length };\n if (attributes != null &&\n typeof attributes === 'object' &&\n Object.keys(attributes).length > 0) {\n newOp.attributes = attributes;\n }\n return this.push(newOp);\n };\n Delta.prototype.push = function (newOp) {\n var index = this.ops.length;\n var lastOp = this.ops[index - 1];\n newOp = extend_1.default(true, {}, newOp);\n if (typeof lastOp === 'object') {\n if (typeof newOp.delete === 'number' &&\n typeof lastOp.delete === 'number') {\n this.ops[index - 1] = { delete: lastOp.delete + newOp.delete };\n return this;\n }\n // Since it does not matter if we insert before or after deleting at the same index,\n // always prefer to insert first\n if (typeof lastOp.delete === 'number' && newOp.insert != null) {\n index -= 1;\n lastOp = this.ops[index - 1];\n if (typeof lastOp !== 'object') {\n this.ops.unshift(newOp);\n return this;\n }\n }\n if (deep_equal_1.default(newOp.attributes, lastOp.attributes)) {\n if (typeof newOp.insert === 'string' &&\n typeof lastOp.insert === 'string') {\n this.ops[index - 1] = { insert: lastOp.insert + newOp.insert };\n if (typeof newOp.attributes === 'object') {\n this.ops[index - 1].attributes = newOp.attributes;\n }\n return this;\n }\n else if (typeof newOp.retain === 'number' &&\n typeof lastOp.retain === 'number') {\n this.ops[index - 1] = { retain: lastOp.retain + newOp.retain };\n if (typeof newOp.attributes === 'object') {\n this.ops[index - 1].attributes = newOp.attributes;\n }\n return this;\n }\n }\n }\n if (index === this.ops.length) {\n this.ops.push(newOp);\n }\n else {\n this.ops.splice(index, 0, newOp);\n }\n return this;\n };\n Delta.prototype.chop = function () {\n var lastOp = this.ops[this.ops.length - 1];\n if (lastOp && lastOp.retain && !lastOp.attributes) {\n this.ops.pop();\n }\n return this;\n };\n Delta.prototype.filter = function (predicate) {\n return this.ops.filter(predicate);\n };\n Delta.prototype.forEach = function (predicate) {\n this.ops.forEach(predicate);\n };\n Delta.prototype.map = function (predicate) {\n return this.ops.map(predicate);\n };\n Delta.prototype.partition = function (predicate) {\n var passed = [];\n var failed = [];\n this.forEach(function (op) {\n var target = predicate(op) ? passed : failed;\n target.push(op);\n });\n return [passed, failed];\n };\n Delta.prototype.reduce = function (predicate, initialValue) {\n return this.ops.reduce(predicate, initialValue);\n };\n Delta.prototype.changeLength = function () {\n return this.reduce(function (length, elem) {\n if (elem.insert) {\n return length + Op_1.default.length(elem);\n }\n else if (elem.delete) {\n return length - elem.delete;\n }\n return length;\n }, 0);\n };\n Delta.prototype.length = function () {\n return this.reduce(function (length, elem) {\n return length + Op_1.default.length(elem);\n }, 0);\n };\n Delta.prototype.slice = function (start, end) {\n if (start === void 0) { start = 0; }\n if (end === void 0) { end = Infinity; }\n var ops = [];\n var iter = Op_1.default.iterator(this.ops);\n var index = 0;\n while (index < end && iter.hasNext()) {\n var nextOp = void 0;\n if (index < start) {\n nextOp = iter.next(start - index);\n }\n else {\n nextOp = iter.next(end - index);\n ops.push(nextOp);\n }\n index += Op_1.default.length(nextOp);\n }\n return new Delta(ops);\n };\n Delta.prototype.compose = function (other) {\n var thisIter = Op_1.default.iterator(this.ops);\n var otherIter = Op_1.default.iterator(other.ops);\n var ops = [];\n var firstOther = otherIter.peek();\n if (firstOther != null &&\n typeof firstOther.retain === 'number' &&\n firstOther.attributes == null) {\n var firstLeft = firstOther.retain;\n while (thisIter.peekType() === 'insert' &&\n thisIter.peekLength() <= firstLeft) {\n firstLeft -= thisIter.peekLength();\n ops.push(thisIter.next());\n }\n if (firstOther.retain - firstLeft > 0) {\n otherIter.next(firstOther.retain - firstLeft);\n }\n }\n var delta = new Delta(ops);\n while (thisIter.hasNext() || otherIter.hasNext()) {\n if (otherIter.peekType() === 'insert') {\n delta.push(otherIter.next());\n }\n else if (thisIter.peekType() === 'delete') {\n delta.push(thisIter.next());\n }\n else {\n var length_1 = Math.min(thisIter.peekLength(), otherIter.peekLength());\n var thisOp = thisIter.next(length_1);\n var otherOp = otherIter.next(length_1);\n if (typeof otherOp.retain === 'number') {\n var newOp = {};\n if (typeof thisOp.retain === 'number') {\n newOp.retain = length_1;\n }\n else {\n newOp.insert = thisOp.insert;\n }\n // Preserve null when composing with a retain, otherwise remove it for inserts\n var attributes = AttributeMap_1.default.compose(thisOp.attributes, otherOp.attributes, typeof thisOp.retain === 'number');\n if (attributes) {\n newOp.attributes = attributes;\n }\n delta.push(newOp);\n // Optimization if rest of other is just retain\n if (!otherIter.hasNext() &&\n deep_equal_1.default(delta.ops[delta.ops.length - 1], newOp)) {\n var rest = new Delta(thisIter.rest());\n return delta.concat(rest).chop();\n }\n // Other op should be delete, we could be an insert or retain\n // Insert + delete cancels out\n }\n else if (typeof otherOp.delete === 'number' &&\n typeof thisOp.retain === 'number') {\n delta.push(otherOp);\n }\n }\n }\n return delta.chop();\n };\n Delta.prototype.concat = function (other) {\n var delta = new Delta(this.ops.slice());\n if (other.ops.length > 0) {\n delta.push(other.ops[0]);\n delta.ops = delta.ops.concat(other.ops.slice(1));\n }\n return delta;\n };\n Delta.prototype.diff = function (other, cursor) {\n if (this.ops === other.ops) {\n return new Delta();\n }\n var strings = [this, other].map(function (delta) {\n return delta\n .map(function (op) {\n if (op.insert != null) {\n return typeof op.insert === 'string' ? op.insert : NULL_CHARACTER;\n }\n var prep = delta === other ? 'on' : 'with';\n throw new Error('diff() called ' + prep + ' non-document');\n })\n .join('');\n });\n var retDelta = new Delta();\n var diffResult = fast_diff_1.default(strings[0], strings[1], cursor);\n var thisIter = Op_1.default.iterator(this.ops);\n var otherIter = Op_1.default.iterator(other.ops);\n diffResult.forEach(function (component) {\n var length = component[1].length;\n while (length > 0) {\n var opLength = 0;\n switch (component[0]) {\n case fast_diff_1.default.INSERT:\n opLength = Math.min(otherIter.peekLength(), length);\n retDelta.push(otherIter.next(opLength));\n break;\n case fast_diff_1.default.DELETE:\n opLength = Math.min(length, thisIter.peekLength());\n thisIter.next(opLength);\n retDelta.delete(opLength);\n break;\n case fast_diff_1.default.EQUAL:\n opLength = Math.min(thisIter.peekLength(), otherIter.peekLength(), length);\n var thisOp = thisIter.next(opLength);\n var otherOp = otherIter.next(opLength);\n if (deep_equal_1.default(thisOp.insert, otherOp.insert)) {\n retDelta.retain(opLength, AttributeMap_1.default.diff(thisOp.attributes, otherOp.attributes));\n }\n else {\n retDelta.push(otherOp).delete(opLength);\n }\n break;\n }\n length -= opLength;\n }\n });\n return retDelta.chop();\n };\n Delta.prototype.eachLine = function (predicate, newline) {\n if (newline === void 0) { newline = '\\n'; }\n var iter = Op_1.default.iterator(this.ops);\n var line = new Delta();\n var i = 0;\n while (iter.hasNext()) {\n if (iter.peekType() !== 'insert') {\n return;\n }\n var thisOp = iter.peek();\n var start = Op_1.default.length(thisOp) - iter.peekLength();\n var index = typeof thisOp.insert === 'string'\n ? thisOp.insert.indexOf(newline, start) - start\n : -1;\n if (index < 0) {\n line.push(iter.next());\n }\n else if (index > 0) {\n line.push(iter.next(index));\n }\n else {\n if (predicate(line, iter.next(1).attributes || {}, i) === false) {\n return;\n }\n i += 1;\n line = new Delta();\n }\n }\n if (line.length() > 0) {\n predicate(line, {}, i);\n }\n };\n Delta.prototype.invert = function (base) {\n var inverted = new Delta();\n this.reduce(function (baseIndex, op) {\n if (op.insert) {\n inverted.delete(Op_1.default.length(op));\n }\n else if (op.retain && op.attributes == null) {\n inverted.retain(op.retain);\n return baseIndex + op.retain;\n }\n else if (op.delete || (op.retain && op.attributes)) {\n var length_2 = (op.delete || op.retain);\n var slice = base.slice(baseIndex, baseIndex + length_2);\n slice.forEach(function (baseOp) {\n if (op.delete) {\n inverted.push(baseOp);\n }\n else if (op.retain && op.attributes) {\n inverted.retain(Op_1.default.length(baseOp), AttributeMap_1.default.invert(op.attributes, baseOp.attributes));\n }\n });\n return baseIndex + length_2;\n }\n return baseIndex;\n }, 0);\n return inverted.chop();\n };\n Delta.prototype.transform = function (arg, priority) {\n if (priority === void 0) { priority = false; }\n priority = !!priority;\n if (typeof arg === 'number') {\n return this.transformPosition(arg, priority);\n }\n var other = arg;\n var thisIter = Op_1.default.iterator(this.ops);\n var otherIter = Op_1.default.iterator(other.ops);\n var delta = new Delta();\n while (thisIter.hasNext() || otherIter.hasNext()) {\n if (thisIter.peekType() === 'insert' &&\n (priority || otherIter.peekType() !== 'insert')) {\n delta.retain(Op_1.default.length(thisIter.next()));\n }\n else if (otherIter.peekType() === 'insert') {\n delta.push(otherIter.next());\n }\n else {\n var length_3 = Math.min(thisIter.peekLength(), otherIter.peekLength());\n var thisOp = thisIter.next(length_3);\n var otherOp = otherIter.next(length_3);\n if (thisOp.delete) {\n // Our delete either makes their delete redundant or removes their retain\n continue;\n }\n else if (otherOp.delete) {\n delta.push(otherOp);\n }\n else {\n // We retain either their retain or insert\n delta.retain(length_3, AttributeMap_1.default.transform(thisOp.attributes, otherOp.attributes, priority));\n }\n }\n }\n return delta.chop();\n };\n Delta.prototype.transformPosition = function (index, priority) {\n if (priority === void 0) { priority = false; }\n priority = !!priority;\n var thisIter = Op_1.default.iterator(this.ops);\n var offset = 0;\n while (thisIter.hasNext() && offset <= index) {\n var length_4 = thisIter.peekLength();\n var nextType = thisIter.peekType();\n thisIter.next();\n if (nextType === 'delete') {\n index -= Math.min(length_4, index - offset);\n continue;\n }\n else if (nextType === 'insert' && (offset < index || !priority)) {\n index += length_4;\n }\n offset += length_4;\n }\n return index;\n };\n Delta.Op = Op_1.default;\n Delta.AttributeMap = AttributeMap_1.default;\n return Delta;\n}());\nmodule.exports = Delta;\n//# sourceMappingURL=Delta.js.map//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMzUuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvcXVpbGwtZGVsdGEvZGlzdC9EZWx0YS5qcz80OGQxIl0sInNvdXJjZXNDb250ZW50IjpbIlwidXNlIHN0cmljdFwiO1xudmFyIF9faW1wb3J0RGVmYXVsdCA9ICh0aGlzICYmIHRoaXMuX19pbXBvcnREZWZhdWx0KSB8fCBmdW5jdGlvbiAobW9kKSB7XG4gICAgcmV0dXJuIChtb2QgJiYgbW9kLl9fZXNNb2R1bGUpID8gbW9kIDogeyBcImRlZmF1bHRcIjogbW9kIH07XG59O1xudmFyIGRlZXBfZXF1YWxfMSA9IF9faW1wb3J0RGVmYXVsdChyZXF1aXJlKFwiZGVlcC1lcXVhbFwiKSk7XG52YXIgZXh0ZW5kXzEg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uICAgICAgICBuZXdPcC5pbnNlcnQgPSBhcmc7XG4gICAgICAgIGlmIChhdHRyaWJ1dGVzICE9IG51bGwgJiZcbiAgICAgICAgICAgIHR5cGVvZiBhdHRyaWJ1dGVzID09PSAnb2JqZWN0JyAmJlxuICAgICAgICAgICAgT2JqZWN0LmtleXMoYXR0cmlidXRlcykubGVuZ3RoID4gMCkge1xuICAgICAgICAgICAgbmV3T3AuYXR0cmlidXRlcyA9IGF0dHJpYnV0ZXM7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHRoaXMucHVzaChuZXdPcCk7XG4gICAgfTtcbiAgICBEZWx0YS5wcm90b3R5cGUuZGVsZXRlID0gZnVuY3Rpb24gKGxlbmd0aCkge1xuICAgICAgICBpZiAobGVuZ3RoIDw9IDApIHtcbiAgICAgICAgICAgIHJldHVybiB0aGlzO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiB0aGlzLnB1c2goeyBkZWxldGU6IGxlbmd0aCB9KTtcbiAgICB9O1xuICAgIERlbHRhLnByb3RvdHlwZS5yZXRhaW4gPSBmdW5jdGlvbiAobGVuZ3RoLCBhdHRyaWJ1dGVzKSB7XG4gICAgICAgIGlmIChsZW5ndGggPD0gMCkge1xuICAgICAgICAgICAgcmV0dXJuIHRoaXM7XG4gICAgICAgIH1cbiAgICAgICAgdmFyIG5ld09wID0geyByZXRhaW46IGxlbmd0aCB9O1xuICAgICAgICBpZiAoYXR0cmlidXRlcyAhPSBudWxsICYmXG4gICAgICAgICAgICB0eXBlb2YgYXR0cmlidXRlcyA9PT0gJ29iamVjdCcgJiZcbiAgICAgICAgICAgIE9iamVjdC5rZXlzKGF0dHJpYnV0ZXMpLmxlbmd0aCA+IDApIHtcbiAgICAgICAgICAgIG5ld09wLmF0dHJpYnV0ZXMgPSBhdHRyaWJ1dGVzO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiB0aGlzLnB1c2gobmV3T3ApO1xuICAgIH07XG4gICAgRGVsdGEucHJvdG90eXBlLnB1c2ggPSBmdW5jdGlvbiAobmV3T3ApIHtcbiAgICAgICAgdmFyIGluZGV4ID0gdGhpcy5vcHMubGVuZ3RoO1xuICAgICAgICB2YXIgbGFzdE9wID0gdGhpcy5vcHNbaW5kZXggLSAxXTtcbiAgICAgICAgbmV3T3AgPSBleHRlbmRfMS5kZWZhdWx0KHRydWUsIHt9LCBuZXdPcCk7XG4gICAgICAgIGlmICh0eXBlb2YgbGFzdE9wID09PSAnb2JqZWN0Jykge1xuICAgICAgICAgICAgaWYgKHR5cGVvZiBuZXdPcC5kZWxldGUgPT09ICdudW1iZXInICYmXG4gICAgICAgICAgICAgICAgdHlwZW9mIGxhc3RPcC5kZWxldGUgPT09ICdudW1iZXInKSB7XG4gICAgICAgICAgICAgICAgdGhpcy5vcHNbaW5kZXggLSAxXSA9IHsgZGVsZXRlOiBsYXN0T3AuZGVsZXRlICsgbmV3T3AuZGVsZXRlIH07XG4gICAgICAgICAgICAgICAgcmV0dXJuIHRoaXM7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICAvLyBTaW5jZSBpdCBkb2VzIG5vdCBtYXR0ZXIgaWYgd2UgaW5zZXJ0IGJlZm9yZSBvciBhZnRlciBkZWxldGluZyBhdCB0aGUgc2FtZSBpbmRleCxcbiAgICAgICAgICAgIC8vIGFsd2F5cyBwcmVmZXIgdG8gaW5zZXJ0IGZpcnN0XG4gICAgICAgICAgICBpZiAodHlwZW9mIGxhc3RPcC5kZWxldGUgPT09ICdudW1iZXInICYmIG5ld09wLmluc2VydCAhPSBudWxsKSB7XG4gICAgICAgICAgICAgICAgaW5kZXggLT0gMTtcbiAgICAgICAgICAgICAgICBsYXN0T3AgPSB0aGlzLm9wc1tpbmRleCAtIDFdO1xuICAgICAgICAgICAgICAgIGlmICh0eXBlb2YgbGFzdE9wICE9PSAnb2JqZWN0Jykge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLm9wcy51bnNoaWZ0KG5ld09wKTtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXM7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKGRlZXBfZXF1YWxfMS5kZWZhdWx0KG5ld09wLmF0dHJpYnV0ZXMsIGxhc3RPcC5hdHRyaWJ1dGVzKSkge1xuICAgICAgICAgICAgICAgIGlmICh0eXBlb2YgbmV3T3AuaW5zZXJ0ID09PSAnc3RyaW5nJyAmJlxuICAgICAgICAgICAgICAgICAgICB0eXBlb2YgbGFzdE9wLmluc2VydCA9PT0gJ3N0cmluZycpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5vcHNbaW5kZXggLSAxXSA9IHsgaW5zZXJ0OiBsYXN0T3AuaW5zZXJ0ICsgbmV3T3AuaW5zZXJ0IH07XG4gICAgICAgICAgICAgICAgICAgIGlmICh0eXBlb2YgbmV3T3AuYXR0cmlidXRlcyA9PT0gJ29iamVjdCcpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMub3BzW2luZGV4IC0gMV0uYXR0cmlidXRlcyA9IG5ld09wLmF0dHJpYnV0ZXM7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXM7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGVsc2UgaWYgKHR5cGVvZiBuZXdPcC5yZXRhaW4gPT09ICdudW1iZXInICYmXG4gICAgICAgICAgICAgICAgICAgIHR5cGVvZiBsYXN0T3AucmV0YWluID09PSAnbnVtYmVyJykge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLm9wc1tpbmRleCAtIDFdID0geyByZXRhaW46IGxhc3RPcC5yZXRhaW4gKyBuZXdPcC5yZXRhaW4gfTtcbiAgICAgICAgICAgICAgICAgICAgaWYgKHR5cGVvZiBuZXdPcC5hdHRyaWJ1dGVzID09PSAnb2JqZWN0Jykge1xuICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5vcHNbaW5kZXggLSAxXS5hdHRyaWJ1dGVzID0gbmV3T3AuYXR0cmlidXRlcztcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcztcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgaWYgKGluZGV4ID09PSB0aGlzLm9wcy5sZW5ndGgpIHtcbiAgICAgICAgICAgIHRoaXMub3BzLnB1c2gobmV3T3ApO1xuICAgICAgICB9XG4gICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgdGhpcy5vcHMuc3BsaWNlKGluZGV4LCAwLCBuZXdPcCk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHRoaXM7XG4gICAgfTtcbiAgICBEZWx0YS5wcm90b3R5cGUuY2hvcCA9IGZ1bmN0aW9uICgpIHtcbiAgICAgICAgdmFyIGxhc3RPcCA9IHRoaXMub3BzW3RoaXMub3BzLmxlbmd0aCAtIDFdO1xuICAgICAgICBpZiAobGFzdE9wICYmIGxhc3RPcC5yZXRhaW4gJiYgIWxhc3RPcC5hdHRyaWJ1dGVzKSB7XG4gICAgICAgICAgICB0aGlzLm9wcy5wb3AoKTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gdGhpcztcbiAgICB9O1xuICAgIERlbHRhLnByb3RvdHlwZS5maWx0ZXIgPSBmdW5jdGlvbiAocHJlZGljYXRlKSB7XG4gICAgICAgIHJldHVybiB0aGlzLm9wcy5maWx0ZXIocHJlZGljYXRlKTtcbiAgICB9O1xuICAgIERlbHRhLnByb3RvdHlwZS5mb3JFYWNoID0gZnVuY3Rpb24gKHByZWRpY2F0ZSkge1xuICAgICAgICB0aGlzLm9wcy5mb3JFYWNoKHByZWRpY2F0ZSk7XG4gICAgfTtcbiAgICBEZWx0YS5wcm90b3R5cGUubWFwID0gZnVuY3Rpb24gKHByZWRpY2F0ZSkge1xuICAgICAgICByZXR1cm4gdGhpcy5vcHMubWFwKHByZWRpY2F0ZSk7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AgICAgICAgcmV0dXJuIHRoaXMucmVkdWNlKGZ1bmN0aW9uIChsZW5ndGgsIGVsZW0pIHtcbiAgICAgICAgICAgIHJldHVybiBsZW5ndGggKyBPcF8xLmRlZmF1bHQubGVuZ3RoKGVsZW0pO1xuICAgICAgICB9LCAwKTtcbiAgICB9O1xuICAgIERlbHRhLnByb3RvdHlwZS5zbGljZSA9IGZ1bmN0aW9uIChzdGFydCwgZW5kKSB7XG4gICAgICAgIGlmIChzdGFydCA9PT0gdm9pZCAwKSB7IHN0YXJ0ID0gMDsgfVxuICAgICAgICBpZiAoZW5kID09PSB2b2lkIDApIHsgZW5kID0gSW5maW5pdHk7IH1cbiAgICAgICAgdmFyIG9wcyA9IFtdO1xuICAgICAgICB2YXIgaXRlciA9IE9wXzEuZGVmYXVsdC5pdGVyYXRvcih0aGlzLm9wcyk7XG4gICAgICAgIHZhciBpbmRleCA9IDA7XG4gICAgICAgIHdoaWxlIChpbmRleCA8IGVuZCAmJiBpdGVyLmhhc05leHQoKSkge1xuICAgICAgICAgICAgdmFyIG5leHRPcCA9IHZvaWQgMDtcbiAgICAgICAgICAgIGlmIChpbmRleCA8IHN0YXJ0KSB7XG4gICAgICAgICAgICAgICAgbmV4dE9wID0gaXRlci5uZXh0KHN0YXJ0IC0gaW5kZXgpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgbmV4dE9wID0gaXRlci5uZXh0KGVuZCAtIGluZGV4KTtcbiAgICAgICAgICAgICAgICBvcHMucHVzaChuZXh0T3ApO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaW5kZXggKz0gT3BfMS5kZWZhdWx0Lmxlbmd0aChuZXh0T3ApO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiBuZXcgRGVsdGEob3BzKTtcbiAgICB9O1xuICAgIERlbHRhLnByb3RvdHlwZS5jb21wb3NlID0gZnVuY3Rpb24gKG90aGVyKSB7XG4gICAgICAgIHZhciB0aG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LnBlZWtUeXBlKCkgPT09ICdpbnNlcnQnKSB7XG4gICAgICAgICAgICAgICAgZGVsdGEucHVzaChvdGhlckl0ZXIubmV4dCgpKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGVsc2UgaWYgKHRoaXNJdGVyLnBlZWtUeXBlKCkgPT09ICdkZWxldGUnKSB7XG4gICAgICAgICAgICAgICAgZGVsdGEucHVzaCh0aGlzSXRlci5uZXh0KCkpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgdmFyIGxlbmd0aF8xID0gTWF0aC5taW4odGhpc0l0ZXIucGVla0xlbmd0aCgpLCBvdGhlckl0ZXIucGVla0xlbmd0aCgpKTtcbiAgICAgICAgICAgICAgICB2YXIgdGhpc09wID0gdGhpc0l0ZXIubmV4dChsZW5ndGhfMSk7XG4gICAgICAgICAgICAgICAgdmFyIG90aGVyT3AgPSBvdGhlckl0ZXIubmV4dChsZW5ndGhfMSk7XG4gICAgICAgICAgICAgICAgaWYgKHR5cGVvZiBvdGhlck9wLnJldGFpbiA9PT0gJ251bWJlcicpIHtcbiAgICAgICAgICAgICAgICAgICAgdmFyIG5ld09wID0ge307XG4gICAgICAgICAgICAgICAgICAgIGlmICh0eXBlb2YgdGhpc09wLnJldGFpbiA9PT0gJ251bWJlcicpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIG5ld09wLnJldGFpbiA9IGxlbmd0aF8xO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgbmV3T3AuaW5zZXJ0ID0gdGhpc09wLmluc2VydDtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAvLyBQcmVzZXJ2ZSBudWxsIHdoZW4gY29tcG9zaW5nIHdpdGggYSByZXRhaW4sIG90aGVyd2lzZSByZW1vdmUgaXQgZm9yIGluc2VydHNcbiAgICAgICAgICAgICAgICAgICAgdmFyIGF0dHJpYnV0ZXMgPSBBdHRyaWJ1dGVNYXBfMS5kZWZhdWx0LmNvbXBvc2UodGhpc09wLmF0dHJpYnV0ZXMsIG90aGVyT3AuYXR0cmlidXRlcywgdHlwZW9mIHRoaXNPcC5yZXRhaW4gPT09ICdudW1iZXInKTtcbiAgICAgICAgICAgICAgICAgICAgaWYgKGF0dHJpYnV0ZXMpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIG5ld09wLmF0dHJpYnV0ZXMgPSBhdHRyaWJ1dGVzO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGRlbHRhLnB1c2gobmV3T3ApO1xuICAgICAgICAgICAgICAgICAgICAvLyBPcHRpbWl6YXRpb24gaWYgcmVzdCBvZiBvdGhlciBpcyBqdXN0IHJldGFpblxuICAgICAgICAgICAgICAgICAgICBpZiAoIW90aGVySXRlci5oYXNOZXh0KCkgJiZcbiAgICAgICAgICAgICAgICAgICAgICAgIGRlZXBfZXF1YWxfMS5kZWZhdWx0KGRlbHRhLm9wc1tkZWx0YS5vcHMubGVuZ3RoIC0gMV0sIG5ld09wKSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHJlc3QgPSBuZXcgRGVsdGEodGhpc0l0ZXIucmVzdCgpKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBkZWx0YS5jb25jYXQocmVzdCkuY2hvcCgpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIC8vIE90aGVyIG9wIHNob3VsZCBiZSBkZWxldGUsIHdlIGNvdWxkIGJlIGFuIGluc2VydCBvciByZXRhaW5cbiAgICAgICAgICAgICAgICAgICAgLy8gSW5zZXJ0ICsgZGVsZXRlIGNhbmNlbHMgb3V0XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGVsc2UgaWYgKHR5cGVvZiBvdGhlck9wLmRlbGV0ZSA9PT0gJ251bWJlcicgJiZcbiAgICAgICAgICAgICAgICAgICAgdHlwZW9mIHRoaXNPcC5yZXRhaW4gPT09ICdudW1iZXInKSB7XG4gICAgICAgICAgICAgICAgICAgIGRlbHRhLnB1c2gob3RoZXJPcCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBkZWx0YS5jaG9wKCk7XG4gICAgfTtcbiAgICBEZWx0YS5wcm90b3R5cGUuY29uY2F0ID0gZnVuY3Rpb24gKG90aGVyKSB7XG4gICAgICAgIHZhciBkZWx0YSA9IG5ldyBEZWx0YSh0aGlzLm9wcy5zbGljZSgpKTtcbiAgICAgICAgaWYgKG90aGVyLm9wcy5sZW5ndGggPiAwKSB7XG4gICAgICAgICAgICBkZWx0YS5wdXNoKG90aGVyLm9wc1swXSk7XG4gICAgICAgICAgICBkZWx0YS5vcHMgPSBkZWx0YS5vcHMuY29uY2F0KG90aGVyLm9wcy5zbGljZSgxKSk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIGRlbHRhO1xuICAgIH07XG4gICAgRGVsdGEucHJvdG90eXBlLmRpZmYgPSBmdW5jdGlvbiAob3RoZXIsIGN1cnNvcikge1xuICAgICAgICBpZiAodGhpcy5vcHMgPT09IG90aGVyLm9wcykge1xuICAgICAgICAgICAgcmV0dXJuIG5ldyBEZWx0YSgpO1xuICAgICAgICB9XG4gICAgICAgIHZhciBzdHJpbmdzID0gW3RoaXMsIG90aGVyXS5tYXAoZnVuY3Rpb24gKGRlbHRhKSB7XG4gICAgICAgICAgICByZXR1cm4gZGVsdGFcbiAgICAgICAgICAgICAgICAubWFwKGZ1bmN0aW9uIChvcCkge1xuICAgICAgICAgICAgICAgIGlmIChvcC5pbnNlcnQgIT0gbnVsbCkge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gdHlwZW9mIG9wLmluc2VydCA9PT0gJ3N0cmluZycgPyBvcC5pbnNlcnQgOiBOVUxMX0NIQVJBQ1RFUjtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgdmFyIHByZXAgPSBkZWx0YSA9PT0gb3RoZXIgPyAnb24nIDogJ3dpdGgnO1xuICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcignZGlmZigpIGNhbGxlZCAnICsgcHJlcCArICcgbm9uLWRvY3VtZW50Jyk7XG4gICAgICAgICAgICB9KVxuICAgICAgICAgICAgICAgIC5qb2luKCcnKTtcbiAgICAgICAgfSk7XG4gICAgICAgIHZhciByZXREZWx0YSA9IG5ldyBEZWx0YSgpO1xuICAgICAgICB2YXIgZGlmZlJlc3VsdCA9IGZhc3RfZGlmZl8xLmRlZmF1bHQoc3RyaW5nc1swXSwgc3RyaW5nc1sxXSwgY3Vyc29yKTtcbiAgICAgICAgdmFyIHRoaXNJdGVyID0gT3BfMS5kZWZhdWx0Lml0ZXJhdG9yKHRoaXMub3BzKTtcbiAgICAgICAgdmFyIG90aGVySXRlciA9IE9wXzEuZGVmYXVsdC5pdGVyYXRvcihvdGhlci5vcHMpO1xuICAgICAgICBkaWZmUmVzdWx0LmZvckVhY2goZnVuY3Rpb24gKGNvbXBvbmVudCkge1xuICAgICAgICAgICAgdmFyIGxlbmd0aCA9IGNvbXBvbmVudFsxXS5sZW5ndGg7XG4gICAgICAgICAgICB3aGlsZSAobGVuZ3RoID4gMCkge1xuICAgICAgICAgICAgICAgIHZhciBvcExlbmd0aCA9IDA7XG4gICAgICAgICAgICAgICAgc3dpdGNoIChjb21wb25lbnRbMF0pIHtcbiAgICAgICAgICAgICAgICAgICAgY2FzZSBmYXN0X2RpZmZfMS5kZWZhdWx0LklOU0VSVDpcbiAgICAgICAgICAgICAgICAgICAgICAgIG9wTGVuZ3RoID0gTWF0aC5taW4ob3RoZXJJdGVyLnBlZWtMZW5ndGgoKSwgbGVuZ3RoKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldERlbHRhLnB1c2gob3RoZXJJdGVyLm5leHQob3BMZW5ndGgpKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgICAgICBjYXNlIGZhc3RfZGlmZl8xLmRlZmF1bHQuREVMRVRFOlxuICAgICAgICAgICAgICAgICAgICAgICAgb3BMZW5ndGggPSBNYXRoLm1pbihsZW5ndGgsIHRoaXNJdGVyLnBlZWtMZW5ndGgoKSk7XG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzSXRlci5uZXh0KG9wTGVuZ3RoKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldERlbHRhLmRlbGV0ZShvcExlbmd0aCk7XG4gICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICAgICAgY2FzZSBmYXN0X2RpZmZfMS5kZWZhdWx0LkVRVUFMOlxuICAgICAgICAgICAgICAgICAgICAgICAgb3BMZW5ndGggPSBNYXRoLm1pbih0aGlzSXRlci5wZWVrTGVuZ3RoKCksIG90aGVySXRlci5wZWVrTGVuZ3RoKCksIGxlbmd0aCk7XG4gICAgICAgICAgICAgICAgICAgICAgICB2YXIgdGhpc09wID0gdGhpc0l0ZXIubmV4dChvcExlbmd0aCk7XG4gICAgICAgICAgICAgICAgICAgICAgICB2YXIgb3RoZXJPcCA9IG90aGVySXRlci5uZXh0KG9wTGVuZ3RoKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChkZWVwX2VxdWFsXzEuZGVmYXVsdCh0aGlzT3AuaW5zZXJ0LCBvdGhlck9wLmluc2VydCkpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXREZWx0YS5yZXRhaW4ob3BMZW5ndGgsIEF0dHJpYnV0ZU1hcF8xLmRlZmF1bHQuZGlmZih0aGlzT3AuYXR0cmlidXRlcywgb3RoZXJPcC5hdHRyaWJ1dGVzKSk7XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXREZWx0YS5wdXNoKG90aGVyT3ApLmRlbGV0ZShvcExlbmd0aCk7XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgbGVuZ3RoIC09IG9wTGVuZ3RoO1xuICAgICAgICAgICAgfVxuICAgICAgICB9KTtcbiAgICAgICAgcmV0dXJuIHJldERlbHRhLmNob3AoKTtcbiAgICB9O1xuICAgIERlbHRhLnByb3RvdHlwZS5lYWNoTGluZSA9IGZ1bmN0aW9uIChwcmVkaWNhdGUsIG5ld2xpbmUpIHtcbiAgICAgICAgaWYgKG5ld2xpbmUgPT09IHZvaWQgMCkgeyBuZXdsaW5lID0gJ1xcbic7IH1cbiAgICAgICAgdmFyIGl0ZXIgPSBPcF8xLmRlZmF1bHQuaXRlcmF0b3IodGhpcy5vcHMpO1xuICAgICAgICB2YXIgbGluZSA9IG5ldyBEZWx0YSgpO1xuICAgICAgICB2YXIgaSA9IDA7XG4gICAgICAgIHdoaWxlIChpdGVyLmhhc05leHQoKSkge1xuICAgICAgICAgICAgaWYgKGl0ZXIucGVla1R5cGUoKSAhPT0gJ2luc2VydCcpIHtcbiAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICB2YXIgdGhpc09wID0gaXRlci5wZWVrKCk7XG4gICAgICAgICAgICB2YXIgc3RhcnQgPSBPcF8xLmRlZmF1bHQubGVuZ3RoKHRoaXNPcCkgLSBpdGVyLnBlZWtMZW5ndGgoKTtcbiAgICAgICAgICAgIHZhciBpbmRleCA9IHR5cGVvZiB0aGlzT3AuaW5zZXJ0ID09PSAnc3RyaW5nJ1xuICAgICAgICAgICAgICAgID8gdGhpc09wLmluc2VydC5pbmRleE9mKG5ld2xpbmUsIHN0YXJ0KSAtIHN0YXJ0XG4gICAgICAgICAgICAgICAgOiAtMTtcbiAgICAgICAgICAgIGlmIChpbmRleCA8IDApIHtcbiAgICAgICAgICAgICAgICBsaW5lLnB1c2goaXRlci5uZXh0KCkpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgZWxzZSBpZiAoaW5kZXggPiAwKSB7XG4gICAgICAgICAgICAgICAgbGluZS5wdXNoKGl0ZXIubmV4dChpbmRleCkpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgaWYgKHByZWRpY2F0ZShsaW5lLCBpdGVyLm5leHQoMSkuYXR0cmlidXRlcyB8fCB7fSwgaSkgPT09IGZhbHNlKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgaSArPSAxO1xuICAgICAgICAgICAgICAgIGxpbmUgPSBuZXcgRGVsdGEoKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICBpZiAobGluZS5sZW5ndGgoKSA+IDApIHtcbiAgICAgICAgICAgIHByZWRpY2F0ZShsaW5lLCB7fSwgaSk7XG4gICAgICAgIH1cbiAgICB9O1xuICAgIERlbHRhLnByb3RvdHlwZS5pbnZlcnQgPSBmdW5jdGlvbiAoYmFzZSkge1xuICAgICAgICB2YXIgaW52ZXJ0ZWQgPSBuZXcgRGVsdGEoKTtcbiAgICAgICAgdGhpcy5yZWR1Y2UoZnVuY3Rpb24gKGJhc2VJbmRleCwgb3ApIHtcbiAgICAgICAgICAgIGlmIChvcC5pbnNlcnQpIHtcbiAgICAgICAgICAgICAgICBpbnZlcnRlZC5kZWxldGUoT3BfMS5kZWZhdWx0Lmxlbmd0aChvcCkpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgZWxzZSBpZiAob3AucmV0YWluICYmIG9wLmF0dHJpYnV0ZXMgPT0gbnVsbCkge1xuICAgICAgICAgICAgICAgIGludmVydGVkLnJldGFpbihvcC5yZXRhaW4pO1xuICAgICAgICAgICAgICAgIHJldHVybiBiYXNlSW5kZXggKyBvcC5yZXRhaW47XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBlbHNlIGlmIChvcC5kZWxldGUgfHwgKG9wLnJldGFpbiAmJiBvcC5hdHRyaWJ1dGVzKSkge1xuICAgICAgICAgICAgICAgIHZhciBsZW5ndGhfMiA9IChvcC5kZWxldGUgfHwgb3AucmV0YWluKTtcbiAgICAgICAgICAgICAgICB2YXIgc2xpY2UgPSBiYXNlLnNsaWNlKGJhc2VJbmRleCwgYmFzZUluZGV4ICsgbGVuZ3RoXzIpO1xuICAgICAgICAgICAgICAgIHNsaWNlLmZvckVhY2goZnVuY3Rpb24gKGJhc2VPcCkge1xuICAgICAgICAgICAgICAgICAgICBpZiAob3AuZGVsZXRlKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBpbnZlcnRlZC5wdXNoKGJhc2VPcCk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgZWxzZSBpZiAob3AucmV0YWluICYmIG9wLmF0dHJpYnV0ZXMpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGludmVydGVkLnJldGFpbihPcF8xLmRlZmF1bHQubGVuZ3RoKGJhc2VPcCksIEF0dHJpYnV0ZU1hcF8xLmRlZmF1bHQuaW52ZXJ0KG9wLmF0dHJpYnV0ZXMsIGJhc2VPcC5hdHRyaWJ1dGVzKSk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgICByZXR1cm4gYmFzZUluZGV4ICsgbGVuZ3RoXzI7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByZXR1cm4gYmFzZUluZGV4O1xuICAgICAgICB9LCAwKTtcbiAgICAgICAgcmV0dXJuIGludmVydGVkLmNob3AoKTtcbiAgICB9O1xuICAgIERlbHRhLnByb3RvdHlwZS50cmFuc2Zvcm0gPSBmdW5jdGlvbiAoYXJnLCBwcmlvcml0eSkge1xuICAgICAgICBpZiAocHJpb3JpdHkgP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oKCkpO1xuICAgICAgICAgICAgICAgIHZhciB0aGlzT3AgPSB0aGlzSXRlci5uZXh0KGxlbmd0aF8zKTtcbiAgICAgICAgICAgICAgICB2YXIgb3RoZXJPcCA9IG90aGVySXRlci5uZXh0KGxlbmd0aF8zKTtcbiAgICAgICAgICAgICAgICBpZiAodGhpc09wLmRlbGV0ZSkge1xuICAgICAgICAgICAgICAgICAgICAvLyBPdXIgZGVsZXRlIGVpdGhlciBtYWtlcyB0aGVpciBkZWxldGUgcmVkdW5kYW50IG9yIHJlbW92ZXMgdGhlaXIgcmV0YWluXG4gICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBlbHNlIGlmIChvdGhlck9wLmRlbGV0ZSkge1xuICAgICAgICAgICAgICAgICAgICBkZWx0YS5wdXNoKG90aGVyT3ApO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgLy8gV2UgcmV0YWluIGVpdGhlciB0aGVpciByZXRhaW4gb3IgaW5zZXJ0XG4gICAgICAgICAgICAgICAgICAgIGRlbHRhLnJldGFpbihsZW5ndGhfMywgQXR0cmlidXRlTWFwXzEuZGVmYXVsdC50cmFuc2Zvcm0odGhpc09wLmF0dHJpYnV0ZXMsIG90aGVyT3AuYXR0cmlidXRlcywgcHJpb3JpdHkpKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIGRlbHRhLmNob3AoKTtcbiAgICB9O1xuICAgIERlbHRhLnByb3RvdHlwZS50cmFuc2Zvcm1Qb3NpdGlvbiA9IGZ1bmN0aW9uIChpbmRleCwgcHJpb3JpdHkpIHtcbiAgICAgICAgaWYgKHByaW9yaXR5ID09PSB2b2lkIDApIHsgcHJpb3JpdHkgPSBmYWxzZTsgfVxuICAgICAgICBwcmlvcml0eSA9ICEhcHJpb3J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7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBIiwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///35\n")},function(module,exports,__webpack_require__){eval("var objectKeys = __webpack_require__(37);\nvar isArguments = __webpack_require__(49);\nvar is = __webpack_require__(50);\nvar isRegex = __webpack_require__(51);\nvar flags = __webpack_require__(55);\nvar isDate = __webpack_require__(57);\n\nvar getTime = Date.prototype.getTime;\n\nfunction deepEqual(actual, expected, options) {\n var opts = options || {};\n\n // 7.1. All identical values are equivalent, as determined by ===.\n if (opts.strict ? is(actual, expected) : actual === expected) {\n return true;\n }\n\n // 7.3. Other pairs that do not both pass typeof value == 'object', equivalence is determined by ==.\n if (!actual || !expected || (typeof actual !== 'object' && typeof expected !== 'object')) {\n return opts.strict ? is(actual, expected) : actual == expected;\n }\n\n /*\n * 7.4. For all other Object pairs, including Array objects, equivalence is\n * determined by having the same number of owned properties (as verified\n * with Object.prototype.hasOwnProperty.call), the same set of keys\n * (although not necessarily the same order), equivalent values for every\n * corresponding key, and an identical 'prototype' property. Note: this\n * accounts for both named and indexed properties on Arrays.\n */\n // eslint-disable-next-line no-use-before-define\n return objEquiv(actual, expected, opts);\n}\n\nfunction isUndefinedOrNull(value) {\n return value === null || value === undefined;\n}\n\nfunction isBuffer(x) {\n if (!x || typeof x !== 'object' || typeof x.length !== 'number') {\n return false;\n }\n if (typeof x.copy !== 'function' || typeof x.slice !== 'function') {\n return false;\n }\n if (x.length > 0 && typeof x[0] !== 'number') {\n return false;\n }\n return true;\n}\n\nfunction objEquiv(a, b, opts) {\n /* eslint max-statements: [2, 50] */\n var i, key;\n if (typeof a !== typeof b) { return false; }\n if (isUndefinedOrNull(a) || isUndefinedOrNull(b)) { return false; }\n\n // an identical 'prototype' property.\n if (a.prototype !== b.prototype) { return false; }\n\n if (isArguments(a) !== isArguments(b)) { return false; }\n\n var aIsRegex = isRegex(a);\n var bIsRegex = isRegex(b);\n if (aIsRegex !== bIsRegex) { return false; }\n if (aIsRegex || bIsRegex) {\n return a.source === b.source && flags(a) === flags(b);\n }\n\n if (isDate(a) && isDate(b)) {\n return getTime.call(a) === getTime.call(b);\n }\n\n var aIsBuffer = isBuffer(a);\n var bIsBuffer = isBuffer(b);\n if (aIsBuffer !== bIsBuffer) { return false; }\n if (aIsBuffer || bIsBuffer) { // && would work too, because both are true or both false here\n if (a.length !== b.length) { return false; }\n for (i = 0; i < a.length; i++) {\n if (a[i] !== b[i]) { return false; }\n }\n return true;\n }\n\n if (typeof a !== typeof b) { return false; }\n\n try {\n var ka = objectKeys(a);\n var kb = objectKeys(b);\n } catch (e) { // happens when one is a string literal and the other isn't\n return false;\n }\n // having the same number of owned properties (keys incorporates hasOwnProperty)\n if (ka.length !== kb.length) { return false; }\n\n // the same set of keys (although not necessarily the same order),\n ka.sort();\n kb.sort();\n // ~~~cheap key test\n for (i = ka.length - 1; i >= 0; i--) {\n if (ka[i] != kb[i]) { return false; }\n }\n // equivalent values for every corresponding key, and ~~~possibly expensive deep test\n for (i = ka.length - 1; i >= 0; i--) {\n key = ka[i];\n if (!deepEqual(a[key], b[key], opts)) { return false; }\n }\n\n return true;\n}\n\nmodule.exports = deepEqual;\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMzYuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvZGVlcC1lcXVhbC9pbmRleC5qcz83ZmFlIl0sInNvdXJjZXNDb250ZW50IjpbInZhciBvYmplY3RLZXlzID0gcmVxdWlyZSgnb2JqZWN0LWtleXMnKTtcbnZhciBpc0FyZ3VtZW50cyA9IHJlcXVpcmUoJ2lzLWFyZ3VtZW50cycpO1xudmFyIGlzID0gcmVxdWlyZSgnb2JqZWN0LWlzJyk7XG52YXIgaXNSZWdleCA9IHJlcXVpcmUoJ2lzLXJlZ2V4Jyk7XG52YXIgZmxhZ3MgPSByZXF1aXJlKCdyZWdleHAucHJvdG90eXBlLmZsYWdzJyk7XG52YXIgaXNEYXRlID0gcmVxdWlyZSgnaXMtZGF0ZS1vYmplY3QnKTtcblxudmFyIGdldFRpbWUgPSBEYXRlLnByb3RvdHlwZS5nZXRUaW1lO1xuXG5mdW5jdGlvbiBkZWVwRXF1YWwoYWN0dWFsLCBleHBlY3RlZCwgb3B0aW9ucykge1xuICB2YXIgb3B0cyA9IG9wdGlvbnMgfHwge307XG5cbiAgLy8gNy4xLiBBbGwgaWRlbnRpY2FsIHZhbHVlcyBhcmUgZXF1aXZhbGVudCwgYXMgZGV0ZX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FBQUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7Iiwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///36\n")},function(module,exports,__webpack_require__){"use strict";eval("\n\nvar slice = Array.prototype.slice;\nvar isArgs = __webpack_require__(38);\n\nvar origKeys = Object.keys;\nvar keysShim = origKeys ? function keys(o) { return origKeys(o); } : __webpack_require__(48);\n\nvar originalKeys = Object.keys;\n\nkeysShim.shim = function shimObjectKeys() {\n\tif (Object.keys) {\n\t\tvar keysWorksWithArguments = (function () {\n\t\t\t// Safari 5.0 bug\n\t\t\tvar args = Object.keys(arguments);\n\t\t\treturn args && args.length === arguments.length;\n\t\t}(1, 2));\n\t\tif (!keysWorksWithArguments) {\n\t\t\tObject.keys = function keys(object) { // eslint-disable-line func-name-matching\n\t\t\t\tif (isArgs(object)) {\n\t\t\t\t\treturn originalKeys(slice.call(object));\n\t\t\t\t}\n\t\t\t\treturn originalKeys(object);\n\t\t\t};\n\t\t}\n\t} else {\n\t\tObject.keys = keysShim;\n\t}\n\treturn Object.keys || keysShim;\n};\n\nmodule.exports = keysShim;\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMzcuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvb2JqZWN0LWtleXMvaW5kZXguanM/ZDZjNyJdLCJzb3VyY2VzQ29udGVudCI6WyIndXNlIHN0cmljdCc7XG5cbnZhciBzbGljZSA9IEFycmF5LnByb3RvdHlwZS5zbGljZTtcbnZhciBpc0FyZ3MgPSByZXF1aXJlKCcuL2lzQXJndW1lbnRzJyk7XG5cbnZhciBvcmlnS2V5cyA9IE9iamVjdC5rZXlzO1xudmFyIGtleXNTaGltID0gb3JpZ0tleXMgPyBmdW5jdGlvbiBrZXlzKG8pIHsgcmV0dXJuIG9yaWdLZXlzKG8pOyB9IDogcmVxdWlyZSgnLi9pbXBsZW1lbnRhdGlvbicpO1xuXG52YXIgb3JpZ2luYWxLZXlzID0gT2JqZWN0LmtleXM7XG5cbmtleXNTaGltLnNoaW0gPSBmdW5jdGlvbiBzaGltT2JqZWN0S2V5cygpIHtcblx0aWYgKE9iamVjdC5rZXlzKSB7XG5cdFx0dmFyIGtleXNXb3Jrc1dpdGhBcmd1bWVudHMgPSAoZnVuY3Rpb24gKCkge1xuXHRcdFx0Ly8gU2FmYXJpIDUuMCBidWdcblx0XHRcdHZhciBhcmdzID0gT2JqZWN0LmtleXMoYXJndW1lbnRzKTtcblx0XHRcdHJldHVybiBhcmdzICYmIGFyZ3MubGVuZ3RoID09PSBhcmd1bWVudHMubGVuZ3RoO1xuXHRcdH0oMSwgMikpO1xuXHRcdGlmICgha2V5c1dvcmtzV2l0aEFyZ3VtZW50cykge1xuXHRcdFx0T2JqZWN0LmtleXMgPSBmdW5jdGlvbiBrZXlzKG9iamVjdCkgeyAvLyBlc2xpbnQtZGlzYWJsZS1saW5lIGZ1bmMtbmFtZS1tYXRjaGluZ1xuXHRcdFx0XHRpZiAoaXNBcmdzKG9iamVjdCkpIHtcblx0XHRcdFx0XHRyZXR1cm4gb3JpZ2luYWxLZXlzKHNsaWNlLmNhbGwob2JqZWN0KSk7XG5cdFx0XHRcdH1cblx0XHRcdFx0cmV0dXJuIG9yaWdpbmFsS2V5cyhvYmplY3QpO1xuXHRcdFx0fTtcblx0XHR9XG5cdH0gZWxzZSB7XG5cdFx0T2JqZWN0LmtleXMgPSBrZXlzU2hpbTtcblx0fVxuXHRyZXR1cm4gT2JqZWN0LmtleXMgfHwga2V5c1NoaW07XG59O1xuXG5tb2R1bGUuZXhwb3J0cyA9IGtleXNTaGltO1xuIl0sIm1hcHBpbmdzIjoiQUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOyIsInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///37\n")},function(module,exports,__webpack_require__){"use strict";eval("\n\nvar toStr = Object.prototype.toString;\n\nmodule.exports = function isArguments(value) {\n\tvar str = toStr.call(value);\n\tvar isArgs = str === '[object Arguments]';\n\tif (!isArgs) {\n\t\tisArgs = str !== '[object Array]' &&\n\t\t\tvalue !== null &&\n\t\t\ttypeof value === 'object' &&\n\t\t\ttypeof value.length === 'number' &&\n\t\t\tvalue.length >= 0 &&\n\t\t\ttoStr.call(value.callee) === '[object Function]';\n\t}\n\treturn isArgs;\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMzguanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvb2JqZWN0LWtleXMvaXNBcmd1bWVudHMuanM/ZDRhYiJdLCJzb3VyY2VzQ29udGVudCI6WyIndXNlIHN0cmljdCc7XG5cbnZhciB0b1N0ciA9IE9iamVjdC5wcm90b3R5cGUudG9TdHJpbmc7XG5cbm1vZHVsZS5leHBvcnRzID0gZnVuY3Rpb24gaXNBcmd1bWVudHModmFsdWUpIHtcblx0dmFyIHN0ciA9IHRvU3RyLmNhbGwodmFsdWUpO1xuXHR2YXIgaXNBcmdzID0gc3RyID09PSAnW29iamVjdCBBcmd1bWVudHNdJztcblx0aWYgKCFpc0FyZ3MpIHtcblx0XHRpc0FyZ3MgPSBzdHIgIT09ICdbb2JqZWN0IEFycmF5XScgJiZcblx0XHRcdHZhbHVlICE9PSBudWxsICYmXG5cdFx0XHR0eXBlb2YgdmFsdWUgPT09ICdvYmplY3QnICYmXG5cdFx0XHR0eXBlb2YgdmFsdWUubGVuZ3RoID09PSAnbnVtYmVyJyAmJlxuXHRcdFx0dmFsdWUubGVuZ3RoID49IDAgJiZcblx0XHRcdHRvU3RyLmNhbGwodmFsdWUuY2FsbGVlKSA9PT0gJ1tvYmplY3QgRnVuY3Rpb25dJztcblx0fVxuXHRyZXR1cm4gaXNBcmdzO1xufTtcbiJdLCJtYXBwaW5ncyI6IkFBQUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTsiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///38\n")},function(module,exports,__webpack_require__){"use strict";eval("\n\nvar toObject = Object;\nvar TypeErr = TypeError;\n\nmodule.exports = function flags() {\n\tif (this != null && this !== toObject(this)) {\n\t\tthrow new TypeErr('RegExp.prototype.flags getter called on non-object');\n\t}\n\tvar result = '';\n\tif (this.global) {\n\t\tresult += 'g';\n\t}\n\tif (this.ignoreCase) {\n\t\tresult += 'i';\n\t}\n\tif (this.multiline) {\n\t\tresult += 'm';\n\t}\n\tif (this.dotAll) {\n\t\tresult += 's';\n\t}\n\tif (this.unicode) {\n\t\tresult += 'u';\n\t}\n\tif (this.sticky) {\n\t\tresult += 'y';\n\t}\n\treturn result;\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMzkuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvcmVnZXhwLnByb3RvdHlwZS5mbGFncy9pbXBsZW1lbnRhdGlvbi5qcz81NzA4Il0sInNvdXJjZXNDb250ZW50IjpbIid1c2Ugc3RyaWN0JztcblxudmFyIHRvT2JqZWN0ID0gT2JqZWN0O1xudmFyIFR5cGVFcnIgPSBUeXBlRXJyb3I7XG5cbm1vZHVsZS5leHBvcnRzID0gZnVuY3Rpb24gZmxhZ3MoKSB7XG5cdGlmICh0aGlzICE9IG51bGwgJiYgdGhpcyAhPT0gdG9PYmplY3QodGhpcykpIHtcblx0XHR0aHJvdyBuZXcgVHlwZUVycignUmVnRXhwLnByb3RvdHlwZS5mbGFncyBnZXR0ZXIgY2FsbGVkIG9uIG5vbi1vYmplY3QnKTtcblx0fVxuXHR2YXIgcmVzdWx0ID0gJyc7XG5cdGlmICh0aGlzLmdsb2JhbCkge1xuXHRcdHJlc3VsdCArPSAnZyc7XG5cdH1cblx0aWYgKHRoaXMuaWdub3JlQ2FzZSkge1xuXHRcdHJlc3VsdCArPSAnaSc7XG5cdH1cblx0aWYgKHRoaXMubXVsdGlsaW5lKSB7XG5cdFx0cmVzdWx0ICs9ICdtJztcblx0fVxuXHRpZiAodGhpcy5kb3RBbGwpIHtcblx0XHRyZXN1bHQgKz0gJ3MnO1xuXHR9XG5cdGlmICh0aGlzLnVuaWNvZGUpIHtcblx0XHRyZXN1bHQgKz0gJ3UnO1xuXHR9XG5cdGlmICh0aGlzLnN0aWNreSkge1xuXHRcdHJlc3VsdCArPSAneSc7XG5cdH1cblx0cmV0dXJuIHJlc3VsdDtcbn07XG4iXSwibWFwcGluZ3MiOiJBQUFBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTsiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///39\n")},function(module,exports,__webpack_require__){"use strict";eval("\n\nvar implementation = __webpack_require__(39);\n\nvar supportsDescriptors = __webpack_require__(15).supportsDescriptors;\nvar gOPD = Object.getOwnPropertyDescriptor;\nvar TypeErr = TypeError;\n\nmodule.exports = function getPolyfill() {\n\tif (!supportsDescriptors) {\n\t\tthrow new TypeErr('RegExp.prototype.flags requires a true ES5 environment that supports property descriptors');\n\t}\n\tif (/a/mig.flags === 'gim') {\n\t\tvar descriptor = gOPD(RegExp.prototype, 'flags');\n\t\tif (descriptor && typeof descriptor.get === 'function' && typeof (/a/).dotAll === 'boolean') {\n\t\t\treturn descriptor.get;\n\t\t}\n\t}\n\treturn implementation;\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNDAuanMiLCJzb3Vy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Q0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7Iiwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///40\n")},function(module,exports,__webpack_require__){"use strict";eval("\n\nvar hasOwn = Object.prototype.hasOwnProperty;\nvar toStr = Object.prototype.toString;\nvar defineProperty = Object.defineProperty;\nvar gOPD = Object.getOwnPropertyDescriptor;\n\nvar isArray = function isArray(arr) {\n\tif (typeof Array.isArray === 'function') {\n\t\treturn Array.isArray(arr);\n\t}\n\n\treturn toStr.call(arr) === '[object Array]';\n};\n\nvar isPlainObject = function isPlainObject(obj) {\n\tif (!obj || toStr.call(obj) !== '[object Object]') {\n\t\treturn false;\n\t}\n\n\tvar hasOwnConstructor = hasOwn.call(obj, 'constructor');\n\tvar hasIsPrototypeOf = obj.constructor && obj.constructor.prototype && hasOwn.call(obj.constructor.prototype, 'isPrototypeOf');\n\t// Not own constructor property must be Object\n\tif (obj.constructor && !hasOwnConstructor && !hasIsPrototypeOf) {\n\t\treturn false;\n\t}\n\n\t// Own properties are enumerated firstly, so to speed up,\n\t// if last one is own, then all properties are own.\n\tvar key;\n\tfor (key in obj) { /**/ }\n\n\treturn typeof key === 'undefined' || hasOwn.call(obj, key);\n};\n\n// If name is '__proto__', and Object.defineProperty is available, define __proto__ as an own property on target\nvar setProperty = function setProperty(target, options) {\n\tif (defineProperty && options.name === '__proto__') {\n\t\tdefineProperty(target, options.name, {\n\t\t\tenumerable: true,\n\t\t\tconfigurable: true,\n\t\t\tvalue: options.newValue,\n\t\t\twritable: true\n\t\t});\n\t} else {\n\t\ttarget[options.name] = options.newValue;\n\t}\n};\n\n// Return undefined instead of __proto__ if '__proto__' is not an own property\nvar getProperty = function getProperty(obj, name) {\n\tif (name === '__proto__') {\n\t\tif (!hasOwn.call(obj, name)) {\n\t\t\treturn void 0;\n\t\t} else if (gOPD) {\n\t\t\t// In early versions of node, obj['__proto__'] is buggy when obj has\n\t\t\t// __proto__ as an own property. Object.getOwnPropertyDescriptor() works.\n\t\t\treturn gOPD(obj, name).value;\n\t\t}\n\t}\n\n\treturn obj[name];\n};\n\nmodule.exports = function extend() {\n\tvar options, name, src, copy, copyIsArray, clone;\n\tvar target = arguments[0];\n\tvar i = 1;\n\tvar length = arguments.length;\n\tvar deep = false;\n\n\t// Handle a deep copy situation\n\tif (typeof target === 'boolean') {\n\t\tdeep = target;\n\t\ttarget = arguments[1] || {};\n\t\t// skip the boolean and the target\n\t\ti = 2;\n\t}\n\tif (target == null || (typeof target !== 'object' && typeof target !== 'function')) {\n\t\ttarget = {};\n\t}\n\n\tfor (; i < length; ++i) {\n\t\toptions = arguments[i];\n\t\t// Only deal with non-null/undefined values\n\t\tif (options != null) {\n\t\t\t// Extend the base object\n\t\t\tfor (name in options) {\n\t\t\t\tsrc = getProperty(target, name);\n\t\t\t\tcopy = getProperty(options, name);\n\n\t\t\t\t// Prevent never-ending loop\n\t\t\t\tif (target !== copy) {\n\t\t\t\t\t// Recurse if we're merging plain objects or arrays\n\t\t\t\t\tif (deep && copy && (isPlainObject(copy) || (copyIsArray = isArray(copy)))) {\n\t\t\t\t\t\tif (copyIsArray) {\n\t\t\t\t\t\t\tcopyIsArray = false;\n\t\t\t\t\t\t\tclone = src && isArray(src) ? src : [];\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tclone = src && isPlainObject(src) ? src : {};\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Never move original objects, clone them\n\t\t\t\t\t\tsetProperty(target, { name: name, newValue: extend(deep, clone, copy) });\n\n\t\t\t\t\t// Don't bring in undefined values\n\t\t\t\t\t} else if (typeof copy !== 'undefined') {\n\t\t\t\t\t\tsetProperty(target, { name: name, newValue: copy });\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Return the modified object\n\treturn target;\n};\n//# sourceURL=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DQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTsiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///41\n")},function(module,exports,__webpack_require__){"use strict";eval("\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar Iterator_1 = __importDefault(__webpack_require__(60));\nvar Op;\n(function (Op) {\n function iterator(ops) {\n return new Iterator_1.default(ops);\n }\n Op.iterator = iterator;\n function length(op) {\n if (typeof op.delete === 'number') {\n return op.delete;\n }\n else if (typeof op.retain === 'number') {\n return op.retain;\n }\n else {\n return typeof op.insert === 'string' ? op.insert.length : 1;\n }\n }\n Op.length = length;\n})(Op || (Op = {}));\nexports.default = Op;\n//# sourceMappingURL=Op.js.map//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNDIuanMiLCJzb3VyY2VzIjpbIndlYn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sZW5ndGg7XG59KShPcCB8fCAoT3AgPSB7fSkpO1xuZXhwb3J0cy5kZWZhdWx0ID0gT3A7XG4vLyMgc291cmNlTWFwcGluZ1VSTD1PcC5qcy5tYXAiXSwibWFwcGluZ3MiOiJBQUFBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQSIsInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///42\n")},function(module,exports,__webpack_require__){"use strict";eval("/* WEBPACK VAR INJECTION */(function(global) {/*!\n * The buffer module from node.js, for the browser.\n *\n * @author Feross Aboukhadijeh \n * @license MIT\n */\n/* eslint-disable no-proto */\n\n\n\nvar base64 = __webpack_require__(45)\nvar ieee754 = __webpack_require__(46)\nvar isArray = __webpack_require__(47)\n\nexports.Buffer = Buffer\nexports.SlowBuffer = SlowBuffer\nexports.INSPECT_MAX_BYTES = 50\n\n/**\n * If `Buffer.TYPED_ARRAY_SUPPORT`:\n * === true Use Uint8Array implementation (fastest)\n * === false Use Object implementation (most compatible, even IE6)\n *\n * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,\n * Opera 11.6+, iOS 4.2+.\n *\n * Due to various browser bugs, sometimes the Object implementation will be used even\n * when the browser supports typed arrays.\n *\n * Note:\n *\n * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,\n * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.\n *\n * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.\n *\n * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of\n * incorrect length in some situations.\n\n * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they\n * get the Object implementation, which is slower but behaves correctly.\n */\nBuffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined\n ? global.TYPED_ARRAY_SUPPORT\n : typedArraySupport()\n\n/*\n * Export kMaxLength after typed array support is determined.\n */\nexports.kMaxLength = kMaxLength()\n\nfunction typedArraySupport () {\n try {\n var arr = new Uint8Array(1)\n arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}\n return arr.foo() === 42 && // typed array instances can be augmented\n typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`\n arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`\n } catch (e) {\n return false\n }\n}\n\nfunction kMaxLength () {\n return Buffer.TYPED_ARRAY_SUPPORT\n ? 0x7fffffff\n : 0x3fffffff\n}\n\nfunction createBuffer (that, length) {\n if (kMaxLength() < length) {\n throw new RangeError('Invalid typed array length')\n }\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n // Return an augmented `Uint8Array` instance, for best performance\n that = new Uint8Array(length)\n that.__proto__ = Buffer.prototype\n } else {\n // Fallback: Return an object instance of the Buffer class\n if (that === null) {\n that = new Buffer(length)\n }\n that.length = length\n }\n\n return that\n}\n\n/**\n * The Buffer constructor returns instances of `Uint8Array` that have their\n * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of\n * `Uint8Array`, so the returned instances will have all the node `Buffer` methods\n * and the `Uint8Array` methods. Square bracket notation works as expected -- it\n * returns a single octet.\n *\n * The `Uint8Array` prototype remains unmodified.\n */\n\nfunction Buffer (arg, encodingOrOffset, length) {\n if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {\n return new Buffer(arg, encodingOrOffset, length)\n }\n\n // Common case.\n if (typeof arg === 'number') {\n if (typeof encodingOrOffset === 'string') {\n throw new Error(\n 'If encoding is specified then the first argument must be a string'\n )\n }\n return allocUnsafe(this, arg)\n }\n return from(this, arg, encodingOrOffset, length)\n}\n\nBuffer.poolSize = 8192 // not used by this implementation\n\n// TODO: Legacy, not needed anymore. Remove in next major version.\nBuffer._augment = function (arr) {\n arr.__proto__ = Buffer.prototype\n return arr\n}\n\nfunction from (that, value, encodingOrOffset, length) {\n if (typeof value === 'number') {\n throw new TypeError('\"value\" argument must not be a number')\n }\n\n if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {\n return fromArrayBuffer(that, value, encodingOrOffset, length)\n }\n\n if (typeof value === 'string') {\n return fromString(that, value, encodingOrOffset)\n }\n\n return fromObject(that, value)\n}\n\n/**\n * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError\n * if value is a number.\n * Buffer.from(str[, encoding])\n * Buffer.from(array)\n * Buffer.from(buffer)\n * Buffer.from(arrayBuffer[, byteOffset[, length]])\n **/\nBuffer.from = function (value, encodingOrOffset, length) {\n return from(null, value, encodingOrOffset, length)\n}\n\nif (Buffer.TYPED_ARRAY_SUPPORT) {\n Buffer.prototype.__proto__ = Uint8Array.prototype\n Buffer.__proto__ = Uint8Array\n if (typeof Symbol !== 'undefined' && Symbol.species &&\n Buffer[Symbol.species] === Buffer) {\n // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97\n Object.defineProperty(Buffer, Symbol.species, {\n value: null,\n configurable: true\n })\n }\n}\n\nfunction assertSize (size) {\n if (typeof size !== 'number') {\n throw new TypeError('\"size\" argument must be a number')\n } else if (size < 0) {\n throw new RangeError('\"size\" argument must not be negative')\n }\n}\n\nfunction alloc (that, size, fill, encoding) {\n assertSize(size)\n if (size <= 0) {\n return createBuffer(that, size)\n }\n if (fill !== undefined) {\n // Only pay attention to encoding if it's a string. This\n // prevents accidentally sending in a number that would\n // be interpretted as a start offset.\n return typeof encoding === 'string'\n ? createBuffer(that, size).fill(fill, encoding)\n : createBuffer(that, size).fill(fill)\n }\n return createBuffer(that, size)\n}\n\n/**\n * Creates a new filled Buffer instance.\n * alloc(size[, fill[, encoding]])\n **/\nBuffer.alloc = function (size, fill, encoding) {\n return alloc(null, size, fill, encoding)\n}\n\nfunction allocUnsafe (that, size) {\n assertSize(size)\n that = createBuffer(that, size < 0 ? 0 : checked(size) | 0)\n if (!Buffer.TYPED_ARRAY_SUPPORT) {\n for (var i = 0; i < size; ++i) {\n that[i] = 0\n }\n }\n return that\n}\n\n/**\n * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.\n * */\nBuffer.allocUnsafe = function (size) {\n return allocUnsafe(null, size)\n}\n/**\n * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.\n */\nBuffer.allocUnsafeSlow = function (size) {\n return allocUnsafe(null, size)\n}\n\nfunction fromString (that, string, encoding) {\n if (typeof encoding !== 'string' || encoding === '') {\n encoding = 'utf8'\n }\n\n if (!Buffer.isEncoding(encoding)) {\n throw new TypeError('\"encoding\" must be a valid string encoding')\n }\n\n var length = byteLength(string, encoding) | 0\n that = createBuffer(that, length)\n\n var actual = that.write(string, encoding)\n\n if (actual !== length) {\n // Writing a hex string, for example, that contains invalid characters will\n // cause everything after the first invalid character to be ignored. (e.g.\n // 'abxxcd' will be treated as 'ab')\n that = that.slice(0, actual)\n }\n\n return that\n}\n\nfunction fromArrayLike (that, array) {\n var length = array.length < 0 ? 0 : checked(array.length) | 0\n that = createBuffer(that, length)\n for (var i = 0; i < length; i += 1) {\n that[i] = array[i] & 255\n }\n return that\n}\n\nfunction fromArrayBuffer (that, array, byteOffset, length) {\n array.byteLength // this throws if `array` is not a valid ArrayBuffer\n\n if (byteOffset < 0 || array.byteLength < byteOffset) {\n throw new RangeError('\\'offset\\' is out of bounds')\n }\n\n if (array.byteLength < byteOffset + (length || 0)) {\n throw new RangeError('\\'length\\' is out of bounds')\n }\n\n if (byteOffset === undefined && length === undefined) {\n array = new Uint8Array(array)\n } else if (length === undefined) {\n array = new Uint8Array(array, byteOffset)\n } else {\n array = new Uint8Array(array, byteOffset, length)\n }\n\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n // Return an augmented `Uint8Array` instance, for best performance\n that = array\n that.__proto__ = Buffer.prototype\n } else {\n // Fallback: Return an object instance of the Buffer class\n that = fromArrayLike(that, array)\n }\n return that\n}\n\nfunction fromObject (that, obj) {\n if (Buffer.isBuffer(obj)) {\n var len = checked(obj.length) | 0\n that = createBuffer(that, len)\n\n if (that.length === 0) {\n return that\n }\n\n obj.copy(that, 0, 0, len)\n return that\n }\n\n if (obj) {\n if ((typeof ArrayBuffer !== 'undefined' &&\n obj.buffer instanceof ArrayBuffer) || 'length' in obj) {\n if (typeof obj.length !== 'number' || isnan(obj.length)) {\n return createBuffer(that, 0)\n }\n return fromArrayLike(that, obj)\n }\n\n if (obj.type === 'Buffer' && isArray(obj.data)) {\n return fromArrayLike(that, obj.data)\n }\n }\n\n throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')\n}\n\nfunction checked (length) {\n // Note: cannot use `length < kMaxLength()` here because that fails when\n // length is NaN (which is otherwise coerced to zero.)\n if (length >= kMaxLength()) {\n throw new RangeError('Attempt to allocate Buffer larger than maximum ' +\n 'size: 0x' + kMaxLength().toString(16) + ' bytes')\n }\n return length | 0\n}\n\nfunction SlowBuffer (length) {\n if (+length != length) { // eslint-disable-line eqeqeq\n length = 0\n }\n return Buffer.alloc(+length)\n}\n\nBuffer.isBuffer = function isBuffer (b) {\n return !!(b != null && b._isBuffer)\n}\n\nBuffer.compare = function compare (a, b) {\n if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {\n throw new TypeError('Arguments must be Buffers')\n }\n\n if (a === b) return 0\n\n var x = a.length\n var y = b.length\n\n for (var i = 0, len = Math.min(x, y); i < len; ++i) {\n if (a[i] !== b[i]) {\n x = a[i]\n y = b[i]\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\nBuffer.isEncoding = function isEncoding (encoding) {\n switch (String(encoding).toLowerCase()) {\n case 'hex':\n case 'utf8':\n case 'utf-8':\n case 'ascii':\n case 'latin1':\n case 'binary':\n case 'base64':\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return true\n default:\n return false\n }\n}\n\nBuffer.concat = function concat (list, length) {\n if (!isArray(list)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n }\n\n if (list.length === 0) {\n return Buffer.alloc(0)\n }\n\n var i\n if (length === undefined) {\n length = 0\n for (i = 0; i < list.length; ++i) {\n length += list[i].length\n }\n }\n\n var buffer = Buffer.allocUnsafe(length)\n var pos = 0\n for (i = 0; i < list.length; ++i) {\n var buf = list[i]\n if (!Buffer.isBuffer(buf)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n }\n buf.copy(buffer, pos)\n pos += buf.length\n }\n return buffer\n}\n\nfunction byteLength (string, encoding) {\n if (Buffer.isBuffer(string)) {\n return string.length\n }\n if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&\n (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {\n return string.byteLength\n }\n if (typeof string !== 'string') {\n string = '' + string\n }\n\n var len = string.length\n if (len === 0) return 0\n\n // Use a for loop to avoid recursion\n var loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'ascii':\n case 'latin1':\n case 'binary':\n return len\n case 'utf8':\n case 'utf-8':\n case undefined:\n return utf8ToBytes(string).length\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return len * 2\n case 'hex':\n return len >>> 1\n case 'base64':\n return base64ToBytes(string).length\n default:\n if (loweredCase) return utf8ToBytes(string).length // assume utf8\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\nBuffer.byteLength = byteLength\n\nfunction slowToString (encoding, start, end) {\n var loweredCase = false\n\n // No need to verify that \"this.length <= MAX_UINT32\" since it's a read-only\n // property of a typed array.\n\n // This behaves neither like String nor Uint8Array in that we set start/end\n // to their upper/lower bounds if the value passed is out of range.\n // undefined is handled specially as per ECMA-262 6th Edition,\n // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.\n if (start === undefined || start < 0) {\n start = 0\n }\n // Return early if start > this.length. Done here to prevent potential uint32\n // coercion fail below.\n if (start > this.length) {\n return ''\n }\n\n if (end === undefined || end > this.length) {\n end = this.length\n }\n\n if (end <= 0) {\n return ''\n }\n\n // Force coersion to uint32. This will also coerce falsey/NaN values to 0.\n end >>>= 0\n start >>>= 0\n\n if (end <= start) {\n return ''\n }\n\n if (!encoding) encoding = 'utf8'\n\n while (true) {\n switch (encoding) {\n case 'hex':\n return hexSlice(this, start, end)\n\n case 'utf8':\n case 'utf-8':\n return utf8Slice(this, start, end)\n\n case 'ascii':\n return asciiSlice(this, start, end)\n\n case 'latin1':\n case 'binary':\n return latin1Slice(this, start, end)\n\n case 'base64':\n return base64Slice(this, start, end)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return utf16leSlice(this, start, end)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = (encoding + '').toLowerCase()\n loweredCase = true\n }\n }\n}\n\n// The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect\n// Buffer instances.\nBuffer.prototype._isBuffer = true\n\nfunction swap (b, n, m) {\n var i = b[n]\n b[n] = b[m]\n b[m] = i\n}\n\nBuffer.prototype.swap16 = function swap16 () {\n var len = this.length\n if (len % 2 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 16-bits')\n }\n for (var i = 0; i < len; i += 2) {\n swap(this, i, i + 1)\n }\n return this\n}\n\nBuffer.prototype.swap32 = function swap32 () {\n var len = this.length\n if (len % 4 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 32-bits')\n }\n for (var i = 0; i < len; i += 4) {\n swap(this, i, i + 3)\n swap(this, i + 1, i + 2)\n }\n return this\n}\n\nBuffer.prototype.swap64 = function swap64 () {\n var len = this.length\n if (len % 8 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 64-bits')\n }\n for (var i = 0; i < len; i += 8) {\n swap(this, i, i + 7)\n swap(this, i + 1, i + 6)\n swap(this, i + 2, i + 5)\n swap(this, i + 3, i + 4)\n }\n return this\n}\n\nBuffer.prototype.toString = function toString () {\n var length = this.length | 0\n if (length === 0) return ''\n if (arguments.length === 0) return utf8Slice(this, 0, length)\n return slowToString.apply(this, arguments)\n}\n\nBuffer.prototype.equals = function equals (b) {\n if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')\n if (this === b) return true\n return Buffer.compare(this, b) === 0\n}\n\nBuffer.prototype.inspect = function inspect () {\n var str = ''\n var max = exports.INSPECT_MAX_BYTES\n if (this.length > 0) {\n str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')\n if (this.length > max) str += ' ... '\n }\n return ''\n}\n\nBuffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {\n if (!Buffer.isBuffer(target)) {\n throw new TypeError('Argument must be a Buffer')\n }\n\n if (start === undefined) {\n start = 0\n }\n if (end === undefined) {\n end = target ? target.length : 0\n }\n if (thisStart === undefined) {\n thisStart = 0\n }\n if (thisEnd === undefined) {\n thisEnd = this.length\n }\n\n if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {\n throw new RangeError('out of range index')\n }\n\n if (thisStart >= thisEnd && start >= end) {\n return 0\n }\n if (thisStart >= thisEnd) {\n return -1\n }\n if (start >= end) {\n return 1\n }\n\n start >>>= 0\n end >>>= 0\n thisStart >>>= 0\n thisEnd >>>= 0\n\n if (this === target) return 0\n\n var x = thisEnd - thisStart\n var y = end - start\n var len = Math.min(x, y)\n\n var thisCopy = this.slice(thisStart, thisEnd)\n var targetCopy = target.slice(start, end)\n\n for (var i = 0; i < len; ++i) {\n if (thisCopy[i] !== targetCopy[i]) {\n x = thisCopy[i]\n y = targetCopy[i]\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\n// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,\n// OR the last index of `val` in `buffer` at offset <= `byteOffset`.\n//\n// Arguments:\n// - buffer - a Buffer to search\n// - val - a string, Buffer, or number\n// - byteOffset - an index into `buffer`; will be clamped to an int32\n// - encoding - an optional encoding, relevant is val is a string\n// - dir - true for indexOf, false for lastIndexOf\nfunction bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {\n // Empty buffer means no match\n if (buffer.length === 0) return -1\n\n // Normalize byteOffset\n if (typeof byteOffset === 'string') {\n encoding = byteOffset\n byteOffset = 0\n } else if (byteOffset > 0x7fffffff) {\n byteOffset = 0x7fffffff\n } else if (byteOffset < -0x80000000) {\n byteOffset = -0x80000000\n }\n byteOffset = +byteOffset // Coerce to Number.\n if (isNaN(byteOffset)) {\n // byteOffset: it it's undefined, null, NaN, \"foo\", etc, search whole buffer\n byteOffset = dir ? 0 : (buffer.length - 1)\n }\n\n // Normalize byteOffset: negative offsets start from the end of the buffer\n if (byteOffset < 0) byteOffset = buffer.length + byteOffset\n if (byteOffset >= buffer.length) {\n if (dir) return -1\n else byteOffset = buffer.length - 1\n } else if (byteOffset < 0) {\n if (dir) byteOffset = 0\n else return -1\n }\n\n // Normalize val\n if (typeof val === 'string') {\n val = Buffer.from(val, encoding)\n }\n\n // Finally, search either indexOf (if dir is true) or lastIndexOf\n if (Buffer.isBuffer(val)) {\n // Special case: looking for empty string/buffer always fails\n if (val.length === 0) {\n return -1\n }\n return arrayIndexOf(buffer, val, byteOffset, encoding, dir)\n } else if (typeof val === 'number') {\n val = val & 0xFF // Search for a byte value [0-255]\n if (Buffer.TYPED_ARRAY_SUPPORT &&\n typeof Uint8Array.prototype.indexOf === 'function') {\n if (dir) {\n return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)\n } else {\n return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)\n }\n }\n return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)\n }\n\n throw new TypeError('val must be string, number or Buffer')\n}\n\nfunction arrayIndexOf (arr, val, byteOffset, encoding, dir) {\n var indexSize = 1\n var arrLength = arr.length\n var valLength = val.length\n\n if (encoding !== undefined) {\n encoding = String(encoding).toLowerCase()\n if (encoding === 'ucs2' || encoding === 'ucs-2' ||\n encoding === 'utf16le' || encoding === 'utf-16le') {\n if (arr.length < 2 || val.length < 2) {\n return -1\n }\n indexSize = 2\n arrLength /= 2\n valLength /= 2\n byteOffset /= 2\n }\n }\n\n function read (buf, i) {\n if (indexSize === 1) {\n return buf[i]\n } else {\n return buf.readUInt16BE(i * indexSize)\n }\n }\n\n var i\n if (dir) {\n var foundIndex = -1\n for (i = byteOffset; i < arrLength; i++) {\n if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {\n if (foundIndex === -1) foundIndex = i\n if (i - foundIndex + 1 === valLength) return foundIndex * indexSize\n } else {\n if (foundIndex !== -1) i -= i - foundIndex\n foundIndex = -1\n }\n }\n } else {\n if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength\n for (i = byteOffset; i >= 0; i--) {\n var found = true\n for (var j = 0; j < valLength; j++) {\n if (read(arr, i + j) !== read(val, j)) {\n found = false\n break\n }\n }\n if (found) return i\n }\n }\n\n return -1\n}\n\nBuffer.prototype.includes = function includes (val, byteOffset, encoding) {\n return this.indexOf(val, byteOffset, encoding) !== -1\n}\n\nBuffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, true)\n}\n\nBuffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, false)\n}\n\nfunction hexWrite (buf, string, offset, length) {\n offset = Number(offset) || 0\n var remaining = buf.length - offset\n if (!length) {\n length = remaining\n } else {\n length = Number(length)\n if (length > remaining) {\n length = remaining\n }\n }\n\n // must be an even number of digits\n var strLen = string.length\n if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')\n\n if (length > strLen / 2) {\n length = strLen / 2\n }\n for (var i = 0; i < length; ++i) {\n var parsed = parseInt(string.substr(i * 2, 2), 16)\n if (isNaN(parsed)) return i\n buf[offset + i] = parsed\n }\n return i\n}\n\nfunction utf8Write (buf, string, offset, length) {\n return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nfunction asciiWrite (buf, string, offset, length) {\n return blitBuffer(asciiToBytes(string), buf, offset, length)\n}\n\nfunction latin1Write (buf, string, offset, length) {\n return asciiWrite(buf, string, offset, length)\n}\n\nfunction base64Write (buf, string, offset, length) {\n return blitBuffer(base64ToBytes(string), buf, offset, length)\n}\n\nfunction ucs2Write (buf, string, offset, length) {\n return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nBuffer.prototype.write = function write (string, offset, length, encoding) {\n // Buffer#write(string)\n if (offset === undefined) {\n encoding = 'utf8'\n length = this.length\n offset = 0\n // Buffer#write(string, encoding)\n } else if (length === undefined && typeof offset === 'string') {\n encoding = offset\n length = this.length\n offset = 0\n // Buffer#write(string, offset[, length][, encoding])\n } else if (isFinite(offset)) {\n offset = offset | 0\n if (isFinite(length)) {\n length = length | 0\n if (encoding === undefined) encoding = 'utf8'\n } else {\n encoding = length\n length = undefined\n }\n // legacy write(string, encoding, offset, length) - remove in v0.13\n } else {\n throw new Error(\n 'Buffer.write(string, encoding, offset[, length]) is no longer supported'\n )\n }\n\n var remaining = this.length - offset\n if (length === undefined || length > remaining) length = remaining\n\n if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {\n throw new RangeError('Attempt to write outside buffer bounds')\n }\n\n if (!encoding) encoding = 'utf8'\n\n var loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'hex':\n return hexWrite(this, string, offset, length)\n\n case 'utf8':\n case 'utf-8':\n return utf8Write(this, string, offset, length)\n\n case 'ascii':\n return asciiWrite(this, string, offset, length)\n\n case 'latin1':\n case 'binary':\n return latin1Write(this, string, offset, length)\n\n case 'base64':\n // Warning: maxLength not taken into account in base64Write\n return base64Write(this, string, offset, length)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return ucs2Write(this, string, offset, length)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\n\nBuffer.prototype.toJSON = function toJSON () {\n return {\n type: 'Buffer',\n data: Array.prototype.slice.call(this._arr || this, 0)\n }\n}\n\nfunction base64Slice (buf, start, end) {\n if (start === 0 && end === buf.length) {\n return base64.fromByteArray(buf)\n } else {\n return base64.fromByteArray(buf.slice(start, end))\n }\n}\n\nfunction utf8Slice (buf, start, end) {\n end = Math.min(buf.length, end)\n var res = []\n\n var i = start\n while (i < end) {\n var firstByte = buf[i]\n var codePoint = null\n var bytesPerSequence = (firstByte > 0xEF) ? 4\n : (firstByte > 0xDF) ? 3\n : (firstByte > 0xBF) ? 2\n : 1\n\n if (i + bytesPerSequence <= end) {\n var secondByte, thirdByte, fourthByte, tempCodePoint\n\n switch (bytesPerSequence) {\n case 1:\n if (firstByte < 0x80) {\n codePoint = firstByte\n }\n break\n case 2:\n secondByte = buf[i + 1]\n if ((secondByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)\n if (tempCodePoint > 0x7F) {\n codePoint = tempCodePoint\n }\n }\n break\n case 3:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)\n if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {\n codePoint = tempCodePoint\n }\n }\n break\n case 4:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n fourthByte = buf[i + 3]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)\n if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {\n codePoint = tempCodePoint\n }\n }\n }\n }\n\n if (codePoint === null) {\n // we did not generate a valid codePoint so insert a\n // replacement char (U+FFFD) and advance only 1 byte\n codePoint = 0xFFFD\n bytesPerSequence = 1\n } else if (codePoint > 0xFFFF) {\n // encode to utf16 (surrogate pair dance)\n codePoint -= 0x10000\n res.push(codePoint >>> 10 & 0x3FF | 0xD800)\n codePoint = 0xDC00 | codePoint & 0x3FF\n }\n\n res.push(codePoint)\n i += bytesPerSequence\n }\n\n return decodeCodePointsArray(res)\n}\n\n// Based on http://stackoverflow.com/a/22747272/680742, the browser with\n// the lowest limit is Chrome, with 0x10000 args.\n// We go 1 magnitude less, for safety\nvar MAX_ARGUMENTS_LENGTH = 0x1000\n\nfunction decodeCodePointsArray (codePoints) {\n var len = codePoints.length\n if (len <= MAX_ARGUMENTS_LENGTH) {\n return String.fromCharCode.apply(String, codePoints) // avoid extra slice()\n }\n\n // Decode in chunks to avoid \"call stack size exceeded\".\n var res = ''\n var i = 0\n while (i < len) {\n res += String.fromCharCode.apply(\n String,\n codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)\n )\n }\n return res\n}\n\nfunction asciiSlice (buf, start, end) {\n var ret = ''\n end = Math.min(buf.length, end)\n\n for (var i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i] & 0x7F)\n }\n return ret\n}\n\nfunction latin1Slice (buf, start, end) {\n var ret = ''\n end = Math.min(buf.length, end)\n\n for (var i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i])\n }\n return ret\n}\n\nfunction hexSlice (buf, start, end) {\n var len = buf.length\n\n if (!start || start < 0) start = 0\n if (!end || end < 0 || end > len) end = len\n\n var out = ''\n for (var i = start; i < end; ++i) {\n out += toHex(buf[i])\n }\n return out\n}\n\nfunction utf16leSlice (buf, start, end) {\n var bytes = buf.slice(start, end)\n var res = ''\n for (var i = 0; i < bytes.length; i += 2) {\n res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)\n }\n return res\n}\n\nBuffer.prototype.slice = function slice (start, end) {\n var len = this.length\n start = ~~start\n end = end === undefined ? len : ~~end\n\n if (start < 0) {\n start += len\n if (start < 0) start = 0\n } else if (start > len) {\n start = len\n }\n\n if (end < 0) {\n end += len\n if (end < 0) end = 0\n } else if (end > len) {\n end = len\n }\n\n if (end < start) end = start\n\n var newBuf\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n newBuf = this.subarray(start, end)\n newBuf.__proto__ = Buffer.prototype\n } else {\n var sliceLen = end - start\n newBuf = new Buffer(sliceLen, undefined)\n for (var i = 0; i < sliceLen; ++i) {\n newBuf[i] = this[i + start]\n }\n }\n\n return newBuf\n}\n\n/*\n * Need to make sure that buffer isn't trying to write out of bounds.\n */\nfunction checkOffset (offset, ext, length) {\n if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n}\n\nBuffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var val = this[offset]\n var mul = 1\n var i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) {\n checkOffset(offset, byteLength, this.length)\n }\n\n var val = this[offset + --byteLength]\n var mul = 1\n while (byteLength > 0 && (mul *= 0x100)) {\n val += this[offset + --byteLength] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 1, this.length)\n return this[offset]\n}\n\nBuffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n return this[offset] | (this[offset + 1] << 8)\n}\n\nBuffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n return (this[offset] << 8) | this[offset + 1]\n}\n\nBuffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return ((this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16)) +\n (this[offset + 3] * 0x1000000)\n}\n\nBuffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] * 0x1000000) +\n ((this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n this[offset + 3])\n}\n\nBuffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var val = this[offset]\n var mul = 1\n var i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var i = byteLength\n var mul = 1\n var val = this[offset + --i]\n while (i > 0 && (mul *= 0x100)) {\n val += this[offset + --i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readInt8 = function readInt8 (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 1, this.length)\n if (!(this[offset] & 0x80)) return (this[offset])\n return ((0xff - this[offset] + 1) * -1)\n}\n\nBuffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n var val = this[offset] | (this[offset + 1] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n var val = this[offset + 1] | (this[offset] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16) |\n (this[offset + 3] << 24)\n}\n\nBuffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] << 24) |\n (this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n (this[offset + 3])\n}\n\nBuffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, true, 23, 4)\n}\n\nBuffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, false, 23, 4)\n}\n\nBuffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, true, 52, 8)\n}\n\nBuffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, false, 52, 8)\n}\n\nfunction checkInt (buf, value, offset, ext, max, min) {\n if (!Buffer.isBuffer(buf)) throw new TypeError('\"buffer\" argument must be a Buffer instance')\n if (value > max || value < min) throw new RangeError('\"value\" argument is out of bounds')\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n}\n\nBuffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) {\n var maxBytes = Math.pow(2, 8 * byteLength) - 1\n checkInt(this, value, offset, byteLength, maxBytes, 0)\n }\n\n var mul = 1\n var i = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) {\n var maxBytes = Math.pow(2, 8 * byteLength) - 1\n checkInt(this, value, offset, byteLength, maxBytes, 0)\n }\n\n var i = byteLength - 1\n var mul = 1\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)\n if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nfunction objectWriteUInt16 (buf, value, offset, littleEndian) {\n if (value < 0) value = 0xffff + value + 1\n for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {\n buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>\n (littleEndian ? i : 1 - i) * 8\n }\n}\n\nBuffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n } else {\n objectWriteUInt16(this, value, offset, true)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n } else {\n objectWriteUInt16(this, value, offset, false)\n }\n return offset + 2\n}\n\nfunction objectWriteUInt32 (buf, value, offset, littleEndian) {\n if (value < 0) value = 0xffffffff + value + 1\n for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {\n buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff\n }\n}\n\nBuffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset + 3] = (value >>> 24)\n this[offset + 2] = (value >>> 16)\n this[offset + 1] = (value >>> 8)\n this[offset] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, true)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, false)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) {\n var limit = Math.pow(2, 8 * byteLength - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n var i = 0\n var mul = 1\n var sub = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {\n sub = 1\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) {\n var limit = Math.pow(2, 8 * byteLength - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n var i = byteLength - 1\n var mul = 1\n var sub = 0\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {\n sub = 1\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)\n if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)\n if (value < 0) value = 0xff + value + 1\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nBuffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n } else {\n objectWriteUInt16(this, value, offset, true)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n } else {\n objectWriteUInt16(this, value, offset, false)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n this[offset + 2] = (value >>> 16)\n this[offset + 3] = (value >>> 24)\n } else {\n objectWriteUInt32(this, value, offset, true)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n if (value < 0) value = 0xffffffff + value + 1\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, false)\n }\n return offset + 4\n}\n\nfunction checkIEEE754 (buf, value, offset, ext, max, min) {\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n if (offset < 0) throw new RangeError('Index out of range')\n}\n\nfunction writeFloat (buf, value, offset, littleEndian, noAssert) {\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)\n }\n ieee754.write(buf, value, offset, littleEndian, 23, 4)\n return offset + 4\n}\n\nBuffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {\n return writeFloat(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {\n return writeFloat(this, value, offset, false, noAssert)\n}\n\nfunction writeDouble (buf, value, offset, littleEndian, noAssert) {\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)\n }\n ieee754.write(buf, value, offset, littleEndian, 52, 8)\n return offset + 8\n}\n\nBuffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {\n return writeDouble(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {\n return writeDouble(this, value, offset, false, noAssert)\n}\n\n// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)\nBuffer.prototype.copy = function copy (target, targetStart, start, end) {\n if (!start) start = 0\n if (!end && end !== 0) end = this.length\n if (targetStart >= target.length) targetStart = target.length\n if (!targetStart) targetStart = 0\n if (end > 0 && end < start) end = start\n\n // Copy 0 bytes; we're done\n if (end === start) return 0\n if (target.length === 0 || this.length === 0) return 0\n\n // Fatal error conditions\n if (targetStart < 0) {\n throw new RangeError('targetStart out of bounds')\n }\n if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')\n if (end < 0) throw new RangeError('sourceEnd out of bounds')\n\n // Are we oob?\n if (end > this.length) end = this.length\n if (target.length - targetStart < end - start) {\n end = target.length - targetStart + start\n }\n\n var len = end - start\n var i\n\n if (this === target && start < targetStart && targetStart < end) {\n // descending copy from end\n for (i = len - 1; i >= 0; --i) {\n target[i + targetStart] = this[i + start]\n }\n } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {\n // ascending copy from start\n for (i = 0; i < len; ++i) {\n target[i + targetStart] = this[i + start]\n }\n } else {\n Uint8Array.prototype.set.call(\n target,\n this.subarray(start, start + len),\n targetStart\n )\n }\n\n return len\n}\n\n// Usage:\n// buffer.fill(number[, offset[, end]])\n// buffer.fill(buffer[, offset[, end]])\n// buffer.fill(string[, offset[, end]][, encoding])\nBuffer.prototype.fill = function fill (val, start, end, encoding) {\n // Handle string cases:\n if (typeof val === 'string') {\n if (typeof start === 'string') {\n encoding = start\n start = 0\n end = this.length\n } else if (typeof end === 'string') {\n encoding = end\n end = this.length\n }\n if (val.length === 1) {\n var code = val.charCodeAt(0)\n if (code < 256) {\n val = code\n }\n }\n if (encoding !== undefined && typeof encoding !== 'string') {\n throw new TypeError('encoding must be a string')\n }\n if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {\n throw new TypeError('Unknown encoding: ' + encoding)\n }\n } else if (typeof val === 'number') {\n val = val & 255\n }\n\n // Invalid ranges are not set to a default, so can range check early.\n if (start < 0 || this.length < start || this.length < end) {\n throw new RangeError('Out of range index')\n }\n\n if (end <= start) {\n return this\n }\n\n start = start >>> 0\n end = end === undefined ? this.length : end >>> 0\n\n if (!val) val = 0\n\n var i\n if (typeof val === 'number') {\n for (i = start; i < end; ++i) {\n this[i] = val\n }\n } else {\n var bytes = Buffer.isBuffer(val)\n ? val\n : utf8ToBytes(new Buffer(val, encoding).toString())\n var len = bytes.length\n for (i = 0; i < end - start; ++i) {\n this[i + start] = bytes[i % len]\n }\n }\n\n return this\n}\n\n// HELPER FUNCTIONS\n// ================\n\nvar INVALID_BASE64_RE = /[^+\\/0-9A-Za-z-_]/g\n\nfunction base64clean (str) {\n // Node strips out invalid characters like \\n and \\t from the string, base64-js does not\n str = stringtrim(str).replace(INVALID_BASE64_RE, '')\n // Node converts strings with length < 2 to ''\n if (str.length < 2) return ''\n // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not\n while (str.length % 4 !== 0) {\n str = str + '='\n }\n return str\n}\n\nfunction stringtrim (str) {\n if (str.trim) return str.trim()\n return str.replace(/^\\s+|\\s+$/g, '')\n}\n\nfunction toHex (n) {\n if (n < 16) return '0' + n.toString(16)\n return n.toString(16)\n}\n\nfunction utf8ToBytes (string, units) {\n units = units || Infinity\n var codePoint\n var length = string.length\n var leadSurrogate = null\n var bytes = []\n\n for (var i = 0; i < length; ++i) {\n codePoint = string.charCodeAt(i)\n\n // is surrogate component\n if (codePoint > 0xD7FF && codePoint < 0xE000) {\n // last char was a lead\n if (!leadSurrogate) {\n // no lead yet\n if (codePoint > 0xDBFF) {\n // unexpected trail\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n } else if (i + 1 === length) {\n // unpaired lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n }\n\n // valid lead\n leadSurrogate = codePoint\n\n continue\n }\n\n // 2 leads in a row\n if (codePoint < 0xDC00) {\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n leadSurrogate = codePoint\n continue\n }\n\n // valid surrogate pair\n codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000\n } else if (leadSurrogate) {\n // valid bmp char, but last char was a lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n }\n\n leadSurrogate = null\n\n // encode utf8\n if (codePoint < 0x80) {\n if ((units -= 1) < 0) break\n bytes.push(codePoint)\n } else if (codePoint < 0x800) {\n if ((units -= 2) < 0) break\n bytes.push(\n codePoint >> 0x6 | 0xC0,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x10000) {\n if ((units -= 3) < 0) break\n bytes.push(\n codePoint >> 0xC | 0xE0,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x110000) {\n if ((units -= 4) < 0) break\n bytes.push(\n codePoint >> 0x12 | 0xF0,\n codePoint >> 0xC & 0x3F | 0x80,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else {\n throw new Error('Invalid code point')\n }\n }\n\n return bytes\n}\n\nfunction asciiToBytes (str) {\n var byteArray = []\n for (var i = 0; i < str.length; ++i) {\n // Node's code seems to be doing this and not & 0x7F..\n byteArray.push(str.charCodeAt(i) & 0xFF)\n }\n return byteArray\n}\n\nfunction utf16leToBytes (str, units) {\n var c, hi, lo\n var byteArray = []\n for (var i = 0; i < str.length; ++i) {\n if ((units -= 2) < 0) break\n\n c = str.charCodeAt(i)\n hi = c >> 8\n lo = c % 256\n byteArray.push(lo)\n byteArray.push(hi)\n }\n\n return byteArray\n}\n\nfunction base64ToBytes (str) {\n return base64.toByteArray(base64clean(str))\n}\n\nfunction blitBuffer (src, dst, offset, length) {\n for (var i = 0; i < length; ++i) {\n if ((i + offset >= dst.length) || (i >= src.length)) break\n dst[i + offset] = src[i]\n }\n return i\n}\n\nfunction isnan (val) {\n return val !== val // eslint-disable-line no-self-compare\n}\n\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(44)))//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNDMuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYnVmZmVyL2luZGV4LmpzP2I2MzkiXS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QUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QSIsInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///43\n")},function(module,exports){eval('var g;\n\n// This works in non-strict mode\ng = (function() {\n\treturn this;\n})();\n\ntry {\n\t// This works if eval is allowed (see CSP)\n\tg = g || new Function("return this")();\n} catch (e) {\n\t// This works if the window reference is available\n\tif (typeof window === "object") g = window;\n}\n\n// g can still be undefined, but nothing to do about it...\n// We return undefined, instead of nothing here, so it\'s\n// easier to handle this case. if(!global) { ...}\n\nmodule.exports = g;\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNDQuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vKHdlYnBhY2spL2J1aWxkaW4vZ2xvYmFsLmpzP2NkMDAiXSwic291cmNlc0NvbnRlbnQiOlsidmFyIGc7XG5cbi8vIFRoaXMgd29ya3MgaW4gbm9uLXN0cmljdCBtb2RlXG5nID0gKGZ1bmN0aW9uKCkge1xuXHRyZXR1cm4gdGhpcztcbn0pKCk7XG5cbnRyeSB7XG5cdC8vIFRoaXMgd29ya3MgaWYgZXZhbCBpcyBhbGxvd2VkIChzZWUgQ1NQKVxuXHRnID0gZyB8fCBuZXcgRnVuY3Rpb24oXCJyZXR1cm4gdGhpc1wiKSgpO1xufSBjYXRjaCAoZSkge1xuXHQvLyBUaGlzIHdvcmtzIGlmIHRoZSB3aW5kb3cgcmVmZXJlbmNlIGlzIGF2YWlsYWJsZVxuXHRpZiAodHlwZW9mIHdpbmRvdyA9PT0gXCJvYmplY3RcIikgZyA9IHdpbmRvdztcbn1cblxuLy8gZyBjYW4gc3RpbGwgYmUgdW5kZWZpbmVkLCBidXQgbm90aGluZyB0byBkbyBhYm91dCBpdC4uLlxuLy8gV2UgcmV0dXJuIHVuZGVmaW5lZCwgaW5zdGVhZCBvZiBub3RoaW5nIGhlcmUsIHNvIGl0J3Ncbi8vIGVhc2llciB0byBoYW5kbGUgdGhpcyBjYXNlLiBpZighZ2xvYmFsKSB7IC4uLn1cblxubW9kdWxlLmV4cG9ydHMgPSBnO1xuIl0sIm1hcHBpbmdzIjoiQUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOyIsInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///44\n')},function(module,exports,__webpack_require__){"use strict";eval("\n\nexports.byteLength = byteLength\nexports.toByteArray = toByteArray\nexports.fromByteArray = fromByteArray\n\nvar lookup = []\nvar revLookup = []\nvar Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array\n\nvar code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'\nfor (var i = 0, len = code.length; i < len; ++i) {\n lookup[i] = code[i]\n revLookup[code.charCodeAt(i)] = i\n}\n\n// Support decoding URL-safe base64 strings, as Node.js does.\n// See: https://en.wikipedia.org/wiki/Base64#URL_applications\nrevLookup['-'.charCodeAt(0)] = 62\nrevLookup['_'.charCodeAt(0)] = 63\n\nfunction getLens (b64) {\n var len = b64.length\n\n if (len % 4 > 0) {\n throw new Error('Invalid string. Length must be a multiple of 4')\n }\n\n // Trim off extra bytes after placeholder bytes are found\n // See: https://github.com/beatgammit/base64-js/issues/42\n var validLen = b64.indexOf('=')\n if (validLen === -1) validLen = len\n\n var placeHoldersLen = validLen === len\n ? 0\n : 4 - (validLen % 4)\n\n return [validLen, placeHoldersLen]\n}\n\n// base64 is 4/3 + up to two characters of the original data\nfunction byteLength (b64) {\n var lens = getLens(b64)\n var validLen = lens[0]\n var placeHoldersLen = lens[1]\n return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen\n}\n\nfunction _byteLength (b64, validLen, placeHoldersLen) {\n return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen\n}\n\nfunction toByteArray (b64) {\n var tmp\n var lens = getLens(b64)\n var validLen = lens[0]\n var placeHoldersLen = lens[1]\n\n var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))\n\n var curByte = 0\n\n // if there are placeholders, only get up to the last complete 4 chars\n var len = placeHoldersLen > 0\n ? validLen - 4\n : validLen\n\n var i\n for (i = 0; i < len; i += 4) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 18) |\n (revLookup[b64.charCodeAt(i + 1)] << 12) |\n (revLookup[b64.charCodeAt(i + 2)] << 6) |\n revLookup[b64.charCodeAt(i + 3)]\n arr[curByte++] = (tmp >> 16) & 0xFF\n arr[curByte++] = (tmp >> 8) & 0xFF\n arr[curByte++] = tmp & 0xFF\n }\n\n if (placeHoldersLen === 2) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 2) |\n (revLookup[b64.charCodeAt(i + 1)] >> 4)\n arr[curByte++] = tmp & 0xFF\n }\n\n if (placeHoldersLen === 1) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 10) |\n (revLookup[b64.charCodeAt(i + 1)] << 4) |\n (revLookup[b64.charCodeAt(i + 2)] >> 2)\n arr[curByte++] = (tmp >> 8) & 0xFF\n arr[curByte++] = tmp & 0xFF\n }\n\n return arr\n}\n\nfunction tripletToBase64 (num) {\n return lookup[num >> 18 & 0x3F] +\n lookup[num >> 12 & 0x3F] +\n lookup[num >> 6 & 0x3F] +\n lookup[num & 0x3F]\n}\n\nfunction encodeChunk (uint8, start, end) {\n var tmp\n var output = []\n for (var i = start; i < end; i += 3) {\n tmp =\n ((uint8[i] << 16) & 0xFF0000) +\n ((uint8[i + 1] << 8) & 0xFF00) +\n (uint8[i + 2] & 0xFF)\n output.push(tripletToBase64(tmp))\n }\n return output.join('')\n}\n\nfunction fromByteArray (uint8) {\n var tmp\n var len = uint8.length\n var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes\n var parts = []\n var maxChunkLength = 16383 // must be multiple of 3\n\n // go through the array every three bytes, we'll deal with trailing stuff later\n for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {\n parts.push(encodeChunk(\n uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)\n ))\n }\n\n // pad the end with zeros, but make sure to not forget the extra bytes\n if (extraBytes === 1) {\n tmp = uint8[len - 1]\n parts.push(\n lookup[tmp >> 2] +\n lookup[(tmp << 4) & 0x3F] +\n '=='\n )\n } else if (extraBytes === 2) {\n tmp = (uint8[len - 2] << 8) + uint8[len - 1]\n parts.push(\n lookup[tmp >> 10] +\n lookup[(tmp >> 4) & 0x3F] +\n lookup[(tmp << 2) & 0x3F] +\n '='\n )\n }\n\n return parts.join('')\n}\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJz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QTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTsiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///45\n")},function(module,exports){eval("exports.read = function (buffer, offset, isLE, mLen, nBytes) {\n var e, m\n var eLen = (nBytes * 8) - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var nBits = -7\n var i = isLE ? (nBytes - 1) : 0\n var d = isLE ? -1 : 1\n var s = buffer[offset + i]\n\n i += d\n\n e = s & ((1 << (-nBits)) - 1)\n s >>= (-nBits)\n nBits += eLen\n for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}\n\n m = e & ((1 << (-nBits)) - 1)\n e >>= (-nBits)\n nBits += mLen\n for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}\n\n if (e === 0) {\n e = 1 - eBias\n } else if (e === eMax) {\n return m ? NaN : ((s ? -1 : 1) * Infinity)\n } else {\n m = m + Math.pow(2, mLen)\n e = e - eBias\n }\n return (s ? -1 : 1) * m * Math.pow(2, e - mLen)\n}\n\nexports.write = function (buffer, value, offset, isLE, mLen, nBytes) {\n var e, m, c\n var eLen = (nBytes * 8) - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)\n var i = isLE ? 0 : (nBytes - 1)\n var d = isLE ? 1 : -1\n var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0\n\n value = Math.abs(value)\n\n if (isNaN(value) || value === Infinity) {\n m = isNaN(value) ? 1 : 0\n e = eMax\n } else {\n e = Math.floor(Math.log(value) / Math.LN2)\n if (value * (c = Math.pow(2, -e)) < 1) {\n e--\n c *= 2\n }\n if (e + eBias >= 1) {\n value += rt / c\n } else {\n value += rt * Math.pow(2, 1 - eBias)\n }\n if (value * c >= 2) {\n e++\n c /= 2\n }\n\n if (e + eBias >= eMax) {\n m = 0\n e = eMax\n } else if (e + eBias >= 1) {\n m = ((value * c) - 1) * Math.pow(2, mLen)\n e = e + eBias\n } else {\n m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)\n e = 0\n }\n }\n\n for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}\n\n e = (e << mLen) | m\n eLen += mLen\n for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}\n\n buffer[offset + i - d] |= s * 128\n}\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNDYuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvaWVlZTc1NC9pbmRleC5qcz85MTUyIl0sInNvdXJjZXNDb250ZW50IjpbImV4cG9ydHMucmVhZCA9IGZ1bmN0aW9uIChidWZmZXIsIG9mZnNldCwgaXNMRSwgbUxlbiwgbkJ5dGVzKSB7XG4gIHZhciBlLCBtXG4gIHZhciBlTGVuID0gKG5CeXRlcyAqIDgpIC0gbUxlbiAtIDFcbiAgdmFyIGVNYXggPSAoMSA8PCBlTGVuKSAtIDFcbiAgdmFyIGVCaWFzID0gZU1heCA+PiAxXG4gIHZhciBuQml0cyA9IC03XG4gIHZhciBpID0gaXNMRSA/IChuQnl0ZXMgLSAxKSA6IDBcbiAgdmFyIGQgPSBpc0xFID8gLTEgOiAxXG4gIHZhciBzID0gYnVmZmVyW29mZnNldCArIGldXG5cbiAgaSArPSBkXG5cbiAgZSA9IHMgJiAoKDEgPDwgKC1uQml0c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1NiwgbUxlbiAtPSA4KSB7fVxuXG4gIGUgPSAoZSA8PCBtTGVuKSB8IG1cbiAgZUxlbiArPSBtTGVuXG4gIGZvciAoOyBlTGVuID4gMDsgYnVmZmVyW29mZnNldCArIGldID0gZSAmIDB4ZmYsIGkgKz0gZCwgZSAvPSAyNTYsIGVMZW4gLT0gOCkge31cblxuICBidWZmZXJbb2Zmc2V0ICsgaSAtIGRdIHw9IHMgKiAxMjhcbn1cbiJdLCJtYXBwaW5ncyI6IkFBQUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOyIsInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///46\n")},function(module,exports){eval("var toString = {}.toString;\n\nmodule.exports = Array.isArray || function (arr) {\n return toString.call(arr) == '[object Array]';\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNDcuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvaXNhcnJheS9pbmRleC5qcz9lM2RiIl0sInNvdXJjZXNDb250ZW50IjpbInZhciB0b1N0cmluZyA9IHt9LnRvU3RyaW5nO1xuXG5tb2R1bGUuZXhwb3J0cyA9IEFycmF5LmlzQXJyYXkgfHwgZnVuY3Rpb24gKGFycikge1xuICByZXR1cm4gdG9TdHJpbmcuY2FsbChhcnIpID09ICdbb2JqZWN0IEFycmF5XSc7XG59O1xuIl0sIm1hcHBpbmdzIjoiQUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOyIsInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///47\n")},function(module,exports,__webpack_require__){"use strict";eval("\n\nvar keysShim;\nif (!Object.keys) {\n\t// modified from https://github.com/es-shims/es5-shim\n\tvar has = Object.prototype.hasOwnProperty;\n\tvar toStr = Object.prototype.toString;\n\tvar isArgs = __webpack_require__(38); // eslint-disable-line global-require\n\tvar isEnumerable = Object.prototype.propertyIsEnumerable;\n\tvar hasDontEnumBug = !isEnumerable.call({ toString: null }, 'toString');\n\tvar hasProtoEnumBug = isEnumerable.call(function () {}, 'prototype');\n\tvar dontEnums = [\n\t\t'toString',\n\t\t'toLocaleString',\n\t\t'valueOf',\n\t\t'hasOwnProperty',\n\t\t'isPrototypeOf',\n\t\t'propertyIsEnumerable',\n\t\t'constructor'\n\t];\n\tvar equalsConstructorPrototype = function (o) {\n\t\tvar ctor = o.constructor;\n\t\treturn ctor && ctor.prototype === o;\n\t};\n\tvar excludedKeys = {\n\t\t$applicationCache: true,\n\t\t$console: true,\n\t\t$external: true,\n\t\t$frame: true,\n\t\t$frameElement: true,\n\t\t$frames: true,\n\t\t$innerHeight: true,\n\t\t$innerWidth: true,\n\t\t$onmozfullscreenchange: true,\n\t\t$onmozfullscreenerror: true,\n\t\t$outerHeight: true,\n\t\t$outerWidth: true,\n\t\t$pageXOffset: true,\n\t\t$pageYOffset: true,\n\t\t$parent: true,\n\t\t$scrollLeft: true,\n\t\t$scrollTop: true,\n\t\t$scrollX: true,\n\t\t$scrollY: true,\n\t\t$self: true,\n\t\t$webkitIndexedDB: true,\n\t\t$webkitStorageInfo: true,\n\t\t$window: true\n\t};\n\tvar hasAutomationEqualityBug = (function () {\n\t\t/* global window */\n\t\tif (typeof window === 'undefined') { return false; }\n\t\tfor (var k in window) {\n\t\t\ttry {\n\t\t\t\tif (!excludedKeys['$' + k] && has.call(window, k) && window[k] !== null && typeof window[k] === 'object') {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tequalsConstructorPrototype(window[k]);\n\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} catch (e) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}());\n\tvar equalsConstructorPrototypeIfNotBuggy = function (o) {\n\t\t/* global window */\n\t\tif (typeof window === 'undefined' || !hasAutomationEqualityBug) {\n\t\t\treturn equalsConstructorPrototype(o);\n\t\t}\n\t\ttry {\n\t\t\treturn equalsConstructorPrototype(o);\n\t\t} catch (e) {\n\t\t\treturn false;\n\t\t}\n\t};\n\n\tkeysShim = function keys(object) {\n\t\tvar isObject = object !== null && typeof object === 'object';\n\t\tvar isFunction = toStr.call(object) === '[object Function]';\n\t\tvar isArguments = isArgs(object);\n\t\tvar isString = isObject && toStr.call(object) === '[object String]';\n\t\tvar theKeys = [];\n\n\t\tif (!isObject && !isFunction && !isArguments) {\n\t\t\tthrow new TypeError('Object.keys called on a non-object');\n\t\t}\n\n\t\tvar skipProto = hasProtoEnumBug && isFunction;\n\t\tif (isString && object.length > 0 && !has.call(object, 0)) {\n\t\t\tfor (var i = 0; i < object.length; ++i) {\n\t\t\t\ttheKeys.push(String(i));\n\t\t\t}\n\t\t}\n\n\t\tif (isArguments && object.length > 0) {\n\t\t\tfor (var j = 0; j < object.length; ++j) {\n\t\t\t\ttheKeys.push(String(j));\n\t\t\t}\n\t\t} else {\n\t\t\tfor (var name in object) {\n\t\t\t\tif (!(skipProto && name === 'prototype') && has.call(object, name)) {\n\t\t\t\t\ttheKeys.push(String(name));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (hasDontEnumBug) {\n\t\t\tvar skipConstructor = equalsConstructorPrototypeIfNotBuggy(object);\n\n\t\t\tfor (var k = 0; k < dontEnums.length; ++k) {\n\t\t\t\tif (!(skipConstructor && dontEnums[k] === 'constructor') && has.call(object, dontEnums[k])) {\n\t\t\t\t\ttheKeys.push(dontEnums[k]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn theKeys;\n\t};\n}\nmodule.exports = keysShim;\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNDguanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvb2JqZWN0LWtleXMvaW1wbGVtZW50YXRpb24uanM/YjE4OSJdLCJzb3VyY2VzQ29udGVudCI6WyIndXNlIHN0cmljdCc7XG5cbnZhciBrZXlzU2hpbTtcbmlmICghT2JqZWN0LmtleXMpIHtcblx0Ly8gbW9kaWZpZWQgZnJvbSBodHRwczovL2dpdGh1Yi5jb20vZXMtc2hpbXMvZXM1LXNoaW1cblx0dmFyIGhhcyA9IE9iamVjdC5wcm90b3R5cGUuaGFzT3duUHJvcGVydHk7XG5cdHZhciB0b1N0ciA9IE9iamVjdC5wcm90b3R5cGUudG9TdHJpbmc7XG5cdHZhciBpc0FyZ3MgPSByZXF1aXJlKCcuL2lzQXJndW1lbnRzJyk7IC8vIGVzbGludC1kaXNhYmxlLWxpbmUgZ2xvYmFsLXJlcXVpcmVcblx0dmFyIGlzRW51bWVyYWJsZSA9IE9iamVjdC5wcm90b3R5cGUucHJvcGVydHlJc0VudW1lcmFibGU7XG5cdHZhciBoYXNEb250RW51bUJ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var toStr = Object.prototype.toString;\n\nvar isStandardArguments = function isArguments(value) {\n\tif (hasToStringTag && value && typeof value === 'object' && Symbol.toStringTag in value) {\n\t\treturn false;\n\t}\n\treturn toStr.call(value) === '[object Arguments]';\n};\n\nvar isLegacyArguments = function isArguments(value) {\n\tif (isStandardArguments(value)) {\n\t\treturn true;\n\t}\n\treturn value !== null &&\n\t\ttypeof value === 'object' &&\n\t\ttypeof value.length === 'number' &&\n\t\tvalue.length >= 0 &&\n\t\ttoStr.call(value) !== '[object Array]' &&\n\t\ttoStr.call(value.callee) === '[object Function]';\n};\n\nvar supportsStandardArguments = (function () {\n\treturn isStandardArguments(arguments);\n}());\n\nisStandardArguments.isLegacyArguments = isLegacyArguments; // for tests\n\nmodule.exports = supportsStandardArguments ? isStandardArguments : isLegacyArguments;\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNDkuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvaXMtYXJndW1lbnRzL2luZGV4LmpzP2UzOWMiXSwic291cmNlc0NvbnRlbnQiOlsiJ3VzZSBzdHJpY3QnO1xuXG52YXIgaGFzVG9TdHJpbmdUYWcgPSB0eXBlb2YgU3ltYm9sID09PSAnZnVuY3Rpb24nICYmIHR5cGVvZiBTeW1ib2wudG9TdHJpbmdUYWcgPT09ICdzeW1ib2wnO1xudmFyIHRvU3RyID0gT2JqZWN0LnByb3RvdHlwZS50b1N0cmluZztcblxudmFyIGlzU3RhbmRhcmRBcmd1bWVudHMgPSBmdW5jdGlvbiBpc0FyZ3VtZW50cyh2YWx1ZSkge1xuXHRpZiAoaGFzVG9TdHJpbmdUYWcgJiYgdmFsdWUgJiYgdHlwZW9mIHZhbHVlID09PSAnb2JqZWN0JyAmJiBTeW1ib2wudG9TdHJpbmdUYWcgaW4gdmFsdWUpIHtcblx0XHRyZXR1cm4gZmFsc2U7XG5cdH1cbl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QTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOyIsInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///49\n")},function(module,exports,__webpack_require__){"use strict";eval("\n\n/* https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.is */\n\nvar NumberIsNaN = function (value) {\n\treturn value !== value;\n};\n\nmodule.exports = function is(a, b) {\n\tif (a === 0 && b === 0) {\n\t\treturn 1 / a === 1 / b;\n\t} else if (a === b) {\n\t\treturn true;\n\t} else if (NumberIsNaN(a) && NumberIsNaN(b)) {\n\t\treturn true;\n\t}\n\treturn false;\n};\n\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNTAuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvb2JqZWN0LWlzL2luZGV4LmpzPzZkYjciXSwic291cmNlc0NvbnRlbnQiOlsiXCJ1c2Ugc3RyaWN0XCI7XG5cbi8qIGh0dHBzOi8vcGVvcGxlLm1vemlsbGEub3JnL35qb3JlbmRvcmZmL2VzNi1kcmFmdC5odG1sI3NlYy1vYmplY3QuaXMgKi9cblxudmFyIE51bWJlcklzTmFOID0gZnVuY3Rpb24gKHZhbHVlKSB7XG5cdHJldHVybiB2YWx1ZSAhPT0gdmFsdWU7XG59O1xuXG5tb2R1bGUuZXhwb3J0cyA9IGZ1bmN0aW9uIGlzKGEsIGIpIHtcblx0aWYgKGEgPT09IDAgJiYgYiA9PT0gMCkge1xuXHRcdHJldHVybiAxIC8gYSA9PT0gMSAvIGI7XG5cdH0gZWxzZSBpZiAoYSA9PT0gYikge1xuXHRcdHJldHVybiB0cnVlO1xuXHR9IGVsc2UgaWYgKE51bWJlcklzTmFOKGEpICYmIE51bWJlcklzTmFOKGIpKSB7XG5cdFx0cmV0dXJuIHRydWU7XG5cdH1cblx0cmV0dXJuIGZhbHNlO1xufTtcblxuIl0sIm1hcHBpbmdzIjoiQUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTsiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///50\n")},function(module,exports,__webpack_require__){"use strict";eval("\n\nvar has = __webpack_require__(52);\nvar regexExec = RegExp.prototype.exec;\nvar gOPD = Object.getOwnPropertyDescriptor;\n\nvar tryRegexExecCall = function tryRegexExec(value) {\n\ttry {\n\t\tvar lastIndex = value.lastIndex;\n\t\tvalue.lastIndex = 0;\n\n\t\tregexExec.call(value);\n\t\treturn true;\n\t} catch (e) {\n\t\treturn false;\n\t} finally {\n\t\tvalue.lastIndex = lastIndex;\n\t}\n};\nvar toStr = Object.prototype.toString;\nvar regexClass = '[object RegExp]';\nvar hasToStringTag = typeof Symbol === 'function' && typeof Symbol.toStringTag === 'symbol';\n\nmodule.exports = function isRegex(value) {\n\tif (!value || typeof value !== 'object') {\n\t\treturn false;\n\t}\n\tif (!hasToStringTag) {\n\t\treturn toStr.call(value) === regexClass;\n\t}\n\n\tvar descriptor = gOPD(value, 'lastIndex');\n\tvar hasLastIndexDataProperty = descriptor && has(descriptor, 'value');\n\tif (!hasLastIndexDataProperty) {\n\t\treturn false;\n\t}\n\n\treturn tryRegexExecCall(value);\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNTEuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvaXMtcmVnZXgvaW5kZXguanM/ZDhkOCJdLCJzb3VyY2VzQ29udGVudCI6WyIndXNlIHN0cmljdCc7XG5cbnZhciBoYXMgPSByZXF1aXJlKCdoYXMnKTtcbnZhciByZW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NjcmlwdG9yICYmIGhhcyhkZXNjcmlwdG9yLCAndmFsdWUnKTtcblx0aWYgKCFoYXNMYXN0SW5kZXhEYXRhUHJvcGVydHkpIHtcblx0XHRyZXR1cm4gZmFsc2U7XG5cdH1cblxuXHRyZXR1cm4gdHJ5UmVnZXhFeGVjQ2FsbCh2YWx1ZSk7XG59O1xuIl0sIm1hcHBpbmdzIjoiQUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7Iiwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///51\n")},function(module,exports,__webpack_require__){"use strict";eval("\n\nvar bind = __webpack_require__(53);\n\nmodule.exports = bind.call(Function.call, Object.prototype.hasOwnProperty);\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNTIuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvaGFzL3NyYy9pbmRleC5qcz9hMGQzIl0sInNvdXJjZXNDb250ZW50IjpbIid1c2Ugc3RyaWN0JztcblxudmFyIGJpbmQgPSByZXF1aXJlKCdmdW5jdGlvbi1iaW5kJyk7XG5cbm1vZHVsZS5leHBvcnRzID0gYmluZC5jYWxsKEZ1bmN0aW9uLmNhbGwsIE9iamVjdC5wcm90b3R5cGUuaGFzT3duUHJvcGVydHkpO1xuIl0sIm1hcHBpbmdzIjoiQUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOyIsInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///52\n")},function(module,exports,__webpack_require__){"use strict";eval("\n\nvar implementation = __webpack_require__(54);\n\nmodule.exports = Function.prototype.bind || implementation;\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNTMuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvZnVuY3Rpb24tYmluZC9pbmRleC5qcz8wZjdjIl0sInNvdXJjZXNDb250ZW50IjpbIid1c2Ugc3RyaWN0JztcblxudmFyIGltcGxlbWVudGF0aW9uID0gcmVxdWlyZSgnLi9pbXBsZW1lbnRhdGlvbicpO1xuXG5tb2R1bGUuZXhwb3J0cyA9IEZ1bmN0aW9uLnByb3RvdHlwZS5iaW5kIHx8IGltcGxlbWVudGF0aW9uO1xuIl0sIm1hcHBpbmdzIjoiQUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOyIsInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///53\n")},function(module,exports,__webpack_require__){"use strict";eval("\n\n/* eslint no-invalid-this: 1 */\n\nvar ERROR_MESSAGE = 'Function.prototype.bind called on incompatible ';\nvar slice = Array.prototype.slice;\nvar toStr = Object.prototype.toString;\nvar funcType = '[object Function]';\n\nmodule.exports = function bind(that) {\n var target = this;\n if (typeof target !== 'function' || toStr.call(target) !== funcType) {\n throw new TypeError(ERROR_MESSAGE + target);\n }\n var args = slice.call(arguments, 1);\n\n var bound;\n var binder = function () {\n if (this instanceof bound) {\n var result = target.apply(\n this,\n args.concat(slice.call(arguments))\n );\n if (Object(result) === result) {\n return result;\n }\n return this;\n } else {\n return target.apply(\n that,\n args.concat(slice.call(arguments))\n );\n }\n };\n\n var boundLength = Math.max(0, target.length - args.length);\n var boundArgs = [];\n for (var i = 0; i < boundLength; i++) {\n boundArgs.push('$' + i);\n }\n\n bound = Function('binder', 'return function (' + boundArgs.join(',') + '){ return binder.apply(this,arguments); }')(binder);\n\n if (target.prototype) {\n var Empty = function Empty() {};\n Empty.prototype = target.prototype;\n bound.prototype = new Empty();\n Empty.prototype = null;\n }\n\n return bound;\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNTQuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvZnVuY3Rpb24tYmluZC9pbXBsZW1lbnRhdGlvbi5qcz82ODhlIl0sInNvdXJjZXNDb250ZW50IjpbIid1c2Ugc3RyaWN0JztcblxuLyogZXNsaW50IG5vLWludmFsaWQtdGhpczogMSAqL1xuXG52YXIgRVJST1JfTUVTU0FHRSA9ICdGdW5jdGlvbi5wcm90b3R5cGUuYmluZCBjYWxsZWQgb24gaW5jb21wYXRpYmxlICc7XG52YXIgc2xpY2UgPSBBcnJheS5wcm90b3R5cGUuc2xpY2U7XG52YXIgdG9TdHIgPSBPYmplY3QucHJvdG90eXBlLnRvU3RyaW5nO1xudmFyIGZ1bmNUeXBlID0gJ1tvYmplY3QgRnVuY3Rpb25dJztcblxubW9kdWxlLmV4cG9ydHMgPSBmdW5jdGlvbiBiaW5kKHRoYXQpIHtcbiAgICB2YXIgdGFyZ2V0ID0gdGhpcztcbiAgICBpZiAodHlwZW9mIHRhcmdldCAhPT0gJ2Z1bmN0aW9uJyB8fCB0b1N0ci5jYWxsKHRhcmdldCkgIT09IGZ1bmNUeXBlKSB7XG4gICAgICAgIHRocm93IG5ldyBUeXBlRXJyb3IoRVJST1JfTUVTU0FHRSArIHRhcmdldCk7XG4gICAgfVxuICAgIHZhciBhcmdzID0gc2xpY2UuY2FsbChhcmd1bWVudHMsIDEpO1xuXG4gICAgdmFyIGJvdW5kO1xuICAgIHZhciBiaW5kZXIgPSBmdW5jdGlvbiAoKSB7XG4gICAgICAgIGlmICh0aGlzIGluc3RhbmNlb2YgYm91bmQpIHtcbiAgICAgICAgICAgIHZhciByZXN1bHQgPSB0YXJnZXQuYXBwbHkoXG4gICAgICAgICAgICAgICAgdGhpcyxcbiAgICAgICAgICAgICAgICBhcmdzLmNvbmNhdChzbGljZS5jYWxsKGFyZ3VtZW50cykpXG4gICAgICAgICAgICApO1xuICAgICAgICAgICAgaWYgKE9iamVjdChyZXN1bHQpID09PSByZXN1bHQpIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gcmVzdWx0O1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgcmV0dXJuIHRoaXM7XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICByZXR1cm4gdGFyZ2V0LmFwcGx5KFxuICAgICAgICAgICAgICAgIHRoYXQsXG4gICAgICAgICAgICAgICAgYXJncy5jb25jYXQoc2xpY2UuY2FsbChhcmd1bWVudHMpKVxuICAgICAgICAgICAgKTtcbiAgICAgICAgfVxuICAgIH07XG5cbiAgICB2YXIgYm91bmRMZW5ndGggPSBNYXRoLm1heCgwLCB0YXJnZXQubGVuZ3RoIC0gYXJncy5sZW5ndGgpO1xuICAgIHZhciBib3VuZEFyZ3MgPSBbXTtcbiAgICBmb3IgKHZhciBpID0gMDsgaSA8IGJvdW5kTGVuZ3RoOyBpKyspIHtcbiAgICAgICAgYm91bmRBcmdzLnB1c2goJyQnICsgaSk7XG4gICAgfVxuXG4gICAgYm91bmQgPSBGdW5jdGlvbignYmluZGVyJywgJ3JldHVybiBmdW5jdGlvbiAoJyArIGJvdW5kQXJncy5qb2luKCcsJykgKyAnKXsgcmV0dXJuIGJpbmRlci5hcHBseSh0aGlzLGFyZ3VtZW50cyk7IH0nKShiaW5kZXIpO1xuXG4gICAgaWYgKHRhcmdldC5wcm90b3R5cGUpIHtcbiAgICAgICAgdmFyIEVtcHR5ID0gZnVuY3Rpb24gRW1wdHkoKSB7fTtcbiAgICAgICAgRW1wdHkucHJvdG90eXBlID0gdGFyZ2V0LnByb3RvdHlwZTtcbiAgICAgICAgYm91bmQucHJvdG90eXBlID0gbmV3IEVtcHR5KCk7XG4gICAgICAgIEVtcHR5LnByb3RvdHlwZSA9IG51bGw7XG4gICAgfVxuXG4gICAgcmV0dXJuIGJvdW5kO1xufTtcbiJdLCJtYXBwaW5ncyI6IkFBQUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7Iiwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///54\n")},function(module,exports,__webpack_require__){"use strict";eval("\n\nvar define = __webpack_require__(15);\n\nvar implementation = __webpack_require__(39);\nvar getPolyfill = __webpack_require__(40);\nvar shim = __webpack_require__(56);\n\nvar flagsBound = Function.call.bind(implementation);\n\ndefine(flagsBound, {\n\tgetPolyfill: getPolyfill,\n\timplementation: implementation,\n\tshim: shim\n});\n\nmodule.exports = flagsBound;\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNTUuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvcmVnZXhwLnByb3RvdHlwZS5mbGFncy9pbmRleC5qcz9lNzEwIl0sInNvdXJjZXNDb250ZW50IjpbIid1c2Ugc3RyaWN0JztcblxudmFyIGRlZmluZSA9IHJlcXVpcmUoJ2RlZmluZS1wcm9wZXJ0aWVzJyk7XG5cbnZhciBpbXBsZW1lbnRhdGlvbiA9IHJlcXVpcmUoJy4vaW1wbGVtZW50YXRpb24nKTtcbnZhciBnZXRQb2x5ZmlsbCA9IHJlcXVpcmUoJy4vcG9seWZpbGwnKTtcbnZhciBzaGltID0gcmVxdWlyZSgnLi9zaGltJyk7XG5cbnZhciBmbGFnc0JvdW5kID0gRnVuY3Rpb24uY2FsbC5iaW5kKGltcGxlbWVudGF0aW9uKTtcblxuZGVmaW5lKGZsYWdzQm91bmQsIHtcblx0Z2V0UG9seWZpbGw6IGdldFBvbHlmaWxsLFxuXHRpbXBsZW1lbnRhdGlvbjogaW1wbGVtZW50YXRpb24sXG5cdHNoaW06IHNoaW1cbn0pO1xuXG5tb2R1bGUuZXhwb3J0cyA9IGZsYWdzQm91bmQ7XG4iXSwibWFwcGluZ3MiOiJBQUFBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7Iiwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///55\n")},function(module,exports,__webpack_require__){"use strict";eval("\n\nvar supportsDescriptors = __webpack_require__(15).supportsDescriptors;\nvar getPolyfill = __webpack_require__(40);\nvar gOPD = Object.getOwnPropertyDescriptor;\nvar defineProperty = Object.defineProperty;\nvar TypeErr = TypeError;\nvar getProto = Object.getPrototypeOf;\nvar regex = /a/;\n\nmodule.exports = function shimFlags() {\n\tif (!supportsDescriptors || !getProto) {\n\t\tthrow new TypeErr('RegExp.prototype.flags requires a true ES5 environment that supports property descriptors');\n\t}\n\tvar polyfill = getPolyfill();\n\tvar proto = getProto(regex);\n\tvar descriptor = gOPD(proto, 'flags');\n\tif (!descriptor || descriptor.get !== polyfill) {\n\t\tdefineProperty(proto, 'flags', {\n\t\t\tconfigurable: true,\n\t\t\tenumerable: false,\n\t\t\tget: polyfill\n\t\t});\n\t}\n\treturn polyfill;\n};\n//# sourceURL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c2NyaXB0b3IuZ2V0ICE9PSBwb2x5ZmlsbCkge1xuXHRcdGRlZmluZVByb3BlcnR5KHByb3RvLCAnZmxhZ3MnLCB7XG5cdFx0XHRjb25maWd1cmFibGU6IHRydWUsXG5cdFx0XHRlbnVtZXJhYmxlOiBmYWxzZSxcblx0XHRcdGdldDogcG9seWZpbGxcblx0XHR9KTtcblx0fVxuXHRyZXR1cm4gcG9seWZpbGw7XG59O1xuIl0sIm1hcHBpbmdzIjoiQUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOyIsInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///56\n")},function(module,exports,__webpack_require__){"use strict";eval("\n\nvar getDay = Date.prototype.getDay;\nvar tryDateObject = function tryDateObject(value) {\n\ttry {\n\t\tgetDay.call(value);\n\t\treturn true;\n\t} catch (e) {\n\t\treturn false;\n\t}\n};\n\nvar toStr = Object.prototype.toString;\nvar dateClass = '[object Date]';\nvar hasToStringTag = typeof Symbol === 'function' && typeof Symbol.toStringTag === 'symbol';\n\nmodule.exports = function isDateObject(value) {\n\tif (typeof value !== 'object' || value === null) { return false; }\n\treturn hasToStringTag ? tryDateObject(value) : toStr.call(value) === dateClass;\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNTcuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvaXMtZGF0ZS1vYmplY3QvaW5kZXguanM/MGU2NSJdLCJzb3VyY2VzQ29udGVudCI6WyIndXNlIHN0cmljdCc7XG5cbnZhciBnZXREYXkgPSBEYXRlLnByb3RvdHlwZS5nZXREYXk7XG52YXIgdHJ5RGF0ZU9iamVjdCA9IGZ1bmN0aW9uIHRyeURhdGVPYmplY3QodmFsdWUpIHtcblx0dHJ5IHtcblx0XHRnZXREYXkuY2FsbCh2YWx1ZSk7XG5cdFx0cmV0dXJuIHRydWU7XG5cdH0gY2F0Y2ggKGUpIHtcblx0XHRyZXR1cm4gZmFsc2U7XG5cdH1cbn07XG5cbnZhciB0b1N0ciA9IE9iamVjdC5wcm90b3R5cGUudG9TdHJpbmc7XG52YXIgZGF0ZUNsYXNzID0gJ1tvYmplY3QgRGF0ZV0nO1xudmFyIGhhc1RvU3RyaW5nVGFnID0gdHlwZW9mIFN5bWJvbCA9PT0gJ2Z1bmN0aW9uJyAmJiB0eXBlb2YgU3ltYm9sLnRvU3RyaW5nVGFnID09PSAnc3ltYm9sJztcblxubW9kdWxlLmV4cG9ydHMgPSBmdW5jdGlvbiBpc0RhdGVPYmplY3QodmFsdWUpIHtcblx0aWYgKHR5cGVvZiB2YWx1ZSAhPT0gJ29iamVjdCcgfHwgdmFsdWUgPT09IG51bGwpIHsgcmV0dXJuIGZhbHNlOyB9XG5cdHJldHVybiBoYXNUb1N0cmluZ1RhZyA/IHRyeURhdGVPYmplY3QodmFsdWUpIDogdG9TdHIuY2FsbCh2YWx1ZSkgPT09IGRhdGVDbGFzcztcbn07XG4iXSwibWFwcGluZ3MiOiJBQUFBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7Iiwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///57\n")},function(module,exports){eval("/**\n * This library modifies the diff-patch-match library by Neil Fraser\n * by removing the patch and match functionality and certain advanced\n * options in the diff function. The original license is as follows:\n *\n * ===\n *\n * Diff Match and Patch\n *\n * Copyright 2006 Google Inc.\n * http://code.google.com/p/google-diff-match-patch/\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n\n/**\n * The data structure representing a diff is an array of tuples:\n * [[DIFF_DELETE, 'Hello'], [DIFF_INSERT, 'Goodbye'], [DIFF_EQUAL, ' world.']]\n * which means: delete 'Hello', add 'Goodbye' and keep ' world.'\n */\nvar DIFF_DELETE = -1;\nvar DIFF_INSERT = 1;\nvar DIFF_EQUAL = 0;\n\n\n/**\n * Find the differences between two texts. Simplifies the problem by stripping\n * any common prefix or suffix off the texts before diffing.\n * @param {string} text1 Old string to be diffed.\n * @param {string} text2 New string to be diffed.\n * @param {Int|Object} [cursor_pos] Edit position in text1 or object with more info\n * @return {Array} Array of diff tuples.\n */\nfunction diff_main(text1, text2, cursor_pos, _fix_unicode) {\n // Check for equality\n if (text1 === text2) {\n if (text1) {\n return [[DIFF_EQUAL, text1]];\n }\n return [];\n }\n\n if (cursor_pos != null) {\n var editdiff = find_cursor_edit_diff(text1, text2, cursor_pos);\n if (editdiff) {\n return editdiff;\n }\n }\n\n // Trim off common prefix (speedup).\n var commonlength = diff_commonPrefix(text1, text2);\n var commonprefix = text1.substring(0, commonlength);\n text1 = text1.substring(commonlength);\n text2 = text2.substring(commonlength);\n\n // Trim off common suffix (speedup).\n commonlength = diff_commonSuffix(text1, text2);\n var commonsuffix = text1.substring(text1.length - commonlength);\n text1 = text1.substring(0, text1.length - commonlength);\n text2 = text2.substring(0, text2.length - commonlength);\n\n // Compute the diff on the middle block.\n var diffs = diff_compute_(text1, text2);\n\n // Restore the prefix and suffix.\n if (commonprefix) {\n diffs.unshift([DIFF_EQUAL, commonprefix]);\n }\n if (commonsuffix) {\n diffs.push([DIFF_EQUAL, commonsuffix]);\n }\n diff_cleanupMerge(diffs, _fix_unicode);\n return diffs;\n};\n\n\n/**\n * Find the differences between two texts. Assumes that the texts do not\n * have any common prefix or suffix.\n * @param {string} text1 Old string to be diffed.\n * @param {string} text2 New string to be diffed.\n * @return {Array} Array of diff tuples.\n */\nfunction diff_compute_(text1, text2) {\n var diffs;\n\n if (!text1) {\n // Just add some text (speedup).\n return [[DIFF_INSERT, text2]];\n }\n\n if (!text2) {\n // Just delete some text (speedup).\n return [[DIFF_DELETE, text1]];\n }\n\n var longtext = text1.length > text2.length ? text1 : text2;\n var shorttext = text1.length > text2.length ? text2 : text1;\n var i = longtext.indexOf(shorttext);\n if (i !== -1) {\n // Shorter text is inside the longer text (speedup).\n diffs = [\n [DIFF_INSERT, longtext.substring(0, i)],\n [DIFF_EQUAL, shorttext],\n [DIFF_INSERT, longtext.substring(i + shorttext.length)]\n ];\n // Swap insertions for deletions if diff is reversed.\n if (text1.length > text2.length) {\n diffs[0][0] = diffs[2][0] = DIFF_DELETE;\n }\n return diffs;\n }\n\n if (shorttext.length === 1) {\n // Single character string.\n // After the previous speedup, the character can't be an equality.\n return [[DIFF_DELETE, text1], [DIFF_INSERT, text2]];\n }\n\n // Check to see if the problem can be split in two.\n var hm = diff_halfMatch_(text1, text2);\n if (hm) {\n // A half-match was found, sort out the return data.\n var text1_a = hm[0];\n var text1_b = hm[1];\n var text2_a = hm[2];\n var text2_b = hm[3];\n var mid_common = hm[4];\n // Send both pairs off for separate processing.\n var diffs_a = diff_main(text1_a, text2_a);\n var diffs_b = diff_main(text1_b, text2_b);\n // Merge the results.\n return diffs_a.concat([[DIFF_EQUAL, mid_common]], diffs_b);\n }\n\n return diff_bisect_(text1, text2);\n};\n\n\n/**\n * Find the 'middle snake' of a diff, split the problem in two\n * and return the recursively constructed diff.\n * See Myers 1986 paper: An O(ND) Difference Algorithm and Its Variations.\n * @param {string} text1 Old string to be diffed.\n * @param {string} text2 New string to be diffed.\n * @return {Array} Array of diff tuples.\n * @private\n */\nfunction diff_bisect_(text1, text2) {\n // Cache the text lengths to prevent multiple calls.\n var text1_length = text1.length;\n var text2_length = text2.length;\n var max_d = Math.ceil((text1_length + text2_length) / 2);\n var v_offset = max_d;\n var v_length = 2 * max_d;\n var v1 = new Array(v_length);\n var v2 = new Array(v_length);\n // Setting all elements to -1 is faster in Chrome & Firefox than mixing\n // integers and undefined.\n for (var x = 0; x < v_length; x++) {\n v1[x] = -1;\n v2[x] = -1;\n }\n v1[v_offset + 1] = 0;\n v2[v_offset + 1] = 0;\n var delta = text1_length - text2_length;\n // If the total number of characters is odd, then the front path will collide\n // with the reverse path.\n var front = (delta % 2 !== 0);\n // Offsets for start and end of k loop.\n // Prevents mapping of space beyond the grid.\n var k1start = 0;\n var k1end = 0;\n var k2start = 0;\n var k2end = 0;\n for (var d = 0; d < max_d; d++) {\n // Walk the front path one step.\n for (var k1 = -d + k1start; k1 <= d - k1end; k1 += 2) {\n var k1_offset = v_offset + k1;\n var x1;\n if (k1 === -d || (k1 !== d && v1[k1_offset - 1] < v1[k1_offset + 1])) {\n x1 = v1[k1_offset + 1];\n } else {\n x1 = v1[k1_offset - 1] + 1;\n }\n var y1 = x1 - k1;\n while (\n x1 < text1_length && y1 < text2_length &&\n text1.charAt(x1) === text2.charAt(y1)\n ) {\n x1++;\n y1++;\n }\n v1[k1_offset] = x1;\n if (x1 > text1_length) {\n // Ran off the right of the graph.\n k1end += 2;\n } else if (y1 > text2_length) {\n // Ran off the bottom of the graph.\n k1start += 2;\n } else if (front) {\n var k2_offset = v_offset + delta - k1;\n if (k2_offset >= 0 && k2_offset < v_length && v2[k2_offset] !== -1) {\n // Mirror x2 onto top-left coordinate system.\n var x2 = text1_length - v2[k2_offset];\n if (x1 >= x2) {\n // Overlap detected.\n return diff_bisectSplit_(text1, text2, x1, y1);\n }\n }\n }\n }\n\n // Walk the reverse path one step.\n for (var k2 = -d + k2start; k2 <= d - k2end; k2 += 2) {\n var k2_offset = v_offset + k2;\n var x2;\n if (k2 === -d || (k2 !== d && v2[k2_offset - 1] < v2[k2_offset + 1])) {\n x2 = v2[k2_offset + 1];\n } else {\n x2 = v2[k2_offset - 1] + 1;\n }\n var y2 = x2 - k2;\n while (\n x2 < text1_length && y2 < text2_length &&\n text1.charAt(text1_length - x2 - 1) === text2.charAt(text2_length - y2 - 1)\n ) {\n x2++;\n y2++;\n }\n v2[k2_offset] = x2;\n if (x2 > text1_length) {\n // Ran off the left of the graph.\n k2end += 2;\n } else if (y2 > text2_length) {\n // Ran off the top of the graph.\n k2start += 2;\n } else if (!front) {\n var k1_offset = v_offset + delta - k2;\n if (k1_offset >= 0 && k1_offset < v_length && v1[k1_offset] !== -1) {\n var x1 = v1[k1_offset];\n var y1 = v_offset + x1 - k1_offset;\n // Mirror x2 onto top-left coordinate system.\n x2 = text1_length - x2;\n if (x1 >= x2) {\n // Overlap detected.\n return diff_bisectSplit_(text1, text2, x1, y1);\n }\n }\n }\n }\n }\n // Diff took too long and hit the deadline or\n // number of diffs equals number of characters, no commonality at all.\n return [[DIFF_DELETE, text1], [DIFF_INSERT, text2]];\n};\n\n\n/**\n * Given the location of the 'middle snake', split the diff in two parts\n * and recurse.\n * @param {string} text1 Old string to be diffed.\n * @param {string} text2 New string to be diffed.\n * @param {number} x Index of split point in text1.\n * @param {number} y Index of split point in text2.\n * @return {Array} Array of diff tuples.\n */\nfunction diff_bisectSplit_(text1, text2, x, y) {\n var text1a = text1.substring(0, x);\n var text2a = text2.substring(0, y);\n var text1b = text1.substring(x);\n var text2b = text2.substring(y);\n\n // Compute both diffs serially.\n var diffs = diff_main(text1a, text2a);\n var diffsb = diff_main(text1b, text2b);\n\n return diffs.concat(diffsb);\n};\n\n\n/**\n * Determine the common prefix of two strings.\n * @param {string} text1 First string.\n * @param {string} text2 Second string.\n * @return {number} The number of characters common to the start of each\n * string.\n */\nfunction diff_commonPrefix(text1, text2) {\n // Quick check for common null cases.\n if (!text1 || !text2 || text1.charAt(0) !== text2.charAt(0)) {\n return 0;\n }\n // Binary search.\n // Performance analysis: http://neil.fraser.name/news/2007/10/09/\n var pointermin = 0;\n var pointermax = Math.min(text1.length, text2.length);\n var pointermid = pointermax;\n var pointerstart = 0;\n while (pointermin < pointermid) {\n if (\n text1.substring(pointerstart, pointermid) ==\n text2.substring(pointerstart, pointermid)\n ) {\n pointermin = pointermid;\n pointerstart = pointermin;\n } else {\n pointermax = pointermid;\n }\n pointermid = Math.floor((pointermax - pointermin) / 2 + pointermin);\n }\n\n if (is_surrogate_pair_start(text1.charCodeAt(pointermid - 1))) {\n pointermid--;\n }\n\n return pointermid;\n};\n\n\n/**\n * Determine the common suffix of two strings.\n * @param {string} text1 First string.\n * @param {string} text2 Second string.\n * @return {number} The number of characters common to the end of each string.\n */\nfunction diff_commonSuffix(text1, text2) {\n // Quick check for common null cases.\n if (!text1 || !text2 || text1.slice(-1) !== text2.slice(-1)) {\n return 0;\n }\n // Binary search.\n // Performance analysis: http://neil.fraser.name/news/2007/10/09/\n var pointermin = 0;\n var pointermax = Math.min(text1.length, text2.length);\n var pointermid = pointermax;\n var pointerend = 0;\n while (pointermin < pointermid) {\n if (\n text1.substring(text1.length - pointermid, text1.length - pointerend) ==\n text2.substring(text2.length - pointermid, text2.length - pointerend)\n ) {\n pointermin = pointermid;\n pointerend = pointermin;\n } else {\n pointermax = pointermid;\n }\n pointermid = Math.floor((pointermax - pointermin) / 2 + pointermin);\n }\n\n if (is_surrogate_pair_end(text1.charCodeAt(text1.length - pointermid))) {\n pointermid--;\n }\n\n return pointermid;\n};\n\n\n/**\n * Do the two texts share a substring which is at least half the length of the\n * longer text?\n * This speedup can produce non-minimal diffs.\n * @param {string} text1 First string.\n * @param {string} text2 Second string.\n * @return {Array.} Five element Array, containing the prefix of\n * text1, the suffix of text1, the prefix of text2, the suffix of\n * text2 and the common middle. Or null if there was no match.\n */\nfunction diff_halfMatch_(text1, text2) {\n var longtext = text1.length > text2.length ? text1 : text2;\n var shorttext = text1.length > text2.length ? text2 : text1;\n if (longtext.length < 4 || shorttext.length * 2 < longtext.length) {\n return null; // Pointless.\n }\n\n /**\n * Does a substring of shorttext exist within longtext such that the substring\n * is at least half the length of longtext?\n * Closure, but does not reference any external variables.\n * @param {string} longtext Longer string.\n * @param {string} shorttext Shorter string.\n * @param {number} i Start index of quarter length substring within longtext.\n * @return {Array.} Five element Array, containing the prefix of\n * longtext, the suffix of longtext, the prefix of shorttext, the suffix\n * of shorttext and the common middle. Or null if there was no match.\n * @private\n */\n function diff_halfMatchI_(longtext, shorttext, i) {\n // Start with a 1/4 length substring at position i as a seed.\n var seed = longtext.substring(i, i + Math.floor(longtext.length / 4));\n var j = -1;\n var best_common = '';\n var best_longtext_a, best_longtext_b, best_shorttext_a, best_shorttext_b;\n while ((j = shorttext.indexOf(seed, j + 1)) !== -1) {\n var prefixLength = diff_commonPrefix(\n longtext.substring(i), shorttext.substring(j));\n var suffixLength = diff_commonSuffix(\n longtext.substring(0, i), shorttext.substring(0, j));\n if (best_common.length < suffixLength + prefixLength) {\n best_common = shorttext.substring(\n j - suffixLength, j) + shorttext.substring(j, j + prefixLength);\n best_longtext_a = longtext.substring(0, i - suffixLength);\n best_longtext_b = longtext.substring(i + prefixLength);\n best_shorttext_a = shorttext.substring(0, j - suffixLength);\n best_shorttext_b = shorttext.substring(j + prefixLength);\n }\n }\n if (best_common.length * 2 >= longtext.length) {\n return [\n best_longtext_a, best_longtext_b,\n best_shorttext_a, best_shorttext_b, best_common\n ];\n } else {\n return null;\n }\n }\n\n // First check if the second quarter is the seed for a half-match.\n var hm1 = diff_halfMatchI_(longtext, shorttext, Math.ceil(longtext.length / 4));\n // Check again based on the third quarter.\n var hm2 = diff_halfMatchI_(longtext, shorttext, Math.ceil(longtext.length / 2));\n var hm;\n if (!hm1 && !hm2) {\n return null;\n } else if (!hm2) {\n hm = hm1;\n } else if (!hm1) {\n hm = hm2;\n } else {\n // Both matched. Select the longest.\n hm = hm1[4].length > hm2[4].length ? hm1 : hm2;\n }\n\n // A half-match was found, sort out the return data.\n var text1_a, text1_b, text2_a, text2_b;\n if (text1.length > text2.length) {\n text1_a = hm[0];\n text1_b = hm[1];\n text2_a = hm[2];\n text2_b = hm[3];\n } else {\n text2_a = hm[0];\n text2_b = hm[1];\n text1_a = hm[2];\n text1_b = hm[3];\n }\n var mid_common = hm[4];\n return [text1_a, text1_b, text2_a, text2_b, mid_common];\n};\n\n\n/**\n * Reorder and merge like edit sections. Merge equalities.\n * Any edit section can move as long as it doesn't cross an equality.\n * @param {Array} diffs Array of diff tuples.\n * @param {boolean} fix_unicode Whether to normalize to a unicode-correct diff\n */\nfunction diff_cleanupMerge(diffs, fix_unicode) {\n diffs.push([DIFF_EQUAL, '']); // Add a dummy entry at the end.\n var pointer = 0;\n var count_delete = 0;\n var count_insert = 0;\n var text_delete = '';\n var text_insert = '';\n var commonlength;\n while (pointer < diffs.length) {\n if (pointer < diffs.length - 1 && !diffs[pointer][1]) {\n diffs.splice(pointer, 1);\n continue;\n }\n switch (diffs[pointer][0]) {\n case DIFF_INSERT:\n\n count_insert++;\n text_insert += diffs[pointer][1];\n pointer++;\n break;\n case DIFF_DELETE:\n count_delete++;\n text_delete += diffs[pointer][1];\n pointer++;\n break;\n case DIFF_EQUAL:\n var previous_equality = pointer - count_insert - count_delete - 1;\n if (fix_unicode) {\n // prevent splitting of unicode surrogate pairs. when fix_unicode is true,\n // we assume that the old and new text in the diff are complete and correct\n // unicode-encoded JS strings, but the tuple boundaries may fall between\n // surrogate pairs. we fix this by shaving off stray surrogates from the end\n // of the previous equality and the beginning of this equality. this may create\n // empty equalities or a common prefix or suffix. for example, if AB and AC are\n // emojis, `[[0, 'A'], [-1, 'BA'], [0, 'C']]` would turn into deleting 'ABAC' and\n // inserting 'AC', and then the common suffix 'AC' will be eliminated. in this\n // particular case, both equalities go away, we absorb any previous inequalities,\n // and we keep scanning for the next equality before rewriting the tuples.\n if (previous_equality >= 0 && ends_with_pair_start(diffs[previous_equality][1])) {\n var stray = diffs[previous_equality][1].slice(-1);\n diffs[previous_equality][1] = diffs[previous_equality][1].slice(0, -1);\n text_delete = stray + text_delete;\n text_insert = stray + text_insert;\n if (!diffs[previous_equality][1]) {\n // emptied out previous equality, so delete it and include previous delete/insert\n diffs.splice(previous_equality, 1);\n pointer--;\n var k = previous_equality - 1;\n if (diffs[k] && diffs[k][0] === DIFF_INSERT) {\n count_insert++;\n text_insert = diffs[k][1] + text_insert;\n k--;\n }\n if (diffs[k] && diffs[k][0] === DIFF_DELETE) {\n count_delete++;\n text_delete = diffs[k][1] + text_delete;\n k--;\n }\n previous_equality = k;\n }\n }\n if (starts_with_pair_end(diffs[pointer][1])) {\n var stray = diffs[pointer][1].charAt(0);\n diffs[pointer][1] = diffs[pointer][1].slice(1);\n text_delete += stray;\n text_insert += stray;\n }\n }\n if (pointer < diffs.length - 1 && !diffs[pointer][1]) {\n // for empty equality not at end, wait for next equality\n diffs.splice(pointer, 1);\n break;\n }\n if (text_delete.length > 0 || text_insert.length > 0) {\n // note that diff_commonPrefix and diff_commonSuffix are unicode-aware\n if (text_delete.length > 0 && text_insert.length > 0) {\n // Factor out any common prefixes.\n commonlength = diff_commonPrefix(text_insert, text_delete);\n if (commonlength !== 0) {\n if (previous_equality >= 0) {\n diffs[previous_equality][1] += text_insert.substring(0, commonlength);\n } else {\n diffs.splice(0, 0, [DIFF_EQUAL, text_insert.substring(0, commonlength)]);\n pointer++;\n }\n text_insert = text_insert.substring(commonlength);\n text_delete = text_delete.substring(commonlength);\n }\n // Factor out any common suffixes.\n commonlength = diff_commonSuffix(text_insert, text_delete);\n if (commonlength !== 0) {\n diffs[pointer][1] =\n text_insert.substring(text_insert.length - commonlength) + diffs[pointer][1];\n text_insert = text_insert.substring(0, text_insert.length - commonlength);\n text_delete = text_delete.substring(0, text_delete.length - commonlength);\n }\n }\n // Delete the offending records and add the merged ones.\n var n = count_insert + count_delete;\n if (text_delete.length === 0 && text_insert.length === 0) {\n diffs.splice(pointer - n, n);\n pointer = pointer - n;\n } else if (text_delete.length === 0) {\n diffs.splice(pointer - n, n, [DIFF_INSERT, text_insert]);\n pointer = pointer - n + 1;\n } else if (text_insert.length === 0) {\n diffs.splice(pointer - n, n, [DIFF_DELETE, text_delete]);\n pointer = pointer - n + 1;\n } else {\n diffs.splice(pointer - n, n, [DIFF_DELETE, text_delete], [DIFF_INSERT, text_insert]);\n pointer = pointer - n + 2;\n }\n }\n if (pointer !== 0 && diffs[pointer - 1][0] === DIFF_EQUAL) {\n // Merge this equality with the previous one.\n diffs[pointer - 1][1] += diffs[pointer][1];\n diffs.splice(pointer, 1);\n } else {\n pointer++;\n }\n count_insert = 0;\n count_delete = 0;\n text_delete = '';\n text_insert = '';\n break;\n }\n }\n if (diffs[diffs.length - 1][1] === '') {\n diffs.pop(); // Remove the dummy entry at the end.\n }\n\n // Second pass: look for single edits surrounded on both sides by equalities\n // which can be shifted sideways to eliminate an equality.\n // e.g: ABAC -> ABAC\n var changes = false;\n pointer = 1;\n // Intentionally ignore the first and last element (don't need checking).\n while (pointer < diffs.length - 1) {\n if (diffs[pointer - 1][0] === DIFF_EQUAL &&\n diffs[pointer + 1][0] === DIFF_EQUAL) {\n // This is a single edit surrounded by equalities.\n if (diffs[pointer][1].substring(diffs[pointer][1].length -\n diffs[pointer - 1][1].length) === diffs[pointer - 1][1]) {\n // Shift the edit over the previous equality.\n diffs[pointer][1] = diffs[pointer - 1][1] +\n diffs[pointer][1].substring(0, diffs[pointer][1].length -\n diffs[pointer - 1][1].length);\n diffs[pointer + 1][1] = diffs[pointer - 1][1] + diffs[pointer + 1][1];\n diffs.splice(pointer - 1, 1);\n changes = true;\n } else if (diffs[pointer][1].substring(0, diffs[pointer + 1][1].length) ==\n diffs[pointer + 1][1]) {\n // Shift the edit over the next equality.\n diffs[pointer - 1][1] += diffs[pointer + 1][1];\n diffs[pointer][1] =\n diffs[pointer][1].substring(diffs[pointer + 1][1].length) +\n diffs[pointer + 1][1];\n diffs.splice(pointer + 1, 1);\n changes = true;\n }\n }\n pointer++;\n }\n // If shifts were made, the diff needs reordering and another shift sweep.\n if (changes) {\n diff_cleanupMerge(diffs, fix_unicode);\n }\n};\n\nfunction is_surrogate_pair_start(charCode) {\n return charCode >= 0xD800 && charCode <= 0xDBFF;\n}\n\nfunction is_surrogate_pair_end(charCode) {\n return charCode >= 0xDC00 && charCode <= 0xDFFF;\n}\n\nfunction starts_with_pair_end(str) {\n return is_surrogate_pair_end(str.charCodeAt(0));\n}\n\nfunction ends_with_pair_start(str) {\n return is_surrogate_pair_start(str.charCodeAt(str.length - 1));\n}\n\nfunction remove_empty_tuples(tuples) {\n var ret = [];\n for (var i = 0; i < tuples.length; i++) {\n if (tuples[i][1].length > 0) {\n ret.push(tuples[i]);\n }\n }\n return ret;\n}\n\nfunction make_edit_splice(before, oldMiddle, newMiddle, after) {\n if (ends_with_pair_start(before) || starts_with_pair_end(after)) {\n return null;\n }\n return remove_empty_tuples([\n [DIFF_EQUAL, before],\n [DIFF_DELETE, oldMiddle],\n [DIFF_INSERT, newMiddle],\n [DIFF_EQUAL, after]\n ]);\n}\n\nfunction find_cursor_edit_diff(oldText, newText, cursor_pos) {\n // note: this runs after equality check has ruled out exact equality\n var oldRange = typeof cursor_pos === 'number' ?\n { index: cursor_pos, length: 0 } : cursor_pos.oldRange;\n var newRange = typeof cursor_pos === 'number' ?\n null : cursor_pos.newRange;\n // take into account the old and new selection to generate the best diff\n // possible for a text edit. for example, a text change from \"xxx\" to \"xx\"\n // could be a delete or forwards-delete of any one of the x's, or the\n // result of selecting two of the x's and typing \"x\".\n var oldLength = oldText.length;\n var newLength = newText.length;\n if (oldRange.length === 0 && (newRange === null || newRange.length === 0)) {\n // see if we have an insert or delete before or after cursor\n var oldCursor = oldRange.index;\n var oldBefore = oldText.slice(0, oldCursor);\n var oldAfter = oldText.slice(oldCursor);\n var maybeNewCursor = newRange ? newRange.index : null;\n editBefore: {\n // is this an insert or delete right before oldCursor?\n var newCursor = oldCursor + newLength - oldLength;\n if (maybeNewCursor !== null && maybeNewCursor !== newCursor) {\n break editBefore;\n }\n if (newCursor < 0 || newCursor > newLength) {\n break editBefore;\n }\n var newBefore = newText.slice(0, newCursor);\n var newAfter = newText.slice(newCursor);\n if (newAfter !== oldAfter) {\n break editBefore;\n }\n var prefixLength = Math.min(oldCursor, newCursor);\n var oldPrefix = oldBefore.slice(0, prefixLength);\n var newPrefix = newBefore.slice(0, prefixLength);\n if (oldPrefix !== newPrefix) {\n break editBefore;\n }\n var oldMiddle = oldBefore.slice(prefixLength);\n var newMiddle = newBefore.slice(prefixLength);\n return make_edit_splice(oldPrefix, oldMiddle, newMiddle, oldAfter);\n }\n editAfter: {\n // is this an insert or delete right after oldCursor?\n if (maybeNewCursor !== null && maybeNewCursor !== oldCursor) {\n break editAfter;\n }\n var cursor = oldCursor;\n var newBefore = newText.slice(0, cursor);\n var newAfter = newText.slice(cursor);\n if (newBefore !== oldBefore) {\n break editAfter;\n }\n var suffixLength = Math.min(oldLength - cursor, newLength - cursor);\n var oldSuffix = oldAfter.slice(oldAfter.length - suffixLength);\n var newSuffix = newAfter.slice(newAfter.length - suffixLength);\n if (oldSuffix !== newSuffix) {\n break editAfter;\n }\n var oldMiddle = oldAfter.slice(0, oldAfter.length - suffixLength);\n var newMiddle = newAfter.slice(0, newAfter.length - suffixLength);\n return make_edit_splice(oldBefore, oldMiddle, newMiddle, oldSuffix);\n }\n }\n if (oldRange.length > 0 && newRange && newRange.length === 0) {\n replaceRange: {\n // see if diff could be a splice of the old selection range\n var oldPrefix = oldText.slice(0, oldRange.index);\n var oldSuffix = oldText.slice(oldRange.index + oldRange.length);\n var prefixLength = oldPrefix.length;\n var suffixLength = oldSuffix.length;\n if (newLength < prefixLength + suffixLength) {\n break replaceRange;\n }\n var newPrefix = newText.slice(0, prefixLength);\n var newSuffix = newText.slice(newLength - suffixLength);\n if (oldPrefix !== newPrefix || oldSuffix !== newSuffix) {\n break replaceRange;\n }\n var oldMiddle = oldText.slice(prefixLength, oldLength - suffixLength);\n var newMiddle = newText.slice(prefixLength, newLength - suffixLength);\n return make_edit_splice(oldPrefix, oldMiddle, newMiddle, oldSuffix);\n }\n }\n\n return null;\n}\n\nfunction diff(text1, text2, cursor_pos) {\n // only pass fix_unicode=true at the top level, not when diff_main is\n // recursively invoked\n return diff_main(text1, text2, cursor_pos, true);\n}\n\ndiff.INSERT = DIFF_INSERT;\ndiff.DELETE = DIFF_DELETE;\ndiff.EQUAL = DIFF_EQUAL;\n\nmodule.exports = diff;\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNTguanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvcXVpbGwtZGVsdGEvbm9kZV9tb2R1bGVzL2Zhc3QtZGlmZi9kaWZmLmpzP2QzMDciXSwic291cmNlc0NvbnRlbnQiOlsiLyoqXG4gKiBUaGlzIGxpYnJhcnkgbW9kaWZpZXMgdGhlIGRpZmYtcGF0Y2gtbWF0Y2ggbGlicmFyeSBieSBOZWlsIEZyYXNlclxuICogYnkgcmVtb3ZpbmcgdGhlIHBhdGNoIGFuZCBtYXRjaCBmdW5jdGlvbmFsaXR5IGFuZCBjZXJ0YWluIGFkdmFuY2VkXG4gKiBvcHRpb25zIGluIHRoZSBkaWZmIGZ1bmN0aW9uLiBUaGUgb3JpZ2luYWwgbGljZW5zZSBpcyBhcyBmb2xsb3dzOlxuICpcbiAqID09PVxuICpcbiAqIERpZmYgTWF0Y2ggYW5kIFBhdGNoXG4gKlxuICogQ29weXJpZ2h0IDIwMDYgR29vZ2xlIEluYy5cbiAqIGh0dHA6Ly9jb2RlLmdvb2dsZS5jb20vcC9nb29nbGUtZGlmZi1tYXRjaC1wYXRjaC9cbiAqXG4gKiBMaWNlbnNlZCB1bmRlciB0aGUgQXBhY2hlIExpY2Vuc2UsIFZlcnNpb24gMi4wICh0aGUgXCJMaWNlbnNlXCIpO1xuICog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dHldWzFdID0gZGlmZnNbcHJldmlvdXNfZXF1YWxpdHldWzFdLnNsaWNlKDAsIC0xKTtcbiAgICAgICAgICAgIHRleHRfZGVsZXRlID0gc3RyYXkgKyB0ZXh0X2RlbGV0ZTtcbiAgICAgICAgICAgIHRleHRfaW5zZXJ0ID0gc3RyYXkgKyB0ZXh0X2luc2VydDtcbiAgICAgICAgICAgIGlmICghZGlmZnNbcHJldmlvdXNfZXF1YWxpdHldWzFdKSB7XG4gICAgICAgICAgICAgIC8vIGVtcHRpZWQgb3V0IHByZXZpb3VzIGVxdWFsaXR5LCBzbyBkZWxldGUgaXQgYW5kIGluY2x1ZGUgcHJldmlvdXMgZGVsZXRlL2luc2VydFxuICAgICAgICAgICAgICBkaWZmcy5zcGxpY2UocHJldmlvdXNfZXF1YWxpdHksIDEpO1xuICAgICAgICAgICAgICBwb2ludGVyLS07XG4gICAgICAgICAgICAgIHZhciBrID0gcHJldmlvdXNfZXF1YWxpdHkgLSAxO1xuICAgICAgICAgICAgICBpZiAoZGlmZnNba10gJiYgZGlmZnNba11bMF0gPT09IERJRkZfSU5TRVJUKSB7XG4gICAgICAgICAgICAgICAgY291bnRfaW5zZXJ0Kys7XG4gICAgICAgICAgICAgICAgdGV4dF9pbnNlcnQgPSBkaWZmc1trXVsxXSArIHRleHRfaW5zZXJ0O1xuICAgICAgICAgICAgICAgIGstLTtcbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICBpZiAoZGlmZnNba10gJiYgZGlmZnNba11bMF0gPT09IERJRkZfREVMRVRFKSB7XG4gICAgICAgICAgICAgICAgY291bnRfZGVsZXRlKys7XG4gICAgICAgICAgICAgICAgdGV4dF9kZWxldGUgPSBkaWZmc1trXVsxXSArIHRleHRfZGVsZXRlO1xuICAgICAgICAgICAgICAgIGstLTtcbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICBwcmV2aW91c19lcXVhbGl0eSA9IGs7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgfVxuICAgIC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UNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOyIsInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///58\n")},function(module,exports,__webpack_require__){"use strict";eval("\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar deep_equal_1 = __importDefault(__webpack_require__(36));\nvar extend_1 = __importDefault(__webpack_require__(41));\nvar AttributeMap;\n(function (AttributeMap) {\n function compose(a, b, keepNull) {\n if (a === void 0) { a = {}; }\n if (b === void 0) { b = {}; }\n if (typeof a !== 'object') {\n a = {};\n }\n if (typeof b !== 'object') {\n b = {};\n }\n var attributes = extend_1.default(true, {}, b);\n if (!keepNull) {\n attributes = Object.keys(attributes).reduce(function (copy, key) {\n if (attributes[key] != null) {\n copy[key] = attributes[key];\n }\n return copy;\n }, {});\n }\n for (var key in a) {\n if (a[key] !== undefined && b[key] === undefined) {\n attributes[key] = a[key];\n }\n }\n return Object.keys(attributes).length > 0 ? attributes : undefined;\n }\n AttributeMap.compose = compose;\n function diff(a, b) {\n if (a === void 0) { a = {}; }\n if (b === void 0) { b = {}; }\n if (typeof a !== 'object') {\n a = {};\n }\n if (typeof b !== 'object') {\n b = {};\n }\n var attributes = Object.keys(a)\n .concat(Object.keys(b))\n .reduce(function (attrs, key) {\n if (!deep_equal_1.default(a[key], b[key])) {\n attrs[key] = b[key] === undefined ? null : b[key];\n }\n return attrs;\n }, {});\n return Object.keys(attributes).length > 0 ? attributes : undefined;\n }\n AttributeMap.diff = diff;\n function invert(attr, base) {\n if (attr === void 0) { attr = {}; }\n if (base === void 0) { base = {}; }\n attr = attr || {};\n var baseInverted = Object.keys(base).reduce(function (memo, key) {\n if (base[key] !== attr[key] && attr[key] !== undefined) {\n memo[key] = base[key];\n }\n return memo;\n }, {});\n return Object.keys(attr).reduce(function (memo, key) {\n if (attr[key] !== base[key] && base[key] === undefined) {\n memo[key] = null;\n }\n return memo;\n }, baseInverted);\n }\n AttributeMap.invert = invert;\n function transform(a, b, priority) {\n if (priority === void 0) { priority = false; }\n if (typeof a !== 'object') {\n return b;\n }\n if (typeof b !== 'object') {\n return undefined;\n }\n if (!priority) {\n return b; // b simply overwrites us without priority\n }\n var attributes = Object.keys(b).reduce(function (attrs, key) {\n if (a[key] === undefined) {\n attrs[key] = b[key]; // null is a valid value\n }\n return attrs;\n }, {});\n return Object.keys(attributes).length > 0 ? attributes : undefined;\n }\n AttributeMap.transform = transform;\n})(AttributeMap || (AttributeMap = {}));\nexports.default = AttributeMap;\n//# sourceMappingURL=AttributeMap.js.map//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNTkuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvcXVpbGwtZGVsdGEvZGlzdC9BdHRyaWJ1dGVNYXAuanM/ZTNmNCJdLCJzb3VyY2VzQ29udGVudCI6WyJcInVzZSBzdHJpY3RcIjtcbnZhciBfX2ltcG9ydERlZmF1bHQgPSAodGhpcyAmJiB0aGlzLl9faW1wb3J0RGVmYXVsdCkgfHwgZnVuY3Rpb24gKG1vZCkge1xuICAgIHJldHVybiAobW9kICYmIG1vZC5fX2VzTW9kdWxlKSA/IG1vZCA6IHsgXCJkZWZhdWx0XCI6IG1vZCB9O1xufTtcbk9iamVjdC5kZWZpbmVQcm9wZXJ0eShleHBvcnRzLCBcIl9fZXNNb2R1bGVcIiwgeyB2YWx1ZTogdHJ1ZSB9KTtcbnZhciBkZWVwX2VxdWFsXzEgPSBfX2ltcG9ydERlZmF1bHQocmVxdWlyZShcImRlZXAtZXF1YWxcIikpO1xudmFyIGV4dGVuZF8xID0gX19pbXBvcnREZWZhdWx0KHJlcXVpcmUoXCJleHRlbmRcIikpO1xudmFyIEF0dHJpYnV0ZU1hcDtcbihmdW5jdGlvbiAoQXR0cmlidXRlTWFwKSB7XG4gICAgZnVuY3Rpb24gY29tcG9zZShhLCBiLCBrZWVwTnVsbCkge1xuICAgICAgICBpZiAoYSA9PT0gdm9pZCAwKSB7IGEgPSB7fTsgfVxuICAgICAgICBpZiAoYiA9PT0gdm9pZCAwKSB7IGIgPSB7fTsgfVxuICAgICAgICBpZiAodHlwZW9mIGEgIT09ICdvYmplY3QnKSB7XG4gICAgICAgICAgICBhID0ge307XG4gICAgICAgIH1cbiAgICAgICAgaWYgKHR5cGVvZiBiICE9PSAnb2JqZWN0Jykge1xuICAgICAgICAgICAgYiA9IHt9O1xuICAgICAgICB9XG4gICAgICAgIHZhciBhdHRyaWJ1dGVzID0gZXh0ZW5kXzEuZGVmYXVsdCh0cnVlLCB7fSwgYik7XG4gICAgICAgIGlmICgha2VlcE51bGwpIHtcbiAgICAgICAgICAgIGF0dHJpYnV0ZXMgPSBPYmplY3Qua2V5cyhhdHRyaWJ1dGVzKS5yZWR1Y2UoZnVuY3Rpb24gKGNvcHksIGtleSkge1xuICAgICAgICAgICAgICAgIGlmIChhdHRyaWJ1dGVzW2tleV0gIT0gbnVsbCkge1xuICAgICAgICAgICAgICAgICAgICBjb3B5W2tleV0gPSBhdHRyaWJ1dGVzW2tleV07XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIHJldHVybiBjb3B5O1xuICAgICAgICAgICAgfSwge30pO1xuICAgICAgICB9XG4gICAgICAgIGZvciAodmFyIGtleSBpbiBhKSB7XG4gICAgICAgICAgICBpZiAoYVtrZXldICE9PSB1bmRlZmluZWQgJiYgYltrZXldID09PSB1bmRlZmluZWQpIHtcbiAgICAgICAgICAgICAgICBhdHRyaWJ1dGVzW2tleV0gPSBhW2tleV07XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIE9iamVjdC5rZXlzKGF0dHJpYnV0ZXMpLmxlbmd0aCA+IDAgPyBhdHRyaWJ1dGVzIDogdW5kZWZpbmVkO1xuICAgIH1cbiAgICBBdHRyaWJ1dGVNYXAuY29tcG9zZSA9IGNvbXBvc2U7XG4gICAgZnVuY3Rpb24gZGlmZihhLCBiKSB7XG4gICAgICAgIGlmIChhID09PSB2b2lkIDApIHsgYSA9IHt9OyB9XG4gICAgICAgIGlmIChiID09PSB2b2lkIDApIHsgYiA9IHt9OyB9XG4gICAgICAgIGlmICh0eXBlb2YgYSAhPT0gJ29iamVjdCcpIHtcbiAgICAgICAgICAgIGEgPSB7fTtcbiAgICAgICAgfVxuICAgICAgICBpZiAodHlwZW9mIGIgIT09ICdvYmplY3QnKSB7XG4gICAgICAgICAgICBiID0ge307XG4gICAgICAgIH1cbiAgICAgICAgdmFyIGF0dHJpYnV0ZXMgPSBPYmplY3Qua2V5cyhhKVxuICAgICAgICAgICAgLmNvbmNhdChPYmplY3Qua2V5cyhiKSlcbiAgICAgICAgICAgIC5yZWR1Y2UoZnVuY3Rpb24gKGF0dHJzLCBrZXkpIHtcbiAgICAgICAgICAgIGlmICghZGVlcF9lcXVhbF8xLmRlZmF1bHQoYVtrZXldLCBiW2tleV0pKSB7XG4gICAgICAgICAgICAgICAgYXR0cnNba2V5XSA9IGJba2V5XSA9PT0gdW5kZWZpbmVkID8gbnVsbCA6IGJba2V5XTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHJldHVybiBhdHRycztcbiAgICAgICAgfSwge30pO1xuICAgICAgICByZXR1cm4gT2JqZWN0LmtleXMoYXR0cmlidXRlcykubGVuZ3RoID4gMCA/IGF0dHJpYnV0ZXMgOiB1bmRlZmluZWQ7XG4gICAgfVxuICAgIEF0dHJpYnV0ZU1hcC5kaWZmID0gZGlmZjtcbiAgICBmdW5jdGlvbiBpbnZlcnQoYXR0ciwgYmFzZSkge1xuICAgICAgICBpZiAoYXR0ciA9PT0gdm9pZCAwKSB7IGF0dHIgPSB7fTsgfVxuICAgICAgICBpZiAoYmFzZSA9PT0gdm9pZCAwKSB7IGJhc2UgPSB7fTsgfVxuICAgICAgICBhdHRyID0gYXR0ciB8fCB7fTtcbiAgICAgICAgdmFyIGJhc2VJbnZlcnRlZCA9IE9iamVjdC5rZXlzKGJhc2UpLnJlZHVjZShmdW5jdGlvbiAobWVtbywga2V5KSB7XG4gICAgICAgICAgICBpZiAoYmFzZVtrZXldICE9PSBhdHRyW2tleV0gJiYgYXR0cltrZXldICE9PSB1bmRlZmluZWQpIHtcbiAgICAgICAgICAgICAgICBtZW1vW2tleV0gPSBiYXNlW2tleV07XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByZXR1cm4gbWVtbztcbiAgICAgICAgfSwge30pO1xuICAgICAgICByZXR1cm4gT2JqZWN0LmtleXMoYXR0cikucmVkdWNlKGZ1bmN0aW9uIChtZW1vLCBrZXkpIHtcbiAgICAgICAgICAgIGlmIChhdHRyW2tleV0gIT09IGJhc2Vba2V5XSAmJiBiYXNlW2tleV0gPT09IHVuZGVmaW5lZCkge1xuICAgICAgICAgICAgICAgIG1lbW9ba2V5XSA9IG51bGw7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByZXR1cm4gbWVtbztcbiAgICAgICAgfSwgYmFzZUludmVydGVkKTtcbiAgICB9XG4gICAgQXR0cmlidXRlTWFwLmludmVydCA9IGludmVydDtcbiAgICBmdW5jdGlvbiB0cmFuc2Zvcm0oYSwgYiwgcHJpb3JpdHkpIHtcbiAgICAgICAgaWYgKHByaW9yaXR5ID09PSB2b2lkIDApIHsgcHJpb3JpdHkgPSBmYWxzZTsgfVxuICAgICAgICBpZiAodHlwZW9mIGEgIT09ICdvYmplY3QnKSB7XG4g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FDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBIiwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///59\n")},function(module,exports,__webpack_require__){"use strict";eval("\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar Op_1 = __importDefault(__webpack_require__(42));\nvar Iterator = /** @class */ (function () {\n function Iterator(ops) {\n this.ops = ops;\n this.index = 0;\n this.offset = 0;\n }\n Iterator.prototype.hasNext = function () {\n return this.peekLength() < Infinity;\n };\n Iterator.prototype.next = function (length) {\n if (!length) {\n length = Infinity;\n }\n var nextOp = this.ops[this.index];\n if (nextOp) {\n var offset = this.offset;\n var opLength = Op_1.default.length(nextOp);\n if (length >= opLength - offset) {\n length = opLength - offset;\n this.index += 1;\n this.offset = 0;\n }\n else {\n this.offset += length;\n }\n if (typeof nextOp.delete === 'number') {\n return { delete: length };\n }\n else {\n var retOp = {};\n if (nextOp.attributes) {\n retOp.attributes = nextOp.attributes;\n }\n if (typeof nextOp.retain === 'number') {\n retOp.retain = length;\n }\n else if (typeof nextOp.insert === 'string') {\n retOp.insert = nextOp.insert.substr(offset, length);\n }\n else {\n // offset should === 0, length should === 1\n retOp.insert = nextOp.insert;\n }\n return retOp;\n }\n }\n else {\n return { retain: Infinity };\n }\n };\n Iterator.prototype.peek = function () {\n return this.ops[this.index];\n };\n Iterator.prototype.peekLength = function () {\n if (this.ops[this.index]) {\n // Should never return 0 if our index is being managed correctly\n return Op_1.default.length(this.ops[this.index]) - this.offset;\n }\n else {\n return Infinity;\n }\n };\n Iterator.prototype.peekType = function () {\n if (this.ops[this.index]) {\n if (typeof this.ops[this.index].delete === 'number') {\n return 'delete';\n }\n else if (typeof this.ops[this.index].retain === 'number') {\n return 'retain';\n }\n else {\n return 'insert';\n }\n }\n return 'retain';\n };\n Iterator.prototype.rest = function () {\n if (!this.hasNext()) {\n return [];\n }\n else if (this.offset === 0) {\n return this.ops.slice(this.index);\n }\n else {\n var offset = this.offset;\n var index = this.index;\n var next = this.next();\n var rest = this.ops.slice(this.index);\n this.offset = offset;\n this.index = index;\n return [next].concat(rest);\n }\n };\n return Iterator;\n}());\nexports.default = Iterator;\n//# sourceMappingURL=Iterator.js.map//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNjAuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvcXVpbGwtZGVsdGEvZGlzdC9JdGVyYXRvci5qcz8wYmViIl0sInNvdXJjZXNDb250ZW50IjpbIlwidXNlIHN0cmljdFwiO1xudmFyIF9faW1wb3J0RGVmYXVsdCA9ICh0aGlzICYmIHRoaXMuX19pbXBvcnREZWZhdWx0KSB8fCBmdW5jdGlvbiAobW9kKSB7XG4gICAgcmV0dXJuIChtb2QgJiYgbW9kLl9fZXNNb2R1bGUpID8gbW9kIDogeyBcImRlZmF1bHRcIjogb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gICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgdGhpcy5vZmZzZXQgKz0gbGVuZ3RoO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKHR5cGVvZiBuZXh0T3AuZGVsZXRlID09PSAnbnVtYmVyJykge1xuICAgICAgICAgICAgICAgIHJldHVybiB7IGRlbGV0ZTogbGVuZ3RoIH07XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgICB2YXIgcmV0T3AgPSB7fTtcbiAgICAgICAgICAgICAgICBpZiAobmV4dE9wLmF0dHJpYnV0ZXMpIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0T3AuYXR0cmlidXRlcyA9IG5leHRPcC5hdHRyaWJ1dGVzO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBpZiAodHlwZW9mIG5leHRPcC5yZXRhaW4gPT09ICdudW1iZXInKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldE9wLnJldGFpbiA9IGxlbmd0aDtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgZWxzZSBpZiAodHlwZW9mIG5leHRPcC5pbnNlcnQgPT09ICdzdHJpbmcnKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldE9wLmluc2VydCA9IG5leHRPcC5pbnNlcnQuc3Vic3RyKG9mZnNldCwgbGVuZ3RoKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIC8vIG9mZnNldCBzaG91bGQgPT09IDAsIGxlbmd0aCBzaG91bGQgPT09IDFcbiAgICAgICAgICAgICAgICAgICAgcmV0T3AuaW5zZXJ0ID0gbmV4dE9wLmluc2VydDtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgcmV0dXJuIHJldE9wO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgcmV0dXJuIHsgcmV0YWluOiBJbmZpbml0eSB9O1xuICAgICAgICB9XG4gICAgfTtcbiAgICBJdGVyYXRvci5wcm90b3R5cGUucGVlayA9IGZ1bmN0aW9uICgpIHtcbiAgICAgICAgcmV0dXJuIHRoaXMub3BzW3RoaXMuaW5kZXhdO1xuICAgIH07XG4gICAgSXRlcmF0b3IucHJvdG90eXBlLnBlZWtMZW5ndGggPSBmdW5jdGlvbiAoKSB7XG4gICAgICAgIGlmICh0aGlzLm9wc1t0aGlzLmluZGV4XSkge1xuICAgICAgICAgICAgLy8gU2hvdWxkIG5ldmVyIHJldHVybiAwIGlmIG91ciBpbmRleCBpcyBiZWluZyBtYW5hZ2VkIGNvcnJlY3RseVxuICAgICAgICAgICAgcmV0dXJuIE9wXzEuZGVmYXVsdC5sZW5ndGgodGhpcy5vcHNbdGhpcy5pbmRleF0pIC0gdGhpcy5vZmZzZXQ7XG4gICAgICAgIH1cbiAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICByZXR1cm4gSW5maW5pdHk7XG4gICAgICAgIH1cbiAgICB9O1xuICAgIEl0ZXJhdG9yLnByb3RvdHlwZS5wZWVrVHlwZSA9IGZ1bmN0aW9uICgpIHtcbiAgICAgICAgaWYgKHRoaXMub3BzW3RoaXMuaW5kZXhdKSB7XG4gICAgICAgICAgICBpZiAodHlwZW9mIHRoaXMub3BzW3RoaXMuaW5kZXhdLmRlbGV0ZSA9PT0gJ251bWJlcicpIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gJ2RlbGV0ZSc7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBlbHNlIGlmICh0eXBlb2YgdGhpcy5vcHNbdGhpcy5pbmRleF0ucmV0YWluID09PSAnbnVtYmVyJykge1xuICAgICAgICAgICAgICAgIHJldHVybiAncmV0YWluJztcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgIHJldHVybiAnaW5zZXJ0JztcbiAgICAgICAgICAg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TtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBIiwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///60\n")},function(module,exports,__webpack_require__){eval("// extracted by mini-css-extract-plugin//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNjEuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9zcmMvaW5kZXguc3R5bD80YmQ3Il0sInNvdXJjZXNDb250ZW50IjpbIi8vIGV4dHJhY3RlZCBieSBtaW5pLWNzcy1leHRyYWN0LXBsdWdpbiJdLCJtYXBwaW5ncyI6IkFBQUEiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///61\n")},,function(module,__webpack_exports__,__webpack_require__){"use strict";eval("__webpack_require__.r(__webpack_exports__);\n\n// EXTERNAL MODULE: ./node_modules/quill/dist/quill.js\nvar quill = __webpack_require__(3);\nvar quill_default = /*#__PURE__*/__webpack_require__.n(quill);\n\n// EXTERNAL MODULE: ./node_modules/quill-delta/dist/Delta.js\nvar Delta = __webpack_require__(35);\nvar Delta_default = /*#__PURE__*/__webpack_require__.n(Delta);\n\n// EXTERNAL MODULE: ./node_modules/quill/assets/snow.styl\nvar snow = __webpack_require__(16);\n\n// EXTERNAL MODULE: ./src/index.styl\nvar src = __webpack_require__(61);\n\n// EXTERNAL MODULE: ./src/preview.styl\nvar preview = __webpack_require__(17);\n\n// CONCATENATED MODULE: ./src/blots/divider.ts\nvar __extends = (undefined && undefined.__extends) || (function () {\r\n var extendStatics = function (d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n };\r\n return function (d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n };\r\n})();\r\n\r\nvar BlockEmbed = quill_default.a.import('blots/block/embed');\r\nvar DividerBlot = /** @class */ (function (_super) {\r\n __extends(DividerBlot, _super);\r\n function DividerBlot() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n return DividerBlot;\r\n}(BlockEmbed));\r\nDividerBlot.blotName = 'divider';\r\nDividerBlot.tagName = 'hr';\r\nquill_default.a.register(DividerBlot);\r\n\n// EXTERNAL MODULE: ./node_modules/eventemitter3/index.js\nvar eventemitter3 = __webpack_require__(14);\nvar eventemitter3_default = /*#__PURE__*/__webpack_require__.n(eventemitter3);\n\n// CONCATENATED MODULE: ./src/blots/image.ts\nvar image_extends = (undefined && undefined.__extends) || (function () {\r\n var extendStatics = function (d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n };\r\n return function (d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n };\r\n})();\r\nvar __read = (undefined && undefined.__read) || function (o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n};\r\nvar __spread = (undefined && undefined.__spread) || function () {\r\n for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n};\r\n\r\n\r\nvar image_BlockEmbed = quill_default.a.import('blots/block/embed');\r\nvar image_ImageBlot = /** @class */ (function (_super) {\r\n image_extends(ImageBlot, _super);\r\n function ImageBlot(node) {\r\n var _this = _super.call(this, node) || this;\r\n node.addEventListener('click', function (e) {\r\n if (ImageBlot.quill.hasFocus()) {\r\n ImageBlot.quill.blur();\r\n }\r\n });\r\n var _a = ImageBlot.getImgAndValue(node), img = _a.img, _b = _a.value, id = _b.id, src = _b.src, srcNode = _b.srcNode, _c = _b.width, width = _c === void 0 ? 0 : _c, _d = _b.height, height = _d === void 0 ? 0 : _d;\r\n if (id) {\r\n node.classList.add(\"image-\" + id);\r\n var status_1 = ImageBlot.uploadStatus[id];\r\n if (status_1) {\r\n ImageBlot.eventEmitter.emit('reinsert', {\r\n id: id,\r\n status: status_1.status || 'UPLOADING',\r\n });\r\n }\r\n else {\r\n ImageBlot.uploadStatus[id] = {};\r\n }\r\n }\r\n else {\r\n setTimeout(function () {\r\n if (!_this.prev)\r\n return;\r\n var pNode = _this.prev.domNode;\r\n if (pNode.tagName === 'P' && !pNode.innerText.trim()) {\r\n _this.prev.remove(); // 移除图片前面的空行\r\n }\r\n }, 0);\r\n }\r\n if (img && src) {\r\n var appendEls_1 = function (width, height) {\r\n var wrap = node.querySelector('.image-wrap');\r\n if (width >= 50 && height >= 50) {\r\n if (!node.querySelector('.remove')) {\r\n var div = ImageBlot.createDiv('remove');\r\n div.addEventListener('click', function () {\r\n _this.remove();\r\n });\r\n wrap.appendChild(div);\r\n }\r\n }\r\n if (id) {\r\n ImageBlot.refreshUpload(id);\r\n }\r\n else if (!srcNode) {\r\n var remoteId = \"remote-\" + ImageBlot.remoteCounter++;\r\n node.classList.add(remoteId);\r\n ImageBlot.eventEmitter.emit('insertRemoteImage', {\r\n remoteId: remoteId,\r\n src: src,\r\n width: width,\r\n height: height,\r\n });\r\n }\r\n };\r\n if (width && height) {\r\n appendEls_1(width, height);\r\n }\r\n else {\r\n img.addEventListener('load', function (e) {\r\n if (img.naturalWidth && img.naturalHeight) {\r\n img.dataset.width = \"\" + img.naturalWidth;\r\n img.dataset.height = \"\" + img.naturalHeight;\r\n }\r\n appendEls_1(img.naturalWidth, img.naturalHeight);\r\n });\r\n }\r\n }\r\n return _this;\r\n }\r\n ImageBlot.refreshUpload = function (id) {\r\n setTimeout(function () {\r\n var _a = ImageBlot.uploadStatus[id] || {}, status = _a.status, progress = _a.progress, error = _a.error, src = _a.src, srcNode = _a.srcNode;\r\n if (status === 'UPLOADING') {\r\n ImageBlot.updateUploadProgress(id, progress);\r\n }\r\n else if (status === 'SUCCESS') {\r\n ImageBlot.setUploadSuccess(id, src, srcNode);\r\n }\r\n else if (status === 'ERROR') {\r\n ImageBlot.setUploadError(id, error);\r\n }\r\n }, 0);\r\n };\r\n ImageBlot.uploadRemoteImage = function (remoteId, id) {\r\n if (ImageBlot.uploadStatus[id])\r\n return;\r\n var node = document.querySelector(\"div.\" + remoteId);\r\n if (node) {\r\n ImageBlot.uploadStatus[id] = {};\r\n node.classList.add(\"image-\" + id);\r\n node.classList.remove(remoteId);\r\n node.querySelector('img.image').dataset.id = id;\r\n }\r\n };\r\n ImageBlot.updateUploadProgress = function (id, progress) {\r\n if ((ImageBlot.uploadStatus[id] || {}).status === 'SUCCESS')\r\n return;\r\n ImageBlot.uploadStatus[id] = { status: 'UPLOADING', progress: Math.round(progress) };\r\n document.querySelectorAll(\"div.image-\" + id).forEach(function (node) {\r\n node.classList.remove('fail');\r\n var wrap = node.querySelector('.image-wrap');\r\n if (!wrap.querySelector('.progress-bar')) {\r\n var div = ImageBlot.createDiv('progress-bar');\r\n var child = ImageBlot.createDiv('progress');\r\n child.style.width = Math.round(progress) + \"%\";\r\n div.appendChild(child);\r\n wrap.appendChild(div);\r\n }\r\n else {\r\n var child = wrap.querySelector('.progress');\r\n child.style.width = Math.round(progress) + \"%\";\r\n }\r\n });\r\n };\r\n ImageBlot.setUploadError = function (id, error) {\r\n if ((ImageBlot.uploadStatus[id] || {}).status === 'SUCCESS')\r\n return;\r\n ImageBlot.uploadStatus[id] = { status: 'ERROR', error: error };\r\n document.querySelectorAll(\"div.image-\" + id).forEach(function (node) {\r\n if (!node.classList.contains('fail'))\r\n node.classList.add('fail');\r\n var wrap = node.querySelector('.image-wrap');\r\n var div = wrap.querySelector('div.error');\r\n if (!div) {\r\n div = ImageBlot.createDiv('error');\r\n div.addEventListener('click', function () {\r\n node.classList.remove('fail');\r\n ImageBlot.uploadStatus[id] = {};\r\n ImageBlot.eventEmitter.emit('reupload', { id: id });\r\n });\r\n wrap.appendChild(div);\r\n }\r\n var html = '上传失败,点击重试';\r\n if (error) {\r\n html += \"\" + error + \"\";\r\n }\r\n div.innerHTML = html;\r\n });\r\n };\r\n ImageBlot.setUploadSuccess = function (id, src, srcNode) {\r\n ImageBlot.uploadStatus[id] = { status: 'SUCCESS', src: src };\r\n document.querySelectorAll(\"div.image-\" + id).forEach(function (node) {\r\n var p = node.querySelector('div.progress-bar');\r\n var e = node.querySelector('div.error');\r\n if (p)\r\n p.remove();\r\n if (e)\r\n e.remove();\r\n var img = node.querySelector('img.image');\r\n if (img) {\r\n // img.setAttribute('src', src) 将导致图片闪动\r\n if (srcNode) {\r\n img.dataset.srcNode = srcNode;\r\n }\r\n img.dataset.src = src;\r\n }\r\n node.classList.remove(\"image-\" + id);\r\n });\r\n };\r\n ImageBlot.createDiv = function () {\r\n var _a;\r\n var classNames = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n classNames[_i] = arguments[_i];\r\n }\r\n var div = document.createElement('div');\r\n div.setAttribute('contenteditable', 'false');\r\n if (classNames.length > 0) {\r\n (_a = div.classList).add.apply(_a, __spread(classNames));\r\n }\r\n return div;\r\n };\r\n ImageBlot.create = function (value) {\r\n if (typeof value === 'string') {\r\n value = { src: value };\r\n }\r\n var node = _super.create.call(this);\r\n node.setAttribute('contenteditable', 'false');\r\n var wrap = ImageBlot.createDiv('image-wrap');\r\n node.appendChild(wrap);\r\n var img = document.createElement('img');\r\n img.classList.add('image');\r\n if (value.id) {\r\n img.dataset.id = value.id;\r\n }\r\n if (value.width && value.height) {\r\n img.dataset.width = \"\" + value.width;\r\n img.dataset.height = \"\" + value.height;\r\n }\r\n if (value.srcNode) {\r\n img.dataset.srcNode = value.srcNode;\r\n }\r\n img.setAttribute('src', value.src);\r\n wrap.appendChild(img);\r\n return node;\r\n };\r\n ImageBlot.getImgAndValue = function (node) {\r\n var img = node.tagName.toUpperCase() === 'IMG'\r\n ? node\r\n : node.querySelector('img.image');\r\n var value = {\r\n src: (img && img.getAttribute('src')) || '',\r\n };\r\n if (img) {\r\n if (img.dataset.id) {\r\n value.id = img.dataset.id;\r\n }\r\n var width = Number(img.dataset.width);\r\n var height = Number(img.dataset.height);\r\n if (width && height) {\r\n value.width = width;\r\n value.height = height;\r\n }\r\n if (img.dataset.srcNode) {\r\n value.srcNode = img.dataset.srcNode;\r\n }\r\n }\r\n return { img: img, value: value };\r\n };\r\n ImageBlot.value = function (node) {\r\n return ImageBlot.getImgAndValue(node).value;\r\n };\r\n ImageBlot.prototype.remove = function () {\r\n var id = ImageBlot.value(this.domNode).id;\r\n if (id) {\r\n var status_2 = ImageBlot.uploadStatus[id];\r\n ImageBlot.eventEmitter.emit('remove', {\r\n id: id,\r\n status: status_2.status || 'UPLOADING',\r\n });\r\n }\r\n _super.prototype.remove.call(this);\r\n };\r\n ImageBlot.pendingImages = function () {\r\n return Object.keys(ImageBlot.uploadStatus).filter(function (id) {\r\n return ImageBlot.uploadStatus[id].status !== 'SUCCESS';\r\n });\r\n };\r\n ImageBlot.buildHtml = function (node) {\r\n node.querySelectorAll('div.image-container').forEach(function (el) {\r\n var img = el.querySelector('img.image');\r\n if (img && (!img.dataset.id || img.dataset.src)) {\r\n if (img.dataset.src) {\r\n img.setAttribute('src', img.dataset.src);\r\n delete img.dataset.src;\r\n }\r\n delete img.dataset.id;\r\n img.removeAttribute('class');\r\n img.removeAttribute('style');\r\n el.parentNode.insertBefore(img, el.nextSibling);\r\n }\r\n el.remove();\r\n });\r\n return node;\r\n };\r\n ImageBlot.tagName = 'div';\r\n ImageBlot.blotName = 'image';\r\n ImageBlot.className = 'image-container';\r\n ImageBlot.remoteCounter = 1;\r\n ImageBlot.eventEmitter = new eventemitter3_default.a();\r\n ImageBlot.uploadStatus = {};\r\n return ImageBlot;\r\n}(image_BlockEmbed));\r\n\r\nquill_default.a.register(image_ImageBlot, true);\r\n\n// CONCATENATED MODULE: ./src/blots/video.ts\nvar video_extends = (undefined && undefined.__extends) || (function () {\r\n var extendStatics = function (d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n };\r\n return function (d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n };\r\n})();\r\nvar video_read = (undefined && undefined.__read) || function (o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n};\r\nvar video_spread = (undefined && undefined.__spread) || function () {\r\n for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(video_read(arguments[i]));\r\n return ar;\r\n};\r\n\r\n\r\nvar video_BlockEmbed = quill_default.a.import('blots/block/embed');\r\nvar video_VideoBlot = /** @class */ (function (_super) {\r\n video_extends(VideoBlot, _super);\r\n function VideoBlot(node) {\r\n var _this = _super.call(this, node) || this;\r\n node.addEventListener('click', function (e) {\r\n if (VideoBlot.quill.hasFocus()) {\r\n VideoBlot.quill.blur();\r\n }\r\n });\r\n var _a = VideoBlot.getVideoAndValue(node), video = _a.video, _b = _a.value, id = _b.id, src = _b.src, width = _b.width, height = _b.height;\r\n if (id) {\r\n node.classList.add(\"video-\" + id);\r\n var status_1 = VideoBlot.uploadStatus[id];\r\n if (status_1) {\r\n VideoBlot.eventEmitter.emit('reinsert', {\r\n id: id,\r\n status: status_1.status || 'UPLOADING',\r\n });\r\n }\r\n else {\r\n VideoBlot.uploadStatus[id] = {};\r\n }\r\n }\r\n if (video && src) {\r\n if (id && !node.querySelector('.progress-bar')) {\r\n var div = VideoBlot.createDiv('progress-bar');\r\n div.appendChild(VideoBlot.createDiv('progress'));\r\n node.appendChild(div);\r\n }\r\n if (id && !node.querySelector('.error')) {\r\n var div = VideoBlot.createDiv('error');\r\n div.addEventListener('click', function () {\r\n VideoBlot.uploadStatus[id] = {};\r\n _this.domNode.classList.remove('fail');\r\n VideoBlot.eventEmitter.emit('reupload', { id: id });\r\n });\r\n node.appendChild(div);\r\n }\r\n if (!node.querySelector('.remove')) {\r\n var div = VideoBlot.createDiv('remove');\r\n div.addEventListener('click', function () {\r\n _this.remove();\r\n });\r\n node.appendChild(div);\r\n }\r\n if (id)\r\n VideoBlot.refreshUpload(id);\r\n }\r\n return _this;\r\n }\r\n VideoBlot.refreshUpload = function (id) {\r\n setTimeout(function () {\r\n var _a = VideoBlot.uploadStatus[id] || {}, status = _a.status, progress = _a.progress, error = _a.error, src = _a.src, srcNode = _a.srcNode, poster = _a.poster, posterNode = _a.posterNode;\r\n if (status === 'UPLOADING') {\r\n VideoBlot.updateUploadProgress(id, progress);\r\n }\r\n else if (status === 'SUCCESS') {\r\n VideoBlot.setUploadSuccess(id, { src: src, srcNode: srcNode, poster: poster, posterNode: posterNode });\r\n }\r\n else if (status === 'ERROR') {\r\n VideoBlot.setUploadError(id, error);\r\n }\r\n }, 0);\r\n };\r\n VideoBlot.updateUploadProgress = function (id, progress) {\r\n if ((VideoBlot.uploadStatus[id] || {}).status === 'SUCCESS')\r\n return;\r\n VideoBlot.uploadStatus[id] = { status: 'UPLOADING', progress: Math.round(progress) };\r\n document.querySelectorAll(\"div.video-\" + id).forEach(function (node) {\r\n node.classList.remove('fail');\r\n node.querySelector('div.progress').style.width = Math.round(progress) + \"%\";\r\n });\r\n };\r\n VideoBlot.setUploadError = function (id, error) {\r\n if ((VideoBlot.uploadStatus[id] || {}).status === 'SUCCESS')\r\n return;\r\n VideoBlot.uploadStatus[id] = { status: 'ERROR', error: error };\r\n document.querySelectorAll(\"div.video-\" + id).forEach(function (node) {\r\n if (!node.classList.contains('fail'))\r\n node.classList.add('fail');\r\n var div = node.querySelector('div.error');\r\n if (div) {\r\n var html = '上传失败,点击重试';\r\n if (error) {\r\n html += \"\" + error + \"\";\r\n }\r\n div.innerHTML = html;\r\n }\r\n });\r\n };\r\n VideoBlot.setUploadSuccess = function (id, options) {\r\n var src = options.src, srcNode = options.srcNode, poster = options.poster, posterNode = options.posterNode;\r\n VideoBlot.uploadStatus[id] = { status: 'SUCCESS', src: src, poster: poster };\r\n if (srcNode) {\r\n VideoBlot.uploadStatus[id].srcNode = srcNode;\r\n }\r\n if (posterNode) {\r\n VideoBlot.uploadStatus[id].posterNode = posterNode;\r\n }\r\n document.querySelectorAll(\"div.video-\" + id).forEach(function (node) {\r\n node.querySelector('div.progress-bar').remove();\r\n node.querySelector('div.error').remove();\r\n var video = node.querySelector('video');\r\n if (video) {\r\n video.dataset.src = src;\r\n video.dataset.poster = poster;\r\n if (srcNode) {\r\n video.dataset.srcNode = srcNode;\r\n }\r\n if (posterNode) {\r\n video.dataset.posterNode = posterNode;\r\n }\r\n }\r\n node.classList.remove(\"video-\" + id);\r\n });\r\n };\r\n VideoBlot.createDiv = function () {\r\n var _a;\r\n var classNames = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n classNames[_i] = arguments[_i];\r\n }\r\n var div = document.createElement('div');\r\n div.setAttribute('contenteditable', 'false');\r\n if (classNames.length > 0) {\r\n (_a = div.classList).add.apply(_a, video_spread(classNames));\r\n }\r\n return div;\r\n };\r\n VideoBlot.create = function (value) {\r\n var node = _super.create.call(this);\r\n node.setAttribute('contenteditable', 'false');\r\n var video = document.createElement('video');\r\n if (value.id) {\r\n video.dataset.id = value.id;\r\n }\r\n if (value.width && value.height) {\r\n video.dataset.width = \"\" + value.width;\r\n video.dataset.height = \"\" + value.height;\r\n }\r\n else {\r\n video.dataset.width = '0';\r\n video.dataset.height = '0';\r\n }\r\n if (value.srcNode) {\r\n video.dataset.srcNode = value.srcNode;\r\n }\r\n if (value.posterNode) {\r\n video.dataset.posterNode = value.posterNode;\r\n }\r\n video.setAttribute('src', value.src);\r\n video.setAttribute('poster', value.poster);\r\n node.appendChild(video);\r\n return node;\r\n };\r\n VideoBlot.getVideoAndValue = function (node) {\r\n var video = node.tagName.toUpperCase() === 'VIDEO'\r\n ? node\r\n : node.querySelector('video');\r\n var value = {\r\n src: (video && video.getAttribute('src')) || '',\r\n poster: (video && video.getAttribute('poster')) || '',\r\n };\r\n if (video) {\r\n if (video.dataset.id) {\r\n value.id = video.dataset.id;\r\n }\r\n var width = Number(video.dataset.width);\r\n var height = Number(video.dataset.height);\r\n if (width && height) {\r\n value.width = width;\r\n value.height = height;\r\n }\r\n if (video.dataset.srcNode) {\r\n value.srcNode = video.dataset.srcNode;\r\n }\r\n if (video.dataset.posterNode) {\r\n value.posterNode = video.dataset.posterNode;\r\n }\r\n }\r\n return { video: video, value: value };\r\n };\r\n VideoBlot.value = function (node) {\r\n return VideoBlot.getVideoAndValue(node).value;\r\n };\r\n VideoBlot.prototype.remove = function () {\r\n var id = VideoBlot.value(this.domNode).id;\r\n if (id) {\r\n var status_2 = VideoBlot.uploadStatus[id];\r\n VideoBlot.eventEmitter.emit('remove', {\r\n id: id,\r\n status: status_2.status || 'UPLOADING',\r\n });\r\n }\r\n _super.prototype.remove.call(this);\r\n };\r\n VideoBlot.pendingVideos = function () {\r\n return Object.keys(VideoBlot.uploadStatus).filter(function (id) {\r\n return VideoBlot.uploadStatus[id].status !== 'SUCCESS';\r\n });\r\n };\r\n VideoBlot.buildHtml = function (node) {\r\n node.querySelectorAll('div.video-container').forEach(function (el) {\r\n var video = el.querySelector('video');\r\n if (video && (!video.dataset.id || video.dataset.src)) {\r\n if (video.dataset.src) {\r\n video.setAttribute('src', video.dataset.src);\r\n delete video.dataset.src;\r\n }\r\n if (video.dataset.poster) {\r\n video.setAttribute('poster', video.dataset.poster);\r\n delete video.dataset.poster;\r\n }\r\n delete video.dataset.id;\r\n video.removeAttribute('class');\r\n video.removeAttribute('style');\r\n el.parentNode.insertBefore(video, el.nextSibling);\r\n }\r\n el.remove();\r\n });\r\n return node;\r\n };\r\n VideoBlot.tagName = 'div';\r\n VideoBlot.blotName = 'video';\r\n VideoBlot.className = 'video-container';\r\n VideoBlot.eventEmitter = new eventemitter3_default.a();\r\n VideoBlot.uploadStatus = {};\r\n return VideoBlot;\r\n}(video_BlockEmbed));\r\n\r\nquill_default.a.register(video_VideoBlot, true);\r\n\n// EXTERNAL MODULE: ./src/caller.ts + 1 modules\nvar caller = __webpack_require__(1);\n\n// EXTERNAL MODULE: ./src/common.ts\nvar common = __webpack_require__(4);\n\n// CONCATENATED MODULE: ./src/index.ts\nvar __values = (undefined && undefined.__values) || function(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n};\r\n\r\n\r\n\r\n\r\n\r\n// import blots\r\n\r\n\r\n\r\n\r\n\r\nvar Header = quill_default.a.import('formats/header');\r\nHeader.tagName = ['H1'];\r\nvar quillSelection;\r\nvar src_quill = new quill_default.a('#editor', {\r\n debug: false,\r\n theme: 'snow',\r\n placeholder: '',\r\n formats: ['bold', 'header', 'blockquote', 'link', 'image', 'video'],\r\n modules: {\r\n toolbar: {\r\n container: '#toolbar',\r\n handlers: {\r\n // 分隔符\r\n divider: function () {\r\n var range = this.quill.getSelection(true);\r\n this.quill.insertText(range.index, '\\n', 'user');\r\n this.quill.insertEmbed(range.index + 1, 'divider', true, 'user');\r\n this.quill.setSelection(range.index + 2, 0, 'silent');\r\n },\r\n // 插入图片\r\n image: function () {\r\n quillSelection = src_quill.getSelection(true);\r\n src_quill.blur();\r\n if (!Object(caller[\"a\" /* callMethod */])('chooseImage')) {\r\n console.log('chooseImage');\r\n }\r\n },\r\n video: function () {\r\n quillSelection = src_quill.getSelection(true);\r\n src_quill.blur();\r\n if (!Object(caller[\"a\" /* callMethod */])('chooseVideo')) {\r\n console.log('chooseVideo');\r\n }\r\n },\r\n undo: function () {\r\n // @ts-ignore\r\n src_quill.history.undo();\r\n },\r\n redo: function () {\r\n // @ts-ignore\r\n src_quill.history.redo();\r\n },\r\n },\r\n },\r\n clipboard: {\r\n matchers: [\r\n [\r\n 'IMG',\r\n function (node, delta) {\r\n return new Delta_default.a().insert({\r\n image: image_ImageBlot.value(node),\r\n });\r\n },\r\n ],\r\n [\r\n 'VIDEO',\r\n function (node, delta) {\r\n return new Delta_default.a().insert({\r\n video: video_VideoBlot.value(node),\r\n });\r\n },\r\n ],\r\n // 粘贴时提取纯文本\r\n [\r\n Node.TEXT_NODE,\r\n function (node, delta) {\r\n var ops = [];\r\n delta.ops.forEach(function (op) {\r\n if (op.insert && typeof op.insert === 'string') {\r\n ops.push({ insert: op.insert });\r\n }\r\n });\r\n delta.ops = ops;\r\n return delta;\r\n },\r\n ],\r\n ],\r\n },\r\n },\r\n});\r\n/** 设置编辑器内容 */\r\nwindow.setContentReceiver = function (data) {\r\n src_quill.clipboard.dangerouslyPasteHTML(data, 'silent');\r\n setTimeout(common[\"b\" /* fixSize */], 0);\r\n};\r\nsetTimeout(function () {\r\n window.setContentReceiver('

截至到2017年12月,我国的网民规模已经达到了7.72亿,而手机网民规模也达7.53亿,2017年网络社交娱乐类应用用户规模均保持了高速增长,同时电子商务、网络游戏、网络广告收入水平增速均在20%以上,发展势头良好。

如此高速的发展,这意味着,移动+社交的时代已经开启。社交软件已经成为了人们生活中密不可分的必需品,社交网站平台不仅仅是沟通、互动、娱乐,甚至能帮助商务交易。

如何快速搭建一个社交网站平台?也成为企业增加用户粘性、提高商务交易至关重要的一步。而ThinkSNS作为社交软件定制开发服务供应商先驱,将以自身携带的优势,引领这一社交时代的发展。社交系统ThinkSNS拥有动态、圈子、资讯、直播、商城、IM即时聊天、频道、音乐、活动、问答、投票、打赏等50余项功能,可根据需求组合,提供源码,能够快速定制属于自己的社交网站平台。同时社交系统ThinkSNS拥有PC端、手机H5端、Android 端、iOS端等多种平台,全新底层架构,稳定性能,保障软件快速上线和运营。

社交系统ThinkSNS可以用于哪些行业?应该用在什么场景呢?ThinkSNS并不仅仅限制于社交;众多的功能扩展让你的社交网站平台如虎添翼。接下来列举一下可以用于哪些行业,我觉得你可以根据自己的行业和面向的用户,来考虑怎么组合。

【教育行业】 教育o2o 根据知名教育机构的业务需求退推出的微教务、微班级、微网盘、微课堂、等模式,形成线下面授+线上服务的闭环。 社区化 依靠活动,问答,消息通知等社区模式更好的服务客户,成为老师家长学生的沟通纽带。 移动化 学生和家长通过手机随时收到课程,作业提醒等教育信息,还可以手机观看微博,移动时代更便捷。 云端化 支持阿里云SAE等云端部署,同时支持将站内视频,图片,附储存到云端,数据更安全,系统运行更高效。

【新媒体行业】 新闻模块 简单易用的CMS功能,支持多种格式文章编辑及文章推送 专题模块 相同优质内容聚合形成专题,持续深入聚焦专类信息投稿 用户能迅速、快捷的发表自己的观点、想法 社区 信息快速传递发酵的平台,也是用户持续跟踪新闻线索的工具

【医疗行业】 品牌服务 基于微信公众帐号开发的品牌系统,具有微活动、微学院、微客服、微会员等模块,通过线上的品牌社区提升用户对品牌的认知 患者社区 基于微信公众帐号开发的患者社区系统,具有用户交流、患者FM、专家答疑、自助查询等模块,提升了用户的黏度和归属感医生社区 基于微信公众号开发的医生社区系统,具有医学资讯、名医电台、在线学习、病历分析等模块,医生可在线上自主学习医疗会议 基于微信帐号开发的医疗会议系统,具有签到、大屏幕、问卷调查、投票等功能,通过数据可以看到参会者参与的效果

【粉丝营销社区】社交·分享 发烧用户聚集一起互动、分享,共同的兴趣形成更多的话题、圈子,增大品牌效应和附加值 互动·参与 粉丝通过线下活动、线上帖子讨论表达自己的观点,让更多的用户参与进来,打造品牌热度 荣誉·认证 品牌利用勋章、认证等机制奖励活跃用户,让用户与品牌紧密联系在一起 积分·换礼 积分、换礼等实质奖励,带动用户积极性吸引用户参与进来,最终达到品牌效应

更多行业案例,请参见:http://www.thinksns.com/case.html

目前,ThinkSNS作为华为、联想、奔驰,远景能源,中国大学生在线,蓝鲸传媒等著名企业软件技术指定合作方,深得业界口碑拥趸。

社交软件开发供应商ThinkSNS官网:http://www.thinksns.com/

');\r\n}, 3000);\r\nimage_ImageBlot.quill = src_quill;\r\nimage_ImageBlot.eventEmitter.on('remove', function (data) {\r\n if (!Object(caller[\"a\" /* callMethod */])('removeImage', data)) {\r\n console.log('removeImage', data);\r\n }\r\n});\r\nimage_ImageBlot.eventEmitter.on('reinsert', function (data) {\r\n if (!Object(caller[\"a\" /* callMethod */])('reinsertImage', data)) {\r\n console.log('reinsertImage', data);\r\n }\r\n});\r\nimage_ImageBlot.eventEmitter.on('reupload', function (data) {\r\n if (!Object(caller[\"a\" /* callMethod */])('reuploadImage', data)) {\r\n console.log('reuploadImage', data);\r\n }\r\n});\r\nimage_ImageBlot.eventEmitter.on('insertRemoteImage', function (data) {\r\n if (!Object(caller[\"a\" /* callMethod */])('insertRemoteImage', data)) {\r\n console.log('insertRemoteImage', data);\r\n }\r\n});\r\n/** 收到图片后预览 */\r\nwindow.imagePreviewReceiver = function (data) {\r\n var e_1, _a;\r\n var srcList = JSON.parse(data);\r\n var index = quillSelection.index;\r\n try {\r\n for (var srcList_1 = __values(srcList), srcList_1_1 = srcList_1.next(); !srcList_1_1.done; srcList_1_1 = srcList_1.next()) {\r\n var item = srcList_1_1.value;\r\n src_quill.insertEmbed(index++, 'image', {\r\n id: \"\" + (item.id || ''),\r\n src: \"\" + item.url,\r\n width: +item.width,\r\n height: +item.height,\r\n }, 'user');\r\n }\r\n }\r\n catch (e_1_1) { e_1 = { error: e_1_1 }; }\r\n finally {\r\n try {\r\n if (srcList_1_1 && !srcList_1_1.done && (_a = srcList_1.return)) _a.call(srcList_1);\r\n }\r\n finally { if (e_1) throw e_1.error; }\r\n }\r\n setTimeout(common[\"a\" /* fixImageSize */], 0);\r\n};\r\nwindow.uploadRemoteImage = function (data) {\r\n var _a = JSON.parse(data) || {}, id = _a.id, remoteId = _a.remoteId;\r\n if (remoteId && \"\" + (id || '')) {\r\n image_ImageBlot.uploadRemoteImage(remoteId, \"\" + id);\r\n }\r\n};\r\n/** 更新图片上传进度 */\r\nwindow.imageProgressReceiver = function (data) {\r\n var _a = JSON.parse(data) || {}, id = _a.id, progress = _a.progress;\r\n image_ImageBlot.updateUploadProgress(\"\" + id, Number(progress));\r\n};\r\n/** 设置图片上传成功 */\r\nwindow.imageUrlReceiver = function (data) {\r\n var _a = JSON.parse(data) || {}, id = _a.id, url = _a.url, node = _a.node;\r\n image_ImageBlot.setUploadSuccess(\"\" + id, \"\" + url, \"\" + (node || ''));\r\n};\r\n/** 设置图片上传失败 */\r\nwindow.imageFailedReceiver = function (data) {\r\n var _a = JSON.parse(data) || {}, id = _a.id, error = _a.error;\r\n image_ImageBlot.setUploadError(\"\" + id, \"\" + (error || ''));\r\n};\r\nvideo_VideoBlot.quill = src_quill;\r\nvideo_VideoBlot.eventEmitter.on('remove', function (data) {\r\n if (!Object(caller[\"a\" /* callMethod */])('removeVideo', data)) {\r\n console.log('removeVideo', data);\r\n }\r\n});\r\nvideo_VideoBlot.eventEmitter.on('reinsert', function (data) {\r\n if (!Object(caller[\"a\" /* callMethod */])('reinsertVideo', data)) {\r\n console.log('reinsertVideo', data);\r\n }\r\n});\r\nvideo_VideoBlot.eventEmitter.on('reupload', function (data) {\r\n if (!Object(caller[\"a\" /* callMethod */])('reuploadVideo', data)) {\r\n console.log('reuploadVideo', data);\r\n }\r\n});\r\n/** 收到视频后预览 */\r\nwindow.videoPreviewReceiver = function (data) {\r\n var item = JSON.parse(data);\r\n var index = quillSelection.index;\r\n src_quill.insertEmbed(index++, 'video', {\r\n id: \"\" + (item.id || ''),\r\n src: \"\" + item.url,\r\n poster: \"\" + item.poster,\r\n width: +item.width,\r\n height: +item.height,\r\n }, 'user');\r\n setTimeout(common[\"c\" /* fixVideoSize */], 0);\r\n};\r\n/** 更新视频上传进度 */\r\nwindow.videoProgressReceiver = function (data) {\r\n var _a = JSON.parse(data) || {}, id = _a.id, progress = _a.progress;\r\n video_VideoBlot.updateUploadProgress(\"\" + id, Number(progress));\r\n};\r\n/** 设置视频上传成功 */\r\nwindow.videoUrlReceiver = function (data) {\r\n var _a = JSON.parse(data) || {}, id = _a.id, url = _a.url, urlNode = _a.urlNode, poster = _a.poster, posterNode = _a.posterNode;\r\n video_VideoBlot.setUploadSuccess(\"\" + id, {\r\n src: \"\" + url,\r\n srcNode: \"\" + (urlNode || ''),\r\n poster: \"\" + poster,\r\n posterNode: \"\" + (posterNode || ''),\r\n });\r\n};\r\n/** 设置视频上传失败 */\r\nwindow.videoFailedReceiver = function (data) {\r\n var _a = JSON.parse(data) || {}, id = _a.id, error = _a.error;\r\n video_VideoBlot.setUploadError(\"\" + id, \"\" + (error || ''));\r\n};\r\nwindow.changePlaceholder = function (text) {\r\n var el = document.querySelector(\".ql-editor,.ql-blank\");\r\n if (el) {\r\n el.setAttribute('data-placeholder', text);\r\n }\r\n};\r\nwindow.editorSubmitReceiver = function () {\r\n var html = src_quill.root.innerHTML;\r\n var div;\r\n div = document.createElement('div');\r\n div.innerHTML = html;\r\n div = video_VideoBlot.buildHtml(image_ImageBlot.buildHtml(div));\r\n var isEmpty = !(src_quill.getText() || div.querySelector('video,img'));\r\n var pendingImages = image_ImageBlot.pendingImages();\r\n var pendingVideos = video_VideoBlot.pendingVideos();\r\n var medias = [];\r\n div.querySelectorAll('img, video').forEach(function (el) {\r\n var tagName = el.tagName.toUpperCase();\r\n var _a = el.dataset, srcNode = _a.srcNode, posterNode = _a.posterNode;\r\n if (tagName === 'IMG' && srcNode) {\r\n medias.push({ image: srcNode });\r\n }\r\n else if (tagName === 'VIDEO' && srcNode && posterNode) {\r\n medias.push({ image: posterNode, video: srcNode });\r\n }\r\n });\r\n html = div.innerHTML;\r\n div = null;\r\n if (!Object(caller[\"a\" /* callMethod */])('sendContentHTML', { html: html, medias: medias, pendingImages: pendingImages, pendingVideos: pendingVideos, isEmpty: isEmpty })) {\r\n console.log('sendContentHTML', { html: html, medias: medias, pendingImages: pendingImages, pendingVideos: pendingVideos, isEmpty: isEmpty });\r\n }\r\n};\r\nwindow.quill = src_quill;\r\nwindow.addEventListener('resize', function () {\r\n var range = src_quill.getSelection();\r\n if (range && src_quill.hasFocus()) {\r\n src_quill.setSelection(range);\r\n }\r\n Object(common[\"b\" /* fixSize */])();\r\n});\r\n/* harmony default export */ var src_0 = __webpack_exports__[\"default\"] = (src_quill);\r\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNjMuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9zcmMvYmxvdHMvZGl2aWRlci50cz80MzljIiwid2VicGFjazovLy8uL3NyYy9ibG90cy9pbWFnZS50cz85MDFmIiwid2VicGFjazovLy8uL3NyYy9ibG90cy92aWRlby50cz8yN2E1Iiwid2VicGFjazovLy8uL3NyYy9pbmRleC50cz9mZmI0Il0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCBRdWlsbCBmcm9tICdxdWlsbCdcblxuY29uc3QgQmxvY2tFbWJlZCA9IFF1aWxsLmltcG9ydCgnYmxvdHMvYmxvY2svZW1iZWQnKVxuXG5jbGFzcyBEaXZpZGVyQmxvdCBleHRlbmRzIEJsb2NrRW1iZWQge31cblxuRGl2aWRlckJsb3QuYmxvdE5hbWUgPSAnZGl2aWRlcidcbkRpdmlkZXJCbG90LnRhZ05hbWUgPSAnaHInXG5cblF1aWxsLnJlZ2lzdGVyKERpdmlkZXJCbG90KVxuIiwiaW1wb3J0IFF1aWxsIGZyb20gJ3F1aWxsJ1xuaW1wb3J0IEV2ZW50RW1pdHRlciBmcm9tICdldmVudGVtaXR0ZXIzJ1xuXG5jb25zdCBCbG9ja0VtYmVkID0gUXVpbGwuaW1wb3J0KCdibG90cy9ibG9jay9lbWJlZCcpXG5cbmludGVyZmFjZSBJbWFnZUJsb3RWYWx1ZSB7XG4gIGlkPzogc3RyaW5nXG4gIHNyYzogc3RyaW5nXG4gIHNyY05vZGU/OiBzdHJpbmdcbiAgd2lkdGg/OiBudW1iZXJcbiAgaGVpZ2h0PzogbnVtYmVyXG59XG5cbmV4cG9ydCBjbGFzcyBJbWFnZUJsb3QgZXh0ZW5kcyBCbG9ja0VtYmVkIHtcbiAgc3RhdGljIHRhZ05hbWUgPSAnZGl2J1xuICBzdGF0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ZUJsb3QudXBsb2FkU3RhdHVzW2lkXSA9IHt9XG4gICAgICB9XG4gICAgfSBlbHNlIHtcbiAgICAgIHNldFRpbWVvdXQoKCkgPT4ge1xuICAgICAgICBpZiAoIXRoaXMucHJldikgcmV0dXJuXG4gICAgICAgIGNvbnN0IHBOb2RlID0gdGhpcy5wcmV2LmRvbU5vZGVcbiAgICAgICAgaWYgKHBOb2RlLnRhZ05hbWUgPT09ICdQJyAmJiAhcE5vZGUuaW5uZXJUZXh0LnRyaW0oKSkge1xuICAgICAgICAgIHRoaXMucHJldi5yZW1vdmUoKSAvLyDnp7vpmaTlm77niYfliY3pnaLnmoTnqbrooYxcbiAgICAgICAgfVxuICAgICAgfSwgMClcbiAgICB9XG5cbiAgICBpZiAoaW1nICYmIHNyYykge1xuICAgICAgY29uc3QgYXBwZW5kRWxzID0gKHdpZHRoOiBudW1iZXIsIGhlaWdodDogbnVtYmVyKSA9PiB7XG4gICAgICAgIGNvbnN0IHdyYXAgPSBub2RlLnF1ZXJ5U2VsZWN0b3IoJy5pbWFnZS13cmFwJykhXG5cbiAgICAgICAgaWYgKHdpZHRoID49IDUwICYmIGhlaWdodCA+PSA1MCkge1xuICAgICAgICAgIGlmICghbm9kZS5xdWVyeVNlbGVjdG9yKCcucmVtb3ZlJykpIHtcbiAgICAgICAgICAgIGNvbnN0IGRpdiA9IEltYWdlQmxvdC5jcmVhdGVEaXYoJ3JlbW92ZScpXG4gICAgICAgICAgICBkaXYuYWRkRXZlbnRMaXN0ZW5lcignY2xpY2snLCAoKSA9PiB7XG4gICAgICAgICAgICAgIHRoaXMucmVtb3ZlKClcbiAgICAgICAgICAgIH0pXG4gICAgICAgICAgICB3cmFwLmFwcGVuZENoaWxkKGRpdilcbiAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICBpZiAoaWQpIHtcbiAgICAgICAgICBJbWFnZUJsb3QucmVmcmVzaFVwbG9hZChpZClcbiAgICAgICAgfSBlbHNlIGlmICghc3JjTm9kZSkge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GNvbnNvbGUubG9nKCdjaG9vc2VJbWFnZScpXG4gICAgICAgICAgfVxuICAgICAgICB9LFxuXG4gICAgICAgIHZpZGVvKHRoaXM6IHsgcXVpbGw6IFF1aWxsIH0pIHtcbiAgICAgICAgICBxdWlsbFNlbGVjdGlvbiA9IHF1aWxsLmdldFNlbGVjdGlvbih0cnVlKVxuXG4gICAgICAgICAgcXVpbGwuYmx1cigpXG5cbiAgICAgICAgICBpZiAoIWNhbGxNZXRob2QoJ2Nob29zZVZpZGVvJykpIHtcbiAgICAgICAgICAgIGNvbnNvbGUubG9nKCdjaG9vc2VWaWRlbycpXG4gICAgICAgICAgfVxuICAgICAgICB9LFxuXG4gICAgICAgIHVuZG8odGhpczogeyBxdWlsbDogUXVpbGwgfSkge1xuICAgICAgICAgIC8vIEB0cy1pZ25vcmVcbiAgICAgICAgICBxdWlsbC5oaXN0b3J5IS51bmRvKClcbiAgICAgICAgfSxcblxuICAgICAgICByZWRvKHRoaXM6IHsgcXVpbGw6IFF1aWxsIH0pIHtcbiAgICAgICAgICAvLyBAdHMtaWdub3JlXG4gICAgICAgICAgcXVpbGwuaGlzdG9yeSEucmVkbygpXG4gICAgICAgIH0sXG4gICAgICB9LFxuICAgIH0sXG4gICAgY2xpcGJvYXJkOiB7XG4gICAgICBtYXRjaGVyczogW1xuICAgICAgICBbXG4gICAgICAgICAgJ0lNRycsXG4gICAgICAgICAgKG5vZGU6IEhUTUxJbWFnZUVsZW1lbnQsIGRlbHRhOiBEZWx0YSk6IERlbHRhID0+IHtcbiAgICAgICAgICAgIHJldHVybiBuZXcgRGVsdGEoKS5pbnNlcnQoe1xuICAgICAgICAgICAgICBpbWFnZTogSW1hZ2VCbG90LnZhbHVlKG5vZGUpLFxuICAgICAgICAgICAgfSlcbiAgICAgICAgICB9LFxuICAgICAgICBdLFxuXG4gICAgICAgIFtcbiAgICAgICAgICAnVklERU8nLFxuICAgICAgICAgIChub2RlOiBIVE1MVmlkZW9FbGVtZW50LCBkZWx0YTogRGVsdGEpOiBEZWx0YSA9PiB7XG4gICAgICAgICAgICByZXR1cm4gbmV3IERlbHRhKCkuaW5zZXJ0KHtcbiAgICAgICAgICAgICAgdmlkZW86IFZpZGVvQmxvdC52YWx1ZShub2RlKSxcbiAgICAgICAgICAgIH0pXG4gICAgICAgICAgfSxcbiAgICAgICAgXSxcblxuICAgICAgICAvLyDnspjotLTml7bmj5Dlj5bnuq/mlofmnKxcbiAgICAgICAgW1xuICAgICAgICAgIE5vZGUuVEVYVF9OT0RFLFxuICAgICAgICAgIChub2RlOiBFbGVtZW50LCBkZWx0YTogRGVsdGEpOiBEZWx0YSA9PiB7XG4gICAgICAgICAgICBjb25zdCBvcHM6IERlbHRhWydvcHMnXSA9IFtdXG4gICAgICAgICAgICBkZWx0YS5vcHMhLmZvckVhY2gob3AgPT4ge1xuICAgICAgICAgICAgICBpZiAob3AuaW5zZXJ0ICYmIHR5cGVvZiBvcC5pbnNlcnQgPT09ICdzdHJpbmcnKSB7XG4gICAgICAgICAgICAgICAgb3BzLnB1c2goeyBpbnNlcnQ6IG9wLmluc2VydCB9KVxuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9KVxuICAgICAgICAgICAgZGVsdGEub3BzID0gb3BzXG4gICAgICAgICAgICByZXR1cm4gZGVsdGFcbiAgICAgICAgICB9LFxuICAgICAgICBdLFxuICAgICAgXSxcbiAgICB9LFxuICB9LFxufSlcblxuLyoqIOiuvue9rue8lui+keWZqOWGheWuuSAqL1xud2luZG93LnNldENvbnRlbnRSZWNlaXZlciA9IGRhdGEgPT4ge1xuICBxdWlsbC5jbGlwYm9hcmQuZGFuZ2Vyb3VzbHlQYXN0ZUhUTUwoZGF0YSwgJ3NpbGVudCcpXG5cbiAgc2V0VGltZW91dChmaXhTaXplLCAwKVxufVxuXG5zZXRUaW1lb3V0KCgpID0+IHtcbiAgd2luZG93LnNldENvbnRlbnRSZWNlaXZlcihcbiAgICAnPHA+5oiq6Iez5YiwMjAxN+W5tDEy5pyI77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FBQ0E7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUVBO0FBRUE7QUFDQTtBQUVBO0FBQ0E7QUFDQTtBQUVBO0FBQ0E7QUFFQTsiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///63\n")}]); \ No newline at end of file diff --git a/dist/preview.js b/dist/preview.js index 90526f9..740de19 100644 --- a/dist/preview.js +++ b/dist/preview.js @@ -1 +1 @@ -!function(n){var g=window.webpackHotUpdate;window.webpackHotUpdate=function(n,I){!function(n,g){if(!Z[n]||!m[n])return;for(var I in m[n]=!1,g)Object.prototype.hasOwnProperty.call(g,I)&&(d[I]=g[I]);0==--o&&0===s&&h()}(n,I),g&&g(n,I)};var I,e=!0,t="915a2690719f51871caa",c=1e4,B={},i=[],a=[];function l(n){var g=y[n];if(!g)return V;var e=function(e){return g.hot.active?(y[e]?-1===y[e].parents.indexOf(n)&&y[e].parents.push(n):(i=[n],I=e),-1===g.children.indexOf(e)&&g.children.push(e)):(console.warn("[HMR] unexpected require("+e+") from disposed module "+n),i=[]),V(e)},t=function(n){return{configurable:!0,enumerable:!0,get:function(){return V[n]},set:function(g){V[n]=g}}};for(var c in V)Object.prototype.hasOwnProperty.call(V,c)&&"e"!==c&&"t"!==c&&Object.defineProperty(e,c,t(c));return e.e=function(n){return"ready"===b&&u("prepare"),s++,V.e(n).then(g,(function(n){throw g(),n}));function g(){s--,"prepare"===b&&(G[n]||p(n),0===s&&0===o&&h())}},e.t=function(n,g){return 1&g&&(n=e(n)),V.t(n,-2&g)},e}function r(n){var g={_acceptedDependencies:{},_declinedDependencies:{},_selfAccepted:!1,_selfDeclined:!1,_disposeHandlers:[],_main:I!==n,active:!0,accept:function(n,I){if(void 0===n)g._selfAccepted=!0;else if("function"==typeof n)g._selfAccepted=n;else if("object"==typeof n)for(var e=0;e=0&&g._disposeHandlers.splice(I,1)},check:X,apply:U,status:function(n){if(!n)return b;C.push(n)},addStatusHandler:function(n){C.push(n)},removeStatusHandler:function(n){var g=C.indexOf(n);g>=0&&C.splice(g,1)},data:B[n]};return I=void 0,g}var C=[],b="idle";function u(n){b=n;for(var g=0;g0;){var t=e.pop(),c=t.id,B=t.chain;if((a=y[c])&&!a.hot._selfAccepted){if(a.hot._selfDeclined)return{type:"self-declined",chain:B,moduleId:c};if(a.hot._main)return{type:"unaccepted",chain:B,moduleId:c};for(var i=0;i ")),X.type){case"self-declined":g.onDeclined&&g.onDeclined(X),g.ignoreDeclined||(p=new Error("Aborted because of self decline: "+X.moduleId+W));break;case"declined":g.onDeclined&&g.onDeclined(X),g.ignoreDeclined||(p=new Error("Aborted because of declined dependency: "+X.moduleId+" in "+X.parentId+W));break;case"unaccepted":g.onUnaccepted&&g.onUnaccepted(X),g.ignoreUnaccepted||(p=new Error("Aborted because "+l+" is not accepted"+W));break;case"accepted":g.onAccepted&&g.onAccepted(X),h=!0;break;case"disposed":g.onDisposed&&g.onDisposed(X),U=!0;break;default:throw new Error("Unexception type "+X.type)}if(p)return u("abort"),Promise.reject(p);if(h)for(l in s[l]=d[l],C(o,X.outdatedModules),X.outdatedDependencies)Object.prototype.hasOwnProperty.call(X.outdatedDependencies,l)&&(A[l]||(A[l]=[]),C(A[l],X.outdatedDependencies[l]));U&&(C(o,[X.moduleId]),s[l]=G)}var N,Y=[];for(e=0;e0;)if(l=x.pop(),a=y[l]){var v={},J=a.hot._disposeHandlers;for(c=0;c=0&&R.parents.splice(N,1))}}for(l in A)if(Object.prototype.hasOwnProperty.call(A,l)&&(a=y[l]))for(H=A[l],c=0;c=0&&a.children.splice(N,1);for(l in u("apply"),t=Q,s)Object.prototype.hasOwnProperty.call(s,l)&&(n[l]=s[l]);var S=null;for(l in A)if(Object.prototype.hasOwnProperty.call(A,l)&&(a=y[l])){H=A[l];var D=[];for(e=0;e undefined\n * typeof document -> undefined\n *\n * react-native:\n * navigator.product -> 'ReactNative'\n * nativescript\n * navigator.product -> 'NativeScript' or 'NS'\n */\nfunction isStandardBrowserEnv() {\n if (typeof navigator !== 'undefined' && (navigator.product === 'ReactNative' ||\n navigator.product === 'NativeScript' ||\n navigator.product === 'NS')) {\n return false;\n }\n return (\n typeof window !== 'undefined' &&\n typeof document !== 'undefined'\n );\n}\n\n/**\n * Iterate over an Array or an Object invoking a function for each item.\n *\n * If `obj` is an Array callback will be called passing\n * the value, index, and complete array for each item.\n *\n * If 'obj' is an Object callback will be called passing\n * the value, key, and complete object for each property.\n *\n * @param {Object|Array} obj The object to iterate\n * @param {Function} fn The callback to invoke for each item\n */\nfunction forEach(obj, fn) {\n // Don't bother if no value provided\n if (obj === null || typeof obj === 'undefined') {\n return;\n }\n\n // Force an array if not already something iterable\n if (typeof obj !== 'object') {\n /*eslint no-param-reassign:0*/\n obj = [obj];\n }\n\n if (isArray(obj)) {\n // Iterate over array values\n for (var i = 0, l = obj.length; i < l; i++) {\n fn.call(null, obj[i], i, obj);\n }\n } else {\n // Iterate over object keys\n for (var key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) {\n fn.call(null, obj[key], key, obj);\n }\n }\n }\n}\n\n/**\n * Accepts varargs expecting each argument to be an object, then\n * immutably merges the properties of each object and returns result.\n *\n * When multiple objects contain the same key the later object in\n * the arguments list will take precedence.\n *\n * Example:\n *\n * ```js\n * var result = merge({foo: 123}, {foo: 456});\n * console.log(result.foo); // outputs 456\n * ```\n *\n * @param {Object} obj1 Object to merge\n * @returns {Object} Result of all merge properties\n */\nfunction merge(/* obj1, obj2, obj3, ... */) {\n var result = {};\n function assignValue(val, key) {\n if (typeof result[key] === 'object' && typeof val === 'object') {\n result[key] = merge(result[key], val);\n } else {\n result[key] = val;\n }\n }\n\n for (var i = 0, l = arguments.length; i < l; i++) {\n forEach(arguments[i], assignValue);\n }\n return result;\n}\n\n/**\n * Function equal to merge with the difference being that no reference\n * to original objects is kept.\n *\n * @see merge\n * @param {Object} obj1 Object to merge\n * @returns {Object} Result of all merge properties\n */\nfunction deepMerge(/* obj1, obj2, obj3, ... */) {\n var result = {};\n function assignValue(val, key) {\n if (typeof result[key] === 'object' && typeof val === 'object') {\n result[key] = deepMerge(result[key], val);\n } else if (typeof val === 'object') {\n result[key] = deepMerge({}, val);\n } else {\n result[key] = val;\n }\n }\n\n for (var i = 0, l = arguments.length; i < l; i++) {\n forEach(arguments[i], assignValue);\n }\n return result;\n}\n\n/**\n * Extends object a by mutably adding to it the properties of object b.\n *\n * @param {Object} a The object to be extended\n * @param {Object} b The object to copy properties from\n * @param {Object} thisArg The object to bind function to\n * @return {Object} The resulting value of object a\n */\nfunction extend(a, b, thisArg) {\n forEach(b, function assignValue(val, key) {\n if (thisArg && typeof val === 'function') {\n a[key] = bind(val, thisArg);\n } else {\n a[key] = val;\n }\n });\n return a;\n}\n\nmodule.exports = {\n isArray: isArray,\n isArrayBuffer: isArrayBuffer,\n isBuffer: isBuffer,\n isFormData: isFormData,\n isArrayBufferView: isArrayBufferView,\n isString: isString,\n isNumber: isNumber,\n isObject: isObject,\n isUndefined: isUndefined,\n isDate: isDate,\n isFile: isFile,\n isBlob: isBlob,\n isFunction: isFunction,\n isStream: isStream,\n isURLSearchParams: isURLSearchParams,\n isStandardBrowserEnv: isStandardBrowserEnv,\n forEach: forEach,\n merge: merge,\n deepMerge: deepMerge,\n extend: extend,\n trim: trim\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMC5qcyIsInNvdXJjZXMiOlsid2VicGFjazovLy8uL25vZGVfbW9kdWxlcy9heGlvcy9saWIvdXRpbHMuanM/YzUzMiJdLCJzb3VyY2VzQ29udGVudCI6WyIndXNlIHN0cmljdCc7XG5cbnZhciBiaW5kID0gcmVxdWlyZSgnLi9oZWxwZXJzL2JpbmQnKTtcbnZhciBpc0J1ZmZlciA9IHJlcXVpcmUoJ2lzLWJ1ZmZlcicpO1xuXG4vKmdsb2JhbCB0b1N0cmluZzp0cnVlKi9cblxuLy8gdXRpbHMgaXMgYSBsaWJyYXJ5IG9mIGd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BQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTsiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///0\n")},function(module,__webpack_exports__,__webpack_require__){"use strict";eval("\n// EXTERNAL MODULE: ./node_modules/axios/index.js\nvar axios = __webpack_require__(2);\nvar axios_default = /*#__PURE__*/__webpack_require__.n(axios);\n\n// EXTERNAL MODULE: ./node_modules/spark-md5/spark-md5.js\nvar spark_md5 = __webpack_require__(5);\nvar spark_md5_default = /*#__PURE__*/__webpack_require__.n(spark_md5);\n\n// CONCATENATED MODULE: ./src/uploader.ts\nvar __assign = (undefined && undefined.__assign) || function () {\r\n __assign = Object.assign || function(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\r\n t[p] = s[p];\r\n }\r\n return t;\r\n };\r\n return __assign.apply(this, arguments);\r\n};\r\nvar __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n};\r\nvar __generator = (undefined && undefined.__generator) || function (thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n};\r\n\r\n\r\nvar userToken = '';\r\nvar apiV2BaseUrl = '';\r\nvar storage = { channel: 'public' };\r\ntry {\r\n var sp = new URL(window.location.href).searchParams;\r\n userToken = sp.get('user_token') || '';\r\n apiV2BaseUrl = sp.get('api_v2_base_url') || '';\r\n var uploadStorage = sp.get('upload_storage');\r\n if (uploadStorage) {\r\n storage = JSON.parse(uploadStorage);\r\n }\r\n}\r\ncatch (err) {\r\n //\r\n}\r\nwindow.setUploaderOptions = function (options) {\r\n if (typeof options === 'string') {\r\n options = JSON.parse(options);\r\n }\r\n userToken = options.userToken || '';\r\n apiV2BaseUrl = options.apiV2BaseUrl || '';\r\n if (options.storage) {\r\n storage = options.storage;\r\n }\r\n};\r\nvar uploadFuncNames = [\r\n 'chooseImage',\r\n 'removeImage',\r\n 'reinsertImage',\r\n 'reuploadImage',\r\n 'insertRemoteImage',\r\n 'chooseVideo',\r\n 'removeVideo',\r\n 'reinsertVideo',\r\n 'reuploadVideo',\r\n];\r\nfunction tryHijackUploadCall(funcName, params) {\r\n if (!uploadFuncNames.includes(funcName)) {\r\n return false;\r\n }\r\n if (funcName.startsWith('choose')) {\r\n chooseAndUpload(funcName.substr(6).toLowerCase());\r\n }\r\n else if (funcName.startsWith('remove')) {\r\n handleRemove(funcName.substr(6).toLowerCase(), params);\r\n }\r\n else if (funcName.startsWith('reinsert')) {\r\n handleReinsert(funcName.substr(8).toLowerCase(), params);\r\n }\r\n else if (funcName.startsWith('reupload')) {\r\n handleReupload(funcName.substr(8).toLowerCase(), params);\r\n }\r\n else if (funcName === 'insertRemoteImage') {\r\n uploadRemoteImage(params);\r\n }\r\n return true;\r\n}\r\nvar uploadFiles = new Map();\r\nvar fileCounter = 1;\r\nfunction chooseAndUpload(type) {\r\n var input = document.createElement('input');\r\n input.setAttribute('type', 'file');\r\n if (type === 'image') {\r\n input.setAttribute('multiple', '');\r\n input.setAttribute('accept', 'image/*');\r\n }\r\n else if (type === 'video') {\r\n input.setAttribute('accept', 'video/mp4');\r\n }\r\n input.addEventListener('change', function () {\r\n var length = input.files.length;\r\n if (!length) {\r\n return;\r\n }\r\n var promises = [];\r\n var _loop_1 = function (i) {\r\n var file = input.files.item(i);\r\n if (!file ||\r\n (type === 'image' && !file.type.startsWith('image/')) ||\r\n (type === 'video' && file.type !== 'video/mp4')) {\r\n return \"continue\";\r\n }\r\n var id = \"\" + fileCounter++;\r\n promises.push(getMediaInfo(file).then(function (mf) {\r\n return __assign(__assign({}, mf), { id: id, useCounter: 1 });\r\n }));\r\n };\r\n for (var i = 0; i < length; i++) {\r\n _loop_1(i);\r\n }\r\n Promise.all(promises)\r\n .then(function (list) {\r\n var params = list\r\n .sort(function (a, b) { return Number(a.id) - Number(b.id); })\r\n .map(function (uf) {\r\n var param = {\r\n id: uf.id,\r\n url: uf.image.url,\r\n width: uf.image.width,\r\n height: uf.image.height,\r\n };\r\n if (type === 'video') {\r\n param.url = uf.video.url;\r\n param.poster = uf.image.url;\r\n }\r\n return param;\r\n });\r\n window.postMessage({\r\n funcName: type + \"PreviewReceiver\",\r\n params: type === 'image' ? params : params[0],\r\n }, '*');\r\n list.forEach(function (uf) {\r\n uploadFiles.set(uf.id, uf);\r\n handleUpload(type, uf.id);\r\n });\r\n })\r\n .catch(console.log);\r\n });\r\n input.click();\r\n}\r\nfunction getMediaInfo(file) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var mf, promises, imageFileType_1, imageFilename_1, setBuffAndHash;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n mf = {\r\n image: {\r\n file: file,\r\n buff: new ArrayBuffer(0),\r\n hash: '',\r\n url: '',\r\n width: 0,\r\n height: 0,\r\n },\r\n };\r\n promises = [];\r\n if (!file.type.startsWith('video/')) return [3 /*break*/, 2];\r\n mf.video = {\r\n file: file,\r\n buff: new ArrayBuffer(0),\r\n hash: '',\r\n url: URL.createObjectURL(file),\r\n width: 0,\r\n height: 0,\r\n };\r\n imageFileType_1 = \"image/png\";\r\n imageFilename_1 = file.name + \".png\";\r\n return [4 /*yield*/, new Promise(function (resolve, reject) {\r\n var video = document.createElement('video');\r\n video.addEventListener('loadeddata', function () {\r\n video.pause();\r\n video.currentTime = 0;\r\n mf.video.width = mf.image.width = video.videoWidth;\r\n mf.video.height = mf.image.height = video.videoHeight;\r\n var canvas = document.createElement('canvas');\r\n canvas.setAttribute('width', \"\" + mf.image.width);\r\n canvas.setAttribute('height', \"\" + mf.image.height);\r\n var ctx = canvas.getContext('2d');\r\n if (!ctx) {\r\n reject(new Error('无法提取到视频封面'));\r\n }\r\n else {\r\n ctx.drawImage(video, 0, 0, mf.image.width, mf.image.height);\r\n canvas.toBlob(function (blob) {\r\n if (!blob || blob.size <= 0) {\r\n reject(new Error('无法提取到视频封面'));\r\n }\r\n else {\r\n var file_1 = new File([blob], imageFilename_1, { type: blob.type });\r\n mf.image.url = URL.createObjectURL(file_1);\r\n mf.image.file = file_1;\r\n resolve();\r\n }\r\n }, imageFileType_1);\r\n }\r\n });\r\n video.autoplay = true;\r\n video.muted = true;\r\n video.src = mf.video.url;\r\n })];\r\n case 1:\r\n _a.sent();\r\n return [3 /*break*/, 3];\r\n case 2:\r\n mf.image.url = URL.createObjectURL(mf.image.file);\r\n promises.push(new Promise(function (resolve, reject) {\r\n var img = document.createElement('img');\r\n img.addEventListener('load', function () {\r\n mf.image.width = img.naturalWidth;\r\n mf.image.height = img.naturalHeight;\r\n resolve();\r\n });\r\n img.addEventListener('error', function () {\r\n reject(new Error('图片加载异常'));\r\n });\r\n img.src = mf.image.url;\r\n }));\r\n _a.label = 3;\r\n case 3:\r\n setBuffAndHash = function (info) {\r\n return new Promise(function (resolve, reject) {\r\n var reader = new FileReader();\r\n reader.addEventListener('load', function () {\r\n var spark = new spark_md5_default.a.ArrayBuffer();\r\n info.buff = reader.result;\r\n info.hash = spark.append(info.buff).end();\r\n resolve();\r\n });\r\n reader.addEventListener('error', function () {\r\n reject(new Error('读取文件异常'));\r\n });\r\n reader.readAsArrayBuffer(info.file);\r\n });\r\n };\r\n promises.push(setBuffAndHash(mf.image));\r\n if (mf.video) {\r\n promises.push(setBuffAndHash(mf.video));\r\n }\r\n return [4 /*yield*/, Promise.all(promises)];\r\n case 4:\r\n _a.sent();\r\n return [2 /*return*/, mf];\r\n }\r\n });\r\n });\r\n}\r\nfunction uploadRemoteImage(params) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var id, contentType_1, filename_1, _a, blob, file, buff, spark, hash, error_1, buff;\r\n return __generator(this, function (_b) {\r\n switch (_b.label) {\r\n case 0:\r\n id = \"\" + fileCounter++;\r\n window.postMessage({\r\n funcName: \"uploadRemoteImage\",\r\n params: { id: id, remoteId: params.remoteId },\r\n }, '*');\r\n _b.label = 1;\r\n case 1:\r\n _b.trys.push([1, 3, , 4]);\r\n contentType_1 = 'image/png';\r\n filename_1 = Date.now() + \".png\";\r\n return [4 /*yield*/, new Promise(function (resolve, reject) {\r\n var img = document.createElement('img');\r\n img.addEventListener('load', function () {\r\n console.log('here');\r\n var canvas = document.createElement('canvas');\r\n canvas.setAttribute('width', \"\" + params.width);\r\n canvas.setAttribute('height', \"\" + params.height);\r\n var ctx = canvas.getContext('2d');\r\n ctx.drawImage(img, 0, 0, params.width, params.height);\r\n canvas.toBlob(function (blob) {\r\n if (!blob) {\r\n return reject();\r\n }\r\n var reader = new FileReader();\r\n reader.addEventListener('load', function () {\r\n var buff = reader.result;\r\n var file = new File([blob], filename_1, { type: contentType_1 });\r\n resolve({ blob: blob, file: file, buff: buff });\r\n });\r\n reader.addEventListener('error', function () { return reject(); });\r\n reader.readAsArrayBuffer(blob);\r\n }, contentType_1);\r\n });\r\n img.addEventListener('error', function () { return reject(); });\r\n img.crossOrigin = 'anonymous';\r\n img.src = params.src;\r\n })];\r\n case 2:\r\n _a = _b.sent(), blob = _a.blob, file = _a.file, buff = _a.buff;\r\n spark = new spark_md5_default.a.ArrayBuffer();\r\n hash = spark.append(buff).end();\r\n uploadFiles.set(id, {\r\n id: id,\r\n useCounter: 1,\r\n image: {\r\n file: file,\r\n buff: buff,\r\n hash: hash,\r\n url: params.src,\r\n width: params.width,\r\n height: params.height,\r\n },\r\n });\r\n return [3 /*break*/, 4];\r\n case 3:\r\n error_1 = _b.sent();\r\n buff = new ArrayBuffer(0);\r\n uploadFiles.set(id, {\r\n id: id,\r\n useCounter: 1,\r\n image: {\r\n file: new File([buff], 'empty'),\r\n buff: buff,\r\n hash: '',\r\n url: params.src,\r\n width: params.width,\r\n height: params.height,\r\n },\r\n error: '无法下载远程图片,请手动上传',\r\n });\r\n return [3 /*break*/, 4];\r\n case 4:\r\n handleUpload('image', id);\r\n return [2 /*return*/];\r\n }\r\n });\r\n });\r\n}\r\nfunction handleUpload(type, id) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var uf, upload, params, _a, node, url, results, video, poster, e_1, message;\r\n var _this = this;\r\n return __generator(this, function (_b) {\r\n switch (_b.label) {\r\n case 0:\r\n uf = uploadFiles.get(id);\r\n if (!uf || (uf.status && ['UPLOADING', 'SUCCESS'].includes(uf.status))) {\r\n return [2 /*return*/];\r\n }\r\n _b.label = 1;\r\n case 1:\r\n _b.trys.push([1, 6, , 7]);\r\n if (uf.error) {\r\n throw new Error(uf.error);\r\n }\r\n upload = function (info) { return __awaiter(_this, void 0, void 0, function () {\r\n var source, _a, uri, method, headers, form, fileKey, data, keys, _b, node, url;\r\n return __generator(this, function (_c) {\r\n switch (_c.label) {\r\n case 0:\r\n source = axios_default.a.CancelToken.source();\r\n uf.cancelUpload = source.cancel.bind(source);\r\n return [4 /*yield*/, axios_default.a.post('storage', {\r\n hash: info.hash,\r\n storage: storage,\r\n size: info.file.size,\r\n filename: info.file.name,\r\n mime_type: info.file.type,\r\n }, {\r\n headers: {\r\n Authorization: userToken,\r\n Accept: 'application/json, */*',\r\n },\r\n baseURL: apiV2BaseUrl,\r\n validateStatus: function (s) { return s === 200 || s === 201; },\r\n cancelToken: source.token,\r\n })];\r\n case 1:\r\n _a = (_c.sent()).data, uri = _a.uri, method = _a.method, headers = _a.headers, form = _a.form, fileKey = _a.file_key;\r\n data = info.buff;\r\n if (form || fileKey) {\r\n data = new FormData();\r\n data.append(fileKey, info.file);\r\n keys = Object.keys(form || {});\r\n if (keys.length) {\r\n keys.forEach(function (key) { return data.append(key, form[key]); });\r\n }\r\n }\r\n source = axios_default.a.CancelToken.source();\r\n uf.cancelUpload = source.cancel.bind(source);\r\n return [4 /*yield*/, axios_default.a.request({\r\n url: uri,\r\n method: method,\r\n headers: headers,\r\n data: data,\r\n onUploadProgress: function (pe) {\r\n if (pe.lengthComputable) {\r\n if (type === 'image' || info.file.type.startsWith('video/')) {\r\n window.postMessage({\r\n funcName: type + \"ProgressReceiver\",\r\n params: { id: id, progress: (pe.loaded * 100) / pe.total },\r\n }, '*');\r\n }\r\n }\r\n },\r\n validateStatus: function (s) { return s === 200 || s === 201; },\r\n cancelToken: source.token,\r\n })];\r\n case 2:\r\n _b = (_c.sent()).data, node = _b.node, url = _b.uri;\r\n return [2 /*return*/, { node: node, url: url, fileType: info.file.type }];\r\n }\r\n });\r\n }); };\r\n uf.status = 'UPLOADING';\r\n params = { id: id };\r\n if (!(type === 'image')) return [3 /*break*/, 3];\r\n return [4 /*yield*/, upload(uf.image)];\r\n case 2:\r\n _a = _b.sent(), node = _a.node, url = _a.url;\r\n params.url = url;\r\n params.node = node;\r\n return [3 /*break*/, 5];\r\n case 3:\r\n if (!(type === 'video')) return [3 /*break*/, 5];\r\n return [4 /*yield*/, Promise.all([upload(uf.image), upload(uf.video)])];\r\n case 4:\r\n results = _b.sent();\r\n video = void 0, poster = void 0;\r\n if (results[0].fileType.startsWith('video/')) {\r\n video = results[0];\r\n poster = results[1];\r\n }\r\n else {\r\n video = results[1];\r\n poster = results[0];\r\n }\r\n params.url = video.url;\r\n params.urlNode = video.node;\r\n params.poster = poster.url;\r\n params.posterNode = poster.node;\r\n _b.label = 5;\r\n case 5:\r\n window.postMessage({ funcName: type + \"UrlReceiver\", params: params }, '*');\r\n return [3 /*break*/, 7];\r\n case 6:\r\n e_1 = _b.sent();\r\n /* eslint require-atomic-updates: */\r\n if (axios_default.a.isCancel(e_1)) {\r\n uf.status = 'CANCEL';\r\n }\r\n else {\r\n uf.status = 'ERROR';\r\n message = e_1.message || '网络异常导致上传失败';\r\n if (e_1.response && e_1.response.data) {\r\n message = e_1.response.data.message;\r\n if (Array.isArray(message)) {\r\n message = message[0];\r\n }\r\n message = message || '服务异常导致上传失败';\r\n }\r\n window.postMessage({\r\n funcName: type + \"FailedReceiver\",\r\n params: { id: id, error: message },\r\n }, '*');\r\n }\r\n return [3 /*break*/, 7];\r\n case 7: return [2 /*return*/];\r\n }\r\n });\r\n });\r\n}\r\nfunction handleRemove(type, params) {\r\n var status = params.status;\r\n if (status !== 'UPLOADING') {\r\n return;\r\n }\r\n var uf = uploadFiles.get(params.id);\r\n if (uf && uf.useCounter > 0) {\r\n uf.useCounter -= 1;\r\n if (uf.useCounter === 0 && uf.status === 'UPLOADING') {\r\n uf.cancelUpload();\r\n }\r\n }\r\n}\r\nfunction handleReinsert(type, params) {\r\n var status = params.status;\r\n if (status !== 'UPLOADING') {\r\n return;\r\n }\r\n var uf = uploadFiles.get(params.id);\r\n if (uf) {\r\n uf.useCounter += 1;\r\n if (uf.useCounter === 1 && uf.status === 'CANCEL') {\r\n handleUpload(type, params.id);\r\n }\r\n }\r\n}\r\nfunction handleReupload(type, params) {\r\n handleUpload(type, params.id);\r\n}\r\n\n// CONCATENATED MODULE: ./src/caller.ts\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"a\", function() { return callMethod; });\n\r\n/**\r\n * 调用客户端函数的方法\r\n *\r\n * @param fnName 调用的方法名\r\n * @param params 调用方法传参\r\n */\r\nfunction callMethod(fnName, params) {\r\n if (params === void 0) { params = undefined; }\r\n if (window.debug) {\r\n console.log('debug callMethod', fnName, params); // eslint-disable-line no-console\r\n }\r\n if (window.launcher) {\r\n // in Android\r\n if (typeof window.launcher[fnName] === 'function') {\r\n if (params) {\r\n window.launcher[fnName](JSON.stringify(params));\r\n }\r\n else {\r\n window.launcher[fnName]();\r\n }\r\n }\r\n }\r\n else if (window.webkit && window.webkit.messageHandlers) {\r\n // in IOS\r\n window.webkit.messageHandlers.MobilePhoneCall.postMessage({ funcName: fnName, params: params });\r\n }\r\n else if (window.self != window.parent) {\r\n // in iframe\r\n if (!tryHijackUploadCall(fnName, params)) {\r\n window.parent.postMessage({ funcName: fnName, params: params }, '*');\r\n }\r\n }\r\n else {\r\n // not in webview\r\n tryHijackUploadCall(fnName, params);\r\n return false;\r\n }\r\n return true;\r\n}\r\nvar FuncName;\r\n(function (FuncName) {\r\n FuncName[\"setUploaderOptions\"] = \"setUploaderOptions\";\r\n FuncName[\"setContentReceiver\"] = \"setContentReceiver\";\r\n FuncName[\"imagePreviewReceiver\"] = \"imagePreviewReceiver\";\r\n FuncName[\"imageProgressReceiver\"] = \"imageProgressReceiver\";\r\n FuncName[\"imageUrlReceiver\"] = \"imageUrlReceiver\";\r\n FuncName[\"imageFailedReceiver\"] = \"imageFailedReceiver\";\r\n FuncName[\"videoPreviewReceiver\"] = \"videoPreviewReceiver\";\r\n FuncName[\"videoProgressReceiver\"] = \"videoProgressReceiver\";\r\n FuncName[\"videoUrlReceiver\"] = \"videoUrlReceiver\";\r\n FuncName[\"videoFailedReceiver\"] = \"videoFailedReceiver\";\r\n FuncName[\"editorSubmitReceiver\"] = \"editorSubmitReceiver\";\r\n FuncName[\"changePlaceholder\"] = \"changePlaceholder\";\r\n FuncName[\"pageHiddenReceiver\"] = \"pageHiddenReceiver\";\r\n})(FuncName || (FuncName = {}));\r\nvar postMessage = window.postMessage;\r\nwindow.postMessage = function (message, targetOrigin, transfer) {\r\n if (targetOrigin === void 0) { targetOrigin = '*'; }\r\n postMessage(message, targetOrigin, transfer);\r\n};\r\nwindow.addEventListener('message', function (e) {\r\n var funcName = (e.data || {}).funcName;\r\n if (funcName && typeof window[funcName] === 'function') {\r\n var params = (e.data || {}).params;\r\n if (!['changePlaceholder', 'setContentReceiver'].includes(funcName)) {\r\n params = params && JSON.stringify(params);\r\n }\r\n window[funcName](params);\r\n }\r\n});\r\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMS5qcyIsInNvdXJjZXMiOlsid2VicGFjazovLy8uL3NyYy91cGxvYWRlci50cz9iM2IwIiwid2VicGFjazovLy8uL3NyYy9jYWxsZXIudHM/ZDU2ZCJdLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgYXhpb3MgZnJvbSAnYXhpb3MnXG5pbXBvcnQgU3BhcmsgZnJvbSAnc3BhcmstbWQ1J1xuXG5sZXQgdXNlclRva2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GlucHV0LmZpbGVzIS5sZW5ndGhcblxuICAgIGlmICghbGVuZ3RoKSB7XG4gICAgICByZXR1cm5cbiAgICB9XG5cbiAgICBjb25zdCBwcm9taXNlczogUHJvbWlzZTxVcGxvYWRGaWxlPltdID0gW11cbiAgICBmb3IgKGxldCBpID0gMDsgaSA8IGxlbmd0aDsgaSsrKSB7XG4gICAgICBjb25zdCBmaWxlID0gaW5wdXQuZmlsZXMhLml0ZW0oaSlcblxuICAgICAgaWYgKFxuICAgICAgICAhZmlsZSB8fFxuICAgICAgICAodHlwZSA9PT0gJ2ltYWdlJyAmJiAhZmlsZS50eXBlLnN0YXJ0c1dpdGgoJ2ltYWdlLycpKSB8fFxuICAgICAgICAodHlwZSA9PT0gJ3ZpZGVvJyAmJiBmaWxlLnR5cGUgIT09ICd2aWRlby9tcDQnKVxuICAgICAgKSB7XG4gICAgICAgIGNvbnRpbnVlXG4gICAgICB9XG5cbiAgICAgIGNvbnN0IGlkID0gYCR7ZmlsZUNvdW50ZXIrK31gXG4gICAgICBwcm9taXNlcy5wdXNoKFxuICAgICAgICBnZXRNZWRpYUluZm8oZmlsZSkudGhlbihtZiA9PiB7XG4gICAgICAgICAgcmV0dXJuIHsgLi4ubWYsIGlkLCB1c2VDb3VudGVyOiAxIH1cbiAgICAgICAgfSksXG4gICAgICApXG4gICAgfVxuXG4gICAgUHJvbWlzZS5hbGwocHJvbWlzZXMpXG4gICAgICAudGhlbihsaXN0ID0+IHtcbiAgICAgICAgY29uc3QgcGFyYW1zOiBhbnlbXSA9IGxpc3RcbiAgICAgICAgICAuc29ydCgoYSwgYikgPT4gTnVtYmVyKGEuaWQpIC0gTnVtYmVyKGIuaWQpKVxuICAgICAgICAgIC5tYXAodWYgPT4ge1xuICAgICAgICAgICAgY29uc3QgcGFyYW06IGFueSA9IHtcbiAgICAgICAgICAgICAgaWQ6IHVmLmlkLFxuICAgICAgICAgICAgICB1cmw6IHVmLmltYWdlLnVybCxcbiAgICAgICAgICAgICAgd2lkdGg6IHVmLmltYWdlLndpZHRoLFxuICAgICAgICAgICAgICBoZWlnaHQ6IHVmLmltYWdlLmhlaWdodCxcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmICh0eXBlID09PSAndmlkZW8nKSB7XG4gICAgICAgICAgICAgIHBhcmFtLnVybCA9IHVmLnZpZGVvIS51cmxcbiAgICAgICAgICAgICAgcGFyYW0ucG9zdGVyID0gdWYuaW1hZ2UudXJsXG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHJldHVybiBwYXJhbVxuICAgICAgICAgIH0pXG5cbiAgICAgICAgd2luZG93LnBvc3RNZXNzYWdlKFxuICAgICAgICAgIHtcbiAgICAgICAgICAgIGZ1bmNOYW1lOiBgJHt0eXBlfVByZXZpZXdSZWNlaXZlcmAsXG4gICAgICAgICAgICBwYXJhbXM6IHR5cGUgPT09ICdpbWFnZScgPyBwYXJhbXMgOiBwYXJhbXNbMF0sXG4gICAgICAgICAgfSxcbiAgICAgICAgICAnKicsXG4gICAgICAgIClcblxuICAgICAgICBsaXN0LmZvckVhY2godWYgPT4ge1xuICAgICAgICAgIHVwbG9hZEZpbGVzLnNldCh1Zi5pZCwgdWYpXG4gICAgICAgICAgaGFuZGxlVXBsb2FkKHR5cGUsIHVmLmlkKVxuICAgICAgICB9KVxuICAgICAgfSlcbiAgICAgIC5jYXRjaChjb25zb2xlLmxvZylcbiAgfSlcblxuICBpbnB1dC5jbGljaygpXG59XG5cbmFzeW5jIGZ1bmN0aW9uIGdldE1lZGlhSW5mbyhmaWxlOiBGaWxlKSB7XG4gIGNvbnN0IG1mOiBNZWRpYUZpbGUgPSB7XG4gICAgaW1hZ2U6IHtcbiAgICAgIGZpbGU6IGZpbGUsXG4gICAgICBidWZmOiBuZXcgQXJyYXlCdWZmZXIoMCksXG4gICAgICBoYXNoOiAnJyxcbiAgICAgIHVybDogJycsXG4gICAgICB3aWR0aDogMCxcbiAgICAgIGhlaWdodDogMCxcbiAgICB9LFxuICB9XG5cb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ICAgICB9LCBjb250ZW50VHlwZSlcbiAgICAgIH0pXG4gICAgICBpbWcuYWRkRXZlbnRMaXN0ZW5lcignZXJyb3InLCAoKSA9PiByZWplY3QoKSlcbiAgICAgIGltZy5jcm9zc09yaWdpbiA9ICdhbm9ueW1vdXMnXG4gICAgICBpbWcuc3JjID0gcGFyYW1zLnNyY1xuICAgIH0pXG5cbiAgICBjb25zdCBzcGFyayA9IG5ldyBTcGFyay5BcnJheUJ1ZmZlcigpXG4gICAgY29uc3QgaGFzaCA9IHNwYXJrLmFwcGVuZChidWZmKS5lbmQoKVxuXG4gICAgdXBsb2FkRmlsZXMuc2V0KGlkLCB7XG4gICAgICBpZCxcbiAgICAgIHVzZUNvdW50ZXI6IDEsXG4gICAgICBpbWFnZToge1xuICAgICAgICBmaWxlLFxuICAgICAgICBidWZmLFxuICAgICAgICBoYXNoLFxuICAgICAgICB1cmw6IHBhcmFtcy5zcmMsXG4gICAgICAgIHdpZHRoOiBwYXJhbXMud2lkdGgsXG4gICAgICAgIGhlaWdodDogcGFyYW1zLmhlaWdodCxcbiAgICAgIH0sXG4gICAgfSlcbiAgfSBjYXRjaCAoZXJyb3IpIHtcbiAgICBjb25zdCBidWZmID0gbmV3IEFycmF5QnVmZmVyKDApXG4gICAgdXBsb2FkRmlsZXMuc2V0KGlkLCB7XG4gICAgICBpZCxcbiAgICAgIHVzZUNvdW50ZXI6IDEsXG4gICAgICBpbWFnZToge1xuICAgICAgICBmaWxlOiBuZXcgRmlsZShbYnVmZl0sICdlbXB0eScpLFxuICAgICAgICBidWZmOiBidWZmLFxuICAgICAgICBoYXNoOiAnJyxcbiAgICAgICAgdXJsOiBwYXJhbXMuc3JjLFxuICAgICAgICB3aWR0aDogcGFyYW1zLndpZHRoLFxuICAgICAgICBoZWlnaHQ6IHBhcmFtcy5oZWlnaHQsXG4gICAgICB9LFxuICAgICAgZXJyb3I6ICfml6Dms5XkuIvovb3ov5znqIvlm77niYfvvIzor7fmiYvliqjkuIrkvKAnL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BR0E7Ozs7OztBQUVBO0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUVBO0FBQ0E7QUFDQTs7O0FDcGhCQTtBQUFBO0FBRUE7Ozs7O0FBS0E7QUFDQTtBQUFBO0FBQ0E7QUFDQTtBQUNBO0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUFBO0FBQ0E7QUFDQTtBQUNBO0FBQUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUVBO0FBQ0E7QUFFQTtBQUFBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUVBO0FBQ0E7QUFFQTtBQUdBO0FBQ0E7QUFFQTtBQUNBO0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTsiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///1\n")},function(module,exports,__webpack_require__){eval("module.exports = __webpack_require__(17);//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMi5qcyIsInNvdXJjZXMiOlsid2VicGFjazovLy8uL25vZGVfbW9kdWxlcy9heGlvcy9pbmRleC5qcz9iYzNhIl0sInNvdXJjZXNDb250ZW50IjpbIm1vZHVsZS5leHBvcnRzID0gcmVxdWlyZSgnLi9saWIvYXhpb3MnKTsiXSwibWFwcGluZ3MiOiJBQUFBIiwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///2\n")},,function(module,__webpack_exports__,__webpack_require__){"use strict";eval("/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"d\", function() { return getViewElement; });\n/* unused harmony export getViewWidth */\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"a\", function() { return fixImageSize; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"c\", function() { return fixVideoSize; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"b\", function() { return fixSize; });\nfunction getViewElement() {\r\n return document.querySelector('div.ql-editor');\r\n}\r\nfunction getViewWidth() {\r\n var view = getViewElement();\r\n if (view) {\r\n var width = view.clientWidth;\r\n var style = getComputedStyle(view);\r\n if (style.paddingLeft) {\r\n width -= parseFloat(style.paddingLeft);\r\n }\r\n if (style.paddingRight) {\r\n width -= parseFloat(style.paddingRight);\r\n }\r\n if (width > 0) {\r\n return width;\r\n }\r\n }\r\n return 0;\r\n}\r\nfunction fixImageSize() {\r\n getViewElement()\r\n .querySelectorAll('img')\r\n .forEach(function (img) {\r\n var viewWidth = getViewWidth();\r\n var width = Number(img.dataset.width);\r\n var height = Number(img.dataset.height);\r\n if (!viewWidth || !width || !height)\r\n return;\r\n if (width > viewWidth) {\r\n height = (viewWidth / width) * height;\r\n width = viewWidth;\r\n }\r\n img.style.width = width + \"px\";\r\n img.style.height = height + \"px\";\r\n });\r\n}\r\nfunction onPalyVideo(e) {\r\n getViewElement()\r\n .querySelectorAll('video,audio')\r\n .forEach(function (media) {\r\n if (media !== e.target) {\r\n media.pause();\r\n }\r\n });\r\n}\r\nfunction fixVideoSize() {\r\n getViewElement()\r\n .querySelectorAll('video')\r\n .forEach(function (video) {\r\n video.setAttribute('controls', '');\r\n video.setAttribute('preload', 'auto');\r\n video.setAttribute('webkit-playsinline', '');\r\n video.setAttribute('playsinline', '');\r\n video.setAttribute('x5-playsinline', '');\r\n video.setAttribute('controlsList', 'nodownload');\r\n video.removeAttribute('autopaly');\r\n video.removeAttribute('loop');\r\n video.removeEventListener('playing', onPalyVideo);\r\n video.addEventListener('playing', onPalyVideo);\r\n console.log(video.shadowRoot);\r\n var viewWidth = getViewWidth();\r\n if (!viewWidth)\r\n return;\r\n var width = Number(video.dataset.width);\r\n var height = Number(video.dataset.height);\r\n if (!width || !height || width < height) {\r\n width = viewWidth;\r\n height = viewWidth;\r\n }\r\n else {\r\n height = (viewWidth / width) * height;\r\n width = viewWidth;\r\n }\r\n video.style.width = width + \"px\";\r\n video.style.height = height + \"px\";\r\n });\r\n}\r\nwindow.pageHiddenReceiver = function (data) {\r\n document.querySelectorAll('video,audio').forEach(function (media) {\r\n media.pause();\r\n });\r\n};\r\nfunction fixSize() {\r\n fixImageSize();\r\n fixVideoSize();\r\n}\r\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNC5qcyIsInNvdXJjZXMiOlsid2VicGFjazovLy8uL3NyYy9jb21tb24udHM/ODA0OSJdLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgZnVuY3Rpb24gZ2V0Vmlld0VsZW1lbnQoKSB7XG4gIHJldHVybiBkb2N1bWVudC5xdWVyeVNlbGVjdG9yPEhUTUxEaXZFbGVtZW50PignZGl2LnFsLWVkaXRvcicpXG59XG5cbmV4cG9ydCBmdW5jdGlvbiBnZXRWaWV3V2lkdGgoKSB7XG4gIGNvbnN0IHZpZXcgPSBnZXRWaWV3RWxlbWVudCgpXG5cbiAgaWYgKHZpZXcpIHtcbiAgICBsZXQgd2lkdGggPSB2aWV3LmNsaWVudFdpZHRoXG4gICAgY29uc3Qgc3R5bGUgPSBnZXRDb21wdXRlZFN0eWxlKHZpZXcpXG5cbiAgICBpZiAoc3R5bGUucGFkZGluZ0xlZnQpIHtcbiAgICAgIHdpZHRoIC09IHBhcnNlRmxvYXQoc3R5bGUucGFkZGluZ0xlZnQpXG4gICAgfV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TtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFFQTtBQUNBO0FBRUE7QUFFQTtBQUNBO0FBQUE7QUFFQTtBQUNBO0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUVBO0FBQ0E7QUFDQTtBQUNBOyIsInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///4\n")},function(module,exports,__webpack_require__){eval("(function (factory) {\n if (true) {\n // Node/CommonJS\n module.exports = factory();\n } else { var glob; }\n}(function (undefined) {\n\n 'use strict';\n\n /*\n * Fastest md5 implementation around (JKM md5).\n * Credits: Joseph Myers\n *\n * @see http://www.myersdaily.org/joseph/javascript/md5-text.html\n * @see http://jsperf.com/md5-shootout/7\n */\n\n /* this function is much faster,\n so if possible we use it. Some IEs\n are the only ones I know of that\n need the idiotic second function,\n generated by an if clause. */\n var add32 = function (a, b) {\n return (a + b) & 0xFFFFFFFF;\n },\n hex_chr = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'];\n\n\n function cmn(q, a, b, x, s, t) {\n a = add32(add32(a, q), add32(x, t));\n return add32((a << s) | (a >>> (32 - s)), b);\n }\n\n function md5cycle(x, k) {\n var a = x[0],\n b = x[1],\n c = x[2],\n d = x[3];\n\n a += (b & c | ~b & d) + k[0] - 680876936 | 0;\n a = (a << 7 | a >>> 25) + b | 0;\n d += (a & b | ~a & c) + k[1] - 389564586 | 0;\n d = (d << 12 | d >>> 20) + a | 0;\n c += (d & a | ~d & b) + k[2] + 606105819 | 0;\n c = (c << 17 | c >>> 15) + d | 0;\n b += (c & d | ~c & a) + k[3] - 1044525330 | 0;\n b = (b << 22 | b >>> 10) + c | 0;\n a += (b & c | ~b & d) + k[4] - 176418897 | 0;\n a = (a << 7 | a >>> 25) + b | 0;\n d += (a & b | ~a & c) + k[5] + 1200080426 | 0;\n d = (d << 12 | d >>> 20) + a | 0;\n c += (d & a | ~d & b) + k[6] - 1473231341 | 0;\n c = (c << 17 | c >>> 15) + d | 0;\n b += (c & d | ~c & a) + k[7] - 45705983 | 0;\n b = (b << 22 | b >>> 10) + c | 0;\n a += (b & c | ~b & d) + k[8] + 1770035416 | 0;\n a = (a << 7 | a >>> 25) + b | 0;\n d += (a & b | ~a & c) + k[9] - 1958414417 | 0;\n d = (d << 12 | d >>> 20) + a | 0;\n c += (d & a | ~d & b) + k[10] - 42063 | 0;\n c = (c << 17 | c >>> 15) + d | 0;\n b += (c & d | ~c & a) + k[11] - 1990404162 | 0;\n b = (b << 22 | b >>> 10) + c | 0;\n a += (b & c | ~b & d) + k[12] + 1804603682 | 0;\n a = (a << 7 | a >>> 25) + b | 0;\n d += (a & b | ~a & c) + k[13] - 40341101 | 0;\n d = (d << 12 | d >>> 20) + a | 0;\n c += (d & a | ~d & b) + k[14] - 1502002290 | 0;\n c = (c << 17 | c >>> 15) + d | 0;\n b += (c & d | ~c & a) + k[15] + 1236535329 | 0;\n b = (b << 22 | b >>> 10) + c | 0;\n\n a += (b & d | c & ~d) + k[1] - 165796510 | 0;\n a = (a << 5 | a >>> 27) + b | 0;\n d += (a & c | b & ~c) + k[6] - 1069501632 | 0;\n d = (d << 9 | d >>> 23) + a | 0;\n c += (d & b | a & ~b) + k[11] + 643717713 | 0;\n c = (c << 14 | c >>> 18) + d | 0;\n b += (c & a | d & ~a) + k[0] - 373897302 | 0;\n b = (b << 20 | b >>> 12) + c | 0;\n a += (b & d | c & ~d) + k[5] - 701558691 | 0;\n a = (a << 5 | a >>> 27) + b | 0;\n d += (a & c | b & ~c) + k[10] + 38016083 | 0;\n d = (d << 9 | d >>> 23) + a | 0;\n c += (d & b | a & ~b) + k[15] - 660478335 | 0;\n c = (c << 14 | c >>> 18) + d | 0;\n b += (c & a | d & ~a) + k[4] - 405537848 | 0;\n b = (b << 20 | b >>> 12) + c | 0;\n a += (b & d | c & ~d) + k[9] + 568446438 | 0;\n a = (a << 5 | a >>> 27) + b | 0;\n d += (a & c | b & ~c) + k[14] - 1019803690 | 0;\n d = (d << 9 | d >>> 23) + a | 0;\n c += (d & b | a & ~b) + k[3] - 187363961 | 0;\n c = (c << 14 | c >>> 18) + d | 0;\n b += (c & a | d & ~a) + k[8] + 1163531501 | 0;\n b = (b << 20 | b >>> 12) + c | 0;\n a += (b & d | c & ~d) + k[13] - 1444681467 | 0;\n a = (a << 5 | a >>> 27) + b | 0;\n d += (a & c | b & ~c) + k[2] - 51403784 | 0;\n d = (d << 9 | d >>> 23) + a | 0;\n c += (d & b | a & ~b) + k[7] + 1735328473 | 0;\n c = (c << 14 | c >>> 18) + d | 0;\n b += (c & a | d & ~a) + k[12] - 1926607734 | 0;\n b = (b << 20 | b >>> 12) + c | 0;\n\n a += (b ^ c ^ d) + k[5] - 378558 | 0;\n a = (a << 4 | a >>> 28) + b | 0;\n d += (a ^ b ^ c) + k[8] - 2022574463 | 0;\n d = (d << 11 | d >>> 21) + a | 0;\n c += (d ^ a ^ b) + k[11] + 1839030562 | 0;\n c = (c << 16 | c >>> 16) + d | 0;\n b += (c ^ d ^ a) + k[14] - 35309556 | 0;\n b = (b << 23 | b >>> 9) + c | 0;\n a += (b ^ c ^ d) + k[1] - 1530992060 | 0;\n a = (a << 4 | a >>> 28) + b | 0;\n d += (a ^ b ^ c) + k[4] + 1272893353 | 0;\n d = (d << 11 | d >>> 21) + a | 0;\n c += (d ^ a ^ b) + k[7] - 155497632 | 0;\n c = (c << 16 | c >>> 16) + d | 0;\n b += (c ^ d ^ a) + k[10] - 1094730640 | 0;\n b = (b << 23 | b >>> 9) + c | 0;\n a += (b ^ c ^ d) + k[13] + 681279174 | 0;\n a = (a << 4 | a >>> 28) + b | 0;\n d += (a ^ b ^ c) + k[0] - 358537222 | 0;\n d = (d << 11 | d >>> 21) + a | 0;\n c += (d ^ a ^ b) + k[3] - 722521979 | 0;\n c = (c << 16 | c >>> 16) + d | 0;\n b += (c ^ d ^ a) + k[6] + 76029189 | 0;\n b = (b << 23 | b >>> 9) + c | 0;\n a += (b ^ c ^ d) + k[9] - 640364487 | 0;\n a = (a << 4 | a >>> 28) + b | 0;\n d += (a ^ b ^ c) + k[12] - 421815835 | 0;\n d = (d << 11 | d >>> 21) + a | 0;\n c += (d ^ a ^ b) + k[15] + 530742520 | 0;\n c = (c << 16 | c >>> 16) + d | 0;\n b += (c ^ d ^ a) + k[2] - 995338651 | 0;\n b = (b << 23 | b >>> 9) + c | 0;\n\n a += (c ^ (b | ~d)) + k[0] - 198630844 | 0;\n a = (a << 6 | a >>> 26) + b | 0;\n d += (b ^ (a | ~c)) + k[7] + 1126891415 | 0;\n d = (d << 10 | d >>> 22) + a | 0;\n c += (a ^ (d | ~b)) + k[14] - 1416354905 | 0;\n c = (c << 15 | c >>> 17) + d | 0;\n b += (d ^ (c | ~a)) + k[5] - 57434055 | 0;\n b = (b << 21 |b >>> 11) + c | 0;\n a += (c ^ (b | ~d)) + k[12] + 1700485571 | 0;\n a = (a << 6 | a >>> 26) + b | 0;\n d += (b ^ (a | ~c)) + k[3] - 1894986606 | 0;\n d = (d << 10 | d >>> 22) + a | 0;\n c += (a ^ (d | ~b)) + k[10] - 1051523 | 0;\n c = (c << 15 | c >>> 17) + d | 0;\n b += (d ^ (c | ~a)) + k[1] - 2054922799 | 0;\n b = (b << 21 |b >>> 11) + c | 0;\n a += (c ^ (b | ~d)) + k[8] + 1873313359 | 0;\n a = (a << 6 | a >>> 26) + b | 0;\n d += (b ^ (a | ~c)) + k[15] - 30611744 | 0;\n d = (d << 10 | d >>> 22) + a | 0;\n c += (a ^ (d | ~b)) + k[6] - 1560198380 | 0;\n c = (c << 15 | c >>> 17) + d | 0;\n b += (d ^ (c | ~a)) + k[13] + 1309151649 | 0;\n b = (b << 21 |b >>> 11) + c | 0;\n a += (c ^ (b | ~d)) + k[4] - 145523070 | 0;\n a = (a << 6 | a >>> 26) + b | 0;\n d += (b ^ (a | ~c)) + k[11] - 1120210379 | 0;\n d = (d << 10 | d >>> 22) + a | 0;\n c += (a ^ (d | ~b)) + k[2] + 718787259 | 0;\n c = (c << 15 | c >>> 17) + d | 0;\n b += (d ^ (c | ~a)) + k[9] - 343485551 | 0;\n b = (b << 21 | b >>> 11) + c | 0;\n\n x[0] = a + x[0] | 0;\n x[1] = b + x[1] | 0;\n x[2] = c + x[2] | 0;\n x[3] = d + x[3] | 0;\n }\n\n function md5blk(s) {\n var md5blks = [],\n i; /* Andy King said do it this way. */\n\n for (i = 0; i < 64; i += 4) {\n md5blks[i >> 2] = s.charCodeAt(i) + (s.charCodeAt(i + 1) << 8) + (s.charCodeAt(i + 2) << 16) + (s.charCodeAt(i + 3) << 24);\n }\n return md5blks;\n }\n\n function md5blk_array(a) {\n var md5blks = [],\n i; /* Andy King said do it this way. */\n\n for (i = 0; i < 64; i += 4) {\n md5blks[i >> 2] = a[i] + (a[i + 1] << 8) + (a[i + 2] << 16) + (a[i + 3] << 24);\n }\n return md5blks;\n }\n\n function md51(s) {\n var n = s.length,\n state = [1732584193, -271733879, -1732584194, 271733878],\n i,\n length,\n tail,\n tmp,\n lo,\n hi;\n\n for (i = 64; i <= n; i += 64) {\n md5cycle(state, md5blk(s.substring(i - 64, i)));\n }\n s = s.substring(i - 64);\n length = s.length;\n tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];\n for (i = 0; i < length; i += 1) {\n tail[i >> 2] |= s.charCodeAt(i) << ((i % 4) << 3);\n }\n tail[i >> 2] |= 0x80 << ((i % 4) << 3);\n if (i > 55) {\n md5cycle(state, tail);\n for (i = 0; i < 16; i += 1) {\n tail[i] = 0;\n }\n }\n\n // Beware that the final length might not fit in 32 bits so we take care of that\n tmp = n * 8;\n tmp = tmp.toString(16).match(/(.*?)(.{0,8})$/);\n lo = parseInt(tmp[2], 16);\n hi = parseInt(tmp[1], 16) || 0;\n\n tail[14] = lo;\n tail[15] = hi;\n\n md5cycle(state, tail);\n return state;\n }\n\n function md51_array(a) {\n var n = a.length,\n state = [1732584193, -271733879, -1732584194, 271733878],\n i,\n length,\n tail,\n tmp,\n lo,\n hi;\n\n for (i = 64; i <= n; i += 64) {\n md5cycle(state, md5blk_array(a.subarray(i - 64, i)));\n }\n\n // Not sure if it is a bug, however IE10 will always produce a sub array of length 1\n // containing the last element of the parent array if the sub array specified starts\n // beyond the length of the parent array - weird.\n // https://connect.microsoft.com/IE/feedback/details/771452/typed-array-subarray-issue\n a = (i - 64) < n ? a.subarray(i - 64) : new Uint8Array(0);\n\n length = a.length;\n tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];\n for (i = 0; i < length; i += 1) {\n tail[i >> 2] |= a[i] << ((i % 4) << 3);\n }\n\n tail[i >> 2] |= 0x80 << ((i % 4) << 3);\n if (i > 55) {\n md5cycle(state, tail);\n for (i = 0; i < 16; i += 1) {\n tail[i] = 0;\n }\n }\n\n // Beware that the final length might not fit in 32 bits so we take care of that\n tmp = n * 8;\n tmp = tmp.toString(16).match(/(.*?)(.{0,8})$/);\n lo = parseInt(tmp[2], 16);\n hi = parseInt(tmp[1], 16) || 0;\n\n tail[14] = lo;\n tail[15] = hi;\n\n md5cycle(state, tail);\n\n return state;\n }\n\n function rhex(n) {\n var s = '',\n j;\n for (j = 0; j < 4; j += 1) {\n s += hex_chr[(n >> (j * 8 + 4)) & 0x0F] + hex_chr[(n >> (j * 8)) & 0x0F];\n }\n return s;\n }\n\n function hex(x) {\n var i;\n for (i = 0; i < x.length; i += 1) {\n x[i] = rhex(x[i]);\n }\n return x.join('');\n }\n\n // In some cases the fast add32 function cannot be used..\n if (hex(md51('hello')) !== '5d41402abc4b2a76b9719d911017c592') {\n add32 = function (x, y) {\n var lsw = (x & 0xFFFF) + (y & 0xFFFF),\n msw = (x >> 16) + (y >> 16) + (lsw >> 16);\n return (msw << 16) | (lsw & 0xFFFF);\n };\n }\n\n // ---------------------------------------------------\n\n /**\n * ArrayBuffer slice polyfill.\n *\n * @see https://github.com/ttaubert/node-arraybuffer-slice\n */\n\n if (typeof ArrayBuffer !== 'undefined' && !ArrayBuffer.prototype.slice) {\n (function () {\n function clamp(val, length) {\n val = (val | 0) || 0;\n\n if (val < 0) {\n return Math.max(val + length, 0);\n }\n\n return Math.min(val, length);\n }\n\n ArrayBuffer.prototype.slice = function (from, to) {\n var length = this.byteLength,\n begin = clamp(from, length),\n end = length,\n num,\n target,\n targetArray,\n sourceArray;\n\n if (to !== undefined) {\n end = clamp(to, length);\n }\n\n if (begin > end) {\n return new ArrayBuffer(0);\n }\n\n num = end - begin;\n target = new ArrayBuffer(num);\n targetArray = new Uint8Array(target);\n\n sourceArray = new Uint8Array(this, begin, num);\n targetArray.set(sourceArray);\n\n return target;\n };\n })();\n }\n\n // ---------------------------------------------------\n\n /**\n * Helpers.\n */\n\n function toUtf8(str) {\n if (/[\\u0080-\\uFFFF]/.test(str)) {\n str = unescape(encodeURIComponent(str));\n }\n\n return str;\n }\n\n function utf8Str2ArrayBuffer(str, returnUInt8Array) {\n var length = str.length,\n buff = new ArrayBuffer(length),\n arr = new Uint8Array(buff),\n i;\n\n for (i = 0; i < length; i += 1) {\n arr[i] = str.charCodeAt(i);\n }\n\n return returnUInt8Array ? arr : buff;\n }\n\n function arrayBuffer2Utf8Str(buff) {\n return String.fromCharCode.apply(null, new Uint8Array(buff));\n }\n\n function concatenateArrayBuffers(first, second, returnUInt8Array) {\n var result = new Uint8Array(first.byteLength + second.byteLength);\n\n result.set(new Uint8Array(first));\n result.set(new Uint8Array(second), first.byteLength);\n\n return returnUInt8Array ? result : result.buffer;\n }\n\n function hexToBinaryString(hex) {\n var bytes = [],\n length = hex.length,\n x;\n\n for (x = 0; x < length - 1; x += 2) {\n bytes.push(parseInt(hex.substr(x, 2), 16));\n }\n\n return String.fromCharCode.apply(String, bytes);\n }\n\n // ---------------------------------------------------\n\n /**\n * SparkMD5 OOP implementation.\n *\n * Use this class to perform an incremental md5, otherwise use the\n * static methods instead.\n */\n\n function SparkMD5() {\n // call reset to init the instance\n this.reset();\n }\n\n /**\n * Appends a string.\n * A conversion will be applied if an utf8 string is detected.\n *\n * @param {String} str The string to be appended\n *\n * @return {SparkMD5} The instance itself\n */\n SparkMD5.prototype.append = function (str) {\n // Converts the string to utf8 bytes if necessary\n // Then append as binary\n this.appendBinary(toUtf8(str));\n\n return this;\n };\n\n /**\n * Appends a binary string.\n *\n * @param {String} contents The binary string to be appended\n *\n * @return {SparkMD5} The instance itself\n */\n SparkMD5.prototype.appendBinary = function (contents) {\n this._buff += contents;\n this._length += contents.length;\n\n var length = this._buff.length,\n i;\n\n for (i = 64; i <= length; i += 64) {\n md5cycle(this._hash, md5blk(this._buff.substring(i - 64, i)));\n }\n\n this._buff = this._buff.substring(i - 64);\n\n return this;\n };\n\n /**\n * Finishes the incremental computation, reseting the internal state and\n * returning the result.\n *\n * @param {Boolean} raw True to get the raw string, false to get the hex string\n *\n * @return {String} The result\n */\n SparkMD5.prototype.end = function (raw) {\n var buff = this._buff,\n length = buff.length,\n i,\n tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n ret;\n\n for (i = 0; i < length; i += 1) {\n tail[i >> 2] |= buff.charCodeAt(i) << ((i % 4) << 3);\n }\n\n this._finish(tail, length);\n ret = hex(this._hash);\n\n if (raw) {\n ret = hexToBinaryString(ret);\n }\n\n this.reset();\n\n return ret;\n };\n\n /**\n * Resets the internal state of the computation.\n *\n * @return {SparkMD5} The instance itself\n */\n SparkMD5.prototype.reset = function () {\n this._buff = '';\n this._length = 0;\n this._hash = [1732584193, -271733879, -1732584194, 271733878];\n\n return this;\n };\n\n /**\n * Gets the internal state of the computation.\n *\n * @return {Object} The state\n */\n SparkMD5.prototype.getState = function () {\n return {\n buff: this._buff,\n length: this._length,\n hash: this._hash\n };\n };\n\n /**\n * Gets the internal state of the computation.\n *\n * @param {Object} state The state\n *\n * @return {SparkMD5} The instance itself\n */\n SparkMD5.prototype.setState = function (state) {\n this._buff = state.buff;\n this._length = state.length;\n this._hash = state.hash;\n\n return this;\n };\n\n /**\n * Releases memory used by the incremental buffer and other additional\n * resources. If you plan to use the instance again, use reset instead.\n */\n SparkMD5.prototype.destroy = function () {\n delete this._hash;\n delete this._buff;\n delete this._length;\n };\n\n /**\n * Finish the final calculation based on the tail.\n *\n * @param {Array} tail The tail (will be modified)\n * @param {Number} length The length of the remaining buffer\n */\n SparkMD5.prototype._finish = function (tail, length) {\n var i = length,\n tmp,\n lo,\n hi;\n\n tail[i >> 2] |= 0x80 << ((i % 4) << 3);\n if (i > 55) {\n md5cycle(this._hash, tail);\n for (i = 0; i < 16; i += 1) {\n tail[i] = 0;\n }\n }\n\n // Do the final computation based on the tail and length\n // Beware that the final length may not fit in 32 bits so we take care of that\n tmp = this._length * 8;\n tmp = tmp.toString(16).match(/(.*?)(.{0,8})$/);\n lo = parseInt(tmp[2], 16);\n hi = parseInt(tmp[1], 16) || 0;\n\n tail[14] = lo;\n tail[15] = hi;\n md5cycle(this._hash, tail);\n };\n\n /**\n * Performs the md5 hash on a string.\n * A conversion will be applied if utf8 string is detected.\n *\n * @param {String} str The string\n * @param {Boolean} raw True to get the raw string, false to get the hex string\n *\n * @return {String} The result\n */\n SparkMD5.hash = function (str, raw) {\n // Converts the string to utf8 bytes if necessary\n // Then compute it using the binary function\n return SparkMD5.hashBinary(toUtf8(str), raw);\n };\n\n /**\n * Performs the md5 hash on a binary string.\n *\n * @param {String} content The binary string\n * @param {Boolean} raw True to get the raw string, false to get the hex string\n *\n * @return {String} The result\n */\n SparkMD5.hashBinary = function (content, raw) {\n var hash = md51(content),\n ret = hex(hash);\n\n return raw ? hexToBinaryString(ret) : ret;\n };\n\n // ---------------------------------------------------\n\n /**\n * SparkMD5 OOP implementation for array buffers.\n *\n * Use this class to perform an incremental md5 ONLY for array buffers.\n */\n SparkMD5.ArrayBuffer = function () {\n // call reset to init the instance\n this.reset();\n };\n\n /**\n * Appends an array buffer.\n *\n * @param {ArrayBuffer} arr The array to be appended\n *\n * @return {SparkMD5.ArrayBuffer} The instance itself\n */\n SparkMD5.ArrayBuffer.prototype.append = function (arr) {\n var buff = concatenateArrayBuffers(this._buff.buffer, arr, true),\n length = buff.length,\n i;\n\n this._length += arr.byteLength;\n\n for (i = 64; i <= length; i += 64) {\n md5cycle(this._hash, md5blk_array(buff.subarray(i - 64, i)));\n }\n\n this._buff = (i - 64) < length ? new Uint8Array(buff.buffer.slice(i - 64)) : new Uint8Array(0);\n\n return this;\n };\n\n /**\n * Finishes the incremental computation, reseting the internal state and\n * returning the result.\n *\n * @param {Boolean} raw True to get the raw string, false to get the hex string\n *\n * @return {String} The result\n */\n SparkMD5.ArrayBuffer.prototype.end = function (raw) {\n var buff = this._buff,\n length = buff.length,\n tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n i,\n ret;\n\n for (i = 0; i < length; i += 1) {\n tail[i >> 2] |= buff[i] << ((i % 4) << 3);\n }\n\n this._finish(tail, length);\n ret = hex(this._hash);\n\n if (raw) {\n ret = hexToBinaryString(ret);\n }\n\n this.reset();\n\n return ret;\n };\n\n /**\n * Resets the internal state of the computation.\n *\n * @return {SparkMD5.ArrayBuffer} The instance itself\n */\n SparkMD5.ArrayBuffer.prototype.reset = function () {\n this._buff = new Uint8Array(0);\n this._length = 0;\n this._hash = [1732584193, -271733879, -1732584194, 271733878];\n\n return this;\n };\n\n /**\n * Gets the internal state of the computation.\n *\n * @return {Object} The state\n */\n SparkMD5.ArrayBuffer.prototype.getState = function () {\n var state = SparkMD5.prototype.getState.call(this);\n\n // Convert buffer to a string\n state.buff = arrayBuffer2Utf8Str(state.buff);\n\n return state;\n };\n\n /**\n * Gets the internal state of the computation.\n *\n * @param {Object} state The state\n *\n * @return {SparkMD5.ArrayBuffer} The instance itself\n */\n SparkMD5.ArrayBuffer.prototype.setState = function (state) {\n // Convert string to buffer\n state.buff = utf8Str2ArrayBuffer(state.buff, true);\n\n return SparkMD5.prototype.setState.call(this, state);\n };\n\n SparkMD5.ArrayBuffer.prototype.destroy = SparkMD5.prototype.destroy;\n\n SparkMD5.ArrayBuffer.prototype._finish = SparkMD5.prototype._finish;\n\n /**\n * Performs the md5 hash on an array buffer.\n *\n * @param {ArrayBuffer} arr The array buffer\n * @param {Boolean} raw True to get the raw string, false to get the hex one\n *\n * @return {String} The result\n */\n SparkMD5.ArrayBuffer.hash = function (arr, raw) {\n var hash = md51_array(new Uint8Array(arr)),\n ret = hex(hash);\n\n return raw ? hexToBinaryString(ret) : ret;\n };\n\n return SparkMD5;\n}));\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNS5qcyIsInNvdXJjZXMiOlsid2VicGFjazovLy8uL25vZGVfbW9kdWxlcy9zcGFyay1tZDUvc3BhcmstbWQ1LmpzPzY5YTAiXSwic291cmNlc0NvbnRlbnQiOlsiKGZ1bmN0aW9uIChmYWN0b3J5KSB7XG4gICAgaWYgKHR5cGVvZiBleHBvcnRzID09PSAnb2JqZWN0Jykge1xuICAgICAgICAvLyBOb2RlL0NvbW1vbkpTXG4gICAgICAgIG1vZHVsZS5leHBvcnRzID0gZmFjdG9yeSgpO1xuICAgIH0gZWxzZSBpZiAodHlwZW9mIGRlZmluZSA9PT0gJ2Z1bmN0aW9uJyAmJiBkZWZpbmUuYW1kKSB7XG4gICAgICAgIC8vIEFNRFxuICAgICAgICBkZWZpbmUoZmFjdG9yeSk7XG4gICAgfSBlbHNlIHtcbiAgICAgICAgLy8gQnJvd3NlciBnbG9iYWxzICh3aXRoIHN1cHBvcnQgZm9yIHdlYiB3b3JrZXJzKVxuICAgICAgICB2YXIgZ2xvYjtcblxuICAg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Igc2xpY2UgcG9seWZpbGwuXG4gICAgICpcbiAgICAgKiBAc2VlIGh0dHBzOi8vZ2l0aHViLmNvbS90dGF1YmVydC9ub2RlLWFycmF5YnVmZmVyLXNsaWNlXG4gICAgICovXG5cbiAgICBpZiAodHlwZW9mIEFycmF5QnVmZmVyICE9PSAndW5kZWZpbmVkJyAmJiAhQXJyYXlCdWZmZXIucHJvdG90eXBlLnNsaWNlKSB7XG4gICAgICAgIChmdW5jdGlvbiAoKSB7XG4gICAgICAgICAgICBmdW5jdGlvbiBjbGFtcCh2YWwsIGxlbmd0aCkge1xuICAgICAgICAgICAgICAgIHZhbCA9ICh2YWwgfCAwKSB8fCAwO1xuXG4gICAgICAgICAgICAgICAgaWYgKHZhbCA8IDApIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE1hdGgubWF4KHZhbCArIGxlbmd0aCwgMCk7XG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgcmV0dXJuIE1hdGgubWluKHZhbCwgbGVuZ3RoKTtcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgQXJyYXlCdWZmZXIucHJvdG90eXBlLnNsaWNlID0gZnVuY3Rpb24gKGZyb20sIHRvKSB7XG4gICAgICAgICAgICAgICAgdmFyIGxlbmd0aCA9IHRoaXMuYnl0ZUxlbmd0aCxcbiAgICAgICAgICAgICAgICAgICAgYmVnaW4gPSBjbGFtcChmcm9tLCBsZW5ndGgpLFxuICAgICAgICAgICAgICAgICAgICBlbmQgPSBsZW5ndGgsXG4gICAgICAgICAgICAgICAgICAgIG51bSxcbiAgICAgICAgICAgICAgICAgICAgdGFyZ2V0LFxuICAgICAgICAgICAgICAgICAgICB0YXJnZXRBcnJheSxcbiAgICAgICAgICAgICAgICAgICAgc291cmNlQXJyYXk7XG5cbiAgICAgICAgICAgICAgICBpZiAodG8gIT09IHVuZGVmaW5lZCkge1xuICAgICAgICAgICAgICAgICAgICBlbmQgPSBjbGFtcCh0bywgbGVuZ3RoKTtcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICBpZiAoYmVnaW4gPiBlbmQpIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG5ldyBBcnJheUJ1ZmZlcigwKTtcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICBudW0gPSBlbmQgLSBiZWdpbjtcbiAgICAgICAgICAgICAgICB0YXJnZXQgPSBuZXcgQXJyYXlCdWZmZXIobnVtKTtcbiAgICAgICAgICAgICAgICB0YXJnZXRBcnJheSA9IG5ldyBVaW50OEFycmF5KHRhcmdldCk7XG5cbiAgICAgICAgICAgICAgICBzb3VyY2VBcnJheSA9IG5ldyBVaW50OEFycmF5KHRoaXMsIGJlZ2luLCBudW0pO1xuICAgICAgICAgICAgICAgIHRhcmdldEFycmF5LnNldChzb3VyY2VBcnJheSk7XG5cbiAgICAgICAgICAgICAgICByZXR1cm4gdGFyZ2V0O1xuICAgICAgICAgICAgfTtcbiAgICAgICAgfSkoKTtcbiAgICB9XG5cbiAgICAvLyAtLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS1cblxuICAgIC8qKlxuICAgICAqIEhlbHBlcnMuXG4gICAgICovXG5cbiAgICBmdW5jdGlvbiB0b1V0Zjgoc3RyKSB7XG4gICAgICAgIGlmICgvW1xcdTAwODAtXFx1RkZGRl0vLnRlc3Qoc3RyKSkge1xuICAgICAgICAgICAgc3RyID0gdW5lc2NhcGUoZW5jb2RlVVJJQ29tcG9uZW50KHN0cikpO1xuICAgICAgICB9XG5cbiAgICAgICAgcmV0dXJuIHN0cjtcbiAgICB9XG5cbiAgICBmdW5jdGlvbiB1dGY4U3RyMkFycmF5QnVmZmVyKHN0ciwgcmV0dXJuVUludDhBcnJheSkge1xuICAgICAgICB2YXIgbGVuZ3RoID0gc3RyLmxlbmd0aCxcbiAgICAgICAgICAgYnVmZiA9IG5ldyBBcnJheUJ1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TtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTsiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///5\n")},function(module,exports,__webpack_require__){"use strict";eval("\n\nmodule.exports = function bind(fn, thisArg) {\n return function wrap() {\n var args = new Array(arguments.length);\n for (var i = 0; i < args.length; i++) {\n args[i] = arguments[i];\n }\n return fn.apply(thisArg, args);\n };\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNi5qcyIsInNvdXJjZXMiOlsid2VicGFjazovLy8uL25vZGVfbW9kdWxlcy9heGlvcy9saWIvaGVscGVycy9iaW5kLmpzPzFkMmIiXSwic291cmNlc0NvbnRlbnQiOlsiJ3VzZSBzdHJpY3QnO1xuXG5tb2R1bGUuZXhwb3J0cyA9IGZ1bmN0aW9uIGJpbmQoZm4sIHRoaXNBcmcpIHtcbiAgcmV0dXJuIGZ1bmN0aW9uIHdyYXAoKSB7XG4gICAgdmFyIGFyZ3MgPSBuZXcgQXJyYXkoYXJndW1lbnRzLmxlbmd0aCk7XG4gICAgZm9yICh2YXIgaSA9IDA7IGkgPCBhcmdzLmxlbmd0aDsgaSsrKSB7XG4gICAgICBhcmdzW2ldID0gYXJndW1lbnRzW2ldO1xuICAgIH1cbiAgICByZXR1cm4gZm4uYXBwbHkodGhpc0FyZywgYXJncyk7XG4gIH07XG59O1xuIl0sIm1hcHBpbmdzIjoiQUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOyIsInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///6\n")},function(module,exports,__webpack_require__){"use strict";eval("\n\nvar utils = __webpack_require__(0);\n\nfunction encode(val) {\n return encodeURIComponent(val).\n replace(/%40/gi, '@').\n replace(/%3A/gi, ':').\n replace(/%24/g, '$').\n replace(/%2C/gi, ',').\n replace(/%20/g, '+').\n replace(/%5B/gi, '[').\n replace(/%5D/gi, ']');\n}\n\n/**\n * Build a URL by appending params to the end\n *\n * @param {string} url The base of the url (e.g., http://www.google.com)\n * @param {object} [params] The params to be appended\n * @returns {string} The formatted url\n */\nmodule.exports = function buildURL(url, params, paramsSerializer) {\n /*eslint no-param-reassign:0*/\n if (!params) {\n return url;\n }\n\n var serializedParams;\n if (paramsSerializer) {\n serializedParams = paramsSerializer(params);\n } else if (utils.isURLSearchParams(params)) {\n serializedParams = params.toString();\n } else {\n var parts = [];\n\n utils.forEach(params, function serialize(val, key) {\n if (val === null || typeof val === 'undefined') {\n return;\n }\n\n if (utils.isArray(val)) {\n key = key + '[]';\n } else {\n val = [val];\n }\n\n utils.forEach(val, function parseValue(v) {\n if (utils.isDate(v)) {\n v = v.toISOString();\n } else if (utils.isObject(v)) {\n v = JSON.stringify(v);\n }\n parts.push(encode(key) + '=' + encode(v));\n });\n });\n\n serializedParams = parts.join('&');\n }\n\n if (serializedParams) {\n var hashmarkIndex = url.indexOf('#');\n if (hashmarkIndex !== -1) {\n url = url.slice(0, hashmarkIndex);\n }\n\n url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;\n }\n\n return url;\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNy5qcyIsInNvdXJjZXMiOlsid2VicGFjazovLy8uL25vZGVfbW9kdWxlcy9heGlvcy9saWIvaGVscGVycy9idWlsZFVSTC5qcz8zMGI1Il0sInNvdXJjZXNDb250ZW50IjpbIid1c2Ugc3RyaWN0JztcblxudmFyIHV0aWxzID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PT0gLTEgPyAnPycgOiAnJicpICsgc2VyaWFsaXplZFBhcmFtcztcbiAgfVxuXG4gIHJldHVybiB1cmw7XG59O1xuIl0sIm1hcHBpbmdzIjoiQUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOyIsInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///7\n")},function(module,exports,__webpack_require__){"use strict";eval("\n\nmodule.exports = function isCancel(value) {\n return !!(value && value.__CANCEL__);\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiOC5qcyIsInNvdXJjZXMiOlsid2VicGFjazovLy8uL25vZGVfbW9kdWxlcy9heGlvcy9saWIvY2FuY2VsL2lzQ2FuY2VsLmpzPzJlNjciXSwic291cmNlc0NvbnRlbnQiOlsiJ3VzZSBzdHJpY3QnO1xuXG5tb2R1bGUuZXhwb3J0cyA9IGZ1bmN0aW9uIGlzQ2FuY2VsKHZhbHVlKSB7XG4gIHJldHVybiAhISh2YWx1ZSAmJiB2YWx1ZS5fX0NBTkNFTF9fKTtcbn07XG4iXSwibWFwcGluZ3MiOiJBQUFBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7Iiwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///8\n")},function(module,exports,__webpack_require__){"use strict";eval("/* WEBPACK VAR INJECTION */(function(process) {\n\nvar utils = __webpack_require__(0);\nvar normalizeHeaderName = __webpack_require__(24);\n\nvar DEFAULT_CONTENT_TYPE = {\n 'Content-Type': 'application/x-www-form-urlencoded'\n};\n\nfunction setContentTypeIfUnset(headers, value) {\n if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) {\n headers['Content-Type'] = value;\n }\n}\n\nfunction getDefaultAdapter() {\n var adapter;\n // Only Node.JS has a process variable that is of [[Class]] process\n if (typeof process !== 'undefined' && Object.prototype.toString.call(process) === '[object process]') {\n // For node use HTTP adapter\n adapter = __webpack_require__(10);\n } else if (typeof XMLHttpRequest !== 'undefined') {\n // For browsers use XHR adapter\n adapter = __webpack_require__(10);\n }\n return adapter;\n}\n\nvar defaults = {\n adapter: getDefaultAdapter(),\n\n transformRequest: [function transformRequest(data, headers) {\n normalizeHeaderName(headers, 'Accept');\n normalizeHeaderName(headers, 'Content-Type');\n if (utils.isFormData(data) ||\n utils.isArrayBuffer(data) ||\n utils.isBuffer(data) ||\n utils.isStream(data) ||\n utils.isFile(data) ||\n utils.isBlob(data)\n ) {\n return data;\n }\n if (utils.isArrayBufferView(data)) {\n return data.buffer;\n }\n if (utils.isURLSearchParams(data)) {\n setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8');\n return data.toString();\n }\n if (utils.isObject(data)) {\n setContentTypeIfUnset(headers, 'application/json;charset=utf-8');\n return JSON.stringify(data);\n }\n return data;\n }],\n\n transformResponse: [function transformResponse(data) {\n /*eslint no-param-reassign:0*/\n if (typeof data === 'string') {\n try {\n data = JSON.parse(data);\n } catch (e) { /* Ignore */ }\n }\n return data;\n }],\n\n /**\n * A timeout in milliseconds to abort a request. If set to 0 (default) a\n * timeout is not created.\n */\n timeout: 0,\n\n xsrfCookieName: 'XSRF-TOKEN',\n xsrfHeaderName: 'X-XSRF-TOKEN',\n\n maxContentLength: -1,\n\n validateStatus: function validateStatus(status) {\n return status >= 200 && status < 300;\n }\n};\n\ndefaults.headers = {\n common: {\n 'Accept': 'application/json, text/plain, */*'\n }\n};\n\nutils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {\n defaults.headers[method] = {};\n});\n\nutils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {\n defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);\n});\n\nmodule.exports = defaults;\n\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(23)))//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiOS5qcyIsInNvdXJjZXMiOlsid2VicGFjazovLy8uL25vZGVfbW9kdWxlcy9heGlvcy9saWIvZGVmYXVsdHMuanM/MjQ0NCJdLCJzb3VyY2VzQ29udGVudCI6WyIndXNlIHN0cmljdCc7XG5cbnZhciB1dGlscyA9IHJlcXVpcmUoJy4vdXRpbHMnKTtcbnZhciBub3JtYWxpemVIZWFkZXJOYW1lID0gcmVxdWlyZSgnLi9oZWxwZXJzL25vcm1hbGl6ZUhlYWRlck5hbWUnKTtcblxudmFyIERFRkFVTFRfQ09OVEVOVF9UWVBFID0ge1xuICAnQ29udGVudC1UeXBlJzogJ2FwcGxpY2F0aW9uL3gtd3d3LWZvcm0tdXJsZW5jb2RlZCdcbn07XG5cbmZ1bmN0aW9uIHNldENvbnRlbnRUeXBlSWZVbnNldChoZWFkZXJzLCB2YWx1ZSkge1xuICBpZiAoIXV0aWxzLmlzVW5kZWZpbmVkKGhlYWRlcnMpICYmIHV0aWxzLmlzVW5kZWZpbmVkKGhlYWRlcnNbJ0NvbnRlbnQtVHlwZSddKSkge1xuICAgIGhlYWRlcnNbJ0NvbnR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E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBIiwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///9\n")},function(module,exports,__webpack_require__){"use strict";eval("\n\nvar utils = __webpack_require__(0);\nvar settle = __webpack_require__(25);\nvar buildURL = __webpack_require__(7);\nvar parseHeaders = __webpack_require__(27);\nvar isURLSameOrigin = __webpack_require__(28);\nvar createError = __webpack_require__(11);\n\nmodule.exports = function xhrAdapter(config) {\n return new Promise(function dispatchXhrRequest(resolve, reject) {\n var requestData = config.data;\n var requestHeaders = config.headers;\n\n if (utils.isFormData(requestData)) {\n delete requestHeaders['Content-Type']; // Let the browser set it\n }\n\n var request = new XMLHttpRequest();\n\n // HTTP basic authentication\n if (config.auth) {\n var username = config.auth.username || '';\n var password = config.auth.password || '';\n requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password);\n }\n\n request.open(config.method.toUpperCase(), buildURL(config.url, config.params, config.paramsSerializer), true);\n\n // Set the request timeout in MS\n request.timeout = config.timeout;\n\n // Listen for ready state\n request.onreadystatechange = function handleLoad() {\n if (!request || request.readyState !== 4) {\n return;\n }\n\n // The request errored out and we didn't get a response, this will be\n // handled by onerror instead\n // With one exception: request that using file: protocol, most browsers\n // will return status as 0 even though it's a successful request\n if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {\n return;\n }\n\n // Prepare the response\n var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null;\n var responseData = !config.responseType || config.responseType === 'text' ? request.responseText : request.response;\n var response = {\n data: responseData,\n status: request.status,\n statusText: request.statusText,\n headers: responseHeaders,\n config: config,\n request: request\n };\n\n settle(resolve, reject, response);\n\n // Clean up request\n request = null;\n };\n\n // Handle browser request cancellation (as opposed to a manual cancellation)\n request.onabort = function handleAbort() {\n if (!request) {\n return;\n }\n\n reject(createError('Request aborted', config, 'ECONNABORTED', request));\n\n // Clean up request\n request = null;\n };\n\n // Handle low level network errors\n request.onerror = function handleError() {\n // Real errors are hidden from us by the browser\n // onerror should only fire if it's a network error\n reject(createError('Network Error', config, null, request));\n\n // Clean up request\n request = null;\n };\n\n // Handle timeout\n request.ontimeout = function handleTimeout() {\n reject(createError('timeout of ' + config.timeout + 'ms exceeded', config, 'ECONNABORTED',\n request));\n\n // Clean up request\n request = null;\n };\n\n // Add xsrf header\n // This is only done if running in a standard browser environment.\n // Specifically not if we're in a web worker, or react-native.\n if (utils.isStandardBrowserEnv()) {\n var cookies = __webpack_require__(29);\n\n // Add xsrf header\n var xsrfValue = (config.withCredentials || isURLSameOrigin(config.url)) && config.xsrfCookieName ?\n cookies.read(config.xsrfCookieName) :\n undefined;\n\n if (xsrfValue) {\n requestHeaders[config.xsrfHeaderName] = xsrfValue;\n }\n }\n\n // Add headers to the request\n if ('setRequestHeader' in request) {\n utils.forEach(requestHeaders, function setRequestHeader(val, key) {\n if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') {\n // Remove Content-Type if data is undefined\n delete requestHeaders[key];\n } else {\n // Otherwise add header to the request\n request.setRequestHeader(key, val);\n }\n });\n }\n\n // Add withCredentials to request if needed\n if (config.withCredentials) {\n request.withCredentials = true;\n }\n\n // Add responseType to request if needed\n if (config.responseType) {\n try {\n request.responseType = config.responseType;\n } catch (e) {\n // Expected DOMException thrown by browsers not compatible XMLHttpRequest Level 2.\n // But, this can be suppressed for 'json' type as it can be parsed by default 'transformResponse' function.\n if (config.responseType !== 'json') {\n throw e;\n }\n }\n }\n\n // Handle progress if needed\n if (typeof config.onDownloadProgress === 'function') {\n request.addEventListener('progress', config.onDownloadProgress);\n }\n\n // Not all browsers support upload events\n if (typeof config.onUploadProgress === 'function' && request.upload) {\n request.upload.addEventListener('progress', config.onUploadProgress);\n }\n\n if (config.cancelToken) {\n // Handle cancellation\n config.cancelToken.promise.then(function onCanceled(cancel) {\n if (!request) {\n return;\n }\n\n request.abort();\n reject(cancel);\n // Clean up request\n request = null;\n });\n }\n\n if (requestData === undefined) {\n requestData = null;\n }\n\n // Send the request\n request.send(requestData);\n });\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMTAuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYXhpb3MvbGliL2FkYXB0ZXJzL3hoci5qcz9iNTBkIl0sInNvdXJjZXNDb250ZW50IjpbIid1c2Ugc3RyaWN0JztcblxudmFyIHV0aWxzID0gcmVxdWlyZSgnLi8uLi91dGlscycpO1xudmFyIHNldHRsZSA9IHJlcXVpcmUoJy4vLi4vY29yZS9zZXR0bGUnKTtcbnZhciBidWlsZFVSTCA9IHJlcXVpcmUoJy4vLi4vaGVscGVycy9idWlsZFVSTCcpO1xudmFyIHBhcnNlSGVhZGVycyA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L=webpack-internal:///10\n")},function(module,exports,__webpack_require__){"use strict";eval("\n\nvar enhanceError = __webpack_require__(26);\n\n/**\n * Create an Error with the specified message, config, error code, request and response.\n *\n * @param {string} message The error message.\n * @param {Object} config The config.\n * @param {string} [code] The error code (for example, 'ECONNABORTED').\n * @param {Object} [request] The request.\n * @param {Object} [response] The response.\n * @returns {Error} The created error.\n */\nmodule.exports = function createError(message, config, code, request, response) {\n var error = new Error(message);\n return enhanceError(error, config, code, request, response);\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMTEuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYXhpb3MvbGliL2NvcmUvY3JlYXRlRXJyb3IuanM/MmQ4MyJdLCJzb3VyY2VzQ29udGVudCI6WyIndXNlIHN0cmljdCc7XG5cbnZhciBlbmhhbmNlRXJyb3IgPSByZXF1aXJlKCcuL2VuaGFuY2VFcnJvcicpO1xuXG4vKipcbiAqIENyZWF0ZSBhbiBFcnJvciB3aXRoIHRoZSBzcGVjaWZpZWQgbWVzc2FnZSwgY29uZmlnLCBlcnJvciBjb2RlLCByZXF1ZXN0IGFuZCByZXNwb25zZS5cbiAqXG4gKiBAcGFyYW0ge3N0cmluZ30gbWVzc2FnZSBUaGUgZXJyb3IgbWVzc2FnZS5cbiAqIEBwYXJhbSB7T2JqZWN0fSBjb25maWcgVGhlIGNvbmZpZy5cbiAqIEBwYXJhbSB7c3RyaW5nfSBbY29kZV0gVGhlIGVycm9yIGNvZGUgKGZvciBleGFtcGxlLCAnRUNPTk5BQk9SVEVEJykuXG4gKiBAcGFyYW0ge09iamVjdH0gW3JlcXVlc3RdIFRoZSByZXF1ZXN0LlxuICogQHBhcmFtIHtPYmplY3R9IFtyZXNwb25zZV0gVGhlIHJlc3BvbnNlLlxuICogQHJldHVybnMge0Vycm9yfSBUaGUgY3JlYXRlZCBlcnJvci5cbiAqL1xubW9kdWxlLmV4cG9ydHMgPSBmdW5jdGlvbiBjcmVhdGVFcnJvcihtZXNzYWdlLCBjb25maWcsIGNvZGUsIHJlcXVlc3QsIHJlc3BvbnNlKSB7XG4gIHZhciBlcnJvciA9IG5ldyBFcnJvcihtZXNzYWdlKTtcbiAgcmV0dXJuIGVuaGFuY2VFcnJvcihlcnJvciwgY29uZmlnLCBjb2RlLCByZXF1ZXN0LCByZXNwb25zZSk7XG59O1xuIl0sIm1hcHBpbmdzIjoiQUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7Iiwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///11\n")},function(module,exports,__webpack_require__){"use strict";eval("\n\nvar utils = __webpack_require__(0);\n\n/**\n * Config-specific merge-function which creates a new config-object\n * by merging two configuration objects together.\n *\n * @param {Object} config1\n * @param {Object} config2\n * @returns {Object} New object resulting from merging config2 to config1\n */\nmodule.exports = function mergeConfig(config1, config2) {\n // eslint-disable-next-line no-param-reassign\n config2 = config2 || {};\n var config = {};\n\n utils.forEach(['url', 'method', 'params', 'data'], function valueFromConfig2(prop) {\n if (typeof config2[prop] !== 'undefined') {\n config[prop] = config2[prop];\n }\n });\n\n utils.forEach(['headers', 'auth', 'proxy'], function mergeDeepProperties(prop) {\n if (utils.isObject(config2[prop])) {\n config[prop] = utils.deepMerge(config1[prop], config2[prop]);\n } else if (typeof config2[prop] !== 'undefined') {\n config[prop] = config2[prop];\n } else if (utils.isObject(config1[prop])) {\n config[prop] = utils.deepMerge(config1[prop]);\n } else if (typeof config1[prop] !== 'undefined') {\n config[prop] = config1[prop];\n }\n });\n\n utils.forEach([\n 'baseURL', 'transformRequest', 'transformResponse', 'paramsSerializer',\n 'timeout', 'withCredentials', 'adapter', 'responseType', 'xsrfCookieName',\n 'xsrfHeaderName', 'onUploadProgress', 'onDownloadProgress', 'maxContentLength',\n 'validateStatus', 'maxRedirects', 'httpAgent', 'httpsAgent', 'cancelToken',\n 'socketPath'\n ], function defaultToConfig2(prop) {\n if (typeof config2[prop] !== 'undefined') {\n config[prop] = config2[prop];\n } else if (typeof config1[prop] !== 'undefined') {\n config[prop] = config1[prop];\n }\n });\n\n return config;\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMTIuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYXhpb3MvbGliL2NvcmUvbWVyZ2VDb25maWcuanM/NGE3YiJdLCJzb3VyY2VzQ29udGVudCI6WyIndXNlIHN0cmljdCc7XG5cbnZhciB1dGlscyA9IHJlcXVpcmUoJy4uL3V0aWxzJyk7XG5cbi8qKlxuICogQ29uZmlnLXNwZWNpZmljIG1lcmdlLWZ1bmN0aW9uIHdoaWNoIGNyZWF0ZXMgYSBuZXcgY29uZmlnLW9iamVjdFxuICogYnkgbWVyZ2luZyB0d28gY29uZmlndXJhdGlvbiBvYmplY3RzIHRvZ2V0aGVyLlxuICpcbiAqIEBwYXJhbSB7T2JqZWN0fSBjb25maWcxXG4gKiBAcGFyYW0ge09iamVjdH0gY29uZmlnMlxuICogQHJldHVybnMge09iamVjdH0gTmV3IG9iamVjdCByZXN1bHRpbmcgZnJvbSBtZXJnaW5nIGNvbmZpZzIgdG8gY29uZmlnMVxuICovXG5tb2R1bGUuZXhwb3J0cyA9IGZ1bmN0aW9uIG1lcmdlQ29uZmlnKGNvbmZpZzEsIGNvbmZpZzIpIHtcbiAgLy8gZXNsaW50LWRpc2FibGUtbmV4dC1saW5lIG5vLXBhcmFtLXJlYXNzaWduXG4gIGNvbmZpZzIgPSBjb25maWcyIHx8IHt9O1xuICB2YXIgY29uZmlnID0ge307XG5cbiAgdXRpbHMuZm9yRWFjaChbJ3VybCcsICd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NyZkNvb2tpZU5hbWUnLFxuICAgICd4c3JmSGVhZGVyTmFtZScsICdvblVwbG9hZFByb2dyZXNzJywgJ29uRG93bmxvYWRQcm9ncmVzcycsICdtYXhDb250ZW50TGVuZ3RoJyxcbiAgICAndmFsaWRhdGVTdGF0dXMnLCAnbWF4UmVkaXJlY3RzJywgJ2h0dHBBZ2VudCcsICdodHRwc0FnZW50JywgJ2NhbmNlbFRva2VuJyxcbiAgICAnc29ja2V0UGF0aCdcbiAgXSwgZnVuY3Rpb24gZGVmYXVsdFRvQ29uZmlnMihwcm9wKSB7XG4gICAgaWYgKHR5cGVvZiBjb25maWcyW3Byb3BdICE9PSAndW5kZWZpbmVkJykge1xuICAgICAgY29uZmlnW3Byb3BdID0gY29uZmlnMltwcm9wXTtcbiAgICB9IGVsc2UgaWYgKHR5cGVvZiBjb25maWcxW3Byb3BdICE9PSAndW5kZWZpbmVkJykge1xuICAgICAgY29uZmlnW3Byb3BdID0gY29uZmlnMVtwcm9wXTtcbiAgICB9XG4gIH0pO1xuXG4gIHJldHVybiBjb25maWc7XG59O1xuIl0sIm1hcHBpbmdzIjoiQUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7Iiwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///12\n")},function(module,exports,__webpack_require__){"use strict";eval("\n\n/**\n * A `Cancel` is an object that is thrown when an operation is canceled.\n *\n * @class\n * @param {string=} message The message.\n */\nfunction Cancel(message) {\n this.message = message;\n}\n\nCancel.prototype.toString = function toString() {\n return 'Cancel' + (this.message ? ': ' + this.message : '');\n};\n\nCancel.prototype.__CANCEL__ = true;\n\nmodule.exports = Cancel;\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMTMuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYXhpb3MvbGliL2NhbmNlbC9DYW5jZWwuanM/N2E3NyJdLCJzb3VyY2VzQ29udGVudCI6WyIndXNlIHN0cmljdCc7XG5cbi8qKlxuICogQSBgQ2FuY2VsYCBpcyBhbiBvYmplY3QgdGhhdCBpcyB0aHJvd24gd2hlbiBhbiBvcGVyYXRpb24gaXMgY2FuY2VsZWQuXG4gKlxuICogQGNsYXNzXG4gKiBAcGFyYW0ge3N0cmluZz19IG1lc3NhZ2UgVGhlIG1lc3NhZ2UuXG4gKi9cbmZ1bmN0aW9uIENhbmNlbChtZXNzYWdlKSB7XG4gIHRoaXMubWVzc2FnZSA9IG1lc3NhZ2U7XG59XG5cbkNhbmNlbC5wcm90b3R5cGUudG9TdHJpbmcgPSBmdW5jdGlvbiB0b1N0cmluZygpIHtcbiAgcmV0dXJuICdDYW5jZWwnICsgKHRoaXMubWVzc2FnZSA/ICc6ICcgKyB0aGlzLm1lc3NhZ2UgOiAnJyk7XG59O1xuXG5DYW5jZWwucHJvdG90eXBlLl9fQ0FOQ0VMX18gPSB0cnVlO1xuXG5tb2R1bGUuZXhwb3J0cyA9IENhbmNlbDtcbiJdLCJtYXBwaW5ncyI6IkFBQUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7Iiwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///13\n")},,function(module,exports,__webpack_require__){eval("// extracted by mini-css-extract-plugin//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMTUuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvcXVpbGwvYXNzZXRzL3Nub3cuc3R5bD80NjE5Il0sInNvdXJjZXNDb250ZW50IjpbIi8vIGV4dHJhY3RlZCBieSBtaW5pLWNzcy1leHRyYWN0LXBsdWdpbiJdLCJtYXBwaW5ncyI6IkFBQUEiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///15\n")},function(module,exports,__webpack_require__){eval("// extracted by mini-css-extract-plugin//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMTYuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9zcmMvcHJldmlldy5zdHlsPzFkMTMiXSwic291cmNlc0NvbnRlbnQiOlsiLy8gZXh0cmFjdGVkIGJ5IG1pbmktY3NzLWV4dHJhY3QtcGx1Z2luIl0sIm1hcHBpbmdzIjoiQUFBQSIsInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///16\n")},function(module,exports,__webpack_require__){"use strict";eval("\n\nvar utils = __webpack_require__(0);\nvar bind = __webpack_require__(6);\nvar Axios = __webpack_require__(19);\nvar mergeConfig = __webpack_require__(12);\nvar defaults = __webpack_require__(9);\n\n/**\n * Create an instance of Axios\n *\n * @param {Object} defaultConfig The default config for the instance\n * @return {Axios} A new instance of Axios\n */\nfunction createInstance(defaultConfig) {\n var context = new Axios(defaultConfig);\n var instance = bind(Axios.prototype.request, context);\n\n // Copy axios.prototype to instance\n utils.extend(instance, Axios.prototype, context);\n\n // Copy context to instance\n utils.extend(instance, context);\n\n return instance;\n}\n\n// Create the default instance to be exported\nvar axios = createInstance(defaults);\n\n// Expose Axios class to allow class inheritance\naxios.Axios = Axios;\n\n// Factory for creating new instances\naxios.create = function create(instanceConfig) {\n return createInstance(mergeConfig(axios.defaults, instanceConfig));\n};\n\n// Expose Cancel & CancelToken\naxios.Cancel = __webpack_require__(13);\naxios.CancelToken = __webpack_require__(32);\naxios.isCancel = __webpack_require__(8);\n\n// Expose all/spread\naxios.all = function all(promises) {\n return Promise.all(promises);\n};\naxios.spread = __webpack_require__(33);\n\nmodule.exports = axios;\n\n// Allow use of default import syntax in TypeScript\nmodule.exports.default = axios;\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMTcuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYXhpb3MvbGliL2F4aW9zLmpzP2NlZTQiXSwic291cmNlc0NvbnRlbnQiOlsiJ3VzZSBzdHJpY3QnO1xuXG52YXIgdXRpbHMgPSByZXF1aXJlKCcuL3V0aWxzJyk7XG52YXIgYmluZCA9IHJlcXVpcmUoJy4vaGVscGVycy9iaW5kJyk7XG52YXIgQXhpb3MgPSByZXF1aXJlKCcuL2NvcmUvQXhpb3MnKTtcbnZhciBtZXJnZUNvbmZpZyA9IHJlcXVpcmUoJy4vY29yZS9tZXJnZUNvbmZpZycpO1xudmFyIGRlZmF1bHRzID0gcmVxdWlyZSgnLi9kZWZhdWx0cycpO1xuXG4vKipcbiAqIENyZWF0ZSBhbiBpbnN0YW5jZSBvZiBBeGlvc1xuICpcbiAqIEBwYXJhbSB7T2JqZWN0fSBkZWZhdWx0Q29uZmlnIFRoZSBkZWZhdWx0IGNvbmZpZyBmb3IgdGhlIGluc3RhbmNlXG4gKiBAcmV0dXJuIHtBeGlvc30gQSBuZXcgaW5zdGFuY2Ugb2YgQXhpb3NcbiAqL1xuZnVuY3Rpb24gY3JlYXRlSW5zdGFuY2UoZGVmY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VsJyk7XG5cbi8vIEV4cG9zZSBhbGwvc3ByZWFkXG5heGlvcy5hbGwgPSBmdW5jdGlvbiBhbGwocHJvbWlzZXMpIHtcbiAgcmV0dXJuIFByb21pc2UuYWxsKHByb21pc2VzKTtcbn07XG5heGlvcy5zcHJlYWQgPSByZXF1aXJlKCcuL2hlbHBlcnMvc3ByZWFkJyk7XG5cbm1vZHVsZS5leHBvcnRzID0gYXhpb3M7XG5cbi8vIEFsbG93IHVzZSBvZiBkZWZhdWx0IGltcG9ydCBzeW50YXggaW4gVHlwZVNjcmlwdFxubW9kdWxlLmV4cG9ydHMuZGVmYXVsdCA9IGF4aW9zO1xuIl0sIm1hcHBpbmdzIjoiQUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOyIsInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///17\n")},function(module,exports){eval("/*!\n * Determine if an object is a Buffer\n *\n * @author Feross Aboukhadijeh \n * @license MIT\n */\n\nmodule.exports = function isBuffer (obj) {\n return obj != null && obj.constructor != null &&\n typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj)\n}\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMTguanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYXhpb3Mvbm9kZV9tb2R1bGVzL2lzLWJ1ZmZlci9pbmRleC5qcz9jN2NlIl0sInNvdXJjZXNDb250ZW50IjpbIi8qIVxuICogRGV0ZXJtaW5lIGlmIGFuIG9iamVjdCBpcyBhIEJ1ZmZlclxuICpcbiAqIEBhdXRob3IgICBGZXJvc3MgQWJvdWtoYWRpamVoIDxodHRwczovL2Zlcm9zcy5vcmc+XG4gKiBAbGljZW5zZSAgTUlUXG4gKi9cblxubW9kdWxlLmV4cG9ydHMgPSBmdW5jdGlvbiBpc0J1ZmZlciAob2JqKSB7XG4gIHJldHVybiBvYmogIT0gbnVsbCAmJiBvYmouY29uc3RydWN0b3IgIT0gbnVsbCAmJlxuICAgIHR5cGVvZiBvYmouY29uc3RydWN0b3IuaXNCdWZmZXIgPT09ICdmdW5jdGlvbicgJiYgb2JqLmNvbnN0cnVjdG9yLmlzQnVmZmVyKG9iailcbn1cbiJdLCJtYXBwaW5ncyI6IkFBQUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTsiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///18\n")},function(module,exports,__webpack_require__){"use strict";eval("\n\nvar utils = __webpack_require__(0);\nvar buildURL = __webpack_require__(7);\nvar InterceptorManager = __webpack_require__(20);\nvar dispatchRequest = __webpack_require__(21);\nvar mergeConfig = __webpack_require__(12);\n\n/**\n * Create a new instance of Axios\n *\n * @param {Object} instanceConfig The default config for the instance\n */\nfunction Axios(instanceConfig) {\n this.defaults = instanceConfig;\n this.interceptors = {\n request: new InterceptorManager(),\n response: new InterceptorManager()\n };\n}\n\n/**\n * Dispatch a request\n *\n * @param {Object} config The config specific for this request (merged with this.defaults)\n */\nAxios.prototype.request = function request(config) {\n /*eslint no-param-reassign:0*/\n // Allow for axios('example/url'[, config]) a la fetch API\n if (typeof config === 'string') {\n config = arguments[1] || {};\n config.url = arguments[0];\n } else {\n config = config || {};\n }\n\n config = mergeConfig(this.defaults, config);\n config.method = config.method ? config.method.toLowerCase() : 'get';\n\n // Hook up interceptors middleware\n var chain = [dispatchRequest, undefined];\n var promise = Promise.resolve(config);\n\n this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {\n chain.unshift(interceptor.fulfilled, interceptor.rejected);\n });\n\n this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {\n chain.push(interceptor.fulfilled, interceptor.rejected);\n });\n\n while (chain.length) {\n promise = promise.then(chain.shift(), chain.shift());\n }\n\n return promise;\n};\n\nAxios.prototype.getUri = function getUri(config) {\n config = mergeConfig(this.defaults, config);\n return buildURL(config.url, config.params, config.paramsSerializer).replace(/^\\?/, '');\n};\n\n// Provide aliases for supported request methods\nutils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {\n /*eslint func-names:0*/\n Axios.prototype[method] = function(url, config) {\n return this.request(utils.merge(config || {}, {\n method: method,\n url: url\n }));\n };\n});\n\nutils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {\n /*eslint func-names:0*/\n Axios.prototype[method] = function(url, data, config) {\n return this.request(utils.merge(config || {}, {\n method: method,\n url: url,\n data: data\n }));\n };\n});\n\nmodule.exports = Axios;\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMTkuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYXhpb3MvbGliL2NvcmUvQXhpb3MuanM/MGEwNiJdLCJzb3VyY2VzQ29udGVudCI6WyIndXNlIHN0cmljdCc7XG5cbnZhciB1dGlscyA9IHJlcXVpcmUoJy4vLi4vdXRpbHMnKTtcbnZhciBidWlsZFVSTCA9IHJlcXVpcmUoJy4uL2hlbHBlcnMvYnVpbGRVUkwnKTtcbnZhciBJbnRlcmNlcHRvck1hbmFnZXIgPSByZXF1aXJlKCc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BQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOyIsInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///19\n")},function(module,exports,__webpack_require__){"use strict";eval("\n\nvar utils = __webpack_require__(0);\n\nfunction InterceptorManager() {\n this.handlers = [];\n}\n\n/**\n * Add a new interceptor to the stack\n *\n * @param {Function} fulfilled The function to handle `then` for a `Promise`\n * @param {Function} rejected The function to handle `reject` for a `Promise`\n *\n * @return {Number} An ID used to remove interceptor later\n */\nInterceptorManager.prototype.use = function use(fulfilled, rejected) {\n this.handlers.push({\n fulfilled: fulfilled,\n rejected: rejected\n });\n return this.handlers.length - 1;\n};\n\n/**\n * Remove an interceptor from the stack\n *\n * @param {Number} id The ID that was returned by `use`\n */\nInterceptorManager.prototype.eject = function eject(id) {\n if (this.handlers[id]) {\n this.handlers[id] = null;\n }\n};\n\n/**\n * Iterate over all the registered interceptors\n *\n * This method is particularly useful for skipping over any\n * interceptors that may have become `null` calling `eject`.\n *\n * @param {Function} fn The function to call for each interceptor\n */\nInterceptorManager.prototype.forEach = function forEach(fn) {\n utils.forEach(this.handlers, function forEachHandler(h) {\n if (h !== null) {\n fn(h);\n }\n });\n};\n\nmodule.exports = InterceptorManager;\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMjAuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYXhpb3MvbGliL2NvcmUvSW50ZXJjZXB0b3JNYW5hZ2VyLmpzP2Y2YjQiXSwic291cmNlc0NvbnRlbnQiOlsiJ3VzZSBzdHJpY3QnO1xuXG52YXIgdXRpbHMgPSByZXF1aXJlKCcuLy4uL3V0aWxzJyk7XG5cbmZ1bmN0aW9uIEludGVyY2VwdG9yTWFuYWdlcigpIHtcbiAgdGhpcy5oYW5kbGVycyA9IFtdO1xufVxuXG4vKipcbiAqIEFkZCBhIG5ldyBpbnRlcmNlcHRvciB0byB0aGUgc3RhY2tcbiAqXG4gKiBAcGFyYW0ge0Z1bmN0aW9ufSBmdWxmaWxsZWQgVGhlIGZ1bmN0aW9uIHRvIGhhbmRsZSBgdGhlbmAgZm9yIGEgYFByb21pc2VgXG4gKiBAcGFyYW0ge0Z1bmN0aW9ufSByZWplY3RlZCBUaGUgZnVuY3Rpb24gdG8gaGFuZGxlIGByZWplY3RgIGZvciBhIGBQcm9taXNlYFxuICpcbiAqIEByZXR1cm4ge051bWJlcn0gQW4gSUQgdXNlZCB0byByZW1vdmUgaW50ZXJjZXB0b3IgbGF0ZXJcbiAqL1xuSW50ZXJjZXB0b3JNYW5hZ2VyLnByb3RvdHlwZS51c2UgPSBmdW5jdGlvbiB1c2UoZnVsZmlsbGVkLCByZWplY3RlZCkge1xuICB0aGlzLmhhbmRsZXJzLnB1c2goe1xuICAgIGZ1bGZpbGxlZDogZnVsZmlsbGVkLFxuIC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E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7Iiwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///20\n")},function(module,exports,__webpack_require__){"use strict";eval("\n\nvar utils = __webpack_require__(0);\nvar transformData = __webpack_require__(22);\nvar isCancel = __webpack_require__(8);\nvar defaults = __webpack_require__(9);\nvar isAbsoluteURL = __webpack_require__(30);\nvar combineURLs = __webpack_require__(31);\n\n/**\n * Throws a `Cancel` if cancellation has been requested.\n */\nfunction throwIfCancellationRequested(config) {\n if (config.cancelToken) {\n config.cancelToken.throwIfRequested();\n }\n}\n\n/**\n * Dispatch a request to the server using the configured adapter.\n *\n * @param {object} config The config that is to be used for the request\n * @returns {Promise} The Promise to be fulfilled\n */\nmodule.exports = function dispatchRequest(config) {\n throwIfCancellationRequested(config);\n\n // Support baseURL config\n if (config.baseURL && !isAbsoluteURL(config.url)) {\n config.url = combineURLs(config.baseURL, config.url);\n }\n\n // Ensure headers exist\n config.headers = config.headers || {};\n\n // Transform request data\n config.data = transformData(\n config.data,\n config.headers,\n config.transformRequest\n );\n\n // Flatten headers\n config.headers = utils.merge(\n config.headers.common || {},\n config.headers[config.method] || {},\n config.headers || {}\n );\n\n utils.forEach(\n ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],\n function cleanHeaderConfig(method) {\n delete config.headers[method];\n }\n );\n\n var adapter = config.adapter || defaults.adapter;\n\n return adapter(config).then(function onAdapterResolution(response) {\n throwIfCancellationRequested(config);\n\n // Transform response data\n response.data = transformData(\n response.data,\n response.headers,\n config.transformResponse\n );\n\n return response;\n }, function onAdapterRejection(reason) {\n if (!isCancel(reason)) {\n throwIfCancellationRequested(config);\n\n // Transform response data\n if (reason && reason.response) {\n reason.response.data = transformData(\n reason.response.data,\n reason.response.headers,\n config.transformResponse\n );\n }\n }\n\n return Promise.reject(reason);\n });\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMjEuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYXhpb3MvbGliL2NvcmUvZGlzcGF0Y2hSZXF1ZXN0LmpzPzUyNzAiXSwic291cmNlc0NvbnRlbnQiOlsiJ3VzZSBzdHJpY3QnO1xuXG52YXIgdXRpbHMgPSByZXF1aXJlKCcuLy4uL3V0aWxzJyk7XG52YXIgdHJhbnNmb3JtRGF0YSA9IHJlcXVpcmUoJy4vdHJhbnNmb3JtRGF0YScpO1xudmFyIGlzQ2FuY2VsID0gcmVxdWlyZSgnLi4vY2FuY2VsL2lzQ2FuY2VsJyk7XG52YXIgZGVmYXVsdHMgPSByZXF1aXJlKCcuLi9kZWZhdWx0cycpO1xudmFyIGlzQWJzb2x1dGVVUkwgPSByZXF1aXJlKCcuLy4uL2hlbHBlcnMvaXNBYnNvbHV0ZVVSTCcpO1xudmFyIGNvbWJpbmVVUkxzID0gcmVxdWlyZSgnLi8uLi9oZWxwZXJzL2NvbWJpbmVVUkxzJyk7XG5cbi8qKlxuICogVGhyb3dzIGEgYENhbmNlbGAgaWYgY2FuY2VsbGF0aW9uIGhhcyBiZWVuIHJlcXVlc3RlZC5cbiAqL1xuZnVuY3Rpb24gdGhyb3dJZkNhbmNlbGxhdGlvblJlcXVlc3RlZChjb25maWcpIHtcbiAgaWYgK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uLnJlc3BvbnNlLmRhdGEgPSB0cmFuc2Zvcm1EYXRhKFxuICAgICAgICAgIHJlYXNvbi5yZXNwb25zZS5kYXRhLFxuICAgICAgICAgIHJlYXNvbi5yZXNwb25zZS5oZWFkZXJzLFxuICAgICAgICAgIGNvbmZpZy50cmFuc2Zvcm1SZXNwb25zZVxuICAgICAgICApO1xuICAgICAgfVxuICAgIH1cblxuICAgIHJldHVybiBQcm9taXNlLnJlamVjdChyZWFzb24pO1xuICB9KTtcbn07XG4iXSwibWFwcGluZ3MiOiJBQUFBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7Iiwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///21\n")},function(module,exports,__webpack_require__){"use strict";eval("\n\nvar utils = __webpack_require__(0);\n\n/**\n * Transform the data for a request or a response\n *\n * @param {Object|String} data The data to be transformed\n * @param {Array} headers The headers for the request or response\n * @param {Array|Function} fns A single function or Array of functions\n * @returns {*} The resulting transformed data\n */\nmodule.exports = function transformData(data, headers, fns) {\n /*eslint no-param-reassign:0*/\n utils.forEach(fns, function transform(fn) {\n data = fn(data, headers);\n });\n\n return data;\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMjIuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYXhpb3MvbGliL2NvcmUvdHJhbnNmb3JtRGF0YS5qcz9jNDAxIl0sInNvdXJjZXNDb250ZW50IjpbIid1c2Ugc3RyaWN0JztcblxudmFyIHV0aWxzID0gcmVxdWlyZSgnLi8uLi91dGlscycpO1xuXG4vKipcbiAqIFRyYW5zZm9ybSB0aGUgZGF0YSBmb3IgYSByZXF1ZXN0IG9yIGEgcmVzcG9uc2VcbiAqXG4gKiBAcGFyYW0ge09iamVjdHxTdHJpbmd9IGRhdGEgVGhlIGRhdGEgdG8gYmUgdHJhbnNmb3JtZWRcbiAqIEBwYXJhbSB7QXJyYXl9IGhlYWRlcnMgVGhlIGhlYWRlcnMgZm9yIHRoZSByZXF1ZXN0IG9yIHJlc3BvbnNlXG4gKiBAcGFyYW0ge0FycmF5fEZ1bmN0aW9ufSBmbnMgQSBzaW5nbGUgZnVuY3Rpb24gb3IgQXJyYXkgb2YgZnVuY3Rpb25zXG4gKiBAcmV0dXJucyB7Kn0gVGhlIHJlc3VsdGluZyB0cmFuc2Zvcm1lZCBkYXRhXG4gKi9cbm1vZHVsZS5leHBvcnRzID0gZnVuY3Rpb24gdHJhbnNmb3JtRGF0YShkYXRhLCBoZWFkZXJzLCBmbnMpIHtcbiAgLyplc2xpbnQgbm8tcGFyYW0tcmVhc3NpZ246MCovXG4gIHV0aWxzLmZvckVhY2goZm5zLCBmdW5jdGlvbiB0cmFuc2Zvcm0oZm4pIHtcbiAgICBkYXRhID0gZm4oZGF0YSwgaGVhZGVycyk7XG4gIH0pO1xuXG4gIHJldHVybiBkYXRhO1xufTtcbiJdLCJtYXBwaW5ncyI6IkFBQUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTsiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///22\n")},function(module,exports){eval("// shim for using process in browser\nvar process = module.exports = {};\n\n// cached from whatever global is present so that test runners that stub it\n// don't break things. But we need to wrap it in a try catch in case it is\n// wrapped in strict mode code which doesn't define any globals. It's inside a\n// function because try/catches deoptimize in certain engines.\n\nvar cachedSetTimeout;\nvar cachedClearTimeout;\n\nfunction defaultSetTimout() {\n throw new Error('setTimeout has not been defined');\n}\nfunction defaultClearTimeout () {\n throw new Error('clearTimeout has not been defined');\n}\n(function () {\n try {\n if (typeof setTimeout === 'function') {\n cachedSetTimeout = setTimeout;\n } else {\n cachedSetTimeout = defaultSetTimout;\n }\n } catch (e) {\n cachedSetTimeout = defaultSetTimout;\n }\n try {\n if (typeof clearTimeout === 'function') {\n cachedClearTimeout = clearTimeout;\n } else {\n cachedClearTimeout = defaultClearTimeout;\n }\n } catch (e) {\n cachedClearTimeout = defaultClearTimeout;\n }\n} ())\nfunction runTimeout(fun) {\n if (cachedSetTimeout === setTimeout) {\n //normal enviroments in sane situations\n return setTimeout(fun, 0);\n }\n // if setTimeout wasn't available but was latter defined\n if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {\n cachedSetTimeout = setTimeout;\n return setTimeout(fun, 0);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedSetTimeout(fun, 0);\n } catch(e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedSetTimeout.call(null, fun, 0);\n } catch(e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error\n return cachedSetTimeout.call(this, fun, 0);\n }\n }\n\n\n}\nfunction runClearTimeout(marker) {\n if (cachedClearTimeout === clearTimeout) {\n //normal enviroments in sane situations\n return clearTimeout(marker);\n }\n // if clearTimeout wasn't available but was latter defined\n if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {\n cachedClearTimeout = clearTimeout;\n return clearTimeout(marker);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedClearTimeout(marker);\n } catch (e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedClearTimeout.call(null, marker);\n } catch (e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.\n // Some versions of I.E. have different rules for clearTimeout vs setTimeout\n return cachedClearTimeout.call(this, marker);\n }\n }\n\n\n\n}\nvar queue = [];\nvar draining = false;\nvar currentQueue;\nvar queueIndex = -1;\n\nfunction cleanUpNextTick() {\n if (!draining || !currentQueue) {\n return;\n }\n draining = false;\n if (currentQueue.length) {\n queue = currentQueue.concat(queue);\n } else {\n queueIndex = -1;\n }\n if (queue.length) {\n drainQueue();\n }\n}\n\nfunction drainQueue() {\n if (draining) {\n return;\n }\n var timeout = runTimeout(cleanUpNextTick);\n draining = true;\n\n var len = queue.length;\n while(len) {\n currentQueue = queue;\n queue = [];\n while (++queueIndex < len) {\n if (currentQueue) {\n currentQueue[queueIndex].run();\n }\n }\n queueIndex = -1;\n len = queue.length;\n }\n currentQueue = null;\n draining = false;\n runClearTimeout(timeout);\n}\n\nprocess.nextTick = function (fun) {\n var args = new Array(arguments.length - 1);\n if (arguments.length > 1) {\n for (var i = 1; i < arguments.length; i++) {\n args[i - 1] = arguments[i];\n }\n }\n queue.push(new Item(fun, args));\n if (queue.length === 1 && !draining) {\n runTimeout(drainQueue);\n }\n};\n\n// v8 likes predictible objects\nfunction Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}\nItem.prototype.run = function () {\n this.fun.apply(null, this.array);\n};\nprocess.title = 'browser';\nprocess.browser = true;\nprocess.env = {};\nprocess.argv = [];\nprocess.version = ''; // empty string to avoid regexp issues\nprocess.versions = {};\n\nfunction noop() {}\n\nprocess.on = noop;\nprocess.addListener = noop;\nprocess.once = noop;\nprocess.off = noop;\nprocess.removeListener = noop;\nprocess.removeAllListeners = noop;\nprocess.emit = noop;\nprocess.prependListener = noop;\nprocess.prependOnceListener = noop;\n\nprocess.listeners = function (name) { return [] }\n\nprocess.binding = function (name) {\n throw new Error('process.binding is not supported');\n};\n\nprocess.cwd = function () { return '/' };\nprocess.chdir = function (dir) {\n throw new Error('process.chdir is not supported');\n};\nprocess.umask = function() { return 0; };\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMjMuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvcHJvY2Vzcy9icm93c2VyLmpzP2YyOGMiXSwic291cmNlc0NvbnRlbnQiOlsiLy8gc2hpbSBmb3IgdXNpbmcgcHJvY2VzcyBpbiBicm93c2VyXG52YXIgcHJvY2VzcyA9IG1vZHVsZS5leHBvcnRzID0ge307XG5cbi8vIGNhY2hlZCBmcm9tIHdoYXRldmVyIGdsb2JhbCBpcyBwcmVzZW50IHNvIHRoYXQgdGVzdCBydW5uZXJzIHRoYXQgc3R1YiBpdFxuLy8gZG9uJ3QgYnJlYWsgdGhpbmdzLiAgQnV0IHdlIG5lZWQgdG8gd3JhcCBpdCBpbiBhIHRyeSBjYXRjaCBpbiBjYXNlIGl0IGlzXG4vLyB3cmFwcGVkIGluIHN0cmljdCBtb2RlIGNvZGUgd2hpY2ggZG9lc24ndCBkZWZpbmUgYW55IGdsb2JhbHMuICBJdCdzIGluc2lkZSBhXG4vLyBmdW5jdGlvbiBiZWNhdXNlIHRyeS9jYXRjaGVzIGRlb3B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7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7Iiwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///23\n")},function(module,exports,__webpack_require__){"use strict";eval("\n\nvar utils = __webpack_require__(0);\n\nmodule.exports = function normalizeHeaderName(headers, normalizedName) {\n utils.forEach(headers, function processHeader(value, name) {\n if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) {\n headers[normalizedName] = value;\n delete headers[name];\n }\n });\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMjQuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYXhpb3MvbGliL2hlbHBlcnMvbm9ybWFsaXplSGVhZGVyTmFtZS5qcz9jOGFmIl0sInNvdXJjZXNDb250ZW50IjpbIid1c2Ugc3RyaWN0JztcblxudmFyIHV0aWxzID0gcmVxdWlyZSgnLi4vdXRpbHMnKTtcblxubW9kdWxlLmV4cG9ydHMgPSBmdW5jdGlvbiBub3JtYWxpemVIZWFkZXJOYW1lKGhlYWRlcnMsIG5vcm1hbGl6ZWROYW1lKSB7XG4gIHV0aWxzLmZvckVhY2goaGVhZGVycywgZnVuY3Rpb24gcHJvY2Vzc0hlYWRlcih2YWx1ZSwgbmFtZSkge1xuICAgIGlmIChuYW1lICE9PSBub3JtYWxpemVkTmFtZSAmJiBuYW1lLnRvVXBwZXJDYXNlKCkgPT09IG5vcm1hbGl6ZWROYW1lLnRvVXBwZXJDYXNlKCkpIHtcbiAgICAgIGhlYWRlcnNbbm9ybWFsaXplZE5hbWVdID0gdmFsdWU7XG4gICAgICBkZWxldGUgaGVhZGVyc1tuYW1lXTtcbiAgICB9XG4gIH0pO1xufTtcbiJdLCJtYXBwaW5ncyI6IkFBQUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOyIsInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///24\n")},function(module,exports,__webpack_require__){"use strict";eval("\n\nvar createError = __webpack_require__(11);\n\n/**\n * Resolve or reject a Promise based on response status.\n *\n * @param {Function} resolve A function that resolves the promise.\n * @param {Function} reject A function that rejects the promise.\n * @param {object} response The response.\n */\nmodule.exports = function settle(resolve, reject, response) {\n var validateStatus = response.config.validateStatus;\n if (!validateStatus || validateStatus(response.status)) {\n resolve(response);\n } else {\n reject(createError(\n 'Request failed with status code ' + response.status,\n response.config,\n null,\n response.request,\n response\n ));\n }\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data: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nJlcXVlc3QsXG4gICAgICByZXNwb25zZVxuICAgICkpO1xuICB9XG59O1xuIl0sIm1hcHBpbmdzIjoiQUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTsiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///25\n")},function(module,exports,__webpack_require__){"use strict";eval("\n\n/**\n * Update an Error with the specified config, error code, and response.\n *\n * @param {Error} error The error to update.\n * @param {Object} config The config.\n * @param {string} [code] The error code (for example, 'ECONNABORTED').\n * @param {Object} [request] The request.\n * @param {Object} [response] The response.\n * @returns {Error} The error.\n */\nmodule.exports = function enhanceError(error, config, code, request, response) {\n error.config = config;\n if (code) {\n error.code = code;\n }\n\n error.request = request;\n error.response = response;\n error.isAxiosError = true;\n\n error.toJSON = function() {\n return {\n // Standard\n message: this.message,\n name: this.name,\n // Microsoft\n description: this.description,\n number: this.number,\n // Mozilla\n fileName: this.fileName,\n lineNumber: this.lineNumber,\n columnNumber: this.columnNumber,\n stack: this.stack,\n // Axios\n config: this.config,\n code: this.code\n };\n };\n return error;\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMjYuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYXhpb3MvbGliL2NvcmUvZW5oYW5jZUVycm9yLmpzPzM4N2YiXSwic291cmNlc0NvbnRlbnQiOlsiJ3VzZSBzdHJpY3QnO1xuXG4vKipcbiAqIFVwZGF0ZSBhbiBFcnJvciB3aXRoIHRoZSBzcGVjaWZpZWQgY29uZmlnLCBlcnJvciBjb2RlLCBhbmQgcmVzcG9uc2UuXG4gKlxuIC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GNvbHVtbk51bWJlcjogdGhpcy5jb2x1bW5OdW1iZXIsXG4gICAgICBzdGFjazogdGhpcy5zdGFjayxcbiAgICAgIC8vIEF4aW9zXG4gICAgICBjb25maWc6IHRoaXMuY29uZmlnLFxuICAgICAgY29kZTogdGhpcy5jb2RlXG4gICAgfTtcbiAgfTtcbiAgcmV0dXJuIGVycm9yO1xufTtcbiJdLCJtYXBwaW5ncyI6IkFBQUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOyIsInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///26\n")},function(module,exports,__webpack_require__){"use strict";eval("\n\nvar utils = __webpack_require__(0);\n\n// Headers whose duplicates are ignored by node\n// c.f. https://nodejs.org/api/http.html#http_message_headers\nvar ignoreDuplicateOf = [\n 'age', 'authorization', 'content-length', 'content-type', 'etag',\n 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',\n 'last-modified', 'location', 'max-forwards', 'proxy-authorization',\n 'referer', 'retry-after', 'user-agent'\n];\n\n/**\n * Parse headers into an object\n *\n * ```\n * Date: Wed, 27 Aug 2014 08:58:49 GMT\n * Content-Type: application/json\n * Connection: keep-alive\n * Transfer-Encoding: chunked\n * ```\n *\n * @param {String} headers Headers needing to be parsed\n * @returns {Object} Headers parsed into an object\n */\nmodule.exports = function parseHeaders(headers) {\n var parsed = {};\n var key;\n var val;\n var i;\n\n if (!headers) { return parsed; }\n\n utils.forEach(headers.split('\\n'), function parser(line) {\n i = line.indexOf(':');\n key = utils.trim(line.substr(0, i)).toLowerCase();\n val = utils.trim(line.substr(i + 1));\n\n if (key) {\n if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) {\n return;\n }\n if (key === 'set-cookie') {\n parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]);\n } else {\n parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;\n }\n }\n });\n\n return parsed;\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMjcuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYXhpb3MvbGliL2hlbHBlcnMvcGFyc2VIZWFkZXJzLmpzP2MzNDUiXSwic291cmNlc0NvbnRlbnQiOlsiJ3VzZSBzdHJpY3QnO1xuXG52YXIgdXRpbHMgPSByZXF1aXJlKCcuLy4uL3V0aWxzJyk7XG5cbi8vIEhlYWRlcnMgd2hvc2UgZHVwbGljYXRlcyBhcmUgaWdub3JlZCBieSBub2RlXG4vLyBjLmYuIGh0dHBzOi8vbm9kZWpzLm9yZy9hcGkvaHR0cC5odG1sI2h0dHBfbWVzc2FnZV9oZWFkZXJzXG52YXIgaWdub3JlRHVwbGljYXRlT2YgPSBbXG4gICdhZ2UnLCAnYXV0aG9yaXphdGlvbicsICdjb250ZW50LWxlbmd0aCcsICdjb250ZW50LXR5cGUnLCAnZXRhZycsXG4gICdleHBpcmVzJywgJ2Zyb20nLCAnaG9zdCcsICdpZi1tb2RpZmllZC1zaW5jZScsICdpZi11bm1vZGlmaWVkLXNpbmNlJyxcbiAgJ2xhc3QtbW9kaWZpZWQnLCAnbG9jYXRpb24nLCAnbWF4LWZvcndhcmRzJywgJ3Byb3h5LWF1dGhvcml6YXRpb24nLFxuICAncmVmZXJlcicsICdyZXRyeS1hZnRlcicsICd1c2VyLWFnZW50J1xuXTtcblxuLyoqXG4gKiBQYXJzZSBoZWFkZXJzIGludG8g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tcbiAgICAgIH0gZWxzZSB7XG4gICAgICAgIHBhcnNlZFtrZXldID0gcGFyc2VkW2tleV0gPyBwYXJzZWRba2V5XSArICcsICcgKyB2YWwgOiB2YWw7XG4gICAgICB9XG4gICAgfVxuICB9KTtcblxuICByZXR1cm4gcGFyc2VkO1xufTtcbiJdLCJtYXBwaW5ncyI6IkFBQUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTsiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///27\n")},function(module,exports,__webpack_require__){"use strict";eval("\n\nvar utils = __webpack_require__(0);\n\nmodule.exports = (\n utils.isStandardBrowserEnv() ?\n\n // Standard browser envs have full support of the APIs needed to test\n // whether the request URL is of the same origin as current location.\n (function standardBrowserEnv() {\n var msie = /(msie|trident)/i.test(navigator.userAgent);\n var urlParsingNode = document.createElement('a');\n var originURL;\n\n /**\n * Parse a URL to discover it's components\n *\n * @param {String} url The URL to be parsed\n * @returns {Object}\n */\n function resolveURL(url) {\n var href = url;\n\n if (msie) {\n // IE needs attribute set twice to normalize properties\n urlParsingNode.setAttribute('href', href);\n href = urlParsingNode.href;\n }\n\n urlParsingNode.setAttribute('href', href);\n\n // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils\n return {\n href: urlParsingNode.href,\n protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',\n host: urlParsingNode.host,\n search: urlParsingNode.search ? urlParsingNode.search.replace(/^\\?/, '') : '',\n hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',\n hostname: urlParsingNode.hostname,\n port: urlParsingNode.port,\n pathname: (urlParsingNode.pathname.charAt(0) === '/') ?\n urlParsingNode.pathname :\n '/' + urlParsingNode.pathname\n };\n }\n\n originURL = resolveURL(window.location.href);\n\n /**\n * Determine if a URL shares the same origin as the current location\n *\n * @param {String} requestURL The URL to test\n * @returns {boolean} True if URL shares the same origin, otherwise false\n */\n return function isURLSameOrigin(requestURL) {\n var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;\n return (parsed.protocol === originURL.protocol &&\n parsed.host === originURL.host);\n };\n })() :\n\n // Non standard browser envs (web workers, react-native) lack needed support.\n (function nonStandardBrowserEnv() {\n return function isURLSameOrigin() {\n return true;\n };\n })()\n);\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMjguanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYXhpb3MvbGliL2hlbHBlcnMvaXNVUkxTYW1lT3JpZ2luLmpzPzM5MzQiXSwic291cmNlc0NvbnRlbnQiOlsiJ3VzZSBzdHJpY3QnO1xuXG52YXIgdXRpbHMgPSByZXF1aXJlKCcuLy4uL3V0aWxzJyk7XG5cbm1vZHVsZS5leHBvcnRzID0gKFxuICB1dGlscy5pc1N0YW5kYXJkQnJvd3NlckVudigpID9cblxuICAvLyBTdGFuZGFyZCBicm93c2VyIGVudnMgaGF2ZSBmdWxsIHN1cHBvcnQgb2YgdGhlIEFQSXMgbmVlZGVkIHRvIHRlc3RcbiAgLy8gd2hldGhlciB0aGUgcmVxdWVzdCBVUkwgaXMgb2YgdGhlIHNhbWUgb3JpZ2luIGFzIGN1cnJlbnQgbG9jYXRp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QUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTsiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///28\n")},function(module,exports,__webpack_require__){"use strict";eval("\n\nvar utils = __webpack_require__(0);\n\nmodule.exports = (\n utils.isStandardBrowserEnv() ?\n\n // Standard browser envs support document.cookie\n (function standardBrowserEnv() {\n return {\n write: function write(name, value, expires, path, domain, secure) {\n var cookie = [];\n cookie.push(name + '=' + encodeURIComponent(value));\n\n if (utils.isNumber(expires)) {\n cookie.push('expires=' + new Date(expires).toGMTString());\n }\n\n if (utils.isString(path)) {\n cookie.push('path=' + path);\n }\n\n if (utils.isString(domain)) {\n cookie.push('domain=' + domain);\n }\n\n if (secure === true) {\n cookie.push('secure');\n }\n\n document.cookie = cookie.join('; ');\n },\n\n read: function read(name) {\n var match = document.cookie.match(new RegExp('(^|;\\\\s*)(' + name + ')=([^;]*)'));\n return (match ? decodeURIComponent(match[3]) : null);\n },\n\n remove: function remove(name) {\n this.write(name, '', Date.now() - 86400000);\n }\n };\n })() :\n\n // Non standard browser env (web workers, react-native) lack needed support.\n (function nonStandardBrowserEnv() {\n return {\n write: function write() {},\n read: function read() { return null; },\n remove: function remove() {}\n };\n })()\n);\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMjkuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYXhpb3MvbGliL2hlbHBlcnMvY29va2llcy5qcz83YWFjIl0sInNvdXJjZXNDb250ZW50IjpbIid1c2Ugc3RyaWN0JztcblxudmFyIHV0aWxzID0gcmVxdWlyZSgnLi8uLi91dGlscycpO1xuXG5tb2R1bGUuZXhwb3J0cyA9IChcbiAgdXRpbHMuaXNTdGFuZGFyZEJyb3dzZXJFbnYoKSA/XG5cbiAgLy8gU3RhbmRhcmQgYnJvd3NlciBlbnZzIHN1cHBvcnQgZG9jdW1lbnQuY29va2llXG4gICAgKGZ1bmN0aW9uIHN0YW5kYXJkQnJvd3NlckVudigpIHtcbiAgICAgIHJldHVybiB7XG4gICAgICAgIHdyaXRlOiBmdW5jdGlvbiB3cml0ZShuYW1lLCB2YWx1ZSwgZXhwaXJlcywgcGF0aCwgZG9tYWluLCBzZWN1cmUpIHtcbiAgICAgICAgICB2YXIgY29va2llID0gW107XG4gICAgICAgICAgY29va2llLnB1c2gobmFtZSArICc9JyArIGVuY29kZVVSSUNvbXBvbmVudCh2YWx1ZSkpO1xuXG4gICAgICAgICAgaWYgKHV0aWxzLmlzTnVtYmVyKGV4cGlyZXMpKSB7XG4gICAgICAgICAgICBjb29raWUucHVzaCgnZXhwaXJlcz0nICsgbmV3IERhdGUoZXhwaXJlcykudG9HTVRTdHJpbmcoKSk7XG4gICAgICAgICAgfVxuXG4gICAgICAgICAgaWYgKHV0aWxzLmlzU3RyaW5nKHBhdGgpKSB7XG4gICAgICAgICAgICBjb29raWUucHVzaCgncGF0aD0nICsgcGF0aCk7XG4gICAgICAgICAgfVxuXG4gICAgICAgICAgaWYgKHV0aWxzLmlzU3RyaW5nKGRvbWFpbikpIHtcbiAgICAgICAgICAgIGNvb2tpZS5wdXNoKCdkb21haW49JyArIGRvbWFpbik7XG4gICAgICAgICAgfVxuXG4gICAgICAgICAgaWYgKHNlY3VyZSA9PT0gdHJ1ZSkge1xuICAgICAgICAgICAgY29va2llLnB1c2goJ3NlY3VyZScpO1xuICAgICAgICAgIH1cblxuICAgICAgICAgIGRvY3VtZW50LmNvb2tpZSA9IGNvb2tpZS5qb2luKCc7ICcpO1xuICAgICAgICB9LFxuXG4gICAgICAgIHJlYWQ6IGZ1bmN0aW9uIHJlYWQobmFtZSkge1xuICAgICAgICAgIHZhciBtYXRjaCA9IGRvY3VtZW50LmNvb2tpZS5tYXRjaChuZXcgUmVnRXhwKCcoXnw7XFxcXHMqKSgnICsgbmFtZSArICcpPShbXjtdKiknKSk7XG4gICAgICAgICAg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webpack-internal:///29\n")},function(module,exports,__webpack_require__){"use strict";eval('\n\n/**\n * Determines whether the specified URL is absolute\n *\n * @param {string} url The URL to test\n * @returns {boolean} True if the specified URL is absolute, otherwise false\n */\nmodule.exports = function isAbsoluteURL(url) {\n // A URL is considered absolute if it begins with "://" or "//" (protocol-relative URL).\n // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed\n // by any combination of letters, digits, plus, period, or hyphen.\n return /^([a-z][a-z\\d\\+\\-\\.]*:)?\\/\\//i.test(url);\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMzAuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYXhpb3MvbGliL2hlbHBlcnMvaXNBYnNvbHV0ZVVSTC5qcz9kOTI1Il0sInNvdXJjZXNDb250ZW50IjpbIid1c2Ugc3RyaWN0JztcblxuLyoqXG4gKiBEZXRlcm1pbmVzIHdoZXRoZXIgdGhlIHNwZWNpZmllZCBVUkwgaXMgYWJzb2x1dGVcbiAqXG4gKiBAcGFyYW0ge3N0cmluZ30gdXJsIFRoZSBVUkwgdG8gdGVzdFxuICogQHJldHVybnMge2Jvb2xlYW59IFRydWUgaWYgdGhlIHNwZWNpZmllZCBVUkwgaXMgYWJzb2x1dGUsIG90aGVyd2lzZSBmYWxzZVxuICovXG5tb2R1bGUuZXhwb3J0cyA9IGZ1bmN0aW9uIGlzQWJzb2x1dGVVUkwodXJsKSB7XG4gIC8vIEEgVVJMIGlzIGNvbnNpZGVyZWQgYWJzb2x1dGUgaWYgaXQgYmVnaW5zIHdpdGggXCI8c2NoZW1lPjovL1wiIG9yIFwiLy9cIiAocHJvdG9jb2wtcmVsYXRpdmUgVVJMKS5cbiAgLy8gUkZDIDM5ODYgZGVmaW5lcyBzY2hlbWUgbmFtZSBhcyBhIHNlcXVlbmNlIG9mIGNoYXJhY3RlcnMgYmVnaW5uaW5nIHdpdGggYSBsZXR0ZXIgYW5kIGZvbGxvd2VkXG4gIC8vIGJ5IGFueSBjb21iaW5hdGlvbiBvZiBsZXR0ZXJzLCBkaWdpdHMsIHBsdXMsIHBlcmlvZCwgb3IgaHlwaGVuLlxuICByZXR1cm4gL14oW2Etel1bYS16XFxkXFwrXFwtXFwuXSo6KT9cXC9cXC8vaS50ZXN0KHVybCk7XG59O1xuIl0sIm1hcHBpbmdzIjoiQUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOyIsInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///30\n')},function(module,exports,__webpack_require__){"use strict";eval("\n\n/**\n * Creates a new URL by combining the specified URLs\n *\n * @param {string} baseURL The base URL\n * @param {string} relativeURL The relative URL\n * @returns {string} The combined URL\n */\nmodule.exports = function combineURLs(baseURL, relativeURL) {\n return relativeURL\n ? baseURL.replace(/\\/+$/, '') + '/' + relativeURL.replace(/^\\/+/, '')\n : baseURL;\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMzEuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYXhpb3MvbGliL2hlbHBlcnMvY29tYmluZVVSTHMuanM/ZTY4MyJdLCJzb3VyY2VzQ29udGVudCI6WyIndXNlIHN0cmljdCc7XG5cbi8qKlxuICogQ3JlYXRlcyBhIG5ldyBVUkwgYnkgY29tYmluaW5nIHRoZSBzcGVjaWZpZWQgVVJMc1xuICpcbiAqIEBwYXJhbSB7c3RyaW5nfSBiYXNlVVJMIFRoZSBiYXNlIFVSTFxuICogQHBhcmFtIHtzdHJpbmd9IHJlbGF0aXZlVVJMIFRoZSByZWxhdGl2ZSBVUkxcbiAqIEByZXR1cm5zIHtzdHJpbmd9IFRoZSBjb21iaW5lZCBVUkxcbiAqL1xubW9kdWxlLmV4cG9ydHMgPSBmdW5jdGlvbiBjb21iaW5lVVJMcyhiYXNlVVJMLCByZWxhdGl2ZVVSTCkge1xuICByZXR1cm4gcmVsYXRpdmVVUkxcbiAgICA/IGJhc2VVUkwucmVwbGFjZSgvXFwvKyQvLCAnJykgKyAnLycgKyByZWxhdGl2ZVVSTC5yZXBsYWNlKC9eXFwvKy8sICcnKVxuICAgIDogYmFzZVVSTDtcbn07XG4iXSwibWFwcGluZ3MiOiJBQUFBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7Iiwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///31\n")},function(module,exports,__webpack_require__){"use strict";eval("\n\nvar Cancel = __webpack_require__(13);\n\n/**\n * A `CancelToken` is an object that can be used to request cancellation of an operation.\n *\n * @class\n * @param {Function} executor The executor function.\n */\nfunction CancelToken(executor) {\n if (typeof executor !== 'function') {\n throw new TypeError('executor must be a function.');\n }\n\n var resolvePromise;\n this.promise = new Promise(function promiseExecutor(resolve) {\n resolvePromise = resolve;\n });\n\n var token = this;\n executor(function cancel(message) {\n if (token.reason) {\n // Cancellation has already been requested\n return;\n }\n\n token.reason = new Cancel(message);\n resolvePromise(token.reason);\n });\n}\n\n/**\n * Throws a `Cancel` if cancellation has been requested.\n */\nCancelToken.prototype.throwIfRequested = function throwIfRequested() {\n if (this.reason) {\n throw this.reason;\n }\n};\n\n/**\n * Returns an object that contains a new `CancelToken` and a function that, when called,\n * cancels the `CancelToken`.\n */\nCancelToken.source = function source() {\n var cancel;\n var token = new CancelToken(function executor(c) {\n cancel = c;\n });\n return {\n token: token,\n cancel: cancel\n };\n};\n\nmodule.exports = CancelToken;\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoi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0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTsiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///32\n")},function(module,exports,__webpack_require__){"use strict";eval("\n\n/**\n * Syntactic sugar for invoking a function and expanding an array for arguments.\n *\n * Common use case would be to use `Function.prototype.apply`.\n *\n * ```js\n * function f(x, y, z) {}\n * var args = [1, 2, 3];\n * f.apply(null, args);\n * ```\n *\n * With `spread` this example can be re-written.\n *\n * ```js\n * spread(function(x, y, z) {})([1, 2, 3]);\n * ```\n *\n * @param {Function} callback\n * @returns {Function}\n */\nmodule.exports = function spread(callback) {\n return function wrap(arr) {\n return callback.apply(null, arr);\n };\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMzMuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYXhpb3MvbGliL2hlbHBlcnMvc3ByZWFkLmpzPzBkZjYiXSwic291cmNlc0NvbnRlbnQiOlsiJ3VzZSBzdHJpY3QnO1xuXG4vKipcbiAqIFN5bnRhY3RpYyBzdWdhciBmb3IgaW52b2tpbmcgYSBmdW5jdGlvbiBhbmQgZXhwYW5kaW5nIGFuIGFycmF5IGZvciBhcmd1bWVudHMuXG4gKlxuICogQ29tbW9uIHVzZSBjYXNlIHdvdWxkIGJlIHRvIHVzZSBgRnVuY3Rpb24ucHJvdG90eXBlLmFwcGx5YC5cbiAqXG4gKiAgYGBganNcbiAqICBmdW5jdGlvbiBmKHgsIHksIHopIHt9XG4gKiAgdmFyIGFyZ3MgPSBbMSwgMiwgM107XG4gKiAgZi5hcHBseShudWxsLCBhcmdzKTtcbiAqICBgYGBcbiAqXG4gKiBXaXRoIGBzcHJlYWRgIHRoaXMgZXhhbXBsZSBjYW4gYmUgcmUtd3JpdHRlbi5cbiAqXG4gKiAgYGBganNcbiAqICBzcHJlYWQoZnVuY3Rpb24oeCwgeSwgeikge30pKFsxLCAyLCAzXSk7XG4gKiAgYGBgXG4gKlxuICogQHBhcmFtIHtGdW5jdGlvbn0gY2FsbGJhY2tcbiAqIEByZXR1cm5zIHtGdW5jdGlvbn1cbiAqL1xubW9kdWxlLmV4cG9ydHMgPSBmdW5jdGlvbiBzcHJlYWQoY2FsbGJhY2spIHtcbiAgcmV0dXJuIGZ1bmN0aW9uIHdyYXAoYXJyKSB7XG4gICAgcmV0dXJuIGNhbGxiYWNrLmFwcGx5KG51bGwsIGFycik7XG4gIH07XG59O1xuIl0sIm1hcHBpbmdzIjoiQUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7Iiwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///33\n")},,,,,,,function(module,__webpack_exports__,__webpack_require__){"use strict";eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var quill_assets_snow_styl__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(15);\n/* harmony import */ var quill_assets_snow_styl__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(quill_assets_snow_styl__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _preview_styl__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(16);\n/* harmony import */ var _preview_styl__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_preview_styl__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _caller__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(1);\n/* harmony import */ var _common__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(4);\n\r\n\r\n\r\n\r\nvar docSize = { width: 0, height: 0 };\r\nfunction setDocSize() {\r\n var width = document.body.offsetWidth;\r\n var height = document.body.offsetHeight;\r\n if (docSize.width !== width || docSize.height !== height) {\r\n docSize.width = width;\r\n docSize.height = height;\r\n if (window.innerWidth && window.innerHeight) {\r\n Object(_caller__WEBPACK_IMPORTED_MODULE_2__[/* callMethod */ \"a\"])('setDocSize', docSize);\r\n }\r\n }\r\n}\r\nwindow.addEventListener('resize', function () {\r\n Object(_common__WEBPACK_IMPORTED_MODULE_3__[/* fixSize */ \"b\"])();\r\n setDocSize();\r\n});\r\nvar onReady = function () {\r\n Object(_common__WEBPACK_IMPORTED_MODULE_3__[/* fixSize */ \"b\"])();\r\n setDocSize();\r\n var view = Object(_common__WEBPACK_IMPORTED_MODULE_3__[/* getViewElement */ \"d\"])();\r\n if (!view) {\r\n return;\r\n }\r\n var images = [];\r\n view.querySelectorAll('img').forEach(function (img, index) {\r\n images.push({\r\n src: img.src,\r\n width: Number(img.dataset.width) || 0,\r\n height: Number(img.dataset.height) || 0,\r\n });\r\n img.addEventListener('click', function () {\r\n Object(_caller__WEBPACK_IMPORTED_MODULE_2__[/* callMethod */ \"a\"])('clickImage', { src: img.src, arr: images, index: index });\r\n });\r\n });\r\n view.querySelectorAll('a').forEach(function (a) {\r\n a.addEventListener('click', function (e) {\r\n if (!/^https?:\\/\\//.test(a.href)) {\r\n e.preventDefault();\r\n }\r\n });\r\n });\r\n Object(_caller__WEBPACK_IMPORTED_MODULE_2__[/* callMethod */ \"a\"])('docReady', {\r\n docWidth: docSize.width,\r\n docHeight: docSize.height,\r\n });\r\n};\r\nif (document.readyState === 'loading') {\r\n document.addEventListener('DOMContentLoaded', onReady);\r\n}\r\nelse {\r\n onReady();\r\n}\r\n//# sourceURL=[module]\n//# sourceMappingUR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4gIGRvY3VtZW50LmFkZEV2ZW50TGlzdGVuZXIoJ0RPTUNvbnRlbnRMb2FkZWQnLCBvblJlYWR5KVxufSBlbHNlIHtcbiAgb25SZWFkeSgpXG59XG4iXSwibWFwcGluZ3MiOiJBQUFBO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFDQTtBQUNBO0FBQ0E7QUFPQTtBQUVBO0FBQ0E7QUFDQTtBQUVBO0FBQ0E7QUFDQTtBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUVBO0FBQ0E7QUFDQTtBQUVBO0FBRUE7QUFDQTtBQUNBO0FBRUE7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUVBO0FBQ0E7QUFDQTtBQUFBO0FBQ0E7QUFDQTsiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///40\n")}]); \ No newline at end of file +!function(n){var g=window.webpackHotUpdate;window.webpackHotUpdate=function(n,e){!function(n,g){if(!Z[n]||!m[n])return;for(var e in m[n]=!1,g)Object.prototype.hasOwnProperty.call(g,e)&&(d[e]=g[e]);0==--o&&0===s&&h()}(n,e),g&&g(n,e)};var e,I=!0,t="95de5ca476bc628f02cb",c=1e4,B={},i=[],a=[];function l(n){var g=y[n];if(!g)return V;var I=function(I){return g.hot.active?(y[I]?-1===y[I].parents.indexOf(n)&&y[I].parents.push(n):(i=[n],e=I),-1===g.children.indexOf(I)&&g.children.push(I)):(console.warn("[HMR] unexpected require("+I+") from disposed module "+n),i=[]),V(I)},t=function(n){return{configurable:!0,enumerable:!0,get:function(){return V[n]},set:function(g){V[n]=g}}};for(var c in V)Object.prototype.hasOwnProperty.call(V,c)&&"e"!==c&&"t"!==c&&Object.defineProperty(I,c,t(c));return I.e=function(n){return"ready"===b&&u("prepare"),s++,V.e(n).then(g,(function(n){throw g(),n}));function g(){s--,"prepare"===b&&(G[n]||p(n),0===s&&0===o&&h())}},I.t=function(n,g){return 1&g&&(n=I(n)),V.t(n,-2&g)},I}function r(n){var g={_acceptedDependencies:{},_declinedDependencies:{},_selfAccepted:!1,_selfDeclined:!1,_disposeHandlers:[],_main:e!==n,active:!0,accept:function(n,e){if(void 0===n)g._selfAccepted=!0;else if("function"==typeof n)g._selfAccepted=n;else if("object"==typeof n)for(var I=0;I=0&&g._disposeHandlers.splice(e,1)},check:X,apply:U,status:function(n){if(!n)return b;C.push(n)},addStatusHandler:function(n){C.push(n)},removeStatusHandler:function(n){var g=C.indexOf(n);g>=0&&C.splice(g,1)},data:B[n]};return e=void 0,g}var C=[],b="idle";function u(n){b=n;for(var g=0;g0;){var t=I.pop(),c=t.id,B=t.chain;if((a=y[c])&&!a.hot._selfAccepted){if(a.hot._selfDeclined)return{type:"self-declined",chain:B,moduleId:c};if(a.hot._main)return{type:"unaccepted",chain:B,moduleId:c};for(var i=0;i ")),X.type){case"self-declined":g.onDeclined&&g.onDeclined(X),g.ignoreDeclined||(p=new Error("Aborted because of self decline: "+X.moduleId+W));break;case"declined":g.onDeclined&&g.onDeclined(X),g.ignoreDeclined||(p=new Error("Aborted because of declined dependency: "+X.moduleId+" in "+X.parentId+W));break;case"unaccepted":g.onUnaccepted&&g.onUnaccepted(X),g.ignoreUnaccepted||(p=new Error("Aborted because "+l+" is not accepted"+W));break;case"accepted":g.onAccepted&&g.onAccepted(X),h=!0;break;case"disposed":g.onDisposed&&g.onDisposed(X),U=!0;break;default:throw new Error("Unexception type "+X.type)}if(p)return u("abort"),Promise.reject(p);if(h)for(l in s[l]=d[l],C(o,X.outdatedModules),X.outdatedDependencies)Object.prototype.hasOwnProperty.call(X.outdatedDependencies,l)&&(A[l]||(A[l]=[]),C(A[l],X.outdatedDependencies[l]));U&&(C(o,[X.moduleId]),s[l]=G)}var N,Y=[];for(I=0;I0;)if(l=H.pop(),a=y[l]){var v={},J=a.hot._disposeHandlers;for(c=0;c=0&&R.parents.splice(N,1))}}for(l in A)if(Object.prototype.hasOwnProperty.call(A,l)&&(a=y[l]))for(x=A[l],c=0;c=0&&a.children.splice(N,1);for(l in u("apply"),t=Q,s)Object.prototype.hasOwnProperty.call(s,l)&&(n[l]=s[l]);var S=null;for(l in A)if(Object.prototype.hasOwnProperty.call(A,l)&&(a=y[l])){x=A[l];var T=[];for(I=0;I undefined\n * typeof document -> undefined\n *\n * react-native:\n * navigator.product -> 'ReactNative'\n * nativescript\n * navigator.product -> 'NativeScript' or 'NS'\n */\nfunction isStandardBrowserEnv() {\n if (typeof navigator !== 'undefined' && (navigator.product === 'ReactNative' ||\n navigator.product === 'NativeScript' ||\n navigator.product === 'NS')) {\n return false;\n }\n return (\n typeof window !== 'undefined' &&\n typeof document !== 'undefined'\n );\n}\n\n/**\n * Iterate over an Array or an Object invoking a function for each item.\n *\n * If `obj` is an Array callback will be called passing\n * the value, index, and complete array for each item.\n *\n * If 'obj' is an Object callback will be called passing\n * the value, key, and complete object for each property.\n *\n * @param {Object|Array} obj The object to iterate\n * @param {Function} fn The callback to invoke for each item\n */\nfunction forEach(obj, fn) {\n // Don't bother if no value provided\n if (obj === null || typeof obj === 'undefined') {\n return;\n }\n\n // Force an array if not already something iterable\n if (typeof obj !== 'object') {\n /*eslint no-param-reassign:0*/\n obj = [obj];\n }\n\n if (isArray(obj)) {\n // Iterate over array values\n for (var i = 0, l = obj.length; i < l; i++) {\n fn.call(null, obj[i], i, obj);\n }\n } else {\n // Iterate over object keys\n for (var key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) {\n fn.call(null, obj[key], key, obj);\n }\n }\n }\n}\n\n/**\n * Accepts varargs expecting each argument to be an object, then\n * immutably merges the properties of each object and returns result.\n *\n * When multiple objects contain the same key the later object in\n * the arguments list will take precedence.\n *\n * Example:\n *\n * ```js\n * var result = merge({foo: 123}, {foo: 456});\n * console.log(result.foo); // outputs 456\n * ```\n *\n * @param {Object} obj1 Object to merge\n * @returns {Object} Result of all merge properties\n */\nfunction merge(/* obj1, obj2, obj3, ... */) {\n var result = {};\n function assignValue(val, key) {\n if (typeof result[key] === 'object' && typeof val === 'object') {\n result[key] = merge(result[key], val);\n } else {\n result[key] = val;\n }\n }\n\n for (var i = 0, l = arguments.length; i < l; i++) {\n forEach(arguments[i], assignValue);\n }\n return result;\n}\n\n/**\n * Function equal to merge with the difference being that no reference\n * to original objects is kept.\n *\n * @see merge\n * @param {Object} obj1 Object to merge\n * @returns {Object} Result of all merge properties\n */\nfunction deepMerge(/* obj1, obj2, obj3, ... */) {\n var result = {};\n function assignValue(val, key) {\n if (typeof result[key] === 'object' && typeof val === 'object') {\n result[key] = deepMerge(result[key], val);\n } else if (typeof val === 'object') {\n result[key] = deepMerge({}, val);\n } else {\n result[key] = val;\n }\n }\n\n for (var i = 0, l = arguments.length; i < l; i++) {\n forEach(arguments[i], assignValue);\n }\n return result;\n}\n\n/**\n * Extends object a by mutably adding to it the properties of object b.\n *\n * @param {Object} a The object to be extended\n * @param {Object} b The object to copy properties from\n * @param {Object} thisArg The object to bind function to\n * @return {Object} The resulting value of object a\n */\nfunction extend(a, b, thisArg) {\n forEach(b, function assignValue(val, key) {\n if (thisArg && typeof val === 'function') {\n a[key] = bind(val, thisArg);\n } else {\n a[key] = val;\n }\n });\n return a;\n}\n\nmodule.exports = {\n isArray: isArray,\n isArrayBuffer: isArrayBuffer,\n isBuffer: isBuffer,\n isFormData: isFormData,\n isArrayBufferView: isArrayBufferView,\n isString: isString,\n isNumber: isNumber,\n isObject: isObject,\n isUndefined: isUndefined,\n isDate: isDate,\n isFile: isFile,\n isBlob: isBlob,\n isFunction: isFunction,\n isStream: isStream,\n isURLSearchParams: isURLSearchParams,\n isStandardBrowserEnv: isStandardBrowserEnv,\n forEach: forEach,\n merge: merge,\n deepMerge: deepMerge,\n extend: extend,\n trim: trim\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMC5qcyIsInNvdXJjZXMiOlsid2VicGFjazovLy8uL25vZGVfbW9kdWxlcy9heGlvcy9saWIvdXRpbHMuanM/YzUzMiJdLCJzb3VyY2VzQ29udGVudCI6WyIndXNlIHN0cmljdCc7XG5cbnZhciBiaW5kID0gcmVxdWlyZSgnLi9oZWxwZXJzL2JpbmQnKTtcbnZhciBpc0J1ZmZlciA9IHJlcXVpcmUoJ2lzLWJ1ZmZlcicpO1xuXG4vKmdsb2JhbCB0b1N0cmluZzp0cnVlKi9cblxuLy8gdXRpbHMgaXMgYSBsaWJyYXJ5IG9mIGdlbmVyaWMgaGVscGVyIGZ1bmN0aW9ucyBub24tc3BlY2lmaWMgdG8gYXhpb3NcblxudmFyIHRvU3RyaW5nID0gT2JqZWN0LnByb3RvdHlwZS50b1N0cmluZztcblxuLyoqXG4gKiBEZXRlcm1pbmUgaWYgYSB2YWx1ZSBpcyBhbiBBcnJheVxuICpcbiAqIEBwYXJhbSB7T2JqZWN0fSB2YWwgVGhlIHZhbHVlIHRvIHRlc3RcbiAqIEByZXR1cm5zIHtib29sZWFufSBUcnVlIGlmIHZhbHVlIGlzIGFuIEFycmF5LCBvdGhlcndpc2UgZmFsc2VcbiAqL1xuZnVuY3Rpb24gaXNBcnJheSh2YWwpIHtcbiAgcmV0dXJuIHRvU3RyaW5nLmNhbGwodmFsKSA9PT0gJ1tvYmplY3QgQXJyYXldJztcbn1cblxuLyoqXG4gKiBEZXRlcm1pbmUgaWYgYSB2YWx1ZSBpcyBhbiBBcnJheUJ1ZmZlclxuICpcbiAqIEBwYXJhbSB7T2JqZWN0fSB2YWwgVGhlIHZhbHVlIHRvIHRlc3RcbiAqIEByZXR1cm5zIHtib29sZWFufSBUcnVlIGlmIHZhbHVlIGlzIGFuIEFycmF5QnVmZmVyLCBvdGhlcndpc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Q0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTsiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///0\n")},function(module,__webpack_exports__,__webpack_require__){"use strict";eval("\n// EXTERNAL MODULE: ./node_modules/axios/index.js\nvar axios = __webpack_require__(2);\nvar axios_default = /*#__PURE__*/__webpack_require__.n(axios);\n\n// EXTERNAL MODULE: ./node_modules/spark-md5/spark-md5.js\nvar spark_md5 = __webpack_require__(5);\nvar spark_md5_default = /*#__PURE__*/__webpack_require__.n(spark_md5);\n\n// CONCATENATED MODULE: ./src/uploader.ts\nvar __assign = (undefined && undefined.__assign) || function () {\r\n __assign = Object.assign || function(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\r\n t[p] = s[p];\r\n }\r\n return t;\r\n };\r\n return __assign.apply(this, arguments);\r\n};\r\nvar __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n};\r\nvar __generator = (undefined && undefined.__generator) || function (thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n};\r\n\r\n\r\nvar userToken = '';\r\nvar apiV2BaseUrl = '';\r\nvar storage = { channel: 'public' };\r\ntry {\r\n var sp = new URL(window.location.href).searchParams;\r\n userToken = sp.get('user_token') || '';\r\n apiV2BaseUrl = sp.get('api_v2_base_url') || '';\r\n var uploadStorage = sp.get('upload_storage');\r\n if (uploadStorage) {\r\n storage = JSON.parse(uploadStorage);\r\n }\r\n}\r\ncatch (err) {\r\n //\r\n}\r\nwindow.setUploaderOptions = function (options) {\r\n if (typeof options === 'string') {\r\n options = JSON.parse(options);\r\n }\r\n userToken = options.userToken || '';\r\n apiV2BaseUrl = options.apiV2BaseUrl || '';\r\n if (options.storage) {\r\n storage = options.storage;\r\n }\r\n};\r\nvar uploadFuncNames = [\r\n 'chooseImage',\r\n 'removeImage',\r\n 'reinsertImage',\r\n 'reuploadImage',\r\n 'insertRemoteImage',\r\n 'chooseVideo',\r\n 'removeVideo',\r\n 'reinsertVideo',\r\n 'reuploadVideo',\r\n];\r\nfunction tryHijackUploadCall(funcName, params) {\r\n if (!uploadFuncNames.includes(funcName)) {\r\n return false;\r\n }\r\n if (funcName.startsWith('choose')) {\r\n chooseAndUpload(funcName.substr(6).toLowerCase());\r\n }\r\n else if (funcName.startsWith('remove')) {\r\n handleRemove(funcName.substr(6).toLowerCase(), params);\r\n }\r\n else if (funcName.startsWith('reinsert')) {\r\n handleReinsert(funcName.substr(8).toLowerCase(), params);\r\n }\r\n else if (funcName.startsWith('reupload')) {\r\n handleReupload(funcName.substr(8).toLowerCase(), params);\r\n }\r\n else if (funcName === 'insertRemoteImage') {\r\n uploadRemoteImage(params);\r\n }\r\n return true;\r\n}\r\nvar uploadFiles = new Map();\r\nvar fileCounter = 1;\r\nfunction chooseAndUpload(type) {\r\n var input = document.createElement('input');\r\n input.setAttribute('type', 'file');\r\n if (type === 'image') {\r\n input.setAttribute('multiple', '');\r\n input.setAttribute('accept', 'image/*');\r\n }\r\n else if (type === 'video') {\r\n input.setAttribute('accept', 'video/mp4');\r\n }\r\n input.addEventListener('change', function () {\r\n var length = input.files.length;\r\n if (!length) {\r\n return;\r\n }\r\n var promises = [];\r\n var _loop_1 = function (i) {\r\n var file = input.files.item(i);\r\n if (!file ||\r\n (type === 'image' && !file.type.startsWith('image/')) ||\r\n (type === 'video' && file.type !== 'video/mp4')) {\r\n return \"continue\";\r\n }\r\n var id = \"\" + fileCounter++;\r\n promises.push(getMediaInfo(file).then(function (mf) {\r\n return __assign(__assign({}, mf), { id: id, useCounter: 1 });\r\n }));\r\n };\r\n for (var i = 0; i < length; i++) {\r\n _loop_1(i);\r\n }\r\n Promise.all(promises)\r\n .then(function (list) {\r\n var params = list\r\n .sort(function (a, b) { return Number(a.id) - Number(b.id); })\r\n .map(function (uf) {\r\n var param = {\r\n id: uf.id,\r\n url: uf.image.url,\r\n width: uf.image.width,\r\n height: uf.image.height,\r\n };\r\n if (type === 'video') {\r\n param.url = uf.video.url;\r\n param.poster = uf.image.url;\r\n }\r\n return param;\r\n });\r\n window.postMessage({\r\n funcName: type + \"PreviewReceiver\",\r\n params: type === 'image' ? params : params[0],\r\n }, '*');\r\n list.forEach(function (uf) {\r\n uploadFiles.set(uf.id, uf);\r\n handleUpload(type, uf.id);\r\n });\r\n })\r\n .catch(console.log);\r\n });\r\n input.click();\r\n}\r\nfunction getMediaInfo(file) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var mf, promises, imageFileType_1, imageFilename_1, setBuffAndHash;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n mf = {\r\n image: {\r\n file: file,\r\n buff: new ArrayBuffer(0),\r\n hash: '',\r\n url: '',\r\n width: 0,\r\n height: 0,\r\n },\r\n };\r\n promises = [];\r\n if (!file.type.startsWith('video/')) return [3 /*break*/, 2];\r\n mf.video = {\r\n file: file,\r\n buff: new ArrayBuffer(0),\r\n hash: '',\r\n url: URL.createObjectURL(file),\r\n width: 0,\r\n height: 0,\r\n };\r\n imageFileType_1 = \"image/png\";\r\n imageFilename_1 = file.name + \".png\";\r\n return [4 /*yield*/, new Promise(function (resolve, reject) {\r\n var video = document.createElement('video');\r\n video.addEventListener('loadeddata', function () {\r\n video.pause();\r\n video.currentTime = 0;\r\n mf.video.width = mf.image.width = video.videoWidth;\r\n mf.video.height = mf.image.height = video.videoHeight;\r\n var canvas = document.createElement('canvas');\r\n canvas.setAttribute('width', \"\" + mf.image.width);\r\n canvas.setAttribute('height', \"\" + mf.image.height);\r\n var ctx = canvas.getContext('2d');\r\n if (!ctx) {\r\n reject(new Error('无法提取到视频封面'));\r\n }\r\n else {\r\n ctx.drawImage(video, 0, 0, mf.image.width, mf.image.height);\r\n canvas.toBlob(function (blob) {\r\n if (!blob || blob.size <= 0) {\r\n reject(new Error('无法提取到视频封面'));\r\n }\r\n else {\r\n var file_1 = new File([blob], imageFilename_1, { type: blob.type });\r\n mf.image.url = URL.createObjectURL(file_1);\r\n mf.image.file = file_1;\r\n resolve();\r\n }\r\n }, imageFileType_1);\r\n }\r\n });\r\n video.autoplay = true;\r\n video.muted = true;\r\n video.src = mf.video.url;\r\n })];\r\n case 1:\r\n _a.sent();\r\n return [3 /*break*/, 3];\r\n case 2:\r\n mf.image.url = URL.createObjectURL(mf.image.file);\r\n promises.push(new Promise(function (resolve, reject) {\r\n var img = document.createElement('img');\r\n img.addEventListener('load', function () {\r\n mf.image.width = img.naturalWidth;\r\n mf.image.height = img.naturalHeight;\r\n resolve();\r\n });\r\n img.addEventListener('error', function () {\r\n reject(new Error('图片加载异常'));\r\n });\r\n img.src = mf.image.url;\r\n }));\r\n _a.label = 3;\r\n case 3:\r\n setBuffAndHash = function (info) {\r\n return new Promise(function (resolve, reject) {\r\n var reader = new FileReader();\r\n reader.addEventListener('load', function () {\r\n var spark = new spark_md5_default.a.ArrayBuffer();\r\n info.buff = reader.result;\r\n info.hash = spark.append(info.buff).end();\r\n resolve();\r\n });\r\n reader.addEventListener('error', function () {\r\n reject(new Error('读取文件异常'));\r\n });\r\n reader.readAsArrayBuffer(info.file);\r\n });\r\n };\r\n promises.push(setBuffAndHash(mf.image));\r\n if (mf.video) {\r\n promises.push(setBuffAndHash(mf.video));\r\n }\r\n return [4 /*yield*/, Promise.all(promises)];\r\n case 4:\r\n _a.sent();\r\n return [2 /*return*/, mf];\r\n }\r\n });\r\n });\r\n}\r\nfunction uploadRemoteImage(params) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var id, contentType_1, filename_1, _a, blob, file, buff, spark, hash, error_1, buff;\r\n return __generator(this, function (_b) {\r\n switch (_b.label) {\r\n case 0:\r\n id = \"\" + fileCounter++;\r\n window.postMessage({\r\n funcName: \"uploadRemoteImage\",\r\n params: { id: id, remoteId: params.remoteId },\r\n }, '*');\r\n _b.label = 1;\r\n case 1:\r\n _b.trys.push([1, 3, , 4]);\r\n contentType_1 = 'image/png';\r\n filename_1 = Date.now() + \".png\";\r\n return [4 /*yield*/, new Promise(function (resolve, reject) {\r\n var img = document.createElement('img');\r\n img.addEventListener('load', function () {\r\n var canvas = document.createElement('canvas');\r\n canvas.setAttribute('width', \"\" + params.width);\r\n canvas.setAttribute('height', \"\" + params.height);\r\n var ctx = canvas.getContext('2d');\r\n ctx.drawImage(img, 0, 0, params.width, params.height);\r\n canvas.toBlob(function (blob) {\r\n if (!blob) {\r\n return reject();\r\n }\r\n var reader = new FileReader();\r\n reader.addEventListener('load', function () {\r\n var buff = reader.result;\r\n var file = new File([blob], filename_1, { type: contentType_1 });\r\n resolve({ blob: blob, file: file, buff: buff });\r\n });\r\n reader.addEventListener('error', function () { return reject(); });\r\n reader.readAsArrayBuffer(blob);\r\n }, contentType_1);\r\n });\r\n img.addEventListener('error', function () { return reject(); });\r\n img.crossOrigin = 'anonymous';\r\n img.src = params.src;\r\n })];\r\n case 2:\r\n _a = _b.sent(), blob = _a.blob, file = _a.file, buff = _a.buff;\r\n spark = new spark_md5_default.a.ArrayBuffer();\r\n hash = spark.append(buff).end();\r\n uploadFiles.set(id, {\r\n id: id,\r\n useCounter: 1,\r\n image: {\r\n file: file,\r\n buff: buff,\r\n hash: hash,\r\n url: params.src,\r\n width: params.width,\r\n height: params.height,\r\n },\r\n });\r\n return [3 /*break*/, 4];\r\n case 3:\r\n error_1 = _b.sent();\r\n buff = new ArrayBuffer(0);\r\n uploadFiles.set(id, {\r\n id: id,\r\n useCounter: 1,\r\n image: {\r\n file: new File([buff], 'empty'),\r\n buff: buff,\r\n hash: '',\r\n url: params.src,\r\n width: params.width,\r\n height: params.height,\r\n },\r\n error: '无法下载远程图片,请手动上传',\r\n });\r\n return [3 /*break*/, 4];\r\n case 4:\r\n handleUpload('image', id);\r\n return [2 /*return*/];\r\n }\r\n });\r\n });\r\n}\r\nfunction handleUpload(type, id) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var uf, upload, params, _a, node, url, results, video, poster, e_1, message;\r\n var _this = this;\r\n return __generator(this, function (_b) {\r\n switch (_b.label) {\r\n case 0:\r\n uf = uploadFiles.get(id);\r\n if (!uf || (uf.status && ['UPLOADING', 'SUCCESS'].includes(uf.status))) {\r\n return [2 /*return*/];\r\n }\r\n _b.label = 1;\r\n case 1:\r\n _b.trys.push([1, 6, , 7]);\r\n if (uf.error) {\r\n throw new Error(uf.error);\r\n }\r\n upload = function (info) { return __awaiter(_this, void 0, void 0, function () {\r\n var source, _a, uri, method, headers, form, fileKey, data, keys, _b, node, url;\r\n return __generator(this, function (_c) {\r\n switch (_c.label) {\r\n case 0:\r\n source = axios_default.a.CancelToken.source();\r\n uf.cancelUpload = source.cancel.bind(source);\r\n return [4 /*yield*/, axios_default.a.post('storage', {\r\n hash: info.hash,\r\n storage: storage,\r\n size: info.file.size,\r\n filename: info.file.name,\r\n mime_type: info.file.type,\r\n }, {\r\n headers: {\r\n Authorization: userToken,\r\n Accept: 'application/json, */*',\r\n },\r\n baseURL: apiV2BaseUrl,\r\n validateStatus: function (s) { return s === 200 || s === 201; },\r\n cancelToken: source.token,\r\n })];\r\n case 1:\r\n _a = (_c.sent()).data, uri = _a.uri, method = _a.method, headers = _a.headers, form = _a.form, fileKey = _a.file_key;\r\n data = info.buff;\r\n if (form || fileKey) {\r\n data = new FormData();\r\n data.append(fileKey, info.file);\r\n keys = Object.keys(form || {});\r\n if (keys.length) {\r\n keys.forEach(function (key) { return data.append(key, form[key]); });\r\n }\r\n }\r\n source = axios_default.a.CancelToken.source();\r\n uf.cancelUpload = source.cancel.bind(source);\r\n return [4 /*yield*/, axios_default.a.request({\r\n url: uri,\r\n method: method,\r\n headers: headers,\r\n data: data,\r\n onUploadProgress: function (pe) {\r\n if (pe.lengthComputable) {\r\n if (type === 'image' || info.file.type.startsWith('video/')) {\r\n window.postMessage({\r\n funcName: type + \"ProgressReceiver\",\r\n params: { id: id, progress: (pe.loaded * 100) / pe.total },\r\n }, '*');\r\n }\r\n }\r\n },\r\n validateStatus: function (s) { return s === 200 || s === 201; },\r\n cancelToken: source.token,\r\n })];\r\n case 2:\r\n _b = (_c.sent()).data, node = _b.node, url = _b.uri;\r\n return [2 /*return*/, { node: node, url: url, fileType: info.file.type }];\r\n }\r\n });\r\n }); };\r\n uf.status = 'UPLOADING';\r\n params = { id: id };\r\n if (!(type === 'image')) return [3 /*break*/, 3];\r\n return [4 /*yield*/, upload(uf.image)];\r\n case 2:\r\n _a = _b.sent(), node = _a.node, url = _a.url;\r\n params.url = url;\r\n params.node = node;\r\n return [3 /*break*/, 5];\r\n case 3:\r\n if (!(type === 'video')) return [3 /*break*/, 5];\r\n return [4 /*yield*/, Promise.all([upload(uf.image), upload(uf.video)])];\r\n case 4:\r\n results = _b.sent();\r\n video = void 0, poster = void 0;\r\n if (results[0].fileType.startsWith('video/')) {\r\n video = results[0];\r\n poster = results[1];\r\n }\r\n else {\r\n video = results[1];\r\n poster = results[0];\r\n }\r\n params.url = video.url;\r\n params.urlNode = video.node;\r\n params.poster = poster.url;\r\n params.posterNode = poster.node;\r\n _b.label = 5;\r\n case 5:\r\n window.postMessage({ funcName: type + \"UrlReceiver\", params: params }, '*');\r\n return [3 /*break*/, 7];\r\n case 6:\r\n e_1 = _b.sent();\r\n /* eslint require-atomic-updates: */\r\n if (axios_default.a.isCancel(e_1)) {\r\n uf.status = 'CANCEL';\r\n }\r\n else {\r\n uf.status = 'ERROR';\r\n message = e_1.message || '网络异常导致上传失败';\r\n if (e_1.response && e_1.response.data) {\r\n message = e_1.response.data.message;\r\n if (Array.isArray(message)) {\r\n message = message[0];\r\n }\r\n message = message || '服务异常导致上传失败';\r\n }\r\n window.postMessage({\r\n funcName: type + \"FailedReceiver\",\r\n params: { id: id, error: message },\r\n }, '*');\r\n }\r\n return [3 /*break*/, 7];\r\n case 7: return [2 /*return*/];\r\n }\r\n });\r\n });\r\n}\r\nfunction handleRemove(type, params) {\r\n var status = params.status;\r\n if (status !== 'UPLOADING') {\r\n return;\r\n }\r\n var uf = uploadFiles.get(params.id);\r\n if (uf && uf.useCounter > 0) {\r\n uf.useCounter -= 1;\r\n if (uf.useCounter === 0 && uf.status === 'UPLOADING') {\r\n uf.cancelUpload();\r\n }\r\n }\r\n}\r\nfunction handleReinsert(type, params) {\r\n var status = params.status;\r\n if (status !== 'UPLOADING') {\r\n return;\r\n }\r\n var uf = uploadFiles.get(params.id);\r\n if (uf) {\r\n uf.useCounter += 1;\r\n if (uf.useCounter === 1 && uf.status === 'CANCEL') {\r\n handleUpload(type, params.id);\r\n }\r\n }\r\n}\r\nfunction handleReupload(type, params) {\r\n handleUpload(type, params.id);\r\n}\r\n\n// CONCATENATED MODULE: ./src/caller.ts\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"a\", function() { return callMethod; });\n\r\n/**\r\n * 调用客户端函数的方法\r\n *\r\n * @param fnName 调用的方法名\r\n * @param params 调用方法传参\r\n */\r\nfunction callMethod(fnName, params) {\r\n if (params === void 0) { params = undefined; }\r\n if (window.debug) {\r\n console.log('debug callMethod', fnName, params); // eslint-disable-line no-console\r\n }\r\n if (window.launcher) {\r\n // in Android\r\n if (typeof window.launcher[fnName] === 'function') {\r\n if (params) {\r\n window.launcher[fnName](JSON.stringify(params));\r\n }\r\n else {\r\n window.launcher[fnName]();\r\n }\r\n }\r\n }\r\n else if (window.webkit && window.webkit.messageHandlers) {\r\n // in IOS\r\n window.webkit.messageHandlers.MobilePhoneCall.postMessage({ funcName: fnName, params: params });\r\n }\r\n else if (window.self != window.parent) {\r\n // in iframe\r\n if (!tryHijackUploadCall(fnName, params)) {\r\n window.parent.postMessage({ funcName: fnName, params: params }, '*');\r\n }\r\n }\r\n else {\r\n // not in webview\r\n // tryHijackUploadCall(fnName, params)\r\n return false;\r\n }\r\n return true;\r\n}\r\nvar FuncName;\r\n(function (FuncName) {\r\n FuncName[\"setUploaderOptions\"] = \"setUploaderOptions\";\r\n FuncName[\"setContentReceiver\"] = \"setContentReceiver\";\r\n FuncName[\"imagePreviewReceiver\"] = \"imagePreviewReceiver\";\r\n FuncName[\"imageProgressReceiver\"] = \"imageProgressReceiver\";\r\n FuncName[\"imageUrlReceiver\"] = \"imageUrlReceiver\";\r\n FuncName[\"imageFailedReceiver\"] = \"imageFailedReceiver\";\r\n FuncName[\"videoPreviewReceiver\"] = \"videoPreviewReceiver\";\r\n FuncName[\"videoProgressReceiver\"] = \"videoProgressReceiver\";\r\n FuncName[\"videoUrlReceiver\"] = \"videoUrlReceiver\";\r\n FuncName[\"videoFailedReceiver\"] = \"videoFailedReceiver\";\r\n FuncName[\"editorSubmitReceiver\"] = \"editorSubmitReceiver\";\r\n FuncName[\"changePlaceholder\"] = \"changePlaceholder\";\r\n FuncName[\"pageHiddenReceiver\"] = \"pageHiddenReceiver\";\r\n})(FuncName || (FuncName = {}));\r\nvar postMessage = window.postMessage;\r\nwindow.postMessage = function (message, targetOrigin, transfer) {\r\n if (targetOrigin === void 0) { targetOrigin = '*'; }\r\n postMessage(message, targetOrigin, transfer);\r\n};\r\nwindow.addEventListener('message', function (e) {\r\n var funcName = (e.data || {}).funcName;\r\n if (funcName && typeof window[funcName] === 'function') {\r\n var params = (e.data || {}).params;\r\n if (!['changePlaceholder', 'setContentReceiver'].includes(funcName)) {\r\n params = params && JSON.stringify(params);\r\n }\r\n window[funcName](params);\r\n }\r\n});\r\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMS5qcyIsInNvdXJjZXMiOlsid2VicGFjazovLy8uL3NyYy91cGxvYWRlci50cz9iM2IwIiwid2VicGFjazovLy8uL3NyYy9jYWxsZXIudHM/ZDU2ZCJdLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgYXhpb3MgZnJvbSAnYXhpb3MnXG5pbXBvcnQgU3BhcmsgZnJvbSAnc3BhcmstbWQ1J1xuXG5sZXQgdXNlclRva2VuOiBzdHJpbmcgPSAnJ1xubGV0IGFwaVYyQmFzZVVybDogc3RyaW5nID0gJydcbmxldCBzdG9yYWdlID0geyBjaGFubmVsOiAncHVibGljJyB9XG5cbnRyeSB7XG4gIGNvbnN0IHNwID0gbmV3IFVSTCh3aW5kb3cubG9jYXRpb24uaHJlZikuc2VhcmNoUGFyYW1zXG5cbiAgdXNlclRva2VuID0gc3AuZ2V0KCd1c2VyX3Rva2VuJykgfHwgJydcbiAgYXBpVjJCYXNlVXJsID0gc3AuZ2V0KCdhcGlfdjJfYmFzZV91cmwnKSB8fCAnJ1xuICBjb25zdCB1cGxvYWRTdG9yYWdlID0gc3AuZ2V0KCd1cGxvYWRfc3RvcmFnZScpXG4gIGlmICh1cGxvYWRTdG9yYWdlKSB7XG4gICAgc3RvcmFnZSA9IEpTT04ucGFyc2UodXBsb2FkU3RvcmFnZSlcbiAgfVxufSBjYXRjaCAoZXJyKSB7XG4gIC8vXG59XG5cbndpbmRvdy5zZXRVcGxvYWRlck9wdGlvbnMgPSBvcHRpb25zID0+IHtcbiAgaWYgKHR5cGVvZiBvcHRpb25zID09PSAnc3RyaW5nJykge1xuICAgIG9wdGlvbnMgPSBKU09OLnBhcnNlKG9wdGlvbnMp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LCB1c2VDb3VudGVyOiAxIH1cbiAgICAgICAgfSksXG4gICAgICApXG4gICAgfVxuXG4gICAgUHJvbWlzZS5hbGwocHJvbWlzZXMpXG4gICAgICAudGhlbihsaXN0ID0+IHtcbiAgICAgICAgY29uc3QgcGFyYW1zOiBhbnlbXSA9IGxpc3RcbiAgICAgICAgICAuc29ydCgoYSwgYikgPT4gTnVtYmVyKGEuaWQpIC0gTnVtYmVyKGIuaWQpKVxuICAgICAgICAgIC5tYXAodWYgPT4ge1xuICAgICAgICAgICAgY29uc3QgcGFyYW06IGFueSA9IHtcbiAgICAgICAgICAgICAgaWQ6IHVmLmlkLFxuICAgICAgICAgICAgICB1cmw6IHVmLmltYWdlLnVybCxcbiAgICAgICAgICAgICAgd2lkdGg6IHVmLmltYWdlLndpZHRoLFxuICAgICAgICAgICAgICBoZWlnaHQ6IHVmLmltYWdlLmhlaWdodCxcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmICh0eXBlID09PSAndmlkZW8nKSB7XG4gICAgICAgICAgICAgIHBhcmFtLnVybCA9IHVmLnZpZGVvIS51cmxcbiAgICAgICAgICAgICAgcGFyYW0ucG9zdGVyID0gdWYuaW1hZ2UudXJsXG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHJldHVybiBwYXJhbVxuICAgICAgICAgIH0pXG5cbiAgICAgICAgd2luZG93LnBvc3RNZXNzYWdlKFxuICAgICAgICAgIHtcbiAgICAgICAgICAgIGZ1bmNOYW1lOiBgJHt0eXBlfVByZXZpZXdSZWNlaXZlcmAsXG4gICAgICAgICAgICBwYXJhbXM6IHR5cGUgPT09ICdpbWFnZScgPyBwYXJhbXMgOiBwYXJhbXNbMF0sXG4gICAgICAgICAgfSxcbiAgICAgICAgICAnKicsXG4gICAgICAgIClcblxuICAgICAgICBsaXN0LmZvckVhY2godWYgPT4ge1xuICAgICAgICAgIHVwbG9hZEZpbGVzLnNldCh1Zi5pZCwgdWYpXG4gICAgICAgICAgaGFuZGxlVXB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tleTogZmlsZUtleSB9LFxuICAgICAgfSA9IGF3YWl0IGF4aW9zLnBvc3QoXG4gICAgICAgICdzdG9yYWdlJyxcbiAgICAgICAge1xuICAgICAgICAgIGhhc2g6IGluZm8uaGFzaCxcbiAgICAgICAgICBzdG9yYWdlLFxuICAgICAgICAgIHNpemU6IGluZm8uZmlsZS5zaXplLFxuICAgICAgICAgIGZpbGVuYW1lOiBpbmZvLmZpbGUubmFtZSxcbiAgICAgICAgICBtaW1lX3R5cGU6IGluZm8uZmlsZS50eXBlLFxuICAgICAgICB9LFxuICAgICAgICB7XG4gICAgICAgICAgaGVhZGVyczoge1xuICAgICAgICAgICAgQXV0aG9yaXphdGlvbjogdXNlclRva2VuLFxuICAgICAgICAgICAgQWNjZXB0OiAnYXBwbGljYXRpb24vanNvbiwgKi8qJyxcbiAgICAgICAgICB9LFxuICAgICAgICAgIGJhc2VVUkw6IGFwaVYyQmFzZVVybCxcbiAgICAgICAgICB2YWxpZGF0ZVN0YXR1czogcyA9PiBzID09PSAyMDAgfHwgcyA9PT0gMjAxLFxuICAgICAgICAgIGNhbmNlbFRva2VuOiBzb3VyY2UudG9rZW4sXG4gICAgICAgIH0sXG4gICAgICApXG5cbiAgICAgIGxldCBkYXRhOiBBcnJheUJ1ZmZlciB8IEZvcm1EYXRhID0gaW5mby5idWZmXG4gICAgICBpZiAoZm9ybSB8fCBmaWxlS2V5KSB7XG4gICAgICAgIGRhdGEgPSBuZXcgRm9ybURhdGEoKVxuICAgICAgICBkYXRhLmFwcGVuZChmaWxlS2V5LCBpbmZvLmZpbGUpXG5cbiAgICAgICAgY29uc3Qga2V5cyA9IE9iamVjdC5rZXlzKGZvcm0gfHwge30pXG5cbiAgICAgICAgaWYgKGtleXMubGVuZ3RoKSB7XG4gICAgICAgICAga2V5cy5mb3JFYWNoKGtleSA9PiAoZGF0YSBhcyBGb3JtRGF0YSkuYXBwZW5kKGtleSwgZm9ybVtrZXldKSlcbiAgICAgICAgfVxuICAgICAgfVxuXG4gICAgICBzb3VyY2UgPSBheGlvcy5DYW5jZWxUb2tlbi5zb3VyY2UoKVxuICAgICAgdWYuY2FuY2VsVXBsb2FkID0gc291cmNlLmNhbmNlbC5iaW5kKHNvdXJjZSlcblxuICAgICAgY29uc3Qge1xuICAgICAgICBkYXRhOiB7IG5vZGUsIHVyaTogdXJsIH0sXG4gICAgICB9ID0gYXdhaXQgYXhpb3MucmVxdWVzdCh7XG4gICAgICAgIHVybDogdXJpLFxuICAgICAgICBtZXRob2QsXG4gICAgICAgIGhlYWRlcnMsXG4gICAgICAgIGRhdGEsXG4gICAgICAgIG9uVXBsb2FkUHJvZ3Jlc3M6IChwZTogUHJvZ3Jlc3NFdmVudCkgPT4ge1xuICAgICAgICAgIGlmIChwZS5sZW5ndGhDb21wdXRhYmxlKSB7XG4gICAgICAgICAgICBpZiAodHlwZSA9PT0gJ2ltYWdlJyB8fCBpbmZvLmZpbGUudHlwZS5zdGFydHNXaXRoKCd2aWRlby8nKSkge1xuICAgICAgICAgICAgICB3aW5kb3cucG9zdE1lc3NhZ2UoXG4gICAgICAgICAgICAgICAge1xuICAgICAgICAgICAgICAgICAgZnVuY05hbWU6IGAke3R5cGV9UHJvZ3Jlc3NSZWNlaXZlcmAsXG4gICAgICAgICAgICAgICAgICBwYXJhbXM6IHsgaWQsIHByb2dyZXNzOiAocGUubG9hZGVkICogMTAwKSAvIHBlLnRvdGFsIH0sXG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICAnKicsXG4gICAgICAgICAgICAgIClcbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9XG4gICAgICAgIH0sXG4gICAgICAgIHZhbGlkYXRlU3RhdHVzOiBzID0+IHMgPT09IDIwMCB8fCBzID09PSAyMDEsXG4gICAgICAgIGNhbmNlbFRva2VuOiBzb3VyY2UudG9rZW4sXG4gICAgICB9KVxuXG4gICAgICByZXR1cm4geyBub2RlLCB1cmwsIGZpbGVUeXBlOiBpbmZvLmZpbGUudHlwZSB9X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Jvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///1\n")},function(module,exports,__webpack_require__){eval("module.exports = __webpack_require__(18);//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMi5qcyIsInNvdXJjZXMiOlsid2VicGFjazovLy8uL25vZGVfbW9kdWxlcy9heGlvcy9pbmRleC5qcz9iYzNhIl0sInNvdXJjZXNDb250ZW50IjpbIm1vZHVsZS5leHBvcnRzID0gcmVxdWlyZSgnLi9saWIvYXhpb3MnKTsiXSwibWFwcGluZ3MiOiJBQUFBIiwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///2\n")},,function(module,__webpack_exports__,__webpack_require__){"use strict";eval("/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"d\", function() { return getViewElement; });\n/* unused harmony export getViewWidth */\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"a\", function() { return fixImageSize; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"c\", function() { return fixVideoSize; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"b\", function() { return fixSize; });\nfunction getViewElement() {\r\n return document.querySelector('div.ql-editor');\r\n}\r\nfunction getViewWidth() {\r\n var view = getViewElement();\r\n if (view) {\r\n var width = view.clientWidth;\r\n var style = getComputedStyle(view);\r\n if (style.paddingLeft) {\r\n width -= parseFloat(style.paddingLeft);\r\n }\r\n if (style.paddingRight) {\r\n width -= parseFloat(style.paddingRight);\r\n }\r\n if (width > 0) {\r\n return width;\r\n }\r\n }\r\n return 0;\r\n}\r\nfunction fixImageSize() {\r\n getViewElement()\r\n .querySelectorAll('img')\r\n .forEach(function (img) {\r\n var viewWidth = getViewWidth();\r\n var width = Number(img.dataset.width);\r\n var height = Number(img.dataset.height);\r\n if (!viewWidth || !width || !height)\r\n return;\r\n if (width > viewWidth) {\r\n height = (viewWidth / width) * height;\r\n width = viewWidth;\r\n }\r\n img.style.width = width + \"px\";\r\n img.style.height = height + \"px\";\r\n });\r\n}\r\nfunction onPalyVideo(e) {\r\n getViewElement()\r\n .querySelectorAll('video,audio')\r\n .forEach(function (media) {\r\n if (media !== e.target) {\r\n media.pause();\r\n }\r\n });\r\n}\r\nfunction fixVideoSize() {\r\n getViewElement()\r\n .querySelectorAll('video')\r\n .forEach(function (video) {\r\n video.setAttribute('controls', '');\r\n video.setAttribute('preload', 'auto');\r\n video.setAttribute('webkit-playsinline', '');\r\n video.setAttribute('playsinline', '');\r\n video.setAttribute('x5-playsinline', '');\r\n video.setAttribute('controlsList', 'nodownload');\r\n video.removeAttribute('autopaly');\r\n video.removeAttribute('loop');\r\n video.removeEventListener('playing', onPalyVideo);\r\n video.addEventListener('playing', onPalyVideo);\r\n var viewWidth = getViewWidth();\r\n if (!viewWidth)\r\n return;\r\n var width = Number(video.dataset.width);\r\n var height = Number(video.dataset.height);\r\n if (!width || !height || width < height) {\r\n width = viewWidth;\r\n height = viewWidth;\r\n }\r\n else {\r\n height = (viewWidth / width) * height;\r\n width = viewWidth;\r\n }\r\n video.style.width = width + \"px\";\r\n video.style.height = height + \"px\";\r\n });\r\n}\r\nwindow.pageHiddenReceiver = function (data) {\r\n document.querySelectorAll('video,audio').forEach(function (media) {\r\n media.pause();\r\n });\r\n};\r\nfunction fixSize() {\r\n fixImageSize();\r\n fixVideoSize();\r\n}\r\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNC5qcyIsInNvdXJjZXMiOlsid2VicGFjazovLy8uL3NyYy9jb21tb24udHM/ODA0OSJdLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgZnVuY3Rpb24gZ2V0Vmlld0VsZW1lbnQoKSB7XG4gIHJldHVybiBkb2N1bWVudC5xdWVyeVNlbGVjdG9yPEhUTUxEaXZFbGVtZW50PignZGl2LnFsLWVkaXRvcicpXG59XG5cbmV4cG9ydCBmdW5jdG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QTtBQUVBO0FBQ0E7QUFDQTtBQUVBO0FBQ0E7QUFDQTtBQUVBO0FBQ0E7QUFDQTtBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBRUE7QUFDQTtBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBRUE7QUFBQTtBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFFQTtBQUNBO0FBRUE7QUFDQTtBQUFBO0FBRUE7QUFDQTtBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQUE7QUFDQTtBQUNBO0FBQ0E7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFFQTtBQUNBO0FBQ0E7QUFDQTsiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///4\n")},function(module,exports,__webpack_require__){eval("(function (factory) {\n if (true) {\n // Node/CommonJS\n module.exports = factory();\n } else { var glob; }\n}(function (undefined) {\n\n 'use strict';\n\n /*\n * Fastest md5 implementation around (JKM md5).\n * Credits: Joseph Myers\n *\n * @see http://www.myersdaily.org/joseph/javascript/md5-text.html\n * @see http://jsperf.com/md5-shootout/7\n */\n\n /* this function is much faster,\n so if possible we use it. Some IEs\n are the only ones I know of that\n need the idiotic second function,\n generated by an if clause. */\n var add32 = function (a, b) {\n return (a + b) & 0xFFFFFFFF;\n },\n hex_chr = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'];\n\n\n function cmn(q, a, b, x, s, t) {\n a = add32(add32(a, q), add32(x, t));\n return add32((a << s) | (a >>> (32 - s)), b);\n }\n\n function md5cycle(x, k) {\n var a = x[0],\n b = x[1],\n c = x[2],\n d = x[3];\n\n a += (b & c | ~b & d) + k[0] - 680876936 | 0;\n a = (a << 7 | a >>> 25) + b | 0;\n d += (a & b | ~a & c) + k[1] - 389564586 | 0;\n d = (d << 12 | d >>> 20) + a | 0;\n c += (d & a | ~d & b) + k[2] + 606105819 | 0;\n c = (c << 17 | c >>> 15) + d | 0;\n b += (c & d | ~c & a) + k[3] - 1044525330 | 0;\n b = (b << 22 | b >>> 10) + c | 0;\n a += (b & c | ~b & d) + k[4] - 176418897 | 0;\n a = (a << 7 | a >>> 25) + b | 0;\n d += (a & b | ~a & c) + k[5] + 1200080426 | 0;\n d = (d << 12 | d >>> 20) + a | 0;\n c += (d & a | ~d & b) + k[6] - 1473231341 | 0;\n c = (c << 17 | c >>> 15) + d | 0;\n b += (c & d | ~c & a) + k[7] - 45705983 | 0;\n b = (b << 22 | b >>> 10) + c | 0;\n a += (b & c | ~b & d) + k[8] + 1770035416 | 0;\n a = (a << 7 | a >>> 25) + b | 0;\n d += (a & b | ~a & c) + k[9] - 1958414417 | 0;\n d = (d << 12 | d >>> 20) + a | 0;\n c += (d & a | ~d & b) + k[10] - 42063 | 0;\n c = (c << 17 | c >>> 15) + d | 0;\n b += (c & d | ~c & a) + k[11] - 1990404162 | 0;\n b = (b << 22 | b >>> 10) + c | 0;\n a += (b & c | ~b & d) + k[12] + 1804603682 | 0;\n a = (a << 7 | a >>> 25) + b | 0;\n d += (a & b | ~a & c) + k[13] - 40341101 | 0;\n d = (d << 12 | d >>> 20) + a | 0;\n c += (d & a | ~d & b) + k[14] - 1502002290 | 0;\n c = (c << 17 | c >>> 15) + d | 0;\n b += (c & d | ~c & a) + k[15] + 1236535329 | 0;\n b = (b << 22 | b >>> 10) + c | 0;\n\n a += (b & d | c & ~d) + k[1] - 165796510 | 0;\n a = (a << 5 | a >>> 27) + b | 0;\n d += (a & c | b & ~c) + k[6] - 1069501632 | 0;\n d = (d << 9 | d >>> 23) + a | 0;\n c += (d & b | a & ~b) + k[11] + 643717713 | 0;\n c = (c << 14 | c >>> 18) + d | 0;\n b += (c & a | d & ~a) + k[0] - 373897302 | 0;\n b = (b << 20 | b >>> 12) + c | 0;\n a += (b & d | c & ~d) + k[5] - 701558691 | 0;\n a = (a << 5 | a >>> 27) + b | 0;\n d += (a & c | b & ~c) + k[10] + 38016083 | 0;\n d = (d << 9 | d >>> 23) + a | 0;\n c += (d & b | a & ~b) + k[15] - 660478335 | 0;\n c = (c << 14 | c >>> 18) + d | 0;\n b += (c & a | d & ~a) + k[4] - 405537848 | 0;\n b = (b << 20 | b >>> 12) + c | 0;\n a += (b & d | c & ~d) + k[9] + 568446438 | 0;\n a = (a << 5 | a >>> 27) + b | 0;\n d += (a & c | b & ~c) + k[14] - 1019803690 | 0;\n d = (d << 9 | d >>> 23) + a | 0;\n c += (d & b | a & ~b) + k[3] - 187363961 | 0;\n c = (c << 14 | c >>> 18) + d | 0;\n b += (c & a | d & ~a) + k[8] + 1163531501 | 0;\n b = (b << 20 | b >>> 12) + c | 0;\n a += (b & d | c & ~d) + k[13] - 1444681467 | 0;\n a = (a << 5 | a >>> 27) + b | 0;\n d += (a & c | b & ~c) + k[2] - 51403784 | 0;\n d = (d << 9 | d >>> 23) + a | 0;\n c += (d & b | a & ~b) + k[7] + 1735328473 | 0;\n c = (c << 14 | c >>> 18) + d | 0;\n b += (c & a | d & ~a) + k[12] - 1926607734 | 0;\n b = (b << 20 | b >>> 12) + c | 0;\n\n a += (b ^ c ^ d) + k[5] - 378558 | 0;\n a = (a << 4 | a >>> 28) + b | 0;\n d += (a ^ b ^ c) + k[8] - 2022574463 | 0;\n d = (d << 11 | d >>> 21) + a | 0;\n c += (d ^ a ^ b) + k[11] + 1839030562 | 0;\n c = (c << 16 | c >>> 16) + d | 0;\n b += (c ^ d ^ a) + k[14] - 35309556 | 0;\n b = (b << 23 | b >>> 9) + c | 0;\n a += (b ^ c ^ d) + k[1] - 1530992060 | 0;\n a = (a << 4 | a >>> 28) + b | 0;\n d += (a ^ b ^ c) + k[4] + 1272893353 | 0;\n d = (d << 11 | d >>> 21) + a | 0;\n c += (d ^ a ^ b) + k[7] - 155497632 | 0;\n c = (c << 16 | c >>> 16) + d | 0;\n b += (c ^ d ^ a) + k[10] - 1094730640 | 0;\n b = (b << 23 | b >>> 9) + c | 0;\n a += (b ^ c ^ d) + k[13] + 681279174 | 0;\n a = (a << 4 | a >>> 28) + b | 0;\n d += (a ^ b ^ c) + k[0] - 358537222 | 0;\n d = (d << 11 | d >>> 21) + a | 0;\n c += (d ^ a ^ b) + k[3] - 722521979 | 0;\n c = (c << 16 | c >>> 16) + d | 0;\n b += (c ^ d ^ a) + k[6] + 76029189 | 0;\n b = (b << 23 | b >>> 9) + c | 0;\n a += (b ^ c ^ d) + k[9] - 640364487 | 0;\n a = (a << 4 | a >>> 28) + b | 0;\n d += (a ^ b ^ c) + k[12] - 421815835 | 0;\n d = (d << 11 | d >>> 21) + a | 0;\n c += (d ^ a ^ b) + k[15] + 530742520 | 0;\n c = (c << 16 | c >>> 16) + d | 0;\n b += (c ^ d ^ a) + k[2] - 995338651 | 0;\n b = (b << 23 | b >>> 9) + c | 0;\n\n a += (c ^ (b | ~d)) + k[0] - 198630844 | 0;\n a = (a << 6 | a >>> 26) + b | 0;\n d += (b ^ (a | ~c)) + k[7] + 1126891415 | 0;\n d = (d << 10 | d >>> 22) + a | 0;\n c += (a ^ (d | ~b)) + k[14] - 1416354905 | 0;\n c = (c << 15 | c >>> 17) + d | 0;\n b += (d ^ (c | ~a)) + k[5] - 57434055 | 0;\n b = (b << 21 |b >>> 11) + c | 0;\n a += (c ^ (b | ~d)) + k[12] + 1700485571 | 0;\n a = (a << 6 | a >>> 26) + b | 0;\n d += (b ^ (a | ~c)) + k[3] - 1894986606 | 0;\n d = (d << 10 | d >>> 22) + a | 0;\n c += (a ^ (d | ~b)) + k[10] - 1051523 | 0;\n c = (c << 15 | c >>> 17) + d | 0;\n b += (d ^ (c | ~a)) + k[1] - 2054922799 | 0;\n b = (b << 21 |b >>> 11) + c | 0;\n a += (c ^ (b | ~d)) + k[8] + 1873313359 | 0;\n a = (a << 6 | a >>> 26) + b | 0;\n d += (b ^ (a | ~c)) + k[15] - 30611744 | 0;\n d = (d << 10 | d >>> 22) + a | 0;\n c += (a ^ (d | ~b)) + k[6] - 1560198380 | 0;\n c = (c << 15 | c >>> 17) + d | 0;\n b += (d ^ (c | ~a)) + k[13] + 1309151649 | 0;\n b = (b << 21 |b >>> 11) + c | 0;\n a += (c ^ (b | ~d)) + k[4] - 145523070 | 0;\n a = (a << 6 | a >>> 26) + b | 0;\n d += (b ^ (a | ~c)) + k[11] - 1120210379 | 0;\n d = (d << 10 | d >>> 22) + a | 0;\n c += (a ^ (d | ~b)) + k[2] + 718787259 | 0;\n c = (c << 15 | c >>> 17) + d | 0;\n b += (d ^ (c | ~a)) + k[9] - 343485551 | 0;\n b = (b << 21 | b >>> 11) + c | 0;\n\n x[0] = a + x[0] | 0;\n x[1] = b + x[1] | 0;\n x[2] = c + x[2] | 0;\n x[3] = d + x[3] | 0;\n }\n\n function md5blk(s) {\n var md5blks = [],\n i; /* Andy King said do it this way. */\n\n for (i = 0; i < 64; i += 4) {\n md5blks[i >> 2] = s.charCodeAt(i) + (s.charCodeAt(i + 1) << 8) + (s.charCodeAt(i + 2) << 16) + (s.charCodeAt(i + 3) << 24);\n }\n return md5blks;\n }\n\n function md5blk_array(a) {\n var md5blks = [],\n i; /* Andy King said do it this way. */\n\n for (i = 0; i < 64; i += 4) {\n md5blks[i >> 2] = a[i] + (a[i + 1] << 8) + (a[i + 2] << 16) + (a[i + 3] << 24);\n }\n return md5blks;\n }\n\n function md51(s) {\n var n = s.length,\n state = [1732584193, -271733879, -1732584194, 271733878],\n i,\n length,\n tail,\n tmp,\n lo,\n hi;\n\n for (i = 64; i <= n; i += 64) {\n md5cycle(state, md5blk(s.substring(i - 64, i)));\n }\n s = s.substring(i - 64);\n length = s.length;\n tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];\n for (i = 0; i < length; i += 1) {\n tail[i >> 2] |= s.charCodeAt(i) << ((i % 4) << 3);\n }\n tail[i >> 2] |= 0x80 << ((i % 4) << 3);\n if (i > 55) {\n md5cycle(state, tail);\n for (i = 0; i < 16; i += 1) {\n tail[i] = 0;\n }\n }\n\n // Beware that the final length might not fit in 32 bits so we take care of that\n tmp = n * 8;\n tmp = tmp.toString(16).match(/(.*?)(.{0,8})$/);\n lo = parseInt(tmp[2], 16);\n hi = parseInt(tmp[1], 16) || 0;\n\n tail[14] = lo;\n tail[15] = hi;\n\n md5cycle(state, tail);\n return state;\n }\n\n function md51_array(a) {\n var n = a.length,\n state = [1732584193, -271733879, -1732584194, 271733878],\n i,\n length,\n tail,\n tmp,\n lo,\n hi;\n\n for (i = 64; i <= n; i += 64) {\n md5cycle(state, md5blk_array(a.subarray(i - 64, i)));\n }\n\n // Not sure if it is a bug, however IE10 will always produce a sub array of length 1\n // containing the last element of the parent array if the sub array specified starts\n // beyond the length of the parent array - weird.\n // https://connect.microsoft.com/IE/feedback/details/771452/typed-array-subarray-issue\n a = (i - 64) < n ? a.subarray(i - 64) : new Uint8Array(0);\n\n length = a.length;\n tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];\n for (i = 0; i < length; i += 1) {\n tail[i >> 2] |= a[i] << ((i % 4) << 3);\n }\n\n tail[i >> 2] |= 0x80 << ((i % 4) << 3);\n if (i > 55) {\n md5cycle(state, tail);\n for (i = 0; i < 16; i += 1) {\n tail[i] = 0;\n }\n }\n\n // Beware that the final length might not fit in 32 bits so we take care of that\n tmp = n * 8;\n tmp = tmp.toString(16).match(/(.*?)(.{0,8})$/);\n lo = parseInt(tmp[2], 16);\n hi = parseInt(tmp[1], 16) || 0;\n\n tail[14] = lo;\n tail[15] = hi;\n\n md5cycle(state, tail);\n\n return state;\n }\n\n function rhex(n) {\n var s = '',\n j;\n for (j = 0; j < 4; j += 1) {\n s += hex_chr[(n >> (j * 8 + 4)) & 0x0F] + hex_chr[(n >> (j * 8)) & 0x0F];\n }\n return s;\n }\n\n function hex(x) {\n var i;\n for (i = 0; i < x.length; i += 1) {\n x[i] = rhex(x[i]);\n }\n return x.join('');\n }\n\n // In some cases the fast add32 function cannot be used..\n if (hex(md51('hello')) !== '5d41402abc4b2a76b9719d911017c592') {\n add32 = function (x, y) {\n var lsw = (x & 0xFFFF) + (y & 0xFFFF),\n msw = (x >> 16) + (y >> 16) + (lsw >> 16);\n return (msw << 16) | (lsw & 0xFFFF);\n };\n }\n\n // ---------------------------------------------------\n\n /**\n * ArrayBuffer slice polyfill.\n *\n * @see https://github.com/ttaubert/node-arraybuffer-slice\n */\n\n if (typeof ArrayBuffer !== 'undefined' && !ArrayBuffer.prototype.slice) {\n (function () {\n function clamp(val, length) {\n val = (val | 0) || 0;\n\n if (val < 0) {\n return Math.max(val + length, 0);\n }\n\n return Math.min(val, length);\n }\n\n ArrayBuffer.prototype.slice = function (from, to) {\n var length = this.byteLength,\n begin = clamp(from, length),\n end = length,\n num,\n target,\n targetArray,\n sourceArray;\n\n if (to !== undefined) {\n end = clamp(to, length);\n }\n\n if (begin > end) {\n return new ArrayBuffer(0);\n }\n\n num = end - begin;\n target = new ArrayBuffer(num);\n targetArray = new Uint8Array(target);\n\n sourceArray = new Uint8Array(this, begin, num);\n targetArray.set(sourceArray);\n\n return target;\n };\n })();\n }\n\n // ---------------------------------------------------\n\n /**\n * Helpers.\n */\n\n function toUtf8(str) {\n if (/[\\u0080-\\uFFFF]/.test(str)) {\n str = unescape(encodeURIComponent(str));\n }\n\n return str;\n }\n\n function utf8Str2ArrayBuffer(str, returnUInt8Array) {\n var length = str.length,\n buff = new ArrayBuffer(length),\n arr = new Uint8Array(buff),\n i;\n\n for (i = 0; i < length; i += 1) {\n arr[i] = str.charCodeAt(i);\n }\n\n return returnUInt8Array ? arr : buff;\n }\n\n function arrayBuffer2Utf8Str(buff) {\n return String.fromCharCode.apply(null, new Uint8Array(buff));\n }\n\n function concatenateArrayBuffers(first, second, returnUInt8Array) {\n var result = new Uint8Array(first.byteLength + second.byteLength);\n\n result.set(new Uint8Array(first));\n result.set(new Uint8Array(second), first.byteLength);\n\n return returnUInt8Array ? result : result.buffer;\n }\n\n function hexToBinaryString(hex) {\n var bytes = [],\n length = hex.length,\n x;\n\n for (x = 0; x < length - 1; x += 2) {\n bytes.push(parseInt(hex.substr(x, 2), 16));\n }\n\n return String.fromCharCode.apply(String, bytes);\n }\n\n // ---------------------------------------------------\n\n /**\n * SparkMD5 OOP implementation.\n *\n * Use this class to perform an incremental md5, otherwise use the\n * static methods instead.\n */\n\n function SparkMD5() {\n // call reset to init the instance\n this.reset();\n }\n\n /**\n * Appends a string.\n * A conversion will be applied if an utf8 string is detected.\n *\n * @param {String} str The string to be appended\n *\n * @return {SparkMD5} The instance itself\n */\n SparkMD5.prototype.append = function (str) {\n // Converts the string to utf8 bytes if necessary\n // Then append as binary\n this.appendBinary(toUtf8(str));\n\n return this;\n };\n\n /**\n * Appends a binary string.\n *\n * @param {String} contents The binary string to be appended\n *\n * @return {SparkMD5} The instance itself\n */\n SparkMD5.prototype.appendBinary = function (contents) {\n this._buff += contents;\n this._length += contents.length;\n\n var length = this._buff.length,\n i;\n\n for (i = 64; i <= length; i += 64) {\n md5cycle(this._hash, md5blk(this._buff.substring(i - 64, i)));\n }\n\n this._buff = this._buff.substring(i - 64);\n\n return this;\n };\n\n /**\n * Finishes the incremental computation, reseting the internal state and\n * returning the result.\n *\n * @param {Boolean} raw True to get the raw string, false to get the hex string\n *\n * @return {String} The result\n */\n SparkMD5.prototype.end = function (raw) {\n var buff = this._buff,\n length = buff.length,\n i,\n tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n ret;\n\n for (i = 0; i < length; i += 1) {\n tail[i >> 2] |= buff.charCodeAt(i) << ((i % 4) << 3);\n }\n\n this._finish(tail, length);\n ret = hex(this._hash);\n\n if (raw) {\n ret = hexToBinaryString(ret);\n }\n\n this.reset();\n\n return ret;\n };\n\n /**\n * Resets the internal state of the computation.\n *\n * @return {SparkMD5} The instance itself\n */\n SparkMD5.prototype.reset = function () {\n this._buff = '';\n this._length = 0;\n this._hash = [1732584193, -271733879, -1732584194, 271733878];\n\n return this;\n };\n\n /**\n * Gets the internal state of the computation.\n *\n * @return {Object} The state\n */\n SparkMD5.prototype.getState = function () {\n return {\n buff: this._buff,\n length: this._length,\n hash: this._hash\n };\n };\n\n /**\n * Gets the internal state of the computation.\n *\n * @param {Object} state The state\n *\n * @return {SparkMD5} The instance itself\n */\n SparkMD5.prototype.setState = function (state) {\n this._buff = state.buff;\n this._length = state.length;\n this._hash = state.hash;\n\n return this;\n };\n\n /**\n * Releases memory used by the incremental buffer and other additional\n * resources. If you plan to use the instance again, use reset instead.\n */\n SparkMD5.prototype.destroy = function () {\n delete this._hash;\n delete this._buff;\n delete this._length;\n };\n\n /**\n * Finish the final calculation based on the tail.\n *\n * @param {Array} tail The tail (will be modified)\n * @param {Number} length The length of the remaining buffer\n */\n SparkMD5.prototype._finish = function (tail, length) {\n var i = length,\n tmp,\n lo,\n hi;\n\n tail[i >> 2] |= 0x80 << ((i % 4) << 3);\n if (i > 55) {\n md5cycle(this._hash, tail);\n for (i = 0; i < 16; i += 1) {\n tail[i] = 0;\n }\n }\n\n // Do the final computation based on the tail and length\n // Beware that the final length may not fit in 32 bits so we take care of that\n tmp = this._length * 8;\n tmp = tmp.toString(16).match(/(.*?)(.{0,8})$/);\n lo = parseInt(tmp[2], 16);\n hi = parseInt(tmp[1], 16) || 0;\n\n tail[14] = lo;\n tail[15] = hi;\n md5cycle(this._hash, tail);\n };\n\n /**\n * Performs the md5 hash on a string.\n * A conversion will be applied if utf8 string is detected.\n *\n * @param {String} str The string\n * @param {Boolean} raw True to get the raw string, false to get the hex string\n *\n * @return {String} The result\n */\n SparkMD5.hash = function (str, raw) {\n // Converts the string to utf8 bytes if necessary\n // Then compute it using the binary function\n return SparkMD5.hashBinary(toUtf8(str), raw);\n };\n\n /**\n * Performs the md5 hash on a binary string.\n *\n * @param {String} content The binary string\n * @param {Boolean} raw True to get the raw string, false to get the hex string\n *\n * @return {String} The result\n */\n SparkMD5.hashBinary = function (content, raw) {\n var hash = md51(content),\n ret = hex(hash);\n\n return raw ? hexToBinaryString(ret) : ret;\n };\n\n // ---------------------------------------------------\n\n /**\n * SparkMD5 OOP implementation for array buffers.\n *\n * Use this class to perform an incremental md5 ONLY for array buffers.\n */\n SparkMD5.ArrayBuffer = function () {\n // call reset to init the instance\n this.reset();\n };\n\n /**\n * Appends an array buffer.\n *\n * @param {ArrayBuffer} arr The array to be appended\n *\n * @return {SparkMD5.ArrayBuffer} The instance itself\n */\n SparkMD5.ArrayBuffer.prototype.append = function (arr) {\n var buff = concatenateArrayBuffers(this._buff.buffer, arr, true),\n length = buff.length,\n i;\n\n this._length += arr.byteLength;\n\n for (i = 64; i <= length; i += 64) {\n md5cycle(this._hash, md5blk_array(buff.subarray(i - 64, i)));\n }\n\n this._buff = (i - 64) < length ? new Uint8Array(buff.buffer.slice(i - 64)) : new Uint8Array(0);\n\n return this;\n };\n\n /**\n * Finishes the incremental computation, reseting the internal state and\n * returning the result.\n *\n * @param {Boolean} raw True to get the raw string, false to get the hex string\n *\n * @return {String} The result\n */\n SparkMD5.ArrayBuffer.prototype.end = function (raw) {\n var buff = this._buff,\n length = buff.length,\n tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n i,\n ret;\n\n for (i = 0; i < length; i += 1) {\n tail[i >> 2] |= buff[i] << ((i % 4) << 3);\n }\n\n this._finish(tail, length);\n ret = hex(this._hash);\n\n if (raw) {\n ret = hexToBinaryString(ret);\n }\n\n this.reset();\n\n return ret;\n };\n\n /**\n * Resets the internal state of the computation.\n *\n * @return {SparkMD5.ArrayBuffer} The instance itself\n */\n SparkMD5.ArrayBuffer.prototype.reset = function () {\n this._buff = new Uint8Array(0);\n this._length = 0;\n this._hash = [1732584193, -271733879, -1732584194, 271733878];\n\n return this;\n };\n\n /**\n * Gets the internal state of the computation.\n *\n * @return {Object} The state\n */\n SparkMD5.ArrayBuffer.prototype.getState = function () {\n var state = SparkMD5.prototype.getState.call(this);\n\n // Convert buffer to a string\n state.buff = arrayBuffer2Utf8Str(state.buff);\n\n return state;\n };\n\n /**\n * Gets the internal state of the computation.\n *\n * @param {Object} state The state\n *\n * @return {SparkMD5.ArrayBuffer} The instance itself\n */\n SparkMD5.ArrayBuffer.prototype.setState = function (state) {\n // Convert string to buffer\n state.buff = utf8Str2ArrayBuffer(state.buff, true);\n\n return SparkMD5.prototype.setState.call(this, state);\n };\n\n SparkMD5.ArrayBuffer.prototype.destroy = SparkMD5.prototype.destroy;\n\n SparkMD5.ArrayBuffer.prototype._finish = SparkMD5.prototype._finish;\n\n /**\n * Performs the md5 hash on an array buffer.\n *\n * @param {ArrayBuffer} arr The array buffer\n * @param {Boolean} raw True to get the raw string, false to get the hex one\n *\n * @return {String} The result\n */\n SparkMD5.ArrayBuffer.hash = function (arr, raw) {\n var hash = md51_array(new Uint8Array(arr)),\n ret = hex(hash);\n\n return raw ? hexToBinaryString(ret) : ret;\n };\n\n return SparkMD5;\n}));\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNS5qcyIsInNvdXJjZXMiOlsid2VicGFjazovLy8uL25vZGVfbW9kdWxlcy9zcGFyay1tZDUvc3BhcmstbWQ1LmpzPzY5YTAiXSwic291cmNlc0NvbnRlbnQiOlsiKGZ1bmN0aW9uIChmYWN0b3J5KSB7XG4gICAgaWYgKHR5cGVvZiBleHBvcnRzID09PSAnb2JqZWN0Jykge1xuICAgICAgICAvLyBOb2RlL0NvbW1vbkpTXG4gICAgICAgIG1vZHVsZS5leHBvcnRzID0gZmFjdG9yeSgpO1xuICAgIH0gZWx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AoeCA+PiAxNikgKyAoeSA+PiAxNikgKyAobHN3ID4+IDE2KTtcbiAgICAgICAgICAgIHJldHVybiAobXN3IDw8IDE2KSB8IChsc3cgJiAweEZGRkYpO1xuICAgICAgICB9O1xuICAgIH1cblxuICAgIC8vIC0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLVxuXG4gICAgLyoqXG4gICAgICogQXJyYXlCdWZmZXIgc2xpY2UgcG9seWZpbGwuXG4gICAgICpcbiAgICAgKiBAc2VlIGh0dHBzOi8vZ2l0aHViLmNvbS90dGF1YmVydC9ub2RlLWFycmF5YnVmZmVyLXNsaWNlXG4gICAgICovXG5cbiAgICBpZiAodHlwZW9mIEFycmF5QnVmZmVyICE9PSAndW5kZWZpbmVkJyAmJiAhQXJyYXlCdWZmZXIucHJvdG90eXBlLnNsaWNlKSB7XG4gICAgICAgIChmdW5jdGlvbiAoKSB7XG4gICAgICAgICAgICBmdW5jdGlvbiBjbGFtcCh2YWwsIGxlbmd0aCkge1xuICAgICAgICAgICAgICAgIHZhbCA9ICh2YWwgfCAwKSB8fCAwO1xuXG4gICAgICAgICAgICAgICAgaWYgKHZhbCA8IDApIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE1hdGgubWF4KHZhbCArIGxlbmd0aCwgMCk7XG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgcmV0dXJuIE1hdGgubWluKHZhbCwgbGVuZ3RoKTtcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgQXJyYXlCdWZmZXIucHJvdG90eXBlLnNsaWNlID0gZnVuY3Rpb24gKGZyb20sIHRvKSB7XG4gICAgICAgICAgICAgICAgdmFyIGxlbmd0aCA9IHRoaXMuYnl0ZUxlbmd0aCxcbiAgICAgICAgICAgICAgICAgICAgYmVnaW4gPSBjbGFtcChmcm9tLCBsZW5ndGgpLFxuICAgICAgICAgICAgICAgICAgICBlbmQgPSBsZW5ndGgsXG4gICAgICAgICAgICAgICAgICAgIG51bSxcbiAgICAgICAgICAgICAgICAgICAgdGFyZ2V0LFxuICAgICAgICAgICAgICAgICAgICB0YXJnZXRBcnJheSxcbiAgICAgICAgICAgICAgICAgICAgc291cmNlQXJyYXk7XG5cbiAgICAgICAgICAgICAgICBpZiAodG8gIT09IHVuZGVmaW5lZCkge1xuICAgICAgICAgICAgICAgICAgICBlbmQgPSBjbGFtcCh0bywgbGVuZ3RoKTtcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICBpZiAoYmVnaW4gPiBlbmQpIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG5ldyBBcnJheUJ1ZmZlcigwKTtcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICBudW0gPSBlbmQgLSBiZWdpbjtcbiAgICAgICAgICAgICAgICB0YXJnZXQgPSBuZXcgQXJyYXlCdWZmZXIobnVtKTtcbiAgICAgICAgICAgICAgICB0YXJnZXRBcnJheSA9IG5ldyBVaW50OEFycmF5KHRhcmdldCk7XG5cbiAgICAgICAgICAgICAgICBzb3VyY2VBcnJheSA9IG5ldyBVaW50OEFycmF5KHRoaXMsIGJlZ2luLCBudW0pO1xuICAgICAgICAgICAgICAgIHRhcmdldEFycmF5LnNldChzb3VyY2VBcnJheSk7XG5cbiAgICAgICAgICAgICAgICByZXR1cm4gdGFyZ2V0O1xuICAgICAgICAgICAgfTtcbiAgICAgICAgfSkoKTtcbiAgICB9XG5cbiAgICAvLyAtLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS1cblxuICAgIC8qKlxuICAgICAqIEhlbHBlcnMuXG4gICAgICovXG5cbiAgICBmdW5jdGlvbiB0b1V0Zjgoc3RyKSB7XG4gICAgICAgIGlmICgvW1xcdTAwODAtXFx1RkZGRl0vLnRlc3Qoc3RyKSkge1xuICAgICAgICAgICAgc3RyID0gdW5lc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VzZXQoKTtcblxuICAgICAgICByZXR1cm4gcmV0O1xuICAgIH07XG5cbiAgICAvKipcbiAgICAgKiBSZXNldHMgdGhlIGludGVybmFsIHN0YXRlIG9mIHRoZSBjb21wdXRhdGlvbi5cbiAgICAgKlxuICAgICAqIEByZXR1cm4ge1NwYXJrTUQ1fSBUaGUgaW5zdGFuY2UgaXRzZWxmXG4gICAgICovXG4gICAgU3BhcmtNRDUucHJvdG90eXBlLnJlc2V0ID0gZnVuY3Rpb24gKCkge1xuICAgICAgICB0aGlzLl9idWZmID0gJyc7XG4gICAgICAgIHRoaXMuX2xlbmd0aCA9IDA7XG4gICAgICAgIHRoaXMuX2hhc2ggPSBbMTczMjU4NDE5MywgLTI3MTczMzg3OSwgLTE3MzI1ODQxOTQsIDI3MTczMzg3OF07XG5cbiAgICAgICAgcmV0dXJuIHRoaXM7XG4gICAgfTtcblxuICAgIC8qKlxuICAgICAqIEdldHMgdGhlIGludGVybmFsIHN0YXRlIG9mIHRoZSBjb21wdXRhdGlvbi5cbiAgICAgKlxuICAgICAqIEByZXR1cm4ge09iamVjdH0gVGhlIHN0YXRlXG4gICAgICovXG4gICAgU3BhcmtNRDUucHJvdG90eXBlLmdldFN0YXRlID0gZnVuY3Rpb24gKCkge1xuICAgICAgICByZXR1cm4ge1xuICAgICAgICAgICAgYnVmZjogdGhpcy5fYnVmZixcbiAgICAgICAgICAgIGxlbmd0aDogdGhpcy5fbGVuZ3RoLFxuICAgICAgICAgICAgaGFzaDogdGhpcy5faGFzaFxuICAgICAgICB9O1xuICAgIH07XG5cbiAgICAvKipcbiAgICAgKiBHZXRzIHRoZSBpbnRlcm5hbCBzdGF0ZSBvZiB0aGUgY29tcHV0YXRpb24uXG4gICAgICpcbiAgICAgKiBAcGFyYW0ge09iamVjdH0gc3RhdGUgVGhlIHN0YXRlXG4gICAgICpcbiAgICAgKiBAcmV0dXJuIHtTcGFya01ENX0gVGhlIGluc3RhbmNlIGl0c2VsZlxuICAgICAqL1xuICAgIF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FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTsiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///5\n")},function(module,exports,__webpack_require__){"use strict";eval("\n\nmodule.exports = function bind(fn, thisArg) {\n return function wrap() {\n var args = new Array(arguments.length);\n for (var i = 0; i < args.length; i++) {\n args[i] = arguments[i];\n }\n return fn.apply(thisArg, args);\n };\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNi5qcyIsInNvdXJjZXMiOlsid2VicGFjazovLy8uL25vZGVfbW9kdWxlcy9heGlvcy9saWIvaGVscGVycy9iaW5kLmpzPzFkMmIiXSwic291cmNlc0NvbnRlbnQiOlsiJ3VzZSBzdHJpY3QnO1xuXG5tb2R1bGUuZXhwb3J0cyA9IGZ1bmN0aW9uIGJpbmQoZm4sIHRoaXNBcmcpIHtcbiAgcmV0dXJuIGZ1bmN0aW9uIHdyYXAoKSB7XG4gICAgdmFyIGFyZ3MgPSBuZXcgQXJyYXkoYXJndW1lbnRzLmxlbmd0aCk7XG4gICAgZm9yICh2YXIgaSA9IDA7IGkgPCBhcmdzLmxlbmd0aDsgaSsrKSB7XG4gICAgICBhcmdzW2ldID0gYXJndW1lbnRzW2ldO1xuICAgIH1cbiAgICByZXR1cm4gZm4uYXBwbHkodGhpc0FyZywgYXJncyk7XG4gIH07XG59O1xuIl0sIm1hcHBpbmdzIjoiQUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOyIsInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///6\n")},function(module,exports,__webpack_require__){"use strict";eval("\n\nvar utils = __webpack_require__(0);\n\nfunction encode(val) {\n return encodeURIComponent(val).\n replace(/%40/gi, '@').\n replace(/%3A/gi, ':').\n replace(/%24/g, '$').\n replace(/%2C/gi, ',').\n replace(/%20/g, '+').\n replace(/%5B/gi, '[').\n replace(/%5D/gi, ']');\n}\n\n/**\n * Build a URL by appending params to the end\n *\n * @param {string} url The base of the url (e.g., http://www.google.com)\n * @param {object} [params] The params to be appended\n * @returns {string} The formatted url\n */\nmodule.exports = function buildURL(url, params, paramsSerializer) {\n /*eslint no-param-reassign:0*/\n if (!params) {\n return url;\n }\n\n var serializedParams;\n if (paramsSerializer) {\n serializedParams = paramsSerializer(params);\n } else if (utils.isURLSearchParams(params)) {\n serializedParams = params.toString();\n } else {\n var parts = [];\n\n utils.forEach(params, function serialize(val, key) {\n if (val === null || typeof val === 'undefined') {\n return;\n }\n\n if (utils.isArray(val)) {\n key = key + '[]';\n } else {\n val = [val];\n }\n\n utils.forEach(val, function parseValue(v) {\n if (utils.isDate(v)) {\n v = v.toISOString();\n } else if (utils.isObject(v)) {\n v = JSON.stringify(v);\n }\n parts.push(encode(key) + '=' + encode(v));\n });\n });\n\n serializedParams = parts.join('&');\n }\n\n if (serializedParams) {\n var hashmarkIndex = url.indexOf('#');\n if (hashmarkIndex !== -1) {\n url = url.slice(0, hashmarkIndex);\n }\n\n url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;\n }\n\n return url;\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNy5qcyIsInNvdXJjZXMiOlsid2VicGFjazovLy8uL25vZGVfbW9kdWxlcy9heGlvcy9saWIvaGVscGVycy9idWlsZFVSTC5qcz8zMGI1Il0sInNvdXJjZXNDb250ZW50IjpbIid1c2Ugc3RyaWN0JztcblxudmFyIHV0aWxzID0gcmVxdWlyZSgnLi8uLi91dGlscycpO1xuXG5mdW5jdGlvbiBlbmNvZGUodmFsKSB7XG4gIHJldHVybiBlbmNvZGVVUklDb21wb25lbnQodmFsKS5cbiAgICByZXBsYWNlKC8lNDAvZ2ksICdAJykuXG4gICAgcmVwbGFjZSgvJTNBL2dpLCAnOicpLlxuICAgIHJlcGxhY2UoLyUyNC9nLCAnJCcpLlxuICAgIHJlcGxhY2UoLyUyQy9naSwgJywnKS5cbiAgICByZXBsYWNlKC8lMjAvZywgJysnKS5cbiAgICByZXBsYWNlKC8lNUIvZ2ksICdbJykuXG4gICAgcmVwbGFjZSgvJTVEL2dpLCAnXScpO1xufVxuXG4vKipcbiAqIEJ1aWxkIGEgVVJMIGJ5IGFwcGVuZGluZyBwYXJhbXMgdG8gdGhlIGVuZFxuICpcbiAqIEBwYXJhbSB7c3RyaW5nfSB1cmwgVGhlIGJhc2Ugb2YgdGhlIHVybCAoZS5nLiwgaHR0cDovL3d3dy5nb29nbGUuY29tKVxuICogQHBhcmFtIHtvYmplY3R9IFtwYXJhbXNdIFRoZSBwYXJhbXMgdG8gYmUgYXBwZW5kZWRcbiAqIEByZXR1cm5zIHtzdHJpbmd9IFRoZSBmb3JtYXR0ZWQgdXJsXG4gKi9cbm1vZHVsZS5leHBvcnRzID0gZnVuY3Rpb24gYnVpbGRVUkwodXJsLCBwYXJhbXMsIHBhcmFtc1NlcmlhbGl6ZXIpIHtcbiAgLyplc2xpbnQgbm8tcGFyYW0tcmVhc3NpZ246MCov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aW4oJyYnKTtcbiAgfVxuXG4gIGlmIChzZXJpYWxpemVkUGFyYW1zKSB7XG4gICAgdmFyIGhhc2htYXJrSW5kZXggPSB1cmwuaW5kZXhPZignIycpO1xuICAgIGlmIChoYXNobWFya0luZGV4ICE9PSAtMSkge1xuICAgICAgdXJsID0gdXJsLnNsaWNlKDAsIGhhc2htYXJrSW5kZXgpO1xuICAgIH1cblxuICAgIHVybCArPSAodXJsLmluZGV4T2YoJz8nKSA9PT0gLTEgPyAnPycgOiAnJicpICsgc2VyaWFsaXplZFBhcmFtcztcbiAgfVxuXG4gIHJldHVybiB1cmw7XG59O1xuIl0sIm1hcHBpbmdzIjoiQUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOyIsInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///7\n")},function(module,exports,__webpack_require__){"use strict";eval("\n\nmodule.exports = function isCancel(value) {\n return !!(value && value.__CANCEL__);\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiOC5qcyIsInNvdXJjZXMiOlsid2VicGFjazovLy8uL25vZGVfbW9kdWxlcy9heGlvcy9saWIvY2FuY2VsL2lzQ2FuY2VsLmpzPzJlNjciXSwic291cmNlc0NvbnRlbnQiOlsiJ3VzZSBzdHJpY3QnO1xuXG5tb2R1bGUuZXhwb3J0cyA9IGZ1bmN0aW9uIGlzQ2FuY2VsKHZhbHVlKSB7XG4gIHJldHVybiAhISh2YWx1ZSAmJiB2YWx1ZS5fX0NBTkNFTF9fKTtcbn07XG4iXSwibWFwcGluZ3MiOiJBQUFBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7Iiwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///8\n")},function(module,exports,__webpack_require__){"use strict";eval("/* WEBPACK VAR INJECTION */(function(process) {\n\nvar utils = __webpack_require__(0);\nvar normalizeHeaderName = __webpack_require__(25);\n\nvar DEFAULT_CONTENT_TYPE = {\n 'Content-Type': 'application/x-www-form-urlencoded'\n};\n\nfunction setContentTypeIfUnset(headers, value) {\n if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) {\n headers['Content-Type'] = value;\n }\n}\n\nfunction getDefaultAdapter() {\n var adapter;\n // Only Node.JS has a process variable that is of [[Class]] process\n if (typeof process !== 'undefined' && Object.prototype.toString.call(process) === '[object process]') {\n // For node use HTTP adapter\n adapter = __webpack_require__(10);\n } else if (typeof XMLHttpRequest !== 'undefined') {\n // For browsers use XHR adapter\n adapter = __webpack_require__(10);\n }\n return adapter;\n}\n\nvar defaults = {\n adapter: getDefaultAdapter(),\n\n transformRequest: [function transformRequest(data, headers) {\n normalizeHeaderName(headers, 'Accept');\n normalizeHeaderName(headers, 'Content-Type');\n if (utils.isFormData(data) ||\n utils.isArrayBuffer(data) ||\n utils.isBuffer(data) ||\n utils.isStream(data) ||\n utils.isFile(data) ||\n utils.isBlob(data)\n ) {\n return data;\n }\n if (utils.isArrayBufferView(data)) {\n return data.buffer;\n }\n if (utils.isURLSearchParams(data)) {\n setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8');\n return data.toString();\n }\n if (utils.isObject(data)) {\n setContentTypeIfUnset(headers, 'application/json;charset=utf-8');\n return JSON.stringify(data);\n }\n return data;\n }],\n\n transformResponse: [function transformResponse(data) {\n /*eslint no-param-reassign:0*/\n if (typeof data === 'string') {\n try {\n data = JSON.parse(data);\n } catch (e) { /* Ignore */ }\n }\n return data;\n }],\n\n /**\n * A timeout in milliseconds to abort a request. If set to 0 (default) a\n * timeout is not created.\n */\n timeout: 0,\n\n xsrfCookieName: 'XSRF-TOKEN',\n xsrfHeaderName: 'X-XSRF-TOKEN',\n\n maxContentLength: -1,\n\n validateStatus: function validateStatus(status) {\n return status >= 200 && status < 300;\n }\n};\n\ndefaults.headers = {\n common: {\n 'Accept': 'application/json, text/plain, */*'\n }\n};\n\nutils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {\n defaults.headers[method] = {};\n});\n\nutils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {\n defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);\n});\n\nmodule.exports = defaults;\n\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(24)))//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiOS5qcyIsInNvdXJjZXMiOlsid2VicGFjazovLy8uL25vZGVfbW9kdWxlcy9heGlvcy9saWIvZGVmYXVsdHMuanM/MjQ0NCJdLCJzb3VyY2VzQ29udGVudCI6WyIndXNlIHN0cmljdCc7XG5cbnZhciB1dGlscyA9IHJlcXVpcmUoJy4vdXRpbHMnKTtcbnZhciBub3JtYWxpemVIZWFkZXJOYW1lID0gcmVxdWlyZSgnLi9oZWxwZXJzL25vcm1hbGl6ZUhlYWRlck5hbWUnKTtcblxudmFyIERFRkFVTFRfQ09OVEVOVF9UWVBFID0ge1xuICAnQ29udGVudC1UeXBlJzogJ2FwcGxpY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0aG9kV2l0aERhdGEobWV0aG9kKSB7XG4gIGRlZmF1bHRzLmhlYWRlcnNbbWV0aG9kXSA9IHV0aWxzLm1lcmdlKERFRkFVTFRfQ09OVEVOVF9UWVBFKTtcbn0pO1xuXG5tb2R1bGUuZXhwb3J0cyA9IGRlZmF1bHRzO1xuIl0sIm1hcHBpbmdzIjoiQUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBIiwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///9\n")},function(module,exports,__webpack_require__){"use strict";eval("\n\nvar utils = __webpack_require__(0);\nvar settle = __webpack_require__(26);\nvar buildURL = __webpack_require__(7);\nvar parseHeaders = __webpack_require__(28);\nvar isURLSameOrigin = __webpack_require__(29);\nvar createError = __webpack_require__(11);\n\nmodule.exports = function xhrAdapter(config) {\n return new Promise(function dispatchXhrRequest(resolve, reject) {\n var requestData = config.data;\n var requestHeaders = config.headers;\n\n if (utils.isFormData(requestData)) {\n delete requestHeaders['Content-Type']; // Let the browser set it\n }\n\n var request = new XMLHttpRequest();\n\n // HTTP basic authentication\n if (config.auth) {\n var username = config.auth.username || '';\n var password = config.auth.password || '';\n requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password);\n }\n\n request.open(config.method.toUpperCase(), buildURL(config.url, config.params, config.paramsSerializer), true);\n\n // Set the request timeout in MS\n request.timeout = config.timeout;\n\n // Listen for ready state\n request.onreadystatechange = function handleLoad() {\n if (!request || request.readyState !== 4) {\n return;\n }\n\n // The request errored out and we didn't get a response, this will be\n // handled by onerror instead\n // With one exception: request that using file: protocol, most browsers\n // will return status as 0 even though it's a successful request\n if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {\n return;\n }\n\n // Prepare the response\n var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null;\n var responseData = !config.responseType || config.responseType === 'text' ? request.responseText : request.response;\n var response = {\n data: responseData,\n status: request.status,\n statusText: request.statusText,\n headers: responseHeaders,\n config: config,\n request: request\n };\n\n settle(resolve, reject, response);\n\n // Clean up request\n request = null;\n };\n\n // Handle browser request cancellation (as opposed to a manual cancellation)\n request.onabort = function handleAbort() {\n if (!request) {\n return;\n }\n\n reject(createError('Request aborted', config, 'ECONNABORTED', request));\n\n // Clean up request\n request = null;\n };\n\n // Handle low level network errors\n request.onerror = function handleError() {\n // Real errors are hidden from us by the browser\n // onerror should only fire if it's a network error\n reject(createError('Network Error', config, null, request));\n\n // Clean up request\n request = null;\n };\n\n // Handle timeout\n request.ontimeout = function handleTimeout() {\n reject(createError('timeout of ' + config.timeout + 'ms exceeded', config, 'ECONNABORTED',\n request));\n\n // Clean up request\n request = null;\n };\n\n // Add xsrf header\n // This is only done if running in a standard browser environment.\n // Specifically not if we're in a web worker, or react-native.\n if (utils.isStandardBrowserEnv()) {\n var cookies = __webpack_require__(30);\n\n // Add xsrf header\n var xsrfValue = (config.withCredentials || isURLSameOrigin(config.url)) && config.xsrfCookieName ?\n cookies.read(config.xsrfCookieName) :\n undefined;\n\n if (xsrfValue) {\n requestHeaders[config.xsrfHeaderName] = xsrfValue;\n }\n }\n\n // Add headers to the request\n if ('setRequestHeader' in request) {\n utils.forEach(requestHeaders, function setRequestHeader(val, key) {\n if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') {\n // Remove Content-Type if data is undefined\n delete requestHeaders[key];\n } else {\n // Otherwise add header to the request\n request.setRequestHeader(key, val);\n }\n });\n }\n\n // Add withCredentials to request if needed\n if (config.withCredentials) {\n request.withCredentials = true;\n }\n\n // Add responseType to request if needed\n if (config.responseType) {\n try {\n request.responseType = config.responseType;\n } catch (e) {\n // Expected DOMException thrown by browsers not compatible XMLHttpRequest Level 2.\n // But, this can be suppressed for 'json' type as it can be parsed by default 'transformResponse' function.\n if (config.responseType !== 'json') {\n throw e;\n }\n }\n }\n\n // Handle progress if needed\n if (typeof config.onDownloadProgress === 'function') {\n request.addEventListener('progress', config.onDownloadProgress);\n }\n\n // Not all browsers support upload events\n if (typeof config.onUploadProgress === 'function' && request.upload) {\n request.upload.addEventListener('progress', config.onUploadProgress);\n }\n\n if (config.cancelToken) {\n // Handle cancellation\n config.cancelToken.promise.then(function onCanceled(cancel) {\n if (!request) {\n return;\n }\n\n request.abort();\n reject(cancel);\n // Clean up request\n request = null;\n });\n }\n\n if (requestData === undefined) {\n requestData = null;\n }\n\n // Send the request\n request.send(requestData);\n });\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMTAuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYXhpb3MvbGliL2FkYXB0ZXJ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0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOyIsInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///10\n")},function(module,exports,__webpack_require__){"use strict";eval("\n\nvar enhanceError = __webpack_require__(27);\n\n/**\n * Create an Error with the specified message, config, error code, request and response.\n *\n * @param {string} message The error message.\n * @param {Object} config The config.\n * @param {string} [code] The error code (for example, 'ECONNABORTED').\n * @param {Object} [request] The request.\n * @param {Object} [response] The response.\n * @returns {Error} The created error.\n */\nmodule.exports = function createError(message, config, code, request, response) {\n var error = new Error(message);\n return enhanceError(error, config, code, request, response);\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMTEuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYXhpb3MvbGliL2NvcmUvY3JlYXRlRXJyb3IuanM/MmQ4MyJdLCJzb3VyY2VzQ29udGVudCI6WyIndXNlIHN0cmljdCc7XG5cbnZhciBlbmhhbmNlRXJyb3IgPSByZXF1aXJlKCcuL2VuaGFuY2VFcnJvcicpO1xuXG4vKipcbiAqIENyZWF0ZSBhbiBFcnJvciB3aXRoIHRoZSBzcGVjaWZpZWQgbWVzc2FnZSwgY29uZmlnLCBlcnJvciBjb2RlLCByZXF1ZXN0IGFuZCByZXNwb25zZS5cbiAqXG4gKiBAcGFyYW0ge3N0cmluZ30gbWVzc2FnZSBUaGUgZXJyb3IgbWVzc2FnZS5cbiAqIEBwYXJhbSB7T2JqZWN0fSBjb25maWcgVGhlIGNvbmZpZy5cbiAqIEBwYXJhbSB7c3RyaW5nfSBbY29kZV0gVGhlIGVycm9yIGNvZGUgKGZvciBleGFtcGxlLCAnRUNPTk5BQk9SVEVEJykuXG4gKiBAcGFyYW0ge09iamVjdH0gW3JlcXVlc3RdIFRoZSByZXF1ZXN0LlxuICogQHBhcmFtIHtPYmplY3R9IFtyZXNwb25zZV0gVGhlIHJlc3BvbnNlLlxuICogQHJldHVybnMge0Vycm9yfSBUaGUgY3JlYXRlZCBlcnJvci5cbiAqL1xubW9kdWxlLmV4cG9ydHMgPSBmdW5jdGlvbiBjcmVhdGVFcnJvcihtZXNzYWdlLCBjb25maWcsIGNvZGUsIHJlcXVlc3QsIHJlc3BvbnNlKSB7XG4gIHZhciBlcnJvciA9IG5ldyBFcnJvcihtZXNzYWdlKTtcbiAgcmV0dXJuIGVuaGFuY2VFcnJvcihlcnJvciwgY29uZmlnLCBjb2RlLCByZXF1ZXN0LCByZXNwb25zZSk7XG59O1xuIl0sIm1hcHBpbmdzIjoiQUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7Iiwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///11\n")},function(module,exports,__webpack_require__){"use strict";eval("\n\nvar utils = __webpack_require__(0);\n\n/**\n * Config-specific merge-function which creates a new config-object\n * by merging two configuration objects together.\n *\n * @param {Object} config1\n * @param {Object} config2\n * @returns {Object} New object resulting from merging config2 to config1\n */\nmodule.exports = function mergeConfig(config1, config2) {\n // eslint-disable-next-line no-param-reassign\n config2 = config2 || {};\n var config = {};\n\n utils.forEach(['url', 'method', 'params', 'data'], function valueFromConfig2(prop) {\n if (typeof config2[prop] !== 'undefined') {\n config[prop] = config2[prop];\n }\n });\n\n utils.forEach(['headers', 'auth', 'proxy'], function mergeDeepProperties(prop) {\n if (utils.isObject(config2[prop])) {\n config[prop] = utils.deepMerge(config1[prop], config2[prop]);\n } else if (typeof config2[prop] !== 'undefined') {\n config[prop] = config2[prop];\n } else if (utils.isObject(config1[prop])) {\n config[prop] = utils.deepMerge(config1[prop]);\n } else if (typeof config1[prop] !== 'undefined') {\n config[prop] = config1[prop];\n }\n });\n\n utils.forEach([\n 'baseURL', 'transformRequest', 'transformResponse', 'paramsSerializer',\n 'timeout', 'withCredentials', 'adapter', 'responseType', 'xsrfCookieName',\n 'xsrfHeaderName', 'onUploadProgress', 'onDownloadProgress', 'maxContentLength',\n 'validateStatus', 'maxRedirects', 'httpAgent', 'httpsAgent', 'cancelToken',\n 'socketPath'\n ], function defaultToConfig2(prop) {\n if (typeof config2[prop] !== 'undefined') {\n config[prop] = config2[prop];\n } else if (typeof config1[prop] !== 'undefined') {\n config[prop] = config1[prop];\n }\n });\n\n return config;\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMTIuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYXhpb3MvbGliL2NvcmUvbWVyZ2VDb25maWcuanM/NGE3YiJdLCJzb3VyY2VzQ29udGVudCI6WyIndXNlIHN0cmljdCc7XG5cbnZhciB1dGlscyA9IHJlcXVpcmUoJy4uL3V0aWxzJyk7XG5cbi8qKlxuICogQ29uZmlnLXNwZWNpZmljIG1lcmdlLWZ1bmN0aW9uIHdoaWNoIGNyZWF0ZXMgYSBuZXcgY29uZmlnLW9iamVjdFxuICogYnkgbWVyZ2luZyB0d28gY29uZmlndXJhdGlvbiBvYmplY3RzIHRvZ2V0aGVyLlxuICpcbiAqIEBwYXJhbSB7T2JqZWN0fSBjb25maWcxXG4gKiBAcGFyYW0ge09iamVjdH0gY29uZmlnMlxuICogQHJldHVybnMge09iamVjdH0gTmV3IG9iamVjdCByZXN1bHRpbmcgZnJvbSBtZXJnaW5nIGNvbmZpZzIgdG8gY29uZm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0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7Iiwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///12\n")},function(module,exports,__webpack_require__){"use strict";eval("\n\n/**\n * A `Cancel` is an object that is thrown when an operation is canceled.\n *\n * @class\n * @param {string=} message The message.\n */\nfunction Cancel(message) {\n this.message = message;\n}\n\nCancel.prototype.toString = function toString() {\n return 'Cancel' + (this.message ? ': ' + this.message : '');\n};\n\nCancel.prototype.__CANCEL__ = true;\n\nmodule.exports = Cancel;\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMTMuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYXhpb3MvbGliL2NhbmNlbC9DYW5jZWwuanM/N2E3NyJdLCJzb3VyY2VzQ29udGVudCI6WyIndXNlIHN0cmljdCc7XG5cbi8qKlxuICogQSBgQ2FuY2VsYCBpcyBhbiBvYmplY3QgdGhhdCBpcyB0aHJvd24gd2hlbiBhbiBvcGVyYXRpb24gaXMgY2FuY2VsZWQuXG4gKlxuICogQGNsYXNzXG4gKiBAcGFyYW0ge3N0cmluZz19IG1lc3NhZ2UgVGhlIG1lc3NhZ2UuXG4gKi9cbmZ1bmN0aW9uIENhbmNlbChtZXNzYWdlKSB7XG4gIHRoaXMubWVzc2FnZSA9IG1lc3NhZ2U7XG59XG5cbkNhbmNlbC5wcm90b3R5cGUudG9TdHJpbmcgPSBmdW5jdGlvbiB0b1N0cmluZygpIHtcbiAgcmV0dXJuICdDYW5jZWwnICsgKHRoaXMubWVzc2FnZSA/ICc6ICcgKyB0aGlzLm1lc3NhZ2UgOiAnJyk7XG59O1xuXG5DYW5jZWwucHJvdG90eXBlLl9fQ0FOQ0VMX18gPSB0cnVlO1xuXG5tb2R1bGUuZXhwb3J0cyA9IENhbmNlbDtcbiJdLCJtYXBwaW5ncyI6IkFBQUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7Iiwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///13\n")},,,function(module,exports,__webpack_require__){eval("// extracted by mini-css-extract-plugin//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMTYuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvcXVpbGwvYXNzZXRzL3Nub3cuc3R5bD80NjE5Il0sInNvdXJjZXNDb250ZW50IjpbIi8vIGV4dHJhY3RlZCBieSBtaW5pLWNzcy1leHRyYWN0LXBsdWdpbiJdLCJtYXBwaW5ncyI6IkFBQUEiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///16\n")},function(module,exports,__webpack_require__){eval("// extracted by mini-css-extract-plugin//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMTcuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9zcmMvcHJldmlldy5zdHlsPzFkMTMiXSwic291cmNlc0NvbnRlbnQiOlsiLy8gZXh0cmFjdGVkIGJ5IG1pbmktY3NzLWV4dHJhY3QtcGx1Z2luIl0sIm1hcHBpbmdzIjoiQUFBQSIsInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///17\n")},function(module,exports,__webpack_require__){"use strict";eval("\n\nvar utils = __webpack_require__(0);\nvar bind = __webpack_require__(6);\nvar Axios = __webpack_require__(20);\nvar mergeConfig = __webpack_require__(12);\nvar defaults = __webpack_require__(9);\n\n/**\n * Create an instance of Axios\n *\n * @param {Object} defaultConfig The default config for the instance\n * @return {Axios} A new instance of Axios\n */\nfunction createInstance(defaultConfig) {\n var context = new Axios(defaultConfig);\n var instance = bind(Axios.prototype.request, context);\n\n // Copy axios.prototype to instance\n utils.extend(instance, Axios.prototype, context);\n\n // Copy context to instance\n utils.extend(instance, context);\n\n return instance;\n}\n\n// Create the default instance to be exported\nvar axios = createInstance(defaults);\n\n// Expose Axios class to allow class inheritance\naxios.Axios = Axios;\n\n// Factory for creating new instances\naxios.create = function create(instanceConfig) {\n return createInstance(mergeConfig(axios.defaults, instanceConfig));\n};\n\n// Expose Cancel & CancelToken\naxios.Cancel = __webpack_require__(13);\naxios.CancelToken = __webpack_require__(33);\naxios.isCancel = __webpack_require__(8);\n\n// Expose all/spread\naxios.all = function all(promises) {\n return Promise.all(promises);\n};\naxios.spread = __webpack_require__(34);\n\nmodule.exports = axios;\n\n// Allow use of default import syntax in TypeScript\nmodule.exports.default = axios;\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMTguanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYXhpb3MvbGliL2F4aW9zLmpzP2NlZTQiXSwic291cmNlc0NvbnRlbnQiOlsiJ3VzZSBzdHJpY3QnO1xuXG52YXIgdXRpbHMgPSByZXF1aXJlKCcuL3V0aWxzJyk7XG52YXIgYmluZCA9IHJlcXVpcmUoJy4vaGVscGVycy9iaW5kJyk7XG52YXIgQXhpb3MgPSByZXF1aXJlKCcuL2NvcmUvQXhpb3MnKTtcbnZhciBtZXJnZUNvbmZpZyA9IHJlcXVpcmUoJy4vY29yZS9tZXJnZUNvbmZpZycpO1xudmFyIGRlZmF1bHRzID0gcmVxdWlyZSgnLi9kZWZhdWx0cycpO1xuXG4vKipc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ports){eval("/*!\n * Determine if an object is a Buffer\n *\n * @author Feross Aboukhadijeh \n * @license MIT\n */\n\nmodule.exports = function isBuffer (obj) {\n return obj != null && obj.constructor != null &&\n typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj)\n}\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMTkuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYXhpb3Mvbm9kZV9tb2R1bGVzL2lzLWJ1ZmZlci9pbmRleC5qcz9jN2NlIl0sInNvdXJjZXNDb250ZW50IjpbIi8qIVxuICogRGV0ZXJtaW5lIGlmIGFuIG9iamVjdCBpcyBhIEJ1ZmZlclxuICpcbiAqIEBhdXRob3IgICBGZXJvc3MgQWJvdWtoYWRpamVoIDxodHRwczovL2Zlcm9zcy5vcmc+XG4gKiBAbGljZW5zZSAgTUlUXG4gKi9cblxubW9kdWxlLmV4cG9ydHMgPSBmdW5jdGlvbiBpc0J1ZmZlciAob2JqKSB7XG4gIHJldHVybiBvYmogIT0gbnVsbCAmJiBvYmouY29uc3RydWN0b3IgIT0gbnVsbCAmJlxuICAgIHR5cGVvZiBvYmouY29uc3RydWN0b3IuaXNCdWZmZXIgPT09ICdmdW5jdGlvbicgJiYgb2JqLmNvbnN0cnVjdG9yLmlzQnVmZmVyKG9iailcbn1cbiJdLCJtYXBwaW5ncyI6IkFBQUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTsiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///19\n")},function(module,exports,__webpack_require__){"use strict";eval("\n\nvar utils = __webpack_require__(0);\nvar buildURL = __webpack_require__(7);\nvar InterceptorManager = __webpack_require__(21);\nvar dispatchRequest = __webpack_require__(22);\nvar mergeConfig = __webpack_require__(12);\n\n/**\n * Create a new instance of Axios\n *\n * @param {Object} instanceConfig The default config for the instance\n */\nfunction Axios(instanceConfig) {\n this.defaults = instanceConfig;\n this.interceptors = {\n request: new InterceptorManager(),\n response: new InterceptorManager()\n };\n}\n\n/**\n * Dispatch a request\n *\n * @param {Object} config The config specific for this request (merged with this.defaults)\n */\nAxios.prototype.request = function request(config) {\n /*eslint no-param-reassign:0*/\n // Allow for axios('example/url'[, config]) a la fetch API\n if (typeof config === 'string') {\n config = arguments[1] || {};\n config.url = arguments[0];\n } else {\n config = config || {};\n }\n\n config = mergeConfig(this.defaults, config);\n config.method = config.method ? config.method.toLowerCase() : 'get';\n\n // Hook up interceptors middleware\n var chain = [dispatchRequest, undefined];\n var promise = Promise.resolve(config);\n\n this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {\n chain.unshift(interceptor.fulfilled, interceptor.rejected);\n });\n\n this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {\n chain.push(interceptor.fulfilled, interceptor.rejected);\n });\n\n while (chain.length) {\n promise = promise.then(chain.shift(), chain.shift());\n }\n\n return promise;\n};\n\nAxios.prototype.getUri = function getUri(config) {\n config = mergeConfig(this.defaults, config);\n return buildURL(config.url, config.params, config.paramsSerializer).replace(/^\\?/, '');\n};\n\n// Provide aliases for supported request methods\nutils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {\n /*eslint func-names:0*/\n Axios.prototype[method] = function(url, config) {\n return this.request(utils.merge(config || {}, {\n method: method,\n url: url\n }));\n };\n});\n\nutils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {\n /*eslint func-names:0*/\n Axios.prototype[method] = function(url, data, config) {\n return this.request(utils.merge(config || {}, {\n method: method,\n url: url,\n data: data\n }));\n };\n});\n\nmodule.exports = Axios;\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMjAuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX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gIHJldHVybiB0aGlzLnJlcXVlc3QodXRpbHMubWVyZ2UoY29uZmlnIHx8IHt9LCB7XG4gICAgICBtZXRob2Q6IG1ldGhvZCxcbiAgICAgIHVybDogdXJsLFxuICAgICAgZGF0YTogZGF0YVxuICAgIH0pKTtcbiAgfTtcbn0pO1xuXG5tb2R1bGUuZXhwb3J0cyA9IEF4aW9zO1xuIl0sIm1hcHBpbmdzIjoiQUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOyIsInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///20\n")},function(module,exports,__webpack_require__){"use strict";eval("\n\nvar utils = __webpack_require__(0);\n\nfunction InterceptorManager() {\n this.handlers = [];\n}\n\n/**\n * Add a new interceptor to the stack\n *\n * @param {Function} fulfilled The function to handle `then` for a `Promise`\n * @param {Function} rejected The function to handle `reject` for a `Promise`\n *\n * @return {Number} An ID used to remove interceptor later\n */\nInterceptorManager.prototype.use = function use(fulfilled, rejected) {\n this.handlers.push({\n fulfilled: fulfilled,\n rejected: rejected\n });\n return this.handlers.length - 1;\n};\n\n/**\n * Remove an interceptor from the stack\n *\n * @param {Number} id The ID that was returned by `use`\n */\nInterceptorManager.prototype.eject = function eject(id) {\n if (this.handlers[id]) {\n this.handlers[id] = null;\n }\n};\n\n/**\n * Iterate over all the registered interceptors\n *\n * This method is particularly useful for skipping over any\n * interceptors that may have become `null` calling `eject`.\n *\n * @param {Function} fn The function to call for each interceptor\n */\nInterceptorManager.prototype.forEach = function forEach(fn) {\n utils.forEach(this.handlers, function forEachHandler(h) {\n if (h !== null) {\n fn(h);\n }\n });\n};\n\nmodule.exports = InterceptorManager;\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMjEuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYXhpb3MvbGliL2NvcmUvSW50ZXJjZXB0b3JNYW5hZ2VyLmpzP2Y2YjQiXSwic291cmNlc0NvbnRlbnQiOlsiJ3VzZSBzdHJpY3QnO1xuXG52YXIgdXRpbHMgPSByZXF1aXJlKCcuLy4uL3V0aWxzJyk7XG5cbmZ1bmN0aW9uIEludGVyY2VwdG9yTWFuYWdlcigpIHtcbiAgdGhpcy5oYW5kbGVycyA9IFtdO1xufVxuXG4vKipcbiAqIEFkZCBhIG5ldyBpbnRlcmNlcHRvciB0byB0aGUgc3RhY2tcbiAqXG4gKiBAcGFyYW0ge0Z1bmN0aW9ufSBmdWxmaWxsZWQgVGhlIGZ1bmN0aW9uIHRvIGhhbmRsZSBgdGhlbmAgZm9yIGEgYFByb21pc2VgXG4gKiBAcGFyYW0ge0Z1bmN0aW9ufSByZWplY3RlZCBUaGUgZnVuY3Rpb24gdG8gaGFuZGxlIGByZWplY3RgIGZvciBhIGBQcm9taXNlYFxuIC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9uIGZvckVhY2goZm4pIHtcbiAgdXRpbHMuZm9yRWFjaCh0aGlzLmhhbmRsZXJzLCBmdW5jdGlvbiBmb3JFYWNoSGFuZGxlcihoKSB7XG4gICAgaWYgKGggIT09IG51bGwpIHtcbiAgICAgIGZuKGgpO1xuICAgIH1cbiAgfSk7XG59O1xuXG5tb2R1bGUuZXhwb3J0cyA9IEludGVyY2VwdG9yTWFuYWdlcjtcbiJdLCJtYXBwaW5ncyI6IkFBQUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7Iiwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///21\n")},function(module,exports,__webpack_require__){"use strict";eval("\n\nvar utils = __webpack_require__(0);\nvar transformData = __webpack_require__(23);\nvar isCancel = __webpack_require__(8);\nvar defaults = __webpack_require__(9);\nvar isAbsoluteURL = __webpack_require__(31);\nvar combineURLs = __webpack_require__(32);\n\n/**\n * Throws a `Cancel` if cancellation has been requested.\n */\nfunction throwIfCancellationRequested(config) {\n if (config.cancelToken) {\n config.cancelToken.throwIfRequested();\n }\n}\n\n/**\n * Dispatch a request to the server using the configured adapter.\n *\n * @param {object} config The config that is to be used for the request\n * @returns {Promise} The Promise to be fulfilled\n */\nmodule.exports = function dispatchRequest(config) {\n throwIfCancellationRequested(config);\n\n // Support baseURL config\n if (config.baseURL && !isAbsoluteURL(config.url)) {\n config.url = combineURLs(config.baseURL, config.url);\n }\n\n // Ensure headers exist\n config.headers = config.headers || {};\n\n // Transform request data\n config.data = transformData(\n config.data,\n config.headers,\n config.transformRequest\n );\n\n // Flatten headers\n config.headers = utils.merge(\n config.headers.common || {},\n config.headers[config.method] || {},\n config.headers || {}\n );\n\n utils.forEach(\n ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],\n function cleanHeaderConfig(method) {\n delete config.headers[method];\n }\n );\n\n var adapter = config.adapter || defaults.adapter;\n\n return adapter(config).then(function onAdapterResolution(response) {\n throwIfCancellationRequested(config);\n\n // Transform response data\n response.data = transformData(\n response.data,\n response.headers,\n config.transformResponse\n );\n\n return response;\n }, function onAdapterRejection(reason) {\n if (!isCancel(reason)) {\n throwIfCancellationRequested(config);\n\n // Transform response data\n if (reason && reason.response) {\n reason.response.data = transformData(\n reason.response.data,\n reason.response.headers,\n config.transformResponse\n );\n }\n }\n\n return Promise.reject(reason);\n });\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMjIuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYXhpb3MvbGliL2NvcmUvZGlzcGF0Y2hSZXF1ZXN0LmpzPzUyNzAiXSwic291cmNlc0NvbnRlbnQiOlsiJ3VzZSBzdHJpY3QnO1xuXG52YXIgdXRpbHMgPSByZXF1aXJlKCcuLy4uL3V0aWxzJyk7XG52YXIgdHJhbnNmb3JtRGF0YSA9IHJlcXVpcmUoJy4vdHJhbnNmb3JtRGF0YScpO1xudmFyIGlzQ2FuY2VsID0gcmVxdWlyZSgnLi4vY2FuY2VsL2lzQ2FuY2VsJyk7XG52YXIgZGVmYXVsdHMgPSByZXF1aXJlKCcuLi9kZWZhdWx0cycpO1xudmFyIGlzQWJzb2x1dGVVUkwgPSByZXF1aXJlKCcuLy4uL2hlbHBlcnMvaXNBYnNvbHV0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QTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7Iiwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///22\n")},function(module,exports,__webpack_require__){"use strict";eval("\n\nvar utils = __webpack_require__(0);\n\n/**\n * Transform the data for a request or a response\n *\n * @param {Object|String} data The data to be transformed\n * @param {Array} headers The headers for the request or response\n * @param {Array|Function} fns A single function or Array of functions\n * @returns {*} The resulting transformed data\n */\nmodule.exports = function transformData(data, headers, fns) {\n /*eslint no-param-reassign:0*/\n utils.forEach(fns, function transform(fn) {\n data = fn(data, headers);\n });\n\n return data;\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMjMuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYXhpb3MvbGliL2NvcmUvdHJhbnNmb3JtRGF0YS5qcz9jNDAxIl0sInNvdXJjZXNDb250ZW50IjpbIid1c2Ugc3RyaWN0JztcblxudmFyIHV0aWxzID0gcmVxdWlyZSgnLi8uLi91dGlscycpO1xuXG4vKipcbiAqIFRyYW5zZm9ybSB0aGUgZGF0YSBmb3IgYSByZXF1ZXN0IG9yIGEgcmVzcG9uc2VcbiAqXG4gKiBAcGFyYW0ge09iamVjdHxTdHJpbmd9IGRhdGEgVGhlIGRhdGEgdG8gYmUgdHJhbnNmb3JtZWRcbiAqIEBwYXJhbSB7QXJyYXl9IGhlYWRlcnMgVGhlIGhlYWRlcnMgZm9yIHRoZSByZXF1ZXN0IG9yIHJlc3BvbnNlXG4gKiBAcGFyYW0ge0FycmF5fEZ1bmN0aW9ufSBmbnMgQSBzaW5nbGUgZnVuY3Rpb24gb3IgQXJyYXkgb2YgZnVuY3Rpb25zXG4gKiBAcmV0dXJucyB7Kn0gVGhlIHJlc3VsdGluZyB0cmFuc2Zvcm1lZCBkYXRhXG4gKi9cbm1vZHVsZS5leHBvcnRzID0gZnVuY3Rpb24gdHJhbnNmb3JtRGF0YShkYXRhLCBoZWFkZXJzLCBmbnMpIHtcbiAgLyplc2xpbnQgbm8tcGFyYW0tcmVhc3NpZ246MCovXG4gIHV0aWxzLmZvckVhY2goZm5zLCBmdW5jdGlvbiB0cmFuc2Zvcm0oZm4pIHtcbiAgICBkYXRhID0gZm4oZGF0YSwgaGVhZGVycyk7XG4gIH0pO1xuXG4gIHJldHVybiBkYXRhO1xufTtcbiJdLCJtYXBwaW5ncyI6IkFBQUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTsiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///23\n")},function(module,exports){eval("// shim for using process in browser\nvar process = module.exports = {};\n\n// cached from whatever global is present so that test runners that stub it\n// don't break things. But we need to wrap it in a try catch in case it is\n// wrapped in strict mode code which doesn't define any globals. It's inside a\n// function because try/catches deoptimize in certain engines.\n\nvar cachedSetTimeout;\nvar cachedClearTimeout;\n\nfunction defaultSetTimout() {\n throw new Error('setTimeout has not been defined');\n}\nfunction defaultClearTimeout () {\n throw new Error('clearTimeout has not been defined');\n}\n(function () {\n try {\n if (typeof setTimeout === 'function') {\n cachedSetTimeout = setTimeout;\n } else {\n cachedSetTimeout = defaultSetTimout;\n }\n } catch (e) {\n cachedSetTimeout = defaultSetTimout;\n }\n try {\n if (typeof clearTimeout === 'function') {\n cachedClearTimeout = clearTimeout;\n } else {\n cachedClearTimeout = defaultClearTimeout;\n }\n } catch (e) {\n cachedClearTimeout = defaultClearTimeout;\n }\n} ())\nfunction runTimeout(fun) {\n if (cachedSetTimeout === setTimeout) {\n //normal enviroments in sane situations\n return setTimeout(fun, 0);\n }\n // if setTimeout wasn't available but was latter defined\n if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {\n cachedSetTimeout = setTimeout;\n return setTimeout(fun, 0);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedSetTimeout(fun, 0);\n } catch(e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedSetTimeout.call(null, fun, 0);\n } catch(e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error\n return cachedSetTimeout.call(this, fun, 0);\n }\n }\n\n\n}\nfunction runClearTimeout(marker) {\n if (cachedClearTimeout === clearTimeout) {\n //normal enviroments in sane situations\n return clearTimeout(marker);\n }\n // if clearTimeout wasn't available but was latter defined\n if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {\n cachedClearTimeout = clearTimeout;\n return clearTimeout(marker);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedClearTimeout(marker);\n } catch (e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedClearTimeout.call(null, marker);\n } catch (e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.\n // Some versions of I.E. have different rules for clearTimeout vs setTimeout\n return cachedClearTimeout.call(this, marker);\n }\n }\n\n\n\n}\nvar queue = [];\nvar draining = false;\nvar currentQueue;\nvar queueIndex = -1;\n\nfunction cleanUpNextTick() {\n if (!draining || !currentQueue) {\n return;\n }\n draining = false;\n if (currentQueue.length) {\n queue = currentQueue.concat(queue);\n } else {\n queueIndex = -1;\n }\n if (queue.length) {\n drainQueue();\n }\n}\n\nfunction drainQueue() {\n if (draining) {\n return;\n }\n var timeout = runTimeout(cleanUpNextTick);\n draining = true;\n\n var len = queue.length;\n while(len) {\n currentQueue = queue;\n queue = [];\n while (++queueIndex < len) {\n if (currentQueue) {\n currentQueue[queueIndex].run();\n }\n }\n queueIndex = -1;\n len = queue.length;\n }\n currentQueue = null;\n draining = false;\n runClearTimeout(timeout);\n}\n\nprocess.nextTick = function (fun) {\n var args = new Array(arguments.length - 1);\n if (arguments.length > 1) {\n for (var i = 1; i < arguments.length; i++) {\n args[i - 1] = arguments[i];\n }\n }\n queue.push(new Item(fun, args));\n if (queue.length === 1 && !draining) {\n runTimeout(drainQueue);\n }\n};\n\n// v8 likes predictible objects\nfunction Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}\nItem.prototype.run = function () {\n this.fun.apply(null, this.array);\n};\nprocess.title = 'browser';\nprocess.browser = true;\nprocess.env = {};\nprocess.argv = [];\nprocess.version = ''; // empty string to avoid regexp issues\nprocess.versions = {};\n\nfunction noop() {}\n\nprocess.on = noop;\nprocess.addListener = noop;\nprocess.once = noop;\nprocess.off = noop;\nprocess.removeListener = noop;\nprocess.removeAllListeners = noop;\nprocess.emit = noop;\nprocess.prependListener = noop;\nprocess.prependOnceListener = noop;\n\nprocess.listeners = function (name) { return [] }\n\nprocess.binding = function (name) {\n throw new Error('process.binding is not supported');\n};\n\nprocess.cwd = function () { return '/' };\nprocess.chdir = function (dir) {\n throw new Error('process.chdir is not supported');\n};\nprocess.umask = function() { return 0; };\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMjQuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvcHJvY2Vzcy9icm93c2VyLmpzP2YyOGMiXSwic291cmNlc0NvbnRlbnQiOlsiLy8gc2hpbSBmb3IgdXNpbmcgcHJvY2VzcyBpbiBicm93c2VyXG52YXIgcHJvY2VzcyA9IG1vZHVsZS5leHBvcnRzID0ge307XG5cbi8vIGNhY2hlZCBmcm9tIHdoYXRldmVyIGdsb2JhbCBpcyBwcmVzZW50IHNvIHRoYXQgdGVzdCBydW5uZXJzIHRoYXQgc3R1YiBpdFxuLy8gZG9uJ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";eval("\n\nvar utils = __webpack_require__(0);\n\nmodule.exports = function normalizeHeaderName(headers, normalizedName) {\n utils.forEach(headers, function processHeader(value, name) {\n if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) {\n headers[normalizedName] = value;\n delete headers[name];\n }\n });\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMjUuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYXhpb3MvbGliL2hlbHBlcnMvbm9ybWFsaXplSGVhZGVyTmFtZS5qcz9jOGFmIl0sInNvdXJjZXNDb250ZW50IjpbIid1c2Ugc3RyaWN0JztcblxudmFyIHV0aWxzID0gcmVxdWlyZSgnLi4vdXRpbHMnKTtcblxubW9kdWxlLmV4cG9ydHMgPSBmdW5jdGlvbiBub3JtYWxpemVIZWFkZXJOYW1lKGhlYWRlcnMsIG5vcm1hbGl6ZWROYW1lKSB7XG4gIHV0aWxzLmZvckVhY2goaGVhZGVycywgZnVuY3Rpb24gcHJvY2Vzc0hlYWRlcih2YWx1ZSwgbmFtZSkge1xuICAgIGlmIChuYW1lICE9PSBub3JtYWxpemVkTmFtZSAmJiBuYW1lLnRvVXBwZXJDYXNlKCkgPT09IG5vcm1hbGl6ZWROYW1lLnRvVXBwZXJDYXNlKCkpIHtcbiAgICAgIGhlYWRlcnNbbm9ybWFsaXplZE5hbWVdID0gdmFsdWU7XG4gICAgICBkZWxldGUgaGVhZGVyc1tuYW1lXTtcbiAgICB9XG4gIH0pO1xufTtcbiJdLCJtYXBwaW5ncyI6IkFBQUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOyIsInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///25\n")},function(module,exports,__webpack_require__){"use strict";eval("\n\nvar createError = __webpack_require__(11);\n\n/**\n * Resolve or reject a Promise based on response status.\n *\n * @param {Function} resolve A function that resolves the promise.\n * @param {Function} reject A function that rejects the promise.\n * @param {object} response The response.\n */\nmodule.exports = function settle(resolve, reject, response) {\n var validateStatus = response.config.validateStatus;\n if (!validateStatus || validateStatus(response.status)) {\n resolve(response);\n } else {\n reject(createError(\n 'Request failed with status code ' + response.status,\n response.config,\n null,\n response.request,\n response\n ));\n }\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMjYuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYXhpb3MvbGliL2NvcmUvc2V0dGxlLmpzPzQ2N2YiXSwic291cmNlc0NvbnRlbnQiOlsiJ3VzZSBzdHJpY3QnO1xuXG52YXIgY3JlYXRlRXJyb3IgPSByZXF1aXJlKCcuL2NyZWF0ZUVycm9yJyk7XG5cbi8qKlxuICogUmVzb2x2ZSBvciByZWplY3QgYSBQcm9taXNlIGJhc2VkIG9uIHJlc3BvbnNlIHN0YXR1cy5cbiAqXG4gKiBAcGFyYW0ge0Z1bmN0aW9ufSByZXNvbHZlIEEgZnVuY3Rpb24gdGhhdCByZXNvbHZlcyB0aGUgcHJvbWlzZS5cbiAqIEBwYXJhbSB7RnVuY3Rpb259IHJlamVjdCBBIGZ1bmN0aW9uIHRoYXQgcmVqZWN0cyB0aGUgcHJvbWlzZS5cbiAqIEBwYXJhbSB7b2JqZWN0fSByZXNwb25zZSBUaGUgcmVzcG9uc2UuXG4gKi9cbm1vZHVsZS5leHBvcnRzID0gZnVuY3Rpb24gc2V0dGxlKHJlc29sdmUsIHJlamVjdCwgcmVzcG9uc2UpIHtcbiAgdmFyIHZhbGlkYXRlU3RhdHVzID0gcmVzcG9uc2UuY29uZmlnLnZhbGlkYXRlU3RhdHVzO1xuICBpZiAoIXZhbGlkYXRlU3RhdHVzIHx8IHZhbGlkYXRlU3RhdHVzKHJlc3BvbnNlLnN0YXR1cykpIHtcbiAgICByZXNvbHZlKHJlc3BvbnNlKTtcbiAgfSBlbHNlIHtcbiAgICByZWplY3QoY3JlYXRlRXJyb3IoXG4gICAgICAnUmVxdWVzdCBmYWlsZWQgd2l0aCBzdGF0dXMgY29kZSAnICsgcmVzcG9uc2Uuc3RhdHVzLFxuICAgICAgcmVzcG9uc2UuY29uZmlnLFxuICAgICAgbnVsbCxcbiAgICAgIHJlc3BvbnNlLnJlcXVlc3QsXG4gICAgICByZXNwb25zZVxuICAgICkpO1xuICB9XG59O1xuIl0sIm1hcHBpbmdzIjoiQUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTsiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///26\n")},function(module,exports,__webpack_require__){"use strict";eval("\n\n/**\n * Update an Error with the specified config, error code, and response.\n *\n * @param {Error} error The error to update.\n * @param {Object} config The config.\n * @param {string} [code] The error code (for example, 'ECONNABORTED').\n * @param {Object} [request] The request.\n * @param {Object} [response] The response.\n * @returns {Error} The error.\n */\nmodule.exports = function enhanceError(error, config, code, request, response) {\n error.config = config;\n if (code) {\n error.code = code;\n }\n\n error.request = request;\n error.response = response;\n error.isAxiosError = true;\n\n error.toJSON = function() {\n return {\n // Standard\n message: this.message,\n name: this.name,\n // Microsoft\n description: this.description,\n number: this.number,\n // Mozilla\n fileName: this.fileName,\n lineNumber: this.lineNumber,\n columnNumber: this.columnNumber,\n stack: this.stack,\n // Axios\n config: this.config,\n code: this.code\n };\n };\n return error;\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMjcuanMiLCJzb3VyY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ICAgICAgbmFtZTogdGhpcy5uYW1lLFxuICAgICAgLy8gTWljcm9zb2Z0XG4gICAgICBkZXNjcmlwdGlvbjogdGhpcy5kZXNjcmlwdGlvbixcbiAgICAgIG51bWJlcjogdGhpcy5udW1iZXIsXG4gICAgICAvLyBNb3ppbGxhXG4gICAgICBmaWxlTmFtZTogdGhpcy5maWxlTmFtZSxcbiAgICAgIGxpbmVOdW1iZXI6IHRoaXMubGluZU51bWJlcixcbiAgICAgIGNvbHVtbk51bWJlcjogdGhpcy5jb2x1bW5OdW1iZXIsXG4gICAgICBzdGFjazogdGhpcy5zdGFjayxcbiAgICAgIC8vIEF4aW9zXG4gICAgICBjb25maWc6IHRoaXMuY29uZmlnLFxuICAgICAgY29kZTogdGhpcy5jb2RlXG4gICAgfTtcbiAgfTtcbiAgcmV0dXJuIGVycm9yO1xufTtcbiJdLCJtYXBwaW5ncyI6IkFBQUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOyIsInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///27\n")},function(module,exports,__webpack_require__){"use strict";eval("\n\nvar utils = __webpack_require__(0);\n\n// Headers whose duplicates are ignored by node\n// c.f. https://nodejs.org/api/http.html#http_message_headers\nvar ignoreDuplicateOf = [\n 'age', 'authorization', 'content-length', 'content-type', 'etag',\n 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',\n 'last-modified', 'location', 'max-forwards', 'proxy-authorization',\n 'referer', 'retry-after', 'user-agent'\n];\n\n/**\n * Parse headers into an object\n *\n * ```\n * Date: Wed, 27 Aug 2014 08:58:49 GMT\n * Content-Type: application/json\n * Connection: keep-alive\n * Transfer-Encoding: chunked\n * ```\n *\n * @param {String} headers Headers needing to be parsed\n * @returns {Object} Headers parsed into an object\n */\nmodule.exports = function parseHeaders(headers) {\n var parsed = {};\n var key;\n var val;\n var i;\n\n if (!headers) { return parsed; }\n\n utils.forEach(headers.split('\\n'), function parser(line) {\n i = line.indexOf(':');\n key = utils.trim(line.substr(0, i)).toLowerCase();\n val = utils.trim(line.substr(i + 1));\n\n if (key) {\n if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) {\n return;\n }\n if (key === 'set-cookie') {\n parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]);\n } else {\n parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;\n }\n }\n });\n\n return parsed;\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMjguanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYXhpb3MvbGliL2hlbHBlcnMvcGFyc2VIZWFkZXJzLmpzP2MzNDUiXSwic291cmNlc0NvbnRlbnQiOlsiJ3VzZSBzdHJpY3QnO1xuXG52YXIgdXRpbHMgPSByZXF1aXJlKCcuLy4uL3V0aWxzJyk7XG5cbi8vIEhlYWRlcnMgd2hvc2UgZHVwbGljYXRlcyBhcmUgaWdub3JlZCBieSBub2RlXG4vLyBjLmYuIGh0dHBzOi8vbm9kZWpzLm9yZy9hcGkvaHR0cC5odG1sI2h0dHBfbWVzc2FnZV9oZWFkZXJzXG52YXIgaWdub3JlRHVwbGljYXRlT2YgPSBbXG4gICdhZ2UnLCAnYXV0aG9yaXphdGlvbicsICdjb250ZW50LWxlbmd0aCcsICdjb250ZW50LXR5cGUnLCAnZXRhZycsXG4gICdleHBpcmVzJywgJ2Zyb20nLCAnaG9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a2V5KSB7XG4gICAgICBpZiAocGFyc2VkW2tleV0gJiYgaWdub3JlRHVwbGljYXRlT2YuaW5kZXhPZihrZXkpID49IDApIHtcbiAgICAgICAgcmV0dXJuO1xuICAgICAgfVxuICAgICAgaWYgKGtleSA9PT0gJ3NldC1jb29raWUnKSB7XG4gICAgICAgIHBhcnNlZFtrZXldID0gKHBhcnNlZFtrZXldID8gcGFyc2VkW2tleV0gOiBbXSkuY29uY2F0KFt2YWxdKTtcbiAgICAgIH0gZWxzZSB7XG4gICAgICAgIHBhcnNlZFtrZXldID0gcGFyc2VkW2tleV0gPyBwYXJzZWRba2V5XSArICcsICcgKyB2YWwgOiB2YWw7XG4gICAgICB9XG4gICAgfVxuICB9KTtcblxuICByZXR1cm4gcGFyc2VkO1xufTtcbiJdLCJtYXBwaW5ncyI6IkFBQUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTsiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///28\n")},function(module,exports,__webpack_require__){"use strict";eval("\n\nvar utils = __webpack_require__(0);\n\nmodule.exports = (\n utils.isStandardBrowserEnv() ?\n\n // Standard browser envs have full support of the APIs needed to test\n // whether the request URL is of the same origin as current location.\n (function standardBrowserEnv() {\n var msie = /(msie|trident)/i.test(navigator.userAgent);\n var urlParsingNode = document.createElement('a');\n var originURL;\n\n /**\n * Parse a URL to discover it's components\n *\n * @param {String} url The URL to be parsed\n * @returns {Object}\n */\n function resolveURL(url) {\n var href = url;\n\n if (msie) {\n // IE needs attribute set twice to normalize properties\n urlParsingNode.setAttribute('href', href);\n href = urlParsingNode.href;\n }\n\n urlParsingNode.setAttribute('href', href);\n\n // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils\n return {\n href: urlParsingNode.href,\n protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',\n host: urlParsingNode.host,\n search: urlParsingNode.search ? urlParsingNode.search.replace(/^\\?/, '') : '',\n hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',\n hostname: urlParsingNode.hostname,\n port: urlParsingNode.port,\n pathname: (urlParsingNode.pathname.charAt(0) === '/') ?\n urlParsingNode.pathname :\n '/' + urlParsingNode.pathname\n };\n }\n\n originURL = resolveURL(window.location.href);\n\n /**\n * Determine if a URL shares the same origin as the current location\n *\n * @param {String} requestURL The URL to test\n * @returns {boolean} True if URL shares the same origin, otherwise false\n */\n return function isURLSameOrigin(requestURL) {\n var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;\n return (parsed.protocol === originURL.protocol &&\n parsed.host === originURL.host);\n };\n })() :\n\n // Non standard browser envs (web workers, react-native) lack needed support.\n (function nonStandardBrowserEnv() {\n return function isURLSameOrigin() {\n return true;\n };\n })()\n);\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMjkuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYXhpb3MvbGliL2hlbHBlcnMvaXNVUkxTYW1lT3JpZ2luLmpzPzM5MzQiXSwic291cmNlc0NvbnRlbnQiOlsiJ3VzZSBzdHJpY3QnO1xuXG52YXIgdXRpbHMgPSByZXF1aXJlKCcuLy4uL3V0aWxzJyk7XG5cbm1vZH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Q0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTsiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///29\n")},function(module,exports,__webpack_require__){"use strict";eval("\n\nvar utils = __webpack_require__(0);\n\nmodule.exports = (\n utils.isStandardBrowserEnv() ?\n\n // Standard browser envs support document.cookie\n (function standardBrowserEnv() {\n return {\n write: function write(name, value, expires, path, domain, secure) {\n var cookie = [];\n cookie.push(name + '=' + encodeURIComponent(value));\n\n if (utils.isNumber(expires)) {\n cookie.push('expires=' + new Date(expires).toGMTString());\n }\n\n if (utils.isString(path)) {\n cookie.push('path=' + path);\n }\n\n if (utils.isString(domain)) {\n cookie.push('domain=' + domain);\n }\n\n if (secure === true) {\n cookie.push('secure');\n }\n\n document.cookie = cookie.join('; ');\n },\n\n read: function read(name) {\n var match = document.cookie.match(new RegExp('(^|;\\\\s*)(' + name + ')=([^;]*)'));\n return (match ? decodeURIComponent(match[3]) : null);\n },\n\n remove: function remove(name) {\n this.write(name, '', Date.now() - 86400000);\n }\n };\n })() :\n\n // Non standard browser env (web workers, react-native) lack needed support.\n (function nonStandardBrowserEnv() {\n return {\n write: function write() {},\n read: function read() { return null; },\n remove: function remove() {}\n };\n })()\n);\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMzAuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYXhpb3MvbGliL2hlbHBlcnMvY29va2llcy5qcz83YWFjIl0sInNvdXJjZXNDb250ZW50IjpbIid1c2Ugc3RyaWN0JztcblxudmFyIHV0aWxzID0gcmVxdWlyZSgnLi8uLi91dGlscycpO1xuXG5tb2R1bGUuZXhwb3J0cyA9IChcbiAgdXRpbHMuaXNTdGFuZGFyZEJyb3dzZXJFbnYoKSA/XG5cbiAgLy8gU3RhbmRhcmQgYnJvd3NlciBlbnZzIHN1cHBvcnQgZG9jdW1lbnQuY29va2llXG4gICAgKGZ1bmN0aW9uIHN0YW5kYXJkQnJvd3NlckVudigpIHtcbiAgICAgIHJldHVybiB7XG4gICAgICAgIHdyaXRlOiBmdW5jdGlvbiB3cml0ZShuYW1lLCB2YWx1ZSwgZXhwaXJlcywgcGF0aCwgZG9tYWluLCBzZWN1cmUpIHtcbiAgICAgICAgICB2YXIgY29va2llID0gW107XG4gICAgICAgICAgY29va2llLnB1c2gobmFtZSArICc9JyArIGVuY29kZVVSSUNvbXBvbmVudCh2YWx1ZSkpO1xuXG4gICAgICAgICAgaWYgKHV0aWxzLmlzTnVtYmVyKGV4cGlyZXMpKSB7XG4gICAgICAgICAgICBjb29raWUucHVzaCgnZXhwaXJlcz0nICsgbmV3IERhdGUoZXhwaXJlcykudG9HTVRTdHJpbmcoKSk7XG4gICAgICAgICAgfVxuXG4gICAgICAgICAgaWYgKHV0aWxzLmlzU3RyaW5nKHBhdGgpKSB7XG4gICAgICAgICAgICBjb29raWUucHVzaCgncGF0aD0nICsgcGF0aCk7XG4gICAgICAgICAgfVxuXG4gICAgICAgICAgaWYgKHV0aWxzLmlzU3RyaW5nKGRvbWFpbikpIHtcbiAgICAgICAgICAgIGNvb2tpZS5wdXNoKCdkb21haW49JyArIGRvbWFpbik7XG4gICAgICAgICAgfVxuXG4gICAgICAgICAgaWYgKHNlY3VyZSA9PT0gdHJ1ZSkge1xuICAgICAgICAgICAgY29va2llLnB1c2goJ3NlY3VyZScpO1xuICAgICAgICAgIH1cblxuICAgIC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FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOyIsInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///30\n")},function(module,exports,__webpack_require__){"use strict";eval('\n\n/**\n * Determines whether the specified URL is absolute\n *\n * @param {string} url The URL to test\n * @returns {boolean} True if the specified URL is absolute, otherwise false\n */\nmodule.exports = function isAbsoluteURL(url) {\n // A URL is considered absolute if it begins with "://" or "//" (protocol-relative URL).\n // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed\n // by any combination of letters, digits, plus, period, or hyphen.\n return /^([a-z][a-z\\d\\+\\-\\.]*:)?\\/\\//i.test(url);\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMzEuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYXhpb3MvbGliL2hlbHBlcnMvaXNBYnNvbHV0ZVVSTC5qcz9kOTI1Il0sInNvdXJjZXNDb250ZW50IjpbIid1c2Ugc3RyaWN0JztcblxuLyoqXG4gKiBEZXRlcm1pbmVzIHdoZXRoZXIgdGhlIHNwZWNpZmllZCBVUkwgaXMgYWJzb2x1dGVcbiAqXG4gKiBAcGFyYW0ge3N0cmluZ30gdXJsIFRoZSBVUkwgdG8gdGVzdFxuICogQHJldHVybnMge2Jvb2xlYW59IFRydWUgaWYgdGhlIHNwZWNpZmllZCBVUkwgaXMgYWJzb2x1dGUsIG90aGVyd2lzZSBmYWxzZVxuICovXG5tb2R1bGUuZXhwb3J0cyA9IGZ1bmN0aW9uIGlzQWJzb2x1dGVVUkwodXJsKSB7XG4gIC8vIEEgVVJMIGlzIGNvbnNpZGVyZWQgYWJzb2x1dGUgaWYgaXQgYmVnaW5zIHdpdGggXCI8c2NoZW1lPjovL1wiIG9yIFwiLy9cIiAocHJvdG9jb2wtcmVsYXRpdmUgVVJMKS5cbiAgLy8gUkZDIDM5ODYgZGVmaW5lcyBzY2hlbWUgbmFtZSBhcyBhIHNlcXVlbmNlIG9mIGNoYXJhY3RlcnMgYmVnaW5uaW5nIHdpdGggYSBsZXR0ZXIgYW5kIGZvbGxvd2VkXG4gIC8vIGJ5IGFueSBjb21iaW5hdGlvbiBvZiBsZXR0ZXJzLCBkaWdpdHMsIHBsdXMsIHBlcmlvZCwgb3IgaHlwaGVuLlxuICByZXR1cm4gL14oW2Etel1bYS16XFxkXFwrXFwtXFwuXSo6KT9cXC9cXC8vaS50ZXN0KHVybCk7XG59O1xuIl0sIm1hcHBpbmdzIjoiQUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOyIsInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///31\n')},function(module,exports,__webpack_require__){"use strict";eval("\n\n/**\n * Creates a new URL by combining the specified URLs\n *\n * @param {string} baseURL The base URL\n * @param {string} relativeURL The relative URL\n * @returns {string} The combined URL\n */\nmodule.exports = function combineURLs(baseURL, relativeURL) {\n return relativeURL\n ? baseURL.replace(/\\/+$/, '') + '/' + relativeURL.replace(/^\\/+/, '')\n : baseURL;\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMzIuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYXhpb3MvbGliL2hlbHBlcnMvY29tYmluZVVSTHMuanM/ZTY4MyJdLCJzb3VyY2VzQ29udGVudCI6WyIndXNlIHN0cmljdCc7XG5cbi8qKlxuICogQ3JlYXRlcyBhIG5ldyBVUkwgYnkgY29tYmluaW5nIHRoZSBzcGVjaWZpZWQgVVJMc1xuICpcbiAqIEBwYXJhbSB7c3RyaW5nfSBiYXNlVVJMIFRoZSBiYXNlIFVSTFxuICogQHBhcmFtIHtzdHJpbmd9IHJlbGF0aXZlVVJMIFRoZSByZWxhdGl2ZSBVUkxcbiAqIEByZXR1cm5zIHtzdHJpbmd9IFRoZSBjb21iaW5lZCBVUkxcbiAqL1xubW9kdWxlLmV4cG9ydHMgPSBmdW5jdGlvbiBjb21iaW5lVVJMcyhiYXNlVVJMLCByZWxhdGl2ZVVSTCkge1xuICByZXR1cm4gcmVsYXRpdmVVUkxcbiAgICA/IGJhc2VVUkwucmVwbGFjZSgvXFwvKyQvLCAnJykgKyAnLycgKyByZWxhdGl2ZVVSTC5yZXBsYWNlKC9eXFwvKy8sICcnKVxuICAgIDogYmFzZVVSTDtcbn07XG4iXSwibWFwcGluZ3MiOiJBQUFBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7Iiwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///32\n")},function(module,exports,__webpack_require__){"use strict";eval("\n\nvar Cancel = __webpack_require__(13);\n\n/**\n * A `CancelToken` is an object that can be used to request cancellation of an operation.\n *\n * @class\n * @param {Function} executor The executor function.\n */\nfunction CancelToken(executor) {\n if (typeof executor !== 'function') {\n throw new TypeError('executor must be a function.');\n }\n\n var resolvePromise;\n this.promise = new Promise(function promiseExecutor(resolve) {\n resolvePromise = resolve;\n });\n\n var token = this;\n executor(function cancel(message) {\n if (token.reason) {\n // Cancellation has already been requested\n return;\n }\n\n token.reason = new Cancel(message);\n resolvePromise(token.reason);\n });\n}\n\n/**\n * Throws a `Cancel` if cancellation has been requested.\n */\nCancelToken.prototype.throwIfRequested = function throwIfRequested() {\n if (this.reason) {\n throw this.reason;\n }\n};\n\n/**\n * Returns an object that contains a new `CancelToken` and a function that, when called,\n * cancels the `CancelToken`.\n */\nCancelToken.source = function source() {\n var cancel;\n var token = new CancelToken(function executor(c) {\n cancel = c;\n });\n return {\n token: token,\n cancel: cancel\n };\n};\n\nmodule.exports = CancelToken;\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMzMuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYXhpb3MvbGliL2NhbmNlbC9DYW5jZWxUb2tlbi5qcz84ZGY0Il0sInNvdXJjZXNDb250ZW50IjpbIid1c2Ugc3RyaWN0JztcblxudmFyIENhbmNlbCA9IHJlcXVpcmUoJy4vQ2FuY2VsJyk7XG5cbi8qKlxuICogQSBgQ2FuY2VsVG9rZW5gIGlzIGFuIG9iamVjdCB0aGF0IGNhbiBiZSB1c2VkIHRvIHJlcXVlc3QgY2FuY2VsbGF0aW9uIG9mIGFuIG9wZXJhdGlvbi5cbiAqXG4gKiBAY2xhc3NcbiAqIEBwYXJhbSB7RnVuY3Rpb259IGV4ZWN1dG9yIFRoZSBleGVjdXRvciBmdW5jdGlvbi5cbiAqL1xuZnVuY3Rpb24gQ2FuY2VsVG9rZW4oZXhlY3V0b3IpIHtcbiAgaWYgKHR5cGVvZiBleGVjdXRvciAhPT0gJ2Z1bmN0aW9uJykge1xuICAgIHRocm93IG5ldyBUeXBlRXJyb3IoJ2V4ZWN1dG9yIG11c3QgYmUgYSBmdW5jdGlvbi4nKTtcbiAgfVxuXG4gIHZhciByZXNvbHZlUHJvbWlzZTtcbiAgdGhpcy5wcm9taXNlID0gbmV3IFByb21pc2UoZnVuY3Rpb24gcHJvbWlzZUV4ZWN1dG9yKHJlc29sdmUpIHtcbiAgICByZXNvbHZlUHJvbWlzZSA9IHJlc29sdmU7XG4gIH0pO1xuXG4gIHZhciB0b2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3MiOiJBQUFBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTsiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///33\n")},function(module,exports,__webpack_require__){"use strict";eval("\n\n/**\n * Syntactic sugar for invoking a function and expanding an array for arguments.\n *\n * Common use case would be to use `Function.prototype.apply`.\n *\n * ```js\n * function f(x, y, z) {}\n * var args = [1, 2, 3];\n * f.apply(null, args);\n * ```\n *\n * With `spread` this example can be re-written.\n *\n * ```js\n * spread(function(x, y, z) {})([1, 2, 3]);\n * ```\n *\n * @param {Function} callback\n * @returns {Function}\n */\nmodule.exports = function spread(callback) {\n return function wrap(arr) {\n return callback.apply(null, arr);\n };\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMzQuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYXhpb3MvbGliL2hlbHBlcnMvc3ByZWFkLmpzPzBkZjYiXSwic291cmNlc0NvbnRlbnQiOlsiJ3VzZSBzdHJpY3QnO1xuXG4vKipcbiAqIFN5bnRhY3RpYyBzdWdhciBmb3IgaW52b2tpbmcgYSBmdW5jdGlvbiBhbmQgZXhwYW5kaW5nIGFuIGFycmF5IGZvciBhcmd1bWVudHMuXG4gKlxuICogQ29tbW9uIHVzZSBjYXNlIHdvdWxkIGJlIHRvIHVzZSBgRnVuY3Rpb24ucHJvdG90eXBlLmFwcGx5YC5cbiAqXG4gKiAgYGBganNcbiAqICBmdW5jdGlvbiBmKHgsIHksIHopIHt9XG4gKiAgdmFyIGFyZ3MgPSBbMSwgMiwgM107XG4gKiAgZi5hcHBseShudWxsLCBhcmdzKTtcbiAqICBgYGBcbiAqXG4gKiBXaXRoIGBzcHJlYWRgIHRoaXMgZXhhbXBsZSBjYW4gYmUgcmUtd3JpdHRlbi5cbiAqXG4gKiAgYGBganNcbiAqICBzcHJlYWQoZnVuY3Rpb24oeCwgeSwgeikge30pKFsxLCAyLCAzXSk7XG4gKiAgYGBgXG4gKlxuICogQHBhcmFtIHtGdW5jdGlvbn0gY2FsbGJhY2tcbiAqIEByZXR1cm5zIHtGdW5jdGlvbn1cbiAqL1xubW9kdWxlLmV4cG9ydHMgPSBmdW5jdGlvbiBzcHJlYWQoY2FsbGJhY2spIHtcbiAgcmV0dXJuIGZ1bmN0aW9uIHdyYXAoYXJyKSB7XG4gICAgcmV0dXJuIGNhbGxiYWNrLmFwcGx5KG51bGwsIGFycik7XG4gIH07XG59O1xuIl0sIm1hcHBpbmdzIjoiQUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7Iiwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///34\n")},,,,,,,,,,,,,,,,,,,,,,,,,,,,function(module,__webpack_exports__,__webpack_require__){"use strict";eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var quill_assets_snow_styl__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(16);\n/* harmony import */ var quill_assets_snow_styl__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(quill_assets_snow_styl__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _preview_styl__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(17);\n/* harmony import */ var _preview_styl__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_preview_styl__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _caller__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(1);\n/* harmony import */ var _common__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(4);\n\r\n\r\n\r\n\r\nvar docSize = { width: 0, height: 0 };\r\nfunction setDocSize() {\r\n var width = document.body.offsetWidth;\r\n var height = document.body.offsetHeight;\r\n if (docSize.width !== width || docSize.height !== height) {\r\n docSize.width = width;\r\n docSize.height = height;\r\n if (window.innerWidth && window.innerHeight) {\r\n Object(_caller__WEBPACK_IMPORTED_MODULE_2__[/* callMethod */ \"a\"])('setDocSize', docSize);\r\n }\r\n }\r\n}\r\nwindow.addEventListener('resize', function () {\r\n Object(_common__WEBPACK_IMPORTED_MODULE_3__[/* fixSize */ \"b\"])();\r\n setDocSize();\r\n});\r\nvar onReady = function () {\r\n Object(_common__WEBPACK_IMPORTED_MODULE_3__[/* fixSize */ \"b\"])();\r\n setDocSize();\r\n var view = Object(_common__WEBPACK_IMPORTED_MODULE_3__[/* getViewElement */ \"d\"])();\r\n if (!view) {\r\n return;\r\n }\r\n var images = [];\r\n view.querySelectorAll('img').forEach(function (img, index) {\r\n images.push({\r\n src: img.src,\r\n width: Number(img.dataset.width) || 0,\r\n height: Number(img.dataset.height) || 0,\r\n });\r\n img.addEventListener('click', function () {\r\n Object(_caller__WEBPACK_IMPORTED_MODULE_2__[/* callMethod */ \"a\"])('clickImage', { src: img.src, arr: images, index: index });\r\n });\r\n });\r\n view.querySelectorAll('a').forEach(function (a) {\r\n a.addEventListener('click', function (e) {\r\n if (!/^https?:\\/\\//.test(a.href)) {\r\n e.preventDefault();\r\n }\r\n });\r\n });\r\n Object(_caller__WEBPACK_IMPORTED_MODULE_2__[/* callMethod */ \"a\"])('docReady', {\r\n docWidth: docSize.width,\r\n docHeight: docSize.height,\r\n });\r\n};\r\nif (document.readyState === 'loading') {\r\n document.addEventListener('DOMContentLoaded', onReady);\r\n}\r\nelse {\r\n onReady();\r\n}\r\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNjIuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9zcmMvcHJldmlldy50cz9lMDQ0Il0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCAncXVpbGwvYXNzZXRzL3Nub3cuc3R5bCdcbmltcG9ydCAnLi9wcmV2aWV3LnN0eWwnXG5pbXBvcnQgeyBjYWxsTWV0aG9kIH0gZnJvbSAnLi9jYWxsZXInXG5pbXBvcnQgeyBnZXRWaWV3RWxlbWVudCwgZml4U2l6ZSB9IGZyb20gJy4vY29tbW9uJ1xuXG5pbnRlcmZhY2UgRG9jU2l6ZSB7XG4gIHdpZHRoOiBudW1iZXJcbiAgaGVpZ2h0OiBudW1iZXJcbn1cblxuY29uc3QgZG9jU2l6ZTogRG9jU2l6ZSA9IHsgd2lkdGg6IDAsIGhlaWdodDogMCB9XG5cbmZ1bmN0aW9uIHNldERvY1NpemUoKSB7XG4gIGNvbnN0IHdpZHRoID0gZG9jdW1lbnQuYm9keS5vZmZzZXRXaWR0aFxuICBjb25zdCBoZWlnaHQgPSBkb2N1bWVudC5ib2R5Lm9mZnNldEhlaWdodFxuXG4gIGlmIChkb2NTaXplLndpZHRoICE9PSB3aWR0aCB8fCBkb2NTaXplLmhlaWdodCAhPT0gaGVpZ2h0KSB7XG4gICAgZG9jU2l6ZS53aWR0aCA9IHdpZHRoXG4gICAgZG9jU2l6ZS5oZ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GEuaHJlZikpIHtcbiAgICAgICAgZS5wcmV2ZW50RGVmYXVsdCgpXG4gICAgICB9XG4gICAgfSlcbiAgfSlcblxuICBjYWxsTWV0aG9kKCdkb2NSZWFkeScsIHtcbiAgICBkb2NXaWR0aDogZG9jU2l6ZS53aWR0aCxcbiAgICBkb2NIZWlnaHQ6IGRvY1NpemUuaGVpZ2h0LFxuICB9KVxufVxuXG5pZiAoZG9jdW1lbnQucmVhZHlTdGF0ZSA9PT0gJ2xvYWRpbmcnKSB7XG4gIGRvY3VtZW50LmFkZEV2ZW50TGlzdGVuZXIoJ0RPTUNvbnRlbnRMb2FkZWQnLCBvblJlYWR5KVxufSBlbHNlIHtcbiAgb25SZWFkeSgpXG59XG4iXSwibWFwcGluZ3MiOiJBQUFBO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFDQTtBQUNBO0FBQ0E7QUFPQTtBQUVBO0FBQ0E7QUFDQTtBQUVBO0FBQ0E7QUFDQTtBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUVBO0FBQ0E7QUFDQTtBQUVBO0FBRUE7QUFDQTtBQUNBO0FBRUE7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUVBO0FBQ0E7QUFDQTtBQUFBO0FBQ0E7QUFDQTsiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///62\n")}]); \ No newline at end of file diff --git a/package.json b/package.json index 8ac1ddf..7f97f8b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@slimkit/plus-editor", - "version": "1.2.3", + "version": "1.2.4", "description": "rich-text editor for plus", "main": "dist/main.bundle.js", "repository": "git@github.com:mutoe/plus-editor.git", diff --git a/src/blots/image.ts b/src/blots/image.ts index ab68d23..c666b0a 100644 --- a/src/blots/image.ts +++ b/src/blots/image.ts @@ -47,6 +47,14 @@ export class ImageBlot extends BlockEmbed { } else { ImageBlot.uploadStatus[id] = {} } + } else { + setTimeout(() => { + if (!this.prev) return + const pNode = this.prev.domNode + if (pNode.tagName === 'P' && !pNode.innerText.trim()) { + this.prev.remove() // 移除图片前面的空行 + } + }, 0) } if (img && src) { @@ -319,4 +327,4 @@ export class ImageBlot extends BlockEmbed { } } -Quill.register(ImageBlot) +Quill.register(ImageBlot, true) diff --git a/src/blots/video.ts b/src/blots/video.ts index 500d4d3..b8c4b74 100644 --- a/src/blots/video.ts +++ b/src/blots/video.ts @@ -297,4 +297,4 @@ export class VideoBlot extends BlockEmbed { } } -Quill.register(VideoBlot) +Quill.register(VideoBlot, true) diff --git a/src/common.ts b/src/common.ts index 0345afc..016bb0a 100644 --- a/src/common.ts +++ b/src/common.ts @@ -71,8 +71,6 @@ export function fixVideoSize() { video.removeEventListener('playing', onPalyVideo) video.addEventListener('playing', onPalyVideo) - console.log(video.shadowRoot) - const viewWidth = getViewWidth() if (!viewWidth) return diff --git a/src/index.ts b/src/index.ts index 95d8487..bd7e3b1 100644 --- a/src/index.ts +++ b/src/index.ts @@ -69,22 +69,16 @@ const quill = new Quill('#editor', { [ 'IMG', (node: HTMLImageElement, delta: Delta): Delta => { - const src = node.getAttribute('src') - - delta.forEach((op: any) => { - if (op.insert && op.insert.image === src) { - op.insert = { image: ImageBlot.value(node) } - } + return new Delta().insert({ + image: ImageBlot.value(node), }) - - return delta }, ], [ 'VIDEO', (node: HTMLVideoElement, delta: Delta): Delta => { - return delta.delete(delta.length()).insert({ + return new Delta().insert({ video: VideoBlot.value(node), }) }, @@ -97,9 +91,7 @@ const quill = new Quill('#editor', { const ops: Delta['ops'] = [] delta.ops!.forEach(op => { if (op.insert && typeof op.insert === 'string') { - ops.push({ - insert: op.insert, - }) + ops.push({ insert: op.insert }) } }) delta.ops = ops @@ -113,11 +105,17 @@ const quill = new Quill('#editor', { /** 设置编辑器内容 */ window.setContentReceiver = data => { - quill.clipboard.dangerouslyPasteHTML(data) + quill.clipboard.dangerouslyPasteHTML(data, 'silent') setTimeout(fixSize, 0) } +setTimeout(() => { + window.setContentReceiver( + '

截至到2017年12月,我国的网民规模已经达到了7.72亿,而手机网民规模也达7.53亿,2017年网络社交娱乐类应用用户规模均保持了高速增长,同时电子商务、网络游戏、网络广告收入水平增速均在20%以上,发展势头良好。

如此高速的发展,这意味着,移动+社交的时代已经开启。社交软件已经成为了人们生活中密不可分的必需品,社交网站平台不仅仅是沟通、互动、娱乐,甚至能帮助商务交易。

如何快速搭建一个社交网站平台?也成为企业增加用户粘性、提高商务交易至关重要的一步。而ThinkSNS作为社交软件定制开发服务供应商先驱,将以自身携带的优势,引领这一社交时代的发展。社交系统ThinkSNS拥有动态、圈子、资讯、直播、商城、IM即时聊天、频道、音乐、活动、问答、投票、打赏等50余项功能,可根据需求组合,提供源码,能够快速定制属于自己的社交网站平台。同时社交系统ThinkSNS拥有PC端、手机H5端、Android 端、iOS端等多种平台,全新底层架构,稳定性能,保障软件快速上线和运营。

社交系统ThinkSNS可以用于哪些行业?应该用在什么场景呢?ThinkSNS并不仅仅限制于社交;众多的功能扩展让你的社交网站平台如虎添翼。接下来列举一下可以用于哪些行业,我觉得你可以根据自己的行业和面向的用户,来考虑怎么组合。

【教育行业】 教育o2o 根据知名教育机构的业务需求退推出的微教务、微班级、微网盘、微课堂、等模式,形成线下面授+线上服务的闭环。 社区化 依靠活动,问答,消息通知等社区模式更好的服务客户,成为老师家长学生的沟通纽带。 移动化 学生和家长通过手机随时收到课程,作业提醒等教育信息,还可以手机观看微博,移动时代更便捷。 云端化 支持阿里云SAE等云端部署,同时支持将站内视频,图片,附储存到云端,数据更安全,系统运行更高效。

【新媒体行业】 新闻模块 简单易用的CMS功能,支持多种格式文章编辑及文章推送 专题模块 相同优质内容聚合形成专题,持续深入聚焦专类信息投稿 用户能迅速、快捷的发表自己的观点、想法 社区 信息快速传递发酵的平台,也是用户持续跟踪新闻线索的工具

【医疗行业】 品牌服务 基于微信公众帐号开发的品牌系统,具有微活动、微学院、微客服、微会员等模块,通过线上的品牌社区提升用户对品牌的认知 患者社区 基于微信公众帐号开发的患者社区系统,具有用户交流、患者FM、专家答疑、自助查询等模块,提升了用户的黏度和归属感医生社区 基于微信公众号开发的医生社区系统,具有医学资讯、名医电台、在线学习、病历分析等模块,医生可在线上自主学习医疗会议 基于微信帐号开发的医疗会议系统,具有签到、大屏幕、问卷调查、投票等功能,通过数据可以看到参会者参与的效果

【粉丝营销社区】社交·分享 发烧用户聚集一起互动、分享,共同的兴趣形成更多的话题、圈子,增大品牌效应和附加值 互动·参与 粉丝通过线下活动、线上帖子讨论表达自己的观点,让更多的用户参与进来,打造品牌热度 荣誉·认证 品牌利用勋章、认证等机制奖励活跃用户,让用户与品牌紧密联系在一起 积分·换礼 积分、换礼等实质奖励,带动用户积极性吸引用户参与进来,最终达到品牌效应

更多行业案例,请参见:http://www.thinksns.com/case.html

目前,ThinkSNS作为华为、联想、奔驰,远景能源,中国大学生在线,蓝鲸传媒等著名企业软件技术指定合作方,深得业界口碑拥趸。

社交软件开发供应商ThinkSNS官网:http://www.thinksns.com/

', + ) +}, 3000) + ImageBlot.quill = quill ImageBlot.eventEmitter.on('remove', data => { @@ -307,6 +305,8 @@ window.addEventListener('resize', () => { if (range && quill.hasFocus()) { quill.setSelection(range) } + + fixSize() }) export default quill diff --git a/src/uploader.ts b/src/uploader.ts index 33d472e..5ed0aab 100644 --- a/src/uploader.ts +++ b/src/uploader.ts @@ -304,7 +304,6 @@ async function uploadRemoteImage(params: { const { blob, file, buff } = await new Promise((resolve, reject) => { const img = document.createElement('img') img.addEventListener('load', () => { - console.log('here') const canvas = document.createElement('canvas') canvas.setAttribute('width', `${params.width}`) canvas.setAttribute('height', `${params.height}`)