babel-helpers.js 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558
  1. (function (global) {
  2. var babelHelpers = global.babelHelpers = {};
  3. babelHelpers.typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
  4. return typeof obj;
  5. } : function (obj) {
  6. return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
  7. };
  8. babelHelpers.jsx = function () {
  9. var REACT_ELEMENT_TYPE = typeof Symbol === "function" && Symbol.for && Symbol.for("react.element") || 0xeac7;
  10. return function createRawReactElement(type, props, key, children) {
  11. var defaultProps = type && type.defaultProps;
  12. var childrenLength = arguments.length - 3;
  13. if (!props && childrenLength !== 0) {
  14. props = {};
  15. }
  16. if (props && defaultProps) {
  17. for (var propName in defaultProps) {
  18. if (props[propName] === void 0) {
  19. props[propName] = defaultProps[propName];
  20. }
  21. }
  22. } else if (!props) {
  23. props = defaultProps || {};
  24. }
  25. if (childrenLength === 1) {
  26. props.children = children;
  27. } else if (childrenLength > 1) {
  28. var childArray = Array(childrenLength);
  29. for (var i = 0; i < childrenLength; i++) {
  30. childArray[i] = arguments[i + 3];
  31. }
  32. props.children = childArray;
  33. }
  34. return {
  35. $$typeof: REACT_ELEMENT_TYPE,
  36. type: type,
  37. key: key === undefined ? null : '' + key,
  38. ref: null,
  39. props: props,
  40. _owner: null
  41. };
  42. };
  43. }();
  44. babelHelpers.asyncIterator = function (iterable) {
  45. if (typeof Symbol === "function") {
  46. if (Symbol.asyncIterator) {
  47. var method = iterable[Symbol.asyncIterator];
  48. if (method != null) return method.call(iterable);
  49. }
  50. if (Symbol.iterator) {
  51. return iterable[Symbol.iterator]();
  52. }
  53. }
  54. throw new TypeError("Object is not async iterable");
  55. };
  56. babelHelpers.asyncGenerator = function () {
  57. function AwaitValue(value) {
  58. this.value = value;
  59. }
  60. function AsyncGenerator(gen) {
  61. var front, back;
  62. function send(key, arg) {
  63. return new Promise(function (resolve, reject) {
  64. var request = {
  65. key: key,
  66. arg: arg,
  67. resolve: resolve,
  68. reject: reject,
  69. next: null
  70. };
  71. if (back) {
  72. back = back.next = request;
  73. } else {
  74. front = back = request;
  75. resume(key, arg);
  76. }
  77. });
  78. }
  79. function resume(key, arg) {
  80. try {
  81. var result = gen[key](arg);
  82. var value = result.value;
  83. if (value instanceof AwaitValue) {
  84. Promise.resolve(value.value).then(function (arg) {
  85. resume("next", arg);
  86. }, function (arg) {
  87. resume("throw", arg);
  88. });
  89. } else {
  90. settle(result.done ? "return" : "normal", result.value);
  91. }
  92. } catch (err) {
  93. settle("throw", err);
  94. }
  95. }
  96. function settle(type, value) {
  97. switch (type) {
  98. case "return":
  99. front.resolve({
  100. value: value,
  101. done: true
  102. });
  103. break;
  104. case "throw":
  105. front.reject(value);
  106. break;
  107. default:
  108. front.resolve({
  109. value: value,
  110. done: false
  111. });
  112. break;
  113. }
  114. front = front.next;
  115. if (front) {
  116. resume(front.key, front.arg);
  117. } else {
  118. back = null;
  119. }
  120. }
  121. this._invoke = send;
  122. if (typeof gen.return !== "function") {
  123. this.return = undefined;
  124. }
  125. }
  126. if (typeof Symbol === "function" && Symbol.asyncIterator) {
  127. AsyncGenerator.prototype[Symbol.asyncIterator] = function () {
  128. return this;
  129. };
  130. }
  131. AsyncGenerator.prototype.next = function (arg) {
  132. return this._invoke("next", arg);
  133. };
  134. AsyncGenerator.prototype.throw = function (arg) {
  135. return this._invoke("throw", arg);
  136. };
  137. AsyncGenerator.prototype.return = function (arg) {
  138. return this._invoke("return", arg);
  139. };
  140. return {
  141. wrap: function (fn) {
  142. return function () {
  143. return new AsyncGenerator(fn.apply(this, arguments));
  144. };
  145. },
  146. await: function (value) {
  147. return new AwaitValue(value);
  148. }
  149. };
  150. }();
  151. babelHelpers.asyncGeneratorDelegate = function (inner, awaitWrap) {
  152. var iter = {},
  153. waiting = false;
  154. function pump(key, value) {
  155. waiting = true;
  156. value = new Promise(function (resolve) {
  157. resolve(inner[key](value));
  158. });
  159. return {
  160. done: false,
  161. value: awaitWrap(value)
  162. };
  163. }
  164. ;
  165. if (typeof Symbol === "function" && Symbol.iterator) {
  166. iter[Symbol.iterator] = function () {
  167. return this;
  168. };
  169. }
  170. iter.next = function (value) {
  171. if (waiting) {
  172. waiting = false;
  173. return value;
  174. }
  175. return pump("next", value);
  176. };
  177. if (typeof inner.throw === "function") {
  178. iter.throw = function (value) {
  179. if (waiting) {
  180. waiting = false;
  181. throw value;
  182. }
  183. return pump("throw", value);
  184. };
  185. }
  186. if (typeof inner.return === "function") {
  187. iter.return = function (value) {
  188. return pump("return", value);
  189. };
  190. }
  191. return iter;
  192. };
  193. babelHelpers.asyncToGenerator = function (fn) {
  194. return function () {
  195. var gen = fn.apply(this, arguments);
  196. return new Promise(function (resolve, reject) {
  197. function step(key, arg) {
  198. try {
  199. var info = gen[key](arg);
  200. var value = info.value;
  201. } catch (error) {
  202. reject(error);
  203. return;
  204. }
  205. if (info.done) {
  206. resolve(value);
  207. } else {
  208. return Promise.resolve(value).then(function (value) {
  209. step("next", value);
  210. }, function (err) {
  211. step("throw", err);
  212. });
  213. }
  214. }
  215. return step("next");
  216. });
  217. };
  218. };
  219. babelHelpers.classCallCheck = function (instance, Constructor) {
  220. if (!(instance instanceof Constructor)) {
  221. throw new TypeError("Cannot call a class as a function");
  222. }
  223. };
  224. babelHelpers.createClass = function () {
  225. function defineProperties(target, props) {
  226. for (var i = 0; i < props.length; i++) {
  227. var descriptor = props[i];
  228. descriptor.enumerable = descriptor.enumerable || false;
  229. descriptor.configurable = true;
  230. if ("value" in descriptor) descriptor.writable = true;
  231. Object.defineProperty(target, descriptor.key, descriptor);
  232. }
  233. }
  234. return function (Constructor, protoProps, staticProps) {
  235. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  236. if (staticProps) defineProperties(Constructor, staticProps);
  237. return Constructor;
  238. };
  239. }();
  240. babelHelpers.defineEnumerableProperties = function (obj, descs) {
  241. for (var key in descs) {
  242. var desc = descs[key];
  243. desc.configurable = desc.enumerable = true;
  244. if ("value" in desc) desc.writable = true;
  245. Object.defineProperty(obj, key, desc);
  246. }
  247. return obj;
  248. };
  249. babelHelpers.defaults = function (obj, defaults) {
  250. var keys = Object.getOwnPropertyNames(defaults);
  251. for (var i = 0; i < keys.length; i++) {
  252. var key = keys[i];
  253. var value = Object.getOwnPropertyDescriptor(defaults, key);
  254. if (value && value.configurable && obj[key] === undefined) {
  255. Object.defineProperty(obj, key, value);
  256. }
  257. }
  258. return obj;
  259. };
  260. babelHelpers.defineProperty = function (obj, key, value) {
  261. if (key in obj) {
  262. Object.defineProperty(obj, key, {
  263. value: value,
  264. enumerable: true,
  265. configurable: true,
  266. writable: true
  267. });
  268. } else {
  269. obj[key] = value;
  270. }
  271. return obj;
  272. };
  273. babelHelpers.extends = Object.assign || function (target) {
  274. for (var i = 1; i < arguments.length; i++) {
  275. var source = arguments[i];
  276. for (var key in source) {
  277. if (Object.prototype.hasOwnProperty.call(source, key)) {
  278. target[key] = source[key];
  279. }
  280. }
  281. }
  282. return target;
  283. };
  284. babelHelpers.get = function get(object, property, receiver) {
  285. if (object === null) object = Function.prototype;
  286. var desc = Object.getOwnPropertyDescriptor(object, property);
  287. if (desc === undefined) {
  288. var parent = Object.getPrototypeOf(object);
  289. if (parent === null) {
  290. return undefined;
  291. } else {
  292. return get(parent, property, receiver);
  293. }
  294. } else if ("value" in desc) {
  295. return desc.value;
  296. } else {
  297. var getter = desc.get;
  298. if (getter === undefined) {
  299. return undefined;
  300. }
  301. return getter.call(receiver);
  302. }
  303. };
  304. babelHelpers.inherits = function (subClass, superClass) {
  305. if (typeof superClass !== "function" && superClass !== null) {
  306. throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
  307. }
  308. subClass.prototype = Object.create(superClass && superClass.prototype, {
  309. constructor: {
  310. value: subClass,
  311. enumerable: false,
  312. writable: true,
  313. configurable: true
  314. }
  315. });
  316. if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
  317. };
  318. babelHelpers.instanceof = function (left, right) {
  319. if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
  320. return right[Symbol.hasInstance](left);
  321. } else {
  322. return left instanceof right;
  323. }
  324. };
  325. babelHelpers.interopRequireDefault = function (obj) {
  326. return obj && obj.__esModule ? obj : {
  327. default: obj
  328. };
  329. };
  330. babelHelpers.interopRequireWildcard = function (obj) {
  331. if (obj && obj.__esModule) {
  332. return obj;
  333. } else {
  334. var newObj = {};
  335. if (obj != null) {
  336. for (var key in obj) {
  337. if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];
  338. }
  339. }
  340. newObj.default = obj;
  341. return newObj;
  342. }
  343. };
  344. babelHelpers.newArrowCheck = function (innerThis, boundThis) {
  345. if (innerThis !== boundThis) {
  346. throw new TypeError("Cannot instantiate an arrow function");
  347. }
  348. };
  349. babelHelpers.objectDestructuringEmpty = function (obj) {
  350. if (obj == null) throw new TypeError("Cannot destructure undefined");
  351. };
  352. babelHelpers.objectWithoutProperties = function (obj, keys) {
  353. var target = {};
  354. for (var i in obj) {
  355. if (keys.indexOf(i) >= 0) continue;
  356. if (!Object.prototype.hasOwnProperty.call(obj, i)) continue;
  357. target[i] = obj[i];
  358. }
  359. return target;
  360. };
  361. babelHelpers.possibleConstructorReturn = function (self, call) {
  362. if (!self) {
  363. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  364. }
  365. return call && (typeof call === "object" || typeof call === "function") ? call : self;
  366. };
  367. babelHelpers.selfGlobal = typeof global === "undefined" ? self : global;
  368. babelHelpers.set = function set(object, property, value, receiver) {
  369. var desc = Object.getOwnPropertyDescriptor(object, property);
  370. if (desc === undefined) {
  371. var parent = Object.getPrototypeOf(object);
  372. if (parent !== null) {
  373. set(parent, property, value, receiver);
  374. }
  375. } else if ("value" in desc && desc.writable) {
  376. desc.value = value;
  377. } else {
  378. var setter = desc.set;
  379. if (setter !== undefined) {
  380. setter.call(receiver, value);
  381. }
  382. }
  383. return value;
  384. };
  385. babelHelpers.slicedToArray = function () {
  386. function sliceIterator(arr, i) {
  387. var _arr = [];
  388. var _n = true;
  389. var _d = false;
  390. var _e = undefined;
  391. try {
  392. for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
  393. _arr.push(_s.value);
  394. if (i && _arr.length === i) break;
  395. }
  396. } catch (err) {
  397. _d = true;
  398. _e = err;
  399. } finally {
  400. try {
  401. if (!_n && _i["return"]) _i["return"]();
  402. } finally {
  403. if (_d) throw _e;
  404. }
  405. }
  406. return _arr;
  407. }
  408. return function (arr, i) {
  409. if (Array.isArray(arr)) {
  410. return arr;
  411. } else if (Symbol.iterator in Object(arr)) {
  412. return sliceIterator(arr, i);
  413. } else {
  414. throw new TypeError("Invalid attempt to destructure non-iterable instance");
  415. }
  416. };
  417. }();
  418. babelHelpers.slicedToArrayLoose = function (arr, i) {
  419. if (Array.isArray(arr)) {
  420. return arr;
  421. } else if (Symbol.iterator in Object(arr)) {
  422. var _arr = [];
  423. for (var _iterator = arr[Symbol.iterator](), _step; !(_step = _iterator.next()).done;) {
  424. _arr.push(_step.value);
  425. if (i && _arr.length === i) break;
  426. }
  427. return _arr;
  428. } else {
  429. throw new TypeError("Invalid attempt to destructure non-iterable instance");
  430. }
  431. };
  432. babelHelpers.taggedTemplateLiteral = function (strings, raw) {
  433. return Object.freeze(Object.defineProperties(strings, {
  434. raw: {
  435. value: Object.freeze(raw)
  436. }
  437. }));
  438. };
  439. babelHelpers.taggedTemplateLiteralLoose = function (strings, raw) {
  440. strings.raw = raw;
  441. return strings;
  442. };
  443. babelHelpers.temporalRef = function (val, name, undef) {
  444. if (val === undef) {
  445. throw new ReferenceError(name + " is not defined - temporal dead zone");
  446. } else {
  447. return val;
  448. }
  449. };
  450. babelHelpers.temporalUndefined = {};
  451. babelHelpers.toArray = function (arr) {
  452. return Array.isArray(arr) ? arr : Array.from(arr);
  453. };
  454. babelHelpers.toConsumableArray = function (arr) {
  455. if (Array.isArray(arr)) {
  456. for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];
  457. return arr2;
  458. } else {
  459. return Array.from(arr);
  460. }
  461. };
  462. })(typeof global === "undefined" ? self : global);