BrickUp API Service for Docker version.

brickup.js 98KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431
  1. /******/ (function(modules) { // webpackBootstrap
  2. /******/ // The module cache
  3. /******/ var installedModules = {};
  4. /******/ // The require function
  5. /******/ function __webpack_require__(moduleId) {
  6. /******/ // Check if module is in cache
  7. /******/ if(installedModules[moduleId])
  8. /******/ return installedModules[moduleId].exports;
  9. /******/ // Create a new module (and put it into the cache)
  10. /******/ var module = installedModules[moduleId] = {
  11. /******/ exports: {},
  12. /******/ id: moduleId,
  13. /******/ loaded: false
  14. /******/ };
  15. /******/ // Execute the module function
  16. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  17. /******/ // Flag the module as loaded
  18. /******/ module.loaded = true;
  19. /******/ // Return the exports of the module
  20. /******/ return module.exports;
  21. /******/ }
  22. /******/ // expose the modules object (__webpack_modules__)
  23. /******/ __webpack_require__.m = modules;
  24. /******/ // expose the module cache
  25. /******/ __webpack_require__.c = installedModules;
  26. /******/ // __webpack_public_path__
  27. /******/ __webpack_require__.p = "";
  28. /******/ // Load entry module and return exports
  29. /******/ return __webpack_require__(0);
  30. /******/ })
  31. /************************************************************************/
  32. /******/ ([
  33. /* 0 */
  34. /***/ function(module, exports, __webpack_require__) {
  35. module.exports = __webpack_require__(1);
  36. /***/ },
  37. /* 1 */
  38. /***/ function(module, exports, __webpack_require__) {
  39. 'use strict';
  40. var _stringify = __webpack_require__(2);
  41. var _stringify2 = _interopRequireDefault(_stringify);
  42. var _regenerator = __webpack_require__(5);
  43. var _regenerator2 = _interopRequireDefault(_regenerator);
  44. var _asyncToGenerator2 = __webpack_require__(78);
  45. var _asyncToGenerator3 = _interopRequireDefault(_asyncToGenerator2);
  46. var _promise = __webpack_require__(9);
  47. var _promise2 = _interopRequireDefault(_promise);
  48. var _classCallCheck2 = __webpack_require__(79);
  49. var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
  50. var _createClass2 = __webpack_require__(80);
  51. var _createClass3 = _interopRequireDefault(_createClass2);
  52. var _events = __webpack_require__(83);
  53. var _events2 = _interopRequireDefault(_events);
  54. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  55. var appId = 'pkbbegkppeahlooepgbffghhnogpdhad';
  56. var apiServer = 'http://api.brickup.io';
  57. var BrickUp = function () {
  58. function BrickUp(options) {
  59. (0, _classCallCheck3.default)(this, BrickUp);
  60. this.connection = null;
  61. this.port = null;
  62. this.bitrate = 9600;
  63. this.flashingJobId = null;
  64. if (options) {
  65. if (options.DEVELOPMENT) apiServer = 'http://localhost:3050';
  66. }
  67. }
  68. (0, _createClass3.default)(BrickUp, [{
  69. key: 'setPort',
  70. value: function setPort(port) {
  71. this.port = port;
  72. }
  73. }, {
  74. key: 'setBitrate',
  75. value: function setBitrate(bitrate) {
  76. this.bitrate = bitrate || 9600;
  77. }
  78. }, {
  79. key: '_getVersion',
  80. value: function _getVersion() {
  81. return new _promise2.default(function (resolve, reject) {
  82. try {
  83. chrome.runtime.sendMessage(appId, { cmd: 'brickup.getVersion' }, function (res) {
  84. if (!res) {
  85. reject(new Error('No BrickUp extension'));
  86. return;
  87. }
  88. resolve(res.version);
  89. });
  90. } catch (e) {
  91. reject(new Error('No BrickUp extension'));
  92. }
  93. });
  94. }
  95. }, {
  96. key: 'getVersion',
  97. value: function () {
  98. var ref = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee(callback) {
  99. var ret;
  100. return _regenerator2.default.wrap(function _callee$(_context) {
  101. while (1) {
  102. switch (_context.prev = _context.next) {
  103. case 0:
  104. _context.prev = 0;
  105. _context.next = 3;
  106. return this._getVersion();
  107. case 3:
  108. ret = _context.sent;
  109. _context.next = 12;
  110. break;
  111. case 6:
  112. _context.prev = 6;
  113. _context.t0 = _context['catch'](0);
  114. if (!callback) {
  115. _context.next = 11;
  116. break;
  117. }
  118. callback(_context.t0);
  119. return _context.abrupt('return');
  120. case 11:
  121. throw _context.t0;
  122. case 12:
  123. if (callback) callback(null, ret);
  124. return _context.abrupt('return', ret);
  125. case 14:
  126. case 'end':
  127. return _context.stop();
  128. }
  129. }
  130. }, _callee, this, [[0, 6]]);
  131. }));
  132. return function getVersion(_x) {
  133. return ref.apply(this, arguments);
  134. };
  135. }()
  136. }, {
  137. key: '_getPorts',
  138. value: function _getPorts() {
  139. return new _promise2.default(function (resolve, reject) {
  140. chrome.runtime.sendMessage(appId, { cmd: 'serial.getPorts' }, function (res) {
  141. var ports = [];
  142. // filter out bluetooth port
  143. res.ports.map(function (port) {
  144. if (!port.path.match(/[Bb]luetooth/) && port.path.match(/tty/)) ports.push(port.path);
  145. });
  146. resolve(ports);
  147. });
  148. });
  149. }
  150. }, {
  151. key: 'getPorts',
  152. value: function () {
  153. var ref = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee2(callback) {
  154. var ret;
  155. return _regenerator2.default.wrap(function _callee2$(_context2) {
  156. while (1) {
  157. switch (_context2.prev = _context2.next) {
  158. case 0:
  159. _context2.prev = 0;
  160. _context2.next = 3;
  161. return this._getPorts();
  162. case 3:
  163. ret = _context2.sent;
  164. _context2.next = 12;
  165. break;
  166. case 6:
  167. _context2.prev = 6;
  168. _context2.t0 = _context2['catch'](0);
  169. if (!callback) {
  170. _context2.next = 11;
  171. break;
  172. }
  173. callback(_context2.t0);
  174. return _context2.abrupt('return');
  175. case 11:
  176. throw _context2.t0;
  177. case 12:
  178. if (callback) callback(null, ret);
  179. return _context2.abrupt('return', ret);
  180. case 14:
  181. case 'end':
  182. return _context2.stop();
  183. }
  184. }
  185. }, _callee2, this, [[0, 6]]);
  186. }));
  187. return function getPorts(_x2) {
  188. return ref.apply(this, arguments);
  189. };
  190. }()
  191. }, {
  192. key: '_getSupportedHW',
  193. value: function _getSupportedHW() {
  194. return new _promise2.default(function (resolve, reject) {
  195. chrome.runtime.sendMessage(appId, { cmd: 'brickup.getSupportedHW' }, function (res) {
  196. var hardwares = [];
  197. res.hardwares.map(function (hw) {
  198. hardwares.push(hw);
  199. });
  200. resolve(hardwares);
  201. });
  202. });
  203. }
  204. }, {
  205. key: 'getSupportedHW',
  206. value: function () {
  207. var ref = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee3(callback) {
  208. var ret;
  209. return _regenerator2.default.wrap(function _callee3$(_context3) {
  210. while (1) {
  211. switch (_context3.prev = _context3.next) {
  212. case 0:
  213. _context3.prev = 0;
  214. _context3.next = 3;
  215. return this._getSupportedHW();
  216. case 3:
  217. ret = _context3.sent;
  218. _context3.next = 12;
  219. break;
  220. case 6:
  221. _context3.prev = 6;
  222. _context3.t0 = _context3['catch'](0);
  223. if (!callback) {
  224. _context3.next = 11;
  225. break;
  226. }
  227. callback(_context3.t0);
  228. return _context3.abrupt('return');
  229. case 11:
  230. throw _context3.t0;
  231. case 12:
  232. if (callback) callback(null, ret);
  233. return _context3.abrupt('return', ret);
  234. case 14:
  235. case 'end':
  236. return _context3.stop();
  237. }
  238. }
  239. }, _callee3, this, [[0, 6]]);
  240. }));
  241. return function getSupportedHW(_x3) {
  242. return ref.apply(this, arguments);
  243. };
  244. }()
  245. }, {
  246. key: 'receiveData',
  247. value: function receiveData(port, bitrate, handler) {
  248. if (!handler) return;
  249. var recv = this.connection = chrome.runtime.connect(appId);
  250. recv.postMessage({
  251. cmd: 'serial.receiveData',
  252. port: port,
  253. bitrate: bitrate || 9600
  254. });
  255. recv.onMessage.addListener(function (data) {
  256. handler(data);
  257. });
  258. }
  259. }, {
  260. key: 'stopReceiving',
  261. value: function stopReceiving() {
  262. if (!this.connection) return;
  263. this.connection.disconnect();
  264. this.connection = null;
  265. }
  266. }, {
  267. key: '_stopFlashing',
  268. value: function _stopFlashing() {
  269. var _this = this;
  270. return new _promise2.default(function (resolve, reject) {
  271. chrome.runtime.sendMessage(appId, { cmd: 'board.stop', jobId: _this.flashingJobId }, function () {
  272. resolve();
  273. });
  274. });
  275. }
  276. }, {
  277. key: 'stopFlashing',
  278. value: function () {
  279. var ref = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee4(callback) {
  280. var ret;
  281. return _regenerator2.default.wrap(function _callee4$(_context4) {
  282. while (1) {
  283. switch (_context4.prev = _context4.next) {
  284. case 0:
  285. _context4.prev = 0;
  286. _context4.next = 3;
  287. return this._stopFlashing();
  288. case 3:
  289. ret = _context4.sent;
  290. _context4.next = 12;
  291. break;
  292. case 6:
  293. _context4.prev = 6;
  294. _context4.t0 = _context4['catch'](0);
  295. if (!callback) {
  296. _context4.next = 11;
  297. break;
  298. }
  299. callback(_context4.t0);
  300. return _context4.abrupt('return');
  301. case 11:
  302. throw _context4.t0;
  303. case 12:
  304. if (callback) callback(null, ret);
  305. return _context4.abrupt('return', ret);
  306. case 14:
  307. case 'end':
  308. return _context4.stop();
  309. }
  310. }
  311. }, _callee4, this, [[0, 6]]);
  312. }));
  313. return function stopFlashing(_x4) {
  314. return ref.apply(this, arguments);
  315. };
  316. }()
  317. }, {
  318. key: '_writeFlash',
  319. value: function _writeFlash(data, raw) {
  320. var _this2 = this;
  321. var self = this;
  322. return new _promise2.default(function (resolve, reject) {
  323. var event = new _events2.default.EventEmitter();
  324. var channel = _this2.connection = chrome.runtime.connect(appId);
  325. channel.postMessage({
  326. cmd: 'board.writeFlash',
  327. port: _this2.port,
  328. raw: raw,
  329. data: data
  330. });
  331. channel.onMessage.addListener(function (result) {
  332. if (result.jobId) {
  333. self.flashingJobId = result.jobId;
  334. return;
  335. }
  336. if (result.break) {
  337. event.emit('break');
  338. return;
  339. }
  340. if (result.timeout) {
  341. event.emit('timeout', result);
  342. return;
  343. }
  344. if (result.err) {
  345. event.emit('error', result.err);
  346. return;
  347. }
  348. // Progress value
  349. if (result.progress) {
  350. event.emit('progress', result.progress);
  351. return;
  352. }
  353. self.flashingJobId = null;
  354. event.emit('finished', result);
  355. });
  356. resolve(event);
  357. });
  358. }
  359. }, {
  360. key: 'writeFlash',
  361. value: function () {
  362. var ref = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee5(data, raw, callback) {
  363. var ret;
  364. return _regenerator2.default.wrap(function _callee5$(_context5) {
  365. while (1) {
  366. switch (_context5.prev = _context5.next) {
  367. case 0:
  368. _context5.prev = 0;
  369. this.stopReceiving();
  370. _context5.next = 4;
  371. return this._writeFlash(data, raw);
  372. case 4:
  373. ret = _context5.sent;
  374. _context5.next = 13;
  375. break;
  376. case 7:
  377. _context5.prev = 7;
  378. _context5.t0 = _context5['catch'](0);
  379. if (!callback) {
  380. _context5.next = 12;
  381. break;
  382. }
  383. callback(_context5.t0);
  384. return _context5.abrupt('return');
  385. case 12:
  386. throw _context5.t0;
  387. case 13:
  388. if (callback) callback(null, ret);
  389. return _context5.abrupt('return', ret);
  390. case 15:
  391. case 'end':
  392. return _context5.stop();
  393. }
  394. }
  395. }, _callee5, this, [[0, 7]]);
  396. }));
  397. return function writeFlash(_x5, _x6, _x7) {
  398. return ref.apply(this, arguments);
  399. };
  400. }()
  401. }, {
  402. key: 'getHexFile',
  403. value: function getHexFile(url, callback) {
  404. var xhr = new XMLHttpRequest();
  405. xhr.onreadystatechange = function () {
  406. if (xhr.readyState == 4) {
  407. if (xhr.status == 200) {
  408. if (callback) callback(null, xhr.responseText);
  409. return;
  410. }
  411. if (callback) callback(new Error('Failed to fetch'));
  412. }
  413. };
  414. xhr.open('GET', url, true);
  415. xhr.send();
  416. }
  417. }, {
  418. key: 'writeFlashByURL',
  419. value: function writeFlashByURL(url, callback) {
  420. this.getHexFile(url, function (err, data) {
  421. if (err) return;
  422. this.writeFlash(data, true, function (err, event) {
  423. if (callback) callback(err, event);
  424. });
  425. }.bind(this));
  426. }
  427. }, {
  428. key: 'flash',
  429. value: function flash(data, callback) {
  430. this.writeFlash(data, true, function (err, event) {
  431. if (callback) callback(err, event);
  432. });
  433. }
  434. }, {
  435. key: 'compile',
  436. value: function compile(sources, callback) {
  437. var body = {
  438. sources: sources
  439. };
  440. var url = apiServer + '/builder/compile';
  441. var xhr = new XMLHttpRequest();
  442. xhr.onreadystatechange = function () {
  443. if (xhr.readyState == 4) {
  444. if (xhr.status == 200) {
  445. callback(null, xhr.responseText);
  446. return;
  447. }
  448. callback(new Error('Failed to fetch'));
  449. }
  450. };
  451. xhr.open('POST', url, true);
  452. xhr.setRequestHeader('Content-Type', 'application/json;charset=UTF-8');
  453. xhr.send((0, _stringify2.default)(body));
  454. }
  455. }]);
  456. return BrickUp;
  457. }();
  458. ;
  459. window.BrickUp = BrickUp;
  460. /***/ },
  461. /* 2 */
  462. /***/ function(module, exports, __webpack_require__) {
  463. module.exports = { "default": __webpack_require__(3), __esModule: true };
  464. /***/ },
  465. /* 3 */
  466. /***/ function(module, exports, __webpack_require__) {
  467. var core = __webpack_require__(4);
  468. module.exports = function stringify(it){ // eslint-disable-line no-unused-vars
  469. return (core.JSON && core.JSON.stringify || JSON.stringify).apply(JSON, arguments);
  470. };
  471. /***/ },
  472. /* 4 */
  473. /***/ function(module, exports) {
  474. var core = module.exports = {version: '1.2.6'};
  475. if(typeof __e == 'number')__e = core; // eslint-disable-line no-undef
  476. /***/ },
  477. /* 5 */
  478. /***/ function(module, exports, __webpack_require__) {
  479. /* WEBPACK VAR INJECTION */(function(global) {// This method of obtaining a reference to the global object needs to be
  480. // kept identical to the way it is obtained in runtime.js
  481. var g =
  482. typeof global === "object" ? global :
  483. typeof window === "object" ? window :
  484. typeof self === "object" ? self : this;
  485. // Use `getOwnPropertyNames` because not all browsers support calling
  486. // `hasOwnProperty` on the global `self` object in a worker. See #183.
  487. var hadRuntime = g.regeneratorRuntime &&
  488. Object.getOwnPropertyNames(g).indexOf("regeneratorRuntime") >= 0;
  489. // Save the old regeneratorRuntime in case it needs to be restored later.
  490. var oldRuntime = hadRuntime && g.regeneratorRuntime;
  491. // Force reevalutation of runtime.js.
  492. g.regeneratorRuntime = undefined;
  493. module.exports = __webpack_require__(6);
  494. if (hadRuntime) {
  495. // Restore the original runtime.
  496. g.regeneratorRuntime = oldRuntime;
  497. } else {
  498. // Remove the global property added by runtime.js.
  499. try {
  500. delete g.regeneratorRuntime;
  501. } catch(e) {
  502. g.regeneratorRuntime = undefined;
  503. }
  504. }
  505. module.exports = { "default": module.exports, __esModule: true };
  506. /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))
  507. /***/ },
  508. /* 6 */
  509. /***/ function(module, exports, __webpack_require__) {
  510. /* WEBPACK VAR INJECTION */(function(global, module, process) {"use strict";
  511. var _promise = __webpack_require__(9);
  512. var _promise2 = _interopRequireDefault(_promise);
  513. var _setPrototypeOf = __webpack_require__(63);
  514. var _setPrototypeOf2 = _interopRequireDefault(_setPrototypeOf);
  515. var _create = __webpack_require__(66);
  516. var _create2 = _interopRequireDefault(_create);
  517. var _typeof2 = __webpack_require__(68);
  518. var _typeof3 = _interopRequireDefault(_typeof2);
  519. var _iterator = __webpack_require__(76);
  520. var _iterator2 = _interopRequireDefault(_iterator);
  521. var _symbol = __webpack_require__(69);
  522. var _symbol2 = _interopRequireDefault(_symbol);
  523. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  524. /**
  525. * Copyright (c) 2014, Facebook, Inc.
  526. * All rights reserved.
  527. *
  528. * This source code is licensed under the BSD-style license found in the
  529. * https://raw.github.com/facebook/regenerator/master/LICENSE file. An
  530. * additional grant of patent rights can be found in the PATENTS file in
  531. * the same directory.
  532. */
  533. !(function (global) {
  534. "use strict";
  535. var hasOwn = Object.prototype.hasOwnProperty;
  536. var undefined; // More compressible than void 0.
  537. var iteratorSymbol = typeof _symbol2.default === "function" && _iterator2.default || "@@iterator";
  538. var inModule = ( false ? "undefined" : (0, _typeof3.default)(module)) === "object";
  539. var runtime = global.regeneratorRuntime;
  540. if (runtime) {
  541. if (inModule) {
  542. // If regeneratorRuntime is defined globally and we're in a module,
  543. // make the exports object identical to regeneratorRuntime.
  544. module.exports = runtime;
  545. }
  546. // Don't bother evaluating the rest of this file if the runtime was
  547. // already defined globally.
  548. return;
  549. }
  550. // Define the runtime globally (as expected by generated code) as either
  551. // module.exports (if we're in a module) or a new, empty object.
  552. runtime = global.regeneratorRuntime = inModule ? module.exports : {};
  553. function wrap(innerFn, outerFn, self, tryLocsList) {
  554. // If outerFn provided, then outerFn.prototype instanceof Generator.
  555. var generator = (0, _create2.default)((outerFn || Generator).prototype);
  556. var context = new Context(tryLocsList || []);
  557. // The ._invoke method unifies the implementations of the .next,
  558. // .throw, and .return methods.
  559. generator._invoke = makeInvokeMethod(innerFn, self, context);
  560. return generator;
  561. }
  562. runtime.wrap = wrap;
  563. // Try/catch helper to minimize deoptimizations. Returns a completion
  564. // record like context.tryEntries[i].completion. This interface could
  565. // have been (and was previously) designed to take a closure to be
  566. // invoked without arguments, but in all the cases we care about we
  567. // already have an existing method we want to call, so there's no need
  568. // to create a new function object. We can even get away with assuming
  569. // the method takes exactly one argument, since that happens to be true
  570. // in every case, so we don't have to touch the arguments object. The
  571. // only additional allocation required is the completion record, which
  572. // has a stable shape and so hopefully should be cheap to allocate.
  573. function tryCatch(fn, obj, arg) {
  574. try {
  575. return { type: "normal", arg: fn.call(obj, arg) };
  576. } catch (err) {
  577. return { type: "throw", arg: err };
  578. }
  579. }
  580. var GenStateSuspendedStart = "suspendedStart";
  581. var GenStateSuspendedYield = "suspendedYield";
  582. var GenStateExecuting = "executing";
  583. var GenStateCompleted = "completed";
  584. // Returning this object from the innerFn has the same effect as
  585. // breaking out of the dispatch switch statement.
  586. var ContinueSentinel = {};
  587. // Dummy constructor functions that we use as the .constructor and
  588. // .constructor.prototype properties for functions that return Generator
  589. // objects. For full spec compliance, you may wish to configure your
  590. // minifier not to mangle the names of these two functions.
  591. function Generator() {}
  592. function GeneratorFunction() {}
  593. function GeneratorFunctionPrototype() {}
  594. var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype;
  595. GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;
  596. GeneratorFunctionPrototype.constructor = GeneratorFunction;
  597. GeneratorFunction.displayName = "GeneratorFunction";
  598. // Helper for defining the .next, .throw, and .return methods of the
  599. // Iterator interface in terms of a single ._invoke method.
  600. function defineIteratorMethods(prototype) {
  601. ["next", "throw", "return"].forEach(function (method) {
  602. prototype[method] = function (arg) {
  603. return this._invoke(method, arg);
  604. };
  605. });
  606. }
  607. runtime.isGeneratorFunction = function (genFun) {
  608. var ctor = typeof genFun === "function" && genFun.constructor;
  609. return ctor ? ctor === GeneratorFunction ||
  610. // For the native GeneratorFunction constructor, the best we can
  611. // do is to check its .name property.
  612. (ctor.displayName || ctor.name) === "GeneratorFunction" : false;
  613. };
  614. runtime.mark = function (genFun) {
  615. if (_setPrototypeOf2.default) {
  616. (0, _setPrototypeOf2.default)(genFun, GeneratorFunctionPrototype);
  617. } else {
  618. genFun.__proto__ = GeneratorFunctionPrototype;
  619. }
  620. genFun.prototype = (0, _create2.default)(Gp);
  621. return genFun;
  622. };
  623. // Within the body of any async function, `await x` is transformed to
  624. // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
  625. // `value instanceof AwaitArgument` to determine if the yielded value is
  626. // meant to be awaited. Some may consider the name of this method too
  627. // cutesy, but they are curmudgeons.
  628. runtime.awrap = function (arg) {
  629. return new AwaitArgument(arg);
  630. };
  631. function AwaitArgument(arg) {
  632. this.arg = arg;
  633. }
  634. function AsyncIterator(generator) {
  635. // This invoke function is written in a style that assumes some
  636. // calling function (or Promise) will handle exceptions.
  637. function invoke(method, arg) {
  638. var result = generator[method](arg);
  639. var value = result.value;
  640. return value instanceof AwaitArgument ? _promise2.default.resolve(value.arg).then(invokeNext, invokeThrow) : _promise2.default.resolve(value).then(function (unwrapped) {
  641. // When a yielded Promise is resolved, its final value becomes
  642. // the .value of the Promise<{value,done}> result for the
  643. // current iteration. If the Promise is rejected, however, the
  644. // result for this iteration will be rejected with the same
  645. // reason. Note that rejections of yielded Promises are not
  646. // thrown back into the generator function, as is the case
  647. // when an awaited Promise is rejected. This difference in
  648. // behavior between yield and await is important, because it
  649. // allows the consumer to decide what to do with the yielded
  650. // rejection (swallow it and continue, manually .throw it back
  651. // into the generator, abandon iteration, whatever). With
  652. // await, by contrast, there is no opportunity to examine the
  653. // rejection reason outside the generator function, so the
  654. // only option is to throw it from the await expression, and
  655. // let the generator function handle the exception.
  656. result.value = unwrapped;
  657. return result;
  658. });
  659. }
  660. if ((typeof process === "undefined" ? "undefined" : (0, _typeof3.default)(process)) === "object" && process.domain) {
  661. invoke = process.domain.bind(invoke);
  662. }
  663. var invokeNext = invoke.bind(generator, "next");
  664. var invokeThrow = invoke.bind(generator, "throw");
  665. var invokeReturn = invoke.bind(generator, "return");
  666. var previousPromise;
  667. function enqueue(method, arg) {
  668. function callInvokeWithMethodAndArg() {
  669. return invoke(method, arg);
  670. }
  671. return previousPromise =
  672. // If enqueue has been called before, then we want to wait until
  673. // all previous Promises have been resolved before calling invoke,
  674. // so that results are always delivered in the correct order. If
  675. // enqueue has not been called before, then it is important to
  676. // call invoke immediately, without waiting on a callback to fire,
  677. // so that the async generator function has the opportunity to do
  678. // any necessary setup in a predictable way. This predictability
  679. // is why the Promise constructor synchronously invokes its
  680. // executor callback, and why async functions synchronously
  681. // execute code before the first await. Since we implement simple
  682. // async functions in terms of async generators, it is especially
  683. // important to get this right, even though it requires care.
  684. previousPromise ? previousPromise.then(callInvokeWithMethodAndArg,
  685. // Avoid propagating failures to Promises returned by later
  686. // invocations of the iterator.
  687. callInvokeWithMethodAndArg) : new _promise2.default(function (resolve) {
  688. resolve(callInvokeWithMethodAndArg());
  689. });
  690. }
  691. // Define the unified helper method that is used to implement .next,
  692. // .throw, and .return (see defineIteratorMethods).
  693. this._invoke = enqueue;
  694. }
  695. defineIteratorMethods(AsyncIterator.prototype);
  696. // Note that simple async functions are implemented on top of
  697. // AsyncIterator objects; they just return a Promise for the value of
  698. // the final result produced by the iterator.
  699. runtime.async = function (innerFn, outerFn, self, tryLocsList) {
  700. var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList));
  701. return runtime.isGeneratorFunction(outerFn) ? iter // If outerFn is a generator, return the full iterator.
  702. : iter.next().then(function (result) {
  703. return result.done ? result.value : iter.next();
  704. });
  705. };
  706. function makeInvokeMethod(innerFn, self, context) {
  707. var state = GenStateSuspendedStart;
  708. return function invoke(method, arg) {
  709. if (state === GenStateExecuting) {
  710. throw new Error("Generator is already running");
  711. }
  712. if (state === GenStateCompleted) {
  713. if (method === "throw") {
  714. throw arg;
  715. }
  716. // Be forgiving, per 25.3.3.3.3 of the spec:
  717. // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
  718. return doneResult();
  719. }
  720. while (true) {
  721. var delegate = context.delegate;
  722. if (delegate) {
  723. if (method === "return" || method === "throw" && delegate.iterator[method] === undefined) {
  724. // A return or throw (when the delegate iterator has no throw
  725. // method) always terminates the yield* loop.
  726. context.delegate = null;
  727. // If the delegate iterator has a return method, give it a
  728. // chance to clean up.
  729. var returnMethod = delegate.iterator["return"];
  730. if (returnMethod) {
  731. var record = tryCatch(returnMethod, delegate.iterator, arg);
  732. if (record.type === "throw") {
  733. // If the return method threw an exception, let that
  734. // exception prevail over the original return or throw.
  735. method = "throw";
  736. arg = record.arg;
  737. continue;
  738. }
  739. }
  740. if (method === "return") {
  741. // Continue with the outer return, now that the delegate
  742. // iterator has been terminated.
  743. continue;
  744. }
  745. }
  746. var record = tryCatch(delegate.iterator[method], delegate.iterator, arg);
  747. if (record.type === "throw") {
  748. context.delegate = null;
  749. // Like returning generator.throw(uncaught), but without the
  750. // overhead of an extra function call.
  751. method = "throw";
  752. arg = record.arg;
  753. continue;
  754. }
  755. // Delegate generator ran and handled its own exceptions so
  756. // regardless of what the method was, we continue as if it is
  757. // "next" with an undefined arg.
  758. method = "next";
  759. arg = undefined;
  760. var info = record.arg;
  761. if (info.done) {
  762. context[delegate.resultName] = info.value;
  763. context.next = delegate.nextLoc;
  764. } else {
  765. state = GenStateSuspendedYield;
  766. return info;
  767. }
  768. context.delegate = null;
  769. }
  770. if (method === "next") {
  771. context._sent = arg;
  772. if (state === GenStateSuspendedYield) {
  773. context.sent = arg;
  774. } else {
  775. context.sent = undefined;
  776. }
  777. } else if (method === "throw") {
  778. if (state === GenStateSuspendedStart) {
  779. state = GenStateCompleted;
  780. throw arg;
  781. }
  782. if (context.dispatchException(arg)) {
  783. // If the dispatched exception was caught by a catch block,
  784. // then let that catch block handle the exception normally.
  785. method = "next";
  786. arg = undefined;
  787. }
  788. } else if (method === "return") {
  789. context.abrupt("return", arg);
  790. }
  791. state = GenStateExecuting;
  792. var record = tryCatch(innerFn, self, context);
  793. if (record.type === "normal") {
  794. // If an exception is thrown from innerFn, we leave state ===
  795. // GenStateExecuting and loop back for another invocation.
  796. state = context.done ? GenStateCompleted : GenStateSuspendedYield;
  797. var info = {
  798. value: record.arg,
  799. done: context.done
  800. };
  801. if (record.arg === ContinueSentinel) {
  802. if (context.delegate && method === "next") {
  803. // Deliberately forget the last sent value so that we don't
  804. // accidentally pass it on to the delegate.
  805. arg = undefined;
  806. }
  807. } else {
  808. return info;
  809. }
  810. } else if (record.type === "throw") {
  811. state = GenStateCompleted;
  812. // Dispatch the exception by looping back around to the
  813. // context.dispatchException(arg) call above.
  814. method = "throw";
  815. arg = record.arg;
  816. }
  817. }
  818. };
  819. }
  820. // Define Generator.prototype.{next,throw,return} in terms of the
  821. // unified ._invoke helper method.
  822. defineIteratorMethods(Gp);
  823. Gp[iteratorSymbol] = function () {
  824. return this;
  825. };
  826. Gp.toString = function () {
  827. return "[object Generator]";
  828. };
  829. function pushTryEntry(locs) {
  830. var entry = { tryLoc: locs[0] };
  831. if (1 in locs) {
  832. entry.catchLoc = locs[1];
  833. }
  834. if (2 in locs) {
  835. entry.finallyLoc = locs[2];
  836. entry.afterLoc = locs[3];
  837. }
  838. this.tryEntries.push(entry);
  839. }
  840. function resetTryEntry(entry) {
  841. var record = entry.completion || {};
  842. record.type = "normal";
  843. delete record.arg;
  844. entry.completion = record;
  845. }
  846. function Context(tryLocsList) {
  847. // The root entry object (effectively a try statement without a catch
  848. // or a finally block) gives us a place to store values thrown from
  849. // locations where there is no enclosing try statement.
  850. this.tryEntries = [{ tryLoc: "root" }];
  851. tryLocsList.forEach(pushTryEntry, this);
  852. this.reset(true);
  853. }
  854. runtime.keys = function (object) {
  855. var keys = [];
  856. for (var key in object) {
  857. keys.push(key);
  858. }
  859. keys.reverse();
  860. // Rather than returning an object with a next method, we keep
  861. // things simple and return the next function itself.
  862. return function next() {
  863. while (keys.length) {
  864. var key = keys.pop();
  865. if (key in object) {
  866. next.value = key;
  867. next.done = false;
  868. return next;
  869. }
  870. }
  871. // To avoid creating an additional object, we just hang the .value
  872. // and .done properties off the next function object itself. This
  873. // also ensures that the minifier will not anonymize the function.
  874. next.done = true;
  875. return next;
  876. };
  877. };
  878. function values(iterable) {
  879. if (iterable) {
  880. var iteratorMethod = iterable[iteratorSymbol];
  881. if (iteratorMethod) {
  882. return iteratorMethod.call(iterable);
  883. }
  884. if (typeof iterable.next === "function") {
  885. return iterable;
  886. }
  887. if (!isNaN(iterable.length)) {
  888. var i = -1,
  889. next = function next() {
  890. while (++i < iterable.length) {
  891. if (hasOwn.call(iterable, i)) {
  892. next.value = iterable[i];
  893. next.done = false;
  894. return next;
  895. }
  896. }
  897. next.value = undefined;
  898. next.done = true;
  899. return next;
  900. };
  901. return next.next = next;
  902. }
  903. }
  904. // Return an iterator with no values.
  905. return { next: doneResult };
  906. }
  907. runtime.values = values;
  908. function doneResult() {
  909. return { value: undefined, done: true };
  910. }
  911. Context.prototype = {
  912. constructor: Context,
  913. reset: function reset(skipTempReset) {
  914. this.prev = 0;
  915. this.next = 0;
  916. this.sent = undefined;
  917. this.done = false;
  918. this.delegate = null;
  919. this.tryEntries.forEach(resetTryEntry);
  920. if (!skipTempReset) {
  921. for (var name in this) {
  922. // Not sure about the optimal order of these conditions:
  923. if (name.charAt(0) === "t" && hasOwn.call(this, name) && !isNaN(+name.slice(1))) {
  924. this[name] = undefined;
  925. }
  926. }
  927. }
  928. },
  929. stop: function stop() {
  930. this.done = true;
  931. var rootEntry = this.tryEntries[0];
  932. var rootRecord = rootEntry.completion;
  933. if (rootRecord.type === "throw") {
  934. throw rootRecord.arg;
  935. }
  936. return this.rval;
  937. },
  938. dispatchException: function dispatchException(exception) {
  939. if (this.done) {
  940. throw exception;
  941. }
  942. var context = this;
  943. function handle(loc, caught) {
  944. record.type = "throw";
  945. record.arg = exception;
  946. context.next = loc;
  947. return !!caught;
  948. }
  949. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  950. var entry = this.tryEntries[i];
  951. var record = entry.completion;
  952. if (entry.tryLoc === "root") {
  953. // Exception thrown outside of any try block that could handle
  954. // it, so set the completion value of the entire function to
  955. // throw the exception.
  956. return handle("end");
  957. }
  958. if (entry.tryLoc <= this.prev) {
  959. var hasCatch = hasOwn.call(entry, "catchLoc");
  960. var hasFinally = hasOwn.call(entry, "finallyLoc");
  961. if (hasCatch && hasFinally) {
  962. if (this.prev < entry.catchLoc) {
  963. return handle(entry.catchLoc, true);
  964. } else if (this.prev < entry.finallyLoc) {
  965. return handle(entry.finallyLoc);
  966. }
  967. } else if (hasCatch) {
  968. if (this.prev < entry.catchLoc) {
  969. return handle(entry.catchLoc, true);
  970. }
  971. } else if (hasFinally) {
  972. if (this.prev < entry.finallyLoc) {
  973. return handle(entry.finallyLoc);
  974. }
  975. } else {
  976. throw new Error("try statement without catch or finally");
  977. }
  978. }
  979. }
  980. },
  981. abrupt: function abrupt(type, arg) {
  982. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  983. var entry = this.tryEntries[i];
  984. if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
  985. var finallyEntry = entry;
  986. break;
  987. }
  988. }
  989. if (finallyEntry && (type === "break" || type === "continue") && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc) {
  990. // Ignore the finally entry if control is not jumping to a
  991. // location outside the try/catch block.
  992. finallyEntry = null;
  993. }
  994. var record = finallyEntry ? finallyEntry.completion : {};
  995. record.type = type;
  996. record.arg = arg;
  997. if (finallyEntry) {
  998. this.next = finallyEntry.finallyLoc;
  999. } else {
  1000. this.complete(record);
  1001. }
  1002. return ContinueSentinel;
  1003. },
  1004. complete: function complete(record, afterLoc) {
  1005. if (record.type === "throw") {
  1006. throw record.arg;
  1007. }
  1008. if (record.type === "break" || record.type === "continue") {
  1009. this.next = record.arg;
  1010. } else if (record.type === "return") {
  1011. this.rval = record.arg;
  1012. this.next = "end";
  1013. } else if (record.type === "normal" && afterLoc) {
  1014. this.next = afterLoc;
  1015. }
  1016. },
  1017. finish: function finish(finallyLoc) {
  1018. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  1019. var entry = this.tryEntries[i];
  1020. if (entry.finallyLoc === finallyLoc) {
  1021. this.complete(entry.completion, entry.afterLoc);
  1022. resetTryEntry(entry);
  1023. return ContinueSentinel;
  1024. }
  1025. }
  1026. },
  1027. "catch": function _catch(tryLoc) {
  1028. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  1029. var entry = this.tryEntries[i];
  1030. if (entry.tryLoc === tryLoc) {
  1031. var record = entry.completion;
  1032. if (record.type === "throw") {
  1033. var thrown = record.arg;
  1034. resetTryEntry(entry);
  1035. }
  1036. return thrown;
  1037. }
  1038. }
  1039. // The context.catch method must only be called with a location
  1040. // argument that corresponds to a known catch block.
  1041. throw new Error("illegal catch attempt");
  1042. },
  1043. delegateYield: function delegateYield(iterable, resultName, nextLoc) {
  1044. this.delegate = {
  1045. iterator: values(iterable),
  1046. resultName: resultName,
  1047. nextLoc: nextLoc
  1048. };
  1049. return ContinueSentinel;
  1050. }
  1051. };
  1052. })(
  1053. // Among the various tricks for obtaining a reference to the global
  1054. // object, this seems to be the most reliable technique that does not
  1055. // use indirect eval (which violates Content Security Policy).
  1056. (typeof global === "undefined" ? "undefined" : (0, _typeof3.default)(global)) === "object" ? global : (typeof window === "undefined" ? "undefined" : (0, _typeof3.default)(window)) === "object" ? window : (typeof self === "undefined" ? "undefined" : (0, _typeof3.default)(self)) === "object" ? self : undefined);
  1057. /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()), __webpack_require__(7)(module), __webpack_require__(8)))
  1058. /***/ },
  1059. /* 7 */
  1060. /***/ function(module, exports) {
  1061. module.exports = function(module) {
  1062. if(!module.webpackPolyfill) {
  1063. module.deprecate = function() {};
  1064. module.paths = [];
  1065. // module.parent = undefined by default
  1066. module.children = [];
  1067. module.webpackPolyfill = 1;
  1068. }
  1069. return module;
  1070. }
  1071. /***/ },
  1072. /* 8 */
  1073. /***/ function(module, exports) {
  1074. // shim for using process in browser
  1075. var process = module.exports = {};
  1076. var queue = [];
  1077. var draining = false;
  1078. var currentQueue;
  1079. var queueIndex = -1;
  1080. function cleanUpNextTick() {
  1081. draining = false;
  1082. if (currentQueue.length) {
  1083. queue = currentQueue.concat(queue);
  1084. } else {
  1085. queueIndex = -1;
  1086. }
  1087. if (queue.length) {
  1088. drainQueue();
  1089. }
  1090. }
  1091. function drainQueue() {
  1092. if (draining) {
  1093. return;
  1094. }
  1095. var timeout = setTimeout(cleanUpNextTick);
  1096. draining = true;
  1097. var len = queue.length;
  1098. while(len) {
  1099. currentQueue = queue;
  1100. queue = [];
  1101. while (++queueIndex < len) {
  1102. if (currentQueue) {
  1103. currentQueue[queueIndex].run();
  1104. }
  1105. }
  1106. queueIndex = -1;
  1107. len = queue.length;
  1108. }
  1109. currentQueue = null;
  1110. draining = false;
  1111. clearTimeout(timeout);
  1112. }
  1113. process.nextTick = function (fun) {
  1114. var args = new Array(arguments.length - 1);
  1115. if (arguments.length > 1) {
  1116. for (var i = 1; i < arguments.length; i++) {
  1117. args[i - 1] = arguments[i];
  1118. }
  1119. }
  1120. queue.push(new Item(fun, args));
  1121. if (queue.length === 1 && !draining) {
  1122. setTimeout(drainQueue, 0);
  1123. }
  1124. };
  1125. // v8 likes predictible objects
  1126. function Item(fun, array) {
  1127. this.fun = fun;
  1128. this.array = array;
  1129. }
  1130. Item.prototype.run = function () {
  1131. this.fun.apply(null, this.array);
  1132. };
  1133. process.title = 'browser';
  1134. process.browser = true;
  1135. process.env = {};
  1136. process.argv = [];
  1137. process.version = ''; // empty string to avoid regexp issues
  1138. process.versions = {};
  1139. function noop() {}
  1140. process.on = noop;
  1141. process.addListener = noop;
  1142. process.once = noop;
  1143. process.off = noop;
  1144. process.removeListener = noop;
  1145. process.removeAllListeners = noop;
  1146. process.emit = noop;
  1147. process.binding = function (name) {
  1148. throw new Error('process.binding is not supported');
  1149. };
  1150. process.cwd = function () { return '/' };
  1151. process.chdir = function (dir) {
  1152. throw new Error('process.chdir is not supported');
  1153. };
  1154. process.umask = function() { return 0; };
  1155. /***/ },
  1156. /* 9 */
  1157. /***/ function(module, exports, __webpack_require__) {
  1158. module.exports = { "default": __webpack_require__(10), __esModule: true };
  1159. /***/ },
  1160. /* 10 */
  1161. /***/ function(module, exports, __webpack_require__) {
  1162. __webpack_require__(11);
  1163. __webpack_require__(12);
  1164. __webpack_require__(35);
  1165. __webpack_require__(42);
  1166. module.exports = __webpack_require__(4).Promise;
  1167. /***/ },
  1168. /* 11 */
  1169. /***/ function(module, exports) {
  1170. /***/ },
  1171. /* 12 */
  1172. /***/ function(module, exports, __webpack_require__) {
  1173. 'use strict';
  1174. var $at = __webpack_require__(13)(true);
  1175. // 21.1.3.27 String.prototype[@@iterator]()
  1176. __webpack_require__(16)(String, 'String', function(iterated){
  1177. this._t = String(iterated); // target
  1178. this._i = 0; // next index
  1179. // 21.1.5.2.1 %StringIteratorPrototype%.next()
  1180. }, function(){
  1181. var O = this._t
  1182. , index = this._i
  1183. , point;
  1184. if(index >= O.length)return {value: undefined, done: true};
  1185. point = $at(O, index);
  1186. this._i += point.length;
  1187. return {value: point, done: false};
  1188. });
  1189. /***/ },
  1190. /* 13 */
  1191. /***/ function(module, exports, __webpack_require__) {
  1192. var toInteger = __webpack_require__(14)
  1193. , defined = __webpack_require__(15);
  1194. // true -> String#at
  1195. // false -> String#codePointAt
  1196. module.exports = function(TO_STRING){
  1197. return function(that, pos){
  1198. var s = String(defined(that))
  1199. , i = toInteger(pos)
  1200. , l = s.length
  1201. , a, b;
  1202. if(i < 0 || i >= l)return TO_STRING ? '' : undefined;
  1203. a = s.charCodeAt(i);
  1204. return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff
  1205. ? TO_STRING ? s.charAt(i) : a
  1206. : TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000;
  1207. };
  1208. };
  1209. /***/ },
  1210. /* 14 */
  1211. /***/ function(module, exports) {
  1212. // 7.1.4 ToInteger
  1213. var ceil = Math.ceil
  1214. , floor = Math.floor;
  1215. module.exports = function(it){
  1216. return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);
  1217. };
  1218. /***/ },
  1219. /* 15 */
  1220. /***/ function(module, exports) {
  1221. // 7.2.1 RequireObjectCoercible(argument)
  1222. module.exports = function(it){
  1223. if(it == undefined)throw TypeError("Can't call method on " + it);
  1224. return it;
  1225. };
  1226. /***/ },
  1227. /* 16 */
  1228. /***/ function(module, exports, __webpack_require__) {
  1229. 'use strict';
  1230. var LIBRARY = __webpack_require__(17)
  1231. , $export = __webpack_require__(18)
  1232. , redefine = __webpack_require__(22)
  1233. , hide = __webpack_require__(23)
  1234. , has = __webpack_require__(28)
  1235. , Iterators = __webpack_require__(29)
  1236. , $iterCreate = __webpack_require__(30)
  1237. , setToStringTag = __webpack_require__(31)
  1238. , getProto = __webpack_require__(24).getProto
  1239. , ITERATOR = __webpack_require__(32)('iterator')
  1240. , BUGGY = !([].keys && 'next' in [].keys()) // Safari has buggy iterators w/o `next`
  1241. , FF_ITERATOR = '@@iterator'
  1242. , KEYS = 'keys'
  1243. , VALUES = 'values';
  1244. var returnThis = function(){ return this; };
  1245. module.exports = function(Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED){
  1246. $iterCreate(Constructor, NAME, next);
  1247. var getMethod = function(kind){
  1248. if(!BUGGY && kind in proto)return proto[kind];
  1249. switch(kind){
  1250. case KEYS: return function keys(){ return new Constructor(this, kind); };
  1251. case VALUES: return function values(){ return new Constructor(this, kind); };
  1252. } return function entries(){ return new Constructor(this, kind); };
  1253. };
  1254. var TAG = NAME + ' Iterator'
  1255. , DEF_VALUES = DEFAULT == VALUES
  1256. , VALUES_BUG = false
  1257. , proto = Base.prototype
  1258. , $native = proto[ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT]
  1259. , $default = $native || getMethod(DEFAULT)
  1260. , methods, key;
  1261. // Fix native
  1262. if($native){
  1263. var IteratorPrototype = getProto($default.call(new Base));
  1264. // Set @@toStringTag to native iterators
  1265. setToStringTag(IteratorPrototype, TAG, true);
  1266. // FF fix
  1267. if(!LIBRARY && has(proto, FF_ITERATOR))hide(IteratorPrototype, ITERATOR, returnThis);
  1268. // fix Array#{values, @@iterator}.name in V8 / FF
  1269. if(DEF_VALUES && $native.name !== VALUES){
  1270. VALUES_BUG = true;
  1271. $default = function values(){ return $native.call(this); };
  1272. }
  1273. }
  1274. // Define iterator
  1275. if((!LIBRARY || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR])){
  1276. hide(proto, ITERATOR, $default);
  1277. }
  1278. // Plug for library
  1279. Iterators[NAME] = $default;
  1280. Iterators[TAG] = returnThis;
  1281. if(DEFAULT){
  1282. methods = {
  1283. values: DEF_VALUES ? $default : getMethod(VALUES),
  1284. keys: IS_SET ? $default : getMethod(KEYS),
  1285. entries: !DEF_VALUES ? $default : getMethod('entries')
  1286. };
  1287. if(FORCED)for(key in methods){
  1288. if(!(key in proto))redefine(proto, key, methods[key]);
  1289. } else $export($export.P + $export.F * (BUGGY || VALUES_BUG), NAME, methods);
  1290. }
  1291. return methods;
  1292. };
  1293. /***/ },
  1294. /* 17 */
  1295. /***/ function(module, exports) {
  1296. module.exports = true;
  1297. /***/ },
  1298. /* 18 */
  1299. /***/ function(module, exports, __webpack_require__) {
  1300. var global = __webpack_require__(19)
  1301. , core = __webpack_require__(4)
  1302. , ctx = __webpack_require__(20)
  1303. , PROTOTYPE = 'prototype';
  1304. var $export = function(type, name, source){
  1305. var IS_FORCED = type & $export.F
  1306. , IS_GLOBAL = type & $export.G
  1307. , IS_STATIC = type & $export.S
  1308. , IS_PROTO = type & $export.P
  1309. , IS_BIND = type & $export.B
  1310. , IS_WRAP = type & $export.W
  1311. , exports = IS_GLOBAL ? core : core[name] || (core[name] = {})
  1312. , target = IS_GLOBAL ? global : IS_STATIC ? global[name] : (global[name] || {})[PROTOTYPE]
  1313. , key, own, out;
  1314. if(IS_GLOBAL)source = name;
  1315. for(key in source){
  1316. // contains in native
  1317. own = !IS_FORCED && target && key in target;
  1318. if(own && key in exports)continue;
  1319. // export native or passed
  1320. out = own ? target[key] : source[key];
  1321. // prevent global pollution for namespaces
  1322. exports[key] = IS_GLOBAL && typeof target[key] != 'function' ? source[key]
  1323. // bind timers to global for call from export context
  1324. : IS_BIND && own ? ctx(out, global)
  1325. // wrap global constructors for prevent change them in library
  1326. : IS_WRAP && target[key] == out ? (function(C){
  1327. var F = function(param){
  1328. return this instanceof C ? new C(param) : C(param);
  1329. };
  1330. F[PROTOTYPE] = C[PROTOTYPE];
  1331. return F;
  1332. // make static versions for prototype methods
  1333. })(out) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out;
  1334. if(IS_PROTO)(exports[PROTOTYPE] || (exports[PROTOTYPE] = {}))[key] = out;
  1335. }
  1336. };
  1337. // type bitmap
  1338. $export.F = 1; // forced
  1339. $export.G = 2; // global
  1340. $export.S = 4; // static
  1341. $export.P = 8; // proto
  1342. $export.B = 16; // bind
  1343. $export.W = 32; // wrap
  1344. module.exports = $export;
  1345. /***/ },
  1346. /* 19 */
  1347. /***/ function(module, exports) {
  1348. // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
  1349. var global = module.exports = typeof window != 'undefined' && window.Math == Math
  1350. ? window : typeof self != 'undefined' && self.Math == Math ? self : Function('return this')();
  1351. if(typeof __g == 'number')__g = global; // eslint-disable-line no-undef
  1352. /***/ },
  1353. /* 20 */
  1354. /***/ function(module, exports, __webpack_require__) {
  1355. // optional / simple context binding
  1356. var aFunction = __webpack_require__(21);
  1357. module.exports = function(fn, that, length){
  1358. aFunction(fn);
  1359. if(that === undefined)return fn;
  1360. switch(length){
  1361. case 1: return function(a){
  1362. return fn.call(that, a);
  1363. };
  1364. case 2: return function(a, b){
  1365. return fn.call(that, a, b);
  1366. };
  1367. case 3: return function(a, b, c){
  1368. return fn.call(that, a, b, c);
  1369. };
  1370. }
  1371. return function(/* ...args */){
  1372. return fn.apply(that, arguments);
  1373. };
  1374. };
  1375. /***/ },
  1376. /* 21 */
  1377. /***/ function(module, exports) {
  1378. module.exports = function(it){
  1379. if(typeof it != 'function')throw TypeError(it + ' is not a function!');
  1380. return it;
  1381. };
  1382. /***/ },
  1383. /* 22 */
  1384. /***/ function(module, exports, __webpack_require__) {
  1385. module.exports = __webpack_require__(23);
  1386. /***/ },
  1387. /* 23 */
  1388. /***/ function(module, exports, __webpack_require__) {
  1389. var $ = __webpack_require__(24)
  1390. , createDesc = __webpack_require__(25);
  1391. module.exports = __webpack_require__(26) ? function(object, key, value){
  1392. return $.setDesc(object, key, createDesc(1, value));
  1393. } : function(object, key, value){
  1394. object[key] = value;
  1395. return object;
  1396. };
  1397. /***/ },
  1398. /* 24 */
  1399. /***/ function(module, exports) {
  1400. var $Object = Object;
  1401. module.exports = {
  1402. create: $Object.create,
  1403. getProto: $Object.getPrototypeOf,
  1404. isEnum: {}.propertyIsEnumerable,
  1405. getDesc: $Object.getOwnPropertyDescriptor,
  1406. setDesc: $Object.defineProperty,
  1407. setDescs: $Object.defineProperties,
  1408. getKeys: $Object.keys,
  1409. getNames: $Object.getOwnPropertyNames,
  1410. getSymbols: $Object.getOwnPropertySymbols,
  1411. each: [].forEach
  1412. };
  1413. /***/ },
  1414. /* 25 */
  1415. /***/ function(module, exports) {
  1416. module.exports = function(bitmap, value){
  1417. return {
  1418. enumerable : !(bitmap & 1),
  1419. configurable: !(bitmap & 2),
  1420. writable : !(bitmap & 4),
  1421. value : value
  1422. };
  1423. };
  1424. /***/ },
  1425. /* 26 */
  1426. /***/ function(module, exports, __webpack_require__) {
  1427. // Thank's IE8 for his funny defineProperty
  1428. module.exports = !__webpack_require__(27)(function(){
  1429. return Object.defineProperty({}, 'a', {get: function(){ return 7; }}).a != 7;
  1430. });
  1431. /***/ },
  1432. /* 27 */
  1433. /***/ function(module, exports) {
  1434. module.exports = function(exec){
  1435. try {
  1436. return !!exec();
  1437. } catch(e){
  1438. return true;
  1439. }
  1440. };
  1441. /***/ },
  1442. /* 28 */
  1443. /***/ function(module, exports) {
  1444. var hasOwnProperty = {}.hasOwnProperty;
  1445. module.exports = function(it, key){
  1446. return hasOwnProperty.call(it, key);
  1447. };
  1448. /***/ },
  1449. /* 29 */
  1450. /***/ function(module, exports) {
  1451. module.exports = {};
  1452. /***/ },
  1453. /* 30 */
  1454. /***/ function(module, exports, __webpack_require__) {
  1455. 'use strict';
  1456. var $ = __webpack_require__(24)
  1457. , descriptor = __webpack_require__(25)
  1458. , setToStringTag = __webpack_require__(31)
  1459. , IteratorPrototype = {};
  1460. // 25.1.2.1.1 %IteratorPrototype%[@@iterator]()
  1461. __webpack_require__(23)(IteratorPrototype, __webpack_require__(32)('iterator'), function(){ return this; });
  1462. module.exports = function(Constructor, NAME, next){
  1463. Constructor.prototype = $.create(IteratorPrototype, {next: descriptor(1, next)});
  1464. setToStringTag(Constructor, NAME + ' Iterator');
  1465. };
  1466. /***/ },
  1467. /* 31 */
  1468. /***/ function(module, exports, __webpack_require__) {
  1469. var def = __webpack_require__(24).setDesc
  1470. , has = __webpack_require__(28)
  1471. , TAG = __webpack_require__(32)('toStringTag');
  1472. module.exports = function(it, tag, stat){
  1473. if(it && !has(it = stat ? it : it.prototype, TAG))def(it, TAG, {configurable: true, value: tag});
  1474. };
  1475. /***/ },
  1476. /* 32 */
  1477. /***/ function(module, exports, __webpack_require__) {
  1478. var store = __webpack_require__(33)('wks')
  1479. , uid = __webpack_require__(34)
  1480. , Symbol = __webpack_require__(19).Symbol;
  1481. module.exports = function(name){
  1482. return store[name] || (store[name] =
  1483. Symbol && Symbol[name] || (Symbol || uid)('Symbol.' + name));
  1484. };
  1485. /***/ },
  1486. /* 33 */
  1487. /***/ function(module, exports, __webpack_require__) {
  1488. var global = __webpack_require__(19)
  1489. , SHARED = '__core-js_shared__'
  1490. , store = global[SHARED] || (global[SHARED] = {});
  1491. module.exports = function(key){
  1492. return store[key] || (store[key] = {});
  1493. };
  1494. /***/ },
  1495. /* 34 */
  1496. /***/ function(module, exports) {
  1497. var id = 0
  1498. , px = Math.random();
  1499. module.exports = function(key){
  1500. return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));
  1501. };
  1502. /***/ },
  1503. /* 35 */
  1504. /***/ function(module, exports, __webpack_require__) {
  1505. __webpack_require__(36);
  1506. var Iterators = __webpack_require__(29);
  1507. Iterators.NodeList = Iterators.HTMLCollection = Iterators.Array;
  1508. /***/ },
  1509. /* 36 */
  1510. /***/ function(module, exports, __webpack_require__) {
  1511. 'use strict';
  1512. var addToUnscopables = __webpack_require__(37)
  1513. , step = __webpack_require__(38)
  1514. , Iterators = __webpack_require__(29)
  1515. , toIObject = __webpack_require__(39);
  1516. // 22.1.3.4 Array.prototype.entries()
  1517. // 22.1.3.13 Array.prototype.keys()
  1518. // 22.1.3.29 Array.prototype.values()
  1519. // 22.1.3.30 Array.prototype[@@iterator]()
  1520. module.exports = __webpack_require__(16)(Array, 'Array', function(iterated, kind){
  1521. this._t = toIObject(iterated); // target
  1522. this._i = 0; // next index
  1523. this._k = kind; // kind
  1524. // 22.1.5.2.1 %ArrayIteratorPrototype%.next()
  1525. }, function(){
  1526. var O = this._t
  1527. , kind = this._k
  1528. , index = this._i++;
  1529. if(!O || index >= O.length){
  1530. this._t = undefined;
  1531. return step(1);
  1532. }
  1533. if(kind == 'keys' )return step(0, index);
  1534. if(kind == 'values')return step(0, O[index]);
  1535. return step(0, [index, O[index]]);
  1536. }, 'values');
  1537. // argumentsList[@@iterator] is %ArrayProto_values% (9.4.4.6, 9.4.4.7)
  1538. Iterators.Arguments = Iterators.Array;
  1539. addToUnscopables('keys');
  1540. addToUnscopables('values');
  1541. addToUnscopables('entries');
  1542. /***/ },
  1543. /* 37 */
  1544. /***/ function(module, exports) {
  1545. module.exports = function(){ /* empty */ };
  1546. /***/ },
  1547. /* 38 */
  1548. /***/ function(module, exports) {
  1549. module.exports = function(done, value){
  1550. return {value: value, done: !!done};
  1551. };
  1552. /***/ },
  1553. /* 39 */
  1554. /***/ function(module, exports, __webpack_require__) {
  1555. // to indexed object, toObject with fallback for non-array-like ES3 strings
  1556. var IObject = __webpack_require__(40)
  1557. , defined = __webpack_require__(15);
  1558. module.exports = function(it){
  1559. return IObject(defined(it));
  1560. };
  1561. /***/ },
  1562. /* 40 */
  1563. /***/ function(module, exports, __webpack_require__) {
  1564. // fallback for non-array-like ES3 and non-enumerable old V8 strings
  1565. var cof = __webpack_require__(41);
  1566. module.exports = Object('z').propertyIsEnumerable(0) ? Object : function(it){
  1567. return cof(it) == 'String' ? it.split('') : Object(it);
  1568. };
  1569. /***/ },
  1570. /* 41 */
  1571. /***/ function(module, exports) {
  1572. var toString = {}.toString;
  1573. module.exports = function(it){
  1574. return toString.call(it).slice(8, -1);
  1575. };
  1576. /***/ },
  1577. /* 42 */
  1578. /***/ function(module, exports, __webpack_require__) {
  1579. 'use strict';
  1580. var $ = __webpack_require__(24)
  1581. , LIBRARY = __webpack_require__(17)
  1582. , global = __webpack_require__(19)
  1583. , ctx = __webpack_require__(20)
  1584. , classof = __webpack_require__(43)
  1585. , $export = __webpack_require__(18)
  1586. , isObject = __webpack_require__(44)
  1587. , anObject = __webpack_require__(45)
  1588. , aFunction = __webpack_require__(21)
  1589. , strictNew = __webpack_require__(46)
  1590. , forOf = __webpack_require__(47)
  1591. , setProto = __webpack_require__(52).set
  1592. , same = __webpack_require__(53)
  1593. , SPECIES = __webpack_require__(32)('species')
  1594. , speciesConstructor = __webpack_require__(54)
  1595. , asap = __webpack_require__(55)
  1596. , PROMISE = 'Promise'
  1597. , process = global.process
  1598. , isNode = classof(process) == 'process'
  1599. , P = global[PROMISE]
  1600. , Wrapper;
  1601. var testResolve = function(sub){
  1602. var test = new P(function(){});
  1603. if(sub)test.constructor = Object;
  1604. return P.resolve(test) === test;
  1605. };
  1606. var USE_NATIVE = function(){
  1607. var works = false;
  1608. function P2(x){
  1609. var self = new P(x);
  1610. setProto(self, P2.prototype);
  1611. return self;
  1612. }
  1613. try {
  1614. works = P && P.resolve && testResolve();
  1615. setProto(P2, P);
  1616. P2.prototype = $.create(P.prototype, {constructor: {value: P2}});
  1617. // actual Firefox has broken subclass support, test that
  1618. if(!(P2.resolve(5).then(function(){}) instanceof P2)){
  1619. works = false;
  1620. }
  1621. // actual V8 bug, https://code.google.com/p/v8/issues/detail?id=4162
  1622. if(works && __webpack_require__(26)){
  1623. var thenableThenGotten = false;
  1624. P.resolve($.setDesc({}, 'then', {
  1625. get: function(){ thenableThenGotten = true; }
  1626. }));
  1627. works = thenableThenGotten;
  1628. }
  1629. } catch(e){ works = false; }
  1630. return works;
  1631. }();
  1632. // helpers
  1633. var sameConstructor = function(a, b){
  1634. // library wrapper special case
  1635. if(LIBRARY && a === P && b === Wrapper)return true;
  1636. return same(a, b);
  1637. };
  1638. var getConstructor = function(C){
  1639. var S = anObject(C)[SPECIES];
  1640. return S != undefined ? S : C;
  1641. };
  1642. var isThenable = function(it){
  1643. var then;
  1644. return isObject(it) && typeof (then = it.then) == 'function' ? then : false;
  1645. };
  1646. var PromiseCapability = function(C){
  1647. var resolve, reject;
  1648. this.promise = new C(function($$resolve, $$reject){
  1649. if(resolve !== undefined || reject !== undefined)throw TypeError('Bad Promise constructor');
  1650. resolve = $$resolve;
  1651. reject = $$reject;
  1652. });
  1653. this.resolve = aFunction(resolve),
  1654. this.reject = aFunction(reject)
  1655. };
  1656. var perform = function(exec){
  1657. try {
  1658. exec();
  1659. } catch(e){
  1660. return {error: e};
  1661. }
  1662. };
  1663. var notify = function(record, isReject){
  1664. if(record.n)return;
  1665. record.n = true;
  1666. var chain = record.c;
  1667. asap(function(){
  1668. var value = record.v
  1669. , ok = record.s == 1
  1670. , i = 0;
  1671. var run = function(reaction){
  1672. var handler = ok ? reaction.ok : reaction.fail
  1673. , resolve = reaction.resolve
  1674. , reject = reaction.reject
  1675. , result, then;
  1676. try {
  1677. if(handler){
  1678. if(!ok)record.h = true;
  1679. result = handler === true ? value : handler(value);
  1680. if(result === reaction.promise){
  1681. reject(TypeError('Promise-chain cycle'));
  1682. } else if(then = isThenable(result)){
  1683. then.call(result, resolve, reject);
  1684. } else resolve(result);
  1685. } else reject(value);
  1686. } catch(e){
  1687. reject(e);
  1688. }
  1689. };
  1690. while(chain.length > i)run(chain[i++]); // variable length - can't use forEach
  1691. chain.length = 0;
  1692. record.n = false;
  1693. if(isReject)setTimeout(function(){
  1694. var promise = record.p
  1695. , handler, console;
  1696. if(isUnhandled(promise)){
  1697. if(isNode){
  1698. process.emit('unhandledRejection', value, promise);
  1699. } else if(handler = global.onunhandledrejection){
  1700. handler({promise: promise, reason: value});
  1701. } else if((console = global.console) && console.error){
  1702. console.error('Unhandled promise rejection', value);
  1703. }
  1704. } record.a = undefined;
  1705. }, 1);
  1706. });
  1707. };
  1708. var isUnhandled = function(promise){
  1709. var record = promise._d
  1710. , chain = record.a || record.c
  1711. , i = 0
  1712. , reaction;
  1713. if(record.h)return false;
  1714. while(chain.length > i){
  1715. reaction = chain[i++];
  1716. if(reaction.fail || !isUnhandled(reaction.promise))return false;
  1717. } return true;
  1718. };
  1719. var $reject = function(value){
  1720. var record = this;
  1721. if(record.d)return;
  1722. record.d = true;
  1723. record = record.r || record; // unwrap
  1724. record.v = value;
  1725. record.s = 2;
  1726. record.a = record.c.slice();
  1727. notify(record, true);
  1728. };
  1729. var $resolve = function(value){
  1730. var record = this
  1731. , then;
  1732. if(record.d)return;
  1733. record.d = true;
  1734. record = record.r || record; // unwrap
  1735. try {
  1736. if(record.p === value)throw TypeError("Promise can't be resolved itself");
  1737. if(then = isThenable(value)){
  1738. asap(function(){
  1739. var wrapper = {r: record, d: false}; // wrap
  1740. try {
  1741. then.call(value, ctx($resolve, wrapper, 1), ctx($reject, wrapper, 1));
  1742. } catch(e){
  1743. $reject.call(wrapper, e);
  1744. }
  1745. });
  1746. } else {
  1747. record.v = value;
  1748. record.s = 1;
  1749. notify(record, false);
  1750. }
  1751. } catch(e){
  1752. $reject.call({r: record, d: false}, e); // wrap
  1753. }
  1754. };
  1755. // constructor polyfill
  1756. if(!USE_NATIVE){
  1757. // 25.4.3.1 Promise(executor)
  1758. P = function Promise(executor){
  1759. aFunction(executor);
  1760. var record = this._d = {
  1761. p: strictNew(this, P, PROMISE), // <- promise
  1762. c: [], // <- awaiting reactions
  1763. a: undefined, // <- checked in isUnhandled reactions
  1764. s: 0, // <- state
  1765. d: false, // <- done
  1766. v: undefined, // <- value
  1767. h: false, // <- handled rejection
  1768. n: false // <- notify
  1769. };
  1770. try {
  1771. executor(ctx($resolve, record, 1), ctx($reject, record, 1));
  1772. } catch(err){
  1773. $reject.call(record, err);
  1774. }
  1775. };
  1776. __webpack_require__(60)(P.prototype, {
  1777. // 25.4.5.3 Promise.prototype.then(onFulfilled, onRejected)
  1778. then: function then(onFulfilled, onRejected){
  1779. var reaction = new PromiseCapability(speciesConstructor(this, P))
  1780. , promise = reaction.promise
  1781. , record = this._d;
  1782. reaction.ok = typeof onFulfilled == 'function' ? onFulfilled : true;
  1783. reaction.fail = typeof onRejected == 'function' && onRejected;
  1784. record.c.push(reaction);
  1785. if(record.a)record.a.push(reaction);
  1786. if(record.s)notify(record, false);
  1787. return promise;
  1788. },
  1789. // 25.4.5.1 Promise.prototype.catch(onRejected)
  1790. 'catch': function(onRejected){
  1791. return this.then(undefined, onRejected);
  1792. }
  1793. });
  1794. }
  1795. $export($export.G + $export.W + $export.F * !USE_NATIVE, {Promise: P});
  1796. __webpack_require__(31)(P, PROMISE);
  1797. __webpack_require__(61)(PROMISE);
  1798. Wrapper = __webpack_require__(4)[PROMISE];
  1799. // statics
  1800. $export($export.S + $export.F * !USE_NATIVE, PROMISE, {
  1801. // 25.4.4.5 Promise.reject(r)
  1802. reject: function reject(r){
  1803. var capability = new PromiseCapability(this)
  1804. , $$reject = capability.reject;
  1805. $$reject(r);
  1806. return capability.promise;
  1807. }
  1808. });
  1809. $export($export.S + $export.F * (!USE_NATIVE || testResolve(true)), PROMISE, {
  1810. // 25.4.4.6 Promise.resolve(x)
  1811. resolve: function resolve(x){
  1812. // instanceof instead of internal slot check because we should fix it without replacement native Promise core
  1813. if(x instanceof P && sameConstructor(x.constructor, this))return x;
  1814. var capability = new PromiseCapability(this)
  1815. , $$resolve = capability.resolve;
  1816. $$resolve(x);
  1817. return capability.promise;
  1818. }
  1819. });
  1820. $export($export.S + $export.F * !(USE_NATIVE && __webpack_require__(62)(function(iter){
  1821. P.all(iter)['catch'](function(){});
  1822. })), PROMISE, {
  1823. // 25.4.4.1 Promise.all(iterable)
  1824. all: function all(iterable){
  1825. var C = getConstructor(this)
  1826. , capability = new PromiseCapability(C)
  1827. , resolve = capability.resolve
  1828. , reject = capability.reject
  1829. , values = [];
  1830. var abrupt = perform(function(){
  1831. forOf(iterable, false, values.push, values);
  1832. var remaining = values.length
  1833. , results = Array(remaining);
  1834. if(remaining)$.each.call(values, function(promise, index){
  1835. var alreadyCalled = false;
  1836. C.resolve(promise).then(function(value){
  1837. if(alreadyCalled)return;
  1838. alreadyCalled = true;
  1839. results[index] = value;
  1840. --remaining || resolve(results);
  1841. }, reject);
  1842. });
  1843. else resolve(results);
  1844. });
  1845. if(abrupt)reject(abrupt.error);
  1846. return capability.promise;
  1847. },
  1848. // 25.4.4.4 Promise.race(iterable)
  1849. race: function race(iterable){
  1850. var C = getConstructor(this)
  1851. , capability = new PromiseCapability(C)
  1852. , reject = capability.reject;
  1853. var abrupt = perform(function(){
  1854. forOf(iterable, false, function(promise){
  1855. C.resolve(promise).then(capability.resolve, reject);
  1856. });
  1857. });
  1858. if(abrupt)reject(abrupt.error);
  1859. return capability.promise;
  1860. }
  1861. });
  1862. /***/ },
  1863. /* 43 */
  1864. /***/ function(module, exports, __webpack_require__) {
  1865. // getting tag from 19.1.3.6 Object.prototype.toString()
  1866. var cof = __webpack_require__(41)
  1867. , TAG = __webpack_require__(32)('toStringTag')
  1868. // ES3 wrong here
  1869. , ARG = cof(function(){ return arguments; }()) == 'Arguments';
  1870. module.exports = function(it){
  1871. var O, T, B;
  1872. return it === undefined ? 'Undefined' : it === null ? 'Null'
  1873. // @@toStringTag case
  1874. : typeof (T = (O = Object(it))[TAG]) == 'string' ? T
  1875. // builtinTag case
  1876. : ARG ? cof(O)
  1877. // ES3 arguments fallback
  1878. : (B = cof(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B;
  1879. };
  1880. /***/ },
  1881. /* 44 */
  1882. /***/ function(module, exports) {
  1883. module.exports = function(it){
  1884. return typeof it === 'object' ? it !== null : typeof it === 'function';
  1885. };
  1886. /***/ },
  1887. /* 45 */
  1888. /***/ function(module, exports, __webpack_require__) {
  1889. var isObject = __webpack_require__(44);
  1890. module.exports = function(it){
  1891. if(!isObject(it))throw TypeError(it + ' is not an object!');
  1892. return it;
  1893. };
  1894. /***/ },
  1895. /* 46 */
  1896. /***/ function(module, exports) {
  1897. module.exports = function(it, Constructor, name){
  1898. if(!(it instanceof Constructor))throw TypeError(name + ": use the 'new' operator!");
  1899. return it;
  1900. };
  1901. /***/ },
  1902. /* 47 */
  1903. /***/ function(module, exports, __webpack_require__) {
  1904. var ctx = __webpack_require__(20)
  1905. , call = __webpack_require__(48)
  1906. , isArrayIter = __webpack_require__(49)
  1907. , anObject = __webpack_require__(45)
  1908. , toLength = __webpack_require__(50)
  1909. , getIterFn = __webpack_require__(51);
  1910. module.exports = function(iterable, entries, fn, that){
  1911. var iterFn = getIterFn(iterable)
  1912. , f = ctx(fn, that, entries ? 2 : 1)
  1913. , index = 0
  1914. , length, step, iterator;
  1915. if(typeof iterFn != 'function')throw TypeError(iterable + ' is not iterable!');
  1916. // fast case for arrays with default iterator
  1917. if(isArrayIter(iterFn))for(length = toLength(iterable.length); length > index; index++){
  1918. entries ? f(anObject(step = iterable[index])[0], step[1]) : f(iterable[index]);
  1919. } else for(iterator = iterFn.call(iterable); !(step = iterator.next()).done; ){
  1920. call(iterator, f, step.value, entries);
  1921. }
  1922. };
  1923. /***/ },
  1924. /* 48 */
  1925. /***/ function(module, exports, __webpack_require__) {
  1926. // call something on iterator step with safe closing on error
  1927. var anObject = __webpack_require__(45);
  1928. module.exports = function(iterator, fn, value, entries){
  1929. try {
  1930. return entries ? fn(anObject(value)[0], value[1]) : fn(value);
  1931. // 7.4.6 IteratorClose(iterator, completion)
  1932. } catch(e){
  1933. var ret = iterator['return'];
  1934. if(ret !== undefined)anObject(ret.call(iterator));
  1935. throw e;
  1936. }
  1937. };
  1938. /***/ },
  1939. /* 49 */
  1940. /***/ function(module, exports, __webpack_require__) {
  1941. // check on default Array iterator
  1942. var Iterators = __webpack_require__(29)
  1943. , ITERATOR = __webpack_require__(32)('iterator')
  1944. , ArrayProto = Array.prototype;
  1945. module.exports = function(it){
  1946. return it !== undefined && (Iterators.Array === it || ArrayProto[ITERATOR] === it);
  1947. };
  1948. /***/ },
  1949. /* 50 */
  1950. /***/ function(module, exports, __webpack_require__) {
  1951. // 7.1.15 ToLength
  1952. var toInteger = __webpack_require__(14)
  1953. , min = Math.min;
  1954. module.exports = function(it){
  1955. return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991
  1956. };
  1957. /***/ },
  1958. /* 51 */
  1959. /***/ function(module, exports, __webpack_require__) {
  1960. var classof = __webpack_require__(43)
  1961. , ITERATOR = __webpack_require__(32)('iterator')
  1962. , Iterators = __webpack_require__(29);
  1963. module.exports = __webpack_require__(4).getIteratorMethod = function(it){
  1964. if(it != undefined)return it[ITERATOR]
  1965. || it['@@iterator']
  1966. || Iterators[classof(it)];
  1967. };
  1968. /***/ },
  1969. /* 52 */
  1970. /***/ function(module, exports, __webpack_require__) {
  1971. // Works with __proto__ only. Old v8 can't work with null proto objects.
  1972. /* eslint-disable no-proto */
  1973. var getDesc = __webpack_require__(24).getDesc
  1974. , isObject = __webpack_require__(44)
  1975. , anObject = __webpack_require__(45);
  1976. var check = function(O, proto){
  1977. anObject(O);
  1978. if(!isObject(proto) && proto !== null)throw TypeError(proto + ": can't set as prototype!");
  1979. };
  1980. module.exports = {
  1981. set: Object.setPrototypeOf || ('__proto__' in {} ? // eslint-disable-line
  1982. function(test, buggy, set){
  1983. try {
  1984. set = __webpack_require__(20)(Function.call, getDesc(Object.prototype, '__proto__').set, 2);
  1985. set(test, []);
  1986. buggy = !(test instanceof Array);
  1987. } catch(e){ buggy = true; }
  1988. return function setPrototypeOf(O, proto){
  1989. check(O, proto);
  1990. if(buggy)O.__proto__ = proto;
  1991. else set(O, proto);
  1992. return O;
  1993. };
  1994. }({}, false) : undefined),
  1995. check: check
  1996. };
  1997. /***/ },
  1998. /* 53 */
  1999. /***/ function(module, exports) {
  2000. // 7.2.9 SameValue(x, y)
  2001. module.exports = Object.is || function is(x, y){
  2002. return x === y ? x !== 0 || 1 / x === 1 / y : x != x && y != y;
  2003. };
  2004. /***/ },
  2005. /* 54 */
  2006. /***/ function(module, exports, __webpack_require__) {
  2007. // 7.3.20 SpeciesConstructor(O, defaultConstructor)
  2008. var anObject = __webpack_require__(45)
  2009. , aFunction = __webpack_require__(21)
  2010. , SPECIES = __webpack_require__(32)('species');
  2011. module.exports = function(O, D){
  2012. var C = anObject(O).constructor, S;
  2013. return C === undefined || (S = anObject(C)[SPECIES]) == undefined ? D : aFunction(S);
  2014. };
  2015. /***/ },
  2016. /* 55 */
  2017. /***/ function(module, exports, __webpack_require__) {
  2018. var global = __webpack_require__(19)
  2019. , macrotask = __webpack_require__(56).set
  2020. , Observer = global.MutationObserver || global.WebKitMutationObserver
  2021. , process = global.process
  2022. , Promise = global.Promise
  2023. , isNode = __webpack_require__(41)(process) == 'process'
  2024. , head, last, notify;
  2025. var flush = function(){
  2026. var parent, domain, fn;
  2027. if(isNode && (parent = process.domain)){
  2028. process.domain = null;
  2029. parent.exit();
  2030. }
  2031. while(head){
  2032. domain = head.domain;
  2033. fn = head.fn;
  2034. if(domain)domain.enter();
  2035. fn(); // <- currently we use it only for Promise - try / catch not required
  2036. if(domain)domain.exit();
  2037. head = head.next;
  2038. } last = undefined;
  2039. if(parent)parent.enter();
  2040. };
  2041. // Node.js
  2042. if(isNode){
  2043. notify = function(){
  2044. process.nextTick(flush);
  2045. };
  2046. // browsers with MutationObserver
  2047. } else if(Observer){
  2048. var toggle = 1
  2049. , node = document.createTextNode('');
  2050. new Observer(flush).observe(node, {characterData: true}); // eslint-disable-line no-new
  2051. notify = function(){
  2052. node.data = toggle = -toggle;
  2053. };
  2054. // environments with maybe non-completely correct, but existent Promise
  2055. } else if(Promise && Promise.resolve){
  2056. notify = function(){
  2057. Promise.resolve().then(flush);
  2058. };
  2059. // for other environments - macrotask based on:
  2060. // - setImmediate
  2061. // - MessageChannel
  2062. // - window.postMessag
  2063. // - onreadystatechange
  2064. // - setTimeout
  2065. } else {
  2066. notify = function(){
  2067. // strange IE + webpack dev server bug - use .call(global)
  2068. macrotask.call(global, flush);
  2069. };
  2070. }
  2071. module.exports = function asap(fn){
  2072. var task = {fn: fn, next: undefined, domain: isNode && process.domain};
  2073. if(last)last.next = task;
  2074. if(!head){
  2075. head = task;
  2076. notify();
  2077. } last = task;
  2078. };
  2079. /***/ },
  2080. /* 56 */
  2081. /***/ function(module, exports, __webpack_require__) {
  2082. var ctx = __webpack_require__(20)
  2083. , invoke = __webpack_require__(57)
  2084. , html = __webpack_require__(58)
  2085. , cel = __webpack_require__(59)
  2086. , global = __webpack_require__(19)
  2087. , process = global.process
  2088. , setTask = global.setImmediate
  2089. , clearTask = global.clearImmediate
  2090. , MessageChannel = global.MessageChannel
  2091. , counter = 0
  2092. , queue = {}
  2093. , ONREADYSTATECHANGE = 'onreadystatechange'
  2094. , defer, channel, port;
  2095. var run = function(){
  2096. var id = +this;
  2097. if(queue.hasOwnProperty(id)){
  2098. var fn = queue[id];
  2099. delete queue[id];
  2100. fn();
  2101. }
  2102. };
  2103. var listner = function(event){
  2104. run.call(event.data);
  2105. };
  2106. // Node.js 0.9+ & IE10+ has setImmediate, otherwise:
  2107. if(!setTask || !clearTask){
  2108. setTask = function setImmediate(fn){
  2109. var args = [], i = 1;
  2110. while(arguments.length > i)args.push(arguments[i++]);
  2111. queue[++counter] = function(){
  2112. invoke(typeof fn == 'function' ? fn : Function(fn), args);
  2113. };
  2114. defer(counter);
  2115. return counter;
  2116. };
  2117. clearTask = function clearImmediate(id){
  2118. delete queue[id];
  2119. };
  2120. // Node.js 0.8-
  2121. if(__webpack_require__(41)(process) == 'process'){
  2122. defer = function(id){
  2123. process.nextTick(ctx(run, id, 1));
  2124. };
  2125. // Browsers with MessageChannel, includes WebWorkers
  2126. } else if(MessageChannel){
  2127. channel = new MessageChannel;
  2128. port = channel.port2;
  2129. channel.port1.onmessage = listner;
  2130. defer = ctx(port.postMessage, port, 1);
  2131. // Browsers with postMessage, skip WebWorkers
  2132. // IE8 has postMessage, but it's sync & typeof its postMessage is 'object'
  2133. } else if(global.addEventListener && typeof postMessage == 'function' && !global.importScripts){
  2134. defer = function(id){
  2135. global.postMessage(id + '', '*');
  2136. };
  2137. global.addEventListener('message', listner, false);
  2138. // IE8-
  2139. } else if(ONREADYSTATECHANGE in cel('script')){
  2140. defer = function(id){
  2141. html.appendChild(cel('script'))[ONREADYSTATECHANGE] = function(){
  2142. html.removeChild(this);
  2143. run.call(id);
  2144. };
  2145. };
  2146. // Rest old browsers
  2147. } else {
  2148. defer = function(id){
  2149. setTimeout(ctx(run, id, 1), 0);
  2150. };
  2151. }
  2152. }
  2153. module.exports = {
  2154. set: setTask,
  2155. clear: clearTask
  2156. };
  2157. /***/ },
  2158. /* 57 */
  2159. /***/ function(module, exports) {
  2160. // fast apply, http://jsperf.lnkit.com/fast-apply/5
  2161. module.exports = function(fn, args, that){
  2162. var un = that === undefined;
  2163. switch(args.length){
  2164. case 0: return un ? fn()
  2165. : fn.call(that);
  2166. case 1: return un ? fn(args[0])
  2167. : fn.call(that, args[0]);
  2168. case 2: return un ? fn(args[0], args[1])
  2169. : fn.call(that, args[0], args[1]);
  2170. case 3: return un ? fn(args[0], args[1], args[2])
  2171. : fn.call(that, args[0], args[1], args[2]);
  2172. case 4: return un ? fn(args[0], args[1], args[2], args[3])
  2173. : fn.call(that, args[0], args[1], args[2], args[3]);
  2174. } return fn.apply(that, args);
  2175. };
  2176. /***/ },
  2177. /* 58 */
  2178. /***/ function(module, exports, __webpack_require__) {
  2179. module.exports = __webpack_require__(19).document && document.documentElement;
  2180. /***/ },
  2181. /* 59 */
  2182. /***/ function(module, exports, __webpack_require__) {
  2183. var isObject = __webpack_require__(44)
  2184. , document = __webpack_require__(19).document
  2185. // in old IE typeof document.createElement is 'object'
  2186. , is = isObject(document) && isObject(document.createElement);
  2187. module.exports = function(it){
  2188. return is ? document.createElement(it) : {};
  2189. };
  2190. /***/ },
  2191. /* 60 */
  2192. /***/ function(module, exports, __webpack_require__) {
  2193. var redefine = __webpack_require__(22);
  2194. module.exports = function(target, src){
  2195. for(var key in src)redefine(target, key, src[key]);
  2196. return target;
  2197. };
  2198. /***/ },
  2199. /* 61 */
  2200. /***/ function(module, exports, __webpack_require__) {
  2201. 'use strict';
  2202. var core = __webpack_require__(4)
  2203. , $ = __webpack_require__(24)
  2204. , DESCRIPTORS = __webpack_require__(26)
  2205. , SPECIES = __webpack_require__(32)('species');
  2206. module.exports = function(KEY){
  2207. var C = core[KEY];
  2208. if(DESCRIPTORS && C && !C[SPECIES])$.setDesc(C, SPECIES, {
  2209. configurable: true,
  2210. get: function(){ return this; }
  2211. });
  2212. };
  2213. /***/ },
  2214. /* 62 */
  2215. /***/ function(module, exports, __webpack_require__) {
  2216. var ITERATOR = __webpack_require__(32)('iterator')
  2217. , SAFE_CLOSING = false;
  2218. try {
  2219. var riter = [7][ITERATOR]();
  2220. riter['return'] = function(){ SAFE_CLOSING = true; };
  2221. Array.from(riter, function(){ throw 2; });
  2222. } catch(e){ /* empty */ }
  2223. module.exports = function(exec, skipClosing){
  2224. if(!skipClosing && !SAFE_CLOSING)return false;
  2225. var safe = false;
  2226. try {
  2227. var arr = [7]
  2228. , iter = arr[ITERATOR]();
  2229. iter.next = function(){ safe = true; };
  2230. arr[ITERATOR] = function(){ return iter; };
  2231. exec(arr);
  2232. } catch(e){ /* empty */ }
  2233. return safe;
  2234. };
  2235. /***/ },
  2236. /* 63 */
  2237. /***/ function(module, exports, __webpack_require__) {
  2238. module.exports = { "default": __webpack_require__(64), __esModule: true };
  2239. /***/ },
  2240. /* 64 */
  2241. /***/ function(module, exports, __webpack_require__) {
  2242. __webpack_require__(65);
  2243. module.exports = __webpack_require__(4).Object.setPrototypeOf;
  2244. /***/ },
  2245. /* 65 */
  2246. /***/ function(module, exports, __webpack_require__) {
  2247. // 19.1.3.19 Object.setPrototypeOf(O, proto)
  2248. var $export = __webpack_require__(18);
  2249. $export($export.S, 'Object', {setPrototypeOf: __webpack_require__(52).set});
  2250. /***/ },
  2251. /* 66 */
  2252. /***/ function(module, exports, __webpack_require__) {
  2253. module.exports = { "default": __webpack_require__(67), __esModule: true };
  2254. /***/ },
  2255. /* 67 */
  2256. /***/ function(module, exports, __webpack_require__) {
  2257. var $ = __webpack_require__(24);
  2258. module.exports = function create(P, D){
  2259. return $.create(P, D);
  2260. };
  2261. /***/ },
  2262. /* 68 */
  2263. /***/ function(module, exports, __webpack_require__) {
  2264. "use strict";
  2265. exports.__esModule = true;
  2266. var _symbol = __webpack_require__(69);
  2267. var _symbol2 = _interopRequireDefault(_symbol);
  2268. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  2269. function _typeof(obj) { return obj && typeof _Symbol !== "undefined" && obj.constructor === _Symbol ? "symbol" : typeof obj; }
  2270. exports.default = function (obj) {
  2271. return obj && typeof _symbol2.default !== "undefined" && obj.constructor === _symbol2.default ? "symbol" : typeof obj === "undefined" ? "undefined" : _typeof(obj);
  2272. };
  2273. /***/ },
  2274. /* 69 */
  2275. /***/ function(module, exports, __webpack_require__) {
  2276. module.exports = { "default": __webpack_require__(70), __esModule: true };
  2277. /***/ },
  2278. /* 70 */
  2279. /***/ function(module, exports, __webpack_require__) {
  2280. __webpack_require__(71);
  2281. __webpack_require__(11);
  2282. module.exports = __webpack_require__(4).Symbol;
  2283. /***/ },
  2284. /* 71 */
  2285. /***/ function(module, exports, __webpack_require__) {
  2286. 'use strict';
  2287. // ECMAScript 6 symbols shim
  2288. var $ = __webpack_require__(24)
  2289. , global = __webpack_require__(19)
  2290. , has = __webpack_require__(28)
  2291. , DESCRIPTORS = __webpack_require__(26)
  2292. , $export = __webpack_require__(18)
  2293. , redefine = __webpack_require__(22)
  2294. , $fails = __webpack_require__(27)
  2295. , shared = __webpack_require__(33)
  2296. , setToStringTag = __webpack_require__(31)
  2297. , uid = __webpack_require__(34)
  2298. , wks = __webpack_require__(32)
  2299. , keyOf = __webpack_require__(72)
  2300. , $names = __webpack_require__(73)
  2301. , enumKeys = __webpack_require__(74)
  2302. , isArray = __webpack_require__(75)
  2303. , anObject = __webpack_require__(45)
  2304. , toIObject = __webpack_require__(39)
  2305. , createDesc = __webpack_require__(25)
  2306. , getDesc = $.getDesc
  2307. , setDesc = $.setDesc
  2308. , _create = $.create
  2309. , getNames = $names.get
  2310. , $Symbol = global.Symbol
  2311. , $JSON = global.JSON
  2312. , _stringify = $JSON && $JSON.stringify
  2313. , setter = false
  2314. , HIDDEN = wks('_hidden')
  2315. , isEnum = $.isEnum
  2316. , SymbolRegistry = shared('symbol-registry')
  2317. , AllSymbols = shared('symbols')
  2318. , useNative = typeof $Symbol == 'function'
  2319. , ObjectProto = Object.prototype;
  2320. // fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687
  2321. var setSymbolDesc = DESCRIPTORS && $fails(function(){
  2322. return _create(setDesc({}, 'a', {
  2323. get: function(){ return setDesc(this, 'a', {value: 7}).a; }
  2324. })).a != 7;
  2325. }) ? function(it, key, D){
  2326. var protoDesc = getDesc(ObjectProto, key);
  2327. if(protoDesc)delete ObjectProto[key];
  2328. setDesc(it, key, D);
  2329. if(protoDesc && it !== ObjectProto)setDesc(ObjectProto, key, protoDesc);
  2330. } : setDesc;
  2331. var wrap = function(tag){
  2332. var sym = AllSymbols[tag] = _create($Symbol.prototype);
  2333. sym._k = tag;
  2334. DESCRIPTORS && setter && setSymbolDesc(ObjectProto, tag, {
  2335. configurable: true,
  2336. set: function(value){
  2337. if(has(this, HIDDEN) && has(this[HIDDEN], tag))this[HIDDEN][tag] = false;
  2338. setSymbolDesc(this, tag, createDesc(1, value));
  2339. }
  2340. });
  2341. return sym;
  2342. };
  2343. var isSymbol = function(it){
  2344. return typeof it == 'symbol';
  2345. };
  2346. var $defineProperty = function defineProperty(it, key, D){
  2347. if(D && has(AllSymbols, key)){
  2348. if(!D.enumerable){
  2349. if(!has(it, HIDDEN))setDesc(it, HIDDEN, createDesc(1, {}));
  2350. it[HIDDEN][key] = true;
  2351. } else {
  2352. if(has(it, HIDDEN) && it[HIDDEN][key])it[HIDDEN][key] = false;
  2353. D = _create(D, {enumerable: createDesc(0, false)});
  2354. } return setSymbolDesc(it, key, D);
  2355. } return setDesc(it, key, D);
  2356. };
  2357. var $defineProperties = function defineProperties(it, P){
  2358. anObject(it);
  2359. var keys = enumKeys(P = toIObject(P))
  2360. , i = 0
  2361. , l = keys.length
  2362. , key;
  2363. while(l > i)$defineProperty(it, key = keys[i++], P[key]);
  2364. return it;
  2365. };
  2366. var $create = function create(it, P){
  2367. return P === undefined ? _create(it) : $defineProperties(_create(it), P);
  2368. };
  2369. var $propertyIsEnumerable = function propertyIsEnumerable(key){
  2370. var E = isEnum.call(this, key);
  2371. return E || !has(this, key) || !has(AllSymbols, key) || has(this, HIDDEN) && this[HIDDEN][key]
  2372. ? E : true;
  2373. };
  2374. var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(it, key){
  2375. var D = getDesc(it = toIObject(it), key);
  2376. if(D && has(AllSymbols, key) && !(has(it, HIDDEN) && it[HIDDEN][key]))D.enumerable = true;
  2377. return D;
  2378. };
  2379. var $getOwnPropertyNames = function getOwnPropertyNames(it){
  2380. var names = getNames(toIObject(it))
  2381. , result = []
  2382. , i = 0
  2383. , key;
  2384. while(names.length > i)if(!has(AllSymbols, key = names[i++]) && key != HIDDEN)result.push(key);
  2385. return result;
  2386. };
  2387. var $getOwnPropertySymbols = function getOwnPropertySymbols(it){
  2388. var names = getNames(toIObject(it))
  2389. , result = []
  2390. , i = 0
  2391. , key;
  2392. while(names.length > i)if(has(AllSymbols, key = names[i++]))result.push(AllSymbols[key]);
  2393. return result;
  2394. };
  2395. var $stringify = function stringify(it){
  2396. if(it === undefined || isSymbol(it))return; // IE8 returns string on undefined
  2397. var args = [it]
  2398. , i = 1
  2399. , $$ = arguments
  2400. , replacer, $replacer;
  2401. while($$.length > i)args.push($$[i++]);
  2402. replacer = args[1];
  2403. if(typeof replacer == 'function')$replacer = replacer;
  2404. if($replacer || !isArray(replacer))replacer = function(key, value){
  2405. if($replacer)value = $replacer.call(this, key, value);
  2406. if(!isSymbol(value))return value;
  2407. };
  2408. args[1] = replacer;
  2409. return _stringify.apply($JSON, args);
  2410. };
  2411. var buggyJSON = $fails(function(){
  2412. var S = $Symbol();
  2413. // MS Edge converts symbol values to JSON as {}
  2414. // WebKit converts symbol values to JSON as null
  2415. // V8 throws on boxed symbols
  2416. return _stringify([S]) != '[null]' || _stringify({a: S}) != '{}' || _stringify(Object(S)) != '{}';
  2417. });
  2418. // 19.4.1.1 Symbol([description])
  2419. if(!useNative){
  2420. $Symbol = function Symbol(){
  2421. if(isSymbol(this))throw TypeError('Symbol is not a constructor');
  2422. return wrap(uid(arguments.length > 0 ? arguments[0] : undefined));
  2423. };
  2424. redefine($Symbol.prototype, 'toString', function toString(){
  2425. return this._k;
  2426. });
  2427. isSymbol = function(it){
  2428. return it instanceof $Symbol;
  2429. };
  2430. $.create = $create;
  2431. $.isEnum = $propertyIsEnumerable;
  2432. $.getDesc = $getOwnPropertyDescriptor;
  2433. $.setDesc = $defineProperty;
  2434. $.setDescs = $defineProperties;
  2435. $.getNames = $names.get = $getOwnPropertyNames;
  2436. $.getSymbols = $getOwnPropertySymbols;
  2437. if(DESCRIPTORS && !__webpack_require__(17)){
  2438. redefine(ObjectProto, 'propertyIsEnumerable', $propertyIsEnumerable, true);
  2439. }
  2440. }
  2441. var symbolStatics = {
  2442. // 19.4.2.1 Symbol.for(key)
  2443. 'for': function(key){
  2444. return has(SymbolRegistry, key += '')
  2445. ? SymbolRegistry[key]
  2446. : SymbolRegistry[key] = $Symbol(key);
  2447. },
  2448. // 19.4.2.5 Symbol.keyFor(sym)
  2449. keyFor: function keyFor(key){
  2450. return keyOf(SymbolRegistry, key);
  2451. },
  2452. useSetter: function(){ setter = true; },
  2453. useSimple: function(){ setter = false; }
  2454. };
  2455. // 19.4.2.2 Symbol.hasInstance
  2456. // 19.4.2.3 Symbol.isConcatSpreadable
  2457. // 19.4.2.4 Symbol.iterator
  2458. // 19.4.2.6 Symbol.match
  2459. // 19.4.2.8 Symbol.replace
  2460. // 19.4.2.9 Symbol.search
  2461. // 19.4.2.10 Symbol.species
  2462. // 19.4.2.11 Symbol.split
  2463. // 19.4.2.12 Symbol.toPrimitive
  2464. // 19.4.2.13 Symbol.toStringTag
  2465. // 19.4.2.14 Symbol.unscopables
  2466. $.each.call((
  2467. 'hasInstance,isConcatSpreadable,iterator,match,replace,search,' +
  2468. 'species,split,toPrimitive,toStringTag,unscopables'
  2469. ).split(','), function(it){
  2470. var sym = wks(it);
  2471. symbolStatics[it] = useNative ? sym : wrap(sym);
  2472. });
  2473. setter = true;
  2474. $export($export.G + $export.W, {Symbol: $Symbol});
  2475. $export($export.S, 'Symbol', symbolStatics);
  2476. $export($export.S + $export.F * !useNative, 'Object', {
  2477. // 19.1.2.2 Object.create(O [, Properties])
  2478. create: $create,
  2479. // 19.1.2.4 Object.defineProperty(O, P, Attributes)
  2480. defineProperty: $defineProperty,
  2481. // 19.1.2.3 Object.defineProperties(O, Properties)
  2482. defineProperties: $defineProperties,
  2483. // 19.1.2.6 Object.getOwnPropertyDescriptor(O, P)
  2484. getOwnPropertyDescriptor: $getOwnPropertyDescriptor,
  2485. // 19.1.2.7 Object.getOwnPropertyNames(O)
  2486. getOwnPropertyNames: $getOwnPropertyNames,
  2487. // 19.1.2.8 Object.getOwnPropertySymbols(O)
  2488. getOwnPropertySymbols: $getOwnPropertySymbols
  2489. });
  2490. // 24.3.2 JSON.stringify(value [, replacer [, space]])
  2491. $JSON && $export($export.S + $export.F * (!useNative || buggyJSON), 'JSON', {stringify: $stringify});
  2492. // 19.4.3.5 Symbol.prototype[@@toStringTag]
  2493. setToStringTag($Symbol, 'Symbol');
  2494. // 20.2.1.9 Math[@@toStringTag]
  2495. setToStringTag(Math, 'Math', true);
  2496. // 24.3.3 JSON[@@toStringTag]
  2497. setToStringTag(global.JSON, 'JSON', true);
  2498. /***/ },
  2499. /* 72 */
  2500. /***/ function(module, exports, __webpack_require__) {
  2501. var $ = __webpack_require__(24)
  2502. , toIObject = __webpack_require__(39);
  2503. module.exports = function(object, el){
  2504. var O = toIObject(object)
  2505. , keys = $.getKeys(O)
  2506. , length = keys.length
  2507. , index = 0
  2508. , key;
  2509. while(length > index)if(O[key = keys[index++]] === el)return key;
  2510. };
  2511. /***/ },
  2512. /* 73 */
  2513. /***/ function(module, exports, __webpack_require__) {
  2514. // fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window
  2515. var toIObject = __webpack_require__(39)
  2516. , getNames = __webpack_require__(24).getNames
  2517. , toString = {}.toString;
  2518. var windowNames = typeof window == 'object' && Object.getOwnPropertyNames
  2519. ? Object.getOwnPropertyNames(window) : [];
  2520. var getWindowNames = function(it){
  2521. try {
  2522. return getNames(it);
  2523. } catch(e){
  2524. return windowNames.slice();
  2525. }
  2526. };
  2527. module.exports.get = function getOwnPropertyNames(it){
  2528. if(windowNames && toString.call(it) == '[object Window]')return getWindowNames(it);
  2529. return getNames(toIObject(it));
  2530. };
  2531. /***/ },
  2532. /* 74 */
  2533. /***/ function(module, exports, __webpack_require__) {
  2534. // all enumerable object keys, includes symbols
  2535. var $ = __webpack_require__(24);
  2536. module.exports = function(it){
  2537. var keys = $.getKeys(it)
  2538. , getSymbols = $.getSymbols;
  2539. if(getSymbols){
  2540. var symbols = getSymbols(it)
  2541. , isEnum = $.isEnum
  2542. , i = 0
  2543. , key;
  2544. while(symbols.length > i)if(isEnum.call(it, key = symbols[i++]))keys.push(key);
  2545. }
  2546. return keys;
  2547. };
  2548. /***/ },
  2549. /* 75 */
  2550. /***/ function(module, exports, __webpack_require__) {
  2551. // 7.2.2 IsArray(argument)
  2552. var cof = __webpack_require__(41);
  2553. module.exports = Array.isArray || function(arg){
  2554. return cof(arg) == 'Array';
  2555. };
  2556. /***/ },
  2557. /* 76 */
  2558. /***/ function(module, exports, __webpack_require__) {
  2559. module.exports = { "default": __webpack_require__(77), __esModule: true };
  2560. /***/ },
  2561. /* 77 */
  2562. /***/ function(module, exports, __webpack_require__) {
  2563. __webpack_require__(12);
  2564. __webpack_require__(35);
  2565. module.exports = __webpack_require__(32)('iterator');
  2566. /***/ },
  2567. /* 78 */
  2568. /***/ function(module, exports, __webpack_require__) {
  2569. "use strict";
  2570. exports.__esModule = true;
  2571. var _promise = __webpack_require__(9);
  2572. var _promise2 = _interopRequireDefault(_promise);
  2573. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  2574. exports.default = function (fn) {
  2575. return function () {
  2576. var gen = fn.apply(this, arguments);
  2577. return new _promise2.default(function (resolve, reject) {
  2578. function step(key, arg) {
  2579. try {
  2580. var info = gen[key](arg);
  2581. var value = info.value;
  2582. } catch (error) {
  2583. reject(error);
  2584. return;
  2585. }
  2586. if (info.done) {
  2587. resolve(value);
  2588. } else {
  2589. _promise2.default.resolve(value).then(function (value) {
  2590. step("next", value);
  2591. }, function (err) {
  2592. step("throw", err);
  2593. });
  2594. }
  2595. }
  2596. step("next");
  2597. });
  2598. };
  2599. };
  2600. /***/ },
  2601. /* 79 */
  2602. /***/ function(module, exports) {
  2603. "use strict";
  2604. exports.__esModule = true;
  2605. exports.default = function (instance, Constructor) {
  2606. if (!(instance instanceof Constructor)) {
  2607. throw new TypeError("Cannot call a class as a function");
  2608. }
  2609. };
  2610. /***/ },
  2611. /* 80 */
  2612. /***/ function(module, exports, __webpack_require__) {
  2613. "use strict";
  2614. exports.__esModule = true;
  2615. var _defineProperty = __webpack_require__(81);
  2616. var _defineProperty2 = _interopRequireDefault(_defineProperty);
  2617. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  2618. exports.default = (function () {
  2619. function defineProperties(target, props) {
  2620. for (var i = 0; i < props.length; i++) {
  2621. var descriptor = props[i];
  2622. descriptor.enumerable = descriptor.enumerable || false;
  2623. descriptor.configurable = true;
  2624. if ("value" in descriptor) descriptor.writable = true;
  2625. (0, _defineProperty2.default)(target, descriptor.key, descriptor);
  2626. }
  2627. }
  2628. return function (Constructor, protoProps, staticProps) {
  2629. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  2630. if (staticProps) defineProperties(Constructor, staticProps);
  2631. return Constructor;
  2632. };
  2633. })();
  2634. /***/ },
  2635. /* 81 */
  2636. /***/ function(module, exports, __webpack_require__) {
  2637. module.exports = { "default": __webpack_require__(82), __esModule: true };
  2638. /***/ },
  2639. /* 82 */
  2640. /***/ function(module, exports, __webpack_require__) {
  2641. var $ = __webpack_require__(24);
  2642. module.exports = function defineProperty(it, key, desc){
  2643. return $.setDesc(it, key, desc);
  2644. };
  2645. /***/ },
  2646. /* 83 */
  2647. /***/ function(module, exports) {
  2648. // Copyright Joyent, Inc. and other Node contributors.
  2649. //
  2650. // Permission is hereby granted, free of charge, to any person obtaining a
  2651. // copy of this software and associated documentation files (the
  2652. // "Software"), to deal in the Software without restriction, including
  2653. // without limitation the rights to use, copy, modify, merge, publish,
  2654. // distribute, sublicense, and/or sell copies of the Software, and to permit
  2655. // persons to whom the Software is furnished to do so, subject to the
  2656. // following conditions:
  2657. //
  2658. // The above copyright notice and this permission notice shall be included
  2659. // in all copies or substantial portions of the Software.
  2660. //
  2661. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  2662. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  2663. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  2664. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  2665. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  2666. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  2667. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  2668. function EventEmitter() {
  2669. this._events = this._events || {};
  2670. this._maxListeners = this._maxListeners || undefined;
  2671. }
  2672. module.exports = EventEmitter;
  2673. // Backwards-compat with node 0.10.x
  2674. EventEmitter.EventEmitter = EventEmitter;
  2675. EventEmitter.prototype._events = undefined;
  2676. EventEmitter.prototype._maxListeners = undefined;
  2677. // By default EventEmitters will print a warning if more than 10 listeners are
  2678. // added to it. This is a useful default which helps finding memory leaks.
  2679. EventEmitter.defaultMaxListeners = 10;
  2680. // Obviously not all Emitters should be limited to 10. This function allows
  2681. // that to be increased. Set to zero for unlimited.
  2682. EventEmitter.prototype.setMaxListeners = function(n) {
  2683. if (!isNumber(n) || n < 0 || isNaN(n))
  2684. throw TypeError('n must be a positive number');
  2685. this._maxListeners = n;
  2686. return this;
  2687. };
  2688. EventEmitter.prototype.emit = function(type) {
  2689. var er, handler, len, args, i, listeners;
  2690. if (!this._events)
  2691. this._events = {};
  2692. // If there is no 'error' event listener then throw.
  2693. if (type === 'error') {
  2694. if (!this._events.error ||
  2695. (isObject(this._events.error) && !this._events.error.length)) {
  2696. er = arguments[1];
  2697. if (er instanceof Error) {
  2698. throw er; // Unhandled 'error' event
  2699. }
  2700. throw TypeError('Uncaught, unspecified "error" event.');
  2701. }
  2702. }
  2703. handler = this._events[type];
  2704. if (isUndefined(handler))
  2705. return false;
  2706. if (isFunction(handler)) {
  2707. switch (arguments.length) {
  2708. // fast cases
  2709. case 1:
  2710. handler.call(this);
  2711. break;
  2712. case 2:
  2713. handler.call(this, arguments[1]);
  2714. break;
  2715. case 3:
  2716. handler.call(this, arguments[1], arguments[2]);
  2717. break;
  2718. // slower
  2719. default:
  2720. args = Array.prototype.slice.call(arguments, 1);
  2721. handler.apply(this, args);
  2722. }
  2723. } else if (isObject(handler)) {
  2724. args = Array.prototype.slice.call(arguments, 1);
  2725. listeners = handler.slice();
  2726. len = listeners.length;
  2727. for (i = 0; i < len; i++)
  2728. listeners[i].apply(this, args);
  2729. }
  2730. return true;
  2731. };
  2732. EventEmitter.prototype.addListener = function(type, listener) {
  2733. var m;
  2734. if (!isFunction(listener))
  2735. throw TypeError('listener must be a function');
  2736. if (!this._events)
  2737. this._events = {};
  2738. // To avoid recursion in the case that type === "newListener"! Before
  2739. // adding it to the listeners, first emit "newListener".
  2740. if (this._events.newListener)
  2741. this.emit('newListener', type,
  2742. isFunction(listener.listener) ?
  2743. listener.listener : listener);
  2744. if (!this._events[type])
  2745. // Optimize the case of one listener. Don't need the extra array object.
  2746. this._events[type] = listener;
  2747. else if (isObject(this._events[type]))
  2748. // If we've already got an array, just append.
  2749. this._events[type].push(listener);
  2750. else
  2751. // Adding the second element, need to change to array.
  2752. this._events[type] = [this._events[type], listener];
  2753. // Check for listener leak
  2754. if (isObject(this._events[type]) && !this._events[type].warned) {
  2755. if (!isUndefined(this._maxListeners)) {
  2756. m = this._maxListeners;
  2757. } else {
  2758. m = EventEmitter.defaultMaxListeners;
  2759. }
  2760. if (m && m > 0 && this._events[type].length > m) {
  2761. this._events[type].warned = true;
  2762. console.error('(node) warning: possible EventEmitter memory ' +
  2763. 'leak detected. %d listeners added. ' +
  2764. 'Use emitter.setMaxListeners() to increase limit.',
  2765. this._events[type].length);
  2766. if (typeof console.trace === 'function') {
  2767. // not supported in IE 10
  2768. console.trace();
  2769. }
  2770. }
  2771. }
  2772. return this;
  2773. };
  2774. EventEmitter.prototype.on = EventEmitter.prototype.addListener;
  2775. EventEmitter.prototype.once = function(type, listener) {
  2776. if (!isFunction(listener))
  2777. throw TypeError('listener must be a function');
  2778. var fired = false;
  2779. function g() {
  2780. this.removeListener(type, g);
  2781. if (!fired) {
  2782. fired = true;
  2783. listener.apply(this, arguments);
  2784. }
  2785. }
  2786. g.listener = listener;
  2787. this.on(type, g);
  2788. return this;
  2789. };
  2790. // emits a 'removeListener' event iff the listener was removed
  2791. EventEmitter.prototype.removeListener = function(type, listener) {
  2792. var list, position, length, i;
  2793. if (!isFunction(listener))
  2794. throw TypeError('listener must be a function');
  2795. if (!this._events || !this._events[type])
  2796. return this;
  2797. list = this._events[type];
  2798. length = list.length;
  2799. position = -1;
  2800. if (list === listener ||
  2801. (isFunction(list.listener) && list.listener === listener)) {
  2802. delete this._events[type];
  2803. if (this._events.removeListener)
  2804. this.emit('removeListener', type, listener);
  2805. } else if (isObject(list)) {
  2806. for (i = length; i-- > 0;) {
  2807. if (list[i] === listener ||
  2808. (list[i].listener && list[i].listener === listener)) {
  2809. position = i;
  2810. break;
  2811. }
  2812. }
  2813. if (position < 0)
  2814. return this;
  2815. if (list.length === 1) {
  2816. list.length = 0;
  2817. delete this._events[type];
  2818. } else {
  2819. list.splice(position, 1);
  2820. }
  2821. if (this._events.removeListener)
  2822. this.emit('removeListener', type, listener);
  2823. }
  2824. return this;
  2825. };
  2826. EventEmitter.prototype.removeAllListeners = function(type) {
  2827. var key, listeners;
  2828. if (!this._events)
  2829. return this;
  2830. // not listening for removeListener, no need to emit
  2831. if (!this._events.removeListener) {
  2832. if (arguments.length === 0)
  2833. this._events = {};
  2834. else if (this._events[type])
  2835. delete this._events[type];
  2836. return this;
  2837. }
  2838. // emit removeListener for all listeners on all events
  2839. if (arguments.length === 0) {
  2840. for (key in this._events) {
  2841. if (key === 'removeListener') continue;
  2842. this.removeAllListeners(key);
  2843. }
  2844. this.removeAllListeners('removeListener');
  2845. this._events = {};
  2846. return this;
  2847. }
  2848. listeners = this._events[type];
  2849. if (isFunction(listeners)) {
  2850. this.removeListener(type, listeners);
  2851. } else if (listeners) {
  2852. // LIFO order
  2853. while (listeners.length)
  2854. this.removeListener(type, listeners[listeners.length - 1]);
  2855. }
  2856. delete this._events[type];
  2857. return this;
  2858. };
  2859. EventEmitter.prototype.listeners = function(type) {
  2860. var ret;
  2861. if (!this._events || !this._events[type])
  2862. ret = [];
  2863. else if (isFunction(this._events[type]))
  2864. ret = [this._events[type]];
  2865. else
  2866. ret = this._events[type].slice();
  2867. return ret;
  2868. };
  2869. EventEmitter.prototype.listenerCount = function(type) {
  2870. if (this._events) {
  2871. var evlistener = this._events[type];
  2872. if (isFunction(evlistener))
  2873. return 1;
  2874. else if (evlistener)
  2875. return evlistener.length;
  2876. }
  2877. return 0;
  2878. };
  2879. EventEmitter.listenerCount = function(emitter, type) {
  2880. return emitter.listenerCount(type);
  2881. };
  2882. function isFunction(arg) {
  2883. return typeof arg === 'function';
  2884. }
  2885. function isNumber(arg) {
  2886. return typeof arg === 'number';
  2887. }
  2888. function isObject(arg) {
  2889. return typeof arg === 'object' && arg !== null;
  2890. }
  2891. function isUndefined(arg) {
  2892. return arg === void 0;
  2893. }
  2894. /***/ }
  2895. /******/ ]);