1 |
|
2 |
|
3 |
|
4 | (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.OSS = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
|
5 | "use strict";
|
6 |
|
7 | var OSS = require('./browser/client');
|
8 |
|
9 | OSS.Buffer = require('buffer').Buffer;
|
10 | OSS.urllib = require('../shims/xhr');
|
11 | OSS.version = require('./browser/version').version;
|
12 | module.exports = OSS;
|
13 |
|
14 | },{"../shims/xhr":397,"./browser/client":2,"./browser/version":5,"buffer":98}],2:[function(require,module,exports){
|
15 | (function (Buffer,process){
|
16 | "use strict";
|
17 |
|
18 | var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
19 |
|
20 | require("core-js/modules/es.symbol");
|
21 |
|
22 | require("core-js/modules/es.symbol.description");
|
23 |
|
24 | require("core-js/modules/es.array.concat");
|
25 |
|
26 | require("core-js/modules/es.array.includes");
|
27 |
|
28 | require("core-js/modules/es.array.index-of");
|
29 |
|
30 | require("core-js/modules/es.array.slice");
|
31 |
|
32 | require("core-js/modules/es.function.name");
|
33 |
|
34 | require("core-js/modules/es.object.assign");
|
35 |
|
36 | require("core-js/modules/es.object.to-string");
|
37 |
|
38 | require("core-js/modules/es.promise");
|
39 |
|
40 | require("core-js/modules/es.regexp.exec");
|
41 |
|
42 | require("core-js/modules/es.regexp.to-string");
|
43 |
|
44 | require("core-js/modules/es.string.replace");
|
45 |
|
46 | require("core-js/modules/es.string.split");
|
47 |
|
48 | require("core-js/modules/es.string.starts-with");
|
49 |
|
50 | var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
51 |
|
52 | require("regenerator-runtime/runtime");
|
53 |
|
54 | var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
55 |
|
56 | var debug = require('debug')('ali-oss');
|
57 |
|
58 | var xml = require('xml2js');
|
59 |
|
60 | var AgentKeepalive = require('agentkeepalive');
|
61 |
|
62 | var merge = require('merge-descriptors');
|
63 |
|
64 | var platform = require('platform');
|
65 |
|
66 | var utility = require('utility');
|
67 |
|
68 | var urllib = require('urllib');
|
69 |
|
70 | var pkg = require('./version');
|
71 |
|
72 | var bowser = require('bowser');
|
73 |
|
74 | var signUtils = require('../common/signUtils');
|
75 |
|
76 | var _initOptions = require('../common/client/initOptions');
|
77 |
|
78 | var _require = require('../common/utils/createRequest'),
|
79 | createRequest = _require.createRequest;
|
80 |
|
81 | var _require2 = require('../common/utils/encoder'),
|
82 | encoder = _require2.encoder;
|
83 |
|
84 | var _require3 = require('../common/client/getReqUrl'),
|
85 | getReqUrl = _require3.getReqUrl;
|
86 |
|
87 | var _require4 = require('../common/utils/setSTSToken'),
|
88 | setSTSToken = _require4.setSTSToken;
|
89 |
|
90 | var _require5 = require('../common/utils/retry'),
|
91 | retry = _require5.retry;
|
92 |
|
93 | var globalHttpAgent = new AgentKeepalive();
|
94 |
|
95 | function _unSupportBrowserTip() {
|
96 | var name = platform.name,
|
97 | version = platform.version;
|
98 |
|
99 | if (name && name.toLowerCase && name.toLowerCase() === 'ie' && version.split('.')[0] < 10) {
|
100 |
|
101 | console.warn('ali-oss does not support the current browser');
|
102 | }
|
103 | }
|
104 |
|
105 |
|
106 | function isHttpsWebProtocol() {
|
107 |
|
108 |
|
109 | return location && location.protocol === 'https:';
|
110 | }
|
111 |
|
112 | function Client(options, ctx) {
|
113 | _unSupportBrowserTip();
|
114 |
|
115 | if (!(this instanceof Client)) {
|
116 | return new Client(options, ctx);
|
117 | }
|
118 |
|
119 | if (options && options.inited) {
|
120 | this.options = options;
|
121 | } else {
|
122 | this.options = Client.initOptions(options);
|
123 | }
|
124 |
|
125 | this.options.cancelFlag = false;
|
126 |
|
127 |
|
128 | if (this.options.urllib) {
|
129 | this.urllib = this.options.urllib;
|
130 | } else {
|
131 | this.urllib = urllib;
|
132 | this.agent = this.options.agent || globalHttpAgent;
|
133 | }
|
134 |
|
135 | this.ctx = ctx;
|
136 | this.userAgent = this._getUserAgent();
|
137 |
|
138 | this.options.amendTimeSkewed = 0;
|
139 | }
|
140 |
|
141 |
|
142 |
|
143 |
|
144 |
|
145 | module.exports = Client;
|
146 |
|
147 | Client.initOptions = function initOptions(options) {
|
148 | if (!options.stsToken) {
|
149 | console.warn('Please use STS Token for safety, see more details at https://help.aliyun.com/document_detail/32077.html');
|
150 | }
|
151 |
|
152 | var opts = Object.assign({
|
153 | secure: isHttpsWebProtocol(),
|
154 |
|
155 | useFetch: false
|
156 | }, options);
|
157 | return _initOptions(opts);
|
158 | };
|
159 |
|
160 |
|
161 |
|
162 |
|
163 |
|
164 | var proto = Client.prototype;
|
165 |
|
166 | proto.debug = debug;
|
167 |
|
168 |
|
169 |
|
170 |
|
171 | merge(proto, require('./object'));
|
172 |
|
173 |
|
174 |
|
175 |
|
176 | merge(proto, require('../common/bucket/getBucketWebsite'));
|
177 | merge(proto, require('../common/bucket/putBucketWebsite'));
|
178 | merge(proto, require('../common/bucket/deleteBucketWebsite'));
|
179 |
|
180 | merge(proto, require('../common/bucket/getBucketLifecycle'));
|
181 | merge(proto, require('../common/bucket/putBucketLifecycle'));
|
182 | merge(proto, require('../common/bucket/deleteBucketLifecycle'));
|
183 |
|
184 | merge(proto, require('../common/bucket/putBucketVersioning'));
|
185 | merge(proto, require('../common/bucket/getBucketVersioning'));
|
186 |
|
187 | merge(proto, require('../common/bucket/getBucketInventory'));
|
188 | merge(proto, require('../common/bucket/deleteBucketInventory'));
|
189 | merge(proto, require('../common/bucket/listBucketInventory'));
|
190 | merge(proto, require('../common/bucket/putBucketInventory'));
|
191 |
|
192 | merge(proto, require('../common/bucket/abortBucketWorm'));
|
193 | merge(proto, require('../common/bucket/completeBucketWorm'));
|
194 | merge(proto, require('../common/bucket/extendBucketWorm'));
|
195 | merge(proto, require('../common/bucket/getBucketWorm'));
|
196 | merge(proto, require('../common/bucket/initiateBucketWorm'));
|
197 |
|
198 | merge(proto, require('./managed-upload'));
|
199 |
|
200 |
|
201 |
|
202 |
|
203 | merge(proto, require('../common/multipart'));
|
204 |
|
205 |
|
206 |
|
207 |
|
208 | merge(proto, require('../common/parallel'));
|
209 |
|
210 |
|
211 |
|
212 |
|
213 |
|
214 |
|
215 | proto.signature = function signature(stringToSign) {
|
216 | this.debug('authorization stringToSign: %s', stringToSign, 'info');
|
217 | return signUtils.computeSignature(this.options.accessKeySecret, stringToSign, this.options.headerEncoding);
|
218 | };
|
219 |
|
220 | proto._getReqUrl = getReqUrl;
|
221 |
|
222 |
|
223 |
|
224 |
|
225 |
|
226 |
|
227 |
|
228 |
|
229 |
|
230 |
|
231 |
|
232 |
|
233 |
|
234 |
|
235 |
|
236 |
|
237 |
|
238 |
|
239 |
|
240 |
|
241 |
|
242 | proto.authorization = function authorization(method, resource, subres, headers) {
|
243 | var stringToSign = signUtils.buildCanonicalString(method.toUpperCase(), resource, {
|
244 | headers: headers,
|
245 | parameters: subres
|
246 | });
|
247 | return signUtils.authorization(this.options.accessKeyId, this.options.accessKeySecret, stringToSign, this.options.headerEncoding);
|
248 | };
|
249 |
|
250 |
|
251 |
|
252 |
|
253 |
|
254 |
|
255 |
|
256 |
|
257 |
|
258 |
|
259 |
|
260 |
|
261 |
|
262 |
|
263 |
|
264 |
|
265 |
|
266 |
|
267 |
|
268 |
|
269 | proto.request = function () {
|
270 | var _ref = (0, _asyncToGenerator2.default)( _regenerator.default.mark(function _callee(params) {
|
271 | var _this = this;
|
272 |
|
273 | var isAvailableStream;
|
274 | return _regenerator.default.wrap(function _callee$(_context) {
|
275 | while (1) {
|
276 | switch (_context.prev = _context.next) {
|
277 | case 0:
|
278 | isAvailableStream = params.stream ? params.stream.readable : true;
|
279 |
|
280 | if (this.options.retryMax && isAvailableStream) {
|
281 | this.request = retry(request.bind(this), this.options.retryMax, {
|
282 | errorHandler: function errorHandler(err) {
|
283 | var _errHandle = function _errHandle(_err) {
|
284 | var statusErr = [-1, -2].includes(_err.status);
|
285 |
|
286 | var requestErrorRetryHandle = _this.options.requestErrorRetryHandle || function () {
|
287 | return true;
|
288 | };
|
289 |
|
290 | return statusErr && requestErrorRetryHandle(_err);
|
291 | };
|
292 |
|
293 | if (_errHandle(err)) return true;
|
294 | return false;
|
295 | }
|
296 | });
|
297 | } else {
|
298 | this.request = request.bind(this);
|
299 | }
|
300 |
|
301 | _context.next = 4;
|
302 | return this.request(params);
|
303 |
|
304 | case 4:
|
305 | return _context.abrupt("return", _context.sent);
|
306 |
|
307 | case 5:
|
308 | case "end":
|
309 | return _context.stop();
|
310 | }
|
311 | }
|
312 | }, _callee, this);
|
313 | }));
|
314 |
|
315 | return function (_x) {
|
316 | return _ref.apply(this, arguments);
|
317 | };
|
318 | }();
|
319 |
|
320 | function request(_x2) {
|
321 | return _request.apply(this, arguments);
|
322 | }
|
323 |
|
324 | function _request() {
|
325 | _request = (0, _asyncToGenerator2.default)( _regenerator.default.mark(function _callee3(params) {
|
326 | var reqParams, result, reqErr, useStream, err, parseData;
|
327 | return _regenerator.default.wrap(function _callee3$(_context3) {
|
328 | while (1) {
|
329 | switch (_context3.prev = _context3.next) {
|
330 | case 0:
|
331 | reqParams = createRequest.call(this, params);
|
332 |
|
333 | if (!this.options.useFetch) {
|
334 | reqParams.params.mode = 'disable-fetch';
|
335 | }
|
336 |
|
337 | useStream = !!params.stream;
|
338 | _context3.prev = 3;
|
339 | _context3.next = 6;
|
340 | return this.urllib.request(reqParams.url, reqParams.params);
|
341 |
|
342 | case 6:
|
343 | result = _context3.sent;
|
344 | this.debug('response %s %s, got %s, headers: %j', params.method, reqParams.url, result.status, result.headers, 'info');
|
345 | _context3.next = 13;
|
346 | break;
|
347 |
|
348 | case 10:
|
349 | _context3.prev = 10;
|
350 | _context3.t0 = _context3["catch"](3);
|
351 | reqErr = _context3.t0;
|
352 |
|
353 | case 13:
|
354 | if (!(result && params.successStatuses && params.successStatuses.indexOf(result.status) === -1)) {
|
355 | _context3.next = 25;
|
356 | break;
|
357 | }
|
358 |
|
359 | _context3.next = 16;
|
360 | return this.requestError(result);
|
361 |
|
362 | case 16:
|
363 | err = _context3.sent;
|
364 |
|
365 | if (!(err.code === 'RequestTimeTooSkewed' && !useStream)) {
|
366 | _context3.next = 22;
|
367 | break;
|
368 | }
|
369 |
|
370 | this.options.amendTimeSkewed = +new Date(err.serverTime) - new Date();
|
371 | _context3.next = 21;
|
372 | return this.request(params);
|
373 |
|
374 | case 21:
|
375 | return _context3.abrupt("return", _context3.sent);
|
376 |
|
377 | case 22:
|
378 | err.params = params;
|
379 | _context3.next = 29;
|
380 | break;
|
381 |
|
382 | case 25:
|
383 | if (!reqErr) {
|
384 | _context3.next = 29;
|
385 | break;
|
386 | }
|
387 |
|
388 | _context3.next = 28;
|
389 | return this.requestError(reqErr);
|
390 |
|
391 | case 28:
|
392 | err = _context3.sent;
|
393 |
|
394 | case 29:
|
395 | if (!err) {
|
396 | _context3.next = 37;
|
397 | break;
|
398 | }
|
399 |
|
400 | if (!(err.status === 403 && err.code === 'InvalidAccessKeyId' && this.options.accessKeyId.startsWith('STS.') && typeof this.options.refreshSTSToken === 'function')) {
|
401 | _context3.next = 36;
|
402 | break;
|
403 | }
|
404 |
|
405 | if (!(!this._setOptions || Date.now() - this._setOptions > 10000)) {
|
406 | _context3.next = 36;
|
407 | break;
|
408 | }
|
409 |
|
410 | this._setOptions = Date.now();
|
411 | _context3.next = 35;
|
412 | return setSTSToken.call(this);
|
413 |
|
414 | case 35:
|
415 | return _context3.abrupt("return", this.request(params));
|
416 |
|
417 | case 36:
|
418 | throw err;
|
419 |
|
420 | case 37:
|
421 | if (!params.xmlResponse) {
|
422 | _context3.next = 42;
|
423 | break;
|
424 | }
|
425 |
|
426 | _context3.next = 40;
|
427 | return this.parseXML(result.data);
|
428 |
|
429 | case 40:
|
430 | parseData = _context3.sent;
|
431 | result.data = parseData;
|
432 |
|
433 | case 42:
|
434 | return _context3.abrupt("return", result);
|
435 |
|
436 | case 43:
|
437 | case "end":
|
438 | return _context3.stop();
|
439 | }
|
440 | }
|
441 | }, _callee3, this, [[3, 10]]);
|
442 | }));
|
443 | return _request.apply(this, arguments);
|
444 | }
|
445 |
|
446 | ;
|
447 |
|
448 | proto._getResource = function _getResource(params) {
|
449 | var resource = '/';
|
450 | if (params.bucket) resource += "".concat(params.bucket, "/");
|
451 | if (params.object) resource += encoder(params.object, this.options.headerEncoding);
|
452 | return resource;
|
453 | };
|
454 |
|
455 | proto._escape = function _escape(name) {
|
456 | return utility.encodeURIComponent(name).replace(/%2F/g, '/');
|
457 | };
|
458 |
|
459 |
|
460 |
|
461 |
|
462 |
|
463 |
|
464 |
|
465 |
|
466 |
|
467 | proto._getUserAgent = function _getUserAgent() {
|
468 | var agent = process && process.browser ? 'js' : 'nodejs';
|
469 | var sdk = "aliyun-sdk-".concat(agent, "/").concat(pkg.version);
|
470 | var plat = platform.description;
|
471 |
|
472 | if (!plat && process) {
|
473 | plat = "Node.js ".concat(process.version.slice(1), " on ").concat(process.platform, " ").concat(process.arch);
|
474 | }
|
475 |
|
476 | return this._checkUserAgent("".concat(sdk, " ").concat(plat));
|
477 | };
|
478 |
|
479 | proto._checkUserAgent = function _checkUserAgent(ua) {
|
480 | var userAgent = ua.replace(/\u03b1/, 'alpha').replace(/\u03b2/, 'beta');
|
481 | return userAgent;
|
482 | };
|
483 |
|
484 |
|
485 |
|
486 |
|
487 |
|
488 |
|
489 |
|
490 |
|
491 |
|
492 | proto.checkBrowserAndVersion = function checkBrowserAndVersion(name, version) {
|
493 | return bowser.name === name && bowser.version.split('.')[0] === version;
|
494 | };
|
495 |
|
496 |
|
497 |
|
498 |
|
499 |
|
500 |
|
501 |
|
502 |
|
503 | proto.parseXML = function parseXMLThunk(str) {
|
504 | return new Promise(function (resolve, reject) {
|
505 | if (Buffer.isBuffer(str)) {
|
506 | str = str.toString();
|
507 | }
|
508 |
|
509 | xml.parseString(str, {
|
510 | explicitRoot: false,
|
511 | explicitArray: false
|
512 | }, function (err, result) {
|
513 | if (err) {
|
514 | reject(err);
|
515 | } else {
|
516 | resolve(result);
|
517 | }
|
518 | });
|
519 | });
|
520 | };
|
521 |
|
522 |
|
523 |
|
524 |
|
525 |
|
526 |
|
527 |
|
528 |
|
529 | proto.requestError = function () {
|
530 | var _requestError = (0, _asyncToGenerator2.default)( _regenerator.default.mark(function _callee2(result) {
|
531 | var err, message, info, msg;
|
532 | return _regenerator.default.wrap(function _callee2$(_context2) {
|
533 | while (1) {
|
534 | switch (_context2.prev = _context2.next) {
|
535 | case 0:
|
536 | err = null;
|
537 |
|
538 | if (!(!result.data || !result.data.length)) {
|
539 | _context2.next = 5;
|
540 | break;
|
541 | }
|
542 |
|
543 | if (result.status === -1 || result.status === -2) {
|
544 |
|
545 | err = new Error(result.message);
|
546 | err.name = result.name;
|
547 | err.status = result.status;
|
548 | err.code = result.name;
|
549 | } else {
|
550 |
|
551 | if (result.status === 404) {
|
552 | err = new Error('Object not exists');
|
553 | err.name = 'NoSuchKeyError';
|
554 | err.status = 404;
|
555 | err.code = 'NoSuchKey';
|
556 | } else if (result.status === 412) {
|
557 | err = new Error('Pre condition failed');
|
558 | err.name = 'PreconditionFailedError';
|
559 | err.status = 412;
|
560 | err.code = 'PreconditionFailed';
|
561 | } else {
|
562 | err = new Error("Unknow error, status: ".concat(result.status));
|
563 | err.name = 'UnknowError';
|
564 | err.status = result.status;
|
565 | }
|
566 |
|
567 | err.requestId = result.headers['x-oss-request-id'];
|
568 | err.host = '';
|
569 | }
|
570 |
|
571 | _context2.next = 32;
|
572 | break;
|
573 |
|
574 | case 5:
|
575 | message = String(result.data);
|
576 | this.debug('request response error data: %s', message, 'error');
|
577 | _context2.prev = 7;
|
578 | _context2.next = 10;
|
579 | return this.parseXML(message);
|
580 |
|
581 | case 10:
|
582 | _context2.t0 = _context2.sent;
|
583 |
|
584 | if (_context2.t0) {
|
585 | _context2.next = 13;
|
586 | break;
|
587 | }
|
588 |
|
589 | _context2.t0 = {};
|
590 |
|
591 | case 13:
|
592 | info = _context2.t0;
|
593 | _context2.next = 23;
|
594 | break;
|
595 |
|
596 | case 16:
|
597 | _context2.prev = 16;
|
598 | _context2.t1 = _context2["catch"](7);
|
599 | this.debug(message, 'error');
|
600 | _context2.t1.message += "\nraw xml: ".concat(message);
|
601 | _context2.t1.status = result.status;
|
602 | _context2.t1.requestId = result.headers['x-oss-request-id'];
|
603 | return _context2.abrupt("return", _context2.t1);
|
604 |
|
605 | case 23:
|
606 | msg = info.Message || "unknow request error, status: ".concat(result.status);
|
607 |
|
608 | if (info.Condition) {
|
609 | msg += " (condition: ".concat(info.Condition, ")");
|
610 | }
|
611 |
|
612 | err = new Error(msg);
|
613 | err.name = info.Code ? "".concat(info.Code, "Error") : 'UnknowError';
|
614 | err.status = result.status;
|
615 | err.code = info.Code;
|
616 | err.requestId = info.RequestId;
|
617 | err.hostId = info.HostId;
|
618 | err.serverTime = info.ServerTime;
|
619 |
|
620 | case 32:
|
621 | this.debug('generate error %j', err, 'error');
|
622 | return _context2.abrupt("return", err);
|
623 |
|
624 | case 34:
|
625 | case "end":
|
626 | return _context2.stop();
|
627 | }
|
628 | }
|
629 | }, _callee2, this, [[7, 16]]);
|
630 | }));
|
631 |
|
632 | function requestError(_x3) {
|
633 | return _requestError.apply(this, arguments);
|
634 | }
|
635 |
|
636 | return requestError;
|
637 | }();
|
638 |
|
639 | }).call(this,{"isBuffer":require("../../node_modules/is-buffer/index.js")},require('_process'))
|
640 | },{"../../node_modules/is-buffer/index.js":308,"../common/bucket/abortBucketWorm":6,"../common/bucket/completeBucketWorm":7,"../common/bucket/deleteBucketInventory":8,"../common/bucket/deleteBucketLifecycle":9,"../common/bucket/deleteBucketWebsite":10,"../common/bucket/extendBucketWorm":11,"../common/bucket/getBucketInventory":12,"../common/bucket/getBucketLifecycle":13,"../common/bucket/getBucketVersioning":14,"../common/bucket/getBucketWebsite":15,"../common/bucket/getBucketWorm":16,"../common/bucket/initiateBucketWorm":17,"../common/bucket/listBucketInventory":18,"../common/bucket/putBucketInventory":19,"../common/bucket/putBucketLifecycle":20,"../common/bucket/putBucketVersioning":21,"../common/bucket/putBucketWebsite":22,"../common/client/getReqUrl":24,"../common/client/initOptions":25,"../common/multipart":28,"../common/parallel":46,"../common/signUtils":47,"../common/utils/createRequest":52,"../common/utils/encoder":55,"../common/utils/retry":67,"../common/utils/setSTSToken":69,"./managed-upload":3,"./object":4,"./version":5,"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"_process":393,"agentkeepalive":75,"bowser":77,"core-js/modules/es.array.concat":234,"core-js/modules/es.array.includes":240,"core-js/modules/es.array.index-of":241,"core-js/modules/es.array.slice":246,"core-js/modules/es.function.name":249,"core-js/modules/es.object.assign":251,"core-js/modules/es.object.to-string":254,"core-js/modules/es.promise":255,"core-js/modules/es.regexp.exec":256,"core-js/modules/es.regexp.to-string":257,"core-js/modules/es.string.replace":261,"core-js/modules/es.string.split":263,"core-js/modules/es.string.starts-with":264,"core-js/modules/es.symbol":267,"core-js/modules/es.symbol.description":266,"debug":391,"merge-descriptors":311,"platform":317,"regenerator-runtime/runtime":337,"urllib":397,"utility":396,"xml2js":352}],3:[function(require,module,exports){
|
641 | (function (Buffer){
|
642 | "use strict";
|
643 |
|
644 | var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
645 |
|
646 | require("core-js/modules/es.array.concat");
|
647 |
|
648 | require("core-js/modules/es.array.filter");
|
649 |
|
650 | require("core-js/modules/es.array.find");
|
651 |
|
652 | require("core-js/modules/es.array.from");
|
653 |
|
654 | require("core-js/modules/es.array.index-of");
|
655 |
|
656 | require("core-js/modules/es.array.iterator");
|
657 |
|
658 | require("core-js/modules/es.array.map");
|
659 |
|
660 | require("core-js/modules/es.array.slice");
|
661 |
|
662 | require("core-js/modules/es.array.splice");
|
663 |
|
664 | require("core-js/modules/es.array-buffer.slice");
|
665 |
|
666 | require("core-js/modules/es.function.name");
|
667 |
|
668 | require("core-js/modules/es.object.to-string");
|
669 |
|
670 | require("core-js/modules/es.promise");
|
671 |
|
672 | require("core-js/modules/es.regexp.to-string");
|
673 |
|
674 | require("core-js/modules/es.string.iterator");
|
675 |
|
676 | require("core-js/modules/es.typed-array.uint8-array");
|
677 |
|
678 | require("core-js/modules/es.typed-array.copy-within");
|
679 |
|
680 | require("core-js/modules/es.typed-array.every");
|
681 |
|
682 | require("core-js/modules/es.typed-array.fill");
|
683 |
|
684 | require("core-js/modules/es.typed-array.filter");
|
685 |
|
686 | require("core-js/modules/es.typed-array.find");
|
687 |
|
688 | require("core-js/modules/es.typed-array.find-index");
|
689 |
|
690 | require("core-js/modules/es.typed-array.for-each");
|
691 |
|
692 | require("core-js/modules/es.typed-array.includes");
|
693 |
|
694 | require("core-js/modules/es.typed-array.index-of");
|
695 |
|
696 | require("core-js/modules/es.typed-array.iterator");
|
697 |
|
698 | require("core-js/modules/es.typed-array.join");
|
699 |
|
700 | require("core-js/modules/es.typed-array.last-index-of");
|
701 |
|
702 | require("core-js/modules/es.typed-array.map");
|
703 |
|
704 | require("core-js/modules/es.typed-array.reduce");
|
705 |
|
706 | require("core-js/modules/es.typed-array.reduce-right");
|
707 |
|
708 | require("core-js/modules/es.typed-array.reverse");
|
709 |
|
710 | require("core-js/modules/es.typed-array.set");
|
711 |
|
712 | require("core-js/modules/es.typed-array.slice");
|
713 |
|
714 | require("core-js/modules/es.typed-array.some");
|
715 |
|
716 | require("core-js/modules/es.typed-array.sort");
|
717 |
|
718 | require("core-js/modules/es.typed-array.subarray");
|
719 |
|
720 | require("core-js/modules/es.typed-array.to-locale-string");
|
721 |
|
722 | require("core-js/modules/es.typed-array.to-string");
|
723 |
|
724 | var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
725 |
|
726 | require("regenerator-runtime/runtime");
|
727 |
|
728 | var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
729 |
|
730 |
|
731 | var util = require('util');
|
732 |
|
733 | var path = require('path');
|
734 |
|
735 | var mime = require('mime');
|
736 |
|
737 | var copy = require('copy-to');
|
738 |
|
739 | var _require = require('../common/utils/isBlob'),
|
740 | isBlob = _require.isBlob;
|
741 |
|
742 | var _require2 = require('../common/utils/isFile'),
|
743 | isFile = _require2.isFile;
|
744 |
|
745 | var _require3 = require('../common/utils/isArray'),
|
746 | isArray = _require3.isArray;
|
747 |
|
748 | var _require4 = require('../common/utils/isBuffer'),
|
749 | isBuffer = _require4.isBuffer;
|
750 |
|
751 | var proto = exports;
|
752 |
|
753 |
|
754 |
|
755 |
|
756 |
|
757 |
|
758 |
|
759 |
|
760 |
|
761 |
|
762 |
|
763 |
|
764 |
|
765 |
|
766 |
|
767 |
|
768 |
|
769 |
|
770 |
|
771 |
|
772 |
|
773 | proto.multipartUpload = function () {
|
774 | var _multipartUpload = (0, _asyncToGenerator2.default)( _regenerator.default.mark(function _callee(name, file) {
|
775 | var options,
|
776 | minPartSize,
|
777 | fileSize,
|
778 | result,
|
779 | ret,
|
780 | initResult,
|
781 | uploadId,
|
782 | partSize,
|
783 | checkpoint,
|
784 | _args = arguments;
|
785 | return _regenerator.default.wrap(function _callee$(_context) {
|
786 | while (1) {
|
787 | switch (_context.prev = _context.next) {
|
788 | case 0:
|
789 | options = _args.length > 2 && _args[2] !== undefined ? _args[2] : {};
|
790 | this.resetCancelFlag();
|
791 |
|
792 | if (!(options.checkpoint && options.checkpoint.uploadId)) {
|
793 | _context.next = 7;
|
794 | break;
|
795 | }
|
796 |
|
797 | if (file && isFile(file)) options.checkpoint.file = file;
|
798 | _context.next = 6;
|
799 | return this._resumeMultipart(options.checkpoint, options);
|
800 |
|
801 | case 6:
|
802 | return _context.abrupt("return", _context.sent);
|
803 |
|
804 | case 7:
|
805 | minPartSize = 100 * 1024;
|
806 |
|
807 | if (!options.mime) {
|
808 | if (isFile(file)) {
|
809 | options.mime = mime.getType(path.extname(file.name));
|
810 | } else if (isBlob(file)) {
|
811 | options.mime = file.type;
|
812 | } else if (isBuffer(file)) {
|
813 | options.mime = '';
|
814 | } else {
|
815 | options.mime = mime.getType(path.extname(file));
|
816 | }
|
817 | }
|
818 |
|
819 | options.headers = options.headers || {};
|
820 |
|
821 | this._convertMetaToHeaders(options.meta, options.headers);
|
822 |
|
823 | _context.next = 13;
|
824 | return this._getFileSize(file);
|
825 |
|
826 | case 13:
|
827 | fileSize = _context.sent;
|
828 |
|
829 | if (!(fileSize < minPartSize)) {
|
830 | _context.next = 25;
|
831 | break;
|
832 | }
|
833 |
|
834 | options.contentLength = fileSize;
|
835 | _context.next = 18;
|
836 | return this.put(name, file, options);
|
837 |
|
838 | case 18:
|
839 | result = _context.sent;
|
840 |
|
841 | if (!(options && options.progress)) {
|
842 | _context.next = 22;
|
843 | break;
|
844 | }
|
845 |
|
846 | _context.next = 22;
|
847 | return options.progress(1);
|
848 |
|
849 | case 22:
|
850 | ret = {
|
851 | res: result.res,
|
852 | bucket: this.options.bucket,
|
853 | name: name,
|
854 | etag: result.res.headers.etag
|
855 | };
|
856 |
|
857 | if (options.headers && options.headers['x-oss-callback'] || options.callback) {
|
858 | ret.data = result.data;
|
859 | }
|
860 |
|
861 | return _context.abrupt("return", ret);
|
862 |
|
863 | case 25:
|
864 | if (!(options.partSize && !(parseInt(options.partSize, 10) === options.partSize))) {
|
865 | _context.next = 27;
|
866 | break;
|
867 | }
|
868 |
|
869 | throw new Error('partSize must be int number');
|
870 |
|
871 | case 27:
|
872 | if (!(options.partSize && options.partSize < minPartSize)) {
|
873 | _context.next = 29;
|
874 | break;
|
875 | }
|
876 |
|
877 | throw new Error("partSize must not be smaller than ".concat(minPartSize));
|
878 |
|
879 | case 29:
|
880 | _context.next = 31;
|
881 | return this.initMultipartUpload(name, options);
|
882 |
|
883 | case 31:
|
884 | initResult = _context.sent;
|
885 | uploadId = initResult.uploadId;
|
886 | partSize = this._getPartSize(fileSize, options.partSize);
|
887 | checkpoint = {
|
888 | file: file,
|
889 | name: name,
|
890 | fileSize: fileSize,
|
891 | partSize: partSize,
|
892 | uploadId: uploadId,
|
893 | doneParts: []
|
894 | };
|
895 |
|
896 | if (!(options && options.progress)) {
|
897 | _context.next = 38;
|
898 | break;
|
899 | }
|
900 |
|
901 | _context.next = 38;
|
902 | return options.progress(0, checkpoint, initResult.res);
|
903 |
|
904 | case 38:
|
905 | _context.next = 40;
|
906 | return this._resumeMultipart(checkpoint, options);
|
907 |
|
908 | case 40:
|
909 | return _context.abrupt("return", _context.sent);
|
910 |
|
911 | case 41:
|
912 | case "end":
|
913 | return _context.stop();
|
914 | }
|
915 | }
|
916 | }, _callee, this);
|
917 | }));
|
918 |
|
919 | function multipartUpload(_x, _x2) {
|
920 | return _multipartUpload.apply(this, arguments);
|
921 | }
|
922 |
|
923 | return multipartUpload;
|
924 | }();
|
925 |
|
926 |
|
927 |
|
928 |
|
929 |
|
930 |
|
931 |
|
932 |
|
933 | proto._resumeMultipart = function () {
|
934 | var _resumeMultipart2 = (0, _asyncToGenerator2.default)( _regenerator.default.mark(function _callee3(checkpoint, options) {
|
935 | var that, file, fileSize, partSize, uploadId, doneParts, name, internalDoneParts, partOffs, numParts, multipartFinish, uploadPartJob, all, done, todo, defaultParallel, parallel, jobErr, abortEvent;
|
936 | return _regenerator.default.wrap(function _callee3$(_context3) {
|
937 | while (1) {
|
938 | switch (_context3.prev = _context3.next) {
|
939 | case 0:
|
940 | that = this;
|
941 |
|
942 | if (!this.isCancel()) {
|
943 | _context3.next = 3;
|
944 | break;
|
945 | }
|
946 |
|
947 | throw this._makeCancelEvent();
|
948 |
|
949 | case 3:
|
950 | file = checkpoint.file, fileSize = checkpoint.fileSize, partSize = checkpoint.partSize, uploadId = checkpoint.uploadId, doneParts = checkpoint.doneParts, name = checkpoint.name;
|
951 | internalDoneParts = [];
|
952 |
|
953 | if (doneParts.length > 0) {
|
954 | copy(doneParts).to(internalDoneParts);
|
955 | }
|
956 |
|
957 | partOffs = this._divideParts(fileSize, partSize);
|
958 | numParts = partOffs.length;
|
959 | multipartFinish = false;
|
960 |
|
961 | uploadPartJob = function uploadPartJob(self, partNo) {
|
962 |
|
963 | return new Promise( function () {
|
964 | var _ref = (0, _asyncToGenerator2.default)( _regenerator.default.mark(function _callee2(resolve, reject) {
|
965 | var pi, stream, data, removeStreamFromMultipartUploadStreams, result, tempErr;
|
966 | return _regenerator.default.wrap(function _callee2$(_context2) {
|
967 | while (1) {
|
968 | switch (_context2.prev = _context2.next) {
|
969 | case 0:
|
970 | _context2.prev = 0;
|
971 |
|
972 | if (self.isCancel()) {
|
973 | _context2.next = 33;
|
974 | break;
|
975 | }
|
976 |
|
977 | pi = partOffs[partNo - 1];
|
978 | stream = self._createStream(file, pi.start, pi.end);
|
979 | data = {
|
980 | stream: stream,
|
981 | size: pi.end - pi.start
|
982 | };
|
983 |
|
984 | if (isArray(self.multipartUploadStreams)) {
|
985 | self.multipartUploadStreams.push(stream);
|
986 | } else {
|
987 | self.multipartUploadStreams = [stream];
|
988 | }
|
989 |
|
990 | removeStreamFromMultipartUploadStreams = function removeStreamFromMultipartUploadStreams() {
|
991 | if (!stream.destroyed) {
|
992 | stream.destroy();
|
993 | }
|
994 |
|
995 | var index = self.multipartUploadStreams.indexOf(stream);
|
996 |
|
997 | if (index !== -1) {
|
998 | self.multipartUploadStreams.splice(index, 1);
|
999 | }
|
1000 | };
|
1001 |
|
1002 | stream.on('close', removeStreamFromMultipartUploadStreams);
|
1003 | stream.on('end', removeStreamFromMultipartUploadStreams);
|
1004 | stream.on('error', removeStreamFromMultipartUploadStreams);
|
1005 | _context2.prev = 10;
|
1006 | _context2.next = 13;
|
1007 | return self._uploadPart(name, uploadId, partNo, data);
|
1008 |
|
1009 | case 13:
|
1010 | result = _context2.sent;
|
1011 | _context2.next = 22;
|
1012 | break;
|
1013 |
|
1014 | case 16:
|
1015 | _context2.prev = 16;
|
1016 | _context2.t0 = _context2["catch"](10);
|
1017 | removeStreamFromMultipartUploadStreams();
|
1018 |
|
1019 | if (!(_context2.t0.status === 404)) {
|
1020 | _context2.next = 21;
|
1021 | break;
|
1022 | }
|
1023 |
|
1024 | throw self._makeAbortEvent();
|
1025 |
|
1026 | case 21:
|
1027 | throw _context2.t0;
|
1028 |
|
1029 | case 22:
|
1030 | if (!(!self.isCancel() && !multipartFinish)) {
|
1031 | _context2.next = 30;
|
1032 | break;
|
1033 | }
|
1034 |
|
1035 | checkpoint.doneParts.push({
|
1036 | number: partNo,
|
1037 | etag: result.res.headers.etag
|
1038 | });
|
1039 |
|
1040 | if (!options.progress) {
|
1041 | _context2.next = 27;
|
1042 | break;
|
1043 | }
|
1044 |
|
1045 | _context2.next = 27;
|
1046 | return options.progress(doneParts.length / numParts, checkpoint, result.res);
|
1047 |
|
1048 | case 27:
|
1049 | resolve({
|
1050 | number: partNo,
|
1051 | etag: result.res.headers.etag
|
1052 | });
|
1053 | _context2.next = 31;
|
1054 | break;
|
1055 |
|
1056 | case 30:
|
1057 | resolve();
|
1058 |
|
1059 | case 31:
|
1060 | _context2.next = 34;
|
1061 | break;
|
1062 |
|
1063 | case 33:
|
1064 | resolve();
|
1065 |
|
1066 | case 34:
|
1067 | _context2.next = 45;
|
1068 | break;
|
1069 |
|
1070 | case 36:
|
1071 | _context2.prev = 36;
|
1072 | _context2.t1 = _context2["catch"](0);
|
1073 | tempErr = new Error();
|
1074 | tempErr.name = _context2.t1.name;
|
1075 | tempErr.message = _context2.t1.message;
|
1076 | tempErr.stack = _context2.t1.stack;
|
1077 | tempErr.partNum = partNo;
|
1078 | copy(_context2.t1).to(tempErr);
|
1079 | reject(tempErr);
|
1080 |
|
1081 | case 45:
|
1082 | case "end":
|
1083 | return _context2.stop();
|
1084 | }
|
1085 | }
|
1086 | }, _callee2, null, [[0, 36], [10, 16]]);
|
1087 | }));
|
1088 |
|
1089 | return function (_x5, _x6) {
|
1090 | return _ref.apply(this, arguments);
|
1091 | };
|
1092 | }());
|
1093 | };
|
1094 |
|
1095 | all = Array.from(new Array(numParts), function (x, i) {
|
1096 | return i + 1;
|
1097 | });
|
1098 | done = internalDoneParts.map(function (p) {
|
1099 | return p.number;
|
1100 | });
|
1101 | todo = all.filter(function (p) {
|
1102 | return done.indexOf(p) < 0;
|
1103 | });
|
1104 | defaultParallel = 5;
|
1105 | parallel = options.parallel || defaultParallel;
|
1106 |
|
1107 | _context3.next = 17;
|
1108 | return this._parallel(todo, parallel, function (value) {
|
1109 | return new Promise(function (resolve, reject) {
|
1110 | uploadPartJob(that, value).then(function (result) {
|
1111 | if (result) {
|
1112 | internalDoneParts.push(result);
|
1113 | }
|
1114 |
|
1115 | resolve();
|
1116 | }).catch(function (err) {
|
1117 | reject(err);
|
1118 | });
|
1119 | });
|
1120 | });
|
1121 |
|
1122 | case 17:
|
1123 | jobErr = _context3.sent;
|
1124 | multipartFinish = true;
|
1125 | abortEvent = jobErr.find(function (err) {
|
1126 | return err.name === 'abort';
|
1127 | });
|
1128 |
|
1129 | if (!abortEvent) {
|
1130 | _context3.next = 22;
|
1131 | break;
|
1132 | }
|
1133 |
|
1134 | throw abortEvent;
|
1135 |
|
1136 | case 22:
|
1137 | if (!this.isCancel()) {
|
1138 | _context3.next = 25;
|
1139 | break;
|
1140 | }
|
1141 |
|
1142 | uploadPartJob = null;
|
1143 | throw this._makeCancelEvent();
|
1144 |
|
1145 | case 25:
|
1146 | if (!(jobErr && jobErr.length > 0)) {
|
1147 | _context3.next = 28;
|
1148 | break;
|
1149 | }
|
1150 |
|
1151 | jobErr[0].message = "Failed to upload some parts with error: ".concat(jobErr[0].toString(), " part_num: ").concat(jobErr[0].partNum);
|
1152 | throw jobErr[0];
|
1153 |
|
1154 | case 28:
|
1155 | _context3.next = 30;
|
1156 | return this.completeMultipartUpload(name, uploadId, internalDoneParts, options);
|
1157 |
|
1158 | case 30:
|
1159 | return _context3.abrupt("return", _context3.sent);
|
1160 |
|
1161 | case 31:
|
1162 | case "end":
|
1163 | return _context3.stop();
|
1164 | }
|
1165 | }
|
1166 | }, _callee3, this);
|
1167 | }));
|
1168 |
|
1169 | function _resumeMultipart(_x3, _x4) {
|
1170 | return _resumeMultipart2.apply(this, arguments);
|
1171 | }
|
1172 |
|
1173 | return _resumeMultipart;
|
1174 | }();
|
1175 |
|
1176 |
|
1177 |
|
1178 |
|
1179 |
|
1180 | proto._getFileSize = function () {
|
1181 | var _getFileSize2 = (0, _asyncToGenerator2.default)( _regenerator.default.mark(function _callee4(file) {
|
1182 | return _regenerator.default.wrap(function _callee4$(_context4) {
|
1183 | while (1) {
|
1184 | switch (_context4.prev = _context4.next) {
|
1185 | case 0:
|
1186 | if (!isBuffer(file)) {
|
1187 | _context4.next = 4;
|
1188 | break;
|
1189 | }
|
1190 |
|
1191 | return _context4.abrupt("return", file.length);
|
1192 |
|
1193 | case 4:
|
1194 | if (!(isBlob(file) || isFile(file))) {
|
1195 | _context4.next = 6;
|
1196 | break;
|
1197 | }
|
1198 |
|
1199 | return _context4.abrupt("return", file.size);
|
1200 |
|
1201 | case 6:
|
1202 | throw new Error('_getFileSize requires Buffer/File/Blob.');
|
1203 |
|
1204 | case 7:
|
1205 | case "end":
|
1206 | return _context4.stop();
|
1207 | }
|
1208 | }
|
1209 | }, _callee4);
|
1210 | }));
|
1211 |
|
1212 | function _getFileSize(_x7) {
|
1213 | return _getFileSize2.apply(this, arguments);
|
1214 | }
|
1215 |
|
1216 | return _getFileSize;
|
1217 | }();
|
1218 |
|
1219 |
|
1220 |
|
1221 |
|
1222 |
|
1223 | var _require5 = require('stream'),
|
1224 | Readable = _require5.Readable;
|
1225 |
|
1226 | function WebFileReadStream(file, options) {
|
1227 | if (!(this instanceof WebFileReadStream)) {
|
1228 | return new WebFileReadStream(file, options);
|
1229 | }
|
1230 |
|
1231 | Readable.call(this, options);
|
1232 | this.file = file;
|
1233 | this.reader = new FileReader();
|
1234 | this.start = 0;
|
1235 | this.finish = false;
|
1236 | this.fileBuffer = null;
|
1237 | }
|
1238 |
|
1239 | util.inherits(WebFileReadStream, Readable);
|
1240 |
|
1241 | WebFileReadStream.prototype.readFileAndPush = function readFileAndPush(size) {
|
1242 | if (this.fileBuffer) {
|
1243 | var pushRet = true;
|
1244 |
|
1245 | while (pushRet && this.fileBuffer && this.start < this.fileBuffer.length) {
|
1246 | var start = this.start;
|
1247 | var end = start + size;
|
1248 | end = end > this.fileBuffer.length ? this.fileBuffer.length : end;
|
1249 | this.start = end;
|
1250 | pushRet = this.push(this.fileBuffer.slice(start, end));
|
1251 | }
|
1252 | }
|
1253 | };
|
1254 |
|
1255 | WebFileReadStream.prototype._read = function _read(size) {
|
1256 | if (this.file && this.start >= this.file.size || this.fileBuffer && this.start >= this.fileBuffer.length || this.finish || this.start === 0 && !this.file) {
|
1257 | if (!this.finish) {
|
1258 | this.fileBuffer = null;
|
1259 | this.finish = true;
|
1260 | }
|
1261 |
|
1262 | this.push(null);
|
1263 | return;
|
1264 | }
|
1265 |
|
1266 | var defaultReadSize = 16 * 1024;
|
1267 | size = size || defaultReadSize;
|
1268 | var that = this;
|
1269 |
|
1270 | this.reader.onload = function onload(e) {
|
1271 | that.fileBuffer = Buffer.from(new Uint8Array(e.target.result));
|
1272 | that.file = null;
|
1273 | that.readFileAndPush(size);
|
1274 | };
|
1275 |
|
1276 | if (this.start === 0) {
|
1277 | this.reader.readAsArrayBuffer(this.file);
|
1278 | } else {
|
1279 | this.readFileAndPush(size);
|
1280 | }
|
1281 | };
|
1282 |
|
1283 | proto._createStream = function _createStream(file, start, end) {
|
1284 | if (isBlob(file) || isFile(file)) {
|
1285 | return new WebFileReadStream(file.slice(start, end));
|
1286 | } else if (isBuffer(file)) {
|
1287 |
|
1288 | var iterable = file.subarray(start, end);
|
1289 | return new Readable({
|
1290 | read: function read() {
|
1291 | this.push(iterable);
|
1292 | this.push(null);
|
1293 | }
|
1294 | });
|
1295 | }
|
1296 |
|
1297 | throw new Error('_createStream requires Buffer/File/Blob.');
|
1298 | };
|
1299 |
|
1300 | proto._getPartSize = function _getPartSize(fileSize, partSize) {
|
1301 | var maxNumParts = 10 * 1000;
|
1302 | var defaultPartSize = 1 * 1024 * 1024;
|
1303 | if (!partSize) partSize = defaultPartSize;
|
1304 | var safeSize = Math.ceil(fileSize / maxNumParts);
|
1305 |
|
1306 | if (partSize < safeSize) {
|
1307 | partSize = safeSize;
|
1308 | console.warn("partSize has been set to ".concat(partSize, ", because the partSize you provided causes partNumber to be greater than 10,000"));
|
1309 | }
|
1310 |
|
1311 | return partSize;
|
1312 | };
|
1313 |
|
1314 | proto._divideParts = function _divideParts(fileSize, partSize) {
|
1315 | var numParts = Math.ceil(fileSize / partSize);
|
1316 | var partOffs = [];
|
1317 |
|
1318 | for (var i = 0; i < numParts; i++) {
|
1319 | var start = partSize * i;
|
1320 | var end = Math.min(start + partSize, fileSize);
|
1321 | partOffs.push({
|
1322 | start: start,
|
1323 | end: end
|
1324 | });
|
1325 | }
|
1326 |
|
1327 | return partOffs;
|
1328 | };
|
1329 |
|
1330 | }).call(this,require("buffer").Buffer)
|
1331 | },{"../common/utils/isArray":59,"../common/utils/isBlob":60,"../common/utils/isBuffer":61,"../common/utils/isFile":62,"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"buffer":98,"copy-to":101,"core-js/modules/es.array-buffer.slice":233,"core-js/modules/es.array.concat":234,"core-js/modules/es.array.filter":236,"core-js/modules/es.array.find":237,"core-js/modules/es.array.from":239,"core-js/modules/es.array.index-of":241,"core-js/modules/es.array.iterator":242,"core-js/modules/es.array.map":245,"core-js/modules/es.array.slice":246,"core-js/modules/es.array.splice":248,"core-js/modules/es.function.name":249,"core-js/modules/es.object.to-string":254,"core-js/modules/es.promise":255,"core-js/modules/es.regexp.to-string":257,"core-js/modules/es.string.iterator":259,"core-js/modules/es.typed-array.copy-within":268,"core-js/modules/es.typed-array.every":269,"core-js/modules/es.typed-array.fill":270,"core-js/modules/es.typed-array.filter":271,"core-js/modules/es.typed-array.find":273,"core-js/modules/es.typed-array.find-index":272,"core-js/modules/es.typed-array.for-each":274,"core-js/modules/es.typed-array.includes":275,"core-js/modules/es.typed-array.index-of":276,"core-js/modules/es.typed-array.iterator":277,"core-js/modules/es.typed-array.join":278,"core-js/modules/es.typed-array.last-index-of":279,"core-js/modules/es.typed-array.map":280,"core-js/modules/es.typed-array.reduce":282,"core-js/modules/es.typed-array.reduce-right":281,"core-js/modules/es.typed-array.reverse":283,"core-js/modules/es.typed-array.set":284,"core-js/modules/es.typed-array.slice":285,"core-js/modules/es.typed-array.some":286,"core-js/modules/es.typed-array.sort":287,"core-js/modules/es.typed-array.subarray":288,"core-js/modules/es.typed-array.to-locale-string":289,"core-js/modules/es.typed-array.to-string":290,"core-js/modules/es.typed-array.uint8-array":291,"mime":313,"path":316,"regenerator-runtime/runtime":337,"stream":340,"util":346}],4:[function(require,module,exports){
|
1332 | "use strict";
|
1333 |
|
1334 | var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
1335 |
|
1336 | require("core-js/modules/es.array.for-each");
|
1337 |
|
1338 | require("core-js/modules/es.array.map");
|
1339 |
|
1340 | require("core-js/modules/es.function.name");
|
1341 |
|
1342 | require("core-js/modules/es.number.constructor");
|
1343 |
|
1344 | require("core-js/modules/es.object.assign");
|
1345 |
|
1346 | require("core-js/modules/es.object.keys");
|
1347 |
|
1348 | require("core-js/modules/es.object.to-string");
|
1349 |
|
1350 | require("core-js/modules/es.promise");
|
1351 |
|
1352 | require("core-js/modules/es.regexp.exec");
|
1353 |
|
1354 | require("core-js/modules/es.regexp.to-string");
|
1355 |
|
1356 | require("core-js/modules/es.string.replace");
|
1357 |
|
1358 | require("core-js/modules/web.dom-collections.for-each");
|
1359 |
|
1360 | var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
1361 |
|
1362 | require("regenerator-runtime/runtime");
|
1363 |
|
1364 | var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
1365 |
|
1366 |
|
1367 | var fs = require('fs');
|
1368 |
|
1369 | var copy = require('copy-to');
|
1370 |
|
1371 | var path = require('path');
|
1372 |
|
1373 | var mime = require('mime');
|
1374 |
|
1375 | var is = require('is-type-of');
|
1376 |
|
1377 | var callback = require('../common/callback');
|
1378 |
|
1379 | var merge = require('merge-descriptors');
|
1380 |
|
1381 | var _require = require('../common/utils/isBlob'),
|
1382 | isBlob = _require.isBlob;
|
1383 |
|
1384 | var _require2 = require('../common/utils/isFile'),
|
1385 | isFile = _require2.isFile;
|
1386 |
|
1387 | var _require3 = require('../common/utils/isBuffer'),
|
1388 | isBuffer = _require3.isBuffer;
|
1389 |
|
1390 |
|
1391 | var proto = exports;
|
1392 |
|
1393 |
|
1394 |
|
1395 |
|
1396 |
|
1397 |
|
1398 |
|
1399 |
|
1400 |
|
1401 |
|
1402 |
|
1403 |
|
1404 | proto.append = function () {
|
1405 | var _append = (0, _asyncToGenerator2.default)( _regenerator.default.mark(function _callee(name, file, options) {
|
1406 | var result;
|
1407 | return _regenerator.default.wrap(function _callee$(_context) {
|
1408 | while (1) {
|
1409 | switch (_context.prev = _context.next) {
|
1410 | case 0:
|
1411 | options = options || {};
|
1412 | if (options.position === undefined) options.position = '0';
|
1413 | options.subres = {
|
1414 | append: '',
|
1415 | position: options.position
|
1416 | };
|
1417 | options.method = 'POST';
|
1418 | _context.next = 6;
|
1419 | return this.put(name, file, options);
|
1420 |
|
1421 | case 6:
|
1422 | result = _context.sent;
|
1423 | result.nextAppendPosition = result.res.headers['x-oss-next-append-position'];
|
1424 | return _context.abrupt("return", result);
|
1425 |
|
1426 | case 9:
|
1427 | case "end":
|
1428 | return _context.stop();
|
1429 | }
|
1430 | }
|
1431 | }, _callee, this);
|
1432 | }));
|
1433 |
|
1434 | function append(_x, _x2, _x3) {
|
1435 | return _append.apply(this, arguments);
|
1436 | }
|
1437 |
|
1438 | return append;
|
1439 | }();
|
1440 |
|
1441 |
|
1442 |
|
1443 |
|
1444 |
|
1445 |
|
1446 |
|
1447 |
|
1448 |
|
1449 |
|
1450 |
|
1451 |
|
1452 |
|
1453 |
|
1454 |
|
1455 |
|
1456 |
|
1457 |
|
1458 |
|
1459 | proto.put = function () {
|
1460 | var _put = (0, _asyncToGenerator2.default)( _regenerator.default.mark(function _callee2(name, file, options) {
|
1461 | var content, stream, _result, method, params, result, ret;
|
1462 |
|
1463 | return _regenerator.default.wrap(function _callee2$(_context2) {
|
1464 | while (1) {
|
1465 | switch (_context2.prev = _context2.next) {
|
1466 | case 0:
|
1467 | options = options || {};
|
1468 | name = this._objectName(name);
|
1469 |
|
1470 | if (!isBuffer(file)) {
|
1471 | _context2.next = 6;
|
1472 | break;
|
1473 | }
|
1474 |
|
1475 | content = file;
|
1476 | _context2.next = 32;
|
1477 | break;
|
1478 |
|
1479 | case 6:
|
1480 | if (!(isBlob(file) || isFile(file))) {
|
1481 | _context2.next = 31;
|
1482 | break;
|
1483 | }
|
1484 |
|
1485 | if (!options.mime) {
|
1486 | if (isFile(file)) {
|
1487 | options.mime = mime.getType(path.extname(file.name));
|
1488 | } else {
|
1489 | options.mime = file.type;
|
1490 | }
|
1491 | }
|
1492 |
|
1493 | stream = this._createStream(file, 0, file.size);
|
1494 | _context2.next = 11;
|
1495 | return this._getFileSize(file);
|
1496 |
|
1497 | case 11:
|
1498 | options.contentLength = _context2.sent;
|
1499 | _context2.prev = 12;
|
1500 | _context2.next = 15;
|
1501 | return this.putStream(name, stream, options);
|
1502 |
|
1503 | case 15:
|
1504 | _result = _context2.sent;
|
1505 | return _context2.abrupt("return", _result);
|
1506 |
|
1507 | case 19:
|
1508 | _context2.prev = 19;
|
1509 | _context2.t0 = _context2["catch"](12);
|
1510 |
|
1511 | if (!(_context2.t0.code === 'RequestTimeTooSkewed')) {
|
1512 | _context2.next = 28;
|
1513 | break;
|
1514 | }
|
1515 |
|
1516 | this.options.amendTimeSkewed = +new Date(_context2.t0.serverTime) - new Date();
|
1517 | _context2.next = 25;
|
1518 | return this.put(name, file, options);
|
1519 |
|
1520 | case 25:
|
1521 | return _context2.abrupt("return", _context2.sent);
|
1522 |
|
1523 | case 28:
|
1524 | throw _context2.t0;
|
1525 |
|
1526 | case 29:
|
1527 | _context2.next = 32;
|
1528 | break;
|
1529 |
|
1530 | case 31:
|
1531 | throw new TypeError('Must provide Buffer/Blob/File for put.');
|
1532 |
|
1533 | case 32:
|
1534 | options.headers = options.headers || {};
|
1535 |
|
1536 | this._convertMetaToHeaders(options.meta, options.headers);
|
1537 |
|
1538 | method = options.method || 'PUT';
|
1539 | params = this._objectRequestParams(method, name, options);
|
1540 | callback.encodeCallback(params, options);
|
1541 | params.mime = options.mime;
|
1542 | params.content = content;
|
1543 | params.successStatuses = [200];
|
1544 | _context2.next = 42;
|
1545 | return this.request(params);
|
1546 |
|
1547 | case 42:
|
1548 | result = _context2.sent;
|
1549 | ret = {
|
1550 | name: name,
|
1551 | url: this._objectUrl(name),
|
1552 | res: result.res
|
1553 | };
|
1554 |
|
1555 | if (params.headers && params.headers['x-oss-callback']) {
|
1556 | ret.data = JSON.parse(result.data.toString());
|
1557 | }
|
1558 |
|
1559 | return _context2.abrupt("return", ret);
|
1560 |
|
1561 | case 46:
|
1562 | case "end":
|
1563 | return _context2.stop();
|
1564 | }
|
1565 | }
|
1566 | }, _callee2, this, [[12, 19]]);
|
1567 | }));
|
1568 |
|
1569 | function put(_x4, _x5, _x6) {
|
1570 | return _put.apply(this, arguments);
|
1571 | }
|
1572 |
|
1573 | return put;
|
1574 | }();
|
1575 |
|
1576 |
|
1577 |
|
1578 |
|
1579 |
|
1580 |
|
1581 |
|
1582 |
|
1583 |
|
1584 |
|
1585 | proto.putStream = function () {
|
1586 | var _putStream = (0, _asyncToGenerator2.default)( _regenerator.default.mark(function _callee3(name, stream, options) {
|
1587 | var method, params, result, ret;
|
1588 | return _regenerator.default.wrap(function _callee3$(_context3) {
|
1589 | while (1) {
|
1590 | switch (_context3.prev = _context3.next) {
|
1591 | case 0:
|
1592 | options = options || {};
|
1593 | options.headers = options.headers || {};
|
1594 | name = this._objectName(name);
|
1595 |
|
1596 | if (options.contentLength) {
|
1597 | options.headers['Content-Length'] = options.contentLength;
|
1598 | } else {
|
1599 | options.headers['Transfer-Encoding'] = 'chunked';
|
1600 | }
|
1601 |
|
1602 | this._convertMetaToHeaders(options.meta, options.headers);
|
1603 |
|
1604 | method = options.method || 'PUT';
|
1605 | params = this._objectRequestParams(method, name, options);
|
1606 | callback.encodeCallback(params, options);
|
1607 | params.mime = options.mime;
|
1608 | params.stream = stream;
|
1609 | params.successStatuses = [200];
|
1610 | _context3.next = 13;
|
1611 | return this.request(params);
|
1612 |
|
1613 | case 13:
|
1614 | result = _context3.sent;
|
1615 | ret = {
|
1616 | name: name,
|
1617 | url: this._objectUrl(name),
|
1618 | res: result.res
|
1619 | };
|
1620 |
|
1621 | if (params.headers && params.headers['x-oss-callback']) {
|
1622 | ret.data = JSON.parse(result.data.toString());
|
1623 | }
|
1624 |
|
1625 | return _context3.abrupt("return", ret);
|
1626 |
|
1627 | case 17:
|
1628 | case "end":
|
1629 | return _context3.stop();
|
1630 | }
|
1631 | }
|
1632 | }, _callee3, this);
|
1633 | }));
|
1634 |
|
1635 | function putStream(_x7, _x8, _x9) {
|
1636 | return _putStream.apply(this, arguments);
|
1637 | }
|
1638 |
|
1639 | return putStream;
|
1640 | }();
|
1641 |
|
1642 | merge(proto, require('../common/object/copyObject'));
|
1643 | merge(proto, require('../common/object/getObjectTagging'));
|
1644 | merge(proto, require('../common/object/putObjectTagging'));
|
1645 | merge(proto, require('../common/object/deleteObjectTagging'));
|
1646 | merge(proto, require('../common/image'));
|
1647 | merge(proto, require('../common/object/getBucketVersions'));
|
1648 | merge(proto, require('../common/object/getACL'));
|
1649 | merge(proto, require('../common/object/putACL'));
|
1650 | merge(proto, require('../common/object/head'));
|
1651 | merge(proto, require('../common/object/delete'));
|
1652 | merge(proto, require('../common/object/get'));
|
1653 | merge(proto, require('../common/object/putSymlink'));
|
1654 | merge(proto, require('../common/object/getSymlink'));
|
1655 | merge(proto, require('../common/object/deleteMulti'));
|
1656 | merge(proto, require('../common/object/getObjectMeta'));
|
1657 | merge(proto, require('../common/object/getObjectUrl'));
|
1658 | merge(proto, require('../common/object/generateObjectUrl'));
|
1659 | merge(proto, require('../common/object/signatureUrl'));
|
1660 |
|
1661 | proto.putMeta = function () {
|
1662 | var _putMeta = (0, _asyncToGenerator2.default)( _regenerator.default.mark(function _callee4(name, meta, options) {
|
1663 | var copyResult;
|
1664 | return _regenerator.default.wrap(function _callee4$(_context4) {
|
1665 | while (1) {
|
1666 | switch (_context4.prev = _context4.next) {
|
1667 | case 0:
|
1668 | _context4.next = 2;
|
1669 | return this.copy(name, name, {
|
1670 | meta: meta || {},
|
1671 | timeout: options && options.timeout,
|
1672 | ctx: options && options.ctx
|
1673 | });
|
1674 |
|
1675 | case 2:
|
1676 | copyResult = _context4.sent;
|
1677 | return _context4.abrupt("return", copyResult);
|
1678 |
|
1679 | case 4:
|
1680 | case "end":
|
1681 | return _context4.stop();
|
1682 | }
|
1683 | }
|
1684 | }, _callee4, this);
|
1685 | }));
|
1686 |
|
1687 | function putMeta(_x10, _x11, _x12) {
|
1688 | return _putMeta.apply(this, arguments);
|
1689 | }
|
1690 |
|
1691 | return putMeta;
|
1692 | }();
|
1693 |
|
1694 | proto.list = function () {
|
1695 | var _list = (0, _asyncToGenerator2.default)( _regenerator.default.mark(function _callee5(query, options) {
|
1696 | var params, result, objects, that, prefixes;
|
1697 | return _regenerator.default.wrap(function _callee5$(_context5) {
|
1698 | while (1) {
|
1699 | switch (_context5.prev = _context5.next) {
|
1700 | case 0:
|
1701 |
|
1702 | params = this._objectRequestParams('GET', '', options);
|
1703 | params.query = query;
|
1704 | params.xmlResponse = true;
|
1705 | params.successStatuses = [200];
|
1706 | _context5.next = 6;
|
1707 | return this.request(params);
|
1708 |
|
1709 | case 6:
|
1710 | result = _context5.sent;
|
1711 | objects = result.data.Contents;
|
1712 | that = this;
|
1713 |
|
1714 | if (objects) {
|
1715 | if (!Array.isArray(objects)) {
|
1716 | objects = [objects];
|
1717 | }
|
1718 |
|
1719 | objects = objects.map(function (obj) {
|
1720 | return {
|
1721 | name: obj.Key,
|
1722 | url: that._objectUrl(obj.Key),
|
1723 | lastModified: obj.LastModified,
|
1724 | etag: obj.ETag,
|
1725 | type: obj.Type,
|
1726 | size: Number(obj.Size),
|
1727 | storageClass: obj.StorageClass,
|
1728 | owner: {
|
1729 | id: obj.Owner.ID,
|
1730 | displayName: obj.Owner.DisplayName
|
1731 | }
|
1732 | };
|
1733 | });
|
1734 | }
|
1735 |
|
1736 | prefixes = result.data.CommonPrefixes || null;
|
1737 |
|
1738 | if (prefixes) {
|
1739 | if (!Array.isArray(prefixes)) {
|
1740 | prefixes = [prefixes];
|
1741 | }
|
1742 |
|
1743 | prefixes = prefixes.map(function (item) {
|
1744 | return item.Prefix;
|
1745 | });
|
1746 | }
|
1747 |
|
1748 | return _context5.abrupt("return", {
|
1749 | res: result.res,
|
1750 | objects: objects,
|
1751 | prefixes: prefixes,
|
1752 | nextMarker: result.data.NextMarker || null,
|
1753 | isTruncated: result.data.IsTruncated === 'true'
|
1754 | });
|
1755 |
|
1756 | case 13:
|
1757 | case "end":
|
1758 | return _context5.stop();
|
1759 | }
|
1760 | }
|
1761 | }, _callee5, this);
|
1762 | }));
|
1763 |
|
1764 | function list(_x13, _x14) {
|
1765 | return _list.apply(this, arguments);
|
1766 | }
|
1767 |
|
1768 | return list;
|
1769 | }();
|
1770 |
|
1771 | proto.listV2 = function () {
|
1772 | var _listV = (0, _asyncToGenerator2.default)( _regenerator.default.mark(function _callee6(query) {
|
1773 | var options,
|
1774 | continuation_token,
|
1775 | params,
|
1776 | result,
|
1777 | objects,
|
1778 | that,
|
1779 | prefixes,
|
1780 | _args6 = arguments;
|
1781 | return _regenerator.default.wrap(function _callee6$(_context6) {
|
1782 | while (1) {
|
1783 | switch (_context6.prev = _context6.next) {
|
1784 | case 0:
|
1785 | options = _args6.length > 1 && _args6[1] !== undefined ? _args6[1] : {};
|
1786 | continuation_token = query['continuation-token'] || query.continuationToken;
|
1787 | delete query['continuation-token'];
|
1788 | delete query.continuationToken;
|
1789 |
|
1790 | if (continuation_token) {
|
1791 | options.subres = Object.assign({
|
1792 | 'continuation-token': continuation_token
|
1793 | }, options.subres);
|
1794 | }
|
1795 |
|
1796 | params = this._objectRequestParams('GET', '', options);
|
1797 | params.query = Object.assign({
|
1798 | 'list-type': 2
|
1799 | }, query);
|
1800 | params.xmlResponse = true;
|
1801 | params.successStatuses = [200];
|
1802 | _context6.next = 11;
|
1803 | return this.request(params);
|
1804 |
|
1805 | case 11:
|
1806 | result = _context6.sent;
|
1807 | objects = result.data.Contents;
|
1808 | that = this;
|
1809 |
|
1810 | if (objects) {
|
1811 | if (!Array.isArray(objects)) {
|
1812 | objects = [objects];
|
1813 | }
|
1814 |
|
1815 | objects = objects.map(function (obj) {
|
1816 | return {
|
1817 | name: obj.Key,
|
1818 | url: that._objectUrl(obj.Key),
|
1819 | lastModified: obj.LastModified,
|
1820 | etag: obj.ETag,
|
1821 | type: obj.Type,
|
1822 | size: Number(obj.Size),
|
1823 | storageClass: obj.StorageClass,
|
1824 | owner: obj.Owner ? {
|
1825 | id: obj.Owner.ID,
|
1826 | displayName: obj.Owner.DisplayName
|
1827 | } : null
|
1828 | };
|
1829 | });
|
1830 | }
|
1831 |
|
1832 | prefixes = result.data.CommonPrefixes || null;
|
1833 |
|
1834 | if (prefixes) {
|
1835 | if (!Array.isArray(prefixes)) {
|
1836 | prefixes = [prefixes];
|
1837 | }
|
1838 |
|
1839 | prefixes = prefixes.map(function (item) {
|
1840 | return item.Prefix;
|
1841 | });
|
1842 | }
|
1843 |
|
1844 | return _context6.abrupt("return", {
|
1845 | res: result.res,
|
1846 | objects: objects,
|
1847 | prefixes: prefixes,
|
1848 | isTruncated: result.data.IsTruncated === 'true',
|
1849 | keyCount: +result.data.KeyCount,
|
1850 | continuationToken: result.data.ContinuationToken || null,
|
1851 | nextContinuationToken: result.data.NextContinuationToken || null
|
1852 | });
|
1853 |
|
1854 | case 18:
|
1855 | case "end":
|
1856 | return _context6.stop();
|
1857 | }
|
1858 | }
|
1859 | }, _callee6, this);
|
1860 | }));
|
1861 |
|
1862 | function listV2(_x15) {
|
1863 | return _listV.apply(this, arguments);
|
1864 | }
|
1865 |
|
1866 | return listV2;
|
1867 | }();
|
1868 |
|
1869 |
|
1870 |
|
1871 |
|
1872 |
|
1873 |
|
1874 |
|
1875 |
|
1876 | proto.restore = function () {
|
1877 | var _restore = (0, _asyncToGenerator2.default)( _regenerator.default.mark(function _callee7(name, options) {
|
1878 | var params, result;
|
1879 | return _regenerator.default.wrap(function _callee7$(_context7) {
|
1880 | while (1) {
|
1881 | switch (_context7.prev = _context7.next) {
|
1882 | case 0:
|
1883 | options = options || {};
|
1884 | options.subres = Object.assign({
|
1885 | restore: ''
|
1886 | }, options.subres);
|
1887 |
|
1888 | if (options.versionId) {
|
1889 | options.subres.versionId = options.versionId;
|
1890 | }
|
1891 |
|
1892 | params = this._objectRequestParams('POST', name, options);
|
1893 | params.successStatuses = [202];
|
1894 | _context7.next = 7;
|
1895 | return this.request(params);
|
1896 |
|
1897 | case 7:
|
1898 | result = _context7.sent;
|
1899 | return _context7.abrupt("return", {
|
1900 | res: result.res
|
1901 | });
|
1902 |
|
1903 | case 9:
|
1904 | case "end":
|
1905 | return _context7.stop();
|
1906 | }
|
1907 | }
|
1908 | }, _callee7, this);
|
1909 | }));
|
1910 |
|
1911 | function restore(_x16, _x17) {
|
1912 | return _restore.apply(this, arguments);
|
1913 | }
|
1914 |
|
1915 | return restore;
|
1916 | }();
|
1917 |
|
1918 | proto._objectUrl = function _objectUrl(name) {
|
1919 | return this._getReqUrl({
|
1920 | bucket: this.options.bucket,
|
1921 | object: name
|
1922 | });
|
1923 | };
|
1924 |
|
1925 |
|
1926 |
|
1927 |
|
1928 |
|
1929 |
|
1930 |
|
1931 |
|
1932 | proto._objectRequestParams = function _objectRequestParams(method, name, options) {
|
1933 | if (!this.options.bucket && !this.options.cname) {
|
1934 | throw new Error('Please create a bucket first');
|
1935 | }
|
1936 |
|
1937 | options = options || {};
|
1938 | name = this._objectName(name);
|
1939 | var params = {
|
1940 | object: name,
|
1941 | bucket: this.options.bucket,
|
1942 | method: method,
|
1943 | subres: options && options.subres,
|
1944 | timeout: options && options.timeout,
|
1945 | ctx: options && options.ctx
|
1946 | };
|
1947 |
|
1948 | if (options.headers) {
|
1949 | params.headers = {};
|
1950 | copy(options.headers).to(params.headers);
|
1951 | }
|
1952 |
|
1953 | return params;
|
1954 | };
|
1955 |
|
1956 | proto._objectName = function _objectName(name) {
|
1957 | return name.replace(/^\/+/, '');
|
1958 | };
|
1959 |
|
1960 | proto._convertMetaToHeaders = function _convertMetaToHeaders(meta, headers) {
|
1961 | if (!meta) {
|
1962 | return;
|
1963 | }
|
1964 |
|
1965 | Object.keys(meta).forEach(function (k) {
|
1966 | headers["x-oss-meta-".concat(k)] = meta[k];
|
1967 | });
|
1968 | };
|
1969 |
|
1970 | proto._deleteFileSafe = function _deleteFileSafe(filepath) {
|
1971 | var _this = this;
|
1972 |
|
1973 | return new Promise(function (resolve) {
|
1974 | fs.exists(filepath, function (exists) {
|
1975 | if (!exists) {
|
1976 | resolve();
|
1977 | } else {
|
1978 | fs.unlink(filepath, function (err) {
|
1979 | if (err) {
|
1980 | _this.debug('unlink %j error: %s', filepath, err, 'error');
|
1981 | }
|
1982 |
|
1983 | resolve();
|
1984 | });
|
1985 | }
|
1986 | });
|
1987 | });
|
1988 | };
|
1989 |
|
1990 |
|
1991 |
|
1992 |
|
1993 |
|
1994 |
|
1995 |
|
1996 |
|
1997 |
|
1998 | proto.get = function () {
|
1999 | var _get = (0, _asyncToGenerator2.default)( _regenerator.default.mark(function _callee8(name, file) {
|
2000 | var options,
|
2001 | writeStream,
|
2002 | needDestroy,
|
2003 | responseCacheControl,
|
2004 | result,
|
2005 | params,
|
2006 | _args8 = arguments;
|
2007 | return _regenerator.default.wrap(function _callee8$(_context8) {
|
2008 | while (1) {
|
2009 | switch (_context8.prev = _context8.next) {
|
2010 | case 0:
|
2011 | options = _args8.length > 2 && _args8[2] !== undefined ? _args8[2] : {};
|
2012 | writeStream = null;
|
2013 | needDestroy = false;
|
2014 |
|
2015 | if (is.writableStream(file)) {
|
2016 | writeStream = file;
|
2017 | } else if (is.string(file)) {
|
2018 | writeStream = fs.createWriteStream(file);
|
2019 | needDestroy = true;
|
2020 | } else {
|
2021 |
|
2022 | options = file;
|
2023 | }
|
2024 |
|
2025 | options = options || {};
|
2026 | responseCacheControl = options.responseCacheControl === null ? '' : 'no-cache';
|
2027 | options.subres = Object.assign(responseCacheControl ? {
|
2028 | 'response-cache-control': responseCacheControl
|
2029 | } : {}, options.subres);
|
2030 |
|
2031 | if (options.versionId) {
|
2032 | options.subres.versionId = options.versionId;
|
2033 | }
|
2034 |
|
2035 | if (options.process) {
|
2036 | options.subres['x-oss-process'] = options.process;
|
2037 | }
|
2038 |
|
2039 | _context8.prev = 9;
|
2040 | params = this._objectRequestParams('GET', name, options);
|
2041 | params.writeStream = writeStream;
|
2042 | params.successStatuses = [200, 206, 304];
|
2043 | _context8.next = 15;
|
2044 | return this.request(params);
|
2045 |
|
2046 | case 15:
|
2047 | result = _context8.sent;
|
2048 |
|
2049 | if (needDestroy) {
|
2050 | writeStream.destroy();
|
2051 | }
|
2052 |
|
2053 | _context8.next = 26;
|
2054 | break;
|
2055 |
|
2056 | case 19:
|
2057 | _context8.prev = 19;
|
2058 | _context8.t0 = _context8["catch"](9);
|
2059 |
|
2060 | if (!needDestroy) {
|
2061 | _context8.next = 25;
|
2062 | break;
|
2063 | }
|
2064 |
|
2065 | writeStream.destroy();
|
2066 |
|
2067 | _context8.next = 25;
|
2068 | return this._deleteFileSafe(file);
|
2069 |
|
2070 | case 25:
|
2071 | throw _context8.t0;
|
2072 |
|
2073 | case 26:
|
2074 | return _context8.abrupt("return", {
|
2075 | res: result.res,
|
2076 | content: result.data
|
2077 | });
|
2078 |
|
2079 | case 27:
|
2080 | case "end":
|
2081 | return _context8.stop();
|
2082 | }
|
2083 | }
|
2084 | }, _callee8, this, [[9, 19]]);
|
2085 | }));
|
2086 |
|
2087 | function get(_x18, _x19) {
|
2088 | return _get.apply(this, arguments);
|
2089 | }
|
2090 |
|
2091 | return get;
|
2092 | }();
|
2093 |
|
2094 | },{"../common/callback":23,"../common/image":26,"../common/object/copyObject":29,"../common/object/delete":30,"../common/object/deleteMulti":31,"../common/object/deleteObjectTagging":32,"../common/object/generateObjectUrl":33,"../common/object/get":34,"../common/object/getACL":35,"../common/object/getBucketVersions":36,"../common/object/getObjectMeta":37,"../common/object/getObjectTagging":38,"../common/object/getObjectUrl":39,"../common/object/getSymlink":40,"../common/object/head":41,"../common/object/putACL":42,"../common/object/putObjectTagging":43,"../common/object/putSymlink":44,"../common/object/signatureUrl":45,"../common/utils/isBlob":60,"../common/utils/isBuffer":61,"../common/utils/isFile":62,"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"copy-to":101,"core-js/modules/es.array.for-each":238,"core-js/modules/es.array.map":245,"core-js/modules/es.function.name":249,"core-js/modules/es.number.constructor":250,"core-js/modules/es.object.assign":251,"core-js/modules/es.object.keys":253,"core-js/modules/es.object.to-string":254,"core-js/modules/es.promise":255,"core-js/modules/es.regexp.exec":256,"core-js/modules/es.regexp.to-string":257,"core-js/modules/es.string.replace":261,"core-js/modules/web.dom-collections.for-each":292,"fs":78,"is-type-of":392,"merge-descriptors":311,"mime":313,"path":316,"regenerator-runtime/runtime":337}],5:[function(require,module,exports){
|
2095 | "use strict";
|
2096 |
|
2097 | exports.version = "6.13.0";
|
2098 |
|
2099 | },{}],6:[function(require,module,exports){
|
2100 | "use strict";
|
2101 |
|
2102 | var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
2103 |
|
2104 | var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
2105 |
|
2106 | require("regenerator-runtime/runtime");
|
2107 |
|
2108 | var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
2109 |
|
2110 | Object.defineProperty(exports, "__esModule", {
|
2111 | value: true
|
2112 | });
|
2113 | exports.abortBucketWorm = void 0;
|
2114 |
|
2115 | var checkBucketName_1 = require("../utils/checkBucketName");
|
2116 |
|
2117 | function abortBucketWorm(_x, _x2) {
|
2118 | return _abortBucketWorm.apply(this, arguments);
|
2119 | }
|
2120 |
|
2121 | function _abortBucketWorm() {
|
2122 | _abortBucketWorm = (0, _asyncToGenerator2.default)( _regenerator.default.mark(function _callee(name, options) {
|
2123 | var params, result;
|
2124 | return _regenerator.default.wrap(function _callee$(_context) {
|
2125 | while (1) {
|
2126 | switch (_context.prev = _context.next) {
|
2127 | case 0:
|
2128 | checkBucketName_1.checkBucketName(name);
|
2129 | params = this._bucketRequestParams('DELETE', name, 'worm', options);
|
2130 | _context.next = 4;
|
2131 | return this.request(params);
|
2132 |
|
2133 | case 4:
|
2134 | result = _context.sent;
|
2135 | return _context.abrupt("return", {
|
2136 | res: result.res,
|
2137 | status: result.status
|
2138 | });
|
2139 |
|
2140 | case 6:
|
2141 | case "end":
|
2142 | return _context.stop();
|
2143 | }
|
2144 | }
|
2145 | }, _callee, this);
|
2146 | }));
|
2147 | return _abortBucketWorm.apply(this, arguments);
|
2148 | }
|
2149 |
|
2150 | exports.abortBucketWorm = abortBucketWorm;
|
2151 |
|
2152 | },{"../utils/checkBucketName":48,"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"regenerator-runtime/runtime":337}],7:[function(require,module,exports){
|
2153 | "use strict";
|
2154 |
|
2155 | var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
2156 |
|
2157 | var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
2158 |
|
2159 | require("regenerator-runtime/runtime");
|
2160 |
|
2161 | var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
2162 |
|
2163 | Object.defineProperty(exports, "__esModule", {
|
2164 | value: true
|
2165 | });
|
2166 | exports.completeBucketWorm = void 0;
|
2167 |
|
2168 | var checkBucketName_1 = require("../utils/checkBucketName");
|
2169 |
|
2170 | function completeBucketWorm(_x, _x2, _x3) {
|
2171 | return _completeBucketWorm.apply(this, arguments);
|
2172 | }
|
2173 |
|
2174 | function _completeBucketWorm() {
|
2175 | _completeBucketWorm = (0, _asyncToGenerator2.default)( _regenerator.default.mark(function _callee(name, wormId, options) {
|
2176 | var params, result;
|
2177 | return _regenerator.default.wrap(function _callee$(_context) {
|
2178 | while (1) {
|
2179 | switch (_context.prev = _context.next) {
|
2180 | case 0:
|
2181 | checkBucketName_1.checkBucketName(name);
|
2182 | params = this._bucketRequestParams('POST', name, {
|
2183 | wormId: wormId
|
2184 | }, options);
|
2185 | _context.next = 4;
|
2186 | return this.request(params);
|
2187 |
|
2188 | case 4:
|
2189 | result = _context.sent;
|
2190 | return _context.abrupt("return", {
|
2191 | res: result.res,
|
2192 | status: result.status
|
2193 | });
|
2194 |
|
2195 | case 6:
|
2196 | case "end":
|
2197 | return _context.stop();
|
2198 | }
|
2199 | }
|
2200 | }, _callee, this);
|
2201 | }));
|
2202 | return _completeBucketWorm.apply(this, arguments);
|
2203 | }
|
2204 |
|
2205 | exports.completeBucketWorm = completeBucketWorm;
|
2206 |
|
2207 | },{"../utils/checkBucketName":48,"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"regenerator-runtime/runtime":337}],8:[function(require,module,exports){
|
2208 | "use strict";
|
2209 |
|
2210 | var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
2211 |
|
2212 | require("core-js/modules/es.object.assign");
|
2213 |
|
2214 | var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
2215 |
|
2216 | require("regenerator-runtime/runtime");
|
2217 |
|
2218 | var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
2219 |
|
2220 | Object.defineProperty(exports, "__esModule", {
|
2221 | value: true
|
2222 | });
|
2223 | exports.deleteBucketInventory = void 0;
|
2224 |
|
2225 | var checkBucketName_1 = require("../utils/checkBucketName");
|
2226 |
|
2227 |
|
2228 |
|
2229 |
|
2230 |
|
2231 |
|
2232 |
|
2233 |
|
2234 | function deleteBucketInventory(_x, _x2) {
|
2235 | return _deleteBucketInventory.apply(this, arguments);
|
2236 | }
|
2237 |
|
2238 | function _deleteBucketInventory() {
|
2239 | _deleteBucketInventory = (0, _asyncToGenerator2.default)( _regenerator.default.mark(function _callee(bucketName, inventoryId) {
|
2240 | var options,
|
2241 | subres,
|
2242 | params,
|
2243 | result,
|
2244 | _args = arguments;
|
2245 | return _regenerator.default.wrap(function _callee$(_context) {
|
2246 | while (1) {
|
2247 | switch (_context.prev = _context.next) {
|
2248 | case 0:
|
2249 | options = _args.length > 2 && _args[2] !== undefined ? _args[2] : {};
|
2250 | subres = Object.assign({
|
2251 | inventory: '',
|
2252 | inventoryId: inventoryId
|
2253 | }, options.subres);
|
2254 | checkBucketName_1.checkBucketName(bucketName);
|
2255 | params = this._bucketRequestParams('DELETE', bucketName, subres, options);
|
2256 | params.successStatuses = [204];
|
2257 | _context.next = 7;
|
2258 | return this.request(params);
|
2259 |
|
2260 | case 7:
|
2261 | result = _context.sent;
|
2262 | return _context.abrupt("return", {
|
2263 | status: result.status,
|
2264 | res: result.res
|
2265 | });
|
2266 |
|
2267 | case 9:
|
2268 | case "end":
|
2269 | return _context.stop();
|
2270 | }
|
2271 | }
|
2272 | }, _callee, this);
|
2273 | }));
|
2274 | return _deleteBucketInventory.apply(this, arguments);
|
2275 | }
|
2276 |
|
2277 | exports.deleteBucketInventory = deleteBucketInventory;
|
2278 |
|
2279 | },{"../utils/checkBucketName":48,"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"core-js/modules/es.object.assign":251,"regenerator-runtime/runtime":337}],9:[function(require,module,exports){
|
2280 | "use strict";
|
2281 |
|
2282 | var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
2283 |
|
2284 | var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
2285 |
|
2286 | require("regenerator-runtime/runtime");
|
2287 |
|
2288 | var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
2289 |
|
2290 | var _require = require('../utils/checkBucketName'),
|
2291 | _checkBucketName = _require.checkBucketName;
|
2292 |
|
2293 | var proto = exports;
|
2294 |
|
2295 | proto.deleteBucketLifecycle = function () {
|
2296 | var _deleteBucketLifecycle = (0, _asyncToGenerator2.default)( _regenerator.default.mark(function _callee(name, options) {
|
2297 | var params, result;
|
2298 | return _regenerator.default.wrap(function _callee$(_context) {
|
2299 | while (1) {
|
2300 | switch (_context.prev = _context.next) {
|
2301 | case 0:
|
2302 | _checkBucketName(name);
|
2303 |
|
2304 | params = this._bucketRequestParams('DELETE', name, 'lifecycle', options);
|
2305 | params.successStatuses = [204];
|
2306 | _context.next = 5;
|
2307 | return this.request(params);
|
2308 |
|
2309 | case 5:
|
2310 | result = _context.sent;
|
2311 | return _context.abrupt("return", {
|
2312 | res: result.res
|
2313 | });
|
2314 |
|
2315 | case 7:
|
2316 | case "end":
|
2317 | return _context.stop();
|
2318 | }
|
2319 | }
|
2320 | }, _callee, this);
|
2321 | }));
|
2322 |
|
2323 | function deleteBucketLifecycle(_x, _x2) {
|
2324 | return _deleteBucketLifecycle.apply(this, arguments);
|
2325 | }
|
2326 |
|
2327 | return deleteBucketLifecycle;
|
2328 | }();
|
2329 |
|
2330 | },{"../utils/checkBucketName":48,"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"regenerator-runtime/runtime":337}],10:[function(require,module,exports){
|
2331 | "use strict";
|
2332 |
|
2333 | var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
2334 |
|
2335 | var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
2336 |
|
2337 | require("regenerator-runtime/runtime");
|
2338 |
|
2339 | var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
2340 |
|
2341 | var _require = require('../utils/checkBucketName'),
|
2342 | _checkBucketName = _require.checkBucketName;
|
2343 |
|
2344 | var proto = exports;
|
2345 |
|
2346 | proto.deleteBucketWebsite = function () {
|
2347 | var _deleteBucketWebsite = (0, _asyncToGenerator2.default)( _regenerator.default.mark(function _callee(name, options) {
|
2348 | var params, result;
|
2349 | return _regenerator.default.wrap(function _callee$(_context) {
|
2350 | while (1) {
|
2351 | switch (_context.prev = _context.next) {
|
2352 | case 0:
|
2353 | _checkBucketName(name);
|
2354 |
|
2355 | params = this._bucketRequestParams('DELETE', name, 'website', options);
|
2356 | params.successStatuses = [204];
|
2357 | _context.next = 5;
|
2358 | return this.request(params);
|
2359 |
|
2360 | case 5:
|
2361 | result = _context.sent;
|
2362 | return _context.abrupt("return", {
|
2363 | res: result.res
|
2364 | });
|
2365 |
|
2366 | case 7:
|
2367 | case "end":
|
2368 | return _context.stop();
|
2369 | }
|
2370 | }
|
2371 | }, _callee, this);
|
2372 | }));
|
2373 |
|
2374 | function deleteBucketWebsite(_x, _x2) {
|
2375 | return _deleteBucketWebsite.apply(this, arguments);
|
2376 | }
|
2377 |
|
2378 | return deleteBucketWebsite;
|
2379 | }();
|
2380 |
|
2381 | },{"../utils/checkBucketName":48,"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"regenerator-runtime/runtime":337}],11:[function(require,module,exports){
|
2382 | "use strict";
|
2383 |
|
2384 | var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
2385 |
|
2386 | var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
2387 |
|
2388 | require("regenerator-runtime/runtime");
|
2389 |
|
2390 | var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
2391 |
|
2392 | Object.defineProperty(exports, "__esModule", {
|
2393 | value: true
|
2394 | });
|
2395 | exports.extendBucketWorm = void 0;
|
2396 |
|
2397 | var checkBucketName_1 = require("../utils/checkBucketName");
|
2398 |
|
2399 | var obj2xml_1 = require("../utils/obj2xml");
|
2400 |
|
2401 | function extendBucketWorm(_x, _x2, _x3, _x4) {
|
2402 | return _extendBucketWorm.apply(this, arguments);
|
2403 | }
|
2404 |
|
2405 | function _extendBucketWorm() {
|
2406 | _extendBucketWorm = (0, _asyncToGenerator2.default)( _regenerator.default.mark(function _callee(name, wormId, days, options) {
|
2407 | var params, paramlXMLObJ, result;
|
2408 | return _regenerator.default.wrap(function _callee$(_context) {
|
2409 | while (1) {
|
2410 | switch (_context.prev = _context.next) {
|
2411 | case 0:
|
2412 | checkBucketName_1.checkBucketName(name);
|
2413 | params = this._bucketRequestParams('POST', name, {
|
2414 | wormExtend: '',
|
2415 | wormId: wormId
|
2416 | }, options);
|
2417 | paramlXMLObJ = {
|
2418 | ExtendWormConfiguration: {
|
2419 | RetentionPeriodInDays: days
|
2420 | }
|
2421 | };
|
2422 | params.mime = 'xml';
|
2423 | params.content = obj2xml_1.obj2xml(paramlXMLObJ, {
|
2424 | headers: true
|
2425 | });
|
2426 | params.successStatuses = [200];
|
2427 | _context.next = 8;
|
2428 | return this.request(params);
|
2429 |
|
2430 | case 8:
|
2431 | result = _context.sent;
|
2432 | return _context.abrupt("return", {
|
2433 | res: result.res,
|
2434 | status: result.status
|
2435 | });
|
2436 |
|
2437 | case 10:
|
2438 | case "end":
|
2439 | return _context.stop();
|
2440 | }
|
2441 | }
|
2442 | }, _callee, this);
|
2443 | }));
|
2444 | return _extendBucketWorm.apply(this, arguments);
|
2445 | }
|
2446 |
|
2447 | exports.extendBucketWorm = extendBucketWorm;
|
2448 |
|
2449 | },{"../utils/checkBucketName":48,"../utils/obj2xml":66,"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"regenerator-runtime/runtime":337}],12:[function(require,module,exports){
|
2450 | "use strict";
|
2451 |
|
2452 | var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
2453 |
|
2454 | require("core-js/modules/es.object.assign");
|
2455 |
|
2456 | var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
2457 |
|
2458 | require("regenerator-runtime/runtime");
|
2459 |
|
2460 | var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
2461 |
|
2462 | Object.defineProperty(exports, "__esModule", {
|
2463 | value: true
|
2464 | });
|
2465 | exports.getBucketInventory = void 0;
|
2466 |
|
2467 | var checkBucketName_1 = require("../utils/checkBucketName");
|
2468 |
|
2469 | var formatInventoryConfig_1 = require("../utils/formatInventoryConfig");
|
2470 |
|
2471 |
|
2472 |
|
2473 |
|
2474 |
|
2475 |
|
2476 |
|
2477 |
|
2478 | function getBucketInventory(_x, _x2) {
|
2479 | return _getBucketInventory.apply(this, arguments);
|
2480 | }
|
2481 |
|
2482 | function _getBucketInventory() {
|
2483 | _getBucketInventory = (0, _asyncToGenerator2.default)( _regenerator.default.mark(function _callee(bucketName, inventoryId) {
|
2484 | var options,
|
2485 | subres,
|
2486 | params,
|
2487 | result,
|
2488 | _args = arguments;
|
2489 | return _regenerator.default.wrap(function _callee$(_context) {
|
2490 | while (1) {
|
2491 | switch (_context.prev = _context.next) {
|
2492 | case 0:
|
2493 | options = _args.length > 2 && _args[2] !== undefined ? _args[2] : {};
|
2494 | subres = Object.assign({
|
2495 | inventory: '',
|
2496 | inventoryId: inventoryId
|
2497 | }, options.subres);
|
2498 | checkBucketName_1.checkBucketName(bucketName);
|
2499 | params = this._bucketRequestParams('GET', bucketName, subres, options);
|
2500 | params.successStatuses = [200];
|
2501 | params.xmlResponse = true;
|
2502 | _context.next = 8;
|
2503 | return this.request(params);
|
2504 |
|
2505 | case 8:
|
2506 | result = _context.sent;
|
2507 | return _context.abrupt("return", {
|
2508 | status: result.status,
|
2509 | res: result.res,
|
2510 | inventory: formatInventoryConfig_1.formatInventoryConfig(result.data)
|
2511 | });
|
2512 |
|
2513 | case 10:
|
2514 | case "end":
|
2515 | return _context.stop();
|
2516 | }
|
2517 | }
|
2518 | }, _callee, this);
|
2519 | }));
|
2520 | return _getBucketInventory.apply(this, arguments);
|
2521 | }
|
2522 |
|
2523 | exports.getBucketInventory = getBucketInventory;
|
2524 |
|
2525 | },{"../utils/checkBucketName":48,"../utils/formatInventoryConfig":56,"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"core-js/modules/es.object.assign":251,"regenerator-runtime/runtime":337}],13:[function(require,module,exports){
|
2526 | "use strict";
|
2527 |
|
2528 | var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
2529 |
|
2530 | require("core-js/modules/es.array.map");
|
2531 |
|
2532 | var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
2533 |
|
2534 | require("regenerator-runtime/runtime");
|
2535 |
|
2536 | var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
2537 |
|
2538 | var _require = require('../utils/checkBucketName'),
|
2539 | _checkBucketName = _require.checkBucketName;
|
2540 |
|
2541 | var _require2 = require('../utils/isArray'),
|
2542 | isArray = _require2.isArray;
|
2543 |
|
2544 | var _require3 = require('../utils/formatObjKey'),
|
2545 | formatObjKey = _require3.formatObjKey;
|
2546 |
|
2547 | var proto = exports;
|
2548 |
|
2549 | proto.getBucketLifecycle = function () {
|
2550 | var _getBucketLifecycle = (0, _asyncToGenerator2.default)( _regenerator.default.mark(function _callee(name, options) {
|
2551 | var params, result, rules;
|
2552 | return _regenerator.default.wrap(function _callee$(_context) {
|
2553 | while (1) {
|
2554 | switch (_context.prev = _context.next) {
|
2555 | case 0:
|
2556 | _checkBucketName(name);
|
2557 |
|
2558 | params = this._bucketRequestParams('GET', name, 'lifecycle', options);
|
2559 | params.successStatuses = [200];
|
2560 | params.xmlResponse = true;
|
2561 | _context.next = 6;
|
2562 | return this.request(params);
|
2563 |
|
2564 | case 6:
|
2565 | result = _context.sent;
|
2566 | rules = result.data.Rule || null;
|
2567 |
|
2568 | if (rules) {
|
2569 | if (!isArray(rules)) {
|
2570 | rules = [rules];
|
2571 | }
|
2572 |
|
2573 | rules = rules.map(function (_) {
|
2574 | if (_.ID) {
|
2575 | _.id = _.ID;
|
2576 | delete _.ID;
|
2577 | }
|
2578 |
|
2579 | if (_.Tag && !isArray(_.Tag)) {
|
2580 | _.Tag = [_.Tag];
|
2581 | }
|
2582 |
|
2583 | return formatObjKey(_, 'firstLowerCase');
|
2584 | });
|
2585 | }
|
2586 |
|
2587 | return _context.abrupt("return", {
|
2588 | rules: rules,
|
2589 | res: result.res
|
2590 | });
|
2591 |
|
2592 | case 10:
|
2593 | case "end":
|
2594 | return _context.stop();
|
2595 | }
|
2596 | }
|
2597 | }, _callee, this);
|
2598 | }));
|
2599 |
|
2600 | function getBucketLifecycle(_x, _x2) {
|
2601 | return _getBucketLifecycle.apply(this, arguments);
|
2602 | }
|
2603 |
|
2604 | return getBucketLifecycle;
|
2605 | }();
|
2606 |
|
2607 | },{"../utils/checkBucketName":48,"../utils/formatObjKey":57,"../utils/isArray":59,"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"core-js/modules/es.array.map":245,"regenerator-runtime/runtime":337}],14:[function(require,module,exports){
|
2608 | "use strict";
|
2609 |
|
2610 | var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
2611 |
|
2612 | var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
2613 |
|
2614 | require("regenerator-runtime/runtime");
|
2615 |
|
2616 | var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
2617 |
|
2618 | var _require = require('../utils/checkBucketName'),
|
2619 | _checkBucketName = _require.checkBucketName;
|
2620 |
|
2621 | var proto = exports;
|
2622 |
|
2623 |
|
2624 |
|
2625 |
|
2626 |
|
2627 | proto.getBucketVersioning = function () {
|
2628 | var _getBucketVersioning = (0, _asyncToGenerator2.default)( _regenerator.default.mark(function _callee(bucketName, options) {
|
2629 | var params, result, versionStatus;
|
2630 | return _regenerator.default.wrap(function _callee$(_context) {
|
2631 | while (1) {
|
2632 | switch (_context.prev = _context.next) {
|
2633 | case 0:
|
2634 | _checkBucketName(bucketName);
|
2635 |
|
2636 | params = this._bucketRequestParams('GET', bucketName, 'versioning', options);
|
2637 | params.xmlResponse = true;
|
2638 | params.successStatuses = [200];
|
2639 | _context.next = 6;
|
2640 | return this.request(params);
|
2641 |
|
2642 | case 6:
|
2643 | result = _context.sent;
|
2644 | versionStatus = result.data.Status;
|
2645 | return _context.abrupt("return", {
|
2646 | status: result.status,
|
2647 | versionStatus: versionStatus,
|
2648 | res: result.res
|
2649 | });
|
2650 |
|
2651 | case 9:
|
2652 | case "end":
|
2653 | return _context.stop();
|
2654 | }
|
2655 | }
|
2656 | }, _callee, this);
|
2657 | }));
|
2658 |
|
2659 | function getBucketVersioning(_x, _x2) {
|
2660 | return _getBucketVersioning.apply(this, arguments);
|
2661 | }
|
2662 |
|
2663 | return getBucketVersioning;
|
2664 | }();
|
2665 |
|
2666 | },{"../utils/checkBucketName":48,"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"regenerator-runtime/runtime":337}],15:[function(require,module,exports){
|
2667 | "use strict";
|
2668 |
|
2669 | var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
2670 |
|
2671 | var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
2672 |
|
2673 | require("regenerator-runtime/runtime");
|
2674 |
|
2675 | var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
2676 |
|
2677 | var _require = require('../utils/checkBucketName'),
|
2678 | _checkBucketName = _require.checkBucketName;
|
2679 |
|
2680 | var _require2 = require('../utils/isObject'),
|
2681 | isObject = _require2.isObject;
|
2682 |
|
2683 | var proto = exports;
|
2684 |
|
2685 | proto.getBucketWebsite = function () {
|
2686 | var _getBucketWebsite = (0, _asyncToGenerator2.default)( _regenerator.default.mark(function _callee(name, options) {
|
2687 | var params, result, routingRules;
|
2688 | return _regenerator.default.wrap(function _callee$(_context) {
|
2689 | while (1) {
|
2690 | switch (_context.prev = _context.next) {
|
2691 | case 0:
|
2692 | _checkBucketName(name);
|
2693 |
|
2694 | params = this._bucketRequestParams('GET', name, 'website', options);
|
2695 | params.successStatuses = [200];
|
2696 | params.xmlResponse = true;
|
2697 | _context.next = 6;
|
2698 | return this.request(params);
|
2699 |
|
2700 | case 6:
|
2701 | result = _context.sent;
|
2702 | routingRules = [];
|
2703 |
|
2704 | if (result.data.RoutingRules && result.data.RoutingRules.RoutingRule) {
|
2705 | if (isObject(result.data.RoutingRules.RoutingRule)) {
|
2706 | routingRules = [result.data.RoutingRules.RoutingRule];
|
2707 | } else {
|
2708 | routingRules = result.data.RoutingRules.RoutingRule;
|
2709 | }
|
2710 | }
|
2711 |
|
2712 | return _context.abrupt("return", {
|
2713 | index: result.data.IndexDocument && result.data.IndexDocument.Suffix || '',
|
2714 | supportSubDir: result.data.IndexDocument && result.data.IndexDocument.SupportSubDir || 'false',
|
2715 | type: result.data.IndexDocument && result.data.IndexDocument.Type,
|
2716 | routingRules: routingRules,
|
2717 | error: result.data.ErrorDocument && result.data.ErrorDocument.Key || null,
|
2718 | res: result.res
|
2719 | });
|
2720 |
|
2721 | case 10:
|
2722 | case "end":
|
2723 | return _context.stop();
|
2724 | }
|
2725 | }
|
2726 | }, _callee, this);
|
2727 | }));
|
2728 |
|
2729 | function getBucketWebsite(_x, _x2) {
|
2730 | return _getBucketWebsite.apply(this, arguments);
|
2731 | }
|
2732 |
|
2733 | return getBucketWebsite;
|
2734 | }();
|
2735 |
|
2736 | },{"../utils/checkBucketName":48,"../utils/isObject":64,"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"regenerator-runtime/runtime":337}],16:[function(require,module,exports){
|
2737 | "use strict";
|
2738 |
|
2739 | var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
2740 |
|
2741 | require("core-js/modules/es.object.assign");
|
2742 |
|
2743 | var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
2744 |
|
2745 | require("regenerator-runtime/runtime");
|
2746 |
|
2747 | var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
2748 |
|
2749 | Object.defineProperty(exports, "__esModule", {
|
2750 | value: true
|
2751 | });
|
2752 | exports.getBucketWorm = void 0;
|
2753 |
|
2754 | var checkBucketName_1 = require("../utils/checkBucketName");
|
2755 |
|
2756 | var dataFix_1 = require("../utils/dataFix");
|
2757 |
|
2758 | function getBucketWorm(_x, _x2) {
|
2759 | return _getBucketWorm.apply(this, arguments);
|
2760 | }
|
2761 |
|
2762 | function _getBucketWorm() {
|
2763 | _getBucketWorm = (0, _asyncToGenerator2.default)( _regenerator.default.mark(function _callee(name, options) {
|
2764 | var params, result;
|
2765 | return _regenerator.default.wrap(function _callee$(_context) {
|
2766 | while (1) {
|
2767 | switch (_context.prev = _context.next) {
|
2768 | case 0:
|
2769 | checkBucketName_1.checkBucketName(name);
|
2770 | params = this._bucketRequestParams('GET', name, 'worm', options);
|
2771 | params.successStatuses = [200];
|
2772 | params.xmlResponse = true;
|
2773 | _context.next = 6;
|
2774 | return this.request(params);
|
2775 |
|
2776 | case 6:
|
2777 | result = _context.sent;
|
2778 | dataFix_1.dataFix(result.data, {
|
2779 | lowerFirst: true,
|
2780 | rename: {
|
2781 | RetentionPeriodInDays: 'days'
|
2782 | }
|
2783 | });
|
2784 | return _context.abrupt("return", Object.assign(Object.assign({}, result.data), {
|
2785 | res: result.res,
|
2786 | status: result.status
|
2787 | }));
|
2788 |
|
2789 | case 9:
|
2790 | case "end":
|
2791 | return _context.stop();
|
2792 | }
|
2793 | }
|
2794 | }, _callee, this);
|
2795 | }));
|
2796 | return _getBucketWorm.apply(this, arguments);
|
2797 | }
|
2798 |
|
2799 | exports.getBucketWorm = getBucketWorm;
|
2800 |
|
2801 | },{"../utils/checkBucketName":48,"../utils/dataFix":53,"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"core-js/modules/es.object.assign":251,"regenerator-runtime/runtime":337}],17:[function(require,module,exports){
|
2802 | "use strict";
|
2803 |
|
2804 | var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
2805 |
|
2806 | var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
2807 |
|
2808 | require("regenerator-runtime/runtime");
|
2809 |
|
2810 | var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
2811 |
|
2812 | Object.defineProperty(exports, "__esModule", {
|
2813 | value: true
|
2814 | });
|
2815 | exports.initiateBucketWorm = void 0;
|
2816 |
|
2817 | var obj2xml_1 = require("../utils/obj2xml");
|
2818 |
|
2819 | var checkBucketName_1 = require("../utils/checkBucketName");
|
2820 |
|
2821 | function initiateBucketWorm(_x, _x2, _x3) {
|
2822 | return _initiateBucketWorm.apply(this, arguments);
|
2823 | }
|
2824 |
|
2825 | function _initiateBucketWorm() {
|
2826 | _initiateBucketWorm = (0, _asyncToGenerator2.default)( _regenerator.default.mark(function _callee(name, days, options) {
|
2827 | var params, paramlXMLObJ, result;
|
2828 | return _regenerator.default.wrap(function _callee$(_context) {
|
2829 | while (1) {
|
2830 | switch (_context.prev = _context.next) {
|
2831 | case 0:
|
2832 | checkBucketName_1.checkBucketName(name);
|
2833 | params = this._bucketRequestParams('POST', name, 'worm', options);
|
2834 | paramlXMLObJ = {
|
2835 | InitiateWormConfiguration: {
|
2836 | RetentionPeriodInDays: days
|
2837 | }
|
2838 | };
|
2839 | params.mime = 'xml';
|
2840 | params.content = obj2xml_1.obj2xml(paramlXMLObJ, {
|
2841 | headers: true
|
2842 | });
|
2843 | params.successStatuses = [200];
|
2844 | _context.next = 8;
|
2845 | return this.request(params);
|
2846 |
|
2847 | case 8:
|
2848 | result = _context.sent;
|
2849 | return _context.abrupt("return", {
|
2850 | res: result.res,
|
2851 | wormId: result.res.headers['x-oss-worm-id'],
|
2852 | status: result.status
|
2853 | });
|
2854 |
|
2855 | case 10:
|
2856 | case "end":
|
2857 | return _context.stop();
|
2858 | }
|
2859 | }
|
2860 | }, _callee, this);
|
2861 | }));
|
2862 | return _initiateBucketWorm.apply(this, arguments);
|
2863 | }
|
2864 |
|
2865 | exports.initiateBucketWorm = initiateBucketWorm;
|
2866 |
|
2867 | },{"../utils/checkBucketName":48,"../utils/obj2xml":66,"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"regenerator-runtime/runtime":337}],18:[function(require,module,exports){
|
2868 | "use strict";
|
2869 |
|
2870 | var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
2871 |
|
2872 | require("core-js/modules/es.object.assign");
|
2873 |
|
2874 | var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
2875 |
|
2876 | require("regenerator-runtime/runtime");
|
2877 |
|
2878 | var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
2879 |
|
2880 | Object.defineProperty(exports, "__esModule", {
|
2881 | value: true
|
2882 | });
|
2883 | exports.listBucketInventory = void 0;
|
2884 |
|
2885 | var checkBucketName_1 = require("../utils/checkBucketName");
|
2886 |
|
2887 | var formatInventoryConfig_1 = require("../utils/formatInventoryConfig");
|
2888 |
|
2889 |
|
2890 |
|
2891 |
|
2892 |
|
2893 |
|
2894 |
|
2895 |
|
2896 | function listBucketInventory(_x) {
|
2897 | return _listBucketInventory.apply(this, arguments);
|
2898 | }
|
2899 |
|
2900 | function _listBucketInventory() {
|
2901 | _listBucketInventory = (0, _asyncToGenerator2.default)( _regenerator.default.mark(function _callee(bucketName) {
|
2902 | var options,
|
2903 | continuationToken,
|
2904 | subres,
|
2905 | params,
|
2906 | result,
|
2907 | data,
|
2908 | res,
|
2909 | status,
|
2910 | _args = arguments;
|
2911 | return _regenerator.default.wrap(function _callee$(_context) {
|
2912 | while (1) {
|
2913 | switch (_context.prev = _context.next) {
|
2914 | case 0:
|
2915 | options = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
|
2916 | continuationToken = options.continuationToken;
|
2917 | subres = Object.assign({
|
2918 | inventory: ''
|
2919 | }, continuationToken && {
|
2920 | 'continuation-token': continuationToken
|
2921 | }, options.subres);
|
2922 | checkBucketName_1.checkBucketName(bucketName);
|
2923 | params = this._bucketRequestParams('GET', bucketName, subres, options);
|
2924 | params.successStatuses = [200];
|
2925 | params.xmlResponse = true;
|
2926 | _context.next = 9;
|
2927 | return this.request(params);
|
2928 |
|
2929 | case 9:
|
2930 | result = _context.sent;
|
2931 | data = result.data, res = result.res, status = result.status;
|
2932 | return _context.abrupt("return", {
|
2933 | isTruncated: data.IsTruncated === 'true',
|
2934 | nextContinuationToken: data.NextContinuationToken,
|
2935 | inventoryList: formatInventoryConfig_1.formatInventoryConfig(data.InventoryConfiguration, true),
|
2936 | status: status,
|
2937 | res: res
|
2938 | });
|
2939 |
|
2940 | case 12:
|
2941 | case "end":
|
2942 | return _context.stop();
|
2943 | }
|
2944 | }
|
2945 | }, _callee, this);
|
2946 | }));
|
2947 | return _listBucketInventory.apply(this, arguments);
|
2948 | }
|
2949 |
|
2950 | exports.listBucketInventory = listBucketInventory;
|
2951 |
|
2952 | },{"../utils/checkBucketName":48,"../utils/formatInventoryConfig":56,"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"core-js/modules/es.object.assign":251,"regenerator-runtime/runtime":337}],19:[function(require,module,exports){
|
2953 | "use strict";
|
2954 |
|
2955 | var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
2956 |
|
2957 | require("core-js/modules/es.array.concat");
|
2958 |
|
2959 | require("core-js/modules/es.object.assign");
|
2960 |
|
2961 | var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
2962 |
|
2963 | require("regenerator-runtime/runtime");
|
2964 |
|
2965 | var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
2966 |
|
2967 | Object.defineProperty(exports, "__esModule", {
|
2968 | value: true
|
2969 | });
|
2970 | exports.putBucketInventory = void 0;
|
2971 |
|
2972 | var checkBucketName_1 = require("../utils/checkBucketName");
|
2973 |
|
2974 | var obj2xml_1 = require("../utils/obj2xml");
|
2975 |
|
2976 |
|
2977 |
|
2978 |
|
2979 |
|
2980 |
|
2981 |
|
2982 |
|
2983 | function putBucketInventory(_x, _x2) {
|
2984 | return _putBucketInventory.apply(this, arguments);
|
2985 | }
|
2986 |
|
2987 | function _putBucketInventory() {
|
2988 | _putBucketInventory = (0, _asyncToGenerator2.default)( _regenerator.default.mark(function _callee(bucketName, inventory) {
|
2989 | var options,
|
2990 | subres,
|
2991 | OSSBucketDestination,
|
2992 | optionalFields,
|
2993 | includedObjectVersions,
|
2994 | destinationBucketPrefix,
|
2995 | rolePrefix,
|
2996 | paramXMLObj,
|
2997 | paramXML,
|
2998 | params,
|
2999 | result,
|
3000 | _args = arguments;
|
3001 | return _regenerator.default.wrap(function _callee$(_context) {
|
3002 | while (1) {
|
3003 | switch (_context.prev = _context.next) {
|
3004 | case 0:
|
3005 | options = _args.length > 2 && _args[2] !== undefined ? _args[2] : {};
|
3006 | subres = Object.assign({
|
3007 | inventory: '',
|
3008 | inventoryId: inventory.id
|
3009 | }, options.subres);
|
3010 | checkBucketName_1.checkBucketName(bucketName);
|
3011 | OSSBucketDestination = inventory.OSSBucketDestination, optionalFields = inventory.optionalFields, includedObjectVersions = inventory.includedObjectVersions;
|
3012 | destinationBucketPrefix = 'acs:oss:::';
|
3013 | rolePrefix = "acs:ram::".concat(OSSBucketDestination.accountId, ":role/");
|
3014 | paramXMLObj = {
|
3015 | InventoryConfiguration: {
|
3016 | Id: inventory.id,
|
3017 | IsEnabled: inventory.isEnabled,
|
3018 | Filter: {
|
3019 | Prefix: inventory.prefix || ''
|
3020 | },
|
3021 | Destination: {
|
3022 | OSSBucketDestination: {
|
3023 | Format: OSSBucketDestination.format,
|
3024 | AccountId: OSSBucketDestination.accountId,
|
3025 | RoleArn: "".concat(rolePrefix).concat(OSSBucketDestination.rolename),
|
3026 | Bucket: "".concat(destinationBucketPrefix).concat(OSSBucketDestination.bucket),
|
3027 | Prefix: OSSBucketDestination.prefix || '',
|
3028 | Encryption: OSSBucketDestination.encryption || ''
|
3029 | }
|
3030 | },
|
3031 | Schedule: {
|
3032 | Frequency: inventory.frequency
|
3033 | },
|
3034 | IncludedObjectVersions: includedObjectVersions,
|
3035 | OptionalFields: {
|
3036 | Field: (optionalFields === null || optionalFields === void 0 ? void 0 : optionalFields.field) || []
|
3037 | }
|
3038 | }
|
3039 | };
|
3040 | paramXML = obj2xml_1.obj2xml(paramXMLObj, {
|
3041 | headers: true,
|
3042 | firstUpperCase: true
|
3043 | });
|
3044 | params = this._bucketRequestParams('PUT', bucketName, subres, options);
|
3045 | params.successStatuses = [200];
|
3046 | params.mime = 'xml';
|
3047 | params.content = paramXML;
|
3048 | _context.next = 14;
|
3049 | return this.request(params);
|
3050 |
|
3051 | case 14:
|
3052 | result = _context.sent;
|
3053 | return _context.abrupt("return", {
|
3054 | status: result.status,
|
3055 | res: result.res
|
3056 | });
|
3057 |
|
3058 | case 16:
|
3059 | case "end":
|
3060 | return _context.stop();
|
3061 | }
|
3062 | }
|
3063 | }, _callee, this);
|
3064 | }));
|
3065 | return _putBucketInventory.apply(this, arguments);
|
3066 | }
|
3067 |
|
3068 | exports.putBucketInventory = putBucketInventory;
|
3069 |
|
3070 | },{"../utils/checkBucketName":48,"../utils/obj2xml":66,"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"core-js/modules/es.array.concat":234,"core-js/modules/es.object.assign":251,"regenerator-runtime/runtime":337}],20:[function(require,module,exports){
|
3071 | "use strict";
|
3072 |
|
3073 | var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
3074 |
|
3075 | require("core-js/modules/es.array.for-each");
|
3076 |
|
3077 | require("core-js/modules/es.array.includes");
|
3078 |
|
3079 | require("core-js/modules/web.dom-collections.for-each");
|
3080 |
|
3081 | var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
3082 |
|
3083 | require("regenerator-runtime/runtime");
|
3084 |
|
3085 | var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
3086 |
|
3087 |
|
3088 | var _require = require('../utils/checkBucketName'),
|
3089 | _checkBucketName = _require.checkBucketName;
|
3090 |
|
3091 | var _require2 = require('../utils/isArray'),
|
3092 | isArray = _require2.isArray;
|
3093 |
|
3094 | var _require3 = require('../utils/deepCopy'),
|
3095 | deepCopy = _require3.deepCopy;
|
3096 |
|
3097 | var _require4 = require('../utils/isObject'),
|
3098 | isObject = _require4.isObject;
|
3099 |
|
3100 | var _require5 = require('../utils/obj2xml'),
|
3101 | obj2xml = _require5.obj2xml;
|
3102 |
|
3103 | var _require6 = require('../utils/checkObjectTag'),
|
3104 | checkObjectTag = _require6.checkObjectTag;
|
3105 |
|
3106 | var _require7 = require('../utils/getStrBytesCount'),
|
3107 | getStrBytesCount = _require7.getStrBytesCount;
|
3108 |
|
3109 | var proto = exports;
|
3110 |
|
3111 | proto.putBucketLifecycle = function () {
|
3112 | var _putBucketLifecycle = (0, _asyncToGenerator2.default)( _regenerator.default.mark(function _callee(name, rules, options) {
|
3113 | var params, Rule, paramXMLObj, paramXML, result;
|
3114 | return _regenerator.default.wrap(function _callee$(_context) {
|
3115 | while (1) {
|
3116 | switch (_context.prev = _context.next) {
|
3117 | case 0:
|
3118 | _checkBucketName(name);
|
3119 |
|
3120 | if (isArray(rules)) {
|
3121 | _context.next = 3;
|
3122 | break;
|
3123 | }
|
3124 |
|
3125 | throw new Error('rules must be Array');
|
3126 |
|
3127 | case 3:
|
3128 | params = this._bucketRequestParams('PUT', name, 'lifecycle', options);
|
3129 | Rule = [];
|
3130 | paramXMLObj = {
|
3131 | LifecycleConfiguration: {
|
3132 | Rule: Rule
|
3133 | }
|
3134 | };
|
3135 | rules.forEach(function (_) {
|
3136 | defaultDaysAndDate2Expiration(_);
|
3137 |
|
3138 | checkRule(_);
|
3139 |
|
3140 | if (_.id) {
|
3141 | _.ID = _.id;
|
3142 | delete _.id;
|
3143 | }
|
3144 |
|
3145 | Rule.push(_);
|
3146 | });
|
3147 | paramXML = obj2xml(paramXMLObj, {
|
3148 | headers: true,
|
3149 | firstUpperCase: true
|
3150 | });
|
3151 | params.content = paramXML;
|
3152 | params.mime = 'xml';
|
3153 | params.successStatuses = [200];
|
3154 | _context.next = 13;
|
3155 | return this.request(params);
|
3156 |
|
3157 | case 13:
|
3158 | result = _context.sent;
|
3159 | return _context.abrupt("return", {
|
3160 | res: result.res
|
3161 | });
|
3162 |
|
3163 | case 15:
|
3164 | case "end":
|
3165 | return _context.stop();
|
3166 | }
|
3167 | }
|
3168 | }, _callee, this);
|
3169 | }));
|
3170 |
|
3171 | function putBucketLifecycle(_x, _x2, _x3) {
|
3172 | return _putBucketLifecycle.apply(this, arguments);
|
3173 | }
|
3174 |
|
3175 | return putBucketLifecycle;
|
3176 | }();
|
3177 |
|
3178 |
|
3179 | function defaultDaysAndDate2Expiration(obj) {
|
3180 | if (obj.days) {
|
3181 | obj.expiration = {
|
3182 | days: obj.days
|
3183 | };
|
3184 | }
|
3185 |
|
3186 | if (obj.date) {
|
3187 | obj.expiration = {
|
3188 | createdBeforeDate: obj.date
|
3189 | };
|
3190 | }
|
3191 | }
|
3192 |
|
3193 | function checkDaysAndDate(obj, key) {
|
3194 | var days = obj.days,
|
3195 | createdBeforeDate = obj.createdBeforeDate;
|
3196 |
|
3197 | if (!days && !createdBeforeDate) {
|
3198 | throw new Error("".concat(key, " must includes days or createdBeforeDate"));
|
3199 | } else if (days && !/^[1-9][0-9]*$/.test(days)) {
|
3200 | throw new Error('days must be a positive integer');
|
3201 | } else if (createdBeforeDate && !/\d{4}-\d{2}-\d{2}T00:00:00.000Z/.test(createdBeforeDate)) {
|
3202 | throw new Error('createdBeforeDate must be date and conform to iso8601 format');
|
3203 | }
|
3204 | }
|
3205 |
|
3206 | function handleCheckTag(tag) {
|
3207 | if (!isArray(tag) && !isObject(tag)) {
|
3208 | throw new Error('tag must be Object or Array');
|
3209 | }
|
3210 |
|
3211 | tag = isObject(tag) ? [tag] : tag;
|
3212 | var tagObj = {};
|
3213 | var tagClone = deepCopy(tag);
|
3214 | tagClone.forEach(function (v) {
|
3215 | tagObj[v.key] = v.value;
|
3216 | });
|
3217 | checkObjectTag(tagObj);
|
3218 | }
|
3219 |
|
3220 | function checkRule(rule) {
|
3221 | if (rule.id && getStrBytesCount(rule.id) > 255) throw new Error('ID is composed of 255 bytes at most');
|
3222 | if (rule.prefix === undefined) throw new Error('Rule must includes prefix');
|
3223 | if (!['Enabled', 'Disabled'].includes(rule.status)) throw new Error('Status must be Enabled or Disabled');
|
3224 |
|
3225 | if (rule.transition) {
|
3226 | if (!['IA', 'Archive'].includes(rule.transition.storageClass)) throw new Error('StorageClass must be IA or Archive');
|
3227 | checkDaysAndDate(rule.transition, 'Transition');
|
3228 | }
|
3229 |
|
3230 | if (rule.expiration) {
|
3231 | if (!rule.expiration.expiredObjectDeleteMarker) {
|
3232 | checkDaysAndDate(rule.expiration, 'Expiration');
|
3233 | } else if (rule.expiration.days || rule.expiration.createdBeforeDate) {
|
3234 | throw new Error('expiredObjectDeleteMarker cannot be used with days or createdBeforeDate');
|
3235 | }
|
3236 | }
|
3237 |
|
3238 | if (rule.abortMultipartUpload) {
|
3239 | checkDaysAndDate(rule.abortMultipartUpload, 'AbortMultipartUpload');
|
3240 | }
|
3241 |
|
3242 | if (!rule.expiration && !rule.abortMultipartUpload && !rule.transition && !rule.noncurrentVersionTransition) {
|
3243 | throw new Error('Rule must includes expiration or abortMultipartUpload or transition or noncurrentVersionTransition');
|
3244 | }
|
3245 |
|
3246 | if (rule.tag) {
|
3247 | if (rule.abortMultipartUpload) {
|
3248 | throw new Error('Tag cannot be used with abortMultipartUpload');
|
3249 | }
|
3250 |
|
3251 | handleCheckTag(rule.tag);
|
3252 | }
|
3253 | }
|
3254 |
|
3255 | },{"../utils/checkBucketName":48,"../utils/checkObjectTag":50,"../utils/deepCopy":54,"../utils/getStrBytesCount":58,"../utils/isArray":59,"../utils/isObject":64,"../utils/obj2xml":66,"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"core-js/modules/es.array.for-each":238,"core-js/modules/es.array.includes":240,"core-js/modules/web.dom-collections.for-each":292,"regenerator-runtime/runtime":337}],21:[function(require,module,exports){
|
3256 | "use strict";
|
3257 |
|
3258 | var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
3259 |
|
3260 | require("core-js/modules/es.array.includes");
|
3261 |
|
3262 | var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
3263 |
|
3264 | require("regenerator-runtime/runtime");
|
3265 |
|
3266 | var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
3267 |
|
3268 | var _require = require('../utils/checkBucketName'),
|
3269 | _checkBucketName = _require.checkBucketName;
|
3270 |
|
3271 | var _require2 = require('../utils/obj2xml'),
|
3272 | obj2xml = _require2.obj2xml;
|
3273 |
|
3274 | var proto = exports;
|
3275 |
|
3276 |
|
3277 |
|
3278 |
|
3279 |
|
3280 |
|
3281 |
|
3282 | proto.putBucketVersioning = function () {
|
3283 | var _putBucketVersioning = (0, _asyncToGenerator2.default)( _regenerator.default.mark(function _callee(name, status) {
|
3284 | var options,
|
3285 | params,
|
3286 | paramXMLObj,
|
3287 | result,
|
3288 | _args = arguments;
|
3289 | return _regenerator.default.wrap(function _callee$(_context) {
|
3290 | while (1) {
|
3291 | switch (_context.prev = _context.next) {
|
3292 | case 0:
|
3293 | options = _args.length > 2 && _args[2] !== undefined ? _args[2] : {};
|
3294 |
|
3295 | _checkBucketName(name);
|
3296 |
|
3297 | if (['Enabled', 'Suspended'].includes(status)) {
|
3298 | _context.next = 4;
|
3299 | break;
|
3300 | }
|
3301 |
|
3302 | throw new Error('status must be Enabled or Suspended');
|
3303 |
|
3304 | case 4:
|
3305 | params = this._bucketRequestParams('PUT', name, 'versioning', options);
|
3306 | paramXMLObj = {
|
3307 | VersioningConfiguration: {
|
3308 | Status: status
|
3309 | }
|
3310 | };
|
3311 | params.mime = 'xml';
|
3312 | params.content = obj2xml(paramXMLObj, {
|
3313 | headers: true
|
3314 | });
|
3315 | _context.next = 10;
|
3316 | return this.request(params);
|
3317 |
|
3318 | case 10:
|
3319 | result = _context.sent;
|
3320 | return _context.abrupt("return", {
|
3321 | res: result.res,
|
3322 | status: result.status
|
3323 | });
|
3324 |
|
3325 | case 12:
|
3326 | case "end":
|
3327 | return _context.stop();
|
3328 | }
|
3329 | }
|
3330 | }, _callee, this);
|
3331 | }));
|
3332 |
|
3333 | function putBucketVersioning(_x, _x2) {
|
3334 | return _putBucketVersioning.apply(this, arguments);
|
3335 | }
|
3336 |
|
3337 | return putBucketVersioning;
|
3338 | }();
|
3339 |
|
3340 | },{"../utils/checkBucketName":48,"../utils/obj2xml":66,"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"core-js/modules/es.array.includes":240,"regenerator-runtime/runtime":337}],22:[function(require,module,exports){
|
3341 | "use strict";
|
3342 |
|
3343 | var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
3344 |
|
3345 | var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
3346 |
|
3347 | require("regenerator-runtime/runtime");
|
3348 |
|
3349 | var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
3350 |
|
3351 | var _require = require('../utils/checkBucketName'),
|
3352 | _checkBucketName = _require.checkBucketName;
|
3353 |
|
3354 | var _require2 = require('../utils/obj2xml'),
|
3355 | obj2xml = _require2.obj2xml;
|
3356 |
|
3357 | var _require3 = require('../utils/isArray'),
|
3358 | isArray = _require3.isArray;
|
3359 |
|
3360 | var proto = exports;
|
3361 |
|
3362 | proto.putBucketWebsite = function () {
|
3363 | var _putBucketWebsite = (0, _asyncToGenerator2.default)( _regenerator.default.mark(function _callee(name) {
|
3364 | var config,
|
3365 | options,
|
3366 | params,
|
3367 | IndexDocument,
|
3368 | WebsiteConfiguration,
|
3369 | website,
|
3370 | result,
|
3371 | _args = arguments;
|
3372 | return _regenerator.default.wrap(function _callee$(_context) {
|
3373 | while (1) {
|
3374 | switch (_context.prev = _context.next) {
|
3375 | case 0:
|
3376 | config = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
|
3377 | options = _args.length > 2 ? _args[2] : undefined;
|
3378 |
|
3379 | _checkBucketName(name);
|
3380 |
|
3381 | params = this._bucketRequestParams('PUT', name, 'website', options);
|
3382 | IndexDocument = {
|
3383 | Suffix: config.index || 'index.html'
|
3384 | };
|
3385 | WebsiteConfiguration = {
|
3386 | IndexDocument: IndexDocument
|
3387 | };
|
3388 | website = {
|
3389 | WebsiteConfiguration: WebsiteConfiguration
|
3390 | };
|
3391 |
|
3392 | if (config.supportSubDir) {
|
3393 | IndexDocument.SupportSubDir = config.supportSubDir;
|
3394 | }
|
3395 |
|
3396 | if (config.type) {
|
3397 | IndexDocument.Type = config.type;
|
3398 | }
|
3399 |
|
3400 | if (config.error) {
|
3401 | WebsiteConfiguration.ErrorDocument = {
|
3402 | Key: config.error
|
3403 | };
|
3404 | }
|
3405 |
|
3406 | if (!(config.routingRules !== undefined)) {
|
3407 | _context.next = 14;
|
3408 | break;
|
3409 | }
|
3410 |
|
3411 | if (isArray(config.routingRules)) {
|
3412 | _context.next = 13;
|
3413 | break;
|
3414 | }
|
3415 |
|
3416 | throw new Error('RoutingRules must be Array');
|
3417 |
|
3418 | case 13:
|
3419 | WebsiteConfiguration.RoutingRules = {
|
3420 | RoutingRule: config.routingRules
|
3421 | };
|
3422 |
|
3423 | case 14:
|
3424 | website = obj2xml(website);
|
3425 | params.content = website;
|
3426 | params.mime = 'xml';
|
3427 | params.successStatuses = [200];
|
3428 | _context.next = 20;
|
3429 | return this.request(params);
|
3430 |
|
3431 | case 20:
|
3432 | result = _context.sent;
|
3433 | return _context.abrupt("return", {
|
3434 | res: result.res
|
3435 | });
|
3436 |
|
3437 | case 22:
|
3438 | case "end":
|
3439 | return _context.stop();
|
3440 | }
|
3441 | }
|
3442 | }, _callee, this);
|
3443 | }));
|
3444 |
|
3445 | function putBucketWebsite(_x) {
|
3446 | return _putBucketWebsite.apply(this, arguments);
|
3447 | }
|
3448 |
|
3449 | return putBucketWebsite;
|
3450 | }();
|
3451 |
|
3452 | },{"../utils/checkBucketName":48,"../utils/isArray":59,"../utils/obj2xml":66,"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"regenerator-runtime/runtime":337}],23:[function(require,module,exports){
|
3453 | (function (Buffer){
|
3454 | "use strict";
|
3455 |
|
3456 | require("core-js/modules/es.array.for-each");
|
3457 |
|
3458 | require("core-js/modules/es.object.keys");
|
3459 |
|
3460 | require("core-js/modules/es.object.to-string");
|
3461 |
|
3462 | require("core-js/modules/es.regexp.to-string");
|
3463 |
|
3464 | require("core-js/modules/web.dom-collections.for-each");
|
3465 |
|
3466 | exports.encodeCallback = function encodeCallback(reqParams, options) {
|
3467 | reqParams.headers = reqParams.headers || {};
|
3468 |
|
3469 | if (!Object.prototype.hasOwnProperty.call(reqParams.headers, 'x-oss-callback')) {
|
3470 | if (options.callback) {
|
3471 | var json = {
|
3472 | callbackUrl: encodeURI(options.callback.url),
|
3473 | callbackBody: options.callback.body
|
3474 | };
|
3475 |
|
3476 | if (options.callback.host) {
|
3477 | json.callbackHost = options.callback.host;
|
3478 | }
|
3479 |
|
3480 | if (options.callback.contentType) {
|
3481 | json.callbackBodyType = options.callback.contentType;
|
3482 | }
|
3483 |
|
3484 | var callback = Buffer.from(JSON.stringify(json)).toString('base64');
|
3485 | reqParams.headers['x-oss-callback'] = callback;
|
3486 |
|
3487 | if (options.callback.customValue) {
|
3488 | var callbackVar = {};
|
3489 | Object.keys(options.callback.customValue).forEach(function (key) {
|
3490 | callbackVar["x:".concat(key)] = options.callback.customValue[key];
|
3491 | });
|
3492 | reqParams.headers['x-oss-callback-var'] = Buffer.from(JSON.stringify(callbackVar)).toString('base64');
|
3493 | }
|
3494 | }
|
3495 | }
|
3496 | };
|
3497 |
|
3498 | }).call(this,require("buffer").Buffer)
|
3499 | },{"buffer":98,"core-js/modules/es.array.for-each":238,"core-js/modules/es.object.keys":253,"core-js/modules/es.object.to-string":254,"core-js/modules/es.regexp.to-string":257,"core-js/modules/web.dom-collections.for-each":292}],24:[function(require,module,exports){
|
3500 | "use strict";
|
3501 |
|
3502 | require("core-js/modules/es.array.concat");
|
3503 |
|
3504 | require("core-js/modules/es.array.for-each");
|
3505 |
|
3506 | require("core-js/modules/es.regexp.exec");
|
3507 |
|
3508 | require("core-js/modules/es.string.replace");
|
3509 |
|
3510 | require("core-js/modules/web.dom-collections.for-each");
|
3511 |
|
3512 | var __importDefault = void 0 && (void 0).__importDefault || function (mod) {
|
3513 | return mod && mod.__esModule ? mod : {
|
3514 | "default": mod
|
3515 | };
|
3516 | };
|
3517 |
|
3518 | Object.defineProperty(exports, "__esModule", {
|
3519 | value: true
|
3520 | });
|
3521 | exports.getReqUrl = void 0;
|
3522 |
|
3523 | var copy_to_1 = __importDefault(require("copy-to"));
|
3524 |
|
3525 | var url_1 = __importDefault(require("url"));
|
3526 |
|
3527 | var merge_descriptors_1 = __importDefault(require("merge-descriptors"));
|
3528 |
|
3529 | var is_type_of_1 = __importDefault(require("is-type-of"));
|
3530 |
|
3531 | var isIP_1 = require("../utils/isIP");
|
3532 |
|
3533 | var checkConfigValid_1 = require("../utils/checkConfigValid");
|
3534 |
|
3535 | function getReqUrl(params) {
|
3536 | var ep = {};
|
3537 | var isCname = this.options.cname;
|
3538 | checkConfigValid_1.checkConfigValid(this.options.endpoint, 'endpoint');
|
3539 | copy_to_1.default(this.options.endpoint, false).to(ep);
|
3540 |
|
3541 | if (params.bucket && !isCname && !isIP_1.isIP(ep.hostname) && !this.options.sldEnable) {
|
3542 | ep.host = "".concat(params.bucket, ".").concat(ep.host);
|
3543 | }
|
3544 |
|
3545 | var resourcePath = '/';
|
3546 |
|
3547 | if (params.bucket && this.options.sldEnable) {
|
3548 | resourcePath += "".concat(params.bucket, "/");
|
3549 | }
|
3550 |
|
3551 | if (params.object) {
|
3552 |
|
3553 | resourcePath += this._escape(params.object).replace(/\+/g, '%2B');
|
3554 | }
|
3555 |
|
3556 | ep.pathname = resourcePath;
|
3557 | var query = {};
|
3558 |
|
3559 | if (params.query) {
|
3560 | merge_descriptors_1.default(query, params.query);
|
3561 | }
|
3562 |
|
3563 | if (params.subres) {
|
3564 | var subresAsQuery = {};
|
3565 |
|
3566 | if (is_type_of_1.default.string(params.subres)) {
|
3567 | subresAsQuery[params.subres] = '';
|
3568 | } else if (is_type_of_1.default.array(params.subres)) {
|
3569 | params.subres.forEach(function (k) {
|
3570 | subresAsQuery[k] = '';
|
3571 | });
|
3572 | } else {
|
3573 | subresAsQuery = params.subres;
|
3574 | }
|
3575 |
|
3576 | merge_descriptors_1.default(query, subresAsQuery);
|
3577 | }
|
3578 |
|
3579 | ep.query = query;
|
3580 | return url_1.default.format(ep);
|
3581 | }
|
3582 |
|
3583 | exports.getReqUrl = getReqUrl;
|
3584 |
|
3585 | },{"../utils/checkConfigValid":49,"../utils/isIP":63,"copy-to":101,"core-js/modules/es.array.concat":234,"core-js/modules/es.array.for-each":238,"core-js/modules/es.regexp.exec":256,"core-js/modules/es.string.replace":261,"core-js/modules/web.dom-collections.for-each":292,"is-type-of":392,"merge-descriptors":311,"url":394}],25:[function(require,module,exports){
|
3586 | "use strict";
|
3587 |
|
3588 | require("core-js/modules/es.array.concat");
|
3589 |
|
3590 | require("core-js/modules/es.object.assign");
|
3591 |
|
3592 | require("core-js/modules/es.string.trim");
|
3593 |
|
3594 | var ms = require('humanize-ms');
|
3595 |
|
3596 | var urlutil = require('url');
|
3597 |
|
3598 | var _require = require('../utils/checkBucketName'),
|
3599 | _checkBucketName = _require.checkBucketName;
|
3600 |
|
3601 | var _require2 = require('../utils/setRegion'),
|
3602 | setRegion = _require2.setRegion;
|
3603 |
|
3604 | var _require3 = require('../utils/checkConfigValid'),
|
3605 | checkConfigValid = _require3.checkConfigValid;
|
3606 |
|
3607 | function setEndpoint(endpoint, secure) {
|
3608 | checkConfigValid(endpoint, 'endpoint');
|
3609 | var url = urlutil.parse(endpoint);
|
3610 |
|
3611 | if (!url.protocol) {
|
3612 | url = urlutil.parse("http".concat(secure ? 's' : '', "://").concat(endpoint));
|
3613 | }
|
3614 |
|
3615 | if (url.protocol !== 'http:' && url.protocol !== 'https:') {
|
3616 | throw new Error('Endpoint protocol must be http or https.');
|
3617 | }
|
3618 |
|
3619 | return url;
|
3620 | }
|
3621 |
|
3622 | module.exports = function (options) {
|
3623 | if (!options || !options.accessKeyId || !options.accessKeySecret) {
|
3624 | throw new Error('require accessKeyId, accessKeySecret');
|
3625 | }
|
3626 |
|
3627 | if (options.bucket) {
|
3628 | _checkBucketName(options.bucket);
|
3629 | }
|
3630 |
|
3631 | var opts = Object.assign({
|
3632 | region: 'oss-cn-hangzhou',
|
3633 | internal: false,
|
3634 | secure: false,
|
3635 | timeout: 60000,
|
3636 | bucket: null,
|
3637 | endpoint: null,
|
3638 | cname: false,
|
3639 | isRequestPay: false,
|
3640 | sldEnable: false,
|
3641 | headerEncoding: 'utf-8',
|
3642 | refreshSTSToken: null
|
3643 | }, options);
|
3644 | opts.accessKeyId = opts.accessKeyId.trim();
|
3645 | opts.accessKeySecret = opts.accessKeySecret.trim();
|
3646 |
|
3647 | if (opts.timeout) {
|
3648 | opts.timeout = ms(opts.timeout);
|
3649 | }
|
3650 |
|
3651 | if (opts.endpoint) {
|
3652 | opts.endpoint = setEndpoint(opts.endpoint, opts.secure);
|
3653 | } else if (opts.region) {
|
3654 | opts.endpoint = setRegion(opts.region, opts.internal, opts.secure);
|
3655 | } else {
|
3656 | throw new Error('require options.endpoint or options.region');
|
3657 | }
|
3658 |
|
3659 | opts.inited = true;
|
3660 | return opts;
|
3661 | };
|
3662 |
|
3663 | },{"../utils/checkBucketName":48,"../utils/checkConfigValid":49,"../utils/setRegion":68,"core-js/modules/es.array.concat":234,"core-js/modules/es.object.assign":251,"core-js/modules/es.string.trim":265,"humanize-ms":299,"url":394}],26:[function(require,module,exports){
|
3664 | "use strict";
|
3665 |
|
3666 | var merge = require('merge-descriptors');
|
3667 |
|
3668 | var proto = exports;
|
3669 | merge(proto, require('./processObjectSave'));
|
3670 |
|
3671 | },{"./processObjectSave":27,"merge-descriptors":311}],27:[function(require,module,exports){
|
3672 | "use strict";
|
3673 |
|
3674 | var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
3675 |
|
3676 | require("core-js/modules/es.array.concat");
|
3677 |
|
3678 | var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
3679 |
|
3680 | require("regenerator-runtime/runtime");
|
3681 |
|
3682 | var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
3683 |
|
3684 |
|
3685 | var _require = require('../utils/checkBucketName'),
|
3686 | _checkBucketName = _require.checkBucketName;
|
3687 |
|
3688 | var querystring = require('querystring');
|
3689 |
|
3690 | var _require2 = require('js-base64'),
|
3691 | str2Base64 = _require2.Base64.encode;
|
3692 |
|
3693 | var proto = exports;
|
3694 |
|
3695 | proto.processObjectSave = function () {
|
3696 | var _processObjectSave = (0, _asyncToGenerator2.default)( _regenerator.default.mark(function _callee(sourceObject, targetObject, process, targetBucket) {
|
3697 | var params, bucketParam, content, result;
|
3698 | return _regenerator.default.wrap(function _callee$(_context) {
|
3699 | while (1) {
|
3700 | switch (_context.prev = _context.next) {
|
3701 | case 0:
|
3702 | checkArgs(sourceObject, 'sourceObject');
|
3703 | checkArgs(targetObject, 'targetObject');
|
3704 | checkArgs(process, 'process');
|
3705 | targetObject = this._objectName(targetObject);
|
3706 |
|
3707 | if (targetBucket) {
|
3708 | _checkBucketName(targetBucket);
|
3709 | }
|
3710 |
|
3711 | params = this._objectRequestParams('POST', sourceObject, {
|
3712 | subres: 'x-oss-process'
|
3713 | });
|
3714 | bucketParam = targetBucket ? ",b_".concat(str2Base64(targetBucket)) : '';
|
3715 | targetObject = str2Base64(targetObject);
|
3716 | content = {
|
3717 | 'x-oss-process': "".concat(process, "|sys/saveas,o_").concat(targetObject).concat(bucketParam)
|
3718 | };
|
3719 | params.content = querystring.stringify(content);
|
3720 | _context.next = 12;
|
3721 | return this.request(params);
|
3722 |
|
3723 | case 12:
|
3724 | result = _context.sent;
|
3725 | return _context.abrupt("return", {
|
3726 | res: result.res,
|
3727 | status: result.res.status
|
3728 | });
|
3729 |
|
3730 | case 14:
|
3731 | case "end":
|
3732 | return _context.stop();
|
3733 | }
|
3734 | }
|
3735 | }, _callee, this);
|
3736 | }));
|
3737 |
|
3738 | function processObjectSave(_x, _x2, _x3, _x4) {
|
3739 | return _processObjectSave.apply(this, arguments);
|
3740 | }
|
3741 |
|
3742 | return processObjectSave;
|
3743 | }();
|
3744 |
|
3745 | function checkArgs(name, key) {
|
3746 | if (!name) {
|
3747 | throw new Error("".concat(key, " is required"));
|
3748 | }
|
3749 |
|
3750 | if (typeof name !== 'string') {
|
3751 | throw new Error("".concat(key, " must be String"));
|
3752 | }
|
3753 | }
|
3754 |
|
3755 | },{"../utils/checkBucketName":48,"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"core-js/modules/es.array.concat":234,"js-base64":310,"querystring":323,"regenerator-runtime/runtime":337}],28:[function(require,module,exports){
|
3756 | "use strict";
|
3757 |
|
3758 | var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
3759 |
|
3760 | require("core-js/modules/es.array.concat");
|
3761 |
|
3762 | require("core-js/modules/es.array.filter");
|
3763 |
|
3764 | require("core-js/modules/es.array.map");
|
3765 |
|
3766 | require("core-js/modules/es.array.sort");
|
3767 |
|
3768 | require("core-js/modules/es.object.to-string");
|
3769 |
|
3770 | require("core-js/modules/es.regexp.to-string");
|
3771 |
|
3772 | var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
3773 |
|
3774 | require("regenerator-runtime/runtime");
|
3775 |
|
3776 | var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
3777 |
|
3778 | var copy = require('copy-to');
|
3779 |
|
3780 | var callback = require('./callback');
|
3781 |
|
3782 | var _require = require('./utils/deepCopy'),
|
3783 | deepCopyWith = _require.deepCopyWith;
|
3784 |
|
3785 | var _require2 = require('./utils/isBuffer'),
|
3786 | isBuffer = _require2.isBuffer;
|
3787 |
|
3788 | var proto = exports;
|
3789 |
|
3790 |
|
3791 |
|
3792 |
|
3793 |
|
3794 |
|
3795 |
|
3796 | proto.listUploads = function () {
|
3797 | var _listUploads = (0, _asyncToGenerator2.default)( _regenerator.default.mark(function _callee(query, options) {
|
3798 | var opt, params, result, uploads;
|
3799 | return _regenerator.default.wrap(function _callee$(_context) {
|
3800 | while (1) {
|
3801 | switch (_context.prev = _context.next) {
|
3802 | case 0:
|
3803 | options = options || {};
|
3804 | opt = {};
|
3805 | copy(options).to(opt);
|
3806 | opt.subres = 'uploads';
|
3807 | params = this._objectRequestParams('GET', '', opt);
|
3808 | params.query = query;
|
3809 | params.xmlResponse = true;
|
3810 | params.successStatuses = [200];
|
3811 | _context.next = 10;
|
3812 | return this.request(params);
|
3813 |
|
3814 | case 10:
|
3815 | result = _context.sent;
|
3816 | uploads = result.data.Upload || [];
|
3817 |
|
3818 | if (!Array.isArray(uploads)) {
|
3819 | uploads = [uploads];
|
3820 | }
|
3821 |
|
3822 | uploads = uploads.map(function (up) {
|
3823 | return {
|
3824 | name: up.Key,
|
3825 | uploadId: up.UploadId,
|
3826 | initiated: up.Initiated
|
3827 | };
|
3828 | });
|
3829 | return _context.abrupt("return", {
|
3830 | res: result.res,
|
3831 | uploads: uploads,
|
3832 | bucket: result.data.Bucket,
|
3833 | nextKeyMarker: result.data.NextKeyMarker,
|
3834 | nextUploadIdMarker: result.data.NextUploadIdMarker,
|
3835 | isTruncated: result.data.IsTruncated === 'true'
|
3836 | });
|
3837 |
|
3838 | case 15:
|
3839 | case "end":
|
3840 | return _context.stop();
|
3841 | }
|
3842 | }
|
3843 | }, _callee, this);
|
3844 | }));
|
3845 |
|
3846 | function listUploads(_x, _x2) {
|
3847 | return _listUploads.apply(this, arguments);
|
3848 | }
|
3849 |
|
3850 | return listUploads;
|
3851 | }();
|
3852 |
|
3853 |
|
3854 |
|
3855 |
|
3856 |
|
3857 |
|
3858 |
|
3859 |
|
3860 |
|
3861 |
|
3862 |
|
3863 |
|
3864 |
|
3865 | proto.listParts = function () {
|
3866 | var _listParts = (0, _asyncToGenerator2.default)( _regenerator.default.mark(function _callee2(name, uploadId, query, options) {
|
3867 | var opt, params, result;
|
3868 | return _regenerator.default.wrap(function _callee2$(_context2) {
|
3869 | while (1) {
|
3870 | switch (_context2.prev = _context2.next) {
|
3871 | case 0:
|
3872 | options = options || {};
|
3873 | opt = {};
|
3874 | copy(options).to(opt);
|
3875 | opt.subres = {
|
3876 | uploadId: uploadId
|
3877 | };
|
3878 | params = this._objectRequestParams('GET', name, opt);
|
3879 | params.query = query;
|
3880 | params.xmlResponse = true;
|
3881 | params.successStatuses = [200];
|
3882 | _context2.next = 10;
|
3883 | return this.request(params);
|
3884 |
|
3885 | case 10:
|
3886 | result = _context2.sent;
|
3887 | return _context2.abrupt("return", {
|
3888 | res: result.res,
|
3889 | uploadId: result.data.UploadId,
|
3890 | bucket: result.data.Bucket,
|
3891 | name: result.data.Key,
|
3892 | partNumberMarker: result.data.PartNumberMarker,
|
3893 | nextPartNumberMarker: result.data.NextPartNumberMarker,
|
3894 | maxParts: result.data.MaxParts,
|
3895 | isTruncated: result.data.IsTruncated,
|
3896 | parts: result.data.Part || []
|
3897 | });
|
3898 |
|
3899 | case 12:
|
3900 | case "end":
|
3901 | return _context2.stop();
|
3902 | }
|
3903 | }
|
3904 | }, _callee2, this);
|
3905 | }));
|
3906 |
|
3907 | function listParts(_x3, _x4, _x5, _x6) {
|
3908 | return _listParts.apply(this, arguments);
|
3909 | }
|
3910 |
|
3911 | return listParts;
|
3912 | }();
|
3913 |
|
3914 |
|
3915 |
|
3916 |
|
3917 |
|
3918 |
|
3919 |
|
3920 |
|
3921 | proto.abortMultipartUpload = function () {
|
3922 | var _abortMultipartUpload = (0, _asyncToGenerator2.default)( _regenerator.default.mark(function _callee3(name, uploadId, options) {
|
3923 | var opt, params, result;
|
3924 | return _regenerator.default.wrap(function _callee3$(_context3) {
|
3925 | while (1) {
|
3926 | switch (_context3.prev = _context3.next) {
|
3927 | case 0:
|
3928 | this._stop();
|
3929 |
|
3930 | options = options || {};
|
3931 | opt = {};
|
3932 | copy(options).to(opt);
|
3933 | opt.subres = {
|
3934 | uploadId: uploadId
|
3935 | };
|
3936 | params = this._objectRequestParams('DELETE', name, opt);
|
3937 | params.successStatuses = [204];
|
3938 | _context3.next = 9;
|
3939 | return this.request(params);
|
3940 |
|
3941 | case 9:
|
3942 | result = _context3.sent;
|
3943 | return _context3.abrupt("return", {
|
3944 | res: result.res
|
3945 | });
|
3946 |
|
3947 | case 11:
|
3948 | case "end":
|
3949 | return _context3.stop();
|
3950 | }
|
3951 | }
|
3952 | }, _callee3, this);
|
3953 | }));
|
3954 |
|
3955 | function abortMultipartUpload(_x7, _x8, _x9) {
|
3956 | return _abortMultipartUpload.apply(this, arguments);
|
3957 | }
|
3958 |
|
3959 | return abortMultipartUpload;
|
3960 | }();
|
3961 |
|
3962 |
|
3963 |
|
3964 |
|
3965 |
|
3966 |
|
3967 |
|
3968 |
|
3969 | proto.initMultipartUpload = function () {
|
3970 | var _initMultipartUpload = (0, _asyncToGenerator2.default)( _regenerator.default.mark(function _callee4(name, options) {
|
3971 | var opt, params, result;
|
3972 | return _regenerator.default.wrap(function _callee4$(_context4) {
|
3973 | while (1) {
|
3974 | switch (_context4.prev = _context4.next) {
|
3975 | case 0:
|
3976 | options = options || {};
|
3977 | opt = {};
|
3978 | copy(options).to(opt);
|
3979 | opt.headers = opt.headers || {};
|
3980 |
|
3981 | this._convertMetaToHeaders(options.meta, opt.headers);
|
3982 |
|
3983 | opt.subres = 'uploads';
|
3984 | params = this._objectRequestParams('POST', name, opt);
|
3985 | params.mime = options.mime;
|
3986 | params.xmlResponse = true;
|
3987 | params.successStatuses = [200];
|
3988 | _context4.next = 12;
|
3989 | return this.request(params);
|
3990 |
|
3991 | case 12:
|
3992 | result = _context4.sent;
|
3993 | return _context4.abrupt("return", {
|
3994 | res: result.res,
|
3995 | bucket: result.data.Bucket,
|
3996 | name: result.data.Key,
|
3997 | uploadId: result.data.UploadId
|
3998 | });
|
3999 |
|
4000 | case 14:
|
4001 | case "end":
|
4002 | return _context4.stop();
|
4003 | }
|
4004 | }
|
4005 | }, _callee4, this);
|
4006 | }));
|
4007 |
|
4008 | function initMultipartUpload(_x10, _x11) {
|
4009 | return _initMultipartUpload.apply(this, arguments);
|
4010 | }
|
4011 |
|
4012 | return initMultipartUpload;
|
4013 | }();
|
4014 |
|
4015 |
|
4016 |
|
4017 |
|
4018 |
|
4019 |
|
4020 |
|
4021 |
|
4022 |
|
4023 |
|
4024 |
|
4025 |
|
4026 | proto.uploadPart = function () {
|
4027 | var _uploadPart2 = (0, _asyncToGenerator2.default)( _regenerator.default.mark(function _callee5(name, uploadId, partNo, file, start, end, options) {
|
4028 | var data;
|
4029 | return _regenerator.default.wrap(function _callee5$(_context5) {
|
4030 | while (1) {
|
4031 | switch (_context5.prev = _context5.next) {
|
4032 | case 0:
|
4033 | data = {
|
4034 | stream: this._createStream(file, start, end),
|
4035 | size: end - start
|
4036 | };
|
4037 | _context5.next = 3;
|
4038 | return this._uploadPart(name, uploadId, partNo, data, options);
|
4039 |
|
4040 | case 3:
|
4041 | return _context5.abrupt("return", _context5.sent);
|
4042 |
|
4043 | case 4:
|
4044 | case "end":
|
4045 | return _context5.stop();
|
4046 | }
|
4047 | }
|
4048 | }, _callee5, this);
|
4049 | }));
|
4050 |
|
4051 | function uploadPart(_x12, _x13, _x14, _x15, _x16, _x17, _x18) {
|
4052 | return _uploadPart2.apply(this, arguments);
|
4053 | }
|
4054 |
|
4055 | return uploadPart;
|
4056 | }();
|
4057 |
|
4058 |
|
4059 |
|
4060 |
|
4061 |
|
4062 |
|
4063 |
|
4064 |
|
4065 |
|
4066 |
|
4067 |
|
4068 |
|
4069 |
|
4070 |
|
4071 |
|
4072 |
|
4073 |
|
4074 |
|
4075 |
|
4076 |
|
4077 |
|
4078 | proto.completeMultipartUpload = function () {
|
4079 | var _completeMultipartUpload = (0, _asyncToGenerator2.default)( _regenerator.default.mark(function _callee6(name, uploadId, parts, options) {
|
4080 | var completeParts, xml, i, p, opt, params, result, ret;
|
4081 | return _regenerator.default.wrap(function _callee6$(_context6) {
|
4082 | while (1) {
|
4083 | switch (_context6.prev = _context6.next) {
|
4084 | case 0:
|
4085 | completeParts = parts.concat().sort(function (a, b) {
|
4086 | return a.number - b.number;
|
4087 | }).filter(function (item, index, arr) {
|
4088 | return !index || item.number !== arr[index - 1].number;
|
4089 | });
|
4090 | xml = '<?xml version="1.0" encoding="UTF-8"?>\n<CompleteMultipartUpload>\n';
|
4091 |
|
4092 | for (i = 0; i < completeParts.length; i++) {
|
4093 | p = completeParts[i];
|
4094 | xml += '<Part>\n';
|
4095 | xml += "<PartNumber>".concat(p.number, "</PartNumber>\n");
|
4096 | xml += "<ETag>".concat(p.etag, "</ETag>\n");
|
4097 | xml += '</Part>\n';
|
4098 | }
|
4099 |
|
4100 | xml += '</CompleteMultipartUpload>';
|
4101 | options = options || {};
|
4102 | opt = {};
|
4103 | opt = deepCopyWith(options, function (_) {
|
4104 | if (isBuffer(_)) return null;
|
4105 | });
|
4106 | if (opt.headers) delete opt.headers['x-oss-server-side-encryption'];
|
4107 | opt.subres = {
|
4108 | uploadId: uploadId
|
4109 | };
|
4110 | params = this._objectRequestParams('POST', name, opt);
|
4111 | callback.encodeCallback(params, opt);
|
4112 | params.mime = 'xml';
|
4113 | params.content = xml;
|
4114 |
|
4115 | if (!(params.headers && params.headers['x-oss-callback'])) {
|
4116 | params.xmlResponse = true;
|
4117 | }
|
4118 |
|
4119 | params.successStatuses = [200];
|
4120 | _context6.next = 17;
|
4121 | return this.request(params);
|
4122 |
|
4123 | case 17:
|
4124 | result = _context6.sent;
|
4125 | ret = {
|
4126 | res: result.res,
|
4127 | bucket: params.bucket,
|
4128 | name: name,
|
4129 | etag: result.res.headers.etag
|
4130 | };
|
4131 |
|
4132 | if (params.headers && params.headers['x-oss-callback']) {
|
4133 | ret.data = JSON.parse(result.data.toString());
|
4134 | }
|
4135 |
|
4136 | return _context6.abrupt("return", ret);
|
4137 |
|
4138 | case 21:
|
4139 | case "end":
|
4140 | return _context6.stop();
|
4141 | }
|
4142 | }
|
4143 | }, _callee6, this);
|
4144 | }));
|
4145 |
|
4146 | function completeMultipartUpload(_x19, _x20, _x21, _x22) {
|
4147 | return _completeMultipartUpload.apply(this, arguments);
|
4148 | }
|
4149 |
|
4150 | return completeMultipartUpload;
|
4151 | }();
|
4152 |
|
4153 |
|
4154 |
|
4155 |
|
4156 |
|
4157 |
|
4158 |
|
4159 |
|
4160 |
|
4161 |
|
4162 | proto._uploadPart = function () {
|
4163 | var _uploadPart3 = (0, _asyncToGenerator2.default)( _regenerator.default.mark(function _callee7(name, uploadId, partNo, data, options) {
|
4164 | var opt, params, result;
|
4165 | return _regenerator.default.wrap(function _callee7$(_context7) {
|
4166 | while (1) {
|
4167 | switch (_context7.prev = _context7.next) {
|
4168 | case 0:
|
4169 | options = options || {};
|
4170 | opt = {};
|
4171 | copy(options).to(opt);
|
4172 | opt.headers = {
|
4173 | 'Content-Length': data.size
|
4174 | };
|
4175 | opt.subres = {
|
4176 | partNumber: partNo,
|
4177 | uploadId: uploadId
|
4178 | };
|
4179 | params = this._objectRequestParams('PUT', name, opt);
|
4180 | params.mime = opt.mime;
|
4181 | params.stream = data.stream;
|
4182 | params.successStatuses = [200];
|
4183 | _context7.next = 11;
|
4184 | return this.request(params);
|
4185 |
|
4186 | case 11:
|
4187 | result = _context7.sent;
|
4188 |
|
4189 | if (result.res.headers.etag) {
|
4190 | _context7.next = 14;
|
4191 | break;
|
4192 | }
|
4193 |
|
4194 | throw new Error('Please set the etag of expose-headers in OSS \n https://help.aliyun.com/document_detail/32069.html');
|
4195 |
|
4196 | case 14:
|
4197 | data.stream = null;
|
4198 | params.stream = null;
|
4199 | return _context7.abrupt("return", {
|
4200 | name: name,
|
4201 | etag: result.res.headers.etag,
|
4202 | res: result.res
|
4203 | });
|
4204 |
|
4205 | case 17:
|
4206 | case "end":
|
4207 | return _context7.stop();
|
4208 | }
|
4209 | }
|
4210 | }, _callee7, this);
|
4211 | }));
|
4212 |
|
4213 | function _uploadPart(_x23, _x24, _x25, _x26, _x27) {
|
4214 | return _uploadPart3.apply(this, arguments);
|
4215 | }
|
4216 |
|
4217 | return _uploadPart;
|
4218 | }();
|
4219 |
|
4220 | },{"./callback":23,"./utils/deepCopy":54,"./utils/isBuffer":61,"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"copy-to":101,"core-js/modules/es.array.concat":234,"core-js/modules/es.array.filter":236,"core-js/modules/es.array.map":245,"core-js/modules/es.array.sort":247,"core-js/modules/es.object.to-string":254,"core-js/modules/es.regexp.to-string":257,"regenerator-runtime/runtime":337}],29:[function(require,module,exports){
|
4221 | "use strict";
|
4222 |
|
4223 | var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4224 |
|
4225 | require("core-js/modules/es.array.concat");
|
4226 |
|
4227 | require("core-js/modules/es.array.find");
|
4228 |
|
4229 | require("core-js/modules/es.array.for-each");
|
4230 |
|
4231 | require("core-js/modules/es.array.includes");
|
4232 |
|
4233 | require("core-js/modules/es.object.keys");
|
4234 |
|
4235 | require("core-js/modules/es.regexp.exec");
|
4236 |
|
4237 | require("core-js/modules/es.string.replace");
|
4238 |
|
4239 | require("core-js/modules/web.dom-collections.for-each");
|
4240 |
|
4241 | var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
4242 |
|
4243 | var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
4244 |
|
4245 | require("regenerator-runtime/runtime");
|
4246 |
|
4247 | var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
4248 |
|
4249 | var _require = require('../utils/checkBucketName'),
|
4250 | _checkBucketName = _require.checkBucketName;
|
4251 |
|
4252 | var proto = exports;
|
4253 | var REPLACE_HEDERS = ['content-type', 'content-encoding', 'content-language', 'content-disposition', 'cache-control', 'expires'];
|
4254 |
|
4255 | proto.copy = function () {
|
4256 | var _copy = (0, _asyncToGenerator2.default)( _regenerator.default.mark(function _callee(name, sourceName, bucketName, options) {
|
4257 | var params, result, data;
|
4258 | return _regenerator.default.wrap(function _callee$(_context) {
|
4259 | while (1) {
|
4260 | switch (_context.prev = _context.next) {
|
4261 | case 0:
|
4262 | if ((0, _typeof2.default)(bucketName) === 'object') {
|
4263 | options = bucketName;
|
4264 | }
|
4265 |
|
4266 | options = options || {};
|
4267 | options.headers = options.headers || {};
|
4268 | Object.keys(options.headers).forEach(function (key) {
|
4269 | options.headers["x-oss-copy-source-".concat(key.toLowerCase())] = options.headers[key];
|
4270 | });
|
4271 |
|
4272 | if (options.meta || Object.keys(options.headers).find(function (_) {
|
4273 | return REPLACE_HEDERS.includes(_.toLowerCase());
|
4274 | })) {
|
4275 | options.headers['x-oss-metadata-directive'] = 'REPLACE';
|
4276 | }
|
4277 |
|
4278 | this._convertMetaToHeaders(options.meta, options.headers);
|
4279 |
|
4280 | sourceName = this._getSourceName(sourceName, bucketName);
|
4281 |
|
4282 | if (options.versionId) {
|
4283 | sourceName = "".concat(sourceName, "?versionId=").concat(options.versionId);
|
4284 | }
|
4285 |
|
4286 | options.headers['x-oss-copy-source'] = sourceName;
|
4287 | params = this._objectRequestParams('PUT', name, options);
|
4288 | params.xmlResponse = true;
|
4289 | params.successStatuses = [200, 304];
|
4290 | _context.next = 14;
|
4291 | return this.request(params);
|
4292 |
|
4293 | case 14:
|
4294 | result = _context.sent;
|
4295 | data = result.data;
|
4296 |
|
4297 | if (data) {
|
4298 | data = {
|
4299 | etag: data.ETag,
|
4300 | lastModified: data.LastModified
|
4301 | };
|
4302 | }
|
4303 |
|
4304 | return _context.abrupt("return", {
|
4305 | data: data,
|
4306 | res: result.res
|
4307 | });
|
4308 |
|
4309 | case 18:
|
4310 | case "end":
|
4311 | return _context.stop();
|
4312 | }
|
4313 | }
|
4314 | }, _callee, this);
|
4315 | }));
|
4316 |
|
4317 | function copy(_x, _x2, _x3, _x4) {
|
4318 | return _copy.apply(this, arguments);
|
4319 | }
|
4320 |
|
4321 | return copy;
|
4322 | }();
|
4323 |
|
4324 |
|
4325 | proto._getSourceName = function _getSourceName(sourceName, bucketName) {
|
4326 | if (typeof bucketName === 'string') {
|
4327 | sourceName = this._objectName(sourceName);
|
4328 | } else if (sourceName[0] !== '/') {
|
4329 | bucketName = this.options.bucket;
|
4330 | } else {
|
4331 | bucketName = sourceName.replace(/\/(.+?)(\/.*)/, '$1');
|
4332 | sourceName = sourceName.replace(/(\/.+?\/)(.*)/, '$2');
|
4333 | }
|
4334 |
|
4335 | _checkBucketName(bucketName);
|
4336 |
|
4337 | sourceName = encodeURIComponent(sourceName);
|
4338 | sourceName = "/".concat(bucketName, "/").concat(sourceName);
|
4339 | return sourceName;
|
4340 | };
|
4341 |
|
4342 | },{"../utils/checkBucketName":48,"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/helpers/typeof":72,"@babel/runtime/regenerator":74,"core-js/modules/es.array.concat":234,"core-js/modules/es.array.find":237,"core-js/modules/es.array.for-each":238,"core-js/modules/es.array.includes":240,"core-js/modules/es.object.keys":253,"core-js/modules/es.regexp.exec":256,"core-js/modules/es.string.replace":261,"core-js/modules/web.dom-collections.for-each":292,"regenerator-runtime/runtime":337}],30:[function(require,module,exports){
|
4343 | "use strict";
|
4344 |
|
4345 | var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4346 |
|
4347 | require("core-js/modules/es.object.assign");
|
4348 |
|
4349 | var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
4350 |
|
4351 | require("regenerator-runtime/runtime");
|
4352 |
|
4353 | var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
4354 |
|
4355 | var proto = exports;
|
4356 |
|
4357 |
|
4358 |
|
4359 |
|
4360 |
|
4361 |
|
4362 |
|
4363 | proto.delete = function () {
|
4364 | var _delete2 = (0, _asyncToGenerator2.default)( _regenerator.default.mark(function _callee(name) {
|
4365 | var options,
|
4366 | params,
|
4367 | result,
|
4368 | _args = arguments;
|
4369 | return _regenerator.default.wrap(function _callee$(_context) {
|
4370 | while (1) {
|
4371 | switch (_context.prev = _context.next) {
|
4372 | case 0:
|
4373 | options = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
|
4374 | options.subres = Object.assign({}, options.subres);
|
4375 |
|
4376 | if (options.versionId) {
|
4377 | options.subres.versionId = options.versionId;
|
4378 | }
|
4379 |
|
4380 | params = this._objectRequestParams('DELETE', name, options);
|
4381 | params.successStatuses = [204];
|
4382 | _context.next = 7;
|
4383 | return this.request(params);
|
4384 |
|
4385 | case 7:
|
4386 | result = _context.sent;
|
4387 | return _context.abrupt("return", {
|
4388 | res: result.res
|
4389 | });
|
4390 |
|
4391 | case 9:
|
4392 | case "end":
|
4393 | return _context.stop();
|
4394 | }
|
4395 | }
|
4396 | }, _callee, this);
|
4397 | }));
|
4398 |
|
4399 | function _delete(_x) {
|
4400 | return _delete2.apply(this, arguments);
|
4401 | }
|
4402 |
|
4403 | return _delete;
|
4404 | }();
|
4405 |
|
4406 | },{"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"core-js/modules/es.object.assign":251,"regenerator-runtime/runtime":337}],31:[function(require,module,exports){
|
4407 | "use strict";
|
4408 |
|
4409 | var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4410 |
|
4411 | require("core-js/modules/es.object.assign");
|
4412 |
|
4413 | var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
4414 |
|
4415 | require("regenerator-runtime/runtime");
|
4416 |
|
4417 | var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
4418 |
|
4419 |
|
4420 | var utility = require('utility');
|
4421 |
|
4422 | var _require = require('../utils/obj2xml'),
|
4423 | obj2xml = _require.obj2xml;
|
4424 |
|
4425 | var proto = exports;
|
4426 |
|
4427 | proto.deleteMulti = function () {
|
4428 | var _deleteMulti = (0, _asyncToGenerator2.default)( _regenerator.default.mark(function _callee(names) {
|
4429 | var options,
|
4430 | objects,
|
4431 | i,
|
4432 | object,
|
4433 | _names$i,
|
4434 | key,
|
4435 | versionId,
|
4436 | paramXMLObj,
|
4437 | paramXML,
|
4438 | params,
|
4439 | result,
|
4440 | r,
|
4441 | deleted,
|
4442 | _args = arguments;
|
4443 |
|
4444 | return _regenerator.default.wrap(function _callee$(_context) {
|
4445 | while (1) {
|
4446 | switch (_context.prev = _context.next) {
|
4447 | case 0:
|
4448 | options = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
|
4449 | objects = [];
|
4450 |
|
4451 | if (!(!names || !names.length)) {
|
4452 | _context.next = 4;
|
4453 | break;
|
4454 | }
|
4455 |
|
4456 | throw new Error('names is required');
|
4457 |
|
4458 | case 4:
|
4459 | for (i = 0; i < names.length; i++) {
|
4460 | object = {};
|
4461 |
|
4462 | if (typeof names[i] === 'string') {
|
4463 | object.Key = utility.escape(this._objectName(names[i]));
|
4464 | } else {
|
4465 | _names$i = names[i], key = _names$i.key, versionId = _names$i.versionId;
|
4466 | object.Key = utility.escape(this._objectName(key));
|
4467 | object.VersionId = versionId;
|
4468 | }
|
4469 |
|
4470 | objects.push(object);
|
4471 | }
|
4472 |
|
4473 | paramXMLObj = {
|
4474 | Delete: {
|
4475 | Quiet: !!options.quiet,
|
4476 | Object: objects
|
4477 | }
|
4478 | };
|
4479 | paramXML = obj2xml(paramXMLObj, {
|
4480 | headers: true
|
4481 | });
|
4482 | options.subres = Object.assign({
|
4483 | delete: ''
|
4484 | }, options.subres);
|
4485 |
|
4486 | if (options.versionId) {
|
4487 | options.subres.versionId = options.versionId;
|
4488 | }
|
4489 |
|
4490 | params = this._objectRequestParams('POST', '', options);
|
4491 | params.mime = 'xml';
|
4492 | params.content = paramXML;
|
4493 | params.xmlResponse = true;
|
4494 | params.successStatuses = [200];
|
4495 | _context.next = 16;
|
4496 | return this.request(params);
|
4497 |
|
4498 | case 16:
|
4499 | result = _context.sent;
|
4500 | r = result.data;
|
4501 | deleted = r && r.Deleted || null;
|
4502 |
|
4503 | if (deleted) {
|
4504 | if (!Array.isArray(deleted)) {
|
4505 | deleted = [deleted];
|
4506 | }
|
4507 | }
|
4508 |
|
4509 | return _context.abrupt("return", {
|
4510 | res: result.res,
|
4511 | deleted: deleted || []
|
4512 | });
|
4513 |
|
4514 | case 21:
|
4515 | case "end":
|
4516 | return _context.stop();
|
4517 | }
|
4518 | }
|
4519 | }, _callee, this);
|
4520 | }));
|
4521 |
|
4522 | function deleteMulti(_x) {
|
4523 | return _deleteMulti.apply(this, arguments);
|
4524 | }
|
4525 |
|
4526 | return deleteMulti;
|
4527 | }();
|
4528 |
|
4529 | },{"../utils/obj2xml":66,"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"core-js/modules/es.object.assign":251,"regenerator-runtime/runtime":337,"utility":396}],32:[function(require,module,exports){
|
4530 | "use strict";
|
4531 |
|
4532 | var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4533 |
|
4534 | require("core-js/modules/es.object.assign");
|
4535 |
|
4536 | var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
4537 |
|
4538 | require("regenerator-runtime/runtime");
|
4539 |
|
4540 | var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
4541 |
|
4542 | var proto = exports;
|
4543 |
|
4544 |
|
4545 |
|
4546 |
|
4547 |
|
4548 |
|
4549 | proto.deleteObjectTagging = function () {
|
4550 | var _deleteObjectTagging = (0, _asyncToGenerator2.default)( _regenerator.default.mark(function _callee(name) {
|
4551 | var options,
|
4552 | params,
|
4553 | result,
|
4554 | _args = arguments;
|
4555 | return _regenerator.default.wrap(function _callee$(_context) {
|
4556 | while (1) {
|
4557 | switch (_context.prev = _context.next) {
|
4558 | case 0:
|
4559 | options = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
|
4560 | options.subres = Object.assign({
|
4561 | tagging: ''
|
4562 | }, options.subres);
|
4563 |
|
4564 | if (options.versionId) {
|
4565 | options.subres.versionId = options.versionId;
|
4566 | }
|
4567 |
|
4568 | name = this._objectName(name);
|
4569 | params = this._objectRequestParams('DELETE', name, options);
|
4570 | params.successStatuses = [204];
|
4571 | _context.next = 8;
|
4572 | return this.request(params);
|
4573 |
|
4574 | case 8:
|
4575 | result = _context.sent;
|
4576 | return _context.abrupt("return", {
|
4577 | status: result.status,
|
4578 | res: result.res
|
4579 | });
|
4580 |
|
4581 | case 10:
|
4582 | case "end":
|
4583 | return _context.stop();
|
4584 | }
|
4585 | }
|
4586 | }, _callee, this);
|
4587 | }));
|
4588 |
|
4589 | function deleteObjectTagging(_x) {
|
4590 | return _deleteObjectTagging.apply(this, arguments);
|
4591 | }
|
4592 |
|
4593 | return deleteObjectTagging;
|
4594 | }();
|
4595 |
|
4596 | },{"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"core-js/modules/es.object.assign":251,"regenerator-runtime/runtime":337}],33:[function(require,module,exports){
|
4597 | "use strict";
|
4598 |
|
4599 | require("core-js/modules/es.array.concat");
|
4600 |
|
4601 | var urlutil = require('url');
|
4602 |
|
4603 | var _require = require('../utils/isIP'),
|
4604 | isIP = _require.isIP;
|
4605 |
|
4606 | var proto = exports;
|
4607 |
|
4608 |
|
4609 |
|
4610 |
|
4611 |
|
4612 |
|
4613 |
|
4614 | proto.generateObjectUrl = function generateObjectUrl(name, baseUrl) {
|
4615 | if (isIP(this.options.endpoint.hostname)) {
|
4616 | throw new Error('can not get the object URL when endpoint is IP');
|
4617 | }
|
4618 |
|
4619 | if (!baseUrl) {
|
4620 | baseUrl = this.options.endpoint.format();
|
4621 | var copyUrl = urlutil.parse(baseUrl);
|
4622 | var bucket = this.options.bucket;
|
4623 | copyUrl.hostname = "".concat(bucket, ".").concat(copyUrl.hostname);
|
4624 | copyUrl.host = "".concat(bucket, ".").concat(copyUrl.host);
|
4625 | baseUrl = copyUrl.format();
|
4626 | } else if (baseUrl[baseUrl.length - 1] !== '/') {
|
4627 | baseUrl += '/';
|
4628 | }
|
4629 |
|
4630 | return baseUrl + this._escape(this._objectName(name));
|
4631 | };
|
4632 |
|
4633 | },{"../utils/isIP":63,"core-js/modules/es.array.concat":234,"url":394}],34:[function(require,module,exports){
|
4634 | "use strict";
|
4635 |
|
4636 | var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4637 |
|
4638 | require("core-js/modules/es.object.assign");
|
4639 |
|
4640 | var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
4641 |
|
4642 | require("regenerator-runtime/runtime");
|
4643 |
|
4644 | var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
4645 |
|
4646 | var fs = require('fs');
|
4647 |
|
4648 | var is = require('is-type-of');
|
4649 |
|
4650 | var proto = exports;
|
4651 |
|
4652 |
|
4653 |
|
4654 |
|
4655 |
|
4656 |
|
4657 |
|
4658 |
|
4659 | proto.get = function () {
|
4660 | var _get = (0, _asyncToGenerator2.default)( _regenerator.default.mark(function _callee(name, file) {
|
4661 | var options,
|
4662 | writeStream,
|
4663 | needDestroy,
|
4664 | result,
|
4665 | params,
|
4666 | _args = arguments;
|
4667 | return _regenerator.default.wrap(function _callee$(_context) {
|
4668 | while (1) {
|
4669 | switch (_context.prev = _context.next) {
|
4670 | case 0:
|
4671 | options = _args.length > 2 && _args[2] !== undefined ? _args[2] : {};
|
4672 | writeStream = null;
|
4673 | needDestroy = false;
|
4674 |
|
4675 | if (is.writableStream(file)) {
|
4676 | writeStream = file;
|
4677 | } else if (is.string(file)) {
|
4678 | writeStream = fs.createWriteStream(file);
|
4679 | needDestroy = true;
|
4680 | } else {
|
4681 |
|
4682 | options = file;
|
4683 | }
|
4684 |
|
4685 | options = options || {};
|
4686 | options.subres = Object.assign({
|
4687 | 'response-cache-control': 'no-cache'
|
4688 | }, options.subres);
|
4689 |
|
4690 | if (options.versionId) {
|
4691 | options.subres.versionId = options.versionId;
|
4692 | }
|
4693 |
|
4694 | if (options.process) {
|
4695 | options.subres['x-oss-process'] = options.process;
|
4696 | }
|
4697 |
|
4698 | _context.prev = 8;
|
4699 | params = this._objectRequestParams('GET', name, options);
|
4700 | params.writeStream = writeStream;
|
4701 | params.successStatuses = [200, 206, 304];
|
4702 | _context.next = 14;
|
4703 | return this.request(params);
|
4704 |
|
4705 | case 14:
|
4706 | result = _context.sent;
|
4707 |
|
4708 | if (needDestroy) {
|
4709 | writeStream.destroy();
|
4710 | }
|
4711 |
|
4712 | _context.next = 25;
|
4713 | break;
|
4714 |
|
4715 | case 18:
|
4716 | _context.prev = 18;
|
4717 | _context.t0 = _context["catch"](8);
|
4718 |
|
4719 | if (!needDestroy) {
|
4720 | _context.next = 24;
|
4721 | break;
|
4722 | }
|
4723 |
|
4724 | writeStream.destroy();
|
4725 |
|
4726 | _context.next = 24;
|
4727 | return this._deleteFileSafe(file);
|
4728 |
|
4729 | case 24:
|
4730 | throw _context.t0;
|
4731 |
|
4732 | case 25:
|
4733 | return _context.abrupt("return", {
|
4734 | res: result.res,
|
4735 | content: result.data
|
4736 | });
|
4737 |
|
4738 | case 26:
|
4739 | case "end":
|
4740 | return _context.stop();
|
4741 | }
|
4742 | }
|
4743 | }, _callee, this, [[8, 18]]);
|
4744 | }));
|
4745 |
|
4746 | function get(_x, _x2) {
|
4747 | return _get.apply(this, arguments);
|
4748 | }
|
4749 |
|
4750 | return get;
|
4751 | }();
|
4752 |
|
4753 | },{"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"core-js/modules/es.object.assign":251,"fs":78,"is-type-of":392,"regenerator-runtime/runtime":337}],35:[function(require,module,exports){
|
4754 | "use strict";
|
4755 |
|
4756 | var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4757 |
|
4758 | require("core-js/modules/es.object.assign");
|
4759 |
|
4760 | var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
4761 |
|
4762 | require("regenerator-runtime/runtime");
|
4763 |
|
4764 | var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
4765 |
|
4766 | var proto = exports;
|
4767 |
|
4768 |
|
4769 |
|
4770 |
|
4771 |
|
4772 |
|
4773 |
|
4774 | proto.getACL = function () {
|
4775 | var _getACL = (0, _asyncToGenerator2.default)( _regenerator.default.mark(function _callee(name) {
|
4776 | var options,
|
4777 | params,
|
4778 | result,
|
4779 | _args = arguments;
|
4780 | return _regenerator.default.wrap(function _callee$(_context) {
|
4781 | while (1) {
|
4782 | switch (_context.prev = _context.next) {
|
4783 | case 0:
|
4784 | options = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
|
4785 | options.subres = Object.assign({
|
4786 | acl: ''
|
4787 | }, options.subres);
|
4788 |
|
4789 | if (options.versionId) {
|
4790 | options.subres.versionId = options.versionId;
|
4791 | }
|
4792 |
|
4793 | name = this._objectName(name);
|
4794 | params = this._objectRequestParams('GET', name, options);
|
4795 | params.successStatuses = [200];
|
4796 | params.xmlResponse = true;
|
4797 | _context.next = 9;
|
4798 | return this.request(params);
|
4799 |
|
4800 | case 9:
|
4801 | result = _context.sent;
|
4802 | return _context.abrupt("return", {
|
4803 | acl: result.data.AccessControlList.Grant,
|
4804 | owner: {
|
4805 | id: result.data.Owner.ID,
|
4806 | displayName: result.data.Owner.DisplayName
|
4807 | },
|
4808 | res: result.res
|
4809 | });
|
4810 |
|
4811 | case 11:
|
4812 | case "end":
|
4813 | return _context.stop();
|
4814 | }
|
4815 | }
|
4816 | }, _callee, this);
|
4817 | }));
|
4818 |
|
4819 | function getACL(_x) {
|
4820 | return _getACL.apply(this, arguments);
|
4821 | }
|
4822 |
|
4823 | return getACL;
|
4824 | }();
|
4825 |
|
4826 | },{"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"core-js/modules/es.object.assign":251,"regenerator-runtime/runtime":337}],36:[function(require,module,exports){
|
4827 | "use strict";
|
4828 |
|
4829 | var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4830 |
|
4831 | require("core-js/modules/es.array.for-each");
|
4832 |
|
4833 | require("core-js/modules/es.array.map");
|
4834 |
|
4835 | require("core-js/modules/es.number.constructor");
|
4836 |
|
4837 | require("core-js/modules/es.object.assign");
|
4838 |
|
4839 | require("core-js/modules/es.object.keys");
|
4840 |
|
4841 | require("core-js/modules/es.regexp.exec");
|
4842 |
|
4843 | require("core-js/modules/es.string.replace");
|
4844 |
|
4845 | require("core-js/modules/web.dom-collections.for-each");
|
4846 |
|
4847 | var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
4848 |
|
4849 | require("regenerator-runtime/runtime");
|
4850 |
|
4851 | var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
4852 |
|
4853 |
|
4854 | var proto = exports;
|
4855 |
|
4856 | var _require = require('../utils/isObject'),
|
4857 | isObject = _require.isObject;
|
4858 |
|
4859 | var _require2 = require('../utils/isArray'),
|
4860 | isArray = _require2.isArray;
|
4861 |
|
4862 | proto.getBucketVersions = getBucketVersions;
|
4863 | proto.listObjectVersions = getBucketVersions;
|
4864 |
|
4865 | function getBucketVersions() {
|
4866 | return _getBucketVersions.apply(this, arguments);
|
4867 | }
|
4868 |
|
4869 | function _getBucketVersions() {
|
4870 | _getBucketVersions = (0, _asyncToGenerator2.default)( _regenerator.default.mark(function _callee() {
|
4871 | var query,
|
4872 | options,
|
4873 | params,
|
4874 | result,
|
4875 | objects,
|
4876 | deleteMarker,
|
4877 | that,
|
4878 | prefixes,
|
4879 | _args = arguments;
|
4880 | return _regenerator.default.wrap(function _callee$(_context) {
|
4881 | while (1) {
|
4882 | switch (_context.prev = _context.next) {
|
4883 | case 0:
|
4884 | query = _args.length > 0 && _args[0] !== undefined ? _args[0] : {};
|
4885 | options = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
|
4886 |
|
4887 | if (!(query.versionIdMarker && query.keyMarker === undefined)) {
|
4888 | _context.next = 4;
|
4889 | break;
|
4890 | }
|
4891 |
|
4892 | throw new Error('A version-id marker cannot be specified without a key marker');
|
4893 |
|
4894 | case 4:
|
4895 | options.subres = Object.assign({
|
4896 | versions: ''
|
4897 | }, options.subres);
|
4898 |
|
4899 | if (options.versionId) {
|
4900 | options.subres.versionId = options.versionId;
|
4901 | }
|
4902 |
|
4903 | params = this._objectRequestParams('GET', '', options);
|
4904 | params.xmlResponse = true;
|
4905 | params.successStatuses = [200];
|
4906 | params.query = formatQuery(query);
|
4907 | _context.next = 12;
|
4908 | return this.request(params);
|
4909 |
|
4910 | case 12:
|
4911 | result = _context.sent;
|
4912 | objects = result.data.Version || [];
|
4913 | deleteMarker = result.data.DeleteMarker || [];
|
4914 | that = this;
|
4915 |
|
4916 | if (objects) {
|
4917 | if (!Array.isArray(objects)) {
|
4918 | objects = [objects];
|
4919 | }
|
4920 |
|
4921 | objects = objects.map(function (obj) {
|
4922 | return {
|
4923 | name: obj.Key,
|
4924 | url: that._objectUrl(obj.Key),
|
4925 | lastModified: obj.LastModified,
|
4926 | isLatest: obj.IsLatest === 'true',
|
4927 | versionId: obj.VersionId,
|
4928 | etag: obj.ETag,
|
4929 | type: obj.Type,
|
4930 | size: Number(obj.Size),
|
4931 | storageClass: obj.StorageClass,
|
4932 | owner: {
|
4933 | id: obj.Owner.ID,
|
4934 | displayName: obj.Owner.DisplayName
|
4935 | }
|
4936 | };
|
4937 | });
|
4938 | }
|
4939 |
|
4940 | if (deleteMarker) {
|
4941 | if (!isArray(deleteMarker)) {
|
4942 | deleteMarker = [deleteMarker];
|
4943 | }
|
4944 |
|
4945 | deleteMarker = deleteMarker.map(function (obj) {
|
4946 | return {
|
4947 | name: obj.Key,
|
4948 | lastModified: obj.LastModified,
|
4949 | versionId: obj.VersionId,
|
4950 | owner: {
|
4951 | id: obj.Owner.ID,
|
4952 | displayName: obj.Owner.DisplayName
|
4953 | }
|
4954 | };
|
4955 | });
|
4956 | }
|
4957 |
|
4958 | prefixes = result.data.CommonPrefixes || null;
|
4959 |
|
4960 | if (prefixes) {
|
4961 | if (!isArray(prefixes)) {
|
4962 | prefixes = [prefixes];
|
4963 | }
|
4964 |
|
4965 | prefixes = prefixes.map(function (item) {
|
4966 | return item.Prefix;
|
4967 | });
|
4968 | }
|
4969 |
|
4970 | return _context.abrupt("return", {
|
4971 | res: result.res,
|
4972 | objects: objects,
|
4973 | deleteMarker: deleteMarker,
|
4974 | prefixes: prefixes,
|
4975 |
|
4976 | nextMarker: result.data.NextKeyMarker || null,
|
4977 |
|
4978 | NextVersionIdMarker: result.data.NextVersionIdMarker || null,
|
4979 | nextKeyMarker: result.data.NextKeyMarker || null,
|
4980 | nextVersionIdMarker: result.data.NextVersionIdMarker || null,
|
4981 | isTruncated: result.data.IsTruncated === 'true'
|
4982 | });
|
4983 |
|
4984 | case 21:
|
4985 | case "end":
|
4986 | return _context.stop();
|
4987 | }
|
4988 | }
|
4989 | }, _callee, this);
|
4990 | }));
|
4991 | return _getBucketVersions.apply(this, arguments);
|
4992 | }
|
4993 |
|
4994 | function camel2Line(name) {
|
4995 | return name.replace(/([A-Z])/g, '-$1').toLowerCase();
|
4996 | }
|
4997 |
|
4998 | function formatQuery() {
|
4999 | var query = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
5000 | var obj = {};
|
5001 |
|
5002 | if (isObject(query)) {
|
5003 | Object.keys(query).forEach(function (key) {
|
5004 | obj[camel2Line(key)] = query[key];
|
5005 | });
|
5006 | }
|
5007 |
|
5008 | return obj;
|
5009 | }
|
5010 |
|
5011 | },{"../utils/isArray":59,"../utils/isObject":64,"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"core-js/modules/es.array.for-each":238,"core-js/modules/es.array.map":245,"core-js/modules/es.number.constructor":250,"core-js/modules/es.object.assign":251,"core-js/modules/es.object.keys":253,"core-js/modules/es.regexp.exec":256,"core-js/modules/es.string.replace":261,"core-js/modules/web.dom-collections.for-each":292,"regenerator-runtime/runtime":337}],37:[function(require,module,exports){
|
5012 | "use strict";
|
5013 |
|
5014 | var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
5015 |
|
5016 | require("core-js/modules/es.object.assign");
|
5017 |
|
5018 | var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
5019 |
|
5020 | require("regenerator-runtime/runtime");
|
5021 |
|
5022 | var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
5023 |
|
5024 | var proto = exports;
|
5025 |
|
5026 |
|
5027 |
|
5028 |
|
5029 |
|
5030 |
|
5031 |
|
5032 | proto.getObjectMeta = function () {
|
5033 | var _getObjectMeta = (0, _asyncToGenerator2.default)( _regenerator.default.mark(function _callee(name, options) {
|
5034 | var params, result;
|
5035 | return _regenerator.default.wrap(function _callee$(_context) {
|
5036 | while (1) {
|
5037 | switch (_context.prev = _context.next) {
|
5038 | case 0:
|
5039 | options = options || {};
|
5040 | name = this._objectName(name);
|
5041 | options.subres = Object.assign({
|
5042 | objectMeta: ''
|
5043 | }, options.subres);
|
5044 |
|
5045 | if (options.versionId) {
|
5046 | options.subres.versionId = options.versionId;
|
5047 | }
|
5048 |
|
5049 | params = this._objectRequestParams('HEAD', name, options);
|
5050 | params.successStatuses = [200];
|
5051 | _context.next = 8;
|
5052 | return this.request(params);
|
5053 |
|
5054 | case 8:
|
5055 | result = _context.sent;
|
5056 | return _context.abrupt("return", {
|
5057 | status: result.status,
|
5058 | res: result.res
|
5059 | });
|
5060 |
|
5061 | case 10:
|
5062 | case "end":
|
5063 | return _context.stop();
|
5064 | }
|
5065 | }
|
5066 | }, _callee, this);
|
5067 | }));
|
5068 |
|
5069 | function getObjectMeta(_x, _x2) {
|
5070 | return _getObjectMeta.apply(this, arguments);
|
5071 | }
|
5072 |
|
5073 | return getObjectMeta;
|
5074 | }();
|
5075 |
|
5076 | },{"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"core-js/modules/es.object.assign":251,"regenerator-runtime/runtime":337}],38:[function(require,module,exports){
|
5077 | "use strict";
|
5078 |
|
5079 | var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
5080 |
|
5081 | require("core-js/modules/es.array.for-each");
|
5082 |
|
5083 | require("core-js/modules/es.object.assign");
|
5084 |
|
5085 | require("core-js/modules/web.dom-collections.for-each");
|
5086 |
|
5087 | var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
5088 |
|
5089 | require("regenerator-runtime/runtime");
|
5090 |
|
5091 | var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
5092 |
|
5093 | var proto = exports;
|
5094 |
|
5095 | var _require = require('../utils/isObject'),
|
5096 | isObject = _require.isObject;
|
5097 |
|
5098 |
|
5099 |
|
5100 |
|
5101 |
|
5102 |
|
5103 |
|
5104 |
|
5105 | proto.getObjectTagging = function () {
|
5106 | var _getObjectTagging = (0, _asyncToGenerator2.default)( _regenerator.default.mark(function _callee(name) {
|
5107 | var options,
|
5108 | params,
|
5109 | result,
|
5110 | Tagging,
|
5111 | Tag,
|
5112 | tag,
|
5113 | _args = arguments;
|
5114 | return _regenerator.default.wrap(function _callee$(_context) {
|
5115 | while (1) {
|
5116 | switch (_context.prev = _context.next) {
|
5117 | case 0:
|
5118 | options = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
|
5119 | options.subres = Object.assign({
|
5120 | tagging: ''
|
5121 | }, options.subres);
|
5122 |
|
5123 | if (options.versionId) {
|
5124 | options.subres.versionId = options.versionId;
|
5125 | }
|
5126 |
|
5127 | name = this._objectName(name);
|
5128 | params = this._objectRequestParams('GET', name, options);
|
5129 | params.successStatuses = [200];
|
5130 | _context.next = 8;
|
5131 | return this.request(params);
|
5132 |
|
5133 | case 8:
|
5134 | result = _context.sent;
|
5135 | _context.next = 11;
|
5136 | return this.parseXML(result.data);
|
5137 |
|
5138 | case 11:
|
5139 | Tagging = _context.sent;
|
5140 | Tag = Tagging.TagSet.Tag;
|
5141 | Tag = Tag && isObject(Tag) ? [Tag] : Tag || [];
|
5142 | tag = {};
|
5143 | Tag.forEach(function (item) {
|
5144 | tag[item.Key] = item.Value;
|
5145 | });
|
5146 | return _context.abrupt("return", {
|
5147 | status: result.status,
|
5148 | res: result.res,
|
5149 | tag: tag
|
5150 | });
|
5151 |
|
5152 | case 17:
|
5153 | case "end":
|
5154 | return _context.stop();
|
5155 | }
|
5156 | }
|
5157 | }, _callee, this);
|
5158 | }));
|
5159 |
|
5160 | function getObjectTagging(_x) {
|
5161 | return _getObjectTagging.apply(this, arguments);
|
5162 | }
|
5163 |
|
5164 | return getObjectTagging;
|
5165 | }();
|
5166 |
|
5167 | },{"../utils/isObject":64,"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"core-js/modules/es.array.for-each":238,"core-js/modules/es.object.assign":251,"core-js/modules/web.dom-collections.for-each":292,"regenerator-runtime/runtime":337}],39:[function(require,module,exports){
|
5168 | "use strict";
|
5169 |
|
5170 | var _require = require('../utils/isIP'),
|
5171 | isIP = _require.isIP;
|
5172 |
|
5173 | var proto = exports;
|
5174 |
|
5175 |
|
5176 |
|
5177 |
|
5178 |
|
5179 |
|
5180 |
|
5181 |
|
5182 | proto.getObjectUrl = function getObjectUrl(name, baseUrl) {
|
5183 | if (isIP(this.options.endpoint.hostname)) {
|
5184 | throw new Error('can not get the object URL when endpoint is IP');
|
5185 | }
|
5186 |
|
5187 | if (!baseUrl) {
|
5188 | baseUrl = this.options.endpoint.format();
|
5189 | } else if (baseUrl[baseUrl.length - 1] !== '/') {
|
5190 | baseUrl += '/';
|
5191 | }
|
5192 |
|
5193 | return baseUrl + this._escape(this._objectName(name));
|
5194 | };
|
5195 |
|
5196 | },{"../utils/isIP":63}],40:[function(require,module,exports){
|
5197 | "use strict";
|
5198 |
|
5199 | var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
5200 |
|
5201 | require("core-js/modules/es.object.assign");
|
5202 |
|
5203 | var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
5204 |
|
5205 | require("regenerator-runtime/runtime");
|
5206 |
|
5207 | var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
5208 |
|
5209 | var proto = exports;
|
5210 |
|
5211 |
|
5212 |
|
5213 |
|
5214 |
|
5215 |
|
5216 |
|
5217 | proto.getSymlink = function () {
|
5218 | var _getSymlink = (0, _asyncToGenerator2.default)( _regenerator.default.mark(function _callee(name) {
|
5219 | var options,
|
5220 | params,
|
5221 | result,
|
5222 | target,
|
5223 | _args = arguments;
|
5224 | return _regenerator.default.wrap(function _callee$(_context) {
|
5225 | while (1) {
|
5226 | switch (_context.prev = _context.next) {
|
5227 | case 0:
|
5228 | options = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
|
5229 | options.subres = Object.assign({
|
5230 | symlink: ''
|
5231 | }, options.subres);
|
5232 |
|
5233 | if (options.versionId) {
|
5234 | options.subres.versionId = options.versionId;
|
5235 | }
|
5236 |
|
5237 | name = this._objectName(name);
|
5238 | params = this._objectRequestParams('GET', name, options);
|
5239 | params.successStatuses = [200];
|
5240 | _context.next = 8;
|
5241 | return this.request(params);
|
5242 |
|
5243 | case 8:
|
5244 | result = _context.sent;
|
5245 | target = result.res.headers['x-oss-symlink-target'];
|
5246 | return _context.abrupt("return", {
|
5247 | targetName: decodeURIComponent(target),
|
5248 | res: result.res
|
5249 | });
|
5250 |
|
5251 | case 11:
|
5252 | case "end":
|
5253 | return _context.stop();
|
5254 | }
|
5255 | }
|
5256 | }, _callee, this);
|
5257 | }));
|
5258 |
|
5259 | function getSymlink(_x) {
|
5260 | return _getSymlink.apply(this, arguments);
|
5261 | }
|
5262 |
|
5263 | return getSymlink;
|
5264 | }();
|
5265 |
|
5266 | },{"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"core-js/modules/es.object.assign":251,"regenerator-runtime/runtime":337}],41:[function(require,module,exports){
|
5267 | "use strict";
|
5268 |
|
5269 | var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
5270 |
|
5271 | require("core-js/modules/es.array.for-each");
|
5272 |
|
5273 | require("core-js/modules/es.array.index-of");
|
5274 |
|
5275 | require("core-js/modules/es.object.assign");
|
5276 |
|
5277 | require("core-js/modules/es.object.keys");
|
5278 |
|
5279 | require("core-js/modules/web.dom-collections.for-each");
|
5280 |
|
5281 | var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
5282 |
|
5283 | require("regenerator-runtime/runtime");
|
5284 |
|
5285 | var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
5286 |
|
5287 | var proto = exports;
|
5288 |
|
5289 |
|
5290 |
|
5291 |
|
5292 |
|
5293 |
|
5294 |
|
5295 | proto.head = function () {
|
5296 | var _head = (0, _asyncToGenerator2.default)( _regenerator.default.mark(function _callee(name) {
|
5297 | var options,
|
5298 | params,
|
5299 | result,
|
5300 | data,
|
5301 | _args = arguments;
|
5302 | return _regenerator.default.wrap(function _callee$(_context) {
|
5303 | while (1) {
|
5304 | switch (_context.prev = _context.next) {
|
5305 | case 0:
|
5306 | options = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
|
5307 | options.subres = Object.assign({}, options.subres);
|
5308 |
|
5309 | if (options.versionId) {
|
5310 | options.subres.versionId = options.versionId;
|
5311 | }
|
5312 |
|
5313 | params = this._objectRequestParams('HEAD', name, options);
|
5314 | params.successStatuses = [200, 304];
|
5315 | _context.next = 7;
|
5316 | return this.request(params);
|
5317 |
|
5318 | case 7:
|
5319 | result = _context.sent;
|
5320 | data = {
|
5321 | meta: null,
|
5322 | res: result.res,
|
5323 | status: result.status
|
5324 | };
|
5325 |
|
5326 | if (result.status === 200) {
|
5327 | Object.keys(result.headers).forEach(function (k) {
|
5328 | if (k.indexOf('x-oss-meta-') === 0) {
|
5329 | if (!data.meta) {
|
5330 | data.meta = {};
|
5331 | }
|
5332 |
|
5333 | data.meta[k.substring(11)] = result.headers[k];
|
5334 | }
|
5335 | });
|
5336 | }
|
5337 |
|
5338 | return _context.abrupt("return", data);
|
5339 |
|
5340 | case 11:
|
5341 | case "end":
|
5342 | return _context.stop();
|
5343 | }
|
5344 | }
|
5345 | }, _callee, this);
|
5346 | }));
|
5347 |
|
5348 | function head(_x) {
|
5349 | return _head.apply(this, arguments);
|
5350 | }
|
5351 |
|
5352 | return head;
|
5353 | }();
|
5354 |
|
5355 | },{"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"core-js/modules/es.array.for-each":238,"core-js/modules/es.array.index-of":241,"core-js/modules/es.object.assign":251,"core-js/modules/es.object.keys":253,"core-js/modules/web.dom-collections.for-each":292,"regenerator-runtime/runtime":337}],42:[function(require,module,exports){
|
5356 | "use strict";
|
5357 |
|
5358 | var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
5359 |
|
5360 | require("core-js/modules/es.object.assign");
|
5361 |
|
5362 | var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
5363 |
|
5364 | require("regenerator-runtime/runtime");
|
5365 |
|
5366 | var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
5367 |
|
5368 | var proto = exports;
|
5369 |
|
5370 |
|
5371 |
|
5372 |
|
5373 |
|
5374 |
|
5375 |
|
5376 | proto.putACL = function () {
|
5377 | var _putACL = (0, _asyncToGenerator2.default)( _regenerator.default.mark(function _callee(name, acl, options) {
|
5378 | var params, result;
|
5379 | return _regenerator.default.wrap(function _callee$(_context) {
|
5380 | while (1) {
|
5381 | switch (_context.prev = _context.next) {
|
5382 | case 0:
|
5383 | options = options || {};
|
5384 | options.subres = Object.assign({
|
5385 | acl: ''
|
5386 | }, options.subres);
|
5387 |
|
5388 | if (options.versionId) {
|
5389 | options.subres.versionId = options.versionId;
|
5390 | }
|
5391 |
|
5392 | options.headers = options.headers || {};
|
5393 | options.headers['x-oss-object-acl'] = acl;
|
5394 | name = this._objectName(name);
|
5395 | params = this._objectRequestParams('PUT', name, options);
|
5396 | params.successStatuses = [200];
|
5397 | _context.next = 10;
|
5398 | return this.request(params);
|
5399 |
|
5400 | case 10:
|
5401 | result = _context.sent;
|
5402 | return _context.abrupt("return", {
|
5403 | res: result.res
|
5404 | });
|
5405 |
|
5406 | case 12:
|
5407 | case "end":
|
5408 | return _context.stop();
|
5409 | }
|
5410 | }
|
5411 | }, _callee, this);
|
5412 | }));
|
5413 |
|
5414 | function putACL(_x, _x2, _x3) {
|
5415 | return _putACL.apply(this, arguments);
|
5416 | }
|
5417 |
|
5418 | return putACL;
|
5419 | }();
|
5420 |
|
5421 | },{"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"core-js/modules/es.object.assign":251,"regenerator-runtime/runtime":337}],43:[function(require,module,exports){
|
5422 | "use strict";
|
5423 |
|
5424 | var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
5425 |
|
5426 | require("core-js/modules/es.array.map");
|
5427 |
|
5428 | require("core-js/modules/es.object.assign");
|
5429 |
|
5430 | require("core-js/modules/es.object.keys");
|
5431 |
|
5432 | var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
5433 |
|
5434 | require("regenerator-runtime/runtime");
|
5435 |
|
5436 | var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
5437 |
|
5438 | var _require = require('../utils/obj2xml'),
|
5439 | obj2xml = _require.obj2xml;
|
5440 |
|
5441 | var _require2 = require('../utils/checkObjectTag'),
|
5442 | checkObjectTag = _require2.checkObjectTag;
|
5443 |
|
5444 | var proto = exports;
|
5445 |
|
5446 |
|
5447 |
|
5448 |
|
5449 |
|
5450 |
|
5451 |
|
5452 | proto.putObjectTagging = function () {
|
5453 | var _putObjectTagging = (0, _asyncToGenerator2.default)( _regenerator.default.mark(function _callee(name, tag) {
|
5454 | var options,
|
5455 | params,
|
5456 | paramXMLObj,
|
5457 | result,
|
5458 | _args = arguments;
|
5459 | return _regenerator.default.wrap(function _callee$(_context) {
|
5460 | while (1) {
|
5461 | switch (_context.prev = _context.next) {
|
5462 | case 0:
|
5463 | options = _args.length > 2 && _args[2] !== undefined ? _args[2] : {};
|
5464 | checkObjectTag(tag);
|
5465 | options.subres = Object.assign({
|
5466 | tagging: ''
|
5467 | }, options.subres);
|
5468 |
|
5469 | if (options.versionId) {
|
5470 | options.subres.versionId = options.versionId;
|
5471 | }
|
5472 |
|
5473 | name = this._objectName(name);
|
5474 | params = this._objectRequestParams('PUT', name, options);
|
5475 | params.successStatuses = [200];
|
5476 | tag = Object.keys(tag).map(function (key) {
|
5477 | return {
|
5478 | Key: key,
|
5479 | Value: tag[key]
|
5480 | };
|
5481 | });
|
5482 | paramXMLObj = {
|
5483 | Tagging: {
|
5484 | TagSet: {
|
5485 | Tag: tag
|
5486 | }
|
5487 | }
|
5488 | };
|
5489 | params.mime = 'xml';
|
5490 | params.content = obj2xml(paramXMLObj);
|
5491 | _context.next = 13;
|
5492 | return this.request(params);
|
5493 |
|
5494 | case 13:
|
5495 | result = _context.sent;
|
5496 | return _context.abrupt("return", {
|
5497 | res: result.res,
|
5498 | status: result.status
|
5499 | });
|
5500 |
|
5501 | case 15:
|
5502 | case "end":
|
5503 | return _context.stop();
|
5504 | }
|
5505 | }
|
5506 | }, _callee, this);
|
5507 | }));
|
5508 |
|
5509 | function putObjectTagging(_x, _x2) {
|
5510 | return _putObjectTagging.apply(this, arguments);
|
5511 | }
|
5512 |
|
5513 | return putObjectTagging;
|
5514 | }();
|
5515 |
|
5516 | },{"../utils/checkObjectTag":50,"../utils/obj2xml":66,"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"core-js/modules/es.array.map":245,"core-js/modules/es.object.assign":251,"core-js/modules/es.object.keys":253,"regenerator-runtime/runtime":337}],44:[function(require,module,exports){
|
5517 | "use strict";
|
5518 |
|
5519 | var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
5520 |
|
5521 | require("core-js/modules/es.object.assign");
|
5522 |
|
5523 | var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
5524 |
|
5525 | require("regenerator-runtime/runtime");
|
5526 |
|
5527 | var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
5528 |
|
5529 | var proto = exports;
|
5530 |
|
5531 |
|
5532 |
|
5533 |
|
5534 |
|
5535 |
|
5536 |
|
5537 |
|
5538 | proto.putSymlink = function () {
|
5539 | var _putSymlink = (0, _asyncToGenerator2.default)( _regenerator.default.mark(function _callee(name, targetName, options) {
|
5540 | var params, result;
|
5541 | return _regenerator.default.wrap(function _callee$(_context) {
|
5542 | while (1) {
|
5543 | switch (_context.prev = _context.next) {
|
5544 | case 0:
|
5545 | options = options || {};
|
5546 | options.headers = options.headers || {};
|
5547 | targetName = this._escape(this._objectName(targetName));
|
5548 |
|
5549 | this._convertMetaToHeaders(options.meta, options.headers);
|
5550 |
|
5551 | options.headers['x-oss-symlink-target'] = targetName;
|
5552 | options.subres = Object.assign({
|
5553 | symlink: ''
|
5554 | }, options.subres);
|
5555 |
|
5556 | if (options.versionId) {
|
5557 | options.subres.versionId = options.versionId;
|
5558 | }
|
5559 |
|
5560 | if (options.storageClass) {
|
5561 | options.headers['x-oss-storage-class'] = options.storageClass;
|
5562 | }
|
5563 |
|
5564 | name = this._objectName(name);
|
5565 | params = this._objectRequestParams('PUT', name, options);
|
5566 | params.successStatuses = [200];
|
5567 | _context.next = 13;
|
5568 | return this.request(params);
|
5569 |
|
5570 | case 13:
|
5571 | result = _context.sent;
|
5572 | return _context.abrupt("return", {
|
5573 | res: result.res
|
5574 | });
|
5575 |
|
5576 | case 15:
|
5577 | case "end":
|
5578 | return _context.stop();
|
5579 | }
|
5580 | }
|
5581 | }, _callee, this);
|
5582 | }));
|
5583 |
|
5584 | function putSymlink(_x, _x2, _x3) {
|
5585 | return _putSymlink.apply(this, arguments);
|
5586 | }
|
5587 |
|
5588 | return putSymlink;
|
5589 | }();
|
5590 |
|
5591 | },{"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"core-js/modules/es.object.assign":251,"regenerator-runtime/runtime":337}],45:[function(require,module,exports){
|
5592 | "use strict";
|
5593 |
|
5594 | var urlutil = require('url');
|
5595 |
|
5596 | var utility = require('utility');
|
5597 |
|
5598 | var copy = require('copy-to');
|
5599 |
|
5600 | var signHelper = require('../../common/signUtils');
|
5601 |
|
5602 | var _require = require('../utils/isIP'),
|
5603 | isIP = _require.isIP;
|
5604 |
|
5605 | var proto = exports;
|
5606 |
|
5607 | proto.signatureUrl = function signatureUrl(name, options) {
|
5608 | if (isIP(this.options.endpoint.hostname)) {
|
5609 | throw new Error('can not get the object URL when endpoint is IP');
|
5610 | }
|
5611 |
|
5612 | options = options || {};
|
5613 | name = this._objectName(name);
|
5614 | options.method = options.method || 'GET';
|
5615 | var expires = utility.timestamp() + (options.expires || 1800);
|
5616 | var params = {
|
5617 | bucket: this.options.bucket,
|
5618 | object: name
|
5619 | };
|
5620 |
|
5621 | var resource = this._getResource(params);
|
5622 |
|
5623 | if (this.options.stsToken) {
|
5624 | options['security-token'] = this.options.stsToken;
|
5625 | }
|
5626 |
|
5627 | var signRes = signHelper._signatureForURL(this.options.accessKeySecret, options, resource, expires);
|
5628 |
|
5629 | var url = urlutil.parse(this._getReqUrl(params));
|
5630 | url.query = {
|
5631 | OSSAccessKeyId: this.options.accessKeyId,
|
5632 | Expires: expires,
|
5633 | Signature: signRes.Signature
|
5634 | };
|
5635 | copy(signRes.subResource).to(url.query);
|
5636 | return url.format();
|
5637 | };
|
5638 |
|
5639 | },{"../../common/signUtils":47,"../utils/isIP":63,"copy-to":101,"url":394,"utility":396}],46:[function(require,module,exports){
|
5640 | "use strict";
|
5641 |
|
5642 | var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
5643 |
|
5644 | require("core-js/modules/es.array.for-each");
|
5645 |
|
5646 | require("core-js/modules/es.array.iterator");
|
5647 |
|
5648 | require("core-js/modules/es.function.name");
|
5649 |
|
5650 | require("core-js/modules/es.object.to-string");
|
5651 |
|
5652 | require("core-js/modules/es.promise");
|
5653 |
|
5654 | require("core-js/modules/es.string.iterator");
|
5655 |
|
5656 | require("core-js/modules/web.dom-collections.for-each");
|
5657 |
|
5658 | require("core-js/modules/web.dom-collections.iterator");
|
5659 |
|
5660 | var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
5661 |
|
5662 | require("regenerator-runtime/runtime");
|
5663 |
|
5664 | var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
5665 |
|
5666 | var _require = require("./utils/isArray"),
|
5667 | isArray = _require.isArray;
|
5668 |
|
5669 | var proto = exports;
|
5670 |
|
5671 | proto._parallelNode = function () {
|
5672 | var _parallelNode2 = (0, _asyncToGenerator2.default)( _regenerator.default.mark(function _callee(todo, parallel, fn, sourceData) {
|
5673 | var that, jobErr, jobs, tempBatch, remainder, batch, taskIndex, i;
|
5674 | return _regenerator.default.wrap(function _callee$(_context) {
|
5675 | while (1) {
|
5676 | switch (_context.prev = _context.next) {
|
5677 | case 0:
|
5678 | that = this;
|
5679 |
|
5680 | jobErr = [];
|
5681 | jobs = [];
|
5682 | tempBatch = todo.length / parallel;
|
5683 | remainder = todo.length % parallel;
|
5684 | batch = remainder === 0 ? tempBatch : (todo.length - remainder) / parallel + 1;
|
5685 | taskIndex = 1;
|
5686 | i = 0;
|
5687 |
|
5688 | case 8:
|
5689 | if (!(i < todo.length)) {
|
5690 | _context.next = 26;
|
5691 | break;
|
5692 | }
|
5693 |
|
5694 | if (!that.isCancel()) {
|
5695 | _context.next = 11;
|
5696 | break;
|
5697 | }
|
5698 |
|
5699 | return _context.abrupt("break", 26);
|
5700 |
|
5701 | case 11:
|
5702 | if (sourceData) {
|
5703 | jobs.push(fn(that, todo[i], sourceData));
|
5704 | } else {
|
5705 | jobs.push(fn(that, todo[i]));
|
5706 | }
|
5707 |
|
5708 | if (!(jobs.length === parallel || taskIndex === batch && i === todo.length - 1)) {
|
5709 | _context.next = 23;
|
5710 | break;
|
5711 | }
|
5712 |
|
5713 | _context.prev = 13;
|
5714 | taskIndex += 1;
|
5715 |
|
5716 |
|
5717 | _context.next = 17;
|
5718 | return Promise.all(jobs);
|
5719 |
|
5720 | case 17:
|
5721 | _context.next = 22;
|
5722 | break;
|
5723 |
|
5724 | case 19:
|
5725 | _context.prev = 19;
|
5726 | _context.t0 = _context["catch"](13);
|
5727 | jobErr.push(_context.t0);
|
5728 |
|
5729 | case 22:
|
5730 | jobs = [];
|
5731 |
|
5732 | case 23:
|
5733 | i++;
|
5734 | _context.next = 8;
|
5735 | break;
|
5736 |
|
5737 | case 26:
|
5738 | return _context.abrupt("return", jobErr);
|
5739 |
|
5740 | case 27:
|
5741 | case "end":
|
5742 | return _context.stop();
|
5743 | }
|
5744 | }
|
5745 | }, _callee, this, [[13, 19]]);
|
5746 | }));
|
5747 |
|
5748 | function _parallelNode(_x, _x2, _x3, _x4) {
|
5749 | return _parallelNode2.apply(this, arguments);
|
5750 | }
|
5751 |
|
5752 | return _parallelNode;
|
5753 | }();
|
5754 |
|
5755 | proto._parallel = function _parallel(todo, parallel, jobPromise) {
|
5756 | var that = this;
|
5757 | return new Promise(function (resolve) {
|
5758 | var _jobErr = [];
|
5759 |
|
5760 | if (parallel <= 0 || !todo) {
|
5761 | resolve(_jobErr);
|
5762 | return;
|
5763 | }
|
5764 |
|
5765 | function onlyOnce(fn) {
|
5766 | return function () {
|
5767 | if (fn === null) throw new Error('Callback was already called.');
|
5768 | var callFn = fn;
|
5769 | fn = null;
|
5770 |
|
5771 | for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
5772 | args[_key] = arguments[_key];
|
5773 | }
|
5774 |
|
5775 | callFn.apply(this, args);
|
5776 | };
|
5777 | }
|
5778 |
|
5779 | function createArrayIterator(coll) {
|
5780 | var i = -1;
|
5781 | var len = coll.length;
|
5782 | return function next() {
|
5783 | return ++i < len && !that.isCancel() ? {
|
5784 | value: coll[i],
|
5785 | key: i
|
5786 | } : null;
|
5787 | };
|
5788 | }
|
5789 |
|
5790 | var nextElem = createArrayIterator(todo);
|
5791 | var done = false;
|
5792 | var running = 0;
|
5793 | var looping = false;
|
5794 |
|
5795 | function iterateeCallback(err, value) {
|
5796 | running -= 1;
|
5797 |
|
5798 | if (err) {
|
5799 | done = true;
|
5800 |
|
5801 | _jobErr.push(err);
|
5802 |
|
5803 | resolve(_jobErr);
|
5804 | } else if (value === {} || done && running <= 0) {
|
5805 | done = true;
|
5806 | resolve(_jobErr);
|
5807 | } else if (!looping) {
|
5808 |
|
5809 | if (that.isCancel()) {
|
5810 | resolve(_jobErr);
|
5811 | } else {
|
5812 | replenish();
|
5813 | }
|
5814 | }
|
5815 | }
|
5816 |
|
5817 | function iteratee(value, callback) {
|
5818 | jobPromise(value).then(function (result) {
|
5819 | callback(null, result);
|
5820 | }).catch(function (err) {
|
5821 | callback(err);
|
5822 | });
|
5823 | }
|
5824 |
|
5825 | function replenish() {
|
5826 | looping = true;
|
5827 |
|
5828 | while (running < parallel && !done && !that.isCancel()) {
|
5829 | var elem = nextElem();
|
5830 |
|
5831 | if (elem === null || _jobErr.length > 0) {
|
5832 | done = true;
|
5833 |
|
5834 | if (running <= 0) {
|
5835 | resolve(_jobErr);
|
5836 | }
|
5837 |
|
5838 | return;
|
5839 | }
|
5840 |
|
5841 | running += 1;
|
5842 | iteratee(elem.value, onlyOnce(iterateeCallback));
|
5843 | }
|
5844 |
|
5845 | looping = false;
|
5846 | }
|
5847 |
|
5848 | replenish();
|
5849 | });
|
5850 | };
|
5851 |
|
5852 |
|
5853 |
|
5854 |
|
5855 |
|
5856 |
|
5857 |
|
5858 |
|
5859 |
|
5860 | proto.cancel = function cancel(abort) {
|
5861 | this.options.cancelFlag = true;
|
5862 |
|
5863 | if (isArray(this.multipartUploadStreams)) {
|
5864 | this.multipartUploadStreams.forEach(function (_) {
|
5865 | if (_.destroyed === false) {
|
5866 | var err = {
|
5867 | name: 'cancel',
|
5868 | message: 'cancel'
|
5869 | };
|
5870 |
|
5871 | _.destroy(err);
|
5872 | }
|
5873 | });
|
5874 | }
|
5875 |
|
5876 | this.multipartUploadStreams = [];
|
5877 |
|
5878 | if (abort) {
|
5879 | this.abortMultipartUpload(abort.name, abort.uploadId, abort.options);
|
5880 | }
|
5881 | };
|
5882 |
|
5883 | proto.isCancel = function isCancel() {
|
5884 | return this.options.cancelFlag;
|
5885 | };
|
5886 |
|
5887 | proto.resetCancelFlag = function resetCancelFlag() {
|
5888 | this.options.cancelFlag = false;
|
5889 | };
|
5890 |
|
5891 | proto._stop = function _stop() {
|
5892 | this.options.cancelFlag = true;
|
5893 | };
|
5894 |
|
5895 |
|
5896 | proto._makeCancelEvent = function _makeCancelEvent() {
|
5897 | var cancelEvent = {
|
5898 | status: 0,
|
5899 | name: 'cancel'
|
5900 | };
|
5901 | return cancelEvent;
|
5902 | };
|
5903 |
|
5904 |
|
5905 | proto._makeAbortEvent = function _makeAbortEvent() {
|
5906 | var abortEvent = {
|
5907 | status: 0,
|
5908 | name: 'abort',
|
5909 | message: 'upload task has been abort'
|
5910 | };
|
5911 | return abortEvent;
|
5912 | };
|
5913 |
|
5914 | },{"./utils/isArray":59,"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"core-js/modules/es.array.for-each":238,"core-js/modules/es.array.iterator":242,"core-js/modules/es.function.name":249,"core-js/modules/es.object.to-string":254,"core-js/modules/es.promise":255,"core-js/modules/es.string.iterator":259,"core-js/modules/web.dom-collections.for-each":292,"core-js/modules/web.dom-collections.iterator":293,"regenerator-runtime/runtime":337}],47:[function(require,module,exports){
|
5915 | (function (Buffer){
|
5916 | "use strict";
|
5917 |
|
5918 | require("core-js/modules/es.array.concat");
|
5919 |
|
5920 | require("core-js/modules/es.array.for-each");
|
5921 |
|
5922 | require("core-js/modules/es.array.index-of");
|
5923 |
|
5924 | require("core-js/modules/es.array.join");
|
5925 |
|
5926 | require("core-js/modules/es.array.sort");
|
5927 |
|
5928 | require("core-js/modules/es.object.keys");
|
5929 |
|
5930 | require("core-js/modules/es.object.to-string");
|
5931 |
|
5932 | require("core-js/modules/es.regexp.to-string");
|
5933 |
|
5934 | require("core-js/modules/es.string.trim");
|
5935 |
|
5936 | require("core-js/modules/web.dom-collections.for-each");
|
5937 |
|
5938 | var crypto = require('./../../shims/crypto/crypto.js');
|
5939 |
|
5940 | var is = require('is-type-of');
|
5941 |
|
5942 | var _require = require('./utils/lowercaseKeyHeader'),
|
5943 | lowercaseKeyHeader = _require.lowercaseKeyHeader;
|
5944 |
|
5945 |
|
5946 |
|
5947 |
|
5948 |
|
5949 |
|
5950 |
|
5951 |
|
5952 | exports.buildCanonicalizedResource = function buildCanonicalizedResource(resourcePath, parameters) {
|
5953 | var canonicalizedResource = "".concat(resourcePath);
|
5954 | var separatorString = '?';
|
5955 |
|
5956 | if (is.string(parameters) && parameters.trim() !== '') {
|
5957 | canonicalizedResource += separatorString + parameters;
|
5958 | } else if (is.array(parameters)) {
|
5959 | parameters.sort();
|
5960 | canonicalizedResource += separatorString + parameters.join('&');
|
5961 | } else if (parameters) {
|
5962 | var compareFunc = function compareFunc(entry1, entry2) {
|
5963 | if (entry1[0] > entry2[0]) {
|
5964 | return 1;
|
5965 | } else if (entry1[0] < entry2[0]) {
|
5966 | return -1;
|
5967 | }
|
5968 |
|
5969 | return 0;
|
5970 | };
|
5971 |
|
5972 | var processFunc = function processFunc(key) {
|
5973 | canonicalizedResource += separatorString + key;
|
5974 |
|
5975 | if (parameters[key]) {
|
5976 | canonicalizedResource += "=".concat(parameters[key]);
|
5977 | }
|
5978 |
|
5979 | separatorString = '&';
|
5980 | };
|
5981 |
|
5982 | Object.keys(parameters).sort(compareFunc).forEach(processFunc);
|
5983 | }
|
5984 |
|
5985 | return canonicalizedResource;
|
5986 | };
|
5987 |
|
5988 |
|
5989 |
|
5990 |
|
5991 |
|
5992 |
|
5993 |
|
5994 |
|
5995 |
|
5996 | exports.buildCanonicalString = function canonicalString(method, resourcePath, request, expires) {
|
5997 | request = request || {};
|
5998 | var headers = lowercaseKeyHeader(request.headers);
|
5999 | var OSS_PREFIX = 'x-oss-';
|
6000 | var ossHeaders = [];
|
6001 | var headersToSign = {};
|
6002 | var signContent = [method.toUpperCase(), headers['content-md5'] || '', headers['content-type'], expires || headers['x-oss-date']];
|
6003 | Object.keys(headers).forEach(function (key) {
|
6004 | var lowerKey = key.toLowerCase();
|
6005 |
|
6006 | if (lowerKey.indexOf(OSS_PREFIX) === 0) {
|
6007 | headersToSign[lowerKey] = String(headers[key]).trim();
|
6008 | }
|
6009 | });
|
6010 | Object.keys(headersToSign).sort().forEach(function (key) {
|
6011 | ossHeaders.push("".concat(key, ":").concat(headersToSign[key]));
|
6012 | });
|
6013 | signContent = signContent.concat(ossHeaders);
|
6014 | signContent.push(this.buildCanonicalizedResource(resourcePath, request.parameters));
|
6015 | return signContent.join('\n');
|
6016 | };
|
6017 |
|
6018 |
|
6019 |
|
6020 |
|
6021 |
|
6022 |
|
6023 | exports.computeSignature = function computeSignature(accessKeySecret, canonicalString) {
|
6024 | var headerEncoding = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'utf-8';
|
6025 | var signature = crypto.createHmac('sha1', accessKeySecret);
|
6026 | return signature.update(Buffer.from(canonicalString, headerEncoding)).digest('base64');
|
6027 | };
|
6028 |
|
6029 |
|
6030 |
|
6031 |
|
6032 |
|
6033 |
|
6034 |
|
6035 | exports.authorization = function authorization(accessKeyId, accessKeySecret, canonicalString, headerEncoding) {
|
6036 | return "OSS ".concat(accessKeyId, ":").concat(this.computeSignature(accessKeySecret, canonicalString, headerEncoding));
|
6037 | };
|
6038 |
|
6039 |
|
6040 |
|
6041 |
|
6042 |
|
6043 |
|
6044 |
|
6045 |
|
6046 |
|
6047 | exports._signatureForURL = function _signatureForURL(accessKeySecret) {
|
6048 | var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
6049 | var resource = arguments.length > 2 ? arguments[2] : undefined;
|
6050 | var expires = arguments.length > 3 ? arguments[3] : undefined;
|
6051 | var headerEncoding = arguments.length > 4 ? arguments[4] : undefined;
|
6052 | var headers = {};
|
6053 | var _options$subResource = options.subResource,
|
6054 | subResource = _options$subResource === void 0 ? {} : _options$subResource;
|
6055 |
|
6056 | if (options.process) {
|
6057 | var processKeyword = 'x-oss-process';
|
6058 | subResource[processKeyword] = options.process;
|
6059 | }
|
6060 |
|
6061 | if (options.trafficLimit) {
|
6062 | var trafficLimitKey = 'x-oss-traffic-limit';
|
6063 | subResource[trafficLimitKey] = options.trafficLimit;
|
6064 | }
|
6065 |
|
6066 | if (options.response) {
|
6067 | Object.keys(options.response).forEach(function (k) {
|
6068 | var key = "response-".concat(k.toLowerCase());
|
6069 | subResource[key] = options.response[k];
|
6070 | });
|
6071 | }
|
6072 |
|
6073 | Object.keys(options).forEach(function (key) {
|
6074 | var lowerKey = key.toLowerCase();
|
6075 | var value = options[key];
|
6076 |
|
6077 | if (lowerKey.indexOf('x-oss-') === 0) {
|
6078 | headers[lowerKey] = value;
|
6079 | } else if (lowerKey.indexOf('content-md5') === 0) {
|
6080 | headers[key] = value;
|
6081 | } else if (lowerKey.indexOf('content-type') === 0) {
|
6082 | headers[key] = value;
|
6083 | }
|
6084 | });
|
6085 |
|
6086 | if (Object.prototype.hasOwnProperty.call(options, 'security-token')) {
|
6087 | subResource['security-token'] = options['security-token'];
|
6088 | }
|
6089 |
|
6090 | if (Object.prototype.hasOwnProperty.call(options, 'callback')) {
|
6091 | var json = {
|
6092 | callbackUrl: encodeURI(options.callback.url),
|
6093 | callbackBody: options.callback.body
|
6094 | };
|
6095 |
|
6096 | if (options.callback.host) {
|
6097 | json.callbackHost = options.callback.host;
|
6098 | }
|
6099 |
|
6100 | if (options.callback.contentType) {
|
6101 | json.callbackBodyType = options.callback.contentType;
|
6102 | }
|
6103 |
|
6104 | subResource.callback = Buffer.from(JSON.stringify(json)).toString('base64');
|
6105 |
|
6106 | if (options.callback.customValue) {
|
6107 | var callbackVar = {};
|
6108 | Object.keys(options.callback.customValue).forEach(function (key) {
|
6109 | callbackVar["x:".concat(key)] = options.callback.customValue[key];
|
6110 | });
|
6111 | subResource['callback-var'] = Buffer.from(JSON.stringify(callbackVar)).toString('base64');
|
6112 | }
|
6113 | }
|
6114 |
|
6115 | var canonicalString = this.buildCanonicalString(options.method, resource, {
|
6116 | headers: headers,
|
6117 | parameters: subResource
|
6118 | }, expires.toString());
|
6119 | return {
|
6120 | Signature: this.computeSignature(accessKeySecret, canonicalString, headerEncoding),
|
6121 | subResource: subResource
|
6122 | };
|
6123 | };
|
6124 |
|
6125 | }).call(this,require("buffer").Buffer)
|
6126 | },{"./../../shims/crypto/crypto.js":387,"./utils/lowercaseKeyHeader":65,"buffer":98,"core-js/modules/es.array.concat":234,"core-js/modules/es.array.for-each":238,"core-js/modules/es.array.index-of":241,"core-js/modules/es.array.join":243,"core-js/modules/es.array.sort":247,"core-js/modules/es.object.keys":253,"core-js/modules/es.object.to-string":254,"core-js/modules/es.regexp.to-string":257,"core-js/modules/es.string.trim":265,"core-js/modules/web.dom-collections.for-each":292,"is-type-of":392}],48:[function(require,module,exports){
|
6127 | "use strict";
|
6128 |
|
6129 | Object.defineProperty(exports, "__esModule", {
|
6130 | value: true
|
6131 | });
|
6132 | exports.checkBucketName = void 0;
|
6133 |
|
6134 | exports.checkBucketName = function (name) {
|
6135 | var createBucket = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
6136 | var bucketRegex = createBucket ? /^[a-z0-9][a-z0-9-]{1,61}[a-z0-9]$/ : /^[a-z0-9_][a-z0-9-_]{1,61}[a-z0-9_]$/;
|
6137 |
|
6138 | if (!bucketRegex.test(name)) {
|
6139 | throw new Error('The bucket must be conform to the specifications');
|
6140 | }
|
6141 | };
|
6142 |
|
6143 | },{}],49:[function(require,module,exports){
|
6144 | "use strict";
|
6145 |
|
6146 | Object.defineProperty(exports, "__esModule", {
|
6147 | value: true
|
6148 | });
|
6149 | exports.checkConfigValid = void 0;
|
6150 | var checkConfigMap = {
|
6151 | endpoint: checkEndpoint,
|
6152 | region: /^[a-zA-Z0-9\-_]+$/
|
6153 | };
|
6154 |
|
6155 | function checkEndpoint(endpoint) {
|
6156 | if (typeof endpoint === 'string') {
|
6157 | return /^[a-zA-Z0-9._:/-]+$/.test(endpoint);
|
6158 | } else if (endpoint.host) {
|
6159 | return /^[a-zA-Z0-9._:/-]+$/.test(endpoint.host);
|
6160 | }
|
6161 |
|
6162 | return false;
|
6163 | }
|
6164 |
|
6165 | exports.checkConfigValid = function (conf, key) {
|
6166 | if (checkConfigMap[key]) {
|
6167 | var isConfigValid = true;
|
6168 |
|
6169 | if (checkConfigMap[key] instanceof Function) {
|
6170 | isConfigValid = checkConfigMap[key](conf);
|
6171 | } else {
|
6172 | isConfigValid = checkConfigMap[key].test(conf);
|
6173 | }
|
6174 |
|
6175 | if (!isConfigValid) {
|
6176 | throw new Error("The ".concat(key, " must be conform to the specifications"));
|
6177 | }
|
6178 | }
|
6179 | };
|
6180 |
|
6181 | },{}],50:[function(require,module,exports){
|
6182 | "use strict";
|
6183 |
|
6184 | require("core-js/modules/es.array.concat");
|
6185 |
|
6186 | require("core-js/modules/es.array.for-each");
|
6187 |
|
6188 | require("core-js/modules/es.object.entries");
|
6189 |
|
6190 | require("core-js/modules/web.dom-collections.for-each");
|
6191 |
|
6192 | Object.defineProperty(exports, "__esModule", {
|
6193 | value: true
|
6194 | });
|
6195 | exports.checkObjectTag = void 0;
|
6196 |
|
6197 | var _require = require('./checkValid'),
|
6198 | checkValid = _require.checkValid;
|
6199 |
|
6200 | var _require2 = require('./isObject'),
|
6201 | isObject = _require2.isObject;
|
6202 |
|
6203 | var commonRules = [{
|
6204 | validator: function validator(value) {
|
6205 | if (typeof value !== 'string') {
|
6206 | throw new Error('the key and value of the tag must be String');
|
6207 | }
|
6208 | }
|
6209 | }, {
|
6210 | pattern: /^[a-zA-Z0-9 +-=._:/]+$/,
|
6211 | msg: 'tag can contain letters, numbers, spaces, and the following symbols: plus sign (+), hyphen (-), equal sign (=), period (.), underscore (_), colon (:), and forward slash (/)'
|
6212 | }];
|
6213 | var rules = {
|
6214 | key: [].concat(commonRules, [{
|
6215 | pattern: /^.{1,128}$/,
|
6216 | msg: 'tag key can be a maximum of 128 bytes in length'
|
6217 | }]),
|
6218 | value: [].concat(commonRules, [{
|
6219 | pattern: /^.{0,256}$/,
|
6220 | msg: 'tag value can be a maximum of 256 bytes in length'
|
6221 | }])
|
6222 | };
|
6223 |
|
6224 | function checkObjectTag(tag) {
|
6225 | if (!isObject(tag)) {
|
6226 | throw new Error('tag must be Object');
|
6227 | }
|
6228 |
|
6229 | var entries = Object.entries(tag);
|
6230 |
|
6231 | if (entries.length > 10) {
|
6232 | throw new Error('maximum of 10 tags for a object');
|
6233 | }
|
6234 |
|
6235 | var rulesIndexKey = ['key', 'value'];
|
6236 | entries.forEach(function (keyValue) {
|
6237 | keyValue.forEach(function (item, index) {
|
6238 | checkValid(item, rules[rulesIndexKey[index]]);
|
6239 | });
|
6240 | });
|
6241 | }
|
6242 |
|
6243 | exports.checkObjectTag = checkObjectTag;
|
6244 |
|
6245 | },{"./checkValid":51,"./isObject":64,"core-js/modules/es.array.concat":234,"core-js/modules/es.array.for-each":238,"core-js/modules/es.object.entries":252,"core-js/modules/web.dom-collections.for-each":292}],51:[function(require,module,exports){
|
6246 | "use strict";
|
6247 |
|
6248 | require("core-js/modules/es.array.for-each");
|
6249 |
|
6250 | require("core-js/modules/web.dom-collections.for-each");
|
6251 |
|
6252 | Object.defineProperty(exports, "__esModule", {
|
6253 | value: true
|
6254 | });
|
6255 | exports.checkValid = void 0;
|
6256 |
|
6257 | function checkValid(_value, _rules) {
|
6258 | _rules.forEach(function (rule) {
|
6259 | if (rule.validator) {
|
6260 | rule.validator(_value);
|
6261 | } else if (rule.pattern && !rule.pattern.test(_value)) {
|
6262 | throw new Error(rule.msg);
|
6263 | }
|
6264 | });
|
6265 | }
|
6266 |
|
6267 | exports.checkValid = checkValid;
|
6268 |
|
6269 | },{"core-js/modules/es.array.for-each":238,"core-js/modules/web.dom-collections.for-each":292}],52:[function(require,module,exports){
|
6270 | (function (Buffer){
|
6271 | "use strict";
|
6272 |
|
6273 | require("core-js/modules/es.array.concat");
|
6274 |
|
6275 | require("core-js/modules/es.array.includes");
|
6276 |
|
6277 | require("core-js/modules/es.array.index-of");
|
6278 |
|
6279 | require("core-js/modules/es.object.assign");
|
6280 |
|
6281 | require("core-js/modules/es.string.includes");
|
6282 |
|
6283 | Object.defineProperty(exports, "__esModule", {
|
6284 | value: true
|
6285 | });
|
6286 | exports.createRequest = void 0;
|
6287 |
|
6288 | var crypto = require('./../../../shims/crypto/crypto.js');
|
6289 |
|
6290 | var debug = require('debug')('ali-oss');
|
6291 |
|
6292 | var mime = require('mime');
|
6293 |
|
6294 | var dateFormat = require('dateformat');
|
6295 |
|
6296 | var copy = require('copy-to');
|
6297 |
|
6298 | var path = require('path');
|
6299 |
|
6300 | var _require = require('./encoder'),
|
6301 | encoder = _require.encoder;
|
6302 |
|
6303 | var _require2 = require('./isIP'),
|
6304 | isIP = _require2.isIP;
|
6305 |
|
6306 | var _require3 = require('./setRegion'),
|
6307 | setRegion = _require3.setRegion;
|
6308 |
|
6309 | var _require4 = require('../client/getReqUrl'),
|
6310 | getReqUrl = _require4.getReqUrl;
|
6311 |
|
6312 | function getHeader(headers, name) {
|
6313 | return headers[name] || headers[name.toLowerCase()];
|
6314 | }
|
6315 |
|
6316 | function delHeader(headers, name) {
|
6317 | delete headers[name];
|
6318 | delete headers[name.toLowerCase()];
|
6319 | }
|
6320 |
|
6321 | function createRequest(params) {
|
6322 | var date = new Date();
|
6323 |
|
6324 | if (this.options.amendTimeSkewed) {
|
6325 | date = +new Date() + this.options.amendTimeSkewed;
|
6326 | }
|
6327 |
|
6328 | var headers = {
|
6329 | 'x-oss-date': dateFormat(date, 'UTC:ddd, dd mmm yyyy HH:MM:ss \'GMT\''),
|
6330 | 'x-oss-user-agent': this.userAgent
|
6331 | };
|
6332 |
|
6333 | if (this.userAgent.includes('nodejs')) {
|
6334 | headers['User-Agent'] = this.userAgent;
|
6335 | }
|
6336 |
|
6337 | if (this.options.isRequestPay) {
|
6338 | Object.assign(headers, {
|
6339 | 'x-oss-request-payer': 'requester'
|
6340 | });
|
6341 | }
|
6342 |
|
6343 | if (this.options.stsToken) {
|
6344 | headers['x-oss-security-token'] = this.options.stsToken;
|
6345 | }
|
6346 |
|
6347 | copy(params.headers).to(headers);
|
6348 |
|
6349 | if (!getHeader(headers, 'Content-Type')) {
|
6350 | if (params.mime && params.mime.indexOf('/') > 0) {
|
6351 | headers['Content-Type'] = params.mime;
|
6352 | } else {
|
6353 | headers['Content-Type'] = mime.getType(params.mime || path.extname(params.object || ''));
|
6354 | }
|
6355 | }
|
6356 |
|
6357 | if (!getHeader(headers, 'Content-Type')) {
|
6358 | delHeader(headers, 'Content-Type');
|
6359 | }
|
6360 |
|
6361 | if (params.content) {
|
6362 | headers['Content-MD5'] = crypto.createHash('md5').update(Buffer.from(params.content, 'utf8')).digest('base64');
|
6363 |
|
6364 | if (!headers['Content-Length']) {
|
6365 | headers['Content-Length'] = params.content.length;
|
6366 | }
|
6367 | }
|
6368 |
|
6369 | var hasOwnProperty = Object.prototype.hasOwnProperty;
|
6370 |
|
6371 | for (var k in headers) {
|
6372 | if (headers[k] && hasOwnProperty.call(headers, k)) {
|
6373 | headers[k] = encoder(String(headers[k]), this.options.headerEncoding);
|
6374 | }
|
6375 | }
|
6376 |
|
6377 | var authResource = this._getResource(params);
|
6378 |
|
6379 | headers.authorization = this.authorization(params.method, authResource, params.subres, headers, this.options.headerEncoding);
|
6380 |
|
6381 | if (isIP(this.options.endpoint.hostname)) {
|
6382 | var _this$options = this.options,
|
6383 | region = _this$options.region,
|
6384 | internal = _this$options.internal,
|
6385 | secure = _this$options.secure;
|
6386 | var hostInfo = setRegion(region, internal, secure);
|
6387 | headers.host = "".concat(params.bucket, ".").concat(hostInfo.host);
|
6388 | }
|
6389 |
|
6390 | var url = getReqUrl.bind(this)(params);
|
6391 | debug('request %s %s, with headers %j, !!stream: %s', params.method, url, headers, !!params.stream);
|
6392 | var timeout = params.timeout || this.options.timeout;
|
6393 | var reqParams = {
|
6394 | method: params.method,
|
6395 | content: params.content,
|
6396 | stream: params.stream,
|
6397 | headers: headers,
|
6398 | timeout: timeout,
|
6399 | writeStream: params.writeStream,
|
6400 | customResponse: params.customResponse,
|
6401 | ctx: params.ctx || this.ctx
|
6402 | };
|
6403 |
|
6404 | if (this.agent) {
|
6405 | reqParams.agent = this.agent;
|
6406 | }
|
6407 |
|
6408 | if (this.httpsAgent) {
|
6409 | reqParams.httpsAgent = this.httpsAgent;
|
6410 | }
|
6411 |
|
6412 | reqParams.enableProxy = !!this.options.enableProxy;
|
6413 | reqParams.proxy = this.options.proxy ? this.options.proxy : null;
|
6414 | return {
|
6415 | url: url,
|
6416 | params: reqParams
|
6417 | };
|
6418 | }
|
6419 |
|
6420 | exports.createRequest = createRequest;
|
6421 |
|
6422 | }).call(this,require("buffer").Buffer)
|
6423 | },{"../client/getReqUrl":24,"./../../../shims/crypto/crypto.js":387,"./encoder":55,"./isIP":63,"./setRegion":68,"buffer":98,"copy-to":101,"core-js/modules/es.array.concat":234,"core-js/modules/es.array.includes":240,"core-js/modules/es.array.index-of":241,"core-js/modules/es.object.assign":251,"core-js/modules/es.string.includes":258,"dateformat":295,"debug":391,"mime":313,"path":316}],53:[function(require,module,exports){
|
6424 | "use strict";
|
6425 |
|
6426 | require("core-js/modules/es.array.for-each");
|
6427 |
|
6428 | require("core-js/modules/es.array.includes");
|
6429 |
|
6430 | require("core-js/modules/es.object.entries");
|
6431 |
|
6432 | require("core-js/modules/es.object.keys");
|
6433 |
|
6434 | require("core-js/modules/es.regexp.exec");
|
6435 |
|
6436 | require("core-js/modules/es.string.replace");
|
6437 |
|
6438 | require("core-js/modules/web.dom-collections.for-each");
|
6439 |
|
6440 | Object.defineProperty(exports, "__esModule", {
|
6441 | value: true
|
6442 | });
|
6443 | exports.dataFix = void 0;
|
6444 |
|
6445 | var isObject_1 = require("./isObject");
|
6446 |
|
6447 | var TRUE = ['true', 'TRUE', '1', 1];
|
6448 | var FALSE = ['false', 'FALSE', '0', 0];
|
6449 |
|
6450 | function dataFix(o, conf, finalKill) {
|
6451 | if (!isObject_1.isObject(o)) return;
|
6452 | var _conf$remove = conf.remove,
|
6453 | remove = _conf$remove === void 0 ? [] : _conf$remove,
|
6454 | _conf$rename = conf.rename,
|
6455 | rename = _conf$rename === void 0 ? {} : _conf$rename,
|
6456 | _conf$camel = conf.camel,
|
6457 | camel = _conf$camel === void 0 ? [] : _conf$camel,
|
6458 | _conf$bool = conf.bool,
|
6459 | bool = _conf$bool === void 0 ? [] : _conf$bool,
|
6460 | _conf$lowerFirst = conf.lowerFirst,
|
6461 | lowerFirst = _conf$lowerFirst === void 0 ? false : _conf$lowerFirst;
|
6462 |
|
6463 | remove.forEach(function (v) {
|
6464 | return delete o[v];
|
6465 | });
|
6466 |
|
6467 | Object.entries(rename).forEach(function (v) {
|
6468 | if (!o[v[0]]) return;
|
6469 | if (o[v[1]]) return;
|
6470 | o[v[1]] = o[v[0]];
|
6471 | delete o[v[0]];
|
6472 | });
|
6473 |
|
6474 | camel.forEach(function (v) {
|
6475 | if (!o[v]) return;
|
6476 | var afterKey = v.replace(/^(.)/, function ($0) {
|
6477 | return $0.toLowerCase();
|
6478 | }).replace(/-(\w)/g, function (_, $1) {
|
6479 | return $1.toUpperCase();
|
6480 | });
|
6481 | if (o[afterKey]) return;
|
6482 | o[afterKey] = o[v];
|
6483 |
|
6484 | });
|
6485 |
|
6486 | bool.forEach(function (v) {
|
6487 | o[v] = fixBool(o[v]);
|
6488 | });
|
6489 |
|
6490 | if (typeof finalKill === 'function') {
|
6491 | finalKill(o);
|
6492 | }
|
6493 |
|
6494 |
|
6495 | fixLowerFirst(o, lowerFirst);
|
6496 | return dataFix;
|
6497 | }
|
6498 |
|
6499 | exports.dataFix = dataFix;
|
6500 |
|
6501 | function fixBool(value) {
|
6502 | if (!value) return false;
|
6503 | if (TRUE.includes(value)) return true;
|
6504 | return FALSE.includes(value) ? false : value;
|
6505 | }
|
6506 |
|
6507 | function fixLowerFirst(o, lowerFirst) {
|
6508 | if (lowerFirst) {
|
6509 | Object.keys(o).forEach(function (key) {
|
6510 | var lowerK = key.replace(/^\w/, function (match) {
|
6511 | return match.toLowerCase();
|
6512 | });
|
6513 |
|
6514 | if (typeof o[lowerK] === 'undefined') {
|
6515 | o[lowerK] = o[key];
|
6516 | delete o[key];
|
6517 | }
|
6518 | });
|
6519 | }
|
6520 | }
|
6521 |
|
6522 | },{"./isObject":64,"core-js/modules/es.array.for-each":238,"core-js/modules/es.array.includes":240,"core-js/modules/es.object.entries":252,"core-js/modules/es.object.keys":253,"core-js/modules/es.regexp.exec":256,"core-js/modules/es.string.replace":261,"core-js/modules/web.dom-collections.for-each":292}],54:[function(require,module,exports){
|
6523 | "use strict";
|
6524 |
|
6525 | var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
6526 |
|
6527 | require("core-js/modules/es.array.for-each");
|
6528 |
|
6529 | require("core-js/modules/es.array.slice");
|
6530 |
|
6531 | require("core-js/modules/es.object.keys");
|
6532 |
|
6533 | require("core-js/modules/web.dom-collections.for-each");
|
6534 |
|
6535 | var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
6536 |
|
6537 | Object.defineProperty(exports, "__esModule", {
|
6538 | value: true
|
6539 | });
|
6540 | exports.deepCopyWith = exports.deepCopy = void 0;
|
6541 |
|
6542 | var isBuffer_1 = require("./isBuffer");
|
6543 |
|
6544 | exports.deepCopy = function (obj) {
|
6545 | if (obj === null || (0, _typeof2.default)(obj) !== 'object') {
|
6546 | return obj;
|
6547 | }
|
6548 |
|
6549 | if (isBuffer_1.isBuffer(obj)) {
|
6550 | return obj.slice();
|
6551 | }
|
6552 |
|
6553 | var copy = Array.isArray(obj) ? [] : {};
|
6554 | Object.keys(obj).forEach(function (key) {
|
6555 | copy[key] = exports.deepCopy(obj[key]);
|
6556 | });
|
6557 | return copy;
|
6558 | };
|
6559 |
|
6560 | exports.deepCopyWith = function (obj, customizer) {
|
6561 | function deepCopyWithHelper(value, innerKey, innerObject) {
|
6562 | var result = customizer(value, innerKey, innerObject);
|
6563 | if (result !== undefined) return result;
|
6564 |
|
6565 | if (value === null || (0, _typeof2.default)(value) !== 'object') {
|
6566 | return value;
|
6567 | }
|
6568 |
|
6569 | if (isBuffer_1.isBuffer(value)) {
|
6570 | return obj.slice();
|
6571 | }
|
6572 |
|
6573 | var copy = Array.isArray(value) ? [] : {};
|
6574 | Object.keys(value).forEach(function (k) {
|
6575 | copy[k] = deepCopyWithHelper(value[k], k, value);
|
6576 | });
|
6577 | return copy;
|
6578 | }
|
6579 |
|
6580 | if (customizer) {
|
6581 | return deepCopyWithHelper(obj, '', null);
|
6582 | } else {
|
6583 | return exports.deepCopy(obj);
|
6584 | }
|
6585 | };
|
6586 |
|
6587 | },{"./isBuffer":61,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/helpers/typeof":72,"core-js/modules/es.array.for-each":238,"core-js/modules/es.array.slice":246,"core-js/modules/es.object.keys":253,"core-js/modules/web.dom-collections.for-each":292}],55:[function(require,module,exports){
|
6588 | (function (Buffer){
|
6589 | "use strict";
|
6590 |
|
6591 | require("core-js/modules/es.object.to-string");
|
6592 |
|
6593 | require("core-js/modules/es.regexp.to-string");
|
6594 |
|
6595 | Object.defineProperty(exports, "__esModule", {
|
6596 | value: true
|
6597 | });
|
6598 | exports.encoder = void 0;
|
6599 |
|
6600 | function encoder(str) {
|
6601 | var encoding = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'utf-8';
|
6602 | if (encoding === 'utf-8') return str;
|
6603 | return Buffer.from(str).toString('latin1');
|
6604 | }
|
6605 |
|
6606 | exports.encoder = encoder;
|
6607 |
|
6608 | }).call(this,require("buffer").Buffer)
|
6609 | },{"buffer":98,"core-js/modules/es.object.to-string":254,"core-js/modules/es.regexp.to-string":257}],56:[function(require,module,exports){
|
6610 | "use strict";
|
6611 |
|
6612 | require("core-js/modules/es.array.map");
|
6613 |
|
6614 | require("core-js/modules/es.regexp.exec");
|
6615 |
|
6616 | require("core-js/modules/es.string.replace");
|
6617 |
|
6618 | Object.defineProperty(exports, "__esModule", {
|
6619 | value: true
|
6620 | });
|
6621 | exports.formatInventoryConfig = void 0;
|
6622 |
|
6623 | var dataFix_1 = require("../utils/dataFix");
|
6624 |
|
6625 | var isObject_1 = require("../utils/isObject");
|
6626 |
|
6627 | var isArray_1 = require("../utils/isArray");
|
6628 |
|
6629 | var formatObjKey_1 = require("../utils/formatObjKey");
|
6630 |
|
6631 | function formatInventoryConfig(inventoryConfig) {
|
6632 | var toArray = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
6633 | if (toArray && isObject_1.isObject(inventoryConfig)) inventoryConfig = [inventoryConfig];
|
6634 |
|
6635 | if (isArray_1.isArray(inventoryConfig)) {
|
6636 | inventoryConfig = inventoryConfig.map(formatFn);
|
6637 | } else {
|
6638 | inventoryConfig = formatFn(inventoryConfig);
|
6639 | }
|
6640 |
|
6641 | return inventoryConfig;
|
6642 | }
|
6643 |
|
6644 | exports.formatInventoryConfig = formatInventoryConfig;
|
6645 |
|
6646 | function formatFn(_) {
|
6647 | dataFix_1.dataFix(_, {
|
6648 | bool: ['IsEnabled']
|
6649 | }, function (conf) {
|
6650 | var _a, _b;
|
6651 |
|
6652 |
|
6653 | conf.prefix = conf.Filter.Prefix;
|
6654 | delete conf.Filter;
|
6655 |
|
6656 | conf.OSSBucketDestination = conf.Destination.OSSBucketDestination;
|
6657 |
|
6658 | conf.OSSBucketDestination.rolename = conf.OSSBucketDestination.RoleArn.replace(/.*\//, '');
|
6659 | delete conf.OSSBucketDestination.RoleArn;
|
6660 |
|
6661 | conf.OSSBucketDestination.bucket = conf.OSSBucketDestination.Bucket.replace(/.*:::/, '');
|
6662 | delete conf.OSSBucketDestination.Bucket;
|
6663 | delete conf.Destination;
|
6664 |
|
6665 | conf.frequency = conf.Schedule.Frequency;
|
6666 | delete conf.Schedule.Frequency;
|
6667 |
|
6668 | if (((_a = conf === null || conf === void 0 ? void 0 : conf.OptionalFields) === null || _a === void 0 ? void 0 : _a.Field) && !isArray_1.isArray((_b = conf.OptionalFields) === null || _b === void 0 ? void 0 : _b.Field)) conf.OptionalFields.Field = [conf.OptionalFields.Field];
|
6669 | });
|
6670 |
|
6671 | _ = formatObjKey_1.formatObjKey(_, 'firstLowerCase', {
|
6672 | exclude: ['OSSBucketDestination', 'SSE-OSS', 'SSE-KMS']
|
6673 | });
|
6674 | return _;
|
6675 | }
|
6676 |
|
6677 | },{"../utils/dataFix":53,"../utils/formatObjKey":57,"../utils/isArray":59,"../utils/isObject":64,"core-js/modules/es.array.map":245,"core-js/modules/es.regexp.exec":256,"core-js/modules/es.string.replace":261}],57:[function(require,module,exports){
|
6678 | "use strict";
|
6679 |
|
6680 | var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
6681 |
|
6682 | require("core-js/modules/es.array.for-each");
|
6683 |
|
6684 | require("core-js/modules/es.array.includes");
|
6685 |
|
6686 | require("core-js/modules/es.object.keys");
|
6687 |
|
6688 | require("core-js/modules/es.regexp.exec");
|
6689 |
|
6690 | require("core-js/modules/es.string.includes");
|
6691 |
|
6692 | require("core-js/modules/es.string.replace");
|
6693 |
|
6694 | require("core-js/modules/web.dom-collections.for-each");
|
6695 |
|
6696 | var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
6697 |
|
6698 | Object.defineProperty(exports, "__esModule", {
|
6699 | value: true
|
6700 | });
|
6701 | exports.formatObjKey = void 0;
|
6702 |
|
6703 | function formatObjKey(obj, type, options) {
|
6704 | if (obj === null || (0, _typeof2.default)(obj) !== 'object') {
|
6705 | return obj;
|
6706 | }
|
6707 |
|
6708 | var o;
|
6709 |
|
6710 | if (Array.isArray(obj)) {
|
6711 | o = [];
|
6712 |
|
6713 | for (var i = 0; i < obj.length; i++) {
|
6714 | o.push(formatObjKey(obj[i], type, options));
|
6715 | }
|
6716 | } else {
|
6717 | o = {};
|
6718 | Object.keys(obj).forEach(function (key) {
|
6719 | o[handelFormat(key, type, options)] = formatObjKey(obj[key], type, options);
|
6720 | });
|
6721 | }
|
6722 |
|
6723 | return o;
|
6724 | }
|
6725 |
|
6726 | exports.formatObjKey = formatObjKey;
|
6727 |
|
6728 | function handelFormat(key, type, options) {
|
6729 | var _a;
|
6730 |
|
6731 | if (options && ((_a = options.exclude) === null || _a === void 0 ? void 0 : _a.includes(key))) return key;
|
6732 |
|
6733 | if (type === 'firstUpperCase') {
|
6734 | key = key.replace(/^./, function (_) {
|
6735 | return _.toUpperCase();
|
6736 | });
|
6737 | } else if (type === 'firstLowerCase') {
|
6738 | key = key.replace(/^./, function (_) {
|
6739 | return _.toLowerCase();
|
6740 | });
|
6741 | }
|
6742 |
|
6743 | return key;
|
6744 | }
|
6745 |
|
6746 | },{"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/helpers/typeof":72,"core-js/modules/es.array.for-each":238,"core-js/modules/es.array.includes":240,"core-js/modules/es.object.keys":253,"core-js/modules/es.regexp.exec":256,"core-js/modules/es.string.includes":258,"core-js/modules/es.string.replace":261,"core-js/modules/web.dom-collections.for-each":292}],58:[function(require,module,exports){
|
6747 | "use strict";
|
6748 |
|
6749 | Object.defineProperty(exports, "__esModule", {
|
6750 | value: true
|
6751 | });
|
6752 | exports.getStrBytesCount = void 0;
|
6753 |
|
6754 | function getStrBytesCount(str) {
|
6755 | var bytesCount = 0;
|
6756 |
|
6757 | for (var i = 0; i < str.length; i++) {
|
6758 | var c = str.charAt(i);
|
6759 |
|
6760 | if (/^[\u00-\uff]$/.test(c)) {
|
6761 | bytesCount += 1;
|
6762 | } else {
|
6763 | bytesCount += 2;
|
6764 | }
|
6765 | }
|
6766 |
|
6767 | return bytesCount;
|
6768 | }
|
6769 |
|
6770 | exports.getStrBytesCount = getStrBytesCount;
|
6771 |
|
6772 | },{}],59:[function(require,module,exports){
|
6773 | "use strict";
|
6774 |
|
6775 | require("core-js/modules/es.object.to-string");
|
6776 |
|
6777 | require("core-js/modules/es.regexp.to-string");
|
6778 |
|
6779 | Object.defineProperty(exports, "__esModule", {
|
6780 | value: true
|
6781 | });
|
6782 | exports.isArray = void 0;
|
6783 |
|
6784 | exports.isArray = function (obj) {
|
6785 | return Object.prototype.toString.call(obj) === '[object Array]';
|
6786 | };
|
6787 |
|
6788 | },{"core-js/modules/es.object.to-string":254,"core-js/modules/es.regexp.to-string":257}],60:[function(require,module,exports){
|
6789 | "use strict";
|
6790 |
|
6791 | Object.defineProperty(exports, "__esModule", {
|
6792 | value: true
|
6793 | });
|
6794 | exports.isBlob = void 0;
|
6795 |
|
6796 | function isBlob(blob) {
|
6797 | return typeof Blob !== 'undefined' && blob instanceof Blob;
|
6798 | }
|
6799 |
|
6800 | exports.isBlob = isBlob;
|
6801 |
|
6802 | },{}],61:[function(require,module,exports){
|
6803 | (function (Buffer){
|
6804 | "use strict";
|
6805 |
|
6806 | Object.defineProperty(exports, "__esModule", {
|
6807 | value: true
|
6808 | });
|
6809 | exports.isBuffer = void 0;
|
6810 |
|
6811 | function isBuffer(obj) {
|
6812 | return Buffer.isBuffer(obj);
|
6813 | }
|
6814 |
|
6815 | exports.isBuffer = isBuffer;
|
6816 |
|
6817 | }).call(this,{"isBuffer":require("../../../node_modules/is-buffer/index.js")})
|
6818 | },{"../../../node_modules/is-buffer/index.js":308}],62:[function(require,module,exports){
|
6819 | "use strict";
|
6820 |
|
6821 | Object.defineProperty(exports, "__esModule", {
|
6822 | value: true
|
6823 | });
|
6824 | exports.isFile = void 0;
|
6825 |
|
6826 | exports.isFile = function (obj) {
|
6827 | return typeof File !== 'undefined' && obj instanceof File;
|
6828 | };
|
6829 |
|
6830 | },{}],63:[function(require,module,exports){
|
6831 | "use strict";
|
6832 |
|
6833 | Object.defineProperty(exports, "__esModule", {
|
6834 | value: true
|
6835 | });
|
6836 | exports.isIP = void 0;
|
6837 |
|
6838 |
|
6839 |
|
6840 |
|
6841 |
|
6842 |
|
6843 |
|
6844 | exports.isIP = function (host) {
|
6845 | var ipv4Regex = /^(25[0-5]|2[0-4]\d|[0-1]?\d?\d)(\.(25[0-5]|2[0-4]\d|[0-1]?\d?\d)){3}$/;
|
6846 | var ipv6Regex = /^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/;
|
6847 | return ipv4Regex.test(host) || ipv6Regex.test(host);
|
6848 | };
|
6849 |
|
6850 | },{}],64:[function(require,module,exports){
|
6851 | "use strict";
|
6852 |
|
6853 | require("core-js/modules/es.object.to-string");
|
6854 |
|
6855 | require("core-js/modules/es.regexp.to-string");
|
6856 |
|
6857 | Object.defineProperty(exports, "__esModule", {
|
6858 | value: true
|
6859 | });
|
6860 | exports.isObject = void 0;
|
6861 |
|
6862 | exports.isObject = function (obj) {
|
6863 | return Object.prototype.toString.call(obj) === '[object Object]';
|
6864 | };
|
6865 |
|
6866 | },{"core-js/modules/es.object.to-string":254,"core-js/modules/es.regexp.to-string":257}],65:[function(require,module,exports){
|
6867 | "use strict";
|
6868 |
|
6869 | require("core-js/modules/es.array.for-each");
|
6870 |
|
6871 | require("core-js/modules/es.object.keys");
|
6872 |
|
6873 | require("core-js/modules/web.dom-collections.for-each");
|
6874 |
|
6875 | Object.defineProperty(exports, "__esModule", {
|
6876 | value: true
|
6877 | });
|
6878 | exports.lowercaseKeyHeader = void 0;
|
6879 |
|
6880 | var isObject_1 = require("./isObject");
|
6881 |
|
6882 | function lowercaseKeyHeader(headers) {
|
6883 | var lowercaseHeader = {};
|
6884 |
|
6885 | if (isObject_1.isObject(headers)) {
|
6886 | Object.keys(headers).forEach(function (key) {
|
6887 | lowercaseHeader[key.toLowerCase()] = headers[key];
|
6888 | });
|
6889 | }
|
6890 |
|
6891 | return lowercaseHeader;
|
6892 | }
|
6893 |
|
6894 | exports.lowercaseKeyHeader = lowercaseKeyHeader;
|
6895 |
|
6896 | },{"./isObject":64,"core-js/modules/es.array.for-each":238,"core-js/modules/es.object.keys":253,"core-js/modules/web.dom-collections.for-each":292}],66:[function(require,module,exports){
|
6897 | "use strict";
|
6898 |
|
6899 | require("core-js/modules/es.array.concat");
|
6900 |
|
6901 | require("core-js/modules/es.array.for-each");
|
6902 |
|
6903 | require("core-js/modules/es.array.join");
|
6904 |
|
6905 | require("core-js/modules/es.array.map");
|
6906 |
|
6907 | require("core-js/modules/es.object.keys");
|
6908 |
|
6909 | require("core-js/modules/es.object.to-string");
|
6910 |
|
6911 | require("core-js/modules/es.regexp.exec");
|
6912 |
|
6913 | require("core-js/modules/es.regexp.to-string");
|
6914 |
|
6915 | require("core-js/modules/es.string.replace");
|
6916 |
|
6917 | require("core-js/modules/web.dom-collections.for-each");
|
6918 |
|
6919 | Object.defineProperty(exports, "__esModule", {
|
6920 | value: true
|
6921 | });
|
6922 | exports.obj2xml = void 0;
|
6923 |
|
6924 | var formatObjKey_1 = require("./formatObjKey");
|
6925 |
|
6926 | function type(params) {
|
6927 | return Object.prototype.toString.call(params).replace(/(.*? |])/g, '').toLowerCase();
|
6928 | }
|
6929 |
|
6930 | function obj2xml(obj, options) {
|
6931 | var s = '';
|
6932 |
|
6933 | if (options && options.headers) {
|
6934 | s = '<?xml version="1.0" encoding="UTF-8"?>\n';
|
6935 | }
|
6936 |
|
6937 | if (options && options.firstUpperCase) {
|
6938 | obj = formatObjKey_1.formatObjKey(obj, 'firstUpperCase');
|
6939 | }
|
6940 |
|
6941 | if (type(obj) === 'object') {
|
6942 | Object.keys(obj).forEach(function (key) {
|
6943 |
|
6944 | if (type(obj[key]) !== 'undefined' && type(obj[key]) !== 'null') {
|
6945 | if (type(obj[key]) === 'string' || type(obj[key]) === 'number') {
|
6946 | s += "<".concat(key, ">").concat(obj[key], "</").concat(key, ">");
|
6947 | } else if (type(obj[key]) === 'object') {
|
6948 | s += "<".concat(key, ">").concat(obj2xml(obj[key]), "</").concat(key, ">");
|
6949 | } else if (type(obj[key]) === 'array') {
|
6950 | s += obj[key].map(function (keyChild) {
|
6951 | return "<".concat(key, ">").concat(obj2xml(keyChild), "</").concat(key, ">");
|
6952 | }).join('');
|
6953 | } else {
|
6954 | s += "<".concat(key, ">").concat(obj[key].toString(), "</").concat(key, ">");
|
6955 | }
|
6956 | }
|
6957 | });
|
6958 | } else {
|
6959 | s += obj.toString();
|
6960 | }
|
6961 |
|
6962 | return s;
|
6963 | }
|
6964 |
|
6965 | exports.obj2xml = obj2xml;
|
6966 |
|
6967 | },{"./formatObjKey":57,"core-js/modules/es.array.concat":234,"core-js/modules/es.array.for-each":238,"core-js/modules/es.array.join":243,"core-js/modules/es.array.map":245,"core-js/modules/es.object.keys":253,"core-js/modules/es.object.to-string":254,"core-js/modules/es.regexp.exec":256,"core-js/modules/es.regexp.to-string":257,"core-js/modules/es.string.replace":261,"core-js/modules/web.dom-collections.for-each":292}],67:[function(require,module,exports){
|
6968 | "use strict";
|
6969 |
|
6970 | require("core-js/modules/es.object.to-string");
|
6971 |
|
6972 | require("core-js/modules/es.promise");
|
6973 |
|
6974 | Object.defineProperty(exports, "__esModule", {
|
6975 | value: true
|
6976 | });
|
6977 | exports.retry = void 0;
|
6978 |
|
6979 | function retry(func, retryMax) {
|
6980 | var config = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
6981 | var retryNum = 0;
|
6982 | var _config$retryDelay = config.retryDelay,
|
6983 | retryDelay = _config$retryDelay === void 0 ? 500 : _config$retryDelay,
|
6984 | _config$errorHandler = config.errorHandler,
|
6985 | errorHandler = _config$errorHandler === void 0 ? function () {
|
6986 | return true;
|
6987 | } : _config$errorHandler;
|
6988 |
|
6989 | var funcR = function funcR() {
|
6990 | for (var _len = arguments.length, arg = new Array(_len), _key = 0; _key < _len; _key++) {
|
6991 | arg[_key] = arguments[_key];
|
6992 | }
|
6993 |
|
6994 | return new Promise(function (resolve, reject) {
|
6995 | func.apply(void 0, arg).then(function (result) {
|
6996 | retryNum = 0;
|
6997 | resolve(result);
|
6998 | }).catch(function (err) {
|
6999 | if (retryNum < retryMax && errorHandler(err)) {
|
7000 | retryNum++;
|
7001 | setTimeout(function () {
|
7002 | resolve(funcR.apply(void 0, arg));
|
7003 | }, retryDelay);
|
7004 | } else {
|
7005 | retryNum = 0;
|
7006 | reject(err);
|
7007 | }
|
7008 | });
|
7009 | });
|
7010 | };
|
7011 |
|
7012 | return funcR;
|
7013 | }
|
7014 |
|
7015 | exports.retry = retry;
|
7016 |
|
7017 | },{"core-js/modules/es.object.to-string":254,"core-js/modules/es.promise":255}],68:[function(require,module,exports){
|
7018 | "use strict";
|
7019 |
|
7020 | var __importDefault = void 0 && (void 0).__importDefault || function (mod) {
|
7021 | return mod && mod.__esModule ? mod : {
|
7022 | "default": mod
|
7023 | };
|
7024 | };
|
7025 |
|
7026 | Object.defineProperty(exports, "__esModule", {
|
7027 | value: true
|
7028 | });
|
7029 | exports.setRegion = void 0;
|
7030 |
|
7031 | var url_1 = __importDefault(require("url"));
|
7032 |
|
7033 | var checkConfigValid_1 = require("./checkConfigValid");
|
7034 |
|
7035 | function setRegion(region) {
|
7036 | var internal = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
7037 | var secure = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
7038 | checkConfigValid_1.checkConfigValid(region, 'region');
|
7039 | var protocol = secure ? 'https://' : 'http://';
|
7040 | var suffix = internal ? '-internal.aliyuncs.com' : '.aliyuncs.com';
|
7041 | var prefix = 'vpc100-oss-cn-';
|
7042 |
|
7043 | if (region.substr(0, prefix.length) === prefix) {
|
7044 | suffix = '.aliyuncs.com';
|
7045 | }
|
7046 |
|
7047 | return url_1.default.parse(protocol + region + suffix);
|
7048 | }
|
7049 |
|
7050 | exports.setRegion = setRegion;
|
7051 |
|
7052 | },{"./checkConfigValid":49,"url":394}],69:[function(require,module,exports){
|
7053 | "use strict";
|
7054 |
|
7055 | var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
7056 |
|
7057 | require("core-js/modules/es.array.find");
|
7058 |
|
7059 | require("core-js/modules/es.array.for-each");
|
7060 |
|
7061 | require("core-js/modules/es.object.assign");
|
7062 |
|
7063 | require("core-js/modules/es.object.keys");
|
7064 |
|
7065 | var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
7066 |
|
7067 | require("regenerator-runtime/runtime");
|
7068 |
|
7069 | var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
7070 |
|
7071 | Object.defineProperty(exports, "__esModule", {
|
7072 | value: true
|
7073 | });
|
7074 | exports.setSTSToken = void 0;
|
7075 |
|
7076 | var formatObjKey_1 = require("./formatObjKey");
|
7077 |
|
7078 | function setSTSToken() {
|
7079 | return _setSTSToken.apply(this, arguments);
|
7080 | }
|
7081 |
|
7082 | function _setSTSToken() {
|
7083 | _setSTSToken = (0, _asyncToGenerator2.default)( _regenerator.default.mark(function _callee() {
|
7084 | var credentials;
|
7085 | return _regenerator.default.wrap(function _callee$(_context) {
|
7086 | while (1) {
|
7087 | switch (_context.prev = _context.next) {
|
7088 | case 0:
|
7089 | if (!this.options) this.options = {};
|
7090 | _context.next = 3;
|
7091 | return this.options.refreshSTSToken();
|
7092 |
|
7093 | case 3:
|
7094 | credentials = _context.sent;
|
7095 | credentials = formatObjKey_1.formatObjKey(credentials, 'firstLowerCase');
|
7096 |
|
7097 | if (credentials.securityToken) {
|
7098 | credentials.stsToken = credentials.securityToken;
|
7099 | }
|
7100 |
|
7101 | checkCredentials(credentials);
|
7102 | Object.assign(this.options, credentials);
|
7103 |
|
7104 | case 8:
|
7105 | case "end":
|
7106 | return _context.stop();
|
7107 | }
|
7108 | }
|
7109 | }, _callee, this);
|
7110 | }));
|
7111 | return _setSTSToken.apply(this, arguments);
|
7112 | }
|
7113 |
|
7114 | exports.setSTSToken = setSTSToken;
|
7115 |
|
7116 | function checkCredentials(obj) {
|
7117 | var stsTokenKey = ['accessKeySecret', 'accessKeyId', 'stsToken'];
|
7118 | var objKeys = Object.keys(obj);
|
7119 | stsTokenKey.forEach(function (_) {
|
7120 | if (!objKeys.find(function (key) {
|
7121 | return key === _;
|
7122 | })) {
|
7123 | throw Error("refreshSTSToken must return contains ".concat(_));
|
7124 | }
|
7125 | });
|
7126 | }
|
7127 |
|
7128 | },{"./formatObjKey":57,"@babel/runtime/helpers/asyncToGenerator":70,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/regenerator":74,"core-js/modules/es.array.find":237,"core-js/modules/es.array.for-each":238,"core-js/modules/es.object.assign":251,"core-js/modules/es.object.keys":253,"regenerator-runtime/runtime":337}],70:[function(require,module,exports){
|
7129 | function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
7130 | try {
|
7131 | var info = gen[key](arg);
|
7132 | var value = info.value;
|
7133 | } catch (error) {
|
7134 | reject(error);
|
7135 | return;
|
7136 | }
|
7137 |
|
7138 | if (info.done) {
|
7139 | resolve(value);
|
7140 | } else {
|
7141 | Promise.resolve(value).then(_next, _throw);
|
7142 | }
|
7143 | }
|
7144 |
|
7145 | function _asyncToGenerator(fn) {
|
7146 | return function () {
|
7147 | var self = this,
|
7148 | args = arguments;
|
7149 | return new Promise(function (resolve, reject) {
|
7150 | var gen = fn.apply(self, args);
|
7151 |
|
7152 | function _next(value) {
|
7153 | asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
7154 | }
|
7155 |
|
7156 | function _throw(err) {
|
7157 | asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
7158 | }
|
7159 |
|
7160 | _next(undefined);
|
7161 | });
|
7162 | };
|
7163 | }
|
7164 |
|
7165 | module.exports = _asyncToGenerator;
|
7166 | },{}],71:[function(require,module,exports){
|
7167 | function _interopRequireDefault(obj) {
|
7168 | return obj && obj.__esModule ? obj : {
|
7169 | "default": obj
|
7170 | };
|
7171 | }
|
7172 |
|
7173 | module.exports = _interopRequireDefault;
|
7174 | },{}],72:[function(require,module,exports){
|
7175 | function _typeof(obj) {
|
7176 | "@babel/helpers - typeof";
|
7177 |
|
7178 | if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
|
7179 | module.exports = _typeof = function _typeof(obj) {
|
7180 | return typeof obj;
|
7181 | };
|
7182 | } else {
|
7183 | module.exports = _typeof = function _typeof(obj) {
|
7184 | return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
7185 | };
|
7186 | }
|
7187 |
|
7188 | return _typeof(obj);
|
7189 | }
|
7190 |
|
7191 | module.exports = _typeof;
|
7192 | },{}],73:[function(require,module,exports){
|
7193 |
|
7194 |
|
7195 |
|
7196 |
|
7197 |
|
7198 |
|
7199 |
|
7200 | var runtime = (function (exports) {
|
7201 | "use strict";
|
7202 |
|
7203 | var Op = Object.prototype;
|
7204 | var hasOwn = Op.hasOwnProperty;
|
7205 | var undefined;
|
7206 | var $Symbol = typeof Symbol === "function" ? Symbol : {};
|
7207 | var iteratorSymbol = $Symbol.iterator || "@@iterator";
|
7208 | var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
|
7209 | var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
|
7210 |
|
7211 | function define(obj, key, value) {
|
7212 | Object.defineProperty(obj, key, {
|
7213 | value: value,
|
7214 | enumerable: true,
|
7215 | configurable: true,
|
7216 | writable: true
|
7217 | });
|
7218 | return obj[key];
|
7219 | }
|
7220 | try {
|
7221 |
|
7222 | define({}, "");
|
7223 | } catch (err) {
|
7224 | define = function(obj, key, value) {
|
7225 | return obj[key] = value;
|
7226 | };
|
7227 | }
|
7228 |
|
7229 | function wrap(innerFn, outerFn, self, tryLocsList) {
|
7230 |
|
7231 | var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
|
7232 | var generator = Object.create(protoGenerator.prototype);
|
7233 | var context = new Context(tryLocsList || []);
|
7234 |
|
7235 |
|
7236 |
|
7237 | generator._invoke = makeInvokeMethod(innerFn, self, context);
|
7238 |
|
7239 | return generator;
|
7240 | }
|
7241 | exports.wrap = wrap;
|
7242 |
|
7243 |
|
7244 |
|
7245 |
|
7246 |
|
7247 |
|
7248 |
|
7249 |
|
7250 |
|
7251 |
|
7252 |
|
7253 | function tryCatch(fn, obj, arg) {
|
7254 | try {
|
7255 | return { type: "normal", arg: fn.call(obj, arg) };
|
7256 | } catch (err) {
|
7257 | return { type: "throw", arg: err };
|
7258 | }
|
7259 | }
|
7260 |
|
7261 | var GenStateSuspendedStart = "suspendedStart";
|
7262 | var GenStateSuspendedYield = "suspendedYield";
|
7263 | var GenStateExecuting = "executing";
|
7264 | var GenStateCompleted = "completed";
|
7265 |
|
7266 |
|
7267 |
|
7268 | var ContinueSentinel = {};
|
7269 |
|
7270 |
|
7271 |
|
7272 |
|
7273 |
|
7274 | function Generator() {}
|
7275 | function GeneratorFunction() {}
|
7276 | function GeneratorFunctionPrototype() {}
|
7277 |
|
7278 |
|
7279 |
|
7280 | var IteratorPrototype = {};
|
7281 | IteratorPrototype[iteratorSymbol] = function () {
|
7282 | return this;
|
7283 | };
|
7284 |
|
7285 | var getProto = Object.getPrototypeOf;
|
7286 | var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
|
7287 | if (NativeIteratorPrototype &&
|
7288 | NativeIteratorPrototype !== Op &&
|
7289 | hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
|
7290 |
|
7291 |
|
7292 | IteratorPrototype = NativeIteratorPrototype;
|
7293 | }
|
7294 |
|
7295 | var Gp = GeneratorFunctionPrototype.prototype =
|
7296 | Generator.prototype = Object.create(IteratorPrototype);
|
7297 | GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;
|
7298 | GeneratorFunctionPrototype.constructor = GeneratorFunction;
|
7299 | GeneratorFunction.displayName = define(
|
7300 | GeneratorFunctionPrototype,
|
7301 | toStringTagSymbol,
|
7302 | "GeneratorFunction"
|
7303 | );
|
7304 |
|
7305 |
|
7306 |
|
7307 | function defineIteratorMethods(prototype) {
|
7308 | ["next", "throw", "return"].forEach(function(method) {
|
7309 | define(prototype, method, function(arg) {
|
7310 | return this._invoke(method, arg);
|
7311 | });
|
7312 | });
|
7313 | }
|
7314 |
|
7315 | exports.isGeneratorFunction = function(genFun) {
|
7316 | var ctor = typeof genFun === "function" && genFun.constructor;
|
7317 | return ctor
|
7318 | ? ctor === GeneratorFunction ||
|
7319 |
|
7320 |
|
7321 | (ctor.displayName || ctor.name) === "GeneratorFunction"
|
7322 | : false;
|
7323 | };
|
7324 |
|
7325 | exports.mark = function(genFun) {
|
7326 | if (Object.setPrototypeOf) {
|
7327 | Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
|
7328 | } else {
|
7329 | genFun.__proto__ = GeneratorFunctionPrototype;
|
7330 | define(genFun, toStringTagSymbol, "GeneratorFunction");
|
7331 | }
|
7332 | genFun.prototype = Object.create(Gp);
|
7333 | return genFun;
|
7334 | };
|
7335 |
|
7336 |
|
7337 |
|
7338 |
|
7339 |
|
7340 | exports.awrap = function(arg) {
|
7341 | return { __await: arg };
|
7342 | };
|
7343 |
|
7344 | function AsyncIterator(generator, PromiseImpl) {
|
7345 | function invoke(method, arg, resolve, reject) {
|
7346 | var record = tryCatch(generator[method], generator, arg);
|
7347 | if (record.type === "throw") {
|
7348 | reject(record.arg);
|
7349 | } else {
|
7350 | var result = record.arg;
|
7351 | var value = result.value;
|
7352 | if (value &&
|
7353 | typeof value === "object" &&
|
7354 | hasOwn.call(value, "__await")) {
|
7355 | return PromiseImpl.resolve(value.__await).then(function(value) {
|
7356 | invoke("next", value, resolve, reject);
|
7357 | }, function(err) {
|
7358 | invoke("throw", err, resolve, reject);
|
7359 | });
|
7360 | }
|
7361 |
|
7362 | return PromiseImpl.resolve(value).then(function(unwrapped) {
|
7363 |
|
7364 |
|
7365 |
|
7366 | result.value = unwrapped;
|
7367 | resolve(result);
|
7368 | }, function(error) {
|
7369 |
|
7370 |
|
7371 | return invoke("throw", error, resolve, reject);
|
7372 | });
|
7373 | }
|
7374 | }
|
7375 |
|
7376 | var previousPromise;
|
7377 |
|
7378 | function enqueue(method, arg) {
|
7379 | function callInvokeWithMethodAndArg() {
|
7380 | return new PromiseImpl(function(resolve, reject) {
|
7381 | invoke(method, arg, resolve, reject);
|
7382 | });
|
7383 | }
|
7384 |
|
7385 | return previousPromise =
|
7386 |
|
7387 |
|
7388 |
|
7389 |
|
7390 |
|
7391 |
|
7392 |
|
7393 |
|
7394 |
|
7395 |
|
7396 |
|
7397 |
|
7398 | previousPromise ? previousPromise.then(
|
7399 | callInvokeWithMethodAndArg,
|
7400 |
|
7401 |
|
7402 | callInvokeWithMethodAndArg
|
7403 | ) : callInvokeWithMethodAndArg();
|
7404 | }
|
7405 |
|
7406 |
|
7407 |
|
7408 | this._invoke = enqueue;
|
7409 | }
|
7410 |
|
7411 | defineIteratorMethods(AsyncIterator.prototype);
|
7412 | AsyncIterator.prototype[asyncIteratorSymbol] = function () {
|
7413 | return this;
|
7414 | };
|
7415 | exports.AsyncIterator = AsyncIterator;
|
7416 |
|
7417 |
|
7418 |
|
7419 |
|
7420 | exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) {
|
7421 | if (PromiseImpl === void 0) PromiseImpl = Promise;
|
7422 |
|
7423 | var iter = new AsyncIterator(
|
7424 | wrap(innerFn, outerFn, self, tryLocsList),
|
7425 | PromiseImpl
|
7426 | );
|
7427 |
|
7428 | return exports.isGeneratorFunction(outerFn)
|
7429 | ? iter
|
7430 | : iter.next().then(function(result) {
|
7431 | return result.done ? result.value : iter.next();
|
7432 | });
|
7433 | };
|
7434 |
|
7435 | function makeInvokeMethod(innerFn, self, context) {
|
7436 | var state = GenStateSuspendedStart;
|
7437 |
|
7438 | return function invoke(method, arg) {
|
7439 | if (state === GenStateExecuting) {
|
7440 | throw new Error("Generator is already running");
|
7441 | }
|
7442 |
|
7443 | if (state === GenStateCompleted) {
|
7444 | if (method === "throw") {
|
7445 | throw arg;
|
7446 | }
|
7447 |
|
7448 |
|
7449 |
|
7450 | return doneResult();
|
7451 | }
|
7452 |
|
7453 | context.method = method;
|
7454 | context.arg = arg;
|
7455 |
|
7456 | while (true) {
|
7457 | var delegate = context.delegate;
|
7458 | if (delegate) {
|
7459 | var delegateResult = maybeInvokeDelegate(delegate, context);
|
7460 | if (delegateResult) {
|
7461 | if (delegateResult === ContinueSentinel) continue;
|
7462 | return delegateResult;
|
7463 | }
|
7464 | }
|
7465 |
|
7466 | if (context.method === "next") {
|
7467 |
|
7468 |
|
7469 | context.sent = context._sent = context.arg;
|
7470 |
|
7471 | } else if (context.method === "throw") {
|
7472 | if (state === GenStateSuspendedStart) {
|
7473 | state = GenStateCompleted;
|
7474 | throw context.arg;
|
7475 | }
|
7476 |
|
7477 | context.dispatchException(context.arg);
|
7478 |
|
7479 | } else if (context.method === "return") {
|
7480 | context.abrupt("return", context.arg);
|
7481 | }
|
7482 |
|
7483 | state = GenStateExecuting;
|
7484 |
|
7485 | var record = tryCatch(innerFn, self, context);
|
7486 | if (record.type === "normal") {
|
7487 |
|
7488 |
|
7489 | state = context.done
|
7490 | ? GenStateCompleted
|
7491 | : GenStateSuspendedYield;
|
7492 |
|
7493 | if (record.arg === ContinueSentinel) {
|
7494 | continue;
|
7495 | }
|
7496 |
|
7497 | return {
|
7498 | value: record.arg,
|
7499 | done: context.done
|
7500 | };
|
7501 |
|
7502 | } else if (record.type === "throw") {
|
7503 | state = GenStateCompleted;
|
7504 |
|
7505 |
|
7506 | context.method = "throw";
|
7507 | context.arg = record.arg;
|
7508 | }
|
7509 | }
|
7510 | };
|
7511 | }
|
7512 |
|
7513 |
|
7514 |
|
7515 |
|
7516 |
|
7517 | function maybeInvokeDelegate(delegate, context) {
|
7518 | var method = delegate.iterator[context.method];
|
7519 | if (method === undefined) {
|
7520 |
|
7521 |
|
7522 | context.delegate = null;
|
7523 |
|
7524 | if (context.method === "throw") {
|
7525 |
|
7526 | if (delegate.iterator["return"]) {
|
7527 |
|
7528 |
|
7529 | context.method = "return";
|
7530 | context.arg = undefined;
|
7531 | maybeInvokeDelegate(delegate, context);
|
7532 |
|
7533 | if (context.method === "throw") {
|
7534 |
|
7535 |
|
7536 | return ContinueSentinel;
|
7537 | }
|
7538 | }
|
7539 |
|
7540 | context.method = "throw";
|
7541 | context.arg = new TypeError(
|
7542 | "The iterator does not provide a 'throw' method");
|
7543 | }
|
7544 |
|
7545 | return ContinueSentinel;
|
7546 | }
|
7547 |
|
7548 | var record = tryCatch(method, delegate.iterator, context.arg);
|
7549 |
|
7550 | if (record.type === "throw") {
|
7551 | context.method = "throw";
|
7552 | context.arg = record.arg;
|
7553 | context.delegate = null;
|
7554 | return ContinueSentinel;
|
7555 | }
|
7556 |
|
7557 | var info = record.arg;
|
7558 |
|
7559 | if (! info) {
|
7560 | context.method = "throw";
|
7561 | context.arg = new TypeError("iterator result is not an object");
|
7562 | context.delegate = null;
|
7563 | return ContinueSentinel;
|
7564 | }
|
7565 |
|
7566 | if (info.done) {
|
7567 |
|
7568 |
|
7569 | context[delegate.resultName] = info.value;
|
7570 |
|
7571 |
|
7572 | context.next = delegate.nextLoc;
|
7573 |
|
7574 |
|
7575 |
|
7576 |
|
7577 |
|
7578 |
|
7579 |
|
7580 | if (context.method !== "return") {
|
7581 | context.method = "next";
|
7582 | context.arg = undefined;
|
7583 | }
|
7584 |
|
7585 | } else {
|
7586 |
|
7587 | return info;
|
7588 | }
|
7589 |
|
7590 |
|
7591 |
|
7592 | context.delegate = null;
|
7593 | return ContinueSentinel;
|
7594 | }
|
7595 |
|
7596 |
|
7597 |
|
7598 | defineIteratorMethods(Gp);
|
7599 |
|
7600 | define(Gp, toStringTagSymbol, "Generator");
|
7601 |
|
7602 |
|
7603 |
|
7604 |
|
7605 |
|
7606 |
|
7607 | Gp[iteratorSymbol] = function() {
|
7608 | return this;
|
7609 | };
|
7610 |
|
7611 | Gp.toString = function() {
|
7612 | return "[object Generator]";
|
7613 | };
|
7614 |
|
7615 | function pushTryEntry(locs) {
|
7616 | var entry = { tryLoc: locs[0] };
|
7617 |
|
7618 | if (1 in locs) {
|
7619 | entry.catchLoc = locs[1];
|
7620 | }
|
7621 |
|
7622 | if (2 in locs) {
|
7623 | entry.finallyLoc = locs[2];
|
7624 | entry.afterLoc = locs[3];
|
7625 | }
|
7626 |
|
7627 | this.tryEntries.push(entry);
|
7628 | }
|
7629 |
|
7630 | function resetTryEntry(entry) {
|
7631 | var record = entry.completion || {};
|
7632 | record.type = "normal";
|
7633 | delete record.arg;
|
7634 | entry.completion = record;
|
7635 | }
|
7636 |
|
7637 | function Context(tryLocsList) {
|
7638 |
|
7639 |
|
7640 |
|
7641 | this.tryEntries = [{ tryLoc: "root" }];
|
7642 | tryLocsList.forEach(pushTryEntry, this);
|
7643 | this.reset(true);
|
7644 | }
|
7645 |
|
7646 | exports.keys = function(object) {
|
7647 | var keys = [];
|
7648 | for (var key in object) {
|
7649 | keys.push(key);
|
7650 | }
|
7651 | keys.reverse();
|
7652 |
|
7653 |
|
7654 |
|
7655 | return function next() {
|
7656 | while (keys.length) {
|
7657 | var key = keys.pop();
|
7658 | if (key in object) {
|
7659 | next.value = key;
|
7660 | next.done = false;
|
7661 | return next;
|
7662 | }
|
7663 | }
|
7664 |
|
7665 |
|
7666 |
|
7667 |
|
7668 | next.done = true;
|
7669 | return next;
|
7670 | };
|
7671 | };
|
7672 |
|
7673 | function values(iterable) {
|
7674 | if (iterable) {
|
7675 | var iteratorMethod = iterable[iteratorSymbol];
|
7676 | if (iteratorMethod) {
|
7677 | return iteratorMethod.call(iterable);
|
7678 | }
|
7679 |
|
7680 | if (typeof iterable.next === "function") {
|
7681 | return iterable;
|
7682 | }
|
7683 |
|
7684 | if (!isNaN(iterable.length)) {
|
7685 | var i = -1, next = function next() {
|
7686 | while (++i < iterable.length) {
|
7687 | if (hasOwn.call(iterable, i)) {
|
7688 | next.value = iterable[i];
|
7689 | next.done = false;
|
7690 | return next;
|
7691 | }
|
7692 | }
|
7693 |
|
7694 | next.value = undefined;
|
7695 | next.done = true;
|
7696 |
|
7697 | return next;
|
7698 | };
|
7699 |
|
7700 | return next.next = next;
|
7701 | }
|
7702 | }
|
7703 |
|
7704 |
|
7705 | return { next: doneResult };
|
7706 | }
|
7707 | exports.values = values;
|
7708 |
|
7709 | function doneResult() {
|
7710 | return { value: undefined, done: true };
|
7711 | }
|
7712 |
|
7713 | Context.prototype = {
|
7714 | constructor: Context,
|
7715 |
|
7716 | reset: function(skipTempReset) {
|
7717 | this.prev = 0;
|
7718 | this.next = 0;
|
7719 |
|
7720 |
|
7721 | this.sent = this._sent = undefined;
|
7722 | this.done = false;
|
7723 | this.delegate = null;
|
7724 |
|
7725 | this.method = "next";
|
7726 | this.arg = undefined;
|
7727 |
|
7728 | this.tryEntries.forEach(resetTryEntry);
|
7729 |
|
7730 | if (!skipTempReset) {
|
7731 | for (var name in this) {
|
7732 |
|
7733 | if (name.charAt(0) === "t" &&
|
7734 | hasOwn.call(this, name) &&
|
7735 | !isNaN(+name.slice(1))) {
|
7736 | this[name] = undefined;
|
7737 | }
|
7738 | }
|
7739 | }
|
7740 | },
|
7741 |
|
7742 | stop: function() {
|
7743 | this.done = true;
|
7744 |
|
7745 | var rootEntry = this.tryEntries[0];
|
7746 | var rootRecord = rootEntry.completion;
|
7747 | if (rootRecord.type === "throw") {
|
7748 | throw rootRecord.arg;
|
7749 | }
|
7750 |
|
7751 | return this.rval;
|
7752 | },
|
7753 |
|
7754 | dispatchException: function(exception) {
|
7755 | if (this.done) {
|
7756 | throw exception;
|
7757 | }
|
7758 |
|
7759 | var context = this;
|
7760 | function handle(loc, caught) {
|
7761 | record.type = "throw";
|
7762 | record.arg = exception;
|
7763 | context.next = loc;
|
7764 |
|
7765 | if (caught) {
|
7766 |
|
7767 |
|
7768 | context.method = "next";
|
7769 | context.arg = undefined;
|
7770 | }
|
7771 |
|
7772 | return !! caught;
|
7773 | }
|
7774 |
|
7775 | for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
7776 | var entry = this.tryEntries[i];
|
7777 | var record = entry.completion;
|
7778 |
|
7779 | if (entry.tryLoc === "root") {
|
7780 |
|
7781 |
|
7782 |
|
7783 | return handle("end");
|
7784 | }
|
7785 |
|
7786 | if (entry.tryLoc <= this.prev) {
|
7787 | var hasCatch = hasOwn.call(entry, "catchLoc");
|
7788 | var hasFinally = hasOwn.call(entry, "finallyLoc");
|
7789 |
|
7790 | if (hasCatch && hasFinally) {
|
7791 | if (this.prev < entry.catchLoc) {
|
7792 | return handle(entry.catchLoc, true);
|
7793 | } else if (this.prev < entry.finallyLoc) {
|
7794 | return handle(entry.finallyLoc);
|
7795 | }
|
7796 |
|
7797 | } else if (hasCatch) {
|
7798 | if (this.prev < entry.catchLoc) {
|
7799 | return handle(entry.catchLoc, true);
|
7800 | }
|
7801 |
|
7802 | } else if (hasFinally) {
|
7803 | if (this.prev < entry.finallyLoc) {
|
7804 | return handle(entry.finallyLoc);
|
7805 | }
|
7806 |
|
7807 | } else {
|
7808 | throw new Error("try statement without catch or finally");
|
7809 | }
|
7810 | }
|
7811 | }
|
7812 | },
|
7813 |
|
7814 | abrupt: function(type, arg) {
|
7815 | for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
7816 | var entry = this.tryEntries[i];
|
7817 | if (entry.tryLoc <= this.prev &&
|
7818 | hasOwn.call(entry, "finallyLoc") &&
|
7819 | this.prev < entry.finallyLoc) {
|
7820 | var finallyEntry = entry;
|
7821 | break;
|
7822 | }
|
7823 | }
|
7824 |
|
7825 | if (finallyEntry &&
|
7826 | (type === "break" ||
|
7827 | type === "continue") &&
|
7828 | finallyEntry.tryLoc <= arg &&
|
7829 | arg <= finallyEntry.finallyLoc) {
|
7830 |
|
7831 |
|
7832 | finallyEntry = null;
|
7833 | }
|
7834 |
|
7835 | var record = finallyEntry ? finallyEntry.completion : {};
|
7836 | record.type = type;
|
7837 | record.arg = arg;
|
7838 |
|
7839 | if (finallyEntry) {
|
7840 | this.method = "next";
|
7841 | this.next = finallyEntry.finallyLoc;
|
7842 | return ContinueSentinel;
|
7843 | }
|
7844 |
|
7845 | return this.complete(record);
|
7846 | },
|
7847 |
|
7848 | complete: function(record, afterLoc) {
|
7849 | if (record.type === "throw") {
|
7850 | throw record.arg;
|
7851 | }
|
7852 |
|
7853 | if (record.type === "break" ||
|
7854 | record.type === "continue") {
|
7855 | this.next = record.arg;
|
7856 | } else if (record.type === "return") {
|
7857 | this.rval = this.arg = record.arg;
|
7858 | this.method = "return";
|
7859 | this.next = "end";
|
7860 | } else if (record.type === "normal" && afterLoc) {
|
7861 | this.next = afterLoc;
|
7862 | }
|
7863 |
|
7864 | return ContinueSentinel;
|
7865 | },
|
7866 |
|
7867 | finish: function(finallyLoc) {
|
7868 | for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
7869 | var entry = this.tryEntries[i];
|
7870 | if (entry.finallyLoc === finallyLoc) {
|
7871 | this.complete(entry.completion, entry.afterLoc);
|
7872 | resetTryEntry(entry);
|
7873 | return ContinueSentinel;
|
7874 | }
|
7875 | }
|
7876 | },
|
7877 |
|
7878 | "catch": function(tryLoc) {
|
7879 | for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
7880 | var entry = this.tryEntries[i];
|
7881 | if (entry.tryLoc === tryLoc) {
|
7882 | var record = entry.completion;
|
7883 | if (record.type === "throw") {
|
7884 | var thrown = record.arg;
|
7885 | resetTryEntry(entry);
|
7886 | }
|
7887 | return thrown;
|
7888 | }
|
7889 | }
|
7890 |
|
7891 |
|
7892 |
|
7893 | throw new Error("illegal catch attempt");
|
7894 | },
|
7895 |
|
7896 | delegateYield: function(iterable, resultName, nextLoc) {
|
7897 | this.delegate = {
|
7898 | iterator: values(iterable),
|
7899 | resultName: resultName,
|
7900 | nextLoc: nextLoc
|
7901 | };
|
7902 |
|
7903 | if (this.method === "next") {
|
7904 |
|
7905 |
|
7906 | this.arg = undefined;
|
7907 | }
|
7908 |
|
7909 | return ContinueSentinel;
|
7910 | }
|
7911 | };
|
7912 |
|
7913 |
|
7914 |
|
7915 |
|
7916 |
|
7917 | return exports;
|
7918 |
|
7919 | }(
|
7920 |
|
7921 |
|
7922 |
|
7923 |
|
7924 | typeof module === "object" ? module.exports : {}
|
7925 | ));
|
7926 |
|
7927 | try {
|
7928 | regeneratorRuntime = runtime;
|
7929 | } catch (accidentalStrictMode) {
|
7930 |
|
7931 |
|
7932 |
|
7933 |
|
7934 |
|
7935 |
|
7936 |
|
7937 |
|
7938 |
|
7939 | Function("r", "regeneratorRuntime = r")(runtime);
|
7940 | }
|
7941 |
|
7942 | },{}],74:[function(require,module,exports){
|
7943 | module.exports = require("regenerator-runtime");
|
7944 |
|
7945 | },{"regenerator-runtime":73}],75:[function(require,module,exports){
|
7946 | module.exports = noop;
|
7947 | module.exports.HttpsAgent = noop;
|
7948 |
|
7949 |
|
7950 | function noop () {}
|
7951 |
|
7952 | },{}],76:[function(require,module,exports){
|
7953 | 'use strict'
|
7954 |
|
7955 | exports.byteLength = byteLength
|
7956 | exports.toByteArray = toByteArray
|
7957 | exports.fromByteArray = fromByteArray
|
7958 |
|
7959 | var lookup = []
|
7960 | var revLookup = []
|
7961 | var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array
|
7962 |
|
7963 | var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
|
7964 | for (var i = 0, len = code.length; i < len; ++i) {
|
7965 | lookup[i] = code[i]
|
7966 | revLookup[code.charCodeAt(i)] = i
|
7967 | }
|
7968 |
|
7969 |
|
7970 |
|
7971 | revLookup['-'.charCodeAt(0)] = 62
|
7972 | revLookup['_'.charCodeAt(0)] = 63
|
7973 |
|
7974 | function getLens (b64) {
|
7975 | var len = b64.length
|
7976 |
|
7977 | if (len % 4 > 0) {
|
7978 | throw new Error('Invalid string. Length must be a multiple of 4')
|
7979 | }
|
7980 |
|
7981 |
|
7982 |
|
7983 | var validLen = b64.indexOf('=')
|
7984 | if (validLen === -1) validLen = len
|
7985 |
|
7986 | var placeHoldersLen = validLen === len
|
7987 | ? 0
|
7988 | : 4 - (validLen % 4)
|
7989 |
|
7990 | return [validLen, placeHoldersLen]
|
7991 | }
|
7992 |
|
7993 |
|
7994 | function byteLength (b64) {
|
7995 | var lens = getLens(b64)
|
7996 | var validLen = lens[0]
|
7997 | var placeHoldersLen = lens[1]
|
7998 | return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
|
7999 | }
|
8000 |
|
8001 | function _byteLength (b64, validLen, placeHoldersLen) {
|
8002 | return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
|
8003 | }
|
8004 |
|
8005 | function toByteArray (b64) {
|
8006 | var tmp
|
8007 | var lens = getLens(b64)
|
8008 | var validLen = lens[0]
|
8009 | var placeHoldersLen = lens[1]
|
8010 |
|
8011 | var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))
|
8012 |
|
8013 | var curByte = 0
|
8014 |
|
8015 |
|
8016 | var len = placeHoldersLen > 0
|
8017 | ? validLen - 4
|
8018 | : validLen
|
8019 |
|
8020 | var i
|
8021 | for (i = 0; i < len; i += 4) {
|
8022 | tmp =
|
8023 | (revLookup[b64.charCodeAt(i)] << 18) |
|
8024 | (revLookup[b64.charCodeAt(i + 1)] << 12) |
|
8025 | (revLookup[b64.charCodeAt(i + 2)] << 6) |
|
8026 | revLookup[b64.charCodeAt(i + 3)]
|
8027 | arr[curByte++] = (tmp >> 16) & 0xFF
|
8028 | arr[curByte++] = (tmp >> 8) & 0xFF
|
8029 | arr[curByte++] = tmp & 0xFF
|
8030 | }
|
8031 |
|
8032 | if (placeHoldersLen === 2) {
|
8033 | tmp =
|
8034 | (revLookup[b64.charCodeAt(i)] << 2) |
|
8035 | (revLookup[b64.charCodeAt(i + 1)] >> 4)
|
8036 | arr[curByte++] = tmp & 0xFF
|
8037 | }
|
8038 |
|
8039 | if (placeHoldersLen === 1) {
|
8040 | tmp =
|
8041 | (revLookup[b64.charCodeAt(i)] << 10) |
|
8042 | (revLookup[b64.charCodeAt(i + 1)] << 4) |
|
8043 | (revLookup[b64.charCodeAt(i + 2)] >> 2)
|
8044 | arr[curByte++] = (tmp >> 8) & 0xFF
|
8045 | arr[curByte++] = tmp & 0xFF
|
8046 | }
|
8047 |
|
8048 | return arr
|
8049 | }
|
8050 |
|
8051 | function tripletToBase64 (num) {
|
8052 | return lookup[num >> 18 & 0x3F] +
|
8053 | lookup[num >> 12 & 0x3F] +
|
8054 | lookup[num >> 6 & 0x3F] +
|
8055 | lookup[num & 0x3F]
|
8056 | }
|
8057 |
|
8058 | function encodeChunk (uint8, start, end) {
|
8059 | var tmp
|
8060 | var output = []
|
8061 | for (var i = start; i < end; i += 3) {
|
8062 | tmp =
|
8063 | ((uint8[i] << 16) & 0xFF0000) +
|
8064 | ((uint8[i + 1] << 8) & 0xFF00) +
|
8065 | (uint8[i + 2] & 0xFF)
|
8066 | output.push(tripletToBase64(tmp))
|
8067 | }
|
8068 | return output.join('')
|
8069 | }
|
8070 |
|
8071 | function fromByteArray (uint8) {
|
8072 | var tmp
|
8073 | var len = uint8.length
|
8074 | var extraBytes = len % 3
|
8075 | var parts = []
|
8076 | var maxChunkLength = 16383
|
8077 |
|
8078 |
|
8079 | for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
|
8080 | parts.push(encodeChunk(
|
8081 | uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)
|
8082 | ))
|
8083 | }
|
8084 |
|
8085 |
|
8086 | if (extraBytes === 1) {
|
8087 | tmp = uint8[len - 1]
|
8088 | parts.push(
|
8089 | lookup[tmp >> 2] +
|
8090 | lookup[(tmp << 4) & 0x3F] +
|
8091 | '=='
|
8092 | )
|
8093 | } else if (extraBytes === 2) {
|
8094 | tmp = (uint8[len - 2] << 8) + uint8[len - 1]
|
8095 | parts.push(
|
8096 | lookup[tmp >> 10] +
|
8097 | lookup[(tmp >> 4) & 0x3F] +
|
8098 | lookup[(tmp << 2) & 0x3F] +
|
8099 | '='
|
8100 | )
|
8101 | }
|
8102 |
|
8103 | return parts.join('')
|
8104 | }
|
8105 |
|
8106 | },{}],77:[function(require,module,exports){
|
8107 |
|
8108 |
|
8109 |
|
8110 |
|
8111 |
|
8112 |
|
8113 | !function (root, name, definition) {
|
8114 | if (typeof module != 'undefined' && module.exports) module.exports = definition()
|
8115 | else if (typeof define == 'function' && define.amd) define(name, definition)
|
8116 | else root[name] = definition()
|
8117 | }(this, 'bowser', function () {
|
8118 | |
8119 |
|
8120 |
|
8121 |
|
8122 | var t = true
|
8123 |
|
8124 | function detect(ua) {
|
8125 |
|
8126 | function getFirstMatch(regex) {
|
8127 | var match = ua.match(regex);
|
8128 | return (match && match.length > 1 && match[1]) || '';
|
8129 | }
|
8130 |
|
8131 | function getSecondMatch(regex) {
|
8132 | var match = ua.match(regex);
|
8133 | return (match && match.length > 1 && match[2]) || '';
|
8134 | }
|
8135 |
|
8136 | var iosdevice = getFirstMatch(/(ipod|iphone|ipad)/i).toLowerCase()
|
8137 | , likeAndroid = /like android/i.test(ua)
|
8138 | , android = !likeAndroid && /android/i.test(ua)
|
8139 | , nexusMobile = /nexus\s*[0-6]\s*/i.test(ua)
|
8140 | , nexusTablet = !nexusMobile && /nexus\s*[0-9]+/i.test(ua)
|
8141 | , chromeos = /CrOS/.test(ua)
|
8142 | , silk = /silk/i.test(ua)
|
8143 | , sailfish = /sailfish/i.test(ua)
|
8144 | , tizen = /tizen/i.test(ua)
|
8145 | , webos = /(web|hpw)(o|0)s/i.test(ua)
|
8146 | , windowsphone = /windows phone/i.test(ua)
|
8147 | , samsungBrowser = /SamsungBrowser/i.test(ua)
|
8148 | , windows = !windowsphone && /windows/i.test(ua)
|
8149 | , mac = !iosdevice && !silk && /macintosh/i.test(ua)
|
8150 | , linux = !android && !sailfish && !tizen && !webos && /linux/i.test(ua)
|
8151 | , edgeVersion = getSecondMatch(/edg([ea]|ios)\/(\d+(\.\d+)?)/i)
|
8152 | , versionIdentifier = getFirstMatch(/version\/(\d+(\.\d+)?)/i)
|
8153 | , tablet = /tablet/i.test(ua) && !/tablet pc/i.test(ua)
|
8154 | , mobile = !tablet && /[^-]mobi/i.test(ua)
|
8155 | , xbox = /xbox/i.test(ua)
|
8156 | , result
|
8157 |
|
8158 | if (/opera/i.test(ua)) {
|
8159 |
|
8160 | result = {
|
8161 | name: 'Opera'
|
8162 | , opera: t
|
8163 | , version: versionIdentifier || getFirstMatch(/(?:opera|opr|opios)[\s\/](\d+(\.\d+)?)/i)
|
8164 | }
|
8165 | } else if (/opr\/|opios/i.test(ua)) {
|
8166 |
|
8167 | result = {
|
8168 | name: 'Opera'
|
8169 | , opera: t
|
8170 | , version: getFirstMatch(/(?:opr|opios)[\s\/](\d+(\.\d+)?)/i) || versionIdentifier
|
8171 | }
|
8172 | }
|
8173 | else if (/SamsungBrowser/i.test(ua)) {
|
8174 | result = {
|
8175 | name: 'Samsung Internet for Android'
|
8176 | , samsungBrowser: t
|
8177 | , version: versionIdentifier || getFirstMatch(/(?:SamsungBrowser)[\s\/](\d+(\.\d+)?)/i)
|
8178 | }
|
8179 | }
|
8180 | else if (/Whale/i.test(ua)) {
|
8181 | result = {
|
8182 | name: 'NAVER Whale browser'
|
8183 | , whale: t
|
8184 | , version: getFirstMatch(/(?:whale)[\s\/](\d+(?:\.\d+)+)/i)
|
8185 | }
|
8186 | }
|
8187 | else if (/MZBrowser/i.test(ua)) {
|
8188 | result = {
|
8189 | name: 'MZ Browser'
|
8190 | , mzbrowser: t
|
8191 | , version: getFirstMatch(/(?:MZBrowser)[\s\/](\d+(?:\.\d+)+)/i)
|
8192 | }
|
8193 | }
|
8194 | else if (/coast/i.test(ua)) {
|
8195 | result = {
|
8196 | name: 'Opera Coast'
|
8197 | , coast: t
|
8198 | , version: versionIdentifier || getFirstMatch(/(?:coast)[\s\/](\d+(\.\d+)?)/i)
|
8199 | }
|
8200 | }
|
8201 | else if (/focus/i.test(ua)) {
|
8202 | result = {
|
8203 | name: 'Focus'
|
8204 | , focus: t
|
8205 | , version: getFirstMatch(/(?:focus)[\s\/](\d+(?:\.\d+)+)/i)
|
8206 | }
|
8207 | }
|
8208 | else if (/yabrowser/i.test(ua)) {
|
8209 | result = {
|
8210 | name: 'Yandex Browser'
|
8211 | , yandexbrowser: t
|
8212 | , version: versionIdentifier || getFirstMatch(/(?:yabrowser)[\s\/](\d+(\.\d+)?)/i)
|
8213 | }
|
8214 | }
|
8215 | else if (/ucbrowser/i.test(ua)) {
|
8216 | result = {
|
8217 | name: 'UC Browser'
|
8218 | , ucbrowser: t
|
8219 | , version: getFirstMatch(/(?:ucbrowser)[\s\/](\d+(?:\.\d+)+)/i)
|
8220 | }
|
8221 | }
|
8222 | else if (/mxios/i.test(ua)) {
|
8223 | result = {
|
8224 | name: 'Maxthon'
|
8225 | , maxthon: t
|
8226 | , version: getFirstMatch(/(?:mxios)[\s\/](\d+(?:\.\d+)+)/i)
|
8227 | }
|
8228 | }
|
8229 | else if (/epiphany/i.test(ua)) {
|
8230 | result = {
|
8231 | name: 'Epiphany'
|
8232 | , epiphany: t
|
8233 | , version: getFirstMatch(/(?:epiphany)[\s\/](\d+(?:\.\d+)+)/i)
|
8234 | }
|
8235 | }
|
8236 | else if (/puffin/i.test(ua)) {
|
8237 | result = {
|
8238 | name: 'Puffin'
|
8239 | , puffin: t
|
8240 | , version: getFirstMatch(/(?:puffin)[\s\/](\d+(?:\.\d+)?)/i)
|
8241 | }
|
8242 | }
|
8243 | else if (/sleipnir/i.test(ua)) {
|
8244 | result = {
|
8245 | name: 'Sleipnir'
|
8246 | , sleipnir: t
|
8247 | , version: getFirstMatch(/(?:sleipnir)[\s\/](\d+(?:\.\d+)+)/i)
|
8248 | }
|
8249 | }
|
8250 | else if (/k-meleon/i.test(ua)) {
|
8251 | result = {
|
8252 | name: 'K-Meleon'
|
8253 | , kMeleon: t
|
8254 | , version: getFirstMatch(/(?:k-meleon)[\s\/](\d+(?:\.\d+)+)/i)
|
8255 | }
|
8256 | }
|
8257 | else if (windowsphone) {
|
8258 | result = {
|
8259 | name: 'Windows Phone'
|
8260 | , osname: 'Windows Phone'
|
8261 | , windowsphone: t
|
8262 | }
|
8263 | if (edgeVersion) {
|
8264 | result.msedge = t
|
8265 | result.version = edgeVersion
|
8266 | }
|
8267 | else {
|
8268 | result.msie = t
|
8269 | result.version = getFirstMatch(/iemobile\/(\d+(\.\d+)?)/i)
|
8270 | }
|
8271 | }
|
8272 | else if (/msie|trident/i.test(ua)) {
|
8273 | result = {
|
8274 | name: 'Internet Explorer'
|
8275 | , msie: t
|
8276 | , version: getFirstMatch(/(?:msie |rv:)(\d+(\.\d+)?)/i)
|
8277 | }
|
8278 | } else if (chromeos) {
|
8279 | result = {
|
8280 | name: 'Chrome'
|
8281 | , osname: 'Chrome OS'
|
8282 | , chromeos: t
|
8283 | , chromeBook: t
|
8284 | , chrome: t
|
8285 | , version: getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.\d+)?)/i)
|
8286 | }
|
8287 | } else if (/edg([ea]|ios)/i.test(ua)) {
|
8288 | result = {
|
8289 | name: 'Microsoft Edge'
|
8290 | , msedge: t
|
8291 | , version: edgeVersion
|
8292 | }
|
8293 | }
|
8294 | else if (/vivaldi/i.test(ua)) {
|
8295 | result = {
|
8296 | name: 'Vivaldi'
|
8297 | , vivaldi: t
|
8298 | , version: getFirstMatch(/vivaldi\/(\d+(\.\d+)?)/i) || versionIdentifier
|
8299 | }
|
8300 | }
|
8301 | else if (sailfish) {
|
8302 | result = {
|
8303 | name: 'Sailfish'
|
8304 | , osname: 'Sailfish OS'
|
8305 | , sailfish: t
|
8306 | , version: getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i)
|
8307 | }
|
8308 | }
|
8309 | else if (/seamonkey\//i.test(ua)) {
|
8310 | result = {
|
8311 | name: 'SeaMonkey'
|
8312 | , seamonkey: t
|
8313 | , version: getFirstMatch(/seamonkey\/(\d+(\.\d+)?)/i)
|
8314 | }
|
8315 | }
|
8316 | else if (/firefox|iceweasel|fxios/i.test(ua)) {
|
8317 | result = {
|
8318 | name: 'Firefox'
|
8319 | , firefox: t
|
8320 | , version: getFirstMatch(/(?:firefox|iceweasel|fxios)[ \/](\d+(\.\d+)?)/i)
|
8321 | }
|
8322 | if (/\((mobile|tablet);[^\)]*rv:[\d\.]+\)/i.test(ua)) {
|
8323 | result.firefoxos = t
|
8324 | result.osname = 'Firefox OS'
|
8325 | }
|
8326 | }
|
8327 | else if (silk) {
|
8328 | result = {
|
8329 | name: 'Amazon Silk'
|
8330 | , silk: t
|
8331 | , version : getFirstMatch(/silk\/(\d+(\.\d+)?)/i)
|
8332 | }
|
8333 | }
|
8334 | else if (/phantom/i.test(ua)) {
|
8335 | result = {
|
8336 | name: 'PhantomJS'
|
8337 | , phantom: t
|
8338 | , version: getFirstMatch(/phantomjs\/(\d+(\.\d+)?)/i)
|
8339 | }
|
8340 | }
|
8341 | else if (/slimerjs/i.test(ua)) {
|
8342 | result = {
|
8343 | name: 'SlimerJS'
|
8344 | , slimer: t
|
8345 | , version: getFirstMatch(/slimerjs\/(\d+(\.\d+)?)/i)
|
8346 | }
|
8347 | }
|
8348 | else if (/blackberry|\bbb\d+/i.test(ua) || /rim\stablet/i.test(ua)) {
|
8349 | result = {
|
8350 | name: 'BlackBerry'
|
8351 | , osname: 'BlackBerry OS'
|
8352 | , blackberry: t
|
8353 | , version: versionIdentifier || getFirstMatch(/blackberry[\d]+\/(\d+(\.\d+)?)/i)
|
8354 | }
|
8355 | }
|
8356 | else if (webos) {
|
8357 | result = {
|
8358 | name: 'WebOS'
|
8359 | , osname: 'WebOS'
|
8360 | , webos: t
|
8361 | , version: versionIdentifier || getFirstMatch(/w(?:eb)?osbrowser\/(\d+(\.\d+)?)/i)
|
8362 | };
|
8363 | /touchpad\
|
8364 | }
|
8365 | else if (/bada/i.test(ua)) {
|
8366 | result = {
|
8367 | name: 'Bada'
|
8368 | , osname: 'Bada'
|
8369 | , bada: t
|
8370 | , version: getFirstMatch(/dolfin\/(\d+(\.\d+)?)/i)
|
8371 | };
|
8372 | }
|
8373 | else if (tizen) {
|
8374 | result = {
|
8375 | name: 'Tizen'
|
8376 | , osname: 'Tizen'
|
8377 | , tizen: t
|
8378 | , version: getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.\d+)?)/i) || versionIdentifier
|
8379 | };
|
8380 | }
|
8381 | else if (/qupzilla/i.test(ua)) {
|
8382 | result = {
|
8383 | name: 'QupZilla'
|
8384 | , qupzilla: t
|
8385 | , version: getFirstMatch(/(?:qupzilla)[\s\/](\d+(?:\.\d+)+)/i) || versionIdentifier
|
8386 | }
|
8387 | }
|
8388 | else if (/chromium/i.test(ua)) {
|
8389 | result = {
|
8390 | name: 'Chromium'
|
8391 | , chromium: t
|
8392 | , version: getFirstMatch(/(?:chromium)[\s\/](\d+(?:\.\d+)?)/i) || versionIdentifier
|
8393 | }
|
8394 | }
|
8395 | else if (/chrome|crios|crmo/i.test(ua)) {
|
8396 | result = {
|
8397 | name: 'Chrome'
|
8398 | , chrome: t
|
8399 | , version: getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.\d+)?)/i)
|
8400 | }
|
8401 | }
|
8402 | else if (android) {
|
8403 | result = {
|
8404 | name: 'Android'
|
8405 | , version: versionIdentifier
|
8406 | }
|
8407 | }
|
8408 | else if (/safari|applewebkit/i.test(ua)) {
|
8409 | result = {
|
8410 | name: 'Safari'
|
8411 | , safari: t
|
8412 | }
|
8413 | if (versionIdentifier) {
|
8414 | result.version = versionIdentifier
|
8415 | }
|
8416 | }
|
8417 | else if (iosdevice) {
|
8418 | result = {
|
8419 | name : iosdevice == 'iphone' ? 'iPhone' : iosdevice == 'ipad' ? 'iPad' : 'iPod'
|
8420 | }
|
8421 |
|
8422 | if (versionIdentifier) {
|
8423 | result.version = versionIdentifier
|
8424 | }
|
8425 | }
|
8426 | else if(/googlebot/i.test(ua)) {
|
8427 | result = {
|
8428 | name: 'Googlebot'
|
8429 | , googlebot: t
|
8430 | , version: getFirstMatch(/googlebot\/(\d+(\.\d+))/i) || versionIdentifier
|
8431 | }
|
8432 | }
|
8433 | else {
|
8434 | result = {
|
8435 | name: getFirstMatch(/^(.*)\/(.*) /),
|
8436 | version: getSecondMatch(/^(.*)\/(.*) /)
|
8437 | };
|
8438 | }
|
8439 |
|
8440 |
|
8441 | if (!result.msedge && /(apple)?webkit/i.test(ua)) {
|
8442 | if (/(apple)?webkit\/537\.36/i.test(ua)) {
|
8443 | result.name = result.name || "Blink"
|
8444 | result.blink = t
|
8445 | } else {
|
8446 | result.name = result.name || "Webkit"
|
8447 | result.webkit = t
|
8448 | }
|
8449 | if (!result.version && versionIdentifier) {
|
8450 | result.version = versionIdentifier
|
8451 | }
|
8452 | } else if (!result.opera && /gecko\//i.test(ua)) {
|
8453 | result.name = result.name || "Gecko"
|
8454 | result.gecko = t
|
8455 | result.version = result.version || getFirstMatch(/gecko\/(\d+(\.\d+)?)/i)
|
8456 | }
|
8457 |
|
8458 |
|
8459 | if (!result.windowsphone && (android || result.silk)) {
|
8460 | result.android = t
|
8461 | result.osname = 'Android'
|
8462 | } else if (!result.windowsphone && iosdevice) {
|
8463 | result[iosdevice] = t
|
8464 | result.ios = t
|
8465 | result.osname = 'iOS'
|
8466 | } else if (mac) {
|
8467 | result.mac = t
|
8468 | result.osname = 'macOS'
|
8469 | } else if (xbox) {
|
8470 | result.xbox = t
|
8471 | result.osname = 'Xbox'
|
8472 | } else if (windows) {
|
8473 | result.windows = t
|
8474 | result.osname = 'Windows'
|
8475 | } else if (linux) {
|
8476 | result.linux = t
|
8477 | result.osname = 'Linux'
|
8478 | }
|
8479 |
|
8480 | function getWindowsVersion (s) {
|
8481 | switch (s) {
|
8482 | case 'NT': return 'NT'
|
8483 | case 'XP': return 'XP'
|
8484 | case 'NT 5.0': return '2000'
|
8485 | case 'NT 5.1': return 'XP'
|
8486 | case 'NT 5.2': return '2003'
|
8487 | case 'NT 6.0': return 'Vista'
|
8488 | case 'NT 6.1': return '7'
|
8489 | case 'NT 6.2': return '8'
|
8490 | case 'NT 6.3': return '8.1'
|
8491 | case 'NT 10.0': return '10'
|
8492 | default: return undefined
|
8493 | }
|
8494 | }
|
8495 |
|
8496 |
|
8497 | var osVersion = '';
|
8498 | if (result.windows) {
|
8499 | osVersion = getWindowsVersion(getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i))
|
8500 | } else if (result.windowsphone) {
|
8501 | osVersion = getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i);
|
8502 | } else if (result.mac) {
|
8503 | osVersion = getFirstMatch(/Mac OS X (\d+([_\.\s]\d+)*)/i);
|
8504 | osVersion = osVersion.replace(/[_\s]/g, '.');
|
8505 | } else if (iosdevice) {
|
8506 | osVersion = getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i);
|
8507 | osVersion = osVersion.replace(/[_\s]/g, '.');
|
8508 | } else if (android) {
|
8509 | osVersion = getFirstMatch(/android[ \/-](\d+(\.\d+)*)/i);
|
8510 | } else if (result.webos) {
|
8511 | osVersion = getFirstMatch(/(?:web|hpw)os\/(\d+(\.\d+)*)/i);
|
8512 | } else if (result.blackberry) {
|
8513 | osVersion = getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i);
|
8514 | } else if (result.bada) {
|
8515 | osVersion = getFirstMatch(/bada\/(\d+(\.\d+)*)/i);
|
8516 | } else if (result.tizen) {
|
8517 | osVersion = getFirstMatch(/tizen[\/\s](\d+(\.\d+)*)/i);
|
8518 | }
|
8519 | if (osVersion) {
|
8520 | result.osversion = osVersion;
|
8521 | }
|
8522 |
|
8523 |
|
8524 | var osMajorVersion = !result.windows && osVersion.split('.')[0];
|
8525 | if (
|
8526 | tablet
|
8527 | || nexusTablet
|
8528 | || iosdevice == 'ipad'
|
8529 | || (android && (osMajorVersion == 3 || (osMajorVersion >= 4 && !mobile)))
|
8530 | || result.silk
|
8531 | ) {
|
8532 | result.tablet = t
|
8533 | } else if (
|
8534 | mobile
|
8535 | || iosdevice == 'iphone'
|
8536 | || iosdevice == 'ipod'
|
8537 | || android
|
8538 | || nexusMobile
|
8539 | || result.blackberry
|
8540 | || result.webos
|
8541 | || result.bada
|
8542 | ) {
|
8543 | result.mobile = t
|
8544 | }
|
8545 |
|
8546 |
|
8547 |
|
8548 | if (result.msedge ||
|
8549 | (result.msie && result.version >= 10) ||
|
8550 | (result.yandexbrowser && result.version >= 15) ||
|
8551 | (result.vivaldi && result.version >= 1.0) ||
|
8552 | (result.chrome && result.version >= 20) ||
|
8553 | (result.samsungBrowser && result.version >= 4) ||
|
8554 | (result.whale && compareVersions([result.version, '1.0']) === 1) ||
|
8555 | (result.mzbrowser && compareVersions([result.version, '6.0']) === 1) ||
|
8556 | (result.focus && compareVersions([result.version, '1.0']) === 1) ||
|
8557 | (result.firefox && result.version >= 20.0) ||
|
8558 | (result.safari && result.version >= 6) ||
|
8559 | (result.opera && result.version >= 10.0) ||
|
8560 | (result.ios && result.osversion && result.osversion.split(".")[0] >= 6) ||
|
8561 | (result.blackberry && result.version >= 10.1)
|
8562 | || (result.chromium && result.version >= 20)
|
8563 | ) {
|
8564 | result.a = t;
|
8565 | }
|
8566 | else if ((result.msie && result.version < 10) ||
|
8567 | (result.chrome && result.version < 20) ||
|
8568 | (result.firefox && result.version < 20.0) ||
|
8569 | (result.safari && result.version < 6) ||
|
8570 | (result.opera && result.version < 10.0) ||
|
8571 | (result.ios && result.osversion && result.osversion.split(".")[0] < 6)
|
8572 | || (result.chromium && result.version < 20)
|
8573 | ) {
|
8574 | result.c = t
|
8575 | } else result.x = t
|
8576 |
|
8577 | return result
|
8578 | }
|
8579 |
|
8580 | var bowser = detect(typeof navigator !== 'undefined' ? navigator.userAgent || '' : '')
|
8581 |
|
8582 | bowser.test = function (browserList) {
|
8583 | for (var i = 0; i < browserList.length; ++i) {
|
8584 | var browserItem = browserList[i];
|
8585 | if (typeof browserItem=== 'string') {
|
8586 | if (browserItem in bowser) {
|
8587 | return true;
|
8588 | }
|
8589 | }
|
8590 | }
|
8591 | return false;
|
8592 | }
|
8593 |
|
8594 | |
8595 |
|
8596 |
|
8597 |
|
8598 |
|
8599 |
|
8600 |
|
8601 |
|
8602 |
|
8603 | function getVersionPrecision(version) {
|
8604 | return version.split(".").length;
|
8605 | }
|
8606 |
|
8607 | |
8608 |
|
8609 |
|
8610 |
|
8611 |
|
8612 |
|
8613 |
|
8614 | function map(arr, iterator) {
|
8615 | var result = [], i;
|
8616 | if (Array.prototype.map) {
|
8617 | return Array.prototype.map.call(arr, iterator);
|
8618 | }
|
8619 | for (i = 0; i < arr.length; i++) {
|
8620 | result.push(iterator(arr[i]));
|
8621 | }
|
8622 | return result;
|
8623 | }
|
8624 |
|
8625 | |
8626 |
|
8627 |
|
8628 |
|
8629 |
|
8630 |
|
8631 |
|
8632 |
|
8633 |
|
8634 |
|
8635 |
|
8636 |
|
8637 | function compareVersions(versions) {
|
8638 |
|
8639 | var precision = Math.max(getVersionPrecision(versions[0]), getVersionPrecision(versions[1]));
|
8640 | var chunks = map(versions, function (version) {
|
8641 | var delta = precision - getVersionPrecision(version);
|
8642 |
|
8643 |
|
8644 | version = version + new Array(delta + 1).join(".0");
|
8645 |
|
8646 |
|
8647 | return map(version.split("."), function (chunk) {
|
8648 | return new Array(20 - chunk.length).join("0") + chunk;
|
8649 | }).reverse();
|
8650 | });
|
8651 |
|
8652 |
|
8653 | while (--precision >= 0) {
|
8654 |
|
8655 | if (chunks[0][precision] > chunks[1][precision]) {
|
8656 | return 1;
|
8657 | }
|
8658 | else if (chunks[0][precision] === chunks[1][precision]) {
|
8659 | if (precision === 0) {
|
8660 |
|
8661 | return 0;
|
8662 | }
|
8663 | }
|
8664 | else {
|
8665 | return -1;
|
8666 | }
|
8667 | }
|
8668 | }
|
8669 |
|
8670 | |
8671 |
|
8672 |
|
8673 |
|
8674 |
|
8675 |
|
8676 |
|
8677 |
|
8678 |
|
8679 |
|
8680 |
|
8681 |
|
8682 |
|
8683 |
|
8684 |
|
8685 |
|
8686 |
|
8687 |
|
8688 | function isUnsupportedBrowser(minVersions, strictMode, ua) {
|
8689 | var _bowser = bowser;
|
8690 |
|
8691 |
|
8692 | if (typeof strictMode === 'string') {
|
8693 | ua = strictMode;
|
8694 | strictMode = void(0);
|
8695 | }
|
8696 |
|
8697 | if (strictMode === void(0)) {
|
8698 | strictMode = false;
|
8699 | }
|
8700 | if (ua) {
|
8701 | _bowser = detect(ua);
|
8702 | }
|
8703 |
|
8704 | var version = "" + _bowser.version;
|
8705 | for (var browser in minVersions) {
|
8706 | if (minVersions.hasOwnProperty(browser)) {
|
8707 | if (_bowser[browser]) {
|
8708 | if (typeof minVersions[browser] !== 'string') {
|
8709 | throw new Error('Browser version in the minVersion map should be a string: ' + browser + ': ' + String(minVersions));
|
8710 | }
|
8711 |
|
8712 |
|
8713 | return compareVersions([version, minVersions[browser]]) < 0;
|
8714 | }
|
8715 | }
|
8716 | }
|
8717 |
|
8718 | return strictMode;
|
8719 | }
|
8720 |
|
8721 | |
8722 |
|
8723 |
|
8724 |
|
8725 |
|
8726 |
|
8727 |
|
8728 |
|
8729 | function check(minVersions, strictMode, ua) {
|
8730 | return !isUnsupportedBrowser(minVersions, strictMode, ua);
|
8731 | }
|
8732 |
|
8733 | bowser.isUnsupportedBrowser = isUnsupportedBrowser;
|
8734 | bowser.compareVersions = compareVersions;
|
8735 | bowser.check = check;
|
8736 |
|
8737 | |
8738 |
|
8739 |
|
8740 |
|
8741 |
|
8742 | bowser._detect = detect;
|
8743 |
|
8744 | |
8745 |
|
8746 |
|
8747 |
|
8748 | bowser.detect = detect;
|
8749 | return bowser
|
8750 | });
|
8751 |
|
8752 | },{}],78:[function(require,module,exports){
|
8753 |
|
8754 | },{}],79:[function(require,module,exports){
|
8755 | (function (global){
|
8756 | var ClientRequest = require('./lib/request')
|
8757 | var response = require('./lib/response')
|
8758 | var extend = require('xtend')
|
8759 | var statusCodes = require('builtin-status-codes')
|
8760 | var url = require('url')
|
8761 |
|
8762 | var http = exports
|
8763 |
|
8764 | http.request = function (opts, cb) {
|
8765 | if (typeof opts === 'string')
|
8766 | opts = url.parse(opts)
|
8767 | else
|
8768 | opts = extend(opts)
|
8769 |
|
8770 |
|
8771 |
|
8772 |
|
8773 | var defaultProtocol = global.location.protocol.search(/^https?:$/) === -1 ? 'http:' : ''
|
8774 |
|
8775 | var protocol = opts.protocol || defaultProtocol
|
8776 | var host = opts.hostname || opts.host
|
8777 | var port = opts.port
|
8778 | var path = opts.path || '/'
|
8779 |
|
8780 |
|
8781 | if (host && host.indexOf(':') !== -1)
|
8782 | host = '[' + host + ']'
|
8783 |
|
8784 |
|
8785 | opts.url = (host ? (protocol + '//' + host) : '') + (port ? ':' + port : '') + path
|
8786 | opts.method = (opts.method || 'GET').toUpperCase()
|
8787 | opts.headers = opts.headers || {}
|
8788 |
|
8789 |
|
8790 |
|
8791 | var req = new ClientRequest(opts)
|
8792 | if (cb)
|
8793 | req.on('response', cb)
|
8794 | return req
|
8795 | }
|
8796 |
|
8797 | http.get = function get (opts, cb) {
|
8798 | var req = http.request(opts, cb)
|
8799 | req.end()
|
8800 | return req
|
8801 | }
|
8802 |
|
8803 | http.ClientRequest = ClientRequest
|
8804 | http.IncomingMessage = response.IncomingMessage
|
8805 |
|
8806 | http.Agent = function () {}
|
8807 | http.Agent.defaultMaxSockets = 4
|
8808 |
|
8809 | http.globalAgent = new http.Agent()
|
8810 |
|
8811 | http.STATUS_CODES = statusCodes
|
8812 |
|
8813 | http.METHODS = [
|
8814 | 'CHECKOUT',
|
8815 | 'CONNECT',
|
8816 | 'COPY',
|
8817 | 'DELETE',
|
8818 | 'GET',
|
8819 | 'HEAD',
|
8820 | 'LOCK',
|
8821 | 'M-SEARCH',
|
8822 | 'MERGE',
|
8823 | 'MKACTIVITY',
|
8824 | 'MKCOL',
|
8825 | 'MOVE',
|
8826 | 'NOTIFY',
|
8827 | 'OPTIONS',
|
8828 | 'PATCH',
|
8829 | 'POST',
|
8830 | 'PROPFIND',
|
8831 | 'PROPPATCH',
|
8832 | 'PURGE',
|
8833 | 'PUT',
|
8834 | 'REPORT',
|
8835 | 'SEARCH',
|
8836 | 'SUBSCRIBE',
|
8837 | 'TRACE',
|
8838 | 'UNLOCK',
|
8839 | 'UNSUBSCRIBE'
|
8840 | ]
|
8841 | }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
8842 | },{"./lib/request":81,"./lib/response":82,"builtin-status-codes":99,"url":394,"xtend":386}],80:[function(require,module,exports){
|
8843 | (function (global){
|
8844 | exports.fetch = isFunction(global.fetch) && isFunction(global.ReadableStream)
|
8845 |
|
8846 | exports.writableStream = isFunction(global.WritableStream)
|
8847 |
|
8848 | exports.abortController = isFunction(global.AbortController)
|
8849 |
|
8850 |
|
8851 |
|
8852 |
|
8853 | var xhr
|
8854 | function getXHR () {
|
8855 |
|
8856 | if (xhr !== undefined) return xhr
|
8857 |
|
8858 | if (global.XMLHttpRequest) {
|
8859 | xhr = new global.XMLHttpRequest()
|
8860 |
|
8861 |
|
8862 |
|
8863 | try {
|
8864 | xhr.open('GET', global.XDomainRequest ? '/' : 'https://example.com')
|
8865 | } catch(e) {
|
8866 | xhr = null
|
8867 | }
|
8868 | } else {
|
8869 |
|
8870 | xhr = null
|
8871 | }
|
8872 | return xhr
|
8873 | }
|
8874 |
|
8875 | function checkTypeSupport (type) {
|
8876 | var xhr = getXHR()
|
8877 | if (!xhr) return false
|
8878 | try {
|
8879 | xhr.responseType = type
|
8880 | return xhr.responseType === type
|
8881 | } catch (e) {}
|
8882 | return false
|
8883 | }
|
8884 |
|
8885 |
|
8886 |
|
8887 | exports.arraybuffer = exports.fetch || checkTypeSupport('arraybuffer')
|
8888 |
|
8889 |
|
8890 |
|
8891 | exports.msstream = !exports.fetch && checkTypeSupport('ms-stream')
|
8892 | exports.mozchunkedarraybuffer = !exports.fetch && checkTypeSupport('moz-chunked-arraybuffer')
|
8893 |
|
8894 |
|
8895 |
|
8896 | exports.overrideMimeType = exports.fetch || (getXHR() ? isFunction(getXHR().overrideMimeType) : false)
|
8897 |
|
8898 | function isFunction (value) {
|
8899 | return typeof value === 'function'
|
8900 | }
|
8901 |
|
8902 | xhr = null
|
8903 |
|
8904 | }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
8905 | },{}],81:[function(require,module,exports){
|
8906 | (function (process,global,Buffer){
|
8907 | var capability = require('./capability')
|
8908 | var inherits = require('inherits')
|
8909 | var response = require('./response')
|
8910 | var stream = require('readable-stream')
|
8911 |
|
8912 | var IncomingMessage = response.IncomingMessage
|
8913 | var rStates = response.readyStates
|
8914 |
|
8915 | function decideMode (preferBinary, useFetch) {
|
8916 | if (capability.fetch && useFetch) {
|
8917 | return 'fetch'
|
8918 | } else if (capability.mozchunkedarraybuffer) {
|
8919 | return 'moz-chunked-arraybuffer'
|
8920 | } else if (capability.msstream) {
|
8921 | return 'ms-stream'
|
8922 | } else if (capability.arraybuffer && preferBinary) {
|
8923 | return 'arraybuffer'
|
8924 | } else {
|
8925 | return 'text'
|
8926 | }
|
8927 | }
|
8928 |
|
8929 | var ClientRequest = module.exports = function (opts) {
|
8930 | var self = this
|
8931 | stream.Writable.call(self)
|
8932 |
|
8933 | self._opts = opts
|
8934 | self._body = []
|
8935 | self._headers = {}
|
8936 | if (opts.auth)
|
8937 | self.setHeader('Authorization', 'Basic ' + Buffer.from(opts.auth).toString('base64'))
|
8938 | Object.keys(opts.headers).forEach(function (name) {
|
8939 | self.setHeader(name, opts.headers[name])
|
8940 | })
|
8941 |
|
8942 | var preferBinary
|
8943 | var useFetch = true
|
8944 | if (opts.mode === 'disable-fetch' || ('requestTimeout' in opts && !capability.abortController)) {
|
8945 |
|
8946 | useFetch = false
|
8947 | preferBinary = true
|
8948 | } else if (opts.mode === 'prefer-streaming') {
|
8949 |
|
8950 |
|
8951 | preferBinary = false
|
8952 | } else if (opts.mode === 'allow-wrong-content-type') {
|
8953 |
|
8954 | preferBinary = !capability.overrideMimeType
|
8955 | } else if (!opts.mode || opts.mode === 'default' || opts.mode === 'prefer-fast') {
|
8956 |
|
8957 | preferBinary = true
|
8958 | } else {
|
8959 | throw new Error('Invalid value for opts.mode')
|
8960 | }
|
8961 | self._mode = decideMode(preferBinary, useFetch)
|
8962 | self._fetchTimer = null
|
8963 |
|
8964 | self.on('finish', function () {
|
8965 | self._onFinish()
|
8966 | })
|
8967 | }
|
8968 |
|
8969 | inherits(ClientRequest, stream.Writable)
|
8970 |
|
8971 | ClientRequest.prototype.setHeader = function (name, value) {
|
8972 | var self = this
|
8973 | var lowerName = name.toLowerCase()
|
8974 |
|
8975 |
|
8976 |
|
8977 | if (unsafeHeaders.indexOf(lowerName) !== -1)
|
8978 | return
|
8979 |
|
8980 | self._headers[lowerName] = {
|
8981 | name: name,
|
8982 | value: value
|
8983 | }
|
8984 | }
|
8985 |
|
8986 | ClientRequest.prototype.getHeader = function (name) {
|
8987 | var header = this._headers[name.toLowerCase()]
|
8988 | if (header)
|
8989 | return header.value
|
8990 | return null
|
8991 | }
|
8992 |
|
8993 | ClientRequest.prototype.removeHeader = function (name) {
|
8994 | var self = this
|
8995 | delete self._headers[name.toLowerCase()]
|
8996 | }
|
8997 |
|
8998 | ClientRequest.prototype._onFinish = function () {
|
8999 | var self = this
|
9000 |
|
9001 | if (self._destroyed)
|
9002 | return
|
9003 | var opts = self._opts
|
9004 |
|
9005 | var headersObj = self._headers
|
9006 | var body = null
|
9007 | if (opts.method !== 'GET' && opts.method !== 'HEAD') {
|
9008 | body = new Blob(self._body, {
|
9009 | type: (headersObj['content-type'] || {}).value || ''
|
9010 | });
|
9011 | }
|
9012 |
|
9013 |
|
9014 | var headersList = []
|
9015 | Object.keys(headersObj).forEach(function (keyName) {
|
9016 | var name = headersObj[keyName].name
|
9017 | var value = headersObj[keyName].value
|
9018 | if (Array.isArray(value)) {
|
9019 | value.forEach(function (v) {
|
9020 | headersList.push([name, v])
|
9021 | })
|
9022 | } else {
|
9023 | headersList.push([name, value])
|
9024 | }
|
9025 | })
|
9026 |
|
9027 | if (self._mode === 'fetch') {
|
9028 | var signal = null
|
9029 | if (capability.abortController) {
|
9030 | var controller = new AbortController()
|
9031 | signal = controller.signal
|
9032 | self._fetchAbortController = controller
|
9033 |
|
9034 | if ('requestTimeout' in opts && opts.requestTimeout !== 0) {
|
9035 | self._fetchTimer = global.setTimeout(function () {
|
9036 | self.emit('requestTimeout')
|
9037 | if (self._fetchAbortController)
|
9038 | self._fetchAbortController.abort()
|
9039 | }, opts.requestTimeout)
|
9040 | }
|
9041 | }
|
9042 |
|
9043 | global.fetch(self._opts.url, {
|
9044 | method: self._opts.method,
|
9045 | headers: headersList,
|
9046 | body: body || undefined,
|
9047 | mode: 'cors',
|
9048 | credentials: opts.withCredentials ? 'include' : 'same-origin',
|
9049 | signal: signal
|
9050 | }).then(function (response) {
|
9051 | self._fetchResponse = response
|
9052 | self._connect()
|
9053 | }, function (reason) {
|
9054 | global.clearTimeout(self._fetchTimer)
|
9055 | if (!self._destroyed)
|
9056 | self.emit('error', reason)
|
9057 | })
|
9058 | } else {
|
9059 | var xhr = self._xhr = new global.XMLHttpRequest()
|
9060 | try {
|
9061 | xhr.open(self._opts.method, self._opts.url, true)
|
9062 | } catch (err) {
|
9063 | process.nextTick(function () {
|
9064 | self.emit('error', err)
|
9065 | })
|
9066 | return
|
9067 | }
|
9068 |
|
9069 |
|
9070 | if ('responseType' in xhr)
|
9071 | xhr.responseType = self._mode
|
9072 |
|
9073 | if ('withCredentials' in xhr)
|
9074 | xhr.withCredentials = !!opts.withCredentials
|
9075 |
|
9076 | if (self._mode === 'text' && 'overrideMimeType' in xhr)
|
9077 | xhr.overrideMimeType('text/plain; charset=x-user-defined')
|
9078 |
|
9079 | if ('requestTimeout' in opts) {
|
9080 | xhr.timeout = opts.requestTimeout
|
9081 | xhr.ontimeout = function () {
|
9082 | self.emit('requestTimeout')
|
9083 | }
|
9084 | }
|
9085 |
|
9086 | headersList.forEach(function (header) {
|
9087 | xhr.setRequestHeader(header[0], header[1])
|
9088 | })
|
9089 |
|
9090 | self._response = null
|
9091 | xhr.onreadystatechange = function () {
|
9092 | switch (xhr.readyState) {
|
9093 | case rStates.LOADING:
|
9094 | case rStates.DONE:
|
9095 | self._onXHRProgress()
|
9096 | break
|
9097 | }
|
9098 | }
|
9099 |
|
9100 |
|
9101 | if (self._mode === 'moz-chunked-arraybuffer') {
|
9102 | xhr.onprogress = function () {
|
9103 | self._onXHRProgress()
|
9104 | }
|
9105 | }
|
9106 |
|
9107 | xhr.onerror = function () {
|
9108 | if (self._destroyed)
|
9109 | return
|
9110 | self.emit('error', new Error('XHR error'))
|
9111 | }
|
9112 |
|
9113 | try {
|
9114 | xhr.send(body)
|
9115 | } catch (err) {
|
9116 | process.nextTick(function () {
|
9117 | self.emit('error', err)
|
9118 | })
|
9119 | return
|
9120 | }
|
9121 | }
|
9122 | }
|
9123 |
|
9124 |
|
9125 |
|
9126 |
|
9127 |
|
9128 |
|
9129 | function statusValid (xhr) {
|
9130 | try {
|
9131 | var status = xhr.status
|
9132 | return (status !== null && status !== 0)
|
9133 | } catch (e) {
|
9134 | return false
|
9135 | }
|
9136 | }
|
9137 |
|
9138 | ClientRequest.prototype._onXHRProgress = function () {
|
9139 | var self = this
|
9140 |
|
9141 | if (!statusValid(self._xhr) || self._destroyed)
|
9142 | return
|
9143 |
|
9144 | if (!self._response)
|
9145 | self._connect()
|
9146 |
|
9147 | self._response._onXHRProgress()
|
9148 | }
|
9149 |
|
9150 | ClientRequest.prototype._connect = function () {
|
9151 | var self = this
|
9152 |
|
9153 | if (self._destroyed)
|
9154 | return
|
9155 |
|
9156 | self._response = new IncomingMessage(self._xhr, self._fetchResponse, self._mode, self._fetchTimer)
|
9157 | self._response.on('error', function(err) {
|
9158 | self.emit('error', err)
|
9159 | })
|
9160 |
|
9161 | self.emit('response', self._response)
|
9162 | }
|
9163 |
|
9164 | ClientRequest.prototype._write = function (chunk, encoding, cb) {
|
9165 | var self = this
|
9166 |
|
9167 | self._body.push(chunk)
|
9168 | cb()
|
9169 | }
|
9170 |
|
9171 | ClientRequest.prototype.abort = ClientRequest.prototype.destroy = function () {
|
9172 | var self = this
|
9173 | self._destroyed = true
|
9174 | global.clearTimeout(self._fetchTimer)
|
9175 | if (self._response)
|
9176 | self._response._destroyed = true
|
9177 | if (self._xhr)
|
9178 | self._xhr.abort()
|
9179 | else if (self._fetchAbortController)
|
9180 | self._fetchAbortController.abort()
|
9181 | }
|
9182 |
|
9183 | ClientRequest.prototype.end = function (data, encoding, cb) {
|
9184 | var self = this
|
9185 | if (typeof data === 'function') {
|
9186 | cb = data
|
9187 | data = undefined
|
9188 | }
|
9189 |
|
9190 | stream.Writable.prototype.end.call(self, data, encoding, cb)
|
9191 | }
|
9192 |
|
9193 | ClientRequest.prototype.flushHeaders = function () {}
|
9194 | ClientRequest.prototype.setTimeout = function () {}
|
9195 | ClientRequest.prototype.setNoDelay = function () {}
|
9196 | ClientRequest.prototype.setSocketKeepAlive = function () {}
|
9197 |
|
9198 |
|
9199 | var unsafeHeaders = [
|
9200 | 'accept-charset',
|
9201 | 'accept-encoding',
|
9202 | 'access-control-request-headers',
|
9203 | 'access-control-request-method',
|
9204 | 'connection',
|
9205 | 'content-length',
|
9206 | 'cookie',
|
9207 | 'cookie2',
|
9208 | 'date',
|
9209 | 'dnt',
|
9210 | 'expect',
|
9211 | 'host',
|
9212 | 'keep-alive',
|
9213 | 'origin',
|
9214 | 'referer',
|
9215 | 'te',
|
9216 | 'trailer',
|
9217 | 'transfer-encoding',
|
9218 | 'upgrade',
|
9219 | 'via'
|
9220 | ]
|
9221 |
|
9222 | }).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("buffer").Buffer)
|
9223 | },{"./capability":80,"./response":82,"_process":393,"buffer":98,"inherits":307,"readable-stream":97}],82:[function(require,module,exports){
|
9224 | (function (process,global,Buffer){
|
9225 | var capability = require('./capability')
|
9226 | var inherits = require('inherits')
|
9227 | var stream = require('readable-stream')
|
9228 |
|
9229 | var rStates = exports.readyStates = {
|
9230 | UNSENT: 0,
|
9231 | OPENED: 1,
|
9232 | HEADERS_RECEIVED: 2,
|
9233 | LOADING: 3,
|
9234 | DONE: 4
|
9235 | }
|
9236 |
|
9237 | var IncomingMessage = exports.IncomingMessage = function (xhr, response, mode, fetchTimer) {
|
9238 | var self = this
|
9239 | stream.Readable.call(self)
|
9240 |
|
9241 | self._mode = mode
|
9242 | self.headers = {}
|
9243 | self.rawHeaders = []
|
9244 | self.trailers = {}
|
9245 | self.rawTrailers = []
|
9246 |
|
9247 |
|
9248 | self.on('end', function () {
|
9249 |
|
9250 | process.nextTick(function () {
|
9251 | self.emit('close')
|
9252 | })
|
9253 | })
|
9254 |
|
9255 | if (mode === 'fetch') {
|
9256 | self._fetchResponse = response
|
9257 |
|
9258 | self.url = response.url
|
9259 | self.statusCode = response.status
|
9260 | self.statusMessage = response.statusText
|
9261 |
|
9262 | response.headers.forEach(function (header, key){
|
9263 | self.headers[key.toLowerCase()] = header
|
9264 | self.rawHeaders.push(key, header)
|
9265 | })
|
9266 |
|
9267 | if (capability.writableStream) {
|
9268 | var writable = new WritableStream({
|
9269 | write: function (chunk) {
|
9270 | return new Promise(function (resolve, reject) {
|
9271 | if (self._destroyed) {
|
9272 | reject()
|
9273 | } else if(self.push(Buffer.from(chunk))) {
|
9274 | resolve()
|
9275 | } else {
|
9276 | self._resumeFetch = resolve
|
9277 | }
|
9278 | })
|
9279 | },
|
9280 | close: function () {
|
9281 | global.clearTimeout(fetchTimer)
|
9282 | if (!self._destroyed)
|
9283 | self.push(null)
|
9284 | },
|
9285 | abort: function (err) {
|
9286 | if (!self._destroyed)
|
9287 | self.emit('error', err)
|
9288 | }
|
9289 | })
|
9290 |
|
9291 | try {
|
9292 | response.body.pipeTo(writable).catch(function (err) {
|
9293 | global.clearTimeout(fetchTimer)
|
9294 | if (!self._destroyed)
|
9295 | self.emit('error', err)
|
9296 | })
|
9297 | return
|
9298 | } catch (e) {}
|
9299 | }
|
9300 |
|
9301 | var reader = response.body.getReader()
|
9302 | function read () {
|
9303 | reader.read().then(function (result) {
|
9304 | if (self._destroyed)
|
9305 | return
|
9306 | if (result.done) {
|
9307 | global.clearTimeout(fetchTimer)
|
9308 | self.push(null)
|
9309 | return
|
9310 | }
|
9311 | self.push(Buffer.from(result.value))
|
9312 | read()
|
9313 | }).catch(function (err) {
|
9314 | global.clearTimeout(fetchTimer)
|
9315 | if (!self._destroyed)
|
9316 | self.emit('error', err)
|
9317 | })
|
9318 | }
|
9319 | read()
|
9320 | } else {
|
9321 | self._xhr = xhr
|
9322 | self._pos = 0
|
9323 |
|
9324 | self.url = xhr.responseURL
|
9325 | self.statusCode = xhr.status
|
9326 | self.statusMessage = xhr.statusText
|
9327 | var headers = xhr.getAllResponseHeaders().split(/\r?\n/)
|
9328 | headers.forEach(function (header) {
|
9329 | var matches = header.match(/^([^:]+):\s*(.*)/)
|
9330 | if (matches) {
|
9331 | var key = matches[1].toLowerCase()
|
9332 | if (key === 'set-cookie') {
|
9333 | if (self.headers[key] === undefined) {
|
9334 | self.headers[key] = []
|
9335 | }
|
9336 | self.headers[key].push(matches[2])
|
9337 | } else if (self.headers[key] !== undefined) {
|
9338 | self.headers[key] += ', ' + matches[2]
|
9339 | } else {
|
9340 | self.headers[key] = matches[2]
|
9341 | }
|
9342 | self.rawHeaders.push(matches[1], matches[2])
|
9343 | }
|
9344 | })
|
9345 |
|
9346 | self._charset = 'x-user-defined'
|
9347 | if (!capability.overrideMimeType) {
|
9348 | var mimeType = self.rawHeaders['mime-type']
|
9349 | if (mimeType) {
|
9350 | var charsetMatch = mimeType.match(/;\s*charset=([^;])(;|$)/)
|
9351 | if (charsetMatch) {
|
9352 | self._charset = charsetMatch[1].toLowerCase()
|
9353 | }
|
9354 | }
|
9355 | if (!self._charset)
|
9356 | self._charset = 'utf-8'
|
9357 | }
|
9358 | }
|
9359 | }
|
9360 |
|
9361 | inherits(IncomingMessage, stream.Readable)
|
9362 |
|
9363 | IncomingMessage.prototype._read = function () {
|
9364 | var self = this
|
9365 |
|
9366 | var resolve = self._resumeFetch
|
9367 | if (resolve) {
|
9368 | self._resumeFetch = null
|
9369 | resolve()
|
9370 | }
|
9371 | }
|
9372 |
|
9373 | IncomingMessage.prototype._onXHRProgress = function () {
|
9374 | var self = this
|
9375 |
|
9376 | var xhr = self._xhr
|
9377 |
|
9378 | var response = null
|
9379 | switch (self._mode) {
|
9380 | case 'text':
|
9381 | response = xhr.responseText
|
9382 | if (response.length > self._pos) {
|
9383 | var newData = response.substr(self._pos)
|
9384 | if (self._charset === 'x-user-defined') {
|
9385 | var buffer = Buffer.alloc(newData.length)
|
9386 | for (var i = 0; i < newData.length; i++)
|
9387 | buffer[i] = newData.charCodeAt(i) & 0xff
|
9388 |
|
9389 | self.push(buffer)
|
9390 | } else {
|
9391 | self.push(newData, self._charset)
|
9392 | }
|
9393 | self._pos = response.length
|
9394 | }
|
9395 | break
|
9396 | case 'arraybuffer':
|
9397 | if (xhr.readyState !== rStates.DONE || !xhr.response)
|
9398 | break
|
9399 | response = xhr.response
|
9400 | self.push(Buffer.from(new Uint8Array(response)))
|
9401 | break
|
9402 | case 'moz-chunked-arraybuffer':
|
9403 | response = xhr.response
|
9404 | if (xhr.readyState !== rStates.LOADING || !response)
|
9405 | break
|
9406 | self.push(Buffer.from(new Uint8Array(response)))
|
9407 | break
|
9408 | case 'ms-stream':
|
9409 | response = xhr.response
|
9410 | if (xhr.readyState !== rStates.LOADING)
|
9411 | break
|
9412 | var reader = new global.MSStreamReader()
|
9413 | reader.onprogress = function () {
|
9414 | if (reader.result.byteLength > self._pos) {
|
9415 | self.push(Buffer.from(new Uint8Array(reader.result.slice(self._pos))))
|
9416 | self._pos = reader.result.byteLength
|
9417 | }
|
9418 | }
|
9419 | reader.onload = function () {
|
9420 | self.push(null)
|
9421 | }
|
9422 |
|
9423 | reader.readAsArrayBuffer(response)
|
9424 | break
|
9425 | }
|
9426 |
|
9427 |
|
9428 | if (self._xhr.readyState === rStates.DONE && self._mode !== 'ms-stream') {
|
9429 | self.push(null)
|
9430 | }
|
9431 | }
|
9432 |
|
9433 | }).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("buffer").Buffer)
|
9434 | },{"./capability":80,"_process":393,"buffer":98,"inherits":307,"readable-stream":97}],83:[function(require,module,exports){
|
9435 | 'use strict';
|
9436 |
|
9437 | function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
|
9438 |
|
9439 | var codes = {};
|
9440 |
|
9441 | function createErrorType(code, message, Base) {
|
9442 | if (!Base) {
|
9443 | Base = Error;
|
9444 | }
|
9445 |
|
9446 | function getMessage(arg1, arg2, arg3) {
|
9447 | if (typeof message === 'string') {
|
9448 | return message;
|
9449 | } else {
|
9450 | return message(arg1, arg2, arg3);
|
9451 | }
|
9452 | }
|
9453 |
|
9454 | var NodeError =
|
9455 |
|
9456 | function (_Base) {
|
9457 | _inheritsLoose(NodeError, _Base);
|
9458 |
|
9459 | function NodeError(arg1, arg2, arg3) {
|
9460 | return _Base.call(this, getMessage(arg1, arg2, arg3)) || this;
|
9461 | }
|
9462 |
|
9463 | return NodeError;
|
9464 | }(Base);
|
9465 |
|
9466 | NodeError.prototype.name = Base.name;
|
9467 | NodeError.prototype.code = code;
|
9468 | codes[code] = NodeError;
|
9469 | }
|
9470 |
|
9471 |
|
9472 | function oneOf(expected, thing) {
|
9473 | if (Array.isArray(expected)) {
|
9474 | var len = expected.length;
|
9475 | expected = expected.map(function (i) {
|
9476 | return String(i);
|
9477 | });
|
9478 |
|
9479 | if (len > 2) {
|
9480 | return "one of ".concat(thing, " ").concat(expected.slice(0, len - 1).join(', '), ", or ") + expected[len - 1];
|
9481 | } else if (len === 2) {
|
9482 | return "one of ".concat(thing, " ").concat(expected[0], " or ").concat(expected[1]);
|
9483 | } else {
|
9484 | return "of ".concat(thing, " ").concat(expected[0]);
|
9485 | }
|
9486 | } else {
|
9487 | return "of ".concat(thing, " ").concat(String(expected));
|
9488 | }
|
9489 | }
|
9490 |
|
9491 |
|
9492 | function startsWith(str, search, pos) {
|
9493 | return str.substr(!pos || pos < 0 ? 0 : +pos, search.length) === search;
|
9494 | }
|
9495 |
|
9496 |
|
9497 | function endsWith(str, search, this_len) {
|
9498 | if (this_len === undefined || this_len > str.length) {
|
9499 | this_len = str.length;
|
9500 | }
|
9501 |
|
9502 | return str.substring(this_len - search.length, this_len) === search;
|
9503 | }
|
9504 |
|
9505 |
|
9506 | function includes(str, search, start) {
|
9507 | if (typeof start !== 'number') {
|
9508 | start = 0;
|
9509 | }
|
9510 |
|
9511 | if (start + search.length > str.length) {
|
9512 | return false;
|
9513 | } else {
|
9514 | return str.indexOf(search, start) !== -1;
|
9515 | }
|
9516 | }
|
9517 |
|
9518 | createErrorType('ERR_INVALID_OPT_VALUE', function (name, value) {
|
9519 | return 'The value "' + value + '" is invalid for option "' + name + '"';
|
9520 | }, TypeError);
|
9521 | createErrorType('ERR_INVALID_ARG_TYPE', function (name, expected, actual) {
|
9522 |
|
9523 | var determiner;
|
9524 |
|
9525 | if (typeof expected === 'string' && startsWith(expected, 'not ')) {
|
9526 | determiner = 'must not be';
|
9527 | expected = expected.replace(/^not /, '');
|
9528 | } else {
|
9529 | determiner = 'must be';
|
9530 | }
|
9531 |
|
9532 | var msg;
|
9533 |
|
9534 | if (endsWith(name, ' argument')) {
|
9535 |
|
9536 | msg = "The ".concat(name, " ").concat(determiner, " ").concat(oneOf(expected, 'type'));
|
9537 | } else {
|
9538 | var type = includes(name, '.') ? 'property' : 'argument';
|
9539 | msg = "The \"".concat(name, "\" ").concat(type, " ").concat(determiner, " ").concat(oneOf(expected, 'type'));
|
9540 | }
|
9541 |
|
9542 | msg += ". Received type ".concat(typeof actual);
|
9543 | return msg;
|
9544 | }, TypeError);
|
9545 | createErrorType('ERR_STREAM_PUSH_AFTER_EOF', 'stream.push() after EOF');
|
9546 | createErrorType('ERR_METHOD_NOT_IMPLEMENTED', function (name) {
|
9547 | return 'The ' + name + ' method is not implemented';
|
9548 | });
|
9549 | createErrorType('ERR_STREAM_PREMATURE_CLOSE', 'Premature close');
|
9550 | createErrorType('ERR_STREAM_DESTROYED', function (name) {
|
9551 | return 'Cannot call ' + name + ' after a stream was destroyed';
|
9552 | });
|
9553 | createErrorType('ERR_MULTIPLE_CALLBACK', 'Callback called multiple times');
|
9554 | createErrorType('ERR_STREAM_CANNOT_PIPE', 'Cannot pipe, not readable');
|
9555 | createErrorType('ERR_STREAM_WRITE_AFTER_END', 'write after end');
|
9556 | createErrorType('ERR_STREAM_NULL_VALUES', 'May not write null values to stream', TypeError);
|
9557 | createErrorType('ERR_UNKNOWN_ENCODING', function (arg) {
|
9558 | return 'Unknown encoding: ' + arg;
|
9559 | }, TypeError);
|
9560 | createErrorType('ERR_STREAM_UNSHIFT_AFTER_END_EVENT', 'stream.unshift() after end event');
|
9561 | module.exports.codes = codes;
|
9562 |
|
9563 | },{}],84:[function(require,module,exports){
|
9564 | (function (process){
|
9565 |
|
9566 |
|
9567 |
|
9568 |
|
9569 |
|
9570 |
|
9571 |
|
9572 |
|
9573 |
|
9574 |
|
9575 |
|
9576 |
|
9577 |
|
9578 |
|
9579 |
|
9580 |
|
9581 |
|
9582 |
|
9583 |
|
9584 |
|
9585 |
|
9586 |
|
9587 |
|
9588 |
|
9589 | 'use strict';
|
9590 |
|
9591 |
|
9592 | var objectKeys = Object.keys || function (obj) {
|
9593 | var keys = [];
|
9594 |
|
9595 | for (var key in obj) {
|
9596 | keys.push(key);
|
9597 | }
|
9598 |
|
9599 | return keys;
|
9600 | };
|
9601 |
|
9602 |
|
9603 |
|
9604 | module.exports = Duplex;
|
9605 |
|
9606 | var Readable = require('./_stream_readable');
|
9607 |
|
9608 | var Writable = require('./_stream_writable');
|
9609 |
|
9610 | require('inherits')(Duplex, Readable);
|
9611 |
|
9612 | {
|
9613 |
|
9614 | var keys = objectKeys(Writable.prototype);
|
9615 |
|
9616 | for (var v = 0; v < keys.length; v++) {
|
9617 | var method = keys[v];
|
9618 | if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method];
|
9619 | }
|
9620 | }
|
9621 |
|
9622 | function Duplex(options) {
|
9623 | if (!(this instanceof Duplex)) return new Duplex(options);
|
9624 | Readable.call(this, options);
|
9625 | Writable.call(this, options);
|
9626 | this.allowHalfOpen = true;
|
9627 |
|
9628 | if (options) {
|
9629 | if (options.readable === false) this.readable = false;
|
9630 | if (options.writable === false) this.writable = false;
|
9631 |
|
9632 | if (options.allowHalfOpen === false) {
|
9633 | this.allowHalfOpen = false;
|
9634 | this.once('end', onend);
|
9635 | }
|
9636 | }
|
9637 | }
|
9638 |
|
9639 | Object.defineProperty(Duplex.prototype, 'writableHighWaterMark', {
|
9640 |
|
9641 |
|
9642 |
|
9643 | enumerable: false,
|
9644 | get: function get() {
|
9645 | return this._writableState.highWaterMark;
|
9646 | }
|
9647 | });
|
9648 | Object.defineProperty(Duplex.prototype, 'writableBuffer', {
|
9649 |
|
9650 |
|
9651 |
|
9652 | enumerable: false,
|
9653 | get: function get() {
|
9654 | return this._writableState && this._writableState.getBuffer();
|
9655 | }
|
9656 | });
|
9657 | Object.defineProperty(Duplex.prototype, 'writableLength', {
|
9658 |
|
9659 |
|
9660 |
|
9661 | enumerable: false,
|
9662 | get: function get() {
|
9663 | return this._writableState.length;
|
9664 | }
|
9665 | });
|
9666 |
|
9667 | function onend() {
|
9668 |
|
9669 | if (this._writableState.ended) return;
|
9670 |
|
9671 |
|
9672 | process.nextTick(onEndNT, this);
|
9673 | }
|
9674 |
|
9675 | function onEndNT(self) {
|
9676 | self.end();
|
9677 | }
|
9678 |
|
9679 | Object.defineProperty(Duplex.prototype, 'destroyed', {
|
9680 |
|
9681 |
|
9682 |
|
9683 | enumerable: false,
|
9684 | get: function get() {
|
9685 | if (this._readableState === undefined || this._writableState === undefined) {
|
9686 | return false;
|
9687 | }
|
9688 |
|
9689 | return this._readableState.destroyed && this._writableState.destroyed;
|
9690 | },
|
9691 | set: function set(value) {
|
9692 |
|
9693 |
|
9694 | if (this._readableState === undefined || this._writableState === undefined) {
|
9695 | return;
|
9696 | }
|
9697 |
|
9698 |
|
9699 |
|
9700 | this._readableState.destroyed = value;
|
9701 | this._writableState.destroyed = value;
|
9702 | }
|
9703 | });
|
9704 | }).call(this,require('_process'))
|
9705 | },{"./_stream_readable":86,"./_stream_writable":88,"_process":393,"inherits":307}],85:[function(require,module,exports){
|
9706 |
|
9707 |
|
9708 |
|
9709 |
|
9710 |
|
9711 |
|
9712 |
|
9713 |
|
9714 |
|
9715 |
|
9716 |
|
9717 |
|
9718 |
|
9719 |
|
9720 |
|
9721 |
|
9722 |
|
9723 |
|
9724 |
|
9725 |
|
9726 |
|
9727 |
|
9728 |
|
9729 | 'use strict';
|
9730 |
|
9731 | module.exports = PassThrough;
|
9732 |
|
9733 | var Transform = require('./_stream_transform');
|
9734 |
|
9735 | require('inherits')(PassThrough, Transform);
|
9736 |
|
9737 | function PassThrough(options) {
|
9738 | if (!(this instanceof PassThrough)) return new PassThrough(options);
|
9739 | Transform.call(this, options);
|
9740 | }
|
9741 |
|
9742 | PassThrough.prototype._transform = function (chunk, encoding, cb) {
|
9743 | cb(null, chunk);
|
9744 | };
|
9745 | },{"./_stream_transform":87,"inherits":307}],86:[function(require,module,exports){
|
9746 | (function (process,global){
|
9747 |
|
9748 |
|
9749 |
|
9750 |
|
9751 |
|
9752 |
|
9753 |
|
9754 |
|
9755 |
|
9756 |
|
9757 |
|
9758 |
|
9759 |
|
9760 |
|
9761 |
|
9762 |
|
9763 |
|
9764 |
|
9765 |
|
9766 |
|
9767 | 'use strict';
|
9768 |
|
9769 | module.exports = Readable;
|
9770 |
|
9771 |
|
9772 | var Duplex;
|
9773 |
|
9774 |
|
9775 | Readable.ReadableState = ReadableState;
|
9776 |
|
9777 |
|
9778 | var EE = require('events').EventEmitter;
|
9779 |
|
9780 | var EElistenerCount = function EElistenerCount(emitter, type) {
|
9781 | return emitter.listeners(type).length;
|
9782 | };
|
9783 |
|
9784 |
|
9785 |
|
9786 |
|
9787 |
|
9788 | var Stream = require('./internal/streams/stream');
|
9789 |
|
9790 |
|
9791 |
|
9792 | var Buffer = require('buffer').Buffer;
|
9793 |
|
9794 | var OurUint8Array = global.Uint8Array || function () {};
|
9795 |
|
9796 | function _uint8ArrayToBuffer(chunk) {
|
9797 | return Buffer.from(chunk);
|
9798 | }
|
9799 |
|
9800 | function _isUint8Array(obj) {
|
9801 | return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;
|
9802 | }
|
9803 |
|
9804 |
|
9805 |
|
9806 | var debugUtil = require('util');
|
9807 |
|
9808 | var debug;
|
9809 |
|
9810 | if (debugUtil && debugUtil.debuglog) {
|
9811 | debug = debugUtil.debuglog('stream');
|
9812 | } else {
|
9813 | debug = function debug() {};
|
9814 | }
|
9815 |
|
9816 |
|
9817 |
|
9818 | var BufferList = require('./internal/streams/buffer_list');
|
9819 |
|
9820 | var destroyImpl = require('./internal/streams/destroy');
|
9821 |
|
9822 | var _require = require('./internal/streams/state'),
|
9823 | getHighWaterMark = _require.getHighWaterMark;
|
9824 |
|
9825 | var _require$codes = require('../errors').codes,
|
9826 | ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE,
|
9827 | ERR_STREAM_PUSH_AFTER_EOF = _require$codes.ERR_STREAM_PUSH_AFTER_EOF,
|
9828 | ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED,
|
9829 | ERR_STREAM_UNSHIFT_AFTER_END_EVENT = _require$codes.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;
|
9830 |
|
9831 |
|
9832 | var StringDecoder;
|
9833 | var createReadableStreamAsyncIterator;
|
9834 | var from;
|
9835 |
|
9836 | require('inherits')(Readable, Stream);
|
9837 |
|
9838 | var errorOrDestroy = destroyImpl.errorOrDestroy;
|
9839 | var kProxyEvents = ['error', 'close', 'destroy', 'pause', 'resume'];
|
9840 |
|
9841 | function prependListener(emitter, event, fn) {
|
9842 |
|
9843 |
|
9844 | if (typeof emitter.prependListener === 'function') return emitter.prependListener(event, fn);
|
9845 |
|
9846 |
|
9847 |
|
9848 |
|
9849 | if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);else if (Array.isArray(emitter._events[event])) emitter._events[event].unshift(fn);else emitter._events[event] = [fn, emitter._events[event]];
|
9850 | }
|
9851 |
|
9852 | function ReadableState(options, stream, isDuplex) {
|
9853 | Duplex = Duplex || require('./_stream_duplex');
|
9854 | options = options || {};
|
9855 |
|
9856 |
|
9857 |
|
9858 |
|
9859 |
|
9860 | if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof Duplex;
|
9861 |
|
9862 |
|
9863 | this.objectMode = !!options.objectMode;
|
9864 | if (isDuplex) this.objectMode = this.objectMode || !!options.readableObjectMode;
|
9865 |
|
9866 |
|
9867 | this.highWaterMark = getHighWaterMark(this, options, 'readableHighWaterMark', isDuplex);
|
9868 |
|
9869 |
|
9870 |
|
9871 | this.buffer = new BufferList();
|
9872 | this.length = 0;
|
9873 | this.pipes = null;
|
9874 | this.pipesCount = 0;
|
9875 | this.flowing = null;
|
9876 | this.ended = false;
|
9877 | this.endEmitted = false;
|
9878 | this.reading = false;
|
9879 |
|
9880 |
|
9881 |
|
9882 |
|
9883 | this.sync = true;
|
9884 |
|
9885 |
|
9886 | this.needReadable = false;
|
9887 | this.emittedReadable = false;
|
9888 | this.readableListening = false;
|
9889 | this.resumeScheduled = false;
|
9890 | this.paused = true;
|
9891 |
|
9892 | this.emitClose = options.emitClose !== false;
|
9893 |
|
9894 | this.autoDestroy = !!options.autoDestroy;
|
9895 |
|
9896 | this.destroyed = false;
|
9897 |
|
9898 |
|
9899 |
|
9900 | this.defaultEncoding = options.defaultEncoding || 'utf8';
|
9901 |
|
9902 | this.awaitDrain = 0;
|
9903 |
|
9904 | this.readingMore = false;
|
9905 | this.decoder = null;
|
9906 | this.encoding = null;
|
9907 |
|
9908 | if (options.encoding) {
|
9909 | if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder;
|
9910 | this.decoder = new StringDecoder(options.encoding);
|
9911 | this.encoding = options.encoding;
|
9912 | }
|
9913 | }
|
9914 |
|
9915 | function Readable(options) {
|
9916 | Duplex = Duplex || require('./_stream_duplex');
|
9917 | if (!(this instanceof Readable)) return new Readable(options);
|
9918 |
|
9919 |
|
9920 | var isDuplex = this instanceof Duplex;
|
9921 | this._readableState = new ReadableState(options, this, isDuplex);
|
9922 |
|
9923 | this.readable = true;
|
9924 |
|
9925 | if (options) {
|
9926 | if (typeof options.read === 'function') this._read = options.read;
|
9927 | if (typeof options.destroy === 'function') this._destroy = options.destroy;
|
9928 | }
|
9929 |
|
9930 | Stream.call(this);
|
9931 | }
|
9932 |
|
9933 | Object.defineProperty(Readable.prototype, 'destroyed', {
|
9934 |
|
9935 |
|
9936 |
|
9937 | enumerable: false,
|
9938 | get: function get() {
|
9939 | if (this._readableState === undefined) {
|
9940 | return false;
|
9941 | }
|
9942 |
|
9943 | return this._readableState.destroyed;
|
9944 | },
|
9945 | set: function set(value) {
|
9946 |
|
9947 |
|
9948 | if (!this._readableState) {
|
9949 | return;
|
9950 | }
|
9951 |
|
9952 |
|
9953 |
|
9954 | this._readableState.destroyed = value;
|
9955 | }
|
9956 | });
|
9957 | Readable.prototype.destroy = destroyImpl.destroy;
|
9958 | Readable.prototype._undestroy = destroyImpl.undestroy;
|
9959 |
|
9960 | Readable.prototype._destroy = function (err, cb) {
|
9961 | cb(err);
|
9962 | };
|
9963 |
|
9964 |
|
9965 |
|
9966 |
|
9967 |
|
9968 | Readable.prototype.push = function (chunk, encoding) {
|
9969 | var state = this._readableState;
|
9970 | var skipChunkCheck;
|
9971 |
|
9972 | if (!state.objectMode) {
|
9973 | if (typeof chunk === 'string') {
|
9974 | encoding = encoding || state.defaultEncoding;
|
9975 |
|
9976 | if (encoding !== state.encoding) {
|
9977 | chunk = Buffer.from(chunk, encoding);
|
9978 | encoding = '';
|
9979 | }
|
9980 |
|
9981 | skipChunkCheck = true;
|
9982 | }
|
9983 | } else {
|
9984 | skipChunkCheck = true;
|
9985 | }
|
9986 |
|
9987 | return readableAddChunk(this, chunk, encoding, false, skipChunkCheck);
|
9988 | };
|
9989 |
|
9990 |
|
9991 | Readable.prototype.unshift = function (chunk) {
|
9992 | return readableAddChunk(this, chunk, null, true, false);
|
9993 | };
|
9994 |
|
9995 | function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) {
|
9996 | debug('readableAddChunk', chunk);
|
9997 | var state = stream._readableState;
|
9998 |
|
9999 | if (chunk === null) {
|
10000 | state.reading = false;
|
10001 | onEofChunk(stream, state);
|
10002 | } else {
|
10003 | var er;
|
10004 | if (!skipChunkCheck) er = chunkInvalid(state, chunk);
|
10005 |
|
10006 | if (er) {
|
10007 | errorOrDestroy(stream, er);
|
10008 | } else if (state.objectMode || chunk && chunk.length > 0) {
|
10009 | if (typeof chunk !== 'string' && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer.prototype) {
|
10010 | chunk = _uint8ArrayToBuffer(chunk);
|
10011 | }
|
10012 |
|
10013 | if (addToFront) {
|
10014 | if (state.endEmitted) errorOrDestroy(stream, new ERR_STREAM_UNSHIFT_AFTER_END_EVENT());else addChunk(stream, state, chunk, true);
|
10015 | } else if (state.ended) {
|
10016 | errorOrDestroy(stream, new ERR_STREAM_PUSH_AFTER_EOF());
|
10017 | } else if (state.destroyed) {
|
10018 | return false;
|
10019 | } else {
|
10020 | state.reading = false;
|
10021 |
|
10022 | if (state.decoder && !encoding) {
|
10023 | chunk = state.decoder.write(chunk);
|
10024 | if (state.objectMode || chunk.length !== 0) addChunk(stream, state, chunk, false);else maybeReadMore(stream, state);
|
10025 | } else {
|
10026 | addChunk(stream, state, chunk, false);
|
10027 | }
|
10028 | }
|
10029 | } else if (!addToFront) {
|
10030 | state.reading = false;
|
10031 | maybeReadMore(stream, state);
|
10032 | }
|
10033 | }
|
10034 |
|
10035 |
|
10036 |
|
10037 |
|
10038 | return !state.ended && (state.length < state.highWaterMark || state.length === 0);
|
10039 | }
|
10040 |
|
10041 | function addChunk(stream, state, chunk, addToFront) {
|
10042 | if (state.flowing && state.length === 0 && !state.sync) {
|
10043 | state.awaitDrain = 0;
|
10044 | stream.emit('data', chunk);
|
10045 | } else {
|
10046 |
|
10047 | state.length += state.objectMode ? 1 : chunk.length;
|
10048 | if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk);
|
10049 | if (state.needReadable) emitReadable(stream);
|
10050 | }
|
10051 |
|
10052 | maybeReadMore(stream, state);
|
10053 | }
|
10054 |
|
10055 | function chunkInvalid(state, chunk) {
|
10056 | var er;
|
10057 |
|
10058 | if (!_isUint8Array(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {
|
10059 | er = new ERR_INVALID_ARG_TYPE('chunk', ['string', 'Buffer', 'Uint8Array'], chunk);
|
10060 | }
|
10061 |
|
10062 | return er;
|
10063 | }
|
10064 |
|
10065 | Readable.prototype.isPaused = function () {
|
10066 | return this._readableState.flowing === false;
|
10067 | };
|
10068 |
|
10069 |
|
10070 | Readable.prototype.setEncoding = function (enc) {
|
10071 | if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder;
|
10072 | var decoder = new StringDecoder(enc);
|
10073 | this._readableState.decoder = decoder;
|
10074 |
|
10075 | this._readableState.encoding = this._readableState.decoder.encoding;
|
10076 |
|
10077 | var p = this._readableState.buffer.head;
|
10078 | var content = '';
|
10079 |
|
10080 | while (p !== null) {
|
10081 | content += decoder.write(p.data);
|
10082 | p = p.next;
|
10083 | }
|
10084 |
|
10085 | this._readableState.buffer.clear();
|
10086 |
|
10087 | if (content !== '') this._readableState.buffer.push(content);
|
10088 | this._readableState.length = content.length;
|
10089 | return this;
|
10090 | };
|
10091 |
|
10092 |
|
10093 | var MAX_HWM = 0x40000000;
|
10094 |
|
10095 | function computeNewHighWaterMark(n) {
|
10096 | if (n >= MAX_HWM) {
|
10097 |
|
10098 | n = MAX_HWM;
|
10099 | } else {
|
10100 |
|
10101 |
|
10102 | n--;
|
10103 | n |= n >>> 1;
|
10104 | n |= n >>> 2;
|
10105 | n |= n >>> 4;
|
10106 | n |= n >>> 8;
|
10107 | n |= n >>> 16;
|
10108 | n++;
|
10109 | }
|
10110 |
|
10111 | return n;
|
10112 | }
|
10113 |
|
10114 |
|
10115 |
|
10116 | function howMuchToRead(n, state) {
|
10117 | if (n <= 0 || state.length === 0 && state.ended) return 0;
|
10118 | if (state.objectMode) return 1;
|
10119 |
|
10120 | if (n !== n) {
|
10121 |
|
10122 | if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;
|
10123 | }
|
10124 |
|
10125 |
|
10126 | if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);
|
10127 | if (n <= state.length) return n;
|
10128 |
|
10129 | if (!state.ended) {
|
10130 | state.needReadable = true;
|
10131 | return 0;
|
10132 | }
|
10133 |
|
10134 | return state.length;
|
10135 | }
|
10136 |
|
10137 |
|
10138 | Readable.prototype.read = function (n) {
|
10139 | debug('read', n);
|
10140 | n = parseInt(n, 10);
|
10141 | var state = this._readableState;
|
10142 | var nOrig = n;
|
10143 | if (n !== 0) state.emittedReadable = false;
|
10144 |
|
10145 |
|
10146 |
|
10147 | if (n === 0 && state.needReadable && ((state.highWaterMark !== 0 ? state.length >= state.highWaterMark : state.length > 0) || state.ended)) {
|
10148 | debug('read: emitReadable', state.length, state.ended);
|
10149 | if (state.length === 0 && state.ended) endReadable(this);else emitReadable(this);
|
10150 | return null;
|
10151 | }
|
10152 |
|
10153 | n = howMuchToRead(n, state);
|
10154 |
|
10155 | if (n === 0 && state.ended) {
|
10156 | if (state.length === 0) endReadable(this);
|
10157 | return null;
|
10158 | }
|
10159 |
|
10160 |
|
10161 |
|
10162 |
|
10163 |
|
10164 |
|
10165 |
|
10166 |
|
10167 |
|
10168 |
|
10169 |
|
10170 |
|
10171 |
|
10172 |
|
10173 |
|
10174 |
|
10175 |
|
10176 |
|
10177 |
|
10178 |
|
10179 |
|
10180 |
|
10181 |
|
10182 | var doRead = state.needReadable;
|
10183 | debug('need readable', doRead);
|
10184 |
|
10185 | if (state.length === 0 || state.length - n < state.highWaterMark) {
|
10186 | doRead = true;
|
10187 | debug('length less than watermark', doRead);
|
10188 | }
|
10189 |
|
10190 |
|
10191 |
|
10192 | if (state.ended || state.reading) {
|
10193 | doRead = false;
|
10194 | debug('reading or ended', doRead);
|
10195 | } else if (doRead) {
|
10196 | debug('do read');
|
10197 | state.reading = true;
|
10198 | state.sync = true;
|
10199 |
|
10200 | if (state.length === 0) state.needReadable = true;
|
10201 |
|
10202 | this._read(state.highWaterMark);
|
10203 |
|
10204 | state.sync = false;
|
10205 |
|
10206 |
|
10207 | if (!state.reading) n = howMuchToRead(nOrig, state);
|
10208 | }
|
10209 |
|
10210 | var ret;
|
10211 | if (n > 0) ret = fromList(n, state);else ret = null;
|
10212 |
|
10213 | if (ret === null) {
|
10214 | state.needReadable = state.length <= state.highWaterMark;
|
10215 | n = 0;
|
10216 | } else {
|
10217 | state.length -= n;
|
10218 | state.awaitDrain = 0;
|
10219 | }
|
10220 |
|
10221 | if (state.length === 0) {
|
10222 |
|
10223 |
|
10224 | if (!state.ended) state.needReadable = true;
|
10225 |
|
10226 | if (nOrig !== n && state.ended) endReadable(this);
|
10227 | }
|
10228 |
|
10229 | if (ret !== null) this.emit('data', ret);
|
10230 | return ret;
|
10231 | };
|
10232 |
|
10233 | function onEofChunk(stream, state) {
|
10234 | debug('onEofChunk');
|
10235 | if (state.ended) return;
|
10236 |
|
10237 | if (state.decoder) {
|
10238 | var chunk = state.decoder.end();
|
10239 |
|
10240 | if (chunk && chunk.length) {
|
10241 | state.buffer.push(chunk);
|
10242 | state.length += state.objectMode ? 1 : chunk.length;
|
10243 | }
|
10244 | }
|
10245 |
|
10246 | state.ended = true;
|
10247 |
|
10248 | if (state.sync) {
|
10249 |
|
10250 |
|
10251 |
|
10252 | emitReadable(stream);
|
10253 | } else {
|
10254 |
|
10255 | state.needReadable = false;
|
10256 |
|
10257 | if (!state.emittedReadable) {
|
10258 | state.emittedReadable = true;
|
10259 | emitReadable_(stream);
|
10260 | }
|
10261 | }
|
10262 | }
|
10263 |
|
10264 |
|
10265 |
|
10266 |
|
10267 | function emitReadable(stream) {
|
10268 | var state = stream._readableState;
|
10269 | debug('emitReadable', state.needReadable, state.emittedReadable);
|
10270 | state.needReadable = false;
|
10271 |
|
10272 | if (!state.emittedReadable) {
|
10273 | debug('emitReadable', state.flowing);
|
10274 | state.emittedReadable = true;
|
10275 | process.nextTick(emitReadable_, stream);
|
10276 | }
|
10277 | }
|
10278 |
|
10279 | function emitReadable_(stream) {
|
10280 | var state = stream._readableState;
|
10281 | debug('emitReadable_', state.destroyed, state.length, state.ended);
|
10282 |
|
10283 | if (!state.destroyed && (state.length || state.ended)) {
|
10284 | stream.emit('readable');
|
10285 | state.emittedReadable = false;
|
10286 | }
|
10287 |
|
10288 |
|
10289 |
|
10290 |
|
10291 |
|
10292 |
|
10293 |
|
10294 | state.needReadable = !state.flowing && !state.ended && state.length <= state.highWaterMark;
|
10295 | flow(stream);
|
10296 | }
|
10297 |
|
10298 |
|
10299 |
|
10300 |
|
10301 |
|
10302 |
|
10303 |
|
10304 | function maybeReadMore(stream, state) {
|
10305 | if (!state.readingMore) {
|
10306 | state.readingMore = true;
|
10307 | process.nextTick(maybeReadMore_, stream, state);
|
10308 | }
|
10309 | }
|
10310 |
|
10311 | function maybeReadMore_(stream, state) {
|
10312 |
|
10313 |
|
10314 |
|
10315 |
|
10316 |
|
10317 |
|
10318 |
|
10319 |
|
10320 |
|
10321 |
|
10322 |
|
10323 |
|
10324 |
|
10325 |
|
10326 |
|
10327 |
|
10328 |
|
10329 |
|
10330 |
|
10331 |
|
10332 |
|
10333 |
|
10334 |
|
10335 | while (!state.reading && !state.ended && (state.length < state.highWaterMark || state.flowing && state.length === 0)) {
|
10336 | var len = state.length;
|
10337 | debug('maybeReadMore read 0');
|
10338 | stream.read(0);
|
10339 | if (len === state.length)
|
10340 | break;
|
10341 | }
|
10342 |
|
10343 | state.readingMore = false;
|
10344 | }
|
10345 |
|
10346 |
|
10347 |
|
10348 |
|
10349 |
|
10350 | Readable.prototype._read = function (n) {
|
10351 | errorOrDestroy(this, new ERR_METHOD_NOT_IMPLEMENTED('_read()'));
|
10352 | };
|
10353 |
|
10354 | Readable.prototype.pipe = function (dest, pipeOpts) {
|
10355 | var src = this;
|
10356 | var state = this._readableState;
|
10357 |
|
10358 | switch (state.pipesCount) {
|
10359 | case 0:
|
10360 | state.pipes = dest;
|
10361 | break;
|
10362 |
|
10363 | case 1:
|
10364 | state.pipes = [state.pipes, dest];
|
10365 | break;
|
10366 |
|
10367 | default:
|
10368 | state.pipes.push(dest);
|
10369 | break;
|
10370 | }
|
10371 |
|
10372 | state.pipesCount += 1;
|
10373 | debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts);
|
10374 | var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr;
|
10375 | var endFn = doEnd ? onend : unpipe;
|
10376 | if (state.endEmitted) process.nextTick(endFn);else src.once('end', endFn);
|
10377 | dest.on('unpipe', onunpipe);
|
10378 |
|
10379 | function onunpipe(readable, unpipeInfo) {
|
10380 | debug('onunpipe');
|
10381 |
|
10382 | if (readable === src) {
|
10383 | if (unpipeInfo && unpipeInfo.hasUnpiped === false) {
|
10384 | unpipeInfo.hasUnpiped = true;
|
10385 | cleanup();
|
10386 | }
|
10387 | }
|
10388 | }
|
10389 |
|
10390 | function onend() {
|
10391 | debug('onend');
|
10392 | dest.end();
|
10393 | }
|
10394 |
|
10395 |
|
10396 |
|
10397 |
|
10398 |
|
10399 | var ondrain = pipeOnDrain(src);
|
10400 | dest.on('drain', ondrain);
|
10401 | var cleanedUp = false;
|
10402 |
|
10403 | function cleanup() {
|
10404 | debug('cleanup');
|
10405 |
|
10406 | dest.removeListener('close', onclose);
|
10407 | dest.removeListener('finish', onfinish);
|
10408 | dest.removeListener('drain', ondrain);
|
10409 | dest.removeListener('error', onerror);
|
10410 | dest.removeListener('unpipe', onunpipe);
|
10411 | src.removeListener('end', onend);
|
10412 | src.removeListener('end', unpipe);
|
10413 | src.removeListener('data', ondata);
|
10414 | cleanedUp = true;
|
10415 |
|
10416 |
|
10417 |
|
10418 |
|
10419 |
|
10420 | if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain();
|
10421 | }
|
10422 |
|
10423 | src.on('data', ondata);
|
10424 |
|
10425 | function ondata(chunk) {
|
10426 | debug('ondata');
|
10427 | var ret = dest.write(chunk);
|
10428 | debug('dest.write', ret);
|
10429 |
|
10430 | if (ret === false) {
|
10431 |
|
10432 |
|
10433 |
|
10434 |
|
10435 | if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) {
|
10436 | debug('false write response, pause', state.awaitDrain);
|
10437 | state.awaitDrain++;
|
10438 | }
|
10439 |
|
10440 | src.pause();
|
10441 | }
|
10442 | }
|
10443 |
|
10444 |
|
10445 |
|
10446 | function onerror(er) {
|
10447 | debug('onerror', er);
|
10448 | unpipe();
|
10449 | dest.removeListener('error', onerror);
|
10450 | if (EElistenerCount(dest, 'error') === 0) errorOrDestroy(dest, er);
|
10451 | }
|
10452 |
|
10453 |
|
10454 | prependListener(dest, 'error', onerror);
|
10455 |
|
10456 | function onclose() {
|
10457 | dest.removeListener('finish', onfinish);
|
10458 | unpipe();
|
10459 | }
|
10460 |
|
10461 | dest.once('close', onclose);
|
10462 |
|
10463 | function onfinish() {
|
10464 | debug('onfinish');
|
10465 | dest.removeListener('close', onclose);
|
10466 | unpipe();
|
10467 | }
|
10468 |
|
10469 | dest.once('finish', onfinish);
|
10470 |
|
10471 | function unpipe() {
|
10472 | debug('unpipe');
|
10473 | src.unpipe(dest);
|
10474 | }
|
10475 |
|
10476 |
|
10477 | dest.emit('pipe', src);
|
10478 |
|
10479 | if (!state.flowing) {
|
10480 | debug('pipe resume');
|
10481 | src.resume();
|
10482 | }
|
10483 |
|
10484 | return dest;
|
10485 | };
|
10486 |
|
10487 | function pipeOnDrain(src) {
|
10488 | return function pipeOnDrainFunctionResult() {
|
10489 | var state = src._readableState;
|
10490 | debug('pipeOnDrain', state.awaitDrain);
|
10491 | if (state.awaitDrain) state.awaitDrain--;
|
10492 |
|
10493 | if (state.awaitDrain === 0 && EElistenerCount(src, 'data')) {
|
10494 | state.flowing = true;
|
10495 | flow(src);
|
10496 | }
|
10497 | };
|
10498 | }
|
10499 |
|
10500 | Readable.prototype.unpipe = function (dest) {
|
10501 | var state = this._readableState;
|
10502 | var unpipeInfo = {
|
10503 | hasUnpiped: false
|
10504 | };
|
10505 |
|
10506 | if (state.pipesCount === 0) return this;
|
10507 |
|
10508 | if (state.pipesCount === 1) {
|
10509 |
|
10510 | if (dest && dest !== state.pipes) return this;
|
10511 | if (!dest) dest = state.pipes;
|
10512 |
|
10513 | state.pipes = null;
|
10514 | state.pipesCount = 0;
|
10515 | state.flowing = false;
|
10516 | if (dest) dest.emit('unpipe', this, unpipeInfo);
|
10517 | return this;
|
10518 | }
|
10519 |
|
10520 |
|
10521 | if (!dest) {
|
10522 |
|
10523 | var dests = state.pipes;
|
10524 | var len = state.pipesCount;
|
10525 | state.pipes = null;
|
10526 | state.pipesCount = 0;
|
10527 | state.flowing = false;
|
10528 |
|
10529 | for (var i = 0; i < len; i++) {
|
10530 | dests[i].emit('unpipe', this, {
|
10531 | hasUnpiped: false
|
10532 | });
|
10533 | }
|
10534 |
|
10535 | return this;
|
10536 | }
|
10537 |
|
10538 |
|
10539 | var index = indexOf(state.pipes, dest);
|
10540 | if (index === -1) return this;
|
10541 | state.pipes.splice(index, 1);
|
10542 | state.pipesCount -= 1;
|
10543 | if (state.pipesCount === 1) state.pipes = state.pipes[0];
|
10544 | dest.emit('unpipe', this, unpipeInfo);
|
10545 | return this;
|
10546 | };
|
10547 |
|
10548 |
|
10549 |
|
10550 | Readable.prototype.on = function (ev, fn) {
|
10551 | var res = Stream.prototype.on.call(this, ev, fn);
|
10552 | var state = this._readableState;
|
10553 |
|
10554 | if (ev === 'data') {
|
10555 |
|
10556 |
|
10557 | state.readableListening = this.listenerCount('readable') > 0;
|
10558 |
|
10559 | if (state.flowing !== false) this.resume();
|
10560 | } else if (ev === 'readable') {
|
10561 | if (!state.endEmitted && !state.readableListening) {
|
10562 | state.readableListening = state.needReadable = true;
|
10563 | state.flowing = false;
|
10564 | state.emittedReadable = false;
|
10565 | debug('on readable', state.length, state.reading);
|
10566 |
|
10567 | if (state.length) {
|
10568 | emitReadable(this);
|
10569 | } else if (!state.reading) {
|
10570 | process.nextTick(nReadingNextTick, this);
|
10571 | }
|
10572 | }
|
10573 | }
|
10574 |
|
10575 | return res;
|
10576 | };
|
10577 |
|
10578 | Readable.prototype.addListener = Readable.prototype.on;
|
10579 |
|
10580 | Readable.prototype.removeListener = function (ev, fn) {
|
10581 | var res = Stream.prototype.removeListener.call(this, ev, fn);
|
10582 |
|
10583 | if (ev === 'readable') {
|
10584 |
|
10585 |
|
10586 |
|
10587 |
|
10588 |
|
10589 |
|
10590 | process.nextTick(updateReadableListening, this);
|
10591 | }
|
10592 |
|
10593 | return res;
|
10594 | };
|
10595 |
|
10596 | Readable.prototype.removeAllListeners = function (ev) {
|
10597 | var res = Stream.prototype.removeAllListeners.apply(this, arguments);
|
10598 |
|
10599 | if (ev === 'readable' || ev === undefined) {
|
10600 |
|
10601 |
|
10602 |
|
10603 |
|
10604 |
|
10605 |
|
10606 | process.nextTick(updateReadableListening, this);
|
10607 | }
|
10608 |
|
10609 | return res;
|
10610 | };
|
10611 |
|
10612 | function updateReadableListening(self) {
|
10613 | var state = self._readableState;
|
10614 | state.readableListening = self.listenerCount('readable') > 0;
|
10615 |
|
10616 | if (state.resumeScheduled && !state.paused) {
|
10617 |
|
10618 |
|
10619 | state.flowing = true;
|
10620 | } else if (self.listenerCount('data') > 0) {
|
10621 | self.resume();
|
10622 | }
|
10623 | }
|
10624 |
|
10625 | function nReadingNextTick(self) {
|
10626 | debug('readable nexttick read 0');
|
10627 | self.read(0);
|
10628 | }
|
10629 |
|
10630 |
|
10631 |
|
10632 | Readable.prototype.resume = function () {
|
10633 | var state = this._readableState;
|
10634 |
|
10635 | if (!state.flowing) {
|
10636 | debug('resume');
|
10637 |
|
10638 |
|
10639 |
|
10640 | state.flowing = !state.readableListening;
|
10641 | resume(this, state);
|
10642 | }
|
10643 |
|
10644 | state.paused = false;
|
10645 | return this;
|
10646 | };
|
10647 |
|
10648 | function resume(stream, state) {
|
10649 | if (!state.resumeScheduled) {
|
10650 | state.resumeScheduled = true;
|
10651 | process.nextTick(resume_, stream, state);
|
10652 | }
|
10653 | }
|
10654 |
|
10655 | function resume_(stream, state) {
|
10656 | debug('resume', state.reading);
|
10657 |
|
10658 | if (!state.reading) {
|
10659 | stream.read(0);
|
10660 | }
|
10661 |
|
10662 | state.resumeScheduled = false;
|
10663 | stream.emit('resume');
|
10664 | flow(stream);
|
10665 | if (state.flowing && !state.reading) stream.read(0);
|
10666 | }
|
10667 |
|
10668 | Readable.prototype.pause = function () {
|
10669 | debug('call pause flowing=%j', this._readableState.flowing);
|
10670 |
|
10671 | if (this._readableState.flowing !== false) {
|
10672 | debug('pause');
|
10673 | this._readableState.flowing = false;
|
10674 | this.emit('pause');
|
10675 | }
|
10676 |
|
10677 | this._readableState.paused = true;
|
10678 | return this;
|
10679 | };
|
10680 |
|
10681 | function flow(stream) {
|
10682 | var state = stream._readableState;
|
10683 | debug('flow', state.flowing);
|
10684 |
|
10685 | while (state.flowing && stream.read() !== null) {
|
10686 | ;
|
10687 | }
|
10688 | }
|
10689 |
|
10690 |
|
10691 |
|
10692 |
|
10693 | Readable.prototype.wrap = function (stream) {
|
10694 | var _this = this;
|
10695 |
|
10696 | var state = this._readableState;
|
10697 | var paused = false;
|
10698 | stream.on('end', function () {
|
10699 | debug('wrapped end');
|
10700 |
|
10701 | if (state.decoder && !state.ended) {
|
10702 | var chunk = state.decoder.end();
|
10703 | if (chunk && chunk.length) _this.push(chunk);
|
10704 | }
|
10705 |
|
10706 | _this.push(null);
|
10707 | });
|
10708 | stream.on('data', function (chunk) {
|
10709 | debug('wrapped data');
|
10710 | if (state.decoder) chunk = state.decoder.write(chunk);
|
10711 |
|
10712 | if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return;
|
10713 |
|
10714 | var ret = _this.push(chunk);
|
10715 |
|
10716 | if (!ret) {
|
10717 | paused = true;
|
10718 | stream.pause();
|
10719 | }
|
10720 | });
|
10721 |
|
10722 |
|
10723 | for (var i in stream) {
|
10724 | if (this[i] === undefined && typeof stream[i] === 'function') {
|
10725 | this[i] = function methodWrap(method) {
|
10726 | return function methodWrapReturnFunction() {
|
10727 | return stream[method].apply(stream, arguments);
|
10728 | };
|
10729 | }(i);
|
10730 | }
|
10731 | }
|
10732 |
|
10733 |
|
10734 | for (var n = 0; n < kProxyEvents.length; n++) {
|
10735 | stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n]));
|
10736 | }
|
10737 |
|
10738 |
|
10739 |
|
10740 | this._read = function (n) {
|
10741 | debug('wrapped _read', n);
|
10742 |
|
10743 | if (paused) {
|
10744 | paused = false;
|
10745 | stream.resume();
|
10746 | }
|
10747 | };
|
10748 |
|
10749 | return this;
|
10750 | };
|
10751 |
|
10752 | if (typeof Symbol === 'function') {
|
10753 | Readable.prototype[Symbol.asyncIterator] = function () {
|
10754 | if (createReadableStreamAsyncIterator === undefined) {
|
10755 | createReadableStreamAsyncIterator = require('./internal/streams/async_iterator');
|
10756 | }
|
10757 |
|
10758 | return createReadableStreamAsyncIterator(this);
|
10759 | };
|
10760 | }
|
10761 |
|
10762 | Object.defineProperty(Readable.prototype, 'readableHighWaterMark', {
|
10763 |
|
10764 |
|
10765 |
|
10766 | enumerable: false,
|
10767 | get: function get() {
|
10768 | return this._readableState.highWaterMark;
|
10769 | }
|
10770 | });
|
10771 | Object.defineProperty(Readable.prototype, 'readableBuffer', {
|
10772 |
|
10773 |
|
10774 |
|
10775 | enumerable: false,
|
10776 | get: function get() {
|
10777 | return this._readableState && this._readableState.buffer;
|
10778 | }
|
10779 | });
|
10780 | Object.defineProperty(Readable.prototype, 'readableFlowing', {
|
10781 |
|
10782 |
|
10783 |
|
10784 | enumerable: false,
|
10785 | get: function get() {
|
10786 | return this._readableState.flowing;
|
10787 | },
|
10788 | set: function set(state) {
|
10789 | if (this._readableState) {
|
10790 | this._readableState.flowing = state;
|
10791 | }
|
10792 | }
|
10793 | });
|
10794 |
|
10795 | Readable._fromList = fromList;
|
10796 | Object.defineProperty(Readable.prototype, 'readableLength', {
|
10797 |
|
10798 |
|
10799 |
|
10800 | enumerable: false,
|
10801 | get: function get() {
|
10802 | return this._readableState.length;
|
10803 | }
|
10804 | });
|
10805 |
|
10806 |
|
10807 |
|
10808 |
|
10809 | function fromList(n, state) {
|
10810 |
|
10811 | if (state.length === 0) return null;
|
10812 | var ret;
|
10813 | if (state.objectMode) ret = state.buffer.shift();else if (!n || n >= state.length) {
|
10814 |
|
10815 | if (state.decoder) ret = state.buffer.join('');else if (state.buffer.length === 1) ret = state.buffer.first();else ret = state.buffer.concat(state.length);
|
10816 | state.buffer.clear();
|
10817 | } else {
|
10818 |
|
10819 | ret = state.buffer.consume(n, state.decoder);
|
10820 | }
|
10821 | return ret;
|
10822 | }
|
10823 |
|
10824 | function endReadable(stream) {
|
10825 | var state = stream._readableState;
|
10826 | debug('endReadable', state.endEmitted);
|
10827 |
|
10828 | if (!state.endEmitted) {
|
10829 | state.ended = true;
|
10830 | process.nextTick(endReadableNT, state, stream);
|
10831 | }
|
10832 | }
|
10833 |
|
10834 | function endReadableNT(state, stream) {
|
10835 | debug('endReadableNT', state.endEmitted, state.length);
|
10836 |
|
10837 | if (!state.endEmitted && state.length === 0) {
|
10838 | state.endEmitted = true;
|
10839 | stream.readable = false;
|
10840 | stream.emit('end');
|
10841 |
|
10842 | if (state.autoDestroy) {
|
10843 |
|
10844 |
|
10845 | var wState = stream._writableState;
|
10846 |
|
10847 | if (!wState || wState.autoDestroy && wState.finished) {
|
10848 | stream.destroy();
|
10849 | }
|
10850 | }
|
10851 | }
|
10852 | }
|
10853 |
|
10854 | if (typeof Symbol === 'function') {
|
10855 | Readable.from = function (iterable, opts) {
|
10856 | if (from === undefined) {
|
10857 | from = require('./internal/streams/from');
|
10858 | }
|
10859 |
|
10860 | return from(Readable, iterable, opts);
|
10861 | };
|
10862 | }
|
10863 |
|
10864 | function indexOf(xs, x) {
|
10865 | for (var i = 0, l = xs.length; i < l; i++) {
|
10866 | if (xs[i] === x) return i;
|
10867 | }
|
10868 |
|
10869 | return -1;
|
10870 | }
|
10871 | }).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
10872 | },{"../errors":83,"./_stream_duplex":84,"./internal/streams/async_iterator":89,"./internal/streams/buffer_list":90,"./internal/streams/destroy":91,"./internal/streams/from":93,"./internal/streams/state":95,"./internal/streams/stream":96,"_process":393,"buffer":98,"events":297,"inherits":307,"string_decoder/":341,"util":78}],87:[function(require,module,exports){
|
10873 |
|
10874 |
|
10875 |
|
10876 |
|
10877 |
|
10878 |
|
10879 |
|
10880 |
|
10881 |
|
10882 |
|
10883 |
|
10884 |
|
10885 |
|
10886 |
|
10887 |
|
10888 |
|
10889 |
|
10890 |
|
10891 |
|
10892 |
|
10893 |
|
10894 |
|
10895 |
|
10896 |
|
10897 |
|
10898 |
|
10899 |
|
10900 |
|
10901 |
|
10902 |
|
10903 |
|
10904 |
|
10905 |
|
10906 |
|
10907 |
|
10908 |
|
10909 |
|
10910 |
|
10911 |
|
10912 |
|
10913 |
|
10914 |
|
10915 |
|
10916 |
|
10917 |
|
10918 |
|
10919 |
|
10920 |
|
10921 |
|
10922 |
|
10923 |
|
10924 |
|
10925 |
|
10926 |
|
10927 |
|
10928 |
|
10929 |
|
10930 |
|
10931 |
|
10932 |
|
10933 |
|
10934 | 'use strict';
|
10935 |
|
10936 | module.exports = Transform;
|
10937 |
|
10938 | var _require$codes = require('../errors').codes,
|
10939 | ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED,
|
10940 | ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK,
|
10941 | ERR_TRANSFORM_ALREADY_TRANSFORMING = _require$codes.ERR_TRANSFORM_ALREADY_TRANSFORMING,
|
10942 | ERR_TRANSFORM_WITH_LENGTH_0 = _require$codes.ERR_TRANSFORM_WITH_LENGTH_0;
|
10943 |
|
10944 | var Duplex = require('./_stream_duplex');
|
10945 |
|
10946 | require('inherits')(Transform, Duplex);
|
10947 |
|
10948 | function afterTransform(er, data) {
|
10949 | var ts = this._transformState;
|
10950 | ts.transforming = false;
|
10951 | var cb = ts.writecb;
|
10952 |
|
10953 | if (cb === null) {
|
10954 | return this.emit('error', new ERR_MULTIPLE_CALLBACK());
|
10955 | }
|
10956 |
|
10957 | ts.writechunk = null;
|
10958 | ts.writecb = null;
|
10959 | if (data != null)
|
10960 | this.push(data);
|
10961 | cb(er);
|
10962 | var rs = this._readableState;
|
10963 | rs.reading = false;
|
10964 |
|
10965 | if (rs.needReadable || rs.length < rs.highWaterMark) {
|
10966 | this._read(rs.highWaterMark);
|
10967 | }
|
10968 | }
|
10969 |
|
10970 | function Transform(options) {
|
10971 | if (!(this instanceof Transform)) return new Transform(options);
|
10972 | Duplex.call(this, options);
|
10973 | this._transformState = {
|
10974 | afterTransform: afterTransform.bind(this),
|
10975 | needTransform: false,
|
10976 | transforming: false,
|
10977 | writecb: null,
|
10978 | writechunk: null,
|
10979 | writeencoding: null
|
10980 | };
|
10981 |
|
10982 | this._readableState.needReadable = true;
|
10983 |
|
10984 |
|
10985 |
|
10986 | this._readableState.sync = false;
|
10987 |
|
10988 | if (options) {
|
10989 | if (typeof options.transform === 'function') this._transform = options.transform;
|
10990 | if (typeof options.flush === 'function') this._flush = options.flush;
|
10991 | }
|
10992 |
|
10993 |
|
10994 | this.on('prefinish', prefinish);
|
10995 | }
|
10996 |
|
10997 | function prefinish() {
|
10998 | var _this = this;
|
10999 |
|
11000 | if (typeof this._flush === 'function' && !this._readableState.destroyed) {
|
11001 | this._flush(function (er, data) {
|
11002 | done(_this, er, data);
|
11003 | });
|
11004 | } else {
|
11005 | done(this, null, null);
|
11006 | }
|
11007 | }
|
11008 |
|
11009 | Transform.prototype.push = function (chunk, encoding) {
|
11010 | this._transformState.needTransform = false;
|
11011 | return Duplex.prototype.push.call(this, chunk, encoding);
|
11012 | };
|
11013 |
|
11014 |
|
11015 |
|
11016 |
|
11017 |
|
11018 |
|
11019 |
|
11020 |
|
11021 |
|
11022 |
|
11023 |
|
11024 | Transform.prototype._transform = function (chunk, encoding, cb) {
|
11025 | cb(new ERR_METHOD_NOT_IMPLEMENTED('_transform()'));
|
11026 | };
|
11027 |
|
11028 | Transform.prototype._write = function (chunk, encoding, cb) {
|
11029 | var ts = this._transformState;
|
11030 | ts.writecb = cb;
|
11031 | ts.writechunk = chunk;
|
11032 | ts.writeencoding = encoding;
|
11033 |
|
11034 | if (!ts.transforming) {
|
11035 | var rs = this._readableState;
|
11036 | if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark);
|
11037 | }
|
11038 | };
|
11039 |
|
11040 |
|
11041 |
|
11042 |
|
11043 | Transform.prototype._read = function (n) {
|
11044 | var ts = this._transformState;
|
11045 |
|
11046 | if (ts.writechunk !== null && !ts.transforming) {
|
11047 | ts.transforming = true;
|
11048 |
|
11049 | this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);
|
11050 | } else {
|
11051 |
|
11052 |
|
11053 | ts.needTransform = true;
|
11054 | }
|
11055 | };
|
11056 |
|
11057 | Transform.prototype._destroy = function (err, cb) {
|
11058 | Duplex.prototype._destroy.call(this, err, function (err2) {
|
11059 | cb(err2);
|
11060 | });
|
11061 | };
|
11062 |
|
11063 | function done(stream, er, data) {
|
11064 | if (er) return stream.emit('error', er);
|
11065 | if (data != null)
|
11066 | stream.push(data);
|
11067 |
|
11068 |
|
11069 |
|
11070 | if (stream._writableState.length) throw new ERR_TRANSFORM_WITH_LENGTH_0();
|
11071 | if (stream._transformState.transforming) throw new ERR_TRANSFORM_ALREADY_TRANSFORMING();
|
11072 | return stream.push(null);
|
11073 | }
|
11074 | },{"../errors":83,"./_stream_duplex":84,"inherits":307}],88:[function(require,module,exports){
|
11075 | (function (process,global){
|
11076 |
|
11077 |
|
11078 |
|
11079 |
|
11080 |
|
11081 |
|
11082 |
|
11083 |
|
11084 |
|
11085 |
|
11086 |
|
11087 |
|
11088 |
|
11089 |
|
11090 |
|
11091 |
|
11092 |
|
11093 |
|
11094 |
|
11095 |
|
11096 |
|
11097 |
|
11098 |
|
11099 | 'use strict';
|
11100 |
|
11101 | module.exports = Writable;
|
11102 |
|
11103 |
|
11104 | function WriteReq(chunk, encoding, cb) {
|
11105 | this.chunk = chunk;
|
11106 | this.encoding = encoding;
|
11107 | this.callback = cb;
|
11108 | this.next = null;
|
11109 | }
|
11110 |
|
11111 |
|
11112 |
|
11113 | function CorkedRequest(state) {
|
11114 | var _this = this;
|
11115 |
|
11116 | this.next = null;
|
11117 | this.entry = null;
|
11118 |
|
11119 | this.finish = function () {
|
11120 | onCorkedFinish(_this, state);
|
11121 | };
|
11122 | }
|
11123 |
|
11124 |
|
11125 |
|
11126 |
|
11127 |
|
11128 | var Duplex;
|
11129 |
|
11130 |
|
11131 | Writable.WritableState = WritableState;
|
11132 |
|
11133 |
|
11134 | var internalUtil = {
|
11135 | deprecate: require('util-deprecate')
|
11136 | };
|
11137 |
|
11138 |
|
11139 |
|
11140 |
|
11141 | var Stream = require('./internal/streams/stream');
|
11142 |
|
11143 |
|
11144 |
|
11145 | var Buffer = require('buffer').Buffer;
|
11146 |
|
11147 | var OurUint8Array = global.Uint8Array || function () {};
|
11148 |
|
11149 | function _uint8ArrayToBuffer(chunk) {
|
11150 | return Buffer.from(chunk);
|
11151 | }
|
11152 |
|
11153 | function _isUint8Array(obj) {
|
11154 | return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;
|
11155 | }
|
11156 |
|
11157 | var destroyImpl = require('./internal/streams/destroy');
|
11158 |
|
11159 | var _require = require('./internal/streams/state'),
|
11160 | getHighWaterMark = _require.getHighWaterMark;
|
11161 |
|
11162 | var _require$codes = require('../errors').codes,
|
11163 | ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE,
|
11164 | ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED,
|
11165 | ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK,
|
11166 | ERR_STREAM_CANNOT_PIPE = _require$codes.ERR_STREAM_CANNOT_PIPE,
|
11167 | ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED,
|
11168 | ERR_STREAM_NULL_VALUES = _require$codes.ERR_STREAM_NULL_VALUES,
|
11169 | ERR_STREAM_WRITE_AFTER_END = _require$codes.ERR_STREAM_WRITE_AFTER_END,
|
11170 | ERR_UNKNOWN_ENCODING = _require$codes.ERR_UNKNOWN_ENCODING;
|
11171 |
|
11172 | var errorOrDestroy = destroyImpl.errorOrDestroy;
|
11173 |
|
11174 | require('inherits')(Writable, Stream);
|
11175 |
|
11176 | function nop() {}
|
11177 |
|
11178 | function WritableState(options, stream, isDuplex) {
|
11179 | Duplex = Duplex || require('./_stream_duplex');
|
11180 | options = options || {};
|
11181 |
|
11182 |
|
11183 |
|
11184 |
|
11185 |
|
11186 | if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof Duplex;
|
11187 |
|
11188 |
|
11189 | this.objectMode = !!options.objectMode;
|
11190 | if (isDuplex) this.objectMode = this.objectMode || !!options.writableObjectMode;
|
11191 |
|
11192 |
|
11193 |
|
11194 | this.highWaterMark = getHighWaterMark(this, options, 'writableHighWaterMark', isDuplex);
|
11195 |
|
11196 | this.finalCalled = false;
|
11197 |
|
11198 | this.needDrain = false;
|
11199 |
|
11200 | this.ending = false;
|
11201 |
|
11202 | this.ended = false;
|
11203 |
|
11204 | this.finished = false;
|
11205 |
|
11206 | this.destroyed = false;
|
11207 |
|
11208 |
|
11209 |
|
11210 | var noDecode = options.decodeStrings === false;
|
11211 | this.decodeStrings = !noDecode;
|
11212 |
|
11213 |
|
11214 |
|
11215 | this.defaultEncoding = options.defaultEncoding || 'utf8';
|
11216 |
|
11217 |
|
11218 |
|
11219 | this.length = 0;
|
11220 |
|
11221 | this.writing = false;
|
11222 |
|
11223 | this.corked = 0;
|
11224 |
|
11225 |
|
11226 |
|
11227 |
|
11228 | this.sync = true;
|
11229 |
|
11230 |
|
11231 |
|
11232 | this.bufferProcessing = false;
|
11233 |
|
11234 | this.onwrite = function (er) {
|
11235 | onwrite(stream, er);
|
11236 | };
|
11237 |
|
11238 |
|
11239 | this.writecb = null;
|
11240 |
|
11241 | this.writelen = 0;
|
11242 | this.bufferedRequest = null;
|
11243 | this.lastBufferedRequest = null;
|
11244 |
|
11245 |
|
11246 | this.pendingcb = 0;
|
11247 |
|
11248 |
|
11249 | this.prefinished = false;
|
11250 |
|
11251 | this.errorEmitted = false;
|
11252 |
|
11253 | this.emitClose = options.emitClose !== false;
|
11254 |
|
11255 | this.autoDestroy = !!options.autoDestroy;
|
11256 |
|
11257 | this.bufferedRequestCount = 0;
|
11258 |
|
11259 |
|
11260 | this.corkedRequestsFree = new CorkedRequest(this);
|
11261 | }
|
11262 |
|
11263 | WritableState.prototype.getBuffer = function getBuffer() {
|
11264 | var current = this.bufferedRequest;
|
11265 | var out = [];
|
11266 |
|
11267 | while (current) {
|
11268 | out.push(current);
|
11269 | current = current.next;
|
11270 | }
|
11271 |
|
11272 | return out;
|
11273 | };
|
11274 |
|
11275 | (function () {
|
11276 | try {
|
11277 | Object.defineProperty(WritableState.prototype, 'buffer', {
|
11278 | get: internalUtil.deprecate(function writableStateBufferGetter() {
|
11279 | return this.getBuffer();
|
11280 | }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.', 'DEP0003')
|
11281 | });
|
11282 | } catch (_) {}
|
11283 | })();
|
11284 |
|
11285 |
|
11286 |
|
11287 | var realHasInstance;
|
11288 |
|
11289 | if (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === 'function') {
|
11290 | realHasInstance = Function.prototype[Symbol.hasInstance];
|
11291 | Object.defineProperty(Writable, Symbol.hasInstance, {
|
11292 | value: function value(object) {
|
11293 | if (realHasInstance.call(this, object)) return true;
|
11294 | if (this !== Writable) return false;
|
11295 | return object && object._writableState instanceof WritableState;
|
11296 | }
|
11297 | });
|
11298 | } else {
|
11299 | realHasInstance = function realHasInstance(object) {
|
11300 | return object instanceof this;
|
11301 | };
|
11302 | }
|
11303 |
|
11304 | function Writable(options) {
|
11305 | Duplex = Duplex || require('./_stream_duplex');
|
11306 |
|
11307 |
|
11308 |
|
11309 |
|
11310 |
|
11311 |
|
11312 |
|
11313 |
|
11314 | var isDuplex = this instanceof Duplex;
|
11315 | if (!isDuplex && !realHasInstance.call(Writable, this)) return new Writable(options);
|
11316 | this._writableState = new WritableState(options, this, isDuplex);
|
11317 |
|
11318 | this.writable = true;
|
11319 |
|
11320 | if (options) {
|
11321 | if (typeof options.write === 'function') this._write = options.write;
|
11322 | if (typeof options.writev === 'function') this._writev = options.writev;
|
11323 | if (typeof options.destroy === 'function') this._destroy = options.destroy;
|
11324 | if (typeof options.final === 'function') this._final = options.final;
|
11325 | }
|
11326 |
|
11327 | Stream.call(this);
|
11328 | }
|
11329 |
|
11330 |
|
11331 | Writable.prototype.pipe = function () {
|
11332 | errorOrDestroy(this, new ERR_STREAM_CANNOT_PIPE());
|
11333 | };
|
11334 |
|
11335 | function writeAfterEnd(stream, cb) {
|
11336 | var er = new ERR_STREAM_WRITE_AFTER_END();
|
11337 |
|
11338 | errorOrDestroy(stream, er);
|
11339 | process.nextTick(cb, er);
|
11340 | }
|
11341 |
|
11342 |
|
11343 |
|
11344 |
|
11345 | function validChunk(stream, state, chunk, cb) {
|
11346 | var er;
|
11347 |
|
11348 | if (chunk === null) {
|
11349 | er = new ERR_STREAM_NULL_VALUES();
|
11350 | } else if (typeof chunk !== 'string' && !state.objectMode) {
|
11351 | er = new ERR_INVALID_ARG_TYPE('chunk', ['string', 'Buffer'], chunk);
|
11352 | }
|
11353 |
|
11354 | if (er) {
|
11355 | errorOrDestroy(stream, er);
|
11356 | process.nextTick(cb, er);
|
11357 | return false;
|
11358 | }
|
11359 |
|
11360 | return true;
|
11361 | }
|
11362 |
|
11363 | Writable.prototype.write = function (chunk, encoding, cb) {
|
11364 | var state = this._writableState;
|
11365 | var ret = false;
|
11366 |
|
11367 | var isBuf = !state.objectMode && _isUint8Array(chunk);
|
11368 |
|
11369 | if (isBuf && !Buffer.isBuffer(chunk)) {
|
11370 | chunk = _uint8ArrayToBuffer(chunk);
|
11371 | }
|
11372 |
|
11373 | if (typeof encoding === 'function') {
|
11374 | cb = encoding;
|
11375 | encoding = null;
|
11376 | }
|
11377 |
|
11378 | if (isBuf) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding;
|
11379 | if (typeof cb !== 'function') cb = nop;
|
11380 | if (state.ending) writeAfterEnd(this, cb);else if (isBuf || validChunk(this, state, chunk, cb)) {
|
11381 | state.pendingcb++;
|
11382 | ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb);
|
11383 | }
|
11384 | return ret;
|
11385 | };
|
11386 |
|
11387 | Writable.prototype.cork = function () {
|
11388 | this._writableState.corked++;
|
11389 | };
|
11390 |
|
11391 | Writable.prototype.uncork = function () {
|
11392 | var state = this._writableState;
|
11393 |
|
11394 | if (state.corked) {
|
11395 | state.corked--;
|
11396 | if (!state.writing && !state.corked && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state);
|
11397 | }
|
11398 | };
|
11399 |
|
11400 | Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {
|
11401 |
|
11402 | if (typeof encoding === 'string') encoding = encoding.toLowerCase();
|
11403 | if (!(['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64', 'ucs2', 'ucs-2', 'utf16le', 'utf-16le', 'raw'].indexOf((encoding + '').toLowerCase()) > -1)) throw new ERR_UNKNOWN_ENCODING(encoding);
|
11404 | this._writableState.defaultEncoding = encoding;
|
11405 | return this;
|
11406 | };
|
11407 |
|
11408 | Object.defineProperty(Writable.prototype, 'writableBuffer', {
|
11409 |
|
11410 |
|
11411 |
|
11412 | enumerable: false,
|
11413 | get: function get() {
|
11414 | return this._writableState && this._writableState.getBuffer();
|
11415 | }
|
11416 | });
|
11417 |
|
11418 | function decodeChunk(state, chunk, encoding) {
|
11419 | if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') {
|
11420 | chunk = Buffer.from(chunk, encoding);
|
11421 | }
|
11422 |
|
11423 | return chunk;
|
11424 | }
|
11425 |
|
11426 | Object.defineProperty(Writable.prototype, 'writableHighWaterMark', {
|
11427 |
|
11428 |
|
11429 |
|
11430 | enumerable: false,
|
11431 | get: function get() {
|
11432 | return this._writableState.highWaterMark;
|
11433 | }
|
11434 | });
|
11435 |
|
11436 |
|
11437 |
|
11438 | function writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) {
|
11439 | if (!isBuf) {
|
11440 | var newChunk = decodeChunk(state, chunk, encoding);
|
11441 |
|
11442 | if (chunk !== newChunk) {
|
11443 | isBuf = true;
|
11444 | encoding = 'buffer';
|
11445 | chunk = newChunk;
|
11446 | }
|
11447 | }
|
11448 |
|
11449 | var len = state.objectMode ? 1 : chunk.length;
|
11450 | state.length += len;
|
11451 | var ret = state.length < state.highWaterMark;
|
11452 |
|
11453 | if (!ret) state.needDrain = true;
|
11454 |
|
11455 | if (state.writing || state.corked) {
|
11456 | var last = state.lastBufferedRequest;
|
11457 | state.lastBufferedRequest = {
|
11458 | chunk: chunk,
|
11459 | encoding: encoding,
|
11460 | isBuf: isBuf,
|
11461 | callback: cb,
|
11462 | next: null
|
11463 | };
|
11464 |
|
11465 | if (last) {
|
11466 | last.next = state.lastBufferedRequest;
|
11467 | } else {
|
11468 | state.bufferedRequest = state.lastBufferedRequest;
|
11469 | }
|
11470 |
|
11471 | state.bufferedRequestCount += 1;
|
11472 | } else {
|
11473 | doWrite(stream, state, false, len, chunk, encoding, cb);
|
11474 | }
|
11475 |
|
11476 | return ret;
|
11477 | }
|
11478 |
|
11479 | function doWrite(stream, state, writev, len, chunk, encoding, cb) {
|
11480 | state.writelen = len;
|
11481 | state.writecb = cb;
|
11482 | state.writing = true;
|
11483 | state.sync = true;
|
11484 | if (state.destroyed) state.onwrite(new ERR_STREAM_DESTROYED('write'));else if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite);
|
11485 | state.sync = false;
|
11486 | }
|
11487 |
|
11488 | function onwriteError(stream, state, sync, er, cb) {
|
11489 | --state.pendingcb;
|
11490 |
|
11491 | if (sync) {
|
11492 |
|
11493 |
|
11494 | process.nextTick(cb, er);
|
11495 |
|
11496 |
|
11497 | process.nextTick(finishMaybe, stream, state);
|
11498 | stream._writableState.errorEmitted = true;
|
11499 | errorOrDestroy(stream, er);
|
11500 | } else {
|
11501 |
|
11502 |
|
11503 | cb(er);
|
11504 | stream._writableState.errorEmitted = true;
|
11505 | errorOrDestroy(stream, er);
|
11506 |
|
11507 |
|
11508 | finishMaybe(stream, state);
|
11509 | }
|
11510 | }
|
11511 |
|
11512 | function onwriteStateUpdate(state) {
|
11513 | state.writing = false;
|
11514 | state.writecb = null;
|
11515 | state.length -= state.writelen;
|
11516 | state.writelen = 0;
|
11517 | }
|
11518 |
|
11519 | function onwrite(stream, er) {
|
11520 | var state = stream._writableState;
|
11521 | var sync = state.sync;
|
11522 | var cb = state.writecb;
|
11523 | if (typeof cb !== 'function') throw new ERR_MULTIPLE_CALLBACK();
|
11524 | onwriteStateUpdate(state);
|
11525 | if (er) onwriteError(stream, state, sync, er, cb);else {
|
11526 |
|
11527 | var finished = needFinish(state) || stream.destroyed;
|
11528 |
|
11529 | if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) {
|
11530 | clearBuffer(stream, state);
|
11531 | }
|
11532 |
|
11533 | if (sync) {
|
11534 | process.nextTick(afterWrite, stream, state, finished, cb);
|
11535 | } else {
|
11536 | afterWrite(stream, state, finished, cb);
|
11537 | }
|
11538 | }
|
11539 | }
|
11540 |
|
11541 | function afterWrite(stream, state, finished, cb) {
|
11542 | if (!finished) onwriteDrain(stream, state);
|
11543 | state.pendingcb--;
|
11544 | cb();
|
11545 | finishMaybe(stream, state);
|
11546 | }
|
11547 |
|
11548 |
|
11549 |
|
11550 |
|
11551 | function onwriteDrain(stream, state) {
|
11552 | if (state.length === 0 && state.needDrain) {
|
11553 | state.needDrain = false;
|
11554 | stream.emit('drain');
|
11555 | }
|
11556 | }
|
11557 |
|
11558 |
|
11559 | function clearBuffer(stream, state) {
|
11560 | state.bufferProcessing = true;
|
11561 | var entry = state.bufferedRequest;
|
11562 |
|
11563 | if (stream._writev && entry && entry.next) {
|
11564 |
|
11565 | var l = state.bufferedRequestCount;
|
11566 | var buffer = new Array(l);
|
11567 | var holder = state.corkedRequestsFree;
|
11568 | holder.entry = entry;
|
11569 | var count = 0;
|
11570 | var allBuffers = true;
|
11571 |
|
11572 | while (entry) {
|
11573 | buffer[count] = entry;
|
11574 | if (!entry.isBuf) allBuffers = false;
|
11575 | entry = entry.next;
|
11576 | count += 1;
|
11577 | }
|
11578 |
|
11579 | buffer.allBuffers = allBuffers;
|
11580 | doWrite(stream, state, true, state.length, buffer, '', holder.finish);
|
11581 |
|
11582 |
|
11583 | state.pendingcb++;
|
11584 | state.lastBufferedRequest = null;
|
11585 |
|
11586 | if (holder.next) {
|
11587 | state.corkedRequestsFree = holder.next;
|
11588 | holder.next = null;
|
11589 | } else {
|
11590 | state.corkedRequestsFree = new CorkedRequest(state);
|
11591 | }
|
11592 |
|
11593 | state.bufferedRequestCount = 0;
|
11594 | } else {
|
11595 |
|
11596 | while (entry) {
|
11597 | var chunk = entry.chunk;
|
11598 | var encoding = entry.encoding;
|
11599 | var cb = entry.callback;
|
11600 | var len = state.objectMode ? 1 : chunk.length;
|
11601 | doWrite(stream, state, false, len, chunk, encoding, cb);
|
11602 | entry = entry.next;
|
11603 | state.bufferedRequestCount--;
|
11604 |
|
11605 |
|
11606 |
|
11607 |
|
11608 | if (state.writing) {
|
11609 | break;
|
11610 | }
|
11611 | }
|
11612 |
|
11613 | if (entry === null) state.lastBufferedRequest = null;
|
11614 | }
|
11615 |
|
11616 | state.bufferedRequest = entry;
|
11617 | state.bufferProcessing = false;
|
11618 | }
|
11619 |
|
11620 | Writable.prototype._write = function (chunk, encoding, cb) {
|
11621 | cb(new ERR_METHOD_NOT_IMPLEMENTED('_write()'));
|
11622 | };
|
11623 |
|
11624 | Writable.prototype._writev = null;
|
11625 |
|
11626 | Writable.prototype.end = function (chunk, encoding, cb) {
|
11627 | var state = this._writableState;
|
11628 |
|
11629 | if (typeof chunk === 'function') {
|
11630 | cb = chunk;
|
11631 | chunk = null;
|
11632 | encoding = null;
|
11633 | } else if (typeof encoding === 'function') {
|
11634 | cb = encoding;
|
11635 | encoding = null;
|
11636 | }
|
11637 |
|
11638 | if (chunk !== null && chunk !== undefined) this.write(chunk, encoding);
|
11639 |
|
11640 | if (state.corked) {
|
11641 | state.corked = 1;
|
11642 | this.uncork();
|
11643 | }
|
11644 |
|
11645 |
|
11646 | if (!state.ending) endWritable(this, state, cb);
|
11647 | return this;
|
11648 | };
|
11649 |
|
11650 | Object.defineProperty(Writable.prototype, 'writableLength', {
|
11651 |
|
11652 |
|
11653 |
|
11654 | enumerable: false,
|
11655 | get: function get() {
|
11656 | return this._writableState.length;
|
11657 | }
|
11658 | });
|
11659 |
|
11660 | function needFinish(state) {
|
11661 | return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing;
|
11662 | }
|
11663 |
|
11664 | function callFinal(stream, state) {
|
11665 | stream._final(function (err) {
|
11666 | state.pendingcb--;
|
11667 |
|
11668 | if (err) {
|
11669 | errorOrDestroy(stream, err);
|
11670 | }
|
11671 |
|
11672 | state.prefinished = true;
|
11673 | stream.emit('prefinish');
|
11674 | finishMaybe(stream, state);
|
11675 | });
|
11676 | }
|
11677 |
|
11678 | function prefinish(stream, state) {
|
11679 | if (!state.prefinished && !state.finalCalled) {
|
11680 | if (typeof stream._final === 'function' && !state.destroyed) {
|
11681 | state.pendingcb++;
|
11682 | state.finalCalled = true;
|
11683 | process.nextTick(callFinal, stream, state);
|
11684 | } else {
|
11685 | state.prefinished = true;
|
11686 | stream.emit('prefinish');
|
11687 | }
|
11688 | }
|
11689 | }
|
11690 |
|
11691 | function finishMaybe(stream, state) {
|
11692 | var need = needFinish(state);
|
11693 |
|
11694 | if (need) {
|
11695 | prefinish(stream, state);
|
11696 |
|
11697 | if (state.pendingcb === 0) {
|
11698 | state.finished = true;
|
11699 | stream.emit('finish');
|
11700 |
|
11701 | if (state.autoDestroy) {
|
11702 |
|
11703 |
|
11704 | var rState = stream._readableState;
|
11705 |
|
11706 | if (!rState || rState.autoDestroy && rState.endEmitted) {
|
11707 | stream.destroy();
|
11708 | }
|
11709 | }
|
11710 | }
|
11711 | }
|
11712 |
|
11713 | return need;
|
11714 | }
|
11715 |
|
11716 | function endWritable(stream, state, cb) {
|
11717 | state.ending = true;
|
11718 | finishMaybe(stream, state);
|
11719 |
|
11720 | if (cb) {
|
11721 | if (state.finished) process.nextTick(cb);else stream.once('finish', cb);
|
11722 | }
|
11723 |
|
11724 | state.ended = true;
|
11725 | stream.writable = false;
|
11726 | }
|
11727 |
|
11728 | function onCorkedFinish(corkReq, state, err) {
|
11729 | var entry = corkReq.entry;
|
11730 | corkReq.entry = null;
|
11731 |
|
11732 | while (entry) {
|
11733 | var cb = entry.callback;
|
11734 | state.pendingcb--;
|
11735 | cb(err);
|
11736 | entry = entry.next;
|
11737 | }
|
11738 |
|
11739 |
|
11740 | state.corkedRequestsFree.next = corkReq;
|
11741 | }
|
11742 |
|
11743 | Object.defineProperty(Writable.prototype, 'destroyed', {
|
11744 |
|
11745 |
|
11746 |
|
11747 | enumerable: false,
|
11748 | get: function get() {
|
11749 | if (this._writableState === undefined) {
|
11750 | return false;
|
11751 | }
|
11752 |
|
11753 | return this._writableState.destroyed;
|
11754 | },
|
11755 | set: function set(value) {
|
11756 |
|
11757 |
|
11758 | if (!this._writableState) {
|
11759 | return;
|
11760 | }
|
11761 |
|
11762 |
|
11763 |
|
11764 | this._writableState.destroyed = value;
|
11765 | }
|
11766 | });
|
11767 | Writable.prototype.destroy = destroyImpl.destroy;
|
11768 | Writable.prototype._undestroy = destroyImpl.undestroy;
|
11769 |
|
11770 | Writable.prototype._destroy = function (err, cb) {
|
11771 | cb(err);
|
11772 | };
|
11773 | }).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
11774 | },{"../errors":83,"./_stream_duplex":84,"./internal/streams/destroy":91,"./internal/streams/state":95,"./internal/streams/stream":96,"_process":393,"buffer":98,"inherits":307,"util-deprecate":343}],89:[function(require,module,exports){
|
11775 | (function (process){
|
11776 | 'use strict';
|
11777 |
|
11778 | var _Object$setPrototypeO;
|
11779 |
|
11780 | function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
11781 |
|
11782 | var finished = require('./end-of-stream');
|
11783 |
|
11784 | var kLastResolve = Symbol('lastResolve');
|
11785 | var kLastReject = Symbol('lastReject');
|
11786 | var kError = Symbol('error');
|
11787 | var kEnded = Symbol('ended');
|
11788 | var kLastPromise = Symbol('lastPromise');
|
11789 | var kHandlePromise = Symbol('handlePromise');
|
11790 | var kStream = Symbol('stream');
|
11791 |
|
11792 | function createIterResult(value, done) {
|
11793 | return {
|
11794 | value: value,
|
11795 | done: done
|
11796 | };
|
11797 | }
|
11798 |
|
11799 | function readAndResolve(iter) {
|
11800 | var resolve = iter[kLastResolve];
|
11801 |
|
11802 | if (resolve !== null) {
|
11803 | var data = iter[kStream].read();
|
11804 |
|
11805 |
|
11806 |
|
11807 | if (data !== null) {
|
11808 | iter[kLastPromise] = null;
|
11809 | iter[kLastResolve] = null;
|
11810 | iter[kLastReject] = null;
|
11811 | resolve(createIterResult(data, false));
|
11812 | }
|
11813 | }
|
11814 | }
|
11815 |
|
11816 | function onReadable(iter) {
|
11817 |
|
11818 |
|
11819 | process.nextTick(readAndResolve, iter);
|
11820 | }
|
11821 |
|
11822 | function wrapForNext(lastPromise, iter) {
|
11823 | return function (resolve, reject) {
|
11824 | lastPromise.then(function () {
|
11825 | if (iter[kEnded]) {
|
11826 | resolve(createIterResult(undefined, true));
|
11827 | return;
|
11828 | }
|
11829 |
|
11830 | iter[kHandlePromise](resolve, reject);
|
11831 | }, reject);
|
11832 | };
|
11833 | }
|
11834 |
|
11835 | var AsyncIteratorPrototype = Object.getPrototypeOf(function () {});
|
11836 | var ReadableStreamAsyncIteratorPrototype = Object.setPrototypeOf((_Object$setPrototypeO = {
|
11837 | get stream() {
|
11838 | return this[kStream];
|
11839 | },
|
11840 |
|
11841 | next: function next() {
|
11842 | var _this = this;
|
11843 |
|
11844 |
|
11845 |
|
11846 | var error = this[kError];
|
11847 |
|
11848 | if (error !== null) {
|
11849 | return Promise.reject(error);
|
11850 | }
|
11851 |
|
11852 | if (this[kEnded]) {
|
11853 | return Promise.resolve(createIterResult(undefined, true));
|
11854 | }
|
11855 |
|
11856 | if (this[kStream].destroyed) {
|
11857 |
|
11858 |
|
11859 |
|
11860 |
|
11861 | return new Promise(function (resolve, reject) {
|
11862 | process.nextTick(function () {
|
11863 | if (_this[kError]) {
|
11864 | reject(_this[kError]);
|
11865 | } else {
|
11866 | resolve(createIterResult(undefined, true));
|
11867 | }
|
11868 | });
|
11869 | });
|
11870 | }
|
11871 |
|
11872 |
|
11873 |
|
11874 |
|
11875 |
|
11876 | var lastPromise = this[kLastPromise];
|
11877 | var promise;
|
11878 |
|
11879 | if (lastPromise) {
|
11880 | promise = new Promise(wrapForNext(lastPromise, this));
|
11881 | } else {
|
11882 |
|
11883 |
|
11884 | var data = this[kStream].read();
|
11885 |
|
11886 | if (data !== null) {
|
11887 | return Promise.resolve(createIterResult(data, false));
|
11888 | }
|
11889 |
|
11890 | promise = new Promise(this[kHandlePromise]);
|
11891 | }
|
11892 |
|
11893 | this[kLastPromise] = promise;
|
11894 | return promise;
|
11895 | }
|
11896 | }, _defineProperty(_Object$setPrototypeO, Symbol.asyncIterator, function () {
|
11897 | return this;
|
11898 | }), _defineProperty(_Object$setPrototypeO, "return", function _return() {
|
11899 | var _this2 = this;
|
11900 |
|
11901 |
|
11902 |
|
11903 |
|
11904 | return new Promise(function (resolve, reject) {
|
11905 | _this2[kStream].destroy(null, function (err) {
|
11906 | if (err) {
|
11907 | reject(err);
|
11908 | return;
|
11909 | }
|
11910 |
|
11911 | resolve(createIterResult(undefined, true));
|
11912 | });
|
11913 | });
|
11914 | }), _Object$setPrototypeO), AsyncIteratorPrototype);
|
11915 |
|
11916 | var createReadableStreamAsyncIterator = function createReadableStreamAsyncIterator(stream) {
|
11917 | var _Object$create;
|
11918 |
|
11919 | var iterator = Object.create(ReadableStreamAsyncIteratorPrototype, (_Object$create = {}, _defineProperty(_Object$create, kStream, {
|
11920 | value: stream,
|
11921 | writable: true
|
11922 | }), _defineProperty(_Object$create, kLastResolve, {
|
11923 | value: null,
|
11924 | writable: true
|
11925 | }), _defineProperty(_Object$create, kLastReject, {
|
11926 | value: null,
|
11927 | writable: true
|
11928 | }), _defineProperty(_Object$create, kError, {
|
11929 | value: null,
|
11930 | writable: true
|
11931 | }), _defineProperty(_Object$create, kEnded, {
|
11932 | value: stream._readableState.endEmitted,
|
11933 | writable: true
|
11934 | }), _defineProperty(_Object$create, kHandlePromise, {
|
11935 | value: function value(resolve, reject) {
|
11936 | var data = iterator[kStream].read();
|
11937 |
|
11938 | if (data) {
|
11939 | iterator[kLastPromise] = null;
|
11940 | iterator[kLastResolve] = null;
|
11941 | iterator[kLastReject] = null;
|
11942 | resolve(createIterResult(data, false));
|
11943 | } else {
|
11944 | iterator[kLastResolve] = resolve;
|
11945 | iterator[kLastReject] = reject;
|
11946 | }
|
11947 | },
|
11948 | writable: true
|
11949 | }), _Object$create));
|
11950 | iterator[kLastPromise] = null;
|
11951 | finished(stream, function (err) {
|
11952 | if (err && err.code !== 'ERR_STREAM_PREMATURE_CLOSE') {
|
11953 | var reject = iterator[kLastReject];
|
11954 |
|
11955 |
|
11956 | if (reject !== null) {
|
11957 | iterator[kLastPromise] = null;
|
11958 | iterator[kLastResolve] = null;
|
11959 | iterator[kLastReject] = null;
|
11960 | reject(err);
|
11961 | }
|
11962 |
|
11963 | iterator[kError] = err;
|
11964 | return;
|
11965 | }
|
11966 |
|
11967 | var resolve = iterator[kLastResolve];
|
11968 |
|
11969 | if (resolve !== null) {
|
11970 | iterator[kLastPromise] = null;
|
11971 | iterator[kLastResolve] = null;
|
11972 | iterator[kLastReject] = null;
|
11973 | resolve(createIterResult(undefined, true));
|
11974 | }
|
11975 |
|
11976 | iterator[kEnded] = true;
|
11977 | });
|
11978 | stream.on('readable', onReadable.bind(null, iterator));
|
11979 | return iterator;
|
11980 | };
|
11981 |
|
11982 | module.exports = createReadableStreamAsyncIterator;
|
11983 | }).call(this,require('_process'))
|
11984 | },{"./end-of-stream":92,"_process":393}],90:[function(require,module,exports){
|
11985 | 'use strict';
|
11986 |
|
11987 | function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
11988 |
|
11989 | function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
11990 |
|
11991 | function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
11992 |
|
11993 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
11994 |
|
11995 | function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
11996 |
|
11997 | function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
11998 |
|
11999 | var _require = require('buffer'),
|
12000 | Buffer = _require.Buffer;
|
12001 |
|
12002 | var _require2 = require('util'),
|
12003 | inspect = _require2.inspect;
|
12004 |
|
12005 | var custom = inspect && inspect.custom || 'inspect';
|
12006 |
|
12007 | function copyBuffer(src, target, offset) {
|
12008 | Buffer.prototype.copy.call(src, target, offset);
|
12009 | }
|
12010 |
|
12011 | module.exports =
|
12012 |
|
12013 | function () {
|
12014 | function BufferList() {
|
12015 | _classCallCheck(this, BufferList);
|
12016 |
|
12017 | this.head = null;
|
12018 | this.tail = null;
|
12019 | this.length = 0;
|
12020 | }
|
12021 |
|
12022 | _createClass(BufferList, [{
|
12023 | key: "push",
|
12024 | value: function push(v) {
|
12025 | var entry = {
|
12026 | data: v,
|
12027 | next: null
|
12028 | };
|
12029 | if (this.length > 0) this.tail.next = entry;else this.head = entry;
|
12030 | this.tail = entry;
|
12031 | ++this.length;
|
12032 | }
|
12033 | }, {
|
12034 | key: "unshift",
|
12035 | value: function unshift(v) {
|
12036 | var entry = {
|
12037 | data: v,
|
12038 | next: this.head
|
12039 | };
|
12040 | if (this.length === 0) this.tail = entry;
|
12041 | this.head = entry;
|
12042 | ++this.length;
|
12043 | }
|
12044 | }, {
|
12045 | key: "shift",
|
12046 | value: function shift() {
|
12047 | if (this.length === 0) return;
|
12048 | var ret = this.head.data;
|
12049 | if (this.length === 1) this.head = this.tail = null;else this.head = this.head.next;
|
12050 | --this.length;
|
12051 | return ret;
|
12052 | }
|
12053 | }, {
|
12054 | key: "clear",
|
12055 | value: function clear() {
|
12056 | this.head = this.tail = null;
|
12057 | this.length = 0;
|
12058 | }
|
12059 | }, {
|
12060 | key: "join",
|
12061 | value: function join(s) {
|
12062 | if (this.length === 0) return '';
|
12063 | var p = this.head;
|
12064 | var ret = '' + p.data;
|
12065 |
|
12066 | while (p = p.next) {
|
12067 | ret += s + p.data;
|
12068 | }
|
12069 |
|
12070 | return ret;
|
12071 | }
|
12072 | }, {
|
12073 | key: "concat",
|
12074 | value: function concat(n) {
|
12075 | if (this.length === 0) return Buffer.alloc(0);
|
12076 | var ret = Buffer.allocUnsafe(n >>> 0);
|
12077 | var p = this.head;
|
12078 | var i = 0;
|
12079 |
|
12080 | while (p) {
|
12081 | copyBuffer(p.data, ret, i);
|
12082 | i += p.data.length;
|
12083 | p = p.next;
|
12084 | }
|
12085 |
|
12086 | return ret;
|
12087 | }
|
12088 |
|
12089 | }, {
|
12090 | key: "consume",
|
12091 | value: function consume(n, hasStrings) {
|
12092 | var ret;
|
12093 |
|
12094 | if (n < this.head.data.length) {
|
12095 |
|
12096 | ret = this.head.data.slice(0, n);
|
12097 | this.head.data = this.head.data.slice(n);
|
12098 | } else if (n === this.head.data.length) {
|
12099 |
|
12100 | ret = this.shift();
|
12101 | } else {
|
12102 |
|
12103 | ret = hasStrings ? this._getString(n) : this._getBuffer(n);
|
12104 | }
|
12105 |
|
12106 | return ret;
|
12107 | }
|
12108 | }, {
|
12109 | key: "first",
|
12110 | value: function first() {
|
12111 | return this.head.data;
|
12112 | }
|
12113 |
|
12114 | }, {
|
12115 | key: "_getString",
|
12116 | value: function _getString(n) {
|
12117 | var p = this.head;
|
12118 | var c = 1;
|
12119 | var ret = p.data;
|
12120 | n -= ret.length;
|
12121 |
|
12122 | while (p = p.next) {
|
12123 | var str = p.data;
|
12124 | var nb = n > str.length ? str.length : n;
|
12125 | if (nb === str.length) ret += str;else ret += str.slice(0, n);
|
12126 | n -= nb;
|
12127 |
|
12128 | if (n === 0) {
|
12129 | if (nb === str.length) {
|
12130 | ++c;
|
12131 | if (p.next) this.head = p.next;else this.head = this.tail = null;
|
12132 | } else {
|
12133 | this.head = p;
|
12134 | p.data = str.slice(nb);
|
12135 | }
|
12136 |
|
12137 | break;
|
12138 | }
|
12139 |
|
12140 | ++c;
|
12141 | }
|
12142 |
|
12143 | this.length -= c;
|
12144 | return ret;
|
12145 | }
|
12146 |
|
12147 | }, {
|
12148 | key: "_getBuffer",
|
12149 | value: function _getBuffer(n) {
|
12150 | var ret = Buffer.allocUnsafe(n);
|
12151 | var p = this.head;
|
12152 | var c = 1;
|
12153 | p.data.copy(ret);
|
12154 | n -= p.data.length;
|
12155 |
|
12156 | while (p = p.next) {
|
12157 | var buf = p.data;
|
12158 | var nb = n > buf.length ? buf.length : n;
|
12159 | buf.copy(ret, ret.length - n, 0, nb);
|
12160 | n -= nb;
|
12161 |
|
12162 | if (n === 0) {
|
12163 | if (nb === buf.length) {
|
12164 | ++c;
|
12165 | if (p.next) this.head = p.next;else this.head = this.tail = null;
|
12166 | } else {
|
12167 | this.head = p;
|
12168 | p.data = buf.slice(nb);
|
12169 | }
|
12170 |
|
12171 | break;
|
12172 | }
|
12173 |
|
12174 | ++c;
|
12175 | }
|
12176 |
|
12177 | this.length -= c;
|
12178 | return ret;
|
12179 | }
|
12180 |
|
12181 | }, {
|
12182 | key: custom,
|
12183 | value: function value(_, options) {
|
12184 | return inspect(this, _objectSpread({}, options, {
|
12185 |
|
12186 | depth: 0,
|
12187 |
|
12188 | customInspect: false
|
12189 | }));
|
12190 | }
|
12191 | }]);
|
12192 |
|
12193 | return BufferList;
|
12194 | }();
|
12195 | },{"buffer":98,"util":78}],91:[function(require,module,exports){
|
12196 | (function (process){
|
12197 | 'use strict';
|
12198 |
|
12199 | function destroy(err, cb) {
|
12200 | var _this = this;
|
12201 |
|
12202 | var readableDestroyed = this._readableState && this._readableState.destroyed;
|
12203 | var writableDestroyed = this._writableState && this._writableState.destroyed;
|
12204 |
|
12205 | if (readableDestroyed || writableDestroyed) {
|
12206 | if (cb) {
|
12207 | cb(err);
|
12208 | } else if (err) {
|
12209 | if (!this._writableState) {
|
12210 | process.nextTick(emitErrorNT, this, err);
|
12211 | } else if (!this._writableState.errorEmitted) {
|
12212 | this._writableState.errorEmitted = true;
|
12213 | process.nextTick(emitErrorNT, this, err);
|
12214 | }
|
12215 | }
|
12216 |
|
12217 | return this;
|
12218 | }
|
12219 |
|
12220 |
|
12221 |
|
12222 | if (this._readableState) {
|
12223 | this._readableState.destroyed = true;
|
12224 | }
|
12225 |
|
12226 |
|
12227 | if (this._writableState) {
|
12228 | this._writableState.destroyed = true;
|
12229 | }
|
12230 |
|
12231 | this._destroy(err || null, function (err) {
|
12232 | if (!cb && err) {
|
12233 | if (!_this._writableState) {
|
12234 | process.nextTick(emitErrorAndCloseNT, _this, err);
|
12235 | } else if (!_this._writableState.errorEmitted) {
|
12236 | _this._writableState.errorEmitted = true;
|
12237 | process.nextTick(emitErrorAndCloseNT, _this, err);
|
12238 | } else {
|
12239 | process.nextTick(emitCloseNT, _this);
|
12240 | }
|
12241 | } else if (cb) {
|
12242 | process.nextTick(emitCloseNT, _this);
|
12243 | cb(err);
|
12244 | } else {
|
12245 | process.nextTick(emitCloseNT, _this);
|
12246 | }
|
12247 | });
|
12248 |
|
12249 | return this;
|
12250 | }
|
12251 |
|
12252 | function emitErrorAndCloseNT(self, err) {
|
12253 | emitErrorNT(self, err);
|
12254 | emitCloseNT(self);
|
12255 | }
|
12256 |
|
12257 | function emitCloseNT(self) {
|
12258 | if (self._writableState && !self._writableState.emitClose) return;
|
12259 | if (self._readableState && !self._readableState.emitClose) return;
|
12260 | self.emit('close');
|
12261 | }
|
12262 |
|
12263 | function undestroy() {
|
12264 | if (this._readableState) {
|
12265 | this._readableState.destroyed = false;
|
12266 | this._readableState.reading = false;
|
12267 | this._readableState.ended = false;
|
12268 | this._readableState.endEmitted = false;
|
12269 | }
|
12270 |
|
12271 | if (this._writableState) {
|
12272 | this._writableState.destroyed = false;
|
12273 | this._writableState.ended = false;
|
12274 | this._writableState.ending = false;
|
12275 | this._writableState.finalCalled = false;
|
12276 | this._writableState.prefinished = false;
|
12277 | this._writableState.finished = false;
|
12278 | this._writableState.errorEmitted = false;
|
12279 | }
|
12280 | }
|
12281 |
|
12282 | function emitErrorNT(self, err) {
|
12283 | self.emit('error', err);
|
12284 | }
|
12285 |
|
12286 | function errorOrDestroy(stream, err) {
|
12287 |
|
12288 |
|
12289 |
|
12290 |
|
12291 |
|
12292 | var rState = stream._readableState;
|
12293 | var wState = stream._writableState;
|
12294 | if (rState && rState.autoDestroy || wState && wState.autoDestroy) stream.destroy(err);else stream.emit('error', err);
|
12295 | }
|
12296 |
|
12297 | module.exports = {
|
12298 | destroy: destroy,
|
12299 | undestroy: undestroy,
|
12300 | errorOrDestroy: errorOrDestroy
|
12301 | };
|
12302 | }).call(this,require('_process'))
|
12303 | },{"_process":393}],92:[function(require,module,exports){
|
12304 |
|
12305 |
|
12306 | 'use strict';
|
12307 |
|
12308 | var ERR_STREAM_PREMATURE_CLOSE = require('../../../errors').codes.ERR_STREAM_PREMATURE_CLOSE;
|
12309 |
|
12310 | function once(callback) {
|
12311 | var called = false;
|
12312 | return function () {
|
12313 | if (called) return;
|
12314 | called = true;
|
12315 |
|
12316 | for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
12317 | args[_key] = arguments[_key];
|
12318 | }
|
12319 |
|
12320 | callback.apply(this, args);
|
12321 | };
|
12322 | }
|
12323 |
|
12324 | function noop() {}
|
12325 |
|
12326 | function isRequest(stream) {
|
12327 | return stream.setHeader && typeof stream.abort === 'function';
|
12328 | }
|
12329 |
|
12330 | function eos(stream, opts, callback) {
|
12331 | if (typeof opts === 'function') return eos(stream, null, opts);
|
12332 | if (!opts) opts = {};
|
12333 | callback = once(callback || noop);
|
12334 | var readable = opts.readable || opts.readable !== false && stream.readable;
|
12335 | var writable = opts.writable || opts.writable !== false && stream.writable;
|
12336 |
|
12337 | var onlegacyfinish = function onlegacyfinish() {
|
12338 | if (!stream.writable) onfinish();
|
12339 | };
|
12340 |
|
12341 | var writableEnded = stream._writableState && stream._writableState.finished;
|
12342 |
|
12343 | var onfinish = function onfinish() {
|
12344 | writable = false;
|
12345 | writableEnded = true;
|
12346 | if (!readable) callback.call(stream);
|
12347 | };
|
12348 |
|
12349 | var readableEnded = stream._readableState && stream._readableState.endEmitted;
|
12350 |
|
12351 | var onend = function onend() {
|
12352 | readable = false;
|
12353 | readableEnded = true;
|
12354 | if (!writable) callback.call(stream);
|
12355 | };
|
12356 |
|
12357 | var onerror = function onerror(err) {
|
12358 | callback.call(stream, err);
|
12359 | };
|
12360 |
|
12361 | var onclose = function onclose() {
|
12362 | var err;
|
12363 |
|
12364 | if (readable && !readableEnded) {
|
12365 | if (!stream._readableState || !stream._readableState.ended) err = new ERR_STREAM_PREMATURE_CLOSE();
|
12366 | return callback.call(stream, err);
|
12367 | }
|
12368 |
|
12369 | if (writable && !writableEnded) {
|
12370 | if (!stream._writableState || !stream._writableState.ended) err = new ERR_STREAM_PREMATURE_CLOSE();
|
12371 | return callback.call(stream, err);
|
12372 | }
|
12373 | };
|
12374 |
|
12375 | var onrequest = function onrequest() {
|
12376 | stream.req.on('finish', onfinish);
|
12377 | };
|
12378 |
|
12379 | if (isRequest(stream)) {
|
12380 | stream.on('complete', onfinish);
|
12381 | stream.on('abort', onclose);
|
12382 | if (stream.req) onrequest();else stream.on('request', onrequest);
|
12383 | } else if (writable && !stream._writableState) {
|
12384 |
|
12385 | stream.on('end', onlegacyfinish);
|
12386 | stream.on('close', onlegacyfinish);
|
12387 | }
|
12388 |
|
12389 | stream.on('end', onend);
|
12390 | stream.on('finish', onfinish);
|
12391 | if (opts.error !== false) stream.on('error', onerror);
|
12392 | stream.on('close', onclose);
|
12393 | return function () {
|
12394 | stream.removeListener('complete', onfinish);
|
12395 | stream.removeListener('abort', onclose);
|
12396 | stream.removeListener('request', onrequest);
|
12397 | if (stream.req) stream.req.removeListener('finish', onfinish);
|
12398 | stream.removeListener('end', onlegacyfinish);
|
12399 | stream.removeListener('close', onlegacyfinish);
|
12400 | stream.removeListener('finish', onfinish);
|
12401 | stream.removeListener('end', onend);
|
12402 | stream.removeListener('error', onerror);
|
12403 | stream.removeListener('close', onclose);
|
12404 | };
|
12405 | }
|
12406 |
|
12407 | module.exports = eos;
|
12408 | },{"../../../errors":83}],93:[function(require,module,exports){
|
12409 | module.exports = function () {
|
12410 | throw new Error('Readable.from is not available in the browser')
|
12411 | };
|
12412 |
|
12413 | },{}],94:[function(require,module,exports){
|
12414 |
|
12415 |
|
12416 | 'use strict';
|
12417 |
|
12418 | var eos;
|
12419 |
|
12420 | function once(callback) {
|
12421 | var called = false;
|
12422 | return function () {
|
12423 | if (called) return;
|
12424 | called = true;
|
12425 | callback.apply(void 0, arguments);
|
12426 | };
|
12427 | }
|
12428 |
|
12429 | var _require$codes = require('../../../errors').codes,
|
12430 | ERR_MISSING_ARGS = _require$codes.ERR_MISSING_ARGS,
|
12431 | ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED;
|
12432 |
|
12433 | function noop(err) {
|
12434 |
|
12435 | if (err) throw err;
|
12436 | }
|
12437 |
|
12438 | function isRequest(stream) {
|
12439 | return stream.setHeader && typeof stream.abort === 'function';
|
12440 | }
|
12441 |
|
12442 | function destroyer(stream, reading, writing, callback) {
|
12443 | callback = once(callback);
|
12444 | var closed = false;
|
12445 | stream.on('close', function () {
|
12446 | closed = true;
|
12447 | });
|
12448 | if (eos === undefined) eos = require('./end-of-stream');
|
12449 | eos(stream, {
|
12450 | readable: reading,
|
12451 | writable: writing
|
12452 | }, function (err) {
|
12453 | if (err) return callback(err);
|
12454 | closed = true;
|
12455 | callback();
|
12456 | });
|
12457 | var destroyed = false;
|
12458 | return function (err) {
|
12459 | if (closed) return;
|
12460 | if (destroyed) return;
|
12461 | destroyed = true;
|
12462 |
|
12463 | if (isRequest(stream)) return stream.abort();
|
12464 | if (typeof stream.destroy === 'function') return stream.destroy();
|
12465 | callback(err || new ERR_STREAM_DESTROYED('pipe'));
|
12466 | };
|
12467 | }
|
12468 |
|
12469 | function call(fn) {
|
12470 | fn();
|
12471 | }
|
12472 |
|
12473 | function pipe(from, to) {
|
12474 | return from.pipe(to);
|
12475 | }
|
12476 |
|
12477 | function popCallback(streams) {
|
12478 | if (!streams.length) return noop;
|
12479 | if (typeof streams[streams.length - 1] !== 'function') return noop;
|
12480 | return streams.pop();
|
12481 | }
|
12482 |
|
12483 | function pipeline() {
|
12484 | for (var _len = arguments.length, streams = new Array(_len), _key = 0; _key < _len; _key++) {
|
12485 | streams[_key] = arguments[_key];
|
12486 | }
|
12487 |
|
12488 | var callback = popCallback(streams);
|
12489 | if (Array.isArray(streams[0])) streams = streams[0];
|
12490 |
|
12491 | if (streams.length < 2) {
|
12492 | throw new ERR_MISSING_ARGS('streams');
|
12493 | }
|
12494 |
|
12495 | var error;
|
12496 | var destroys = streams.map(function (stream, i) {
|
12497 | var reading = i < streams.length - 1;
|
12498 | var writing = i > 0;
|
12499 | return destroyer(stream, reading, writing, function (err) {
|
12500 | if (!error) error = err;
|
12501 | if (err) destroys.forEach(call);
|
12502 | if (reading) return;
|
12503 | destroys.forEach(call);
|
12504 | callback(error);
|
12505 | });
|
12506 | });
|
12507 | return streams.reduce(pipe);
|
12508 | }
|
12509 |
|
12510 | module.exports = pipeline;
|
12511 | },{"../../../errors":83,"./end-of-stream":92}],95:[function(require,module,exports){
|
12512 | 'use strict';
|
12513 |
|
12514 | var ERR_INVALID_OPT_VALUE = require('../../../errors').codes.ERR_INVALID_OPT_VALUE;
|
12515 |
|
12516 | function highWaterMarkFrom(options, isDuplex, duplexKey) {
|
12517 | return options.highWaterMark != null ? options.highWaterMark : isDuplex ? options[duplexKey] : null;
|
12518 | }
|
12519 |
|
12520 | function getHighWaterMark(state, options, duplexKey, isDuplex) {
|
12521 | var hwm = highWaterMarkFrom(options, isDuplex, duplexKey);
|
12522 |
|
12523 | if (hwm != null) {
|
12524 | if (!(isFinite(hwm) && Math.floor(hwm) === hwm) || hwm < 0) {
|
12525 | var name = isDuplex ? duplexKey : 'highWaterMark';
|
12526 | throw new ERR_INVALID_OPT_VALUE(name, hwm);
|
12527 | }
|
12528 |
|
12529 | return Math.floor(hwm);
|
12530 | }
|
12531 |
|
12532 |
|
12533 | return state.objectMode ? 16 : 16 * 1024;
|
12534 | }
|
12535 |
|
12536 | module.exports = {
|
12537 | getHighWaterMark: getHighWaterMark
|
12538 | };
|
12539 | },{"../../../errors":83}],96:[function(require,module,exports){
|
12540 | module.exports = require('events').EventEmitter;
|
12541 |
|
12542 | },{"events":297}],97:[function(require,module,exports){
|
12543 | exports = module.exports = require('./lib/_stream_readable.js');
|
12544 | exports.Stream = exports;
|
12545 | exports.Readable = exports;
|
12546 | exports.Writable = require('./lib/_stream_writable.js');
|
12547 | exports.Duplex = require('./lib/_stream_duplex.js');
|
12548 | exports.Transform = require('./lib/_stream_transform.js');
|
12549 | exports.PassThrough = require('./lib/_stream_passthrough.js');
|
12550 | exports.finished = require('./lib/internal/streams/end-of-stream.js');
|
12551 | exports.pipeline = require('./lib/internal/streams/pipeline.js');
|
12552 |
|
12553 | },{"./lib/_stream_duplex.js":84,"./lib/_stream_passthrough.js":85,"./lib/_stream_readable.js":86,"./lib/_stream_transform.js":87,"./lib/_stream_writable.js":88,"./lib/internal/streams/end-of-stream.js":92,"./lib/internal/streams/pipeline.js":94}],98:[function(require,module,exports){
|
12554 | (function (Buffer){
|
12555 |
|
12556 |
|
12557 |
|
12558 |
|
12559 |
|
12560 |
|
12561 |
|
12562 |
|
12563 | 'use strict'
|
12564 |
|
12565 | var base64 = require('base64-js')
|
12566 | var ieee754 = require('ieee754')
|
12567 |
|
12568 | exports.Buffer = Buffer
|
12569 | exports.SlowBuffer = SlowBuffer
|
12570 | exports.INSPECT_MAX_BYTES = 50
|
12571 |
|
12572 | var K_MAX_LENGTH = 0x7fffffff
|
12573 | exports.kMaxLength = K_MAX_LENGTH
|
12574 |
|
12575 |
|
12576 |
|
12577 |
|
12578 |
|
12579 |
|
12580 |
|
12581 |
|
12582 |
|
12583 |
|
12584 |
|
12585 |
|
12586 |
|
12587 |
|
12588 |
|
12589 | Buffer.TYPED_ARRAY_SUPPORT = typedArraySupport()
|
12590 |
|
12591 | if (!Buffer.TYPED_ARRAY_SUPPORT && typeof console !== 'undefined' &&
|
12592 | typeof console.error === 'function') {
|
12593 | console.error(
|
12594 | 'This browser lacks typed array (Uint8Array) support which is required by ' +
|
12595 | '`buffer` v5.x. Use `buffer` v4.x if you require old browser support.'
|
12596 | )
|
12597 | }
|
12598 |
|
12599 | function typedArraySupport () {
|
12600 |
|
12601 | try {
|
12602 | var arr = new Uint8Array(1)
|
12603 | arr.__proto__ = { __proto__: Uint8Array.prototype, foo: function () { return 42 } }
|
12604 | return arr.foo() === 42
|
12605 | } catch (e) {
|
12606 | return false
|
12607 | }
|
12608 | }
|
12609 |
|
12610 | Object.defineProperty(Buffer.prototype, 'parent', {
|
12611 | enumerable: true,
|
12612 | get: function () {
|
12613 | if (!Buffer.isBuffer(this)) return undefined
|
12614 | return this.buffer
|
12615 | }
|
12616 | })
|
12617 |
|
12618 | Object.defineProperty(Buffer.prototype, 'offset', {
|
12619 | enumerable: true,
|
12620 | get: function () {
|
12621 | if (!Buffer.isBuffer(this)) return undefined
|
12622 | return this.byteOffset
|
12623 | }
|
12624 | })
|
12625 |
|
12626 | function createBuffer (length) {
|
12627 | if (length > K_MAX_LENGTH) {
|
12628 | throw new RangeError('The value "' + length + '" is invalid for option "size"')
|
12629 | }
|
12630 |
|
12631 | var buf = new Uint8Array(length)
|
12632 | buf.__proto__ = Buffer.prototype
|
12633 | return buf
|
12634 | }
|
12635 |
|
12636 |
|
12637 |
|
12638 |
|
12639 |
|
12640 |
|
12641 |
|
12642 |
|
12643 |
|
12644 |
|
12645 |
|
12646 | function Buffer (arg, encodingOrOffset, length) {
|
12647 |
|
12648 | if (typeof arg === 'number') {
|
12649 | if (typeof encodingOrOffset === 'string') {
|
12650 | throw new TypeError(
|
12651 | 'The "string" argument must be of type string. Received type number'
|
12652 | )
|
12653 | }
|
12654 | return allocUnsafe(arg)
|
12655 | }
|
12656 | return from(arg, encodingOrOffset, length)
|
12657 | }
|
12658 |
|
12659 |
|
12660 | if (typeof Symbol !== 'undefined' && Symbol.species != null &&
|
12661 | Buffer[Symbol.species] === Buffer) {
|
12662 | Object.defineProperty(Buffer, Symbol.species, {
|
12663 | value: null,
|
12664 | configurable: true,
|
12665 | enumerable: false,
|
12666 | writable: false
|
12667 | })
|
12668 | }
|
12669 |
|
12670 | Buffer.poolSize = 8192
|
12671 |
|
12672 | function from (value, encodingOrOffset, length) {
|
12673 | if (typeof value === 'string') {
|
12674 | return fromString(value, encodingOrOffset)
|
12675 | }
|
12676 |
|
12677 | if (ArrayBuffer.isView(value)) {
|
12678 | return fromArrayLike(value)
|
12679 | }
|
12680 |
|
12681 | if (value == null) {
|
12682 | throw TypeError(
|
12683 | 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +
|
12684 | 'or Array-like Object. Received type ' + (typeof value)
|
12685 | )
|
12686 | }
|
12687 |
|
12688 | if (isInstance(value, ArrayBuffer) ||
|
12689 | (value && isInstance(value.buffer, ArrayBuffer))) {
|
12690 | return fromArrayBuffer(value, encodingOrOffset, length)
|
12691 | }
|
12692 |
|
12693 | if (typeof value === 'number') {
|
12694 | throw new TypeError(
|
12695 | 'The "value" argument must not be of type number. Received type number'
|
12696 | )
|
12697 | }
|
12698 |
|
12699 | var valueOf = value.valueOf && value.valueOf()
|
12700 | if (valueOf != null && valueOf !== value) {
|
12701 | return Buffer.from(valueOf, encodingOrOffset, length)
|
12702 | }
|
12703 |
|
12704 | var b = fromObject(value)
|
12705 | if (b) return b
|
12706 |
|
12707 | if (typeof Symbol !== 'undefined' && Symbol.toPrimitive != null &&
|
12708 | typeof value[Symbol.toPrimitive] === 'function') {
|
12709 | return Buffer.from(
|
12710 | value[Symbol.toPrimitive]('string'), encodingOrOffset, length
|
12711 | )
|
12712 | }
|
12713 |
|
12714 | throw new TypeError(
|
12715 | 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +
|
12716 | 'or Array-like Object. Received type ' + (typeof value)
|
12717 | )
|
12718 | }
|
12719 |
|
12720 |
|
12721 |
|
12722 |
|
12723 |
|
12724 |
|
12725 |
|
12726 |
|
12727 |
|
12728 | Buffer.from = function (value, encodingOrOffset, length) {
|
12729 | return from(value, encodingOrOffset, length)
|
12730 | }
|
12731 |
|
12732 |
|
12733 |
|
12734 | Buffer.prototype.__proto__ = Uint8Array.prototype
|
12735 | Buffer.__proto__ = Uint8Array
|
12736 |
|
12737 | function assertSize (size) {
|
12738 | if (typeof size !== 'number') {
|
12739 | throw new TypeError('"size" argument must be of type number')
|
12740 | } else if (size < 0) {
|
12741 | throw new RangeError('The value "' + size + '" is invalid for option "size"')
|
12742 | }
|
12743 | }
|
12744 |
|
12745 | function alloc (size, fill, encoding) {
|
12746 | assertSize(size)
|
12747 | if (size <= 0) {
|
12748 | return createBuffer(size)
|
12749 | }
|
12750 | if (fill !== undefined) {
|
12751 |
|
12752 |
|
12753 |
|
12754 | return typeof encoding === 'string'
|
12755 | ? createBuffer(size).fill(fill, encoding)
|
12756 | : createBuffer(size).fill(fill)
|
12757 | }
|
12758 | return createBuffer(size)
|
12759 | }
|
12760 |
|
12761 |
|
12762 |
|
12763 |
|
12764 |
|
12765 | Buffer.alloc = function (size, fill, encoding) {
|
12766 | return alloc(size, fill, encoding)
|
12767 | }
|
12768 |
|
12769 | function allocUnsafe (size) {
|
12770 | assertSize(size)
|
12771 | return createBuffer(size < 0 ? 0 : checked(size) | 0)
|
12772 | }
|
12773 |
|
12774 |
|
12775 |
|
12776 |
|
12777 | Buffer.allocUnsafe = function (size) {
|
12778 | return allocUnsafe(size)
|
12779 | }
|
12780 |
|
12781 |
|
12782 |
|
12783 | Buffer.allocUnsafeSlow = function (size) {
|
12784 | return allocUnsafe(size)
|
12785 | }
|
12786 |
|
12787 | function fromString (string, encoding) {
|
12788 | if (typeof encoding !== 'string' || encoding === '') {
|
12789 | encoding = 'utf8'
|
12790 | }
|
12791 |
|
12792 | if (!Buffer.isEncoding(encoding)) {
|
12793 | throw new TypeError('Unknown encoding: ' + encoding)
|
12794 | }
|
12795 |
|
12796 | var length = byteLength(string, encoding) | 0
|
12797 | var buf = createBuffer(length)
|
12798 |
|
12799 | var actual = buf.write(string, encoding)
|
12800 |
|
12801 | if (actual !== length) {
|
12802 |
|
12803 |
|
12804 |
|
12805 | buf = buf.slice(0, actual)
|
12806 | }
|
12807 |
|
12808 | return buf
|
12809 | }
|
12810 |
|
12811 | function fromArrayLike (array) {
|
12812 | var length = array.length < 0 ? 0 : checked(array.length) | 0
|
12813 | var buf = createBuffer(length)
|
12814 | for (var i = 0; i < length; i += 1) {
|
12815 | buf[i] = array[i] & 255
|
12816 | }
|
12817 | return buf
|
12818 | }
|
12819 |
|
12820 | function fromArrayBuffer (array, byteOffset, length) {
|
12821 | if (byteOffset < 0 || array.byteLength < byteOffset) {
|
12822 | throw new RangeError('"offset" is outside of buffer bounds')
|
12823 | }
|
12824 |
|
12825 | if (array.byteLength < byteOffset + (length || 0)) {
|
12826 | throw new RangeError('"length" is outside of buffer bounds')
|
12827 | }
|
12828 |
|
12829 | var buf
|
12830 | if (byteOffset === undefined && length === undefined) {
|
12831 | buf = new Uint8Array(array)
|
12832 | } else if (length === undefined) {
|
12833 | buf = new Uint8Array(array, byteOffset)
|
12834 | } else {
|
12835 | buf = new Uint8Array(array, byteOffset, length)
|
12836 | }
|
12837 |
|
12838 |
|
12839 | buf.__proto__ = Buffer.prototype
|
12840 | return buf
|
12841 | }
|
12842 |
|
12843 | function fromObject (obj) {
|
12844 | if (Buffer.isBuffer(obj)) {
|
12845 | var len = checked(obj.length) | 0
|
12846 | var buf = createBuffer(len)
|
12847 |
|
12848 | if (buf.length === 0) {
|
12849 | return buf
|
12850 | }
|
12851 |
|
12852 | obj.copy(buf, 0, 0, len)
|
12853 | return buf
|
12854 | }
|
12855 |
|
12856 | if (obj.length !== undefined) {
|
12857 | if (typeof obj.length !== 'number' || numberIsNaN(obj.length)) {
|
12858 | return createBuffer(0)
|
12859 | }
|
12860 | return fromArrayLike(obj)
|
12861 | }
|
12862 |
|
12863 | if (obj.type === 'Buffer' && Array.isArray(obj.data)) {
|
12864 | return fromArrayLike(obj.data)
|
12865 | }
|
12866 | }
|
12867 |
|
12868 | function checked (length) {
|
12869 |
|
12870 |
|
12871 | if (length >= K_MAX_LENGTH) {
|
12872 | throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
|
12873 | 'size: 0x' + K_MAX_LENGTH.toString(16) + ' bytes')
|
12874 | }
|
12875 | return length | 0
|
12876 | }
|
12877 |
|
12878 | function SlowBuffer (length) {
|
12879 | if (+length != length) {
|
12880 | length = 0
|
12881 | }
|
12882 | return Buffer.alloc(+length)
|
12883 | }
|
12884 |
|
12885 | Buffer.isBuffer = function isBuffer (b) {
|
12886 | return b != null && b._isBuffer === true &&
|
12887 | b !== Buffer.prototype
|
12888 | }
|
12889 |
|
12890 | Buffer.compare = function compare (a, b) {
|
12891 | if (isInstance(a, Uint8Array)) a = Buffer.from(a, a.offset, a.byteLength)
|
12892 | if (isInstance(b, Uint8Array)) b = Buffer.from(b, b.offset, b.byteLength)
|
12893 | if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
|
12894 | throw new TypeError(
|
12895 | 'The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array'
|
12896 | )
|
12897 | }
|
12898 |
|
12899 | if (a === b) return 0
|
12900 |
|
12901 | var x = a.length
|
12902 | var y = b.length
|
12903 |
|
12904 | for (var i = 0, len = Math.min(x, y); i < len; ++i) {
|
12905 | if (a[i] !== b[i]) {
|
12906 | x = a[i]
|
12907 | y = b[i]
|
12908 | break
|
12909 | }
|
12910 | }
|
12911 |
|
12912 | if (x < y) return -1
|
12913 | if (y < x) return 1
|
12914 | return 0
|
12915 | }
|
12916 |
|
12917 | Buffer.isEncoding = function isEncoding (encoding) {
|
12918 | switch (String(encoding).toLowerCase()) {
|
12919 | case 'hex':
|
12920 | case 'utf8':
|
12921 | case 'utf-8':
|
12922 | case 'ascii':
|
12923 | case 'latin1':
|
12924 | case 'binary':
|
12925 | case 'base64':
|
12926 | case 'ucs2':
|
12927 | case 'ucs-2':
|
12928 | case 'utf16le':
|
12929 | case 'utf-16le':
|
12930 | return true
|
12931 | default:
|
12932 | return false
|
12933 | }
|
12934 | }
|
12935 |
|
12936 | Buffer.concat = function concat (list, length) {
|
12937 | if (!Array.isArray(list)) {
|
12938 | throw new TypeError('"list" argument must be an Array of Buffers')
|
12939 | }
|
12940 |
|
12941 | if (list.length === 0) {
|
12942 | return Buffer.alloc(0)
|
12943 | }
|
12944 |
|
12945 | var i
|
12946 | if (length === undefined) {
|
12947 | length = 0
|
12948 | for (i = 0; i < list.length; ++i) {
|
12949 | length += list[i].length
|
12950 | }
|
12951 | }
|
12952 |
|
12953 | var buffer = Buffer.allocUnsafe(length)
|
12954 | var pos = 0
|
12955 | for (i = 0; i < list.length; ++i) {
|
12956 | var buf = list[i]
|
12957 | if (isInstance(buf, Uint8Array)) {
|
12958 | buf = Buffer.from(buf)
|
12959 | }
|
12960 | if (!Buffer.isBuffer(buf)) {
|
12961 | throw new TypeError('"list" argument must be an Array of Buffers')
|
12962 | }
|
12963 | buf.copy(buffer, pos)
|
12964 | pos += buf.length
|
12965 | }
|
12966 | return buffer
|
12967 | }
|
12968 |
|
12969 | function byteLength (string, encoding) {
|
12970 | if (Buffer.isBuffer(string)) {
|
12971 | return string.length
|
12972 | }
|
12973 | if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) {
|
12974 | return string.byteLength
|
12975 | }
|
12976 | if (typeof string !== 'string') {
|
12977 | throw new TypeError(
|
12978 | 'The "string" argument must be one of type string, Buffer, or ArrayBuffer. ' +
|
12979 | 'Received type ' + typeof string
|
12980 | )
|
12981 | }
|
12982 |
|
12983 | var len = string.length
|
12984 | var mustMatch = (arguments.length > 2 && arguments[2] === true)
|
12985 | if (!mustMatch && len === 0) return 0
|
12986 |
|
12987 |
|
12988 | var loweredCase = false
|
12989 | for (;;) {
|
12990 | switch (encoding) {
|
12991 | case 'ascii':
|
12992 | case 'latin1':
|
12993 | case 'binary':
|
12994 | return len
|
12995 | case 'utf8':
|
12996 | case 'utf-8':
|
12997 | return utf8ToBytes(string).length
|
12998 | case 'ucs2':
|
12999 | case 'ucs-2':
|
13000 | case 'utf16le':
|
13001 | case 'utf-16le':
|
13002 | return len * 2
|
13003 | case 'hex':
|
13004 | return len >>> 1
|
13005 | case 'base64':
|
13006 | return base64ToBytes(string).length
|
13007 | default:
|
13008 | if (loweredCase) {
|
13009 | return mustMatch ? -1 : utf8ToBytes(string).length
|
13010 | }
|
13011 | encoding = ('' + encoding).toLowerCase()
|
13012 | loweredCase = true
|
13013 | }
|
13014 | }
|
13015 | }
|
13016 | Buffer.byteLength = byteLength
|
13017 |
|
13018 | function slowToString (encoding, start, end) {
|
13019 | var loweredCase = false
|
13020 |
|
13021 |
|
13022 |
|
13023 |
|
13024 |
|
13025 |
|
13026 |
|
13027 |
|
13028 | if (start === undefined || start < 0) {
|
13029 | start = 0
|
13030 | }
|
13031 |
|
13032 |
|
13033 | if (start > this.length) {
|
13034 | return ''
|
13035 | }
|
13036 |
|
13037 | if (end === undefined || end > this.length) {
|
13038 | end = this.length
|
13039 | }
|
13040 |
|
13041 | if (end <= 0) {
|
13042 | return ''
|
13043 | }
|
13044 |
|
13045 |
|
13046 | end >>>= 0
|
13047 | start >>>= 0
|
13048 |
|
13049 | if (end <= start) {
|
13050 | return ''
|
13051 | }
|
13052 |
|
13053 | if (!encoding) encoding = 'utf8'
|
13054 |
|
13055 | while (true) {
|
13056 | switch (encoding) {
|
13057 | case 'hex':
|
13058 | return hexSlice(this, start, end)
|
13059 |
|
13060 | case 'utf8':
|
13061 | case 'utf-8':
|
13062 | return utf8Slice(this, start, end)
|
13063 |
|
13064 | case 'ascii':
|
13065 | return asciiSlice(this, start, end)
|
13066 |
|
13067 | case 'latin1':
|
13068 | case 'binary':
|
13069 | return latin1Slice(this, start, end)
|
13070 |
|
13071 | case 'base64':
|
13072 | return base64Slice(this, start, end)
|
13073 |
|
13074 | case 'ucs2':
|
13075 | case 'ucs-2':
|
13076 | case 'utf16le':
|
13077 | case 'utf-16le':
|
13078 | return utf16leSlice(this, start, end)
|
13079 |
|
13080 | default:
|
13081 | if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
|
13082 | encoding = (encoding + '').toLowerCase()
|
13083 | loweredCase = true
|
13084 | }
|
13085 | }
|
13086 | }
|
13087 |
|
13088 |
|
13089 |
|
13090 |
|
13091 |
|
13092 |
|
13093 |
|
13094 | Buffer.prototype._isBuffer = true
|
13095 |
|
13096 | function swap (b, n, m) {
|
13097 | var i = b[n]
|
13098 | b[n] = b[m]
|
13099 | b[m] = i
|
13100 | }
|
13101 |
|
13102 | Buffer.prototype.swap16 = function swap16 () {
|
13103 | var len = this.length
|
13104 | if (len % 2 !== 0) {
|
13105 | throw new RangeError('Buffer size must be a multiple of 16-bits')
|
13106 | }
|
13107 | for (var i = 0; i < len; i += 2) {
|
13108 | swap(this, i, i + 1)
|
13109 | }
|
13110 | return this
|
13111 | }
|
13112 |
|
13113 | Buffer.prototype.swap32 = function swap32 () {
|
13114 | var len = this.length
|
13115 | if (len % 4 !== 0) {
|
13116 | throw new RangeError('Buffer size must be a multiple of 32-bits')
|
13117 | }
|
13118 | for (var i = 0; i < len; i += 4) {
|
13119 | swap(this, i, i + 3)
|
13120 | swap(this, i + 1, i + 2)
|
13121 | }
|
13122 | return this
|
13123 | }
|
13124 |
|
13125 | Buffer.prototype.swap64 = function swap64 () {
|
13126 | var len = this.length
|
13127 | if (len % 8 !== 0) {
|
13128 | throw new RangeError('Buffer size must be a multiple of 64-bits')
|
13129 | }
|
13130 | for (var i = 0; i < len; i += 8) {
|
13131 | swap(this, i, i + 7)
|
13132 | swap(this, i + 1, i + 6)
|
13133 | swap(this, i + 2, i + 5)
|
13134 | swap(this, i + 3, i + 4)
|
13135 | }
|
13136 | return this
|
13137 | }
|
13138 |
|
13139 | Buffer.prototype.toString = function toString () {
|
13140 | var length = this.length
|
13141 | if (length === 0) return ''
|
13142 | if (arguments.length === 0) return utf8Slice(this, 0, length)
|
13143 | return slowToString.apply(this, arguments)
|
13144 | }
|
13145 |
|
13146 | Buffer.prototype.toLocaleString = Buffer.prototype.toString
|
13147 |
|
13148 | Buffer.prototype.equals = function equals (b) {
|
13149 | if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
|
13150 | if (this === b) return true
|
13151 | return Buffer.compare(this, b) === 0
|
13152 | }
|
13153 |
|
13154 | Buffer.prototype.inspect = function inspect () {
|
13155 | var str = ''
|
13156 | var max = exports.INSPECT_MAX_BYTES
|
13157 | str = this.toString('hex', 0, max).replace(/(.{2})/g, '$1 ').trim()
|
13158 | if (this.length > max) str += ' ... '
|
13159 | return '<Buffer ' + str + '>'
|
13160 | }
|
13161 |
|
13162 | Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
|
13163 | if (isInstance(target, Uint8Array)) {
|
13164 | target = Buffer.from(target, target.offset, target.byteLength)
|
13165 | }
|
13166 | if (!Buffer.isBuffer(target)) {
|
13167 | throw new TypeError(
|
13168 | 'The "target" argument must be one of type Buffer or Uint8Array. ' +
|
13169 | 'Received type ' + (typeof target)
|
13170 | )
|
13171 | }
|
13172 |
|
13173 | if (start === undefined) {
|
13174 | start = 0
|
13175 | }
|
13176 | if (end === undefined) {
|
13177 | end = target ? target.length : 0
|
13178 | }
|
13179 | if (thisStart === undefined) {
|
13180 | thisStart = 0
|
13181 | }
|
13182 | if (thisEnd === undefined) {
|
13183 | thisEnd = this.length
|
13184 | }
|
13185 |
|
13186 | if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
|
13187 | throw new RangeError('out of range index')
|
13188 | }
|
13189 |
|
13190 | if (thisStart >= thisEnd && start >= end) {
|
13191 | return 0
|
13192 | }
|
13193 | if (thisStart >= thisEnd) {
|
13194 | return -1
|
13195 | }
|
13196 | if (start >= end) {
|
13197 | return 1
|
13198 | }
|
13199 |
|
13200 | start >>>= 0
|
13201 | end >>>= 0
|
13202 | thisStart >>>= 0
|
13203 | thisEnd >>>= 0
|
13204 |
|
13205 | if (this === target) return 0
|
13206 |
|
13207 | var x = thisEnd - thisStart
|
13208 | var y = end - start
|
13209 | var len = Math.min(x, y)
|
13210 |
|
13211 | var thisCopy = this.slice(thisStart, thisEnd)
|
13212 | var targetCopy = target.slice(start, end)
|
13213 |
|
13214 | for (var i = 0; i < len; ++i) {
|
13215 | if (thisCopy[i] !== targetCopy[i]) {
|
13216 | x = thisCopy[i]
|
13217 | y = targetCopy[i]
|
13218 | break
|
13219 | }
|
13220 | }
|
13221 |
|
13222 | if (x < y) return -1
|
13223 | if (y < x) return 1
|
13224 | return 0
|
13225 | }
|
13226 |
|
13227 |
|
13228 |
|
13229 |
|
13230 |
|
13231 |
|
13232 |
|
13233 |
|
13234 |
|
13235 |
|
13236 | function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
|
13237 |
|
13238 | if (buffer.length === 0) return -1
|
13239 |
|
13240 |
|
13241 | if (typeof byteOffset === 'string') {
|
13242 | encoding = byteOffset
|
13243 | byteOffset = 0
|
13244 | } else if (byteOffset > 0x7fffffff) {
|
13245 | byteOffset = 0x7fffffff
|
13246 | } else if (byteOffset < -0x80000000) {
|
13247 | byteOffset = -0x80000000
|
13248 | }
|
13249 | byteOffset = +byteOffset
|
13250 | if (numberIsNaN(byteOffset)) {
|
13251 |
|
13252 | byteOffset = dir ? 0 : (buffer.length - 1)
|
13253 | }
|
13254 |
|
13255 |
|
13256 | if (byteOffset < 0) byteOffset = buffer.length + byteOffset
|
13257 | if (byteOffset >= buffer.length) {
|
13258 | if (dir) return -1
|
13259 | else byteOffset = buffer.length - 1
|
13260 | } else if (byteOffset < 0) {
|
13261 | if (dir) byteOffset = 0
|
13262 | else return -1
|
13263 | }
|
13264 |
|
13265 |
|
13266 | if (typeof val === 'string') {
|
13267 | val = Buffer.from(val, encoding)
|
13268 | }
|
13269 |
|
13270 |
|
13271 | if (Buffer.isBuffer(val)) {
|
13272 |
|
13273 | if (val.length === 0) {
|
13274 | return -1
|
13275 | }
|
13276 | return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
|
13277 | } else if (typeof val === 'number') {
|
13278 | val = val & 0xFF
|
13279 | if (typeof Uint8Array.prototype.indexOf === 'function') {
|
13280 | if (dir) {
|
13281 | return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
|
13282 | } else {
|
13283 | return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
|
13284 | }
|
13285 | }
|
13286 | return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)
|
13287 | }
|
13288 |
|
13289 | throw new TypeError('val must be string, number or Buffer')
|
13290 | }
|
13291 |
|
13292 | function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
|
13293 | var indexSize = 1
|
13294 | var arrLength = arr.length
|
13295 | var valLength = val.length
|
13296 |
|
13297 | if (encoding !== undefined) {
|
13298 | encoding = String(encoding).toLowerCase()
|
13299 | if (encoding === 'ucs2' || encoding === 'ucs-2' ||
|
13300 | encoding === 'utf16le' || encoding === 'utf-16le') {
|
13301 | if (arr.length < 2 || val.length < 2) {
|
13302 | return -1
|
13303 | }
|
13304 | indexSize = 2
|
13305 | arrLength /= 2
|
13306 | valLength /= 2
|
13307 | byteOffset /= 2
|
13308 | }
|
13309 | }
|
13310 |
|
13311 | function read (buf, i) {
|
13312 | if (indexSize === 1) {
|
13313 | return buf[i]
|
13314 | } else {
|
13315 | return buf.readUInt16BE(i * indexSize)
|
13316 | }
|
13317 | }
|
13318 |
|
13319 | var i
|
13320 | if (dir) {
|
13321 | var foundIndex = -1
|
13322 | for (i = byteOffset; i < arrLength; i++) {
|
13323 | if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
|
13324 | if (foundIndex === -1) foundIndex = i
|
13325 | if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
|
13326 | } else {
|
13327 | if (foundIndex !== -1) i -= i - foundIndex
|
13328 | foundIndex = -1
|
13329 | }
|
13330 | }
|
13331 | } else {
|
13332 | if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength
|
13333 | for (i = byteOffset; i >= 0; i--) {
|
13334 | var found = true
|
13335 | for (var j = 0; j < valLength; j++) {
|
13336 | if (read(arr, i + j) !== read(val, j)) {
|
13337 | found = false
|
13338 | break
|
13339 | }
|
13340 | }
|
13341 | if (found) return i
|
13342 | }
|
13343 | }
|
13344 |
|
13345 | return -1
|
13346 | }
|
13347 |
|
13348 | Buffer.prototype.includes = function includes (val, byteOffset, encoding) {
|
13349 | return this.indexOf(val, byteOffset, encoding) !== -1
|
13350 | }
|
13351 |
|
13352 | Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {
|
13353 | return bidirectionalIndexOf(this, val, byteOffset, encoding, true)
|
13354 | }
|
13355 |
|
13356 | Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {
|
13357 | return bidirectionalIndexOf(this, val, byteOffset, encoding, false)
|
13358 | }
|
13359 |
|
13360 | function hexWrite (buf, string, offset, length) {
|
13361 | offset = Number(offset) || 0
|
13362 | var remaining = buf.length - offset
|
13363 | if (!length) {
|
13364 | length = remaining
|
13365 | } else {
|
13366 | length = Number(length)
|
13367 | if (length > remaining) {
|
13368 | length = remaining
|
13369 | }
|
13370 | }
|
13371 |
|
13372 | var strLen = string.length
|
13373 |
|
13374 | if (length > strLen / 2) {
|
13375 | length = strLen / 2
|
13376 | }
|
13377 | for (var i = 0; i < length; ++i) {
|
13378 | var parsed = parseInt(string.substr(i * 2, 2), 16)
|
13379 | if (numberIsNaN(parsed)) return i
|
13380 | buf[offset + i] = parsed
|
13381 | }
|
13382 | return i
|
13383 | }
|
13384 |
|
13385 | function utf8Write (buf, string, offset, length) {
|
13386 | return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
|
13387 | }
|
13388 |
|
13389 | function asciiWrite (buf, string, offset, length) {
|
13390 | return blitBuffer(asciiToBytes(string), buf, offset, length)
|
13391 | }
|
13392 |
|
13393 | function latin1Write (buf, string, offset, length) {
|
13394 | return asciiWrite(buf, string, offset, length)
|
13395 | }
|
13396 |
|
13397 | function base64Write (buf, string, offset, length) {
|
13398 | return blitBuffer(base64ToBytes(string), buf, offset, length)
|
13399 | }
|
13400 |
|
13401 | function ucs2Write (buf, string, offset, length) {
|
13402 | return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
|
13403 | }
|
13404 |
|
13405 | Buffer.prototype.write = function write (string, offset, length, encoding) {
|
13406 |
|
13407 | if (offset === undefined) {
|
13408 | encoding = 'utf8'
|
13409 | length = this.length
|
13410 | offset = 0
|
13411 |
|
13412 | } else if (length === undefined && typeof offset === 'string') {
|
13413 | encoding = offset
|
13414 | length = this.length
|
13415 | offset = 0
|
13416 |
|
13417 | } else if (isFinite(offset)) {
|
13418 | offset = offset >>> 0
|
13419 | if (isFinite(length)) {
|
13420 | length = length >>> 0
|
13421 | if (encoding === undefined) encoding = 'utf8'
|
13422 | } else {
|
13423 | encoding = length
|
13424 | length = undefined
|
13425 | }
|
13426 | } else {
|
13427 | throw new Error(
|
13428 | 'Buffer.write(string, encoding, offset[, length]) is no longer supported'
|
13429 | )
|
13430 | }
|
13431 |
|
13432 | var remaining = this.length - offset
|
13433 | if (length === undefined || length > remaining) length = remaining
|
13434 |
|
13435 | if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
|
13436 | throw new RangeError('Attempt to write outside buffer bounds')
|
13437 | }
|
13438 |
|
13439 | if (!encoding) encoding = 'utf8'
|
13440 |
|
13441 | var loweredCase = false
|
13442 | for (;;) {
|
13443 | switch (encoding) {
|
13444 | case 'hex':
|
13445 | return hexWrite(this, string, offset, length)
|
13446 |
|
13447 | case 'utf8':
|
13448 | case 'utf-8':
|
13449 | return utf8Write(this, string, offset, length)
|
13450 |
|
13451 | case 'ascii':
|
13452 | return asciiWrite(this, string, offset, length)
|
13453 |
|
13454 | case 'latin1':
|
13455 | case 'binary':
|
13456 | return latin1Write(this, string, offset, length)
|
13457 |
|
13458 | case 'base64':
|
13459 |
|
13460 | return base64Write(this, string, offset, length)
|
13461 |
|
13462 | case 'ucs2':
|
13463 | case 'ucs-2':
|
13464 | case 'utf16le':
|
13465 | case 'utf-16le':
|
13466 | return ucs2Write(this, string, offset, length)
|
13467 |
|
13468 | default:
|
13469 | if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
|
13470 | encoding = ('' + encoding).toLowerCase()
|
13471 | loweredCase = true
|
13472 | }
|
13473 | }
|
13474 | }
|
13475 |
|
13476 | Buffer.prototype.toJSON = function toJSON () {
|
13477 | return {
|
13478 | type: 'Buffer',
|
13479 | data: Array.prototype.slice.call(this._arr || this, 0)
|
13480 | }
|
13481 | }
|
13482 |
|
13483 | function base64Slice (buf, start, end) {
|
13484 | if (start === 0 && end === buf.length) {
|
13485 | return base64.fromByteArray(buf)
|
13486 | } else {
|
13487 | return base64.fromByteArray(buf.slice(start, end))
|
13488 | }
|
13489 | }
|
13490 |
|
13491 | function utf8Slice (buf, start, end) {
|
13492 | end = Math.min(buf.length, end)
|
13493 | var res = []
|
13494 |
|
13495 | var i = start
|
13496 | while (i < end) {
|
13497 | var firstByte = buf[i]
|
13498 | var codePoint = null
|
13499 | var bytesPerSequence = (firstByte > 0xEF) ? 4
|
13500 | : (firstByte > 0xDF) ? 3
|
13501 | : (firstByte > 0xBF) ? 2
|
13502 | : 1
|
13503 |
|
13504 | if (i + bytesPerSequence <= end) {
|
13505 | var secondByte, thirdByte, fourthByte, tempCodePoint
|
13506 |
|
13507 | switch (bytesPerSequence) {
|
13508 | case 1:
|
13509 | if (firstByte < 0x80) {
|
13510 | codePoint = firstByte
|
13511 | }
|
13512 | break
|
13513 | case 2:
|
13514 | secondByte = buf[i + 1]
|
13515 | if ((secondByte & 0xC0) === 0x80) {
|
13516 | tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)
|
13517 | if (tempCodePoint > 0x7F) {
|
13518 | codePoint = tempCodePoint
|
13519 | }
|
13520 | }
|
13521 | break
|
13522 | case 3:
|
13523 | secondByte = buf[i + 1]
|
13524 | thirdByte = buf[i + 2]
|
13525 | if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
|
13526 | tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)
|
13527 | if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
|
13528 | codePoint = tempCodePoint
|
13529 | }
|
13530 | }
|
13531 | break
|
13532 | case 4:
|
13533 | secondByte = buf[i + 1]
|
13534 | thirdByte = buf[i + 2]
|
13535 | fourthByte = buf[i + 3]
|
13536 | if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
|
13537 | tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)
|
13538 | if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
|
13539 | codePoint = tempCodePoint
|
13540 | }
|
13541 | }
|
13542 | }
|
13543 | }
|
13544 |
|
13545 | if (codePoint === null) {
|
13546 |
|
13547 |
|
13548 | codePoint = 0xFFFD
|
13549 | bytesPerSequence = 1
|
13550 | } else if (codePoint > 0xFFFF) {
|
13551 |
|
13552 | codePoint -= 0x10000
|
13553 | res.push(codePoint >>> 10 & 0x3FF | 0xD800)
|
13554 | codePoint = 0xDC00 | codePoint & 0x3FF
|
13555 | }
|
13556 |
|
13557 | res.push(codePoint)
|
13558 | i += bytesPerSequence
|
13559 | }
|
13560 |
|
13561 | return decodeCodePointsArray(res)
|
13562 | }
|
13563 |
|
13564 |
|
13565 |
|
13566 |
|
13567 | var MAX_ARGUMENTS_LENGTH = 0x1000
|
13568 |
|
13569 | function decodeCodePointsArray (codePoints) {
|
13570 | var len = codePoints.length
|
13571 | if (len <= MAX_ARGUMENTS_LENGTH) {
|
13572 | return String.fromCharCode.apply(String, codePoints)
|
13573 | }
|
13574 |
|
13575 |
|
13576 | var res = ''
|
13577 | var i = 0
|
13578 | while (i < len) {
|
13579 | res += String.fromCharCode.apply(
|
13580 | String,
|
13581 | codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
|
13582 | )
|
13583 | }
|
13584 | return res
|
13585 | }
|
13586 |
|
13587 | function asciiSlice (buf, start, end) {
|
13588 | var ret = ''
|
13589 | end = Math.min(buf.length, end)
|
13590 |
|
13591 | for (var i = start; i < end; ++i) {
|
13592 | ret += String.fromCharCode(buf[i] & 0x7F)
|
13593 | }
|
13594 | return ret
|
13595 | }
|
13596 |
|
13597 | function latin1Slice (buf, start, end) {
|
13598 | var ret = ''
|
13599 | end = Math.min(buf.length, end)
|
13600 |
|
13601 | for (var i = start; i < end; ++i) {
|
13602 | ret += String.fromCharCode(buf[i])
|
13603 | }
|
13604 | return ret
|
13605 | }
|
13606 |
|
13607 | function hexSlice (buf, start, end) {
|
13608 | var len = buf.length
|
13609 |
|
13610 | if (!start || start < 0) start = 0
|
13611 | if (!end || end < 0 || end > len) end = len
|
13612 |
|
13613 | var out = ''
|
13614 | for (var i = start; i < end; ++i) {
|
13615 | out += toHex(buf[i])
|
13616 | }
|
13617 | return out
|
13618 | }
|
13619 |
|
13620 | function utf16leSlice (buf, start, end) {
|
13621 | var bytes = buf.slice(start, end)
|
13622 | var res = ''
|
13623 | for (var i = 0; i < bytes.length; i += 2) {
|
13624 | res += String.fromCharCode(bytes[i] + (bytes[i + 1] * 256))
|
13625 | }
|
13626 | return res
|
13627 | }
|
13628 |
|
13629 | Buffer.prototype.slice = function slice (start, end) {
|
13630 | var len = this.length
|
13631 | start = ~~start
|
13632 | end = end === undefined ? len : ~~end
|
13633 |
|
13634 | if (start < 0) {
|
13635 | start += len
|
13636 | if (start < 0) start = 0
|
13637 | } else if (start > len) {
|
13638 | start = len
|
13639 | }
|
13640 |
|
13641 | if (end < 0) {
|
13642 | end += len
|
13643 | if (end < 0) end = 0
|
13644 | } else if (end > len) {
|
13645 | end = len
|
13646 | }
|
13647 |
|
13648 | if (end < start) end = start
|
13649 |
|
13650 | var newBuf = this.subarray(start, end)
|
13651 |
|
13652 | newBuf.__proto__ = Buffer.prototype
|
13653 | return newBuf
|
13654 | }
|
13655 |
|
13656 |
|
13657 |
|
13658 |
|
13659 | function checkOffset (offset, ext, length) {
|
13660 | if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
|
13661 | if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
|
13662 | }
|
13663 |
|
13664 | Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
|
13665 | offset = offset >>> 0
|
13666 | byteLength = byteLength >>> 0
|
13667 | if (!noAssert) checkOffset(offset, byteLength, this.length)
|
13668 |
|
13669 | var val = this[offset]
|
13670 | var mul = 1
|
13671 | var i = 0
|
13672 | while (++i < byteLength && (mul *= 0x100)) {
|
13673 | val += this[offset + i] * mul
|
13674 | }
|
13675 |
|
13676 | return val
|
13677 | }
|
13678 |
|
13679 | Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
|
13680 | offset = offset >>> 0
|
13681 | byteLength = byteLength >>> 0
|
13682 | if (!noAssert) {
|
13683 | checkOffset(offset, byteLength, this.length)
|
13684 | }
|
13685 |
|
13686 | var val = this[offset + --byteLength]
|
13687 | var mul = 1
|
13688 | while (byteLength > 0 && (mul *= 0x100)) {
|
13689 | val += this[offset + --byteLength] * mul
|
13690 | }
|
13691 |
|
13692 | return val
|
13693 | }
|
13694 |
|
13695 | Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
|
13696 | offset = offset >>> 0
|
13697 | if (!noAssert) checkOffset(offset, 1, this.length)
|
13698 | return this[offset]
|
13699 | }
|
13700 |
|
13701 | Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
|
13702 | offset = offset >>> 0
|
13703 | if (!noAssert) checkOffset(offset, 2, this.length)
|
13704 | return this[offset] | (this[offset + 1] << 8)
|
13705 | }
|
13706 |
|
13707 | Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
|
13708 | offset = offset >>> 0
|
13709 | if (!noAssert) checkOffset(offset, 2, this.length)
|
13710 | return (this[offset] << 8) | this[offset + 1]
|
13711 | }
|
13712 |
|
13713 | Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
|
13714 | offset = offset >>> 0
|
13715 | if (!noAssert) checkOffset(offset, 4, this.length)
|
13716 |
|
13717 | return ((this[offset]) |
|
13718 | (this[offset + 1] << 8) |
|
13719 | (this[offset + 2] << 16)) +
|
13720 | (this[offset + 3] * 0x1000000)
|
13721 | }
|
13722 |
|
13723 | Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
|
13724 | offset = offset >>> 0
|
13725 | if (!noAssert) checkOffset(offset, 4, this.length)
|
13726 |
|
13727 | return (this[offset] * 0x1000000) +
|
13728 | ((this[offset + 1] << 16) |
|
13729 | (this[offset + 2] << 8) |
|
13730 | this[offset + 3])
|
13731 | }
|
13732 |
|
13733 | Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
|
13734 | offset = offset >>> 0
|
13735 | byteLength = byteLength >>> 0
|
13736 | if (!noAssert) checkOffset(offset, byteLength, this.length)
|
13737 |
|
13738 | var val = this[offset]
|
13739 | var mul = 1
|
13740 | var i = 0
|
13741 | while (++i < byteLength && (mul *= 0x100)) {
|
13742 | val += this[offset + i] * mul
|
13743 | }
|
13744 | mul *= 0x80
|
13745 |
|
13746 | if (val >= mul) val -= Math.pow(2, 8 * byteLength)
|
13747 |
|
13748 | return val
|
13749 | }
|
13750 |
|
13751 | Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
|
13752 | offset = offset >>> 0
|
13753 | byteLength = byteLength >>> 0
|
13754 | if (!noAssert) checkOffset(offset, byteLength, this.length)
|
13755 |
|
13756 | var i = byteLength
|
13757 | var mul = 1
|
13758 | var val = this[offset + --i]
|
13759 | while (i > 0 && (mul *= 0x100)) {
|
13760 | val += this[offset + --i] * mul
|
13761 | }
|
13762 | mul *= 0x80
|
13763 |
|
13764 | if (val >= mul) val -= Math.pow(2, 8 * byteLength)
|
13765 |
|
13766 | return val
|
13767 | }
|
13768 |
|
13769 | Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
|
13770 | offset = offset >>> 0
|
13771 | if (!noAssert) checkOffset(offset, 1, this.length)
|
13772 | if (!(this[offset] & 0x80)) return (this[offset])
|
13773 | return ((0xff - this[offset] + 1) * -1)
|
13774 | }
|
13775 |
|
13776 | Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
|
13777 | offset = offset >>> 0
|
13778 | if (!noAssert) checkOffset(offset, 2, this.length)
|
13779 | var val = this[offset] | (this[offset + 1] << 8)
|
13780 | return (val & 0x8000) ? val | 0xFFFF0000 : val
|
13781 | }
|
13782 |
|
13783 | Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
|
13784 | offset = offset >>> 0
|
13785 | if (!noAssert) checkOffset(offset, 2, this.length)
|
13786 | var val = this[offset + 1] | (this[offset] << 8)
|
13787 | return (val & 0x8000) ? val | 0xFFFF0000 : val
|
13788 | }
|
13789 |
|
13790 | Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
|
13791 | offset = offset >>> 0
|
13792 | if (!noAssert) checkOffset(offset, 4, this.length)
|
13793 |
|
13794 | return (this[offset]) |
|
13795 | (this[offset + 1] << 8) |
|
13796 | (this[offset + 2] << 16) |
|
13797 | (this[offset + 3] << 24)
|
13798 | }
|
13799 |
|
13800 | Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
|
13801 | offset = offset >>> 0
|
13802 | if (!noAssert) checkOffset(offset, 4, this.length)
|
13803 |
|
13804 | return (this[offset] << 24) |
|
13805 | (this[offset + 1] << 16) |
|
13806 | (this[offset + 2] << 8) |
|
13807 | (this[offset + 3])
|
13808 | }
|
13809 |
|
13810 | Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
|
13811 | offset = offset >>> 0
|
13812 | if (!noAssert) checkOffset(offset, 4, this.length)
|
13813 | return ieee754.read(this, offset, true, 23, 4)
|
13814 | }
|
13815 |
|
13816 | Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
|
13817 | offset = offset >>> 0
|
13818 | if (!noAssert) checkOffset(offset, 4, this.length)
|
13819 | return ieee754.read(this, offset, false, 23, 4)
|
13820 | }
|
13821 |
|
13822 | Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
|
13823 | offset = offset >>> 0
|
13824 | if (!noAssert) checkOffset(offset, 8, this.length)
|
13825 | return ieee754.read(this, offset, true, 52, 8)
|
13826 | }
|
13827 |
|
13828 | Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
|
13829 | offset = offset >>> 0
|
13830 | if (!noAssert) checkOffset(offset, 8, this.length)
|
13831 | return ieee754.read(this, offset, false, 52, 8)
|
13832 | }
|
13833 |
|
13834 | function checkInt (buf, value, offset, ext, max, min) {
|
13835 | if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance')
|
13836 | if (value > max || value < min) throw new RangeError('"value" argument is out of bounds')
|
13837 | if (offset + ext > buf.length) throw new RangeError('Index out of range')
|
13838 | }
|
13839 |
|
13840 | Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
|
13841 | value = +value
|
13842 | offset = offset >>> 0
|
13843 | byteLength = byteLength >>> 0
|
13844 | if (!noAssert) {
|
13845 | var maxBytes = Math.pow(2, 8 * byteLength) - 1
|
13846 | checkInt(this, value, offset, byteLength, maxBytes, 0)
|
13847 | }
|
13848 |
|
13849 | var mul = 1
|
13850 | var i = 0
|
13851 | this[offset] = value & 0xFF
|
13852 | while (++i < byteLength && (mul *= 0x100)) {
|
13853 | this[offset + i] = (value / mul) & 0xFF
|
13854 | }
|
13855 |
|
13856 | return offset + byteLength
|
13857 | }
|
13858 |
|
13859 | Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
|
13860 | value = +value
|
13861 | offset = offset >>> 0
|
13862 | byteLength = byteLength >>> 0
|
13863 | if (!noAssert) {
|
13864 | var maxBytes = Math.pow(2, 8 * byteLength) - 1
|
13865 | checkInt(this, value, offset, byteLength, maxBytes, 0)
|
13866 | }
|
13867 |
|
13868 | var i = byteLength - 1
|
13869 | var mul = 1
|
13870 | this[offset + i] = value & 0xFF
|
13871 | while (--i >= 0 && (mul *= 0x100)) {
|
13872 | this[offset + i] = (value / mul) & 0xFF
|
13873 | }
|
13874 |
|
13875 | return offset + byteLength
|
13876 | }
|
13877 |
|
13878 | Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
|
13879 | value = +value
|
13880 | offset = offset >>> 0
|
13881 | if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)
|
13882 | this[offset] = (value & 0xff)
|
13883 | return offset + 1
|
13884 | }
|
13885 |
|
13886 | Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
|
13887 | value = +value
|
13888 | offset = offset >>> 0
|
13889 | if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
|
13890 | this[offset] = (value & 0xff)
|
13891 | this[offset + 1] = (value >>> 8)
|
13892 | return offset + 2
|
13893 | }
|
13894 |
|
13895 | Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
|
13896 | value = +value
|
13897 | offset = offset >>> 0
|
13898 | if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
|
13899 | this[offset] = (value >>> 8)
|
13900 | this[offset + 1] = (value & 0xff)
|
13901 | return offset + 2
|
13902 | }
|
13903 |
|
13904 | Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
|
13905 | value = +value
|
13906 | offset = offset >>> 0
|
13907 | if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
|
13908 | this[offset + 3] = (value >>> 24)
|
13909 | this[offset + 2] = (value >>> 16)
|
13910 | this[offset + 1] = (value >>> 8)
|
13911 | this[offset] = (value & 0xff)
|
13912 | return offset + 4
|
13913 | }
|
13914 |
|
13915 | Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
|
13916 | value = +value
|
13917 | offset = offset >>> 0
|
13918 | if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
|
13919 | this[offset] = (value >>> 24)
|
13920 | this[offset + 1] = (value >>> 16)
|
13921 | this[offset + 2] = (value >>> 8)
|
13922 | this[offset + 3] = (value & 0xff)
|
13923 | return offset + 4
|
13924 | }
|
13925 |
|
13926 | Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
|
13927 | value = +value
|
13928 | offset = offset >>> 0
|
13929 | if (!noAssert) {
|
13930 | var limit = Math.pow(2, (8 * byteLength) - 1)
|
13931 |
|
13932 | checkInt(this, value, offset, byteLength, limit - 1, -limit)
|
13933 | }
|
13934 |
|
13935 | var i = 0
|
13936 | var mul = 1
|
13937 | var sub = 0
|
13938 | this[offset] = value & 0xFF
|
13939 | while (++i < byteLength && (mul *= 0x100)) {
|
13940 | if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
|
13941 | sub = 1
|
13942 | }
|
13943 | this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
|
13944 | }
|
13945 |
|
13946 | return offset + byteLength
|
13947 | }
|
13948 |
|
13949 | Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
|
13950 | value = +value
|
13951 | offset = offset >>> 0
|
13952 | if (!noAssert) {
|
13953 | var limit = Math.pow(2, (8 * byteLength) - 1)
|
13954 |
|
13955 | checkInt(this, value, offset, byteLength, limit - 1, -limit)
|
13956 | }
|
13957 |
|
13958 | var i = byteLength - 1
|
13959 | var mul = 1
|
13960 | var sub = 0
|
13961 | this[offset + i] = value & 0xFF
|
13962 | while (--i >= 0 && (mul *= 0x100)) {
|
13963 | if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
|
13964 | sub = 1
|
13965 | }
|
13966 | this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
|
13967 | }
|
13968 |
|
13969 | return offset + byteLength
|
13970 | }
|
13971 |
|
13972 | Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
|
13973 | value = +value
|
13974 | offset = offset >>> 0
|
13975 | if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)
|
13976 | if (value < 0) value = 0xff + value + 1
|
13977 | this[offset] = (value & 0xff)
|
13978 | return offset + 1
|
13979 | }
|
13980 |
|
13981 | Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
|
13982 | value = +value
|
13983 | offset = offset >>> 0
|
13984 | if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
|
13985 | this[offset] = (value & 0xff)
|
13986 | this[offset + 1] = (value >>> 8)
|
13987 | return offset + 2
|
13988 | }
|
13989 |
|
13990 | Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
|
13991 | value = +value
|
13992 | offset = offset >>> 0
|
13993 | if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
|
13994 | this[offset] = (value >>> 8)
|
13995 | this[offset + 1] = (value & 0xff)
|
13996 | return offset + 2
|
13997 | }
|
13998 |
|
13999 | Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
|
14000 | value = +value
|
14001 | offset = offset >>> 0
|
14002 | if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
|
14003 | this[offset] = (value & 0xff)
|
14004 | this[offset + 1] = (value >>> 8)
|
14005 | this[offset + 2] = (value >>> 16)
|
14006 | this[offset + 3] = (value >>> 24)
|
14007 | return offset + 4
|
14008 | }
|
14009 |
|
14010 | Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
|
14011 | value = +value
|
14012 | offset = offset >>> 0
|
14013 | if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
|
14014 | if (value < 0) value = 0xffffffff + value + 1
|
14015 | this[offset] = (value >>> 24)
|
14016 | this[offset + 1] = (value >>> 16)
|
14017 | this[offset + 2] = (value >>> 8)
|
14018 | this[offset + 3] = (value & 0xff)
|
14019 | return offset + 4
|
14020 | }
|
14021 |
|
14022 | function checkIEEE754 (buf, value, offset, ext, max, min) {
|
14023 | if (offset + ext > buf.length) throw new RangeError('Index out of range')
|
14024 | if (offset < 0) throw new RangeError('Index out of range')
|
14025 | }
|
14026 |
|
14027 | function writeFloat (buf, value, offset, littleEndian, noAssert) {
|
14028 | value = +value
|
14029 | offset = offset >>> 0
|
14030 | if (!noAssert) {
|
14031 | checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)
|
14032 | }
|
14033 | ieee754.write(buf, value, offset, littleEndian, 23, 4)
|
14034 | return offset + 4
|
14035 | }
|
14036 |
|
14037 | Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
|
14038 | return writeFloat(this, value, offset, true, noAssert)
|
14039 | }
|
14040 |
|
14041 | Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
|
14042 | return writeFloat(this, value, offset, false, noAssert)
|
14043 | }
|
14044 |
|
14045 | function writeDouble (buf, value, offset, littleEndian, noAssert) {
|
14046 | value = +value
|
14047 | offset = offset >>> 0
|
14048 | if (!noAssert) {
|
14049 | checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)
|
14050 | }
|
14051 | ieee754.write(buf, value, offset, littleEndian, 52, 8)
|
14052 | return offset + 8
|
14053 | }
|
14054 |
|
14055 | Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
|
14056 | return writeDouble(this, value, offset, true, noAssert)
|
14057 | }
|
14058 |
|
14059 | Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
|
14060 | return writeDouble(this, value, offset, false, noAssert)
|
14061 | }
|
14062 |
|
14063 |
|
14064 | Buffer.prototype.copy = function copy (target, targetStart, start, end) {
|
14065 | if (!Buffer.isBuffer(target)) throw new TypeError('argument should be a Buffer')
|
14066 | if (!start) start = 0
|
14067 | if (!end && end !== 0) end = this.length
|
14068 | if (targetStart >= target.length) targetStart = target.length
|
14069 | if (!targetStart) targetStart = 0
|
14070 | if (end > 0 && end < start) end = start
|
14071 |
|
14072 |
|
14073 | if (end === start) return 0
|
14074 | if (target.length === 0 || this.length === 0) return 0
|
14075 |
|
14076 |
|
14077 | if (targetStart < 0) {
|
14078 | throw new RangeError('targetStart out of bounds')
|
14079 | }
|
14080 | if (start < 0 || start >= this.length) throw new RangeError('Index out of range')
|
14081 | if (end < 0) throw new RangeError('sourceEnd out of bounds')
|
14082 |
|
14083 |
|
14084 | if (end > this.length) end = this.length
|
14085 | if (target.length - targetStart < end - start) {
|
14086 | end = target.length - targetStart + start
|
14087 | }
|
14088 |
|
14089 | var len = end - start
|
14090 |
|
14091 | if (this === target && typeof Uint8Array.prototype.copyWithin === 'function') {
|
14092 |
|
14093 | this.copyWithin(targetStart, start, end)
|
14094 | } else if (this === target && start < targetStart && targetStart < end) {
|
14095 |
|
14096 | for (var i = len - 1; i >= 0; --i) {
|
14097 | target[i + targetStart] = this[i + start]
|
14098 | }
|
14099 | } else {
|
14100 | Uint8Array.prototype.set.call(
|
14101 | target,
|
14102 | this.subarray(start, end),
|
14103 | targetStart
|
14104 | )
|
14105 | }
|
14106 |
|
14107 | return len
|
14108 | }
|
14109 |
|
14110 |
|
14111 |
|
14112 |
|
14113 |
|
14114 | Buffer.prototype.fill = function fill (val, start, end, encoding) {
|
14115 |
|
14116 | if (typeof val === 'string') {
|
14117 | if (typeof start === 'string') {
|
14118 | encoding = start
|
14119 | start = 0
|
14120 | end = this.length
|
14121 | } else if (typeof end === 'string') {
|
14122 | encoding = end
|
14123 | end = this.length
|
14124 | }
|
14125 | if (encoding !== undefined && typeof encoding !== 'string') {
|
14126 | throw new TypeError('encoding must be a string')
|
14127 | }
|
14128 | if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
|
14129 | throw new TypeError('Unknown encoding: ' + encoding)
|
14130 | }
|
14131 | if (val.length === 1) {
|
14132 | var code = val.charCodeAt(0)
|
14133 | if ((encoding === 'utf8' && code < 128) ||
|
14134 | encoding === 'latin1') {
|
14135 |
|
14136 | val = code
|
14137 | }
|
14138 | }
|
14139 | } else if (typeof val === 'number') {
|
14140 | val = val & 255
|
14141 | }
|
14142 |
|
14143 |
|
14144 | if (start < 0 || this.length < start || this.length < end) {
|
14145 | throw new RangeError('Out of range index')
|
14146 | }
|
14147 |
|
14148 | if (end <= start) {
|
14149 | return this
|
14150 | }
|
14151 |
|
14152 | start = start >>> 0
|
14153 | end = end === undefined ? this.length : end >>> 0
|
14154 |
|
14155 | if (!val) val = 0
|
14156 |
|
14157 | var i
|
14158 | if (typeof val === 'number') {
|
14159 | for (i = start; i < end; ++i) {
|
14160 | this[i] = val
|
14161 | }
|
14162 | } else {
|
14163 | var bytes = Buffer.isBuffer(val)
|
14164 | ? val
|
14165 | : Buffer.from(val, encoding)
|
14166 | var len = bytes.length
|
14167 | if (len === 0) {
|
14168 | throw new TypeError('The value "' + val +
|
14169 | '" is invalid for argument "value"')
|
14170 | }
|
14171 | for (i = 0; i < end - start; ++i) {
|
14172 | this[i + start] = bytes[i % len]
|
14173 | }
|
14174 | }
|
14175 |
|
14176 | return this
|
14177 | }
|
14178 |
|
14179 |
|
14180 |
|
14181 |
|
14182 | var INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g
|
14183 |
|
14184 | function base64clean (str) {
|
14185 |
|
14186 | str = str.split('=')[0]
|
14187 |
|
14188 | str = str.trim().replace(INVALID_BASE64_RE, '')
|
14189 |
|
14190 | if (str.length < 2) return ''
|
14191 |
|
14192 | while (str.length % 4 !== 0) {
|
14193 | str = str + '='
|
14194 | }
|
14195 | return str
|
14196 | }
|
14197 |
|
14198 | function toHex (n) {
|
14199 | if (n < 16) return '0' + n.toString(16)
|
14200 | return n.toString(16)
|
14201 | }
|
14202 |
|
14203 | function utf8ToBytes (string, units) {
|
14204 | units = units || Infinity
|
14205 | var codePoint
|
14206 | var length = string.length
|
14207 | var leadSurrogate = null
|
14208 | var bytes = []
|
14209 |
|
14210 | for (var i = 0; i < length; ++i) {
|
14211 | codePoint = string.charCodeAt(i)
|
14212 |
|
14213 |
|
14214 | if (codePoint > 0xD7FF && codePoint < 0xE000) {
|
14215 |
|
14216 | if (!leadSurrogate) {
|
14217 |
|
14218 | if (codePoint > 0xDBFF) {
|
14219 |
|
14220 | if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
|
14221 | continue
|
14222 | } else if (i + 1 === length) {
|
14223 |
|
14224 | if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
|
14225 | continue
|
14226 | }
|
14227 |
|
14228 |
|
14229 | leadSurrogate = codePoint
|
14230 |
|
14231 | continue
|
14232 | }
|
14233 |
|
14234 |
|
14235 | if (codePoint < 0xDC00) {
|
14236 | if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
|
14237 | leadSurrogate = codePoint
|
14238 | continue
|
14239 | }
|
14240 |
|
14241 |
|
14242 | codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000
|
14243 | } else if (leadSurrogate) {
|
14244 |
|
14245 | if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
|
14246 | }
|
14247 |
|
14248 | leadSurrogate = null
|
14249 |
|
14250 |
|
14251 | if (codePoint < 0x80) {
|
14252 | if ((units -= 1) < 0) break
|
14253 | bytes.push(codePoint)
|
14254 | } else if (codePoint < 0x800) {
|
14255 | if ((units -= 2) < 0) break
|
14256 | bytes.push(
|
14257 | codePoint >> 0x6 | 0xC0,
|
14258 | codePoint & 0x3F | 0x80
|
14259 | )
|
14260 | } else if (codePoint < 0x10000) {
|
14261 | if ((units -= 3) < 0) break
|
14262 | bytes.push(
|
14263 | codePoint >> 0xC | 0xE0,
|
14264 | codePoint >> 0x6 & 0x3F | 0x80,
|
14265 | codePoint & 0x3F | 0x80
|
14266 | )
|
14267 | } else if (codePoint < 0x110000) {
|
14268 | if ((units -= 4) < 0) break
|
14269 | bytes.push(
|
14270 | codePoint >> 0x12 | 0xF0,
|
14271 | codePoint >> 0xC & 0x3F | 0x80,
|
14272 | codePoint >> 0x6 & 0x3F | 0x80,
|
14273 | codePoint & 0x3F | 0x80
|
14274 | )
|
14275 | } else {
|
14276 | throw new Error('Invalid code point')
|
14277 | }
|
14278 | }
|
14279 |
|
14280 | return bytes
|
14281 | }
|
14282 |
|
14283 | function asciiToBytes (str) {
|
14284 | var byteArray = []
|
14285 | for (var i = 0; i < str.length; ++i) {
|
14286 |
|
14287 | byteArray.push(str.charCodeAt(i) & 0xFF)
|
14288 | }
|
14289 | return byteArray
|
14290 | }
|
14291 |
|
14292 | function utf16leToBytes (str, units) {
|
14293 | var c, hi, lo
|
14294 | var byteArray = []
|
14295 | for (var i = 0; i < str.length; ++i) {
|
14296 | if ((units -= 2) < 0) break
|
14297 |
|
14298 | c = str.charCodeAt(i)
|
14299 | hi = c >> 8
|
14300 | lo = c % 256
|
14301 | byteArray.push(lo)
|
14302 | byteArray.push(hi)
|
14303 | }
|
14304 |
|
14305 | return byteArray
|
14306 | }
|
14307 |
|
14308 | function base64ToBytes (str) {
|
14309 | return base64.toByteArray(base64clean(str))
|
14310 | }
|
14311 |
|
14312 | function blitBuffer (src, dst, offset, length) {
|
14313 | for (var i = 0; i < length; ++i) {
|
14314 | if ((i + offset >= dst.length) || (i >= src.length)) break
|
14315 | dst[i + offset] = src[i]
|
14316 | }
|
14317 | return i
|
14318 | }
|
14319 |
|
14320 |
|
14321 |
|
14322 |
|
14323 | function isInstance (obj, type) {
|
14324 | return obj instanceof type ||
|
14325 | (obj != null && obj.constructor != null && obj.constructor.name != null &&
|
14326 | obj.constructor.name === type.name)
|
14327 | }
|
14328 | function numberIsNaN (obj) {
|
14329 |
|
14330 | return obj !== obj
|
14331 | }
|
14332 |
|
14333 | }).call(this,require("buffer").Buffer)
|
14334 | },{"base64-js":76,"buffer":98,"ieee754":300}],99:[function(require,module,exports){
|
14335 | module.exports = {
|
14336 | "100": "Continue",
|
14337 | "101": "Switching Protocols",
|
14338 | "102": "Processing",
|
14339 | "200": "OK",
|
14340 | "201": "Created",
|
14341 | "202": "Accepted",
|
14342 | "203": "Non-Authoritative Information",
|
14343 | "204": "No Content",
|
14344 | "205": "Reset Content",
|
14345 | "206": "Partial Content",
|
14346 | "207": "Multi-Status",
|
14347 | "208": "Already Reported",
|
14348 | "226": "IM Used",
|
14349 | "300": "Multiple Choices",
|
14350 | "301": "Moved Permanently",
|
14351 | "302": "Found",
|
14352 | "303": "See Other",
|
14353 | "304": "Not Modified",
|
14354 | "305": "Use Proxy",
|
14355 | "307": "Temporary Redirect",
|
14356 | "308": "Permanent Redirect",
|
14357 | "400": "Bad Request",
|
14358 | "401": "Unauthorized",
|
14359 | "402": "Payment Required",
|
14360 | "403": "Forbidden",
|
14361 | "404": "Not Found",
|
14362 | "405": "Method Not Allowed",
|
14363 | "406": "Not Acceptable",
|
14364 | "407": "Proxy Authentication Required",
|
14365 | "408": "Request Timeout",
|
14366 | "409": "Conflict",
|
14367 | "410": "Gone",
|
14368 | "411": "Length Required",
|
14369 | "412": "Precondition Failed",
|
14370 | "413": "Payload Too Large",
|
14371 | "414": "URI Too Long",
|
14372 | "415": "Unsupported Media Type",
|
14373 | "416": "Range Not Satisfiable",
|
14374 | "417": "Expectation Failed",
|
14375 | "418": "I'm a teapot",
|
14376 | "421": "Misdirected Request",
|
14377 | "422": "Unprocessable Entity",
|
14378 | "423": "Locked",
|
14379 | "424": "Failed Dependency",
|
14380 | "425": "Unordered Collection",
|
14381 | "426": "Upgrade Required",
|
14382 | "428": "Precondition Required",
|
14383 | "429": "Too Many Requests",
|
14384 | "431": "Request Header Fields Too Large",
|
14385 | "451": "Unavailable For Legal Reasons",
|
14386 | "500": "Internal Server Error",
|
14387 | "501": "Not Implemented",
|
14388 | "502": "Bad Gateway",
|
14389 | "503": "Service Unavailable",
|
14390 | "504": "Gateway Timeout",
|
14391 | "505": "HTTP Version Not Supported",
|
14392 | "506": "Variant Also Negotiates",
|
14393 | "507": "Insufficient Storage",
|
14394 | "508": "Loop Detected",
|
14395 | "509": "Bandwidth Limit Exceeded",
|
14396 | "510": "Not Extended",
|
14397 | "511": "Network Authentication Required"
|
14398 | }
|
14399 |
|
14400 | },{}],100:[function(require,module,exports){
|
14401 | module.exports={
|
14402 | "O_RDONLY": 0,
|
14403 | "O_WRONLY": 1,
|
14404 | "O_RDWR": 2,
|
14405 | "S_IFMT": 61440,
|
14406 | "S_IFREG": 32768,
|
14407 | "S_IFDIR": 16384,
|
14408 | "S_IFCHR": 8192,
|
14409 | "S_IFBLK": 24576,
|
14410 | "S_IFIFO": 4096,
|
14411 | "S_IFLNK": 40960,
|
14412 | "S_IFSOCK": 49152,
|
14413 | "O_CREAT": 512,
|
14414 | "O_EXCL": 2048,
|
14415 | "O_NOCTTY": 131072,
|
14416 | "O_TRUNC": 1024,
|
14417 | "O_APPEND": 8,
|
14418 | "O_DIRECTORY": 1048576,
|
14419 | "O_NOFOLLOW": 256,
|
14420 | "O_SYNC": 128,
|
14421 | "O_SYMLINK": 2097152,
|
14422 | "O_NONBLOCK": 4,
|
14423 | "S_IRWXU": 448,
|
14424 | "S_IRUSR": 256,
|
14425 | "S_IWUSR": 128,
|
14426 | "S_IXUSR": 64,
|
14427 | "S_IRWXG": 56,
|
14428 | "S_IRGRP": 32,
|
14429 | "S_IWGRP": 16,
|
14430 | "S_IXGRP": 8,
|
14431 | "S_IRWXO": 7,
|
14432 | "S_IROTH": 4,
|
14433 | "S_IWOTH": 2,
|
14434 | "S_IXOTH": 1,
|
14435 | "E2BIG": 7,
|
14436 | "EACCES": 13,
|
14437 | "EADDRINUSE": 48,
|
14438 | "EADDRNOTAVAIL": 49,
|
14439 | "EAFNOSUPPORT": 47,
|
14440 | "EAGAIN": 35,
|
14441 | "EALREADY": 37,
|
14442 | "EBADF": 9,
|
14443 | "EBADMSG": 94,
|
14444 | "EBUSY": 16,
|
14445 | "ECANCELED": 89,
|
14446 | "ECHILD": 10,
|
14447 | "ECONNABORTED": 53,
|
14448 | "ECONNREFUSED": 61,
|
14449 | "ECONNRESET": 54,
|
14450 | "EDEADLK": 11,
|
14451 | "EDESTADDRREQ": 39,
|
14452 | "EDOM": 33,
|
14453 | "EDQUOT": 69,
|
14454 | "EEXIST": 17,
|
14455 | "EFAULT": 14,
|
14456 | "EFBIG": 27,
|
14457 | "EHOSTUNREACH": 65,
|
14458 | "EIDRM": 90,
|
14459 | "EILSEQ": 92,
|
14460 | "EINPROGRESS": 36,
|
14461 | "EINTR": 4,
|
14462 | "EINVAL": 22,
|
14463 | "EIO": 5,
|
14464 | "EISCONN": 56,
|
14465 | "EISDIR": 21,
|
14466 | "ELOOP": 62,
|
14467 | "EMFILE": 24,
|
14468 | "EMLINK": 31,
|
14469 | "EMSGSIZE": 40,
|
14470 | "EMULTIHOP": 95,
|
14471 | "ENAMETOOLONG": 63,
|
14472 | "ENETDOWN": 50,
|
14473 | "ENETRESET": 52,
|
14474 | "ENETUNREACH": 51,
|
14475 | "ENFILE": 23,
|
14476 | "ENOBUFS": 55,
|
14477 | "ENODATA": 96,
|
14478 | "ENODEV": 19,
|
14479 | "ENOENT": 2,
|
14480 | "ENOEXEC": 8,
|
14481 | "ENOLCK": 77,
|
14482 | "ENOLINK": 97,
|
14483 | "ENOMEM": 12,
|
14484 | "ENOMSG": 91,
|
14485 | "ENOPROTOOPT": 42,
|
14486 | "ENOSPC": 28,
|
14487 | "ENOSR": 98,
|
14488 | "ENOSTR": 99,
|
14489 | "ENOSYS": 78,
|
14490 | "ENOTCONN": 57,
|
14491 | "ENOTDIR": 20,
|
14492 | "ENOTEMPTY": 66,
|
14493 | "ENOTSOCK": 38,
|
14494 | "ENOTSUP": 45,
|
14495 | "ENOTTY": 25,
|
14496 | "ENXIO": 6,
|
14497 | "EOPNOTSUPP": 102,
|
14498 | "EOVERFLOW": 84,
|
14499 | "EPERM": 1,
|
14500 | "EPIPE": 32,
|
14501 | "EPROTO": 100,
|
14502 | "EPROTONOSUPPORT": 43,
|
14503 | "EPROTOTYPE": 41,
|
14504 | "ERANGE": 34,
|
14505 | "EROFS": 30,
|
14506 | "ESPIPE": 29,
|
14507 | "ESRCH": 3,
|
14508 | "ESTALE": 70,
|
14509 | "ETIME": 101,
|
14510 | "ETIMEDOUT": 60,
|
14511 | "ETXTBSY": 26,
|
14512 | "EWOULDBLOCK": 35,
|
14513 | "EXDEV": 18,
|
14514 | "SIGHUP": 1,
|
14515 | "SIGINT": 2,
|
14516 | "SIGQUIT": 3,
|
14517 | "SIGILL": 4,
|
14518 | "SIGTRAP": 5,
|
14519 | "SIGABRT": 6,
|
14520 | "SIGIOT": 6,
|
14521 | "SIGBUS": 10,
|
14522 | "SIGFPE": 8,
|
14523 | "SIGKILL": 9,
|
14524 | "SIGUSR1": 30,
|
14525 | "SIGSEGV": 11,
|
14526 | "SIGUSR2": 31,
|
14527 | "SIGPIPE": 13,
|
14528 | "SIGALRM": 14,
|
14529 | "SIGTERM": 15,
|
14530 | "SIGCHLD": 20,
|
14531 | "SIGCONT": 19,
|
14532 | "SIGSTOP": 17,
|
14533 | "SIGTSTP": 18,
|
14534 | "SIGTTIN": 21,
|
14535 | "SIGTTOU": 22,
|
14536 | "SIGURG": 16,
|
14537 | "SIGXCPU": 24,
|
14538 | "SIGXFSZ": 25,
|
14539 | "SIGVTALRM": 26,
|
14540 | "SIGPROF": 27,
|
14541 | "SIGWINCH": 28,
|
14542 | "SIGIO": 23,
|
14543 | "SIGSYS": 12,
|
14544 | "SSL_OP_ALL": 2147486719,
|
14545 | "SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION": 262144,
|
14546 | "SSL_OP_CIPHER_SERVER_PREFERENCE": 4194304,
|
14547 | "SSL_OP_CISCO_ANYCONNECT": 32768,
|
14548 | "SSL_OP_COOKIE_EXCHANGE": 8192,
|
14549 | "SSL_OP_CRYPTOPRO_TLSEXT_BUG": 2147483648,
|
14550 | "SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS": 2048,
|
14551 | "SSL_OP_EPHEMERAL_RSA": 0,
|
14552 | "SSL_OP_LEGACY_SERVER_CONNECT": 4,
|
14553 | "SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER": 32,
|
14554 | "SSL_OP_MICROSOFT_SESS_ID_BUG": 1,
|
14555 | "SSL_OP_MSIE_SSLV2_RSA_PADDING": 0,
|
14556 | "SSL_OP_NETSCAPE_CA_DN_BUG": 536870912,
|
14557 | "SSL_OP_NETSCAPE_CHALLENGE_BUG": 2,
|
14558 | "SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG": 1073741824,
|
14559 | "SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG": 8,
|
14560 | "SSL_OP_NO_COMPRESSION": 131072,
|
14561 | "SSL_OP_NO_QUERY_MTU": 4096,
|
14562 | "SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION": 65536,
|
14563 | "SSL_OP_NO_SSLv2": 16777216,
|
14564 | "SSL_OP_NO_SSLv3": 33554432,
|
14565 | "SSL_OP_NO_TICKET": 16384,
|
14566 | "SSL_OP_NO_TLSv1": 67108864,
|
14567 | "SSL_OP_NO_TLSv1_1": 268435456,
|
14568 | "SSL_OP_NO_TLSv1_2": 134217728,
|
14569 | "SSL_OP_PKCS1_CHECK_1": 0,
|
14570 | "SSL_OP_PKCS1_CHECK_2": 0,
|
14571 | "SSL_OP_SINGLE_DH_USE": 1048576,
|
14572 | "SSL_OP_SINGLE_ECDH_USE": 524288,
|
14573 | "SSL_OP_SSLEAY_080_CLIENT_DH_BUG": 128,
|
14574 | "SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG": 0,
|
14575 | "SSL_OP_TLS_BLOCK_PADDING_BUG": 512,
|
14576 | "SSL_OP_TLS_D5_BUG": 256,
|
14577 | "SSL_OP_TLS_ROLLBACK_BUG": 8388608,
|
14578 | "ENGINE_METHOD_DSA": 2,
|
14579 | "ENGINE_METHOD_DH": 4,
|
14580 | "ENGINE_METHOD_RAND": 8,
|
14581 | "ENGINE_METHOD_ECDH": 16,
|
14582 | "ENGINE_METHOD_ECDSA": 32,
|
14583 | "ENGINE_METHOD_CIPHERS": 64,
|
14584 | "ENGINE_METHOD_DIGESTS": 128,
|
14585 | "ENGINE_METHOD_STORE": 256,
|
14586 | "ENGINE_METHOD_PKEY_METHS": 512,
|
14587 | "ENGINE_METHOD_PKEY_ASN1_METHS": 1024,
|
14588 | "ENGINE_METHOD_ALL": 65535,
|
14589 | "ENGINE_METHOD_NONE": 0,
|
14590 | "DH_CHECK_P_NOT_SAFE_PRIME": 2,
|
14591 | "DH_CHECK_P_NOT_PRIME": 1,
|
14592 | "DH_UNABLE_TO_CHECK_GENERATOR": 4,
|
14593 | "DH_NOT_SUITABLE_GENERATOR": 8,
|
14594 | "NPN_ENABLED": 1,
|
14595 | "RSA_PKCS1_PADDING": 1,
|
14596 | "RSA_SSLV23_PADDING": 2,
|
14597 | "RSA_NO_PADDING": 3,
|
14598 | "RSA_PKCS1_OAEP_PADDING": 4,
|
14599 | "RSA_X931_PADDING": 5,
|
14600 | "RSA_PKCS1_PSS_PADDING": 6,
|
14601 | "POINT_CONVERSION_COMPRESSED": 2,
|
14602 | "POINT_CONVERSION_UNCOMPRESSED": 4,
|
14603 | "POINT_CONVERSION_HYBRID": 6,
|
14604 | "F_OK": 0,
|
14605 | "R_OK": 4,
|
14606 | "W_OK": 2,
|
14607 | "X_OK": 1,
|
14608 | "UV_UDP_REUSEADDR": 4
|
14609 | }
|
14610 |
|
14611 | },{}],101:[function(require,module,exports){
|
14612 |
|
14613 |
|
14614 |
|
14615 |
|
14616 |
|
14617 |
|
14618 | 'use strict';
|
14619 |
|
14620 |
|
14621 |
|
14622 |
|
14623 |
|
14624 | var slice = Array.prototype.slice;
|
14625 |
|
14626 |
|
14627 |
|
14628 |
|
14629 |
|
14630 |
|
14631 |
|
14632 |
|
14633 |
|
14634 |
|
14635 |
|
14636 |
|
14637 |
|
14638 | module.exports = Copy;
|
14639 |
|
14640 |
|
14641 |
|
14642 |
|
14643 |
|
14644 |
|
14645 |
|
14646 |
|
14647 | function Copy(src, withAccess) {
|
14648 | if (!(this instanceof Copy)) return new Copy(src, withAccess);
|
14649 | this.src = src;
|
14650 | this._withAccess = withAccess;
|
14651 | }
|
14652 |
|
14653 |
|
14654 |
|
14655 |
|
14656 |
|
14657 |
|
14658 |
|
14659 | Copy.prototype.withAccess = function (w) {
|
14660 | this._withAccess = w !== false;
|
14661 | return this;
|
14662 | };
|
14663 |
|
14664 |
|
14665 |
|
14666 |
|
14667 |
|
14668 |
|
14669 |
|
14670 | Copy.prototype.pick = function(keys) {
|
14671 | if (!Array.isArray(keys)) {
|
14672 | keys = slice.call(arguments);
|
14673 | }
|
14674 | if (keys.length) {
|
14675 | this.keys = keys;
|
14676 | }
|
14677 | return this;
|
14678 | };
|
14679 |
|
14680 |
|
14681 |
|
14682 |
|
14683 |
|
14684 |
|
14685 |
|
14686 |
|
14687 |
|
14688 | Copy.prototype.to = function(to) {
|
14689 | to = to || {};
|
14690 |
|
14691 | if (!this.src) return to;
|
14692 | var keys = this.keys || Object.keys(this.src);
|
14693 |
|
14694 | if (!this._withAccess) {
|
14695 | for (var i = 0; i < keys.length; i++) {
|
14696 | key = keys[i];
|
14697 | if (to[key] !== undefined) continue;
|
14698 | to[key] = this.src[key];
|
14699 | }
|
14700 | return to;
|
14701 | }
|
14702 |
|
14703 | for (var i = 0; i < keys.length; i++) {
|
14704 | var key = keys[i];
|
14705 | if (!notDefined(to, key)) continue;
|
14706 | var getter = this.src.__lookupGetter__(key);
|
14707 | var setter = this.src.__lookupSetter__(key);
|
14708 | if (getter) to.__defineGetter__(key, getter);
|
14709 | if (setter) to.__defineSetter__(key, setter);
|
14710 |
|
14711 | if (!getter && !setter) {
|
14712 | to[key] = this.src[key];
|
14713 | }
|
14714 | }
|
14715 | return to;
|
14716 | };
|
14717 |
|
14718 |
|
14719 |
|
14720 |
|
14721 |
|
14722 |
|
14723 |
|
14724 |
|
14725 |
|
14726 | Copy.prototype.toCover = function(to) {
|
14727 | var keys = this.keys || Object.keys(this.src);
|
14728 |
|
14729 | for (var i = 0; i < keys.length; i++) {
|
14730 | var key = keys[i];
|
14731 | delete to[key];
|
14732 | var getter = this.src.__lookupGetter__(key);
|
14733 | var setter = this.src.__lookupSetter__(key);
|
14734 | if (getter) to.__defineGetter__(key, getter);
|
14735 | if (setter) to.__defineSetter__(key, setter);
|
14736 |
|
14737 | if (!getter && !setter) {
|
14738 | to[key] = this.src[key];
|
14739 | }
|
14740 | }
|
14741 | };
|
14742 |
|
14743 | Copy.prototype.override = Copy.prototype.toCover;
|
14744 |
|
14745 |
|
14746 |
|
14747 |
|
14748 |
|
14749 |
|
14750 |
|
14751 | Copy.prototype.and = function (obj) {
|
14752 | var src = {};
|
14753 | this.to(src);
|
14754 | this.src = obj;
|
14755 | this.to(src);
|
14756 | this.src = src;
|
14757 |
|
14758 | return this;
|
14759 | };
|
14760 |
|
14761 |
|
14762 |
|
14763 |
|
14764 |
|
14765 |
|
14766 |
|
14767 |
|
14768 | function notDefined(obj, key) {
|
14769 | return obj[key] === undefined
|
14770 | && obj.__lookupGetter__(key) === undefined
|
14771 | && obj.__lookupSetter__(key) === undefined;
|
14772 | }
|
14773 |
|
14774 | },{}],102:[function(require,module,exports){
|
14775 | module.exports = function (it) {
|
14776 | if (typeof it != 'function') {
|
14777 | throw TypeError(String(it) + ' is not a function');
|
14778 | } return it;
|
14779 | };
|
14780 |
|
14781 | },{}],103:[function(require,module,exports){
|
14782 | var isObject = require('../internals/is-object');
|
14783 |
|
14784 | module.exports = function (it) {
|
14785 | if (!isObject(it) && it !== null) {
|
14786 | throw TypeError("Can't set " + String(it) + ' as a prototype');
|
14787 | } return it;
|
14788 | };
|
14789 |
|
14790 | },{"../internals/is-object":164}],104:[function(require,module,exports){
|
14791 | var wellKnownSymbol = require('../internals/well-known-symbol');
|
14792 | var create = require('../internals/object-create');
|
14793 | var definePropertyModule = require('../internals/object-define-property');
|
14794 |
|
14795 | var UNSCOPABLES = wellKnownSymbol('unscopables');
|
14796 | var ArrayPrototype = Array.prototype;
|
14797 |
|
14798 |
|
14799 |
|
14800 | if (ArrayPrototype[UNSCOPABLES] == undefined) {
|
14801 | definePropertyModule.f(ArrayPrototype, UNSCOPABLES, {
|
14802 | configurable: true,
|
14803 | value: create(null)
|
14804 | });
|
14805 | }
|
14806 |
|
14807 |
|
14808 | module.exports = function (key) {
|
14809 | ArrayPrototype[UNSCOPABLES][key] = true;
|
14810 | };
|
14811 |
|
14812 | },{"../internals/object-create":178,"../internals/object-define-property":180,"../internals/well-known-symbol":231}],105:[function(require,module,exports){
|
14813 | 'use strict';
|
14814 | var charAt = require('../internals/string-multibyte').charAt;
|
14815 |
|
14816 |
|
14817 |
|
14818 | module.exports = function (S, index, unicode) {
|
14819 | return index + (unicode ? charAt(S, index).length : 1);
|
14820 | };
|
14821 |
|
14822 | },{"../internals/string-multibyte":211}],106:[function(require,module,exports){
|
14823 | module.exports = function (it, Constructor, name) {
|
14824 | if (!(it instanceof Constructor)) {
|
14825 | throw TypeError('Incorrect ' + (name ? name + ' ' : '') + 'invocation');
|
14826 | } return it;
|
14827 | };
|
14828 |
|
14829 | },{}],107:[function(require,module,exports){
|
14830 | var isObject = require('../internals/is-object');
|
14831 |
|
14832 | module.exports = function (it) {
|
14833 | if (!isObject(it)) {
|
14834 | throw TypeError(String(it) + ' is not an object');
|
14835 | } return it;
|
14836 | };
|
14837 |
|
14838 | },{"../internals/is-object":164}],108:[function(require,module,exports){
|
14839 | module.exports = typeof ArrayBuffer !== 'undefined' && typeof DataView !== 'undefined';
|
14840 |
|
14841 | },{}],109:[function(require,module,exports){
|
14842 | 'use strict';
|
14843 | var NATIVE_ARRAY_BUFFER = require('../internals/array-buffer-native');
|
14844 | var DESCRIPTORS = require('../internals/descriptors');
|
14845 | var global = require('../internals/global');
|
14846 | var isObject = require('../internals/is-object');
|
14847 | var has = require('../internals/has');
|
14848 | var classof = require('../internals/classof');
|
14849 | var createNonEnumerableProperty = require('../internals/create-non-enumerable-property');
|
14850 | var redefine = require('../internals/redefine');
|
14851 | var defineProperty = require('../internals/object-define-property').f;
|
14852 | var getPrototypeOf = require('../internals/object-get-prototype-of');
|
14853 | var setPrototypeOf = require('../internals/object-set-prototype-of');
|
14854 | var wellKnownSymbol = require('../internals/well-known-symbol');
|
14855 | var uid = require('../internals/uid');
|
14856 |
|
14857 | var Int8Array = global.Int8Array;
|
14858 | var Int8ArrayPrototype = Int8Array && Int8Array.prototype;
|
14859 | var Uint8ClampedArray = global.Uint8ClampedArray;
|
14860 | var Uint8ClampedArrayPrototype = Uint8ClampedArray && Uint8ClampedArray.prototype;
|
14861 | var TypedArray = Int8Array && getPrototypeOf(Int8Array);
|
14862 | var TypedArrayPrototype = Int8ArrayPrototype && getPrototypeOf(Int8ArrayPrototype);
|
14863 | var ObjectPrototype = Object.prototype;
|
14864 | var isPrototypeOf = ObjectPrototype.isPrototypeOf;
|
14865 |
|
14866 | var TO_STRING_TAG = wellKnownSymbol('toStringTag');
|
14867 | var TYPED_ARRAY_TAG = uid('TYPED_ARRAY_TAG');
|
14868 |
|
14869 | var NATIVE_ARRAY_BUFFER_VIEWS = NATIVE_ARRAY_BUFFER && !!setPrototypeOf && classof(global.opera) !== 'Opera';
|
14870 | var TYPED_ARRAY_TAG_REQIRED = false;
|
14871 | var NAME;
|
14872 |
|
14873 | var TypedArrayConstructorsList = {
|
14874 | Int8Array: 1,
|
14875 | Uint8Array: 1,
|
14876 | Uint8ClampedArray: 1,
|
14877 | Int16Array: 2,
|
14878 | Uint16Array: 2,
|
14879 | Int32Array: 4,
|
14880 | Uint32Array: 4,
|
14881 | Float32Array: 4,
|
14882 | Float64Array: 8
|
14883 | };
|
14884 |
|
14885 | var isView = function isView(it) {
|
14886 | var klass = classof(it);
|
14887 | return klass === 'DataView' || has(TypedArrayConstructorsList, klass);
|
14888 | };
|
14889 |
|
14890 | var isTypedArray = function (it) {
|
14891 | return isObject(it) && has(TypedArrayConstructorsList, classof(it));
|
14892 | };
|
14893 |
|
14894 | var aTypedArray = function (it) {
|
14895 | if (isTypedArray(it)) return it;
|
14896 | throw TypeError('Target is not a typed array');
|
14897 | };
|
14898 |
|
14899 | var aTypedArrayConstructor = function (C) {
|
14900 | if (setPrototypeOf) {
|
14901 | if (isPrototypeOf.call(TypedArray, C)) return C;
|
14902 | } else for (var ARRAY in TypedArrayConstructorsList) if (has(TypedArrayConstructorsList, NAME)) {
|
14903 | var TypedArrayConstructor = global[ARRAY];
|
14904 | if (TypedArrayConstructor && (C === TypedArrayConstructor || isPrototypeOf.call(TypedArrayConstructor, C))) {
|
14905 | return C;
|
14906 | }
|
14907 | } throw TypeError('Target is not a typed array constructor');
|
14908 | };
|
14909 |
|
14910 | var exportTypedArrayMethod = function (KEY, property, forced) {
|
14911 | if (!DESCRIPTORS) return;
|
14912 | if (forced) for (var ARRAY in TypedArrayConstructorsList) {
|
14913 | var TypedArrayConstructor = global[ARRAY];
|
14914 | if (TypedArrayConstructor && has(TypedArrayConstructor.prototype, KEY)) {
|
14915 | delete TypedArrayConstructor.prototype[KEY];
|
14916 | }
|
14917 | }
|
14918 | if (!TypedArrayPrototype[KEY] || forced) {
|
14919 | redefine(TypedArrayPrototype, KEY, forced ? property
|
14920 | : NATIVE_ARRAY_BUFFER_VIEWS && Int8ArrayPrototype[KEY] || property);
|
14921 | }
|
14922 | };
|
14923 |
|
14924 | var exportTypedArrayStaticMethod = function (KEY, property, forced) {
|
14925 | var ARRAY, TypedArrayConstructor;
|
14926 | if (!DESCRIPTORS) return;
|
14927 | if (setPrototypeOf) {
|
14928 | if (forced) for (ARRAY in TypedArrayConstructorsList) {
|
14929 | TypedArrayConstructor = global[ARRAY];
|
14930 | if (TypedArrayConstructor && has(TypedArrayConstructor, KEY)) {
|
14931 | delete TypedArrayConstructor[KEY];
|
14932 | }
|
14933 | }
|
14934 | if (!TypedArray[KEY] || forced) {
|
14935 |
|
14936 | try {
|
14937 | return redefine(TypedArray, KEY, forced ? property : NATIVE_ARRAY_BUFFER_VIEWS && Int8Array[KEY] || property);
|
14938 | } catch (error) { }
|
14939 | } else return;
|
14940 | }
|
14941 | for (ARRAY in TypedArrayConstructorsList) {
|
14942 | TypedArrayConstructor = global[ARRAY];
|
14943 | if (TypedArrayConstructor && (!TypedArrayConstructor[KEY] || forced)) {
|
14944 | redefine(TypedArrayConstructor, KEY, property);
|
14945 | }
|
14946 | }
|
14947 | };
|
14948 |
|
14949 | for (NAME in TypedArrayConstructorsList) {
|
14950 | if (!global[NAME]) NATIVE_ARRAY_BUFFER_VIEWS = false;
|
14951 | }
|
14952 |
|
14953 |
|
14954 | if (!NATIVE_ARRAY_BUFFER_VIEWS || typeof TypedArray != 'function' || TypedArray === Function.prototype) {
|
14955 |
|
14956 | TypedArray = function TypedArray() {
|
14957 | throw TypeError('Incorrect invocation');
|
14958 | };
|
14959 | if (NATIVE_ARRAY_BUFFER_VIEWS) for (NAME in TypedArrayConstructorsList) {
|
14960 | if (global[NAME]) setPrototypeOf(global[NAME], TypedArray);
|
14961 | }
|
14962 | }
|
14963 |
|
14964 | if (!NATIVE_ARRAY_BUFFER_VIEWS || !TypedArrayPrototype || TypedArrayPrototype === ObjectPrototype) {
|
14965 | TypedArrayPrototype = TypedArray.prototype;
|
14966 | if (NATIVE_ARRAY_BUFFER_VIEWS) for (NAME in TypedArrayConstructorsList) {
|
14967 | if (global[NAME]) setPrototypeOf(global[NAME].prototype, TypedArrayPrototype);
|
14968 | }
|
14969 | }
|
14970 |
|
14971 |
|
14972 | if (NATIVE_ARRAY_BUFFER_VIEWS && getPrototypeOf(Uint8ClampedArrayPrototype) !== TypedArrayPrototype) {
|
14973 | setPrototypeOf(Uint8ClampedArrayPrototype, TypedArrayPrototype);
|
14974 | }
|
14975 |
|
14976 | if (DESCRIPTORS && !has(TypedArrayPrototype, TO_STRING_TAG)) {
|
14977 | TYPED_ARRAY_TAG_REQIRED = true;
|
14978 | defineProperty(TypedArrayPrototype, TO_STRING_TAG, { get: function () {
|
14979 | return isObject(this) ? this[TYPED_ARRAY_TAG] : undefined;
|
14980 | } });
|
14981 | for (NAME in TypedArrayConstructorsList) if (global[NAME]) {
|
14982 | createNonEnumerableProperty(global[NAME], TYPED_ARRAY_TAG, NAME);
|
14983 | }
|
14984 | }
|
14985 |
|
14986 | module.exports = {
|
14987 | NATIVE_ARRAY_BUFFER_VIEWS: NATIVE_ARRAY_BUFFER_VIEWS,
|
14988 | TYPED_ARRAY_TAG: TYPED_ARRAY_TAG_REQIRED && TYPED_ARRAY_TAG,
|
14989 | aTypedArray: aTypedArray,
|
14990 | aTypedArrayConstructor: aTypedArrayConstructor,
|
14991 | exportTypedArrayMethod: exportTypedArrayMethod,
|
14992 | exportTypedArrayStaticMethod: exportTypedArrayStaticMethod,
|
14993 | isView: isView,
|
14994 | isTypedArray: isTypedArray,
|
14995 | TypedArray: TypedArray,
|
14996 | TypedArrayPrototype: TypedArrayPrototype
|
14997 | };
|
14998 |
|
14999 | },{"../internals/array-buffer-native":108,"../internals/classof":126,"../internals/create-non-enumerable-property":131,"../internals/descriptors":136,"../internals/global":150,"../internals/has":151,"../internals/is-object":164,"../internals/object-define-property":180,"../internals/object-get-prototype-of":185,"../internals/object-set-prototype-of":189,"../internals/redefine":197,"../internals/uid":228,"../internals/well-known-symbol":231}],110:[function(require,module,exports){
|
15000 | 'use strict';
|
15001 | var global = require('../internals/global');
|
15002 | var DESCRIPTORS = require('../internals/descriptors');
|
15003 | var NATIVE_ARRAY_BUFFER = require('../internals/array-buffer-native');
|
15004 | var createNonEnumerableProperty = require('../internals/create-non-enumerable-property');
|
15005 | var redefineAll = require('../internals/redefine-all');
|
15006 | var fails = require('../internals/fails');
|
15007 | var anInstance = require('../internals/an-instance');
|
15008 | var toInteger = require('../internals/to-integer');
|
15009 | var toLength = require('../internals/to-length');
|
15010 | var toIndex = require('../internals/to-index');
|
15011 | var IEEE754 = require('../internals/ieee754');
|
15012 | var getPrototypeOf = require('../internals/object-get-prototype-of');
|
15013 | var setPrototypeOf = require('../internals/object-set-prototype-of');
|
15014 | var getOwnPropertyNames = require('../internals/object-get-own-property-names').f;
|
15015 | var defineProperty = require('../internals/object-define-property').f;
|
15016 | var arrayFill = require('../internals/array-fill');
|
15017 | var setToStringTag = require('../internals/set-to-string-tag');
|
15018 | var InternalStateModule = require('../internals/internal-state');
|
15019 |
|
15020 | var getInternalState = InternalStateModule.get;
|
15021 | var setInternalState = InternalStateModule.set;
|
15022 | var ARRAY_BUFFER = 'ArrayBuffer';
|
15023 | var DATA_VIEW = 'DataView';
|
15024 | var PROTOTYPE = 'prototype';
|
15025 | var WRONG_LENGTH = 'Wrong length';
|
15026 | var WRONG_INDEX = 'Wrong index';
|
15027 | var NativeArrayBuffer = global[ARRAY_BUFFER];
|
15028 | var $ArrayBuffer = NativeArrayBuffer;
|
15029 | var $DataView = global[DATA_VIEW];
|
15030 | var $DataViewPrototype = $DataView && $DataView[PROTOTYPE];
|
15031 | var ObjectPrototype = Object.prototype;
|
15032 | var RangeError = global.RangeError;
|
15033 |
|
15034 | var packIEEE754 = IEEE754.pack;
|
15035 | var unpackIEEE754 = IEEE754.unpack;
|
15036 |
|
15037 | var packInt8 = function (number) {
|
15038 | return [number & 0xFF];
|
15039 | };
|
15040 |
|
15041 | var packInt16 = function (number) {
|
15042 | return [number & 0xFF, number >> 8 & 0xFF];
|
15043 | };
|
15044 |
|
15045 | var packInt32 = function (number) {
|
15046 | return [number & 0xFF, number >> 8 & 0xFF, number >> 16 & 0xFF, number >> 24 & 0xFF];
|
15047 | };
|
15048 |
|
15049 | var unpackInt32 = function (buffer) {
|
15050 | return buffer[3] << 24 | buffer[2] << 16 | buffer[1] << 8 | buffer[0];
|
15051 | };
|
15052 |
|
15053 | var packFloat32 = function (number) {
|
15054 | return packIEEE754(number, 23, 4);
|
15055 | };
|
15056 |
|
15057 | var packFloat64 = function (number) {
|
15058 | return packIEEE754(number, 52, 8);
|
15059 | };
|
15060 |
|
15061 | var addGetter = function (Constructor, key) {
|
15062 | defineProperty(Constructor[PROTOTYPE], key, { get: function () { return getInternalState(this)[key]; } });
|
15063 | };
|
15064 |
|
15065 | var get = function (view, count, index, isLittleEndian) {
|
15066 | var intIndex = toIndex(index);
|
15067 | var store = getInternalState(view);
|
15068 | if (intIndex + count > store.byteLength) throw RangeError(WRONG_INDEX);
|
15069 | var bytes = getInternalState(store.buffer).bytes;
|
15070 | var start = intIndex + store.byteOffset;
|
15071 | var pack = bytes.slice(start, start + count);
|
15072 | return isLittleEndian ? pack : pack.reverse();
|
15073 | };
|
15074 |
|
15075 | var set = function (view, count, index, conversion, value, isLittleEndian) {
|
15076 | var intIndex = toIndex(index);
|
15077 | var store = getInternalState(view);
|
15078 | if (intIndex + count > store.byteLength) throw RangeError(WRONG_INDEX);
|
15079 | var bytes = getInternalState(store.buffer).bytes;
|
15080 | var start = intIndex + store.byteOffset;
|
15081 | var pack = conversion(+value);
|
15082 | for (var i = 0; i < count; i++) bytes[start + i] = pack[isLittleEndian ? i : count - i - 1];
|
15083 | };
|
15084 |
|
15085 | if (!NATIVE_ARRAY_BUFFER) {
|
15086 | $ArrayBuffer = function ArrayBuffer(length) {
|
15087 | anInstance(this, $ArrayBuffer, ARRAY_BUFFER);
|
15088 | var byteLength = toIndex(length);
|
15089 | setInternalState(this, {
|
15090 | bytes: arrayFill.call(new Array(byteLength), 0),
|
15091 | byteLength: byteLength
|
15092 | });
|
15093 | if (!DESCRIPTORS) this.byteLength = byteLength;
|
15094 | };
|
15095 |
|
15096 | $DataView = function DataView(buffer, byteOffset, byteLength) {
|
15097 | anInstance(this, $DataView, DATA_VIEW);
|
15098 | anInstance(buffer, $ArrayBuffer, DATA_VIEW);
|
15099 | var bufferLength = getInternalState(buffer).byteLength;
|
15100 | var offset = toInteger(byteOffset);
|
15101 | if (offset < 0 || offset > bufferLength) throw RangeError('Wrong offset');
|
15102 | byteLength = byteLength === undefined ? bufferLength - offset : toLength(byteLength);
|
15103 | if (offset + byteLength > bufferLength) throw RangeError(WRONG_LENGTH);
|
15104 | setInternalState(this, {
|
15105 | buffer: buffer,
|
15106 | byteLength: byteLength,
|
15107 | byteOffset: offset
|
15108 | });
|
15109 | if (!DESCRIPTORS) {
|
15110 | this.buffer = buffer;
|
15111 | this.byteLength = byteLength;
|
15112 | this.byteOffset = offset;
|
15113 | }
|
15114 | };
|
15115 |
|
15116 | if (DESCRIPTORS) {
|
15117 | addGetter($ArrayBuffer, 'byteLength');
|
15118 | addGetter($DataView, 'buffer');
|
15119 | addGetter($DataView, 'byteLength');
|
15120 | addGetter($DataView, 'byteOffset');
|
15121 | }
|
15122 |
|
15123 | redefineAll($DataView[PROTOTYPE], {
|
15124 | getInt8: function getInt8(byteOffset) {
|
15125 | return get(this, 1, byteOffset)[0] << 24 >> 24;
|
15126 | },
|
15127 | getUint8: function getUint8(byteOffset) {
|
15128 | return get(this, 1, byteOffset)[0];
|
15129 | },
|
15130 | getInt16: function getInt16(byteOffset /* , littleEndian */) {
|
15131 | var bytes = get(this, 2, byteOffset, arguments.length > 1 ? arguments[1] : undefined);
|
15132 | return (bytes[1] << 8 | bytes[0]) << 16 >> 16;
|
15133 | },
|
15134 | getUint16: function getUint16(byteOffset /* , littleEndian */) {
|
15135 | var bytes = get(this, 2, byteOffset, arguments.length > 1 ? arguments[1] : undefined);
|
15136 | return bytes[1] << 8 | bytes[0];
|
15137 | },
|
15138 | getInt32: function getInt32(byteOffset /* , littleEndian */) {
|
15139 | return unpackInt32(get(this, 4, byteOffset, arguments.length > 1 ? arguments[1] : undefined));
|
15140 | },
|
15141 | getUint32: function getUint32(byteOffset /* , littleEndian */) {
|
15142 | return unpackInt32(get(this, 4, byteOffset, arguments.length > 1 ? arguments[1] : undefined)) >>> 0;
|
15143 | },
|
15144 | getFloat32: function getFloat32(byteOffset /* , littleEndian */) {
|
15145 | return unpackIEEE754(get(this, 4, byteOffset, arguments.length > 1 ? arguments[1] : undefined), 23);
|
15146 | },
|
15147 | getFloat64: function getFloat64(byteOffset /* , littleEndian */) {
|
15148 | return unpackIEEE754(get(this, 8, byteOffset, arguments.length > 1 ? arguments[1] : undefined), 52);
|
15149 | },
|
15150 | setInt8: function setInt8(byteOffset, value) {
|
15151 | set(this, 1, byteOffset, packInt8, value);
|
15152 | },
|
15153 | setUint8: function setUint8(byteOffset, value) {
|
15154 | set(this, 1, byteOffset, packInt8, value);
|
15155 | },
|
15156 | setInt16: function setInt16(byteOffset, value /* , littleEndian */) {
|
15157 | set(this, 2, byteOffset, packInt16, value, arguments.length > 2 ? arguments[2] : undefined);
|
15158 | },
|
15159 | setUint16: function setUint16(byteOffset, value /* , littleEndian */) {
|
15160 | set(this, 2, byteOffset, packInt16, value, arguments.length > 2 ? arguments[2] : undefined);
|
15161 | },
|
15162 | setInt32: function setInt32(byteOffset, value /* , littleEndian */) {
|
15163 | set(this, 4, byteOffset, packInt32, value, arguments.length > 2 ? arguments[2] : undefined);
|
15164 | },
|
15165 | setUint32: function setUint32(byteOffset, value /* , littleEndian */) {
|
15166 | set(this, 4, byteOffset, packInt32, value, arguments.length > 2 ? arguments[2] : undefined);
|
15167 | },
|
15168 | setFloat32: function setFloat32(byteOffset, value /* , littleEndian */) {
|
15169 | set(this, 4, byteOffset, packFloat32, value, arguments.length > 2 ? arguments[2] : undefined);
|
15170 | },
|
15171 | setFloat64: function setFloat64(byteOffset, value /* , littleEndian */) {
|
15172 | set(this, 8, byteOffset, packFloat64, value, arguments.length > 2 ? arguments[2] : undefined);
|
15173 | }
|
15174 | });
|
15175 | } else {
|
15176 | if (!fails(function () {
|
15177 | NativeArrayBuffer(1);
|
15178 | }) || !fails(function () {
|
15179 | new NativeArrayBuffer(-1);
|
15180 | }) || fails(function () {
|
15181 | new NativeArrayBuffer();
|
15182 | new NativeArrayBuffer(1.5);
|
15183 | new NativeArrayBuffer(NaN);
|
15184 | return NativeArrayBuffer.name != ARRAY_BUFFER;
|
15185 | })) {
|
15186 | $ArrayBuffer = function ArrayBuffer(length) {
|
15187 | anInstance(this, $ArrayBuffer);
|
15188 | return new NativeArrayBuffer(toIndex(length));
|
15189 | };
|
15190 | var ArrayBufferPrototype = $ArrayBuffer[PROTOTYPE] = NativeArrayBuffer[PROTOTYPE];
|
15191 | for (var keys = getOwnPropertyNames(NativeArrayBuffer), j = 0, key; keys.length > j;) {
|
15192 | if (!((key = keys[j++]) in $ArrayBuffer)) {
|
15193 | createNonEnumerableProperty($ArrayBuffer, key, NativeArrayBuffer[key]);
|
15194 | }
|
15195 | }
|
15196 | ArrayBufferPrototype.constructor = $ArrayBuffer;
|
15197 | }
|
15198 |
|
15199 |
|
15200 | if (setPrototypeOf && getPrototypeOf($DataViewPrototype) !== ObjectPrototype) {
|
15201 | setPrototypeOf($DataViewPrototype, ObjectPrototype);
|
15202 | }
|
15203 |
|
15204 |
|
15205 | var testView = new $DataView(new $ArrayBuffer(2));
|
15206 | var nativeSetInt8 = $DataViewPrototype.setInt8;
|
15207 | testView.setInt8(0, 2147483648);
|
15208 | testView.setInt8(1, 2147483649);
|
15209 | if (testView.getInt8(0) || !testView.getInt8(1)) redefineAll($DataViewPrototype, {
|
15210 | setInt8: function setInt8(byteOffset, value) {
|
15211 | nativeSetInt8.call(this, byteOffset, value << 24 >> 24);
|
15212 | },
|
15213 | setUint8: function setUint8(byteOffset, value) {
|
15214 | nativeSetInt8.call(this, byteOffset, value << 24 >> 24);
|
15215 | }
|
15216 | }, { unsafe: true });
|
15217 | }
|
15218 |
|
15219 | setToStringTag($ArrayBuffer, ARRAY_BUFFER);
|
15220 | setToStringTag($DataView, DATA_VIEW);
|
15221 |
|
15222 | module.exports = {
|
15223 | ArrayBuffer: $ArrayBuffer,
|
15224 | DataView: $DataView
|
15225 | };
|
15226 |
|
15227 | },{"../internals/an-instance":106,"../internals/array-buffer-native":108,"../internals/array-fill":112,"../internals/create-non-enumerable-property":131,"../internals/descriptors":136,"../internals/fails":145,"../internals/global":150,"../internals/ieee754":156,"../internals/internal-state":160,"../internals/object-define-property":180,"../internals/object-get-own-property-names":183,"../internals/object-get-prototype-of":185,"../internals/object-set-prototype-of":189,"../internals/redefine-all":196,"../internals/set-to-string-tag":206,"../internals/to-index":216,"../internals/to-integer":218,"../internals/to-length":219}],111:[function(require,module,exports){
|
15228 | 'use strict';
|
15229 | var toObject = require('../internals/to-object');
|
15230 | var toAbsoluteIndex = require('../internals/to-absolute-index');
|
15231 | var toLength = require('../internals/to-length');
|
15232 |
|
15233 | var min = Math.min;
|
15234 |
|
15235 |
|
15236 |
|
15237 | module.exports = [].copyWithin || function copyWithin(target /* = 0 */, start /* = 0, end = @length */) {
|
15238 | var O = toObject(this);
|
15239 | var len = toLength(O.length);
|
15240 | var to = toAbsoluteIndex(target, len);
|
15241 | var from = toAbsoluteIndex(start, len);
|
15242 | var end = arguments.length > 2 ? arguments[2] : undefined;
|
15243 | var count = min((end === undefined ? len : toAbsoluteIndex(end, len)) - from, len - to);
|
15244 | var inc = 1;
|
15245 | if (from < to && to < from + count) {
|
15246 | inc = -1;
|
15247 | from += count - 1;
|
15248 | to += count - 1;
|
15249 | }
|
15250 | while (count-- > 0) {
|
15251 | if (from in O) O[to] = O[from];
|
15252 | else delete O[to];
|
15253 | to += inc;
|
15254 | from += inc;
|
15255 | } return O;
|
15256 | };
|
15257 |
|
15258 | },{"../internals/to-absolute-index":215,"../internals/to-length":219,"../internals/to-object":220}],112:[function(require,module,exports){
|
15259 | 'use strict';
|
15260 | var toObject = require('../internals/to-object');
|
15261 | var toAbsoluteIndex = require('../internals/to-absolute-index');
|
15262 | var toLength = require('../internals/to-length');
|
15263 |
|
15264 |
|
15265 |
|
15266 | module.exports = function fill(value /* , start = 0, end = @length */) {
|
15267 | var O = toObject(this);
|
15268 | var length = toLength(O.length);
|
15269 | var argumentsLength = arguments.length;
|
15270 | var index = toAbsoluteIndex(argumentsLength > 1 ? arguments[1] : undefined, length);
|
15271 | var end = argumentsLength > 2 ? arguments[2] : undefined;
|
15272 | var endPos = end === undefined ? length : toAbsoluteIndex(end, length);
|
15273 | while (endPos > index) O[index++] = value;
|
15274 | return O;
|
15275 | };
|
15276 |
|
15277 | },{"../internals/to-absolute-index":215,"../internals/to-length":219,"../internals/to-object":220}],113:[function(require,module,exports){
|
15278 | 'use strict';
|
15279 | var $forEach = require('../internals/array-iteration').forEach;
|
15280 | var arrayMethodIsStrict = require('../internals/array-method-is-strict');
|
15281 | var arrayMethodUsesToLength = require('../internals/array-method-uses-to-length');
|
15282 |
|
15283 | var STRICT_METHOD = arrayMethodIsStrict('forEach');
|
15284 | var USES_TO_LENGTH = arrayMethodUsesToLength('forEach');
|
15285 |
|
15286 |
|
15287 |
|
15288 | module.exports = (!STRICT_METHOD || !USES_TO_LENGTH) ? function forEach(callbackfn /* , thisArg */) {
|
15289 | return $forEach(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
|
15290 | } : [].forEach;
|
15291 |
|
15292 | },{"../internals/array-iteration":116,"../internals/array-method-is-strict":119,"../internals/array-method-uses-to-length":120}],114:[function(require,module,exports){
|
15293 | 'use strict';
|
15294 | var bind = require('../internals/function-bind-context');
|
15295 | var toObject = require('../internals/to-object');
|
15296 | var callWithSafeIterationClosing = require('../internals/call-with-safe-iteration-closing');
|
15297 | var isArrayIteratorMethod = require('../internals/is-array-iterator-method');
|
15298 | var toLength = require('../internals/to-length');
|
15299 | var createProperty = require('../internals/create-property');
|
15300 | var getIteratorMethod = require('../internals/get-iterator-method');
|
15301 |
|
15302 |
|
15303 |
|
15304 | module.exports = function from(arrayLike /* , mapfn = undefined, thisArg = undefined */) {
|
15305 | var O = toObject(arrayLike);
|
15306 | var C = typeof this == 'function' ? this : Array;
|
15307 | var argumentsLength = arguments.length;
|
15308 | var mapfn = argumentsLength > 1 ? arguments[1] : undefined;
|
15309 | var mapping = mapfn !== undefined;
|
15310 | var iteratorMethod = getIteratorMethod(O);
|
15311 | var index = 0;
|
15312 | var length, result, step, iterator, next, value;
|
15313 | if (mapping) mapfn = bind(mapfn, argumentsLength > 2 ? arguments[2] : undefined, 2);
|
15314 |
|
15315 | if (iteratorMethod != undefined && !(C == Array && isArrayIteratorMethod(iteratorMethod))) {
|
15316 | iterator = iteratorMethod.call(O);
|
15317 | next = iterator.next;
|
15318 | result = new C();
|
15319 | for (;!(step = next.call(iterator)).done; index++) {
|
15320 | value = mapping ? callWithSafeIterationClosing(iterator, mapfn, [step.value, index], true) : step.value;
|
15321 | createProperty(result, index, value);
|
15322 | }
|
15323 | } else {
|
15324 | length = toLength(O.length);
|
15325 | result = new C(length);
|
15326 | for (;length > index; index++) {
|
15327 | value = mapping ? mapfn(O[index], index) : O[index];
|
15328 | createProperty(result, index, value);
|
15329 | }
|
15330 | }
|
15331 | result.length = index;
|
15332 | return result;
|
15333 | };
|
15334 |
|
15335 | },{"../internals/call-with-safe-iteration-closing":123,"../internals/create-property":133,"../internals/function-bind-context":147,"../internals/get-iterator-method":149,"../internals/is-array-iterator-method":161,"../internals/to-length":219,"../internals/to-object":220}],115:[function(require,module,exports){
|
15336 | var toIndexedObject = require('../internals/to-indexed-object');
|
15337 | var toLength = require('../internals/to-length');
|
15338 | var toAbsoluteIndex = require('../internals/to-absolute-index');
|
15339 |
|
15340 |
|
15341 | var createMethod = function (IS_INCLUDES) {
|
15342 | return function ($this, el, fromIndex) {
|
15343 | var O = toIndexedObject($this);
|
15344 | var length = toLength(O.length);
|
15345 | var index = toAbsoluteIndex(fromIndex, length);
|
15346 | var value;
|
15347 |
|
15348 |
|
15349 | if (IS_INCLUDES && el != el) while (length > index) {
|
15350 | value = O[index++];
|
15351 |
|
15352 | if (value != value) return true;
|
15353 |
|
15354 | } else for (;length > index; index++) {
|
15355 | if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
|
15356 | } return !IS_INCLUDES && -1;
|
15357 | };
|
15358 | };
|
15359 |
|
15360 | module.exports = {
|
15361 |
|
15362 |
|
15363 | includes: createMethod(true),
|
15364 |
|
15365 |
|
15366 | indexOf: createMethod(false)
|
15367 | };
|
15368 |
|
15369 | },{"../internals/to-absolute-index":215,"../internals/to-indexed-object":217,"../internals/to-length":219}],116:[function(require,module,exports){
|
15370 | var bind = require('../internals/function-bind-context');
|
15371 | var IndexedObject = require('../internals/indexed-object');
|
15372 | var toObject = require('../internals/to-object');
|
15373 | var toLength = require('../internals/to-length');
|
15374 | var arraySpeciesCreate = require('../internals/array-species-create');
|
15375 |
|
15376 | var push = [].push;
|
15377 |
|
15378 |
|
15379 | var createMethod = function (TYPE) {
|
15380 | var IS_MAP = TYPE == 1;
|
15381 | var IS_FILTER = TYPE == 2;
|
15382 | var IS_SOME = TYPE == 3;
|
15383 | var IS_EVERY = TYPE == 4;
|
15384 | var IS_FIND_INDEX = TYPE == 6;
|
15385 | var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;
|
15386 | return function ($this, callbackfn, that, specificCreate) {
|
15387 | var O = toObject($this);
|
15388 | var self = IndexedObject(O);
|
15389 | var boundFunction = bind(callbackfn, that, 3);
|
15390 | var length = toLength(self.length);
|
15391 | var index = 0;
|
15392 | var create = specificCreate || arraySpeciesCreate;
|
15393 | var target = IS_MAP ? create($this, length) : IS_FILTER ? create($this, 0) : undefined;
|
15394 | var value, result;
|
15395 | for (;length > index; index++) if (NO_HOLES || index in self) {
|
15396 | value = self[index];
|
15397 | result = boundFunction(value, index, O);
|
15398 | if (TYPE) {
|
15399 | if (IS_MAP) target[index] = result;
|
15400 | else if (result) switch (TYPE) {
|
15401 | case 3: return true;
|
15402 | case 5: return value;
|
15403 | case 6: return index;
|
15404 | case 2: push.call(target, value);
|
15405 | } else if (IS_EVERY) return false;
|
15406 | }
|
15407 | }
|
15408 | return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : target;
|
15409 | };
|
15410 | };
|
15411 |
|
15412 | module.exports = {
|
15413 |
|
15414 |
|
15415 | forEach: createMethod(0),
|
15416 |
|
15417 |
|
15418 | map: createMethod(1),
|
15419 |
|
15420 |
|
15421 | filter: createMethod(2),
|
15422 |
|
15423 |
|
15424 | some: createMethod(3),
|
15425 |
|
15426 |
|
15427 | every: createMethod(4),
|
15428 |
|
15429 |
|
15430 | find: createMethod(5),
|
15431 |
|
15432 |
|
15433 | findIndex: createMethod(6)
|
15434 | };
|
15435 |
|
15436 | },{"../internals/array-species-create":122,"../internals/function-bind-context":147,"../internals/indexed-object":157,"../internals/to-length":219,"../internals/to-object":220}],117:[function(require,module,exports){
|
15437 | 'use strict';
|
15438 | var toIndexedObject = require('../internals/to-indexed-object');
|
15439 | var toInteger = require('../internals/to-integer');
|
15440 | var toLength = require('../internals/to-length');
|
15441 | var arrayMethodIsStrict = require('../internals/array-method-is-strict');
|
15442 | var arrayMethodUsesToLength = require('../internals/array-method-uses-to-length');
|
15443 |
|
15444 | var min = Math.min;
|
15445 | var nativeLastIndexOf = [].lastIndexOf;
|
15446 | var NEGATIVE_ZERO = !!nativeLastIndexOf && 1 / [1].lastIndexOf(1, -0) < 0;
|
15447 | var STRICT_METHOD = arrayMethodIsStrict('lastIndexOf');
|
15448 |
|
15449 | var USES_TO_LENGTH = arrayMethodUsesToLength('indexOf', { ACCESSORS: true, 1: 0 });
|
15450 | var FORCED = NEGATIVE_ZERO || !STRICT_METHOD || !USES_TO_LENGTH;
|
15451 |
|
15452 |
|
15453 |
|
15454 | module.exports = FORCED ? function lastIndexOf(searchElement /* , fromIndex = @[*-1] */) {
|
15455 |
|
15456 | if (NEGATIVE_ZERO) return nativeLastIndexOf.apply(this, arguments) || 0;
|
15457 | var O = toIndexedObject(this);
|
15458 | var length = toLength(O.length);
|
15459 | var index = length - 1;
|
15460 | if (arguments.length > 1) index = min(index, toInteger(arguments[1]));
|
15461 | if (index < 0) index = length + index;
|
15462 | for (;index >= 0; index--) if (index in O && O[index] === searchElement) return index || 0;
|
15463 | return -1;
|
15464 | } : nativeLastIndexOf;
|
15465 |
|
15466 | },{"../internals/array-method-is-strict":119,"../internals/array-method-uses-to-length":120,"../internals/to-indexed-object":217,"../internals/to-integer":218,"../internals/to-length":219}],118:[function(require,module,exports){
|
15467 | var fails = require('../internals/fails');
|
15468 | var wellKnownSymbol = require('../internals/well-known-symbol');
|
15469 | var V8_VERSION = require('../internals/engine-v8-version');
|
15470 |
|
15471 | var SPECIES = wellKnownSymbol('species');
|
15472 |
|
15473 | module.exports = function (METHOD_NAME) {
|
15474 |
|
15475 |
|
15476 |
|
15477 | return V8_VERSION >= 51 || !fails(function () {
|
15478 | var array = [];
|
15479 | var constructor = array.constructor = {};
|
15480 | constructor[SPECIES] = function () {
|
15481 | return { foo: 1 };
|
15482 | };
|
15483 | return array[METHOD_NAME](Boolean).foo !== 1;
|
15484 | });
|
15485 | };
|
15486 |
|
15487 | },{"../internals/engine-v8-version":142,"../internals/fails":145,"../internals/well-known-symbol":231}],119:[function(require,module,exports){
|
15488 | 'use strict';
|
15489 | var fails = require('../internals/fails');
|
15490 |
|
15491 | module.exports = function (METHOD_NAME, argument) {
|
15492 | var method = [][METHOD_NAME];
|
15493 | return !!method && fails(function () {
|
15494 |
|
15495 | method.call(null, argument || function () { throw 1; }, 1);
|
15496 | });
|
15497 | };
|
15498 |
|
15499 | },{"../internals/fails":145}],120:[function(require,module,exports){
|
15500 | var DESCRIPTORS = require('../internals/descriptors');
|
15501 | var fails = require('../internals/fails');
|
15502 | var has = require('../internals/has');
|
15503 |
|
15504 | var defineProperty = Object.defineProperty;
|
15505 | var cache = {};
|
15506 |
|
15507 | var thrower = function (it) { throw it; };
|
15508 |
|
15509 | module.exports = function (METHOD_NAME, options) {
|
15510 | if (has(cache, METHOD_NAME)) return cache[METHOD_NAME];
|
15511 | if (!options) options = {};
|
15512 | var method = [][METHOD_NAME];
|
15513 | var ACCESSORS = has(options, 'ACCESSORS') ? options.ACCESSORS : false;
|
15514 | var argument0 = has(options, 0) ? options[0] : thrower;
|
15515 | var argument1 = has(options, 1) ? options[1] : undefined;
|
15516 |
|
15517 | return cache[METHOD_NAME] = !!method && !fails(function () {
|
15518 | if (ACCESSORS && !DESCRIPTORS) return true;
|
15519 | var O = { length: -1 };
|
15520 |
|
15521 | if (ACCESSORS) defineProperty(O, 1, { enumerable: true, get: thrower });
|
15522 | else O[1] = 1;
|
15523 |
|
15524 | method.call(O, argument0, argument1);
|
15525 | });
|
15526 | };
|
15527 |
|
15528 | },{"../internals/descriptors":136,"../internals/fails":145,"../internals/has":151}],121:[function(require,module,exports){
|
15529 | var aFunction = require('../internals/a-function');
|
15530 | var toObject = require('../internals/to-object');
|
15531 | var IndexedObject = require('../internals/indexed-object');
|
15532 | var toLength = require('../internals/to-length');
|
15533 |
|
15534 |
|
15535 | var createMethod = function (IS_RIGHT) {
|
15536 | return function (that, callbackfn, argumentsLength, memo) {
|
15537 | aFunction(callbackfn);
|
15538 | var O = toObject(that);
|
15539 | var self = IndexedObject(O);
|
15540 | var length = toLength(O.length);
|
15541 | var index = IS_RIGHT ? length - 1 : 0;
|
15542 | var i = IS_RIGHT ? -1 : 1;
|
15543 | if (argumentsLength < 2) while (true) {
|
15544 | if (index in self) {
|
15545 | memo = self[index];
|
15546 | index += i;
|
15547 | break;
|
15548 | }
|
15549 | index += i;
|
15550 | if (IS_RIGHT ? index < 0 : length <= index) {
|
15551 | throw TypeError('Reduce of empty array with no initial value');
|
15552 | }
|
15553 | }
|
15554 | for (;IS_RIGHT ? index >= 0 : length > index; index += i) if (index in self) {
|
15555 | memo = callbackfn(memo, self[index], index, O);
|
15556 | }
|
15557 | return memo;
|
15558 | };
|
15559 | };
|
15560 |
|
15561 | module.exports = {
|
15562 |
|
15563 |
|
15564 | left: createMethod(false),
|
15565 |
|
15566 |
|
15567 | right: createMethod(true)
|
15568 | };
|
15569 |
|
15570 | },{"../internals/a-function":102,"../internals/indexed-object":157,"../internals/to-length":219,"../internals/to-object":220}],122:[function(require,module,exports){
|
15571 | var isObject = require('../internals/is-object');
|
15572 | var isArray = require('../internals/is-array');
|
15573 | var wellKnownSymbol = require('../internals/well-known-symbol');
|
15574 |
|
15575 | var SPECIES = wellKnownSymbol('species');
|
15576 |
|
15577 |
|
15578 |
|
15579 | module.exports = function (originalArray, length) {
|
15580 | var C;
|
15581 | if (isArray(originalArray)) {
|
15582 | C = originalArray.constructor;
|
15583 |
|
15584 | if (typeof C == 'function' && (C === Array || isArray(C.prototype))) C = undefined;
|
15585 | else if (isObject(C)) {
|
15586 | C = C[SPECIES];
|
15587 | if (C === null) C = undefined;
|
15588 | }
|
15589 | } return new (C === undefined ? Array : C)(length === 0 ? 0 : length);
|
15590 | };
|
15591 |
|
15592 | },{"../internals/is-array":162,"../internals/is-object":164,"../internals/well-known-symbol":231}],123:[function(require,module,exports){
|
15593 | var anObject = require('../internals/an-object');
|
15594 | var iteratorClose = require('../internals/iterator-close');
|
15595 |
|
15596 |
|
15597 | module.exports = function (iterator, fn, value, ENTRIES) {
|
15598 | try {
|
15599 | return ENTRIES ? fn(anObject(value)[0], value[1]) : fn(value);
|
15600 |
|
15601 | } catch (error) {
|
15602 | iteratorClose(iterator);
|
15603 | throw error;
|
15604 | }
|
15605 | };
|
15606 |
|
15607 | },{"../internals/an-object":107,"../internals/iterator-close":168}],124:[function(require,module,exports){
|
15608 | var wellKnownSymbol = require('../internals/well-known-symbol');
|
15609 |
|
15610 | var ITERATOR = wellKnownSymbol('iterator');
|
15611 | var SAFE_CLOSING = false;
|
15612 |
|
15613 | try {
|
15614 | var called = 0;
|
15615 | var iteratorWithReturn = {
|
15616 | next: function () {
|
15617 | return { done: !!called++ };
|
15618 | },
|
15619 | 'return': function () {
|
15620 | SAFE_CLOSING = true;
|
15621 | }
|
15622 | };
|
15623 | iteratorWithReturn[ITERATOR] = function () {
|
15624 | return this;
|
15625 | };
|
15626 |
|
15627 | Array.from(iteratorWithReturn, function () { throw 2; });
|
15628 | } catch (error) { }
|
15629 |
|
15630 | module.exports = function (exec, SKIP_CLOSING) {
|
15631 | if (!SKIP_CLOSING && !SAFE_CLOSING) return false;
|
15632 | var ITERATION_SUPPORT = false;
|
15633 | try {
|
15634 | var object = {};
|
15635 | object[ITERATOR] = function () {
|
15636 | return {
|
15637 | next: function () {
|
15638 | return { done: ITERATION_SUPPORT = true };
|
15639 | }
|
15640 | };
|
15641 | };
|
15642 | exec(object);
|
15643 | } catch (error) { }
|
15644 | return ITERATION_SUPPORT;
|
15645 | };
|
15646 |
|
15647 | },{"../internals/well-known-symbol":231}],125:[function(require,module,exports){
|
15648 | var toString = {}.toString;
|
15649 |
|
15650 | module.exports = function (it) {
|
15651 | return toString.call(it).slice(8, -1);
|
15652 | };
|
15653 |
|
15654 | },{}],126:[function(require,module,exports){
|
15655 | var TO_STRING_TAG_SUPPORT = require('../internals/to-string-tag-support');
|
15656 | var classofRaw = require('../internals/classof-raw');
|
15657 | var wellKnownSymbol = require('../internals/well-known-symbol');
|
15658 |
|
15659 | var TO_STRING_TAG = wellKnownSymbol('toStringTag');
|
15660 |
|
15661 | var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) == 'Arguments';
|
15662 |
|
15663 |
|
15664 | var tryGet = function (it, key) {
|
15665 | try {
|
15666 | return it[key];
|
15667 | } catch (error) { }
|
15668 | };
|
15669 |
|
15670 |
|
15671 | module.exports = TO_STRING_TAG_SUPPORT ? classofRaw : function (it) {
|
15672 | var O, tag, result;
|
15673 | return it === undefined ? 'Undefined' : it === null ? 'Null'
|
15674 |
|
15675 | : typeof (tag = tryGet(O = Object(it), TO_STRING_TAG)) == 'string' ? tag
|
15676 |
|
15677 | : CORRECT_ARGUMENTS ? classofRaw(O)
|
15678 |
|
15679 | : (result = classofRaw(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : result;
|
15680 | };
|
15681 |
|
15682 | },{"../internals/classof-raw":125,"../internals/to-string-tag-support":224,"../internals/well-known-symbol":231}],127:[function(require,module,exports){
|
15683 | var has = require('../internals/has');
|
15684 | var ownKeys = require('../internals/own-keys');
|
15685 | var getOwnPropertyDescriptorModule = require('../internals/object-get-own-property-descriptor');
|
15686 | var definePropertyModule = require('../internals/object-define-property');
|
15687 |
|
15688 | module.exports = function (target, source) {
|
15689 | var keys = ownKeys(source);
|
15690 | var defineProperty = definePropertyModule.f;
|
15691 | var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
|
15692 | for (var i = 0; i < keys.length; i++) {
|
15693 | var key = keys[i];
|
15694 | if (!has(target, key)) defineProperty(target, key, getOwnPropertyDescriptor(source, key));
|
15695 | }
|
15696 | };
|
15697 |
|
15698 | },{"../internals/has":151,"../internals/object-define-property":180,"../internals/object-get-own-property-descriptor":181,"../internals/own-keys":192}],128:[function(require,module,exports){
|
15699 | var wellKnownSymbol = require('../internals/well-known-symbol');
|
15700 |
|
15701 | var MATCH = wellKnownSymbol('match');
|
15702 |
|
15703 | module.exports = function (METHOD_NAME) {
|
15704 | var regexp = /./;
|
15705 | try {
|
15706 | '/./'[METHOD_NAME](regexp);
|
15707 | } catch (error1) {
|
15708 | try {
|
15709 | regexp[MATCH] = false;
|
15710 | return '/./'[METHOD_NAME](regexp);
|
15711 | } catch (error2) { }
|
15712 | } return false;
|
15713 | };
|
15714 |
|
15715 | },{"../internals/well-known-symbol":231}],129:[function(require,module,exports){
|
15716 | var fails = require('../internals/fails');
|
15717 |
|
15718 | module.exports = !fails(function () {
|
15719 | function F() { }
|
15720 | F.prototype.constructor = null;
|
15721 | return Object.getPrototypeOf(new F()) !== F.prototype;
|
15722 | });
|
15723 |
|
15724 | },{"../internals/fails":145}],130:[function(require,module,exports){
|
15725 | 'use strict';
|
15726 | var IteratorPrototype = require('../internals/iterators-core').IteratorPrototype;
|
15727 | var create = require('../internals/object-create');
|
15728 | var createPropertyDescriptor = require('../internals/create-property-descriptor');
|
15729 | var setToStringTag = require('../internals/set-to-string-tag');
|
15730 | var Iterators = require('../internals/iterators');
|
15731 |
|
15732 | var returnThis = function () { return this; };
|
15733 |
|
15734 | module.exports = function (IteratorConstructor, NAME, next) {
|
15735 | var TO_STRING_TAG = NAME + ' Iterator';
|
15736 | IteratorConstructor.prototype = create(IteratorPrototype, { next: createPropertyDescriptor(1, next) });
|
15737 | setToStringTag(IteratorConstructor, TO_STRING_TAG, false, true);
|
15738 | Iterators[TO_STRING_TAG] = returnThis;
|
15739 | return IteratorConstructor;
|
15740 | };
|
15741 |
|
15742 | },{"../internals/create-property-descriptor":132,"../internals/iterators":170,"../internals/iterators-core":169,"../internals/object-create":178,"../internals/set-to-string-tag":206}],131:[function(require,module,exports){
|
15743 | var DESCRIPTORS = require('../internals/descriptors');
|
15744 | var definePropertyModule = require('../internals/object-define-property');
|
15745 | var createPropertyDescriptor = require('../internals/create-property-descriptor');
|
15746 |
|
15747 | module.exports = DESCRIPTORS ? function (object, key, value) {
|
15748 | return definePropertyModule.f(object, key, createPropertyDescriptor(1, value));
|
15749 | } : function (object, key, value) {
|
15750 | object[key] = value;
|
15751 | return object;
|
15752 | };
|
15753 |
|
15754 | },{"../internals/create-property-descriptor":132,"../internals/descriptors":136,"../internals/object-define-property":180}],132:[function(require,module,exports){
|
15755 | module.exports = function (bitmap, value) {
|
15756 | return {
|
15757 | enumerable: !(bitmap & 1),
|
15758 | configurable: !(bitmap & 2),
|
15759 | writable: !(bitmap & 4),
|
15760 | value: value
|
15761 | };
|
15762 | };
|
15763 |
|
15764 | },{}],133:[function(require,module,exports){
|
15765 | 'use strict';
|
15766 | var toPrimitive = require('../internals/to-primitive');
|
15767 | var definePropertyModule = require('../internals/object-define-property');
|
15768 | var createPropertyDescriptor = require('../internals/create-property-descriptor');
|
15769 |
|
15770 | module.exports = function (object, key, value) {
|
15771 | var propertyKey = toPrimitive(key);
|
15772 | if (propertyKey in object) definePropertyModule.f(object, propertyKey, createPropertyDescriptor(0, value));
|
15773 | else object[propertyKey] = value;
|
15774 | };
|
15775 |
|
15776 | },{"../internals/create-property-descriptor":132,"../internals/object-define-property":180,"../internals/to-primitive":223}],134:[function(require,module,exports){
|
15777 | 'use strict';
|
15778 | var $ = require('../internals/export');
|
15779 | var createIteratorConstructor = require('../internals/create-iterator-constructor');
|
15780 | var getPrototypeOf = require('../internals/object-get-prototype-of');
|
15781 | var setPrototypeOf = require('../internals/object-set-prototype-of');
|
15782 | var setToStringTag = require('../internals/set-to-string-tag');
|
15783 | var createNonEnumerableProperty = require('../internals/create-non-enumerable-property');
|
15784 | var redefine = require('../internals/redefine');
|
15785 | var wellKnownSymbol = require('../internals/well-known-symbol');
|
15786 | var IS_PURE = require('../internals/is-pure');
|
15787 | var Iterators = require('../internals/iterators');
|
15788 | var IteratorsCore = require('../internals/iterators-core');
|
15789 |
|
15790 | var IteratorPrototype = IteratorsCore.IteratorPrototype;
|
15791 | var BUGGY_SAFARI_ITERATORS = IteratorsCore.BUGGY_SAFARI_ITERATORS;
|
15792 | var ITERATOR = wellKnownSymbol('iterator');
|
15793 | var KEYS = 'keys';
|
15794 | var VALUES = 'values';
|
15795 | var ENTRIES = 'entries';
|
15796 |
|
15797 | var returnThis = function () { return this; };
|
15798 |
|
15799 | module.exports = function (Iterable, NAME, IteratorConstructor, next, DEFAULT, IS_SET, FORCED) {
|
15800 | createIteratorConstructor(IteratorConstructor, NAME, next);
|
15801 |
|
15802 | var getIterationMethod = function (KIND) {
|
15803 | if (KIND === DEFAULT && defaultIterator) return defaultIterator;
|
15804 | if (!BUGGY_SAFARI_ITERATORS && KIND in IterablePrototype) return IterablePrototype[KIND];
|
15805 | switch (KIND) {
|
15806 | case KEYS: return function keys() { return new IteratorConstructor(this, KIND); };
|
15807 | case VALUES: return function values() { return new IteratorConstructor(this, KIND); };
|
15808 | case ENTRIES: return function entries() { return new IteratorConstructor(this, KIND); };
|
15809 | } return function () { return new IteratorConstructor(this); };
|
15810 | };
|
15811 |
|
15812 | var TO_STRING_TAG = NAME + ' Iterator';
|
15813 | var INCORRECT_VALUES_NAME = false;
|
15814 | var IterablePrototype = Iterable.prototype;
|
15815 | var nativeIterator = IterablePrototype[ITERATOR]
|
15816 | || IterablePrototype['@@iterator']
|
15817 | || DEFAULT && IterablePrototype[DEFAULT];
|
15818 | var defaultIterator = !BUGGY_SAFARI_ITERATORS && nativeIterator || getIterationMethod(DEFAULT);
|
15819 | var anyNativeIterator = NAME == 'Array' ? IterablePrototype.entries || nativeIterator : nativeIterator;
|
15820 | var CurrentIteratorPrototype, methods, KEY;
|
15821 |
|
15822 |
|
15823 | if (anyNativeIterator) {
|
15824 | CurrentIteratorPrototype = getPrototypeOf(anyNativeIterator.call(new Iterable()));
|
15825 | if (IteratorPrototype !== Object.prototype && CurrentIteratorPrototype.next) {
|
15826 | if (!IS_PURE && getPrototypeOf(CurrentIteratorPrototype) !== IteratorPrototype) {
|
15827 | if (setPrototypeOf) {
|
15828 | setPrototypeOf(CurrentIteratorPrototype, IteratorPrototype);
|
15829 | } else if (typeof CurrentIteratorPrototype[ITERATOR] != 'function') {
|
15830 | createNonEnumerableProperty(CurrentIteratorPrototype, ITERATOR, returnThis);
|
15831 | }
|
15832 | }
|
15833 |
|
15834 | setToStringTag(CurrentIteratorPrototype, TO_STRING_TAG, true, true);
|
15835 | if (IS_PURE) Iterators[TO_STRING_TAG] = returnThis;
|
15836 | }
|
15837 | }
|
15838 |
|
15839 |
|
15840 | if (DEFAULT == VALUES && nativeIterator && nativeIterator.name !== VALUES) {
|
15841 | INCORRECT_VALUES_NAME = true;
|
15842 | defaultIterator = function values() { return nativeIterator.call(this); };
|
15843 | }
|
15844 |
|
15845 |
|
15846 | if ((!IS_PURE || FORCED) && IterablePrototype[ITERATOR] !== defaultIterator) {
|
15847 | createNonEnumerableProperty(IterablePrototype, ITERATOR, defaultIterator);
|
15848 | }
|
15849 | Iterators[NAME] = defaultIterator;
|
15850 |
|
15851 |
|
15852 | if (DEFAULT) {
|
15853 | methods = {
|
15854 | values: getIterationMethod(VALUES),
|
15855 | keys: IS_SET ? defaultIterator : getIterationMethod(KEYS),
|
15856 | entries: getIterationMethod(ENTRIES)
|
15857 | };
|
15858 | if (FORCED) for (KEY in methods) {
|
15859 | if (BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME || !(KEY in IterablePrototype)) {
|
15860 | redefine(IterablePrototype, KEY, methods[KEY]);
|
15861 | }
|
15862 | } else $({ target: NAME, proto: true, forced: BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME }, methods);
|
15863 | }
|
15864 |
|
15865 | return methods;
|
15866 | };
|
15867 |
|
15868 | },{"../internals/create-iterator-constructor":130,"../internals/create-non-enumerable-property":131,"../internals/export":144,"../internals/is-pure":165,"../internals/iterators":170,"../internals/iterators-core":169,"../internals/object-get-prototype-of":185,"../internals/object-set-prototype-of":189,"../internals/redefine":197,"../internals/set-to-string-tag":206,"../internals/well-known-symbol":231}],135:[function(require,module,exports){
|
15869 | var path = require('../internals/path');
|
15870 | var has = require('../internals/has');
|
15871 | var wrappedWellKnownSymbolModule = require('../internals/well-known-symbol-wrapped');
|
15872 | var defineProperty = require('../internals/object-define-property').f;
|
15873 |
|
15874 | module.exports = function (NAME) {
|
15875 | var Symbol = path.Symbol || (path.Symbol = {});
|
15876 | if (!has(Symbol, NAME)) defineProperty(Symbol, NAME, {
|
15877 | value: wrappedWellKnownSymbolModule.f(NAME)
|
15878 | });
|
15879 | };
|
15880 |
|
15881 | },{"../internals/has":151,"../internals/object-define-property":180,"../internals/path":193,"../internals/well-known-symbol-wrapped":230}],136:[function(require,module,exports){
|
15882 | var fails = require('../internals/fails');
|
15883 |
|
15884 |
|
15885 | module.exports = !fails(function () {
|
15886 | return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] != 7;
|
15887 | });
|
15888 |
|
15889 | },{"../internals/fails":145}],137:[function(require,module,exports){
|
15890 | var global = require('../internals/global');
|
15891 | var isObject = require('../internals/is-object');
|
15892 |
|
15893 | var document = global.document;
|
15894 |
|
15895 | var EXISTS = isObject(document) && isObject(document.createElement);
|
15896 |
|
15897 | module.exports = function (it) {
|
15898 | return EXISTS ? document.createElement(it) : {};
|
15899 | };
|
15900 |
|
15901 | },{"../internals/global":150,"../internals/is-object":164}],138:[function(require,module,exports){
|
15902 |
|
15903 |
|
15904 | module.exports = {
|
15905 | CSSRuleList: 0,
|
15906 | CSSStyleDeclaration: 0,
|
15907 | CSSValueList: 0,
|
15908 | ClientRectList: 0,
|
15909 | DOMRectList: 0,
|
15910 | DOMStringList: 0,
|
15911 | DOMTokenList: 1,
|
15912 | DataTransferItemList: 0,
|
15913 | FileList: 0,
|
15914 | HTMLAllCollection: 0,
|
15915 | HTMLCollection: 0,
|
15916 | HTMLFormElement: 0,
|
15917 | HTMLSelectElement: 0,
|
15918 | MediaList: 0,
|
15919 | MimeTypeArray: 0,
|
15920 | NamedNodeMap: 0,
|
15921 | NodeList: 1,
|
15922 | PaintRequestList: 0,
|
15923 | Plugin: 0,
|
15924 | PluginArray: 0,
|
15925 | SVGLengthList: 0,
|
15926 | SVGNumberList: 0,
|
15927 | SVGPathSegList: 0,
|
15928 | SVGPointList: 0,
|
15929 | SVGStringList: 0,
|
15930 | SVGTransformList: 0,
|
15931 | SourceBufferList: 0,
|
15932 | StyleSheetList: 0,
|
15933 | TextTrackCueList: 0,
|
15934 | TextTrackList: 0,
|
15935 | TouchList: 0
|
15936 | };
|
15937 |
|
15938 | },{}],139:[function(require,module,exports){
|
15939 | var userAgent = require('../internals/engine-user-agent');
|
15940 |
|
15941 | module.exports = /(iphone|ipod|ipad).*applewebkit/i.test(userAgent);
|
15942 |
|
15943 | },{"../internals/engine-user-agent":141}],140:[function(require,module,exports){
|
15944 | var classof = require('../internals/classof-raw');
|
15945 | var global = require('../internals/global');
|
15946 |
|
15947 | module.exports = classof(global.process) == 'process';
|
15948 |
|
15949 | },{"../internals/classof-raw":125,"../internals/global":150}],141:[function(require,module,exports){
|
15950 | var getBuiltIn = require('../internals/get-built-in');
|
15951 |
|
15952 | module.exports = getBuiltIn('navigator', 'userAgent') || '';
|
15953 |
|
15954 | },{"../internals/get-built-in":148}],142:[function(require,module,exports){
|
15955 | var global = require('../internals/global');
|
15956 | var userAgent = require('../internals/engine-user-agent');
|
15957 |
|
15958 | var process = global.process;
|
15959 | var versions = process && process.versions;
|
15960 | var v8 = versions && versions.v8;
|
15961 | var match, version;
|
15962 |
|
15963 | if (v8) {
|
15964 | match = v8.split('.');
|
15965 | version = match[0] + match[1];
|
15966 | } else if (userAgent) {
|
15967 | match = userAgent.match(/Edge\/(\d+)/);
|
15968 | if (!match || match[1] >= 74) {
|
15969 | match = userAgent.match(/Chrome\/(\d+)/);
|
15970 | if (match) version = match[1];
|
15971 | }
|
15972 | }
|
15973 |
|
15974 | module.exports = version && +version;
|
15975 |
|
15976 | },{"../internals/engine-user-agent":141,"../internals/global":150}],143:[function(require,module,exports){
|
15977 |
|
15978 | module.exports = [
|
15979 | 'constructor',
|
15980 | 'hasOwnProperty',
|
15981 | 'isPrototypeOf',
|
15982 | 'propertyIsEnumerable',
|
15983 | 'toLocaleString',
|
15984 | 'toString',
|
15985 | 'valueOf'
|
15986 | ];
|
15987 |
|
15988 | },{}],144:[function(require,module,exports){
|
15989 | var global = require('../internals/global');
|
15990 | var getOwnPropertyDescriptor = require('../internals/object-get-own-property-descriptor').f;
|
15991 | var createNonEnumerableProperty = require('../internals/create-non-enumerable-property');
|
15992 | var redefine = require('../internals/redefine');
|
15993 | var setGlobal = require('../internals/set-global');
|
15994 | var copyConstructorProperties = require('../internals/copy-constructor-properties');
|
15995 | var isForced = require('../internals/is-forced');
|
15996 |
|
15997 |
|
15998 |
|
15999 |
|
16000 |
|
16001 |
|
16002 |
|
16003 |
|
16004 |
|
16005 |
|
16006 |
|
16007 |
|
16008 |
|
16009 |
|
16010 |
|
16011 | module.exports = function (options, source) {
|
16012 | var TARGET = options.target;
|
16013 | var GLOBAL = options.global;
|
16014 | var STATIC = options.stat;
|
16015 | var FORCED, target, key, targetProperty, sourceProperty, descriptor;
|
16016 | if (GLOBAL) {
|
16017 | target = global;
|
16018 | } else if (STATIC) {
|
16019 | target = global[TARGET] || setGlobal(TARGET, {});
|
16020 | } else {
|
16021 | target = (global[TARGET] || {}).prototype;
|
16022 | }
|
16023 | if (target) for (key in source) {
|
16024 | sourceProperty = source[key];
|
16025 | if (options.noTargetGet) {
|
16026 | descriptor = getOwnPropertyDescriptor(target, key);
|
16027 | targetProperty = descriptor && descriptor.value;
|
16028 | } else targetProperty = target[key];
|
16029 | FORCED = isForced(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
|
16030 |
|
16031 | if (!FORCED && targetProperty !== undefined) {
|
16032 | if (typeof sourceProperty === typeof targetProperty) continue;
|
16033 | copyConstructorProperties(sourceProperty, targetProperty);
|
16034 | }
|
16035 |
|
16036 | if (options.sham || (targetProperty && targetProperty.sham)) {
|
16037 | createNonEnumerableProperty(sourceProperty, 'sham', true);
|
16038 | }
|
16039 |
|
16040 | redefine(target, key, sourceProperty, options);
|
16041 | }
|
16042 | };
|
16043 |
|
16044 | },{"../internals/copy-constructor-properties":127,"../internals/create-non-enumerable-property":131,"../internals/global":150,"../internals/is-forced":163,"../internals/object-get-own-property-descriptor":181,"../internals/redefine":197,"../internals/set-global":204}],145:[function(require,module,exports){
|
16045 | module.exports = function (exec) {
|
16046 | try {
|
16047 | return !!exec();
|
16048 | } catch (error) {
|
16049 | return true;
|
16050 | }
|
16051 | };
|
16052 |
|
16053 | },{}],146:[function(require,module,exports){
|
16054 | 'use strict';
|
16055 |
|
16056 | require('../modules/es.regexp.exec');
|
16057 | var redefine = require('../internals/redefine');
|
16058 | var fails = require('../internals/fails');
|
16059 | var wellKnownSymbol = require('../internals/well-known-symbol');
|
16060 | var regexpExec = require('../internals/regexp-exec');
|
16061 | var createNonEnumerableProperty = require('../internals/create-non-enumerable-property');
|
16062 |
|
16063 | var SPECIES = wellKnownSymbol('species');
|
16064 |
|
16065 | var REPLACE_SUPPORTS_NAMED_GROUPS = !fails(function () {
|
16066 |
|
16067 |
|
16068 |
|
16069 | var re = /./;
|
16070 | re.exec = function () {
|
16071 | var result = [];
|
16072 | result.groups = { a: '7' };
|
16073 | return result;
|
16074 | };
|
16075 | return ''.replace(re, '$<a>') !== '7';
|
16076 | });
|
16077 |
|
16078 |
|
16079 |
|
16080 | var REPLACE_KEEPS_$0 = (function () {
|
16081 | return 'a'.replace(/./, '$0') === '$0';
|
16082 | })();
|
16083 |
|
16084 | var REPLACE = wellKnownSymbol('replace');
|
16085 |
|
16086 | var REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE = (function () {
|
16087 | if (/./[REPLACE]) {
|
16088 | return /./[REPLACE]('a', '$0') === '';
|
16089 | }
|
16090 | return false;
|
16091 | })();
|
16092 |
|
16093 |
|
16094 |
|
16095 | var SPLIT_WORKS_WITH_OVERWRITTEN_EXEC = !fails(function () {
|
16096 | var re = /(?:)/;
|
16097 | var originalExec = re.exec;
|
16098 | re.exec = function () { return originalExec.apply(this, arguments); };
|
16099 | var result = 'ab'.split(re);
|
16100 | return result.length !== 2 || result[0] !== 'a' || result[1] !== 'b';
|
16101 | });
|
16102 |
|
16103 | module.exports = function (KEY, length, exec, sham) {
|
16104 | var SYMBOL = wellKnownSymbol(KEY);
|
16105 |
|
16106 | var DELEGATES_TO_SYMBOL = !fails(function () {
|
16107 |
|
16108 | var O = {};
|
16109 | O[SYMBOL] = function () { return 7; };
|
16110 | return ''[KEY](O) != 7;
|
16111 | });
|
16112 |
|
16113 | var DELEGATES_TO_EXEC = DELEGATES_TO_SYMBOL && !fails(function () {
|
16114 |
|
16115 | var execCalled = false;
|
16116 | var re = /a/;
|
16117 |
|
16118 | if (KEY === 'split') {
|
16119 |
|
16120 |
|
16121 |
|
16122 | re = {};
|
16123 |
|
16124 |
|
16125 | re.constructor = {};
|
16126 | re.constructor[SPECIES] = function () { return re; };
|
16127 | re.flags = '';
|
16128 | re[SYMBOL] = /./[SYMBOL];
|
16129 | }
|
16130 |
|
16131 | re.exec = function () { execCalled = true; return null; };
|
16132 |
|
16133 | re[SYMBOL]('');
|
16134 | return !execCalled;
|
16135 | });
|
16136 |
|
16137 | if (
|
16138 | !DELEGATES_TO_SYMBOL ||
|
16139 | !DELEGATES_TO_EXEC ||
|
16140 | (KEY === 'replace' && !(
|
16141 | REPLACE_SUPPORTS_NAMED_GROUPS &&
|
16142 | REPLACE_KEEPS_$0 &&
|
16143 | !REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE
|
16144 | )) ||
|
16145 | (KEY === 'split' && !SPLIT_WORKS_WITH_OVERWRITTEN_EXEC)
|
16146 | ) {
|
16147 | var nativeRegExpMethod = /./[SYMBOL];
|
16148 | var methods = exec(SYMBOL, ''[KEY], function (nativeMethod, regexp, str, arg2, forceStringMethod) {
|
16149 | if (regexp.exec === regexpExec) {
|
16150 | if (DELEGATES_TO_SYMBOL && !forceStringMethod) {
|
16151 |
|
16152 |
|
16153 |
|
16154 | return { done: true, value: nativeRegExpMethod.call(regexp, str, arg2) };
|
16155 | }
|
16156 | return { done: true, value: nativeMethod.call(str, regexp, arg2) };
|
16157 | }
|
16158 | return { done: false };
|
16159 | }, {
|
16160 | REPLACE_KEEPS_$0: REPLACE_KEEPS_$0,
|
16161 | REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE: REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE
|
16162 | });
|
16163 | var stringMethod = methods[0];
|
16164 | var regexMethod = methods[1];
|
16165 |
|
16166 | redefine(String.prototype, KEY, stringMethod);
|
16167 | redefine(RegExp.prototype, SYMBOL, length == 2
|
16168 |
|
16169 |
|
16170 | ? function (string, arg) { return regexMethod.call(string, this, arg); }
|
16171 |
|
16172 |
|
16173 | : function (string) { return regexMethod.call(string, this); }
|
16174 | );
|
16175 | }
|
16176 |
|
16177 | if (sham) createNonEnumerableProperty(RegExp.prototype[SYMBOL], 'sham', true);
|
16178 | };
|
16179 |
|
16180 | },{"../internals/create-non-enumerable-property":131,"../internals/fails":145,"../internals/redefine":197,"../internals/regexp-exec":199,"../internals/well-known-symbol":231,"../modules/es.regexp.exec":256}],147:[function(require,module,exports){
|
16181 | var aFunction = require('../internals/a-function');
|
16182 |
|
16183 |
|
16184 | module.exports = function (fn, that, length) {
|
16185 | aFunction(fn);
|
16186 | if (that === undefined) return fn;
|
16187 | switch (length) {
|
16188 | case 0: return function () {
|
16189 | return fn.call(that);
|
16190 | };
|
16191 | case 1: return function (a) {
|
16192 | return fn.call(that, a);
|
16193 | };
|
16194 | case 2: return function (a, b) {
|
16195 | return fn.call(that, a, b);
|
16196 | };
|
16197 | case 3: return function (a, b, c) {
|
16198 | return fn.call(that, a, b, c);
|
16199 | };
|
16200 | }
|
16201 | return function (/* ...args */) {
|
16202 | return fn.apply(that, arguments);
|
16203 | };
|
16204 | };
|
16205 |
|
16206 | },{"../internals/a-function":102}],148:[function(require,module,exports){
|
16207 | var path = require('../internals/path');
|
16208 | var global = require('../internals/global');
|
16209 |
|
16210 | var aFunction = function (variable) {
|
16211 | return typeof variable == 'function' ? variable : undefined;
|
16212 | };
|
16213 |
|
16214 | module.exports = function (namespace, method) {
|
16215 | return arguments.length < 2 ? aFunction(path[namespace]) || aFunction(global[namespace])
|
16216 | : path[namespace] && path[namespace][method] || global[namespace] && global[namespace][method];
|
16217 | };
|
16218 |
|
16219 | },{"../internals/global":150,"../internals/path":193}],149:[function(require,module,exports){
|
16220 | var classof = require('../internals/classof');
|
16221 | var Iterators = require('../internals/iterators');
|
16222 | var wellKnownSymbol = require('../internals/well-known-symbol');
|
16223 |
|
16224 | var ITERATOR = wellKnownSymbol('iterator');
|
16225 |
|
16226 | module.exports = function (it) {
|
16227 | if (it != undefined) return it[ITERATOR]
|
16228 | || it['@@iterator']
|
16229 | || Iterators[classof(it)];
|
16230 | };
|
16231 |
|
16232 | },{"../internals/classof":126,"../internals/iterators":170,"../internals/well-known-symbol":231}],150:[function(require,module,exports){
|
16233 | (function (global){
|
16234 | var check = function (it) {
|
16235 | return it && it.Math == Math && it;
|
16236 | };
|
16237 |
|
16238 |
|
16239 | module.exports =
|
16240 |
|
16241 | check(typeof globalThis == 'object' && globalThis) ||
|
16242 | check(typeof window == 'object' && window) ||
|
16243 | check(typeof self == 'object' && self) ||
|
16244 | check(typeof global == 'object' && global) ||
|
16245 |
|
16246 | (function () { return this; })() || Function('return this')();
|
16247 |
|
16248 | }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
16249 | },{}],151:[function(require,module,exports){
|
16250 | var hasOwnProperty = {}.hasOwnProperty;
|
16251 |
|
16252 | module.exports = function (it, key) {
|
16253 | return hasOwnProperty.call(it, key);
|
16254 | };
|
16255 |
|
16256 | },{}],152:[function(require,module,exports){
|
16257 | module.exports = {};
|
16258 |
|
16259 | },{}],153:[function(require,module,exports){
|
16260 | var global = require('../internals/global');
|
16261 |
|
16262 | module.exports = function (a, b) {
|
16263 | var console = global.console;
|
16264 | if (console && console.error) {
|
16265 | arguments.length === 1 ? console.error(a) : console.error(a, b);
|
16266 | }
|
16267 | };
|
16268 |
|
16269 | },{"../internals/global":150}],154:[function(require,module,exports){
|
16270 | var getBuiltIn = require('../internals/get-built-in');
|
16271 |
|
16272 | module.exports = getBuiltIn('document', 'documentElement');
|
16273 |
|
16274 | },{"../internals/get-built-in":148}],155:[function(require,module,exports){
|
16275 | var DESCRIPTORS = require('../internals/descriptors');
|
16276 | var fails = require('../internals/fails');
|
16277 | var createElement = require('../internals/document-create-element');
|
16278 |
|
16279 |
|
16280 | module.exports = !DESCRIPTORS && !fails(function () {
|
16281 | return Object.defineProperty(createElement('div'), 'a', {
|
16282 | get: function () { return 7; }
|
16283 | }).a != 7;
|
16284 | });
|
16285 |
|
16286 | },{"../internals/descriptors":136,"../internals/document-create-element":137,"../internals/fails":145}],156:[function(require,module,exports){
|
16287 |
|
16288 |
|
16289 | var Infinity = 1 / 0;
|
16290 | var abs = Math.abs;
|
16291 | var pow = Math.pow;
|
16292 | var floor = Math.floor;
|
16293 | var log = Math.log;
|
16294 | var LN2 = Math.LN2;
|
16295 |
|
16296 | var pack = function (number, mantissaLength, bytes) {
|
16297 | var buffer = new Array(bytes);
|
16298 | var exponentLength = bytes * 8 - mantissaLength - 1;
|
16299 | var eMax = (1 << exponentLength) - 1;
|
16300 | var eBias = eMax >> 1;
|
16301 | var rt = mantissaLength === 23 ? pow(2, -24) - pow(2, -77) : 0;
|
16302 | var sign = number < 0 || number === 0 && 1 / number < 0 ? 1 : 0;
|
16303 | var index = 0;
|
16304 | var exponent, mantissa, c;
|
16305 | number = abs(number);
|
16306 |
|
16307 | if (number != number || number === Infinity) {
|
16308 |
|
16309 | mantissa = number != number ? 1 : 0;
|
16310 | exponent = eMax;
|
16311 | } else {
|
16312 | exponent = floor(log(number) / LN2);
|
16313 | if (number * (c = pow(2, -exponent)) < 1) {
|
16314 | exponent--;
|
16315 | c *= 2;
|
16316 | }
|
16317 | if (exponent + eBias >= 1) {
|
16318 | number += rt / c;
|
16319 | } else {
|
16320 | number += rt * pow(2, 1 - eBias);
|
16321 | }
|
16322 | if (number * c >= 2) {
|
16323 | exponent++;
|
16324 | c /= 2;
|
16325 | }
|
16326 | if (exponent + eBias >= eMax) {
|
16327 | mantissa = 0;
|
16328 | exponent = eMax;
|
16329 | } else if (exponent + eBias >= 1) {
|
16330 | mantissa = (number * c - 1) * pow(2, mantissaLength);
|
16331 | exponent = exponent + eBias;
|
16332 | } else {
|
16333 | mantissa = number * pow(2, eBias - 1) * pow(2, mantissaLength);
|
16334 | exponent = 0;
|
16335 | }
|
16336 | }
|
16337 | for (; mantissaLength >= 8; buffer[index++] = mantissa & 255, mantissa /= 256, mantissaLength -= 8);
|
16338 | exponent = exponent << mantissaLength | mantissa;
|
16339 | exponentLength += mantissaLength;
|
16340 | for (; exponentLength > 0; buffer[index++] = exponent & 255, exponent /= 256, exponentLength -= 8);
|
16341 | buffer[--index] |= sign * 128;
|
16342 | return buffer;
|
16343 | };
|
16344 |
|
16345 | var unpack = function (buffer, mantissaLength) {
|
16346 | var bytes = buffer.length;
|
16347 | var exponentLength = bytes * 8 - mantissaLength - 1;
|
16348 | var eMax = (1 << exponentLength) - 1;
|
16349 | var eBias = eMax >> 1;
|
16350 | var nBits = exponentLength - 7;
|
16351 | var index = bytes - 1;
|
16352 | var sign = buffer[index--];
|
16353 | var exponent = sign & 127;
|
16354 | var mantissa;
|
16355 | sign >>= 7;
|
16356 | for (; nBits > 0; exponent = exponent * 256 + buffer[index], index--, nBits -= 8);
|
16357 | mantissa = exponent & (1 << -nBits) - 1;
|
16358 | exponent >>= -nBits;
|
16359 | nBits += mantissaLength;
|
16360 | for (; nBits > 0; mantissa = mantissa * 256 + buffer[index], index--, nBits -= 8);
|
16361 | if (exponent === 0) {
|
16362 | exponent = 1 - eBias;
|
16363 | } else if (exponent === eMax) {
|
16364 | return mantissa ? NaN : sign ? -Infinity : Infinity;
|
16365 | } else {
|
16366 | mantissa = mantissa + pow(2, mantissaLength);
|
16367 | exponent = exponent - eBias;
|
16368 | } return (sign ? -1 : 1) * mantissa * pow(2, exponent - mantissaLength);
|
16369 | };
|
16370 |
|
16371 | module.exports = {
|
16372 | pack: pack,
|
16373 | unpack: unpack
|
16374 | };
|
16375 |
|
16376 | },{}],157:[function(require,module,exports){
|
16377 | var fails = require('../internals/fails');
|
16378 | var classof = require('../internals/classof-raw');
|
16379 |
|
16380 | var split = ''.split;
|
16381 |
|
16382 |
|
16383 | module.exports = fails(function () {
|
16384 |
|
16385 |
|
16386 | return !Object('z').propertyIsEnumerable(0);
|
16387 | }) ? function (it) {
|
16388 | return classof(it) == 'String' ? split.call(it, '') : Object(it);
|
16389 | } : Object;
|
16390 |
|
16391 | },{"../internals/classof-raw":125,"../internals/fails":145}],158:[function(require,module,exports){
|
16392 | var isObject = require('../internals/is-object');
|
16393 | var setPrototypeOf = require('../internals/object-set-prototype-of');
|
16394 |
|
16395 |
|
16396 | module.exports = function ($this, dummy, Wrapper) {
|
16397 | var NewTarget, NewTargetPrototype;
|
16398 | if (
|
16399 |
|
16400 | setPrototypeOf &&
|
16401 |
|
16402 | typeof (NewTarget = dummy.constructor) == 'function' &&
|
16403 | NewTarget !== Wrapper &&
|
16404 | isObject(NewTargetPrototype = NewTarget.prototype) &&
|
16405 | NewTargetPrototype !== Wrapper.prototype
|
16406 | ) setPrototypeOf($this, NewTargetPrototype);
|
16407 | return $this;
|
16408 | };
|
16409 |
|
16410 | },{"../internals/is-object":164,"../internals/object-set-prototype-of":189}],159:[function(require,module,exports){
|
16411 | var store = require('../internals/shared-store');
|
16412 |
|
16413 | var functionToString = Function.toString;
|
16414 |
|
16415 |
|
16416 | if (typeof store.inspectSource != 'function') {
|
16417 | store.inspectSource = function (it) {
|
16418 | return functionToString.call(it);
|
16419 | };
|
16420 | }
|
16421 |
|
16422 | module.exports = store.inspectSource;
|
16423 |
|
16424 | },{"../internals/shared-store":208}],160:[function(require,module,exports){
|
16425 | var NATIVE_WEAK_MAP = require('../internals/native-weak-map');
|
16426 | var global = require('../internals/global');
|
16427 | var isObject = require('../internals/is-object');
|
16428 | var createNonEnumerableProperty = require('../internals/create-non-enumerable-property');
|
16429 | var objectHas = require('../internals/has');
|
16430 | var shared = require('../internals/shared-store');
|
16431 | var sharedKey = require('../internals/shared-key');
|
16432 | var hiddenKeys = require('../internals/hidden-keys');
|
16433 |
|
16434 | var WeakMap = global.WeakMap;
|
16435 | var set, get, has;
|
16436 |
|
16437 | var enforce = function (it) {
|
16438 | return has(it) ? get(it) : set(it, {});
|
16439 | };
|
16440 |
|
16441 | var getterFor = function (TYPE) {
|
16442 | return function (it) {
|
16443 | var state;
|
16444 | if (!isObject(it) || (state = get(it)).type !== TYPE) {
|
16445 | throw TypeError('Incompatible receiver, ' + TYPE + ' required');
|
16446 | } return state;
|
16447 | };
|
16448 | };
|
16449 |
|
16450 | if (NATIVE_WEAK_MAP) {
|
16451 | var store = shared.state || (shared.state = new WeakMap());
|
16452 | var wmget = store.get;
|
16453 | var wmhas = store.has;
|
16454 | var wmset = store.set;
|
16455 | set = function (it, metadata) {
|
16456 | metadata.facade = it;
|
16457 | wmset.call(store, it, metadata);
|
16458 | return metadata;
|
16459 | };
|
16460 | get = function (it) {
|
16461 | return wmget.call(store, it) || {};
|
16462 | };
|
16463 | has = function (it) {
|
16464 | return wmhas.call(store, it);
|
16465 | };
|
16466 | } else {
|
16467 | var STATE = sharedKey('state');
|
16468 | hiddenKeys[STATE] = true;
|
16469 | set = function (it, metadata) {
|
16470 | metadata.facade = it;
|
16471 | createNonEnumerableProperty(it, STATE, metadata);
|
16472 | return metadata;
|
16473 | };
|
16474 | get = function (it) {
|
16475 | return objectHas(it, STATE) ? it[STATE] : {};
|
16476 | };
|
16477 | has = function (it) {
|
16478 | return objectHas(it, STATE);
|
16479 | };
|
16480 | }
|
16481 |
|
16482 | module.exports = {
|
16483 | set: set,
|
16484 | get: get,
|
16485 | has: has,
|
16486 | enforce: enforce,
|
16487 | getterFor: getterFor
|
16488 | };
|
16489 |
|
16490 | },{"../internals/create-non-enumerable-property":131,"../internals/global":150,"../internals/has":151,"../internals/hidden-keys":152,"../internals/is-object":164,"../internals/native-weak-map":174,"../internals/shared-key":207,"../internals/shared-store":208}],161:[function(require,module,exports){
|
16491 | var wellKnownSymbol = require('../internals/well-known-symbol');
|
16492 | var Iterators = require('../internals/iterators');
|
16493 |
|
16494 | var ITERATOR = wellKnownSymbol('iterator');
|
16495 | var ArrayPrototype = Array.prototype;
|
16496 |
|
16497 |
|
16498 | module.exports = function (it) {
|
16499 | return it !== undefined && (Iterators.Array === it || ArrayPrototype[ITERATOR] === it);
|
16500 | };
|
16501 |
|
16502 | },{"../internals/iterators":170,"../internals/well-known-symbol":231}],162:[function(require,module,exports){
|
16503 | var classof = require('../internals/classof-raw');
|
16504 |
|
16505 |
|
16506 |
|
16507 | module.exports = Array.isArray || function isArray(arg) {
|
16508 | return classof(arg) == 'Array';
|
16509 | };
|
16510 |
|
16511 | },{"../internals/classof-raw":125}],163:[function(require,module,exports){
|
16512 | var fails = require('../internals/fails');
|
16513 |
|
16514 | var replacement = /#|\.prototype\./;
|
16515 |
|
16516 | var isForced = function (feature, detection) {
|
16517 | var value = data[normalize(feature)];
|
16518 | return value == POLYFILL ? true
|
16519 | : value == NATIVE ? false
|
16520 | : typeof detection == 'function' ? fails(detection)
|
16521 | : !!detection;
|
16522 | };
|
16523 |
|
16524 | var normalize = isForced.normalize = function (string) {
|
16525 | return String(string).replace(replacement, '.').toLowerCase();
|
16526 | };
|
16527 |
|
16528 | var data = isForced.data = {};
|
16529 | var NATIVE = isForced.NATIVE = 'N';
|
16530 | var POLYFILL = isForced.POLYFILL = 'P';
|
16531 |
|
16532 | module.exports = isForced;
|
16533 |
|
16534 | },{"../internals/fails":145}],164:[function(require,module,exports){
|
16535 | module.exports = function (it) {
|
16536 | return typeof it === 'object' ? it !== null : typeof it === 'function';
|
16537 | };
|
16538 |
|
16539 | },{}],165:[function(require,module,exports){
|
16540 | module.exports = false;
|
16541 |
|
16542 | },{}],166:[function(require,module,exports){
|
16543 | var isObject = require('../internals/is-object');
|
16544 | var classof = require('../internals/classof-raw');
|
16545 | var wellKnownSymbol = require('../internals/well-known-symbol');
|
16546 |
|
16547 | var MATCH = wellKnownSymbol('match');
|
16548 |
|
16549 |
|
16550 |
|
16551 | module.exports = function (it) {
|
16552 | var isRegExp;
|
16553 | return isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : classof(it) == 'RegExp');
|
16554 | };
|
16555 |
|
16556 | },{"../internals/classof-raw":125,"../internals/is-object":164,"../internals/well-known-symbol":231}],167:[function(require,module,exports){
|
16557 | var anObject = require('../internals/an-object');
|
16558 | var isArrayIteratorMethod = require('../internals/is-array-iterator-method');
|
16559 | var toLength = require('../internals/to-length');
|
16560 | var bind = require('../internals/function-bind-context');
|
16561 | var getIteratorMethod = require('../internals/get-iterator-method');
|
16562 | var iteratorClose = require('../internals/iterator-close');
|
16563 |
|
16564 | var Result = function (stopped, result) {
|
16565 | this.stopped = stopped;
|
16566 | this.result = result;
|
16567 | };
|
16568 |
|
16569 | module.exports = function (iterable, unboundFunction, options) {
|
16570 | var that = options && options.that;
|
16571 | var AS_ENTRIES = !!(options && options.AS_ENTRIES);
|
16572 | var IS_ITERATOR = !!(options && options.IS_ITERATOR);
|
16573 | var INTERRUPTED = !!(options && options.INTERRUPTED);
|
16574 | var fn = bind(unboundFunction, that, 1 + AS_ENTRIES + INTERRUPTED);
|
16575 | var iterator, iterFn, index, length, result, next, step;
|
16576 |
|
16577 | var stop = function (condition) {
|
16578 | if (iterator) iteratorClose(iterator);
|
16579 | return new Result(true, condition);
|
16580 | };
|
16581 |
|
16582 | var callFn = function (value) {
|
16583 | if (AS_ENTRIES) {
|
16584 | anObject(value);
|
16585 | return INTERRUPTED ? fn(value[0], value[1], stop) : fn(value[0], value[1]);
|
16586 | } return INTERRUPTED ? fn(value, stop) : fn(value);
|
16587 | };
|
16588 |
|
16589 | if (IS_ITERATOR) {
|
16590 | iterator = iterable;
|
16591 | } else {
|
16592 | iterFn = getIteratorMethod(iterable);
|
16593 | if (typeof iterFn != 'function') throw TypeError('Target is not iterable');
|
16594 |
|
16595 | if (isArrayIteratorMethod(iterFn)) {
|
16596 | for (index = 0, length = toLength(iterable.length); length > index; index++) {
|
16597 | result = callFn(iterable[index]);
|
16598 | if (result && result instanceof Result) return result;
|
16599 | } return new Result(false);
|
16600 | }
|
16601 | iterator = iterFn.call(iterable);
|
16602 | }
|
16603 |
|
16604 | next = iterator.next;
|
16605 | while (!(step = next.call(iterator)).done) {
|
16606 | try {
|
16607 | result = callFn(step.value);
|
16608 | } catch (error) {
|
16609 | iteratorClose(iterator);
|
16610 | throw error;
|
16611 | }
|
16612 | if (typeof result == 'object' && result && result instanceof Result) return result;
|
16613 | } return new Result(false);
|
16614 | };
|
16615 |
|
16616 | },{"../internals/an-object":107,"../internals/function-bind-context":147,"../internals/get-iterator-method":149,"../internals/is-array-iterator-method":161,"../internals/iterator-close":168,"../internals/to-length":219}],168:[function(require,module,exports){
|
16617 | var anObject = require('../internals/an-object');
|
16618 |
|
16619 | module.exports = function (iterator) {
|
16620 | var returnMethod = iterator['return'];
|
16621 | if (returnMethod !== undefined) {
|
16622 | return anObject(returnMethod.call(iterator)).value;
|
16623 | }
|
16624 | };
|
16625 |
|
16626 | },{"../internals/an-object":107}],169:[function(require,module,exports){
|
16627 | 'use strict';
|
16628 | var getPrototypeOf = require('../internals/object-get-prototype-of');
|
16629 | var createNonEnumerableProperty = require('../internals/create-non-enumerable-property');
|
16630 | var has = require('../internals/has');
|
16631 | var wellKnownSymbol = require('../internals/well-known-symbol');
|
16632 | var IS_PURE = require('../internals/is-pure');
|
16633 |
|
16634 | var ITERATOR = wellKnownSymbol('iterator');
|
16635 | var BUGGY_SAFARI_ITERATORS = false;
|
16636 |
|
16637 | var returnThis = function () { return this; };
|
16638 |
|
16639 |
|
16640 |
|
16641 | var IteratorPrototype, PrototypeOfArrayIteratorPrototype, arrayIterator;
|
16642 |
|
16643 | if ([].keys) {
|
16644 | arrayIterator = [].keys();
|
16645 |
|
16646 | if (!('next' in arrayIterator)) BUGGY_SAFARI_ITERATORS = true;
|
16647 | else {
|
16648 | PrototypeOfArrayIteratorPrototype = getPrototypeOf(getPrototypeOf(arrayIterator));
|
16649 | if (PrototypeOfArrayIteratorPrototype !== Object.prototype) IteratorPrototype = PrototypeOfArrayIteratorPrototype;
|
16650 | }
|
16651 | }
|
16652 |
|
16653 | if (IteratorPrototype == undefined) IteratorPrototype = {};
|
16654 |
|
16655 |
|
16656 | if (!IS_PURE && !has(IteratorPrototype, ITERATOR)) {
|
16657 | createNonEnumerableProperty(IteratorPrototype, ITERATOR, returnThis);
|
16658 | }
|
16659 |
|
16660 | module.exports = {
|
16661 | IteratorPrototype: IteratorPrototype,
|
16662 | BUGGY_SAFARI_ITERATORS: BUGGY_SAFARI_ITERATORS
|
16663 | };
|
16664 |
|
16665 | },{"../internals/create-non-enumerable-property":131,"../internals/has":151,"../internals/is-pure":165,"../internals/object-get-prototype-of":185,"../internals/well-known-symbol":231}],170:[function(require,module,exports){
|
16666 | arguments[4][152][0].apply(exports,arguments)
|
16667 | },{"dup":152}],171:[function(require,module,exports){
|
16668 | var global = require('../internals/global');
|
16669 | var getOwnPropertyDescriptor = require('../internals/object-get-own-property-descriptor').f;
|
16670 | var macrotask = require('../internals/task').set;
|
16671 | var IS_IOS = require('../internals/engine-is-ios');
|
16672 | var IS_NODE = require('../internals/engine-is-node');
|
16673 |
|
16674 | var MutationObserver = global.MutationObserver || global.WebKitMutationObserver;
|
16675 | var document = global.document;
|
16676 | var process = global.process;
|
16677 | var Promise = global.Promise;
|
16678 |
|
16679 | var queueMicrotaskDescriptor = getOwnPropertyDescriptor(global, 'queueMicrotask');
|
16680 | var queueMicrotask = queueMicrotaskDescriptor && queueMicrotaskDescriptor.value;
|
16681 |
|
16682 | var flush, head, last, notify, toggle, node, promise, then;
|
16683 |
|
16684 |
|
16685 | if (!queueMicrotask) {
|
16686 | flush = function () {
|
16687 | var parent, fn;
|
16688 | if (IS_NODE && (parent = process.domain)) parent.exit();
|
16689 | while (head) {
|
16690 | fn = head.fn;
|
16691 | head = head.next;
|
16692 | try {
|
16693 | fn();
|
16694 | } catch (error) {
|
16695 | if (head) notify();
|
16696 | else last = undefined;
|
16697 | throw error;
|
16698 | }
|
16699 | } last = undefined;
|
16700 | if (parent) parent.enter();
|
16701 | };
|
16702 |
|
16703 |
|
16704 | if (!IS_IOS && !IS_NODE && MutationObserver && document) {
|
16705 | toggle = true;
|
16706 | node = document.createTextNode('');
|
16707 | new MutationObserver(flush).observe(node, { characterData: true });
|
16708 | notify = function () {
|
16709 | node.data = toggle = !toggle;
|
16710 | };
|
16711 |
|
16712 | } else if (Promise && Promise.resolve) {
|
16713 |
|
16714 | promise = Promise.resolve(undefined);
|
16715 | then = promise.then;
|
16716 | notify = function () {
|
16717 | then.call(promise, flush);
|
16718 | };
|
16719 |
|
16720 | } else if (IS_NODE) {
|
16721 | notify = function () {
|
16722 | process.nextTick(flush);
|
16723 | };
|
16724 |
|
16725 |
|
16726 |
|
16727 |
|
16728 |
|
16729 |
|
16730 | } else {
|
16731 | notify = function () {
|
16732 |
|
16733 | macrotask.call(global, flush);
|
16734 | };
|
16735 | }
|
16736 | }
|
16737 |
|
16738 | module.exports = queueMicrotask || function (fn) {
|
16739 | var task = { fn: fn, next: undefined };
|
16740 | if (last) last.next = task;
|
16741 | if (!head) {
|
16742 | head = task;
|
16743 | notify();
|
16744 | } last = task;
|
16745 | };
|
16746 |
|
16747 | },{"../internals/engine-is-ios":139,"../internals/engine-is-node":140,"../internals/global":150,"../internals/object-get-own-property-descriptor":181,"../internals/task":214}],172:[function(require,module,exports){
|
16748 | var global = require('../internals/global');
|
16749 |
|
16750 | module.exports = global.Promise;
|
16751 |
|
16752 | },{"../internals/global":150}],173:[function(require,module,exports){
|
16753 | var fails = require('../internals/fails');
|
16754 |
|
16755 | module.exports = !!Object.getOwnPropertySymbols && !fails(function () {
|
16756 |
|
16757 |
|
16758 | return !String(Symbol());
|
16759 | });
|
16760 |
|
16761 | },{"../internals/fails":145}],174:[function(require,module,exports){
|
16762 | var global = require('../internals/global');
|
16763 | var inspectSource = require('../internals/inspect-source');
|
16764 |
|
16765 | var WeakMap = global.WeakMap;
|
16766 |
|
16767 | module.exports = typeof WeakMap === 'function' && /native code/.test(inspectSource(WeakMap));
|
16768 |
|
16769 | },{"../internals/global":150,"../internals/inspect-source":159}],175:[function(require,module,exports){
|
16770 | 'use strict';
|
16771 | var aFunction = require('../internals/a-function');
|
16772 |
|
16773 | var PromiseCapability = function (C) {
|
16774 | var resolve, reject;
|
16775 | this.promise = new C(function ($$resolve, $$reject) {
|
16776 | if (resolve !== undefined || reject !== undefined) throw TypeError('Bad Promise constructor');
|
16777 | resolve = $$resolve;
|
16778 | reject = $$reject;
|
16779 | });
|
16780 | this.resolve = aFunction(resolve);
|
16781 | this.reject = aFunction(reject);
|
16782 | };
|
16783 |
|
16784 |
|
16785 | module.exports.f = function (C) {
|
16786 | return new PromiseCapability(C);
|
16787 | };
|
16788 |
|
16789 | },{"../internals/a-function":102}],176:[function(require,module,exports){
|
16790 | var isRegExp = require('../internals/is-regexp');
|
16791 |
|
16792 | module.exports = function (it) {
|
16793 | if (isRegExp(it)) {
|
16794 | throw TypeError("The method doesn't accept regular expressions");
|
16795 | } return it;
|
16796 | };
|
16797 |
|
16798 | },{"../internals/is-regexp":166}],177:[function(require,module,exports){
|
16799 | 'use strict';
|
16800 | var DESCRIPTORS = require('../internals/descriptors');
|
16801 | var fails = require('../internals/fails');
|
16802 | var objectKeys = require('../internals/object-keys');
|
16803 | var getOwnPropertySymbolsModule = require('../internals/object-get-own-property-symbols');
|
16804 | var propertyIsEnumerableModule = require('../internals/object-property-is-enumerable');
|
16805 | var toObject = require('../internals/to-object');
|
16806 | var IndexedObject = require('../internals/indexed-object');
|
16807 |
|
16808 | var nativeAssign = Object.assign;
|
16809 | var defineProperty = Object.defineProperty;
|
16810 |
|
16811 |
|
16812 |
|
16813 | module.exports = !nativeAssign || fails(function () {
|
16814 |
|
16815 | if (DESCRIPTORS && nativeAssign({ b: 1 }, nativeAssign(defineProperty({}, 'a', {
|
16816 | enumerable: true,
|
16817 | get: function () {
|
16818 | defineProperty(this, 'b', {
|
16819 | value: 3,
|
16820 | enumerable: false
|
16821 | });
|
16822 | }
|
16823 | }), { b: 2 })).b !== 1) return true;
|
16824 |
|
16825 | var A = {};
|
16826 | var B = {};
|
16827 |
|
16828 | var symbol = Symbol();
|
16829 | var alphabet = 'abcdefghijklmnopqrst';
|
16830 | A[symbol] = 7;
|
16831 | alphabet.split('').forEach(function (chr) { B[chr] = chr; });
|
16832 | return nativeAssign({}, A)[symbol] != 7 || objectKeys(nativeAssign({}, B)).join('') != alphabet;
|
16833 | }) ? function assign(target, source) {
|
16834 | var T = toObject(target);
|
16835 | var argumentsLength = arguments.length;
|
16836 | var index = 1;
|
16837 | var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
|
16838 | var propertyIsEnumerable = propertyIsEnumerableModule.f;
|
16839 | while (argumentsLength > index) {
|
16840 | var S = IndexedObject(arguments[index++]);
|
16841 | var keys = getOwnPropertySymbols ? objectKeys(S).concat(getOwnPropertySymbols(S)) : objectKeys(S);
|
16842 | var length = keys.length;
|
16843 | var j = 0;
|
16844 | var key;
|
16845 | while (length > j) {
|
16846 | key = keys[j++];
|
16847 | if (!DESCRIPTORS || propertyIsEnumerable.call(S, key)) T[key] = S[key];
|
16848 | }
|
16849 | } return T;
|
16850 | } : nativeAssign;
|
16851 |
|
16852 | },{"../internals/descriptors":136,"../internals/fails":145,"../internals/indexed-object":157,"../internals/object-get-own-property-symbols":184,"../internals/object-keys":187,"../internals/object-property-is-enumerable":188,"../internals/to-object":220}],178:[function(require,module,exports){
|
16853 | var anObject = require('../internals/an-object');
|
16854 | var defineProperties = require('../internals/object-define-properties');
|
16855 | var enumBugKeys = require('../internals/enum-bug-keys');
|
16856 | var hiddenKeys = require('../internals/hidden-keys');
|
16857 | var html = require('../internals/html');
|
16858 | var documentCreateElement = require('../internals/document-create-element');
|
16859 | var sharedKey = require('../internals/shared-key');
|
16860 |
|
16861 | var GT = '>';
|
16862 | var LT = '<';
|
16863 | var PROTOTYPE = 'prototype';
|
16864 | var SCRIPT = 'script';
|
16865 | var IE_PROTO = sharedKey('IE_PROTO');
|
16866 |
|
16867 | var EmptyConstructor = function () { };
|
16868 |
|
16869 | var scriptTag = function (content) {
|
16870 | return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT;
|
16871 | };
|
16872 |
|
16873 |
|
16874 | var NullProtoObjectViaActiveX = function (activeXDocument) {
|
16875 | activeXDocument.write(scriptTag(''));
|
16876 | activeXDocument.close();
|
16877 | var temp = activeXDocument.parentWindow.Object;
|
16878 | activeXDocument = null;
|
16879 | return temp;
|
16880 | };
|
16881 |
|
16882 |
|
16883 | var NullProtoObjectViaIFrame = function () {
|
16884 |
|
16885 | var iframe = documentCreateElement('iframe');
|
16886 | var JS = 'java' + SCRIPT + ':';
|
16887 | var iframeDocument;
|
16888 | iframe.style.display = 'none';
|
16889 | html.appendChild(iframe);
|
16890 |
|
16891 | iframe.src = String(JS);
|
16892 | iframeDocument = iframe.contentWindow.document;
|
16893 | iframeDocument.open();
|
16894 | iframeDocument.write(scriptTag('document.F=Object'));
|
16895 | iframeDocument.close();
|
16896 | return iframeDocument.F;
|
16897 | };
|
16898 |
|
16899 |
|
16900 |
|
16901 |
|
16902 |
|
16903 |
|
16904 | var activeXDocument;
|
16905 | var NullProtoObject = function () {
|
16906 | try {
|
16907 |
|
16908 | activeXDocument = document.domain && new ActiveXObject('htmlfile');
|
16909 | } catch (error) { }
|
16910 | NullProtoObject = activeXDocument ? NullProtoObjectViaActiveX(activeXDocument) : NullProtoObjectViaIFrame();
|
16911 | var length = enumBugKeys.length;
|
16912 | while (length--) delete NullProtoObject[PROTOTYPE][enumBugKeys[length]];
|
16913 | return NullProtoObject();
|
16914 | };
|
16915 |
|
16916 | hiddenKeys[IE_PROTO] = true;
|
16917 |
|
16918 |
|
16919 |
|
16920 | module.exports = Object.create || function create(O, Properties) {
|
16921 | var result;
|
16922 | if (O !== null) {
|
16923 | EmptyConstructor[PROTOTYPE] = anObject(O);
|
16924 | result = new EmptyConstructor();
|
16925 | EmptyConstructor[PROTOTYPE] = null;
|
16926 |
|
16927 | result[IE_PROTO] = O;
|
16928 | } else result = NullProtoObject();
|
16929 | return Properties === undefined ? result : defineProperties(result, Properties);
|
16930 | };
|
16931 |
|
16932 | },{"../internals/an-object":107,"../internals/document-create-element":137,"../internals/enum-bug-keys":143,"../internals/hidden-keys":152,"../internals/html":154,"../internals/object-define-properties":179,"../internals/shared-key":207}],179:[function(require,module,exports){
|
16933 | var DESCRIPTORS = require('../internals/descriptors');
|
16934 | var definePropertyModule = require('../internals/object-define-property');
|
16935 | var anObject = require('../internals/an-object');
|
16936 | var objectKeys = require('../internals/object-keys');
|
16937 |
|
16938 |
|
16939 |
|
16940 | module.exports = DESCRIPTORS ? Object.defineProperties : function defineProperties(O, Properties) {
|
16941 | anObject(O);
|
16942 | var keys = objectKeys(Properties);
|
16943 | var length = keys.length;
|
16944 | var index = 0;
|
16945 | var key;
|
16946 | while (length > index) definePropertyModule.f(O, key = keys[index++], Properties[key]);
|
16947 | return O;
|
16948 | };
|
16949 |
|
16950 | },{"../internals/an-object":107,"../internals/descriptors":136,"../internals/object-define-property":180,"../internals/object-keys":187}],180:[function(require,module,exports){
|
16951 | var DESCRIPTORS = require('../internals/descriptors');
|
16952 | var IE8_DOM_DEFINE = require('../internals/ie8-dom-define');
|
16953 | var anObject = require('../internals/an-object');
|
16954 | var toPrimitive = require('../internals/to-primitive');
|
16955 |
|
16956 | var nativeDefineProperty = Object.defineProperty;
|
16957 |
|
16958 |
|
16959 |
|
16960 | exports.f = DESCRIPTORS ? nativeDefineProperty : function defineProperty(O, P, Attributes) {
|
16961 | anObject(O);
|
16962 | P = toPrimitive(P, true);
|
16963 | anObject(Attributes);
|
16964 | if (IE8_DOM_DEFINE) try {
|
16965 | return nativeDefineProperty(O, P, Attributes);
|
16966 | } catch (error) { }
|
16967 | if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported');
|
16968 | if ('value' in Attributes) O[P] = Attributes.value;
|
16969 | return O;
|
16970 | };
|
16971 |
|
16972 | },{"../internals/an-object":107,"../internals/descriptors":136,"../internals/ie8-dom-define":155,"../internals/to-primitive":223}],181:[function(require,module,exports){
|
16973 | var DESCRIPTORS = require('../internals/descriptors');
|
16974 | var propertyIsEnumerableModule = require('../internals/object-property-is-enumerable');
|
16975 | var createPropertyDescriptor = require('../internals/create-property-descriptor');
|
16976 | var toIndexedObject = require('../internals/to-indexed-object');
|
16977 | var toPrimitive = require('../internals/to-primitive');
|
16978 | var has = require('../internals/has');
|
16979 | var IE8_DOM_DEFINE = require('../internals/ie8-dom-define');
|
16980 |
|
16981 | var nativeGetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
16982 |
|
16983 |
|
16984 |
|
16985 | exports.f = DESCRIPTORS ? nativeGetOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {
|
16986 | O = toIndexedObject(O);
|
16987 | P = toPrimitive(P, true);
|
16988 | if (IE8_DOM_DEFINE) try {
|
16989 | return nativeGetOwnPropertyDescriptor(O, P);
|
16990 | } catch (error) { }
|
16991 | if (has(O, P)) return createPropertyDescriptor(!propertyIsEnumerableModule.f.call(O, P), O[P]);
|
16992 | };
|
16993 |
|
16994 | },{"../internals/create-property-descriptor":132,"../internals/descriptors":136,"../internals/has":151,"../internals/ie8-dom-define":155,"../internals/object-property-is-enumerable":188,"../internals/to-indexed-object":217,"../internals/to-primitive":223}],182:[function(require,module,exports){
|
16995 | var toIndexedObject = require('../internals/to-indexed-object');
|
16996 | var nativeGetOwnPropertyNames = require('../internals/object-get-own-property-names').f;
|
16997 |
|
16998 | var toString = {}.toString;
|
16999 |
|
17000 | var windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames
|
17001 | ? Object.getOwnPropertyNames(window) : [];
|
17002 |
|
17003 | var getWindowNames = function (it) {
|
17004 | try {
|
17005 | return nativeGetOwnPropertyNames(it);
|
17006 | } catch (error) {
|
17007 | return windowNames.slice();
|
17008 | }
|
17009 | };
|
17010 |
|
17011 |
|
17012 | module.exports.f = function getOwnPropertyNames(it) {
|
17013 | return windowNames && toString.call(it) == '[object Window]'
|
17014 | ? getWindowNames(it)
|
17015 | : nativeGetOwnPropertyNames(toIndexedObject(it));
|
17016 | };
|
17017 |
|
17018 | },{"../internals/object-get-own-property-names":183,"../internals/to-indexed-object":217}],183:[function(require,module,exports){
|
17019 | var internalObjectKeys = require('../internals/object-keys-internal');
|
17020 | var enumBugKeys = require('../internals/enum-bug-keys');
|
17021 |
|
17022 | var hiddenKeys = enumBugKeys.concat('length', 'prototype');
|
17023 |
|
17024 |
|
17025 |
|
17026 | exports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
|
17027 | return internalObjectKeys(O, hiddenKeys);
|
17028 | };
|
17029 |
|
17030 | },{"../internals/enum-bug-keys":143,"../internals/object-keys-internal":186}],184:[function(require,module,exports){
|
17031 | exports.f = Object.getOwnPropertySymbols;
|
17032 |
|
17033 | },{}],185:[function(require,module,exports){
|
17034 | var has = require('../internals/has');
|
17035 | var toObject = require('../internals/to-object');
|
17036 | var sharedKey = require('../internals/shared-key');
|
17037 | var CORRECT_PROTOTYPE_GETTER = require('../internals/correct-prototype-getter');
|
17038 |
|
17039 | var IE_PROTO = sharedKey('IE_PROTO');
|
17040 | var ObjectPrototype = Object.prototype;
|
17041 |
|
17042 |
|
17043 |
|
17044 | module.exports = CORRECT_PROTOTYPE_GETTER ? Object.getPrototypeOf : function (O) {
|
17045 | O = toObject(O);
|
17046 | if (has(O, IE_PROTO)) return O[IE_PROTO];
|
17047 | if (typeof O.constructor == 'function' && O instanceof O.constructor) {
|
17048 | return O.constructor.prototype;
|
17049 | } return O instanceof Object ? ObjectPrototype : null;
|
17050 | };
|
17051 |
|
17052 | },{"../internals/correct-prototype-getter":129,"../internals/has":151,"../internals/shared-key":207,"../internals/to-object":220}],186:[function(require,module,exports){
|
17053 | var has = require('../internals/has');
|
17054 | var toIndexedObject = require('../internals/to-indexed-object');
|
17055 | var indexOf = require('../internals/array-includes').indexOf;
|
17056 | var hiddenKeys = require('../internals/hidden-keys');
|
17057 |
|
17058 | module.exports = function (object, names) {
|
17059 | var O = toIndexedObject(object);
|
17060 | var i = 0;
|
17061 | var result = [];
|
17062 | var key;
|
17063 | for (key in O) !has(hiddenKeys, key) && has(O, key) && result.push(key);
|
17064 |
|
17065 | while (names.length > i) if (has(O, key = names[i++])) {
|
17066 | ~indexOf(result, key) || result.push(key);
|
17067 | }
|
17068 | return result;
|
17069 | };
|
17070 |
|
17071 | },{"../internals/array-includes":115,"../internals/has":151,"../internals/hidden-keys":152,"../internals/to-indexed-object":217}],187:[function(require,module,exports){
|
17072 | var internalObjectKeys = require('../internals/object-keys-internal');
|
17073 | var enumBugKeys = require('../internals/enum-bug-keys');
|
17074 |
|
17075 |
|
17076 |
|
17077 | module.exports = Object.keys || function keys(O) {
|
17078 | return internalObjectKeys(O, enumBugKeys);
|
17079 | };
|
17080 |
|
17081 | },{"../internals/enum-bug-keys":143,"../internals/object-keys-internal":186}],188:[function(require,module,exports){
|
17082 | 'use strict';
|
17083 | var nativePropertyIsEnumerable = {}.propertyIsEnumerable;
|
17084 | var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
17085 |
|
17086 |
|
17087 | var NASHORN_BUG = getOwnPropertyDescriptor && !nativePropertyIsEnumerable.call({ 1: 2 }, 1);
|
17088 |
|
17089 |
|
17090 |
|
17091 | exports.f = NASHORN_BUG ? function propertyIsEnumerable(V) {
|
17092 | var descriptor = getOwnPropertyDescriptor(this, V);
|
17093 | return !!descriptor && descriptor.enumerable;
|
17094 | } : nativePropertyIsEnumerable;
|
17095 |
|
17096 | },{}],189:[function(require,module,exports){
|
17097 | var anObject = require('../internals/an-object');
|
17098 | var aPossiblePrototype = require('../internals/a-possible-prototype');
|
17099 |
|
17100 |
|
17101 |
|
17102 |
|
17103 |
|
17104 | module.exports = Object.setPrototypeOf || ('__proto__' in {} ? function () {
|
17105 | var CORRECT_SETTER = false;
|
17106 | var test = {};
|
17107 | var setter;
|
17108 | try {
|
17109 | setter = Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set;
|
17110 | setter.call(test, []);
|
17111 | CORRECT_SETTER = test instanceof Array;
|
17112 | } catch (error) { }
|
17113 | return function setPrototypeOf(O, proto) {
|
17114 | anObject(O);
|
17115 | aPossiblePrototype(proto);
|
17116 | if (CORRECT_SETTER) setter.call(O, proto);
|
17117 | else O.__proto__ = proto;
|
17118 | return O;
|
17119 | };
|
17120 | }() : undefined);
|
17121 |
|
17122 | },{"../internals/a-possible-prototype":103,"../internals/an-object":107}],190:[function(require,module,exports){
|
17123 | var DESCRIPTORS = require('../internals/descriptors');
|
17124 | var objectKeys = require('../internals/object-keys');
|
17125 | var toIndexedObject = require('../internals/to-indexed-object');
|
17126 | var propertyIsEnumerable = require('../internals/object-property-is-enumerable').f;
|
17127 |
|
17128 |
|
17129 | var createMethod = function (TO_ENTRIES) {
|
17130 | return function (it) {
|
17131 | var O = toIndexedObject(it);
|
17132 | var keys = objectKeys(O);
|
17133 | var length = keys.length;
|
17134 | var i = 0;
|
17135 | var result = [];
|
17136 | var key;
|
17137 | while (length > i) {
|
17138 | key = keys[i++];
|
17139 | if (!DESCRIPTORS || propertyIsEnumerable.call(O, key)) {
|
17140 | result.push(TO_ENTRIES ? [key, O[key]] : O[key]);
|
17141 | }
|
17142 | }
|
17143 | return result;
|
17144 | };
|
17145 | };
|
17146 |
|
17147 | module.exports = {
|
17148 |
|
17149 |
|
17150 | entries: createMethod(true),
|
17151 |
|
17152 |
|
17153 | values: createMethod(false)
|
17154 | };
|
17155 |
|
17156 | },{"../internals/descriptors":136,"../internals/object-keys":187,"../internals/object-property-is-enumerable":188,"../internals/to-indexed-object":217}],191:[function(require,module,exports){
|
17157 | 'use strict';
|
17158 | var TO_STRING_TAG_SUPPORT = require('../internals/to-string-tag-support');
|
17159 | var classof = require('../internals/classof');
|
17160 |
|
17161 |
|
17162 |
|
17163 | module.exports = TO_STRING_TAG_SUPPORT ? {}.toString : function toString() {
|
17164 | return '[object ' + classof(this) + ']';
|
17165 | };
|
17166 |
|
17167 | },{"../internals/classof":126,"../internals/to-string-tag-support":224}],192:[function(require,module,exports){
|
17168 | var getBuiltIn = require('../internals/get-built-in');
|
17169 | var getOwnPropertyNamesModule = require('../internals/object-get-own-property-names');
|
17170 | var getOwnPropertySymbolsModule = require('../internals/object-get-own-property-symbols');
|
17171 | var anObject = require('../internals/an-object');
|
17172 |
|
17173 |
|
17174 | module.exports = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) {
|
17175 | var keys = getOwnPropertyNamesModule.f(anObject(it));
|
17176 | var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
|
17177 | return getOwnPropertySymbols ? keys.concat(getOwnPropertySymbols(it)) : keys;
|
17178 | };
|
17179 |
|
17180 | },{"../internals/an-object":107,"../internals/get-built-in":148,"../internals/object-get-own-property-names":183,"../internals/object-get-own-property-symbols":184}],193:[function(require,module,exports){
|
17181 | var global = require('../internals/global');
|
17182 |
|
17183 | module.exports = global;
|
17184 |
|
17185 | },{"../internals/global":150}],194:[function(require,module,exports){
|
17186 | module.exports = function (exec) {
|
17187 | try {
|
17188 | return { error: false, value: exec() };
|
17189 | } catch (error) {
|
17190 | return { error: true, value: error };
|
17191 | }
|
17192 | };
|
17193 |
|
17194 | },{}],195:[function(require,module,exports){
|
17195 | var anObject = require('../internals/an-object');
|
17196 | var isObject = require('../internals/is-object');
|
17197 | var newPromiseCapability = require('../internals/new-promise-capability');
|
17198 |
|
17199 | module.exports = function (C, x) {
|
17200 | anObject(C);
|
17201 | if (isObject(x) && x.constructor === C) return x;
|
17202 | var promiseCapability = newPromiseCapability.f(C);
|
17203 | var resolve = promiseCapability.resolve;
|
17204 | resolve(x);
|
17205 | return promiseCapability.promise;
|
17206 | };
|
17207 |
|
17208 | },{"../internals/an-object":107,"../internals/is-object":164,"../internals/new-promise-capability":175}],196:[function(require,module,exports){
|
17209 | var redefine = require('../internals/redefine');
|
17210 |
|
17211 | module.exports = function (target, src, options) {
|
17212 | for (var key in src) redefine(target, key, src[key], options);
|
17213 | return target;
|
17214 | };
|
17215 |
|
17216 | },{"../internals/redefine":197}],197:[function(require,module,exports){
|
17217 | var global = require('../internals/global');
|
17218 | var createNonEnumerableProperty = require('../internals/create-non-enumerable-property');
|
17219 | var has = require('../internals/has');
|
17220 | var setGlobal = require('../internals/set-global');
|
17221 | var inspectSource = require('../internals/inspect-source');
|
17222 | var InternalStateModule = require('../internals/internal-state');
|
17223 |
|
17224 | var getInternalState = InternalStateModule.get;
|
17225 | var enforceInternalState = InternalStateModule.enforce;
|
17226 | var TEMPLATE = String(String).split('String');
|
17227 |
|
17228 | (module.exports = function (O, key, value, options) {
|
17229 | var unsafe = options ? !!options.unsafe : false;
|
17230 | var simple = options ? !!options.enumerable : false;
|
17231 | var noTargetGet = options ? !!options.noTargetGet : false;
|
17232 | var state;
|
17233 | if (typeof value == 'function') {
|
17234 | if (typeof key == 'string' && !has(value, 'name')) {
|
17235 | createNonEnumerableProperty(value, 'name', key);
|
17236 | }
|
17237 | state = enforceInternalState(value);
|
17238 | if (!state.source) {
|
17239 | state.source = TEMPLATE.join(typeof key == 'string' ? key : '');
|
17240 | }
|
17241 | }
|
17242 | if (O === global) {
|
17243 | if (simple) O[key] = value;
|
17244 | else setGlobal(key, value);
|
17245 | return;
|
17246 | } else if (!unsafe) {
|
17247 | delete O[key];
|
17248 | } else if (!noTargetGet && O[key]) {
|
17249 | simple = true;
|
17250 | }
|
17251 | if (simple) O[key] = value;
|
17252 | else createNonEnumerableProperty(O, key, value);
|
17253 |
|
17254 | })(Function.prototype, 'toString', function toString() {
|
17255 | return typeof this == 'function' && getInternalState(this).source || inspectSource(this);
|
17256 | });
|
17257 |
|
17258 | },{"../internals/create-non-enumerable-property":131,"../internals/global":150,"../internals/has":151,"../internals/inspect-source":159,"../internals/internal-state":160,"../internals/set-global":204}],198:[function(require,module,exports){
|
17259 | var classof = require('./classof-raw');
|
17260 | var regexpExec = require('./regexp-exec');
|
17261 |
|
17262 |
|
17263 |
|
17264 | module.exports = function (R, S) {
|
17265 | var exec = R.exec;
|
17266 | if (typeof exec === 'function') {
|
17267 | var result = exec.call(R, S);
|
17268 | if (typeof result !== 'object') {
|
17269 | throw TypeError('RegExp exec method returned something other than an Object or null');
|
17270 | }
|
17271 | return result;
|
17272 | }
|
17273 |
|
17274 | if (classof(R) !== 'RegExp') {
|
17275 | throw TypeError('RegExp#exec called on incompatible receiver');
|
17276 | }
|
17277 |
|
17278 | return regexpExec.call(R, S);
|
17279 | };
|
17280 |
|
17281 |
|
17282 | },{"./classof-raw":125,"./regexp-exec":199}],199:[function(require,module,exports){
|
17283 | 'use strict';
|
17284 | var regexpFlags = require('./regexp-flags');
|
17285 | var stickyHelpers = require('./regexp-sticky-helpers');
|
17286 |
|
17287 | var nativeExec = RegExp.prototype.exec;
|
17288 |
|
17289 |
|
17290 |
|
17291 | var nativeReplace = String.prototype.replace;
|
17292 |
|
17293 | var patchedExec = nativeExec;
|
17294 |
|
17295 | var UPDATES_LAST_INDEX_WRONG = (function () {
|
17296 | var re1 = /a/;
|
17297 | var re2 = /b*/g;
|
17298 | nativeExec.call(re1, 'a');
|
17299 | nativeExec.call(re2, 'a');
|
17300 | return re1.lastIndex !== 0 || re2.lastIndex !== 0;
|
17301 | })();
|
17302 |
|
17303 | var UNSUPPORTED_Y = stickyHelpers.UNSUPPORTED_Y || stickyHelpers.BROKEN_CARET;
|
17304 |
|
17305 |
|
17306 | var NPCG_INCLUDED = /()??/.exec('')[1] !== undefined;
|
17307 |
|
17308 | var PATCH = UPDATES_LAST_INDEX_WRONG || NPCG_INCLUDED || UNSUPPORTED_Y;
|
17309 |
|
17310 | if (PATCH) {
|
17311 | patchedExec = function exec(str) {
|
17312 | var re = this;
|
17313 | var lastIndex, reCopy, match, i;
|
17314 | var sticky = UNSUPPORTED_Y && re.sticky;
|
17315 | var flags = regexpFlags.call(re);
|
17316 | var source = re.source;
|
17317 | var charsAdded = 0;
|
17318 | var strCopy = str;
|
17319 |
|
17320 | if (sticky) {
|
17321 | flags = flags.replace('y', '');
|
17322 | if (flags.indexOf('g') === -1) {
|
17323 | flags += 'g';
|
17324 | }
|
17325 |
|
17326 | strCopy = String(str).slice(re.lastIndex);
|
17327 |
|
17328 | if (re.lastIndex > 0 && (!re.multiline || re.multiline && str[re.lastIndex - 1] !== '\n')) {
|
17329 | source = '(?: ' + source + ')';
|
17330 | strCopy = ' ' + strCopy;
|
17331 | charsAdded++;
|
17332 | }
|
17333 |
|
17334 |
|
17335 | reCopy = new RegExp('^(?:' + source + ')', flags);
|
17336 | }
|
17337 |
|
17338 | if (NPCG_INCLUDED) {
|
17339 | reCopy = new RegExp('^' + source + '$(?!\\s)', flags);
|
17340 | }
|
17341 | if (UPDATES_LAST_INDEX_WRONG) lastIndex = re.lastIndex;
|
17342 |
|
17343 | match = nativeExec.call(sticky ? reCopy : re, strCopy);
|
17344 |
|
17345 | if (sticky) {
|
17346 | if (match) {
|
17347 | match.input = match.input.slice(charsAdded);
|
17348 | match[0] = match[0].slice(charsAdded);
|
17349 | match.index = re.lastIndex;
|
17350 | re.lastIndex += match[0].length;
|
17351 | } else re.lastIndex = 0;
|
17352 | } else if (UPDATES_LAST_INDEX_WRONG && match) {
|
17353 | re.lastIndex = re.global ? match.index + match[0].length : lastIndex;
|
17354 | }
|
17355 | if (NPCG_INCLUDED && match && match.length > 1) {
|
17356 |
|
17357 |
|
17358 | nativeReplace.call(match[0], reCopy, function () {
|
17359 | for (i = 1; i < arguments.length - 2; i++) {
|
17360 | if (arguments[i] === undefined) match[i] = undefined;
|
17361 | }
|
17362 | });
|
17363 | }
|
17364 |
|
17365 | return match;
|
17366 | };
|
17367 | }
|
17368 |
|
17369 | module.exports = patchedExec;
|
17370 |
|
17371 | },{"./regexp-flags":200,"./regexp-sticky-helpers":201}],200:[function(require,module,exports){
|
17372 | 'use strict';
|
17373 | var anObject = require('../internals/an-object');
|
17374 |
|
17375 |
|
17376 |
|
17377 | module.exports = function () {
|
17378 | var that = anObject(this);
|
17379 | var result = '';
|
17380 | if (that.global) result += 'g';
|
17381 | if (that.ignoreCase) result += 'i';
|
17382 | if (that.multiline) result += 'm';
|
17383 | if (that.dotAll) result += 's';
|
17384 | if (that.unicode) result += 'u';
|
17385 | if (that.sticky) result += 'y';
|
17386 | return result;
|
17387 | };
|
17388 |
|
17389 | },{"../internals/an-object":107}],201:[function(require,module,exports){
|
17390 | 'use strict';
|
17391 |
|
17392 | var fails = require('./fails');
|
17393 |
|
17394 |
|
17395 |
|
17396 | function RE(s, f) {
|
17397 | return RegExp(s, f);
|
17398 | }
|
17399 |
|
17400 | exports.UNSUPPORTED_Y = fails(function () {
|
17401 |
|
17402 | var re = RE('a', 'y');
|
17403 | re.lastIndex = 2;
|
17404 | return re.exec('abcd') != null;
|
17405 | });
|
17406 |
|
17407 | exports.BROKEN_CARET = fails(function () {
|
17408 |
|
17409 | var re = RE('^r', 'gy');
|
17410 | re.lastIndex = 2;
|
17411 | return re.exec('str') != null;
|
17412 | });
|
17413 |
|
17414 | },{"./fails":145}],202:[function(require,module,exports){
|
17415 |
|
17416 |
|
17417 | module.exports = function (it) {
|
17418 | if (it == undefined) throw TypeError("Can't call method on " + it);
|
17419 | return it;
|
17420 | };
|
17421 |
|
17422 | },{}],203:[function(require,module,exports){
|
17423 |
|
17424 |
|
17425 | module.exports = Object.is || function is(x, y) {
|
17426 |
|
17427 | return x === y ? x !== 0 || 1 / x === 1 / y : x != x && y != y;
|
17428 | };
|
17429 |
|
17430 | },{}],204:[function(require,module,exports){
|
17431 | var global = require('../internals/global');
|
17432 | var createNonEnumerableProperty = require('../internals/create-non-enumerable-property');
|
17433 |
|
17434 | module.exports = function (key, value) {
|
17435 | try {
|
17436 | createNonEnumerableProperty(global, key, value);
|
17437 | } catch (error) {
|
17438 | global[key] = value;
|
17439 | } return value;
|
17440 | };
|
17441 |
|
17442 | },{"../internals/create-non-enumerable-property":131,"../internals/global":150}],205:[function(require,module,exports){
|
17443 | 'use strict';
|
17444 | var getBuiltIn = require('../internals/get-built-in');
|
17445 | var definePropertyModule = require('../internals/object-define-property');
|
17446 | var wellKnownSymbol = require('../internals/well-known-symbol');
|
17447 | var DESCRIPTORS = require('../internals/descriptors');
|
17448 |
|
17449 | var SPECIES = wellKnownSymbol('species');
|
17450 |
|
17451 | module.exports = function (CONSTRUCTOR_NAME) {
|
17452 | var Constructor = getBuiltIn(CONSTRUCTOR_NAME);
|
17453 | var defineProperty = definePropertyModule.f;
|
17454 |
|
17455 | if (DESCRIPTORS && Constructor && !Constructor[SPECIES]) {
|
17456 | defineProperty(Constructor, SPECIES, {
|
17457 | configurable: true,
|
17458 | get: function () { return this; }
|
17459 | });
|
17460 | }
|
17461 | };
|
17462 |
|
17463 | },{"../internals/descriptors":136,"../internals/get-built-in":148,"../internals/object-define-property":180,"../internals/well-known-symbol":231}],206:[function(require,module,exports){
|
17464 | var defineProperty = require('../internals/object-define-property').f;
|
17465 | var has = require('../internals/has');
|
17466 | var wellKnownSymbol = require('../internals/well-known-symbol');
|
17467 |
|
17468 | var TO_STRING_TAG = wellKnownSymbol('toStringTag');
|
17469 |
|
17470 | module.exports = function (it, TAG, STATIC) {
|
17471 | if (it && !has(it = STATIC ? it : it.prototype, TO_STRING_TAG)) {
|
17472 | defineProperty(it, TO_STRING_TAG, { configurable: true, value: TAG });
|
17473 | }
|
17474 | };
|
17475 |
|
17476 | },{"../internals/has":151,"../internals/object-define-property":180,"../internals/well-known-symbol":231}],207:[function(require,module,exports){
|
17477 | var shared = require('../internals/shared');
|
17478 | var uid = require('../internals/uid');
|
17479 |
|
17480 | var keys = shared('keys');
|
17481 |
|
17482 | module.exports = function (key) {
|
17483 | return keys[key] || (keys[key] = uid(key));
|
17484 | };
|
17485 |
|
17486 | },{"../internals/shared":209,"../internals/uid":228}],208:[function(require,module,exports){
|
17487 | var global = require('../internals/global');
|
17488 | var setGlobal = require('../internals/set-global');
|
17489 |
|
17490 | var SHARED = '__core-js_shared__';
|
17491 | var store = global[SHARED] || setGlobal(SHARED, {});
|
17492 |
|
17493 | module.exports = store;
|
17494 |
|
17495 | },{"../internals/global":150,"../internals/set-global":204}],209:[function(require,module,exports){
|
17496 | var IS_PURE = require('../internals/is-pure');
|
17497 | var store = require('../internals/shared-store');
|
17498 |
|
17499 | (module.exports = function (key, value) {
|
17500 | return store[key] || (store[key] = value !== undefined ? value : {});
|
17501 | })('versions', []).push({
|
17502 | version: '3.7.0',
|
17503 | mode: IS_PURE ? 'pure' : 'global',
|
17504 | copyright: '© 2020 Denis Pushkarev (zloirock.ru)'
|
17505 | });
|
17506 |
|
17507 | },{"../internals/is-pure":165,"../internals/shared-store":208}],210:[function(require,module,exports){
|
17508 | var anObject = require('../internals/an-object');
|
17509 | var aFunction = require('../internals/a-function');
|
17510 | var wellKnownSymbol = require('../internals/well-known-symbol');
|
17511 |
|
17512 | var SPECIES = wellKnownSymbol('species');
|
17513 |
|
17514 |
|
17515 |
|
17516 | module.exports = function (O, defaultConstructor) {
|
17517 | var C = anObject(O).constructor;
|
17518 | var S;
|
17519 | return C === undefined || (S = anObject(C)[SPECIES]) == undefined ? defaultConstructor : aFunction(S);
|
17520 | };
|
17521 |
|
17522 | },{"../internals/a-function":102,"../internals/an-object":107,"../internals/well-known-symbol":231}],211:[function(require,module,exports){
|
17523 | var toInteger = require('../internals/to-integer');
|
17524 | var requireObjectCoercible = require('../internals/require-object-coercible');
|
17525 |
|
17526 |
|
17527 | var createMethod = function (CONVERT_TO_STRING) {
|
17528 | return function ($this, pos) {
|
17529 | var S = String(requireObjectCoercible($this));
|
17530 | var position = toInteger(pos);
|
17531 | var size = S.length;
|
17532 | var first, second;
|
17533 | if (position < 0 || position >= size) return CONVERT_TO_STRING ? '' : undefined;
|
17534 | first = S.charCodeAt(position);
|
17535 | return first < 0xD800 || first > 0xDBFF || position + 1 === size
|
17536 | || (second = S.charCodeAt(position + 1)) < 0xDC00 || second > 0xDFFF
|
17537 | ? CONVERT_TO_STRING ? S.charAt(position) : first
|
17538 | : CONVERT_TO_STRING ? S.slice(position, position + 2) : (first - 0xD800 << 10) + (second - 0xDC00) + 0x10000;
|
17539 | };
|
17540 | };
|
17541 |
|
17542 | module.exports = {
|
17543 |
|
17544 |
|
17545 | codeAt: createMethod(false),
|
17546 |
|
17547 |
|
17548 | charAt: createMethod(true)
|
17549 | };
|
17550 |
|
17551 | },{"../internals/require-object-coercible":202,"../internals/to-integer":218}],212:[function(require,module,exports){
|
17552 | var fails = require('../internals/fails');
|
17553 | var whitespaces = require('../internals/whitespaces');
|
17554 |
|
17555 | var non = '\u200B\u0085\u180E';
|
17556 |
|
17557 |
|
17558 |
|
17559 | module.exports = function (METHOD_NAME) {
|
17560 | return fails(function () {
|
17561 | return !!whitespaces[METHOD_NAME]() || non[METHOD_NAME]() != non || whitespaces[METHOD_NAME].name !== METHOD_NAME;
|
17562 | });
|
17563 | };
|
17564 |
|
17565 | },{"../internals/fails":145,"../internals/whitespaces":232}],213:[function(require,module,exports){
|
17566 | var requireObjectCoercible = require('../internals/require-object-coercible');
|
17567 | var whitespaces = require('../internals/whitespaces');
|
17568 |
|
17569 | var whitespace = '[' + whitespaces + ']';
|
17570 | var ltrim = RegExp('^' + whitespace + whitespace + '*');
|
17571 | var rtrim = RegExp(whitespace + whitespace + '*$');
|
17572 |
|
17573 |
|
17574 | var createMethod = function (TYPE) {
|
17575 | return function ($this) {
|
17576 | var string = String(requireObjectCoercible($this));
|
17577 | if (TYPE & 1) string = string.replace(ltrim, '');
|
17578 | if (TYPE & 2) string = string.replace(rtrim, '');
|
17579 | return string;
|
17580 | };
|
17581 | };
|
17582 |
|
17583 | module.exports = {
|
17584 |
|
17585 |
|
17586 | start: createMethod(1),
|
17587 |
|
17588 |
|
17589 | end: createMethod(2),
|
17590 |
|
17591 |
|
17592 | trim: createMethod(3)
|
17593 | };
|
17594 |
|
17595 | },{"../internals/require-object-coercible":202,"../internals/whitespaces":232}],214:[function(require,module,exports){
|
17596 | var global = require('../internals/global');
|
17597 | var fails = require('../internals/fails');
|
17598 | var bind = require('../internals/function-bind-context');
|
17599 | var html = require('../internals/html');
|
17600 | var createElement = require('../internals/document-create-element');
|
17601 | var IS_IOS = require('../internals/engine-is-ios');
|
17602 | var IS_NODE = require('../internals/engine-is-node');
|
17603 |
|
17604 | var location = global.location;
|
17605 | var set = global.setImmediate;
|
17606 | var clear = global.clearImmediate;
|
17607 | var process = global.process;
|
17608 | var MessageChannel = global.MessageChannel;
|
17609 | var Dispatch = global.Dispatch;
|
17610 | var counter = 0;
|
17611 | var queue = {};
|
17612 | var ONREADYSTATECHANGE = 'onreadystatechange';
|
17613 | var defer, channel, port;
|
17614 |
|
17615 | var run = function (id) {
|
17616 |
|
17617 | if (queue.hasOwnProperty(id)) {
|
17618 | var fn = queue[id];
|
17619 | delete queue[id];
|
17620 | fn();
|
17621 | }
|
17622 | };
|
17623 |
|
17624 | var runner = function (id) {
|
17625 | return function () {
|
17626 | run(id);
|
17627 | };
|
17628 | };
|
17629 |
|
17630 | var listener = function (event) {
|
17631 | run(event.data);
|
17632 | };
|
17633 |
|
17634 | var post = function (id) {
|
17635 |
|
17636 | global.postMessage(id + '', location.protocol + '//' + location.host);
|
17637 | };
|
17638 |
|
17639 |
|
17640 | if (!set || !clear) {
|
17641 | set = function setImmediate(fn) {
|
17642 | var args = [];
|
17643 | var i = 1;
|
17644 | while (arguments.length > i) args.push(arguments[i++]);
|
17645 | queue[++counter] = function () {
|
17646 |
|
17647 | (typeof fn == 'function' ? fn : Function(fn)).apply(undefined, args);
|
17648 | };
|
17649 | defer(counter);
|
17650 | return counter;
|
17651 | };
|
17652 | clear = function clearImmediate(id) {
|
17653 | delete queue[id];
|
17654 | };
|
17655 |
|
17656 | if (IS_NODE) {
|
17657 | defer = function (id) {
|
17658 | process.nextTick(runner(id));
|
17659 | };
|
17660 |
|
17661 | } else if (Dispatch && Dispatch.now) {
|
17662 | defer = function (id) {
|
17663 | Dispatch.now(runner(id));
|
17664 | };
|
17665 |
|
17666 |
|
17667 | } else if (MessageChannel && !IS_IOS) {
|
17668 | channel = new MessageChannel();
|
17669 | port = channel.port2;
|
17670 | channel.port1.onmessage = listener;
|
17671 | defer = bind(port.postMessage, port, 1);
|
17672 |
|
17673 |
|
17674 | } else if (
|
17675 | global.addEventListener &&
|
17676 | typeof postMessage == 'function' &&
|
17677 | !global.importScripts &&
|
17678 | location && location.protocol !== 'file:' &&
|
17679 | !fails(post)
|
17680 | ) {
|
17681 | defer = post;
|
17682 | global.addEventListener('message', listener, false);
|
17683 |
|
17684 | } else if (ONREADYSTATECHANGE in createElement('script')) {
|
17685 | defer = function (id) {
|
17686 | html.appendChild(createElement('script'))[ONREADYSTATECHANGE] = function () {
|
17687 | html.removeChild(this);
|
17688 | run(id);
|
17689 | };
|
17690 | };
|
17691 |
|
17692 | } else {
|
17693 | defer = function (id) {
|
17694 | setTimeout(runner(id), 0);
|
17695 | };
|
17696 | }
|
17697 | }
|
17698 |
|
17699 | module.exports = {
|
17700 | set: set,
|
17701 | clear: clear
|
17702 | };
|
17703 |
|
17704 | },{"../internals/document-create-element":137,"../internals/engine-is-ios":139,"../internals/engine-is-node":140,"../internals/fails":145,"../internals/function-bind-context":147,"../internals/global":150,"../internals/html":154}],215:[function(require,module,exports){
|
17705 | var toInteger = require('../internals/to-integer');
|
17706 |
|
17707 | var max = Math.max;
|
17708 | var min = Math.min;
|
17709 |
|
17710 |
|
17711 |
|
17712 |
|
17713 | module.exports = function (index, length) {
|
17714 | var integer = toInteger(index);
|
17715 | return integer < 0 ? max(integer + length, 0) : min(integer, length);
|
17716 | };
|
17717 |
|
17718 | },{"../internals/to-integer":218}],216:[function(require,module,exports){
|
17719 | var toInteger = require('../internals/to-integer');
|
17720 | var toLength = require('../internals/to-length');
|
17721 |
|
17722 |
|
17723 |
|
17724 | module.exports = function (it) {
|
17725 | if (it === undefined) return 0;
|
17726 | var number = toInteger(it);
|
17727 | var length = toLength(number);
|
17728 | if (number !== length) throw RangeError('Wrong length or index');
|
17729 | return length;
|
17730 | };
|
17731 |
|
17732 | },{"../internals/to-integer":218,"../internals/to-length":219}],217:[function(require,module,exports){
|
17733 |
|
17734 | var IndexedObject = require('../internals/indexed-object');
|
17735 | var requireObjectCoercible = require('../internals/require-object-coercible');
|
17736 |
|
17737 | module.exports = function (it) {
|
17738 | return IndexedObject(requireObjectCoercible(it));
|
17739 | };
|
17740 |
|
17741 | },{"../internals/indexed-object":157,"../internals/require-object-coercible":202}],218:[function(require,module,exports){
|
17742 | var ceil = Math.ceil;
|
17743 | var floor = Math.floor;
|
17744 |
|
17745 |
|
17746 |
|
17747 | module.exports = function (argument) {
|
17748 | return isNaN(argument = +argument) ? 0 : (argument > 0 ? floor : ceil)(argument);
|
17749 | };
|
17750 |
|
17751 | },{}],219:[function(require,module,exports){
|
17752 | var toInteger = require('../internals/to-integer');
|
17753 |
|
17754 | var min = Math.min;
|
17755 |
|
17756 |
|
17757 |
|
17758 | module.exports = function (argument) {
|
17759 | return argument > 0 ? min(toInteger(argument), 0x1FFFFFFFFFFFFF) : 0;
|
17760 | };
|
17761 |
|
17762 | },{"../internals/to-integer":218}],220:[function(require,module,exports){
|
17763 | var requireObjectCoercible = require('../internals/require-object-coercible');
|
17764 |
|
17765 |
|
17766 |
|
17767 | module.exports = function (argument) {
|
17768 | return Object(requireObjectCoercible(argument));
|
17769 | };
|
17770 |
|
17771 | },{"../internals/require-object-coercible":202}],221:[function(require,module,exports){
|
17772 | var toPositiveInteger = require('../internals/to-positive-integer');
|
17773 |
|
17774 | module.exports = function (it, BYTES) {
|
17775 | var offset = toPositiveInteger(it);
|
17776 | if (offset % BYTES) throw RangeError('Wrong offset');
|
17777 | return offset;
|
17778 | };
|
17779 |
|
17780 | },{"../internals/to-positive-integer":222}],222:[function(require,module,exports){
|
17781 | var toInteger = require('../internals/to-integer');
|
17782 |
|
17783 | module.exports = function (it) {
|
17784 | var result = toInteger(it);
|
17785 | if (result < 0) throw RangeError("The argument can't be less than 0");
|
17786 | return result;
|
17787 | };
|
17788 |
|
17789 | },{"../internals/to-integer":218}],223:[function(require,module,exports){
|
17790 | var isObject = require('../internals/is-object');
|
17791 |
|
17792 |
|
17793 |
|
17794 |
|
17795 |
|
17796 | module.exports = function (input, PREFERRED_STRING) {
|
17797 | if (!isObject(input)) return input;
|
17798 | var fn, val;
|
17799 | if (PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val;
|
17800 | if (typeof (fn = input.valueOf) == 'function' && !isObject(val = fn.call(input))) return val;
|
17801 | if (!PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val;
|
17802 | throw TypeError("Can't convert object to primitive value");
|
17803 | };
|
17804 |
|
17805 | },{"../internals/is-object":164}],224:[function(require,module,exports){
|
17806 | var wellKnownSymbol = require('../internals/well-known-symbol');
|
17807 |
|
17808 | var TO_STRING_TAG = wellKnownSymbol('toStringTag');
|
17809 | var test = {};
|
17810 |
|
17811 | test[TO_STRING_TAG] = 'z';
|
17812 |
|
17813 | module.exports = String(test) === '[object z]';
|
17814 |
|
17815 | },{"../internals/well-known-symbol":231}],225:[function(require,module,exports){
|
17816 | 'use strict';
|
17817 | var $ = require('../internals/export');
|
17818 | var global = require('../internals/global');
|
17819 | var DESCRIPTORS = require('../internals/descriptors');
|
17820 | var TYPED_ARRAYS_CONSTRUCTORS_REQUIRES_WRAPPERS = require('../internals/typed-array-constructors-require-wrappers');
|
17821 | var ArrayBufferViewCore = require('../internals/array-buffer-view-core');
|
17822 | var ArrayBufferModule = require('../internals/array-buffer');
|
17823 | var anInstance = require('../internals/an-instance');
|
17824 | var createPropertyDescriptor = require('../internals/create-property-descriptor');
|
17825 | var createNonEnumerableProperty = require('../internals/create-non-enumerable-property');
|
17826 | var toLength = require('../internals/to-length');
|
17827 | var toIndex = require('../internals/to-index');
|
17828 | var toOffset = require('../internals/to-offset');
|
17829 | var toPrimitive = require('../internals/to-primitive');
|
17830 | var has = require('../internals/has');
|
17831 | var classof = require('../internals/classof');
|
17832 | var isObject = require('../internals/is-object');
|
17833 | var create = require('../internals/object-create');
|
17834 | var setPrototypeOf = require('../internals/object-set-prototype-of');
|
17835 | var getOwnPropertyNames = require('../internals/object-get-own-property-names').f;
|
17836 | var typedArrayFrom = require('../internals/typed-array-from');
|
17837 | var forEach = require('../internals/array-iteration').forEach;
|
17838 | var setSpecies = require('../internals/set-species');
|
17839 | var definePropertyModule = require('../internals/object-define-property');
|
17840 | var getOwnPropertyDescriptorModule = require('../internals/object-get-own-property-descriptor');
|
17841 | var InternalStateModule = require('../internals/internal-state');
|
17842 | var inheritIfRequired = require('../internals/inherit-if-required');
|
17843 |
|
17844 | var getInternalState = InternalStateModule.get;
|
17845 | var setInternalState = InternalStateModule.set;
|
17846 | var nativeDefineProperty = definePropertyModule.f;
|
17847 | var nativeGetOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
|
17848 | var round = Math.round;
|
17849 | var RangeError = global.RangeError;
|
17850 | var ArrayBuffer = ArrayBufferModule.ArrayBuffer;
|
17851 | var DataView = ArrayBufferModule.DataView;
|
17852 | var NATIVE_ARRAY_BUFFER_VIEWS = ArrayBufferViewCore.NATIVE_ARRAY_BUFFER_VIEWS;
|
17853 | var TYPED_ARRAY_TAG = ArrayBufferViewCore.TYPED_ARRAY_TAG;
|
17854 | var TypedArray = ArrayBufferViewCore.TypedArray;
|
17855 | var TypedArrayPrototype = ArrayBufferViewCore.TypedArrayPrototype;
|
17856 | var aTypedArrayConstructor = ArrayBufferViewCore.aTypedArrayConstructor;
|
17857 | var isTypedArray = ArrayBufferViewCore.isTypedArray;
|
17858 | var BYTES_PER_ELEMENT = 'BYTES_PER_ELEMENT';
|
17859 | var WRONG_LENGTH = 'Wrong length';
|
17860 |
|
17861 | var fromList = function (C, list) {
|
17862 | var index = 0;
|
17863 | var length = list.length;
|
17864 | var result = new (aTypedArrayConstructor(C))(length);
|
17865 | while (length > index) result[index] = list[index++];
|
17866 | return result;
|
17867 | };
|
17868 |
|
17869 | var addGetter = function (it, key) {
|
17870 | nativeDefineProperty(it, key, { get: function () {
|
17871 | return getInternalState(this)[key];
|
17872 | } });
|
17873 | };
|
17874 |
|
17875 | var isArrayBuffer = function (it) {
|
17876 | var klass;
|
17877 | return it instanceof ArrayBuffer || (klass = classof(it)) == 'ArrayBuffer' || klass == 'SharedArrayBuffer';
|
17878 | };
|
17879 |
|
17880 | var isTypedArrayIndex = function (target, key) {
|
17881 | return isTypedArray(target)
|
17882 | && typeof key != 'symbol'
|
17883 | && key in target
|
17884 | && String(+key) == String(key);
|
17885 | };
|
17886 |
|
17887 | var wrappedGetOwnPropertyDescriptor = function getOwnPropertyDescriptor(target, key) {
|
17888 | return isTypedArrayIndex(target, key = toPrimitive(key, true))
|
17889 | ? createPropertyDescriptor(2, target[key])
|
17890 | : nativeGetOwnPropertyDescriptor(target, key);
|
17891 | };
|
17892 |
|
17893 | var wrappedDefineProperty = function defineProperty(target, key, descriptor) {
|
17894 | if (isTypedArrayIndex(target, key = toPrimitive(key, true))
|
17895 | && isObject(descriptor)
|
17896 | && has(descriptor, 'value')
|
17897 | && !has(descriptor, 'get')
|
17898 | && !has(descriptor, 'set')
|
17899 |
|
17900 | && !descriptor.configurable
|
17901 | && (!has(descriptor, 'writable') || descriptor.writable)
|
17902 | && (!has(descriptor, 'enumerable') || descriptor.enumerable)
|
17903 | ) {
|
17904 | target[key] = descriptor.value;
|
17905 | return target;
|
17906 | } return nativeDefineProperty(target, key, descriptor);
|
17907 | };
|
17908 |
|
17909 | if (DESCRIPTORS) {
|
17910 | if (!NATIVE_ARRAY_BUFFER_VIEWS) {
|
17911 | getOwnPropertyDescriptorModule.f = wrappedGetOwnPropertyDescriptor;
|
17912 | definePropertyModule.f = wrappedDefineProperty;
|
17913 | addGetter(TypedArrayPrototype, 'buffer');
|
17914 | addGetter(TypedArrayPrototype, 'byteOffset');
|
17915 | addGetter(TypedArrayPrototype, 'byteLength');
|
17916 | addGetter(TypedArrayPrototype, 'length');
|
17917 | }
|
17918 |
|
17919 | $({ target: 'Object', stat: true, forced: !NATIVE_ARRAY_BUFFER_VIEWS }, {
|
17920 | getOwnPropertyDescriptor: wrappedGetOwnPropertyDescriptor,
|
17921 | defineProperty: wrappedDefineProperty
|
17922 | });
|
17923 |
|
17924 | module.exports = function (TYPE, wrapper, CLAMPED) {
|
17925 | var BYTES = TYPE.match(/\d+$/)[0] / 8;
|
17926 | var CONSTRUCTOR_NAME = TYPE + (CLAMPED ? 'Clamped' : '') + 'Array';
|
17927 | var GETTER = 'get' + TYPE;
|
17928 | var SETTER = 'set' + TYPE;
|
17929 | var NativeTypedArrayConstructor = global[CONSTRUCTOR_NAME];
|
17930 | var TypedArrayConstructor = NativeTypedArrayConstructor;
|
17931 | var TypedArrayConstructorPrototype = TypedArrayConstructor && TypedArrayConstructor.prototype;
|
17932 | var exported = {};
|
17933 |
|
17934 | var getter = function (that, index) {
|
17935 | var data = getInternalState(that);
|
17936 | return data.view[GETTER](index * BYTES + data.byteOffset, true);
|
17937 | };
|
17938 |
|
17939 | var setter = function (that, index, value) {
|
17940 | var data = getInternalState(that);
|
17941 | if (CLAMPED) value = (value = round(value)) < 0 ? 0 : value > 0xFF ? 0xFF : value & 0xFF;
|
17942 | data.view[SETTER](index * BYTES + data.byteOffset, value, true);
|
17943 | };
|
17944 |
|
17945 | var addElement = function (that, index) {
|
17946 | nativeDefineProperty(that, index, {
|
17947 | get: function () {
|
17948 | return getter(this, index);
|
17949 | },
|
17950 | set: function (value) {
|
17951 | return setter(this, index, value);
|
17952 | },
|
17953 | enumerable: true
|
17954 | });
|
17955 | };
|
17956 |
|
17957 | if (!NATIVE_ARRAY_BUFFER_VIEWS) {
|
17958 | TypedArrayConstructor = wrapper(function (that, data, offset, $length) {
|
17959 | anInstance(that, TypedArrayConstructor, CONSTRUCTOR_NAME);
|
17960 | var index = 0;
|
17961 | var byteOffset = 0;
|
17962 | var buffer, byteLength, length;
|
17963 | if (!isObject(data)) {
|
17964 | length = toIndex(data);
|
17965 | byteLength = length * BYTES;
|
17966 | buffer = new ArrayBuffer(byteLength);
|
17967 | } else if (isArrayBuffer(data)) {
|
17968 | buffer = data;
|
17969 | byteOffset = toOffset(offset, BYTES);
|
17970 | var $len = data.byteLength;
|
17971 | if ($length === undefined) {
|
17972 | if ($len % BYTES) throw RangeError(WRONG_LENGTH);
|
17973 | byteLength = $len - byteOffset;
|
17974 | if (byteLength < 0) throw RangeError(WRONG_LENGTH);
|
17975 | } else {
|
17976 | byteLength = toLength($length) * BYTES;
|
17977 | if (byteLength + byteOffset > $len) throw RangeError(WRONG_LENGTH);
|
17978 | }
|
17979 | length = byteLength / BYTES;
|
17980 | } else if (isTypedArray(data)) {
|
17981 | return fromList(TypedArrayConstructor, data);
|
17982 | } else {
|
17983 | return typedArrayFrom.call(TypedArrayConstructor, data);
|
17984 | }
|
17985 | setInternalState(that, {
|
17986 | buffer: buffer,
|
17987 | byteOffset: byteOffset,
|
17988 | byteLength: byteLength,
|
17989 | length: length,
|
17990 | view: new DataView(buffer)
|
17991 | });
|
17992 | while (index < length) addElement(that, index++);
|
17993 | });
|
17994 |
|
17995 | if (setPrototypeOf) setPrototypeOf(TypedArrayConstructor, TypedArray);
|
17996 | TypedArrayConstructorPrototype = TypedArrayConstructor.prototype = create(TypedArrayPrototype);
|
17997 | } else if (TYPED_ARRAYS_CONSTRUCTORS_REQUIRES_WRAPPERS) {
|
17998 | TypedArrayConstructor = wrapper(function (dummy, data, typedArrayOffset, $length) {
|
17999 | anInstance(dummy, TypedArrayConstructor, CONSTRUCTOR_NAME);
|
18000 | return inheritIfRequired(function () {
|
18001 | if (!isObject(data)) return new NativeTypedArrayConstructor(toIndex(data));
|
18002 | if (isArrayBuffer(data)) return $length !== undefined
|
18003 | ? new NativeTypedArrayConstructor(data, toOffset(typedArrayOffset, BYTES), $length)
|
18004 | : typedArrayOffset !== undefined
|
18005 | ? new NativeTypedArrayConstructor(data, toOffset(typedArrayOffset, BYTES))
|
18006 | : new NativeTypedArrayConstructor(data);
|
18007 | if (isTypedArray(data)) return fromList(TypedArrayConstructor, data);
|
18008 | return typedArrayFrom.call(TypedArrayConstructor, data);
|
18009 | }(), dummy, TypedArrayConstructor);
|
18010 | });
|
18011 |
|
18012 | if (setPrototypeOf) setPrototypeOf(TypedArrayConstructor, TypedArray);
|
18013 | forEach(getOwnPropertyNames(NativeTypedArrayConstructor), function (key) {
|
18014 | if (!(key in TypedArrayConstructor)) {
|
18015 | createNonEnumerableProperty(TypedArrayConstructor, key, NativeTypedArrayConstructor[key]);
|
18016 | }
|
18017 | });
|
18018 | TypedArrayConstructor.prototype = TypedArrayConstructorPrototype;
|
18019 | }
|
18020 |
|
18021 | if (TypedArrayConstructorPrototype.constructor !== TypedArrayConstructor) {
|
18022 | createNonEnumerableProperty(TypedArrayConstructorPrototype, 'constructor', TypedArrayConstructor);
|
18023 | }
|
18024 |
|
18025 | if (TYPED_ARRAY_TAG) {
|
18026 | createNonEnumerableProperty(TypedArrayConstructorPrototype, TYPED_ARRAY_TAG, CONSTRUCTOR_NAME);
|
18027 | }
|
18028 |
|
18029 | exported[CONSTRUCTOR_NAME] = TypedArrayConstructor;
|
18030 |
|
18031 | $({
|
18032 | global: true, forced: TypedArrayConstructor != NativeTypedArrayConstructor, sham: !NATIVE_ARRAY_BUFFER_VIEWS
|
18033 | }, exported);
|
18034 |
|
18035 | if (!(BYTES_PER_ELEMENT in TypedArrayConstructor)) {
|
18036 | createNonEnumerableProperty(TypedArrayConstructor, BYTES_PER_ELEMENT, BYTES);
|
18037 | }
|
18038 |
|
18039 | if (!(BYTES_PER_ELEMENT in TypedArrayConstructorPrototype)) {
|
18040 | createNonEnumerableProperty(TypedArrayConstructorPrototype, BYTES_PER_ELEMENT, BYTES);
|
18041 | }
|
18042 |
|
18043 | setSpecies(CONSTRUCTOR_NAME);
|
18044 | };
|
18045 | } else module.exports = function () { };
|
18046 |
|
18047 | },{"../internals/an-instance":106,"../internals/array-buffer":110,"../internals/array-buffer-view-core":109,"../internals/array-iteration":116,"../internals/classof":126,"../internals/create-non-enumerable-property":131,"../internals/create-property-descriptor":132,"../internals/descriptors":136,"../internals/export":144,"../internals/global":150,"../internals/has":151,"../internals/inherit-if-required":158,"../internals/internal-state":160,"../internals/is-object":164,"../internals/object-create":178,"../internals/object-define-property":180,"../internals/object-get-own-property-descriptor":181,"../internals/object-get-own-property-names":183,"../internals/object-set-prototype-of":189,"../internals/set-species":205,"../internals/to-index":216,"../internals/to-length":219,"../internals/to-offset":221,"../internals/to-primitive":223,"../internals/typed-array-constructors-require-wrappers":226,"../internals/typed-array-from":227}],226:[function(require,module,exports){
|
18048 |
|
18049 | var global = require('../internals/global');
|
18050 | var fails = require('../internals/fails');
|
18051 | var checkCorrectnessOfIteration = require('../internals/check-correctness-of-iteration');
|
18052 | var NATIVE_ARRAY_BUFFER_VIEWS = require('../internals/array-buffer-view-core').NATIVE_ARRAY_BUFFER_VIEWS;
|
18053 |
|
18054 | var ArrayBuffer = global.ArrayBuffer;
|
18055 | var Int8Array = global.Int8Array;
|
18056 |
|
18057 | module.exports = !NATIVE_ARRAY_BUFFER_VIEWS || !fails(function () {
|
18058 | Int8Array(1);
|
18059 | }) || !fails(function () {
|
18060 | new Int8Array(-1);
|
18061 | }) || !checkCorrectnessOfIteration(function (iterable) {
|
18062 | new Int8Array();
|
18063 | new Int8Array(null);
|
18064 | new Int8Array(1.5);
|
18065 | new Int8Array(iterable);
|
18066 | }, true) || fails(function () {
|
18067 |
|
18068 | return new Int8Array(new ArrayBuffer(2), 1, undefined).length !== 1;
|
18069 | });
|
18070 |
|
18071 | },{"../internals/array-buffer-view-core":109,"../internals/check-correctness-of-iteration":124,"../internals/fails":145,"../internals/global":150}],227:[function(require,module,exports){
|
18072 | var toObject = require('../internals/to-object');
|
18073 | var toLength = require('../internals/to-length');
|
18074 | var getIteratorMethod = require('../internals/get-iterator-method');
|
18075 | var isArrayIteratorMethod = require('../internals/is-array-iterator-method');
|
18076 | var bind = require('../internals/function-bind-context');
|
18077 | var aTypedArrayConstructor = require('../internals/array-buffer-view-core').aTypedArrayConstructor;
|
18078 |
|
18079 | module.exports = function from(source /* , mapfn, thisArg */) {
|
18080 | var O = toObject(source);
|
18081 | var argumentsLength = arguments.length;
|
18082 | var mapfn = argumentsLength > 1 ? arguments[1] : undefined;
|
18083 | var mapping = mapfn !== undefined;
|
18084 | var iteratorMethod = getIteratorMethod(O);
|
18085 | var i, length, result, step, iterator, next;
|
18086 | if (iteratorMethod != undefined && !isArrayIteratorMethod(iteratorMethod)) {
|
18087 | iterator = iteratorMethod.call(O);
|
18088 | next = iterator.next;
|
18089 | O = [];
|
18090 | while (!(step = next.call(iterator)).done) {
|
18091 | O.push(step.value);
|
18092 | }
|
18093 | }
|
18094 | if (mapping && argumentsLength > 2) {
|
18095 | mapfn = bind(mapfn, arguments[2], 2);
|
18096 | }
|
18097 | length = toLength(O.length);
|
18098 | result = new (aTypedArrayConstructor(this))(length);
|
18099 | for (i = 0; length > i; i++) {
|
18100 | result[i] = mapping ? mapfn(O[i], i) : O[i];
|
18101 | }
|
18102 | return result;
|
18103 | };
|
18104 |
|
18105 | },{"../internals/array-buffer-view-core":109,"../internals/function-bind-context":147,"../internals/get-iterator-method":149,"../internals/is-array-iterator-method":161,"../internals/to-length":219,"../internals/to-object":220}],228:[function(require,module,exports){
|
18106 | var id = 0;
|
18107 | var postfix = Math.random();
|
18108 |
|
18109 | module.exports = function (key) {
|
18110 | return 'Symbol(' + String(key === undefined ? '' : key) + ')_' + (++id + postfix).toString(36);
|
18111 | };
|
18112 |
|
18113 | },{}],229:[function(require,module,exports){
|
18114 | var NATIVE_SYMBOL = require('../internals/native-symbol');
|
18115 |
|
18116 | module.exports = NATIVE_SYMBOL
|
18117 |
|
18118 | && !Symbol.sham
|
18119 |
|
18120 | && typeof Symbol.iterator == 'symbol';
|
18121 |
|
18122 | },{"../internals/native-symbol":173}],230:[function(require,module,exports){
|
18123 | var wellKnownSymbol = require('../internals/well-known-symbol');
|
18124 |
|
18125 | exports.f = wellKnownSymbol;
|
18126 |
|
18127 | },{"../internals/well-known-symbol":231}],231:[function(require,module,exports){
|
18128 | var global = require('../internals/global');
|
18129 | var shared = require('../internals/shared');
|
18130 | var has = require('../internals/has');
|
18131 | var uid = require('../internals/uid');
|
18132 | var NATIVE_SYMBOL = require('../internals/native-symbol');
|
18133 | var USE_SYMBOL_AS_UID = require('../internals/use-symbol-as-uid');
|
18134 |
|
18135 | var WellKnownSymbolsStore = shared('wks');
|
18136 | var Symbol = global.Symbol;
|
18137 | var createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol : Symbol && Symbol.withoutSetter || uid;
|
18138 |
|
18139 | module.exports = function (name) {
|
18140 | if (!has(WellKnownSymbolsStore, name)) {
|
18141 | if (NATIVE_SYMBOL && has(Symbol, name)) WellKnownSymbolsStore[name] = Symbol[name];
|
18142 | else WellKnownSymbolsStore[name] = createWellKnownSymbol('Symbol.' + name);
|
18143 | } return WellKnownSymbolsStore[name];
|
18144 | };
|
18145 |
|
18146 | },{"../internals/global":150,"../internals/has":151,"../internals/native-symbol":173,"../internals/shared":209,"../internals/uid":228,"../internals/use-symbol-as-uid":229}],232:[function(require,module,exports){
|
18147 |
|
18148 |
|
18149 | module.exports = '\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF';
|
18150 |
|
18151 | },{}],233:[function(require,module,exports){
|
18152 | 'use strict';
|
18153 | var $ = require('../internals/export');
|
18154 | var fails = require('../internals/fails');
|
18155 | var ArrayBufferModule = require('../internals/array-buffer');
|
18156 | var anObject = require('../internals/an-object');
|
18157 | var toAbsoluteIndex = require('../internals/to-absolute-index');
|
18158 | var toLength = require('../internals/to-length');
|
18159 | var speciesConstructor = require('../internals/species-constructor');
|
18160 |
|
18161 | var ArrayBuffer = ArrayBufferModule.ArrayBuffer;
|
18162 | var DataView = ArrayBufferModule.DataView;
|
18163 | var nativeArrayBufferSlice = ArrayBuffer.prototype.slice;
|
18164 |
|
18165 | var INCORRECT_SLICE = fails(function () {
|
18166 | return !new ArrayBuffer(2).slice(1, undefined).byteLength;
|
18167 | });
|
18168 |
|
18169 |
|
18170 |
|
18171 | $({ target: 'ArrayBuffer', proto: true, unsafe: true, forced: INCORRECT_SLICE }, {
|
18172 | slice: function slice(start, end) {
|
18173 | if (nativeArrayBufferSlice !== undefined && end === undefined) {
|
18174 | return nativeArrayBufferSlice.call(anObject(this), start);
|
18175 | }
|
18176 | var length = anObject(this).byteLength;
|
18177 | var first = toAbsoluteIndex(start, length);
|
18178 | var fin = toAbsoluteIndex(end === undefined ? length : end, length);
|
18179 | var result = new (speciesConstructor(this, ArrayBuffer))(toLength(fin - first));
|
18180 | var viewSource = new DataView(this);
|
18181 | var viewTarget = new DataView(result);
|
18182 | var index = 0;
|
18183 | while (first < fin) {
|
18184 | viewTarget.setUint8(index++, viewSource.getUint8(first++));
|
18185 | } return result;
|
18186 | }
|
18187 | });
|
18188 |
|
18189 | },{"../internals/an-object":107,"../internals/array-buffer":110,"../internals/export":144,"../internals/fails":145,"../internals/species-constructor":210,"../internals/to-absolute-index":215,"../internals/to-length":219}],234:[function(require,module,exports){
|
18190 | 'use strict';
|
18191 | var $ = require('../internals/export');
|
18192 | var fails = require('../internals/fails');
|
18193 | var isArray = require('../internals/is-array');
|
18194 | var isObject = require('../internals/is-object');
|
18195 | var toObject = require('../internals/to-object');
|
18196 | var toLength = require('../internals/to-length');
|
18197 | var createProperty = require('../internals/create-property');
|
18198 | var arraySpeciesCreate = require('../internals/array-species-create');
|
18199 | var arrayMethodHasSpeciesSupport = require('../internals/array-method-has-species-support');
|
18200 | var wellKnownSymbol = require('../internals/well-known-symbol');
|
18201 | var V8_VERSION = require('../internals/engine-v8-version');
|
18202 |
|
18203 | var IS_CONCAT_SPREADABLE = wellKnownSymbol('isConcatSpreadable');
|
18204 | var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF;
|
18205 | var MAXIMUM_ALLOWED_INDEX_EXCEEDED = 'Maximum allowed index exceeded';
|
18206 |
|
18207 |
|
18208 |
|
18209 |
|
18210 | var IS_CONCAT_SPREADABLE_SUPPORT = V8_VERSION >= 51 || !fails(function () {
|
18211 | var array = [];
|
18212 | array[IS_CONCAT_SPREADABLE] = false;
|
18213 | return array.concat()[0] !== array;
|
18214 | });
|
18215 |
|
18216 | var SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('concat');
|
18217 |
|
18218 | var isConcatSpreadable = function (O) {
|
18219 | if (!isObject(O)) return false;
|
18220 | var spreadable = O[IS_CONCAT_SPREADABLE];
|
18221 | return spreadable !== undefined ? !!spreadable : isArray(O);
|
18222 | };
|
18223 |
|
18224 | var FORCED = !IS_CONCAT_SPREADABLE_SUPPORT || !SPECIES_SUPPORT;
|
18225 |
|
18226 |
|
18227 |
|
18228 |
|
18229 | $({ target: 'Array', proto: true, forced: FORCED }, {
|
18230 | concat: function concat(arg) {
|
18231 | var O = toObject(this);
|
18232 | var A = arraySpeciesCreate(O, 0);
|
18233 | var n = 0;
|
18234 | var i, k, length, len, E;
|
18235 | for (i = -1, length = arguments.length; i < length; i++) {
|
18236 | E = i === -1 ? O : arguments[i];
|
18237 | if (isConcatSpreadable(E)) {
|
18238 | len = toLength(E.length);
|
18239 | if (n + len > MAX_SAFE_INTEGER) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
|
18240 | for (k = 0; k < len; k++, n++) if (k in E) createProperty(A, n, E[k]);
|
18241 | } else {
|
18242 | if (n >= MAX_SAFE_INTEGER) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
|
18243 | createProperty(A, n++, E);
|
18244 | }
|
18245 | }
|
18246 | A.length = n;
|
18247 | return A;
|
18248 | }
|
18249 | });
|
18250 |
|
18251 | },{"../internals/array-method-has-species-support":118,"../internals/array-species-create":122,"../internals/create-property":133,"../internals/engine-v8-version":142,"../internals/export":144,"../internals/fails":145,"../internals/is-array":162,"../internals/is-object":164,"../internals/to-length":219,"../internals/to-object":220,"../internals/well-known-symbol":231}],235:[function(require,module,exports){
|
18252 | var $ = require('../internals/export');
|
18253 | var fill = require('../internals/array-fill');
|
18254 | var addToUnscopables = require('../internals/add-to-unscopables');
|
18255 |
|
18256 |
|
18257 |
|
18258 | $({ target: 'Array', proto: true }, {
|
18259 | fill: fill
|
18260 | });
|
18261 |
|
18262 |
|
18263 | addToUnscopables('fill');
|
18264 |
|
18265 | },{"../internals/add-to-unscopables":104,"../internals/array-fill":112,"../internals/export":144}],236:[function(require,module,exports){
|
18266 | 'use strict';
|
18267 | var $ = require('../internals/export');
|
18268 | var $filter = require('../internals/array-iteration').filter;
|
18269 | var arrayMethodHasSpeciesSupport = require('../internals/array-method-has-species-support');
|
18270 | var arrayMethodUsesToLength = require('../internals/array-method-uses-to-length');
|
18271 |
|
18272 | var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('filter');
|
18273 |
|
18274 | var USES_TO_LENGTH = arrayMethodUsesToLength('filter');
|
18275 |
|
18276 |
|
18277 |
|
18278 |
|
18279 | $({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT || !USES_TO_LENGTH }, {
|
18280 | filter: function filter(callbackfn /* , thisArg */) {
|
18281 | return $filter(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
|
18282 | }
|
18283 | });
|
18284 |
|
18285 | },{"../internals/array-iteration":116,"../internals/array-method-has-species-support":118,"../internals/array-method-uses-to-length":120,"../internals/export":144}],237:[function(require,module,exports){
|
18286 | 'use strict';
|
18287 | var $ = require('../internals/export');
|
18288 | var $find = require('../internals/array-iteration').find;
|
18289 | var addToUnscopables = require('../internals/add-to-unscopables');
|
18290 | var arrayMethodUsesToLength = require('../internals/array-method-uses-to-length');
|
18291 |
|
18292 | var FIND = 'find';
|
18293 | var SKIPS_HOLES = true;
|
18294 |
|
18295 | var USES_TO_LENGTH = arrayMethodUsesToLength(FIND);
|
18296 |
|
18297 |
|
18298 | if (FIND in []) Array(1)[FIND](function () { SKIPS_HOLES = false; });
|
18299 |
|
18300 |
|
18301 |
|
18302 | $({ target: 'Array', proto: true, forced: SKIPS_HOLES || !USES_TO_LENGTH }, {
|
18303 | find: function find(callbackfn /* , that = undefined */) {
|
18304 | return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
|
18305 | }
|
18306 | });
|
18307 |
|
18308 |
|
18309 | addToUnscopables(FIND);
|
18310 |
|
18311 | },{"../internals/add-to-unscopables":104,"../internals/array-iteration":116,"../internals/array-method-uses-to-length":120,"../internals/export":144}],238:[function(require,module,exports){
|
18312 | 'use strict';
|
18313 | var $ = require('../internals/export');
|
18314 | var forEach = require('../internals/array-for-each');
|
18315 |
|
18316 |
|
18317 |
|
18318 | $({ target: 'Array', proto: true, forced: [].forEach != forEach }, {
|
18319 | forEach: forEach
|
18320 | });
|
18321 |
|
18322 | },{"../internals/array-for-each":113,"../internals/export":144}],239:[function(require,module,exports){
|
18323 | var $ = require('../internals/export');
|
18324 | var from = require('../internals/array-from');
|
18325 | var checkCorrectnessOfIteration = require('../internals/check-correctness-of-iteration');
|
18326 |
|
18327 | var INCORRECT_ITERATION = !checkCorrectnessOfIteration(function (iterable) {
|
18328 | Array.from(iterable);
|
18329 | });
|
18330 |
|
18331 |
|
18332 |
|
18333 | $({ target: 'Array', stat: true, forced: INCORRECT_ITERATION }, {
|
18334 | from: from
|
18335 | });
|
18336 |
|
18337 | },{"../internals/array-from":114,"../internals/check-correctness-of-iteration":124,"../internals/export":144}],240:[function(require,module,exports){
|
18338 | 'use strict';
|
18339 | var $ = require('../internals/export');
|
18340 | var $includes = require('../internals/array-includes').includes;
|
18341 | var addToUnscopables = require('../internals/add-to-unscopables');
|
18342 | var arrayMethodUsesToLength = require('../internals/array-method-uses-to-length');
|
18343 |
|
18344 | var USES_TO_LENGTH = arrayMethodUsesToLength('indexOf', { ACCESSORS: true, 1: 0 });
|
18345 |
|
18346 |
|
18347 |
|
18348 | $({ target: 'Array', proto: true, forced: !USES_TO_LENGTH }, {
|
18349 | includes: function includes(el /* , fromIndex = 0 */) {
|
18350 | return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);
|
18351 | }
|
18352 | });
|
18353 |
|
18354 |
|
18355 | addToUnscopables('includes');
|
18356 |
|
18357 | },{"../internals/add-to-unscopables":104,"../internals/array-includes":115,"../internals/array-method-uses-to-length":120,"../internals/export":144}],241:[function(require,module,exports){
|
18358 | 'use strict';
|
18359 | var $ = require('../internals/export');
|
18360 | var $indexOf = require('../internals/array-includes').indexOf;
|
18361 | var arrayMethodIsStrict = require('../internals/array-method-is-strict');
|
18362 | var arrayMethodUsesToLength = require('../internals/array-method-uses-to-length');
|
18363 |
|
18364 | var nativeIndexOf = [].indexOf;
|
18365 |
|
18366 | var NEGATIVE_ZERO = !!nativeIndexOf && 1 / [1].indexOf(1, -0) < 0;
|
18367 | var STRICT_METHOD = arrayMethodIsStrict('indexOf');
|
18368 | var USES_TO_LENGTH = arrayMethodUsesToLength('indexOf', { ACCESSORS: true, 1: 0 });
|
18369 |
|
18370 |
|
18371 |
|
18372 | $({ target: 'Array', proto: true, forced: NEGATIVE_ZERO || !STRICT_METHOD || !USES_TO_LENGTH }, {
|
18373 | indexOf: function indexOf(searchElement /* , fromIndex = 0 */) {
|
18374 | return NEGATIVE_ZERO
|
18375 |
|
18376 | ? nativeIndexOf.apply(this, arguments) || 0
|
18377 | : $indexOf(this, searchElement, arguments.length > 1 ? arguments[1] : undefined);
|
18378 | }
|
18379 | });
|
18380 |
|
18381 | },{"../internals/array-includes":115,"../internals/array-method-is-strict":119,"../internals/array-method-uses-to-length":120,"../internals/export":144}],242:[function(require,module,exports){
|
18382 | 'use strict';
|
18383 | var toIndexedObject = require('../internals/to-indexed-object');
|
18384 | var addToUnscopables = require('../internals/add-to-unscopables');
|
18385 | var Iterators = require('../internals/iterators');
|
18386 | var InternalStateModule = require('../internals/internal-state');
|
18387 | var defineIterator = require('../internals/define-iterator');
|
18388 |
|
18389 | var ARRAY_ITERATOR = 'Array Iterator';
|
18390 | var setInternalState = InternalStateModule.set;
|
18391 | var getInternalState = InternalStateModule.getterFor(ARRAY_ITERATOR);
|
18392 |
|
18393 |
|
18394 |
|
18395 |
|
18396 |
|
18397 |
|
18398 |
|
18399 |
|
18400 |
|
18401 |
|
18402 |
|
18403 | module.exports = defineIterator(Array, 'Array', function (iterated, kind) {
|
18404 | setInternalState(this, {
|
18405 | type: ARRAY_ITERATOR,
|
18406 | target: toIndexedObject(iterated),
|
18407 | index: 0,
|
18408 | kind: kind
|
18409 | });
|
18410 |
|
18411 |
|
18412 | }, function () {
|
18413 | var state = getInternalState(this);
|
18414 | var target = state.target;
|
18415 | var kind = state.kind;
|
18416 | var index = state.index++;
|
18417 | if (!target || index >= target.length) {
|
18418 | state.target = undefined;
|
18419 | return { value: undefined, done: true };
|
18420 | }
|
18421 | if (kind == 'keys') return { value: index, done: false };
|
18422 | if (kind == 'values') return { value: target[index], done: false };
|
18423 | return { value: [index, target[index]], done: false };
|
18424 | }, 'values');
|
18425 |
|
18426 |
|
18427 |
|
18428 |
|
18429 | Iterators.Arguments = Iterators.Array;
|
18430 |
|
18431 |
|
18432 | addToUnscopables('keys');
|
18433 | addToUnscopables('values');
|
18434 | addToUnscopables('entries');
|
18435 |
|
18436 | },{"../internals/add-to-unscopables":104,"../internals/define-iterator":134,"../internals/internal-state":160,"../internals/iterators":170,"../internals/to-indexed-object":217}],243:[function(require,module,exports){
|
18437 | 'use strict';
|
18438 | var $ = require('../internals/export');
|
18439 | var IndexedObject = require('../internals/indexed-object');
|
18440 | var toIndexedObject = require('../internals/to-indexed-object');
|
18441 | var arrayMethodIsStrict = require('../internals/array-method-is-strict');
|
18442 |
|
18443 | var nativeJoin = [].join;
|
18444 |
|
18445 | var ES3_STRINGS = IndexedObject != Object;
|
18446 | var STRICT_METHOD = arrayMethodIsStrict('join', ',');
|
18447 |
|
18448 |
|
18449 |
|
18450 | $({ target: 'Array', proto: true, forced: ES3_STRINGS || !STRICT_METHOD }, {
|
18451 | join: function join(separator) {
|
18452 | return nativeJoin.call(toIndexedObject(this), separator === undefined ? ',' : separator);
|
18453 | }
|
18454 | });
|
18455 |
|
18456 | },{"../internals/array-method-is-strict":119,"../internals/export":144,"../internals/indexed-object":157,"../internals/to-indexed-object":217}],244:[function(require,module,exports){
|
18457 | var $ = require('../internals/export');
|
18458 | var lastIndexOf = require('../internals/array-last-index-of');
|
18459 |
|
18460 |
|
18461 |
|
18462 | $({ target: 'Array', proto: true, forced: lastIndexOf !== [].lastIndexOf }, {
|
18463 | lastIndexOf: lastIndexOf
|
18464 | });
|
18465 |
|
18466 | },{"../internals/array-last-index-of":117,"../internals/export":144}],245:[function(require,module,exports){
|
18467 | 'use strict';
|
18468 | var $ = require('../internals/export');
|
18469 | var $map = require('../internals/array-iteration').map;
|
18470 | var arrayMethodHasSpeciesSupport = require('../internals/array-method-has-species-support');
|
18471 | var arrayMethodUsesToLength = require('../internals/array-method-uses-to-length');
|
18472 |
|
18473 | var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('map');
|
18474 |
|
18475 | var USES_TO_LENGTH = arrayMethodUsesToLength('map');
|
18476 |
|
18477 |
|
18478 |
|
18479 |
|
18480 | $({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT || !USES_TO_LENGTH }, {
|
18481 | map: function map(callbackfn /* , thisArg */) {
|
18482 | return $map(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
|
18483 | }
|
18484 | });
|
18485 |
|
18486 | },{"../internals/array-iteration":116,"../internals/array-method-has-species-support":118,"../internals/array-method-uses-to-length":120,"../internals/export":144}],246:[function(require,module,exports){
|
18487 | 'use strict';
|
18488 | var $ = require('../internals/export');
|
18489 | var isObject = require('../internals/is-object');
|
18490 | var isArray = require('../internals/is-array');
|
18491 | var toAbsoluteIndex = require('../internals/to-absolute-index');
|
18492 | var toLength = require('../internals/to-length');
|
18493 | var toIndexedObject = require('../internals/to-indexed-object');
|
18494 | var createProperty = require('../internals/create-property');
|
18495 | var wellKnownSymbol = require('../internals/well-known-symbol');
|
18496 | var arrayMethodHasSpeciesSupport = require('../internals/array-method-has-species-support');
|
18497 | var arrayMethodUsesToLength = require('../internals/array-method-uses-to-length');
|
18498 |
|
18499 | var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('slice');
|
18500 | var USES_TO_LENGTH = arrayMethodUsesToLength('slice', { ACCESSORS: true, 0: 0, 1: 2 });
|
18501 |
|
18502 | var SPECIES = wellKnownSymbol('species');
|
18503 | var nativeSlice = [].slice;
|
18504 | var max = Math.max;
|
18505 |
|
18506 |
|
18507 |
|
18508 |
|
18509 | $({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT || !USES_TO_LENGTH }, {
|
18510 | slice: function slice(start, end) {
|
18511 | var O = toIndexedObject(this);
|
18512 | var length = toLength(O.length);
|
18513 | var k = toAbsoluteIndex(start, length);
|
18514 | var fin = toAbsoluteIndex(end === undefined ? length : end, length);
|
18515 |
|
18516 | var Constructor, result, n;
|
18517 | if (isArray(O)) {
|
18518 | Constructor = O.constructor;
|
18519 |
|
18520 | if (typeof Constructor == 'function' && (Constructor === Array || isArray(Constructor.prototype))) {
|
18521 | Constructor = undefined;
|
18522 | } else if (isObject(Constructor)) {
|
18523 | Constructor = Constructor[SPECIES];
|
18524 | if (Constructor === null) Constructor = undefined;
|
18525 | }
|
18526 | if (Constructor === Array || Constructor === undefined) {
|
18527 | return nativeSlice.call(O, k, fin);
|
18528 | }
|
18529 | }
|
18530 | result = new (Constructor === undefined ? Array : Constructor)(max(fin - k, 0));
|
18531 | for (n = 0; k < fin; k++, n++) if (k in O) createProperty(result, n, O[k]);
|
18532 | result.length = n;
|
18533 | return result;
|
18534 | }
|
18535 | });
|
18536 |
|
18537 | },{"../internals/array-method-has-species-support":118,"../internals/array-method-uses-to-length":120,"../internals/create-property":133,"../internals/export":144,"../internals/is-array":162,"../internals/is-object":164,"../internals/to-absolute-index":215,"../internals/to-indexed-object":217,"../internals/to-length":219,"../internals/well-known-symbol":231}],247:[function(require,module,exports){
|
18538 | 'use strict';
|
18539 | var $ = require('../internals/export');
|
18540 | var aFunction = require('../internals/a-function');
|
18541 | var toObject = require('../internals/to-object');
|
18542 | var fails = require('../internals/fails');
|
18543 | var arrayMethodIsStrict = require('../internals/array-method-is-strict');
|
18544 |
|
18545 | var test = [];
|
18546 | var nativeSort = test.sort;
|
18547 |
|
18548 |
|
18549 | var FAILS_ON_UNDEFINED = fails(function () {
|
18550 | test.sort(undefined);
|
18551 | });
|
18552 |
|
18553 | var FAILS_ON_NULL = fails(function () {
|
18554 | test.sort(null);
|
18555 | });
|
18556 |
|
18557 | var STRICT_METHOD = arrayMethodIsStrict('sort');
|
18558 |
|
18559 | var FORCED = FAILS_ON_UNDEFINED || !FAILS_ON_NULL || !STRICT_METHOD;
|
18560 |
|
18561 |
|
18562 |
|
18563 | $({ target: 'Array', proto: true, forced: FORCED }, {
|
18564 | sort: function sort(comparefn) {
|
18565 | return comparefn === undefined
|
18566 | ? nativeSort.call(toObject(this))
|
18567 | : nativeSort.call(toObject(this), aFunction(comparefn));
|
18568 | }
|
18569 | });
|
18570 |
|
18571 | },{"../internals/a-function":102,"../internals/array-method-is-strict":119,"../internals/export":144,"../internals/fails":145,"../internals/to-object":220}],248:[function(require,module,exports){
|
18572 | 'use strict';
|
18573 | var $ = require('../internals/export');
|
18574 | var toAbsoluteIndex = require('../internals/to-absolute-index');
|
18575 | var toInteger = require('../internals/to-integer');
|
18576 | var toLength = require('../internals/to-length');
|
18577 | var toObject = require('../internals/to-object');
|
18578 | var arraySpeciesCreate = require('../internals/array-species-create');
|
18579 | var createProperty = require('../internals/create-property');
|
18580 | var arrayMethodHasSpeciesSupport = require('../internals/array-method-has-species-support');
|
18581 | var arrayMethodUsesToLength = require('../internals/array-method-uses-to-length');
|
18582 |
|
18583 | var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('splice');
|
18584 | var USES_TO_LENGTH = arrayMethodUsesToLength('splice', { ACCESSORS: true, 0: 0, 1: 2 });
|
18585 |
|
18586 | var max = Math.max;
|
18587 | var min = Math.min;
|
18588 | var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF;
|
18589 | var MAXIMUM_ALLOWED_LENGTH_EXCEEDED = 'Maximum allowed length exceeded';
|
18590 |
|
18591 |
|
18592 |
|
18593 |
|
18594 | $({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT || !USES_TO_LENGTH }, {
|
18595 | splice: function splice(start, deleteCount /* , ...items */) {
|
18596 | var O = toObject(this);
|
18597 | var len = toLength(O.length);
|
18598 | var actualStart = toAbsoluteIndex(start, len);
|
18599 | var argumentsLength = arguments.length;
|
18600 | var insertCount, actualDeleteCount, A, k, from, to;
|
18601 | if (argumentsLength === 0) {
|
18602 | insertCount = actualDeleteCount = 0;
|
18603 | } else if (argumentsLength === 1) {
|
18604 | insertCount = 0;
|
18605 | actualDeleteCount = len - actualStart;
|
18606 | } else {
|
18607 | insertCount = argumentsLength - 2;
|
18608 | actualDeleteCount = min(max(toInteger(deleteCount), 0), len - actualStart);
|
18609 | }
|
18610 | if (len + insertCount - actualDeleteCount > MAX_SAFE_INTEGER) {
|
18611 | throw TypeError(MAXIMUM_ALLOWED_LENGTH_EXCEEDED);
|
18612 | }
|
18613 | A = arraySpeciesCreate(O, actualDeleteCount);
|
18614 | for (k = 0; k < actualDeleteCount; k++) {
|
18615 | from = actualStart + k;
|
18616 | if (from in O) createProperty(A, k, O[from]);
|
18617 | }
|
18618 | A.length = actualDeleteCount;
|
18619 | if (insertCount < actualDeleteCount) {
|
18620 | for (k = actualStart; k < len - actualDeleteCount; k++) {
|
18621 | from = k + actualDeleteCount;
|
18622 | to = k + insertCount;
|
18623 | if (from in O) O[to] = O[from];
|
18624 | else delete O[to];
|
18625 | }
|
18626 | for (k = len; k > len - actualDeleteCount + insertCount; k--) delete O[k - 1];
|
18627 | } else if (insertCount > actualDeleteCount) {
|
18628 | for (k = len - actualDeleteCount; k > actualStart; k--) {
|
18629 | from = k + actualDeleteCount - 1;
|
18630 | to = k + insertCount - 1;
|
18631 | if (from in O) O[to] = O[from];
|
18632 | else delete O[to];
|
18633 | }
|
18634 | }
|
18635 | for (k = 0; k < insertCount; k++) {
|
18636 | O[k + actualStart] = arguments[k + 2];
|
18637 | }
|
18638 | O.length = len - actualDeleteCount + insertCount;
|
18639 | return A;
|
18640 | }
|
18641 | });
|
18642 |
|
18643 | },{"../internals/array-method-has-species-support":118,"../internals/array-method-uses-to-length":120,"../internals/array-species-create":122,"../internals/create-property":133,"../internals/export":144,"../internals/to-absolute-index":215,"../internals/to-integer":218,"../internals/to-length":219,"../internals/to-object":220}],249:[function(require,module,exports){
|
18644 | var DESCRIPTORS = require('../internals/descriptors');
|
18645 | var defineProperty = require('../internals/object-define-property').f;
|
18646 |
|
18647 | var FunctionPrototype = Function.prototype;
|
18648 | var FunctionPrototypeToString = FunctionPrototype.toString;
|
18649 | var nameRE = /^\s*function ([^ (]*)/;
|
18650 | var NAME = 'name';
|
18651 |
|
18652 |
|
18653 |
|
18654 | if (DESCRIPTORS && !(NAME in FunctionPrototype)) {
|
18655 | defineProperty(FunctionPrototype, NAME, {
|
18656 | configurable: true,
|
18657 | get: function () {
|
18658 | try {
|
18659 | return FunctionPrototypeToString.call(this).match(nameRE)[1];
|
18660 | } catch (error) {
|
18661 | return '';
|
18662 | }
|
18663 | }
|
18664 | });
|
18665 | }
|
18666 |
|
18667 | },{"../internals/descriptors":136,"../internals/object-define-property":180}],250:[function(require,module,exports){
|
18668 | 'use strict';
|
18669 | var DESCRIPTORS = require('../internals/descriptors');
|
18670 | var global = require('../internals/global');
|
18671 | var isForced = require('../internals/is-forced');
|
18672 | var redefine = require('../internals/redefine');
|
18673 | var has = require('../internals/has');
|
18674 | var classof = require('../internals/classof-raw');
|
18675 | var inheritIfRequired = require('../internals/inherit-if-required');
|
18676 | var toPrimitive = require('../internals/to-primitive');
|
18677 | var fails = require('../internals/fails');
|
18678 | var create = require('../internals/object-create');
|
18679 | var getOwnPropertyNames = require('../internals/object-get-own-property-names').f;
|
18680 | var getOwnPropertyDescriptor = require('../internals/object-get-own-property-descriptor').f;
|
18681 | var defineProperty = require('../internals/object-define-property').f;
|
18682 | var trim = require('../internals/string-trim').trim;
|
18683 |
|
18684 | var NUMBER = 'Number';
|
18685 | var NativeNumber = global[NUMBER];
|
18686 | var NumberPrototype = NativeNumber.prototype;
|
18687 |
|
18688 |
|
18689 | var BROKEN_CLASSOF = classof(create(NumberPrototype)) == NUMBER;
|
18690 |
|
18691 |
|
18692 |
|
18693 | var toNumber = function (argument) {
|
18694 | var it = toPrimitive(argument, false);
|
18695 | var first, third, radix, maxCode, digits, length, index, code;
|
18696 | if (typeof it == 'string' && it.length > 2) {
|
18697 | it = trim(it);
|
18698 | first = it.charCodeAt(0);
|
18699 | if (first === 43 || first === 45) {
|
18700 | third = it.charCodeAt(2);
|
18701 | if (third === 88 || third === 120) return NaN;
|
18702 | } else if (first === 48) {
|
18703 | switch (it.charCodeAt(1)) {
|
18704 | case 66: case 98: radix = 2; maxCode = 49; break;
|
18705 | case 79: case 111: radix = 8; maxCode = 55; break;
|
18706 | default: return +it;
|
18707 | }
|
18708 | digits = it.slice(2);
|
18709 | length = digits.length;
|
18710 | for (index = 0; index < length; index++) {
|
18711 | code = digits.charCodeAt(index);
|
18712 |
|
18713 |
|
18714 | if (code < 48 || code > maxCode) return NaN;
|
18715 | } return parseInt(digits, radix);
|
18716 | }
|
18717 | } return +it;
|
18718 | };
|
18719 |
|
18720 |
|
18721 |
|
18722 | if (isForced(NUMBER, !NativeNumber(' 0o1') || !NativeNumber('0b1') || NativeNumber('+0x1'))) {
|
18723 | var NumberWrapper = function Number(value) {
|
18724 | var it = arguments.length < 1 ? 0 : value;
|
18725 | var dummy = this;
|
18726 | return dummy instanceof NumberWrapper
|
18727 |
|
18728 | && (BROKEN_CLASSOF ? fails(function () { NumberPrototype.valueOf.call(dummy); }) : classof(dummy) != NUMBER)
|
18729 | ? inheritIfRequired(new NativeNumber(toNumber(it)), dummy, NumberWrapper) : toNumber(it);
|
18730 | };
|
18731 | for (var keys = DESCRIPTORS ? getOwnPropertyNames(NativeNumber) : (
|
18732 |
|
18733 | 'MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,' +
|
18734 |
|
18735 | 'EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,' +
|
18736 | 'MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger'
|
18737 | ).split(','), j = 0, key; keys.length > j; j++) {
|
18738 | if (has(NativeNumber, key = keys[j]) && !has(NumberWrapper, key)) {
|
18739 | defineProperty(NumberWrapper, key, getOwnPropertyDescriptor(NativeNumber, key));
|
18740 | }
|
18741 | }
|
18742 | NumberWrapper.prototype = NumberPrototype;
|
18743 | NumberPrototype.constructor = NumberWrapper;
|
18744 | redefine(global, NUMBER, NumberWrapper);
|
18745 | }
|
18746 |
|
18747 | },{"../internals/classof-raw":125,"../internals/descriptors":136,"../internals/fails":145,"../internals/global":150,"../internals/has":151,"../internals/inherit-if-required":158,"../internals/is-forced":163,"../internals/object-create":178,"../internals/object-define-property":180,"../internals/object-get-own-property-descriptor":181,"../internals/object-get-own-property-names":183,"../internals/redefine":197,"../internals/string-trim":213,"../internals/to-primitive":223}],251:[function(require,module,exports){
|
18748 | var $ = require('../internals/export');
|
18749 | var assign = require('../internals/object-assign');
|
18750 |
|
18751 |
|
18752 |
|
18753 | $({ target: 'Object', stat: true, forced: Object.assign !== assign }, {
|
18754 | assign: assign
|
18755 | });
|
18756 |
|
18757 | },{"../internals/export":144,"../internals/object-assign":177}],252:[function(require,module,exports){
|
18758 | var $ = require('../internals/export');
|
18759 | var $entries = require('../internals/object-to-array').entries;
|
18760 |
|
18761 |
|
18762 |
|
18763 | $({ target: 'Object', stat: true }, {
|
18764 | entries: function entries(O) {
|
18765 | return $entries(O);
|
18766 | }
|
18767 | });
|
18768 |
|
18769 | },{"../internals/export":144,"../internals/object-to-array":190}],253:[function(require,module,exports){
|
18770 | var $ = require('../internals/export');
|
18771 | var toObject = require('../internals/to-object');
|
18772 | var nativeKeys = require('../internals/object-keys');
|
18773 | var fails = require('../internals/fails');
|
18774 |
|
18775 | var FAILS_ON_PRIMITIVES = fails(function () { nativeKeys(1); });
|
18776 |
|
18777 |
|
18778 |
|
18779 | $({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES }, {
|
18780 | keys: function keys(it) {
|
18781 | return nativeKeys(toObject(it));
|
18782 | }
|
18783 | });
|
18784 |
|
18785 | },{"../internals/export":144,"../internals/fails":145,"../internals/object-keys":187,"../internals/to-object":220}],254:[function(require,module,exports){
|
18786 | var TO_STRING_TAG_SUPPORT = require('../internals/to-string-tag-support');
|
18787 | var redefine = require('../internals/redefine');
|
18788 | var toString = require('../internals/object-to-string');
|
18789 |
|
18790 |
|
18791 |
|
18792 | if (!TO_STRING_TAG_SUPPORT) {
|
18793 | redefine(Object.prototype, 'toString', toString, { unsafe: true });
|
18794 | }
|
18795 |
|
18796 | },{"../internals/object-to-string":191,"../internals/redefine":197,"../internals/to-string-tag-support":224}],255:[function(require,module,exports){
|
18797 | 'use strict';
|
18798 | var $ = require('../internals/export');
|
18799 | var IS_PURE = require('../internals/is-pure');
|
18800 | var global = require('../internals/global');
|
18801 | var getBuiltIn = require('../internals/get-built-in');
|
18802 | var NativePromise = require('../internals/native-promise-constructor');
|
18803 | var redefine = require('../internals/redefine');
|
18804 | var redefineAll = require('../internals/redefine-all');
|
18805 | var setToStringTag = require('../internals/set-to-string-tag');
|
18806 | var setSpecies = require('../internals/set-species');
|
18807 | var isObject = require('../internals/is-object');
|
18808 | var aFunction = require('../internals/a-function');
|
18809 | var anInstance = require('../internals/an-instance');
|
18810 | var inspectSource = require('../internals/inspect-source');
|
18811 | var iterate = require('../internals/iterate');
|
18812 | var checkCorrectnessOfIteration = require('../internals/check-correctness-of-iteration');
|
18813 | var speciesConstructor = require('../internals/species-constructor');
|
18814 | var task = require('../internals/task').set;
|
18815 | var microtask = require('../internals/microtask');
|
18816 | var promiseResolve = require('../internals/promise-resolve');
|
18817 | var hostReportErrors = require('../internals/host-report-errors');
|
18818 | var newPromiseCapabilityModule = require('../internals/new-promise-capability');
|
18819 | var perform = require('../internals/perform');
|
18820 | var InternalStateModule = require('../internals/internal-state');
|
18821 | var isForced = require('../internals/is-forced');
|
18822 | var wellKnownSymbol = require('../internals/well-known-symbol');
|
18823 | var IS_NODE = require('../internals/engine-is-node');
|
18824 | var V8_VERSION = require('../internals/engine-v8-version');
|
18825 |
|
18826 | var SPECIES = wellKnownSymbol('species');
|
18827 | var PROMISE = 'Promise';
|
18828 | var getInternalState = InternalStateModule.get;
|
18829 | var setInternalState = InternalStateModule.set;
|
18830 | var getInternalPromiseState = InternalStateModule.getterFor(PROMISE);
|
18831 | var PromiseConstructor = NativePromise;
|
18832 | var TypeError = global.TypeError;
|
18833 | var document = global.document;
|
18834 | var process = global.process;
|
18835 | var $fetch = getBuiltIn('fetch');
|
18836 | var newPromiseCapability = newPromiseCapabilityModule.f;
|
18837 | var newGenericPromiseCapability = newPromiseCapability;
|
18838 | var DISPATCH_EVENT = !!(document && document.createEvent && global.dispatchEvent);
|
18839 | var NATIVE_REJECTION_EVENT = typeof PromiseRejectionEvent == 'function';
|
18840 | var UNHANDLED_REJECTION = 'unhandledrejection';
|
18841 | var REJECTION_HANDLED = 'rejectionhandled';
|
18842 | var PENDING = 0;
|
18843 | var FULFILLED = 1;
|
18844 | var REJECTED = 2;
|
18845 | var HANDLED = 1;
|
18846 | var UNHANDLED = 2;
|
18847 | var Internal, OwnPromiseCapability, PromiseWrapper, nativeThen;
|
18848 |
|
18849 | var FORCED = isForced(PROMISE, function () {
|
18850 | var GLOBAL_CORE_JS_PROMISE = inspectSource(PromiseConstructor) !== String(PromiseConstructor);
|
18851 | if (!GLOBAL_CORE_JS_PROMISE) {
|
18852 |
|
18853 |
|
18854 |
|
18855 | if (V8_VERSION === 66) return true;
|
18856 |
|
18857 | if (!IS_NODE && !NATIVE_REJECTION_EVENT) return true;
|
18858 | }
|
18859 |
|
18860 | if (IS_PURE && !PromiseConstructor.prototype['finally']) return true;
|
18861 |
|
18862 |
|
18863 |
|
18864 | if (V8_VERSION >= 51 && /native code/.test(PromiseConstructor)) return false;
|
18865 |
|
18866 | var promise = PromiseConstructor.resolve(1);
|
18867 | var FakePromise = function (exec) {
|
18868 | exec(function () { }, function () { });
|
18869 | };
|
18870 | var constructor = promise.constructor = {};
|
18871 | constructor[SPECIES] = FakePromise;
|
18872 | return !(promise.then(function () { }) instanceof FakePromise);
|
18873 | });
|
18874 |
|
18875 | var INCORRECT_ITERATION = FORCED || !checkCorrectnessOfIteration(function (iterable) {
|
18876 | PromiseConstructor.all(iterable)['catch'](function () { });
|
18877 | });
|
18878 |
|
18879 |
|
18880 | var isThenable = function (it) {
|
18881 | var then;
|
18882 | return isObject(it) && typeof (then = it.then) == 'function' ? then : false;
|
18883 | };
|
18884 |
|
18885 | var notify = function (state, isReject) {
|
18886 | if (state.notified) return;
|
18887 | state.notified = true;
|
18888 | var chain = state.reactions;
|
18889 | microtask(function () {
|
18890 | var value = state.value;
|
18891 | var ok = state.state == FULFILLED;
|
18892 | var index = 0;
|
18893 |
|
18894 | while (chain.length > index) {
|
18895 | var reaction = chain[index++];
|
18896 | var handler = ok ? reaction.ok : reaction.fail;
|
18897 | var resolve = reaction.resolve;
|
18898 | var reject = reaction.reject;
|
18899 | var domain = reaction.domain;
|
18900 | var result, then, exited;
|
18901 | try {
|
18902 | if (handler) {
|
18903 | if (!ok) {
|
18904 | if (state.rejection === UNHANDLED) onHandleUnhandled(state);
|
18905 | state.rejection = HANDLED;
|
18906 | }
|
18907 | if (handler === true) result = value;
|
18908 | else {
|
18909 | if (domain) domain.enter();
|
18910 | result = handler(value);
|
18911 | if (domain) {
|
18912 | domain.exit();
|
18913 | exited = true;
|
18914 | }
|
18915 | }
|
18916 | if (result === reaction.promise) {
|
18917 | reject(TypeError('Promise-chain cycle'));
|
18918 | } else if (then = isThenable(result)) {
|
18919 | then.call(result, resolve, reject);
|
18920 | } else resolve(result);
|
18921 | } else reject(value);
|
18922 | } catch (error) {
|
18923 | if (domain && !exited) domain.exit();
|
18924 | reject(error);
|
18925 | }
|
18926 | }
|
18927 | state.reactions = [];
|
18928 | state.notified = false;
|
18929 | if (isReject && !state.rejection) onUnhandled(state);
|
18930 | });
|
18931 | };
|
18932 |
|
18933 | var dispatchEvent = function (name, promise, reason) {
|
18934 | var event, handler;
|
18935 | if (DISPATCH_EVENT) {
|
18936 | event = document.createEvent('Event');
|
18937 | event.promise = promise;
|
18938 | event.reason = reason;
|
18939 | event.initEvent(name, false, true);
|
18940 | global.dispatchEvent(event);
|
18941 | } else event = { promise: promise, reason: reason };
|
18942 | if (!NATIVE_REJECTION_EVENT && (handler = global['on' + name])) handler(event);
|
18943 | else if (name === UNHANDLED_REJECTION) hostReportErrors('Unhandled promise rejection', reason);
|
18944 | };
|
18945 |
|
18946 | var onUnhandled = function (state) {
|
18947 | task.call(global, function () {
|
18948 | var promise = state.facade;
|
18949 | var value = state.value;
|
18950 | var IS_UNHANDLED = isUnhandled(state);
|
18951 | var result;
|
18952 | if (IS_UNHANDLED) {
|
18953 | result = perform(function () {
|
18954 | if (IS_NODE) {
|
18955 | process.emit('unhandledRejection', value, promise);
|
18956 | } else dispatchEvent(UNHANDLED_REJECTION, promise, value);
|
18957 | });
|
18958 |
|
18959 | state.rejection = IS_NODE || isUnhandled(state) ? UNHANDLED : HANDLED;
|
18960 | if (result.error) throw result.value;
|
18961 | }
|
18962 | });
|
18963 | };
|
18964 |
|
18965 | var isUnhandled = function (state) {
|
18966 | return state.rejection !== HANDLED && !state.parent;
|
18967 | };
|
18968 |
|
18969 | var onHandleUnhandled = function (state) {
|
18970 | task.call(global, function () {
|
18971 | var promise = state.facade;
|
18972 | if (IS_NODE) {
|
18973 | process.emit('rejectionHandled', promise);
|
18974 | } else dispatchEvent(REJECTION_HANDLED, promise, state.value);
|
18975 | });
|
18976 | };
|
18977 |
|
18978 | var bind = function (fn, state, unwrap) {
|
18979 | return function (value) {
|
18980 | fn(state, value, unwrap);
|
18981 | };
|
18982 | };
|
18983 |
|
18984 | var internalReject = function (state, value, unwrap) {
|
18985 | if (state.done) return;
|
18986 | state.done = true;
|
18987 | if (unwrap) state = unwrap;
|
18988 | state.value = value;
|
18989 | state.state = REJECTED;
|
18990 | notify(state, true);
|
18991 | };
|
18992 |
|
18993 | var internalResolve = function (state, value, unwrap) {
|
18994 | if (state.done) return;
|
18995 | state.done = true;
|
18996 | if (unwrap) state = unwrap;
|
18997 | try {
|
18998 | if (state.facade === value) throw TypeError("Promise can't be resolved itself");
|
18999 | var then = isThenable(value);
|
19000 | if (then) {
|
19001 | microtask(function () {
|
19002 | var wrapper = { done: false };
|
19003 | try {
|
19004 | then.call(value,
|
19005 | bind(internalResolve, wrapper, state),
|
19006 | bind(internalReject, wrapper, state)
|
19007 | );
|
19008 | } catch (error) {
|
19009 | internalReject(wrapper, error, state);
|
19010 | }
|
19011 | });
|
19012 | } else {
|
19013 | state.value = value;
|
19014 | state.state = FULFILLED;
|
19015 | notify(state, false);
|
19016 | }
|
19017 | } catch (error) {
|
19018 | internalReject({ done: false }, error, state);
|
19019 | }
|
19020 | };
|
19021 |
|
19022 |
|
19023 | if (FORCED) {
|
19024 |
|
19025 | PromiseConstructor = function Promise(executor) {
|
19026 | anInstance(this, PromiseConstructor, PROMISE);
|
19027 | aFunction(executor);
|
19028 | Internal.call(this);
|
19029 | var state = getInternalState(this);
|
19030 | try {
|
19031 | executor(bind(internalResolve, state), bind(internalReject, state));
|
19032 | } catch (error) {
|
19033 | internalReject(state, error);
|
19034 | }
|
19035 | };
|
19036 |
|
19037 | Internal = function Promise(executor) {
|
19038 | setInternalState(this, {
|
19039 | type: PROMISE,
|
19040 | done: false,
|
19041 | notified: false,
|
19042 | parent: false,
|
19043 | reactions: [],
|
19044 | rejection: false,
|
19045 | state: PENDING,
|
19046 | value: undefined
|
19047 | });
|
19048 | };
|
19049 | Internal.prototype = redefineAll(PromiseConstructor.prototype, {
|
19050 |
|
19051 |
|
19052 | then: function then(onFulfilled, onRejected) {
|
19053 | var state = getInternalPromiseState(this);
|
19054 | var reaction = newPromiseCapability(speciesConstructor(this, PromiseConstructor));
|
19055 | reaction.ok = typeof onFulfilled == 'function' ? onFulfilled : true;
|
19056 | reaction.fail = typeof onRejected == 'function' && onRejected;
|
19057 | reaction.domain = IS_NODE ? process.domain : undefined;
|
19058 | state.parent = true;
|
19059 | state.reactions.push(reaction);
|
19060 | if (state.state != PENDING) notify(state, false);
|
19061 | return reaction.promise;
|
19062 | },
|
19063 |
|
19064 |
|
19065 | 'catch': function (onRejected) {
|
19066 | return this.then(undefined, onRejected);
|
19067 | }
|
19068 | });
|
19069 | OwnPromiseCapability = function () {
|
19070 | var promise = new Internal();
|
19071 | var state = getInternalState(promise);
|
19072 | this.promise = promise;
|
19073 | this.resolve = bind(internalResolve, state);
|
19074 | this.reject = bind(internalReject, state);
|
19075 | };
|
19076 | newPromiseCapabilityModule.f = newPromiseCapability = function (C) {
|
19077 | return C === PromiseConstructor || C === PromiseWrapper
|
19078 | ? new OwnPromiseCapability(C)
|
19079 | : newGenericPromiseCapability(C);
|
19080 | };
|
19081 |
|
19082 | if (!IS_PURE && typeof NativePromise == 'function') {
|
19083 | nativeThen = NativePromise.prototype.then;
|
19084 |
|
19085 |
|
19086 | redefine(NativePromise.prototype, 'then', function then(onFulfilled, onRejected) {
|
19087 | var that = this;
|
19088 | return new PromiseConstructor(function (resolve, reject) {
|
19089 | nativeThen.call(that, resolve, reject);
|
19090 | }).then(onFulfilled, onRejected);
|
19091 |
|
19092 | }, { unsafe: true });
|
19093 |
|
19094 |
|
19095 | if (typeof $fetch == 'function') $({ global: true, enumerable: true, forced: true }, {
|
19096 |
|
19097 | fetch: function fetch(input /* , init */) {
|
19098 | return promiseResolve(PromiseConstructor, $fetch.apply(global, arguments));
|
19099 | }
|
19100 | });
|
19101 | }
|
19102 | }
|
19103 |
|
19104 | $({ global: true, wrap: true, forced: FORCED }, {
|
19105 | Promise: PromiseConstructor
|
19106 | });
|
19107 |
|
19108 | setToStringTag(PromiseConstructor, PROMISE, false, true);
|
19109 | setSpecies(PROMISE);
|
19110 |
|
19111 | PromiseWrapper = getBuiltIn(PROMISE);
|
19112 |
|
19113 |
|
19114 | $({ target: PROMISE, stat: true, forced: FORCED }, {
|
19115 |
|
19116 |
|
19117 | reject: function reject(r) {
|
19118 | var capability = newPromiseCapability(this);
|
19119 | capability.reject.call(undefined, r);
|
19120 | return capability.promise;
|
19121 | }
|
19122 | });
|
19123 |
|
19124 | $({ target: PROMISE, stat: true, forced: IS_PURE || FORCED }, {
|
19125 |
|
19126 |
|
19127 | resolve: function resolve(x) {
|
19128 | return promiseResolve(IS_PURE && this === PromiseWrapper ? PromiseConstructor : this, x);
|
19129 | }
|
19130 | });
|
19131 |
|
19132 | $({ target: PROMISE, stat: true, forced: INCORRECT_ITERATION }, {
|
19133 |
|
19134 |
|
19135 | all: function all(iterable) {
|
19136 | var C = this;
|
19137 | var capability = newPromiseCapability(C);
|
19138 | var resolve = capability.resolve;
|
19139 | var reject = capability.reject;
|
19140 | var result = perform(function () {
|
19141 | var $promiseResolve = aFunction(C.resolve);
|
19142 | var values = [];
|
19143 | var counter = 0;
|
19144 | var remaining = 1;
|
19145 | iterate(iterable, function (promise) {
|
19146 | var index = counter++;
|
19147 | var alreadyCalled = false;
|
19148 | values.push(undefined);
|
19149 | remaining++;
|
19150 | $promiseResolve.call(C, promise).then(function (value) {
|
19151 | if (alreadyCalled) return;
|
19152 | alreadyCalled = true;
|
19153 | values[index] = value;
|
19154 | --remaining || resolve(values);
|
19155 | }, reject);
|
19156 | });
|
19157 | --remaining || resolve(values);
|
19158 | });
|
19159 | if (result.error) reject(result.value);
|
19160 | return capability.promise;
|
19161 | },
|
19162 |
|
19163 |
|
19164 | race: function race(iterable) {
|
19165 | var C = this;
|
19166 | var capability = newPromiseCapability(C);
|
19167 | var reject = capability.reject;
|
19168 | var result = perform(function () {
|
19169 | var $promiseResolve = aFunction(C.resolve);
|
19170 | iterate(iterable, function (promise) {
|
19171 | $promiseResolve.call(C, promise).then(capability.resolve, reject);
|
19172 | });
|
19173 | });
|
19174 | if (result.error) reject(result.value);
|
19175 | return capability.promise;
|
19176 | }
|
19177 | });
|
19178 |
|
19179 | },{"../internals/a-function":102,"../internals/an-instance":106,"../internals/check-correctness-of-iteration":124,"../internals/engine-is-node":140,"../internals/engine-v8-version":142,"../internals/export":144,"../internals/get-built-in":148,"../internals/global":150,"../internals/host-report-errors":153,"../internals/inspect-source":159,"../internals/internal-state":160,"../internals/is-forced":163,"../internals/is-object":164,"../internals/is-pure":165,"../internals/iterate":167,"../internals/microtask":171,"../internals/native-promise-constructor":172,"../internals/new-promise-capability":175,"../internals/perform":194,"../internals/promise-resolve":195,"../internals/redefine":197,"../internals/redefine-all":196,"../internals/set-species":205,"../internals/set-to-string-tag":206,"../internals/species-constructor":210,"../internals/task":214,"../internals/well-known-symbol":231}],256:[function(require,module,exports){
|
19180 | 'use strict';
|
19181 | var $ = require('../internals/export');
|
19182 | var exec = require('../internals/regexp-exec');
|
19183 |
|
19184 | $({ target: 'RegExp', proto: true, forced: /./.exec !== exec }, {
|
19185 | exec: exec
|
19186 | });
|
19187 |
|
19188 | },{"../internals/export":144,"../internals/regexp-exec":199}],257:[function(require,module,exports){
|
19189 | 'use strict';
|
19190 | var redefine = require('../internals/redefine');
|
19191 | var anObject = require('../internals/an-object');
|
19192 | var fails = require('../internals/fails');
|
19193 | var flags = require('../internals/regexp-flags');
|
19194 |
|
19195 | var TO_STRING = 'toString';
|
19196 | var RegExpPrototype = RegExp.prototype;
|
19197 | var nativeToString = RegExpPrototype[TO_STRING];
|
19198 |
|
19199 | var NOT_GENERIC = fails(function () { return nativeToString.call({ source: 'a', flags: 'b' }) != '/a/b'; });
|
19200 |
|
19201 | var INCORRECT_NAME = nativeToString.name != TO_STRING;
|
19202 |
|
19203 |
|
19204 |
|
19205 | if (NOT_GENERIC || INCORRECT_NAME) {
|
19206 | redefine(RegExp.prototype, TO_STRING, function toString() {
|
19207 | var R = anObject(this);
|
19208 | var p = String(R.source);
|
19209 | var rf = R.flags;
|
19210 | var f = String(rf === undefined && R instanceof RegExp && !('flags' in RegExpPrototype) ? flags.call(R) : rf);
|
19211 | return '/' + p + '/' + f;
|
19212 | }, { unsafe: true });
|
19213 | }
|
19214 |
|
19215 | },{"../internals/an-object":107,"../internals/fails":145,"../internals/redefine":197,"../internals/regexp-flags":200}],258:[function(require,module,exports){
|
19216 | 'use strict';
|
19217 | var $ = require('../internals/export');
|
19218 | var notARegExp = require('../internals/not-a-regexp');
|
19219 | var requireObjectCoercible = require('../internals/require-object-coercible');
|
19220 | var correctIsRegExpLogic = require('../internals/correct-is-regexp-logic');
|
19221 |
|
19222 |
|
19223 |
|
19224 | $({ target: 'String', proto: true, forced: !correctIsRegExpLogic('includes') }, {
|
19225 | includes: function includes(searchString /* , position = 0 */) {
|
19226 | return !!~String(requireObjectCoercible(this))
|
19227 | .indexOf(notARegExp(searchString), arguments.length > 1 ? arguments[1] : undefined);
|
19228 | }
|
19229 | });
|
19230 |
|
19231 | },{"../internals/correct-is-regexp-logic":128,"../internals/export":144,"../internals/not-a-regexp":176,"../internals/require-object-coercible":202}],259:[function(require,module,exports){
|
19232 | 'use strict';
|
19233 | var charAt = require('../internals/string-multibyte').charAt;
|
19234 | var InternalStateModule = require('../internals/internal-state');
|
19235 | var defineIterator = require('../internals/define-iterator');
|
19236 |
|
19237 | var STRING_ITERATOR = 'String Iterator';
|
19238 | var setInternalState = InternalStateModule.set;
|
19239 | var getInternalState = InternalStateModule.getterFor(STRING_ITERATOR);
|
19240 |
|
19241 |
|
19242 |
|
19243 | defineIterator(String, 'String', function (iterated) {
|
19244 | setInternalState(this, {
|
19245 | type: STRING_ITERATOR,
|
19246 | string: String(iterated),
|
19247 | index: 0
|
19248 | });
|
19249 |
|
19250 |
|
19251 | }, function next() {
|
19252 | var state = getInternalState(this);
|
19253 | var string = state.string;
|
19254 | var index = state.index;
|
19255 | var point;
|
19256 | if (index >= string.length) return { value: undefined, done: true };
|
19257 | point = charAt(string, index);
|
19258 | state.index += point.length;
|
19259 | return { value: point, done: false };
|
19260 | });
|
19261 |
|
19262 | },{"../internals/define-iterator":134,"../internals/internal-state":160,"../internals/string-multibyte":211}],260:[function(require,module,exports){
|
19263 | 'use strict';
|
19264 | var fixRegExpWellKnownSymbolLogic = require('../internals/fix-regexp-well-known-symbol-logic');
|
19265 | var anObject = require('../internals/an-object');
|
19266 | var toLength = require('../internals/to-length');
|
19267 | var requireObjectCoercible = require('../internals/require-object-coercible');
|
19268 | var advanceStringIndex = require('../internals/advance-string-index');
|
19269 | var regExpExec = require('../internals/regexp-exec-abstract');
|
19270 |
|
19271 |
|
19272 | fixRegExpWellKnownSymbolLogic('match', 1, function (MATCH, nativeMatch, maybeCallNative) {
|
19273 | return [
|
19274 |
|
19275 |
|
19276 | function match(regexp) {
|
19277 | var O = requireObjectCoercible(this);
|
19278 | var matcher = regexp == undefined ? undefined : regexp[MATCH];
|
19279 | return matcher !== undefined ? matcher.call(regexp, O) : new RegExp(regexp)[MATCH](String(O));
|
19280 | },
|
19281 |
|
19282 |
|
19283 | function (regexp) {
|
19284 | var res = maybeCallNative(nativeMatch, regexp, this);
|
19285 | if (res.done) return res.value;
|
19286 |
|
19287 | var rx = anObject(regexp);
|
19288 | var S = String(this);
|
19289 |
|
19290 | if (!rx.global) return regExpExec(rx, S);
|
19291 |
|
19292 | var fullUnicode = rx.unicode;
|
19293 | rx.lastIndex = 0;
|
19294 | var A = [];
|
19295 | var n = 0;
|
19296 | var result;
|
19297 | while ((result = regExpExec(rx, S)) !== null) {
|
19298 | var matchStr = String(result[0]);
|
19299 | A[n] = matchStr;
|
19300 | if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode);
|
19301 | n++;
|
19302 | }
|
19303 | return n === 0 ? null : A;
|
19304 | }
|
19305 | ];
|
19306 | });
|
19307 |
|
19308 | },{"../internals/advance-string-index":105,"../internals/an-object":107,"../internals/fix-regexp-well-known-symbol-logic":146,"../internals/regexp-exec-abstract":198,"../internals/require-object-coercible":202,"../internals/to-length":219}],261:[function(require,module,exports){
|
19309 | 'use strict';
|
19310 | var fixRegExpWellKnownSymbolLogic = require('../internals/fix-regexp-well-known-symbol-logic');
|
19311 | var anObject = require('../internals/an-object');
|
19312 | var toObject = require('../internals/to-object');
|
19313 | var toLength = require('../internals/to-length');
|
19314 | var toInteger = require('../internals/to-integer');
|
19315 | var requireObjectCoercible = require('../internals/require-object-coercible');
|
19316 | var advanceStringIndex = require('../internals/advance-string-index');
|
19317 | var regExpExec = require('../internals/regexp-exec-abstract');
|
19318 |
|
19319 | var max = Math.max;
|
19320 | var min = Math.min;
|
19321 | var floor = Math.floor;
|
19322 | var SUBSTITUTION_SYMBOLS = /\$([$&'`]|\d\d?|<[^>]*>)/g;
|
19323 | var SUBSTITUTION_SYMBOLS_NO_NAMED = /\$([$&'`]|\d\d?)/g;
|
19324 |
|
19325 | var maybeToString = function (it) {
|
19326 | return it === undefined ? it : String(it);
|
19327 | };
|
19328 |
|
19329 |
|
19330 | fixRegExpWellKnownSymbolLogic('replace', 2, function (REPLACE, nativeReplace, maybeCallNative, reason) {
|
19331 | var REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE = reason.REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE;
|
19332 | var REPLACE_KEEPS_$0 = reason.REPLACE_KEEPS_$0;
|
19333 | var UNSAFE_SUBSTITUTE = REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE ? '$' : '$0';
|
19334 |
|
19335 | return [
|
19336 |
|
19337 |
|
19338 | function replace(searchValue, replaceValue) {
|
19339 | var O = requireObjectCoercible(this);
|
19340 | var replacer = searchValue == undefined ? undefined : searchValue[REPLACE];
|
19341 | return replacer !== undefined
|
19342 | ? replacer.call(searchValue, O, replaceValue)
|
19343 | : nativeReplace.call(String(O), searchValue, replaceValue);
|
19344 | },
|
19345 |
|
19346 |
|
19347 | function (regexp, replaceValue) {
|
19348 | if (
|
19349 | (!REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE && REPLACE_KEEPS_$0) ||
|
19350 | (typeof replaceValue === 'string' && replaceValue.indexOf(UNSAFE_SUBSTITUTE) === -1)
|
19351 | ) {
|
19352 | var res = maybeCallNative(nativeReplace, regexp, this, replaceValue);
|
19353 | if (res.done) return res.value;
|
19354 | }
|
19355 |
|
19356 | var rx = anObject(regexp);
|
19357 | var S = String(this);
|
19358 |
|
19359 | var functionalReplace = typeof replaceValue === 'function';
|
19360 | if (!functionalReplace) replaceValue = String(replaceValue);
|
19361 |
|
19362 | var global = rx.global;
|
19363 | if (global) {
|
19364 | var fullUnicode = rx.unicode;
|
19365 | rx.lastIndex = 0;
|
19366 | }
|
19367 | var results = [];
|
19368 | while (true) {
|
19369 | var result = regExpExec(rx, S);
|
19370 | if (result === null) break;
|
19371 |
|
19372 | results.push(result);
|
19373 | if (!global) break;
|
19374 |
|
19375 | var matchStr = String(result[0]);
|
19376 | if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode);
|
19377 | }
|
19378 |
|
19379 | var accumulatedResult = '';
|
19380 | var nextSourcePosition = 0;
|
19381 | for (var i = 0; i < results.length; i++) {
|
19382 | result = results[i];
|
19383 |
|
19384 | var matched = String(result[0]);
|
19385 | var position = max(min(toInteger(result.index), S.length), 0);
|
19386 | var captures = [];
|
19387 |
|
19388 |
|
19389 |
|
19390 |
|
19391 |
|
19392 | for (var j = 1; j < result.length; j++) captures.push(maybeToString(result[j]));
|
19393 | var namedCaptures = result.groups;
|
19394 | if (functionalReplace) {
|
19395 | var replacerArgs = [matched].concat(captures, position, S);
|
19396 | if (namedCaptures !== undefined) replacerArgs.push(namedCaptures);
|
19397 | var replacement = String(replaceValue.apply(undefined, replacerArgs));
|
19398 | } else {
|
19399 | replacement = getSubstitution(matched, S, position, captures, namedCaptures, replaceValue);
|
19400 | }
|
19401 | if (position >= nextSourcePosition) {
|
19402 | accumulatedResult += S.slice(nextSourcePosition, position) + replacement;
|
19403 | nextSourcePosition = position + matched.length;
|
19404 | }
|
19405 | }
|
19406 | return accumulatedResult + S.slice(nextSourcePosition);
|
19407 | }
|
19408 | ];
|
19409 |
|
19410 |
|
19411 | function getSubstitution(matched, str, position, captures, namedCaptures, replacement) {
|
19412 | var tailPos = position + matched.length;
|
19413 | var m = captures.length;
|
19414 | var symbols = SUBSTITUTION_SYMBOLS_NO_NAMED;
|
19415 | if (namedCaptures !== undefined) {
|
19416 | namedCaptures = toObject(namedCaptures);
|
19417 | symbols = SUBSTITUTION_SYMBOLS;
|
19418 | }
|
19419 | return nativeReplace.call(replacement, symbols, function (match, ch) {
|
19420 | var capture;
|
19421 | switch (ch.charAt(0)) {
|
19422 | case '$': return '$';
|
19423 | case '&': return matched;
|
19424 | case '`': return str.slice(0, position);
|
19425 | case "'": return str.slice(tailPos);
|
19426 | case '<':
|
19427 | capture = namedCaptures[ch.slice(1, -1)];
|
19428 | break;
|
19429 | default:
|
19430 | var n = +ch;
|
19431 | if (n === 0) return match;
|
19432 | if (n > m) {
|
19433 | var f = floor(n / 10);
|
19434 | if (f === 0) return match;
|
19435 | if (f <= m) return captures[f - 1] === undefined ? ch.charAt(1) : captures[f - 1] + ch.charAt(1);
|
19436 | return match;
|
19437 | }
|
19438 | capture = captures[n - 1];
|
19439 | }
|
19440 | return capture === undefined ? '' : capture;
|
19441 | });
|
19442 | }
|
19443 | });
|
19444 |
|
19445 | },{"../internals/advance-string-index":105,"../internals/an-object":107,"../internals/fix-regexp-well-known-symbol-logic":146,"../internals/regexp-exec-abstract":198,"../internals/require-object-coercible":202,"../internals/to-integer":218,"../internals/to-length":219,"../internals/to-object":220}],262:[function(require,module,exports){
|
19446 | 'use strict';
|
19447 | var fixRegExpWellKnownSymbolLogic = require('../internals/fix-regexp-well-known-symbol-logic');
|
19448 | var anObject = require('../internals/an-object');
|
19449 | var requireObjectCoercible = require('../internals/require-object-coercible');
|
19450 | var sameValue = require('../internals/same-value');
|
19451 | var regExpExec = require('../internals/regexp-exec-abstract');
|
19452 |
|
19453 |
|
19454 | fixRegExpWellKnownSymbolLogic('search', 1, function (SEARCH, nativeSearch, maybeCallNative) {
|
19455 | return [
|
19456 |
|
19457 |
|
19458 | function search(regexp) {
|
19459 | var O = requireObjectCoercible(this);
|
19460 | var searcher = regexp == undefined ? undefined : regexp[SEARCH];
|
19461 | return searcher !== undefined ? searcher.call(regexp, O) : new RegExp(regexp)[SEARCH](String(O));
|
19462 | },
|
19463 |
|
19464 |
|
19465 | function (regexp) {
|
19466 | var res = maybeCallNative(nativeSearch, regexp, this);
|
19467 | if (res.done) return res.value;
|
19468 |
|
19469 | var rx = anObject(regexp);
|
19470 | var S = String(this);
|
19471 |
|
19472 | var previousLastIndex = rx.lastIndex;
|
19473 | if (!sameValue(previousLastIndex, 0)) rx.lastIndex = 0;
|
19474 | var result = regExpExec(rx, S);
|
19475 | if (!sameValue(rx.lastIndex, previousLastIndex)) rx.lastIndex = previousLastIndex;
|
19476 | return result === null ? -1 : result.index;
|
19477 | }
|
19478 | ];
|
19479 | });
|
19480 |
|
19481 | },{"../internals/an-object":107,"../internals/fix-regexp-well-known-symbol-logic":146,"../internals/regexp-exec-abstract":198,"../internals/require-object-coercible":202,"../internals/same-value":203}],263:[function(require,module,exports){
|
19482 | 'use strict';
|
19483 | var fixRegExpWellKnownSymbolLogic = require('../internals/fix-regexp-well-known-symbol-logic');
|
19484 | var isRegExp = require('../internals/is-regexp');
|
19485 | var anObject = require('../internals/an-object');
|
19486 | var requireObjectCoercible = require('../internals/require-object-coercible');
|
19487 | var speciesConstructor = require('../internals/species-constructor');
|
19488 | var advanceStringIndex = require('../internals/advance-string-index');
|
19489 | var toLength = require('../internals/to-length');
|
19490 | var callRegExpExec = require('../internals/regexp-exec-abstract');
|
19491 | var regexpExec = require('../internals/regexp-exec');
|
19492 | var fails = require('../internals/fails');
|
19493 |
|
19494 | var arrayPush = [].push;
|
19495 | var min = Math.min;
|
19496 | var MAX_UINT32 = 0xFFFFFFFF;
|
19497 |
|
19498 |
|
19499 | var SUPPORTS_Y = !fails(function () { return !RegExp(MAX_UINT32, 'y'); });
|
19500 |
|
19501 |
|
19502 | fixRegExpWellKnownSymbolLogic('split', 2, function (SPLIT, nativeSplit, maybeCallNative) {
|
19503 | var internalSplit;
|
19504 | if (
|
19505 | 'abbc'.split(/(b)*/)[1] == 'c' ||
|
19506 | 'test'.split(/(?:)/, -1).length != 4 ||
|
19507 | 'ab'.split(/(?:ab)*/).length != 2 ||
|
19508 | '.'.split(/(.?)(.?)/).length != 4 ||
|
19509 | '.'.split(/()()/).length > 1 ||
|
19510 | ''.split(/.?/).length
|
19511 | ) {
|
19512 |
|
19513 | internalSplit = function (separator, limit) {
|
19514 | var string = String(requireObjectCoercible(this));
|
19515 | var lim = limit === undefined ? MAX_UINT32 : limit >>> 0;
|
19516 | if (lim === 0) return [];
|
19517 | if (separator === undefined) return [string];
|
19518 |
|
19519 | if (!isRegExp(separator)) {
|
19520 | return nativeSplit.call(string, separator, lim);
|
19521 | }
|
19522 | var output = [];
|
19523 | var flags = (separator.ignoreCase ? 'i' : '') +
|
19524 | (separator.multiline ? 'm' : '') +
|
19525 | (separator.unicode ? 'u' : '') +
|
19526 | (separator.sticky ? 'y' : '');
|
19527 | var lastLastIndex = 0;
|
19528 |
|
19529 | var separatorCopy = new RegExp(separator.source, flags + 'g');
|
19530 | var match, lastIndex, lastLength;
|
19531 | while (match = regexpExec.call(separatorCopy, string)) {
|
19532 | lastIndex = separatorCopy.lastIndex;
|
19533 | if (lastIndex > lastLastIndex) {
|
19534 | output.push(string.slice(lastLastIndex, match.index));
|
19535 | if (match.length > 1 && match.index < string.length) arrayPush.apply(output, match.slice(1));
|
19536 | lastLength = match[0].length;
|
19537 | lastLastIndex = lastIndex;
|
19538 | if (output.length >= lim) break;
|
19539 | }
|
19540 | if (separatorCopy.lastIndex === match.index) separatorCopy.lastIndex++;
|
19541 | }
|
19542 | if (lastLastIndex === string.length) {
|
19543 | if (lastLength || !separatorCopy.test('')) output.push('');
|
19544 | } else output.push(string.slice(lastLastIndex));
|
19545 | return output.length > lim ? output.slice(0, lim) : output;
|
19546 | };
|
19547 |
|
19548 | } else if ('0'.split(undefined, 0).length) {
|
19549 | internalSplit = function (separator, limit) {
|
19550 | return separator === undefined && limit === 0 ? [] : nativeSplit.call(this, separator, limit);
|
19551 | };
|
19552 | } else internalSplit = nativeSplit;
|
19553 |
|
19554 | return [
|
19555 |
|
19556 |
|
19557 | function split(separator, limit) {
|
19558 | var O = requireObjectCoercible(this);
|
19559 | var splitter = separator == undefined ? undefined : separator[SPLIT];
|
19560 | return splitter !== undefined
|
19561 | ? splitter.call(separator, O, limit)
|
19562 | : internalSplit.call(String(O), separator, limit);
|
19563 | },
|
19564 |
|
19565 |
|
19566 |
|
19567 |
|
19568 |
|
19569 | function (regexp, limit) {
|
19570 | var res = maybeCallNative(internalSplit, regexp, this, limit, internalSplit !== nativeSplit);
|
19571 | if (res.done) return res.value;
|
19572 |
|
19573 | var rx = anObject(regexp);
|
19574 | var S = String(this);
|
19575 | var C = speciesConstructor(rx, RegExp);
|
19576 |
|
19577 | var unicodeMatching = rx.unicode;
|
19578 | var flags = (rx.ignoreCase ? 'i' : '') +
|
19579 | (rx.multiline ? 'm' : '') +
|
19580 | (rx.unicode ? 'u' : '') +
|
19581 | (SUPPORTS_Y ? 'y' : 'g');
|
19582 |
|
19583 |
|
19584 |
|
19585 | var splitter = new C(SUPPORTS_Y ? rx : '^(?:' + rx.source + ')', flags);
|
19586 | var lim = limit === undefined ? MAX_UINT32 : limit >>> 0;
|
19587 | if (lim === 0) return [];
|
19588 | if (S.length === 0) return callRegExpExec(splitter, S) === null ? [S] : [];
|
19589 | var p = 0;
|
19590 | var q = 0;
|
19591 | var A = [];
|
19592 | while (q < S.length) {
|
19593 | splitter.lastIndex = SUPPORTS_Y ? q : 0;
|
19594 | var z = callRegExpExec(splitter, SUPPORTS_Y ? S : S.slice(q));
|
19595 | var e;
|
19596 | if (
|
19597 | z === null ||
|
19598 | (e = min(toLength(splitter.lastIndex + (SUPPORTS_Y ? 0 : q)), S.length)) === p
|
19599 | ) {
|
19600 | q = advanceStringIndex(S, q, unicodeMatching);
|
19601 | } else {
|
19602 | A.push(S.slice(p, q));
|
19603 | if (A.length === lim) return A;
|
19604 | for (var i = 1; i <= z.length - 1; i++) {
|
19605 | A.push(z[i]);
|
19606 | if (A.length === lim) return A;
|
19607 | }
|
19608 | q = p = e;
|
19609 | }
|
19610 | }
|
19611 | A.push(S.slice(p));
|
19612 | return A;
|
19613 | }
|
19614 | ];
|
19615 | }, !SUPPORTS_Y);
|
19616 |
|
19617 | },{"../internals/advance-string-index":105,"../internals/an-object":107,"../internals/fails":145,"../internals/fix-regexp-well-known-symbol-logic":146,"../internals/is-regexp":166,"../internals/regexp-exec":199,"../internals/regexp-exec-abstract":198,"../internals/require-object-coercible":202,"../internals/species-constructor":210,"../internals/to-length":219}],264:[function(require,module,exports){
|
19618 | 'use strict';
|
19619 | var $ = require('../internals/export');
|
19620 | var getOwnPropertyDescriptor = require('../internals/object-get-own-property-descriptor').f;
|
19621 | var toLength = require('../internals/to-length');
|
19622 | var notARegExp = require('../internals/not-a-regexp');
|
19623 | var requireObjectCoercible = require('../internals/require-object-coercible');
|
19624 | var correctIsRegExpLogic = require('../internals/correct-is-regexp-logic');
|
19625 | var IS_PURE = require('../internals/is-pure');
|
19626 |
|
19627 | var nativeStartsWith = ''.startsWith;
|
19628 | var min = Math.min;
|
19629 |
|
19630 | var CORRECT_IS_REGEXP_LOGIC = correctIsRegExpLogic('startsWith');
|
19631 |
|
19632 | var MDN_POLYFILL_BUG = !IS_PURE && !CORRECT_IS_REGEXP_LOGIC && !!function () {
|
19633 | var descriptor = getOwnPropertyDescriptor(String.prototype, 'startsWith');
|
19634 | return descriptor && !descriptor.writable;
|
19635 | }();
|
19636 |
|
19637 |
|
19638 |
|
19639 | $({ target: 'String', proto: true, forced: !MDN_POLYFILL_BUG && !CORRECT_IS_REGEXP_LOGIC }, {
|
19640 | startsWith: function startsWith(searchString /* , position = 0 */) {
|
19641 | var that = String(requireObjectCoercible(this));
|
19642 | notARegExp(searchString);
|
19643 | var index = toLength(min(arguments.length > 1 ? arguments[1] : undefined, that.length));
|
19644 | var search = String(searchString);
|
19645 | return nativeStartsWith
|
19646 | ? nativeStartsWith.call(that, search, index)
|
19647 | : that.slice(index, index + search.length) === search;
|
19648 | }
|
19649 | });
|
19650 |
|
19651 | },{"../internals/correct-is-regexp-logic":128,"../internals/export":144,"../internals/is-pure":165,"../internals/not-a-regexp":176,"../internals/object-get-own-property-descriptor":181,"../internals/require-object-coercible":202,"../internals/to-length":219}],265:[function(require,module,exports){
|
19652 | 'use strict';
|
19653 | var $ = require('../internals/export');
|
19654 | var $trim = require('../internals/string-trim').trim;
|
19655 | var forcedStringTrimMethod = require('../internals/string-trim-forced');
|
19656 |
|
19657 |
|
19658 |
|
19659 | $({ target: 'String', proto: true, forced: forcedStringTrimMethod('trim') }, {
|
19660 | trim: function trim() {
|
19661 | return $trim(this);
|
19662 | }
|
19663 | });
|
19664 |
|
19665 | },{"../internals/export":144,"../internals/string-trim":213,"../internals/string-trim-forced":212}],266:[function(require,module,exports){
|
19666 |
|
19667 |
|
19668 | 'use strict';
|
19669 | var $ = require('../internals/export');
|
19670 | var DESCRIPTORS = require('../internals/descriptors');
|
19671 | var global = require('../internals/global');
|
19672 | var has = require('../internals/has');
|
19673 | var isObject = require('../internals/is-object');
|
19674 | var defineProperty = require('../internals/object-define-property').f;
|
19675 | var copyConstructorProperties = require('../internals/copy-constructor-properties');
|
19676 |
|
19677 | var NativeSymbol = global.Symbol;
|
19678 |
|
19679 | if (DESCRIPTORS && typeof NativeSymbol == 'function' && (!('description' in NativeSymbol.prototype) ||
|
19680 |
|
19681 | NativeSymbol().description !== undefined
|
19682 | )) {
|
19683 | var EmptyStringDescriptionStore = {};
|
19684 |
|
19685 | var SymbolWrapper = function Symbol() {
|
19686 | var description = arguments.length < 1 || arguments[0] === undefined ? undefined : String(arguments[0]);
|
19687 | var result = this instanceof SymbolWrapper
|
19688 | ? new NativeSymbol(description)
|
19689 |
|
19690 | : description === undefined ? NativeSymbol() : NativeSymbol(description);
|
19691 | if (description === '') EmptyStringDescriptionStore[result] = true;
|
19692 | return result;
|
19693 | };
|
19694 | copyConstructorProperties(SymbolWrapper, NativeSymbol);
|
19695 | var symbolPrototype = SymbolWrapper.prototype = NativeSymbol.prototype;
|
19696 | symbolPrototype.constructor = SymbolWrapper;
|
19697 |
|
19698 | var symbolToString = symbolPrototype.toString;
|
19699 | var native = String(NativeSymbol('test')) == 'Symbol(test)';
|
19700 | var regexp = /^Symbol\((.*)\)[^)]+$/;
|
19701 | defineProperty(symbolPrototype, 'description', {
|
19702 | configurable: true,
|
19703 | get: function description() {
|
19704 | var symbol = isObject(this) ? this.valueOf() : this;
|
19705 | var string = symbolToString.call(symbol);
|
19706 | if (has(EmptyStringDescriptionStore, symbol)) return '';
|
19707 | var desc = native ? string.slice(7, -1) : string.replace(regexp, '$1');
|
19708 | return desc === '' ? undefined : desc;
|
19709 | }
|
19710 | });
|
19711 |
|
19712 | $({ global: true, forced: true }, {
|
19713 | Symbol: SymbolWrapper
|
19714 | });
|
19715 | }
|
19716 |
|
19717 | },{"../internals/copy-constructor-properties":127,"../internals/descriptors":136,"../internals/export":144,"../internals/global":150,"../internals/has":151,"../internals/is-object":164,"../internals/object-define-property":180}],267:[function(require,module,exports){
|
19718 | 'use strict';
|
19719 | var $ = require('../internals/export');
|
19720 | var global = require('../internals/global');
|
19721 | var getBuiltIn = require('../internals/get-built-in');
|
19722 | var IS_PURE = require('../internals/is-pure');
|
19723 | var DESCRIPTORS = require('../internals/descriptors');
|
19724 | var NATIVE_SYMBOL = require('../internals/native-symbol');
|
19725 | var USE_SYMBOL_AS_UID = require('../internals/use-symbol-as-uid');
|
19726 | var fails = require('../internals/fails');
|
19727 | var has = require('../internals/has');
|
19728 | var isArray = require('../internals/is-array');
|
19729 | var isObject = require('../internals/is-object');
|
19730 | var anObject = require('../internals/an-object');
|
19731 | var toObject = require('../internals/to-object');
|
19732 | var toIndexedObject = require('../internals/to-indexed-object');
|
19733 | var toPrimitive = require('../internals/to-primitive');
|
19734 | var createPropertyDescriptor = require('../internals/create-property-descriptor');
|
19735 | var nativeObjectCreate = require('../internals/object-create');
|
19736 | var objectKeys = require('../internals/object-keys');
|
19737 | var getOwnPropertyNamesModule = require('../internals/object-get-own-property-names');
|
19738 | var getOwnPropertyNamesExternal = require('../internals/object-get-own-property-names-external');
|
19739 | var getOwnPropertySymbolsModule = require('../internals/object-get-own-property-symbols');
|
19740 | var getOwnPropertyDescriptorModule = require('../internals/object-get-own-property-descriptor');
|
19741 | var definePropertyModule = require('../internals/object-define-property');
|
19742 | var propertyIsEnumerableModule = require('../internals/object-property-is-enumerable');
|
19743 | var createNonEnumerableProperty = require('../internals/create-non-enumerable-property');
|
19744 | var redefine = require('../internals/redefine');
|
19745 | var shared = require('../internals/shared');
|
19746 | var sharedKey = require('../internals/shared-key');
|
19747 | var hiddenKeys = require('../internals/hidden-keys');
|
19748 | var uid = require('../internals/uid');
|
19749 | var wellKnownSymbol = require('../internals/well-known-symbol');
|
19750 | var wrappedWellKnownSymbolModule = require('../internals/well-known-symbol-wrapped');
|
19751 | var defineWellKnownSymbol = require('../internals/define-well-known-symbol');
|
19752 | var setToStringTag = require('../internals/set-to-string-tag');
|
19753 | var InternalStateModule = require('../internals/internal-state');
|
19754 | var $forEach = require('../internals/array-iteration').forEach;
|
19755 |
|
19756 | var HIDDEN = sharedKey('hidden');
|
19757 | var SYMBOL = 'Symbol';
|
19758 | var PROTOTYPE = 'prototype';
|
19759 | var TO_PRIMITIVE = wellKnownSymbol('toPrimitive');
|
19760 | var setInternalState = InternalStateModule.set;
|
19761 | var getInternalState = InternalStateModule.getterFor(SYMBOL);
|
19762 | var ObjectPrototype = Object[PROTOTYPE];
|
19763 | var $Symbol = global.Symbol;
|
19764 | var $stringify = getBuiltIn('JSON', 'stringify');
|
19765 | var nativeGetOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
|
19766 | var nativeDefineProperty = definePropertyModule.f;
|
19767 | var nativeGetOwnPropertyNames = getOwnPropertyNamesExternal.f;
|
19768 | var nativePropertyIsEnumerable = propertyIsEnumerableModule.f;
|
19769 | var AllSymbols = shared('symbols');
|
19770 | var ObjectPrototypeSymbols = shared('op-symbols');
|
19771 | var StringToSymbolRegistry = shared('string-to-symbol-registry');
|
19772 | var SymbolToStringRegistry = shared('symbol-to-string-registry');
|
19773 | var WellKnownSymbolsStore = shared('wks');
|
19774 | var QObject = global.QObject;
|
19775 |
|
19776 | var USE_SETTER = !QObject || !QObject[PROTOTYPE] || !QObject[PROTOTYPE].findChild;
|
19777 |
|
19778 |
|
19779 | var setSymbolDescriptor = DESCRIPTORS && fails(function () {
|
19780 | return nativeObjectCreate(nativeDefineProperty({}, 'a', {
|
19781 | get: function () { return nativeDefineProperty(this, 'a', { value: 7 }).a; }
|
19782 | })).a != 7;
|
19783 | }) ? function (O, P, Attributes) {
|
19784 | var ObjectPrototypeDescriptor = nativeGetOwnPropertyDescriptor(ObjectPrototype, P);
|
19785 | if (ObjectPrototypeDescriptor) delete ObjectPrototype[P];
|
19786 | nativeDefineProperty(O, P, Attributes);
|
19787 | if (ObjectPrototypeDescriptor && O !== ObjectPrototype) {
|
19788 | nativeDefineProperty(ObjectPrototype, P, ObjectPrototypeDescriptor);
|
19789 | }
|
19790 | } : nativeDefineProperty;
|
19791 |
|
19792 | var wrap = function (tag, description) {
|
19793 | var symbol = AllSymbols[tag] = nativeObjectCreate($Symbol[PROTOTYPE]);
|
19794 | setInternalState(symbol, {
|
19795 | type: SYMBOL,
|
19796 | tag: tag,
|
19797 | description: description
|
19798 | });
|
19799 | if (!DESCRIPTORS) symbol.description = description;
|
19800 | return symbol;
|
19801 | };
|
19802 |
|
19803 | var isSymbol = USE_SYMBOL_AS_UID ? function (it) {
|
19804 | return typeof it == 'symbol';
|
19805 | } : function (it) {
|
19806 | return Object(it) instanceof $Symbol;
|
19807 | };
|
19808 |
|
19809 | var $defineProperty = function defineProperty(O, P, Attributes) {
|
19810 | if (O === ObjectPrototype) $defineProperty(ObjectPrototypeSymbols, P, Attributes);
|
19811 | anObject(O);
|
19812 | var key = toPrimitive(P, true);
|
19813 | anObject(Attributes);
|
19814 | if (has(AllSymbols, key)) {
|
19815 | if (!Attributes.enumerable) {
|
19816 | if (!has(O, HIDDEN)) nativeDefineProperty(O, HIDDEN, createPropertyDescriptor(1, {}));
|
19817 | O[HIDDEN][key] = true;
|
19818 | } else {
|
19819 | if (has(O, HIDDEN) && O[HIDDEN][key]) O[HIDDEN][key] = false;
|
19820 | Attributes = nativeObjectCreate(Attributes, { enumerable: createPropertyDescriptor(0, false) });
|
19821 | } return setSymbolDescriptor(O, key, Attributes);
|
19822 | } return nativeDefineProperty(O, key, Attributes);
|
19823 | };
|
19824 |
|
19825 | var $defineProperties = function defineProperties(O, Properties) {
|
19826 | anObject(O);
|
19827 | var properties = toIndexedObject(Properties);
|
19828 | var keys = objectKeys(properties).concat($getOwnPropertySymbols(properties));
|
19829 | $forEach(keys, function (key) {
|
19830 | if (!DESCRIPTORS || $propertyIsEnumerable.call(properties, key)) $defineProperty(O, key, properties[key]);
|
19831 | });
|
19832 | return O;
|
19833 | };
|
19834 |
|
19835 | var $create = function create(O, Properties) {
|
19836 | return Properties === undefined ? nativeObjectCreate(O) : $defineProperties(nativeObjectCreate(O), Properties);
|
19837 | };
|
19838 |
|
19839 | var $propertyIsEnumerable = function propertyIsEnumerable(V) {
|
19840 | var P = toPrimitive(V, true);
|
19841 | var enumerable = nativePropertyIsEnumerable.call(this, P);
|
19842 | if (this === ObjectPrototype && has(AllSymbols, P) && !has(ObjectPrototypeSymbols, P)) return false;
|
19843 | return enumerable || !has(this, P) || !has(AllSymbols, P) || has(this, HIDDEN) && this[HIDDEN][P] ? enumerable : true;
|
19844 | };
|
19845 |
|
19846 | var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(O, P) {
|
19847 | var it = toIndexedObject(O);
|
19848 | var key = toPrimitive(P, true);
|
19849 | if (it === ObjectPrototype && has(AllSymbols, key) && !has(ObjectPrototypeSymbols, key)) return;
|
19850 | var descriptor = nativeGetOwnPropertyDescriptor(it, key);
|
19851 | if (descriptor && has(AllSymbols, key) && !(has(it, HIDDEN) && it[HIDDEN][key])) {
|
19852 | descriptor.enumerable = true;
|
19853 | }
|
19854 | return descriptor;
|
19855 | };
|
19856 |
|
19857 | var $getOwnPropertyNames = function getOwnPropertyNames(O) {
|
19858 | var names = nativeGetOwnPropertyNames(toIndexedObject(O));
|
19859 | var result = [];
|
19860 | $forEach(names, function (key) {
|
19861 | if (!has(AllSymbols, key) && !has(hiddenKeys, key)) result.push(key);
|
19862 | });
|
19863 | return result;
|
19864 | };
|
19865 |
|
19866 | var $getOwnPropertySymbols = function getOwnPropertySymbols(O) {
|
19867 | var IS_OBJECT_PROTOTYPE = O === ObjectPrototype;
|
19868 | var names = nativeGetOwnPropertyNames(IS_OBJECT_PROTOTYPE ? ObjectPrototypeSymbols : toIndexedObject(O));
|
19869 | var result = [];
|
19870 | $forEach(names, function (key) {
|
19871 | if (has(AllSymbols, key) && (!IS_OBJECT_PROTOTYPE || has(ObjectPrototype, key))) {
|
19872 | result.push(AllSymbols[key]);
|
19873 | }
|
19874 | });
|
19875 | return result;
|
19876 | };
|
19877 |
|
19878 |
|
19879 |
|
19880 | if (!NATIVE_SYMBOL) {
|
19881 | $Symbol = function Symbol() {
|
19882 | if (this instanceof $Symbol) throw TypeError('Symbol is not a constructor');
|
19883 | var description = !arguments.length || arguments[0] === undefined ? undefined : String(arguments[0]);
|
19884 | var tag = uid(description);
|
19885 | var setter = function (value) {
|
19886 | if (this === ObjectPrototype) setter.call(ObjectPrototypeSymbols, value);
|
19887 | if (has(this, HIDDEN) && has(this[HIDDEN], tag)) this[HIDDEN][tag] = false;
|
19888 | setSymbolDescriptor(this, tag, createPropertyDescriptor(1, value));
|
19889 | };
|
19890 | if (DESCRIPTORS && USE_SETTER) setSymbolDescriptor(ObjectPrototype, tag, { configurable: true, set: setter });
|
19891 | return wrap(tag, description);
|
19892 | };
|
19893 |
|
19894 | redefine($Symbol[PROTOTYPE], 'toString', function toString() {
|
19895 | return getInternalState(this).tag;
|
19896 | });
|
19897 |
|
19898 | redefine($Symbol, 'withoutSetter', function (description) {
|
19899 | return wrap(uid(description), description);
|
19900 | });
|
19901 |
|
19902 | propertyIsEnumerableModule.f = $propertyIsEnumerable;
|
19903 | definePropertyModule.f = $defineProperty;
|
19904 | getOwnPropertyDescriptorModule.f = $getOwnPropertyDescriptor;
|
19905 | getOwnPropertyNamesModule.f = getOwnPropertyNamesExternal.f = $getOwnPropertyNames;
|
19906 | getOwnPropertySymbolsModule.f = $getOwnPropertySymbols;
|
19907 |
|
19908 | wrappedWellKnownSymbolModule.f = function (name) {
|
19909 | return wrap(wellKnownSymbol(name), name);
|
19910 | };
|
19911 |
|
19912 | if (DESCRIPTORS) {
|
19913 |
|
19914 | nativeDefineProperty($Symbol[PROTOTYPE], 'description', {
|
19915 | configurable: true,
|
19916 | get: function description() {
|
19917 | return getInternalState(this).description;
|
19918 | }
|
19919 | });
|
19920 | if (!IS_PURE) {
|
19921 | redefine(ObjectPrototype, 'propertyIsEnumerable', $propertyIsEnumerable, { unsafe: true });
|
19922 | }
|
19923 | }
|
19924 | }
|
19925 |
|
19926 | $({ global: true, wrap: true, forced: !NATIVE_SYMBOL, sham: !NATIVE_SYMBOL }, {
|
19927 | Symbol: $Symbol
|
19928 | });
|
19929 |
|
19930 | $forEach(objectKeys(WellKnownSymbolsStore), function (name) {
|
19931 | defineWellKnownSymbol(name);
|
19932 | });
|
19933 |
|
19934 | $({ target: SYMBOL, stat: true, forced: !NATIVE_SYMBOL }, {
|
19935 |
|
19936 |
|
19937 | 'for': function (key) {
|
19938 | var string = String(key);
|
19939 | if (has(StringToSymbolRegistry, string)) return StringToSymbolRegistry[string];
|
19940 | var symbol = $Symbol(string);
|
19941 | StringToSymbolRegistry[string] = symbol;
|
19942 | SymbolToStringRegistry[symbol] = string;
|
19943 | return symbol;
|
19944 | },
|
19945 |
|
19946 |
|
19947 | keyFor: function keyFor(sym) {
|
19948 | if (!isSymbol(sym)) throw TypeError(sym + ' is not a symbol');
|
19949 | if (has(SymbolToStringRegistry, sym)) return SymbolToStringRegistry[sym];
|
19950 | },
|
19951 | useSetter: function () { USE_SETTER = true; },
|
19952 | useSimple: function () { USE_SETTER = false; }
|
19953 | });
|
19954 |
|
19955 | $({ target: 'Object', stat: true, forced: !NATIVE_SYMBOL, sham: !DESCRIPTORS }, {
|
19956 |
|
19957 |
|
19958 | create: $create,
|
19959 |
|
19960 |
|
19961 | defineProperty: $defineProperty,
|
19962 |
|
19963 |
|
19964 | defineProperties: $defineProperties,
|
19965 |
|
19966 |
|
19967 | getOwnPropertyDescriptor: $getOwnPropertyDescriptor
|
19968 | });
|
19969 |
|
19970 | $({ target: 'Object', stat: true, forced: !NATIVE_SYMBOL }, {
|
19971 |
|
19972 |
|
19973 | getOwnPropertyNames: $getOwnPropertyNames,
|
19974 |
|
19975 |
|
19976 | getOwnPropertySymbols: $getOwnPropertySymbols
|
19977 | });
|
19978 |
|
19979 |
|
19980 |
|
19981 | $({ target: 'Object', stat: true, forced: fails(function () { getOwnPropertySymbolsModule.f(1); }) }, {
|
19982 | getOwnPropertySymbols: function getOwnPropertySymbols(it) {
|
19983 | return getOwnPropertySymbolsModule.f(toObject(it));
|
19984 | }
|
19985 | });
|
19986 |
|
19987 |
|
19988 |
|
19989 | if ($stringify) {
|
19990 | var FORCED_JSON_STRINGIFY = !NATIVE_SYMBOL || fails(function () {
|
19991 | var symbol = $Symbol();
|
19992 |
|
19993 | return $stringify([symbol]) != '[null]'
|
19994 |
|
19995 | || $stringify({ a: symbol }) != '{}'
|
19996 |
|
19997 | || $stringify(Object(symbol)) != '{}';
|
19998 | });
|
19999 |
|
20000 | $({ target: 'JSON', stat: true, forced: FORCED_JSON_STRINGIFY }, {
|
20001 |
|
20002 | stringify: function stringify(it, replacer, space) {
|
20003 | var args = [it];
|
20004 | var index = 1;
|
20005 | var $replacer;
|
20006 | while (arguments.length > index) args.push(arguments[index++]);
|
20007 | $replacer = replacer;
|
20008 | if (!isObject(replacer) && it === undefined || isSymbol(it)) return;
|
20009 | if (!isArray(replacer)) replacer = function (key, value) {
|
20010 | if (typeof $replacer == 'function') value = $replacer.call(this, key, value);
|
20011 | if (!isSymbol(value)) return value;
|
20012 | };
|
20013 | args[1] = replacer;
|
20014 | return $stringify.apply(null, args);
|
20015 | }
|
20016 | });
|
20017 | }
|
20018 |
|
20019 |
|
20020 |
|
20021 | if (!$Symbol[PROTOTYPE][TO_PRIMITIVE]) {
|
20022 | createNonEnumerableProperty($Symbol[PROTOTYPE], TO_PRIMITIVE, $Symbol[PROTOTYPE].valueOf);
|
20023 | }
|
20024 |
|
20025 |
|
20026 | setToStringTag($Symbol, SYMBOL);
|
20027 |
|
20028 | hiddenKeys[HIDDEN] = true;
|
20029 |
|
20030 | },{"../internals/an-object":107,"../internals/array-iteration":116,"../internals/create-non-enumerable-property":131,"../internals/create-property-descriptor":132,"../internals/define-well-known-symbol":135,"../internals/descriptors":136,"../internals/export":144,"../internals/fails":145,"../internals/get-built-in":148,"../internals/global":150,"../internals/has":151,"../internals/hidden-keys":152,"../internals/internal-state":160,"../internals/is-array":162,"../internals/is-object":164,"../internals/is-pure":165,"../internals/native-symbol":173,"../internals/object-create":178,"../internals/object-define-property":180,"../internals/object-get-own-property-descriptor":181,"../internals/object-get-own-property-names":183,"../internals/object-get-own-property-names-external":182,"../internals/object-get-own-property-symbols":184,"../internals/object-keys":187,"../internals/object-property-is-enumerable":188,"../internals/redefine":197,"../internals/set-to-string-tag":206,"../internals/shared":209,"../internals/shared-key":207,"../internals/to-indexed-object":217,"../internals/to-object":220,"../internals/to-primitive":223,"../internals/uid":228,"../internals/use-symbol-as-uid":229,"../internals/well-known-symbol":231,"../internals/well-known-symbol-wrapped":230}],268:[function(require,module,exports){
|
20031 | 'use strict';
|
20032 | var ArrayBufferViewCore = require('../internals/array-buffer-view-core');
|
20033 | var $copyWithin = require('../internals/array-copy-within');
|
20034 |
|
20035 | var aTypedArray = ArrayBufferViewCore.aTypedArray;
|
20036 | var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
|
20037 |
|
20038 |
|
20039 |
|
20040 | exportTypedArrayMethod('copyWithin', function copyWithin(target, start /* , end */) {
|
20041 | return $copyWithin.call(aTypedArray(this), target, start, arguments.length > 2 ? arguments[2] : undefined);
|
20042 | });
|
20043 |
|
20044 | },{"../internals/array-buffer-view-core":109,"../internals/array-copy-within":111}],269:[function(require,module,exports){
|
20045 | 'use strict';
|
20046 | var ArrayBufferViewCore = require('../internals/array-buffer-view-core');
|
20047 | var $every = require('../internals/array-iteration').every;
|
20048 |
|
20049 | var aTypedArray = ArrayBufferViewCore.aTypedArray;
|
20050 | var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
|
20051 |
|
20052 |
|
20053 |
|
20054 | exportTypedArrayMethod('every', function every(callbackfn /* , thisArg */) {
|
20055 | return $every(aTypedArray(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined);
|
20056 | });
|
20057 |
|
20058 | },{"../internals/array-buffer-view-core":109,"../internals/array-iteration":116}],270:[function(require,module,exports){
|
20059 | 'use strict';
|
20060 | var ArrayBufferViewCore = require('../internals/array-buffer-view-core');
|
20061 | var $fill = require('../internals/array-fill');
|
20062 |
|
20063 | var aTypedArray = ArrayBufferViewCore.aTypedArray;
|
20064 | var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
|
20065 |
|
20066 |
|
20067 |
|
20068 |
|
20069 | exportTypedArrayMethod('fill', function fill(value /* , start, end */) {
|
20070 | return $fill.apply(aTypedArray(this), arguments);
|
20071 | });
|
20072 |
|
20073 | },{"../internals/array-buffer-view-core":109,"../internals/array-fill":112}],271:[function(require,module,exports){
|
20074 | 'use strict';
|
20075 | var ArrayBufferViewCore = require('../internals/array-buffer-view-core');
|
20076 | var $filter = require('../internals/array-iteration').filter;
|
20077 | var speciesConstructor = require('../internals/species-constructor');
|
20078 |
|
20079 | var aTypedArray = ArrayBufferViewCore.aTypedArray;
|
20080 | var aTypedArrayConstructor = ArrayBufferViewCore.aTypedArrayConstructor;
|
20081 | var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
|
20082 |
|
20083 |
|
20084 |
|
20085 | exportTypedArrayMethod('filter', function filter(callbackfn /* , thisArg */) {
|
20086 | var list = $filter(aTypedArray(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined);
|
20087 | var C = speciesConstructor(this, this.constructor);
|
20088 | var index = 0;
|
20089 | var length = list.length;
|
20090 | var result = new (aTypedArrayConstructor(C))(length);
|
20091 | while (length > index) result[index] = list[index++];
|
20092 | return result;
|
20093 | });
|
20094 |
|
20095 | },{"../internals/array-buffer-view-core":109,"../internals/array-iteration":116,"../internals/species-constructor":210}],272:[function(require,module,exports){
|
20096 | 'use strict';
|
20097 | var ArrayBufferViewCore = require('../internals/array-buffer-view-core');
|
20098 | var $findIndex = require('../internals/array-iteration').findIndex;
|
20099 |
|
20100 | var aTypedArray = ArrayBufferViewCore.aTypedArray;
|
20101 | var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
|
20102 |
|
20103 |
|
20104 |
|
20105 | exportTypedArrayMethod('findIndex', function findIndex(predicate /* , thisArg */) {
|
20106 | return $findIndex(aTypedArray(this), predicate, arguments.length > 1 ? arguments[1] : undefined);
|
20107 | });
|
20108 |
|
20109 | },{"../internals/array-buffer-view-core":109,"../internals/array-iteration":116}],273:[function(require,module,exports){
|
20110 | 'use strict';
|
20111 | var ArrayBufferViewCore = require('../internals/array-buffer-view-core');
|
20112 | var $find = require('../internals/array-iteration').find;
|
20113 |
|
20114 | var aTypedArray = ArrayBufferViewCore.aTypedArray;
|
20115 | var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
|
20116 |
|
20117 |
|
20118 |
|
20119 | exportTypedArrayMethod('find', function find(predicate /* , thisArg */) {
|
20120 | return $find(aTypedArray(this), predicate, arguments.length > 1 ? arguments[1] : undefined);
|
20121 | });
|
20122 |
|
20123 | },{"../internals/array-buffer-view-core":109,"../internals/array-iteration":116}],274:[function(require,module,exports){
|
20124 | 'use strict';
|
20125 | var ArrayBufferViewCore = require('../internals/array-buffer-view-core');
|
20126 | var $forEach = require('../internals/array-iteration').forEach;
|
20127 |
|
20128 | var aTypedArray = ArrayBufferViewCore.aTypedArray;
|
20129 | var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
|
20130 |
|
20131 |
|
20132 |
|
20133 | exportTypedArrayMethod('forEach', function forEach(callbackfn /* , thisArg */) {
|
20134 | $forEach(aTypedArray(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined);
|
20135 | });
|
20136 |
|
20137 | },{"../internals/array-buffer-view-core":109,"../internals/array-iteration":116}],275:[function(require,module,exports){
|
20138 | 'use strict';
|
20139 | var ArrayBufferViewCore = require('../internals/array-buffer-view-core');
|
20140 | var $includes = require('../internals/array-includes').includes;
|
20141 |
|
20142 | var aTypedArray = ArrayBufferViewCore.aTypedArray;
|
20143 | var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
|
20144 |
|
20145 |
|
20146 |
|
20147 | exportTypedArrayMethod('includes', function includes(searchElement /* , fromIndex */) {
|
20148 | return $includes(aTypedArray(this), searchElement, arguments.length > 1 ? arguments[1] : undefined);
|
20149 | });
|
20150 |
|
20151 | },{"../internals/array-buffer-view-core":109,"../internals/array-includes":115}],276:[function(require,module,exports){
|
20152 | 'use strict';
|
20153 | var ArrayBufferViewCore = require('../internals/array-buffer-view-core');
|
20154 | var $indexOf = require('../internals/array-includes').indexOf;
|
20155 |
|
20156 | var aTypedArray = ArrayBufferViewCore.aTypedArray;
|
20157 | var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
|
20158 |
|
20159 |
|
20160 |
|
20161 | exportTypedArrayMethod('indexOf', function indexOf(searchElement /* , fromIndex */) {
|
20162 | return $indexOf(aTypedArray(this), searchElement, arguments.length > 1 ? arguments[1] : undefined);
|
20163 | });
|
20164 |
|
20165 | },{"../internals/array-buffer-view-core":109,"../internals/array-includes":115}],277:[function(require,module,exports){
|
20166 | 'use strict';
|
20167 | var global = require('../internals/global');
|
20168 | var ArrayBufferViewCore = require('../internals/array-buffer-view-core');
|
20169 | var ArrayIterators = require('../modules/es.array.iterator');
|
20170 | var wellKnownSymbol = require('../internals/well-known-symbol');
|
20171 |
|
20172 | var ITERATOR = wellKnownSymbol('iterator');
|
20173 | var Uint8Array = global.Uint8Array;
|
20174 | var arrayValues = ArrayIterators.values;
|
20175 | var arrayKeys = ArrayIterators.keys;
|
20176 | var arrayEntries = ArrayIterators.entries;
|
20177 | var aTypedArray = ArrayBufferViewCore.aTypedArray;
|
20178 | var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
|
20179 | var nativeTypedArrayIterator = Uint8Array && Uint8Array.prototype[ITERATOR];
|
20180 |
|
20181 | var CORRECT_ITER_NAME = !!nativeTypedArrayIterator
|
20182 | && (nativeTypedArrayIterator.name == 'values' || nativeTypedArrayIterator.name == undefined);
|
20183 |
|
20184 | var typedArrayValues = function values() {
|
20185 | return arrayValues.call(aTypedArray(this));
|
20186 | };
|
20187 |
|
20188 |
|
20189 |
|
20190 | exportTypedArrayMethod('entries', function entries() {
|
20191 | return arrayEntries.call(aTypedArray(this));
|
20192 | });
|
20193 |
|
20194 |
|
20195 | exportTypedArrayMethod('keys', function keys() {
|
20196 | return arrayKeys.call(aTypedArray(this));
|
20197 | });
|
20198 |
|
20199 |
|
20200 | exportTypedArrayMethod('values', typedArrayValues, !CORRECT_ITER_NAME);
|
20201 |
|
20202 |
|
20203 | exportTypedArrayMethod(ITERATOR, typedArrayValues, !CORRECT_ITER_NAME);
|
20204 |
|
20205 | },{"../internals/array-buffer-view-core":109,"../internals/global":150,"../internals/well-known-symbol":231,"../modules/es.array.iterator":242}],278:[function(require,module,exports){
|
20206 | 'use strict';
|
20207 | var ArrayBufferViewCore = require('../internals/array-buffer-view-core');
|
20208 |
|
20209 | var aTypedArray = ArrayBufferViewCore.aTypedArray;
|
20210 | var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
|
20211 | var $join = [].join;
|
20212 |
|
20213 |
|
20214 |
|
20215 |
|
20216 | exportTypedArrayMethod('join', function join(separator) {
|
20217 | return $join.apply(aTypedArray(this), arguments);
|
20218 | });
|
20219 |
|
20220 | },{"../internals/array-buffer-view-core":109}],279:[function(require,module,exports){
|
20221 | 'use strict';
|
20222 | var ArrayBufferViewCore = require('../internals/array-buffer-view-core');
|
20223 | var $lastIndexOf = require('../internals/array-last-index-of');
|
20224 |
|
20225 | var aTypedArray = ArrayBufferViewCore.aTypedArray;
|
20226 | var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
|
20227 |
|
20228 |
|
20229 |
|
20230 |
|
20231 | exportTypedArrayMethod('lastIndexOf', function lastIndexOf(searchElement /* , fromIndex */) {
|
20232 | return $lastIndexOf.apply(aTypedArray(this), arguments);
|
20233 | });
|
20234 |
|
20235 | },{"../internals/array-buffer-view-core":109,"../internals/array-last-index-of":117}],280:[function(require,module,exports){
|
20236 | 'use strict';
|
20237 | var ArrayBufferViewCore = require('../internals/array-buffer-view-core');
|
20238 | var $map = require('../internals/array-iteration').map;
|
20239 | var speciesConstructor = require('../internals/species-constructor');
|
20240 |
|
20241 | var aTypedArray = ArrayBufferViewCore.aTypedArray;
|
20242 | var aTypedArrayConstructor = ArrayBufferViewCore.aTypedArrayConstructor;
|
20243 | var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
|
20244 |
|
20245 |
|
20246 |
|
20247 | exportTypedArrayMethod('map', function map(mapfn /* , thisArg */) {
|
20248 | return $map(aTypedArray(this), mapfn, arguments.length > 1 ? arguments[1] : undefined, function (O, length) {
|
20249 | return new (aTypedArrayConstructor(speciesConstructor(O, O.constructor)))(length);
|
20250 | });
|
20251 | });
|
20252 |
|
20253 | },{"../internals/array-buffer-view-core":109,"../internals/array-iteration":116,"../internals/species-constructor":210}],281:[function(require,module,exports){
|
20254 | 'use strict';
|
20255 | var ArrayBufferViewCore = require('../internals/array-buffer-view-core');
|
20256 | var $reduceRight = require('../internals/array-reduce').right;
|
20257 |
|
20258 | var aTypedArray = ArrayBufferViewCore.aTypedArray;
|
20259 | var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
|
20260 |
|
20261 |
|
20262 |
|
20263 | exportTypedArrayMethod('reduceRight', function reduceRight(callbackfn /* , initialValue */) {
|
20264 | return $reduceRight(aTypedArray(this), callbackfn, arguments.length, arguments.length > 1 ? arguments[1] : undefined);
|
20265 | });
|
20266 |
|
20267 | },{"../internals/array-buffer-view-core":109,"../internals/array-reduce":121}],282:[function(require,module,exports){
|
20268 | 'use strict';
|
20269 | var ArrayBufferViewCore = require('../internals/array-buffer-view-core');
|
20270 | var $reduce = require('../internals/array-reduce').left;
|
20271 |
|
20272 | var aTypedArray = ArrayBufferViewCore.aTypedArray;
|
20273 | var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
|
20274 |
|
20275 |
|
20276 |
|
20277 | exportTypedArrayMethod('reduce', function reduce(callbackfn /* , initialValue */) {
|
20278 | return $reduce(aTypedArray(this), callbackfn, arguments.length, arguments.length > 1 ? arguments[1] : undefined);
|
20279 | });
|
20280 |
|
20281 | },{"../internals/array-buffer-view-core":109,"../internals/array-reduce":121}],283:[function(require,module,exports){
|
20282 | 'use strict';
|
20283 | var ArrayBufferViewCore = require('../internals/array-buffer-view-core');
|
20284 |
|
20285 | var aTypedArray = ArrayBufferViewCore.aTypedArray;
|
20286 | var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
|
20287 | var floor = Math.floor;
|
20288 |
|
20289 |
|
20290 |
|
20291 | exportTypedArrayMethod('reverse', function reverse() {
|
20292 | var that = this;
|
20293 | var length = aTypedArray(that).length;
|
20294 | var middle = floor(length / 2);
|
20295 | var index = 0;
|
20296 | var value;
|
20297 | while (index < middle) {
|
20298 | value = that[index];
|
20299 | that[index++] = that[--length];
|
20300 | that[length] = value;
|
20301 | } return that;
|
20302 | });
|
20303 |
|
20304 | },{"../internals/array-buffer-view-core":109}],284:[function(require,module,exports){
|
20305 | 'use strict';
|
20306 | var ArrayBufferViewCore = require('../internals/array-buffer-view-core');
|
20307 | var toLength = require('../internals/to-length');
|
20308 | var toOffset = require('../internals/to-offset');
|
20309 | var toObject = require('../internals/to-object');
|
20310 | var fails = require('../internals/fails');
|
20311 |
|
20312 | var aTypedArray = ArrayBufferViewCore.aTypedArray;
|
20313 | var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
|
20314 |
|
20315 | var FORCED = fails(function () {
|
20316 |
|
20317 | new Int8Array(1).set({});
|
20318 | });
|
20319 |
|
20320 |
|
20321 |
|
20322 | exportTypedArrayMethod('set', function set(arrayLike /* , offset */) {
|
20323 | aTypedArray(this);
|
20324 | var offset = toOffset(arguments.length > 1 ? arguments[1] : undefined, 1);
|
20325 | var length = this.length;
|
20326 | var src = toObject(arrayLike);
|
20327 | var len = toLength(src.length);
|
20328 | var index = 0;
|
20329 | if (len + offset > length) throw RangeError('Wrong length');
|
20330 | while (index < len) this[offset + index] = src[index++];
|
20331 | }, FORCED);
|
20332 |
|
20333 | },{"../internals/array-buffer-view-core":109,"../internals/fails":145,"../internals/to-length":219,"../internals/to-object":220,"../internals/to-offset":221}],285:[function(require,module,exports){
|
20334 | 'use strict';
|
20335 | var ArrayBufferViewCore = require('../internals/array-buffer-view-core');
|
20336 | var speciesConstructor = require('../internals/species-constructor');
|
20337 | var fails = require('../internals/fails');
|
20338 |
|
20339 | var aTypedArray = ArrayBufferViewCore.aTypedArray;
|
20340 | var aTypedArrayConstructor = ArrayBufferViewCore.aTypedArrayConstructor;
|
20341 | var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
|
20342 | var $slice = [].slice;
|
20343 |
|
20344 | var FORCED = fails(function () {
|
20345 |
|
20346 | new Int8Array(1).slice();
|
20347 | });
|
20348 |
|
20349 |
|
20350 |
|
20351 | exportTypedArrayMethod('slice', function slice(start, end) {
|
20352 | var list = $slice.call(aTypedArray(this), start, end);
|
20353 | var C = speciesConstructor(this, this.constructor);
|
20354 | var index = 0;
|
20355 | var length = list.length;
|
20356 | var result = new (aTypedArrayConstructor(C))(length);
|
20357 | while (length > index) result[index] = list[index++];
|
20358 | return result;
|
20359 | }, FORCED);
|
20360 |
|
20361 | },{"../internals/array-buffer-view-core":109,"../internals/fails":145,"../internals/species-constructor":210}],286:[function(require,module,exports){
|
20362 | 'use strict';
|
20363 | var ArrayBufferViewCore = require('../internals/array-buffer-view-core');
|
20364 | var $some = require('../internals/array-iteration').some;
|
20365 |
|
20366 | var aTypedArray = ArrayBufferViewCore.aTypedArray;
|
20367 | var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
|
20368 |
|
20369 |
|
20370 |
|
20371 | exportTypedArrayMethod('some', function some(callbackfn /* , thisArg */) {
|
20372 | return $some(aTypedArray(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined);
|
20373 | });
|
20374 |
|
20375 | },{"../internals/array-buffer-view-core":109,"../internals/array-iteration":116}],287:[function(require,module,exports){
|
20376 | 'use strict';
|
20377 | var ArrayBufferViewCore = require('../internals/array-buffer-view-core');
|
20378 |
|
20379 | var aTypedArray = ArrayBufferViewCore.aTypedArray;
|
20380 | var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
|
20381 | var $sort = [].sort;
|
20382 |
|
20383 |
|
20384 |
|
20385 | exportTypedArrayMethod('sort', function sort(comparefn) {
|
20386 | return $sort.call(aTypedArray(this), comparefn);
|
20387 | });
|
20388 |
|
20389 | },{"../internals/array-buffer-view-core":109}],288:[function(require,module,exports){
|
20390 | 'use strict';
|
20391 | var ArrayBufferViewCore = require('../internals/array-buffer-view-core');
|
20392 | var toLength = require('../internals/to-length');
|
20393 | var toAbsoluteIndex = require('../internals/to-absolute-index');
|
20394 | var speciesConstructor = require('../internals/species-constructor');
|
20395 |
|
20396 | var aTypedArray = ArrayBufferViewCore.aTypedArray;
|
20397 | var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
|
20398 |
|
20399 |
|
20400 |
|
20401 | exportTypedArrayMethod('subarray', function subarray(begin, end) {
|
20402 | var O = aTypedArray(this);
|
20403 | var length = O.length;
|
20404 | var beginIndex = toAbsoluteIndex(begin, length);
|
20405 | return new (speciesConstructor(O, O.constructor))(
|
20406 | O.buffer,
|
20407 | O.byteOffset + beginIndex * O.BYTES_PER_ELEMENT,
|
20408 | toLength((end === undefined ? length : toAbsoluteIndex(end, length)) - beginIndex)
|
20409 | );
|
20410 | });
|
20411 |
|
20412 | },{"../internals/array-buffer-view-core":109,"../internals/species-constructor":210,"../internals/to-absolute-index":215,"../internals/to-length":219}],289:[function(require,module,exports){
|
20413 | 'use strict';
|
20414 | var global = require('../internals/global');
|
20415 | var ArrayBufferViewCore = require('../internals/array-buffer-view-core');
|
20416 | var fails = require('../internals/fails');
|
20417 |
|
20418 | var Int8Array = global.Int8Array;
|
20419 | var aTypedArray = ArrayBufferViewCore.aTypedArray;
|
20420 | var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
|
20421 | var $toLocaleString = [].toLocaleString;
|
20422 | var $slice = [].slice;
|
20423 |
|
20424 |
|
20425 | var TO_LOCALE_STRING_BUG = !!Int8Array && fails(function () {
|
20426 | $toLocaleString.call(new Int8Array(1));
|
20427 | });
|
20428 |
|
20429 | var FORCED = fails(function () {
|
20430 | return [1, 2].toLocaleString() != new Int8Array([1, 2]).toLocaleString();
|
20431 | }) || !fails(function () {
|
20432 | Int8Array.prototype.toLocaleString.call([1, 2]);
|
20433 | });
|
20434 |
|
20435 |
|
20436 |
|
20437 | exportTypedArrayMethod('toLocaleString', function toLocaleString() {
|
20438 | return $toLocaleString.apply(TO_LOCALE_STRING_BUG ? $slice.call(aTypedArray(this)) : aTypedArray(this), arguments);
|
20439 | }, FORCED);
|
20440 |
|
20441 | },{"../internals/array-buffer-view-core":109,"../internals/fails":145,"../internals/global":150}],290:[function(require,module,exports){
|
20442 | 'use strict';
|
20443 | var exportTypedArrayMethod = require('../internals/array-buffer-view-core').exportTypedArrayMethod;
|
20444 | var fails = require('../internals/fails');
|
20445 | var global = require('../internals/global');
|
20446 |
|
20447 | var Uint8Array = global.Uint8Array;
|
20448 | var Uint8ArrayPrototype = Uint8Array && Uint8Array.prototype || {};
|
20449 | var arrayToString = [].toString;
|
20450 | var arrayJoin = [].join;
|
20451 |
|
20452 | if (fails(function () { arrayToString.call({}); })) {
|
20453 | arrayToString = function toString() {
|
20454 | return arrayJoin.call(this);
|
20455 | };
|
20456 | }
|
20457 |
|
20458 | var IS_NOT_ARRAY_METHOD = Uint8ArrayPrototype.toString != arrayToString;
|
20459 |
|
20460 |
|
20461 |
|
20462 | exportTypedArrayMethod('toString', arrayToString, IS_NOT_ARRAY_METHOD);
|
20463 |
|
20464 | },{"../internals/array-buffer-view-core":109,"../internals/fails":145,"../internals/global":150}],291:[function(require,module,exports){
|
20465 | var createTypedArrayConstructor = require('../internals/typed-array-constructor');
|
20466 |
|
20467 |
|
20468 |
|
20469 | createTypedArrayConstructor('Uint8', function (init) {
|
20470 | return function Uint8Array(data, byteOffset, length) {
|
20471 | return init(this, data, byteOffset, length);
|
20472 | };
|
20473 | });
|
20474 |
|
20475 | },{"../internals/typed-array-constructor":225}],292:[function(require,module,exports){
|
20476 | var global = require('../internals/global');
|
20477 | var DOMIterables = require('../internals/dom-iterables');
|
20478 | var forEach = require('../internals/array-for-each');
|
20479 | var createNonEnumerableProperty = require('../internals/create-non-enumerable-property');
|
20480 |
|
20481 | for (var COLLECTION_NAME in DOMIterables) {
|
20482 | var Collection = global[COLLECTION_NAME];
|
20483 | var CollectionPrototype = Collection && Collection.prototype;
|
20484 |
|
20485 | if (CollectionPrototype && CollectionPrototype.forEach !== forEach) try {
|
20486 | createNonEnumerableProperty(CollectionPrototype, 'forEach', forEach);
|
20487 | } catch (error) {
|
20488 | CollectionPrototype.forEach = forEach;
|
20489 | }
|
20490 | }
|
20491 |
|
20492 | },{"../internals/array-for-each":113,"../internals/create-non-enumerable-property":131,"../internals/dom-iterables":138,"../internals/global":150}],293:[function(require,module,exports){
|
20493 | var global = require('../internals/global');
|
20494 | var DOMIterables = require('../internals/dom-iterables');
|
20495 | var ArrayIteratorMethods = require('../modules/es.array.iterator');
|
20496 | var createNonEnumerableProperty = require('../internals/create-non-enumerable-property');
|
20497 | var wellKnownSymbol = require('../internals/well-known-symbol');
|
20498 |
|
20499 | var ITERATOR = wellKnownSymbol('iterator');
|
20500 | var TO_STRING_TAG = wellKnownSymbol('toStringTag');
|
20501 | var ArrayValues = ArrayIteratorMethods.values;
|
20502 |
|
20503 | for (var COLLECTION_NAME in DOMIterables) {
|
20504 | var Collection = global[COLLECTION_NAME];
|
20505 | var CollectionPrototype = Collection && Collection.prototype;
|
20506 | if (CollectionPrototype) {
|
20507 |
|
20508 | if (CollectionPrototype[ITERATOR] !== ArrayValues) try {
|
20509 | createNonEnumerableProperty(CollectionPrototype, ITERATOR, ArrayValues);
|
20510 | } catch (error) {
|
20511 | CollectionPrototype[ITERATOR] = ArrayValues;
|
20512 | }
|
20513 | if (!CollectionPrototype[TO_STRING_TAG]) {
|
20514 | createNonEnumerableProperty(CollectionPrototype, TO_STRING_TAG, COLLECTION_NAME);
|
20515 | }
|
20516 | if (DOMIterables[COLLECTION_NAME]) for (var METHOD_NAME in ArrayIteratorMethods) {
|
20517 |
|
20518 | if (CollectionPrototype[METHOD_NAME] !== ArrayIteratorMethods[METHOD_NAME]) try {
|
20519 | createNonEnumerableProperty(CollectionPrototype, METHOD_NAME, ArrayIteratorMethods[METHOD_NAME]);
|
20520 | } catch (error) {
|
20521 | CollectionPrototype[METHOD_NAME] = ArrayIteratorMethods[METHOD_NAME];
|
20522 | }
|
20523 | }
|
20524 | }
|
20525 | }
|
20526 |
|
20527 | },{"../internals/create-non-enumerable-property":131,"../internals/dom-iterables":138,"../internals/global":150,"../internals/well-known-symbol":231,"../modules/es.array.iterator":242}],294:[function(require,module,exports){
|
20528 | (function (Buffer){
|
20529 |
|
20530 |
|
20531 |
|
20532 |
|
20533 |
|
20534 |
|
20535 |
|
20536 |
|
20537 |
|
20538 |
|
20539 |
|
20540 |
|
20541 |
|
20542 |
|
20543 |
|
20544 |
|
20545 |
|
20546 |
|
20547 |
|
20548 |
|
20549 |
|
20550 |
|
20551 |
|
20552 |
|
20553 | function isArray(arg) {
|
20554 | if (Array.isArray) {
|
20555 | return Array.isArray(arg);
|
20556 | }
|
20557 | return objectToString(arg) === '[object Array]';
|
20558 | }
|
20559 | exports.isArray = isArray;
|
20560 |
|
20561 | function isBoolean(arg) {
|
20562 | return typeof arg === 'boolean';
|
20563 | }
|
20564 | exports.isBoolean = isBoolean;
|
20565 |
|
20566 | function isNull(arg) {
|
20567 | return arg === null;
|
20568 | }
|
20569 | exports.isNull = isNull;
|
20570 |
|
20571 | function isNullOrUndefined(arg) {
|
20572 | return arg == null;
|
20573 | }
|
20574 | exports.isNullOrUndefined = isNullOrUndefined;
|
20575 |
|
20576 | function isNumber(arg) {
|
20577 | return typeof arg === 'number';
|
20578 | }
|
20579 | exports.isNumber = isNumber;
|
20580 |
|
20581 | function isString(arg) {
|
20582 | return typeof arg === 'string';
|
20583 | }
|
20584 | exports.isString = isString;
|
20585 |
|
20586 | function isSymbol(arg) {
|
20587 | return typeof arg === 'symbol';
|
20588 | }
|
20589 | exports.isSymbol = isSymbol;
|
20590 |
|
20591 | function isUndefined(arg) {
|
20592 | return arg === void 0;
|
20593 | }
|
20594 | exports.isUndefined = isUndefined;
|
20595 |
|
20596 | function isRegExp(re) {
|
20597 | return objectToString(re) === '[object RegExp]';
|
20598 | }
|
20599 | exports.isRegExp = isRegExp;
|
20600 |
|
20601 | function isObject(arg) {
|
20602 | return typeof arg === 'object' && arg !== null;
|
20603 | }
|
20604 | exports.isObject = isObject;
|
20605 |
|
20606 | function isDate(d) {
|
20607 | return objectToString(d) === '[object Date]';
|
20608 | }
|
20609 | exports.isDate = isDate;
|
20610 |
|
20611 | function isError(e) {
|
20612 | return (objectToString(e) === '[object Error]' || e instanceof Error);
|
20613 | }
|
20614 | exports.isError = isError;
|
20615 |
|
20616 | function isFunction(arg) {
|
20617 | return typeof arg === 'function';
|
20618 | }
|
20619 | exports.isFunction = isFunction;
|
20620 |
|
20621 | function isPrimitive(arg) {
|
20622 | return arg === null ||
|
20623 | typeof arg === 'boolean' ||
|
20624 | typeof arg === 'number' ||
|
20625 | typeof arg === 'string' ||
|
20626 | typeof arg === 'symbol' ||
|
20627 | typeof arg === 'undefined';
|
20628 | }
|
20629 | exports.isPrimitive = isPrimitive;
|
20630 |
|
20631 | exports.isBuffer = Buffer.isBuffer;
|
20632 |
|
20633 | function objectToString(o) {
|
20634 | return Object.prototype.toString.call(o);
|
20635 | }
|
20636 |
|
20637 | }).call(this,{"isBuffer":require("../../is-buffer/index.js")})
|
20638 | },{"../../is-buffer/index.js":308}],295:[function(require,module,exports){
|
20639 |
|
20640 |
|
20641 |
|
20642 |
|
20643 |
|
20644 |
|
20645 |
|
20646 |
|
20647 |
|
20648 |
|
20649 |
|
20650 |
|
20651 |
|
20652 |
|
20653 | (function(global) {
|
20654 | 'use strict';
|
20655 |
|
20656 | var dateFormat = (function() {
|
20657 | var token = /d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|[LloSZWN]|'[^']*'|'[^']*'/g;
|
20658 | var timezone = /\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g;
|
20659 | var timezoneClip = /[^-+\dA-Z]/g;
|
20660 |
|
20661 |
|
20662 | return function (date, mask, utc, gmt) {
|
20663 |
|
20664 |
|
20665 | if (arguments.length === 1 && kindOf(date) === 'string' && !/\d/.test(date)) {
|
20666 | mask = date;
|
20667 | date = undefined;
|
20668 | }
|
20669 |
|
20670 | date = date || new Date;
|
20671 |
|
20672 | if(!(date instanceof Date)) {
|
20673 | date = new Date(date);
|
20674 | }
|
20675 |
|
20676 | if (isNaN(date)) {
|
20677 | throw TypeError('Invalid date');
|
20678 | }
|
20679 |
|
20680 | mask = String(dateFormat.masks[mask] || mask || dateFormat.masks['default']);
|
20681 |
|
20682 |
|
20683 | var maskSlice = mask.slice(0, 4);
|
20684 | if (maskSlice === 'UTC:' || maskSlice === 'GMT:') {
|
20685 | mask = mask.slice(4);
|
20686 | utc = true;
|
20687 | if (maskSlice === 'GMT:') {
|
20688 | gmt = true;
|
20689 | }
|
20690 | }
|
20691 |
|
20692 | var _ = utc ? 'getUTC' : 'get';
|
20693 | var d = date[_ + 'Date']();
|
20694 | var D = date[_ + 'Day']();
|
20695 | var m = date[_ + 'Month']();
|
20696 | var y = date[_ + 'FullYear']();
|
20697 | var H = date[_ + 'Hours']();
|
20698 | var M = date[_ + 'Minutes']();
|
20699 | var s = date[_ + 'Seconds']();
|
20700 | var L = date[_ + 'Milliseconds']();
|
20701 | var o = utc ? 0 : date.getTimezoneOffset();
|
20702 | var W = getWeek(date);
|
20703 | var N = getDayOfWeek(date);
|
20704 | var flags = {
|
20705 | d: d,
|
20706 | dd: pad(d),
|
20707 | ddd: dateFormat.i18n.dayNames[D],
|
20708 | dddd: dateFormat.i18n.dayNames[D + 7],
|
20709 | m: m + 1,
|
20710 | mm: pad(m + 1),
|
20711 | mmm: dateFormat.i18n.monthNames[m],
|
20712 | mmmm: dateFormat.i18n.monthNames[m + 12],
|
20713 | yy: String(y).slice(2),
|
20714 | yyyy: y,
|
20715 | h: H % 12 || 12,
|
20716 | hh: pad(H % 12 || 12),
|
20717 | H: H,
|
20718 | HH: pad(H),
|
20719 | M: M,
|
20720 | MM: pad(M),
|
20721 | s: s,
|
20722 | ss: pad(s),
|
20723 | l: pad(L, 3),
|
20724 | L: pad(Math.round(L / 10)),
|
20725 | t: H < 12 ? 'a' : 'p',
|
20726 | tt: H < 12 ? 'am' : 'pm',
|
20727 | T: H < 12 ? 'A' : 'P',
|
20728 | TT: H < 12 ? 'AM' : 'PM',
|
20729 | Z: gmt ? 'GMT' : utc ? 'UTC' : (String(date).match(timezone) || ['']).pop().replace(timezoneClip, ''),
|
20730 | o: (o > 0 ? '-' : '+') + pad(Math.floor(Math.abs(o) / 60) * 100 + Math.abs(o) % 60, 4),
|
20731 | S: ['th', 'st', 'nd', 'rd'][d % 10 > 3 ? 0 : (d % 100 - d % 10 != 10) * d % 10],
|
20732 | W: W,
|
20733 | N: N
|
20734 | };
|
20735 |
|
20736 | return mask.replace(token, function (match) {
|
20737 | if (match in flags) {
|
20738 | return flags[match];
|
20739 | }
|
20740 | return match.slice(1, match.length - 1);
|
20741 | });
|
20742 | };
|
20743 | })();
|
20744 |
|
20745 | dateFormat.masks = {
|
20746 | 'default': 'ddd mmm dd yyyy HH:MM:ss',
|
20747 | 'shortDate': 'm/d/yy',
|
20748 | 'mediumDate': 'mmm d, yyyy',
|
20749 | 'longDate': 'mmmm d, yyyy',
|
20750 | 'fullDate': 'dddd, mmmm d, yyyy',
|
20751 | 'shortTime': 'h:MM TT',
|
20752 | 'mediumTime': 'h:MM:ss TT',
|
20753 | 'longTime': 'h:MM:ss TT Z',
|
20754 | 'isoDate': 'yyyy-mm-dd',
|
20755 | 'isoTime': 'HH:MM:ss',
|
20756 | 'isoDateTime': 'yyyy-mm-dd\'T\'HH:MM:sso',
|
20757 | 'isoUtcDateTime': 'UTC:yyyy-mm-dd\'T\'HH:MM:ss\'Z\'',
|
20758 | 'expiresHeaderFormat': 'ddd, dd mmm yyyy HH:MM:ss Z'
|
20759 | };
|
20760 |
|
20761 |
|
20762 | dateFormat.i18n = {
|
20763 | dayNames: [
|
20764 | 'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat',
|
20765 | 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'
|
20766 | ],
|
20767 | monthNames: [
|
20768 | 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec',
|
20769 | 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'
|
20770 | ]
|
20771 | };
|
20772 |
|
20773 | function pad(val, len) {
|
20774 | val = String(val);
|
20775 | len = len || 2;
|
20776 | while (val.length < len) {
|
20777 | val = '0' + val;
|
20778 | }
|
20779 | return val;
|
20780 | }
|
20781 |
|
20782 |
|
20783 |
|
20784 |
|
20785 |
|
20786 |
|
20787 |
|
20788 |
|
20789 |
|
20790 | function getWeek(date) {
|
20791 |
|
20792 | var targetThursday = new Date(date.getFullYear(), date.getMonth(), date.getDate());
|
20793 |
|
20794 |
|
20795 | targetThursday.setDate(targetThursday.getDate() - ((targetThursday.getDay() + 6) % 7) + 3);
|
20796 |
|
20797 |
|
20798 | var firstThursday = new Date(targetThursday.getFullYear(), 0, 4);
|
20799 |
|
20800 |
|
20801 | firstThursday.setDate(firstThursday.getDate() - ((firstThursday.getDay() + 6) % 7) + 3);
|
20802 |
|
20803 |
|
20804 | var ds = targetThursday.getTimezoneOffset() - firstThursday.getTimezoneOffset();
|
20805 | targetThursday.setHours(targetThursday.getHours() - ds);
|
20806 |
|
20807 |
|
20808 | var weekDiff = (targetThursday - firstThursday) / (86400000*7);
|
20809 | return 1 + Math.floor(weekDiff);
|
20810 | }
|
20811 |
|
20812 |
|
20813 |
|
20814 |
|
20815 |
|
20816 |
|
20817 |
|
20818 |
|
20819 | function getDayOfWeek(date) {
|
20820 | var dow = date.getDay();
|
20821 | if(dow === 0) {
|
20822 | dow = 7;
|
20823 | }
|
20824 | return dow;
|
20825 | }
|
20826 |
|
20827 |
|
20828 |
|
20829 |
|
20830 |
|
20831 |
|
20832 | function kindOf(val) {
|
20833 | if (val === null) {
|
20834 | return 'null';
|
20835 | }
|
20836 |
|
20837 | if (val === undefined) {
|
20838 | return 'undefined';
|
20839 | }
|
20840 |
|
20841 | if (typeof val !== 'object') {
|
20842 | return typeof val;
|
20843 | }
|
20844 |
|
20845 | if (Array.isArray(val)) {
|
20846 | return 'array';
|
20847 | }
|
20848 |
|
20849 | return {}.toString.call(val)
|
20850 | .slice(8, -1).toLowerCase();
|
20851 | };
|
20852 |
|
20853 |
|
20854 |
|
20855 | if (typeof define === 'function' && define.amd) {
|
20856 | define(function () {
|
20857 | return dateFormat;
|
20858 | });
|
20859 | } else if (typeof exports === 'object') {
|
20860 | module.exports = dateFormat;
|
20861 | } else {
|
20862 | global.dateFormat = dateFormat;
|
20863 | }
|
20864 | })(this);
|
20865 |
|
20866 | },{}],296:[function(require,module,exports){
|
20867 |
|
20868 |
|
20869 |
|
20870 |
|
20871 |
|
20872 |
|
20873 |
|
20874 |
|
20875 | 'use strict';
|
20876 |
|
20877 |
|
20878 |
|
20879 |
|
20880 |
|
20881 |
|
20882 | var matchHtmlRegExp = /["'&<>]/;
|
20883 |
|
20884 |
|
20885 |
|
20886 |
|
20887 |
|
20888 |
|
20889 | module.exports = escapeHtml;
|
20890 |
|
20891 |
|
20892 |
|
20893 |
|
20894 |
|
20895 |
|
20896 |
|
20897 |
|
20898 |
|
20899 | function escapeHtml(string) {
|
20900 | var str = '' + string;
|
20901 | var match = matchHtmlRegExp.exec(str);
|
20902 |
|
20903 | if (!match) {
|
20904 | return str;
|
20905 | }
|
20906 |
|
20907 | var escape;
|
20908 | var html = '';
|
20909 | var index = 0;
|
20910 | var lastIndex = 0;
|
20911 |
|
20912 | for (index = match.index; index < str.length; index++) {
|
20913 | switch (str.charCodeAt(index)) {
|
20914 | case 34:
|
20915 | escape = '"';
|
20916 | break;
|
20917 | case 38:
|
20918 | escape = '&';
|
20919 | break;
|
20920 | case 39:
|
20921 | escape = ''';
|
20922 | break;
|
20923 | case 60:
|
20924 | escape = '<';
|
20925 | break;
|
20926 | case 62:
|
20927 | escape = '>';
|
20928 | break;
|
20929 | default:
|
20930 | continue;
|
20931 | }
|
20932 |
|
20933 | if (lastIndex !== index) {
|
20934 | html += str.substring(lastIndex, index);
|
20935 | }
|
20936 |
|
20937 | lastIndex = index + 1;
|
20938 | html += escape;
|
20939 | }
|
20940 |
|
20941 | return lastIndex !== index
|
20942 | ? html + str.substring(lastIndex, index)
|
20943 | : html;
|
20944 | }
|
20945 |
|
20946 | },{}],297:[function(require,module,exports){
|
20947 |
|
20948 |
|
20949 |
|
20950 |
|
20951 |
|
20952 |
|
20953 |
|
20954 |
|
20955 |
|
20956 |
|
20957 |
|
20958 |
|
20959 |
|
20960 |
|
20961 |
|
20962 |
|
20963 |
|
20964 |
|
20965 |
|
20966 |
|
20967 |
|
20968 | var objectCreate = Object.create || objectCreatePolyfill
|
20969 | var objectKeys = Object.keys || objectKeysPolyfill
|
20970 | var bind = Function.prototype.bind || functionBindPolyfill
|
20971 |
|
20972 | function EventEmitter() {
|
20973 | if (!this._events || !Object.prototype.hasOwnProperty.call(this, '_events')) {
|
20974 | this._events = objectCreate(null);
|
20975 | this._eventsCount = 0;
|
20976 | }
|
20977 |
|
20978 | this._maxListeners = this._maxListeners || undefined;
|
20979 | }
|
20980 | module.exports = EventEmitter;
|
20981 |
|
20982 |
|
20983 | EventEmitter.EventEmitter = EventEmitter;
|
20984 |
|
20985 | EventEmitter.prototype._events = undefined;
|
20986 | EventEmitter.prototype._maxListeners = undefined;
|
20987 |
|
20988 |
|
20989 |
|
20990 | var defaultMaxListeners = 10;
|
20991 |
|
20992 | var hasDefineProperty;
|
20993 | try {
|
20994 | var o = {};
|
20995 | if (Object.defineProperty) Object.defineProperty(o, 'x', { value: 0 });
|
20996 | hasDefineProperty = o.x === 0;
|
20997 | } catch (err) { hasDefineProperty = false }
|
20998 | if (hasDefineProperty) {
|
20999 | Object.defineProperty(EventEmitter, 'defaultMaxListeners', {
|
21000 | enumerable: true,
|
21001 | get: function() {
|
21002 | return defaultMaxListeners;
|
21003 | },
|
21004 | set: function(arg) {
|
21005 |
|
21006 |
|
21007 | if (typeof arg !== 'number' || arg < 0 || arg !== arg)
|
21008 | throw new TypeError('"defaultMaxListeners" must be a positive number');
|
21009 | defaultMaxListeners = arg;
|
21010 | }
|
21011 | });
|
21012 | } else {
|
21013 | EventEmitter.defaultMaxListeners = defaultMaxListeners;
|
21014 | }
|
21015 |
|
21016 |
|
21017 |
|
21018 | EventEmitter.prototype.setMaxListeners = function setMaxListeners(n) {
|
21019 | if (typeof n !== 'number' || n < 0 || isNaN(n))
|
21020 | throw new TypeError('"n" argument must be a positive number');
|
21021 | this._maxListeners = n;
|
21022 | return this;
|
21023 | };
|
21024 |
|
21025 | function $getMaxListeners(that) {
|
21026 | if (that._maxListeners === undefined)
|
21027 | return EventEmitter.defaultMaxListeners;
|
21028 | return that._maxListeners;
|
21029 | }
|
21030 |
|
21031 | EventEmitter.prototype.getMaxListeners = function getMaxListeners() {
|
21032 | return $getMaxListeners(this);
|
21033 | };
|
21034 |
|
21035 |
|
21036 |
|
21037 |
|
21038 |
|
21039 |
|
21040 | function emitNone(handler, isFn, self) {
|
21041 | if (isFn)
|
21042 | handler.call(self);
|
21043 | else {
|
21044 | var len = handler.length;
|
21045 | var listeners = arrayClone(handler, len);
|
21046 | for (var i = 0; i < len; ++i)
|
21047 | listeners[i].call(self);
|
21048 | }
|
21049 | }
|
21050 | function emitOne(handler, isFn, self, arg1) {
|
21051 | if (isFn)
|
21052 | handler.call(self, arg1);
|
21053 | else {
|
21054 | var len = handler.length;
|
21055 | var listeners = arrayClone(handler, len);
|
21056 | for (var i = 0; i < len; ++i)
|
21057 | listeners[i].call(self, arg1);
|
21058 | }
|
21059 | }
|
21060 | function emitTwo(handler, isFn, self, arg1, arg2) {
|
21061 | if (isFn)
|
21062 | handler.call(self, arg1, arg2);
|
21063 | else {
|
21064 | var len = handler.length;
|
21065 | var listeners = arrayClone(handler, len);
|
21066 | for (var i = 0; i < len; ++i)
|
21067 | listeners[i].call(self, arg1, arg2);
|
21068 | }
|
21069 | }
|
21070 | function emitThree(handler, isFn, self, arg1, arg2, arg3) {
|
21071 | if (isFn)
|
21072 | handler.call(self, arg1, arg2, arg3);
|
21073 | else {
|
21074 | var len = handler.length;
|
21075 | var listeners = arrayClone(handler, len);
|
21076 | for (var i = 0; i < len; ++i)
|
21077 | listeners[i].call(self, arg1, arg2, arg3);
|
21078 | }
|
21079 | }
|
21080 |
|
21081 | function emitMany(handler, isFn, self, args) {
|
21082 | if (isFn)
|
21083 | handler.apply(self, args);
|
21084 | else {
|
21085 | var len = handler.length;
|
21086 | var listeners = arrayClone(handler, len);
|
21087 | for (var i = 0; i < len; ++i)
|
21088 | listeners[i].apply(self, args);
|
21089 | }
|
21090 | }
|
21091 |
|
21092 | EventEmitter.prototype.emit = function emit(type) {
|
21093 | var er, handler, len, args, i, events;
|
21094 | var doError = (type === 'error');
|
21095 |
|
21096 | events = this._events;
|
21097 | if (events)
|
21098 | doError = (doError && events.error == null);
|
21099 | else if (!doError)
|
21100 | return false;
|
21101 |
|
21102 |
|
21103 | if (doError) {
|
21104 | if (arguments.length > 1)
|
21105 | er = arguments[1];
|
21106 | if (er instanceof Error) {
|
21107 | throw er;
|
21108 | } else {
|
21109 |
|
21110 | var err = new Error('Unhandled "error" event. (' + er + ')');
|
21111 | err.context = er;
|
21112 | throw err;
|
21113 | }
|
21114 | return false;
|
21115 | }
|
21116 |
|
21117 | handler = events[type];
|
21118 |
|
21119 | if (!handler)
|
21120 | return false;
|
21121 |
|
21122 | var isFn = typeof handler === 'function';
|
21123 | len = arguments.length;
|
21124 | switch (len) {
|
21125 |
|
21126 | case 1:
|
21127 | emitNone(handler, isFn, this);
|
21128 | break;
|
21129 | case 2:
|
21130 | emitOne(handler, isFn, this, arguments[1]);
|
21131 | break;
|
21132 | case 3:
|
21133 | emitTwo(handler, isFn, this, arguments[1], arguments[2]);
|
21134 | break;
|
21135 | case 4:
|
21136 | emitThree(handler, isFn, this, arguments[1], arguments[2], arguments[3]);
|
21137 | break;
|
21138 |
|
21139 | default:
|
21140 | args = new Array(len - 1);
|
21141 | for (i = 1; i < len; i++)
|
21142 | args[i - 1] = arguments[i];
|
21143 | emitMany(handler, isFn, this, args);
|
21144 | }
|
21145 |
|
21146 | return true;
|
21147 | };
|
21148 |
|
21149 | function _addListener(target, type, listener, prepend) {
|
21150 | var m;
|
21151 | var events;
|
21152 | var existing;
|
21153 |
|
21154 | if (typeof listener !== 'function')
|
21155 | throw new TypeError('"listener" argument must be a function');
|
21156 |
|
21157 | events = target._events;
|
21158 | if (!events) {
|
21159 | events = target._events = objectCreate(null);
|
21160 | target._eventsCount = 0;
|
21161 | } else {
|
21162 |
|
21163 |
|
21164 | if (events.newListener) {
|
21165 | target.emit('newListener', type,
|
21166 | listener.listener ? listener.listener : listener);
|
21167 |
|
21168 |
|
21169 |
|
21170 | events = target._events;
|
21171 | }
|
21172 | existing = events[type];
|
21173 | }
|
21174 |
|
21175 | if (!existing) {
|
21176 |
|
21177 | existing = events[type] = listener;
|
21178 | ++target._eventsCount;
|
21179 | } else {
|
21180 | if (typeof existing === 'function') {
|
21181 |
|
21182 | existing = events[type] =
|
21183 | prepend ? [listener, existing] : [existing, listener];
|
21184 | } else {
|
21185 |
|
21186 | if (prepend) {
|
21187 | existing.unshift(listener);
|
21188 | } else {
|
21189 | existing.push(listener);
|
21190 | }
|
21191 | }
|
21192 |
|
21193 |
|
21194 | if (!existing.warned) {
|
21195 | m = $getMaxListeners(target);
|
21196 | if (m && m > 0 && existing.length > m) {
|
21197 | existing.warned = true;
|
21198 | var w = new Error('Possible EventEmitter memory leak detected. ' +
|
21199 | existing.length + ' "' + String(type) + '" listeners ' +
|
21200 | 'added. Use emitter.setMaxListeners() to ' +
|
21201 | 'increase limit.');
|
21202 | w.name = 'MaxListenersExceededWarning';
|
21203 | w.emitter = target;
|
21204 | w.type = type;
|
21205 | w.count = existing.length;
|
21206 | if (typeof console === 'object' && console.warn) {
|
21207 | console.warn('%s: %s', w.name, w.message);
|
21208 | }
|
21209 | }
|
21210 | }
|
21211 | }
|
21212 |
|
21213 | return target;
|
21214 | }
|
21215 |
|
21216 | EventEmitter.prototype.addListener = function addListener(type, listener) {
|
21217 | return _addListener(this, type, listener, false);
|
21218 | };
|
21219 |
|
21220 | EventEmitter.prototype.on = EventEmitter.prototype.addListener;
|
21221 |
|
21222 | EventEmitter.prototype.prependListener =
|
21223 | function prependListener(type, listener) {
|
21224 | return _addListener(this, type, listener, true);
|
21225 | };
|
21226 |
|
21227 | function onceWrapper() {
|
21228 | if (!this.fired) {
|
21229 | this.target.removeListener(this.type, this.wrapFn);
|
21230 | this.fired = true;
|
21231 | switch (arguments.length) {
|
21232 | case 0:
|
21233 | return this.listener.call(this.target);
|
21234 | case 1:
|
21235 | return this.listener.call(this.target, arguments[0]);
|
21236 | case 2:
|
21237 | return this.listener.call(this.target, arguments[0], arguments[1]);
|
21238 | case 3:
|
21239 | return this.listener.call(this.target, arguments[0], arguments[1],
|
21240 | arguments[2]);
|
21241 | default:
|
21242 | var args = new Array(arguments.length);
|
21243 | for (var i = 0; i < args.length; ++i)
|
21244 | args[i] = arguments[i];
|
21245 | this.listener.apply(this.target, args);
|
21246 | }
|
21247 | }
|
21248 | }
|
21249 |
|
21250 | function _onceWrap(target, type, listener) {
|
21251 | var state = { fired: false, wrapFn: undefined, target: target, type: type, listener: listener };
|
21252 | var wrapped = bind.call(onceWrapper, state);
|
21253 | wrapped.listener = listener;
|
21254 | state.wrapFn = wrapped;
|
21255 | return wrapped;
|
21256 | }
|
21257 |
|
21258 | EventEmitter.prototype.once = function once(type, listener) {
|
21259 | if (typeof listener !== 'function')
|
21260 | throw new TypeError('"listener" argument must be a function');
|
21261 | this.on(type, _onceWrap(this, type, listener));
|
21262 | return this;
|
21263 | };
|
21264 |
|
21265 | EventEmitter.prototype.prependOnceListener =
|
21266 | function prependOnceListener(type, listener) {
|
21267 | if (typeof listener !== 'function')
|
21268 | throw new TypeError('"listener" argument must be a function');
|
21269 | this.prependListener(type, _onceWrap(this, type, listener));
|
21270 | return this;
|
21271 | };
|
21272 |
|
21273 |
|
21274 | EventEmitter.prototype.removeListener =
|
21275 | function removeListener(type, listener) {
|
21276 | var list, events, position, i, originalListener;
|
21277 |
|
21278 | if (typeof listener !== 'function')
|
21279 | throw new TypeError('"listener" argument must be a function');
|
21280 |
|
21281 | events = this._events;
|
21282 | if (!events)
|
21283 | return this;
|
21284 |
|
21285 | list = events[type];
|
21286 | if (!list)
|
21287 | return this;
|
21288 |
|
21289 | if (list === listener || list.listener === listener) {
|
21290 | if (--this._eventsCount === 0)
|
21291 | this._events = objectCreate(null);
|
21292 | else {
|
21293 | delete events[type];
|
21294 | if (events.removeListener)
|
21295 | this.emit('removeListener', type, list.listener || listener);
|
21296 | }
|
21297 | } else if (typeof list !== 'function') {
|
21298 | position = -1;
|
21299 |
|
21300 | for (i = list.length - 1; i >= 0; i--) {
|
21301 | if (list[i] === listener || list[i].listener === listener) {
|
21302 | originalListener = list[i].listener;
|
21303 | position = i;
|
21304 | break;
|
21305 | }
|
21306 | }
|
21307 |
|
21308 | if (position < 0)
|
21309 | return this;
|
21310 |
|
21311 | if (position === 0)
|
21312 | list.shift();
|
21313 | else
|
21314 | spliceOne(list, position);
|
21315 |
|
21316 | if (list.length === 1)
|
21317 | events[type] = list[0];
|
21318 |
|
21319 | if (events.removeListener)
|
21320 | this.emit('removeListener', type, originalListener || listener);
|
21321 | }
|
21322 |
|
21323 | return this;
|
21324 | };
|
21325 |
|
21326 | EventEmitter.prototype.removeAllListeners =
|
21327 | function removeAllListeners(type) {
|
21328 | var listeners, events, i;
|
21329 |
|
21330 | events = this._events;
|
21331 | if (!events)
|
21332 | return this;
|
21333 |
|
21334 |
|
21335 | if (!events.removeListener) {
|
21336 | if (arguments.length === 0) {
|
21337 | this._events = objectCreate(null);
|
21338 | this._eventsCount = 0;
|
21339 | } else if (events[type]) {
|
21340 | if (--this._eventsCount === 0)
|
21341 | this._events = objectCreate(null);
|
21342 | else
|
21343 | delete events[type];
|
21344 | }
|
21345 | return this;
|
21346 | }
|
21347 |
|
21348 |
|
21349 | if (arguments.length === 0) {
|
21350 | var keys = objectKeys(events);
|
21351 | var key;
|
21352 | for (i = 0; i < keys.length; ++i) {
|
21353 | key = keys[i];
|
21354 | if (key === 'removeListener') continue;
|
21355 | this.removeAllListeners(key);
|
21356 | }
|
21357 | this.removeAllListeners('removeListener');
|
21358 | this._events = objectCreate(null);
|
21359 | this._eventsCount = 0;
|
21360 | return this;
|
21361 | }
|
21362 |
|
21363 | listeners = events[type];
|
21364 |
|
21365 | if (typeof listeners === 'function') {
|
21366 | this.removeListener(type, listeners);
|
21367 | } else if (listeners) {
|
21368 |
|
21369 | for (i = listeners.length - 1; i >= 0; i--) {
|
21370 | this.removeListener(type, listeners[i]);
|
21371 | }
|
21372 | }
|
21373 |
|
21374 | return this;
|
21375 | };
|
21376 |
|
21377 | function _listeners(target, type, unwrap) {
|
21378 | var events = target._events;
|
21379 |
|
21380 | if (!events)
|
21381 | return [];
|
21382 |
|
21383 | var evlistener = events[type];
|
21384 | if (!evlistener)
|
21385 | return [];
|
21386 |
|
21387 | if (typeof evlistener === 'function')
|
21388 | return unwrap ? [evlistener.listener || evlistener] : [evlistener];
|
21389 |
|
21390 | return unwrap ? unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length);
|
21391 | }
|
21392 |
|
21393 | EventEmitter.prototype.listeners = function listeners(type) {
|
21394 | return _listeners(this, type, true);
|
21395 | };
|
21396 |
|
21397 | EventEmitter.prototype.rawListeners = function rawListeners(type) {
|
21398 | return _listeners(this, type, false);
|
21399 | };
|
21400 |
|
21401 | EventEmitter.listenerCount = function(emitter, type) {
|
21402 | if (typeof emitter.listenerCount === 'function') {
|
21403 | return emitter.listenerCount(type);
|
21404 | } else {
|
21405 | return listenerCount.call(emitter, type);
|
21406 | }
|
21407 | };
|
21408 |
|
21409 | EventEmitter.prototype.listenerCount = listenerCount;
|
21410 | function listenerCount(type) {
|
21411 | var events = this._events;
|
21412 |
|
21413 | if (events) {
|
21414 | var evlistener = events[type];
|
21415 |
|
21416 | if (typeof evlistener === 'function') {
|
21417 | return 1;
|
21418 | } else if (evlistener) {
|
21419 | return evlistener.length;
|
21420 | }
|
21421 | }
|
21422 |
|
21423 | return 0;
|
21424 | }
|
21425 |
|
21426 | EventEmitter.prototype.eventNames = function eventNames() {
|
21427 | return this._eventsCount > 0 ? Reflect.ownKeys(this._events) : [];
|
21428 | };
|
21429 |
|
21430 |
|
21431 | function spliceOne(list, index) {
|
21432 | for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1)
|
21433 | list[i] = list[k];
|
21434 | list.pop();
|
21435 | }
|
21436 |
|
21437 | function arrayClone(arr, n) {
|
21438 | var copy = new Array(n);
|
21439 | for (var i = 0; i < n; ++i)
|
21440 | copy[i] = arr[i];
|
21441 | return copy;
|
21442 | }
|
21443 |
|
21444 | function unwrapListeners(arr) {
|
21445 | var ret = new Array(arr.length);
|
21446 | for (var i = 0; i < ret.length; ++i) {
|
21447 | ret[i] = arr[i].listener || arr[i];
|
21448 | }
|
21449 | return ret;
|
21450 | }
|
21451 |
|
21452 | function objectCreatePolyfill(proto) {
|
21453 | var F = function() {};
|
21454 | F.prototype = proto;
|
21455 | return new F;
|
21456 | }
|
21457 | function objectKeysPolyfill(obj) {
|
21458 | var keys = [];
|
21459 | for (var k in obj) if (Object.prototype.hasOwnProperty.call(obj, k)) {
|
21460 | keys.push(k);
|
21461 | }
|
21462 | return k;
|
21463 | }
|
21464 | function functionBindPolyfill(context) {
|
21465 | var fn = this;
|
21466 | return function () {
|
21467 | return fn.apply(context, arguments);
|
21468 | };
|
21469 | }
|
21470 |
|
21471 | },{}],298:[function(require,module,exports){
|
21472 | var http = require('http')
|
21473 | var url = require('url')
|
21474 |
|
21475 | var https = module.exports
|
21476 |
|
21477 | for (var key in http) {
|
21478 | if (http.hasOwnProperty(key)) https[key] = http[key]
|
21479 | }
|
21480 |
|
21481 | https.request = function (params, cb) {
|
21482 | params = validateParams(params)
|
21483 | return http.request.call(this, params, cb)
|
21484 | }
|
21485 |
|
21486 | https.get = function (params, cb) {
|
21487 | params = validateParams(params)
|
21488 | return http.get.call(this, params, cb)
|
21489 | }
|
21490 |
|
21491 | function validateParams (params) {
|
21492 | if (typeof params === 'string') {
|
21493 | params = url.parse(params)
|
21494 | }
|
21495 | if (!params.protocol) {
|
21496 | params.protocol = 'https:'
|
21497 | }
|
21498 | if (params.protocol !== 'https:') {
|
21499 | throw new Error('Protocol "' + params.protocol + '" not supported. Expected "https:"')
|
21500 | }
|
21501 | return params
|
21502 | }
|
21503 |
|
21504 | },{"http":79,"url":394}],299:[function(require,module,exports){
|
21505 |
|
21506 |
|
21507 |
|
21508 |
|
21509 |
|
21510 |
|
21511 | 'use strict';
|
21512 |
|
21513 |
|
21514 |
|
21515 |
|
21516 |
|
21517 | var util = require('util');
|
21518 | var ms = require('ms');
|
21519 |
|
21520 | module.exports = function (t) {
|
21521 | if (typeof t === 'number') return t;
|
21522 | var r = ms(t);
|
21523 | if (r === undefined) {
|
21524 | var err = new Error(util.format('humanize-ms(%j) result undefined', t));
|
21525 | console.warn(err.stack);
|
21526 | }
|
21527 | return r;
|
21528 | };
|
21529 |
|
21530 | },{"ms":315,"util":346}],300:[function(require,module,exports){
|
21531 | exports.read = function (buffer, offset, isLE, mLen, nBytes) {
|
21532 | var e, m
|
21533 | var eLen = (nBytes * 8) - mLen - 1
|
21534 | var eMax = (1 << eLen) - 1
|
21535 | var eBias = eMax >> 1
|
21536 | var nBits = -7
|
21537 | var i = isLE ? (nBytes - 1) : 0
|
21538 | var d = isLE ? -1 : 1
|
21539 | var s = buffer[offset + i]
|
21540 |
|
21541 | i += d
|
21542 |
|
21543 | e = s & ((1 << (-nBits)) - 1)
|
21544 | s >>= (-nBits)
|
21545 | nBits += eLen
|
21546 | for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}
|
21547 |
|
21548 | m = e & ((1 << (-nBits)) - 1)
|
21549 | e >>= (-nBits)
|
21550 | nBits += mLen
|
21551 | for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}
|
21552 |
|
21553 | if (e === 0) {
|
21554 | e = 1 - eBias
|
21555 | } else if (e === eMax) {
|
21556 | return m ? NaN : ((s ? -1 : 1) * Infinity)
|
21557 | } else {
|
21558 | m = m + Math.pow(2, mLen)
|
21559 | e = e - eBias
|
21560 | }
|
21561 | return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
|
21562 | }
|
21563 |
|
21564 | exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
|
21565 | var e, m, c
|
21566 | var eLen = (nBytes * 8) - mLen - 1
|
21567 | var eMax = (1 << eLen) - 1
|
21568 | var eBias = eMax >> 1
|
21569 | var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)
|
21570 | var i = isLE ? 0 : (nBytes - 1)
|
21571 | var d = isLE ? 1 : -1
|
21572 | var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0
|
21573 |
|
21574 | value = Math.abs(value)
|
21575 |
|
21576 | if (isNaN(value) || value === Infinity) {
|
21577 | m = isNaN(value) ? 1 : 0
|
21578 | e = eMax
|
21579 | } else {
|
21580 | e = Math.floor(Math.log(value) / Math.LN2)
|
21581 | if (value * (c = Math.pow(2, -e)) < 1) {
|
21582 | e--
|
21583 | c *= 2
|
21584 | }
|
21585 | if (e + eBias >= 1) {
|
21586 | value += rt / c
|
21587 | } else {
|
21588 | value += rt * Math.pow(2, 1 - eBias)
|
21589 | }
|
21590 | if (value * c >= 2) {
|
21591 | e++
|
21592 | c /= 2
|
21593 | }
|
21594 |
|
21595 | if (e + eBias >= eMax) {
|
21596 | m = 0
|
21597 | e = eMax
|
21598 | } else if (e + eBias >= 1) {
|
21599 | m = ((value * c) - 1) * Math.pow(2, mLen)
|
21600 | e = e + eBias
|
21601 | } else {
|
21602 | m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)
|
21603 | e = 0
|
21604 | }
|
21605 | }
|
21606 |
|
21607 | for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
|
21608 |
|
21609 | e = (e << mLen) | m
|
21610 | eLen += mLen
|
21611 | for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
|
21612 |
|
21613 | buffer[offset + i - d] |= s * 128
|
21614 | }
|
21615 |
|
21616 | },{}],301:[function(require,module,exports){
|
21617 | 'use strict';
|
21618 | var types = [
|
21619 | require('./nextTick'),
|
21620 | require('./queueMicrotask'),
|
21621 | require('./mutation.js'),
|
21622 | require('./messageChannel'),
|
21623 | require('./stateChange'),
|
21624 | require('./timeout')
|
21625 | ];
|
21626 | var draining;
|
21627 | var currentQueue;
|
21628 | var queueIndex = -1;
|
21629 | var queue = [];
|
21630 | var scheduled = false;
|
21631 | function cleanUpNextTick() {
|
21632 | if (!draining || !currentQueue) {
|
21633 | return;
|
21634 | }
|
21635 | draining = false;
|
21636 | if (currentQueue.length) {
|
21637 | queue = currentQueue.concat(queue);
|
21638 | } else {
|
21639 | queueIndex = -1;
|
21640 | }
|
21641 | if (queue.length) {
|
21642 | nextTick();
|
21643 | }
|
21644 | }
|
21645 |
|
21646 |
|
21647 | function nextTick() {
|
21648 | if (draining) {
|
21649 | return;
|
21650 | }
|
21651 | scheduled = false;
|
21652 | draining = true;
|
21653 | var len = queue.length;
|
21654 | var timeout = setTimeout(cleanUpNextTick);
|
21655 | while (len) {
|
21656 | currentQueue = queue;
|
21657 | queue = [];
|
21658 | while (currentQueue && ++queueIndex < len) {
|
21659 | currentQueue[queueIndex].run();
|
21660 | }
|
21661 | queueIndex = -1;
|
21662 | len = queue.length;
|
21663 | }
|
21664 | currentQueue = null;
|
21665 | queueIndex = -1;
|
21666 | draining = false;
|
21667 | clearTimeout(timeout);
|
21668 | }
|
21669 | var scheduleDrain;
|
21670 | var i = -1;
|
21671 | var len = types.length;
|
21672 | while (++i < len) {
|
21673 | if (types[i] && types[i].test && types[i].test()) {
|
21674 | scheduleDrain = types[i].install(nextTick);
|
21675 | break;
|
21676 | }
|
21677 | }
|
21678 |
|
21679 | function Item(fun, array) {
|
21680 | this.fun = fun;
|
21681 | this.array = array;
|
21682 | }
|
21683 | Item.prototype.run = function () {
|
21684 | var fun = this.fun;
|
21685 | var array = this.array;
|
21686 | switch (array.length) {
|
21687 | case 0:
|
21688 | return fun();
|
21689 | case 1:
|
21690 | return fun(array[0]);
|
21691 | case 2:
|
21692 | return fun(array[0], array[1]);
|
21693 | case 3:
|
21694 | return fun(array[0], array[1], array[2]);
|
21695 | default:
|
21696 | return fun.apply(null, array);
|
21697 | }
|
21698 |
|
21699 | };
|
21700 | module.exports = immediate;
|
21701 | function immediate(task) {
|
21702 | var args = new Array(arguments.length - 1);
|
21703 | if (arguments.length > 1) {
|
21704 | for (var i = 1; i < arguments.length; i++) {
|
21705 | args[i - 1] = arguments[i];
|
21706 | }
|
21707 | }
|
21708 | queue.push(new Item(task, args));
|
21709 | if (!scheduled && !draining) {
|
21710 | scheduled = true;
|
21711 | scheduleDrain();
|
21712 | }
|
21713 | }
|
21714 |
|
21715 | },{"./messageChannel":302,"./mutation.js":303,"./nextTick":78,"./queueMicrotask":304,"./stateChange":305,"./timeout":306}],302:[function(require,module,exports){
|
21716 | (function (global){
|
21717 | 'use strict';
|
21718 |
|
21719 | exports.test = function () {
|
21720 | if (global.setImmediate) {
|
21721 |
|
21722 |
|
21723 | return false;
|
21724 | }
|
21725 | return typeof global.MessageChannel !== 'undefined';
|
21726 | };
|
21727 |
|
21728 | exports.install = function (func) {
|
21729 | var channel = new global.MessageChannel();
|
21730 | channel.port1.onmessage = func;
|
21731 | return function () {
|
21732 | channel.port2.postMessage(0);
|
21733 | };
|
21734 | };
|
21735 | }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
21736 | },{}],303:[function(require,module,exports){
|
21737 | (function (global){
|
21738 | 'use strict';
|
21739 |
|
21740 |
|
21741 |
|
21742 |
|
21743 | var Mutation = global.MutationObserver || global.WebKitMutationObserver;
|
21744 |
|
21745 | exports.test = function () {
|
21746 | return Mutation;
|
21747 | };
|
21748 |
|
21749 | exports.install = function (handle) {
|
21750 | var called = 0;
|
21751 | var observer = new Mutation(handle);
|
21752 | var element = global.document.createTextNode('');
|
21753 | observer.observe(element, {
|
21754 | characterData: true
|
21755 | });
|
21756 | return function () {
|
21757 | element.data = (called = ++called % 2);
|
21758 | };
|
21759 | };
|
21760 | }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
21761 | },{}],304:[function(require,module,exports){
|
21762 | (function (global){
|
21763 | 'use strict';
|
21764 | exports.test = function () {
|
21765 | return typeof global.queueMicrotask === 'function';
|
21766 | };
|
21767 |
|
21768 | exports.install = function (func) {
|
21769 | return function () {
|
21770 | global.queueMicrotask(func);
|
21771 | };
|
21772 | };
|
21773 |
|
21774 | }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
21775 | },{}],305:[function(require,module,exports){
|
21776 | (function (global){
|
21777 | 'use strict';
|
21778 |
|
21779 | exports.test = function () {
|
21780 | return 'document' in global && 'onreadystatechange' in global.document.createElement('script');
|
21781 | };
|
21782 |
|
21783 | exports.install = function (handle) {
|
21784 | return function () {
|
21785 |
|
21786 |
|
21787 |
|
21788 | var scriptEl = global.document.createElement('script');
|
21789 | scriptEl.onreadystatechange = function () {
|
21790 | handle();
|
21791 |
|
21792 | scriptEl.onreadystatechange = null;
|
21793 | scriptEl.parentNode.removeChild(scriptEl);
|
21794 | scriptEl = null;
|
21795 | };
|
21796 | global.document.documentElement.appendChild(scriptEl);
|
21797 |
|
21798 | return handle;
|
21799 | };
|
21800 | };
|
21801 | }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
21802 | },{}],306:[function(require,module,exports){
|
21803 | 'use strict';
|
21804 | exports.test = function () {
|
21805 | return true;
|
21806 | };
|
21807 |
|
21808 | exports.install = function (t) {
|
21809 | return function () {
|
21810 | setTimeout(t, 0);
|
21811 | };
|
21812 | };
|
21813 | },{}],307:[function(require,module,exports){
|
21814 | if (typeof Object.create === 'function') {
|
21815 |
|
21816 | module.exports = function inherits(ctor, superCtor) {
|
21817 | if (superCtor) {
|
21818 | ctor.super_ = superCtor
|
21819 | ctor.prototype = Object.create(superCtor.prototype, {
|
21820 | constructor: {
|
21821 | value: ctor,
|
21822 | enumerable: false,
|
21823 | writable: true,
|
21824 | configurable: true
|
21825 | }
|
21826 | })
|
21827 | }
|
21828 | };
|
21829 | } else {
|
21830 |
|
21831 | module.exports = function inherits(ctor, superCtor) {
|
21832 | if (superCtor) {
|
21833 | ctor.super_ = superCtor
|
21834 | var TempCtor = function () {}
|
21835 | TempCtor.prototype = superCtor.prototype
|
21836 | ctor.prototype = new TempCtor()
|
21837 | ctor.prototype.constructor = ctor
|
21838 | }
|
21839 | }
|
21840 | }
|
21841 |
|
21842 | },{}],308:[function(require,module,exports){
|
21843 |
|
21844 |
|
21845 |
|
21846 |
|
21847 |
|
21848 |
|
21849 |
|
21850 |
|
21851 |
|
21852 | module.exports = function (obj) {
|
21853 | return obj != null && (isBuffer(obj) || isSlowBuffer(obj) || !!obj._isBuffer)
|
21854 | }
|
21855 |
|
21856 | function isBuffer (obj) {
|
21857 | return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj)
|
21858 | }
|
21859 |
|
21860 |
|
21861 | function isSlowBuffer (obj) {
|
21862 | return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0))
|
21863 | }
|
21864 |
|
21865 | },{}],309:[function(require,module,exports){
|
21866 | var toString = {}.toString;
|
21867 |
|
21868 | module.exports = Array.isArray || function (arr) {
|
21869 | return toString.call(arr) == '[object Array]';
|
21870 | };
|
21871 |
|
21872 | },{}],310:[function(require,module,exports){
|
21873 | (function (global){
|
21874 |
|
21875 |
|
21876 |
|
21877 |
|
21878 |
|
21879 |
|
21880 |
|
21881 |
|
21882 |
|
21883 | ;(function (global, factory) {
|
21884 | typeof exports === 'object' && typeof module !== 'undefined'
|
21885 | ? module.exports = factory(global)
|
21886 | : typeof define === 'function' && define.amd
|
21887 | ? define(factory) : factory(global)
|
21888 | }((
|
21889 | typeof self !== 'undefined' ? self
|
21890 | : typeof window !== 'undefined' ? window
|
21891 | : typeof global !== 'undefined' ? global
|
21892 | : this
|
21893 | ), function(global) {
|
21894 | 'use strict';
|
21895 |
|
21896 | global = global || {};
|
21897 | var _Base64 = global.Base64;
|
21898 | var version = "2.5.2";
|
21899 |
|
21900 | var buffer;
|
21901 | if (typeof module !== 'undefined' && module.exports) {
|
21902 | try {
|
21903 | buffer = eval("require('buffer').Buffer");
|
21904 | } catch (err) {
|
21905 | buffer = undefined;
|
21906 | }
|
21907 | }
|
21908 |
|
21909 | var b64chars
|
21910 | = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
|
21911 | var b64tab = function(bin) {
|
21912 | var t = {};
|
21913 | for (var i = 0, l = bin.length; i < l; i++) t[bin.charAt(i)] = i;
|
21914 | return t;
|
21915 | }(b64chars);
|
21916 | var fromCharCode = String.fromCharCode;
|
21917 |
|
21918 | var cb_utob = function(c) {
|
21919 | if (c.length < 2) {
|
21920 | var cc = c.charCodeAt(0);
|
21921 | return cc < 0x80 ? c
|
21922 | : cc < 0x800 ? (fromCharCode(0xc0 | (cc >>> 6))
|
21923 | + fromCharCode(0x80 | (cc & 0x3f)))
|
21924 | : (fromCharCode(0xe0 | ((cc >>> 12) & 0x0f))
|
21925 | + fromCharCode(0x80 | ((cc >>> 6) & 0x3f))
|
21926 | + fromCharCode(0x80 | ( cc & 0x3f)));
|
21927 | } else {
|
21928 | var cc = 0x10000
|
21929 | + (c.charCodeAt(0) - 0xD800) * 0x400
|
21930 | + (c.charCodeAt(1) - 0xDC00);
|
21931 | return (fromCharCode(0xf0 | ((cc >>> 18) & 0x07))
|
21932 | + fromCharCode(0x80 | ((cc >>> 12) & 0x3f))
|
21933 | + fromCharCode(0x80 | ((cc >>> 6) & 0x3f))
|
21934 | + fromCharCode(0x80 | ( cc & 0x3f)));
|
21935 | }
|
21936 | };
|
21937 | var re_utob = /[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g;
|
21938 | var utob = function(u) {
|
21939 | return u.replace(re_utob, cb_utob);
|
21940 | };
|
21941 | var cb_encode = function(ccc) {
|
21942 | var padlen = [0, 2, 1][ccc.length % 3],
|
21943 | ord = ccc.charCodeAt(0) << 16
|
21944 | | ((ccc.length > 1 ? ccc.charCodeAt(1) : 0) << 8)
|
21945 | | ((ccc.length > 2 ? ccc.charCodeAt(2) : 0)),
|
21946 | chars = [
|
21947 | b64chars.charAt( ord >>> 18),
|
21948 | b64chars.charAt((ord >>> 12) & 63),
|
21949 | padlen >= 2 ? '=' : b64chars.charAt((ord >>> 6) & 63),
|
21950 | padlen >= 1 ? '=' : b64chars.charAt(ord & 63)
|
21951 | ];
|
21952 | return chars.join('');
|
21953 | };
|
21954 | var btoa = global.btoa ? function(b) {
|
21955 | return global.btoa(b);
|
21956 | } : function(b) {
|
21957 | return b.replace(/[\s\S]{1,3}/g, cb_encode);
|
21958 | };
|
21959 | var _encode = function(u) {
|
21960 | var isUint8Array = Object.prototype.toString.call(u) === '[object Uint8Array]';
|
21961 | return isUint8Array ? u.toString('base64')
|
21962 | : btoa(utob(String(u)));
|
21963 | }
|
21964 | var encode = function(u, urisafe) {
|
21965 | return !urisafe
|
21966 | ? _encode(u)
|
21967 | : _encode(String(u)).replace(/[+\/]/g, function(m0) {
|
21968 | return m0 == '+' ? '-' : '_';
|
21969 | }).replace(/=/g, '');
|
21970 | };
|
21971 | var encodeURI = function(u) { return encode(u, true) };
|
21972 |
|
21973 | var re_btou = /[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g;
|
21974 | var cb_btou = function(cccc) {
|
21975 | switch(cccc.length) {
|
21976 | case 4:
|
21977 | var cp = ((0x07 & cccc.charCodeAt(0)) << 18)
|
21978 | | ((0x3f & cccc.charCodeAt(1)) << 12)
|
21979 | | ((0x3f & cccc.charCodeAt(2)) << 6)
|
21980 | | (0x3f & cccc.charCodeAt(3)),
|
21981 | offset = cp - 0x10000;
|
21982 | return (fromCharCode((offset >>> 10) + 0xD800)
|
21983 | + fromCharCode((offset & 0x3FF) + 0xDC00));
|
21984 | case 3:
|
21985 | return fromCharCode(
|
21986 | ((0x0f & cccc.charCodeAt(0)) << 12)
|
21987 | | ((0x3f & cccc.charCodeAt(1)) << 6)
|
21988 | | (0x3f & cccc.charCodeAt(2))
|
21989 | );
|
21990 | default:
|
21991 | return fromCharCode(
|
21992 | ((0x1f & cccc.charCodeAt(0)) << 6)
|
21993 | | (0x3f & cccc.charCodeAt(1))
|
21994 | );
|
21995 | }
|
21996 | };
|
21997 | var btou = function(b) {
|
21998 | return b.replace(re_btou, cb_btou);
|
21999 | };
|
22000 | var cb_decode = function(cccc) {
|
22001 | var len = cccc.length,
|
22002 | padlen = len % 4,
|
22003 | n = (len > 0 ? b64tab[cccc.charAt(0)] << 18 : 0)
|
22004 | | (len > 1 ? b64tab[cccc.charAt(1)] << 12 : 0)
|
22005 | | (len > 2 ? b64tab[cccc.charAt(2)] << 6 : 0)
|
22006 | | (len > 3 ? b64tab[cccc.charAt(3)] : 0),
|
22007 | chars = [
|
22008 | fromCharCode( n >>> 16),
|
22009 | fromCharCode((n >>> 8) & 0xff),
|
22010 | fromCharCode( n & 0xff)
|
22011 | ];
|
22012 | chars.length -= [0, 0, 2, 1][padlen];
|
22013 | return chars.join('');
|
22014 | };
|
22015 | var _atob = global.atob ? function(a) {
|
22016 | return global.atob(a);
|
22017 | } : function(a){
|
22018 | return a.replace(/\S{1,4}/g, cb_decode);
|
22019 | };
|
22020 | var atob = function(a) {
|
22021 | return _atob(String(a).replace(/[^A-Za-z0-9\+\/]/g, ''));
|
22022 | };
|
22023 | var _decode = buffer ?
|
22024 | buffer.from && Uint8Array && buffer.from !== Uint8Array.from
|
22025 | ? function(a) {
|
22026 | return (a.constructor === buffer.constructor
|
22027 | ? a : buffer.from(a, 'base64')).toString();
|
22028 | }
|
22029 | : function(a) {
|
22030 | return (a.constructor === buffer.constructor
|
22031 | ? a : new buffer(a, 'base64')).toString();
|
22032 | }
|
22033 | : function(a) { return btou(_atob(a)) };
|
22034 | var decode = function(a){
|
22035 | return _decode(
|
22036 | String(a).replace(/[-_]/g, function(m0) { return m0 == '-' ? '+' : '/' })
|
22037 | .replace(/[^A-Za-z0-9\+\/]/g, '')
|
22038 | );
|
22039 | };
|
22040 | var noConflict = function() {
|
22041 | var Base64 = global.Base64;
|
22042 | global.Base64 = _Base64;
|
22043 | return Base64;
|
22044 | };
|
22045 |
|
22046 | global.Base64 = {
|
22047 | VERSION: version,
|
22048 | atob: atob,
|
22049 | btoa: btoa,
|
22050 | fromBase64: decode,
|
22051 | toBase64: encode,
|
22052 | utob: utob,
|
22053 | encode: encode,
|
22054 | encodeURI: encodeURI,
|
22055 | btou: btou,
|
22056 | decode: decode,
|
22057 | noConflict: noConflict,
|
22058 | __buffer__: buffer
|
22059 | };
|
22060 |
|
22061 | if (typeof Object.defineProperty === 'function') {
|
22062 | var noEnum = function(v){
|
22063 | return {value:v,enumerable:false,writable:true,configurable:true};
|
22064 | };
|
22065 | global.Base64.extendString = function () {
|
22066 | Object.defineProperty(
|
22067 | String.prototype, 'fromBase64', noEnum(function () {
|
22068 | return decode(this)
|
22069 | }));
|
22070 | Object.defineProperty(
|
22071 | String.prototype, 'toBase64', noEnum(function (urisafe) {
|
22072 | return encode(this, urisafe)
|
22073 | }));
|
22074 | Object.defineProperty(
|
22075 | String.prototype, 'toBase64URI', noEnum(function () {
|
22076 | return encode(this, true)
|
22077 | }));
|
22078 | };
|
22079 | }
|
22080 |
|
22081 |
|
22082 |
|
22083 | if (global['Meteor']) {
|
22084 | Base64 = global.Base64;
|
22085 | }
|
22086 |
|
22087 |
|
22088 | if (typeof module !== 'undefined' && module.exports) {
|
22089 | module.exports.Base64 = global.Base64;
|
22090 | }
|
22091 | else if (typeof define === 'function' && define.amd) {
|
22092 |
|
22093 | define([], function(){ return global.Base64 });
|
22094 | }
|
22095 |
|
22096 | return {Base64: global.Base64}
|
22097 | }));
|
22098 |
|
22099 |
|
22100 | }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
22101 | },{}],311:[function(require,module,exports){
|
22102 |
|
22103 |
|
22104 |
|
22105 |
|
22106 |
|
22107 |
|
22108 |
|
22109 | 'use strict'
|
22110 |
|
22111 |
|
22112 |
|
22113 |
|
22114 |
|
22115 |
|
22116 | module.exports = merge
|
22117 |
|
22118 |
|
22119 |
|
22120 |
|
22121 |
|
22122 |
|
22123 | var hasOwnProperty = Object.prototype.hasOwnProperty
|
22124 |
|
22125 |
|
22126 |
|
22127 |
|
22128 |
|
22129 |
|
22130 |
|
22131 |
|
22132 |
|
22133 |
|
22134 |
|
22135 | function merge(dest, src, redefine) {
|
22136 | if (!dest) {
|
22137 | throw new TypeError('argument dest is required')
|
22138 | }
|
22139 |
|
22140 | if (!src) {
|
22141 | throw new TypeError('argument src is required')
|
22142 | }
|
22143 |
|
22144 | if (redefine === undefined) {
|
22145 |
|
22146 | redefine = true
|
22147 | }
|
22148 |
|
22149 | Object.getOwnPropertyNames(src).forEach(function forEachOwnPropertyName(name) {
|
22150 | if (!redefine && hasOwnProperty.call(dest, name)) {
|
22151 |
|
22152 | return
|
22153 | }
|
22154 |
|
22155 |
|
22156 | var descriptor = Object.getOwnPropertyDescriptor(src, name)
|
22157 | Object.defineProperty(dest, name, descriptor)
|
22158 | })
|
22159 |
|
22160 | return dest
|
22161 | }
|
22162 |
|
22163 | },{}],312:[function(require,module,exports){
|
22164 | 'use strict';
|
22165 |
|
22166 |
|
22167 |
|
22168 |
|
22169 |
|
22170 | function Mime() {
|
22171 | this._types = Object.create(null);
|
22172 | this._extensions = Object.create(null);
|
22173 |
|
22174 | for (var i = 0; i < arguments.length; i++) {
|
22175 | this.define(arguments[i]);
|
22176 | }
|
22177 |
|
22178 | this.define = this.define.bind(this);
|
22179 | this.getType = this.getType.bind(this);
|
22180 | this.getExtension = this.getExtension.bind(this);
|
22181 | }
|
22182 |
|
22183 |
|
22184 |
|
22185 |
|
22186 |
|
22187 |
|
22188 |
|
22189 |
|
22190 |
|
22191 |
|
22192 |
|
22193 |
|
22194 |
|
22195 |
|
22196 |
|
22197 |
|
22198 |
|
22199 |
|
22200 |
|
22201 |
|
22202 | Mime.prototype.define = function(typeMap, force) {
|
22203 | for (var type in typeMap) {
|
22204 | var extensions = typeMap[type].map(function(t) {return t.toLowerCase()});
|
22205 | type = type.toLowerCase();
|
22206 |
|
22207 | for (var i = 0; i < extensions.length; i++) {
|
22208 | var ext = extensions[i];
|
22209 |
|
22210 |
|
22211 |
|
22212 | if (ext[0] == '*') {
|
22213 | continue;
|
22214 | }
|
22215 |
|
22216 | if (!force && (ext in this._types)) {
|
22217 | throw new Error(
|
22218 | 'Attempt to change mapping for "' + ext +
|
22219 | '" extension from "' + this._types[ext] + '" to "' + type +
|
22220 | '". Pass `force=true` to allow this, otherwise remove "' + ext +
|
22221 | '" from the list of extensions for "' + type + '".'
|
22222 | );
|
22223 | }
|
22224 |
|
22225 | this._types[ext] = type;
|
22226 | }
|
22227 |
|
22228 |
|
22229 | if (force || !this._extensions[type]) {
|
22230 | var ext = extensions[0];
|
22231 | this._extensions[type] = (ext[0] != '*') ? ext : ext.substr(1)
|
22232 | }
|
22233 | }
|
22234 | };
|
22235 |
|
22236 |
|
22237 |
|
22238 |
|
22239 | Mime.prototype.getType = function(path) {
|
22240 | path = String(path);
|
22241 | var last = path.replace(/^.*[/\\]/, '').toLowerCase();
|
22242 | var ext = last.replace(/^.*\./, '').toLowerCase();
|
22243 |
|
22244 | var hasPath = last.length < path.length;
|
22245 | var hasDot = ext.length < last.length - 1;
|
22246 |
|
22247 | return (hasDot || !hasPath) && this._types[ext] || null;
|
22248 | };
|
22249 |
|
22250 |
|
22251 |
|
22252 |
|
22253 | Mime.prototype.getExtension = function(type) {
|
22254 | type = /^\s*([^;\s]*)/.test(type) && RegExp.$1;
|
22255 | return type && this._extensions[type.toLowerCase()] || null;
|
22256 | };
|
22257 |
|
22258 | module.exports = Mime;
|
22259 |
|
22260 | },{}],313:[function(require,module,exports){
|
22261 | 'use strict';
|
22262 |
|
22263 | var Mime = require('./Mime');
|
22264 | module.exports = new Mime(require('./types/standard'));
|
22265 |
|
22266 | },{"./Mime":312,"./types/standard":314}],314:[function(require,module,exports){
|
22267 | module.exports = {"application/andrew-inset":["ez"],"application/applixware":["aw"],"application/atom+xml":["atom"],"application/atomcat+xml":["atomcat"],"application/atomdeleted+xml":["atomdeleted"],"application/atomsvc+xml":["atomsvc"],"application/atsc-dwd+xml":["dwd"],"application/atsc-held+xml":["held"],"application/atsc-rsat+xml":["rsat"],"application/bdoc":["bdoc"],"application/calendar+xml":["xcs"],"application/ccxml+xml":["ccxml"],"application/cdfx+xml":["cdfx"],"application/cdmi-capability":["cdmia"],"application/cdmi-container":["cdmic"],"application/cdmi-domain":["cdmid"],"application/cdmi-object":["cdmio"],"application/cdmi-queue":["cdmiq"],"application/cu-seeme":["cu"],"application/dash+xml":["mpd"],"application/davmount+xml":["davmount"],"application/docbook+xml":["dbk"],"application/dssc+der":["dssc"],"application/dssc+xml":["xdssc"],"application/ecmascript":["ecma","es"],"application/emma+xml":["emma"],"application/emotionml+xml":["emotionml"],"application/epub+zip":["epub"],"application/exi":["exi"],"application/fdt+xml":["fdt"],"application/font-tdpfr":["pfr"],"application/geo+json":["geojson"],"application/gml+xml":["gml"],"application/gpx+xml":["gpx"],"application/gxf":["gxf"],"application/gzip":["gz"],"application/hjson":["hjson"],"application/hyperstudio":["stk"],"application/inkml+xml":["ink","inkml"],"application/ipfix":["ipfix"],"application/its+xml":["its"],"application/java-archive":["jar","war","ear"],"application/java-serialized-object":["ser"],"application/java-vm":["class"],"application/javascript":["js","mjs"],"application/json":["json","map"],"application/json5":["json5"],"application/jsonml+json":["jsonml"],"application/ld+json":["jsonld"],"application/lgr+xml":["lgr"],"application/lost+xml":["lostxml"],"application/mac-binhex40":["hqx"],"application/mac-compactpro":["cpt"],"application/mads+xml":["mads"],"application/manifest+json":["webmanifest"],"application/marc":["mrc"],"application/marcxml+xml":["mrcx"],"application/mathematica":["ma","nb","mb"],"application/mathml+xml":["mathml"],"application/mbox":["mbox"],"application/mediaservercontrol+xml":["mscml"],"application/metalink+xml":["metalink"],"application/metalink4+xml":["meta4"],"application/mets+xml":["mets"],"application/mmt-aei+xml":["maei"],"application/mmt-usd+xml":["musd"],"application/mods+xml":["mods"],"application/mp21":["m21","mp21"],"application/mp4":["mp4s","m4p"],"application/mrb-consumer+xml":["*xdf"],"application/mrb-publish+xml":["*xdf"],"application/msword":["doc","dot"],"application/mxf":["mxf"],"application/n-quads":["nq"],"application/n-triples":["nt"],"application/node":["cjs"],"application/octet-stream":["bin","dms","lrf","mar","so","dist","distz","pkg","bpk","dump","elc","deploy","exe","dll","deb","dmg","iso","img","msi","msp","msm","buffer"],"application/oda":["oda"],"application/oebps-package+xml":["opf"],"application/ogg":["ogx"],"application/omdoc+xml":["omdoc"],"application/onenote":["onetoc","onetoc2","onetmp","onepkg"],"application/oxps":["oxps"],"application/p2p-overlay+xml":["relo"],"application/patch-ops-error+xml":["*xer"],"application/pdf":["pdf"],"application/pgp-encrypted":["pgp"],"application/pgp-signature":["asc","sig"],"application/pics-rules":["prf"],"application/pkcs10":["p10"],"application/pkcs7-mime":["p7m","p7c"],"application/pkcs7-signature":["p7s"],"application/pkcs8":["p8"],"application/pkix-attr-cert":["ac"],"application/pkix-cert":["cer"],"application/pkix-crl":["crl"],"application/pkix-pkipath":["pkipath"],"application/pkixcmp":["pki"],"application/pls+xml":["pls"],"application/postscript":["ai","eps","ps"],"application/provenance+xml":["provx"],"application/pskc+xml":["pskcxml"],"application/raml+yaml":["raml"],"application/rdf+xml":["rdf","owl"],"application/reginfo+xml":["rif"],"application/relax-ng-compact-syntax":["rnc"],"application/resource-lists+xml":["rl"],"application/resource-lists-diff+xml":["rld"],"application/rls-services+xml":["rs"],"application/route-apd+xml":["rapd"],"application/route-s-tsid+xml":["sls"],"application/route-usd+xml":["rusd"],"application/rpki-ghostbusters":["gbr"],"application/rpki-manifest":["mft"],"application/rpki-roa":["roa"],"application/rsd+xml":["rsd"],"application/rss+xml":["rss"],"application/rtf":["rtf"],"application/sbml+xml":["sbml"],"application/scvp-cv-request":["scq"],"application/scvp-cv-response":["scs"],"application/scvp-vp-request":["spq"],"application/scvp-vp-response":["spp"],"application/sdp":["sdp"],"application/senml+xml":["senmlx"],"application/sensml+xml":["sensmlx"],"application/set-payment-initiation":["setpay"],"application/set-registration-initiation":["setreg"],"application/shf+xml":["shf"],"application/sieve":["siv","sieve"],"application/smil+xml":["smi","smil"],"application/sparql-query":["rq"],"application/sparql-results+xml":["srx"],"application/srgs":["gram"],"application/srgs+xml":["grxml"],"application/sru+xml":["sru"],"application/ssdl+xml":["ssdl"],"application/ssml+xml":["ssml"],"application/swid+xml":["swidtag"],"application/tei+xml":["tei","teicorpus"],"application/thraud+xml":["tfi"],"application/timestamped-data":["tsd"],"application/toml":["toml"],"application/ttml+xml":["ttml"],"application/urc-ressheet+xml":["rsheet"],"application/voicexml+xml":["vxml"],"application/wasm":["wasm"],"application/widget":["wgt"],"application/winhlp":["hlp"],"application/wsdl+xml":["wsdl"],"application/wspolicy+xml":["wspolicy"],"application/xaml+xml":["xaml"],"application/xcap-att+xml":["xav"],"application/xcap-caps+xml":["xca"],"application/xcap-diff+xml":["xdf"],"application/xcap-el+xml":["xel"],"application/xcap-error+xml":["xer"],"application/xcap-ns+xml":["xns"],"application/xenc+xml":["xenc"],"application/xhtml+xml":["xhtml","xht"],"application/xliff+xml":["xlf"],"application/xml":["xml","xsl","xsd","rng"],"application/xml-dtd":["dtd"],"application/xop+xml":["xop"],"application/xproc+xml":["xpl"],"application/xslt+xml":["xslt"],"application/xspf+xml":["xspf"],"application/xv+xml":["mxml","xhvml","xvml","xvm"],"application/yang":["yang"],"application/yin+xml":["yin"],"application/zip":["zip"],"audio/3gpp":["*3gpp"],"audio/adpcm":["adp"],"audio/basic":["au","snd"],"audio/midi":["mid","midi","kar","rmi"],"audio/mobile-xmf":["mxmf"],"audio/mp3":["*mp3"],"audio/mp4":["m4a","mp4a"],"audio/mpeg":["mpga","mp2","mp2a","mp3","m2a","m3a"],"audio/ogg":["oga","ogg","spx"],"audio/s3m":["s3m"],"audio/silk":["sil"],"audio/wav":["wav"],"audio/wave":["*wav"],"audio/webm":["weba"],"audio/xm":["xm"],"font/collection":["ttc"],"font/otf":["otf"],"font/ttf":["ttf"],"font/woff":["woff"],"font/woff2":["woff2"],"image/aces":["exr"],"image/apng":["apng"],"image/bmp":["bmp"],"image/cgm":["cgm"],"image/dicom-rle":["drle"],"image/emf":["emf"],"image/fits":["fits"],"image/g3fax":["g3"],"image/gif":["gif"],"image/heic":["heic"],"image/heic-sequence":["heics"],"image/heif":["heif"],"image/heif-sequence":["heifs"],"image/hej2k":["hej2"],"image/hsj2":["hsj2"],"image/ief":["ief"],"image/jls":["jls"],"image/jp2":["jp2","jpg2"],"image/jpeg":["jpeg","jpg","jpe"],"image/jph":["jph"],"image/jphc":["jhc"],"image/jpm":["jpm"],"image/jpx":["jpx","jpf"],"image/jxr":["jxr"],"image/jxra":["jxra"],"image/jxrs":["jxrs"],"image/jxs":["jxs"],"image/jxsc":["jxsc"],"image/jxsi":["jxsi"],"image/jxss":["jxss"],"image/ktx":["ktx"],"image/png":["png"],"image/sgi":["sgi"],"image/svg+xml":["svg","svgz"],"image/t38":["t38"],"image/tiff":["tif","tiff"],"image/tiff-fx":["tfx"],"image/webp":["webp"],"image/wmf":["wmf"],"message/disposition-notification":["disposition-notification"],"message/global":["u8msg"],"message/global-delivery-status":["u8dsn"],"message/global-disposition-notification":["u8mdn"],"message/global-headers":["u8hdr"],"message/rfc822":["eml","mime"],"model/3mf":["3mf"],"model/gltf+json":["gltf"],"model/gltf-binary":["glb"],"model/iges":["igs","iges"],"model/mesh":["msh","mesh","silo"],"model/mtl":["mtl"],"model/obj":["obj"],"model/stl":["stl"],"model/vrml":["wrl","vrml"],"model/x3d+binary":["*x3db","x3dbz"],"model/x3d+fastinfoset":["x3db"],"model/x3d+vrml":["*x3dv","x3dvz"],"model/x3d+xml":["x3d","x3dz"],"model/x3d-vrml":["x3dv"],"text/cache-manifest":["appcache","manifest"],"text/calendar":["ics","ifb"],"text/coffeescript":["coffee","litcoffee"],"text/css":["css"],"text/csv":["csv"],"text/html":["html","htm","shtml"],"text/jade":["jade"],"text/jsx":["jsx"],"text/less":["less"],"text/markdown":["markdown","md"],"text/mathml":["mml"],"text/mdx":["mdx"],"text/n3":["n3"],"text/plain":["txt","text","conf","def","list","log","in","ini"],"text/richtext":["rtx"],"text/rtf":["*rtf"],"text/sgml":["sgml","sgm"],"text/shex":["shex"],"text/slim":["slim","slm"],"text/stylus":["stylus","styl"],"text/tab-separated-values":["tsv"],"text/troff":["t","tr","roff","man","me","ms"],"text/turtle":["ttl"],"text/uri-list":["uri","uris","urls"],"text/vcard":["vcard"],"text/vtt":["vtt"],"text/xml":["*xml"],"text/yaml":["yaml","yml"],"video/3gpp":["3gp","3gpp"],"video/3gpp2":["3g2"],"video/h261":["h261"],"video/h263":["h263"],"video/h264":["h264"],"video/jpeg":["jpgv"],"video/jpm":["*jpm","jpgm"],"video/mj2":["mj2","mjp2"],"video/mp2t":["ts"],"video/mp4":["mp4","mp4v","mpg4"],"video/mpeg":["mpeg","mpg","mpe","m1v","m2v"],"video/ogg":["ogv"],"video/quicktime":["qt","mov"],"video/webm":["webm"]};
|
22268 | },{}],315:[function(require,module,exports){
|
22269 |
|
22270 |
|
22271 |
|
22272 |
|
22273 | var s = 1000;
|
22274 | var m = s * 60;
|
22275 | var h = m * 60;
|
22276 | var d = h * 24;
|
22277 | var w = d * 7;
|
22278 | var y = d * 365.25;
|
22279 |
|
22280 |
|
22281 |
|
22282 |
|
22283 |
|
22284 |
|
22285 |
|
22286 |
|
22287 |
|
22288 |
|
22289 |
|
22290 |
|
22291 |
|
22292 |
|
22293 |
|
22294 | module.exports = function(val, options) {
|
22295 | options = options || {};
|
22296 | var type = typeof val;
|
22297 | if (type === 'string' && val.length > 0) {
|
22298 | return parse(val);
|
22299 | } else if (type === 'number' && isFinite(val)) {
|
22300 | return options.long ? fmtLong(val) : fmtShort(val);
|
22301 | }
|
22302 | throw new Error(
|
22303 | 'val is not a non-empty string or a valid number. val=' +
|
22304 | JSON.stringify(val)
|
22305 | );
|
22306 | };
|
22307 |
|
22308 |
|
22309 |
|
22310 |
|
22311 |
|
22312 |
|
22313 |
|
22314 |
|
22315 |
|
22316 | function parse(str) {
|
22317 | str = String(str);
|
22318 | if (str.length > 100) {
|
22319 | return;
|
22320 | }
|
22321 | var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(
|
22322 | str
|
22323 | );
|
22324 | if (!match) {
|
22325 | return;
|
22326 | }
|
22327 | var n = parseFloat(match[1]);
|
22328 | var type = (match[2] || 'ms').toLowerCase();
|
22329 | switch (type) {
|
22330 | case 'years':
|
22331 | case 'year':
|
22332 | case 'yrs':
|
22333 | case 'yr':
|
22334 | case 'y':
|
22335 | return n * y;
|
22336 | case 'weeks':
|
22337 | case 'week':
|
22338 | case 'w':
|
22339 | return n * w;
|
22340 | case 'days':
|
22341 | case 'day':
|
22342 | case 'd':
|
22343 | return n * d;
|
22344 | case 'hours':
|
22345 | case 'hour':
|
22346 | case 'hrs':
|
22347 | case 'hr':
|
22348 | case 'h':
|
22349 | return n * h;
|
22350 | case 'minutes':
|
22351 | case 'minute':
|
22352 | case 'mins':
|
22353 | case 'min':
|
22354 | case 'm':
|
22355 | return n * m;
|
22356 | case 'seconds':
|
22357 | case 'second':
|
22358 | case 'secs':
|
22359 | case 'sec':
|
22360 | case 's':
|
22361 | return n * s;
|
22362 | case 'milliseconds':
|
22363 | case 'millisecond':
|
22364 | case 'msecs':
|
22365 | case 'msec':
|
22366 | case 'ms':
|
22367 | return n;
|
22368 | default:
|
22369 | return undefined;
|
22370 | }
|
22371 | }
|
22372 |
|
22373 |
|
22374 |
|
22375 |
|
22376 |
|
22377 |
|
22378 |
|
22379 |
|
22380 |
|
22381 | function fmtShort(ms) {
|
22382 | var msAbs = Math.abs(ms);
|
22383 | if (msAbs >= d) {
|
22384 | return Math.round(ms / d) + 'd';
|
22385 | }
|
22386 | if (msAbs >= h) {
|
22387 | return Math.round(ms / h) + 'h';
|
22388 | }
|
22389 | if (msAbs >= m) {
|
22390 | return Math.round(ms / m) + 'm';
|
22391 | }
|
22392 | if (msAbs >= s) {
|
22393 | return Math.round(ms / s) + 's';
|
22394 | }
|
22395 | return ms + 'ms';
|
22396 | }
|
22397 |
|
22398 |
|
22399 |
|
22400 |
|
22401 |
|
22402 |
|
22403 |
|
22404 |
|
22405 |
|
22406 | function fmtLong(ms) {
|
22407 | var msAbs = Math.abs(ms);
|
22408 | if (msAbs >= d) {
|
22409 | return plural(ms, msAbs, d, 'day');
|
22410 | }
|
22411 | if (msAbs >= h) {
|
22412 | return plural(ms, msAbs, h, 'hour');
|
22413 | }
|
22414 | if (msAbs >= m) {
|
22415 | return plural(ms, msAbs, m, 'minute');
|
22416 | }
|
22417 | if (msAbs >= s) {
|
22418 | return plural(ms, msAbs, s, 'second');
|
22419 | }
|
22420 | return ms + ' ms';
|
22421 | }
|
22422 |
|
22423 |
|
22424 |
|
22425 |
|
22426 |
|
22427 | function plural(ms, msAbs, n, name) {
|
22428 | var isPlural = msAbs >= n * 1.5;
|
22429 | return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');
|
22430 | }
|
22431 |
|
22432 | },{}],316:[function(require,module,exports){
|
22433 | (function (process){
|
22434 |
|
22435 |
|
22436 |
|
22437 |
|
22438 |
|
22439 |
|
22440 |
|
22441 |
|
22442 |
|
22443 |
|
22444 |
|
22445 |
|
22446 |
|
22447 |
|
22448 |
|
22449 |
|
22450 |
|
22451 |
|
22452 |
|
22453 |
|
22454 |
|
22455 |
|
22456 |
|
22457 |
|
22458 |
|
22459 |
|
22460 |
|
22461 |
|
22462 | function normalizeArray(parts, allowAboveRoot) {
|
22463 |
|
22464 | var up = 0;
|
22465 | for (var i = parts.length - 1; i >= 0; i--) {
|
22466 | var last = parts[i];
|
22467 | if (last === '.') {
|
22468 | parts.splice(i, 1);
|
22469 | } else if (last === '..') {
|
22470 | parts.splice(i, 1);
|
22471 | up++;
|
22472 | } else if (up) {
|
22473 | parts.splice(i, 1);
|
22474 | up--;
|
22475 | }
|
22476 | }
|
22477 |
|
22478 |
|
22479 | if (allowAboveRoot) {
|
22480 | for (; up--; up) {
|
22481 | parts.unshift('..');
|
22482 | }
|
22483 | }
|
22484 |
|
22485 | return parts;
|
22486 | }
|
22487 |
|
22488 |
|
22489 |
|
22490 | exports.resolve = function() {
|
22491 | var resolvedPath = '',
|
22492 | resolvedAbsolute = false;
|
22493 |
|
22494 | for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {
|
22495 | var path = (i >= 0) ? arguments[i] : process.cwd();
|
22496 |
|
22497 |
|
22498 | if (typeof path !== 'string') {
|
22499 | throw new TypeError('Arguments to path.resolve must be strings');
|
22500 | } else if (!path) {
|
22501 | continue;
|
22502 | }
|
22503 |
|
22504 | resolvedPath = path + '/' + resolvedPath;
|
22505 | resolvedAbsolute = path.charAt(0) === '/';
|
22506 | }
|
22507 |
|
22508 |
|
22509 |
|
22510 |
|
22511 |
|
22512 | resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function(p) {
|
22513 | return !!p;
|
22514 | }), !resolvedAbsolute).join('/');
|
22515 |
|
22516 | return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.';
|
22517 | };
|
22518 |
|
22519 |
|
22520 |
|
22521 | exports.normalize = function(path) {
|
22522 | var isAbsolute = exports.isAbsolute(path),
|
22523 | trailingSlash = substr(path, -1) === '/';
|
22524 |
|
22525 |
|
22526 | path = normalizeArray(filter(path.split('/'), function(p) {
|
22527 | return !!p;
|
22528 | }), !isAbsolute).join('/');
|
22529 |
|
22530 | if (!path && !isAbsolute) {
|
22531 | path = '.';
|
22532 | }
|
22533 | if (path && trailingSlash) {
|
22534 | path += '/';
|
22535 | }
|
22536 |
|
22537 | return (isAbsolute ? '/' : '') + path;
|
22538 | };
|
22539 |
|
22540 |
|
22541 | exports.isAbsolute = function(path) {
|
22542 | return path.charAt(0) === '/';
|
22543 | };
|
22544 |
|
22545 |
|
22546 | exports.join = function() {
|
22547 | var paths = Array.prototype.slice.call(arguments, 0);
|
22548 | return exports.normalize(filter(paths, function(p, index) {
|
22549 | if (typeof p !== 'string') {
|
22550 | throw new TypeError('Arguments to path.join must be strings');
|
22551 | }
|
22552 | return p;
|
22553 | }).join('/'));
|
22554 | };
|
22555 |
|
22556 |
|
22557 |
|
22558 |
|
22559 | exports.relative = function(from, to) {
|
22560 | from = exports.resolve(from).substr(1);
|
22561 | to = exports.resolve(to).substr(1);
|
22562 |
|
22563 | function trim(arr) {
|
22564 | var start = 0;
|
22565 | for (; start < arr.length; start++) {
|
22566 | if (arr[start] !== '') break;
|
22567 | }
|
22568 |
|
22569 | var end = arr.length - 1;
|
22570 | for (; end >= 0; end--) {
|
22571 | if (arr[end] !== '') break;
|
22572 | }
|
22573 |
|
22574 | if (start > end) return [];
|
22575 | return arr.slice(start, end - start + 1);
|
22576 | }
|
22577 |
|
22578 | var fromParts = trim(from.split('/'));
|
22579 | var toParts = trim(to.split('/'));
|
22580 |
|
22581 | var length = Math.min(fromParts.length, toParts.length);
|
22582 | var samePartsLength = length;
|
22583 | for (var i = 0; i < length; i++) {
|
22584 | if (fromParts[i] !== toParts[i]) {
|
22585 | samePartsLength = i;
|
22586 | break;
|
22587 | }
|
22588 | }
|
22589 |
|
22590 | var outputParts = [];
|
22591 | for (var i = samePartsLength; i < fromParts.length; i++) {
|
22592 | outputParts.push('..');
|
22593 | }
|
22594 |
|
22595 | outputParts = outputParts.concat(toParts.slice(samePartsLength));
|
22596 |
|
22597 | return outputParts.join('/');
|
22598 | };
|
22599 |
|
22600 | exports.sep = '/';
|
22601 | exports.delimiter = ':';
|
22602 |
|
22603 | exports.dirname = function (path) {
|
22604 | if (typeof path !== 'string') path = path + '';
|
22605 | if (path.length === 0) return '.';
|
22606 | var code = path.charCodeAt(0);
|
22607 | var hasRoot = code === 47 ;
|
22608 | var end = -1;
|
22609 | var matchedSlash = true;
|
22610 | for (var i = path.length - 1; i >= 1; --i) {
|
22611 | code = path.charCodeAt(i);
|
22612 | if (code === 47 ) {
|
22613 | if (!matchedSlash) {
|
22614 | end = i;
|
22615 | break;
|
22616 | }
|
22617 | } else {
|
22618 |
|
22619 | matchedSlash = false;
|
22620 | }
|
22621 | }
|
22622 |
|
22623 | if (end === -1) return hasRoot ? '/' : '.';
|
22624 | if (hasRoot && end === 1) {
|
22625 |
|
22626 |
|
22627 | return '/';
|
22628 | }
|
22629 | return path.slice(0, end);
|
22630 | };
|
22631 |
|
22632 | function basename(path) {
|
22633 | if (typeof path !== 'string') path = path + '';
|
22634 |
|
22635 | var start = 0;
|
22636 | var end = -1;
|
22637 | var matchedSlash = true;
|
22638 | var i;
|
22639 |
|
22640 | for (i = path.length - 1; i >= 0; --i) {
|
22641 | if (path.charCodeAt(i) === 47 ) {
|
22642 |
|
22643 |
|
22644 | if (!matchedSlash) {
|
22645 | start = i + 1;
|
22646 | break;
|
22647 | }
|
22648 | } else if (end === -1) {
|
22649 |
|
22650 |
|
22651 | matchedSlash = false;
|
22652 | end = i + 1;
|
22653 | }
|
22654 | }
|
22655 |
|
22656 | if (end === -1) return '';
|
22657 | return path.slice(start, end);
|
22658 | }
|
22659 |
|
22660 |
|
22661 |
|
22662 | exports.basename = function (path, ext) {
|
22663 | var f = basename(path);
|
22664 | if (ext && f.substr(-1 * ext.length) === ext) {
|
22665 | f = f.substr(0, f.length - ext.length);
|
22666 | }
|
22667 | return f;
|
22668 | };
|
22669 |
|
22670 | exports.extname = function (path) {
|
22671 | if (typeof path !== 'string') path = path + '';
|
22672 | var startDot = -1;
|
22673 | var startPart = 0;
|
22674 | var end = -1;
|
22675 | var matchedSlash = true;
|
22676 |
|
22677 |
|
22678 | var preDotState = 0;
|
22679 | for (var i = path.length - 1; i >= 0; --i) {
|
22680 | var code = path.charCodeAt(i);
|
22681 | if (code === 47 ) {
|
22682 |
|
22683 |
|
22684 | if (!matchedSlash) {
|
22685 | startPart = i + 1;
|
22686 | break;
|
22687 | }
|
22688 | continue;
|
22689 | }
|
22690 | if (end === -1) {
|
22691 |
|
22692 |
|
22693 | matchedSlash = false;
|
22694 | end = i + 1;
|
22695 | }
|
22696 | if (code === 46 ) {
|
22697 |
|
22698 | if (startDot === -1)
|
22699 | startDot = i;
|
22700 | else if (preDotState !== 1)
|
22701 | preDotState = 1;
|
22702 | } else if (startDot !== -1) {
|
22703 |
|
22704 |
|
22705 | preDotState = -1;
|
22706 | }
|
22707 | }
|
22708 |
|
22709 | if (startDot === -1 || end === -1 ||
|
22710 |
|
22711 | preDotState === 0 ||
|
22712 |
|
22713 | preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) {
|
22714 | return '';
|
22715 | }
|
22716 | return path.slice(startDot, end);
|
22717 | };
|
22718 |
|
22719 | function filter (xs, f) {
|
22720 | if (xs.filter) return xs.filter(f);
|
22721 | var res = [];
|
22722 | for (var i = 0; i < xs.length; i++) {
|
22723 | if (f(xs[i], i, xs)) res.push(xs[i]);
|
22724 | }
|
22725 | return res;
|
22726 | }
|
22727 |
|
22728 |
|
22729 | var substr = 'ab'.substr(-1) === 'b'
|
22730 | ? function (str, start, len) { return str.substr(start, len) }
|
22731 | : function (str, start, len) {
|
22732 | if (start < 0) start = str.length + start;
|
22733 | return str.substr(start, len);
|
22734 | }
|
22735 | ;
|
22736 |
|
22737 | }).call(this,require('_process'))
|
22738 | },{"_process":393}],317:[function(require,module,exports){
|
22739 | (function (global){
|
22740 |
|
22741 |
|
22742 |
|
22743 |
|
22744 |
|
22745 |
|
22746 | ;(function() {
|
22747 | 'use strict';
|
22748 |
|
22749 |
|
22750 | var objectTypes = {
|
22751 | 'function': true,
|
22752 | 'object': true
|
22753 | };
|
22754 |
|
22755 |
|
22756 | var root = (objectTypes[typeof window] && window) || this;
|
22757 |
|
22758 |
|
22759 | var oldRoot = root;
|
22760 |
|
22761 |
|
22762 | var freeExports = objectTypes[typeof exports] && exports;
|
22763 |
|
22764 |
|
22765 | var freeModule = objectTypes[typeof module] && module && !module.nodeType && module;
|
22766 |
|
22767 |
|
22768 | var freeGlobal = freeExports && freeModule && typeof global == 'object' && global;
|
22769 | if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal || freeGlobal.self === freeGlobal)) {
|
22770 | root = freeGlobal;
|
22771 | }
|
22772 |
|
22773 | |
22774 |
|
22775 |
|
22776 |
|
22777 |
|
22778 | var maxSafeInteger = Math.pow(2, 53) - 1;
|
22779 |
|
22780 |
|
22781 | var reOpera = /\bOpera/;
|
22782 |
|
22783 |
|
22784 | var thisBinding = this;
|
22785 |
|
22786 |
|
22787 | var objectProto = Object.prototype;
|
22788 |
|
22789 |
|
22790 | var hasOwnProperty = objectProto.hasOwnProperty;
|
22791 |
|
22792 |
|
22793 | var toString = objectProto.toString;
|
22794 |
|
22795 |
|
22796 |
|
22797 | |
22798 |
|
22799 |
|
22800 |
|
22801 |
|
22802 |
|
22803 |
|
22804 | function capitalize(string) {
|
22805 | string = String(string);
|
22806 | return string.charAt(0).toUpperCase() + string.slice(1);
|
22807 | }
|
22808 |
|
22809 | |
22810 |
|
22811 |
|
22812 |
|
22813 |
|
22814 |
|
22815 |
|
22816 |
|
22817 | function cleanupOS(os, pattern, label) {
|
22818 |
|
22819 |
|
22820 |
|
22821 | var data = {
|
22822 | '10.0': '10',
|
22823 | '6.4': '10 Technical Preview',
|
22824 | '6.3': '8.1',
|
22825 | '6.2': '8',
|
22826 | '6.1': 'Server 2008 R2 / 7',
|
22827 | '6.0': 'Server 2008 / Vista',
|
22828 | '5.2': 'Server 2003 / XP 64-bit',
|
22829 | '5.1': 'XP',
|
22830 | '5.01': '2000 SP1',
|
22831 | '5.0': '2000',
|
22832 | '4.0': 'NT',
|
22833 | '4.90': 'ME'
|
22834 | };
|
22835 |
|
22836 | if (pattern && label && /^Win/i.test(os) && !/^Windows Phone /i.test(os) &&
|
22837 | (data = data[/[\d.]+$/.exec(os)])) {
|
22838 | os = 'Windows ' + data;
|
22839 | }
|
22840 |
|
22841 | os = String(os);
|
22842 |
|
22843 | if (pattern && label) {
|
22844 | os = os.replace(RegExp(pattern, 'i'), label);
|
22845 | }
|
22846 |
|
22847 | os = format(
|
22848 | os.replace(/ ce$/i, ' CE')
|
22849 | .replace(/\bhpw/i, 'web')
|
22850 | .replace(/\bMacintosh\b/, 'Mac OS')
|
22851 | .replace(/_PowerPC\b/i, ' OS')
|
22852 | .replace(/\b(OS X) [^ \d]+/i, '$1')
|
22853 | .replace(/\bMac (OS X)\b/, '$1')
|
22854 | .replace(/\/(\d)/, ' $1')
|
22855 | .replace(/_/g, '.')
|
22856 | .replace(/(?: BePC|[ .]*fc[ \d.]+)$/i, '')
|
22857 | .replace(/\bx86\.64\b/gi, 'x86_64')
|
22858 | .replace(/\b(Windows Phone) OS\b/, '$1')
|
22859 | .replace(/\b(Chrome OS \w+) [\d.]+\b/, '$1')
|
22860 | .split(' on ')[0]
|
22861 | );
|
22862 |
|
22863 | return os;
|
22864 | }
|
22865 |
|
22866 | |
22867 |
|
22868 |
|
22869 |
|
22870 |
|
22871 |
|
22872 |
|
22873 | function each(object, callback) {
|
22874 | var index = -1,
|
22875 | length = object ? object.length : 0;
|
22876 |
|
22877 | if (typeof length == 'number' && length > -1 && length <= maxSafeInteger) {
|
22878 | while (++index < length) {
|
22879 | callback(object[index], index, object);
|
22880 | }
|
22881 | } else {
|
22882 | forOwn(object, callback);
|
22883 | }
|
22884 | }
|
22885 |
|
22886 | |
22887 |
|
22888 |
|
22889 |
|
22890 |
|
22891 |
|
22892 |
|
22893 | function format(string) {
|
22894 | string = trim(string);
|
22895 | return /^(?:webOS|i(?:OS|P))/.test(string)
|
22896 | ? string
|
22897 | : capitalize(string);
|
22898 | }
|
22899 |
|
22900 | |
22901 |
|
22902 |
|
22903 |
|
22904 |
|
22905 |
|
22906 |
|
22907 | function forOwn(object, callback) {
|
22908 | for (var key in object) {
|
22909 | if (hasOwnProperty.call(object, key)) {
|
22910 | callback(object[key], key, object);
|
22911 | }
|
22912 | }
|
22913 | }
|
22914 |
|
22915 | |
22916 |
|
22917 |
|
22918 |
|
22919 |
|
22920 |
|
22921 |
|
22922 | function getClassOf(value) {
|
22923 | return value == null
|
22924 | ? capitalize(value)
|
22925 | : toString.call(value).slice(8, -1);
|
22926 | }
|
22927 |
|
22928 | |
22929 |
|
22930 |
|
22931 |
|
22932 |
|
22933 |
|
22934 |
|
22935 |
|
22936 |
|
22937 |
|
22938 | function isHostType(object, property) {
|
22939 | var type = object != null ? typeof object[property] : 'number';
|
22940 | return !/^(?:boolean|number|string|undefined)$/.test(type) &&
|
22941 | (type == 'object' ? !!object[property] : true);
|
22942 | }
|
22943 |
|
22944 | |
22945 |
|
22946 |
|
22947 |
|
22948 |
|
22949 |
|
22950 |
|
22951 | function qualify(string) {
|
22952 | return String(string).replace(/([ -])(?!$)/g, '$1?');
|
22953 | }
|
22954 |
|
22955 | |
22956 |
|
22957 |
|
22958 |
|
22959 |
|
22960 |
|
22961 |
|
22962 |
|
22963 | function reduce(array, callback) {
|
22964 | var accumulator = null;
|
22965 | each(array, function(value, index) {
|
22966 | accumulator = callback(accumulator, value, index, array);
|
22967 | });
|
22968 | return accumulator;
|
22969 | }
|
22970 |
|
22971 | |
22972 |
|
22973 |
|
22974 |
|
22975 |
|
22976 |
|
22977 |
|
22978 | function trim(string) {
|
22979 | return String(string).replace(/^ +| +$/g, '');
|
22980 | }
|
22981 |
|
22982 |
|
22983 |
|
22984 | |
22985 |
|
22986 |
|
22987 |
|
22988 |
|
22989 |
|
22990 |
|
22991 |
|
22992 | function parse(ua) {
|
22993 |
|
22994 |
|
22995 | var context = root;
|
22996 |
|
22997 |
|
22998 | var isCustomContext = ua && typeof ua == 'object' && getClassOf(ua) != 'String';
|
22999 |
|
23000 |
|
23001 | if (isCustomContext) {
|
23002 | context = ua;
|
23003 | ua = null;
|
23004 | }
|
23005 |
|
23006 |
|
23007 | var nav = context.navigator || {};
|
23008 |
|
23009 |
|
23010 | var userAgent = nav.userAgent || '';
|
23011 |
|
23012 | ua || (ua = userAgent);
|
23013 |
|
23014 |
|
23015 | var isModuleScope = isCustomContext || thisBinding == oldRoot;
|
23016 |
|
23017 |
|
23018 | var likeChrome = isCustomContext
|
23019 | ? !!nav.likeChrome
|
23020 | : /\bChrome\b/.test(ua) && !/internal|\n/i.test(toString.toString());
|
23021 |
|
23022 |
|
23023 | var objectClass = 'Object',
|
23024 | airRuntimeClass = isCustomContext ? objectClass : 'ScriptBridgingProxyObject',
|
23025 | enviroClass = isCustomContext ? objectClass : 'Environment',
|
23026 | javaClass = (isCustomContext && context.java) ? 'JavaPackage' : getClassOf(context.java),
|
23027 | phantomClass = isCustomContext ? objectClass : 'RuntimeObject';
|
23028 |
|
23029 |
|
23030 | var java = /\bJava/.test(javaClass) && context.java;
|
23031 |
|
23032 |
|
23033 | var rhino = java && getClassOf(context.environment) == enviroClass;
|
23034 |
|
23035 |
|
23036 | var alpha = java ? 'a' : '\u03b1';
|
23037 |
|
23038 |
|
23039 | var beta = java ? 'b' : '\u03b2';
|
23040 |
|
23041 |
|
23042 | var doc = context.document || {};
|
23043 |
|
23044 | |
23045 |
|
23046 |
|
23047 |
|
23048 |
|
23049 | var opera = context.operamini || context.opera;
|
23050 |
|
23051 |
|
23052 | var operaClass = reOpera.test(operaClass = (isCustomContext && opera) ? opera['[[Class]]'] : getClassOf(opera))
|
23053 | ? operaClass
|
23054 | : (opera = null);
|
23055 |
|
23056 |
|
23057 |
|
23058 |
|
23059 | var data;
|
23060 |
|
23061 |
|
23062 | var arch = ua;
|
23063 |
|
23064 |
|
23065 | var description = [];
|
23066 |
|
23067 |
|
23068 | var prerelease = null;
|
23069 |
|
23070 |
|
23071 | var useFeatures = ua == userAgent;
|
23072 |
|
23073 |
|
23074 | var version = useFeatures && opera && typeof opera.version == 'function' && opera.version();
|
23075 |
|
23076 |
|
23077 | var isSpecialCasedOS;
|
23078 |
|
23079 |
|
23080 | var layout = getLayout([
|
23081 | { 'label': 'EdgeHTML', 'pattern': 'Edge' },
|
23082 | 'Trident',
|
23083 | { 'label': 'WebKit', 'pattern': 'AppleWebKit' },
|
23084 | 'iCab',
|
23085 | 'Presto',
|
23086 | 'NetFront',
|
23087 | 'Tasman',
|
23088 | 'KHTML',
|
23089 | 'Gecko'
|
23090 | ]);
|
23091 |
|
23092 |
|
23093 | var name = getName([
|
23094 | 'Adobe AIR',
|
23095 | 'Arora',
|
23096 | 'Avant Browser',
|
23097 | 'Breach',
|
23098 | 'Camino',
|
23099 | 'Electron',
|
23100 | 'Epiphany',
|
23101 | 'Fennec',
|
23102 | 'Flock',
|
23103 | 'Galeon',
|
23104 | 'GreenBrowser',
|
23105 | 'iCab',
|
23106 | 'Iceweasel',
|
23107 | 'K-Meleon',
|
23108 | 'Konqueror',
|
23109 | 'Lunascape',
|
23110 | 'Maxthon',
|
23111 | { 'label': 'Microsoft Edge', 'pattern': 'Edge' },
|
23112 | 'Midori',
|
23113 | 'Nook Browser',
|
23114 | 'PaleMoon',
|
23115 | 'PhantomJS',
|
23116 | 'Raven',
|
23117 | 'Rekonq',
|
23118 | 'RockMelt',
|
23119 | { 'label': 'Samsung Internet', 'pattern': 'SamsungBrowser' },
|
23120 | 'SeaMonkey',
|
23121 | { 'label': 'Silk', 'pattern': '(?:Cloud9|Silk-Accelerated)' },
|
23122 | 'Sleipnir',
|
23123 | 'SlimBrowser',
|
23124 | { 'label': 'SRWare Iron', 'pattern': 'Iron' },
|
23125 | 'Sunrise',
|
23126 | 'Swiftfox',
|
23127 | 'Waterfox',
|
23128 | 'WebPositive',
|
23129 | 'Opera Mini',
|
23130 | { 'label': 'Opera Mini', 'pattern': 'OPiOS' },
|
23131 | 'Opera',
|
23132 | { 'label': 'Opera', 'pattern': 'OPR' },
|
23133 | 'Chrome',
|
23134 | { 'label': 'Chrome Mobile', 'pattern': '(?:CriOS|CrMo)' },
|
23135 | { 'label': 'Firefox', 'pattern': '(?:Firefox|Minefield)' },
|
23136 | { 'label': 'Firefox for iOS', 'pattern': 'FxiOS' },
|
23137 | { 'label': 'IE', 'pattern': 'IEMobile' },
|
23138 | { 'label': 'IE', 'pattern': 'MSIE' },
|
23139 | 'Safari'
|
23140 | ]);
|
23141 |
|
23142 |
|
23143 | var product = getProduct([
|
23144 | { 'label': 'BlackBerry', 'pattern': 'BB10' },
|
23145 | 'BlackBerry',
|
23146 | { 'label': 'Galaxy S', 'pattern': 'GT-I9000' },
|
23147 | { 'label': 'Galaxy S2', 'pattern': 'GT-I9100' },
|
23148 | { 'label': 'Galaxy S3', 'pattern': 'GT-I9300' },
|
23149 | { 'label': 'Galaxy S4', 'pattern': 'GT-I9500' },
|
23150 | { 'label': 'Galaxy S5', 'pattern': 'SM-G900' },
|
23151 | { 'label': 'Galaxy S6', 'pattern': 'SM-G920' },
|
23152 | { 'label': 'Galaxy S6 Edge', 'pattern': 'SM-G925' },
|
23153 | { 'label': 'Galaxy S7', 'pattern': 'SM-G930' },
|
23154 | { 'label': 'Galaxy S7 Edge', 'pattern': 'SM-G935' },
|
23155 | 'Google TV',
|
23156 | 'Lumia',
|
23157 | 'iPad',
|
23158 | 'iPod',
|
23159 | 'iPhone',
|
23160 | 'Kindle',
|
23161 | { 'label': 'Kindle Fire', 'pattern': '(?:Cloud9|Silk-Accelerated)' },
|
23162 | 'Nexus',
|
23163 | 'Nook',
|
23164 | 'PlayBook',
|
23165 | 'PlayStation Vita',
|
23166 | 'PlayStation',
|
23167 | 'TouchPad',
|
23168 | 'Transformer',
|
23169 | { 'label': 'Wii U', 'pattern': 'WiiU' },
|
23170 | 'Wii',
|
23171 | 'Xbox One',
|
23172 | { 'label': 'Xbox 360', 'pattern': 'Xbox' },
|
23173 | 'Xoom'
|
23174 | ]);
|
23175 |
|
23176 |
|
23177 | var manufacturer = getManufacturer({
|
23178 | 'Apple': { 'iPad': 1, 'iPhone': 1, 'iPod': 1 },
|
23179 | 'Archos': {},
|
23180 | 'Amazon': { 'Kindle': 1, 'Kindle Fire': 1 },
|
23181 | 'Asus': { 'Transformer': 1 },
|
23182 | 'Barnes & Noble': { 'Nook': 1 },
|
23183 | 'BlackBerry': { 'PlayBook': 1 },
|
23184 | 'Google': { 'Google TV': 1, 'Nexus': 1 },
|
23185 | 'HP': { 'TouchPad': 1 },
|
23186 | 'HTC': {},
|
23187 | 'LG': {},
|
23188 | 'Microsoft': { 'Xbox': 1, 'Xbox One': 1 },
|
23189 | 'Motorola': { 'Xoom': 1 },
|
23190 | 'Nintendo': { 'Wii U': 1, 'Wii': 1 },
|
23191 | 'Nokia': { 'Lumia': 1 },
|
23192 | 'Samsung': { 'Galaxy S': 1, 'Galaxy S2': 1, 'Galaxy S3': 1, 'Galaxy S4': 1 },
|
23193 | 'Sony': { 'PlayStation': 1, 'PlayStation Vita': 1 }
|
23194 | });
|
23195 |
|
23196 |
|
23197 | var os = getOS([
|
23198 | 'Windows Phone',
|
23199 | 'Android',
|
23200 | 'CentOS',
|
23201 | { 'label': 'Chrome OS', 'pattern': 'CrOS' },
|
23202 | 'Debian',
|
23203 | 'Fedora',
|
23204 | 'FreeBSD',
|
23205 | 'Gentoo',
|
23206 | 'Haiku',
|
23207 | 'Kubuntu',
|
23208 | 'Linux Mint',
|
23209 | 'OpenBSD',
|
23210 | 'Red Hat',
|
23211 | 'SuSE',
|
23212 | 'Ubuntu',
|
23213 | 'Xubuntu',
|
23214 | 'Cygwin',
|
23215 | 'Symbian OS',
|
23216 | 'hpwOS',
|
23217 | 'webOS ',
|
23218 | 'webOS',
|
23219 | 'Tablet OS',
|
23220 | 'Tizen',
|
23221 | 'Linux',
|
23222 | 'Mac OS X',
|
23223 | 'Macintosh',
|
23224 | 'Mac',
|
23225 | 'Windows 98;',
|
23226 | 'Windows '
|
23227 | ]);
|
23228 |
|
23229 |
|
23230 |
|
23231 | |
23232 |
|
23233 |
|
23234 |
|
23235 |
|
23236 |
|
23237 |
|
23238 | function getLayout(guesses) {
|
23239 | return reduce(guesses, function(result, guess) {
|
23240 | return result || RegExp('\\b' + (
|
23241 | guess.pattern || qualify(guess)
|
23242 | ) + '\\b', 'i').exec(ua) && (guess.label || guess);
|
23243 | });
|
23244 | }
|
23245 |
|
23246 | |
23247 |
|
23248 |
|
23249 |
|
23250 |
|
23251 |
|
23252 |
|
23253 | function getManufacturer(guesses) {
|
23254 | return reduce(guesses, function(result, value, key) {
|
23255 |
|
23256 | return result || (
|
23257 | value[product] ||
|
23258 | value[/^[a-z]+(?: +[a-z]+\b)*/i.exec(product)] ||
|
23259 | RegExp('\\b' + qualify(key) + '(?:\\b|\\w*\\d)', 'i').exec(ua)
|
23260 | ) && key;
|
23261 | });
|
23262 | }
|
23263 |
|
23264 | |
23265 |
|
23266 |
|
23267 |
|
23268 |
|
23269 |
|
23270 |
|
23271 | function getName(guesses) {
|
23272 | return reduce(guesses, function(result, guess) {
|
23273 | return result || RegExp('\\b' + (
|
23274 | guess.pattern || qualify(guess)
|
23275 | ) + '\\b', 'i').exec(ua) && (guess.label || guess);
|
23276 | });
|
23277 | }
|
23278 |
|
23279 | |
23280 |
|
23281 |
|
23282 |
|
23283 |
|
23284 |
|
23285 |
|
23286 | function getOS(guesses) {
|
23287 | return reduce(guesses, function(result, guess) {
|
23288 | var pattern = guess.pattern || qualify(guess);
|
23289 | if (!result && (result =
|
23290 | RegExp('\\b' + pattern + '(?:/[\\d.]+|[ \\w.]*)', 'i').exec(ua)
|
23291 | )) {
|
23292 | result = cleanupOS(result, pattern, guess.label || guess);
|
23293 | }
|
23294 | return result;
|
23295 | });
|
23296 | }
|
23297 |
|
23298 | |
23299 |
|
23300 |
|
23301 |
|
23302 |
|
23303 |
|
23304 |
|
23305 | function getProduct(guesses) {
|
23306 | return reduce(guesses, function(result, guess) {
|
23307 | var pattern = guess.pattern || qualify(guess);
|
23308 | if (!result && (result =
|
23309 | RegExp('\\b' + pattern + ' *\\d+[.\\w_]*', 'i').exec(ua) ||
|
23310 | RegExp('\\b' + pattern + ' *\\w+-[\\w]*', 'i').exec(ua) ||
|
23311 | RegExp('\\b' + pattern + '(?:; *(?:[a-z]+[_-])?[a-z]+\\d+|[^ ();-]*)', 'i').exec(ua)
|
23312 | )) {
|
23313 |
|
23314 | if ((result = String((guess.label && !RegExp(pattern, 'i').test(guess.label)) ? guess.label : result).split('/'))[1] && !/[\d.]+/.test(result[0])) {
|
23315 | result[0] += ' ' + result[1];
|
23316 | }
|
23317 |
|
23318 | guess = guess.label || guess;
|
23319 | result = format(result[0]
|
23320 | .replace(RegExp(pattern, 'i'), guess)
|
23321 | .replace(RegExp('; *(?:' + guess + '[_-])?', 'i'), ' ')
|
23322 | .replace(RegExp('(' + guess + ')[-_.]?(\\w)', 'i'), '$1 $2'));
|
23323 | }
|
23324 | return result;
|
23325 | });
|
23326 | }
|
23327 |
|
23328 | |
23329 |
|
23330 |
|
23331 |
|
23332 |
|
23333 |
|
23334 |
|
23335 | function getVersion(patterns) {
|
23336 | return reduce(patterns, function(result, pattern) {
|
23337 | return result || (RegExp(pattern +
|
23338 | '(?:-[\\d.]+/|(?: for [\\w-]+)?[ /-])([\\d.]+[^ ();/_-]*)', 'i').exec(ua) || 0)[1] || null;
|
23339 | });
|
23340 | }
|
23341 |
|
23342 | |
23343 |
|
23344 |
|
23345 |
|
23346 |
|
23347 |
|
23348 |
|
23349 | function toStringPlatform() {
|
23350 | return this.description || '';
|
23351 | }
|
23352 |
|
23353 |
|
23354 |
|
23355 |
|
23356 | layout && (layout = [layout]);
|
23357 |
|
23358 |
|
23359 | if (manufacturer && !product) {
|
23360 | product = getProduct([manufacturer]);
|
23361 | }
|
23362 |
|
23363 | if ((data = /\bGoogle TV\b/.exec(product))) {
|
23364 | product = data[0];
|
23365 | }
|
23366 |
|
23367 | if (/\bSimulator\b/i.test(ua)) {
|
23368 | product = (product ? product + ' ' : '') + 'Simulator';
|
23369 | }
|
23370 |
|
23371 | if (name == 'Opera Mini' && /\bOPiOS\b/.test(ua)) {
|
23372 | description.push('running in Turbo/Uncompressed mode');
|
23373 | }
|
23374 |
|
23375 | if (name == 'IE' && /\blike iPhone OS\b/.test(ua)) {
|
23376 | data = parse(ua.replace(/like iPhone OS/, ''));
|
23377 | manufacturer = data.manufacturer;
|
23378 | product = data.product;
|
23379 | }
|
23380 |
|
23381 | else if (/^iP/.test(product)) {
|
23382 | name || (name = 'Safari');
|
23383 | os = 'iOS' + ((data = / OS ([\d_]+)/i.exec(ua))
|
23384 | ? ' ' + data[1].replace(/_/g, '.')
|
23385 | : '');
|
23386 | }
|
23387 |
|
23388 | else if (name == 'Konqueror' && !/buntu/i.test(os)) {
|
23389 | os = 'Kubuntu';
|
23390 | }
|
23391 |
|
23392 | else if ((manufacturer && manufacturer != 'Google' &&
|
23393 | ((/Chrome/.test(name) && !/\bMobile Safari\b/i.test(ua)) || /\bVita\b/.test(product))) ||
|
23394 | (/\bAndroid\b/.test(os) && /^Chrome/.test(name) && /\bVersion\//i.test(ua))) {
|
23395 | name = 'Android Browser';
|
23396 | os = /\bAndroid\b/.test(os) ? os : 'Android';
|
23397 | }
|
23398 |
|
23399 | else if (name == 'Silk') {
|
23400 | if (!/\bMobi/i.test(ua)) {
|
23401 | os = 'Android';
|
23402 | description.unshift('desktop mode');
|
23403 | }
|
23404 | if (/Accelerated *= *true/i.test(ua)) {
|
23405 | description.unshift('accelerated');
|
23406 | }
|
23407 | }
|
23408 |
|
23409 | else if (name == 'PaleMoon' && (data = /\bFirefox\/([\d.]+)\b/.exec(ua))) {
|
23410 | description.push('identifying as Firefox ' + data[1]);
|
23411 | }
|
23412 |
|
23413 | else if (name == 'Firefox' && (data = /\b(Mobile|Tablet|TV)\b/i.exec(ua))) {
|
23414 | os || (os = 'Firefox OS');
|
23415 | product || (product = data[1]);
|
23416 | }
|
23417 |
|
23418 | else if (!name || (data = !/\bMinefield\b/i.test(ua) && /\b(?:Firefox|Safari)\b/.exec(name))) {
|
23419 |
|
23420 | if (name && !product && /[\/,]|^[^(]+?\)/.test(ua.slice(ua.indexOf(data + '/') + 8))) {
|
23421 |
|
23422 | name = null;
|
23423 | }
|
23424 |
|
23425 | if ((data = product || manufacturer || os) &&
|
23426 | (product || manufacturer || /\b(?:Android|Symbian OS|Tablet OS|webOS)\b/.test(os))) {
|
23427 | name = /[a-z]+(?: Hat)?/i.exec(/\bAndroid\b/.test(os) ? os : data) + ' Browser';
|
23428 | }
|
23429 | }
|
23430 |
|
23431 | else if (name == 'Electron' && (data = (/\bChrome\/([\d.]+)\b/.exec(ua) || 0)[1])) {
|
23432 | description.push('Chromium ' + data);
|
23433 | }
|
23434 |
|
23435 | if (!version) {
|
23436 | version = getVersion([
|
23437 | '(?:Cloud9|CriOS|CrMo|Edge|FxiOS|IEMobile|Iron|Opera ?Mini|OPiOS|OPR|Raven|SamsungBrowser|Silk(?!/[\\d.]+$))',
|
23438 | 'Version',
|
23439 | qualify(name),
|
23440 | '(?:Firefox|Minefield|NetFront)'
|
23441 | ]);
|
23442 | }
|
23443 |
|
23444 | if ((data =
|
23445 | layout == 'iCab' && parseFloat(version) > 3 && 'WebKit' ||
|
23446 | /\bOpera\b/.test(name) && (/\bOPR\b/.test(ua) ? 'Blink' : 'Presto') ||
|
23447 | /\b(?:Midori|Nook|Safari)\b/i.test(ua) && !/^(?:Trident|EdgeHTML)$/.test(layout) && 'WebKit' ||
|
23448 | !layout && /\bMSIE\b/i.test(ua) && (os == 'Mac OS' ? 'Tasman' : 'Trident') ||
|
23449 | layout == 'WebKit' && /\bPlayStation\b(?! Vita\b)/i.test(name) && 'NetFront'
|
23450 | )) {
|
23451 | layout = [data];
|
23452 | }
|
23453 |
|
23454 | if (name == 'IE' && (data = (/; *(?:XBLWP|ZuneWP)(\d+)/i.exec(ua) || 0)[1])) {
|
23455 | name += ' Mobile';
|
23456 | os = 'Windows Phone ' + (/\+$/.test(data) ? data : data + '.x');
|
23457 | description.unshift('desktop mode');
|
23458 | }
|
23459 |
|
23460 | else if (/\bWPDesktop\b/i.test(ua)) {
|
23461 | name = 'IE Mobile';
|
23462 | os = 'Windows Phone 8.x';
|
23463 | description.unshift('desktop mode');
|
23464 | version || (version = (/\brv:([\d.]+)/.exec(ua) || 0)[1]);
|
23465 | }
|
23466 |
|
23467 | else if (name != 'IE' && layout == 'Trident' && (data = /\brv:([\d.]+)/.exec(ua))) {
|
23468 | if (name) {
|
23469 | description.push('identifying as ' + name + (version ? ' ' + version : ''));
|
23470 | }
|
23471 | name = 'IE';
|
23472 | version = data[1];
|
23473 | }
|
23474 |
|
23475 | if (useFeatures) {
|
23476 |
|
23477 |
|
23478 | if (isHostType(context, 'global')) {
|
23479 | if (java) {
|
23480 | data = java.lang.System;
|
23481 | arch = data.getProperty('os.arch');
|
23482 | os = os || data.getProperty('os.name') + ' ' + data.getProperty('os.version');
|
23483 | }
|
23484 | if (rhino) {
|
23485 | try {
|
23486 | version = context.require('ringo/engine').version.join('.');
|
23487 | name = 'RingoJS';
|
23488 | } catch(e) {
|
23489 | if ((data = context.system) && data.global.system == context.system) {
|
23490 | name = 'Narwhal';
|
23491 | os || (os = data[0].os || null);
|
23492 | }
|
23493 | }
|
23494 | if (!name) {
|
23495 | name = 'Rhino';
|
23496 | }
|
23497 | }
|
23498 | else if (
|
23499 | typeof context.process == 'object' && !context.process.browser &&
|
23500 | (data = context.process)
|
23501 | ) {
|
23502 | if (typeof data.versions == 'object') {
|
23503 | if (typeof data.versions.electron == 'string') {
|
23504 | description.push('Node ' + data.versions.node);
|
23505 | name = 'Electron';
|
23506 | version = data.versions.electron;
|
23507 | } else if (typeof data.versions.nw == 'string') {
|
23508 | description.push('Chromium ' + version, 'Node ' + data.versions.node);
|
23509 | name = 'NW.js';
|
23510 | version = data.versions.nw;
|
23511 | }
|
23512 | }
|
23513 | if (!name) {
|
23514 | name = 'Node.js';
|
23515 | arch = data.arch;
|
23516 | os = data.platform;
|
23517 | version = /[\d.]+/.exec(data.version);
|
23518 | version = version ? version[0] : null;
|
23519 | }
|
23520 | }
|
23521 | }
|
23522 |
|
23523 | else if (getClassOf((data = context.runtime)) == airRuntimeClass) {
|
23524 | name = 'Adobe AIR';
|
23525 | os = data.flash.system.Capabilities.os;
|
23526 | }
|
23527 |
|
23528 | else if (getClassOf((data = context.phantom)) == phantomClass) {
|
23529 | name = 'PhantomJS';
|
23530 | version = (data = data.version || null) && (data.major + '.' + data.minor + '.' + data.patch);
|
23531 | }
|
23532 |
|
23533 | else if (typeof doc.documentMode == 'number' && (data = /\bTrident\/(\d+)/i.exec(ua))) {
|
23534 |
|
23535 |
|
23536 | version = [version, doc.documentMode];
|
23537 | if ((data = +data[1] + 4) != version[1]) {
|
23538 | description.push('IE ' + version[1] + ' mode');
|
23539 | layout && (layout[1] = '');
|
23540 | version[1] = data;
|
23541 | }
|
23542 | version = name == 'IE' ? String(version[1].toFixed(1)) : version[0];
|
23543 | }
|
23544 |
|
23545 | else if (typeof doc.documentMode == 'number' && /^(?:Chrome|Firefox)\b/.test(name)) {
|
23546 | description.push('masking as ' + name + ' ' + version);
|
23547 | name = 'IE';
|
23548 | version = '11.0';
|
23549 | layout = ['Trident'];
|
23550 | os = 'Windows';
|
23551 | }
|
23552 | os = os && format(os);
|
23553 | }
|
23554 |
|
23555 | if (version && (data =
|
23556 | /(?:[ab]|dp|pre|[ab]\d+pre)(?:\d+\+?)?$/i.exec(version) ||
|
23557 | /(?:alpha|beta)(?: ?\d)?/i.exec(ua + ';' + (useFeatures && nav.appMinorVersion)) ||
|
23558 | /\bMinefield\b/i.test(ua) && 'a'
|
23559 | )) {
|
23560 | prerelease = /b/i.test(data) ? 'beta' : 'alpha';
|
23561 | version = version.replace(RegExp(data + '\\+?$'), '') +
|
23562 | (prerelease == 'beta' ? beta : alpha) + (/\d+\+?/.exec(data) || '');
|
23563 | }
|
23564 |
|
23565 | if (name == 'Fennec' || name == 'Firefox' && /\b(?:Android|Firefox OS)\b/.test(os)) {
|
23566 | name = 'Firefox Mobile';
|
23567 | }
|
23568 |
|
23569 | else if (name == 'Maxthon' && version) {
|
23570 | version = version.replace(/\.[\d.]+/, '.x');
|
23571 | }
|
23572 |
|
23573 | else if (/\bXbox\b/i.test(product)) {
|
23574 | if (product == 'Xbox 360') {
|
23575 | os = null;
|
23576 | }
|
23577 | if (product == 'Xbox 360' && /\bIEMobile\b/.test(ua)) {
|
23578 | description.unshift('mobile mode');
|
23579 | }
|
23580 | }
|
23581 |
|
23582 | else if ((/^(?:Chrome|IE|Opera)$/.test(name) || name && !product && !/Browser|Mobi/.test(name)) &&
|
23583 | (os == 'Windows CE' || /Mobi/i.test(ua))) {
|
23584 | name += ' Mobile';
|
23585 | }
|
23586 |
|
23587 | else if (name == 'IE' && useFeatures) {
|
23588 | try {
|
23589 | if (context.external === null) {
|
23590 | description.unshift('platform preview');
|
23591 | }
|
23592 | } catch(e) {
|
23593 | description.unshift('embedded');
|
23594 | }
|
23595 | }
|
23596 |
|
23597 |
|
23598 | else if ((/\bBlackBerry\b/.test(product) || /\bBB10\b/.test(ua)) && (data =
|
23599 | (RegExp(product.replace(/ +/g, ' *') + '/([.\\d]+)', 'i').exec(ua) || 0)[1] ||
|
23600 | version
|
23601 | )) {
|
23602 | data = [data, /BB10/.test(ua)];
|
23603 | os = (data[1] ? (product = null, manufacturer = 'BlackBerry') : 'Device Software') + ' ' + data[0];
|
23604 | version = null;
|
23605 | }
|
23606 |
|
23607 |
|
23608 | else if (this != forOwn && product != 'Wii' && (
|
23609 | (useFeatures && opera) ||
|
23610 | (/Opera/.test(name) && /\b(?:MSIE|Firefox)\b/i.test(ua)) ||
|
23611 | (name == 'Firefox' && /\bOS X (?:\d+\.){2,}/.test(os)) ||
|
23612 | (name == 'IE' && (
|
23613 | (os && !/^Win/.test(os) && version > 5.5) ||
|
23614 | /\bWindows XP\b/.test(os) && version > 8 ||
|
23615 | version == 8 && !/\bTrident\b/.test(ua)
|
23616 | ))
|
23617 | ) && !reOpera.test((data = parse.call(forOwn, ua.replace(reOpera, '') + ';'))) && data.name) {
|
23618 |
|
23619 | data = 'ing as ' + data.name + ((data = data.version) ? ' ' + data : '');
|
23620 | if (reOpera.test(name)) {
|
23621 | if (/\bIE\b/.test(data) && os == 'Mac OS') {
|
23622 | os = null;
|
23623 | }
|
23624 | data = 'identify' + data;
|
23625 | }
|
23626 |
|
23627 | else {
|
23628 | data = 'mask' + data;
|
23629 | if (operaClass) {
|
23630 | name = format(operaClass.replace(/([a-z])([A-Z])/g, '$1 $2'));
|
23631 | } else {
|
23632 | name = 'Opera';
|
23633 | }
|
23634 | if (/\bIE\b/.test(data)) {
|
23635 | os = null;
|
23636 | }
|
23637 | if (!useFeatures) {
|
23638 | version = null;
|
23639 | }
|
23640 | }
|
23641 | layout = ['Presto'];
|
23642 | description.push(data);
|
23643 | }
|
23644 |
|
23645 | if ((data = (/\bAppleWebKit\/([\d.]+\+?)/i.exec(ua) || 0)[1])) {
|
23646 |
|
23647 |
|
23648 | data = [parseFloat(data.replace(/\.(\d)$/, '.0$1')), data];
|
23649 |
|
23650 | if (name == 'Safari' && data[1].slice(-1) == '+') {
|
23651 | name = 'WebKit Nightly';
|
23652 | prerelease = 'alpha';
|
23653 | version = data[1].slice(0, -1);
|
23654 | }
|
23655 |
|
23656 | else if (version == data[1] ||
|
23657 | version == (data[2] = (/\bSafari\/([\d.]+\+?)/i.exec(ua) || 0)[1])) {
|
23658 | version = null;
|
23659 | }
|
23660 |
|
23661 | data[1] = (/\bChrome\/([\d.]+)/i.exec(ua) || 0)[1];
|
23662 |
|
23663 | if (data[0] == 537.36 && data[2] == 537.36 && parseFloat(data[1]) >= 28 && layout == 'WebKit') {
|
23664 | layout = ['Blink'];
|
23665 | }
|
23666 |
|
23667 |
|
23668 | if (!useFeatures || (!likeChrome && !data[1])) {
|
23669 | layout && (layout[1] = 'like Safari');
|
23670 | data = (data = data[0], data < 400 ? 1 : data < 500 ? 2 : data < 526 ? 3 : data < 533 ? 4 : data < 534 ? '4+' : data < 535 ? 5 : data < 537 ? 6 : data < 538 ? 7 : data < 601 ? 8 : '8');
|
23671 | } else {
|
23672 | layout && (layout[1] = 'like Chrome');
|
23673 | data = data[1] || (data = data[0], data < 530 ? 1 : data < 532 ? 2 : data < 532.05 ? 3 : data < 533 ? 4 : data < 534.03 ? 5 : data < 534.07 ? 6 : data < 534.10 ? 7 : data < 534.13 ? 8 : data < 534.16 ? 9 : data < 534.24 ? 10 : data < 534.30 ? 11 : data < 535.01 ? 12 : data < 535.02 ? '13+' : data < 535.07 ? 15 : data < 535.11 ? 16 : data < 535.19 ? 17 : data < 536.05 ? 18 : data < 536.10 ? 19 : data < 537.01 ? 20 : data < 537.11 ? '21+' : data < 537.13 ? 23 : data < 537.18 ? 24 : data < 537.24 ? 25 : data < 537.36 ? 26 : layout != 'Blink' ? '27' : '28');
|
23674 | }
|
23675 |
|
23676 | layout && (layout[1] += ' ' + (data += typeof data == 'number' ? '.x' : /[.+]/.test(data) ? '' : '+'));
|
23677 |
|
23678 | if (name == 'Safari' && (!version || parseInt(version) > 45)) {
|
23679 | version = data;
|
23680 | }
|
23681 | }
|
23682 |
|
23683 | if (name == 'Opera' && (data = /\bzbov|zvav$/.exec(os))) {
|
23684 | name += ' ';
|
23685 | description.unshift('desktop mode');
|
23686 | if (data == 'zvav') {
|
23687 | name += 'Mini';
|
23688 | version = null;
|
23689 | } else {
|
23690 | name += 'Mobile';
|
23691 | }
|
23692 | os = os.replace(RegExp(' *' + data + '$'), '');
|
23693 | }
|
23694 |
|
23695 | else if (name == 'Safari' && /\bChrome\b/.exec(layout && layout[1])) {
|
23696 | description.unshift('desktop mode');
|
23697 | name = 'Chrome Mobile';
|
23698 | version = null;
|
23699 |
|
23700 | if (/\bOS X\b/.test(os)) {
|
23701 | manufacturer = 'Apple';
|
23702 | os = 'iOS 4.3+';
|
23703 | } else {
|
23704 | os = null;
|
23705 | }
|
23706 | }
|
23707 |
|
23708 | if (version && version.indexOf((data = /[\d.]+$/.exec(os))) == 0 &&
|
23709 | ua.indexOf('/' + data + '-') > -1) {
|
23710 | os = trim(os.replace(data, ''));
|
23711 | }
|
23712 |
|
23713 | if (layout && !/\b(?:Avant|Nook)\b/.test(name) && (
|
23714 | /Browser|Lunascape|Maxthon/.test(name) ||
|
23715 | name != 'Safari' && /^iOS/.test(os) && /\bSafari\b/.test(layout[1]) ||
|
23716 | /^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Samsung Internet|Sleipnir|Web)/.test(name) && layout[1])) {
|
23717 |
|
23718 | (data = layout[layout.length - 1]) && description.push(data);
|
23719 | }
|
23720 |
|
23721 | if (description.length) {
|
23722 | description = ['(' + description.join('; ') + ')'];
|
23723 | }
|
23724 |
|
23725 | if (manufacturer && product && product.indexOf(manufacturer) < 0) {
|
23726 | description.push('on ' + manufacturer);
|
23727 | }
|
23728 |
|
23729 | if (product) {
|
23730 | description.push((/^on /.test(description[description.length - 1]) ? '' : 'on ') + product);
|
23731 | }
|
23732 |
|
23733 | if (os) {
|
23734 | data = / ([\d.+]+)$/.exec(os);
|
23735 | isSpecialCasedOS = data && os.charAt(os.length - data[0].length - 1) == '/';
|
23736 | os = {
|
23737 | 'architecture': 32,
|
23738 | 'family': (data && !isSpecialCasedOS) ? os.replace(data[0], '') : os,
|
23739 | 'version': data ? data[1] : null,
|
23740 | 'toString': function() {
|
23741 | var version = this.version;
|
23742 | return this.family + ((version && !isSpecialCasedOS) ? ' ' + version : '') + (this.architecture == 64 ? ' 64-bit' : '');
|
23743 | }
|
23744 | };
|
23745 | }
|
23746 |
|
23747 | if ((data = /\b(?:AMD|IA|Win|WOW|x86_|x)64\b/i.exec(arch)) && !/\bi686\b/i.test(arch)) {
|
23748 | if (os) {
|
23749 | os.architecture = 64;
|
23750 | os.family = os.family.replace(RegExp(' *' + data), '');
|
23751 | }
|
23752 | if (
|
23753 | name && (/\bWOW64\b/i.test(ua) ||
|
23754 | (useFeatures && /\w(?:86|32)$/.test(nav.cpuClass || nav.platform) && !/\bWin64; x64\b/i.test(ua)))
|
23755 | ) {
|
23756 | description.unshift('32-bit');
|
23757 | }
|
23758 | }
|
23759 |
|
23760 | else if (
|
23761 | os && /^OS X/.test(os.family) &&
|
23762 | name == 'Chrome' && parseFloat(version) >= 39
|
23763 | ) {
|
23764 | os.architecture = 64;
|
23765 | }
|
23766 |
|
23767 | ua || (ua = null);
|
23768 |
|
23769 |
|
23770 |
|
23771 | |
23772 |
|
23773 |
|
23774 |
|
23775 |
|
23776 |
|
23777 | var platform = {};
|
23778 |
|
23779 | |
23780 |
|
23781 |
|
23782 |
|
23783 |
|
23784 |
|
23785 | platform.description = ua;
|
23786 |
|
23787 | |
23788 |
|
23789 |
|
23790 |
|
23791 |
|
23792 |
|
23793 |
|
23794 |
|
23795 |
|
23796 | platform.layout = layout && layout[0];
|
23797 |
|
23798 | |
23799 |
|
23800 |
|
23801 |
|
23802 |
|
23803 |
|
23804 |
|
23805 |
|
23806 |
|
23807 |
|
23808 |
|
23809 | platform.manufacturer = manufacturer;
|
23810 |
|
23811 | |
23812 |
|
23813 |
|
23814 |
|
23815 |
|
23816 |
|
23817 |
|
23818 |
|
23819 |
|
23820 |
|
23821 |
|
23822 |
|
23823 |
|
23824 |
|
23825 | platform.name = name;
|
23826 |
|
23827 | |
23828 |
|
23829 |
|
23830 |
|
23831 |
|
23832 |
|
23833 | platform.prerelease = prerelease;
|
23834 |
|
23835 | |
23836 |
|
23837 |
|
23838 |
|
23839 |
|
23840 |
|
23841 |
|
23842 |
|
23843 |
|
23844 |
|
23845 |
|
23846 | platform.product = product;
|
23847 |
|
23848 | |
23849 |
|
23850 |
|
23851 |
|
23852 |
|
23853 |
|
23854 | platform.ua = ua;
|
23855 |
|
23856 | |
23857 |
|
23858 |
|
23859 |
|
23860 |
|
23861 |
|
23862 | platform.version = name && version;
|
23863 |
|
23864 | |
23865 |
|
23866 |
|
23867 |
|
23868 |
|
23869 |
|
23870 | platform.os = os || {
|
23871 |
|
23872 | |
23873 |
|
23874 |
|
23875 |
|
23876 |
|
23877 |
|
23878 | 'architecture': null,
|
23879 |
|
23880 | |
23881 |
|
23882 |
|
23883 |
|
23884 |
|
23885 |
|
23886 |
|
23887 |
|
23888 |
|
23889 |
|
23890 |
|
23891 | 'family': null,
|
23892 |
|
23893 | |
23894 |
|
23895 |
|
23896 |
|
23897 |
|
23898 |
|
23899 | 'version': null,
|
23900 |
|
23901 | |
23902 |
|
23903 |
|
23904 |
|
23905 |
|
23906 |
|
23907 | 'toString': function() { return 'null'; }
|
23908 | };
|
23909 |
|
23910 | platform.parse = parse;
|
23911 | platform.toString = toStringPlatform;
|
23912 |
|
23913 | if (platform.version) {
|
23914 | description.unshift(version);
|
23915 | }
|
23916 | if (platform.name) {
|
23917 | description.unshift(name);
|
23918 | }
|
23919 | if (os && name && !(os == String(os).split(' ')[0] && (os == name.split(' ')[0] || product))) {
|
23920 | description.push(product ? '(' + os + ')' : 'on ' + os);
|
23921 | }
|
23922 | if (description.length) {
|
23923 | platform.description = description.join(' ');
|
23924 | }
|
23925 | return platform;
|
23926 | }
|
23927 |
|
23928 |
|
23929 |
|
23930 |
|
23931 | var platform = parse();
|
23932 |
|
23933 |
|
23934 | if (typeof define == 'function' && typeof define.amd == 'object' && define.amd) {
|
23935 |
|
23936 |
|
23937 |
|
23938 | root.platform = platform;
|
23939 |
|
23940 |
|
23941 | define(function() {
|
23942 | return platform;
|
23943 | });
|
23944 | }
|
23945 |
|
23946 | else if (freeExports && freeModule) {
|
23947 |
|
23948 | forOwn(platform, function(value, key) {
|
23949 | freeExports[key] = value;
|
23950 | });
|
23951 | }
|
23952 | else {
|
23953 |
|
23954 | root.platform = platform;
|
23955 | }
|
23956 | }.call(this));
|
23957 |
|
23958 | }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
23959 | },{}],318:[function(require,module,exports){
|
23960 | (function (process){
|
23961 | 'use strict';
|
23962 |
|
23963 | if (typeof process === 'undefined' ||
|
23964 | !process.version ||
|
23965 | process.version.indexOf('v0.') === 0 ||
|
23966 | process.version.indexOf('v1.') === 0 && process.version.indexOf('v1.8.') !== 0) {
|
23967 | module.exports = { nextTick: nextTick };
|
23968 | } else {
|
23969 | module.exports = process
|
23970 | }
|
23971 |
|
23972 | function nextTick(fn, arg1, arg2, arg3) {
|
23973 | if (typeof fn !== 'function') {
|
23974 | throw new TypeError('"callback" argument must be a function');
|
23975 | }
|
23976 | var len = arguments.length;
|
23977 | var args, i;
|
23978 | switch (len) {
|
23979 | case 0:
|
23980 | case 1:
|
23981 | return process.nextTick(fn);
|
23982 | case 2:
|
23983 | return process.nextTick(function afterTickOne() {
|
23984 | fn.call(null, arg1);
|
23985 | });
|
23986 | case 3:
|
23987 | return process.nextTick(function afterTickTwo() {
|
23988 | fn.call(null, arg1, arg2);
|
23989 | });
|
23990 | case 4:
|
23991 | return process.nextTick(function afterTickThree() {
|
23992 | fn.call(null, arg1, arg2, arg3);
|
23993 | });
|
23994 | default:
|
23995 | args = new Array(len - 1);
|
23996 | i = 0;
|
23997 | while (i < args.length) {
|
23998 | args[i++] = arguments[i];
|
23999 | }
|
24000 | return process.nextTick(function afterTick() {
|
24001 | fn.apply(null, args);
|
24002 | });
|
24003 | }
|
24004 | }
|
24005 |
|
24006 |
|
24007 | }).call(this,require('_process'))
|
24008 | },{"_process":393}],319:[function(require,module,exports){
|
24009 | var immediate = require('immediate');
|
24010 | var process = module.exports = {};
|
24011 | process.nextTick = immediate
|
24012 |
|
24013 | process.title = 'browser';
|
24014 | process.title1 = 'test123';
|
24015 | process.browser = true;
|
24016 | process.env = {};
|
24017 | process.argv = [];
|
24018 | process.version = '';
|
24019 | process.versions = {};
|
24020 | function noop() {}
|
24021 | process.on = noop;
|
24022 | process.addListener = noop;
|
24023 | process.once = noop;
|
24024 | process.off = noop;
|
24025 | process.removeListener = noop;
|
24026 | process.removeAllListeners = noop;
|
24027 | process.emit = noop;
|
24028 | process.prependListener = noop;
|
24029 | process.prependOnceListener = noop;
|
24030 | process.listeners = function (name) { return [] }
|
24031 | process.binding = function (name) {
|
24032 | throw new Error('process.binding is not supported');
|
24033 | };
|
24034 | process.cwd = function () { return '/' };
|
24035 | process.chdir = function (dir) {
|
24036 | throw new Error('process.chdir is not supported');
|
24037 | };
|
24038 | process.umask = function() { return 0; };
|
24039 |
|
24040 | },{"immediate":301}],320:[function(require,module,exports){
|
24041 | (function (global){
|
24042 |
|
24043 | ;(function(root) {
|
24044 |
|
24045 |
|
24046 | var freeExports = typeof exports == 'object' && exports &&
|
24047 | !exports.nodeType && exports;
|
24048 | var freeModule = typeof module == 'object' && module &&
|
24049 | !module.nodeType && module;
|
24050 | var freeGlobal = typeof global == 'object' && global;
|
24051 | if (
|
24052 | freeGlobal.global === freeGlobal ||
|
24053 | freeGlobal.window === freeGlobal ||
|
24054 | freeGlobal.self === freeGlobal
|
24055 | ) {
|
24056 | root = freeGlobal;
|
24057 | }
|
24058 |
|
24059 | |
24060 |
|
24061 |
|
24062 |
|
24063 |
|
24064 | var punycode,
|
24065 |
|
24066 |
|
24067 | maxInt = 2147483647,
|
24068 |
|
24069 |
|
24070 | base = 36,
|
24071 | tMin = 1,
|
24072 | tMax = 26,
|
24073 | skew = 38,
|
24074 | damp = 700,
|
24075 | initialBias = 72,
|
24076 | initialN = 128,
|
24077 | delimiter = '-',
|
24078 |
|
24079 |
|
24080 | regexPunycode = /^xn--/,
|
24081 | regexNonASCII = /[^\x20-\x7E]/,
|
24082 | regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g,
|
24083 |
|
24084 |
|
24085 | errors = {
|
24086 | 'overflow': 'Overflow: input needs wider integers to process',
|
24087 | 'not-basic': 'Illegal input >= 0x80 (not a basic code point)',
|
24088 | 'invalid-input': 'Invalid input'
|
24089 | },
|
24090 |
|
24091 |
|
24092 | baseMinusTMin = base - tMin,
|
24093 | floor = Math.floor,
|
24094 | stringFromCharCode = String.fromCharCode,
|
24095 |
|
24096 |
|
24097 | key;
|
24098 |
|
24099 |
|
24100 |
|
24101 | |
24102 |
|
24103 |
|
24104 |
|
24105 |
|
24106 |
|
24107 | function error(type) {
|
24108 | throw new RangeError(errors[type]);
|
24109 | }
|
24110 |
|
24111 | |
24112 |
|
24113 |
|
24114 |
|
24115 |
|
24116 |
|
24117 |
|
24118 |
|
24119 | function map(array, fn) {
|
24120 | var length = array.length;
|
24121 | var result = [];
|
24122 | while (length--) {
|
24123 | result[length] = fn(array[length]);
|
24124 | }
|
24125 | return result;
|
24126 | }
|
24127 |
|
24128 | |
24129 |
|
24130 |
|
24131 |
|
24132 |
|
24133 |
|
24134 |
|
24135 |
|
24136 |
|
24137 |
|
24138 | function mapDomain(string, fn) {
|
24139 | var parts = string.split('@');
|
24140 | var result = '';
|
24141 | if (parts.length > 1) {
|
24142 |
|
24143 |
|
24144 | result = parts[0] + '@';
|
24145 | string = parts[1];
|
24146 | }
|
24147 |
|
24148 | string = string.replace(regexSeparators, '\x2E');
|
24149 | var labels = string.split('.');
|
24150 | var encoded = map(labels, fn).join('.');
|
24151 | return result + encoded;
|
24152 | }
|
24153 |
|
24154 | |
24155 |
|
24156 |
|
24157 |
|
24158 |
|
24159 |
|
24160 |
|
24161 |
|
24162 |
|
24163 |
|
24164 |
|
24165 |
|
24166 |
|
24167 | function ucs2decode(string) {
|
24168 | var output = [],
|
24169 | counter = 0,
|
24170 | length = string.length,
|
24171 | value,
|
24172 | extra;
|
24173 | while (counter < length) {
|
24174 | value = string.charCodeAt(counter++);
|
24175 | if (value >= 0xD800 && value <= 0xDBFF && counter < length) {
|
24176 |
|
24177 | extra = string.charCodeAt(counter++);
|
24178 | if ((extra & 0xFC00) == 0xDC00) {
|
24179 | output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);
|
24180 | } else {
|
24181 |
|
24182 |
|
24183 | output.push(value);
|
24184 | counter--;
|
24185 | }
|
24186 | } else {
|
24187 | output.push(value);
|
24188 | }
|
24189 | }
|
24190 | return output;
|
24191 | }
|
24192 |
|
24193 | |
24194 |
|
24195 |
|
24196 |
|
24197 |
|
24198 |
|
24199 |
|
24200 |
|
24201 | function ucs2encode(array) {
|
24202 | return map(array, function(value) {
|
24203 | var output = '';
|
24204 | if (value > 0xFFFF) {
|
24205 | value -= 0x10000;
|
24206 | output += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800);
|
24207 | value = 0xDC00 | value & 0x3FF;
|
24208 | }
|
24209 | output += stringFromCharCode(value);
|
24210 | return output;
|
24211 | }).join('');
|
24212 | }
|
24213 |
|
24214 | |
24215 |
|
24216 |
|
24217 |
|
24218 |
|
24219 |
|
24220 |
|
24221 |
|
24222 |
|
24223 | function basicToDigit(codePoint) {
|
24224 | if (codePoint - 48 < 10) {
|
24225 | return codePoint - 22;
|
24226 | }
|
24227 | if (codePoint - 65 < 26) {
|
24228 | return codePoint - 65;
|
24229 | }
|
24230 | if (codePoint - 97 < 26) {
|
24231 | return codePoint - 97;
|
24232 | }
|
24233 | return base;
|
24234 | }
|
24235 |
|
24236 | |
24237 |
|
24238 |
|
24239 |
|
24240 |
|
24241 |
|
24242 |
|
24243 |
|
24244 |
|
24245 |
|
24246 |
|
24247 | function digitToBasic(digit, flag) {
|
24248 |
|
24249 |
|
24250 | return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);
|
24251 | }
|
24252 |
|
24253 | |
24254 |
|
24255 |
|
24256 |
|
24257 |
|
24258 | function adapt(delta, numPoints, firstTime) {
|
24259 | var k = 0;
|
24260 | delta = firstTime ? floor(delta / damp) : delta >> 1;
|
24261 | delta += floor(delta / numPoints);
|
24262 | for (; delta > baseMinusTMin * tMax >> 1; k += base) {
|
24263 | delta = floor(delta / baseMinusTMin);
|
24264 | }
|
24265 | return floor(k + (baseMinusTMin + 1) * delta / (delta + skew));
|
24266 | }
|
24267 |
|
24268 | |
24269 |
|
24270 |
|
24271 |
|
24272 |
|
24273 |
|
24274 |
|
24275 | function decode(input) {
|
24276 |
|
24277 | var output = [],
|
24278 | inputLength = input.length,
|
24279 | out,
|
24280 | i = 0,
|
24281 | n = initialN,
|
24282 | bias = initialBias,
|
24283 | basic,
|
24284 | j,
|
24285 | index,
|
24286 | oldi,
|
24287 | w,
|
24288 | k,
|
24289 | digit,
|
24290 | t,
|
24291 |
|
24292 | baseMinusT;
|
24293 |
|
24294 |
|
24295 |
|
24296 |
|
24297 |
|
24298 | basic = input.lastIndexOf(delimiter);
|
24299 | if (basic < 0) {
|
24300 | basic = 0;
|
24301 | }
|
24302 |
|
24303 | for (j = 0; j < basic; ++j) {
|
24304 |
|
24305 | if (input.charCodeAt(j) >= 0x80) {
|
24306 | error('not-basic');
|
24307 | }
|
24308 | output.push(input.charCodeAt(j));
|
24309 | }
|
24310 |
|
24311 |
|
24312 |
|
24313 |
|
24314 | for (index = basic > 0 ? basic + 1 : 0; index < inputLength; ) {
|
24315 |
|
24316 |
|
24317 |
|
24318 |
|
24319 |
|
24320 |
|
24321 | for (oldi = i, w = 1, k = base; ; k += base) {
|
24322 |
|
24323 | if (index >= inputLength) {
|
24324 | error('invalid-input');
|
24325 | }
|
24326 |
|
24327 | digit = basicToDigit(input.charCodeAt(index++));
|
24328 |
|
24329 | if (digit >= base || digit > floor((maxInt - i) / w)) {
|
24330 | error('overflow');
|
24331 | }
|
24332 |
|
24333 | i += digit * w;
|
24334 | t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);
|
24335 |
|
24336 | if (digit < t) {
|
24337 | break;
|
24338 | }
|
24339 |
|
24340 | baseMinusT = base - t;
|
24341 | if (w > floor(maxInt / baseMinusT)) {
|
24342 | error('overflow');
|
24343 | }
|
24344 |
|
24345 | w *= baseMinusT;
|
24346 |
|
24347 | }
|
24348 |
|
24349 | out = output.length + 1;
|
24350 | bias = adapt(i - oldi, out, oldi == 0);
|
24351 |
|
24352 |
|
24353 |
|
24354 | if (floor(i / out) > maxInt - n) {
|
24355 | error('overflow');
|
24356 | }
|
24357 |
|
24358 | n += floor(i / out);
|
24359 | i %= out;
|
24360 |
|
24361 |
|
24362 | output.splice(i++, 0, n);
|
24363 |
|
24364 | }
|
24365 |
|
24366 | return ucs2encode(output);
|
24367 | }
|
24368 |
|
24369 | |
24370 |
|
24371 |
|
24372 |
|
24373 |
|
24374 |
|
24375 |
|
24376 | function encode(input) {
|
24377 | var n,
|
24378 | delta,
|
24379 | handledCPCount,
|
24380 | basicLength,
|
24381 | bias,
|
24382 | j,
|
24383 | m,
|
24384 | q,
|
24385 | k,
|
24386 | t,
|
24387 | currentValue,
|
24388 | output = [],
|
24389 |
|
24390 | inputLength,
|
24391 |
|
24392 | handledCPCountPlusOne,
|
24393 | baseMinusT,
|
24394 | qMinusT;
|
24395 |
|
24396 |
|
24397 | input = ucs2decode(input);
|
24398 |
|
24399 |
|
24400 | inputLength = input.length;
|
24401 |
|
24402 |
|
24403 | n = initialN;
|
24404 | delta = 0;
|
24405 | bias = initialBias;
|
24406 |
|
24407 |
|
24408 | for (j = 0; j < inputLength; ++j) {
|
24409 | currentValue = input[j];
|
24410 | if (currentValue < 0x80) {
|
24411 | output.push(stringFromCharCode(currentValue));
|
24412 | }
|
24413 | }
|
24414 |
|
24415 | handledCPCount = basicLength = output.length;
|
24416 |
|
24417 |
|
24418 |
|
24419 |
|
24420 |
|
24421 | if (basicLength) {
|
24422 | output.push(delimiter);
|
24423 | }
|
24424 |
|
24425 |
|
24426 | while (handledCPCount < inputLength) {
|
24427 |
|
24428 |
|
24429 |
|
24430 | for (m = maxInt, j = 0; j < inputLength; ++j) {
|
24431 | currentValue = input[j];
|
24432 | if (currentValue >= n && currentValue < m) {
|
24433 | m = currentValue;
|
24434 | }
|
24435 | }
|
24436 |
|
24437 |
|
24438 |
|
24439 | handledCPCountPlusOne = handledCPCount + 1;
|
24440 | if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {
|
24441 | error('overflow');
|
24442 | }
|
24443 |
|
24444 | delta += (m - n) * handledCPCountPlusOne;
|
24445 | n = m;
|
24446 |
|
24447 | for (j = 0; j < inputLength; ++j) {
|
24448 | currentValue = input[j];
|
24449 |
|
24450 | if (currentValue < n && ++delta > maxInt) {
|
24451 | error('overflow');
|
24452 | }
|
24453 |
|
24454 | if (currentValue == n) {
|
24455 |
|
24456 | for (q = delta, k = base; ; k += base) {
|
24457 | t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);
|
24458 | if (q < t) {
|
24459 | break;
|
24460 | }
|
24461 | qMinusT = q - t;
|
24462 | baseMinusT = base - t;
|
24463 | output.push(
|
24464 | stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0))
|
24465 | );
|
24466 | q = floor(qMinusT / baseMinusT);
|
24467 | }
|
24468 |
|
24469 | output.push(stringFromCharCode(digitToBasic(q, 0)));
|
24470 | bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength);
|
24471 | delta = 0;
|
24472 | ++handledCPCount;
|
24473 | }
|
24474 | }
|
24475 |
|
24476 | ++delta;
|
24477 | ++n;
|
24478 |
|
24479 | }
|
24480 | return output.join('');
|
24481 | }
|
24482 |
|
24483 | |
24484 |
|
24485 |
|
24486 |
|
24487 |
|
24488 |
|
24489 |
|
24490 |
|
24491 |
|
24492 |
|
24493 |
|
24494 | function toUnicode(input) {
|
24495 | return mapDomain(input, function(string) {
|
24496 | return regexPunycode.test(string)
|
24497 | ? decode(string.slice(4).toLowerCase())
|
24498 | : string;
|
24499 | });
|
24500 | }
|
24501 |
|
24502 | |
24503 |
|
24504 |
|
24505 |
|
24506 |
|
24507 |
|
24508 |
|
24509 |
|
24510 |
|
24511 |
|
24512 |
|
24513 | function toASCII(input) {
|
24514 | return mapDomain(input, function(string) {
|
24515 | return regexNonASCII.test(string)
|
24516 | ? 'xn--' + encode(string)
|
24517 | : string;
|
24518 | });
|
24519 | }
|
24520 |
|
24521 |
|
24522 |
|
24523 |
|
24524 | punycode = {
|
24525 | |
24526 |
|
24527 |
|
24528 |
|
24529 |
|
24530 | 'version': '1.4.1',
|
24531 | |
24532 |
|
24533 |
|
24534 |
|
24535 |
|
24536 |
|
24537 |
|
24538 | 'ucs2': {
|
24539 | 'decode': ucs2decode,
|
24540 | 'encode': ucs2encode
|
24541 | },
|
24542 | 'decode': decode,
|
24543 | 'encode': encode,
|
24544 | 'toASCII': toASCII,
|
24545 | 'toUnicode': toUnicode
|
24546 | };
|
24547 |
|
24548 |
|
24549 |
|
24550 |
|
24551 | if (
|
24552 | typeof define == 'function' &&
|
24553 | typeof define.amd == 'object' &&
|
24554 | define.amd
|
24555 | ) {
|
24556 | define('punycode', function() {
|
24557 | return punycode;
|
24558 | });
|
24559 | } else if (freeExports && freeModule) {
|
24560 | if (module.exports == freeExports) {
|
24561 |
|
24562 | freeModule.exports = punycode;
|
24563 | } else {
|
24564 |
|
24565 | for (key in punycode) {
|
24566 | punycode.hasOwnProperty(key) && (freeExports[key] = punycode[key]);
|
24567 | }
|
24568 | }
|
24569 | } else {
|
24570 |
|
24571 | root.punycode = punycode;
|
24572 | }
|
24573 |
|
24574 | }(this));
|
24575 |
|
24576 | }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
24577 | },{}],321:[function(require,module,exports){
|
24578 |
|
24579 |
|
24580 |
|
24581 |
|
24582 |
|
24583 |
|
24584 |
|
24585 |
|
24586 |
|
24587 |
|
24588 |
|
24589 |
|
24590 |
|
24591 |
|
24592 |
|
24593 |
|
24594 |
|
24595 |
|
24596 |
|
24597 |
|
24598 |
|
24599 | 'use strict';
|
24600 |
|
24601 |
|
24602 |
|
24603 |
|
24604 | function hasOwnProperty(obj, prop) {
|
24605 | return Object.prototype.hasOwnProperty.call(obj, prop);
|
24606 | }
|
24607 |
|
24608 | module.exports = function(qs, sep, eq, options) {
|
24609 | sep = sep || '&';
|
24610 | eq = eq || '=';
|
24611 | var obj = {};
|
24612 |
|
24613 | if (typeof qs !== 'string' || qs.length === 0) {
|
24614 | return obj;
|
24615 | }
|
24616 |
|
24617 | var regexp = /\+/g;
|
24618 | qs = qs.split(sep);
|
24619 |
|
24620 | var maxKeys = 1000;
|
24621 | if (options && typeof options.maxKeys === 'number') {
|
24622 | maxKeys = options.maxKeys;
|
24623 | }
|
24624 |
|
24625 | var len = qs.length;
|
24626 |
|
24627 | if (maxKeys > 0 && len > maxKeys) {
|
24628 | len = maxKeys;
|
24629 | }
|
24630 |
|
24631 | for (var i = 0; i < len; ++i) {
|
24632 | var x = qs[i].replace(regexp, '%20'),
|
24633 | idx = x.indexOf(eq),
|
24634 | kstr, vstr, k, v;
|
24635 |
|
24636 | if (idx >= 0) {
|
24637 | kstr = x.substr(0, idx);
|
24638 | vstr = x.substr(idx + 1);
|
24639 | } else {
|
24640 | kstr = x;
|
24641 | vstr = '';
|
24642 | }
|
24643 |
|
24644 | k = decodeURIComponent(kstr);
|
24645 | v = decodeURIComponent(vstr);
|
24646 |
|
24647 | if (!hasOwnProperty(obj, k)) {
|
24648 | obj[k] = v;
|
24649 | } else if (isArray(obj[k])) {
|
24650 | obj[k].push(v);
|
24651 | } else {
|
24652 | obj[k] = [obj[k], v];
|
24653 | }
|
24654 | }
|
24655 |
|
24656 | return obj;
|
24657 | };
|
24658 |
|
24659 | var isArray = Array.isArray || function (xs) {
|
24660 | return Object.prototype.toString.call(xs) === '[object Array]';
|
24661 | };
|
24662 |
|
24663 | },{}],322:[function(require,module,exports){
|
24664 |
|
24665 |
|
24666 |
|
24667 |
|
24668 |
|
24669 |
|
24670 |
|
24671 |
|
24672 |
|
24673 |
|
24674 |
|
24675 |
|
24676 |
|
24677 |
|
24678 |
|
24679 |
|
24680 |
|
24681 |
|
24682 |
|
24683 |
|
24684 |
|
24685 | 'use strict';
|
24686 |
|
24687 | var stringifyPrimitive = function(v) {
|
24688 | switch (typeof v) {
|
24689 | case 'string':
|
24690 | return v;
|
24691 |
|
24692 | case 'boolean':
|
24693 | return v ? 'true' : 'false';
|
24694 |
|
24695 | case 'number':
|
24696 | return isFinite(v) ? v : '';
|
24697 |
|
24698 | default:
|
24699 | return '';
|
24700 | }
|
24701 | };
|
24702 |
|
24703 | module.exports = function(obj, sep, eq, name) {
|
24704 | sep = sep || '&';
|
24705 | eq = eq || '=';
|
24706 | if (obj === null) {
|
24707 | obj = undefined;
|
24708 | }
|
24709 |
|
24710 | if (typeof obj === 'object') {
|
24711 | return map(objectKeys(obj), function(k) {
|
24712 | var ks = encodeURIComponent(stringifyPrimitive(k)) + eq;
|
24713 | if (isArray(obj[k])) {
|
24714 | return map(obj[k], function(v) {
|
24715 | return ks + encodeURIComponent(stringifyPrimitive(v));
|
24716 | }).join(sep);
|
24717 | } else {
|
24718 | return ks + encodeURIComponent(stringifyPrimitive(obj[k]));
|
24719 | }
|
24720 | }).join(sep);
|
24721 |
|
24722 | }
|
24723 |
|
24724 | if (!name) return '';
|
24725 | return encodeURIComponent(stringifyPrimitive(name)) + eq +
|
24726 | encodeURIComponent(stringifyPrimitive(obj));
|
24727 | };
|
24728 |
|
24729 | var isArray = Array.isArray || function (xs) {
|
24730 | return Object.prototype.toString.call(xs) === '[object Array]';
|
24731 | };
|
24732 |
|
24733 | function map (xs, f) {
|
24734 | if (xs.map) return xs.map(f);
|
24735 | var res = [];
|
24736 | for (var i = 0; i < xs.length; i++) {
|
24737 | res.push(f(xs[i], i));
|
24738 | }
|
24739 | return res;
|
24740 | }
|
24741 |
|
24742 | var objectKeys = Object.keys || function (obj) {
|
24743 | var res = [];
|
24744 | for (var key in obj) {
|
24745 | if (Object.prototype.hasOwnProperty.call(obj, key)) res.push(key);
|
24746 | }
|
24747 | return res;
|
24748 | };
|
24749 |
|
24750 | },{}],323:[function(require,module,exports){
|
24751 | 'use strict';
|
24752 |
|
24753 | exports.decode = exports.parse = require('./decode');
|
24754 | exports.encode = exports.stringify = require('./encode');
|
24755 |
|
24756 | },{"./decode":321,"./encode":322}],324:[function(require,module,exports){
|
24757 | module.exports = require('./lib/_stream_duplex.js');
|
24758 |
|
24759 | },{"./lib/_stream_duplex.js":325}],325:[function(require,module,exports){
|
24760 |
|
24761 |
|
24762 |
|
24763 |
|
24764 |
|
24765 |
|
24766 |
|
24767 |
|
24768 |
|
24769 |
|
24770 |
|
24771 |
|
24772 |
|
24773 |
|
24774 |
|
24775 |
|
24776 |
|
24777 |
|
24778 |
|
24779 |
|
24780 |
|
24781 |
|
24782 |
|
24783 |
|
24784 |
|
24785 |
|
24786 | 'use strict';
|
24787 |
|
24788 |
|
24789 |
|
24790 | var pna = require('process-nextick-args');
|
24791 |
|
24792 |
|
24793 |
|
24794 | var objectKeys = Object.keys || function (obj) {
|
24795 | var keys = [];
|
24796 | for (var key in obj) {
|
24797 | keys.push(key);
|
24798 | }return keys;
|
24799 | };
|
24800 |
|
24801 |
|
24802 | module.exports = Duplex;
|
24803 |
|
24804 |
|
24805 | var util = Object.create(require('core-util-is'));
|
24806 | util.inherits = require('inherits');
|
24807 |
|
24808 |
|
24809 | var Readable = require('./_stream_readable');
|
24810 | var Writable = require('./_stream_writable');
|
24811 |
|
24812 | util.inherits(Duplex, Readable);
|
24813 |
|
24814 | {
|
24815 |
|
24816 | var keys = objectKeys(Writable.prototype);
|
24817 | for (var v = 0; v < keys.length; v++) {
|
24818 | var method = keys[v];
|
24819 | if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method];
|
24820 | }
|
24821 | }
|
24822 |
|
24823 | function Duplex(options) {
|
24824 | if (!(this instanceof Duplex)) return new Duplex(options);
|
24825 |
|
24826 | Readable.call(this, options);
|
24827 | Writable.call(this, options);
|
24828 |
|
24829 | if (options && options.readable === false) this.readable = false;
|
24830 |
|
24831 | if (options && options.writable === false) this.writable = false;
|
24832 |
|
24833 | this.allowHalfOpen = true;
|
24834 | if (options && options.allowHalfOpen === false) this.allowHalfOpen = false;
|
24835 |
|
24836 | this.once('end', onend);
|
24837 | }
|
24838 |
|
24839 | Object.defineProperty(Duplex.prototype, 'writableHighWaterMark', {
|
24840 |
|
24841 |
|
24842 |
|
24843 | enumerable: false,
|
24844 | get: function () {
|
24845 | return this._writableState.highWaterMark;
|
24846 | }
|
24847 | });
|
24848 |
|
24849 |
|
24850 | function onend() {
|
24851 |
|
24852 |
|
24853 | if (this.allowHalfOpen || this._writableState.ended) return;
|
24854 |
|
24855 |
|
24856 |
|
24857 | pna.nextTick(onEndNT, this);
|
24858 | }
|
24859 |
|
24860 | function onEndNT(self) {
|
24861 | self.end();
|
24862 | }
|
24863 |
|
24864 | Object.defineProperty(Duplex.prototype, 'destroyed', {
|
24865 | get: function () {
|
24866 | if (this._readableState === undefined || this._writableState === undefined) {
|
24867 | return false;
|
24868 | }
|
24869 | return this._readableState.destroyed && this._writableState.destroyed;
|
24870 | },
|
24871 | set: function (value) {
|
24872 |
|
24873 |
|
24874 | if (this._readableState === undefined || this._writableState === undefined) {
|
24875 | return;
|
24876 | }
|
24877 |
|
24878 |
|
24879 |
|
24880 | this._readableState.destroyed = value;
|
24881 | this._writableState.destroyed = value;
|
24882 | }
|
24883 | });
|
24884 |
|
24885 | Duplex.prototype._destroy = function (err, cb) {
|
24886 | this.push(null);
|
24887 | this.end();
|
24888 |
|
24889 | pna.nextTick(cb, err);
|
24890 | };
|
24891 | },{"./_stream_readable":327,"./_stream_writable":329,"core-util-is":294,"inherits":307,"process-nextick-args":318}],326:[function(require,module,exports){
|
24892 |
|
24893 |
|
24894 |
|
24895 |
|
24896 |
|
24897 |
|
24898 |
|
24899 |
|
24900 |
|
24901 |
|
24902 |
|
24903 |
|
24904 |
|
24905 |
|
24906 |
|
24907 |
|
24908 |
|
24909 |
|
24910 |
|
24911 |
|
24912 |
|
24913 |
|
24914 |
|
24915 |
|
24916 |
|
24917 | 'use strict';
|
24918 |
|
24919 | module.exports = PassThrough;
|
24920 |
|
24921 | var Transform = require('./_stream_transform');
|
24922 |
|
24923 |
|
24924 | var util = Object.create(require('core-util-is'));
|
24925 | util.inherits = require('inherits');
|
24926 |
|
24927 |
|
24928 | util.inherits(PassThrough, Transform);
|
24929 |
|
24930 | function PassThrough(options) {
|
24931 | if (!(this instanceof PassThrough)) return new PassThrough(options);
|
24932 |
|
24933 | Transform.call(this, options);
|
24934 | }
|
24935 |
|
24936 | PassThrough.prototype._transform = function (chunk, encoding, cb) {
|
24937 | cb(null, chunk);
|
24938 | };
|
24939 | },{"./_stream_transform":328,"core-util-is":294,"inherits":307}],327:[function(require,module,exports){
|
24940 | (function (process,global){
|
24941 |
|
24942 |
|
24943 |
|
24944 |
|
24945 |
|
24946 |
|
24947 |
|
24948 |
|
24949 |
|
24950 |
|
24951 |
|
24952 |
|
24953 |
|
24954 |
|
24955 |
|
24956 |
|
24957 |
|
24958 |
|
24959 |
|
24960 |
|
24961 |
|
24962 | 'use strict';
|
24963 |
|
24964 |
|
24965 |
|
24966 | var pna = require('process-nextick-args');
|
24967 |
|
24968 |
|
24969 | module.exports = Readable;
|
24970 |
|
24971 |
|
24972 | var isArray = require('isarray');
|
24973 |
|
24974 |
|
24975 |
|
24976 | var Duplex;
|
24977 |
|
24978 |
|
24979 | Readable.ReadableState = ReadableState;
|
24980 |
|
24981 |
|
24982 | var EE = require('events').EventEmitter;
|
24983 |
|
24984 | var EElistenerCount = function (emitter, type) {
|
24985 | return emitter.listeners(type).length;
|
24986 | };
|
24987 |
|
24988 |
|
24989 |
|
24990 | var Stream = require('./internal/streams/stream');
|
24991 |
|
24992 |
|
24993 |
|
24994 |
|
24995 | var Buffer = require('safe-buffer').Buffer;
|
24996 | var OurUint8Array = global.Uint8Array || function () {};
|
24997 | function _uint8ArrayToBuffer(chunk) {
|
24998 | return Buffer.from(chunk);
|
24999 | }
|
25000 | function _isUint8Array(obj) {
|
25001 | return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;
|
25002 | }
|
25003 |
|
25004 |
|
25005 |
|
25006 |
|
25007 | var util = Object.create(require('core-util-is'));
|
25008 | util.inherits = require('inherits');
|
25009 |
|
25010 |
|
25011 |
|
25012 | var debugUtil = require('util');
|
25013 | var debug = void 0;
|
25014 | if (debugUtil && debugUtil.debuglog) {
|
25015 | debug = debugUtil.debuglog('stream');
|
25016 | } else {
|
25017 | debug = function () {};
|
25018 | }
|
25019 |
|
25020 |
|
25021 | var BufferList = require('./internal/streams/BufferList');
|
25022 | var destroyImpl = require('./internal/streams/destroy');
|
25023 | var StringDecoder;
|
25024 |
|
25025 | util.inherits(Readable, Stream);
|
25026 |
|
25027 | var kProxyEvents = ['error', 'close', 'destroy', 'pause', 'resume'];
|
25028 |
|
25029 | function prependListener(emitter, event, fn) {
|
25030 |
|
25031 |
|
25032 | if (typeof emitter.prependListener === 'function') return emitter.prependListener(event, fn);
|
25033 |
|
25034 |
|
25035 |
|
25036 |
|
25037 |
|
25038 | if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);else if (isArray(emitter._events[event])) emitter._events[event].unshift(fn);else emitter._events[event] = [fn, emitter._events[event]];
|
25039 | }
|
25040 |
|
25041 | function ReadableState(options, stream) {
|
25042 | Duplex = Duplex || require('./_stream_duplex');
|
25043 |
|
25044 | options = options || {};
|
25045 |
|
25046 |
|
25047 |
|
25048 |
|
25049 |
|
25050 |
|
25051 | var isDuplex = stream instanceof Duplex;
|
25052 |
|
25053 |
|
25054 |
|
25055 | this.objectMode = !!options.objectMode;
|
25056 |
|
25057 | if (isDuplex) this.objectMode = this.objectMode || !!options.readableObjectMode;
|
25058 |
|
25059 |
|
25060 |
|
25061 | var hwm = options.highWaterMark;
|
25062 | var readableHwm = options.readableHighWaterMark;
|
25063 | var defaultHwm = this.objectMode ? 16 : 16 * 1024;
|
25064 |
|
25065 | if (hwm || hwm === 0) this.highWaterMark = hwm;else if (isDuplex && (readableHwm || readableHwm === 0)) this.highWaterMark = readableHwm;else this.highWaterMark = defaultHwm;
|
25066 |
|
25067 |
|
25068 | this.highWaterMark = Math.floor(this.highWaterMark);
|
25069 |
|
25070 |
|
25071 |
|
25072 |
|
25073 | this.buffer = new BufferList();
|
25074 | this.length = 0;
|
25075 | this.pipes = null;
|
25076 | this.pipesCount = 0;
|
25077 | this.flowing = null;
|
25078 | this.ended = false;
|
25079 | this.endEmitted = false;
|
25080 | this.reading = false;
|
25081 |
|
25082 |
|
25083 |
|
25084 |
|
25085 |
|
25086 | this.sync = true;
|
25087 |
|
25088 |
|
25089 |
|
25090 | this.needReadable = false;
|
25091 | this.emittedReadable = false;
|
25092 | this.readableListening = false;
|
25093 | this.resumeScheduled = false;
|
25094 |
|
25095 |
|
25096 | this.destroyed = false;
|
25097 |
|
25098 |
|
25099 |
|
25100 |
|
25101 | this.defaultEncoding = options.defaultEncoding || 'utf8';
|
25102 |
|
25103 |
|
25104 | this.awaitDrain = 0;
|
25105 |
|
25106 |
|
25107 | this.readingMore = false;
|
25108 |
|
25109 | this.decoder = null;
|
25110 | this.encoding = null;
|
25111 | if (options.encoding) {
|
25112 | if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder;
|
25113 | this.decoder = new StringDecoder(options.encoding);
|
25114 | this.encoding = options.encoding;
|
25115 | }
|
25116 | }
|
25117 |
|
25118 | function Readable(options) {
|
25119 | Duplex = Duplex || require('./_stream_duplex');
|
25120 |
|
25121 | if (!(this instanceof Readable)) return new Readable(options);
|
25122 |
|
25123 | this._readableState = new ReadableState(options, this);
|
25124 |
|
25125 |
|
25126 | this.readable = true;
|
25127 |
|
25128 | if (options) {
|
25129 | if (typeof options.read === 'function') this._read = options.read;
|
25130 |
|
25131 | if (typeof options.destroy === 'function') this._destroy = options.destroy;
|
25132 | }
|
25133 |
|
25134 | Stream.call(this);
|
25135 | }
|
25136 |
|
25137 | Object.defineProperty(Readable.prototype, 'destroyed', {
|
25138 | get: function () {
|
25139 | if (this._readableState === undefined) {
|
25140 | return false;
|
25141 | }
|
25142 | return this._readableState.destroyed;
|
25143 | },
|
25144 | set: function (value) {
|
25145 |
|
25146 |
|
25147 | if (!this._readableState) {
|
25148 | return;
|
25149 | }
|
25150 |
|
25151 |
|
25152 |
|
25153 | this._readableState.destroyed = value;
|
25154 | }
|
25155 | });
|
25156 |
|
25157 | Readable.prototype.destroy = destroyImpl.destroy;
|
25158 | Readable.prototype._undestroy = destroyImpl.undestroy;
|
25159 | Readable.prototype._destroy = function (err, cb) {
|
25160 | this.push(null);
|
25161 | cb(err);
|
25162 | };
|
25163 |
|
25164 |
|
25165 |
|
25166 |
|
25167 |
|
25168 | Readable.prototype.push = function (chunk, encoding) {
|
25169 | var state = this._readableState;
|
25170 | var skipChunkCheck;
|
25171 |
|
25172 | if (!state.objectMode) {
|
25173 | if (typeof chunk === 'string') {
|
25174 | encoding = encoding || state.defaultEncoding;
|
25175 | if (encoding !== state.encoding) {
|
25176 | chunk = Buffer.from(chunk, encoding);
|
25177 | encoding = '';
|
25178 | }
|
25179 | skipChunkCheck = true;
|
25180 | }
|
25181 | } else {
|
25182 | skipChunkCheck = true;
|
25183 | }
|
25184 |
|
25185 | return readableAddChunk(this, chunk, encoding, false, skipChunkCheck);
|
25186 | };
|
25187 |
|
25188 |
|
25189 | Readable.prototype.unshift = function (chunk) {
|
25190 | return readableAddChunk(this, chunk, null, true, false);
|
25191 | };
|
25192 |
|
25193 | function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) {
|
25194 | var state = stream._readableState;
|
25195 | if (chunk === null) {
|
25196 | state.reading = false;
|
25197 | onEofChunk(stream, state);
|
25198 | } else {
|
25199 | var er;
|
25200 | if (!skipChunkCheck) er = chunkInvalid(state, chunk);
|
25201 | if (er) {
|
25202 | stream.emit('error', er);
|
25203 | } else if (state.objectMode || chunk && chunk.length > 0) {
|
25204 | if (typeof chunk !== 'string' && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer.prototype) {
|
25205 | chunk = _uint8ArrayToBuffer(chunk);
|
25206 | }
|
25207 |
|
25208 | if (addToFront) {
|
25209 | if (state.endEmitted) stream.emit('error', new Error('stream.unshift() after end event'));else addChunk(stream, state, chunk, true);
|
25210 | } else if (state.ended) {
|
25211 | stream.emit('error', new Error('stream.push() after EOF'));
|
25212 | } else {
|
25213 | state.reading = false;
|
25214 | if (state.decoder && !encoding) {
|
25215 | chunk = state.decoder.write(chunk);
|
25216 | if (state.objectMode || chunk.length !== 0) addChunk(stream, state, chunk, false);else maybeReadMore(stream, state);
|
25217 | } else {
|
25218 | addChunk(stream, state, chunk, false);
|
25219 | }
|
25220 | }
|
25221 | } else if (!addToFront) {
|
25222 | state.reading = false;
|
25223 | }
|
25224 | }
|
25225 |
|
25226 | return needMoreData(state);
|
25227 | }
|
25228 |
|
25229 | function addChunk(stream, state, chunk, addToFront) {
|
25230 | if (state.flowing && state.length === 0 && !state.sync) {
|
25231 | stream.emit('data', chunk);
|
25232 | stream.read(0);
|
25233 | } else {
|
25234 |
|
25235 | state.length += state.objectMode ? 1 : chunk.length;
|
25236 | if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk);
|
25237 |
|
25238 | if (state.needReadable) emitReadable(stream);
|
25239 | }
|
25240 | maybeReadMore(stream, state);
|
25241 | }
|
25242 |
|
25243 | function chunkInvalid(state, chunk) {
|
25244 | var er;
|
25245 | if (!_isUint8Array(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {
|
25246 | er = new TypeError('Invalid non-string/buffer chunk');
|
25247 | }
|
25248 | return er;
|
25249 | }
|
25250 |
|
25251 |
|
25252 |
|
25253 |
|
25254 |
|
25255 |
|
25256 |
|
25257 |
|
25258 | function needMoreData(state) {
|
25259 | return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0);
|
25260 | }
|
25261 |
|
25262 | Readable.prototype.isPaused = function () {
|
25263 | return this._readableState.flowing === false;
|
25264 | };
|
25265 |
|
25266 |
|
25267 | Readable.prototype.setEncoding = function (enc) {
|
25268 | if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder;
|
25269 | this._readableState.decoder = new StringDecoder(enc);
|
25270 | this._readableState.encoding = enc;
|
25271 | return this;
|
25272 | };
|
25273 |
|
25274 |
|
25275 | var MAX_HWM = 0x800000;
|
25276 | function computeNewHighWaterMark(n) {
|
25277 | if (n >= MAX_HWM) {
|
25278 | n = MAX_HWM;
|
25279 | } else {
|
25280 |
|
25281 |
|
25282 | n--;
|
25283 | n |= n >>> 1;
|
25284 | n |= n >>> 2;
|
25285 | n |= n >>> 4;
|
25286 | n |= n >>> 8;
|
25287 | n |= n >>> 16;
|
25288 | n++;
|
25289 | }
|
25290 | return n;
|
25291 | }
|
25292 |
|
25293 |
|
25294 |
|
25295 | function howMuchToRead(n, state) {
|
25296 | if (n <= 0 || state.length === 0 && state.ended) return 0;
|
25297 | if (state.objectMode) return 1;
|
25298 | if (n !== n) {
|
25299 |
|
25300 | if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;
|
25301 | }
|
25302 |
|
25303 | if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);
|
25304 | if (n <= state.length) return n;
|
25305 |
|
25306 | if (!state.ended) {
|
25307 | state.needReadable = true;
|
25308 | return 0;
|
25309 | }
|
25310 | return state.length;
|
25311 | }
|
25312 |
|
25313 |
|
25314 | Readable.prototype.read = function (n) {
|
25315 | debug('read', n);
|
25316 | n = parseInt(n, 10);
|
25317 | var state = this._readableState;
|
25318 | var nOrig = n;
|
25319 |
|
25320 | if (n !== 0) state.emittedReadable = false;
|
25321 |
|
25322 |
|
25323 |
|
25324 |
|
25325 | if (n === 0 && state.needReadable && (state.length >= state.highWaterMark || state.ended)) {
|
25326 | debug('read: emitReadable', state.length, state.ended);
|
25327 | if (state.length === 0 && state.ended) endReadable(this);else emitReadable(this);
|
25328 | return null;
|
25329 | }
|
25330 |
|
25331 | n = howMuchToRead(n, state);
|
25332 |
|
25333 |
|
25334 | if (n === 0 && state.ended) {
|
25335 | if (state.length === 0) endReadable(this);
|
25336 | return null;
|
25337 | }
|
25338 |
|
25339 |
|
25340 |
|
25341 |
|
25342 |
|
25343 |
|
25344 |
|
25345 |
|
25346 |
|
25347 |
|
25348 |
|
25349 |
|
25350 |
|
25351 |
|
25352 |
|
25353 |
|
25354 |
|
25355 |
|
25356 |
|
25357 |
|
25358 |
|
25359 |
|
25360 |
|
25361 |
|
25362 | var doRead = state.needReadable;
|
25363 | debug('need readable', doRead);
|
25364 |
|
25365 |
|
25366 | if (state.length === 0 || state.length - n < state.highWaterMark) {
|
25367 | doRead = true;
|
25368 | debug('length less than watermark', doRead);
|
25369 | }
|
25370 |
|
25371 |
|
25372 |
|
25373 | if (state.ended || state.reading) {
|
25374 | doRead = false;
|
25375 | debug('reading or ended', doRead);
|
25376 | } else if (doRead) {
|
25377 | debug('do read');
|
25378 | state.reading = true;
|
25379 | state.sync = true;
|
25380 |
|
25381 | if (state.length === 0) state.needReadable = true;
|
25382 |
|
25383 | this._read(state.highWaterMark);
|
25384 | state.sync = false;
|
25385 |
|
25386 |
|
25387 | if (!state.reading) n = howMuchToRead(nOrig, state);
|
25388 | }
|
25389 |
|
25390 | var ret;
|
25391 | if (n > 0) ret = fromList(n, state);else ret = null;
|
25392 |
|
25393 | if (ret === null) {
|
25394 | state.needReadable = true;
|
25395 | n = 0;
|
25396 | } else {
|
25397 | state.length -= n;
|
25398 | }
|
25399 |
|
25400 | if (state.length === 0) {
|
25401 |
|
25402 |
|
25403 | if (!state.ended) state.needReadable = true;
|
25404 |
|
25405 |
|
25406 | if (nOrig !== n && state.ended) endReadable(this);
|
25407 | }
|
25408 |
|
25409 | if (ret !== null) this.emit('data', ret);
|
25410 |
|
25411 | return ret;
|
25412 | };
|
25413 |
|
25414 | function onEofChunk(stream, state) {
|
25415 | if (state.ended) return;
|
25416 | if (state.decoder) {
|
25417 | var chunk = state.decoder.end();
|
25418 | if (chunk && chunk.length) {
|
25419 | state.buffer.push(chunk);
|
25420 | state.length += state.objectMode ? 1 : chunk.length;
|
25421 | }
|
25422 | }
|
25423 | state.ended = true;
|
25424 |
|
25425 |
|
25426 | emitReadable(stream);
|
25427 | }
|
25428 |
|
25429 |
|
25430 |
|
25431 |
|
25432 | function emitReadable(stream) {
|
25433 | var state = stream._readableState;
|
25434 | state.needReadable = false;
|
25435 | if (!state.emittedReadable) {
|
25436 | debug('emitReadable', state.flowing);
|
25437 | state.emittedReadable = true;
|
25438 | if (state.sync) pna.nextTick(emitReadable_, stream);else emitReadable_(stream);
|
25439 | }
|
25440 | }
|
25441 |
|
25442 | function emitReadable_(stream) {
|
25443 | debug('emit readable');
|
25444 | stream.emit('readable');
|
25445 | flow(stream);
|
25446 | }
|
25447 |
|
25448 |
|
25449 |
|
25450 |
|
25451 |
|
25452 |
|
25453 |
|
25454 | function maybeReadMore(stream, state) {
|
25455 | if (!state.readingMore) {
|
25456 | state.readingMore = true;
|
25457 | pna.nextTick(maybeReadMore_, stream, state);
|
25458 | }
|
25459 | }
|
25460 |
|
25461 | function maybeReadMore_(stream, state) {
|
25462 | var len = state.length;
|
25463 | while (!state.reading && !state.flowing && !state.ended && state.length < state.highWaterMark) {
|
25464 | debug('maybeReadMore read 0');
|
25465 | stream.read(0);
|
25466 | if (len === state.length)
|
25467 |
|
25468 | break;else len = state.length;
|
25469 | }
|
25470 | state.readingMore = false;
|
25471 | }
|
25472 |
|
25473 |
|
25474 |
|
25475 |
|
25476 |
|
25477 | Readable.prototype._read = function (n) {
|
25478 | this.emit('error', new Error('_read() is not implemented'));
|
25479 | };
|
25480 |
|
25481 | Readable.prototype.pipe = function (dest, pipeOpts) {
|
25482 | var src = this;
|
25483 | var state = this._readableState;
|
25484 |
|
25485 | switch (state.pipesCount) {
|
25486 | case 0:
|
25487 | state.pipes = dest;
|
25488 | break;
|
25489 | case 1:
|
25490 | state.pipes = [state.pipes, dest];
|
25491 | break;
|
25492 | default:
|
25493 | state.pipes.push(dest);
|
25494 | break;
|
25495 | }
|
25496 | state.pipesCount += 1;
|
25497 | debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts);
|
25498 |
|
25499 | var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr;
|
25500 |
|
25501 | var endFn = doEnd ? onend : unpipe;
|
25502 | if (state.endEmitted) pna.nextTick(endFn);else src.once('end', endFn);
|
25503 |
|
25504 | dest.on('unpipe', onunpipe);
|
25505 | function onunpipe(readable, unpipeInfo) {
|
25506 | debug('onunpipe');
|
25507 | if (readable === src) {
|
25508 | if (unpipeInfo && unpipeInfo.hasUnpiped === false) {
|
25509 | unpipeInfo.hasUnpiped = true;
|
25510 | cleanup();
|
25511 | }
|
25512 | }
|
25513 | }
|
25514 |
|
25515 | function onend() {
|
25516 | debug('onend');
|
25517 | dest.end();
|
25518 | }
|
25519 |
|
25520 |
|
25521 |
|
25522 |
|
25523 |
|
25524 | var ondrain = pipeOnDrain(src);
|
25525 | dest.on('drain', ondrain);
|
25526 |
|
25527 | var cleanedUp = false;
|
25528 | function cleanup() {
|
25529 | debug('cleanup');
|
25530 |
|
25531 | dest.removeListener('close', onclose);
|
25532 | dest.removeListener('finish', onfinish);
|
25533 | dest.removeListener('drain', ondrain);
|
25534 | dest.removeListener('error', onerror);
|
25535 | dest.removeListener('unpipe', onunpipe);
|
25536 | src.removeListener('end', onend);
|
25537 | src.removeListener('end', unpipe);
|
25538 | src.removeListener('data', ondata);
|
25539 |
|
25540 | cleanedUp = true;
|
25541 |
|
25542 |
|
25543 |
|
25544 |
|
25545 |
|
25546 |
|
25547 | if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain();
|
25548 | }
|
25549 |
|
25550 |
|
25551 |
|
25552 |
|
25553 |
|
25554 | var increasedAwaitDrain = false;
|
25555 | src.on('data', ondata);
|
25556 | function ondata(chunk) {
|
25557 | debug('ondata');
|
25558 | increasedAwaitDrain = false;
|
25559 | var ret = dest.write(chunk);
|
25560 | if (false === ret && !increasedAwaitDrain) {
|
25561 |
|
25562 |
|
25563 |
|
25564 |
|
25565 | if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) {
|
25566 | debug('false write response, pause', src._readableState.awaitDrain);
|
25567 | src._readableState.awaitDrain++;
|
25568 | increasedAwaitDrain = true;
|
25569 | }
|
25570 | src.pause();
|
25571 | }
|
25572 | }
|
25573 |
|
25574 |
|
25575 |
|
25576 | function onerror(er) {
|
25577 | debug('onerror', er);
|
25578 | unpipe();
|
25579 | dest.removeListener('error', onerror);
|
25580 | if (EElistenerCount(dest, 'error') === 0) dest.emit('error', er);
|
25581 | }
|
25582 |
|
25583 |
|
25584 | prependListener(dest, 'error', onerror);
|
25585 |
|
25586 |
|
25587 | function onclose() {
|
25588 | dest.removeListener('finish', onfinish);
|
25589 | unpipe();
|
25590 | }
|
25591 | dest.once('close', onclose);
|
25592 | function onfinish() {
|
25593 | debug('onfinish');
|
25594 | dest.removeListener('close', onclose);
|
25595 | unpipe();
|
25596 | }
|
25597 | dest.once('finish', onfinish);
|
25598 |
|
25599 | function unpipe() {
|
25600 | debug('unpipe');
|
25601 | src.unpipe(dest);
|
25602 | }
|
25603 |
|
25604 |
|
25605 | dest.emit('pipe', src);
|
25606 |
|
25607 |
|
25608 | if (!state.flowing) {
|
25609 | debug('pipe resume');
|
25610 | src.resume();
|
25611 | }
|
25612 |
|
25613 | return dest;
|
25614 | };
|
25615 |
|
25616 | function pipeOnDrain(src) {
|
25617 | return function () {
|
25618 | var state = src._readableState;
|
25619 | debug('pipeOnDrain', state.awaitDrain);
|
25620 | if (state.awaitDrain) state.awaitDrain--;
|
25621 | if (state.awaitDrain === 0 && EElistenerCount(src, 'data')) {
|
25622 | state.flowing = true;
|
25623 | flow(src);
|
25624 | }
|
25625 | };
|
25626 | }
|
25627 |
|
25628 | Readable.prototype.unpipe = function (dest) {
|
25629 | var state = this._readableState;
|
25630 | var unpipeInfo = { hasUnpiped: false };
|
25631 |
|
25632 |
|
25633 | if (state.pipesCount === 0) return this;
|
25634 |
|
25635 |
|
25636 | if (state.pipesCount === 1) {
|
25637 |
|
25638 | if (dest && dest !== state.pipes) return this;
|
25639 |
|
25640 | if (!dest) dest = state.pipes;
|
25641 |
|
25642 |
|
25643 | state.pipes = null;
|
25644 | state.pipesCount = 0;
|
25645 | state.flowing = false;
|
25646 | if (dest) dest.emit('unpipe', this, unpipeInfo);
|
25647 | return this;
|
25648 | }
|
25649 |
|
25650 |
|
25651 |
|
25652 | if (!dest) {
|
25653 |
|
25654 | var dests = state.pipes;
|
25655 | var len = state.pipesCount;
|
25656 | state.pipes = null;
|
25657 | state.pipesCount = 0;
|
25658 | state.flowing = false;
|
25659 |
|
25660 | for (var i = 0; i < len; i++) {
|
25661 | dests[i].emit('unpipe', this, unpipeInfo);
|
25662 | }return this;
|
25663 | }
|
25664 |
|
25665 |
|
25666 | var index = indexOf(state.pipes, dest);
|
25667 | if (index === -1) return this;
|
25668 |
|
25669 | state.pipes.splice(index, 1);
|
25670 | state.pipesCount -= 1;
|
25671 | if (state.pipesCount === 1) state.pipes = state.pipes[0];
|
25672 |
|
25673 | dest.emit('unpipe', this, unpipeInfo);
|
25674 |
|
25675 | return this;
|
25676 | };
|
25677 |
|
25678 |
|
25679 |
|
25680 | Readable.prototype.on = function (ev, fn) {
|
25681 | var res = Stream.prototype.on.call(this, ev, fn);
|
25682 |
|
25683 | if (ev === 'data') {
|
25684 |
|
25685 | if (this._readableState.flowing !== false) this.resume();
|
25686 | } else if (ev === 'readable') {
|
25687 | var state = this._readableState;
|
25688 | if (!state.endEmitted && !state.readableListening) {
|
25689 | state.readableListening = state.needReadable = true;
|
25690 | state.emittedReadable = false;
|
25691 | if (!state.reading) {
|
25692 | pna.nextTick(nReadingNextTick, this);
|
25693 | } else if (state.length) {
|
25694 | emitReadable(this);
|
25695 | }
|
25696 | }
|
25697 | }
|
25698 |
|
25699 | return res;
|
25700 | };
|
25701 | Readable.prototype.addListener = Readable.prototype.on;
|
25702 |
|
25703 | function nReadingNextTick(self) {
|
25704 | debug('readable nexttick read 0');
|
25705 | self.read(0);
|
25706 | }
|
25707 |
|
25708 |
|
25709 |
|
25710 | Readable.prototype.resume = function () {
|
25711 | var state = this._readableState;
|
25712 | if (!state.flowing) {
|
25713 | debug('resume');
|
25714 | state.flowing = true;
|
25715 | resume(this, state);
|
25716 | }
|
25717 | return this;
|
25718 | };
|
25719 |
|
25720 | function resume(stream, state) {
|
25721 | if (!state.resumeScheduled) {
|
25722 | state.resumeScheduled = true;
|
25723 | pna.nextTick(resume_, stream, state);
|
25724 | }
|
25725 | }
|
25726 |
|
25727 | function resume_(stream, state) {
|
25728 | if (!state.reading) {
|
25729 | debug('resume read 0');
|
25730 | stream.read(0);
|
25731 | }
|
25732 |
|
25733 | state.resumeScheduled = false;
|
25734 | state.awaitDrain = 0;
|
25735 | stream.emit('resume');
|
25736 | flow(stream);
|
25737 | if (state.flowing && !state.reading) stream.read(0);
|
25738 | }
|
25739 |
|
25740 | Readable.prototype.pause = function () {
|
25741 | debug('call pause flowing=%j', this._readableState.flowing);
|
25742 | if (false !== this._readableState.flowing) {
|
25743 | debug('pause');
|
25744 | this._readableState.flowing = false;
|
25745 | this.emit('pause');
|
25746 | }
|
25747 | return this;
|
25748 | };
|
25749 |
|
25750 | function flow(stream) {
|
25751 | var state = stream._readableState;
|
25752 | debug('flow', state.flowing);
|
25753 | while (state.flowing && stream.read() !== null) {}
|
25754 | }
|
25755 |
|
25756 |
|
25757 |
|
25758 |
|
25759 | Readable.prototype.wrap = function (stream) {
|
25760 | var _this = this;
|
25761 |
|
25762 | var state = this._readableState;
|
25763 | var paused = false;
|
25764 |
|
25765 | stream.on('end', function () {
|
25766 | debug('wrapped end');
|
25767 | if (state.decoder && !state.ended) {
|
25768 | var chunk = state.decoder.end();
|
25769 | if (chunk && chunk.length) _this.push(chunk);
|
25770 | }
|
25771 |
|
25772 | _this.push(null);
|
25773 | });
|
25774 |
|
25775 | stream.on('data', function (chunk) {
|
25776 | debug('wrapped data');
|
25777 | if (state.decoder) chunk = state.decoder.write(chunk);
|
25778 |
|
25779 |
|
25780 | if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return;
|
25781 |
|
25782 | var ret = _this.push(chunk);
|
25783 | if (!ret) {
|
25784 | paused = true;
|
25785 | stream.pause();
|
25786 | }
|
25787 | });
|
25788 |
|
25789 |
|
25790 |
|
25791 | for (var i in stream) {
|
25792 | if (this[i] === undefined && typeof stream[i] === 'function') {
|
25793 | this[i] = function (method) {
|
25794 | return function () {
|
25795 | return stream[method].apply(stream, arguments);
|
25796 | };
|
25797 | }(i);
|
25798 | }
|
25799 | }
|
25800 |
|
25801 |
|
25802 | for (var n = 0; n < kProxyEvents.length; n++) {
|
25803 | stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n]));
|
25804 | }
|
25805 |
|
25806 |
|
25807 |
|
25808 | this._read = function (n) {
|
25809 | debug('wrapped _read', n);
|
25810 | if (paused) {
|
25811 | paused = false;
|
25812 | stream.resume();
|
25813 | }
|
25814 | };
|
25815 |
|
25816 | return this;
|
25817 | };
|
25818 |
|
25819 | Object.defineProperty(Readable.prototype, 'readableHighWaterMark', {
|
25820 |
|
25821 |
|
25822 |
|
25823 | enumerable: false,
|
25824 | get: function () {
|
25825 | return this._readableState.highWaterMark;
|
25826 | }
|
25827 | });
|
25828 |
|
25829 |
|
25830 | Readable._fromList = fromList;
|
25831 |
|
25832 |
|
25833 |
|
25834 |
|
25835 |
|
25836 | function fromList(n, state) {
|
25837 |
|
25838 | if (state.length === 0) return null;
|
25839 |
|
25840 | var ret;
|
25841 | if (state.objectMode) ret = state.buffer.shift();else if (!n || n >= state.length) {
|
25842 |
|
25843 | if (state.decoder) ret = state.buffer.join('');else if (state.buffer.length === 1) ret = state.buffer.head.data;else ret = state.buffer.concat(state.length);
|
25844 | state.buffer.clear();
|
25845 | } else {
|
25846 |
|
25847 | ret = fromListPartial(n, state.buffer, state.decoder);
|
25848 | }
|
25849 |
|
25850 | return ret;
|
25851 | }
|
25852 |
|
25853 |
|
25854 |
|
25855 |
|
25856 | function fromListPartial(n, list, hasStrings) {
|
25857 | var ret;
|
25858 | if (n < list.head.data.length) {
|
25859 |
|
25860 | ret = list.head.data.slice(0, n);
|
25861 | list.head.data = list.head.data.slice(n);
|
25862 | } else if (n === list.head.data.length) {
|
25863 |
|
25864 | ret = list.shift();
|
25865 | } else {
|
25866 |
|
25867 | ret = hasStrings ? copyFromBufferString(n, list) : copyFromBuffer(n, list);
|
25868 | }
|
25869 | return ret;
|
25870 | }
|
25871 |
|
25872 |
|
25873 |
|
25874 |
|
25875 |
|
25876 | function copyFromBufferString(n, list) {
|
25877 | var p = list.head;
|
25878 | var c = 1;
|
25879 | var ret = p.data;
|
25880 | n -= ret.length;
|
25881 | while (p = p.next) {
|
25882 | var str = p.data;
|
25883 | var nb = n > str.length ? str.length : n;
|
25884 | if (nb === str.length) ret += str;else ret += str.slice(0, n);
|
25885 | n -= nb;
|
25886 | if (n === 0) {
|
25887 | if (nb === str.length) {
|
25888 | ++c;
|
25889 | if (p.next) list.head = p.next;else list.head = list.tail = null;
|
25890 | } else {
|
25891 | list.head = p;
|
25892 | p.data = str.slice(nb);
|
25893 | }
|
25894 | break;
|
25895 | }
|
25896 | ++c;
|
25897 | }
|
25898 | list.length -= c;
|
25899 | return ret;
|
25900 | }
|
25901 |
|
25902 |
|
25903 |
|
25904 |
|
25905 | function copyFromBuffer(n, list) {
|
25906 | var ret = Buffer.allocUnsafe(n);
|
25907 | var p = list.head;
|
25908 | var c = 1;
|
25909 | p.data.copy(ret);
|
25910 | n -= p.data.length;
|
25911 | while (p = p.next) {
|
25912 | var buf = p.data;
|
25913 | var nb = n > buf.length ? buf.length : n;
|
25914 | buf.copy(ret, ret.length - n, 0, nb);
|
25915 | n -= nb;
|
25916 | if (n === 0) {
|
25917 | if (nb === buf.length) {
|
25918 | ++c;
|
25919 | if (p.next) list.head = p.next;else list.head = list.tail = null;
|
25920 | } else {
|
25921 | list.head = p;
|
25922 | p.data = buf.slice(nb);
|
25923 | }
|
25924 | break;
|
25925 | }
|
25926 | ++c;
|
25927 | }
|
25928 | list.length -= c;
|
25929 | return ret;
|
25930 | }
|
25931 |
|
25932 | function endReadable(stream) {
|
25933 | var state = stream._readableState;
|
25934 |
|
25935 |
|
25936 |
|
25937 | if (state.length > 0) throw new Error('"endReadable()" called on non-empty stream');
|
25938 |
|
25939 | if (!state.endEmitted) {
|
25940 | state.ended = true;
|
25941 | pna.nextTick(endReadableNT, state, stream);
|
25942 | }
|
25943 | }
|
25944 |
|
25945 | function endReadableNT(state, stream) {
|
25946 |
|
25947 | if (!state.endEmitted && state.length === 0) {
|
25948 | state.endEmitted = true;
|
25949 | stream.readable = false;
|
25950 | stream.emit('end');
|
25951 | }
|
25952 | }
|
25953 |
|
25954 | function indexOf(xs, x) {
|
25955 | for (var i = 0, l = xs.length; i < l; i++) {
|
25956 | if (xs[i] === x) return i;
|
25957 | }
|
25958 | return -1;
|
25959 | }
|
25960 | }).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
25961 | },{"./_stream_duplex":325,"./internal/streams/BufferList":330,"./internal/streams/destroy":331,"./internal/streams/stream":332,"_process":393,"core-util-is":294,"events":297,"inherits":307,"isarray":309,"process-nextick-args":318,"safe-buffer":338,"string_decoder/":341,"util":78}],328:[function(require,module,exports){
|
25962 |
|
25963 |
|
25964 |
|
25965 |
|
25966 |
|
25967 |
|
25968 |
|
25969 |
|
25970 |
|
25971 |
|
25972 |
|
25973 |
|
25974 |
|
25975 |
|
25976 |
|
25977 |
|
25978 |
|
25979 |
|
25980 |
|
25981 |
|
25982 |
|
25983 |
|
25984 |
|
25985 |
|
25986 |
|
25987 |
|
25988 |
|
25989 |
|
25990 |
|
25991 |
|
25992 |
|
25993 |
|
25994 |
|
25995 |
|
25996 |
|
25997 |
|
25998 |
|
25999 |
|
26000 |
|
26001 |
|
26002 |
|
26003 |
|
26004 |
|
26005 |
|
26006 |
|
26007 |
|
26008 |
|
26009 |
|
26010 |
|
26011 |
|
26012 |
|
26013 |
|
26014 |
|
26015 |
|
26016 |
|
26017 |
|
26018 |
|
26019 |
|
26020 |
|
26021 |
|
26022 |
|
26023 |
|
26024 |
|
26025 | 'use strict';
|
26026 |
|
26027 | module.exports = Transform;
|
26028 |
|
26029 | var Duplex = require('./_stream_duplex');
|
26030 |
|
26031 |
|
26032 | var util = Object.create(require('core-util-is'));
|
26033 | util.inherits = require('inherits');
|
26034 |
|
26035 |
|
26036 | util.inherits(Transform, Duplex);
|
26037 |
|
26038 | function afterTransform(er, data) {
|
26039 | var ts = this._transformState;
|
26040 | ts.transforming = false;
|
26041 |
|
26042 | var cb = ts.writecb;
|
26043 |
|
26044 | if (!cb) {
|
26045 | return this.emit('error', new Error('write callback called multiple times'));
|
26046 | }
|
26047 |
|
26048 | ts.writechunk = null;
|
26049 | ts.writecb = null;
|
26050 |
|
26051 | if (data != null)
|
26052 | this.push(data);
|
26053 |
|
26054 | cb(er);
|
26055 |
|
26056 | var rs = this._readableState;
|
26057 | rs.reading = false;
|
26058 | if (rs.needReadable || rs.length < rs.highWaterMark) {
|
26059 | this._read(rs.highWaterMark);
|
26060 | }
|
26061 | }
|
26062 |
|
26063 | function Transform(options) {
|
26064 | if (!(this instanceof Transform)) return new Transform(options);
|
26065 |
|
26066 | Duplex.call(this, options);
|
26067 |
|
26068 | this._transformState = {
|
26069 | afterTransform: afterTransform.bind(this),
|
26070 | needTransform: false,
|
26071 | transforming: false,
|
26072 | writecb: null,
|
26073 | writechunk: null,
|
26074 | writeencoding: null
|
26075 | };
|
26076 |
|
26077 |
|
26078 | this._readableState.needReadable = true;
|
26079 |
|
26080 |
|
26081 |
|
26082 |
|
26083 | this._readableState.sync = false;
|
26084 |
|
26085 | if (options) {
|
26086 | if (typeof options.transform === 'function') this._transform = options.transform;
|
26087 |
|
26088 | if (typeof options.flush === 'function') this._flush = options.flush;
|
26089 | }
|
26090 |
|
26091 |
|
26092 | this.on('prefinish', prefinish);
|
26093 | }
|
26094 |
|
26095 | function prefinish() {
|
26096 | var _this = this;
|
26097 |
|
26098 | if (typeof this._flush === 'function') {
|
26099 | this._flush(function (er, data) {
|
26100 | done(_this, er, data);
|
26101 | });
|
26102 | } else {
|
26103 | done(this, null, null);
|
26104 | }
|
26105 | }
|
26106 |
|
26107 | Transform.prototype.push = function (chunk, encoding) {
|
26108 | this._transformState.needTransform = false;
|
26109 | return Duplex.prototype.push.call(this, chunk, encoding);
|
26110 | };
|
26111 |
|
26112 |
|
26113 |
|
26114 |
|
26115 |
|
26116 |
|
26117 |
|
26118 |
|
26119 |
|
26120 |
|
26121 |
|
26122 | Transform.prototype._transform = function (chunk, encoding, cb) {
|
26123 | throw new Error('_transform() is not implemented');
|
26124 | };
|
26125 |
|
26126 | Transform.prototype._write = function (chunk, encoding, cb) {
|
26127 | var ts = this._transformState;
|
26128 | ts.writecb = cb;
|
26129 | ts.writechunk = chunk;
|
26130 | ts.writeencoding = encoding;
|
26131 | if (!ts.transforming) {
|
26132 | var rs = this._readableState;
|
26133 | if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark);
|
26134 | }
|
26135 | };
|
26136 |
|
26137 |
|
26138 |
|
26139 |
|
26140 | Transform.prototype._read = function (n) {
|
26141 | var ts = this._transformState;
|
26142 |
|
26143 | if (ts.writechunk !== null && ts.writecb && !ts.transforming) {
|
26144 | ts.transforming = true;
|
26145 | this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);
|
26146 | } else {
|
26147 |
|
26148 |
|
26149 | ts.needTransform = true;
|
26150 | }
|
26151 | };
|
26152 |
|
26153 | Transform.prototype._destroy = function (err, cb) {
|
26154 | var _this2 = this;
|
26155 |
|
26156 | Duplex.prototype._destroy.call(this, err, function (err2) {
|
26157 | cb(err2);
|
26158 | _this2.emit('close');
|
26159 | });
|
26160 | };
|
26161 |
|
26162 | function done(stream, er, data) {
|
26163 | if (er) return stream.emit('error', er);
|
26164 |
|
26165 | if (data != null)
|
26166 | stream.push(data);
|
26167 |
|
26168 |
|
26169 |
|
26170 | if (stream._writableState.length) throw new Error('Calling transform done when ws.length != 0');
|
26171 |
|
26172 | if (stream._transformState.transforming) throw new Error('Calling transform done when still transforming');
|
26173 |
|
26174 | return stream.push(null);
|
26175 | }
|
26176 | },{"./_stream_duplex":325,"core-util-is":294,"inherits":307}],329:[function(require,module,exports){
|
26177 | (function (process,global,setImmediate){
|
26178 |
|
26179 |
|
26180 |
|
26181 |
|
26182 |
|
26183 |
|
26184 |
|
26185 |
|
26186 |
|
26187 |
|
26188 |
|
26189 |
|
26190 |
|
26191 |
|
26192 |
|
26193 |
|
26194 |
|
26195 |
|
26196 |
|
26197 |
|
26198 |
|
26199 |
|
26200 |
|
26201 |
|
26202 |
|
26203 | 'use strict';
|
26204 |
|
26205 |
|
26206 |
|
26207 | var pna = require('process-nextick-args');
|
26208 |
|
26209 |
|
26210 | module.exports = Writable;
|
26211 |
|
26212 |
|
26213 | function WriteReq(chunk, encoding, cb) {
|
26214 | this.chunk = chunk;
|
26215 | this.encoding = encoding;
|
26216 | this.callback = cb;
|
26217 | this.next = null;
|
26218 | }
|
26219 |
|
26220 |
|
26221 |
|
26222 | function CorkedRequest(state) {
|
26223 | var _this = this;
|
26224 |
|
26225 | this.next = null;
|
26226 | this.entry = null;
|
26227 | this.finish = function () {
|
26228 | onCorkedFinish(_this, state);
|
26229 | };
|
26230 | }
|
26231 |
|
26232 |
|
26233 |
|
26234 | var asyncWrite = !process.browser && ['v0.10', 'v0.9.'].indexOf(process.version.slice(0, 5)) > -1 ? setImmediate : pna.nextTick;
|
26235 |
|
26236 |
|
26237 |
|
26238 | var Duplex;
|
26239 |
|
26240 |
|
26241 | Writable.WritableState = WritableState;
|
26242 |
|
26243 |
|
26244 | var util = Object.create(require('core-util-is'));
|
26245 | util.inherits = require('inherits');
|
26246 |
|
26247 |
|
26248 |
|
26249 | var internalUtil = {
|
26250 | deprecate: require('util-deprecate')
|
26251 | };
|
26252 |
|
26253 |
|
26254 |
|
26255 | var Stream = require('./internal/streams/stream');
|
26256 |
|
26257 |
|
26258 |
|
26259 |
|
26260 | var Buffer = require('safe-buffer').Buffer;
|
26261 | var OurUint8Array = global.Uint8Array || function () {};
|
26262 | function _uint8ArrayToBuffer(chunk) {
|
26263 | return Buffer.from(chunk);
|
26264 | }
|
26265 | function _isUint8Array(obj) {
|
26266 | return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;
|
26267 | }
|
26268 |
|
26269 |
|
26270 |
|
26271 | var destroyImpl = require('./internal/streams/destroy');
|
26272 |
|
26273 | util.inherits(Writable, Stream);
|
26274 |
|
26275 | function nop() {}
|
26276 |
|
26277 | function WritableState(options, stream) {
|
26278 | Duplex = Duplex || require('./_stream_duplex');
|
26279 |
|
26280 | options = options || {};
|
26281 |
|
26282 |
|
26283 |
|
26284 |
|
26285 |
|
26286 |
|
26287 | var isDuplex = stream instanceof Duplex;
|
26288 |
|
26289 |
|
26290 |
|
26291 | this.objectMode = !!options.objectMode;
|
26292 |
|
26293 | if (isDuplex) this.objectMode = this.objectMode || !!options.writableObjectMode;
|
26294 |
|
26295 |
|
26296 |
|
26297 |
|
26298 | var hwm = options.highWaterMark;
|
26299 | var writableHwm = options.writableHighWaterMark;
|
26300 | var defaultHwm = this.objectMode ? 16 : 16 * 1024;
|
26301 |
|
26302 | if (hwm || hwm === 0) this.highWaterMark = hwm;else if (isDuplex && (writableHwm || writableHwm === 0)) this.highWaterMark = writableHwm;else this.highWaterMark = defaultHwm;
|
26303 |
|
26304 |
|
26305 | this.highWaterMark = Math.floor(this.highWaterMark);
|
26306 |
|
26307 |
|
26308 | this.finalCalled = false;
|
26309 |
|
26310 |
|
26311 | this.needDrain = false;
|
26312 |
|
26313 | this.ending = false;
|
26314 |
|
26315 | this.ended = false;
|
26316 |
|
26317 | this.finished = false;
|
26318 |
|
26319 |
|
26320 | this.destroyed = false;
|
26321 |
|
26322 |
|
26323 |
|
26324 |
|
26325 | var noDecode = options.decodeStrings === false;
|
26326 | this.decodeStrings = !noDecode;
|
26327 |
|
26328 |
|
26329 |
|
26330 |
|
26331 | this.defaultEncoding = options.defaultEncoding || 'utf8';
|
26332 |
|
26333 |
|
26334 |
|
26335 |
|
26336 | this.length = 0;
|
26337 |
|
26338 |
|
26339 | this.writing = false;
|
26340 |
|
26341 |
|
26342 | this.corked = 0;
|
26343 |
|
26344 |
|
26345 |
|
26346 |
|
26347 |
|
26348 | this.sync = true;
|
26349 |
|
26350 |
|
26351 |
|
26352 |
|
26353 | this.bufferProcessing = false;
|
26354 |
|
26355 |
|
26356 | this.onwrite = function (er) {
|
26357 | onwrite(stream, er);
|
26358 | };
|
26359 |
|
26360 |
|
26361 | this.writecb = null;
|
26362 |
|
26363 |
|
26364 | this.writelen = 0;
|
26365 |
|
26366 | this.bufferedRequest = null;
|
26367 | this.lastBufferedRequest = null;
|
26368 |
|
26369 |
|
26370 |
|
26371 | this.pendingcb = 0;
|
26372 |
|
26373 |
|
26374 |
|
26375 | this.prefinished = false;
|
26376 |
|
26377 |
|
26378 | this.errorEmitted = false;
|
26379 |
|
26380 |
|
26381 | this.bufferedRequestCount = 0;
|
26382 |
|
26383 |
|
26384 |
|
26385 | this.corkedRequestsFree = new CorkedRequest(this);
|
26386 | }
|
26387 |
|
26388 | WritableState.prototype.getBuffer = function getBuffer() {
|
26389 | var current = this.bufferedRequest;
|
26390 | var out = [];
|
26391 | while (current) {
|
26392 | out.push(current);
|
26393 | current = current.next;
|
26394 | }
|
26395 | return out;
|
26396 | };
|
26397 |
|
26398 | (function () {
|
26399 | try {
|
26400 | Object.defineProperty(WritableState.prototype, 'buffer', {
|
26401 | get: internalUtil.deprecate(function () {
|
26402 | return this.getBuffer();
|
26403 | }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.', 'DEP0003')
|
26404 | });
|
26405 | } catch (_) {}
|
26406 | })();
|
26407 |
|
26408 |
|
26409 |
|
26410 | var realHasInstance;
|
26411 | if (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === 'function') {
|
26412 | realHasInstance = Function.prototype[Symbol.hasInstance];
|
26413 | Object.defineProperty(Writable, Symbol.hasInstance, {
|
26414 | value: function (object) {
|
26415 | if (realHasInstance.call(this, object)) return true;
|
26416 | if (this !== Writable) return false;
|
26417 |
|
26418 | return object && object._writableState instanceof WritableState;
|
26419 | }
|
26420 | });
|
26421 | } else {
|
26422 | realHasInstance = function (object) {
|
26423 | return object instanceof this;
|
26424 | };
|
26425 | }
|
26426 |
|
26427 | function Writable(options) {
|
26428 | Duplex = Duplex || require('./_stream_duplex');
|
26429 |
|
26430 |
|
26431 |
|
26432 |
|
26433 |
|
26434 |
|
26435 |
|
26436 |
|
26437 | if (!realHasInstance.call(Writable, this) && !(this instanceof Duplex)) {
|
26438 | return new Writable(options);
|
26439 | }
|
26440 |
|
26441 | this._writableState = new WritableState(options, this);
|
26442 |
|
26443 |
|
26444 | this.writable = true;
|
26445 |
|
26446 | if (options) {
|
26447 | if (typeof options.write === 'function') this._write = options.write;
|
26448 |
|
26449 | if (typeof options.writev === 'function') this._writev = options.writev;
|
26450 |
|
26451 | if (typeof options.destroy === 'function') this._destroy = options.destroy;
|
26452 |
|
26453 | if (typeof options.final === 'function') this._final = options.final;
|
26454 | }
|
26455 |
|
26456 | Stream.call(this);
|
26457 | }
|
26458 |
|
26459 |
|
26460 | Writable.prototype.pipe = function () {
|
26461 | this.emit('error', new Error('Cannot pipe, not readable'));
|
26462 | };
|
26463 |
|
26464 | function writeAfterEnd(stream, cb) {
|
26465 | var er = new Error('write after end');
|
26466 |
|
26467 | stream.emit('error', er);
|
26468 | pna.nextTick(cb, er);
|
26469 | }
|
26470 |
|
26471 |
|
26472 |
|
26473 |
|
26474 | function validChunk(stream, state, chunk, cb) {
|
26475 | var valid = true;
|
26476 | var er = false;
|
26477 |
|
26478 | if (chunk === null) {
|
26479 | er = new TypeError('May not write null values to stream');
|
26480 | } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {
|
26481 | er = new TypeError('Invalid non-string/buffer chunk');
|
26482 | }
|
26483 | if (er) {
|
26484 | stream.emit('error', er);
|
26485 | pna.nextTick(cb, er);
|
26486 | valid = false;
|
26487 | }
|
26488 | return valid;
|
26489 | }
|
26490 |
|
26491 | Writable.prototype.write = function (chunk, encoding, cb) {
|
26492 | var state = this._writableState;
|
26493 | var ret = false;
|
26494 | var isBuf = !state.objectMode && _isUint8Array(chunk);
|
26495 |
|
26496 | if (isBuf && !Buffer.isBuffer(chunk)) {
|
26497 | chunk = _uint8ArrayToBuffer(chunk);
|
26498 | }
|
26499 |
|
26500 | if (typeof encoding === 'function') {
|
26501 | cb = encoding;
|
26502 | encoding = null;
|
26503 | }
|
26504 |
|
26505 | if (isBuf) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding;
|
26506 |
|
26507 | if (typeof cb !== 'function') cb = nop;
|
26508 |
|
26509 | if (state.ended) writeAfterEnd(this, cb);else if (isBuf || validChunk(this, state, chunk, cb)) {
|
26510 | state.pendingcb++;
|
26511 | ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb);
|
26512 | }
|
26513 |
|
26514 | return ret;
|
26515 | };
|
26516 |
|
26517 | Writable.prototype.cork = function () {
|
26518 | var state = this._writableState;
|
26519 |
|
26520 | state.corked++;
|
26521 | };
|
26522 |
|
26523 | Writable.prototype.uncork = function () {
|
26524 | var state = this._writableState;
|
26525 |
|
26526 | if (state.corked) {
|
26527 | state.corked--;
|
26528 |
|
26529 | if (!state.writing && !state.corked && !state.finished && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state);
|
26530 | }
|
26531 | };
|
26532 |
|
26533 | Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {
|
26534 |
|
26535 | if (typeof encoding === 'string') encoding = encoding.toLowerCase();
|
26536 | if (!(['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64', 'ucs2', 'ucs-2', 'utf16le', 'utf-16le', 'raw'].indexOf((encoding + '').toLowerCase()) > -1)) throw new TypeError('Unknown encoding: ' + encoding);
|
26537 | this._writableState.defaultEncoding = encoding;
|
26538 | return this;
|
26539 | };
|
26540 |
|
26541 | function decodeChunk(state, chunk, encoding) {
|
26542 | if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') {
|
26543 | chunk = Buffer.from(chunk, encoding);
|
26544 | }
|
26545 | return chunk;
|
26546 | }
|
26547 |
|
26548 | Object.defineProperty(Writable.prototype, 'writableHighWaterMark', {
|
26549 |
|
26550 |
|
26551 |
|
26552 | enumerable: false,
|
26553 | get: function () {
|
26554 | return this._writableState.highWaterMark;
|
26555 | }
|
26556 | });
|
26557 |
|
26558 |
|
26559 |
|
26560 |
|
26561 | function writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) {
|
26562 | if (!isBuf) {
|
26563 | var newChunk = decodeChunk(state, chunk, encoding);
|
26564 | if (chunk !== newChunk) {
|
26565 | isBuf = true;
|
26566 | encoding = 'buffer';
|
26567 | chunk = newChunk;
|
26568 | }
|
26569 | }
|
26570 | var len = state.objectMode ? 1 : chunk.length;
|
26571 |
|
26572 | state.length += len;
|
26573 |
|
26574 | var ret = state.length < state.highWaterMark;
|
26575 |
|
26576 | if (!ret) state.needDrain = true;
|
26577 |
|
26578 | if (state.writing || state.corked) {
|
26579 | var last = state.lastBufferedRequest;
|
26580 | state.lastBufferedRequest = {
|
26581 | chunk: chunk,
|
26582 | encoding: encoding,
|
26583 | isBuf: isBuf,
|
26584 | callback: cb,
|
26585 | next: null
|
26586 | };
|
26587 | if (last) {
|
26588 | last.next = state.lastBufferedRequest;
|
26589 | } else {
|
26590 | state.bufferedRequest = state.lastBufferedRequest;
|
26591 | }
|
26592 | state.bufferedRequestCount += 1;
|
26593 | } else {
|
26594 | doWrite(stream, state, false, len, chunk, encoding, cb);
|
26595 | }
|
26596 |
|
26597 | return ret;
|
26598 | }
|
26599 |
|
26600 | function doWrite(stream, state, writev, len, chunk, encoding, cb) {
|
26601 | state.writelen = len;
|
26602 | state.writecb = cb;
|
26603 | state.writing = true;
|
26604 | state.sync = true;
|
26605 | if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite);
|
26606 | state.sync = false;
|
26607 | }
|
26608 |
|
26609 | function onwriteError(stream, state, sync, er, cb) {
|
26610 | --state.pendingcb;
|
26611 |
|
26612 | if (sync) {
|
26613 |
|
26614 |
|
26615 | pna.nextTick(cb, er);
|
26616 |
|
26617 |
|
26618 | pna.nextTick(finishMaybe, stream, state);
|
26619 | stream._writableState.errorEmitted = true;
|
26620 | stream.emit('error', er);
|
26621 | } else {
|
26622 |
|
26623 |
|
26624 | cb(er);
|
26625 | stream._writableState.errorEmitted = true;
|
26626 | stream.emit('error', er);
|
26627 |
|
26628 |
|
26629 | finishMaybe(stream, state);
|
26630 | }
|
26631 | }
|
26632 |
|
26633 | function onwriteStateUpdate(state) {
|
26634 | state.writing = false;
|
26635 | state.writecb = null;
|
26636 | state.length -= state.writelen;
|
26637 | state.writelen = 0;
|
26638 | }
|
26639 |
|
26640 | function onwrite(stream, er) {
|
26641 | var state = stream._writableState;
|
26642 | var sync = state.sync;
|
26643 | var cb = state.writecb;
|
26644 |
|
26645 | onwriteStateUpdate(state);
|
26646 |
|
26647 | if (er) onwriteError(stream, state, sync, er, cb);else {
|
26648 |
|
26649 | var finished = needFinish(state);
|
26650 |
|
26651 | if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) {
|
26652 | clearBuffer(stream, state);
|
26653 | }
|
26654 |
|
26655 | if (sync) {
|
26656 |
|
26657 | asyncWrite(afterWrite, stream, state, finished, cb);
|
26658 |
|
26659 | } else {
|
26660 | afterWrite(stream, state, finished, cb);
|
26661 | }
|
26662 | }
|
26663 | }
|
26664 |
|
26665 | function afterWrite(stream, state, finished, cb) {
|
26666 | if (!finished) onwriteDrain(stream, state);
|
26667 | state.pendingcb--;
|
26668 | cb();
|
26669 | finishMaybe(stream, state);
|
26670 | }
|
26671 |
|
26672 |
|
26673 |
|
26674 |
|
26675 | function onwriteDrain(stream, state) {
|
26676 | if (state.length === 0 && state.needDrain) {
|
26677 | state.needDrain = false;
|
26678 | stream.emit('drain');
|
26679 | }
|
26680 | }
|
26681 |
|
26682 |
|
26683 | function clearBuffer(stream, state) {
|
26684 | state.bufferProcessing = true;
|
26685 | var entry = state.bufferedRequest;
|
26686 |
|
26687 | if (stream._writev && entry && entry.next) {
|
26688 |
|
26689 | var l = state.bufferedRequestCount;
|
26690 | var buffer = new Array(l);
|
26691 | var holder = state.corkedRequestsFree;
|
26692 | holder.entry = entry;
|
26693 |
|
26694 | var count = 0;
|
26695 | var allBuffers = true;
|
26696 | while (entry) {
|
26697 | buffer[count] = entry;
|
26698 | if (!entry.isBuf) allBuffers = false;
|
26699 | entry = entry.next;
|
26700 | count += 1;
|
26701 | }
|
26702 | buffer.allBuffers = allBuffers;
|
26703 |
|
26704 | doWrite(stream, state, true, state.length, buffer, '', holder.finish);
|
26705 |
|
26706 |
|
26707 |
|
26708 | state.pendingcb++;
|
26709 | state.lastBufferedRequest = null;
|
26710 | if (holder.next) {
|
26711 | state.corkedRequestsFree = holder.next;
|
26712 | holder.next = null;
|
26713 | } else {
|
26714 | state.corkedRequestsFree = new CorkedRequest(state);
|
26715 | }
|
26716 | state.bufferedRequestCount = 0;
|
26717 | } else {
|
26718 |
|
26719 | while (entry) {
|
26720 | var chunk = entry.chunk;
|
26721 | var encoding = entry.encoding;
|
26722 | var cb = entry.callback;
|
26723 | var len = state.objectMode ? 1 : chunk.length;
|
26724 |
|
26725 | doWrite(stream, state, false, len, chunk, encoding, cb);
|
26726 | entry = entry.next;
|
26727 | state.bufferedRequestCount--;
|
26728 |
|
26729 |
|
26730 |
|
26731 |
|
26732 | if (state.writing) {
|
26733 | break;
|
26734 | }
|
26735 | }
|
26736 |
|
26737 | if (entry === null) state.lastBufferedRequest = null;
|
26738 | }
|
26739 |
|
26740 | state.bufferedRequest = entry;
|
26741 | state.bufferProcessing = false;
|
26742 | }
|
26743 |
|
26744 | Writable.prototype._write = function (chunk, encoding, cb) {
|
26745 | cb(new Error('_write() is not implemented'));
|
26746 | };
|
26747 |
|
26748 | Writable.prototype._writev = null;
|
26749 |
|
26750 | Writable.prototype.end = function (chunk, encoding, cb) {
|
26751 | var state = this._writableState;
|
26752 |
|
26753 | if (typeof chunk === 'function') {
|
26754 | cb = chunk;
|
26755 | chunk = null;
|
26756 | encoding = null;
|
26757 | } else if (typeof encoding === 'function') {
|
26758 | cb = encoding;
|
26759 | encoding = null;
|
26760 | }
|
26761 |
|
26762 | if (chunk !== null && chunk !== undefined) this.write(chunk, encoding);
|
26763 |
|
26764 |
|
26765 | if (state.corked) {
|
26766 | state.corked = 1;
|
26767 | this.uncork();
|
26768 | }
|
26769 |
|
26770 |
|
26771 | if (!state.ending && !state.finished) endWritable(this, state, cb);
|
26772 | };
|
26773 |
|
26774 | function needFinish(state) {
|
26775 | return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing;
|
26776 | }
|
26777 | function callFinal(stream, state) {
|
26778 | stream._final(function (err) {
|
26779 | state.pendingcb--;
|
26780 | if (err) {
|
26781 | stream.emit('error', err);
|
26782 | }
|
26783 | state.prefinished = true;
|
26784 | stream.emit('prefinish');
|
26785 | finishMaybe(stream, state);
|
26786 | });
|
26787 | }
|
26788 | function prefinish(stream, state) {
|
26789 | if (!state.prefinished && !state.finalCalled) {
|
26790 | if (typeof stream._final === 'function') {
|
26791 | state.pendingcb++;
|
26792 | state.finalCalled = true;
|
26793 | pna.nextTick(callFinal, stream, state);
|
26794 | } else {
|
26795 | state.prefinished = true;
|
26796 | stream.emit('prefinish');
|
26797 | }
|
26798 | }
|
26799 | }
|
26800 |
|
26801 | function finishMaybe(stream, state) {
|
26802 | var need = needFinish(state);
|
26803 | if (need) {
|
26804 | prefinish(stream, state);
|
26805 | if (state.pendingcb === 0) {
|
26806 | state.finished = true;
|
26807 | stream.emit('finish');
|
26808 | }
|
26809 | }
|
26810 | return need;
|
26811 | }
|
26812 |
|
26813 | function endWritable(stream, state, cb) {
|
26814 | state.ending = true;
|
26815 | finishMaybe(stream, state);
|
26816 | if (cb) {
|
26817 | if (state.finished) pna.nextTick(cb);else stream.once('finish', cb);
|
26818 | }
|
26819 | state.ended = true;
|
26820 | stream.writable = false;
|
26821 | }
|
26822 |
|
26823 | function onCorkedFinish(corkReq, state, err) {
|
26824 | var entry = corkReq.entry;
|
26825 | corkReq.entry = null;
|
26826 | while (entry) {
|
26827 | var cb = entry.callback;
|
26828 | state.pendingcb--;
|
26829 | cb(err);
|
26830 | entry = entry.next;
|
26831 | }
|
26832 | if (state.corkedRequestsFree) {
|
26833 | state.corkedRequestsFree.next = corkReq;
|
26834 | } else {
|
26835 | state.corkedRequestsFree = corkReq;
|
26836 | }
|
26837 | }
|
26838 |
|
26839 | Object.defineProperty(Writable.prototype, 'destroyed', {
|
26840 | get: function () {
|
26841 | if (this._writableState === undefined) {
|
26842 | return false;
|
26843 | }
|
26844 | return this._writableState.destroyed;
|
26845 | },
|
26846 | set: function (value) {
|
26847 |
|
26848 |
|
26849 | if (!this._writableState) {
|
26850 | return;
|
26851 | }
|
26852 |
|
26853 |
|
26854 |
|
26855 | this._writableState.destroyed = value;
|
26856 | }
|
26857 | });
|
26858 |
|
26859 | Writable.prototype.destroy = destroyImpl.destroy;
|
26860 | Writable.prototype._undestroy = destroyImpl.undestroy;
|
26861 | Writable.prototype._destroy = function (err, cb) {
|
26862 | this.end();
|
26863 | cb(err);
|
26864 | };
|
26865 | }).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("timers").setImmediate)
|
26866 | },{"./_stream_duplex":325,"./internal/streams/destroy":331,"./internal/streams/stream":332,"_process":393,"core-util-is":294,"inherits":307,"process-nextick-args":318,"safe-buffer":338,"timers":342,"util-deprecate":343}],330:[function(require,module,exports){
|
26867 | 'use strict';
|
26868 |
|
26869 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
26870 |
|
26871 | var Buffer = require('safe-buffer').Buffer;
|
26872 | var util = require('util');
|
26873 |
|
26874 | function copyBuffer(src, target, offset) {
|
26875 | src.copy(target, offset);
|
26876 | }
|
26877 |
|
26878 | module.exports = function () {
|
26879 | function BufferList() {
|
26880 | _classCallCheck(this, BufferList);
|
26881 |
|
26882 | this.head = null;
|
26883 | this.tail = null;
|
26884 | this.length = 0;
|
26885 | }
|
26886 |
|
26887 | BufferList.prototype.push = function push(v) {
|
26888 | var entry = { data: v, next: null };
|
26889 | if (this.length > 0) this.tail.next = entry;else this.head = entry;
|
26890 | this.tail = entry;
|
26891 | ++this.length;
|
26892 | };
|
26893 |
|
26894 | BufferList.prototype.unshift = function unshift(v) {
|
26895 | var entry = { data: v, next: this.head };
|
26896 | if (this.length === 0) this.tail = entry;
|
26897 | this.head = entry;
|
26898 | ++this.length;
|
26899 | };
|
26900 |
|
26901 | BufferList.prototype.shift = function shift() {
|
26902 | if (this.length === 0) return;
|
26903 | var ret = this.head.data;
|
26904 | if (this.length === 1) this.head = this.tail = null;else this.head = this.head.next;
|
26905 | --this.length;
|
26906 | return ret;
|
26907 | };
|
26908 |
|
26909 | BufferList.prototype.clear = function clear() {
|
26910 | this.head = this.tail = null;
|
26911 | this.length = 0;
|
26912 | };
|
26913 |
|
26914 | BufferList.prototype.join = function join(s) {
|
26915 | if (this.length === 0) return '';
|
26916 | var p = this.head;
|
26917 | var ret = '' + p.data;
|
26918 | while (p = p.next) {
|
26919 | ret += s + p.data;
|
26920 | }return ret;
|
26921 | };
|
26922 |
|
26923 | BufferList.prototype.concat = function concat(n) {
|
26924 | if (this.length === 0) return Buffer.alloc(0);
|
26925 | if (this.length === 1) return this.head.data;
|
26926 | var ret = Buffer.allocUnsafe(n >>> 0);
|
26927 | var p = this.head;
|
26928 | var i = 0;
|
26929 | while (p) {
|
26930 | copyBuffer(p.data, ret, i);
|
26931 | i += p.data.length;
|
26932 | p = p.next;
|
26933 | }
|
26934 | return ret;
|
26935 | };
|
26936 |
|
26937 | return BufferList;
|
26938 | }();
|
26939 |
|
26940 | if (util && util.inspect && util.inspect.custom) {
|
26941 | module.exports.prototype[util.inspect.custom] = function () {
|
26942 | var obj = util.inspect({ length: this.length });
|
26943 | return this.constructor.name + ' ' + obj;
|
26944 | };
|
26945 | }
|
26946 | },{"safe-buffer":338,"util":78}],331:[function(require,module,exports){
|
26947 | 'use strict';
|
26948 |
|
26949 |
|
26950 |
|
26951 | var pna = require('process-nextick-args');
|
26952 |
|
26953 |
|
26954 |
|
26955 | function destroy(err, cb) {
|
26956 | var _this = this;
|
26957 |
|
26958 | var readableDestroyed = this._readableState && this._readableState.destroyed;
|
26959 | var writableDestroyed = this._writableState && this._writableState.destroyed;
|
26960 |
|
26961 | if (readableDestroyed || writableDestroyed) {
|
26962 | if (cb) {
|
26963 | cb(err);
|
26964 | } else if (err && (!this._writableState || !this._writableState.errorEmitted)) {
|
26965 | pna.nextTick(emitErrorNT, this, err);
|
26966 | }
|
26967 | return this;
|
26968 | }
|
26969 |
|
26970 |
|
26971 |
|
26972 |
|
26973 | if (this._readableState) {
|
26974 | this._readableState.destroyed = true;
|
26975 | }
|
26976 |
|
26977 |
|
26978 | if (this._writableState) {
|
26979 | this._writableState.destroyed = true;
|
26980 | }
|
26981 |
|
26982 | this._destroy(err || null, function (err) {
|
26983 | if (!cb && err) {
|
26984 | pna.nextTick(emitErrorNT, _this, err);
|
26985 | if (_this._writableState) {
|
26986 | _this._writableState.errorEmitted = true;
|
26987 | }
|
26988 | } else if (cb) {
|
26989 | cb(err);
|
26990 | }
|
26991 | });
|
26992 |
|
26993 | return this;
|
26994 | }
|
26995 |
|
26996 | function undestroy() {
|
26997 | if (this._readableState) {
|
26998 | this._readableState.destroyed = false;
|
26999 | this._readableState.reading = false;
|
27000 | this._readableState.ended = false;
|
27001 | this._readableState.endEmitted = false;
|
27002 | }
|
27003 |
|
27004 | if (this._writableState) {
|
27005 | this._writableState.destroyed = false;
|
27006 | this._writableState.ended = false;
|
27007 | this._writableState.ending = false;
|
27008 | this._writableState.finished = false;
|
27009 | this._writableState.errorEmitted = false;
|
27010 | }
|
27011 | }
|
27012 |
|
27013 | function emitErrorNT(self, err) {
|
27014 | self.emit('error', err);
|
27015 | }
|
27016 |
|
27017 | module.exports = {
|
27018 | destroy: destroy,
|
27019 | undestroy: undestroy
|
27020 | };
|
27021 | },{"process-nextick-args":318}],332:[function(require,module,exports){
|
27022 | arguments[4][96][0].apply(exports,arguments)
|
27023 | },{"dup":96,"events":297}],333:[function(require,module,exports){
|
27024 | module.exports = require('./readable').PassThrough
|
27025 |
|
27026 | },{"./readable":334}],334:[function(require,module,exports){
|
27027 | exports = module.exports = require('./lib/_stream_readable.js');
|
27028 | exports.Stream = exports;
|
27029 | exports.Readable = exports;
|
27030 | exports.Writable = require('./lib/_stream_writable.js');
|
27031 | exports.Duplex = require('./lib/_stream_duplex.js');
|
27032 | exports.Transform = require('./lib/_stream_transform.js');
|
27033 | exports.PassThrough = require('./lib/_stream_passthrough.js');
|
27034 |
|
27035 | },{"./lib/_stream_duplex.js":325,"./lib/_stream_passthrough.js":326,"./lib/_stream_readable.js":327,"./lib/_stream_transform.js":328,"./lib/_stream_writable.js":329}],335:[function(require,module,exports){
|
27036 | module.exports = require('./readable').Transform
|
27037 |
|
27038 | },{"./readable":334}],336:[function(require,module,exports){
|
27039 | module.exports = require('./lib/_stream_writable.js');
|
27040 |
|
27041 | },{"./lib/_stream_writable.js":329}],337:[function(require,module,exports){
|
27042 |
|
27043 |
|
27044 |
|
27045 |
|
27046 |
|
27047 |
|
27048 |
|
27049 | !(function(global) {
|
27050 | "use strict";
|
27051 |
|
27052 | var Op = Object.prototype;
|
27053 | var hasOwn = Op.hasOwnProperty;
|
27054 | var undefined;
|
27055 | var $Symbol = typeof Symbol === "function" ? Symbol : {};
|
27056 | var iteratorSymbol = $Symbol.iterator || "@@iterator";
|
27057 | var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
|
27058 | var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
|
27059 |
|
27060 | var inModule = typeof module === "object";
|
27061 | var runtime = global.regeneratorRuntime;
|
27062 | if (runtime) {
|
27063 | if (inModule) {
|
27064 |
|
27065 |
|
27066 | module.exports = runtime;
|
27067 | }
|
27068 |
|
27069 |
|
27070 | return;
|
27071 | }
|
27072 |
|
27073 |
|
27074 |
|
27075 | runtime = global.regeneratorRuntime = inModule ? module.exports : {};
|
27076 |
|
27077 | function wrap(innerFn, outerFn, self, tryLocsList) {
|
27078 |
|
27079 | var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
|
27080 | var generator = Object.create(protoGenerator.prototype);
|
27081 | var context = new Context(tryLocsList || []);
|
27082 |
|
27083 |
|
27084 |
|
27085 | generator._invoke = makeInvokeMethod(innerFn, self, context);
|
27086 |
|
27087 | return generator;
|
27088 | }
|
27089 | runtime.wrap = wrap;
|
27090 |
|
27091 |
|
27092 |
|
27093 |
|
27094 |
|
27095 |
|
27096 |
|
27097 |
|
27098 |
|
27099 |
|
27100 |
|
27101 | function tryCatch(fn, obj, arg) {
|
27102 | try {
|
27103 | return { type: "normal", arg: fn.call(obj, arg) };
|
27104 | } catch (err) {
|
27105 | return { type: "throw", arg: err };
|
27106 | }
|
27107 | }
|
27108 |
|
27109 | var GenStateSuspendedStart = "suspendedStart";
|
27110 | var GenStateSuspendedYield = "suspendedYield";
|
27111 | var GenStateExecuting = "executing";
|
27112 | var GenStateCompleted = "completed";
|
27113 |
|
27114 |
|
27115 |
|
27116 | var ContinueSentinel = {};
|
27117 |
|
27118 |
|
27119 |
|
27120 |
|
27121 |
|
27122 | function Generator() {}
|
27123 | function GeneratorFunction() {}
|
27124 | function GeneratorFunctionPrototype() {}
|
27125 |
|
27126 |
|
27127 |
|
27128 | var IteratorPrototype = {};
|
27129 | IteratorPrototype[iteratorSymbol] = function () {
|
27130 | return this;
|
27131 | };
|
27132 |
|
27133 | var getProto = Object.getPrototypeOf;
|
27134 | var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
|
27135 | if (NativeIteratorPrototype &&
|
27136 | NativeIteratorPrototype !== Op &&
|
27137 | hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
|
27138 |
|
27139 |
|
27140 | IteratorPrototype = NativeIteratorPrototype;
|
27141 | }
|
27142 |
|
27143 | var Gp = GeneratorFunctionPrototype.prototype =
|
27144 | Generator.prototype = Object.create(IteratorPrototype);
|
27145 | GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;
|
27146 | GeneratorFunctionPrototype.constructor = GeneratorFunction;
|
27147 | GeneratorFunctionPrototype[toStringTagSymbol] =
|
27148 | GeneratorFunction.displayName = "GeneratorFunction";
|
27149 |
|
27150 |
|
27151 |
|
27152 | function defineIteratorMethods(prototype) {
|
27153 | ["next", "throw", "return"].forEach(function(method) {
|
27154 | prototype[method] = function(arg) {
|
27155 | return this._invoke(method, arg);
|
27156 | };
|
27157 | });
|
27158 | }
|
27159 |
|
27160 | runtime.isGeneratorFunction = function(genFun) {
|
27161 | var ctor = typeof genFun === "function" && genFun.constructor;
|
27162 | return ctor
|
27163 | ? ctor === GeneratorFunction ||
|
27164 |
|
27165 |
|
27166 | (ctor.displayName || ctor.name) === "GeneratorFunction"
|
27167 | : false;
|
27168 | };
|
27169 |
|
27170 | runtime.mark = function(genFun) {
|
27171 | if (Object.setPrototypeOf) {
|
27172 | Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
|
27173 | } else {
|
27174 | genFun.__proto__ = GeneratorFunctionPrototype;
|
27175 | if (!(toStringTagSymbol in genFun)) {
|
27176 | genFun[toStringTagSymbol] = "GeneratorFunction";
|
27177 | }
|
27178 | }
|
27179 | genFun.prototype = Object.create(Gp);
|
27180 | return genFun;
|
27181 | };
|
27182 |
|
27183 |
|
27184 |
|
27185 |
|
27186 |
|
27187 | runtime.awrap = function(arg) {
|
27188 | return { __await: arg };
|
27189 | };
|
27190 |
|
27191 | function AsyncIterator(generator) {
|
27192 | function invoke(method, arg, resolve, reject) {
|
27193 | var record = tryCatch(generator[method], generator, arg);
|
27194 | if (record.type === "throw") {
|
27195 | reject(record.arg);
|
27196 | } else {
|
27197 | var result = record.arg;
|
27198 | var value = result.value;
|
27199 | if (value &&
|
27200 | typeof value === "object" &&
|
27201 | hasOwn.call(value, "__await")) {
|
27202 | return Promise.resolve(value.__await).then(function(value) {
|
27203 | invoke("next", value, resolve, reject);
|
27204 | }, function(err) {
|
27205 | invoke("throw", err, resolve, reject);
|
27206 | });
|
27207 | }
|
27208 |
|
27209 | return Promise.resolve(value).then(function(unwrapped) {
|
27210 |
|
27211 |
|
27212 |
|
27213 |
|
27214 |
|
27215 |
|
27216 |
|
27217 |
|
27218 |
|
27219 |
|
27220 |
|
27221 |
|
27222 |
|
27223 |
|
27224 |
|
27225 | result.value = unwrapped;
|
27226 | resolve(result);
|
27227 | }, reject);
|
27228 | }
|
27229 | }
|
27230 |
|
27231 | var previousPromise;
|
27232 |
|
27233 | function enqueue(method, arg) {
|
27234 | function callInvokeWithMethodAndArg() {
|
27235 | return new Promise(function(resolve, reject) {
|
27236 | invoke(method, arg, resolve, reject);
|
27237 | });
|
27238 | }
|
27239 |
|
27240 | return previousPromise =
|
27241 |
|
27242 |
|
27243 |
|
27244 |
|
27245 |
|
27246 |
|
27247 |
|
27248 |
|
27249 |
|
27250 |
|
27251 |
|
27252 |
|
27253 | previousPromise ? previousPromise.then(
|
27254 | callInvokeWithMethodAndArg,
|
27255 |
|
27256 |
|
27257 | callInvokeWithMethodAndArg
|
27258 | ) : callInvokeWithMethodAndArg();
|
27259 | }
|
27260 |
|
27261 |
|
27262 |
|
27263 | this._invoke = enqueue;
|
27264 | }
|
27265 |
|
27266 | defineIteratorMethods(AsyncIterator.prototype);
|
27267 | AsyncIterator.prototype[asyncIteratorSymbol] = function () {
|
27268 | return this;
|
27269 | };
|
27270 | runtime.AsyncIterator = AsyncIterator;
|
27271 |
|
27272 |
|
27273 |
|
27274 |
|
27275 | runtime.async = function(innerFn, outerFn, self, tryLocsList) {
|
27276 | var iter = new AsyncIterator(
|
27277 | wrap(innerFn, outerFn, self, tryLocsList)
|
27278 | );
|
27279 |
|
27280 | return runtime.isGeneratorFunction(outerFn)
|
27281 | ? iter
|
27282 | : iter.next().then(function(result) {
|
27283 | return result.done ? result.value : iter.next();
|
27284 | });
|
27285 | };
|
27286 |
|
27287 | function makeInvokeMethod(innerFn, self, context) {
|
27288 | var state = GenStateSuspendedStart;
|
27289 |
|
27290 | return function invoke(method, arg) {
|
27291 | if (state === GenStateExecuting) {
|
27292 | throw new Error("Generator is already running");
|
27293 | }
|
27294 |
|
27295 | if (state === GenStateCompleted) {
|
27296 | if (method === "throw") {
|
27297 | throw arg;
|
27298 | }
|
27299 |
|
27300 |
|
27301 |
|
27302 | return doneResult();
|
27303 | }
|
27304 |
|
27305 | context.method = method;
|
27306 | context.arg = arg;
|
27307 |
|
27308 | while (true) {
|
27309 | var delegate = context.delegate;
|
27310 | if (delegate) {
|
27311 | var delegateResult = maybeInvokeDelegate(delegate, context);
|
27312 | if (delegateResult) {
|
27313 | if (delegateResult === ContinueSentinel) continue;
|
27314 | return delegateResult;
|
27315 | }
|
27316 | }
|
27317 |
|
27318 | if (context.method === "next") {
|
27319 |
|
27320 |
|
27321 | context.sent = context._sent = context.arg;
|
27322 |
|
27323 | } else if (context.method === "throw") {
|
27324 | if (state === GenStateSuspendedStart) {
|
27325 | state = GenStateCompleted;
|
27326 | throw context.arg;
|
27327 | }
|
27328 |
|
27329 | context.dispatchException(context.arg);
|
27330 |
|
27331 | } else if (context.method === "return") {
|
27332 | context.abrupt("return", context.arg);
|
27333 | }
|
27334 |
|
27335 | state = GenStateExecuting;
|
27336 |
|
27337 | var record = tryCatch(innerFn, self, context);
|
27338 | if (record.type === "normal") {
|
27339 |
|
27340 |
|
27341 | state = context.done
|
27342 | ? GenStateCompleted
|
27343 | : GenStateSuspendedYield;
|
27344 |
|
27345 | if (record.arg === ContinueSentinel) {
|
27346 | continue;
|
27347 | }
|
27348 |
|
27349 | return {
|
27350 | value: record.arg,
|
27351 | done: context.done
|
27352 | };
|
27353 |
|
27354 | } else if (record.type === "throw") {
|
27355 | state = GenStateCompleted;
|
27356 |
|
27357 |
|
27358 | context.method = "throw";
|
27359 | context.arg = record.arg;
|
27360 | }
|
27361 | }
|
27362 | };
|
27363 | }
|
27364 |
|
27365 |
|
27366 |
|
27367 |
|
27368 |
|
27369 | function maybeInvokeDelegate(delegate, context) {
|
27370 | var method = delegate.iterator[context.method];
|
27371 | if (method === undefined) {
|
27372 |
|
27373 |
|
27374 | context.delegate = null;
|
27375 |
|
27376 | if (context.method === "throw") {
|
27377 | if (delegate.iterator.return) {
|
27378 |
|
27379 |
|
27380 | context.method = "return";
|
27381 | context.arg = undefined;
|
27382 | maybeInvokeDelegate(delegate, context);
|
27383 |
|
27384 | if (context.method === "throw") {
|
27385 |
|
27386 |
|
27387 | return ContinueSentinel;
|
27388 | }
|
27389 | }
|
27390 |
|
27391 | context.method = "throw";
|
27392 | context.arg = new TypeError(
|
27393 | "The iterator does not provide a 'throw' method");
|
27394 | }
|
27395 |
|
27396 | return ContinueSentinel;
|
27397 | }
|
27398 |
|
27399 | var record = tryCatch(method, delegate.iterator, context.arg);
|
27400 |
|
27401 | if (record.type === "throw") {
|
27402 | context.method = "throw";
|
27403 | context.arg = record.arg;
|
27404 | context.delegate = null;
|
27405 | return ContinueSentinel;
|
27406 | }
|
27407 |
|
27408 | var info = record.arg;
|
27409 |
|
27410 | if (! info) {
|
27411 | context.method = "throw";
|
27412 | context.arg = new TypeError("iterator result is not an object");
|
27413 | context.delegate = null;
|
27414 | return ContinueSentinel;
|
27415 | }
|
27416 |
|
27417 | if (info.done) {
|
27418 |
|
27419 |
|
27420 | context[delegate.resultName] = info.value;
|
27421 |
|
27422 |
|
27423 | context.next = delegate.nextLoc;
|
27424 |
|
27425 |
|
27426 |
|
27427 |
|
27428 |
|
27429 |
|
27430 |
|
27431 | if (context.method !== "return") {
|
27432 | context.method = "next";
|
27433 | context.arg = undefined;
|
27434 | }
|
27435 |
|
27436 | } else {
|
27437 |
|
27438 | return info;
|
27439 | }
|
27440 |
|
27441 |
|
27442 |
|
27443 | context.delegate = null;
|
27444 | return ContinueSentinel;
|
27445 | }
|
27446 |
|
27447 |
|
27448 |
|
27449 | defineIteratorMethods(Gp);
|
27450 |
|
27451 | Gp[toStringTagSymbol] = "Generator";
|
27452 |
|
27453 |
|
27454 |
|
27455 |
|
27456 |
|
27457 |
|
27458 | Gp[iteratorSymbol] = function() {
|
27459 | return this;
|
27460 | };
|
27461 |
|
27462 | Gp.toString = function() {
|
27463 | return "[object Generator]";
|
27464 | };
|
27465 |
|
27466 | function pushTryEntry(locs) {
|
27467 | var entry = { tryLoc: locs[0] };
|
27468 |
|
27469 | if (1 in locs) {
|
27470 | entry.catchLoc = locs[1];
|
27471 | }
|
27472 |
|
27473 | if (2 in locs) {
|
27474 | entry.finallyLoc = locs[2];
|
27475 | entry.afterLoc = locs[3];
|
27476 | }
|
27477 |
|
27478 | this.tryEntries.push(entry);
|
27479 | }
|
27480 |
|
27481 | function resetTryEntry(entry) {
|
27482 | var record = entry.completion || {};
|
27483 | record.type = "normal";
|
27484 | delete record.arg;
|
27485 | entry.completion = record;
|
27486 | }
|
27487 |
|
27488 | function Context(tryLocsList) {
|
27489 |
|
27490 |
|
27491 |
|
27492 | this.tryEntries = [{ tryLoc: "root" }];
|
27493 | tryLocsList.forEach(pushTryEntry, this);
|
27494 | this.reset(true);
|
27495 | }
|
27496 |
|
27497 | runtime.keys = function(object) {
|
27498 | var keys = [];
|
27499 | for (var key in object) {
|
27500 | keys.push(key);
|
27501 | }
|
27502 | keys.reverse();
|
27503 |
|
27504 |
|
27505 |
|
27506 | return function next() {
|
27507 | while (keys.length) {
|
27508 | var key = keys.pop();
|
27509 | if (key in object) {
|
27510 | next.value = key;
|
27511 | next.done = false;
|
27512 | return next;
|
27513 | }
|
27514 | }
|
27515 |
|
27516 |
|
27517 |
|
27518 |
|
27519 | next.done = true;
|
27520 | return next;
|
27521 | };
|
27522 | };
|
27523 |
|
27524 | function values(iterable) {
|
27525 | if (iterable) {
|
27526 | var iteratorMethod = iterable[iteratorSymbol];
|
27527 | if (iteratorMethod) {
|
27528 | return iteratorMethod.call(iterable);
|
27529 | }
|
27530 |
|
27531 | if (typeof iterable.next === "function") {
|
27532 | return iterable;
|
27533 | }
|
27534 |
|
27535 | if (!isNaN(iterable.length)) {
|
27536 | var i = -1, next = function next() {
|
27537 | while (++i < iterable.length) {
|
27538 | if (hasOwn.call(iterable, i)) {
|
27539 | next.value = iterable[i];
|
27540 | next.done = false;
|
27541 | return next;
|
27542 | }
|
27543 | }
|
27544 |
|
27545 | next.value = undefined;
|
27546 | next.done = true;
|
27547 |
|
27548 | return next;
|
27549 | };
|
27550 |
|
27551 | return next.next = next;
|
27552 | }
|
27553 | }
|
27554 |
|
27555 |
|
27556 | return { next: doneResult };
|
27557 | }
|
27558 | runtime.values = values;
|
27559 |
|
27560 | function doneResult() {
|
27561 | return { value: undefined, done: true };
|
27562 | }
|
27563 |
|
27564 | Context.prototype = {
|
27565 | constructor: Context,
|
27566 |
|
27567 | reset: function(skipTempReset) {
|
27568 | this.prev = 0;
|
27569 | this.next = 0;
|
27570 |
|
27571 |
|
27572 | this.sent = this._sent = undefined;
|
27573 | this.done = false;
|
27574 | this.delegate = null;
|
27575 |
|
27576 | this.method = "next";
|
27577 | this.arg = undefined;
|
27578 |
|
27579 | this.tryEntries.forEach(resetTryEntry);
|
27580 |
|
27581 | if (!skipTempReset) {
|
27582 | for (var name in this) {
|
27583 |
|
27584 | if (name.charAt(0) === "t" &&
|
27585 | hasOwn.call(this, name) &&
|
27586 | !isNaN(+name.slice(1))) {
|
27587 | this[name] = undefined;
|
27588 | }
|
27589 | }
|
27590 | }
|
27591 | },
|
27592 |
|
27593 | stop: function() {
|
27594 | this.done = true;
|
27595 |
|
27596 | var rootEntry = this.tryEntries[0];
|
27597 | var rootRecord = rootEntry.completion;
|
27598 | if (rootRecord.type === "throw") {
|
27599 | throw rootRecord.arg;
|
27600 | }
|
27601 |
|
27602 | return this.rval;
|
27603 | },
|
27604 |
|
27605 | dispatchException: function(exception) {
|
27606 | if (this.done) {
|
27607 | throw exception;
|
27608 | }
|
27609 |
|
27610 | var context = this;
|
27611 | function handle(loc, caught) {
|
27612 | record.type = "throw";
|
27613 | record.arg = exception;
|
27614 | context.next = loc;
|
27615 |
|
27616 | if (caught) {
|
27617 |
|
27618 |
|
27619 | context.method = "next";
|
27620 | context.arg = undefined;
|
27621 | }
|
27622 |
|
27623 | return !! caught;
|
27624 | }
|
27625 |
|
27626 | for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
27627 | var entry = this.tryEntries[i];
|
27628 | var record = entry.completion;
|
27629 |
|
27630 | if (entry.tryLoc === "root") {
|
27631 |
|
27632 |
|
27633 |
|
27634 | return handle("end");
|
27635 | }
|
27636 |
|
27637 | if (entry.tryLoc <= this.prev) {
|
27638 | var hasCatch = hasOwn.call(entry, "catchLoc");
|
27639 | var hasFinally = hasOwn.call(entry, "finallyLoc");
|
27640 |
|
27641 | if (hasCatch && hasFinally) {
|
27642 | if (this.prev < entry.catchLoc) {
|
27643 | return handle(entry.catchLoc, true);
|
27644 | } else if (this.prev < entry.finallyLoc) {
|
27645 | return handle(entry.finallyLoc);
|
27646 | }
|
27647 |
|
27648 | } else if (hasCatch) {
|
27649 | if (this.prev < entry.catchLoc) {
|
27650 | return handle(entry.catchLoc, true);
|
27651 | }
|
27652 |
|
27653 | } else if (hasFinally) {
|
27654 | if (this.prev < entry.finallyLoc) {
|
27655 | return handle(entry.finallyLoc);
|
27656 | }
|
27657 |
|
27658 | } else {
|
27659 | throw new Error("try statement without catch or finally");
|
27660 | }
|
27661 | }
|
27662 | }
|
27663 | },
|
27664 |
|
27665 | abrupt: function(type, arg) {
|
27666 | for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
27667 | var entry = this.tryEntries[i];
|
27668 | if (entry.tryLoc <= this.prev &&
|
27669 | hasOwn.call(entry, "finallyLoc") &&
|
27670 | this.prev < entry.finallyLoc) {
|
27671 | var finallyEntry = entry;
|
27672 | break;
|
27673 | }
|
27674 | }
|
27675 |
|
27676 | if (finallyEntry &&
|
27677 | (type === "break" ||
|
27678 | type === "continue") &&
|
27679 | finallyEntry.tryLoc <= arg &&
|
27680 | arg <= finallyEntry.finallyLoc) {
|
27681 |
|
27682 |
|
27683 | finallyEntry = null;
|
27684 | }
|
27685 |
|
27686 | var record = finallyEntry ? finallyEntry.completion : {};
|
27687 | record.type = type;
|
27688 | record.arg = arg;
|
27689 |
|
27690 | if (finallyEntry) {
|
27691 | this.method = "next";
|
27692 | this.next = finallyEntry.finallyLoc;
|
27693 | return ContinueSentinel;
|
27694 | }
|
27695 |
|
27696 | return this.complete(record);
|
27697 | },
|
27698 |
|
27699 | complete: function(record, afterLoc) {
|
27700 | if (record.type === "throw") {
|
27701 | throw record.arg;
|
27702 | }
|
27703 |
|
27704 | if (record.type === "break" ||
|
27705 | record.type === "continue") {
|
27706 | this.next = record.arg;
|
27707 | } else if (record.type === "return") {
|
27708 | this.rval = this.arg = record.arg;
|
27709 | this.method = "return";
|
27710 | this.next = "end";
|
27711 | } else if (record.type === "normal" && afterLoc) {
|
27712 | this.next = afterLoc;
|
27713 | }
|
27714 |
|
27715 | return ContinueSentinel;
|
27716 | },
|
27717 |
|
27718 | finish: function(finallyLoc) {
|
27719 | for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
27720 | var entry = this.tryEntries[i];
|
27721 | if (entry.finallyLoc === finallyLoc) {
|
27722 | this.complete(entry.completion, entry.afterLoc);
|
27723 | resetTryEntry(entry);
|
27724 | return ContinueSentinel;
|
27725 | }
|
27726 | }
|
27727 | },
|
27728 |
|
27729 | "catch": function(tryLoc) {
|
27730 | for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
27731 | var entry = this.tryEntries[i];
|
27732 | if (entry.tryLoc === tryLoc) {
|
27733 | var record = entry.completion;
|
27734 | if (record.type === "throw") {
|
27735 | var thrown = record.arg;
|
27736 | resetTryEntry(entry);
|
27737 | }
|
27738 | return thrown;
|
27739 | }
|
27740 | }
|
27741 |
|
27742 |
|
27743 |
|
27744 | throw new Error("illegal catch attempt");
|
27745 | },
|
27746 |
|
27747 | delegateYield: function(iterable, resultName, nextLoc) {
|
27748 | this.delegate = {
|
27749 | iterator: values(iterable),
|
27750 | resultName: resultName,
|
27751 | nextLoc: nextLoc
|
27752 | };
|
27753 |
|
27754 | if (this.method === "next") {
|
27755 |
|
27756 |
|
27757 | this.arg = undefined;
|
27758 | }
|
27759 |
|
27760 | return ContinueSentinel;
|
27761 | }
|
27762 | };
|
27763 | })(
|
27764 |
|
27765 |
|
27766 |
|
27767 | (function() { return this })() || Function("return this")()
|
27768 | );
|
27769 |
|
27770 | },{}],338:[function(require,module,exports){
|
27771 |
|
27772 | var buffer = require('buffer')
|
27773 | var Buffer = buffer.Buffer
|
27774 |
|
27775 |
|
27776 | function copyProps (src, dst) {
|
27777 | for (var key in src) {
|
27778 | dst[key] = src[key]
|
27779 | }
|
27780 | }
|
27781 | if (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) {
|
27782 | module.exports = buffer
|
27783 | } else {
|
27784 |
|
27785 | copyProps(buffer, exports)
|
27786 | exports.Buffer = SafeBuffer
|
27787 | }
|
27788 |
|
27789 | function SafeBuffer (arg, encodingOrOffset, length) {
|
27790 | return Buffer(arg, encodingOrOffset, length)
|
27791 | }
|
27792 |
|
27793 |
|
27794 | copyProps(Buffer, SafeBuffer)
|
27795 |
|
27796 | SafeBuffer.from = function (arg, encodingOrOffset, length) {
|
27797 | if (typeof arg === 'number') {
|
27798 | throw new TypeError('Argument must not be a number')
|
27799 | }
|
27800 | return Buffer(arg, encodingOrOffset, length)
|
27801 | }
|
27802 |
|
27803 | SafeBuffer.alloc = function (size, fill, encoding) {
|
27804 | if (typeof size !== 'number') {
|
27805 | throw new TypeError('Argument must be a number')
|
27806 | }
|
27807 | var buf = Buffer(size)
|
27808 | if (fill !== undefined) {
|
27809 | if (typeof encoding === 'string') {
|
27810 | buf.fill(fill, encoding)
|
27811 | } else {
|
27812 | buf.fill(fill)
|
27813 | }
|
27814 | } else {
|
27815 | buf.fill(0)
|
27816 | }
|
27817 | return buf
|
27818 | }
|
27819 |
|
27820 | SafeBuffer.allocUnsafe = function (size) {
|
27821 | if (typeof size !== 'number') {
|
27822 | throw new TypeError('Argument must be a number')
|
27823 | }
|
27824 | return Buffer(size)
|
27825 | }
|
27826 |
|
27827 | SafeBuffer.allocUnsafeSlow = function (size) {
|
27828 | if (typeof size !== 'number') {
|
27829 | throw new TypeError('Argument must be a number')
|
27830 | }
|
27831 | return buffer.SlowBuffer(size)
|
27832 | }
|
27833 |
|
27834 | },{"buffer":98}],339:[function(require,module,exports){
|
27835 | (function (Buffer){
|
27836 | ;(function (sax) {
|
27837 | sax.parser = function (strict, opt) { return new SAXParser(strict, opt) }
|
27838 | sax.SAXParser = SAXParser
|
27839 | sax.SAXStream = SAXStream
|
27840 | sax.createStream = createStream
|
27841 |
|
27842 |
|
27843 |
|
27844 |
|
27845 |
|
27846 |
|
27847 |
|
27848 |
|
27849 |
|
27850 |
|
27851 | sax.MAX_BUFFER_LENGTH = 64 * 1024
|
27852 |
|
27853 | var buffers = [
|
27854 | 'comment', 'sgmlDecl', 'textNode', 'tagName', 'doctype',
|
27855 | 'procInstName', 'procInstBody', 'entity', 'attribName',
|
27856 | 'attribValue', 'cdata', 'script'
|
27857 | ]
|
27858 |
|
27859 | sax.EVENTS = [
|
27860 | 'text',
|
27861 | 'processinginstruction',
|
27862 | 'sgmldeclaration',
|
27863 | 'doctype',
|
27864 | 'comment',
|
27865 | 'opentagstart',
|
27866 | 'attribute',
|
27867 | 'opentag',
|
27868 | 'closetag',
|
27869 | 'opencdata',
|
27870 | 'cdata',
|
27871 | 'closecdata',
|
27872 | 'error',
|
27873 | 'end',
|
27874 | 'ready',
|
27875 | 'script',
|
27876 | 'opennamespace',
|
27877 | 'closenamespace'
|
27878 | ]
|
27879 |
|
27880 | function SAXParser (strict, opt) {
|
27881 | if (!(this instanceof SAXParser)) {
|
27882 | return new SAXParser(strict, opt)
|
27883 | }
|
27884 |
|
27885 | var parser = this
|
27886 | clearBuffers(parser)
|
27887 | parser.q = parser.c = ''
|
27888 | parser.bufferCheckPosition = sax.MAX_BUFFER_LENGTH
|
27889 | parser.opt = opt || {}
|
27890 | parser.opt.lowercase = parser.opt.lowercase || parser.opt.lowercasetags
|
27891 | parser.looseCase = parser.opt.lowercase ? 'toLowerCase' : 'toUpperCase'
|
27892 | parser.tags = []
|
27893 | parser.closed = parser.closedRoot = parser.sawRoot = false
|
27894 | parser.tag = parser.error = null
|
27895 | parser.strict = !!strict
|
27896 | parser.noscript = !!(strict || parser.opt.noscript)
|
27897 | parser.state = S.BEGIN
|
27898 | parser.strictEntities = parser.opt.strictEntities
|
27899 | parser.ENTITIES = parser.strictEntities ? Object.create(sax.XML_ENTITIES) : Object.create(sax.ENTITIES)
|
27900 | parser.attribList = []
|
27901 |
|
27902 |
|
27903 |
|
27904 |
|
27905 | if (parser.opt.xmlns) {
|
27906 | parser.ns = Object.create(rootNS)
|
27907 | }
|
27908 |
|
27909 |
|
27910 | parser.trackPosition = parser.opt.position !== false
|
27911 | if (parser.trackPosition) {
|
27912 | parser.position = parser.line = parser.column = 0
|
27913 | }
|
27914 | emit(parser, 'onready')
|
27915 | }
|
27916 |
|
27917 | if (!Object.create) {
|
27918 | Object.create = function (o) {
|
27919 | function F () {}
|
27920 | F.prototype = o
|
27921 | var newf = new F()
|
27922 | return newf
|
27923 | }
|
27924 | }
|
27925 |
|
27926 | if (!Object.keys) {
|
27927 | Object.keys = function (o) {
|
27928 | var a = []
|
27929 | for (var i in o) if (o.hasOwnProperty(i)) a.push(i)
|
27930 | return a
|
27931 | }
|
27932 | }
|
27933 |
|
27934 | function checkBufferLength (parser) {
|
27935 | var maxAllowed = Math.max(sax.MAX_BUFFER_LENGTH, 10)
|
27936 | var maxActual = 0
|
27937 | for (var i = 0, l = buffers.length; i < l; i++) {
|
27938 | var len = parser[buffers[i]].length
|
27939 | if (len > maxAllowed) {
|
27940 |
|
27941 |
|
27942 |
|
27943 |
|
27944 | switch (buffers[i]) {
|
27945 | case 'textNode':
|
27946 | closeText(parser)
|
27947 | break
|
27948 |
|
27949 | case 'cdata':
|
27950 | emitNode(parser, 'oncdata', parser.cdata)
|
27951 | parser.cdata = ''
|
27952 | break
|
27953 |
|
27954 | case 'script':
|
27955 | emitNode(parser, 'onscript', parser.script)
|
27956 | parser.script = ''
|
27957 | break
|
27958 |
|
27959 | default:
|
27960 | error(parser, 'Max buffer length exceeded: ' + buffers[i])
|
27961 | }
|
27962 | }
|
27963 | maxActual = Math.max(maxActual, len)
|
27964 | }
|
27965 |
|
27966 | var m = sax.MAX_BUFFER_LENGTH - maxActual
|
27967 | parser.bufferCheckPosition = m + parser.position
|
27968 | }
|
27969 |
|
27970 | function clearBuffers (parser) {
|
27971 | for (var i = 0, l = buffers.length; i < l; i++) {
|
27972 | parser[buffers[i]] = ''
|
27973 | }
|
27974 | }
|
27975 |
|
27976 | function flushBuffers (parser) {
|
27977 | closeText(parser)
|
27978 | if (parser.cdata !== '') {
|
27979 | emitNode(parser, 'oncdata', parser.cdata)
|
27980 | parser.cdata = ''
|
27981 | }
|
27982 | if (parser.script !== '') {
|
27983 | emitNode(parser, 'onscript', parser.script)
|
27984 | parser.script = ''
|
27985 | }
|
27986 | }
|
27987 |
|
27988 | SAXParser.prototype = {
|
27989 | end: function () { end(this) },
|
27990 | write: write,
|
27991 | resume: function () { this.error = null; return this },
|
27992 | close: function () { return this.write(null) },
|
27993 | flush: function () { flushBuffers(this) }
|
27994 | }
|
27995 |
|
27996 | var Stream
|
27997 | try {
|
27998 | Stream = require('stream').Stream
|
27999 | } catch (ex) {
|
28000 | Stream = function () {}
|
28001 | }
|
28002 |
|
28003 | var streamWraps = sax.EVENTS.filter(function (ev) {
|
28004 | return ev !== 'error' && ev !== 'end'
|
28005 | })
|
28006 |
|
28007 | function createStream (strict, opt) {
|
28008 | return new SAXStream(strict, opt)
|
28009 | }
|
28010 |
|
28011 | function SAXStream (strict, opt) {
|
28012 | if (!(this instanceof SAXStream)) {
|
28013 | return new SAXStream(strict, opt)
|
28014 | }
|
28015 |
|
28016 | Stream.apply(this)
|
28017 |
|
28018 | this._parser = new SAXParser(strict, opt)
|
28019 | this.writable = true
|
28020 | this.readable = true
|
28021 |
|
28022 | var me = this
|
28023 |
|
28024 | this._parser.onend = function () {
|
28025 | me.emit('end')
|
28026 | }
|
28027 |
|
28028 | this._parser.onerror = function (er) {
|
28029 | me.emit('error', er)
|
28030 |
|
28031 |
|
28032 |
|
28033 | me._parser.error = null
|
28034 | }
|
28035 |
|
28036 | this._decoder = null
|
28037 |
|
28038 | streamWraps.forEach(function (ev) {
|
28039 | Object.defineProperty(me, 'on' + ev, {
|
28040 | get: function () {
|
28041 | return me._parser['on' + ev]
|
28042 | },
|
28043 | set: function (h) {
|
28044 | if (!h) {
|
28045 | me.removeAllListeners(ev)
|
28046 | me._parser['on' + ev] = h
|
28047 | return h
|
28048 | }
|
28049 | me.on(ev, h)
|
28050 | },
|
28051 | enumerable: true,
|
28052 | configurable: false
|
28053 | })
|
28054 | })
|
28055 | }
|
28056 |
|
28057 | SAXStream.prototype = Object.create(Stream.prototype, {
|
28058 | constructor: {
|
28059 | value: SAXStream
|
28060 | }
|
28061 | })
|
28062 |
|
28063 | SAXStream.prototype.write = function (data) {
|
28064 | if (typeof Buffer === 'function' &&
|
28065 | typeof Buffer.isBuffer === 'function' &&
|
28066 | Buffer.isBuffer(data)) {
|
28067 | if (!this._decoder) {
|
28068 | var SD = require('string_decoder').StringDecoder
|
28069 | this._decoder = new SD('utf8')
|
28070 | }
|
28071 | data = this._decoder.write(data)
|
28072 | }
|
28073 |
|
28074 | this._parser.write(data.toString())
|
28075 | this.emit('data', data)
|
28076 | return true
|
28077 | }
|
28078 |
|
28079 | SAXStream.prototype.end = function (chunk) {
|
28080 | if (chunk && chunk.length) {
|
28081 | this.write(chunk)
|
28082 | }
|
28083 | this._parser.end()
|
28084 | return true
|
28085 | }
|
28086 |
|
28087 | SAXStream.prototype.on = function (ev, handler) {
|
28088 | var me = this
|
28089 | if (!me._parser['on' + ev] && streamWraps.indexOf(ev) !== -1) {
|
28090 | me._parser['on' + ev] = function () {
|
28091 | var args = arguments.length === 1 ? [arguments[0]] : Array.apply(null, arguments)
|
28092 | args.splice(0, 0, ev)
|
28093 | me.emit.apply(me, args)
|
28094 | }
|
28095 | }
|
28096 |
|
28097 | return Stream.prototype.on.call(me, ev, handler)
|
28098 | }
|
28099 |
|
28100 |
|
28101 |
|
28102 | var CDATA = '[CDATA['
|
28103 | var DOCTYPE = 'DOCTYPE'
|
28104 | var XML_NAMESPACE = 'http://www.w3.org/XML/1998/namespace'
|
28105 | var XMLNS_NAMESPACE = 'http://www.w3.org/2000/xmlns/'
|
28106 | var rootNS = { xml: XML_NAMESPACE, xmlns: XMLNS_NAMESPACE }
|
28107 |
|
28108 |
|
28109 |
|
28110 |
|
28111 |
|
28112 |
|
28113 |
|
28114 | var nameStart = /[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/
|
28115 |
|
28116 | var nameBody = /[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/
|
28117 |
|
28118 | var entityStart = /[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/
|
28119 | var entityBody = /[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/
|
28120 |
|
28121 | function isWhitespace (c) {
|
28122 | return c === ' ' || c === '\n' || c === '\r' || c === '\t'
|
28123 | }
|
28124 |
|
28125 | function isQuote (c) {
|
28126 | return c === '"' || c === '\''
|
28127 | }
|
28128 |
|
28129 | function isAttribEnd (c) {
|
28130 | return c === '>' || isWhitespace(c)
|
28131 | }
|
28132 |
|
28133 | function isMatch (regex, c) {
|
28134 | return regex.test(c)
|
28135 | }
|
28136 |
|
28137 | function notMatch (regex, c) {
|
28138 | return !isMatch(regex, c)
|
28139 | }
|
28140 |
|
28141 | var S = 0
|
28142 | sax.STATE = {
|
28143 | BEGIN: S++,
|
28144 | BEGIN_WHITESPACE: S++,
|
28145 | TEXT: S++,
|
28146 | TEXT_ENTITY: S++,
|
28147 | OPEN_WAKA: S++,
|
28148 | SGML_DECL: S++,
|
28149 | SGML_DECL_QUOTED: S++,
|
28150 | DOCTYPE: S++,
|
28151 | DOCTYPE_QUOTED: S++,
|
28152 | DOCTYPE_DTD: S++,
|
28153 | DOCTYPE_DTD_QUOTED: S++,
|
28154 | COMMENT_STARTING: S++,
|
28155 | COMMENT: S++,
|
28156 | COMMENT_ENDING: S++,
|
28157 | COMMENT_ENDED: S++,
|
28158 | CDATA: S++,
|
28159 | CDATA_ENDING: S++,
|
28160 | CDATA_ENDING_2: S++,
|
28161 | PROC_INST: S++,
|
28162 | PROC_INST_BODY: S++,
|
28163 | PROC_INST_ENDING: S++,
|
28164 | OPEN_TAG: S++,
|
28165 | OPEN_TAG_SLASH: S++,
|
28166 | ATTRIB: S++,
|
28167 | ATTRIB_NAME: S++,
|
28168 | ATTRIB_NAME_SAW_WHITE: S++,
|
28169 | ATTRIB_VALUE: S++,
|
28170 | ATTRIB_VALUE_QUOTED: S++,
|
28171 | ATTRIB_VALUE_CLOSED: S++,
|
28172 | ATTRIB_VALUE_UNQUOTED: S++,
|
28173 | ATTRIB_VALUE_ENTITY_Q: S++,
|
28174 | ATTRIB_VALUE_ENTITY_U: S++,
|
28175 | CLOSE_TAG: S++,
|
28176 | CLOSE_TAG_SAW_WHITE: S++,
|
28177 | SCRIPT: S++,
|
28178 | SCRIPT_ENDING: S++
|
28179 | }
|
28180 |
|
28181 | sax.XML_ENTITIES = {
|
28182 | 'amp': '&',
|
28183 | 'gt': '>',
|
28184 | 'lt': '<',
|
28185 | 'quot': '"',
|
28186 | 'apos': "'"
|
28187 | }
|
28188 |
|
28189 | sax.ENTITIES = {
|
28190 | 'amp': '&',
|
28191 | 'gt': '>',
|
28192 | 'lt': '<',
|
28193 | 'quot': '"',
|
28194 | 'apos': "'",
|
28195 | 'AElig': 198,
|
28196 | 'Aacute': 193,
|
28197 | 'Acirc': 194,
|
28198 | 'Agrave': 192,
|
28199 | 'Aring': 197,
|
28200 | 'Atilde': 195,
|
28201 | 'Auml': 196,
|
28202 | 'Ccedil': 199,
|
28203 | 'ETH': 208,
|
28204 | 'Eacute': 201,
|
28205 | 'Ecirc': 202,
|
28206 | 'Egrave': 200,
|
28207 | 'Euml': 203,
|
28208 | 'Iacute': 205,
|
28209 | 'Icirc': 206,
|
28210 | 'Igrave': 204,
|
28211 | 'Iuml': 207,
|
28212 | 'Ntilde': 209,
|
28213 | 'Oacute': 211,
|
28214 | 'Ocirc': 212,
|
28215 | 'Ograve': 210,
|
28216 | 'Oslash': 216,
|
28217 | 'Otilde': 213,
|
28218 | 'Ouml': 214,
|
28219 | 'THORN': 222,
|
28220 | 'Uacute': 218,
|
28221 | 'Ucirc': 219,
|
28222 | 'Ugrave': 217,
|
28223 | 'Uuml': 220,
|
28224 | 'Yacute': 221,
|
28225 | 'aacute': 225,
|
28226 | 'acirc': 226,
|
28227 | 'aelig': 230,
|
28228 | 'agrave': 224,
|
28229 | 'aring': 229,
|
28230 | 'atilde': 227,
|
28231 | 'auml': 228,
|
28232 | 'ccedil': 231,
|
28233 | 'eacute': 233,
|
28234 | 'ecirc': 234,
|
28235 | 'egrave': 232,
|
28236 | 'eth': 240,
|
28237 | 'euml': 235,
|
28238 | 'iacute': 237,
|
28239 | 'icirc': 238,
|
28240 | 'igrave': 236,
|
28241 | 'iuml': 239,
|
28242 | 'ntilde': 241,
|
28243 | 'oacute': 243,
|
28244 | 'ocirc': 244,
|
28245 | 'ograve': 242,
|
28246 | 'oslash': 248,
|
28247 | 'otilde': 245,
|
28248 | 'ouml': 246,
|
28249 | 'szlig': 223,
|
28250 | 'thorn': 254,
|
28251 | 'uacute': 250,
|
28252 | 'ucirc': 251,
|
28253 | 'ugrave': 249,
|
28254 | 'uuml': 252,
|
28255 | 'yacute': 253,
|
28256 | 'yuml': 255,
|
28257 | 'copy': 169,
|
28258 | 'reg': 174,
|
28259 | 'nbsp': 160,
|
28260 | 'iexcl': 161,
|
28261 | 'cent': 162,
|
28262 | 'pound': 163,
|
28263 | 'curren': 164,
|
28264 | 'yen': 165,
|
28265 | 'brvbar': 166,
|
28266 | 'sect': 167,
|
28267 | 'uml': 168,
|
28268 | 'ordf': 170,
|
28269 | 'laquo': 171,
|
28270 | 'not': 172,
|
28271 | 'shy': 173,
|
28272 | 'macr': 175,
|
28273 | 'deg': 176,
|
28274 | 'plusmn': 177,
|
28275 | 'sup1': 185,
|
28276 | 'sup2': 178,
|
28277 | 'sup3': 179,
|
28278 | 'acute': 180,
|
28279 | 'micro': 181,
|
28280 | 'para': 182,
|
28281 | 'middot': 183,
|
28282 | 'cedil': 184,
|
28283 | 'ordm': 186,
|
28284 | 'raquo': 187,
|
28285 | 'frac14': 188,
|
28286 | 'frac12': 189,
|
28287 | 'frac34': 190,
|
28288 | 'iquest': 191,
|
28289 | 'times': 215,
|
28290 | 'divide': 247,
|
28291 | 'OElig': 338,
|
28292 | 'oelig': 339,
|
28293 | 'Scaron': 352,
|
28294 | 'scaron': 353,
|
28295 | 'Yuml': 376,
|
28296 | 'fnof': 402,
|
28297 | 'circ': 710,
|
28298 | 'tilde': 732,
|
28299 | 'Alpha': 913,
|
28300 | 'Beta': 914,
|
28301 | 'Gamma': 915,
|
28302 | 'Delta': 916,
|
28303 | 'Epsilon': 917,
|
28304 | 'Zeta': 918,
|
28305 | 'Eta': 919,
|
28306 | 'Theta': 920,
|
28307 | 'Iota': 921,
|
28308 | 'Kappa': 922,
|
28309 | 'Lambda': 923,
|
28310 | 'Mu': 924,
|
28311 | 'Nu': 925,
|
28312 | 'Xi': 926,
|
28313 | 'Omicron': 927,
|
28314 | 'Pi': 928,
|
28315 | 'Rho': 929,
|
28316 | 'Sigma': 931,
|
28317 | 'Tau': 932,
|
28318 | 'Upsilon': 933,
|
28319 | 'Phi': 934,
|
28320 | 'Chi': 935,
|
28321 | 'Psi': 936,
|
28322 | 'Omega': 937,
|
28323 | 'alpha': 945,
|
28324 | 'beta': 946,
|
28325 | 'gamma': 947,
|
28326 | 'delta': 948,
|
28327 | 'epsilon': 949,
|
28328 | 'zeta': 950,
|
28329 | 'eta': 951,
|
28330 | 'theta': 952,
|
28331 | 'iota': 953,
|
28332 | 'kappa': 954,
|
28333 | 'lambda': 955,
|
28334 | 'mu': 956,
|
28335 | 'nu': 957,
|
28336 | 'xi': 958,
|
28337 | 'omicron': 959,
|
28338 | 'pi': 960,
|
28339 | 'rho': 961,
|
28340 | 'sigmaf': 962,
|
28341 | 'sigma': 963,
|
28342 | 'tau': 964,
|
28343 | 'upsilon': 965,
|
28344 | 'phi': 966,
|
28345 | 'chi': 967,
|
28346 | 'psi': 968,
|
28347 | 'omega': 969,
|
28348 | 'thetasym': 977,
|
28349 | 'upsih': 978,
|
28350 | 'piv': 982,
|
28351 | 'ensp': 8194,
|
28352 | 'emsp': 8195,
|
28353 | 'thinsp': 8201,
|
28354 | 'zwnj': 8204,
|
28355 | 'zwj': 8205,
|
28356 | 'lrm': 8206,
|
28357 | 'rlm': 8207,
|
28358 | 'ndash': 8211,
|
28359 | 'mdash': 8212,
|
28360 | 'lsquo': 8216,
|
28361 | 'rsquo': 8217,
|
28362 | 'sbquo': 8218,
|
28363 | 'ldquo': 8220,
|
28364 | 'rdquo': 8221,
|
28365 | 'bdquo': 8222,
|
28366 | 'dagger': 8224,
|
28367 | 'Dagger': 8225,
|
28368 | 'bull': 8226,
|
28369 | 'hellip': 8230,
|
28370 | 'permil': 8240,
|
28371 | 'prime': 8242,
|
28372 | 'Prime': 8243,
|
28373 | 'lsaquo': 8249,
|
28374 | 'rsaquo': 8250,
|
28375 | 'oline': 8254,
|
28376 | 'frasl': 8260,
|
28377 | 'euro': 8364,
|
28378 | 'image': 8465,
|
28379 | 'weierp': 8472,
|
28380 | 'real': 8476,
|
28381 | 'trade': 8482,
|
28382 | 'alefsym': 8501,
|
28383 | 'larr': 8592,
|
28384 | 'uarr': 8593,
|
28385 | 'rarr': 8594,
|
28386 | 'darr': 8595,
|
28387 | 'harr': 8596,
|
28388 | 'crarr': 8629,
|
28389 | 'lArr': 8656,
|
28390 | 'uArr': 8657,
|
28391 | 'rArr': 8658,
|
28392 | 'dArr': 8659,
|
28393 | 'hArr': 8660,
|
28394 | 'forall': 8704,
|
28395 | 'part': 8706,
|
28396 | 'exist': 8707,
|
28397 | 'empty': 8709,
|
28398 | 'nabla': 8711,
|
28399 | 'isin': 8712,
|
28400 | 'notin': 8713,
|
28401 | 'ni': 8715,
|
28402 | 'prod': 8719,
|
28403 | 'sum': 8721,
|
28404 | 'minus': 8722,
|
28405 | 'lowast': 8727,
|
28406 | 'radic': 8730,
|
28407 | 'prop': 8733,
|
28408 | 'infin': 8734,
|
28409 | 'ang': 8736,
|
28410 | 'and': 8743,
|
28411 | 'or': 8744,
|
28412 | 'cap': 8745,
|
28413 | 'cup': 8746,
|
28414 | 'int': 8747,
|
28415 | 'there4': 8756,
|
28416 | 'sim': 8764,
|
28417 | 'cong': 8773,
|
28418 | 'asymp': 8776,
|
28419 | 'ne': 8800,
|
28420 | 'equiv': 8801,
|
28421 | 'le': 8804,
|
28422 | 'ge': 8805,
|
28423 | 'sub': 8834,
|
28424 | 'sup': 8835,
|
28425 | 'nsub': 8836,
|
28426 | 'sube': 8838,
|
28427 | 'supe': 8839,
|
28428 | 'oplus': 8853,
|
28429 | 'otimes': 8855,
|
28430 | 'perp': 8869,
|
28431 | 'sdot': 8901,
|
28432 | 'lceil': 8968,
|
28433 | 'rceil': 8969,
|
28434 | 'lfloor': 8970,
|
28435 | 'rfloor': 8971,
|
28436 | 'lang': 9001,
|
28437 | 'rang': 9002,
|
28438 | 'loz': 9674,
|
28439 | 'spades': 9824,
|
28440 | 'clubs': 9827,
|
28441 | 'hearts': 9829,
|
28442 | 'diams': 9830
|
28443 | }
|
28444 |
|
28445 | Object.keys(sax.ENTITIES).forEach(function (key) {
|
28446 | var e = sax.ENTITIES[key]
|
28447 | var s = typeof e === 'number' ? String.fromCharCode(e) : e
|
28448 | sax.ENTITIES[key] = s
|
28449 | })
|
28450 |
|
28451 | for (var s in sax.STATE) {
|
28452 | sax.STATE[sax.STATE[s]] = s
|
28453 | }
|
28454 |
|
28455 |
|
28456 | S = sax.STATE
|
28457 |
|
28458 | function emit (parser, event, data) {
|
28459 | parser[event] && parser[event](data)
|
28460 | }
|
28461 |
|
28462 | function emitNode (parser, nodeType, data) {
|
28463 | if (parser.textNode) closeText(parser)
|
28464 | emit(parser, nodeType, data)
|
28465 | }
|
28466 |
|
28467 | function closeText (parser) {
|
28468 | parser.textNode = textopts(parser.opt, parser.textNode)
|
28469 | if (parser.textNode) emit(parser, 'ontext', parser.textNode)
|
28470 | parser.textNode = ''
|
28471 | }
|
28472 |
|
28473 | function textopts (opt, text) {
|
28474 | if (opt.trim) text = text.trim()
|
28475 | if (opt.normalize) text = text.replace(/\s+/g, ' ')
|
28476 | return text
|
28477 | }
|
28478 |
|
28479 | function error (parser, er) {
|
28480 | closeText(parser)
|
28481 | if (parser.trackPosition) {
|
28482 | er += '\nLine: ' + parser.line +
|
28483 | '\nColumn: ' + parser.column +
|
28484 | '\nChar: ' + parser.c
|
28485 | }
|
28486 | er = new Error(er)
|
28487 | parser.error = er
|
28488 | emit(parser, 'onerror', er)
|
28489 | return parser
|
28490 | }
|
28491 |
|
28492 | function end (parser) {
|
28493 | if (parser.sawRoot && !parser.closedRoot) strictFail(parser, 'Unclosed root tag')
|
28494 | if ((parser.state !== S.BEGIN) &&
|
28495 | (parser.state !== S.BEGIN_WHITESPACE) &&
|
28496 | (parser.state !== S.TEXT)) {
|
28497 | error(parser, 'Unexpected end')
|
28498 | }
|
28499 | closeText(parser)
|
28500 | parser.c = ''
|
28501 | parser.closed = true
|
28502 | emit(parser, 'onend')
|
28503 | SAXParser.call(parser, parser.strict, parser.opt)
|
28504 | return parser
|
28505 | }
|
28506 |
|
28507 | function strictFail (parser, message) {
|
28508 | if (typeof parser !== 'object' || !(parser instanceof SAXParser)) {
|
28509 | throw new Error('bad call to strictFail')
|
28510 | }
|
28511 | if (parser.strict) {
|
28512 | error(parser, message)
|
28513 | }
|
28514 | }
|
28515 |
|
28516 | function newTag (parser) {
|
28517 | if (!parser.strict) parser.tagName = parser.tagName[parser.looseCase]()
|
28518 | var parent = parser.tags[parser.tags.length - 1] || parser
|
28519 | var tag = parser.tag = { name: parser.tagName, attributes: {} }
|
28520 |
|
28521 |
|
28522 | if (parser.opt.xmlns) {
|
28523 | tag.ns = parent.ns
|
28524 | }
|
28525 | parser.attribList.length = 0
|
28526 | emitNode(parser, 'onopentagstart', tag)
|
28527 | }
|
28528 |
|
28529 | function qname (name, attribute) {
|
28530 | var i = name.indexOf(':')
|
28531 | var qualName = i < 0 ? [ '', name ] : name.split(':')
|
28532 | var prefix = qualName[0]
|
28533 | var local = qualName[1]
|
28534 |
|
28535 |
|
28536 | if (attribute && name === 'xmlns') {
|
28537 | prefix = 'xmlns'
|
28538 | local = ''
|
28539 | }
|
28540 |
|
28541 | return { prefix: prefix, local: local }
|
28542 | }
|
28543 |
|
28544 | function attrib (parser) {
|
28545 | if (!parser.strict) {
|
28546 | parser.attribName = parser.attribName[parser.looseCase]()
|
28547 | }
|
28548 |
|
28549 | if (parser.attribList.indexOf(parser.attribName) !== -1 ||
|
28550 | parser.tag.attributes.hasOwnProperty(parser.attribName)) {
|
28551 | parser.attribName = parser.attribValue = ''
|
28552 | return
|
28553 | }
|
28554 |
|
28555 | if (parser.opt.xmlns) {
|
28556 | var qn = qname(parser.attribName, true)
|
28557 | var prefix = qn.prefix
|
28558 | var local = qn.local
|
28559 |
|
28560 | if (prefix === 'xmlns') {
|
28561 |
|
28562 | if (local === 'xml' && parser.attribValue !== XML_NAMESPACE) {
|
28563 | strictFail(parser,
|
28564 | 'xml: prefix must be bound to ' + XML_NAMESPACE + '\n' +
|
28565 | 'Actual: ' + parser.attribValue)
|
28566 | } else if (local === 'xmlns' && parser.attribValue !== XMLNS_NAMESPACE) {
|
28567 | strictFail(parser,
|
28568 | 'xmlns: prefix must be bound to ' + XMLNS_NAMESPACE + '\n' +
|
28569 | 'Actual: ' + parser.attribValue)
|
28570 | } else {
|
28571 | var tag = parser.tag
|
28572 | var parent = parser.tags[parser.tags.length - 1] || parser
|
28573 | if (tag.ns === parent.ns) {
|
28574 | tag.ns = Object.create(parent.ns)
|
28575 | }
|
28576 | tag.ns[local] = parser.attribValue
|
28577 | }
|
28578 | }
|
28579 |
|
28580 |
|
28581 |
|
28582 |
|
28583 | parser.attribList.push([parser.attribName, parser.attribValue])
|
28584 | } else {
|
28585 |
|
28586 | parser.tag.attributes[parser.attribName] = parser.attribValue
|
28587 | emitNode(parser, 'onattribute', {
|
28588 | name: parser.attribName,
|
28589 | value: parser.attribValue
|
28590 | })
|
28591 | }
|
28592 |
|
28593 | parser.attribName = parser.attribValue = ''
|
28594 | }
|
28595 |
|
28596 | function openTag (parser, selfClosing) {
|
28597 | if (parser.opt.xmlns) {
|
28598 |
|
28599 | var tag = parser.tag
|
28600 |
|
28601 |
|
28602 | var qn = qname(parser.tagName)
|
28603 | tag.prefix = qn.prefix
|
28604 | tag.local = qn.local
|
28605 | tag.uri = tag.ns[qn.prefix] || ''
|
28606 |
|
28607 | if (tag.prefix && !tag.uri) {
|
28608 | strictFail(parser, 'Unbound namespace prefix: ' +
|
28609 | JSON.stringify(parser.tagName))
|
28610 | tag.uri = qn.prefix
|
28611 | }
|
28612 |
|
28613 | var parent = parser.tags[parser.tags.length - 1] || parser
|
28614 | if (tag.ns && parent.ns !== tag.ns) {
|
28615 | Object.keys(tag.ns).forEach(function (p) {
|
28616 | emitNode(parser, 'onopennamespace', {
|
28617 | prefix: p,
|
28618 | uri: tag.ns[p]
|
28619 | })
|
28620 | })
|
28621 | }
|
28622 |
|
28623 |
|
28624 |
|
28625 |
|
28626 | for (var i = 0, l = parser.attribList.length; i < l; i++) {
|
28627 | var nv = parser.attribList[i]
|
28628 | var name = nv[0]
|
28629 | var value = nv[1]
|
28630 | var qualName = qname(name, true)
|
28631 | var prefix = qualName.prefix
|
28632 | var local = qualName.local
|
28633 | var uri = prefix === '' ? '' : (tag.ns[prefix] || '')
|
28634 | var a = {
|
28635 | name: name,
|
28636 | value: value,
|
28637 | prefix: prefix,
|
28638 | local: local,
|
28639 | uri: uri
|
28640 | }
|
28641 |
|
28642 |
|
28643 |
|
28644 | if (prefix && prefix !== 'xmlns' && !uri) {
|
28645 | strictFail(parser, 'Unbound namespace prefix: ' +
|
28646 | JSON.stringify(prefix))
|
28647 | a.uri = prefix
|
28648 | }
|
28649 | parser.tag.attributes[name] = a
|
28650 | emitNode(parser, 'onattribute', a)
|
28651 | }
|
28652 | parser.attribList.length = 0
|
28653 | }
|
28654 |
|
28655 | parser.tag.isSelfClosing = !!selfClosing
|
28656 |
|
28657 |
|
28658 | parser.sawRoot = true
|
28659 | parser.tags.push(parser.tag)
|
28660 | emitNode(parser, 'onopentag', parser.tag)
|
28661 | if (!selfClosing) {
|
28662 |
|
28663 | if (!parser.noscript && parser.tagName.toLowerCase() === 'script') {
|
28664 | parser.state = S.SCRIPT
|
28665 | } else {
|
28666 | parser.state = S.TEXT
|
28667 | }
|
28668 | parser.tag = null
|
28669 | parser.tagName = ''
|
28670 | }
|
28671 | parser.attribName = parser.attribValue = ''
|
28672 | parser.attribList.length = 0
|
28673 | }
|
28674 |
|
28675 | function closeTag (parser) {
|
28676 | if (!parser.tagName) {
|
28677 | strictFail(parser, 'Weird empty close tag.')
|
28678 | parser.textNode += '</>'
|
28679 | parser.state = S.TEXT
|
28680 | return
|
28681 | }
|
28682 |
|
28683 | if (parser.script) {
|
28684 | if (parser.tagName !== 'script') {
|
28685 | parser.script += '</' + parser.tagName + '>'
|
28686 | parser.tagName = ''
|
28687 | parser.state = S.SCRIPT
|
28688 | return
|
28689 | }
|
28690 | emitNode(parser, 'onscript', parser.script)
|
28691 | parser.script = ''
|
28692 | }
|
28693 |
|
28694 |
|
28695 |
|
28696 | var t = parser.tags.length
|
28697 | var tagName = parser.tagName
|
28698 | if (!parser.strict) {
|
28699 | tagName = tagName[parser.looseCase]()
|
28700 | }
|
28701 | var closeTo = tagName
|
28702 | while (t--) {
|
28703 | var close = parser.tags[t]
|
28704 | if (close.name !== closeTo) {
|
28705 |
|
28706 | strictFail(parser, 'Unexpected close tag')
|
28707 | } else {
|
28708 | break
|
28709 | }
|
28710 | }
|
28711 |
|
28712 |
|
28713 | if (t < 0) {
|
28714 | strictFail(parser, 'Unmatched closing tag: ' + parser.tagName)
|
28715 | parser.textNode += '</' + parser.tagName + '>'
|
28716 | parser.state = S.TEXT
|
28717 | return
|
28718 | }
|
28719 | parser.tagName = tagName
|
28720 | var s = parser.tags.length
|
28721 | while (s-- > t) {
|
28722 | var tag = parser.tag = parser.tags.pop()
|
28723 | parser.tagName = parser.tag.name
|
28724 | emitNode(parser, 'onclosetag', parser.tagName)
|
28725 |
|
28726 | var x = {}
|
28727 | for (var i in tag.ns) {
|
28728 | x[i] = tag.ns[i]
|
28729 | }
|
28730 |
|
28731 | var parent = parser.tags[parser.tags.length - 1] || parser
|
28732 | if (parser.opt.xmlns && tag.ns !== parent.ns) {
|
28733 |
|
28734 | Object.keys(tag.ns).forEach(function (p) {
|
28735 | var n = tag.ns[p]
|
28736 | emitNode(parser, 'onclosenamespace', { prefix: p, uri: n })
|
28737 | })
|
28738 | }
|
28739 | }
|
28740 | if (t === 0) parser.closedRoot = true
|
28741 | parser.tagName = parser.attribValue = parser.attribName = ''
|
28742 | parser.attribList.length = 0
|
28743 | parser.state = S.TEXT
|
28744 | }
|
28745 |
|
28746 | function parseEntity (parser) {
|
28747 | var entity = parser.entity
|
28748 | var entityLC = entity.toLowerCase()
|
28749 | var num
|
28750 | var numStr = ''
|
28751 |
|
28752 | if (parser.ENTITIES[entity]) {
|
28753 | return parser.ENTITIES[entity]
|
28754 | }
|
28755 | if (parser.ENTITIES[entityLC]) {
|
28756 | return parser.ENTITIES[entityLC]
|
28757 | }
|
28758 | entity = entityLC
|
28759 | if (entity.charAt(0) === '#') {
|
28760 | if (entity.charAt(1) === 'x') {
|
28761 | entity = entity.slice(2)
|
28762 | num = parseInt(entity, 16)
|
28763 | numStr = num.toString(16)
|
28764 | } else {
|
28765 | entity = entity.slice(1)
|
28766 | num = parseInt(entity, 10)
|
28767 | numStr = num.toString(10)
|
28768 | }
|
28769 | }
|
28770 | entity = entity.replace(/^0+/, '')
|
28771 | if (isNaN(num) || numStr.toLowerCase() !== entity) {
|
28772 | strictFail(parser, 'Invalid character entity')
|
28773 | return '&' + parser.entity + ';'
|
28774 | }
|
28775 |
|
28776 | return String.fromCodePoint(num)
|
28777 | }
|
28778 |
|
28779 | function beginWhiteSpace (parser, c) {
|
28780 | if (c === '<') {
|
28781 | parser.state = S.OPEN_WAKA
|
28782 | parser.startTagPosition = parser.position
|
28783 | } else if (!isWhitespace(c)) {
|
28784 |
|
28785 |
|
28786 | strictFail(parser, 'Non-whitespace before first tag.')
|
28787 | parser.textNode = c
|
28788 | parser.state = S.TEXT
|
28789 | }
|
28790 | }
|
28791 |
|
28792 | function charAt (chunk, i) {
|
28793 | var result = ''
|
28794 | if (i < chunk.length) {
|
28795 | result = chunk.charAt(i)
|
28796 | }
|
28797 | return result
|
28798 | }
|
28799 |
|
28800 | function write (chunk) {
|
28801 | var parser = this
|
28802 | if (this.error) {
|
28803 | throw this.error
|
28804 | }
|
28805 | if (parser.closed) {
|
28806 | return error(parser,
|
28807 | 'Cannot write after close. Assign an onready handler.')
|
28808 | }
|
28809 | if (chunk === null) {
|
28810 | return end(parser)
|
28811 | }
|
28812 | if (typeof chunk === 'object') {
|
28813 | chunk = chunk.toString()
|
28814 | }
|
28815 | var i = 0
|
28816 | var c = ''
|
28817 | while (true) {
|
28818 | c = charAt(chunk, i++)
|
28819 | parser.c = c
|
28820 |
|
28821 | if (!c) {
|
28822 | break
|
28823 | }
|
28824 |
|
28825 | if (parser.trackPosition) {
|
28826 | parser.position++
|
28827 | if (c === '\n') {
|
28828 | parser.line++
|
28829 | parser.column = 0
|
28830 | } else {
|
28831 | parser.column++
|
28832 | }
|
28833 | }
|
28834 |
|
28835 | switch (parser.state) {
|
28836 | case S.BEGIN:
|
28837 | parser.state = S.BEGIN_WHITESPACE
|
28838 | if (c === '\uFEFF') {
|
28839 | continue
|
28840 | }
|
28841 | beginWhiteSpace(parser, c)
|
28842 | continue
|
28843 |
|
28844 | case S.BEGIN_WHITESPACE:
|
28845 | beginWhiteSpace(parser, c)
|
28846 | continue
|
28847 |
|
28848 | case S.TEXT:
|
28849 | if (parser.sawRoot && !parser.closedRoot) {
|
28850 | var starti = i - 1
|
28851 | while (c && c !== '<' && c !== '&') {
|
28852 | c = charAt(chunk, i++)
|
28853 | if (c && parser.trackPosition) {
|
28854 | parser.position++
|
28855 | if (c === '\n') {
|
28856 | parser.line++
|
28857 | parser.column = 0
|
28858 | } else {
|
28859 | parser.column++
|
28860 | }
|
28861 | }
|
28862 | }
|
28863 | parser.textNode += chunk.substring(starti, i - 1)
|
28864 | }
|
28865 | if (c === '<' && !(parser.sawRoot && parser.closedRoot && !parser.strict)) {
|
28866 | parser.state = S.OPEN_WAKA
|
28867 | parser.startTagPosition = parser.position
|
28868 | } else {
|
28869 | if (!isWhitespace(c) && (!parser.sawRoot || parser.closedRoot)) {
|
28870 | strictFail(parser, 'Text data outside of root node.')
|
28871 | }
|
28872 | if (c === '&') {
|
28873 | parser.state = S.TEXT_ENTITY
|
28874 | } else {
|
28875 | parser.textNode += c
|
28876 | }
|
28877 | }
|
28878 | continue
|
28879 |
|
28880 | case S.SCRIPT:
|
28881 |
|
28882 | if (c === '<') {
|
28883 | parser.state = S.SCRIPT_ENDING
|
28884 | } else {
|
28885 | parser.script += c
|
28886 | }
|
28887 | continue
|
28888 |
|
28889 | case S.SCRIPT_ENDING:
|
28890 | if (c === '/') {
|
28891 | parser.state = S.CLOSE_TAG
|
28892 | } else {
|
28893 | parser.script += '<' + c
|
28894 | parser.state = S.SCRIPT
|
28895 | }
|
28896 | continue
|
28897 |
|
28898 | case S.OPEN_WAKA:
|
28899 |
|
28900 | if (c === '!') {
|
28901 | parser.state = S.SGML_DECL
|
28902 | parser.sgmlDecl = ''
|
28903 | } else if (isWhitespace(c)) {
|
28904 |
|
28905 | } else if (isMatch(nameStart, c)) {
|
28906 | parser.state = S.OPEN_TAG
|
28907 | parser.tagName = c
|
28908 | } else if (c === '/') {
|
28909 | parser.state = S.CLOSE_TAG
|
28910 | parser.tagName = ''
|
28911 | } else if (c === '?') {
|
28912 | parser.state = S.PROC_INST
|
28913 | parser.procInstName = parser.procInstBody = ''
|
28914 | } else {
|
28915 | strictFail(parser, 'Unencoded <')
|
28916 |
|
28917 | if (parser.startTagPosition + 1 < parser.position) {
|
28918 | var pad = parser.position - parser.startTagPosition
|
28919 | c = new Array(pad).join(' ') + c
|
28920 | }
|
28921 | parser.textNode += '<' + c
|
28922 | parser.state = S.TEXT
|
28923 | }
|
28924 | continue
|
28925 |
|
28926 | case S.SGML_DECL:
|
28927 | if ((parser.sgmlDecl + c).toUpperCase() === CDATA) {
|
28928 | emitNode(parser, 'onopencdata')
|
28929 | parser.state = S.CDATA
|
28930 | parser.sgmlDecl = ''
|
28931 | parser.cdata = ''
|
28932 | } else if (parser.sgmlDecl + c === '--') {
|
28933 | parser.state = S.COMMENT
|
28934 | parser.comment = ''
|
28935 | parser.sgmlDecl = ''
|
28936 | } else if ((parser.sgmlDecl + c).toUpperCase() === DOCTYPE) {
|
28937 | parser.state = S.DOCTYPE
|
28938 | if (parser.doctype || parser.sawRoot) {
|
28939 | strictFail(parser,
|
28940 | 'Inappropriately located doctype declaration')
|
28941 | }
|
28942 | parser.doctype = ''
|
28943 | parser.sgmlDecl = ''
|
28944 | } else if (c === '>') {
|
28945 | emitNode(parser, 'onsgmldeclaration', parser.sgmlDecl)
|
28946 | parser.sgmlDecl = ''
|
28947 | parser.state = S.TEXT
|
28948 | } else if (isQuote(c)) {
|
28949 | parser.state = S.SGML_DECL_QUOTED
|
28950 | parser.sgmlDecl += c
|
28951 | } else {
|
28952 | parser.sgmlDecl += c
|
28953 | }
|
28954 | continue
|
28955 |
|
28956 | case S.SGML_DECL_QUOTED:
|
28957 | if (c === parser.q) {
|
28958 | parser.state = S.SGML_DECL
|
28959 | parser.q = ''
|
28960 | }
|
28961 | parser.sgmlDecl += c
|
28962 | continue
|
28963 |
|
28964 | case S.DOCTYPE:
|
28965 | if (c === '>') {
|
28966 | parser.state = S.TEXT
|
28967 | emitNode(parser, 'ondoctype', parser.doctype)
|
28968 | parser.doctype = true
|
28969 | } else {
|
28970 | parser.doctype += c
|
28971 | if (c === '[') {
|
28972 | parser.state = S.DOCTYPE_DTD
|
28973 | } else if (isQuote(c)) {
|
28974 | parser.state = S.DOCTYPE_QUOTED
|
28975 | parser.q = c
|
28976 | }
|
28977 | }
|
28978 | continue
|
28979 |
|
28980 | case S.DOCTYPE_QUOTED:
|
28981 | parser.doctype += c
|
28982 | if (c === parser.q) {
|
28983 | parser.q = ''
|
28984 | parser.state = S.DOCTYPE
|
28985 | }
|
28986 | continue
|
28987 |
|
28988 | case S.DOCTYPE_DTD:
|
28989 | parser.doctype += c
|
28990 | if (c === ']') {
|
28991 | parser.state = S.DOCTYPE
|
28992 | } else if (isQuote(c)) {
|
28993 | parser.state = S.DOCTYPE_DTD_QUOTED
|
28994 | parser.q = c
|
28995 | }
|
28996 | continue
|
28997 |
|
28998 | case S.DOCTYPE_DTD_QUOTED:
|
28999 | parser.doctype += c
|
29000 | if (c === parser.q) {
|
29001 | parser.state = S.DOCTYPE_DTD
|
29002 | parser.q = ''
|
29003 | }
|
29004 | continue
|
29005 |
|
29006 | case S.COMMENT:
|
29007 | if (c === '-') {
|
29008 | parser.state = S.COMMENT_ENDING
|
29009 | } else {
|
29010 | parser.comment += c
|
29011 | }
|
29012 | continue
|
29013 |
|
29014 | case S.COMMENT_ENDING:
|
29015 | if (c === '-') {
|
29016 | parser.state = S.COMMENT_ENDED
|
29017 | parser.comment = textopts(parser.opt, parser.comment)
|
29018 | if (parser.comment) {
|
29019 | emitNode(parser, 'oncomment', parser.comment)
|
29020 | }
|
29021 | parser.comment = ''
|
29022 | } else {
|
29023 | parser.comment += '-' + c
|
29024 | parser.state = S.COMMENT
|
29025 | }
|
29026 | continue
|
29027 |
|
29028 | case S.COMMENT_ENDED:
|
29029 | if (c !== '>') {
|
29030 | strictFail(parser, 'Malformed comment')
|
29031 |
|
29032 |
|
29033 | parser.comment += '--' + c
|
29034 | parser.state = S.COMMENT
|
29035 | } else {
|
29036 | parser.state = S.TEXT
|
29037 | }
|
29038 | continue
|
29039 |
|
29040 | case S.CDATA:
|
29041 | if (c === ']') {
|
29042 | parser.state = S.CDATA_ENDING
|
29043 | } else {
|
29044 | parser.cdata += c
|
29045 | }
|
29046 | continue
|
29047 |
|
29048 | case S.CDATA_ENDING:
|
29049 | if (c === ']') {
|
29050 | parser.state = S.CDATA_ENDING_2
|
29051 | } else {
|
29052 | parser.cdata += ']' + c
|
29053 | parser.state = S.CDATA
|
29054 | }
|
29055 | continue
|
29056 |
|
29057 | case S.CDATA_ENDING_2:
|
29058 | if (c === '>') {
|
29059 | if (parser.cdata) {
|
29060 | emitNode(parser, 'oncdata', parser.cdata)
|
29061 | }
|
29062 | emitNode(parser, 'onclosecdata')
|
29063 | parser.cdata = ''
|
29064 | parser.state = S.TEXT
|
29065 | } else if (c === ']') {
|
29066 | parser.cdata += ']'
|
29067 | } else {
|
29068 | parser.cdata += ']]' + c
|
29069 | parser.state = S.CDATA
|
29070 | }
|
29071 | continue
|
29072 |
|
29073 | case S.PROC_INST:
|
29074 | if (c === '?') {
|
29075 | parser.state = S.PROC_INST_ENDING
|
29076 | } else if (isWhitespace(c)) {
|
29077 | parser.state = S.PROC_INST_BODY
|
29078 | } else {
|
29079 | parser.procInstName += c
|
29080 | }
|
29081 | continue
|
29082 |
|
29083 | case S.PROC_INST_BODY:
|
29084 | if (!parser.procInstBody && isWhitespace(c)) {
|
29085 | continue
|
29086 | } else if (c === '?') {
|
29087 | parser.state = S.PROC_INST_ENDING
|
29088 | } else {
|
29089 | parser.procInstBody += c
|
29090 | }
|
29091 | continue
|
29092 |
|
29093 | case S.PROC_INST_ENDING:
|
29094 | if (c === '>') {
|
29095 | emitNode(parser, 'onprocessinginstruction', {
|
29096 | name: parser.procInstName,
|
29097 | body: parser.procInstBody
|
29098 | })
|
29099 | parser.procInstName = parser.procInstBody = ''
|
29100 | parser.state = S.TEXT
|
29101 | } else {
|
29102 | parser.procInstBody += '?' + c
|
29103 | parser.state = S.PROC_INST_BODY
|
29104 | }
|
29105 | continue
|
29106 |
|
29107 | case S.OPEN_TAG:
|
29108 | if (isMatch(nameBody, c)) {
|
29109 | parser.tagName += c
|
29110 | } else {
|
29111 | newTag(parser)
|
29112 | if (c === '>') {
|
29113 | openTag(parser)
|
29114 | } else if (c === '/') {
|
29115 | parser.state = S.OPEN_TAG_SLASH
|
29116 | } else {
|
29117 | if (!isWhitespace(c)) {
|
29118 | strictFail(parser, 'Invalid character in tag name')
|
29119 | }
|
29120 | parser.state = S.ATTRIB
|
29121 | }
|
29122 | }
|
29123 | continue
|
29124 |
|
29125 | case S.OPEN_TAG_SLASH:
|
29126 | if (c === '>') {
|
29127 | openTag(parser, true)
|
29128 | closeTag(parser)
|
29129 | } else {
|
29130 | strictFail(parser, 'Forward-slash in opening tag not followed by >')
|
29131 | parser.state = S.ATTRIB
|
29132 | }
|
29133 | continue
|
29134 |
|
29135 | case S.ATTRIB:
|
29136 |
|
29137 | if (isWhitespace(c)) {
|
29138 | continue
|
29139 | } else if (c === '>') {
|
29140 | openTag(parser)
|
29141 | } else if (c === '/') {
|
29142 | parser.state = S.OPEN_TAG_SLASH
|
29143 | } else if (isMatch(nameStart, c)) {
|
29144 | parser.attribName = c
|
29145 | parser.attribValue = ''
|
29146 | parser.state = S.ATTRIB_NAME
|
29147 | } else {
|
29148 | strictFail(parser, 'Invalid attribute name')
|
29149 | }
|
29150 | continue
|
29151 |
|
29152 | case S.ATTRIB_NAME:
|
29153 | if (c === '=') {
|
29154 | parser.state = S.ATTRIB_VALUE
|
29155 | } else if (c === '>') {
|
29156 | strictFail(parser, 'Attribute without value')
|
29157 | parser.attribValue = parser.attribName
|
29158 | attrib(parser)
|
29159 | openTag(parser)
|
29160 | } else if (isWhitespace(c)) {
|
29161 | parser.state = S.ATTRIB_NAME_SAW_WHITE
|
29162 | } else if (isMatch(nameBody, c)) {
|
29163 | parser.attribName += c
|
29164 | } else {
|
29165 | strictFail(parser, 'Invalid attribute name')
|
29166 | }
|
29167 | continue
|
29168 |
|
29169 | case S.ATTRIB_NAME_SAW_WHITE:
|
29170 | if (c === '=') {
|
29171 | parser.state = S.ATTRIB_VALUE
|
29172 | } else if (isWhitespace(c)) {
|
29173 | continue
|
29174 | } else {
|
29175 | strictFail(parser, 'Attribute without value')
|
29176 | parser.tag.attributes[parser.attribName] = ''
|
29177 | parser.attribValue = ''
|
29178 | emitNode(parser, 'onattribute', {
|
29179 | name: parser.attribName,
|
29180 | value: ''
|
29181 | })
|
29182 | parser.attribName = ''
|
29183 | if (c === '>') {
|
29184 | openTag(parser)
|
29185 | } else if (isMatch(nameStart, c)) {
|
29186 | parser.attribName = c
|
29187 | parser.state = S.ATTRIB_NAME
|
29188 | } else {
|
29189 | strictFail(parser, 'Invalid attribute name')
|
29190 | parser.state = S.ATTRIB
|
29191 | }
|
29192 | }
|
29193 | continue
|
29194 |
|
29195 | case S.ATTRIB_VALUE:
|
29196 | if (isWhitespace(c)) {
|
29197 | continue
|
29198 | } else if (isQuote(c)) {
|
29199 | parser.q = c
|
29200 | parser.state = S.ATTRIB_VALUE_QUOTED
|
29201 | } else {
|
29202 | strictFail(parser, 'Unquoted attribute value')
|
29203 | parser.state = S.ATTRIB_VALUE_UNQUOTED
|
29204 | parser.attribValue = c
|
29205 | }
|
29206 | continue
|
29207 |
|
29208 | case S.ATTRIB_VALUE_QUOTED:
|
29209 | if (c !== parser.q) {
|
29210 | if (c === '&') {
|
29211 | parser.state = S.ATTRIB_VALUE_ENTITY_Q
|
29212 | } else {
|
29213 | parser.attribValue += c
|
29214 | }
|
29215 | continue
|
29216 | }
|
29217 | attrib(parser)
|
29218 | parser.q = ''
|
29219 | parser.state = S.ATTRIB_VALUE_CLOSED
|
29220 | continue
|
29221 |
|
29222 | case S.ATTRIB_VALUE_CLOSED:
|
29223 | if (isWhitespace(c)) {
|
29224 | parser.state = S.ATTRIB
|
29225 | } else if (c === '>') {
|
29226 | openTag(parser)
|
29227 | } else if (c === '/') {
|
29228 | parser.state = S.OPEN_TAG_SLASH
|
29229 | } else if (isMatch(nameStart, c)) {
|
29230 | strictFail(parser, 'No whitespace between attributes')
|
29231 | parser.attribName = c
|
29232 | parser.attribValue = ''
|
29233 | parser.state = S.ATTRIB_NAME
|
29234 | } else {
|
29235 | strictFail(parser, 'Invalid attribute name')
|
29236 | }
|
29237 | continue
|
29238 |
|
29239 | case S.ATTRIB_VALUE_UNQUOTED:
|
29240 | if (!isAttribEnd(c)) {
|
29241 | if (c === '&') {
|
29242 | parser.state = S.ATTRIB_VALUE_ENTITY_U
|
29243 | } else {
|
29244 | parser.attribValue += c
|
29245 | }
|
29246 | continue
|
29247 | }
|
29248 | attrib(parser)
|
29249 | if (c === '>') {
|
29250 | openTag(parser)
|
29251 | } else {
|
29252 | parser.state = S.ATTRIB
|
29253 | }
|
29254 | continue
|
29255 |
|
29256 | case S.CLOSE_TAG:
|
29257 | if (!parser.tagName) {
|
29258 | if (isWhitespace(c)) {
|
29259 | continue
|
29260 | } else if (notMatch(nameStart, c)) {
|
29261 | if (parser.script) {
|
29262 | parser.script += '</' + c
|
29263 | parser.state = S.SCRIPT
|
29264 | } else {
|
29265 | strictFail(parser, 'Invalid tagname in closing tag.')
|
29266 | }
|
29267 | } else {
|
29268 | parser.tagName = c
|
29269 | }
|
29270 | } else if (c === '>') {
|
29271 | closeTag(parser)
|
29272 | } else if (isMatch(nameBody, c)) {
|
29273 | parser.tagName += c
|
29274 | } else if (parser.script) {
|
29275 | parser.script += '</' + parser.tagName
|
29276 | parser.tagName = ''
|
29277 | parser.state = S.SCRIPT
|
29278 | } else {
|
29279 | if (!isWhitespace(c)) {
|
29280 | strictFail(parser, 'Invalid tagname in closing tag')
|
29281 | }
|
29282 | parser.state = S.CLOSE_TAG_SAW_WHITE
|
29283 | }
|
29284 | continue
|
29285 |
|
29286 | case S.CLOSE_TAG_SAW_WHITE:
|
29287 | if (isWhitespace(c)) {
|
29288 | continue
|
29289 | }
|
29290 | if (c === '>') {
|
29291 | closeTag(parser)
|
29292 | } else {
|
29293 | strictFail(parser, 'Invalid characters in closing tag')
|
29294 | }
|
29295 | continue
|
29296 |
|
29297 | case S.TEXT_ENTITY:
|
29298 | case S.ATTRIB_VALUE_ENTITY_Q:
|
29299 | case S.ATTRIB_VALUE_ENTITY_U:
|
29300 | var returnState
|
29301 | var buffer
|
29302 | switch (parser.state) {
|
29303 | case S.TEXT_ENTITY:
|
29304 | returnState = S.TEXT
|
29305 | buffer = 'textNode'
|
29306 | break
|
29307 |
|
29308 | case S.ATTRIB_VALUE_ENTITY_Q:
|
29309 | returnState = S.ATTRIB_VALUE_QUOTED
|
29310 | buffer = 'attribValue'
|
29311 | break
|
29312 |
|
29313 | case S.ATTRIB_VALUE_ENTITY_U:
|
29314 | returnState = S.ATTRIB_VALUE_UNQUOTED
|
29315 | buffer = 'attribValue'
|
29316 | break
|
29317 | }
|
29318 |
|
29319 | if (c === ';') {
|
29320 | parser[buffer] += parseEntity(parser)
|
29321 | parser.entity = ''
|
29322 | parser.state = returnState
|
29323 | } else if (isMatch(parser.entity.length ? entityBody : entityStart, c)) {
|
29324 | parser.entity += c
|
29325 | } else {
|
29326 | strictFail(parser, 'Invalid character in entity name')
|
29327 | parser[buffer] += '&' + parser.entity + c
|
29328 | parser.entity = ''
|
29329 | parser.state = returnState
|
29330 | }
|
29331 |
|
29332 | continue
|
29333 |
|
29334 | default:
|
29335 | throw new Error(parser, 'Unknown state: ' + parser.state)
|
29336 | }
|
29337 | }
|
29338 |
|
29339 | if (parser.position >= parser.bufferCheckPosition) {
|
29340 | checkBufferLength(parser)
|
29341 | }
|
29342 | return parser
|
29343 | }
|
29344 |
|
29345 |
|
29346 |
|
29347 | if (!String.fromCodePoint) {
|
29348 | (function () {
|
29349 | var stringFromCharCode = String.fromCharCode
|
29350 | var floor = Math.floor
|
29351 | var fromCodePoint = function () {
|
29352 | var MAX_SIZE = 0x4000
|
29353 | var codeUnits = []
|
29354 | var highSurrogate
|
29355 | var lowSurrogate
|
29356 | var index = -1
|
29357 | var length = arguments.length
|
29358 | if (!length) {
|
29359 | return ''
|
29360 | }
|
29361 | var result = ''
|
29362 | while (++index < length) {
|
29363 | var codePoint = Number(arguments[index])
|
29364 | if (
|
29365 | !isFinite(codePoint) ||
|
29366 | codePoint < 0 ||
|
29367 | codePoint > 0x10FFFF ||
|
29368 | floor(codePoint) !== codePoint
|
29369 | ) {
|
29370 | throw RangeError('Invalid code point: ' + codePoint)
|
29371 | }
|
29372 | if (codePoint <= 0xFFFF) {
|
29373 | codeUnits.push(codePoint)
|
29374 | } else {
|
29375 |
|
29376 | codePoint -= 0x10000
|
29377 | highSurrogate = (codePoint >> 10) + 0xD800
|
29378 | lowSurrogate = (codePoint % 0x400) + 0xDC00
|
29379 | codeUnits.push(highSurrogate, lowSurrogate)
|
29380 | }
|
29381 | if (index + 1 === length || codeUnits.length > MAX_SIZE) {
|
29382 | result += stringFromCharCode.apply(null, codeUnits)
|
29383 | codeUnits.length = 0
|
29384 | }
|
29385 | }
|
29386 | return result
|
29387 | }
|
29388 |
|
29389 | if (Object.defineProperty) {
|
29390 | Object.defineProperty(String, 'fromCodePoint', {
|
29391 | value: fromCodePoint,
|
29392 | configurable: true,
|
29393 | writable: true
|
29394 | })
|
29395 | } else {
|
29396 | String.fromCodePoint = fromCodePoint
|
29397 | }
|
29398 | }())
|
29399 | }
|
29400 | })(typeof exports === 'undefined' ? this.sax = {} : exports)
|
29401 |
|
29402 | }).call(this,require("buffer").Buffer)
|
29403 | },{"buffer":98,"stream":340,"string_decoder":341}],340:[function(require,module,exports){
|
29404 |
|
29405 |
|
29406 |
|
29407 |
|
29408 |
|
29409 |
|
29410 |
|
29411 |
|
29412 |
|
29413 |
|
29414 |
|
29415 |
|
29416 |
|
29417 |
|
29418 |
|
29419 |
|
29420 |
|
29421 |
|
29422 |
|
29423 |
|
29424 |
|
29425 | module.exports = Stream;
|
29426 |
|
29427 | var EE = require('events').EventEmitter;
|
29428 | var inherits = require('inherits');
|
29429 |
|
29430 | inherits(Stream, EE);
|
29431 | Stream.Readable = require('readable-stream/readable.js');
|
29432 | Stream.Writable = require('readable-stream/writable.js');
|
29433 | Stream.Duplex = require('readable-stream/duplex.js');
|
29434 | Stream.Transform = require('readable-stream/transform.js');
|
29435 | Stream.PassThrough = require('readable-stream/passthrough.js');
|
29436 |
|
29437 |
|
29438 | Stream.Stream = Stream;
|
29439 |
|
29440 |
|
29441 |
|
29442 |
|
29443 |
|
29444 |
|
29445 | function Stream() {
|
29446 | EE.call(this);
|
29447 | }
|
29448 |
|
29449 | Stream.prototype.pipe = function(dest, options) {
|
29450 | var source = this;
|
29451 |
|
29452 | function ondata(chunk) {
|
29453 | if (dest.writable) {
|
29454 | if (false === dest.write(chunk) && source.pause) {
|
29455 | source.pause();
|
29456 | }
|
29457 | }
|
29458 | }
|
29459 |
|
29460 | source.on('data', ondata);
|
29461 |
|
29462 | function ondrain() {
|
29463 | if (source.readable && source.resume) {
|
29464 | source.resume();
|
29465 | }
|
29466 | }
|
29467 |
|
29468 | dest.on('drain', ondrain);
|
29469 |
|
29470 |
|
29471 |
|
29472 | if (!dest._isStdio && (!options || options.end !== false)) {
|
29473 | source.on('end', onend);
|
29474 | source.on('close', onclose);
|
29475 | }
|
29476 |
|
29477 | var didOnEnd = false;
|
29478 | function onend() {
|
29479 | if (didOnEnd) return;
|
29480 | didOnEnd = true;
|
29481 |
|
29482 | dest.end();
|
29483 | }
|
29484 |
|
29485 |
|
29486 | function onclose() {
|
29487 | if (didOnEnd) return;
|
29488 | didOnEnd = true;
|
29489 |
|
29490 | if (typeof dest.destroy === 'function') dest.destroy();
|
29491 | }
|
29492 |
|
29493 |
|
29494 | function onerror(er) {
|
29495 | cleanup();
|
29496 | if (EE.listenerCount(this, 'error') === 0) {
|
29497 | throw er;
|
29498 | }
|
29499 | }
|
29500 |
|
29501 | source.on('error', onerror);
|
29502 | dest.on('error', onerror);
|
29503 |
|
29504 |
|
29505 | function cleanup() {
|
29506 | source.removeListener('data', ondata);
|
29507 | dest.removeListener('drain', ondrain);
|
29508 |
|
29509 | source.removeListener('end', onend);
|
29510 | source.removeListener('close', onclose);
|
29511 |
|
29512 | source.removeListener('error', onerror);
|
29513 | dest.removeListener('error', onerror);
|
29514 |
|
29515 | source.removeListener('end', cleanup);
|
29516 | source.removeListener('close', cleanup);
|
29517 |
|
29518 | dest.removeListener('close', cleanup);
|
29519 | }
|
29520 |
|
29521 | source.on('end', cleanup);
|
29522 | source.on('close', cleanup);
|
29523 |
|
29524 | dest.on('close', cleanup);
|
29525 |
|
29526 | dest.emit('pipe', source);
|
29527 |
|
29528 |
|
29529 | return dest;
|
29530 | };
|
29531 |
|
29532 | },{"events":297,"inherits":307,"readable-stream/duplex.js":324,"readable-stream/passthrough.js":333,"readable-stream/readable.js":334,"readable-stream/transform.js":335,"readable-stream/writable.js":336}],341:[function(require,module,exports){
|
29533 |
|
29534 |
|
29535 |
|
29536 |
|
29537 |
|
29538 |
|
29539 |
|
29540 |
|
29541 |
|
29542 |
|
29543 |
|
29544 |
|
29545 |
|
29546 |
|
29547 |
|
29548 |
|
29549 |
|
29550 |
|
29551 |
|
29552 |
|
29553 |
|
29554 | 'use strict';
|
29555 |
|
29556 |
|
29557 |
|
29558 | var Buffer = require('safe-buffer').Buffer;
|
29559 |
|
29560 |
|
29561 | var isEncoding = Buffer.isEncoding || function (encoding) {
|
29562 | encoding = '' + encoding;
|
29563 | switch (encoding && encoding.toLowerCase()) {
|
29564 | case 'hex':case 'utf8':case 'utf-8':case 'ascii':case 'binary':case 'base64':case 'ucs2':case 'ucs-2':case 'utf16le':case 'utf-16le':case 'raw':
|
29565 | return true;
|
29566 | default:
|
29567 | return false;
|
29568 | }
|
29569 | };
|
29570 |
|
29571 | function _normalizeEncoding(enc) {
|
29572 | if (!enc) return 'utf8';
|
29573 | var retried;
|
29574 | while (true) {
|
29575 | switch (enc) {
|
29576 | case 'utf8':
|
29577 | case 'utf-8':
|
29578 | return 'utf8';
|
29579 | case 'ucs2':
|
29580 | case 'ucs-2':
|
29581 | case 'utf16le':
|
29582 | case 'utf-16le':
|
29583 | return 'utf16le';
|
29584 | case 'latin1':
|
29585 | case 'binary':
|
29586 | return 'latin1';
|
29587 | case 'base64':
|
29588 | case 'ascii':
|
29589 | case 'hex':
|
29590 | return enc;
|
29591 | default:
|
29592 | if (retried) return;
|
29593 | enc = ('' + enc).toLowerCase();
|
29594 | retried = true;
|
29595 | }
|
29596 | }
|
29597 | };
|
29598 |
|
29599 |
|
29600 |
|
29601 | function normalizeEncoding(enc) {
|
29602 | var nenc = _normalizeEncoding(enc);
|
29603 | if (typeof nenc !== 'string' && (Buffer.isEncoding === isEncoding || !isEncoding(enc))) throw new Error('Unknown encoding: ' + enc);
|
29604 | return nenc || enc;
|
29605 | }
|
29606 |
|
29607 |
|
29608 |
|
29609 |
|
29610 | exports.StringDecoder = StringDecoder;
|
29611 | function StringDecoder(encoding) {
|
29612 | this.encoding = normalizeEncoding(encoding);
|
29613 | var nb;
|
29614 | switch (this.encoding) {
|
29615 | case 'utf16le':
|
29616 | this.text = utf16Text;
|
29617 | this.end = utf16End;
|
29618 | nb = 4;
|
29619 | break;
|
29620 | case 'utf8':
|
29621 | this.fillLast = utf8FillLast;
|
29622 | nb = 4;
|
29623 | break;
|
29624 | case 'base64':
|
29625 | this.text = base64Text;
|
29626 | this.end = base64End;
|
29627 | nb = 3;
|
29628 | break;
|
29629 | default:
|
29630 | this.write = simpleWrite;
|
29631 | this.end = simpleEnd;
|
29632 | return;
|
29633 | }
|
29634 | this.lastNeed = 0;
|
29635 | this.lastTotal = 0;
|
29636 | this.lastChar = Buffer.allocUnsafe(nb);
|
29637 | }
|
29638 |
|
29639 | StringDecoder.prototype.write = function (buf) {
|
29640 | if (buf.length === 0) return '';
|
29641 | var r;
|
29642 | var i;
|
29643 | if (this.lastNeed) {
|
29644 | r = this.fillLast(buf);
|
29645 | if (r === undefined) return '';
|
29646 | i = this.lastNeed;
|
29647 | this.lastNeed = 0;
|
29648 | } else {
|
29649 | i = 0;
|
29650 | }
|
29651 | if (i < buf.length) return r ? r + this.text(buf, i) : this.text(buf, i);
|
29652 | return r || '';
|
29653 | };
|
29654 |
|
29655 | StringDecoder.prototype.end = utf8End;
|
29656 |
|
29657 |
|
29658 | StringDecoder.prototype.text = utf8Text;
|
29659 |
|
29660 |
|
29661 | StringDecoder.prototype.fillLast = function (buf) {
|
29662 | if (this.lastNeed <= buf.length) {
|
29663 | buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed);
|
29664 | return this.lastChar.toString(this.encoding, 0, this.lastTotal);
|
29665 | }
|
29666 | buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, buf.length);
|
29667 | this.lastNeed -= buf.length;
|
29668 | };
|
29669 |
|
29670 |
|
29671 |
|
29672 | function utf8CheckByte(byte) {
|
29673 | if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;
|
29674 | return byte >> 6 === 0x02 ? -1 : -2;
|
29675 | }
|
29676 |
|
29677 |
|
29678 |
|
29679 |
|
29680 | function utf8CheckIncomplete(self, buf, i) {
|
29681 | var j = buf.length - 1;
|
29682 | if (j < i) return 0;
|
29683 | var nb = utf8CheckByte(buf[j]);
|
29684 | if (nb >= 0) {
|
29685 | if (nb > 0) self.lastNeed = nb - 1;
|
29686 | return nb;
|
29687 | }
|
29688 | if (--j < i || nb === -2) return 0;
|
29689 | nb = utf8CheckByte(buf[j]);
|
29690 | if (nb >= 0) {
|
29691 | if (nb > 0) self.lastNeed = nb - 2;
|
29692 | return nb;
|
29693 | }
|
29694 | if (--j < i || nb === -2) return 0;
|
29695 | nb = utf8CheckByte(buf[j]);
|
29696 | if (nb >= 0) {
|
29697 | if (nb > 0) {
|
29698 | if (nb === 2) nb = 0;else self.lastNeed = nb - 3;
|
29699 | }
|
29700 | return nb;
|
29701 | }
|
29702 | return 0;
|
29703 | }
|
29704 |
|
29705 |
|
29706 |
|
29707 |
|
29708 |
|
29709 |
|
29710 |
|
29711 |
|
29712 |
|
29713 | function utf8CheckExtraBytes(self, buf, p) {
|
29714 | if ((buf[0] & 0xC0) !== 0x80) {
|
29715 | self.lastNeed = 0;
|
29716 | return '\ufffd';
|
29717 | }
|
29718 | if (self.lastNeed > 1 && buf.length > 1) {
|
29719 | if ((buf[1] & 0xC0) !== 0x80) {
|
29720 | self.lastNeed = 1;
|
29721 | return '\ufffd';
|
29722 | }
|
29723 | if (self.lastNeed > 2 && buf.length > 2) {
|
29724 | if ((buf[2] & 0xC0) !== 0x80) {
|
29725 | self.lastNeed = 2;
|
29726 | return '\ufffd';
|
29727 | }
|
29728 | }
|
29729 | }
|
29730 | }
|
29731 |
|
29732 |
|
29733 | function utf8FillLast(buf) {
|
29734 | var p = this.lastTotal - this.lastNeed;
|
29735 | var r = utf8CheckExtraBytes(this, buf, p);
|
29736 | if (r !== undefined) return r;
|
29737 | if (this.lastNeed <= buf.length) {
|
29738 | buf.copy(this.lastChar, p, 0, this.lastNeed);
|
29739 | return this.lastChar.toString(this.encoding, 0, this.lastTotal);
|
29740 | }
|
29741 | buf.copy(this.lastChar, p, 0, buf.length);
|
29742 | this.lastNeed -= buf.length;
|
29743 | }
|
29744 |
|
29745 |
|
29746 |
|
29747 |
|
29748 | function utf8Text(buf, i) {
|
29749 | var total = utf8CheckIncomplete(this, buf, i);
|
29750 | if (!this.lastNeed) return buf.toString('utf8', i);
|
29751 | this.lastTotal = total;
|
29752 | var end = buf.length - (total - this.lastNeed);
|
29753 | buf.copy(this.lastChar, 0, end);
|
29754 | return buf.toString('utf8', i, end);
|
29755 | }
|
29756 |
|
29757 |
|
29758 |
|
29759 | function utf8End(buf) {
|
29760 | var r = buf && buf.length ? this.write(buf) : '';
|
29761 | if (this.lastNeed) return r + '\ufffd';
|
29762 | return r;
|
29763 | }
|
29764 |
|
29765 |
|
29766 |
|
29767 |
|
29768 |
|
29769 | function utf16Text(buf, i) {
|
29770 | if ((buf.length - i) % 2 === 0) {
|
29771 | var r = buf.toString('utf16le', i);
|
29772 | if (r) {
|
29773 | var c = r.charCodeAt(r.length - 1);
|
29774 | if (c >= 0xD800 && c <= 0xDBFF) {
|
29775 | this.lastNeed = 2;
|
29776 | this.lastTotal = 4;
|
29777 | this.lastChar[0] = buf[buf.length - 2];
|
29778 | this.lastChar[1] = buf[buf.length - 1];
|
29779 | return r.slice(0, -1);
|
29780 | }
|
29781 | }
|
29782 | return r;
|
29783 | }
|
29784 | this.lastNeed = 1;
|
29785 | this.lastTotal = 2;
|
29786 | this.lastChar[0] = buf[buf.length - 1];
|
29787 | return buf.toString('utf16le', i, buf.length - 1);
|
29788 | }
|
29789 |
|
29790 |
|
29791 |
|
29792 | function utf16End(buf) {
|
29793 | var r = buf && buf.length ? this.write(buf) : '';
|
29794 | if (this.lastNeed) {
|
29795 | var end = this.lastTotal - this.lastNeed;
|
29796 | return r + this.lastChar.toString('utf16le', 0, end);
|
29797 | }
|
29798 | return r;
|
29799 | }
|
29800 |
|
29801 | function base64Text(buf, i) {
|
29802 | var n = (buf.length - i) % 3;
|
29803 | if (n === 0) return buf.toString('base64', i);
|
29804 | this.lastNeed = 3 - n;
|
29805 | this.lastTotal = 3;
|
29806 | if (n === 1) {
|
29807 | this.lastChar[0] = buf[buf.length - 1];
|
29808 | } else {
|
29809 | this.lastChar[0] = buf[buf.length - 2];
|
29810 | this.lastChar[1] = buf[buf.length - 1];
|
29811 | }
|
29812 | return buf.toString('base64', i, buf.length - n);
|
29813 | }
|
29814 |
|
29815 | function base64End(buf) {
|
29816 | var r = buf && buf.length ? this.write(buf) : '';
|
29817 | if (this.lastNeed) return r + this.lastChar.toString('base64', 0, 3 - this.lastNeed);
|
29818 | return r;
|
29819 | }
|
29820 |
|
29821 |
|
29822 | function simpleWrite(buf) {
|
29823 | return buf.toString(this.encoding);
|
29824 | }
|
29825 |
|
29826 | function simpleEnd(buf) {
|
29827 | return buf && buf.length ? this.write(buf) : '';
|
29828 | }
|
29829 | },{"safe-buffer":338}],342:[function(require,module,exports){
|
29830 | (function (setImmediate,clearImmediate){
|
29831 | var nextTick = require('process/browser.js').nextTick;
|
29832 | var apply = Function.prototype.apply;
|
29833 | var slice = Array.prototype.slice;
|
29834 | var immediateIds = {};
|
29835 | var nextImmediateId = 0;
|
29836 |
|
29837 |
|
29838 |
|
29839 | exports.setTimeout = function() {
|
29840 | return new Timeout(apply.call(setTimeout, window, arguments), clearTimeout);
|
29841 | };
|
29842 | exports.setInterval = function() {
|
29843 | return new Timeout(apply.call(setInterval, window, arguments), clearInterval);
|
29844 | };
|
29845 | exports.clearTimeout =
|
29846 | exports.clearInterval = function(timeout) { timeout.close(); };
|
29847 |
|
29848 | function Timeout(id, clearFn) {
|
29849 | this._id = id;
|
29850 | this._clearFn = clearFn;
|
29851 | }
|
29852 | Timeout.prototype.unref = Timeout.prototype.ref = function() {};
|
29853 | Timeout.prototype.close = function() {
|
29854 | this._clearFn.call(window, this._id);
|
29855 | };
|
29856 |
|
29857 |
|
29858 | exports.enroll = function(item, msecs) {
|
29859 | clearTimeout(item._idleTimeoutId);
|
29860 | item._idleTimeout = msecs;
|
29861 | };
|
29862 |
|
29863 | exports.unenroll = function(item) {
|
29864 | clearTimeout(item._idleTimeoutId);
|
29865 | item._idleTimeout = -1;
|
29866 | };
|
29867 |
|
29868 | exports._unrefActive = exports.active = function(item) {
|
29869 | clearTimeout(item._idleTimeoutId);
|
29870 |
|
29871 | var msecs = item._idleTimeout;
|
29872 | if (msecs >= 0) {
|
29873 | item._idleTimeoutId = setTimeout(function onTimeout() {
|
29874 | if (item._onTimeout)
|
29875 | item._onTimeout();
|
29876 | }, msecs);
|
29877 | }
|
29878 | };
|
29879 |
|
29880 |
|
29881 | exports.setImmediate = typeof setImmediate === "function" ? setImmediate : function(fn) {
|
29882 | var id = nextImmediateId++;
|
29883 | var args = arguments.length < 2 ? false : slice.call(arguments, 1);
|
29884 |
|
29885 | immediateIds[id] = true;
|
29886 |
|
29887 | nextTick(function onNextTick() {
|
29888 | if (immediateIds[id]) {
|
29889 |
|
29890 |
|
29891 | if (args) {
|
29892 | fn.apply(null, args);
|
29893 | } else {
|
29894 | fn.call(null);
|
29895 | }
|
29896 |
|
29897 | exports.clearImmediate(id);
|
29898 | }
|
29899 | });
|
29900 |
|
29901 | return id;
|
29902 | };
|
29903 |
|
29904 | exports.clearImmediate = typeof clearImmediate === "function" ? clearImmediate : function(id) {
|
29905 | delete immediateIds[id];
|
29906 | };
|
29907 | }).call(this,require("timers").setImmediate,require("timers").clearImmediate)
|
29908 | },{"process/browser.js":319,"timers":342}],343:[function(require,module,exports){
|
29909 | (function (global){
|
29910 |
|
29911 |
|
29912 |
|
29913 |
|
29914 |
|
29915 | module.exports = deprecate;
|
29916 |
|
29917 |
|
29918 |
|
29919 |
|
29920 |
|
29921 |
|
29922 |
|
29923 |
|
29924 |
|
29925 |
|
29926 |
|
29927 |
|
29928 |
|
29929 |
|
29930 |
|
29931 |
|
29932 |
|
29933 |
|
29934 |
|
29935 | function deprecate (fn, msg) {
|
29936 | if (config('noDeprecation')) {
|
29937 | return fn;
|
29938 | }
|
29939 |
|
29940 | var warned = false;
|
29941 | function deprecated() {
|
29942 | if (!warned) {
|
29943 | if (config('throwDeprecation')) {
|
29944 | throw new Error(msg);
|
29945 | } else if (config('traceDeprecation')) {
|
29946 | console.trace(msg);
|
29947 | } else {
|
29948 | console.warn(msg);
|
29949 | }
|
29950 | warned = true;
|
29951 | }
|
29952 | return fn.apply(this, arguments);
|
29953 | }
|
29954 |
|
29955 | return deprecated;
|
29956 | }
|
29957 |
|
29958 |
|
29959 |
|
29960 |
|
29961 |
|
29962 |
|
29963 |
|
29964 |
|
29965 |
|
29966 | function config (name) {
|
29967 |
|
29968 | try {
|
29969 | if (!global.localStorage) return false;
|
29970 | } catch (_) {
|
29971 | return false;
|
29972 | }
|
29973 | var val = global.localStorage[name];
|
29974 | if (null == val) return false;
|
29975 | return String(val).toLowerCase() === 'true';
|
29976 | }
|
29977 |
|
29978 | }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
29979 | },{}],344:[function(require,module,exports){
|
29980 | if (typeof Object.create === 'function') {
|
29981 |
|
29982 | module.exports = function inherits(ctor, superCtor) {
|
29983 | ctor.super_ = superCtor
|
29984 | ctor.prototype = Object.create(superCtor.prototype, {
|
29985 | constructor: {
|
29986 | value: ctor,
|
29987 | enumerable: false,
|
29988 | writable: true,
|
29989 | configurable: true
|
29990 | }
|
29991 | });
|
29992 | };
|
29993 | } else {
|
29994 |
|
29995 | module.exports = function inherits(ctor, superCtor) {
|
29996 | ctor.super_ = superCtor
|
29997 | var TempCtor = function () {}
|
29998 | TempCtor.prototype = superCtor.prototype
|
29999 | ctor.prototype = new TempCtor()
|
30000 | ctor.prototype.constructor = ctor
|
30001 | }
|
30002 | }
|
30003 |
|
30004 | },{}],345:[function(require,module,exports){
|
30005 | module.exports = function isBuffer(arg) {
|
30006 | return arg && typeof arg === 'object'
|
30007 | && typeof arg.copy === 'function'
|
30008 | && typeof arg.fill === 'function'
|
30009 | && typeof arg.readUInt8 === 'function';
|
30010 | }
|
30011 | },{}],346:[function(require,module,exports){
|
30012 | (function (process,global){
|
30013 |
|
30014 |
|
30015 |
|
30016 |
|
30017 |
|
30018 |
|
30019 |
|
30020 |
|
30021 |
|
30022 |
|
30023 |
|
30024 |
|
30025 |
|
30026 |
|
30027 |
|
30028 |
|
30029 |
|
30030 |
|
30031 |
|
30032 |
|
30033 |
|
30034 | var formatRegExp = /%[sdj%]/g;
|
30035 | exports.format = function(f) {
|
30036 | if (!isString(f)) {
|
30037 | var objects = [];
|
30038 | for (var i = 0; i < arguments.length; i++) {
|
30039 | objects.push(inspect(arguments[i]));
|
30040 | }
|
30041 | return objects.join(' ');
|
30042 | }
|
30043 |
|
30044 | var i = 1;
|
30045 | var args = arguments;
|
30046 | var len = args.length;
|
30047 | var str = String(f).replace(formatRegExp, function(x) {
|
30048 | if (x === '%%') return '%';
|
30049 | if (i >= len) return x;
|
30050 | switch (x) {
|
30051 | case '%s': return String(args[i++]);
|
30052 | case '%d': return Number(args[i++]);
|
30053 | case '%j':
|
30054 | try {
|
30055 | return JSON.stringify(args[i++]);
|
30056 | } catch (_) {
|
30057 | return '[Circular]';
|
30058 | }
|
30059 | default:
|
30060 | return x;
|
30061 | }
|
30062 | });
|
30063 | for (var x = args[i]; i < len; x = args[++i]) {
|
30064 | if (isNull(x) || !isObject(x)) {
|
30065 | str += ' ' + x;
|
30066 | } else {
|
30067 | str += ' ' + inspect(x);
|
30068 | }
|
30069 | }
|
30070 | return str;
|
30071 | };
|
30072 |
|
30073 |
|
30074 |
|
30075 |
|
30076 |
|
30077 | exports.deprecate = function(fn, msg) {
|
30078 |
|
30079 | if (isUndefined(global.process)) {
|
30080 | return function() {
|
30081 | return exports.deprecate(fn, msg).apply(this, arguments);
|
30082 | };
|
30083 | }
|
30084 |
|
30085 | if (process.noDeprecation === true) {
|
30086 | return fn;
|
30087 | }
|
30088 |
|
30089 | var warned = false;
|
30090 | function deprecated() {
|
30091 | if (!warned) {
|
30092 | if (process.throwDeprecation) {
|
30093 | throw new Error(msg);
|
30094 | } else if (process.traceDeprecation) {
|
30095 | console.trace(msg);
|
30096 | } else {
|
30097 | console.error(msg);
|
30098 | }
|
30099 | warned = true;
|
30100 | }
|
30101 | return fn.apply(this, arguments);
|
30102 | }
|
30103 |
|
30104 | return deprecated;
|
30105 | };
|
30106 |
|
30107 |
|
30108 | var debugs = {};
|
30109 | var debugEnviron;
|
30110 | exports.debuglog = function(set) {
|
30111 | if (isUndefined(debugEnviron))
|
30112 | debugEnviron = process.env.NODE_DEBUG || '';
|
30113 | set = set.toUpperCase();
|
30114 | if (!debugs[set]) {
|
30115 | if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) {
|
30116 | var pid = process.pid;
|
30117 | debugs[set] = function() {
|
30118 | var msg = exports.format.apply(exports, arguments);
|
30119 | console.error('%s %d: %s', set, pid, msg);
|
30120 | };
|
30121 | } else {
|
30122 | debugs[set] = function() {};
|
30123 | }
|
30124 | }
|
30125 | return debugs[set];
|
30126 | };
|
30127 |
|
30128 |
|
30129 | /**
|
30130 | * Echos the value of a value. Trys to print the value out
|
30131 | * in the best way possible given the different types.
|
30132 | *
|
30133 | * @param {Object} obj The object to print out.
|
30134 | * @param {Object} opts Optional options object that alters the output.
|
30135 | */
|
30136 |
|
30137 | function inspect(obj, opts) {
|
30138 |
|
30139 | var ctx = {
|
30140 | seen: [],
|
30141 | stylize: stylizeNoColor
|
30142 | };
|
30143 |
|
30144 | if (arguments.length >= 3) ctx.depth = arguments[2];
|
30145 | if (arguments.length >= 4) ctx.colors = arguments[3];
|
30146 | if (isBoolean(opts)) {
|
30147 |
|
30148 | ctx.showHidden = opts;
|
30149 | } else if (opts) {
|
30150 |
|
30151 | exports._extend(ctx, opts);
|
30152 | }
|
30153 |
|
30154 | if (isUndefined(ctx.showHidden)) ctx.showHidden = false;
|
30155 | if (isUndefined(ctx.depth)) ctx.depth = 2;
|
30156 | if (isUndefined(ctx.colors)) ctx.colors = false;
|
30157 | if (isUndefined(ctx.customInspect)) ctx.customInspect = true;
|
30158 | if (ctx.colors) ctx.stylize = stylizeWithColor;
|
30159 | return formatValue(ctx, obj, ctx.depth);
|
30160 | }
|
30161 | exports.inspect = inspect;
|
30162 |
|
30163 |
|
30164 |
|
30165 | inspect.colors = {
|
30166 | 'bold' : [1, 22],
|
30167 | 'italic' : [3, 23],
|
30168 | 'underline' : [4, 24],
|
30169 | 'inverse' : [7, 27],
|
30170 | 'white' : [37, 39],
|
30171 | 'grey' : [90, 39],
|
30172 | 'black' : [30, 39],
|
30173 | 'blue' : [34, 39],
|
30174 | 'cyan' : [36, 39],
|
30175 | 'green' : [32, 39],
|
30176 | 'magenta' : [35, 39],
|
30177 | 'red' : [31, 39],
|
30178 | 'yellow' : [33, 39]
|
30179 | };
|
30180 |
|
30181 |
|
30182 | inspect.styles = {
|
30183 | 'special': 'cyan',
|
30184 | 'number': 'yellow',
|
30185 | 'boolean': 'yellow',
|
30186 | 'undefined': 'grey',
|
30187 | 'null': 'bold',
|
30188 | 'string': 'green',
|
30189 | 'date': 'magenta',
|
30190 |
|
30191 | 'regexp': 'red'
|
30192 | };
|
30193 |
|
30194 |
|
30195 | function stylizeWithColor(str, styleType) {
|
30196 | var style = inspect.styles[styleType];
|
30197 |
|
30198 | if (style) {
|
30199 | return '\u001b[' + inspect.colors[style][0] + 'm' + str +
|
30200 | '\u001b[' + inspect.colors[style][1] + 'm';
|
30201 | } else {
|
30202 | return str;
|
30203 | }
|
30204 | }
|
30205 |
|
30206 |
|
30207 | function stylizeNoColor(str, styleType) {
|
30208 | return str;
|
30209 | }
|
30210 |
|
30211 |
|
30212 | function arrayToHash(array) {
|
30213 | var hash = {};
|
30214 |
|
30215 | array.forEach(function(val, idx) {
|
30216 | hash[val] = true;
|
30217 | });
|
30218 |
|
30219 | return hash;
|
30220 | }
|
30221 |
|
30222 |
|
30223 | function formatValue(ctx, value, recurseTimes) {
|
30224 |
|
30225 |
|
30226 | if (ctx.customInspect &&
|
30227 | value &&
|
30228 | isFunction(value.inspect) &&
|
30229 |
|
30230 | value.inspect !== exports.inspect &&
|
30231 |
|
30232 | !(value.constructor && value.constructor.prototype === value)) {
|
30233 | var ret = value.inspect(recurseTimes, ctx);
|
30234 | if (!isString(ret)) {
|
30235 | ret = formatValue(ctx, ret, recurseTimes);
|
30236 | }
|
30237 | return ret;
|
30238 | }
|
30239 |
|
30240 |
|
30241 | var primitive = formatPrimitive(ctx, value);
|
30242 | if (primitive) {
|
30243 | return primitive;
|
30244 | }
|
30245 |
|
30246 |
|
30247 | var keys = Object.keys(value);
|
30248 | var visibleKeys = arrayToHash(keys);
|
30249 |
|
30250 | if (ctx.showHidden) {
|
30251 | keys = Object.getOwnPropertyNames(value);
|
30252 | }
|
30253 |
|
30254 |
|
30255 |
|
30256 | if (isError(value)
|
30257 | && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {
|
30258 | return formatError(value);
|
30259 | }
|
30260 |
|
30261 |
|
30262 | if (keys.length === 0) {
|
30263 | if (isFunction(value)) {
|
30264 | var name = value.name ? ': ' + value.name : '';
|
30265 | return ctx.stylize('[Function' + name + ']', 'special');
|
30266 | }
|
30267 | if (isRegExp(value)) {
|
30268 | return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
|
30269 | }
|
30270 | if (isDate(value)) {
|
30271 | return ctx.stylize(Date.prototype.toString.call(value), 'date');
|
30272 | }
|
30273 | if (isError(value)) {
|
30274 | return formatError(value);
|
30275 | }
|
30276 | }
|
30277 |
|
30278 | var base = '', array = false, braces = ['{', '}'];
|
30279 |
|
30280 |
|
30281 | if (isArray(value)) {
|
30282 | array = true;
|
30283 | braces = ['[', ']'];
|
30284 | }
|
30285 |
|
30286 |
|
30287 | if (isFunction(value)) {
|
30288 | var n = value.name ? ': ' + value.name : '';
|
30289 | base = ' [Function' + n + ']';
|
30290 | }
|
30291 |
|
30292 |
|
30293 | if (isRegExp(value)) {
|
30294 | base = ' ' + RegExp.prototype.toString.call(value);
|
30295 | }
|
30296 |
|
30297 |
|
30298 | if (isDate(value)) {
|
30299 | base = ' ' + Date.prototype.toUTCString.call(value);
|
30300 | }
|
30301 |
|
30302 |
|
30303 | if (isError(value)) {
|
30304 | base = ' ' + formatError(value);
|
30305 | }
|
30306 |
|
30307 | if (keys.length === 0 && (!array || value.length == 0)) {
|
30308 | return braces[0] + base + braces[1];
|
30309 | }
|
30310 |
|
30311 | if (recurseTimes < 0) {
|
30312 | if (isRegExp(value)) {
|
30313 | return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
|
30314 | } else {
|
30315 | return ctx.stylize('[Object]', 'special');
|
30316 | }
|
30317 | }
|
30318 |
|
30319 | ctx.seen.push(value);
|
30320 |
|
30321 | var output;
|
30322 | if (array) {
|
30323 | output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);
|
30324 | } else {
|
30325 | output = keys.map(function(key) {
|
30326 | return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);
|
30327 | });
|
30328 | }
|
30329 |
|
30330 | ctx.seen.pop();
|
30331 |
|
30332 | return reduceToSingleString(output, base, braces);
|
30333 | }
|
30334 |
|
30335 |
|
30336 | function formatPrimitive(ctx, value) {
|
30337 | if (isUndefined(value))
|
30338 | return ctx.stylize('undefined', 'undefined');
|
30339 | if (isString(value)) {
|
30340 | var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '')
|
30341 | .replace(/'/g, "\\'")
|
30342 | .replace(/\\"/g, '"') + '\'';
|
30343 | return ctx.stylize(simple, 'string');
|
30344 | }
|
30345 | if (isNumber(value))
|
30346 | return ctx.stylize('' + value, 'number');
|
30347 | if (isBoolean(value))
|
30348 | return ctx.stylize('' + value, 'boolean');
|
30349 |
|
30350 | if (isNull(value))
|
30351 | return ctx.stylize('null', 'null');
|
30352 | }
|
30353 |
|
30354 |
|
30355 | function formatError(value) {
|
30356 | return '[' + Error.prototype.toString.call(value) + ']';
|
30357 | }
|
30358 |
|
30359 |
|
30360 | function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
|
30361 | var output = [];
|
30362 | for (var i = 0, l = value.length; i < l; ++i) {
|
30363 | if (hasOwnProperty(value, String(i))) {
|
30364 | output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
|
30365 | String(i), true));
|
30366 | } else {
|
30367 | output.push('');
|
30368 | }
|
30369 | }
|
30370 | keys.forEach(function(key) {
|
30371 | if (!key.match(/^\d+$/)) {
|
30372 | output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
|
30373 | key, true));
|
30374 | }
|
30375 | });
|
30376 | return output;
|
30377 | }
|
30378 |
|
30379 |
|
30380 | function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
|
30381 | var name, str, desc;
|
30382 | desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };
|
30383 | if (desc.get) {
|
30384 | if (desc.set) {
|
30385 | str = ctx.stylize('[Getter/Setter]', 'special');
|
30386 | } else {
|
30387 | str = ctx.stylize('[Getter]', 'special');
|
30388 | }
|
30389 | } else {
|
30390 | if (desc.set) {
|
30391 | str = ctx.stylize('[Setter]', 'special');
|
30392 | }
|
30393 | }
|
30394 | if (!hasOwnProperty(visibleKeys, key)) {
|
30395 | name = '[' + key + ']';
|
30396 | }
|
30397 | if (!str) {
|
30398 | if (ctx.seen.indexOf(desc.value) < 0) {
|
30399 | if (isNull(recurseTimes)) {
|
30400 | str = formatValue(ctx, desc.value, null);
|
30401 | } else {
|
30402 | str = formatValue(ctx, desc.value, recurseTimes - 1);
|
30403 | }
|
30404 | if (str.indexOf('\n') > -1) {
|
30405 | if (array) {
|
30406 | str = str.split('\n').map(function(line) {
|
30407 | return ' ' + line;
|
30408 | }).join('\n').substr(2);
|
30409 | } else {
|
30410 | str = '\n' + str.split('\n').map(function(line) {
|
30411 | return ' ' + line;
|
30412 | }).join('\n');
|
30413 | }
|
30414 | }
|
30415 | } else {
|
30416 | str = ctx.stylize('[Circular]', 'special');
|
30417 | }
|
30418 | }
|
30419 | if (isUndefined(name)) {
|
30420 | if (array && key.match(/^\d+$/)) {
|
30421 | return str;
|
30422 | }
|
30423 | name = JSON.stringify('' + key);
|
30424 | if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) {
|
30425 | name = name.substr(1, name.length - 2);
|
30426 | name = ctx.stylize(name, 'name');
|
30427 | } else {
|
30428 | name = name.replace(/'/g, "\\'")
|
30429 | .replace(/\\"/g, '"')
|
30430 | .replace(/(^"|"$)/g, "'");
|
30431 | name = ctx.stylize(name, 'string');
|
30432 | }
|
30433 | }
|
30434 |
|
30435 | return name + ': ' + str;
|
30436 | }
|
30437 |
|
30438 |
|
30439 | function reduceToSingleString(output, base, braces) {
|
30440 | var numLinesEst = 0;
|
30441 | var length = output.reduce(function(prev, cur) {
|
30442 | numLinesEst++;
|
30443 | if (cur.indexOf('\n') >= 0) numLinesEst++;
|
30444 | return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1;
|
30445 | }, 0);
|
30446 |
|
30447 | if (length > 60) {
|
30448 | return braces[0] +
|
30449 | (base === '' ? '' : base + '\n ') +
|
30450 | ' ' +
|
30451 | output.join(',\n ') +
|
30452 | ' ' +
|
30453 | braces[1];
|
30454 | }
|
30455 |
|
30456 | return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];
|
30457 | }
|
30458 |
|
30459 |
|
30460 |
|
30461 |
|
30462 | function isArray(ar) {
|
30463 | return Array.isArray(ar);
|
30464 | }
|
30465 | exports.isArray = isArray;
|
30466 |
|
30467 | function isBoolean(arg) {
|
30468 | return typeof arg === 'boolean';
|
30469 | }
|
30470 | exports.isBoolean = isBoolean;
|
30471 |
|
30472 | function isNull(arg) {
|
30473 | return arg === null;
|
30474 | }
|
30475 | exports.isNull = isNull;
|
30476 |
|
30477 | function isNullOrUndefined(arg) {
|
30478 | return arg == null;
|
30479 | }
|
30480 | exports.isNullOrUndefined = isNullOrUndefined;
|
30481 |
|
30482 | function isNumber(arg) {
|
30483 | return typeof arg === 'number';
|
30484 | }
|
30485 | exports.isNumber = isNumber;
|
30486 |
|
30487 | function isString(arg) {
|
30488 | return typeof arg === 'string';
|
30489 | }
|
30490 | exports.isString = isString;
|
30491 |
|
30492 | function isSymbol(arg) {
|
30493 | return typeof arg === 'symbol';
|
30494 | }
|
30495 | exports.isSymbol = isSymbol;
|
30496 |
|
30497 | function isUndefined(arg) {
|
30498 | return arg === void 0;
|
30499 | }
|
30500 | exports.isUndefined = isUndefined;
|
30501 |
|
30502 | function isRegExp(re) {
|
30503 | return isObject(re) && objectToString(re) === '[object RegExp]';
|
30504 | }
|
30505 | exports.isRegExp = isRegExp;
|
30506 |
|
30507 | function isObject(arg) {
|
30508 | return typeof arg === 'object' && arg !== null;
|
30509 | }
|
30510 | exports.isObject = isObject;
|
30511 |
|
30512 | function isDate(d) {
|
30513 | return isObject(d) && objectToString(d) === '[object Date]';
|
30514 | }
|
30515 | exports.isDate = isDate;
|
30516 |
|
30517 | function isError(e) {
|
30518 | return isObject(e) &&
|
30519 | (objectToString(e) === '[object Error]' || e instanceof Error);
|
30520 | }
|
30521 | exports.isError = isError;
|
30522 |
|
30523 | function isFunction(arg) {
|
30524 | return typeof arg === 'function';
|
30525 | }
|
30526 | exports.isFunction = isFunction;
|
30527 |
|
30528 | function isPrimitive(arg) {
|
30529 | return arg === null ||
|
30530 | typeof arg === 'boolean' ||
|
30531 | typeof arg === 'number' ||
|
30532 | typeof arg === 'string' ||
|
30533 | typeof arg === 'symbol' ||
|
30534 | typeof arg === 'undefined';
|
30535 | }
|
30536 | exports.isPrimitive = isPrimitive;
|
30537 |
|
30538 | exports.isBuffer = require('./support/isBuffer');
|
30539 |
|
30540 | function objectToString(o) {
|
30541 | return Object.prototype.toString.call(o);
|
30542 | }
|
30543 |
|
30544 |
|
30545 | function pad(n) {
|
30546 | return n < 10 ? '0' + n.toString(10) : n.toString(10);
|
30547 | }
|
30548 |
|
30549 |
|
30550 | var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',
|
30551 | 'Oct', 'Nov', 'Dec'];
|
30552 |
|
30553 |
|
30554 | function timestamp() {
|
30555 | var d = new Date();
|
30556 | var time = [pad(d.getHours()),
|
30557 | pad(d.getMinutes()),
|
30558 | pad(d.getSeconds())].join(':');
|
30559 | return [d.getDate(), months[d.getMonth()], time].join(' ');
|
30560 | }
|
30561 |
|
30562 |
|
30563 |
|
30564 | exports.log = function() {
|
30565 | console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments));
|
30566 | };
|
30567 |
|
30568 |
|
30569 |
|
30570 |
|
30571 |
|
30572 |
|
30573 |
|
30574 |
|
30575 |
|
30576 |
|
30577 |
|
30578 |
|
30579 |
|
30580 |
|
30581 |
|
30582 | exports.inherits = require('inherits');
|
30583 |
|
30584 | exports._extend = function(origin, add) {
|
30585 |
|
30586 | if (!add || !isObject(add)) return origin;
|
30587 |
|
30588 | var keys = Object.keys(add);
|
30589 | var i = keys.length;
|
30590 | while (i--) {
|
30591 | origin[keys[i]] = add[keys[i]];
|
30592 | }
|
30593 | return origin;
|
30594 | };
|
30595 |
|
30596 | function hasOwnProperty(obj, prop) {
|
30597 | return Object.prototype.hasOwnProperty.call(obj, prop);
|
30598 | }
|
30599 |
|
30600 | }).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
30601 | },{"./support/isBuffer":345,"_process":393,"inherits":344}],347:[function(require,module,exports){
|
30602 |
|
30603 | (function() {
|
30604 | "use strict";
|
30605 | exports.stripBOM = function(str) {
|
30606 | if (str[0] === '\uFEFF') {
|
30607 | return str.substring(1);
|
30608 | } else {
|
30609 | return str;
|
30610 | }
|
30611 | };
|
30612 |
|
30613 | }).call(this);
|
30614 |
|
30615 | },{}],348:[function(require,module,exports){
|
30616 |
|
30617 | (function() {
|
30618 | "use strict";
|
30619 | var builder, defaults, escapeCDATA, requiresCDATA, wrapCDATA,
|
30620 | hasProp = {}.hasOwnProperty;
|
30621 |
|
30622 | builder = require('xmlbuilder');
|
30623 |
|
30624 | defaults = require('./defaults').defaults;
|
30625 |
|
30626 | requiresCDATA = function(entry) {
|
30627 | return typeof entry === "string" && (entry.indexOf('&') >= 0 || entry.indexOf('>') >= 0 || entry.indexOf('<') >= 0);
|
30628 | };
|
30629 |
|
30630 | wrapCDATA = function(entry) {
|
30631 | return "<![CDATA[" + (escapeCDATA(entry)) + "]]>";
|
30632 | };
|
30633 |
|
30634 | escapeCDATA = function(entry) {
|
30635 | return entry.replace(']]>', ']]]]><![CDATA[>');
|
30636 | };
|
30637 |
|
30638 | exports.Builder = (function() {
|
30639 | function Builder(opts) {
|
30640 | var key, ref, value;
|
30641 | this.options = {};
|
30642 | ref = defaults["0.2"];
|
30643 | for (key in ref) {
|
30644 | if (!hasProp.call(ref, key)) continue;
|
30645 | value = ref[key];
|
30646 | this.options[key] = value;
|
30647 | }
|
30648 | for (key in opts) {
|
30649 | if (!hasProp.call(opts, key)) continue;
|
30650 | value = opts[key];
|
30651 | this.options[key] = value;
|
30652 | }
|
30653 | }
|
30654 |
|
30655 | Builder.prototype.buildObject = function(rootObj) {
|
30656 | var attrkey, charkey, render, rootElement, rootName;
|
30657 | attrkey = this.options.attrkey;
|
30658 | charkey = this.options.charkey;
|
30659 | if ((Object.keys(rootObj).length === 1) && (this.options.rootName === defaults['0.2'].rootName)) {
|
30660 | rootName = Object.keys(rootObj)[0];
|
30661 | rootObj = rootObj[rootName];
|
30662 | } else {
|
30663 | rootName = this.options.rootName;
|
30664 | }
|
30665 | render = (function(_this) {
|
30666 | return function(element, obj) {
|
30667 | var attr, child, entry, index, key, value;
|
30668 | if (typeof obj !== 'object') {
|
30669 | if (_this.options.cdata && requiresCDATA(obj)) {
|
30670 | element.raw(wrapCDATA(obj));
|
30671 | } else {
|
30672 | element.txt(obj);
|
30673 | }
|
30674 | } else if (Array.isArray(obj)) {
|
30675 | for (index in obj) {
|
30676 | if (!hasProp.call(obj, index)) continue;
|
30677 | child = obj[index];
|
30678 | for (key in child) {
|
30679 | entry = child[key];
|
30680 | element = render(element.ele(key), entry).up();
|
30681 | }
|
30682 | }
|
30683 | } else {
|
30684 | for (key in obj) {
|
30685 | if (!hasProp.call(obj, key)) continue;
|
30686 | child = obj[key];
|
30687 | if (key === attrkey) {
|
30688 | if (typeof child === "object") {
|
30689 | for (attr in child) {
|
30690 | value = child[attr];
|
30691 | element = element.att(attr, value);
|
30692 | }
|
30693 | }
|
30694 | } else if (key === charkey) {
|
30695 | if (_this.options.cdata && requiresCDATA(child)) {
|
30696 | element = element.raw(wrapCDATA(child));
|
30697 | } else {
|
30698 | element = element.txt(child);
|
30699 | }
|
30700 | } else if (Array.isArray(child)) {
|
30701 | for (index in child) {
|
30702 | if (!hasProp.call(child, index)) continue;
|
30703 | entry = child[index];
|
30704 | if (typeof entry === 'string') {
|
30705 | if (_this.options.cdata && requiresCDATA(entry)) {
|
30706 | element = element.ele(key).raw(wrapCDATA(entry)).up();
|
30707 | } else {
|
30708 | element = element.ele(key, entry).up();
|
30709 | }
|
30710 | } else {
|
30711 | element = render(element.ele(key), entry).up();
|
30712 | }
|
30713 | }
|
30714 | } else if (typeof child === "object") {
|
30715 | element = render(element.ele(key), child).up();
|
30716 | } else {
|
30717 | if (typeof child === 'string' && _this.options.cdata && requiresCDATA(child)) {
|
30718 | element = element.ele(key).raw(wrapCDATA(child)).up();
|
30719 | } else {
|
30720 | if (child == null) {
|
30721 | child = '';
|
30722 | }
|
30723 | element = element.ele(key, child.toString()).up();
|
30724 | }
|
30725 | }
|
30726 | }
|
30727 | }
|
30728 | return element;
|
30729 | };
|
30730 | })(this);
|
30731 | rootElement = builder.create(rootName, this.options.xmldec, this.options.doctype, {
|
30732 | headless: this.options.headless,
|
30733 | allowSurrogateChars: this.options.allowSurrogateChars
|
30734 | });
|
30735 | return render(rootElement, rootObj).end(this.options.renderOpts);
|
30736 | };
|
30737 |
|
30738 | return Builder;
|
30739 |
|
30740 | })();
|
30741 |
|
30742 | }).call(this);
|
30743 |
|
30744 | },{"./defaults":349,"xmlbuilder":385}],349:[function(require,module,exports){
|
30745 |
|
30746 | (function() {
|
30747 | exports.defaults = {
|
30748 | "0.1": {
|
30749 | explicitCharkey: false,
|
30750 | trim: true,
|
30751 | normalize: true,
|
30752 | normalizeTags: false,
|
30753 | attrkey: "@",
|
30754 | charkey: "#",
|
30755 | explicitArray: false,
|
30756 | ignoreAttrs: false,
|
30757 | mergeAttrs: false,
|
30758 | explicitRoot: false,
|
30759 | validator: null,
|
30760 | xmlns: false,
|
30761 | explicitChildren: false,
|
30762 | childkey: '@@',
|
30763 | charsAsChildren: false,
|
30764 | includeWhiteChars: false,
|
30765 | async: false,
|
30766 | strict: true,
|
30767 | attrNameProcessors: null,
|
30768 | attrValueProcessors: null,
|
30769 | tagNameProcessors: null,
|
30770 | valueProcessors: null,
|
30771 | emptyTag: ''
|
30772 | },
|
30773 | "0.2": {
|
30774 | explicitCharkey: false,
|
30775 | trim: false,
|
30776 | normalize: false,
|
30777 | normalizeTags: false,
|
30778 | attrkey: "$",
|
30779 | charkey: "_",
|
30780 | explicitArray: true,
|
30781 | ignoreAttrs: false,
|
30782 | mergeAttrs: false,
|
30783 | explicitRoot: true,
|
30784 | validator: null,
|
30785 | xmlns: false,
|
30786 | explicitChildren: false,
|
30787 | preserveChildrenOrder: false,
|
30788 | childkey: '$$',
|
30789 | charsAsChildren: false,
|
30790 | includeWhiteChars: false,
|
30791 | async: false,
|
30792 | strict: true,
|
30793 | attrNameProcessors: null,
|
30794 | attrValueProcessors: null,
|
30795 | tagNameProcessors: null,
|
30796 | valueProcessors: null,
|
30797 | rootName: 'root',
|
30798 | xmldec: {
|
30799 | 'version': '1.0',
|
30800 | 'encoding': 'UTF-8',
|
30801 | 'standalone': true
|
30802 | },
|
30803 | doctype: null,
|
30804 | renderOpts: {
|
30805 | 'pretty': true,
|
30806 | 'indent': ' ',
|
30807 | 'newline': '\n'
|
30808 | },
|
30809 | headless: false,
|
30810 | chunkSize: 10000,
|
30811 | emptyTag: '',
|
30812 | cdata: false
|
30813 | }
|
30814 | };
|
30815 |
|
30816 | }).call(this);
|
30817 |
|
30818 | },{}],350:[function(require,module,exports){
|
30819 |
|
30820 | (function() {
|
30821 | "use strict";
|
30822 | var bom, defaults, events, isEmpty, processItem, processors, sax, setImmediate,
|
30823 | bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
|
30824 | extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
|
30825 | hasProp = {}.hasOwnProperty;
|
30826 |
|
30827 | sax = require('sax');
|
30828 |
|
30829 | events = require('events');
|
30830 |
|
30831 | bom = require('./bom');
|
30832 |
|
30833 | processors = require('./processors');
|
30834 |
|
30835 | setImmediate = require('timers').setImmediate;
|
30836 |
|
30837 | defaults = require('./defaults').defaults;
|
30838 |
|
30839 | isEmpty = function(thing) {
|
30840 | return typeof thing === "object" && (thing != null) && Object.keys(thing).length === 0;
|
30841 | };
|
30842 |
|
30843 | processItem = function(processors, item, key) {
|
30844 | var i, len, process;
|
30845 | for (i = 0, len = processors.length; i < len; i++) {
|
30846 | process = processors[i];
|
30847 | item = process(item, key);
|
30848 | }
|
30849 | return item;
|
30850 | };
|
30851 |
|
30852 | exports.Parser = (function(superClass) {
|
30853 | extend(Parser, superClass);
|
30854 |
|
30855 | function Parser(opts) {
|
30856 | this.parseStringPromise = bind(this.parseStringPromise, this);
|
30857 | this.parseString = bind(this.parseString, this);
|
30858 | this.reset = bind(this.reset, this);
|
30859 | this.assignOrPush = bind(this.assignOrPush, this);
|
30860 | this.processAsync = bind(this.processAsync, this);
|
30861 | var key, ref, value;
|
30862 | if (!(this instanceof exports.Parser)) {
|
30863 | return new exports.Parser(opts);
|
30864 | }
|
30865 | this.options = {};
|
30866 | ref = defaults["0.2"];
|
30867 | for (key in ref) {
|
30868 | if (!hasProp.call(ref, key)) continue;
|
30869 | value = ref[key];
|
30870 | this.options[key] = value;
|
30871 | }
|
30872 | for (key in opts) {
|
30873 | if (!hasProp.call(opts, key)) continue;
|
30874 | value = opts[key];
|
30875 | this.options[key] = value;
|
30876 | }
|
30877 | if (this.options.xmlns) {
|
30878 | this.options.xmlnskey = this.options.attrkey + "ns";
|
30879 | }
|
30880 | if (this.options.normalizeTags) {
|
30881 | if (!this.options.tagNameProcessors) {
|
30882 | this.options.tagNameProcessors = [];
|
30883 | }
|
30884 | this.options.tagNameProcessors.unshift(processors.normalize);
|
30885 | }
|
30886 | this.reset();
|
30887 | }
|
30888 |
|
30889 | Parser.prototype.processAsync = function() {
|
30890 | var chunk, err;
|
30891 | try {
|
30892 | if (this.remaining.length <= this.options.chunkSize) {
|
30893 | chunk = this.remaining;
|
30894 | this.remaining = '';
|
30895 | this.saxParser = this.saxParser.write(chunk);
|
30896 | return this.saxParser.close();
|
30897 | } else {
|
30898 | chunk = this.remaining.substr(0, this.options.chunkSize);
|
30899 | this.remaining = this.remaining.substr(this.options.chunkSize, this.remaining.length);
|
30900 | this.saxParser = this.saxParser.write(chunk);
|
30901 | return setImmediate(this.processAsync);
|
30902 | }
|
30903 | } catch (error1) {
|
30904 | err = error1;
|
30905 | if (!this.saxParser.errThrown) {
|
30906 | this.saxParser.errThrown = true;
|
30907 | return this.emit(err);
|
30908 | }
|
30909 | }
|
30910 | };
|
30911 |
|
30912 | Parser.prototype.assignOrPush = function(obj, key, newValue) {
|
30913 | if (!(key in obj)) {
|
30914 | if (!this.options.explicitArray) {
|
30915 | return obj[key] = newValue;
|
30916 | } else {
|
30917 | return obj[key] = [newValue];
|
30918 | }
|
30919 | } else {
|
30920 | if (!(obj[key] instanceof Array)) {
|
30921 | obj[key] = [obj[key]];
|
30922 | }
|
30923 | return obj[key].push(newValue);
|
30924 | }
|
30925 | };
|
30926 |
|
30927 | Parser.prototype.reset = function() {
|
30928 | var attrkey, charkey, ontext, stack;
|
30929 | this.removeAllListeners();
|
30930 | this.saxParser = sax.parser(this.options.strict, {
|
30931 | trim: false,
|
30932 | normalize: false,
|
30933 | xmlns: this.options.xmlns
|
30934 | });
|
30935 | this.saxParser.errThrown = false;
|
30936 | this.saxParser.onerror = (function(_this) {
|
30937 | return function(error) {
|
30938 | _this.saxParser.resume();
|
30939 | if (!_this.saxParser.errThrown) {
|
30940 | _this.saxParser.errThrown = true;
|
30941 | return _this.emit("error", error);
|
30942 | }
|
30943 | };
|
30944 | })(this);
|
30945 | this.saxParser.onend = (function(_this) {
|
30946 | return function() {
|
30947 | if (!_this.saxParser.ended) {
|
30948 | _this.saxParser.ended = true;
|
30949 | return _this.emit("end", _this.resultObject);
|
30950 | }
|
30951 | };
|
30952 | })(this);
|
30953 | this.saxParser.ended = false;
|
30954 | this.EXPLICIT_CHARKEY = this.options.explicitCharkey;
|
30955 | this.resultObject = null;
|
30956 | stack = [];
|
30957 | attrkey = this.options.attrkey;
|
30958 | charkey = this.options.charkey;
|
30959 | this.saxParser.onopentag = (function(_this) {
|
30960 | return function(node) {
|
30961 | var key, newValue, obj, processedKey, ref;
|
30962 | obj = {};
|
30963 | obj[charkey] = "";
|
30964 | if (!_this.options.ignoreAttrs) {
|
30965 | ref = node.attributes;
|
30966 | for (key in ref) {
|
30967 | if (!hasProp.call(ref, key)) continue;
|
30968 | if (!(attrkey in obj) && !_this.options.mergeAttrs) {
|
30969 | obj[attrkey] = {};
|
30970 | }
|
30971 | newValue = _this.options.attrValueProcessors ? processItem(_this.options.attrValueProcessors, node.attributes[key], key) : node.attributes[key];
|
30972 | processedKey = _this.options.attrNameProcessors ? processItem(_this.options.attrNameProcessors, key) : key;
|
30973 | if (_this.options.mergeAttrs) {
|
30974 | _this.assignOrPush(obj, processedKey, newValue);
|
30975 | } else {
|
30976 | obj[attrkey][processedKey] = newValue;
|
30977 | }
|
30978 | }
|
30979 | }
|
30980 | obj["#name"] = _this.options.tagNameProcessors ? processItem(_this.options.tagNameProcessors, node.name) : node.name;
|
30981 | if (_this.options.xmlns) {
|
30982 | obj[_this.options.xmlnskey] = {
|
30983 | uri: node.uri,
|
30984 | local: node.local
|
30985 | };
|
30986 | }
|
30987 | return stack.push(obj);
|
30988 | };
|
30989 | })(this);
|
30990 | this.saxParser.onclosetag = (function(_this) {
|
30991 | return function() {
|
30992 | var cdata, emptyStr, key, node, nodeName, obj, objClone, old, s, xpath;
|
30993 | obj = stack.pop();
|
30994 | nodeName = obj["#name"];
|
30995 | if (!_this.options.explicitChildren || !_this.options.preserveChildrenOrder) {
|
30996 | delete obj["#name"];
|
30997 | }
|
30998 | if (obj.cdata === true) {
|
30999 | cdata = obj.cdata;
|
31000 | delete obj.cdata;
|
31001 | }
|
31002 | s = stack[stack.length - 1];
|
31003 | if (obj[charkey].match(/^\s*$/) && !cdata) {
|
31004 | emptyStr = obj[charkey];
|
31005 | delete obj[charkey];
|
31006 | } else {
|
31007 | if (_this.options.trim) {
|
31008 | obj[charkey] = obj[charkey].trim();
|
31009 | }
|
31010 | if (_this.options.normalize) {
|
31011 | obj[charkey] = obj[charkey].replace(/\s{2,}/g, " ").trim();
|
31012 | }
|
31013 | obj[charkey] = _this.options.valueProcessors ? processItem(_this.options.valueProcessors, obj[charkey], nodeName) : obj[charkey];
|
31014 | if (Object.keys(obj).length === 1 && charkey in obj && !_this.EXPLICIT_CHARKEY) {
|
31015 | obj = obj[charkey];
|
31016 | }
|
31017 | }
|
31018 | if (isEmpty(obj)) {
|
31019 | obj = _this.options.emptyTag !== '' ? _this.options.emptyTag : emptyStr;
|
31020 | }
|
31021 | if (_this.options.validator != null) {
|
31022 | xpath = "/" + ((function() {
|
31023 | var i, len, results;
|
31024 | results = [];
|
31025 | for (i = 0, len = stack.length; i < len; i++) {
|
31026 | node = stack[i];
|
31027 | results.push(node["#name"]);
|
31028 | }
|
31029 | return results;
|
31030 | })()).concat(nodeName).join("/");
|
31031 | (function() {
|
31032 | var err;
|
31033 | try {
|
31034 | return obj = _this.options.validator(xpath, s && s[nodeName], obj);
|
31035 | } catch (error1) {
|
31036 | err = error1;
|
31037 | return _this.emit("error", err);
|
31038 | }
|
31039 | })();
|
31040 | }
|
31041 | if (_this.options.explicitChildren && !_this.options.mergeAttrs && typeof obj === 'object') {
|
31042 | if (!_this.options.preserveChildrenOrder) {
|
31043 | node = {};
|
31044 | if (_this.options.attrkey in obj) {
|
31045 | node[_this.options.attrkey] = obj[_this.options.attrkey];
|
31046 | delete obj[_this.options.attrkey];
|
31047 | }
|
31048 | if (!_this.options.charsAsChildren && _this.options.charkey in obj) {
|
31049 | node[_this.options.charkey] = obj[_this.options.charkey];
|
31050 | delete obj[_this.options.charkey];
|
31051 | }
|
31052 | if (Object.getOwnPropertyNames(obj).length > 0) {
|
31053 | node[_this.options.childkey] = obj;
|
31054 | }
|
31055 | obj = node;
|
31056 | } else if (s) {
|
31057 | s[_this.options.childkey] = s[_this.options.childkey] || [];
|
31058 | objClone = {};
|
31059 | for (key in obj) {
|
31060 | if (!hasProp.call(obj, key)) continue;
|
31061 | objClone[key] = obj[key];
|
31062 | }
|
31063 | s[_this.options.childkey].push(objClone);
|
31064 | delete obj["#name"];
|
31065 | if (Object.keys(obj).length === 1 && charkey in obj && !_this.EXPLICIT_CHARKEY) {
|
31066 | obj = obj[charkey];
|
31067 | }
|
31068 | }
|
31069 | }
|
31070 | if (stack.length > 0) {
|
31071 | return _this.assignOrPush(s, nodeName, obj);
|
31072 | } else {
|
31073 | if (_this.options.explicitRoot) {
|
31074 | old = obj;
|
31075 | obj = {};
|
31076 | obj[nodeName] = old;
|
31077 | }
|
31078 | _this.resultObject = obj;
|
31079 | _this.saxParser.ended = true;
|
31080 | return _this.emit("end", _this.resultObject);
|
31081 | }
|
31082 | };
|
31083 | })(this);
|
31084 | ontext = (function(_this) {
|
31085 | return function(text) {
|
31086 | var charChild, s;
|
31087 | s = stack[stack.length - 1];
|
31088 | if (s) {
|
31089 | s[charkey] += text;
|
31090 | if (_this.options.explicitChildren && _this.options.preserveChildrenOrder && _this.options.charsAsChildren && (_this.options.includeWhiteChars || text.replace(/\\n/g, '').trim() !== '')) {
|
31091 | s[_this.options.childkey] = s[_this.options.childkey] || [];
|
31092 | charChild = {
|
31093 | '#name': '__text__'
|
31094 | };
|
31095 | charChild[charkey] = text;
|
31096 | if (_this.options.normalize) {
|
31097 | charChild[charkey] = charChild[charkey].replace(/\s{2,}/g, " ").trim();
|
31098 | }
|
31099 | s[_this.options.childkey].push(charChild);
|
31100 | }
|
31101 | return s;
|
31102 | }
|
31103 | };
|
31104 | })(this);
|
31105 | this.saxParser.ontext = ontext;
|
31106 | return this.saxParser.oncdata = (function(_this) {
|
31107 | return function(text) {
|
31108 | var s;
|
31109 | s = ontext(text);
|
31110 | if (s) {
|
31111 | return s.cdata = true;
|
31112 | }
|
31113 | };
|
31114 | })(this);
|
31115 | };
|
31116 |
|
31117 | Parser.prototype.parseString = function(str, cb) {
|
31118 | var err;
|
31119 | if ((cb != null) && typeof cb === "function") {
|
31120 | this.on("end", function(result) {
|
31121 | this.reset();
|
31122 | return cb(null, result);
|
31123 | });
|
31124 | this.on("error", function(err) {
|
31125 | this.reset();
|
31126 | return cb(err);
|
31127 | });
|
31128 | }
|
31129 | try {
|
31130 | str = str.toString();
|
31131 | if (str.trim() === '') {
|
31132 | this.emit("end", null);
|
31133 | return true;
|
31134 | }
|
31135 | str = bom.stripBOM(str);
|
31136 | if (this.options.async) {
|
31137 | this.remaining = str;
|
31138 | setImmediate(this.processAsync);
|
31139 | return this.saxParser;
|
31140 | }
|
31141 | return this.saxParser.write(str).close();
|
31142 | } catch (error1) {
|
31143 | err = error1;
|
31144 | if (!(this.saxParser.errThrown || this.saxParser.ended)) {
|
31145 | this.emit('error', err);
|
31146 | return this.saxParser.errThrown = true;
|
31147 | } else if (this.saxParser.ended) {
|
31148 | throw err;
|
31149 | }
|
31150 | }
|
31151 | };
|
31152 |
|
31153 | Parser.prototype.parseStringPromise = function(str) {
|
31154 | return new Promise((function(_this) {
|
31155 | return function(resolve, reject) {
|
31156 | return _this.parseString(str, function(err, value) {
|
31157 | if (err) {
|
31158 | return reject(err);
|
31159 | } else {
|
31160 | return resolve(value);
|
31161 | }
|
31162 | });
|
31163 | };
|
31164 | })(this));
|
31165 | };
|
31166 |
|
31167 | return Parser;
|
31168 |
|
31169 | })(events);
|
31170 |
|
31171 | exports.parseString = function(str, a, b) {
|
31172 | var cb, options, parser;
|
31173 | if (b != null) {
|
31174 | if (typeof b === 'function') {
|
31175 | cb = b;
|
31176 | }
|
31177 | if (typeof a === 'object') {
|
31178 | options = a;
|
31179 | }
|
31180 | } else {
|
31181 | if (typeof a === 'function') {
|
31182 | cb = a;
|
31183 | }
|
31184 | options = {};
|
31185 | }
|
31186 | parser = new exports.Parser(options);
|
31187 | return parser.parseString(str, cb);
|
31188 | };
|
31189 |
|
31190 | exports.parseStringPromise = function(str, a) {
|
31191 | var options, parser;
|
31192 | if (typeof a === 'object') {
|
31193 | options = a;
|
31194 | }
|
31195 | parser = new exports.Parser(options);
|
31196 | return parser.parseStringPromise(str);
|
31197 | };
|
31198 |
|
31199 | }).call(this);
|
31200 |
|
31201 | },{"./bom":347,"./defaults":349,"./processors":351,"events":297,"sax":339,"timers":342}],351:[function(require,module,exports){
|
31202 |
|
31203 | (function() {
|
31204 | "use strict";
|
31205 | var prefixMatch;
|
31206 |
|
31207 | prefixMatch = new RegExp(/(?!xmlns)^.*:/);
|
31208 |
|
31209 | exports.normalize = function(str) {
|
31210 | return str.toLowerCase();
|
31211 | };
|
31212 |
|
31213 | exports.firstCharLowerCase = function(str) {
|
31214 | return str.charAt(0).toLowerCase() + str.slice(1);
|
31215 | };
|
31216 |
|
31217 | exports.stripPrefix = function(str) {
|
31218 | return str.replace(prefixMatch, '');
|
31219 | };
|
31220 |
|
31221 | exports.parseNumbers = function(str) {
|
31222 | if (!isNaN(str)) {
|
31223 | str = str % 1 === 0 ? parseInt(str, 10) : parseFloat(str);
|
31224 | }
|
31225 | return str;
|
31226 | };
|
31227 |
|
31228 | exports.parseBooleans = function(str) {
|
31229 | if (/^(?:true|false)$/i.test(str)) {
|
31230 | str = str.toLowerCase() === 'true';
|
31231 | }
|
31232 | return str;
|
31233 | };
|
31234 |
|
31235 | }).call(this);
|
31236 |
|
31237 | },{}],352:[function(require,module,exports){
|
31238 |
|
31239 | (function() {
|
31240 | "use strict";
|
31241 | var builder, defaults, parser, processors,
|
31242 | extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
|
31243 | hasProp = {}.hasOwnProperty;
|
31244 |
|
31245 | defaults = require('./defaults');
|
31246 |
|
31247 | builder = require('./builder');
|
31248 |
|
31249 | parser = require('./parser');
|
31250 |
|
31251 | processors = require('./processors');
|
31252 |
|
31253 | exports.defaults = defaults.defaults;
|
31254 |
|
31255 | exports.processors = processors;
|
31256 |
|
31257 | exports.ValidationError = (function(superClass) {
|
31258 | extend(ValidationError, superClass);
|
31259 |
|
31260 | function ValidationError(message) {
|
31261 | this.message = message;
|
31262 | }
|
31263 |
|
31264 | return ValidationError;
|
31265 |
|
31266 | })(Error);
|
31267 |
|
31268 | exports.Builder = builder.Builder;
|
31269 |
|
31270 | exports.Parser = parser.Parser;
|
31271 |
|
31272 | exports.parseString = parser.parseString;
|
31273 |
|
31274 | exports.parseStringPromise = parser.parseStringPromise;
|
31275 |
|
31276 | }).call(this);
|
31277 |
|
31278 | },{"./builder":348,"./defaults":349,"./parser":350,"./processors":351}],353:[function(require,module,exports){
|
31279 |
|
31280 | (function() {
|
31281 | module.exports = {
|
31282 | Disconnected: 1,
|
31283 | Preceding: 2,
|
31284 | Following: 4,
|
31285 | Contains: 8,
|
31286 | ContainedBy: 16,
|
31287 | ImplementationSpecific: 32
|
31288 | };
|
31289 |
|
31290 | }).call(this);
|
31291 |
|
31292 | },{}],354:[function(require,module,exports){
|
31293 |
|
31294 | (function() {
|
31295 | module.exports = {
|
31296 | Element: 1,
|
31297 | Attribute: 2,
|
31298 | Text: 3,
|
31299 | CData: 4,
|
31300 | EntityReference: 5,
|
31301 | EntityDeclaration: 6,
|
31302 | ProcessingInstruction: 7,
|
31303 | Comment: 8,
|
31304 | Document: 9,
|
31305 | DocType: 10,
|
31306 | DocumentFragment: 11,
|
31307 | NotationDeclaration: 12,
|
31308 | Declaration: 201,
|
31309 | Raw: 202,
|
31310 | AttributeDeclaration: 203,
|
31311 | ElementDeclaration: 204,
|
31312 | Dummy: 205
|
31313 | };
|
31314 |
|
31315 | }).call(this);
|
31316 |
|
31317 | },{}],355:[function(require,module,exports){
|
31318 |
|
31319 | (function() {
|
31320 | var assign, getValue, isArray, isEmpty, isFunction, isObject, isPlainObject,
|
31321 | slice = [].slice,
|
31322 | hasProp = {}.hasOwnProperty;
|
31323 |
|
31324 | assign = function() {
|
31325 | var i, key, len, source, sources, target;
|
31326 | target = arguments[0], sources = 2 <= arguments.length ? slice.call(arguments, 1) : [];
|
31327 | if (isFunction(Object.assign)) {
|
31328 | Object.assign.apply(null, arguments);
|
31329 | } else {
|
31330 | for (i = 0, len = sources.length; i < len; i++) {
|
31331 | source = sources[i];
|
31332 | if (source != null) {
|
31333 | for (key in source) {
|
31334 | if (!hasProp.call(source, key)) continue;
|
31335 | target[key] = source[key];
|
31336 | }
|
31337 | }
|
31338 | }
|
31339 | }
|
31340 | return target;
|
31341 | };
|
31342 |
|
31343 | isFunction = function(val) {
|
31344 | return !!val && Object.prototype.toString.call(val) === '[object Function]';
|
31345 | };
|
31346 |
|
31347 | isObject = function(val) {
|
31348 | var ref;
|
31349 | return !!val && ((ref = typeof val) === 'function' || ref === 'object');
|
31350 | };
|
31351 |
|
31352 | isArray = function(val) {
|
31353 | if (isFunction(Array.isArray)) {
|
31354 | return Array.isArray(val);
|
31355 | } else {
|
31356 | return Object.prototype.toString.call(val) === '[object Array]';
|
31357 | }
|
31358 | };
|
31359 |
|
31360 | isEmpty = function(val) {
|
31361 | var key;
|
31362 | if (isArray(val)) {
|
31363 | return !val.length;
|
31364 | } else {
|
31365 | for (key in val) {
|
31366 | if (!hasProp.call(val, key)) continue;
|
31367 | return false;
|
31368 | }
|
31369 | return true;
|
31370 | }
|
31371 | };
|
31372 |
|
31373 | isPlainObject = function(val) {
|
31374 | var ctor, proto;
|
31375 | return isObject(val) && (proto = Object.getPrototypeOf(val)) && (ctor = proto.constructor) && (typeof ctor === 'function') && (ctor instanceof ctor) && (Function.prototype.toString.call(ctor) === Function.prototype.toString.call(Object));
|
31376 | };
|
31377 |
|
31378 | getValue = function(obj) {
|
31379 | if (isFunction(obj.valueOf)) {
|
31380 | return obj.valueOf();
|
31381 | } else {
|
31382 | return obj;
|
31383 | }
|
31384 | };
|
31385 |
|
31386 | module.exports.assign = assign;
|
31387 |
|
31388 | module.exports.isFunction = isFunction;
|
31389 |
|
31390 | module.exports.isObject = isObject;
|
31391 |
|
31392 | module.exports.isArray = isArray;
|
31393 |
|
31394 | module.exports.isEmpty = isEmpty;
|
31395 |
|
31396 | module.exports.isPlainObject = isPlainObject;
|
31397 |
|
31398 | module.exports.getValue = getValue;
|
31399 |
|
31400 | }).call(this);
|
31401 |
|
31402 | },{}],356:[function(require,module,exports){
|
31403 |
|
31404 | (function() {
|
31405 | module.exports = {
|
31406 | None: 0,
|
31407 | OpenTag: 1,
|
31408 | InsideTag: 2,
|
31409 | CloseTag: 3
|
31410 | };
|
31411 |
|
31412 | }).call(this);
|
31413 |
|
31414 | },{}],357:[function(require,module,exports){
|
31415 |
|
31416 | (function() {
|
31417 | var NodeType, XMLAttribute, XMLNode;
|
31418 |
|
31419 | NodeType = require('./NodeType');
|
31420 |
|
31421 | XMLNode = require('./XMLNode');
|
31422 |
|
31423 | module.exports = XMLAttribute = (function() {
|
31424 | function XMLAttribute(parent, name, value) {
|
31425 | this.parent = parent;
|
31426 | if (this.parent) {
|
31427 | this.options = this.parent.options;
|
31428 | this.stringify = this.parent.stringify;
|
31429 | }
|
31430 | if (name == null) {
|
31431 | throw new Error("Missing attribute name. " + this.debugInfo(name));
|
31432 | }
|
31433 | this.name = this.stringify.name(name);
|
31434 | this.value = this.stringify.attValue(value);
|
31435 | this.type = NodeType.Attribute;
|
31436 | this.isId = false;
|
31437 | this.schemaTypeInfo = null;
|
31438 | }
|
31439 |
|
31440 | Object.defineProperty(XMLAttribute.prototype, 'nodeType', {
|
31441 | get: function() {
|
31442 | return this.type;
|
31443 | }
|
31444 | });
|
31445 |
|
31446 | Object.defineProperty(XMLAttribute.prototype, 'ownerElement', {
|
31447 | get: function() {
|
31448 | return this.parent;
|
31449 | }
|
31450 | });
|
31451 |
|
31452 | Object.defineProperty(XMLAttribute.prototype, 'textContent', {
|
31453 | get: function() {
|
31454 | return this.value;
|
31455 | },
|
31456 | set: function(value) {
|
31457 | return this.value = value || '';
|
31458 | }
|
31459 | });
|
31460 |
|
31461 | Object.defineProperty(XMLAttribute.prototype, 'namespaceURI', {
|
31462 | get: function() {
|
31463 | return '';
|
31464 | }
|
31465 | });
|
31466 |
|
31467 | Object.defineProperty(XMLAttribute.prototype, 'prefix', {
|
31468 | get: function() {
|
31469 | return '';
|
31470 | }
|
31471 | });
|
31472 |
|
31473 | Object.defineProperty(XMLAttribute.prototype, 'localName', {
|
31474 | get: function() {
|
31475 | return this.name;
|
31476 | }
|
31477 | });
|
31478 |
|
31479 | Object.defineProperty(XMLAttribute.prototype, 'specified', {
|
31480 | get: function() {
|
31481 | return true;
|
31482 | }
|
31483 | });
|
31484 |
|
31485 | XMLAttribute.prototype.clone = function() {
|
31486 | return Object.create(this);
|
31487 | };
|
31488 |
|
31489 | XMLAttribute.prototype.toString = function(options) {
|
31490 | return this.options.writer.attribute(this, this.options.writer.filterOptions(options));
|
31491 | };
|
31492 |
|
31493 | XMLAttribute.prototype.debugInfo = function(name) {
|
31494 | name = name || this.name;
|
31495 | if (name == null) {
|
31496 | return "parent: <" + this.parent.name + ">";
|
31497 | } else {
|
31498 | return "attribute: {" + name + "}, parent: <" + this.parent.name + ">";
|
31499 | }
|
31500 | };
|
31501 |
|
31502 | XMLAttribute.prototype.isEqualNode = function(node) {
|
31503 | if (node.namespaceURI !== this.namespaceURI) {
|
31504 | return false;
|
31505 | }
|
31506 | if (node.prefix !== this.prefix) {
|
31507 | return false;
|
31508 | }
|
31509 | if (node.localName !== this.localName) {
|
31510 | return false;
|
31511 | }
|
31512 | if (node.value !== this.value) {
|
31513 | return false;
|
31514 | }
|
31515 | return true;
|
31516 | };
|
31517 |
|
31518 | return XMLAttribute;
|
31519 |
|
31520 | })();
|
31521 |
|
31522 | }).call(this);
|
31523 |
|
31524 | },{"./NodeType":354,"./XMLNode":376}],358:[function(require,module,exports){
|
31525 |
|
31526 | (function() {
|
31527 | var NodeType, XMLCData, XMLCharacterData,
|
31528 | extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
|
31529 | hasProp = {}.hasOwnProperty;
|
31530 |
|
31531 | NodeType = require('./NodeType');
|
31532 |
|
31533 | XMLCharacterData = require('./XMLCharacterData');
|
31534 |
|
31535 | module.exports = XMLCData = (function(superClass) {
|
31536 | extend(XMLCData, superClass);
|
31537 |
|
31538 | function XMLCData(parent, text) {
|
31539 | XMLCData.__super__.constructor.call(this, parent);
|
31540 | if (text == null) {
|
31541 | throw new Error("Missing CDATA text. " + this.debugInfo());
|
31542 | }
|
31543 | this.name = "#cdata-section";
|
31544 | this.type = NodeType.CData;
|
31545 | this.value = this.stringify.cdata(text);
|
31546 | }
|
31547 |
|
31548 | XMLCData.prototype.clone = function() {
|
31549 | return Object.create(this);
|
31550 | };
|
31551 |
|
31552 | XMLCData.prototype.toString = function(options) {
|
31553 | return this.options.writer.cdata(this, this.options.writer.filterOptions(options));
|
31554 | };
|
31555 |
|
31556 | return XMLCData;
|
31557 |
|
31558 | })(XMLCharacterData);
|
31559 |
|
31560 | }).call(this);
|
31561 |
|
31562 | },{"./NodeType":354,"./XMLCharacterData":359}],359:[function(require,module,exports){
|
31563 |
|
31564 | (function() {
|
31565 | var XMLCharacterData, XMLNode,
|
31566 | extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
|
31567 | hasProp = {}.hasOwnProperty;
|
31568 |
|
31569 | XMLNode = require('./XMLNode');
|
31570 |
|
31571 | module.exports = XMLCharacterData = (function(superClass) {
|
31572 | extend(XMLCharacterData, superClass);
|
31573 |
|
31574 | function XMLCharacterData(parent) {
|
31575 | XMLCharacterData.__super__.constructor.call(this, parent);
|
31576 | this.value = '';
|
31577 | }
|
31578 |
|
31579 | Object.defineProperty(XMLCharacterData.prototype, 'data', {
|
31580 | get: function() {
|
31581 | return this.value;
|
31582 | },
|
31583 | set: function(value) {
|
31584 | return this.value = value || '';
|
31585 | }
|
31586 | });
|
31587 |
|
31588 | Object.defineProperty(XMLCharacterData.prototype, 'length', {
|
31589 | get: function() {
|
31590 | return this.value.length;
|
31591 | }
|
31592 | });
|
31593 |
|
31594 | Object.defineProperty(XMLCharacterData.prototype, 'textContent', {
|
31595 | get: function() {
|
31596 | return this.value;
|
31597 | },
|
31598 | set: function(value) {
|
31599 | return this.value = value || '';
|
31600 | }
|
31601 | });
|
31602 |
|
31603 | XMLCharacterData.prototype.clone = function() {
|
31604 | return Object.create(this);
|
31605 | };
|
31606 |
|
31607 | XMLCharacterData.prototype.substringData = function(offset, count) {
|
31608 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
31609 | };
|
31610 |
|
31611 | XMLCharacterData.prototype.appendData = function(arg) {
|
31612 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
31613 | };
|
31614 |
|
31615 | XMLCharacterData.prototype.insertData = function(offset, arg) {
|
31616 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
31617 | };
|
31618 |
|
31619 | XMLCharacterData.prototype.deleteData = function(offset, count) {
|
31620 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
31621 | };
|
31622 |
|
31623 | XMLCharacterData.prototype.replaceData = function(offset, count, arg) {
|
31624 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
31625 | };
|
31626 |
|
31627 | XMLCharacterData.prototype.isEqualNode = function(node) {
|
31628 | if (!XMLCharacterData.__super__.isEqualNode.apply(this, arguments).isEqualNode(node)) {
|
31629 | return false;
|
31630 | }
|
31631 | if (node.data !== this.data) {
|
31632 | return false;
|
31633 | }
|
31634 | return true;
|
31635 | };
|
31636 |
|
31637 | return XMLCharacterData;
|
31638 |
|
31639 | })(XMLNode);
|
31640 |
|
31641 | }).call(this);
|
31642 |
|
31643 | },{"./XMLNode":376}],360:[function(require,module,exports){
|
31644 |
|
31645 | (function() {
|
31646 | var NodeType, XMLCharacterData, XMLComment,
|
31647 | extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
|
31648 | hasProp = {}.hasOwnProperty;
|
31649 |
|
31650 | NodeType = require('./NodeType');
|
31651 |
|
31652 | XMLCharacterData = require('./XMLCharacterData');
|
31653 |
|
31654 | module.exports = XMLComment = (function(superClass) {
|
31655 | extend(XMLComment, superClass);
|
31656 |
|
31657 | function XMLComment(parent, text) {
|
31658 | XMLComment.__super__.constructor.call(this, parent);
|
31659 | if (text == null) {
|
31660 | throw new Error("Missing comment text. " + this.debugInfo());
|
31661 | }
|
31662 | this.name = "#comment";
|
31663 | this.type = NodeType.Comment;
|
31664 | this.value = this.stringify.comment(text);
|
31665 | }
|
31666 |
|
31667 | XMLComment.prototype.clone = function() {
|
31668 | return Object.create(this);
|
31669 | };
|
31670 |
|
31671 | XMLComment.prototype.toString = function(options) {
|
31672 | return this.options.writer.comment(this, this.options.writer.filterOptions(options));
|
31673 | };
|
31674 |
|
31675 | return XMLComment;
|
31676 |
|
31677 | })(XMLCharacterData);
|
31678 |
|
31679 | }).call(this);
|
31680 |
|
31681 | },{"./NodeType":354,"./XMLCharacterData":359}],361:[function(require,module,exports){
|
31682 |
|
31683 | (function() {
|
31684 | var XMLDOMConfiguration, XMLDOMErrorHandler, XMLDOMStringList;
|
31685 |
|
31686 | XMLDOMErrorHandler = require('./XMLDOMErrorHandler');
|
31687 |
|
31688 | XMLDOMStringList = require('./XMLDOMStringList');
|
31689 |
|
31690 | module.exports = XMLDOMConfiguration = (function() {
|
31691 | function XMLDOMConfiguration() {
|
31692 | var clonedSelf;
|
31693 | this.defaultParams = {
|
31694 | "canonical-form": false,
|
31695 | "cdata-sections": false,
|
31696 | "comments": false,
|
31697 | "datatype-normalization": false,
|
31698 | "element-content-whitespace": true,
|
31699 | "entities": true,
|
31700 | "error-handler": new XMLDOMErrorHandler(),
|
31701 | "infoset": true,
|
31702 | "validate-if-schema": false,
|
31703 | "namespaces": true,
|
31704 | "namespace-declarations": true,
|
31705 | "normalize-characters": false,
|
31706 | "schema-location": '',
|
31707 | "schema-type": '',
|
31708 | "split-cdata-sections": true,
|
31709 | "validate": false,
|
31710 | "well-formed": true
|
31711 | };
|
31712 | this.params = clonedSelf = Object.create(this.defaultParams);
|
31713 | }
|
31714 |
|
31715 | Object.defineProperty(XMLDOMConfiguration.prototype, 'parameterNames', {
|
31716 | get: function() {
|
31717 | return new XMLDOMStringList(Object.keys(this.defaultParams));
|
31718 | }
|
31719 | });
|
31720 |
|
31721 | XMLDOMConfiguration.prototype.getParameter = function(name) {
|
31722 | if (this.params.hasOwnProperty(name)) {
|
31723 | return this.params[name];
|
31724 | } else {
|
31725 | return null;
|
31726 | }
|
31727 | };
|
31728 |
|
31729 | XMLDOMConfiguration.prototype.canSetParameter = function(name, value) {
|
31730 | return true;
|
31731 | };
|
31732 |
|
31733 | XMLDOMConfiguration.prototype.setParameter = function(name, value) {
|
31734 | if (value != null) {
|
31735 | return this.params[name] = value;
|
31736 | } else {
|
31737 | return delete this.params[name];
|
31738 | }
|
31739 | };
|
31740 |
|
31741 | return XMLDOMConfiguration;
|
31742 |
|
31743 | })();
|
31744 |
|
31745 | }).call(this);
|
31746 |
|
31747 | },{"./XMLDOMErrorHandler":362,"./XMLDOMStringList":364}],362:[function(require,module,exports){
|
31748 |
|
31749 | (function() {
|
31750 | var XMLDOMErrorHandler;
|
31751 |
|
31752 | module.exports = XMLDOMErrorHandler = (function() {
|
31753 | function XMLDOMErrorHandler() {}
|
31754 |
|
31755 | XMLDOMErrorHandler.prototype.handleError = function(error) {
|
31756 | throw new Error(error);
|
31757 | };
|
31758 |
|
31759 | return XMLDOMErrorHandler;
|
31760 |
|
31761 | })();
|
31762 |
|
31763 | }).call(this);
|
31764 |
|
31765 | },{}],363:[function(require,module,exports){
|
31766 |
|
31767 | (function() {
|
31768 | var XMLDOMImplementation;
|
31769 |
|
31770 | module.exports = XMLDOMImplementation = (function() {
|
31771 | function XMLDOMImplementation() {}
|
31772 |
|
31773 | XMLDOMImplementation.prototype.hasFeature = function(feature, version) {
|
31774 | return true;
|
31775 | };
|
31776 |
|
31777 | XMLDOMImplementation.prototype.createDocumentType = function(qualifiedName, publicId, systemId) {
|
31778 | throw new Error("This DOM method is not implemented.");
|
31779 | };
|
31780 |
|
31781 | XMLDOMImplementation.prototype.createDocument = function(namespaceURI, qualifiedName, doctype) {
|
31782 | throw new Error("This DOM method is not implemented.");
|
31783 | };
|
31784 |
|
31785 | XMLDOMImplementation.prototype.createHTMLDocument = function(title) {
|
31786 | throw new Error("This DOM method is not implemented.");
|
31787 | };
|
31788 |
|
31789 | XMLDOMImplementation.prototype.getFeature = function(feature, version) {
|
31790 | throw new Error("This DOM method is not implemented.");
|
31791 | };
|
31792 |
|
31793 | return XMLDOMImplementation;
|
31794 |
|
31795 | })();
|
31796 |
|
31797 | }).call(this);
|
31798 |
|
31799 | },{}],364:[function(require,module,exports){
|
31800 |
|
31801 | (function() {
|
31802 | var XMLDOMStringList;
|
31803 |
|
31804 | module.exports = XMLDOMStringList = (function() {
|
31805 | function XMLDOMStringList(arr) {
|
31806 | this.arr = arr || [];
|
31807 | }
|
31808 |
|
31809 | Object.defineProperty(XMLDOMStringList.prototype, 'length', {
|
31810 | get: function() {
|
31811 | return this.arr.length;
|
31812 | }
|
31813 | });
|
31814 |
|
31815 | XMLDOMStringList.prototype.item = function(index) {
|
31816 | return this.arr[index] || null;
|
31817 | };
|
31818 |
|
31819 | XMLDOMStringList.prototype.contains = function(str) {
|
31820 | return this.arr.indexOf(str) !== -1;
|
31821 | };
|
31822 |
|
31823 | return XMLDOMStringList;
|
31824 |
|
31825 | })();
|
31826 |
|
31827 | }).call(this);
|
31828 |
|
31829 | },{}],365:[function(require,module,exports){
|
31830 |
|
31831 | (function() {
|
31832 | var NodeType, XMLDTDAttList, XMLNode,
|
31833 | extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
|
31834 | hasProp = {}.hasOwnProperty;
|
31835 |
|
31836 | XMLNode = require('./XMLNode');
|
31837 |
|
31838 | NodeType = require('./NodeType');
|
31839 |
|
31840 | module.exports = XMLDTDAttList = (function(superClass) {
|
31841 | extend(XMLDTDAttList, superClass);
|
31842 |
|
31843 | function XMLDTDAttList(parent, elementName, attributeName, attributeType, defaultValueType, defaultValue) {
|
31844 | XMLDTDAttList.__super__.constructor.call(this, parent);
|
31845 | if (elementName == null) {
|
31846 | throw new Error("Missing DTD element name. " + this.debugInfo());
|
31847 | }
|
31848 | if (attributeName == null) {
|
31849 | throw new Error("Missing DTD attribute name. " + this.debugInfo(elementName));
|
31850 | }
|
31851 | if (!attributeType) {
|
31852 | throw new Error("Missing DTD attribute type. " + this.debugInfo(elementName));
|
31853 | }
|
31854 | if (!defaultValueType) {
|
31855 | throw new Error("Missing DTD attribute default. " + this.debugInfo(elementName));
|
31856 | }
|
31857 | if (defaultValueType.indexOf('#') !== 0) {
|
31858 | defaultValueType = '#' + defaultValueType;
|
31859 | }
|
31860 | if (!defaultValueType.match(/^(#REQUIRED|#IMPLIED|#FIXED|#DEFAULT)$/)) {
|
31861 | throw new Error("Invalid default value type; expected: #REQUIRED, #IMPLIED, #FIXED or #DEFAULT. " + this.debugInfo(elementName));
|
31862 | }
|
31863 | if (defaultValue && !defaultValueType.match(/^(#FIXED|#DEFAULT)$/)) {
|
31864 | throw new Error("Default value only applies to #FIXED or #DEFAULT. " + this.debugInfo(elementName));
|
31865 | }
|
31866 | this.elementName = this.stringify.name(elementName);
|
31867 | this.type = NodeType.AttributeDeclaration;
|
31868 | this.attributeName = this.stringify.name(attributeName);
|
31869 | this.attributeType = this.stringify.dtdAttType(attributeType);
|
31870 | if (defaultValue) {
|
31871 | this.defaultValue = this.stringify.dtdAttDefault(defaultValue);
|
31872 | }
|
31873 | this.defaultValueType = defaultValueType;
|
31874 | }
|
31875 |
|
31876 | XMLDTDAttList.prototype.toString = function(options) {
|
31877 | return this.options.writer.dtdAttList(this, this.options.writer.filterOptions(options));
|
31878 | };
|
31879 |
|
31880 | return XMLDTDAttList;
|
31881 |
|
31882 | })(XMLNode);
|
31883 |
|
31884 | }).call(this);
|
31885 |
|
31886 | },{"./NodeType":354,"./XMLNode":376}],366:[function(require,module,exports){
|
31887 |
|
31888 | (function() {
|
31889 | var NodeType, XMLDTDElement, XMLNode,
|
31890 | extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
|
31891 | hasProp = {}.hasOwnProperty;
|
31892 |
|
31893 | XMLNode = require('./XMLNode');
|
31894 |
|
31895 | NodeType = require('./NodeType');
|
31896 |
|
31897 | module.exports = XMLDTDElement = (function(superClass) {
|
31898 | extend(XMLDTDElement, superClass);
|
31899 |
|
31900 | function XMLDTDElement(parent, name, value) {
|
31901 | XMLDTDElement.__super__.constructor.call(this, parent);
|
31902 | if (name == null) {
|
31903 | throw new Error("Missing DTD element name. " + this.debugInfo());
|
31904 | }
|
31905 | if (!value) {
|
31906 | value = '(#PCDATA)';
|
31907 | }
|
31908 | if (Array.isArray(value)) {
|
31909 | value = '(' + value.join(',') + ')';
|
31910 | }
|
31911 | this.name = this.stringify.name(name);
|
31912 | this.type = NodeType.ElementDeclaration;
|
31913 | this.value = this.stringify.dtdElementValue(value);
|
31914 | }
|
31915 |
|
31916 | XMLDTDElement.prototype.toString = function(options) {
|
31917 | return this.options.writer.dtdElement(this, this.options.writer.filterOptions(options));
|
31918 | };
|
31919 |
|
31920 | return XMLDTDElement;
|
31921 |
|
31922 | })(XMLNode);
|
31923 |
|
31924 | }).call(this);
|
31925 |
|
31926 | },{"./NodeType":354,"./XMLNode":376}],367:[function(require,module,exports){
|
31927 |
|
31928 | (function() {
|
31929 | var NodeType, XMLDTDEntity, XMLNode, isObject,
|
31930 | extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
|
31931 | hasProp = {}.hasOwnProperty;
|
31932 |
|
31933 | isObject = require('./Utility').isObject;
|
31934 |
|
31935 | XMLNode = require('./XMLNode');
|
31936 |
|
31937 | NodeType = require('./NodeType');
|
31938 |
|
31939 | module.exports = XMLDTDEntity = (function(superClass) {
|
31940 | extend(XMLDTDEntity, superClass);
|
31941 |
|
31942 | function XMLDTDEntity(parent, pe, name, value) {
|
31943 | XMLDTDEntity.__super__.constructor.call(this, parent);
|
31944 | if (name == null) {
|
31945 | throw new Error("Missing DTD entity name. " + this.debugInfo(name));
|
31946 | }
|
31947 | if (value == null) {
|
31948 | throw new Error("Missing DTD entity value. " + this.debugInfo(name));
|
31949 | }
|
31950 | this.pe = !!pe;
|
31951 | this.name = this.stringify.name(name);
|
31952 | this.type = NodeType.EntityDeclaration;
|
31953 | if (!isObject(value)) {
|
31954 | this.value = this.stringify.dtdEntityValue(value);
|
31955 | this.internal = true;
|
31956 | } else {
|
31957 | if (!value.pubID && !value.sysID) {
|
31958 | throw new Error("Public and/or system identifiers are required for an external entity. " + this.debugInfo(name));
|
31959 | }
|
31960 | if (value.pubID && !value.sysID) {
|
31961 | throw new Error("System identifier is required for a public external entity. " + this.debugInfo(name));
|
31962 | }
|
31963 | this.internal = false;
|
31964 | if (value.pubID != null) {
|
31965 | this.pubID = this.stringify.dtdPubID(value.pubID);
|
31966 | }
|
31967 | if (value.sysID != null) {
|
31968 | this.sysID = this.stringify.dtdSysID(value.sysID);
|
31969 | }
|
31970 | if (value.nData != null) {
|
31971 | this.nData = this.stringify.dtdNData(value.nData);
|
31972 | }
|
31973 | if (this.pe && this.nData) {
|
31974 | throw new Error("Notation declaration is not allowed in a parameter entity. " + this.debugInfo(name));
|
31975 | }
|
31976 | }
|
31977 | }
|
31978 |
|
31979 | Object.defineProperty(XMLDTDEntity.prototype, 'publicId', {
|
31980 | get: function() {
|
31981 | return this.pubID;
|
31982 | }
|
31983 | });
|
31984 |
|
31985 | Object.defineProperty(XMLDTDEntity.prototype, 'systemId', {
|
31986 | get: function() {
|
31987 | return this.sysID;
|
31988 | }
|
31989 | });
|
31990 |
|
31991 | Object.defineProperty(XMLDTDEntity.prototype, 'notationName', {
|
31992 | get: function() {
|
31993 | return this.nData || null;
|
31994 | }
|
31995 | });
|
31996 |
|
31997 | Object.defineProperty(XMLDTDEntity.prototype, 'inputEncoding', {
|
31998 | get: function() {
|
31999 | return null;
|
32000 | }
|
32001 | });
|
32002 |
|
32003 | Object.defineProperty(XMLDTDEntity.prototype, 'xmlEncoding', {
|
32004 | get: function() {
|
32005 | return null;
|
32006 | }
|
32007 | });
|
32008 |
|
32009 | Object.defineProperty(XMLDTDEntity.prototype, 'xmlVersion', {
|
32010 | get: function() {
|
32011 | return null;
|
32012 | }
|
32013 | });
|
32014 |
|
32015 | XMLDTDEntity.prototype.toString = function(options) {
|
32016 | return this.options.writer.dtdEntity(this, this.options.writer.filterOptions(options));
|
32017 | };
|
32018 |
|
32019 | return XMLDTDEntity;
|
32020 |
|
32021 | })(XMLNode);
|
32022 |
|
32023 | }).call(this);
|
32024 |
|
32025 | },{"./NodeType":354,"./Utility":355,"./XMLNode":376}],368:[function(require,module,exports){
|
32026 |
|
32027 | (function() {
|
32028 | var NodeType, XMLDTDNotation, XMLNode,
|
32029 | extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
|
32030 | hasProp = {}.hasOwnProperty;
|
32031 |
|
32032 | XMLNode = require('./XMLNode');
|
32033 |
|
32034 | NodeType = require('./NodeType');
|
32035 |
|
32036 | module.exports = XMLDTDNotation = (function(superClass) {
|
32037 | extend(XMLDTDNotation, superClass);
|
32038 |
|
32039 | function XMLDTDNotation(parent, name, value) {
|
32040 | XMLDTDNotation.__super__.constructor.call(this, parent);
|
32041 | if (name == null) {
|
32042 | throw new Error("Missing DTD notation name. " + this.debugInfo(name));
|
32043 | }
|
32044 | if (!value.pubID && !value.sysID) {
|
32045 | throw new Error("Public or system identifiers are required for an external entity. " + this.debugInfo(name));
|
32046 | }
|
32047 | this.name = this.stringify.name(name);
|
32048 | this.type = NodeType.NotationDeclaration;
|
32049 | if (value.pubID != null) {
|
32050 | this.pubID = this.stringify.dtdPubID(value.pubID);
|
32051 | }
|
32052 | if (value.sysID != null) {
|
32053 | this.sysID = this.stringify.dtdSysID(value.sysID);
|
32054 | }
|
32055 | }
|
32056 |
|
32057 | Object.defineProperty(XMLDTDNotation.prototype, 'publicId', {
|
32058 | get: function() {
|
32059 | return this.pubID;
|
32060 | }
|
32061 | });
|
32062 |
|
32063 | Object.defineProperty(XMLDTDNotation.prototype, 'systemId', {
|
32064 | get: function() {
|
32065 | return this.sysID;
|
32066 | }
|
32067 | });
|
32068 |
|
32069 | XMLDTDNotation.prototype.toString = function(options) {
|
32070 | return this.options.writer.dtdNotation(this, this.options.writer.filterOptions(options));
|
32071 | };
|
32072 |
|
32073 | return XMLDTDNotation;
|
32074 |
|
32075 | })(XMLNode);
|
32076 |
|
32077 | }).call(this);
|
32078 |
|
32079 | },{"./NodeType":354,"./XMLNode":376}],369:[function(require,module,exports){
|
32080 |
|
32081 | (function() {
|
32082 | var NodeType, XMLDeclaration, XMLNode, isObject,
|
32083 | extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
|
32084 | hasProp = {}.hasOwnProperty;
|
32085 |
|
32086 | isObject = require('./Utility').isObject;
|
32087 |
|
32088 | XMLNode = require('./XMLNode');
|
32089 |
|
32090 | NodeType = require('./NodeType');
|
32091 |
|
32092 | module.exports = XMLDeclaration = (function(superClass) {
|
32093 | extend(XMLDeclaration, superClass);
|
32094 |
|
32095 | function XMLDeclaration(parent, version, encoding, standalone) {
|
32096 | var ref;
|
32097 | XMLDeclaration.__super__.constructor.call(this, parent);
|
32098 | if (isObject(version)) {
|
32099 | ref = version, version = ref.version, encoding = ref.encoding, standalone = ref.standalone;
|
32100 | }
|
32101 | if (!version) {
|
32102 | version = '1.0';
|
32103 | }
|
32104 | this.type = NodeType.Declaration;
|
32105 | this.version = this.stringify.xmlVersion(version);
|
32106 | if (encoding != null) {
|
32107 | this.encoding = this.stringify.xmlEncoding(encoding);
|
32108 | }
|
32109 | if (standalone != null) {
|
32110 | this.standalone = this.stringify.xmlStandalone(standalone);
|
32111 | }
|
32112 | }
|
32113 |
|
32114 | XMLDeclaration.prototype.toString = function(options) {
|
32115 | return this.options.writer.declaration(this, this.options.writer.filterOptions(options));
|
32116 | };
|
32117 |
|
32118 | return XMLDeclaration;
|
32119 |
|
32120 | })(XMLNode);
|
32121 |
|
32122 | }).call(this);
|
32123 |
|
32124 | },{"./NodeType":354,"./Utility":355,"./XMLNode":376}],370:[function(require,module,exports){
|
32125 |
|
32126 | (function() {
|
32127 | var NodeType, XMLDTDAttList, XMLDTDElement, XMLDTDEntity, XMLDTDNotation, XMLDocType, XMLNamedNodeMap, XMLNode, isObject,
|
32128 | extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
|
32129 | hasProp = {}.hasOwnProperty;
|
32130 |
|
32131 | isObject = require('./Utility').isObject;
|
32132 |
|
32133 | XMLNode = require('./XMLNode');
|
32134 |
|
32135 | NodeType = require('./NodeType');
|
32136 |
|
32137 | XMLDTDAttList = require('./XMLDTDAttList');
|
32138 |
|
32139 | XMLDTDEntity = require('./XMLDTDEntity');
|
32140 |
|
32141 | XMLDTDElement = require('./XMLDTDElement');
|
32142 |
|
32143 | XMLDTDNotation = require('./XMLDTDNotation');
|
32144 |
|
32145 | XMLNamedNodeMap = require('./XMLNamedNodeMap');
|
32146 |
|
32147 | module.exports = XMLDocType = (function(superClass) {
|
32148 | extend(XMLDocType, superClass);
|
32149 |
|
32150 | function XMLDocType(parent, pubID, sysID) {
|
32151 | var child, i, len, ref, ref1, ref2;
|
32152 | XMLDocType.__super__.constructor.call(this, parent);
|
32153 | this.type = NodeType.DocType;
|
32154 | if (parent.children) {
|
32155 | ref = parent.children;
|
32156 | for (i = 0, len = ref.length; i < len; i++) {
|
32157 | child = ref[i];
|
32158 | if (child.type === NodeType.Element) {
|
32159 | this.name = child.name;
|
32160 | break;
|
32161 | }
|
32162 | }
|
32163 | }
|
32164 | this.documentObject = parent;
|
32165 | if (isObject(pubID)) {
|
32166 | ref1 = pubID, pubID = ref1.pubID, sysID = ref1.sysID;
|
32167 | }
|
32168 | if (sysID == null) {
|
32169 | ref2 = [pubID, sysID], sysID = ref2[0], pubID = ref2[1];
|
32170 | }
|
32171 | if (pubID != null) {
|
32172 | this.pubID = this.stringify.dtdPubID(pubID);
|
32173 | }
|
32174 | if (sysID != null) {
|
32175 | this.sysID = this.stringify.dtdSysID(sysID);
|
32176 | }
|
32177 | }
|
32178 |
|
32179 | Object.defineProperty(XMLDocType.prototype, 'entities', {
|
32180 | get: function() {
|
32181 | var child, i, len, nodes, ref;
|
32182 | nodes = {};
|
32183 | ref = this.children;
|
32184 | for (i = 0, len = ref.length; i < len; i++) {
|
32185 | child = ref[i];
|
32186 | if ((child.type === NodeType.EntityDeclaration) && !child.pe) {
|
32187 | nodes[child.name] = child;
|
32188 | }
|
32189 | }
|
32190 | return new XMLNamedNodeMap(nodes);
|
32191 | }
|
32192 | });
|
32193 |
|
32194 | Object.defineProperty(XMLDocType.prototype, 'notations', {
|
32195 | get: function() {
|
32196 | var child, i, len, nodes, ref;
|
32197 | nodes = {};
|
32198 | ref = this.children;
|
32199 | for (i = 0, len = ref.length; i < len; i++) {
|
32200 | child = ref[i];
|
32201 | if (child.type === NodeType.NotationDeclaration) {
|
32202 | nodes[child.name] = child;
|
32203 | }
|
32204 | }
|
32205 | return new XMLNamedNodeMap(nodes);
|
32206 | }
|
32207 | });
|
32208 |
|
32209 | Object.defineProperty(XMLDocType.prototype, 'publicId', {
|
32210 | get: function() {
|
32211 | return this.pubID;
|
32212 | }
|
32213 | });
|
32214 |
|
32215 | Object.defineProperty(XMLDocType.prototype, 'systemId', {
|
32216 | get: function() {
|
32217 | return this.sysID;
|
32218 | }
|
32219 | });
|
32220 |
|
32221 | Object.defineProperty(XMLDocType.prototype, 'internalSubset', {
|
32222 | get: function() {
|
32223 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
32224 | }
|
32225 | });
|
32226 |
|
32227 | XMLDocType.prototype.element = function(name, value) {
|
32228 | var child;
|
32229 | child = new XMLDTDElement(this, name, value);
|
32230 | this.children.push(child);
|
32231 | return this;
|
32232 | };
|
32233 |
|
32234 | XMLDocType.prototype.attList = function(elementName, attributeName, attributeType, defaultValueType, defaultValue) {
|
32235 | var child;
|
32236 | child = new XMLDTDAttList(this, elementName, attributeName, attributeType, defaultValueType, defaultValue);
|
32237 | this.children.push(child);
|
32238 | return this;
|
32239 | };
|
32240 |
|
32241 | XMLDocType.prototype.entity = function(name, value) {
|
32242 | var child;
|
32243 | child = new XMLDTDEntity(this, false, name, value);
|
32244 | this.children.push(child);
|
32245 | return this;
|
32246 | };
|
32247 |
|
32248 | XMLDocType.prototype.pEntity = function(name, value) {
|
32249 | var child;
|
32250 | child = new XMLDTDEntity(this, true, name, value);
|
32251 | this.children.push(child);
|
32252 | return this;
|
32253 | };
|
32254 |
|
32255 | XMLDocType.prototype.notation = function(name, value) {
|
32256 | var child;
|
32257 | child = new XMLDTDNotation(this, name, value);
|
32258 | this.children.push(child);
|
32259 | return this;
|
32260 | };
|
32261 |
|
32262 | XMLDocType.prototype.toString = function(options) {
|
32263 | return this.options.writer.docType(this, this.options.writer.filterOptions(options));
|
32264 | };
|
32265 |
|
32266 | XMLDocType.prototype.ele = function(name, value) {
|
32267 | return this.element(name, value);
|
32268 | };
|
32269 |
|
32270 | XMLDocType.prototype.att = function(elementName, attributeName, attributeType, defaultValueType, defaultValue) {
|
32271 | return this.attList(elementName, attributeName, attributeType, defaultValueType, defaultValue);
|
32272 | };
|
32273 |
|
32274 | XMLDocType.prototype.ent = function(name, value) {
|
32275 | return this.entity(name, value);
|
32276 | };
|
32277 |
|
32278 | XMLDocType.prototype.pent = function(name, value) {
|
32279 | return this.pEntity(name, value);
|
32280 | };
|
32281 |
|
32282 | XMLDocType.prototype.not = function(name, value) {
|
32283 | return this.notation(name, value);
|
32284 | };
|
32285 |
|
32286 | XMLDocType.prototype.up = function() {
|
32287 | return this.root() || this.documentObject;
|
32288 | };
|
32289 |
|
32290 | XMLDocType.prototype.isEqualNode = function(node) {
|
32291 | if (!XMLDocType.__super__.isEqualNode.apply(this, arguments).isEqualNode(node)) {
|
32292 | return false;
|
32293 | }
|
32294 | if (node.name !== this.name) {
|
32295 | return false;
|
32296 | }
|
32297 | if (node.publicId !== this.publicId) {
|
32298 | return false;
|
32299 | }
|
32300 | if (node.systemId !== this.systemId) {
|
32301 | return false;
|
32302 | }
|
32303 | return true;
|
32304 | };
|
32305 |
|
32306 | return XMLDocType;
|
32307 |
|
32308 | })(XMLNode);
|
32309 |
|
32310 | }).call(this);
|
32311 |
|
32312 | },{"./NodeType":354,"./Utility":355,"./XMLDTDAttList":365,"./XMLDTDElement":366,"./XMLDTDEntity":367,"./XMLDTDNotation":368,"./XMLNamedNodeMap":375,"./XMLNode":376}],371:[function(require,module,exports){
|
32313 |
|
32314 | (function() {
|
32315 | var NodeType, XMLDOMConfiguration, XMLDOMImplementation, XMLDocument, XMLNode, XMLStringWriter, XMLStringifier, isPlainObject,
|
32316 | extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
|
32317 | hasProp = {}.hasOwnProperty;
|
32318 |
|
32319 | isPlainObject = require('./Utility').isPlainObject;
|
32320 |
|
32321 | XMLDOMImplementation = require('./XMLDOMImplementation');
|
32322 |
|
32323 | XMLDOMConfiguration = require('./XMLDOMConfiguration');
|
32324 |
|
32325 | XMLNode = require('./XMLNode');
|
32326 |
|
32327 | NodeType = require('./NodeType');
|
32328 |
|
32329 | XMLStringifier = require('./XMLStringifier');
|
32330 |
|
32331 | XMLStringWriter = require('./XMLStringWriter');
|
32332 |
|
32333 | module.exports = XMLDocument = (function(superClass) {
|
32334 | extend(XMLDocument, superClass);
|
32335 |
|
32336 | function XMLDocument(options) {
|
32337 | XMLDocument.__super__.constructor.call(this, null);
|
32338 | this.name = "#document";
|
32339 | this.type = NodeType.Document;
|
32340 | this.documentURI = null;
|
32341 | this.domConfig = new XMLDOMConfiguration();
|
32342 | options || (options = {});
|
32343 | if (!options.writer) {
|
32344 | options.writer = new XMLStringWriter();
|
32345 | }
|
32346 | this.options = options;
|
32347 | this.stringify = new XMLStringifier(options);
|
32348 | }
|
32349 |
|
32350 | Object.defineProperty(XMLDocument.prototype, 'implementation', {
|
32351 | value: new XMLDOMImplementation()
|
32352 | });
|
32353 |
|
32354 | Object.defineProperty(XMLDocument.prototype, 'doctype', {
|
32355 | get: function() {
|
32356 | var child, i, len, ref;
|
32357 | ref = this.children;
|
32358 | for (i = 0, len = ref.length; i < len; i++) {
|
32359 | child = ref[i];
|
32360 | if (child.type === NodeType.DocType) {
|
32361 | return child;
|
32362 | }
|
32363 | }
|
32364 | return null;
|
32365 | }
|
32366 | });
|
32367 |
|
32368 | Object.defineProperty(XMLDocument.prototype, 'documentElement', {
|
32369 | get: function() {
|
32370 | return this.rootObject || null;
|
32371 | }
|
32372 | });
|
32373 |
|
32374 | Object.defineProperty(XMLDocument.prototype, 'inputEncoding', {
|
32375 | get: function() {
|
32376 | return null;
|
32377 | }
|
32378 | });
|
32379 |
|
32380 | Object.defineProperty(XMLDocument.prototype, 'strictErrorChecking', {
|
32381 | get: function() {
|
32382 | return false;
|
32383 | }
|
32384 | });
|
32385 |
|
32386 | Object.defineProperty(XMLDocument.prototype, 'xmlEncoding', {
|
32387 | get: function() {
|
32388 | if (this.children.length !== 0 && this.children[0].type === NodeType.Declaration) {
|
32389 | return this.children[0].encoding;
|
32390 | } else {
|
32391 | return null;
|
32392 | }
|
32393 | }
|
32394 | });
|
32395 |
|
32396 | Object.defineProperty(XMLDocument.prototype, 'xmlStandalone', {
|
32397 | get: function() {
|
32398 | if (this.children.length !== 0 && this.children[0].type === NodeType.Declaration) {
|
32399 | return this.children[0].standalone === 'yes';
|
32400 | } else {
|
32401 | return false;
|
32402 | }
|
32403 | }
|
32404 | });
|
32405 |
|
32406 | Object.defineProperty(XMLDocument.prototype, 'xmlVersion', {
|
32407 | get: function() {
|
32408 | if (this.children.length !== 0 && this.children[0].type === NodeType.Declaration) {
|
32409 | return this.children[0].version;
|
32410 | } else {
|
32411 | return "1.0";
|
32412 | }
|
32413 | }
|
32414 | });
|
32415 |
|
32416 | Object.defineProperty(XMLDocument.prototype, 'URL', {
|
32417 | get: function() {
|
32418 | return this.documentURI;
|
32419 | }
|
32420 | });
|
32421 |
|
32422 | Object.defineProperty(XMLDocument.prototype, 'origin', {
|
32423 | get: function() {
|
32424 | return null;
|
32425 | }
|
32426 | });
|
32427 |
|
32428 | Object.defineProperty(XMLDocument.prototype, 'compatMode', {
|
32429 | get: function() {
|
32430 | return null;
|
32431 | }
|
32432 | });
|
32433 |
|
32434 | Object.defineProperty(XMLDocument.prototype, 'characterSet', {
|
32435 | get: function() {
|
32436 | return null;
|
32437 | }
|
32438 | });
|
32439 |
|
32440 | Object.defineProperty(XMLDocument.prototype, 'contentType', {
|
32441 | get: function() {
|
32442 | return null;
|
32443 | }
|
32444 | });
|
32445 |
|
32446 | XMLDocument.prototype.end = function(writer) {
|
32447 | var writerOptions;
|
32448 | writerOptions = {};
|
32449 | if (!writer) {
|
32450 | writer = this.options.writer;
|
32451 | } else if (isPlainObject(writer)) {
|
32452 | writerOptions = writer;
|
32453 | writer = this.options.writer;
|
32454 | }
|
32455 | return writer.document(this, writer.filterOptions(writerOptions));
|
32456 | };
|
32457 |
|
32458 | XMLDocument.prototype.toString = function(options) {
|
32459 | return this.options.writer.document(this, this.options.writer.filterOptions(options));
|
32460 | };
|
32461 |
|
32462 | XMLDocument.prototype.createElement = function(tagName) {
|
32463 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
32464 | };
|
32465 |
|
32466 | XMLDocument.prototype.createDocumentFragment = function() {
|
32467 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
32468 | };
|
32469 |
|
32470 | XMLDocument.prototype.createTextNode = function(data) {
|
32471 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
32472 | };
|
32473 |
|
32474 | XMLDocument.prototype.createComment = function(data) {
|
32475 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
32476 | };
|
32477 |
|
32478 | XMLDocument.prototype.createCDATASection = function(data) {
|
32479 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
32480 | };
|
32481 |
|
32482 | XMLDocument.prototype.createProcessingInstruction = function(target, data) {
|
32483 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
32484 | };
|
32485 |
|
32486 | XMLDocument.prototype.createAttribute = function(name) {
|
32487 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
32488 | };
|
32489 |
|
32490 | XMLDocument.prototype.createEntityReference = function(name) {
|
32491 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
32492 | };
|
32493 |
|
32494 | XMLDocument.prototype.getElementsByTagName = function(tagname) {
|
32495 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
32496 | };
|
32497 |
|
32498 | XMLDocument.prototype.importNode = function(importedNode, deep) {
|
32499 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
32500 | };
|
32501 |
|
32502 | XMLDocument.prototype.createElementNS = function(namespaceURI, qualifiedName) {
|
32503 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
32504 | };
|
32505 |
|
32506 | XMLDocument.prototype.createAttributeNS = function(namespaceURI, qualifiedName) {
|
32507 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
32508 | };
|
32509 |
|
32510 | XMLDocument.prototype.getElementsByTagNameNS = function(namespaceURI, localName) {
|
32511 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
32512 | };
|
32513 |
|
32514 | XMLDocument.prototype.getElementById = function(elementId) {
|
32515 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
32516 | };
|
32517 |
|
32518 | XMLDocument.prototype.adoptNode = function(source) {
|
32519 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
32520 | };
|
32521 |
|
32522 | XMLDocument.prototype.normalizeDocument = function() {
|
32523 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
32524 | };
|
32525 |
|
32526 | XMLDocument.prototype.renameNode = function(node, namespaceURI, qualifiedName) {
|
32527 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
32528 | };
|
32529 |
|
32530 | XMLDocument.prototype.getElementsByClassName = function(classNames) {
|
32531 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
32532 | };
|
32533 |
|
32534 | XMLDocument.prototype.createEvent = function(eventInterface) {
|
32535 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
32536 | };
|
32537 |
|
32538 | XMLDocument.prototype.createRange = function() {
|
32539 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
32540 | };
|
32541 |
|
32542 | XMLDocument.prototype.createNodeIterator = function(root, whatToShow, filter) {
|
32543 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
32544 | };
|
32545 |
|
32546 | XMLDocument.prototype.createTreeWalker = function(root, whatToShow, filter) {
|
32547 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
32548 | };
|
32549 |
|
32550 | return XMLDocument;
|
32551 |
|
32552 | })(XMLNode);
|
32553 |
|
32554 | }).call(this);
|
32555 |
|
32556 | },{"./NodeType":354,"./Utility":355,"./XMLDOMConfiguration":361,"./XMLDOMImplementation":363,"./XMLNode":376,"./XMLStringWriter":381,"./XMLStringifier":382}],372:[function(require,module,exports){
|
32557 |
|
32558 | (function() {
|
32559 | var NodeType, WriterState, XMLAttribute, XMLCData, XMLComment, XMLDTDAttList, XMLDTDElement, XMLDTDEntity, XMLDTDNotation, XMLDeclaration, XMLDocType, XMLDocument, XMLDocumentCB, XMLElement, XMLProcessingInstruction, XMLRaw, XMLStringWriter, XMLStringifier, XMLText, getValue, isFunction, isObject, isPlainObject, ref,
|
32560 | hasProp = {}.hasOwnProperty;
|
32561 |
|
32562 | ref = require('./Utility'), isObject = ref.isObject, isFunction = ref.isFunction, isPlainObject = ref.isPlainObject, getValue = ref.getValue;
|
32563 |
|
32564 | NodeType = require('./NodeType');
|
32565 |
|
32566 | XMLDocument = require('./XMLDocument');
|
32567 |
|
32568 | XMLElement = require('./XMLElement');
|
32569 |
|
32570 | XMLCData = require('./XMLCData');
|
32571 |
|
32572 | XMLComment = require('./XMLComment');
|
32573 |
|
32574 | XMLRaw = require('./XMLRaw');
|
32575 |
|
32576 | XMLText = require('./XMLText');
|
32577 |
|
32578 | XMLProcessingInstruction = require('./XMLProcessingInstruction');
|
32579 |
|
32580 | XMLDeclaration = require('./XMLDeclaration');
|
32581 |
|
32582 | XMLDocType = require('./XMLDocType');
|
32583 |
|
32584 | XMLDTDAttList = require('./XMLDTDAttList');
|
32585 |
|
32586 | XMLDTDEntity = require('./XMLDTDEntity');
|
32587 |
|
32588 | XMLDTDElement = require('./XMLDTDElement');
|
32589 |
|
32590 | XMLDTDNotation = require('./XMLDTDNotation');
|
32591 |
|
32592 | XMLAttribute = require('./XMLAttribute');
|
32593 |
|
32594 | XMLStringifier = require('./XMLStringifier');
|
32595 |
|
32596 | XMLStringWriter = require('./XMLStringWriter');
|
32597 |
|
32598 | WriterState = require('./WriterState');
|
32599 |
|
32600 | module.exports = XMLDocumentCB = (function() {
|
32601 | function XMLDocumentCB(options, onData, onEnd) {
|
32602 | var writerOptions;
|
32603 | this.name = "?xml";
|
32604 | this.type = NodeType.Document;
|
32605 | options || (options = {});
|
32606 | writerOptions = {};
|
32607 | if (!options.writer) {
|
32608 | options.writer = new XMLStringWriter();
|
32609 | } else if (isPlainObject(options.writer)) {
|
32610 | writerOptions = options.writer;
|
32611 | options.writer = new XMLStringWriter();
|
32612 | }
|
32613 | this.options = options;
|
32614 | this.writer = options.writer;
|
32615 | this.writerOptions = this.writer.filterOptions(writerOptions);
|
32616 | this.stringify = new XMLStringifier(options);
|
32617 | this.onDataCallback = onData || function() {};
|
32618 | this.onEndCallback = onEnd || function() {};
|
32619 | this.currentNode = null;
|
32620 | this.currentLevel = -1;
|
32621 | this.openTags = {};
|
32622 | this.documentStarted = false;
|
32623 | this.documentCompleted = false;
|
32624 | this.root = null;
|
32625 | }
|
32626 |
|
32627 | XMLDocumentCB.prototype.createChildNode = function(node) {
|
32628 | var att, attName, attributes, child, i, len, ref1, ref2;
|
32629 | switch (node.type) {
|
32630 | case NodeType.CData:
|
32631 | this.cdata(node.value);
|
32632 | break;
|
32633 | case NodeType.Comment:
|
32634 | this.comment(node.value);
|
32635 | break;
|
32636 | case NodeType.Element:
|
32637 | attributes = {};
|
32638 | ref1 = node.attribs;
|
32639 | for (attName in ref1) {
|
32640 | if (!hasProp.call(ref1, attName)) continue;
|
32641 | att = ref1[attName];
|
32642 | attributes[attName] = att.value;
|
32643 | }
|
32644 | this.node(node.name, attributes);
|
32645 | break;
|
32646 | case NodeType.Dummy:
|
32647 | this.dummy();
|
32648 | break;
|
32649 | case NodeType.Raw:
|
32650 | this.raw(node.value);
|
32651 | break;
|
32652 | case NodeType.Text:
|
32653 | this.text(node.value);
|
32654 | break;
|
32655 | case NodeType.ProcessingInstruction:
|
32656 | this.instruction(node.target, node.value);
|
32657 | break;
|
32658 | default:
|
32659 | throw new Error("This XML node type is not supported in a JS object: " + node.constructor.name);
|
32660 | }
|
32661 | ref2 = node.children;
|
32662 | for (i = 0, len = ref2.length; i < len; i++) {
|
32663 | child = ref2[i];
|
32664 | this.createChildNode(child);
|
32665 | if (child.type === NodeType.Element) {
|
32666 | this.up();
|
32667 | }
|
32668 | }
|
32669 | return this;
|
32670 | };
|
32671 |
|
32672 | XMLDocumentCB.prototype.dummy = function() {
|
32673 | return this;
|
32674 | };
|
32675 |
|
32676 | XMLDocumentCB.prototype.node = function(name, attributes, text) {
|
32677 | var ref1;
|
32678 | if (name == null) {
|
32679 | throw new Error("Missing node name.");
|
32680 | }
|
32681 | if (this.root && this.currentLevel === -1) {
|
32682 | throw new Error("Document can only have one root node. " + this.debugInfo(name));
|
32683 | }
|
32684 | this.openCurrent();
|
32685 | name = getValue(name);
|
32686 | if (attributes == null) {
|
32687 | attributes = {};
|
32688 | }
|
32689 | attributes = getValue(attributes);
|
32690 | if (!isObject(attributes)) {
|
32691 | ref1 = [attributes, text], text = ref1[0], attributes = ref1[1];
|
32692 | }
|
32693 | this.currentNode = new XMLElement(this, name, attributes);
|
32694 | this.currentNode.children = false;
|
32695 | this.currentLevel++;
|
32696 | this.openTags[this.currentLevel] = this.currentNode;
|
32697 | if (text != null) {
|
32698 | this.text(text);
|
32699 | }
|
32700 | return this;
|
32701 | };
|
32702 |
|
32703 | XMLDocumentCB.prototype.element = function(name, attributes, text) {
|
32704 | var child, i, len, oldValidationFlag, ref1, root;
|
32705 | if (this.currentNode && this.currentNode.type === NodeType.DocType) {
|
32706 | this.dtdElement.apply(this, arguments);
|
32707 | } else {
|
32708 | if (Array.isArray(name) || isObject(name) || isFunction(name)) {
|
32709 | oldValidationFlag = this.options.noValidation;
|
32710 | this.options.noValidation = true;
|
32711 | root = new XMLDocument(this.options).element('TEMP_ROOT');
|
32712 | root.element(name);
|
32713 | this.options.noValidation = oldValidationFlag;
|
32714 | ref1 = root.children;
|
32715 | for (i = 0, len = ref1.length; i < len; i++) {
|
32716 | child = ref1[i];
|
32717 | this.createChildNode(child);
|
32718 | if (child.type === NodeType.Element) {
|
32719 | this.up();
|
32720 | }
|
32721 | }
|
32722 | } else {
|
32723 | this.node(name, attributes, text);
|
32724 | }
|
32725 | }
|
32726 | return this;
|
32727 | };
|
32728 |
|
32729 | XMLDocumentCB.prototype.attribute = function(name, value) {
|
32730 | var attName, attValue;
|
32731 | if (!this.currentNode || this.currentNode.children) {
|
32732 | throw new Error("att() can only be used immediately after an ele() call in callback mode. " + this.debugInfo(name));
|
32733 | }
|
32734 | if (name != null) {
|
32735 | name = getValue(name);
|
32736 | }
|
32737 | if (isObject(name)) {
|
32738 | for (attName in name) {
|
32739 | if (!hasProp.call(name, attName)) continue;
|
32740 | attValue = name[attName];
|
32741 | this.attribute(attName, attValue);
|
32742 | }
|
32743 | } else {
|
32744 | if (isFunction(value)) {
|
32745 | value = value.apply();
|
32746 | }
|
32747 | if (this.options.keepNullAttributes && (value == null)) {
|
32748 | this.currentNode.attribs[name] = new XMLAttribute(this, name, "");
|
32749 | } else if (value != null) {
|
32750 | this.currentNode.attribs[name] = new XMLAttribute(this, name, value);
|
32751 | }
|
32752 | }
|
32753 | return this;
|
32754 | };
|
32755 |
|
32756 | XMLDocumentCB.prototype.text = function(value) {
|
32757 | var node;
|
32758 | this.openCurrent();
|
32759 | node = new XMLText(this, value);
|
32760 | this.onData(this.writer.text(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1);
|
32761 | return this;
|
32762 | };
|
32763 |
|
32764 | XMLDocumentCB.prototype.cdata = function(value) {
|
32765 | var node;
|
32766 | this.openCurrent();
|
32767 | node = new XMLCData(this, value);
|
32768 | this.onData(this.writer.cdata(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1);
|
32769 | return this;
|
32770 | };
|
32771 |
|
32772 | XMLDocumentCB.prototype.comment = function(value) {
|
32773 | var node;
|
32774 | this.openCurrent();
|
32775 | node = new XMLComment(this, value);
|
32776 | this.onData(this.writer.comment(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1);
|
32777 | return this;
|
32778 | };
|
32779 |
|
32780 | XMLDocumentCB.prototype.raw = function(value) {
|
32781 | var node;
|
32782 | this.openCurrent();
|
32783 | node = new XMLRaw(this, value);
|
32784 | this.onData(this.writer.raw(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1);
|
32785 | return this;
|
32786 | };
|
32787 |
|
32788 | XMLDocumentCB.prototype.instruction = function(target, value) {
|
32789 | var i, insTarget, insValue, len, node;
|
32790 | this.openCurrent();
|
32791 | if (target != null) {
|
32792 | target = getValue(target);
|
32793 | }
|
32794 | if (value != null) {
|
32795 | value = getValue(value);
|
32796 | }
|
32797 | if (Array.isArray(target)) {
|
32798 | for (i = 0, len = target.length; i < len; i++) {
|
32799 | insTarget = target[i];
|
32800 | this.instruction(insTarget);
|
32801 | }
|
32802 | } else if (isObject(target)) {
|
32803 | for (insTarget in target) {
|
32804 | if (!hasProp.call(target, insTarget)) continue;
|
32805 | insValue = target[insTarget];
|
32806 | this.instruction(insTarget, insValue);
|
32807 | }
|
32808 | } else {
|
32809 | if (isFunction(value)) {
|
32810 | value = value.apply();
|
32811 | }
|
32812 | node = new XMLProcessingInstruction(this, target, value);
|
32813 | this.onData(this.writer.processingInstruction(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1);
|
32814 | }
|
32815 | return this;
|
32816 | };
|
32817 |
|
32818 | XMLDocumentCB.prototype.declaration = function(version, encoding, standalone) {
|
32819 | var node;
|
32820 | this.openCurrent();
|
32821 | if (this.documentStarted) {
|
32822 | throw new Error("declaration() must be the first node.");
|
32823 | }
|
32824 | node = new XMLDeclaration(this, version, encoding, standalone);
|
32825 | this.onData(this.writer.declaration(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1);
|
32826 | return this;
|
32827 | };
|
32828 |
|
32829 | XMLDocumentCB.prototype.doctype = function(root, pubID, sysID) {
|
32830 | this.openCurrent();
|
32831 | if (root == null) {
|
32832 | throw new Error("Missing root node name.");
|
32833 | }
|
32834 | if (this.root) {
|
32835 | throw new Error("dtd() must come before the root node.");
|
32836 | }
|
32837 | this.currentNode = new XMLDocType(this, pubID, sysID);
|
32838 | this.currentNode.rootNodeName = root;
|
32839 | this.currentNode.children = false;
|
32840 | this.currentLevel++;
|
32841 | this.openTags[this.currentLevel] = this.currentNode;
|
32842 | return this;
|
32843 | };
|
32844 |
|
32845 | XMLDocumentCB.prototype.dtdElement = function(name, value) {
|
32846 | var node;
|
32847 | this.openCurrent();
|
32848 | node = new XMLDTDElement(this, name, value);
|
32849 | this.onData(this.writer.dtdElement(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1);
|
32850 | return this;
|
32851 | };
|
32852 |
|
32853 | XMLDocumentCB.prototype.attList = function(elementName, attributeName, attributeType, defaultValueType, defaultValue) {
|
32854 | var node;
|
32855 | this.openCurrent();
|
32856 | node = new XMLDTDAttList(this, elementName, attributeName, attributeType, defaultValueType, defaultValue);
|
32857 | this.onData(this.writer.dtdAttList(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1);
|
32858 | return this;
|
32859 | };
|
32860 |
|
32861 | XMLDocumentCB.prototype.entity = function(name, value) {
|
32862 | var node;
|
32863 | this.openCurrent();
|
32864 | node = new XMLDTDEntity(this, false, name, value);
|
32865 | this.onData(this.writer.dtdEntity(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1);
|
32866 | return this;
|
32867 | };
|
32868 |
|
32869 | XMLDocumentCB.prototype.pEntity = function(name, value) {
|
32870 | var node;
|
32871 | this.openCurrent();
|
32872 | node = new XMLDTDEntity(this, true, name, value);
|
32873 | this.onData(this.writer.dtdEntity(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1);
|
32874 | return this;
|
32875 | };
|
32876 |
|
32877 | XMLDocumentCB.prototype.notation = function(name, value) {
|
32878 | var node;
|
32879 | this.openCurrent();
|
32880 | node = new XMLDTDNotation(this, name, value);
|
32881 | this.onData(this.writer.dtdNotation(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1);
|
32882 | return this;
|
32883 | };
|
32884 |
|
32885 | XMLDocumentCB.prototype.up = function() {
|
32886 | if (this.currentLevel < 0) {
|
32887 | throw new Error("The document node has no parent.");
|
32888 | }
|
32889 | if (this.currentNode) {
|
32890 | if (this.currentNode.children) {
|
32891 | this.closeNode(this.currentNode);
|
32892 | } else {
|
32893 | this.openNode(this.currentNode);
|
32894 | }
|
32895 | this.currentNode = null;
|
32896 | } else {
|
32897 | this.closeNode(this.openTags[this.currentLevel]);
|
32898 | }
|
32899 | delete this.openTags[this.currentLevel];
|
32900 | this.currentLevel--;
|
32901 | return this;
|
32902 | };
|
32903 |
|
32904 | XMLDocumentCB.prototype.end = function() {
|
32905 | while (this.currentLevel >= 0) {
|
32906 | this.up();
|
32907 | }
|
32908 | return this.onEnd();
|
32909 | };
|
32910 |
|
32911 | XMLDocumentCB.prototype.openCurrent = function() {
|
32912 | if (this.currentNode) {
|
32913 | this.currentNode.children = true;
|
32914 | return this.openNode(this.currentNode);
|
32915 | }
|
32916 | };
|
32917 |
|
32918 | XMLDocumentCB.prototype.openNode = function(node) {
|
32919 | var att, chunk, name, ref1;
|
32920 | if (!node.isOpen) {
|
32921 | if (!this.root && this.currentLevel === 0 && node.type === NodeType.Element) {
|
32922 | this.root = node;
|
32923 | }
|
32924 | chunk = '';
|
32925 | if (node.type === NodeType.Element) {
|
32926 | this.writerOptions.state = WriterState.OpenTag;
|
32927 | chunk = this.writer.indent(node, this.writerOptions, this.currentLevel) + '<' + node.name;
|
32928 | ref1 = node.attribs;
|
32929 | for (name in ref1) {
|
32930 | if (!hasProp.call(ref1, name)) continue;
|
32931 | att = ref1[name];
|
32932 | chunk += this.writer.attribute(att, this.writerOptions, this.currentLevel);
|
32933 | }
|
32934 | chunk += (node.children ? '>' : '/>') + this.writer.endline(node, this.writerOptions, this.currentLevel);
|
32935 | this.writerOptions.state = WriterState.InsideTag;
|
32936 | } else {
|
32937 | this.writerOptions.state = WriterState.OpenTag;
|
32938 | chunk = this.writer.indent(node, this.writerOptions, this.currentLevel) + '<!DOCTYPE ' + node.rootNodeName;
|
32939 | if (node.pubID && node.sysID) {
|
32940 | chunk += ' PUBLIC "' + node.pubID + '" "' + node.sysID + '"';
|
32941 | } else if (node.sysID) {
|
32942 | chunk += ' SYSTEM "' + node.sysID + '"';
|
32943 | }
|
32944 | if (node.children) {
|
32945 | chunk += ' [';
|
32946 | this.writerOptions.state = WriterState.InsideTag;
|
32947 | } else {
|
32948 | this.writerOptions.state = WriterState.CloseTag;
|
32949 | chunk += '>';
|
32950 | }
|
32951 | chunk += this.writer.endline(node, this.writerOptions, this.currentLevel);
|
32952 | }
|
32953 | this.onData(chunk, this.currentLevel);
|
32954 | return node.isOpen = true;
|
32955 | }
|
32956 | };
|
32957 |
|
32958 | XMLDocumentCB.prototype.closeNode = function(node) {
|
32959 | var chunk;
|
32960 | if (!node.isClosed) {
|
32961 | chunk = '';
|
32962 | this.writerOptions.state = WriterState.CloseTag;
|
32963 | if (node.type === NodeType.Element) {
|
32964 | chunk = this.writer.indent(node, this.writerOptions, this.currentLevel) + '</' + node.name + '>' + this.writer.endline(node, this.writerOptions, this.currentLevel);
|
32965 | } else {
|
32966 | chunk = this.writer.indent(node, this.writerOptions, this.currentLevel) + ']>' + this.writer.endline(node, this.writerOptions, this.currentLevel);
|
32967 | }
|
32968 | this.writerOptions.state = WriterState.None;
|
32969 | this.onData(chunk, this.currentLevel);
|
32970 | return node.isClosed = true;
|
32971 | }
|
32972 | };
|
32973 |
|
32974 | XMLDocumentCB.prototype.onData = function(chunk, level) {
|
32975 | this.documentStarted = true;
|
32976 | return this.onDataCallback(chunk, level + 1);
|
32977 | };
|
32978 |
|
32979 | XMLDocumentCB.prototype.onEnd = function() {
|
32980 | this.documentCompleted = true;
|
32981 | return this.onEndCallback();
|
32982 | };
|
32983 |
|
32984 | XMLDocumentCB.prototype.debugInfo = function(name) {
|
32985 | if (name == null) {
|
32986 | return "";
|
32987 | } else {
|
32988 | return "node: <" + name + ">";
|
32989 | }
|
32990 | };
|
32991 |
|
32992 | XMLDocumentCB.prototype.ele = function() {
|
32993 | return this.element.apply(this, arguments);
|
32994 | };
|
32995 |
|
32996 | XMLDocumentCB.prototype.nod = function(name, attributes, text) {
|
32997 | return this.node(name, attributes, text);
|
32998 | };
|
32999 |
|
33000 | XMLDocumentCB.prototype.txt = function(value) {
|
33001 | return this.text(value);
|
33002 | };
|
33003 |
|
33004 | XMLDocumentCB.prototype.dat = function(value) {
|
33005 | return this.cdata(value);
|
33006 | };
|
33007 |
|
33008 | XMLDocumentCB.prototype.com = function(value) {
|
33009 | return this.comment(value);
|
33010 | };
|
33011 |
|
33012 | XMLDocumentCB.prototype.ins = function(target, value) {
|
33013 | return this.instruction(target, value);
|
33014 | };
|
33015 |
|
33016 | XMLDocumentCB.prototype.dec = function(version, encoding, standalone) {
|
33017 | return this.declaration(version, encoding, standalone);
|
33018 | };
|
33019 |
|
33020 | XMLDocumentCB.prototype.dtd = function(root, pubID, sysID) {
|
33021 | return this.doctype(root, pubID, sysID);
|
33022 | };
|
33023 |
|
33024 | XMLDocumentCB.prototype.e = function(name, attributes, text) {
|
33025 | return this.element(name, attributes, text);
|
33026 | };
|
33027 |
|
33028 | XMLDocumentCB.prototype.n = function(name, attributes, text) {
|
33029 | return this.node(name, attributes, text);
|
33030 | };
|
33031 |
|
33032 | XMLDocumentCB.prototype.t = function(value) {
|
33033 | return this.text(value);
|
33034 | };
|
33035 |
|
33036 | XMLDocumentCB.prototype.d = function(value) {
|
33037 | return this.cdata(value);
|
33038 | };
|
33039 |
|
33040 | XMLDocumentCB.prototype.c = function(value) {
|
33041 | return this.comment(value);
|
33042 | };
|
33043 |
|
33044 | XMLDocumentCB.prototype.r = function(value) {
|
33045 | return this.raw(value);
|
33046 | };
|
33047 |
|
33048 | XMLDocumentCB.prototype.i = function(target, value) {
|
33049 | return this.instruction(target, value);
|
33050 | };
|
33051 |
|
33052 | XMLDocumentCB.prototype.att = function() {
|
33053 | if (this.currentNode && this.currentNode.type === NodeType.DocType) {
|
33054 | return this.attList.apply(this, arguments);
|
33055 | } else {
|
33056 | return this.attribute.apply(this, arguments);
|
33057 | }
|
33058 | };
|
33059 |
|
33060 | XMLDocumentCB.prototype.a = function() {
|
33061 | if (this.currentNode && this.currentNode.type === NodeType.DocType) {
|
33062 | return this.attList.apply(this, arguments);
|
33063 | } else {
|
33064 | return this.attribute.apply(this, arguments);
|
33065 | }
|
33066 | };
|
33067 |
|
33068 | XMLDocumentCB.prototype.ent = function(name, value) {
|
33069 | return this.entity(name, value);
|
33070 | };
|
33071 |
|
33072 | XMLDocumentCB.prototype.pent = function(name, value) {
|
33073 | return this.pEntity(name, value);
|
33074 | };
|
33075 |
|
33076 | XMLDocumentCB.prototype.not = function(name, value) {
|
33077 | return this.notation(name, value);
|
33078 | };
|
33079 |
|
33080 | return XMLDocumentCB;
|
33081 |
|
33082 | })();
|
33083 |
|
33084 | }).call(this);
|
33085 |
|
33086 | },{"./NodeType":354,"./Utility":355,"./WriterState":356,"./XMLAttribute":357,"./XMLCData":358,"./XMLComment":360,"./XMLDTDAttList":365,"./XMLDTDElement":366,"./XMLDTDEntity":367,"./XMLDTDNotation":368,"./XMLDeclaration":369,"./XMLDocType":370,"./XMLDocument":371,"./XMLElement":374,"./XMLProcessingInstruction":378,"./XMLRaw":379,"./XMLStringWriter":381,"./XMLStringifier":382,"./XMLText":383}],373:[function(require,module,exports){
|
33087 |
|
33088 | (function() {
|
33089 | var NodeType, XMLDummy, XMLNode,
|
33090 | extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
|
33091 | hasProp = {}.hasOwnProperty;
|
33092 |
|
33093 | XMLNode = require('./XMLNode');
|
33094 |
|
33095 | NodeType = require('./NodeType');
|
33096 |
|
33097 | module.exports = XMLDummy = (function(superClass) {
|
33098 | extend(XMLDummy, superClass);
|
33099 |
|
33100 | function XMLDummy(parent) {
|
33101 | XMLDummy.__super__.constructor.call(this, parent);
|
33102 | this.type = NodeType.Dummy;
|
33103 | }
|
33104 |
|
33105 | XMLDummy.prototype.clone = function() {
|
33106 | return Object.create(this);
|
33107 | };
|
33108 |
|
33109 | XMLDummy.prototype.toString = function(options) {
|
33110 | return '';
|
33111 | };
|
33112 |
|
33113 | return XMLDummy;
|
33114 |
|
33115 | })(XMLNode);
|
33116 |
|
33117 | }).call(this);
|
33118 |
|
33119 | },{"./NodeType":354,"./XMLNode":376}],374:[function(require,module,exports){
|
33120 |
|
33121 | (function() {
|
33122 | var NodeType, XMLAttribute, XMLElement, XMLNamedNodeMap, XMLNode, getValue, isFunction, isObject, ref,
|
33123 | extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
|
33124 | hasProp = {}.hasOwnProperty;
|
33125 |
|
33126 | ref = require('./Utility'), isObject = ref.isObject, isFunction = ref.isFunction, getValue = ref.getValue;
|
33127 |
|
33128 | XMLNode = require('./XMLNode');
|
33129 |
|
33130 | NodeType = require('./NodeType');
|
33131 |
|
33132 | XMLAttribute = require('./XMLAttribute');
|
33133 |
|
33134 | XMLNamedNodeMap = require('./XMLNamedNodeMap');
|
33135 |
|
33136 | module.exports = XMLElement = (function(superClass) {
|
33137 | extend(XMLElement, superClass);
|
33138 |
|
33139 | function XMLElement(parent, name, attributes) {
|
33140 | var child, j, len, ref1;
|
33141 | XMLElement.__super__.constructor.call(this, parent);
|
33142 | if (name == null) {
|
33143 | throw new Error("Missing element name. " + this.debugInfo());
|
33144 | }
|
33145 | this.name = this.stringify.name(name);
|
33146 | this.type = NodeType.Element;
|
33147 | this.attribs = {};
|
33148 | this.schemaTypeInfo = null;
|
33149 | if (attributes != null) {
|
33150 | this.attribute(attributes);
|
33151 | }
|
33152 | if (parent.type === NodeType.Document) {
|
33153 | this.isRoot = true;
|
33154 | this.documentObject = parent;
|
33155 | parent.rootObject = this;
|
33156 | if (parent.children) {
|
33157 | ref1 = parent.children;
|
33158 | for (j = 0, len = ref1.length; j < len; j++) {
|
33159 | child = ref1[j];
|
33160 | if (child.type === NodeType.DocType) {
|
33161 | child.name = this.name;
|
33162 | break;
|
33163 | }
|
33164 | }
|
33165 | }
|
33166 | }
|
33167 | }
|
33168 |
|
33169 | Object.defineProperty(XMLElement.prototype, 'tagName', {
|
33170 | get: function() {
|
33171 | return this.name;
|
33172 | }
|
33173 | });
|
33174 |
|
33175 | Object.defineProperty(XMLElement.prototype, 'namespaceURI', {
|
33176 | get: function() {
|
33177 | return '';
|
33178 | }
|
33179 | });
|
33180 |
|
33181 | Object.defineProperty(XMLElement.prototype, 'prefix', {
|
33182 | get: function() {
|
33183 | return '';
|
33184 | }
|
33185 | });
|
33186 |
|
33187 | Object.defineProperty(XMLElement.prototype, 'localName', {
|
33188 | get: function() {
|
33189 | return this.name;
|
33190 | }
|
33191 | });
|
33192 |
|
33193 | Object.defineProperty(XMLElement.prototype, 'id', {
|
33194 | get: function() {
|
33195 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
33196 | }
|
33197 | });
|
33198 |
|
33199 | Object.defineProperty(XMLElement.prototype, 'className', {
|
33200 | get: function() {
|
33201 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
33202 | }
|
33203 | });
|
33204 |
|
33205 | Object.defineProperty(XMLElement.prototype, 'classList', {
|
33206 | get: function() {
|
33207 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
33208 | }
|
33209 | });
|
33210 |
|
33211 | Object.defineProperty(XMLElement.prototype, 'attributes', {
|
33212 | get: function() {
|
33213 | if (!this.attributeMap || !this.attributeMap.nodes) {
|
33214 | this.attributeMap = new XMLNamedNodeMap(this.attribs);
|
33215 | }
|
33216 | return this.attributeMap;
|
33217 | }
|
33218 | });
|
33219 |
|
33220 | XMLElement.prototype.clone = function() {
|
33221 | var att, attName, clonedSelf, ref1;
|
33222 | clonedSelf = Object.create(this);
|
33223 | if (clonedSelf.isRoot) {
|
33224 | clonedSelf.documentObject = null;
|
33225 | }
|
33226 | clonedSelf.attribs = {};
|
33227 | ref1 = this.attribs;
|
33228 | for (attName in ref1) {
|
33229 | if (!hasProp.call(ref1, attName)) continue;
|
33230 | att = ref1[attName];
|
33231 | clonedSelf.attribs[attName] = att.clone();
|
33232 | }
|
33233 | clonedSelf.children = [];
|
33234 | this.children.forEach(function(child) {
|
33235 | var clonedChild;
|
33236 | clonedChild = child.clone();
|
33237 | clonedChild.parent = clonedSelf;
|
33238 | return clonedSelf.children.push(clonedChild);
|
33239 | });
|
33240 | return clonedSelf;
|
33241 | };
|
33242 |
|
33243 | XMLElement.prototype.attribute = function(name, value) {
|
33244 | var attName, attValue;
|
33245 | if (name != null) {
|
33246 | name = getValue(name);
|
33247 | }
|
33248 | if (isObject(name)) {
|
33249 | for (attName in name) {
|
33250 | if (!hasProp.call(name, attName)) continue;
|
33251 | attValue = name[attName];
|
33252 | this.attribute(attName, attValue);
|
33253 | }
|
33254 | } else {
|
33255 | if (isFunction(value)) {
|
33256 | value = value.apply();
|
33257 | }
|
33258 | if (this.options.keepNullAttributes && (value == null)) {
|
33259 | this.attribs[name] = new XMLAttribute(this, name, "");
|
33260 | } else if (value != null) {
|
33261 | this.attribs[name] = new XMLAttribute(this, name, value);
|
33262 | }
|
33263 | }
|
33264 | return this;
|
33265 | };
|
33266 |
|
33267 | XMLElement.prototype.removeAttribute = function(name) {
|
33268 | var attName, j, len;
|
33269 | if (name == null) {
|
33270 | throw new Error("Missing attribute name. " + this.debugInfo());
|
33271 | }
|
33272 | name = getValue(name);
|
33273 | if (Array.isArray(name)) {
|
33274 | for (j = 0, len = name.length; j < len; j++) {
|
33275 | attName = name[j];
|
33276 | delete this.attribs[attName];
|
33277 | }
|
33278 | } else {
|
33279 | delete this.attribs[name];
|
33280 | }
|
33281 | return this;
|
33282 | };
|
33283 |
|
33284 | XMLElement.prototype.toString = function(options) {
|
33285 | return this.options.writer.element(this, this.options.writer.filterOptions(options));
|
33286 | };
|
33287 |
|
33288 | XMLElement.prototype.att = function(name, value) {
|
33289 | return this.attribute(name, value);
|
33290 | };
|
33291 |
|
33292 | XMLElement.prototype.a = function(name, value) {
|
33293 | return this.attribute(name, value);
|
33294 | };
|
33295 |
|
33296 | XMLElement.prototype.getAttribute = function(name) {
|
33297 | if (this.attribs.hasOwnProperty(name)) {
|
33298 | return this.attribs[name].value;
|
33299 | } else {
|
33300 | return null;
|
33301 | }
|
33302 | };
|
33303 |
|
33304 | XMLElement.prototype.setAttribute = function(name, value) {
|
33305 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
33306 | };
|
33307 |
|
33308 | XMLElement.prototype.getAttributeNode = function(name) {
|
33309 | if (this.attribs.hasOwnProperty(name)) {
|
33310 | return this.attribs[name];
|
33311 | } else {
|
33312 | return null;
|
33313 | }
|
33314 | };
|
33315 |
|
33316 | XMLElement.prototype.setAttributeNode = function(newAttr) {
|
33317 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
33318 | };
|
33319 |
|
33320 | XMLElement.prototype.removeAttributeNode = function(oldAttr) {
|
33321 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
33322 | };
|
33323 |
|
33324 | XMLElement.prototype.getElementsByTagName = function(name) {
|
33325 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
33326 | };
|
33327 |
|
33328 | XMLElement.prototype.getAttributeNS = function(namespaceURI, localName) {
|
33329 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
33330 | };
|
33331 |
|
33332 | XMLElement.prototype.setAttributeNS = function(namespaceURI, qualifiedName, value) {
|
33333 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
33334 | };
|
33335 |
|
33336 | XMLElement.prototype.removeAttributeNS = function(namespaceURI, localName) {
|
33337 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
33338 | };
|
33339 |
|
33340 | XMLElement.prototype.getAttributeNodeNS = function(namespaceURI, localName) {
|
33341 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
33342 | };
|
33343 |
|
33344 | XMLElement.prototype.setAttributeNodeNS = function(newAttr) {
|
33345 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
33346 | };
|
33347 |
|
33348 | XMLElement.prototype.getElementsByTagNameNS = function(namespaceURI, localName) {
|
33349 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
33350 | };
|
33351 |
|
33352 | XMLElement.prototype.hasAttribute = function(name) {
|
33353 | return this.attribs.hasOwnProperty(name);
|
33354 | };
|
33355 |
|
33356 | XMLElement.prototype.hasAttributeNS = function(namespaceURI, localName) {
|
33357 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
33358 | };
|
33359 |
|
33360 | XMLElement.prototype.setIdAttribute = function(name, isId) {
|
33361 | if (this.attribs.hasOwnProperty(name)) {
|
33362 | return this.attribs[name].isId;
|
33363 | } else {
|
33364 | return isId;
|
33365 | }
|
33366 | };
|
33367 |
|
33368 | XMLElement.prototype.setIdAttributeNS = function(namespaceURI, localName, isId) {
|
33369 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
33370 | };
|
33371 |
|
33372 | XMLElement.prototype.setIdAttributeNode = function(idAttr, isId) {
|
33373 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
33374 | };
|
33375 |
|
33376 | XMLElement.prototype.getElementsByTagName = function(tagname) {
|
33377 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
33378 | };
|
33379 |
|
33380 | XMLElement.prototype.getElementsByTagNameNS = function(namespaceURI, localName) {
|
33381 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
33382 | };
|
33383 |
|
33384 | XMLElement.prototype.getElementsByClassName = function(classNames) {
|
33385 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
33386 | };
|
33387 |
|
33388 | XMLElement.prototype.isEqualNode = function(node) {
|
33389 | var i, j, ref1;
|
33390 | if (!XMLElement.__super__.isEqualNode.apply(this, arguments).isEqualNode(node)) {
|
33391 | return false;
|
33392 | }
|
33393 | if (node.namespaceURI !== this.namespaceURI) {
|
33394 | return false;
|
33395 | }
|
33396 | if (node.prefix !== this.prefix) {
|
33397 | return false;
|
33398 | }
|
33399 | if (node.localName !== this.localName) {
|
33400 | return false;
|
33401 | }
|
33402 | if (node.attribs.length !== this.attribs.length) {
|
33403 | return false;
|
33404 | }
|
33405 | for (i = j = 0, ref1 = this.attribs.length - 1; 0 <= ref1 ? j <= ref1 : j >= ref1; i = 0 <= ref1 ? ++j : --j) {
|
33406 | if (!this.attribs[i].isEqualNode(node.attribs[i])) {
|
33407 | return false;
|
33408 | }
|
33409 | }
|
33410 | return true;
|
33411 | };
|
33412 |
|
33413 | return XMLElement;
|
33414 |
|
33415 | })(XMLNode);
|
33416 |
|
33417 | }).call(this);
|
33418 |
|
33419 | },{"./NodeType":354,"./Utility":355,"./XMLAttribute":357,"./XMLNamedNodeMap":375,"./XMLNode":376}],375:[function(require,module,exports){
|
33420 |
|
33421 | (function() {
|
33422 | var XMLNamedNodeMap;
|
33423 |
|
33424 | module.exports = XMLNamedNodeMap = (function() {
|
33425 | function XMLNamedNodeMap(nodes) {
|
33426 | this.nodes = nodes;
|
33427 | }
|
33428 |
|
33429 | Object.defineProperty(XMLNamedNodeMap.prototype, 'length', {
|
33430 | get: function() {
|
33431 | return Object.keys(this.nodes).length || 0;
|
33432 | }
|
33433 | });
|
33434 |
|
33435 | XMLNamedNodeMap.prototype.clone = function() {
|
33436 | return this.nodes = null;
|
33437 | };
|
33438 |
|
33439 | XMLNamedNodeMap.prototype.getNamedItem = function(name) {
|
33440 | return this.nodes[name];
|
33441 | };
|
33442 |
|
33443 | XMLNamedNodeMap.prototype.setNamedItem = function(node) {
|
33444 | var oldNode;
|
33445 | oldNode = this.nodes[node.nodeName];
|
33446 | this.nodes[node.nodeName] = node;
|
33447 | return oldNode || null;
|
33448 | };
|
33449 |
|
33450 | XMLNamedNodeMap.prototype.removeNamedItem = function(name) {
|
33451 | var oldNode;
|
33452 | oldNode = this.nodes[name];
|
33453 | delete this.nodes[name];
|
33454 | return oldNode || null;
|
33455 | };
|
33456 |
|
33457 | XMLNamedNodeMap.prototype.item = function(index) {
|
33458 | return this.nodes[Object.keys(this.nodes)[index]] || null;
|
33459 | };
|
33460 |
|
33461 | XMLNamedNodeMap.prototype.getNamedItemNS = function(namespaceURI, localName) {
|
33462 | throw new Error("This DOM method is not implemented.");
|
33463 | };
|
33464 |
|
33465 | XMLNamedNodeMap.prototype.setNamedItemNS = function(node) {
|
33466 | throw new Error("This DOM method is not implemented.");
|
33467 | };
|
33468 |
|
33469 | XMLNamedNodeMap.prototype.removeNamedItemNS = function(namespaceURI, localName) {
|
33470 | throw new Error("This DOM method is not implemented.");
|
33471 | };
|
33472 |
|
33473 | return XMLNamedNodeMap;
|
33474 |
|
33475 | })();
|
33476 |
|
33477 | }).call(this);
|
33478 |
|
33479 | },{}],376:[function(require,module,exports){
|
33480 |
|
33481 | (function() {
|
33482 | var DocumentPosition, NodeType, XMLCData, XMLComment, XMLDeclaration, XMLDocType, XMLDummy, XMLElement, XMLNamedNodeMap, XMLNode, XMLNodeList, XMLProcessingInstruction, XMLRaw, XMLText, getValue, isEmpty, isFunction, isObject, ref1,
|
33483 | hasProp = {}.hasOwnProperty;
|
33484 |
|
33485 | ref1 = require('./Utility'), isObject = ref1.isObject, isFunction = ref1.isFunction, isEmpty = ref1.isEmpty, getValue = ref1.getValue;
|
33486 |
|
33487 | XMLElement = null;
|
33488 |
|
33489 | XMLCData = null;
|
33490 |
|
33491 | XMLComment = null;
|
33492 |
|
33493 | XMLDeclaration = null;
|
33494 |
|
33495 | XMLDocType = null;
|
33496 |
|
33497 | XMLRaw = null;
|
33498 |
|
33499 | XMLText = null;
|
33500 |
|
33501 | XMLProcessingInstruction = null;
|
33502 |
|
33503 | XMLDummy = null;
|
33504 |
|
33505 | NodeType = null;
|
33506 |
|
33507 | XMLNodeList = null;
|
33508 |
|
33509 | XMLNamedNodeMap = null;
|
33510 |
|
33511 | DocumentPosition = null;
|
33512 |
|
33513 | module.exports = XMLNode = (function() {
|
33514 | function XMLNode(parent1) {
|
33515 | this.parent = parent1;
|
33516 | if (this.parent) {
|
33517 | this.options = this.parent.options;
|
33518 | this.stringify = this.parent.stringify;
|
33519 | }
|
33520 | this.value = null;
|
33521 | this.children = [];
|
33522 | this.baseURI = null;
|
33523 | if (!XMLElement) {
|
33524 | XMLElement = require('./XMLElement');
|
33525 | XMLCData = require('./XMLCData');
|
33526 | XMLComment = require('./XMLComment');
|
33527 | XMLDeclaration = require('./XMLDeclaration');
|
33528 | XMLDocType = require('./XMLDocType');
|
33529 | XMLRaw = require('./XMLRaw');
|
33530 | XMLText = require('./XMLText');
|
33531 | XMLProcessingInstruction = require('./XMLProcessingInstruction');
|
33532 | XMLDummy = require('./XMLDummy');
|
33533 | NodeType = require('./NodeType');
|
33534 | XMLNodeList = require('./XMLNodeList');
|
33535 | XMLNamedNodeMap = require('./XMLNamedNodeMap');
|
33536 | DocumentPosition = require('./DocumentPosition');
|
33537 | }
|
33538 | }
|
33539 |
|
33540 | Object.defineProperty(XMLNode.prototype, 'nodeName', {
|
33541 | get: function() {
|
33542 | return this.name;
|
33543 | }
|
33544 | });
|
33545 |
|
33546 | Object.defineProperty(XMLNode.prototype, 'nodeType', {
|
33547 | get: function() {
|
33548 | return this.type;
|
33549 | }
|
33550 | });
|
33551 |
|
33552 | Object.defineProperty(XMLNode.prototype, 'nodeValue', {
|
33553 | get: function() {
|
33554 | return this.value;
|
33555 | }
|
33556 | });
|
33557 |
|
33558 | Object.defineProperty(XMLNode.prototype, 'parentNode', {
|
33559 | get: function() {
|
33560 | return this.parent;
|
33561 | }
|
33562 | });
|
33563 |
|
33564 | Object.defineProperty(XMLNode.prototype, 'childNodes', {
|
33565 | get: function() {
|
33566 | if (!this.childNodeList || !this.childNodeList.nodes) {
|
33567 | this.childNodeList = new XMLNodeList(this.children);
|
33568 | }
|
33569 | return this.childNodeList;
|
33570 | }
|
33571 | });
|
33572 |
|
33573 | Object.defineProperty(XMLNode.prototype, 'firstChild', {
|
33574 | get: function() {
|
33575 | return this.children[0] || null;
|
33576 | }
|
33577 | });
|
33578 |
|
33579 | Object.defineProperty(XMLNode.prototype, 'lastChild', {
|
33580 | get: function() {
|
33581 | return this.children[this.children.length - 1] || null;
|
33582 | }
|
33583 | });
|
33584 |
|
33585 | Object.defineProperty(XMLNode.prototype, 'previousSibling', {
|
33586 | get: function() {
|
33587 | var i;
|
33588 | i = this.parent.children.indexOf(this);
|
33589 | return this.parent.children[i - 1] || null;
|
33590 | }
|
33591 | });
|
33592 |
|
33593 | Object.defineProperty(XMLNode.prototype, 'nextSibling', {
|
33594 | get: function() {
|
33595 | var i;
|
33596 | i = this.parent.children.indexOf(this);
|
33597 | return this.parent.children[i + 1] || null;
|
33598 | }
|
33599 | });
|
33600 |
|
33601 | Object.defineProperty(XMLNode.prototype, 'ownerDocument', {
|
33602 | get: function() {
|
33603 | return this.document() || null;
|
33604 | }
|
33605 | });
|
33606 |
|
33607 | Object.defineProperty(XMLNode.prototype, 'textContent', {
|
33608 | get: function() {
|
33609 | var child, j, len, ref2, str;
|
33610 | if (this.nodeType === NodeType.Element || this.nodeType === NodeType.DocumentFragment) {
|
33611 | str = '';
|
33612 | ref2 = this.children;
|
33613 | for (j = 0, len = ref2.length; j < len; j++) {
|
33614 | child = ref2[j];
|
33615 | if (child.textContent) {
|
33616 | str += child.textContent;
|
33617 | }
|
33618 | }
|
33619 | return str;
|
33620 | } else {
|
33621 | return null;
|
33622 | }
|
33623 | },
|
33624 | set: function(value) {
|
33625 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
33626 | }
|
33627 | });
|
33628 |
|
33629 | XMLNode.prototype.setParent = function(parent) {
|
33630 | var child, j, len, ref2, results;
|
33631 | this.parent = parent;
|
33632 | if (parent) {
|
33633 | this.options = parent.options;
|
33634 | this.stringify = parent.stringify;
|
33635 | }
|
33636 | ref2 = this.children;
|
33637 | results = [];
|
33638 | for (j = 0, len = ref2.length; j < len; j++) {
|
33639 | child = ref2[j];
|
33640 | results.push(child.setParent(this));
|
33641 | }
|
33642 | return results;
|
33643 | };
|
33644 |
|
33645 | XMLNode.prototype.element = function(name, attributes, text) {
|
33646 | var childNode, item, j, k, key, lastChild, len, len1, ref2, ref3, val;
|
33647 | lastChild = null;
|
33648 | if (attributes === null && (text == null)) {
|
33649 | ref2 = [{}, null], attributes = ref2[0], text = ref2[1];
|
33650 | }
|
33651 | if (attributes == null) {
|
33652 | attributes = {};
|
33653 | }
|
33654 | attributes = getValue(attributes);
|
33655 | if (!isObject(attributes)) {
|
33656 | ref3 = [attributes, text], text = ref3[0], attributes = ref3[1];
|
33657 | }
|
33658 | if (name != null) {
|
33659 | name = getValue(name);
|
33660 | }
|
33661 | if (Array.isArray(name)) {
|
33662 | for (j = 0, len = name.length; j < len; j++) {
|
33663 | item = name[j];
|
33664 | lastChild = this.element(item);
|
33665 | }
|
33666 | } else if (isFunction(name)) {
|
33667 | lastChild = this.element(name.apply());
|
33668 | } else if (isObject(name)) {
|
33669 | for (key in name) {
|
33670 | if (!hasProp.call(name, key)) continue;
|
33671 | val = name[key];
|
33672 | if (isFunction(val)) {
|
33673 | val = val.apply();
|
33674 | }
|
33675 | if (!this.options.ignoreDecorators && this.stringify.convertAttKey && key.indexOf(this.stringify.convertAttKey) === 0) {
|
33676 | lastChild = this.attribute(key.substr(this.stringify.convertAttKey.length), val);
|
33677 | } else if (!this.options.separateArrayItems && Array.isArray(val) && isEmpty(val)) {
|
33678 | lastChild = this.dummy();
|
33679 | } else if (isObject(val) && isEmpty(val)) {
|
33680 | lastChild = this.element(key);
|
33681 | } else if (!this.options.keepNullNodes && (val == null)) {
|
33682 | lastChild = this.dummy();
|
33683 | } else if (!this.options.separateArrayItems && Array.isArray(val)) {
|
33684 | for (k = 0, len1 = val.length; k < len1; k++) {
|
33685 | item = val[k];
|
33686 | childNode = {};
|
33687 | childNode[key] = item;
|
33688 | lastChild = this.element(childNode);
|
33689 | }
|
33690 | } else if (isObject(val)) {
|
33691 | if (!this.options.ignoreDecorators && this.stringify.convertTextKey && key.indexOf(this.stringify.convertTextKey) === 0) {
|
33692 | lastChild = this.element(val);
|
33693 | } else {
|
33694 | lastChild = this.element(key);
|
33695 | lastChild.element(val);
|
33696 | }
|
33697 | } else {
|
33698 | lastChild = this.element(key, val);
|
33699 | }
|
33700 | }
|
33701 | } else if (!this.options.keepNullNodes && text === null) {
|
33702 | lastChild = this.dummy();
|
33703 | } else {
|
33704 | if (!this.options.ignoreDecorators && this.stringify.convertTextKey && name.indexOf(this.stringify.convertTextKey) === 0) {
|
33705 | lastChild = this.text(text);
|
33706 | } else if (!this.options.ignoreDecorators && this.stringify.convertCDataKey && name.indexOf(this.stringify.convertCDataKey) === 0) {
|
33707 | lastChild = this.cdata(text);
|
33708 | } else if (!this.options.ignoreDecorators && this.stringify.convertCommentKey && name.indexOf(this.stringify.convertCommentKey) === 0) {
|
33709 | lastChild = this.comment(text);
|
33710 | } else if (!this.options.ignoreDecorators && this.stringify.convertRawKey && name.indexOf(this.stringify.convertRawKey) === 0) {
|
33711 | lastChild = this.raw(text);
|
33712 | } else if (!this.options.ignoreDecorators && this.stringify.convertPIKey && name.indexOf(this.stringify.convertPIKey) === 0) {
|
33713 | lastChild = this.instruction(name.substr(this.stringify.convertPIKey.length), text);
|
33714 | } else {
|
33715 | lastChild = this.node(name, attributes, text);
|
33716 | }
|
33717 | }
|
33718 | if (lastChild == null) {
|
33719 | throw new Error("Could not create any elements with: " + name + ". " + this.debugInfo());
|
33720 | }
|
33721 | return lastChild;
|
33722 | };
|
33723 |
|
33724 | XMLNode.prototype.insertBefore = function(name, attributes, text) {
|
33725 | var child, i, newChild, refChild, removed;
|
33726 | if (name != null ? name.type : void 0) {
|
33727 | newChild = name;
|
33728 | refChild = attributes;
|
33729 | newChild.setParent(this);
|
33730 | if (refChild) {
|
33731 | i = children.indexOf(refChild);
|
33732 | removed = children.splice(i);
|
33733 | children.push(newChild);
|
33734 | Array.prototype.push.apply(children, removed);
|
33735 | } else {
|
33736 | children.push(newChild);
|
33737 | }
|
33738 | return newChild;
|
33739 | } else {
|
33740 | if (this.isRoot) {
|
33741 | throw new Error("Cannot insert elements at root level. " + this.debugInfo(name));
|
33742 | }
|
33743 | i = this.parent.children.indexOf(this);
|
33744 | removed = this.parent.children.splice(i);
|
33745 | child = this.parent.element(name, attributes, text);
|
33746 | Array.prototype.push.apply(this.parent.children, removed);
|
33747 | return child;
|
33748 | }
|
33749 | };
|
33750 |
|
33751 | XMLNode.prototype.insertAfter = function(name, attributes, text) {
|
33752 | var child, i, removed;
|
33753 | if (this.isRoot) {
|
33754 | throw new Error("Cannot insert elements at root level. " + this.debugInfo(name));
|
33755 | }
|
33756 | i = this.parent.children.indexOf(this);
|
33757 | removed = this.parent.children.splice(i + 1);
|
33758 | child = this.parent.element(name, attributes, text);
|
33759 | Array.prototype.push.apply(this.parent.children, removed);
|
33760 | return child;
|
33761 | };
|
33762 |
|
33763 | XMLNode.prototype.remove = function() {
|
33764 | var i, ref2;
|
33765 | if (this.isRoot) {
|
33766 | throw new Error("Cannot remove the root element. " + this.debugInfo());
|
33767 | }
|
33768 | i = this.parent.children.indexOf(this);
|
33769 | [].splice.apply(this.parent.children, [i, i - i + 1].concat(ref2 = [])), ref2;
|
33770 | return this.parent;
|
33771 | };
|
33772 |
|
33773 | XMLNode.prototype.node = function(name, attributes, text) {
|
33774 | var child, ref2;
|
33775 | if (name != null) {
|
33776 | name = getValue(name);
|
33777 | }
|
33778 | attributes || (attributes = {});
|
33779 | attributes = getValue(attributes);
|
33780 | if (!isObject(attributes)) {
|
33781 | ref2 = [attributes, text], text = ref2[0], attributes = ref2[1];
|
33782 | }
|
33783 | child = new XMLElement(this, name, attributes);
|
33784 | if (text != null) {
|
33785 | child.text(text);
|
33786 | }
|
33787 | this.children.push(child);
|
33788 | return child;
|
33789 | };
|
33790 |
|
33791 | XMLNode.prototype.text = function(value) {
|
33792 | var child;
|
33793 | if (isObject(value)) {
|
33794 | this.element(value);
|
33795 | }
|
33796 | child = new XMLText(this, value);
|
33797 | this.children.push(child);
|
33798 | return this;
|
33799 | };
|
33800 |
|
33801 | XMLNode.prototype.cdata = function(value) {
|
33802 | var child;
|
33803 | child = new XMLCData(this, value);
|
33804 | this.children.push(child);
|
33805 | return this;
|
33806 | };
|
33807 |
|
33808 | XMLNode.prototype.comment = function(value) {
|
33809 | var child;
|
33810 | child = new XMLComment(this, value);
|
33811 | this.children.push(child);
|
33812 | return this;
|
33813 | };
|
33814 |
|
33815 | XMLNode.prototype.commentBefore = function(value) {
|
33816 | var child, i, removed;
|
33817 | i = this.parent.children.indexOf(this);
|
33818 | removed = this.parent.children.splice(i);
|
33819 | child = this.parent.comment(value);
|
33820 | Array.prototype.push.apply(this.parent.children, removed);
|
33821 | return this;
|
33822 | };
|
33823 |
|
33824 | XMLNode.prototype.commentAfter = function(value) {
|
33825 | var child, i, removed;
|
33826 | i = this.parent.children.indexOf(this);
|
33827 | removed = this.parent.children.splice(i + 1);
|
33828 | child = this.parent.comment(value);
|
33829 | Array.prototype.push.apply(this.parent.children, removed);
|
33830 | return this;
|
33831 | };
|
33832 |
|
33833 | XMLNode.prototype.raw = function(value) {
|
33834 | var child;
|
33835 | child = new XMLRaw(this, value);
|
33836 | this.children.push(child);
|
33837 | return this;
|
33838 | };
|
33839 |
|
33840 | XMLNode.prototype.dummy = function() {
|
33841 | var child;
|
33842 | child = new XMLDummy(this);
|
33843 | return child;
|
33844 | };
|
33845 |
|
33846 | XMLNode.prototype.instruction = function(target, value) {
|
33847 | var insTarget, insValue, instruction, j, len;
|
33848 | if (target != null) {
|
33849 | target = getValue(target);
|
33850 | }
|
33851 | if (value != null) {
|
33852 | value = getValue(value);
|
33853 | }
|
33854 | if (Array.isArray(target)) {
|
33855 | for (j = 0, len = target.length; j < len; j++) {
|
33856 | insTarget = target[j];
|
33857 | this.instruction(insTarget);
|
33858 | }
|
33859 | } else if (isObject(target)) {
|
33860 | for (insTarget in target) {
|
33861 | if (!hasProp.call(target, insTarget)) continue;
|
33862 | insValue = target[insTarget];
|
33863 | this.instruction(insTarget, insValue);
|
33864 | }
|
33865 | } else {
|
33866 | if (isFunction(value)) {
|
33867 | value = value.apply();
|
33868 | }
|
33869 | instruction = new XMLProcessingInstruction(this, target, value);
|
33870 | this.children.push(instruction);
|
33871 | }
|
33872 | return this;
|
33873 | };
|
33874 |
|
33875 | XMLNode.prototype.instructionBefore = function(target, value) {
|
33876 | var child, i, removed;
|
33877 | i = this.parent.children.indexOf(this);
|
33878 | removed = this.parent.children.splice(i);
|
33879 | child = this.parent.instruction(target, value);
|
33880 | Array.prototype.push.apply(this.parent.children, removed);
|
33881 | return this;
|
33882 | };
|
33883 |
|
33884 | XMLNode.prototype.instructionAfter = function(target, value) {
|
33885 | var child, i, removed;
|
33886 | i = this.parent.children.indexOf(this);
|
33887 | removed = this.parent.children.splice(i + 1);
|
33888 | child = this.parent.instruction(target, value);
|
33889 | Array.prototype.push.apply(this.parent.children, removed);
|
33890 | return this;
|
33891 | };
|
33892 |
|
33893 | XMLNode.prototype.declaration = function(version, encoding, standalone) {
|
33894 | var doc, xmldec;
|
33895 | doc = this.document();
|
33896 | xmldec = new XMLDeclaration(doc, version, encoding, standalone);
|
33897 | if (doc.children.length === 0) {
|
33898 | doc.children.unshift(xmldec);
|
33899 | } else if (doc.children[0].type === NodeType.Declaration) {
|
33900 | doc.children[0] = xmldec;
|
33901 | } else {
|
33902 | doc.children.unshift(xmldec);
|
33903 | }
|
33904 | return doc.root() || doc;
|
33905 | };
|
33906 |
|
33907 | XMLNode.prototype.dtd = function(pubID, sysID) {
|
33908 | var child, doc, doctype, i, j, k, len, len1, ref2, ref3;
|
33909 | doc = this.document();
|
33910 | doctype = new XMLDocType(doc, pubID, sysID);
|
33911 | ref2 = doc.children;
|
33912 | for (i = j = 0, len = ref2.length; j < len; i = ++j) {
|
33913 | child = ref2[i];
|
33914 | if (child.type === NodeType.DocType) {
|
33915 | doc.children[i] = doctype;
|
33916 | return doctype;
|
33917 | }
|
33918 | }
|
33919 | ref3 = doc.children;
|
33920 | for (i = k = 0, len1 = ref3.length; k < len1; i = ++k) {
|
33921 | child = ref3[i];
|
33922 | if (child.isRoot) {
|
33923 | doc.children.splice(i, 0, doctype);
|
33924 | return doctype;
|
33925 | }
|
33926 | }
|
33927 | doc.children.push(doctype);
|
33928 | return doctype;
|
33929 | };
|
33930 |
|
33931 | XMLNode.prototype.up = function() {
|
33932 | if (this.isRoot) {
|
33933 | throw new Error("The root node has no parent. Use doc() if you need to get the document object.");
|
33934 | }
|
33935 | return this.parent;
|
33936 | };
|
33937 |
|
33938 | XMLNode.prototype.root = function() {
|
33939 | var node;
|
33940 | node = this;
|
33941 | while (node) {
|
33942 | if (node.type === NodeType.Document) {
|
33943 | return node.rootObject;
|
33944 | } else if (node.isRoot) {
|
33945 | return node;
|
33946 | } else {
|
33947 | node = node.parent;
|
33948 | }
|
33949 | }
|
33950 | };
|
33951 |
|
33952 | XMLNode.prototype.document = function() {
|
33953 | var node;
|
33954 | node = this;
|
33955 | while (node) {
|
33956 | if (node.type === NodeType.Document) {
|
33957 | return node;
|
33958 | } else {
|
33959 | node = node.parent;
|
33960 | }
|
33961 | }
|
33962 | };
|
33963 |
|
33964 | XMLNode.prototype.end = function(options) {
|
33965 | return this.document().end(options);
|
33966 | };
|
33967 |
|
33968 | XMLNode.prototype.prev = function() {
|
33969 | var i;
|
33970 | i = this.parent.children.indexOf(this);
|
33971 | if (i < 1) {
|
33972 | throw new Error("Already at the first node. " + this.debugInfo());
|
33973 | }
|
33974 | return this.parent.children[i - 1];
|
33975 | };
|
33976 |
|
33977 | XMLNode.prototype.next = function() {
|
33978 | var i;
|
33979 | i = this.parent.children.indexOf(this);
|
33980 | if (i === -1 || i === this.parent.children.length - 1) {
|
33981 | throw new Error("Already at the last node. " + this.debugInfo());
|
33982 | }
|
33983 | return this.parent.children[i + 1];
|
33984 | };
|
33985 |
|
33986 | XMLNode.prototype.importDocument = function(doc) {
|
33987 | var clonedRoot;
|
33988 | clonedRoot = doc.root().clone();
|
33989 | clonedRoot.parent = this;
|
33990 | clonedRoot.isRoot = false;
|
33991 | this.children.push(clonedRoot);
|
33992 | return this;
|
33993 | };
|
33994 |
|
33995 | XMLNode.prototype.debugInfo = function(name) {
|
33996 | var ref2, ref3;
|
33997 | name = name || this.name;
|
33998 | if ((name == null) && !((ref2 = this.parent) != null ? ref2.name : void 0)) {
|
33999 | return "";
|
34000 | } else if (name == null) {
|
34001 | return "parent: <" + this.parent.name + ">";
|
34002 | } else if (!((ref3 = this.parent) != null ? ref3.name : void 0)) {
|
34003 | return "node: <" + name + ">";
|
34004 | } else {
|
34005 | return "node: <" + name + ">, parent: <" + this.parent.name + ">";
|
34006 | }
|
34007 | };
|
34008 |
|
34009 | XMLNode.prototype.ele = function(name, attributes, text) {
|
34010 | return this.element(name, attributes, text);
|
34011 | };
|
34012 |
|
34013 | XMLNode.prototype.nod = function(name, attributes, text) {
|
34014 | return this.node(name, attributes, text);
|
34015 | };
|
34016 |
|
34017 | XMLNode.prototype.txt = function(value) {
|
34018 | return this.text(value);
|
34019 | };
|
34020 |
|
34021 | XMLNode.prototype.dat = function(value) {
|
34022 | return this.cdata(value);
|
34023 | };
|
34024 |
|
34025 | XMLNode.prototype.com = function(value) {
|
34026 | return this.comment(value);
|
34027 | };
|
34028 |
|
34029 | XMLNode.prototype.ins = function(target, value) {
|
34030 | return this.instruction(target, value);
|
34031 | };
|
34032 |
|
34033 | XMLNode.prototype.doc = function() {
|
34034 | return this.document();
|
34035 | };
|
34036 |
|
34037 | XMLNode.prototype.dec = function(version, encoding, standalone) {
|
34038 | return this.declaration(version, encoding, standalone);
|
34039 | };
|
34040 |
|
34041 | XMLNode.prototype.e = function(name, attributes, text) {
|
34042 | return this.element(name, attributes, text);
|
34043 | };
|
34044 |
|
34045 | XMLNode.prototype.n = function(name, attributes, text) {
|
34046 | return this.node(name, attributes, text);
|
34047 | };
|
34048 |
|
34049 | XMLNode.prototype.t = function(value) {
|
34050 | return this.text(value);
|
34051 | };
|
34052 |
|
34053 | XMLNode.prototype.d = function(value) {
|
34054 | return this.cdata(value);
|
34055 | };
|
34056 |
|
34057 | XMLNode.prototype.c = function(value) {
|
34058 | return this.comment(value);
|
34059 | };
|
34060 |
|
34061 | XMLNode.prototype.r = function(value) {
|
34062 | return this.raw(value);
|
34063 | };
|
34064 |
|
34065 | XMLNode.prototype.i = function(target, value) {
|
34066 | return this.instruction(target, value);
|
34067 | };
|
34068 |
|
34069 | XMLNode.prototype.u = function() {
|
34070 | return this.up();
|
34071 | };
|
34072 |
|
34073 | XMLNode.prototype.importXMLBuilder = function(doc) {
|
34074 | return this.importDocument(doc);
|
34075 | };
|
34076 |
|
34077 | XMLNode.prototype.replaceChild = function(newChild, oldChild) {
|
34078 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
34079 | };
|
34080 |
|
34081 | XMLNode.prototype.removeChild = function(oldChild) {
|
34082 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
34083 | };
|
34084 |
|
34085 | XMLNode.prototype.appendChild = function(newChild) {
|
34086 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
34087 | };
|
34088 |
|
34089 | XMLNode.prototype.hasChildNodes = function() {
|
34090 | return this.children.length !== 0;
|
34091 | };
|
34092 |
|
34093 | XMLNode.prototype.cloneNode = function(deep) {
|
34094 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
34095 | };
|
34096 |
|
34097 | XMLNode.prototype.normalize = function() {
|
34098 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
34099 | };
|
34100 |
|
34101 | XMLNode.prototype.isSupported = function(feature, version) {
|
34102 | return true;
|
34103 | };
|
34104 |
|
34105 | XMLNode.prototype.hasAttributes = function() {
|
34106 | return this.attribs.length !== 0;
|
34107 | };
|
34108 |
|
34109 | XMLNode.prototype.compareDocumentPosition = function(other) {
|
34110 | var ref, res;
|
34111 | ref = this;
|
34112 | if (ref === other) {
|
34113 | return 0;
|
34114 | } else if (this.document() !== other.document()) {
|
34115 | res = DocumentPosition.Disconnected | DocumentPosition.ImplementationSpecific;
|
34116 | if (Math.random() < 0.5) {
|
34117 | res |= DocumentPosition.Preceding;
|
34118 | } else {
|
34119 | res |= DocumentPosition.Following;
|
34120 | }
|
34121 | return res;
|
34122 | } else if (ref.isAncestor(other)) {
|
34123 | return DocumentPosition.Contains | DocumentPosition.Preceding;
|
34124 | } else if (ref.isDescendant(other)) {
|
34125 | return DocumentPosition.Contains | DocumentPosition.Following;
|
34126 | } else if (ref.isPreceding(other)) {
|
34127 | return DocumentPosition.Preceding;
|
34128 | } else {
|
34129 | return DocumentPosition.Following;
|
34130 | }
|
34131 | };
|
34132 |
|
34133 | XMLNode.prototype.isSameNode = function(other) {
|
34134 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
34135 | };
|
34136 |
|
34137 | XMLNode.prototype.lookupPrefix = function(namespaceURI) {
|
34138 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
34139 | };
|
34140 |
|
34141 | XMLNode.prototype.isDefaultNamespace = function(namespaceURI) {
|
34142 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
34143 | };
|
34144 |
|
34145 | XMLNode.prototype.lookupNamespaceURI = function(prefix) {
|
34146 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
34147 | };
|
34148 |
|
34149 | XMLNode.prototype.isEqualNode = function(node) {
|
34150 | var i, j, ref2;
|
34151 | if (node.nodeType !== this.nodeType) {
|
34152 | return false;
|
34153 | }
|
34154 | if (node.children.length !== this.children.length) {
|
34155 | return false;
|
34156 | }
|
34157 | for (i = j = 0, ref2 = this.children.length - 1; 0 <= ref2 ? j <= ref2 : j >= ref2; i = 0 <= ref2 ? ++j : --j) {
|
34158 | if (!this.children[i].isEqualNode(node.children[i])) {
|
34159 | return false;
|
34160 | }
|
34161 | }
|
34162 | return true;
|
34163 | };
|
34164 |
|
34165 | XMLNode.prototype.getFeature = function(feature, version) {
|
34166 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
34167 | };
|
34168 |
|
34169 | XMLNode.prototype.setUserData = function(key, data, handler) {
|
34170 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
34171 | };
|
34172 |
|
34173 | XMLNode.prototype.getUserData = function(key) {
|
34174 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
34175 | };
|
34176 |
|
34177 | XMLNode.prototype.contains = function(other) {
|
34178 | if (!other) {
|
34179 | return false;
|
34180 | }
|
34181 | return other === this || this.isDescendant(other);
|
34182 | };
|
34183 |
|
34184 | XMLNode.prototype.isDescendant = function(node) {
|
34185 | var child, isDescendantChild, j, len, ref2;
|
34186 | ref2 = this.children;
|
34187 | for (j = 0, len = ref2.length; j < len; j++) {
|
34188 | child = ref2[j];
|
34189 | if (node === child) {
|
34190 | return true;
|
34191 | }
|
34192 | isDescendantChild = child.isDescendant(node);
|
34193 | if (isDescendantChild) {
|
34194 | return true;
|
34195 | }
|
34196 | }
|
34197 | return false;
|
34198 | };
|
34199 |
|
34200 | XMLNode.prototype.isAncestor = function(node) {
|
34201 | return node.isDescendant(this);
|
34202 | };
|
34203 |
|
34204 | XMLNode.prototype.isPreceding = function(node) {
|
34205 | var nodePos, thisPos;
|
34206 | nodePos = this.treePosition(node);
|
34207 | thisPos = this.treePosition(this);
|
34208 | if (nodePos === -1 || thisPos === -1) {
|
34209 | return false;
|
34210 | } else {
|
34211 | return nodePos < thisPos;
|
34212 | }
|
34213 | };
|
34214 |
|
34215 | XMLNode.prototype.isFollowing = function(node) {
|
34216 | var nodePos, thisPos;
|
34217 | nodePos = this.treePosition(node);
|
34218 | thisPos = this.treePosition(this);
|
34219 | if (nodePos === -1 || thisPos === -1) {
|
34220 | return false;
|
34221 | } else {
|
34222 | return nodePos > thisPos;
|
34223 | }
|
34224 | };
|
34225 |
|
34226 | XMLNode.prototype.treePosition = function(node) {
|
34227 | var found, pos;
|
34228 | pos = 0;
|
34229 | found = false;
|
34230 | this.foreachTreeNode(this.document(), function(childNode) {
|
34231 | pos++;
|
34232 | if (!found && childNode === node) {
|
34233 | return found = true;
|
34234 | }
|
34235 | });
|
34236 | if (found) {
|
34237 | return pos;
|
34238 | } else {
|
34239 | return -1;
|
34240 | }
|
34241 | };
|
34242 |
|
34243 | XMLNode.prototype.foreachTreeNode = function(node, func) {
|
34244 | var child, j, len, ref2, res;
|
34245 | node || (node = this.document());
|
34246 | ref2 = node.children;
|
34247 | for (j = 0, len = ref2.length; j < len; j++) {
|
34248 | child = ref2[j];
|
34249 | if (res = func(child)) {
|
34250 | return res;
|
34251 | } else {
|
34252 | res = this.foreachTreeNode(child, func);
|
34253 | if (res) {
|
34254 | return res;
|
34255 | }
|
34256 | }
|
34257 | }
|
34258 | };
|
34259 |
|
34260 | return XMLNode;
|
34261 |
|
34262 | })();
|
34263 |
|
34264 | }).call(this);
|
34265 |
|
34266 | },{"./DocumentPosition":353,"./NodeType":354,"./Utility":355,"./XMLCData":358,"./XMLComment":360,"./XMLDeclaration":369,"./XMLDocType":370,"./XMLDummy":373,"./XMLElement":374,"./XMLNamedNodeMap":375,"./XMLNodeList":377,"./XMLProcessingInstruction":378,"./XMLRaw":379,"./XMLText":383}],377:[function(require,module,exports){
|
34267 |
|
34268 | (function() {
|
34269 | var XMLNodeList;
|
34270 |
|
34271 | module.exports = XMLNodeList = (function() {
|
34272 | function XMLNodeList(nodes) {
|
34273 | this.nodes = nodes;
|
34274 | }
|
34275 |
|
34276 | Object.defineProperty(XMLNodeList.prototype, 'length', {
|
34277 | get: function() {
|
34278 | return this.nodes.length || 0;
|
34279 | }
|
34280 | });
|
34281 |
|
34282 | XMLNodeList.prototype.clone = function() {
|
34283 | return this.nodes = null;
|
34284 | };
|
34285 |
|
34286 | XMLNodeList.prototype.item = function(index) {
|
34287 | return this.nodes[index] || null;
|
34288 | };
|
34289 |
|
34290 | return XMLNodeList;
|
34291 |
|
34292 | })();
|
34293 |
|
34294 | }).call(this);
|
34295 |
|
34296 | },{}],378:[function(require,module,exports){
|
34297 |
|
34298 | (function() {
|
34299 | var NodeType, XMLCharacterData, XMLProcessingInstruction,
|
34300 | extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
|
34301 | hasProp = {}.hasOwnProperty;
|
34302 |
|
34303 | NodeType = require('./NodeType');
|
34304 |
|
34305 | XMLCharacterData = require('./XMLCharacterData');
|
34306 |
|
34307 | module.exports = XMLProcessingInstruction = (function(superClass) {
|
34308 | extend(XMLProcessingInstruction, superClass);
|
34309 |
|
34310 | function XMLProcessingInstruction(parent, target, value) {
|
34311 | XMLProcessingInstruction.__super__.constructor.call(this, parent);
|
34312 | if (target == null) {
|
34313 | throw new Error("Missing instruction target. " + this.debugInfo());
|
34314 | }
|
34315 | this.type = NodeType.ProcessingInstruction;
|
34316 | this.target = this.stringify.insTarget(target);
|
34317 | this.name = this.target;
|
34318 | if (value) {
|
34319 | this.value = this.stringify.insValue(value);
|
34320 | }
|
34321 | }
|
34322 |
|
34323 | XMLProcessingInstruction.prototype.clone = function() {
|
34324 | return Object.create(this);
|
34325 | };
|
34326 |
|
34327 | XMLProcessingInstruction.prototype.toString = function(options) {
|
34328 | return this.options.writer.processingInstruction(this, this.options.writer.filterOptions(options));
|
34329 | };
|
34330 |
|
34331 | XMLProcessingInstruction.prototype.isEqualNode = function(node) {
|
34332 | if (!XMLProcessingInstruction.__super__.isEqualNode.apply(this, arguments).isEqualNode(node)) {
|
34333 | return false;
|
34334 | }
|
34335 | if (node.target !== this.target) {
|
34336 | return false;
|
34337 | }
|
34338 | return true;
|
34339 | };
|
34340 |
|
34341 | return XMLProcessingInstruction;
|
34342 |
|
34343 | })(XMLCharacterData);
|
34344 |
|
34345 | }).call(this);
|
34346 |
|
34347 | },{"./NodeType":354,"./XMLCharacterData":359}],379:[function(require,module,exports){
|
34348 |
|
34349 | (function() {
|
34350 | var NodeType, XMLNode, XMLRaw,
|
34351 | extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
|
34352 | hasProp = {}.hasOwnProperty;
|
34353 |
|
34354 | NodeType = require('./NodeType');
|
34355 |
|
34356 | XMLNode = require('./XMLNode');
|
34357 |
|
34358 | module.exports = XMLRaw = (function(superClass) {
|
34359 | extend(XMLRaw, superClass);
|
34360 |
|
34361 | function XMLRaw(parent, text) {
|
34362 | XMLRaw.__super__.constructor.call(this, parent);
|
34363 | if (text == null) {
|
34364 | throw new Error("Missing raw text. " + this.debugInfo());
|
34365 | }
|
34366 | this.type = NodeType.Raw;
|
34367 | this.value = this.stringify.raw(text);
|
34368 | }
|
34369 |
|
34370 | XMLRaw.prototype.clone = function() {
|
34371 | return Object.create(this);
|
34372 | };
|
34373 |
|
34374 | XMLRaw.prototype.toString = function(options) {
|
34375 | return this.options.writer.raw(this, this.options.writer.filterOptions(options));
|
34376 | };
|
34377 |
|
34378 | return XMLRaw;
|
34379 |
|
34380 | })(XMLNode);
|
34381 |
|
34382 | }).call(this);
|
34383 |
|
34384 | },{"./NodeType":354,"./XMLNode":376}],380:[function(require,module,exports){
|
34385 |
|
34386 | (function() {
|
34387 | var NodeType, WriterState, XMLStreamWriter, XMLWriterBase,
|
34388 | extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
|
34389 | hasProp = {}.hasOwnProperty;
|
34390 |
|
34391 | NodeType = require('./NodeType');
|
34392 |
|
34393 | XMLWriterBase = require('./XMLWriterBase');
|
34394 |
|
34395 | WriterState = require('./WriterState');
|
34396 |
|
34397 | module.exports = XMLStreamWriter = (function(superClass) {
|
34398 | extend(XMLStreamWriter, superClass);
|
34399 |
|
34400 | function XMLStreamWriter(stream, options) {
|
34401 | this.stream = stream;
|
34402 | XMLStreamWriter.__super__.constructor.call(this, options);
|
34403 | }
|
34404 |
|
34405 | XMLStreamWriter.prototype.endline = function(node, options, level) {
|
34406 | if (node.isLastRootNode && options.state === WriterState.CloseTag) {
|
34407 | return '';
|
34408 | } else {
|
34409 | return XMLStreamWriter.__super__.endline.call(this, node, options, level);
|
34410 | }
|
34411 | };
|
34412 |
|
34413 | XMLStreamWriter.prototype.document = function(doc, options) {
|
34414 | var child, i, j, k, len, len1, ref, ref1, results;
|
34415 | ref = doc.children;
|
34416 | for (i = j = 0, len = ref.length; j < len; i = ++j) {
|
34417 | child = ref[i];
|
34418 | child.isLastRootNode = i === doc.children.length - 1;
|
34419 | }
|
34420 | options = this.filterOptions(options);
|
34421 | ref1 = doc.children;
|
34422 | results = [];
|
34423 | for (k = 0, len1 = ref1.length; k < len1; k++) {
|
34424 | child = ref1[k];
|
34425 | results.push(this.writeChildNode(child, options, 0));
|
34426 | }
|
34427 | return results;
|
34428 | };
|
34429 |
|
34430 | XMLStreamWriter.prototype.attribute = function(att, options, level) {
|
34431 | return this.stream.write(XMLStreamWriter.__super__.attribute.call(this, att, options, level));
|
34432 | };
|
34433 |
|
34434 | XMLStreamWriter.prototype.cdata = function(node, options, level) {
|
34435 | return this.stream.write(XMLStreamWriter.__super__.cdata.call(this, node, options, level));
|
34436 | };
|
34437 |
|
34438 | XMLStreamWriter.prototype.comment = function(node, options, level) {
|
34439 | return this.stream.write(XMLStreamWriter.__super__.comment.call(this, node, options, level));
|
34440 | };
|
34441 |
|
34442 | XMLStreamWriter.prototype.declaration = function(node, options, level) {
|
34443 | return this.stream.write(XMLStreamWriter.__super__.declaration.call(this, node, options, level));
|
34444 | };
|
34445 |
|
34446 | XMLStreamWriter.prototype.docType = function(node, options, level) {
|
34447 | var child, j, len, ref;
|
34448 | level || (level = 0);
|
34449 | this.openNode(node, options, level);
|
34450 | options.state = WriterState.OpenTag;
|
34451 | this.stream.write(this.indent(node, options, level));
|
34452 | this.stream.write('<!DOCTYPE ' + node.root().name);
|
34453 | if (node.pubID && node.sysID) {
|
34454 | this.stream.write(' PUBLIC "' + node.pubID + '" "' + node.sysID + '"');
|
34455 | } else if (node.sysID) {
|
34456 | this.stream.write(' SYSTEM "' + node.sysID + '"');
|
34457 | }
|
34458 | if (node.children.length > 0) {
|
34459 | this.stream.write(' [');
|
34460 | this.stream.write(this.endline(node, options, level));
|
34461 | options.state = WriterState.InsideTag;
|
34462 | ref = node.children;
|
34463 | for (j = 0, len = ref.length; j < len; j++) {
|
34464 | child = ref[j];
|
34465 | this.writeChildNode(child, options, level + 1);
|
34466 | }
|
34467 | options.state = WriterState.CloseTag;
|
34468 | this.stream.write(']');
|
34469 | }
|
34470 | options.state = WriterState.CloseTag;
|
34471 | this.stream.write(options.spaceBeforeSlash + '>');
|
34472 | this.stream.write(this.endline(node, options, level));
|
34473 | options.state = WriterState.None;
|
34474 | return this.closeNode(node, options, level);
|
34475 | };
|
34476 |
|
34477 | XMLStreamWriter.prototype.element = function(node, options, level) {
|
34478 | var att, child, childNodeCount, firstChildNode, j, len, name, prettySuppressed, ref, ref1;
|
34479 | level || (level = 0);
|
34480 | this.openNode(node, options, level);
|
34481 | options.state = WriterState.OpenTag;
|
34482 | this.stream.write(this.indent(node, options, level) + '<' + node.name);
|
34483 | ref = node.attribs;
|
34484 | for (name in ref) {
|
34485 | if (!hasProp.call(ref, name)) continue;
|
34486 | att = ref[name];
|
34487 | this.attribute(att, options, level);
|
34488 | }
|
34489 | childNodeCount = node.children.length;
|
34490 | firstChildNode = childNodeCount === 0 ? null : node.children[0];
|
34491 | if (childNodeCount === 0 || node.children.every(function(e) {
|
34492 | return (e.type === NodeType.Text || e.type === NodeType.Raw) && e.value === '';
|
34493 | })) {
|
34494 | if (options.allowEmpty) {
|
34495 | this.stream.write('>');
|
34496 | options.state = WriterState.CloseTag;
|
34497 | this.stream.write('</' + node.name + '>');
|
34498 | } else {
|
34499 | options.state = WriterState.CloseTag;
|
34500 | this.stream.write(options.spaceBeforeSlash + '/>');
|
34501 | }
|
34502 | } else if (options.pretty && childNodeCount === 1 && (firstChildNode.type === NodeType.Text || firstChildNode.type === NodeType.Raw) && (firstChildNode.value != null)) {
|
34503 | this.stream.write('>');
|
34504 | options.state = WriterState.InsideTag;
|
34505 | options.suppressPrettyCount++;
|
34506 | prettySuppressed = true;
|
34507 | this.writeChildNode(firstChildNode, options, level + 1);
|
34508 | options.suppressPrettyCount--;
|
34509 | prettySuppressed = false;
|
34510 | options.state = WriterState.CloseTag;
|
34511 | this.stream.write('</' + node.name + '>');
|
34512 | } else {
|
34513 | this.stream.write('>' + this.endline(node, options, level));
|
34514 | options.state = WriterState.InsideTag;
|
34515 | ref1 = node.children;
|
34516 | for (j = 0, len = ref1.length; j < len; j++) {
|
34517 | child = ref1[j];
|
34518 | this.writeChildNode(child, options, level + 1);
|
34519 | }
|
34520 | options.state = WriterState.CloseTag;
|
34521 | this.stream.write(this.indent(node, options, level) + '</' + node.name + '>');
|
34522 | }
|
34523 | this.stream.write(this.endline(node, options, level));
|
34524 | options.state = WriterState.None;
|
34525 | return this.closeNode(node, options, level);
|
34526 | };
|
34527 |
|
34528 | XMLStreamWriter.prototype.processingInstruction = function(node, options, level) {
|
34529 | return this.stream.write(XMLStreamWriter.__super__.processingInstruction.call(this, node, options, level));
|
34530 | };
|
34531 |
|
34532 | XMLStreamWriter.prototype.raw = function(node, options, level) {
|
34533 | return this.stream.write(XMLStreamWriter.__super__.raw.call(this, node, options, level));
|
34534 | };
|
34535 |
|
34536 | XMLStreamWriter.prototype.text = function(node, options, level) {
|
34537 | return this.stream.write(XMLStreamWriter.__super__.text.call(this, node, options, level));
|
34538 | };
|
34539 |
|
34540 | XMLStreamWriter.prototype.dtdAttList = function(node, options, level) {
|
34541 | return this.stream.write(XMLStreamWriter.__super__.dtdAttList.call(this, node, options, level));
|
34542 | };
|
34543 |
|
34544 | XMLStreamWriter.prototype.dtdElement = function(node, options, level) {
|
34545 | return this.stream.write(XMLStreamWriter.__super__.dtdElement.call(this, node, options, level));
|
34546 | };
|
34547 |
|
34548 | XMLStreamWriter.prototype.dtdEntity = function(node, options, level) {
|
34549 | return this.stream.write(XMLStreamWriter.__super__.dtdEntity.call(this, node, options, level));
|
34550 | };
|
34551 |
|
34552 | XMLStreamWriter.prototype.dtdNotation = function(node, options, level) {
|
34553 | return this.stream.write(XMLStreamWriter.__super__.dtdNotation.call(this, node, options, level));
|
34554 | };
|
34555 |
|
34556 | return XMLStreamWriter;
|
34557 |
|
34558 | })(XMLWriterBase);
|
34559 |
|
34560 | }).call(this);
|
34561 |
|
34562 | },{"./NodeType":354,"./WriterState":356,"./XMLWriterBase":384}],381:[function(require,module,exports){
|
34563 |
|
34564 | (function() {
|
34565 | var XMLStringWriter, XMLWriterBase,
|
34566 | extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
|
34567 | hasProp = {}.hasOwnProperty;
|
34568 |
|
34569 | XMLWriterBase = require('./XMLWriterBase');
|
34570 |
|
34571 | module.exports = XMLStringWriter = (function(superClass) {
|
34572 | extend(XMLStringWriter, superClass);
|
34573 |
|
34574 | function XMLStringWriter(options) {
|
34575 | XMLStringWriter.__super__.constructor.call(this, options);
|
34576 | }
|
34577 |
|
34578 | XMLStringWriter.prototype.document = function(doc, options) {
|
34579 | var child, i, len, r, ref;
|
34580 | options = this.filterOptions(options);
|
34581 | r = '';
|
34582 | ref = doc.children;
|
34583 | for (i = 0, len = ref.length; i < len; i++) {
|
34584 | child = ref[i];
|
34585 | r += this.writeChildNode(child, options, 0);
|
34586 | }
|
34587 | if (options.pretty && r.slice(-options.newline.length) === options.newline) {
|
34588 | r = r.slice(0, -options.newline.length);
|
34589 | }
|
34590 | return r;
|
34591 | };
|
34592 |
|
34593 | return XMLStringWriter;
|
34594 |
|
34595 | })(XMLWriterBase);
|
34596 |
|
34597 | }).call(this);
|
34598 |
|
34599 | },{"./XMLWriterBase":384}],382:[function(require,module,exports){
|
34600 |
|
34601 | (function() {
|
34602 | var XMLStringifier,
|
34603 | bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
|
34604 | hasProp = {}.hasOwnProperty;
|
34605 |
|
34606 | module.exports = XMLStringifier = (function() {
|
34607 | function XMLStringifier(options) {
|
34608 | this.assertLegalName = bind(this.assertLegalName, this);
|
34609 | this.assertLegalChar = bind(this.assertLegalChar, this);
|
34610 | var key, ref, value;
|
34611 | options || (options = {});
|
34612 | this.options = options;
|
34613 | if (!this.options.version) {
|
34614 | this.options.version = '1.0';
|
34615 | }
|
34616 | ref = options.stringify || {};
|
34617 | for (key in ref) {
|
34618 | if (!hasProp.call(ref, key)) continue;
|
34619 | value = ref[key];
|
34620 | this[key] = value;
|
34621 | }
|
34622 | }
|
34623 |
|
34624 | XMLStringifier.prototype.name = function(val) {
|
34625 | if (this.options.noValidation) {
|
34626 | return val;
|
34627 | }
|
34628 | return this.assertLegalName('' + val || '');
|
34629 | };
|
34630 |
|
34631 | XMLStringifier.prototype.text = function(val) {
|
34632 | if (this.options.noValidation) {
|
34633 | return val;
|
34634 | }
|
34635 | return this.assertLegalChar(this.textEscape('' + val || ''));
|
34636 | };
|
34637 |
|
34638 | XMLStringifier.prototype.cdata = function(val) {
|
34639 | if (this.options.noValidation) {
|
34640 | return val;
|
34641 | }
|
34642 | val = '' + val || '';
|
34643 | val = val.replace(']]>', ']]]]><![CDATA[>');
|
34644 | return this.assertLegalChar(val);
|
34645 | };
|
34646 |
|
34647 | XMLStringifier.prototype.comment = function(val) {
|
34648 | if (this.options.noValidation) {
|
34649 | return val;
|
34650 | }
|
34651 | val = '' + val || '';
|
34652 | if (val.match(/--/)) {
|
34653 | throw new Error("Comment text cannot contain double-hypen: " + val);
|
34654 | }
|
34655 | return this.assertLegalChar(val);
|
34656 | };
|
34657 |
|
34658 | XMLStringifier.prototype.raw = function(val) {
|
34659 | if (this.options.noValidation) {
|
34660 | return val;
|
34661 | }
|
34662 | return '' + val || '';
|
34663 | };
|
34664 |
|
34665 | XMLStringifier.prototype.attValue = function(val) {
|
34666 | if (this.options.noValidation) {
|
34667 | return val;
|
34668 | }
|
34669 | return this.assertLegalChar(this.attEscape(val = '' + val || ''));
|
34670 | };
|
34671 |
|
34672 | XMLStringifier.prototype.insTarget = function(val) {
|
34673 | if (this.options.noValidation) {
|
34674 | return val;
|
34675 | }
|
34676 | return this.assertLegalChar('' + val || '');
|
34677 | };
|
34678 |
|
34679 | XMLStringifier.prototype.insValue = function(val) {
|
34680 | if (this.options.noValidation) {
|
34681 | return val;
|
34682 | }
|
34683 | val = '' + val || '';
|
34684 | if (val.match(/\?>/)) {
|
34685 | throw new Error("Invalid processing instruction value: " + val);
|
34686 | }
|
34687 | return this.assertLegalChar(val);
|
34688 | };
|
34689 |
|
34690 | XMLStringifier.prototype.xmlVersion = function(val) {
|
34691 | if (this.options.noValidation) {
|
34692 | return val;
|
34693 | }
|
34694 | val = '' + val || '';
|
34695 | if (!val.match(/1\.[0-9]+/)) {
|
34696 | throw new Error("Invalid version number: " + val);
|
34697 | }
|
34698 | return val;
|
34699 | };
|
34700 |
|
34701 | XMLStringifier.prototype.xmlEncoding = function(val) {
|
34702 | if (this.options.noValidation) {
|
34703 | return val;
|
34704 | }
|
34705 | val = '' + val || '';
|
34706 | if (!val.match(/^[A-Za-z](?:[A-Za-z0-9._-])*$/)) {
|
34707 | throw new Error("Invalid encoding: " + val);
|
34708 | }
|
34709 | return this.assertLegalChar(val);
|
34710 | };
|
34711 |
|
34712 | XMLStringifier.prototype.xmlStandalone = function(val) {
|
34713 | if (this.options.noValidation) {
|
34714 | return val;
|
34715 | }
|
34716 | if (val) {
|
34717 | return "yes";
|
34718 | } else {
|
34719 | return "no";
|
34720 | }
|
34721 | };
|
34722 |
|
34723 | XMLStringifier.prototype.dtdPubID = function(val) {
|
34724 | if (this.options.noValidation) {
|
34725 | return val;
|
34726 | }
|
34727 | return this.assertLegalChar('' + val || '');
|
34728 | };
|
34729 |
|
34730 | XMLStringifier.prototype.dtdSysID = function(val) {
|
34731 | if (this.options.noValidation) {
|
34732 | return val;
|
34733 | }
|
34734 | return this.assertLegalChar('' + val || '');
|
34735 | };
|
34736 |
|
34737 | XMLStringifier.prototype.dtdElementValue = function(val) {
|
34738 | if (this.options.noValidation) {
|
34739 | return val;
|
34740 | }
|
34741 | return this.assertLegalChar('' + val || '');
|
34742 | };
|
34743 |
|
34744 | XMLStringifier.prototype.dtdAttType = function(val) {
|
34745 | if (this.options.noValidation) {
|
34746 | return val;
|
34747 | }
|
34748 | return this.assertLegalChar('' + val || '');
|
34749 | };
|
34750 |
|
34751 | XMLStringifier.prototype.dtdAttDefault = function(val) {
|
34752 | if (this.options.noValidation) {
|
34753 | return val;
|
34754 | }
|
34755 | return this.assertLegalChar('' + val || '');
|
34756 | };
|
34757 |
|
34758 | XMLStringifier.prototype.dtdEntityValue = function(val) {
|
34759 | if (this.options.noValidation) {
|
34760 | return val;
|
34761 | }
|
34762 | return this.assertLegalChar('' + val || '');
|
34763 | };
|
34764 |
|
34765 | XMLStringifier.prototype.dtdNData = function(val) {
|
34766 | if (this.options.noValidation) {
|
34767 | return val;
|
34768 | }
|
34769 | return this.assertLegalChar('' + val || '');
|
34770 | };
|
34771 |
|
34772 | XMLStringifier.prototype.convertAttKey = '@';
|
34773 |
|
34774 | XMLStringifier.prototype.convertPIKey = '?';
|
34775 |
|
34776 | XMLStringifier.prototype.convertTextKey = '#text';
|
34777 |
|
34778 | XMLStringifier.prototype.convertCDataKey = '#cdata';
|
34779 |
|
34780 | XMLStringifier.prototype.convertCommentKey = '#comment';
|
34781 |
|
34782 | XMLStringifier.prototype.convertRawKey = '#raw';
|
34783 |
|
34784 | XMLStringifier.prototype.assertLegalChar = function(str) {
|
34785 | var regex, res;
|
34786 | if (this.options.noValidation) {
|
34787 | return str;
|
34788 | }
|
34789 | regex = '';
|
34790 | if (this.options.version === '1.0') {
|
34791 | regex = /[\0-\x08\x0B\f\x0E-\x1F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/;
|
34792 | if (res = str.match(regex)) {
|
34793 | throw new Error("Invalid character in string: " + str + " at index " + res.index);
|
34794 | }
|
34795 | } else if (this.options.version === '1.1') {
|
34796 | regex = /[\0\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/;
|
34797 | if (res = str.match(regex)) {
|
34798 | throw new Error("Invalid character in string: " + str + " at index " + res.index);
|
34799 | }
|
34800 | }
|
34801 | return str;
|
34802 | };
|
34803 |
|
34804 | XMLStringifier.prototype.assertLegalName = function(str) {
|
34805 | var regex;
|
34806 | if (this.options.noValidation) {
|
34807 | return str;
|
34808 | }
|
34809 | this.assertLegalChar(str);
|
34810 | regex = /^([:A-Z_a-z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])([\x2D\.0-:A-Z_a-z\xB7\xC0-\xD6\xD8-\xF6\xF8-\u037D\u037F-\u1FFF\u200C\u200D\u203F\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])*$/;
|
34811 | if (!str.match(regex)) {
|
34812 | throw new Error("Invalid character in name");
|
34813 | }
|
34814 | return str;
|
34815 | };
|
34816 |
|
34817 | XMLStringifier.prototype.textEscape = function(str) {
|
34818 | var ampregex;
|
34819 | if (this.options.noValidation) {
|
34820 | return str;
|
34821 | }
|
34822 | ampregex = this.options.noDoubleEncoding ? /(?!&\S+;)&/g : /&/g;
|
34823 | return str.replace(ampregex, '&').replace(/</g, '<').replace(/>/g, '>').replace(/\r/g, '
');
|
34824 | };
|
34825 |
|
34826 | XMLStringifier.prototype.attEscape = function(str) {
|
34827 | var ampregex;
|
34828 | if (this.options.noValidation) {
|
34829 | return str;
|
34830 | }
|
34831 | ampregex = this.options.noDoubleEncoding ? /(?!&\S+;)&/g : /&/g;
|
34832 | return str.replace(ampregex, '&').replace(/</g, '<').replace(/"/g, '"').replace(/\t/g, '	').replace(/\n/g, '
').replace(/\r/g, '
');
|
34833 | };
|
34834 |
|
34835 | return XMLStringifier;
|
34836 |
|
34837 | })();
|
34838 |
|
34839 | }).call(this);
|
34840 |
|
34841 | },{}],383:[function(require,module,exports){
|
34842 |
|
34843 | (function() {
|
34844 | var NodeType, XMLCharacterData, XMLText,
|
34845 | extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
|
34846 | hasProp = {}.hasOwnProperty;
|
34847 |
|
34848 | NodeType = require('./NodeType');
|
34849 |
|
34850 | XMLCharacterData = require('./XMLCharacterData');
|
34851 |
|
34852 | module.exports = XMLText = (function(superClass) {
|
34853 | extend(XMLText, superClass);
|
34854 |
|
34855 | function XMLText(parent, text) {
|
34856 | XMLText.__super__.constructor.call(this, parent);
|
34857 | if (text == null) {
|
34858 | throw new Error("Missing element text. " + this.debugInfo());
|
34859 | }
|
34860 | this.name = "#text";
|
34861 | this.type = NodeType.Text;
|
34862 | this.value = this.stringify.text(text);
|
34863 | }
|
34864 |
|
34865 | Object.defineProperty(XMLText.prototype, 'isElementContentWhitespace', {
|
34866 | get: function() {
|
34867 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
34868 | }
|
34869 | });
|
34870 |
|
34871 | Object.defineProperty(XMLText.prototype, 'wholeText', {
|
34872 | get: function() {
|
34873 | var next, prev, str;
|
34874 | str = '';
|
34875 | prev = this.previousSibling;
|
34876 | while (prev) {
|
34877 | str = prev.data + str;
|
34878 | prev = prev.previousSibling;
|
34879 | }
|
34880 | str += this.data;
|
34881 | next = this.nextSibling;
|
34882 | while (next) {
|
34883 | str = str + next.data;
|
34884 | next = next.nextSibling;
|
34885 | }
|
34886 | return str;
|
34887 | }
|
34888 | });
|
34889 |
|
34890 | XMLText.prototype.clone = function() {
|
34891 | return Object.create(this);
|
34892 | };
|
34893 |
|
34894 | XMLText.prototype.toString = function(options) {
|
34895 | return this.options.writer.text(this, this.options.writer.filterOptions(options));
|
34896 | };
|
34897 |
|
34898 | XMLText.prototype.splitText = function(offset) {
|
34899 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
34900 | };
|
34901 |
|
34902 | XMLText.prototype.replaceWholeText = function(content) {
|
34903 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
34904 | };
|
34905 |
|
34906 | return XMLText;
|
34907 |
|
34908 | })(XMLCharacterData);
|
34909 |
|
34910 | }).call(this);
|
34911 |
|
34912 | },{"./NodeType":354,"./XMLCharacterData":359}],384:[function(require,module,exports){
|
34913 |
|
34914 | (function() {
|
34915 | var NodeType, WriterState, XMLCData, XMLComment, XMLDTDAttList, XMLDTDElement, XMLDTDEntity, XMLDTDNotation, XMLDeclaration, XMLDocType, XMLDummy, XMLElement, XMLProcessingInstruction, XMLRaw, XMLText, XMLWriterBase, assign,
|
34916 | hasProp = {}.hasOwnProperty;
|
34917 |
|
34918 | assign = require('./Utility').assign;
|
34919 |
|
34920 | NodeType = require('./NodeType');
|
34921 |
|
34922 | XMLDeclaration = require('./XMLDeclaration');
|
34923 |
|
34924 | XMLDocType = require('./XMLDocType');
|
34925 |
|
34926 | XMLCData = require('./XMLCData');
|
34927 |
|
34928 | XMLComment = require('./XMLComment');
|
34929 |
|
34930 | XMLElement = require('./XMLElement');
|
34931 |
|
34932 | XMLRaw = require('./XMLRaw');
|
34933 |
|
34934 | XMLText = require('./XMLText');
|
34935 |
|
34936 | XMLProcessingInstruction = require('./XMLProcessingInstruction');
|
34937 |
|
34938 | XMLDummy = require('./XMLDummy');
|
34939 |
|
34940 | XMLDTDAttList = require('./XMLDTDAttList');
|
34941 |
|
34942 | XMLDTDElement = require('./XMLDTDElement');
|
34943 |
|
34944 | XMLDTDEntity = require('./XMLDTDEntity');
|
34945 |
|
34946 | XMLDTDNotation = require('./XMLDTDNotation');
|
34947 |
|
34948 | WriterState = require('./WriterState');
|
34949 |
|
34950 | module.exports = XMLWriterBase = (function() {
|
34951 | function XMLWriterBase(options) {
|
34952 | var key, ref, value;
|
34953 | options || (options = {});
|
34954 | this.options = options;
|
34955 | ref = options.writer || {};
|
34956 | for (key in ref) {
|
34957 | if (!hasProp.call(ref, key)) continue;
|
34958 | value = ref[key];
|
34959 | this["_" + key] = this[key];
|
34960 | this[key] = value;
|
34961 | }
|
34962 | }
|
34963 |
|
34964 | XMLWriterBase.prototype.filterOptions = function(options) {
|
34965 | var filteredOptions, ref, ref1, ref2, ref3, ref4, ref5, ref6;
|
34966 | options || (options = {});
|
34967 | options = assign({}, this.options, options);
|
34968 | filteredOptions = {
|
34969 | writer: this
|
34970 | };
|
34971 | filteredOptions.pretty = options.pretty || false;
|
34972 | filteredOptions.allowEmpty = options.allowEmpty || false;
|
34973 | filteredOptions.indent = (ref = options.indent) != null ? ref : ' ';
|
34974 | filteredOptions.newline = (ref1 = options.newline) != null ? ref1 : '\n';
|
34975 | filteredOptions.offset = (ref2 = options.offset) != null ? ref2 : 0;
|
34976 | filteredOptions.dontPrettyTextNodes = (ref3 = (ref4 = options.dontPrettyTextNodes) != null ? ref4 : options.dontprettytextnodes) != null ? ref3 : 0;
|
34977 | filteredOptions.spaceBeforeSlash = (ref5 = (ref6 = options.spaceBeforeSlash) != null ? ref6 : options.spacebeforeslash) != null ? ref5 : '';
|
34978 | if (filteredOptions.spaceBeforeSlash === true) {
|
34979 | filteredOptions.spaceBeforeSlash = ' ';
|
34980 | }
|
34981 | filteredOptions.suppressPrettyCount = 0;
|
34982 | filteredOptions.user = {};
|
34983 | filteredOptions.state = WriterState.None;
|
34984 | return filteredOptions;
|
34985 | };
|
34986 |
|
34987 | XMLWriterBase.prototype.indent = function(node, options, level) {
|
34988 | var indentLevel;
|
34989 | if (!options.pretty || options.suppressPrettyCount) {
|
34990 | return '';
|
34991 | } else if (options.pretty) {
|
34992 | indentLevel = (level || 0) + options.offset + 1;
|
34993 | if (indentLevel > 0) {
|
34994 | return new Array(indentLevel).join(options.indent);
|
34995 | }
|
34996 | }
|
34997 | return '';
|
34998 | };
|
34999 |
|
35000 | XMLWriterBase.prototype.endline = function(node, options, level) {
|
35001 | if (!options.pretty || options.suppressPrettyCount) {
|
35002 | return '';
|
35003 | } else {
|
35004 | return options.newline;
|
35005 | }
|
35006 | };
|
35007 |
|
35008 | XMLWriterBase.prototype.attribute = function(att, options, level) {
|
35009 | var r;
|
35010 | this.openAttribute(att, options, level);
|
35011 | r = ' ' + att.name + '="' + att.value + '"';
|
35012 | this.closeAttribute(att, options, level);
|
35013 | return r;
|
35014 | };
|
35015 |
|
35016 | XMLWriterBase.prototype.cdata = function(node, options, level) {
|
35017 | var r;
|
35018 | this.openNode(node, options, level);
|
35019 | options.state = WriterState.OpenTag;
|
35020 | r = this.indent(node, options, level) + '<![CDATA[';
|
35021 | options.state = WriterState.InsideTag;
|
35022 | r += node.value;
|
35023 | options.state = WriterState.CloseTag;
|
35024 | r += ']]>' + this.endline(node, options, level);
|
35025 | options.state = WriterState.None;
|
35026 | this.closeNode(node, options, level);
|
35027 | return r;
|
35028 | };
|
35029 |
|
35030 | XMLWriterBase.prototype.comment = function(node, options, level) {
|
35031 | var r;
|
35032 | this.openNode(node, options, level);
|
35033 | options.state = WriterState.OpenTag;
|
35034 | r = this.indent(node, options, level) + '<!-- ';
|
35035 | options.state = WriterState.InsideTag;
|
35036 | r += node.value;
|
35037 | options.state = WriterState.CloseTag;
|
35038 | r += ' -->' + this.endline(node, options, level);
|
35039 | options.state = WriterState.None;
|
35040 | this.closeNode(node, options, level);
|
35041 | return r;
|
35042 | };
|
35043 |
|
35044 | XMLWriterBase.prototype.declaration = function(node, options, level) {
|
35045 | var r;
|
35046 | this.openNode(node, options, level);
|
35047 | options.state = WriterState.OpenTag;
|
35048 | r = this.indent(node, options, level) + '<?xml';
|
35049 | options.state = WriterState.InsideTag;
|
35050 | r += ' version="' + node.version + '"';
|
35051 | if (node.encoding != null) {
|
35052 | r += ' encoding="' + node.encoding + '"';
|
35053 | }
|
35054 | if (node.standalone != null) {
|
35055 | r += ' standalone="' + node.standalone + '"';
|
35056 | }
|
35057 | options.state = WriterState.CloseTag;
|
35058 | r += options.spaceBeforeSlash + '?>';
|
35059 | r += this.endline(node, options, level);
|
35060 | options.state = WriterState.None;
|
35061 | this.closeNode(node, options, level);
|
35062 | return r;
|
35063 | };
|
35064 |
|
35065 | XMLWriterBase.prototype.docType = function(node, options, level) {
|
35066 | var child, i, len, r, ref;
|
35067 | level || (level = 0);
|
35068 | this.openNode(node, options, level);
|
35069 | options.state = WriterState.OpenTag;
|
35070 | r = this.indent(node, options, level);
|
35071 | r += '<!DOCTYPE ' + node.root().name;
|
35072 | if (node.pubID && node.sysID) {
|
35073 | r += ' PUBLIC "' + node.pubID + '" "' + node.sysID + '"';
|
35074 | } else if (node.sysID) {
|
35075 | r += ' SYSTEM "' + node.sysID + '"';
|
35076 | }
|
35077 | if (node.children.length > 0) {
|
35078 | r += ' [';
|
35079 | r += this.endline(node, options, level);
|
35080 | options.state = WriterState.InsideTag;
|
35081 | ref = node.children;
|
35082 | for (i = 0, len = ref.length; i < len; i++) {
|
35083 | child = ref[i];
|
35084 | r += this.writeChildNode(child, options, level + 1);
|
35085 | }
|
35086 | options.state = WriterState.CloseTag;
|
35087 | r += ']';
|
35088 | }
|
35089 | options.state = WriterState.CloseTag;
|
35090 | r += options.spaceBeforeSlash + '>';
|
35091 | r += this.endline(node, options, level);
|
35092 | options.state = WriterState.None;
|
35093 | this.closeNode(node, options, level);
|
35094 | return r;
|
35095 | };
|
35096 |
|
35097 | XMLWriterBase.prototype.element = function(node, options, level) {
|
35098 | var att, child, childNodeCount, firstChildNode, i, j, len, len1, name, prettySuppressed, r, ref, ref1, ref2;
|
35099 | level || (level = 0);
|
35100 | prettySuppressed = false;
|
35101 | r = '';
|
35102 | this.openNode(node, options, level);
|
35103 | options.state = WriterState.OpenTag;
|
35104 | r += this.indent(node, options, level) + '<' + node.name;
|
35105 | ref = node.attribs;
|
35106 | for (name in ref) {
|
35107 | if (!hasProp.call(ref, name)) continue;
|
35108 | att = ref[name];
|
35109 | r += this.attribute(att, options, level);
|
35110 | }
|
35111 | childNodeCount = node.children.length;
|
35112 | firstChildNode = childNodeCount === 0 ? null : node.children[0];
|
35113 | if (childNodeCount === 0 || node.children.every(function(e) {
|
35114 | return (e.type === NodeType.Text || e.type === NodeType.Raw) && e.value === '';
|
35115 | })) {
|
35116 | if (options.allowEmpty) {
|
35117 | r += '>';
|
35118 | options.state = WriterState.CloseTag;
|
35119 | r += '</' + node.name + '>' + this.endline(node, options, level);
|
35120 | } else {
|
35121 | options.state = WriterState.CloseTag;
|
35122 | r += options.spaceBeforeSlash + '/>' + this.endline(node, options, level);
|
35123 | }
|
35124 | } else if (options.pretty && childNodeCount === 1 && (firstChildNode.type === NodeType.Text || firstChildNode.type === NodeType.Raw) && (firstChildNode.value != null)) {
|
35125 | r += '>';
|
35126 | options.state = WriterState.InsideTag;
|
35127 | options.suppressPrettyCount++;
|
35128 | prettySuppressed = true;
|
35129 | r += this.writeChildNode(firstChildNode, options, level + 1);
|
35130 | options.suppressPrettyCount--;
|
35131 | prettySuppressed = false;
|
35132 | options.state = WriterState.CloseTag;
|
35133 | r += '</' + node.name + '>' + this.endline(node, options, level);
|
35134 | } else {
|
35135 | if (options.dontPrettyTextNodes) {
|
35136 | ref1 = node.children;
|
35137 | for (i = 0, len = ref1.length; i < len; i++) {
|
35138 | child = ref1[i];
|
35139 | if ((child.type === NodeType.Text || child.type === NodeType.Raw) && (child.value != null)) {
|
35140 | options.suppressPrettyCount++;
|
35141 | prettySuppressed = true;
|
35142 | break;
|
35143 | }
|
35144 | }
|
35145 | }
|
35146 | r += '>' + this.endline(node, options, level);
|
35147 | options.state = WriterState.InsideTag;
|
35148 | ref2 = node.children;
|
35149 | for (j = 0, len1 = ref2.length; j < len1; j++) {
|
35150 | child = ref2[j];
|
35151 | r += this.writeChildNode(child, options, level + 1);
|
35152 | }
|
35153 | options.state = WriterState.CloseTag;
|
35154 | r += this.indent(node, options, level) + '</' + node.name + '>';
|
35155 | if (prettySuppressed) {
|
35156 | options.suppressPrettyCount--;
|
35157 | }
|
35158 | r += this.endline(node, options, level);
|
35159 | options.state = WriterState.None;
|
35160 | }
|
35161 | this.closeNode(node, options, level);
|
35162 | return r;
|
35163 | };
|
35164 |
|
35165 | XMLWriterBase.prototype.writeChildNode = function(node, options, level) {
|
35166 | switch (node.type) {
|
35167 | case NodeType.CData:
|
35168 | return this.cdata(node, options, level);
|
35169 | case NodeType.Comment:
|
35170 | return this.comment(node, options, level);
|
35171 | case NodeType.Element:
|
35172 | return this.element(node, options, level);
|
35173 | case NodeType.Raw:
|
35174 | return this.raw(node, options, level);
|
35175 | case NodeType.Text:
|
35176 | return this.text(node, options, level);
|
35177 | case NodeType.ProcessingInstruction:
|
35178 | return this.processingInstruction(node, options, level);
|
35179 | case NodeType.Dummy:
|
35180 | return '';
|
35181 | case NodeType.Declaration:
|
35182 | return this.declaration(node, options, level);
|
35183 | case NodeType.DocType:
|
35184 | return this.docType(node, options, level);
|
35185 | case NodeType.AttributeDeclaration:
|
35186 | return this.dtdAttList(node, options, level);
|
35187 | case NodeType.ElementDeclaration:
|
35188 | return this.dtdElement(node, options, level);
|
35189 | case NodeType.EntityDeclaration:
|
35190 | return this.dtdEntity(node, options, level);
|
35191 | case NodeType.NotationDeclaration:
|
35192 | return this.dtdNotation(node, options, level);
|
35193 | default:
|
35194 | throw new Error("Unknown XML node type: " + node.constructor.name);
|
35195 | }
|
35196 | };
|
35197 |
|
35198 | XMLWriterBase.prototype.processingInstruction = function(node, options, level) {
|
35199 | var r;
|
35200 | this.openNode(node, options, level);
|
35201 | options.state = WriterState.OpenTag;
|
35202 | r = this.indent(node, options, level) + '<?';
|
35203 | options.state = WriterState.InsideTag;
|
35204 | r += node.target;
|
35205 | if (node.value) {
|
35206 | r += ' ' + node.value;
|
35207 | }
|
35208 | options.state = WriterState.CloseTag;
|
35209 | r += options.spaceBeforeSlash + '?>';
|
35210 | r += this.endline(node, options, level);
|
35211 | options.state = WriterState.None;
|
35212 | this.closeNode(node, options, level);
|
35213 | return r;
|
35214 | };
|
35215 |
|
35216 | XMLWriterBase.prototype.raw = function(node, options, level) {
|
35217 | var r;
|
35218 | this.openNode(node, options, level);
|
35219 | options.state = WriterState.OpenTag;
|
35220 | r = this.indent(node, options, level);
|
35221 | options.state = WriterState.InsideTag;
|
35222 | r += node.value;
|
35223 | options.state = WriterState.CloseTag;
|
35224 | r += this.endline(node, options, level);
|
35225 | options.state = WriterState.None;
|
35226 | this.closeNode(node, options, level);
|
35227 | return r;
|
35228 | };
|
35229 |
|
35230 | XMLWriterBase.prototype.text = function(node, options, level) {
|
35231 | var r;
|
35232 | this.openNode(node, options, level);
|
35233 | options.state = WriterState.OpenTag;
|
35234 | r = this.indent(node, options, level);
|
35235 | options.state = WriterState.InsideTag;
|
35236 | r += node.value;
|
35237 | options.state = WriterState.CloseTag;
|
35238 | r += this.endline(node, options, level);
|
35239 | options.state = WriterState.None;
|
35240 | this.closeNode(node, options, level);
|
35241 | return r;
|
35242 | };
|
35243 |
|
35244 | XMLWriterBase.prototype.dtdAttList = function(node, options, level) {
|
35245 | var r;
|
35246 | this.openNode(node, options, level);
|
35247 | options.state = WriterState.OpenTag;
|
35248 | r = this.indent(node, options, level) + '<!ATTLIST';
|
35249 | options.state = WriterState.InsideTag;
|
35250 | r += ' ' + node.elementName + ' ' + node.attributeName + ' ' + node.attributeType;
|
35251 | if (node.defaultValueType !== '#DEFAULT') {
|
35252 | r += ' ' + node.defaultValueType;
|
35253 | }
|
35254 | if (node.defaultValue) {
|
35255 | r += ' "' + node.defaultValue + '"';
|
35256 | }
|
35257 | options.state = WriterState.CloseTag;
|
35258 | r += options.spaceBeforeSlash + '>' + this.endline(node, options, level);
|
35259 | options.state = WriterState.None;
|
35260 | this.closeNode(node, options, level);
|
35261 | return r;
|
35262 | };
|
35263 |
|
35264 | XMLWriterBase.prototype.dtdElement = function(node, options, level) {
|
35265 | var r;
|
35266 | this.openNode(node, options, level);
|
35267 | options.state = WriterState.OpenTag;
|
35268 | r = this.indent(node, options, level) + '<!ELEMENT';
|
35269 | options.state = WriterState.InsideTag;
|
35270 | r += ' ' + node.name + ' ' + node.value;
|
35271 | options.state = WriterState.CloseTag;
|
35272 | r += options.spaceBeforeSlash + '>' + this.endline(node, options, level);
|
35273 | options.state = WriterState.None;
|
35274 | this.closeNode(node, options, level);
|
35275 | return r;
|
35276 | };
|
35277 |
|
35278 | XMLWriterBase.prototype.dtdEntity = function(node, options, level) {
|
35279 | var r;
|
35280 | this.openNode(node, options, level);
|
35281 | options.state = WriterState.OpenTag;
|
35282 | r = this.indent(node, options, level) + '<!ENTITY';
|
35283 | options.state = WriterState.InsideTag;
|
35284 | if (node.pe) {
|
35285 | r += ' %';
|
35286 | }
|
35287 | r += ' ' + node.name;
|
35288 | if (node.value) {
|
35289 | r += ' "' + node.value + '"';
|
35290 | } else {
|
35291 | if (node.pubID && node.sysID) {
|
35292 | r += ' PUBLIC "' + node.pubID + '" "' + node.sysID + '"';
|
35293 | } else if (node.sysID) {
|
35294 | r += ' SYSTEM "' + node.sysID + '"';
|
35295 | }
|
35296 | if (node.nData) {
|
35297 | r += ' NDATA ' + node.nData;
|
35298 | }
|
35299 | }
|
35300 | options.state = WriterState.CloseTag;
|
35301 | r += options.spaceBeforeSlash + '>' + this.endline(node, options, level);
|
35302 | options.state = WriterState.None;
|
35303 | this.closeNode(node, options, level);
|
35304 | return r;
|
35305 | };
|
35306 |
|
35307 | XMLWriterBase.prototype.dtdNotation = function(node, options, level) {
|
35308 | var r;
|
35309 | this.openNode(node, options, level);
|
35310 | options.state = WriterState.OpenTag;
|
35311 | r = this.indent(node, options, level) + '<!NOTATION';
|
35312 | options.state = WriterState.InsideTag;
|
35313 | r += ' ' + node.name;
|
35314 | if (node.pubID && node.sysID) {
|
35315 | r += ' PUBLIC "' + node.pubID + '" "' + node.sysID + '"';
|
35316 | } else if (node.pubID) {
|
35317 | r += ' PUBLIC "' + node.pubID + '"';
|
35318 | } else if (node.sysID) {
|
35319 | r += ' SYSTEM "' + node.sysID + '"';
|
35320 | }
|
35321 | options.state = WriterState.CloseTag;
|
35322 | r += options.spaceBeforeSlash + '>' + this.endline(node, options, level);
|
35323 | options.state = WriterState.None;
|
35324 | this.closeNode(node, options, level);
|
35325 | return r;
|
35326 | };
|
35327 |
|
35328 | XMLWriterBase.prototype.openNode = function(node, options, level) {};
|
35329 |
|
35330 | XMLWriterBase.prototype.closeNode = function(node, options, level) {};
|
35331 |
|
35332 | XMLWriterBase.prototype.openAttribute = function(att, options, level) {};
|
35333 |
|
35334 | XMLWriterBase.prototype.closeAttribute = function(att, options, level) {};
|
35335 |
|
35336 | return XMLWriterBase;
|
35337 |
|
35338 | })();
|
35339 |
|
35340 | }).call(this);
|
35341 |
|
35342 | },{"./NodeType":354,"./Utility":355,"./WriterState":356,"./XMLCData":358,"./XMLComment":360,"./XMLDTDAttList":365,"./XMLDTDElement":366,"./XMLDTDEntity":367,"./XMLDTDNotation":368,"./XMLDeclaration":369,"./XMLDocType":370,"./XMLDummy":373,"./XMLElement":374,"./XMLProcessingInstruction":378,"./XMLRaw":379,"./XMLText":383}],385:[function(require,module,exports){
|
35343 |
|
35344 | (function() {
|
35345 | var NodeType, WriterState, XMLDOMImplementation, XMLDocument, XMLDocumentCB, XMLStreamWriter, XMLStringWriter, assign, isFunction, ref;
|
35346 |
|
35347 | ref = require('./Utility'), assign = ref.assign, isFunction = ref.isFunction;
|
35348 |
|
35349 | XMLDOMImplementation = require('./XMLDOMImplementation');
|
35350 |
|
35351 | XMLDocument = require('./XMLDocument');
|
35352 |
|
35353 | XMLDocumentCB = require('./XMLDocumentCB');
|
35354 |
|
35355 | XMLStringWriter = require('./XMLStringWriter');
|
35356 |
|
35357 | XMLStreamWriter = require('./XMLStreamWriter');
|
35358 |
|
35359 | NodeType = require('./NodeType');
|
35360 |
|
35361 | WriterState = require('./WriterState');
|
35362 |
|
35363 | module.exports.create = function(name, xmldec, doctype, options) {
|
35364 | var doc, root;
|
35365 | if (name == null) {
|
35366 | throw new Error("Root element needs a name.");
|
35367 | }
|
35368 | options = assign({}, xmldec, doctype, options);
|
35369 | doc = new XMLDocument(options);
|
35370 | root = doc.element(name);
|
35371 | if (!options.headless) {
|
35372 | doc.declaration(options);
|
35373 | if ((options.pubID != null) || (options.sysID != null)) {
|
35374 | doc.dtd(options);
|
35375 | }
|
35376 | }
|
35377 | return root;
|
35378 | };
|
35379 |
|
35380 | module.exports.begin = function(options, onData, onEnd) {
|
35381 | var ref1;
|
35382 | if (isFunction(options)) {
|
35383 | ref1 = [options, onData], onData = ref1[0], onEnd = ref1[1];
|
35384 | options = {};
|
35385 | }
|
35386 | if (onData) {
|
35387 | return new XMLDocumentCB(options, onData, onEnd);
|
35388 | } else {
|
35389 | return new XMLDocument(options);
|
35390 | }
|
35391 | };
|
35392 |
|
35393 | module.exports.stringWriter = function(options) {
|
35394 | return new XMLStringWriter(options);
|
35395 | };
|
35396 |
|
35397 | module.exports.streamWriter = function(stream, options) {
|
35398 | return new XMLStreamWriter(stream, options);
|
35399 | };
|
35400 |
|
35401 | module.exports.implementation = new XMLDOMImplementation();
|
35402 |
|
35403 | module.exports.nodeType = NodeType;
|
35404 |
|
35405 | module.exports.writerState = WriterState;
|
35406 |
|
35407 | }).call(this);
|
35408 |
|
35409 | },{"./NodeType":354,"./Utility":355,"./WriterState":356,"./XMLDOMImplementation":363,"./XMLDocument":371,"./XMLDocumentCB":372,"./XMLStreamWriter":380,"./XMLStringWriter":381}],386:[function(require,module,exports){
|
35410 | module.exports = extend
|
35411 |
|
35412 | var hasOwnProperty = Object.prototype.hasOwnProperty;
|
35413 |
|
35414 | function extend() {
|
35415 | var target = {}
|
35416 |
|
35417 | for (var i = 0; i < arguments.length; i++) {
|
35418 | var source = arguments[i]
|
35419 |
|
35420 | for (var key in source) {
|
35421 | if (hasOwnProperty.call(source, key)) {
|
35422 | target[key] = source[key]
|
35423 | }
|
35424 | }
|
35425 | }
|
35426 |
|
35427 | return target
|
35428 | }
|
35429 |
|
35430 | },{}],387:[function(require,module,exports){
|
35431 | "use strict";
|
35432 |
|
35433 | require("core-js/modules/es.array.concat");
|
35434 |
|
35435 | require("core-js/modules/es.array.fill");
|
35436 |
|
35437 | require("core-js/modules/es.array.join");
|
35438 |
|
35439 | require("core-js/modules/es.array.slice");
|
35440 |
|
35441 | require("core-js/modules/es.object.to-string");
|
35442 |
|
35443 | require("core-js/modules/es.regexp.to-string");
|
35444 |
|
35445 | var Buffer = require('buffer').Buffer;
|
35446 |
|
35447 | var sha = require('./sha');
|
35448 |
|
35449 | var md5 = require('./md5');
|
35450 |
|
35451 | var algorithms = {
|
35452 | sha1: sha,
|
35453 | md5: md5
|
35454 | };
|
35455 | var blocksize = 64;
|
35456 | var zeroBuffer = Buffer.alloc(blocksize);
|
35457 | zeroBuffer.fill(0);
|
35458 |
|
35459 | function hmac(fn, key, data) {
|
35460 | if (!Buffer.isBuffer(key)) key = Buffer.from(key);
|
35461 | if (!Buffer.isBuffer(data)) data = Buffer.from(data);
|
35462 |
|
35463 | if (key.length > blocksize) {
|
35464 | key = fn(key);
|
35465 | } else if (key.length < blocksize) {
|
35466 | key = Buffer.concat([key, zeroBuffer], blocksize);
|
35467 | }
|
35468 |
|
35469 | var ipad = Buffer.alloc(blocksize),
|
35470 | opad = Buffer.alloc(blocksize);
|
35471 |
|
35472 | for (var i = 0; i < blocksize; i++) {
|
35473 | ipad[i] = key[i] ^ 0x36;
|
35474 | opad[i] = key[i] ^ 0x5C;
|
35475 | }
|
35476 |
|
35477 | var hash = fn(Buffer.concat([ipad, data]));
|
35478 | return fn(Buffer.concat([opad, hash]));
|
35479 | }
|
35480 |
|
35481 | function hash(alg, key) {
|
35482 | alg = alg || 'sha1';
|
35483 | var fn = algorithms[alg];
|
35484 | var bufs = [];
|
35485 | var length = 0;
|
35486 | if (!fn) error('algorithm:', alg, 'is not yet supported');
|
35487 | return {
|
35488 | update: function update(data) {
|
35489 | if (!Buffer.isBuffer(data)) data = Buffer.from(data);
|
35490 | bufs.push(data);
|
35491 | length += data.length;
|
35492 | return this;
|
35493 | },
|
35494 | digest: function digest(enc) {
|
35495 | var buf = Buffer.concat(bufs);
|
35496 | var r = key ? hmac(fn, key, buf) : fn(buf);
|
35497 | bufs = null;
|
35498 | return enc ? r.toString(enc) : r;
|
35499 | }
|
35500 | };
|
35501 | }
|
35502 |
|
35503 | function error() {
|
35504 | var m = [].slice.call(arguments).join(' ');
|
35505 | throw new Error([m, 'we accept pull requests', 'http://github.com/dominictarr/crypto-browserify'].join('\n'));
|
35506 | }
|
35507 |
|
35508 | exports.createHash = function (alg) {
|
35509 | return hash(alg);
|
35510 | };
|
35511 |
|
35512 | exports.createHmac = function (alg, key) {
|
35513 | return hash(alg, key);
|
35514 | };
|
35515 |
|
35516 | exports.createCredentials = function () {
|
35517 | error('sorry,createCredentials is not implemented yet');
|
35518 | };
|
35519 |
|
35520 | exports.createCipher = function () {
|
35521 | error('sorry,createCipher is not implemented yet');
|
35522 | };
|
35523 |
|
35524 | exports.createCipheriv = function () {
|
35525 | error('sorry,createCipheriv is not implemented yet');
|
35526 | };
|
35527 |
|
35528 | exports.createDecipher = function () {
|
35529 | error('sorry,createDecipher is not implemented yet');
|
35530 | };
|
35531 |
|
35532 | exports.createDecipheriv = function () {
|
35533 | error('sorry,createDecipheriv is not implemented yet');
|
35534 | };
|
35535 |
|
35536 | exports.createSign = function () {
|
35537 | error('sorry,createSign is not implemented yet');
|
35538 | };
|
35539 |
|
35540 | exports.createVerify = function () {
|
35541 | error('sorry,createVerify is not implemented yet');
|
35542 | };
|
35543 |
|
35544 | exports.createDiffieHellman = function () {
|
35545 | error('sorry,createDiffieHellman is not implemented yet');
|
35546 | };
|
35547 |
|
35548 | exports.pbkdf2 = function () {
|
35549 | error('sorry,pbkdf2 is not implemented yet');
|
35550 | };
|
35551 |
|
35552 | },{"./md5":389,"./sha":390,"buffer":98,"core-js/modules/es.array.concat":234,"core-js/modules/es.array.fill":235,"core-js/modules/es.array.join":243,"core-js/modules/es.array.slice":246,"core-js/modules/es.object.to-string":254,"core-js/modules/es.regexp.to-string":257}],388:[function(require,module,exports){
|
35553 | "use strict";
|
35554 |
|
35555 | require("core-js/modules/es.array.concat");
|
35556 |
|
35557 | require("core-js/modules/es.array.fill");
|
35558 |
|
35559 | var Buffer = require('buffer').Buffer;
|
35560 |
|
35561 | var intSize = 4;
|
35562 | var zeroBuffer = Buffer.alloc(intSize);
|
35563 | zeroBuffer.fill(0);
|
35564 | var chrsz = 8;
|
35565 |
|
35566 | function toArray(buf, bigEndian) {
|
35567 | if (buf.length % intSize !== 0) {
|
35568 | var len = buf.length + (intSize - buf.length % intSize);
|
35569 | buf = Buffer.concat([buf, zeroBuffer], len);
|
35570 | }
|
35571 |
|
35572 | var arr = [];
|
35573 | var fn = bigEndian ? buf.readInt32BE : buf.readInt32LE;
|
35574 |
|
35575 | for (var i = 0; i < buf.length; i += intSize) {
|
35576 | arr.push(fn.call(buf, i));
|
35577 | }
|
35578 |
|
35579 | return arr;
|
35580 | }
|
35581 |
|
35582 | function toBuffer(arr, size, bigEndian) {
|
35583 | var buf = Buffer.alloc(size);
|
35584 | var fn = bigEndian ? buf.writeInt32BE : buf.writeInt32LE;
|
35585 |
|
35586 | for (var i = 0; i < arr.length; i++) {
|
35587 | fn.call(buf, arr[i], i * 4, true);
|
35588 | }
|
35589 |
|
35590 | return buf;
|
35591 | }
|
35592 |
|
35593 | function hash(buf, fn, hashSize, bigEndian) {
|
35594 | if (!Buffer.isBuffer(buf)) buf = Buffer.from(buf);
|
35595 | var arr = fn(toArray(buf, bigEndian), buf.length * chrsz);
|
35596 | return toBuffer(arr, hashSize, bigEndian);
|
35597 | }
|
35598 |
|
35599 | module.exports = {
|
35600 | hash: hash
|
35601 | };
|
35602 |
|
35603 | },{"buffer":98,"core-js/modules/es.array.concat":234,"core-js/modules/es.array.fill":235}],389:[function(require,module,exports){
|
35604 | "use strict";
|
35605 |
|
35606 |
|
35607 |
|
35608 |
|
35609 |
|
35610 |
|
35611 |
|
35612 |
|
35613 |
|
35614 | var helpers = require('./helpers');
|
35615 |
|
35616 |
|
35617 |
|
35618 |
|
35619 |
|
35620 | function md5_vm_test() {
|
35621 | return hex_md5("abc") == "900150983cd24fb0d6963f7d28e17f72";
|
35622 | }
|
35623 |
|
35624 |
|
35625 |
|
35626 |
|
35627 |
|
35628 | function core_md5(x, len) {
|
35629 |
|
35630 | x[len >> 5] |= 0x80 << len % 32;
|
35631 | x[(len + 64 >>> 9 << 4) + 14] = len;
|
35632 | var a = 1732584193;
|
35633 | var b = -271733879;
|
35634 | var c = -1732584194;
|
35635 | var d = 271733878;
|
35636 |
|
35637 | for (var i = 0; i < x.length; i += 16) {
|
35638 | var olda = a;
|
35639 | var oldb = b;
|
35640 | var oldc = c;
|
35641 | var oldd = d;
|
35642 | a = md5_ff(a, b, c, d, x[i + 0], 7, -680876936);
|
35643 | d = md5_ff(d, a, b, c, x[i + 1], 12, -389564586);
|
35644 | c = md5_ff(c, d, a, b, x[i + 2], 17, 606105819);
|
35645 | b = md5_ff(b, c, d, a, x[i + 3], 22, -1044525330);
|
35646 | a = md5_ff(a, b, c, d, x[i + 4], 7, -176418897);
|
35647 | d = md5_ff(d, a, b, c, x[i + 5], 12, 1200080426);
|
35648 | c = md5_ff(c, d, a, b, x[i + 6], 17, -1473231341);
|
35649 | b = md5_ff(b, c, d, a, x[i + 7], 22, -45705983);
|
35650 | a = md5_ff(a, b, c, d, x[i + 8], 7, 1770035416);
|
35651 | d = md5_ff(d, a, b, c, x[i + 9], 12, -1958414417);
|
35652 | c = md5_ff(c, d, a, b, x[i + 10], 17, -42063);
|
35653 | b = md5_ff(b, c, d, a, x[i + 11], 22, -1990404162);
|
35654 | a = md5_ff(a, b, c, d, x[i + 12], 7, 1804603682);
|
35655 | d = md5_ff(d, a, b, c, x[i + 13], 12, -40341101);
|
35656 | c = md5_ff(c, d, a, b, x[i + 14], 17, -1502002290);
|
35657 | b = md5_ff(b, c, d, a, x[i + 15], 22, 1236535329);
|
35658 | a = md5_gg(a, b, c, d, x[i + 1], 5, -165796510);
|
35659 | d = md5_gg(d, a, b, c, x[i + 6], 9, -1069501632);
|
35660 | c = md5_gg(c, d, a, b, x[i + 11], 14, 643717713);
|
35661 | b = md5_gg(b, c, d, a, x[i + 0], 20, -373897302);
|
35662 | a = md5_gg(a, b, c, d, x[i + 5], 5, -701558691);
|
35663 | d = md5_gg(d, a, b, c, x[i + 10], 9, 38016083);
|
35664 | c = md5_gg(c, d, a, b, x[i + 15], 14, -660478335);
|
35665 | b = md5_gg(b, c, d, a, x[i + 4], 20, -405537848);
|
35666 | a = md5_gg(a, b, c, d, x[i + 9], 5, 568446438);
|
35667 | d = md5_gg(d, a, b, c, x[i + 14], 9, -1019803690);
|
35668 | c = md5_gg(c, d, a, b, x[i + 3], 14, -187363961);
|
35669 | b = md5_gg(b, c, d, a, x[i + 8], 20, 1163531501);
|
35670 | a = md5_gg(a, b, c, d, x[i + 13], 5, -1444681467);
|
35671 | d = md5_gg(d, a, b, c, x[i + 2], 9, -51403784);
|
35672 | c = md5_gg(c, d, a, b, x[i + 7], 14, 1735328473);
|
35673 | b = md5_gg(b, c, d, a, x[i + 12], 20, -1926607734);
|
35674 | a = md5_hh(a, b, c, d, x[i + 5], 4, -378558);
|
35675 | d = md5_hh(d, a, b, c, x[i + 8], 11, -2022574463);
|
35676 | c = md5_hh(c, d, a, b, x[i + 11], 16, 1839030562);
|
35677 | b = md5_hh(b, c, d, a, x[i + 14], 23, -35309556);
|
35678 | a = md5_hh(a, b, c, d, x[i + 1], 4, -1530992060);
|
35679 | d = md5_hh(d, a, b, c, x[i + 4], 11, 1272893353);
|
35680 | c = md5_hh(c, d, a, b, x[i + 7], 16, -155497632);
|
35681 | b = md5_hh(b, c, d, a, x[i + 10], 23, -1094730640);
|
35682 | a = md5_hh(a, b, c, d, x[i + 13], 4, 681279174);
|
35683 | d = md5_hh(d, a, b, c, x[i + 0], 11, -358537222);
|
35684 | c = md5_hh(c, d, a, b, x[i + 3], 16, -722521979);
|
35685 | b = md5_hh(b, c, d, a, x[i + 6], 23, 76029189);
|
35686 | a = md5_hh(a, b, c, d, x[i + 9], 4, -640364487);
|
35687 | d = md5_hh(d, a, b, c, x[i + 12], 11, -421815835);
|
35688 | c = md5_hh(c, d, a, b, x[i + 15], 16, 530742520);
|
35689 | b = md5_hh(b, c, d, a, x[i + 2], 23, -995338651);
|
35690 | a = md5_ii(a, b, c, d, x[i + 0], 6, -198630844);
|
35691 | d = md5_ii(d, a, b, c, x[i + 7], 10, 1126891415);
|
35692 | c = md5_ii(c, d, a, b, x[i + 14], 15, -1416354905);
|
35693 | b = md5_ii(b, c, d, a, x[i + 5], 21, -57434055);
|
35694 | a = md5_ii(a, b, c, d, x[i + 12], 6, 1700485571);
|
35695 | d = md5_ii(d, a, b, c, x[i + 3], 10, -1894986606);
|
35696 | c = md5_ii(c, d, a, b, x[i + 10], 15, -1051523);
|
35697 | b = md5_ii(b, c, d, a, x[i + 1], 21, -2054922799);
|
35698 | a = md5_ii(a, b, c, d, x[i + 8], 6, 1873313359);
|
35699 | d = md5_ii(d, a, b, c, x[i + 15], 10, -30611744);
|
35700 | c = md5_ii(c, d, a, b, x[i + 6], 15, -1560198380);
|
35701 | b = md5_ii(b, c, d, a, x[i + 13], 21, 1309151649);
|
35702 | a = md5_ii(a, b, c, d, x[i + 4], 6, -145523070);
|
35703 | d = md5_ii(d, a, b, c, x[i + 11], 10, -1120210379);
|
35704 | c = md5_ii(c, d, a, b, x[i + 2], 15, 718787259);
|
35705 | b = md5_ii(b, c, d, a, x[i + 9], 21, -343485551);
|
35706 | a = safe_add(a, olda);
|
35707 | b = safe_add(b, oldb);
|
35708 | c = safe_add(c, oldc);
|
35709 | d = safe_add(d, oldd);
|
35710 | }
|
35711 |
|
35712 | return Array(a, b, c, d);
|
35713 | }
|
35714 |
|
35715 |
|
35716 |
|
35717 |
|
35718 |
|
35719 | function md5_cmn(q, a, b, x, s, t) {
|
35720 | return safe_add(bit_rol(safe_add(safe_add(a, q), safe_add(x, t)), s), b);
|
35721 | }
|
35722 |
|
35723 | function md5_ff(a, b, c, d, x, s, t) {
|
35724 | return md5_cmn(b & c | ~b & d, a, b, x, s, t);
|
35725 | }
|
35726 |
|
35727 | function md5_gg(a, b, c, d, x, s, t) {
|
35728 | return md5_cmn(b & d | c & ~d, a, b, x, s, t);
|
35729 | }
|
35730 |
|
35731 | function md5_hh(a, b, c, d, x, s, t) {
|
35732 | return md5_cmn(b ^ c ^ d, a, b, x, s, t);
|
35733 | }
|
35734 |
|
35735 | function md5_ii(a, b, c, d, x, s, t) {
|
35736 | return md5_cmn(c ^ (b | ~d), a, b, x, s, t);
|
35737 | }
|
35738 |
|
35739 |
|
35740 |
|
35741 |
|
35742 |
|
35743 |
|
35744 | function safe_add(x, y) {
|
35745 | var lsw = (x & 0xFFFF) + (y & 0xFFFF);
|
35746 | var msw = (x >> 16) + (y >> 16) + (lsw >> 16);
|
35747 | return msw << 16 | lsw & 0xFFFF;
|
35748 | }
|
35749 |
|
35750 |
|
35751 |
|
35752 |
|
35753 |
|
35754 | function bit_rol(num, cnt) {
|
35755 | return num << cnt | num >>> 32 - cnt;
|
35756 | }
|
35757 |
|
35758 | module.exports = function md5(buf) {
|
35759 | return helpers.hash(buf, core_md5, 16);
|
35760 | };
|
35761 |
|
35762 | },{"./helpers":388}],390:[function(require,module,exports){
|
35763 | "use strict";
|
35764 |
|
35765 |
|
35766 |
|
35767 |
|
35768 |
|
35769 |
|
35770 |
|
35771 |
|
35772 |
|
35773 | var helpers = require('./helpers');
|
35774 |
|
35775 |
|
35776 |
|
35777 |
|
35778 |
|
35779 | function core_sha1(x, len) {
|
35780 |
|
35781 | x[len >> 5] |= 0x80 << 24 - len % 32;
|
35782 | x[(len + 64 >> 9 << 4) + 15] = len;
|
35783 | var w = Array(80);
|
35784 | var a = 1732584193;
|
35785 | var b = -271733879;
|
35786 | var c = -1732584194;
|
35787 | var d = 271733878;
|
35788 | var e = -1009589776;
|
35789 |
|
35790 | for (var i = 0; i < x.length; i += 16) {
|
35791 | var olda = a;
|
35792 | var oldb = b;
|
35793 | var oldc = c;
|
35794 | var oldd = d;
|
35795 | var olde = e;
|
35796 |
|
35797 | for (var j = 0; j < 80; j++) {
|
35798 | if (j < 16) w[j] = x[i + j];else w[j] = rol(w[j - 3] ^ w[j - 8] ^ w[j - 14] ^ w[j - 16], 1);
|
35799 | var t = safe_add(safe_add(rol(a, 5), sha1_ft(j, b, c, d)), safe_add(safe_add(e, w[j]), sha1_kt(j)));
|
35800 | e = d;
|
35801 | d = c;
|
35802 | c = rol(b, 30);
|
35803 | b = a;
|
35804 | a = t;
|
35805 | }
|
35806 |
|
35807 | a = safe_add(a, olda);
|
35808 | b = safe_add(b, oldb);
|
35809 | c = safe_add(c, oldc);
|
35810 | d = safe_add(d, oldd);
|
35811 | e = safe_add(e, olde);
|
35812 | }
|
35813 |
|
35814 | return Array(a, b, c, d, e);
|
35815 | }
|
35816 |
|
35817 |
|
35818 |
|
35819 |
|
35820 |
|
35821 |
|
35822 | function sha1_ft(t, b, c, d) {
|
35823 | if (t < 20) return b & c | ~b & d;
|
35824 | if (t < 40) return b ^ c ^ d;
|
35825 | if (t < 60) return b & c | b & d | c & d;
|
35826 | return b ^ c ^ d;
|
35827 | }
|
35828 |
|
35829 |
|
35830 |
|
35831 |
|
35832 |
|
35833 | function sha1_kt(t) {
|
35834 | return t < 20 ? 1518500249 : t < 40 ? 1859775393 : t < 60 ? -1894007588 : -899497514;
|
35835 | }
|
35836 |
|
35837 |
|
35838 |
|
35839 |
|
35840 |
|
35841 |
|
35842 | function safe_add(x, y) {
|
35843 | var lsw = (x & 0xFFFF) + (y & 0xFFFF);
|
35844 | var msw = (x >> 16) + (y >> 16) + (lsw >> 16);
|
35845 | return msw << 16 | lsw & 0xFFFF;
|
35846 | }
|
35847 |
|
35848 |
|
35849 |
|
35850 |
|
35851 |
|
35852 | function rol(num, cnt) {
|
35853 | return num << cnt | num >>> 32 - cnt;
|
35854 | }
|
35855 |
|
35856 | module.exports = function sha1(buf) {
|
35857 | return helpers.hash(buf, core_sha1, 20, true);
|
35858 | };
|
35859 |
|
35860 | },{"./helpers":388}],391:[function(require,module,exports){
|
35861 | "use strict";
|
35862 |
|
35863 | module.exports = function () {
|
35864 | return function () {};
|
35865 | };
|
35866 |
|
35867 | },{}],392:[function(require,module,exports){
|
35868 | (function (Buffer){
|
35869 | "use strict";
|
35870 |
|
35871 | var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
35872 |
|
35873 | var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
35874 |
|
35875 | var _require = require('stream'),
|
35876 | Stream = _require.Stream;
|
35877 |
|
35878 | var _require2 = require('../lib/common/utils/isArray'),
|
35879 | isArray = _require2.isArray;
|
35880 |
|
35881 | module.exports.string = function isString(obj) {
|
35882 | return typeof obj === 'string';
|
35883 | };
|
35884 |
|
35885 | module.exports.array = isArray;
|
35886 | module.exports.buffer = Buffer.isBuffer;
|
35887 |
|
35888 | function isStream(obj) {
|
35889 | return obj instanceof Stream;
|
35890 | }
|
35891 |
|
35892 | module.exports.writableStream = function isWritableStream(obj) {
|
35893 | return isStream(obj) && typeof obj._write === 'function' && (0, _typeof2.default)(obj._writableState) === 'object';
|
35894 | };
|
35895 |
|
35896 | }).call(this,{"isBuffer":require("../node_modules/is-buffer/index.js")})
|
35897 | },{"../lib/common/utils/isArray":59,"../node_modules/is-buffer/index.js":308,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/helpers/typeof":72,"stream":340}],393:[function(require,module,exports){
|
35898 | "use strict";
|
35899 |
|
35900 | var immediate = require('immediate');
|
35901 |
|
35902 | var process = module.exports = {};
|
35903 | process.nextTick = immediate;
|
35904 | process.title = 'browser';
|
35905 | process.browser = true;
|
35906 | process.env = {};
|
35907 | process.argv = [];
|
35908 | process.version = '';
|
35909 |
|
35910 | process.versions = {};
|
35911 |
|
35912 | function noop() {}
|
35913 |
|
35914 | process.on = noop;
|
35915 | process.addListener = noop;
|
35916 | process.once = noop;
|
35917 | process.off = noop;
|
35918 | process.removeListener = noop;
|
35919 | process.removeAllListeners = noop;
|
35920 | process.emit = noop;
|
35921 | process.prependListener = noop;
|
35922 | process.prependOnceListener = noop;
|
35923 |
|
35924 | process.listeners = function (name) {
|
35925 | return [];
|
35926 | };
|
35927 |
|
35928 | process.binding = function (name) {
|
35929 | throw new Error('process.binding is not supported');
|
35930 | };
|
35931 |
|
35932 | process.cwd = function () {
|
35933 | return '/';
|
35934 | };
|
35935 |
|
35936 | process.chdir = function (dir) {
|
35937 | throw new Error('process.chdir is not supported');
|
35938 | };
|
35939 |
|
35940 | process.umask = function () {
|
35941 | return 0;
|
35942 | };
|
35943 |
|
35944 | },{"immediate":301}],394:[function(require,module,exports){
|
35945 |
|
35946 |
|
35947 |
|
35948 |
|
35949 |
|
35950 |
|
35951 |
|
35952 |
|
35953 |
|
35954 |
|
35955 |
|
35956 |
|
35957 |
|
35958 |
|
35959 |
|
35960 |
|
35961 |
|
35962 |
|
35963 |
|
35964 |
|
35965 | 'use strict';
|
35966 |
|
35967 | var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
35968 |
|
35969 | require("core-js/modules/es.array.concat");
|
35970 |
|
35971 | require("core-js/modules/es.array.index-of");
|
35972 |
|
35973 | require("core-js/modules/es.array.join");
|
35974 |
|
35975 | require("core-js/modules/es.array.last-index-of");
|
35976 |
|
35977 | require("core-js/modules/es.array.slice");
|
35978 |
|
35979 | require("core-js/modules/es.array.splice");
|
35980 |
|
35981 | require("core-js/modules/es.object.keys");
|
35982 |
|
35983 | require("core-js/modules/es.regexp.exec");
|
35984 |
|
35985 | require("core-js/modules/es.string.match");
|
35986 |
|
35987 | require("core-js/modules/es.string.replace");
|
35988 |
|
35989 | require("core-js/modules/es.string.search");
|
35990 |
|
35991 | require("core-js/modules/es.string.split");
|
35992 |
|
35993 | require("core-js/modules/es.string.trim");
|
35994 |
|
35995 | var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
35996 |
|
35997 | var punycode = require('punycode');
|
35998 |
|
35999 | var util = require('./util');
|
36000 |
|
36001 | exports.parse = urlParse;
|
36002 | exports.resolve = urlResolve;
|
36003 | exports.resolveObject = urlResolveObject;
|
36004 | exports.format = urlFormat;
|
36005 | exports.Url = Url;
|
36006 |
|
36007 | function Url() {
|
36008 | this.protocol = null;
|
36009 | this.slashes = null;
|
36010 | this.auth = null;
|
36011 | this.host = null;
|
36012 | this.port = null;
|
36013 | this.hostname = null;
|
36014 | this.hash = null;
|
36015 | this.search = null;
|
36016 | this.query = null;
|
36017 | this.pathname = null;
|
36018 | this.path = null;
|
36019 | this.href = null;
|
36020 | }
|
36021 |
|
36022 |
|
36023 |
|
36024 |
|
36025 | var protocolPattern = /^([a-z0-9.+-]+:)/i,
|
36026 | portPattern = /:[0-9]*$/,
|
36027 |
|
36028 | simplePathPattern = /^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,
|
36029 |
|
36030 |
|
36031 | delims = ['<', '>', '"', '`', ' ', '\r', '\n', '\t'],
|
36032 |
|
36033 | unwise = ['{', '}', '|', '\\', '^', '`'].concat(delims),
|
36034 |
|
36035 | autoEscape = ['\''].concat(unwise),
|
36036 |
|
36037 |
|
36038 |
|
36039 |
|
36040 | nonHostChars = ['%', '/', '?', ';', '#'].concat(autoEscape),
|
36041 | hostEndingChars = ['/', '?', '#'],
|
36042 | hostnameMaxLen = 255,
|
36043 | hostnamePartPattern = /^[+a-z0-9A-Z_-]{0,63}$/,
|
36044 | hostnamePartStart = /^([+a-z0-9A-Z_-]{0,63})(.*)$/,
|
36045 |
|
36046 | unsafeProtocol = {
|
36047 | 'javascript': true,
|
36048 | 'javascript:': true
|
36049 | },
|
36050 |
|
36051 | hostlessProtocol = {
|
36052 | 'javascript': true,
|
36053 | 'javascript:': true
|
36054 | },
|
36055 |
|
36056 | slashedProtocol = {
|
36057 | 'http': true,
|
36058 | 'https': true,
|
36059 | 'ftp': true,
|
36060 | 'gopher': true,
|
36061 | 'file': true,
|
36062 | 'http:': true,
|
36063 | 'https:': true,
|
36064 | 'ftp:': true,
|
36065 | 'gopher:': true,
|
36066 | 'file:': true
|
36067 | },
|
36068 | querystring = require('querystring');
|
36069 |
|
36070 | function urlParse(url, parseQueryString, slashesDenoteHost) {
|
36071 | if (url && util.isObject(url) && url instanceof Url) return url;
|
36072 | var u = new Url();
|
36073 | u.parse(url, parseQueryString, slashesDenoteHost);
|
36074 | return u;
|
36075 | }
|
36076 |
|
36077 | Url.prototype.parse = function (url, parseQueryString, slashesDenoteHost) {
|
36078 | if (!util.isString(url)) {
|
36079 | throw new TypeError("Parameter 'url' must be a string, not " + (0, _typeof2.default)(url));
|
36080 | }
|
36081 |
|
36082 |
|
36083 |
|
36084 |
|
36085 | var queryIndex = url.indexOf('?'),
|
36086 | splitter = queryIndex !== -1 && queryIndex < url.indexOf('#') ? '?' : '#',
|
36087 | uSplit = url.split(splitter),
|
36088 | slashRegex = /\\/g;
|
36089 | uSplit[0] = uSplit[0].replace(slashRegex, '/');
|
36090 | url = uSplit.join(splitter);
|
36091 | var rest = url;
|
36092 |
|
36093 |
|
36094 | rest = rest.trim();
|
36095 |
|
36096 | if (!slashesDenoteHost && url.split('#').length === 1) {
|
36097 |
|
36098 | var simplePath = simplePathPattern.exec(rest);
|
36099 |
|
36100 | if (simplePath) {
|
36101 | this.path = rest;
|
36102 | this.href = rest;
|
36103 | this.pathname = simplePath[1];
|
36104 |
|
36105 | if (simplePath[2]) {
|
36106 | this.search = simplePath[2];
|
36107 |
|
36108 | if (parseQueryString) {
|
36109 | this.query = querystring.parse(this.search.substr(1));
|
36110 | } else {
|
36111 | this.query = this.search.substr(1);
|
36112 | }
|
36113 | } else if (parseQueryString) {
|
36114 | this.search = '';
|
36115 | this.query = {};
|
36116 | }
|
36117 |
|
36118 | return this;
|
36119 | }
|
36120 | }
|
36121 |
|
36122 | var proto = protocolPattern.exec(rest);
|
36123 |
|
36124 | if (proto) {
|
36125 | proto = proto[0];
|
36126 | var lowerProto = proto.toLowerCase();
|
36127 | this.protocol = lowerProto;
|
36128 | rest = rest.substr(proto.length);
|
36129 | }
|
36130 |
|
36131 |
|
36132 |
|
36133 |
|
36134 |
|
36135 | if (slashesDenoteHost || proto || rest.match(/^\/\/[^@\/]+@[^@\/]+/)) {
|
36136 | var slashes = rest.substr(0, 2) === '//';
|
36137 |
|
36138 | if (slashes && !(proto && hostlessProtocol[proto])) {
|
36139 | rest = rest.substr(2);
|
36140 | this.slashes = true;
|
36141 | }
|
36142 | }
|
36143 |
|
36144 | if (!hostlessProtocol[proto] && (slashes || proto && !slashedProtocol[proto])) {
|
36145 |
|
36146 |
|
36147 |
|
36148 |
|
36149 |
|
36150 |
|
36151 |
|
36152 |
|
36153 |
|
36154 |
|
36155 |
|
36156 |
|
36157 |
|
36158 |
|
36159 | var hostEnd = -1;
|
36160 |
|
36161 | for (var i = 0; i < hostEndingChars.length; i++) {
|
36162 | var hec = rest.indexOf(hostEndingChars[i]);
|
36163 | if (hec !== -1 && (hostEnd === -1 || hec < hostEnd)) hostEnd = hec;
|
36164 | }
|
36165 |
|
36166 |
|
36167 |
|
36168 | var auth, atSign;
|
36169 |
|
36170 | if (hostEnd === -1) {
|
36171 |
|
36172 | atSign = rest.lastIndexOf('@');
|
36173 | } else {
|
36174 |
|
36175 |
|
36176 | atSign = rest.lastIndexOf('@', hostEnd);
|
36177 | }
|
36178 |
|
36179 |
|
36180 |
|
36181 | if (atSign !== -1) {
|
36182 | auth = rest.slice(0, atSign);
|
36183 | rest = rest.slice(atSign + 1);
|
36184 | this.auth = decodeURIComponent(auth);
|
36185 | }
|
36186 |
|
36187 |
|
36188 | hostEnd = -1;
|
36189 |
|
36190 | for (var i = 0; i < nonHostChars.length; i++) {
|
36191 | var hec = rest.indexOf(nonHostChars[i]);
|
36192 | if (hec !== -1 && (hostEnd === -1 || hec < hostEnd)) hostEnd = hec;
|
36193 | }
|
36194 |
|
36195 |
|
36196 | if (hostEnd === -1) hostEnd = rest.length;
|
36197 | this.host = rest.slice(0, hostEnd);
|
36198 | rest = rest.slice(hostEnd);
|
36199 |
|
36200 | this.parseHost();
|
36201 |
|
36202 |
|
36203 | this.hostname = this.hostname || '';
|
36204 |
|
36205 |
|
36206 | var ipv6Hostname = this.hostname[0] === '[' && this.hostname[this.hostname.length - 1] === ']';
|
36207 |
|
36208 | if (!ipv6Hostname) {
|
36209 | var hostparts = this.hostname.split('.');
|
36210 |
|
36211 | for (var i = 0, l = hostparts.length; i < l; i++) {
|
36212 | var part = hostparts[i];
|
36213 | if (!part) continue;
|
36214 |
|
36215 | if (!part.match(hostnamePartPattern)) {
|
36216 | var newpart = '';
|
36217 |
|
36218 | for (var j = 0, k = part.length; j < k; j++) {
|
36219 | if (part.charCodeAt(j) > 127) {
|
36220 |
|
36221 |
|
36222 |
|
36223 | newpart += 'x';
|
36224 | } else {
|
36225 | newpart += part[j];
|
36226 | }
|
36227 | }
|
36228 |
|
36229 |
|
36230 | if (!newpart.match(hostnamePartPattern)) {
|
36231 | var validParts = hostparts.slice(0, i);
|
36232 | var notHost = hostparts.slice(i + 1);
|
36233 | var bit = part.match(hostnamePartStart);
|
36234 |
|
36235 | if (bit) {
|
36236 | validParts.push(bit[1]);
|
36237 | notHost.unshift(bit[2]);
|
36238 | }
|
36239 |
|
36240 | if (notHost.length) {
|
36241 | rest = '/' + notHost.join('.') + rest;
|
36242 | }
|
36243 |
|
36244 | this.hostname = validParts.join('.');
|
36245 | break;
|
36246 | }
|
36247 | }
|
36248 | }
|
36249 | }
|
36250 |
|
36251 | if (this.hostname.length > hostnameMaxLen) {
|
36252 | this.hostname = '';
|
36253 | } else {
|
36254 |
|
36255 | this.hostname = this.hostname.toLowerCase();
|
36256 | }
|
36257 |
|
36258 | if (!ipv6Hostname) {
|
36259 |
|
36260 |
|
36261 |
|
36262 |
|
36263 | this.hostname = punycode.toASCII(this.hostname);
|
36264 | }
|
36265 |
|
36266 | var p = this.port ? ':' + this.port : '';
|
36267 | var h = this.hostname || '';
|
36268 | this.host = h + p;
|
36269 | this.href += this.host;
|
36270 |
|
36271 |
|
36272 | if (ipv6Hostname) {
|
36273 | this.hostname = this.hostname.substr(1, this.hostname.length - 2);
|
36274 |
|
36275 | if (rest[0] !== '/') {
|
36276 | rest = '/' + rest;
|
36277 | }
|
36278 | }
|
36279 | }
|
36280 |
|
36281 |
|
36282 |
|
36283 | if (!unsafeProtocol[lowerProto]) {
|
36284 |
|
36285 |
|
36286 |
|
36287 | for (var i = 0, l = autoEscape.length; i < l; i++) {
|
36288 | var ae = autoEscape[i];
|
36289 | if (rest.indexOf(ae) === -1) continue;
|
36290 | var esc = encodeURIComponent(ae);
|
36291 |
|
36292 | if (esc === ae) {
|
36293 | esc = escape(ae);
|
36294 | }
|
36295 |
|
36296 | rest = rest.split(ae).join(esc);
|
36297 | }
|
36298 | }
|
36299 |
|
36300 |
|
36301 | var hash = rest.indexOf('#');
|
36302 |
|
36303 | if (hash !== -1) {
|
36304 |
|
36305 | this.hash = rest.substr(hash);
|
36306 | rest = rest.slice(0, hash);
|
36307 | }
|
36308 |
|
36309 | var qm = rest.indexOf('?');
|
36310 |
|
36311 | if (qm !== -1) {
|
36312 | this.search = rest.substr(qm);
|
36313 | this.query = rest.substr(qm + 1);
|
36314 |
|
36315 | if (parseQueryString) {
|
36316 | this.query = querystring.parse(this.query);
|
36317 | }
|
36318 |
|
36319 | rest = rest.slice(0, qm);
|
36320 | } else if (parseQueryString) {
|
36321 |
|
36322 | this.search = '';
|
36323 | this.query = {};
|
36324 | }
|
36325 |
|
36326 | if (rest) this.pathname = rest;
|
36327 |
|
36328 | if (slashedProtocol[lowerProto] && this.hostname && !this.pathname) {
|
36329 | this.pathname = '/';
|
36330 | }
|
36331 |
|
36332 |
|
36333 | if (this.pathname || this.search) {
|
36334 | var p = this.pathname || '';
|
36335 | var s = this.search || '';
|
36336 | this.path = p + s;
|
36337 | }
|
36338 |
|
36339 |
|
36340 | this.href = this.format();
|
36341 | return this;
|
36342 | };
|
36343 |
|
36344 |
|
36345 | function urlFormat(obj) {
|
36346 |
|
36347 |
|
36348 |
|
36349 |
|
36350 | if (util.isString(obj)) obj = urlParse(obj);
|
36351 | if (!(obj instanceof Url)) return Url.prototype.format.call(obj);
|
36352 | return obj.format();
|
36353 | }
|
36354 |
|
36355 | Url.prototype.format = function () {
|
36356 | var auth = this.auth || '';
|
36357 |
|
36358 | if (auth) {
|
36359 | auth = encodeURIComponent(auth);
|
36360 | auth = auth.replace(/%3A/i, ':');
|
36361 | auth += '@';
|
36362 | }
|
36363 |
|
36364 | var protocol = this.protocol || '',
|
36365 | pathname = this.pathname || '',
|
36366 | hash = this.hash || '',
|
36367 | host = false,
|
36368 | query = '';
|
36369 |
|
36370 | if (this.host) {
|
36371 | host = auth + this.host;
|
36372 | } else if (this.hostname) {
|
36373 | host = auth + (this.hostname.indexOf(':') === -1 ? this.hostname : '[' + this.hostname + ']');
|
36374 |
|
36375 | if (this.port) {
|
36376 | host += ':' + this.port;
|
36377 | }
|
36378 | }
|
36379 |
|
36380 | if (this.query && util.isObject(this.query) && Object.keys(this.query).length) {
|
36381 | query = querystring.stringify(this.query);
|
36382 | }
|
36383 |
|
36384 | var search = this.search || query && '?' + query || '';
|
36385 | if (protocol && protocol.substr(-1) !== ':') protocol += ':';
|
36386 |
|
36387 |
|
36388 | if (this.slashes || (!protocol || slashedProtocol[protocol]) && host !== false) {
|
36389 | host = '//' + (host || '');
|
36390 | if (pathname && pathname.charAt(0) !== '/') pathname = '/' + pathname;
|
36391 | } else if (!host) {
|
36392 | host = '';
|
36393 | }
|
36394 |
|
36395 | if (hash && hash.charAt(0) !== '#') hash = '#' + hash;
|
36396 | if (search && search.charAt(0) !== '?') search = '?' + search;
|
36397 | pathname = pathname.replace(/[?#]/g, function (match) {
|
36398 | return encodeURIComponent(match);
|
36399 | });
|
36400 | search = search.replace('#', '%23');
|
36401 | return protocol + host + pathname + search + hash;
|
36402 | };
|
36403 |
|
36404 | function urlResolve(source, relative) {
|
36405 | return urlParse(source, false, true).resolve(relative);
|
36406 | }
|
36407 |
|
36408 | Url.prototype.resolve = function (relative) {
|
36409 | return this.resolveObject(urlParse(relative, false, true)).format();
|
36410 | };
|
36411 |
|
36412 | function urlResolveObject(source, relative) {
|
36413 | if (!source) return relative;
|
36414 | return urlParse(source, false, true).resolveObject(relative);
|
36415 | }
|
36416 |
|
36417 | Url.prototype.resolveObject = function (relative) {
|
36418 | if (util.isString(relative)) {
|
36419 | var rel = new Url();
|
36420 | rel.parse(relative, false, true);
|
36421 | relative = rel;
|
36422 | }
|
36423 |
|
36424 | var result = new Url();
|
36425 | var tkeys = Object.keys(this);
|
36426 |
|
36427 | for (var tk = 0; tk < tkeys.length; tk++) {
|
36428 | var tkey = tkeys[tk];
|
36429 | result[tkey] = this[tkey];
|
36430 | }
|
36431 |
|
36432 |
|
36433 |
|
36434 | result.hash = relative.hash;
|
36435 |
|
36436 | if (relative.href === '') {
|
36437 | result.href = result.format();
|
36438 | return result;
|
36439 | }
|
36440 |
|
36441 |
|
36442 | if (relative.slashes && !relative.protocol) {
|
36443 |
|
36444 | var rkeys = Object.keys(relative);
|
36445 |
|
36446 | for (var rk = 0; rk < rkeys.length; rk++) {
|
36447 | var rkey = rkeys[rk];
|
36448 | if (rkey !== 'protocol') result[rkey] = relative[rkey];
|
36449 | }
|
36450 |
|
36451 |
|
36452 | if (slashedProtocol[result.protocol] && result.hostname && !result.pathname) {
|
36453 | result.path = result.pathname = '/';
|
36454 | }
|
36455 |
|
36456 | result.href = result.format();
|
36457 | return result;
|
36458 | }
|
36459 |
|
36460 | if (relative.protocol && relative.protocol !== result.protocol) {
|
36461 |
|
36462 |
|
36463 |
|
36464 |
|
36465 |
|
36466 |
|
36467 |
|
36468 |
|
36469 | if (!slashedProtocol[relative.protocol]) {
|
36470 | var keys = Object.keys(relative);
|
36471 |
|
36472 | for (var v = 0; v < keys.length; v++) {
|
36473 | var k = keys[v];
|
36474 | result[k] = relative[k];
|
36475 | }
|
36476 |
|
36477 | result.href = result.format();
|
36478 | return result;
|
36479 | }
|
36480 |
|
36481 | result.protocol = relative.protocol;
|
36482 |
|
36483 | if (!relative.host && !hostlessProtocol[relative.protocol]) {
|
36484 | var relPath = (relative.pathname || '').split('/');
|
36485 |
|
36486 | while (relPath.length && !(relative.host = relPath.shift())) {
|
36487 | ;
|
36488 | }
|
36489 |
|
36490 | if (!relative.host) relative.host = '';
|
36491 | if (!relative.hostname) relative.hostname = '';
|
36492 | if (relPath[0] !== '') relPath.unshift('');
|
36493 | if (relPath.length < 2) relPath.unshift('');
|
36494 | result.pathname = relPath.join('/');
|
36495 | } else {
|
36496 | result.pathname = relative.pathname;
|
36497 | }
|
36498 |
|
36499 | result.search = relative.search;
|
36500 | result.query = relative.query;
|
36501 | result.host = relative.host || '';
|
36502 | result.auth = relative.auth;
|
36503 | result.hostname = relative.hostname || relative.host;
|
36504 | result.port = relative.port;
|
36505 |
|
36506 | if (result.pathname || result.search) {
|
36507 | var p = result.pathname || '';
|
36508 | var s = result.search || '';
|
36509 | result.path = p + s;
|
36510 | }
|
36511 |
|
36512 | result.slashes = result.slashes || relative.slashes;
|
36513 | result.href = result.format();
|
36514 | return result;
|
36515 | }
|
36516 |
|
36517 | var isSourceAbs = result.pathname && result.pathname.charAt(0) === '/',
|
36518 | isRelAbs = relative.host || relative.pathname && relative.pathname.charAt(0) === '/',
|
36519 | mustEndAbs = isRelAbs || isSourceAbs || result.host && relative.pathname,
|
36520 | removeAllDots = mustEndAbs,
|
36521 | srcPath = result.pathname && result.pathname.split('/') || [],
|
36522 | relPath = relative.pathname && relative.pathname.split('/') || [],
|
36523 | psychotic = result.protocol && !slashedProtocol[result.protocol];
|
36524 |
|
36525 |
|
36526 |
|
36527 |
|
36528 |
|
36529 | if (psychotic) {
|
36530 | result.hostname = '';
|
36531 | result.port = null;
|
36532 |
|
36533 | if (result.host) {
|
36534 | if (srcPath[0] === '') srcPath[0] = result.host;else srcPath.unshift(result.host);
|
36535 | }
|
36536 |
|
36537 | result.host = '';
|
36538 |
|
36539 | if (relative.protocol) {
|
36540 | relative.hostname = null;
|
36541 | relative.port = null;
|
36542 |
|
36543 | if (relative.host) {
|
36544 | if (relPath[0] === '') relPath[0] = relative.host;else relPath.unshift(relative.host);
|
36545 | }
|
36546 |
|
36547 | relative.host = null;
|
36548 | }
|
36549 |
|
36550 | mustEndAbs = mustEndAbs && (relPath[0] === '' || srcPath[0] === '');
|
36551 | }
|
36552 |
|
36553 | if (isRelAbs) {
|
36554 |
|
36555 | result.host = relative.host || relative.host === '' ? relative.host : result.host;
|
36556 | result.hostname = relative.hostname || relative.hostname === '' ? relative.hostname : result.hostname;
|
36557 | result.search = relative.search;
|
36558 | result.query = relative.query;
|
36559 | srcPath = relPath;
|
36560 | } else if (relPath.length) {
|
36561 |
|
36562 |
|
36563 | if (!srcPath) srcPath = [];
|
36564 | srcPath.pop();
|
36565 | srcPath = srcPath.concat(relPath);
|
36566 | result.search = relative.search;
|
36567 | result.query = relative.query;
|
36568 | } else if (!util.isNullOrUndefined(relative.search)) {
|
36569 |
|
36570 |
|
36571 |
|
36572 | if (psychotic) {
|
36573 | result.hostname = result.host = srcPath.shift();
|
36574 |
|
36575 |
|
36576 |
|
36577 | var authInHost = result.host && result.host.indexOf('@') > 0 ? result.host.split('@') : false;
|
36578 |
|
36579 | if (authInHost) {
|
36580 | result.auth = authInHost.shift();
|
36581 | result.host = result.hostname = authInHost.shift();
|
36582 | }
|
36583 | }
|
36584 |
|
36585 | result.search = relative.search;
|
36586 | result.query = relative.query;
|
36587 |
|
36588 | if (!util.isNull(result.pathname) || !util.isNull(result.search)) {
|
36589 | result.path = (result.pathname ? result.pathname : '') + (result.search ? result.search : '');
|
36590 | }
|
36591 |
|
36592 | result.href = result.format();
|
36593 | return result;
|
36594 | }
|
36595 |
|
36596 | if (!srcPath.length) {
|
36597 |
|
36598 |
|
36599 | result.pathname = null;
|
36600 |
|
36601 | if (result.search) {
|
36602 | result.path = '/' + result.search;
|
36603 | } else {
|
36604 | result.path = null;
|
36605 | }
|
36606 |
|
36607 | result.href = result.format();
|
36608 | return result;
|
36609 | }
|
36610 |
|
36611 |
|
36612 |
|
36613 |
|
36614 | var last = srcPath.slice(-1)[0];
|
36615 | var hasTrailingSlash = (result.host || relative.host || srcPath.length > 1) && (last === '.' || last === '..') || last === '';
|
36616 |
|
36617 |
|
36618 | var up = 0;
|
36619 |
|
36620 | for (var i = srcPath.length; i >= 0; i--) {
|
36621 | last = srcPath[i];
|
36622 |
|
36623 | if (last === '.') {
|
36624 | srcPath.splice(i, 1);
|
36625 | } else if (last === '..') {
|
36626 | srcPath.splice(i, 1);
|
36627 | up++;
|
36628 | } else if (up) {
|
36629 | srcPath.splice(i, 1);
|
36630 | up--;
|
36631 | }
|
36632 | }
|
36633 |
|
36634 |
|
36635 | if (!mustEndAbs && !removeAllDots) {
|
36636 | for (; up--; up) {
|
36637 | srcPath.unshift('..');
|
36638 | }
|
36639 | }
|
36640 |
|
36641 | if (mustEndAbs && srcPath[0] !== '' && (!srcPath[0] || srcPath[0].charAt(0) !== '/')) {
|
36642 | srcPath.unshift('');
|
36643 | }
|
36644 |
|
36645 | if (hasTrailingSlash && srcPath.join('/').substr(-1) !== '/') {
|
36646 | srcPath.push('');
|
36647 | }
|
36648 |
|
36649 | var isAbsolute = srcPath[0] === '' || srcPath[0] && srcPath[0].charAt(0) === '/';
|
36650 |
|
36651 | if (psychotic) {
|
36652 | result.hostname = result.host = isAbsolute ? '' : srcPath.length ? srcPath.shift() : '';
|
36653 |
|
36654 |
|
36655 |
|
36656 | var authInHost = result.host && result.host.indexOf('@') > 0 ? result.host.split('@') : false;
|
36657 |
|
36658 | if (authInHost) {
|
36659 | result.auth = authInHost.shift();
|
36660 | result.host = result.hostname = authInHost.shift();
|
36661 | }
|
36662 | }
|
36663 |
|
36664 | mustEndAbs = mustEndAbs || result.host && srcPath.length;
|
36665 |
|
36666 | if (mustEndAbs && !isAbsolute) {
|
36667 | srcPath.unshift('');
|
36668 | }
|
36669 |
|
36670 | if (!srcPath.length) {
|
36671 | result.pathname = null;
|
36672 | result.path = null;
|
36673 | } else {
|
36674 | result.pathname = srcPath.join('/');
|
36675 | }
|
36676 |
|
36677 |
|
36678 | if (!util.isNull(result.pathname) || !util.isNull(result.search)) {
|
36679 | result.path = (result.pathname ? result.pathname : '') + (result.search ? result.search : '');
|
36680 | }
|
36681 |
|
36682 | result.auth = relative.auth || result.auth;
|
36683 | result.slashes = result.slashes || relative.slashes;
|
36684 | result.href = result.format();
|
36685 | return result;
|
36686 | };
|
36687 |
|
36688 | Url.prototype.parseHost = function () {
|
36689 | var host = this.host;
|
36690 | var port = portPattern.exec(host);
|
36691 |
|
36692 | if (port) {
|
36693 | port = port[0];
|
36694 |
|
36695 | if (port !== ':') {
|
36696 | this.port = port.substr(1);
|
36697 | }
|
36698 |
|
36699 | host = host.substr(0, host.length - port.length);
|
36700 | }
|
36701 |
|
36702 | if (host) this.hostname = host;
|
36703 | };
|
36704 |
|
36705 | },{"./util":395,"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/helpers/typeof":72,"core-js/modules/es.array.concat":234,"core-js/modules/es.array.index-of":241,"core-js/modules/es.array.join":243,"core-js/modules/es.array.last-index-of":244,"core-js/modules/es.array.slice":246,"core-js/modules/es.array.splice":248,"core-js/modules/es.object.keys":253,"core-js/modules/es.regexp.exec":256,"core-js/modules/es.string.match":260,"core-js/modules/es.string.replace":261,"core-js/modules/es.string.search":262,"core-js/modules/es.string.split":263,"core-js/modules/es.string.trim":265,"punycode":320,"querystring":323}],395:[function(require,module,exports){
|
36706 | 'use strict';
|
36707 |
|
36708 | var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
36709 |
|
36710 | var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
36711 |
|
36712 | module.exports = {
|
36713 | isString: function isString(arg) {
|
36714 | return typeof arg === 'string';
|
36715 | },
|
36716 | isObject: function isObject(arg) {
|
36717 | return (0, _typeof2.default)(arg) === 'object' && arg !== null;
|
36718 | },
|
36719 | isNull: function isNull(arg) {
|
36720 | return arg === null;
|
36721 | },
|
36722 | isNullOrUndefined: function isNullOrUndefined(arg) {
|
36723 | return arg == null;
|
36724 | }
|
36725 | };
|
36726 |
|
36727 | },{"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/helpers/typeof":72}],396:[function(require,module,exports){
|
36728 | "use strict";
|
36729 |
|
36730 | require("core-js/modules/es.number.constructor");
|
36731 |
|
36732 |
|
36733 | exports.encodeURIComponent = function (text) {
|
36734 | try {
|
36735 | return encodeURIComponent(text);
|
36736 | } catch (e) {
|
36737 | return text;
|
36738 | }
|
36739 | };
|
36740 |
|
36741 | exports.escape = require('escape-html');
|
36742 |
|
36743 | exports.timestamp = function timestamp(t) {
|
36744 | if (t) {
|
36745 | var v = t;
|
36746 |
|
36747 | if (typeof v === 'string') {
|
36748 | v = Number(v);
|
36749 | }
|
36750 |
|
36751 | if (String(t).length === 10) {
|
36752 | v *= 1000;
|
36753 | }
|
36754 |
|
36755 | return new Date(v);
|
36756 | }
|
36757 |
|
36758 | return Math.round(Date.now() / 1000);
|
36759 | };
|
36760 |
|
36761 | },{"core-js/modules/es.number.constructor":250,"escape-html":296}],397:[function(require,module,exports){
|
36762 | (function (process,Buffer){
|
36763 | 'use strict';
|
36764 |
|
36765 | var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
36766 |
|
36767 | require("core-js/modules/es.array.concat");
|
36768 |
|
36769 | require("core-js/modules/es.array.index-of");
|
36770 |
|
36771 | require("core-js/modules/es.array.join");
|
36772 |
|
36773 | require("core-js/modules/es.function.name");
|
36774 |
|
36775 | require("core-js/modules/es.object.to-string");
|
36776 |
|
36777 | require("core-js/modules/es.promise");
|
36778 |
|
36779 | var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
36780 |
|
36781 | var util = require('util');
|
36782 |
|
36783 | var urlutil = require('url');
|
36784 |
|
36785 | var http = require('http');
|
36786 |
|
36787 | var https = require('https');
|
36788 |
|
36789 | var debug = require('debug')('urllib');
|
36790 |
|
36791 | var ms = require('humanize-ms');
|
36792 |
|
36793 | var _Promise;
|
36794 |
|
36795 | var REQUEST_ID = 0;
|
36796 | var MAX_VALUE = Math.pow(2, 31) - 10;
|
36797 | var PROTO_RE = /^https?:\/\//i;
|
36798 |
|
36799 | function getAgent(agent, defaultAgent) {
|
36800 | return agent === undefined ? defaultAgent : agent;
|
36801 | }
|
36802 |
|
36803 | function makeCallback(resolve, reject) {
|
36804 | return function (err, data, res) {
|
36805 | if (err) {
|
36806 | return reject(err);
|
36807 | }
|
36808 |
|
36809 | resolve({
|
36810 | data: data,
|
36811 | status: res.statusCode,
|
36812 | headers: res.headers,
|
36813 | res: res
|
36814 | });
|
36815 | };
|
36816 | }
|
36817 |
|
36818 |
|
36819 | exports.TIMEOUTS = [ms('300s'), ms('300s')];
|
36820 | var TEXT_DATA_TYPES = ['json', 'text'];
|
36821 |
|
36822 | exports.request = function request(url, args, callback) {
|
36823 |
|
36824 | if (arguments.length === 2 && typeof args === 'function') {
|
36825 | callback = args;
|
36826 | args = null;
|
36827 | }
|
36828 |
|
36829 | if (typeof callback === 'function') {
|
36830 | return exports.requestWithCallback(url, args, callback);
|
36831 | }
|
36832 |
|
36833 | return new Promise(function (resolve, reject) {
|
36834 | exports.requestWithCallback(url, args, makeCallback(resolve, reject));
|
36835 | });
|
36836 | };
|
36837 |
|
36838 | exports.requestWithCallback = function requestWithCallback(url, args, callback) {
|
36839 |
|
36840 | if (!url || typeof url !== 'string' && (0, _typeof2.default)(url) !== 'object') {
|
36841 | var msg = util.format('expect request url to be a string or a http request options, but got %j', url);
|
36842 | throw new Error(msg);
|
36843 | }
|
36844 |
|
36845 | if (arguments.length === 2 && typeof args === 'function') {
|
36846 | callback = args;
|
36847 | args = null;
|
36848 | }
|
36849 |
|
36850 | args = args || {};
|
36851 |
|
36852 | if (REQUEST_ID >= MAX_VALUE) {
|
36853 | REQUEST_ID = 0;
|
36854 | }
|
36855 |
|
36856 | var reqId = ++REQUEST_ID;
|
36857 | args.requestUrls = args.requestUrls || [];
|
36858 | var reqMeta = {
|
36859 | requestId: reqId,
|
36860 | url: url,
|
36861 | args: args,
|
36862 | ctx: args.ctx
|
36863 | };
|
36864 |
|
36865 | if (args.emitter) {
|
36866 | args.emitter.emit('request', reqMeta);
|
36867 | }
|
36868 |
|
36869 | args.timeout = args.timeout || exports.TIMEOUTS;
|
36870 | args.maxRedirects = args.maxRedirects || 10;
|
36871 | args.streaming = args.streaming || args.customResponse;
|
36872 | var requestStartTime = Date.now();
|
36873 | var parsedUrl;
|
36874 |
|
36875 | if (typeof url === 'string') {
|
36876 | if (!PROTO_RE.test(url)) {
|
36877 |
|
36878 | url = 'http://' + url;
|
36879 | }
|
36880 |
|
36881 | parsedUrl = urlutil.parse(url);
|
36882 | } else {
|
36883 | parsedUrl = url;
|
36884 | }
|
36885 |
|
36886 | var method = (args.type || args.method || parsedUrl.method || 'GET').toUpperCase();
|
36887 | var port = parsedUrl.port || 80;
|
36888 | var httplib = http;
|
36889 | var agent = getAgent(args.agent, exports.agent);
|
36890 | var fixJSONCtlChars = args.fixJSONCtlChars;
|
36891 |
|
36892 | if (parsedUrl.protocol === 'https:') {
|
36893 | httplib = https;
|
36894 | agent = getAgent(args.httpsAgent, exports.httpsAgent);
|
36895 |
|
36896 | if (!parsedUrl.port) {
|
36897 | port = 443;
|
36898 | }
|
36899 | }
|
36900 |
|
36901 |
|
36902 |
|
36903 |
|
36904 |
|
36905 |
|
36906 | var options = {
|
36907 | host: parsedUrl.hostname || parsedUrl.host || 'localhost',
|
36908 | path: parsedUrl.path || '/',
|
36909 | method: method,
|
36910 | port: port,
|
36911 | agent: agent,
|
36912 | headers: args.headers || {},
|
36913 |
|
36914 |
|
36915 |
|
36916 |
|
36917 | lookup: args.lookup
|
36918 | };
|
36919 |
|
36920 | if (Array.isArray(args.timeout)) {
|
36921 | options.requestTimeout = args.timeout[args.timeout.length - 1];
|
36922 | } else if (typeof args.timeout !== 'undefined') {
|
36923 | options.requestTimeout = args.timeout;
|
36924 | }
|
36925 |
|
36926 | var sslNames = ['pfx', 'key', 'passphrase', 'cert', 'ca', 'ciphers', 'rejectUnauthorized', 'secureProtocol', 'secureOptions'];
|
36927 |
|
36928 | for (var i = 0; i < sslNames.length; i++) {
|
36929 | var name = sslNames[i];
|
36930 |
|
36931 | if (args.hasOwnProperty(name)) {
|
36932 | options[name] = args[name];
|
36933 | }
|
36934 | }
|
36935 |
|
36936 |
|
36937 | if (options.rejectUnauthorized === false && !options.hasOwnProperty('secureOptions')) {
|
36938 | options.secureOptions = require('constants').SSL_OP_NO_TLSv1_2;
|
36939 | }
|
36940 |
|
36941 | var auth = args.auth || parsedUrl.auth;
|
36942 |
|
36943 | if (auth) {
|
36944 | options.auth = auth;
|
36945 | }
|
36946 |
|
36947 | var body = args.content || args.data;
|
36948 | var dataAsQueryString = method === 'GET' || method === 'HEAD' || args.dataAsQueryString;
|
36949 |
|
36950 | if (!args.content) {
|
36951 | if (body && !(typeof body === 'string' || Buffer.isBuffer(body))) {
|
36952 | if (dataAsQueryString) {
|
36953 |
|
36954 | body = args.nestedQuerystring ? qs.stringify(body) : querystring.stringify(body);
|
36955 | } else {
|
36956 | var contentType = options.headers['Content-Type'] || options.headers['content-type'];
|
36957 |
|
36958 | if (!contentType) {
|
36959 | if (args.contentType === 'json') {
|
36960 | contentType = 'application/json';
|
36961 | } else {
|
36962 | contentType = 'application/x-www-form-urlencoded';
|
36963 | }
|
36964 |
|
36965 | options.headers['Content-Type'] = contentType;
|
36966 | }
|
36967 |
|
36968 | if (parseContentType(contentType).type === 'application/json') {
|
36969 | body = JSON.stringify(body);
|
36970 | } else {
|
36971 |
|
36972 | body = args.nestedQuerystring ? qs.stringify(body) : querystring.stringify(body);
|
36973 | }
|
36974 | }
|
36975 | }
|
36976 | }
|
36977 |
|
36978 |
|
36979 | if (dataAsQueryString && body) {
|
36980 | options.path += (parsedUrl.query ? '&' : '?') + body;
|
36981 | body = null;
|
36982 | }
|
36983 |
|
36984 | var requestSize = 0;
|
36985 |
|
36986 | if (body) {
|
36987 | var length = body.length;
|
36988 |
|
36989 | if (!Buffer.isBuffer(body)) {
|
36990 | length = Buffer.byteLength(body);
|
36991 | }
|
36992 |
|
36993 | requestSize = options.headers['Content-Length'] = length;
|
36994 | }
|
36995 |
|
36996 | if (args.dataType === 'json') {
|
36997 | options.headers.Accept = 'application/json';
|
36998 | }
|
36999 |
|
37000 | if (typeof args.beforeRequest === 'function') {
|
37001 |
|
37002 | args.beforeRequest(options);
|
37003 | }
|
37004 |
|
37005 | var connectTimer = null;
|
37006 | var responseTimer = null;
|
37007 | var __err = null;
|
37008 | var connected = false;
|
37009 |
|
37010 | var keepAliveSocket = false;
|
37011 |
|
37012 | var responseSize = 0;
|
37013 | var statusCode = -1;
|
37014 | var responseAborted = false;
|
37015 | var remoteAddress = '';
|
37016 | var remotePort = '';
|
37017 | var timing = null;
|
37018 |
|
37019 | if (args.timing) {
|
37020 | timing = {
|
37021 |
|
37022 | queuing: 0,
|
37023 |
|
37024 | dnslookup: 0,
|
37025 |
|
37026 | connected: 0,
|
37027 |
|
37028 | requestSent: 0,
|
37029 |
|
37030 | waiting: 0,
|
37031 | contentDownload: 0
|
37032 | };
|
37033 | }
|
37034 |
|
37035 | function cancelConnectTimer() {
|
37036 | if (connectTimer) {
|
37037 | clearTimeout(connectTimer);
|
37038 | connectTimer = null;
|
37039 | }
|
37040 | }
|
37041 |
|
37042 | function cancelResponseTimer() {
|
37043 | if (responseTimer) {
|
37044 | clearTimeout(responseTimer);
|
37045 | responseTimer = null;
|
37046 | }
|
37047 | }
|
37048 |
|
37049 | function done(err, data, res) {
|
37050 | cancelResponseTimer();
|
37051 |
|
37052 | if (!callback) {
|
37053 | console.warn('[urllib:warn] [%s] [%s] [worker:%s] %s %s callback twice!!!', Date(), reqId, process.pid, options.method, url);
|
37054 |
|
37055 | if (err) {
|
37056 | console.warn('[urllib:warn] [%s] [%s] [worker:%s] %s: %s\nstack: %s', Date(), reqId, process.pid, err.name, err.message, err.stack);
|
37057 | }
|
37058 |
|
37059 | return;
|
37060 | }
|
37061 |
|
37062 | var cb = callback;
|
37063 | callback = null;
|
37064 | var headers = {};
|
37065 |
|
37066 | if (res) {
|
37067 | statusCode = res.statusCode;
|
37068 | headers = res.headers;
|
37069 | }
|
37070 |
|
37071 |
|
37072 | if (statusCode === 401 && headers['www-authenticate'] && (!args.headers || !args.headers.Authorization) && args.digestAuth) {
|
37073 | var authenticate = headers['www-authenticate'];
|
37074 |
|
37075 | if (authenticate.indexOf('Digest ') >= 0) {
|
37076 | debug('Request#%d %s: got digest auth header WWW-Authenticate: %s', reqId, url, authenticate);
|
37077 | args.headers = args.headers || {};
|
37078 | args.headers.Authorization = digestAuthHeader(options.method, options.path, authenticate, args.digestAuth);
|
37079 | debug('Request#%d %s: auth with digest header: %s', reqId, url, args.headers.Authorization);
|
37080 |
|
37081 | if (res.headers['set-cookie']) {
|
37082 | args.headers.Cookie = res.headers['set-cookie'].join(';');
|
37083 | }
|
37084 |
|
37085 | return exports.requestWithCallback(url, args, cb);
|
37086 | }
|
37087 | }
|
37088 |
|
37089 | var requestUseTime = Date.now() - requestStartTime;
|
37090 |
|
37091 | if (timing) {
|
37092 | timing.contentDownload = requestUseTime;
|
37093 | }
|
37094 |
|
37095 | debug('[%sms] done, %s bytes HTTP %s %s %s %s, keepAliveSocket: %s, timing: %j', requestUseTime, responseSize, statusCode, options.method, options.host, options.path, keepAliveSocket, timing);
|
37096 | var response = {
|
37097 | status: statusCode,
|
37098 | statusCode: statusCode,
|
37099 | headers: headers,
|
37100 | size: responseSize,
|
37101 | aborted: responseAborted,
|
37102 | rt: requestUseTime,
|
37103 | keepAliveSocket: keepAliveSocket,
|
37104 | data: data,
|
37105 | requestUrls: args.requestUrls,
|
37106 | timing: timing,
|
37107 | remoteAddress: remoteAddress,
|
37108 | remotePort: remotePort
|
37109 | };
|
37110 |
|
37111 | if (err) {
|
37112 | var agentStatus = '';
|
37113 |
|
37114 | if (agent && typeof agent.getCurrentStatus === 'function') {
|
37115 |
|
37116 | agentStatus = ', agent status: ' + JSON.stringify(agent.getCurrentStatus());
|
37117 | }
|
37118 |
|
37119 | err.message += ', ' + options.method + ' ' + url + ' ' + statusCode + ' (connected: ' + connected + ', keepalive socket: ' + keepAliveSocket + agentStatus + ')' + '\nheaders: ' + JSON.stringify(headers);
|
37120 | err.data = data;
|
37121 | err.path = options.path;
|
37122 | err.status = statusCode;
|
37123 | err.headers = headers;
|
37124 | err.res = response;
|
37125 | }
|
37126 |
|
37127 | cb(err, data, args.streaming ? res : response);
|
37128 |
|
37129 | if (args.emitter) {
|
37130 |
|
37131 | reqMeta.url = url;
|
37132 | reqMeta.socket = req && req.connection;
|
37133 | reqMeta.options = options;
|
37134 | reqMeta.size = requestSize;
|
37135 | args.emitter.emit('response', {
|
37136 | requestId: reqId,
|
37137 | error: err,
|
37138 | ctx: args.ctx,
|
37139 | req: reqMeta,
|
37140 | res: response
|
37141 | });
|
37142 | }
|
37143 | }
|
37144 |
|
37145 | function handleRedirect(res) {
|
37146 | var err = null;
|
37147 |
|
37148 | if (args.followRedirect && statuses.redirect[res.statusCode]) {
|
37149 |
|
37150 | args._followRedirectCount = (args._followRedirectCount || 0) + 1;
|
37151 | var location = res.headers.location;
|
37152 |
|
37153 | if (!location) {
|
37154 | err = new Error('Got statusCode ' + res.statusCode + ' but cannot resolve next location from headers');
|
37155 | err.name = 'FollowRedirectError';
|
37156 | } else if (args._followRedirectCount > args.maxRedirects) {
|
37157 | err = new Error('Exceeded maxRedirects. Probably stuck in a redirect loop ' + url);
|
37158 | err.name = 'MaxRedirectError';
|
37159 | } else {
|
37160 | var newUrl = args.formatRedirectUrl ? args.formatRedirectUrl(url, location) : urlutil.resolve(url, location);
|
37161 | debug('Request#%d %s: `redirected` from %s to %s', reqId, options.path, url, newUrl);
|
37162 |
|
37163 | cancelResponseTimer();
|
37164 |
|
37165 | if (args.headers && args.headers.Host && PROTO_RE.test(location)) {
|
37166 | args.headers.Host = null;
|
37167 | }
|
37168 |
|
37169 |
|
37170 | var cb = callback;
|
37171 | callback = null;
|
37172 | exports.requestWithCallback(newUrl, args, cb);
|
37173 | return {
|
37174 | redirect: true,
|
37175 | error: null
|
37176 | };
|
37177 | }
|
37178 | }
|
37179 |
|
37180 | return {
|
37181 | redirect: false,
|
37182 | error: err
|
37183 | };
|
37184 | }
|
37185 |
|
37186 | if (args.gzip) {
|
37187 | if (!options.headers['Accept-Encoding'] && !options.headers['accept-encoding']) {
|
37188 | options.headers['Accept-Encoding'] = 'gzip';
|
37189 | }
|
37190 | }
|
37191 |
|
37192 | function decodeContent(res, body, cb) {
|
37193 | var encoding = res.headers['content-encoding'];
|
37194 |
|
37195 |
|
37196 |
|
37197 |
|
37198 | return cb(null, body, encoding);
|
37199 |
|
37200 |
|
37201 | }
|
37202 |
|
37203 | var writeStream = args.writeStream;
|
37204 | debug('Request#%d %s %s with headers %j, options.path: %s', reqId, method, url, options.headers, options.path);
|
37205 | args.requestUrls.push(url);
|
37206 |
|
37207 | function onResponse(res) {
|
37208 | if (timing) {
|
37209 | timing.waiting = Date.now() - requestStartTime;
|
37210 | }
|
37211 |
|
37212 | debug('Request#%d %s `req response` event emit: status %d, headers: %j', reqId, url, res.statusCode, res.headers);
|
37213 |
|
37214 | if (args.streaming) {
|
37215 | var result = handleRedirect(res);
|
37216 |
|
37217 | if (result.redirect) {
|
37218 | res.resume();
|
37219 | return;
|
37220 | }
|
37221 |
|
37222 | if (result.error) {
|
37223 | res.resume();
|
37224 | return done(result.error, null, res);
|
37225 | }
|
37226 |
|
37227 | return done(null, null, res);
|
37228 | }
|
37229 |
|
37230 | res.on('close', function () {
|
37231 | debug('Request#%d %s: `res close` event emit, total size %d', reqId, url, responseSize);
|
37232 | });
|
37233 | res.on('error', function () {
|
37234 | debug('Request#%d %s: `res error` event emit, total size %d', reqId, url, responseSize);
|
37235 | });
|
37236 | res.on('aborted', function () {
|
37237 | responseAborted = true;
|
37238 | debug('Request#%d %s: `res aborted` event emit, total size %d', reqId, url, responseSize);
|
37239 | });
|
37240 |
|
37241 | if (writeStream) {
|
37242 |
|
37243 |
|
37244 |
|
37245 |
|
37246 |
|
37247 |
|
37248 |
|
37249 |
|
37250 |
|
37251 |
|
37252 |
|
37253 |
|
37254 |
|
37255 |
|
37256 |
|
37257 |
|
37258 | var result = handleRedirect(res);
|
37259 |
|
37260 | if (result.redirect) {
|
37261 | res.resume();
|
37262 | return;
|
37263 | }
|
37264 |
|
37265 | if (result.error) {
|
37266 | res.resume();
|
37267 |
|
37268 | writeStream.end();
|
37269 | return done(result.error, null, res);
|
37270 | }
|
37271 |
|
37272 |
|
37273 | if (args.consumeWriteStream === false) {
|
37274 | res.on('end', done.bind(null, null, null, res));
|
37275 | } else {
|
37276 |
|
37277 | if (isNode010 || isNode012) {
|
37278 | first([[writeStream, 'close'], [res, 'aborted']], function (_, stream, event) {
|
37279 | debug('Request#%d %s: writeStream or res %s event emitted', reqId, url, event);
|
37280 | done(__err || null, null, res);
|
37281 | });
|
37282 | } else {
|
37283 | writeStream.on('close', function () {
|
37284 | debug('Request#%d %s: writeStream close event emitted', reqId, url);
|
37285 | done(__err || null, null, res);
|
37286 | });
|
37287 | }
|
37288 | }
|
37289 |
|
37290 | return res.pipe(writeStream);
|
37291 | }
|
37292 |
|
37293 |
|
37294 |
|
37295 |
|
37296 |
|
37297 |
|
37298 |
|
37299 |
|
37300 |
|
37301 |
|
37302 |
|
37303 |
|
37304 |
|
37305 | var chunks = [];
|
37306 | res.on('data', function (chunk) {
|
37307 | debug('Request#%d %s: `res data` event emit, size %d', reqId, url, chunk.length);
|
37308 | responseSize += chunk.length;
|
37309 | chunks.push(chunk);
|
37310 | });
|
37311 | res.on('end', function () {
|
37312 | var body = Buffer.concat(chunks, responseSize);
|
37313 | debug('Request#%d %s: `res end` event emit, total size %d, _dumped: %s', reqId, url, responseSize, res._dumped);
|
37314 |
|
37315 | if (__err) {
|
37316 |
|
37317 | return done(__err, body, res);
|
37318 | }
|
37319 |
|
37320 | var result = handleRedirect(res);
|
37321 |
|
37322 | if (result.error) {
|
37323 | return done(result.error, body, res);
|
37324 | }
|
37325 |
|
37326 | if (result.redirect) {
|
37327 | return;
|
37328 | }
|
37329 |
|
37330 | decodeContent(res, body, function (err, data, encoding) {
|
37331 | if (err) {
|
37332 | return done(err, body, res);
|
37333 | }
|
37334 |
|
37335 |
|
37336 | if (!encoding && TEXT_DATA_TYPES.indexOf(args.dataType) >= 0) {
|
37337 |
|
37338 | try {
|
37339 | data = decodeBodyByCharset(data, res);
|
37340 | } catch (e) {
|
37341 | debug('decodeBodyByCharset error: %s', e);
|
37342 |
|
37343 | return done(null, data, res);
|
37344 | }
|
37345 |
|
37346 | if (args.dataType === 'json') {
|
37347 | if (responseSize === 0) {
|
37348 | data = null;
|
37349 | } else {
|
37350 | var r = parseJSON(data, fixJSONCtlChars);
|
37351 |
|
37352 | if (r.error) {
|
37353 | err = r.error;
|
37354 | } else {
|
37355 | data = r.data;
|
37356 | }
|
37357 | }
|
37358 | }
|
37359 | }
|
37360 |
|
37361 | if (responseAborted) {
|
37362 |
|
37363 |
|
37364 | debug('Request#%d %s: Remote socket was terminated before `response.end()` was called', reqId, url);
|
37365 | }
|
37366 |
|
37367 | done(err, data, res);
|
37368 | });
|
37369 | });
|
37370 | }
|
37371 |
|
37372 | var connectTimeout, responseTimeout;
|
37373 |
|
37374 | if (Array.isArray(args.timeout)) {
|
37375 | connectTimeout = ms(args.timeout[0]);
|
37376 | responseTimeout = ms(args.timeout[1]);
|
37377 | } else {
|
37378 |
|
37379 | connectTimeout = responseTimeout = ms(args.timeout);
|
37380 | }
|
37381 |
|
37382 | debug('ConnectTimeout: %d, ResponseTimeout: %d', connectTimeout, responseTimeout);
|
37383 |
|
37384 | function startConnectTimer() {
|
37385 | debug('Connect timer ticking, timeout: %d', connectTimeout);
|
37386 | connectTimer = setTimeout(function () {
|
37387 | connectTimer = null;
|
37388 |
|
37389 | if (statusCode === -1) {
|
37390 | statusCode = -2;
|
37391 | }
|
37392 |
|
37393 | var msg = 'Connect timeout for ' + connectTimeout + 'ms';
|
37394 | var errorName = 'ConnectionTimeoutError';
|
37395 |
|
37396 | if (!req.socket) {
|
37397 | errorName = 'SocketAssignTimeoutError';
|
37398 | msg += ', working sockets is full';
|
37399 | }
|
37400 |
|
37401 | __err = new Error(msg);
|
37402 | __err.name = errorName;
|
37403 | __err.requestId = reqId;
|
37404 | debug('ConnectTimeout: Request#%d %s %s: %s, connected: %s', reqId, url, __err.name, msg, connected);
|
37405 | abortRequest();
|
37406 | }, connectTimeout);
|
37407 | }
|
37408 |
|
37409 | function startResposneTimer() {
|
37410 | debug('Response timer ticking, timeout: %d', responseTimeout);
|
37411 | responseTimer = setTimeout(function () {
|
37412 | responseTimer = null;
|
37413 | var msg = 'Response timeout for ' + responseTimeout + 'ms';
|
37414 | var errorName = 'ResponseTimeoutError';
|
37415 | __err = new Error(msg);
|
37416 | __err.name = errorName;
|
37417 | __err.requestId = reqId;
|
37418 | debug('ResponseTimeout: Request#%d %s %s: %s, connected: %s', reqId, url, __err.name, msg, connected);
|
37419 | abortRequest();
|
37420 | }, responseTimeout);
|
37421 | }
|
37422 |
|
37423 | var req;
|
37424 |
|
37425 | options.mode = args.mode ? args.mode : '';
|
37426 |
|
37427 | try {
|
37428 | req = httplib.request(options, onResponse);
|
37429 | } catch (err) {
|
37430 | return done(err);
|
37431 | }
|
37432 |
|
37433 |
|
37434 | if (typeof window === 'undefined') {
|
37435 |
|
37436 | startConnectTimer();
|
37437 | } else {
|
37438 | req.on('requestTimeout', function () {
|
37439 | if (statusCode === -1) {
|
37440 | statusCode = -2;
|
37441 | }
|
37442 |
|
37443 | var msg = 'Connect timeout for ' + connectTimeout + 'ms';
|
37444 | var errorName = 'ConnectionTimeoutError';
|
37445 | __err = new Error(msg);
|
37446 | __err.name = errorName;
|
37447 | __err.requestId = reqId;
|
37448 | abortRequest();
|
37449 | });
|
37450 | }
|
37451 |
|
37452 | function abortRequest() {
|
37453 | debug('Request#%d %s abort, connected: %s', reqId, url, connected);
|
37454 |
|
37455 | if (!req.socket) {
|
37456 | __err.noSocket = true;
|
37457 | done(__err);
|
37458 | }
|
37459 |
|
37460 | req.abort();
|
37461 | }
|
37462 |
|
37463 | if (timing) {
|
37464 |
|
37465 | req.on('finish', function () {
|
37466 | timing.requestSent = Date.now() - requestStartTime;
|
37467 | });
|
37468 | }
|
37469 |
|
37470 | req.once('socket', function (socket) {
|
37471 | if (timing) {
|
37472 |
|
37473 | timing.queuing = Date.now() - requestStartTime;
|
37474 | }
|
37475 |
|
37476 |
|
37477 |
|
37478 |
|
37479 | if (isNode010 && socket.socket) {
|
37480 | socket = socket.socket;
|
37481 | }
|
37482 |
|
37483 | var readyState = socket.readyState;
|
37484 |
|
37485 | if (readyState === 'opening') {
|
37486 | socket.once('lookup', function (err, ip, addressType) {
|
37487 | debug('Request#%d %s lookup: %s, %s, %s', reqId, url, err, ip, addressType);
|
37488 |
|
37489 | if (timing) {
|
37490 | timing.dnslookup = Date.now() - requestStartTime;
|
37491 | }
|
37492 |
|
37493 | if (ip) {
|
37494 | remoteAddress = ip;
|
37495 | }
|
37496 | });
|
37497 | socket.once('connect', function () {
|
37498 | if (timing) {
|
37499 |
|
37500 | timing.connected = Date.now() - requestStartTime;
|
37501 | }
|
37502 |
|
37503 |
|
37504 | cancelConnectTimer();
|
37505 | startResposneTimer();
|
37506 | debug('Request#%d %s new socket connected', reqId, url);
|
37507 | connected = true;
|
37508 |
|
37509 | if (!remoteAddress) {
|
37510 | remoteAddress = socket.remoteAddress;
|
37511 | }
|
37512 |
|
37513 | remotePort = socket.remotePort;
|
37514 | });
|
37515 | return;
|
37516 | }
|
37517 |
|
37518 | debug('Request#%d %s reuse socket connected, readyState: %s', reqId, url, readyState);
|
37519 | connected = true;
|
37520 | keepAliveSocket = true;
|
37521 |
|
37522 | if (!remoteAddress) {
|
37523 | remoteAddress = socket.remoteAddress;
|
37524 | }
|
37525 |
|
37526 | remotePort = socket.remotePort;
|
37527 |
|
37528 | cancelConnectTimer();
|
37529 | startResposneTimer();
|
37530 | });
|
37531 | req.on('error', function (err) {
|
37532 |
|
37533 | if (err.name === 'Error' || err.name === 'TypeError') {
|
37534 | err.name = connected ? 'ResponseError' : 'RequestError';
|
37535 | }
|
37536 |
|
37537 | err.message += ' (req "error")';
|
37538 | debug('Request#%d %s `req error` event emit, %s: %s', reqId, url, err.name, err.message);
|
37539 | done(__err || err);
|
37540 | });
|
37541 |
|
37542 | if (writeStream) {
|
37543 | writeStream.once('error', function (err) {
|
37544 | err.message += ' (writeStream "error")';
|
37545 | __err = err;
|
37546 | debug('Request#%d %s `writeStream error` event emit, %s: %s', reqId, url, err.name, err.message);
|
37547 | abortRequest();
|
37548 | });
|
37549 | }
|
37550 |
|
37551 | if (args.stream) {
|
37552 | args.stream.pipe(req);
|
37553 | args.stream.once('error', function (err) {
|
37554 | err.message += ' (stream "error")';
|
37555 | __err = err;
|
37556 | debug('Request#%d %s `readStream error` event emit, %s: %s', reqId, url, err.name, err.message);
|
37557 | abortRequest();
|
37558 | });
|
37559 | } else {
|
37560 | req.end(body);
|
37561 | }
|
37562 |
|
37563 | req.requestId = reqId;
|
37564 | return req;
|
37565 | };
|
37566 |
|
37567 | }).call(this,require('_process'),require("buffer").Buffer)
|
37568 | },{"@babel/runtime/helpers/interopRequireDefault":71,"@babel/runtime/helpers/typeof":72,"_process":393,"buffer":98,"constants":100,"core-js/modules/es.array.concat":234,"core-js/modules/es.array.index-of":241,"core-js/modules/es.array.join":243,"core-js/modules/es.function.name":249,"core-js/modules/es.object.to-string":254,"core-js/modules/es.promise":255,"debug":391,"http":79,"https":298,"humanize-ms":299,"url":394,"util":346}]},{},[1])(1)
|
37569 | });
|
37570 |
|