@atlaskit/embedded-document 0.8.16 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,5 @@
1
- import _typeof from "@babel/runtime/helpers/typeof";
2
1
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
3
- function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
2
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
4
3
  import { createContext } from 'react';
5
4
  var noop = function noop() {};
6
5
  export var Context = /*#__PURE__*/createContext({
@@ -10,16 +9,14 @@ export var Context = /*#__PURE__*/createContext({
10
9
  getDocumentByObjectId: noop,
11
10
  setDocumentMode: noop,
12
11
  updateDocument: function () {
13
- var _updateDocument = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
14
- return _regeneratorRuntime().wrap(function _callee$(_context) {
15
- while (1) {
16
- switch (_context.prev = _context.next) {
17
- case 0:
18
- throw new Error('Not implemented.');
19
- case 1:
20
- case "end":
21
- return _context.stop();
22
- }
12
+ var _updateDocument = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
13
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
14
+ while (1) switch (_context.prev = _context.next) {
15
+ case 0:
16
+ throw new Error('Not implemented.');
17
+ case 1:
18
+ case "end":
19
+ return _context.stop();
23
20
  }
24
21
  }, _callee);
25
22
  }));
@@ -29,16 +26,14 @@ export var Context = /*#__PURE__*/createContext({
29
26
  return updateDocument;
30
27
  }(),
31
28
  createDocument: function () {
32
- var _createDocument = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
33
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
34
- while (1) {
35
- switch (_context2.prev = _context2.next) {
36
- case 0:
37
- throw new Error('Not implemented.');
38
- case 1:
39
- case "end":
40
- return _context2.stop();
41
- }
29
+ var _createDocument = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
30
+ return _regeneratorRuntime.wrap(function _callee2$(_context2) {
31
+ while (1) switch (_context2.prev = _context2.next) {
32
+ case 0:
33
+ throw new Error('Not implemented.');
34
+ case 1:
35
+ case "end":
36
+ return _context2.stop();
42
37
  }
43
38
  }, _callee2);
44
39
  }));
@@ -1,4 +1,3 @@
1
- import _typeof from "@babel/runtime/helpers/typeof";
2
1
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
3
2
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
4
3
  import _createClass from "@babel/runtime/helpers/createClass";
@@ -9,7 +8,7 @@ import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
9
8
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
10
9
  import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
11
10
  var _templateObject;
12
- function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
11
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
13
12
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
14
13
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
15
14
  import React from 'react';
@@ -28,24 +27,22 @@ var EmbeddedDocument = /*#__PURE__*/function (_Component) {
28
27
  _classCallCheck(this, EmbeddedDocument);
29
28
  _this = _super.call(this, props);
30
29
  _defineProperty(_assertThisInitialized(_this), "getDocumentByObjectId", /*#__PURE__*/function () {
31
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(objectId, language) {
30
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(objectId, language) {
32
31
  var doc;
33
- return _regeneratorRuntime().wrap(function _callee$(_context) {
34
- while (1) {
35
- switch (_context.prev = _context.next) {
36
- case 0:
37
- _this.setState({
38
- isLoading: true
39
- });
40
- _context.next = 3;
41
- return _this.provider.getDocumentByObjectId(objectId, language);
42
- case 3:
43
- doc = _context.sent;
44
- _this.setDocumentState(doc);
45
- case 5:
46
- case "end":
47
- return _context.stop();
48
- }
32
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
33
+ while (1) switch (_context.prev = _context.next) {
34
+ case 0:
35
+ _this.setState({
36
+ isLoading: true
37
+ });
38
+ _context.next = 3;
39
+ return _this.provider.getDocumentByObjectId(objectId, language);
40
+ case 3:
41
+ doc = _context.sent;
42
+ _this.setDocumentState(doc);
43
+ case 5:
44
+ case "end":
45
+ return _context.stop();
49
46
  }
50
47
  }, _callee);
51
48
  }));
@@ -54,24 +51,22 @@ var EmbeddedDocument = /*#__PURE__*/function (_Component) {
54
51
  };
55
52
  }());
56
53
  _defineProperty(_assertThisInitialized(_this), "getDocument", /*#__PURE__*/function () {
57
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(documentId, language) {
54
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(documentId, language) {
58
55
  var doc;
59
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
60
- while (1) {
61
- switch (_context2.prev = _context2.next) {
62
- case 0:
63
- _this.setState({
64
- isLoading: true
65
- });
66
- _context2.next = 3;
67
- return _this.provider.getDocument(documentId, language);
68
- case 3:
69
- doc = _context2.sent;
70
- _this.setDocumentState(doc);
71
- case 5:
72
- case "end":
73
- return _context2.stop();
74
- }
56
+ return _regeneratorRuntime.wrap(function _callee2$(_context2) {
57
+ while (1) switch (_context2.prev = _context2.next) {
58
+ case 0:
59
+ _this.setState({
60
+ isLoading: true
61
+ });
62
+ _context2.next = 3;
63
+ return _this.provider.getDocument(documentId, language);
64
+ case 3:
65
+ doc = _context2.sent;
66
+ _this.setDocumentState(doc);
67
+ case 5:
68
+ case "end":
69
+ return _context2.stop();
75
70
  }
76
71
  }, _callee2);
77
72
  }));
@@ -80,18 +75,16 @@ var EmbeddedDocument = /*#__PURE__*/function (_Component) {
80
75
  };
81
76
  }());
82
77
  _defineProperty(_assertThisInitialized(_this), "setDocumentMode", /*#__PURE__*/function () {
83
- var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(mode) {
84
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
85
- while (1) {
86
- switch (_context3.prev = _context3.next) {
87
- case 0:
88
- _this.setState({
89
- mode: mode
90
- });
91
- case 1:
92
- case "end":
93
- return _context3.stop();
94
- }
78
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(mode) {
79
+ return _regeneratorRuntime.wrap(function _callee3$(_context3) {
80
+ while (1) switch (_context3.prev = _context3.next) {
81
+ case 0:
82
+ _this.setState({
83
+ mode: mode
84
+ });
85
+ case 1:
86
+ case "end":
87
+ return _context3.stop();
95
88
  }
96
89
  }, _callee3);
97
90
  }));
@@ -100,42 +93,40 @@ var EmbeddedDocument = /*#__PURE__*/function (_Component) {
100
93
  };
101
94
  }());
102
95
  _defineProperty(_assertThisInitialized(_this), "updateDocument", /*#__PURE__*/function () {
103
- var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(body) {
96
+ var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(body) {
104
97
  var _ref5, documentId, objectId, language, doc;
105
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
106
- while (1) {
107
- switch (_context4.prev = _context4.next) {
108
- case 0:
109
- _ref5 = _this.state.doc || _this.props, documentId = _ref5.documentId, objectId = _ref5.objectId, language = _ref5.language;
110
- if (documentId) {
111
- _context4.next = 3;
112
- break;
113
- }
114
- return _context4.abrupt("return", _this.createDocument(body));
115
- case 3:
116
- _context4.next = 5;
117
- return _this.provider.updateDocument(documentId, JSON.stringify(body), objectId, '', language);
118
- case 5:
119
- doc = _context4.sent;
120
- if (!doc) {
121
- _context4.next = 11;
122
- break;
123
- }
124
- _this.setState({
125
- doc: doc,
126
- mode: 'view'
127
- });
128
- return _context4.abrupt("return", doc);
129
- case 11:
130
- _this.setState({
131
- hasError: true,
132
- mode: 'view'
133
- });
134
- throw new Error('Failed to update document');
135
- case 13:
136
- case "end":
137
- return _context4.stop();
138
- }
98
+ return _regeneratorRuntime.wrap(function _callee4$(_context4) {
99
+ while (1) switch (_context4.prev = _context4.next) {
100
+ case 0:
101
+ _ref5 = _this.state.doc || _this.props, documentId = _ref5.documentId, objectId = _ref5.objectId, language = _ref5.language;
102
+ if (documentId) {
103
+ _context4.next = 3;
104
+ break;
105
+ }
106
+ return _context4.abrupt("return", _this.createDocument(body));
107
+ case 3:
108
+ _context4.next = 5;
109
+ return _this.provider.updateDocument(documentId, JSON.stringify(body), objectId, '', language);
110
+ case 5:
111
+ doc = _context4.sent;
112
+ if (!doc) {
113
+ _context4.next = 11;
114
+ break;
115
+ }
116
+ _this.setState({
117
+ doc: doc,
118
+ mode: 'view'
119
+ });
120
+ return _context4.abrupt("return", doc);
121
+ case 11:
122
+ _this.setState({
123
+ hasError: true,
124
+ mode: 'view'
125
+ });
126
+ throw new Error('Failed to update document');
127
+ case 13:
128
+ case "end":
129
+ return _context4.stop();
139
130
  }
140
131
  }, _callee4);
141
132
  }));
@@ -144,36 +135,34 @@ var EmbeddedDocument = /*#__PURE__*/function (_Component) {
144
135
  };
145
136
  }());
146
137
  _defineProperty(_assertThisInitialized(_this), "createDocument", /*#__PURE__*/function () {
147
- var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(body) {
138
+ var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(body) {
148
139
  var _this$props, objectId, language, doc;
149
- return _regeneratorRuntime().wrap(function _callee5$(_context5) {
150
- while (1) {
151
- switch (_context5.prev = _context5.next) {
152
- case 0:
153
- _this$props = _this.props, objectId = _this$props.objectId, language = _this$props.language;
154
- _context5.next = 3;
155
- return _this.provider.createDocument(JSON.stringify(body), objectId, '', language);
156
- case 3:
157
- doc = _context5.sent;
158
- if (!doc) {
159
- _context5.next = 9;
160
- break;
161
- }
162
- _this.setState({
163
- doc: doc,
164
- mode: 'view'
165
- });
166
- return _context5.abrupt("return", doc);
167
- case 9:
168
- _this.setState({
169
- hasError: true,
170
- mode: 'view'
171
- });
172
- throw new Error('Failed to create document');
173
- case 11:
174
- case "end":
175
- return _context5.stop();
176
- }
140
+ return _regeneratorRuntime.wrap(function _callee5$(_context5) {
141
+ while (1) switch (_context5.prev = _context5.next) {
142
+ case 0:
143
+ _this$props = _this.props, objectId = _this$props.objectId, language = _this$props.language;
144
+ _context5.next = 3;
145
+ return _this.provider.createDocument(JSON.stringify(body), objectId, '', language);
146
+ case 3:
147
+ doc = _context5.sent;
148
+ if (!doc) {
149
+ _context5.next = 9;
150
+ break;
151
+ }
152
+ _this.setState({
153
+ doc: doc,
154
+ mode: 'view'
155
+ });
156
+ return _context5.abrupt("return", doc);
157
+ case 9:
158
+ _this.setState({
159
+ hasError: true,
160
+ mode: 'view'
161
+ });
162
+ throw new Error('Failed to create document');
163
+ case 11:
164
+ case "end":
165
+ return _context5.stop();
177
166
  }
178
167
  }, _callee5);
179
168
  }));
@@ -211,29 +200,27 @@ var EmbeddedDocument = /*#__PURE__*/function (_Component) {
211
200
  _createClass(EmbeddedDocument, [{
212
201
  key: "componentDidMount",
213
202
  value: function () {
214
- var _componentDidMount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
203
+ var _componentDidMount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6() {
215
204
  var _this$props2, documentId, language, objectId;
216
- return _regeneratorRuntime().wrap(function _callee6$(_context6) {
217
- while (1) {
218
- switch (_context6.prev = _context6.next) {
219
- case 0:
220
- _this$props2 = this.props, documentId = _this$props2.documentId, language = _this$props2.language, objectId = _this$props2.objectId;
221
- if (!documentId) {
222
- _context6.next = 6;
223
- break;
224
- }
225
- _context6.next = 4;
226
- return this.getDocument(documentId, language);
227
- case 4:
228
- _context6.next = 8;
205
+ return _regeneratorRuntime.wrap(function _callee6$(_context6) {
206
+ while (1) switch (_context6.prev = _context6.next) {
207
+ case 0:
208
+ _this$props2 = this.props, documentId = _this$props2.documentId, language = _this$props2.language, objectId = _this$props2.objectId;
209
+ if (!documentId) {
210
+ _context6.next = 6;
229
211
  break;
230
- case 6:
231
- _context6.next = 8;
232
- return this.getDocumentByObjectId(objectId, language);
233
- case 8:
234
- case "end":
235
- return _context6.stop();
236
- }
212
+ }
213
+ _context6.next = 4;
214
+ return this.getDocument(documentId, language);
215
+ case 4:
216
+ _context6.next = 8;
217
+ break;
218
+ case 6:
219
+ _context6.next = 8;
220
+ return this.getDocumentByObjectId(objectId, language);
221
+ case 8:
222
+ case "end":
223
+ return _context6.stop();
237
224
  }
238
225
  }, _callee6, this);
239
226
  }));