media-utils.js 63 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946
  1. this["wp"] = this["wp"] || {}; this["wp"]["mediaUtils"] =
  2. /******/ (function(modules) { // webpackBootstrap
  3. /******/ // The module cache
  4. /******/ var installedModules = {};
  5. /******/
  6. /******/ // The require function
  7. /******/ function __webpack_require__(moduleId) {
  8. /******/
  9. /******/ // Check if module is in cache
  10. /******/ if(installedModules[moduleId]) {
  11. /******/ return installedModules[moduleId].exports;
  12. /******/ }
  13. /******/ // Create a new module (and put it into the cache)
  14. /******/ var module = installedModules[moduleId] = {
  15. /******/ i: moduleId,
  16. /******/ l: false,
  17. /******/ exports: {}
  18. /******/ };
  19. /******/
  20. /******/ // Execute the module function
  21. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  22. /******/
  23. /******/ // Flag the module as loaded
  24. /******/ module.l = true;
  25. /******/
  26. /******/ // Return the exports of the module
  27. /******/ return module.exports;
  28. /******/ }
  29. /******/
  30. /******/
  31. /******/ // expose the modules object (__webpack_modules__)
  32. /******/ __webpack_require__.m = modules;
  33. /******/
  34. /******/ // expose the module cache
  35. /******/ __webpack_require__.c = installedModules;
  36. /******/
  37. /******/ // define getter function for harmony exports
  38. /******/ __webpack_require__.d = function(exports, name, getter) {
  39. /******/ if(!__webpack_require__.o(exports, name)) {
  40. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  41. /******/ }
  42. /******/ };
  43. /******/
  44. /******/ // define __esModule on exports
  45. /******/ __webpack_require__.r = function(exports) {
  46. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  47. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  48. /******/ }
  49. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  50. /******/ };
  51. /******/
  52. /******/ // create a fake namespace object
  53. /******/ // mode & 1: value is a module id, require it
  54. /******/ // mode & 2: merge all properties of value into the ns
  55. /******/ // mode & 4: return value when already ns object
  56. /******/ // mode & 8|1: behave like require
  57. /******/ __webpack_require__.t = function(value, mode) {
  58. /******/ if(mode & 1) value = __webpack_require__(value);
  59. /******/ if(mode & 8) return value;
  60. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  61. /******/ var ns = Object.create(null);
  62. /******/ __webpack_require__.r(ns);
  63. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  64. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  65. /******/ return ns;
  66. /******/ };
  67. /******/
  68. /******/ // getDefaultExport function for compatibility with non-harmony modules
  69. /******/ __webpack_require__.n = function(module) {
  70. /******/ var getter = module && module.__esModule ?
  71. /******/ function getDefault() { return module['default']; } :
  72. /******/ function getModuleExports() { return module; };
  73. /******/ __webpack_require__.d(getter, 'a', getter);
  74. /******/ return getter;
  75. /******/ };
  76. /******/
  77. /******/ // Object.prototype.hasOwnProperty.call
  78. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  79. /******/
  80. /******/ // __webpack_public_path__
  81. /******/ __webpack_require__.p = "";
  82. /******/
  83. /******/
  84. /******/ // Load entry module and return exports
  85. /******/ return __webpack_require__(__webpack_require__.s = 362);
  86. /******/ })
  87. /************************************************************************/
  88. /******/ ({
  89. /***/ 0:
  90. /***/ (function(module, exports) {
  91. (function() { module.exports = this["wp"]["element"]; }());
  92. /***/ }),
  93. /***/ 1:
  94. /***/ (function(module, exports) {
  95. (function() { module.exports = this["wp"]["i18n"]; }());
  96. /***/ }),
  97. /***/ 10:
  98. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  99. "use strict";
  100. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _defineProperty; });
  101. function _defineProperty(obj, key, value) {
  102. if (key in obj) {
  103. Object.defineProperty(obj, key, {
  104. value: value,
  105. enumerable: true,
  106. configurable: true,
  107. writable: true
  108. });
  109. } else {
  110. obj[key] = value;
  111. }
  112. return obj;
  113. }
  114. /***/ }),
  115. /***/ 11:
  116. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  117. "use strict";
  118. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _createClass; });
  119. function _defineProperties(target, props) {
  120. for (var i = 0; i < props.length; i++) {
  121. var descriptor = props[i];
  122. descriptor.enumerable = descriptor.enumerable || false;
  123. descriptor.configurable = true;
  124. if ("value" in descriptor) descriptor.writable = true;
  125. Object.defineProperty(target, descriptor.key, descriptor);
  126. }
  127. }
  128. function _createClass(Constructor, protoProps, staticProps) {
  129. if (protoProps) _defineProperties(Constructor.prototype, protoProps);
  130. if (staticProps) _defineProperties(Constructor, staticProps);
  131. return Constructor;
  132. }
  133. /***/ }),
  134. /***/ 12:
  135. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  136. "use strict";
  137. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _classCallCheck; });
  138. function _classCallCheck(instance, Constructor) {
  139. if (!(instance instanceof Constructor)) {
  140. throw new TypeError("Cannot call a class as a function");
  141. }
  142. }
  143. /***/ }),
  144. /***/ 13:
  145. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  146. "use strict";
  147. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _possibleConstructorReturn; });
  148. /* harmony import */ var _helpers_esm_typeof__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(31);
  149. /* harmony import */ var _assertThisInitialized__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(5);
  150. function _possibleConstructorReturn(self, call) {
  151. if (call && (Object(_helpers_esm_typeof__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(call) === "object" || typeof call === "function")) {
  152. return call;
  153. }
  154. return Object(_assertThisInitialized__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"])(self);
  155. }
  156. /***/ }),
  157. /***/ 14:
  158. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  159. "use strict";
  160. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _getPrototypeOf; });
  161. function _getPrototypeOf(o) {
  162. _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
  163. return o.__proto__ || Object.getPrototypeOf(o);
  164. };
  165. return _getPrototypeOf(o);
  166. }
  167. /***/ }),
  168. /***/ 15:
  169. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  170. "use strict";
  171. // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js
  172. function _setPrototypeOf(o, p) {
  173. _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
  174. o.__proto__ = p;
  175. return o;
  176. };
  177. return _setPrototypeOf(o, p);
  178. }
  179. // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/inherits.js
  180. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _inherits; });
  181. function _inherits(subClass, superClass) {
  182. if (typeof superClass !== "function" && superClass !== null) {
  183. throw new TypeError("Super expression must either be null or a function");
  184. }
  185. subClass.prototype = Object.create(superClass && superClass.prototype, {
  186. constructor: {
  187. value: subClass,
  188. writable: true,
  189. configurable: true
  190. }
  191. });
  192. if (superClass) _setPrototypeOf(subClass, superClass);
  193. }
  194. /***/ }),
  195. /***/ 17:
  196. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  197. "use strict";
  198. // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js
  199. function _arrayWithoutHoles(arr) {
  200. if (Array.isArray(arr)) {
  201. for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) {
  202. arr2[i] = arr[i];
  203. }
  204. return arr2;
  205. }
  206. }
  207. // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/iterableToArray.js
  208. var iterableToArray = __webpack_require__(30);
  209. // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js
  210. function _nonIterableSpread() {
  211. throw new TypeError("Invalid attempt to spread non-iterable instance");
  212. }
  213. // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js
  214. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _toConsumableArray; });
  215. function _toConsumableArray(arr) {
  216. return _arrayWithoutHoles(arr) || Object(iterableToArray["a" /* default */])(arr) || _nonIterableSpread();
  217. }
  218. /***/ }),
  219. /***/ 2:
  220. /***/ (function(module, exports) {
  221. (function() { module.exports = this["lodash"]; }());
  222. /***/ }),
  223. /***/ 20:
  224. /***/ (function(module, exports, __webpack_require__) {
  225. module.exports = __webpack_require__(47);
  226. /***/ }),
  227. /***/ 23:
  228. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  229. "use strict";
  230. // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js
  231. var arrayWithHoles = __webpack_require__(38);
  232. // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js
  233. function _iterableToArrayLimit(arr, i) {
  234. var _arr = [];
  235. var _n = true;
  236. var _d = false;
  237. var _e = undefined;
  238. try {
  239. for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
  240. _arr.push(_s.value);
  241. if (i && _arr.length === i) break;
  242. }
  243. } catch (err) {
  244. _d = true;
  245. _e = err;
  246. } finally {
  247. try {
  248. if (!_n && _i["return"] != null) _i["return"]();
  249. } finally {
  250. if (_d) throw _e;
  251. }
  252. }
  253. return _arr;
  254. }
  255. // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/nonIterableRest.js
  256. var nonIterableRest = __webpack_require__(39);
  257. // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js
  258. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _slicedToArray; });
  259. function _slicedToArray(arr, i) {
  260. return Object(arrayWithHoles["a" /* default */])(arr) || _iterableToArrayLimit(arr, i) || Object(nonIterableRest["a" /* default */])();
  261. }
  262. /***/ }),
  263. /***/ 30:
  264. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  265. "use strict";
  266. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _iterableToArray; });
  267. function _iterableToArray(iter) {
  268. if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter);
  269. }
  270. /***/ }),
  271. /***/ 31:
  272. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  273. "use strict";
  274. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _typeof; });
  275. function _typeof2(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof2 = function _typeof2(obj) { return typeof obj; }; } else { _typeof2 = function _typeof2(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof2(obj); }
  276. function _typeof(obj) {
  277. if (typeof Symbol === "function" && _typeof2(Symbol.iterator) === "symbol") {
  278. _typeof = function _typeof(obj) {
  279. return _typeof2(obj);
  280. };
  281. } else {
  282. _typeof = function _typeof(obj) {
  283. return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : _typeof2(obj);
  284. };
  285. }
  286. return _typeof(obj);
  287. }
  288. /***/ }),
  289. /***/ 34:
  290. /***/ (function(module, exports) {
  291. (function() { module.exports = this["wp"]["apiFetch"]; }());
  292. /***/ }),
  293. /***/ 35:
  294. /***/ (function(module, exports) {
  295. (function() { module.exports = this["wp"]["blob"]; }());
  296. /***/ }),
  297. /***/ 362:
  298. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  299. "use strict";
  300. __webpack_require__.r(__webpack_exports__);
  301. // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/classCallCheck.js
  302. var classCallCheck = __webpack_require__(12);
  303. // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/createClass.js
  304. var createClass = __webpack_require__(11);
  305. // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js
  306. var possibleConstructorReturn = __webpack_require__(13);
  307. // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js
  308. var getPrototypeOf = __webpack_require__(14);
  309. // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js
  310. var assertThisInitialized = __webpack_require__(5);
  311. // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/inherits.js + 1 modules
  312. var inherits = __webpack_require__(15);
  313. // EXTERNAL MODULE: external "lodash"
  314. var external_lodash_ = __webpack_require__(2);
  315. // EXTERNAL MODULE: external {"this":["wp","element"]}
  316. var external_this_wp_element_ = __webpack_require__(0);
  317. // EXTERNAL MODULE: external {"this":["wp","i18n"]}
  318. var external_this_wp_i18n_ = __webpack_require__(1);
  319. // CONCATENATED MODULE: ./node_modules/@wordpress/media-utils/build-module/components/media-upload/index.js
  320. /**
  321. * External dependencies
  322. */
  323. /**
  324. * WordPress dependencies
  325. */
  326. var _window = window,
  327. wp = _window.wp;
  328. var getFeaturedImageMediaFrame = function getFeaturedImageMediaFrame() {
  329. return wp.media.view.MediaFrame.Select.extend({
  330. /**
  331. * Enables the Set Featured Image Button.
  332. *
  333. * @param {Object} toolbar toolbar for featured image state
  334. * @return {void}
  335. */
  336. featuredImageToolbar: function featuredImageToolbar(toolbar) {
  337. this.createSelectToolbar(toolbar, {
  338. text: wp.media.view.l10n.setFeaturedImage,
  339. state: this.options.state
  340. });
  341. },
  342. /**
  343. * Create the default states.
  344. *
  345. * @return {void}
  346. */
  347. createStates: function createStates() {
  348. this.on('toolbar:create:featured-image', this.featuredImageToolbar, this);
  349. this.states.add([new wp.media.controller.FeaturedImage()]);
  350. }
  351. });
  352. }; // Getter for the sake of unit tests.
  353. var media_upload_getGalleryDetailsMediaFrame = function getGalleryDetailsMediaFrame() {
  354. /**
  355. * Custom gallery details frame.
  356. *
  357. * @see https://github.com/xwp/wp-core-media-widgets/blob/905edbccfc2a623b73a93dac803c5335519d7837/wp-admin/js/widgets/media-gallery-widget.js
  358. * @class GalleryDetailsMediaFrame
  359. * @class
  360. */
  361. return wp.media.view.MediaFrame.Post.extend({
  362. /**
  363. * Create the default states.
  364. *
  365. * @return {void}
  366. */
  367. createStates: function createStates() {
  368. this.states.add([new wp.media.controller.Library({
  369. id: 'gallery',
  370. title: wp.media.view.l10n.createGalleryTitle,
  371. priority: 40,
  372. toolbar: 'main-gallery',
  373. filterable: 'uploaded',
  374. multiple: 'add',
  375. editable: false,
  376. library: wp.media.query(Object(external_lodash_["defaults"])({
  377. type: 'image'
  378. }, this.options.library))
  379. }), new wp.media.controller.GalleryEdit({
  380. library: this.options.selection,
  381. editing: this.options.editing,
  382. menu: 'gallery',
  383. displaySettings: false,
  384. multiple: true
  385. }), new wp.media.controller.GalleryAdd()]);
  386. }
  387. });
  388. }; // the media library image object contains numerous attributes
  389. // we only need this set to display the image in the library
  390. var media_upload_slimImageObject = function slimImageObject(img) {
  391. var attrSet = ['sizes', 'mime', 'type', 'subtype', 'id', 'url', 'alt', 'link', 'caption'];
  392. return Object(external_lodash_["pick"])(img, attrSet);
  393. };
  394. var getAttachmentsCollection = function getAttachmentsCollection(ids) {
  395. return wp.media.query({
  396. order: 'ASC',
  397. orderby: 'post__in',
  398. post__in: ids,
  399. posts_per_page: -1,
  400. query: true,
  401. type: 'image'
  402. });
  403. };
  404. var media_upload_MediaUpload =
  405. /*#__PURE__*/
  406. function (_Component) {
  407. Object(inherits["a" /* default */])(MediaUpload, _Component);
  408. function MediaUpload(_ref) {
  409. var _this;
  410. var allowedTypes = _ref.allowedTypes,
  411. _ref$gallery = _ref.gallery,
  412. gallery = _ref$gallery === void 0 ? false : _ref$gallery,
  413. _ref$unstableFeatured = _ref.unstableFeaturedImageFlow,
  414. unstableFeaturedImageFlow = _ref$unstableFeatured === void 0 ? false : _ref$unstableFeatured,
  415. modalClass = _ref.modalClass,
  416. _ref$multiple = _ref.multiple,
  417. multiple = _ref$multiple === void 0 ? false : _ref$multiple,
  418. _ref$title = _ref.title,
  419. title = _ref$title === void 0 ? Object(external_this_wp_i18n_["__"])('Select or Upload Media') : _ref$title;
  420. Object(classCallCheck["a" /* default */])(this, MediaUpload);
  421. _this = Object(possibleConstructorReturn["a" /* default */])(this, Object(getPrototypeOf["a" /* default */])(MediaUpload).apply(this, arguments));
  422. _this.openModal = _this.openModal.bind(Object(assertThisInitialized["a" /* default */])(_this));
  423. _this.onOpen = _this.onOpen.bind(Object(assertThisInitialized["a" /* default */])(_this));
  424. _this.onSelect = _this.onSelect.bind(Object(assertThisInitialized["a" /* default */])(_this));
  425. _this.onUpdate = _this.onUpdate.bind(Object(assertThisInitialized["a" /* default */])(_this));
  426. _this.onClose = _this.onClose.bind(Object(assertThisInitialized["a" /* default */])(_this));
  427. if (gallery) {
  428. _this.buildAndSetGalleryFrame();
  429. } else {
  430. var frameConfig = {
  431. title: title,
  432. multiple: multiple
  433. };
  434. if (!!allowedTypes) {
  435. frameConfig.library = {
  436. type: allowedTypes
  437. };
  438. }
  439. _this.frame = wp.media(frameConfig);
  440. }
  441. if (modalClass) {
  442. _this.frame.$el.addClass(modalClass);
  443. }
  444. if (unstableFeaturedImageFlow) {
  445. _this.buildAndSetFeatureImageFrame();
  446. }
  447. _this.initializeListeners();
  448. return _this;
  449. }
  450. Object(createClass["a" /* default */])(MediaUpload, [{
  451. key: "initializeListeners",
  452. value: function initializeListeners() {
  453. // When an image is selected in the media frame...
  454. this.frame.on('select', this.onSelect);
  455. this.frame.on('update', this.onUpdate);
  456. this.frame.on('open', this.onOpen);
  457. this.frame.on('close', this.onClose);
  458. }
  459. }, {
  460. key: "buildAndSetGalleryFrame",
  461. value: function buildAndSetGalleryFrame() {
  462. var _this$props = this.props,
  463. _this$props$addToGall = _this$props.addToGallery,
  464. addToGallery = _this$props$addToGall === void 0 ? false : _this$props$addToGall,
  465. allowedTypes = _this$props.allowedTypes,
  466. _this$props$multiple = _this$props.multiple,
  467. multiple = _this$props$multiple === void 0 ? false : _this$props$multiple,
  468. _this$props$value = _this$props.value,
  469. value = _this$props$value === void 0 ? null : _this$props$value; // If the value did not changed there is no need to rebuild the frame,
  470. // we can continue to use the existing one.
  471. if (value === this.lastGalleryValue) {
  472. return;
  473. }
  474. this.lastGalleryValue = value; // If a frame already existed remove it.
  475. if (this.frame) {
  476. this.frame.remove();
  477. }
  478. var currentState;
  479. if (addToGallery) {
  480. currentState = 'gallery-library';
  481. } else {
  482. currentState = value ? 'gallery-edit' : 'gallery';
  483. }
  484. if (!this.GalleryDetailsMediaFrame) {
  485. this.GalleryDetailsMediaFrame = media_upload_getGalleryDetailsMediaFrame();
  486. }
  487. var attachments = getAttachmentsCollection(value);
  488. var selection = new wp.media.model.Selection(attachments.models, {
  489. props: attachments.props.toJSON(),
  490. multiple: multiple
  491. });
  492. this.frame = new this.GalleryDetailsMediaFrame({
  493. mimeType: allowedTypes,
  494. state: currentState,
  495. multiple: multiple,
  496. selection: selection,
  497. editing: value ? true : false
  498. });
  499. wp.media.frame = this.frame;
  500. this.initializeListeners();
  501. }
  502. }, {
  503. key: "buildAndSetFeatureImageFrame",
  504. value: function buildAndSetFeatureImageFrame() {
  505. var featuredImageFrame = getFeaturedImageMediaFrame();
  506. var attachments = getAttachmentsCollection(this.props.value);
  507. var selection = new wp.media.model.Selection(attachments.models, {
  508. props: attachments.props.toJSON()
  509. });
  510. this.frame = new featuredImageFrame({
  511. mimeType: this.props.allowedTypes,
  512. state: 'featured-image',
  513. multiple: this.props.multiple,
  514. selection: selection,
  515. editing: this.props.value ? true : false
  516. });
  517. wp.media.frame = this.frame;
  518. }
  519. }, {
  520. key: "componentWillUnmount",
  521. value: function componentWillUnmount() {
  522. this.frame.remove();
  523. }
  524. }, {
  525. key: "onUpdate",
  526. value: function onUpdate(selections) {
  527. var _this$props2 = this.props,
  528. onSelect = _this$props2.onSelect,
  529. _this$props2$multiple = _this$props2.multiple,
  530. multiple = _this$props2$multiple === void 0 ? false : _this$props2$multiple;
  531. var state = this.frame.state();
  532. var selectedImages = selections || state.get('selection');
  533. if (!selectedImages || !selectedImages.models.length) {
  534. return;
  535. }
  536. if (multiple) {
  537. onSelect(selectedImages.models.map(function (model) {
  538. return media_upload_slimImageObject(model.toJSON());
  539. }));
  540. } else {
  541. onSelect(media_upload_slimImageObject(selectedImages.models[0].toJSON()));
  542. }
  543. }
  544. }, {
  545. key: "onSelect",
  546. value: function onSelect() {
  547. var _this$props3 = this.props,
  548. onSelect = _this$props3.onSelect,
  549. _this$props3$multiple = _this$props3.multiple,
  550. multiple = _this$props3$multiple === void 0 ? false : _this$props3$multiple; // Get media attachment details from the frame state
  551. var attachment = this.frame.state().get('selection').toJSON();
  552. onSelect(multiple ? attachment : attachment[0]);
  553. }
  554. }, {
  555. key: "onOpen",
  556. value: function onOpen() {
  557. this.updateCollection();
  558. if (!this.props.value) {
  559. return;
  560. }
  561. if (!this.props.gallery) {
  562. var selection = this.frame.state().get('selection');
  563. Object(external_lodash_["castArray"])(this.props.value).forEach(function (id) {
  564. selection.add(wp.media.attachment(id));
  565. });
  566. } // load the images so they are available in the media modal.
  567. getAttachmentsCollection(Object(external_lodash_["castArray"])(this.props.value)).more();
  568. }
  569. }, {
  570. key: "onClose",
  571. value: function onClose() {
  572. var onClose = this.props.onClose;
  573. if (onClose) {
  574. onClose();
  575. }
  576. }
  577. }, {
  578. key: "updateCollection",
  579. value: function updateCollection() {
  580. var frameContent = this.frame.content.get();
  581. if (frameContent && frameContent.collection) {
  582. var collection = frameContent.collection; // clean all attachments we have in memory.
  583. collection.toArray().forEach(function (model) {
  584. return model.trigger('destroy', model);
  585. }); // reset has more flag, if library had small amount of items all items may have been loaded before.
  586. collection.mirroring._hasMore = true; // request items
  587. collection.more();
  588. }
  589. }
  590. }, {
  591. key: "openModal",
  592. value: function openModal() {
  593. if (this.props.gallery && this.props.value && this.props.value.length > 0) {
  594. this.buildAndSetGalleryFrame();
  595. }
  596. this.frame.open();
  597. }
  598. }, {
  599. key: "render",
  600. value: function render() {
  601. return this.props.render({
  602. open: this.openModal
  603. });
  604. }
  605. }]);
  606. return MediaUpload;
  607. }(external_this_wp_element_["Component"]);
  608. /* harmony default export */ var media_upload = (media_upload_MediaUpload);
  609. // CONCATENATED MODULE: ./node_modules/@wordpress/media-utils/build-module/components/index.js
  610. // EXTERNAL MODULE: ./node_modules/@babel/runtime/regenerator/index.js
  611. var regenerator = __webpack_require__(20);
  612. var regenerator_default = /*#__PURE__*/__webpack_require__.n(regenerator);
  613. // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/objectSpread.js
  614. var objectSpread = __webpack_require__(7);
  615. // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js
  616. var asyncToGenerator = __webpack_require__(43);
  617. // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js + 2 modules
  618. var toConsumableArray = __webpack_require__(17);
  619. // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js + 1 modules
  620. var slicedToArray = __webpack_require__(23);
  621. // EXTERNAL MODULE: external {"this":["wp","apiFetch"]}
  622. var external_this_wp_apiFetch_ = __webpack_require__(34);
  623. var external_this_wp_apiFetch_default = /*#__PURE__*/__webpack_require__.n(external_this_wp_apiFetch_);
  624. // EXTERNAL MODULE: external {"this":["wp","blob"]}
  625. var external_this_wp_blob_ = __webpack_require__(35);
  626. // CONCATENATED MODULE: ./node_modules/@wordpress/media-utils/build-module/utils/upload-media.js
  627. /**
  628. * External dependencies
  629. */
  630. /**
  631. * WordPress dependencies
  632. */
  633. /**
  634. * Browsers may use unexpected mime types, and they differ from browser to browser.
  635. * This function computes a flexible array of mime types from the mime type structured provided by the server.
  636. * Converts { jpg|jpeg|jpe: "image/jpeg" } into [ "image/jpeg", "image/jpg", "image/jpeg", "image/jpe" ]
  637. * The computation of this array instead of directly using the object,
  638. * solves the problem in chrome where mp3 files have audio/mp3 as mime type instead of audio/mpeg.
  639. * https://bugs.chromium.org/p/chromium/issues/detail?id=227004
  640. *
  641. * @param {?Object} wpMimeTypesObject Mime type object received from the server.
  642. * Extensions are keys separated by '|' and values are mime types associated with an extension.
  643. *
  644. * @return {?Array} An array of mime types or the parameter passed if it was "falsy".
  645. */
  646. function getMimeTypesArray(wpMimeTypesObject) {
  647. if (!wpMimeTypesObject) {
  648. return wpMimeTypesObject;
  649. }
  650. return Object(external_lodash_["flatMap"])(wpMimeTypesObject, function (mime, extensionsString) {
  651. var _mime$split = mime.split('/'),
  652. _mime$split2 = Object(slicedToArray["a" /* default */])(_mime$split, 1),
  653. type = _mime$split2[0];
  654. var extensions = extensionsString.split('|');
  655. return [mime].concat(Object(toConsumableArray["a" /* default */])(Object(external_lodash_["map"])(extensions, function (extension) {
  656. return "".concat(type, "/").concat(extension);
  657. })));
  658. });
  659. }
  660. /**
  661. * Media Upload is used by audio, image, gallery, video, and file blocks to
  662. * handle uploading a media file when a file upload button is activated.
  663. *
  664. * TODO: future enhancement to add an upload indicator.
  665. *
  666. * @param {Object} $0 Parameters object passed to the function.
  667. * @param {?Array} $0.allowedTypes Array with the types of media that can be uploaded, if unset all types are allowed.
  668. * @param {?Object} $0.additionalData Additional data to include in the request.
  669. * @param {Array} $0.filesList List of files.
  670. * @param {?number} $0.maxUploadFileSize Maximum upload size in bytes allowed for the site.
  671. * @param {Function} $0.onError Function called when an error happens.
  672. * @param {Function} $0.onFileChange Function called each time a file or a temporary representation of the file is available.
  673. * @param {?Object} $0.wpAllowedMimeTypes List of allowed mime types and file extensions.
  674. */
  675. function uploadMedia(_x) {
  676. return _uploadMedia.apply(this, arguments);
  677. }
  678. /**
  679. * @param {File} file Media File to Save.
  680. * @param {?Object} additionalData Additional data to include in the request.
  681. *
  682. * @return {Promise} Media Object Promise.
  683. */
  684. function _uploadMedia() {
  685. _uploadMedia = Object(asyncToGenerator["a" /* default */])(
  686. /*#__PURE__*/
  687. regenerator_default.a.mark(function _callee(_ref) {
  688. var allowedTypes, _ref$additionalData, additionalData, filesList, maxUploadFileSize, _ref$onError, onError, onFileChange, _ref$wpAllowedMimeTyp, wpAllowedMimeTypes, files, filesSet, setAndUpdateFiles, isAllowedType, allowedMimeTypesForUser, isAllowedMimeTypeForUser, triggerError, validFiles, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, _mediaFile, idx, mediaFile, savedMedia, mediaObject, message;
  689. return regenerator_default.a.wrap(function _callee$(_context) {
  690. while (1) {
  691. switch (_context.prev = _context.next) {
  692. case 0:
  693. allowedTypes = _ref.allowedTypes, _ref$additionalData = _ref.additionalData, additionalData = _ref$additionalData === void 0 ? {} : _ref$additionalData, filesList = _ref.filesList, maxUploadFileSize = _ref.maxUploadFileSize, _ref$onError = _ref.onError, onError = _ref$onError === void 0 ? external_lodash_["noop"] : _ref$onError, onFileChange = _ref.onFileChange, _ref$wpAllowedMimeTyp = _ref.wpAllowedMimeTypes, wpAllowedMimeTypes = _ref$wpAllowedMimeTyp === void 0 ? null : _ref$wpAllowedMimeTyp;
  694. // Cast filesList to array
  695. files = Object(toConsumableArray["a" /* default */])(filesList);
  696. filesSet = [];
  697. setAndUpdateFiles = function setAndUpdateFiles(idx, value) {
  698. Object(external_this_wp_blob_["revokeBlobURL"])(Object(external_lodash_["get"])(filesSet, [idx, 'url']));
  699. filesSet[idx] = value;
  700. onFileChange(Object(external_lodash_["compact"])(filesSet));
  701. }; // Allowed type specified by consumer
  702. isAllowedType = function isAllowedType(fileType) {
  703. if (!allowedTypes) {
  704. return true;
  705. }
  706. return Object(external_lodash_["some"])(allowedTypes, function (allowedType) {
  707. // If a complete mimetype is specified verify if it matches exactly the mime type of the file.
  708. if (Object(external_lodash_["includes"])(allowedType, '/')) {
  709. return allowedType === fileType;
  710. } // Otherwise a general mime type is used and we should verify if the file mimetype starts with it.
  711. return Object(external_lodash_["startsWith"])(fileType, "".concat(allowedType, "/"));
  712. });
  713. }; // Allowed types for the current WP_User
  714. allowedMimeTypesForUser = getMimeTypesArray(wpAllowedMimeTypes);
  715. isAllowedMimeTypeForUser = function isAllowedMimeTypeForUser(fileType) {
  716. return Object(external_lodash_["includes"])(allowedMimeTypesForUser, fileType);
  717. }; // Build the error message including the filename
  718. triggerError = function triggerError(error) {
  719. error.message = [Object(external_this_wp_element_["createElement"])("strong", {
  720. key: "filename"
  721. }, error.file.name), ': ', error.message];
  722. onError(error);
  723. };
  724. validFiles = [];
  725. _iteratorNormalCompletion = true;
  726. _didIteratorError = false;
  727. _iteratorError = undefined;
  728. _context.prev = 12;
  729. _iterator = files[Symbol.iterator]();
  730. case 14:
  731. if (_iteratorNormalCompletion = (_step = _iterator.next()).done) {
  732. _context.next = 34;
  733. break;
  734. }
  735. _mediaFile = _step.value;
  736. if (!(allowedMimeTypesForUser && !isAllowedMimeTypeForUser(_mediaFile.type))) {
  737. _context.next = 19;
  738. break;
  739. }
  740. triggerError({
  741. code: 'MIME_TYPE_NOT_ALLOWED_FOR_USER',
  742. message: Object(external_this_wp_i18n_["__"])('Sorry, this file type is not permitted for security reasons.'),
  743. file: _mediaFile
  744. });
  745. return _context.abrupt("continue", 31);
  746. case 19:
  747. if (isAllowedType(_mediaFile.type)) {
  748. _context.next = 22;
  749. break;
  750. }
  751. triggerError({
  752. code: 'MIME_TYPE_NOT_SUPPORTED',
  753. message: Object(external_this_wp_i18n_["__"])('Sorry, this file type is not supported here.'),
  754. file: _mediaFile
  755. });
  756. return _context.abrupt("continue", 31);
  757. case 22:
  758. if (!(maxUploadFileSize && _mediaFile.size > maxUploadFileSize)) {
  759. _context.next = 25;
  760. break;
  761. }
  762. triggerError({
  763. code: 'SIZE_ABOVE_LIMIT',
  764. message: Object(external_this_wp_i18n_["__"])('This file exceeds the maximum upload size for this site.'),
  765. file: _mediaFile
  766. });
  767. return _context.abrupt("continue", 31);
  768. case 25:
  769. if (!(_mediaFile.size <= 0)) {
  770. _context.next = 28;
  771. break;
  772. }
  773. triggerError({
  774. code: 'EMPTY_FILE',
  775. message: Object(external_this_wp_i18n_["__"])('This file is empty.'),
  776. file: _mediaFile
  777. });
  778. return _context.abrupt("continue", 31);
  779. case 28:
  780. validFiles.push(_mediaFile); // Set temporary URL to create placeholder media file, this is replaced
  781. // with final file from media gallery when upload is `done` below
  782. filesSet.push({
  783. url: Object(external_this_wp_blob_["createBlobURL"])(_mediaFile)
  784. });
  785. onFileChange(filesSet);
  786. case 31:
  787. _iteratorNormalCompletion = true;
  788. _context.next = 14;
  789. break;
  790. case 34:
  791. _context.next = 40;
  792. break;
  793. case 36:
  794. _context.prev = 36;
  795. _context.t0 = _context["catch"](12);
  796. _didIteratorError = true;
  797. _iteratorError = _context.t0;
  798. case 40:
  799. _context.prev = 40;
  800. _context.prev = 41;
  801. if (!_iteratorNormalCompletion && _iterator.return != null) {
  802. _iterator.return();
  803. }
  804. case 43:
  805. _context.prev = 43;
  806. if (!_didIteratorError) {
  807. _context.next = 46;
  808. break;
  809. }
  810. throw _iteratorError;
  811. case 46:
  812. return _context.finish(43);
  813. case 47:
  814. return _context.finish(40);
  815. case 48:
  816. idx = 0;
  817. case 49:
  818. if (!(idx < validFiles.length)) {
  819. _context.next = 68;
  820. break;
  821. }
  822. mediaFile = validFiles[idx];
  823. _context.prev = 51;
  824. _context.next = 54;
  825. return createMediaFromFile(mediaFile, additionalData);
  826. case 54:
  827. savedMedia = _context.sent;
  828. mediaObject = Object(objectSpread["a" /* default */])({}, Object(external_lodash_["omit"])(savedMedia, ['alt_text', 'source_url']), {
  829. alt: savedMedia.alt_text,
  830. caption: Object(external_lodash_["get"])(savedMedia, ['caption', 'raw'], ''),
  831. title: savedMedia.title.raw,
  832. url: savedMedia.source_url
  833. });
  834. setAndUpdateFiles(idx, mediaObject);
  835. _context.next = 65;
  836. break;
  837. case 59:
  838. _context.prev = 59;
  839. _context.t1 = _context["catch"](51);
  840. // Reset to empty on failure.
  841. setAndUpdateFiles(idx, null);
  842. message = void 0;
  843. if (Object(external_lodash_["has"])(_context.t1, ['message'])) {
  844. message = Object(external_lodash_["get"])(_context.t1, ['message']);
  845. } else {
  846. message = Object(external_this_wp_i18n_["sprintf"])( // translators: %s: file name
  847. Object(external_this_wp_i18n_["__"])('Error while uploading file %s to the media library.'), mediaFile.name);
  848. }
  849. onError({
  850. code: 'GENERAL',
  851. message: message,
  852. file: mediaFile
  853. });
  854. case 65:
  855. ++idx;
  856. _context.next = 49;
  857. break;
  858. case 68:
  859. case "end":
  860. return _context.stop();
  861. }
  862. }
  863. }, _callee, null, [[12, 36, 40, 48], [41,, 43, 47], [51, 59]]);
  864. }));
  865. return _uploadMedia.apply(this, arguments);
  866. }
  867. function createMediaFromFile(file, additionalData) {
  868. // Create upload payload
  869. var data = new window.FormData();
  870. data.append('file', file, file.name || file.type.replace('/', '.'));
  871. Object(external_lodash_["forEach"])(additionalData, function (value, key) {
  872. return data.append(key, value);
  873. });
  874. return external_this_wp_apiFetch_default()({
  875. path: '/wp/v2/media',
  876. body: data,
  877. method: 'POST'
  878. });
  879. }
  880. // CONCATENATED MODULE: ./node_modules/@wordpress/media-utils/build-module/utils/index.js
  881. // CONCATENATED MODULE: ./node_modules/@wordpress/media-utils/build-module/index.js
  882. /* concated harmony reexport MediaUpload */__webpack_require__.d(__webpack_exports__, "MediaUpload", function() { return media_upload; });
  883. /* concated harmony reexport uploadMedia */__webpack_require__.d(__webpack_exports__, "uploadMedia", function() { return uploadMedia; });
  884. /***/ }),
  885. /***/ 38:
  886. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  887. "use strict";
  888. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _arrayWithHoles; });
  889. function _arrayWithHoles(arr) {
  890. if (Array.isArray(arr)) return arr;
  891. }
  892. /***/ }),
  893. /***/ 39:
  894. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  895. "use strict";
  896. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _nonIterableRest; });
  897. function _nonIterableRest() {
  898. throw new TypeError("Invalid attempt to destructure non-iterable instance");
  899. }
  900. /***/ }),
  901. /***/ 43:
  902. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  903. "use strict";
  904. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _asyncToGenerator; });
  905. function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
  906. try {
  907. var info = gen[key](arg);
  908. var value = info.value;
  909. } catch (error) {
  910. reject(error);
  911. return;
  912. }
  913. if (info.done) {
  914. resolve(value);
  915. } else {
  916. Promise.resolve(value).then(_next, _throw);
  917. }
  918. }
  919. function _asyncToGenerator(fn) {
  920. return function () {
  921. var self = this,
  922. args = arguments;
  923. return new Promise(function (resolve, reject) {
  924. var gen = fn.apply(self, args);
  925. function _next(value) {
  926. asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
  927. }
  928. function _throw(err) {
  929. asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
  930. }
  931. _next(undefined);
  932. });
  933. };
  934. }
  935. /***/ }),
  936. /***/ 47:
  937. /***/ (function(module, exports, __webpack_require__) {
  938. /**
  939. * Copyright (c) 2014-present, Facebook, Inc.
  940. *
  941. * This source code is licensed under the MIT license found in the
  942. * LICENSE file in the root directory of this source tree.
  943. */
  944. var runtime = (function (exports) {
  945. "use strict";
  946. var Op = Object.prototype;
  947. var hasOwn = Op.hasOwnProperty;
  948. var undefined; // More compressible than void 0.
  949. var $Symbol = typeof Symbol === "function" ? Symbol : {};
  950. var iteratorSymbol = $Symbol.iterator || "@@iterator";
  951. var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
  952. var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
  953. function wrap(innerFn, outerFn, self, tryLocsList) {
  954. // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
  955. var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
  956. var generator = Object.create(protoGenerator.prototype);
  957. var context = new Context(tryLocsList || []);
  958. // The ._invoke method unifies the implementations of the .next,
  959. // .throw, and .return methods.
  960. generator._invoke = makeInvokeMethod(innerFn, self, context);
  961. return generator;
  962. }
  963. exports.wrap = wrap;
  964. // Try/catch helper to minimize deoptimizations. Returns a completion
  965. // record like context.tryEntries[i].completion. This interface could
  966. // have been (and was previously) designed to take a closure to be
  967. // invoked without arguments, but in all the cases we care about we
  968. // already have an existing method we want to call, so there's no need
  969. // to create a new function object. We can even get away with assuming
  970. // the method takes exactly one argument, since that happens to be true
  971. // in every case, so we don't have to touch the arguments object. The
  972. // only additional allocation required is the completion record, which
  973. // has a stable shape and so hopefully should be cheap to allocate.
  974. function tryCatch(fn, obj, arg) {
  975. try {
  976. return { type: "normal", arg: fn.call(obj, arg) };
  977. } catch (err) {
  978. return { type: "throw", arg: err };
  979. }
  980. }
  981. var GenStateSuspendedStart = "suspendedStart";
  982. var GenStateSuspendedYield = "suspendedYield";
  983. var GenStateExecuting = "executing";
  984. var GenStateCompleted = "completed";
  985. // Returning this object from the innerFn has the same effect as
  986. // breaking out of the dispatch switch statement.
  987. var ContinueSentinel = {};
  988. // Dummy constructor functions that we use as the .constructor and
  989. // .constructor.prototype properties for functions that return Generator
  990. // objects. For full spec compliance, you may wish to configure your
  991. // minifier not to mangle the names of these two functions.
  992. function Generator() {}
  993. function GeneratorFunction() {}
  994. function GeneratorFunctionPrototype() {}
  995. // This is a polyfill for %IteratorPrototype% for environments that
  996. // don't natively support it.
  997. var IteratorPrototype = {};
  998. IteratorPrototype[iteratorSymbol] = function () {
  999. return this;
  1000. };
  1001. var getProto = Object.getPrototypeOf;
  1002. var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
  1003. if (NativeIteratorPrototype &&
  1004. NativeIteratorPrototype !== Op &&
  1005. hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
  1006. // This environment has a native %IteratorPrototype%; use it instead
  1007. // of the polyfill.
  1008. IteratorPrototype = NativeIteratorPrototype;
  1009. }
  1010. var Gp = GeneratorFunctionPrototype.prototype =
  1011. Generator.prototype = Object.create(IteratorPrototype);
  1012. GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;
  1013. GeneratorFunctionPrototype.constructor = GeneratorFunction;
  1014. GeneratorFunctionPrototype[toStringTagSymbol] =
  1015. GeneratorFunction.displayName = "GeneratorFunction";
  1016. // Helper for defining the .next, .throw, and .return methods of the
  1017. // Iterator interface in terms of a single ._invoke method.
  1018. function defineIteratorMethods(prototype) {
  1019. ["next", "throw", "return"].forEach(function(method) {
  1020. prototype[method] = function(arg) {
  1021. return this._invoke(method, arg);
  1022. };
  1023. });
  1024. }
  1025. exports.isGeneratorFunction = function(genFun) {
  1026. var ctor = typeof genFun === "function" && genFun.constructor;
  1027. return ctor
  1028. ? ctor === GeneratorFunction ||
  1029. // For the native GeneratorFunction constructor, the best we can
  1030. // do is to check its .name property.
  1031. (ctor.displayName || ctor.name) === "GeneratorFunction"
  1032. : false;
  1033. };
  1034. exports.mark = function(genFun) {
  1035. if (Object.setPrototypeOf) {
  1036. Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
  1037. } else {
  1038. genFun.__proto__ = GeneratorFunctionPrototype;
  1039. if (!(toStringTagSymbol in genFun)) {
  1040. genFun[toStringTagSymbol] = "GeneratorFunction";
  1041. }
  1042. }
  1043. genFun.prototype = Object.create(Gp);
  1044. return genFun;
  1045. };
  1046. // Within the body of any async function, `await x` is transformed to
  1047. // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
  1048. // `hasOwn.call(value, "__await")` to determine if the yielded value is
  1049. // meant to be awaited.
  1050. exports.awrap = function(arg) {
  1051. return { __await: arg };
  1052. };
  1053. function AsyncIterator(generator) {
  1054. function invoke(method, arg, resolve, reject) {
  1055. var record = tryCatch(generator[method], generator, arg);
  1056. if (record.type === "throw") {
  1057. reject(record.arg);
  1058. } else {
  1059. var result = record.arg;
  1060. var value = result.value;
  1061. if (value &&
  1062. typeof value === "object" &&
  1063. hasOwn.call(value, "__await")) {
  1064. return Promise.resolve(value.__await).then(function(value) {
  1065. invoke("next", value, resolve, reject);
  1066. }, function(err) {
  1067. invoke("throw", err, resolve, reject);
  1068. });
  1069. }
  1070. return Promise.resolve(value).then(function(unwrapped) {
  1071. // When a yielded Promise is resolved, its final value becomes
  1072. // the .value of the Promise<{value,done}> result for the
  1073. // current iteration.
  1074. result.value = unwrapped;
  1075. resolve(result);
  1076. }, function(error) {
  1077. // If a rejected Promise was yielded, throw the rejection back
  1078. // into the async generator function so it can be handled there.
  1079. return invoke("throw", error, resolve, reject);
  1080. });
  1081. }
  1082. }
  1083. var previousPromise;
  1084. function enqueue(method, arg) {
  1085. function callInvokeWithMethodAndArg() {
  1086. return new Promise(function(resolve, reject) {
  1087. invoke(method, arg, resolve, reject);
  1088. });
  1089. }
  1090. return previousPromise =
  1091. // If enqueue has been called before, then we want to wait until
  1092. // all previous Promises have been resolved before calling invoke,
  1093. // so that results are always delivered in the correct order. If
  1094. // enqueue has not been called before, then it is important to
  1095. // call invoke immediately, without waiting on a callback to fire,
  1096. // so that the async generator function has the opportunity to do
  1097. // any necessary setup in a predictable way. This predictability
  1098. // is why the Promise constructor synchronously invokes its
  1099. // executor callback, and why async functions synchronously
  1100. // execute code before the first await. Since we implement simple
  1101. // async functions in terms of async generators, it is especially
  1102. // important to get this right, even though it requires care.
  1103. previousPromise ? previousPromise.then(
  1104. callInvokeWithMethodAndArg,
  1105. // Avoid propagating failures to Promises returned by later
  1106. // invocations of the iterator.
  1107. callInvokeWithMethodAndArg
  1108. ) : callInvokeWithMethodAndArg();
  1109. }
  1110. // Define the unified helper method that is used to implement .next,
  1111. // .throw, and .return (see defineIteratorMethods).
  1112. this._invoke = enqueue;
  1113. }
  1114. defineIteratorMethods(AsyncIterator.prototype);
  1115. AsyncIterator.prototype[asyncIteratorSymbol] = function () {
  1116. return this;
  1117. };
  1118. exports.AsyncIterator = AsyncIterator;
  1119. // Note that simple async functions are implemented on top of
  1120. // AsyncIterator objects; they just return a Promise for the value of
  1121. // the final result produced by the iterator.
  1122. exports.async = function(innerFn, outerFn, self, tryLocsList) {
  1123. var iter = new AsyncIterator(
  1124. wrap(innerFn, outerFn, self, tryLocsList)
  1125. );
  1126. return exports.isGeneratorFunction(outerFn)
  1127. ? iter // If outerFn is a generator, return the full iterator.
  1128. : iter.next().then(function(result) {
  1129. return result.done ? result.value : iter.next();
  1130. });
  1131. };
  1132. function makeInvokeMethod(innerFn, self, context) {
  1133. var state = GenStateSuspendedStart;
  1134. return function invoke(method, arg) {
  1135. if (state === GenStateExecuting) {
  1136. throw new Error("Generator is already running");
  1137. }
  1138. if (state === GenStateCompleted) {
  1139. if (method === "throw") {
  1140. throw arg;
  1141. }
  1142. // Be forgiving, per 25.3.3.3.3 of the spec:
  1143. // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
  1144. return doneResult();
  1145. }
  1146. context.method = method;
  1147. context.arg = arg;
  1148. while (true) {
  1149. var delegate = context.delegate;
  1150. if (delegate) {
  1151. var delegateResult = maybeInvokeDelegate(delegate, context);
  1152. if (delegateResult) {
  1153. if (delegateResult === ContinueSentinel) continue;
  1154. return delegateResult;
  1155. }
  1156. }
  1157. if (context.method === "next") {
  1158. // Setting context._sent for legacy support of Babel's
  1159. // function.sent implementation.
  1160. context.sent = context._sent = context.arg;
  1161. } else if (context.method === "throw") {
  1162. if (state === GenStateSuspendedStart) {
  1163. state = GenStateCompleted;
  1164. throw context.arg;
  1165. }
  1166. context.dispatchException(context.arg);
  1167. } else if (context.method === "return") {
  1168. context.abrupt("return", context.arg);
  1169. }
  1170. state = GenStateExecuting;
  1171. var record = tryCatch(innerFn, self, context);
  1172. if (record.type === "normal") {
  1173. // If an exception is thrown from innerFn, we leave state ===
  1174. // GenStateExecuting and loop back for another invocation.
  1175. state = context.done
  1176. ? GenStateCompleted
  1177. : GenStateSuspendedYield;
  1178. if (record.arg === ContinueSentinel) {
  1179. continue;
  1180. }
  1181. return {
  1182. value: record.arg,
  1183. done: context.done
  1184. };
  1185. } else if (record.type === "throw") {
  1186. state = GenStateCompleted;
  1187. // Dispatch the exception by looping back around to the
  1188. // context.dispatchException(context.arg) call above.
  1189. context.method = "throw";
  1190. context.arg = record.arg;
  1191. }
  1192. }
  1193. };
  1194. }
  1195. // Call delegate.iterator[context.method](context.arg) and handle the
  1196. // result, either by returning a { value, done } result from the
  1197. // delegate iterator, or by modifying context.method and context.arg,
  1198. // setting context.delegate to null, and returning the ContinueSentinel.
  1199. function maybeInvokeDelegate(delegate, context) {
  1200. var method = delegate.iterator[context.method];
  1201. if (method === undefined) {
  1202. // A .throw or .return when the delegate iterator has no .throw
  1203. // method always terminates the yield* loop.
  1204. context.delegate = null;
  1205. if (context.method === "throw") {
  1206. // Note: ["return"] must be used for ES3 parsing compatibility.
  1207. if (delegate.iterator["return"]) {
  1208. // If the delegate iterator has a return method, give it a
  1209. // chance to clean up.
  1210. context.method = "return";
  1211. context.arg = undefined;
  1212. maybeInvokeDelegate(delegate, context);
  1213. if (context.method === "throw") {
  1214. // If maybeInvokeDelegate(context) changed context.method from
  1215. // "return" to "throw", let that override the TypeError below.
  1216. return ContinueSentinel;
  1217. }
  1218. }
  1219. context.method = "throw";
  1220. context.arg = new TypeError(
  1221. "The iterator does not provide a 'throw' method");
  1222. }
  1223. return ContinueSentinel;
  1224. }
  1225. var record = tryCatch(method, delegate.iterator, context.arg);
  1226. if (record.type === "throw") {
  1227. context.method = "throw";
  1228. context.arg = record.arg;
  1229. context.delegate = null;
  1230. return ContinueSentinel;
  1231. }
  1232. var info = record.arg;
  1233. if (! info) {
  1234. context.method = "throw";
  1235. context.arg = new TypeError("iterator result is not an object");
  1236. context.delegate = null;
  1237. return ContinueSentinel;
  1238. }
  1239. if (info.done) {
  1240. // Assign the result of the finished delegate to the temporary
  1241. // variable specified by delegate.resultName (see delegateYield).
  1242. context[delegate.resultName] = info.value;
  1243. // Resume execution at the desired location (see delegateYield).
  1244. context.next = delegate.nextLoc;
  1245. // If context.method was "throw" but the delegate handled the
  1246. // exception, let the outer generator proceed normally. If
  1247. // context.method was "next", forget context.arg since it has been
  1248. // "consumed" by the delegate iterator. If context.method was
  1249. // "return", allow the original .return call to continue in the
  1250. // outer generator.
  1251. if (context.method !== "return") {
  1252. context.method = "next";
  1253. context.arg = undefined;
  1254. }
  1255. } else {
  1256. // Re-yield the result returned by the delegate method.
  1257. return info;
  1258. }
  1259. // The delegate iterator is finished, so forget it and continue with
  1260. // the outer generator.
  1261. context.delegate = null;
  1262. return ContinueSentinel;
  1263. }
  1264. // Define Generator.prototype.{next,throw,return} in terms of the
  1265. // unified ._invoke helper method.
  1266. defineIteratorMethods(Gp);
  1267. Gp[toStringTagSymbol] = "Generator";
  1268. // A Generator should always return itself as the iterator object when the
  1269. // @@iterator function is called on it. Some browsers' implementations of the
  1270. // iterator prototype chain incorrectly implement this, causing the Generator
  1271. // object to not be returned from this call. This ensures that doesn't happen.
  1272. // See https://github.com/facebook/regenerator/issues/274 for more details.
  1273. Gp[iteratorSymbol] = function() {
  1274. return this;
  1275. };
  1276. Gp.toString = function() {
  1277. return "[object Generator]";
  1278. };
  1279. function pushTryEntry(locs) {
  1280. var entry = { tryLoc: locs[0] };
  1281. if (1 in locs) {
  1282. entry.catchLoc = locs[1];
  1283. }
  1284. if (2 in locs) {
  1285. entry.finallyLoc = locs[2];
  1286. entry.afterLoc = locs[3];
  1287. }
  1288. this.tryEntries.push(entry);
  1289. }
  1290. function resetTryEntry(entry) {
  1291. var record = entry.completion || {};
  1292. record.type = "normal";
  1293. delete record.arg;
  1294. entry.completion = record;
  1295. }
  1296. function Context(tryLocsList) {
  1297. // The root entry object (effectively a try statement without a catch
  1298. // or a finally block) gives us a place to store values thrown from
  1299. // locations where there is no enclosing try statement.
  1300. this.tryEntries = [{ tryLoc: "root" }];
  1301. tryLocsList.forEach(pushTryEntry, this);
  1302. this.reset(true);
  1303. }
  1304. exports.keys = function(object) {
  1305. var keys = [];
  1306. for (var key in object) {
  1307. keys.push(key);
  1308. }
  1309. keys.reverse();
  1310. // Rather than returning an object with a next method, we keep
  1311. // things simple and return the next function itself.
  1312. return function next() {
  1313. while (keys.length) {
  1314. var key = keys.pop();
  1315. if (key in object) {
  1316. next.value = key;
  1317. next.done = false;
  1318. return next;
  1319. }
  1320. }
  1321. // To avoid creating an additional object, we just hang the .value
  1322. // and .done properties off the next function object itself. This
  1323. // also ensures that the minifier will not anonymize the function.
  1324. next.done = true;
  1325. return next;
  1326. };
  1327. };
  1328. function values(iterable) {
  1329. if (iterable) {
  1330. var iteratorMethod = iterable[iteratorSymbol];
  1331. if (iteratorMethod) {
  1332. return iteratorMethod.call(iterable);
  1333. }
  1334. if (typeof iterable.next === "function") {
  1335. return iterable;
  1336. }
  1337. if (!isNaN(iterable.length)) {
  1338. var i = -1, next = function next() {
  1339. while (++i < iterable.length) {
  1340. if (hasOwn.call(iterable, i)) {
  1341. next.value = iterable[i];
  1342. next.done = false;
  1343. return next;
  1344. }
  1345. }
  1346. next.value = undefined;
  1347. next.done = true;
  1348. return next;
  1349. };
  1350. return next.next = next;
  1351. }
  1352. }
  1353. // Return an iterator with no values.
  1354. return { next: doneResult };
  1355. }
  1356. exports.values = values;
  1357. function doneResult() {
  1358. return { value: undefined, done: true };
  1359. }
  1360. Context.prototype = {
  1361. constructor: Context,
  1362. reset: function(skipTempReset) {
  1363. this.prev = 0;
  1364. this.next = 0;
  1365. // Resetting context._sent for legacy support of Babel's
  1366. // function.sent implementation.
  1367. this.sent = this._sent = undefined;
  1368. this.done = false;
  1369. this.delegate = null;
  1370. this.method = "next";
  1371. this.arg = undefined;
  1372. this.tryEntries.forEach(resetTryEntry);
  1373. if (!skipTempReset) {
  1374. for (var name in this) {
  1375. // Not sure about the optimal order of these conditions:
  1376. if (name.charAt(0) === "t" &&
  1377. hasOwn.call(this, name) &&
  1378. !isNaN(+name.slice(1))) {
  1379. this[name] = undefined;
  1380. }
  1381. }
  1382. }
  1383. },
  1384. stop: function() {
  1385. this.done = true;
  1386. var rootEntry = this.tryEntries[0];
  1387. var rootRecord = rootEntry.completion;
  1388. if (rootRecord.type === "throw") {
  1389. throw rootRecord.arg;
  1390. }
  1391. return this.rval;
  1392. },
  1393. dispatchException: function(exception) {
  1394. if (this.done) {
  1395. throw exception;
  1396. }
  1397. var context = this;
  1398. function handle(loc, caught) {
  1399. record.type = "throw";
  1400. record.arg = exception;
  1401. context.next = loc;
  1402. if (caught) {
  1403. // If the dispatched exception was caught by a catch block,
  1404. // then let that catch block handle the exception normally.
  1405. context.method = "next";
  1406. context.arg = undefined;
  1407. }
  1408. return !! caught;
  1409. }
  1410. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  1411. var entry = this.tryEntries[i];
  1412. var record = entry.completion;
  1413. if (entry.tryLoc === "root") {
  1414. // Exception thrown outside of any try block that could handle
  1415. // it, so set the completion value of the entire function to
  1416. // throw the exception.
  1417. return handle("end");
  1418. }
  1419. if (entry.tryLoc <= this.prev) {
  1420. var hasCatch = hasOwn.call(entry, "catchLoc");
  1421. var hasFinally = hasOwn.call(entry, "finallyLoc");
  1422. if (hasCatch && hasFinally) {
  1423. if (this.prev < entry.catchLoc) {
  1424. return handle(entry.catchLoc, true);
  1425. } else if (this.prev < entry.finallyLoc) {
  1426. return handle(entry.finallyLoc);
  1427. }
  1428. } else if (hasCatch) {
  1429. if (this.prev < entry.catchLoc) {
  1430. return handle(entry.catchLoc, true);
  1431. }
  1432. } else if (hasFinally) {
  1433. if (this.prev < entry.finallyLoc) {
  1434. return handle(entry.finallyLoc);
  1435. }
  1436. } else {
  1437. throw new Error("try statement without catch or finally");
  1438. }
  1439. }
  1440. }
  1441. },
  1442. abrupt: function(type, arg) {
  1443. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  1444. var entry = this.tryEntries[i];
  1445. if (entry.tryLoc <= this.prev &&
  1446. hasOwn.call(entry, "finallyLoc") &&
  1447. this.prev < entry.finallyLoc) {
  1448. var finallyEntry = entry;
  1449. break;
  1450. }
  1451. }
  1452. if (finallyEntry &&
  1453. (type === "break" ||
  1454. type === "continue") &&
  1455. finallyEntry.tryLoc <= arg &&
  1456. arg <= finallyEntry.finallyLoc) {
  1457. // Ignore the finally entry if control is not jumping to a
  1458. // location outside the try/catch block.
  1459. finallyEntry = null;
  1460. }
  1461. var record = finallyEntry ? finallyEntry.completion : {};
  1462. record.type = type;
  1463. record.arg = arg;
  1464. if (finallyEntry) {
  1465. this.method = "next";
  1466. this.next = finallyEntry.finallyLoc;
  1467. return ContinueSentinel;
  1468. }
  1469. return this.complete(record);
  1470. },
  1471. complete: function(record, afterLoc) {
  1472. if (record.type === "throw") {
  1473. throw record.arg;
  1474. }
  1475. if (record.type === "break" ||
  1476. record.type === "continue") {
  1477. this.next = record.arg;
  1478. } else if (record.type === "return") {
  1479. this.rval = this.arg = record.arg;
  1480. this.method = "return";
  1481. this.next = "end";
  1482. } else if (record.type === "normal" && afterLoc) {
  1483. this.next = afterLoc;
  1484. }
  1485. return ContinueSentinel;
  1486. },
  1487. finish: function(finallyLoc) {
  1488. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  1489. var entry = this.tryEntries[i];
  1490. if (entry.finallyLoc === finallyLoc) {
  1491. this.complete(entry.completion, entry.afterLoc);
  1492. resetTryEntry(entry);
  1493. return ContinueSentinel;
  1494. }
  1495. }
  1496. },
  1497. "catch": function(tryLoc) {
  1498. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  1499. var entry = this.tryEntries[i];
  1500. if (entry.tryLoc === tryLoc) {
  1501. var record = entry.completion;
  1502. if (record.type === "throw") {
  1503. var thrown = record.arg;
  1504. resetTryEntry(entry);
  1505. }
  1506. return thrown;
  1507. }
  1508. }
  1509. // The context.catch method must only be called with a location
  1510. // argument that corresponds to a known catch block.
  1511. throw new Error("illegal catch attempt");
  1512. },
  1513. delegateYield: function(iterable, resultName, nextLoc) {
  1514. this.delegate = {
  1515. iterator: values(iterable),
  1516. resultName: resultName,
  1517. nextLoc: nextLoc
  1518. };
  1519. if (this.method === "next") {
  1520. // Deliberately forget the last sent value so that we don't
  1521. // accidentally pass it on to the delegate.
  1522. this.arg = undefined;
  1523. }
  1524. return ContinueSentinel;
  1525. }
  1526. };
  1527. // Regardless of whether this script is executing as a CommonJS module
  1528. // or not, return the runtime object so that we can declare the variable
  1529. // regeneratorRuntime in the outer scope, which allows this module to be
  1530. // injected easily by `bin/regenerator --include-runtime script.js`.
  1531. return exports;
  1532. }(
  1533. // If this script is executing as a CommonJS module, use module.exports
  1534. // as the regeneratorRuntime namespace. Otherwise create a new empty
  1535. // object. Either way, the resulting object will be used to initialize
  1536. // the regeneratorRuntime variable at the top of this file.
  1537. true ? module.exports : undefined
  1538. ));
  1539. try {
  1540. regeneratorRuntime = runtime;
  1541. } catch (accidentalStrictMode) {
  1542. // This module should not be running in strict mode, so the above
  1543. // assignment should always work unless something is misconfigured. Just
  1544. // in case runtime.js accidentally runs in strict mode, we can escape
  1545. // strict mode using a global Function call. This could conceivably fail
  1546. // if a Content Security Policy forbids using Function, but in that case
  1547. // the proper solution is to fix the accidental strict mode problem. If
  1548. // you've misconfigured your bundler to force strict mode and applied a
  1549. // CSP to forbid Function, and you're not willing to fix either of those
  1550. // problems, please detail your unique predicament in a GitHub issue.
  1551. Function("r", "regeneratorRuntime = r")(runtime);
  1552. }
  1553. /***/ }),
  1554. /***/ 5:
  1555. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1556. "use strict";
  1557. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _assertThisInitialized; });
  1558. function _assertThisInitialized(self) {
  1559. if (self === void 0) {
  1560. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  1561. }
  1562. return self;
  1563. }
  1564. /***/ }),
  1565. /***/ 7:
  1566. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1567. "use strict";
  1568. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _objectSpread; });
  1569. /* harmony import */ var _defineProperty__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(10);
  1570. function _objectSpread(target) {
  1571. for (var i = 1; i < arguments.length; i++) {
  1572. var source = arguments[i] != null ? arguments[i] : {};
  1573. var ownKeys = Object.keys(source);
  1574. if (typeof Object.getOwnPropertySymbols === 'function') {
  1575. ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) {
  1576. return Object.getOwnPropertyDescriptor(source, sym).enumerable;
  1577. }));
  1578. }
  1579. ownKeys.forEach(function (key) {
  1580. Object(_defineProperty__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(target, key, source[key]);
  1581. });
  1582. }
  1583. return target;
  1584. }
  1585. /***/ })
  1586. /******/ });