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 | OSS.Buffer = require('buffer').Buffer;
|
9 | OSS.urllib = require('../shims/xhr');
|
10 | OSS.version = require('./browser/version').version;
|
11 |
|
12 | module.exports = OSS;
|
13 |
|
14 | },{"../shims/xhr":334,"./browser/client":2,"./browser/version":5,"buffer":70}],2:[function(require,module,exports){
|
15 | (function (process,Buffer){
|
16 | 'use strict';
|
17 |
|
18 | var _promise = require('babel-runtime/core-js/promise');
|
19 |
|
20 | var _promise2 = _interopRequireDefault(_promise);
|
21 |
|
22 | var _regenerator = require('babel-runtime/regenerator');
|
23 |
|
24 | var _regenerator2 = _interopRequireDefault(_regenerator);
|
25 |
|
26 | var _assign = require('babel-runtime/core-js/object/assign');
|
27 |
|
28 | var _assign2 = _interopRequireDefault(_assign);
|
29 |
|
30 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
31 |
|
32 | var debug = require('debug')('ali-oss');
|
33 | var crypto = require('./../../shims/crypto/crypto.js');
|
34 | var path = require('path');
|
35 | var copy = require('copy-to');
|
36 | var mime = require('mime');
|
37 | var xml = require('xml2js');
|
38 | var AgentKeepalive = require('agentkeepalive');
|
39 | var merge = require('merge-descriptors');
|
40 | var urlutil = require('url');
|
41 | var is = require('is-type-of');
|
42 | var platform = require('platform');
|
43 | var utility = require('utility');
|
44 | var urllib = require('urllib');
|
45 | var pkg = require('./version');
|
46 | var dateFormat = require('dateformat');
|
47 | var bowser = require('bowser');
|
48 | var signUtils = require('../common/signUtils');
|
49 | var _isIP = require('../common/utils/isIP');
|
50 | var _initOptions = require('../common/client/initOptions');
|
51 |
|
52 | var globalHttpAgent = new AgentKeepalive();
|
53 |
|
54 | function getHeader(headers, name) {
|
55 | return headers[name] || headers[name.toLowerCase()];
|
56 | }
|
57 |
|
58 | function _unSupportBrowserTip() {
|
59 | var name = platform.name,
|
60 | version = platform.version;
|
61 |
|
62 | if (name && name.toLowerCase && name.toLowerCase() === 'ie' && version.split('.')[0] < 10) {
|
63 |
|
64 | console.warn('ali-oss does not support the current browser');
|
65 | }
|
66 | }
|
67 |
|
68 | function isHttpsWebProtocol() {
|
69 |
|
70 |
|
71 | return location && location.protocol === 'https:';
|
72 | }
|
73 |
|
74 | function Client(options, ctx) {
|
75 | _unSupportBrowserTip();
|
76 | if (!(this instanceof Client)) {
|
77 | return new Client(options, ctx);
|
78 | }
|
79 | if (options && options.inited) {
|
80 | this.options = options;
|
81 | } else {
|
82 | this.options = Client.initOptions(options);
|
83 | }
|
84 |
|
85 | this.options.cancelFlag = false;
|
86 |
|
87 |
|
88 | if (this.options.urllib) {
|
89 | this.urllib = this.options.urllib;
|
90 | } else {
|
91 | this.urllib = urllib;
|
92 | this.agent = this.options.agent || globalHttpAgent;
|
93 | }
|
94 | this.ctx = ctx;
|
95 | this.userAgent = this._getUserAgent();
|
96 |
|
97 |
|
98 | this.options.amendTimeSkewed = 0;
|
99 | }
|
100 |
|
101 |
|
102 |
|
103 |
|
104 |
|
105 | module.exports = Client;
|
106 |
|
107 | Client.initOptions = function initOptions(options) {
|
108 | if (!options.stsToken) {
|
109 | console.warn('Please use STS Token for safety, see more details at https://help.aliyun.com/document_detail/32077.html');
|
110 | }
|
111 | var opts = (0, _assign2.default)({
|
112 | secure: isHttpsWebProtocol(),
|
113 |
|
114 | useFetch: false
|
115 | }, options);
|
116 |
|
117 | return _initOptions(opts);
|
118 | };
|
119 |
|
120 |
|
121 |
|
122 |
|
123 |
|
124 | var proto = Client.prototype;
|
125 |
|
126 |
|
127 | proto.debug = debug;
|
128 |
|
129 |
|
130 |
|
131 |
|
132 | merge(proto, require('./object'));
|
133 |
|
134 |
|
135 |
|
136 | merge(proto, require('../common/bucket/getBucketWebsite'));
|
137 | merge(proto, require('../common/bucket/putBucketWebsite'));
|
138 | merge(proto, require('../common/bucket/deleteBucketWebsite'));
|
139 |
|
140 |
|
141 | merge(proto, require('../common/bucket/getBucketLifecycle'));
|
142 | merge(proto, require('../common/bucket/putBucketLifecycle'));
|
143 | merge(proto, require('../common/bucket/deleteBucketLifecycle'));
|
144 |
|
145 |
|
146 | merge(proto, require('../common/bucket/putBucketVersioning'));
|
147 | merge(proto, require('../common/bucket/getBucketVersioning'));
|
148 |
|
149 |
|
150 | merge(proto, require('./managed-upload'));
|
151 |
|
152 |
|
153 |
|
154 | merge(proto, require('../common/multipart'));
|
155 |
|
156 |
|
157 |
|
158 |
|
159 | merge(proto, require('../common/parallel'));
|
160 |
|
161 |
|
162 |
|
163 |
|
164 |
|
165 |
|
166 | proto.signature = function signature(stringToSign) {
|
167 | this.debug('authorization stringToSign: %s', stringToSign, 'info');
|
168 |
|
169 | return signUtils.computeSignature(this.options.accessKeySecret, stringToSign);
|
170 | };
|
171 |
|
172 |
|
173 |
|
174 |
|
175 |
|
176 |
|
177 |
|
178 |
|
179 |
|
180 |
|
181 |
|
182 |
|
183 |
|
184 |
|
185 |
|
186 |
|
187 |
|
188 |
|
189 |
|
190 |
|
191 |
|
192 |
|
193 | proto.authorization = function authorization(method, resource, subres, headers) {
|
194 | var stringToSign = signUtils.buildCanonicalString(method.toUpperCase(), resource, {
|
195 | headers: headers,
|
196 | parameters: subres
|
197 | });
|
198 |
|
199 | return signUtils.authorization(this.options.accessKeyId, this.options.accessKeySecret, stringToSign);
|
200 | };
|
201 |
|
202 |
|
203 |
|
204 |
|
205 |
|
206 |
|
207 |
|
208 | proto.createRequest = function createRequest(params) {
|
209 | var headers = {
|
210 | 'x-oss-date': dateFormat(+new Date() + this.options.amendTimeSkewed, 'UTC:ddd, dd mmm yyyy HH:MM:ss \'GMT\''),
|
211 | 'x-oss-user-agent': this.userAgent
|
212 | };
|
213 |
|
214 | if (this.options.isRequestPay) {
|
215 | (0, _assign2.default)(headers, { 'x-oss-request-payer': 'requester' });
|
216 | }
|
217 |
|
218 | if (this.options.stsToken) {
|
219 | headers['x-oss-security-token'] = this.options.stsToken;
|
220 | }
|
221 |
|
222 | copy(params.headers).to(headers);
|
223 |
|
224 | if (!getHeader(headers, 'Content-Type')) {
|
225 | if (params.mime === mime.default_type) {
|
226 | params.mime = '';
|
227 | }
|
228 |
|
229 | if (params.mime && params.mime.indexOf('/') > 0) {
|
230 | headers['Content-Type'] = params.mime;
|
231 | } else {
|
232 | headers['Content-Type'] = mime.getType(params.mime || path.extname(params.object || '')) || 'application/octet-stream';
|
233 | }
|
234 | }
|
235 |
|
236 | if (params.content) {
|
237 | headers['Content-Md5'] = crypto.createHash('md5').update(Buffer.from(params.content, 'utf8')).digest('base64');
|
238 | if (!headers['Content-Length']) {
|
239 | headers['Content-Length'] = params.content.length;
|
240 | }
|
241 | }
|
242 |
|
243 | var authResource = this._getResource(params);
|
244 | headers.authorization = this.authorization(params.method, authResource, params.subres, headers);
|
245 |
|
246 | var url = this._getReqUrl(params);
|
247 | this.debug('request %s %s, with headers %j, !!stream: %s', params.method, url, headers, !!params.stream, 'info');
|
248 | var timeout = params.timeout || this.options.timeout;
|
249 | var reqParams = {
|
250 | agent: this.agent,
|
251 | method: params.method,
|
252 | content: params.content,
|
253 | stream: params.stream,
|
254 | headers: headers,
|
255 | timeout: timeout,
|
256 | writeStream: params.writeStream,
|
257 | customResponse: params.customResponse,
|
258 | ctx: params.ctx || this.ctx
|
259 | };
|
260 |
|
261 | return {
|
262 | url: url,
|
263 | params: reqParams
|
264 | };
|
265 | };
|
266 |
|
267 |
|
268 |
|
269 |
|
270 |
|
271 |
|
272 |
|
273 |
|
274 |
|
275 |
|
276 |
|
277 |
|
278 |
|
279 |
|
280 |
|
281 |
|
282 |
|
283 |
|
284 |
|
285 |
|
286 | proto.request = function request(params) {
|
287 | var reqParams, result, reqErr, useStream, err, parseData;
|
288 | return _regenerator2.default.async(function request$(_context) {
|
289 | while (1) {
|
290 | switch (_context.prev = _context.next) {
|
291 | case 0:
|
292 | reqParams = this.createRequest(params);
|
293 |
|
294 |
|
295 | if (!this.options.useFetch) {
|
296 | reqParams.params.mode = 'disable-fetch';
|
297 | }
|
298 | result = void 0;
|
299 | reqErr = void 0;
|
300 | useStream = !!params.stream;
|
301 | _context.prev = 5;
|
302 | _context.next = 8;
|
303 | return _regenerator2.default.awrap(this.urllib.request(reqParams.url, reqParams.params));
|
304 |
|
305 | case 8:
|
306 | result = _context.sent;
|
307 |
|
308 | this.debug('response %s %s, got %s, headers: %j', params.method, reqParams.url, result.status, result.headers, 'info');
|
309 | _context.next = 15;
|
310 | break;
|
311 |
|
312 | case 12:
|
313 | _context.prev = 12;
|
314 | _context.t0 = _context['catch'](5);
|
315 |
|
316 | reqErr = _context.t0;
|
317 |
|
318 | case 15:
|
319 | err = void 0;
|
320 |
|
321 | if (!(result && params.successStatuses && params.successStatuses.indexOf(result.status) === -1)) {
|
322 | _context.next = 28;
|
323 | break;
|
324 | }
|
325 |
|
326 | _context.next = 19;
|
327 | return _regenerator2.default.awrap(this.requestError(result));
|
328 |
|
329 | case 19:
|
330 | err = _context.sent;
|
331 |
|
332 | if (!(err.code === 'RequestTimeTooSkewed' && !useStream)) {
|
333 | _context.next = 25;
|
334 | break;
|
335 | }
|
336 |
|
337 | this.options.amendTimeSkewed = +new Date(err.serverTime) - new Date();
|
338 | _context.next = 24;
|
339 | return _regenerator2.default.awrap(this.request(params));
|
340 |
|
341 | case 24:
|
342 | return _context.abrupt('return', _context.sent);
|
343 |
|
344 | case 25:
|
345 | err.params = params;
|
346 | _context.next = 32;
|
347 | break;
|
348 |
|
349 | case 28:
|
350 | if (!reqErr) {
|
351 | _context.next = 32;
|
352 | break;
|
353 | }
|
354 |
|
355 | _context.next = 31;
|
356 | return _regenerator2.default.awrap(this.requestError(reqErr));
|
357 |
|
358 | case 31:
|
359 | err = _context.sent;
|
360 |
|
361 | case 32:
|
362 | if (!err) {
|
363 | _context.next = 34;
|
364 | break;
|
365 | }
|
366 |
|
367 | throw err;
|
368 |
|
369 | case 34:
|
370 | if (!params.xmlResponse) {
|
371 | _context.next = 39;
|
372 | break;
|
373 | }
|
374 |
|
375 | _context.next = 37;
|
376 | return _regenerator2.default.awrap(this.parseXML(result.data));
|
377 |
|
378 | case 37:
|
379 | parseData = _context.sent;
|
380 |
|
381 | result.data = parseData;
|
382 |
|
383 | case 39:
|
384 | return _context.abrupt('return', result);
|
385 |
|
386 | case 40:
|
387 | case 'end':
|
388 | return _context.stop();
|
389 | }
|
390 | }
|
391 | }, null, this, [[5, 12]]);
|
392 | };
|
393 |
|
394 | proto._getResource = function _getResource(params) {
|
395 | var resource = '/';
|
396 | if (params.bucket) resource += params.bucket + '/';
|
397 | if (params.object) resource += params.object;
|
398 |
|
399 | return resource;
|
400 | };
|
401 |
|
402 | proto._isIP = _isIP;
|
403 |
|
404 | proto._escape = function _escape(name) {
|
405 | return utility.encodeURIComponent(name).replace(/%2F/g, '/');
|
406 | };
|
407 |
|
408 | proto._getReqUrl = function _getReqUrl(params) {
|
409 | var ep = {};
|
410 | copy(this.options.endpoint).to(ep);
|
411 | var isIP = this._isIP(ep.hostname);
|
412 | var isCname = this.options.cname;
|
413 | if (params.bucket && !isCname && !isIP) {
|
414 | ep.host = params.bucket + '.' + ep.host;
|
415 | }
|
416 |
|
417 | var reourcePath = '/';
|
418 | if (params.bucket && isIP) {
|
419 | reourcePath += params.bucket + '/';
|
420 | }
|
421 |
|
422 | if (params.object) {
|
423 |
|
424 | reourcePath += this._escape(params.object).replace(/\+/g, '%2B');
|
425 | }
|
426 | ep.pathname = reourcePath;
|
427 |
|
428 | var query = {};
|
429 | if (params.query) {
|
430 | merge(query, params.query);
|
431 | }
|
432 |
|
433 | if (params.subres) {
|
434 | var subresAsQuery = {};
|
435 | if (is.string(params.subres)) {
|
436 | subresAsQuery[params.subres] = '';
|
437 | } else if (is.array(params.subres)) {
|
438 | params.subres.forEach(function (k) {
|
439 | subresAsQuery[k] = '';
|
440 | });
|
441 | } else {
|
442 | subresAsQuery = params.subres;
|
443 | }
|
444 | merge(query, subresAsQuery);
|
445 | }
|
446 |
|
447 | ep.query = query;
|
448 |
|
449 | return urlutil.format(ep);
|
450 | };
|
451 |
|
452 |
|
453 |
|
454 |
|
455 |
|
456 |
|
457 |
|
458 |
|
459 |
|
460 | proto._getUserAgent = function _getUserAgent() {
|
461 | var agent = process && process.browser ? 'js' : 'nodejs';
|
462 | var sdk = 'aliyun-sdk-' + agent + '/' + pkg.version;
|
463 | var plat = platform.description;
|
464 | if (!plat && process) {
|
465 | plat = 'Node.js ' + process.version.slice(1) + ' on ' + process.platform + ' ' + process.arch;
|
466 | }
|
467 |
|
468 | return this._checkUserAgent(sdk + ' ' + plat);
|
469 | };
|
470 |
|
471 | proto._checkUserAgent = function _checkUserAgent(ua) {
|
472 | var userAgent = ua.replace(/\u03b1/, 'alpha').replace(/\u03b2/, 'beta');
|
473 | return userAgent;
|
474 | };
|
475 |
|
476 |
|
477 |
|
478 |
|
479 |
|
480 |
|
481 |
|
482 |
|
483 |
|
484 | proto.checkBrowserAndVersion = function checkBrowserAndVersion(name, version) {
|
485 | return bowser.name === name && bowser.version.split('.')[0] === version;
|
486 | };
|
487 |
|
488 |
|
489 |
|
490 |
|
491 |
|
492 |
|
493 |
|
494 |
|
495 | proto.parseXML = function parseXMLThunk(str) {
|
496 | return new _promise2.default(function (resolve, reject) {
|
497 | if (Buffer.isBuffer(str)) {
|
498 | str = str.toString();
|
499 | }
|
500 | xml.parseString(str, {
|
501 | explicitRoot: false,
|
502 | explicitArray: false
|
503 | }, function (err, result) {
|
504 | if (err) {
|
505 | reject(err);
|
506 | } else {
|
507 | resolve(result);
|
508 | }
|
509 | });
|
510 | });
|
511 | };
|
512 |
|
513 |
|
514 |
|
515 |
|
516 |
|
517 |
|
518 |
|
519 |
|
520 | proto.requestError = function requestError(result) {
|
521 | var err, message, info, msg;
|
522 | return _regenerator2.default.async(function requestError$(_context2) {
|
523 | while (1) {
|
524 | switch (_context2.prev = _context2.next) {
|
525 | case 0:
|
526 | err = null;
|
527 |
|
528 | if (!(!result.data || !result.data.length)) {
|
529 | _context2.next = 5;
|
530 | break;
|
531 | }
|
532 |
|
533 | if (result.status === -1 || result.status === -2) {
|
534 |
|
535 | err = new Error(result.message);
|
536 | err.name = result.name;
|
537 | err.status = result.status;
|
538 | err.code = result.name;
|
539 | } else {
|
540 |
|
541 | if (result.status === 404) {
|
542 | err = new Error('Object not exists');
|
543 | err.name = 'NoSuchKeyError';
|
544 | err.status = 404;
|
545 | err.code = 'NoSuchKey';
|
546 | } else if (result.status === 412) {
|
547 | err = new Error('Pre condition failed');
|
548 | err.name = 'PreconditionFailedError';
|
549 | err.status = 412;
|
550 | err.code = 'PreconditionFailed';
|
551 | } else {
|
552 | err = new Error('Unknow error, status: ' + result.status);
|
553 | err.name = 'UnknowError';
|
554 | err.status = result.status;
|
555 | }
|
556 | err.requestId = result.headers['x-oss-request-id'];
|
557 | err.host = '';
|
558 | }
|
559 | _context2.next = 33;
|
560 | break;
|
561 |
|
562 | case 5:
|
563 | message = String(result.data);
|
564 |
|
565 | this.debug('request response error data: %s', message, 'error');
|
566 |
|
567 | info = void 0;
|
568 | _context2.prev = 8;
|
569 | _context2.next = 11;
|
570 | return _regenerator2.default.awrap(this.parseXML(message));
|
571 |
|
572 | case 11:
|
573 | _context2.t0 = _context2.sent;
|
574 |
|
575 | if (_context2.t0) {
|
576 | _context2.next = 14;
|
577 | break;
|
578 | }
|
579 |
|
580 | _context2.t0 = {};
|
581 |
|
582 | case 14:
|
583 | info = _context2.t0;
|
584 | _context2.next = 24;
|
585 | break;
|
586 |
|
587 | case 17:
|
588 | _context2.prev = 17;
|
589 | _context2.t1 = _context2['catch'](8);
|
590 |
|
591 | this.debug(message, 'error');
|
592 | _context2.t1.message += '\nraw xml: ' + message;
|
593 | _context2.t1.status = result.status;
|
594 | _context2.t1.requestId = result.headers['x-oss-request-id'];
|
595 | return _context2.abrupt('return', _context2.t1);
|
596 |
|
597 | case 24:
|
598 | msg = info.Message || 'unknow request error, status: ' + result.status;
|
599 |
|
600 | if (info.Condition) {
|
601 | msg += ' (condition: ' + info.Condition + ')';
|
602 | }
|
603 | err = new Error(msg);
|
604 | err.name = info.Code ? info.Code + 'Error' : 'UnknowError';
|
605 | err.status = result.status;
|
606 | err.code = info.Code;
|
607 | err.requestId = info.RequestId;
|
608 | err.hostId = info.HostId;
|
609 | err.serverTime = info.ServerTime;
|
610 |
|
611 | case 33:
|
612 |
|
613 | this.debug('generate error %j', err, 'error');
|
614 | return _context2.abrupt('return', err);
|
615 |
|
616 | case 35:
|
617 | case 'end':
|
618 | return _context2.stop();
|
619 | }
|
620 | }
|
621 | }, null, this, [[8, 17]]);
|
622 | };
|
623 |
|
624 | }).call(this,require('_process'),require("buffer").Buffer)
|
625 | },{"../common/bucket/deleteBucketLifecycle":6,"../common/bucket/deleteBucketWebsite":7,"../common/bucket/getBucketLifecycle":8,"../common/bucket/getBucketVersioning":9,"../common/bucket/getBucketWebsite":10,"../common/bucket/putBucketLifecycle":11,"../common/bucket/putBucketVersioning":12,"../common/bucket/putBucketWebsite":13,"../common/client/initOptions":15,"../common/multipart":18,"../common/parallel":29,"../common/signUtils":30,"../common/utils/isIP":40,"./../../shims/crypto/crypto.js":328,"./managed-upload":3,"./object":4,"./version":5,"_process":249,"agentkeepalive":43,"babel-runtime/core-js/object/assign":49,"babel-runtime/core-js/promise":56,"babel-runtime/regenerator":65,"bowser":67,"buffer":70,"copy-to":73,"dateformat":187,"debug":188,"is-type-of":233,"merge-descriptors":237,"mime":332,"path":246,"platform":247,"url":279,"urllib":334,"utility":333,"xml2js":293}],3:[function(require,module,exports){
|
626 | (function (Buffer){
|
627 | 'use strict';
|
628 |
|
629 | var _from = require('babel-runtime/core-js/array/from');
|
630 |
|
631 | var _from2 = _interopRequireDefault(_from);
|
632 |
|
633 | var _promise = require('babel-runtime/core-js/promise');
|
634 |
|
635 | var _promise2 = _interopRequireDefault(_promise);
|
636 |
|
637 | var _regenerator = require('babel-runtime/regenerator');
|
638 |
|
639 | var _regenerator2 = _interopRequireDefault(_regenerator);
|
640 |
|
641 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
642 |
|
643 |
|
644 | var is = require('is-type-of');
|
645 | var util = require('util');
|
646 | var path = require('path');
|
647 | var mime = require('mime');
|
648 | var copy = require('copy-to');
|
649 | var isBlob = require('../common/utils/isBlob');
|
650 | var isFile = require('../common/utils/isFile');
|
651 |
|
652 | var proto = exports;
|
653 |
|
654 |
|
655 |
|
656 |
|
657 |
|
658 |
|
659 |
|
660 |
|
661 |
|
662 |
|
663 |
|
664 |
|
665 |
|
666 |
|
667 |
|
668 |
|
669 |
|
670 |
|
671 |
|
672 |
|
673 |
|
674 | proto.multipartUpload = function multipartUpload(name, file, options) {
|
675 | var minPartSize, fileSize, stream, result, ret, initResult, uploadId, partSize, checkpoint;
|
676 | return _regenerator2.default.async(function multipartUpload$(_context) {
|
677 | while (1) {
|
678 | switch (_context.prev = _context.next) {
|
679 | case 0:
|
680 | this.resetCancelFlag();
|
681 | options = options || {};
|
682 |
|
683 | if (!(options.checkpoint && options.checkpoint.uploadId)) {
|
684 | _context.next = 6;
|
685 | break;
|
686 | }
|
687 |
|
688 | _context.next = 5;
|
689 | return _regenerator2.default.awrap(this._resumeMultipart(options.checkpoint, options));
|
690 |
|
691 | case 5:
|
692 | return _context.abrupt('return', _context.sent);
|
693 |
|
694 | case 6:
|
695 | minPartSize = 100 * 1024;
|
696 |
|
697 |
|
698 | if (!options.mime) {
|
699 | if (isFile(file)) {
|
700 | options.mime = mime.getType(path.extname(file.name));
|
701 | } else if (isBlob(file)) {
|
702 | options.mime = file.type;
|
703 | } else {
|
704 | options.mime = mime.getType(path.extname(file));
|
705 | }
|
706 | }
|
707 |
|
708 | options.headers = options.headers || {};
|
709 | this._convertMetaToHeaders(options.meta, options.headers);
|
710 |
|
711 | _context.next = 12;
|
712 | return _regenerator2.default.awrap(this._getFileSize(file));
|
713 |
|
714 | case 12:
|
715 | fileSize = _context.sent;
|
716 |
|
717 | if (!(fileSize < minPartSize)) {
|
718 | _context.next = 25;
|
719 | break;
|
720 | }
|
721 |
|
722 | stream = this._createStream(file, 0, fileSize);
|
723 |
|
724 | options.contentLength = fileSize;
|
725 |
|
726 | _context.next = 18;
|
727 | return _regenerator2.default.awrap(this.putStream(name, stream, options));
|
728 |
|
729 | case 18:
|
730 | result = _context.sent;
|
731 |
|
732 | if (!(options && options.progress)) {
|
733 | _context.next = 22;
|
734 | break;
|
735 | }
|
736 |
|
737 | _context.next = 22;
|
738 | return _regenerator2.default.awrap(options.progress(1));
|
739 |
|
740 | case 22:
|
741 | ret = {
|
742 | res: result.res,
|
743 | bucket: this.options.bucket,
|
744 | name: name,
|
745 | etag: result.res.headers.etag
|
746 | };
|
747 |
|
748 |
|
749 | if (options.headers && options.headers['x-oss-callback'] || options.callback) {
|
750 | ret.data = result.data;
|
751 | }
|
752 |
|
753 | return _context.abrupt('return', ret);
|
754 |
|
755 | case 25:
|
756 | if (!(options.partSize && !(parseInt(options.partSize, 10) === options.partSize))) {
|
757 | _context.next = 27;
|
758 | break;
|
759 | }
|
760 |
|
761 | throw new Error('partSize must be int number');
|
762 |
|
763 | case 27:
|
764 | if (!(options.partSize && options.partSize < minPartSize)) {
|
765 | _context.next = 29;
|
766 | break;
|
767 | }
|
768 |
|
769 | throw new Error('partSize must not be smaller than ' + minPartSize);
|
770 |
|
771 | case 29:
|
772 | _context.next = 31;
|
773 | return _regenerator2.default.awrap(this.initMultipartUpload(name, options));
|
774 |
|
775 | case 31:
|
776 | initResult = _context.sent;
|
777 | uploadId = initResult.uploadId;
|
778 | partSize = this._getPartSize(fileSize, options.partSize);
|
779 | checkpoint = {
|
780 | file: file,
|
781 | name: name,
|
782 | fileSize: fileSize,
|
783 | partSize: partSize,
|
784 | uploadId: uploadId,
|
785 | doneParts: []
|
786 | };
|
787 |
|
788 | if (!(options && options.progress)) {
|
789 | _context.next = 38;
|
790 | break;
|
791 | }
|
792 |
|
793 | _context.next = 38;
|
794 | return _regenerator2.default.awrap(options.progress(0, checkpoint, initResult.res));
|
795 |
|
796 | case 38:
|
797 | _context.next = 40;
|
798 | return _regenerator2.default.awrap(this._resumeMultipart(checkpoint, options));
|
799 |
|
800 | case 40:
|
801 | return _context.abrupt('return', _context.sent);
|
802 |
|
803 | case 41:
|
804 | case 'end':
|
805 | return _context.stop();
|
806 | }
|
807 | }
|
808 | }, null, this);
|
809 | };
|
810 |
|
811 |
|
812 |
|
813 |
|
814 |
|
815 |
|
816 |
|
817 | proto._resumeMultipart = function _resumeMultipart(checkpoint, options) {
|
818 | var that, file, fileSize, partSize, uploadId, doneParts, name, internalDoneParts, partOffs, numParts, multipartFinish, uploadPartJob, all, done, todo, defaultParallel, parallel, jobErr;
|
819 | return _regenerator2.default.async(function _resumeMultipart$(_context3) {
|
820 | while (1) {
|
821 | switch (_context3.prev = _context3.next) {
|
822 | case 0:
|
823 | that = this;
|
824 |
|
825 | if (!this.isCancel()) {
|
826 | _context3.next = 3;
|
827 | break;
|
828 | }
|
829 |
|
830 | throw this._makeCancelEvent();
|
831 |
|
832 | case 3:
|
833 | file = checkpoint.file, fileSize = checkpoint.fileSize, partSize = checkpoint.partSize, uploadId = checkpoint.uploadId, doneParts = checkpoint.doneParts, name = checkpoint.name;
|
834 | internalDoneParts = [];
|
835 |
|
836 |
|
837 | if (doneParts.length > 0) {
|
838 | copy(doneParts).to(internalDoneParts);
|
839 | }
|
840 |
|
841 | partOffs = this._divideParts(fileSize, partSize);
|
842 | numParts = partOffs.length;
|
843 | multipartFinish = false;
|
844 |
|
845 | uploadPartJob = function uploadPartJob(self, partNo) {
|
846 | var _this = this;
|
847 |
|
848 | return new _promise2.default(function _callee(resolve, reject) {
|
849 | var pi, data, result, tempErr;
|
850 | return _regenerator2.default.async(function _callee$(_context2) {
|
851 | while (1) {
|
852 | switch (_context2.prev = _context2.next) {
|
853 | case 0:
|
854 | _context2.prev = 0;
|
855 |
|
856 | if (self.isCancel()) {
|
857 | _context2.next = 18;
|
858 | break;
|
859 | }
|
860 |
|
861 | pi = partOffs[partNo - 1];
|
862 | data = {
|
863 | stream: self._createStream(file, pi.start, pi.end),
|
864 | size: pi.end - pi.start
|
865 | };
|
866 | _context2.next = 6;
|
867 | return _regenerator2.default.awrap(self._uploadPart(name, uploadId, partNo, data));
|
868 |
|
869 | case 6:
|
870 | result = _context2.sent;
|
871 |
|
872 | if (!(!self.isCancel() && !multipartFinish)) {
|
873 | _context2.next = 15;
|
874 | break;
|
875 | }
|
876 |
|
877 | checkpoint.doneParts.push({
|
878 | number: partNo,
|
879 | etag: result.res.headers.etag
|
880 | });
|
881 |
|
882 | if (!options.progress) {
|
883 | _context2.next = 12;
|
884 | break;
|
885 | }
|
886 |
|
887 | _context2.next = 12;
|
888 | return _regenerator2.default.awrap(options.progress(doneParts.length / numParts, checkpoint, result.res));
|
889 |
|
890 | case 12:
|
891 |
|
892 | resolve({
|
893 | number: partNo,
|
894 | etag: result.res.headers.etag
|
895 | });
|
896 | _context2.next = 16;
|
897 | break;
|
898 |
|
899 | case 15:
|
900 | resolve();
|
901 |
|
902 | case 16:
|
903 | _context2.next = 19;
|
904 | break;
|
905 |
|
906 | case 18:
|
907 | resolve();
|
908 |
|
909 | case 19:
|
910 | _context2.next = 30;
|
911 | break;
|
912 |
|
913 | case 21:
|
914 | _context2.prev = 21;
|
915 | _context2.t0 = _context2['catch'](0);
|
916 | tempErr = new Error();
|
917 |
|
918 | tempErr.name = _context2.t0.name;
|
919 | tempErr.message = _context2.t0.message;
|
920 | tempErr.stack = _context2.t0.stack;
|
921 | tempErr.partNum = partNo;
|
922 | copy(_context2.t0).to(tempErr);
|
923 | reject(tempErr);
|
924 |
|
925 | case 30:
|
926 | case 'end':
|
927 | return _context2.stop();
|
928 | }
|
929 | }
|
930 | }, null, _this, [[0, 21]]);
|
931 | });
|
932 | };
|
933 |
|
934 | all = (0, _from2.default)(new Array(numParts), function (x, i) {
|
935 | return i + 1;
|
936 | });
|
937 | done = internalDoneParts.map(function (p) {
|
938 | return p.number;
|
939 | });
|
940 | todo = all.filter(function (p) {
|
941 | return done.indexOf(p) < 0;
|
942 | });
|
943 | defaultParallel = 5;
|
944 | parallel = options.parallel || defaultParallel;
|
945 |
|
946 |
|
947 |
|
948 | _context3.next = 17;
|
949 | return _regenerator2.default.awrap(this._parallel(todo, parallel, function (value) {
|
950 | return new _promise2.default(function (resolve, reject) {
|
951 | uploadPartJob(that, value).then(function (result) {
|
952 | if (result) {
|
953 | internalDoneParts.push(result);
|
954 | }
|
955 | resolve();
|
956 | }).catch(function (err) {
|
957 | reject(err);
|
958 | });
|
959 | });
|
960 | }));
|
961 |
|
962 | case 17:
|
963 | jobErr = _context3.sent;
|
964 |
|
965 | multipartFinish = true;
|
966 |
|
967 | if (!this.isCancel()) {
|
968 | _context3.next = 22;
|
969 | break;
|
970 | }
|
971 |
|
972 | uploadPartJob = null;
|
973 | throw this._makeCancelEvent();
|
974 |
|
975 | case 22:
|
976 | if (!(jobErr && jobErr.length > 0)) {
|
977 | _context3.next = 25;
|
978 | break;
|
979 | }
|
980 |
|
981 | jobErr[0].message = 'Failed to upload some parts with error: ' + jobErr[0].toString() + ' part_num: ' + jobErr[0].partNum;
|
982 | throw jobErr[0];
|
983 |
|
984 | case 25:
|
985 | _context3.next = 27;
|
986 | return _regenerator2.default.awrap(this.completeMultipartUpload(name, uploadId, internalDoneParts, options));
|
987 |
|
988 | case 27:
|
989 | return _context3.abrupt('return', _context3.sent);
|
990 |
|
991 | case 28:
|
992 | case 'end':
|
993 | return _context3.stop();
|
994 | }
|
995 | }
|
996 | }, null, this);
|
997 | };
|
998 |
|
999 |
|
1000 |
|
1001 |
|
1002 | proto._getFileSize = function _getFileSize(file) {
|
1003 | return _regenerator2.default.async(function _getFileSize$(_context4) {
|
1004 | while (1) {
|
1005 | switch (_context4.prev = _context4.next) {
|
1006 | case 0:
|
1007 | if (!is.buffer(file)) {
|
1008 | _context4.next = 4;
|
1009 | break;
|
1010 | }
|
1011 |
|
1012 | return _context4.abrupt('return', file.length);
|
1013 |
|
1014 | case 4:
|
1015 | if (!(isBlob(file) || isFile(file))) {
|
1016 | _context4.next = 6;
|
1017 | break;
|
1018 | }
|
1019 |
|
1020 | return _context4.abrupt('return', file.size);
|
1021 |
|
1022 | case 6:
|
1023 | throw new Error('_getFileSize requires Buffer/File/Blob.');
|
1024 |
|
1025 | case 7:
|
1026 | case 'end':
|
1027 | return _context4.stop();
|
1028 | }
|
1029 | }
|
1030 | }, null, this);
|
1031 | };
|
1032 |
|
1033 |
|
1034 |
|
1035 |
|
1036 |
|
1037 | var _require = require('stream'),
|
1038 | Readable = _require.Readable;
|
1039 |
|
1040 | function WebFileReadStream(file, options) {
|
1041 | if (!(this instanceof WebFileReadStream)) {
|
1042 | return new WebFileReadStream(file, options);
|
1043 | }
|
1044 |
|
1045 | Readable.call(this, options);
|
1046 |
|
1047 | this.file = file;
|
1048 | this.reader = new FileReader();
|
1049 | this.start = 0;
|
1050 | this.finish = false;
|
1051 | this.fileBuffer = null;
|
1052 | }
|
1053 | util.inherits(WebFileReadStream, Readable);
|
1054 |
|
1055 | WebFileReadStream.prototype.readFileAndPush = function readFileAndPush(size) {
|
1056 | if (this.fileBuffer) {
|
1057 | var pushRet = true;
|
1058 | while (pushRet && this.fileBuffer && this.start < this.fileBuffer.length) {
|
1059 | var start = this.start;
|
1060 |
|
1061 | var end = start + size;
|
1062 | end = end > this.fileBuffer.length ? this.fileBuffer.length : end;
|
1063 | this.start = end;
|
1064 | pushRet = this.push(this.fileBuffer.slice(start, end));
|
1065 | }
|
1066 | }
|
1067 | };
|
1068 |
|
1069 | WebFileReadStream.prototype._read = function _read(size) {
|
1070 | if (this.file && this.start >= this.file.size || this.fileBuffer && this.start >= this.fileBuffer.length || this.finish || this.start === 0 && !this.file) {
|
1071 | if (!this.finish) {
|
1072 | this.fileBuffer = null;
|
1073 | this.finish = true;
|
1074 | }
|
1075 | this.push(null);
|
1076 | return;
|
1077 | }
|
1078 |
|
1079 | var defaultReadSize = 16 * 1024;
|
1080 | size = size || defaultReadSize;
|
1081 |
|
1082 | var that = this;
|
1083 | this.reader.onload = function onload(e) {
|
1084 | that.fileBuffer = Buffer.from(new Uint8Array(e.target.result));
|
1085 | that.file = null;
|
1086 | that.readFileAndPush(size);
|
1087 | };
|
1088 |
|
1089 | if (this.start === 0) {
|
1090 | this.reader.readAsArrayBuffer(this.file);
|
1091 | } else {
|
1092 | this.readFileAndPush(size);
|
1093 | }
|
1094 | };
|
1095 |
|
1096 | proto._createStream = function _createStream(file, start, end) {
|
1097 | if (isBlob(file) || isFile(file)) {
|
1098 | return new WebFileReadStream(file.slice(start, end));
|
1099 | }
|
1100 |
|
1101 |
|
1102 |
|
1103 |
|
1104 |
|
1105 |
|
1106 |
|
1107 | throw new Error('_createStream requires File/Blob.');
|
1108 | };
|
1109 |
|
1110 | proto._getPartSize = function _getPartSize(fileSize, partSize) {
|
1111 | var maxNumParts = 10 * 1000;
|
1112 | var defaultPartSize = 1024 * 1024;
|
1113 |
|
1114 | if (!partSize) {
|
1115 | return defaultPartSize;
|
1116 | }
|
1117 |
|
1118 | return Math.max(Math.ceil(fileSize / maxNumParts), partSize);
|
1119 | };
|
1120 |
|
1121 | proto._divideParts = function _divideParts(fileSize, partSize) {
|
1122 | var numParts = Math.ceil(fileSize / partSize);
|
1123 |
|
1124 | var partOffs = [];
|
1125 | for (var i = 0; i < numParts; i++) {
|
1126 | var start = partSize * i;
|
1127 | var end = Math.min(start + partSize, fileSize);
|
1128 |
|
1129 | partOffs.push({
|
1130 | start: start,
|
1131 | end: end
|
1132 | });
|
1133 | }
|
1134 |
|
1135 | return partOffs;
|
1136 | };
|
1137 |
|
1138 | }).call(this,require("buffer").Buffer)
|
1139 | },{"../common/utils/isBlob":38,"../common/utils/isFile":39,"babel-runtime/core-js/array/from":47,"babel-runtime/core-js/promise":56,"babel-runtime/regenerator":65,"buffer":70,"copy-to":73,"is-type-of":233,"mime":332,"path":246,"stream":271,"util":287}],4:[function(require,module,exports){
|
1140 | 'use strict';
|
1141 |
|
1142 | var _promise = require('babel-runtime/core-js/promise');
|
1143 |
|
1144 | var _promise2 = _interopRequireDefault(_promise);
|
1145 |
|
1146 | var _keys = require('babel-runtime/core-js/object/keys');
|
1147 |
|
1148 | var _keys2 = _interopRequireDefault(_keys);
|
1149 |
|
1150 | var _assign = require('babel-runtime/core-js/object/assign');
|
1151 |
|
1152 | var _assign2 = _interopRequireDefault(_assign);
|
1153 |
|
1154 | var _regenerator = require('babel-runtime/regenerator');
|
1155 |
|
1156 | var _regenerator2 = _interopRequireDefault(_regenerator);
|
1157 |
|
1158 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
1159 |
|
1160 |
|
1161 | var utility = require('utility');
|
1162 | var fs = require('fs');
|
1163 | var is = require('is-type-of');
|
1164 | var urlutil = require('url');
|
1165 | var copy = require('copy-to');
|
1166 | var path = require('path');
|
1167 | var mime = require('mime');
|
1168 | var callback = require('../common/callback');
|
1169 | var signHelper = require('../common/signUtils');
|
1170 | var merge = require('merge-descriptors');
|
1171 | var isBlob = require('../common/utils/isBlob');
|
1172 | var isFile = require('../common/utils/isFile');
|
1173 |
|
1174 |
|
1175 |
|
1176 |
|
1177 | var proto = exports;
|
1178 |
|
1179 |
|
1180 |
|
1181 |
|
1182 |
|
1183 |
|
1184 |
|
1185 |
|
1186 |
|
1187 |
|
1188 |
|
1189 |
|
1190 | proto.append = function append(name, file, options) {
|
1191 | var result;
|
1192 | return _regenerator2.default.async(function append$(_context) {
|
1193 | while (1) {
|
1194 | switch (_context.prev = _context.next) {
|
1195 | case 0:
|
1196 | options = options || {};
|
1197 | if (options.position === undefined) options.position = '0';
|
1198 | options.subres = {
|
1199 | append: '',
|
1200 | position: options.position
|
1201 | };
|
1202 | options.method = 'POST';
|
1203 |
|
1204 | _context.next = 6;
|
1205 | return _regenerator2.default.awrap(this.put(name, file, options));
|
1206 |
|
1207 | case 6:
|
1208 | result = _context.sent;
|
1209 |
|
1210 | result.nextAppendPosition = result.res.headers['x-oss-next-append-position'];
|
1211 | return _context.abrupt('return', result);
|
1212 |
|
1213 | case 9:
|
1214 | case 'end':
|
1215 | return _context.stop();
|
1216 | }
|
1217 | }
|
1218 | }, null, this);
|
1219 | };
|
1220 |
|
1221 |
|
1222 |
|
1223 |
|
1224 |
|
1225 |
|
1226 |
|
1227 |
|
1228 |
|
1229 |
|
1230 |
|
1231 |
|
1232 |
|
1233 |
|
1234 |
|
1235 |
|
1236 |
|
1237 |
|
1238 | proto.put = function put(name, file, options) {
|
1239 | var content, stream, _result, method, params, result, ret;
|
1240 |
|
1241 | return _regenerator2.default.async(function put$(_context2) {
|
1242 | while (1) {
|
1243 | switch (_context2.prev = _context2.next) {
|
1244 | case 0:
|
1245 | content = void 0;
|
1246 |
|
1247 | options = options || {};
|
1248 | name = this._objectName(name);
|
1249 |
|
1250 | if (!is.buffer(file)) {
|
1251 | _context2.next = 7;
|
1252 | break;
|
1253 | }
|
1254 |
|
1255 | content = file;
|
1256 | _context2.next = 30;
|
1257 | break;
|
1258 |
|
1259 | case 7:
|
1260 | if (!(isBlob(file) || isFile(file))) {
|
1261 | _context2.next = 29;
|
1262 | break;
|
1263 | }
|
1264 |
|
1265 | if (!options.mime) {
|
1266 | if (isFile(file)) {
|
1267 | options.mime = mime.getType(path.extname(file.name));
|
1268 | } else {
|
1269 | options.mime = file.type;
|
1270 | }
|
1271 | }
|
1272 |
|
1273 | stream = this._createStream(file, 0, file.size);
|
1274 | _context2.next = 12;
|
1275 | return _regenerator2.default.awrap(this._getFileSize(file));
|
1276 |
|
1277 | case 12:
|
1278 | options.contentLength = _context2.sent;
|
1279 | _context2.prev = 13;
|
1280 | _context2.next = 16;
|
1281 | return _regenerator2.default.awrap(this.putStream(name, stream, options));
|
1282 |
|
1283 | case 16:
|
1284 | _result = _context2.sent;
|
1285 | return _context2.abrupt('return', _result);
|
1286 |
|
1287 | case 20:
|
1288 | _context2.prev = 20;
|
1289 | _context2.t0 = _context2['catch'](13);
|
1290 |
|
1291 | if (!(_context2.t0.code === 'RequestTimeTooSkewed')) {
|
1292 | _context2.next = 27;
|
1293 | break;
|
1294 | }
|
1295 |
|
1296 | this.options.amendTimeSkewed = +new Date(_context2.t0.serverTime) - new Date();
|
1297 | _context2.next = 26;
|
1298 | return _regenerator2.default.awrap(this.put(name, file, options));
|
1299 |
|
1300 | case 26:
|
1301 | return _context2.abrupt('return', _context2.sent);
|
1302 |
|
1303 | case 27:
|
1304 | _context2.next = 30;
|
1305 | break;
|
1306 |
|
1307 | case 29:
|
1308 | throw new TypeError('Must provide Buffer/Blob/File for put.');
|
1309 |
|
1310 | case 30:
|
1311 |
|
1312 | options.headers = options.headers || {};
|
1313 | this._convertMetaToHeaders(options.meta, options.headers);
|
1314 |
|
1315 | method = options.method || 'PUT';
|
1316 | params = this._objectRequestParams(method, name, options);
|
1317 |
|
1318 | callback.encodeCallback(params, options);
|
1319 | params.mime = options.mime;
|
1320 | params.content = content;
|
1321 | params.successStatuses = [200];
|
1322 |
|
1323 | _context2.next = 40;
|
1324 | return _regenerator2.default.awrap(this.request(params));
|
1325 |
|
1326 | case 40:
|
1327 | result = _context2.sent;
|
1328 | ret = {
|
1329 | name: name,
|
1330 | url: this._objectUrl(name),
|
1331 | res: result.res
|
1332 | };
|
1333 |
|
1334 |
|
1335 | if (params.headers && params.headers['x-oss-callback']) {
|
1336 | ret.data = JSON.parse(result.data.toString());
|
1337 | }
|
1338 |
|
1339 | return _context2.abrupt('return', ret);
|
1340 |
|
1341 | case 44:
|
1342 | case 'end':
|
1343 | return _context2.stop();
|
1344 | }
|
1345 | }
|
1346 | }, null, this, [[13, 20]]);
|
1347 | };
|
1348 |
|
1349 |
|
1350 |
|
1351 |
|
1352 |
|
1353 |
|
1354 |
|
1355 |
|
1356 |
|
1357 | proto.putStream = function putStream(name, stream, options) {
|
1358 | var method, params, result, ret;
|
1359 | return _regenerator2.default.async(function putStream$(_context3) {
|
1360 | while (1) {
|
1361 | switch (_context3.prev = _context3.next) {
|
1362 | case 0:
|
1363 | options = options || {};
|
1364 | options.headers = options.headers || {};
|
1365 | name = this._objectName(name);
|
1366 | if (options.contentLength) {
|
1367 | options.headers['Content-Length'] = options.contentLength;
|
1368 | } else {
|
1369 | options.headers['Transfer-Encoding'] = 'chunked';
|
1370 | }
|
1371 | this._convertMetaToHeaders(options.meta, options.headers);
|
1372 |
|
1373 | method = options.method || 'PUT';
|
1374 | params = this._objectRequestParams(method, name, options);
|
1375 |
|
1376 | callback.encodeCallback(params, options);
|
1377 | params.mime = options.mime;
|
1378 | params.stream = stream;
|
1379 | params.successStatuses = [200];
|
1380 |
|
1381 | _context3.next = 13;
|
1382 | return _regenerator2.default.awrap(this.request(params));
|
1383 |
|
1384 | case 13:
|
1385 | result = _context3.sent;
|
1386 | ret = {
|
1387 | name: name,
|
1388 | url: this._objectUrl(name),
|
1389 | res: result.res
|
1390 | };
|
1391 |
|
1392 |
|
1393 | if (params.headers && params.headers['x-oss-callback']) {
|
1394 | ret.data = JSON.parse(result.data.toString());
|
1395 | }
|
1396 |
|
1397 | return _context3.abrupt('return', ret);
|
1398 |
|
1399 | case 17:
|
1400 | case 'end':
|
1401 | return _context3.stop();
|
1402 | }
|
1403 | }
|
1404 | }, null, this);
|
1405 | };
|
1406 |
|
1407 | merge(proto, require('../common/object/copyObject'));
|
1408 | merge(proto, require('../common/object/getObjectTagging'));
|
1409 | merge(proto, require('../common/object/putObjectTagging'));
|
1410 | merge(proto, require('../common/object/deleteObjectTagging'));
|
1411 | merge(proto, require('../common/image'));
|
1412 | merge(proto, require('../common/object/getBucketVersions'));
|
1413 | merge(proto, require('../common/object/getACL'));
|
1414 | merge(proto, require('../common/object/putACL'));
|
1415 | merge(proto, require('../common/object/head'));
|
1416 | merge(proto, require('../common/object/delete'));
|
1417 | merge(proto, require('../common/object/get'));
|
1418 |
|
1419 | proto.putMeta = function putMeta(name, meta, options) {
|
1420 | var copyResult;
|
1421 | return _regenerator2.default.async(function putMeta$(_context4) {
|
1422 | while (1) {
|
1423 | switch (_context4.prev = _context4.next) {
|
1424 | case 0:
|
1425 | _context4.next = 2;
|
1426 | return _regenerator2.default.awrap(this.copy(name, name, {
|
1427 | meta: meta || {},
|
1428 | timeout: options && options.timeout,
|
1429 | ctx: options && options.ctx
|
1430 | }));
|
1431 |
|
1432 | case 2:
|
1433 | copyResult = _context4.sent;
|
1434 | return _context4.abrupt('return', copyResult);
|
1435 |
|
1436 | case 4:
|
1437 | case 'end':
|
1438 | return _context4.stop();
|
1439 | }
|
1440 | }
|
1441 | }, null, this);
|
1442 | };
|
1443 |
|
1444 | proto.list = function list(query, options) {
|
1445 | var params, result, objects, that, prefixes;
|
1446 | return _regenerator2.default.async(function list$(_context5) {
|
1447 | while (1) {
|
1448 | switch (_context5.prev = _context5.next) {
|
1449 | case 0:
|
1450 |
|
1451 |
|
1452 | params = this._objectRequestParams('GET', '', options);
|
1453 |
|
1454 | params.query = query;
|
1455 | params.xmlResponse = true;
|
1456 | params.successStatuses = [200];
|
1457 |
|
1458 | _context5.next = 6;
|
1459 | return _regenerator2.default.awrap(this.request(params));
|
1460 |
|
1461 | case 6:
|
1462 | result = _context5.sent;
|
1463 | objects = result.data.Contents;
|
1464 | that = this;
|
1465 |
|
1466 | if (objects) {
|
1467 | if (!Array.isArray(objects)) {
|
1468 | objects = [objects];
|
1469 | }
|
1470 | objects = objects.map(function (obj) {
|
1471 | return {
|
1472 | name: obj.Key,
|
1473 | url: that._objectUrl(obj.Key),
|
1474 | lastModified: obj.LastModified,
|
1475 | etag: obj.ETag,
|
1476 | type: obj.Type,
|
1477 | size: Number(obj.Size),
|
1478 | storageClass: obj.StorageClass,
|
1479 | owner: {
|
1480 | id: obj.Owner.ID,
|
1481 | displayName: obj.Owner.DisplayName
|
1482 | }
|
1483 | };
|
1484 | });
|
1485 | }
|
1486 | prefixes = result.data.CommonPrefixes || null;
|
1487 |
|
1488 | if (prefixes) {
|
1489 | if (!Array.isArray(prefixes)) {
|
1490 | prefixes = [prefixes];
|
1491 | }
|
1492 | prefixes = prefixes.map(function (item) {
|
1493 | return item.Prefix;
|
1494 | });
|
1495 | }
|
1496 | return _context5.abrupt('return', {
|
1497 | res: result.res,
|
1498 | objects: objects,
|
1499 | prefixes: prefixes,
|
1500 | nextMarker: result.data.NextMarker || null,
|
1501 | isTruncated: result.data.IsTruncated === 'true'
|
1502 | });
|
1503 |
|
1504 | case 13:
|
1505 | case 'end':
|
1506 | return _context5.stop();
|
1507 | }
|
1508 | }
|
1509 | }, null, this);
|
1510 | };
|
1511 |
|
1512 |
|
1513 |
|
1514 |
|
1515 |
|
1516 |
|
1517 |
|
1518 | proto.restore = function restore(name, options) {
|
1519 | var params, result;
|
1520 | return _regenerator2.default.async(function restore$(_context6) {
|
1521 | while (1) {
|
1522 | switch (_context6.prev = _context6.next) {
|
1523 | case 0:
|
1524 | options = options || {};
|
1525 | options.subres = (0, _assign2.default)({ restore: '' }, options.subres);
|
1526 | if (options.versionId) {
|
1527 | options.subres.versionId = options.versionId;
|
1528 | }
|
1529 | params = this._objectRequestParams('POST', name, options);
|
1530 |
|
1531 | params.successStatuses = [202];
|
1532 |
|
1533 | _context6.next = 7;
|
1534 | return _regenerator2.default.awrap(this.request(params));
|
1535 |
|
1536 | case 7:
|
1537 | result = _context6.sent;
|
1538 | return _context6.abrupt('return', {
|
1539 | res: result.res
|
1540 | });
|
1541 |
|
1542 | case 9:
|
1543 | case 'end':
|
1544 | return _context6.stop();
|
1545 | }
|
1546 | }
|
1547 | }, null, this);
|
1548 | };
|
1549 |
|
1550 | proto.signatureUrl = function signatureUrl(name, options) {
|
1551 | options = options || {};
|
1552 | name = this._objectName(name);
|
1553 | options.method = options.method || 'GET';
|
1554 | var expires = utility.timestamp() + (options.expires || 1800);
|
1555 | var params = {
|
1556 | bucket: this.options.bucket,
|
1557 | object: name
|
1558 | };
|
1559 |
|
1560 | var resource = this._getResource(params);
|
1561 |
|
1562 | if (this.options.stsToken) {
|
1563 | options['security-token'] = this.options.stsToken;
|
1564 | }
|
1565 |
|
1566 | var signRes = signHelper._signatureForURL(this.options.accessKeySecret, options, resource, expires);
|
1567 |
|
1568 | var url = urlutil.parse(this._getReqUrl(params));
|
1569 | url.query = {
|
1570 | OSSAccessKeyId: this.options.accessKeyId,
|
1571 | Expires: expires,
|
1572 | Signature: signRes.Signature
|
1573 | };
|
1574 |
|
1575 | copy(signRes.subResource).to(url.query);
|
1576 |
|
1577 | return url.format();
|
1578 | };
|
1579 |
|
1580 |
|
1581 |
|
1582 |
|
1583 |
|
1584 |
|
1585 |
|
1586 |
|
1587 | proto.getObjectUrl = function getObjectUrl(name, baseUrl) {
|
1588 | if (!baseUrl) {
|
1589 | baseUrl = this.options.endpoint.format();
|
1590 | } else if (baseUrl[baseUrl.length - 1] !== '/') {
|
1591 | baseUrl += '/';
|
1592 | }
|
1593 | return baseUrl + this._escape(this._objectName(name));
|
1594 | };
|
1595 |
|
1596 | proto._objectUrl = function _objectUrl(name) {
|
1597 | return this._getReqUrl({ bucket: this.options.bucket, object: name });
|
1598 | };
|
1599 |
|
1600 |
|
1601 |
|
1602 |
|
1603 |
|
1604 |
|
1605 |
|
1606 | proto.generateObjectUrl = function (name, baseUrl) {
|
1607 | if (!baseUrl) {
|
1608 | baseUrl = this.options.endpoint.format();
|
1609 | var copyUrl = urlutil.parse(baseUrl);
|
1610 | var bucket = this.options.bucket;
|
1611 |
|
1612 |
|
1613 | copyUrl.hostname = bucket + '.' + copyUrl.hostname;
|
1614 | copyUrl.host = bucket + '.' + copyUrl.host;
|
1615 | baseUrl = copyUrl.format();
|
1616 | } else if (baseUrl[baseUrl.length - 1] !== '/') {
|
1617 | baseUrl += '/';
|
1618 | }
|
1619 | return baseUrl + this._escape(this._objectName(name));
|
1620 | };
|
1621 |
|
1622 |
|
1623 |
|
1624 |
|
1625 |
|
1626 |
|
1627 |
|
1628 |
|
1629 | proto._objectRequestParams = function _objectRequestParams(method, name, options) {
|
1630 | if (!this.options.bucket) {
|
1631 | throw new Error('Please create a bucket first');
|
1632 | }
|
1633 |
|
1634 | options = options || {};
|
1635 | name = this._objectName(name);
|
1636 | var params = {
|
1637 | object: name,
|
1638 | bucket: this.options.bucket,
|
1639 | method: method,
|
1640 | subres: options && options.subres,
|
1641 | timeout: options && options.timeout,
|
1642 | ctx: options && options.ctx
|
1643 | };
|
1644 |
|
1645 | if (options.headers) {
|
1646 | params.headers = {};
|
1647 | copy(options.headers).to(params.headers);
|
1648 | }
|
1649 | return params;
|
1650 | };
|
1651 |
|
1652 | proto._objectName = function _objectName(name) {
|
1653 | return name.replace(/^\/+/, '');
|
1654 | };
|
1655 |
|
1656 | proto._convertMetaToHeaders = function _convertMetaToHeaders(meta, headers) {
|
1657 | if (!meta) {
|
1658 | return;
|
1659 | }
|
1660 |
|
1661 | (0, _keys2.default)(meta).forEach(function (k) {
|
1662 | headers['x-oss-meta-' + k] = meta[k];
|
1663 | });
|
1664 | };
|
1665 |
|
1666 | proto._deleteFileSafe = function _deleteFileSafe(filepath) {
|
1667 | var _this = this;
|
1668 |
|
1669 | return new _promise2.default(function (resolve) {
|
1670 | fs.exists(filepath, function (exists) {
|
1671 | if (!exists) {
|
1672 | resolve();
|
1673 | } else {
|
1674 | fs.unlink(filepath, function (err) {
|
1675 | if (err) {
|
1676 | _this.debug('unlink %j error: %s', filepath, err, 'error');
|
1677 | }
|
1678 | resolve();
|
1679 | });
|
1680 | }
|
1681 | });
|
1682 | });
|
1683 | };
|
1684 |
|
1685 | },{"../common/callback":14,"../common/image":16,"../common/object/copyObject":19,"../common/object/delete":20,"../common/object/deleteObjectTagging":21,"../common/object/get":22,"../common/object/getACL":23,"../common/object/getBucketVersions":24,"../common/object/getObjectTagging":25,"../common/object/head":26,"../common/object/putACL":27,"../common/object/putObjectTagging":28,"../common/signUtils":30,"../common/utils/isBlob":38,"../common/utils/isFile":39,"babel-runtime/core-js/object/assign":49,"babel-runtime/core-js/object/keys":55,"babel-runtime/core-js/promise":56,"babel-runtime/regenerator":65,"copy-to":73,"fs":68,"is-type-of":233,"merge-descriptors":237,"mime":332,"path":246,"url":279,"utility":333}],5:[function(require,module,exports){
|
1686 | "use strict";
|
1687 |
|
1688 | exports.version = "6.8.0";
|
1689 |
|
1690 | },{}],6:[function(require,module,exports){
|
1691 | 'use strict';
|
1692 |
|
1693 | var _regenerator = require('babel-runtime/regenerator');
|
1694 |
|
1695 | var _regenerator2 = _interopRequireDefault(_regenerator);
|
1696 |
|
1697 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
1698 |
|
1699 | var _checkBucketName = require('../utils/checkBucketName');
|
1700 |
|
1701 | var proto = exports;
|
1702 |
|
1703 | proto.deleteBucketLifecycle = function deleteBucketLifecycle(name, options) {
|
1704 | var params, result;
|
1705 | return _regenerator2.default.async(function deleteBucketLifecycle$(_context) {
|
1706 | while (1) {
|
1707 | switch (_context.prev = _context.next) {
|
1708 | case 0:
|
1709 | _checkBucketName(name);
|
1710 | params = this._bucketRequestParams('DELETE', name, 'lifecycle', options);
|
1711 |
|
1712 | params.successStatuses = [204];
|
1713 | _context.next = 5;
|
1714 | return _regenerator2.default.awrap(this.request(params));
|
1715 |
|
1716 | case 5:
|
1717 | result = _context.sent;
|
1718 | return _context.abrupt('return', {
|
1719 | res: result.res
|
1720 | });
|
1721 |
|
1722 | case 7:
|
1723 | case 'end':
|
1724 | return _context.stop();
|
1725 | }
|
1726 | }
|
1727 | }, null, this);
|
1728 | };
|
1729 |
|
1730 | },{"../utils/checkBucketName":31,"babel-runtime/regenerator":65}],7:[function(require,module,exports){
|
1731 | 'use strict';
|
1732 |
|
1733 | var _regenerator = require('babel-runtime/regenerator');
|
1734 |
|
1735 | var _regenerator2 = _interopRequireDefault(_regenerator);
|
1736 |
|
1737 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
1738 |
|
1739 | var _checkBucketName = require('../utils/checkBucketName');
|
1740 |
|
1741 | var proto = exports;
|
1742 |
|
1743 | proto.deleteBucketWebsite = function deleteBucketWebsite(name, options) {
|
1744 | var params, result;
|
1745 | return _regenerator2.default.async(function deleteBucketWebsite$(_context) {
|
1746 | while (1) {
|
1747 | switch (_context.prev = _context.next) {
|
1748 | case 0:
|
1749 | _checkBucketName(name);
|
1750 | params = this._bucketRequestParams('DELETE', name, 'website', options);
|
1751 |
|
1752 | params.successStatuses = [204];
|
1753 | _context.next = 5;
|
1754 | return _regenerator2.default.awrap(this.request(params));
|
1755 |
|
1756 | case 5:
|
1757 | result = _context.sent;
|
1758 | return _context.abrupt('return', {
|
1759 | res: result.res
|
1760 | });
|
1761 |
|
1762 | case 7:
|
1763 | case 'end':
|
1764 | return _context.stop();
|
1765 | }
|
1766 | }
|
1767 | }, null, this);
|
1768 | };
|
1769 |
|
1770 | },{"../utils/checkBucketName":31,"babel-runtime/regenerator":65}],8:[function(require,module,exports){
|
1771 | 'use strict';
|
1772 |
|
1773 | var _regenerator = require('babel-runtime/regenerator');
|
1774 |
|
1775 | var _regenerator2 = _interopRequireDefault(_regenerator);
|
1776 |
|
1777 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
1778 |
|
1779 | var _checkBucketName = require('../utils/checkBucketName');
|
1780 | var isArray = require('../utils/isArray');
|
1781 | var formatObjKey = require('../utils/formatObjKey');
|
1782 |
|
1783 | var proto = exports;
|
1784 |
|
1785 | proto.getBucketLifecycle = function getBucketLifecycle(name, options) {
|
1786 | var params, result, rules;
|
1787 | return _regenerator2.default.async(function getBucketLifecycle$(_context) {
|
1788 | while (1) {
|
1789 | switch (_context.prev = _context.next) {
|
1790 | case 0:
|
1791 | _checkBucketName(name);
|
1792 | params = this._bucketRequestParams('GET', name, 'lifecycle', options);
|
1793 |
|
1794 | params.successStatuses = [200];
|
1795 | params.xmlResponse = true;
|
1796 | _context.next = 6;
|
1797 | return _regenerator2.default.awrap(this.request(params));
|
1798 |
|
1799 | case 6:
|
1800 | result = _context.sent;
|
1801 | rules = result.data.Rule || null;
|
1802 |
|
1803 | if (rules) {
|
1804 | if (!isArray(rules)) {
|
1805 | rules = [rules];
|
1806 | }
|
1807 | rules = rules.map(function (_) {
|
1808 | if (_.ID) {
|
1809 | _.id = _.ID;
|
1810 | delete _.ID;
|
1811 | }
|
1812 | if (_.Tag && !isArray(_.Tag)) {
|
1813 | _.Tag = [_.Tag];
|
1814 | }
|
1815 | return formatObjKey(_, 'firstLowerCase');
|
1816 | });
|
1817 | }
|
1818 | return _context.abrupt('return', {
|
1819 | rules: rules,
|
1820 | res: result.res
|
1821 | });
|
1822 |
|
1823 | case 10:
|
1824 | case 'end':
|
1825 | return _context.stop();
|
1826 | }
|
1827 | }
|
1828 | }, null, this);
|
1829 | };
|
1830 |
|
1831 | },{"../utils/checkBucketName":31,"../utils/formatObjKey":35,"../utils/isArray":37,"babel-runtime/regenerator":65}],9:[function(require,module,exports){
|
1832 | 'use strict';
|
1833 |
|
1834 | var _regenerator = require('babel-runtime/regenerator');
|
1835 |
|
1836 | var _regenerator2 = _interopRequireDefault(_regenerator);
|
1837 |
|
1838 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
1839 |
|
1840 | var _checkBucketName = require('../utils/checkBucketName');
|
1841 |
|
1842 | var proto = exports;
|
1843 |
|
1844 |
|
1845 |
|
1846 |
|
1847 |
|
1848 | proto.getBucketVersioning = function getBucketVersioning(bucketName, options) {
|
1849 | var params, result, versionStatus;
|
1850 | return _regenerator2.default.async(function getBucketVersioning$(_context) {
|
1851 | while (1) {
|
1852 | switch (_context.prev = _context.next) {
|
1853 | case 0:
|
1854 | _checkBucketName(bucketName);
|
1855 | params = this._bucketRequestParams('GET', bucketName, 'versioning', options);
|
1856 |
|
1857 | params.xmlResponse = true;
|
1858 | params.successStatuses = [200];
|
1859 | _context.next = 6;
|
1860 | return _regenerator2.default.awrap(this.request(params));
|
1861 |
|
1862 | case 6:
|
1863 | result = _context.sent;
|
1864 | versionStatus = result.data.Status;
|
1865 | return _context.abrupt('return', {
|
1866 | status: result.status,
|
1867 | versionStatus: versionStatus,
|
1868 | res: result.res
|
1869 | });
|
1870 |
|
1871 | case 9:
|
1872 | case 'end':
|
1873 | return _context.stop();
|
1874 | }
|
1875 | }
|
1876 | }, null, this);
|
1877 | };
|
1878 |
|
1879 | },{"../utils/checkBucketName":31,"babel-runtime/regenerator":65}],10:[function(require,module,exports){
|
1880 | 'use strict';
|
1881 |
|
1882 | var _regenerator = require('babel-runtime/regenerator');
|
1883 |
|
1884 | var _regenerator2 = _interopRequireDefault(_regenerator);
|
1885 |
|
1886 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
1887 |
|
1888 | var _checkBucketName = require('../utils/checkBucketName');
|
1889 | var isObject = require('../utils/isObject');
|
1890 |
|
1891 | var proto = exports;
|
1892 |
|
1893 | proto.getBucketWebsite = function getBucketWebsite(name, options) {
|
1894 | var params, result, routingRules;
|
1895 | return _regenerator2.default.async(function getBucketWebsite$(_context) {
|
1896 | while (1) {
|
1897 | switch (_context.prev = _context.next) {
|
1898 | case 0:
|
1899 | _checkBucketName(name);
|
1900 | params = this._bucketRequestParams('GET', name, 'website', options);
|
1901 |
|
1902 | params.successStatuses = [200];
|
1903 | params.xmlResponse = true;
|
1904 | _context.next = 6;
|
1905 | return _regenerator2.default.awrap(this.request(params));
|
1906 |
|
1907 | case 6:
|
1908 | result = _context.sent;
|
1909 | routingRules = [];
|
1910 |
|
1911 | if (result.data.RoutingRules && result.data.RoutingRules.RoutingRule) {
|
1912 | if (isObject(result.data.RoutingRules.RoutingRule)) {
|
1913 | routingRules = [result.data.RoutingRules.RoutingRule];
|
1914 | } else {
|
1915 | routingRules = result.data.RoutingRules.RoutingRule;
|
1916 | }
|
1917 | }
|
1918 | return _context.abrupt('return', {
|
1919 | index: result.data.IndexDocument && result.data.IndexDocument.Suffix || '',
|
1920 | supportSubDir: result.data.IndexDocument && result.data.IndexDocument.SupportSubDir || 'false',
|
1921 | type: result.data.IndexDocument && result.data.IndexDocument.Type,
|
1922 | routingRules: routingRules,
|
1923 | error: result.data.ErrorDocument && result.data.ErrorDocument.Key || null,
|
1924 | res: result.res
|
1925 | });
|
1926 |
|
1927 | case 10:
|
1928 | case 'end':
|
1929 | return _context.stop();
|
1930 | }
|
1931 | }
|
1932 | }, null, this);
|
1933 | };
|
1934 |
|
1935 | },{"../utils/checkBucketName":31,"../utils/isObject":41,"babel-runtime/regenerator":65}],11:[function(require,module,exports){
|
1936 | 'use strict';
|
1937 |
|
1938 | var _regenerator = require('babel-runtime/regenerator');
|
1939 |
|
1940 | var _regenerator2 = _interopRequireDefault(_regenerator);
|
1941 |
|
1942 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
1943 |
|
1944 |
|
1945 | var _checkBucketName = require('../utils/checkBucketName');
|
1946 | var isArray = require('../utils/isArray');
|
1947 | var deepCopy = require('../utils/deepCopy');
|
1948 | var isObject = require('../utils/isObject');
|
1949 | var obj2xml = require('../utils/obj2xml');
|
1950 | var checkObjectTag = require('../utils/checkObjectTag');
|
1951 | var getStrBytesCount = require('../utils/getStrBytesCount');
|
1952 |
|
1953 | var proto = exports;
|
1954 |
|
1955 | proto.putBucketLifecycle = function putBucketLifecycle(name, rules, options) {
|
1956 | var params, Rule, paramXMLObj, paramXML, result;
|
1957 | return _regenerator2.default.async(function putBucketLifecycle$(_context) {
|
1958 | while (1) {
|
1959 | switch (_context.prev = _context.next) {
|
1960 | case 0:
|
1961 | _checkBucketName(name);
|
1962 |
|
1963 | if (isArray(rules)) {
|
1964 | _context.next = 3;
|
1965 | break;
|
1966 | }
|
1967 |
|
1968 | throw new Error('rules must be Array');
|
1969 |
|
1970 | case 3:
|
1971 | params = this._bucketRequestParams('PUT', name, 'lifecycle', options);
|
1972 | Rule = [];
|
1973 | paramXMLObj = {
|
1974 | LifecycleConfiguration: {
|
1975 | Rule: Rule
|
1976 | }
|
1977 | };
|
1978 |
|
1979 |
|
1980 | rules.forEach(function (_) {
|
1981 | defaultDaysAndDate2Expiration(_);
|
1982 | checkRule(_);
|
1983 | if (_.id) {
|
1984 | _.ID = _.id;
|
1985 | delete _.id;
|
1986 | }
|
1987 | Rule.push(_);
|
1988 | });
|
1989 |
|
1990 | paramXML = obj2xml(paramXMLObj, {
|
1991 | headers: true,
|
1992 | firstUpperCase: true
|
1993 | });
|
1994 |
|
1995 |
|
1996 | params.content = paramXML;
|
1997 | params.mime = 'xml';
|
1998 | params.successStatuses = [200];
|
1999 | _context.next = 13;
|
2000 | return _regenerator2.default.awrap(this.request(params));
|
2001 |
|
2002 | case 13:
|
2003 | result = _context.sent;
|
2004 | return _context.abrupt('return', {
|
2005 | res: result.res
|
2006 | });
|
2007 |
|
2008 | case 15:
|
2009 | case 'end':
|
2010 | return _context.stop();
|
2011 | }
|
2012 | }
|
2013 | }, null, this);
|
2014 | };
|
2015 |
|
2016 |
|
2017 | function defaultDaysAndDate2Expiration(obj) {
|
2018 | if (obj.days) {
|
2019 | obj.expiration = {
|
2020 | days: obj.days
|
2021 | };
|
2022 | }
|
2023 | if (obj.date) {
|
2024 | obj.expiration = {
|
2025 | createdBeforeDate: obj.date
|
2026 | };
|
2027 | }
|
2028 | }
|
2029 |
|
2030 | function checkDaysAndDate(obj, key) {
|
2031 | var days = obj.days,
|
2032 | createdBeforeDate = obj.createdBeforeDate;
|
2033 |
|
2034 | if (!days && !createdBeforeDate) {
|
2035 | throw new Error(key + ' must includes days or createdBeforeDate');
|
2036 | } else if (days && !/^[1-9][0-9]*$/.test(days)) {
|
2037 | throw new Error('days must be a positive integer');
|
2038 | } else if (createdBeforeDate && !/\d{4}-\d{2}-\d{2}T00:00:00.000Z/.test(createdBeforeDate)) {
|
2039 | throw new Error('createdBeforeDate must be date and conform to iso8601 format');
|
2040 | }
|
2041 | }
|
2042 |
|
2043 | function handleCheckTag(tag) {
|
2044 | if (!isArray(tag) && !isObject(tag)) {
|
2045 | throw new Error('tag must be Object or Array');
|
2046 | }
|
2047 | tag = isObject(tag) ? [tag] : tag;
|
2048 | var tagObj = {};
|
2049 | var tagClone = deepCopy(tag);
|
2050 | tagClone.forEach(function (v) {
|
2051 | tagObj[v.key] = v.value;
|
2052 | });
|
2053 |
|
2054 | checkObjectTag(tagObj);
|
2055 | }
|
2056 |
|
2057 | function checkRule(rule) {
|
2058 | if (rule.id && getStrBytesCount(rule.id) > 255) throw new Error('ID is composed of 255 bytes at most');
|
2059 |
|
2060 | if (rule.prefix === '' || rule.prefix === undefined) throw new Error('Rule must includes prefix');
|
2061 |
|
2062 | if (!['Enabled', 'Disabled'].includes(rule.status)) throw new Error('Status must be Enabled or Disabled');
|
2063 |
|
2064 | if (rule.transition) {
|
2065 | if (!['IA', 'Archive'].includes(rule.transition.storageClass)) throw new Error('StorageClass must be IA or Archive');
|
2066 | checkDaysAndDate(rule.transition, 'Transition');
|
2067 | }
|
2068 |
|
2069 | if (rule.expiration) {
|
2070 | if (!rule.expiration.expiredObjectDeleteMarker) {
|
2071 | checkDaysAndDate(rule.expiration, 'Expiration');
|
2072 | } else if (rule.expiration.days || rule.expiration.createdBeforeDate) {
|
2073 | throw new Error('expiredObjectDeleteMarker cannot be used with days or createdBeforeDate');
|
2074 | }
|
2075 | }
|
2076 |
|
2077 | if (rule.abortMultipartUpload) {
|
2078 | checkDaysAndDate(rule.abortMultipartUpload, 'AbortMultipartUpload');
|
2079 | }
|
2080 |
|
2081 | if (!rule.expiration && !rule.abortMultipartUpload && !rule.transition && !rule.noncurrentVersionTransition) {
|
2082 | throw new Error('Rule must includes expiration or abortMultipartUpload or transition or noncurrentVersionTransition');
|
2083 | }
|
2084 |
|
2085 | if (rule.tag) {
|
2086 | if (rule.abortMultipartUpload) {
|
2087 | throw new Error('Tag cannot be used with abortMultipartUpload');
|
2088 | }
|
2089 | handleCheckTag(rule.tag);
|
2090 | }
|
2091 | }
|
2092 |
|
2093 | },{"../utils/checkBucketName":31,"../utils/checkObjectTag":32,"../utils/deepCopy":34,"../utils/getStrBytesCount":36,"../utils/isArray":37,"../utils/isObject":41,"../utils/obj2xml":42,"babel-runtime/regenerator":65}],12:[function(require,module,exports){
|
2094 | 'use strict';
|
2095 |
|
2096 | var _regenerator = require('babel-runtime/regenerator');
|
2097 |
|
2098 | var _regenerator2 = _interopRequireDefault(_regenerator);
|
2099 |
|
2100 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
2101 |
|
2102 | var _checkBucketName = require('../utils/checkBucketName');
|
2103 | var obj2xml = require('../utils/obj2xml');
|
2104 |
|
2105 | var proto = exports;
|
2106 |
|
2107 |
|
2108 |
|
2109 |
|
2110 |
|
2111 |
|
2112 |
|
2113 | proto.putBucketVersioning = function putBucketVersioning(name, status) {
|
2114 | var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
2115 | var params, paramXMLObj, result;
|
2116 | return _regenerator2.default.async(function putBucketVersioning$(_context) {
|
2117 | while (1) {
|
2118 | switch (_context.prev = _context.next) {
|
2119 | case 0:
|
2120 | _checkBucketName(name);
|
2121 |
|
2122 | if (['Enabled', 'Suspended'].includes(status)) {
|
2123 | _context.next = 3;
|
2124 | break;
|
2125 | }
|
2126 |
|
2127 | throw new Error('status must be Enabled or Suspended');
|
2128 |
|
2129 | case 3:
|
2130 | params = this._bucketRequestParams('PUT', name, 'versioning', options);
|
2131 | paramXMLObj = {
|
2132 | VersioningConfiguration: {
|
2133 | Status: status
|
2134 | }
|
2135 | };
|
2136 |
|
2137 |
|
2138 | params.mime = 'xml';
|
2139 | params.content = obj2xml(paramXMLObj, {
|
2140 | headers: true
|
2141 | });
|
2142 |
|
2143 | _context.next = 9;
|
2144 | return _regenerator2.default.awrap(this.request(params));
|
2145 |
|
2146 | case 9:
|
2147 | result = _context.sent;
|
2148 | return _context.abrupt('return', {
|
2149 | res: result.res,
|
2150 | status: result.status
|
2151 | });
|
2152 |
|
2153 | case 11:
|
2154 | case 'end':
|
2155 | return _context.stop();
|
2156 | }
|
2157 | }
|
2158 | }, null, this);
|
2159 | };
|
2160 |
|
2161 | },{"../utils/checkBucketName":31,"../utils/obj2xml":42,"babel-runtime/regenerator":65}],13:[function(require,module,exports){
|
2162 | 'use strict';
|
2163 |
|
2164 | var _regenerator = require('babel-runtime/regenerator');
|
2165 |
|
2166 | var _regenerator2 = _interopRequireDefault(_regenerator);
|
2167 |
|
2168 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
2169 |
|
2170 | var _checkBucketName = require('../utils/checkBucketName');
|
2171 | var obj2xml = require('../utils/obj2xml');
|
2172 | var isArray = require('../utils/isArray');
|
2173 |
|
2174 | var proto = exports;
|
2175 | proto.putBucketWebsite = function putBucketWebsite(name) {
|
2176 | var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
2177 | var options = arguments[2];
|
2178 | var params, IndexDocument, WebsiteConfiguration, website, result;
|
2179 | return _regenerator2.default.async(function putBucketWebsite$(_context) {
|
2180 | while (1) {
|
2181 | switch (_context.prev = _context.next) {
|
2182 | case 0:
|
2183 | _checkBucketName(name);
|
2184 | params = this._bucketRequestParams('PUT', name, 'website', options);
|
2185 | IndexDocument = {
|
2186 | Suffix: config.index || 'index.html'
|
2187 | };
|
2188 | WebsiteConfiguration = {
|
2189 | IndexDocument: IndexDocument
|
2190 | };
|
2191 | website = {
|
2192 | WebsiteConfiguration: WebsiteConfiguration
|
2193 | };
|
2194 |
|
2195 |
|
2196 | if (config.supportSubDir) {
|
2197 | IndexDocument.SupportSubDir = config.supportSubDir;
|
2198 | }
|
2199 |
|
2200 | if (config.type) {
|
2201 | IndexDocument.Type = config.type;
|
2202 | }
|
2203 |
|
2204 | if (config.error) {
|
2205 | WebsiteConfiguration.ErrorDocument = {
|
2206 | Key: config.error
|
2207 | };
|
2208 | }
|
2209 |
|
2210 | if (!(config.routingRules !== undefined)) {
|
2211 | _context.next = 12;
|
2212 | break;
|
2213 | }
|
2214 |
|
2215 | if (isArray(config.routingRules)) {
|
2216 | _context.next = 11;
|
2217 | break;
|
2218 | }
|
2219 |
|
2220 | throw new Error('RoutingRules must be Array');
|
2221 |
|
2222 | case 11:
|
2223 | WebsiteConfiguration.RoutingRules = {
|
2224 | RoutingRule: config.routingRules
|
2225 | };
|
2226 |
|
2227 | case 12:
|
2228 |
|
2229 | website = obj2xml(website);
|
2230 | params.content = website;
|
2231 | params.mime = 'xml';
|
2232 | params.successStatuses = [200];
|
2233 | _context.next = 18;
|
2234 | return _regenerator2.default.awrap(this.request(params));
|
2235 |
|
2236 | case 18:
|
2237 | result = _context.sent;
|
2238 | return _context.abrupt('return', {
|
2239 | res: result.res
|
2240 | });
|
2241 |
|
2242 | case 20:
|
2243 | case 'end':
|
2244 | return _context.stop();
|
2245 | }
|
2246 | }
|
2247 | }, null, this);
|
2248 | };
|
2249 |
|
2250 | },{"../utils/checkBucketName":31,"../utils/isArray":37,"../utils/obj2xml":42,"babel-runtime/regenerator":65}],14:[function(require,module,exports){
|
2251 | (function (Buffer){
|
2252 | 'use strict';
|
2253 |
|
2254 | var _keys = require('babel-runtime/core-js/object/keys');
|
2255 |
|
2256 | var _keys2 = _interopRequireDefault(_keys);
|
2257 |
|
2258 | var _stringify = require('babel-runtime/core-js/json/stringify');
|
2259 |
|
2260 | var _stringify2 = _interopRequireDefault(_stringify);
|
2261 |
|
2262 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
2263 |
|
2264 | exports.encodeCallback = function encodeCallback(reqParams, options) {
|
2265 | reqParams.headers = reqParams.headers || {};
|
2266 | if (!Object.prototype.hasOwnProperty.call(reqParams.headers, 'x-oss-callback')) {
|
2267 | if (options.callback) {
|
2268 | var json = {
|
2269 | callbackUrl: encodeURI(options.callback.url),
|
2270 | callbackBody: options.callback.body
|
2271 | };
|
2272 | if (options.callback.host) {
|
2273 | json.callbackHost = options.callback.host;
|
2274 | }
|
2275 | if (options.callback.contentType) {
|
2276 | json.callbackBodyType = options.callback.contentType;
|
2277 | }
|
2278 | var callback = Buffer.from((0, _stringify2.default)(json)).toString('base64');
|
2279 | reqParams.headers['x-oss-callback'] = callback;
|
2280 |
|
2281 | if (options.callback.customValue) {
|
2282 | var callbackVar = {};
|
2283 | (0, _keys2.default)(options.callback.customValue).forEach(function (key) {
|
2284 | callbackVar['x:' + key] = options.callback.customValue[key];
|
2285 | });
|
2286 | reqParams.headers['x-oss-callback-var'] = Buffer.from((0, _stringify2.default)(callbackVar)).toString('base64');
|
2287 | }
|
2288 | }
|
2289 | }
|
2290 | };
|
2291 |
|
2292 | }).call(this,require("buffer").Buffer)
|
2293 | },{"babel-runtime/core-js/json/stringify":48,"babel-runtime/core-js/object/keys":55,"buffer":70}],15:[function(require,module,exports){
|
2294 | 'use strict';
|
2295 |
|
2296 | var _assign = require('babel-runtime/core-js/object/assign');
|
2297 |
|
2298 | var _assign2 = _interopRequireDefault(_assign);
|
2299 |
|
2300 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
2301 |
|
2302 | var ms = require('humanize-ms');
|
2303 | var urlutil = require('url');
|
2304 | var _checkBucketName = require('../utils/checkBucketName');
|
2305 |
|
2306 | function setEndpoint(endpoint, secure) {
|
2307 | var url = urlutil.parse(endpoint);
|
2308 |
|
2309 | if (!url.protocol) {
|
2310 | url = urlutil.parse('http' + (secure ? 's' : '') + '://' + endpoint);
|
2311 | }
|
2312 |
|
2313 | if (url.protocol !== 'http:' && url.protocol !== 'https:') {
|
2314 | throw new Error('Endpoint protocol must be http or https.');
|
2315 | }
|
2316 |
|
2317 | return url;
|
2318 | }
|
2319 |
|
2320 | function setRegion(region, internal, secure) {
|
2321 | var protocol = secure ? 'https://' : 'http://';
|
2322 | var suffix = internal ? '-internal.aliyuncs.com' : '.aliyuncs.com';
|
2323 | var prefix = 'vpc100-oss-cn-';
|
2324 |
|
2325 | if (region.substr(0, prefix.length) === prefix) {
|
2326 | suffix = '.aliyuncs.com';
|
2327 | }
|
2328 |
|
2329 | return urlutil.parse(protocol + region + suffix);
|
2330 | }
|
2331 |
|
2332 | module.exports = function (options) {
|
2333 | if (!options || !options.accessKeyId || !options.accessKeySecret) {
|
2334 | throw new Error('require accessKeyId, accessKeySecret');
|
2335 | }
|
2336 | if (options.bucket) {
|
2337 | _checkBucketName(options.bucket);
|
2338 | }
|
2339 | var opts = (0, _assign2.default)({
|
2340 | region: 'oss-cn-hangzhou',
|
2341 | internal: false,
|
2342 | secure: false,
|
2343 | timeout: 60000,
|
2344 | bucket: null,
|
2345 | endpoint: null,
|
2346 | cname: false,
|
2347 | isRequestPay: false,
|
2348 | sldEnable: false
|
2349 | }, options);
|
2350 |
|
2351 | opts.accessKeyId = opts.accessKeyId.trim();
|
2352 | opts.accessKeySecret = opts.accessKeySecret.trim();
|
2353 |
|
2354 | if (opts.timeout) {
|
2355 | opts.timeout = ms(opts.timeout);
|
2356 | }
|
2357 |
|
2358 | if (opts.endpoint) {
|
2359 | opts.endpoint = setEndpoint(opts.endpoint, opts.secure);
|
2360 | } else if (opts.region) {
|
2361 | opts.endpoint = setRegion(opts.region, opts.internal, opts.secure);
|
2362 | } else {
|
2363 | throw new Error('require options.endpoint or options.region');
|
2364 | }
|
2365 |
|
2366 | opts.inited = true;
|
2367 | return opts;
|
2368 | };
|
2369 |
|
2370 | },{"../utils/checkBucketName":31,"babel-runtime/core-js/object/assign":49,"humanize-ms":224,"url":279}],16:[function(require,module,exports){
|
2371 | 'use strict';
|
2372 |
|
2373 | var merge = require('merge-descriptors');
|
2374 |
|
2375 | var proto = exports;
|
2376 |
|
2377 | merge(proto, require('./processObjectSave'));
|
2378 |
|
2379 | },{"./processObjectSave":17,"merge-descriptors":237}],17:[function(require,module,exports){
|
2380 | 'use strict';
|
2381 |
|
2382 | var _regenerator = require('babel-runtime/regenerator');
|
2383 |
|
2384 | var _regenerator2 = _interopRequireDefault(_regenerator);
|
2385 |
|
2386 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
2387 |
|
2388 |
|
2389 | var _checkBucketName = require('../utils/checkBucketName');
|
2390 | var querystring = require('querystring');
|
2391 |
|
2392 | var _require = require('js-base64'),
|
2393 | str2Base64 = _require.Base64.encode;
|
2394 |
|
2395 | var proto = exports;
|
2396 |
|
2397 | proto.processObjectSave = function processObjectSave(sourceObject, targetObject, process, targetBucket) {
|
2398 | var params, bucketParam, content, result;
|
2399 | return _regenerator2.default.async(function processObjectSave$(_context) {
|
2400 | while (1) {
|
2401 | switch (_context.prev = _context.next) {
|
2402 | case 0:
|
2403 | checkArgs(sourceObject, 'sourceObject');
|
2404 | checkArgs(targetObject, 'targetObject');
|
2405 | checkArgs(process, 'process');
|
2406 | targetObject = this._objectName(targetObject);
|
2407 | if (targetBucket) {
|
2408 | _checkBucketName(targetBucket);
|
2409 | }
|
2410 |
|
2411 | params = this._objectRequestParams('POST', sourceObject, {
|
2412 | subres: 'x-oss-process'
|
2413 | });
|
2414 | bucketParam = targetBucket ? ',b_' + str2Base64(targetBucket) : '';
|
2415 |
|
2416 | targetObject = str2Base64(targetObject);
|
2417 |
|
2418 | content = {
|
2419 | 'x-oss-process': process + '|sys/saveas,o_' + targetObject + bucketParam
|
2420 | };
|
2421 |
|
2422 | params.content = querystring.stringify(content);
|
2423 |
|
2424 | _context.next = 12;
|
2425 | return _regenerator2.default.awrap(this.request(params));
|
2426 |
|
2427 | case 12:
|
2428 | result = _context.sent;
|
2429 | return _context.abrupt('return', {
|
2430 | res: result.res,
|
2431 | status: result.res.status
|
2432 | });
|
2433 |
|
2434 | case 14:
|
2435 | case 'end':
|
2436 | return _context.stop();
|
2437 | }
|
2438 | }
|
2439 | }, null, this);
|
2440 | };
|
2441 |
|
2442 | function checkArgs(name, key) {
|
2443 | if (!name) {
|
2444 | throw new Error(key + ' is required');
|
2445 | }
|
2446 | if (typeof name !== 'string') {
|
2447 | throw new Error(key + ' must be String');
|
2448 | }
|
2449 | }
|
2450 |
|
2451 | },{"../utils/checkBucketName":31,"babel-runtime/regenerator":65,"js-base64":236,"querystring":253}],18:[function(require,module,exports){
|
2452 | 'use strict';
|
2453 |
|
2454 | var _regenerator = require('babel-runtime/regenerator');
|
2455 |
|
2456 | var _regenerator2 = _interopRequireDefault(_regenerator);
|
2457 |
|
2458 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
2459 |
|
2460 | var copy = require('copy-to');
|
2461 | var callback = require('./callback');
|
2462 | var deepCopy = require('./utils/deepCopy');
|
2463 |
|
2464 | var proto = exports;
|
2465 |
|
2466 |
|
2467 |
|
2468 |
|
2469 |
|
2470 |
|
2471 |
|
2472 | proto.listUploads = function listUploads(query, options) {
|
2473 | var opt, params, result, uploads;
|
2474 | return _regenerator2.default.async(function listUploads$(_context) {
|
2475 | while (1) {
|
2476 | switch (_context.prev = _context.next) {
|
2477 | case 0:
|
2478 | options = options || {};
|
2479 | opt = {};
|
2480 |
|
2481 | copy(options).to(opt);
|
2482 | opt.subres = 'uploads';
|
2483 | params = this._objectRequestParams('GET', '', opt);
|
2484 |
|
2485 | params.query = query;
|
2486 | params.xmlResponse = true;
|
2487 | params.successStatuses = [200];
|
2488 |
|
2489 | _context.next = 10;
|
2490 | return _regenerator2.default.awrap(this.request(params));
|
2491 |
|
2492 | case 10:
|
2493 | result = _context.sent;
|
2494 | uploads = result.data.Upload || [];
|
2495 |
|
2496 | if (!Array.isArray(uploads)) {
|
2497 | uploads = [uploads];
|
2498 | }
|
2499 | uploads = uploads.map(function (up) {
|
2500 | return {
|
2501 | name: up.Key,
|
2502 | uploadId: up.UploadId,
|
2503 | initiated: up.Initiated
|
2504 | };
|
2505 | });
|
2506 |
|
2507 | return _context.abrupt('return', {
|
2508 | res: result.res,
|
2509 | uploads: uploads,
|
2510 | bucket: result.data.Bucket,
|
2511 | nextKeyMarker: result.data.NextKeyMarker,
|
2512 | nextUploadIdMarker: result.data.NextUploadIdMarker,
|
2513 | isTruncated: result.data.IsTruncated === 'true'
|
2514 | });
|
2515 |
|
2516 | case 15:
|
2517 | case 'end':
|
2518 | return _context.stop();
|
2519 | }
|
2520 | }
|
2521 | }, null, this);
|
2522 | };
|
2523 |
|
2524 |
|
2525 |
|
2526 |
|
2527 |
|
2528 |
|
2529 |
|
2530 |
|
2531 |
|
2532 |
|
2533 |
|
2534 |
|
2535 | proto.listParts = function listParts(name, uploadId, query, options) {
|
2536 | var opt, params, result;
|
2537 | return _regenerator2.default.async(function listParts$(_context2) {
|
2538 | while (1) {
|
2539 | switch (_context2.prev = _context2.next) {
|
2540 | case 0:
|
2541 | options = options || {};
|
2542 | opt = {};
|
2543 |
|
2544 | copy(options).to(opt);
|
2545 | opt.subres = {
|
2546 | uploadId: uploadId
|
2547 | };
|
2548 | params = this._objectRequestParams('GET', name, opt);
|
2549 |
|
2550 | params.query = query;
|
2551 | params.xmlResponse = true;
|
2552 | params.successStatuses = [200];
|
2553 |
|
2554 | _context2.next = 10;
|
2555 | return _regenerator2.default.awrap(this.request(params));
|
2556 |
|
2557 | case 10:
|
2558 | result = _context2.sent;
|
2559 | return _context2.abrupt('return', {
|
2560 | res: result.res,
|
2561 | uploadId: result.data.UploadId,
|
2562 | bucket: result.data.Bucket,
|
2563 | name: result.data.Key,
|
2564 | partNumberMarker: result.data.PartNumberMarker,
|
2565 | nextPartNumberMarker: result.data.NextPartNumberMarker,
|
2566 | maxParts: result.data.MaxParts,
|
2567 | isTruncated: result.data.IsTruncated,
|
2568 | parts: result.data.Part || []
|
2569 | });
|
2570 |
|
2571 | case 12:
|
2572 | case 'end':
|
2573 | return _context2.stop();
|
2574 | }
|
2575 | }
|
2576 | }, null, this);
|
2577 | };
|
2578 |
|
2579 |
|
2580 |
|
2581 |
|
2582 |
|
2583 |
|
2584 |
|
2585 | proto.abortMultipartUpload = function abortMultipartUpload(name, uploadId, options) {
|
2586 | var opt, params, result;
|
2587 | return _regenerator2.default.async(function abortMultipartUpload$(_context3) {
|
2588 | while (1) {
|
2589 | switch (_context3.prev = _context3.next) {
|
2590 | case 0:
|
2591 | this._stop();
|
2592 | options = options || {};
|
2593 | opt = {};
|
2594 |
|
2595 | copy(options).to(opt);
|
2596 | opt.subres = { uploadId: uploadId };
|
2597 | params = this._objectRequestParams('DELETE', name, opt);
|
2598 |
|
2599 | params.successStatuses = [204];
|
2600 |
|
2601 | _context3.next = 9;
|
2602 | return _regenerator2.default.awrap(this.request(params));
|
2603 |
|
2604 | case 9:
|
2605 | result = _context3.sent;
|
2606 | return _context3.abrupt('return', {
|
2607 | res: result.res
|
2608 | });
|
2609 |
|
2610 | case 11:
|
2611 | case 'end':
|
2612 | return _context3.stop();
|
2613 | }
|
2614 | }
|
2615 | }, null, this);
|
2616 | };
|
2617 |
|
2618 |
|
2619 |
|
2620 |
|
2621 |
|
2622 |
|
2623 |
|
2624 | proto.initMultipartUpload = function initMultipartUpload(name, options) {
|
2625 | var opt, params, result;
|
2626 | return _regenerator2.default.async(function initMultipartUpload$(_context4) {
|
2627 | while (1) {
|
2628 | switch (_context4.prev = _context4.next) {
|
2629 | case 0:
|
2630 | options = options || {};
|
2631 | opt = {};
|
2632 |
|
2633 | copy(options).to(opt);
|
2634 | opt.headers = opt.headers || {};
|
2635 | this._convertMetaToHeaders(options.meta, opt.headers);
|
2636 |
|
2637 | opt.subres = 'uploads';
|
2638 | params = this._objectRequestParams('POST', name, opt);
|
2639 |
|
2640 | params.mime = options.mime;
|
2641 | params.xmlResponse = true;
|
2642 | params.successStatuses = [200];
|
2643 |
|
2644 | _context4.next = 12;
|
2645 | return _regenerator2.default.awrap(this.request(params));
|
2646 |
|
2647 | case 12:
|
2648 | result = _context4.sent;
|
2649 | return _context4.abrupt('return', {
|
2650 | res: result.res,
|
2651 | bucket: result.data.Bucket,
|
2652 | name: result.data.Key,
|
2653 | uploadId: result.data.UploadId
|
2654 | });
|
2655 |
|
2656 | case 14:
|
2657 | case 'end':
|
2658 | return _context4.stop();
|
2659 | }
|
2660 | }
|
2661 | }, null, this);
|
2662 | };
|
2663 |
|
2664 |
|
2665 |
|
2666 |
|
2667 |
|
2668 |
|
2669 |
|
2670 |
|
2671 |
|
2672 |
|
2673 |
|
2674 | proto.uploadPart = function uploadPart(name, uploadId, partNo, file, start, end, options) {
|
2675 | var data;
|
2676 | return _regenerator2.default.async(function uploadPart$(_context5) {
|
2677 | while (1) {
|
2678 | switch (_context5.prev = _context5.next) {
|
2679 | case 0:
|
2680 | data = {
|
2681 | stream: this._createStream(file, start, end),
|
2682 | size: end - start
|
2683 | };
|
2684 | _context5.next = 3;
|
2685 | return _regenerator2.default.awrap(this._uploadPart(name, uploadId, partNo, data, options));
|
2686 |
|
2687 | case 3:
|
2688 | return _context5.abrupt('return', _context5.sent);
|
2689 |
|
2690 | case 4:
|
2691 | case 'end':
|
2692 | return _context5.stop();
|
2693 | }
|
2694 | }
|
2695 | }, null, this);
|
2696 | };
|
2697 |
|
2698 |
|
2699 |
|
2700 |
|
2701 |
|
2702 |
|
2703 |
|
2704 |
|
2705 |
|
2706 |
|
2707 |
|
2708 |
|
2709 |
|
2710 |
|
2711 |
|
2712 |
|
2713 |
|
2714 |
|
2715 |
|
2716 |
|
2717 | proto.completeMultipartUpload = function completeMultipartUpload(name, uploadId, parts, options) {
|
2718 | var completeParts, xml, i, p, opt, params, result, ret;
|
2719 | return _regenerator2.default.async(function completeMultipartUpload$(_context6) {
|
2720 | while (1) {
|
2721 | switch (_context6.prev = _context6.next) {
|
2722 | case 0:
|
2723 | completeParts = parts.concat().sort(function (a, b) {
|
2724 | return a.number - b.number;
|
2725 | }).filter(function (item, index, arr) {
|
2726 | return !index || item.number !== arr[index - 1].number;
|
2727 | });
|
2728 | xml = '<?xml version="1.0" encoding="UTF-8"?>\n<CompleteMultipartUpload>\n';
|
2729 |
|
2730 | for (i = 0; i < completeParts.length; i++) {
|
2731 | p = completeParts[i];
|
2732 |
|
2733 | xml += '<Part>\n';
|
2734 | xml += '<PartNumber>' + p.number + '</PartNumber>\n';
|
2735 | xml += '<ETag>' + p.etag + '</ETag>\n';
|
2736 | xml += '</Part>\n';
|
2737 | }
|
2738 | xml += '</CompleteMultipartUpload>';
|
2739 |
|
2740 | options = options || {};
|
2741 | opt = {};
|
2742 |
|
2743 | opt = deepCopy(options);
|
2744 | if (opt.headers) delete opt.headers['x-oss-server-side-encryption'];
|
2745 | opt.subres = { uploadId: uploadId };
|
2746 |
|
2747 | params = this._objectRequestParams('POST', name, opt);
|
2748 |
|
2749 | callback.encodeCallback(params, opt);
|
2750 | params.mime = 'xml';
|
2751 | params.content = xml;
|
2752 |
|
2753 | if (!(params.headers && params.headers['x-oss-callback'])) {
|
2754 | params.xmlResponse = true;
|
2755 | }
|
2756 | params.successStatuses = [200];
|
2757 | _context6.next = 17;
|
2758 | return _regenerator2.default.awrap(this.request(params));
|
2759 |
|
2760 | case 17:
|
2761 | result = _context6.sent;
|
2762 | ret = {
|
2763 | res: result.res,
|
2764 | bucket: params.bucket,
|
2765 | name: name,
|
2766 | etag: result.res.headers.etag
|
2767 | };
|
2768 |
|
2769 |
|
2770 | if (params.headers && params.headers['x-oss-callback']) {
|
2771 | ret.data = JSON.parse(result.data.toString());
|
2772 | }
|
2773 |
|
2774 | return _context6.abrupt('return', ret);
|
2775 |
|
2776 | case 21:
|
2777 | case 'end':
|
2778 | return _context6.stop();
|
2779 | }
|
2780 | }
|
2781 | }, null, this);
|
2782 | };
|
2783 |
|
2784 |
|
2785 |
|
2786 |
|
2787 |
|
2788 |
|
2789 |
|
2790 |
|
2791 |
|
2792 | proto._uploadPart = function _uploadPart(name, uploadId, partNo, data, options) {
|
2793 | var opt, params, result;
|
2794 | return _regenerator2.default.async(function _uploadPart$(_context7) {
|
2795 | while (1) {
|
2796 | switch (_context7.prev = _context7.next) {
|
2797 | case 0:
|
2798 | options = options || {};
|
2799 | opt = {};
|
2800 |
|
2801 | copy(options).to(opt);
|
2802 | opt.headers = {
|
2803 | 'Content-Length': data.size
|
2804 | };
|
2805 |
|
2806 | opt.subres = {
|
2807 | partNumber: partNo,
|
2808 | uploadId: uploadId
|
2809 | };
|
2810 | params = this._objectRequestParams('PUT', name, opt);
|
2811 |
|
2812 | params.mime = opt.mime;
|
2813 | params.stream = data.stream;
|
2814 | params.successStatuses = [200];
|
2815 |
|
2816 | _context7.next = 11;
|
2817 | return _regenerator2.default.awrap(this.request(params));
|
2818 |
|
2819 | case 11:
|
2820 | result = _context7.sent;
|
2821 |
|
2822 | if (result.res.headers.etag) {
|
2823 | _context7.next = 14;
|
2824 | break;
|
2825 | }
|
2826 |
|
2827 | throw new Error('Please set the etag of expose-headers in OSS \n https://help.aliyun.com/document_detail/32069.html');
|
2828 |
|
2829 | case 14:
|
2830 |
|
2831 | data.stream = null;
|
2832 | params.stream = null;
|
2833 | return _context7.abrupt('return', {
|
2834 | name: name,
|
2835 | etag: result.res.headers.etag,
|
2836 | res: result.res
|
2837 | });
|
2838 |
|
2839 | case 17:
|
2840 | case 'end':
|
2841 | return _context7.stop();
|
2842 | }
|
2843 | }
|
2844 | }, null, this);
|
2845 | };
|
2846 |
|
2847 | },{"./callback":14,"./utils/deepCopy":34,"babel-runtime/regenerator":65,"copy-to":73}],19:[function(require,module,exports){
|
2848 | 'use strict';
|
2849 |
|
2850 | var _regenerator = require('babel-runtime/regenerator');
|
2851 |
|
2852 | var _regenerator2 = _interopRequireDefault(_regenerator);
|
2853 |
|
2854 | var _keys = require('babel-runtime/core-js/object/keys');
|
2855 |
|
2856 | var _keys2 = _interopRequireDefault(_keys);
|
2857 |
|
2858 | var _typeof2 = require('babel-runtime/helpers/typeof');
|
2859 |
|
2860 | var _typeof3 = _interopRequireDefault(_typeof2);
|
2861 |
|
2862 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
2863 |
|
2864 | var _checkBucketName = require('../utils/checkBucketName');
|
2865 |
|
2866 | var proto = exports;
|
2867 |
|
2868 | proto.copy = function copy(name, sourceName, bucketName, options) {
|
2869 | var params, result, data;
|
2870 | return _regenerator2.default.async(function copy$(_context) {
|
2871 | while (1) {
|
2872 | switch (_context.prev = _context.next) {
|
2873 | case 0:
|
2874 | if ((typeof bucketName === 'undefined' ? 'undefined' : (0, _typeof3.default)(bucketName)) === 'object') {
|
2875 | options = bucketName;
|
2876 | }
|
2877 | options = options || {};
|
2878 | options.headers = options.headers || {};
|
2879 |
|
2880 | (0, _keys2.default)(options.headers).forEach(function (key) {
|
2881 | options.headers['x-oss-copy-source-' + key.toLowerCase()] = options.headers[key];
|
2882 | });
|
2883 | if (options.meta) {
|
2884 | options.headers['x-oss-metadata-directive'] = 'REPLACE';
|
2885 | }
|
2886 | this._convertMetaToHeaders(options.meta, options.headers);
|
2887 |
|
2888 | sourceName = this._getSourceName(sourceName, bucketName);
|
2889 |
|
2890 | if (options.versionId) {
|
2891 | sourceName = sourceName + '?versionId=' + options.versionId;
|
2892 | }
|
2893 |
|
2894 | options.headers['x-oss-copy-source'] = sourceName;
|
2895 |
|
2896 | params = this._objectRequestParams('PUT', name, options);
|
2897 |
|
2898 | params.xmlResponse = true;
|
2899 | params.successStatuses = [200, 304];
|
2900 |
|
2901 | _context.next = 14;
|
2902 | return _regenerator2.default.awrap(this.request(params));
|
2903 |
|
2904 | case 14:
|
2905 | result = _context.sent;
|
2906 | data = result.data;
|
2907 |
|
2908 | if (data) {
|
2909 | data = {
|
2910 | etag: data.ETag,
|
2911 | lastModified: data.LastModified
|
2912 | };
|
2913 | }
|
2914 |
|
2915 | return _context.abrupt('return', {
|
2916 | data: data,
|
2917 | res: result.res
|
2918 | });
|
2919 |
|
2920 | case 18:
|
2921 | case 'end':
|
2922 | return _context.stop();
|
2923 | }
|
2924 | }
|
2925 | }, null, this);
|
2926 | };
|
2927 |
|
2928 |
|
2929 | proto._getSourceName = function _getSourceName(sourceName, bucketName) {
|
2930 | if (typeof bucketName === 'string') {
|
2931 | sourceName = this._objectName(sourceName);
|
2932 | } else if (sourceName[0] !== '/') {
|
2933 | bucketName = this.options.bucket;
|
2934 | } else {
|
2935 | bucketName = sourceName.replace(/\/(.+?)(\/.*)/, '$1');
|
2936 | sourceName = sourceName.replace(/(\/.+?\/)(.*)/, '$2');
|
2937 | }
|
2938 |
|
2939 | _checkBucketName(bucketName);
|
2940 |
|
2941 | sourceName = encodeURI(sourceName);
|
2942 |
|
2943 | sourceName = '/' + bucketName + '/' + sourceName;
|
2944 | return sourceName;
|
2945 | };
|
2946 |
|
2947 | },{"../utils/checkBucketName":31,"babel-runtime/core-js/object/keys":55,"babel-runtime/helpers/typeof":64,"babel-runtime/regenerator":65}],20:[function(require,module,exports){
|
2948 | 'use strict';
|
2949 |
|
2950 | var _regenerator = require('babel-runtime/regenerator');
|
2951 |
|
2952 | var _regenerator2 = _interopRequireDefault(_regenerator);
|
2953 |
|
2954 | var _assign = require('babel-runtime/core-js/object/assign');
|
2955 |
|
2956 | var _assign2 = _interopRequireDefault(_assign);
|
2957 |
|
2958 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
2959 |
|
2960 | var proto = exports;
|
2961 |
|
2962 |
|
2963 |
|
2964 |
|
2965 |
|
2966 |
|
2967 |
|
2968 | proto.delete = function _delete(name) {
|
2969 | var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
2970 | var params, result;
|
2971 | return _regenerator2.default.async(function _delete$(_context) {
|
2972 | while (1) {
|
2973 | switch (_context.prev = _context.next) {
|
2974 | case 0:
|
2975 | options.subres = (0, _assign2.default)({}, options.subres);
|
2976 | if (options.versionId) {
|
2977 | options.subres.versionId = options.versionId;
|
2978 | }
|
2979 | params = this._objectRequestParams('DELETE', name, options);
|
2980 |
|
2981 | params.successStatuses = [204];
|
2982 |
|
2983 | _context.next = 6;
|
2984 | return _regenerator2.default.awrap(this.request(params));
|
2985 |
|
2986 | case 6:
|
2987 | result = _context.sent;
|
2988 | return _context.abrupt('return', {
|
2989 | res: result.res
|
2990 | });
|
2991 |
|
2992 | case 8:
|
2993 | case 'end':
|
2994 | return _context.stop();
|
2995 | }
|
2996 | }
|
2997 | }, null, this);
|
2998 | };
|
2999 |
|
3000 | },{"babel-runtime/core-js/object/assign":49,"babel-runtime/regenerator":65}],21:[function(require,module,exports){
|
3001 | 'use strict';
|
3002 |
|
3003 | var _regenerator = require('babel-runtime/regenerator');
|
3004 |
|
3005 | var _regenerator2 = _interopRequireDefault(_regenerator);
|
3006 |
|
3007 | var _assign = require('babel-runtime/core-js/object/assign');
|
3008 |
|
3009 | var _assign2 = _interopRequireDefault(_assign);
|
3010 |
|
3011 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
3012 |
|
3013 | var proto = exports;
|
3014 |
|
3015 |
|
3016 |
|
3017 |
|
3018 |
|
3019 |
|
3020 | proto.deleteObjectTagging = function deleteObjectTagging(name) {
|
3021 | var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
3022 | var params, result;
|
3023 | return _regenerator2.default.async(function deleteObjectTagging$(_context) {
|
3024 | while (1) {
|
3025 | switch (_context.prev = _context.next) {
|
3026 | case 0:
|
3027 | options.subres = (0, _assign2.default)({ tagging: '' }, options.subres);
|
3028 | if (options.versionId) {
|
3029 | options.subres.versionId = options.versionId;
|
3030 | }
|
3031 | name = this._objectName(name);
|
3032 | params = this._objectRequestParams('DELETE', name, options);
|
3033 |
|
3034 | params.successStatuses = [204];
|
3035 | _context.next = 7;
|
3036 | return _regenerator2.default.awrap(this.request(params));
|
3037 |
|
3038 | case 7:
|
3039 | result = _context.sent;
|
3040 | return _context.abrupt('return', {
|
3041 | status: result.status,
|
3042 | res: result.res
|
3043 | });
|
3044 |
|
3045 | case 9:
|
3046 | case 'end':
|
3047 | return _context.stop();
|
3048 | }
|
3049 | }
|
3050 | }, null, this);
|
3051 | };
|
3052 |
|
3053 | },{"babel-runtime/core-js/object/assign":49,"babel-runtime/regenerator":65}],22:[function(require,module,exports){
|
3054 | 'use strict';
|
3055 |
|
3056 | var _regenerator = require('babel-runtime/regenerator');
|
3057 |
|
3058 | var _regenerator2 = _interopRequireDefault(_regenerator);
|
3059 |
|
3060 | var _assign = require('babel-runtime/core-js/object/assign');
|
3061 |
|
3062 | var _assign2 = _interopRequireDefault(_assign);
|
3063 |
|
3064 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
3065 |
|
3066 | var fs = require('fs');
|
3067 | var is = require('is-type-of');
|
3068 |
|
3069 | var proto = exports;
|
3070 |
|
3071 |
|
3072 |
|
3073 |
|
3074 |
|
3075 |
|
3076 |
|
3077 | proto.get = function get(name, file) {
|
3078 | var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
3079 | var writeStream, needDestroy, result, params;
|
3080 | return _regenerator2.default.async(function get$(_context) {
|
3081 | while (1) {
|
3082 | switch (_context.prev = _context.next) {
|
3083 | case 0:
|
3084 | writeStream = null;
|
3085 | needDestroy = false;
|
3086 |
|
3087 |
|
3088 | if (is.writableStream(file)) {
|
3089 | writeStream = file;
|
3090 | } else if (is.string(file)) {
|
3091 | writeStream = fs.createWriteStream(file);
|
3092 | needDestroy = true;
|
3093 | } else {
|
3094 |
|
3095 | options = file;
|
3096 | }
|
3097 |
|
3098 | options = options || {};
|
3099 |
|
3100 | options.subres = (0, _assign2.default)({}, options.subres);
|
3101 | if (options.versionId) {
|
3102 | options.subres.versionId = options.versionId;
|
3103 | }
|
3104 | if (options.process) {
|
3105 | options.subres['x-oss-process'] = options.process;
|
3106 | }
|
3107 |
|
3108 | result = void 0;
|
3109 | _context.prev = 8;
|
3110 | params = this._objectRequestParams('GET', name, options);
|
3111 |
|
3112 | params.writeStream = writeStream;
|
3113 | params.successStatuses = [200, 206, 304];
|
3114 |
|
3115 | _context.next = 14;
|
3116 | return _regenerator2.default.awrap(this.request(params));
|
3117 |
|
3118 | case 14:
|
3119 | result = _context.sent;
|
3120 |
|
3121 |
|
3122 | if (needDestroy) {
|
3123 | writeStream.destroy();
|
3124 | }
|
3125 | _context.next = 25;
|
3126 | break;
|
3127 |
|
3128 | case 18:
|
3129 | _context.prev = 18;
|
3130 | _context.t0 = _context['catch'](8);
|
3131 |
|
3132 | if (!needDestroy) {
|
3133 | _context.next = 24;
|
3134 | break;
|
3135 | }
|
3136 |
|
3137 | writeStream.destroy();
|
3138 |
|
3139 | _context.next = 24;
|
3140 | return _regenerator2.default.awrap(this._deleteFileSafe(file));
|
3141 |
|
3142 | case 24:
|
3143 | throw _context.t0;
|
3144 |
|
3145 | case 25:
|
3146 | return _context.abrupt('return', {
|
3147 | res: result.res,
|
3148 | content: result.data
|
3149 | });
|
3150 |
|
3151 | case 26:
|
3152 | case 'end':
|
3153 | return _context.stop();
|
3154 | }
|
3155 | }
|
3156 | }, null, this, [[8, 18]]);
|
3157 | };
|
3158 |
|
3159 | },{"babel-runtime/core-js/object/assign":49,"babel-runtime/regenerator":65,"fs":68,"is-type-of":233}],23:[function(require,module,exports){
|
3160 | 'use strict';
|
3161 |
|
3162 | var _regenerator = require('babel-runtime/regenerator');
|
3163 |
|
3164 | var _regenerator2 = _interopRequireDefault(_regenerator);
|
3165 |
|
3166 | var _assign = require('babel-runtime/core-js/object/assign');
|
3167 |
|
3168 | var _assign2 = _interopRequireDefault(_assign);
|
3169 |
|
3170 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
3171 |
|
3172 | var proto = exports;
|
3173 |
|
3174 |
|
3175 |
|
3176 |
|
3177 |
|
3178 |
|
3179 |
|
3180 | proto.getACL = function getACL(name) {
|
3181 | var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
3182 | var params, result;
|
3183 | return _regenerator2.default.async(function getACL$(_context) {
|
3184 | while (1) {
|
3185 | switch (_context.prev = _context.next) {
|
3186 | case 0:
|
3187 | options.subres = (0, _assign2.default)({ acl: '' }, options.subres);
|
3188 | if (options.versionId) {
|
3189 | options.subres.versionId = options.versionId;
|
3190 | }
|
3191 | name = this._objectName(name);
|
3192 |
|
3193 | params = this._objectRequestParams('GET', name, options);
|
3194 |
|
3195 | params.successStatuses = [200];
|
3196 | params.xmlResponse = true;
|
3197 |
|
3198 | _context.next = 8;
|
3199 | return _regenerator2.default.awrap(this.request(params));
|
3200 |
|
3201 | case 8:
|
3202 | result = _context.sent;
|
3203 | return _context.abrupt('return', {
|
3204 | acl: result.data.AccessControlList.Grant,
|
3205 | owner: {
|
3206 | id: result.data.Owner.ID,
|
3207 | displayName: result.data.Owner.DisplayName
|
3208 | },
|
3209 | res: result.res
|
3210 | });
|
3211 |
|
3212 | case 10:
|
3213 | case 'end':
|
3214 | return _context.stop();
|
3215 | }
|
3216 | }
|
3217 | }, null, this);
|
3218 | };
|
3219 |
|
3220 | },{"babel-runtime/core-js/object/assign":49,"babel-runtime/regenerator":65}],24:[function(require,module,exports){
|
3221 | 'use strict';
|
3222 |
|
3223 | var _keys = require('babel-runtime/core-js/object/keys');
|
3224 |
|
3225 | var _keys2 = _interopRequireDefault(_keys);
|
3226 |
|
3227 | var _regenerator = require('babel-runtime/regenerator');
|
3228 |
|
3229 | var _regenerator2 = _interopRequireDefault(_regenerator);
|
3230 |
|
3231 | var _assign = require('babel-runtime/core-js/object/assign');
|
3232 |
|
3233 | var _assign2 = _interopRequireDefault(_assign);
|
3234 |
|
3235 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
3236 |
|
3237 |
|
3238 | var proto = exports;
|
3239 | var isObject = require('../utils/isObject');
|
3240 |
|
3241 | proto.getBucketVersions = getBucketVersions;
|
3242 | proto.listObjectVersions = getBucketVersions;
|
3243 |
|
3244 | function getBucketVersions() {
|
3245 | var query = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
3246 | var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
3247 | var params, result, objects, deleteMarker, that;
|
3248 | return _regenerator2.default.async(function getBucketVersions$(_context) {
|
3249 | while (1) {
|
3250 | switch (_context.prev = _context.next) {
|
3251 | case 0:
|
3252 | if (!(query.versionIdMarker && query.keyMarker === undefined)) {
|
3253 | _context.next = 2;
|
3254 | break;
|
3255 | }
|
3256 |
|
3257 | throw new Error('A version-id marker cannot be specified without a key marker');
|
3258 |
|
3259 | case 2:
|
3260 |
|
3261 | options.subres = (0, _assign2.default)({ versions: '' }, options.subres);
|
3262 | if (options.versionId) {
|
3263 | options.subres.versionId = options.versionId;
|
3264 | }
|
3265 | params = this._objectRequestParams('GET', '', options);
|
3266 |
|
3267 | params.xmlResponse = true;
|
3268 | params.successStatuses = [200];
|
3269 |
|
3270 | params.query = formatQuery(query);
|
3271 |
|
3272 | _context.next = 10;
|
3273 | return _regenerator2.default.awrap(this.request(params));
|
3274 |
|
3275 | case 10:
|
3276 | result = _context.sent;
|
3277 | objects = result.data.Version || [];
|
3278 | deleteMarker = result.data.DeleteMarker || [];
|
3279 | that = this;
|
3280 |
|
3281 | if (objects) {
|
3282 | if (!Array.isArray(objects)) {
|
3283 | objects = [objects];
|
3284 | }
|
3285 | objects = objects.map(function (obj) {
|
3286 | return {
|
3287 | name: obj.Key,
|
3288 | url: that._objectUrl(obj.Key),
|
3289 | lastModified: obj.LastModified,
|
3290 | isLatest: obj.IsLatest === 'true',
|
3291 | versionId: obj.VersionId,
|
3292 | etag: obj.ETag,
|
3293 | type: obj.Type,
|
3294 | size: Number(obj.Size),
|
3295 | storageClass: obj.StorageClass,
|
3296 | owner: {
|
3297 | id: obj.Owner.ID,
|
3298 | displayName: obj.Owner.DisplayName
|
3299 | }
|
3300 | };
|
3301 | });
|
3302 | }
|
3303 | if (deleteMarker) {
|
3304 | if (!Array.isArray(deleteMarker)) {
|
3305 | deleteMarker = [deleteMarker];
|
3306 | }
|
3307 | deleteMarker = deleteMarker.map(function (obj) {
|
3308 | return {
|
3309 | name: obj.Key,
|
3310 | lastModified: obj.LastModified,
|
3311 | versionId: obj.VersionId,
|
3312 | owner: {
|
3313 | id: obj.Owner.ID,
|
3314 | displayName: obj.Owner.DisplayName
|
3315 | }
|
3316 | };
|
3317 | });
|
3318 | }
|
3319 | return _context.abrupt('return', {
|
3320 | res: result.res,
|
3321 | objects: objects,
|
3322 | deleteMarker: deleteMarker,
|
3323 | nextMarker: result.data.NextMarker || null,
|
3324 | NextVersionIdMarker: result.data.NextVersionIdMarker || null,
|
3325 | isTruncated: result.data.IsTruncated === 'true'
|
3326 | });
|
3327 |
|
3328 | case 17:
|
3329 | case 'end':
|
3330 | return _context.stop();
|
3331 | }
|
3332 | }
|
3333 | }, null, this);
|
3334 | }
|
3335 |
|
3336 | function camel2Line(name) {
|
3337 | return name.replace(/([A-Z])/g, '-$1').toLowerCase();
|
3338 | }
|
3339 |
|
3340 | function formatQuery() {
|
3341 | var query = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
3342 |
|
3343 | var obj = {};
|
3344 | if (isObject(query)) {
|
3345 | (0, _keys2.default)(query).forEach(function (key) {
|
3346 | obj[camel2Line(key)] = query[key];
|
3347 | });
|
3348 | }
|
3349 |
|
3350 | return obj;
|
3351 | }
|
3352 |
|
3353 | },{"../utils/isObject":41,"babel-runtime/core-js/object/assign":49,"babel-runtime/core-js/object/keys":55,"babel-runtime/regenerator":65}],25:[function(require,module,exports){
|
3354 | 'use strict';
|
3355 |
|
3356 | var _regenerator = require('babel-runtime/regenerator');
|
3357 |
|
3358 | var _regenerator2 = _interopRequireDefault(_regenerator);
|
3359 |
|
3360 | var _assign = require('babel-runtime/core-js/object/assign');
|
3361 |
|
3362 | var _assign2 = _interopRequireDefault(_assign);
|
3363 |
|
3364 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
3365 |
|
3366 | var proto = exports;
|
3367 | var isObject = require('../utils/isObject');
|
3368 |
|
3369 |
|
3370 |
|
3371 |
|
3372 |
|
3373 |
|
3374 |
|
3375 | proto.getObjectTagging = function getObjectTagging(name) {
|
3376 | var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
3377 | var params, result, Tagging, Tag, tag;
|
3378 | return _regenerator2.default.async(function getObjectTagging$(_context) {
|
3379 | while (1) {
|
3380 | switch (_context.prev = _context.next) {
|
3381 | case 0:
|
3382 | options.subres = (0, _assign2.default)({ tagging: '' }, options.subres);
|
3383 | if (options.versionId) {
|
3384 | options.subres.versionId = options.versionId;
|
3385 | }
|
3386 | name = this._objectName(name);
|
3387 | params = this._objectRequestParams('GET', name, options);
|
3388 |
|
3389 | params.successStatuses = [200];
|
3390 | _context.next = 7;
|
3391 | return _regenerator2.default.awrap(this.request(params));
|
3392 |
|
3393 | case 7:
|
3394 | result = _context.sent;
|
3395 | _context.next = 10;
|
3396 | return _regenerator2.default.awrap(this.parseXML(result.data));
|
3397 |
|
3398 | case 10:
|
3399 | Tagging = _context.sent;
|
3400 | Tag = Tagging.TagSet.Tag;
|
3401 |
|
3402 | Tag = Tag && isObject(Tag) ? [Tag] : Tag || [];
|
3403 |
|
3404 | tag = {};
|
3405 |
|
3406 |
|
3407 | Tag.forEach(function (item) {
|
3408 | tag[item.Key] = item.Value;
|
3409 | });
|
3410 |
|
3411 | return _context.abrupt('return', {
|
3412 | status: result.status,
|
3413 | res: result.res,
|
3414 | tag: tag
|
3415 | });
|
3416 |
|
3417 | case 16:
|
3418 | case 'end':
|
3419 | return _context.stop();
|
3420 | }
|
3421 | }
|
3422 | }, null, this);
|
3423 | };
|
3424 |
|
3425 | },{"../utils/isObject":41,"babel-runtime/core-js/object/assign":49,"babel-runtime/regenerator":65}],26:[function(require,module,exports){
|
3426 | 'use strict';
|
3427 |
|
3428 | var _regenerator = require('babel-runtime/regenerator');
|
3429 |
|
3430 | var _regenerator2 = _interopRequireDefault(_regenerator);
|
3431 |
|
3432 | var _keys = require('babel-runtime/core-js/object/keys');
|
3433 |
|
3434 | var _keys2 = _interopRequireDefault(_keys);
|
3435 |
|
3436 | var _assign = require('babel-runtime/core-js/object/assign');
|
3437 |
|
3438 | var _assign2 = _interopRequireDefault(_assign);
|
3439 |
|
3440 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
3441 |
|
3442 | var proto = exports;
|
3443 |
|
3444 |
|
3445 |
|
3446 |
|
3447 |
|
3448 |
|
3449 |
|
3450 | proto.head = function head(name) {
|
3451 | var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
3452 | var params, result, data;
|
3453 | return _regenerator2.default.async(function head$(_context) {
|
3454 | while (1) {
|
3455 | switch (_context.prev = _context.next) {
|
3456 | case 0:
|
3457 | options.subres = (0, _assign2.default)({}, options.subres);
|
3458 | if (options.versionId) {
|
3459 | options.subres.versionId = options.versionId;
|
3460 | }
|
3461 | params = this._objectRequestParams('HEAD', name, options);
|
3462 |
|
3463 | params.successStatuses = [200, 304];
|
3464 |
|
3465 | _context.next = 6;
|
3466 | return _regenerator2.default.awrap(this.request(params));
|
3467 |
|
3468 | case 6:
|
3469 | result = _context.sent;
|
3470 | data = {
|
3471 | meta: null,
|
3472 | res: result.res,
|
3473 | status: result.status
|
3474 | };
|
3475 |
|
3476 |
|
3477 | if (result.status === 200) {
|
3478 | (0, _keys2.default)(result.headers).forEach(function (k) {
|
3479 | if (k.indexOf('x-oss-meta-') === 0) {
|
3480 | if (!data.meta) {
|
3481 | data.meta = {};
|
3482 | }
|
3483 | data.meta[k.substring(11)] = result.headers[k];
|
3484 | }
|
3485 | });
|
3486 | }
|
3487 | return _context.abrupt('return', data);
|
3488 |
|
3489 | case 10:
|
3490 | case 'end':
|
3491 | return _context.stop();
|
3492 | }
|
3493 | }
|
3494 | }, null, this);
|
3495 | };
|
3496 |
|
3497 | },{"babel-runtime/core-js/object/assign":49,"babel-runtime/core-js/object/keys":55,"babel-runtime/regenerator":65}],27:[function(require,module,exports){
|
3498 | 'use strict';
|
3499 |
|
3500 | var _regenerator = require('babel-runtime/regenerator');
|
3501 |
|
3502 | var _regenerator2 = _interopRequireDefault(_regenerator);
|
3503 |
|
3504 | var _assign = require('babel-runtime/core-js/object/assign');
|
3505 |
|
3506 | var _assign2 = _interopRequireDefault(_assign);
|
3507 |
|
3508 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
3509 |
|
3510 | var proto = exports;
|
3511 |
|
3512 |
|
3513 |
|
3514 |
|
3515 |
|
3516 |
|
3517 |
|
3518 | proto.putACL = function putACL(name, acl, options) {
|
3519 | var params, result;
|
3520 | return _regenerator2.default.async(function putACL$(_context) {
|
3521 | while (1) {
|
3522 | switch (_context.prev = _context.next) {
|
3523 | case 0:
|
3524 | options = options || {};
|
3525 | options.subres = (0, _assign2.default)({ acl: '' }, options.subres);
|
3526 | if (options.versionId) {
|
3527 | options.subres.versionId = options.versionId;
|
3528 | }
|
3529 | options.headers = options.headers || {};
|
3530 | options.headers['x-oss-object-acl'] = acl;
|
3531 | name = this._objectName(name);
|
3532 |
|
3533 | params = this._objectRequestParams('PUT', name, options);
|
3534 |
|
3535 | params.successStatuses = [200];
|
3536 |
|
3537 | _context.next = 10;
|
3538 | return _regenerator2.default.awrap(this.request(params));
|
3539 |
|
3540 | case 10:
|
3541 | result = _context.sent;
|
3542 | return _context.abrupt('return', {
|
3543 | res: result.res
|
3544 | });
|
3545 |
|
3546 | case 12:
|
3547 | case 'end':
|
3548 | return _context.stop();
|
3549 | }
|
3550 | }
|
3551 | }, null, this);
|
3552 | };
|
3553 |
|
3554 | },{"babel-runtime/core-js/object/assign":49,"babel-runtime/regenerator":65}],28:[function(require,module,exports){
|
3555 | 'use strict';
|
3556 |
|
3557 | var _regenerator = require('babel-runtime/regenerator');
|
3558 |
|
3559 | var _regenerator2 = _interopRequireDefault(_regenerator);
|
3560 |
|
3561 | var _keys = require('babel-runtime/core-js/object/keys');
|
3562 |
|
3563 | var _keys2 = _interopRequireDefault(_keys);
|
3564 |
|
3565 | var _assign = require('babel-runtime/core-js/object/assign');
|
3566 |
|
3567 | var _assign2 = _interopRequireDefault(_assign);
|
3568 |
|
3569 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
3570 |
|
3571 | var obj2xml = require('../utils/obj2xml');
|
3572 | var checkTag = require('../utils/checkObjectTag');
|
3573 |
|
3574 | var proto = exports;
|
3575 |
|
3576 |
|
3577 |
|
3578 |
|
3579 |
|
3580 |
|
3581 |
|
3582 | proto.putObjectTagging = function putObjectTagging(name, tag) {
|
3583 | var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
3584 | var params, paramXMLObj, result;
|
3585 | return _regenerator2.default.async(function putObjectTagging$(_context) {
|
3586 | while (1) {
|
3587 | switch (_context.prev = _context.next) {
|
3588 | case 0:
|
3589 | checkTag(tag);
|
3590 |
|
3591 | options.subres = (0, _assign2.default)({ tagging: '' }, options.subres);
|
3592 | if (options.versionId) {
|
3593 | options.subres.versionId = options.versionId;
|
3594 | }
|
3595 | name = this._objectName(name);
|
3596 | params = this._objectRequestParams('PUT', name, options);
|
3597 |
|
3598 | params.successStatuses = [200];
|
3599 | tag = (0, _keys2.default)(tag).map(function (key) {
|
3600 | return {
|
3601 | Key: key,
|
3602 | Value: tag[key]
|
3603 | };
|
3604 | });
|
3605 |
|
3606 | paramXMLObj = {
|
3607 | Tagging: {
|
3608 | TagSet: {
|
3609 | Tag: tag
|
3610 | }
|
3611 | }
|
3612 | };
|
3613 |
|
3614 |
|
3615 | params.mime = 'xml';
|
3616 | params.content = obj2xml(paramXMLObj);
|
3617 |
|
3618 | _context.next = 12;
|
3619 | return _regenerator2.default.awrap(this.request(params));
|
3620 |
|
3621 | case 12:
|
3622 | result = _context.sent;
|
3623 | return _context.abrupt('return', {
|
3624 | res: result.res,
|
3625 | status: result.status
|
3626 | });
|
3627 |
|
3628 | case 14:
|
3629 | case 'end':
|
3630 | return _context.stop();
|
3631 | }
|
3632 | }
|
3633 | }, null, this);
|
3634 | };
|
3635 |
|
3636 | },{"../utils/checkObjectTag":32,"../utils/obj2xml":42,"babel-runtime/core-js/object/assign":49,"babel-runtime/core-js/object/keys":55,"babel-runtime/regenerator":65}],29:[function(require,module,exports){
|
3637 | 'use strict';
|
3638 |
|
3639 | var _regenerator = require('babel-runtime/regenerator');
|
3640 |
|
3641 | var _regenerator2 = _interopRequireDefault(_regenerator);
|
3642 |
|
3643 | var _promise = require('babel-runtime/core-js/promise');
|
3644 |
|
3645 | var _promise2 = _interopRequireDefault(_promise);
|
3646 |
|
3647 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
3648 |
|
3649 | var proto = exports;
|
3650 |
|
3651 | proto._parallelNode = function _parallelNode(todo, parallel, fn, sourceData) {
|
3652 | var that, jobErr, jobs, tempBatch, remainder, batch, taskIndex, i;
|
3653 | return _regenerator2.default.async(function _parallelNode$(_context) {
|
3654 | while (1) {
|
3655 | switch (_context.prev = _context.next) {
|
3656 | case 0:
|
3657 | that = this;
|
3658 |
|
3659 |
|
3660 | jobErr = [];
|
3661 | jobs = [];
|
3662 | tempBatch = todo.length / parallel;
|
3663 | remainder = todo.length % parallel;
|
3664 | batch = remainder === 0 ? tempBatch : (todo.length - remainder) / parallel + 1;
|
3665 | taskIndex = 1;
|
3666 | i = 0;
|
3667 |
|
3668 | case 8:
|
3669 | if (!(i < todo.length)) {
|
3670 | _context.next = 26;
|
3671 | break;
|
3672 | }
|
3673 |
|
3674 | if (!that.isCancel()) {
|
3675 | _context.next = 11;
|
3676 | break;
|
3677 | }
|
3678 |
|
3679 | return _context.abrupt('break', 26);
|
3680 |
|
3681 | case 11:
|
3682 |
|
3683 | if (sourceData) {
|
3684 | jobs.push(fn(that, todo[i], sourceData));
|
3685 | } else {
|
3686 | jobs.push(fn(that, todo[i]));
|
3687 | }
|
3688 |
|
3689 | if (!(jobs.length === parallel || taskIndex === batch && i === todo.length - 1)) {
|
3690 | _context.next = 23;
|
3691 | break;
|
3692 | }
|
3693 |
|
3694 | _context.prev = 13;
|
3695 |
|
3696 | taskIndex += 1;
|
3697 |
|
3698 | _context.next = 17;
|
3699 | return _regenerator2.default.awrap(_promise2.default.all(jobs));
|
3700 |
|
3701 | case 17:
|
3702 | _context.next = 22;
|
3703 | break;
|
3704 |
|
3705 | case 19:
|
3706 | _context.prev = 19;
|
3707 | _context.t0 = _context['catch'](13);
|
3708 |
|
3709 | jobErr.push(_context.t0);
|
3710 |
|
3711 | case 22:
|
3712 | jobs = [];
|
3713 |
|
3714 | case 23:
|
3715 | i++;
|
3716 | _context.next = 8;
|
3717 | break;
|
3718 |
|
3719 | case 26:
|
3720 | return _context.abrupt('return', jobErr);
|
3721 |
|
3722 | case 27:
|
3723 | case 'end':
|
3724 | return _context.stop();
|
3725 | }
|
3726 | }
|
3727 | }, null, this, [[13, 19]]);
|
3728 | };
|
3729 |
|
3730 | proto._parallel = function _parallel(todo, parallel, jobPromise) {
|
3731 | var that = this;
|
3732 | return new _promise2.default(function (resolve) {
|
3733 | var _jobErr = [];
|
3734 | if (parallel <= 0 || !todo) {
|
3735 | resolve(_jobErr);
|
3736 | return;
|
3737 | }
|
3738 |
|
3739 | function onlyOnce(fn) {
|
3740 | return function () {
|
3741 | if (fn === null) throw new Error('Callback was already called.');
|
3742 | var callFn = fn;
|
3743 | fn = null;
|
3744 |
|
3745 | for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
3746 | args[_key] = arguments[_key];
|
3747 | }
|
3748 |
|
3749 | callFn.apply(this, args);
|
3750 | };
|
3751 | }
|
3752 |
|
3753 | function createArrayIterator(coll) {
|
3754 | var i = -1;
|
3755 | var len = coll.length;
|
3756 | return function next() {
|
3757 | return ++i < len && !that.isCancel() ? { value: coll[i], key: i } : null;
|
3758 | };
|
3759 | }
|
3760 |
|
3761 | var nextElem = createArrayIterator(todo);
|
3762 | var done = false;
|
3763 | var running = 0;
|
3764 | var looping = false;
|
3765 |
|
3766 | function iterateeCallback(err, value) {
|
3767 | running -= 1;
|
3768 | if (err) {
|
3769 | done = true;
|
3770 | _jobErr.push(err);
|
3771 | resolve(_jobErr);
|
3772 | } else if (value === {} || done && running <= 0) {
|
3773 | done = true;
|
3774 | resolve(_jobErr);
|
3775 | } else if (!looping) {
|
3776 |
|
3777 | if (that.isCancel()) {
|
3778 | resolve(_jobErr);
|
3779 | } else {
|
3780 | replenish();
|
3781 | }
|
3782 | }
|
3783 | }
|
3784 |
|
3785 | function iteratee(value, callback) {
|
3786 | jobPromise(value).then(function (result) {
|
3787 | callback(null, result);
|
3788 | }).catch(function (err) {
|
3789 | callback(err);
|
3790 | });
|
3791 | }
|
3792 |
|
3793 | function replenish() {
|
3794 | looping = true;
|
3795 | while (running < parallel && !done && !that.isCancel()) {
|
3796 | var elem = nextElem();
|
3797 | if (elem === null || _jobErr.length > 0) {
|
3798 | done = true;
|
3799 | if (running <= 0) {
|
3800 | resolve(_jobErr);
|
3801 | }
|
3802 | return;
|
3803 | }
|
3804 | running += 1;
|
3805 | iteratee(elem.value, onlyOnce(iterateeCallback));
|
3806 | }
|
3807 | looping = false;
|
3808 | }
|
3809 |
|
3810 | replenish();
|
3811 | });
|
3812 | };
|
3813 |
|
3814 |
|
3815 |
|
3816 |
|
3817 |
|
3818 |
|
3819 |
|
3820 |
|
3821 | proto.cancel = function cancel(abort) {
|
3822 | this.options.cancelFlag = true;
|
3823 | if (abort) {
|
3824 | this.abortMultipartUpload(abort.name, abort.uploadId, abort.options);
|
3825 | }
|
3826 | };
|
3827 |
|
3828 | proto.isCancel = function isCancel() {
|
3829 | return this.options.cancelFlag;
|
3830 | };
|
3831 |
|
3832 | proto.resetCancelFlag = function resetCancelFlag() {
|
3833 | this.options.cancelFlag = false;
|
3834 | };
|
3835 |
|
3836 | proto._stop = function _stop() {
|
3837 | this.options.cancelFlag = true;
|
3838 | };
|
3839 |
|
3840 |
|
3841 | proto._makeCancelEvent = function _makeCancelEvent() {
|
3842 | var cancelEvent = {
|
3843 | status: 0,
|
3844 | name: 'cancel'
|
3845 | };
|
3846 | return cancelEvent;
|
3847 | };
|
3848 |
|
3849 | },{"babel-runtime/core-js/promise":56,"babel-runtime/regenerator":65}],30:[function(require,module,exports){
|
3850 | (function (Buffer){
|
3851 | 'use strict';
|
3852 |
|
3853 | var _stringify = require('babel-runtime/core-js/json/stringify');
|
3854 |
|
3855 | var _stringify2 = _interopRequireDefault(_stringify);
|
3856 |
|
3857 | var _keys = require('babel-runtime/core-js/object/keys');
|
3858 |
|
3859 | var _keys2 = _interopRequireDefault(_keys);
|
3860 |
|
3861 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
3862 |
|
3863 | var crypto = require('./../../shims/crypto/crypto.js');
|
3864 | var is = require('is-type-of');
|
3865 |
|
3866 |
|
3867 |
|
3868 |
|
3869 |
|
3870 |
|
3871 |
|
3872 | exports.buildCanonicalizedResource = function buildCanonicalizedResource(resourcePath, parameters) {
|
3873 | var canonicalizedResource = '' + resourcePath;
|
3874 | var separatorString = '?';
|
3875 |
|
3876 | if (is.string(parameters) && parameters.trim() !== '') {
|
3877 | canonicalizedResource += separatorString + parameters;
|
3878 | } else if (is.array(parameters)) {
|
3879 | parameters.sort();
|
3880 | canonicalizedResource += separatorString + parameters.join('&');
|
3881 | } else if (parameters) {
|
3882 | var compareFunc = function compareFunc(entry1, entry2) {
|
3883 | if (entry1[0] > entry2[0]) {
|
3884 | return 1;
|
3885 | } else if (entry1[0] < entry2[0]) {
|
3886 | return -1;
|
3887 | }
|
3888 | return 0;
|
3889 | };
|
3890 | var processFunc = function processFunc(key) {
|
3891 | canonicalizedResource += separatorString + key;
|
3892 | if (parameters[key]) {
|
3893 | canonicalizedResource += '=' + parameters[key];
|
3894 | }
|
3895 | separatorString = '&';
|
3896 | };
|
3897 | (0, _keys2.default)(parameters).sort(compareFunc).forEach(processFunc);
|
3898 | }
|
3899 |
|
3900 | return canonicalizedResource;
|
3901 | };
|
3902 |
|
3903 |
|
3904 |
|
3905 |
|
3906 |
|
3907 |
|
3908 |
|
3909 |
|
3910 | exports.buildCanonicalString = function canonicalString(method, resourcePath, request, expires) {
|
3911 | request = request || {};
|
3912 | var headers = request.headers || {};
|
3913 | var OSS_PREFIX = 'x-oss-';
|
3914 | var ossHeaders = [];
|
3915 | var headersToSign = {};
|
3916 |
|
3917 | var signContent = [method.toUpperCase(), headers['Content-Md5'] || '', headers['Content-Type'] || headers['Content-Type'.toLowerCase()], expires || headers['x-oss-date']];
|
3918 |
|
3919 | (0, _keys2.default)(headers).forEach(function (key) {
|
3920 | var lowerKey = key.toLowerCase();
|
3921 | if (lowerKey.indexOf(OSS_PREFIX) === 0) {
|
3922 | headersToSign[lowerKey] = String(headers[key]).trim();
|
3923 | }
|
3924 | });
|
3925 |
|
3926 | (0, _keys2.default)(headersToSign).sort().forEach(function (key) {
|
3927 | ossHeaders.push(key + ':' + headersToSign[key]);
|
3928 | });
|
3929 |
|
3930 | signContent = signContent.concat(ossHeaders);
|
3931 |
|
3932 | signContent.push(this.buildCanonicalizedResource(resourcePath, request.parameters));
|
3933 |
|
3934 | return signContent.join('\n');
|
3935 | };
|
3936 |
|
3937 |
|
3938 |
|
3939 |
|
3940 |
|
3941 | exports.computeSignature = function computeSignature(accessKeySecret, canonicalString) {
|
3942 | var signature = crypto.createHmac('sha1', accessKeySecret);
|
3943 | return signature.update(Buffer.from(canonicalString, 'utf8')).digest('base64');
|
3944 | };
|
3945 |
|
3946 |
|
3947 |
|
3948 |
|
3949 |
|
3950 |
|
3951 | exports.authorization = function authorization(accessKeyId, accessKeySecret, canonicalString) {
|
3952 | return 'OSS ' + accessKeyId + ':' + this.computeSignature(accessKeySecret, canonicalString);
|
3953 | };
|
3954 |
|
3955 |
|
3956 |
|
3957 |
|
3958 |
|
3959 |
|
3960 |
|
3961 |
|
3962 | exports._signatureForURL = function _signatureForURL(accessKeySecret) {
|
3963 | var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
3964 | var resource = arguments[2];
|
3965 | var expires = arguments[3];
|
3966 |
|
3967 | var headers = {};
|
3968 | var _options$subResource = options.subResource,
|
3969 | subResource = _options$subResource === undefined ? {} : _options$subResource;
|
3970 |
|
3971 |
|
3972 | if (options.process) {
|
3973 | var processKeyword = 'x-oss-process';
|
3974 | subResource[processKeyword] = options.process;
|
3975 | }
|
3976 |
|
3977 | if (options.trafficLimit) {
|
3978 | var trafficLimitKey = 'x-oss-traffic-limit';
|
3979 | subResource[trafficLimitKey] = options.trafficLimit;
|
3980 | }
|
3981 |
|
3982 | if (options.response) {
|
3983 | (0, _keys2.default)(options.response).forEach(function (k) {
|
3984 | var key = 'response-' + k.toLowerCase();
|
3985 | subResource[key] = options.response[k];
|
3986 | });
|
3987 | }
|
3988 |
|
3989 | (0, _keys2.default)(options).forEach(function (key) {
|
3990 | var lowerKey = key.toLowerCase();
|
3991 | var value = options[key];
|
3992 | if (lowerKey.indexOf('x-oss-') === 0) {
|
3993 | headers[lowerKey] = value;
|
3994 | } else if (lowerKey.indexOf('content-md5') === 0) {
|
3995 | headers[key] = value;
|
3996 | } else if (lowerKey.indexOf('content-type') === 0) {
|
3997 | headers[key] = value;
|
3998 | }
|
3999 | });
|
4000 |
|
4001 | if (Object.prototype.hasOwnProperty.call(options, 'security-token')) {
|
4002 | subResource['security-token'] = options['security-token'];
|
4003 | }
|
4004 |
|
4005 | if (Object.prototype.hasOwnProperty.call(options, 'callback')) {
|
4006 | var json = {
|
4007 | callbackUrl: encodeURI(options.callback.url),
|
4008 | callbackBody: options.callback.body
|
4009 | };
|
4010 | if (options.callback.host) {
|
4011 | json.callbackHost = options.callback.host;
|
4012 | }
|
4013 | if (options.callback.contentType) {
|
4014 | json.callbackBodyType = options.callback.contentType;
|
4015 | }
|
4016 | subResource.callback = Buffer.from((0, _stringify2.default)(json)).toString('base64');
|
4017 |
|
4018 | if (options.callback.customValue) {
|
4019 | var callbackVar = {};
|
4020 | (0, _keys2.default)(options.callback.customValue).forEach(function (key) {
|
4021 | callbackVar['x:' + key] = options.callback.customValue[key];
|
4022 | });
|
4023 | subResource['callback-var'] = Buffer.from((0, _stringify2.default)(callbackVar)).toString('base64');
|
4024 | }
|
4025 | }
|
4026 |
|
4027 | var canonicalString = this.buildCanonicalString(options.method, resource, {
|
4028 | headers: headers,
|
4029 | parameters: subResource
|
4030 | }, expires.toString());
|
4031 |
|
4032 | return {
|
4033 | Signature: this.computeSignature(accessKeySecret, canonicalString),
|
4034 | subResource: subResource
|
4035 | };
|
4036 | };
|
4037 |
|
4038 | }).call(this,require("buffer").Buffer)
|
4039 | },{"./../../shims/crypto/crypto.js":328,"babel-runtime/core-js/json/stringify":48,"babel-runtime/core-js/object/keys":55,"buffer":70,"is-type-of":233}],31:[function(require,module,exports){
|
4040 | 'use strict';
|
4041 |
|
4042 |
|
4043 |
|
4044 |
|
4045 |
|
4046 | module.exports = function (name, createBucket) {
|
4047 | 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_]$/;
|
4048 | if (!bucketRegex.test(name)) {
|
4049 | throw new Error('The bucket must be conform to the specifications');
|
4050 | }
|
4051 | };
|
4052 |
|
4053 | },{}],32:[function(require,module,exports){
|
4054 | 'use strict';
|
4055 |
|
4056 | var _entries = require('babel-runtime/core-js/object/entries');
|
4057 |
|
4058 | var _entries2 = _interopRequireDefault(_entries);
|
4059 |
|
4060 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
4061 |
|
4062 | var checkValid = require('./checkValid');
|
4063 | var isObject = require('./isObject');
|
4064 |
|
4065 | var commonRules = [{
|
4066 | validator: function validator(value) {
|
4067 | if (typeof value !== 'string') {
|
4068 | throw new Error('the key and value of the tag must be String');
|
4069 | }
|
4070 | }
|
4071 | }, {
|
4072 | pattern: /^[a-zA-Z0-9 +-=._:/]+$/,
|
4073 | msg: 'tag can contain letters, numbers, spaces, and the following symbols: plus sign (+), hyphen (-), equal sign (=), period (.), underscore (_), colon (:), and forward slash (/)'
|
4074 | }];
|
4075 |
|
4076 | var rules = {
|
4077 | key: [].concat(commonRules, [{
|
4078 | pattern: /^.{1,128}$/,
|
4079 | msg: 'tag key can be a maximum of 128 bytes in length'
|
4080 | }]),
|
4081 | value: [].concat(commonRules, [{
|
4082 | pattern: /^.{0,256}$/,
|
4083 | msg: 'tag value can be a maximum of 256 bytes in length'
|
4084 | }])
|
4085 | };
|
4086 |
|
4087 | module.exports = function checkTag(tag) {
|
4088 | if (!isObject(tag)) {
|
4089 | throw new Error('tag must be Object');
|
4090 | }
|
4091 |
|
4092 | var entries = (0, _entries2.default)(tag);
|
4093 |
|
4094 | if (entries.length > 10) {
|
4095 | throw new Error('maximum of 10 tags for a object');
|
4096 | }
|
4097 |
|
4098 | var rulesIndexKey = ['key', 'value'];
|
4099 |
|
4100 | entries.forEach(function (keyValue) {
|
4101 | keyValue.forEach(function (item, index) {
|
4102 | checkValid(item, rules[rulesIndexKey[index]]);
|
4103 | });
|
4104 | });
|
4105 | };
|
4106 |
|
4107 | },{"./checkValid":33,"./isObject":41,"babel-runtime/core-js/object/entries":52}],33:[function(require,module,exports){
|
4108 | "use strict";
|
4109 |
|
4110 | module.exports = function checkValid(_value, _rules) {
|
4111 | _rules.forEach(function (rule) {
|
4112 | if (rule.validator) {
|
4113 | rule.validator(_value);
|
4114 | } else if (rule.pattern && !rule.pattern.test(_value)) {
|
4115 | throw new Error(rule.msg);
|
4116 | }
|
4117 | });
|
4118 | };
|
4119 |
|
4120 | },{}],34:[function(require,module,exports){
|
4121 | 'use strict';
|
4122 |
|
4123 | var _keys = require('babel-runtime/core-js/object/keys');
|
4124 |
|
4125 | var _keys2 = _interopRequireDefault(_keys);
|
4126 |
|
4127 | var _typeof2 = require('babel-runtime/helpers/typeof');
|
4128 |
|
4129 | var _typeof3 = _interopRequireDefault(_typeof2);
|
4130 |
|
4131 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
4132 |
|
4133 | module.exports = function deepCopy(obj) {
|
4134 | var cache = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
4135 |
|
4136 | if (obj === null || (typeof obj === 'undefined' ? 'undefined' : (0, _typeof3.default)(obj)) !== 'object') {
|
4137 | return obj;
|
4138 | }
|
4139 | var hit = cache.filter(function (c) {
|
4140 | return c.original === obj;
|
4141 | })[0];
|
4142 | if (hit) {
|
4143 | return hit.copy;
|
4144 | }
|
4145 | var copy = Array.isArray(obj) ? [] : {};
|
4146 | cache.push({
|
4147 | original: obj,
|
4148 | copy: copy
|
4149 | });
|
4150 |
|
4151 | (0, _keys2.default)(obj).forEach(function (key) {
|
4152 | copy[key] = deepCopy(obj[key], cache);
|
4153 | });
|
4154 |
|
4155 | return copy;
|
4156 | };
|
4157 |
|
4158 | },{"babel-runtime/core-js/object/keys":55,"babel-runtime/helpers/typeof":64}],35:[function(require,module,exports){
|
4159 | 'use strict';
|
4160 |
|
4161 | var _keys = require('babel-runtime/core-js/object/keys');
|
4162 |
|
4163 | var _keys2 = _interopRequireDefault(_keys);
|
4164 |
|
4165 | var _typeof2 = require('babel-runtime/helpers/typeof');
|
4166 |
|
4167 | var _typeof3 = _interopRequireDefault(_typeof2);
|
4168 |
|
4169 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
4170 |
|
4171 |
|
4172 | module.exports = function formatObjKey(obj, type) {
|
4173 | if (obj === null || (typeof obj === 'undefined' ? 'undefined' : (0, _typeof3.default)(obj)) !== 'object') {
|
4174 | return obj;
|
4175 | }
|
4176 |
|
4177 | var o = void 0;
|
4178 | if (Array.isArray(obj)) {
|
4179 | o = [];
|
4180 | for (var i = 0; i < obj.length; i++) {
|
4181 | o.push(formatObjKey(obj[i], type));
|
4182 | }
|
4183 | } else {
|
4184 | o = {};
|
4185 | (0, _keys2.default)(obj).forEach(function (key) {
|
4186 | o[handelFormat(key, type)] = formatObjKey(obj[key], type);
|
4187 | });
|
4188 | }
|
4189 | return o;
|
4190 | };
|
4191 |
|
4192 | function handelFormat(key, type) {
|
4193 | if (type === 'firstUpperCase') {
|
4194 | key = key.replace(/^./, function (_) {
|
4195 | return _.toUpperCase();
|
4196 | });
|
4197 | } else if (type === 'firstLowerCase') {
|
4198 | key = key.replace(/^./, function (_) {
|
4199 | return _.toLowerCase();
|
4200 | });
|
4201 | }
|
4202 | return key;
|
4203 | }
|
4204 |
|
4205 | },{"babel-runtime/core-js/object/keys":55,"babel-runtime/helpers/typeof":64}],36:[function(require,module,exports){
|
4206 | "use strict";
|
4207 |
|
4208 | module.exports = function getStrBytesCount(str) {
|
4209 | var bytesCount = 0;
|
4210 | for (var i = 0; i < str.length; i++) {
|
4211 | var c = str.charAt(i);
|
4212 | if (/^[\u00-\uff]$/.test(c)) {
|
4213 | bytesCount += 1;
|
4214 | } else {
|
4215 | bytesCount += 2;
|
4216 | }
|
4217 | }
|
4218 | return bytesCount;
|
4219 | };
|
4220 |
|
4221 | },{}],37:[function(require,module,exports){
|
4222 | 'use strict';
|
4223 |
|
4224 | module.exports = function isArray(obj) {
|
4225 | return Object.prototype.toString.call(obj) === '[object Array]';
|
4226 | };
|
4227 |
|
4228 | },{}],38:[function(require,module,exports){
|
4229 | 'use strict';
|
4230 |
|
4231 | module.exports = function isBlob(blob) {
|
4232 | return typeof Blob !== 'undefined' && blob instanceof Blob;
|
4233 | };
|
4234 |
|
4235 | },{}],39:[function(require,module,exports){
|
4236 | 'use strict';
|
4237 |
|
4238 | module.exports = function isFile(obj) {
|
4239 | return typeof File !== 'undefined' && obj instanceof File;
|
4240 | };
|
4241 |
|
4242 | },{}],40:[function(require,module,exports){
|
4243 | "use strict";
|
4244 |
|
4245 |
|
4246 |
|
4247 |
|
4248 |
|
4249 |
|
4250 |
|
4251 | module.exports = function (host) {
|
4252 | 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}$/;
|
4253 | 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*$/;
|
4254 | var isIP = ipv4Regex.test(host) || ipv6Regex.test(host);
|
4255 | return isIP;
|
4256 | };
|
4257 |
|
4258 | },{}],41:[function(require,module,exports){
|
4259 | 'use strict';
|
4260 |
|
4261 | module.exports = function isObject(obj) {
|
4262 | return Object.prototype.toString.call(obj) === '[object Object]';
|
4263 | };
|
4264 |
|
4265 | },{}],42:[function(require,module,exports){
|
4266 | 'use strict';
|
4267 |
|
4268 | var _keys = require('babel-runtime/core-js/object/keys');
|
4269 |
|
4270 | var _keys2 = _interopRequireDefault(_keys);
|
4271 |
|
4272 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
4273 |
|
4274 | var formatObjKey = require('./formatObjKey');
|
4275 |
|
4276 | function type(params) {
|
4277 | return Object.prototype.toString.call(params).replace(/(.*? |])/g, '').toLowerCase();
|
4278 | }
|
4279 |
|
4280 | function obj2xml(obj, options) {
|
4281 | var s = '';
|
4282 | if (options && options.headers) {
|
4283 | s = '<?xml version="1.0" encoding="UTF-8"?>\n';
|
4284 | }
|
4285 | if (options && options.firstUpperCase) {
|
4286 | obj = formatObjKey(obj, 'firstUpperCase');
|
4287 | }
|
4288 | if (type(obj) === 'object') {
|
4289 | (0, _keys2.default)(obj).forEach(function (key) {
|
4290 | if (type(obj[key]) === 'string' || type(obj[key]) === 'number') {
|
4291 | s += '<' + key + '>' + obj[key] + '</' + key + '>';
|
4292 | } else if (type(obj[key]) === 'object') {
|
4293 | s += '<' + key + '>' + obj2xml(obj[key]) + '</' + key + '>';
|
4294 | } else if (type(obj[key]) === 'array') {
|
4295 | s += obj[key].map(function (keyChild) {
|
4296 | return '<' + key + '>' + obj2xml(keyChild) + '</' + key + '>';
|
4297 | }).join('');
|
4298 | } else {
|
4299 | s += '<' + key + '>' + obj[key].toString() + '</' + key + '>';
|
4300 | }
|
4301 | });
|
4302 | } else {
|
4303 | s += obj.toString();
|
4304 | }
|
4305 | return s;
|
4306 | }
|
4307 |
|
4308 | module.exports = obj2xml;
|
4309 |
|
4310 | },{"./formatObjKey":35,"babel-runtime/core-js/object/keys":55}],43:[function(require,module,exports){
|
4311 | module.exports = noop;
|
4312 | module.exports.HttpsAgent = noop;
|
4313 |
|
4314 |
|
4315 | function noop () {}
|
4316 |
|
4317 | },{}],44:[function(require,module,exports){
|
4318 | module.exports = require('./register')().Promise
|
4319 |
|
4320 | },{"./register":46}],45:[function(require,module,exports){
|
4321 | "use strict"
|
4322 |
|
4323 | var REGISTRATION_KEY = '@@any-promise/REGISTRATION',
|
4324 |
|
4325 | registered = null
|
4326 |
|
4327 |
|
4328 |
|
4329 |
|
4330 |
|
4331 |
|
4332 |
|
4333 |
|
4334 |
|
4335 |
|
4336 |
|
4337 |
|
4338 |
|
4339 |
|
4340 |
|
4341 |
|
4342 |
|
4343 |
|
4344 |
|
4345 |
|
4346 |
|
4347 |
|
4348 |
|
4349 |
|
4350 |
|
4351 |
|
4352 |
|
4353 |
|
4354 |
|
4355 |
|
4356 |
|
4357 | module.exports = function(root, loadImplementation){
|
4358 | return function register(implementation, opts){
|
4359 | implementation = implementation || null
|
4360 | opts = opts || {}
|
4361 |
|
4362 | var registerGlobal = opts.global !== false;
|
4363 |
|
4364 |
|
4365 | if(registered === null && registerGlobal){
|
4366 | registered = root[REGISTRATION_KEY] || null
|
4367 | }
|
4368 |
|
4369 | if(registered !== null
|
4370 | && implementation !== null
|
4371 | && registered.implementation !== implementation){
|
4372 |
|
4373 | throw new Error('any-promise already defined as "'+registered.implementation+
|
4374 | '". You can only register an implementation before the first '+
|
4375 | ' call to require("any-promise") and an implementation cannot be changed')
|
4376 | }
|
4377 |
|
4378 | if(registered === null){
|
4379 |
|
4380 | if(implementation !== null && typeof opts.Promise !== 'undefined'){
|
4381 | registered = {
|
4382 | Promise: opts.Promise,
|
4383 | implementation: implementation
|
4384 | }
|
4385 | } else {
|
4386 |
|
4387 | registered = loadImplementation(implementation)
|
4388 | }
|
4389 |
|
4390 | if(registerGlobal){
|
4391 |
|
4392 | root[REGISTRATION_KEY] = registered
|
4393 | }
|
4394 | }
|
4395 |
|
4396 | return registered
|
4397 | }
|
4398 | }
|
4399 |
|
4400 | },{}],46:[function(require,module,exports){
|
4401 | "use strict";
|
4402 | module.exports = require('./loader')(window, loadImplementation)
|
4403 |
|
4404 |
|
4405 |
|
4406 |
|
4407 |
|
4408 |
|
4409 | function loadImplementation(){
|
4410 | if(typeof window.Promise === 'undefined'){
|
4411 | throw new Error("any-promise browser requires a polyfill or explicit registration"+
|
4412 | " e.g: require('any-promise/register/bluebird')")
|
4413 | }
|
4414 | return {
|
4415 | Promise: window.Promise,
|
4416 | implementation: 'window.Promise'
|
4417 | }
|
4418 | }
|
4419 |
|
4420 | },{"./loader":45}],47:[function(require,module,exports){
|
4421 | module.exports = { "default": require("core-js/library/fn/array/from"), __esModule: true };
|
4422 | },{"core-js/library/fn/array/from":74}],48:[function(require,module,exports){
|
4423 | module.exports = { "default": require("core-js/library/fn/json/stringify"), __esModule: true };
|
4424 | },{"core-js/library/fn/json/stringify":75}],49:[function(require,module,exports){
|
4425 | module.exports = { "default": require("core-js/library/fn/object/assign"), __esModule: true };
|
4426 | },{"core-js/library/fn/object/assign":76}],50:[function(require,module,exports){
|
4427 | module.exports = { "default": require("core-js/library/fn/object/create"), __esModule: true };
|
4428 | },{"core-js/library/fn/object/create":77}],51:[function(require,module,exports){
|
4429 | module.exports = { "default": require("core-js/library/fn/object/define-property"), __esModule: true };
|
4430 | },{"core-js/library/fn/object/define-property":78}],52:[function(require,module,exports){
|
4431 | module.exports = { "default": require("core-js/library/fn/object/entries"), __esModule: true };
|
4432 | },{"core-js/library/fn/object/entries":79}],53:[function(require,module,exports){
|
4433 | module.exports = { "default": require("core-js/library/fn/object/get-own-property-names"), __esModule: true };
|
4434 | },{"core-js/library/fn/object/get-own-property-names":80}],54:[function(require,module,exports){
|
4435 | module.exports = { "default": require("core-js/library/fn/object/get-prototype-of"), __esModule: true };
|
4436 | },{"core-js/library/fn/object/get-prototype-of":81}],55:[function(require,module,exports){
|
4437 | module.exports = { "default": require("core-js/library/fn/object/keys"), __esModule: true };
|
4438 | },{"core-js/library/fn/object/keys":82}],56:[function(require,module,exports){
|
4439 | module.exports = { "default": require("core-js/library/fn/promise"), __esModule: true };
|
4440 | },{"core-js/library/fn/promise":83}],57:[function(require,module,exports){
|
4441 | module.exports = { "default": require("core-js/library/fn/set-immediate"), __esModule: true };
|
4442 | },{"core-js/library/fn/set-immediate":84}],58:[function(require,module,exports){
|
4443 | module.exports = { "default": require("core-js/library/fn/string/from-code-point"), __esModule: true };
|
4444 | },{"core-js/library/fn/string/from-code-point":85}],59:[function(require,module,exports){
|
4445 | module.exports = { "default": require("core-js/library/fn/symbol"), __esModule: true };
|
4446 | },{"core-js/library/fn/symbol":87}],60:[function(require,module,exports){
|
4447 | module.exports = { "default": require("core-js/library/fn/symbol/has-instance"), __esModule: true };
|
4448 | },{"core-js/library/fn/symbol/has-instance":86}],61:[function(require,module,exports){
|
4449 | module.exports = { "default": require("core-js/library/fn/symbol/iterator"), __esModule: true };
|
4450 | },{"core-js/library/fn/symbol/iterator":88}],62:[function(require,module,exports){
|
4451 | "use strict";
|
4452 |
|
4453 | exports.__esModule = true;
|
4454 |
|
4455 | exports.default = function (instance, Constructor) {
|
4456 | if (!(instance instanceof Constructor)) {
|
4457 | throw new TypeError("Cannot call a class as a function");
|
4458 | }
|
4459 | };
|
4460 | },{}],63:[function(require,module,exports){
|
4461 | "use strict";
|
4462 |
|
4463 | exports.__esModule = true;
|
4464 |
|
4465 | var _defineProperty = require("../core-js/object/define-property");
|
4466 |
|
4467 | var _defineProperty2 = _interopRequireDefault(_defineProperty);
|
4468 |
|
4469 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
4470 |
|
4471 | exports.default = function () {
|
4472 | function defineProperties(target, props) {
|
4473 | for (var i = 0; i < props.length; i++) {
|
4474 | var descriptor = props[i];
|
4475 | descriptor.enumerable = descriptor.enumerable || false;
|
4476 | descriptor.configurable = true;
|
4477 | if ("value" in descriptor) descriptor.writable = true;
|
4478 | (0, _defineProperty2.default)(target, descriptor.key, descriptor);
|
4479 | }
|
4480 | }
|
4481 |
|
4482 | return function (Constructor, protoProps, staticProps) {
|
4483 | if (protoProps) defineProperties(Constructor.prototype, protoProps);
|
4484 | if (staticProps) defineProperties(Constructor, staticProps);
|
4485 | return Constructor;
|
4486 | };
|
4487 | }();
|
4488 | },{"../core-js/object/define-property":51}],64:[function(require,module,exports){
|
4489 | "use strict";
|
4490 |
|
4491 | exports.__esModule = true;
|
4492 |
|
4493 | var _iterator = require("../core-js/symbol/iterator");
|
4494 |
|
4495 | var _iterator2 = _interopRequireDefault(_iterator);
|
4496 |
|
4497 | var _symbol = require("../core-js/symbol");
|
4498 |
|
4499 | var _symbol2 = _interopRequireDefault(_symbol);
|
4500 |
|
4501 | var _typeof = typeof _symbol2.default === "function" && typeof _iterator2.default === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof _symbol2.default === "function" && obj.constructor === _symbol2.default && obj !== _symbol2.default.prototype ? "symbol" : typeof obj; };
|
4502 |
|
4503 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
4504 |
|
4505 | exports.default = typeof _symbol2.default === "function" && _typeof(_iterator2.default) === "symbol" ? function (obj) {
|
4506 | return typeof obj === "undefined" ? "undefined" : _typeof(obj);
|
4507 | } : function (obj) {
|
4508 | return obj && typeof _symbol2.default === "function" && obj.constructor === _symbol2.default && obj !== _symbol2.default.prototype ? "symbol" : typeof obj === "undefined" ? "undefined" : _typeof(obj);
|
4509 | };
|
4510 | },{"../core-js/symbol":59,"../core-js/symbol/iterator":61}],65:[function(require,module,exports){
|
4511 | module.exports = require("regenerator-runtime");
|
4512 |
|
4513 | },{"regenerator-runtime":267}],66:[function(require,module,exports){
|
4514 | 'use strict'
|
4515 |
|
4516 | exports.byteLength = byteLength
|
4517 | exports.toByteArray = toByteArray
|
4518 | exports.fromByteArray = fromByteArray
|
4519 |
|
4520 | var lookup = []
|
4521 | var revLookup = []
|
4522 | var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array
|
4523 |
|
4524 | var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
|
4525 | for (var i = 0, len = code.length; i < len; ++i) {
|
4526 | lookup[i] = code[i]
|
4527 | revLookup[code.charCodeAt(i)] = i
|
4528 | }
|
4529 |
|
4530 |
|
4531 |
|
4532 | revLookup['-'.charCodeAt(0)] = 62
|
4533 | revLookup['_'.charCodeAt(0)] = 63
|
4534 |
|
4535 | function getLens (b64) {
|
4536 | var len = b64.length
|
4537 |
|
4538 | if (len % 4 > 0) {
|
4539 | throw new Error('Invalid string. Length must be a multiple of 4')
|
4540 | }
|
4541 |
|
4542 |
|
4543 |
|
4544 | var validLen = b64.indexOf('=')
|
4545 | if (validLen === -1) validLen = len
|
4546 |
|
4547 | var placeHoldersLen = validLen === len
|
4548 | ? 0
|
4549 | : 4 - (validLen % 4)
|
4550 |
|
4551 | return [validLen, placeHoldersLen]
|
4552 | }
|
4553 |
|
4554 |
|
4555 | function byteLength (b64) {
|
4556 | var lens = getLens(b64)
|
4557 | var validLen = lens[0]
|
4558 | var placeHoldersLen = lens[1]
|
4559 | return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
|
4560 | }
|
4561 |
|
4562 | function _byteLength (b64, validLen, placeHoldersLen) {
|
4563 | return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
|
4564 | }
|
4565 |
|
4566 | function toByteArray (b64) {
|
4567 | var tmp
|
4568 | var lens = getLens(b64)
|
4569 | var validLen = lens[0]
|
4570 | var placeHoldersLen = lens[1]
|
4571 |
|
4572 | var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))
|
4573 |
|
4574 | var curByte = 0
|
4575 |
|
4576 |
|
4577 | var len = placeHoldersLen > 0
|
4578 | ? validLen - 4
|
4579 | : validLen
|
4580 |
|
4581 | for (var i = 0; i < len; i += 4) {
|
4582 | tmp =
|
4583 | (revLookup[b64.charCodeAt(i)] << 18) |
|
4584 | (revLookup[b64.charCodeAt(i + 1)] << 12) |
|
4585 | (revLookup[b64.charCodeAt(i + 2)] << 6) |
|
4586 | revLookup[b64.charCodeAt(i + 3)]
|
4587 | arr[curByte++] = (tmp >> 16) & 0xFF
|
4588 | arr[curByte++] = (tmp >> 8) & 0xFF
|
4589 | arr[curByte++] = tmp & 0xFF
|
4590 | }
|
4591 |
|
4592 | if (placeHoldersLen === 2) {
|
4593 | tmp =
|
4594 | (revLookup[b64.charCodeAt(i)] << 2) |
|
4595 | (revLookup[b64.charCodeAt(i + 1)] >> 4)
|
4596 | arr[curByte++] = tmp & 0xFF
|
4597 | }
|
4598 |
|
4599 | if (placeHoldersLen === 1) {
|
4600 | tmp =
|
4601 | (revLookup[b64.charCodeAt(i)] << 10) |
|
4602 | (revLookup[b64.charCodeAt(i + 1)] << 4) |
|
4603 | (revLookup[b64.charCodeAt(i + 2)] >> 2)
|
4604 | arr[curByte++] = (tmp >> 8) & 0xFF
|
4605 | arr[curByte++] = tmp & 0xFF
|
4606 | }
|
4607 |
|
4608 | return arr
|
4609 | }
|
4610 |
|
4611 | function tripletToBase64 (num) {
|
4612 | return lookup[num >> 18 & 0x3F] +
|
4613 | lookup[num >> 12 & 0x3F] +
|
4614 | lookup[num >> 6 & 0x3F] +
|
4615 | lookup[num & 0x3F]
|
4616 | }
|
4617 |
|
4618 | function encodeChunk (uint8, start, end) {
|
4619 | var tmp
|
4620 | var output = []
|
4621 | for (var i = start; i < end; i += 3) {
|
4622 | tmp =
|
4623 | ((uint8[i] << 16) & 0xFF0000) +
|
4624 | ((uint8[i + 1] << 8) & 0xFF00) +
|
4625 | (uint8[i + 2] & 0xFF)
|
4626 | output.push(tripletToBase64(tmp))
|
4627 | }
|
4628 | return output.join('')
|
4629 | }
|
4630 |
|
4631 | function fromByteArray (uint8) {
|
4632 | var tmp
|
4633 | var len = uint8.length
|
4634 | var extraBytes = len % 3
|
4635 | var parts = []
|
4636 | var maxChunkLength = 16383
|
4637 |
|
4638 |
|
4639 | for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
|
4640 | parts.push(encodeChunk(
|
4641 | uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)
|
4642 | ))
|
4643 | }
|
4644 |
|
4645 |
|
4646 | if (extraBytes === 1) {
|
4647 | tmp = uint8[len - 1]
|
4648 | parts.push(
|
4649 | lookup[tmp >> 2] +
|
4650 | lookup[(tmp << 4) & 0x3F] +
|
4651 | '=='
|
4652 | )
|
4653 | } else if (extraBytes === 2) {
|
4654 | tmp = (uint8[len - 2] << 8) + uint8[len - 1]
|
4655 | parts.push(
|
4656 | lookup[tmp >> 10] +
|
4657 | lookup[(tmp >> 4) & 0x3F] +
|
4658 | lookup[(tmp << 2) & 0x3F] +
|
4659 | '='
|
4660 | )
|
4661 | }
|
4662 |
|
4663 | return parts.join('')
|
4664 | }
|
4665 |
|
4666 | },{}],67:[function(require,module,exports){
|
4667 |
|
4668 |
|
4669 |
|
4670 |
|
4671 |
|
4672 |
|
4673 | !function (root, name, definition) {
|
4674 | if (typeof module != 'undefined' && module.exports) module.exports = definition()
|
4675 | else if (typeof define == 'function' && define.amd) define(name, definition)
|
4676 | else root[name] = definition()
|
4677 | }(this, 'bowser', function () {
|
4678 | |
4679 |
|
4680 |
|
4681 |
|
4682 | var t = true
|
4683 |
|
4684 | function detect(ua) {
|
4685 |
|
4686 | function getFirstMatch(regex) {
|
4687 | var match = ua.match(regex);
|
4688 | return (match && match.length > 1 && match[1]) || '';
|
4689 | }
|
4690 |
|
4691 | function getSecondMatch(regex) {
|
4692 | var match = ua.match(regex);
|
4693 | return (match && match.length > 1 && match[2]) || '';
|
4694 | }
|
4695 |
|
4696 | var iosdevice = getFirstMatch(/(ipod|iphone|ipad)/i).toLowerCase()
|
4697 | , likeAndroid = /like android/i.test(ua)
|
4698 | , android = !likeAndroid && /android/i.test(ua)
|
4699 | , nexusMobile = /nexus\s*[0-6]\s*/i.test(ua)
|
4700 | , nexusTablet = !nexusMobile && /nexus\s*[0-9]+/i.test(ua)
|
4701 | , chromeos = /CrOS/.test(ua)
|
4702 | , silk = /silk/i.test(ua)
|
4703 | , sailfish = /sailfish/i.test(ua)
|
4704 | , tizen = /tizen/i.test(ua)
|
4705 | , webos = /(web|hpw)(o|0)s/i.test(ua)
|
4706 | , windowsphone = /windows phone/i.test(ua)
|
4707 | , samsungBrowser = /SamsungBrowser/i.test(ua)
|
4708 | , windows = !windowsphone && /windows/i.test(ua)
|
4709 | , mac = !iosdevice && !silk && /macintosh/i.test(ua)
|
4710 | , linux = !android && !sailfish && !tizen && !webos && /linux/i.test(ua)
|
4711 | , edgeVersion = getSecondMatch(/edg([ea]|ios)\/(\d+(\.\d+)?)/i)
|
4712 | , versionIdentifier = getFirstMatch(/version\/(\d+(\.\d+)?)/i)
|
4713 | , tablet = /tablet/i.test(ua) && !/tablet pc/i.test(ua)
|
4714 | , mobile = !tablet && /[^-]mobi/i.test(ua)
|
4715 | , xbox = /xbox/i.test(ua)
|
4716 | , result
|
4717 |
|
4718 | if (/opera/i.test(ua)) {
|
4719 |
|
4720 | result = {
|
4721 | name: 'Opera'
|
4722 | , opera: t
|
4723 | , version: versionIdentifier || getFirstMatch(/(?:opera|opr|opios)[\s\/](\d+(\.\d+)?)/i)
|
4724 | }
|
4725 | } else if (/opr\/|opios/i.test(ua)) {
|
4726 |
|
4727 | result = {
|
4728 | name: 'Opera'
|
4729 | , opera: t
|
4730 | , version: getFirstMatch(/(?:opr|opios)[\s\/](\d+(\.\d+)?)/i) || versionIdentifier
|
4731 | }
|
4732 | }
|
4733 | else if (/SamsungBrowser/i.test(ua)) {
|
4734 | result = {
|
4735 | name: 'Samsung Internet for Android'
|
4736 | , samsungBrowser: t
|
4737 | , version: versionIdentifier || getFirstMatch(/(?:SamsungBrowser)[\s\/](\d+(\.\d+)?)/i)
|
4738 | }
|
4739 | }
|
4740 | else if (/Whale/i.test(ua)) {
|
4741 | result = {
|
4742 | name: 'NAVER Whale browser'
|
4743 | , whale: t
|
4744 | , version: getFirstMatch(/(?:whale)[\s\/](\d+(?:\.\d+)+)/i)
|
4745 | }
|
4746 | }
|
4747 | else if (/MZBrowser/i.test(ua)) {
|
4748 | result = {
|
4749 | name: 'MZ Browser'
|
4750 | , mzbrowser: t
|
4751 | , version: getFirstMatch(/(?:MZBrowser)[\s\/](\d+(?:\.\d+)+)/i)
|
4752 | }
|
4753 | }
|
4754 | else if (/coast/i.test(ua)) {
|
4755 | result = {
|
4756 | name: 'Opera Coast'
|
4757 | , coast: t
|
4758 | , version: versionIdentifier || getFirstMatch(/(?:coast)[\s\/](\d+(\.\d+)?)/i)
|
4759 | }
|
4760 | }
|
4761 | else if (/focus/i.test(ua)) {
|
4762 | result = {
|
4763 | name: 'Focus'
|
4764 | , focus: t
|
4765 | , version: getFirstMatch(/(?:focus)[\s\/](\d+(?:\.\d+)+)/i)
|
4766 | }
|
4767 | }
|
4768 | else if (/yabrowser/i.test(ua)) {
|
4769 | result = {
|
4770 | name: 'Yandex Browser'
|
4771 | , yandexbrowser: t
|
4772 | , version: versionIdentifier || getFirstMatch(/(?:yabrowser)[\s\/](\d+(\.\d+)?)/i)
|
4773 | }
|
4774 | }
|
4775 | else if (/ucbrowser/i.test(ua)) {
|
4776 | result = {
|
4777 | name: 'UC Browser'
|
4778 | , ucbrowser: t
|
4779 | , version: getFirstMatch(/(?:ucbrowser)[\s\/](\d+(?:\.\d+)+)/i)
|
4780 | }
|
4781 | }
|
4782 | else if (/mxios/i.test(ua)) {
|
4783 | result = {
|
4784 | name: 'Maxthon'
|
4785 | , maxthon: t
|
4786 | , version: getFirstMatch(/(?:mxios)[\s\/](\d+(?:\.\d+)+)/i)
|
4787 | }
|
4788 | }
|
4789 | else if (/epiphany/i.test(ua)) {
|
4790 | result = {
|
4791 | name: 'Epiphany'
|
4792 | , epiphany: t
|
4793 | , version: getFirstMatch(/(?:epiphany)[\s\/](\d+(?:\.\d+)+)/i)
|
4794 | }
|
4795 | }
|
4796 | else if (/puffin/i.test(ua)) {
|
4797 | result = {
|
4798 | name: 'Puffin'
|
4799 | , puffin: t
|
4800 | , version: getFirstMatch(/(?:puffin)[\s\/](\d+(?:\.\d+)?)/i)
|
4801 | }
|
4802 | }
|
4803 | else if (/sleipnir/i.test(ua)) {
|
4804 | result = {
|
4805 | name: 'Sleipnir'
|
4806 | , sleipnir: t
|
4807 | , version: getFirstMatch(/(?:sleipnir)[\s\/](\d+(?:\.\d+)+)/i)
|
4808 | }
|
4809 | }
|
4810 | else if (/k-meleon/i.test(ua)) {
|
4811 | result = {
|
4812 | name: 'K-Meleon'
|
4813 | , kMeleon: t
|
4814 | , version: getFirstMatch(/(?:k-meleon)[\s\/](\d+(?:\.\d+)+)/i)
|
4815 | }
|
4816 | }
|
4817 | else if (windowsphone) {
|
4818 | result = {
|
4819 | name: 'Windows Phone'
|
4820 | , osname: 'Windows Phone'
|
4821 | , windowsphone: t
|
4822 | }
|
4823 | if (edgeVersion) {
|
4824 | result.msedge = t
|
4825 | result.version = edgeVersion
|
4826 | }
|
4827 | else {
|
4828 | result.msie = t
|
4829 | result.version = getFirstMatch(/iemobile\/(\d+(\.\d+)?)/i)
|
4830 | }
|
4831 | }
|
4832 | else if (/msie|trident/i.test(ua)) {
|
4833 | result = {
|
4834 | name: 'Internet Explorer'
|
4835 | , msie: t
|
4836 | , version: getFirstMatch(/(?:msie |rv:)(\d+(\.\d+)?)/i)
|
4837 | }
|
4838 | } else if (chromeos) {
|
4839 | result = {
|
4840 | name: 'Chrome'
|
4841 | , osname: 'Chrome OS'
|
4842 | , chromeos: t
|
4843 | , chromeBook: t
|
4844 | , chrome: t
|
4845 | , version: getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.\d+)?)/i)
|
4846 | }
|
4847 | } else if (/edg([ea]|ios)/i.test(ua)) {
|
4848 | result = {
|
4849 | name: 'Microsoft Edge'
|
4850 | , msedge: t
|
4851 | , version: edgeVersion
|
4852 | }
|
4853 | }
|
4854 | else if (/vivaldi/i.test(ua)) {
|
4855 | result = {
|
4856 | name: 'Vivaldi'
|
4857 | , vivaldi: t
|
4858 | , version: getFirstMatch(/vivaldi\/(\d+(\.\d+)?)/i) || versionIdentifier
|
4859 | }
|
4860 | }
|
4861 | else if (sailfish) {
|
4862 | result = {
|
4863 | name: 'Sailfish'
|
4864 | , osname: 'Sailfish OS'
|
4865 | , sailfish: t
|
4866 | , version: getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i)
|
4867 | }
|
4868 | }
|
4869 | else if (/seamonkey\//i.test(ua)) {
|
4870 | result = {
|
4871 | name: 'SeaMonkey'
|
4872 | , seamonkey: t
|
4873 | , version: getFirstMatch(/seamonkey\/(\d+(\.\d+)?)/i)
|
4874 | }
|
4875 | }
|
4876 | else if (/firefox|iceweasel|fxios/i.test(ua)) {
|
4877 | result = {
|
4878 | name: 'Firefox'
|
4879 | , firefox: t
|
4880 | , version: getFirstMatch(/(?:firefox|iceweasel|fxios)[ \/](\d+(\.\d+)?)/i)
|
4881 | }
|
4882 | if (/\((mobile|tablet);[^\)]*rv:[\d\.]+\)/i.test(ua)) {
|
4883 | result.firefoxos = t
|
4884 | result.osname = 'Firefox OS'
|
4885 | }
|
4886 | }
|
4887 | else if (silk) {
|
4888 | result = {
|
4889 | name: 'Amazon Silk'
|
4890 | , silk: t
|
4891 | , version : getFirstMatch(/silk\/(\d+(\.\d+)?)/i)
|
4892 | }
|
4893 | }
|
4894 | else if (/phantom/i.test(ua)) {
|
4895 | result = {
|
4896 | name: 'PhantomJS'
|
4897 | , phantom: t
|
4898 | , version: getFirstMatch(/phantomjs\/(\d+(\.\d+)?)/i)
|
4899 | }
|
4900 | }
|
4901 | else if (/slimerjs/i.test(ua)) {
|
4902 | result = {
|
4903 | name: 'SlimerJS'
|
4904 | , slimer: t
|
4905 | , version: getFirstMatch(/slimerjs\/(\d+(\.\d+)?)/i)
|
4906 | }
|
4907 | }
|
4908 | else if (/blackberry|\bbb\d+/i.test(ua) || /rim\stablet/i.test(ua)) {
|
4909 | result = {
|
4910 | name: 'BlackBerry'
|
4911 | , osname: 'BlackBerry OS'
|
4912 | , blackberry: t
|
4913 | , version: versionIdentifier || getFirstMatch(/blackberry[\d]+\/(\d+(\.\d+)?)/i)
|
4914 | }
|
4915 | }
|
4916 | else if (webos) {
|
4917 | result = {
|
4918 | name: 'WebOS'
|
4919 | , osname: 'WebOS'
|
4920 | , webos: t
|
4921 | , version: versionIdentifier || getFirstMatch(/w(?:eb)?osbrowser\/(\d+(\.\d+)?)/i)
|
4922 | };
|
4923 | /touchpad\
|
4924 | }
|
4925 | else if (/bada/i.test(ua)) {
|
4926 | result = {
|
4927 | name: 'Bada'
|
4928 | , osname: 'Bada'
|
4929 | , bada: t
|
4930 | , version: getFirstMatch(/dolfin\/(\d+(\.\d+)?)/i)
|
4931 | };
|
4932 | }
|
4933 | else if (tizen) {
|
4934 | result = {
|
4935 | name: 'Tizen'
|
4936 | , osname: 'Tizen'
|
4937 | , tizen: t
|
4938 | , version: getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.\d+)?)/i) || versionIdentifier
|
4939 | };
|
4940 | }
|
4941 | else if (/qupzilla/i.test(ua)) {
|
4942 | result = {
|
4943 | name: 'QupZilla'
|
4944 | , qupzilla: t
|
4945 | , version: getFirstMatch(/(?:qupzilla)[\s\/](\d+(?:\.\d+)+)/i) || versionIdentifier
|
4946 | }
|
4947 | }
|
4948 | else if (/chromium/i.test(ua)) {
|
4949 | result = {
|
4950 | name: 'Chromium'
|
4951 | , chromium: t
|
4952 | , version: getFirstMatch(/(?:chromium)[\s\/](\d+(?:\.\d+)?)/i) || versionIdentifier
|
4953 | }
|
4954 | }
|
4955 | else if (/chrome|crios|crmo/i.test(ua)) {
|
4956 | result = {
|
4957 | name: 'Chrome'
|
4958 | , chrome: t
|
4959 | , version: getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.\d+)?)/i)
|
4960 | }
|
4961 | }
|
4962 | else if (android) {
|
4963 | result = {
|
4964 | name: 'Android'
|
4965 | , version: versionIdentifier
|
4966 | }
|
4967 | }
|
4968 | else if (/safari|applewebkit/i.test(ua)) {
|
4969 | result = {
|
4970 | name: 'Safari'
|
4971 | , safari: t
|
4972 | }
|
4973 | if (versionIdentifier) {
|
4974 | result.version = versionIdentifier
|
4975 | }
|
4976 | }
|
4977 | else if (iosdevice) {
|
4978 | result = {
|
4979 | name : iosdevice == 'iphone' ? 'iPhone' : iosdevice == 'ipad' ? 'iPad' : 'iPod'
|
4980 | }
|
4981 |
|
4982 | if (versionIdentifier) {
|
4983 | result.version = versionIdentifier
|
4984 | }
|
4985 | }
|
4986 | else if(/googlebot/i.test(ua)) {
|
4987 | result = {
|
4988 | name: 'Googlebot'
|
4989 | , googlebot: t
|
4990 | , version: getFirstMatch(/googlebot\/(\d+(\.\d+))/i) || versionIdentifier
|
4991 | }
|
4992 | }
|
4993 | else {
|
4994 | result = {
|
4995 | name: getFirstMatch(/^(.*)\/(.*) /),
|
4996 | version: getSecondMatch(/^(.*)\/(.*) /)
|
4997 | };
|
4998 | }
|
4999 |
|
5000 |
|
5001 | if (!result.msedge && /(apple)?webkit/i.test(ua)) {
|
5002 | if (/(apple)?webkit\/537\.36/i.test(ua)) {
|
5003 | result.name = result.name || "Blink"
|
5004 | result.blink = t
|
5005 | } else {
|
5006 | result.name = result.name || "Webkit"
|
5007 | result.webkit = t
|
5008 | }
|
5009 | if (!result.version && versionIdentifier) {
|
5010 | result.version = versionIdentifier
|
5011 | }
|
5012 | } else if (!result.opera && /gecko\//i.test(ua)) {
|
5013 | result.name = result.name || "Gecko"
|
5014 | result.gecko = t
|
5015 | result.version = result.version || getFirstMatch(/gecko\/(\d+(\.\d+)?)/i)
|
5016 | }
|
5017 |
|
5018 |
|
5019 | if (!result.windowsphone && (android || result.silk)) {
|
5020 | result.android = t
|
5021 | result.osname = 'Android'
|
5022 | } else if (!result.windowsphone && iosdevice) {
|
5023 | result[iosdevice] = t
|
5024 | result.ios = t
|
5025 | result.osname = 'iOS'
|
5026 | } else if (mac) {
|
5027 | result.mac = t
|
5028 | result.osname = 'macOS'
|
5029 | } else if (xbox) {
|
5030 | result.xbox = t
|
5031 | result.osname = 'Xbox'
|
5032 | } else if (windows) {
|
5033 | result.windows = t
|
5034 | result.osname = 'Windows'
|
5035 | } else if (linux) {
|
5036 | result.linux = t
|
5037 | result.osname = 'Linux'
|
5038 | }
|
5039 |
|
5040 | function getWindowsVersion (s) {
|
5041 | switch (s) {
|
5042 | case 'NT': return 'NT'
|
5043 | case 'XP': return 'XP'
|
5044 | case 'NT 5.0': return '2000'
|
5045 | case 'NT 5.1': return 'XP'
|
5046 | case 'NT 5.2': return '2003'
|
5047 | case 'NT 6.0': return 'Vista'
|
5048 | case 'NT 6.1': return '7'
|
5049 | case 'NT 6.2': return '8'
|
5050 | case 'NT 6.3': return '8.1'
|
5051 | case 'NT 10.0': return '10'
|
5052 | default: return undefined
|
5053 | }
|
5054 | }
|
5055 |
|
5056 |
|
5057 | var osVersion = '';
|
5058 | if (result.windows) {
|
5059 | osVersion = getWindowsVersion(getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i))
|
5060 | } else if (result.windowsphone) {
|
5061 | osVersion = getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i);
|
5062 | } else if (result.mac) {
|
5063 | osVersion = getFirstMatch(/Mac OS X (\d+([_\.\s]\d+)*)/i);
|
5064 | osVersion = osVersion.replace(/[_\s]/g, '.');
|
5065 | } else if (iosdevice) {
|
5066 | osVersion = getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i);
|
5067 | osVersion = osVersion.replace(/[_\s]/g, '.');
|
5068 | } else if (android) {
|
5069 | osVersion = getFirstMatch(/android[ \/-](\d+(\.\d+)*)/i);
|
5070 | } else if (result.webos) {
|
5071 | osVersion = getFirstMatch(/(?:web|hpw)os\/(\d+(\.\d+)*)/i);
|
5072 | } else if (result.blackberry) {
|
5073 | osVersion = getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i);
|
5074 | } else if (result.bada) {
|
5075 | osVersion = getFirstMatch(/bada\/(\d+(\.\d+)*)/i);
|
5076 | } else if (result.tizen) {
|
5077 | osVersion = getFirstMatch(/tizen[\/\s](\d+(\.\d+)*)/i);
|
5078 | }
|
5079 | if (osVersion) {
|
5080 | result.osversion = osVersion;
|
5081 | }
|
5082 |
|
5083 |
|
5084 | var osMajorVersion = !result.windows && osVersion.split('.')[0];
|
5085 | if (
|
5086 | tablet
|
5087 | || nexusTablet
|
5088 | || iosdevice == 'ipad'
|
5089 | || (android && (osMajorVersion == 3 || (osMajorVersion >= 4 && !mobile)))
|
5090 | || result.silk
|
5091 | ) {
|
5092 | result.tablet = t
|
5093 | } else if (
|
5094 | mobile
|
5095 | || iosdevice == 'iphone'
|
5096 | || iosdevice == 'ipod'
|
5097 | || android
|
5098 | || nexusMobile
|
5099 | || result.blackberry
|
5100 | || result.webos
|
5101 | || result.bada
|
5102 | ) {
|
5103 | result.mobile = t
|
5104 | }
|
5105 |
|
5106 |
|
5107 |
|
5108 | if (result.msedge ||
|
5109 | (result.msie && result.version >= 10) ||
|
5110 | (result.yandexbrowser && result.version >= 15) ||
|
5111 | (result.vivaldi && result.version >= 1.0) ||
|
5112 | (result.chrome && result.version >= 20) ||
|
5113 | (result.samsungBrowser && result.version >= 4) ||
|
5114 | (result.whale && compareVersions([result.version, '1.0']) === 1) ||
|
5115 | (result.mzbrowser && compareVersions([result.version, '6.0']) === 1) ||
|
5116 | (result.focus && compareVersions([result.version, '1.0']) === 1) ||
|
5117 | (result.firefox && result.version >= 20.0) ||
|
5118 | (result.safari && result.version >= 6) ||
|
5119 | (result.opera && result.version >= 10.0) ||
|
5120 | (result.ios && result.osversion && result.osversion.split(".")[0] >= 6) ||
|
5121 | (result.blackberry && result.version >= 10.1)
|
5122 | || (result.chromium && result.version >= 20)
|
5123 | ) {
|
5124 | result.a = t;
|
5125 | }
|
5126 | else if ((result.msie && result.version < 10) ||
|
5127 | (result.chrome && result.version < 20) ||
|
5128 | (result.firefox && result.version < 20.0) ||
|
5129 | (result.safari && result.version < 6) ||
|
5130 | (result.opera && result.version < 10.0) ||
|
5131 | (result.ios && result.osversion && result.osversion.split(".")[0] < 6)
|
5132 | || (result.chromium && result.version < 20)
|
5133 | ) {
|
5134 | result.c = t
|
5135 | } else result.x = t
|
5136 |
|
5137 | return result
|
5138 | }
|
5139 |
|
5140 | var bowser = detect(typeof navigator !== 'undefined' ? navigator.userAgent || '' : '')
|
5141 |
|
5142 | bowser.test = function (browserList) {
|
5143 | for (var i = 0; i < browserList.length; ++i) {
|
5144 | var browserItem = browserList[i];
|
5145 | if (typeof browserItem=== 'string') {
|
5146 | if (browserItem in bowser) {
|
5147 | return true;
|
5148 | }
|
5149 | }
|
5150 | }
|
5151 | return false;
|
5152 | }
|
5153 |
|
5154 | |
5155 |
|
5156 |
|
5157 |
|
5158 |
|
5159 |
|
5160 |
|
5161 |
|
5162 |
|
5163 | function getVersionPrecision(version) {
|
5164 | return version.split(".").length;
|
5165 | }
|
5166 |
|
5167 | |
5168 |
|
5169 |
|
5170 |
|
5171 |
|
5172 |
|
5173 |
|
5174 | function map(arr, iterator) {
|
5175 | var result = [], i;
|
5176 | if (Array.prototype.map) {
|
5177 | return Array.prototype.map.call(arr, iterator);
|
5178 | }
|
5179 | for (i = 0; i < arr.length; i++) {
|
5180 | result.push(iterator(arr[i]));
|
5181 | }
|
5182 | return result;
|
5183 | }
|
5184 |
|
5185 | |
5186 |
|
5187 |
|
5188 |
|
5189 |
|
5190 |
|
5191 |
|
5192 |
|
5193 |
|
5194 |
|
5195 |
|
5196 |
|
5197 | function compareVersions(versions) {
|
5198 |
|
5199 | var precision = Math.max(getVersionPrecision(versions[0]), getVersionPrecision(versions[1]));
|
5200 | var chunks = map(versions, function (version) {
|
5201 | var delta = precision - getVersionPrecision(version);
|
5202 |
|
5203 |
|
5204 | version = version + new Array(delta + 1).join(".0");
|
5205 |
|
5206 |
|
5207 | return map(version.split("."), function (chunk) {
|
5208 | return new Array(20 - chunk.length).join("0") + chunk;
|
5209 | }).reverse();
|
5210 | });
|
5211 |
|
5212 |
|
5213 | while (--precision >= 0) {
|
5214 |
|
5215 | if (chunks[0][precision] > chunks[1][precision]) {
|
5216 | return 1;
|
5217 | }
|
5218 | else if (chunks[0][precision] === chunks[1][precision]) {
|
5219 | if (precision === 0) {
|
5220 |
|
5221 | return 0;
|
5222 | }
|
5223 | }
|
5224 | else {
|
5225 | return -1;
|
5226 | }
|
5227 | }
|
5228 | }
|
5229 |
|
5230 | |
5231 |
|
5232 |
|
5233 |
|
5234 |
|
5235 |
|
5236 |
|
5237 |
|
5238 |
|
5239 |
|
5240 |
|
5241 |
|
5242 |
|
5243 |
|
5244 |
|
5245 |
|
5246 |
|
5247 |
|
5248 | function isUnsupportedBrowser(minVersions, strictMode, ua) {
|
5249 | var _bowser = bowser;
|
5250 |
|
5251 |
|
5252 | if (typeof strictMode === 'string') {
|
5253 | ua = strictMode;
|
5254 | strictMode = void(0);
|
5255 | }
|
5256 |
|
5257 | if (strictMode === void(0)) {
|
5258 | strictMode = false;
|
5259 | }
|
5260 | if (ua) {
|
5261 | _bowser = detect(ua);
|
5262 | }
|
5263 |
|
5264 | var version = "" + _bowser.version;
|
5265 | for (var browser in minVersions) {
|
5266 | if (minVersions.hasOwnProperty(browser)) {
|
5267 | if (_bowser[browser]) {
|
5268 | if (typeof minVersions[browser] !== 'string') {
|
5269 | throw new Error('Browser version in the minVersion map should be a string: ' + browser + ': ' + String(minVersions));
|
5270 | }
|
5271 |
|
5272 |
|
5273 | return compareVersions([version, minVersions[browser]]) < 0;
|
5274 | }
|
5275 | }
|
5276 | }
|
5277 |
|
5278 | return strictMode;
|
5279 | }
|
5280 |
|
5281 | |
5282 |
|
5283 |
|
5284 |
|
5285 |
|
5286 |
|
5287 |
|
5288 |
|
5289 | function check(minVersions, strictMode, ua) {
|
5290 | return !isUnsupportedBrowser(minVersions, strictMode, ua);
|
5291 | }
|
5292 |
|
5293 | bowser.isUnsupportedBrowser = isUnsupportedBrowser;
|
5294 | bowser.compareVersions = compareVersions;
|
5295 | bowser.check = check;
|
5296 |
|
5297 | |
5298 |
|
5299 |
|
5300 |
|
5301 |
|
5302 | bowser._detect = detect;
|
5303 |
|
5304 | |
5305 |
|
5306 |
|
5307 |
|
5308 | bowser.detect = detect;
|
5309 | return bowser
|
5310 | });
|
5311 |
|
5312 | },{}],68:[function(require,module,exports){
|
5313 |
|
5314 | },{}],69:[function(require,module,exports){
|
5315 |
|
5316 |
|
5317 |
|
5318 |
|
5319 |
|
5320 |
|
5321 |
|
5322 |
|
5323 |
|
5324 |
|
5325 |
|
5326 |
|
5327 |
|
5328 |
|
5329 |
|
5330 |
|
5331 |
|
5332 |
|
5333 |
|
5334 |
|
5335 |
|
5336 | var Buffer = require('buffer').Buffer;
|
5337 |
|
5338 | var isBufferEncoding = Buffer.isEncoding
|
5339 | || function(encoding) {
|
5340 | switch (encoding && encoding.toLowerCase()) {
|
5341 | 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': return true;
|
5342 | default: return false;
|
5343 | }
|
5344 | }
|
5345 |
|
5346 |
|
5347 | function assertEncoding(encoding) {
|
5348 | if (encoding && !isBufferEncoding(encoding)) {
|
5349 | throw new Error('Unknown encoding: ' + encoding);
|
5350 | }
|
5351 | }
|
5352 |
|
5353 |
|
5354 |
|
5355 |
|
5356 |
|
5357 |
|
5358 |
|
5359 |
|
5360 |
|
5361 | var StringDecoder = exports.StringDecoder = function(encoding) {
|
5362 | this.encoding = (encoding || 'utf8').toLowerCase().replace(/[-_]/, '');
|
5363 | assertEncoding(encoding);
|
5364 | switch (this.encoding) {
|
5365 | case 'utf8':
|
5366 |
|
5367 | this.surrogateSize = 3;
|
5368 | break;
|
5369 | case 'ucs2':
|
5370 | case 'utf16le':
|
5371 |
|
5372 | this.surrogateSize = 2;
|
5373 | this.detectIncompleteChar = utf16DetectIncompleteChar;
|
5374 | break;
|
5375 | case 'base64':
|
5376 |
|
5377 | this.surrogateSize = 3;
|
5378 | this.detectIncompleteChar = base64DetectIncompleteChar;
|
5379 | break;
|
5380 | default:
|
5381 | this.write = passThroughWrite;
|
5382 | return;
|
5383 | }
|
5384 |
|
5385 |
|
5386 |
|
5387 | this.charBuffer = new Buffer(6);
|
5388 |
|
5389 | this.charReceived = 0;
|
5390 |
|
5391 | this.charLength = 0;
|
5392 | };
|
5393 |
|
5394 |
|
5395 |
|
5396 |
|
5397 |
|
5398 |
|
5399 |
|
5400 |
|
5401 |
|
5402 |
|
5403 |
|
5404 | StringDecoder.prototype.write = function(buffer) {
|
5405 | var charStr = '';
|
5406 |
|
5407 | while (this.charLength) {
|
5408 |
|
5409 | var available = (buffer.length >= this.charLength - this.charReceived) ?
|
5410 | this.charLength - this.charReceived :
|
5411 | buffer.length;
|
5412 |
|
5413 |
|
5414 | buffer.copy(this.charBuffer, this.charReceived, 0, available);
|
5415 | this.charReceived += available;
|
5416 |
|
5417 | if (this.charReceived < this.charLength) {
|
5418 |
|
5419 | return '';
|
5420 | }
|
5421 |
|
5422 |
|
5423 | buffer = buffer.slice(available, buffer.length);
|
5424 |
|
5425 |
|
5426 | charStr = this.charBuffer.slice(0, this.charLength).toString(this.encoding);
|
5427 |
|
5428 |
|
5429 | var charCode = charStr.charCodeAt(charStr.length - 1);
|
5430 | if (charCode >= 0xD800 && charCode <= 0xDBFF) {
|
5431 | this.charLength += this.surrogateSize;
|
5432 | charStr = '';
|
5433 | continue;
|
5434 | }
|
5435 | this.charReceived = this.charLength = 0;
|
5436 |
|
5437 |
|
5438 | if (buffer.length === 0) {
|
5439 | return charStr;
|
5440 | }
|
5441 | break;
|
5442 | }
|
5443 |
|
5444 |
|
5445 | this.detectIncompleteChar(buffer);
|
5446 |
|
5447 | var end = buffer.length;
|
5448 | if (this.charLength) {
|
5449 |
|
5450 | buffer.copy(this.charBuffer, 0, buffer.length - this.charReceived, end);
|
5451 | end -= this.charReceived;
|
5452 | }
|
5453 |
|
5454 | charStr += buffer.toString(this.encoding, 0, end);
|
5455 |
|
5456 | var end = charStr.length - 1;
|
5457 | var charCode = charStr.charCodeAt(end);
|
5458 |
|
5459 | if (charCode >= 0xD800 && charCode <= 0xDBFF) {
|
5460 | var size = this.surrogateSize;
|
5461 | this.charLength += size;
|
5462 | this.charReceived += size;
|
5463 | this.charBuffer.copy(this.charBuffer, size, 0, size);
|
5464 | buffer.copy(this.charBuffer, 0, 0, size);
|
5465 | return charStr.substring(0, end);
|
5466 | }
|
5467 |
|
5468 |
|
5469 | return charStr;
|
5470 | };
|
5471 |
|
5472 |
|
5473 |
|
5474 |
|
5475 |
|
5476 | StringDecoder.prototype.detectIncompleteChar = function(buffer) {
|
5477 |
|
5478 | var i = (buffer.length >= 3) ? 3 : buffer.length;
|
5479 |
|
5480 |
|
5481 |
|
5482 | for (; i > 0; i--) {
|
5483 | var c = buffer[buffer.length - i];
|
5484 |
|
5485 |
|
5486 |
|
5487 |
|
5488 | if (i == 1 && c >> 5 == 0x06) {
|
5489 | this.charLength = 2;
|
5490 | break;
|
5491 | }
|
5492 |
|
5493 |
|
5494 | if (i <= 2 && c >> 4 == 0x0E) {
|
5495 | this.charLength = 3;
|
5496 | break;
|
5497 | }
|
5498 |
|
5499 |
|
5500 | if (i <= 3 && c >> 3 == 0x1E) {
|
5501 | this.charLength = 4;
|
5502 | break;
|
5503 | }
|
5504 | }
|
5505 | this.charReceived = i;
|
5506 | };
|
5507 |
|
5508 | StringDecoder.prototype.end = function(buffer) {
|
5509 | var res = '';
|
5510 | if (buffer && buffer.length)
|
5511 | res = this.write(buffer);
|
5512 |
|
5513 | if (this.charReceived) {
|
5514 | var cr = this.charReceived;
|
5515 | var buf = this.charBuffer;
|
5516 | var enc = this.encoding;
|
5517 | res += buf.slice(0, cr).toString(enc);
|
5518 | }
|
5519 |
|
5520 | return res;
|
5521 | };
|
5522 |
|
5523 | function passThroughWrite(buffer) {
|
5524 | return buffer.toString(this.encoding);
|
5525 | }
|
5526 |
|
5527 | function utf16DetectIncompleteChar(buffer) {
|
5528 | this.charReceived = buffer.length % 2;
|
5529 | this.charLength = this.charReceived ? 2 : 0;
|
5530 | }
|
5531 |
|
5532 | function base64DetectIncompleteChar(buffer) {
|
5533 | this.charReceived = buffer.length % 3;
|
5534 | this.charLength = this.charReceived ? 3 : 0;
|
5535 | }
|
5536 |
|
5537 | },{"buffer":70}],70:[function(require,module,exports){
|
5538 | (function (global){
|
5539 |
|
5540 |
|
5541 |
|
5542 |
|
5543 |
|
5544 |
|
5545 |
|
5546 |
|
5547 | 'use strict'
|
5548 |
|
5549 | var base64 = require('base64-js')
|
5550 | var ieee754 = require('ieee754')
|
5551 | var isArray = require('isarray')
|
5552 |
|
5553 | exports.Buffer = Buffer
|
5554 | exports.SlowBuffer = SlowBuffer
|
5555 | exports.INSPECT_MAX_BYTES = 50
|
5556 |
|
5557 |
|
5558 |
|
5559 |
|
5560 |
|
5561 |
|
5562 |
|
5563 |
|
5564 |
|
5565 |
|
5566 |
|
5567 |
|
5568 |
|
5569 |
|
5570 |
|
5571 |
|
5572 |
|
5573 |
|
5574 |
|
5575 |
|
5576 |
|
5577 |
|
5578 |
|
5579 |
|
5580 |
|
5581 | Buffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined
|
5582 | ? global.TYPED_ARRAY_SUPPORT
|
5583 | : typedArraySupport()
|
5584 |
|
5585 |
|
5586 |
|
5587 |
|
5588 | exports.kMaxLength = kMaxLength()
|
5589 |
|
5590 | function typedArraySupport () {
|
5591 | try {
|
5592 | var arr = new Uint8Array(1)
|
5593 | arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}
|
5594 | return arr.foo() === 42 &&
|
5595 | typeof arr.subarray === 'function' &&
|
5596 | arr.subarray(1, 1).byteLength === 0
|
5597 | } catch (e) {
|
5598 | return false
|
5599 | }
|
5600 | }
|
5601 |
|
5602 | function kMaxLength () {
|
5603 | return Buffer.TYPED_ARRAY_SUPPORT
|
5604 | ? 0x7fffffff
|
5605 | : 0x3fffffff
|
5606 | }
|
5607 |
|
5608 | function createBuffer (that, length) {
|
5609 | if (kMaxLength() < length) {
|
5610 | throw new RangeError('Invalid typed array length')
|
5611 | }
|
5612 | if (Buffer.TYPED_ARRAY_SUPPORT) {
|
5613 |
|
5614 | that = new Uint8Array(length)
|
5615 | that.__proto__ = Buffer.prototype
|
5616 | } else {
|
5617 |
|
5618 | if (that === null) {
|
5619 | that = new Buffer(length)
|
5620 | }
|
5621 | that.length = length
|
5622 | }
|
5623 |
|
5624 | return that
|
5625 | }
|
5626 |
|
5627 |
|
5628 |
|
5629 |
|
5630 |
|
5631 |
|
5632 |
|
5633 |
|
5634 |
|
5635 |
|
5636 |
|
5637 | function Buffer (arg, encodingOrOffset, length) {
|
5638 | if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {
|
5639 | return new Buffer(arg, encodingOrOffset, length)
|
5640 | }
|
5641 |
|
5642 |
|
5643 | if (typeof arg === 'number') {
|
5644 | if (typeof encodingOrOffset === 'string') {
|
5645 | throw new Error(
|
5646 | 'If encoding is specified then the first argument must be a string'
|
5647 | )
|
5648 | }
|
5649 | return allocUnsafe(this, arg)
|
5650 | }
|
5651 | return from(this, arg, encodingOrOffset, length)
|
5652 | }
|
5653 |
|
5654 | Buffer.poolSize = 8192
|
5655 |
|
5656 |
|
5657 | Buffer._augment = function (arr) {
|
5658 | arr.__proto__ = Buffer.prototype
|
5659 | return arr
|
5660 | }
|
5661 |
|
5662 | function from (that, value, encodingOrOffset, length) {
|
5663 | if (typeof value === 'number') {
|
5664 | throw new TypeError('"value" argument must not be a number')
|
5665 | }
|
5666 |
|
5667 | if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {
|
5668 | return fromArrayBuffer(that, value, encodingOrOffset, length)
|
5669 | }
|
5670 |
|
5671 | if (typeof value === 'string') {
|
5672 | return fromString(that, value, encodingOrOffset)
|
5673 | }
|
5674 |
|
5675 | return fromObject(that, value)
|
5676 | }
|
5677 |
|
5678 |
|
5679 |
|
5680 |
|
5681 |
|
5682 |
|
5683 |
|
5684 |
|
5685 |
|
5686 | Buffer.from = function (value, encodingOrOffset, length) {
|
5687 | return from(null, value, encodingOrOffset, length)
|
5688 | }
|
5689 |
|
5690 | if (Buffer.TYPED_ARRAY_SUPPORT) {
|
5691 | Buffer.prototype.__proto__ = Uint8Array.prototype
|
5692 | Buffer.__proto__ = Uint8Array
|
5693 | if (typeof Symbol !== 'undefined' && Symbol.species &&
|
5694 | Buffer[Symbol.species] === Buffer) {
|
5695 |
|
5696 | Object.defineProperty(Buffer, Symbol.species, {
|
5697 | value: null,
|
5698 | configurable: true
|
5699 | })
|
5700 | }
|
5701 | }
|
5702 |
|
5703 | function assertSize (size) {
|
5704 | if (typeof size !== 'number') {
|
5705 | throw new TypeError('"size" argument must be a number')
|
5706 | } else if (size < 0) {
|
5707 | throw new RangeError('"size" argument must not be negative')
|
5708 | }
|
5709 | }
|
5710 |
|
5711 | function alloc (that, size, fill, encoding) {
|
5712 | assertSize(size)
|
5713 | if (size <= 0) {
|
5714 | return createBuffer(that, size)
|
5715 | }
|
5716 | if (fill !== undefined) {
|
5717 |
|
5718 |
|
5719 |
|
5720 | return typeof encoding === 'string'
|
5721 | ? createBuffer(that, size).fill(fill, encoding)
|
5722 | : createBuffer(that, size).fill(fill)
|
5723 | }
|
5724 | return createBuffer(that, size)
|
5725 | }
|
5726 |
|
5727 |
|
5728 |
|
5729 |
|
5730 |
|
5731 | Buffer.alloc = function (size, fill, encoding) {
|
5732 | return alloc(null, size, fill, encoding)
|
5733 | }
|
5734 |
|
5735 | function allocUnsafe (that, size) {
|
5736 | assertSize(size)
|
5737 | that = createBuffer(that, size < 0 ? 0 : checked(size) | 0)
|
5738 | if (!Buffer.TYPED_ARRAY_SUPPORT) {
|
5739 | for (var i = 0; i < size; ++i) {
|
5740 | that[i] = 0
|
5741 | }
|
5742 | }
|
5743 | return that
|
5744 | }
|
5745 |
|
5746 |
|
5747 |
|
5748 |
|
5749 | Buffer.allocUnsafe = function (size) {
|
5750 | return allocUnsafe(null, size)
|
5751 | }
|
5752 |
|
5753 |
|
5754 |
|
5755 | Buffer.allocUnsafeSlow = function (size) {
|
5756 | return allocUnsafe(null, size)
|
5757 | }
|
5758 |
|
5759 | function fromString (that, string, encoding) {
|
5760 | if (typeof encoding !== 'string' || encoding === '') {
|
5761 | encoding = 'utf8'
|
5762 | }
|
5763 |
|
5764 | if (!Buffer.isEncoding(encoding)) {
|
5765 | throw new TypeError('"encoding" must be a valid string encoding')
|
5766 | }
|
5767 |
|
5768 | var length = byteLength(string, encoding) | 0
|
5769 | that = createBuffer(that, length)
|
5770 |
|
5771 | var actual = that.write(string, encoding)
|
5772 |
|
5773 | if (actual !== length) {
|
5774 |
|
5775 |
|
5776 |
|
5777 | that = that.slice(0, actual)
|
5778 | }
|
5779 |
|
5780 | return that
|
5781 | }
|
5782 |
|
5783 | function fromArrayLike (that, array) {
|
5784 | var length = array.length < 0 ? 0 : checked(array.length) | 0
|
5785 | that = createBuffer(that, length)
|
5786 | for (var i = 0; i < length; i += 1) {
|
5787 | that[i] = array[i] & 255
|
5788 | }
|
5789 | return that
|
5790 | }
|
5791 |
|
5792 | function fromArrayBuffer (that, array, byteOffset, length) {
|
5793 | array.byteLength
|
5794 |
|
5795 | if (byteOffset < 0 || array.byteLength < byteOffset) {
|
5796 | throw new RangeError('\'offset\' is out of bounds')
|
5797 | }
|
5798 |
|
5799 | if (array.byteLength < byteOffset + (length || 0)) {
|
5800 | throw new RangeError('\'length\' is out of bounds')
|
5801 | }
|
5802 |
|
5803 | if (byteOffset === undefined && length === undefined) {
|
5804 | array = new Uint8Array(array)
|
5805 | } else if (length === undefined) {
|
5806 | array = new Uint8Array(array, byteOffset)
|
5807 | } else {
|
5808 | array = new Uint8Array(array, byteOffset, length)
|
5809 | }
|
5810 |
|
5811 | if (Buffer.TYPED_ARRAY_SUPPORT) {
|
5812 |
|
5813 | that = array
|
5814 | that.__proto__ = Buffer.prototype
|
5815 | } else {
|
5816 |
|
5817 | that = fromArrayLike(that, array)
|
5818 | }
|
5819 | return that
|
5820 | }
|
5821 |
|
5822 | function fromObject (that, obj) {
|
5823 | if (Buffer.isBuffer(obj)) {
|
5824 | var len = checked(obj.length) | 0
|
5825 | that = createBuffer(that, len)
|
5826 |
|
5827 | if (that.length === 0) {
|
5828 | return that
|
5829 | }
|
5830 |
|
5831 | obj.copy(that, 0, 0, len)
|
5832 | return that
|
5833 | }
|
5834 |
|
5835 | if (obj) {
|
5836 | if ((typeof ArrayBuffer !== 'undefined' &&
|
5837 | obj.buffer instanceof ArrayBuffer) || 'length' in obj) {
|
5838 | if (typeof obj.length !== 'number' || isnan(obj.length)) {
|
5839 | return createBuffer(that, 0)
|
5840 | }
|
5841 | return fromArrayLike(that, obj)
|
5842 | }
|
5843 |
|
5844 | if (obj.type === 'Buffer' && isArray(obj.data)) {
|
5845 | return fromArrayLike(that, obj.data)
|
5846 | }
|
5847 | }
|
5848 |
|
5849 | throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')
|
5850 | }
|
5851 |
|
5852 | function checked (length) {
|
5853 |
|
5854 |
|
5855 | if (length >= kMaxLength()) {
|
5856 | throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
|
5857 | 'size: 0x' + kMaxLength().toString(16) + ' bytes')
|
5858 | }
|
5859 | return length | 0
|
5860 | }
|
5861 |
|
5862 | function SlowBuffer (length) {
|
5863 | if (+length != length) {
|
5864 | length = 0
|
5865 | }
|
5866 | return Buffer.alloc(+length)
|
5867 | }
|
5868 |
|
5869 | Buffer.isBuffer = function isBuffer (b) {
|
5870 | return !!(b != null && b._isBuffer)
|
5871 | }
|
5872 |
|
5873 | Buffer.compare = function compare (a, b) {
|
5874 | if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
|
5875 | throw new TypeError('Arguments must be Buffers')
|
5876 | }
|
5877 |
|
5878 | if (a === b) return 0
|
5879 |
|
5880 | var x = a.length
|
5881 | var y = b.length
|
5882 |
|
5883 | for (var i = 0, len = Math.min(x, y); i < len; ++i) {
|
5884 | if (a[i] !== b[i]) {
|
5885 | x = a[i]
|
5886 | y = b[i]
|
5887 | break
|
5888 | }
|
5889 | }
|
5890 |
|
5891 | if (x < y) return -1
|
5892 | if (y < x) return 1
|
5893 | return 0
|
5894 | }
|
5895 |
|
5896 | Buffer.isEncoding = function isEncoding (encoding) {
|
5897 | switch (String(encoding).toLowerCase()) {
|
5898 | case 'hex':
|
5899 | case 'utf8':
|
5900 | case 'utf-8':
|
5901 | case 'ascii':
|
5902 | case 'latin1':
|
5903 | case 'binary':
|
5904 | case 'base64':
|
5905 | case 'ucs2':
|
5906 | case 'ucs-2':
|
5907 | case 'utf16le':
|
5908 | case 'utf-16le':
|
5909 | return true
|
5910 | default:
|
5911 | return false
|
5912 | }
|
5913 | }
|
5914 |
|
5915 | Buffer.concat = function concat (list, length) {
|
5916 | if (!isArray(list)) {
|
5917 | throw new TypeError('"list" argument must be an Array of Buffers')
|
5918 | }
|
5919 |
|
5920 | if (list.length === 0) {
|
5921 | return Buffer.alloc(0)
|
5922 | }
|
5923 |
|
5924 | var i
|
5925 | if (length === undefined) {
|
5926 | length = 0
|
5927 | for (i = 0; i < list.length; ++i) {
|
5928 | length += list[i].length
|
5929 | }
|
5930 | }
|
5931 |
|
5932 | var buffer = Buffer.allocUnsafe(length)
|
5933 | var pos = 0
|
5934 | for (i = 0; i < list.length; ++i) {
|
5935 | var buf = list[i]
|
5936 | if (!Buffer.isBuffer(buf)) {
|
5937 | throw new TypeError('"list" argument must be an Array of Buffers')
|
5938 | }
|
5939 | buf.copy(buffer, pos)
|
5940 | pos += buf.length
|
5941 | }
|
5942 | return buffer
|
5943 | }
|
5944 |
|
5945 | function byteLength (string, encoding) {
|
5946 | if (Buffer.isBuffer(string)) {
|
5947 | return string.length
|
5948 | }
|
5949 | if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&
|
5950 | (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {
|
5951 | return string.byteLength
|
5952 | }
|
5953 | if (typeof string !== 'string') {
|
5954 | string = '' + string
|
5955 | }
|
5956 |
|
5957 | var len = string.length
|
5958 | if (len === 0) return 0
|
5959 |
|
5960 |
|
5961 | var loweredCase = false
|
5962 | for (;;) {
|
5963 | switch (encoding) {
|
5964 | case 'ascii':
|
5965 | case 'latin1':
|
5966 | case 'binary':
|
5967 | return len
|
5968 | case 'utf8':
|
5969 | case 'utf-8':
|
5970 | case undefined:
|
5971 | return utf8ToBytes(string).length
|
5972 | case 'ucs2':
|
5973 | case 'ucs-2':
|
5974 | case 'utf16le':
|
5975 | case 'utf-16le':
|
5976 | return len * 2
|
5977 | case 'hex':
|
5978 | return len >>> 1
|
5979 | case 'base64':
|
5980 | return base64ToBytes(string).length
|
5981 | default:
|
5982 | if (loweredCase) return utf8ToBytes(string).length
|
5983 | encoding = ('' + encoding).toLowerCase()
|
5984 | loweredCase = true
|
5985 | }
|
5986 | }
|
5987 | }
|
5988 | Buffer.byteLength = byteLength
|
5989 |
|
5990 | function slowToString (encoding, start, end) {
|
5991 | var loweredCase = false
|
5992 |
|
5993 |
|
5994 |
|
5995 |
|
5996 |
|
5997 |
|
5998 |
|
5999 |
|
6000 | if (start === undefined || start < 0) {
|
6001 | start = 0
|
6002 | }
|
6003 |
|
6004 |
|
6005 | if (start > this.length) {
|
6006 | return ''
|
6007 | }
|
6008 |
|
6009 | if (end === undefined || end > this.length) {
|
6010 | end = this.length
|
6011 | }
|
6012 |
|
6013 | if (end <= 0) {
|
6014 | return ''
|
6015 | }
|
6016 |
|
6017 |
|
6018 | end >>>= 0
|
6019 | start >>>= 0
|
6020 |
|
6021 | if (end <= start) {
|
6022 | return ''
|
6023 | }
|
6024 |
|
6025 | if (!encoding) encoding = 'utf8'
|
6026 |
|
6027 | while (true) {
|
6028 | switch (encoding) {
|
6029 | case 'hex':
|
6030 | return hexSlice(this, start, end)
|
6031 |
|
6032 | case 'utf8':
|
6033 | case 'utf-8':
|
6034 | return utf8Slice(this, start, end)
|
6035 |
|
6036 | case 'ascii':
|
6037 | return asciiSlice(this, start, end)
|
6038 |
|
6039 | case 'latin1':
|
6040 | case 'binary':
|
6041 | return latin1Slice(this, start, end)
|
6042 |
|
6043 | case 'base64':
|
6044 | return base64Slice(this, start, end)
|
6045 |
|
6046 | case 'ucs2':
|
6047 | case 'ucs-2':
|
6048 | case 'utf16le':
|
6049 | case 'utf-16le':
|
6050 | return utf16leSlice(this, start, end)
|
6051 |
|
6052 | default:
|
6053 | if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
|
6054 | encoding = (encoding + '').toLowerCase()
|
6055 | loweredCase = true
|
6056 | }
|
6057 | }
|
6058 | }
|
6059 |
|
6060 |
|
6061 |
|
6062 | Buffer.prototype._isBuffer = true
|
6063 |
|
6064 | function swap (b, n, m) {
|
6065 | var i = b[n]
|
6066 | b[n] = b[m]
|
6067 | b[m] = i
|
6068 | }
|
6069 |
|
6070 | Buffer.prototype.swap16 = function swap16 () {
|
6071 | var len = this.length
|
6072 | if (len % 2 !== 0) {
|
6073 | throw new RangeError('Buffer size must be a multiple of 16-bits')
|
6074 | }
|
6075 | for (var i = 0; i < len; i += 2) {
|
6076 | swap(this, i, i + 1)
|
6077 | }
|
6078 | return this
|
6079 | }
|
6080 |
|
6081 | Buffer.prototype.swap32 = function swap32 () {
|
6082 | var len = this.length
|
6083 | if (len % 4 !== 0) {
|
6084 | throw new RangeError('Buffer size must be a multiple of 32-bits')
|
6085 | }
|
6086 | for (var i = 0; i < len; i += 4) {
|
6087 | swap(this, i, i + 3)
|
6088 | swap(this, i + 1, i + 2)
|
6089 | }
|
6090 | return this
|
6091 | }
|
6092 |
|
6093 | Buffer.prototype.swap64 = function swap64 () {
|
6094 | var len = this.length
|
6095 | if (len % 8 !== 0) {
|
6096 | throw new RangeError('Buffer size must be a multiple of 64-bits')
|
6097 | }
|
6098 | for (var i = 0; i < len; i += 8) {
|
6099 | swap(this, i, i + 7)
|
6100 | swap(this, i + 1, i + 6)
|
6101 | swap(this, i + 2, i + 5)
|
6102 | swap(this, i + 3, i + 4)
|
6103 | }
|
6104 | return this
|
6105 | }
|
6106 |
|
6107 | Buffer.prototype.toString = function toString () {
|
6108 | var length = this.length | 0
|
6109 | if (length === 0) return ''
|
6110 | if (arguments.length === 0) return utf8Slice(this, 0, length)
|
6111 | return slowToString.apply(this, arguments)
|
6112 | }
|
6113 |
|
6114 | Buffer.prototype.equals = function equals (b) {
|
6115 | if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
|
6116 | if (this === b) return true
|
6117 | return Buffer.compare(this, b) === 0
|
6118 | }
|
6119 |
|
6120 | Buffer.prototype.inspect = function inspect () {
|
6121 | var str = ''
|
6122 | var max = exports.INSPECT_MAX_BYTES
|
6123 | if (this.length > 0) {
|
6124 | str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')
|
6125 | if (this.length > max) str += ' ... '
|
6126 | }
|
6127 | return '<Buffer ' + str + '>'
|
6128 | }
|
6129 |
|
6130 | Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
|
6131 | if (!Buffer.isBuffer(target)) {
|
6132 | throw new TypeError('Argument must be a Buffer')
|
6133 | }
|
6134 |
|
6135 | if (start === undefined) {
|
6136 | start = 0
|
6137 | }
|
6138 | if (end === undefined) {
|
6139 | end = target ? target.length : 0
|
6140 | }
|
6141 | if (thisStart === undefined) {
|
6142 | thisStart = 0
|
6143 | }
|
6144 | if (thisEnd === undefined) {
|
6145 | thisEnd = this.length
|
6146 | }
|
6147 |
|
6148 | if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
|
6149 | throw new RangeError('out of range index')
|
6150 | }
|
6151 |
|
6152 | if (thisStart >= thisEnd && start >= end) {
|
6153 | return 0
|
6154 | }
|
6155 | if (thisStart >= thisEnd) {
|
6156 | return -1
|
6157 | }
|
6158 | if (start >= end) {
|
6159 | return 1
|
6160 | }
|
6161 |
|
6162 | start >>>= 0
|
6163 | end >>>= 0
|
6164 | thisStart >>>= 0
|
6165 | thisEnd >>>= 0
|
6166 |
|
6167 | if (this === target) return 0
|
6168 |
|
6169 | var x = thisEnd - thisStart
|
6170 | var y = end - start
|
6171 | var len = Math.min(x, y)
|
6172 |
|
6173 | var thisCopy = this.slice(thisStart, thisEnd)
|
6174 | var targetCopy = target.slice(start, end)
|
6175 |
|
6176 | for (var i = 0; i < len; ++i) {
|
6177 | if (thisCopy[i] !== targetCopy[i]) {
|
6178 | x = thisCopy[i]
|
6179 | y = targetCopy[i]
|
6180 | break
|
6181 | }
|
6182 | }
|
6183 |
|
6184 | if (x < y) return -1
|
6185 | if (y < x) return 1
|
6186 | return 0
|
6187 | }
|
6188 |
|
6189 |
|
6190 |
|
6191 |
|
6192 |
|
6193 |
|
6194 |
|
6195 |
|
6196 |
|
6197 |
|
6198 | function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
|
6199 |
|
6200 | if (buffer.length === 0) return -1
|
6201 |
|
6202 |
|
6203 | if (typeof byteOffset === 'string') {
|
6204 | encoding = byteOffset
|
6205 | byteOffset = 0
|
6206 | } else if (byteOffset > 0x7fffffff) {
|
6207 | byteOffset = 0x7fffffff
|
6208 | } else if (byteOffset < -0x80000000) {
|
6209 | byteOffset = -0x80000000
|
6210 | }
|
6211 | byteOffset = +byteOffset
|
6212 | if (isNaN(byteOffset)) {
|
6213 |
|
6214 | byteOffset = dir ? 0 : (buffer.length - 1)
|
6215 | }
|
6216 |
|
6217 |
|
6218 | if (byteOffset < 0) byteOffset = buffer.length + byteOffset
|
6219 | if (byteOffset >= buffer.length) {
|
6220 | if (dir) return -1
|
6221 | else byteOffset = buffer.length - 1
|
6222 | } else if (byteOffset < 0) {
|
6223 | if (dir) byteOffset = 0
|
6224 | else return -1
|
6225 | }
|
6226 |
|
6227 |
|
6228 | if (typeof val === 'string') {
|
6229 | val = Buffer.from(val, encoding)
|
6230 | }
|
6231 |
|
6232 |
|
6233 | if (Buffer.isBuffer(val)) {
|
6234 |
|
6235 | if (val.length === 0) {
|
6236 | return -1
|
6237 | }
|
6238 | return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
|
6239 | } else if (typeof val === 'number') {
|
6240 | val = val & 0xFF
|
6241 | if (Buffer.TYPED_ARRAY_SUPPORT &&
|
6242 | typeof Uint8Array.prototype.indexOf === 'function') {
|
6243 | if (dir) {
|
6244 | return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
|
6245 | } else {
|
6246 | return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
|
6247 | }
|
6248 | }
|
6249 | return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)
|
6250 | }
|
6251 |
|
6252 | throw new TypeError('val must be string, number or Buffer')
|
6253 | }
|
6254 |
|
6255 | function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
|
6256 | var indexSize = 1
|
6257 | var arrLength = arr.length
|
6258 | var valLength = val.length
|
6259 |
|
6260 | if (encoding !== undefined) {
|
6261 | encoding = String(encoding).toLowerCase()
|
6262 | if (encoding === 'ucs2' || encoding === 'ucs-2' ||
|
6263 | encoding === 'utf16le' || encoding === 'utf-16le') {
|
6264 | if (arr.length < 2 || val.length < 2) {
|
6265 | return -1
|
6266 | }
|
6267 | indexSize = 2
|
6268 | arrLength /= 2
|
6269 | valLength /= 2
|
6270 | byteOffset /= 2
|
6271 | }
|
6272 | }
|
6273 |
|
6274 | function read (buf, i) {
|
6275 | if (indexSize === 1) {
|
6276 | return buf[i]
|
6277 | } else {
|
6278 | return buf.readUInt16BE(i * indexSize)
|
6279 | }
|
6280 | }
|
6281 |
|
6282 | var i
|
6283 | if (dir) {
|
6284 | var foundIndex = -1
|
6285 | for (i = byteOffset; i < arrLength; i++) {
|
6286 | if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
|
6287 | if (foundIndex === -1) foundIndex = i
|
6288 | if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
|
6289 | } else {
|
6290 | if (foundIndex !== -1) i -= i - foundIndex
|
6291 | foundIndex = -1
|
6292 | }
|
6293 | }
|
6294 | } else {
|
6295 | if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength
|
6296 | for (i = byteOffset; i >= 0; i--) {
|
6297 | var found = true
|
6298 | for (var j = 0; j < valLength; j++) {
|
6299 | if (read(arr, i + j) !== read(val, j)) {
|
6300 | found = false
|
6301 | break
|
6302 | }
|
6303 | }
|
6304 | if (found) return i
|
6305 | }
|
6306 | }
|
6307 |
|
6308 | return -1
|
6309 | }
|
6310 |
|
6311 | Buffer.prototype.includes = function includes (val, byteOffset, encoding) {
|
6312 | return this.indexOf(val, byteOffset, encoding) !== -1
|
6313 | }
|
6314 |
|
6315 | Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {
|
6316 | return bidirectionalIndexOf(this, val, byteOffset, encoding, true)
|
6317 | }
|
6318 |
|
6319 | Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {
|
6320 | return bidirectionalIndexOf(this, val, byteOffset, encoding, false)
|
6321 | }
|
6322 |
|
6323 | function hexWrite (buf, string, offset, length) {
|
6324 | offset = Number(offset) || 0
|
6325 | var remaining = buf.length - offset
|
6326 | if (!length) {
|
6327 | length = remaining
|
6328 | } else {
|
6329 | length = Number(length)
|
6330 | if (length > remaining) {
|
6331 | length = remaining
|
6332 | }
|
6333 | }
|
6334 |
|
6335 |
|
6336 | var strLen = string.length
|
6337 | if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')
|
6338 |
|
6339 | if (length > strLen / 2) {
|
6340 | length = strLen / 2
|
6341 | }
|
6342 | for (var i = 0; i < length; ++i) {
|
6343 | var parsed = parseInt(string.substr(i * 2, 2), 16)
|
6344 | if (isNaN(parsed)) return i
|
6345 | buf[offset + i] = parsed
|
6346 | }
|
6347 | return i
|
6348 | }
|
6349 |
|
6350 | function utf8Write (buf, string, offset, length) {
|
6351 | return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
|
6352 | }
|
6353 |
|
6354 | function asciiWrite (buf, string, offset, length) {
|
6355 | return blitBuffer(asciiToBytes(string), buf, offset, length)
|
6356 | }
|
6357 |
|
6358 | function latin1Write (buf, string, offset, length) {
|
6359 | return asciiWrite(buf, string, offset, length)
|
6360 | }
|
6361 |
|
6362 | function base64Write (buf, string, offset, length) {
|
6363 | return blitBuffer(base64ToBytes(string), buf, offset, length)
|
6364 | }
|
6365 |
|
6366 | function ucs2Write (buf, string, offset, length) {
|
6367 | return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
|
6368 | }
|
6369 |
|
6370 | Buffer.prototype.write = function write (string, offset, length, encoding) {
|
6371 |
|
6372 | if (offset === undefined) {
|
6373 | encoding = 'utf8'
|
6374 | length = this.length
|
6375 | offset = 0
|
6376 |
|
6377 | } else if (length === undefined && typeof offset === 'string') {
|
6378 | encoding = offset
|
6379 | length = this.length
|
6380 | offset = 0
|
6381 |
|
6382 | } else if (isFinite(offset)) {
|
6383 | offset = offset | 0
|
6384 | if (isFinite(length)) {
|
6385 | length = length | 0
|
6386 | if (encoding === undefined) encoding = 'utf8'
|
6387 | } else {
|
6388 | encoding = length
|
6389 | length = undefined
|
6390 | }
|
6391 |
|
6392 | } else {
|
6393 | throw new Error(
|
6394 | 'Buffer.write(string, encoding, offset[, length]) is no longer supported'
|
6395 | )
|
6396 | }
|
6397 |
|
6398 | var remaining = this.length - offset
|
6399 | if (length === undefined || length > remaining) length = remaining
|
6400 |
|
6401 | if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
|
6402 | throw new RangeError('Attempt to write outside buffer bounds')
|
6403 | }
|
6404 |
|
6405 | if (!encoding) encoding = 'utf8'
|
6406 |
|
6407 | var loweredCase = false
|
6408 | for (;;) {
|
6409 | switch (encoding) {
|
6410 | case 'hex':
|
6411 | return hexWrite(this, string, offset, length)
|
6412 |
|
6413 | case 'utf8':
|
6414 | case 'utf-8':
|
6415 | return utf8Write(this, string, offset, length)
|
6416 |
|
6417 | case 'ascii':
|
6418 | return asciiWrite(this, string, offset, length)
|
6419 |
|
6420 | case 'latin1':
|
6421 | case 'binary':
|
6422 | return latin1Write(this, string, offset, length)
|
6423 |
|
6424 | case 'base64':
|
6425 |
|
6426 | return base64Write(this, string, offset, length)
|
6427 |
|
6428 | case 'ucs2':
|
6429 | case 'ucs-2':
|
6430 | case 'utf16le':
|
6431 | case 'utf-16le':
|
6432 | return ucs2Write(this, string, offset, length)
|
6433 |
|
6434 | default:
|
6435 | if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
|
6436 | encoding = ('' + encoding).toLowerCase()
|
6437 | loweredCase = true
|
6438 | }
|
6439 | }
|
6440 | }
|
6441 |
|
6442 | Buffer.prototype.toJSON = function toJSON () {
|
6443 | return {
|
6444 | type: 'Buffer',
|
6445 | data: Array.prototype.slice.call(this._arr || this, 0)
|
6446 | }
|
6447 | }
|
6448 |
|
6449 | function base64Slice (buf, start, end) {
|
6450 | if (start === 0 && end === buf.length) {
|
6451 | return base64.fromByteArray(buf)
|
6452 | } else {
|
6453 | return base64.fromByteArray(buf.slice(start, end))
|
6454 | }
|
6455 | }
|
6456 |
|
6457 | function utf8Slice (buf, start, end) {
|
6458 | end = Math.min(buf.length, end)
|
6459 | var res = []
|
6460 |
|
6461 | var i = start
|
6462 | while (i < end) {
|
6463 | var firstByte = buf[i]
|
6464 | var codePoint = null
|
6465 | var bytesPerSequence = (firstByte > 0xEF) ? 4
|
6466 | : (firstByte > 0xDF) ? 3
|
6467 | : (firstByte > 0xBF) ? 2
|
6468 | : 1
|
6469 |
|
6470 | if (i + bytesPerSequence <= end) {
|
6471 | var secondByte, thirdByte, fourthByte, tempCodePoint
|
6472 |
|
6473 | switch (bytesPerSequence) {
|
6474 | case 1:
|
6475 | if (firstByte < 0x80) {
|
6476 | codePoint = firstByte
|
6477 | }
|
6478 | break
|
6479 | case 2:
|
6480 | secondByte = buf[i + 1]
|
6481 | if ((secondByte & 0xC0) === 0x80) {
|
6482 | tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)
|
6483 | if (tempCodePoint > 0x7F) {
|
6484 | codePoint = tempCodePoint
|
6485 | }
|
6486 | }
|
6487 | break
|
6488 | case 3:
|
6489 | secondByte = buf[i + 1]
|
6490 | thirdByte = buf[i + 2]
|
6491 | if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
|
6492 | tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)
|
6493 | if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
|
6494 | codePoint = tempCodePoint
|
6495 | }
|
6496 | }
|
6497 | break
|
6498 | case 4:
|
6499 | secondByte = buf[i + 1]
|
6500 | thirdByte = buf[i + 2]
|
6501 | fourthByte = buf[i + 3]
|
6502 | if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
|
6503 | tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)
|
6504 | if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
|
6505 | codePoint = tempCodePoint
|
6506 | }
|
6507 | }
|
6508 | }
|
6509 | }
|
6510 |
|
6511 | if (codePoint === null) {
|
6512 |
|
6513 |
|
6514 | codePoint = 0xFFFD
|
6515 | bytesPerSequence = 1
|
6516 | } else if (codePoint > 0xFFFF) {
|
6517 |
|
6518 | codePoint -= 0x10000
|
6519 | res.push(codePoint >>> 10 & 0x3FF | 0xD800)
|
6520 | codePoint = 0xDC00 | codePoint & 0x3FF
|
6521 | }
|
6522 |
|
6523 | res.push(codePoint)
|
6524 | i += bytesPerSequence
|
6525 | }
|
6526 |
|
6527 | return decodeCodePointsArray(res)
|
6528 | }
|
6529 |
|
6530 |
|
6531 |
|
6532 |
|
6533 | var MAX_ARGUMENTS_LENGTH = 0x1000
|
6534 |
|
6535 | function decodeCodePointsArray (codePoints) {
|
6536 | var len = codePoints.length
|
6537 | if (len <= MAX_ARGUMENTS_LENGTH) {
|
6538 | return String.fromCharCode.apply(String, codePoints)
|
6539 | }
|
6540 |
|
6541 |
|
6542 | var res = ''
|
6543 | var i = 0
|
6544 | while (i < len) {
|
6545 | res += String.fromCharCode.apply(
|
6546 | String,
|
6547 | codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
|
6548 | )
|
6549 | }
|
6550 | return res
|
6551 | }
|
6552 |
|
6553 | function asciiSlice (buf, start, end) {
|
6554 | var ret = ''
|
6555 | end = Math.min(buf.length, end)
|
6556 |
|
6557 | for (var i = start; i < end; ++i) {
|
6558 | ret += String.fromCharCode(buf[i] & 0x7F)
|
6559 | }
|
6560 | return ret
|
6561 | }
|
6562 |
|
6563 | function latin1Slice (buf, start, end) {
|
6564 | var ret = ''
|
6565 | end = Math.min(buf.length, end)
|
6566 |
|
6567 | for (var i = start; i < end; ++i) {
|
6568 | ret += String.fromCharCode(buf[i])
|
6569 | }
|
6570 | return ret
|
6571 | }
|
6572 |
|
6573 | function hexSlice (buf, start, end) {
|
6574 | var len = buf.length
|
6575 |
|
6576 | if (!start || start < 0) start = 0
|
6577 | if (!end || end < 0 || end > len) end = len
|
6578 |
|
6579 | var out = ''
|
6580 | for (var i = start; i < end; ++i) {
|
6581 | out += toHex(buf[i])
|
6582 | }
|
6583 | return out
|
6584 | }
|
6585 |
|
6586 | function utf16leSlice (buf, start, end) {
|
6587 | var bytes = buf.slice(start, end)
|
6588 | var res = ''
|
6589 | for (var i = 0; i < bytes.length; i += 2) {
|
6590 | res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)
|
6591 | }
|
6592 | return res
|
6593 | }
|
6594 |
|
6595 | Buffer.prototype.slice = function slice (start, end) {
|
6596 | var len = this.length
|
6597 | start = ~~start
|
6598 | end = end === undefined ? len : ~~end
|
6599 |
|
6600 | if (start < 0) {
|
6601 | start += len
|
6602 | if (start < 0) start = 0
|
6603 | } else if (start > len) {
|
6604 | start = len
|
6605 | }
|
6606 |
|
6607 | if (end < 0) {
|
6608 | end += len
|
6609 | if (end < 0) end = 0
|
6610 | } else if (end > len) {
|
6611 | end = len
|
6612 | }
|
6613 |
|
6614 | if (end < start) end = start
|
6615 |
|
6616 | var newBuf
|
6617 | if (Buffer.TYPED_ARRAY_SUPPORT) {
|
6618 | newBuf = this.subarray(start, end)
|
6619 | newBuf.__proto__ = Buffer.prototype
|
6620 | } else {
|
6621 | var sliceLen = end - start
|
6622 | newBuf = new Buffer(sliceLen, undefined)
|
6623 | for (var i = 0; i < sliceLen; ++i) {
|
6624 | newBuf[i] = this[i + start]
|
6625 | }
|
6626 | }
|
6627 |
|
6628 | return newBuf
|
6629 | }
|
6630 |
|
6631 |
|
6632 |
|
6633 |
|
6634 | function checkOffset (offset, ext, length) {
|
6635 | if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
|
6636 | if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
|
6637 | }
|
6638 |
|
6639 | Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
|
6640 | offset = offset | 0
|
6641 | byteLength = byteLength | 0
|
6642 | if (!noAssert) checkOffset(offset, byteLength, this.length)
|
6643 |
|
6644 | var val = this[offset]
|
6645 | var mul = 1
|
6646 | var i = 0
|
6647 | while (++i < byteLength && (mul *= 0x100)) {
|
6648 | val += this[offset + i] * mul
|
6649 | }
|
6650 |
|
6651 | return val
|
6652 | }
|
6653 |
|
6654 | Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
|
6655 | offset = offset | 0
|
6656 | byteLength = byteLength | 0
|
6657 | if (!noAssert) {
|
6658 | checkOffset(offset, byteLength, this.length)
|
6659 | }
|
6660 |
|
6661 | var val = this[offset + --byteLength]
|
6662 | var mul = 1
|
6663 | while (byteLength > 0 && (mul *= 0x100)) {
|
6664 | val += this[offset + --byteLength] * mul
|
6665 | }
|
6666 |
|
6667 | return val
|
6668 | }
|
6669 |
|
6670 | Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
|
6671 | if (!noAssert) checkOffset(offset, 1, this.length)
|
6672 | return this[offset]
|
6673 | }
|
6674 |
|
6675 | Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
|
6676 | if (!noAssert) checkOffset(offset, 2, this.length)
|
6677 | return this[offset] | (this[offset + 1] << 8)
|
6678 | }
|
6679 |
|
6680 | Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
|
6681 | if (!noAssert) checkOffset(offset, 2, this.length)
|
6682 | return (this[offset] << 8) | this[offset + 1]
|
6683 | }
|
6684 |
|
6685 | Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
|
6686 | if (!noAssert) checkOffset(offset, 4, this.length)
|
6687 |
|
6688 | return ((this[offset]) |
|
6689 | (this[offset + 1] << 8) |
|
6690 | (this[offset + 2] << 16)) +
|
6691 | (this[offset + 3] * 0x1000000)
|
6692 | }
|
6693 |
|
6694 | Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
|
6695 | if (!noAssert) checkOffset(offset, 4, this.length)
|
6696 |
|
6697 | return (this[offset] * 0x1000000) +
|
6698 | ((this[offset + 1] << 16) |
|
6699 | (this[offset + 2] << 8) |
|
6700 | this[offset + 3])
|
6701 | }
|
6702 |
|
6703 | Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
|
6704 | offset = offset | 0
|
6705 | byteLength = byteLength | 0
|
6706 | if (!noAssert) checkOffset(offset, byteLength, this.length)
|
6707 |
|
6708 | var val = this[offset]
|
6709 | var mul = 1
|
6710 | var i = 0
|
6711 | while (++i < byteLength && (mul *= 0x100)) {
|
6712 | val += this[offset + i] * mul
|
6713 | }
|
6714 | mul *= 0x80
|
6715 |
|
6716 | if (val >= mul) val -= Math.pow(2, 8 * byteLength)
|
6717 |
|
6718 | return val
|
6719 | }
|
6720 |
|
6721 | Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
|
6722 | offset = offset | 0
|
6723 | byteLength = byteLength | 0
|
6724 | if (!noAssert) checkOffset(offset, byteLength, this.length)
|
6725 |
|
6726 | var i = byteLength
|
6727 | var mul = 1
|
6728 | var val = this[offset + --i]
|
6729 | while (i > 0 && (mul *= 0x100)) {
|
6730 | val += this[offset + --i] * mul
|
6731 | }
|
6732 | mul *= 0x80
|
6733 |
|
6734 | if (val >= mul) val -= Math.pow(2, 8 * byteLength)
|
6735 |
|
6736 | return val
|
6737 | }
|
6738 |
|
6739 | Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
|
6740 | if (!noAssert) checkOffset(offset, 1, this.length)
|
6741 | if (!(this[offset] & 0x80)) return (this[offset])
|
6742 | return ((0xff - this[offset] + 1) * -1)
|
6743 | }
|
6744 |
|
6745 | Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
|
6746 | if (!noAssert) checkOffset(offset, 2, this.length)
|
6747 | var val = this[offset] | (this[offset + 1] << 8)
|
6748 | return (val & 0x8000) ? val | 0xFFFF0000 : val
|
6749 | }
|
6750 |
|
6751 | Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
|
6752 | if (!noAssert) checkOffset(offset, 2, this.length)
|
6753 | var val = this[offset + 1] | (this[offset] << 8)
|
6754 | return (val & 0x8000) ? val | 0xFFFF0000 : val
|
6755 | }
|
6756 |
|
6757 | Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
|
6758 | if (!noAssert) checkOffset(offset, 4, this.length)
|
6759 |
|
6760 | return (this[offset]) |
|
6761 | (this[offset + 1] << 8) |
|
6762 | (this[offset + 2] << 16) |
|
6763 | (this[offset + 3] << 24)
|
6764 | }
|
6765 |
|
6766 | Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
|
6767 | if (!noAssert) checkOffset(offset, 4, this.length)
|
6768 |
|
6769 | return (this[offset] << 24) |
|
6770 | (this[offset + 1] << 16) |
|
6771 | (this[offset + 2] << 8) |
|
6772 | (this[offset + 3])
|
6773 | }
|
6774 |
|
6775 | Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
|
6776 | if (!noAssert) checkOffset(offset, 4, this.length)
|
6777 | return ieee754.read(this, offset, true, 23, 4)
|
6778 | }
|
6779 |
|
6780 | Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
|
6781 | if (!noAssert) checkOffset(offset, 4, this.length)
|
6782 | return ieee754.read(this, offset, false, 23, 4)
|
6783 | }
|
6784 |
|
6785 | Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
|
6786 | if (!noAssert) checkOffset(offset, 8, this.length)
|
6787 | return ieee754.read(this, offset, true, 52, 8)
|
6788 | }
|
6789 |
|
6790 | Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
|
6791 | if (!noAssert) checkOffset(offset, 8, this.length)
|
6792 | return ieee754.read(this, offset, false, 52, 8)
|
6793 | }
|
6794 |
|
6795 | function checkInt (buf, value, offset, ext, max, min) {
|
6796 | if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance')
|
6797 | if (value > max || value < min) throw new RangeError('"value" argument is out of bounds')
|
6798 | if (offset + ext > buf.length) throw new RangeError('Index out of range')
|
6799 | }
|
6800 |
|
6801 | Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
|
6802 | value = +value
|
6803 | offset = offset | 0
|
6804 | byteLength = byteLength | 0
|
6805 | if (!noAssert) {
|
6806 | var maxBytes = Math.pow(2, 8 * byteLength) - 1
|
6807 | checkInt(this, value, offset, byteLength, maxBytes, 0)
|
6808 | }
|
6809 |
|
6810 | var mul = 1
|
6811 | var i = 0
|
6812 | this[offset] = value & 0xFF
|
6813 | while (++i < byteLength && (mul *= 0x100)) {
|
6814 | this[offset + i] = (value / mul) & 0xFF
|
6815 | }
|
6816 |
|
6817 | return offset + byteLength
|
6818 | }
|
6819 |
|
6820 | Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
|
6821 | value = +value
|
6822 | offset = offset | 0
|
6823 | byteLength = byteLength | 0
|
6824 | if (!noAssert) {
|
6825 | var maxBytes = Math.pow(2, 8 * byteLength) - 1
|
6826 | checkInt(this, value, offset, byteLength, maxBytes, 0)
|
6827 | }
|
6828 |
|
6829 | var i = byteLength - 1
|
6830 | var mul = 1
|
6831 | this[offset + i] = value & 0xFF
|
6832 | while (--i >= 0 && (mul *= 0x100)) {
|
6833 | this[offset + i] = (value / mul) & 0xFF
|
6834 | }
|
6835 |
|
6836 | return offset + byteLength
|
6837 | }
|
6838 |
|
6839 | Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
|
6840 | value = +value
|
6841 | offset = offset | 0
|
6842 | if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)
|
6843 | if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
|
6844 | this[offset] = (value & 0xff)
|
6845 | return offset + 1
|
6846 | }
|
6847 |
|
6848 | function objectWriteUInt16 (buf, value, offset, littleEndian) {
|
6849 | if (value < 0) value = 0xffff + value + 1
|
6850 | for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {
|
6851 | buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>
|
6852 | (littleEndian ? i : 1 - i) * 8
|
6853 | }
|
6854 | }
|
6855 |
|
6856 | Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
|
6857 | value = +value
|
6858 | offset = offset | 0
|
6859 | if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
|
6860 | if (Buffer.TYPED_ARRAY_SUPPORT) {
|
6861 | this[offset] = (value & 0xff)
|
6862 | this[offset + 1] = (value >>> 8)
|
6863 | } else {
|
6864 | objectWriteUInt16(this, value, offset, true)
|
6865 | }
|
6866 | return offset + 2
|
6867 | }
|
6868 |
|
6869 | Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
|
6870 | value = +value
|
6871 | offset = offset | 0
|
6872 | if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
|
6873 | if (Buffer.TYPED_ARRAY_SUPPORT) {
|
6874 | this[offset] = (value >>> 8)
|
6875 | this[offset + 1] = (value & 0xff)
|
6876 | } else {
|
6877 | objectWriteUInt16(this, value, offset, false)
|
6878 | }
|
6879 | return offset + 2
|
6880 | }
|
6881 |
|
6882 | function objectWriteUInt32 (buf, value, offset, littleEndian) {
|
6883 | if (value < 0) value = 0xffffffff + value + 1
|
6884 | for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {
|
6885 | buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff
|
6886 | }
|
6887 | }
|
6888 |
|
6889 | Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
|
6890 | value = +value
|
6891 | offset = offset | 0
|
6892 | if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
|
6893 | if (Buffer.TYPED_ARRAY_SUPPORT) {
|
6894 | this[offset + 3] = (value >>> 24)
|
6895 | this[offset + 2] = (value >>> 16)
|
6896 | this[offset + 1] = (value >>> 8)
|
6897 | this[offset] = (value & 0xff)
|
6898 | } else {
|
6899 | objectWriteUInt32(this, value, offset, true)
|
6900 | }
|
6901 | return offset + 4
|
6902 | }
|
6903 |
|
6904 | Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
|
6905 | value = +value
|
6906 | offset = offset | 0
|
6907 | if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
|
6908 | if (Buffer.TYPED_ARRAY_SUPPORT) {
|
6909 | this[offset] = (value >>> 24)
|
6910 | this[offset + 1] = (value >>> 16)
|
6911 | this[offset + 2] = (value >>> 8)
|
6912 | this[offset + 3] = (value & 0xff)
|
6913 | } else {
|
6914 | objectWriteUInt32(this, value, offset, false)
|
6915 | }
|
6916 | return offset + 4
|
6917 | }
|
6918 |
|
6919 | Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
|
6920 | value = +value
|
6921 | offset = offset | 0
|
6922 | if (!noAssert) {
|
6923 | var limit = Math.pow(2, 8 * byteLength - 1)
|
6924 |
|
6925 | checkInt(this, value, offset, byteLength, limit - 1, -limit)
|
6926 | }
|
6927 |
|
6928 | var i = 0
|
6929 | var mul = 1
|
6930 | var sub = 0
|
6931 | this[offset] = value & 0xFF
|
6932 | while (++i < byteLength && (mul *= 0x100)) {
|
6933 | if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
|
6934 | sub = 1
|
6935 | }
|
6936 | this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
|
6937 | }
|
6938 |
|
6939 | return offset + byteLength
|
6940 | }
|
6941 |
|
6942 | Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
|
6943 | value = +value
|
6944 | offset = offset | 0
|
6945 | if (!noAssert) {
|
6946 | var limit = Math.pow(2, 8 * byteLength - 1)
|
6947 |
|
6948 | checkInt(this, value, offset, byteLength, limit - 1, -limit)
|
6949 | }
|
6950 |
|
6951 | var i = byteLength - 1
|
6952 | var mul = 1
|
6953 | var sub = 0
|
6954 | this[offset + i] = value & 0xFF
|
6955 | while (--i >= 0 && (mul *= 0x100)) {
|
6956 | if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
|
6957 | sub = 1
|
6958 | }
|
6959 | this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
|
6960 | }
|
6961 |
|
6962 | return offset + byteLength
|
6963 | }
|
6964 |
|
6965 | Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
|
6966 | value = +value
|
6967 | offset = offset | 0
|
6968 | if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)
|
6969 | if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
|
6970 | if (value < 0) value = 0xff + value + 1
|
6971 | this[offset] = (value & 0xff)
|
6972 | return offset + 1
|
6973 | }
|
6974 |
|
6975 | Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
|
6976 | value = +value
|
6977 | offset = offset | 0
|
6978 | if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
|
6979 | if (Buffer.TYPED_ARRAY_SUPPORT) {
|
6980 | this[offset] = (value & 0xff)
|
6981 | this[offset + 1] = (value >>> 8)
|
6982 | } else {
|
6983 | objectWriteUInt16(this, value, offset, true)
|
6984 | }
|
6985 | return offset + 2
|
6986 | }
|
6987 |
|
6988 | Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
|
6989 | value = +value
|
6990 | offset = offset | 0
|
6991 | if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
|
6992 | if (Buffer.TYPED_ARRAY_SUPPORT) {
|
6993 | this[offset] = (value >>> 8)
|
6994 | this[offset + 1] = (value & 0xff)
|
6995 | } else {
|
6996 | objectWriteUInt16(this, value, offset, false)
|
6997 | }
|
6998 | return offset + 2
|
6999 | }
|
7000 |
|
7001 | Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
|
7002 | value = +value
|
7003 | offset = offset | 0
|
7004 | if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
|
7005 | if (Buffer.TYPED_ARRAY_SUPPORT) {
|
7006 | this[offset] = (value & 0xff)
|
7007 | this[offset + 1] = (value >>> 8)
|
7008 | this[offset + 2] = (value >>> 16)
|
7009 | this[offset + 3] = (value >>> 24)
|
7010 | } else {
|
7011 | objectWriteUInt32(this, value, offset, true)
|
7012 | }
|
7013 | return offset + 4
|
7014 | }
|
7015 |
|
7016 | Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
|
7017 | value = +value
|
7018 | offset = offset | 0
|
7019 | if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
|
7020 | if (value < 0) value = 0xffffffff + value + 1
|
7021 | if (Buffer.TYPED_ARRAY_SUPPORT) {
|
7022 | this[offset] = (value >>> 24)
|
7023 | this[offset + 1] = (value >>> 16)
|
7024 | this[offset + 2] = (value >>> 8)
|
7025 | this[offset + 3] = (value & 0xff)
|
7026 | } else {
|
7027 | objectWriteUInt32(this, value, offset, false)
|
7028 | }
|
7029 | return offset + 4
|
7030 | }
|
7031 |
|
7032 | function checkIEEE754 (buf, value, offset, ext, max, min) {
|
7033 | if (offset + ext > buf.length) throw new RangeError('Index out of range')
|
7034 | if (offset < 0) throw new RangeError('Index out of range')
|
7035 | }
|
7036 |
|
7037 | function writeFloat (buf, value, offset, littleEndian, noAssert) {
|
7038 | if (!noAssert) {
|
7039 | checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)
|
7040 | }
|
7041 | ieee754.write(buf, value, offset, littleEndian, 23, 4)
|
7042 | return offset + 4
|
7043 | }
|
7044 |
|
7045 | Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
|
7046 | return writeFloat(this, value, offset, true, noAssert)
|
7047 | }
|
7048 |
|
7049 | Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
|
7050 | return writeFloat(this, value, offset, false, noAssert)
|
7051 | }
|
7052 |
|
7053 | function writeDouble (buf, value, offset, littleEndian, noAssert) {
|
7054 | if (!noAssert) {
|
7055 | checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)
|
7056 | }
|
7057 | ieee754.write(buf, value, offset, littleEndian, 52, 8)
|
7058 | return offset + 8
|
7059 | }
|
7060 |
|
7061 | Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
|
7062 | return writeDouble(this, value, offset, true, noAssert)
|
7063 | }
|
7064 |
|
7065 | Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
|
7066 | return writeDouble(this, value, offset, false, noAssert)
|
7067 | }
|
7068 |
|
7069 |
|
7070 | Buffer.prototype.copy = function copy (target, targetStart, start, end) {
|
7071 | if (!start) start = 0
|
7072 | if (!end && end !== 0) end = this.length
|
7073 | if (targetStart >= target.length) targetStart = target.length
|
7074 | if (!targetStart) targetStart = 0
|
7075 | if (end > 0 && end < start) end = start
|
7076 |
|
7077 |
|
7078 | if (end === start) return 0
|
7079 | if (target.length === 0 || this.length === 0) return 0
|
7080 |
|
7081 |
|
7082 | if (targetStart < 0) {
|
7083 | throw new RangeError('targetStart out of bounds')
|
7084 | }
|
7085 | if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')
|
7086 | if (end < 0) throw new RangeError('sourceEnd out of bounds')
|
7087 |
|
7088 |
|
7089 | if (end > this.length) end = this.length
|
7090 | if (target.length - targetStart < end - start) {
|
7091 | end = target.length - targetStart + start
|
7092 | }
|
7093 |
|
7094 | var len = end - start
|
7095 | var i
|
7096 |
|
7097 | if (this === target && start < targetStart && targetStart < end) {
|
7098 |
|
7099 | for (i = len - 1; i >= 0; --i) {
|
7100 | target[i + targetStart] = this[i + start]
|
7101 | }
|
7102 | } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {
|
7103 |
|
7104 | for (i = 0; i < len; ++i) {
|
7105 | target[i + targetStart] = this[i + start]
|
7106 | }
|
7107 | } else {
|
7108 | Uint8Array.prototype.set.call(
|
7109 | target,
|
7110 | this.subarray(start, start + len),
|
7111 | targetStart
|
7112 | )
|
7113 | }
|
7114 |
|
7115 | return len
|
7116 | }
|
7117 |
|
7118 |
|
7119 |
|
7120 |
|
7121 |
|
7122 | Buffer.prototype.fill = function fill (val, start, end, encoding) {
|
7123 |
|
7124 | if (typeof val === 'string') {
|
7125 | if (typeof start === 'string') {
|
7126 | encoding = start
|
7127 | start = 0
|
7128 | end = this.length
|
7129 | } else if (typeof end === 'string') {
|
7130 | encoding = end
|
7131 | end = this.length
|
7132 | }
|
7133 | if (val.length === 1) {
|
7134 | var code = val.charCodeAt(0)
|
7135 | if (code < 256) {
|
7136 | val = code
|
7137 | }
|
7138 | }
|
7139 | if (encoding !== undefined && typeof encoding !== 'string') {
|
7140 | throw new TypeError('encoding must be a string')
|
7141 | }
|
7142 | if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
|
7143 | throw new TypeError('Unknown encoding: ' + encoding)
|
7144 | }
|
7145 | } else if (typeof val === 'number') {
|
7146 | val = val & 255
|
7147 | }
|
7148 |
|
7149 |
|
7150 | if (start < 0 || this.length < start || this.length < end) {
|
7151 | throw new RangeError('Out of range index')
|
7152 | }
|
7153 |
|
7154 | if (end <= start) {
|
7155 | return this
|
7156 | }
|
7157 |
|
7158 | start = start >>> 0
|
7159 | end = end === undefined ? this.length : end >>> 0
|
7160 |
|
7161 | if (!val) val = 0
|
7162 |
|
7163 | var i
|
7164 | if (typeof val === 'number') {
|
7165 | for (i = start; i < end; ++i) {
|
7166 | this[i] = val
|
7167 | }
|
7168 | } else {
|
7169 | var bytes = Buffer.isBuffer(val)
|
7170 | ? val
|
7171 | : utf8ToBytes(new Buffer(val, encoding).toString())
|
7172 | var len = bytes.length
|
7173 | for (i = 0; i < end - start; ++i) {
|
7174 | this[i + start] = bytes[i % len]
|
7175 | }
|
7176 | }
|
7177 |
|
7178 | return this
|
7179 | }
|
7180 |
|
7181 |
|
7182 |
|
7183 |
|
7184 | var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g
|
7185 |
|
7186 | function base64clean (str) {
|
7187 |
|
7188 | str = stringtrim(str).replace(INVALID_BASE64_RE, '')
|
7189 |
|
7190 | if (str.length < 2) return ''
|
7191 |
|
7192 | while (str.length % 4 !== 0) {
|
7193 | str = str + '='
|
7194 | }
|
7195 | return str
|
7196 | }
|
7197 |
|
7198 | function stringtrim (str) {
|
7199 | if (str.trim) return str.trim()
|
7200 | return str.replace(/^\s+|\s+$/g, '')
|
7201 | }
|
7202 |
|
7203 | function toHex (n) {
|
7204 | if (n < 16) return '0' + n.toString(16)
|
7205 | return n.toString(16)
|
7206 | }
|
7207 |
|
7208 | function utf8ToBytes (string, units) {
|
7209 | units = units || Infinity
|
7210 | var codePoint
|
7211 | var length = string.length
|
7212 | var leadSurrogate = null
|
7213 | var bytes = []
|
7214 |
|
7215 | for (var i = 0; i < length; ++i) {
|
7216 | codePoint = string.charCodeAt(i)
|
7217 |
|
7218 |
|
7219 | if (codePoint > 0xD7FF && codePoint < 0xE000) {
|
7220 |
|
7221 | if (!leadSurrogate) {
|
7222 |
|
7223 | if (codePoint > 0xDBFF) {
|
7224 |
|
7225 | if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
|
7226 | continue
|
7227 | } else if (i + 1 === length) {
|
7228 |
|
7229 | if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
|
7230 | continue
|
7231 | }
|
7232 |
|
7233 |
|
7234 | leadSurrogate = codePoint
|
7235 |
|
7236 | continue
|
7237 | }
|
7238 |
|
7239 |
|
7240 | if (codePoint < 0xDC00) {
|
7241 | if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
|
7242 | leadSurrogate = codePoint
|
7243 | continue
|
7244 | }
|
7245 |
|
7246 |
|
7247 | codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000
|
7248 | } else if (leadSurrogate) {
|
7249 |
|
7250 | if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
|
7251 | }
|
7252 |
|
7253 | leadSurrogate = null
|
7254 |
|
7255 |
|
7256 | if (codePoint < 0x80) {
|
7257 | if ((units -= 1) < 0) break
|
7258 | bytes.push(codePoint)
|
7259 | } else if (codePoint < 0x800) {
|
7260 | if ((units -= 2) < 0) break
|
7261 | bytes.push(
|
7262 | codePoint >> 0x6 | 0xC0,
|
7263 | codePoint & 0x3F | 0x80
|
7264 | )
|
7265 | } else if (codePoint < 0x10000) {
|
7266 | if ((units -= 3) < 0) break
|
7267 | bytes.push(
|
7268 | codePoint >> 0xC | 0xE0,
|
7269 | codePoint >> 0x6 & 0x3F | 0x80,
|
7270 | codePoint & 0x3F | 0x80
|
7271 | )
|
7272 | } else if (codePoint < 0x110000) {
|
7273 | if ((units -= 4) < 0) break
|
7274 | bytes.push(
|
7275 | codePoint >> 0x12 | 0xF0,
|
7276 | codePoint >> 0xC & 0x3F | 0x80,
|
7277 | codePoint >> 0x6 & 0x3F | 0x80,
|
7278 | codePoint & 0x3F | 0x80
|
7279 | )
|
7280 | } else {
|
7281 | throw new Error('Invalid code point')
|
7282 | }
|
7283 | }
|
7284 |
|
7285 | return bytes
|
7286 | }
|
7287 |
|
7288 | function asciiToBytes (str) {
|
7289 | var byteArray = []
|
7290 | for (var i = 0; i < str.length; ++i) {
|
7291 |
|
7292 | byteArray.push(str.charCodeAt(i) & 0xFF)
|
7293 | }
|
7294 | return byteArray
|
7295 | }
|
7296 |
|
7297 | function utf16leToBytes (str, units) {
|
7298 | var c, hi, lo
|
7299 | var byteArray = []
|
7300 | for (var i = 0; i < str.length; ++i) {
|
7301 | if ((units -= 2) < 0) break
|
7302 |
|
7303 | c = str.charCodeAt(i)
|
7304 | hi = c >> 8
|
7305 | lo = c % 256
|
7306 | byteArray.push(lo)
|
7307 | byteArray.push(hi)
|
7308 | }
|
7309 |
|
7310 | return byteArray
|
7311 | }
|
7312 |
|
7313 | function base64ToBytes (str) {
|
7314 | return base64.toByteArray(base64clean(str))
|
7315 | }
|
7316 |
|
7317 | function blitBuffer (src, dst, offset, length) {
|
7318 | for (var i = 0; i < length; ++i) {
|
7319 | if ((i + offset >= dst.length) || (i >= src.length)) break
|
7320 | dst[i + offset] = src[i]
|
7321 | }
|
7322 | return i
|
7323 | }
|
7324 |
|
7325 | function isnan (val) {
|
7326 | return val !== val
|
7327 | }
|
7328 |
|
7329 | }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
7330 | },{"base64-js":66,"ieee754":225,"isarray":234}],71:[function(require,module,exports){
|
7331 | module.exports = {
|
7332 | "100": "Continue",
|
7333 | "101": "Switching Protocols",
|
7334 | "102": "Processing",
|
7335 | "200": "OK",
|
7336 | "201": "Created",
|
7337 | "202": "Accepted",
|
7338 | "203": "Non-Authoritative Information",
|
7339 | "204": "No Content",
|
7340 | "205": "Reset Content",
|
7341 | "206": "Partial Content",
|
7342 | "207": "Multi-Status",
|
7343 | "208": "Already Reported",
|
7344 | "226": "IM Used",
|
7345 | "300": "Multiple Choices",
|
7346 | "301": "Moved Permanently",
|
7347 | "302": "Found",
|
7348 | "303": "See Other",
|
7349 | "304": "Not Modified",
|
7350 | "305": "Use Proxy",
|
7351 | "307": "Temporary Redirect",
|
7352 | "308": "Permanent Redirect",
|
7353 | "400": "Bad Request",
|
7354 | "401": "Unauthorized",
|
7355 | "402": "Payment Required",
|
7356 | "403": "Forbidden",
|
7357 | "404": "Not Found",
|
7358 | "405": "Method Not Allowed",
|
7359 | "406": "Not Acceptable",
|
7360 | "407": "Proxy Authentication Required",
|
7361 | "408": "Request Timeout",
|
7362 | "409": "Conflict",
|
7363 | "410": "Gone",
|
7364 | "411": "Length Required",
|
7365 | "412": "Precondition Failed",
|
7366 | "413": "Payload Too Large",
|
7367 | "414": "URI Too Long",
|
7368 | "415": "Unsupported Media Type",
|
7369 | "416": "Range Not Satisfiable",
|
7370 | "417": "Expectation Failed",
|
7371 | "418": "I'm a teapot",
|
7372 | "421": "Misdirected Request",
|
7373 | "422": "Unprocessable Entity",
|
7374 | "423": "Locked",
|
7375 | "424": "Failed Dependency",
|
7376 | "425": "Unordered Collection",
|
7377 | "426": "Upgrade Required",
|
7378 | "428": "Precondition Required",
|
7379 | "429": "Too Many Requests",
|
7380 | "431": "Request Header Fields Too Large",
|
7381 | "451": "Unavailable For Legal Reasons",
|
7382 | "500": "Internal Server Error",
|
7383 | "501": "Not Implemented",
|
7384 | "502": "Bad Gateway",
|
7385 | "503": "Service Unavailable",
|
7386 | "504": "Gateway Timeout",
|
7387 | "505": "HTTP Version Not Supported",
|
7388 | "506": "Variant Also Negotiates",
|
7389 | "507": "Insufficient Storage",
|
7390 | "508": "Loop Detected",
|
7391 | "509": "Bandwidth Limit Exceeded",
|
7392 | "510": "Not Extended",
|
7393 | "511": "Network Authentication Required"
|
7394 | }
|
7395 |
|
7396 | },{}],72:[function(require,module,exports){
|
7397 | module.exports={
|
7398 | "O_RDONLY": 0,
|
7399 | "O_WRONLY": 1,
|
7400 | "O_RDWR": 2,
|
7401 | "S_IFMT": 61440,
|
7402 | "S_IFREG": 32768,
|
7403 | "S_IFDIR": 16384,
|
7404 | "S_IFCHR": 8192,
|
7405 | "S_IFBLK": 24576,
|
7406 | "S_IFIFO": 4096,
|
7407 | "S_IFLNK": 40960,
|
7408 | "S_IFSOCK": 49152,
|
7409 | "O_CREAT": 512,
|
7410 | "O_EXCL": 2048,
|
7411 | "O_NOCTTY": 131072,
|
7412 | "O_TRUNC": 1024,
|
7413 | "O_APPEND": 8,
|
7414 | "O_DIRECTORY": 1048576,
|
7415 | "O_NOFOLLOW": 256,
|
7416 | "O_SYNC": 128,
|
7417 | "O_SYMLINK": 2097152,
|
7418 | "O_NONBLOCK": 4,
|
7419 | "S_IRWXU": 448,
|
7420 | "S_IRUSR": 256,
|
7421 | "S_IWUSR": 128,
|
7422 | "S_IXUSR": 64,
|
7423 | "S_IRWXG": 56,
|
7424 | "S_IRGRP": 32,
|
7425 | "S_IWGRP": 16,
|
7426 | "S_IXGRP": 8,
|
7427 | "S_IRWXO": 7,
|
7428 | "S_IROTH": 4,
|
7429 | "S_IWOTH": 2,
|
7430 | "S_IXOTH": 1,
|
7431 | "E2BIG": 7,
|
7432 | "EACCES": 13,
|
7433 | "EADDRINUSE": 48,
|
7434 | "EADDRNOTAVAIL": 49,
|
7435 | "EAFNOSUPPORT": 47,
|
7436 | "EAGAIN": 35,
|
7437 | "EALREADY": 37,
|
7438 | "EBADF": 9,
|
7439 | "EBADMSG": 94,
|
7440 | "EBUSY": 16,
|
7441 | "ECANCELED": 89,
|
7442 | "ECHILD": 10,
|
7443 | "ECONNABORTED": 53,
|
7444 | "ECONNREFUSED": 61,
|
7445 | "ECONNRESET": 54,
|
7446 | "EDEADLK": 11,
|
7447 | "EDESTADDRREQ": 39,
|
7448 | "EDOM": 33,
|
7449 | "EDQUOT": 69,
|
7450 | "EEXIST": 17,
|
7451 | "EFAULT": 14,
|
7452 | "EFBIG": 27,
|
7453 | "EHOSTUNREACH": 65,
|
7454 | "EIDRM": 90,
|
7455 | "EILSEQ": 92,
|
7456 | "EINPROGRESS": 36,
|
7457 | "EINTR": 4,
|
7458 | "EINVAL": 22,
|
7459 | "EIO": 5,
|
7460 | "EISCONN": 56,
|
7461 | "EISDIR": 21,
|
7462 | "ELOOP": 62,
|
7463 | "EMFILE": 24,
|
7464 | "EMLINK": 31,
|
7465 | "EMSGSIZE": 40,
|
7466 | "EMULTIHOP": 95,
|
7467 | "ENAMETOOLONG": 63,
|
7468 | "ENETDOWN": 50,
|
7469 | "ENETRESET": 52,
|
7470 | "ENETUNREACH": 51,
|
7471 | "ENFILE": 23,
|
7472 | "ENOBUFS": 55,
|
7473 | "ENODATA": 96,
|
7474 | "ENODEV": 19,
|
7475 | "ENOENT": 2,
|
7476 | "ENOEXEC": 8,
|
7477 | "ENOLCK": 77,
|
7478 | "ENOLINK": 97,
|
7479 | "ENOMEM": 12,
|
7480 | "ENOMSG": 91,
|
7481 | "ENOPROTOOPT": 42,
|
7482 | "ENOSPC": 28,
|
7483 | "ENOSR": 98,
|
7484 | "ENOSTR": 99,
|
7485 | "ENOSYS": 78,
|
7486 | "ENOTCONN": 57,
|
7487 | "ENOTDIR": 20,
|
7488 | "ENOTEMPTY": 66,
|
7489 | "ENOTSOCK": 38,
|
7490 | "ENOTSUP": 45,
|
7491 | "ENOTTY": 25,
|
7492 | "ENXIO": 6,
|
7493 | "EOPNOTSUPP": 102,
|
7494 | "EOVERFLOW": 84,
|
7495 | "EPERM": 1,
|
7496 | "EPIPE": 32,
|
7497 | "EPROTO": 100,
|
7498 | "EPROTONOSUPPORT": 43,
|
7499 | "EPROTOTYPE": 41,
|
7500 | "ERANGE": 34,
|
7501 | "EROFS": 30,
|
7502 | "ESPIPE": 29,
|
7503 | "ESRCH": 3,
|
7504 | "ESTALE": 70,
|
7505 | "ETIME": 101,
|
7506 | "ETIMEDOUT": 60,
|
7507 | "ETXTBSY": 26,
|
7508 | "EWOULDBLOCK": 35,
|
7509 | "EXDEV": 18,
|
7510 | "SIGHUP": 1,
|
7511 | "SIGINT": 2,
|
7512 | "SIGQUIT": 3,
|
7513 | "SIGILL": 4,
|
7514 | "SIGTRAP": 5,
|
7515 | "SIGABRT": 6,
|
7516 | "SIGIOT": 6,
|
7517 | "SIGBUS": 10,
|
7518 | "SIGFPE": 8,
|
7519 | "SIGKILL": 9,
|
7520 | "SIGUSR1": 30,
|
7521 | "SIGSEGV": 11,
|
7522 | "SIGUSR2": 31,
|
7523 | "SIGPIPE": 13,
|
7524 | "SIGALRM": 14,
|
7525 | "SIGTERM": 15,
|
7526 | "SIGCHLD": 20,
|
7527 | "SIGCONT": 19,
|
7528 | "SIGSTOP": 17,
|
7529 | "SIGTSTP": 18,
|
7530 | "SIGTTIN": 21,
|
7531 | "SIGTTOU": 22,
|
7532 | "SIGURG": 16,
|
7533 | "SIGXCPU": 24,
|
7534 | "SIGXFSZ": 25,
|
7535 | "SIGVTALRM": 26,
|
7536 | "SIGPROF": 27,
|
7537 | "SIGWINCH": 28,
|
7538 | "SIGIO": 23,
|
7539 | "SIGSYS": 12,
|
7540 | "SSL_OP_ALL": 2147486719,
|
7541 | "SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION": 262144,
|
7542 | "SSL_OP_CIPHER_SERVER_PREFERENCE": 4194304,
|
7543 | "SSL_OP_CISCO_ANYCONNECT": 32768,
|
7544 | "SSL_OP_COOKIE_EXCHANGE": 8192,
|
7545 | "SSL_OP_CRYPTOPRO_TLSEXT_BUG": 2147483648,
|
7546 | "SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS": 2048,
|
7547 | "SSL_OP_EPHEMERAL_RSA": 0,
|
7548 | "SSL_OP_LEGACY_SERVER_CONNECT": 4,
|
7549 | "SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER": 32,
|
7550 | "SSL_OP_MICROSOFT_SESS_ID_BUG": 1,
|
7551 | "SSL_OP_MSIE_SSLV2_RSA_PADDING": 0,
|
7552 | "SSL_OP_NETSCAPE_CA_DN_BUG": 536870912,
|
7553 | "SSL_OP_NETSCAPE_CHALLENGE_BUG": 2,
|
7554 | "SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG": 1073741824,
|
7555 | "SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG": 8,
|
7556 | "SSL_OP_NO_COMPRESSION": 131072,
|
7557 | "SSL_OP_NO_QUERY_MTU": 4096,
|
7558 | "SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION": 65536,
|
7559 | "SSL_OP_NO_SSLv2": 16777216,
|
7560 | "SSL_OP_NO_SSLv3": 33554432,
|
7561 | "SSL_OP_NO_TICKET": 16384,
|
7562 | "SSL_OP_NO_TLSv1": 67108864,
|
7563 | "SSL_OP_NO_TLSv1_1": 268435456,
|
7564 | "SSL_OP_NO_TLSv1_2": 134217728,
|
7565 | "SSL_OP_PKCS1_CHECK_1": 0,
|
7566 | "SSL_OP_PKCS1_CHECK_2": 0,
|
7567 | "SSL_OP_SINGLE_DH_USE": 1048576,
|
7568 | "SSL_OP_SINGLE_ECDH_USE": 524288,
|
7569 | "SSL_OP_SSLEAY_080_CLIENT_DH_BUG": 128,
|
7570 | "SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG": 0,
|
7571 | "SSL_OP_TLS_BLOCK_PADDING_BUG": 512,
|
7572 | "SSL_OP_TLS_D5_BUG": 256,
|
7573 | "SSL_OP_TLS_ROLLBACK_BUG": 8388608,
|
7574 | "ENGINE_METHOD_DSA": 2,
|
7575 | "ENGINE_METHOD_DH": 4,
|
7576 | "ENGINE_METHOD_RAND": 8,
|
7577 | "ENGINE_METHOD_ECDH": 16,
|
7578 | "ENGINE_METHOD_ECDSA": 32,
|
7579 | "ENGINE_METHOD_CIPHERS": 64,
|
7580 | "ENGINE_METHOD_DIGESTS": 128,
|
7581 | "ENGINE_METHOD_STORE": 256,
|
7582 | "ENGINE_METHOD_PKEY_METHS": 512,
|
7583 | "ENGINE_METHOD_PKEY_ASN1_METHS": 1024,
|
7584 | "ENGINE_METHOD_ALL": 65535,
|
7585 | "ENGINE_METHOD_NONE": 0,
|
7586 | "DH_CHECK_P_NOT_SAFE_PRIME": 2,
|
7587 | "DH_CHECK_P_NOT_PRIME": 1,
|
7588 | "DH_UNABLE_TO_CHECK_GENERATOR": 4,
|
7589 | "DH_NOT_SUITABLE_GENERATOR": 8,
|
7590 | "NPN_ENABLED": 1,
|
7591 | "RSA_PKCS1_PADDING": 1,
|
7592 | "RSA_SSLV23_PADDING": 2,
|
7593 | "RSA_NO_PADDING": 3,
|
7594 | "RSA_PKCS1_OAEP_PADDING": 4,
|
7595 | "RSA_X931_PADDING": 5,
|
7596 | "RSA_PKCS1_PSS_PADDING": 6,
|
7597 | "POINT_CONVERSION_COMPRESSED": 2,
|
7598 | "POINT_CONVERSION_UNCOMPRESSED": 4,
|
7599 | "POINT_CONVERSION_HYBRID": 6,
|
7600 | "F_OK": 0,
|
7601 | "R_OK": 4,
|
7602 | "W_OK": 2,
|
7603 | "X_OK": 1,
|
7604 | "UV_UDP_REUSEADDR": 4
|
7605 | }
|
7606 |
|
7607 | },{}],73:[function(require,module,exports){
|
7608 |
|
7609 |
|
7610 |
|
7611 |
|
7612 |
|
7613 |
|
7614 | 'use strict';
|
7615 |
|
7616 |
|
7617 |
|
7618 |
|
7619 |
|
7620 | var slice = Array.prototype.slice;
|
7621 |
|
7622 |
|
7623 |
|
7624 |
|
7625 |
|
7626 |
|
7627 |
|
7628 |
|
7629 |
|
7630 |
|
7631 |
|
7632 |
|
7633 |
|
7634 | module.exports = Copy;
|
7635 |
|
7636 |
|
7637 |
|
7638 |
|
7639 |
|
7640 |
|
7641 |
|
7642 |
|
7643 | function Copy(src, withAccess) {
|
7644 | if (!(this instanceof Copy)) return new Copy(src, withAccess);
|
7645 | this.src = src;
|
7646 | this._withAccess = withAccess;
|
7647 | }
|
7648 |
|
7649 |
|
7650 |
|
7651 |
|
7652 |
|
7653 |
|
7654 |
|
7655 | Copy.prototype.withAccess = function (w) {
|
7656 | this._withAccess = w !== false;
|
7657 | return this;
|
7658 | };
|
7659 |
|
7660 |
|
7661 |
|
7662 |
|
7663 |
|
7664 |
|
7665 |
|
7666 | Copy.prototype.pick = function(keys) {
|
7667 | if (!Array.isArray(keys)) {
|
7668 | keys = slice.call(arguments);
|
7669 | }
|
7670 | if (keys.length) {
|
7671 | this.keys = keys;
|
7672 | }
|
7673 | return this;
|
7674 | };
|
7675 |
|
7676 |
|
7677 |
|
7678 |
|
7679 |
|
7680 |
|
7681 |
|
7682 |
|
7683 |
|
7684 | Copy.prototype.to = function(to) {
|
7685 | to = to || {};
|
7686 |
|
7687 | if (!this.src) return to;
|
7688 | var keys = this.keys || Object.keys(this.src);
|
7689 |
|
7690 | if (!this._withAccess) {
|
7691 | for (var i = 0; i < keys.length; i++) {
|
7692 | key = keys[i];
|
7693 | if (to[key] !== undefined) continue;
|
7694 | to[key] = this.src[key];
|
7695 | }
|
7696 | return to;
|
7697 | }
|
7698 |
|
7699 | for (var i = 0; i < keys.length; i++) {
|
7700 | var key = keys[i];
|
7701 | if (!notDefined(to, key)) continue;
|
7702 | var getter = this.src.__lookupGetter__(key);
|
7703 | var setter = this.src.__lookupSetter__(key);
|
7704 | if (getter) to.__defineGetter__(key, getter);
|
7705 | if (setter) to.__defineSetter__(key, setter);
|
7706 |
|
7707 | if (!getter && !setter) {
|
7708 | to[key] = this.src[key];
|
7709 | }
|
7710 | }
|
7711 | return to;
|
7712 | };
|
7713 |
|
7714 |
|
7715 |
|
7716 |
|
7717 |
|
7718 |
|
7719 |
|
7720 |
|
7721 |
|
7722 | Copy.prototype.toCover = function(to) {
|
7723 | var keys = this.keys || Object.keys(this.src);
|
7724 |
|
7725 | for (var i = 0; i < keys.length; i++) {
|
7726 | var key = keys[i];
|
7727 | delete to[key];
|
7728 | var getter = this.src.__lookupGetter__(key);
|
7729 | var setter = this.src.__lookupSetter__(key);
|
7730 | if (getter) to.__defineGetter__(key, getter);
|
7731 | if (setter) to.__defineSetter__(key, setter);
|
7732 |
|
7733 | if (!getter && !setter) {
|
7734 | to[key] = this.src[key];
|
7735 | }
|
7736 | }
|
7737 | };
|
7738 |
|
7739 | Copy.prototype.override = Copy.prototype.toCover;
|
7740 |
|
7741 |
|
7742 |
|
7743 |
|
7744 |
|
7745 |
|
7746 |
|
7747 | Copy.prototype.and = function (obj) {
|
7748 | var src = {};
|
7749 | this.to(src);
|
7750 | this.src = obj;
|
7751 | this.to(src);
|
7752 | this.src = src;
|
7753 |
|
7754 | return this;
|
7755 | };
|
7756 |
|
7757 |
|
7758 |
|
7759 |
|
7760 |
|
7761 |
|
7762 |
|
7763 |
|
7764 | function notDefined(obj, key) {
|
7765 | return obj[key] === undefined
|
7766 | && obj.__lookupGetter__(key) === undefined
|
7767 | && obj.__lookupSetter__(key) === undefined;
|
7768 | }
|
7769 |
|
7770 | },{}],74:[function(require,module,exports){
|
7771 | require('../../modules/es6.string.iterator');
|
7772 | require('../../modules/es6.array.from');
|
7773 | module.exports = require('../../modules/_core').Array.from;
|
7774 |
|
7775 | },{"../../modules/_core":96,"../../modules/es6.array.from":165,"../../modules/es6.string.iterator":177}],75:[function(require,module,exports){
|
7776 | var core = require('../../modules/_core');
|
7777 | var $JSON = core.JSON || (core.JSON = { stringify: JSON.stringify });
|
7778 | module.exports = function stringify(it) {
|
7779 | return $JSON.stringify.apply($JSON, arguments);
|
7780 | };
|
7781 |
|
7782 | },{"../../modules/_core":96}],76:[function(require,module,exports){
|
7783 | require('../../modules/es6.object.assign');
|
7784 | module.exports = require('../../modules/_core').Object.assign;
|
7785 |
|
7786 | },{"../../modules/_core":96,"../../modules/es6.object.assign":168}],77:[function(require,module,exports){
|
7787 | require('../../modules/es6.object.create');
|
7788 | var $Object = require('../../modules/_core').Object;
|
7789 | module.exports = function create(P, D) {
|
7790 | return $Object.create(P, D);
|
7791 | };
|
7792 |
|
7793 | },{"../../modules/_core":96,"../../modules/es6.object.create":169}],78:[function(require,module,exports){
|
7794 | require('../../modules/es6.object.define-property');
|
7795 | var $Object = require('../../modules/_core').Object;
|
7796 | module.exports = function defineProperty(it, key, desc) {
|
7797 | return $Object.defineProperty(it, key, desc);
|
7798 | };
|
7799 |
|
7800 | },{"../../modules/_core":96,"../../modules/es6.object.define-property":170}],79:[function(require,module,exports){
|
7801 | require('../../modules/es7.object.entries');
|
7802 | module.exports = require('../../modules/_core').Object.entries;
|
7803 |
|
7804 | },{"../../modules/_core":96,"../../modules/es7.object.entries":179}],80:[function(require,module,exports){
|
7805 | require('../../modules/es6.object.get-own-property-names');
|
7806 | var $Object = require('../../modules/_core').Object;
|
7807 | module.exports = function getOwnPropertyNames(it) {
|
7808 | return $Object.getOwnPropertyNames(it);
|
7809 | };
|
7810 |
|
7811 | },{"../../modules/_core":96,"../../modules/es6.object.get-own-property-names":171}],81:[function(require,module,exports){
|
7812 | require('../../modules/es6.object.get-prototype-of');
|
7813 | module.exports = require('../../modules/_core').Object.getPrototypeOf;
|
7814 |
|
7815 | },{"../../modules/_core":96,"../../modules/es6.object.get-prototype-of":172}],82:[function(require,module,exports){
|
7816 | require('../../modules/es6.object.keys');
|
7817 | module.exports = require('../../modules/_core').Object.keys;
|
7818 |
|
7819 | },{"../../modules/_core":96,"../../modules/es6.object.keys":173}],83:[function(require,module,exports){
|
7820 | require('../modules/es6.object.to-string');
|
7821 | require('../modules/es6.string.iterator');
|
7822 | require('../modules/web.dom.iterable');
|
7823 | require('../modules/es6.promise');
|
7824 | require('../modules/es7.promise.finally');
|
7825 | require('../modules/es7.promise.try');
|
7826 | module.exports = require('../modules/_core').Promise;
|
7827 |
|
7828 | },{"../modules/_core":96,"../modules/es6.object.to-string":174,"../modules/es6.promise":175,"../modules/es6.string.iterator":177,"../modules/es7.promise.finally":180,"../modules/es7.promise.try":181,"../modules/web.dom.iterable":184}],84:[function(require,module,exports){
|
7829 | require('../modules/web.immediate');
|
7830 | module.exports = require('../modules/_core').setImmediate;
|
7831 |
|
7832 | },{"../modules/_core":96,"../modules/web.immediate":185}],85:[function(require,module,exports){
|
7833 | require('../../modules/es6.string.from-code-point');
|
7834 | module.exports = require('../../modules/_core').String.fromCodePoint;
|
7835 |
|
7836 | },{"../../modules/_core":96,"../../modules/es6.string.from-code-point":176}],86:[function(require,module,exports){
|
7837 | require('../../modules/es6.function.has-instance');
|
7838 | module.exports = require('../../modules/_wks-ext').f('hasInstance');
|
7839 |
|
7840 | },{"../../modules/_wks-ext":162,"../../modules/es6.function.has-instance":167}],87:[function(require,module,exports){
|
7841 | require('../../modules/es6.symbol');
|
7842 | require('../../modules/es6.object.to-string');
|
7843 | require('../../modules/es7.symbol.async-iterator');
|
7844 | require('../../modules/es7.symbol.observable');
|
7845 | module.exports = require('../../modules/_core').Symbol;
|
7846 |
|
7847 | },{"../../modules/_core":96,"../../modules/es6.object.to-string":174,"../../modules/es6.symbol":178,"../../modules/es7.symbol.async-iterator":182,"../../modules/es7.symbol.observable":183}],88:[function(require,module,exports){
|
7848 | require('../../modules/es6.string.iterator');
|
7849 | require('../../modules/web.dom.iterable');
|
7850 | module.exports = require('../../modules/_wks-ext').f('iterator');
|
7851 |
|
7852 | },{"../../modules/_wks-ext":162,"../../modules/es6.string.iterator":177,"../../modules/web.dom.iterable":184}],89:[function(require,module,exports){
|
7853 | module.exports = function (it) {
|
7854 | if (typeof it != 'function') throw TypeError(it + ' is not a function!');
|
7855 | return it;
|
7856 | };
|
7857 |
|
7858 | },{}],90:[function(require,module,exports){
|
7859 | module.exports = function () { };
|
7860 |
|
7861 | },{}],91:[function(require,module,exports){
|
7862 | module.exports = function (it, Constructor, name, forbiddenField) {
|
7863 | if (!(it instanceof Constructor) || (forbiddenField !== undefined && forbiddenField in it)) {
|
7864 | throw TypeError(name + ': incorrect invocation!');
|
7865 | } return it;
|
7866 | };
|
7867 |
|
7868 | },{}],92:[function(require,module,exports){
|
7869 | var isObject = require('./_is-object');
|
7870 | module.exports = function (it) {
|
7871 | if (!isObject(it)) throw TypeError(it + ' is not an object!');
|
7872 | return it;
|
7873 | };
|
7874 |
|
7875 | },{"./_is-object":116}],93:[function(require,module,exports){
|
7876 |
|
7877 |
|
7878 | var toIObject = require('./_to-iobject');
|
7879 | var toLength = require('./_to-length');
|
7880 | var toAbsoluteIndex = require('./_to-absolute-index');
|
7881 | module.exports = function (IS_INCLUDES) {
|
7882 | return function ($this, el, fromIndex) {
|
7883 | var O = toIObject($this);
|
7884 | var length = toLength(O.length);
|
7885 | var index = toAbsoluteIndex(fromIndex, length);
|
7886 | var value;
|
7887 |
|
7888 |
|
7889 | if (IS_INCLUDES && el != el) while (length > index) {
|
7890 | value = O[index++];
|
7891 |
|
7892 | if (value != value) return true;
|
7893 |
|
7894 | } else for (;length > index; index++) if (IS_INCLUDES || index in O) {
|
7895 | if (O[index] === el) return IS_INCLUDES || index || 0;
|
7896 | } return !IS_INCLUDES && -1;
|
7897 | };
|
7898 | };
|
7899 |
|
7900 | },{"./_to-absolute-index":153,"./_to-iobject":155,"./_to-length":156}],94:[function(require,module,exports){
|
7901 |
|
7902 | var cof = require('./_cof');
|
7903 | var TAG = require('./_wks')('toStringTag');
|
7904 |
|
7905 | var ARG = cof(function () { return arguments; }()) == 'Arguments';
|
7906 |
|
7907 |
|
7908 | var tryGet = function (it, key) {
|
7909 | try {
|
7910 | return it[key];
|
7911 | } catch (e) { }
|
7912 | };
|
7913 |
|
7914 | module.exports = function (it) {
|
7915 | var O, T, B;
|
7916 | return it === undefined ? 'Undefined' : it === null ? 'Null'
|
7917 |
|
7918 | : typeof (T = tryGet(O = Object(it), TAG)) == 'string' ? T
|
7919 |
|
7920 | : ARG ? cof(O)
|
7921 |
|
7922 | : (B = cof(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B;
|
7923 | };
|
7924 |
|
7925 | },{"./_cof":95,"./_wks":163}],95:[function(require,module,exports){
|
7926 | var toString = {}.toString;
|
7927 |
|
7928 | module.exports = function (it) {
|
7929 | return toString.call(it).slice(8, -1);
|
7930 | };
|
7931 |
|
7932 | },{}],96:[function(require,module,exports){
|
7933 | var core = module.exports = { version: '2.5.7' };
|
7934 | if (typeof __e == 'number') __e = core;
|
7935 |
|
7936 | },{}],97:[function(require,module,exports){
|
7937 | 'use strict';
|
7938 | var $defineProperty = require('./_object-dp');
|
7939 | var createDesc = require('./_property-desc');
|
7940 |
|
7941 | module.exports = function (object, index, value) {
|
7942 | if (index in object) $defineProperty.f(object, index, createDesc(0, value));
|
7943 | else object[index] = value;
|
7944 | };
|
7945 |
|
7946 | },{"./_object-dp":129,"./_property-desc":143}],98:[function(require,module,exports){
|
7947 |
|
7948 | var aFunction = require('./_a-function');
|
7949 | module.exports = function (fn, that, length) {
|
7950 | aFunction(fn);
|
7951 | if (that === undefined) return fn;
|
7952 | switch (length) {
|
7953 | case 1: return function (a) {
|
7954 | return fn.call(that, a);
|
7955 | };
|
7956 | case 2: return function (a, b) {
|
7957 | return fn.call(that, a, b);
|
7958 | };
|
7959 | case 3: return function (a, b, c) {
|
7960 | return fn.call(that, a, b, c);
|
7961 | };
|
7962 | }
|
7963 | return function (/* ...args */) {
|
7964 | return fn.apply(that, arguments);
|
7965 | };
|
7966 | };
|
7967 |
|
7968 | },{"./_a-function":89}],99:[function(require,module,exports){
|
7969 |
|
7970 | module.exports = function (it) {
|
7971 | if (it == undefined) throw TypeError("Can't call method on " + it);
|
7972 | return it;
|
7973 | };
|
7974 |
|
7975 | },{}],100:[function(require,module,exports){
|
7976 |
|
7977 | module.exports = !require('./_fails')(function () {
|
7978 | return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7;
|
7979 | });
|
7980 |
|
7981 | },{"./_fails":105}],101:[function(require,module,exports){
|
7982 | var isObject = require('./_is-object');
|
7983 | var document = require('./_global').document;
|
7984 |
|
7985 | var is = isObject(document) && isObject(document.createElement);
|
7986 | module.exports = function (it) {
|
7987 | return is ? document.createElement(it) : {};
|
7988 | };
|
7989 |
|
7990 | },{"./_global":107,"./_is-object":116}],102:[function(require,module,exports){
|
7991 |
|
7992 | module.exports = (
|
7993 | 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf'
|
7994 | ).split(',');
|
7995 |
|
7996 | },{}],103:[function(require,module,exports){
|
7997 |
|
7998 | var getKeys = require('./_object-keys');
|
7999 | var gOPS = require('./_object-gops');
|
8000 | var pIE = require('./_object-pie');
|
8001 | module.exports = function (it) {
|
8002 | var result = getKeys(it);
|
8003 | var getSymbols = gOPS.f;
|
8004 | if (getSymbols) {
|
8005 | var symbols = getSymbols(it);
|
8006 | var isEnum = pIE.f;
|
8007 | var i = 0;
|
8008 | var key;
|
8009 | while (symbols.length > i) if (isEnum.call(it, key = symbols[i++])) result.push(key);
|
8010 | } return result;
|
8011 | };
|
8012 |
|
8013 | },{"./_object-gops":134,"./_object-keys":137,"./_object-pie":138}],104:[function(require,module,exports){
|
8014 | var global = require('./_global');
|
8015 | var core = require('./_core');
|
8016 | var ctx = require('./_ctx');
|
8017 | var hide = require('./_hide');
|
8018 | var has = require('./_has');
|
8019 | var PROTOTYPE = 'prototype';
|
8020 |
|
8021 | var $export = function (type, name, source) {
|
8022 | var IS_FORCED = type & $export.F;
|
8023 | var IS_GLOBAL = type & $export.G;
|
8024 | var IS_STATIC = type & $export.S;
|
8025 | var IS_PROTO = type & $export.P;
|
8026 | var IS_BIND = type & $export.B;
|
8027 | var IS_WRAP = type & $export.W;
|
8028 | var exports = IS_GLOBAL ? core : core[name] || (core[name] = {});
|
8029 | var expProto = exports[PROTOTYPE];
|
8030 | var target = IS_GLOBAL ? global : IS_STATIC ? global[name] : (global[name] || {})[PROTOTYPE];
|
8031 | var key, own, out;
|
8032 | if (IS_GLOBAL) source = name;
|
8033 | for (key in source) {
|
8034 |
|
8035 | own = !IS_FORCED && target && target[key] !== undefined;
|
8036 | if (own && has(exports, key)) continue;
|
8037 |
|
8038 | out = own ? target[key] : source[key];
|
8039 |
|
8040 | exports[key] = IS_GLOBAL && typeof target[key] != 'function' ? source[key]
|
8041 |
|
8042 | : IS_BIND && own ? ctx(out, global)
|
8043 |
|
8044 | : IS_WRAP && target[key] == out ? (function (C) {
|
8045 | var F = function (a, b, c) {
|
8046 | if (this instanceof C) {
|
8047 | switch (arguments.length) {
|
8048 | case 0: return new C();
|
8049 | case 1: return new C(a);
|
8050 | case 2: return new C(a, b);
|
8051 | } return new C(a, b, c);
|
8052 | } return C.apply(this, arguments);
|
8053 | };
|
8054 | F[PROTOTYPE] = C[PROTOTYPE];
|
8055 | return F;
|
8056 |
|
8057 | })(out) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out;
|
8058 |
|
8059 | if (IS_PROTO) {
|
8060 | (exports.virtual || (exports.virtual = {}))[key] = out;
|
8061 |
|
8062 | if (type & $export.R && expProto && !expProto[key]) hide(expProto, key, out);
|
8063 | }
|
8064 | }
|
8065 | };
|
8066 |
|
8067 | $export.F = 1;
|
8068 | $export.G = 2;
|
8069 | $export.S = 4;
|
8070 | $export.P = 8;
|
8071 | $export.B = 16;
|
8072 | $export.W = 32;
|
8073 | $export.U = 64;
|
8074 | $export.R = 128;
|
8075 | module.exports = $export;
|
8076 |
|
8077 | },{"./_core":96,"./_ctx":98,"./_global":107,"./_has":108,"./_hide":109}],105:[function(require,module,exports){
|
8078 | module.exports = function (exec) {
|
8079 | try {
|
8080 | return !!exec();
|
8081 | } catch (e) {
|
8082 | return true;
|
8083 | }
|
8084 | };
|
8085 |
|
8086 | },{}],106:[function(require,module,exports){
|
8087 | var ctx = require('./_ctx');
|
8088 | var call = require('./_iter-call');
|
8089 | var isArrayIter = require('./_is-array-iter');
|
8090 | var anObject = require('./_an-object');
|
8091 | var toLength = require('./_to-length');
|
8092 | var getIterFn = require('./core.get-iterator-method');
|
8093 | var BREAK = {};
|
8094 | var RETURN = {};
|
8095 | var exports = module.exports = function (iterable, entries, fn, that, ITERATOR) {
|
8096 | var iterFn = ITERATOR ? function () { return iterable; } : getIterFn(iterable);
|
8097 | var f = ctx(fn, that, entries ? 2 : 1);
|
8098 | var index = 0;
|
8099 | var length, step, iterator, result;
|
8100 | if (typeof iterFn != 'function') throw TypeError(iterable + ' is not iterable!');
|
8101 |
|
8102 | if (isArrayIter(iterFn)) for (length = toLength(iterable.length); length > index; index++) {
|
8103 | result = entries ? f(anObject(step = iterable[index])[0], step[1]) : f(iterable[index]);
|
8104 | if (result === BREAK || result === RETURN) return result;
|
8105 | } else for (iterator = iterFn.call(iterable); !(step = iterator.next()).done;) {
|
8106 | result = call(iterator, f, step.value, entries);
|
8107 | if (result === BREAK || result === RETURN) return result;
|
8108 | }
|
8109 | };
|
8110 | exports.BREAK = BREAK;
|
8111 | exports.RETURN = RETURN;
|
8112 |
|
8113 | },{"./_an-object":92,"./_ctx":98,"./_is-array-iter":114,"./_iter-call":117,"./_to-length":156,"./core.get-iterator-method":164}],107:[function(require,module,exports){
|
8114 |
|
8115 | var global = module.exports = typeof window != 'undefined' && window.Math == Math
|
8116 | ? window : typeof self != 'undefined' && self.Math == Math ? self
|
8117 |
|
8118 | : Function('return this')();
|
8119 | if (typeof __g == 'number') __g = global;
|
8120 |
|
8121 | },{}],108:[function(require,module,exports){
|
8122 | var hasOwnProperty = {}.hasOwnProperty;
|
8123 | module.exports = function (it, key) {
|
8124 | return hasOwnProperty.call(it, key);
|
8125 | };
|
8126 |
|
8127 | },{}],109:[function(require,module,exports){
|
8128 | var dP = require('./_object-dp');
|
8129 | var createDesc = require('./_property-desc');
|
8130 | module.exports = require('./_descriptors') ? function (object, key, value) {
|
8131 | return dP.f(object, key, createDesc(1, value));
|
8132 | } : function (object, key, value) {
|
8133 | object[key] = value;
|
8134 | return object;
|
8135 | };
|
8136 |
|
8137 | },{"./_descriptors":100,"./_object-dp":129,"./_property-desc":143}],110:[function(require,module,exports){
|
8138 | var document = require('./_global').document;
|
8139 | module.exports = document && document.documentElement;
|
8140 |
|
8141 | },{"./_global":107}],111:[function(require,module,exports){
|
8142 | module.exports = !require('./_descriptors') && !require('./_fails')(function () {
|
8143 | return Object.defineProperty(require('./_dom-create')('div'), 'a', { get: function () { return 7; } }).a != 7;
|
8144 | });
|
8145 |
|
8146 | },{"./_descriptors":100,"./_dom-create":101,"./_fails":105}],112:[function(require,module,exports){
|
8147 |
|
8148 | module.exports = function (fn, args, that) {
|
8149 | var un = that === undefined;
|
8150 | switch (args.length) {
|
8151 | case 0: return un ? fn()
|
8152 | : fn.call(that);
|
8153 | case 1: return un ? fn(args[0])
|
8154 | : fn.call(that, args[0]);
|
8155 | case 2: return un ? fn(args[0], args[1])
|
8156 | : fn.call(that, args[0], args[1]);
|
8157 | case 3: return un ? fn(args[0], args[1], args[2])
|
8158 | : fn.call(that, args[0], args[1], args[2]);
|
8159 | case 4: return un ? fn(args[0], args[1], args[2], args[3])
|
8160 | : fn.call(that, args[0], args[1], args[2], args[3]);
|
8161 | } return fn.apply(that, args);
|
8162 | };
|
8163 |
|
8164 | },{}],113:[function(require,module,exports){
|
8165 |
|
8166 | var cof = require('./_cof');
|
8167 |
|
8168 | module.exports = Object('z').propertyIsEnumerable(0) ? Object : function (it) {
|
8169 | return cof(it) == 'String' ? it.split('') : Object(it);
|
8170 | };
|
8171 |
|
8172 | },{"./_cof":95}],114:[function(require,module,exports){
|
8173 |
|
8174 | var Iterators = require('./_iterators');
|
8175 | var ITERATOR = require('./_wks')('iterator');
|
8176 | var ArrayProto = Array.prototype;
|
8177 |
|
8178 | module.exports = function (it) {
|
8179 | return it !== undefined && (Iterators.Array === it || ArrayProto[ITERATOR] === it);
|
8180 | };
|
8181 |
|
8182 | },{"./_iterators":122,"./_wks":163}],115:[function(require,module,exports){
|
8183 |
|
8184 | var cof = require('./_cof');
|
8185 | module.exports = Array.isArray || function isArray(arg) {
|
8186 | return cof(arg) == 'Array';
|
8187 | };
|
8188 |
|
8189 | },{"./_cof":95}],116:[function(require,module,exports){
|
8190 | module.exports = function (it) {
|
8191 | return typeof it === 'object' ? it !== null : typeof it === 'function';
|
8192 | };
|
8193 |
|
8194 | },{}],117:[function(require,module,exports){
|
8195 |
|
8196 | var anObject = require('./_an-object');
|
8197 | module.exports = function (iterator, fn, value, entries) {
|
8198 | try {
|
8199 | return entries ? fn(anObject(value)[0], value[1]) : fn(value);
|
8200 |
|
8201 | } catch (e) {
|
8202 | var ret = iterator['return'];
|
8203 | if (ret !== undefined) anObject(ret.call(iterator));
|
8204 | throw e;
|
8205 | }
|
8206 | };
|
8207 |
|
8208 | },{"./_an-object":92}],118:[function(require,module,exports){
|
8209 | 'use strict';
|
8210 | var create = require('./_object-create');
|
8211 | var descriptor = require('./_property-desc');
|
8212 | var setToStringTag = require('./_set-to-string-tag');
|
8213 | var IteratorPrototype = {};
|
8214 |
|
8215 |
|
8216 | require('./_hide')(IteratorPrototype, require('./_wks')('iterator'), function () { return this; });
|
8217 |
|
8218 | module.exports = function (Constructor, NAME, next) {
|
8219 | Constructor.prototype = create(IteratorPrototype, { next: descriptor(1, next) });
|
8220 | setToStringTag(Constructor, NAME + ' Iterator');
|
8221 | };
|
8222 |
|
8223 | },{"./_hide":109,"./_object-create":128,"./_property-desc":143,"./_set-to-string-tag":147,"./_wks":163}],119:[function(require,module,exports){
|
8224 | 'use strict';
|
8225 | var LIBRARY = require('./_library');
|
8226 | var $export = require('./_export');
|
8227 | var redefine = require('./_redefine');
|
8228 | var hide = require('./_hide');
|
8229 | var Iterators = require('./_iterators');
|
8230 | var $iterCreate = require('./_iter-create');
|
8231 | var setToStringTag = require('./_set-to-string-tag');
|
8232 | var getPrototypeOf = require('./_object-gpo');
|
8233 | var ITERATOR = require('./_wks')('iterator');
|
8234 | var BUGGY = !([].keys && 'next' in [].keys());
|
8235 | var FF_ITERATOR = '@@iterator';
|
8236 | var KEYS = 'keys';
|
8237 | var VALUES = 'values';
|
8238 |
|
8239 | var returnThis = function () { return this; };
|
8240 |
|
8241 | module.exports = function (Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED) {
|
8242 | $iterCreate(Constructor, NAME, next);
|
8243 | var getMethod = function (kind) {
|
8244 | if (!BUGGY && kind in proto) return proto[kind];
|
8245 | switch (kind) {
|
8246 | case KEYS: return function keys() { return new Constructor(this, kind); };
|
8247 | case VALUES: return function values() { return new Constructor(this, kind); };
|
8248 | } return function entries() { return new Constructor(this, kind); };
|
8249 | };
|
8250 | var TAG = NAME + ' Iterator';
|
8251 | var DEF_VALUES = DEFAULT == VALUES;
|
8252 | var VALUES_BUG = false;
|
8253 | var proto = Base.prototype;
|
8254 | var $native = proto[ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT];
|
8255 | var $default = $native || getMethod(DEFAULT);
|
8256 | var $entries = DEFAULT ? !DEF_VALUES ? $default : getMethod('entries') : undefined;
|
8257 | var $anyNative = NAME == 'Array' ? proto.entries || $native : $native;
|
8258 | var methods, key, IteratorPrototype;
|
8259 |
|
8260 | if ($anyNative) {
|
8261 | IteratorPrototype = getPrototypeOf($anyNative.call(new Base()));
|
8262 | if (IteratorPrototype !== Object.prototype && IteratorPrototype.next) {
|
8263 |
|
8264 | setToStringTag(IteratorPrototype, TAG, true);
|
8265 |
|
8266 | if (!LIBRARY && typeof IteratorPrototype[ITERATOR] != 'function') hide(IteratorPrototype, ITERATOR, returnThis);
|
8267 | }
|
8268 | }
|
8269 |
|
8270 | if (DEF_VALUES && $native && $native.name !== VALUES) {
|
8271 | VALUES_BUG = true;
|
8272 | $default = function values() { return $native.call(this); };
|
8273 | }
|
8274 |
|
8275 | if ((!LIBRARY || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR])) {
|
8276 | hide(proto, ITERATOR, $default);
|
8277 | }
|
8278 |
|
8279 | Iterators[NAME] = $default;
|
8280 | Iterators[TAG] = returnThis;
|
8281 | if (DEFAULT) {
|
8282 | methods = {
|
8283 | values: DEF_VALUES ? $default : getMethod(VALUES),
|
8284 | keys: IS_SET ? $default : getMethod(KEYS),
|
8285 | entries: $entries
|
8286 | };
|
8287 | if (FORCED) for (key in methods) {
|
8288 | if (!(key in proto)) redefine(proto, key, methods[key]);
|
8289 | } else $export($export.P + $export.F * (BUGGY || VALUES_BUG), NAME, methods);
|
8290 | }
|
8291 | return methods;
|
8292 | };
|
8293 |
|
8294 | },{"./_export":104,"./_hide":109,"./_iter-create":118,"./_iterators":122,"./_library":123,"./_object-gpo":135,"./_redefine":145,"./_set-to-string-tag":147,"./_wks":163}],120:[function(require,module,exports){
|
8295 | var ITERATOR = require('./_wks')('iterator');
|
8296 | var SAFE_CLOSING = false;
|
8297 |
|
8298 | try {
|
8299 | var riter = [7][ITERATOR]();
|
8300 | riter['return'] = function () { SAFE_CLOSING = true; };
|
8301 |
|
8302 | Array.from(riter, function () { throw 2; });
|
8303 | } catch (e) { }
|
8304 |
|
8305 | module.exports = function (exec, skipClosing) {
|
8306 | if (!skipClosing && !SAFE_CLOSING) return false;
|
8307 | var safe = false;
|
8308 | try {
|
8309 | var arr = [7];
|
8310 | var iter = arr[ITERATOR]();
|
8311 | iter.next = function () { return { done: safe = true }; };
|
8312 | arr[ITERATOR] = function () { return iter; };
|
8313 | exec(arr);
|
8314 | } catch (e) { }
|
8315 | return safe;
|
8316 | };
|
8317 |
|
8318 | },{"./_wks":163}],121:[function(require,module,exports){
|
8319 | module.exports = function (done, value) {
|
8320 | return { value: value, done: !!done };
|
8321 | };
|
8322 |
|
8323 | },{}],122:[function(require,module,exports){
|
8324 | module.exports = {};
|
8325 |
|
8326 | },{}],123:[function(require,module,exports){
|
8327 | module.exports = true;
|
8328 |
|
8329 | },{}],124:[function(require,module,exports){
|
8330 | var META = require('./_uid')('meta');
|
8331 | var isObject = require('./_is-object');
|
8332 | var has = require('./_has');
|
8333 | var setDesc = require('./_object-dp').f;
|
8334 | var id = 0;
|
8335 | var isExtensible = Object.isExtensible || function () {
|
8336 | return true;
|
8337 | };
|
8338 | var FREEZE = !require('./_fails')(function () {
|
8339 | return isExtensible(Object.preventExtensions({}));
|
8340 | });
|
8341 | var setMeta = function (it) {
|
8342 | setDesc(it, META, { value: {
|
8343 | i: 'O' + ++id,
|
8344 | w: {}
|
8345 | } });
|
8346 | };
|
8347 | var fastKey = function (it, create) {
|
8348 |
|
8349 | if (!isObject(it)) return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it;
|
8350 | if (!has(it, META)) {
|
8351 |
|
8352 | if (!isExtensible(it)) return 'F';
|
8353 |
|
8354 | if (!create) return 'E';
|
8355 |
|
8356 | setMeta(it);
|
8357 |
|
8358 | } return it[META].i;
|
8359 | };
|
8360 | var getWeak = function (it, create) {
|
8361 | if (!has(it, META)) {
|
8362 |
|
8363 | if (!isExtensible(it)) return true;
|
8364 |
|
8365 | if (!create) return false;
|
8366 |
|
8367 | setMeta(it);
|
8368 |
|
8369 | } return it[META].w;
|
8370 | };
|
8371 |
|
8372 | var onFreeze = function (it) {
|
8373 | if (FREEZE && meta.NEED && isExtensible(it) && !has(it, META)) setMeta(it);
|
8374 | return it;
|
8375 | };
|
8376 | var meta = module.exports = {
|
8377 | KEY: META,
|
8378 | NEED: false,
|
8379 | fastKey: fastKey,
|
8380 | getWeak: getWeak,
|
8381 | onFreeze: onFreeze
|
8382 | };
|
8383 |
|
8384 | },{"./_fails":105,"./_has":108,"./_is-object":116,"./_object-dp":129,"./_uid":159}],125:[function(require,module,exports){
|
8385 | var global = require('./_global');
|
8386 | var macrotask = require('./_task').set;
|
8387 | var Observer = global.MutationObserver || global.WebKitMutationObserver;
|
8388 | var process = global.process;
|
8389 | var Promise = global.Promise;
|
8390 | var isNode = require('./_cof')(process) == 'process';
|
8391 |
|
8392 | module.exports = function () {
|
8393 | var head, last, notify;
|
8394 |
|
8395 | var flush = function () {
|
8396 | var parent, fn;
|
8397 | if (isNode && (parent = process.domain)) parent.exit();
|
8398 | while (head) {
|
8399 | fn = head.fn;
|
8400 | head = head.next;
|
8401 | try {
|
8402 | fn();
|
8403 | } catch (e) {
|
8404 | if (head) notify();
|
8405 | else last = undefined;
|
8406 | throw e;
|
8407 | }
|
8408 | } last = undefined;
|
8409 | if (parent) parent.enter();
|
8410 | };
|
8411 |
|
8412 |
|
8413 | if (isNode) {
|
8414 | notify = function () {
|
8415 | process.nextTick(flush);
|
8416 | };
|
8417 |
|
8418 | } else if (Observer && !(global.navigator && global.navigator.standalone)) {
|
8419 | var toggle = true;
|
8420 | var node = document.createTextNode('');
|
8421 | new Observer(flush).observe(node, { characterData: true });
|
8422 | notify = function () {
|
8423 | node.data = toggle = !toggle;
|
8424 | };
|
8425 |
|
8426 | } else if (Promise && Promise.resolve) {
|
8427 |
|
8428 | var promise = Promise.resolve(undefined);
|
8429 | notify = function () {
|
8430 | promise.then(flush);
|
8431 | };
|
8432 |
|
8433 |
|
8434 |
|
8435 |
|
8436 |
|
8437 |
|
8438 | } else {
|
8439 | notify = function () {
|
8440 |
|
8441 | macrotask.call(global, flush);
|
8442 | };
|
8443 | }
|
8444 |
|
8445 | return function (fn) {
|
8446 | var task = { fn: fn, next: undefined };
|
8447 | if (last) last.next = task;
|
8448 | if (!head) {
|
8449 | head = task;
|
8450 | notify();
|
8451 | } last = task;
|
8452 | };
|
8453 | };
|
8454 |
|
8455 | },{"./_cof":95,"./_global":107,"./_task":152}],126:[function(require,module,exports){
|
8456 | 'use strict';
|
8457 |
|
8458 | var aFunction = require('./_a-function');
|
8459 |
|
8460 | function PromiseCapability(C) {
|
8461 | var resolve, reject;
|
8462 | this.promise = new C(function ($$resolve, $$reject) {
|
8463 | if (resolve !== undefined || reject !== undefined) throw TypeError('Bad Promise constructor');
|
8464 | resolve = $$resolve;
|
8465 | reject = $$reject;
|
8466 | });
|
8467 | this.resolve = aFunction(resolve);
|
8468 | this.reject = aFunction(reject);
|
8469 | }
|
8470 |
|
8471 | module.exports.f = function (C) {
|
8472 | return new PromiseCapability(C);
|
8473 | };
|
8474 |
|
8475 | },{"./_a-function":89}],127:[function(require,module,exports){
|
8476 | 'use strict';
|
8477 |
|
8478 | var getKeys = require('./_object-keys');
|
8479 | var gOPS = require('./_object-gops');
|
8480 | var pIE = require('./_object-pie');
|
8481 | var toObject = require('./_to-object');
|
8482 | var IObject = require('./_iobject');
|
8483 | var $assign = Object.assign;
|
8484 |
|
8485 |
|
8486 | module.exports = !$assign || require('./_fails')(function () {
|
8487 | var A = {};
|
8488 | var B = {};
|
8489 |
|
8490 | var S = Symbol();
|
8491 | var K = 'abcdefghijklmnopqrst';
|
8492 | A[S] = 7;
|
8493 | K.split('').forEach(function (k) { B[k] = k; });
|
8494 | return $assign({}, A)[S] != 7 || Object.keys($assign({}, B)).join('') != K;
|
8495 | }) ? function assign(target, source) {
|
8496 | var T = toObject(target);
|
8497 | var aLen = arguments.length;
|
8498 | var index = 1;
|
8499 | var getSymbols = gOPS.f;
|
8500 | var isEnum = pIE.f;
|
8501 | while (aLen > index) {
|
8502 | var S = IObject(arguments[index++]);
|
8503 | var keys = getSymbols ? getKeys(S).concat(getSymbols(S)) : getKeys(S);
|
8504 | var length = keys.length;
|
8505 | var j = 0;
|
8506 | var key;
|
8507 | while (length > j) if (isEnum.call(S, key = keys[j++])) T[key] = S[key];
|
8508 | } return T;
|
8509 | } : $assign;
|
8510 |
|
8511 | },{"./_fails":105,"./_iobject":113,"./_object-gops":134,"./_object-keys":137,"./_object-pie":138,"./_to-object":157}],128:[function(require,module,exports){
|
8512 |
|
8513 | var anObject = require('./_an-object');
|
8514 | var dPs = require('./_object-dps');
|
8515 | var enumBugKeys = require('./_enum-bug-keys');
|
8516 | var IE_PROTO = require('./_shared-key')('IE_PROTO');
|
8517 | var Empty = function () { };
|
8518 | var PROTOTYPE = 'prototype';
|
8519 |
|
8520 |
|
8521 | var createDict = function () {
|
8522 |
|
8523 | var iframe = require('./_dom-create')('iframe');
|
8524 | var i = enumBugKeys.length;
|
8525 | var lt = '<';
|
8526 | var gt = '>';
|
8527 | var iframeDocument;
|
8528 | iframe.style.display = 'none';
|
8529 | require('./_html').appendChild(iframe);
|
8530 | iframe.src = 'javascript:';
|
8531 |
|
8532 |
|
8533 | iframeDocument = iframe.contentWindow.document;
|
8534 | iframeDocument.open();
|
8535 | iframeDocument.write(lt + 'script' + gt + 'document.F=Object' + lt + '/script' + gt);
|
8536 | iframeDocument.close();
|
8537 | createDict = iframeDocument.F;
|
8538 | while (i--) delete createDict[PROTOTYPE][enumBugKeys[i]];
|
8539 | return createDict();
|
8540 | };
|
8541 |
|
8542 | module.exports = Object.create || function create(O, Properties) {
|
8543 | var result;
|
8544 | if (O !== null) {
|
8545 | Empty[PROTOTYPE] = anObject(O);
|
8546 | result = new Empty();
|
8547 | Empty[PROTOTYPE] = null;
|
8548 |
|
8549 | result[IE_PROTO] = O;
|
8550 | } else result = createDict();
|
8551 | return Properties === undefined ? result : dPs(result, Properties);
|
8552 | };
|
8553 |
|
8554 | },{"./_an-object":92,"./_dom-create":101,"./_enum-bug-keys":102,"./_html":110,"./_object-dps":130,"./_shared-key":148}],129:[function(require,module,exports){
|
8555 | var anObject = require('./_an-object');
|
8556 | var IE8_DOM_DEFINE = require('./_ie8-dom-define');
|
8557 | var toPrimitive = require('./_to-primitive');
|
8558 | var dP = Object.defineProperty;
|
8559 |
|
8560 | exports.f = require('./_descriptors') ? Object.defineProperty : function defineProperty(O, P, Attributes) {
|
8561 | anObject(O);
|
8562 | P = toPrimitive(P, true);
|
8563 | anObject(Attributes);
|
8564 | if (IE8_DOM_DEFINE) try {
|
8565 | return dP(O, P, Attributes);
|
8566 | } catch (e) { }
|
8567 | if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported!');
|
8568 | if ('value' in Attributes) O[P] = Attributes.value;
|
8569 | return O;
|
8570 | };
|
8571 |
|
8572 | },{"./_an-object":92,"./_descriptors":100,"./_ie8-dom-define":111,"./_to-primitive":158}],130:[function(require,module,exports){
|
8573 | var dP = require('./_object-dp');
|
8574 | var anObject = require('./_an-object');
|
8575 | var getKeys = require('./_object-keys');
|
8576 |
|
8577 | module.exports = require('./_descriptors') ? Object.defineProperties : function defineProperties(O, Properties) {
|
8578 | anObject(O);
|
8579 | var keys = getKeys(Properties);
|
8580 | var length = keys.length;
|
8581 | var i = 0;
|
8582 | var P;
|
8583 | while (length > i) dP.f(O, P = keys[i++], Properties[P]);
|
8584 | return O;
|
8585 | };
|
8586 |
|
8587 | },{"./_an-object":92,"./_descriptors":100,"./_object-dp":129,"./_object-keys":137}],131:[function(require,module,exports){
|
8588 | var pIE = require('./_object-pie');
|
8589 | var createDesc = require('./_property-desc');
|
8590 | var toIObject = require('./_to-iobject');
|
8591 | var toPrimitive = require('./_to-primitive');
|
8592 | var has = require('./_has');
|
8593 | var IE8_DOM_DEFINE = require('./_ie8-dom-define');
|
8594 | var gOPD = Object.getOwnPropertyDescriptor;
|
8595 |
|
8596 | exports.f = require('./_descriptors') ? gOPD : function getOwnPropertyDescriptor(O, P) {
|
8597 | O = toIObject(O);
|
8598 | P = toPrimitive(P, true);
|
8599 | if (IE8_DOM_DEFINE) try {
|
8600 | return gOPD(O, P);
|
8601 | } catch (e) { }
|
8602 | if (has(O, P)) return createDesc(!pIE.f.call(O, P), O[P]);
|
8603 | };
|
8604 |
|
8605 | },{"./_descriptors":100,"./_has":108,"./_ie8-dom-define":111,"./_object-pie":138,"./_property-desc":143,"./_to-iobject":155,"./_to-primitive":158}],132:[function(require,module,exports){
|
8606 |
|
8607 | var toIObject = require('./_to-iobject');
|
8608 | var gOPN = require('./_object-gopn').f;
|
8609 | var toString = {}.toString;
|
8610 |
|
8611 | var windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames
|
8612 | ? Object.getOwnPropertyNames(window) : [];
|
8613 |
|
8614 | var getWindowNames = function (it) {
|
8615 | try {
|
8616 | return gOPN(it);
|
8617 | } catch (e) {
|
8618 | return windowNames.slice();
|
8619 | }
|
8620 | };
|
8621 |
|
8622 | module.exports.f = function getOwnPropertyNames(it) {
|
8623 | return windowNames && toString.call(it) == '[object Window]' ? getWindowNames(it) : gOPN(toIObject(it));
|
8624 | };
|
8625 |
|
8626 | },{"./_object-gopn":133,"./_to-iobject":155}],133:[function(require,module,exports){
|
8627 |
|
8628 | var $keys = require('./_object-keys-internal');
|
8629 | var hiddenKeys = require('./_enum-bug-keys').concat('length', 'prototype');
|
8630 |
|
8631 | exports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
|
8632 | return $keys(O, hiddenKeys);
|
8633 | };
|
8634 |
|
8635 | },{"./_enum-bug-keys":102,"./_object-keys-internal":136}],134:[function(require,module,exports){
|
8636 | exports.f = Object.getOwnPropertySymbols;
|
8637 |
|
8638 | },{}],135:[function(require,module,exports){
|
8639 |
|
8640 | var has = require('./_has');
|
8641 | var toObject = require('./_to-object');
|
8642 | var IE_PROTO = require('./_shared-key')('IE_PROTO');
|
8643 | var ObjectProto = Object.prototype;
|
8644 |
|
8645 | module.exports = Object.getPrototypeOf || function (O) {
|
8646 | O = toObject(O);
|
8647 | if (has(O, IE_PROTO)) return O[IE_PROTO];
|
8648 | if (typeof O.constructor == 'function' && O instanceof O.constructor) {
|
8649 | return O.constructor.prototype;
|
8650 | } return O instanceof Object ? ObjectProto : null;
|
8651 | };
|
8652 |
|
8653 | },{"./_has":108,"./_shared-key":148,"./_to-object":157}],136:[function(require,module,exports){
|
8654 | var has = require('./_has');
|
8655 | var toIObject = require('./_to-iobject');
|
8656 | var arrayIndexOf = require('./_array-includes')(false);
|
8657 | var IE_PROTO = require('./_shared-key')('IE_PROTO');
|
8658 |
|
8659 | module.exports = function (object, names) {
|
8660 | var O = toIObject(object);
|
8661 | var i = 0;
|
8662 | var result = [];
|
8663 | var key;
|
8664 | for (key in O) if (key != IE_PROTO) has(O, key) && result.push(key);
|
8665 |
|
8666 | while (names.length > i) if (has(O, key = names[i++])) {
|
8667 | ~arrayIndexOf(result, key) || result.push(key);
|
8668 | }
|
8669 | return result;
|
8670 | };
|
8671 |
|
8672 | },{"./_array-includes":93,"./_has":108,"./_shared-key":148,"./_to-iobject":155}],137:[function(require,module,exports){
|
8673 |
|
8674 | var $keys = require('./_object-keys-internal');
|
8675 | var enumBugKeys = require('./_enum-bug-keys');
|
8676 |
|
8677 | module.exports = Object.keys || function keys(O) {
|
8678 | return $keys(O, enumBugKeys);
|
8679 | };
|
8680 |
|
8681 | },{"./_enum-bug-keys":102,"./_object-keys-internal":136}],138:[function(require,module,exports){
|
8682 | exports.f = {}.propertyIsEnumerable;
|
8683 |
|
8684 | },{}],139:[function(require,module,exports){
|
8685 |
|
8686 | var $export = require('./_export');
|
8687 | var core = require('./_core');
|
8688 | var fails = require('./_fails');
|
8689 | module.exports = function (KEY, exec) {
|
8690 | var fn = (core.Object || {})[KEY] || Object[KEY];
|
8691 | var exp = {};
|
8692 | exp[KEY] = exec(fn);
|
8693 | $export($export.S + $export.F * fails(function () { fn(1); }), 'Object', exp);
|
8694 | };
|
8695 |
|
8696 | },{"./_core":96,"./_export":104,"./_fails":105}],140:[function(require,module,exports){
|
8697 | var getKeys = require('./_object-keys');
|
8698 | var toIObject = require('./_to-iobject');
|
8699 | var isEnum = require('./_object-pie').f;
|
8700 | module.exports = function (isEntries) {
|
8701 | return function (it) {
|
8702 | var O = toIObject(it);
|
8703 | var keys = getKeys(O);
|
8704 | var length = keys.length;
|
8705 | var i = 0;
|
8706 | var result = [];
|
8707 | var key;
|
8708 | while (length > i) if (isEnum.call(O, key = keys[i++])) {
|
8709 | result.push(isEntries ? [key, O[key]] : O[key]);
|
8710 | } return result;
|
8711 | };
|
8712 | };
|
8713 |
|
8714 | },{"./_object-keys":137,"./_object-pie":138,"./_to-iobject":155}],141:[function(require,module,exports){
|
8715 | module.exports = function (exec) {
|
8716 | try {
|
8717 | return { e: false, v: exec() };
|
8718 | } catch (e) {
|
8719 | return { e: true, v: e };
|
8720 | }
|
8721 | };
|
8722 |
|
8723 | },{}],142:[function(require,module,exports){
|
8724 | var anObject = require('./_an-object');
|
8725 | var isObject = require('./_is-object');
|
8726 | var newPromiseCapability = require('./_new-promise-capability');
|
8727 |
|
8728 | module.exports = function (C, x) {
|
8729 | anObject(C);
|
8730 | if (isObject(x) && x.constructor === C) return x;
|
8731 | var promiseCapability = newPromiseCapability.f(C);
|
8732 | var resolve = promiseCapability.resolve;
|
8733 | resolve(x);
|
8734 | return promiseCapability.promise;
|
8735 | };
|
8736 |
|
8737 | },{"./_an-object":92,"./_is-object":116,"./_new-promise-capability":126}],143:[function(require,module,exports){
|
8738 | module.exports = function (bitmap, value) {
|
8739 | return {
|
8740 | enumerable: !(bitmap & 1),
|
8741 | configurable: !(bitmap & 2),
|
8742 | writable: !(bitmap & 4),
|
8743 | value: value
|
8744 | };
|
8745 | };
|
8746 |
|
8747 | },{}],144:[function(require,module,exports){
|
8748 | var hide = require('./_hide');
|
8749 | module.exports = function (target, src, safe) {
|
8750 | for (var key in src) {
|
8751 | if (safe && target[key]) target[key] = src[key];
|
8752 | else hide(target, key, src[key]);
|
8753 | } return target;
|
8754 | };
|
8755 |
|
8756 | },{"./_hide":109}],145:[function(require,module,exports){
|
8757 | module.exports = require('./_hide');
|
8758 |
|
8759 | },{"./_hide":109}],146:[function(require,module,exports){
|
8760 | 'use strict';
|
8761 | var global = require('./_global');
|
8762 | var core = require('./_core');
|
8763 | var dP = require('./_object-dp');
|
8764 | var DESCRIPTORS = require('./_descriptors');
|
8765 | var SPECIES = require('./_wks')('species');
|
8766 |
|
8767 | module.exports = function (KEY) {
|
8768 | var C = typeof core[KEY] == 'function' ? core[KEY] : global[KEY];
|
8769 | if (DESCRIPTORS && C && !C[SPECIES]) dP.f(C, SPECIES, {
|
8770 | configurable: true,
|
8771 | get: function () { return this; }
|
8772 | });
|
8773 | };
|
8774 |
|
8775 | },{"./_core":96,"./_descriptors":100,"./_global":107,"./_object-dp":129,"./_wks":163}],147:[function(require,module,exports){
|
8776 | var def = require('./_object-dp').f;
|
8777 | var has = require('./_has');
|
8778 | var TAG = require('./_wks')('toStringTag');
|
8779 |
|
8780 | module.exports = function (it, tag, stat) {
|
8781 | if (it && !has(it = stat ? it : it.prototype, TAG)) def(it, TAG, { configurable: true, value: tag });
|
8782 | };
|
8783 |
|
8784 | },{"./_has":108,"./_object-dp":129,"./_wks":163}],148:[function(require,module,exports){
|
8785 | var shared = require('./_shared')('keys');
|
8786 | var uid = require('./_uid');
|
8787 | module.exports = function (key) {
|
8788 | return shared[key] || (shared[key] = uid(key));
|
8789 | };
|
8790 |
|
8791 | },{"./_shared":149,"./_uid":159}],149:[function(require,module,exports){
|
8792 | var core = require('./_core');
|
8793 | var global = require('./_global');
|
8794 | var SHARED = '__core-js_shared__';
|
8795 | var store = global[SHARED] || (global[SHARED] = {});
|
8796 |
|
8797 | (module.exports = function (key, value) {
|
8798 | return store[key] || (store[key] = value !== undefined ? value : {});
|
8799 | })('versions', []).push({
|
8800 | version: core.version,
|
8801 | mode: require('./_library') ? 'pure' : 'global',
|
8802 | copyright: '© 2018 Denis Pushkarev (zloirock.ru)'
|
8803 | });
|
8804 |
|
8805 | },{"./_core":96,"./_global":107,"./_library":123}],150:[function(require,module,exports){
|
8806 |
|
8807 | var anObject = require('./_an-object');
|
8808 | var aFunction = require('./_a-function');
|
8809 | var SPECIES = require('./_wks')('species');
|
8810 | module.exports = function (O, D) {
|
8811 | var C = anObject(O).constructor;
|
8812 | var S;
|
8813 | return C === undefined || (S = anObject(C)[SPECIES]) == undefined ? D : aFunction(S);
|
8814 | };
|
8815 |
|
8816 | },{"./_a-function":89,"./_an-object":92,"./_wks":163}],151:[function(require,module,exports){
|
8817 | var toInteger = require('./_to-integer');
|
8818 | var defined = require('./_defined');
|
8819 |
|
8820 |
|
8821 | module.exports = function (TO_STRING) {
|
8822 | return function (that, pos) {
|
8823 | var s = String(defined(that));
|
8824 | var i = toInteger(pos);
|
8825 | var l = s.length;
|
8826 | var a, b;
|
8827 | if (i < 0 || i >= l) return TO_STRING ? '' : undefined;
|
8828 | a = s.charCodeAt(i);
|
8829 | return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff
|
8830 | ? TO_STRING ? s.charAt(i) : a
|
8831 | : TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000;
|
8832 | };
|
8833 | };
|
8834 |
|
8835 | },{"./_defined":99,"./_to-integer":154}],152:[function(require,module,exports){
|
8836 | var ctx = require('./_ctx');
|
8837 | var invoke = require('./_invoke');
|
8838 | var html = require('./_html');
|
8839 | var cel = require('./_dom-create');
|
8840 | var global = require('./_global');
|
8841 | var process = global.process;
|
8842 | var setTask = global.setImmediate;
|
8843 | var clearTask = global.clearImmediate;
|
8844 | var MessageChannel = global.MessageChannel;
|
8845 | var Dispatch = global.Dispatch;
|
8846 | var counter = 0;
|
8847 | var queue = {};
|
8848 | var ONREADYSTATECHANGE = 'onreadystatechange';
|
8849 | var defer, channel, port;
|
8850 | var run = function () {
|
8851 | var id = +this;
|
8852 |
|
8853 | if (queue.hasOwnProperty(id)) {
|
8854 | var fn = queue[id];
|
8855 | delete queue[id];
|
8856 | fn();
|
8857 | }
|
8858 | };
|
8859 | var listener = function (event) {
|
8860 | run.call(event.data);
|
8861 | };
|
8862 |
|
8863 | if (!setTask || !clearTask) {
|
8864 | setTask = function setImmediate(fn) {
|
8865 | var args = [];
|
8866 | var i = 1;
|
8867 | while (arguments.length > i) args.push(arguments[i++]);
|
8868 | queue[++counter] = function () {
|
8869 |
|
8870 | invoke(typeof fn == 'function' ? fn : Function(fn), args);
|
8871 | };
|
8872 | defer(counter);
|
8873 | return counter;
|
8874 | };
|
8875 | clearTask = function clearImmediate(id) {
|
8876 | delete queue[id];
|
8877 | };
|
8878 |
|
8879 | if (require('./_cof')(process) == 'process') {
|
8880 | defer = function (id) {
|
8881 | process.nextTick(ctx(run, id, 1));
|
8882 | };
|
8883 |
|
8884 | } else if (Dispatch && Dispatch.now) {
|
8885 | defer = function (id) {
|
8886 | Dispatch.now(ctx(run, id, 1));
|
8887 | };
|
8888 |
|
8889 | } else if (MessageChannel) {
|
8890 | channel = new MessageChannel();
|
8891 | port = channel.port2;
|
8892 | channel.port1.onmessage = listener;
|
8893 | defer = ctx(port.postMessage, port, 1);
|
8894 |
|
8895 |
|
8896 | } else if (global.addEventListener && typeof postMessage == 'function' && !global.importScripts) {
|
8897 | defer = function (id) {
|
8898 | global.postMessage(id + '', '*');
|
8899 | };
|
8900 | global.addEventListener('message', listener, false);
|
8901 |
|
8902 | } else if (ONREADYSTATECHANGE in cel('script')) {
|
8903 | defer = function (id) {
|
8904 | html.appendChild(cel('script'))[ONREADYSTATECHANGE] = function () {
|
8905 | html.removeChild(this);
|
8906 | run.call(id);
|
8907 | };
|
8908 | };
|
8909 |
|
8910 | } else {
|
8911 | defer = function (id) {
|
8912 | setTimeout(ctx(run, id, 1), 0);
|
8913 | };
|
8914 | }
|
8915 | }
|
8916 | module.exports = {
|
8917 | set: setTask,
|
8918 | clear: clearTask
|
8919 | };
|
8920 |
|
8921 | },{"./_cof":95,"./_ctx":98,"./_dom-create":101,"./_global":107,"./_html":110,"./_invoke":112}],153:[function(require,module,exports){
|
8922 | var toInteger = require('./_to-integer');
|
8923 | var max = Math.max;
|
8924 | var min = Math.min;
|
8925 | module.exports = function (index, length) {
|
8926 | index = toInteger(index);
|
8927 | return index < 0 ? max(index + length, 0) : min(index, length);
|
8928 | };
|
8929 |
|
8930 | },{"./_to-integer":154}],154:[function(require,module,exports){
|
8931 |
|
8932 | var ceil = Math.ceil;
|
8933 | var floor = Math.floor;
|
8934 | module.exports = function (it) {
|
8935 | return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);
|
8936 | };
|
8937 |
|
8938 | },{}],155:[function(require,module,exports){
|
8939 |
|
8940 | var IObject = require('./_iobject');
|
8941 | var defined = require('./_defined');
|
8942 | module.exports = function (it) {
|
8943 | return IObject(defined(it));
|
8944 | };
|
8945 |
|
8946 | },{"./_defined":99,"./_iobject":113}],156:[function(require,module,exports){
|
8947 |
|
8948 | var toInteger = require('./_to-integer');
|
8949 | var min = Math.min;
|
8950 | module.exports = function (it) {
|
8951 | return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0;
|
8952 | };
|
8953 |
|
8954 | },{"./_to-integer":154}],157:[function(require,module,exports){
|
8955 |
|
8956 | var defined = require('./_defined');
|
8957 | module.exports = function (it) {
|
8958 | return Object(defined(it));
|
8959 | };
|
8960 |
|
8961 | },{"./_defined":99}],158:[function(require,module,exports){
|
8962 |
|
8963 | var isObject = require('./_is-object');
|
8964 |
|
8965 |
|
8966 | module.exports = function (it, S) {
|
8967 | if (!isObject(it)) return it;
|
8968 | var fn, val;
|
8969 | if (S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;
|
8970 | if (typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it))) return val;
|
8971 | if (!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;
|
8972 | throw TypeError("Can't convert object to primitive value");
|
8973 | };
|
8974 |
|
8975 | },{"./_is-object":116}],159:[function(require,module,exports){
|
8976 | var id = 0;
|
8977 | var px = Math.random();
|
8978 | module.exports = function (key) {
|
8979 | return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));
|
8980 | };
|
8981 |
|
8982 | },{}],160:[function(require,module,exports){
|
8983 | var global = require('./_global');
|
8984 | var navigator = global.navigator;
|
8985 |
|
8986 | module.exports = navigator && navigator.userAgent || '';
|
8987 |
|
8988 | },{"./_global":107}],161:[function(require,module,exports){
|
8989 | var global = require('./_global');
|
8990 | var core = require('./_core');
|
8991 | var LIBRARY = require('./_library');
|
8992 | var wksExt = require('./_wks-ext');
|
8993 | var defineProperty = require('./_object-dp').f;
|
8994 | module.exports = function (name) {
|
8995 | var $Symbol = core.Symbol || (core.Symbol = LIBRARY ? {} : global.Symbol || {});
|
8996 | if (name.charAt(0) != '_' && !(name in $Symbol)) defineProperty($Symbol, name, { value: wksExt.f(name) });
|
8997 | };
|
8998 |
|
8999 | },{"./_core":96,"./_global":107,"./_library":123,"./_object-dp":129,"./_wks-ext":162}],162:[function(require,module,exports){
|
9000 | exports.f = require('./_wks');
|
9001 |
|
9002 | },{"./_wks":163}],163:[function(require,module,exports){
|
9003 | var store = require('./_shared')('wks');
|
9004 | var uid = require('./_uid');
|
9005 | var Symbol = require('./_global').Symbol;
|
9006 | var USE_SYMBOL = typeof Symbol == 'function';
|
9007 |
|
9008 | var $exports = module.exports = function (name) {
|
9009 | return store[name] || (store[name] =
|
9010 | USE_SYMBOL && Symbol[name] || (USE_SYMBOL ? Symbol : uid)('Symbol.' + name));
|
9011 | };
|
9012 |
|
9013 | $exports.store = store;
|
9014 |
|
9015 | },{"./_global":107,"./_shared":149,"./_uid":159}],164:[function(require,module,exports){
|
9016 | var classof = require('./_classof');
|
9017 | var ITERATOR = require('./_wks')('iterator');
|
9018 | var Iterators = require('./_iterators');
|
9019 | module.exports = require('./_core').getIteratorMethod = function (it) {
|
9020 | if (it != undefined) return it[ITERATOR]
|
9021 | || it['@@iterator']
|
9022 | || Iterators[classof(it)];
|
9023 | };
|
9024 |
|
9025 | },{"./_classof":94,"./_core":96,"./_iterators":122,"./_wks":163}],165:[function(require,module,exports){
|
9026 | 'use strict';
|
9027 | var ctx = require('./_ctx');
|
9028 | var $export = require('./_export');
|
9029 | var toObject = require('./_to-object');
|
9030 | var call = require('./_iter-call');
|
9031 | var isArrayIter = require('./_is-array-iter');
|
9032 | var toLength = require('./_to-length');
|
9033 | var createProperty = require('./_create-property');
|
9034 | var getIterFn = require('./core.get-iterator-method');
|
9035 |
|
9036 | $export($export.S + $export.F * !require('./_iter-detect')(function (iter) { Array.from(iter); }), 'Array', {
|
9037 |
|
9038 | from: function from(arrayLike /* , mapfn = undefined, thisArg = undefined */) {
|
9039 | var O = toObject(arrayLike);
|
9040 | var C = typeof this == 'function' ? this : Array;
|
9041 | var aLen = arguments.length;
|
9042 | var mapfn = aLen > 1 ? arguments[1] : undefined;
|
9043 | var mapping = mapfn !== undefined;
|
9044 | var index = 0;
|
9045 | var iterFn = getIterFn(O);
|
9046 | var length, result, step, iterator;
|
9047 | if (mapping) mapfn = ctx(mapfn, aLen > 2 ? arguments[2] : undefined, 2);
|
9048 |
|
9049 | if (iterFn != undefined && !(C == Array && isArrayIter(iterFn))) {
|
9050 | for (iterator = iterFn.call(O), result = new C(); !(step = iterator.next()).done; index++) {
|
9051 | createProperty(result, index, mapping ? call(iterator, mapfn, [step.value, index], true) : step.value);
|
9052 | }
|
9053 | } else {
|
9054 | length = toLength(O.length);
|
9055 | for (result = new C(length); length > index; index++) {
|
9056 | createProperty(result, index, mapping ? mapfn(O[index], index) : O[index]);
|
9057 | }
|
9058 | }
|
9059 | result.length = index;
|
9060 | return result;
|
9061 | }
|
9062 | });
|
9063 |
|
9064 | },{"./_create-property":97,"./_ctx":98,"./_export":104,"./_is-array-iter":114,"./_iter-call":117,"./_iter-detect":120,"./_to-length":156,"./_to-object":157,"./core.get-iterator-method":164}],166:[function(require,module,exports){
|
9065 | 'use strict';
|
9066 | var addToUnscopables = require('./_add-to-unscopables');
|
9067 | var step = require('./_iter-step');
|
9068 | var Iterators = require('./_iterators');
|
9069 | var toIObject = require('./_to-iobject');
|
9070 |
|
9071 |
|
9072 |
|
9073 |
|
9074 |
|
9075 | module.exports = require('./_iter-define')(Array, 'Array', function (iterated, kind) {
|
9076 | this._t = toIObject(iterated);
|
9077 | this._i = 0;
|
9078 | this._k = kind;
|
9079 |
|
9080 | }, function () {
|
9081 | var O = this._t;
|
9082 | var kind = this._k;
|
9083 | var index = this._i++;
|
9084 | if (!O || index >= O.length) {
|
9085 | this._t = undefined;
|
9086 | return step(1);
|
9087 | }
|
9088 | if (kind == 'keys') return step(0, index);
|
9089 | if (kind == 'values') return step(0, O[index]);
|
9090 | return step(0, [index, O[index]]);
|
9091 | }, 'values');
|
9092 |
|
9093 |
|
9094 | Iterators.Arguments = Iterators.Array;
|
9095 |
|
9096 | addToUnscopables('keys');
|
9097 | addToUnscopables('values');
|
9098 | addToUnscopables('entries');
|
9099 |
|
9100 | },{"./_add-to-unscopables":90,"./_iter-define":119,"./_iter-step":121,"./_iterators":122,"./_to-iobject":155}],167:[function(require,module,exports){
|
9101 | 'use strict';
|
9102 | var isObject = require('./_is-object');
|
9103 | var getPrototypeOf = require('./_object-gpo');
|
9104 | var HAS_INSTANCE = require('./_wks')('hasInstance');
|
9105 | var FunctionProto = Function.prototype;
|
9106 |
|
9107 | if (!(HAS_INSTANCE in FunctionProto)) require('./_object-dp').f(FunctionProto, HAS_INSTANCE, { value: function (O) {
|
9108 | if (typeof this != 'function' || !isObject(O)) return false;
|
9109 | if (!isObject(this.prototype)) return O instanceof this;
|
9110 |
|
9111 | while (O = getPrototypeOf(O)) if (this.prototype === O) return true;
|
9112 | return false;
|
9113 | } });
|
9114 |
|
9115 | },{"./_is-object":116,"./_object-dp":129,"./_object-gpo":135,"./_wks":163}],168:[function(require,module,exports){
|
9116 |
|
9117 | var $export = require('./_export');
|
9118 |
|
9119 | $export($export.S + $export.F, 'Object', { assign: require('./_object-assign') });
|
9120 |
|
9121 | },{"./_export":104,"./_object-assign":127}],169:[function(require,module,exports){
|
9122 | var $export = require('./_export');
|
9123 |
|
9124 | $export($export.S, 'Object', { create: require('./_object-create') });
|
9125 |
|
9126 | },{"./_export":104,"./_object-create":128}],170:[function(require,module,exports){
|
9127 | var $export = require('./_export');
|
9128 |
|
9129 | $export($export.S + $export.F * !require('./_descriptors'), 'Object', { defineProperty: require('./_object-dp').f });
|
9130 |
|
9131 | },{"./_descriptors":100,"./_export":104,"./_object-dp":129}],171:[function(require,module,exports){
|
9132 |
|
9133 | require('./_object-sap')('getOwnPropertyNames', function () {
|
9134 | return require('./_object-gopn-ext').f;
|
9135 | });
|
9136 |
|
9137 | },{"./_object-gopn-ext":132,"./_object-sap":139}],172:[function(require,module,exports){
|
9138 |
|
9139 | var toObject = require('./_to-object');
|
9140 | var $getPrototypeOf = require('./_object-gpo');
|
9141 |
|
9142 | require('./_object-sap')('getPrototypeOf', function () {
|
9143 | return function getPrototypeOf(it) {
|
9144 | return $getPrototypeOf(toObject(it));
|
9145 | };
|
9146 | });
|
9147 |
|
9148 | },{"./_object-gpo":135,"./_object-sap":139,"./_to-object":157}],173:[function(require,module,exports){
|
9149 |
|
9150 | var toObject = require('./_to-object');
|
9151 | var $keys = require('./_object-keys');
|
9152 |
|
9153 | require('./_object-sap')('keys', function () {
|
9154 | return function keys(it) {
|
9155 | return $keys(toObject(it));
|
9156 | };
|
9157 | });
|
9158 |
|
9159 | },{"./_object-keys":137,"./_object-sap":139,"./_to-object":157}],174:[function(require,module,exports){
|
9160 | arguments[4][68][0].apply(exports,arguments)
|
9161 | },{"dup":68}],175:[function(require,module,exports){
|
9162 | 'use strict';
|
9163 | var LIBRARY = require('./_library');
|
9164 | var global = require('./_global');
|
9165 | var ctx = require('./_ctx');
|
9166 | var classof = require('./_classof');
|
9167 | var $export = require('./_export');
|
9168 | var isObject = require('./_is-object');
|
9169 | var aFunction = require('./_a-function');
|
9170 | var anInstance = require('./_an-instance');
|
9171 | var forOf = require('./_for-of');
|
9172 | var speciesConstructor = require('./_species-constructor');
|
9173 | var task = require('./_task').set;
|
9174 | var microtask = require('./_microtask')();
|
9175 | var newPromiseCapabilityModule = require('./_new-promise-capability');
|
9176 | var perform = require('./_perform');
|
9177 | var userAgent = require('./_user-agent');
|
9178 | var promiseResolve = require('./_promise-resolve');
|
9179 | var PROMISE = 'Promise';
|
9180 | var TypeError = global.TypeError;
|
9181 | var process = global.process;
|
9182 | var versions = process && process.versions;
|
9183 | var v8 = versions && versions.v8 || '';
|
9184 | var $Promise = global[PROMISE];
|
9185 | var isNode = classof(process) == 'process';
|
9186 | var empty = function () { };
|
9187 | var Internal, newGenericPromiseCapability, OwnPromiseCapability, Wrapper;
|
9188 | var newPromiseCapability = newGenericPromiseCapability = newPromiseCapabilityModule.f;
|
9189 |
|
9190 | var USE_NATIVE = !!function () {
|
9191 | try {
|
9192 |
|
9193 | var promise = $Promise.resolve(1);
|
9194 | var FakePromise = (promise.constructor = {})[require('./_wks')('species')] = function (exec) {
|
9195 | exec(empty, empty);
|
9196 | };
|
9197 |
|
9198 | return (isNode || typeof PromiseRejectionEvent == 'function')
|
9199 | && promise.then(empty) instanceof FakePromise
|
9200 |
|
9201 |
|
9202 |
|
9203 | && v8.indexOf('6.6') !== 0
|
9204 | && userAgent.indexOf('Chrome/66') === -1;
|
9205 | } catch (e) { }
|
9206 | }();
|
9207 |
|
9208 |
|
9209 | var isThenable = function (it) {
|
9210 | var then;
|
9211 | return isObject(it) && typeof (then = it.then) == 'function' ? then : false;
|
9212 | };
|
9213 | var notify = function (promise, isReject) {
|
9214 | if (promise._n) return;
|
9215 | promise._n = true;
|
9216 | var chain = promise._c;
|
9217 | microtask(function () {
|
9218 | var value = promise._v;
|
9219 | var ok = promise._s == 1;
|
9220 | var i = 0;
|
9221 | var run = function (reaction) {
|
9222 | var handler = ok ? reaction.ok : reaction.fail;
|
9223 | var resolve = reaction.resolve;
|
9224 | var reject = reaction.reject;
|
9225 | var domain = reaction.domain;
|
9226 | var result, then, exited;
|
9227 | try {
|
9228 | if (handler) {
|
9229 | if (!ok) {
|
9230 | if (promise._h == 2) onHandleUnhandled(promise);
|
9231 | promise._h = 1;
|
9232 | }
|
9233 | if (handler === true) result = value;
|
9234 | else {
|
9235 | if (domain) domain.enter();
|
9236 | result = handler(value);
|
9237 | if (domain) {
|
9238 | domain.exit();
|
9239 | exited = true;
|
9240 | }
|
9241 | }
|
9242 | if (result === reaction.promise) {
|
9243 | reject(TypeError('Promise-chain cycle'));
|
9244 | } else if (then = isThenable(result)) {
|
9245 | then.call(result, resolve, reject);
|
9246 | } else resolve(result);
|
9247 | } else reject(value);
|
9248 | } catch (e) {
|
9249 | if (domain && !exited) domain.exit();
|
9250 | reject(e);
|
9251 | }
|
9252 | };
|
9253 | while (chain.length > i) run(chain[i++]);
|
9254 | promise._c = [];
|
9255 | promise._n = false;
|
9256 | if (isReject && !promise._h) onUnhandled(promise);
|
9257 | });
|
9258 | };
|
9259 | var onUnhandled = function (promise) {
|
9260 | task.call(global, function () {
|
9261 | var value = promise._v;
|
9262 | var unhandled = isUnhandled(promise);
|
9263 | var result, handler, console;
|
9264 | if (unhandled) {
|
9265 | result = perform(function () {
|
9266 | if (isNode) {
|
9267 | process.emit('unhandledRejection', value, promise);
|
9268 | } else if (handler = global.onunhandledrejection) {
|
9269 | handler({ promise: promise, reason: value });
|
9270 | } else if ((console = global.console) && console.error) {
|
9271 | console.error('Unhandled promise rejection', value);
|
9272 | }
|
9273 | });
|
9274 |
|
9275 | promise._h = isNode || isUnhandled(promise) ? 2 : 1;
|
9276 | } promise._a = undefined;
|
9277 | if (unhandled && result.e) throw result.v;
|
9278 | });
|
9279 | };
|
9280 | var isUnhandled = function (promise) {
|
9281 | return promise._h !== 1 && (promise._a || promise._c).length === 0;
|
9282 | };
|
9283 | var onHandleUnhandled = function (promise) {
|
9284 | task.call(global, function () {
|
9285 | var handler;
|
9286 | if (isNode) {
|
9287 | process.emit('rejectionHandled', promise);
|
9288 | } else if (handler = global.onrejectionhandled) {
|
9289 | handler({ promise: promise, reason: promise._v });
|
9290 | }
|
9291 | });
|
9292 | };
|
9293 | var $reject = function (value) {
|
9294 | var promise = this;
|
9295 | if (promise._d) return;
|
9296 | promise._d = true;
|
9297 | promise = promise._w || promise;
|
9298 | promise._v = value;
|
9299 | promise._s = 2;
|
9300 | if (!promise._a) promise._a = promise._c.slice();
|
9301 | notify(promise, true);
|
9302 | };
|
9303 | var $resolve = function (value) {
|
9304 | var promise = this;
|
9305 | var then;
|
9306 | if (promise._d) return;
|
9307 | promise._d = true;
|
9308 | promise = promise._w || promise;
|
9309 | try {
|
9310 | if (promise === value) throw TypeError("Promise can't be resolved itself");
|
9311 | if (then = isThenable(value)) {
|
9312 | microtask(function () {
|
9313 | var wrapper = { _w: promise, _d: false };
|
9314 | try {
|
9315 | then.call(value, ctx($resolve, wrapper, 1), ctx($reject, wrapper, 1));
|
9316 | } catch (e) {
|
9317 | $reject.call(wrapper, e);
|
9318 | }
|
9319 | });
|
9320 | } else {
|
9321 | promise._v = value;
|
9322 | promise._s = 1;
|
9323 | notify(promise, false);
|
9324 | }
|
9325 | } catch (e) {
|
9326 | $reject.call({ _w: promise, _d: false }, e);
|
9327 | }
|
9328 | };
|
9329 |
|
9330 |
|
9331 | if (!USE_NATIVE) {
|
9332 |
|
9333 | $Promise = function Promise(executor) {
|
9334 | anInstance(this, $Promise, PROMISE, '_h');
|
9335 | aFunction(executor);
|
9336 | Internal.call(this);
|
9337 | try {
|
9338 | executor(ctx($resolve, this, 1), ctx($reject, this, 1));
|
9339 | } catch (err) {
|
9340 | $reject.call(this, err);
|
9341 | }
|
9342 | };
|
9343 |
|
9344 | Internal = function Promise(executor) {
|
9345 | this._c = [];
|
9346 | this._a = undefined;
|
9347 | this._s = 0;
|
9348 | this._d = false;
|
9349 | this._v = undefined;
|
9350 | this._h = 0;
|
9351 | this._n = false;
|
9352 | };
|
9353 | Internal.prototype = require('./_redefine-all')($Promise.prototype, {
|
9354 |
|
9355 | then: function then(onFulfilled, onRejected) {
|
9356 | var reaction = newPromiseCapability(speciesConstructor(this, $Promise));
|
9357 | reaction.ok = typeof onFulfilled == 'function' ? onFulfilled : true;
|
9358 | reaction.fail = typeof onRejected == 'function' && onRejected;
|
9359 | reaction.domain = isNode ? process.domain : undefined;
|
9360 | this._c.push(reaction);
|
9361 | if (this._a) this._a.push(reaction);
|
9362 | if (this._s) notify(this, false);
|
9363 | return reaction.promise;
|
9364 | },
|
9365 |
|
9366 | 'catch': function (onRejected) {
|
9367 | return this.then(undefined, onRejected);
|
9368 | }
|
9369 | });
|
9370 | OwnPromiseCapability = function () {
|
9371 | var promise = new Internal();
|
9372 | this.promise = promise;
|
9373 | this.resolve = ctx($resolve, promise, 1);
|
9374 | this.reject = ctx($reject, promise, 1);
|
9375 | };
|
9376 | newPromiseCapabilityModule.f = newPromiseCapability = function (C) {
|
9377 | return C === $Promise || C === Wrapper
|
9378 | ? new OwnPromiseCapability(C)
|
9379 | : newGenericPromiseCapability(C);
|
9380 | };
|
9381 | }
|
9382 |
|
9383 | $export($export.G + $export.W + $export.F * !USE_NATIVE, { Promise: $Promise });
|
9384 | require('./_set-to-string-tag')($Promise, PROMISE);
|
9385 | require('./_set-species')(PROMISE);
|
9386 | Wrapper = require('./_core')[PROMISE];
|
9387 |
|
9388 |
|
9389 | $export($export.S + $export.F * !USE_NATIVE, PROMISE, {
|
9390 |
|
9391 | reject: function reject(r) {
|
9392 | var capability = newPromiseCapability(this);
|
9393 | var $$reject = capability.reject;
|
9394 | $$reject(r);
|
9395 | return capability.promise;
|
9396 | }
|
9397 | });
|
9398 | $export($export.S + $export.F * (LIBRARY || !USE_NATIVE), PROMISE, {
|
9399 |
|
9400 | resolve: function resolve(x) {
|
9401 | return promiseResolve(LIBRARY && this === Wrapper ? $Promise : this, x);
|
9402 | }
|
9403 | });
|
9404 | $export($export.S + $export.F * !(USE_NATIVE && require('./_iter-detect')(function (iter) {
|
9405 | $Promise.all(iter)['catch'](empty);
|
9406 | })), PROMISE, {
|
9407 |
|
9408 | all: function all(iterable) {
|
9409 | var C = this;
|
9410 | var capability = newPromiseCapability(C);
|
9411 | var resolve = capability.resolve;
|
9412 | var reject = capability.reject;
|
9413 | var result = perform(function () {
|
9414 | var values = [];
|
9415 | var index = 0;
|
9416 | var remaining = 1;
|
9417 | forOf(iterable, false, function (promise) {
|
9418 | var $index = index++;
|
9419 | var alreadyCalled = false;
|
9420 | values.push(undefined);
|
9421 | remaining++;
|
9422 | C.resolve(promise).then(function (value) {
|
9423 | if (alreadyCalled) return;
|
9424 | alreadyCalled = true;
|
9425 | values[$index] = value;
|
9426 | --remaining || resolve(values);
|
9427 | }, reject);
|
9428 | });
|
9429 | --remaining || resolve(values);
|
9430 | });
|
9431 | if (result.e) reject(result.v);
|
9432 | return capability.promise;
|
9433 | },
|
9434 |
|
9435 | race: function race(iterable) {
|
9436 | var C = this;
|
9437 | var capability = newPromiseCapability(C);
|
9438 | var reject = capability.reject;
|
9439 | var result = perform(function () {
|
9440 | forOf(iterable, false, function (promise) {
|
9441 | C.resolve(promise).then(capability.resolve, reject);
|
9442 | });
|
9443 | });
|
9444 | if (result.e) reject(result.v);
|
9445 | return capability.promise;
|
9446 | }
|
9447 | });
|
9448 |
|
9449 | },{"./_a-function":89,"./_an-instance":91,"./_classof":94,"./_core":96,"./_ctx":98,"./_export":104,"./_for-of":106,"./_global":107,"./_is-object":116,"./_iter-detect":120,"./_library":123,"./_microtask":125,"./_new-promise-capability":126,"./_perform":141,"./_promise-resolve":142,"./_redefine-all":144,"./_set-species":146,"./_set-to-string-tag":147,"./_species-constructor":150,"./_task":152,"./_user-agent":160,"./_wks":163}],176:[function(require,module,exports){
|
9450 | var $export = require('./_export');
|
9451 | var toAbsoluteIndex = require('./_to-absolute-index');
|
9452 | var fromCharCode = String.fromCharCode;
|
9453 | var $fromCodePoint = String.fromCodePoint;
|
9454 |
|
9455 |
|
9456 | $export($export.S + $export.F * (!!$fromCodePoint && $fromCodePoint.length != 1), 'String', {
|
9457 |
|
9458 | fromCodePoint: function fromCodePoint(x) {
|
9459 | var res = [];
|
9460 | var aLen = arguments.length;
|
9461 | var i = 0;
|
9462 | var code;
|
9463 | while (aLen > i) {
|
9464 | code = +arguments[i++];
|
9465 | if (toAbsoluteIndex(code, 0x10ffff) !== code) throw RangeError(code + ' is not a valid code point');
|
9466 | res.push(code < 0x10000
|
9467 | ? fromCharCode(code)
|
9468 | : fromCharCode(((code -= 0x10000) >> 10) + 0xd800, code % 0x400 + 0xdc00)
|
9469 | );
|
9470 | } return res.join('');
|
9471 | }
|
9472 | });
|
9473 |
|
9474 | },{"./_export":104,"./_to-absolute-index":153}],177:[function(require,module,exports){
|
9475 | 'use strict';
|
9476 | var $at = require('./_string-at')(true);
|
9477 |
|
9478 |
|
9479 | require('./_iter-define')(String, 'String', function (iterated) {
|
9480 | this._t = String(iterated);
|
9481 | this._i = 0;
|
9482 |
|
9483 | }, function () {
|
9484 | var O = this._t;
|
9485 | var index = this._i;
|
9486 | var point;
|
9487 | if (index >= O.length) return { value: undefined, done: true };
|
9488 | point = $at(O, index);
|
9489 | this._i += point.length;
|
9490 | return { value: point, done: false };
|
9491 | });
|
9492 |
|
9493 | },{"./_iter-define":119,"./_string-at":151}],178:[function(require,module,exports){
|
9494 | 'use strict';
|
9495 |
|
9496 | var global = require('./_global');
|
9497 | var has = require('./_has');
|
9498 | var DESCRIPTORS = require('./_descriptors');
|
9499 | var $export = require('./_export');
|
9500 | var redefine = require('./_redefine');
|
9501 | var META = require('./_meta').KEY;
|
9502 | var $fails = require('./_fails');
|
9503 | var shared = require('./_shared');
|
9504 | var setToStringTag = require('./_set-to-string-tag');
|
9505 | var uid = require('./_uid');
|
9506 | var wks = require('./_wks');
|
9507 | var wksExt = require('./_wks-ext');
|
9508 | var wksDefine = require('./_wks-define');
|
9509 | var enumKeys = require('./_enum-keys');
|
9510 | var isArray = require('./_is-array');
|
9511 | var anObject = require('./_an-object');
|
9512 | var isObject = require('./_is-object');
|
9513 | var toIObject = require('./_to-iobject');
|
9514 | var toPrimitive = require('./_to-primitive');
|
9515 | var createDesc = require('./_property-desc');
|
9516 | var _create = require('./_object-create');
|
9517 | var gOPNExt = require('./_object-gopn-ext');
|
9518 | var $GOPD = require('./_object-gopd');
|
9519 | var $DP = require('./_object-dp');
|
9520 | var $keys = require('./_object-keys');
|
9521 | var gOPD = $GOPD.f;
|
9522 | var dP = $DP.f;
|
9523 | var gOPN = gOPNExt.f;
|
9524 | var $Symbol = global.Symbol;
|
9525 | var $JSON = global.JSON;
|
9526 | var _stringify = $JSON && $JSON.stringify;
|
9527 | var PROTOTYPE = 'prototype';
|
9528 | var HIDDEN = wks('_hidden');
|
9529 | var TO_PRIMITIVE = wks('toPrimitive');
|
9530 | var isEnum = {}.propertyIsEnumerable;
|
9531 | var SymbolRegistry = shared('symbol-registry');
|
9532 | var AllSymbols = shared('symbols');
|
9533 | var OPSymbols = shared('op-symbols');
|
9534 | var ObjectProto = Object[PROTOTYPE];
|
9535 | var USE_NATIVE = typeof $Symbol == 'function';
|
9536 | var QObject = global.QObject;
|
9537 |
|
9538 | var setter = !QObject || !QObject[PROTOTYPE] || !QObject[PROTOTYPE].findChild;
|
9539 |
|
9540 |
|
9541 | var setSymbolDesc = DESCRIPTORS && $fails(function () {
|
9542 | return _create(dP({}, 'a', {
|
9543 | get: function () { return dP(this, 'a', { value: 7 }).a; }
|
9544 | })).a != 7;
|
9545 | }) ? function (it, key, D) {
|
9546 | var protoDesc = gOPD(ObjectProto, key);
|
9547 | if (protoDesc) delete ObjectProto[key];
|
9548 | dP(it, key, D);
|
9549 | if (protoDesc && it !== ObjectProto) dP(ObjectProto, key, protoDesc);
|
9550 | } : dP;
|
9551 |
|
9552 | var wrap = function (tag) {
|
9553 | var sym = AllSymbols[tag] = _create($Symbol[PROTOTYPE]);
|
9554 | sym._k = tag;
|
9555 | return sym;
|
9556 | };
|
9557 |
|
9558 | var isSymbol = USE_NATIVE && typeof $Symbol.iterator == 'symbol' ? function (it) {
|
9559 | return typeof it == 'symbol';
|
9560 | } : function (it) {
|
9561 | return it instanceof $Symbol;
|
9562 | };
|
9563 |
|
9564 | var $defineProperty = function defineProperty(it, key, D) {
|
9565 | if (it === ObjectProto) $defineProperty(OPSymbols, key, D);
|
9566 | anObject(it);
|
9567 | key = toPrimitive(key, true);
|
9568 | anObject(D);
|
9569 | if (has(AllSymbols, key)) {
|
9570 | if (!D.enumerable) {
|
9571 | if (!has(it, HIDDEN)) dP(it, HIDDEN, createDesc(1, {}));
|
9572 | it[HIDDEN][key] = true;
|
9573 | } else {
|
9574 | if (has(it, HIDDEN) && it[HIDDEN][key]) it[HIDDEN][key] = false;
|
9575 | D = _create(D, { enumerable: createDesc(0, false) });
|
9576 | } return setSymbolDesc(it, key, D);
|
9577 | } return dP(it, key, D);
|
9578 | };
|
9579 | var $defineProperties = function defineProperties(it, P) {
|
9580 | anObject(it);
|
9581 | var keys = enumKeys(P = toIObject(P));
|
9582 | var i = 0;
|
9583 | var l = keys.length;
|
9584 | var key;
|
9585 | while (l > i) $defineProperty(it, key = keys[i++], P[key]);
|
9586 | return it;
|
9587 | };
|
9588 | var $create = function create(it, P) {
|
9589 | return P === undefined ? _create(it) : $defineProperties(_create(it), P);
|
9590 | };
|
9591 | var $propertyIsEnumerable = function propertyIsEnumerable(key) {
|
9592 | var E = isEnum.call(this, key = toPrimitive(key, true));
|
9593 | if (this === ObjectProto && has(AllSymbols, key) && !has(OPSymbols, key)) return false;
|
9594 | return E || !has(this, key) || !has(AllSymbols, key) || has(this, HIDDEN) && this[HIDDEN][key] ? E : true;
|
9595 | };
|
9596 | var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(it, key) {
|
9597 | it = toIObject(it);
|
9598 | key = toPrimitive(key, true);
|
9599 | if (it === ObjectProto && has(AllSymbols, key) && !has(OPSymbols, key)) return;
|
9600 | var D = gOPD(it, key);
|
9601 | if (D && has(AllSymbols, key) && !(has(it, HIDDEN) && it[HIDDEN][key])) D.enumerable = true;
|
9602 | return D;
|
9603 | };
|
9604 | var $getOwnPropertyNames = function getOwnPropertyNames(it) {
|
9605 | var names = gOPN(toIObject(it));
|
9606 | var result = [];
|
9607 | var i = 0;
|
9608 | var key;
|
9609 | while (names.length > i) {
|
9610 | if (!has(AllSymbols, key = names[i++]) && key != HIDDEN && key != META) result.push(key);
|
9611 | } return result;
|
9612 | };
|
9613 | var $getOwnPropertySymbols = function getOwnPropertySymbols(it) {
|
9614 | var IS_OP = it === ObjectProto;
|
9615 | var names = gOPN(IS_OP ? OPSymbols : toIObject(it));
|
9616 | var result = [];
|
9617 | var i = 0;
|
9618 | var key;
|
9619 | while (names.length > i) {
|
9620 | if (has(AllSymbols, key = names[i++]) && (IS_OP ? has(ObjectProto, key) : true)) result.push(AllSymbols[key]);
|
9621 | } return result;
|
9622 | };
|
9623 |
|
9624 |
|
9625 | if (!USE_NATIVE) {
|
9626 | $Symbol = function Symbol() {
|
9627 | if (this instanceof $Symbol) throw TypeError('Symbol is not a constructor!');
|
9628 | var tag = uid(arguments.length > 0 ? arguments[0] : undefined);
|
9629 | var $set = function (value) {
|
9630 | if (this === ObjectProto) $set.call(OPSymbols, value);
|
9631 | if (has(this, HIDDEN) && has(this[HIDDEN], tag)) this[HIDDEN][tag] = false;
|
9632 | setSymbolDesc(this, tag, createDesc(1, value));
|
9633 | };
|
9634 | if (DESCRIPTORS && setter) setSymbolDesc(ObjectProto, tag, { configurable: true, set: $set });
|
9635 | return wrap(tag);
|
9636 | };
|
9637 | redefine($Symbol[PROTOTYPE], 'toString', function toString() {
|
9638 | return this._k;
|
9639 | });
|
9640 |
|
9641 | $GOPD.f = $getOwnPropertyDescriptor;
|
9642 | $DP.f = $defineProperty;
|
9643 | require('./_object-gopn').f = gOPNExt.f = $getOwnPropertyNames;
|
9644 | require('./_object-pie').f = $propertyIsEnumerable;
|
9645 | require('./_object-gops').f = $getOwnPropertySymbols;
|
9646 |
|
9647 | if (DESCRIPTORS && !require('./_library')) {
|
9648 | redefine(ObjectProto, 'propertyIsEnumerable', $propertyIsEnumerable, true);
|
9649 | }
|
9650 |
|
9651 | wksExt.f = function (name) {
|
9652 | return wrap(wks(name));
|
9653 | };
|
9654 | }
|
9655 |
|
9656 | $export($export.G + $export.W + $export.F * !USE_NATIVE, { Symbol: $Symbol });
|
9657 |
|
9658 | for (var es6Symbols = (
|
9659 |
|
9660 | 'hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables'
|
9661 | ).split(','), j = 0; es6Symbols.length > j;)wks(es6Symbols[j++]);
|
9662 |
|
9663 | for (var wellKnownSymbols = $keys(wks.store), k = 0; wellKnownSymbols.length > k;) wksDefine(wellKnownSymbols[k++]);
|
9664 |
|
9665 | $export($export.S + $export.F * !USE_NATIVE, 'Symbol', {
|
9666 |
|
9667 | 'for': function (key) {
|
9668 | return has(SymbolRegistry, key += '')
|
9669 | ? SymbolRegistry[key]
|
9670 | : SymbolRegistry[key] = $Symbol(key);
|
9671 | },
|
9672 |
|
9673 | keyFor: function keyFor(sym) {
|
9674 | if (!isSymbol(sym)) throw TypeError(sym + ' is not a symbol!');
|
9675 | for (var key in SymbolRegistry) if (SymbolRegistry[key] === sym) return key;
|
9676 | },
|
9677 | useSetter: function () { setter = true; },
|
9678 | useSimple: function () { setter = false; }
|
9679 | });
|
9680 |
|
9681 | $export($export.S + $export.F * !USE_NATIVE, 'Object', {
|
9682 |
|
9683 | create: $create,
|
9684 |
|
9685 | defineProperty: $defineProperty,
|
9686 |
|
9687 | defineProperties: $defineProperties,
|
9688 |
|
9689 | getOwnPropertyDescriptor: $getOwnPropertyDescriptor,
|
9690 |
|
9691 | getOwnPropertyNames: $getOwnPropertyNames,
|
9692 |
|
9693 | getOwnPropertySymbols: $getOwnPropertySymbols
|
9694 | });
|
9695 |
|
9696 |
|
9697 | $JSON && $export($export.S + $export.F * (!USE_NATIVE || $fails(function () {
|
9698 | var S = $Symbol();
|
9699 |
|
9700 |
|
9701 |
|
9702 | return _stringify([S]) != '[null]' || _stringify({ a: S }) != '{}' || _stringify(Object(S)) != '{}';
|
9703 | })), 'JSON', {
|
9704 | stringify: function stringify(it) {
|
9705 | var args = [it];
|
9706 | var i = 1;
|
9707 | var replacer, $replacer;
|
9708 | while (arguments.length > i) args.push(arguments[i++]);
|
9709 | $replacer = replacer = args[1];
|
9710 | if (!isObject(replacer) && it === undefined || isSymbol(it)) return;
|
9711 | if (!isArray(replacer)) replacer = function (key, value) {
|
9712 | if (typeof $replacer == 'function') value = $replacer.call(this, key, value);
|
9713 | if (!isSymbol(value)) return value;
|
9714 | };
|
9715 | args[1] = replacer;
|
9716 | return _stringify.apply($JSON, args);
|
9717 | }
|
9718 | });
|
9719 |
|
9720 |
|
9721 | $Symbol[PROTOTYPE][TO_PRIMITIVE] || require('./_hide')($Symbol[PROTOTYPE], TO_PRIMITIVE, $Symbol[PROTOTYPE].valueOf);
|
9722 |
|
9723 | setToStringTag($Symbol, 'Symbol');
|
9724 |
|
9725 | setToStringTag(Math, 'Math', true);
|
9726 |
|
9727 | setToStringTag(global.JSON, 'JSON', true);
|
9728 |
|
9729 | },{"./_an-object":92,"./_descriptors":100,"./_enum-keys":103,"./_export":104,"./_fails":105,"./_global":107,"./_has":108,"./_hide":109,"./_is-array":115,"./_is-object":116,"./_library":123,"./_meta":124,"./_object-create":128,"./_object-dp":129,"./_object-gopd":131,"./_object-gopn":133,"./_object-gopn-ext":132,"./_object-gops":134,"./_object-keys":137,"./_object-pie":138,"./_property-desc":143,"./_redefine":145,"./_set-to-string-tag":147,"./_shared":149,"./_to-iobject":155,"./_to-primitive":158,"./_uid":159,"./_wks":163,"./_wks-define":161,"./_wks-ext":162}],179:[function(require,module,exports){
|
9730 |
|
9731 | var $export = require('./_export');
|
9732 | var $entries = require('./_object-to-array')(true);
|
9733 |
|
9734 | $export($export.S, 'Object', {
|
9735 | entries: function entries(it) {
|
9736 | return $entries(it);
|
9737 | }
|
9738 | });
|
9739 |
|
9740 | },{"./_export":104,"./_object-to-array":140}],180:[function(require,module,exports){
|
9741 |
|
9742 | 'use strict';
|
9743 | var $export = require('./_export');
|
9744 | var core = require('./_core');
|
9745 | var global = require('./_global');
|
9746 | var speciesConstructor = require('./_species-constructor');
|
9747 | var promiseResolve = require('./_promise-resolve');
|
9748 |
|
9749 | $export($export.P + $export.R, 'Promise', { 'finally': function (onFinally) {
|
9750 | var C = speciesConstructor(this, core.Promise || global.Promise);
|
9751 | var isFunction = typeof onFinally == 'function';
|
9752 | return this.then(
|
9753 | isFunction ? function (x) {
|
9754 | return promiseResolve(C, onFinally()).then(function () { return x; });
|
9755 | } : onFinally,
|
9756 | isFunction ? function (e) {
|
9757 | return promiseResolve(C, onFinally()).then(function () { throw e; });
|
9758 | } : onFinally
|
9759 | );
|
9760 | } });
|
9761 |
|
9762 | },{"./_core":96,"./_export":104,"./_global":107,"./_promise-resolve":142,"./_species-constructor":150}],181:[function(require,module,exports){
|
9763 | 'use strict';
|
9764 |
|
9765 | var $export = require('./_export');
|
9766 | var newPromiseCapability = require('./_new-promise-capability');
|
9767 | var perform = require('./_perform');
|
9768 |
|
9769 | $export($export.S, 'Promise', { 'try': function (callbackfn) {
|
9770 | var promiseCapability = newPromiseCapability.f(this);
|
9771 | var result = perform(callbackfn);
|
9772 | (result.e ? promiseCapability.reject : promiseCapability.resolve)(result.v);
|
9773 | return promiseCapability.promise;
|
9774 | } });
|
9775 |
|
9776 | },{"./_export":104,"./_new-promise-capability":126,"./_perform":141}],182:[function(require,module,exports){
|
9777 | require('./_wks-define')('asyncIterator');
|
9778 |
|
9779 | },{"./_wks-define":161}],183:[function(require,module,exports){
|
9780 | require('./_wks-define')('observable');
|
9781 |
|
9782 | },{"./_wks-define":161}],184:[function(require,module,exports){
|
9783 | require('./es6.array.iterator');
|
9784 | var global = require('./_global');
|
9785 | var hide = require('./_hide');
|
9786 | var Iterators = require('./_iterators');
|
9787 | var TO_STRING_TAG = require('./_wks')('toStringTag');
|
9788 |
|
9789 | var DOMIterables = ('CSSRuleList,CSSStyleDeclaration,CSSValueList,ClientRectList,DOMRectList,DOMStringList,' +
|
9790 | 'DOMTokenList,DataTransferItemList,FileList,HTMLAllCollection,HTMLCollection,HTMLFormElement,HTMLSelectElement,' +
|
9791 | 'MediaList,MimeTypeArray,NamedNodeMap,NodeList,PaintRequestList,Plugin,PluginArray,SVGLengthList,SVGNumberList,' +
|
9792 | 'SVGPathSegList,SVGPointList,SVGStringList,SVGTransformList,SourceBufferList,StyleSheetList,TextTrackCueList,' +
|
9793 | 'TextTrackList,TouchList').split(',');
|
9794 |
|
9795 | for (var i = 0; i < DOMIterables.length; i++) {
|
9796 | var NAME = DOMIterables[i];
|
9797 | var Collection = global[NAME];
|
9798 | var proto = Collection && Collection.prototype;
|
9799 | if (proto && !proto[TO_STRING_TAG]) hide(proto, TO_STRING_TAG, NAME);
|
9800 | Iterators[NAME] = Iterators.Array;
|
9801 | }
|
9802 |
|
9803 | },{"./_global":107,"./_hide":109,"./_iterators":122,"./_wks":163,"./es6.array.iterator":166}],185:[function(require,module,exports){
|
9804 | var $export = require('./_export');
|
9805 | var $task = require('./_task');
|
9806 | $export($export.G + $export.B, {
|
9807 | setImmediate: $task.set,
|
9808 | clearImmediate: $task.clear
|
9809 | });
|
9810 |
|
9811 | },{"./_export":104,"./_task":152}],186:[function(require,module,exports){
|
9812 | (function (Buffer){
|
9813 | 'use strict';
|
9814 |
|
9815 | var _typeof2 = require('babel-runtime/helpers/typeof');
|
9816 |
|
9817 | var _typeof3 = _interopRequireDefault(_typeof2);
|
9818 |
|
9819 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
9820 |
|
9821 |
|
9822 |
|
9823 |
|
9824 |
|
9825 |
|
9826 |
|
9827 |
|
9828 |
|
9829 |
|
9830 |
|
9831 |
|
9832 |
|
9833 |
|
9834 |
|
9835 |
|
9836 |
|
9837 |
|
9838 |
|
9839 |
|
9840 |
|
9841 |
|
9842 |
|
9843 |
|
9844 |
|
9845 | function isArray(arg) {
|
9846 | if (Array.isArray) {
|
9847 | return Array.isArray(arg);
|
9848 | }
|
9849 | return objectToString(arg) === '[object Array]';
|
9850 | }
|
9851 | exports.isArray = isArray;
|
9852 |
|
9853 | function isBoolean(arg) {
|
9854 | return typeof arg === 'boolean';
|
9855 | }
|
9856 | exports.isBoolean = isBoolean;
|
9857 |
|
9858 | function isNull(arg) {
|
9859 | return arg === null;
|
9860 | }
|
9861 | exports.isNull = isNull;
|
9862 |
|
9863 | function isNullOrUndefined(arg) {
|
9864 | return arg == null;
|
9865 | }
|
9866 | exports.isNullOrUndefined = isNullOrUndefined;
|
9867 |
|
9868 | function isNumber(arg) {
|
9869 | return typeof arg === 'number';
|
9870 | }
|
9871 | exports.isNumber = isNumber;
|
9872 |
|
9873 | function isString(arg) {
|
9874 | return typeof arg === 'string';
|
9875 | }
|
9876 | exports.isString = isString;
|
9877 |
|
9878 | function isSymbol(arg) {
|
9879 | return (typeof arg === 'undefined' ? 'undefined' : (0, _typeof3.default)(arg)) === 'symbol';
|
9880 | }
|
9881 | exports.isSymbol = isSymbol;
|
9882 |
|
9883 | function isUndefined(arg) {
|
9884 | return arg === void 0;
|
9885 | }
|
9886 | exports.isUndefined = isUndefined;
|
9887 |
|
9888 | function isRegExp(re) {
|
9889 | return objectToString(re) === '[object RegExp]';
|
9890 | }
|
9891 | exports.isRegExp = isRegExp;
|
9892 |
|
9893 | function isObject(arg) {
|
9894 | return (typeof arg === 'undefined' ? 'undefined' : (0, _typeof3.default)(arg)) === 'object' && arg !== null;
|
9895 | }
|
9896 | exports.isObject = isObject;
|
9897 |
|
9898 | function isDate(d) {
|
9899 | return objectToString(d) === '[object Date]';
|
9900 | }
|
9901 | exports.isDate = isDate;
|
9902 |
|
9903 | function isError(e) {
|
9904 | return objectToString(e) === '[object Error]' || e instanceof Error;
|
9905 | }
|
9906 | exports.isError = isError;
|
9907 |
|
9908 | function isFunction(arg) {
|
9909 | return typeof arg === 'function';
|
9910 | }
|
9911 | exports.isFunction = isFunction;
|
9912 |
|
9913 | function isPrimitive(arg) {
|
9914 | return arg === null || typeof arg === 'boolean' || typeof arg === 'number' || typeof arg === 'string' || (typeof arg === 'undefined' ? 'undefined' : (0, _typeof3.default)(arg)) === 'symbol' ||
|
9915 | typeof arg === 'undefined';
|
9916 | }
|
9917 | exports.isPrimitive = isPrimitive;
|
9918 |
|
9919 | exports.isBuffer = Buffer.isBuffer;
|
9920 |
|
9921 | function objectToString(o) {
|
9922 | return Object.prototype.toString.call(o);
|
9923 | }
|
9924 |
|
9925 | }).call(this,{"isBuffer":require("../../is-buffer/index.js")})
|
9926 | },{"../../is-buffer/index.js":227,"babel-runtime/helpers/typeof":64}],187:[function(require,module,exports){
|
9927 | 'use strict';
|
9928 |
|
9929 | var _typeof2 = require('babel-runtime/helpers/typeof');
|
9930 |
|
9931 | var _typeof3 = _interopRequireDefault(_typeof2);
|
9932 |
|
9933 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
9934 |
|
9935 |
|
9936 |
|
9937 |
|
9938 |
|
9939 |
|
9940 |
|
9941 |
|
9942 |
|
9943 |
|
9944 |
|
9945 |
|
9946 |
|
9947 |
|
9948 |
|
9949 | (function (global) {
|
9950 | 'use strict';
|
9951 |
|
9952 | var dateFormat = function () {
|
9953 | var token = /d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|[LloSZWN]|'[^']*'|'[^']*'/g;
|
9954 | var timezone = /\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g;
|
9955 | var timezoneClip = /[^-+\dA-Z]/g;
|
9956 |
|
9957 |
|
9958 | return function (date, mask, utc, gmt) {
|
9959 |
|
9960 |
|
9961 | if (arguments.length === 1 && kindOf(date) === 'string' && !/\d/.test(date)) {
|
9962 | mask = date;
|
9963 | date = undefined;
|
9964 | }
|
9965 |
|
9966 | date = date || new Date();
|
9967 |
|
9968 | if (!(date instanceof Date)) {
|
9969 | date = new Date(date);
|
9970 | }
|
9971 |
|
9972 | if (isNaN(date)) {
|
9973 | throw TypeError('Invalid date');
|
9974 | }
|
9975 |
|
9976 | mask = String(dateFormat.masks[mask] || mask || dateFormat.masks['default']);
|
9977 |
|
9978 |
|
9979 | var maskSlice = mask.slice(0, 4);
|
9980 | if (maskSlice === 'UTC:' || maskSlice === 'GMT:') {
|
9981 | mask = mask.slice(4);
|
9982 | utc = true;
|
9983 | if (maskSlice === 'GMT:') {
|
9984 | gmt = true;
|
9985 | }
|
9986 | }
|
9987 |
|
9988 | var _ = utc ? 'getUTC' : 'get';
|
9989 | var d = date[_ + 'Date']();
|
9990 | var D = date[_ + 'Day']();
|
9991 | var m = date[_ + 'Month']();
|
9992 | var y = date[_ + 'FullYear']();
|
9993 | var H = date[_ + 'Hours']();
|
9994 | var M = date[_ + 'Minutes']();
|
9995 | var s = date[_ + 'Seconds']();
|
9996 | var L = date[_ + 'Milliseconds']();
|
9997 | var o = utc ? 0 : date.getTimezoneOffset();
|
9998 | var W = getWeek(date);
|
9999 | var N = getDayOfWeek(date);
|
10000 | var flags = {
|
10001 | d: d,
|
10002 | dd: pad(d),
|
10003 | ddd: dateFormat.i18n.dayNames[D],
|
10004 | dddd: dateFormat.i18n.dayNames[D + 7],
|
10005 | m: m + 1,
|
10006 | mm: pad(m + 1),
|
10007 | mmm: dateFormat.i18n.monthNames[m],
|
10008 | mmmm: dateFormat.i18n.monthNames[m + 12],
|
10009 | yy: String(y).slice(2),
|
10010 | yyyy: y,
|
10011 | h: H % 12 || 12,
|
10012 | hh: pad(H % 12 || 12),
|
10013 | H: H,
|
10014 | HH: pad(H),
|
10015 | M: M,
|
10016 | MM: pad(M),
|
10017 | s: s,
|
10018 | ss: pad(s),
|
10019 | l: pad(L, 3),
|
10020 | L: pad(Math.round(L / 10)),
|
10021 | t: H < 12 ? 'a' : 'p',
|
10022 | tt: H < 12 ? 'am' : 'pm',
|
10023 | T: H < 12 ? 'A' : 'P',
|
10024 | TT: H < 12 ? 'AM' : 'PM',
|
10025 | Z: gmt ? 'GMT' : utc ? 'UTC' : (String(date).match(timezone) || ['']).pop().replace(timezoneClip, ''),
|
10026 | o: (o > 0 ? '-' : '+') + pad(Math.floor(Math.abs(o) / 60) * 100 + Math.abs(o) % 60, 4),
|
10027 | S: ['th', 'st', 'nd', 'rd'][d % 10 > 3 ? 0 : (d % 100 - d % 10 != 10) * d % 10],
|
10028 | W: W,
|
10029 | N: N
|
10030 | };
|
10031 |
|
10032 | return mask.replace(token, function (match) {
|
10033 | if (match in flags) {
|
10034 | return flags[match];
|
10035 | }
|
10036 | return match.slice(1, match.length - 1);
|
10037 | });
|
10038 | };
|
10039 | }();
|
10040 |
|
10041 | dateFormat.masks = {
|
10042 | 'default': 'ddd mmm dd yyyy HH:MM:ss',
|
10043 | 'shortDate': 'm/d/yy',
|
10044 | 'mediumDate': 'mmm d, yyyy',
|
10045 | 'longDate': 'mmmm d, yyyy',
|
10046 | 'fullDate': 'dddd, mmmm d, yyyy',
|
10047 | 'shortTime': 'h:MM TT',
|
10048 | 'mediumTime': 'h:MM:ss TT',
|
10049 | 'longTime': 'h:MM:ss TT Z',
|
10050 | 'isoDate': 'yyyy-mm-dd',
|
10051 | 'isoTime': 'HH:MM:ss',
|
10052 | 'isoDateTime': 'yyyy-mm-dd\'T\'HH:MM:sso',
|
10053 | 'isoUtcDateTime': 'UTC:yyyy-mm-dd\'T\'HH:MM:ss\'Z\'',
|
10054 | 'expiresHeaderFormat': 'ddd, dd mmm yyyy HH:MM:ss Z'
|
10055 | };
|
10056 |
|
10057 |
|
10058 | dateFormat.i18n = {
|
10059 | dayNames: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
|
10060 | monthNames: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec', 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
|
10061 | };
|
10062 |
|
10063 | function pad(val, len) {
|
10064 | val = String(val);
|
10065 | len = len || 2;
|
10066 | while (val.length < len) {
|
10067 | val = '0' + val;
|
10068 | }
|
10069 | return val;
|
10070 | }
|
10071 |
|
10072 | |
10073 |
|
10074 |
|
10075 |
|
10076 |
|
10077 |
|
10078 |
|
10079 |
|
10080 | function getWeek(date) {
|
10081 |
|
10082 | var targetThursday = new Date(date.getFullYear(), date.getMonth(), date.getDate());
|
10083 |
|
10084 |
|
10085 | targetThursday.setDate(targetThursday.getDate() - (targetThursday.getDay() + 6) % 7 + 3);
|
10086 |
|
10087 |
|
10088 | var firstThursday = new Date(targetThursday.getFullYear(), 0, 4);
|
10089 |
|
10090 |
|
10091 | firstThursday.setDate(firstThursday.getDate() - (firstThursday.getDay() + 6) % 7 + 3);
|
10092 |
|
10093 |
|
10094 | var ds = targetThursday.getTimezoneOffset() - firstThursday.getTimezoneOffset();
|
10095 | targetThursday.setHours(targetThursday.getHours() - ds);
|
10096 |
|
10097 |
|
10098 | var weekDiff = (targetThursday - firstThursday) / (86400000 * 7);
|
10099 | return 1 + Math.floor(weekDiff);
|
10100 | }
|
10101 |
|
10102 | |
10103 |
|
10104 |
|
10105 |
|
10106 |
|
10107 |
|
10108 |
|
10109 | function getDayOfWeek(date) {
|
10110 | var dow = date.getDay();
|
10111 | if (dow === 0) {
|
10112 | dow = 7;
|
10113 | }
|
10114 | return dow;
|
10115 | }
|
10116 |
|
10117 | |
10118 |
|
10119 |
|
10120 |
|
10121 |
|
10122 | function kindOf(val) {
|
10123 | if (val === null) {
|
10124 | return 'null';
|
10125 | }
|
10126 |
|
10127 | if (val === undefined) {
|
10128 | return 'undefined';
|
10129 | }
|
10130 |
|
10131 | if ((typeof val === 'undefined' ? 'undefined' : (0, _typeof3.default)(val)) !== 'object') {
|
10132 | return typeof val === 'undefined' ? 'undefined' : (0, _typeof3.default)(val);
|
10133 | }
|
10134 |
|
10135 | if (Array.isArray(val)) {
|
10136 | return 'array';
|
10137 | }
|
10138 |
|
10139 | return {}.toString.call(val).slice(8, -1).toLowerCase();
|
10140 | };
|
10141 |
|
10142 | if (typeof define === 'function' && define.amd) {
|
10143 | define(function () {
|
10144 | return dateFormat;
|
10145 | });
|
10146 | } else if ((typeof exports === 'undefined' ? 'undefined' : (0, _typeof3.default)(exports)) === 'object') {
|
10147 | module.exports = dateFormat;
|
10148 | } else {
|
10149 | global.dateFormat = dateFormat;
|
10150 | }
|
10151 | })(undefined);
|
10152 |
|
10153 | },{"babel-runtime/helpers/typeof":64}],188:[function(require,module,exports){
|
10154 | (function (process){
|
10155 |
|
10156 |
|
10157 |
|
10158 |
|
10159 |
|
10160 |
|
10161 | exports = module.exports = require('./debug');
|
10162 | exports.log = log;
|
10163 | exports.formatArgs = formatArgs;
|
10164 | exports.save = save;
|
10165 | exports.load = load;
|
10166 | exports.useColors = useColors;
|
10167 | exports.storage = 'undefined' != typeof chrome
|
10168 | && 'undefined' != typeof chrome.storage
|
10169 | ? chrome.storage.local
|
10170 | : localstorage();
|
10171 |
|
10172 |
|
10173 |
|
10174 |
|
10175 |
|
10176 | exports.colors = [
|
10177 | 'lightseagreen',
|
10178 | 'forestgreen',
|
10179 | 'goldenrod',
|
10180 | 'dodgerblue',
|
10181 | 'darkorchid',
|
10182 | 'crimson'
|
10183 | ];
|
10184 |
|
10185 |
|
10186 |
|
10187 |
|
10188 |
|
10189 |
|
10190 |
|
10191 |
|
10192 |
|
10193 | function useColors() {
|
10194 |
|
10195 |
|
10196 |
|
10197 | if (typeof window !== 'undefined' && window.process && window.process.type === 'renderer') {
|
10198 | return true;
|
10199 | }
|
10200 |
|
10201 |
|
10202 |
|
10203 | return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||
|
10204 |
|
10205 | (typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||
|
10206 |
|
10207 |
|
10208 | (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) ||
|
10209 |
|
10210 | (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/));
|
10211 | }
|
10212 |
|
10213 |
|
10214 |
|
10215 |
|
10216 |
|
10217 | exports.formatters.j = function(v) {
|
10218 | try {
|
10219 | return JSON.stringify(v);
|
10220 | } catch (err) {
|
10221 | return '[UnexpectedJSONParseError]: ' + err.message;
|
10222 | }
|
10223 | };
|
10224 |
|
10225 |
|
10226 |
|
10227 |
|
10228 |
|
10229 |
|
10230 |
|
10231 |
|
10232 | function formatArgs(args) {
|
10233 | var useColors = this.useColors;
|
10234 |
|
10235 | args[0] = (useColors ? '%c' : '')
|
10236 | + this.namespace
|
10237 | + (useColors ? ' %c' : ' ')
|
10238 | + args[0]
|
10239 | + (useColors ? '%c ' : ' ')
|
10240 | + '+' + exports.humanize(this.diff);
|
10241 |
|
10242 | if (!useColors) return;
|
10243 |
|
10244 | var c = 'color: ' + this.color;
|
10245 | args.splice(1, 0, c, 'color: inherit')
|
10246 |
|
10247 |
|
10248 |
|
10249 |
|
10250 | var index = 0;
|
10251 | var lastC = 0;
|
10252 | args[0].replace(/%[a-zA-Z%]/g, function(match) {
|
10253 | if ('%%' === match) return;
|
10254 | index++;
|
10255 | if ('%c' === match) {
|
10256 |
|
10257 |
|
10258 | lastC = index;
|
10259 | }
|
10260 | });
|
10261 |
|
10262 | args.splice(lastC, 0, c);
|
10263 | }
|
10264 |
|
10265 |
|
10266 |
|
10267 |
|
10268 |
|
10269 |
|
10270 |
|
10271 |
|
10272 | function log() {
|
10273 |
|
10274 |
|
10275 | return 'object' === typeof console
|
10276 | && console.log
|
10277 | && Function.prototype.apply.call(console.log, console, arguments);
|
10278 | }
|
10279 |
|
10280 |
|
10281 |
|
10282 |
|
10283 |
|
10284 |
|
10285 |
|
10286 |
|
10287 | function save(namespaces) {
|
10288 | try {
|
10289 | if (null == namespaces) {
|
10290 | exports.storage.removeItem('debug');
|
10291 | } else {
|
10292 | exports.storage.debug = namespaces;
|
10293 | }
|
10294 | } catch(e) {}
|
10295 | }
|
10296 |
|
10297 |
|
10298 |
|
10299 |
|
10300 |
|
10301 |
|
10302 |
|
10303 |
|
10304 | function load() {
|
10305 | var r;
|
10306 | try {
|
10307 | r = exports.storage.debug;
|
10308 | } catch(e) {}
|
10309 |
|
10310 |
|
10311 | if (!r && typeof process !== 'undefined' && 'env' in process) {
|
10312 | r = process.env.DEBUG;
|
10313 | }
|
10314 |
|
10315 | return r;
|
10316 | }
|
10317 |
|
10318 |
|
10319 |
|
10320 |
|
10321 |
|
10322 | exports.enable(load());
|
10323 |
|
10324 |
|
10325 |
|
10326 |
|
10327 |
|
10328 |
|
10329 |
|
10330 |
|
10331 |
|
10332 |
|
10333 |
|
10334 |
|
10335 | function localstorage() {
|
10336 | try {
|
10337 | return window.localStorage;
|
10338 | } catch (e) {}
|
10339 | }
|
10340 |
|
10341 | }).call(this,require('_process'))
|
10342 | },{"./debug":189,"_process":249}],189:[function(require,module,exports){
|
10343 |
|
10344 |
|
10345 |
|
10346 |
|
10347 |
|
10348 |
|
10349 |
|
10350 |
|
10351 | exports = module.exports = createDebug.debug = createDebug['default'] = createDebug;
|
10352 | exports.coerce = coerce;
|
10353 | exports.disable = disable;
|
10354 | exports.enable = enable;
|
10355 | exports.enabled = enabled;
|
10356 | exports.humanize = require('ms');
|
10357 |
|
10358 |
|
10359 |
|
10360 |
|
10361 |
|
10362 | exports.names = [];
|
10363 | exports.skips = [];
|
10364 |
|
10365 |
|
10366 |
|
10367 |
|
10368 |
|
10369 |
|
10370 |
|
10371 | exports.formatters = {};
|
10372 |
|
10373 |
|
10374 |
|
10375 |
|
10376 |
|
10377 | var prevTime;
|
10378 |
|
10379 |
|
10380 |
|
10381 |
|
10382 |
|
10383 |
|
10384 |
|
10385 |
|
10386 | function selectColor(namespace) {
|
10387 | var hash = 0, i;
|
10388 |
|
10389 | for (i in namespace) {
|
10390 | hash = ((hash << 5) - hash) + namespace.charCodeAt(i);
|
10391 | hash |= 0;
|
10392 | }
|
10393 |
|
10394 | return exports.colors[Math.abs(hash) % exports.colors.length];
|
10395 | }
|
10396 |
|
10397 |
|
10398 |
|
10399 |
|
10400 |
|
10401 |
|
10402 |
|
10403 |
|
10404 |
|
10405 | function createDebug(namespace) {
|
10406 |
|
10407 | function debug() {
|
10408 |
|
10409 | if (!debug.enabled) return;
|
10410 |
|
10411 | var self = debug;
|
10412 |
|
10413 |
|
10414 | var curr = +new Date();
|
10415 | var ms = curr - (prevTime || curr);
|
10416 | self.diff = ms;
|
10417 | self.prev = prevTime;
|
10418 | self.curr = curr;
|
10419 | prevTime = curr;
|
10420 |
|
10421 |
|
10422 | var args = new Array(arguments.length);
|
10423 | for (var i = 0; i < args.length; i++) {
|
10424 | args[i] = arguments[i];
|
10425 | }
|
10426 |
|
10427 | args[0] = exports.coerce(args[0]);
|
10428 |
|
10429 | if ('string' !== typeof args[0]) {
|
10430 |
|
10431 | args.unshift('%O');
|
10432 | }
|
10433 |
|
10434 |
|
10435 | var index = 0;
|
10436 | args[0] = args[0].replace(/%([a-zA-Z%])/g, function(match, format) {
|
10437 |
|
10438 | if (match === '%%') return match;
|
10439 | index++;
|
10440 | var formatter = exports.formatters[format];
|
10441 | if ('function' === typeof formatter) {
|
10442 | var val = args[index];
|
10443 | match = formatter.call(self, val);
|
10444 |
|
10445 |
|
10446 | args.splice(index, 1);
|
10447 | index--;
|
10448 | }
|
10449 | return match;
|
10450 | });
|
10451 |
|
10452 |
|
10453 | exports.formatArgs.call(self, args);
|
10454 |
|
10455 | var logFn = debug.log || exports.log || console.log.bind(console);
|
10456 | logFn.apply(self, args);
|
10457 | }
|
10458 |
|
10459 | debug.namespace = namespace;
|
10460 | debug.enabled = exports.enabled(namespace);
|
10461 | debug.useColors = exports.useColors();
|
10462 | debug.color = selectColor(namespace);
|
10463 |
|
10464 |
|
10465 | if ('function' === typeof exports.init) {
|
10466 | exports.init(debug);
|
10467 | }
|
10468 |
|
10469 | return debug;
|
10470 | }
|
10471 |
|
10472 |
|
10473 |
|
10474 |
|
10475 |
|
10476 |
|
10477 |
|
10478 |
|
10479 |
|
10480 | function enable(namespaces) {
|
10481 | exports.save(namespaces);
|
10482 |
|
10483 | exports.names = [];
|
10484 | exports.skips = [];
|
10485 |
|
10486 | var split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/);
|
10487 | var len = split.length;
|
10488 |
|
10489 | for (var i = 0; i < len; i++) {
|
10490 | if (!split[i]) continue;
|
10491 | namespaces = split[i].replace(/\*/g, '.*?');
|
10492 | if (namespaces[0] === '-') {
|
10493 | exports.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));
|
10494 | } else {
|
10495 | exports.names.push(new RegExp('^' + namespaces + '$'));
|
10496 | }
|
10497 | }
|
10498 | }
|
10499 |
|
10500 |
|
10501 |
|
10502 |
|
10503 |
|
10504 |
|
10505 |
|
10506 | function disable() {
|
10507 | exports.enable('');
|
10508 | }
|
10509 |
|
10510 |
|
10511 |
|
10512 |
|
10513 |
|
10514 |
|
10515 |
|
10516 |
|
10517 |
|
10518 | function enabled(name) {
|
10519 | var i, len;
|
10520 | for (i = 0, len = exports.skips.length; i < len; i++) {
|
10521 | if (exports.skips[i].test(name)) {
|
10522 | return false;
|
10523 | }
|
10524 | }
|
10525 | for (i = 0, len = exports.names.length; i < len; i++) {
|
10526 | if (exports.names[i].test(name)) {
|
10527 | return true;
|
10528 | }
|
10529 | }
|
10530 | return false;
|
10531 | }
|
10532 |
|
10533 |
|
10534 |
|
10535 |
|
10536 |
|
10537 |
|
10538 |
|
10539 |
|
10540 |
|
10541 | function coerce(val) {
|
10542 | if (val instanceof Error) return val.stack || val.message;
|
10543 | return val;
|
10544 | }
|
10545 |
|
10546 | },{"ms":238}],190:[function(require,module,exports){
|
10547 | 'use strict';
|
10548 |
|
10549 | var keys = require('object-keys');
|
10550 | var foreach = require('foreach');
|
10551 | var hasSymbols = typeof Symbol === 'function' && typeof Symbol() === 'symbol';
|
10552 |
|
10553 | var toStr = Object.prototype.toString;
|
10554 |
|
10555 | var isFunction = function (fn) {
|
10556 | return typeof fn === 'function' && toStr.call(fn) === '[object Function]';
|
10557 | };
|
10558 |
|
10559 | var arePropertyDescriptorsSupported = function () {
|
10560 | var obj = {};
|
10561 | try {
|
10562 | Object.defineProperty(obj, 'x', { enumerable: false, value: obj });
|
10563 |
|
10564 | for (var _ in obj) { return false; }
|
10565 |
|
10566 | return obj.x === obj;
|
10567 | } catch (e) {
|
10568 | return false;
|
10569 | }
|
10570 | };
|
10571 | var supportsDescriptors = Object.defineProperty && arePropertyDescriptorsSupported();
|
10572 |
|
10573 | var defineProperty = function (object, name, value, predicate) {
|
10574 | if (name in object && (!isFunction(predicate) || !predicate())) {
|
10575 | return;
|
10576 | }
|
10577 | if (supportsDescriptors) {
|
10578 | Object.defineProperty(object, name, {
|
10579 | configurable: true,
|
10580 | enumerable: false,
|
10581 | value: value,
|
10582 | writable: true
|
10583 | });
|
10584 | } else {
|
10585 | object[name] = value;
|
10586 | }
|
10587 | };
|
10588 |
|
10589 | var defineProperties = function (object, map) {
|
10590 | var predicates = arguments.length > 2 ? arguments[2] : {};
|
10591 | var props = keys(map);
|
10592 | if (hasSymbols) {
|
10593 | props = props.concat(Object.getOwnPropertySymbols(map));
|
10594 | }
|
10595 | foreach(props, function (name) {
|
10596 | defineProperty(object, name, map[name], predicates[name]);
|
10597 | });
|
10598 | };
|
10599 |
|
10600 | defineProperties.supportsDescriptors = !!supportsDescriptors;
|
10601 |
|
10602 | module.exports = defineProperties;
|
10603 |
|
10604 | },{"foreach":217,"object-keys":240}],191:[function(require,module,exports){
|
10605 | 'use strict';
|
10606 |
|
10607 |
|
10608 |
|
10609 |
|
10610 |
|
10611 |
|
10612 | var undefined;
|
10613 |
|
10614 | var ThrowTypeError = Object.getOwnPropertyDescriptor
|
10615 | ? (function () { return Object.getOwnPropertyDescriptor(arguments, 'callee').get; }())
|
10616 | : function () { throw new TypeError(); };
|
10617 |
|
10618 | var hasSymbols = typeof Symbol === 'function' && typeof Symbol.iterator === 'symbol';
|
10619 |
|
10620 | var getProto = Object.getPrototypeOf || function (x) { return x.__proto__; };
|
10621 |
|
10622 | var generator;
|
10623 | var generatorFunction = generator ? getProto(generator) : undefined;
|
10624 | var asyncFn;
|
10625 | var asyncFunction = asyncFn ? asyncFn.constructor : undefined;
|
10626 | var asyncGen;
|
10627 | var asyncGenFunction = asyncGen ? getProto(asyncGen) : undefined;
|
10628 | var asyncGenIterator = asyncGen ? asyncGen() : undefined;
|
10629 |
|
10630 | var TypedArray = typeof Uint8Array === 'undefined' ? undefined : getProto(Uint8Array);
|
10631 |
|
10632 | var INTRINSICS = {
|
10633 | '$ %Array%': Array,
|
10634 | '$ %ArrayBuffer%': typeof ArrayBuffer === 'undefined' ? undefined : ArrayBuffer,
|
10635 | '$ %ArrayBufferPrototype%': typeof ArrayBuffer === 'undefined' ? undefined : ArrayBuffer.prototype,
|
10636 | '$ %ArrayIteratorPrototype%': hasSymbols ? getProto([][Symbol.iterator]()) : undefined,
|
10637 | '$ %ArrayPrototype%': Array.prototype,
|
10638 | '$ %ArrayProto_entries%': Array.prototype.entries,
|
10639 | '$ %ArrayProto_forEach%': Array.prototype.forEach,
|
10640 | '$ %ArrayProto_keys%': Array.prototype.keys,
|
10641 | '$ %ArrayProto_values%': Array.prototype.values,
|
10642 | '$ %AsyncFromSyncIteratorPrototype%': undefined,
|
10643 | '$ %AsyncFunction%': asyncFunction,
|
10644 | '$ %AsyncFunctionPrototype%': asyncFunction ? asyncFunction.prototype : undefined,
|
10645 | '$ %AsyncGenerator%': asyncGen ? getProto(asyncGenIterator) : undefined,
|
10646 | '$ %AsyncGeneratorFunction%': asyncGenFunction,
|
10647 | '$ %AsyncGeneratorPrototype%': asyncGenFunction ? asyncGenFunction.prototype : undefined,
|
10648 | '$ %AsyncIteratorPrototype%': asyncGenIterator && hasSymbols && Symbol.asyncIterator ? asyncGenIterator[Symbol.asyncIterator]() : undefined,
|
10649 | '$ %Atomics%': typeof Atomics === 'undefined' ? undefined : Atomics,
|
10650 | '$ %Boolean%': Boolean,
|
10651 | '$ %BooleanPrototype%': Boolean.prototype,
|
10652 | '$ %DataView%': typeof DataView === 'undefined' ? undefined : DataView,
|
10653 | '$ %DataViewPrototype%': typeof DataView === 'undefined' ? undefined : DataView.prototype,
|
10654 | '$ %Date%': Date,
|
10655 | '$ %DatePrototype%': Date.prototype,
|
10656 | '$ %decodeURI%': decodeURI,
|
10657 | '$ %decodeURIComponent%': decodeURIComponent,
|
10658 | '$ %encodeURI%': encodeURI,
|
10659 | '$ %encodeURIComponent%': encodeURIComponent,
|
10660 | '$ %Error%': Error,
|
10661 | '$ %ErrorPrototype%': Error.prototype,
|
10662 | '$ %eval%': eval,
|
10663 | '$ %EvalError%': EvalError,
|
10664 | '$ %EvalErrorPrototype%': EvalError.prototype,
|
10665 | '$ %Float32Array%': typeof Float32Array === 'undefined' ? undefined : Float32Array,
|
10666 | '$ %Float32ArrayPrototype%': typeof Float32Array === 'undefined' ? undefined : Float32Array.prototype,
|
10667 | '$ %Float64Array%': typeof Float64Array === 'undefined' ? undefined : Float64Array,
|
10668 | '$ %Float64ArrayPrototype%': typeof Float64Array === 'undefined' ? undefined : Float64Array.prototype,
|
10669 | '$ %Function%': Function,
|
10670 | '$ %FunctionPrototype%': Function.prototype,
|
10671 | '$ %Generator%': generator ? getProto(generator()) : undefined,
|
10672 | '$ %GeneratorFunction%': generatorFunction,
|
10673 | '$ %GeneratorPrototype%': generatorFunction ? generatorFunction.prototype : undefined,
|
10674 | '$ %Int8Array%': typeof Int8Array === 'undefined' ? undefined : Int8Array,
|
10675 | '$ %Int8ArrayPrototype%': typeof Int8Array === 'undefined' ? undefined : Int8Array.prototype,
|
10676 | '$ %Int16Array%': typeof Int16Array === 'undefined' ? undefined : Int16Array,
|
10677 | '$ %Int16ArrayPrototype%': typeof Int16Array === 'undefined' ? undefined : Int8Array.prototype,
|
10678 | '$ %Int32Array%': typeof Int32Array === 'undefined' ? undefined : Int32Array,
|
10679 | '$ %Int32ArrayPrototype%': typeof Int32Array === 'undefined' ? undefined : Int32Array.prototype,
|
10680 | '$ %isFinite%': isFinite,
|
10681 | '$ %isNaN%': isNaN,
|
10682 | '$ %IteratorPrototype%': hasSymbols ? getProto(getProto([][Symbol.iterator]())) : undefined,
|
10683 | '$ %JSON%': JSON,
|
10684 | '$ %JSONParse%': JSON.parse,
|
10685 | '$ %Map%': typeof Map === 'undefined' ? undefined : Map,
|
10686 | '$ %MapIteratorPrototype%': typeof Map === 'undefined' || !hasSymbols ? undefined : getProto(new Map()[Symbol.iterator]()),
|
10687 | '$ %MapPrototype%': typeof Map === 'undefined' ? undefined : Map.prototype,
|
10688 | '$ %Math%': Math,
|
10689 | '$ %Number%': Number,
|
10690 | '$ %NumberPrototype%': Number.prototype,
|
10691 | '$ %Object%': Object,
|
10692 | '$ %ObjectPrototype%': Object.prototype,
|
10693 | '$ %ObjProto_toString%': Object.prototype.toString,
|
10694 | '$ %ObjProto_valueOf%': Object.prototype.valueOf,
|
10695 | '$ %parseFloat%': parseFloat,
|
10696 | '$ %parseInt%': parseInt,
|
10697 | '$ %Promise%': typeof Promise === 'undefined' ? undefined : Promise,
|
10698 | '$ %PromisePrototype%': typeof Promise === 'undefined' ? undefined : Promise.prototype,
|
10699 | '$ %PromiseProto_then%': typeof Promise === 'undefined' ? undefined : Promise.prototype.then,
|
10700 | '$ %Promise_all%': typeof Promise === 'undefined' ? undefined : Promise.all,
|
10701 | '$ %Promise_reject%': typeof Promise === 'undefined' ? undefined : Promise.reject,
|
10702 | '$ %Promise_resolve%': typeof Promise === 'undefined' ? undefined : Promise.resolve,
|
10703 | '$ %Proxy%': typeof Proxy === 'undefined' ? undefined : Proxy,
|
10704 | '$ %RangeError%': RangeError,
|
10705 | '$ %RangeErrorPrototype%': RangeError.prototype,
|
10706 | '$ %ReferenceError%': ReferenceError,
|
10707 | '$ %ReferenceErrorPrototype%': ReferenceError.prototype,
|
10708 | '$ %Reflect%': typeof Reflect === 'undefined' ? undefined : Reflect,
|
10709 | '$ %RegExp%': RegExp,
|
10710 | '$ %RegExpPrototype%': RegExp.prototype,
|
10711 | '$ %Set%': typeof Set === 'undefined' ? undefined : Set,
|
10712 | '$ %SetIteratorPrototype%': typeof Set === 'undefined' || !hasSymbols ? undefined : getProto(new Set()[Symbol.iterator]()),
|
10713 | '$ %SetPrototype%': typeof Set === 'undefined' ? undefined : Set.prototype,
|
10714 | '$ %SharedArrayBuffer%': typeof SharedArrayBuffer === 'undefined' ? undefined : SharedArrayBuffer,
|
10715 | '$ %SharedArrayBufferPrototype%': typeof SharedArrayBuffer === 'undefined' ? undefined : SharedArrayBuffer.prototype,
|
10716 | '$ %String%': String,
|
10717 | '$ %StringIteratorPrototype%': hasSymbols ? getProto(''[Symbol.iterator]()) : undefined,
|
10718 | '$ %StringPrototype%': String.prototype,
|
10719 | '$ %Symbol%': hasSymbols ? Symbol : undefined,
|
10720 | '$ %SymbolPrototype%': hasSymbols ? Symbol.prototype : undefined,
|
10721 | '$ %SyntaxError%': SyntaxError,
|
10722 | '$ %SyntaxErrorPrototype%': SyntaxError.prototype,
|
10723 | '$ %ThrowTypeError%': ThrowTypeError,
|
10724 | '$ %TypedArray%': TypedArray,
|
10725 | '$ %TypedArrayPrototype%': TypedArray ? TypedArray.prototype : undefined,
|
10726 | '$ %TypeError%': TypeError,
|
10727 | '$ %TypeErrorPrototype%': TypeError.prototype,
|
10728 | '$ %Uint8Array%': typeof Uint8Array === 'undefined' ? undefined : Uint8Array,
|
10729 | '$ %Uint8ArrayPrototype%': typeof Uint8Array === 'undefined' ? undefined : Uint8Array.prototype,
|
10730 | '$ %Uint8ClampedArray%': typeof Uint8ClampedArray === 'undefined' ? undefined : Uint8ClampedArray,
|
10731 | '$ %Uint8ClampedArrayPrototype%': typeof Uint8ClampedArray === 'undefined' ? undefined : Uint8ClampedArray.prototype,
|
10732 | '$ %Uint16Array%': typeof Uint16Array === 'undefined' ? undefined : Uint16Array,
|
10733 | '$ %Uint16ArrayPrototype%': typeof Uint16Array === 'undefined' ? undefined : Uint16Array.prototype,
|
10734 | '$ %Uint32Array%': typeof Uint32Array === 'undefined' ? undefined : Uint32Array,
|
10735 | '$ %Uint32ArrayPrototype%': typeof Uint32Array === 'undefined' ? undefined : Uint32Array.prototype,
|
10736 | '$ %URIError%': URIError,
|
10737 | '$ %URIErrorPrototype%': URIError.prototype,
|
10738 | '$ %WeakMap%': typeof WeakMap === 'undefined' ? undefined : WeakMap,
|
10739 | '$ %WeakMapPrototype%': typeof WeakMap === 'undefined' ? undefined : WeakMap.prototype,
|
10740 | '$ %WeakSet%': typeof WeakSet === 'undefined' ? undefined : WeakSet,
|
10741 | '$ %WeakSetPrototype%': typeof WeakSet === 'undefined' ? undefined : WeakSet.prototype
|
10742 | };
|
10743 |
|
10744 | module.exports = function GetIntrinsic(name, allowMissing) {
|
10745 | if (arguments.length > 1 && typeof allowMissing !== 'boolean') {
|
10746 | throw new TypeError('"allowMissing" argument must be a boolean');
|
10747 | }
|
10748 |
|
10749 | var key = '$ ' + name;
|
10750 | if (!(key in INTRINSICS)) {
|
10751 | throw new SyntaxError('intrinsic ' + name + ' does not exist!');
|
10752 | }
|
10753 |
|
10754 |
|
10755 | if (typeof INTRINSICS[key] === 'undefined' && !allowMissing) {
|
10756 | throw new TypeError('intrinsic ' + name + ' exists, but is not available. Please file an issue!');
|
10757 | }
|
10758 | return INTRINSICS[key];
|
10759 | };
|
10760 |
|
10761 | },{}],192:[function(require,module,exports){
|
10762 | 'use strict';
|
10763 |
|
10764 | var has = require('has');
|
10765 | var toPrimitive = require('es-to-primitive/es6');
|
10766 | var keys = require('object-keys');
|
10767 | var inspect = require('object-inspect');
|
10768 |
|
10769 | var GetIntrinsic = require('./GetIntrinsic');
|
10770 |
|
10771 | var $TypeError = GetIntrinsic('%TypeError%');
|
10772 | var $RangeError = GetIntrinsic('%RangeError%');
|
10773 | var $SyntaxError = GetIntrinsic('%SyntaxError%');
|
10774 | var $Array = GetIntrinsic('%Array%');
|
10775 | var $ArrayPrototype = $Array.prototype;
|
10776 | var $String = GetIntrinsic('%String%');
|
10777 | var $Object = GetIntrinsic('%Object%');
|
10778 | var $Number = GetIntrinsic('%Number%');
|
10779 | var $Symbol = GetIntrinsic('%Symbol%', true);
|
10780 | var $RegExp = GetIntrinsic('%RegExp%');
|
10781 | var $Promise = GetIntrinsic('%Promise%', true);
|
10782 | var $preventExtensions = $Object.preventExtensions;
|
10783 |
|
10784 | var hasSymbols = require('has-symbols')();
|
10785 |
|
10786 | var assertRecord = require('./helpers/assertRecord');
|
10787 | var $isNaN = require('./helpers/isNaN');
|
10788 | var $isFinite = require('./helpers/isFinite');
|
10789 | var MAX_ARRAY_LENGTH = Math.pow(2, 32) - 1;
|
10790 | var MAX_SAFE_INTEGER = $Number.MAX_SAFE_INTEGER || Math.pow(2, 53) - 1;
|
10791 |
|
10792 | var assign = require('./helpers/assign');
|
10793 | var sign = require('./helpers/sign');
|
10794 | var mod = require('./helpers/mod');
|
10795 | var isPrimitive = require('./helpers/isPrimitive');
|
10796 | var forEach = require('./helpers/forEach');
|
10797 | var every = require('./helpers/every');
|
10798 | var isSamePropertyDescriptor = require('./helpers/isSamePropertyDescriptor');
|
10799 | var isPropertyDescriptor = require('./helpers/isPropertyDescriptor');
|
10800 | var parseInteger = parseInt;
|
10801 | var callBind = require('./helpers/callBind');
|
10802 | var $PromiseThen = $Promise ? callBind(GetIntrinsic('%PromiseProto_then%')) : null;
|
10803 | var arraySlice = callBind($Array.prototype.slice);
|
10804 | var strSlice = callBind($String.prototype.slice);
|
10805 | var isBinary = callBind($RegExp.prototype.test, /^0b[01]+$/i);
|
10806 | var isOctal = callBind($RegExp.prototype.test, /^0o[0-7]+$/i);
|
10807 | var isDigit = callBind($RegExp.prototype.test, /^[0-9]$/);
|
10808 | var regexExec = callBind($RegExp.prototype.exec);
|
10809 | var nonWS = ['\u0085', '\u200b', '\ufffe'].join('');
|
10810 | var nonWSregex = new $RegExp('[' + nonWS + ']', 'g');
|
10811 | var hasNonWS = callBind($RegExp.prototype.test, nonWSregex);
|
10812 | var invalidHexLiteral = /^[-+]0x[0-9a-f]+$/i;
|
10813 | var isInvalidHexLiteral = callBind($RegExp.prototype.test, invalidHexLiteral);
|
10814 | var $charCodeAt = callBind($String.prototype.charCodeAt);
|
10815 | var $isEnumerable = callBind($Object.prototype.propertyIsEnumerable);
|
10816 |
|
10817 | var toStr = callBind($Object.prototype.toString);
|
10818 |
|
10819 | var $NumberValueOf = callBind(GetIntrinsic('%NumberPrototype%').valueOf);
|
10820 | var $BooleanValueOf = callBind(GetIntrinsic('%BooleanPrototype%').valueOf);
|
10821 | var $StringValueOf = callBind(GetIntrinsic('%StringPrototype%').valueOf);
|
10822 | var $DateValueOf = callBind(GetIntrinsic('%DatePrototype%').valueOf);
|
10823 | var $SymbolToString = hasSymbols && callBind(GetIntrinsic('%SymbolPrototype%').toString);
|
10824 |
|
10825 | var $floor = Math.floor;
|
10826 | var $abs = Math.abs;
|
10827 |
|
10828 | var $ObjectCreate = $Object.create;
|
10829 | var $gOPD = $Object.getOwnPropertyDescriptor;
|
10830 | var $gOPN = $Object.getOwnPropertyNames;
|
10831 | var $gOPS = $Object.getOwnPropertySymbols;
|
10832 | var $isExtensible = $Object.isExtensible;
|
10833 | var $defineProperty = $Object.defineProperty;
|
10834 | var $setProto = Object.setPrototypeOf || (
|
10835 |
|
10836 | [].__proto__ !== Array.prototype
|
10837 | ? null
|
10838 | : function (O, proto) {
|
10839 | O.__proto__ = proto;
|
10840 | return O;
|
10841 | }
|
10842 | );
|
10843 |
|
10844 | var DefineOwnProperty = function DefineOwnProperty(ES, O, P, desc) {
|
10845 | if (!$defineProperty) {
|
10846 | if (!ES.IsDataDescriptor(desc)) {
|
10847 |
|
10848 | return false;
|
10849 | }
|
10850 | if (!desc['[[Configurable]]'] || !desc['[[Writable]]']) {
|
10851 | return false;
|
10852 | }
|
10853 |
|
10854 |
|
10855 | if (P in O && $isEnumerable(O, P) !== !!desc['[[Enumerable]]']) {
|
10856 |
|
10857 | return false;
|
10858 | }
|
10859 |
|
10860 |
|
10861 | var V = desc['[[Value]]'];
|
10862 | O[P] = V;
|
10863 | return ES.SameValue(O[P], V);
|
10864 | }
|
10865 | $defineProperty(O, P, ES.FromPropertyDescriptor(desc));
|
10866 | return true;
|
10867 | };
|
10868 |
|
10869 |
|
10870 |
|
10871 | var ws = [
|
10872 | '\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003',
|
10873 | '\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028',
|
10874 | '\u2029\uFEFF'
|
10875 | ].join('');
|
10876 | var trimRegex = new RegExp('(^[' + ws + ']+)|([' + ws + ']+$)', 'g');
|
10877 | var $replace = callBind($String.prototype.replace);
|
10878 | var trim = function (value) {
|
10879 | return $replace(value, trimRegex, '');
|
10880 | };
|
10881 |
|
10882 | var ES5 = require('./es5');
|
10883 |
|
10884 | var hasRegExpMatcher = require('is-regex');
|
10885 |
|
10886 |
|
10887 | var ES6 = assign(assign({}, ES5), {
|
10888 |
|
10889 |
|
10890 | Call: function Call(F, V) {
|
10891 | var args = arguments.length > 2 ? arguments[2] : [];
|
10892 | if (!this.IsCallable(F)) {
|
10893 | throw new $TypeError(inspect(F) + ' is not a function');
|
10894 | }
|
10895 | return F.apply(V, args);
|
10896 | },
|
10897 |
|
10898 |
|
10899 | ToPrimitive: toPrimitive,
|
10900 |
|
10901 |
|
10902 |
|
10903 |
|
10904 |
|
10905 | ToNumber: function ToNumber(argument) {
|
10906 | var value = isPrimitive(argument) ? argument : toPrimitive(argument, $Number);
|
10907 | if (typeof value === 'symbol') {
|
10908 | throw new $TypeError('Cannot convert a Symbol value to a number');
|
10909 | }
|
10910 | if (typeof value === 'string') {
|
10911 | if (isBinary(value)) {
|
10912 | return this.ToNumber(parseInteger(strSlice(value, 2), 2));
|
10913 | } else if (isOctal(value)) {
|
10914 | return this.ToNumber(parseInteger(strSlice(value, 2), 8));
|
10915 | } else if (hasNonWS(value) || isInvalidHexLiteral(value)) {
|
10916 | return NaN;
|
10917 | } else {
|
10918 | var trimmed = trim(value);
|
10919 | if (trimmed !== value) {
|
10920 | return this.ToNumber(trimmed);
|
10921 | }
|
10922 | }
|
10923 | }
|
10924 | return $Number(value);
|
10925 | },
|
10926 |
|
10927 |
|
10928 |
|
10929 |
|
10930 |
|
10931 |
|
10932 |
|
10933 |
|
10934 |
|
10935 |
|
10936 |
|
10937 | ToInt16: function ToInt16(argument) {
|
10938 | var int16bit = this.ToUint16(argument);
|
10939 | return int16bit >= 0x8000 ? int16bit - 0x10000 : int16bit;
|
10940 | },
|
10941 |
|
10942 |
|
10943 |
|
10944 |
|
10945 |
|
10946 | ToInt8: function ToInt8(argument) {
|
10947 | var int8bit = this.ToUint8(argument);
|
10948 | return int8bit >= 0x80 ? int8bit - 0x100 : int8bit;
|
10949 | },
|
10950 |
|
10951 |
|
10952 | ToUint8: function ToUint8(argument) {
|
10953 | var number = this.ToNumber(argument);
|
10954 | if ($isNaN(number) || number === 0 || !$isFinite(number)) { return 0; }
|
10955 | var posInt = sign(number) * $floor($abs(number));
|
10956 | return mod(posInt, 0x100);
|
10957 | },
|
10958 |
|
10959 |
|
10960 | ToUint8Clamp: function ToUint8Clamp(argument) {
|
10961 | var number = this.ToNumber(argument);
|
10962 | if ($isNaN(number) || number <= 0) { return 0; }
|
10963 | if (number >= 0xFF) { return 0xFF; }
|
10964 | var f = $floor(argument);
|
10965 | if (f + 0.5 < number) { return f + 1; }
|
10966 | if (number < f + 0.5) { return f; }
|
10967 | if (f % 2 !== 0) { return f + 1; }
|
10968 | return f;
|
10969 | },
|
10970 |
|
10971 |
|
10972 | ToString: function ToString(argument) {
|
10973 | if (typeof argument === 'symbol') {
|
10974 | throw new $TypeError('Cannot convert a Symbol value to a string');
|
10975 | }
|
10976 | return $String(argument);
|
10977 | },
|
10978 |
|
10979 |
|
10980 | ToObject: function ToObject(value) {
|
10981 | this.RequireObjectCoercible(value);
|
10982 | return $Object(value);
|
10983 | },
|
10984 |
|
10985 |
|
10986 | ToPropertyKey: function ToPropertyKey(argument) {
|
10987 | var key = this.ToPrimitive(argument, $String);
|
10988 | return typeof key === 'symbol' ? key : this.ToString(key);
|
10989 | },
|
10990 |
|
10991 |
|
10992 | ToLength: function ToLength(argument) {
|
10993 | var len = this.ToInteger(argument);
|
10994 | if (len <= 0) { return 0; }
|
10995 | if (len > MAX_SAFE_INTEGER) { return MAX_SAFE_INTEGER; }
|
10996 | return len;
|
10997 | },
|
10998 |
|
10999 |
|
11000 | CanonicalNumericIndexString: function CanonicalNumericIndexString(argument) {
|
11001 | if (toStr(argument) !== '[object String]') {
|
11002 | throw new $TypeError('must be a string');
|
11003 | }
|
11004 | if (argument === '-0') { return -0; }
|
11005 | var n = this.ToNumber(argument);
|
11006 | if (this.SameValue(this.ToString(n), argument)) { return n; }
|
11007 | return void 0;
|
11008 | },
|
11009 |
|
11010 |
|
11011 | RequireObjectCoercible: ES5.CheckObjectCoercible,
|
11012 |
|
11013 |
|
11014 | IsArray: $Array.isArray || function IsArray(argument) {
|
11015 | return toStr(argument) === '[object Array]';
|
11016 | },
|
11017 |
|
11018 |
|
11019 |
|
11020 |
|
11021 |
|
11022 | IsConstructor: function IsConstructor(argument) {
|
11023 | return typeof argument === 'function' && !!argument.prototype;
|
11024 | },
|
11025 |
|
11026 |
|
11027 | IsExtensible: $preventExtensions
|
11028 | ? function IsExtensible(obj) {
|
11029 | if (isPrimitive(obj)) {
|
11030 | return false;
|
11031 | }
|
11032 | return $isExtensible(obj);
|
11033 | }
|
11034 | : function isExtensible(obj) { return true; },
|
11035 |
|
11036 |
|
11037 | IsInteger: function IsInteger(argument) {
|
11038 | if (typeof argument !== 'number' || $isNaN(argument) || !$isFinite(argument)) {
|
11039 | return false;
|
11040 | }
|
11041 | var abs = $abs(argument);
|
11042 | return $floor(abs) === abs;
|
11043 | },
|
11044 |
|
11045 |
|
11046 | IsPropertyKey: function IsPropertyKey(argument) {
|
11047 | return typeof argument === 'string' || typeof argument === 'symbol';
|
11048 | },
|
11049 |
|
11050 |
|
11051 | IsRegExp: function IsRegExp(argument) {
|
11052 | if (!argument || typeof argument !== 'object') {
|
11053 | return false;
|
11054 | }
|
11055 | if (hasSymbols) {
|
11056 | var isRegExp = argument[$Symbol.match];
|
11057 | if (typeof isRegExp !== 'undefined') {
|
11058 | return ES5.ToBoolean(isRegExp);
|
11059 | }
|
11060 | }
|
11061 | return hasRegExpMatcher(argument);
|
11062 | },
|
11063 |
|
11064 |
|
11065 |
|
11066 |
|
11067 |
|
11068 | SameValueZero: function SameValueZero(x, y) {
|
11069 | return (x === y) || ($isNaN(x) && $isNaN(y));
|
11070 | },
|
11071 |
|
11072 | |
11073 |
|
11074 |
|
11075 |
|
11076 |
|
11077 |
|
11078 |
|
11079 | GetV: function GetV(V, P) {
|
11080 |
|
11081 | if (!this.IsPropertyKey(P)) {
|
11082 | throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true');
|
11083 | }
|
11084 |
|
11085 |
|
11086 | var O = this.ToObject(V);
|
11087 |
|
11088 |
|
11089 | return O[P];
|
11090 | },
|
11091 |
|
11092 | |
11093 |
|
11094 |
|
11095 |
|
11096 |
|
11097 |
|
11098 |
|
11099 |
|
11100 |
|
11101 | GetMethod: function GetMethod(O, P) {
|
11102 |
|
11103 | if (!this.IsPropertyKey(P)) {
|
11104 | throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true');
|
11105 | }
|
11106 |
|
11107 |
|
11108 | var func = this.GetV(O, P);
|
11109 |
|
11110 |
|
11111 | if (func == null) {
|
11112 | return void 0;
|
11113 | }
|
11114 |
|
11115 |
|
11116 | if (!this.IsCallable(func)) {
|
11117 | throw new $TypeError(P + 'is not a function');
|
11118 | }
|
11119 |
|
11120 |
|
11121 | return func;
|
11122 | },
|
11123 |
|
11124 | |
11125 |
|
11126 |
|
11127 |
|
11128 |
|
11129 |
|
11130 | Get: function Get(O, P) {
|
11131 |
|
11132 | if (this.Type(O) !== 'Object') {
|
11133 | throw new $TypeError('Assertion failed: Type(O) is not Object');
|
11134 | }
|
11135 |
|
11136 | if (!this.IsPropertyKey(P)) {
|
11137 | throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true, got ' + inspect(P));
|
11138 | }
|
11139 |
|
11140 | return O[P];
|
11141 | },
|
11142 |
|
11143 | Type: function Type(x) {
|
11144 | if (typeof x === 'symbol') {
|
11145 | return 'Symbol';
|
11146 | }
|
11147 | return ES5.Type(x);
|
11148 | },
|
11149 |
|
11150 |
|
11151 | SpeciesConstructor: function SpeciesConstructor(O, defaultConstructor) {
|
11152 | if (this.Type(O) !== 'Object') {
|
11153 | throw new $TypeError('Assertion failed: Type(O) is not Object');
|
11154 | }
|
11155 | var C = O.constructor;
|
11156 | if (typeof C === 'undefined') {
|
11157 | return defaultConstructor;
|
11158 | }
|
11159 | if (this.Type(C) !== 'Object') {
|
11160 | throw new $TypeError('O.constructor is not an Object');
|
11161 | }
|
11162 | var S = hasSymbols && $Symbol.species ? C[$Symbol.species] : void 0;
|
11163 | if (S == null) {
|
11164 | return defaultConstructor;
|
11165 | }
|
11166 | if (this.IsConstructor(S)) {
|
11167 | return S;
|
11168 | }
|
11169 | throw new $TypeError('no constructor found');
|
11170 | },
|
11171 |
|
11172 |
|
11173 | FromPropertyDescriptor: function FromPropertyDescriptor(Desc) {
|
11174 | if (typeof Desc === 'undefined') {
|
11175 | return Desc;
|
11176 | }
|
11177 |
|
11178 | assertRecord(this, 'Property Descriptor', 'Desc', Desc);
|
11179 |
|
11180 | var obj = {};
|
11181 | if ('[[Value]]' in Desc) {
|
11182 | obj.value = Desc['[[Value]]'];
|
11183 | }
|
11184 | if ('[[Writable]]' in Desc) {
|
11185 | obj.writable = Desc['[[Writable]]'];
|
11186 | }
|
11187 | if ('[[Get]]' in Desc) {
|
11188 | obj.get = Desc['[[Get]]'];
|
11189 | }
|
11190 | if ('[[Set]]' in Desc) {
|
11191 | obj.set = Desc['[[Set]]'];
|
11192 | }
|
11193 | if ('[[Enumerable]]' in Desc) {
|
11194 | obj.enumerable = Desc['[[Enumerable]]'];
|
11195 | }
|
11196 | if ('[[Configurable]]' in Desc) {
|
11197 | obj.configurable = Desc['[[Configurable]]'];
|
11198 | }
|
11199 | return obj;
|
11200 | },
|
11201 |
|
11202 |
|
11203 | CompletePropertyDescriptor: function CompletePropertyDescriptor(Desc) {
|
11204 | assertRecord(this, 'Property Descriptor', 'Desc', Desc);
|
11205 |
|
11206 | if (this.IsGenericDescriptor(Desc) || this.IsDataDescriptor(Desc)) {
|
11207 | if (!has(Desc, '[[Value]]')) {
|
11208 | Desc['[[Value]]'] = void 0;
|
11209 | }
|
11210 | if (!has(Desc, '[[Writable]]')) {
|
11211 | Desc['[[Writable]]'] = false;
|
11212 | }
|
11213 | } else {
|
11214 | if (!has(Desc, '[[Get]]')) {
|
11215 | Desc['[[Get]]'] = void 0;
|
11216 | }
|
11217 | if (!has(Desc, '[[Set]]')) {
|
11218 | Desc['[[Set]]'] = void 0;
|
11219 | }
|
11220 | }
|
11221 | if (!has(Desc, '[[Enumerable]]')) {
|
11222 | Desc['[[Enumerable]]'] = false;
|
11223 | }
|
11224 | if (!has(Desc, '[[Configurable]]')) {
|
11225 | Desc['[[Configurable]]'] = false;
|
11226 | }
|
11227 | return Desc;
|
11228 | },
|
11229 |
|
11230 |
|
11231 | Set: function Set(O, P, V, Throw) {
|
11232 | if (this.Type(O) !== 'Object') {
|
11233 | throw new $TypeError('O must be an Object');
|
11234 | }
|
11235 | if (!this.IsPropertyKey(P)) {
|
11236 | throw new $TypeError('P must be a Property Key');
|
11237 | }
|
11238 | if (this.Type(Throw) !== 'Boolean') {
|
11239 | throw new $TypeError('Throw must be a Boolean');
|
11240 | }
|
11241 | if (Throw) {
|
11242 | O[P] = V;
|
11243 | return true;
|
11244 | } else {
|
11245 | try {
|
11246 | O[P] = V;
|
11247 | } catch (e) {
|
11248 | return false;
|
11249 | }
|
11250 | }
|
11251 | },
|
11252 |
|
11253 |
|
11254 | HasOwnProperty: function HasOwnProperty(O, P) {
|
11255 | if (this.Type(O) !== 'Object') {
|
11256 | throw new $TypeError('O must be an Object');
|
11257 | }
|
11258 | if (!this.IsPropertyKey(P)) {
|
11259 | throw new $TypeError('P must be a Property Key');
|
11260 | }
|
11261 | return has(O, P);
|
11262 | },
|
11263 |
|
11264 |
|
11265 | HasProperty: function HasProperty(O, P) {
|
11266 | if (this.Type(O) !== 'Object') {
|
11267 | throw new $TypeError('O must be an Object');
|
11268 | }
|
11269 | if (!this.IsPropertyKey(P)) {
|
11270 | throw new $TypeError('P must be a Property Key');
|
11271 | }
|
11272 | return P in O;
|
11273 | },
|
11274 |
|
11275 |
|
11276 | IsConcatSpreadable: function IsConcatSpreadable(O) {
|
11277 | if (this.Type(O) !== 'Object') {
|
11278 | return false;
|
11279 | }
|
11280 | if (hasSymbols && typeof $Symbol.isConcatSpreadable === 'symbol') {
|
11281 | var spreadable = this.Get(O, Symbol.isConcatSpreadable);
|
11282 | if (typeof spreadable !== 'undefined') {
|
11283 | return this.ToBoolean(spreadable);
|
11284 | }
|
11285 | }
|
11286 | return this.IsArray(O);
|
11287 | },
|
11288 |
|
11289 |
|
11290 | Invoke: function Invoke(O, P) {
|
11291 | if (!this.IsPropertyKey(P)) {
|
11292 | throw new $TypeError('P must be a Property Key');
|
11293 | }
|
11294 | var argumentsList = arraySlice(arguments, 2);
|
11295 | var func = this.GetV(O, P);
|
11296 | return this.Call(func, O, argumentsList);
|
11297 | },
|
11298 |
|
11299 |
|
11300 | GetIterator: function GetIterator(obj, method) {
|
11301 | var actualMethod = method;
|
11302 | if (arguments.length < 2) {
|
11303 | if (!hasSymbols) {
|
11304 | throw new SyntaxError('GetIterator depends on native Symbol support when `method` is not passed');
|
11305 | }
|
11306 | actualMethod = this.GetMethod(obj, $Symbol.iterator);
|
11307 | }
|
11308 | var iterator = this.Call(actualMethod, obj);
|
11309 | if (this.Type(iterator) !== 'Object') {
|
11310 | throw new $TypeError('iterator must return an object');
|
11311 | }
|
11312 |
|
11313 | return iterator;
|
11314 | },
|
11315 |
|
11316 |
|
11317 | IteratorNext: function IteratorNext(iterator, value) {
|
11318 | var result = this.Invoke(iterator, 'next', arguments.length < 2 ? [] : [value]);
|
11319 | if (this.Type(result) !== 'Object') {
|
11320 | throw new $TypeError('iterator next must return an object');
|
11321 | }
|
11322 | return result;
|
11323 | },
|
11324 |
|
11325 |
|
11326 | IteratorComplete: function IteratorComplete(iterResult) {
|
11327 | if (this.Type(iterResult) !== 'Object') {
|
11328 | throw new $TypeError('Assertion failed: Type(iterResult) is not Object');
|
11329 | }
|
11330 | return this.ToBoolean(this.Get(iterResult, 'done'));
|
11331 | },
|
11332 |
|
11333 |
|
11334 | IteratorValue: function IteratorValue(iterResult) {
|
11335 | if (this.Type(iterResult) !== 'Object') {
|
11336 | throw new $TypeError('Assertion failed: Type(iterResult) is not Object');
|
11337 | }
|
11338 | return this.Get(iterResult, 'value');
|
11339 | },
|
11340 |
|
11341 |
|
11342 | IteratorStep: function IteratorStep(iterator) {
|
11343 | var result = this.IteratorNext(iterator);
|
11344 | var done = this.IteratorComplete(result);
|
11345 | return done === true ? false : result;
|
11346 | },
|
11347 |
|
11348 |
|
11349 | IteratorClose: function IteratorClose(iterator, completion) {
|
11350 | if (this.Type(iterator) !== 'Object') {
|
11351 | throw new $TypeError('Assertion failed: Type(iterator) is not Object');
|
11352 | }
|
11353 | if (!this.IsCallable(completion)) {
|
11354 | throw new $TypeError('Assertion failed: completion is not a thunk for a Completion Record');
|
11355 | }
|
11356 | var completionThunk = completion;
|
11357 |
|
11358 | var iteratorReturn = this.GetMethod(iterator, 'return');
|
11359 |
|
11360 | if (typeof iteratorReturn === 'undefined') {
|
11361 | return completionThunk();
|
11362 | }
|
11363 |
|
11364 | var completionRecord;
|
11365 | try {
|
11366 | var innerResult = this.Call(iteratorReturn, iterator, []);
|
11367 | } catch (e) {
|
11368 |
|
11369 |
|
11370 |
|
11371 | completionRecord = completionThunk();
|
11372 | completionThunk = null;
|
11373 |
|
11374 |
|
11375 | throw e;
|
11376 | }
|
11377 | completionRecord = completionThunk();
|
11378 | completionThunk = null;
|
11379 |
|
11380 | if (this.Type(innerResult) !== 'Object') {
|
11381 | throw new $TypeError('iterator .return must return an object');
|
11382 | }
|
11383 |
|
11384 | return completionRecord;
|
11385 | },
|
11386 |
|
11387 |
|
11388 | CreateIterResultObject: function CreateIterResultObject(value, done) {
|
11389 | if (this.Type(done) !== 'Boolean') {
|
11390 | throw new $TypeError('Assertion failed: Type(done) is not Boolean');
|
11391 | }
|
11392 | return {
|
11393 | value: value,
|
11394 | done: done
|
11395 | };
|
11396 | },
|
11397 |
|
11398 |
|
11399 | RegExpExec: function RegExpExec(R, S) {
|
11400 | if (this.Type(R) !== 'Object') {
|
11401 | throw new $TypeError('R must be an Object');
|
11402 | }
|
11403 | if (this.Type(S) !== 'String') {
|
11404 | throw new $TypeError('S must be a String');
|
11405 | }
|
11406 | var exec = this.Get(R, 'exec');
|
11407 | if (this.IsCallable(exec)) {
|
11408 | var result = this.Call(exec, R, [S]);
|
11409 | if (result === null || this.Type(result) === 'Object') {
|
11410 | return result;
|
11411 | }
|
11412 | throw new $TypeError('"exec" method must return `null` or an Object');
|
11413 | }
|
11414 | return regexExec(R, S);
|
11415 | },
|
11416 |
|
11417 |
|
11418 | ArraySpeciesCreate: function ArraySpeciesCreate(originalArray, length) {
|
11419 | if (!this.IsInteger(length) || length < 0) {
|
11420 | throw new $TypeError('Assertion failed: length must be an integer >= 0');
|
11421 | }
|
11422 | var len = length === 0 ? 0 : length;
|
11423 | var C;
|
11424 | var isArray = this.IsArray(originalArray);
|
11425 | if (isArray) {
|
11426 | C = this.Get(originalArray, 'constructor');
|
11427 |
|
11428 |
|
11429 |
|
11430 |
|
11431 |
|
11432 | if (this.Type(C) === 'Object' && hasSymbols && $Symbol.species) {
|
11433 | C = this.Get(C, $Symbol.species);
|
11434 | if (C === null) {
|
11435 | C = void 0;
|
11436 | }
|
11437 | }
|
11438 | }
|
11439 | if (typeof C === 'undefined') {
|
11440 | return $Array(len);
|
11441 | }
|
11442 | if (!this.IsConstructor(C)) {
|
11443 | throw new $TypeError('C must be a constructor');
|
11444 | }
|
11445 | return new C(len);
|
11446 | },
|
11447 |
|
11448 | CreateDataProperty: function CreateDataProperty(O, P, V) {
|
11449 | if (this.Type(O) !== 'Object') {
|
11450 | throw new $TypeError('Assertion failed: Type(O) is not Object');
|
11451 | }
|
11452 | if (!this.IsPropertyKey(P)) {
|
11453 | throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true');
|
11454 | }
|
11455 | var oldDesc = $gOPD(O, P);
|
11456 | var extensible = oldDesc || this.IsExtensible(O);
|
11457 | var immutable = oldDesc && (!oldDesc.writable || !oldDesc.configurable);
|
11458 | if (immutable || !extensible) {
|
11459 | return false;
|
11460 | }
|
11461 | return DefineOwnProperty(this, O, P, {
|
11462 | '[[Configurable]]': true,
|
11463 | '[[Enumerable]]': true,
|
11464 | '[[Value]]': V,
|
11465 | '[[Writable]]': true
|
11466 | });
|
11467 | },
|
11468 |
|
11469 |
|
11470 | CreateDataPropertyOrThrow: function CreateDataPropertyOrThrow(O, P, V) {
|
11471 | if (this.Type(O) !== 'Object') {
|
11472 | throw new $TypeError('Assertion failed: Type(O) is not Object');
|
11473 | }
|
11474 | if (!this.IsPropertyKey(P)) {
|
11475 | throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true');
|
11476 | }
|
11477 | var success = this.CreateDataProperty(O, P, V);
|
11478 | if (!success) {
|
11479 | throw new $TypeError('unable to create data property');
|
11480 | }
|
11481 | return success;
|
11482 | },
|
11483 |
|
11484 |
|
11485 | ObjectCreate: function ObjectCreate(proto, internalSlotsList) {
|
11486 | if (proto !== null && this.Type(proto) !== 'Object') {
|
11487 | throw new $TypeError('Assertion failed: proto must be null or an object');
|
11488 | }
|
11489 | var slots = arguments.length < 2 ? [] : internalSlotsList;
|
11490 | if (slots.length > 0) {
|
11491 | throw new $SyntaxError('es-abstract does not yet support internal slots');
|
11492 | }
|
11493 |
|
11494 | if (proto === null && !$ObjectCreate) {
|
11495 | throw new $SyntaxError('native Object.create support is required to create null objects');
|
11496 | }
|
11497 |
|
11498 | return $ObjectCreate(proto);
|
11499 | },
|
11500 |
|
11501 |
|
11502 | AdvanceStringIndex: function AdvanceStringIndex(S, index, unicode) {
|
11503 | if (this.Type(S) !== 'String') {
|
11504 | throw new $TypeError('S must be a String');
|
11505 | }
|
11506 | if (!this.IsInteger(index) || index < 0 || index > MAX_SAFE_INTEGER) {
|
11507 | throw new $TypeError('Assertion failed: length must be an integer >= 0 and <= 2**53');
|
11508 | }
|
11509 | if (this.Type(unicode) !== 'Boolean') {
|
11510 | throw new $TypeError('Assertion failed: unicode must be a Boolean');
|
11511 | }
|
11512 | if (!unicode) {
|
11513 | return index + 1;
|
11514 | }
|
11515 | var length = S.length;
|
11516 | if ((index + 1) >= length) {
|
11517 | return index + 1;
|
11518 | }
|
11519 |
|
11520 | var first = $charCodeAt(S, index);
|
11521 | if (first < 0xD800 || first > 0xDBFF) {
|
11522 | return index + 1;
|
11523 | }
|
11524 |
|
11525 | var second = $charCodeAt(S, index + 1);
|
11526 | if (second < 0xDC00 || second > 0xDFFF) {
|
11527 | return index + 1;
|
11528 | }
|
11529 |
|
11530 | return index + 2;
|
11531 | },
|
11532 |
|
11533 |
|
11534 | CreateMethodProperty: function CreateMethodProperty(O, P, V) {
|
11535 | if (this.Type(O) !== 'Object') {
|
11536 | throw new $TypeError('Assertion failed: Type(O) is not Object');
|
11537 | }
|
11538 |
|
11539 | if (!this.IsPropertyKey(P)) {
|
11540 | throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true');
|
11541 | }
|
11542 |
|
11543 | var newDesc = {
|
11544 | '[[Configurable]]': true,
|
11545 | '[[Enumerable]]': false,
|
11546 | '[[Value]]': V,
|
11547 | '[[Writable]]': true
|
11548 | };
|
11549 | return DefineOwnProperty(this, O, P, newDesc);
|
11550 | },
|
11551 |
|
11552 |
|
11553 | DefinePropertyOrThrow: function DefinePropertyOrThrow(O, P, desc) {
|
11554 | if (this.Type(O) !== 'Object') {
|
11555 | throw new $TypeError('Assertion failed: Type(O) is not Object');
|
11556 | }
|
11557 |
|
11558 | if (!this.IsPropertyKey(P)) {
|
11559 | throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true');
|
11560 | }
|
11561 |
|
11562 | var Desc = isPropertyDescriptor(this, desc) ? desc : this.ToPropertyDescriptor(desc);
|
11563 | if (!isPropertyDescriptor(this, Desc)) {
|
11564 | throw new $TypeError('Assertion failed: Desc is not a valid Property Descriptor');
|
11565 | }
|
11566 |
|
11567 | return DefineOwnProperty(this, O, P, Desc);
|
11568 | },
|
11569 |
|
11570 |
|
11571 | DeletePropertyOrThrow: function DeletePropertyOrThrow(O, P) {
|
11572 | if (this.Type(O) !== 'Object') {
|
11573 | throw new $TypeError('Assertion failed: Type(O) is not Object');
|
11574 | }
|
11575 |
|
11576 | if (!this.IsPropertyKey(P)) {
|
11577 | throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true');
|
11578 | }
|
11579 |
|
11580 | var success = delete O[P];
|
11581 | if (!success) {
|
11582 | throw new TypeError('Attempt to delete property failed.');
|
11583 | }
|
11584 | return success;
|
11585 | },
|
11586 |
|
11587 |
|
11588 | EnumerableOwnNames: function EnumerableOwnNames(O) {
|
11589 | if (this.Type(O) !== 'Object') {
|
11590 | throw new $TypeError('Assertion failed: Type(O) is not Object');
|
11591 | }
|
11592 |
|
11593 | return keys(O);
|
11594 | },
|
11595 |
|
11596 |
|
11597 | thisNumberValue: function thisNumberValue(value) {
|
11598 | if (this.Type(value) === 'Number') {
|
11599 | return value;
|
11600 | }
|
11601 |
|
11602 | return $NumberValueOf(value);
|
11603 | },
|
11604 |
|
11605 |
|
11606 | thisBooleanValue: function thisBooleanValue(value) {
|
11607 | if (this.Type(value) === 'Boolean') {
|
11608 | return value;
|
11609 | }
|
11610 |
|
11611 | return $BooleanValueOf(value);
|
11612 | },
|
11613 |
|
11614 |
|
11615 | thisStringValue: function thisStringValue(value) {
|
11616 | if (this.Type(value) === 'String') {
|
11617 | return value;
|
11618 | }
|
11619 |
|
11620 | return $StringValueOf(value);
|
11621 | },
|
11622 |
|
11623 |
|
11624 | thisTimeValue: function thisTimeValue(value) {
|
11625 | return $DateValueOf(value);
|
11626 | },
|
11627 |
|
11628 |
|
11629 | SetIntegrityLevel: function SetIntegrityLevel(O, level) {
|
11630 | if (this.Type(O) !== 'Object') {
|
11631 | throw new $TypeError('Assertion failed: Type(O) is not Object');
|
11632 | }
|
11633 | if (level !== 'sealed' && level !== 'frozen') {
|
11634 | throw new $TypeError('Assertion failed: `level` must be `"sealed"` or `"frozen"`');
|
11635 | }
|
11636 | if (!$preventExtensions) {
|
11637 | throw new $SyntaxError('SetIntegrityLevel requires native `Object.preventExtensions` support');
|
11638 | }
|
11639 | var status = $preventExtensions(O);
|
11640 | if (!status) {
|
11641 | return false;
|
11642 | }
|
11643 | if (!$gOPN) {
|
11644 | throw new $SyntaxError('SetIntegrityLevel requires native `Object.getOwnPropertyNames` support');
|
11645 | }
|
11646 | var theKeys = $gOPN(O);
|
11647 | var ES = this;
|
11648 | if (level === 'sealed') {
|
11649 | forEach(theKeys, function (k) {
|
11650 | ES.DefinePropertyOrThrow(O, k, { configurable: false });
|
11651 | });
|
11652 | } else if (level === 'frozen') {
|
11653 | forEach(theKeys, function (k) {
|
11654 | var currentDesc = $gOPD(O, k);
|
11655 | if (typeof currentDesc !== 'undefined') {
|
11656 | var desc;
|
11657 | if (ES.IsAccessorDescriptor(ES.ToPropertyDescriptor(currentDesc))) {
|
11658 | desc = { configurable: false };
|
11659 | } else {
|
11660 | desc = { configurable: false, writable: false };
|
11661 | }
|
11662 | ES.DefinePropertyOrThrow(O, k, desc);
|
11663 | }
|
11664 | });
|
11665 | }
|
11666 | return true;
|
11667 | },
|
11668 |
|
11669 |
|
11670 | TestIntegrityLevel: function TestIntegrityLevel(O, level) {
|
11671 | if (this.Type(O) !== 'Object') {
|
11672 | throw new $TypeError('Assertion failed: Type(O) is not Object');
|
11673 | }
|
11674 | if (level !== 'sealed' && level !== 'frozen') {
|
11675 | throw new $TypeError('Assertion failed: `level` must be `"sealed"` or `"frozen"`');
|
11676 | }
|
11677 | var status = this.IsExtensible(O);
|
11678 | if (status) {
|
11679 | return false;
|
11680 | }
|
11681 | var theKeys = $gOPN(O);
|
11682 | var ES = this;
|
11683 | return theKeys.length === 0 || every(theKeys, function (k) {
|
11684 | var currentDesc = $gOPD(O, k);
|
11685 | if (typeof currentDesc !== 'undefined') {
|
11686 | if (currentDesc.configurable) {
|
11687 | return false;
|
11688 | }
|
11689 | if (level === 'frozen' && ES.IsDataDescriptor(ES.ToPropertyDescriptor(currentDesc)) && currentDesc.writable) {
|
11690 | return false;
|
11691 | }
|
11692 | }
|
11693 | return true;
|
11694 | });
|
11695 | },
|
11696 |
|
11697 |
|
11698 | OrdinaryHasInstance: function OrdinaryHasInstance(C, O) {
|
11699 | if (this.IsCallable(C) === false) {
|
11700 | return false;
|
11701 | }
|
11702 | if (this.Type(O) !== 'Object') {
|
11703 | return false;
|
11704 | }
|
11705 | var P = this.Get(C, 'prototype');
|
11706 | if (this.Type(P) !== 'Object') {
|
11707 | throw new $TypeError('OrdinaryHasInstance called on an object with an invalid prototype property.');
|
11708 | }
|
11709 | return O instanceof C;
|
11710 | },
|
11711 |
|
11712 |
|
11713 | OrdinaryHasProperty: function OrdinaryHasProperty(O, P) {
|
11714 | if (this.Type(O) !== 'Object') {
|
11715 | throw new $TypeError('Assertion failed: Type(O) is not Object');
|
11716 | }
|
11717 | if (!this.IsPropertyKey(P)) {
|
11718 | throw new $TypeError('Assertion failed: P must be a Property Key');
|
11719 | }
|
11720 | return P in O;
|
11721 | },
|
11722 |
|
11723 |
|
11724 | InstanceofOperator: function InstanceofOperator(O, C) {
|
11725 | if (this.Type(O) !== 'Object') {
|
11726 | throw new $TypeError('Assertion failed: Type(O) is not Object');
|
11727 | }
|
11728 | var instOfHandler = hasSymbols && $Symbol.hasInstance ? this.GetMethod(C, $Symbol.hasInstance) : void 0;
|
11729 | if (typeof instOfHandler !== 'undefined') {
|
11730 | return this.ToBoolean(this.Call(instOfHandler, C, [O]));
|
11731 | }
|
11732 | if (!this.IsCallable(C)) {
|
11733 | throw new $TypeError('`C` is not Callable');
|
11734 | }
|
11735 | return this.OrdinaryHasInstance(C, O);
|
11736 | },
|
11737 |
|
11738 |
|
11739 | IsPromise: function IsPromise(x) {
|
11740 | if (this.Type(x) !== 'Object') {
|
11741 | return false;
|
11742 | }
|
11743 | if (!$Promise) {
|
11744 | return false;
|
11745 | }
|
11746 | try {
|
11747 | $PromiseThen(x);
|
11748 | } catch (e) {
|
11749 | return false;
|
11750 | }
|
11751 | return true;
|
11752 | },
|
11753 |
|
11754 |
|
11755 | 'Abstract Equality Comparison': function AbstractEqualityComparison(x, y) {
|
11756 | var xType = this.Type(x);
|
11757 | var yType = this.Type(y);
|
11758 | if (xType === yType) {
|
11759 | return x === y;
|
11760 | }
|
11761 | if (x == null && y == null) {
|
11762 | return true;
|
11763 | }
|
11764 | if (xType === 'Number' && yType === 'String') {
|
11765 | return this['Abstract Equality Comparison'](x, this.ToNumber(y));
|
11766 | }
|
11767 | if (xType === 'String' && yType === 'Number') {
|
11768 | return this['Abstract Equality Comparison'](this.ToNumber(x), y);
|
11769 | }
|
11770 | if (xType === 'Boolean') {
|
11771 | return this['Abstract Equality Comparison'](this.ToNumber(x), y);
|
11772 | }
|
11773 | if (yType === 'Boolean') {
|
11774 | return this['Abstract Equality Comparison'](x, this.ToNumber(y));
|
11775 | }
|
11776 | if ((xType === 'String' || xType === 'Number' || xType === 'Symbol') && yType === 'Object') {
|
11777 | return this['Abstract Equality Comparison'](x, this.ToPrimitive(y));
|
11778 | }
|
11779 | if (xType === 'Object' && (yType === 'String' || yType === 'Number' || yType === 'Symbol')) {
|
11780 | return this['Abstract Equality Comparison'](this.ToPrimitive(x), y);
|
11781 | }
|
11782 | return false;
|
11783 | },
|
11784 |
|
11785 |
|
11786 | ValidateAndApplyPropertyDescriptor: function ValidateAndApplyPropertyDescriptor(O, P, extensible, Desc, current) {
|
11787 |
|
11788 | var oType = this.Type(O);
|
11789 | if (oType !== 'Undefined' && oType !== 'Object') {
|
11790 | throw new $TypeError('Assertion failed: O must be undefined or an Object');
|
11791 | }
|
11792 | if (this.Type(extensible) !== 'Boolean') {
|
11793 | throw new $TypeError('Assertion failed: extensible must be a Boolean');
|
11794 | }
|
11795 | if (!isPropertyDescriptor(this, Desc)) {
|
11796 | throw new $TypeError('Assertion failed: Desc must be a Property Descriptor');
|
11797 | }
|
11798 | if (this.Type(current) !== 'Undefined' && !isPropertyDescriptor(this, current)) {
|
11799 | throw new $TypeError('Assertion failed: current must be a Property Descriptor, or undefined');
|
11800 | }
|
11801 | if (oType !== 'Undefined' && !this.IsPropertyKey(P)) {
|
11802 | throw new $TypeError('Assertion failed: if O is not undefined, P must be a Property Key');
|
11803 | }
|
11804 | if (this.Type(current) === 'Undefined') {
|
11805 | if (!extensible) {
|
11806 | return false;
|
11807 | }
|
11808 | if (this.IsGenericDescriptor(Desc) || this.IsDataDescriptor(Desc)) {
|
11809 | if (oType !== 'Undefined') {
|
11810 | DefineOwnProperty(this, O, P, {
|
11811 | '[[Configurable]]': Desc['[[Configurable]]'],
|
11812 | '[[Enumerable]]': Desc['[[Enumerable]]'],
|
11813 | '[[Value]]': Desc['[[Value]]'],
|
11814 | '[[Writable]]': Desc['[[Writable]]']
|
11815 | });
|
11816 | }
|
11817 | } else {
|
11818 | if (!this.IsAccessorDescriptor(Desc)) {
|
11819 | throw new $TypeError('Assertion failed: Desc is not an accessor descriptor');
|
11820 | }
|
11821 | if (oType !== 'Undefined') {
|
11822 | return DefineOwnProperty(this, O, P, Desc);
|
11823 | }
|
11824 | }
|
11825 | return true;
|
11826 | }
|
11827 | if (this.IsGenericDescriptor(Desc) && !('[[Configurable]]' in Desc) && !('[[Enumerable]]' in Desc)) {
|
11828 | return true;
|
11829 | }
|
11830 | if (isSamePropertyDescriptor(this, Desc, current)) {
|
11831 | return true;
|
11832 | }
|
11833 |
|
11834 | if (!current['[[Configurable]]']) {
|
11835 | if (Desc['[[Configurable]]']) {
|
11836 | return false;
|
11837 | }
|
11838 | if ('[[Enumerable]]' in Desc && !Desc['[[Enumerable]]'] === !!current['[[Enumerable]]']) {
|
11839 | return false;
|
11840 | }
|
11841 | }
|
11842 | if (this.IsGenericDescriptor(Desc)) {
|
11843 |
|
11844 | } else if (this.IsDataDescriptor(current) !== this.IsDataDescriptor(Desc)) {
|
11845 | if (!current['[[Configurable]]']) {
|
11846 | return false;
|
11847 | }
|
11848 | if (this.IsDataDescriptor(current)) {
|
11849 | if (oType !== 'Undefined') {
|
11850 | DefineOwnProperty(this, O, P, {
|
11851 | '[[Configurable]]': current['[[Configurable]]'],
|
11852 | '[[Enumerable]]': current['[[Enumerable]]'],
|
11853 | '[[Get]]': undefined
|
11854 | });
|
11855 | }
|
11856 | } else if (oType !== 'Undefined') {
|
11857 | DefineOwnProperty(this, O, P, {
|
11858 | '[[Configurable]]': current['[[Configurable]]'],
|
11859 | '[[Enumerable]]': current['[[Enumerable]]'],
|
11860 | '[[Value]]': undefined
|
11861 | });
|
11862 | }
|
11863 | } else if (this.IsDataDescriptor(current) && this.IsDataDescriptor(Desc)) {
|
11864 | if (!current['[[Configurable]]'] && !current['[[Writable]]']) {
|
11865 | if ('[[Writable]]' in Desc && Desc['[[Writable]]']) {
|
11866 | return false;
|
11867 | }
|
11868 | if ('[[Value]]' in Desc && !this.SameValue(Desc['[[Value]]'], current['[[Value]]'])) {
|
11869 | return false;
|
11870 | }
|
11871 | return true;
|
11872 | }
|
11873 | } else if (this.IsAccessorDescriptor(current) && this.IsAccessorDescriptor(Desc)) {
|
11874 | if (!current['[[Configurable]]']) {
|
11875 | if ('[[Set]]' in Desc && !this.SameValue(Desc['[[Set]]'], current['[[Set]]'])) {
|
11876 | return false;
|
11877 | }
|
11878 | if ('[[Get]]' in Desc && !this.SameValue(Desc['[[Get]]'], current['[[Get]]'])) {
|
11879 | return false;
|
11880 | }
|
11881 | return true;
|
11882 | }
|
11883 | } else {
|
11884 | throw new $TypeError('Assertion failed: current and Desc are not both data, both accessors, or one accessor and one data.');
|
11885 | }
|
11886 | if (oType !== 'Undefined') {
|
11887 | return DefineOwnProperty(this, O, P, Desc);
|
11888 | }
|
11889 | return true;
|
11890 | },
|
11891 |
|
11892 |
|
11893 | OrdinaryDefineOwnProperty: function OrdinaryDefineOwnProperty(O, P, Desc) {
|
11894 | if (this.Type(O) !== 'Object') {
|
11895 | throw new $TypeError('Assertion failed: O must be an Object');
|
11896 | }
|
11897 | if (!this.IsPropertyKey(P)) {
|
11898 | throw new $TypeError('Assertion failed: P must be a Property Key');
|
11899 | }
|
11900 | if (!isPropertyDescriptor(this, Desc)) {
|
11901 | throw new $TypeError('Assertion failed: Desc must be a Property Descriptor');
|
11902 | }
|
11903 | var desc = $gOPD(O, P);
|
11904 | var current = desc && this.ToPropertyDescriptor(desc);
|
11905 | var extensible = this.IsExtensible(O);
|
11906 | return this.ValidateAndApplyPropertyDescriptor(O, P, extensible, Desc, current);
|
11907 | },
|
11908 |
|
11909 |
|
11910 | OrdinaryGetOwnProperty: function OrdinaryGetOwnProperty(O, P) {
|
11911 | if (this.Type(O) !== 'Object') {
|
11912 | throw new $TypeError('Assertion failed: O must be an Object');
|
11913 | }
|
11914 | if (!this.IsPropertyKey(P)) {
|
11915 | throw new $TypeError('Assertion failed: P must be a Property Key');
|
11916 | }
|
11917 | if (!has(O, P)) {
|
11918 | return void 0;
|
11919 | }
|
11920 | if (!$gOPD) {
|
11921 |
|
11922 | var arrayLength = this.IsArray(O) && P === 'length';
|
11923 | var regexLastIndex = this.IsRegExp(O) && P === 'lastIndex';
|
11924 | return {
|
11925 | '[[Configurable]]': !(arrayLength || regexLastIndex),
|
11926 | '[[Enumerable]]': $isEnumerable(O, P),
|
11927 | '[[Value]]': O[P],
|
11928 | '[[Writable]]': true
|
11929 | };
|
11930 | }
|
11931 | return this.ToPropertyDescriptor($gOPD(O, P));
|
11932 | },
|
11933 |
|
11934 |
|
11935 | ArrayCreate: function ArrayCreate(length) {
|
11936 | if (!this.IsInteger(length) || length < 0) {
|
11937 | throw new $TypeError('Assertion failed: `length` must be an integer Number >= 0');
|
11938 | }
|
11939 | if (length > MAX_ARRAY_LENGTH) {
|
11940 | throw new $RangeError('length is greater than (2**32 - 1)');
|
11941 | }
|
11942 | var proto = arguments.length > 1 ? arguments[1] : $ArrayPrototype;
|
11943 | var A = [];
|
11944 | if (proto !== $ArrayPrototype) {
|
11945 | if (!$setProto) {
|
11946 | throw new $SyntaxError('ArrayCreate: a `proto` argument that is not `Array.prototype` is not supported in an environment that does not support setting the [[Prototype]]');
|
11947 | }
|
11948 | $setProto(A, proto);
|
11949 | }
|
11950 | if (length !== 0) {
|
11951 | A.length = length;
|
11952 | }
|
11953 | |
11954 |
|
11955 |
|
11956 |
|
11957 |
|
11958 |
|
11959 |
|
11960 |
|
11961 | return A;
|
11962 | },
|
11963 |
|
11964 |
|
11965 | ArraySetLength: function ArraySetLength(A, Desc) {
|
11966 | if (!this.IsArray(A)) {
|
11967 | throw new $TypeError('Assertion failed: A must be an Array');
|
11968 | }
|
11969 | if (!isPropertyDescriptor(this, Desc)) {
|
11970 | throw new $TypeError('Assertion failed: Desc must be a Property Descriptor');
|
11971 | }
|
11972 | if (!('[[Value]]' in Desc)) {
|
11973 | return this.OrdinaryDefineOwnProperty(A, 'length', Desc);
|
11974 | }
|
11975 | var newLenDesc = assign({}, Desc);
|
11976 | var newLen = this.ToUint32(Desc['[[Value]]']);
|
11977 | var numberLen = this.ToNumber(Desc['[[Value]]']);
|
11978 | if (newLen !== numberLen) {
|
11979 | throw new $RangeError('Invalid array length');
|
11980 | }
|
11981 | newLenDesc['[[Value]]'] = newLen;
|
11982 | var oldLenDesc = this.OrdinaryGetOwnProperty(A, 'length');
|
11983 | if (!this.IsDataDescriptor(oldLenDesc)) {
|
11984 | throw new $TypeError('Assertion failed: an array had a non-data descriptor on `length`');
|
11985 | }
|
11986 | var oldLen = oldLenDesc['[[Value]]'];
|
11987 | if (newLen >= oldLen) {
|
11988 | return this.OrdinaryDefineOwnProperty(A, 'length', newLenDesc);
|
11989 | }
|
11990 | if (!oldLenDesc['[[Writable]]']) {
|
11991 | return false;
|
11992 | }
|
11993 | var newWritable;
|
11994 | if (!('[[Writable]]' in newLenDesc) || newLenDesc['[[Writable]]']) {
|
11995 | newWritable = true;
|
11996 | } else {
|
11997 | newWritable = false;
|
11998 | newLenDesc['[[Writable]]'] = true;
|
11999 | }
|
12000 | var succeeded = this.OrdinaryDefineOwnProperty(A, 'length', newLenDesc);
|
12001 | if (!succeeded) {
|
12002 | return false;
|
12003 | }
|
12004 | while (newLen < oldLen) {
|
12005 | oldLen -= 1;
|
12006 | var deleteSucceeded = delete A[this.ToString(oldLen)];
|
12007 | if (!deleteSucceeded) {
|
12008 | newLenDesc['[[Value]]'] = oldLen + 1;
|
12009 | if (!newWritable) {
|
12010 | newLenDesc['[[Writable]]'] = false;
|
12011 | this.OrdinaryDefineOwnProperty(A, 'length', newLenDesc);
|
12012 | return false;
|
12013 | }
|
12014 | }
|
12015 | }
|
12016 | if (!newWritable) {
|
12017 | return this.OrdinaryDefineOwnProperty(A, 'length', { '[[Writable]]': false });
|
12018 | }
|
12019 | return true;
|
12020 | },
|
12021 |
|
12022 |
|
12023 | CreateHTML: function CreateHTML(string, tag, attribute, value) {
|
12024 | if (this.Type(tag) !== 'String' || this.Type(attribute) !== 'String') {
|
12025 | throw new $TypeError('Assertion failed: `tag` and `attribute` must be strings');
|
12026 | }
|
12027 | var str = this.RequireObjectCoercible(string);
|
12028 | var S = this.ToString(str);
|
12029 | var p1 = '<' + tag;
|
12030 | if (attribute !== '') {
|
12031 | var V = this.ToString(value);
|
12032 | var escapedV = $replace(V, /\x22/g, '"');
|
12033 | p1 += '\x20' + attribute + '\x3D\x22' + escapedV + '\x22';
|
12034 | }
|
12035 | return p1 + '>' + S + '</' + tag + '>';
|
12036 | },
|
12037 |
|
12038 |
|
12039 | GetOwnPropertyKeys: function GetOwnPropertyKeys(O, Type) {
|
12040 | if (this.Type(O) !== 'Object') {
|
12041 | throw new $TypeError('Assertion failed: Type(O) is not Object');
|
12042 | }
|
12043 | if (Type === 'Symbol') {
|
12044 | return hasSymbols && $gOPS ? $gOPS(O) : [];
|
12045 | }
|
12046 | if (Type === 'String') {
|
12047 | if (!$gOPN) {
|
12048 | return keys(O);
|
12049 | }
|
12050 | return $gOPN(O);
|
12051 | }
|
12052 | throw new $TypeError('Assertion failed: `Type` must be `"String"` or `"Symbol"`');
|
12053 | },
|
12054 |
|
12055 |
|
12056 | SymbolDescriptiveString: function SymbolDescriptiveString(sym) {
|
12057 | if (this.Type(sym) !== 'Symbol') {
|
12058 | throw new $TypeError('Assertion failed: `sym` must be a Symbol');
|
12059 | }
|
12060 | return $SymbolToString(sym);
|
12061 | },
|
12062 |
|
12063 |
|
12064 |
|
12065 | GetSubstitution: function GetSubstitution(matched, str, position, captures, replacement) {
|
12066 | if (this.Type(matched) !== 'String') {
|
12067 | throw new $TypeError('Assertion failed: `matched` must be a String');
|
12068 | }
|
12069 | var matchLength = matched.length;
|
12070 |
|
12071 | if (this.Type(str) !== 'String') {
|
12072 | throw new $TypeError('Assertion failed: `str` must be a String');
|
12073 | }
|
12074 | var stringLength = str.length;
|
12075 |
|
12076 | if (!this.IsInteger(position) || position < 0 || position > stringLength) {
|
12077 | throw new $TypeError('Assertion failed: `position` must be a nonnegative integer, and less than or equal to the length of `string`, got ' + inspect(position));
|
12078 | }
|
12079 |
|
12080 | var ES = this;
|
12081 | var isStringOrHole = function (capture, index, arr) { return ES.Type(capture) === 'String' || !(index in arr); };
|
12082 | if (!this.IsArray(captures) || !every(captures, isStringOrHole)) {
|
12083 | throw new $TypeError('Assertion failed: `captures` must be a List of Strings, got ' + inspect(captures));
|
12084 | }
|
12085 |
|
12086 | if (this.Type(replacement) !== 'String') {
|
12087 | throw new $TypeError('Assertion failed: `replacement` must be a String');
|
12088 | }
|
12089 |
|
12090 | var tailPos = position + matchLength;
|
12091 | var m = captures.length;
|
12092 |
|
12093 | var result = '';
|
12094 | for (var i = 0; i < replacement.length; i += 1) {
|
12095 |
|
12096 | var current = replacement[i];
|
12097 | var isLast = (i + 1) >= replacement.length;
|
12098 | var nextIsLast = (i + 2) >= replacement.length;
|
12099 | if (current === '$' && !isLast) {
|
12100 | var next = replacement[i + 1];
|
12101 | if (next === '$') {
|
12102 | result += '$';
|
12103 | i += 1;
|
12104 | } else if (next === '&') {
|
12105 | result += matched;
|
12106 | i += 1;
|
12107 | } else if (next === '`') {
|
12108 | result += position === 0 ? '' : strSlice(str, 0, position - 1);
|
12109 | i += 1;
|
12110 | } else if (next === "'") {
|
12111 | result += tailPos >= stringLength ? '' : strSlice(str, tailPos);
|
12112 | i += 1;
|
12113 | } else {
|
12114 | var nextNext = nextIsLast ? null : replacement[i + 2];
|
12115 | if (isDigit(next) && next !== '0' && (nextIsLast || !isDigit(nextNext))) {
|
12116 |
|
12117 | var n = parseInteger(next, 10);
|
12118 |
|
12119 | result += (n <= m && this.Type(captures[n - 1]) === 'Undefined') ? '' : captures[n - 1];
|
12120 | i += 1;
|
12121 | } else if (isDigit(next) && (nextIsLast || isDigit(nextNext))) {
|
12122 |
|
12123 | var nn = next + nextNext;
|
12124 | var nnI = parseInteger(nn, 10) - 1;
|
12125 |
|
12126 | result += (nn <= m && this.Type(captures[nnI]) === 'Undefined') ? '' : captures[nnI];
|
12127 | i += 2;
|
12128 | } else {
|
12129 | result += '$';
|
12130 | }
|
12131 | }
|
12132 | } else {
|
12133 |
|
12134 | result += replacement[i];
|
12135 | }
|
12136 | }
|
12137 | return result;
|
12138 | }
|
12139 | });
|
12140 |
|
12141 | delete ES6.CheckObjectCoercible;
|
12142 |
|
12143 | module.exports = ES6;
|
12144 |
|
12145 | },{"./GetIntrinsic":191,"./es5":194,"./helpers/assertRecord":196,"./helpers/assign":197,"./helpers/callBind":198,"./helpers/every":199,"./helpers/forEach":200,"./helpers/isFinite":201,"./helpers/isNaN":202,"./helpers/isPrimitive":203,"./helpers/isPropertyDescriptor":204,"./helpers/isSamePropertyDescriptor":205,"./helpers/mod":206,"./helpers/sign":207,"es-to-primitive/es6":213,"has":222,"has-symbols":220,"is-regex":231,"object-inspect":239,"object-keys":209}],193:[function(require,module,exports){
|
12146 | 'use strict';
|
12147 |
|
12148 | var GetIntrinsic = require('./GetIntrinsic');
|
12149 |
|
12150 | var $Array = GetIntrinsic('%Array%');
|
12151 |
|
12152 | var hasSymbols = require('has-symbols')();
|
12153 |
|
12154 | var ES2015 = require('./es2015');
|
12155 | var assign = require('./helpers/assign');
|
12156 | var callBind = require('./helpers/callBind');
|
12157 |
|
12158 | var $arrayPush = callBind($Array.prototype.push);
|
12159 | var $arraySlice = callBind($Array.prototype.slice);
|
12160 | var $arrayJoin = callBind($Array.prototype.join);
|
12161 |
|
12162 | var ES2016 = assign(assign({}, ES2015), {
|
12163 |
|
12164 | SameValueNonNumber: function SameValueNonNumber(x, y) {
|
12165 | if (typeof x === 'number' || typeof x !== typeof y) {
|
12166 | throw new TypeError('SameValueNonNumber requires two non-number values of the same type.');
|
12167 | }
|
12168 | return this.SameValue(x, y);
|
12169 | },
|
12170 |
|
12171 |
|
12172 | IterableToArrayLike: function IterableToArrayLike(items) {
|
12173 | var usingIterator;
|
12174 | if (hasSymbols) {
|
12175 | usingIterator = this.GetMethod(items, Symbol.iterator);
|
12176 | } else if (this.IsArray(items)) {
|
12177 | usingIterator = function () {
|
12178 | var i = -1;
|
12179 | var arr = this;
|
12180 | return {
|
12181 | next: function () {
|
12182 | i += 1;
|
12183 | return {
|
12184 | done: i >= arr.length,
|
12185 | value: arr[i]
|
12186 | };
|
12187 | }
|
12188 | };
|
12189 | };
|
12190 | } else if (this.Type(items) === 'String') {
|
12191 | var ES = this;
|
12192 | usingIterator = function () {
|
12193 | var i = 0;
|
12194 | return {
|
12195 | next: function () {
|
12196 | var nextIndex = ES.AdvanceStringIndex(items, i, true);
|
12197 | var value = $arrayJoin($arraySlice(items, i, nextIndex), '');
|
12198 | i = nextIndex;
|
12199 | return {
|
12200 | done: nextIndex > items.length,
|
12201 | value: value
|
12202 | };
|
12203 | }
|
12204 | };
|
12205 | };
|
12206 | }
|
12207 | if (typeof usingIterator !== 'undefined') {
|
12208 | var iterator = this.GetIterator(items, usingIterator);
|
12209 | var values = [];
|
12210 | var next = true;
|
12211 | while (next) {
|
12212 | next = this.IteratorStep(iterator);
|
12213 | if (next) {
|
12214 | var nextValue = this.IteratorValue(next);
|
12215 | $arrayPush(values, nextValue);
|
12216 | }
|
12217 | }
|
12218 | return values;
|
12219 | }
|
12220 |
|
12221 | return this.ToObject(items);
|
12222 | }
|
12223 | });
|
12224 |
|
12225 | module.exports = ES2016;
|
12226 |
|
12227 | },{"./GetIntrinsic":191,"./es2015":192,"./helpers/assign":197,"./helpers/callBind":198,"has-symbols":220}],194:[function(require,module,exports){
|
12228 | 'use strict';
|
12229 |
|
12230 | var GetIntrinsic = require('./GetIntrinsic');
|
12231 |
|
12232 | var $Object = GetIntrinsic('%Object%');
|
12233 | var $TypeError = GetIntrinsic('%TypeError%');
|
12234 | var $String = GetIntrinsic('%String%');
|
12235 | var $Number = GetIntrinsic('%Number%');
|
12236 |
|
12237 | var assertRecord = require('./helpers/assertRecord');
|
12238 | var isPropertyDescriptor = require('./helpers/isPropertyDescriptor');
|
12239 | var $isNaN = require('./helpers/isNaN');
|
12240 | var $isFinite = require('./helpers/isFinite');
|
12241 |
|
12242 | var sign = require('./helpers/sign');
|
12243 | var mod = require('./helpers/mod');
|
12244 |
|
12245 | var IsCallable = require('is-callable');
|
12246 | var toPrimitive = require('es-to-primitive/es5');
|
12247 |
|
12248 | var has = require('has');
|
12249 |
|
12250 | var callBind = require('./helpers/callBind');
|
12251 | var strSlice = callBind($String.prototype.slice);
|
12252 |
|
12253 | var isPrefixOf = function isPrefixOf(prefix, string) {
|
12254 | if (prefix === string) {
|
12255 | return true;
|
12256 | }
|
12257 | if (prefix.length > string.length) {
|
12258 | return false;
|
12259 | }
|
12260 | return strSlice(string, 0, prefix.length) === prefix;
|
12261 | };
|
12262 |
|
12263 |
|
12264 | var ES5 = {
|
12265 | ToPrimitive: toPrimitive,
|
12266 |
|
12267 | ToBoolean: function ToBoolean(value) {
|
12268 | return !!value;
|
12269 | },
|
12270 | ToNumber: function ToNumber(value) {
|
12271 | return +value;
|
12272 | },
|
12273 | ToInteger: function ToInteger(value) {
|
12274 | var number = this.ToNumber(value);
|
12275 | if ($isNaN(number)) { return 0; }
|
12276 | if (number === 0 || !$isFinite(number)) { return number; }
|
12277 | return sign(number) * Math.floor(Math.abs(number));
|
12278 | },
|
12279 | ToInt32: function ToInt32(x) {
|
12280 | return this.ToNumber(x) >> 0;
|
12281 | },
|
12282 | ToUint32: function ToUint32(x) {
|
12283 | return this.ToNumber(x) >>> 0;
|
12284 | },
|
12285 | ToUint16: function ToUint16(value) {
|
12286 | var number = this.ToNumber(value);
|
12287 | if ($isNaN(number) || number === 0 || !$isFinite(number)) { return 0; }
|
12288 | var posInt = sign(number) * Math.floor(Math.abs(number));
|
12289 | return mod(posInt, 0x10000);
|
12290 | },
|
12291 | ToString: function ToString(value) {
|
12292 | return $String(value);
|
12293 | },
|
12294 | ToObject: function ToObject(value) {
|
12295 | this.CheckObjectCoercible(value);
|
12296 | return $Object(value);
|
12297 | },
|
12298 | CheckObjectCoercible: function CheckObjectCoercible(value, optMessage) {
|
12299 |
|
12300 | if (value == null) {
|
12301 | throw new $TypeError(optMessage || 'Cannot call method on ' + value);
|
12302 | }
|
12303 | return value;
|
12304 | },
|
12305 | IsCallable: IsCallable,
|
12306 | SameValue: function SameValue(x, y) {
|
12307 | if (x === y) {
|
12308 | if (x === 0) { return 1 / x === 1 / y; }
|
12309 | return true;
|
12310 | }
|
12311 | return $isNaN(x) && $isNaN(y);
|
12312 | },
|
12313 |
|
12314 |
|
12315 | Type: function Type(x) {
|
12316 | if (x === null) {
|
12317 | return 'Null';
|
12318 | }
|
12319 | if (typeof x === 'undefined') {
|
12320 | return 'Undefined';
|
12321 | }
|
12322 | if (typeof x === 'function' || typeof x === 'object') {
|
12323 | return 'Object';
|
12324 | }
|
12325 | if (typeof x === 'number') {
|
12326 | return 'Number';
|
12327 | }
|
12328 | if (typeof x === 'boolean') {
|
12329 | return 'Boolean';
|
12330 | }
|
12331 | if (typeof x === 'string') {
|
12332 | return 'String';
|
12333 | }
|
12334 | },
|
12335 |
|
12336 |
|
12337 | IsPropertyDescriptor: function IsPropertyDescriptor(Desc) {
|
12338 | return isPropertyDescriptor(this, Desc);
|
12339 | },
|
12340 |
|
12341 |
|
12342 | IsAccessorDescriptor: function IsAccessorDescriptor(Desc) {
|
12343 | if (typeof Desc === 'undefined') {
|
12344 | return false;
|
12345 | }
|
12346 |
|
12347 | assertRecord(this, 'Property Descriptor', 'Desc', Desc);
|
12348 |
|
12349 | if (!has(Desc, '[[Get]]') && !has(Desc, '[[Set]]')) {
|
12350 | return false;
|
12351 | }
|
12352 |
|
12353 | return true;
|
12354 | },
|
12355 |
|
12356 |
|
12357 | IsDataDescriptor: function IsDataDescriptor(Desc) {
|
12358 | if (typeof Desc === 'undefined') {
|
12359 | return false;
|
12360 | }
|
12361 |
|
12362 | assertRecord(this, 'Property Descriptor', 'Desc', Desc);
|
12363 |
|
12364 | if (!has(Desc, '[[Value]]') && !has(Desc, '[[Writable]]')) {
|
12365 | return false;
|
12366 | }
|
12367 |
|
12368 | return true;
|
12369 | },
|
12370 |
|
12371 |
|
12372 | IsGenericDescriptor: function IsGenericDescriptor(Desc) {
|
12373 | if (typeof Desc === 'undefined') {
|
12374 | return false;
|
12375 | }
|
12376 |
|
12377 | assertRecord(this, 'Property Descriptor', 'Desc', Desc);
|
12378 |
|
12379 | if (!this.IsAccessorDescriptor(Desc) && !this.IsDataDescriptor(Desc)) {
|
12380 | return true;
|
12381 | }
|
12382 |
|
12383 | return false;
|
12384 | },
|
12385 |
|
12386 |
|
12387 | FromPropertyDescriptor: function FromPropertyDescriptor(Desc) {
|
12388 | if (typeof Desc === 'undefined') {
|
12389 | return Desc;
|
12390 | }
|
12391 |
|
12392 | assertRecord(this, 'Property Descriptor', 'Desc', Desc);
|
12393 |
|
12394 | if (this.IsDataDescriptor(Desc)) {
|
12395 | return {
|
12396 | value: Desc['[[Value]]'],
|
12397 | writable: !!Desc['[[Writable]]'],
|
12398 | enumerable: !!Desc['[[Enumerable]]'],
|
12399 | configurable: !!Desc['[[Configurable]]']
|
12400 | };
|
12401 | } else if (this.IsAccessorDescriptor(Desc)) {
|
12402 | return {
|
12403 | get: Desc['[[Get]]'],
|
12404 | set: Desc['[[Set]]'],
|
12405 | enumerable: !!Desc['[[Enumerable]]'],
|
12406 | configurable: !!Desc['[[Configurable]]']
|
12407 | };
|
12408 | } else {
|
12409 | throw new $TypeError('FromPropertyDescriptor must be called with a fully populated Property Descriptor');
|
12410 | }
|
12411 | },
|
12412 |
|
12413 |
|
12414 | ToPropertyDescriptor: function ToPropertyDescriptor(Obj) {
|
12415 | if (this.Type(Obj) !== 'Object') {
|
12416 | throw new $TypeError('ToPropertyDescriptor requires an object');
|
12417 | }
|
12418 |
|
12419 | var desc = {};
|
12420 | if (has(Obj, 'enumerable')) {
|
12421 | desc['[[Enumerable]]'] = this.ToBoolean(Obj.enumerable);
|
12422 | }
|
12423 | if (has(Obj, 'configurable')) {
|
12424 | desc['[[Configurable]]'] = this.ToBoolean(Obj.configurable);
|
12425 | }
|
12426 | if (has(Obj, 'value')) {
|
12427 | desc['[[Value]]'] = Obj.value;
|
12428 | }
|
12429 | if (has(Obj, 'writable')) {
|
12430 | desc['[[Writable]]'] = this.ToBoolean(Obj.writable);
|
12431 | }
|
12432 | if (has(Obj, 'get')) {
|
12433 | var getter = Obj.get;
|
12434 | if (typeof getter !== 'undefined' && !this.IsCallable(getter)) {
|
12435 | throw new TypeError('getter must be a function');
|
12436 | }
|
12437 | desc['[[Get]]'] = getter;
|
12438 | }
|
12439 | if (has(Obj, 'set')) {
|
12440 | var setter = Obj.set;
|
12441 | if (typeof setter !== 'undefined' && !this.IsCallable(setter)) {
|
12442 | throw new $TypeError('setter must be a function');
|
12443 | }
|
12444 | desc['[[Set]]'] = setter;
|
12445 | }
|
12446 |
|
12447 | if ((has(desc, '[[Get]]') || has(desc, '[[Set]]')) && (has(desc, '[[Value]]') || has(desc, '[[Writable]]'))) {
|
12448 | throw new $TypeError('Invalid property descriptor. Cannot both specify accessors and a value or writable attribute');
|
12449 | }
|
12450 | return desc;
|
12451 | },
|
12452 |
|
12453 |
|
12454 | 'Abstract Equality Comparison': function AbstractEqualityComparison(x, y) {
|
12455 | var xType = this.Type(x);
|
12456 | var yType = this.Type(y);
|
12457 | if (xType === yType) {
|
12458 | return x === y;
|
12459 | }
|
12460 | if (x == null && y == null) {
|
12461 | return true;
|
12462 | }
|
12463 | if (xType === 'Number' && yType === 'String') {
|
12464 | return this['Abstract Equality Comparison'](x, this.ToNumber(y));
|
12465 | }
|
12466 | if (xType === 'String' && yType === 'Number') {
|
12467 | return this['Abstract Equality Comparison'](this.ToNumber(x), y);
|
12468 | }
|
12469 | if (xType === 'Boolean') {
|
12470 | return this['Abstract Equality Comparison'](this.ToNumber(x), y);
|
12471 | }
|
12472 | if (yType === 'Boolean') {
|
12473 | return this['Abstract Equality Comparison'](x, this.ToNumber(y));
|
12474 | }
|
12475 | if ((xType === 'String' || xType === 'Number') && yType === 'Object') {
|
12476 | return this['Abstract Equality Comparison'](x, this.ToPrimitive(y));
|
12477 | }
|
12478 | if (xType === 'Object' && (yType === 'String' || yType === 'Number')) {
|
12479 | return this['Abstract Equality Comparison'](this.ToPrimitive(x), y);
|
12480 | }
|
12481 | return false;
|
12482 | },
|
12483 |
|
12484 |
|
12485 | 'Strict Equality Comparison': function StrictEqualityComparison(x, y) {
|
12486 | var xType = this.Type(x);
|
12487 | var yType = this.Type(y);
|
12488 | if (xType !== yType) {
|
12489 | return false;
|
12490 | }
|
12491 | if (xType === 'Undefined' || xType === 'Null') {
|
12492 | return true;
|
12493 | }
|
12494 | return x === y;
|
12495 | },
|
12496 |
|
12497 |
|
12498 |
|
12499 | 'Abstract Relational Comparison': function AbstractRelationalComparison(x, y, LeftFirst) {
|
12500 | if (this.Type(LeftFirst) !== 'Boolean') {
|
12501 | throw new $TypeError('Assertion failed: LeftFirst argument must be a Boolean');
|
12502 | }
|
12503 | var px;
|
12504 | var py;
|
12505 | if (LeftFirst) {
|
12506 | px = this.ToPrimitive(x, $Number);
|
12507 | py = this.ToPrimitive(y, $Number);
|
12508 | } else {
|
12509 | py = this.ToPrimitive(y, $Number);
|
12510 | px = this.ToPrimitive(x, $Number);
|
12511 | }
|
12512 | var bothStrings = this.Type(px) === 'String' && this.Type(py) === 'String';
|
12513 | if (!bothStrings) {
|
12514 | var nx = this.ToNumber(px);
|
12515 | var ny = this.ToNumber(py);
|
12516 | if ($isNaN(nx) || $isNaN(ny)) {
|
12517 | return undefined;
|
12518 | }
|
12519 | if ($isFinite(nx) && $isFinite(ny) && nx === ny) {
|
12520 | return false;
|
12521 | }
|
12522 | if (nx === 0 && ny === 0) {
|
12523 | return false;
|
12524 | }
|
12525 | if (nx === Infinity) {
|
12526 | return false;
|
12527 | }
|
12528 | if (ny === Infinity) {
|
12529 | return true;
|
12530 | }
|
12531 | if (ny === -Infinity) {
|
12532 | return false;
|
12533 | }
|
12534 | if (nx === -Infinity) {
|
12535 | return true;
|
12536 | }
|
12537 | return nx < ny;
|
12538 | }
|
12539 | if (isPrefixOf(py, px)) {
|
12540 | return false;
|
12541 | }
|
12542 | if (isPrefixOf(px, py)) {
|
12543 | return true;
|
12544 | }
|
12545 | return px < py;
|
12546 | }
|
12547 | };
|
12548 |
|
12549 | module.exports = ES5;
|
12550 |
|
12551 | },{"./GetIntrinsic":191,"./helpers/assertRecord":196,"./helpers/callBind":198,"./helpers/isFinite":201,"./helpers/isNaN":202,"./helpers/isPropertyDescriptor":204,"./helpers/mod":206,"./helpers/sign":207,"es-to-primitive/es5":212,"has":222,"is-callable":228}],195:[function(require,module,exports){
|
12552 | 'use strict';
|
12553 |
|
12554 | module.exports = require('./es2016');
|
12555 |
|
12556 | },{"./es2016":193}],196:[function(require,module,exports){
|
12557 | 'use strict';
|
12558 |
|
12559 | var GetIntrinsic = require('../GetIntrinsic');
|
12560 |
|
12561 | var $TypeError = GetIntrinsic('%TypeError%');
|
12562 | var $SyntaxError = GetIntrinsic('%SyntaxError%');
|
12563 |
|
12564 | var has = require('has');
|
12565 |
|
12566 | var predicates = {
|
12567 |
|
12568 | 'Property Descriptor': function isPropertyDescriptor(ES, Desc) {
|
12569 | if (ES.Type(Desc) !== 'Object') {
|
12570 | return false;
|
12571 | }
|
12572 | var allowed = {
|
12573 | '[[Configurable]]': true,
|
12574 | '[[Enumerable]]': true,
|
12575 | '[[Get]]': true,
|
12576 | '[[Set]]': true,
|
12577 | '[[Value]]': true,
|
12578 | '[[Writable]]': true
|
12579 | };
|
12580 |
|
12581 | for (var key in Desc) {
|
12582 | if (has(Desc, key) && !allowed[key]) {
|
12583 | return false;
|
12584 | }
|
12585 | }
|
12586 |
|
12587 | var isData = has(Desc, '[[Value]]');
|
12588 | var IsAccessor = has(Desc, '[[Get]]') || has(Desc, '[[Set]]');
|
12589 | if (isData && IsAccessor) {
|
12590 | throw new $TypeError('Property Descriptors may not be both accessor and data descriptors');
|
12591 | }
|
12592 | return true;
|
12593 | }
|
12594 | };
|
12595 |
|
12596 | module.exports = function assertRecord(ES, recordType, argumentName, value) {
|
12597 | var predicate = predicates[recordType];
|
12598 | if (typeof predicate !== 'function') {
|
12599 | throw new $SyntaxError('unknown record type: ' + recordType);
|
12600 | }
|
12601 | if (!predicate(ES, value)) {
|
12602 | throw new $TypeError(argumentName + ' must be a ' + recordType);
|
12603 | }
|
12604 | };
|
12605 |
|
12606 | },{"../GetIntrinsic":191,"has":222}],197:[function(require,module,exports){
|
12607 | 'use strict';
|
12608 |
|
12609 | var GetIntrinsic = require('../GetIntrinsic');
|
12610 |
|
12611 | var has = require('has');
|
12612 |
|
12613 | var $assign = GetIntrinsic('%Object%').assign;
|
12614 |
|
12615 | module.exports = function assign(target, source) {
|
12616 | if ($assign) {
|
12617 | return $assign(target, source);
|
12618 | }
|
12619 |
|
12620 |
|
12621 | for (var key in source) {
|
12622 | if (has(source, key)) {
|
12623 | target[key] = source[key];
|
12624 | }
|
12625 | }
|
12626 | return target;
|
12627 | };
|
12628 |
|
12629 | },{"../GetIntrinsic":191,"has":222}],198:[function(require,module,exports){
|
12630 | 'use strict';
|
12631 |
|
12632 | var bind = require('function-bind');
|
12633 |
|
12634 | var GetIntrinsic = require('../GetIntrinsic');
|
12635 |
|
12636 | var $Function = GetIntrinsic('%Function%');
|
12637 | var $apply = $Function.apply;
|
12638 | var $call = $Function.call;
|
12639 |
|
12640 | module.exports = function callBind() {
|
12641 | return bind.apply($call, arguments);
|
12642 | };
|
12643 |
|
12644 | module.exports.apply = function applyBind() {
|
12645 | return bind.apply($apply, arguments);
|
12646 | };
|
12647 |
|
12648 | },{"../GetIntrinsic":191,"function-bind":219}],199:[function(require,module,exports){
|
12649 | 'use strict';
|
12650 |
|
12651 | module.exports = function every(array, predicate) {
|
12652 | for (var i = 0; i < array.length; i += 1) {
|
12653 | if (!predicate(array[i], i, array)) {
|
12654 | return false;
|
12655 | }
|
12656 | }
|
12657 | return true;
|
12658 | };
|
12659 |
|
12660 | },{}],200:[function(require,module,exports){
|
12661 | 'use strict';
|
12662 |
|
12663 | module.exports = function forEach(array, callback) {
|
12664 | for (var i = 0; i < array.length; i += 1) {
|
12665 | callback(array[i], i, array);
|
12666 | }
|
12667 | };
|
12668 |
|
12669 | },{}],201:[function(require,module,exports){
|
12670 | 'use strict';
|
12671 |
|
12672 | var $isNaN = Number.isNaN || function (a) { return a !== a; };
|
12673 |
|
12674 | module.exports = Number.isFinite || function (x) { return typeof x === 'number' && !$isNaN(x) && x !== Infinity && x !== -Infinity; };
|
12675 |
|
12676 | },{}],202:[function(require,module,exports){
|
12677 | 'use strict';
|
12678 |
|
12679 | module.exports = Number.isNaN || function isNaN(a) {
|
12680 | return a !== a;
|
12681 | };
|
12682 |
|
12683 | },{}],203:[function(require,module,exports){
|
12684 | 'use strict';
|
12685 |
|
12686 | module.exports = function isPrimitive(value) {
|
12687 | return value === null || (typeof value !== 'function' && typeof value !== 'object');
|
12688 | };
|
12689 |
|
12690 | },{}],204:[function(require,module,exports){
|
12691 | 'use strict';
|
12692 |
|
12693 | var GetIntrinsic = require('../GetIntrinsic');
|
12694 |
|
12695 | var has = require('has');
|
12696 | var $TypeError = GetIntrinsic('%TypeError%');
|
12697 |
|
12698 | module.exports = function IsPropertyDescriptor(ES, Desc) {
|
12699 | if (ES.Type(Desc) !== 'Object') {
|
12700 | return false;
|
12701 | }
|
12702 | var allowed = {
|
12703 | '[[Configurable]]': true,
|
12704 | '[[Enumerable]]': true,
|
12705 | '[[Get]]': true,
|
12706 | '[[Set]]': true,
|
12707 | '[[Value]]': true,
|
12708 | '[[Writable]]': true
|
12709 | };
|
12710 |
|
12711 | for (var key in Desc) {
|
12712 | if (has(Desc, key) && !allowed[key]) {
|
12713 | return false;
|
12714 | }
|
12715 | }
|
12716 |
|
12717 | if (ES.IsDataDescriptor(Desc) && ES.IsAccessorDescriptor(Desc)) {
|
12718 | throw new $TypeError('Property Descriptors may not be both accessor and data descriptors');
|
12719 | }
|
12720 | return true;
|
12721 | };
|
12722 |
|
12723 | },{"../GetIntrinsic":191,"has":222}],205:[function(require,module,exports){
|
12724 | 'use strict';
|
12725 |
|
12726 | var every = require('./every');
|
12727 |
|
12728 | module.exports = function isSamePropertyDescriptor(ES, D1, D2) {
|
12729 | var fields = [
|
12730 | '[[Configurable]]',
|
12731 | '[[Enumerable]]',
|
12732 | '[[Get]]',
|
12733 | '[[Set]]',
|
12734 | '[[Value]]',
|
12735 | '[[Writable]]'
|
12736 | ];
|
12737 | return every(fields, function (field) {
|
12738 | if ((field in D1) !== (field in D2)) {
|
12739 | return false;
|
12740 | }
|
12741 | return ES.SameValue(D1[field], D2[field]);
|
12742 | });
|
12743 | };
|
12744 |
|
12745 | },{"./every":199}],206:[function(require,module,exports){
|
12746 | 'use strict';
|
12747 |
|
12748 | module.exports = function mod(number, modulo) {
|
12749 | var remain = number % modulo;
|
12750 | return Math.floor(remain >= 0 ? remain : remain + modulo);
|
12751 | };
|
12752 |
|
12753 | },{}],207:[function(require,module,exports){
|
12754 | 'use strict';
|
12755 |
|
12756 | module.exports = function sign(number) {
|
12757 | return number >= 0 ? 1 : -1;
|
12758 | };
|
12759 |
|
12760 | },{}],208:[function(require,module,exports){
|
12761 | 'use strict';
|
12762 |
|
12763 | var keysShim;
|
12764 | if (!Object.keys) {
|
12765 |
|
12766 | var has = Object.prototype.hasOwnProperty;
|
12767 | var toStr = Object.prototype.toString;
|
12768 | var isArgs = require('./isArguments');
|
12769 | var isEnumerable = Object.prototype.propertyIsEnumerable;
|
12770 | var hasDontEnumBug = !isEnumerable.call({ toString: null }, 'toString');
|
12771 | var hasProtoEnumBug = isEnumerable.call(function () {}, 'prototype');
|
12772 | var dontEnums = [
|
12773 | 'toString',
|
12774 | 'toLocaleString',
|
12775 | 'valueOf',
|
12776 | 'hasOwnProperty',
|
12777 | 'isPrototypeOf',
|
12778 | 'propertyIsEnumerable',
|
12779 | 'constructor'
|
12780 | ];
|
12781 | var equalsConstructorPrototype = function (o) {
|
12782 | var ctor = o.constructor;
|
12783 | return ctor && ctor.prototype === o;
|
12784 | };
|
12785 | var excludedKeys = {
|
12786 | $applicationCache: true,
|
12787 | $console: true,
|
12788 | $external: true,
|
12789 | $frame: true,
|
12790 | $frameElement: true,
|
12791 | $frames: true,
|
12792 | $innerHeight: true,
|
12793 | $innerWidth: true,
|
12794 | $onmozfullscreenchange: true,
|
12795 | $onmozfullscreenerror: true,
|
12796 | $outerHeight: true,
|
12797 | $outerWidth: true,
|
12798 | $pageXOffset: true,
|
12799 | $pageYOffset: true,
|
12800 | $parent: true,
|
12801 | $scrollLeft: true,
|
12802 | $scrollTop: true,
|
12803 | $scrollX: true,
|
12804 | $scrollY: true,
|
12805 | $self: true,
|
12806 | $webkitIndexedDB: true,
|
12807 | $webkitStorageInfo: true,
|
12808 | $window: true
|
12809 | };
|
12810 | var hasAutomationEqualityBug = (function () {
|
12811 |
|
12812 | if (typeof window === 'undefined') { return false; }
|
12813 | for (var k in window) {
|
12814 | try {
|
12815 | if (!excludedKeys['$' + k] && has.call(window, k) && window[k] !== null && typeof window[k] === 'object') {
|
12816 | try {
|
12817 | equalsConstructorPrototype(window[k]);
|
12818 | } catch (e) {
|
12819 | return true;
|
12820 | }
|
12821 | }
|
12822 | } catch (e) {
|
12823 | return true;
|
12824 | }
|
12825 | }
|
12826 | return false;
|
12827 | }());
|
12828 | var equalsConstructorPrototypeIfNotBuggy = function (o) {
|
12829 |
|
12830 | if (typeof window === 'undefined' || !hasAutomationEqualityBug) {
|
12831 | return equalsConstructorPrototype(o);
|
12832 | }
|
12833 | try {
|
12834 | return equalsConstructorPrototype(o);
|
12835 | } catch (e) {
|
12836 | return false;
|
12837 | }
|
12838 | };
|
12839 |
|
12840 | keysShim = function keys(object) {
|
12841 | var isObject = object !== null && typeof object === 'object';
|
12842 | var isFunction = toStr.call(object) === '[object Function]';
|
12843 | var isArguments = isArgs(object);
|
12844 | var isString = isObject && toStr.call(object) === '[object String]';
|
12845 | var theKeys = [];
|
12846 |
|
12847 | if (!isObject && !isFunction && !isArguments) {
|
12848 | throw new TypeError('Object.keys called on a non-object');
|
12849 | }
|
12850 |
|
12851 | var skipProto = hasProtoEnumBug && isFunction;
|
12852 | if (isString && object.length > 0 && !has.call(object, 0)) {
|
12853 | for (var i = 0; i < object.length; ++i) {
|
12854 | theKeys.push(String(i));
|
12855 | }
|
12856 | }
|
12857 |
|
12858 | if (isArguments && object.length > 0) {
|
12859 | for (var j = 0; j < object.length; ++j) {
|
12860 | theKeys.push(String(j));
|
12861 | }
|
12862 | } else {
|
12863 | for (var name in object) {
|
12864 | if (!(skipProto && name === 'prototype') && has.call(object, name)) {
|
12865 | theKeys.push(String(name));
|
12866 | }
|
12867 | }
|
12868 | }
|
12869 |
|
12870 | if (hasDontEnumBug) {
|
12871 | var skipConstructor = equalsConstructorPrototypeIfNotBuggy(object);
|
12872 |
|
12873 | for (var k = 0; k < dontEnums.length; ++k) {
|
12874 | if (!(skipConstructor && dontEnums[k] === 'constructor') && has.call(object, dontEnums[k])) {
|
12875 | theKeys.push(dontEnums[k]);
|
12876 | }
|
12877 | }
|
12878 | }
|
12879 | return theKeys;
|
12880 | };
|
12881 | }
|
12882 | module.exports = keysShim;
|
12883 |
|
12884 | },{"./isArguments":210}],209:[function(require,module,exports){
|
12885 | 'use strict';
|
12886 |
|
12887 | var slice = Array.prototype.slice;
|
12888 | var isArgs = require('./isArguments');
|
12889 |
|
12890 | var origKeys = Object.keys;
|
12891 | var keysShim = origKeys ? function keys(o) { return origKeys(o); } : require('./implementation');
|
12892 |
|
12893 | var originalKeys = Object.keys;
|
12894 |
|
12895 | keysShim.shim = function shimObjectKeys() {
|
12896 | if (Object.keys) {
|
12897 | var keysWorksWithArguments = (function () {
|
12898 |
|
12899 | var args = Object.keys(arguments);
|
12900 | return args && args.length === arguments.length;
|
12901 | }(1, 2));
|
12902 | if (!keysWorksWithArguments) {
|
12903 | Object.keys = function keys(object) {
|
12904 | if (isArgs(object)) {
|
12905 | return originalKeys(slice.call(object));
|
12906 | }
|
12907 | return originalKeys(object);
|
12908 | };
|
12909 | }
|
12910 | } else {
|
12911 | Object.keys = keysShim;
|
12912 | }
|
12913 | return Object.keys || keysShim;
|
12914 | };
|
12915 |
|
12916 | module.exports = keysShim;
|
12917 |
|
12918 | },{"./implementation":208,"./isArguments":210}],210:[function(require,module,exports){
|
12919 | 'use strict';
|
12920 |
|
12921 | var toStr = Object.prototype.toString;
|
12922 |
|
12923 | module.exports = function isArguments(value) {
|
12924 | var str = toStr.call(value);
|
12925 | var isArgs = str === '[object Arguments]';
|
12926 | if (!isArgs) {
|
12927 | isArgs = str !== '[object Array]' &&
|
12928 | value !== null &&
|
12929 | typeof value === 'object' &&
|
12930 | typeof value.length === 'number' &&
|
12931 | value.length >= 0 &&
|
12932 | toStr.call(value.callee) === '[object Function]';
|
12933 | }
|
12934 | return isArgs;
|
12935 | };
|
12936 |
|
12937 | },{}],211:[function(require,module,exports){
|
12938 | 'use strict';
|
12939 |
|
12940 | var hasSymbols = typeof Symbol === 'function' && typeof Symbol.iterator === 'symbol';
|
12941 |
|
12942 | var isPrimitive = require('./helpers/isPrimitive');
|
12943 | var isCallable = require('is-callable');
|
12944 | var isDate = require('is-date-object');
|
12945 | var isSymbol = require('is-symbol');
|
12946 |
|
12947 | var ordinaryToPrimitive = function OrdinaryToPrimitive(O, hint) {
|
12948 | if (typeof O === 'undefined' || O === null) {
|
12949 | throw new TypeError('Cannot call method on ' + O);
|
12950 | }
|
12951 | if (typeof hint !== 'string' || (hint !== 'number' && hint !== 'string')) {
|
12952 | throw new TypeError('hint must be "string" or "number"');
|
12953 | }
|
12954 | var methodNames = hint === 'string' ? ['toString', 'valueOf'] : ['valueOf', 'toString'];
|
12955 | var method, result, i;
|
12956 | for (i = 0; i < methodNames.length; ++i) {
|
12957 | method = O[methodNames[i]];
|
12958 | if (isCallable(method)) {
|
12959 | result = method.call(O);
|
12960 | if (isPrimitive(result)) {
|
12961 | return result;
|
12962 | }
|
12963 | }
|
12964 | }
|
12965 | throw new TypeError('No default value');
|
12966 | };
|
12967 |
|
12968 | var GetMethod = function GetMethod(O, P) {
|
12969 | var func = O[P];
|
12970 | if (func !== null && typeof func !== 'undefined') {
|
12971 | if (!isCallable(func)) {
|
12972 | throw new TypeError(func + ' returned for property ' + P + ' of object ' + O + ' is not a function');
|
12973 | }
|
12974 | return func;
|
12975 | }
|
12976 | return void 0;
|
12977 | };
|
12978 |
|
12979 |
|
12980 | module.exports = function ToPrimitive(input) {
|
12981 | if (isPrimitive(input)) {
|
12982 | return input;
|
12983 | }
|
12984 | var hint = 'default';
|
12985 | if (arguments.length > 1) {
|
12986 | if (arguments[1] === String) {
|
12987 | hint = 'string';
|
12988 | } else if (arguments[1] === Number) {
|
12989 | hint = 'number';
|
12990 | }
|
12991 | }
|
12992 |
|
12993 | var exoticToPrim;
|
12994 | if (hasSymbols) {
|
12995 | if (Symbol.toPrimitive) {
|
12996 | exoticToPrim = GetMethod(input, Symbol.toPrimitive);
|
12997 | } else if (isSymbol(input)) {
|
12998 | exoticToPrim = Symbol.prototype.valueOf;
|
12999 | }
|
13000 | }
|
13001 | if (typeof exoticToPrim !== 'undefined') {
|
13002 | var result = exoticToPrim.call(input, hint);
|
13003 | if (isPrimitive(result)) {
|
13004 | return result;
|
13005 | }
|
13006 | throw new TypeError('unable to convert exotic object to primitive');
|
13007 | }
|
13008 | if (hint === 'default' && (isDate(input) || isSymbol(input))) {
|
13009 | hint = 'string';
|
13010 | }
|
13011 | return ordinaryToPrimitive(input, hint === 'default' ? 'number' : hint);
|
13012 | };
|
13013 |
|
13014 | },{"./helpers/isPrimitive":214,"is-callable":228,"is-date-object":230,"is-symbol":232}],212:[function(require,module,exports){
|
13015 | 'use strict';
|
13016 |
|
13017 | var toStr = Object.prototype.toString;
|
13018 |
|
13019 | var isPrimitive = require('./helpers/isPrimitive');
|
13020 |
|
13021 | var isCallable = require('is-callable');
|
13022 |
|
13023 |
|
13024 | var ES5internalSlots = {
|
13025 | '[[DefaultValue]]': function (O) {
|
13026 | var actualHint;
|
13027 | if (arguments.length > 1) {
|
13028 | actualHint = arguments[1];
|
13029 | } else {
|
13030 | actualHint = toStr.call(O) === '[object Date]' ? String : Number;
|
13031 | }
|
13032 |
|
13033 | if (actualHint === String || actualHint === Number) {
|
13034 | var methods = actualHint === String ? ['toString', 'valueOf'] : ['valueOf', 'toString'];
|
13035 | var value, i;
|
13036 | for (i = 0; i < methods.length; ++i) {
|
13037 | if (isCallable(O[methods[i]])) {
|
13038 | value = O[methods[i]]();
|
13039 | if (isPrimitive(value)) {
|
13040 | return value;
|
13041 | }
|
13042 | }
|
13043 | }
|
13044 | throw new TypeError('No default value');
|
13045 | }
|
13046 | throw new TypeError('invalid [[DefaultValue]] hint supplied');
|
13047 | }
|
13048 | };
|
13049 |
|
13050 |
|
13051 | module.exports = function ToPrimitive(input) {
|
13052 | if (isPrimitive(input)) {
|
13053 | return input;
|
13054 | }
|
13055 | if (arguments.length > 1) {
|
13056 | return ES5internalSlots['[[DefaultValue]]'](input, arguments[1]);
|
13057 | }
|
13058 | return ES5internalSlots['[[DefaultValue]]'](input);
|
13059 | };
|
13060 |
|
13061 | },{"./helpers/isPrimitive":214,"is-callable":228}],213:[function(require,module,exports){
|
13062 | 'use strict';
|
13063 |
|
13064 | module.exports = require('./es2015');
|
13065 |
|
13066 | },{"./es2015":211}],214:[function(require,module,exports){
|
13067 | module.exports = function isPrimitive(value) {
|
13068 | return value === null || (typeof value !== 'function' && typeof value !== 'object');
|
13069 | };
|
13070 |
|
13071 | },{}],215:[function(require,module,exports){
|
13072 |
|
13073 |
|
13074 |
|
13075 |
|
13076 |
|
13077 |
|
13078 |
|
13079 |
|
13080 | 'use strict';
|
13081 |
|
13082 |
|
13083 |
|
13084 |
|
13085 |
|
13086 |
|
13087 | var matchHtmlRegExp = /["'&<>]/;
|
13088 |
|
13089 |
|
13090 |
|
13091 |
|
13092 |
|
13093 |
|
13094 | module.exports = escapeHtml;
|
13095 |
|
13096 |
|
13097 |
|
13098 |
|
13099 |
|
13100 |
|
13101 |
|
13102 |
|
13103 |
|
13104 | function escapeHtml(string) {
|
13105 | var str = '' + string;
|
13106 | var match = matchHtmlRegExp.exec(str);
|
13107 |
|
13108 | if (!match) {
|
13109 | return str;
|
13110 | }
|
13111 |
|
13112 | var escape;
|
13113 | var html = '';
|
13114 | var index = 0;
|
13115 | var lastIndex = 0;
|
13116 |
|
13117 | for (index = match.index; index < str.length; index++) {
|
13118 | switch (str.charCodeAt(index)) {
|
13119 | case 34:
|
13120 | escape = '"';
|
13121 | break;
|
13122 | case 38:
|
13123 | escape = '&';
|
13124 | break;
|
13125 | case 39:
|
13126 | escape = ''';
|
13127 | break;
|
13128 | case 60:
|
13129 | escape = '<';
|
13130 | break;
|
13131 | case 62:
|
13132 | escape = '>';
|
13133 | break;
|
13134 | default:
|
13135 | continue;
|
13136 | }
|
13137 |
|
13138 | if (lastIndex !== index) {
|
13139 | html += str.substring(lastIndex, index);
|
13140 | }
|
13141 |
|
13142 | lastIndex = index + 1;
|
13143 | html += escape;
|
13144 | }
|
13145 |
|
13146 | return lastIndex !== index
|
13147 | ? html + str.substring(lastIndex, index)
|
13148 | : html;
|
13149 | }
|
13150 |
|
13151 | },{}],216:[function(require,module,exports){
|
13152 |
|
13153 |
|
13154 |
|
13155 |
|
13156 |
|
13157 |
|
13158 |
|
13159 |
|
13160 |
|
13161 |
|
13162 |
|
13163 |
|
13164 |
|
13165 |
|
13166 |
|
13167 |
|
13168 |
|
13169 |
|
13170 |
|
13171 |
|
13172 |
|
13173 | function EventEmitter() {
|
13174 | this._events = this._events || {};
|
13175 | this._maxListeners = this._maxListeners || undefined;
|
13176 | }
|
13177 | module.exports = EventEmitter;
|
13178 |
|
13179 |
|
13180 | EventEmitter.EventEmitter = EventEmitter;
|
13181 |
|
13182 | EventEmitter.prototype._events = undefined;
|
13183 | EventEmitter.prototype._maxListeners = undefined;
|
13184 |
|
13185 |
|
13186 |
|
13187 | EventEmitter.defaultMaxListeners = 10;
|
13188 |
|
13189 |
|
13190 |
|
13191 | EventEmitter.prototype.setMaxListeners = function(n) {
|
13192 | if (!isNumber(n) || n < 0 || isNaN(n))
|
13193 | throw TypeError('n must be a positive number');
|
13194 | this._maxListeners = n;
|
13195 | return this;
|
13196 | };
|
13197 |
|
13198 | EventEmitter.prototype.emit = function(type) {
|
13199 | var er, handler, len, args, i, listeners;
|
13200 |
|
13201 | if (!this._events)
|
13202 | this._events = {};
|
13203 |
|
13204 |
|
13205 | if (type === 'error') {
|
13206 | if (!this._events.error ||
|
13207 | (isObject(this._events.error) && !this._events.error.length)) {
|
13208 | er = arguments[1];
|
13209 | if (er instanceof Error) {
|
13210 | throw er;
|
13211 | } else {
|
13212 |
|
13213 | var err = new Error('Uncaught, unspecified "error" event. (' + er + ')');
|
13214 | err.context = er;
|
13215 | throw err;
|
13216 | }
|
13217 | }
|
13218 | }
|
13219 |
|
13220 | handler = this._events[type];
|
13221 |
|
13222 | if (isUndefined(handler))
|
13223 | return false;
|
13224 |
|
13225 | if (isFunction(handler)) {
|
13226 | switch (arguments.length) {
|
13227 |
|
13228 | case 1:
|
13229 | handler.call(this);
|
13230 | break;
|
13231 | case 2:
|
13232 | handler.call(this, arguments[1]);
|
13233 | break;
|
13234 | case 3:
|
13235 | handler.call(this, arguments[1], arguments[2]);
|
13236 | break;
|
13237 |
|
13238 | default:
|
13239 | args = Array.prototype.slice.call(arguments, 1);
|
13240 | handler.apply(this, args);
|
13241 | }
|
13242 | } else if (isObject(handler)) {
|
13243 | args = Array.prototype.slice.call(arguments, 1);
|
13244 | listeners = handler.slice();
|
13245 | len = listeners.length;
|
13246 | for (i = 0; i < len; i++)
|
13247 | listeners[i].apply(this, args);
|
13248 | }
|
13249 |
|
13250 | return true;
|
13251 | };
|
13252 |
|
13253 | EventEmitter.prototype.addListener = function(type, listener) {
|
13254 | var m;
|
13255 |
|
13256 | if (!isFunction(listener))
|
13257 | throw TypeError('listener must be a function');
|
13258 |
|
13259 | if (!this._events)
|
13260 | this._events = {};
|
13261 |
|
13262 |
|
13263 |
|
13264 | if (this._events.newListener)
|
13265 | this.emit('newListener', type,
|
13266 | isFunction(listener.listener) ?
|
13267 | listener.listener : listener);
|
13268 |
|
13269 | if (!this._events[type])
|
13270 |
|
13271 | this._events[type] = listener;
|
13272 | else if (isObject(this._events[type]))
|
13273 |
|
13274 | this._events[type].push(listener);
|
13275 | else
|
13276 |
|
13277 | this._events[type] = [this._events[type], listener];
|
13278 |
|
13279 |
|
13280 | if (isObject(this._events[type]) && !this._events[type].warned) {
|
13281 | if (!isUndefined(this._maxListeners)) {
|
13282 | m = this._maxListeners;
|
13283 | } else {
|
13284 | m = EventEmitter.defaultMaxListeners;
|
13285 | }
|
13286 |
|
13287 | if (m && m > 0 && this._events[type].length > m) {
|
13288 | this._events[type].warned = true;
|
13289 | console.error('(node) warning: possible EventEmitter memory ' +
|
13290 | 'leak detected. %d listeners added. ' +
|
13291 | 'Use emitter.setMaxListeners() to increase limit.',
|
13292 | this._events[type].length);
|
13293 | if (typeof console.trace === 'function') {
|
13294 |
|
13295 | console.trace();
|
13296 | }
|
13297 | }
|
13298 | }
|
13299 |
|
13300 | return this;
|
13301 | };
|
13302 |
|
13303 | EventEmitter.prototype.on = EventEmitter.prototype.addListener;
|
13304 |
|
13305 | EventEmitter.prototype.once = function(type, listener) {
|
13306 | if (!isFunction(listener))
|
13307 | throw TypeError('listener must be a function');
|
13308 |
|
13309 | var fired = false;
|
13310 |
|
13311 | function g() {
|
13312 | this.removeListener(type, g);
|
13313 |
|
13314 | if (!fired) {
|
13315 | fired = true;
|
13316 | listener.apply(this, arguments);
|
13317 | }
|
13318 | }
|
13319 |
|
13320 | g.listener = listener;
|
13321 | this.on(type, g);
|
13322 |
|
13323 | return this;
|
13324 | };
|
13325 |
|
13326 |
|
13327 | EventEmitter.prototype.removeListener = function(type, listener) {
|
13328 | var list, position, length, i;
|
13329 |
|
13330 | if (!isFunction(listener))
|
13331 | throw TypeError('listener must be a function');
|
13332 |
|
13333 | if (!this._events || !this._events[type])
|
13334 | return this;
|
13335 |
|
13336 | list = this._events[type];
|
13337 | length = list.length;
|
13338 | position = -1;
|
13339 |
|
13340 | if (list === listener ||
|
13341 | (isFunction(list.listener) && list.listener === listener)) {
|
13342 | delete this._events[type];
|
13343 | if (this._events.removeListener)
|
13344 | this.emit('removeListener', type, listener);
|
13345 |
|
13346 | } else if (isObject(list)) {
|
13347 | for (i = length; i-- > 0;) {
|
13348 | if (list[i] === listener ||
|
13349 | (list[i].listener && list[i].listener === listener)) {
|
13350 | position = i;
|
13351 | break;
|
13352 | }
|
13353 | }
|
13354 |
|
13355 | if (position < 0)
|
13356 | return this;
|
13357 |
|
13358 | if (list.length === 1) {
|
13359 | list.length = 0;
|
13360 | delete this._events[type];
|
13361 | } else {
|
13362 | list.splice(position, 1);
|
13363 | }
|
13364 |
|
13365 | if (this._events.removeListener)
|
13366 | this.emit('removeListener', type, listener);
|
13367 | }
|
13368 |
|
13369 | return this;
|
13370 | };
|
13371 |
|
13372 | EventEmitter.prototype.removeAllListeners = function(type) {
|
13373 | var key, listeners;
|
13374 |
|
13375 | if (!this._events)
|
13376 | return this;
|
13377 |
|
13378 |
|
13379 | if (!this._events.removeListener) {
|
13380 | if (arguments.length === 0)
|
13381 | this._events = {};
|
13382 | else if (this._events[type])
|
13383 | delete this._events[type];
|
13384 | return this;
|
13385 | }
|
13386 |
|
13387 |
|
13388 | if (arguments.length === 0) {
|
13389 | for (key in this._events) {
|
13390 | if (key === 'removeListener') continue;
|
13391 | this.removeAllListeners(key);
|
13392 | }
|
13393 | this.removeAllListeners('removeListener');
|
13394 | this._events = {};
|
13395 | return this;
|
13396 | }
|
13397 |
|
13398 | listeners = this._events[type];
|
13399 |
|
13400 | if (isFunction(listeners)) {
|
13401 | this.removeListener(type, listeners);
|
13402 | } else if (listeners) {
|
13403 |
|
13404 | while (listeners.length)
|
13405 | this.removeListener(type, listeners[listeners.length - 1]);
|
13406 | }
|
13407 | delete this._events[type];
|
13408 |
|
13409 | return this;
|
13410 | };
|
13411 |
|
13412 | EventEmitter.prototype.listeners = function(type) {
|
13413 | var ret;
|
13414 | if (!this._events || !this._events[type])
|
13415 | ret = [];
|
13416 | else if (isFunction(this._events[type]))
|
13417 | ret = [this._events[type]];
|
13418 | else
|
13419 | ret = this._events[type].slice();
|
13420 | return ret;
|
13421 | };
|
13422 |
|
13423 | EventEmitter.prototype.listenerCount = function(type) {
|
13424 | if (this._events) {
|
13425 | var evlistener = this._events[type];
|
13426 |
|
13427 | if (isFunction(evlistener))
|
13428 | return 1;
|
13429 | else if (evlistener)
|
13430 | return evlistener.length;
|
13431 | }
|
13432 | return 0;
|
13433 | };
|
13434 |
|
13435 | EventEmitter.listenerCount = function(emitter, type) {
|
13436 | return emitter.listenerCount(type);
|
13437 | };
|
13438 |
|
13439 | function isFunction(arg) {
|
13440 | return typeof arg === 'function';
|
13441 | }
|
13442 |
|
13443 | function isNumber(arg) {
|
13444 | return typeof arg === 'number';
|
13445 | }
|
13446 |
|
13447 | function isObject(arg) {
|
13448 | return typeof arg === 'object' && arg !== null;
|
13449 | }
|
13450 |
|
13451 | function isUndefined(arg) {
|
13452 | return arg === void 0;
|
13453 | }
|
13454 |
|
13455 | },{}],217:[function(require,module,exports){
|
13456 |
|
13457 | var hasOwn = Object.prototype.hasOwnProperty;
|
13458 | var toString = Object.prototype.toString;
|
13459 |
|
13460 | module.exports = function forEach (obj, fn, ctx) {
|
13461 | if (toString.call(fn) !== '[object Function]') {
|
13462 | throw new TypeError('iterator must be a function');
|
13463 | }
|
13464 | var l = obj.length;
|
13465 | if (l === +l) {
|
13466 | for (var i = 0; i < l; i++) {
|
13467 | fn.call(ctx, obj[i], i, obj);
|
13468 | }
|
13469 | } else {
|
13470 | for (var k in obj) {
|
13471 | if (hasOwn.call(obj, k)) {
|
13472 | fn.call(ctx, obj[k], k, obj);
|
13473 | }
|
13474 | }
|
13475 | }
|
13476 | };
|
13477 |
|
13478 |
|
13479 | },{}],218:[function(require,module,exports){
|
13480 | 'use strict';
|
13481 |
|
13482 |
|
13483 |
|
13484 | var ERROR_MESSAGE = 'Function.prototype.bind called on incompatible ';
|
13485 | var slice = Array.prototype.slice;
|
13486 | var toStr = Object.prototype.toString;
|
13487 | var funcType = '[object Function]';
|
13488 |
|
13489 | module.exports = function bind(that) {
|
13490 | var target = this;
|
13491 | if (typeof target !== 'function' || toStr.call(target) !== funcType) {
|
13492 | throw new TypeError(ERROR_MESSAGE + target);
|
13493 | }
|
13494 | var args = slice.call(arguments, 1);
|
13495 |
|
13496 | var bound;
|
13497 | var binder = function () {
|
13498 | if (this instanceof bound) {
|
13499 | var result = target.apply(
|
13500 | this,
|
13501 | args.concat(slice.call(arguments))
|
13502 | );
|
13503 | if (Object(result) === result) {
|
13504 | return result;
|
13505 | }
|
13506 | return this;
|
13507 | } else {
|
13508 | return target.apply(
|
13509 | that,
|
13510 | args.concat(slice.call(arguments))
|
13511 | );
|
13512 | }
|
13513 | };
|
13514 |
|
13515 | var boundLength = Math.max(0, target.length - args.length);
|
13516 | var boundArgs = [];
|
13517 | for (var i = 0; i < boundLength; i++) {
|
13518 | boundArgs.push('$' + i);
|
13519 | }
|
13520 |
|
13521 | bound = Function('binder', 'return function (' + boundArgs.join(',') + '){ return binder.apply(this,arguments); }')(binder);
|
13522 |
|
13523 | if (target.prototype) {
|
13524 | var Empty = function Empty() {};
|
13525 | Empty.prototype = target.prototype;
|
13526 | bound.prototype = new Empty();
|
13527 | Empty.prototype = null;
|
13528 | }
|
13529 |
|
13530 | return bound;
|
13531 | };
|
13532 |
|
13533 | },{}],219:[function(require,module,exports){
|
13534 | 'use strict';
|
13535 |
|
13536 | var implementation = require('./implementation');
|
13537 |
|
13538 | module.exports = Function.prototype.bind || implementation;
|
13539 |
|
13540 | },{"./implementation":218}],220:[function(require,module,exports){
|
13541 | (function (global){
|
13542 | 'use strict';
|
13543 |
|
13544 | var origSymbol = global.Symbol;
|
13545 | var hasSymbolSham = require('./shams');
|
13546 |
|
13547 | module.exports = function hasNativeSymbols() {
|
13548 | if (typeof origSymbol !== 'function') { return false; }
|
13549 | if (typeof Symbol !== 'function') { return false; }
|
13550 | if (typeof origSymbol('foo') !== 'symbol') { return false; }
|
13551 | if (typeof Symbol('bar') !== 'symbol') { return false; }
|
13552 |
|
13553 | return hasSymbolSham();
|
13554 | };
|
13555 |
|
13556 | }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
13557 | },{"./shams":221}],221:[function(require,module,exports){
|
13558 | 'use strict';
|
13559 |
|
13560 |
|
13561 | module.exports = function hasSymbols() {
|
13562 | if (typeof Symbol !== 'function' || typeof Object.getOwnPropertySymbols !== 'function') { return false; }
|
13563 | if (typeof Symbol.iterator === 'symbol') { return true; }
|
13564 |
|
13565 | var obj = {};
|
13566 | var sym = Symbol('test');
|
13567 | var symObj = Object(sym);
|
13568 | if (typeof sym === 'string') { return false; }
|
13569 |
|
13570 | if (Object.prototype.toString.call(sym) !== '[object Symbol]') { return false; }
|
13571 | if (Object.prototype.toString.call(symObj) !== '[object Symbol]') { return false; }
|
13572 |
|
13573 |
|
13574 |
|
13575 |
|
13576 |
|
13577 |
|
13578 |
|
13579 |
|
13580 |
|
13581 | var symVal = 42;
|
13582 | obj[sym] = symVal;
|
13583 | for (sym in obj) { return false; }
|
13584 | if (typeof Object.keys === 'function' && Object.keys(obj).length !== 0) { return false; }
|
13585 |
|
13586 | if (typeof Object.getOwnPropertyNames === 'function' && Object.getOwnPropertyNames(obj).length !== 0) { return false; }
|
13587 |
|
13588 | var syms = Object.getOwnPropertySymbols(obj);
|
13589 | if (syms.length !== 1 || syms[0] !== sym) { return false; }
|
13590 |
|
13591 | if (!Object.prototype.propertyIsEnumerable.call(obj, sym)) { return false; }
|
13592 |
|
13593 | if (typeof Object.getOwnPropertyDescriptor === 'function') {
|
13594 | var descriptor = Object.getOwnPropertyDescriptor(obj, sym);
|
13595 | if (descriptor.value !== symVal || descriptor.enumerable !== true) { return false; }
|
13596 | }
|
13597 |
|
13598 | return true;
|
13599 | };
|
13600 |
|
13601 | },{}],222:[function(require,module,exports){
|
13602 | 'use strict';
|
13603 |
|
13604 | var bind = require('function-bind');
|
13605 |
|
13606 | module.exports = bind.call(Function.call, Object.prototype.hasOwnProperty);
|
13607 |
|
13608 | },{"function-bind":219}],223:[function(require,module,exports){
|
13609 | var http = require('http');
|
13610 |
|
13611 | var https = module.exports;
|
13612 |
|
13613 | for (var key in http) {
|
13614 | if (http.hasOwnProperty(key)) https[key] = http[key];
|
13615 | };
|
13616 |
|
13617 | https.request = function (params, cb) {
|
13618 | if (!params) params = {};
|
13619 | params.scheme = 'https';
|
13620 | params.protocol = 'https:';
|
13621 | return http.request.call(this, params, cb);
|
13622 | }
|
13623 |
|
13624 | },{"http":272}],224:[function(require,module,exports){
|
13625 |
|
13626 |
|
13627 |
|
13628 |
|
13629 |
|
13630 |
|
13631 | 'use strict';
|
13632 |
|
13633 |
|
13634 |
|
13635 |
|
13636 |
|
13637 | var util = require('util');
|
13638 | var ms = require('ms');
|
13639 |
|
13640 | module.exports = function (t) {
|
13641 | if (typeof t === 'number') return t;
|
13642 | var r = ms(t);
|
13643 | if (r === undefined) {
|
13644 | var err = new Error(util.format('humanize-ms(%j) result undefined', t));
|
13645 | console.warn(err.stack);
|
13646 | }
|
13647 | return r;
|
13648 | };
|
13649 |
|
13650 | },{"ms":238,"util":287}],225:[function(require,module,exports){
|
13651 | exports.read = function (buffer, offset, isLE, mLen, nBytes) {
|
13652 | var e, m
|
13653 | var eLen = (nBytes * 8) - mLen - 1
|
13654 | var eMax = (1 << eLen) - 1
|
13655 | var eBias = eMax >> 1
|
13656 | var nBits = -7
|
13657 | var i = isLE ? (nBytes - 1) : 0
|
13658 | var d = isLE ? -1 : 1
|
13659 | var s = buffer[offset + i]
|
13660 |
|
13661 | i += d
|
13662 |
|
13663 | e = s & ((1 << (-nBits)) - 1)
|
13664 | s >>= (-nBits)
|
13665 | nBits += eLen
|
13666 | for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}
|
13667 |
|
13668 | m = e & ((1 << (-nBits)) - 1)
|
13669 | e >>= (-nBits)
|
13670 | nBits += mLen
|
13671 | for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}
|
13672 |
|
13673 | if (e === 0) {
|
13674 | e = 1 - eBias
|
13675 | } else if (e === eMax) {
|
13676 | return m ? NaN : ((s ? -1 : 1) * Infinity)
|
13677 | } else {
|
13678 | m = m + Math.pow(2, mLen)
|
13679 | e = e - eBias
|
13680 | }
|
13681 | return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
|
13682 | }
|
13683 |
|
13684 | exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
|
13685 | var e, m, c
|
13686 | var eLen = (nBytes * 8) - mLen - 1
|
13687 | var eMax = (1 << eLen) - 1
|
13688 | var eBias = eMax >> 1
|
13689 | var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)
|
13690 | var i = isLE ? 0 : (nBytes - 1)
|
13691 | var d = isLE ? 1 : -1
|
13692 | var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0
|
13693 |
|
13694 | value = Math.abs(value)
|
13695 |
|
13696 | if (isNaN(value) || value === Infinity) {
|
13697 | m = isNaN(value) ? 1 : 0
|
13698 | e = eMax
|
13699 | } else {
|
13700 | e = Math.floor(Math.log(value) / Math.LN2)
|
13701 | if (value * (c = Math.pow(2, -e)) < 1) {
|
13702 | e--
|
13703 | c *= 2
|
13704 | }
|
13705 | if (e + eBias >= 1) {
|
13706 | value += rt / c
|
13707 | } else {
|
13708 | value += rt * Math.pow(2, 1 - eBias)
|
13709 | }
|
13710 | if (value * c >= 2) {
|
13711 | e++
|
13712 | c /= 2
|
13713 | }
|
13714 |
|
13715 | if (e + eBias >= eMax) {
|
13716 | m = 0
|
13717 | e = eMax
|
13718 | } else if (e + eBias >= 1) {
|
13719 | m = ((value * c) - 1) * Math.pow(2, mLen)
|
13720 | e = e + eBias
|
13721 | } else {
|
13722 | m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)
|
13723 | e = 0
|
13724 | }
|
13725 | }
|
13726 |
|
13727 | for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
|
13728 |
|
13729 | e = (e << mLen) | m
|
13730 | eLen += mLen
|
13731 | for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
|
13732 |
|
13733 | buffer[offset + i - d] |= s * 128
|
13734 | }
|
13735 |
|
13736 | },{}],226:[function(require,module,exports){
|
13737 | if (typeof Object.create === 'function') {
|
13738 |
|
13739 | module.exports = function inherits(ctor, superCtor) {
|
13740 | ctor.super_ = superCtor
|
13741 | ctor.prototype = Object.create(superCtor.prototype, {
|
13742 | constructor: {
|
13743 | value: ctor,
|
13744 | enumerable: false,
|
13745 | writable: true,
|
13746 | configurable: true
|
13747 | }
|
13748 | });
|
13749 | };
|
13750 | } else {
|
13751 |
|
13752 | module.exports = function inherits(ctor, superCtor) {
|
13753 | ctor.super_ = superCtor
|
13754 | var TempCtor = function () {}
|
13755 | TempCtor.prototype = superCtor.prototype
|
13756 | ctor.prototype = new TempCtor()
|
13757 | ctor.prototype.constructor = ctor
|
13758 | }
|
13759 | }
|
13760 |
|
13761 | },{}],227:[function(require,module,exports){
|
13762 |
|
13763 |
|
13764 |
|
13765 |
|
13766 |
|
13767 |
|
13768 |
|
13769 |
|
13770 |
|
13771 | module.exports = function (obj) {
|
13772 | return obj != null && (isBuffer(obj) || isSlowBuffer(obj) || !!obj._isBuffer)
|
13773 | }
|
13774 |
|
13775 | function isBuffer (obj) {
|
13776 | return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj)
|
13777 | }
|
13778 |
|
13779 |
|
13780 | function isSlowBuffer (obj) {
|
13781 | return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0))
|
13782 | }
|
13783 |
|
13784 | },{}],228:[function(require,module,exports){
|
13785 | 'use strict';
|
13786 |
|
13787 | var fnToStr = Function.prototype.toString;
|
13788 |
|
13789 | var constructorRegex = /^\s*class\b/;
|
13790 | var isES6ClassFn = function isES6ClassFunction(value) {
|
13791 | try {
|
13792 | var fnStr = fnToStr.call(value);
|
13793 | return constructorRegex.test(fnStr);
|
13794 | } catch (e) {
|
13795 | return false;
|
13796 | }
|
13797 | };
|
13798 |
|
13799 | var tryFunctionObject = function tryFunctionToStr(value) {
|
13800 | try {
|
13801 | if (isES6ClassFn(value)) { return false; }
|
13802 | fnToStr.call(value);
|
13803 | return true;
|
13804 | } catch (e) {
|
13805 | return false;
|
13806 | }
|
13807 | };
|
13808 | var toStr = Object.prototype.toString;
|
13809 | var fnClass = '[object Function]';
|
13810 | var genClass = '[object GeneratorFunction]';
|
13811 | var hasToStringTag = typeof Symbol === 'function' && typeof Symbol.toStringTag === 'symbol';
|
13812 |
|
13813 | module.exports = function isCallable(value) {
|
13814 | if (!value) { return false; }
|
13815 | if (typeof value !== 'function' && typeof value !== 'object') { return false; }
|
13816 | if (typeof value === 'function' && !value.prototype) { return true; }
|
13817 | if (hasToStringTag) { return tryFunctionObject(value); }
|
13818 | if (isES6ClassFn(value)) { return false; }
|
13819 | var strClass = toStr.call(value);
|
13820 | return strClass === fnClass || strClass === genClass;
|
13821 | };
|
13822 |
|
13823 | },{}],229:[function(require,module,exports){
|
13824 | (function(root) {
|
13825 | var toString = Function.prototype.toString;
|
13826 |
|
13827 | function fnBody(fn) {
|
13828 | return toString.call(fn).replace(/^[^{]*{\s*/,'').replace(/\s*}[^}]*$/,'');
|
13829 | }
|
13830 |
|
13831 | function isClass(fn) {
|
13832 | return (typeof fn === 'function' &&
|
13833 | (/^class(?:\s|{)/.test(toString.call(fn)) ||
|
13834 | (/^.*classCallCheck\(/.test(fnBody(fn))))
|
13835 | );
|
13836 | }
|
13837 |
|
13838 | if (typeof exports !== 'undefined') {
|
13839 | if (typeof module !== 'undefined' && module.exports) {
|
13840 | exports = module.exports = isClass;
|
13841 | }
|
13842 | exports.isClass = isClass;
|
13843 | } else if (typeof define === 'function' && define.amd) {
|
13844 | define([], function() {
|
13845 | return isClass;
|
13846 | });
|
13847 | } else {
|
13848 | root.isClass = isClass;
|
13849 | }
|
13850 |
|
13851 | })(this);
|
13852 |
|
13853 | },{}],230:[function(require,module,exports){
|
13854 | 'use strict';
|
13855 |
|
13856 | var getDay = Date.prototype.getDay;
|
13857 | var tryDateObject = function tryDateObject(value) {
|
13858 | try {
|
13859 | getDay.call(value);
|
13860 | return true;
|
13861 | } catch (e) {
|
13862 | return false;
|
13863 | }
|
13864 | };
|
13865 |
|
13866 | var toStr = Object.prototype.toString;
|
13867 | var dateClass = '[object Date]';
|
13868 | var hasToStringTag = typeof Symbol === 'function' && typeof Symbol.toStringTag === 'symbol';
|
13869 |
|
13870 | module.exports = function isDateObject(value) {
|
13871 | if (typeof value !== 'object' || value === null) { return false; }
|
13872 | return hasToStringTag ? tryDateObject(value) : toStr.call(value) === dateClass;
|
13873 | };
|
13874 |
|
13875 | },{}],231:[function(require,module,exports){
|
13876 | 'use strict';
|
13877 |
|
13878 | var has = require('has');
|
13879 | var regexExec = RegExp.prototype.exec;
|
13880 | var gOPD = Object.getOwnPropertyDescriptor;
|
13881 |
|
13882 | var tryRegexExecCall = function tryRegexExec(value) {
|
13883 | try {
|
13884 | var lastIndex = value.lastIndex;
|
13885 | value.lastIndex = 0;
|
13886 |
|
13887 | regexExec.call(value);
|
13888 | return true;
|
13889 | } catch (e) {
|
13890 | return false;
|
13891 | } finally {
|
13892 | value.lastIndex = lastIndex;
|
13893 | }
|
13894 | };
|
13895 | var toStr = Object.prototype.toString;
|
13896 | var regexClass = '[object RegExp]';
|
13897 | var hasToStringTag = typeof Symbol === 'function' && typeof Symbol.toStringTag === 'symbol';
|
13898 |
|
13899 | module.exports = function isRegex(value) {
|
13900 | if (!value || typeof value !== 'object') {
|
13901 | return false;
|
13902 | }
|
13903 | if (!hasToStringTag) {
|
13904 | return toStr.call(value) === regexClass;
|
13905 | }
|
13906 |
|
13907 | var descriptor = gOPD(value, 'lastIndex');
|
13908 | var hasLastIndexDataProperty = descriptor && has(descriptor, 'value');
|
13909 | if (!hasLastIndexDataProperty) {
|
13910 | return false;
|
13911 | }
|
13912 |
|
13913 | return tryRegexExecCall(value);
|
13914 | };
|
13915 |
|
13916 | },{"has":222}],232:[function(require,module,exports){
|
13917 | 'use strict';
|
13918 |
|
13919 | var toStr = Object.prototype.toString;
|
13920 | var hasSymbols = require('has-symbols')();
|
13921 |
|
13922 | if (hasSymbols) {
|
13923 | var symToStr = Symbol.prototype.toString;
|
13924 | var symStringRegex = /^Symbol\(.*\)$/;
|
13925 | var isSymbolObject = function isRealSymbolObject(value) {
|
13926 | if (typeof value.valueOf() !== 'symbol') {
|
13927 | return false;
|
13928 | }
|
13929 | return symStringRegex.test(symToStr.call(value));
|
13930 | };
|
13931 |
|
13932 | module.exports = function isSymbol(value) {
|
13933 | if (typeof value === 'symbol') {
|
13934 | return true;
|
13935 | }
|
13936 | if (toStr.call(value) !== '[object Symbol]') {
|
13937 | return false;
|
13938 | }
|
13939 | try {
|
13940 | return isSymbolObject(value);
|
13941 | } catch (e) {
|
13942 | return false;
|
13943 | }
|
13944 | };
|
13945 | } else {
|
13946 |
|
13947 | module.exports = function isSymbol(value) {
|
13948 |
|
13949 | return false && value;
|
13950 | };
|
13951 | }
|
13952 |
|
13953 | },{"has-symbols":220}],233:[function(require,module,exports){
|
13954 | 'use strict';
|
13955 |
|
13956 | var utils = require('core-util-is');
|
13957 | var isStearm = require('isstream');
|
13958 |
|
13959 | var isClass = require('is-class-hotfix');
|
13960 |
|
13961 |
|
13962 |
|
13963 |
|
13964 |
|
13965 | Object.keys(utils).map(function (name) {
|
13966 | exports[transform(name)] = utils[name];
|
13967 | });
|
13968 |
|
13969 |
|
13970 |
|
13971 |
|
13972 |
|
13973 | exports.stream = isStearm;
|
13974 | exports.readableStream = isStearm.isReadable;
|
13975 | exports.writableStream = isStearm.isWritable;
|
13976 | exports.duplexStream = isStearm.isDuplex;
|
13977 |
|
13978 |
|
13979 |
|
13980 |
|
13981 | exports.class = isClass;
|
13982 |
|
13983 |
|
13984 |
|
13985 |
|
13986 |
|
13987 | exports.finite = Number.isFinite;
|
13988 |
|
13989 | exports.NaN = Number.isNaN
|
13990 |
|
13991 | exports.generator = function (obj) {
|
13992 | return obj
|
13993 | && 'function' === typeof obj.next
|
13994 | && 'function' === typeof obj.throw;
|
13995 | };
|
13996 |
|
13997 | exports.generatorFunction = function (obj) {
|
13998 | return obj
|
13999 | && obj.constructor
|
14000 | && 'GeneratorFunction' === obj.constructor.name;
|
14001 | };
|
14002 |
|
14003 | exports.asyncFunction = function (obj) {
|
14004 | return obj
|
14005 | && obj.constructor
|
14006 | && 'AsyncFunction' === obj.constructor.name;
|
14007 | };
|
14008 |
|
14009 | exports.promise = function (obj) {
|
14010 | return obj
|
14011 | && 'function' === typeof obj.then;
|
14012 | };
|
14013 |
|
14014 | var MAX_INT_31 = Math.pow(2, 31);
|
14015 |
|
14016 | exports.int = function (obj) {
|
14017 | return utils.isNumber(obj)
|
14018 | && obj % 1 === 0;
|
14019 | };
|
14020 |
|
14021 | exports.int32 = function (obj) {
|
14022 | return exports.int(obj)
|
14023 | && obj < MAX_INT_31
|
14024 | && obj >= -MAX_INT_31;
|
14025 | };
|
14026 |
|
14027 | exports.long = function (obj) {
|
14028 | return exports.int(obj)
|
14029 | && (obj >= MAX_INT_31 || obj < -MAX_INT_31);
|
14030 | };
|
14031 |
|
14032 | exports.Long = function (obj) {
|
14033 | return exports.object(obj)
|
14034 | && exports.number(obj.high)
|
14035 | && exports.number(obj.low);
|
14036 | };
|
14037 |
|
14038 | exports.double = function (obj) {
|
14039 | return utils.isNumber(obj)
|
14040 | && !isNaN(obj)
|
14041 | && obj % 1 !== 0;
|
14042 | };
|
14043 |
|
14044 |
|
14045 |
|
14046 |
|
14047 |
|
14048 | exports.date = function isDate(obj) {
|
14049 | return obj instanceof Date;
|
14050 | };
|
14051 |
|
14052 | exports.regExp = function isRegExp(obj) {
|
14053 | return obj instanceof RegExp;
|
14054 | };
|
14055 | exports.regexp = exports.regExp;
|
14056 |
|
14057 | exports.error = function isError(obj) {
|
14058 | return obj instanceof Error;
|
14059 | };
|
14060 |
|
14061 | exports.array = Array.isArray;
|
14062 |
|
14063 |
|
14064 |
|
14065 |
|
14066 |
|
14067 |
|
14068 |
|
14069 | function transform(m) {
|
14070 | var name = m.slice(2);
|
14071 | name = name[0].toLowerCase() + name.slice(1);
|
14072 | return name;
|
14073 | }
|
14074 |
|
14075 | },{"core-util-is":186,"is-class-hotfix":229,"isstream":235}],234:[function(require,module,exports){
|
14076 | var toString = {}.toString;
|
14077 |
|
14078 | module.exports = Array.isArray || function (arr) {
|
14079 | return toString.call(arr) == '[object Array]';
|
14080 | };
|
14081 |
|
14082 | },{}],235:[function(require,module,exports){
|
14083 | var stream = require('stream')
|
14084 |
|
14085 |
|
14086 | function isStream (obj) {
|
14087 | return obj instanceof stream.Stream
|
14088 | }
|
14089 |
|
14090 |
|
14091 | function isReadable (obj) {
|
14092 | return isStream(obj) && typeof obj._read == 'function' && typeof obj._readableState == 'object'
|
14093 | }
|
14094 |
|
14095 |
|
14096 | function isWritable (obj) {
|
14097 | return isStream(obj) && typeof obj._write == 'function' && typeof obj._writableState == 'object'
|
14098 | }
|
14099 |
|
14100 |
|
14101 | function isDuplex (obj) {
|
14102 | return isReadable(obj) && isWritable(obj)
|
14103 | }
|
14104 |
|
14105 |
|
14106 | module.exports = isStream
|
14107 | module.exports.isReadable = isReadable
|
14108 | module.exports.isWritable = isWritable
|
14109 | module.exports.isDuplex = isDuplex
|
14110 |
|
14111 | },{"stream":271}],236:[function(require,module,exports){
|
14112 | (function (global){
|
14113 |
|
14114 |
|
14115 |
|
14116 |
|
14117 |
|
14118 |
|
14119 |
|
14120 |
|
14121 |
|
14122 | ;(function (global, factory) {
|
14123 | typeof exports === 'object' && typeof module !== 'undefined'
|
14124 | ? module.exports = factory(global)
|
14125 | : typeof define === 'function' && define.amd
|
14126 | ? define(factory) : factory(global)
|
14127 | }((
|
14128 | typeof self !== 'undefined' ? self
|
14129 | : typeof window !== 'undefined' ? window
|
14130 | : typeof global !== 'undefined' ? global
|
14131 | : this
|
14132 | ), function(global) {
|
14133 | 'use strict';
|
14134 |
|
14135 | global = global || {};
|
14136 | var _Base64 = global.Base64;
|
14137 | var version = "2.5.2";
|
14138 |
|
14139 | var buffer;
|
14140 | if (typeof module !== 'undefined' && module.exports) {
|
14141 | try {
|
14142 | buffer = eval("require('buffer').Buffer");
|
14143 | } catch (err) {
|
14144 | buffer = undefined;
|
14145 | }
|
14146 | }
|
14147 |
|
14148 | var b64chars
|
14149 | = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
|
14150 | var b64tab = function(bin) {
|
14151 | var t = {};
|
14152 | for (var i = 0, l = bin.length; i < l; i++) t[bin.charAt(i)] = i;
|
14153 | return t;
|
14154 | }(b64chars);
|
14155 | var fromCharCode = String.fromCharCode;
|
14156 |
|
14157 | var cb_utob = function(c) {
|
14158 | if (c.length < 2) {
|
14159 | var cc = c.charCodeAt(0);
|
14160 | return cc < 0x80 ? c
|
14161 | : cc < 0x800 ? (fromCharCode(0xc0 | (cc >>> 6))
|
14162 | + fromCharCode(0x80 | (cc & 0x3f)))
|
14163 | : (fromCharCode(0xe0 | ((cc >>> 12) & 0x0f))
|
14164 | + fromCharCode(0x80 | ((cc >>> 6) & 0x3f))
|
14165 | + fromCharCode(0x80 | ( cc & 0x3f)));
|
14166 | } else {
|
14167 | var cc = 0x10000
|
14168 | + (c.charCodeAt(0) - 0xD800) * 0x400
|
14169 | + (c.charCodeAt(1) - 0xDC00);
|
14170 | return (fromCharCode(0xf0 | ((cc >>> 18) & 0x07))
|
14171 | + fromCharCode(0x80 | ((cc >>> 12) & 0x3f))
|
14172 | + fromCharCode(0x80 | ((cc >>> 6) & 0x3f))
|
14173 | + fromCharCode(0x80 | ( cc & 0x3f)));
|
14174 | }
|
14175 | };
|
14176 | var re_utob = /[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g;
|
14177 | var utob = function(u) {
|
14178 | return u.replace(re_utob, cb_utob);
|
14179 | };
|
14180 | var cb_encode = function(ccc) {
|
14181 | var padlen = [0, 2, 1][ccc.length % 3],
|
14182 | ord = ccc.charCodeAt(0) << 16
|
14183 | | ((ccc.length > 1 ? ccc.charCodeAt(1) : 0) << 8)
|
14184 | | ((ccc.length > 2 ? ccc.charCodeAt(2) : 0)),
|
14185 | chars = [
|
14186 | b64chars.charAt( ord >>> 18),
|
14187 | b64chars.charAt((ord >>> 12) & 63),
|
14188 | padlen >= 2 ? '=' : b64chars.charAt((ord >>> 6) & 63),
|
14189 | padlen >= 1 ? '=' : b64chars.charAt(ord & 63)
|
14190 | ];
|
14191 | return chars.join('');
|
14192 | };
|
14193 | var btoa = global.btoa ? function(b) {
|
14194 | return global.btoa(b);
|
14195 | } : function(b) {
|
14196 | return b.replace(/[\s\S]{1,3}/g, cb_encode);
|
14197 | };
|
14198 | var _encode = function(u) {
|
14199 | var isUint8Array = Object.prototype.toString.call(u) === '[object Uint8Array]';
|
14200 | return isUint8Array ? u.toString('base64')
|
14201 | : btoa(utob(String(u)));
|
14202 | }
|
14203 | var encode = function(u, urisafe) {
|
14204 | return !urisafe
|
14205 | ? _encode(u)
|
14206 | : _encode(String(u)).replace(/[+\/]/g, function(m0) {
|
14207 | return m0 == '+' ? '-' : '_';
|
14208 | }).replace(/=/g, '');
|
14209 | };
|
14210 | var encodeURI = function(u) { return encode(u, true) };
|
14211 |
|
14212 | var re_btou = /[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g;
|
14213 | var cb_btou = function(cccc) {
|
14214 | switch(cccc.length) {
|
14215 | case 4:
|
14216 | var cp = ((0x07 & cccc.charCodeAt(0)) << 18)
|
14217 | | ((0x3f & cccc.charCodeAt(1)) << 12)
|
14218 | | ((0x3f & cccc.charCodeAt(2)) << 6)
|
14219 | | (0x3f & cccc.charCodeAt(3)),
|
14220 | offset = cp - 0x10000;
|
14221 | return (fromCharCode((offset >>> 10) + 0xD800)
|
14222 | + fromCharCode((offset & 0x3FF) + 0xDC00));
|
14223 | case 3:
|
14224 | return fromCharCode(
|
14225 | ((0x0f & cccc.charCodeAt(0)) << 12)
|
14226 | | ((0x3f & cccc.charCodeAt(1)) << 6)
|
14227 | | (0x3f & cccc.charCodeAt(2))
|
14228 | );
|
14229 | default:
|
14230 | return fromCharCode(
|
14231 | ((0x1f & cccc.charCodeAt(0)) << 6)
|
14232 | | (0x3f & cccc.charCodeAt(1))
|
14233 | );
|
14234 | }
|
14235 | };
|
14236 | var btou = function(b) {
|
14237 | return b.replace(re_btou, cb_btou);
|
14238 | };
|
14239 | var cb_decode = function(cccc) {
|
14240 | var len = cccc.length,
|
14241 | padlen = len % 4,
|
14242 | n = (len > 0 ? b64tab[cccc.charAt(0)] << 18 : 0)
|
14243 | | (len > 1 ? b64tab[cccc.charAt(1)] << 12 : 0)
|
14244 | | (len > 2 ? b64tab[cccc.charAt(2)] << 6 : 0)
|
14245 | | (len > 3 ? b64tab[cccc.charAt(3)] : 0),
|
14246 | chars = [
|
14247 | fromCharCode( n >>> 16),
|
14248 | fromCharCode((n >>> 8) & 0xff),
|
14249 | fromCharCode( n & 0xff)
|
14250 | ];
|
14251 | chars.length -= [0, 0, 2, 1][padlen];
|
14252 | return chars.join('');
|
14253 | };
|
14254 | var _atob = global.atob ? function(a) {
|
14255 | return global.atob(a);
|
14256 | } : function(a){
|
14257 | return a.replace(/\S{1,4}/g, cb_decode);
|
14258 | };
|
14259 | var atob = function(a) {
|
14260 | return _atob(String(a).replace(/[^A-Za-z0-9\+\/]/g, ''));
|
14261 | };
|
14262 | var _decode = buffer ?
|
14263 | buffer.from && Uint8Array && buffer.from !== Uint8Array.from
|
14264 | ? function(a) {
|
14265 | return (a.constructor === buffer.constructor
|
14266 | ? a : buffer.from(a, 'base64')).toString();
|
14267 | }
|
14268 | : function(a) {
|
14269 | return (a.constructor === buffer.constructor
|
14270 | ? a : new buffer(a, 'base64')).toString();
|
14271 | }
|
14272 | : function(a) { return btou(_atob(a)) };
|
14273 | var decode = function(a){
|
14274 | return _decode(
|
14275 | String(a).replace(/[-_]/g, function(m0) { return m0 == '-' ? '+' : '/' })
|
14276 | .replace(/[^A-Za-z0-9\+\/]/g, '')
|
14277 | );
|
14278 | };
|
14279 | var noConflict = function() {
|
14280 | var Base64 = global.Base64;
|
14281 | global.Base64 = _Base64;
|
14282 | return Base64;
|
14283 | };
|
14284 |
|
14285 | global.Base64 = {
|
14286 | VERSION: version,
|
14287 | atob: atob,
|
14288 | btoa: btoa,
|
14289 | fromBase64: decode,
|
14290 | toBase64: encode,
|
14291 | utob: utob,
|
14292 | encode: encode,
|
14293 | encodeURI: encodeURI,
|
14294 | btou: btou,
|
14295 | decode: decode,
|
14296 | noConflict: noConflict,
|
14297 | __buffer__: buffer
|
14298 | };
|
14299 |
|
14300 | if (typeof Object.defineProperty === 'function') {
|
14301 | var noEnum = function(v){
|
14302 | return {value:v,enumerable:false,writable:true,configurable:true};
|
14303 | };
|
14304 | global.Base64.extendString = function () {
|
14305 | Object.defineProperty(
|
14306 | String.prototype, 'fromBase64', noEnum(function () {
|
14307 | return decode(this)
|
14308 | }));
|
14309 | Object.defineProperty(
|
14310 | String.prototype, 'toBase64', noEnum(function (urisafe) {
|
14311 | return encode(this, urisafe)
|
14312 | }));
|
14313 | Object.defineProperty(
|
14314 | String.prototype, 'toBase64URI', noEnum(function () {
|
14315 | return encode(this, true)
|
14316 | }));
|
14317 | };
|
14318 | }
|
14319 |
|
14320 |
|
14321 |
|
14322 | if (global['Meteor']) {
|
14323 | Base64 = global.Base64;
|
14324 | }
|
14325 |
|
14326 |
|
14327 | if (typeof module !== 'undefined' && module.exports) {
|
14328 | module.exports.Base64 = global.Base64;
|
14329 | }
|
14330 | else if (typeof define === 'function' && define.amd) {
|
14331 |
|
14332 | define([], function(){ return global.Base64 });
|
14333 | }
|
14334 |
|
14335 | return {Base64: global.Base64}
|
14336 | }));
|
14337 |
|
14338 |
|
14339 | }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
14340 | },{}],237:[function(require,module,exports){
|
14341 |
|
14342 |
|
14343 |
|
14344 |
|
14345 |
|
14346 |
|
14347 |
|
14348 | 'use strict'
|
14349 |
|
14350 |
|
14351 |
|
14352 |
|
14353 |
|
14354 |
|
14355 | module.exports = merge
|
14356 |
|
14357 |
|
14358 |
|
14359 |
|
14360 |
|
14361 |
|
14362 | var hasOwnProperty = Object.prototype.hasOwnProperty
|
14363 |
|
14364 |
|
14365 |
|
14366 |
|
14367 |
|
14368 |
|
14369 |
|
14370 |
|
14371 |
|
14372 |
|
14373 |
|
14374 | function merge(dest, src, redefine) {
|
14375 | if (!dest) {
|
14376 | throw new TypeError('argument dest is required')
|
14377 | }
|
14378 |
|
14379 | if (!src) {
|
14380 | throw new TypeError('argument src is required')
|
14381 | }
|
14382 |
|
14383 | if (redefine === undefined) {
|
14384 |
|
14385 | redefine = true
|
14386 | }
|
14387 |
|
14388 | Object.getOwnPropertyNames(src).forEach(function forEachOwnPropertyName(name) {
|
14389 | if (!redefine && hasOwnProperty.call(dest, name)) {
|
14390 |
|
14391 | return
|
14392 | }
|
14393 |
|
14394 |
|
14395 | var descriptor = Object.getOwnPropertyDescriptor(src, name)
|
14396 | Object.defineProperty(dest, name, descriptor)
|
14397 | })
|
14398 |
|
14399 | return dest
|
14400 | }
|
14401 |
|
14402 | },{}],238:[function(require,module,exports){
|
14403 |
|
14404 |
|
14405 |
|
14406 |
|
14407 | var s = 1000;
|
14408 | var m = s * 60;
|
14409 | var h = m * 60;
|
14410 | var d = h * 24;
|
14411 | var y = d * 365.25;
|
14412 |
|
14413 |
|
14414 |
|
14415 |
|
14416 |
|
14417 |
|
14418 |
|
14419 |
|
14420 |
|
14421 |
|
14422 |
|
14423 |
|
14424 |
|
14425 |
|
14426 |
|
14427 | module.exports = function(val, options) {
|
14428 | options = options || {};
|
14429 | var type = typeof val;
|
14430 | if (type === 'string' && val.length > 0) {
|
14431 | return parse(val);
|
14432 | } else if (type === 'number' && isNaN(val) === false) {
|
14433 | return options.long ? fmtLong(val) : fmtShort(val);
|
14434 | }
|
14435 | throw new Error(
|
14436 | 'val is not a non-empty string or a valid number. val=' +
|
14437 | JSON.stringify(val)
|
14438 | );
|
14439 | };
|
14440 |
|
14441 |
|
14442 |
|
14443 |
|
14444 |
|
14445 |
|
14446 |
|
14447 |
|
14448 |
|
14449 | function parse(str) {
|
14450 | str = String(str);
|
14451 | if (str.length > 100) {
|
14452 | return;
|
14453 | }
|
14454 | var match = /^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(
|
14455 | str
|
14456 | );
|
14457 | if (!match) {
|
14458 | return;
|
14459 | }
|
14460 | var n = parseFloat(match[1]);
|
14461 | var type = (match[2] || 'ms').toLowerCase();
|
14462 | switch (type) {
|
14463 | case 'years':
|
14464 | case 'year':
|
14465 | case 'yrs':
|
14466 | case 'yr':
|
14467 | case 'y':
|
14468 | return n * y;
|
14469 | case 'days':
|
14470 | case 'day':
|
14471 | case 'd':
|
14472 | return n * d;
|
14473 | case 'hours':
|
14474 | case 'hour':
|
14475 | case 'hrs':
|
14476 | case 'hr':
|
14477 | case 'h':
|
14478 | return n * h;
|
14479 | case 'minutes':
|
14480 | case 'minute':
|
14481 | case 'mins':
|
14482 | case 'min':
|
14483 | case 'm':
|
14484 | return n * m;
|
14485 | case 'seconds':
|
14486 | case 'second':
|
14487 | case 'secs':
|
14488 | case 'sec':
|
14489 | case 's':
|
14490 | return n * s;
|
14491 | case 'milliseconds':
|
14492 | case 'millisecond':
|
14493 | case 'msecs':
|
14494 | case 'msec':
|
14495 | case 'ms':
|
14496 | return n;
|
14497 | default:
|
14498 | return undefined;
|
14499 | }
|
14500 | }
|
14501 |
|
14502 |
|
14503 |
|
14504 |
|
14505 |
|
14506 |
|
14507 |
|
14508 |
|
14509 |
|
14510 | function fmtShort(ms) {
|
14511 | if (ms >= d) {
|
14512 | return Math.round(ms / d) + 'd';
|
14513 | }
|
14514 | if (ms >= h) {
|
14515 | return Math.round(ms / h) + 'h';
|
14516 | }
|
14517 | if (ms >= m) {
|
14518 | return Math.round(ms / m) + 'm';
|
14519 | }
|
14520 | if (ms >= s) {
|
14521 | return Math.round(ms / s) + 's';
|
14522 | }
|
14523 | return ms + 'ms';
|
14524 | }
|
14525 |
|
14526 |
|
14527 |
|
14528 |
|
14529 |
|
14530 |
|
14531 |
|
14532 |
|
14533 |
|
14534 | function fmtLong(ms) {
|
14535 | return plural(ms, d, 'day') ||
|
14536 | plural(ms, h, 'hour') ||
|
14537 | plural(ms, m, 'minute') ||
|
14538 | plural(ms, s, 'second') ||
|
14539 | ms + ' ms';
|
14540 | }
|
14541 |
|
14542 |
|
14543 |
|
14544 |
|
14545 |
|
14546 | function plural(ms, n, name) {
|
14547 | if (ms < n) {
|
14548 | return;
|
14549 | }
|
14550 | if (ms < n * 1.5) {
|
14551 | return Math.floor(ms / n) + ' ' + name;
|
14552 | }
|
14553 | return Math.ceil(ms / n) + ' ' + name + 's';
|
14554 | }
|
14555 |
|
14556 | },{}],239:[function(require,module,exports){
|
14557 | var hasMap = typeof Map === 'function' && Map.prototype;
|
14558 | var mapSizeDescriptor = Object.getOwnPropertyDescriptor && hasMap ? Object.getOwnPropertyDescriptor(Map.prototype, 'size') : null;
|
14559 | var mapSize = hasMap && mapSizeDescriptor && typeof mapSizeDescriptor.get === 'function' ? mapSizeDescriptor.get : null;
|
14560 | var mapForEach = hasMap && Map.prototype.forEach;
|
14561 | var hasSet = typeof Set === 'function' && Set.prototype;
|
14562 | var setSizeDescriptor = Object.getOwnPropertyDescriptor && hasSet ? Object.getOwnPropertyDescriptor(Set.prototype, 'size') : null;
|
14563 | var setSize = hasSet && setSizeDescriptor && typeof setSizeDescriptor.get === 'function' ? setSizeDescriptor.get : null;
|
14564 | var setForEach = hasSet && Set.prototype.forEach;
|
14565 | var booleanValueOf = Boolean.prototype.valueOf;
|
14566 | var objectToString = Object.prototype.toString;
|
14567 | var bigIntValueOf = typeof BigInt === 'function' ? BigInt.prototype.valueOf : null;
|
14568 |
|
14569 | var inspectCustom = require('./util.inspect').custom;
|
14570 | var inspectSymbol = (inspectCustom && isSymbol(inspectCustom)) ? inspectCustom : null;
|
14571 |
|
14572 | module.exports = function inspect_ (obj, opts, depth, seen) {
|
14573 | if (!opts) opts = {};
|
14574 |
|
14575 | if (has(opts, 'quoteStyle') && (opts.quoteStyle !== 'single' && opts.quoteStyle !== 'double')) {
|
14576 | throw new TypeError('option "quoteStyle" must be "single" or "double"');
|
14577 | }
|
14578 |
|
14579 | if (typeof obj === 'undefined') {
|
14580 | return 'undefined';
|
14581 | }
|
14582 | if (obj === null) {
|
14583 | return 'null';
|
14584 | }
|
14585 | if (typeof obj === 'boolean') {
|
14586 | return obj ? 'true' : 'false';
|
14587 | }
|
14588 |
|
14589 | if (typeof obj === 'string') {
|
14590 | return inspectString(obj, opts);
|
14591 | }
|
14592 | if (typeof obj === 'number') {
|
14593 | if (obj === 0) {
|
14594 | return Infinity / obj > 0 ? '0' : '-0';
|
14595 | }
|
14596 | return String(obj);
|
14597 | }
|
14598 | if (typeof obj === 'bigint') {
|
14599 | return String(obj) + 'n';
|
14600 | }
|
14601 |
|
14602 | var maxDepth = typeof opts.depth === 'undefined' ? 5 : opts.depth;
|
14603 | if (typeof depth === 'undefined') depth = 0;
|
14604 | if (depth >= maxDepth && maxDepth > 0 && typeof obj === 'object') {
|
14605 | return '[Object]';
|
14606 | }
|
14607 |
|
14608 | if (typeof seen === 'undefined') seen = [];
|
14609 | else if (indexOf(seen, obj) >= 0) {
|
14610 | return '[Circular]';
|
14611 | }
|
14612 |
|
14613 | function inspect (value, from) {
|
14614 | if (from) {
|
14615 | seen = seen.slice();
|
14616 | seen.push(from);
|
14617 | }
|
14618 | return inspect_(value, opts, depth + 1, seen);
|
14619 | }
|
14620 |
|
14621 | if (typeof obj === 'function') {
|
14622 | var name = nameOf(obj);
|
14623 | return '[Function' + (name ? ': ' + name : '') + ']';
|
14624 | }
|
14625 | if (isSymbol(obj)) {
|
14626 | var symString = Symbol.prototype.toString.call(obj);
|
14627 | return typeof obj === 'object' ? markBoxed(symString) : symString;
|
14628 | }
|
14629 | if (isElement(obj)) {
|
14630 | var s = '<' + String(obj.nodeName).toLowerCase();
|
14631 | var attrs = obj.attributes || [];
|
14632 | for (var i = 0; i < attrs.length; i++) {
|
14633 | s += ' ' + attrs[i].name + '=' + wrapQuotes(quote(attrs[i].value), 'double', opts);
|
14634 | }
|
14635 | s += '>';
|
14636 | if (obj.childNodes && obj.childNodes.length) s += '...';
|
14637 | s += '</' + String(obj.nodeName).toLowerCase() + '>';
|
14638 | return s;
|
14639 | }
|
14640 | if (isArray(obj)) {
|
14641 | if (obj.length === 0) return '[]';
|
14642 | return '[ ' + arrObjKeys(obj, inspect).join(', ') + ' ]';
|
14643 | }
|
14644 | if (isError(obj)) {
|
14645 | var parts = arrObjKeys(obj, inspect);
|
14646 | if (parts.length === 0) return '[' + String(obj) + ']';
|
14647 | return '{ [' + String(obj) + '] ' + parts.join(', ') + ' }';
|
14648 | }
|
14649 | if (typeof obj === 'object') {
|
14650 | if (inspectSymbol && typeof obj[inspectSymbol] === 'function') {
|
14651 | return obj[inspectSymbol]();
|
14652 | } else if (typeof obj.inspect === 'function') {
|
14653 | return obj.inspect();
|
14654 | }
|
14655 | }
|
14656 | if (isMap(obj)) {
|
14657 | var parts = [];
|
14658 | mapForEach.call(obj, function (value, key) {
|
14659 | parts.push(inspect(key, obj) + ' => ' + inspect(value, obj));
|
14660 | });
|
14661 | return collectionOf('Map', mapSize.call(obj), parts);
|
14662 | }
|
14663 | if (isSet(obj)) {
|
14664 | var parts = [];
|
14665 | setForEach.call(obj, function (value ) {
|
14666 | parts.push(inspect(value, obj));
|
14667 | });
|
14668 | return collectionOf('Set', setSize.call(obj), parts);
|
14669 | }
|
14670 | if (isNumber(obj)) {
|
14671 | return markBoxed(inspect(Number(obj)));
|
14672 | }
|
14673 | if (isBigInt(obj)) {
|
14674 | return markBoxed(inspect(bigIntValueOf.call(obj)));
|
14675 | }
|
14676 | if (isBoolean(obj)) {
|
14677 | return markBoxed(booleanValueOf.call(obj));
|
14678 | }
|
14679 | if (isString(obj)) {
|
14680 | return markBoxed(inspect(String(obj)));
|
14681 | }
|
14682 | if (!isDate(obj) && !isRegExp(obj)) {
|
14683 | var xs = arrObjKeys(obj, inspect);
|
14684 | if (xs.length === 0) return '{}';
|
14685 | return '{ ' + xs.join(', ') + ' }';
|
14686 | }
|
14687 | return String(obj);
|
14688 | };
|
14689 |
|
14690 | function wrapQuotes (s, defaultStyle, opts) {
|
14691 | var quoteChar = (opts.quoteStyle || defaultStyle) === 'double' ? '"' : "'";
|
14692 | return quoteChar + s + quoteChar;
|
14693 | }
|
14694 |
|
14695 | function quote (s) {
|
14696 | return String(s).replace(/"/g, '"');
|
14697 | }
|
14698 |
|
14699 | function isArray (obj) { return toStr(obj) === '[object Array]'; }
|
14700 | function isDate (obj) { return toStr(obj) === '[object Date]'; }
|
14701 | function isRegExp (obj) { return toStr(obj) === '[object RegExp]'; }
|
14702 | function isError (obj) { return toStr(obj) === '[object Error]'; }
|
14703 | function isSymbol (obj) { return toStr(obj) === '[object Symbol]'; }
|
14704 | function isString (obj) { return toStr(obj) === '[object String]'; }
|
14705 | function isNumber (obj) { return toStr(obj) === '[object Number]'; }
|
14706 | function isBigInt (obj) { return toStr(obj) === '[object BigInt]'; }
|
14707 | function isBoolean (obj) { return toStr(obj) === '[object Boolean]'; }
|
14708 |
|
14709 | var hasOwn = Object.prototype.hasOwnProperty || function (key) { return key in this; };
|
14710 | function has (obj, key) {
|
14711 | return hasOwn.call(obj, key);
|
14712 | }
|
14713 |
|
14714 | function toStr (obj) {
|
14715 | return objectToString.call(obj);
|
14716 | }
|
14717 |
|
14718 | function nameOf (f) {
|
14719 | if (f.name) return f.name;
|
14720 | var m = String(f).match(/^function\s*([\w$]+)/);
|
14721 | if (m) return m[1];
|
14722 | }
|
14723 |
|
14724 | function indexOf (xs, x) {
|
14725 | if (xs.indexOf) return xs.indexOf(x);
|
14726 | for (var i = 0, l = xs.length; i < l; i++) {
|
14727 | if (xs[i] === x) return i;
|
14728 | }
|
14729 | return -1;
|
14730 | }
|
14731 |
|
14732 | function isMap (x) {
|
14733 | if (!mapSize) {
|
14734 | return false;
|
14735 | }
|
14736 | try {
|
14737 | mapSize.call(x);
|
14738 | try {
|
14739 | setSize.call(x);
|
14740 | } catch (s) {
|
14741 | return true;
|
14742 | }
|
14743 | return x instanceof Map;
|
14744 | } catch (e) {}
|
14745 | return false;
|
14746 | }
|
14747 |
|
14748 | function isSet (x) {
|
14749 | if (!setSize) {
|
14750 | return false;
|
14751 | }
|
14752 | try {
|
14753 | setSize.call(x);
|
14754 | try {
|
14755 | mapSize.call(x);
|
14756 | } catch (m) {
|
14757 | return true;
|
14758 | }
|
14759 | return x instanceof Set;
|
14760 | } catch (e) {}
|
14761 | return false;
|
14762 | }
|
14763 |
|
14764 | function isElement (x) {
|
14765 | if (!x || typeof x !== 'object') return false;
|
14766 | if (typeof HTMLElement !== 'undefined' && x instanceof HTMLElement) {
|
14767 | return true;
|
14768 | }
|
14769 | return typeof x.nodeName === 'string'
|
14770 | && typeof x.getAttribute === 'function'
|
14771 | ;
|
14772 | }
|
14773 |
|
14774 | function inspectString (str, opts) {
|
14775 | var s = str.replace(/(['\\])/g, '\\$1').replace(/[\x00-\x1f]/g, lowbyte);
|
14776 | return wrapQuotes(s, 'single', opts);
|
14777 | }
|
14778 |
|
14779 | function lowbyte (c) {
|
14780 | var n = c.charCodeAt(0);
|
14781 | var x = { 8: 'b', 9: 't', 10: 'n', 12: 'f', 13: 'r' }[n];
|
14782 | if (x) return '\\' + x;
|
14783 | return '\\x' + (n < 0x10 ? '0' : '') + n.toString(16);
|
14784 | }
|
14785 |
|
14786 | function markBoxed (str) {
|
14787 | return 'Object(' + str + ')';
|
14788 | }
|
14789 |
|
14790 | function collectionOf (type, size, entries) {
|
14791 | return type + ' (' + size + ') {' + entries.join(', ') + '}';
|
14792 | }
|
14793 |
|
14794 | function arrObjKeys (obj, inspect) {
|
14795 | var isArr = isArray(obj);
|
14796 | var xs = [];
|
14797 | if (isArr) {
|
14798 | xs.length = obj.length;
|
14799 | for (var i = 0; i < obj.length; i++) {
|
14800 | xs[i] = has(obj, i) ? inspect(obj[i], obj) : '';
|
14801 | }
|
14802 | }
|
14803 | for (var key in obj) {
|
14804 | if (!has(obj, key)) continue;
|
14805 | if (isArr && String(Number(key)) === key && key < obj.length) continue;
|
14806 | if (/[^\w$]/.test(key)) {
|
14807 | xs.push(inspect(key, obj) + ': ' + inspect(obj[key], obj));
|
14808 | } else {
|
14809 | xs.push(key + ': ' + inspect(obj[key], obj));
|
14810 | }
|
14811 | }
|
14812 | return xs;
|
14813 | }
|
14814 |
|
14815 | },{"./util.inspect":68}],240:[function(require,module,exports){
|
14816 | 'use strict';
|
14817 |
|
14818 |
|
14819 | var has = Object.prototype.hasOwnProperty;
|
14820 | var toStr = Object.prototype.toString;
|
14821 | var slice = Array.prototype.slice;
|
14822 | var isArgs = require('./isArguments');
|
14823 | var isEnumerable = Object.prototype.propertyIsEnumerable;
|
14824 | var hasDontEnumBug = !isEnumerable.call({ toString: null }, 'toString');
|
14825 | var hasProtoEnumBug = isEnumerable.call(function () {}, 'prototype');
|
14826 | var dontEnums = [
|
14827 | 'toString',
|
14828 | 'toLocaleString',
|
14829 | 'valueOf',
|
14830 | 'hasOwnProperty',
|
14831 | 'isPrototypeOf',
|
14832 | 'propertyIsEnumerable',
|
14833 | 'constructor'
|
14834 | ];
|
14835 | var equalsConstructorPrototype = function (o) {
|
14836 | var ctor = o.constructor;
|
14837 | return ctor && ctor.prototype === o;
|
14838 | };
|
14839 | var excludedKeys = {
|
14840 | $applicationCache: true,
|
14841 | $console: true,
|
14842 | $external: true,
|
14843 | $frame: true,
|
14844 | $frameElement: true,
|
14845 | $frames: true,
|
14846 | $innerHeight: true,
|
14847 | $innerWidth: true,
|
14848 | $outerHeight: true,
|
14849 | $outerWidth: true,
|
14850 | $pageXOffset: true,
|
14851 | $pageYOffset: true,
|
14852 | $parent: true,
|
14853 | $scrollLeft: true,
|
14854 | $scrollTop: true,
|
14855 | $scrollX: true,
|
14856 | $scrollY: true,
|
14857 | $self: true,
|
14858 | $webkitIndexedDB: true,
|
14859 | $webkitStorageInfo: true,
|
14860 | $window: true
|
14861 | };
|
14862 | var hasAutomationEqualityBug = (function () {
|
14863 |
|
14864 | if (typeof window === 'undefined') { return false; }
|
14865 | for (var k in window) {
|
14866 | try {
|
14867 | if (!excludedKeys['$' + k] && has.call(window, k) && window[k] !== null && typeof window[k] === 'object') {
|
14868 | try {
|
14869 | equalsConstructorPrototype(window[k]);
|
14870 | } catch (e) {
|
14871 | return true;
|
14872 | }
|
14873 | }
|
14874 | } catch (e) {
|
14875 | return true;
|
14876 | }
|
14877 | }
|
14878 | return false;
|
14879 | }());
|
14880 | var equalsConstructorPrototypeIfNotBuggy = function (o) {
|
14881 |
|
14882 | if (typeof window === 'undefined' || !hasAutomationEqualityBug) {
|
14883 | return equalsConstructorPrototype(o);
|
14884 | }
|
14885 | try {
|
14886 | return equalsConstructorPrototype(o);
|
14887 | } catch (e) {
|
14888 | return false;
|
14889 | }
|
14890 | };
|
14891 |
|
14892 | var keysShim = function keys(object) {
|
14893 | var isObject = object !== null && typeof object === 'object';
|
14894 | var isFunction = toStr.call(object) === '[object Function]';
|
14895 | var isArguments = isArgs(object);
|
14896 | var isString = isObject && toStr.call(object) === '[object String]';
|
14897 | var theKeys = [];
|
14898 |
|
14899 | if (!isObject && !isFunction && !isArguments) {
|
14900 | throw new TypeError('Object.keys called on a non-object');
|
14901 | }
|
14902 |
|
14903 | var skipProto = hasProtoEnumBug && isFunction;
|
14904 | if (isString && object.length > 0 && !has.call(object, 0)) {
|
14905 | for (var i = 0; i < object.length; ++i) {
|
14906 | theKeys.push(String(i));
|
14907 | }
|
14908 | }
|
14909 |
|
14910 | if (isArguments && object.length > 0) {
|
14911 | for (var j = 0; j < object.length; ++j) {
|
14912 | theKeys.push(String(j));
|
14913 | }
|
14914 | } else {
|
14915 | for (var name in object) {
|
14916 | if (!(skipProto && name === 'prototype') && has.call(object, name)) {
|
14917 | theKeys.push(String(name));
|
14918 | }
|
14919 | }
|
14920 | }
|
14921 |
|
14922 | if (hasDontEnumBug) {
|
14923 | var skipConstructor = equalsConstructorPrototypeIfNotBuggy(object);
|
14924 |
|
14925 | for (var k = 0; k < dontEnums.length; ++k) {
|
14926 | if (!(skipConstructor && dontEnums[k] === 'constructor') && has.call(object, dontEnums[k])) {
|
14927 | theKeys.push(dontEnums[k]);
|
14928 | }
|
14929 | }
|
14930 | }
|
14931 | return theKeys;
|
14932 | };
|
14933 |
|
14934 | keysShim.shim = function shimObjectKeys() {
|
14935 | if (Object.keys) {
|
14936 | var keysWorksWithArguments = (function () {
|
14937 |
|
14938 | return (Object.keys(arguments) || '').length === 2;
|
14939 | }(1, 2));
|
14940 | if (!keysWorksWithArguments) {
|
14941 | var originalKeys = Object.keys;
|
14942 | Object.keys = function keys(object) {
|
14943 | if (isArgs(object)) {
|
14944 | return originalKeys(slice.call(object));
|
14945 | } else {
|
14946 | return originalKeys(object);
|
14947 | }
|
14948 | };
|
14949 | }
|
14950 | } else {
|
14951 | Object.keys = keysShim;
|
14952 | }
|
14953 | return Object.keys || keysShim;
|
14954 | };
|
14955 |
|
14956 | module.exports = keysShim;
|
14957 |
|
14958 | },{"./isArguments":241}],241:[function(require,module,exports){
|
14959 | arguments[4][210][0].apply(exports,arguments)
|
14960 | },{"dup":210}],242:[function(require,module,exports){
|
14961 | 'use strict';
|
14962 |
|
14963 | var ES = require('es-abstract/es7');
|
14964 |
|
14965 | var defineProperty = Object.defineProperty;
|
14966 | var getDescriptor = Object.getOwnPropertyDescriptor;
|
14967 | var getOwnNames = Object.getOwnPropertyNames;
|
14968 | var getSymbols = Object.getOwnPropertySymbols;
|
14969 | var concat = Function.call.bind(Array.prototype.concat);
|
14970 | var reduce = Function.call.bind(Array.prototype.reduce);
|
14971 | var getAll = getSymbols ? function (obj) {
|
14972 | return concat(getOwnNames(obj), getSymbols(obj));
|
14973 | } : getOwnNames;
|
14974 |
|
14975 | var isES5 = ES.IsCallable(getDescriptor) && ES.IsCallable(getOwnNames);
|
14976 |
|
14977 | var safePut = function put(obj, prop, val) {
|
14978 | if (defineProperty && prop in obj) {
|
14979 | defineProperty(obj, prop, {
|
14980 | configurable: true,
|
14981 | enumerable: true,
|
14982 | value: val,
|
14983 | writable: true
|
14984 | });
|
14985 | } else {
|
14986 | obj[prop] = val;
|
14987 | }
|
14988 | };
|
14989 |
|
14990 | module.exports = function getOwnPropertyDescriptors(value) {
|
14991 | ES.RequireObjectCoercible(value);
|
14992 | if (!isES5) {
|
14993 | throw new TypeError('getOwnPropertyDescriptors requires Object.getOwnPropertyDescriptor');
|
14994 | }
|
14995 |
|
14996 | var O = ES.ToObject(value);
|
14997 | return reduce(getAll(O), function (acc, key) {
|
14998 | var descriptor = getDescriptor(O, key);
|
14999 | if (typeof descriptor !== 'undefined') {
|
15000 | safePut(acc, key, descriptor);
|
15001 | }
|
15002 | return acc;
|
15003 | }, {});
|
15004 | };
|
15005 |
|
15006 | },{"es-abstract/es7":195}],243:[function(require,module,exports){
|
15007 | 'use strict';
|
15008 |
|
15009 | var define = require('define-properties');
|
15010 |
|
15011 | var implementation = require('./implementation');
|
15012 | var getPolyfill = require('./polyfill');
|
15013 | var shim = require('./shim');
|
15014 |
|
15015 | define(implementation, {
|
15016 | getPolyfill: getPolyfill,
|
15017 | implementation: implementation,
|
15018 | shim: shim
|
15019 | });
|
15020 |
|
15021 | module.exports = implementation;
|
15022 |
|
15023 | },{"./implementation":242,"./polyfill":244,"./shim":245,"define-properties":190}],244:[function(require,module,exports){
|
15024 | 'use strict';
|
15025 |
|
15026 | var implementation = require('./implementation');
|
15027 |
|
15028 | module.exports = function getPolyfill() {
|
15029 | return typeof Object.getOwnPropertyDescriptors === 'function' ? Object.getOwnPropertyDescriptors : implementation;
|
15030 | };
|
15031 |
|
15032 | },{"./implementation":242}],245:[function(require,module,exports){
|
15033 | 'use strict';
|
15034 |
|
15035 | var getPolyfill = require('./polyfill');
|
15036 | var define = require('define-properties');
|
15037 |
|
15038 | module.exports = function shimGetOwnPropertyDescriptors() {
|
15039 | var polyfill = getPolyfill();
|
15040 | define(
|
15041 | Object,
|
15042 | { getOwnPropertyDescriptors: polyfill },
|
15043 | { getOwnPropertyDescriptors: function () { return Object.getOwnPropertyDescriptors !== polyfill; } }
|
15044 | );
|
15045 | return polyfill;
|
15046 | };
|
15047 |
|
15048 | },{"./polyfill":244,"define-properties":190}],246:[function(require,module,exports){
|
15049 | (function (process){
|
15050 |
|
15051 |
|
15052 |
|
15053 |
|
15054 |
|
15055 |
|
15056 |
|
15057 |
|
15058 |
|
15059 |
|
15060 |
|
15061 |
|
15062 |
|
15063 |
|
15064 |
|
15065 |
|
15066 |
|
15067 |
|
15068 |
|
15069 |
|
15070 |
|
15071 |
|
15072 |
|
15073 |
|
15074 |
|
15075 |
|
15076 |
|
15077 |
|
15078 | function normalizeArray(parts, allowAboveRoot) {
|
15079 |
|
15080 | var up = 0;
|
15081 | for (var i = parts.length - 1; i >= 0; i--) {
|
15082 | var last = parts[i];
|
15083 | if (last === '.') {
|
15084 | parts.splice(i, 1);
|
15085 | } else if (last === '..') {
|
15086 | parts.splice(i, 1);
|
15087 | up++;
|
15088 | } else if (up) {
|
15089 | parts.splice(i, 1);
|
15090 | up--;
|
15091 | }
|
15092 | }
|
15093 |
|
15094 |
|
15095 | if (allowAboveRoot) {
|
15096 | for (; up--; up) {
|
15097 | parts.unshift('..');
|
15098 | }
|
15099 | }
|
15100 |
|
15101 | return parts;
|
15102 | }
|
15103 |
|
15104 |
|
15105 |
|
15106 | exports.resolve = function() {
|
15107 | var resolvedPath = '',
|
15108 | resolvedAbsolute = false;
|
15109 |
|
15110 | for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {
|
15111 | var path = (i >= 0) ? arguments[i] : process.cwd();
|
15112 |
|
15113 |
|
15114 | if (typeof path !== 'string') {
|
15115 | throw new TypeError('Arguments to path.resolve must be strings');
|
15116 | } else if (!path) {
|
15117 | continue;
|
15118 | }
|
15119 |
|
15120 | resolvedPath = path + '/' + resolvedPath;
|
15121 | resolvedAbsolute = path.charAt(0) === '/';
|
15122 | }
|
15123 |
|
15124 |
|
15125 |
|
15126 |
|
15127 |
|
15128 | resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function(p) {
|
15129 | return !!p;
|
15130 | }), !resolvedAbsolute).join('/');
|
15131 |
|
15132 | return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.';
|
15133 | };
|
15134 |
|
15135 |
|
15136 |
|
15137 | exports.normalize = function(path) {
|
15138 | var isAbsolute = exports.isAbsolute(path),
|
15139 | trailingSlash = substr(path, -1) === '/';
|
15140 |
|
15141 |
|
15142 | path = normalizeArray(filter(path.split('/'), function(p) {
|
15143 | return !!p;
|
15144 | }), !isAbsolute).join('/');
|
15145 |
|
15146 | if (!path && !isAbsolute) {
|
15147 | path = '.';
|
15148 | }
|
15149 | if (path && trailingSlash) {
|
15150 | path += '/';
|
15151 | }
|
15152 |
|
15153 | return (isAbsolute ? '/' : '') + path;
|
15154 | };
|
15155 |
|
15156 |
|
15157 | exports.isAbsolute = function(path) {
|
15158 | return path.charAt(0) === '/';
|
15159 | };
|
15160 |
|
15161 |
|
15162 | exports.join = function() {
|
15163 | var paths = Array.prototype.slice.call(arguments, 0);
|
15164 | return exports.normalize(filter(paths, function(p, index) {
|
15165 | if (typeof p !== 'string') {
|
15166 | throw new TypeError('Arguments to path.join must be strings');
|
15167 | }
|
15168 | return p;
|
15169 | }).join('/'));
|
15170 | };
|
15171 |
|
15172 |
|
15173 |
|
15174 |
|
15175 | exports.relative = function(from, to) {
|
15176 | from = exports.resolve(from).substr(1);
|
15177 | to = exports.resolve(to).substr(1);
|
15178 |
|
15179 | function trim(arr) {
|
15180 | var start = 0;
|
15181 | for (; start < arr.length; start++) {
|
15182 | if (arr[start] !== '') break;
|
15183 | }
|
15184 |
|
15185 | var end = arr.length - 1;
|
15186 | for (; end >= 0; end--) {
|
15187 | if (arr[end] !== '') break;
|
15188 | }
|
15189 |
|
15190 | if (start > end) return [];
|
15191 | return arr.slice(start, end - start + 1);
|
15192 | }
|
15193 |
|
15194 | var fromParts = trim(from.split('/'));
|
15195 | var toParts = trim(to.split('/'));
|
15196 |
|
15197 | var length = Math.min(fromParts.length, toParts.length);
|
15198 | var samePartsLength = length;
|
15199 | for (var i = 0; i < length; i++) {
|
15200 | if (fromParts[i] !== toParts[i]) {
|
15201 | samePartsLength = i;
|
15202 | break;
|
15203 | }
|
15204 | }
|
15205 |
|
15206 | var outputParts = [];
|
15207 | for (var i = samePartsLength; i < fromParts.length; i++) {
|
15208 | outputParts.push('..');
|
15209 | }
|
15210 |
|
15211 | outputParts = outputParts.concat(toParts.slice(samePartsLength));
|
15212 |
|
15213 | return outputParts.join('/');
|
15214 | };
|
15215 |
|
15216 | exports.sep = '/';
|
15217 | exports.delimiter = ':';
|
15218 |
|
15219 | exports.dirname = function (path) {
|
15220 | if (typeof path !== 'string') path = path + '';
|
15221 | if (path.length === 0) return '.';
|
15222 | var code = path.charCodeAt(0);
|
15223 | var hasRoot = code === 47 ;
|
15224 | var end = -1;
|
15225 | var matchedSlash = true;
|
15226 | for (var i = path.length - 1; i >= 1; --i) {
|
15227 | code = path.charCodeAt(i);
|
15228 | if (code === 47 ) {
|
15229 | if (!matchedSlash) {
|
15230 | end = i;
|
15231 | break;
|
15232 | }
|
15233 | } else {
|
15234 |
|
15235 | matchedSlash = false;
|
15236 | }
|
15237 | }
|
15238 |
|
15239 | if (end === -1) return hasRoot ? '/' : '.';
|
15240 | if (hasRoot && end === 1) {
|
15241 |
|
15242 |
|
15243 | return '/';
|
15244 | }
|
15245 | return path.slice(0, end);
|
15246 | };
|
15247 |
|
15248 | function basename(path) {
|
15249 | if (typeof path !== 'string') path = path + '';
|
15250 |
|
15251 | var start = 0;
|
15252 | var end = -1;
|
15253 | var matchedSlash = true;
|
15254 | var i;
|
15255 |
|
15256 | for (i = path.length - 1; i >= 0; --i) {
|
15257 | if (path.charCodeAt(i) === 47 ) {
|
15258 |
|
15259 |
|
15260 | if (!matchedSlash) {
|
15261 | start = i + 1;
|
15262 | break;
|
15263 | }
|
15264 | } else if (end === -1) {
|
15265 |
|
15266 |
|
15267 | matchedSlash = false;
|
15268 | end = i + 1;
|
15269 | }
|
15270 | }
|
15271 |
|
15272 | if (end === -1) return '';
|
15273 | return path.slice(start, end);
|
15274 | }
|
15275 |
|
15276 |
|
15277 |
|
15278 | exports.basename = function (path, ext) {
|
15279 | var f = basename(path);
|
15280 | if (ext && f.substr(-1 * ext.length) === ext) {
|
15281 | f = f.substr(0, f.length - ext.length);
|
15282 | }
|
15283 | return f;
|
15284 | };
|
15285 |
|
15286 | exports.extname = function (path) {
|
15287 | if (typeof path !== 'string') path = path + '';
|
15288 | var startDot = -1;
|
15289 | var startPart = 0;
|
15290 | var end = -1;
|
15291 | var matchedSlash = true;
|
15292 |
|
15293 |
|
15294 | var preDotState = 0;
|
15295 | for (var i = path.length - 1; i >= 0; --i) {
|
15296 | var code = path.charCodeAt(i);
|
15297 | if (code === 47 ) {
|
15298 |
|
15299 |
|
15300 | if (!matchedSlash) {
|
15301 | startPart = i + 1;
|
15302 | break;
|
15303 | }
|
15304 | continue;
|
15305 | }
|
15306 | if (end === -1) {
|
15307 |
|
15308 |
|
15309 | matchedSlash = false;
|
15310 | end = i + 1;
|
15311 | }
|
15312 | if (code === 46 ) {
|
15313 |
|
15314 | if (startDot === -1)
|
15315 | startDot = i;
|
15316 | else if (preDotState !== 1)
|
15317 | preDotState = 1;
|
15318 | } else if (startDot !== -1) {
|
15319 |
|
15320 |
|
15321 | preDotState = -1;
|
15322 | }
|
15323 | }
|
15324 |
|
15325 | if (startDot === -1 || end === -1 ||
|
15326 |
|
15327 | preDotState === 0 ||
|
15328 |
|
15329 | preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) {
|
15330 | return '';
|
15331 | }
|
15332 | return path.slice(startDot, end);
|
15333 | };
|
15334 |
|
15335 | function filter (xs, f) {
|
15336 | if (xs.filter) return xs.filter(f);
|
15337 | var res = [];
|
15338 | for (var i = 0; i < xs.length; i++) {
|
15339 | if (f(xs[i], i, xs)) res.push(xs[i]);
|
15340 | }
|
15341 | return res;
|
15342 | }
|
15343 |
|
15344 |
|
15345 | var substr = 'ab'.substr(-1) === 'b'
|
15346 | ? function (str, start, len) { return str.substr(start, len) }
|
15347 | : function (str, start, len) {
|
15348 | if (start < 0) start = str.length + start;
|
15349 | return str.substr(start, len);
|
15350 | }
|
15351 | ;
|
15352 |
|
15353 | }).call(this,require('_process'))
|
15354 | },{"_process":249}],247:[function(require,module,exports){
|
15355 | (function (global){
|
15356 |
|
15357 |
|
15358 |
|
15359 |
|
15360 |
|
15361 |
|
15362 | ;(function() {
|
15363 | 'use strict';
|
15364 |
|
15365 |
|
15366 | var objectTypes = {
|
15367 | 'function': true,
|
15368 | 'object': true
|
15369 | };
|
15370 |
|
15371 |
|
15372 | var root = (objectTypes[typeof window] && window) || this;
|
15373 |
|
15374 |
|
15375 | var oldRoot = root;
|
15376 |
|
15377 |
|
15378 | var freeExports = objectTypes[typeof exports] && exports;
|
15379 |
|
15380 |
|
15381 | var freeModule = objectTypes[typeof module] && module && !module.nodeType && module;
|
15382 |
|
15383 |
|
15384 | var freeGlobal = freeExports && freeModule && typeof global == 'object' && global;
|
15385 | if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal || freeGlobal.self === freeGlobal)) {
|
15386 | root = freeGlobal;
|
15387 | }
|
15388 |
|
15389 | |
15390 |
|
15391 |
|
15392 |
|
15393 |
|
15394 | var maxSafeInteger = Math.pow(2, 53) - 1;
|
15395 |
|
15396 |
|
15397 | var reOpera = /\bOpera/;
|
15398 |
|
15399 |
|
15400 | var thisBinding = this;
|
15401 |
|
15402 |
|
15403 | var objectProto = Object.prototype;
|
15404 |
|
15405 |
|
15406 | var hasOwnProperty = objectProto.hasOwnProperty;
|
15407 |
|
15408 |
|
15409 | var toString = objectProto.toString;
|
15410 |
|
15411 |
|
15412 |
|
15413 | |
15414 |
|
15415 |
|
15416 |
|
15417 |
|
15418 |
|
15419 |
|
15420 | function capitalize(string) {
|
15421 | string = String(string);
|
15422 | return string.charAt(0).toUpperCase() + string.slice(1);
|
15423 | }
|
15424 |
|
15425 | |
15426 |
|
15427 |
|
15428 |
|
15429 |
|
15430 |
|
15431 |
|
15432 |
|
15433 | function cleanupOS(os, pattern, label) {
|
15434 |
|
15435 |
|
15436 |
|
15437 | var data = {
|
15438 | '10.0': '10',
|
15439 | '6.4': '10 Technical Preview',
|
15440 | '6.3': '8.1',
|
15441 | '6.2': '8',
|
15442 | '6.1': 'Server 2008 R2 / 7',
|
15443 | '6.0': 'Server 2008 / Vista',
|
15444 | '5.2': 'Server 2003 / XP 64-bit',
|
15445 | '5.1': 'XP',
|
15446 | '5.01': '2000 SP1',
|
15447 | '5.0': '2000',
|
15448 | '4.0': 'NT',
|
15449 | '4.90': 'ME'
|
15450 | };
|
15451 |
|
15452 | if (pattern && label && /^Win/i.test(os) && !/^Windows Phone /i.test(os) &&
|
15453 | (data = data[/[\d.]+$/.exec(os)])) {
|
15454 | os = 'Windows ' + data;
|
15455 | }
|
15456 |
|
15457 | os = String(os);
|
15458 |
|
15459 | if (pattern && label) {
|
15460 | os = os.replace(RegExp(pattern, 'i'), label);
|
15461 | }
|
15462 |
|
15463 | os = format(
|
15464 | os.replace(/ ce$/i, ' CE')
|
15465 | .replace(/\bhpw/i, 'web')
|
15466 | .replace(/\bMacintosh\b/, 'Mac OS')
|
15467 | .replace(/_PowerPC\b/i, ' OS')
|
15468 | .replace(/\b(OS X) [^ \d]+/i, '$1')
|
15469 | .replace(/\bMac (OS X)\b/, '$1')
|
15470 | .replace(/\/(\d)/, ' $1')
|
15471 | .replace(/_/g, '.')
|
15472 | .replace(/(?: BePC|[ .]*fc[ \d.]+)$/i, '')
|
15473 | .replace(/\bx86\.64\b/gi, 'x86_64')
|
15474 | .replace(/\b(Windows Phone) OS\b/, '$1')
|
15475 | .replace(/\b(Chrome OS \w+) [\d.]+\b/, '$1')
|
15476 | .split(' on ')[0]
|
15477 | );
|
15478 |
|
15479 | return os;
|
15480 | }
|
15481 |
|
15482 | |
15483 |
|
15484 |
|
15485 |
|
15486 |
|
15487 |
|
15488 |
|
15489 | function each(object, callback) {
|
15490 | var index = -1,
|
15491 | length = object ? object.length : 0;
|
15492 |
|
15493 | if (typeof length == 'number' && length > -1 && length <= maxSafeInteger) {
|
15494 | while (++index < length) {
|
15495 | callback(object[index], index, object);
|
15496 | }
|
15497 | } else {
|
15498 | forOwn(object, callback);
|
15499 | }
|
15500 | }
|
15501 |
|
15502 | |
15503 |
|
15504 |
|
15505 |
|
15506 |
|
15507 |
|
15508 |
|
15509 | function format(string) {
|
15510 | string = trim(string);
|
15511 | return /^(?:webOS|i(?:OS|P))/.test(string)
|
15512 | ? string
|
15513 | : capitalize(string);
|
15514 | }
|
15515 |
|
15516 | |
15517 |
|
15518 |
|
15519 |
|
15520 |
|
15521 |
|
15522 |
|
15523 | function forOwn(object, callback) {
|
15524 | for (var key in object) {
|
15525 | if (hasOwnProperty.call(object, key)) {
|
15526 | callback(object[key], key, object);
|
15527 | }
|
15528 | }
|
15529 | }
|
15530 |
|
15531 | |
15532 |
|
15533 |
|
15534 |
|
15535 |
|
15536 |
|
15537 |
|
15538 | function getClassOf(value) {
|
15539 | return value == null
|
15540 | ? capitalize(value)
|
15541 | : toString.call(value).slice(8, -1);
|
15542 | }
|
15543 |
|
15544 | |
15545 |
|
15546 |
|
15547 |
|
15548 |
|
15549 |
|
15550 |
|
15551 |
|
15552 |
|
15553 |
|
15554 | function isHostType(object, property) {
|
15555 | var type = object != null ? typeof object[property] : 'number';
|
15556 | return !/^(?:boolean|number|string|undefined)$/.test(type) &&
|
15557 | (type == 'object' ? !!object[property] : true);
|
15558 | }
|
15559 |
|
15560 | |
15561 |
|
15562 |
|
15563 |
|
15564 |
|
15565 |
|
15566 |
|
15567 | function qualify(string) {
|
15568 | return String(string).replace(/([ -])(?!$)/g, '$1?');
|
15569 | }
|
15570 |
|
15571 | |
15572 |
|
15573 |
|
15574 |
|
15575 |
|
15576 |
|
15577 |
|
15578 |
|
15579 | function reduce(array, callback) {
|
15580 | var accumulator = null;
|
15581 | each(array, function(value, index) {
|
15582 | accumulator = callback(accumulator, value, index, array);
|
15583 | });
|
15584 | return accumulator;
|
15585 | }
|
15586 |
|
15587 | |
15588 |
|
15589 |
|
15590 |
|
15591 |
|
15592 |
|
15593 |
|
15594 | function trim(string) {
|
15595 | return String(string).replace(/^ +| +$/g, '');
|
15596 | }
|
15597 |
|
15598 |
|
15599 |
|
15600 | |
15601 |
|
15602 |
|
15603 |
|
15604 |
|
15605 |
|
15606 |
|
15607 |
|
15608 | function parse(ua) {
|
15609 |
|
15610 |
|
15611 | var context = root;
|
15612 |
|
15613 |
|
15614 | var isCustomContext = ua && typeof ua == 'object' && getClassOf(ua) != 'String';
|
15615 |
|
15616 |
|
15617 | if (isCustomContext) {
|
15618 | context = ua;
|
15619 | ua = null;
|
15620 | }
|
15621 |
|
15622 |
|
15623 | var nav = context.navigator || {};
|
15624 |
|
15625 |
|
15626 | var userAgent = nav.userAgent || '';
|
15627 |
|
15628 | ua || (ua = userAgent);
|
15629 |
|
15630 |
|
15631 | var isModuleScope = isCustomContext || thisBinding == oldRoot;
|
15632 |
|
15633 |
|
15634 | var likeChrome = isCustomContext
|
15635 | ? !!nav.likeChrome
|
15636 | : /\bChrome\b/.test(ua) && !/internal|\n/i.test(toString.toString());
|
15637 |
|
15638 |
|
15639 | var objectClass = 'Object',
|
15640 | airRuntimeClass = isCustomContext ? objectClass : 'ScriptBridgingProxyObject',
|
15641 | enviroClass = isCustomContext ? objectClass : 'Environment',
|
15642 | javaClass = (isCustomContext && context.java) ? 'JavaPackage' : getClassOf(context.java),
|
15643 | phantomClass = isCustomContext ? objectClass : 'RuntimeObject';
|
15644 |
|
15645 |
|
15646 | var java = /\bJava/.test(javaClass) && context.java;
|
15647 |
|
15648 |
|
15649 | var rhino = java && getClassOf(context.environment) == enviroClass;
|
15650 |
|
15651 |
|
15652 | var alpha = java ? 'a' : '\u03b1';
|
15653 |
|
15654 |
|
15655 | var beta = java ? 'b' : '\u03b2';
|
15656 |
|
15657 |
|
15658 | var doc = context.document || {};
|
15659 |
|
15660 | |
15661 |
|
15662 |
|
15663 |
|
15664 |
|
15665 | var opera = context.operamini || context.opera;
|
15666 |
|
15667 |
|
15668 | var operaClass = reOpera.test(operaClass = (isCustomContext && opera) ? opera['[[Class]]'] : getClassOf(opera))
|
15669 | ? operaClass
|
15670 | : (opera = null);
|
15671 |
|
15672 |
|
15673 |
|
15674 |
|
15675 | var data;
|
15676 |
|
15677 |
|
15678 | var arch = ua;
|
15679 |
|
15680 |
|
15681 | var description = [];
|
15682 |
|
15683 |
|
15684 | var prerelease = null;
|
15685 |
|
15686 |
|
15687 | var useFeatures = ua == userAgent;
|
15688 |
|
15689 |
|
15690 | var version = useFeatures && opera && typeof opera.version == 'function' && opera.version();
|
15691 |
|
15692 |
|
15693 | var isSpecialCasedOS;
|
15694 |
|
15695 |
|
15696 | var layout = getLayout([
|
15697 | { 'label': 'EdgeHTML', 'pattern': 'Edge' },
|
15698 | 'Trident',
|
15699 | { 'label': 'WebKit', 'pattern': 'AppleWebKit' },
|
15700 | 'iCab',
|
15701 | 'Presto',
|
15702 | 'NetFront',
|
15703 | 'Tasman',
|
15704 | 'KHTML',
|
15705 | 'Gecko'
|
15706 | ]);
|
15707 |
|
15708 |
|
15709 | var name = getName([
|
15710 | 'Adobe AIR',
|
15711 | 'Arora',
|
15712 | 'Avant Browser',
|
15713 | 'Breach',
|
15714 | 'Camino',
|
15715 | 'Electron',
|
15716 | 'Epiphany',
|
15717 | 'Fennec',
|
15718 | 'Flock',
|
15719 | 'Galeon',
|
15720 | 'GreenBrowser',
|
15721 | 'iCab',
|
15722 | 'Iceweasel',
|
15723 | 'K-Meleon',
|
15724 | 'Konqueror',
|
15725 | 'Lunascape',
|
15726 | 'Maxthon',
|
15727 | { 'label': 'Microsoft Edge', 'pattern': 'Edge' },
|
15728 | 'Midori',
|
15729 | 'Nook Browser',
|
15730 | 'PaleMoon',
|
15731 | 'PhantomJS',
|
15732 | 'Raven',
|
15733 | 'Rekonq',
|
15734 | 'RockMelt',
|
15735 | { 'label': 'Samsung Internet', 'pattern': 'SamsungBrowser' },
|
15736 | 'SeaMonkey',
|
15737 | { 'label': 'Silk', 'pattern': '(?:Cloud9|Silk-Accelerated)' },
|
15738 | 'Sleipnir',
|
15739 | 'SlimBrowser',
|
15740 | { 'label': 'SRWare Iron', 'pattern': 'Iron' },
|
15741 | 'Sunrise',
|
15742 | 'Swiftfox',
|
15743 | 'Waterfox',
|
15744 | 'WebPositive',
|
15745 | 'Opera Mini',
|
15746 | { 'label': 'Opera Mini', 'pattern': 'OPiOS' },
|
15747 | 'Opera',
|
15748 | { 'label': 'Opera', 'pattern': 'OPR' },
|
15749 | 'Chrome',
|
15750 | { 'label': 'Chrome Mobile', 'pattern': '(?:CriOS|CrMo)' },
|
15751 | { 'label': 'Firefox', 'pattern': '(?:Firefox|Minefield)' },
|
15752 | { 'label': 'Firefox for iOS', 'pattern': 'FxiOS' },
|
15753 | { 'label': 'IE', 'pattern': 'IEMobile' },
|
15754 | { 'label': 'IE', 'pattern': 'MSIE' },
|
15755 | 'Safari'
|
15756 | ]);
|
15757 |
|
15758 |
|
15759 | var product = getProduct([
|
15760 | { 'label': 'BlackBerry', 'pattern': 'BB10' },
|
15761 | 'BlackBerry',
|
15762 | { 'label': 'Galaxy S', 'pattern': 'GT-I9000' },
|
15763 | { 'label': 'Galaxy S2', 'pattern': 'GT-I9100' },
|
15764 | { 'label': 'Galaxy S3', 'pattern': 'GT-I9300' },
|
15765 | { 'label': 'Galaxy S4', 'pattern': 'GT-I9500' },
|
15766 | { 'label': 'Galaxy S5', 'pattern': 'SM-G900' },
|
15767 | { 'label': 'Galaxy S6', 'pattern': 'SM-G920' },
|
15768 | { 'label': 'Galaxy S6 Edge', 'pattern': 'SM-G925' },
|
15769 | { 'label': 'Galaxy S7', 'pattern': 'SM-G930' },
|
15770 | { 'label': 'Galaxy S7 Edge', 'pattern': 'SM-G935' },
|
15771 | 'Google TV',
|
15772 | 'Lumia',
|
15773 | 'iPad',
|
15774 | 'iPod',
|
15775 | 'iPhone',
|
15776 | 'Kindle',
|
15777 | { 'label': 'Kindle Fire', 'pattern': '(?:Cloud9|Silk-Accelerated)' },
|
15778 | 'Nexus',
|
15779 | 'Nook',
|
15780 | 'PlayBook',
|
15781 | 'PlayStation Vita',
|
15782 | 'PlayStation',
|
15783 | 'TouchPad',
|
15784 | 'Transformer',
|
15785 | { 'label': 'Wii U', 'pattern': 'WiiU' },
|
15786 | 'Wii',
|
15787 | 'Xbox One',
|
15788 | { 'label': 'Xbox 360', 'pattern': 'Xbox' },
|
15789 | 'Xoom'
|
15790 | ]);
|
15791 |
|
15792 |
|
15793 | var manufacturer = getManufacturer({
|
15794 | 'Apple': { 'iPad': 1, 'iPhone': 1, 'iPod': 1 },
|
15795 | 'Archos': {},
|
15796 | 'Amazon': { 'Kindle': 1, 'Kindle Fire': 1 },
|
15797 | 'Asus': { 'Transformer': 1 },
|
15798 | 'Barnes & Noble': { 'Nook': 1 },
|
15799 | 'BlackBerry': { 'PlayBook': 1 },
|
15800 | 'Google': { 'Google TV': 1, 'Nexus': 1 },
|
15801 | 'HP': { 'TouchPad': 1 },
|
15802 | 'HTC': {},
|
15803 | 'LG': {},
|
15804 | 'Microsoft': { 'Xbox': 1, 'Xbox One': 1 },
|
15805 | 'Motorola': { 'Xoom': 1 },
|
15806 | 'Nintendo': { 'Wii U': 1, 'Wii': 1 },
|
15807 | 'Nokia': { 'Lumia': 1 },
|
15808 | 'Samsung': { 'Galaxy S': 1, 'Galaxy S2': 1, 'Galaxy S3': 1, 'Galaxy S4': 1 },
|
15809 | 'Sony': { 'PlayStation': 1, 'PlayStation Vita': 1 }
|
15810 | });
|
15811 |
|
15812 |
|
15813 | var os = getOS([
|
15814 | 'Windows Phone',
|
15815 | 'Android',
|
15816 | 'CentOS',
|
15817 | { 'label': 'Chrome OS', 'pattern': 'CrOS' },
|
15818 | 'Debian',
|
15819 | 'Fedora',
|
15820 | 'FreeBSD',
|
15821 | 'Gentoo',
|
15822 | 'Haiku',
|
15823 | 'Kubuntu',
|
15824 | 'Linux Mint',
|
15825 | 'OpenBSD',
|
15826 | 'Red Hat',
|
15827 | 'SuSE',
|
15828 | 'Ubuntu',
|
15829 | 'Xubuntu',
|
15830 | 'Cygwin',
|
15831 | 'Symbian OS',
|
15832 | 'hpwOS',
|
15833 | 'webOS ',
|
15834 | 'webOS',
|
15835 | 'Tablet OS',
|
15836 | 'Tizen',
|
15837 | 'Linux',
|
15838 | 'Mac OS X',
|
15839 | 'Macintosh',
|
15840 | 'Mac',
|
15841 | 'Windows 98;',
|
15842 | 'Windows '
|
15843 | ]);
|
15844 |
|
15845 |
|
15846 |
|
15847 | |
15848 |
|
15849 |
|
15850 |
|
15851 |
|
15852 |
|
15853 |
|
15854 | function getLayout(guesses) {
|
15855 | return reduce(guesses, function(result, guess) {
|
15856 | return result || RegExp('\\b' + (
|
15857 | guess.pattern || qualify(guess)
|
15858 | ) + '\\b', 'i').exec(ua) && (guess.label || guess);
|
15859 | });
|
15860 | }
|
15861 |
|
15862 | |
15863 |
|
15864 |
|
15865 |
|
15866 |
|
15867 |
|
15868 |
|
15869 | function getManufacturer(guesses) {
|
15870 | return reduce(guesses, function(result, value, key) {
|
15871 |
|
15872 | return result || (
|
15873 | value[product] ||
|
15874 | value[/^[a-z]+(?: +[a-z]+\b)*/i.exec(product)] ||
|
15875 | RegExp('\\b' + qualify(key) + '(?:\\b|\\w*\\d)', 'i').exec(ua)
|
15876 | ) && key;
|
15877 | });
|
15878 | }
|
15879 |
|
15880 | |
15881 |
|
15882 |
|
15883 |
|
15884 |
|
15885 |
|
15886 |
|
15887 | function getName(guesses) {
|
15888 | return reduce(guesses, function(result, guess) {
|
15889 | return result || RegExp('\\b' + (
|
15890 | guess.pattern || qualify(guess)
|
15891 | ) + '\\b', 'i').exec(ua) && (guess.label || guess);
|
15892 | });
|
15893 | }
|
15894 |
|
15895 | |
15896 |
|
15897 |
|
15898 |
|
15899 |
|
15900 |
|
15901 |
|
15902 | function getOS(guesses) {
|
15903 | return reduce(guesses, function(result, guess) {
|
15904 | var pattern = guess.pattern || qualify(guess);
|
15905 | if (!result && (result =
|
15906 | RegExp('\\b' + pattern + '(?:/[\\d.]+|[ \\w.]*)', 'i').exec(ua)
|
15907 | )) {
|
15908 | result = cleanupOS(result, pattern, guess.label || guess);
|
15909 | }
|
15910 | return result;
|
15911 | });
|
15912 | }
|
15913 |
|
15914 | |
15915 |
|
15916 |
|
15917 |
|
15918 |
|
15919 |
|
15920 |
|
15921 | function getProduct(guesses) {
|
15922 | return reduce(guesses, function(result, guess) {
|
15923 | var pattern = guess.pattern || qualify(guess);
|
15924 | if (!result && (result =
|
15925 | RegExp('\\b' + pattern + ' *\\d+[.\\w_]*', 'i').exec(ua) ||
|
15926 | RegExp('\\b' + pattern + ' *\\w+-[\\w]*', 'i').exec(ua) ||
|
15927 | RegExp('\\b' + pattern + '(?:; *(?:[a-z]+[_-])?[a-z]+\\d+|[^ ();-]*)', 'i').exec(ua)
|
15928 | )) {
|
15929 |
|
15930 | if ((result = String((guess.label && !RegExp(pattern, 'i').test(guess.label)) ? guess.label : result).split('/'))[1] && !/[\d.]+/.test(result[0])) {
|
15931 | result[0] += ' ' + result[1];
|
15932 | }
|
15933 |
|
15934 | guess = guess.label || guess;
|
15935 | result = format(result[0]
|
15936 | .replace(RegExp(pattern, 'i'), guess)
|
15937 | .replace(RegExp('; *(?:' + guess + '[_-])?', 'i'), ' ')
|
15938 | .replace(RegExp('(' + guess + ')[-_.]?(\\w)', 'i'), '$1 $2'));
|
15939 | }
|
15940 | return result;
|
15941 | });
|
15942 | }
|
15943 |
|
15944 | |
15945 |
|
15946 |
|
15947 |
|
15948 |
|
15949 |
|
15950 |
|
15951 | function getVersion(patterns) {
|
15952 | return reduce(patterns, function(result, pattern) {
|
15953 | return result || (RegExp(pattern +
|
15954 | '(?:-[\\d.]+/|(?: for [\\w-]+)?[ /-])([\\d.]+[^ ();/_-]*)', 'i').exec(ua) || 0)[1] || null;
|
15955 | });
|
15956 | }
|
15957 |
|
15958 | |
15959 |
|
15960 |
|
15961 |
|
15962 |
|
15963 |
|
15964 |
|
15965 | function toStringPlatform() {
|
15966 | return this.description || '';
|
15967 | }
|
15968 |
|
15969 |
|
15970 |
|
15971 |
|
15972 | layout && (layout = [layout]);
|
15973 |
|
15974 |
|
15975 | if (manufacturer && !product) {
|
15976 | product = getProduct([manufacturer]);
|
15977 | }
|
15978 |
|
15979 | if ((data = /\bGoogle TV\b/.exec(product))) {
|
15980 | product = data[0];
|
15981 | }
|
15982 |
|
15983 | if (/\bSimulator\b/i.test(ua)) {
|
15984 | product = (product ? product + ' ' : '') + 'Simulator';
|
15985 | }
|
15986 |
|
15987 | if (name == 'Opera Mini' && /\bOPiOS\b/.test(ua)) {
|
15988 | description.push('running in Turbo/Uncompressed mode');
|
15989 | }
|
15990 |
|
15991 | if (name == 'IE' && /\blike iPhone OS\b/.test(ua)) {
|
15992 | data = parse(ua.replace(/like iPhone OS/, ''));
|
15993 | manufacturer = data.manufacturer;
|
15994 | product = data.product;
|
15995 | }
|
15996 |
|
15997 | else if (/^iP/.test(product)) {
|
15998 | name || (name = 'Safari');
|
15999 | os = 'iOS' + ((data = / OS ([\d_]+)/i.exec(ua))
|
16000 | ? ' ' + data[1].replace(/_/g, '.')
|
16001 | : '');
|
16002 | }
|
16003 |
|
16004 | else if (name == 'Konqueror' && !/buntu/i.test(os)) {
|
16005 | os = 'Kubuntu';
|
16006 | }
|
16007 |
|
16008 | else if ((manufacturer && manufacturer != 'Google' &&
|
16009 | ((/Chrome/.test(name) && !/\bMobile Safari\b/i.test(ua)) || /\bVita\b/.test(product))) ||
|
16010 | (/\bAndroid\b/.test(os) && /^Chrome/.test(name) && /\bVersion\//i.test(ua))) {
|
16011 | name = 'Android Browser';
|
16012 | os = /\bAndroid\b/.test(os) ? os : 'Android';
|
16013 | }
|
16014 |
|
16015 | else if (name == 'Silk') {
|
16016 | if (!/\bMobi/i.test(ua)) {
|
16017 | os = 'Android';
|
16018 | description.unshift('desktop mode');
|
16019 | }
|
16020 | if (/Accelerated *= *true/i.test(ua)) {
|
16021 | description.unshift('accelerated');
|
16022 | }
|
16023 | }
|
16024 |
|
16025 | else if (name == 'PaleMoon' && (data = /\bFirefox\/([\d.]+)\b/.exec(ua))) {
|
16026 | description.push('identifying as Firefox ' + data[1]);
|
16027 | }
|
16028 |
|
16029 | else if (name == 'Firefox' && (data = /\b(Mobile|Tablet|TV)\b/i.exec(ua))) {
|
16030 | os || (os = 'Firefox OS');
|
16031 | product || (product = data[1]);
|
16032 | }
|
16033 |
|
16034 | else if (!name || (data = !/\bMinefield\b/i.test(ua) && /\b(?:Firefox|Safari)\b/.exec(name))) {
|
16035 |
|
16036 | if (name && !product && /[\/,]|^[^(]+?\)/.test(ua.slice(ua.indexOf(data + '/') + 8))) {
|
16037 |
|
16038 | name = null;
|
16039 | }
|
16040 |
|
16041 | if ((data = product || manufacturer || os) &&
|
16042 | (product || manufacturer || /\b(?:Android|Symbian OS|Tablet OS|webOS)\b/.test(os))) {
|
16043 | name = /[a-z]+(?: Hat)?/i.exec(/\bAndroid\b/.test(os) ? os : data) + ' Browser';
|
16044 | }
|
16045 | }
|
16046 |
|
16047 | else if (name == 'Electron' && (data = (/\bChrome\/([\d.]+)\b/.exec(ua) || 0)[1])) {
|
16048 | description.push('Chromium ' + data);
|
16049 | }
|
16050 |
|
16051 | if (!version) {
|
16052 | version = getVersion([
|
16053 | '(?:Cloud9|CriOS|CrMo|Edge|FxiOS|IEMobile|Iron|Opera ?Mini|OPiOS|OPR|Raven|SamsungBrowser|Silk(?!/[\\d.]+$))',
|
16054 | 'Version',
|
16055 | qualify(name),
|
16056 | '(?:Firefox|Minefield|NetFront)'
|
16057 | ]);
|
16058 | }
|
16059 |
|
16060 | if ((data =
|
16061 | layout == 'iCab' && parseFloat(version) > 3 && 'WebKit' ||
|
16062 | /\bOpera\b/.test(name) && (/\bOPR\b/.test(ua) ? 'Blink' : 'Presto') ||
|
16063 | /\b(?:Midori|Nook|Safari)\b/i.test(ua) && !/^(?:Trident|EdgeHTML)$/.test(layout) && 'WebKit' ||
|
16064 | !layout && /\bMSIE\b/i.test(ua) && (os == 'Mac OS' ? 'Tasman' : 'Trident') ||
|
16065 | layout == 'WebKit' && /\bPlayStation\b(?! Vita\b)/i.test(name) && 'NetFront'
|
16066 | )) {
|
16067 | layout = [data];
|
16068 | }
|
16069 |
|
16070 | if (name == 'IE' && (data = (/; *(?:XBLWP|ZuneWP)(\d+)/i.exec(ua) || 0)[1])) {
|
16071 | name += ' Mobile';
|
16072 | os = 'Windows Phone ' + (/\+$/.test(data) ? data : data + '.x');
|
16073 | description.unshift('desktop mode');
|
16074 | }
|
16075 |
|
16076 | else if (/\bWPDesktop\b/i.test(ua)) {
|
16077 | name = 'IE Mobile';
|
16078 | os = 'Windows Phone 8.x';
|
16079 | description.unshift('desktop mode');
|
16080 | version || (version = (/\brv:([\d.]+)/.exec(ua) || 0)[1]);
|
16081 | }
|
16082 |
|
16083 | else if (name != 'IE' && layout == 'Trident' && (data = /\brv:([\d.]+)/.exec(ua))) {
|
16084 | if (name) {
|
16085 | description.push('identifying as ' + name + (version ? ' ' + version : ''));
|
16086 | }
|
16087 | name = 'IE';
|
16088 | version = data[1];
|
16089 | }
|
16090 |
|
16091 | if (useFeatures) {
|
16092 |
|
16093 |
|
16094 | if (isHostType(context, 'global')) {
|
16095 | if (java) {
|
16096 | data = java.lang.System;
|
16097 | arch = data.getProperty('os.arch');
|
16098 | os = os || data.getProperty('os.name') + ' ' + data.getProperty('os.version');
|
16099 | }
|
16100 | if (rhino) {
|
16101 | try {
|
16102 | version = context.require('ringo/engine').version.join('.');
|
16103 | name = 'RingoJS';
|
16104 | } catch(e) {
|
16105 | if ((data = context.system) && data.global.system == context.system) {
|
16106 | name = 'Narwhal';
|
16107 | os || (os = data[0].os || null);
|
16108 | }
|
16109 | }
|
16110 | if (!name) {
|
16111 | name = 'Rhino';
|
16112 | }
|
16113 | }
|
16114 | else if (
|
16115 | typeof context.process == 'object' && !context.process.browser &&
|
16116 | (data = context.process)
|
16117 | ) {
|
16118 | if (typeof data.versions == 'object') {
|
16119 | if (typeof data.versions.electron == 'string') {
|
16120 | description.push('Node ' + data.versions.node);
|
16121 | name = 'Electron';
|
16122 | version = data.versions.electron;
|
16123 | } else if (typeof data.versions.nw == 'string') {
|
16124 | description.push('Chromium ' + version, 'Node ' + data.versions.node);
|
16125 | name = 'NW.js';
|
16126 | version = data.versions.nw;
|
16127 | }
|
16128 | }
|
16129 | if (!name) {
|
16130 | name = 'Node.js';
|
16131 | arch = data.arch;
|
16132 | os = data.platform;
|
16133 | version = /[\d.]+/.exec(data.version);
|
16134 | version = version ? version[0] : null;
|
16135 | }
|
16136 | }
|
16137 | }
|
16138 |
|
16139 | else if (getClassOf((data = context.runtime)) == airRuntimeClass) {
|
16140 | name = 'Adobe AIR';
|
16141 | os = data.flash.system.Capabilities.os;
|
16142 | }
|
16143 |
|
16144 | else if (getClassOf((data = context.phantom)) == phantomClass) {
|
16145 | name = 'PhantomJS';
|
16146 | version = (data = data.version || null) && (data.major + '.' + data.minor + '.' + data.patch);
|
16147 | }
|
16148 |
|
16149 | else if (typeof doc.documentMode == 'number' && (data = /\bTrident\/(\d+)/i.exec(ua))) {
|
16150 |
|
16151 |
|
16152 | version = [version, doc.documentMode];
|
16153 | if ((data = +data[1] + 4) != version[1]) {
|
16154 | description.push('IE ' + version[1] + ' mode');
|
16155 | layout && (layout[1] = '');
|
16156 | version[1] = data;
|
16157 | }
|
16158 | version = name == 'IE' ? String(version[1].toFixed(1)) : version[0];
|
16159 | }
|
16160 |
|
16161 | else if (typeof doc.documentMode == 'number' && /^(?:Chrome|Firefox)\b/.test(name)) {
|
16162 | description.push('masking as ' + name + ' ' + version);
|
16163 | name = 'IE';
|
16164 | version = '11.0';
|
16165 | layout = ['Trident'];
|
16166 | os = 'Windows';
|
16167 | }
|
16168 | os = os && format(os);
|
16169 | }
|
16170 |
|
16171 | if (version && (data =
|
16172 | /(?:[ab]|dp|pre|[ab]\d+pre)(?:\d+\+?)?$/i.exec(version) ||
|
16173 | /(?:alpha|beta)(?: ?\d)?/i.exec(ua + ';' + (useFeatures && nav.appMinorVersion)) ||
|
16174 | /\bMinefield\b/i.test(ua) && 'a'
|
16175 | )) {
|
16176 | prerelease = /b/i.test(data) ? 'beta' : 'alpha';
|
16177 | version = version.replace(RegExp(data + '\\+?$'), '') +
|
16178 | (prerelease == 'beta' ? beta : alpha) + (/\d+\+?/.exec(data) || '');
|
16179 | }
|
16180 |
|
16181 | if (name == 'Fennec' || name == 'Firefox' && /\b(?:Android|Firefox OS)\b/.test(os)) {
|
16182 | name = 'Firefox Mobile';
|
16183 | }
|
16184 |
|
16185 | else if (name == 'Maxthon' && version) {
|
16186 | version = version.replace(/\.[\d.]+/, '.x');
|
16187 | }
|
16188 |
|
16189 | else if (/\bXbox\b/i.test(product)) {
|
16190 | if (product == 'Xbox 360') {
|
16191 | os = null;
|
16192 | }
|
16193 | if (product == 'Xbox 360' && /\bIEMobile\b/.test(ua)) {
|
16194 | description.unshift('mobile mode');
|
16195 | }
|
16196 | }
|
16197 |
|
16198 | else if ((/^(?:Chrome|IE|Opera)$/.test(name) || name && !product && !/Browser|Mobi/.test(name)) &&
|
16199 | (os == 'Windows CE' || /Mobi/i.test(ua))) {
|
16200 | name += ' Mobile';
|
16201 | }
|
16202 |
|
16203 | else if (name == 'IE' && useFeatures) {
|
16204 | try {
|
16205 | if (context.external === null) {
|
16206 | description.unshift('platform preview');
|
16207 | }
|
16208 | } catch(e) {
|
16209 | description.unshift('embedded');
|
16210 | }
|
16211 | }
|
16212 |
|
16213 |
|
16214 | else if ((/\bBlackBerry\b/.test(product) || /\bBB10\b/.test(ua)) && (data =
|
16215 | (RegExp(product.replace(/ +/g, ' *') + '/([.\\d]+)', 'i').exec(ua) || 0)[1] ||
|
16216 | version
|
16217 | )) {
|
16218 | data = [data, /BB10/.test(ua)];
|
16219 | os = (data[1] ? (product = null, manufacturer = 'BlackBerry') : 'Device Software') + ' ' + data[0];
|
16220 | version = null;
|
16221 | }
|
16222 |
|
16223 |
|
16224 | else if (this != forOwn && product != 'Wii' && (
|
16225 | (useFeatures && opera) ||
|
16226 | (/Opera/.test(name) && /\b(?:MSIE|Firefox)\b/i.test(ua)) ||
|
16227 | (name == 'Firefox' && /\bOS X (?:\d+\.){2,}/.test(os)) ||
|
16228 | (name == 'IE' && (
|
16229 | (os && !/^Win/.test(os) && version > 5.5) ||
|
16230 | /\bWindows XP\b/.test(os) && version > 8 ||
|
16231 | version == 8 && !/\bTrident\b/.test(ua)
|
16232 | ))
|
16233 | ) && !reOpera.test((data = parse.call(forOwn, ua.replace(reOpera, '') + ';'))) && data.name) {
|
16234 |
|
16235 | data = 'ing as ' + data.name + ((data = data.version) ? ' ' + data : '');
|
16236 | if (reOpera.test(name)) {
|
16237 | if (/\bIE\b/.test(data) && os == 'Mac OS') {
|
16238 | os = null;
|
16239 | }
|
16240 | data = 'identify' + data;
|
16241 | }
|
16242 |
|
16243 | else {
|
16244 | data = 'mask' + data;
|
16245 | if (operaClass) {
|
16246 | name = format(operaClass.replace(/([a-z])([A-Z])/g, '$1 $2'));
|
16247 | } else {
|
16248 | name = 'Opera';
|
16249 | }
|
16250 | if (/\bIE\b/.test(data)) {
|
16251 | os = null;
|
16252 | }
|
16253 | if (!useFeatures) {
|
16254 | version = null;
|
16255 | }
|
16256 | }
|
16257 | layout = ['Presto'];
|
16258 | description.push(data);
|
16259 | }
|
16260 |
|
16261 | if ((data = (/\bAppleWebKit\/([\d.]+\+?)/i.exec(ua) || 0)[1])) {
|
16262 |
|
16263 |
|
16264 | data = [parseFloat(data.replace(/\.(\d)$/, '.0$1')), data];
|
16265 |
|
16266 | if (name == 'Safari' && data[1].slice(-1) == '+') {
|
16267 | name = 'WebKit Nightly';
|
16268 | prerelease = 'alpha';
|
16269 | version = data[1].slice(0, -1);
|
16270 | }
|
16271 |
|
16272 | else if (version == data[1] ||
|
16273 | version == (data[2] = (/\bSafari\/([\d.]+\+?)/i.exec(ua) || 0)[1])) {
|
16274 | version = null;
|
16275 | }
|
16276 |
|
16277 | data[1] = (/\bChrome\/([\d.]+)/i.exec(ua) || 0)[1];
|
16278 |
|
16279 | if (data[0] == 537.36 && data[2] == 537.36 && parseFloat(data[1]) >= 28 && layout == 'WebKit') {
|
16280 | layout = ['Blink'];
|
16281 | }
|
16282 |
|
16283 |
|
16284 | if (!useFeatures || (!likeChrome && !data[1])) {
|
16285 | layout && (layout[1] = 'like Safari');
|
16286 | 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');
|
16287 | } else {
|
16288 | layout && (layout[1] = 'like Chrome');
|
16289 | 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');
|
16290 | }
|
16291 |
|
16292 | layout && (layout[1] += ' ' + (data += typeof data == 'number' ? '.x' : /[.+]/.test(data) ? '' : '+'));
|
16293 |
|
16294 | if (name == 'Safari' && (!version || parseInt(version) > 45)) {
|
16295 | version = data;
|
16296 | }
|
16297 | }
|
16298 |
|
16299 | if (name == 'Opera' && (data = /\bzbov|zvav$/.exec(os))) {
|
16300 | name += ' ';
|
16301 | description.unshift('desktop mode');
|
16302 | if (data == 'zvav') {
|
16303 | name += 'Mini';
|
16304 | version = null;
|
16305 | } else {
|
16306 | name += 'Mobile';
|
16307 | }
|
16308 | os = os.replace(RegExp(' *' + data + '$'), '');
|
16309 | }
|
16310 |
|
16311 | else if (name == 'Safari' && /\bChrome\b/.exec(layout && layout[1])) {
|
16312 | description.unshift('desktop mode');
|
16313 | name = 'Chrome Mobile';
|
16314 | version = null;
|
16315 |
|
16316 | if (/\bOS X\b/.test(os)) {
|
16317 | manufacturer = 'Apple';
|
16318 | os = 'iOS 4.3+';
|
16319 | } else {
|
16320 | os = null;
|
16321 | }
|
16322 | }
|
16323 |
|
16324 | if (version && version.indexOf((data = /[\d.]+$/.exec(os))) == 0 &&
|
16325 | ua.indexOf('/' + data + '-') > -1) {
|
16326 | os = trim(os.replace(data, ''));
|
16327 | }
|
16328 |
|
16329 | if (layout && !/\b(?:Avant|Nook)\b/.test(name) && (
|
16330 | /Browser|Lunascape|Maxthon/.test(name) ||
|
16331 | name != 'Safari' && /^iOS/.test(os) && /\bSafari\b/.test(layout[1]) ||
|
16332 | /^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Samsung Internet|Sleipnir|Web)/.test(name) && layout[1])) {
|
16333 |
|
16334 | (data = layout[layout.length - 1]) && description.push(data);
|
16335 | }
|
16336 |
|
16337 | if (description.length) {
|
16338 | description = ['(' + description.join('; ') + ')'];
|
16339 | }
|
16340 |
|
16341 | if (manufacturer && product && product.indexOf(manufacturer) < 0) {
|
16342 | description.push('on ' + manufacturer);
|
16343 | }
|
16344 |
|
16345 | if (product) {
|
16346 | description.push((/^on /.test(description[description.length - 1]) ? '' : 'on ') + product);
|
16347 | }
|
16348 |
|
16349 | if (os) {
|
16350 | data = / ([\d.+]+)$/.exec(os);
|
16351 | isSpecialCasedOS = data && os.charAt(os.length - data[0].length - 1) == '/';
|
16352 | os = {
|
16353 | 'architecture': 32,
|
16354 | 'family': (data && !isSpecialCasedOS) ? os.replace(data[0], '') : os,
|
16355 | 'version': data ? data[1] : null,
|
16356 | 'toString': function() {
|
16357 | var version = this.version;
|
16358 | return this.family + ((version && !isSpecialCasedOS) ? ' ' + version : '') + (this.architecture == 64 ? ' 64-bit' : '');
|
16359 | }
|
16360 | };
|
16361 | }
|
16362 |
|
16363 | if ((data = /\b(?:AMD|IA|Win|WOW|x86_|x)64\b/i.exec(arch)) && !/\bi686\b/i.test(arch)) {
|
16364 | if (os) {
|
16365 | os.architecture = 64;
|
16366 | os.family = os.family.replace(RegExp(' *' + data), '');
|
16367 | }
|
16368 | if (
|
16369 | name && (/\bWOW64\b/i.test(ua) ||
|
16370 | (useFeatures && /\w(?:86|32)$/.test(nav.cpuClass || nav.platform) && !/\bWin64; x64\b/i.test(ua)))
|
16371 | ) {
|
16372 | description.unshift('32-bit');
|
16373 | }
|
16374 | }
|
16375 |
|
16376 | else if (
|
16377 | os && /^OS X/.test(os.family) &&
|
16378 | name == 'Chrome' && parseFloat(version) >= 39
|
16379 | ) {
|
16380 | os.architecture = 64;
|
16381 | }
|
16382 |
|
16383 | ua || (ua = null);
|
16384 |
|
16385 |
|
16386 |
|
16387 | |
16388 |
|
16389 |
|
16390 |
|
16391 |
|
16392 |
|
16393 | var platform = {};
|
16394 |
|
16395 | |
16396 |
|
16397 |
|
16398 |
|
16399 |
|
16400 |
|
16401 | platform.description = ua;
|
16402 |
|
16403 | |
16404 |
|
16405 |
|
16406 |
|
16407 |
|
16408 |
|
16409 |
|
16410 |
|
16411 |
|
16412 | platform.layout = layout && layout[0];
|
16413 |
|
16414 | |
16415 |
|
16416 |
|
16417 |
|
16418 |
|
16419 |
|
16420 |
|
16421 |
|
16422 |
|
16423 |
|
16424 |
|
16425 | platform.manufacturer = manufacturer;
|
16426 |
|
16427 | |
16428 |
|
16429 |
|
16430 |
|
16431 |
|
16432 |
|
16433 |
|
16434 |
|
16435 |
|
16436 |
|
16437 |
|
16438 |
|
16439 |
|
16440 |
|
16441 | platform.name = name;
|
16442 |
|
16443 | |
16444 |
|
16445 |
|
16446 |
|
16447 |
|
16448 |
|
16449 | platform.prerelease = prerelease;
|
16450 |
|
16451 | |
16452 |
|
16453 |
|
16454 |
|
16455 |
|
16456 |
|
16457 |
|
16458 |
|
16459 |
|
16460 |
|
16461 |
|
16462 | platform.product = product;
|
16463 |
|
16464 | |
16465 |
|
16466 |
|
16467 |
|
16468 |
|
16469 |
|
16470 | platform.ua = ua;
|
16471 |
|
16472 | |
16473 |
|
16474 |
|
16475 |
|
16476 |
|
16477 |
|
16478 | platform.version = name && version;
|
16479 |
|
16480 | |
16481 |
|
16482 |
|
16483 |
|
16484 |
|
16485 |
|
16486 | platform.os = os || {
|
16487 |
|
16488 | |
16489 |
|
16490 |
|
16491 |
|
16492 |
|
16493 |
|
16494 | 'architecture': null,
|
16495 |
|
16496 | |
16497 |
|
16498 |
|
16499 |
|
16500 |
|
16501 |
|
16502 |
|
16503 |
|
16504 |
|
16505 |
|
16506 |
|
16507 | 'family': null,
|
16508 |
|
16509 | |
16510 |
|
16511 |
|
16512 |
|
16513 |
|
16514 |
|
16515 | 'version': null,
|
16516 |
|
16517 | |
16518 |
|
16519 |
|
16520 |
|
16521 |
|
16522 |
|
16523 | 'toString': function() { return 'null'; }
|
16524 | };
|
16525 |
|
16526 | platform.parse = parse;
|
16527 | platform.toString = toStringPlatform;
|
16528 |
|
16529 | if (platform.version) {
|
16530 | description.unshift(version);
|
16531 | }
|
16532 | if (platform.name) {
|
16533 | description.unshift(name);
|
16534 | }
|
16535 | if (os && name && !(os == String(os).split(' ')[0] && (os == name.split(' ')[0] || product))) {
|
16536 | description.push(product ? '(' + os + ')' : 'on ' + os);
|
16537 | }
|
16538 | if (description.length) {
|
16539 | platform.description = description.join(' ');
|
16540 | }
|
16541 | return platform;
|
16542 | }
|
16543 |
|
16544 |
|
16545 |
|
16546 |
|
16547 | var platform = parse();
|
16548 |
|
16549 |
|
16550 | if (typeof define == 'function' && typeof define.amd == 'object' && define.amd) {
|
16551 |
|
16552 |
|
16553 |
|
16554 | root.platform = platform;
|
16555 |
|
16556 |
|
16557 | define(function() {
|
16558 | return platform;
|
16559 | });
|
16560 | }
|
16561 |
|
16562 | else if (freeExports && freeModule) {
|
16563 |
|
16564 | forOwn(platform, function(value, key) {
|
16565 | freeExports[key] = value;
|
16566 | });
|
16567 | }
|
16568 | else {
|
16569 |
|
16570 | root.platform = platform;
|
16571 | }
|
16572 | }.call(this));
|
16573 |
|
16574 | }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
16575 | },{}],248:[function(require,module,exports){
|
16576 | (function (process){
|
16577 | 'use strict';
|
16578 |
|
16579 | if (!process.version ||
|
16580 | process.version.indexOf('v0.') === 0 ||
|
16581 | process.version.indexOf('v1.') === 0 && process.version.indexOf('v1.8.') !== 0) {
|
16582 | module.exports = { nextTick: nextTick };
|
16583 | } else {
|
16584 | module.exports = process
|
16585 | }
|
16586 |
|
16587 | function nextTick(fn, arg1, arg2, arg3) {
|
16588 | if (typeof fn !== 'function') {
|
16589 | throw new TypeError('"callback" argument must be a function');
|
16590 | }
|
16591 | var len = arguments.length;
|
16592 | var args, i;
|
16593 | switch (len) {
|
16594 | case 0:
|
16595 | case 1:
|
16596 | return process.nextTick(fn);
|
16597 | case 2:
|
16598 | return process.nextTick(function afterTickOne() {
|
16599 | fn.call(null, arg1);
|
16600 | });
|
16601 | case 3:
|
16602 | return process.nextTick(function afterTickTwo() {
|
16603 | fn.call(null, arg1, arg2);
|
16604 | });
|
16605 | case 4:
|
16606 | return process.nextTick(function afterTickThree() {
|
16607 | fn.call(null, arg1, arg2, arg3);
|
16608 | });
|
16609 | default:
|
16610 | args = new Array(len - 1);
|
16611 | i = 0;
|
16612 | while (i < args.length) {
|
16613 | args[i++] = arguments[i];
|
16614 | }
|
16615 | return process.nextTick(function afterTick() {
|
16616 | fn.apply(null, args);
|
16617 | });
|
16618 | }
|
16619 | }
|
16620 |
|
16621 |
|
16622 | }).call(this,require('_process'))
|
16623 | },{"_process":249}],249:[function(require,module,exports){
|
16624 |
|
16625 | var process = module.exports = {};
|
16626 |
|
16627 |
|
16628 |
|
16629 |
|
16630 |
|
16631 |
|
16632 | var cachedSetTimeout;
|
16633 | var cachedClearTimeout;
|
16634 |
|
16635 | function defaultSetTimout() {
|
16636 | throw new Error('setTimeout has not been defined');
|
16637 | }
|
16638 | function defaultClearTimeout () {
|
16639 | throw new Error('clearTimeout has not been defined');
|
16640 | }
|
16641 | (function () {
|
16642 | try {
|
16643 | if (typeof setTimeout === 'function') {
|
16644 | cachedSetTimeout = setTimeout;
|
16645 | } else {
|
16646 | cachedSetTimeout = defaultSetTimout;
|
16647 | }
|
16648 | } catch (e) {
|
16649 | cachedSetTimeout = defaultSetTimout;
|
16650 | }
|
16651 | try {
|
16652 | if (typeof clearTimeout === 'function') {
|
16653 | cachedClearTimeout = clearTimeout;
|
16654 | } else {
|
16655 | cachedClearTimeout = defaultClearTimeout;
|
16656 | }
|
16657 | } catch (e) {
|
16658 | cachedClearTimeout = defaultClearTimeout;
|
16659 | }
|
16660 | } ())
|
16661 | function runTimeout(fun) {
|
16662 | if (cachedSetTimeout === setTimeout) {
|
16663 |
|
16664 | return setTimeout(fun, 0);
|
16665 | }
|
16666 |
|
16667 | if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
|
16668 | cachedSetTimeout = setTimeout;
|
16669 | return setTimeout(fun, 0);
|
16670 | }
|
16671 | try {
|
16672 |
|
16673 | return cachedSetTimeout(fun, 0);
|
16674 | } catch(e){
|
16675 | try {
|
16676 |
|
16677 | return cachedSetTimeout.call(null, fun, 0);
|
16678 | } catch(e){
|
16679 |
|
16680 | return cachedSetTimeout.call(this, fun, 0);
|
16681 | }
|
16682 | }
|
16683 |
|
16684 |
|
16685 | }
|
16686 | function runClearTimeout(marker) {
|
16687 | if (cachedClearTimeout === clearTimeout) {
|
16688 |
|
16689 | return clearTimeout(marker);
|
16690 | }
|
16691 |
|
16692 | if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
|
16693 | cachedClearTimeout = clearTimeout;
|
16694 | return clearTimeout(marker);
|
16695 | }
|
16696 | try {
|
16697 |
|
16698 | return cachedClearTimeout(marker);
|
16699 | } catch (e){
|
16700 | try {
|
16701 |
|
16702 | return cachedClearTimeout.call(null, marker);
|
16703 | } catch (e){
|
16704 |
|
16705 |
|
16706 | return cachedClearTimeout.call(this, marker);
|
16707 | }
|
16708 | }
|
16709 |
|
16710 |
|
16711 |
|
16712 | }
|
16713 | var queue = [];
|
16714 | var draining = false;
|
16715 | var currentQueue;
|
16716 | var queueIndex = -1;
|
16717 |
|
16718 | function cleanUpNextTick() {
|
16719 | if (!draining || !currentQueue) {
|
16720 | return;
|
16721 | }
|
16722 | draining = false;
|
16723 | if (currentQueue.length) {
|
16724 | queue = currentQueue.concat(queue);
|
16725 | } else {
|
16726 | queueIndex = -1;
|
16727 | }
|
16728 | if (queue.length) {
|
16729 | drainQueue();
|
16730 | }
|
16731 | }
|
16732 |
|
16733 | function drainQueue() {
|
16734 | if (draining) {
|
16735 | return;
|
16736 | }
|
16737 | var timeout = runTimeout(cleanUpNextTick);
|
16738 | draining = true;
|
16739 |
|
16740 | var len = queue.length;
|
16741 | while(len) {
|
16742 | currentQueue = queue;
|
16743 | queue = [];
|
16744 | while (++queueIndex < len) {
|
16745 | if (currentQueue) {
|
16746 | currentQueue[queueIndex].run();
|
16747 | }
|
16748 | }
|
16749 | queueIndex = -1;
|
16750 | len = queue.length;
|
16751 | }
|
16752 | currentQueue = null;
|
16753 | draining = false;
|
16754 | runClearTimeout(timeout);
|
16755 | }
|
16756 |
|
16757 | process.nextTick = function (fun) {
|
16758 | var args = new Array(arguments.length - 1);
|
16759 | if (arguments.length > 1) {
|
16760 | for (var i = 1; i < arguments.length; i++) {
|
16761 | args[i - 1] = arguments[i];
|
16762 | }
|
16763 | }
|
16764 | queue.push(new Item(fun, args));
|
16765 | if (queue.length === 1 && !draining) {
|
16766 | runTimeout(drainQueue);
|
16767 | }
|
16768 | };
|
16769 |
|
16770 |
|
16771 | function Item(fun, array) {
|
16772 | this.fun = fun;
|
16773 | this.array = array;
|
16774 | }
|
16775 | Item.prototype.run = function () {
|
16776 | this.fun.apply(null, this.array);
|
16777 | };
|
16778 | process.title = 'browser';
|
16779 | process.browser = true;
|
16780 | process.env = {};
|
16781 | process.argv = [];
|
16782 | process.version = '';
|
16783 | process.versions = {};
|
16784 |
|
16785 | function noop() {}
|
16786 |
|
16787 | process.on = noop;
|
16788 | process.addListener = noop;
|
16789 | process.once = noop;
|
16790 | process.off = noop;
|
16791 | process.removeListener = noop;
|
16792 | process.removeAllListeners = noop;
|
16793 | process.emit = noop;
|
16794 | process.prependListener = noop;
|
16795 | process.prependOnceListener = noop;
|
16796 |
|
16797 | process.listeners = function (name) { return [] }
|
16798 |
|
16799 | process.binding = function (name) {
|
16800 | throw new Error('process.binding is not supported');
|
16801 | };
|
16802 |
|
16803 | process.cwd = function () { return '/' };
|
16804 | process.chdir = function (dir) {
|
16805 | throw new Error('process.chdir is not supported');
|
16806 | };
|
16807 | process.umask = function() { return 0; };
|
16808 |
|
16809 | },{}],250:[function(require,module,exports){
|
16810 | (function (global){
|
16811 |
|
16812 | ;(function(root) {
|
16813 |
|
16814 |
|
16815 | var freeExports = typeof exports == 'object' && exports &&
|
16816 | !exports.nodeType && exports;
|
16817 | var freeModule = typeof module == 'object' && module &&
|
16818 | !module.nodeType && module;
|
16819 | var freeGlobal = typeof global == 'object' && global;
|
16820 | if (
|
16821 | freeGlobal.global === freeGlobal ||
|
16822 | freeGlobal.window === freeGlobal ||
|
16823 | freeGlobal.self === freeGlobal
|
16824 | ) {
|
16825 | root = freeGlobal;
|
16826 | }
|
16827 |
|
16828 | |
16829 |
|
16830 |
|
16831 |
|
16832 |
|
16833 | var punycode,
|
16834 |
|
16835 |
|
16836 | maxInt = 2147483647,
|
16837 |
|
16838 |
|
16839 | base = 36,
|
16840 | tMin = 1,
|
16841 | tMax = 26,
|
16842 | skew = 38,
|
16843 | damp = 700,
|
16844 | initialBias = 72,
|
16845 | initialN = 128,
|
16846 | delimiter = '-',
|
16847 |
|
16848 |
|
16849 | regexPunycode = /^xn--/,
|
16850 | regexNonASCII = /[^\x20-\x7E]/,
|
16851 | regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g,
|
16852 |
|
16853 |
|
16854 | errors = {
|
16855 | 'overflow': 'Overflow: input needs wider integers to process',
|
16856 | 'not-basic': 'Illegal input >= 0x80 (not a basic code point)',
|
16857 | 'invalid-input': 'Invalid input'
|
16858 | },
|
16859 |
|
16860 |
|
16861 | baseMinusTMin = base - tMin,
|
16862 | floor = Math.floor,
|
16863 | stringFromCharCode = String.fromCharCode,
|
16864 |
|
16865 |
|
16866 | key;
|
16867 |
|
16868 |
|
16869 |
|
16870 | |
16871 |
|
16872 |
|
16873 |
|
16874 |
|
16875 |
|
16876 | function error(type) {
|
16877 | throw new RangeError(errors[type]);
|
16878 | }
|
16879 |
|
16880 | |
16881 |
|
16882 |
|
16883 |
|
16884 |
|
16885 |
|
16886 |
|
16887 |
|
16888 | function map(array, fn) {
|
16889 | var length = array.length;
|
16890 | var result = [];
|
16891 | while (length--) {
|
16892 | result[length] = fn(array[length]);
|
16893 | }
|
16894 | return result;
|
16895 | }
|
16896 |
|
16897 | |
16898 |
|
16899 |
|
16900 |
|
16901 |
|
16902 |
|
16903 |
|
16904 |
|
16905 |
|
16906 |
|
16907 | function mapDomain(string, fn) {
|
16908 | var parts = string.split('@');
|
16909 | var result = '';
|
16910 | if (parts.length > 1) {
|
16911 |
|
16912 |
|
16913 | result = parts[0] + '@';
|
16914 | string = parts[1];
|
16915 | }
|
16916 |
|
16917 | string = string.replace(regexSeparators, '\x2E');
|
16918 | var labels = string.split('.');
|
16919 | var encoded = map(labels, fn).join('.');
|
16920 | return result + encoded;
|
16921 | }
|
16922 |
|
16923 | |
16924 |
|
16925 |
|
16926 |
|
16927 |
|
16928 |
|
16929 |
|
16930 |
|
16931 |
|
16932 |
|
16933 |
|
16934 |
|
16935 |
|
16936 | function ucs2decode(string) {
|
16937 | var output = [],
|
16938 | counter = 0,
|
16939 | length = string.length,
|
16940 | value,
|
16941 | extra;
|
16942 | while (counter < length) {
|
16943 | value = string.charCodeAt(counter++);
|
16944 | if (value >= 0xD800 && value <= 0xDBFF && counter < length) {
|
16945 |
|
16946 | extra = string.charCodeAt(counter++);
|
16947 | if ((extra & 0xFC00) == 0xDC00) {
|
16948 | output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);
|
16949 | } else {
|
16950 |
|
16951 |
|
16952 | output.push(value);
|
16953 | counter--;
|
16954 | }
|
16955 | } else {
|
16956 | output.push(value);
|
16957 | }
|
16958 | }
|
16959 | return output;
|
16960 | }
|
16961 |
|
16962 | |
16963 |
|
16964 |
|
16965 |
|
16966 |
|
16967 |
|
16968 |
|
16969 |
|
16970 | function ucs2encode(array) {
|
16971 | return map(array, function(value) {
|
16972 | var output = '';
|
16973 | if (value > 0xFFFF) {
|
16974 | value -= 0x10000;
|
16975 | output += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800);
|
16976 | value = 0xDC00 | value & 0x3FF;
|
16977 | }
|
16978 | output += stringFromCharCode(value);
|
16979 | return output;
|
16980 | }).join('');
|
16981 | }
|
16982 |
|
16983 | |
16984 |
|
16985 |
|
16986 |
|
16987 |
|
16988 |
|
16989 |
|
16990 |
|
16991 |
|
16992 | function basicToDigit(codePoint) {
|
16993 | if (codePoint - 48 < 10) {
|
16994 | return codePoint - 22;
|
16995 | }
|
16996 | if (codePoint - 65 < 26) {
|
16997 | return codePoint - 65;
|
16998 | }
|
16999 | if (codePoint - 97 < 26) {
|
17000 | return codePoint - 97;
|
17001 | }
|
17002 | return base;
|
17003 | }
|
17004 |
|
17005 | |
17006 |
|
17007 |
|
17008 |
|
17009 |
|
17010 |
|
17011 |
|
17012 |
|
17013 |
|
17014 |
|
17015 |
|
17016 | function digitToBasic(digit, flag) {
|
17017 |
|
17018 |
|
17019 | return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);
|
17020 | }
|
17021 |
|
17022 | |
17023 |
|
17024 |
|
17025 |
|
17026 |
|
17027 | function adapt(delta, numPoints, firstTime) {
|
17028 | var k = 0;
|
17029 | delta = firstTime ? floor(delta / damp) : delta >> 1;
|
17030 | delta += floor(delta / numPoints);
|
17031 | for (; delta > baseMinusTMin * tMax >> 1; k += base) {
|
17032 | delta = floor(delta / baseMinusTMin);
|
17033 | }
|
17034 | return floor(k + (baseMinusTMin + 1) * delta / (delta + skew));
|
17035 | }
|
17036 |
|
17037 | |
17038 |
|
17039 |
|
17040 |
|
17041 |
|
17042 |
|
17043 |
|
17044 | function decode(input) {
|
17045 |
|
17046 | var output = [],
|
17047 | inputLength = input.length,
|
17048 | out,
|
17049 | i = 0,
|
17050 | n = initialN,
|
17051 | bias = initialBias,
|
17052 | basic,
|
17053 | j,
|
17054 | index,
|
17055 | oldi,
|
17056 | w,
|
17057 | k,
|
17058 | digit,
|
17059 | t,
|
17060 |
|
17061 | baseMinusT;
|
17062 |
|
17063 |
|
17064 |
|
17065 |
|
17066 |
|
17067 | basic = input.lastIndexOf(delimiter);
|
17068 | if (basic < 0) {
|
17069 | basic = 0;
|
17070 | }
|
17071 |
|
17072 | for (j = 0; j < basic; ++j) {
|
17073 |
|
17074 | if (input.charCodeAt(j) >= 0x80) {
|
17075 | error('not-basic');
|
17076 | }
|
17077 | output.push(input.charCodeAt(j));
|
17078 | }
|
17079 |
|
17080 |
|
17081 |
|
17082 |
|
17083 | for (index = basic > 0 ? basic + 1 : 0; index < inputLength; ) {
|
17084 |
|
17085 |
|
17086 |
|
17087 |
|
17088 |
|
17089 |
|
17090 | for (oldi = i, w = 1, k = base; ; k += base) {
|
17091 |
|
17092 | if (index >= inputLength) {
|
17093 | error('invalid-input');
|
17094 | }
|
17095 |
|
17096 | digit = basicToDigit(input.charCodeAt(index++));
|
17097 |
|
17098 | if (digit >= base || digit > floor((maxInt - i) / w)) {
|
17099 | error('overflow');
|
17100 | }
|
17101 |
|
17102 | i += digit * w;
|
17103 | t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);
|
17104 |
|
17105 | if (digit < t) {
|
17106 | break;
|
17107 | }
|
17108 |
|
17109 | baseMinusT = base - t;
|
17110 | if (w > floor(maxInt / baseMinusT)) {
|
17111 | error('overflow');
|
17112 | }
|
17113 |
|
17114 | w *= baseMinusT;
|
17115 |
|
17116 | }
|
17117 |
|
17118 | out = output.length + 1;
|
17119 | bias = adapt(i - oldi, out, oldi == 0);
|
17120 |
|
17121 |
|
17122 |
|
17123 | if (floor(i / out) > maxInt - n) {
|
17124 | error('overflow');
|
17125 | }
|
17126 |
|
17127 | n += floor(i / out);
|
17128 | i %= out;
|
17129 |
|
17130 |
|
17131 | output.splice(i++, 0, n);
|
17132 |
|
17133 | }
|
17134 |
|
17135 | return ucs2encode(output);
|
17136 | }
|
17137 |
|
17138 | |
17139 |
|
17140 |
|
17141 |
|
17142 |
|
17143 |
|
17144 |
|
17145 | function encode(input) {
|
17146 | var n,
|
17147 | delta,
|
17148 | handledCPCount,
|
17149 | basicLength,
|
17150 | bias,
|
17151 | j,
|
17152 | m,
|
17153 | q,
|
17154 | k,
|
17155 | t,
|
17156 | currentValue,
|
17157 | output = [],
|
17158 |
|
17159 | inputLength,
|
17160 |
|
17161 | handledCPCountPlusOne,
|
17162 | baseMinusT,
|
17163 | qMinusT;
|
17164 |
|
17165 |
|
17166 | input = ucs2decode(input);
|
17167 |
|
17168 |
|
17169 | inputLength = input.length;
|
17170 |
|
17171 |
|
17172 | n = initialN;
|
17173 | delta = 0;
|
17174 | bias = initialBias;
|
17175 |
|
17176 |
|
17177 | for (j = 0; j < inputLength; ++j) {
|
17178 | currentValue = input[j];
|
17179 | if (currentValue < 0x80) {
|
17180 | output.push(stringFromCharCode(currentValue));
|
17181 | }
|
17182 | }
|
17183 |
|
17184 | handledCPCount = basicLength = output.length;
|
17185 |
|
17186 |
|
17187 |
|
17188 |
|
17189 |
|
17190 | if (basicLength) {
|
17191 | output.push(delimiter);
|
17192 | }
|
17193 |
|
17194 |
|
17195 | while (handledCPCount < inputLength) {
|
17196 |
|
17197 |
|
17198 |
|
17199 | for (m = maxInt, j = 0; j < inputLength; ++j) {
|
17200 | currentValue = input[j];
|
17201 | if (currentValue >= n && currentValue < m) {
|
17202 | m = currentValue;
|
17203 | }
|
17204 | }
|
17205 |
|
17206 |
|
17207 |
|
17208 | handledCPCountPlusOne = handledCPCount + 1;
|
17209 | if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {
|
17210 | error('overflow');
|
17211 | }
|
17212 |
|
17213 | delta += (m - n) * handledCPCountPlusOne;
|
17214 | n = m;
|
17215 |
|
17216 | for (j = 0; j < inputLength; ++j) {
|
17217 | currentValue = input[j];
|
17218 |
|
17219 | if (currentValue < n && ++delta > maxInt) {
|
17220 | error('overflow');
|
17221 | }
|
17222 |
|
17223 | if (currentValue == n) {
|
17224 |
|
17225 | for (q = delta, k = base; ; k += base) {
|
17226 | t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);
|
17227 | if (q < t) {
|
17228 | break;
|
17229 | }
|
17230 | qMinusT = q - t;
|
17231 | baseMinusT = base - t;
|
17232 | output.push(
|
17233 | stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0))
|
17234 | );
|
17235 | q = floor(qMinusT / baseMinusT);
|
17236 | }
|
17237 |
|
17238 | output.push(stringFromCharCode(digitToBasic(q, 0)));
|
17239 | bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength);
|
17240 | delta = 0;
|
17241 | ++handledCPCount;
|
17242 | }
|
17243 | }
|
17244 |
|
17245 | ++delta;
|
17246 | ++n;
|
17247 |
|
17248 | }
|
17249 | return output.join('');
|
17250 | }
|
17251 |
|
17252 | |
17253 |
|
17254 |
|
17255 |
|
17256 |
|
17257 |
|
17258 |
|
17259 |
|
17260 |
|
17261 |
|
17262 |
|
17263 | function toUnicode(input) {
|
17264 | return mapDomain(input, function(string) {
|
17265 | return regexPunycode.test(string)
|
17266 | ? decode(string.slice(4).toLowerCase())
|
17267 | : string;
|
17268 | });
|
17269 | }
|
17270 |
|
17271 | |
17272 |
|
17273 |
|
17274 |
|
17275 |
|
17276 |
|
17277 |
|
17278 |
|
17279 |
|
17280 |
|
17281 |
|
17282 | function toASCII(input) {
|
17283 | return mapDomain(input, function(string) {
|
17284 | return regexNonASCII.test(string)
|
17285 | ? 'xn--' + encode(string)
|
17286 | : string;
|
17287 | });
|
17288 | }
|
17289 |
|
17290 |
|
17291 |
|
17292 |
|
17293 | punycode = {
|
17294 | |
17295 |
|
17296 |
|
17297 |
|
17298 |
|
17299 | 'version': '1.4.1',
|
17300 | |
17301 |
|
17302 |
|
17303 |
|
17304 |
|
17305 |
|
17306 |
|
17307 | 'ucs2': {
|
17308 | 'decode': ucs2decode,
|
17309 | 'encode': ucs2encode
|
17310 | },
|
17311 | 'decode': decode,
|
17312 | 'encode': encode,
|
17313 | 'toASCII': toASCII,
|
17314 | 'toUnicode': toUnicode
|
17315 | };
|
17316 |
|
17317 |
|
17318 |
|
17319 |
|
17320 | if (
|
17321 | typeof define == 'function' &&
|
17322 | typeof define.amd == 'object' &&
|
17323 | define.amd
|
17324 | ) {
|
17325 | define('punycode', function() {
|
17326 | return punycode;
|
17327 | });
|
17328 | } else if (freeExports && freeModule) {
|
17329 | if (module.exports == freeExports) {
|
17330 |
|
17331 | freeModule.exports = punycode;
|
17332 | } else {
|
17333 |
|
17334 | for (key in punycode) {
|
17335 | punycode.hasOwnProperty(key) && (freeExports[key] = punycode[key]);
|
17336 | }
|
17337 | }
|
17338 | } else {
|
17339 |
|
17340 | root.punycode = punycode;
|
17341 | }
|
17342 |
|
17343 | }(this));
|
17344 |
|
17345 | }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
17346 | },{}],251:[function(require,module,exports){
|
17347 |
|
17348 |
|
17349 |
|
17350 |
|
17351 |
|
17352 |
|
17353 |
|
17354 |
|
17355 |
|
17356 |
|
17357 |
|
17358 |
|
17359 |
|
17360 |
|
17361 |
|
17362 |
|
17363 |
|
17364 |
|
17365 |
|
17366 |
|
17367 |
|
17368 | 'use strict';
|
17369 |
|
17370 |
|
17371 |
|
17372 |
|
17373 | function hasOwnProperty(obj, prop) {
|
17374 | return Object.prototype.hasOwnProperty.call(obj, prop);
|
17375 | }
|
17376 |
|
17377 | module.exports = function(qs, sep, eq, options) {
|
17378 | sep = sep || '&';
|
17379 | eq = eq || '=';
|
17380 | var obj = {};
|
17381 |
|
17382 | if (typeof qs !== 'string' || qs.length === 0) {
|
17383 | return obj;
|
17384 | }
|
17385 |
|
17386 | var regexp = /\+/g;
|
17387 | qs = qs.split(sep);
|
17388 |
|
17389 | var maxKeys = 1000;
|
17390 | if (options && typeof options.maxKeys === 'number') {
|
17391 | maxKeys = options.maxKeys;
|
17392 | }
|
17393 |
|
17394 | var len = qs.length;
|
17395 |
|
17396 | if (maxKeys > 0 && len > maxKeys) {
|
17397 | len = maxKeys;
|
17398 | }
|
17399 |
|
17400 | for (var i = 0; i < len; ++i) {
|
17401 | var x = qs[i].replace(regexp, '%20'),
|
17402 | idx = x.indexOf(eq),
|
17403 | kstr, vstr, k, v;
|
17404 |
|
17405 | if (idx >= 0) {
|
17406 | kstr = x.substr(0, idx);
|
17407 | vstr = x.substr(idx + 1);
|
17408 | } else {
|
17409 | kstr = x;
|
17410 | vstr = '';
|
17411 | }
|
17412 |
|
17413 | k = decodeURIComponent(kstr);
|
17414 | v = decodeURIComponent(vstr);
|
17415 |
|
17416 | if (!hasOwnProperty(obj, k)) {
|
17417 | obj[k] = v;
|
17418 | } else if (isArray(obj[k])) {
|
17419 | obj[k].push(v);
|
17420 | } else {
|
17421 | obj[k] = [obj[k], v];
|
17422 | }
|
17423 | }
|
17424 |
|
17425 | return obj;
|
17426 | };
|
17427 |
|
17428 | var isArray = Array.isArray || function (xs) {
|
17429 | return Object.prototype.toString.call(xs) === '[object Array]';
|
17430 | };
|
17431 |
|
17432 | },{}],252:[function(require,module,exports){
|
17433 |
|
17434 |
|
17435 |
|
17436 |
|
17437 |
|
17438 |
|
17439 |
|
17440 |
|
17441 |
|
17442 |
|
17443 |
|
17444 |
|
17445 |
|
17446 |
|
17447 |
|
17448 |
|
17449 |
|
17450 |
|
17451 |
|
17452 |
|
17453 |
|
17454 | 'use strict';
|
17455 |
|
17456 | var stringifyPrimitive = function(v) {
|
17457 | switch (typeof v) {
|
17458 | case 'string':
|
17459 | return v;
|
17460 |
|
17461 | case 'boolean':
|
17462 | return v ? 'true' : 'false';
|
17463 |
|
17464 | case 'number':
|
17465 | return isFinite(v) ? v : '';
|
17466 |
|
17467 | default:
|
17468 | return '';
|
17469 | }
|
17470 | };
|
17471 |
|
17472 | module.exports = function(obj, sep, eq, name) {
|
17473 | sep = sep || '&';
|
17474 | eq = eq || '=';
|
17475 | if (obj === null) {
|
17476 | obj = undefined;
|
17477 | }
|
17478 |
|
17479 | if (typeof obj === 'object') {
|
17480 | return map(objectKeys(obj), function(k) {
|
17481 | var ks = encodeURIComponent(stringifyPrimitive(k)) + eq;
|
17482 | if (isArray(obj[k])) {
|
17483 | return map(obj[k], function(v) {
|
17484 | return ks + encodeURIComponent(stringifyPrimitive(v));
|
17485 | }).join(sep);
|
17486 | } else {
|
17487 | return ks + encodeURIComponent(stringifyPrimitive(obj[k]));
|
17488 | }
|
17489 | }).join(sep);
|
17490 |
|
17491 | }
|
17492 |
|
17493 | if (!name) return '';
|
17494 | return encodeURIComponent(stringifyPrimitive(name)) + eq +
|
17495 | encodeURIComponent(stringifyPrimitive(obj));
|
17496 | };
|
17497 |
|
17498 | var isArray = Array.isArray || function (xs) {
|
17499 | return Object.prototype.toString.call(xs) === '[object Array]';
|
17500 | };
|
17501 |
|
17502 | function map (xs, f) {
|
17503 | if (xs.map) return xs.map(f);
|
17504 | var res = [];
|
17505 | for (var i = 0; i < xs.length; i++) {
|
17506 | res.push(f(xs[i], i));
|
17507 | }
|
17508 | return res;
|
17509 | }
|
17510 |
|
17511 | var objectKeys = Object.keys || function (obj) {
|
17512 | var res = [];
|
17513 | for (var key in obj) {
|
17514 | if (Object.prototype.hasOwnProperty.call(obj, key)) res.push(key);
|
17515 | }
|
17516 | return res;
|
17517 | };
|
17518 |
|
17519 | },{}],253:[function(require,module,exports){
|
17520 | 'use strict';
|
17521 |
|
17522 | exports.decode = exports.parse = require('./decode');
|
17523 | exports.encode = exports.stringify = require('./encode');
|
17524 |
|
17525 | },{"./decode":251,"./encode":252}],254:[function(require,module,exports){
|
17526 | module.exports = require('./lib/_stream_duplex.js');
|
17527 |
|
17528 | },{"./lib/_stream_duplex.js":255}],255:[function(require,module,exports){
|
17529 |
|
17530 |
|
17531 |
|
17532 |
|
17533 |
|
17534 |
|
17535 |
|
17536 |
|
17537 |
|
17538 |
|
17539 |
|
17540 |
|
17541 |
|
17542 |
|
17543 |
|
17544 |
|
17545 |
|
17546 |
|
17547 |
|
17548 |
|
17549 |
|
17550 |
|
17551 |
|
17552 |
|
17553 |
|
17554 |
|
17555 | 'use strict';
|
17556 |
|
17557 |
|
17558 |
|
17559 | var _keys = require('babel-runtime/core-js/object/keys');
|
17560 |
|
17561 | var _keys2 = _interopRequireDefault(_keys);
|
17562 |
|
17563 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
17564 |
|
17565 | var pna = require('process-nextick-args');
|
17566 |
|
17567 |
|
17568 |
|
17569 | var objectKeys = _keys2.default || function (obj) {
|
17570 | var keys = [];
|
17571 | for (var key in obj) {
|
17572 | keys.push(key);
|
17573 | }return keys;
|
17574 | };
|
17575 |
|
17576 |
|
17577 | module.exports = Duplex;
|
17578 |
|
17579 |
|
17580 | var util = require('core-util-is');
|
17581 | util.inherits = require('inherits');
|
17582 |
|
17583 |
|
17584 | var Readable = require('./_stream_readable');
|
17585 | var Writable = require('./_stream_writable');
|
17586 |
|
17587 | util.inherits(Duplex, Readable);
|
17588 |
|
17589 | {
|
17590 |
|
17591 | var keys = objectKeys(Writable.prototype);
|
17592 | for (var v = 0; v < keys.length; v++) {
|
17593 | var method = keys[v];
|
17594 | if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method];
|
17595 | }
|
17596 | }
|
17597 |
|
17598 | function Duplex(options) {
|
17599 | if (!(this instanceof Duplex)) return new Duplex(options);
|
17600 |
|
17601 | Readable.call(this, options);
|
17602 | Writable.call(this, options);
|
17603 |
|
17604 | if (options && options.readable === false) this.readable = false;
|
17605 |
|
17606 | if (options && options.writable === false) this.writable = false;
|
17607 |
|
17608 | this.allowHalfOpen = true;
|
17609 | if (options && options.allowHalfOpen === false) this.allowHalfOpen = false;
|
17610 |
|
17611 | this.once('end', onend);
|
17612 | }
|
17613 |
|
17614 | Object.defineProperty(Duplex.prototype, 'writableHighWaterMark', {
|
17615 |
|
17616 |
|
17617 |
|
17618 | enumerable: false,
|
17619 | get: function get() {
|
17620 | return this._writableState.highWaterMark;
|
17621 | }
|
17622 | });
|
17623 |
|
17624 |
|
17625 | function onend() {
|
17626 |
|
17627 |
|
17628 | if (this.allowHalfOpen || this._writableState.ended) return;
|
17629 |
|
17630 |
|
17631 |
|
17632 | pna.nextTick(onEndNT, this);
|
17633 | }
|
17634 |
|
17635 | function onEndNT(self) {
|
17636 | self.end();
|
17637 | }
|
17638 |
|
17639 | Object.defineProperty(Duplex.prototype, 'destroyed', {
|
17640 | get: function get() {
|
17641 | if (this._readableState === undefined || this._writableState === undefined) {
|
17642 | return false;
|
17643 | }
|
17644 | return this._readableState.destroyed && this._writableState.destroyed;
|
17645 | },
|
17646 | set: function set(value) {
|
17647 |
|
17648 |
|
17649 | if (this._readableState === undefined || this._writableState === undefined) {
|
17650 | return;
|
17651 | }
|
17652 |
|
17653 |
|
17654 |
|
17655 | this._readableState.destroyed = value;
|
17656 | this._writableState.destroyed = value;
|
17657 | }
|
17658 | });
|
17659 |
|
17660 | Duplex.prototype._destroy = function (err, cb) {
|
17661 | this.push(null);
|
17662 | this.end();
|
17663 |
|
17664 | pna.nextTick(cb, err);
|
17665 | };
|
17666 |
|
17667 | },{"./_stream_readable":257,"./_stream_writable":259,"babel-runtime/core-js/object/keys":55,"core-util-is":186,"inherits":226,"process-nextick-args":248}],256:[function(require,module,exports){
|
17668 |
|
17669 |
|
17670 |
|
17671 |
|
17672 |
|
17673 |
|
17674 |
|
17675 |
|
17676 |
|
17677 |
|
17678 |
|
17679 |
|
17680 |
|
17681 |
|
17682 |
|
17683 |
|
17684 |
|
17685 |
|
17686 |
|
17687 |
|
17688 |
|
17689 |
|
17690 |
|
17691 |
|
17692 |
|
17693 | 'use strict';
|
17694 |
|
17695 | module.exports = PassThrough;
|
17696 |
|
17697 | var Transform = require('./_stream_transform');
|
17698 |
|
17699 |
|
17700 | var util = require('core-util-is');
|
17701 | util.inherits = require('inherits');
|
17702 |
|
17703 |
|
17704 | util.inherits(PassThrough, Transform);
|
17705 |
|
17706 | function PassThrough(options) {
|
17707 | if (!(this instanceof PassThrough)) return new PassThrough(options);
|
17708 |
|
17709 | Transform.call(this, options);
|
17710 | }
|
17711 |
|
17712 | PassThrough.prototype._transform = function (chunk, encoding, cb) {
|
17713 | cb(null, chunk);
|
17714 | };
|
17715 |
|
17716 | },{"./_stream_transform":258,"core-util-is":186,"inherits":226}],257:[function(require,module,exports){
|
17717 | (function (process,global){
|
17718 |
|
17719 |
|
17720 |
|
17721 |
|
17722 |
|
17723 |
|
17724 |
|
17725 |
|
17726 |
|
17727 |
|
17728 |
|
17729 |
|
17730 |
|
17731 |
|
17732 |
|
17733 |
|
17734 |
|
17735 |
|
17736 |
|
17737 |
|
17738 |
|
17739 | 'use strict';
|
17740 |
|
17741 |
|
17742 |
|
17743 | var _getPrototypeOf = require('babel-runtime/core-js/object/get-prototype-of');
|
17744 |
|
17745 | var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);
|
17746 |
|
17747 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
17748 |
|
17749 | var pna = require('process-nextick-args');
|
17750 |
|
17751 |
|
17752 | module.exports = Readable;
|
17753 |
|
17754 |
|
17755 | var isArray = require('isarray');
|
17756 |
|
17757 |
|
17758 |
|
17759 | var Duplex;
|
17760 |
|
17761 |
|
17762 | Readable.ReadableState = ReadableState;
|
17763 |
|
17764 |
|
17765 | var EE = require('events').EventEmitter;
|
17766 |
|
17767 | var EElistenerCount = function EElistenerCount(emitter, type) {
|
17768 | return emitter.listeners(type).length;
|
17769 | };
|
17770 |
|
17771 |
|
17772 |
|
17773 | var Stream = require('./internal/streams/stream');
|
17774 |
|
17775 |
|
17776 |
|
17777 |
|
17778 | var Buffer = require('safe-buffer').Buffer;
|
17779 | var OurUint8Array = global.Uint8Array || function () {};
|
17780 | function _uint8ArrayToBuffer(chunk) {
|
17781 | return Buffer.from(chunk);
|
17782 | }
|
17783 | function _isUint8Array(obj) {
|
17784 | return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;
|
17785 | }
|
17786 |
|
17787 |
|
17788 |
|
17789 |
|
17790 | var util = require('core-util-is');
|
17791 | util.inherits = require('inherits');
|
17792 |
|
17793 |
|
17794 |
|
17795 | var debugUtil = require('util');
|
17796 | var debug = void 0;
|
17797 | if (debugUtil && debugUtil.debuglog) {
|
17798 | debug = debugUtil.debuglog('stream');
|
17799 | } else {
|
17800 | debug = function debug() {};
|
17801 | }
|
17802 |
|
17803 |
|
17804 | var BufferList = require('./internal/streams/BufferList');
|
17805 | var destroyImpl = require('./internal/streams/destroy');
|
17806 | var StringDecoder;
|
17807 |
|
17808 | util.inherits(Readable, Stream);
|
17809 |
|
17810 | var kProxyEvents = ['error', 'close', 'destroy', 'pause', 'resume'];
|
17811 |
|
17812 | function prependListener(emitter, event, fn) {
|
17813 |
|
17814 |
|
17815 | if (typeof emitter.prependListener === 'function') return emitter.prependListener(event, fn);
|
17816 |
|
17817 |
|
17818 |
|
17819 |
|
17820 |
|
17821 | 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]];
|
17822 | }
|
17823 |
|
17824 | function ReadableState(options, stream) {
|
17825 | Duplex = Duplex || require('./_stream_duplex');
|
17826 |
|
17827 | options = options || {};
|
17828 |
|
17829 |
|
17830 |
|
17831 |
|
17832 |
|
17833 |
|
17834 | var isDuplex = stream instanceof Duplex;
|
17835 |
|
17836 |
|
17837 |
|
17838 | this.objectMode = !!options.objectMode;
|
17839 |
|
17840 | if (isDuplex) this.objectMode = this.objectMode || !!options.readableObjectMode;
|
17841 |
|
17842 |
|
17843 |
|
17844 | var hwm = options.highWaterMark;
|
17845 | var readableHwm = options.readableHighWaterMark;
|
17846 | var defaultHwm = this.objectMode ? 16 : 16 * 1024;
|
17847 |
|
17848 | if (hwm || hwm === 0) this.highWaterMark = hwm;else if (isDuplex && (readableHwm || readableHwm === 0)) this.highWaterMark = readableHwm;else this.highWaterMark = defaultHwm;
|
17849 |
|
17850 |
|
17851 | this.highWaterMark = Math.floor(this.highWaterMark);
|
17852 |
|
17853 |
|
17854 |
|
17855 |
|
17856 | this.buffer = new BufferList();
|
17857 | this.length = 0;
|
17858 | this.pipes = null;
|
17859 | this.pipesCount = 0;
|
17860 | this.flowing = null;
|
17861 | this.ended = false;
|
17862 | this.endEmitted = false;
|
17863 | this.reading = false;
|
17864 |
|
17865 |
|
17866 |
|
17867 |
|
17868 |
|
17869 | this.sync = true;
|
17870 |
|
17871 |
|
17872 |
|
17873 | this.needReadable = false;
|
17874 | this.emittedReadable = false;
|
17875 | this.readableListening = false;
|
17876 | this.resumeScheduled = false;
|
17877 |
|
17878 |
|
17879 | this.destroyed = false;
|
17880 |
|
17881 |
|
17882 |
|
17883 |
|
17884 | this.defaultEncoding = options.defaultEncoding || 'utf8';
|
17885 |
|
17886 |
|
17887 | this.awaitDrain = 0;
|
17888 |
|
17889 |
|
17890 | this.readingMore = false;
|
17891 |
|
17892 | this.decoder = null;
|
17893 | this.encoding = null;
|
17894 | if (options.encoding) {
|
17895 | if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder;
|
17896 | this.decoder = new StringDecoder(options.encoding);
|
17897 | this.encoding = options.encoding;
|
17898 | }
|
17899 | }
|
17900 |
|
17901 | function Readable(options) {
|
17902 | Duplex = Duplex || require('./_stream_duplex');
|
17903 |
|
17904 | if (!(this instanceof Readable)) return new Readable(options);
|
17905 |
|
17906 | this._readableState = new ReadableState(options, this);
|
17907 |
|
17908 |
|
17909 | this.readable = true;
|
17910 |
|
17911 | if (options) {
|
17912 | if (typeof options.read === 'function') this._read = options.read;
|
17913 |
|
17914 | if (typeof options.destroy === 'function') this._destroy = options.destroy;
|
17915 | }
|
17916 |
|
17917 | Stream.call(this);
|
17918 | }
|
17919 |
|
17920 | Object.defineProperty(Readable.prototype, 'destroyed', {
|
17921 | get: function get() {
|
17922 | if (this._readableState === undefined) {
|
17923 | return false;
|
17924 | }
|
17925 | return this._readableState.destroyed;
|
17926 | },
|
17927 | set: function set(value) {
|
17928 |
|
17929 |
|
17930 | if (!this._readableState) {
|
17931 | return;
|
17932 | }
|
17933 |
|
17934 |
|
17935 |
|
17936 | this._readableState.destroyed = value;
|
17937 | }
|
17938 | });
|
17939 |
|
17940 | Readable.prototype.destroy = destroyImpl.destroy;
|
17941 | Readable.prototype._undestroy = destroyImpl.undestroy;
|
17942 | Readable.prototype._destroy = function (err, cb) {
|
17943 | this.push(null);
|
17944 | cb(err);
|
17945 | };
|
17946 |
|
17947 |
|
17948 |
|
17949 |
|
17950 |
|
17951 | Readable.prototype.push = function (chunk, encoding) {
|
17952 | var state = this._readableState;
|
17953 | var skipChunkCheck;
|
17954 |
|
17955 | if (!state.objectMode) {
|
17956 | if (typeof chunk === 'string') {
|
17957 | encoding = encoding || state.defaultEncoding;
|
17958 | if (encoding !== state.encoding) {
|
17959 | chunk = Buffer.from(chunk, encoding);
|
17960 | encoding = '';
|
17961 | }
|
17962 | skipChunkCheck = true;
|
17963 | }
|
17964 | } else {
|
17965 | skipChunkCheck = true;
|
17966 | }
|
17967 |
|
17968 | return readableAddChunk(this, chunk, encoding, false, skipChunkCheck);
|
17969 | };
|
17970 |
|
17971 |
|
17972 | Readable.prototype.unshift = function (chunk) {
|
17973 | return readableAddChunk(this, chunk, null, true, false);
|
17974 | };
|
17975 |
|
17976 | function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) {
|
17977 | var state = stream._readableState;
|
17978 | if (chunk === null) {
|
17979 | state.reading = false;
|
17980 | onEofChunk(stream, state);
|
17981 | } else {
|
17982 | var er;
|
17983 | if (!skipChunkCheck) er = chunkInvalid(state, chunk);
|
17984 | if (er) {
|
17985 | stream.emit('error', er);
|
17986 | } else if (state.objectMode || chunk && chunk.length > 0) {
|
17987 | if (typeof chunk !== 'string' && !state.objectMode && (0, _getPrototypeOf2.default)(chunk) !== Buffer.prototype) {
|
17988 | chunk = _uint8ArrayToBuffer(chunk);
|
17989 | }
|
17990 |
|
17991 | if (addToFront) {
|
17992 | if (state.endEmitted) stream.emit('error', new Error('stream.unshift() after end event'));else addChunk(stream, state, chunk, true);
|
17993 | } else if (state.ended) {
|
17994 | stream.emit('error', new Error('stream.push() after EOF'));
|
17995 | } else {
|
17996 | state.reading = false;
|
17997 | if (state.decoder && !encoding) {
|
17998 | chunk = state.decoder.write(chunk);
|
17999 | if (state.objectMode || chunk.length !== 0) addChunk(stream, state, chunk, false);else maybeReadMore(stream, state);
|
18000 | } else {
|
18001 | addChunk(stream, state, chunk, false);
|
18002 | }
|
18003 | }
|
18004 | } else if (!addToFront) {
|
18005 | state.reading = false;
|
18006 | }
|
18007 | }
|
18008 |
|
18009 | return needMoreData(state);
|
18010 | }
|
18011 |
|
18012 | function addChunk(stream, state, chunk, addToFront) {
|
18013 | if (state.flowing && state.length === 0 && !state.sync) {
|
18014 | stream.emit('data', chunk);
|
18015 | stream.read(0);
|
18016 | } else {
|
18017 |
|
18018 | state.length += state.objectMode ? 1 : chunk.length;
|
18019 | if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk);
|
18020 |
|
18021 | if (state.needReadable) emitReadable(stream);
|
18022 | }
|
18023 | maybeReadMore(stream, state);
|
18024 | }
|
18025 |
|
18026 | function chunkInvalid(state, chunk) {
|
18027 | var er;
|
18028 | if (!_isUint8Array(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {
|
18029 | er = new TypeError('Invalid non-string/buffer chunk');
|
18030 | }
|
18031 | return er;
|
18032 | }
|
18033 |
|
18034 |
|
18035 |
|
18036 |
|
18037 |
|
18038 |
|
18039 |
|
18040 |
|
18041 | function needMoreData(state) {
|
18042 | return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0);
|
18043 | }
|
18044 |
|
18045 | Readable.prototype.isPaused = function () {
|
18046 | return this._readableState.flowing === false;
|
18047 | };
|
18048 |
|
18049 |
|
18050 | Readable.prototype.setEncoding = function (enc) {
|
18051 | if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder;
|
18052 | this._readableState.decoder = new StringDecoder(enc);
|
18053 | this._readableState.encoding = enc;
|
18054 | return this;
|
18055 | };
|
18056 |
|
18057 |
|
18058 | var MAX_HWM = 0x800000;
|
18059 | function computeNewHighWaterMark(n) {
|
18060 | if (n >= MAX_HWM) {
|
18061 | n = MAX_HWM;
|
18062 | } else {
|
18063 |
|
18064 |
|
18065 | n--;
|
18066 | n |= n >>> 1;
|
18067 | n |= n >>> 2;
|
18068 | n |= n >>> 4;
|
18069 | n |= n >>> 8;
|
18070 | n |= n >>> 16;
|
18071 | n++;
|
18072 | }
|
18073 | return n;
|
18074 | }
|
18075 |
|
18076 |
|
18077 |
|
18078 | function howMuchToRead(n, state) {
|
18079 | if (n <= 0 || state.length === 0 && state.ended) return 0;
|
18080 | if (state.objectMode) return 1;
|
18081 | if (n !== n) {
|
18082 |
|
18083 | if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;
|
18084 | }
|
18085 |
|
18086 | if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);
|
18087 | if (n <= state.length) return n;
|
18088 |
|
18089 | if (!state.ended) {
|
18090 | state.needReadable = true;
|
18091 | return 0;
|
18092 | }
|
18093 | return state.length;
|
18094 | }
|
18095 |
|
18096 |
|
18097 | Readable.prototype.read = function (n) {
|
18098 | debug('read', n);
|
18099 | n = parseInt(n, 10);
|
18100 | var state = this._readableState;
|
18101 | var nOrig = n;
|
18102 |
|
18103 | if (n !== 0) state.emittedReadable = false;
|
18104 |
|
18105 |
|
18106 |
|
18107 |
|
18108 | if (n === 0 && state.needReadable && (state.length >= state.highWaterMark || state.ended)) {
|
18109 | debug('read: emitReadable', state.length, state.ended);
|
18110 | if (state.length === 0 && state.ended) endReadable(this);else emitReadable(this);
|
18111 | return null;
|
18112 | }
|
18113 |
|
18114 | n = howMuchToRead(n, state);
|
18115 |
|
18116 |
|
18117 | if (n === 0 && state.ended) {
|
18118 | if (state.length === 0) endReadable(this);
|
18119 | return null;
|
18120 | }
|
18121 |
|
18122 |
|
18123 |
|
18124 |
|
18125 |
|
18126 |
|
18127 |
|
18128 |
|
18129 |
|
18130 |
|
18131 |
|
18132 |
|
18133 |
|
18134 |
|
18135 |
|
18136 |
|
18137 |
|
18138 |
|
18139 |
|
18140 |
|
18141 |
|
18142 |
|
18143 |
|
18144 |
|
18145 | var doRead = state.needReadable;
|
18146 | debug('need readable', doRead);
|
18147 |
|
18148 |
|
18149 | if (state.length === 0 || state.length - n < state.highWaterMark) {
|
18150 | doRead = true;
|
18151 | debug('length less than watermark', doRead);
|
18152 | }
|
18153 |
|
18154 |
|
18155 |
|
18156 | if (state.ended || state.reading) {
|
18157 | doRead = false;
|
18158 | debug('reading or ended', doRead);
|
18159 | } else if (doRead) {
|
18160 | debug('do read');
|
18161 | state.reading = true;
|
18162 | state.sync = true;
|
18163 |
|
18164 | if (state.length === 0) state.needReadable = true;
|
18165 |
|
18166 | this._read(state.highWaterMark);
|
18167 | state.sync = false;
|
18168 |
|
18169 |
|
18170 | if (!state.reading) n = howMuchToRead(nOrig, state);
|
18171 | }
|
18172 |
|
18173 | var ret;
|
18174 | if (n > 0) ret = fromList(n, state);else ret = null;
|
18175 |
|
18176 | if (ret === null) {
|
18177 | state.needReadable = true;
|
18178 | n = 0;
|
18179 | } else {
|
18180 | state.length -= n;
|
18181 | }
|
18182 |
|
18183 | if (state.length === 0) {
|
18184 |
|
18185 |
|
18186 | if (!state.ended) state.needReadable = true;
|
18187 |
|
18188 |
|
18189 | if (nOrig !== n && state.ended) endReadable(this);
|
18190 | }
|
18191 |
|
18192 | if (ret !== null) this.emit('data', ret);
|
18193 |
|
18194 | return ret;
|
18195 | };
|
18196 |
|
18197 | function onEofChunk(stream, state) {
|
18198 | if (state.ended) return;
|
18199 | if (state.decoder) {
|
18200 | var chunk = state.decoder.end();
|
18201 | if (chunk && chunk.length) {
|
18202 | state.buffer.push(chunk);
|
18203 | state.length += state.objectMode ? 1 : chunk.length;
|
18204 | }
|
18205 | }
|
18206 | state.ended = true;
|
18207 |
|
18208 |
|
18209 | emitReadable(stream);
|
18210 | }
|
18211 |
|
18212 |
|
18213 |
|
18214 |
|
18215 | function emitReadable(stream) {
|
18216 | var state = stream._readableState;
|
18217 | state.needReadable = false;
|
18218 | if (!state.emittedReadable) {
|
18219 | debug('emitReadable', state.flowing);
|
18220 | state.emittedReadable = true;
|
18221 | if (state.sync) pna.nextTick(emitReadable_, stream);else emitReadable_(stream);
|
18222 | }
|
18223 | }
|
18224 |
|
18225 | function emitReadable_(stream) {
|
18226 | debug('emit readable');
|
18227 | stream.emit('readable');
|
18228 | flow(stream);
|
18229 | }
|
18230 |
|
18231 |
|
18232 |
|
18233 |
|
18234 |
|
18235 |
|
18236 |
|
18237 | function maybeReadMore(stream, state) {
|
18238 | if (!state.readingMore) {
|
18239 | state.readingMore = true;
|
18240 | pna.nextTick(maybeReadMore_, stream, state);
|
18241 | }
|
18242 | }
|
18243 |
|
18244 | function maybeReadMore_(stream, state) {
|
18245 | var len = state.length;
|
18246 | while (!state.reading && !state.flowing && !state.ended && state.length < state.highWaterMark) {
|
18247 | debug('maybeReadMore read 0');
|
18248 | stream.read(0);
|
18249 | if (len === state.length)
|
18250 |
|
18251 | break;else len = state.length;
|
18252 | }
|
18253 | state.readingMore = false;
|
18254 | }
|
18255 |
|
18256 |
|
18257 |
|
18258 |
|
18259 |
|
18260 | Readable.prototype._read = function (n) {
|
18261 | this.emit('error', new Error('_read() is not implemented'));
|
18262 | };
|
18263 |
|
18264 | Readable.prototype.pipe = function (dest, pipeOpts) {
|
18265 | var src = this;
|
18266 | var state = this._readableState;
|
18267 |
|
18268 | switch (state.pipesCount) {
|
18269 | case 0:
|
18270 | state.pipes = dest;
|
18271 | break;
|
18272 | case 1:
|
18273 | state.pipes = [state.pipes, dest];
|
18274 | break;
|
18275 | default:
|
18276 | state.pipes.push(dest);
|
18277 | break;
|
18278 | }
|
18279 | state.pipesCount += 1;
|
18280 | debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts);
|
18281 |
|
18282 | var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr;
|
18283 |
|
18284 | var endFn = doEnd ? onend : unpipe;
|
18285 | if (state.endEmitted) pna.nextTick(endFn);else src.once('end', endFn);
|
18286 |
|
18287 | dest.on('unpipe', onunpipe);
|
18288 | function onunpipe(readable, unpipeInfo) {
|
18289 | debug('onunpipe');
|
18290 | if (readable === src) {
|
18291 | if (unpipeInfo && unpipeInfo.hasUnpiped === false) {
|
18292 | unpipeInfo.hasUnpiped = true;
|
18293 | cleanup();
|
18294 | }
|
18295 | }
|
18296 | }
|
18297 |
|
18298 | function onend() {
|
18299 | debug('onend');
|
18300 | dest.end();
|
18301 | }
|
18302 |
|
18303 |
|
18304 |
|
18305 |
|
18306 |
|
18307 | var ondrain = pipeOnDrain(src);
|
18308 | dest.on('drain', ondrain);
|
18309 |
|
18310 | var cleanedUp = false;
|
18311 | function cleanup() {
|
18312 | debug('cleanup');
|
18313 |
|
18314 | dest.removeListener('close', onclose);
|
18315 | dest.removeListener('finish', onfinish);
|
18316 | dest.removeListener('drain', ondrain);
|
18317 | dest.removeListener('error', onerror);
|
18318 | dest.removeListener('unpipe', onunpipe);
|
18319 | src.removeListener('end', onend);
|
18320 | src.removeListener('end', unpipe);
|
18321 | src.removeListener('data', ondata);
|
18322 |
|
18323 | cleanedUp = true;
|
18324 |
|
18325 |
|
18326 |
|
18327 |
|
18328 |
|
18329 |
|
18330 | if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain();
|
18331 | }
|
18332 |
|
18333 |
|
18334 |
|
18335 |
|
18336 |
|
18337 | var increasedAwaitDrain = false;
|
18338 | src.on('data', ondata);
|
18339 | function ondata(chunk) {
|
18340 | debug('ondata');
|
18341 | increasedAwaitDrain = false;
|
18342 | var ret = dest.write(chunk);
|
18343 | if (false === ret && !increasedAwaitDrain) {
|
18344 |
|
18345 |
|
18346 |
|
18347 |
|
18348 | if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) {
|
18349 | debug('false write response, pause', src._readableState.awaitDrain);
|
18350 | src._readableState.awaitDrain++;
|
18351 | increasedAwaitDrain = true;
|
18352 | }
|
18353 | src.pause();
|
18354 | }
|
18355 | }
|
18356 |
|
18357 |
|
18358 |
|
18359 | function onerror(er) {
|
18360 | debug('onerror', er);
|
18361 | unpipe();
|
18362 | dest.removeListener('error', onerror);
|
18363 | if (EElistenerCount(dest, 'error') === 0) dest.emit('error', er);
|
18364 | }
|
18365 |
|
18366 |
|
18367 | prependListener(dest, 'error', onerror);
|
18368 |
|
18369 |
|
18370 | function onclose() {
|
18371 | dest.removeListener('finish', onfinish);
|
18372 | unpipe();
|
18373 | }
|
18374 | dest.once('close', onclose);
|
18375 | function onfinish() {
|
18376 | debug('onfinish');
|
18377 | dest.removeListener('close', onclose);
|
18378 | unpipe();
|
18379 | }
|
18380 | dest.once('finish', onfinish);
|
18381 |
|
18382 | function unpipe() {
|
18383 | debug('unpipe');
|
18384 | src.unpipe(dest);
|
18385 | }
|
18386 |
|
18387 |
|
18388 | dest.emit('pipe', src);
|
18389 |
|
18390 |
|
18391 | if (!state.flowing) {
|
18392 | debug('pipe resume');
|
18393 | src.resume();
|
18394 | }
|
18395 |
|
18396 | return dest;
|
18397 | };
|
18398 |
|
18399 | function pipeOnDrain(src) {
|
18400 | return function () {
|
18401 | var state = src._readableState;
|
18402 | debug('pipeOnDrain', state.awaitDrain);
|
18403 | if (state.awaitDrain) state.awaitDrain--;
|
18404 | if (state.awaitDrain === 0 && EElistenerCount(src, 'data')) {
|
18405 | state.flowing = true;
|
18406 | flow(src);
|
18407 | }
|
18408 | };
|
18409 | }
|
18410 |
|
18411 | Readable.prototype.unpipe = function (dest) {
|
18412 | var state = this._readableState;
|
18413 | var unpipeInfo = { hasUnpiped: false };
|
18414 |
|
18415 |
|
18416 | if (state.pipesCount === 0) return this;
|
18417 |
|
18418 |
|
18419 | if (state.pipesCount === 1) {
|
18420 |
|
18421 | if (dest && dest !== state.pipes) return this;
|
18422 |
|
18423 | if (!dest) dest = state.pipes;
|
18424 |
|
18425 |
|
18426 | state.pipes = null;
|
18427 | state.pipesCount = 0;
|
18428 | state.flowing = false;
|
18429 | if (dest) dest.emit('unpipe', this, unpipeInfo);
|
18430 | return this;
|
18431 | }
|
18432 |
|
18433 |
|
18434 |
|
18435 | if (!dest) {
|
18436 |
|
18437 | var dests = state.pipes;
|
18438 | var len = state.pipesCount;
|
18439 | state.pipes = null;
|
18440 | state.pipesCount = 0;
|
18441 | state.flowing = false;
|
18442 |
|
18443 | for (var i = 0; i < len; i++) {
|
18444 | dests[i].emit('unpipe', this, unpipeInfo);
|
18445 | }return this;
|
18446 | }
|
18447 |
|
18448 |
|
18449 | var index = indexOf(state.pipes, dest);
|
18450 | if (index === -1) return this;
|
18451 |
|
18452 | state.pipes.splice(index, 1);
|
18453 | state.pipesCount -= 1;
|
18454 | if (state.pipesCount === 1) state.pipes = state.pipes[0];
|
18455 |
|
18456 | dest.emit('unpipe', this, unpipeInfo);
|
18457 |
|
18458 | return this;
|
18459 | };
|
18460 |
|
18461 |
|
18462 |
|
18463 | Readable.prototype.on = function (ev, fn) {
|
18464 | var res = Stream.prototype.on.call(this, ev, fn);
|
18465 |
|
18466 | if (ev === 'data') {
|
18467 |
|
18468 | if (this._readableState.flowing !== false) this.resume();
|
18469 | } else if (ev === 'readable') {
|
18470 | var state = this._readableState;
|
18471 | if (!state.endEmitted && !state.readableListening) {
|
18472 | state.readableListening = state.needReadable = true;
|
18473 | state.emittedReadable = false;
|
18474 | if (!state.reading) {
|
18475 | pna.nextTick(nReadingNextTick, this);
|
18476 | } else if (state.length) {
|
18477 | emitReadable(this);
|
18478 | }
|
18479 | }
|
18480 | }
|
18481 |
|
18482 | return res;
|
18483 | };
|
18484 | Readable.prototype.addListener = Readable.prototype.on;
|
18485 |
|
18486 | function nReadingNextTick(self) {
|
18487 | debug('readable nexttick read 0');
|
18488 | self.read(0);
|
18489 | }
|
18490 |
|
18491 |
|
18492 |
|
18493 | Readable.prototype.resume = function () {
|
18494 | var state = this._readableState;
|
18495 | if (!state.flowing) {
|
18496 | debug('resume');
|
18497 | state.flowing = true;
|
18498 | resume(this, state);
|
18499 | }
|
18500 | return this;
|
18501 | };
|
18502 |
|
18503 | function resume(stream, state) {
|
18504 | if (!state.resumeScheduled) {
|
18505 | state.resumeScheduled = true;
|
18506 | pna.nextTick(resume_, stream, state);
|
18507 | }
|
18508 | }
|
18509 |
|
18510 | function resume_(stream, state) {
|
18511 | if (!state.reading) {
|
18512 | debug('resume read 0');
|
18513 | stream.read(0);
|
18514 | }
|
18515 |
|
18516 | state.resumeScheduled = false;
|
18517 | state.awaitDrain = 0;
|
18518 | stream.emit('resume');
|
18519 | flow(stream);
|
18520 | if (state.flowing && !state.reading) stream.read(0);
|
18521 | }
|
18522 |
|
18523 | Readable.prototype.pause = function () {
|
18524 | debug('call pause flowing=%j', this._readableState.flowing);
|
18525 | if (false !== this._readableState.flowing) {
|
18526 | debug('pause');
|
18527 | this._readableState.flowing = false;
|
18528 | this.emit('pause');
|
18529 | }
|
18530 | return this;
|
18531 | };
|
18532 |
|
18533 | function flow(stream) {
|
18534 | var state = stream._readableState;
|
18535 | debug('flow', state.flowing);
|
18536 | while (state.flowing && stream.read() !== null) {}
|
18537 | }
|
18538 |
|
18539 |
|
18540 |
|
18541 |
|
18542 | Readable.prototype.wrap = function (stream) {
|
18543 | var _this = this;
|
18544 |
|
18545 | var state = this._readableState;
|
18546 | var paused = false;
|
18547 |
|
18548 | stream.on('end', function () {
|
18549 | debug('wrapped end');
|
18550 | if (state.decoder && !state.ended) {
|
18551 | var chunk = state.decoder.end();
|
18552 | if (chunk && chunk.length) _this.push(chunk);
|
18553 | }
|
18554 |
|
18555 | _this.push(null);
|
18556 | });
|
18557 |
|
18558 | stream.on('data', function (chunk) {
|
18559 | debug('wrapped data');
|
18560 | if (state.decoder) chunk = state.decoder.write(chunk);
|
18561 |
|
18562 |
|
18563 | if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return;
|
18564 |
|
18565 | var ret = _this.push(chunk);
|
18566 | if (!ret) {
|
18567 | paused = true;
|
18568 | stream.pause();
|
18569 | }
|
18570 | });
|
18571 |
|
18572 |
|
18573 |
|
18574 | for (var i in stream) {
|
18575 | if (this[i] === undefined && typeof stream[i] === 'function') {
|
18576 | this[i] = function (method) {
|
18577 | return function () {
|
18578 | return stream[method].apply(stream, arguments);
|
18579 | };
|
18580 | }(i);
|
18581 | }
|
18582 | }
|
18583 |
|
18584 |
|
18585 | for (var n = 0; n < kProxyEvents.length; n++) {
|
18586 | stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n]));
|
18587 | }
|
18588 |
|
18589 |
|
18590 |
|
18591 | this._read = function (n) {
|
18592 | debug('wrapped _read', n);
|
18593 | if (paused) {
|
18594 | paused = false;
|
18595 | stream.resume();
|
18596 | }
|
18597 | };
|
18598 |
|
18599 | return this;
|
18600 | };
|
18601 |
|
18602 | Object.defineProperty(Readable.prototype, 'readableHighWaterMark', {
|
18603 |
|
18604 |
|
18605 |
|
18606 | enumerable: false,
|
18607 | get: function get() {
|
18608 | return this._readableState.highWaterMark;
|
18609 | }
|
18610 | });
|
18611 |
|
18612 |
|
18613 | Readable._fromList = fromList;
|
18614 |
|
18615 |
|
18616 |
|
18617 |
|
18618 |
|
18619 | function fromList(n, state) {
|
18620 |
|
18621 | if (state.length === 0) return null;
|
18622 |
|
18623 | var ret;
|
18624 | if (state.objectMode) ret = state.buffer.shift();else if (!n || n >= state.length) {
|
18625 |
|
18626 | 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);
|
18627 | state.buffer.clear();
|
18628 | } else {
|
18629 |
|
18630 | ret = fromListPartial(n, state.buffer, state.decoder);
|
18631 | }
|
18632 |
|
18633 | return ret;
|
18634 | }
|
18635 |
|
18636 |
|
18637 |
|
18638 |
|
18639 | function fromListPartial(n, list, hasStrings) {
|
18640 | var ret;
|
18641 | if (n < list.head.data.length) {
|
18642 |
|
18643 | ret = list.head.data.slice(0, n);
|
18644 | list.head.data = list.head.data.slice(n);
|
18645 | } else if (n === list.head.data.length) {
|
18646 |
|
18647 | ret = list.shift();
|
18648 | } else {
|
18649 |
|
18650 | ret = hasStrings ? copyFromBufferString(n, list) : copyFromBuffer(n, list);
|
18651 | }
|
18652 | return ret;
|
18653 | }
|
18654 |
|
18655 |
|
18656 |
|
18657 |
|
18658 |
|
18659 | function copyFromBufferString(n, list) {
|
18660 | var p = list.head;
|
18661 | var c = 1;
|
18662 | var ret = p.data;
|
18663 | n -= ret.length;
|
18664 | while (p = p.next) {
|
18665 | var str = p.data;
|
18666 | var nb = n > str.length ? str.length : n;
|
18667 | if (nb === str.length) ret += str;else ret += str.slice(0, n);
|
18668 | n -= nb;
|
18669 | if (n === 0) {
|
18670 | if (nb === str.length) {
|
18671 | ++c;
|
18672 | if (p.next) list.head = p.next;else list.head = list.tail = null;
|
18673 | } else {
|
18674 | list.head = p;
|
18675 | p.data = str.slice(nb);
|
18676 | }
|
18677 | break;
|
18678 | }
|
18679 | ++c;
|
18680 | }
|
18681 | list.length -= c;
|
18682 | return ret;
|
18683 | }
|
18684 |
|
18685 |
|
18686 |
|
18687 |
|
18688 | function copyFromBuffer(n, list) {
|
18689 | var ret = Buffer.allocUnsafe(n);
|
18690 | var p = list.head;
|
18691 | var c = 1;
|
18692 | p.data.copy(ret);
|
18693 | n -= p.data.length;
|
18694 | while (p = p.next) {
|
18695 | var buf = p.data;
|
18696 | var nb = n > buf.length ? buf.length : n;
|
18697 | buf.copy(ret, ret.length - n, 0, nb);
|
18698 | n -= nb;
|
18699 | if (n === 0) {
|
18700 | if (nb === buf.length) {
|
18701 | ++c;
|
18702 | if (p.next) list.head = p.next;else list.head = list.tail = null;
|
18703 | } else {
|
18704 | list.head = p;
|
18705 | p.data = buf.slice(nb);
|
18706 | }
|
18707 | break;
|
18708 | }
|
18709 | ++c;
|
18710 | }
|
18711 | list.length -= c;
|
18712 | return ret;
|
18713 | }
|
18714 |
|
18715 | function endReadable(stream) {
|
18716 | var state = stream._readableState;
|
18717 |
|
18718 |
|
18719 |
|
18720 | if (state.length > 0) throw new Error('"endReadable()" called on non-empty stream');
|
18721 |
|
18722 | if (!state.endEmitted) {
|
18723 | state.ended = true;
|
18724 | pna.nextTick(endReadableNT, state, stream);
|
18725 | }
|
18726 | }
|
18727 |
|
18728 | function endReadableNT(state, stream) {
|
18729 |
|
18730 | if (!state.endEmitted && state.length === 0) {
|
18731 | state.endEmitted = true;
|
18732 | stream.readable = false;
|
18733 | stream.emit('end');
|
18734 | }
|
18735 | }
|
18736 |
|
18737 | function indexOf(xs, x) {
|
18738 | for (var i = 0, l = xs.length; i < l; i++) {
|
18739 | if (xs[i] === x) return i;
|
18740 | }
|
18741 | return -1;
|
18742 | }
|
18743 |
|
18744 | }).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
18745 | },{"./_stream_duplex":255,"./internal/streams/BufferList":260,"./internal/streams/destroy":261,"./internal/streams/stream":262,"_process":249,"babel-runtime/core-js/object/get-prototype-of":54,"core-util-is":186,"events":216,"inherits":226,"isarray":234,"process-nextick-args":248,"safe-buffer":269,"string_decoder/":276,"util":68}],258:[function(require,module,exports){
|
18746 |
|
18747 |
|
18748 |
|
18749 |
|
18750 |
|
18751 |
|
18752 |
|
18753 |
|
18754 |
|
18755 |
|
18756 |
|
18757 |
|
18758 |
|
18759 |
|
18760 |
|
18761 |
|
18762 |
|
18763 |
|
18764 |
|
18765 |
|
18766 |
|
18767 |
|
18768 |
|
18769 |
|
18770 |
|
18771 |
|
18772 |
|
18773 |
|
18774 |
|
18775 |
|
18776 |
|
18777 |
|
18778 |
|
18779 |
|
18780 |
|
18781 |
|
18782 |
|
18783 |
|
18784 |
|
18785 |
|
18786 |
|
18787 |
|
18788 |
|
18789 |
|
18790 |
|
18791 |
|
18792 |
|
18793 |
|
18794 |
|
18795 |
|
18796 |
|
18797 |
|
18798 |
|
18799 |
|
18800 |
|
18801 |
|
18802 |
|
18803 |
|
18804 |
|
18805 |
|
18806 |
|
18807 |
|
18808 |
|
18809 | 'use strict';
|
18810 |
|
18811 | module.exports = Transform;
|
18812 |
|
18813 | var Duplex = require('./_stream_duplex');
|
18814 |
|
18815 |
|
18816 | var util = require('core-util-is');
|
18817 | util.inherits = require('inherits');
|
18818 |
|
18819 |
|
18820 | util.inherits(Transform, Duplex);
|
18821 |
|
18822 | function afterTransform(er, data) {
|
18823 | var ts = this._transformState;
|
18824 | ts.transforming = false;
|
18825 |
|
18826 | var cb = ts.writecb;
|
18827 |
|
18828 | if (!cb) {
|
18829 | return this.emit('error', new Error('write callback called multiple times'));
|
18830 | }
|
18831 |
|
18832 | ts.writechunk = null;
|
18833 | ts.writecb = null;
|
18834 |
|
18835 | if (data != null)
|
18836 | this.push(data);
|
18837 |
|
18838 | cb(er);
|
18839 |
|
18840 | var rs = this._readableState;
|
18841 | rs.reading = false;
|
18842 | if (rs.needReadable || rs.length < rs.highWaterMark) {
|
18843 | this._read(rs.highWaterMark);
|
18844 | }
|
18845 | }
|
18846 |
|
18847 | function Transform(options) {
|
18848 | if (!(this instanceof Transform)) return new Transform(options);
|
18849 |
|
18850 | Duplex.call(this, options);
|
18851 |
|
18852 | this._transformState = {
|
18853 | afterTransform: afterTransform.bind(this),
|
18854 | needTransform: false,
|
18855 | transforming: false,
|
18856 | writecb: null,
|
18857 | writechunk: null,
|
18858 | writeencoding: null
|
18859 | };
|
18860 |
|
18861 |
|
18862 | this._readableState.needReadable = true;
|
18863 |
|
18864 |
|
18865 |
|
18866 |
|
18867 | this._readableState.sync = false;
|
18868 |
|
18869 | if (options) {
|
18870 | if (typeof options.transform === 'function') this._transform = options.transform;
|
18871 |
|
18872 | if (typeof options.flush === 'function') this._flush = options.flush;
|
18873 | }
|
18874 |
|
18875 |
|
18876 | this.on('prefinish', prefinish);
|
18877 | }
|
18878 |
|
18879 | function prefinish() {
|
18880 | var _this = this;
|
18881 |
|
18882 | if (typeof this._flush === 'function') {
|
18883 | this._flush(function (er, data) {
|
18884 | done(_this, er, data);
|
18885 | });
|
18886 | } else {
|
18887 | done(this, null, null);
|
18888 | }
|
18889 | }
|
18890 |
|
18891 | Transform.prototype.push = function (chunk, encoding) {
|
18892 | this._transformState.needTransform = false;
|
18893 | return Duplex.prototype.push.call(this, chunk, encoding);
|
18894 | };
|
18895 |
|
18896 |
|
18897 |
|
18898 |
|
18899 |
|
18900 |
|
18901 |
|
18902 |
|
18903 |
|
18904 |
|
18905 |
|
18906 | Transform.prototype._transform = function (chunk, encoding, cb) {
|
18907 | throw new Error('_transform() is not implemented');
|
18908 | };
|
18909 |
|
18910 | Transform.prototype._write = function (chunk, encoding, cb) {
|
18911 | var ts = this._transformState;
|
18912 | ts.writecb = cb;
|
18913 | ts.writechunk = chunk;
|
18914 | ts.writeencoding = encoding;
|
18915 | if (!ts.transforming) {
|
18916 | var rs = this._readableState;
|
18917 | if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark);
|
18918 | }
|
18919 | };
|
18920 |
|
18921 |
|
18922 |
|
18923 |
|
18924 | Transform.prototype._read = function (n) {
|
18925 | var ts = this._transformState;
|
18926 |
|
18927 | if (ts.writechunk !== null && ts.writecb && !ts.transforming) {
|
18928 | ts.transforming = true;
|
18929 | this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);
|
18930 | } else {
|
18931 |
|
18932 |
|
18933 | ts.needTransform = true;
|
18934 | }
|
18935 | };
|
18936 |
|
18937 | Transform.prototype._destroy = function (err, cb) {
|
18938 | var _this2 = this;
|
18939 |
|
18940 | Duplex.prototype._destroy.call(this, err, function (err2) {
|
18941 | cb(err2);
|
18942 | _this2.emit('close');
|
18943 | });
|
18944 | };
|
18945 |
|
18946 | function done(stream, er, data) {
|
18947 | if (er) return stream.emit('error', er);
|
18948 |
|
18949 | if (data != null)
|
18950 | stream.push(data);
|
18951 |
|
18952 |
|
18953 |
|
18954 | if (stream._writableState.length) throw new Error('Calling transform done when ws.length != 0');
|
18955 |
|
18956 | if (stream._transformState.transforming) throw new Error('Calling transform done when still transforming');
|
18957 |
|
18958 | return stream.push(null);
|
18959 | }
|
18960 |
|
18961 | },{"./_stream_duplex":255,"core-util-is":186,"inherits":226}],259:[function(require,module,exports){
|
18962 | (function (process,global){
|
18963 |
|
18964 |
|
18965 |
|
18966 |
|
18967 |
|
18968 |
|
18969 |
|
18970 |
|
18971 |
|
18972 |
|
18973 |
|
18974 |
|
18975 |
|
18976 |
|
18977 |
|
18978 |
|
18979 |
|
18980 |
|
18981 |
|
18982 |
|
18983 |
|
18984 |
|
18985 |
|
18986 |
|
18987 |
|
18988 | 'use strict';
|
18989 |
|
18990 |
|
18991 |
|
18992 | var _defineProperty = require('babel-runtime/core-js/object/define-property');
|
18993 |
|
18994 | var _defineProperty2 = _interopRequireDefault(_defineProperty);
|
18995 |
|
18996 | var _hasInstance = require('babel-runtime/core-js/symbol/has-instance');
|
18997 |
|
18998 | var _hasInstance2 = _interopRequireDefault(_hasInstance);
|
18999 |
|
19000 | var _symbol = require('babel-runtime/core-js/symbol');
|
19001 |
|
19002 | var _symbol2 = _interopRequireDefault(_symbol);
|
19003 |
|
19004 | var _setImmediate2 = require('babel-runtime/core-js/set-immediate');
|
19005 |
|
19006 | var _setImmediate3 = _interopRequireDefault(_setImmediate2);
|
19007 |
|
19008 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
19009 |
|
19010 | var pna = require('process-nextick-args');
|
19011 |
|
19012 |
|
19013 | module.exports = Writable;
|
19014 |
|
19015 |
|
19016 | function WriteReq(chunk, encoding, cb) {
|
19017 | this.chunk = chunk;
|
19018 | this.encoding = encoding;
|
19019 | this.callback = cb;
|
19020 | this.next = null;
|
19021 | }
|
19022 |
|
19023 |
|
19024 |
|
19025 | function CorkedRequest(state) {
|
19026 | var _this = this;
|
19027 |
|
19028 | this.next = null;
|
19029 | this.entry = null;
|
19030 | this.finish = function () {
|
19031 | onCorkedFinish(_this, state);
|
19032 | };
|
19033 | }
|
19034 |
|
19035 |
|
19036 |
|
19037 | var asyncWrite = !process.browser && ['v0.10', 'v0.9.'].indexOf(process.version.slice(0, 5)) > -1 ? _setImmediate3.default : pna.nextTick;
|
19038 |
|
19039 |
|
19040 |
|
19041 | var Duplex;
|
19042 |
|
19043 |
|
19044 | Writable.WritableState = WritableState;
|
19045 |
|
19046 |
|
19047 | var util = require('core-util-is');
|
19048 | util.inherits = require('inherits');
|
19049 |
|
19050 |
|
19051 |
|
19052 | var internalUtil = {
|
19053 | deprecate: require('util-deprecate')
|
19054 | };
|
19055 |
|
19056 |
|
19057 |
|
19058 | var Stream = require('./internal/streams/stream');
|
19059 |
|
19060 |
|
19061 |
|
19062 |
|
19063 | var Buffer = require('safe-buffer').Buffer;
|
19064 | var OurUint8Array = global.Uint8Array || function () {};
|
19065 | function _uint8ArrayToBuffer(chunk) {
|
19066 | return Buffer.from(chunk);
|
19067 | }
|
19068 | function _isUint8Array(obj) {
|
19069 | return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;
|
19070 | }
|
19071 |
|
19072 |
|
19073 |
|
19074 | var destroyImpl = require('./internal/streams/destroy');
|
19075 |
|
19076 | util.inherits(Writable, Stream);
|
19077 |
|
19078 | function nop() {}
|
19079 |
|
19080 | function WritableState(options, stream) {
|
19081 | Duplex = Duplex || require('./_stream_duplex');
|
19082 |
|
19083 | options = options || {};
|
19084 |
|
19085 |
|
19086 |
|
19087 |
|
19088 |
|
19089 |
|
19090 | var isDuplex = stream instanceof Duplex;
|
19091 |
|
19092 |
|
19093 |
|
19094 | this.objectMode = !!options.objectMode;
|
19095 |
|
19096 | if (isDuplex) this.objectMode = this.objectMode || !!options.writableObjectMode;
|
19097 |
|
19098 |
|
19099 |
|
19100 |
|
19101 | var hwm = options.highWaterMark;
|
19102 | var writableHwm = options.writableHighWaterMark;
|
19103 | var defaultHwm = this.objectMode ? 16 : 16 * 1024;
|
19104 |
|
19105 | if (hwm || hwm === 0) this.highWaterMark = hwm;else if (isDuplex && (writableHwm || writableHwm === 0)) this.highWaterMark = writableHwm;else this.highWaterMark = defaultHwm;
|
19106 |
|
19107 |
|
19108 | this.highWaterMark = Math.floor(this.highWaterMark);
|
19109 |
|
19110 |
|
19111 | this.finalCalled = false;
|
19112 |
|
19113 |
|
19114 | this.needDrain = false;
|
19115 |
|
19116 | this.ending = false;
|
19117 |
|
19118 | this.ended = false;
|
19119 |
|
19120 | this.finished = false;
|
19121 |
|
19122 |
|
19123 | this.destroyed = false;
|
19124 |
|
19125 |
|
19126 |
|
19127 |
|
19128 | var noDecode = options.decodeStrings === false;
|
19129 | this.decodeStrings = !noDecode;
|
19130 |
|
19131 |
|
19132 |
|
19133 |
|
19134 | this.defaultEncoding = options.defaultEncoding || 'utf8';
|
19135 |
|
19136 |
|
19137 |
|
19138 |
|
19139 | this.length = 0;
|
19140 |
|
19141 |
|
19142 | this.writing = false;
|
19143 |
|
19144 |
|
19145 | this.corked = 0;
|
19146 |
|
19147 |
|
19148 |
|
19149 |
|
19150 |
|
19151 | this.sync = true;
|
19152 |
|
19153 |
|
19154 |
|
19155 |
|
19156 | this.bufferProcessing = false;
|
19157 |
|
19158 |
|
19159 | this.onwrite = function (er) {
|
19160 | onwrite(stream, er);
|
19161 | };
|
19162 |
|
19163 |
|
19164 | this.writecb = null;
|
19165 |
|
19166 |
|
19167 | this.writelen = 0;
|
19168 |
|
19169 | this.bufferedRequest = null;
|
19170 | this.lastBufferedRequest = null;
|
19171 |
|
19172 |
|
19173 |
|
19174 | this.pendingcb = 0;
|
19175 |
|
19176 |
|
19177 |
|
19178 | this.prefinished = false;
|
19179 |
|
19180 |
|
19181 | this.errorEmitted = false;
|
19182 |
|
19183 |
|
19184 | this.bufferedRequestCount = 0;
|
19185 |
|
19186 |
|
19187 |
|
19188 | this.corkedRequestsFree = new CorkedRequest(this);
|
19189 | }
|
19190 |
|
19191 | WritableState.prototype.getBuffer = function getBuffer() {
|
19192 | var current = this.bufferedRequest;
|
19193 | var out = [];
|
19194 | while (current) {
|
19195 | out.push(current);
|
19196 | current = current.next;
|
19197 | }
|
19198 | return out;
|
19199 | };
|
19200 |
|
19201 | (function () {
|
19202 | try {
|
19203 | Object.defineProperty(WritableState.prototype, 'buffer', {
|
19204 | get: internalUtil.deprecate(function () {
|
19205 | return this.getBuffer();
|
19206 | }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.', 'DEP0003')
|
19207 | });
|
19208 | } catch (_) {}
|
19209 | })();
|
19210 |
|
19211 |
|
19212 |
|
19213 | var realHasInstance;
|
19214 | if (typeof _symbol2.default === 'function' && _hasInstance2.default && typeof Function.prototype[_hasInstance2.default] === 'function') {
|
19215 | realHasInstance = Function.prototype[_hasInstance2.default];
|
19216 | (0, _defineProperty2.default)(Writable, _hasInstance2.default, {
|
19217 | value: function value(object) {
|
19218 | if (realHasInstance.call(this, object)) return true;
|
19219 | if (this !== Writable) return false;
|
19220 |
|
19221 | return object && object._writableState instanceof WritableState;
|
19222 | }
|
19223 | });
|
19224 | } else {
|
19225 | realHasInstance = function realHasInstance(object) {
|
19226 | return object instanceof this;
|
19227 | };
|
19228 | }
|
19229 |
|
19230 | function Writable(options) {
|
19231 | Duplex = Duplex || require('./_stream_duplex');
|
19232 |
|
19233 |
|
19234 |
|
19235 |
|
19236 |
|
19237 |
|
19238 |
|
19239 |
|
19240 | if (!realHasInstance.call(Writable, this) && !(this instanceof Duplex)) {
|
19241 | return new Writable(options);
|
19242 | }
|
19243 |
|
19244 | this._writableState = new WritableState(options, this);
|
19245 |
|
19246 |
|
19247 | this.writable = true;
|
19248 |
|
19249 | if (options) {
|
19250 | if (typeof options.write === 'function') this._write = options.write;
|
19251 |
|
19252 | if (typeof options.writev === 'function') this._writev = options.writev;
|
19253 |
|
19254 | if (typeof options.destroy === 'function') this._destroy = options.destroy;
|
19255 |
|
19256 | if (typeof options.final === 'function') this._final = options.final;
|
19257 | }
|
19258 |
|
19259 | Stream.call(this);
|
19260 | }
|
19261 |
|
19262 |
|
19263 | Writable.prototype.pipe = function () {
|
19264 | this.emit('error', new Error('Cannot pipe, not readable'));
|
19265 | };
|
19266 |
|
19267 | function writeAfterEnd(stream, cb) {
|
19268 | var er = new Error('write after end');
|
19269 |
|
19270 | stream.emit('error', er);
|
19271 | pna.nextTick(cb, er);
|
19272 | }
|
19273 |
|
19274 |
|
19275 |
|
19276 |
|
19277 | function validChunk(stream, state, chunk, cb) {
|
19278 | var valid = true;
|
19279 | var er = false;
|
19280 |
|
19281 | if (chunk === null) {
|
19282 | er = new TypeError('May not write null values to stream');
|
19283 | } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {
|
19284 | er = new TypeError('Invalid non-string/buffer chunk');
|
19285 | }
|
19286 | if (er) {
|
19287 | stream.emit('error', er);
|
19288 | pna.nextTick(cb, er);
|
19289 | valid = false;
|
19290 | }
|
19291 | return valid;
|
19292 | }
|
19293 |
|
19294 | Writable.prototype.write = function (chunk, encoding, cb) {
|
19295 | var state = this._writableState;
|
19296 | var ret = false;
|
19297 | var isBuf = !state.objectMode && _isUint8Array(chunk);
|
19298 |
|
19299 | if (isBuf && !Buffer.isBuffer(chunk)) {
|
19300 | chunk = _uint8ArrayToBuffer(chunk);
|
19301 | }
|
19302 |
|
19303 | if (typeof encoding === 'function') {
|
19304 | cb = encoding;
|
19305 | encoding = null;
|
19306 | }
|
19307 |
|
19308 | if (isBuf) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding;
|
19309 |
|
19310 | if (typeof cb !== 'function') cb = nop;
|
19311 |
|
19312 | if (state.ended) writeAfterEnd(this, cb);else if (isBuf || validChunk(this, state, chunk, cb)) {
|
19313 | state.pendingcb++;
|
19314 | ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb);
|
19315 | }
|
19316 |
|
19317 | return ret;
|
19318 | };
|
19319 |
|
19320 | Writable.prototype.cork = function () {
|
19321 | var state = this._writableState;
|
19322 |
|
19323 | state.corked++;
|
19324 | };
|
19325 |
|
19326 | Writable.prototype.uncork = function () {
|
19327 | var state = this._writableState;
|
19328 |
|
19329 | if (state.corked) {
|
19330 | state.corked--;
|
19331 |
|
19332 | if (!state.writing && !state.corked && !state.finished && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state);
|
19333 | }
|
19334 | };
|
19335 |
|
19336 | Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {
|
19337 |
|
19338 | if (typeof encoding === 'string') encoding = encoding.toLowerCase();
|
19339 | 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);
|
19340 | this._writableState.defaultEncoding = encoding;
|
19341 | return this;
|
19342 | };
|
19343 |
|
19344 | function decodeChunk(state, chunk, encoding) {
|
19345 | if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') {
|
19346 | chunk = Buffer.from(chunk, encoding);
|
19347 | }
|
19348 | return chunk;
|
19349 | }
|
19350 |
|
19351 | Object.defineProperty(Writable.prototype, 'writableHighWaterMark', {
|
19352 |
|
19353 |
|
19354 |
|
19355 | enumerable: false,
|
19356 | get: function get() {
|
19357 | return this._writableState.highWaterMark;
|
19358 | }
|
19359 | });
|
19360 |
|
19361 |
|
19362 |
|
19363 |
|
19364 | function writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) {
|
19365 | if (!isBuf) {
|
19366 | var newChunk = decodeChunk(state, chunk, encoding);
|
19367 | if (chunk !== newChunk) {
|
19368 | isBuf = true;
|
19369 | encoding = 'buffer';
|
19370 | chunk = newChunk;
|
19371 | }
|
19372 | }
|
19373 | var len = state.objectMode ? 1 : chunk.length;
|
19374 |
|
19375 | state.length += len;
|
19376 |
|
19377 | var ret = state.length < state.highWaterMark;
|
19378 |
|
19379 | if (!ret) state.needDrain = true;
|
19380 |
|
19381 | if (state.writing || state.corked) {
|
19382 | var last = state.lastBufferedRequest;
|
19383 | state.lastBufferedRequest = {
|
19384 | chunk: chunk,
|
19385 | encoding: encoding,
|
19386 | isBuf: isBuf,
|
19387 | callback: cb,
|
19388 | next: null
|
19389 | };
|
19390 | if (last) {
|
19391 | last.next = state.lastBufferedRequest;
|
19392 | } else {
|
19393 | state.bufferedRequest = state.lastBufferedRequest;
|
19394 | }
|
19395 | state.bufferedRequestCount += 1;
|
19396 | } else {
|
19397 | doWrite(stream, state, false, len, chunk, encoding, cb);
|
19398 | }
|
19399 |
|
19400 | return ret;
|
19401 | }
|
19402 |
|
19403 | function doWrite(stream, state, writev, len, chunk, encoding, cb) {
|
19404 | state.writelen = len;
|
19405 | state.writecb = cb;
|
19406 | state.writing = true;
|
19407 | state.sync = true;
|
19408 | if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite);
|
19409 | state.sync = false;
|
19410 | }
|
19411 |
|
19412 | function onwriteError(stream, state, sync, er, cb) {
|
19413 | --state.pendingcb;
|
19414 |
|
19415 | if (sync) {
|
19416 |
|
19417 |
|
19418 | pna.nextTick(cb, er);
|
19419 |
|
19420 |
|
19421 | pna.nextTick(finishMaybe, stream, state);
|
19422 | stream._writableState.errorEmitted = true;
|
19423 | stream.emit('error', er);
|
19424 | } else {
|
19425 |
|
19426 |
|
19427 | cb(er);
|
19428 | stream._writableState.errorEmitted = true;
|
19429 | stream.emit('error', er);
|
19430 |
|
19431 |
|
19432 | finishMaybe(stream, state);
|
19433 | }
|
19434 | }
|
19435 |
|
19436 | function onwriteStateUpdate(state) {
|
19437 | state.writing = false;
|
19438 | state.writecb = null;
|
19439 | state.length -= state.writelen;
|
19440 | state.writelen = 0;
|
19441 | }
|
19442 |
|
19443 | function onwrite(stream, er) {
|
19444 | var state = stream._writableState;
|
19445 | var sync = state.sync;
|
19446 | var cb = state.writecb;
|
19447 |
|
19448 | onwriteStateUpdate(state);
|
19449 |
|
19450 | if (er) onwriteError(stream, state, sync, er, cb);else {
|
19451 |
|
19452 | var finished = needFinish(state);
|
19453 |
|
19454 | if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) {
|
19455 | clearBuffer(stream, state);
|
19456 | }
|
19457 |
|
19458 | if (sync) {
|
19459 |
|
19460 | asyncWrite(afterWrite, stream, state, finished, cb);
|
19461 |
|
19462 | } else {
|
19463 | afterWrite(stream, state, finished, cb);
|
19464 | }
|
19465 | }
|
19466 | }
|
19467 |
|
19468 | function afterWrite(stream, state, finished, cb) {
|
19469 | if (!finished) onwriteDrain(stream, state);
|
19470 | state.pendingcb--;
|
19471 | cb();
|
19472 | finishMaybe(stream, state);
|
19473 | }
|
19474 |
|
19475 |
|
19476 |
|
19477 |
|
19478 | function onwriteDrain(stream, state) {
|
19479 | if (state.length === 0 && state.needDrain) {
|
19480 | state.needDrain = false;
|
19481 | stream.emit('drain');
|
19482 | }
|
19483 | }
|
19484 |
|
19485 |
|
19486 | function clearBuffer(stream, state) {
|
19487 | state.bufferProcessing = true;
|
19488 | var entry = state.bufferedRequest;
|
19489 |
|
19490 | if (stream._writev && entry && entry.next) {
|
19491 |
|
19492 | var l = state.bufferedRequestCount;
|
19493 | var buffer = new Array(l);
|
19494 | var holder = state.corkedRequestsFree;
|
19495 | holder.entry = entry;
|
19496 |
|
19497 | var count = 0;
|
19498 | var allBuffers = true;
|
19499 | while (entry) {
|
19500 | buffer[count] = entry;
|
19501 | if (!entry.isBuf) allBuffers = false;
|
19502 | entry = entry.next;
|
19503 | count += 1;
|
19504 | }
|
19505 | buffer.allBuffers = allBuffers;
|
19506 |
|
19507 | doWrite(stream, state, true, state.length, buffer, '', holder.finish);
|
19508 |
|
19509 |
|
19510 |
|
19511 | state.pendingcb++;
|
19512 | state.lastBufferedRequest = null;
|
19513 | if (holder.next) {
|
19514 | state.corkedRequestsFree = holder.next;
|
19515 | holder.next = null;
|
19516 | } else {
|
19517 | state.corkedRequestsFree = new CorkedRequest(state);
|
19518 | }
|
19519 | state.bufferedRequestCount = 0;
|
19520 | } else {
|
19521 |
|
19522 | while (entry) {
|
19523 | var chunk = entry.chunk;
|
19524 | var encoding = entry.encoding;
|
19525 | var cb = entry.callback;
|
19526 | var len = state.objectMode ? 1 : chunk.length;
|
19527 |
|
19528 | doWrite(stream, state, false, len, chunk, encoding, cb);
|
19529 | entry = entry.next;
|
19530 | state.bufferedRequestCount--;
|
19531 |
|
19532 |
|
19533 |
|
19534 |
|
19535 | if (state.writing) {
|
19536 | break;
|
19537 | }
|
19538 | }
|
19539 |
|
19540 | if (entry === null) state.lastBufferedRequest = null;
|
19541 | }
|
19542 |
|
19543 | state.bufferedRequest = entry;
|
19544 | state.bufferProcessing = false;
|
19545 | }
|
19546 |
|
19547 | Writable.prototype._write = function (chunk, encoding, cb) {
|
19548 | cb(new Error('_write() is not implemented'));
|
19549 | };
|
19550 |
|
19551 | Writable.prototype._writev = null;
|
19552 |
|
19553 | Writable.prototype.end = function (chunk, encoding, cb) {
|
19554 | var state = this._writableState;
|
19555 |
|
19556 | if (typeof chunk === 'function') {
|
19557 | cb = chunk;
|
19558 | chunk = null;
|
19559 | encoding = null;
|
19560 | } else if (typeof encoding === 'function') {
|
19561 | cb = encoding;
|
19562 | encoding = null;
|
19563 | }
|
19564 |
|
19565 | if (chunk !== null && chunk !== undefined) this.write(chunk, encoding);
|
19566 |
|
19567 |
|
19568 | if (state.corked) {
|
19569 | state.corked = 1;
|
19570 | this.uncork();
|
19571 | }
|
19572 |
|
19573 |
|
19574 | if (!state.ending && !state.finished) endWritable(this, state, cb);
|
19575 | };
|
19576 |
|
19577 | function needFinish(state) {
|
19578 | return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing;
|
19579 | }
|
19580 | function callFinal(stream, state) {
|
19581 | stream._final(function (err) {
|
19582 | state.pendingcb--;
|
19583 | if (err) {
|
19584 | stream.emit('error', err);
|
19585 | }
|
19586 | state.prefinished = true;
|
19587 | stream.emit('prefinish');
|
19588 | finishMaybe(stream, state);
|
19589 | });
|
19590 | }
|
19591 | function prefinish(stream, state) {
|
19592 | if (!state.prefinished && !state.finalCalled) {
|
19593 | if (typeof stream._final === 'function') {
|
19594 | state.pendingcb++;
|
19595 | state.finalCalled = true;
|
19596 | pna.nextTick(callFinal, stream, state);
|
19597 | } else {
|
19598 | state.prefinished = true;
|
19599 | stream.emit('prefinish');
|
19600 | }
|
19601 | }
|
19602 | }
|
19603 |
|
19604 | function finishMaybe(stream, state) {
|
19605 | var need = needFinish(state);
|
19606 | if (need) {
|
19607 | prefinish(stream, state);
|
19608 | if (state.pendingcb === 0) {
|
19609 | state.finished = true;
|
19610 | stream.emit('finish');
|
19611 | }
|
19612 | }
|
19613 | return need;
|
19614 | }
|
19615 |
|
19616 | function endWritable(stream, state, cb) {
|
19617 | state.ending = true;
|
19618 | finishMaybe(stream, state);
|
19619 | if (cb) {
|
19620 | if (state.finished) pna.nextTick(cb);else stream.once('finish', cb);
|
19621 | }
|
19622 | state.ended = true;
|
19623 | stream.writable = false;
|
19624 | }
|
19625 |
|
19626 | function onCorkedFinish(corkReq, state, err) {
|
19627 | var entry = corkReq.entry;
|
19628 | corkReq.entry = null;
|
19629 | while (entry) {
|
19630 | var cb = entry.callback;
|
19631 | state.pendingcb--;
|
19632 | cb(err);
|
19633 | entry = entry.next;
|
19634 | }
|
19635 | if (state.corkedRequestsFree) {
|
19636 | state.corkedRequestsFree.next = corkReq;
|
19637 | } else {
|
19638 | state.corkedRequestsFree = corkReq;
|
19639 | }
|
19640 | }
|
19641 |
|
19642 | Object.defineProperty(Writable.prototype, 'destroyed', {
|
19643 | get: function get() {
|
19644 | if (this._writableState === undefined) {
|
19645 | return false;
|
19646 | }
|
19647 | return this._writableState.destroyed;
|
19648 | },
|
19649 | set: function set(value) {
|
19650 |
|
19651 |
|
19652 | if (!this._writableState) {
|
19653 | return;
|
19654 | }
|
19655 |
|
19656 |
|
19657 |
|
19658 | this._writableState.destroyed = value;
|
19659 | }
|
19660 | });
|
19661 |
|
19662 | Writable.prototype.destroy = destroyImpl.destroy;
|
19663 | Writable.prototype._undestroy = destroyImpl.undestroy;
|
19664 | Writable.prototype._destroy = function (err, cb) {
|
19665 | this.end();
|
19666 | cb(err);
|
19667 | };
|
19668 |
|
19669 | }).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
19670 | },{"./_stream_duplex":255,"./internal/streams/destroy":261,"./internal/streams/stream":262,"_process":249,"babel-runtime/core-js/object/define-property":51,"babel-runtime/core-js/set-immediate":57,"babel-runtime/core-js/symbol":59,"babel-runtime/core-js/symbol/has-instance":60,"core-util-is":186,"inherits":226,"process-nextick-args":248,"safe-buffer":269,"util-deprecate":281}],260:[function(require,module,exports){
|
19671 | 'use strict';
|
19672 |
|
19673 | function _classCallCheck(instance, Constructor) {
|
19674 | if (!(instance instanceof Constructor)) {
|
19675 | throw new TypeError("Cannot call a class as a function");
|
19676 | }
|
19677 | }
|
19678 |
|
19679 | var Buffer = require('safe-buffer').Buffer;
|
19680 | var util = require('util');
|
19681 |
|
19682 | function copyBuffer(src, target, offset) {
|
19683 | src.copy(target, offset);
|
19684 | }
|
19685 |
|
19686 | module.exports = function () {
|
19687 | function BufferList() {
|
19688 | _classCallCheck(this, BufferList);
|
19689 |
|
19690 | this.head = null;
|
19691 | this.tail = null;
|
19692 | this.length = 0;
|
19693 | }
|
19694 |
|
19695 | BufferList.prototype.push = function push(v) {
|
19696 | var entry = { data: v, next: null };
|
19697 | if (this.length > 0) this.tail.next = entry;else this.head = entry;
|
19698 | this.tail = entry;
|
19699 | ++this.length;
|
19700 | };
|
19701 |
|
19702 | BufferList.prototype.unshift = function unshift(v) {
|
19703 | var entry = { data: v, next: this.head };
|
19704 | if (this.length === 0) this.tail = entry;
|
19705 | this.head = entry;
|
19706 | ++this.length;
|
19707 | };
|
19708 |
|
19709 | BufferList.prototype.shift = function shift() {
|
19710 | if (this.length === 0) return;
|
19711 | var ret = this.head.data;
|
19712 | if (this.length === 1) this.head = this.tail = null;else this.head = this.head.next;
|
19713 | --this.length;
|
19714 | return ret;
|
19715 | };
|
19716 |
|
19717 | BufferList.prototype.clear = function clear() {
|
19718 | this.head = this.tail = null;
|
19719 | this.length = 0;
|
19720 | };
|
19721 |
|
19722 | BufferList.prototype.join = function join(s) {
|
19723 | if (this.length === 0) return '';
|
19724 | var p = this.head;
|
19725 | var ret = '' + p.data;
|
19726 | while (p = p.next) {
|
19727 | ret += s + p.data;
|
19728 | }return ret;
|
19729 | };
|
19730 |
|
19731 | BufferList.prototype.concat = function concat(n) {
|
19732 | if (this.length === 0) return Buffer.alloc(0);
|
19733 | if (this.length === 1) return this.head.data;
|
19734 | var ret = Buffer.allocUnsafe(n >>> 0);
|
19735 | var p = this.head;
|
19736 | var i = 0;
|
19737 | while (p) {
|
19738 | copyBuffer(p.data, ret, i);
|
19739 | i += p.data.length;
|
19740 | p = p.next;
|
19741 | }
|
19742 | return ret;
|
19743 | };
|
19744 |
|
19745 | return BufferList;
|
19746 | }();
|
19747 |
|
19748 | if (util && util.inspect && util.inspect.custom) {
|
19749 | module.exports.prototype[util.inspect.custom] = function () {
|
19750 | var obj = util.inspect({ length: this.length });
|
19751 | return this.constructor.name + ' ' + obj;
|
19752 | };
|
19753 | }
|
19754 |
|
19755 | },{"safe-buffer":269,"util":68}],261:[function(require,module,exports){
|
19756 | 'use strict';
|
19757 |
|
19758 |
|
19759 |
|
19760 | var pna = require('process-nextick-args');
|
19761 |
|
19762 |
|
19763 |
|
19764 | function destroy(err, cb) {
|
19765 | var _this = this;
|
19766 |
|
19767 | var readableDestroyed = this._readableState && this._readableState.destroyed;
|
19768 | var writableDestroyed = this._writableState && this._writableState.destroyed;
|
19769 |
|
19770 | if (readableDestroyed || writableDestroyed) {
|
19771 | if (cb) {
|
19772 | cb(err);
|
19773 | } else if (err && (!this._writableState || !this._writableState.errorEmitted)) {
|
19774 | pna.nextTick(emitErrorNT, this, err);
|
19775 | }
|
19776 | return this;
|
19777 | }
|
19778 |
|
19779 |
|
19780 |
|
19781 |
|
19782 | if (this._readableState) {
|
19783 | this._readableState.destroyed = true;
|
19784 | }
|
19785 |
|
19786 |
|
19787 | if (this._writableState) {
|
19788 | this._writableState.destroyed = true;
|
19789 | }
|
19790 |
|
19791 | this._destroy(err || null, function (err) {
|
19792 | if (!cb && err) {
|
19793 | pna.nextTick(emitErrorNT, _this, err);
|
19794 | if (_this._writableState) {
|
19795 | _this._writableState.errorEmitted = true;
|
19796 | }
|
19797 | } else if (cb) {
|
19798 | cb(err);
|
19799 | }
|
19800 | });
|
19801 |
|
19802 | return this;
|
19803 | }
|
19804 |
|
19805 | function undestroy() {
|
19806 | if (this._readableState) {
|
19807 | this._readableState.destroyed = false;
|
19808 | this._readableState.reading = false;
|
19809 | this._readableState.ended = false;
|
19810 | this._readableState.endEmitted = false;
|
19811 | }
|
19812 |
|
19813 | if (this._writableState) {
|
19814 | this._writableState.destroyed = false;
|
19815 | this._writableState.ended = false;
|
19816 | this._writableState.ending = false;
|
19817 | this._writableState.finished = false;
|
19818 | this._writableState.errorEmitted = false;
|
19819 | }
|
19820 | }
|
19821 |
|
19822 | function emitErrorNT(self, err) {
|
19823 | self.emit('error', err);
|
19824 | }
|
19825 |
|
19826 | module.exports = {
|
19827 | destroy: destroy,
|
19828 | undestroy: undestroy
|
19829 | };
|
19830 |
|
19831 | },{"process-nextick-args":248}],262:[function(require,module,exports){
|
19832 | 'use strict';
|
19833 |
|
19834 | module.exports = require('events').EventEmitter;
|
19835 |
|
19836 | },{"events":216}],263:[function(require,module,exports){
|
19837 | module.exports = require('./readable').PassThrough
|
19838 |
|
19839 | },{"./readable":264}],264:[function(require,module,exports){
|
19840 | exports = module.exports = require('./lib/_stream_readable.js');
|
19841 | exports.Stream = exports;
|
19842 | exports.Readable = exports;
|
19843 | exports.Writable = require('./lib/_stream_writable.js');
|
19844 | exports.Duplex = require('./lib/_stream_duplex.js');
|
19845 | exports.Transform = require('./lib/_stream_transform.js');
|
19846 | exports.PassThrough = require('./lib/_stream_passthrough.js');
|
19847 |
|
19848 | },{"./lib/_stream_duplex.js":255,"./lib/_stream_passthrough.js":256,"./lib/_stream_readable.js":257,"./lib/_stream_transform.js":258,"./lib/_stream_writable.js":259}],265:[function(require,module,exports){
|
19849 | module.exports = require('./readable').Transform
|
19850 |
|
19851 | },{"./readable":264}],266:[function(require,module,exports){
|
19852 | module.exports = require('./lib/_stream_writable.js');
|
19853 |
|
19854 | },{"./lib/_stream_writable.js":259}],267:[function(require,module,exports){
|
19855 |
|
19856 |
|
19857 |
|
19858 |
|
19859 |
|
19860 |
|
19861 |
|
19862 |
|
19863 |
|
19864 | var g = (function() { return this })() || Function("return this")();
|
19865 |
|
19866 |
|
19867 |
|
19868 | var hadRuntime = g.regeneratorRuntime &&
|
19869 | Object.getOwnPropertyNames(g).indexOf("regeneratorRuntime") >= 0;
|
19870 |
|
19871 |
|
19872 | var oldRuntime = hadRuntime && g.regeneratorRuntime;
|
19873 |
|
19874 |
|
19875 | g.regeneratorRuntime = undefined;
|
19876 |
|
19877 | module.exports = require("./runtime");
|
19878 |
|
19879 | if (hadRuntime) {
|
19880 |
|
19881 | g.regeneratorRuntime = oldRuntime;
|
19882 | } else {
|
19883 |
|
19884 | try {
|
19885 | delete g.regeneratorRuntime;
|
19886 | } catch(e) {
|
19887 | g.regeneratorRuntime = undefined;
|
19888 | }
|
19889 | }
|
19890 |
|
19891 | },{"./runtime":268}],268:[function(require,module,exports){
|
19892 |
|
19893 |
|
19894 |
|
19895 |
|
19896 |
|
19897 |
|
19898 |
|
19899 | !(function(global) {
|
19900 | "use strict";
|
19901 |
|
19902 | var Op = Object.prototype;
|
19903 | var hasOwn = Op.hasOwnProperty;
|
19904 | var undefined;
|
19905 | var $Symbol = typeof Symbol === "function" ? Symbol : {};
|
19906 | var iteratorSymbol = $Symbol.iterator || "@@iterator";
|
19907 | var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
|
19908 | var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
|
19909 |
|
19910 | var inModule = typeof module === "object";
|
19911 | var runtime = global.regeneratorRuntime;
|
19912 | if (runtime) {
|
19913 | if (inModule) {
|
19914 |
|
19915 |
|
19916 | module.exports = runtime;
|
19917 | }
|
19918 |
|
19919 |
|
19920 | return;
|
19921 | }
|
19922 |
|
19923 |
|
19924 |
|
19925 | runtime = global.regeneratorRuntime = inModule ? module.exports : {};
|
19926 |
|
19927 | function wrap(innerFn, outerFn, self, tryLocsList) {
|
19928 |
|
19929 | var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
|
19930 | var generator = Object.create(protoGenerator.prototype);
|
19931 | var context = new Context(tryLocsList || []);
|
19932 |
|
19933 |
|
19934 |
|
19935 | generator._invoke = makeInvokeMethod(innerFn, self, context);
|
19936 |
|
19937 | return generator;
|
19938 | }
|
19939 | runtime.wrap = wrap;
|
19940 |
|
19941 |
|
19942 |
|
19943 |
|
19944 |
|
19945 |
|
19946 |
|
19947 |
|
19948 |
|
19949 |
|
19950 |
|
19951 | function tryCatch(fn, obj, arg) {
|
19952 | try {
|
19953 | return { type: "normal", arg: fn.call(obj, arg) };
|
19954 | } catch (err) {
|
19955 | return { type: "throw", arg: err };
|
19956 | }
|
19957 | }
|
19958 |
|
19959 | var GenStateSuspendedStart = "suspendedStart";
|
19960 | var GenStateSuspendedYield = "suspendedYield";
|
19961 | var GenStateExecuting = "executing";
|
19962 | var GenStateCompleted = "completed";
|
19963 |
|
19964 |
|
19965 |
|
19966 | var ContinueSentinel = {};
|
19967 |
|
19968 |
|
19969 |
|
19970 |
|
19971 |
|
19972 | function Generator() {}
|
19973 | function GeneratorFunction() {}
|
19974 | function GeneratorFunctionPrototype() {}
|
19975 |
|
19976 |
|
19977 |
|
19978 | var IteratorPrototype = {};
|
19979 | IteratorPrototype[iteratorSymbol] = function () {
|
19980 | return this;
|
19981 | };
|
19982 |
|
19983 | var getProto = Object.getPrototypeOf;
|
19984 | var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
|
19985 | if (NativeIteratorPrototype &&
|
19986 | NativeIteratorPrototype !== Op &&
|
19987 | hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
|
19988 |
|
19989 |
|
19990 | IteratorPrototype = NativeIteratorPrototype;
|
19991 | }
|
19992 |
|
19993 | var Gp = GeneratorFunctionPrototype.prototype =
|
19994 | Generator.prototype = Object.create(IteratorPrototype);
|
19995 | GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;
|
19996 | GeneratorFunctionPrototype.constructor = GeneratorFunction;
|
19997 | GeneratorFunctionPrototype[toStringTagSymbol] =
|
19998 | GeneratorFunction.displayName = "GeneratorFunction";
|
19999 |
|
20000 |
|
20001 |
|
20002 | function defineIteratorMethods(prototype) {
|
20003 | ["next", "throw", "return"].forEach(function(method) {
|
20004 | prototype[method] = function(arg) {
|
20005 | return this._invoke(method, arg);
|
20006 | };
|
20007 | });
|
20008 | }
|
20009 |
|
20010 | runtime.isGeneratorFunction = function(genFun) {
|
20011 | var ctor = typeof genFun === "function" && genFun.constructor;
|
20012 | return ctor
|
20013 | ? ctor === GeneratorFunction ||
|
20014 |
|
20015 |
|
20016 | (ctor.displayName || ctor.name) === "GeneratorFunction"
|
20017 | : false;
|
20018 | };
|
20019 |
|
20020 | runtime.mark = function(genFun) {
|
20021 | if (Object.setPrototypeOf) {
|
20022 | Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
|
20023 | } else {
|
20024 | genFun.__proto__ = GeneratorFunctionPrototype;
|
20025 | if (!(toStringTagSymbol in genFun)) {
|
20026 | genFun[toStringTagSymbol] = "GeneratorFunction";
|
20027 | }
|
20028 | }
|
20029 | genFun.prototype = Object.create(Gp);
|
20030 | return genFun;
|
20031 | };
|
20032 |
|
20033 |
|
20034 |
|
20035 |
|
20036 |
|
20037 | runtime.awrap = function(arg) {
|
20038 | return { __await: arg };
|
20039 | };
|
20040 |
|
20041 | function AsyncIterator(generator) {
|
20042 | function invoke(method, arg, resolve, reject) {
|
20043 | var record = tryCatch(generator[method], generator, arg);
|
20044 | if (record.type === "throw") {
|
20045 | reject(record.arg);
|
20046 | } else {
|
20047 | var result = record.arg;
|
20048 | var value = result.value;
|
20049 | if (value &&
|
20050 | typeof value === "object" &&
|
20051 | hasOwn.call(value, "__await")) {
|
20052 | return Promise.resolve(value.__await).then(function(value) {
|
20053 | invoke("next", value, resolve, reject);
|
20054 | }, function(err) {
|
20055 | invoke("throw", err, resolve, reject);
|
20056 | });
|
20057 | }
|
20058 |
|
20059 | return Promise.resolve(value).then(function(unwrapped) {
|
20060 |
|
20061 |
|
20062 |
|
20063 |
|
20064 |
|
20065 |
|
20066 |
|
20067 |
|
20068 |
|
20069 |
|
20070 |
|
20071 |
|
20072 |
|
20073 |
|
20074 |
|
20075 | result.value = unwrapped;
|
20076 | resolve(result);
|
20077 | }, reject);
|
20078 | }
|
20079 | }
|
20080 |
|
20081 | var previousPromise;
|
20082 |
|
20083 | function enqueue(method, arg) {
|
20084 | function callInvokeWithMethodAndArg() {
|
20085 | return new Promise(function(resolve, reject) {
|
20086 | invoke(method, arg, resolve, reject);
|
20087 | });
|
20088 | }
|
20089 |
|
20090 | return previousPromise =
|
20091 |
|
20092 |
|
20093 |
|
20094 |
|
20095 |
|
20096 |
|
20097 |
|
20098 |
|
20099 |
|
20100 |
|
20101 |
|
20102 |
|
20103 | previousPromise ? previousPromise.then(
|
20104 | callInvokeWithMethodAndArg,
|
20105 |
|
20106 |
|
20107 | callInvokeWithMethodAndArg
|
20108 | ) : callInvokeWithMethodAndArg();
|
20109 | }
|
20110 |
|
20111 |
|
20112 |
|
20113 | this._invoke = enqueue;
|
20114 | }
|
20115 |
|
20116 | defineIteratorMethods(AsyncIterator.prototype);
|
20117 | AsyncIterator.prototype[asyncIteratorSymbol] = function () {
|
20118 | return this;
|
20119 | };
|
20120 | runtime.AsyncIterator = AsyncIterator;
|
20121 |
|
20122 |
|
20123 |
|
20124 |
|
20125 | runtime.async = function(innerFn, outerFn, self, tryLocsList) {
|
20126 | var iter = new AsyncIterator(
|
20127 | wrap(innerFn, outerFn, self, tryLocsList)
|
20128 | );
|
20129 |
|
20130 | return runtime.isGeneratorFunction(outerFn)
|
20131 | ? iter
|
20132 | : iter.next().then(function(result) {
|
20133 | return result.done ? result.value : iter.next();
|
20134 | });
|
20135 | };
|
20136 |
|
20137 | function makeInvokeMethod(innerFn, self, context) {
|
20138 | var state = GenStateSuspendedStart;
|
20139 |
|
20140 | return function invoke(method, arg) {
|
20141 | if (state === GenStateExecuting) {
|
20142 | throw new Error("Generator is already running");
|
20143 | }
|
20144 |
|
20145 | if (state === GenStateCompleted) {
|
20146 | if (method === "throw") {
|
20147 | throw arg;
|
20148 | }
|
20149 |
|
20150 |
|
20151 |
|
20152 | return doneResult();
|
20153 | }
|
20154 |
|
20155 | context.method = method;
|
20156 | context.arg = arg;
|
20157 |
|
20158 | while (true) {
|
20159 | var delegate = context.delegate;
|
20160 | if (delegate) {
|
20161 | var delegateResult = maybeInvokeDelegate(delegate, context);
|
20162 | if (delegateResult) {
|
20163 | if (delegateResult === ContinueSentinel) continue;
|
20164 | return delegateResult;
|
20165 | }
|
20166 | }
|
20167 |
|
20168 | if (context.method === "next") {
|
20169 |
|
20170 |
|
20171 | context.sent = context._sent = context.arg;
|
20172 |
|
20173 | } else if (context.method === "throw") {
|
20174 | if (state === GenStateSuspendedStart) {
|
20175 | state = GenStateCompleted;
|
20176 | throw context.arg;
|
20177 | }
|
20178 |
|
20179 | context.dispatchException(context.arg);
|
20180 |
|
20181 | } else if (context.method === "return") {
|
20182 | context.abrupt("return", context.arg);
|
20183 | }
|
20184 |
|
20185 | state = GenStateExecuting;
|
20186 |
|
20187 | var record = tryCatch(innerFn, self, context);
|
20188 | if (record.type === "normal") {
|
20189 |
|
20190 |
|
20191 | state = context.done
|
20192 | ? GenStateCompleted
|
20193 | : GenStateSuspendedYield;
|
20194 |
|
20195 | if (record.arg === ContinueSentinel) {
|
20196 | continue;
|
20197 | }
|
20198 |
|
20199 | return {
|
20200 | value: record.arg,
|
20201 | done: context.done
|
20202 | };
|
20203 |
|
20204 | } else if (record.type === "throw") {
|
20205 | state = GenStateCompleted;
|
20206 |
|
20207 |
|
20208 | context.method = "throw";
|
20209 | context.arg = record.arg;
|
20210 | }
|
20211 | }
|
20212 | };
|
20213 | }
|
20214 |
|
20215 |
|
20216 |
|
20217 |
|
20218 |
|
20219 | function maybeInvokeDelegate(delegate, context) {
|
20220 | var method = delegate.iterator[context.method];
|
20221 | if (method === undefined) {
|
20222 |
|
20223 |
|
20224 | context.delegate = null;
|
20225 |
|
20226 | if (context.method === "throw") {
|
20227 | if (delegate.iterator.return) {
|
20228 |
|
20229 |
|
20230 | context.method = "return";
|
20231 | context.arg = undefined;
|
20232 | maybeInvokeDelegate(delegate, context);
|
20233 |
|
20234 | if (context.method === "throw") {
|
20235 |
|
20236 |
|
20237 | return ContinueSentinel;
|
20238 | }
|
20239 | }
|
20240 |
|
20241 | context.method = "throw";
|
20242 | context.arg = new TypeError(
|
20243 | "The iterator does not provide a 'throw' method");
|
20244 | }
|
20245 |
|
20246 | return ContinueSentinel;
|
20247 | }
|
20248 |
|
20249 | var record = tryCatch(method, delegate.iterator, context.arg);
|
20250 |
|
20251 | if (record.type === "throw") {
|
20252 | context.method = "throw";
|
20253 | context.arg = record.arg;
|
20254 | context.delegate = null;
|
20255 | return ContinueSentinel;
|
20256 | }
|
20257 |
|
20258 | var info = record.arg;
|
20259 |
|
20260 | if (! info) {
|
20261 | context.method = "throw";
|
20262 | context.arg = new TypeError("iterator result is not an object");
|
20263 | context.delegate = null;
|
20264 | return ContinueSentinel;
|
20265 | }
|
20266 |
|
20267 | if (info.done) {
|
20268 |
|
20269 |
|
20270 | context[delegate.resultName] = info.value;
|
20271 |
|
20272 |
|
20273 | context.next = delegate.nextLoc;
|
20274 |
|
20275 |
|
20276 |
|
20277 |
|
20278 |
|
20279 |
|
20280 |
|
20281 | if (context.method !== "return") {
|
20282 | context.method = "next";
|
20283 | context.arg = undefined;
|
20284 | }
|
20285 |
|
20286 | } else {
|
20287 |
|
20288 | return info;
|
20289 | }
|
20290 |
|
20291 |
|
20292 |
|
20293 | context.delegate = null;
|
20294 | return ContinueSentinel;
|
20295 | }
|
20296 |
|
20297 |
|
20298 |
|
20299 | defineIteratorMethods(Gp);
|
20300 |
|
20301 | Gp[toStringTagSymbol] = "Generator";
|
20302 |
|
20303 |
|
20304 |
|
20305 |
|
20306 |
|
20307 |
|
20308 | Gp[iteratorSymbol] = function() {
|
20309 | return this;
|
20310 | };
|
20311 |
|
20312 | Gp.toString = function() {
|
20313 | return "[object Generator]";
|
20314 | };
|
20315 |
|
20316 | function pushTryEntry(locs) {
|
20317 | var entry = { tryLoc: locs[0] };
|
20318 |
|
20319 | if (1 in locs) {
|
20320 | entry.catchLoc = locs[1];
|
20321 | }
|
20322 |
|
20323 | if (2 in locs) {
|
20324 | entry.finallyLoc = locs[2];
|
20325 | entry.afterLoc = locs[3];
|
20326 | }
|
20327 |
|
20328 | this.tryEntries.push(entry);
|
20329 | }
|
20330 |
|
20331 | function resetTryEntry(entry) {
|
20332 | var record = entry.completion || {};
|
20333 | record.type = "normal";
|
20334 | delete record.arg;
|
20335 | entry.completion = record;
|
20336 | }
|
20337 |
|
20338 | function Context(tryLocsList) {
|
20339 |
|
20340 |
|
20341 |
|
20342 | this.tryEntries = [{ tryLoc: "root" }];
|
20343 | tryLocsList.forEach(pushTryEntry, this);
|
20344 | this.reset(true);
|
20345 | }
|
20346 |
|
20347 | runtime.keys = function(object) {
|
20348 | var keys = [];
|
20349 | for (var key in object) {
|
20350 | keys.push(key);
|
20351 | }
|
20352 | keys.reverse();
|
20353 |
|
20354 |
|
20355 |
|
20356 | return function next() {
|
20357 | while (keys.length) {
|
20358 | var key = keys.pop();
|
20359 | if (key in object) {
|
20360 | next.value = key;
|
20361 | next.done = false;
|
20362 | return next;
|
20363 | }
|
20364 | }
|
20365 |
|
20366 |
|
20367 |
|
20368 |
|
20369 | next.done = true;
|
20370 | return next;
|
20371 | };
|
20372 | };
|
20373 |
|
20374 | function values(iterable) {
|
20375 | if (iterable) {
|
20376 | var iteratorMethod = iterable[iteratorSymbol];
|
20377 | if (iteratorMethod) {
|
20378 | return iteratorMethod.call(iterable);
|
20379 | }
|
20380 |
|
20381 | if (typeof iterable.next === "function") {
|
20382 | return iterable;
|
20383 | }
|
20384 |
|
20385 | if (!isNaN(iterable.length)) {
|
20386 | var i = -1, next = function next() {
|
20387 | while (++i < iterable.length) {
|
20388 | if (hasOwn.call(iterable, i)) {
|
20389 | next.value = iterable[i];
|
20390 | next.done = false;
|
20391 | return next;
|
20392 | }
|
20393 | }
|
20394 |
|
20395 | next.value = undefined;
|
20396 | next.done = true;
|
20397 |
|
20398 | return next;
|
20399 | };
|
20400 |
|
20401 | return next.next = next;
|
20402 | }
|
20403 | }
|
20404 |
|
20405 |
|
20406 | return { next: doneResult };
|
20407 | }
|
20408 | runtime.values = values;
|
20409 |
|
20410 | function doneResult() {
|
20411 | return { value: undefined, done: true };
|
20412 | }
|
20413 |
|
20414 | Context.prototype = {
|
20415 | constructor: Context,
|
20416 |
|
20417 | reset: function(skipTempReset) {
|
20418 | this.prev = 0;
|
20419 | this.next = 0;
|
20420 |
|
20421 |
|
20422 | this.sent = this._sent = undefined;
|
20423 | this.done = false;
|
20424 | this.delegate = null;
|
20425 |
|
20426 | this.method = "next";
|
20427 | this.arg = undefined;
|
20428 |
|
20429 | this.tryEntries.forEach(resetTryEntry);
|
20430 |
|
20431 | if (!skipTempReset) {
|
20432 | for (var name in this) {
|
20433 |
|
20434 | if (name.charAt(0) === "t" &&
|
20435 | hasOwn.call(this, name) &&
|
20436 | !isNaN(+name.slice(1))) {
|
20437 | this[name] = undefined;
|
20438 | }
|
20439 | }
|
20440 | }
|
20441 | },
|
20442 |
|
20443 | stop: function() {
|
20444 | this.done = true;
|
20445 |
|
20446 | var rootEntry = this.tryEntries[0];
|
20447 | var rootRecord = rootEntry.completion;
|
20448 | if (rootRecord.type === "throw") {
|
20449 | throw rootRecord.arg;
|
20450 | }
|
20451 |
|
20452 | return this.rval;
|
20453 | },
|
20454 |
|
20455 | dispatchException: function(exception) {
|
20456 | if (this.done) {
|
20457 | throw exception;
|
20458 | }
|
20459 |
|
20460 | var context = this;
|
20461 | function handle(loc, caught) {
|
20462 | record.type = "throw";
|
20463 | record.arg = exception;
|
20464 | context.next = loc;
|
20465 |
|
20466 | if (caught) {
|
20467 |
|
20468 |
|
20469 | context.method = "next";
|
20470 | context.arg = undefined;
|
20471 | }
|
20472 |
|
20473 | return !! caught;
|
20474 | }
|
20475 |
|
20476 | for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
20477 | var entry = this.tryEntries[i];
|
20478 | var record = entry.completion;
|
20479 |
|
20480 | if (entry.tryLoc === "root") {
|
20481 |
|
20482 |
|
20483 |
|
20484 | return handle("end");
|
20485 | }
|
20486 |
|
20487 | if (entry.tryLoc <= this.prev) {
|
20488 | var hasCatch = hasOwn.call(entry, "catchLoc");
|
20489 | var hasFinally = hasOwn.call(entry, "finallyLoc");
|
20490 |
|
20491 | if (hasCatch && hasFinally) {
|
20492 | if (this.prev < entry.catchLoc) {
|
20493 | return handle(entry.catchLoc, true);
|
20494 | } else if (this.prev < entry.finallyLoc) {
|
20495 | return handle(entry.finallyLoc);
|
20496 | }
|
20497 |
|
20498 | } else if (hasCatch) {
|
20499 | if (this.prev < entry.catchLoc) {
|
20500 | return handle(entry.catchLoc, true);
|
20501 | }
|
20502 |
|
20503 | } else if (hasFinally) {
|
20504 | if (this.prev < entry.finallyLoc) {
|
20505 | return handle(entry.finallyLoc);
|
20506 | }
|
20507 |
|
20508 | } else {
|
20509 | throw new Error("try statement without catch or finally");
|
20510 | }
|
20511 | }
|
20512 | }
|
20513 | },
|
20514 |
|
20515 | abrupt: function(type, arg) {
|
20516 | for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
20517 | var entry = this.tryEntries[i];
|
20518 | if (entry.tryLoc <= this.prev &&
|
20519 | hasOwn.call(entry, "finallyLoc") &&
|
20520 | this.prev < entry.finallyLoc) {
|
20521 | var finallyEntry = entry;
|
20522 | break;
|
20523 | }
|
20524 | }
|
20525 |
|
20526 | if (finallyEntry &&
|
20527 | (type === "break" ||
|
20528 | type === "continue") &&
|
20529 | finallyEntry.tryLoc <= arg &&
|
20530 | arg <= finallyEntry.finallyLoc) {
|
20531 |
|
20532 |
|
20533 | finallyEntry = null;
|
20534 | }
|
20535 |
|
20536 | var record = finallyEntry ? finallyEntry.completion : {};
|
20537 | record.type = type;
|
20538 | record.arg = arg;
|
20539 |
|
20540 | if (finallyEntry) {
|
20541 | this.method = "next";
|
20542 | this.next = finallyEntry.finallyLoc;
|
20543 | return ContinueSentinel;
|
20544 | }
|
20545 |
|
20546 | return this.complete(record);
|
20547 | },
|
20548 |
|
20549 | complete: function(record, afterLoc) {
|
20550 | if (record.type === "throw") {
|
20551 | throw record.arg;
|
20552 | }
|
20553 |
|
20554 | if (record.type === "break" ||
|
20555 | record.type === "continue") {
|
20556 | this.next = record.arg;
|
20557 | } else if (record.type === "return") {
|
20558 | this.rval = this.arg = record.arg;
|
20559 | this.method = "return";
|
20560 | this.next = "end";
|
20561 | } else if (record.type === "normal" && afterLoc) {
|
20562 | this.next = afterLoc;
|
20563 | }
|
20564 |
|
20565 | return ContinueSentinel;
|
20566 | },
|
20567 |
|
20568 | finish: function(finallyLoc) {
|
20569 | for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
20570 | var entry = this.tryEntries[i];
|
20571 | if (entry.finallyLoc === finallyLoc) {
|
20572 | this.complete(entry.completion, entry.afterLoc);
|
20573 | resetTryEntry(entry);
|
20574 | return ContinueSentinel;
|
20575 | }
|
20576 | }
|
20577 | },
|
20578 |
|
20579 | "catch": function(tryLoc) {
|
20580 | for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
20581 | var entry = this.tryEntries[i];
|
20582 | if (entry.tryLoc === tryLoc) {
|
20583 | var record = entry.completion;
|
20584 | if (record.type === "throw") {
|
20585 | var thrown = record.arg;
|
20586 | resetTryEntry(entry);
|
20587 | }
|
20588 | return thrown;
|
20589 | }
|
20590 | }
|
20591 |
|
20592 |
|
20593 |
|
20594 | throw new Error("illegal catch attempt");
|
20595 | },
|
20596 |
|
20597 | delegateYield: function(iterable, resultName, nextLoc) {
|
20598 | this.delegate = {
|
20599 | iterator: values(iterable),
|
20600 | resultName: resultName,
|
20601 | nextLoc: nextLoc
|
20602 | };
|
20603 |
|
20604 | if (this.method === "next") {
|
20605 |
|
20606 |
|
20607 | this.arg = undefined;
|
20608 | }
|
20609 |
|
20610 | return ContinueSentinel;
|
20611 | }
|
20612 | };
|
20613 | })(
|
20614 |
|
20615 |
|
20616 |
|
20617 | (function() { return this })() || Function("return this")()
|
20618 | );
|
20619 |
|
20620 | },{}],269:[function(require,module,exports){
|
20621 |
|
20622 | var buffer = require('buffer')
|
20623 | var Buffer = buffer.Buffer
|
20624 |
|
20625 |
|
20626 | function copyProps (src, dst) {
|
20627 | for (var key in src) {
|
20628 | dst[key] = src[key]
|
20629 | }
|
20630 | }
|
20631 | if (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) {
|
20632 | module.exports = buffer
|
20633 | } else {
|
20634 |
|
20635 | copyProps(buffer, exports)
|
20636 | exports.Buffer = SafeBuffer
|
20637 | }
|
20638 |
|
20639 | function SafeBuffer (arg, encodingOrOffset, length) {
|
20640 | return Buffer(arg, encodingOrOffset, length)
|
20641 | }
|
20642 |
|
20643 |
|
20644 | copyProps(Buffer, SafeBuffer)
|
20645 |
|
20646 | SafeBuffer.from = function (arg, encodingOrOffset, length) {
|
20647 | if (typeof arg === 'number') {
|
20648 | throw new TypeError('Argument must not be a number')
|
20649 | }
|
20650 | return Buffer(arg, encodingOrOffset, length)
|
20651 | }
|
20652 |
|
20653 | SafeBuffer.alloc = function (size, fill, encoding) {
|
20654 | if (typeof size !== 'number') {
|
20655 | throw new TypeError('Argument must be a number')
|
20656 | }
|
20657 | var buf = Buffer(size)
|
20658 | if (fill !== undefined) {
|
20659 | if (typeof encoding === 'string') {
|
20660 | buf.fill(fill, encoding)
|
20661 | } else {
|
20662 | buf.fill(fill)
|
20663 | }
|
20664 | } else {
|
20665 | buf.fill(0)
|
20666 | }
|
20667 | return buf
|
20668 | }
|
20669 |
|
20670 | SafeBuffer.allocUnsafe = function (size) {
|
20671 | if (typeof size !== 'number') {
|
20672 | throw new TypeError('Argument must be a number')
|
20673 | }
|
20674 | return Buffer(size)
|
20675 | }
|
20676 |
|
20677 | SafeBuffer.allocUnsafeSlow = function (size) {
|
20678 | if (typeof size !== 'number') {
|
20679 | throw new TypeError('Argument must be a number')
|
20680 | }
|
20681 | return buffer.SlowBuffer(size)
|
20682 | }
|
20683 |
|
20684 | },{"buffer":70}],270:[function(require,module,exports){
|
20685 | (function (Buffer){
|
20686 | 'use strict';
|
20687 |
|
20688 | var _fromCodePoint = require('babel-runtime/core-js/string/from-code-point');
|
20689 |
|
20690 | var _fromCodePoint2 = _interopRequireDefault(_fromCodePoint);
|
20691 |
|
20692 | var _stringify = require('babel-runtime/core-js/json/stringify');
|
20693 |
|
20694 | var _stringify2 = _interopRequireDefault(_stringify);
|
20695 |
|
20696 | var _typeof2 = require('babel-runtime/helpers/typeof');
|
20697 |
|
20698 | var _typeof3 = _interopRequireDefault(_typeof2);
|
20699 |
|
20700 | var _defineProperty = require('babel-runtime/core-js/object/define-property');
|
20701 |
|
20702 | var _defineProperty2 = _interopRequireDefault(_defineProperty);
|
20703 |
|
20704 | var _keys = require('babel-runtime/core-js/object/keys');
|
20705 |
|
20706 | var _keys2 = _interopRequireDefault(_keys);
|
20707 |
|
20708 | var _create = require('babel-runtime/core-js/object/create');
|
20709 |
|
20710 | var _create2 = _interopRequireDefault(_create);
|
20711 |
|
20712 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
20713 |
|
20714 | ;(function (sax) {
|
20715 |
|
20716 | sax.parser = function (strict, opt) {
|
20717 | return new SAXParser(strict, opt);
|
20718 | };
|
20719 | sax.SAXParser = SAXParser;
|
20720 | sax.SAXStream = SAXStream;
|
20721 | sax.createStream = createStream;
|
20722 |
|
20723 |
|
20724 |
|
20725 |
|
20726 |
|
20727 |
|
20728 |
|
20729 |
|
20730 |
|
20731 |
|
20732 | sax.MAX_BUFFER_LENGTH = 64 * 1024;
|
20733 |
|
20734 | var buffers = ['comment', 'sgmlDecl', 'textNode', 'tagName', 'doctype', 'procInstName', 'procInstBody', 'entity', 'attribName', 'attribValue', 'cdata', 'script'];
|
20735 |
|
20736 | sax.EVENTS = ['text', 'processinginstruction', 'sgmldeclaration', 'doctype', 'comment', 'opentagstart', 'attribute', 'opentag', 'closetag', 'opencdata', 'cdata', 'closecdata', 'error', 'end', 'ready', 'script', 'opennamespace', 'closenamespace'];
|
20737 |
|
20738 | function SAXParser(strict, opt) {
|
20739 | if (!(this instanceof SAXParser)) {
|
20740 | return new SAXParser(strict, opt);
|
20741 | }
|
20742 |
|
20743 | var parser = this;
|
20744 | clearBuffers(parser);
|
20745 | parser.q = parser.c = '';
|
20746 | parser.bufferCheckPosition = sax.MAX_BUFFER_LENGTH;
|
20747 | parser.opt = opt || {};
|
20748 | parser.opt.lowercase = parser.opt.lowercase || parser.opt.lowercasetags;
|
20749 | parser.looseCase = parser.opt.lowercase ? 'toLowerCase' : 'toUpperCase';
|
20750 | parser.tags = [];
|
20751 | parser.closed = parser.closedRoot = parser.sawRoot = false;
|
20752 | parser.tag = parser.error = null;
|
20753 | parser.strict = !!strict;
|
20754 | parser.noscript = !!(strict || parser.opt.noscript);
|
20755 | parser.state = S.BEGIN;
|
20756 | parser.strictEntities = parser.opt.strictEntities;
|
20757 | parser.ENTITIES = parser.strictEntities ? (0, _create2.default)(sax.XML_ENTITIES) : (0, _create2.default)(sax.ENTITIES);
|
20758 | parser.attribList = [];
|
20759 |
|
20760 |
|
20761 |
|
20762 |
|
20763 | if (parser.opt.xmlns) {
|
20764 | parser.ns = (0, _create2.default)(rootNS);
|
20765 | }
|
20766 |
|
20767 |
|
20768 | parser.trackPosition = parser.opt.position !== false;
|
20769 | if (parser.trackPosition) {
|
20770 | parser.position = parser.line = parser.column = 0;
|
20771 | }
|
20772 | emit(parser, 'onready');
|
20773 | }
|
20774 |
|
20775 | if (!_create2.default) {
|
20776 | Object.create = function (o) {
|
20777 | function F() {}
|
20778 | F.prototype = o;
|
20779 | var newf = new F();
|
20780 | return newf;
|
20781 | };
|
20782 | }
|
20783 |
|
20784 | if (!_keys2.default) {
|
20785 | Object.keys = function (o) {
|
20786 | var a = [];
|
20787 | for (var i in o) {
|
20788 | if (o.hasOwnProperty(i)) a.push(i);
|
20789 | }return a;
|
20790 | };
|
20791 | }
|
20792 |
|
20793 | function checkBufferLength(parser) {
|
20794 | var maxAllowed = Math.max(sax.MAX_BUFFER_LENGTH, 10);
|
20795 | var maxActual = 0;
|
20796 | for (var i = 0, l = buffers.length; i < l; i++) {
|
20797 | var len = parser[buffers[i]].length;
|
20798 | if (len > maxAllowed) {
|
20799 |
|
20800 |
|
20801 |
|
20802 |
|
20803 | switch (buffers[i]) {
|
20804 | case 'textNode':
|
20805 | closeText(parser);
|
20806 | break;
|
20807 |
|
20808 | case 'cdata':
|
20809 | emitNode(parser, 'oncdata', parser.cdata);
|
20810 | parser.cdata = '';
|
20811 | break;
|
20812 |
|
20813 | case 'script':
|
20814 | emitNode(parser, 'onscript', parser.script);
|
20815 | parser.script = '';
|
20816 | break;
|
20817 |
|
20818 | default:
|
20819 | error(parser, 'Max buffer length exceeded: ' + buffers[i]);
|
20820 | }
|
20821 | }
|
20822 | maxActual = Math.max(maxActual, len);
|
20823 | }
|
20824 |
|
20825 | var m = sax.MAX_BUFFER_LENGTH - maxActual;
|
20826 | parser.bufferCheckPosition = m + parser.position;
|
20827 | }
|
20828 |
|
20829 | function clearBuffers(parser) {
|
20830 | for (var i = 0, l = buffers.length; i < l; i++) {
|
20831 | parser[buffers[i]] = '';
|
20832 | }
|
20833 | }
|
20834 |
|
20835 | function flushBuffers(parser) {
|
20836 | closeText(parser);
|
20837 | if (parser.cdata !== '') {
|
20838 | emitNode(parser, 'oncdata', parser.cdata);
|
20839 | parser.cdata = '';
|
20840 | }
|
20841 | if (parser.script !== '') {
|
20842 | emitNode(parser, 'onscript', parser.script);
|
20843 | parser.script = '';
|
20844 | }
|
20845 | }
|
20846 |
|
20847 | SAXParser.prototype = {
|
20848 | end: function end() {
|
20849 | _end(this);
|
20850 | },
|
20851 | write: write,
|
20852 | resume: function resume() {
|
20853 | this.error = null;return this;
|
20854 | },
|
20855 | close: function close() {
|
20856 | return this.write(null);
|
20857 | },
|
20858 | flush: function flush() {
|
20859 | flushBuffers(this);
|
20860 | }
|
20861 | };
|
20862 |
|
20863 | var Stream;
|
20864 | try {
|
20865 | Stream = require('stream').Stream;
|
20866 | } catch (ex) {
|
20867 | Stream = function Stream() {};
|
20868 | }
|
20869 |
|
20870 | var streamWraps = sax.EVENTS.filter(function (ev) {
|
20871 | return ev !== 'error' && ev !== 'end';
|
20872 | });
|
20873 |
|
20874 | function createStream(strict, opt) {
|
20875 | return new SAXStream(strict, opt);
|
20876 | }
|
20877 |
|
20878 | function SAXStream(strict, opt) {
|
20879 | if (!(this instanceof SAXStream)) {
|
20880 | return new SAXStream(strict, opt);
|
20881 | }
|
20882 |
|
20883 | Stream.apply(this);
|
20884 |
|
20885 | this._parser = new SAXParser(strict, opt);
|
20886 | this.writable = true;
|
20887 | this.readable = true;
|
20888 |
|
20889 | var me = this;
|
20890 |
|
20891 | this._parser.onend = function () {
|
20892 | me.emit('end');
|
20893 | };
|
20894 |
|
20895 | this._parser.onerror = function (er) {
|
20896 | me.emit('error', er);
|
20897 |
|
20898 |
|
20899 |
|
20900 | me._parser.error = null;
|
20901 | };
|
20902 |
|
20903 | this._decoder = null;
|
20904 |
|
20905 | streamWraps.forEach(function (ev) {
|
20906 | (0, _defineProperty2.default)(me, 'on' + ev, {
|
20907 | get: function get() {
|
20908 | return me._parser['on' + ev];
|
20909 | },
|
20910 | set: function set(h) {
|
20911 | if (!h) {
|
20912 | me.removeAllListeners(ev);
|
20913 | me._parser['on' + ev] = h;
|
20914 | return h;
|
20915 | }
|
20916 | me.on(ev, h);
|
20917 | },
|
20918 | enumerable: true,
|
20919 | configurable: false
|
20920 | });
|
20921 | });
|
20922 | }
|
20923 |
|
20924 | SAXStream.prototype = (0, _create2.default)(Stream.prototype, {
|
20925 | constructor: {
|
20926 | value: SAXStream
|
20927 | }
|
20928 | });
|
20929 |
|
20930 | SAXStream.prototype.write = function (data) {
|
20931 | if (typeof Buffer === 'function' && typeof Buffer.isBuffer === 'function' && Buffer.isBuffer(data)) {
|
20932 | if (!this._decoder) {
|
20933 | var SD = require('string_decoder').StringDecoder;
|
20934 | this._decoder = new SD('utf8');
|
20935 | }
|
20936 | data = this._decoder.write(data);
|
20937 | }
|
20938 |
|
20939 | this._parser.write(data.toString());
|
20940 | this.emit('data', data);
|
20941 | return true;
|
20942 | };
|
20943 |
|
20944 | SAXStream.prototype.end = function (chunk) {
|
20945 | if (chunk && chunk.length) {
|
20946 | this.write(chunk);
|
20947 | }
|
20948 | this._parser.end();
|
20949 | return true;
|
20950 | };
|
20951 |
|
20952 | SAXStream.prototype.on = function (ev, handler) {
|
20953 | var me = this;
|
20954 | if (!me._parser['on' + ev] && streamWraps.indexOf(ev) !== -1) {
|
20955 | me._parser['on' + ev] = function () {
|
20956 | var args = arguments.length === 1 ? [arguments[0]] : Array.apply(null, arguments);
|
20957 | args.splice(0, 0, ev);
|
20958 | me.emit.apply(me, args);
|
20959 | };
|
20960 | }
|
20961 |
|
20962 | return Stream.prototype.on.call(me, ev, handler);
|
20963 | };
|
20964 |
|
20965 |
|
20966 |
|
20967 | var CDATA = '[CDATA[';
|
20968 | var DOCTYPE = 'DOCTYPE';
|
20969 | var XML_NAMESPACE = 'http://www.w3.org/XML/1998/namespace';
|
20970 | var XMLNS_NAMESPACE = 'http://www.w3.org/2000/xmlns/';
|
20971 | var rootNS = { xml: XML_NAMESPACE, xmlns: XMLNS_NAMESPACE
|
20972 |
|
20973 |
|
20974 |
|
20975 |
|
20976 |
|
20977 |
|
20978 |
|
20979 | };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]/;
|
20980 |
|
20981 | 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-]/;
|
20982 |
|
20983 | 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]/;
|
20984 | 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-]/;
|
20985 |
|
20986 | function isWhitespace(c) {
|
20987 | return c === ' ' || c === '\n' || c === '\r' || c === '\t';
|
20988 | }
|
20989 |
|
20990 | function isQuote(c) {
|
20991 | return c === '"' || c === '\'';
|
20992 | }
|
20993 |
|
20994 | function isAttribEnd(c) {
|
20995 | return c === '>' || isWhitespace(c);
|
20996 | }
|
20997 |
|
20998 | function isMatch(regex, c) {
|
20999 | return regex.test(c);
|
21000 | }
|
21001 |
|
21002 | function notMatch(regex, c) {
|
21003 | return !isMatch(regex, c);
|
21004 | }
|
21005 |
|
21006 | var S = 0;
|
21007 | sax.STATE = {
|
21008 | BEGIN: S++,
|
21009 | BEGIN_WHITESPACE: S++,
|
21010 | TEXT: S++,
|
21011 | TEXT_ENTITY: S++,
|
21012 | OPEN_WAKA: S++,
|
21013 | SGML_DECL: S++,
|
21014 | SGML_DECL_QUOTED: S++,
|
21015 | DOCTYPE: S++,
|
21016 | DOCTYPE_QUOTED: S++,
|
21017 | DOCTYPE_DTD: S++,
|
21018 | DOCTYPE_DTD_QUOTED: S++,
|
21019 | COMMENT_STARTING: S++,
|
21020 | COMMENT: S++,
|
21021 | COMMENT_ENDING: S++,
|
21022 | COMMENT_ENDED: S++,
|
21023 | CDATA: S++,
|
21024 | CDATA_ENDING: S++,
|
21025 | CDATA_ENDING_2: S++,
|
21026 | PROC_INST: S++,
|
21027 | PROC_INST_BODY: S++,
|
21028 | PROC_INST_ENDING: S++,
|
21029 | OPEN_TAG: S++,
|
21030 | OPEN_TAG_SLASH: S++,
|
21031 | ATTRIB: S++,
|
21032 | ATTRIB_NAME: S++,
|
21033 | ATTRIB_NAME_SAW_WHITE: S++,
|
21034 | ATTRIB_VALUE: S++,
|
21035 | ATTRIB_VALUE_QUOTED: S++,
|
21036 | ATTRIB_VALUE_CLOSED: S++,
|
21037 | ATTRIB_VALUE_UNQUOTED: S++,
|
21038 | ATTRIB_VALUE_ENTITY_Q: S++,
|
21039 | ATTRIB_VALUE_ENTITY_U: S++,
|
21040 | CLOSE_TAG: S++,
|
21041 | CLOSE_TAG_SAW_WHITE: S++,
|
21042 | SCRIPT: S++,
|
21043 | SCRIPT_ENDING: S++
|
21044 | };
|
21045 |
|
21046 | sax.XML_ENTITIES = {
|
21047 | 'amp': '&',
|
21048 | 'gt': '>',
|
21049 | 'lt': '<',
|
21050 | 'quot': '"',
|
21051 | 'apos': "'"
|
21052 | };
|
21053 |
|
21054 | sax.ENTITIES = {
|
21055 | 'amp': '&',
|
21056 | 'gt': '>',
|
21057 | 'lt': '<',
|
21058 | 'quot': '"',
|
21059 | 'apos': "'",
|
21060 | 'AElig': 198,
|
21061 | 'Aacute': 193,
|
21062 | 'Acirc': 194,
|
21063 | 'Agrave': 192,
|
21064 | 'Aring': 197,
|
21065 | 'Atilde': 195,
|
21066 | 'Auml': 196,
|
21067 | 'Ccedil': 199,
|
21068 | 'ETH': 208,
|
21069 | 'Eacute': 201,
|
21070 | 'Ecirc': 202,
|
21071 | 'Egrave': 200,
|
21072 | 'Euml': 203,
|
21073 | 'Iacute': 205,
|
21074 | 'Icirc': 206,
|
21075 | 'Igrave': 204,
|
21076 | 'Iuml': 207,
|
21077 | 'Ntilde': 209,
|
21078 | 'Oacute': 211,
|
21079 | 'Ocirc': 212,
|
21080 | 'Ograve': 210,
|
21081 | 'Oslash': 216,
|
21082 | 'Otilde': 213,
|
21083 | 'Ouml': 214,
|
21084 | 'THORN': 222,
|
21085 | 'Uacute': 218,
|
21086 | 'Ucirc': 219,
|
21087 | 'Ugrave': 217,
|
21088 | 'Uuml': 220,
|
21089 | 'Yacute': 221,
|
21090 | 'aacute': 225,
|
21091 | 'acirc': 226,
|
21092 | 'aelig': 230,
|
21093 | 'agrave': 224,
|
21094 | 'aring': 229,
|
21095 | 'atilde': 227,
|
21096 | 'auml': 228,
|
21097 | 'ccedil': 231,
|
21098 | 'eacute': 233,
|
21099 | 'ecirc': 234,
|
21100 | 'egrave': 232,
|
21101 | 'eth': 240,
|
21102 | 'euml': 235,
|
21103 | 'iacute': 237,
|
21104 | 'icirc': 238,
|
21105 | 'igrave': 236,
|
21106 | 'iuml': 239,
|
21107 | 'ntilde': 241,
|
21108 | 'oacute': 243,
|
21109 | 'ocirc': 244,
|
21110 | 'ograve': 242,
|
21111 | 'oslash': 248,
|
21112 | 'otilde': 245,
|
21113 | 'ouml': 246,
|
21114 | 'szlig': 223,
|
21115 | 'thorn': 254,
|
21116 | 'uacute': 250,
|
21117 | 'ucirc': 251,
|
21118 | 'ugrave': 249,
|
21119 | 'uuml': 252,
|
21120 | 'yacute': 253,
|
21121 | 'yuml': 255,
|
21122 | 'copy': 169,
|
21123 | 'reg': 174,
|
21124 | 'nbsp': 160,
|
21125 | 'iexcl': 161,
|
21126 | 'cent': 162,
|
21127 | 'pound': 163,
|
21128 | 'curren': 164,
|
21129 | 'yen': 165,
|
21130 | 'brvbar': 166,
|
21131 | 'sect': 167,
|
21132 | 'uml': 168,
|
21133 | 'ordf': 170,
|
21134 | 'laquo': 171,
|
21135 | 'not': 172,
|
21136 | 'shy': 173,
|
21137 | 'macr': 175,
|
21138 | 'deg': 176,
|
21139 | 'plusmn': 177,
|
21140 | 'sup1': 185,
|
21141 | 'sup2': 178,
|
21142 | 'sup3': 179,
|
21143 | 'acute': 180,
|
21144 | 'micro': 181,
|
21145 | 'para': 182,
|
21146 | 'middot': 183,
|
21147 | 'cedil': 184,
|
21148 | 'ordm': 186,
|
21149 | 'raquo': 187,
|
21150 | 'frac14': 188,
|
21151 | 'frac12': 189,
|
21152 | 'frac34': 190,
|
21153 | 'iquest': 191,
|
21154 | 'times': 215,
|
21155 | 'divide': 247,
|
21156 | 'OElig': 338,
|
21157 | 'oelig': 339,
|
21158 | 'Scaron': 352,
|
21159 | 'scaron': 353,
|
21160 | 'Yuml': 376,
|
21161 | 'fnof': 402,
|
21162 | 'circ': 710,
|
21163 | 'tilde': 732,
|
21164 | 'Alpha': 913,
|
21165 | 'Beta': 914,
|
21166 | 'Gamma': 915,
|
21167 | 'Delta': 916,
|
21168 | 'Epsilon': 917,
|
21169 | 'Zeta': 918,
|
21170 | 'Eta': 919,
|
21171 | 'Theta': 920,
|
21172 | 'Iota': 921,
|
21173 | 'Kappa': 922,
|
21174 | 'Lambda': 923,
|
21175 | 'Mu': 924,
|
21176 | 'Nu': 925,
|
21177 | 'Xi': 926,
|
21178 | 'Omicron': 927,
|
21179 | 'Pi': 928,
|
21180 | 'Rho': 929,
|
21181 | 'Sigma': 931,
|
21182 | 'Tau': 932,
|
21183 | 'Upsilon': 933,
|
21184 | 'Phi': 934,
|
21185 | 'Chi': 935,
|
21186 | 'Psi': 936,
|
21187 | 'Omega': 937,
|
21188 | 'alpha': 945,
|
21189 | 'beta': 946,
|
21190 | 'gamma': 947,
|
21191 | 'delta': 948,
|
21192 | 'epsilon': 949,
|
21193 | 'zeta': 950,
|
21194 | 'eta': 951,
|
21195 | 'theta': 952,
|
21196 | 'iota': 953,
|
21197 | 'kappa': 954,
|
21198 | 'lambda': 955,
|
21199 | 'mu': 956,
|
21200 | 'nu': 957,
|
21201 | 'xi': 958,
|
21202 | 'omicron': 959,
|
21203 | 'pi': 960,
|
21204 | 'rho': 961,
|
21205 | 'sigmaf': 962,
|
21206 | 'sigma': 963,
|
21207 | 'tau': 964,
|
21208 | 'upsilon': 965,
|
21209 | 'phi': 966,
|
21210 | 'chi': 967,
|
21211 | 'psi': 968,
|
21212 | 'omega': 969,
|
21213 | 'thetasym': 977,
|
21214 | 'upsih': 978,
|
21215 | 'piv': 982,
|
21216 | 'ensp': 8194,
|
21217 | 'emsp': 8195,
|
21218 | 'thinsp': 8201,
|
21219 | 'zwnj': 8204,
|
21220 | 'zwj': 8205,
|
21221 | 'lrm': 8206,
|
21222 | 'rlm': 8207,
|
21223 | 'ndash': 8211,
|
21224 | 'mdash': 8212,
|
21225 | 'lsquo': 8216,
|
21226 | 'rsquo': 8217,
|
21227 | 'sbquo': 8218,
|
21228 | 'ldquo': 8220,
|
21229 | 'rdquo': 8221,
|
21230 | 'bdquo': 8222,
|
21231 | 'dagger': 8224,
|
21232 | 'Dagger': 8225,
|
21233 | 'bull': 8226,
|
21234 | 'hellip': 8230,
|
21235 | 'permil': 8240,
|
21236 | 'prime': 8242,
|
21237 | 'Prime': 8243,
|
21238 | 'lsaquo': 8249,
|
21239 | 'rsaquo': 8250,
|
21240 | 'oline': 8254,
|
21241 | 'frasl': 8260,
|
21242 | 'euro': 8364,
|
21243 | 'image': 8465,
|
21244 | 'weierp': 8472,
|
21245 | 'real': 8476,
|
21246 | 'trade': 8482,
|
21247 | 'alefsym': 8501,
|
21248 | 'larr': 8592,
|
21249 | 'uarr': 8593,
|
21250 | 'rarr': 8594,
|
21251 | 'darr': 8595,
|
21252 | 'harr': 8596,
|
21253 | 'crarr': 8629,
|
21254 | 'lArr': 8656,
|
21255 | 'uArr': 8657,
|
21256 | 'rArr': 8658,
|
21257 | 'dArr': 8659,
|
21258 | 'hArr': 8660,
|
21259 | 'forall': 8704,
|
21260 | 'part': 8706,
|
21261 | 'exist': 8707,
|
21262 | 'empty': 8709,
|
21263 | 'nabla': 8711,
|
21264 | 'isin': 8712,
|
21265 | 'notin': 8713,
|
21266 | 'ni': 8715,
|
21267 | 'prod': 8719,
|
21268 | 'sum': 8721,
|
21269 | 'minus': 8722,
|
21270 | 'lowast': 8727,
|
21271 | 'radic': 8730,
|
21272 | 'prop': 8733,
|
21273 | 'infin': 8734,
|
21274 | 'ang': 8736,
|
21275 | 'and': 8743,
|
21276 | 'or': 8744,
|
21277 | 'cap': 8745,
|
21278 | 'cup': 8746,
|
21279 | 'int': 8747,
|
21280 | 'there4': 8756,
|
21281 | 'sim': 8764,
|
21282 | 'cong': 8773,
|
21283 | 'asymp': 8776,
|
21284 | 'ne': 8800,
|
21285 | 'equiv': 8801,
|
21286 | 'le': 8804,
|
21287 | 'ge': 8805,
|
21288 | 'sub': 8834,
|
21289 | 'sup': 8835,
|
21290 | 'nsub': 8836,
|
21291 | 'sube': 8838,
|
21292 | 'supe': 8839,
|
21293 | 'oplus': 8853,
|
21294 | 'otimes': 8855,
|
21295 | 'perp': 8869,
|
21296 | 'sdot': 8901,
|
21297 | 'lceil': 8968,
|
21298 | 'rceil': 8969,
|
21299 | 'lfloor': 8970,
|
21300 | 'rfloor': 8971,
|
21301 | 'lang': 9001,
|
21302 | 'rang': 9002,
|
21303 | 'loz': 9674,
|
21304 | 'spades': 9824,
|
21305 | 'clubs': 9827,
|
21306 | 'hearts': 9829,
|
21307 | 'diams': 9830
|
21308 | };
|
21309 |
|
21310 | (0, _keys2.default)(sax.ENTITIES).forEach(function (key) {
|
21311 | var e = sax.ENTITIES[key];
|
21312 | var s = typeof e === 'number' ? String.fromCharCode(e) : e;
|
21313 | sax.ENTITIES[key] = s;
|
21314 | });
|
21315 |
|
21316 | for (var s in sax.STATE) {
|
21317 | sax.STATE[sax.STATE[s]] = s;
|
21318 | }
|
21319 |
|
21320 |
|
21321 | S = sax.STATE;
|
21322 |
|
21323 | function emit(parser, event, data) {
|
21324 | parser[event] && parser[event](data);
|
21325 | }
|
21326 |
|
21327 | function emitNode(parser, nodeType, data) {
|
21328 | if (parser.textNode) closeText(parser);
|
21329 | emit(parser, nodeType, data);
|
21330 | }
|
21331 |
|
21332 | function closeText(parser) {
|
21333 | parser.textNode = textopts(parser.opt, parser.textNode);
|
21334 | if (parser.textNode) emit(parser, 'ontext', parser.textNode);
|
21335 | parser.textNode = '';
|
21336 | }
|
21337 |
|
21338 | function textopts(opt, text) {
|
21339 | if (opt.trim) text = text.trim();
|
21340 | if (opt.normalize) text = text.replace(/\s+/g, ' ');
|
21341 | return text;
|
21342 | }
|
21343 |
|
21344 | function error(parser, er) {
|
21345 | closeText(parser);
|
21346 | if (parser.trackPosition) {
|
21347 | er += '\nLine: ' + parser.line + '\nColumn: ' + parser.column + '\nChar: ' + parser.c;
|
21348 | }
|
21349 | er = new Error(er);
|
21350 | parser.error = er;
|
21351 | emit(parser, 'onerror', er);
|
21352 | return parser;
|
21353 | }
|
21354 |
|
21355 | function _end(parser) {
|
21356 | if (parser.sawRoot && !parser.closedRoot) strictFail(parser, 'Unclosed root tag');
|
21357 | if (parser.state !== S.BEGIN && parser.state !== S.BEGIN_WHITESPACE && parser.state !== S.TEXT) {
|
21358 | error(parser, 'Unexpected end');
|
21359 | }
|
21360 | closeText(parser);
|
21361 | parser.c = '';
|
21362 | parser.closed = true;
|
21363 | emit(parser, 'onend');
|
21364 | SAXParser.call(parser, parser.strict, parser.opt);
|
21365 | return parser;
|
21366 | }
|
21367 |
|
21368 | function strictFail(parser, message) {
|
21369 | if ((typeof parser === 'undefined' ? 'undefined' : (0, _typeof3.default)(parser)) !== 'object' || !(parser instanceof SAXParser)) {
|
21370 | throw new Error('bad call to strictFail');
|
21371 | }
|
21372 | if (parser.strict) {
|
21373 | error(parser, message);
|
21374 | }
|
21375 | }
|
21376 |
|
21377 | function newTag(parser) {
|
21378 | if (!parser.strict) parser.tagName = parser.tagName[parser.looseCase]();
|
21379 | var parent = parser.tags[parser.tags.length - 1] || parser;
|
21380 | var tag = parser.tag = { name: parser.tagName, attributes: {}
|
21381 |
|
21382 |
|
21383 | };if (parser.opt.xmlns) {
|
21384 | tag.ns = parent.ns;
|
21385 | }
|
21386 | parser.attribList.length = 0;
|
21387 | emitNode(parser, 'onopentagstart', tag);
|
21388 | }
|
21389 |
|
21390 | function qname(name, attribute) {
|
21391 | var i = name.indexOf(':');
|
21392 | var qualName = i < 0 ? ['', name] : name.split(':');
|
21393 | var prefix = qualName[0];
|
21394 | var local = qualName[1];
|
21395 |
|
21396 |
|
21397 | if (attribute && name === 'xmlns') {
|
21398 | prefix = 'xmlns';
|
21399 | local = '';
|
21400 | }
|
21401 |
|
21402 | return { prefix: prefix, local: local };
|
21403 | }
|
21404 |
|
21405 | function attrib(parser) {
|
21406 | if (!parser.strict) {
|
21407 | parser.attribName = parser.attribName[parser.looseCase]();
|
21408 | }
|
21409 |
|
21410 | if (parser.attribList.indexOf(parser.attribName) !== -1 || parser.tag.attributes.hasOwnProperty(parser.attribName)) {
|
21411 | parser.attribName = parser.attribValue = '';
|
21412 | return;
|
21413 | }
|
21414 |
|
21415 | if (parser.opt.xmlns) {
|
21416 | var qn = qname(parser.attribName, true);
|
21417 | var prefix = qn.prefix;
|
21418 | var local = qn.local;
|
21419 |
|
21420 | if (prefix === 'xmlns') {
|
21421 |
|
21422 | if (local === 'xml' && parser.attribValue !== XML_NAMESPACE) {
|
21423 | strictFail(parser, 'xml: prefix must be bound to ' + XML_NAMESPACE + '\n' + 'Actual: ' + parser.attribValue);
|
21424 | } else if (local === 'xmlns' && parser.attribValue !== XMLNS_NAMESPACE) {
|
21425 | strictFail(parser, 'xmlns: prefix must be bound to ' + XMLNS_NAMESPACE + '\n' + 'Actual: ' + parser.attribValue);
|
21426 | } else {
|
21427 | var tag = parser.tag;
|
21428 | var parent = parser.tags[parser.tags.length - 1] || parser;
|
21429 | if (tag.ns === parent.ns) {
|
21430 | tag.ns = (0, _create2.default)(parent.ns);
|
21431 | }
|
21432 | tag.ns[local] = parser.attribValue;
|
21433 | }
|
21434 | }
|
21435 |
|
21436 |
|
21437 |
|
21438 |
|
21439 | parser.attribList.push([parser.attribName, parser.attribValue]);
|
21440 | } else {
|
21441 |
|
21442 | parser.tag.attributes[parser.attribName] = parser.attribValue;
|
21443 | emitNode(parser, 'onattribute', {
|
21444 | name: parser.attribName,
|
21445 | value: parser.attribValue
|
21446 | });
|
21447 | }
|
21448 |
|
21449 | parser.attribName = parser.attribValue = '';
|
21450 | }
|
21451 |
|
21452 | function openTag(parser, selfClosing) {
|
21453 | if (parser.opt.xmlns) {
|
21454 |
|
21455 | var tag = parser.tag;
|
21456 |
|
21457 |
|
21458 | var qn = qname(parser.tagName);
|
21459 | tag.prefix = qn.prefix;
|
21460 | tag.local = qn.local;
|
21461 | tag.uri = tag.ns[qn.prefix] || '';
|
21462 |
|
21463 | if (tag.prefix && !tag.uri) {
|
21464 | strictFail(parser, 'Unbound namespace prefix: ' + (0, _stringify2.default)(parser.tagName));
|
21465 | tag.uri = qn.prefix;
|
21466 | }
|
21467 |
|
21468 | var parent = parser.tags[parser.tags.length - 1] || parser;
|
21469 | if (tag.ns && parent.ns !== tag.ns) {
|
21470 | (0, _keys2.default)(tag.ns).forEach(function (p) {
|
21471 | emitNode(parser, 'onopennamespace', {
|
21472 | prefix: p,
|
21473 | uri: tag.ns[p]
|
21474 | });
|
21475 | });
|
21476 | }
|
21477 |
|
21478 |
|
21479 |
|
21480 |
|
21481 | for (var i = 0, l = parser.attribList.length; i < l; i++) {
|
21482 | var nv = parser.attribList[i];
|
21483 | var name = nv[0];
|
21484 | var value = nv[1];
|
21485 | var qualName = qname(name, true);
|
21486 | var prefix = qualName.prefix;
|
21487 | var local = qualName.local;
|
21488 | var uri = prefix === '' ? '' : tag.ns[prefix] || '';
|
21489 | var a = {
|
21490 | name: name,
|
21491 | value: value,
|
21492 | prefix: prefix,
|
21493 | local: local,
|
21494 | uri: uri
|
21495 |
|
21496 |
|
21497 |
|
21498 | };if (prefix && prefix !== 'xmlns' && !uri) {
|
21499 | strictFail(parser, 'Unbound namespace prefix: ' + (0, _stringify2.default)(prefix));
|
21500 | a.uri = prefix;
|
21501 | }
|
21502 | parser.tag.attributes[name] = a;
|
21503 | emitNode(parser, 'onattribute', a);
|
21504 | }
|
21505 | parser.attribList.length = 0;
|
21506 | }
|
21507 |
|
21508 | parser.tag.isSelfClosing = !!selfClosing;
|
21509 |
|
21510 |
|
21511 | parser.sawRoot = true;
|
21512 | parser.tags.push(parser.tag);
|
21513 | emitNode(parser, 'onopentag', parser.tag);
|
21514 | if (!selfClosing) {
|
21515 |
|
21516 | if (!parser.noscript && parser.tagName.toLowerCase() === 'script') {
|
21517 | parser.state = S.SCRIPT;
|
21518 | } else {
|
21519 | parser.state = S.TEXT;
|
21520 | }
|
21521 | parser.tag = null;
|
21522 | parser.tagName = '';
|
21523 | }
|
21524 | parser.attribName = parser.attribValue = '';
|
21525 | parser.attribList.length = 0;
|
21526 | }
|
21527 |
|
21528 | function closeTag(parser) {
|
21529 | if (!parser.tagName) {
|
21530 | strictFail(parser, 'Weird empty close tag.');
|
21531 | parser.textNode += '</>';
|
21532 | parser.state = S.TEXT;
|
21533 | return;
|
21534 | }
|
21535 |
|
21536 | if (parser.script) {
|
21537 | if (parser.tagName !== 'script') {
|
21538 | parser.script += '</' + parser.tagName + '>';
|
21539 | parser.tagName = '';
|
21540 | parser.state = S.SCRIPT;
|
21541 | return;
|
21542 | }
|
21543 | emitNode(parser, 'onscript', parser.script);
|
21544 | parser.script = '';
|
21545 | }
|
21546 |
|
21547 |
|
21548 |
|
21549 | var t = parser.tags.length;
|
21550 | var tagName = parser.tagName;
|
21551 | if (!parser.strict) {
|
21552 | tagName = tagName[parser.looseCase]();
|
21553 | }
|
21554 | var closeTo = tagName;
|
21555 | while (t--) {
|
21556 | var close = parser.tags[t];
|
21557 | if (close.name !== closeTo) {
|
21558 |
|
21559 | strictFail(parser, 'Unexpected close tag');
|
21560 | } else {
|
21561 | break;
|
21562 | }
|
21563 | }
|
21564 |
|
21565 |
|
21566 | if (t < 0) {
|
21567 | strictFail(parser, 'Unmatched closing tag: ' + parser.tagName);
|
21568 | parser.textNode += '</' + parser.tagName + '>';
|
21569 | parser.state = S.TEXT;
|
21570 | return;
|
21571 | }
|
21572 | parser.tagName = tagName;
|
21573 | var s = parser.tags.length;
|
21574 | while (s-- > t) {
|
21575 | var tag = parser.tag = parser.tags.pop();
|
21576 | parser.tagName = parser.tag.name;
|
21577 | emitNode(parser, 'onclosetag', parser.tagName);
|
21578 |
|
21579 | var x = {};
|
21580 | for (var i in tag.ns) {
|
21581 | x[i] = tag.ns[i];
|
21582 | }
|
21583 |
|
21584 | var parent = parser.tags[parser.tags.length - 1] || parser;
|
21585 | if (parser.opt.xmlns && tag.ns !== parent.ns) {
|
21586 |
|
21587 | (0, _keys2.default)(tag.ns).forEach(function (p) {
|
21588 | var n = tag.ns[p];
|
21589 | emitNode(parser, 'onclosenamespace', { prefix: p, uri: n });
|
21590 | });
|
21591 | }
|
21592 | }
|
21593 | if (t === 0) parser.closedRoot = true;
|
21594 | parser.tagName = parser.attribValue = parser.attribName = '';
|
21595 | parser.attribList.length = 0;
|
21596 | parser.state = S.TEXT;
|
21597 | }
|
21598 |
|
21599 | function parseEntity(parser) {
|
21600 | var entity = parser.entity;
|
21601 | var entityLC = entity.toLowerCase();
|
21602 | var num;
|
21603 | var numStr = '';
|
21604 |
|
21605 | if (parser.ENTITIES[entity]) {
|
21606 | return parser.ENTITIES[entity];
|
21607 | }
|
21608 | if (parser.ENTITIES[entityLC]) {
|
21609 | return parser.ENTITIES[entityLC];
|
21610 | }
|
21611 | entity = entityLC;
|
21612 | if (entity.charAt(0) === '#') {
|
21613 | if (entity.charAt(1) === 'x') {
|
21614 | entity = entity.slice(2);
|
21615 | num = parseInt(entity, 16);
|
21616 | numStr = num.toString(16);
|
21617 | } else {
|
21618 | entity = entity.slice(1);
|
21619 | num = parseInt(entity, 10);
|
21620 | numStr = num.toString(10);
|
21621 | }
|
21622 | }
|
21623 | entity = entity.replace(/^0+/, '');
|
21624 | if (isNaN(num) || numStr.toLowerCase() !== entity) {
|
21625 | strictFail(parser, 'Invalid character entity');
|
21626 | return '&' + parser.entity + ';';
|
21627 | }
|
21628 |
|
21629 | return (0, _fromCodePoint2.default)(num);
|
21630 | }
|
21631 |
|
21632 | function beginWhiteSpace(parser, c) {
|
21633 | if (c === '<') {
|
21634 | parser.state = S.OPEN_WAKA;
|
21635 | parser.startTagPosition = parser.position;
|
21636 | } else if (!isWhitespace(c)) {
|
21637 |
|
21638 |
|
21639 | strictFail(parser, 'Non-whitespace before first tag.');
|
21640 | parser.textNode = c;
|
21641 | parser.state = S.TEXT;
|
21642 | }
|
21643 | }
|
21644 |
|
21645 | function charAt(chunk, i) {
|
21646 | var result = '';
|
21647 | if (i < chunk.length) {
|
21648 | result = chunk.charAt(i);
|
21649 | }
|
21650 | return result;
|
21651 | }
|
21652 |
|
21653 | function write(chunk) {
|
21654 | var parser = this;
|
21655 | if (this.error) {
|
21656 | throw this.error;
|
21657 | }
|
21658 | if (parser.closed) {
|
21659 | return error(parser, 'Cannot write after close. Assign an onready handler.');
|
21660 | }
|
21661 | if (chunk === null) {
|
21662 | return _end(parser);
|
21663 | }
|
21664 | if ((typeof chunk === 'undefined' ? 'undefined' : (0, _typeof3.default)(chunk)) === 'object') {
|
21665 | chunk = chunk.toString();
|
21666 | }
|
21667 | var i = 0;
|
21668 | var c = '';
|
21669 | while (true) {
|
21670 | c = charAt(chunk, i++);
|
21671 | parser.c = c;
|
21672 |
|
21673 | if (!c) {
|
21674 | break;
|
21675 | }
|
21676 |
|
21677 | if (parser.trackPosition) {
|
21678 | parser.position++;
|
21679 | if (c === '\n') {
|
21680 | parser.line++;
|
21681 | parser.column = 0;
|
21682 | } else {
|
21683 | parser.column++;
|
21684 | }
|
21685 | }
|
21686 |
|
21687 | switch (parser.state) {
|
21688 | case S.BEGIN:
|
21689 | parser.state = S.BEGIN_WHITESPACE;
|
21690 | if (c === '\uFEFF') {
|
21691 | continue;
|
21692 | }
|
21693 | beginWhiteSpace(parser, c);
|
21694 | continue;
|
21695 |
|
21696 | case S.BEGIN_WHITESPACE:
|
21697 | beginWhiteSpace(parser, c);
|
21698 | continue;
|
21699 |
|
21700 | case S.TEXT:
|
21701 | if (parser.sawRoot && !parser.closedRoot) {
|
21702 | var starti = i - 1;
|
21703 | while (c && c !== '<' && c !== '&') {
|
21704 | c = charAt(chunk, i++);
|
21705 | if (c && parser.trackPosition) {
|
21706 | parser.position++;
|
21707 | if (c === '\n') {
|
21708 | parser.line++;
|
21709 | parser.column = 0;
|
21710 | } else {
|
21711 | parser.column++;
|
21712 | }
|
21713 | }
|
21714 | }
|
21715 | parser.textNode += chunk.substring(starti, i - 1);
|
21716 | }
|
21717 | if (c === '<' && !(parser.sawRoot && parser.closedRoot && !parser.strict)) {
|
21718 | parser.state = S.OPEN_WAKA;
|
21719 | parser.startTagPosition = parser.position;
|
21720 | } else {
|
21721 | if (!isWhitespace(c) && (!parser.sawRoot || parser.closedRoot)) {
|
21722 | strictFail(parser, 'Text data outside of root node.');
|
21723 | }
|
21724 | if (c === '&') {
|
21725 | parser.state = S.TEXT_ENTITY;
|
21726 | } else {
|
21727 | parser.textNode += c;
|
21728 | }
|
21729 | }
|
21730 | continue;
|
21731 |
|
21732 | case S.SCRIPT:
|
21733 |
|
21734 | if (c === '<') {
|
21735 | parser.state = S.SCRIPT_ENDING;
|
21736 | } else {
|
21737 | parser.script += c;
|
21738 | }
|
21739 | continue;
|
21740 |
|
21741 | case S.SCRIPT_ENDING:
|
21742 | if (c === '/') {
|
21743 | parser.state = S.CLOSE_TAG;
|
21744 | } else {
|
21745 | parser.script += '<' + c;
|
21746 | parser.state = S.SCRIPT;
|
21747 | }
|
21748 | continue;
|
21749 |
|
21750 | case S.OPEN_WAKA:
|
21751 |
|
21752 | if (c === '!') {
|
21753 | parser.state = S.SGML_DECL;
|
21754 | parser.sgmlDecl = '';
|
21755 | } else if (isWhitespace(c)) {
|
21756 |
|
21757 | } else if (isMatch(nameStart, c)) {
|
21758 | parser.state = S.OPEN_TAG;
|
21759 | parser.tagName = c;
|
21760 | } else if (c === '/') {
|
21761 | parser.state = S.CLOSE_TAG;
|
21762 | parser.tagName = '';
|
21763 | } else if (c === '?') {
|
21764 | parser.state = S.PROC_INST;
|
21765 | parser.procInstName = parser.procInstBody = '';
|
21766 | } else {
|
21767 | strictFail(parser, 'Unencoded <');
|
21768 |
|
21769 | if (parser.startTagPosition + 1 < parser.position) {
|
21770 | var pad = parser.position - parser.startTagPosition;
|
21771 | c = new Array(pad).join(' ') + c;
|
21772 | }
|
21773 | parser.textNode += '<' + c;
|
21774 | parser.state = S.TEXT;
|
21775 | }
|
21776 | continue;
|
21777 |
|
21778 | case S.SGML_DECL:
|
21779 | if ((parser.sgmlDecl + c).toUpperCase() === CDATA) {
|
21780 | emitNode(parser, 'onopencdata');
|
21781 | parser.state = S.CDATA;
|
21782 | parser.sgmlDecl = '';
|
21783 | parser.cdata = '';
|
21784 | } else if (parser.sgmlDecl + c === '--') {
|
21785 | parser.state = S.COMMENT;
|
21786 | parser.comment = '';
|
21787 | parser.sgmlDecl = '';
|
21788 | } else if ((parser.sgmlDecl + c).toUpperCase() === DOCTYPE) {
|
21789 | parser.state = S.DOCTYPE;
|
21790 | if (parser.doctype || parser.sawRoot) {
|
21791 | strictFail(parser, 'Inappropriately located doctype declaration');
|
21792 | }
|
21793 | parser.doctype = '';
|
21794 | parser.sgmlDecl = '';
|
21795 | } else if (c === '>') {
|
21796 | emitNode(parser, 'onsgmldeclaration', parser.sgmlDecl);
|
21797 | parser.sgmlDecl = '';
|
21798 | parser.state = S.TEXT;
|
21799 | } else if (isQuote(c)) {
|
21800 | parser.state = S.SGML_DECL_QUOTED;
|
21801 | parser.sgmlDecl += c;
|
21802 | } else {
|
21803 | parser.sgmlDecl += c;
|
21804 | }
|
21805 | continue;
|
21806 |
|
21807 | case S.SGML_DECL_QUOTED:
|
21808 | if (c === parser.q) {
|
21809 | parser.state = S.SGML_DECL;
|
21810 | parser.q = '';
|
21811 | }
|
21812 | parser.sgmlDecl += c;
|
21813 | continue;
|
21814 |
|
21815 | case S.DOCTYPE:
|
21816 | if (c === '>') {
|
21817 | parser.state = S.TEXT;
|
21818 | emitNode(parser, 'ondoctype', parser.doctype);
|
21819 | parser.doctype = true;
|
21820 | } else {
|
21821 | parser.doctype += c;
|
21822 | if (c === '[') {
|
21823 | parser.state = S.DOCTYPE_DTD;
|
21824 | } else if (isQuote(c)) {
|
21825 | parser.state = S.DOCTYPE_QUOTED;
|
21826 | parser.q = c;
|
21827 | }
|
21828 | }
|
21829 | continue;
|
21830 |
|
21831 | case S.DOCTYPE_QUOTED:
|
21832 | parser.doctype += c;
|
21833 | if (c === parser.q) {
|
21834 | parser.q = '';
|
21835 | parser.state = S.DOCTYPE;
|
21836 | }
|
21837 | continue;
|
21838 |
|
21839 | case S.DOCTYPE_DTD:
|
21840 | parser.doctype += c;
|
21841 | if (c === ']') {
|
21842 | parser.state = S.DOCTYPE;
|
21843 | } else if (isQuote(c)) {
|
21844 | parser.state = S.DOCTYPE_DTD_QUOTED;
|
21845 | parser.q = c;
|
21846 | }
|
21847 | continue;
|
21848 |
|
21849 | case S.DOCTYPE_DTD_QUOTED:
|
21850 | parser.doctype += c;
|
21851 | if (c === parser.q) {
|
21852 | parser.state = S.DOCTYPE_DTD;
|
21853 | parser.q = '';
|
21854 | }
|
21855 | continue;
|
21856 |
|
21857 | case S.COMMENT:
|
21858 | if (c === '-') {
|
21859 | parser.state = S.COMMENT_ENDING;
|
21860 | } else {
|
21861 | parser.comment += c;
|
21862 | }
|
21863 | continue;
|
21864 |
|
21865 | case S.COMMENT_ENDING:
|
21866 | if (c === '-') {
|
21867 | parser.state = S.COMMENT_ENDED;
|
21868 | parser.comment = textopts(parser.opt, parser.comment);
|
21869 | if (parser.comment) {
|
21870 | emitNode(parser, 'oncomment', parser.comment);
|
21871 | }
|
21872 | parser.comment = '';
|
21873 | } else {
|
21874 | parser.comment += '-' + c;
|
21875 | parser.state = S.COMMENT;
|
21876 | }
|
21877 | continue;
|
21878 |
|
21879 | case S.COMMENT_ENDED:
|
21880 | if (c !== '>') {
|
21881 | strictFail(parser, 'Malformed comment');
|
21882 |
|
21883 |
|
21884 | parser.comment += '--' + c;
|
21885 | parser.state = S.COMMENT;
|
21886 | } else {
|
21887 | parser.state = S.TEXT;
|
21888 | }
|
21889 | continue;
|
21890 |
|
21891 | case S.CDATA:
|
21892 | if (c === ']') {
|
21893 | parser.state = S.CDATA_ENDING;
|
21894 | } else {
|
21895 | parser.cdata += c;
|
21896 | }
|
21897 | continue;
|
21898 |
|
21899 | case S.CDATA_ENDING:
|
21900 | if (c === ']') {
|
21901 | parser.state = S.CDATA_ENDING_2;
|
21902 | } else {
|
21903 | parser.cdata += ']' + c;
|
21904 | parser.state = S.CDATA;
|
21905 | }
|
21906 | continue;
|
21907 |
|
21908 | case S.CDATA_ENDING_2:
|
21909 | if (c === '>') {
|
21910 | if (parser.cdata) {
|
21911 | emitNode(parser, 'oncdata', parser.cdata);
|
21912 | }
|
21913 | emitNode(parser, 'onclosecdata');
|
21914 | parser.cdata = '';
|
21915 | parser.state = S.TEXT;
|
21916 | } else if (c === ']') {
|
21917 | parser.cdata += ']';
|
21918 | } else {
|
21919 | parser.cdata += ']]' + c;
|
21920 | parser.state = S.CDATA;
|
21921 | }
|
21922 | continue;
|
21923 |
|
21924 | case S.PROC_INST:
|
21925 | if (c === '?') {
|
21926 | parser.state = S.PROC_INST_ENDING;
|
21927 | } else if (isWhitespace(c)) {
|
21928 | parser.state = S.PROC_INST_BODY;
|
21929 | } else {
|
21930 | parser.procInstName += c;
|
21931 | }
|
21932 | continue;
|
21933 |
|
21934 | case S.PROC_INST_BODY:
|
21935 | if (!parser.procInstBody && isWhitespace(c)) {
|
21936 | continue;
|
21937 | } else if (c === '?') {
|
21938 | parser.state = S.PROC_INST_ENDING;
|
21939 | } else {
|
21940 | parser.procInstBody += c;
|
21941 | }
|
21942 | continue;
|
21943 |
|
21944 | case S.PROC_INST_ENDING:
|
21945 | if (c === '>') {
|
21946 | emitNode(parser, 'onprocessinginstruction', {
|
21947 | name: parser.procInstName,
|
21948 | body: parser.procInstBody
|
21949 | });
|
21950 | parser.procInstName = parser.procInstBody = '';
|
21951 | parser.state = S.TEXT;
|
21952 | } else {
|
21953 | parser.procInstBody += '?' + c;
|
21954 | parser.state = S.PROC_INST_BODY;
|
21955 | }
|
21956 | continue;
|
21957 |
|
21958 | case S.OPEN_TAG:
|
21959 | if (isMatch(nameBody, c)) {
|
21960 | parser.tagName += c;
|
21961 | } else {
|
21962 | newTag(parser);
|
21963 | if (c === '>') {
|
21964 | openTag(parser);
|
21965 | } else if (c === '/') {
|
21966 | parser.state = S.OPEN_TAG_SLASH;
|
21967 | } else {
|
21968 | if (!isWhitespace(c)) {
|
21969 | strictFail(parser, 'Invalid character in tag name');
|
21970 | }
|
21971 | parser.state = S.ATTRIB;
|
21972 | }
|
21973 | }
|
21974 | continue;
|
21975 |
|
21976 | case S.OPEN_TAG_SLASH:
|
21977 | if (c === '>') {
|
21978 | openTag(parser, true);
|
21979 | closeTag(parser);
|
21980 | } else {
|
21981 | strictFail(parser, 'Forward-slash in opening tag not followed by >');
|
21982 | parser.state = S.ATTRIB;
|
21983 | }
|
21984 | continue;
|
21985 |
|
21986 | case S.ATTRIB:
|
21987 |
|
21988 | if (isWhitespace(c)) {
|
21989 | continue;
|
21990 | } else if (c === '>') {
|
21991 | openTag(parser);
|
21992 | } else if (c === '/') {
|
21993 | parser.state = S.OPEN_TAG_SLASH;
|
21994 | } else if (isMatch(nameStart, c)) {
|
21995 | parser.attribName = c;
|
21996 | parser.attribValue = '';
|
21997 | parser.state = S.ATTRIB_NAME;
|
21998 | } else {
|
21999 | strictFail(parser, 'Invalid attribute name');
|
22000 | }
|
22001 | continue;
|
22002 |
|
22003 | case S.ATTRIB_NAME:
|
22004 | if (c === '=') {
|
22005 | parser.state = S.ATTRIB_VALUE;
|
22006 | } else if (c === '>') {
|
22007 | strictFail(parser, 'Attribute without value');
|
22008 | parser.attribValue = parser.attribName;
|
22009 | attrib(parser);
|
22010 | openTag(parser);
|
22011 | } else if (isWhitespace(c)) {
|
22012 | parser.state = S.ATTRIB_NAME_SAW_WHITE;
|
22013 | } else if (isMatch(nameBody, c)) {
|
22014 | parser.attribName += c;
|
22015 | } else {
|
22016 | strictFail(parser, 'Invalid attribute name');
|
22017 | }
|
22018 | continue;
|
22019 |
|
22020 | case S.ATTRIB_NAME_SAW_WHITE:
|
22021 | if (c === '=') {
|
22022 | parser.state = S.ATTRIB_VALUE;
|
22023 | } else if (isWhitespace(c)) {
|
22024 | continue;
|
22025 | } else {
|
22026 | strictFail(parser, 'Attribute without value');
|
22027 | parser.tag.attributes[parser.attribName] = '';
|
22028 | parser.attribValue = '';
|
22029 | emitNode(parser, 'onattribute', {
|
22030 | name: parser.attribName,
|
22031 | value: ''
|
22032 | });
|
22033 | parser.attribName = '';
|
22034 | if (c === '>') {
|
22035 | openTag(parser);
|
22036 | } else if (isMatch(nameStart, c)) {
|
22037 | parser.attribName = c;
|
22038 | parser.state = S.ATTRIB_NAME;
|
22039 | } else {
|
22040 | strictFail(parser, 'Invalid attribute name');
|
22041 | parser.state = S.ATTRIB;
|
22042 | }
|
22043 | }
|
22044 | continue;
|
22045 |
|
22046 | case S.ATTRIB_VALUE:
|
22047 | if (isWhitespace(c)) {
|
22048 | continue;
|
22049 | } else if (isQuote(c)) {
|
22050 | parser.q = c;
|
22051 | parser.state = S.ATTRIB_VALUE_QUOTED;
|
22052 | } else {
|
22053 | strictFail(parser, 'Unquoted attribute value');
|
22054 | parser.state = S.ATTRIB_VALUE_UNQUOTED;
|
22055 | parser.attribValue = c;
|
22056 | }
|
22057 | continue;
|
22058 |
|
22059 | case S.ATTRIB_VALUE_QUOTED:
|
22060 | if (c !== parser.q) {
|
22061 | if (c === '&') {
|
22062 | parser.state = S.ATTRIB_VALUE_ENTITY_Q;
|
22063 | } else {
|
22064 | parser.attribValue += c;
|
22065 | }
|
22066 | continue;
|
22067 | }
|
22068 | attrib(parser);
|
22069 | parser.q = '';
|
22070 | parser.state = S.ATTRIB_VALUE_CLOSED;
|
22071 | continue;
|
22072 |
|
22073 | case S.ATTRIB_VALUE_CLOSED:
|
22074 | if (isWhitespace(c)) {
|
22075 | parser.state = S.ATTRIB;
|
22076 | } else if (c === '>') {
|
22077 | openTag(parser);
|
22078 | } else if (c === '/') {
|
22079 | parser.state = S.OPEN_TAG_SLASH;
|
22080 | } else if (isMatch(nameStart, c)) {
|
22081 | strictFail(parser, 'No whitespace between attributes');
|
22082 | parser.attribName = c;
|
22083 | parser.attribValue = '';
|
22084 | parser.state = S.ATTRIB_NAME;
|
22085 | } else {
|
22086 | strictFail(parser, 'Invalid attribute name');
|
22087 | }
|
22088 | continue;
|
22089 |
|
22090 | case S.ATTRIB_VALUE_UNQUOTED:
|
22091 | if (!isAttribEnd(c)) {
|
22092 | if (c === '&') {
|
22093 | parser.state = S.ATTRIB_VALUE_ENTITY_U;
|
22094 | } else {
|
22095 | parser.attribValue += c;
|
22096 | }
|
22097 | continue;
|
22098 | }
|
22099 | attrib(parser);
|
22100 | if (c === '>') {
|
22101 | openTag(parser);
|
22102 | } else {
|
22103 | parser.state = S.ATTRIB;
|
22104 | }
|
22105 | continue;
|
22106 |
|
22107 | case S.CLOSE_TAG:
|
22108 | if (!parser.tagName) {
|
22109 | if (isWhitespace(c)) {
|
22110 | continue;
|
22111 | } else if (notMatch(nameStart, c)) {
|
22112 | if (parser.script) {
|
22113 | parser.script += '</' + c;
|
22114 | parser.state = S.SCRIPT;
|
22115 | } else {
|
22116 | strictFail(parser, 'Invalid tagname in closing tag.');
|
22117 | }
|
22118 | } else {
|
22119 | parser.tagName = c;
|
22120 | }
|
22121 | } else if (c === '>') {
|
22122 | closeTag(parser);
|
22123 | } else if (isMatch(nameBody, c)) {
|
22124 | parser.tagName += c;
|
22125 | } else if (parser.script) {
|
22126 | parser.script += '</' + parser.tagName;
|
22127 | parser.tagName = '';
|
22128 | parser.state = S.SCRIPT;
|
22129 | } else {
|
22130 | if (!isWhitespace(c)) {
|
22131 | strictFail(parser, 'Invalid tagname in closing tag');
|
22132 | }
|
22133 | parser.state = S.CLOSE_TAG_SAW_WHITE;
|
22134 | }
|
22135 | continue;
|
22136 |
|
22137 | case S.CLOSE_TAG_SAW_WHITE:
|
22138 | if (isWhitespace(c)) {
|
22139 | continue;
|
22140 | }
|
22141 | if (c === '>') {
|
22142 | closeTag(parser);
|
22143 | } else {
|
22144 | strictFail(parser, 'Invalid characters in closing tag');
|
22145 | }
|
22146 | continue;
|
22147 |
|
22148 | case S.TEXT_ENTITY:
|
22149 | case S.ATTRIB_VALUE_ENTITY_Q:
|
22150 | case S.ATTRIB_VALUE_ENTITY_U:
|
22151 | var returnState;
|
22152 | var buffer;
|
22153 | switch (parser.state) {
|
22154 | case S.TEXT_ENTITY:
|
22155 | returnState = S.TEXT;
|
22156 | buffer = 'textNode';
|
22157 | break;
|
22158 |
|
22159 | case S.ATTRIB_VALUE_ENTITY_Q:
|
22160 | returnState = S.ATTRIB_VALUE_QUOTED;
|
22161 | buffer = 'attribValue';
|
22162 | break;
|
22163 |
|
22164 | case S.ATTRIB_VALUE_ENTITY_U:
|
22165 | returnState = S.ATTRIB_VALUE_UNQUOTED;
|
22166 | buffer = 'attribValue';
|
22167 | break;
|
22168 | }
|
22169 |
|
22170 | if (c === ';') {
|
22171 | parser[buffer] += parseEntity(parser);
|
22172 | parser.entity = '';
|
22173 | parser.state = returnState;
|
22174 | } else if (isMatch(parser.entity.length ? entityBody : entityStart, c)) {
|
22175 | parser.entity += c;
|
22176 | } else {
|
22177 | strictFail(parser, 'Invalid character in entity name');
|
22178 | parser[buffer] += '&' + parser.entity + c;
|
22179 | parser.entity = '';
|
22180 | parser.state = returnState;
|
22181 | }
|
22182 |
|
22183 | continue;
|
22184 |
|
22185 | default:
|
22186 | throw new Error(parser, 'Unknown state: ' + parser.state);
|
22187 | }
|
22188 | }
|
22189 |
|
22190 | if (parser.position >= parser.bufferCheckPosition) {
|
22191 | checkBufferLength(parser);
|
22192 | }
|
22193 | return parser;
|
22194 | }
|
22195 |
|
22196 |
|
22197 |
|
22198 | if (!_fromCodePoint2.default) {
|
22199 | (function () {
|
22200 | var stringFromCharCode = String.fromCharCode;
|
22201 | var floor = Math.floor;
|
22202 | var fromCodePoint = function fromCodePoint() {
|
22203 | var MAX_SIZE = 0x4000;
|
22204 | var codeUnits = [];
|
22205 | var highSurrogate;
|
22206 | var lowSurrogate;
|
22207 | var index = -1;
|
22208 | var length = arguments.length;
|
22209 | if (!length) {
|
22210 | return '';
|
22211 | }
|
22212 | var result = '';
|
22213 | while (++index < length) {
|
22214 | var codePoint = Number(arguments[index]);
|
22215 | if (!isFinite(codePoint) ||
|
22216 | codePoint < 0 ||
|
22217 | codePoint > 0x10FFFF ||
|
22218 | floor(codePoint) !== codePoint
|
22219 | ) {
|
22220 | throw RangeError('Invalid code point: ' + codePoint);
|
22221 | }
|
22222 | if (codePoint <= 0xFFFF) {
|
22223 |
|
22224 | codeUnits.push(codePoint);
|
22225 | } else {
|
22226 |
|
22227 |
|
22228 | codePoint -= 0x10000;
|
22229 | highSurrogate = (codePoint >> 10) + 0xD800;
|
22230 | lowSurrogate = codePoint % 0x400 + 0xDC00;
|
22231 | codeUnits.push(highSurrogate, lowSurrogate);
|
22232 | }
|
22233 | if (index + 1 === length || codeUnits.length > MAX_SIZE) {
|
22234 | result += stringFromCharCode.apply(null, codeUnits);
|
22235 | codeUnits.length = 0;
|
22236 | }
|
22237 | }
|
22238 | return result;
|
22239 | };
|
22240 |
|
22241 | if (_defineProperty2.default) {
|
22242 | Object.defineProperty(String, 'fromCodePoint', {
|
22243 | value: fromCodePoint,
|
22244 | configurable: true,
|
22245 | writable: true
|
22246 | });
|
22247 | } else {
|
22248 | String.fromCodePoint = fromCodePoint;
|
22249 | }
|
22250 | })();
|
22251 | }
|
22252 | })(typeof exports === 'undefined' ? undefined.sax = {} : exports);
|
22253 |
|
22254 | }).call(this,require("buffer").Buffer)
|
22255 | },{"babel-runtime/core-js/json/stringify":48,"babel-runtime/core-js/object/create":50,"babel-runtime/core-js/object/define-property":51,"babel-runtime/core-js/object/keys":55,"babel-runtime/core-js/string/from-code-point":58,"babel-runtime/helpers/typeof":64,"buffer":70,"stream":271,"string_decoder":69}],271:[function(require,module,exports){
|
22256 |
|
22257 |
|
22258 |
|
22259 |
|
22260 |
|
22261 |
|
22262 |
|
22263 |
|
22264 |
|
22265 |
|
22266 |
|
22267 |
|
22268 |
|
22269 |
|
22270 |
|
22271 |
|
22272 |
|
22273 |
|
22274 |
|
22275 |
|
22276 |
|
22277 | module.exports = Stream;
|
22278 |
|
22279 | var EE = require('events').EventEmitter;
|
22280 | var inherits = require('inherits');
|
22281 |
|
22282 | inherits(Stream, EE);
|
22283 | Stream.Readable = require('readable-stream/readable.js');
|
22284 | Stream.Writable = require('readable-stream/writable.js');
|
22285 | Stream.Duplex = require('readable-stream/duplex.js');
|
22286 | Stream.Transform = require('readable-stream/transform.js');
|
22287 | Stream.PassThrough = require('readable-stream/passthrough.js');
|
22288 |
|
22289 |
|
22290 | Stream.Stream = Stream;
|
22291 |
|
22292 |
|
22293 |
|
22294 |
|
22295 |
|
22296 |
|
22297 | function Stream() {
|
22298 | EE.call(this);
|
22299 | }
|
22300 |
|
22301 | Stream.prototype.pipe = function(dest, options) {
|
22302 | var source = this;
|
22303 |
|
22304 | function ondata(chunk) {
|
22305 | if (dest.writable) {
|
22306 | if (false === dest.write(chunk) && source.pause) {
|
22307 | source.pause();
|
22308 | }
|
22309 | }
|
22310 | }
|
22311 |
|
22312 | source.on('data', ondata);
|
22313 |
|
22314 | function ondrain() {
|
22315 | if (source.readable && source.resume) {
|
22316 | source.resume();
|
22317 | }
|
22318 | }
|
22319 |
|
22320 | dest.on('drain', ondrain);
|
22321 |
|
22322 |
|
22323 |
|
22324 | if (!dest._isStdio && (!options || options.end !== false)) {
|
22325 | source.on('end', onend);
|
22326 | source.on('close', onclose);
|
22327 | }
|
22328 |
|
22329 | var didOnEnd = false;
|
22330 | function onend() {
|
22331 | if (didOnEnd) return;
|
22332 | didOnEnd = true;
|
22333 |
|
22334 | dest.end();
|
22335 | }
|
22336 |
|
22337 |
|
22338 | function onclose() {
|
22339 | if (didOnEnd) return;
|
22340 | didOnEnd = true;
|
22341 |
|
22342 | if (typeof dest.destroy === 'function') dest.destroy();
|
22343 | }
|
22344 |
|
22345 |
|
22346 | function onerror(er) {
|
22347 | cleanup();
|
22348 | if (EE.listenerCount(this, 'error') === 0) {
|
22349 | throw er;
|
22350 | }
|
22351 | }
|
22352 |
|
22353 | source.on('error', onerror);
|
22354 | dest.on('error', onerror);
|
22355 |
|
22356 |
|
22357 | function cleanup() {
|
22358 | source.removeListener('data', ondata);
|
22359 | dest.removeListener('drain', ondrain);
|
22360 |
|
22361 | source.removeListener('end', onend);
|
22362 | source.removeListener('close', onclose);
|
22363 |
|
22364 | source.removeListener('error', onerror);
|
22365 | dest.removeListener('error', onerror);
|
22366 |
|
22367 | source.removeListener('end', cleanup);
|
22368 | source.removeListener('close', cleanup);
|
22369 |
|
22370 | dest.removeListener('close', cleanup);
|
22371 | }
|
22372 |
|
22373 | source.on('end', cleanup);
|
22374 | source.on('close', cleanup);
|
22375 |
|
22376 | dest.on('close', cleanup);
|
22377 |
|
22378 | dest.emit('pipe', source);
|
22379 |
|
22380 |
|
22381 | return dest;
|
22382 | };
|
22383 |
|
22384 | },{"events":216,"inherits":226,"readable-stream/duplex.js":254,"readable-stream/passthrough.js":263,"readable-stream/readable.js":264,"readable-stream/transform.js":265,"readable-stream/writable.js":266}],272:[function(require,module,exports){
|
22385 | (function (global){
|
22386 | var ClientRequest = require('./lib/request')
|
22387 | var response = require('./lib/response')
|
22388 | var extend = require('xtend')
|
22389 | var statusCodes = require('builtin-status-codes')
|
22390 | var url = require('url')
|
22391 |
|
22392 | var http = exports
|
22393 |
|
22394 | http.request = function (opts, cb) {
|
22395 | if (typeof opts === 'string')
|
22396 | opts = url.parse(opts)
|
22397 | else
|
22398 | opts = extend(opts)
|
22399 |
|
22400 |
|
22401 |
|
22402 |
|
22403 | var defaultProtocol = global.location.protocol.search(/^https?:$/) === -1 ? 'http:' : ''
|
22404 |
|
22405 | var protocol = opts.protocol || defaultProtocol
|
22406 | var host = opts.hostname || opts.host
|
22407 | var port = opts.port
|
22408 | var path = opts.path || '/'
|
22409 |
|
22410 |
|
22411 | if (host && host.indexOf(':') !== -1)
|
22412 | host = '[' + host + ']'
|
22413 |
|
22414 |
|
22415 | opts.url = (host ? (protocol + '//' + host) : '') + (port ? ':' + port : '') + path
|
22416 | opts.method = (opts.method || 'GET').toUpperCase()
|
22417 | opts.headers = opts.headers || {}
|
22418 |
|
22419 |
|
22420 |
|
22421 | var req = new ClientRequest(opts)
|
22422 | if (cb)
|
22423 | req.on('response', cb)
|
22424 | return req
|
22425 | }
|
22426 |
|
22427 | http.get = function get (opts, cb) {
|
22428 | var req = http.request(opts, cb)
|
22429 | req.end()
|
22430 | return req
|
22431 | }
|
22432 |
|
22433 | http.ClientRequest = ClientRequest
|
22434 | http.IncomingMessage = response.IncomingMessage
|
22435 |
|
22436 | http.Agent = function () {}
|
22437 | http.Agent.defaultMaxSockets = 4
|
22438 |
|
22439 | http.globalAgent = new http.Agent()
|
22440 |
|
22441 | http.STATUS_CODES = statusCodes
|
22442 |
|
22443 | http.METHODS = [
|
22444 | 'CHECKOUT',
|
22445 | 'CONNECT',
|
22446 | 'COPY',
|
22447 | 'DELETE',
|
22448 | 'GET',
|
22449 | 'HEAD',
|
22450 | 'LOCK',
|
22451 | 'M-SEARCH',
|
22452 | 'MERGE',
|
22453 | 'MKACTIVITY',
|
22454 | 'MKCOL',
|
22455 | 'MOVE',
|
22456 | 'NOTIFY',
|
22457 | 'OPTIONS',
|
22458 | 'PATCH',
|
22459 | 'POST',
|
22460 | 'PROPFIND',
|
22461 | 'PROPPATCH',
|
22462 | 'PURGE',
|
22463 | 'PUT',
|
22464 | 'REPORT',
|
22465 | 'SEARCH',
|
22466 | 'SUBSCRIBE',
|
22467 | 'TRACE',
|
22468 | 'UNLOCK',
|
22469 | 'UNSUBSCRIBE'
|
22470 | ]
|
22471 | }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
22472 | },{"./lib/request":274,"./lib/response":275,"builtin-status-codes":71,"url":279,"xtend":327}],273:[function(require,module,exports){
|
22473 | (function (global){
|
22474 | 'use strict';
|
22475 |
|
22476 | exports.fetch = isFunction(global.fetch) && isFunction(global.ReadableStream);
|
22477 |
|
22478 | exports.writableStream = isFunction(global.WritableStream);
|
22479 |
|
22480 | exports.abortController = isFunction(global.AbortController);
|
22481 |
|
22482 | exports.blobConstructor = false;
|
22483 | try {
|
22484 | new Blob([new ArrayBuffer(1)]);
|
22485 | exports.blobConstructor = true;
|
22486 | } catch (e) {}
|
22487 |
|
22488 |
|
22489 |
|
22490 |
|
22491 | var xhr;
|
22492 | function getXHR() {
|
22493 |
|
22494 | if (xhr !== undefined) return xhr;
|
22495 |
|
22496 | if (global.XMLHttpRequest) {
|
22497 | xhr = new global.XMLHttpRequest();
|
22498 |
|
22499 |
|
22500 |
|
22501 | try {
|
22502 | xhr.open('GET', global.XDomainRequest ? '/' : 'https://example.com');
|
22503 | } catch (e) {
|
22504 | xhr = null;
|
22505 | }
|
22506 | } else {
|
22507 |
|
22508 | xhr = null;
|
22509 | }
|
22510 | return xhr;
|
22511 | }
|
22512 |
|
22513 | function checkTypeSupport(type) {
|
22514 | var xhr = getXHR();
|
22515 | if (!xhr) return false;
|
22516 | try {
|
22517 | xhr.responseType = type;
|
22518 | return xhr.responseType === type;
|
22519 | } catch (e) {}
|
22520 | return false;
|
22521 | }
|
22522 |
|
22523 |
|
22524 |
|
22525 | var haveArrayBuffer = typeof global.ArrayBuffer !== 'undefined';
|
22526 | var haveSlice = haveArrayBuffer && isFunction(global.ArrayBuffer.prototype.slice);
|
22527 |
|
22528 |
|
22529 |
|
22530 | exports.arraybuffer = exports.fetch || haveArrayBuffer && checkTypeSupport('arraybuffer');
|
22531 |
|
22532 |
|
22533 |
|
22534 | exports.msstream = !exports.fetch && haveSlice && checkTypeSupport('ms-stream');
|
22535 | exports.mozchunkedarraybuffer = !exports.fetch && haveArrayBuffer && checkTypeSupport('moz-chunked-arraybuffer');
|
22536 |
|
22537 |
|
22538 |
|
22539 | exports.overrideMimeType = exports.fetch || (getXHR() ? isFunction(getXHR().overrideMimeType) : false);
|
22540 |
|
22541 | exports.vbArray = isFunction(global.VBArray);
|
22542 |
|
22543 | function isFunction(value) {
|
22544 | return typeof value === 'function';
|
22545 | }
|
22546 |
|
22547 | xhr = null;
|
22548 |
|
22549 | }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
22550 | },{}],274:[function(require,module,exports){
|
22551 | (function (process,global,Buffer){
|
22552 | 'use strict';
|
22553 |
|
22554 | var _keys = require('babel-runtime/core-js/object/keys');
|
22555 |
|
22556 | var _keys2 = _interopRequireDefault(_keys);
|
22557 |
|
22558 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
22559 |
|
22560 | var capability = require('./capability');
|
22561 | var inherits = require('inherits');
|
22562 | var response = require('./response');
|
22563 | var stream = require('readable-stream');
|
22564 | var toArrayBuffer = require('to-arraybuffer');
|
22565 |
|
22566 | var IncomingMessage = response.IncomingMessage;
|
22567 | var rStates = response.readyStates;
|
22568 |
|
22569 | function decideMode(preferBinary, useFetch) {
|
22570 | if (capability.fetch && useFetch) {
|
22571 | return 'fetch';
|
22572 | } else if (capability.mozchunkedarraybuffer) {
|
22573 | return 'moz-chunked-arraybuffer';
|
22574 | } else if (capability.msstream) {
|
22575 | return 'ms-stream';
|
22576 | } else if (capability.arraybuffer && preferBinary) {
|
22577 | return 'arraybuffer';
|
22578 | } else if (capability.vbArray && preferBinary) {
|
22579 | return 'text:vbarray';
|
22580 | } else {
|
22581 | return 'text';
|
22582 | }
|
22583 | }
|
22584 |
|
22585 | var ClientRequest = module.exports = function (opts) {
|
22586 | var self = this;
|
22587 | stream.Writable.call(self);
|
22588 |
|
22589 | self._opts = opts;
|
22590 | self._body = [];
|
22591 | self._headers = {};
|
22592 | if (opts.auth) self.setHeader('Authorization', 'Basic ' + new Buffer(opts.auth).toString('base64'));
|
22593 | (0, _keys2.default)(opts.headers).forEach(function (name) {
|
22594 | self.setHeader(name, opts.headers[name]);
|
22595 | });
|
22596 |
|
22597 | var preferBinary;
|
22598 | var useFetch = true;
|
22599 | if (opts.mode === 'disable-fetch' || 'requestTimeout' in opts && !capability.abortController) {
|
22600 |
|
22601 | useFetch = false;
|
22602 | preferBinary = true;
|
22603 | } else if (opts.mode === 'prefer-streaming') {
|
22604 |
|
22605 |
|
22606 | preferBinary = false;
|
22607 | } else if (opts.mode === 'allow-wrong-content-type') {
|
22608 |
|
22609 | preferBinary = !capability.overrideMimeType;
|
22610 | } else if (!opts.mode || opts.mode === 'default' || opts.mode === 'prefer-fast') {
|
22611 |
|
22612 | preferBinary = true;
|
22613 | } else {
|
22614 | throw new Error('Invalid value for opts.mode');
|
22615 | }
|
22616 | self._mode = decideMode(preferBinary, useFetch);
|
22617 | self._fetchTimer = null;
|
22618 |
|
22619 | self.on('finish', function () {
|
22620 | self._onFinish();
|
22621 | });
|
22622 | };
|
22623 |
|
22624 | inherits(ClientRequest, stream.Writable);
|
22625 |
|
22626 | ClientRequest.prototype.setHeader = function (name, value) {
|
22627 | var self = this;
|
22628 | var lowerName = name.toLowerCase();
|
22629 |
|
22630 |
|
22631 |
|
22632 | if (unsafeHeaders.indexOf(lowerName) !== -1) return;
|
22633 |
|
22634 | self._headers[lowerName] = {
|
22635 | name: name,
|
22636 | value: value
|
22637 | };
|
22638 | };
|
22639 |
|
22640 | ClientRequest.prototype.getHeader = function (name) {
|
22641 | var header = this._headers[name.toLowerCase()];
|
22642 | if (header) return header.value;
|
22643 | return null;
|
22644 | };
|
22645 |
|
22646 | ClientRequest.prototype.removeHeader = function (name) {
|
22647 | var self = this;
|
22648 | delete self._headers[name.toLowerCase()];
|
22649 | };
|
22650 |
|
22651 | ClientRequest.prototype._onFinish = function () {
|
22652 | var self = this;
|
22653 |
|
22654 | if (self._destroyed) return;
|
22655 | var opts = self._opts;
|
22656 |
|
22657 | var headersObj = self._headers;
|
22658 | var body = null;
|
22659 | if (opts.method !== 'GET' && opts.method !== 'HEAD') {
|
22660 | if (capability.arraybuffer) {
|
22661 | body = toArrayBuffer(Buffer.concat(self._body));
|
22662 | } else if (capability.blobConstructor) {
|
22663 | body = new global.Blob(self._body.map(function (buffer) {
|
22664 | return toArrayBuffer(buffer);
|
22665 | }), {
|
22666 | type: (headersObj['content-type'] || {}).value || ''
|
22667 | });
|
22668 | } else {
|
22669 |
|
22670 | body = Buffer.concat(self._body).toString();
|
22671 | }
|
22672 | }
|
22673 |
|
22674 |
|
22675 | var headersList = [];
|
22676 | (0, _keys2.default)(headersObj).forEach(function (keyName) {
|
22677 | var name = headersObj[keyName].name;
|
22678 | var value = headersObj[keyName].value;
|
22679 | if (Array.isArray(value)) {
|
22680 | value.forEach(function (v) {
|
22681 | headersList.push([name, v]);
|
22682 | });
|
22683 | } else {
|
22684 | headersList.push([name, value]);
|
22685 | }
|
22686 | });
|
22687 |
|
22688 | if (self._mode === 'fetch') {
|
22689 | var signal = null;
|
22690 | var fetchTimer = null;
|
22691 | if (capability.abortController) {
|
22692 | var controller = new AbortController();
|
22693 | signal = controller.signal;
|
22694 | self._fetchAbortController = controller;
|
22695 |
|
22696 | if ('requestTimeout' in opts && opts.requestTimeout !== 0) {
|
22697 | self._fetchTimer = global.setTimeout(function () {
|
22698 | self.emit('requestTimeout');
|
22699 | if (self._fetchAbortController) self._fetchAbortController.abort();
|
22700 | }, opts.requestTimeout);
|
22701 | }
|
22702 | }
|
22703 |
|
22704 | global.fetch(self._opts.url, {
|
22705 | method: self._opts.method,
|
22706 | headers: headersList,
|
22707 | body: body || undefined,
|
22708 | mode: 'cors',
|
22709 | credentials: opts.withCredentials ? 'include' : 'same-origin',
|
22710 | signal: signal
|
22711 | }).then(function (response) {
|
22712 | self._fetchResponse = response;
|
22713 | self._connect();
|
22714 | }, function (reason) {
|
22715 | global.clearTimeout(self._fetchTimer);
|
22716 | if (!self._destroyed) self.emit('error', reason);
|
22717 | });
|
22718 | } else {
|
22719 | var xhr = self._xhr = new global.XMLHttpRequest();
|
22720 | try {
|
22721 | xhr.open(self._opts.method, self._opts.url, true);
|
22722 | } catch (err) {
|
22723 | process.nextTick(function () {
|
22724 | self.emit('error', err);
|
22725 | });
|
22726 | return;
|
22727 | }
|
22728 |
|
22729 |
|
22730 | if ('responseType' in xhr) xhr.responseType = self._mode.split(':')[0];
|
22731 |
|
22732 | if ('withCredentials' in xhr) xhr.withCredentials = !!opts.withCredentials;
|
22733 |
|
22734 | if (self._mode === 'text' && 'overrideMimeType' in xhr) xhr.overrideMimeType('text/plain; charset=x-user-defined');
|
22735 |
|
22736 | if ('requestTimeout' in opts) {
|
22737 | xhr.timeout = opts.requestTimeout;
|
22738 | xhr.ontimeout = function () {
|
22739 | self.emit('requestTimeout');
|
22740 | };
|
22741 | }
|
22742 |
|
22743 | headersList.forEach(function (header) {
|
22744 | xhr.setRequestHeader(header[0], header[1]);
|
22745 | });
|
22746 |
|
22747 | self._response = null;
|
22748 | xhr.onreadystatechange = function () {
|
22749 | switch (xhr.readyState) {
|
22750 | case rStates.LOADING:
|
22751 | case rStates.DONE:
|
22752 | self._onXHRProgress();
|
22753 | break;
|
22754 | }
|
22755 | };
|
22756 |
|
22757 |
|
22758 | if (self._mode === 'moz-chunked-arraybuffer') {
|
22759 | xhr.onprogress = function () {
|
22760 | self._onXHRProgress();
|
22761 | };
|
22762 | }
|
22763 |
|
22764 | xhr.onerror = function () {
|
22765 | if (self._destroyed) return;
|
22766 | self.emit('error', new Error('XHR error'));
|
22767 | };
|
22768 |
|
22769 | try {
|
22770 | xhr.send(body);
|
22771 | } catch (err) {
|
22772 | process.nextTick(function () {
|
22773 | self.emit('error', err);
|
22774 | });
|
22775 | return;
|
22776 | }
|
22777 | }
|
22778 | };
|
22779 |
|
22780 |
|
22781 |
|
22782 |
|
22783 |
|
22784 |
|
22785 | function statusValid(xhr) {
|
22786 | try {
|
22787 | var status = xhr.status;
|
22788 | return status !== null && status !== 0;
|
22789 | } catch (e) {
|
22790 | return false;
|
22791 | }
|
22792 | }
|
22793 |
|
22794 | ClientRequest.prototype._onXHRProgress = function () {
|
22795 | var self = this;
|
22796 |
|
22797 | if (!statusValid(self._xhr) || self._destroyed) return;
|
22798 |
|
22799 | if (!self._response) self._connect();
|
22800 |
|
22801 | self._response._onXHRProgress();
|
22802 | };
|
22803 |
|
22804 | ClientRequest.prototype._connect = function () {
|
22805 | var self = this;
|
22806 |
|
22807 | if (self._destroyed) return;
|
22808 |
|
22809 | self._response = new IncomingMessage(self._xhr, self._fetchResponse, self._mode, self._fetchTimer);
|
22810 | self._response.on('error', function (err) {
|
22811 | self.emit('error', err);
|
22812 | });
|
22813 |
|
22814 | self.emit('response', self._response);
|
22815 | };
|
22816 |
|
22817 | ClientRequest.prototype._write = function (chunk, encoding, cb) {
|
22818 | var self = this;
|
22819 |
|
22820 | self._body.push(chunk);
|
22821 | cb();
|
22822 | };
|
22823 |
|
22824 | ClientRequest.prototype.abort = ClientRequest.prototype.destroy = function () {
|
22825 | var self = this;
|
22826 | self._destroyed = true;
|
22827 | global.clearTimeout(self._fetchTimer);
|
22828 | if (self._response) self._response._destroyed = true;
|
22829 | if (self._xhr) self._xhr.abort();else if (self._fetchAbortController) self._fetchAbortController.abort();
|
22830 | };
|
22831 |
|
22832 | ClientRequest.prototype.end = function (data, encoding, cb) {
|
22833 | var self = this;
|
22834 | if (typeof data === 'function') {
|
22835 | cb = data;
|
22836 | data = undefined;
|
22837 | }
|
22838 |
|
22839 | stream.Writable.prototype.end.call(self, data, encoding, cb);
|
22840 | };
|
22841 |
|
22842 | ClientRequest.prototype.flushHeaders = function () {};
|
22843 | ClientRequest.prototype.setTimeout = function () {};
|
22844 | ClientRequest.prototype.setNoDelay = function () {};
|
22845 | ClientRequest.prototype.setSocketKeepAlive = function () {};
|
22846 |
|
22847 |
|
22848 | var unsafeHeaders = ['accept-charset', 'accept-encoding', 'access-control-request-headers', 'access-control-request-method', 'connection', 'content-length', 'cookie', 'cookie2', 'date', 'dnt', 'expect', 'host', 'keep-alive', 'origin', 'referer', 'te', 'trailer', 'transfer-encoding', 'upgrade', 'user-agent', 'via'];
|
22849 |
|
22850 | }).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("buffer").Buffer)
|
22851 | },{"./capability":273,"./response":275,"_process":249,"babel-runtime/core-js/object/keys":55,"buffer":70,"inherits":226,"readable-stream":264,"to-arraybuffer":278}],275:[function(require,module,exports){
|
22852 | (function (process,global,Buffer){
|
22853 | 'use strict';
|
22854 |
|
22855 | var _promise = require('babel-runtime/core-js/promise');
|
22856 |
|
22857 | var _promise2 = _interopRequireDefault(_promise);
|
22858 |
|
22859 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
22860 |
|
22861 | var capability = require('./capability');
|
22862 | var inherits = require('inherits');
|
22863 | var stream = require('readable-stream');
|
22864 |
|
22865 | var rStates = exports.readyStates = {
|
22866 | UNSENT: 0,
|
22867 | OPENED: 1,
|
22868 | HEADERS_RECEIVED: 2,
|
22869 | LOADING: 3,
|
22870 | DONE: 4
|
22871 | };
|
22872 |
|
22873 | var IncomingMessage = exports.IncomingMessage = function (xhr, response, mode, fetchTimer) {
|
22874 | var self = this;
|
22875 | stream.Readable.call(self);
|
22876 |
|
22877 | self._mode = mode;
|
22878 | self.headers = {};
|
22879 | self.rawHeaders = [];
|
22880 | self.trailers = {};
|
22881 | self.rawTrailers = [];
|
22882 |
|
22883 |
|
22884 | self.on('end', function () {
|
22885 |
|
22886 | process.nextTick(function () {
|
22887 | self.emit('close');
|
22888 | });
|
22889 | });
|
22890 |
|
22891 | if (mode === 'fetch') {
|
22892 | var read = function read() {
|
22893 | reader.read().then(function (result) {
|
22894 | if (self._destroyed) return;
|
22895 | if (result.done) {
|
22896 | global.clearTimeout(fetchTimer);
|
22897 | self.push(null);
|
22898 | return;
|
22899 | }
|
22900 | self.push(new Buffer(result.value));
|
22901 | read();
|
22902 | }).catch(function (err) {
|
22903 | global.clearTimeout(fetchTimer);
|
22904 | if (!self._destroyed) self.emit('error', err);
|
22905 | });
|
22906 | };
|
22907 |
|
22908 | self._fetchResponse = response;
|
22909 |
|
22910 | self.url = response.url;
|
22911 | self.statusCode = response.status;
|
22912 | self.statusMessage = response.statusText;
|
22913 |
|
22914 | response.headers.forEach(function (header, key) {
|
22915 | self.headers[key.toLowerCase()] = header;
|
22916 | self.rawHeaders.push(key, header);
|
22917 | });
|
22918 |
|
22919 | if (capability.writableStream) {
|
22920 | var writable = new WritableStream({
|
22921 | write: function write(chunk) {
|
22922 | return new _promise2.default(function (resolve, reject) {
|
22923 | if (self._destroyed) {
|
22924 | reject();
|
22925 | } else if (self.push(new Buffer(chunk))) {
|
22926 | resolve();
|
22927 | } else {
|
22928 | self._resumeFetch = resolve;
|
22929 | }
|
22930 | });
|
22931 | },
|
22932 | close: function close() {
|
22933 | global.clearTimeout(fetchTimer);
|
22934 | if (!self._destroyed) self.push(null);
|
22935 | },
|
22936 | abort: function abort(err) {
|
22937 | if (!self._destroyed) self.emit('error', err);
|
22938 | }
|
22939 | });
|
22940 |
|
22941 | try {
|
22942 | response.body.pipeTo(writable).catch(function (err) {
|
22943 | global.clearTimeout(fetchTimer);
|
22944 | if (!self._destroyed) self.emit('error', err);
|
22945 | });
|
22946 | return;
|
22947 | } catch (e) {}
|
22948 | }
|
22949 |
|
22950 | var reader = response.body.getReader();
|
22951 |
|
22952 | read();
|
22953 | } else {
|
22954 | self._xhr = xhr;
|
22955 | self._pos = 0;
|
22956 |
|
22957 | self.url = xhr.responseURL;
|
22958 | self.statusCode = xhr.status;
|
22959 | self.statusMessage = xhr.statusText;
|
22960 | var headers = xhr.getAllResponseHeaders().split(/\r?\n/);
|
22961 | headers.forEach(function (header) {
|
22962 | var matches = header.match(/^([^:]+):\s*(.*)/);
|
22963 | if (matches) {
|
22964 | var key = matches[1].toLowerCase();
|
22965 | if (key === 'set-cookie') {
|
22966 | if (self.headers[key] === undefined) {
|
22967 | self.headers[key] = [];
|
22968 | }
|
22969 | self.headers[key].push(matches[2]);
|
22970 | } else if (self.headers[key] !== undefined) {
|
22971 | self.headers[key] += ', ' + matches[2];
|
22972 | } else {
|
22973 | self.headers[key] = matches[2];
|
22974 | }
|
22975 | self.rawHeaders.push(matches[1], matches[2]);
|
22976 | }
|
22977 | });
|
22978 |
|
22979 | self._charset = 'x-user-defined';
|
22980 | if (!capability.overrideMimeType) {
|
22981 | var mimeType = self.rawHeaders['mime-type'];
|
22982 | if (mimeType) {
|
22983 | var charsetMatch = mimeType.match(/;\s*charset=([^;])(;|$)/);
|
22984 | if (charsetMatch) {
|
22985 | self._charset = charsetMatch[1].toLowerCase();
|
22986 | }
|
22987 | }
|
22988 | if (!self._charset) self._charset = 'utf-8';
|
22989 | }
|
22990 | }
|
22991 | };
|
22992 |
|
22993 | inherits(IncomingMessage, stream.Readable);
|
22994 |
|
22995 | IncomingMessage.prototype._read = function () {
|
22996 | var self = this;
|
22997 |
|
22998 | var resolve = self._resumeFetch;
|
22999 | if (resolve) {
|
23000 | self._resumeFetch = null;
|
23001 | resolve();
|
23002 | }
|
23003 | };
|
23004 |
|
23005 | IncomingMessage.prototype._onXHRProgress = function () {
|
23006 | var self = this;
|
23007 |
|
23008 | var xhr = self._xhr;
|
23009 |
|
23010 | var response = null;
|
23011 | switch (self._mode) {
|
23012 | case 'text:vbarray':
|
23013 |
|
23014 | if (xhr.readyState !== rStates.DONE) break;
|
23015 | try {
|
23016 |
|
23017 | response = new global.VBArray(xhr.responseBody).toArray();
|
23018 | } catch (e) {}
|
23019 | if (response !== null) {
|
23020 | self.push(new Buffer(response));
|
23021 | break;
|
23022 | }
|
23023 |
|
23024 | case 'text':
|
23025 | try {
|
23026 |
|
23027 | response = xhr.responseText;
|
23028 | } catch (e) {
|
23029 | self._mode = 'text:vbarray';
|
23030 | break;
|
23031 | }
|
23032 | if (response.length > self._pos) {
|
23033 | var newData = response.substr(self._pos);
|
23034 | if (self._charset === 'x-user-defined') {
|
23035 | var buffer = new Buffer(newData.length);
|
23036 | for (var i = 0; i < newData.length; i++) {
|
23037 | buffer[i] = newData.charCodeAt(i) & 0xff;
|
23038 | }self.push(buffer);
|
23039 | } else {
|
23040 | self.push(newData, self._charset);
|
23041 | }
|
23042 | self._pos = response.length;
|
23043 | }
|
23044 | break;
|
23045 | case 'arraybuffer':
|
23046 | if (xhr.readyState !== rStates.DONE || !xhr.response) break;
|
23047 | response = xhr.response;
|
23048 | self.push(new Buffer(new Uint8Array(response)));
|
23049 | break;
|
23050 | case 'moz-chunked-arraybuffer':
|
23051 |
|
23052 | response = xhr.response;
|
23053 | if (xhr.readyState !== rStates.LOADING || !response) break;
|
23054 | self.push(new Buffer(new Uint8Array(response)));
|
23055 | break;
|
23056 | case 'ms-stream':
|
23057 | response = xhr.response;
|
23058 | if (xhr.readyState !== rStates.LOADING) break;
|
23059 | var reader = new global.MSStreamReader();
|
23060 | reader.onprogress = function () {
|
23061 | if (reader.result.byteLength > self._pos) {
|
23062 | self.push(new Buffer(new Uint8Array(reader.result.slice(self._pos))));
|
23063 | self._pos = reader.result.byteLength;
|
23064 | }
|
23065 | };
|
23066 | reader.onload = function () {
|
23067 | self.push(null);
|
23068 | };
|
23069 |
|
23070 | reader.readAsArrayBuffer(response);
|
23071 | break;
|
23072 | }
|
23073 |
|
23074 |
|
23075 | if (self._xhr.readyState === rStates.DONE && self._mode !== 'ms-stream') {
|
23076 | self.push(null);
|
23077 | }
|
23078 | };
|
23079 |
|
23080 | }).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("buffer").Buffer)
|
23081 | },{"./capability":273,"_process":249,"babel-runtime/core-js/promise":56,"buffer":70,"inherits":226,"readable-stream":264}],276:[function(require,module,exports){
|
23082 |
|
23083 |
|
23084 |
|
23085 |
|
23086 |
|
23087 |
|
23088 |
|
23089 |
|
23090 |
|
23091 |
|
23092 |
|
23093 |
|
23094 |
|
23095 |
|
23096 |
|
23097 |
|
23098 |
|
23099 |
|
23100 |
|
23101 |
|
23102 |
|
23103 | 'use strict';
|
23104 |
|
23105 |
|
23106 |
|
23107 | var Buffer = require('safe-buffer').Buffer;
|
23108 |
|
23109 |
|
23110 | var isEncoding = Buffer.isEncoding || function (encoding) {
|
23111 | encoding = '' + encoding;
|
23112 | switch (encoding && encoding.toLowerCase()) {
|
23113 | 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':
|
23114 | return true;
|
23115 | default:
|
23116 | return false;
|
23117 | }
|
23118 | };
|
23119 |
|
23120 | function _normalizeEncoding(enc) {
|
23121 | if (!enc) return 'utf8';
|
23122 | var retried;
|
23123 | while (true) {
|
23124 | switch (enc) {
|
23125 | case 'utf8':
|
23126 | case 'utf-8':
|
23127 | return 'utf8';
|
23128 | case 'ucs2':
|
23129 | case 'ucs-2':
|
23130 | case 'utf16le':
|
23131 | case 'utf-16le':
|
23132 | return 'utf16le';
|
23133 | case 'latin1':
|
23134 | case 'binary':
|
23135 | return 'latin1';
|
23136 | case 'base64':
|
23137 | case 'ascii':
|
23138 | case 'hex':
|
23139 | return enc;
|
23140 | default:
|
23141 | if (retried) return;
|
23142 | enc = ('' + enc).toLowerCase();
|
23143 | retried = true;
|
23144 | }
|
23145 | }
|
23146 | };
|
23147 |
|
23148 |
|
23149 |
|
23150 | function normalizeEncoding(enc) {
|
23151 | var nenc = _normalizeEncoding(enc);
|
23152 | if (typeof nenc !== 'string' && (Buffer.isEncoding === isEncoding || !isEncoding(enc))) throw new Error('Unknown encoding: ' + enc);
|
23153 | return nenc || enc;
|
23154 | }
|
23155 |
|
23156 |
|
23157 |
|
23158 |
|
23159 | exports.StringDecoder = StringDecoder;
|
23160 | function StringDecoder(encoding) {
|
23161 | this.encoding = normalizeEncoding(encoding);
|
23162 | var nb;
|
23163 | switch (this.encoding) {
|
23164 | case 'utf16le':
|
23165 | this.text = utf16Text;
|
23166 | this.end = utf16End;
|
23167 | nb = 4;
|
23168 | break;
|
23169 | case 'utf8':
|
23170 | this.fillLast = utf8FillLast;
|
23171 | nb = 4;
|
23172 | break;
|
23173 | case 'base64':
|
23174 | this.text = base64Text;
|
23175 | this.end = base64End;
|
23176 | nb = 3;
|
23177 | break;
|
23178 | default:
|
23179 | this.write = simpleWrite;
|
23180 | this.end = simpleEnd;
|
23181 | return;
|
23182 | }
|
23183 | this.lastNeed = 0;
|
23184 | this.lastTotal = 0;
|
23185 | this.lastChar = Buffer.allocUnsafe(nb);
|
23186 | }
|
23187 |
|
23188 | StringDecoder.prototype.write = function (buf) {
|
23189 | if (buf.length === 0) return '';
|
23190 | var r;
|
23191 | var i;
|
23192 | if (this.lastNeed) {
|
23193 | r = this.fillLast(buf);
|
23194 | if (r === undefined) return '';
|
23195 | i = this.lastNeed;
|
23196 | this.lastNeed = 0;
|
23197 | } else {
|
23198 | i = 0;
|
23199 | }
|
23200 | if (i < buf.length) return r ? r + this.text(buf, i) : this.text(buf, i);
|
23201 | return r || '';
|
23202 | };
|
23203 |
|
23204 | StringDecoder.prototype.end = utf8End;
|
23205 |
|
23206 |
|
23207 | StringDecoder.prototype.text = utf8Text;
|
23208 |
|
23209 |
|
23210 | StringDecoder.prototype.fillLast = function (buf) {
|
23211 | if (this.lastNeed <= buf.length) {
|
23212 | buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed);
|
23213 | return this.lastChar.toString(this.encoding, 0, this.lastTotal);
|
23214 | }
|
23215 | buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, buf.length);
|
23216 | this.lastNeed -= buf.length;
|
23217 | };
|
23218 |
|
23219 |
|
23220 |
|
23221 | function utf8CheckByte(byte) {
|
23222 | 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;
|
23223 | return byte >> 6 === 0x02 ? -1 : -2;
|
23224 | }
|
23225 |
|
23226 |
|
23227 |
|
23228 |
|
23229 | function utf8CheckIncomplete(self, buf, i) {
|
23230 | var j = buf.length - 1;
|
23231 | if (j < i) return 0;
|
23232 | var nb = utf8CheckByte(buf[j]);
|
23233 | if (nb >= 0) {
|
23234 | if (nb > 0) self.lastNeed = nb - 1;
|
23235 | return nb;
|
23236 | }
|
23237 | if (--j < i || nb === -2) return 0;
|
23238 | nb = utf8CheckByte(buf[j]);
|
23239 | if (nb >= 0) {
|
23240 | if (nb > 0) self.lastNeed = nb - 2;
|
23241 | return nb;
|
23242 | }
|
23243 | if (--j < i || nb === -2) return 0;
|
23244 | nb = utf8CheckByte(buf[j]);
|
23245 | if (nb >= 0) {
|
23246 | if (nb > 0) {
|
23247 | if (nb === 2) nb = 0;else self.lastNeed = nb - 3;
|
23248 | }
|
23249 | return nb;
|
23250 | }
|
23251 | return 0;
|
23252 | }
|
23253 |
|
23254 |
|
23255 |
|
23256 |
|
23257 |
|
23258 |
|
23259 |
|
23260 |
|
23261 |
|
23262 | function utf8CheckExtraBytes(self, buf, p) {
|
23263 | if ((buf[0] & 0xC0) !== 0x80) {
|
23264 | self.lastNeed = 0;
|
23265 | return '\uFFFD';
|
23266 | }
|
23267 | if (self.lastNeed > 1 && buf.length > 1) {
|
23268 | if ((buf[1] & 0xC0) !== 0x80) {
|
23269 | self.lastNeed = 1;
|
23270 | return '\uFFFD';
|
23271 | }
|
23272 | if (self.lastNeed > 2 && buf.length > 2) {
|
23273 | if ((buf[2] & 0xC0) !== 0x80) {
|
23274 | self.lastNeed = 2;
|
23275 | return '\uFFFD';
|
23276 | }
|
23277 | }
|
23278 | }
|
23279 | }
|
23280 |
|
23281 |
|
23282 | function utf8FillLast(buf) {
|
23283 | var p = this.lastTotal - this.lastNeed;
|
23284 | var r = utf8CheckExtraBytes(this, buf, p);
|
23285 | if (r !== undefined) return r;
|
23286 | if (this.lastNeed <= buf.length) {
|
23287 | buf.copy(this.lastChar, p, 0, this.lastNeed);
|
23288 | return this.lastChar.toString(this.encoding, 0, this.lastTotal);
|
23289 | }
|
23290 | buf.copy(this.lastChar, p, 0, buf.length);
|
23291 | this.lastNeed -= buf.length;
|
23292 | }
|
23293 |
|
23294 |
|
23295 |
|
23296 |
|
23297 | function utf8Text(buf, i) {
|
23298 | var total = utf8CheckIncomplete(this, buf, i);
|
23299 | if (!this.lastNeed) return buf.toString('utf8', i);
|
23300 | this.lastTotal = total;
|
23301 | var end = buf.length - (total - this.lastNeed);
|
23302 | buf.copy(this.lastChar, 0, end);
|
23303 | return buf.toString('utf8', i, end);
|
23304 | }
|
23305 |
|
23306 |
|
23307 |
|
23308 | function utf8End(buf) {
|
23309 | var r = buf && buf.length ? this.write(buf) : '';
|
23310 | if (this.lastNeed) return r + '\uFFFD';
|
23311 | return r;
|
23312 | }
|
23313 |
|
23314 |
|
23315 |
|
23316 |
|
23317 |
|
23318 | function utf16Text(buf, i) {
|
23319 | if ((buf.length - i) % 2 === 0) {
|
23320 | var r = buf.toString('utf16le', i);
|
23321 | if (r) {
|
23322 | var c = r.charCodeAt(r.length - 1);
|
23323 | if (c >= 0xD800 && c <= 0xDBFF) {
|
23324 | this.lastNeed = 2;
|
23325 | this.lastTotal = 4;
|
23326 | this.lastChar[0] = buf[buf.length - 2];
|
23327 | this.lastChar[1] = buf[buf.length - 1];
|
23328 | return r.slice(0, -1);
|
23329 | }
|
23330 | }
|
23331 | return r;
|
23332 | }
|
23333 | this.lastNeed = 1;
|
23334 | this.lastTotal = 2;
|
23335 | this.lastChar[0] = buf[buf.length - 1];
|
23336 | return buf.toString('utf16le', i, buf.length - 1);
|
23337 | }
|
23338 |
|
23339 |
|
23340 |
|
23341 | function utf16End(buf) {
|
23342 | var r = buf && buf.length ? this.write(buf) : '';
|
23343 | if (this.lastNeed) {
|
23344 | var end = this.lastTotal - this.lastNeed;
|
23345 | return r + this.lastChar.toString('utf16le', 0, end);
|
23346 | }
|
23347 | return r;
|
23348 | }
|
23349 |
|
23350 | function base64Text(buf, i) {
|
23351 | var n = (buf.length - i) % 3;
|
23352 | if (n === 0) return buf.toString('base64', i);
|
23353 | this.lastNeed = 3 - n;
|
23354 | this.lastTotal = 3;
|
23355 | if (n === 1) {
|
23356 | this.lastChar[0] = buf[buf.length - 1];
|
23357 | } else {
|
23358 | this.lastChar[0] = buf[buf.length - 2];
|
23359 | this.lastChar[1] = buf[buf.length - 1];
|
23360 | }
|
23361 | return buf.toString('base64', i, buf.length - n);
|
23362 | }
|
23363 |
|
23364 | function base64End(buf) {
|
23365 | var r = buf && buf.length ? this.write(buf) : '';
|
23366 | if (this.lastNeed) return r + this.lastChar.toString('base64', 0, 3 - this.lastNeed);
|
23367 | return r;
|
23368 | }
|
23369 |
|
23370 |
|
23371 | function simpleWrite(buf) {
|
23372 | return buf.toString(this.encoding);
|
23373 | }
|
23374 |
|
23375 | function simpleEnd(buf) {
|
23376 | return buf && buf.length ? this.write(buf) : '';
|
23377 | }
|
23378 |
|
23379 | },{"safe-buffer":269}],277:[function(require,module,exports){
|
23380 | (function (setImmediate,clearImmediate){
|
23381 | var nextTick = require('process/browser.js').nextTick;
|
23382 | var apply = Function.prototype.apply;
|
23383 | var slice = Array.prototype.slice;
|
23384 | var immediateIds = {};
|
23385 | var nextImmediateId = 0;
|
23386 |
|
23387 |
|
23388 |
|
23389 | exports.setTimeout = function() {
|
23390 | return new Timeout(apply.call(setTimeout, window, arguments), clearTimeout);
|
23391 | };
|
23392 | exports.setInterval = function() {
|
23393 | return new Timeout(apply.call(setInterval, window, arguments), clearInterval);
|
23394 | };
|
23395 | exports.clearTimeout =
|
23396 | exports.clearInterval = function(timeout) { timeout.close(); };
|
23397 |
|
23398 | function Timeout(id, clearFn) {
|
23399 | this._id = id;
|
23400 | this._clearFn = clearFn;
|
23401 | }
|
23402 | Timeout.prototype.unref = Timeout.prototype.ref = function() {};
|
23403 | Timeout.prototype.close = function() {
|
23404 | this._clearFn.call(window, this._id);
|
23405 | };
|
23406 |
|
23407 |
|
23408 | exports.enroll = function(item, msecs) {
|
23409 | clearTimeout(item._idleTimeoutId);
|
23410 | item._idleTimeout = msecs;
|
23411 | };
|
23412 |
|
23413 | exports.unenroll = function(item) {
|
23414 | clearTimeout(item._idleTimeoutId);
|
23415 | item._idleTimeout = -1;
|
23416 | };
|
23417 |
|
23418 | exports._unrefActive = exports.active = function(item) {
|
23419 | clearTimeout(item._idleTimeoutId);
|
23420 |
|
23421 | var msecs = item._idleTimeout;
|
23422 | if (msecs >= 0) {
|
23423 | item._idleTimeoutId = setTimeout(function onTimeout() {
|
23424 | if (item._onTimeout)
|
23425 | item._onTimeout();
|
23426 | }, msecs);
|
23427 | }
|
23428 | };
|
23429 |
|
23430 |
|
23431 | exports.setImmediate = typeof setImmediate === "function" ? setImmediate : function(fn) {
|
23432 | var id = nextImmediateId++;
|
23433 | var args = arguments.length < 2 ? false : slice.call(arguments, 1);
|
23434 |
|
23435 | immediateIds[id] = true;
|
23436 |
|
23437 | nextTick(function onNextTick() {
|
23438 | if (immediateIds[id]) {
|
23439 |
|
23440 |
|
23441 | if (args) {
|
23442 | fn.apply(null, args);
|
23443 | } else {
|
23444 | fn.call(null);
|
23445 | }
|
23446 |
|
23447 | exports.clearImmediate(id);
|
23448 | }
|
23449 | });
|
23450 |
|
23451 | return id;
|
23452 | };
|
23453 |
|
23454 | exports.clearImmediate = typeof clearImmediate === "function" ? clearImmediate : function(id) {
|
23455 | delete immediateIds[id];
|
23456 | };
|
23457 | }).call(this,require("timers").setImmediate,require("timers").clearImmediate)
|
23458 | },{"process/browser.js":249,"timers":277}],278:[function(require,module,exports){
|
23459 | var Buffer = require('buffer').Buffer
|
23460 |
|
23461 | module.exports = function (buf) {
|
23462 |
|
23463 | if (buf instanceof Uint8Array) {
|
23464 |
|
23465 | if (buf.byteOffset === 0 && buf.byteLength === buf.buffer.byteLength) {
|
23466 | return buf.buffer
|
23467 | } else if (typeof buf.buffer.slice === 'function') {
|
23468 |
|
23469 | return buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength)
|
23470 | }
|
23471 | }
|
23472 |
|
23473 | if (Buffer.isBuffer(buf)) {
|
23474 |
|
23475 |
|
23476 | var arrayCopy = new Uint8Array(buf.length)
|
23477 | var len = buf.length
|
23478 | for (var i = 0; i < len; i++) {
|
23479 | arrayCopy[i] = buf[i]
|
23480 | }
|
23481 | return arrayCopy.buffer
|
23482 | } else {
|
23483 | throw new Error('Argument must be a Buffer')
|
23484 | }
|
23485 | }
|
23486 |
|
23487 | },{"buffer":70}],279:[function(require,module,exports){
|
23488 |
|
23489 |
|
23490 |
|
23491 |
|
23492 |
|
23493 |
|
23494 |
|
23495 |
|
23496 |
|
23497 |
|
23498 |
|
23499 |
|
23500 |
|
23501 |
|
23502 |
|
23503 |
|
23504 |
|
23505 |
|
23506 |
|
23507 |
|
23508 |
|
23509 | 'use strict';
|
23510 |
|
23511 | var punycode = require('punycode');
|
23512 | var util = require('./util');
|
23513 |
|
23514 | exports.parse = urlParse;
|
23515 | exports.resolve = urlResolve;
|
23516 | exports.resolveObject = urlResolveObject;
|
23517 | exports.format = urlFormat;
|
23518 |
|
23519 | exports.Url = Url;
|
23520 |
|
23521 | function Url() {
|
23522 | this.protocol = null;
|
23523 | this.slashes = null;
|
23524 | this.auth = null;
|
23525 | this.host = null;
|
23526 | this.port = null;
|
23527 | this.hostname = null;
|
23528 | this.hash = null;
|
23529 | this.search = null;
|
23530 | this.query = null;
|
23531 | this.pathname = null;
|
23532 | this.path = null;
|
23533 | this.href = null;
|
23534 | }
|
23535 |
|
23536 |
|
23537 |
|
23538 |
|
23539 |
|
23540 | var protocolPattern = /^([a-z0-9.+-]+:)/i,
|
23541 | portPattern = /:[0-9]*$/,
|
23542 |
|
23543 |
|
23544 | simplePathPattern = /^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,
|
23545 |
|
23546 |
|
23547 |
|
23548 | delims = ['<', '>', '"', '`', ' ', '\r', '\n', '\t'],
|
23549 |
|
23550 |
|
23551 | unwise = ['{', '}', '|', '\\', '^', '`'].concat(delims),
|
23552 |
|
23553 |
|
23554 | autoEscape = ['\''].concat(unwise),
|
23555 |
|
23556 |
|
23557 |
|
23558 |
|
23559 | nonHostChars = ['%', '/', '?', ';', '#'].concat(autoEscape),
|
23560 | hostEndingChars = ['/', '?', '#'],
|
23561 | hostnameMaxLen = 255,
|
23562 | hostnamePartPattern = /^[+a-z0-9A-Z_-]{0,63}$/,
|
23563 | hostnamePartStart = /^([+a-z0-9A-Z_-]{0,63})(.*)$/,
|
23564 |
|
23565 | unsafeProtocol = {
|
23566 | 'javascript': true,
|
23567 | 'javascript:': true
|
23568 | },
|
23569 |
|
23570 | hostlessProtocol = {
|
23571 | 'javascript': true,
|
23572 | 'javascript:': true
|
23573 | },
|
23574 |
|
23575 | slashedProtocol = {
|
23576 | 'http': true,
|
23577 | 'https': true,
|
23578 | 'ftp': true,
|
23579 | 'gopher': true,
|
23580 | 'file': true,
|
23581 | 'http:': true,
|
23582 | 'https:': true,
|
23583 | 'ftp:': true,
|
23584 | 'gopher:': true,
|
23585 | 'file:': true
|
23586 | },
|
23587 | querystring = require('querystring');
|
23588 |
|
23589 | function urlParse(url, parseQueryString, slashesDenoteHost) {
|
23590 | if (url && util.isObject(url) && url instanceof Url) return url;
|
23591 |
|
23592 | var u = new Url;
|
23593 | u.parse(url, parseQueryString, slashesDenoteHost);
|
23594 | return u;
|
23595 | }
|
23596 |
|
23597 | Url.prototype.parse = function(url, parseQueryString, slashesDenoteHost) {
|
23598 | if (!util.isString(url)) {
|
23599 | throw new TypeError("Parameter 'url' must be a string, not " + typeof url);
|
23600 | }
|
23601 |
|
23602 |
|
23603 |
|
23604 |
|
23605 | var queryIndex = url.indexOf('?'),
|
23606 | splitter =
|
23607 | (queryIndex !== -1 && queryIndex < url.indexOf('#')) ? '?' : '#',
|
23608 | uSplit = url.split(splitter),
|
23609 | slashRegex = /\\/g;
|
23610 | uSplit[0] = uSplit[0].replace(slashRegex, '/');
|
23611 | url = uSplit.join(splitter);
|
23612 |
|
23613 | var rest = url;
|
23614 |
|
23615 |
|
23616 |
|
23617 | rest = rest.trim();
|
23618 |
|
23619 | if (!slashesDenoteHost && url.split('#').length === 1) {
|
23620 |
|
23621 | var simplePath = simplePathPattern.exec(rest);
|
23622 | if (simplePath) {
|
23623 | this.path = rest;
|
23624 | this.href = rest;
|
23625 | this.pathname = simplePath[1];
|
23626 | if (simplePath[2]) {
|
23627 | this.search = simplePath[2];
|
23628 | if (parseQueryString) {
|
23629 | this.query = querystring.parse(this.search.substr(1));
|
23630 | } else {
|
23631 | this.query = this.search.substr(1);
|
23632 | }
|
23633 | } else if (parseQueryString) {
|
23634 | this.search = '';
|
23635 | this.query = {};
|
23636 | }
|
23637 | return this;
|
23638 | }
|
23639 | }
|
23640 |
|
23641 | var proto = protocolPattern.exec(rest);
|
23642 | if (proto) {
|
23643 | proto = proto[0];
|
23644 | var lowerProto = proto.toLowerCase();
|
23645 | this.protocol = lowerProto;
|
23646 | rest = rest.substr(proto.length);
|
23647 | }
|
23648 |
|
23649 |
|
23650 |
|
23651 |
|
23652 |
|
23653 | if (slashesDenoteHost || proto || rest.match(/^\/\/[^@\/]+@[^@\/]+/)) {
|
23654 | var slashes = rest.substr(0, 2) === '//';
|
23655 | if (slashes && !(proto && hostlessProtocol[proto])) {
|
23656 | rest = rest.substr(2);
|
23657 | this.slashes = true;
|
23658 | }
|
23659 | }
|
23660 |
|
23661 | if (!hostlessProtocol[proto] &&
|
23662 | (slashes || (proto && !slashedProtocol[proto]))) {
|
23663 |
|
23664 |
|
23665 |
|
23666 |
|
23667 |
|
23668 |
|
23669 |
|
23670 |
|
23671 |
|
23672 |
|
23673 |
|
23674 |
|
23675 |
|
23676 |
|
23677 |
|
23678 |
|
23679 |
|
23680 | var hostEnd = -1;
|
23681 | for (var i = 0; i < hostEndingChars.length; i++) {
|
23682 | var hec = rest.indexOf(hostEndingChars[i]);
|
23683 | if (hec !== -1 && (hostEnd === -1 || hec < hostEnd))
|
23684 | hostEnd = hec;
|
23685 | }
|
23686 |
|
23687 |
|
23688 |
|
23689 | var auth, atSign;
|
23690 | if (hostEnd === -1) {
|
23691 |
|
23692 | atSign = rest.lastIndexOf('@');
|
23693 | } else {
|
23694 |
|
23695 |
|
23696 | atSign = rest.lastIndexOf('@', hostEnd);
|
23697 | }
|
23698 |
|
23699 |
|
23700 |
|
23701 | if (atSign !== -1) {
|
23702 | auth = rest.slice(0, atSign);
|
23703 | rest = rest.slice(atSign + 1);
|
23704 | this.auth = decodeURIComponent(auth);
|
23705 | }
|
23706 |
|
23707 |
|
23708 | hostEnd = -1;
|
23709 | for (var i = 0; i < nonHostChars.length; i++) {
|
23710 | var hec = rest.indexOf(nonHostChars[i]);
|
23711 | if (hec !== -1 && (hostEnd === -1 || hec < hostEnd))
|
23712 | hostEnd = hec;
|
23713 | }
|
23714 |
|
23715 | if (hostEnd === -1)
|
23716 | hostEnd = rest.length;
|
23717 |
|
23718 | this.host = rest.slice(0, hostEnd);
|
23719 | rest = rest.slice(hostEnd);
|
23720 |
|
23721 |
|
23722 | this.parseHost();
|
23723 |
|
23724 |
|
23725 |
|
23726 | this.hostname = this.hostname || '';
|
23727 |
|
23728 |
|
23729 |
|
23730 | var ipv6Hostname = this.hostname[0] === '[' &&
|
23731 | this.hostname[this.hostname.length - 1] === ']';
|
23732 |
|
23733 |
|
23734 | if (!ipv6Hostname) {
|
23735 | var hostparts = this.hostname.split(/\./);
|
23736 | for (var i = 0, l = hostparts.length; i < l; i++) {
|
23737 | var part = hostparts[i];
|
23738 | if (!part) continue;
|
23739 | if (!part.match(hostnamePartPattern)) {
|
23740 | var newpart = '';
|
23741 | for (var j = 0, k = part.length; j < k; j++) {
|
23742 | if (part.charCodeAt(j) > 127) {
|
23743 |
|
23744 |
|
23745 |
|
23746 | newpart += 'x';
|
23747 | } else {
|
23748 | newpart += part[j];
|
23749 | }
|
23750 | }
|
23751 |
|
23752 | if (!newpart.match(hostnamePartPattern)) {
|
23753 | var validParts = hostparts.slice(0, i);
|
23754 | var notHost = hostparts.slice(i + 1);
|
23755 | var bit = part.match(hostnamePartStart);
|
23756 | if (bit) {
|
23757 | validParts.push(bit[1]);
|
23758 | notHost.unshift(bit[2]);
|
23759 | }
|
23760 | if (notHost.length) {
|
23761 | rest = '/' + notHost.join('.') + rest;
|
23762 | }
|
23763 | this.hostname = validParts.join('.');
|
23764 | break;
|
23765 | }
|
23766 | }
|
23767 | }
|
23768 | }
|
23769 |
|
23770 | if (this.hostname.length > hostnameMaxLen) {
|
23771 | this.hostname = '';
|
23772 | } else {
|
23773 |
|
23774 | this.hostname = this.hostname.toLowerCase();
|
23775 | }
|
23776 |
|
23777 | if (!ipv6Hostname) {
|
23778 |
|
23779 |
|
23780 |
|
23781 |
|
23782 | this.hostname = punycode.toASCII(this.hostname);
|
23783 | }
|
23784 |
|
23785 | var p = this.port ? ':' + this.port : '';
|
23786 | var h = this.hostname || '';
|
23787 | this.host = h + p;
|
23788 | this.href += this.host;
|
23789 |
|
23790 |
|
23791 |
|
23792 | if (ipv6Hostname) {
|
23793 | this.hostname = this.hostname.substr(1, this.hostname.length - 2);
|
23794 | if (rest[0] !== '/') {
|
23795 | rest = '/' + rest;
|
23796 | }
|
23797 | }
|
23798 | }
|
23799 |
|
23800 |
|
23801 |
|
23802 | if (!unsafeProtocol[lowerProto]) {
|
23803 |
|
23804 |
|
23805 |
|
23806 |
|
23807 | for (var i = 0, l = autoEscape.length; i < l; i++) {
|
23808 | var ae = autoEscape[i];
|
23809 | if (rest.indexOf(ae) === -1)
|
23810 | continue;
|
23811 | var esc = encodeURIComponent(ae);
|
23812 | if (esc === ae) {
|
23813 | esc = escape(ae);
|
23814 | }
|
23815 | rest = rest.split(ae).join(esc);
|
23816 | }
|
23817 | }
|
23818 |
|
23819 |
|
23820 |
|
23821 | var hash = rest.indexOf('#');
|
23822 | if (hash !== -1) {
|
23823 |
|
23824 | this.hash = rest.substr(hash);
|
23825 | rest = rest.slice(0, hash);
|
23826 | }
|
23827 | var qm = rest.indexOf('?');
|
23828 | if (qm !== -1) {
|
23829 | this.search = rest.substr(qm);
|
23830 | this.query = rest.substr(qm + 1);
|
23831 | if (parseQueryString) {
|
23832 | this.query = querystring.parse(this.query);
|
23833 | }
|
23834 | rest = rest.slice(0, qm);
|
23835 | } else if (parseQueryString) {
|
23836 |
|
23837 | this.search = '';
|
23838 | this.query = {};
|
23839 | }
|
23840 | if (rest) this.pathname = rest;
|
23841 | if (slashedProtocol[lowerProto] &&
|
23842 | this.hostname && !this.pathname) {
|
23843 | this.pathname = '/';
|
23844 | }
|
23845 |
|
23846 |
|
23847 | if (this.pathname || this.search) {
|
23848 | var p = this.pathname || '';
|
23849 | var s = this.search || '';
|
23850 | this.path = p + s;
|
23851 | }
|
23852 |
|
23853 |
|
23854 | this.href = this.format();
|
23855 | return this;
|
23856 | };
|
23857 |
|
23858 |
|
23859 | function urlFormat(obj) {
|
23860 |
|
23861 |
|
23862 |
|
23863 |
|
23864 | if (util.isString(obj)) obj = urlParse(obj);
|
23865 | if (!(obj instanceof Url)) return Url.prototype.format.call(obj);
|
23866 | return obj.format();
|
23867 | }
|
23868 |
|
23869 | Url.prototype.format = function() {
|
23870 | var auth = this.auth || '';
|
23871 | if (auth) {
|
23872 | auth = encodeURIComponent(auth);
|
23873 | auth = auth.replace(/%3A/i, ':');
|
23874 | auth += '@';
|
23875 | }
|
23876 |
|
23877 | var protocol = this.protocol || '',
|
23878 | pathname = this.pathname || '',
|
23879 | hash = this.hash || '',
|
23880 | host = false,
|
23881 | query = '';
|
23882 |
|
23883 | if (this.host) {
|
23884 | host = auth + this.host;
|
23885 | } else if (this.hostname) {
|
23886 | host = auth + (this.hostname.indexOf(':') === -1 ?
|
23887 | this.hostname :
|
23888 | '[' + this.hostname + ']');
|
23889 | if (this.port) {
|
23890 | host += ':' + this.port;
|
23891 | }
|
23892 | }
|
23893 |
|
23894 | if (this.query &&
|
23895 | util.isObject(this.query) &&
|
23896 | Object.keys(this.query).length) {
|
23897 | query = querystring.stringify(this.query);
|
23898 | }
|
23899 |
|
23900 | var search = this.search || (query && ('?' + query)) || '';
|
23901 |
|
23902 | if (protocol && protocol.substr(-1) !== ':') protocol += ':';
|
23903 |
|
23904 |
|
23905 |
|
23906 | if (this.slashes ||
|
23907 | (!protocol || slashedProtocol[protocol]) && host !== false) {
|
23908 | host = '//' + (host || '');
|
23909 | if (pathname && pathname.charAt(0) !== '/') pathname = '/' + pathname;
|
23910 | } else if (!host) {
|
23911 | host = '';
|
23912 | }
|
23913 |
|
23914 | if (hash && hash.charAt(0) !== '#') hash = '#' + hash;
|
23915 | if (search && search.charAt(0) !== '?') search = '?' + search;
|
23916 |
|
23917 | pathname = pathname.replace(/[?#]/g, function(match) {
|
23918 | return encodeURIComponent(match);
|
23919 | });
|
23920 | search = search.replace('#', '%23');
|
23921 |
|
23922 | return protocol + host + pathname + search + hash;
|
23923 | };
|
23924 |
|
23925 | function urlResolve(source, relative) {
|
23926 | return urlParse(source, false, true).resolve(relative);
|
23927 | }
|
23928 |
|
23929 | Url.prototype.resolve = function(relative) {
|
23930 | return this.resolveObject(urlParse(relative, false, true)).format();
|
23931 | };
|
23932 |
|
23933 | function urlResolveObject(source, relative) {
|
23934 | if (!source) return relative;
|
23935 | return urlParse(source, false, true).resolveObject(relative);
|
23936 | }
|
23937 |
|
23938 | Url.prototype.resolveObject = function(relative) {
|
23939 | if (util.isString(relative)) {
|
23940 | var rel = new Url();
|
23941 | rel.parse(relative, false, true);
|
23942 | relative = rel;
|
23943 | }
|
23944 |
|
23945 | var result = new Url();
|
23946 | var tkeys = Object.keys(this);
|
23947 | for (var tk = 0; tk < tkeys.length; tk++) {
|
23948 | var tkey = tkeys[tk];
|
23949 | result[tkey] = this[tkey];
|
23950 | }
|
23951 |
|
23952 |
|
23953 |
|
23954 | result.hash = relative.hash;
|
23955 |
|
23956 |
|
23957 | if (relative.href === '') {
|
23958 | result.href = result.format();
|
23959 | return result;
|
23960 | }
|
23961 |
|
23962 |
|
23963 | if (relative.slashes && !relative.protocol) {
|
23964 |
|
23965 | var rkeys = Object.keys(relative);
|
23966 | for (var rk = 0; rk < rkeys.length; rk++) {
|
23967 | var rkey = rkeys[rk];
|
23968 | if (rkey !== 'protocol')
|
23969 | result[rkey] = relative[rkey];
|
23970 | }
|
23971 |
|
23972 |
|
23973 | if (slashedProtocol[result.protocol] &&
|
23974 | result.hostname && !result.pathname) {
|
23975 | result.path = result.pathname = '/';
|
23976 | }
|
23977 |
|
23978 | result.href = result.format();
|
23979 | return result;
|
23980 | }
|
23981 |
|
23982 | if (relative.protocol && relative.protocol !== result.protocol) {
|
23983 |
|
23984 |
|
23985 |
|
23986 |
|
23987 |
|
23988 |
|
23989 |
|
23990 |
|
23991 | if (!slashedProtocol[relative.protocol]) {
|
23992 | var keys = Object.keys(relative);
|
23993 | for (var v = 0; v < keys.length; v++) {
|
23994 | var k = keys[v];
|
23995 | result[k] = relative[k];
|
23996 | }
|
23997 | result.href = result.format();
|
23998 | return result;
|
23999 | }
|
24000 |
|
24001 | result.protocol = relative.protocol;
|
24002 | if (!relative.host && !hostlessProtocol[relative.protocol]) {
|
24003 | var relPath = (relative.pathname || '').split('/');
|
24004 | while (relPath.length && !(relative.host = relPath.shift()));
|
24005 | if (!relative.host) relative.host = '';
|
24006 | if (!relative.hostname) relative.hostname = '';
|
24007 | if (relPath[0] !== '') relPath.unshift('');
|
24008 | if (relPath.length < 2) relPath.unshift('');
|
24009 | result.pathname = relPath.join('/');
|
24010 | } else {
|
24011 | result.pathname = relative.pathname;
|
24012 | }
|
24013 | result.search = relative.search;
|
24014 | result.query = relative.query;
|
24015 | result.host = relative.host || '';
|
24016 | result.auth = relative.auth;
|
24017 | result.hostname = relative.hostname || relative.host;
|
24018 | result.port = relative.port;
|
24019 |
|
24020 | if (result.pathname || result.search) {
|
24021 | var p = result.pathname || '';
|
24022 | var s = result.search || '';
|
24023 | result.path = p + s;
|
24024 | }
|
24025 | result.slashes = result.slashes || relative.slashes;
|
24026 | result.href = result.format();
|
24027 | return result;
|
24028 | }
|
24029 |
|
24030 | var isSourceAbs = (result.pathname && result.pathname.charAt(0) === '/'),
|
24031 | isRelAbs = (
|
24032 | relative.host ||
|
24033 | relative.pathname && relative.pathname.charAt(0) === '/'
|
24034 | ),
|
24035 | mustEndAbs = (isRelAbs || isSourceAbs ||
|
24036 | (result.host && relative.pathname)),
|
24037 | removeAllDots = mustEndAbs,
|
24038 | srcPath = result.pathname && result.pathname.split('/') || [],
|
24039 | relPath = relative.pathname && relative.pathname.split('/') || [],
|
24040 | psychotic = result.protocol && !slashedProtocol[result.protocol];
|
24041 |
|
24042 |
|
24043 |
|
24044 |
|
24045 |
|
24046 |
|
24047 | if (psychotic) {
|
24048 | result.hostname = '';
|
24049 | result.port = null;
|
24050 | if (result.host) {
|
24051 | if (srcPath[0] === '') srcPath[0] = result.host;
|
24052 | else srcPath.unshift(result.host);
|
24053 | }
|
24054 | result.host = '';
|
24055 | if (relative.protocol) {
|
24056 | relative.hostname = null;
|
24057 | relative.port = null;
|
24058 | if (relative.host) {
|
24059 | if (relPath[0] === '') relPath[0] = relative.host;
|
24060 | else relPath.unshift(relative.host);
|
24061 | }
|
24062 | relative.host = null;
|
24063 | }
|
24064 | mustEndAbs = mustEndAbs && (relPath[0] === '' || srcPath[0] === '');
|
24065 | }
|
24066 |
|
24067 | if (isRelAbs) {
|
24068 |
|
24069 | result.host = (relative.host || relative.host === '') ?
|
24070 | relative.host : result.host;
|
24071 | result.hostname = (relative.hostname || relative.hostname === '') ?
|
24072 | relative.hostname : result.hostname;
|
24073 | result.search = relative.search;
|
24074 | result.query = relative.query;
|
24075 | srcPath = relPath;
|
24076 |
|
24077 | } else if (relPath.length) {
|
24078 |
|
24079 |
|
24080 | if (!srcPath) srcPath = [];
|
24081 | srcPath.pop();
|
24082 | srcPath = srcPath.concat(relPath);
|
24083 | result.search = relative.search;
|
24084 | result.query = relative.query;
|
24085 | } else if (!util.isNullOrUndefined(relative.search)) {
|
24086 |
|
24087 |
|
24088 |
|
24089 | if (psychotic) {
|
24090 | result.hostname = result.host = srcPath.shift();
|
24091 |
|
24092 |
|
24093 |
|
24094 | var authInHost = result.host && result.host.indexOf('@') > 0 ?
|
24095 | result.host.split('@') : false;
|
24096 | if (authInHost) {
|
24097 | result.auth = authInHost.shift();
|
24098 | result.host = result.hostname = authInHost.shift();
|
24099 | }
|
24100 | }
|
24101 | result.search = relative.search;
|
24102 | result.query = relative.query;
|
24103 |
|
24104 | if (!util.isNull(result.pathname) || !util.isNull(result.search)) {
|
24105 | result.path = (result.pathname ? result.pathname : '') +
|
24106 | (result.search ? result.search : '');
|
24107 | }
|
24108 | result.href = result.format();
|
24109 | return result;
|
24110 | }
|
24111 |
|
24112 | if (!srcPath.length) {
|
24113 |
|
24114 |
|
24115 | result.pathname = null;
|
24116 |
|
24117 | if (result.search) {
|
24118 | result.path = '/' + result.search;
|
24119 | } else {
|
24120 | result.path = null;
|
24121 | }
|
24122 | result.href = result.format();
|
24123 | return result;
|
24124 | }
|
24125 |
|
24126 |
|
24127 |
|
24128 |
|
24129 | var last = srcPath.slice(-1)[0];
|
24130 | var hasTrailingSlash = (
|
24131 | (result.host || relative.host || srcPath.length > 1) &&
|
24132 | (last === '.' || last === '..') || last === '');
|
24133 |
|
24134 |
|
24135 |
|
24136 | var up = 0;
|
24137 | for (var i = srcPath.length; i >= 0; i--) {
|
24138 | last = srcPath[i];
|
24139 | if (last === '.') {
|
24140 | srcPath.splice(i, 1);
|
24141 | } else if (last === '..') {
|
24142 | srcPath.splice(i, 1);
|
24143 | up++;
|
24144 | } else if (up) {
|
24145 | srcPath.splice(i, 1);
|
24146 | up--;
|
24147 | }
|
24148 | }
|
24149 |
|
24150 |
|
24151 | if (!mustEndAbs && !removeAllDots) {
|
24152 | for (; up--; up) {
|
24153 | srcPath.unshift('..');
|
24154 | }
|
24155 | }
|
24156 |
|
24157 | if (mustEndAbs && srcPath[0] !== '' &&
|
24158 | (!srcPath[0] || srcPath[0].charAt(0) !== '/')) {
|
24159 | srcPath.unshift('');
|
24160 | }
|
24161 |
|
24162 | if (hasTrailingSlash && (srcPath.join('/').substr(-1) !== '/')) {
|
24163 | srcPath.push('');
|
24164 | }
|
24165 |
|
24166 | var isAbsolute = srcPath[0] === '' ||
|
24167 | (srcPath[0] && srcPath[0].charAt(0) === '/');
|
24168 |
|
24169 |
|
24170 | if (psychotic) {
|
24171 | result.hostname = result.host = isAbsolute ? '' :
|
24172 | srcPath.length ? srcPath.shift() : '';
|
24173 |
|
24174 |
|
24175 |
|
24176 | var authInHost = result.host && result.host.indexOf('@') > 0 ?
|
24177 | result.host.split('@') : false;
|
24178 | if (authInHost) {
|
24179 | result.auth = authInHost.shift();
|
24180 | result.host = result.hostname = authInHost.shift();
|
24181 | }
|
24182 | }
|
24183 |
|
24184 | mustEndAbs = mustEndAbs || (result.host && srcPath.length);
|
24185 |
|
24186 | if (mustEndAbs && !isAbsolute) {
|
24187 | srcPath.unshift('');
|
24188 | }
|
24189 |
|
24190 | if (!srcPath.length) {
|
24191 | result.pathname = null;
|
24192 | result.path = null;
|
24193 | } else {
|
24194 | result.pathname = srcPath.join('/');
|
24195 | }
|
24196 |
|
24197 |
|
24198 | if (!util.isNull(result.pathname) || !util.isNull(result.search)) {
|
24199 | result.path = (result.pathname ? result.pathname : '') +
|
24200 | (result.search ? result.search : '');
|
24201 | }
|
24202 | result.auth = relative.auth || result.auth;
|
24203 | result.slashes = result.slashes || relative.slashes;
|
24204 | result.href = result.format();
|
24205 | return result;
|
24206 | };
|
24207 |
|
24208 | Url.prototype.parseHost = function() {
|
24209 | var host = this.host;
|
24210 | var port = portPattern.exec(host);
|
24211 | if (port) {
|
24212 | port = port[0];
|
24213 | if (port !== ':') {
|
24214 | this.port = port.substr(1);
|
24215 | }
|
24216 | host = host.substr(0, host.length - port.length);
|
24217 | }
|
24218 | if (host) this.hostname = host;
|
24219 | };
|
24220 |
|
24221 | },{"./util":280,"punycode":250,"querystring":253}],280:[function(require,module,exports){
|
24222 | 'use strict';
|
24223 |
|
24224 | module.exports = {
|
24225 | isString: function(arg) {
|
24226 | return typeof(arg) === 'string';
|
24227 | },
|
24228 | isObject: function(arg) {
|
24229 | return typeof(arg) === 'object' && arg !== null;
|
24230 | },
|
24231 | isNull: function(arg) {
|
24232 | return arg === null;
|
24233 | },
|
24234 | isNullOrUndefined: function(arg) {
|
24235 | return arg == null;
|
24236 | }
|
24237 | };
|
24238 |
|
24239 | },{}],281:[function(require,module,exports){
|
24240 | (function (global){
|
24241 |
|
24242 |
|
24243 |
|
24244 |
|
24245 |
|
24246 | module.exports = deprecate;
|
24247 |
|
24248 |
|
24249 |
|
24250 |
|
24251 |
|
24252 |
|
24253 |
|
24254 |
|
24255 |
|
24256 |
|
24257 |
|
24258 |
|
24259 |
|
24260 |
|
24261 |
|
24262 |
|
24263 |
|
24264 |
|
24265 |
|
24266 | function deprecate (fn, msg) {
|
24267 | if (config('noDeprecation')) {
|
24268 | return fn;
|
24269 | }
|
24270 |
|
24271 | var warned = false;
|
24272 | function deprecated() {
|
24273 | if (!warned) {
|
24274 | if (config('throwDeprecation')) {
|
24275 | throw new Error(msg);
|
24276 | } else if (config('traceDeprecation')) {
|
24277 | console.trace(msg);
|
24278 | } else {
|
24279 | console.warn(msg);
|
24280 | }
|
24281 | warned = true;
|
24282 | }
|
24283 | return fn.apply(this, arguments);
|
24284 | }
|
24285 |
|
24286 | return deprecated;
|
24287 | }
|
24288 |
|
24289 |
|
24290 |
|
24291 |
|
24292 |
|
24293 |
|
24294 |
|
24295 |
|
24296 |
|
24297 | function config (name) {
|
24298 |
|
24299 | try {
|
24300 | if (!global.localStorage) return false;
|
24301 | } catch (_) {
|
24302 | return false;
|
24303 | }
|
24304 | var val = global.localStorage[name];
|
24305 | if (null == val) return false;
|
24306 | return String(val).toLowerCase() === 'true';
|
24307 | }
|
24308 |
|
24309 | }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
24310 | },{}],282:[function(require,module,exports){
|
24311 | 'use strict';
|
24312 |
|
24313 | var isES5 = typeof Object.defineProperty === 'function'
|
24314 | && typeof Object.defineProperties === 'function'
|
24315 | && typeof Object.getPrototypeOf === 'function'
|
24316 | && typeof Object.setPrototypeOf === 'function';
|
24317 |
|
24318 | if (!isES5) {
|
24319 | throw new TypeError('util.promisify requires a true ES5 environment');
|
24320 | }
|
24321 |
|
24322 | var getOwnPropertyDescriptors = require('object.getownpropertydescriptors');
|
24323 |
|
24324 | if (typeof Promise !== 'function') {
|
24325 | throw new TypeError('`Promise` must be globally available for util.promisify to work.');
|
24326 | }
|
24327 |
|
24328 | var slice = Function.call.bind(Array.prototype.slice);
|
24329 | var concat = Function.call.bind(Array.prototype.concat);
|
24330 | var forEach = Function.call.bind(Array.prototype.forEach);
|
24331 |
|
24332 | var hasSymbols = typeof Symbol === 'function' && typeof Symbol('') === 'symbol';
|
24333 |
|
24334 | var kCustomPromisifiedSymbol = hasSymbols ? Symbol('util.promisify.custom') : null;
|
24335 | var kCustomPromisifyArgsSymbol = hasSymbols ? Symbol('customPromisifyArgs') : null;
|
24336 |
|
24337 | module.exports = function promisify(orig) {
|
24338 | if (typeof orig !== 'function') {
|
24339 | var error = new TypeError('The "original" argument must be of type function');
|
24340 | error.name = 'TypeError [ERR_INVALID_ARG_TYPE]';
|
24341 | error.code = 'ERR_INVALID_ARG_TYPE';
|
24342 | throw error;
|
24343 | }
|
24344 |
|
24345 | if (hasSymbols && orig[kCustomPromisifiedSymbol]) {
|
24346 | var customFunction = orig[kCustomPromisifiedSymbol];
|
24347 | if (typeof customFunction !== 'function') {
|
24348 | throw new TypeError('The [util.promisify.custom] property must be a function');
|
24349 | }
|
24350 | Object.defineProperty(customFunction, kCustomPromisifiedSymbol, {
|
24351 | configurable: true,
|
24352 | enumerable: false,
|
24353 | value: customFunction,
|
24354 | writable: false
|
24355 | });
|
24356 | return customFunction;
|
24357 | }
|
24358 |
|
24359 |
|
24360 |
|
24361 | var argumentNames = orig[kCustomPromisifyArgsSymbol];
|
24362 |
|
24363 | var promisified = function fn() {
|
24364 | var args = slice(arguments);
|
24365 | var self = this;
|
24366 | return new Promise(function (resolve, reject) {
|
24367 | orig.apply(self, concat(args, function (err) {
|
24368 | var values = arguments.length > 1 ? slice(arguments, 1) : [];
|
24369 | if (err) {
|
24370 | reject(err);
|
24371 | } else if (typeof argumentNames !== 'undefined' && values.length > 1) {
|
24372 | var obj = {};
|
24373 | forEach(argumentNames, function (name, index) {
|
24374 | obj[name] = values[index];
|
24375 | });
|
24376 | resolve(obj);
|
24377 | } else {
|
24378 | resolve(values[0]);
|
24379 | }
|
24380 | }));
|
24381 | });
|
24382 | };
|
24383 |
|
24384 | Object.setPrototypeOf(promisified, Object.getPrototypeOf(orig));
|
24385 |
|
24386 | Object.defineProperty(promisified, kCustomPromisifiedSymbol, {
|
24387 | configurable: true,
|
24388 | enumerable: false,
|
24389 | value: promisified,
|
24390 | writable: false
|
24391 | });
|
24392 | return Object.defineProperties(promisified, getOwnPropertyDescriptors(orig));
|
24393 | };
|
24394 |
|
24395 | module.exports.custom = kCustomPromisifiedSymbol;
|
24396 | module.exports.customPromisifyArgs = kCustomPromisifyArgsSymbol;
|
24397 |
|
24398 | },{"object.getownpropertydescriptors":243}],283:[function(require,module,exports){
|
24399 | 'use strict';
|
24400 |
|
24401 | var define = require('define-properties');
|
24402 | var util = require('util');
|
24403 |
|
24404 | var implementation = require('./implementation');
|
24405 | var getPolyfill = require('./polyfill');
|
24406 | var polyfill = getPolyfill();
|
24407 | var shim = require('./shim');
|
24408 |
|
24409 |
|
24410 | var boundPromisify = function promisify(orig) {
|
24411 |
|
24412 | return polyfill.apply(util, arguments);
|
24413 | };
|
24414 | define(boundPromisify, {
|
24415 | custom: polyfill.custom,
|
24416 | customPromisifyArgs: polyfill.customPromisifyArgs,
|
24417 | getPolyfill: getPolyfill,
|
24418 | implementation: implementation,
|
24419 | shim: shim
|
24420 | });
|
24421 |
|
24422 | module.exports = boundPromisify;
|
24423 |
|
24424 | },{"./implementation":282,"./polyfill":284,"./shim":285,"define-properties":190,"util":287}],284:[function(require,module,exports){
|
24425 | 'use strict';
|
24426 |
|
24427 | var util = require('util');
|
24428 | var implementation = require('./implementation');
|
24429 |
|
24430 | module.exports = function getPolyfill() {
|
24431 | if (typeof util.promisify === 'function') {
|
24432 | return util.promisify;
|
24433 | }
|
24434 | return implementation;
|
24435 | };
|
24436 |
|
24437 | },{"./implementation":282,"util":287}],285:[function(require,module,exports){
|
24438 | 'use strict';
|
24439 |
|
24440 | var util = require('util');
|
24441 | var getPolyfill = require('./polyfill');
|
24442 |
|
24443 | module.exports = function shimUtilPromisify() {
|
24444 | var polyfill = getPolyfill();
|
24445 | if (polyfill !== util.promisify) {
|
24446 | util.promisify = polyfill;
|
24447 | Object.defineProperty(util, 'promisify', { value: polyfill });
|
24448 | }
|
24449 | return polyfill;
|
24450 | };
|
24451 |
|
24452 | },{"./polyfill":284,"util":287}],286:[function(require,module,exports){
|
24453 | module.exports = function isBuffer(arg) {
|
24454 | return arg && typeof arg === 'object'
|
24455 | && typeof arg.copy === 'function'
|
24456 | && typeof arg.fill === 'function'
|
24457 | && typeof arg.readUInt8 === 'function';
|
24458 | }
|
24459 | },{}],287:[function(require,module,exports){
|
24460 | (function (process,global){
|
24461 |
|
24462 |
|
24463 |
|
24464 |
|
24465 |
|
24466 |
|
24467 |
|
24468 |
|
24469 |
|
24470 |
|
24471 |
|
24472 |
|
24473 |
|
24474 |
|
24475 |
|
24476 |
|
24477 |
|
24478 |
|
24479 |
|
24480 |
|
24481 |
|
24482 | var formatRegExp = /%[sdj%]/g;
|
24483 | exports.format = function(f) {
|
24484 | if (!isString(f)) {
|
24485 | var objects = [];
|
24486 | for (var i = 0; i < arguments.length; i++) {
|
24487 | objects.push(inspect(arguments[i]));
|
24488 | }
|
24489 | return objects.join(' ');
|
24490 | }
|
24491 |
|
24492 | var i = 1;
|
24493 | var args = arguments;
|
24494 | var len = args.length;
|
24495 | var str = String(f).replace(formatRegExp, function(x) {
|
24496 | if (x === '%%') return '%';
|
24497 | if (i >= len) return x;
|
24498 | switch (x) {
|
24499 | case '%s': return String(args[i++]);
|
24500 | case '%d': return Number(args[i++]);
|
24501 | case '%j':
|
24502 | try {
|
24503 | return JSON.stringify(args[i++]);
|
24504 | } catch (_) {
|
24505 | return '[Circular]';
|
24506 | }
|
24507 | default:
|
24508 | return x;
|
24509 | }
|
24510 | });
|
24511 | for (var x = args[i]; i < len; x = args[++i]) {
|
24512 | if (isNull(x) || !isObject(x)) {
|
24513 | str += ' ' + x;
|
24514 | } else {
|
24515 | str += ' ' + inspect(x);
|
24516 | }
|
24517 | }
|
24518 | return str;
|
24519 | };
|
24520 |
|
24521 |
|
24522 |
|
24523 |
|
24524 |
|
24525 | exports.deprecate = function(fn, msg) {
|
24526 |
|
24527 | if (isUndefined(global.process)) {
|
24528 | return function() {
|
24529 | return exports.deprecate(fn, msg).apply(this, arguments);
|
24530 | };
|
24531 | }
|
24532 |
|
24533 | if (process.noDeprecation === true) {
|
24534 | return fn;
|
24535 | }
|
24536 |
|
24537 | var warned = false;
|
24538 | function deprecated() {
|
24539 | if (!warned) {
|
24540 | if (process.throwDeprecation) {
|
24541 | throw new Error(msg);
|
24542 | } else if (process.traceDeprecation) {
|
24543 | console.trace(msg);
|
24544 | } else {
|
24545 | console.error(msg);
|
24546 | }
|
24547 | warned = true;
|
24548 | }
|
24549 | return fn.apply(this, arguments);
|
24550 | }
|
24551 |
|
24552 | return deprecated;
|
24553 | };
|
24554 |
|
24555 |
|
24556 | var debugs = {};
|
24557 | var debugEnviron;
|
24558 | exports.debuglog = function(set) {
|
24559 | if (isUndefined(debugEnviron))
|
24560 | debugEnviron = process.env.NODE_DEBUG || '';
|
24561 | set = set.toUpperCase();
|
24562 | if (!debugs[set]) {
|
24563 | if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) {
|
24564 | var pid = process.pid;
|
24565 | debugs[set] = function() {
|
24566 | var msg = exports.format.apply(exports, arguments);
|
24567 | console.error('%s %d: %s', set, pid, msg);
|
24568 | };
|
24569 | } else {
|
24570 | debugs[set] = function() {};
|
24571 | }
|
24572 | }
|
24573 | return debugs[set];
|
24574 | };
|
24575 |
|
24576 |
|
24577 | /**
|
24578 | * Echos the value of a value. Trys to print the value out
|
24579 | * in the best way possible given the different types.
|
24580 | *
|
24581 | * @param {Object} obj The object to print out.
|
24582 | * @param {Object} opts Optional options object that alters the output.
|
24583 | */
|
24584 |
|
24585 | function inspect(obj, opts) {
|
24586 |
|
24587 | var ctx = {
|
24588 | seen: [],
|
24589 | stylize: stylizeNoColor
|
24590 | };
|
24591 |
|
24592 | if (arguments.length >= 3) ctx.depth = arguments[2];
|
24593 | if (arguments.length >= 4) ctx.colors = arguments[3];
|
24594 | if (isBoolean(opts)) {
|
24595 |
|
24596 | ctx.showHidden = opts;
|
24597 | } else if (opts) {
|
24598 |
|
24599 | exports._extend(ctx, opts);
|
24600 | }
|
24601 |
|
24602 | if (isUndefined(ctx.showHidden)) ctx.showHidden = false;
|
24603 | if (isUndefined(ctx.depth)) ctx.depth = 2;
|
24604 | if (isUndefined(ctx.colors)) ctx.colors = false;
|
24605 | if (isUndefined(ctx.customInspect)) ctx.customInspect = true;
|
24606 | if (ctx.colors) ctx.stylize = stylizeWithColor;
|
24607 | return formatValue(ctx, obj, ctx.depth);
|
24608 | }
|
24609 | exports.inspect = inspect;
|
24610 |
|
24611 |
|
24612 |
|
24613 | inspect.colors = {
|
24614 | 'bold' : [1, 22],
|
24615 | 'italic' : [3, 23],
|
24616 | 'underline' : [4, 24],
|
24617 | 'inverse' : [7, 27],
|
24618 | 'white' : [37, 39],
|
24619 | 'grey' : [90, 39],
|
24620 | 'black' : [30, 39],
|
24621 | 'blue' : [34, 39],
|
24622 | 'cyan' : [36, 39],
|
24623 | 'green' : [32, 39],
|
24624 | 'magenta' : [35, 39],
|
24625 | 'red' : [31, 39],
|
24626 | 'yellow' : [33, 39]
|
24627 | };
|
24628 |
|
24629 |
|
24630 | inspect.styles = {
|
24631 | 'special': 'cyan',
|
24632 | 'number': 'yellow',
|
24633 | 'boolean': 'yellow',
|
24634 | 'undefined': 'grey',
|
24635 | 'null': 'bold',
|
24636 | 'string': 'green',
|
24637 | 'date': 'magenta',
|
24638 |
|
24639 | 'regexp': 'red'
|
24640 | };
|
24641 |
|
24642 |
|
24643 | function stylizeWithColor(str, styleType) {
|
24644 | var style = inspect.styles[styleType];
|
24645 |
|
24646 | if (style) {
|
24647 | return '\u001b[' + inspect.colors[style][0] + 'm' + str +
|
24648 | '\u001b[' + inspect.colors[style][1] + 'm';
|
24649 | } else {
|
24650 | return str;
|
24651 | }
|
24652 | }
|
24653 |
|
24654 |
|
24655 | function stylizeNoColor(str, styleType) {
|
24656 | return str;
|
24657 | }
|
24658 |
|
24659 |
|
24660 | function arrayToHash(array) {
|
24661 | var hash = {};
|
24662 |
|
24663 | array.forEach(function(val, idx) {
|
24664 | hash[val] = true;
|
24665 | });
|
24666 |
|
24667 | return hash;
|
24668 | }
|
24669 |
|
24670 |
|
24671 | function formatValue(ctx, value, recurseTimes) {
|
24672 |
|
24673 |
|
24674 | if (ctx.customInspect &&
|
24675 | value &&
|
24676 | isFunction(value.inspect) &&
|
24677 |
|
24678 | value.inspect !== exports.inspect &&
|
24679 |
|
24680 | !(value.constructor && value.constructor.prototype === value)) {
|
24681 | var ret = value.inspect(recurseTimes, ctx);
|
24682 | if (!isString(ret)) {
|
24683 | ret = formatValue(ctx, ret, recurseTimes);
|
24684 | }
|
24685 | return ret;
|
24686 | }
|
24687 |
|
24688 |
|
24689 | var primitive = formatPrimitive(ctx, value);
|
24690 | if (primitive) {
|
24691 | return primitive;
|
24692 | }
|
24693 |
|
24694 |
|
24695 | var keys = Object.keys(value);
|
24696 | var visibleKeys = arrayToHash(keys);
|
24697 |
|
24698 | if (ctx.showHidden) {
|
24699 | keys = Object.getOwnPropertyNames(value);
|
24700 | }
|
24701 |
|
24702 |
|
24703 |
|
24704 | if (isError(value)
|
24705 | && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {
|
24706 | return formatError(value);
|
24707 | }
|
24708 |
|
24709 |
|
24710 | if (keys.length === 0) {
|
24711 | if (isFunction(value)) {
|
24712 | var name = value.name ? ': ' + value.name : '';
|
24713 | return ctx.stylize('[Function' + name + ']', 'special');
|
24714 | }
|
24715 | if (isRegExp(value)) {
|
24716 | return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
|
24717 | }
|
24718 | if (isDate(value)) {
|
24719 | return ctx.stylize(Date.prototype.toString.call(value), 'date');
|
24720 | }
|
24721 | if (isError(value)) {
|
24722 | return formatError(value);
|
24723 | }
|
24724 | }
|
24725 |
|
24726 | var base = '', array = false, braces = ['{', '}'];
|
24727 |
|
24728 |
|
24729 | if (isArray(value)) {
|
24730 | array = true;
|
24731 | braces = ['[', ']'];
|
24732 | }
|
24733 |
|
24734 |
|
24735 | if (isFunction(value)) {
|
24736 | var n = value.name ? ': ' + value.name : '';
|
24737 | base = ' [Function' + n + ']';
|
24738 | }
|
24739 |
|
24740 |
|
24741 | if (isRegExp(value)) {
|
24742 | base = ' ' + RegExp.prototype.toString.call(value);
|
24743 | }
|
24744 |
|
24745 |
|
24746 | if (isDate(value)) {
|
24747 | base = ' ' + Date.prototype.toUTCString.call(value);
|
24748 | }
|
24749 |
|
24750 |
|
24751 | if (isError(value)) {
|
24752 | base = ' ' + formatError(value);
|
24753 | }
|
24754 |
|
24755 | if (keys.length === 0 && (!array || value.length == 0)) {
|
24756 | return braces[0] + base + braces[1];
|
24757 | }
|
24758 |
|
24759 | if (recurseTimes < 0) {
|
24760 | if (isRegExp(value)) {
|
24761 | return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
|
24762 | } else {
|
24763 | return ctx.stylize('[Object]', 'special');
|
24764 | }
|
24765 | }
|
24766 |
|
24767 | ctx.seen.push(value);
|
24768 |
|
24769 | var output;
|
24770 | if (array) {
|
24771 | output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);
|
24772 | } else {
|
24773 | output = keys.map(function(key) {
|
24774 | return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);
|
24775 | });
|
24776 | }
|
24777 |
|
24778 | ctx.seen.pop();
|
24779 |
|
24780 | return reduceToSingleString(output, base, braces);
|
24781 | }
|
24782 |
|
24783 |
|
24784 | function formatPrimitive(ctx, value) {
|
24785 | if (isUndefined(value))
|
24786 | return ctx.stylize('undefined', 'undefined');
|
24787 | if (isString(value)) {
|
24788 | var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '')
|
24789 | .replace(/'/g, "\\'")
|
24790 | .replace(/\\"/g, '"') + '\'';
|
24791 | return ctx.stylize(simple, 'string');
|
24792 | }
|
24793 | if (isNumber(value))
|
24794 | return ctx.stylize('' + value, 'number');
|
24795 | if (isBoolean(value))
|
24796 | return ctx.stylize('' + value, 'boolean');
|
24797 |
|
24798 | if (isNull(value))
|
24799 | return ctx.stylize('null', 'null');
|
24800 | }
|
24801 |
|
24802 |
|
24803 | function formatError(value) {
|
24804 | return '[' + Error.prototype.toString.call(value) + ']';
|
24805 | }
|
24806 |
|
24807 |
|
24808 | function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
|
24809 | var output = [];
|
24810 | for (var i = 0, l = value.length; i < l; ++i) {
|
24811 | if (hasOwnProperty(value, String(i))) {
|
24812 | output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
|
24813 | String(i), true));
|
24814 | } else {
|
24815 | output.push('');
|
24816 | }
|
24817 | }
|
24818 | keys.forEach(function(key) {
|
24819 | if (!key.match(/^\d+$/)) {
|
24820 | output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
|
24821 | key, true));
|
24822 | }
|
24823 | });
|
24824 | return output;
|
24825 | }
|
24826 |
|
24827 |
|
24828 | function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
|
24829 | var name, str, desc;
|
24830 | desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };
|
24831 | if (desc.get) {
|
24832 | if (desc.set) {
|
24833 | str = ctx.stylize('[Getter/Setter]', 'special');
|
24834 | } else {
|
24835 | str = ctx.stylize('[Getter]', 'special');
|
24836 | }
|
24837 | } else {
|
24838 | if (desc.set) {
|
24839 | str = ctx.stylize('[Setter]', 'special');
|
24840 | }
|
24841 | }
|
24842 | if (!hasOwnProperty(visibleKeys, key)) {
|
24843 | name = '[' + key + ']';
|
24844 | }
|
24845 | if (!str) {
|
24846 | if (ctx.seen.indexOf(desc.value) < 0) {
|
24847 | if (isNull(recurseTimes)) {
|
24848 | str = formatValue(ctx, desc.value, null);
|
24849 | } else {
|
24850 | str = formatValue(ctx, desc.value, recurseTimes - 1);
|
24851 | }
|
24852 | if (str.indexOf('\n') > -1) {
|
24853 | if (array) {
|
24854 | str = str.split('\n').map(function(line) {
|
24855 | return ' ' + line;
|
24856 | }).join('\n').substr(2);
|
24857 | } else {
|
24858 | str = '\n' + str.split('\n').map(function(line) {
|
24859 | return ' ' + line;
|
24860 | }).join('\n');
|
24861 | }
|
24862 | }
|
24863 | } else {
|
24864 | str = ctx.stylize('[Circular]', 'special');
|
24865 | }
|
24866 | }
|
24867 | if (isUndefined(name)) {
|
24868 | if (array && key.match(/^\d+$/)) {
|
24869 | return str;
|
24870 | }
|
24871 | name = JSON.stringify('' + key);
|
24872 | if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) {
|
24873 | name = name.substr(1, name.length - 2);
|
24874 | name = ctx.stylize(name, 'name');
|
24875 | } else {
|
24876 | name = name.replace(/'/g, "\\'")
|
24877 | .replace(/\\"/g, '"')
|
24878 | .replace(/(^"|"$)/g, "'");
|
24879 | name = ctx.stylize(name, 'string');
|
24880 | }
|
24881 | }
|
24882 |
|
24883 | return name + ': ' + str;
|
24884 | }
|
24885 |
|
24886 |
|
24887 | function reduceToSingleString(output, base, braces) {
|
24888 | var numLinesEst = 0;
|
24889 | var length = output.reduce(function(prev, cur) {
|
24890 | numLinesEst++;
|
24891 | if (cur.indexOf('\n') >= 0) numLinesEst++;
|
24892 | return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1;
|
24893 | }, 0);
|
24894 |
|
24895 | if (length > 60) {
|
24896 | return braces[0] +
|
24897 | (base === '' ? '' : base + '\n ') +
|
24898 | ' ' +
|
24899 | output.join(',\n ') +
|
24900 | ' ' +
|
24901 | braces[1];
|
24902 | }
|
24903 |
|
24904 | return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];
|
24905 | }
|
24906 |
|
24907 |
|
24908 |
|
24909 |
|
24910 | function isArray(ar) {
|
24911 | return Array.isArray(ar);
|
24912 | }
|
24913 | exports.isArray = isArray;
|
24914 |
|
24915 | function isBoolean(arg) {
|
24916 | return typeof arg === 'boolean';
|
24917 | }
|
24918 | exports.isBoolean = isBoolean;
|
24919 |
|
24920 | function isNull(arg) {
|
24921 | return arg === null;
|
24922 | }
|
24923 | exports.isNull = isNull;
|
24924 |
|
24925 | function isNullOrUndefined(arg) {
|
24926 | return arg == null;
|
24927 | }
|
24928 | exports.isNullOrUndefined = isNullOrUndefined;
|
24929 |
|
24930 | function isNumber(arg) {
|
24931 | return typeof arg === 'number';
|
24932 | }
|
24933 | exports.isNumber = isNumber;
|
24934 |
|
24935 | function isString(arg) {
|
24936 | return typeof arg === 'string';
|
24937 | }
|
24938 | exports.isString = isString;
|
24939 |
|
24940 | function isSymbol(arg) {
|
24941 | return typeof arg === 'symbol';
|
24942 | }
|
24943 | exports.isSymbol = isSymbol;
|
24944 |
|
24945 | function isUndefined(arg) {
|
24946 | return arg === void 0;
|
24947 | }
|
24948 | exports.isUndefined = isUndefined;
|
24949 |
|
24950 | function isRegExp(re) {
|
24951 | return isObject(re) && objectToString(re) === '[object RegExp]';
|
24952 | }
|
24953 | exports.isRegExp = isRegExp;
|
24954 |
|
24955 | function isObject(arg) {
|
24956 | return typeof arg === 'object' && arg !== null;
|
24957 | }
|
24958 | exports.isObject = isObject;
|
24959 |
|
24960 | function isDate(d) {
|
24961 | return isObject(d) && objectToString(d) === '[object Date]';
|
24962 | }
|
24963 | exports.isDate = isDate;
|
24964 |
|
24965 | function isError(e) {
|
24966 | return isObject(e) &&
|
24967 | (objectToString(e) === '[object Error]' || e instanceof Error);
|
24968 | }
|
24969 | exports.isError = isError;
|
24970 |
|
24971 | function isFunction(arg) {
|
24972 | return typeof arg === 'function';
|
24973 | }
|
24974 | exports.isFunction = isFunction;
|
24975 |
|
24976 | function isPrimitive(arg) {
|
24977 | return arg === null ||
|
24978 | typeof arg === 'boolean' ||
|
24979 | typeof arg === 'number' ||
|
24980 | typeof arg === 'string' ||
|
24981 | typeof arg === 'symbol' ||
|
24982 | typeof arg === 'undefined';
|
24983 | }
|
24984 | exports.isPrimitive = isPrimitive;
|
24985 |
|
24986 | exports.isBuffer = require('./support/isBuffer');
|
24987 |
|
24988 | function objectToString(o) {
|
24989 | return Object.prototype.toString.call(o);
|
24990 | }
|
24991 |
|
24992 |
|
24993 | function pad(n) {
|
24994 | return n < 10 ? '0' + n.toString(10) : n.toString(10);
|
24995 | }
|
24996 |
|
24997 |
|
24998 | var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',
|
24999 | 'Oct', 'Nov', 'Dec'];
|
25000 |
|
25001 |
|
25002 | function timestamp() {
|
25003 | var d = new Date();
|
25004 | var time = [pad(d.getHours()),
|
25005 | pad(d.getMinutes()),
|
25006 | pad(d.getSeconds())].join(':');
|
25007 | return [d.getDate(), months[d.getMonth()], time].join(' ');
|
25008 | }
|
25009 |
|
25010 |
|
25011 |
|
25012 | exports.log = function() {
|
25013 | console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments));
|
25014 | };
|
25015 |
|
25016 |
|
25017 |
|
25018 |
|
25019 |
|
25020 |
|
25021 |
|
25022 |
|
25023 |
|
25024 |
|
25025 |
|
25026 |
|
25027 |
|
25028 |
|
25029 |
|
25030 | exports.inherits = require('inherits');
|
25031 |
|
25032 | exports._extend = function(origin, add) {
|
25033 |
|
25034 | if (!add || !isObject(add)) return origin;
|
25035 |
|
25036 | var keys = Object.keys(add);
|
25037 | var i = keys.length;
|
25038 | while (i--) {
|
25039 | origin[keys[i]] = add[keys[i]];
|
25040 | }
|
25041 | return origin;
|
25042 | };
|
25043 |
|
25044 | function hasOwnProperty(obj, prop) {
|
25045 | return Object.prototype.hasOwnProperty.call(obj, prop);
|
25046 | }
|
25047 |
|
25048 | }).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
25049 | },{"./support/isBuffer":286,"_process":249,"inherits":226}],288:[function(require,module,exports){
|
25050 | "use strict";
|
25051 |
|
25052 |
|
25053 | (function () {
|
25054 | "use strict";
|
25055 |
|
25056 | exports.stripBOM = function (str) {
|
25057 | if (str[0] === "\uFEFF") {
|
25058 | return str.substring(1);
|
25059 | } else {
|
25060 | return str;
|
25061 | }
|
25062 | };
|
25063 | }).call(undefined);
|
25064 |
|
25065 | },{}],289:[function(require,module,exports){
|
25066 | 'use strict';
|
25067 |
|
25068 | var _typeof2 = require('babel-runtime/helpers/typeof');
|
25069 |
|
25070 | var _typeof3 = _interopRequireDefault(_typeof2);
|
25071 |
|
25072 | var _keys = require('babel-runtime/core-js/object/keys');
|
25073 |
|
25074 | var _keys2 = _interopRequireDefault(_keys);
|
25075 |
|
25076 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
25077 |
|
25078 |
|
25079 | (function () {
|
25080 | "use strict";
|
25081 |
|
25082 | var builder,
|
25083 | defaults,
|
25084 | escapeCDATA,
|
25085 | requiresCDATA,
|
25086 | wrapCDATA,
|
25087 | hasProp = {}.hasOwnProperty;
|
25088 |
|
25089 | builder = require('xmlbuilder');
|
25090 |
|
25091 | defaults = require('./defaults').defaults;
|
25092 |
|
25093 | requiresCDATA = function requiresCDATA(entry) {
|
25094 | return typeof entry === "string" && (entry.indexOf('&') >= 0 || entry.indexOf('>') >= 0 || entry.indexOf('<') >= 0);
|
25095 | };
|
25096 |
|
25097 | wrapCDATA = function wrapCDATA(entry) {
|
25098 | return "<![CDATA[" + escapeCDATA(entry) + "]]>";
|
25099 | };
|
25100 |
|
25101 | escapeCDATA = function escapeCDATA(entry) {
|
25102 | return entry.replace(']]>', ']]]]><![CDATA[>');
|
25103 | };
|
25104 |
|
25105 | exports.Builder = function () {
|
25106 | function Builder(opts) {
|
25107 | var key, ref, value;
|
25108 | this.options = {};
|
25109 | ref = defaults["0.2"];
|
25110 | for (key in ref) {
|
25111 | if (!hasProp.call(ref, key)) continue;
|
25112 | value = ref[key];
|
25113 | this.options[key] = value;
|
25114 | }
|
25115 | for (key in opts) {
|
25116 | if (!hasProp.call(opts, key)) continue;
|
25117 | value = opts[key];
|
25118 | this.options[key] = value;
|
25119 | }
|
25120 | }
|
25121 |
|
25122 | Builder.prototype.buildObject = function (rootObj) {
|
25123 | var attrkey, charkey, render, rootElement, rootName;
|
25124 | attrkey = this.options.attrkey;
|
25125 | charkey = this.options.charkey;
|
25126 | if ((0, _keys2.default)(rootObj).length === 1 && this.options.rootName === defaults['0.2'].rootName) {
|
25127 | rootName = (0, _keys2.default)(rootObj)[0];
|
25128 | rootObj = rootObj[rootName];
|
25129 | } else {
|
25130 | rootName = this.options.rootName;
|
25131 | }
|
25132 | render = function (_this) {
|
25133 | return function (element, obj) {
|
25134 | var attr, child, entry, index, key, value;
|
25135 | if ((typeof obj === 'undefined' ? 'undefined' : (0, _typeof3.default)(obj)) !== 'object') {
|
25136 | if (_this.options.cdata && requiresCDATA(obj)) {
|
25137 | element.raw(wrapCDATA(obj));
|
25138 | } else {
|
25139 | element.txt(obj);
|
25140 | }
|
25141 | } else if (Array.isArray(obj)) {
|
25142 | for (index in obj) {
|
25143 | if (!hasProp.call(obj, index)) continue;
|
25144 | child = obj[index];
|
25145 | for (key in child) {
|
25146 | entry = child[key];
|
25147 | element = render(element.ele(key), entry).up();
|
25148 | }
|
25149 | }
|
25150 | } else {
|
25151 | for (key in obj) {
|
25152 | if (!hasProp.call(obj, key)) continue;
|
25153 | child = obj[key];
|
25154 | if (key === attrkey) {
|
25155 | if ((typeof child === 'undefined' ? 'undefined' : (0, _typeof3.default)(child)) === "object") {
|
25156 | for (attr in child) {
|
25157 | value = child[attr];
|
25158 | element = element.att(attr, value);
|
25159 | }
|
25160 | }
|
25161 | } else if (key === charkey) {
|
25162 | if (_this.options.cdata && requiresCDATA(child)) {
|
25163 | element = element.raw(wrapCDATA(child));
|
25164 | } else {
|
25165 | element = element.txt(child);
|
25166 | }
|
25167 | } else if (Array.isArray(child)) {
|
25168 | for (index in child) {
|
25169 | if (!hasProp.call(child, index)) continue;
|
25170 | entry = child[index];
|
25171 | if (typeof entry === 'string') {
|
25172 | if (_this.options.cdata && requiresCDATA(entry)) {
|
25173 | element = element.ele(key).raw(wrapCDATA(entry)).up();
|
25174 | } else {
|
25175 | element = element.ele(key, entry).up();
|
25176 | }
|
25177 | } else {
|
25178 | element = render(element.ele(key), entry).up();
|
25179 | }
|
25180 | }
|
25181 | } else if ((typeof child === 'undefined' ? 'undefined' : (0, _typeof3.default)(child)) === "object") {
|
25182 | element = render(element.ele(key), child).up();
|
25183 | } else {
|
25184 | if (typeof child === 'string' && _this.options.cdata && requiresCDATA(child)) {
|
25185 | element = element.ele(key).raw(wrapCDATA(child)).up();
|
25186 | } else {
|
25187 | if (child == null) {
|
25188 | child = '';
|
25189 | }
|
25190 | element = element.ele(key, child.toString()).up();
|
25191 | }
|
25192 | }
|
25193 | }
|
25194 | }
|
25195 | return element;
|
25196 | };
|
25197 | }(this);
|
25198 | rootElement = builder.create(rootName, this.options.xmldec, this.options.doctype, {
|
25199 | headless: this.options.headless,
|
25200 | allowSurrogateChars: this.options.allowSurrogateChars
|
25201 | });
|
25202 | return render(rootElement, rootObj).end(this.options.renderOpts);
|
25203 | };
|
25204 |
|
25205 | return Builder;
|
25206 | }();
|
25207 | }).call(undefined);
|
25208 |
|
25209 | },{"./defaults":290,"babel-runtime/core-js/object/keys":55,"babel-runtime/helpers/typeof":64,"xmlbuilder":326}],290:[function(require,module,exports){
|
25210 | "use strict";
|
25211 |
|
25212 |
|
25213 | (function () {
|
25214 | exports.defaults = {
|
25215 | "0.1": {
|
25216 | explicitCharkey: false,
|
25217 | trim: true,
|
25218 | normalize: true,
|
25219 | normalizeTags: false,
|
25220 | attrkey: "@",
|
25221 | charkey: "#",
|
25222 | explicitArray: false,
|
25223 | ignoreAttrs: false,
|
25224 | mergeAttrs: false,
|
25225 | explicitRoot: false,
|
25226 | validator: null,
|
25227 | xmlns: false,
|
25228 | explicitChildren: false,
|
25229 | childkey: '@@',
|
25230 | charsAsChildren: false,
|
25231 | includeWhiteChars: false,
|
25232 | async: false,
|
25233 | strict: true,
|
25234 | attrNameProcessors: null,
|
25235 | attrValueProcessors: null,
|
25236 | tagNameProcessors: null,
|
25237 | valueProcessors: null,
|
25238 | emptyTag: ''
|
25239 | },
|
25240 | "0.2": {
|
25241 | explicitCharkey: false,
|
25242 | trim: false,
|
25243 | normalize: false,
|
25244 | normalizeTags: false,
|
25245 | attrkey: "$",
|
25246 | charkey: "_",
|
25247 | explicitArray: true,
|
25248 | ignoreAttrs: false,
|
25249 | mergeAttrs: false,
|
25250 | explicitRoot: true,
|
25251 | validator: null,
|
25252 | xmlns: false,
|
25253 | explicitChildren: false,
|
25254 | preserveChildrenOrder: false,
|
25255 | childkey: '$$',
|
25256 | charsAsChildren: false,
|
25257 | includeWhiteChars: false,
|
25258 | async: false,
|
25259 | strict: true,
|
25260 | attrNameProcessors: null,
|
25261 | attrValueProcessors: null,
|
25262 | tagNameProcessors: null,
|
25263 | valueProcessors: null,
|
25264 | rootName: 'root',
|
25265 | xmldec: {
|
25266 | 'version': '1.0',
|
25267 | 'encoding': 'UTF-8',
|
25268 | 'standalone': true
|
25269 | },
|
25270 | doctype: null,
|
25271 | renderOpts: {
|
25272 | 'pretty': true,
|
25273 | 'indent': ' ',
|
25274 | 'newline': '\n'
|
25275 | },
|
25276 | headless: false,
|
25277 | chunkSize: 10000,
|
25278 | emptyTag: '',
|
25279 | cdata: false
|
25280 | }
|
25281 | };
|
25282 | }).call(undefined);
|
25283 |
|
25284 | },{}],291:[function(require,module,exports){
|
25285 | 'use strict';
|
25286 |
|
25287 | var _getOwnPropertyNames = require('babel-runtime/core-js/object/get-own-property-names');
|
25288 |
|
25289 | var _getOwnPropertyNames2 = _interopRequireDefault(_getOwnPropertyNames);
|
25290 |
|
25291 | var _keys = require('babel-runtime/core-js/object/keys');
|
25292 |
|
25293 | var _keys2 = _interopRequireDefault(_keys);
|
25294 |
|
25295 | var _typeof2 = require('babel-runtime/helpers/typeof');
|
25296 |
|
25297 | var _typeof3 = _interopRequireDefault(_typeof2);
|
25298 |
|
25299 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
25300 |
|
25301 |
|
25302 | (function () {
|
25303 | "use strict";
|
25304 |
|
25305 | var bom,
|
25306 | defaults,
|
25307 | events,
|
25308 | isEmpty,
|
25309 | processItem,
|
25310 | processors,
|
25311 | promisify,
|
25312 | sax,
|
25313 | setImmediate,
|
25314 | bind = function bind(fn, me) {
|
25315 | return function () {
|
25316 | return fn.apply(me, arguments);
|
25317 | };
|
25318 | },
|
25319 | extend = function extend(child, parent) {
|
25320 | for (var key in parent) {
|
25321 | if (hasProp.call(parent, key)) child[key] = parent[key];
|
25322 | }function ctor() {
|
25323 | this.constructor = child;
|
25324 | }ctor.prototype = parent.prototype;child.prototype = new ctor();child.__super__ = parent.prototype;return child;
|
25325 | },
|
25326 | hasProp = {}.hasOwnProperty;
|
25327 |
|
25328 | sax = require('sax');
|
25329 |
|
25330 | events = require('events');
|
25331 |
|
25332 | bom = require('./bom');
|
25333 |
|
25334 | processors = require('./processors');
|
25335 |
|
25336 | setImmediate = require('timers').setImmediate;
|
25337 |
|
25338 | defaults = require('./defaults').defaults;
|
25339 |
|
25340 | promisify = require('util.promisify');
|
25341 |
|
25342 | isEmpty = function isEmpty(thing) {
|
25343 | return (typeof thing === 'undefined' ? 'undefined' : (0, _typeof3.default)(thing)) === "object" && thing != null && (0, _keys2.default)(thing).length === 0;
|
25344 | };
|
25345 |
|
25346 | processItem = function processItem(processors, item, key) {
|
25347 | var i, len, process;
|
25348 | for (i = 0, len = processors.length; i < len; i++) {
|
25349 | process = processors[i];
|
25350 | item = process(item, key);
|
25351 | }
|
25352 | return item;
|
25353 | };
|
25354 |
|
25355 | exports.Parser = function (superClass) {
|
25356 | extend(Parser, superClass);
|
25357 |
|
25358 | function Parser(opts) {
|
25359 | this.parseStringPromise = bind(this.parseStringPromise, this);
|
25360 | this.parseString = bind(this.parseString, this);
|
25361 | this.reset = bind(this.reset, this);
|
25362 | this.assignOrPush = bind(this.assignOrPush, this);
|
25363 | this.processAsync = bind(this.processAsync, this);
|
25364 | var key, ref, value;
|
25365 | if (!(this instanceof exports.Parser)) {
|
25366 | return new exports.Parser(opts);
|
25367 | }
|
25368 | this.options = {};
|
25369 | ref = defaults["0.2"];
|
25370 | for (key in ref) {
|
25371 | if (!hasProp.call(ref, key)) continue;
|
25372 | value = ref[key];
|
25373 | this.options[key] = value;
|
25374 | }
|
25375 | for (key in opts) {
|
25376 | if (!hasProp.call(opts, key)) continue;
|
25377 | value = opts[key];
|
25378 | this.options[key] = value;
|
25379 | }
|
25380 | if (this.options.xmlns) {
|
25381 | this.options.xmlnskey = this.options.attrkey + "ns";
|
25382 | }
|
25383 | if (this.options.normalizeTags) {
|
25384 | if (!this.options.tagNameProcessors) {
|
25385 | this.options.tagNameProcessors = [];
|
25386 | }
|
25387 | this.options.tagNameProcessors.unshift(processors.normalize);
|
25388 | }
|
25389 | this.reset();
|
25390 | }
|
25391 |
|
25392 | Parser.prototype.processAsync = function () {
|
25393 | var chunk, err;
|
25394 | try {
|
25395 | if (this.remaining.length <= this.options.chunkSize) {
|
25396 | chunk = this.remaining;
|
25397 | this.remaining = '';
|
25398 | this.saxParser = this.saxParser.write(chunk);
|
25399 | return this.saxParser.close();
|
25400 | } else {
|
25401 | chunk = this.remaining.substr(0, this.options.chunkSize);
|
25402 | this.remaining = this.remaining.substr(this.options.chunkSize, this.remaining.length);
|
25403 | this.saxParser = this.saxParser.write(chunk);
|
25404 | return setImmediate(this.processAsync);
|
25405 | }
|
25406 | } catch (error1) {
|
25407 | err = error1;
|
25408 | if (!this.saxParser.errThrown) {
|
25409 | this.saxParser.errThrown = true;
|
25410 | return this.emit(err);
|
25411 | }
|
25412 | }
|
25413 | };
|
25414 |
|
25415 | Parser.prototype.assignOrPush = function (obj, key, newValue) {
|
25416 | if (!(key in obj)) {
|
25417 | if (!this.options.explicitArray) {
|
25418 | return obj[key] = newValue;
|
25419 | } else {
|
25420 | return obj[key] = [newValue];
|
25421 | }
|
25422 | } else {
|
25423 | if (!(obj[key] instanceof Array)) {
|
25424 | obj[key] = [obj[key]];
|
25425 | }
|
25426 | return obj[key].push(newValue);
|
25427 | }
|
25428 | };
|
25429 |
|
25430 | Parser.prototype.reset = function () {
|
25431 | var attrkey, charkey, ontext, stack;
|
25432 | this.removeAllListeners();
|
25433 | this.saxParser = sax.parser(this.options.strict, {
|
25434 | trim: false,
|
25435 | normalize: false,
|
25436 | xmlns: this.options.xmlns
|
25437 | });
|
25438 | this.saxParser.errThrown = false;
|
25439 | this.saxParser.onerror = function (_this) {
|
25440 | return function (error) {
|
25441 | _this.saxParser.resume();
|
25442 | if (!_this.saxParser.errThrown) {
|
25443 | _this.saxParser.errThrown = true;
|
25444 | return _this.emit("error", error);
|
25445 | }
|
25446 | };
|
25447 | }(this);
|
25448 | this.saxParser.onend = function (_this) {
|
25449 | return function () {
|
25450 | if (!_this.saxParser.ended) {
|
25451 | _this.saxParser.ended = true;
|
25452 | return _this.emit("end", _this.resultObject);
|
25453 | }
|
25454 | };
|
25455 | }(this);
|
25456 | this.saxParser.ended = false;
|
25457 | this.EXPLICIT_CHARKEY = this.options.explicitCharkey;
|
25458 | this.resultObject = null;
|
25459 | stack = [];
|
25460 | attrkey = this.options.attrkey;
|
25461 | charkey = this.options.charkey;
|
25462 | this.saxParser.onopentag = function (_this) {
|
25463 | return function (node) {
|
25464 | var key, newValue, obj, processedKey, ref;
|
25465 | obj = {};
|
25466 | obj[charkey] = "";
|
25467 | if (!_this.options.ignoreAttrs) {
|
25468 | ref = node.attributes;
|
25469 | for (key in ref) {
|
25470 | if (!hasProp.call(ref, key)) continue;
|
25471 | if (!(attrkey in obj) && !_this.options.mergeAttrs) {
|
25472 | obj[attrkey] = {};
|
25473 | }
|
25474 | newValue = _this.options.attrValueProcessors ? processItem(_this.options.attrValueProcessors, node.attributes[key], key) : node.attributes[key];
|
25475 | processedKey = _this.options.attrNameProcessors ? processItem(_this.options.attrNameProcessors, key) : key;
|
25476 | if (_this.options.mergeAttrs) {
|
25477 | _this.assignOrPush(obj, processedKey, newValue);
|
25478 | } else {
|
25479 | obj[attrkey][processedKey] = newValue;
|
25480 | }
|
25481 | }
|
25482 | }
|
25483 | obj["#name"] = _this.options.tagNameProcessors ? processItem(_this.options.tagNameProcessors, node.name) : node.name;
|
25484 | if (_this.options.xmlns) {
|
25485 | obj[_this.options.xmlnskey] = {
|
25486 | uri: node.uri,
|
25487 | local: node.local
|
25488 | };
|
25489 | }
|
25490 | return stack.push(obj);
|
25491 | };
|
25492 | }(this);
|
25493 | this.saxParser.onclosetag = function (_this) {
|
25494 | return function () {
|
25495 | var cdata, emptyStr, key, node, nodeName, obj, objClone, old, s, xpath;
|
25496 | obj = stack.pop();
|
25497 | nodeName = obj["#name"];
|
25498 | if (!_this.options.explicitChildren || !_this.options.preserveChildrenOrder) {
|
25499 | delete obj["#name"];
|
25500 | }
|
25501 | if (obj.cdata === true) {
|
25502 | cdata = obj.cdata;
|
25503 | delete obj.cdata;
|
25504 | }
|
25505 | s = stack[stack.length - 1];
|
25506 | if (obj[charkey].match(/^\s*$/) && !cdata) {
|
25507 | emptyStr = obj[charkey];
|
25508 | delete obj[charkey];
|
25509 | } else {
|
25510 | if (_this.options.trim) {
|
25511 | obj[charkey] = obj[charkey].trim();
|
25512 | }
|
25513 | if (_this.options.normalize) {
|
25514 | obj[charkey] = obj[charkey].replace(/\s{2,}/g, " ").trim();
|
25515 | }
|
25516 | obj[charkey] = _this.options.valueProcessors ? processItem(_this.options.valueProcessors, obj[charkey], nodeName) : obj[charkey];
|
25517 | if ((0, _keys2.default)(obj).length === 1 && charkey in obj && !_this.EXPLICIT_CHARKEY) {
|
25518 | obj = obj[charkey];
|
25519 | }
|
25520 | }
|
25521 | if (isEmpty(obj)) {
|
25522 | obj = _this.options.emptyTag !== '' ? _this.options.emptyTag : emptyStr;
|
25523 | }
|
25524 | if (_this.options.validator != null) {
|
25525 | xpath = "/" + function () {
|
25526 | var i, len, results;
|
25527 | results = [];
|
25528 | for (i = 0, len = stack.length; i < len; i++) {
|
25529 | node = stack[i];
|
25530 | results.push(node["#name"]);
|
25531 | }
|
25532 | return results;
|
25533 | }().concat(nodeName).join("/");
|
25534 | (function () {
|
25535 | var err;
|
25536 | try {
|
25537 | return obj = _this.options.validator(xpath, s && s[nodeName], obj);
|
25538 | } catch (error1) {
|
25539 | err = error1;
|
25540 | return _this.emit("error", err);
|
25541 | }
|
25542 | })();
|
25543 | }
|
25544 | if (_this.options.explicitChildren && !_this.options.mergeAttrs && (typeof obj === 'undefined' ? 'undefined' : (0, _typeof3.default)(obj)) === 'object') {
|
25545 | if (!_this.options.preserveChildrenOrder) {
|
25546 | node = {};
|
25547 | if (_this.options.attrkey in obj) {
|
25548 | node[_this.options.attrkey] = obj[_this.options.attrkey];
|
25549 | delete obj[_this.options.attrkey];
|
25550 | }
|
25551 | if (!_this.options.charsAsChildren && _this.options.charkey in obj) {
|
25552 | node[_this.options.charkey] = obj[_this.options.charkey];
|
25553 | delete obj[_this.options.charkey];
|
25554 | }
|
25555 | if ((0, _getOwnPropertyNames2.default)(obj).length > 0) {
|
25556 | node[_this.options.childkey] = obj;
|
25557 | }
|
25558 | obj = node;
|
25559 | } else if (s) {
|
25560 | s[_this.options.childkey] = s[_this.options.childkey] || [];
|
25561 | objClone = {};
|
25562 | for (key in obj) {
|
25563 | if (!hasProp.call(obj, key)) continue;
|
25564 | objClone[key] = obj[key];
|
25565 | }
|
25566 | s[_this.options.childkey].push(objClone);
|
25567 | delete obj["#name"];
|
25568 | if ((0, _keys2.default)(obj).length === 1 && charkey in obj && !_this.EXPLICIT_CHARKEY) {
|
25569 | obj = obj[charkey];
|
25570 | }
|
25571 | }
|
25572 | }
|
25573 | if (stack.length > 0) {
|
25574 | return _this.assignOrPush(s, nodeName, obj);
|
25575 | } else {
|
25576 | if (_this.options.explicitRoot) {
|
25577 | old = obj;
|
25578 | obj = {};
|
25579 | obj[nodeName] = old;
|
25580 | }
|
25581 | _this.resultObject = obj;
|
25582 | _this.saxParser.ended = true;
|
25583 | return _this.emit("end", _this.resultObject);
|
25584 | }
|
25585 | };
|
25586 | }(this);
|
25587 | ontext = function (_this) {
|
25588 | return function (text) {
|
25589 | var charChild, s;
|
25590 | s = stack[stack.length - 1];
|
25591 | if (s) {
|
25592 | s[charkey] += text;
|
25593 | if (_this.options.explicitChildren && _this.options.preserveChildrenOrder && _this.options.charsAsChildren && (_this.options.includeWhiteChars || text.replace(/\\n/g, '').trim() !== '')) {
|
25594 | s[_this.options.childkey] = s[_this.options.childkey] || [];
|
25595 | charChild = {
|
25596 | '#name': '__text__'
|
25597 | };
|
25598 | charChild[charkey] = text;
|
25599 | if (_this.options.normalize) {
|
25600 | charChild[charkey] = charChild[charkey].replace(/\s{2,}/g, " ").trim();
|
25601 | }
|
25602 | s[_this.options.childkey].push(charChild);
|
25603 | }
|
25604 | return s;
|
25605 | }
|
25606 | };
|
25607 | }(this);
|
25608 | this.saxParser.ontext = ontext;
|
25609 | return this.saxParser.oncdata = function (_this) {
|
25610 | return function (text) {
|
25611 | var s;
|
25612 | s = ontext(text);
|
25613 | if (s) {
|
25614 | return s.cdata = true;
|
25615 | }
|
25616 | };
|
25617 | }(this);
|
25618 | };
|
25619 |
|
25620 | Parser.prototype.parseString = function (str, cb) {
|
25621 | var err;
|
25622 | if (cb != null && typeof cb === "function") {
|
25623 | this.on("end", function (result) {
|
25624 | this.reset();
|
25625 | return cb(null, result);
|
25626 | });
|
25627 | this.on("error", function (err) {
|
25628 | this.reset();
|
25629 | return cb(err);
|
25630 | });
|
25631 | }
|
25632 | try {
|
25633 | str = str.toString();
|
25634 | if (str.trim() === '') {
|
25635 | this.emit("end", null);
|
25636 | return true;
|
25637 | }
|
25638 | str = bom.stripBOM(str);
|
25639 | if (this.options.async) {
|
25640 | this.remaining = str;
|
25641 | setImmediate(this.processAsync);
|
25642 | return this.saxParser;
|
25643 | }
|
25644 | return this.saxParser.write(str).close();
|
25645 | } catch (error1) {
|
25646 | err = error1;
|
25647 | if (!(this.saxParser.errThrown || this.saxParser.ended)) {
|
25648 | this.emit('error', err);
|
25649 | return this.saxParser.errThrown = true;
|
25650 | } else if (this.saxParser.ended) {
|
25651 | throw err;
|
25652 | }
|
25653 | }
|
25654 | };
|
25655 |
|
25656 | Parser.prototype.parseStringPromise = function (str) {
|
25657 | return promisify(this.parseString)(str);
|
25658 | };
|
25659 |
|
25660 | return Parser;
|
25661 | }(events);
|
25662 |
|
25663 | exports.parseString = function (str, a, b) {
|
25664 | var cb, options, parser;
|
25665 | if (b != null) {
|
25666 | if (typeof b === 'function') {
|
25667 | cb = b;
|
25668 | }
|
25669 | if ((typeof a === 'undefined' ? 'undefined' : (0, _typeof3.default)(a)) === 'object') {
|
25670 | options = a;
|
25671 | }
|
25672 | } else {
|
25673 | if (typeof a === 'function') {
|
25674 | cb = a;
|
25675 | }
|
25676 | options = {};
|
25677 | }
|
25678 | parser = new exports.Parser(options);
|
25679 | return parser.parseString(str, cb);
|
25680 | };
|
25681 |
|
25682 | exports.parseStringPromise = function (str, a) {
|
25683 | var options, parser;
|
25684 | if ((typeof a === 'undefined' ? 'undefined' : (0, _typeof3.default)(a)) === 'object') {
|
25685 | options = a;
|
25686 | }
|
25687 | parser = new exports.Parser(options);
|
25688 | return parser.parseStringPromise(str);
|
25689 | };
|
25690 | }).call(undefined);
|
25691 |
|
25692 | },{"./bom":288,"./defaults":290,"./processors":292,"babel-runtime/core-js/object/get-own-property-names":53,"babel-runtime/core-js/object/keys":55,"babel-runtime/helpers/typeof":64,"events":216,"sax":270,"timers":277,"util.promisify":283}],292:[function(require,module,exports){
|
25693 | 'use strict';
|
25694 |
|
25695 |
|
25696 | (function () {
|
25697 | "use strict";
|
25698 |
|
25699 | var prefixMatch;
|
25700 |
|
25701 | prefixMatch = new RegExp(/(?!xmlns)^.*:/);
|
25702 |
|
25703 | exports.normalize = function (str) {
|
25704 | return str.toLowerCase();
|
25705 | };
|
25706 |
|
25707 | exports.firstCharLowerCase = function (str) {
|
25708 | return str.charAt(0).toLowerCase() + str.slice(1);
|
25709 | };
|
25710 |
|
25711 | exports.stripPrefix = function (str) {
|
25712 | return str.replace(prefixMatch, '');
|
25713 | };
|
25714 |
|
25715 | exports.parseNumbers = function (str) {
|
25716 | if (!isNaN(str)) {
|
25717 | str = str % 1 === 0 ? parseInt(str, 10) : parseFloat(str);
|
25718 | }
|
25719 | return str;
|
25720 | };
|
25721 |
|
25722 | exports.parseBooleans = function (str) {
|
25723 | if (/^(?:true|false)$/i.test(str)) {
|
25724 | str = str.toLowerCase() === 'true';
|
25725 | }
|
25726 | return str;
|
25727 | };
|
25728 | }).call(undefined);
|
25729 |
|
25730 | },{}],293:[function(require,module,exports){
|
25731 | 'use strict';
|
25732 |
|
25733 |
|
25734 | (function () {
|
25735 | "use strict";
|
25736 |
|
25737 | var builder,
|
25738 | defaults,
|
25739 | parser,
|
25740 | processors,
|
25741 | extend = function extend(child, parent) {
|
25742 | for (var key in parent) {
|
25743 | if (hasProp.call(parent, key)) child[key] = parent[key];
|
25744 | }function ctor() {
|
25745 | this.constructor = child;
|
25746 | }ctor.prototype = parent.prototype;child.prototype = new ctor();child.__super__ = parent.prototype;return child;
|
25747 | },
|
25748 | hasProp = {}.hasOwnProperty;
|
25749 |
|
25750 | defaults = require('./defaults');
|
25751 |
|
25752 | builder = require('./builder');
|
25753 |
|
25754 | parser = require('./parser');
|
25755 |
|
25756 | processors = require('./processors');
|
25757 |
|
25758 | exports.defaults = defaults.defaults;
|
25759 |
|
25760 | exports.processors = processors;
|
25761 |
|
25762 | exports.ValidationError = function (superClass) {
|
25763 | extend(ValidationError, superClass);
|
25764 |
|
25765 | function ValidationError(message) {
|
25766 | this.message = message;
|
25767 | }
|
25768 |
|
25769 | return ValidationError;
|
25770 | }(Error);
|
25771 |
|
25772 | exports.Builder = builder.Builder;
|
25773 |
|
25774 | exports.Parser = parser.Parser;
|
25775 |
|
25776 | exports.parseString = parser.parseString;
|
25777 |
|
25778 | exports.parseStringPromise = parser.parseStringPromise;
|
25779 | }).call(undefined);
|
25780 |
|
25781 | },{"./builder":289,"./defaults":290,"./parser":291,"./processors":292}],294:[function(require,module,exports){
|
25782 | "use strict";
|
25783 |
|
25784 |
|
25785 | (function () {
|
25786 | module.exports = {
|
25787 | Disconnected: 1,
|
25788 | Preceding: 2,
|
25789 | Following: 4,
|
25790 | Contains: 8,
|
25791 | ContainedBy: 16,
|
25792 | ImplementationSpecific: 32
|
25793 | };
|
25794 | }).call(undefined);
|
25795 |
|
25796 | },{}],295:[function(require,module,exports){
|
25797 | "use strict";
|
25798 |
|
25799 |
|
25800 | (function () {
|
25801 | module.exports = {
|
25802 | Element: 1,
|
25803 | Attribute: 2,
|
25804 | Text: 3,
|
25805 | CData: 4,
|
25806 | EntityReference: 5,
|
25807 | EntityDeclaration: 6,
|
25808 | ProcessingInstruction: 7,
|
25809 | Comment: 8,
|
25810 | Document: 9,
|
25811 | DocType: 10,
|
25812 | DocumentFragment: 11,
|
25813 | NotationDeclaration: 12,
|
25814 | Declaration: 201,
|
25815 | Raw: 202,
|
25816 | AttributeDeclaration: 203,
|
25817 | ElementDeclaration: 204,
|
25818 | Dummy: 205
|
25819 | };
|
25820 | }).call(undefined);
|
25821 |
|
25822 | },{}],296:[function(require,module,exports){
|
25823 | 'use strict';
|
25824 |
|
25825 | var _getPrototypeOf = require('babel-runtime/core-js/object/get-prototype-of');
|
25826 |
|
25827 | var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);
|
25828 |
|
25829 | var _typeof2 = require('babel-runtime/helpers/typeof');
|
25830 |
|
25831 | var _typeof3 = _interopRequireDefault(_typeof2);
|
25832 |
|
25833 | var _assign = require('babel-runtime/core-js/object/assign');
|
25834 |
|
25835 | var _assign2 = _interopRequireDefault(_assign);
|
25836 |
|
25837 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
25838 |
|
25839 |
|
25840 | (function () {
|
25841 | var assign,
|
25842 | getValue,
|
25843 | isArray,
|
25844 | isEmpty,
|
25845 | isFunction,
|
25846 | isObject,
|
25847 | isPlainObject,
|
25848 | slice = [].slice,
|
25849 | hasProp = {}.hasOwnProperty;
|
25850 |
|
25851 | assign = function assign() {
|
25852 | var i, key, len, source, sources, target;
|
25853 | target = arguments[0], sources = 2 <= arguments.length ? slice.call(arguments, 1) : [];
|
25854 | if (isFunction(_assign2.default)) {
|
25855 | _assign2.default.apply(null, arguments);
|
25856 | } else {
|
25857 | for (i = 0, len = sources.length; i < len; i++) {
|
25858 | source = sources[i];
|
25859 | if (source != null) {
|
25860 | for (key in source) {
|
25861 | if (!hasProp.call(source, key)) continue;
|
25862 | target[key] = source[key];
|
25863 | }
|
25864 | }
|
25865 | }
|
25866 | }
|
25867 | return target;
|
25868 | };
|
25869 |
|
25870 | isFunction = function isFunction(val) {
|
25871 | return !!val && Object.prototype.toString.call(val) === '[object Function]';
|
25872 | };
|
25873 |
|
25874 | isObject = function isObject(val) {
|
25875 | var ref;
|
25876 | return !!val && ((ref = typeof val === 'undefined' ? 'undefined' : (0, _typeof3.default)(val)) === 'function' || ref === 'object');
|
25877 | };
|
25878 |
|
25879 | isArray = function isArray(val) {
|
25880 | if (isFunction(Array.isArray)) {
|
25881 | return Array.isArray(val);
|
25882 | } else {
|
25883 | return Object.prototype.toString.call(val) === '[object Array]';
|
25884 | }
|
25885 | };
|
25886 |
|
25887 | isEmpty = function isEmpty(val) {
|
25888 | var key;
|
25889 | if (isArray(val)) {
|
25890 | return !val.length;
|
25891 | } else {
|
25892 | for (key in val) {
|
25893 | if (!hasProp.call(val, key)) continue;
|
25894 | return false;
|
25895 | }
|
25896 | return true;
|
25897 | }
|
25898 | };
|
25899 |
|
25900 | isPlainObject = function isPlainObject(val) {
|
25901 | var ctor, proto;
|
25902 | return isObject(val) && (proto = (0, _getPrototypeOf2.default)(val)) && (ctor = proto.constructor) && typeof ctor === 'function' && ctor instanceof ctor && Function.prototype.toString.call(ctor) === Function.prototype.toString.call(Object);
|
25903 | };
|
25904 |
|
25905 | getValue = function getValue(obj) {
|
25906 | if (isFunction(obj.valueOf)) {
|
25907 | return obj.valueOf();
|
25908 | } else {
|
25909 | return obj;
|
25910 | }
|
25911 | };
|
25912 |
|
25913 | module.exports.assign = assign;
|
25914 |
|
25915 | module.exports.isFunction = isFunction;
|
25916 |
|
25917 | module.exports.isObject = isObject;
|
25918 |
|
25919 | module.exports.isArray = isArray;
|
25920 |
|
25921 | module.exports.isEmpty = isEmpty;
|
25922 |
|
25923 | module.exports.isPlainObject = isPlainObject;
|
25924 |
|
25925 | module.exports.getValue = getValue;
|
25926 | }).call(undefined);
|
25927 |
|
25928 | },{"babel-runtime/core-js/object/assign":49,"babel-runtime/core-js/object/get-prototype-of":54,"babel-runtime/helpers/typeof":64}],297:[function(require,module,exports){
|
25929 | "use strict";
|
25930 |
|
25931 |
|
25932 | (function () {
|
25933 | module.exports = {
|
25934 | None: 0,
|
25935 | OpenTag: 1,
|
25936 | InsideTag: 2,
|
25937 | CloseTag: 3
|
25938 | };
|
25939 | }).call(undefined);
|
25940 |
|
25941 | },{}],298:[function(require,module,exports){
|
25942 | 'use strict';
|
25943 |
|
25944 | var _create = require('babel-runtime/core-js/object/create');
|
25945 |
|
25946 | var _create2 = _interopRequireDefault(_create);
|
25947 |
|
25948 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
25949 |
|
25950 |
|
25951 | (function () {
|
25952 | var NodeType, XMLAttribute, XMLNode;
|
25953 |
|
25954 | NodeType = require('./NodeType');
|
25955 |
|
25956 | XMLNode = require('./XMLNode');
|
25957 |
|
25958 | module.exports = XMLAttribute = function () {
|
25959 | function XMLAttribute(parent, name, value) {
|
25960 | this.parent = parent;
|
25961 | if (this.parent) {
|
25962 | this.options = this.parent.options;
|
25963 | this.stringify = this.parent.stringify;
|
25964 | }
|
25965 | if (name == null) {
|
25966 | throw new Error("Missing attribute name. " + this.debugInfo(name));
|
25967 | }
|
25968 | this.name = this.stringify.name(name);
|
25969 | this.value = this.stringify.attValue(value);
|
25970 | this.type = NodeType.Attribute;
|
25971 | this.isId = false;
|
25972 | this.schemaTypeInfo = null;
|
25973 | }
|
25974 |
|
25975 | Object.defineProperty(XMLAttribute.prototype, 'nodeType', {
|
25976 | get: function get() {
|
25977 | return this.type;
|
25978 | }
|
25979 | });
|
25980 |
|
25981 | Object.defineProperty(XMLAttribute.prototype, 'ownerElement', {
|
25982 | get: function get() {
|
25983 | return this.parent;
|
25984 | }
|
25985 | });
|
25986 |
|
25987 | Object.defineProperty(XMLAttribute.prototype, 'textContent', {
|
25988 | get: function get() {
|
25989 | return this.value;
|
25990 | },
|
25991 | set: function set(value) {
|
25992 | return this.value = value || '';
|
25993 | }
|
25994 | });
|
25995 |
|
25996 | Object.defineProperty(XMLAttribute.prototype, 'namespaceURI', {
|
25997 | get: function get() {
|
25998 | return '';
|
25999 | }
|
26000 | });
|
26001 |
|
26002 | Object.defineProperty(XMLAttribute.prototype, 'prefix', {
|
26003 | get: function get() {
|
26004 | return '';
|
26005 | }
|
26006 | });
|
26007 |
|
26008 | Object.defineProperty(XMLAttribute.prototype, 'localName', {
|
26009 | get: function get() {
|
26010 | return this.name;
|
26011 | }
|
26012 | });
|
26013 |
|
26014 | Object.defineProperty(XMLAttribute.prototype, 'specified', {
|
26015 | get: function get() {
|
26016 | return true;
|
26017 | }
|
26018 | });
|
26019 |
|
26020 | XMLAttribute.prototype.clone = function () {
|
26021 | return (0, _create2.default)(this);
|
26022 | };
|
26023 |
|
26024 | XMLAttribute.prototype.toString = function (options) {
|
26025 | return this.options.writer.attribute(this, this.options.writer.filterOptions(options));
|
26026 | };
|
26027 |
|
26028 | XMLAttribute.prototype.debugInfo = function (name) {
|
26029 | name = name || this.name;
|
26030 | if (name == null) {
|
26031 | return "parent: <" + this.parent.name + ">";
|
26032 | } else {
|
26033 | return "attribute: {" + name + "}, parent: <" + this.parent.name + ">";
|
26034 | }
|
26035 | };
|
26036 |
|
26037 | XMLAttribute.prototype.isEqualNode = function (node) {
|
26038 | if (node.namespaceURI !== this.namespaceURI) {
|
26039 | return false;
|
26040 | }
|
26041 | if (node.prefix !== this.prefix) {
|
26042 | return false;
|
26043 | }
|
26044 | if (node.localName !== this.localName) {
|
26045 | return false;
|
26046 | }
|
26047 | if (node.value !== this.value) {
|
26048 | return false;
|
26049 | }
|
26050 | return true;
|
26051 | };
|
26052 |
|
26053 | return XMLAttribute;
|
26054 | }();
|
26055 | }).call(undefined);
|
26056 |
|
26057 | },{"./NodeType":295,"./XMLNode":317,"babel-runtime/core-js/object/create":50}],299:[function(require,module,exports){
|
26058 | 'use strict';
|
26059 |
|
26060 | var _create = require('babel-runtime/core-js/object/create');
|
26061 |
|
26062 | var _create2 = _interopRequireDefault(_create);
|
26063 |
|
26064 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
26065 |
|
26066 |
|
26067 | (function () {
|
26068 | var NodeType,
|
26069 | XMLCData,
|
26070 | XMLCharacterData,
|
26071 | extend = function extend(child, parent) {
|
26072 | for (var key in parent) {
|
26073 | if (hasProp.call(parent, key)) child[key] = parent[key];
|
26074 | }function ctor() {
|
26075 | this.constructor = child;
|
26076 | }ctor.prototype = parent.prototype;child.prototype = new ctor();child.__super__ = parent.prototype;return child;
|
26077 | },
|
26078 | hasProp = {}.hasOwnProperty;
|
26079 |
|
26080 | NodeType = require('./NodeType');
|
26081 |
|
26082 | XMLCharacterData = require('./XMLCharacterData');
|
26083 |
|
26084 | module.exports = XMLCData = function (superClass) {
|
26085 | extend(XMLCData, superClass);
|
26086 |
|
26087 | function XMLCData(parent, text) {
|
26088 | XMLCData.__super__.constructor.call(this, parent);
|
26089 | if (text == null) {
|
26090 | throw new Error("Missing CDATA text. " + this.debugInfo());
|
26091 | }
|
26092 | this.name = "#cdata-section";
|
26093 | this.type = NodeType.CData;
|
26094 | this.value = this.stringify.cdata(text);
|
26095 | }
|
26096 |
|
26097 | XMLCData.prototype.clone = function () {
|
26098 | return (0, _create2.default)(this);
|
26099 | };
|
26100 |
|
26101 | XMLCData.prototype.toString = function (options) {
|
26102 | return this.options.writer.cdata(this, this.options.writer.filterOptions(options));
|
26103 | };
|
26104 |
|
26105 | return XMLCData;
|
26106 | }(XMLCharacterData);
|
26107 | }).call(undefined);
|
26108 |
|
26109 | },{"./NodeType":295,"./XMLCharacterData":300,"babel-runtime/core-js/object/create":50}],300:[function(require,module,exports){
|
26110 | 'use strict';
|
26111 |
|
26112 | var _create = require('babel-runtime/core-js/object/create');
|
26113 |
|
26114 | var _create2 = _interopRequireDefault(_create);
|
26115 |
|
26116 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
26117 |
|
26118 |
|
26119 | (function () {
|
26120 | var XMLCharacterData,
|
26121 | XMLNode,
|
26122 | extend = function extend(child, parent) {
|
26123 | for (var key in parent) {
|
26124 | if (hasProp.call(parent, key)) child[key] = parent[key];
|
26125 | }function ctor() {
|
26126 | this.constructor = child;
|
26127 | }ctor.prototype = parent.prototype;child.prototype = new ctor();child.__super__ = parent.prototype;return child;
|
26128 | },
|
26129 | hasProp = {}.hasOwnProperty;
|
26130 |
|
26131 | XMLNode = require('./XMLNode');
|
26132 |
|
26133 | module.exports = XMLCharacterData = function (superClass) {
|
26134 | extend(XMLCharacterData, superClass);
|
26135 |
|
26136 | function XMLCharacterData(parent) {
|
26137 | XMLCharacterData.__super__.constructor.call(this, parent);
|
26138 | this.value = '';
|
26139 | }
|
26140 |
|
26141 | Object.defineProperty(XMLCharacterData.prototype, 'data', {
|
26142 | get: function get() {
|
26143 | return this.value;
|
26144 | },
|
26145 | set: function set(value) {
|
26146 | return this.value = value || '';
|
26147 | }
|
26148 | });
|
26149 |
|
26150 | Object.defineProperty(XMLCharacterData.prototype, 'length', {
|
26151 | get: function get() {
|
26152 | return this.value.length;
|
26153 | }
|
26154 | });
|
26155 |
|
26156 | Object.defineProperty(XMLCharacterData.prototype, 'textContent', {
|
26157 | get: function get() {
|
26158 | return this.value;
|
26159 | },
|
26160 | set: function set(value) {
|
26161 | return this.value = value || '';
|
26162 | }
|
26163 | });
|
26164 |
|
26165 | XMLCharacterData.prototype.clone = function () {
|
26166 | return (0, _create2.default)(this);
|
26167 | };
|
26168 |
|
26169 | XMLCharacterData.prototype.substringData = function (offset, count) {
|
26170 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
26171 | };
|
26172 |
|
26173 | XMLCharacterData.prototype.appendData = function (arg) {
|
26174 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
26175 | };
|
26176 |
|
26177 | XMLCharacterData.prototype.insertData = function (offset, arg) {
|
26178 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
26179 | };
|
26180 |
|
26181 | XMLCharacterData.prototype.deleteData = function (offset, count) {
|
26182 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
26183 | };
|
26184 |
|
26185 | XMLCharacterData.prototype.replaceData = function (offset, count, arg) {
|
26186 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
26187 | };
|
26188 |
|
26189 | XMLCharacterData.prototype.isEqualNode = function (node) {
|
26190 | if (!XMLCharacterData.__super__.isEqualNode.apply(this, arguments).isEqualNode(node)) {
|
26191 | return false;
|
26192 | }
|
26193 | if (node.data !== this.data) {
|
26194 | return false;
|
26195 | }
|
26196 | return true;
|
26197 | };
|
26198 |
|
26199 | return XMLCharacterData;
|
26200 | }(XMLNode);
|
26201 | }).call(undefined);
|
26202 |
|
26203 | },{"./XMLNode":317,"babel-runtime/core-js/object/create":50}],301:[function(require,module,exports){
|
26204 | 'use strict';
|
26205 |
|
26206 | var _create = require('babel-runtime/core-js/object/create');
|
26207 |
|
26208 | var _create2 = _interopRequireDefault(_create);
|
26209 |
|
26210 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
26211 |
|
26212 |
|
26213 | (function () {
|
26214 | var NodeType,
|
26215 | XMLCharacterData,
|
26216 | XMLComment,
|
26217 | extend = function extend(child, parent) {
|
26218 | for (var key in parent) {
|
26219 | if (hasProp.call(parent, key)) child[key] = parent[key];
|
26220 | }function ctor() {
|
26221 | this.constructor = child;
|
26222 | }ctor.prototype = parent.prototype;child.prototype = new ctor();child.__super__ = parent.prototype;return child;
|
26223 | },
|
26224 | hasProp = {}.hasOwnProperty;
|
26225 |
|
26226 | NodeType = require('./NodeType');
|
26227 |
|
26228 | XMLCharacterData = require('./XMLCharacterData');
|
26229 |
|
26230 | module.exports = XMLComment = function (superClass) {
|
26231 | extend(XMLComment, superClass);
|
26232 |
|
26233 | function XMLComment(parent, text) {
|
26234 | XMLComment.__super__.constructor.call(this, parent);
|
26235 | if (text == null) {
|
26236 | throw new Error("Missing comment text. " + this.debugInfo());
|
26237 | }
|
26238 | this.name = "#comment";
|
26239 | this.type = NodeType.Comment;
|
26240 | this.value = this.stringify.comment(text);
|
26241 | }
|
26242 |
|
26243 | XMLComment.prototype.clone = function () {
|
26244 | return (0, _create2.default)(this);
|
26245 | };
|
26246 |
|
26247 | XMLComment.prototype.toString = function (options) {
|
26248 | return this.options.writer.comment(this, this.options.writer.filterOptions(options));
|
26249 | };
|
26250 |
|
26251 | return XMLComment;
|
26252 | }(XMLCharacterData);
|
26253 | }).call(undefined);
|
26254 |
|
26255 | },{"./NodeType":295,"./XMLCharacterData":300,"babel-runtime/core-js/object/create":50}],302:[function(require,module,exports){
|
26256 | 'use strict';
|
26257 |
|
26258 | var _keys = require('babel-runtime/core-js/object/keys');
|
26259 |
|
26260 | var _keys2 = _interopRequireDefault(_keys);
|
26261 |
|
26262 | var _create = require('babel-runtime/core-js/object/create');
|
26263 |
|
26264 | var _create2 = _interopRequireDefault(_create);
|
26265 |
|
26266 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
26267 |
|
26268 |
|
26269 | (function () {
|
26270 | var XMLDOMConfiguration, XMLDOMErrorHandler, XMLDOMStringList;
|
26271 |
|
26272 | XMLDOMErrorHandler = require('./XMLDOMErrorHandler');
|
26273 |
|
26274 | XMLDOMStringList = require('./XMLDOMStringList');
|
26275 |
|
26276 | module.exports = XMLDOMConfiguration = function () {
|
26277 | function XMLDOMConfiguration() {
|
26278 | var clonedSelf;
|
26279 | this.defaultParams = {
|
26280 | "canonical-form": false,
|
26281 | "cdata-sections": false,
|
26282 | "comments": false,
|
26283 | "datatype-normalization": false,
|
26284 | "element-content-whitespace": true,
|
26285 | "entities": true,
|
26286 | "error-handler": new XMLDOMErrorHandler(),
|
26287 | "infoset": true,
|
26288 | "validate-if-schema": false,
|
26289 | "namespaces": true,
|
26290 | "namespace-declarations": true,
|
26291 | "normalize-characters": false,
|
26292 | "schema-location": '',
|
26293 | "schema-type": '',
|
26294 | "split-cdata-sections": true,
|
26295 | "validate": false,
|
26296 | "well-formed": true
|
26297 | };
|
26298 | this.params = clonedSelf = (0, _create2.default)(this.defaultParams);
|
26299 | }
|
26300 |
|
26301 | Object.defineProperty(XMLDOMConfiguration.prototype, 'parameterNames', {
|
26302 | get: function get() {
|
26303 | return new XMLDOMStringList((0, _keys2.default)(this.defaultParams));
|
26304 | }
|
26305 | });
|
26306 |
|
26307 | XMLDOMConfiguration.prototype.getParameter = function (name) {
|
26308 | if (this.params.hasOwnProperty(name)) {
|
26309 | return this.params[name];
|
26310 | } else {
|
26311 | return null;
|
26312 | }
|
26313 | };
|
26314 |
|
26315 | XMLDOMConfiguration.prototype.canSetParameter = function (name, value) {
|
26316 | return true;
|
26317 | };
|
26318 |
|
26319 | XMLDOMConfiguration.prototype.setParameter = function (name, value) {
|
26320 | if (value != null) {
|
26321 | return this.params[name] = value;
|
26322 | } else {
|
26323 | return delete this.params[name];
|
26324 | }
|
26325 | };
|
26326 |
|
26327 | return XMLDOMConfiguration;
|
26328 | }();
|
26329 | }).call(undefined);
|
26330 |
|
26331 | },{"./XMLDOMErrorHandler":303,"./XMLDOMStringList":305,"babel-runtime/core-js/object/create":50,"babel-runtime/core-js/object/keys":55}],303:[function(require,module,exports){
|
26332 | "use strict";
|
26333 |
|
26334 |
|
26335 | (function () {
|
26336 | var XMLDOMErrorHandler;
|
26337 |
|
26338 | module.exports = XMLDOMErrorHandler = function () {
|
26339 | function XMLDOMErrorHandler() {}
|
26340 |
|
26341 | XMLDOMErrorHandler.prototype.handleError = function (error) {
|
26342 | throw new Error(error);
|
26343 | };
|
26344 |
|
26345 | return XMLDOMErrorHandler;
|
26346 | }();
|
26347 | }).call(undefined);
|
26348 |
|
26349 | },{}],304:[function(require,module,exports){
|
26350 | "use strict";
|
26351 |
|
26352 |
|
26353 | (function () {
|
26354 | var XMLDOMImplementation;
|
26355 |
|
26356 | module.exports = XMLDOMImplementation = function () {
|
26357 | function XMLDOMImplementation() {}
|
26358 |
|
26359 | XMLDOMImplementation.prototype.hasFeature = function (feature, version) {
|
26360 | return true;
|
26361 | };
|
26362 |
|
26363 | XMLDOMImplementation.prototype.createDocumentType = function (qualifiedName, publicId, systemId) {
|
26364 | throw new Error("This DOM method is not implemented.");
|
26365 | };
|
26366 |
|
26367 | XMLDOMImplementation.prototype.createDocument = function (namespaceURI, qualifiedName, doctype) {
|
26368 | throw new Error("This DOM method is not implemented.");
|
26369 | };
|
26370 |
|
26371 | XMLDOMImplementation.prototype.createHTMLDocument = function (title) {
|
26372 | throw new Error("This DOM method is not implemented.");
|
26373 | };
|
26374 |
|
26375 | XMLDOMImplementation.prototype.getFeature = function (feature, version) {
|
26376 | throw new Error("This DOM method is not implemented.");
|
26377 | };
|
26378 |
|
26379 | return XMLDOMImplementation;
|
26380 | }();
|
26381 | }).call(undefined);
|
26382 |
|
26383 | },{}],305:[function(require,module,exports){
|
26384 | 'use strict';
|
26385 |
|
26386 |
|
26387 | (function () {
|
26388 | var XMLDOMStringList;
|
26389 |
|
26390 | module.exports = XMLDOMStringList = function () {
|
26391 | function XMLDOMStringList(arr) {
|
26392 | this.arr = arr || [];
|
26393 | }
|
26394 |
|
26395 | Object.defineProperty(XMLDOMStringList.prototype, 'length', {
|
26396 | get: function get() {
|
26397 | return this.arr.length;
|
26398 | }
|
26399 | });
|
26400 |
|
26401 | XMLDOMStringList.prototype.item = function (index) {
|
26402 | return this.arr[index] || null;
|
26403 | };
|
26404 |
|
26405 | XMLDOMStringList.prototype.contains = function (str) {
|
26406 | return this.arr.indexOf(str) !== -1;
|
26407 | };
|
26408 |
|
26409 | return XMLDOMStringList;
|
26410 | }();
|
26411 | }).call(undefined);
|
26412 |
|
26413 | },{}],306:[function(require,module,exports){
|
26414 | 'use strict';
|
26415 |
|
26416 |
|
26417 | (function () {
|
26418 | var NodeType,
|
26419 | XMLDTDAttList,
|
26420 | XMLNode,
|
26421 | extend = function extend(child, parent) {
|
26422 | for (var key in parent) {
|
26423 | if (hasProp.call(parent, key)) child[key] = parent[key];
|
26424 | }function ctor() {
|
26425 | this.constructor = child;
|
26426 | }ctor.prototype = parent.prototype;child.prototype = new ctor();child.__super__ = parent.prototype;return child;
|
26427 | },
|
26428 | hasProp = {}.hasOwnProperty;
|
26429 |
|
26430 | XMLNode = require('./XMLNode');
|
26431 |
|
26432 | NodeType = require('./NodeType');
|
26433 |
|
26434 | module.exports = XMLDTDAttList = function (superClass) {
|
26435 | extend(XMLDTDAttList, superClass);
|
26436 |
|
26437 | function XMLDTDAttList(parent, elementName, attributeName, attributeType, defaultValueType, defaultValue) {
|
26438 | XMLDTDAttList.__super__.constructor.call(this, parent);
|
26439 | if (elementName == null) {
|
26440 | throw new Error("Missing DTD element name. " + this.debugInfo());
|
26441 | }
|
26442 | if (attributeName == null) {
|
26443 | throw new Error("Missing DTD attribute name. " + this.debugInfo(elementName));
|
26444 | }
|
26445 | if (!attributeType) {
|
26446 | throw new Error("Missing DTD attribute type. " + this.debugInfo(elementName));
|
26447 | }
|
26448 | if (!defaultValueType) {
|
26449 | throw new Error("Missing DTD attribute default. " + this.debugInfo(elementName));
|
26450 | }
|
26451 | if (defaultValueType.indexOf('#') !== 0) {
|
26452 | defaultValueType = '#' + defaultValueType;
|
26453 | }
|
26454 | if (!defaultValueType.match(/^(#REQUIRED|#IMPLIED|#FIXED|#DEFAULT)$/)) {
|
26455 | throw new Error("Invalid default value type; expected: #REQUIRED, #IMPLIED, #FIXED or #DEFAULT. " + this.debugInfo(elementName));
|
26456 | }
|
26457 | if (defaultValue && !defaultValueType.match(/^(#FIXED|#DEFAULT)$/)) {
|
26458 | throw new Error("Default value only applies to #FIXED or #DEFAULT. " + this.debugInfo(elementName));
|
26459 | }
|
26460 | this.elementName = this.stringify.name(elementName);
|
26461 | this.type = NodeType.AttributeDeclaration;
|
26462 | this.attributeName = this.stringify.name(attributeName);
|
26463 | this.attributeType = this.stringify.dtdAttType(attributeType);
|
26464 | if (defaultValue) {
|
26465 | this.defaultValue = this.stringify.dtdAttDefault(defaultValue);
|
26466 | }
|
26467 | this.defaultValueType = defaultValueType;
|
26468 | }
|
26469 |
|
26470 | XMLDTDAttList.prototype.toString = function (options) {
|
26471 | return this.options.writer.dtdAttList(this, this.options.writer.filterOptions(options));
|
26472 | };
|
26473 |
|
26474 | return XMLDTDAttList;
|
26475 | }(XMLNode);
|
26476 | }).call(undefined);
|
26477 |
|
26478 | },{"./NodeType":295,"./XMLNode":317}],307:[function(require,module,exports){
|
26479 | 'use strict';
|
26480 |
|
26481 |
|
26482 | (function () {
|
26483 | var NodeType,
|
26484 | XMLDTDElement,
|
26485 | XMLNode,
|
26486 | extend = function extend(child, parent) {
|
26487 | for (var key in parent) {
|
26488 | if (hasProp.call(parent, key)) child[key] = parent[key];
|
26489 | }function ctor() {
|
26490 | this.constructor = child;
|
26491 | }ctor.prototype = parent.prototype;child.prototype = new ctor();child.__super__ = parent.prototype;return child;
|
26492 | },
|
26493 | hasProp = {}.hasOwnProperty;
|
26494 |
|
26495 | XMLNode = require('./XMLNode');
|
26496 |
|
26497 | NodeType = require('./NodeType');
|
26498 |
|
26499 | module.exports = XMLDTDElement = function (superClass) {
|
26500 | extend(XMLDTDElement, superClass);
|
26501 |
|
26502 | function XMLDTDElement(parent, name, value) {
|
26503 | XMLDTDElement.__super__.constructor.call(this, parent);
|
26504 | if (name == null) {
|
26505 | throw new Error("Missing DTD element name. " + this.debugInfo());
|
26506 | }
|
26507 | if (!value) {
|
26508 | value = '(#PCDATA)';
|
26509 | }
|
26510 | if (Array.isArray(value)) {
|
26511 | value = '(' + value.join(',') + ')';
|
26512 | }
|
26513 | this.name = this.stringify.name(name);
|
26514 | this.type = NodeType.ElementDeclaration;
|
26515 | this.value = this.stringify.dtdElementValue(value);
|
26516 | }
|
26517 |
|
26518 | XMLDTDElement.prototype.toString = function (options) {
|
26519 | return this.options.writer.dtdElement(this, this.options.writer.filterOptions(options));
|
26520 | };
|
26521 |
|
26522 | return XMLDTDElement;
|
26523 | }(XMLNode);
|
26524 | }).call(undefined);
|
26525 |
|
26526 | },{"./NodeType":295,"./XMLNode":317}],308:[function(require,module,exports){
|
26527 | 'use strict';
|
26528 |
|
26529 |
|
26530 | (function () {
|
26531 | var NodeType,
|
26532 | XMLDTDEntity,
|
26533 | XMLNode,
|
26534 | isObject,
|
26535 | extend = function extend(child, parent) {
|
26536 | for (var key in parent) {
|
26537 | if (hasProp.call(parent, key)) child[key] = parent[key];
|
26538 | }function ctor() {
|
26539 | this.constructor = child;
|
26540 | }ctor.prototype = parent.prototype;child.prototype = new ctor();child.__super__ = parent.prototype;return child;
|
26541 | },
|
26542 | hasProp = {}.hasOwnProperty;
|
26543 |
|
26544 | isObject = require('./Utility').isObject;
|
26545 |
|
26546 | XMLNode = require('./XMLNode');
|
26547 |
|
26548 | NodeType = require('./NodeType');
|
26549 |
|
26550 | module.exports = XMLDTDEntity = function (superClass) {
|
26551 | extend(XMLDTDEntity, superClass);
|
26552 |
|
26553 | function XMLDTDEntity(parent, pe, name, value) {
|
26554 | XMLDTDEntity.__super__.constructor.call(this, parent);
|
26555 | if (name == null) {
|
26556 | throw new Error("Missing DTD entity name. " + this.debugInfo(name));
|
26557 | }
|
26558 | if (value == null) {
|
26559 | throw new Error("Missing DTD entity value. " + this.debugInfo(name));
|
26560 | }
|
26561 | this.pe = !!pe;
|
26562 | this.name = this.stringify.name(name);
|
26563 | this.type = NodeType.EntityDeclaration;
|
26564 | if (!isObject(value)) {
|
26565 | this.value = this.stringify.dtdEntityValue(value);
|
26566 | this.internal = true;
|
26567 | } else {
|
26568 | if (!value.pubID && !value.sysID) {
|
26569 | throw new Error("Public and/or system identifiers are required for an external entity. " + this.debugInfo(name));
|
26570 | }
|
26571 | if (value.pubID && !value.sysID) {
|
26572 | throw new Error("System identifier is required for a public external entity. " + this.debugInfo(name));
|
26573 | }
|
26574 | this.internal = false;
|
26575 | if (value.pubID != null) {
|
26576 | this.pubID = this.stringify.dtdPubID(value.pubID);
|
26577 | }
|
26578 | if (value.sysID != null) {
|
26579 | this.sysID = this.stringify.dtdSysID(value.sysID);
|
26580 | }
|
26581 | if (value.nData != null) {
|
26582 | this.nData = this.stringify.dtdNData(value.nData);
|
26583 | }
|
26584 | if (this.pe && this.nData) {
|
26585 | throw new Error("Notation declaration is not allowed in a parameter entity. " + this.debugInfo(name));
|
26586 | }
|
26587 | }
|
26588 | }
|
26589 |
|
26590 | Object.defineProperty(XMLDTDEntity.prototype, 'publicId', {
|
26591 | get: function get() {
|
26592 | return this.pubID;
|
26593 | }
|
26594 | });
|
26595 |
|
26596 | Object.defineProperty(XMLDTDEntity.prototype, 'systemId', {
|
26597 | get: function get() {
|
26598 | return this.sysID;
|
26599 | }
|
26600 | });
|
26601 |
|
26602 | Object.defineProperty(XMLDTDEntity.prototype, 'notationName', {
|
26603 | get: function get() {
|
26604 | return this.nData || null;
|
26605 | }
|
26606 | });
|
26607 |
|
26608 | Object.defineProperty(XMLDTDEntity.prototype, 'inputEncoding', {
|
26609 | get: function get() {
|
26610 | return null;
|
26611 | }
|
26612 | });
|
26613 |
|
26614 | Object.defineProperty(XMLDTDEntity.prototype, 'xmlEncoding', {
|
26615 | get: function get() {
|
26616 | return null;
|
26617 | }
|
26618 | });
|
26619 |
|
26620 | Object.defineProperty(XMLDTDEntity.prototype, 'xmlVersion', {
|
26621 | get: function get() {
|
26622 | return null;
|
26623 | }
|
26624 | });
|
26625 |
|
26626 | XMLDTDEntity.prototype.toString = function (options) {
|
26627 | return this.options.writer.dtdEntity(this, this.options.writer.filterOptions(options));
|
26628 | };
|
26629 |
|
26630 | return XMLDTDEntity;
|
26631 | }(XMLNode);
|
26632 | }).call(undefined);
|
26633 |
|
26634 | },{"./NodeType":295,"./Utility":296,"./XMLNode":317}],309:[function(require,module,exports){
|
26635 | 'use strict';
|
26636 |
|
26637 |
|
26638 | (function () {
|
26639 | var NodeType,
|
26640 | XMLDTDNotation,
|
26641 | XMLNode,
|
26642 | extend = function extend(child, parent) {
|
26643 | for (var key in parent) {
|
26644 | if (hasProp.call(parent, key)) child[key] = parent[key];
|
26645 | }function ctor() {
|
26646 | this.constructor = child;
|
26647 | }ctor.prototype = parent.prototype;child.prototype = new ctor();child.__super__ = parent.prototype;return child;
|
26648 | },
|
26649 | hasProp = {}.hasOwnProperty;
|
26650 |
|
26651 | XMLNode = require('./XMLNode');
|
26652 |
|
26653 | NodeType = require('./NodeType');
|
26654 |
|
26655 | module.exports = XMLDTDNotation = function (superClass) {
|
26656 | extend(XMLDTDNotation, superClass);
|
26657 |
|
26658 | function XMLDTDNotation(parent, name, value) {
|
26659 | XMLDTDNotation.__super__.constructor.call(this, parent);
|
26660 | if (name == null) {
|
26661 | throw new Error("Missing DTD notation name. " + this.debugInfo(name));
|
26662 | }
|
26663 | if (!value.pubID && !value.sysID) {
|
26664 | throw new Error("Public or system identifiers are required for an external entity. " + this.debugInfo(name));
|
26665 | }
|
26666 | this.name = this.stringify.name(name);
|
26667 | this.type = NodeType.NotationDeclaration;
|
26668 | if (value.pubID != null) {
|
26669 | this.pubID = this.stringify.dtdPubID(value.pubID);
|
26670 | }
|
26671 | if (value.sysID != null) {
|
26672 | this.sysID = this.stringify.dtdSysID(value.sysID);
|
26673 | }
|
26674 | }
|
26675 |
|
26676 | Object.defineProperty(XMLDTDNotation.prototype, 'publicId', {
|
26677 | get: function get() {
|
26678 | return this.pubID;
|
26679 | }
|
26680 | });
|
26681 |
|
26682 | Object.defineProperty(XMLDTDNotation.prototype, 'systemId', {
|
26683 | get: function get() {
|
26684 | return this.sysID;
|
26685 | }
|
26686 | });
|
26687 |
|
26688 | XMLDTDNotation.prototype.toString = function (options) {
|
26689 | return this.options.writer.dtdNotation(this, this.options.writer.filterOptions(options));
|
26690 | };
|
26691 |
|
26692 | return XMLDTDNotation;
|
26693 | }(XMLNode);
|
26694 | }).call(undefined);
|
26695 |
|
26696 | },{"./NodeType":295,"./XMLNode":317}],310:[function(require,module,exports){
|
26697 | 'use strict';
|
26698 |
|
26699 |
|
26700 | (function () {
|
26701 | var NodeType,
|
26702 | XMLDeclaration,
|
26703 | XMLNode,
|
26704 | isObject,
|
26705 | extend = function extend(child, parent) {
|
26706 | for (var key in parent) {
|
26707 | if (hasProp.call(parent, key)) child[key] = parent[key];
|
26708 | }function ctor() {
|
26709 | this.constructor = child;
|
26710 | }ctor.prototype = parent.prototype;child.prototype = new ctor();child.__super__ = parent.prototype;return child;
|
26711 | },
|
26712 | hasProp = {}.hasOwnProperty;
|
26713 |
|
26714 | isObject = require('./Utility').isObject;
|
26715 |
|
26716 | XMLNode = require('./XMLNode');
|
26717 |
|
26718 | NodeType = require('./NodeType');
|
26719 |
|
26720 | module.exports = XMLDeclaration = function (superClass) {
|
26721 | extend(XMLDeclaration, superClass);
|
26722 |
|
26723 | function XMLDeclaration(parent, version, encoding, standalone) {
|
26724 | var ref;
|
26725 | XMLDeclaration.__super__.constructor.call(this, parent);
|
26726 | if (isObject(version)) {
|
26727 | ref = version, version = ref.version, encoding = ref.encoding, standalone = ref.standalone;
|
26728 | }
|
26729 | if (!version) {
|
26730 | version = '1.0';
|
26731 | }
|
26732 | this.type = NodeType.Declaration;
|
26733 | this.version = this.stringify.xmlVersion(version);
|
26734 | if (encoding != null) {
|
26735 | this.encoding = this.stringify.xmlEncoding(encoding);
|
26736 | }
|
26737 | if (standalone != null) {
|
26738 | this.standalone = this.stringify.xmlStandalone(standalone);
|
26739 | }
|
26740 | }
|
26741 |
|
26742 | XMLDeclaration.prototype.toString = function (options) {
|
26743 | return this.options.writer.declaration(this, this.options.writer.filterOptions(options));
|
26744 | };
|
26745 |
|
26746 | return XMLDeclaration;
|
26747 | }(XMLNode);
|
26748 | }).call(undefined);
|
26749 |
|
26750 | },{"./NodeType":295,"./Utility":296,"./XMLNode":317}],311:[function(require,module,exports){
|
26751 | 'use strict';
|
26752 |
|
26753 |
|
26754 | (function () {
|
26755 | var NodeType,
|
26756 | XMLDTDAttList,
|
26757 | XMLDTDElement,
|
26758 | XMLDTDEntity,
|
26759 | XMLDTDNotation,
|
26760 | XMLDocType,
|
26761 | XMLNamedNodeMap,
|
26762 | XMLNode,
|
26763 | isObject,
|
26764 | extend = function extend(child, parent) {
|
26765 | for (var key in parent) {
|
26766 | if (hasProp.call(parent, key)) child[key] = parent[key];
|
26767 | }function ctor() {
|
26768 | this.constructor = child;
|
26769 | }ctor.prototype = parent.prototype;child.prototype = new ctor();child.__super__ = parent.prototype;return child;
|
26770 | },
|
26771 | hasProp = {}.hasOwnProperty;
|
26772 |
|
26773 | isObject = require('./Utility').isObject;
|
26774 |
|
26775 | XMLNode = require('./XMLNode');
|
26776 |
|
26777 | NodeType = require('./NodeType');
|
26778 |
|
26779 | XMLDTDAttList = require('./XMLDTDAttList');
|
26780 |
|
26781 | XMLDTDEntity = require('./XMLDTDEntity');
|
26782 |
|
26783 | XMLDTDElement = require('./XMLDTDElement');
|
26784 |
|
26785 | XMLDTDNotation = require('./XMLDTDNotation');
|
26786 |
|
26787 | XMLNamedNodeMap = require('./XMLNamedNodeMap');
|
26788 |
|
26789 | module.exports = XMLDocType = function (superClass) {
|
26790 | extend(XMLDocType, superClass);
|
26791 |
|
26792 | function XMLDocType(parent, pubID, sysID) {
|
26793 | var child, i, len, ref, ref1, ref2;
|
26794 | XMLDocType.__super__.constructor.call(this, parent);
|
26795 | this.type = NodeType.DocType;
|
26796 | if (parent.children) {
|
26797 | ref = parent.children;
|
26798 | for (i = 0, len = ref.length; i < len; i++) {
|
26799 | child = ref[i];
|
26800 | if (child.type === NodeType.Element) {
|
26801 | this.name = child.name;
|
26802 | break;
|
26803 | }
|
26804 | }
|
26805 | }
|
26806 | this.documentObject = parent;
|
26807 | if (isObject(pubID)) {
|
26808 | ref1 = pubID, pubID = ref1.pubID, sysID = ref1.sysID;
|
26809 | }
|
26810 | if (sysID == null) {
|
26811 | ref2 = [pubID, sysID], sysID = ref2[0], pubID = ref2[1];
|
26812 | }
|
26813 | if (pubID != null) {
|
26814 | this.pubID = this.stringify.dtdPubID(pubID);
|
26815 | }
|
26816 | if (sysID != null) {
|
26817 | this.sysID = this.stringify.dtdSysID(sysID);
|
26818 | }
|
26819 | }
|
26820 |
|
26821 | Object.defineProperty(XMLDocType.prototype, 'entities', {
|
26822 | get: function get() {
|
26823 | var child, i, len, nodes, ref;
|
26824 | nodes = {};
|
26825 | ref = this.children;
|
26826 | for (i = 0, len = ref.length; i < len; i++) {
|
26827 | child = ref[i];
|
26828 | if (child.type === NodeType.EntityDeclaration && !child.pe) {
|
26829 | nodes[child.name] = child;
|
26830 | }
|
26831 | }
|
26832 | return new XMLNamedNodeMap(nodes);
|
26833 | }
|
26834 | });
|
26835 |
|
26836 | Object.defineProperty(XMLDocType.prototype, 'notations', {
|
26837 | get: function get() {
|
26838 | var child, i, len, nodes, ref;
|
26839 | nodes = {};
|
26840 | ref = this.children;
|
26841 | for (i = 0, len = ref.length; i < len; i++) {
|
26842 | child = ref[i];
|
26843 | if (child.type === NodeType.NotationDeclaration) {
|
26844 | nodes[child.name] = child;
|
26845 | }
|
26846 | }
|
26847 | return new XMLNamedNodeMap(nodes);
|
26848 | }
|
26849 | });
|
26850 |
|
26851 | Object.defineProperty(XMLDocType.prototype, 'publicId', {
|
26852 | get: function get() {
|
26853 | return this.pubID;
|
26854 | }
|
26855 | });
|
26856 |
|
26857 | Object.defineProperty(XMLDocType.prototype, 'systemId', {
|
26858 | get: function get() {
|
26859 | return this.sysID;
|
26860 | }
|
26861 | });
|
26862 |
|
26863 | Object.defineProperty(XMLDocType.prototype, 'internalSubset', {
|
26864 | get: function get() {
|
26865 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
26866 | }
|
26867 | });
|
26868 |
|
26869 | XMLDocType.prototype.element = function (name, value) {
|
26870 | var child;
|
26871 | child = new XMLDTDElement(this, name, value);
|
26872 | this.children.push(child);
|
26873 | return this;
|
26874 | };
|
26875 |
|
26876 | XMLDocType.prototype.attList = function (elementName, attributeName, attributeType, defaultValueType, defaultValue) {
|
26877 | var child;
|
26878 | child = new XMLDTDAttList(this, elementName, attributeName, attributeType, defaultValueType, defaultValue);
|
26879 | this.children.push(child);
|
26880 | return this;
|
26881 | };
|
26882 |
|
26883 | XMLDocType.prototype.entity = function (name, value) {
|
26884 | var child;
|
26885 | child = new XMLDTDEntity(this, false, name, value);
|
26886 | this.children.push(child);
|
26887 | return this;
|
26888 | };
|
26889 |
|
26890 | XMLDocType.prototype.pEntity = function (name, value) {
|
26891 | var child;
|
26892 | child = new XMLDTDEntity(this, true, name, value);
|
26893 | this.children.push(child);
|
26894 | return this;
|
26895 | };
|
26896 |
|
26897 | XMLDocType.prototype.notation = function (name, value) {
|
26898 | var child;
|
26899 | child = new XMLDTDNotation(this, name, value);
|
26900 | this.children.push(child);
|
26901 | return this;
|
26902 | };
|
26903 |
|
26904 | XMLDocType.prototype.toString = function (options) {
|
26905 | return this.options.writer.docType(this, this.options.writer.filterOptions(options));
|
26906 | };
|
26907 |
|
26908 | XMLDocType.prototype.ele = function (name, value) {
|
26909 | return this.element(name, value);
|
26910 | };
|
26911 |
|
26912 | XMLDocType.prototype.att = function (elementName, attributeName, attributeType, defaultValueType, defaultValue) {
|
26913 | return this.attList(elementName, attributeName, attributeType, defaultValueType, defaultValue);
|
26914 | };
|
26915 |
|
26916 | XMLDocType.prototype.ent = function (name, value) {
|
26917 | return this.entity(name, value);
|
26918 | };
|
26919 |
|
26920 | XMLDocType.prototype.pent = function (name, value) {
|
26921 | return this.pEntity(name, value);
|
26922 | };
|
26923 |
|
26924 | XMLDocType.prototype.not = function (name, value) {
|
26925 | return this.notation(name, value);
|
26926 | };
|
26927 |
|
26928 | XMLDocType.prototype.up = function () {
|
26929 | return this.root() || this.documentObject;
|
26930 | };
|
26931 |
|
26932 | XMLDocType.prototype.isEqualNode = function (node) {
|
26933 | if (!XMLDocType.__super__.isEqualNode.apply(this, arguments).isEqualNode(node)) {
|
26934 | return false;
|
26935 | }
|
26936 | if (node.name !== this.name) {
|
26937 | return false;
|
26938 | }
|
26939 | if (node.publicId !== this.publicId) {
|
26940 | return false;
|
26941 | }
|
26942 | if (node.systemId !== this.systemId) {
|
26943 | return false;
|
26944 | }
|
26945 | return true;
|
26946 | };
|
26947 |
|
26948 | return XMLDocType;
|
26949 | }(XMLNode);
|
26950 | }).call(undefined);
|
26951 |
|
26952 | },{"./NodeType":295,"./Utility":296,"./XMLDTDAttList":306,"./XMLDTDElement":307,"./XMLDTDEntity":308,"./XMLDTDNotation":309,"./XMLNamedNodeMap":316,"./XMLNode":317}],312:[function(require,module,exports){
|
26953 | 'use strict';
|
26954 |
|
26955 |
|
26956 | (function () {
|
26957 | var NodeType,
|
26958 | XMLDOMConfiguration,
|
26959 | XMLDOMImplementation,
|
26960 | XMLDocument,
|
26961 | XMLNode,
|
26962 | XMLStringWriter,
|
26963 | XMLStringifier,
|
26964 | isPlainObject,
|
26965 | extend = function extend(child, parent) {
|
26966 | for (var key in parent) {
|
26967 | if (hasProp.call(parent, key)) child[key] = parent[key];
|
26968 | }function ctor() {
|
26969 | this.constructor = child;
|
26970 | }ctor.prototype = parent.prototype;child.prototype = new ctor();child.__super__ = parent.prototype;return child;
|
26971 | },
|
26972 | hasProp = {}.hasOwnProperty;
|
26973 |
|
26974 | isPlainObject = require('./Utility').isPlainObject;
|
26975 |
|
26976 | XMLDOMImplementation = require('./XMLDOMImplementation');
|
26977 |
|
26978 | XMLDOMConfiguration = require('./XMLDOMConfiguration');
|
26979 |
|
26980 | XMLNode = require('./XMLNode');
|
26981 |
|
26982 | NodeType = require('./NodeType');
|
26983 |
|
26984 | XMLStringifier = require('./XMLStringifier');
|
26985 |
|
26986 | XMLStringWriter = require('./XMLStringWriter');
|
26987 |
|
26988 | module.exports = XMLDocument = function (superClass) {
|
26989 | extend(XMLDocument, superClass);
|
26990 |
|
26991 | function XMLDocument(options) {
|
26992 | XMLDocument.__super__.constructor.call(this, null);
|
26993 | this.name = "#document";
|
26994 | this.type = NodeType.Document;
|
26995 | this.documentURI = null;
|
26996 | this.domConfig = new XMLDOMConfiguration();
|
26997 | options || (options = {});
|
26998 | if (!options.writer) {
|
26999 | options.writer = new XMLStringWriter();
|
27000 | }
|
27001 | this.options = options;
|
27002 | this.stringify = new XMLStringifier(options);
|
27003 | }
|
27004 |
|
27005 | Object.defineProperty(XMLDocument.prototype, 'implementation', {
|
27006 | value: new XMLDOMImplementation()
|
27007 | });
|
27008 |
|
27009 | Object.defineProperty(XMLDocument.prototype, 'doctype', {
|
27010 | get: function get() {
|
27011 | var child, i, len, ref;
|
27012 | ref = this.children;
|
27013 | for (i = 0, len = ref.length; i < len; i++) {
|
27014 | child = ref[i];
|
27015 | if (child.type === NodeType.DocType) {
|
27016 | return child;
|
27017 | }
|
27018 | }
|
27019 | return null;
|
27020 | }
|
27021 | });
|
27022 |
|
27023 | Object.defineProperty(XMLDocument.prototype, 'documentElement', {
|
27024 | get: function get() {
|
27025 | return this.rootObject || null;
|
27026 | }
|
27027 | });
|
27028 |
|
27029 | Object.defineProperty(XMLDocument.prototype, 'inputEncoding', {
|
27030 | get: function get() {
|
27031 | return null;
|
27032 | }
|
27033 | });
|
27034 |
|
27035 | Object.defineProperty(XMLDocument.prototype, 'strictErrorChecking', {
|
27036 | get: function get() {
|
27037 | return false;
|
27038 | }
|
27039 | });
|
27040 |
|
27041 | Object.defineProperty(XMLDocument.prototype, 'xmlEncoding', {
|
27042 | get: function get() {
|
27043 | if (this.children.length !== 0 && this.children[0].type === NodeType.Declaration) {
|
27044 | return this.children[0].encoding;
|
27045 | } else {
|
27046 | return null;
|
27047 | }
|
27048 | }
|
27049 | });
|
27050 |
|
27051 | Object.defineProperty(XMLDocument.prototype, 'xmlStandalone', {
|
27052 | get: function get() {
|
27053 | if (this.children.length !== 0 && this.children[0].type === NodeType.Declaration) {
|
27054 | return this.children[0].standalone === 'yes';
|
27055 | } else {
|
27056 | return false;
|
27057 | }
|
27058 | }
|
27059 | });
|
27060 |
|
27061 | Object.defineProperty(XMLDocument.prototype, 'xmlVersion', {
|
27062 | get: function get() {
|
27063 | if (this.children.length !== 0 && this.children[0].type === NodeType.Declaration) {
|
27064 | return this.children[0].version;
|
27065 | } else {
|
27066 | return "1.0";
|
27067 | }
|
27068 | }
|
27069 | });
|
27070 |
|
27071 | Object.defineProperty(XMLDocument.prototype, 'URL', {
|
27072 | get: function get() {
|
27073 | return this.documentURI;
|
27074 | }
|
27075 | });
|
27076 |
|
27077 | Object.defineProperty(XMLDocument.prototype, 'origin', {
|
27078 | get: function get() {
|
27079 | return null;
|
27080 | }
|
27081 | });
|
27082 |
|
27083 | Object.defineProperty(XMLDocument.prototype, 'compatMode', {
|
27084 | get: function get() {
|
27085 | return null;
|
27086 | }
|
27087 | });
|
27088 |
|
27089 | Object.defineProperty(XMLDocument.prototype, 'characterSet', {
|
27090 | get: function get() {
|
27091 | return null;
|
27092 | }
|
27093 | });
|
27094 |
|
27095 | Object.defineProperty(XMLDocument.prototype, 'contentType', {
|
27096 | get: function get() {
|
27097 | return null;
|
27098 | }
|
27099 | });
|
27100 |
|
27101 | XMLDocument.prototype.end = function (writer) {
|
27102 | var writerOptions;
|
27103 | writerOptions = {};
|
27104 | if (!writer) {
|
27105 | writer = this.options.writer;
|
27106 | } else if (isPlainObject(writer)) {
|
27107 | writerOptions = writer;
|
27108 | writer = this.options.writer;
|
27109 | }
|
27110 | return writer.document(this, writer.filterOptions(writerOptions));
|
27111 | };
|
27112 |
|
27113 | XMLDocument.prototype.toString = function (options) {
|
27114 | return this.options.writer.document(this, this.options.writer.filterOptions(options));
|
27115 | };
|
27116 |
|
27117 | XMLDocument.prototype.createElement = function (tagName) {
|
27118 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
27119 | };
|
27120 |
|
27121 | XMLDocument.prototype.createDocumentFragment = function () {
|
27122 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
27123 | };
|
27124 |
|
27125 | XMLDocument.prototype.createTextNode = function (data) {
|
27126 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
27127 | };
|
27128 |
|
27129 | XMLDocument.prototype.createComment = function (data) {
|
27130 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
27131 | };
|
27132 |
|
27133 | XMLDocument.prototype.createCDATASection = function (data) {
|
27134 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
27135 | };
|
27136 |
|
27137 | XMLDocument.prototype.createProcessingInstruction = function (target, data) {
|
27138 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
27139 | };
|
27140 |
|
27141 | XMLDocument.prototype.createAttribute = function (name) {
|
27142 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
27143 | };
|
27144 |
|
27145 | XMLDocument.prototype.createEntityReference = function (name) {
|
27146 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
27147 | };
|
27148 |
|
27149 | XMLDocument.prototype.getElementsByTagName = function (tagname) {
|
27150 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
27151 | };
|
27152 |
|
27153 | XMLDocument.prototype.importNode = function (importedNode, deep) {
|
27154 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
27155 | };
|
27156 |
|
27157 | XMLDocument.prototype.createElementNS = function (namespaceURI, qualifiedName) {
|
27158 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
27159 | };
|
27160 |
|
27161 | XMLDocument.prototype.createAttributeNS = function (namespaceURI, qualifiedName) {
|
27162 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
27163 | };
|
27164 |
|
27165 | XMLDocument.prototype.getElementsByTagNameNS = function (namespaceURI, localName) {
|
27166 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
27167 | };
|
27168 |
|
27169 | XMLDocument.prototype.getElementById = function (elementId) {
|
27170 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
27171 | };
|
27172 |
|
27173 | XMLDocument.prototype.adoptNode = function (source) {
|
27174 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
27175 | };
|
27176 |
|
27177 | XMLDocument.prototype.normalizeDocument = function () {
|
27178 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
27179 | };
|
27180 |
|
27181 | XMLDocument.prototype.renameNode = function (node, namespaceURI, qualifiedName) {
|
27182 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
27183 | };
|
27184 |
|
27185 | XMLDocument.prototype.getElementsByClassName = function (classNames) {
|
27186 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
27187 | };
|
27188 |
|
27189 | XMLDocument.prototype.createEvent = function (eventInterface) {
|
27190 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
27191 | };
|
27192 |
|
27193 | XMLDocument.prototype.createRange = function () {
|
27194 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
27195 | };
|
27196 |
|
27197 | XMLDocument.prototype.createNodeIterator = function (root, whatToShow, filter) {
|
27198 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
27199 | };
|
27200 |
|
27201 | XMLDocument.prototype.createTreeWalker = function (root, whatToShow, filter) {
|
27202 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
27203 | };
|
27204 |
|
27205 | return XMLDocument;
|
27206 | }(XMLNode);
|
27207 | }).call(undefined);
|
27208 |
|
27209 | },{"./NodeType":295,"./Utility":296,"./XMLDOMConfiguration":302,"./XMLDOMImplementation":304,"./XMLNode":317,"./XMLStringWriter":322,"./XMLStringifier":323}],313:[function(require,module,exports){
|
27210 | 'use strict';
|
27211 |
|
27212 |
|
27213 | (function () {
|
27214 | var NodeType,
|
27215 | WriterState,
|
27216 | XMLAttribute,
|
27217 | XMLCData,
|
27218 | XMLComment,
|
27219 | XMLDTDAttList,
|
27220 | XMLDTDElement,
|
27221 | XMLDTDEntity,
|
27222 | XMLDTDNotation,
|
27223 | XMLDeclaration,
|
27224 | XMLDocType,
|
27225 | XMLDocument,
|
27226 | XMLDocumentCB,
|
27227 | XMLElement,
|
27228 | XMLProcessingInstruction,
|
27229 | XMLRaw,
|
27230 | XMLStringWriter,
|
27231 | XMLStringifier,
|
27232 | XMLText,
|
27233 | getValue,
|
27234 | isFunction,
|
27235 | isObject,
|
27236 | isPlainObject,
|
27237 | ref,
|
27238 | hasProp = {}.hasOwnProperty;
|
27239 |
|
27240 | ref = require('./Utility'), isObject = ref.isObject, isFunction = ref.isFunction, isPlainObject = ref.isPlainObject, getValue = ref.getValue;
|
27241 |
|
27242 | NodeType = require('./NodeType');
|
27243 |
|
27244 | XMLDocument = require('./XMLDocument');
|
27245 |
|
27246 | XMLElement = require('./XMLElement');
|
27247 |
|
27248 | XMLCData = require('./XMLCData');
|
27249 |
|
27250 | XMLComment = require('./XMLComment');
|
27251 |
|
27252 | XMLRaw = require('./XMLRaw');
|
27253 |
|
27254 | XMLText = require('./XMLText');
|
27255 |
|
27256 | XMLProcessingInstruction = require('./XMLProcessingInstruction');
|
27257 |
|
27258 | XMLDeclaration = require('./XMLDeclaration');
|
27259 |
|
27260 | XMLDocType = require('./XMLDocType');
|
27261 |
|
27262 | XMLDTDAttList = require('./XMLDTDAttList');
|
27263 |
|
27264 | XMLDTDEntity = require('./XMLDTDEntity');
|
27265 |
|
27266 | XMLDTDElement = require('./XMLDTDElement');
|
27267 |
|
27268 | XMLDTDNotation = require('./XMLDTDNotation');
|
27269 |
|
27270 | XMLAttribute = require('./XMLAttribute');
|
27271 |
|
27272 | XMLStringifier = require('./XMLStringifier');
|
27273 |
|
27274 | XMLStringWriter = require('./XMLStringWriter');
|
27275 |
|
27276 | WriterState = require('./WriterState');
|
27277 |
|
27278 | module.exports = XMLDocumentCB = function () {
|
27279 | function XMLDocumentCB(options, onData, onEnd) {
|
27280 | var writerOptions;
|
27281 | this.name = "?xml";
|
27282 | this.type = NodeType.Document;
|
27283 | options || (options = {});
|
27284 | writerOptions = {};
|
27285 | if (!options.writer) {
|
27286 | options.writer = new XMLStringWriter();
|
27287 | } else if (isPlainObject(options.writer)) {
|
27288 | writerOptions = options.writer;
|
27289 | options.writer = new XMLStringWriter();
|
27290 | }
|
27291 | this.options = options;
|
27292 | this.writer = options.writer;
|
27293 | this.writerOptions = this.writer.filterOptions(writerOptions);
|
27294 | this.stringify = new XMLStringifier(options);
|
27295 | this.onDataCallback = onData || function () {};
|
27296 | this.onEndCallback = onEnd || function () {};
|
27297 | this.currentNode = null;
|
27298 | this.currentLevel = -1;
|
27299 | this.openTags = {};
|
27300 | this.documentStarted = false;
|
27301 | this.documentCompleted = false;
|
27302 | this.root = null;
|
27303 | }
|
27304 |
|
27305 | XMLDocumentCB.prototype.createChildNode = function (node) {
|
27306 | var att, attName, attributes, child, i, len, ref1, ref2;
|
27307 | switch (node.type) {
|
27308 | case NodeType.CData:
|
27309 | this.cdata(node.value);
|
27310 | break;
|
27311 | case NodeType.Comment:
|
27312 | this.comment(node.value);
|
27313 | break;
|
27314 | case NodeType.Element:
|
27315 | attributes = {};
|
27316 | ref1 = node.attribs;
|
27317 | for (attName in ref1) {
|
27318 | if (!hasProp.call(ref1, attName)) continue;
|
27319 | att = ref1[attName];
|
27320 | attributes[attName] = att.value;
|
27321 | }
|
27322 | this.node(node.name, attributes);
|
27323 | break;
|
27324 | case NodeType.Dummy:
|
27325 | this.dummy();
|
27326 | break;
|
27327 | case NodeType.Raw:
|
27328 | this.raw(node.value);
|
27329 | break;
|
27330 | case NodeType.Text:
|
27331 | this.text(node.value);
|
27332 | break;
|
27333 | case NodeType.ProcessingInstruction:
|
27334 | this.instruction(node.target, node.value);
|
27335 | break;
|
27336 | default:
|
27337 | throw new Error("This XML node type is not supported in a JS object: " + node.constructor.name);
|
27338 | }
|
27339 | ref2 = node.children;
|
27340 | for (i = 0, len = ref2.length; i < len; i++) {
|
27341 | child = ref2[i];
|
27342 | this.createChildNode(child);
|
27343 | if (child.type === NodeType.Element) {
|
27344 | this.up();
|
27345 | }
|
27346 | }
|
27347 | return this;
|
27348 | };
|
27349 |
|
27350 | XMLDocumentCB.prototype.dummy = function () {
|
27351 | return this;
|
27352 | };
|
27353 |
|
27354 | XMLDocumentCB.prototype.node = function (name, attributes, text) {
|
27355 | var ref1;
|
27356 | if (name == null) {
|
27357 | throw new Error("Missing node name.");
|
27358 | }
|
27359 | if (this.root && this.currentLevel === -1) {
|
27360 | throw new Error("Document can only have one root node. " + this.debugInfo(name));
|
27361 | }
|
27362 | this.openCurrent();
|
27363 | name = getValue(name);
|
27364 | if (attributes == null) {
|
27365 | attributes = {};
|
27366 | }
|
27367 | attributes = getValue(attributes);
|
27368 | if (!isObject(attributes)) {
|
27369 | ref1 = [attributes, text], text = ref1[0], attributes = ref1[1];
|
27370 | }
|
27371 | this.currentNode = new XMLElement(this, name, attributes);
|
27372 | this.currentNode.children = false;
|
27373 | this.currentLevel++;
|
27374 | this.openTags[this.currentLevel] = this.currentNode;
|
27375 | if (text != null) {
|
27376 | this.text(text);
|
27377 | }
|
27378 | return this;
|
27379 | };
|
27380 |
|
27381 | XMLDocumentCB.prototype.element = function (name, attributes, text) {
|
27382 | var child, i, len, oldValidationFlag, ref1, root;
|
27383 | if (this.currentNode && this.currentNode.type === NodeType.DocType) {
|
27384 | this.dtdElement.apply(this, arguments);
|
27385 | } else {
|
27386 | if (Array.isArray(name) || isObject(name) || isFunction(name)) {
|
27387 | oldValidationFlag = this.options.noValidation;
|
27388 | this.options.noValidation = true;
|
27389 | root = new XMLDocument(this.options).element('TEMP_ROOT');
|
27390 | root.element(name);
|
27391 | this.options.noValidation = oldValidationFlag;
|
27392 | ref1 = root.children;
|
27393 | for (i = 0, len = ref1.length; i < len; i++) {
|
27394 | child = ref1[i];
|
27395 | this.createChildNode(child);
|
27396 | if (child.type === NodeType.Element) {
|
27397 | this.up();
|
27398 | }
|
27399 | }
|
27400 | } else {
|
27401 | this.node(name, attributes, text);
|
27402 | }
|
27403 | }
|
27404 | return this;
|
27405 | };
|
27406 |
|
27407 | XMLDocumentCB.prototype.attribute = function (name, value) {
|
27408 | var attName, attValue;
|
27409 | if (!this.currentNode || this.currentNode.children) {
|
27410 | throw new Error("att() can only be used immediately after an ele() call in callback mode. " + this.debugInfo(name));
|
27411 | }
|
27412 | if (name != null) {
|
27413 | name = getValue(name);
|
27414 | }
|
27415 | if (isObject(name)) {
|
27416 | for (attName in name) {
|
27417 | if (!hasProp.call(name, attName)) continue;
|
27418 | attValue = name[attName];
|
27419 | this.attribute(attName, attValue);
|
27420 | }
|
27421 | } else {
|
27422 | if (isFunction(value)) {
|
27423 | value = value.apply();
|
27424 | }
|
27425 | if (this.options.keepNullAttributes && value == null) {
|
27426 | this.currentNode.attribs[name] = new XMLAttribute(this, name, "");
|
27427 | } else if (value != null) {
|
27428 | this.currentNode.attribs[name] = new XMLAttribute(this, name, value);
|
27429 | }
|
27430 | }
|
27431 | return this;
|
27432 | };
|
27433 |
|
27434 | XMLDocumentCB.prototype.text = function (value) {
|
27435 | var node;
|
27436 | this.openCurrent();
|
27437 | node = new XMLText(this, value);
|
27438 | this.onData(this.writer.text(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1);
|
27439 | return this;
|
27440 | };
|
27441 |
|
27442 | XMLDocumentCB.prototype.cdata = function (value) {
|
27443 | var node;
|
27444 | this.openCurrent();
|
27445 | node = new XMLCData(this, value);
|
27446 | this.onData(this.writer.cdata(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1);
|
27447 | return this;
|
27448 | };
|
27449 |
|
27450 | XMLDocumentCB.prototype.comment = function (value) {
|
27451 | var node;
|
27452 | this.openCurrent();
|
27453 | node = new XMLComment(this, value);
|
27454 | this.onData(this.writer.comment(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1);
|
27455 | return this;
|
27456 | };
|
27457 |
|
27458 | XMLDocumentCB.prototype.raw = function (value) {
|
27459 | var node;
|
27460 | this.openCurrent();
|
27461 | node = new XMLRaw(this, value);
|
27462 | this.onData(this.writer.raw(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1);
|
27463 | return this;
|
27464 | };
|
27465 |
|
27466 | XMLDocumentCB.prototype.instruction = function (target, value) {
|
27467 | var i, insTarget, insValue, len, node;
|
27468 | this.openCurrent();
|
27469 | if (target != null) {
|
27470 | target = getValue(target);
|
27471 | }
|
27472 | if (value != null) {
|
27473 | value = getValue(value);
|
27474 | }
|
27475 | if (Array.isArray(target)) {
|
27476 | for (i = 0, len = target.length; i < len; i++) {
|
27477 | insTarget = target[i];
|
27478 | this.instruction(insTarget);
|
27479 | }
|
27480 | } else if (isObject(target)) {
|
27481 | for (insTarget in target) {
|
27482 | if (!hasProp.call(target, insTarget)) continue;
|
27483 | insValue = target[insTarget];
|
27484 | this.instruction(insTarget, insValue);
|
27485 | }
|
27486 | } else {
|
27487 | if (isFunction(value)) {
|
27488 | value = value.apply();
|
27489 | }
|
27490 | node = new XMLProcessingInstruction(this, target, value);
|
27491 | this.onData(this.writer.processingInstruction(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1);
|
27492 | }
|
27493 | return this;
|
27494 | };
|
27495 |
|
27496 | XMLDocumentCB.prototype.declaration = function (version, encoding, standalone) {
|
27497 | var node;
|
27498 | this.openCurrent();
|
27499 | if (this.documentStarted) {
|
27500 | throw new Error("declaration() must be the first node.");
|
27501 | }
|
27502 | node = new XMLDeclaration(this, version, encoding, standalone);
|
27503 | this.onData(this.writer.declaration(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1);
|
27504 | return this;
|
27505 | };
|
27506 |
|
27507 | XMLDocumentCB.prototype.doctype = function (root, pubID, sysID) {
|
27508 | this.openCurrent();
|
27509 | if (root == null) {
|
27510 | throw new Error("Missing root node name.");
|
27511 | }
|
27512 | if (this.root) {
|
27513 | throw new Error("dtd() must come before the root node.");
|
27514 | }
|
27515 | this.currentNode = new XMLDocType(this, pubID, sysID);
|
27516 | this.currentNode.rootNodeName = root;
|
27517 | this.currentNode.children = false;
|
27518 | this.currentLevel++;
|
27519 | this.openTags[this.currentLevel] = this.currentNode;
|
27520 | return this;
|
27521 | };
|
27522 |
|
27523 | XMLDocumentCB.prototype.dtdElement = function (name, value) {
|
27524 | var node;
|
27525 | this.openCurrent();
|
27526 | node = new XMLDTDElement(this, name, value);
|
27527 | this.onData(this.writer.dtdElement(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1);
|
27528 | return this;
|
27529 | };
|
27530 |
|
27531 | XMLDocumentCB.prototype.attList = function (elementName, attributeName, attributeType, defaultValueType, defaultValue) {
|
27532 | var node;
|
27533 | this.openCurrent();
|
27534 | node = new XMLDTDAttList(this, elementName, attributeName, attributeType, defaultValueType, defaultValue);
|
27535 | this.onData(this.writer.dtdAttList(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1);
|
27536 | return this;
|
27537 | };
|
27538 |
|
27539 | XMLDocumentCB.prototype.entity = function (name, value) {
|
27540 | var node;
|
27541 | this.openCurrent();
|
27542 | node = new XMLDTDEntity(this, false, name, value);
|
27543 | this.onData(this.writer.dtdEntity(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1);
|
27544 | return this;
|
27545 | };
|
27546 |
|
27547 | XMLDocumentCB.prototype.pEntity = function (name, value) {
|
27548 | var node;
|
27549 | this.openCurrent();
|
27550 | node = new XMLDTDEntity(this, true, name, value);
|
27551 | this.onData(this.writer.dtdEntity(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1);
|
27552 | return this;
|
27553 | };
|
27554 |
|
27555 | XMLDocumentCB.prototype.notation = function (name, value) {
|
27556 | var node;
|
27557 | this.openCurrent();
|
27558 | node = new XMLDTDNotation(this, name, value);
|
27559 | this.onData(this.writer.dtdNotation(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1);
|
27560 | return this;
|
27561 | };
|
27562 |
|
27563 | XMLDocumentCB.prototype.up = function () {
|
27564 | if (this.currentLevel < 0) {
|
27565 | throw new Error("The document node has no parent.");
|
27566 | }
|
27567 | if (this.currentNode) {
|
27568 | if (this.currentNode.children) {
|
27569 | this.closeNode(this.currentNode);
|
27570 | } else {
|
27571 | this.openNode(this.currentNode);
|
27572 | }
|
27573 | this.currentNode = null;
|
27574 | } else {
|
27575 | this.closeNode(this.openTags[this.currentLevel]);
|
27576 | }
|
27577 | delete this.openTags[this.currentLevel];
|
27578 | this.currentLevel--;
|
27579 | return this;
|
27580 | };
|
27581 |
|
27582 | XMLDocumentCB.prototype.end = function () {
|
27583 | while (this.currentLevel >= 0) {
|
27584 | this.up();
|
27585 | }
|
27586 | return this.onEnd();
|
27587 | };
|
27588 |
|
27589 | XMLDocumentCB.prototype.openCurrent = function () {
|
27590 | if (this.currentNode) {
|
27591 | this.currentNode.children = true;
|
27592 | return this.openNode(this.currentNode);
|
27593 | }
|
27594 | };
|
27595 |
|
27596 | XMLDocumentCB.prototype.openNode = function (node) {
|
27597 | var att, chunk, name, ref1;
|
27598 | if (!node.isOpen) {
|
27599 | if (!this.root && this.currentLevel === 0 && node.type === NodeType.Element) {
|
27600 | this.root = node;
|
27601 | }
|
27602 | chunk = '';
|
27603 | if (node.type === NodeType.Element) {
|
27604 | this.writerOptions.state = WriterState.OpenTag;
|
27605 | chunk = this.writer.indent(node, this.writerOptions, this.currentLevel) + '<' + node.name;
|
27606 | ref1 = node.attribs;
|
27607 | for (name in ref1) {
|
27608 | if (!hasProp.call(ref1, name)) continue;
|
27609 | att = ref1[name];
|
27610 | chunk += this.writer.attribute(att, this.writerOptions, this.currentLevel);
|
27611 | }
|
27612 | chunk += (node.children ? '>' : '/>') + this.writer.endline(node, this.writerOptions, this.currentLevel);
|
27613 | this.writerOptions.state = WriterState.InsideTag;
|
27614 | } else {
|
27615 | this.writerOptions.state = WriterState.OpenTag;
|
27616 | chunk = this.writer.indent(node, this.writerOptions, this.currentLevel) + '<!DOCTYPE ' + node.rootNodeName;
|
27617 | if (node.pubID && node.sysID) {
|
27618 | chunk += ' PUBLIC "' + node.pubID + '" "' + node.sysID + '"';
|
27619 | } else if (node.sysID) {
|
27620 | chunk += ' SYSTEM "' + node.sysID + '"';
|
27621 | }
|
27622 | if (node.children) {
|
27623 | chunk += ' [';
|
27624 | this.writerOptions.state = WriterState.InsideTag;
|
27625 | } else {
|
27626 | this.writerOptions.state = WriterState.CloseTag;
|
27627 | chunk += '>';
|
27628 | }
|
27629 | chunk += this.writer.endline(node, this.writerOptions, this.currentLevel);
|
27630 | }
|
27631 | this.onData(chunk, this.currentLevel);
|
27632 | return node.isOpen = true;
|
27633 | }
|
27634 | };
|
27635 |
|
27636 | XMLDocumentCB.prototype.closeNode = function (node) {
|
27637 | var chunk;
|
27638 | if (!node.isClosed) {
|
27639 | chunk = '';
|
27640 | this.writerOptions.state = WriterState.CloseTag;
|
27641 | if (node.type === NodeType.Element) {
|
27642 | chunk = this.writer.indent(node, this.writerOptions, this.currentLevel) + '</' + node.name + '>' + this.writer.endline(node, this.writerOptions, this.currentLevel);
|
27643 | } else {
|
27644 | chunk = this.writer.indent(node, this.writerOptions, this.currentLevel) + ']>' + this.writer.endline(node, this.writerOptions, this.currentLevel);
|
27645 | }
|
27646 | this.writerOptions.state = WriterState.None;
|
27647 | this.onData(chunk, this.currentLevel);
|
27648 | return node.isClosed = true;
|
27649 | }
|
27650 | };
|
27651 |
|
27652 | XMLDocumentCB.prototype.onData = function (chunk, level) {
|
27653 | this.documentStarted = true;
|
27654 | return this.onDataCallback(chunk, level + 1);
|
27655 | };
|
27656 |
|
27657 | XMLDocumentCB.prototype.onEnd = function () {
|
27658 | this.documentCompleted = true;
|
27659 | return this.onEndCallback();
|
27660 | };
|
27661 |
|
27662 | XMLDocumentCB.prototype.debugInfo = function (name) {
|
27663 | if (name == null) {
|
27664 | return "";
|
27665 | } else {
|
27666 | return "node: <" + name + ">";
|
27667 | }
|
27668 | };
|
27669 |
|
27670 | XMLDocumentCB.prototype.ele = function () {
|
27671 | return this.element.apply(this, arguments);
|
27672 | };
|
27673 |
|
27674 | XMLDocumentCB.prototype.nod = function (name, attributes, text) {
|
27675 | return this.node(name, attributes, text);
|
27676 | };
|
27677 |
|
27678 | XMLDocumentCB.prototype.txt = function (value) {
|
27679 | return this.text(value);
|
27680 | };
|
27681 |
|
27682 | XMLDocumentCB.prototype.dat = function (value) {
|
27683 | return this.cdata(value);
|
27684 | };
|
27685 |
|
27686 | XMLDocumentCB.prototype.com = function (value) {
|
27687 | return this.comment(value);
|
27688 | };
|
27689 |
|
27690 | XMLDocumentCB.prototype.ins = function (target, value) {
|
27691 | return this.instruction(target, value);
|
27692 | };
|
27693 |
|
27694 | XMLDocumentCB.prototype.dec = function (version, encoding, standalone) {
|
27695 | return this.declaration(version, encoding, standalone);
|
27696 | };
|
27697 |
|
27698 | XMLDocumentCB.prototype.dtd = function (root, pubID, sysID) {
|
27699 | return this.doctype(root, pubID, sysID);
|
27700 | };
|
27701 |
|
27702 | XMLDocumentCB.prototype.e = function (name, attributes, text) {
|
27703 | return this.element(name, attributes, text);
|
27704 | };
|
27705 |
|
27706 | XMLDocumentCB.prototype.n = function (name, attributes, text) {
|
27707 | return this.node(name, attributes, text);
|
27708 | };
|
27709 |
|
27710 | XMLDocumentCB.prototype.t = function (value) {
|
27711 | return this.text(value);
|
27712 | };
|
27713 |
|
27714 | XMLDocumentCB.prototype.d = function (value) {
|
27715 | return this.cdata(value);
|
27716 | };
|
27717 |
|
27718 | XMLDocumentCB.prototype.c = function (value) {
|
27719 | return this.comment(value);
|
27720 | };
|
27721 |
|
27722 | XMLDocumentCB.prototype.r = function (value) {
|
27723 | return this.raw(value);
|
27724 | };
|
27725 |
|
27726 | XMLDocumentCB.prototype.i = function (target, value) {
|
27727 | return this.instruction(target, value);
|
27728 | };
|
27729 |
|
27730 | XMLDocumentCB.prototype.att = function () {
|
27731 | if (this.currentNode && this.currentNode.type === NodeType.DocType) {
|
27732 | return this.attList.apply(this, arguments);
|
27733 | } else {
|
27734 | return this.attribute.apply(this, arguments);
|
27735 | }
|
27736 | };
|
27737 |
|
27738 | XMLDocumentCB.prototype.a = function () {
|
27739 | if (this.currentNode && this.currentNode.type === NodeType.DocType) {
|
27740 | return this.attList.apply(this, arguments);
|
27741 | } else {
|
27742 | return this.attribute.apply(this, arguments);
|
27743 | }
|
27744 | };
|
27745 |
|
27746 | XMLDocumentCB.prototype.ent = function (name, value) {
|
27747 | return this.entity(name, value);
|
27748 | };
|
27749 |
|
27750 | XMLDocumentCB.prototype.pent = function (name, value) {
|
27751 | return this.pEntity(name, value);
|
27752 | };
|
27753 |
|
27754 | XMLDocumentCB.prototype.not = function (name, value) {
|
27755 | return this.notation(name, value);
|
27756 | };
|
27757 |
|
27758 | return XMLDocumentCB;
|
27759 | }();
|
27760 | }).call(undefined);
|
27761 |
|
27762 | },{"./NodeType":295,"./Utility":296,"./WriterState":297,"./XMLAttribute":298,"./XMLCData":299,"./XMLComment":301,"./XMLDTDAttList":306,"./XMLDTDElement":307,"./XMLDTDEntity":308,"./XMLDTDNotation":309,"./XMLDeclaration":310,"./XMLDocType":311,"./XMLDocument":312,"./XMLElement":315,"./XMLProcessingInstruction":319,"./XMLRaw":320,"./XMLStringWriter":322,"./XMLStringifier":323,"./XMLText":324}],314:[function(require,module,exports){
|
27763 | 'use strict';
|
27764 |
|
27765 | var _create = require('babel-runtime/core-js/object/create');
|
27766 |
|
27767 | var _create2 = _interopRequireDefault(_create);
|
27768 |
|
27769 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
27770 |
|
27771 |
|
27772 | (function () {
|
27773 | var NodeType,
|
27774 | XMLDummy,
|
27775 | XMLNode,
|
27776 | extend = function extend(child, parent) {
|
27777 | for (var key in parent) {
|
27778 | if (hasProp.call(parent, key)) child[key] = parent[key];
|
27779 | }function ctor() {
|
27780 | this.constructor = child;
|
27781 | }ctor.prototype = parent.prototype;child.prototype = new ctor();child.__super__ = parent.prototype;return child;
|
27782 | },
|
27783 | hasProp = {}.hasOwnProperty;
|
27784 |
|
27785 | XMLNode = require('./XMLNode');
|
27786 |
|
27787 | NodeType = require('./NodeType');
|
27788 |
|
27789 | module.exports = XMLDummy = function (superClass) {
|
27790 | extend(XMLDummy, superClass);
|
27791 |
|
27792 | function XMLDummy(parent) {
|
27793 | XMLDummy.__super__.constructor.call(this, parent);
|
27794 | this.type = NodeType.Dummy;
|
27795 | }
|
27796 |
|
27797 | XMLDummy.prototype.clone = function () {
|
27798 | return (0, _create2.default)(this);
|
27799 | };
|
27800 |
|
27801 | XMLDummy.prototype.toString = function (options) {
|
27802 | return '';
|
27803 | };
|
27804 |
|
27805 | return XMLDummy;
|
27806 | }(XMLNode);
|
27807 | }).call(undefined);
|
27808 |
|
27809 | },{"./NodeType":295,"./XMLNode":317,"babel-runtime/core-js/object/create":50}],315:[function(require,module,exports){
|
27810 | 'use strict';
|
27811 |
|
27812 | var _create = require('babel-runtime/core-js/object/create');
|
27813 |
|
27814 | var _create2 = _interopRequireDefault(_create);
|
27815 |
|
27816 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
27817 |
|
27818 |
|
27819 | (function () {
|
27820 | var NodeType,
|
27821 | XMLAttribute,
|
27822 | XMLElement,
|
27823 | XMLNamedNodeMap,
|
27824 | XMLNode,
|
27825 | getValue,
|
27826 | isFunction,
|
27827 | isObject,
|
27828 | ref,
|
27829 | extend = function extend(child, parent) {
|
27830 | for (var key in parent) {
|
27831 | if (hasProp.call(parent, key)) child[key] = parent[key];
|
27832 | }function ctor() {
|
27833 | this.constructor = child;
|
27834 | }ctor.prototype = parent.prototype;child.prototype = new ctor();child.__super__ = parent.prototype;return child;
|
27835 | },
|
27836 | hasProp = {}.hasOwnProperty;
|
27837 |
|
27838 | ref = require('./Utility'), isObject = ref.isObject, isFunction = ref.isFunction, getValue = ref.getValue;
|
27839 |
|
27840 | XMLNode = require('./XMLNode');
|
27841 |
|
27842 | NodeType = require('./NodeType');
|
27843 |
|
27844 | XMLAttribute = require('./XMLAttribute');
|
27845 |
|
27846 | XMLNamedNodeMap = require('./XMLNamedNodeMap');
|
27847 |
|
27848 | module.exports = XMLElement = function (superClass) {
|
27849 | extend(XMLElement, superClass);
|
27850 |
|
27851 | function XMLElement(parent, name, attributes) {
|
27852 | var child, j, len, ref1;
|
27853 | XMLElement.__super__.constructor.call(this, parent);
|
27854 | if (name == null) {
|
27855 | throw new Error("Missing element name. " + this.debugInfo());
|
27856 | }
|
27857 | this.name = this.stringify.name(name);
|
27858 | this.type = NodeType.Element;
|
27859 | this.attribs = {};
|
27860 | this.schemaTypeInfo = null;
|
27861 | if (attributes != null) {
|
27862 | this.attribute(attributes);
|
27863 | }
|
27864 | if (parent.type === NodeType.Document) {
|
27865 | this.isRoot = true;
|
27866 | this.documentObject = parent;
|
27867 | parent.rootObject = this;
|
27868 | if (parent.children) {
|
27869 | ref1 = parent.children;
|
27870 | for (j = 0, len = ref1.length; j < len; j++) {
|
27871 | child = ref1[j];
|
27872 | if (child.type === NodeType.DocType) {
|
27873 | child.name = this.name;
|
27874 | break;
|
27875 | }
|
27876 | }
|
27877 | }
|
27878 | }
|
27879 | }
|
27880 |
|
27881 | Object.defineProperty(XMLElement.prototype, 'tagName', {
|
27882 | get: function get() {
|
27883 | return this.name;
|
27884 | }
|
27885 | });
|
27886 |
|
27887 | Object.defineProperty(XMLElement.prototype, 'namespaceURI', {
|
27888 | get: function get() {
|
27889 | return '';
|
27890 | }
|
27891 | });
|
27892 |
|
27893 | Object.defineProperty(XMLElement.prototype, 'prefix', {
|
27894 | get: function get() {
|
27895 | return '';
|
27896 | }
|
27897 | });
|
27898 |
|
27899 | Object.defineProperty(XMLElement.prototype, 'localName', {
|
27900 | get: function get() {
|
27901 | return this.name;
|
27902 | }
|
27903 | });
|
27904 |
|
27905 | Object.defineProperty(XMLElement.prototype, 'id', {
|
27906 | get: function get() {
|
27907 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
27908 | }
|
27909 | });
|
27910 |
|
27911 | Object.defineProperty(XMLElement.prototype, 'className', {
|
27912 | get: function get() {
|
27913 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
27914 | }
|
27915 | });
|
27916 |
|
27917 | Object.defineProperty(XMLElement.prototype, 'classList', {
|
27918 | get: function get() {
|
27919 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
27920 | }
|
27921 | });
|
27922 |
|
27923 | Object.defineProperty(XMLElement.prototype, 'attributes', {
|
27924 | get: function get() {
|
27925 | if (!this.attributeMap || !this.attributeMap.nodes) {
|
27926 | this.attributeMap = new XMLNamedNodeMap(this.attribs);
|
27927 | }
|
27928 | return this.attributeMap;
|
27929 | }
|
27930 | });
|
27931 |
|
27932 | XMLElement.prototype.clone = function () {
|
27933 | var att, attName, clonedSelf, ref1;
|
27934 | clonedSelf = (0, _create2.default)(this);
|
27935 | if (clonedSelf.isRoot) {
|
27936 | clonedSelf.documentObject = null;
|
27937 | }
|
27938 | clonedSelf.attribs = {};
|
27939 | ref1 = this.attribs;
|
27940 | for (attName in ref1) {
|
27941 | if (!hasProp.call(ref1, attName)) continue;
|
27942 | att = ref1[attName];
|
27943 | clonedSelf.attribs[attName] = att.clone();
|
27944 | }
|
27945 | clonedSelf.children = [];
|
27946 | this.children.forEach(function (child) {
|
27947 | var clonedChild;
|
27948 | clonedChild = child.clone();
|
27949 | clonedChild.parent = clonedSelf;
|
27950 | return clonedSelf.children.push(clonedChild);
|
27951 | });
|
27952 | return clonedSelf;
|
27953 | };
|
27954 |
|
27955 | XMLElement.prototype.attribute = function (name, value) {
|
27956 | var attName, attValue;
|
27957 | if (name != null) {
|
27958 | name = getValue(name);
|
27959 | }
|
27960 | if (isObject(name)) {
|
27961 | for (attName in name) {
|
27962 | if (!hasProp.call(name, attName)) continue;
|
27963 | attValue = name[attName];
|
27964 | this.attribute(attName, attValue);
|
27965 | }
|
27966 | } else {
|
27967 | if (isFunction(value)) {
|
27968 | value = value.apply();
|
27969 | }
|
27970 | if (this.options.keepNullAttributes && value == null) {
|
27971 | this.attribs[name] = new XMLAttribute(this, name, "");
|
27972 | } else if (value != null) {
|
27973 | this.attribs[name] = new XMLAttribute(this, name, value);
|
27974 | }
|
27975 | }
|
27976 | return this;
|
27977 | };
|
27978 |
|
27979 | XMLElement.prototype.removeAttribute = function (name) {
|
27980 | var attName, j, len;
|
27981 | if (name == null) {
|
27982 | throw new Error("Missing attribute name. " + this.debugInfo());
|
27983 | }
|
27984 | name = getValue(name);
|
27985 | if (Array.isArray(name)) {
|
27986 | for (j = 0, len = name.length; j < len; j++) {
|
27987 | attName = name[j];
|
27988 | delete this.attribs[attName];
|
27989 | }
|
27990 | } else {
|
27991 | delete this.attribs[name];
|
27992 | }
|
27993 | return this;
|
27994 | };
|
27995 |
|
27996 | XMLElement.prototype.toString = function (options) {
|
27997 | return this.options.writer.element(this, this.options.writer.filterOptions(options));
|
27998 | };
|
27999 |
|
28000 | XMLElement.prototype.att = function (name, value) {
|
28001 | return this.attribute(name, value);
|
28002 | };
|
28003 |
|
28004 | XMLElement.prototype.a = function (name, value) {
|
28005 | return this.attribute(name, value);
|
28006 | };
|
28007 |
|
28008 | XMLElement.prototype.getAttribute = function (name) {
|
28009 | if (this.attribs.hasOwnProperty(name)) {
|
28010 | return this.attribs[name].value;
|
28011 | } else {
|
28012 | return null;
|
28013 | }
|
28014 | };
|
28015 |
|
28016 | XMLElement.prototype.setAttribute = function (name, value) {
|
28017 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
28018 | };
|
28019 |
|
28020 | XMLElement.prototype.getAttributeNode = function (name) {
|
28021 | if (this.attribs.hasOwnProperty(name)) {
|
28022 | return this.attribs[name];
|
28023 | } else {
|
28024 | return null;
|
28025 | }
|
28026 | };
|
28027 |
|
28028 | XMLElement.prototype.setAttributeNode = function (newAttr) {
|
28029 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
28030 | };
|
28031 |
|
28032 | XMLElement.prototype.removeAttributeNode = function (oldAttr) {
|
28033 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
28034 | };
|
28035 |
|
28036 | XMLElement.prototype.getElementsByTagName = function (name) {
|
28037 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
28038 | };
|
28039 |
|
28040 | XMLElement.prototype.getAttributeNS = function (namespaceURI, localName) {
|
28041 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
28042 | };
|
28043 |
|
28044 | XMLElement.prototype.setAttributeNS = function (namespaceURI, qualifiedName, value) {
|
28045 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
28046 | };
|
28047 |
|
28048 | XMLElement.prototype.removeAttributeNS = function (namespaceURI, localName) {
|
28049 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
28050 | };
|
28051 |
|
28052 | XMLElement.prototype.getAttributeNodeNS = function (namespaceURI, localName) {
|
28053 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
28054 | };
|
28055 |
|
28056 | XMLElement.prototype.setAttributeNodeNS = function (newAttr) {
|
28057 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
28058 | };
|
28059 |
|
28060 | XMLElement.prototype.getElementsByTagNameNS = function (namespaceURI, localName) {
|
28061 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
28062 | };
|
28063 |
|
28064 | XMLElement.prototype.hasAttribute = function (name) {
|
28065 | return this.attribs.hasOwnProperty(name);
|
28066 | };
|
28067 |
|
28068 | XMLElement.prototype.hasAttributeNS = function (namespaceURI, localName) {
|
28069 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
28070 | };
|
28071 |
|
28072 | XMLElement.prototype.setIdAttribute = function (name, isId) {
|
28073 | if (this.attribs.hasOwnProperty(name)) {
|
28074 | return this.attribs[name].isId;
|
28075 | } else {
|
28076 | return isId;
|
28077 | }
|
28078 | };
|
28079 |
|
28080 | XMLElement.prototype.setIdAttributeNS = function (namespaceURI, localName, isId) {
|
28081 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
28082 | };
|
28083 |
|
28084 | XMLElement.prototype.setIdAttributeNode = function (idAttr, isId) {
|
28085 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
28086 | };
|
28087 |
|
28088 | XMLElement.prototype.getElementsByTagName = function (tagname) {
|
28089 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
28090 | };
|
28091 |
|
28092 | XMLElement.prototype.getElementsByTagNameNS = function (namespaceURI, localName) {
|
28093 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
28094 | };
|
28095 |
|
28096 | XMLElement.prototype.getElementsByClassName = function (classNames) {
|
28097 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
28098 | };
|
28099 |
|
28100 | XMLElement.prototype.isEqualNode = function (node) {
|
28101 | var i, j, ref1;
|
28102 | if (!XMLElement.__super__.isEqualNode.apply(this, arguments).isEqualNode(node)) {
|
28103 | return false;
|
28104 | }
|
28105 | if (node.namespaceURI !== this.namespaceURI) {
|
28106 | return false;
|
28107 | }
|
28108 | if (node.prefix !== this.prefix) {
|
28109 | return false;
|
28110 | }
|
28111 | if (node.localName !== this.localName) {
|
28112 | return false;
|
28113 | }
|
28114 | if (node.attribs.length !== this.attribs.length) {
|
28115 | return false;
|
28116 | }
|
28117 | for (i = j = 0, ref1 = this.attribs.length - 1; 0 <= ref1 ? j <= ref1 : j >= ref1; i = 0 <= ref1 ? ++j : --j) {
|
28118 | if (!this.attribs[i].isEqualNode(node.attribs[i])) {
|
28119 | return false;
|
28120 | }
|
28121 | }
|
28122 | return true;
|
28123 | };
|
28124 |
|
28125 | return XMLElement;
|
28126 | }(XMLNode);
|
28127 | }).call(undefined);
|
28128 |
|
28129 | },{"./NodeType":295,"./Utility":296,"./XMLAttribute":298,"./XMLNamedNodeMap":316,"./XMLNode":317,"babel-runtime/core-js/object/create":50}],316:[function(require,module,exports){
|
28130 | "use strict";
|
28131 |
|
28132 | var _keys = require("babel-runtime/core-js/object/keys");
|
28133 |
|
28134 | var _keys2 = _interopRequireDefault(_keys);
|
28135 |
|
28136 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
28137 |
|
28138 |
|
28139 | (function () {
|
28140 | var XMLNamedNodeMap;
|
28141 |
|
28142 | module.exports = XMLNamedNodeMap = function () {
|
28143 | function XMLNamedNodeMap(nodes) {
|
28144 | this.nodes = nodes;
|
28145 | }
|
28146 |
|
28147 | Object.defineProperty(XMLNamedNodeMap.prototype, 'length', {
|
28148 | get: function get() {
|
28149 | return (0, _keys2.default)(this.nodes).length || 0;
|
28150 | }
|
28151 | });
|
28152 |
|
28153 | XMLNamedNodeMap.prototype.clone = function () {
|
28154 | return this.nodes = null;
|
28155 | };
|
28156 |
|
28157 | XMLNamedNodeMap.prototype.getNamedItem = function (name) {
|
28158 | return this.nodes[name];
|
28159 | };
|
28160 |
|
28161 | XMLNamedNodeMap.prototype.setNamedItem = function (node) {
|
28162 | var oldNode;
|
28163 | oldNode = this.nodes[node.nodeName];
|
28164 | this.nodes[node.nodeName] = node;
|
28165 | return oldNode || null;
|
28166 | };
|
28167 |
|
28168 | XMLNamedNodeMap.prototype.removeNamedItem = function (name) {
|
28169 | var oldNode;
|
28170 | oldNode = this.nodes[name];
|
28171 | delete this.nodes[name];
|
28172 | return oldNode || null;
|
28173 | };
|
28174 |
|
28175 | XMLNamedNodeMap.prototype.item = function (index) {
|
28176 | return this.nodes[(0, _keys2.default)(this.nodes)[index]] || null;
|
28177 | };
|
28178 |
|
28179 | XMLNamedNodeMap.prototype.getNamedItemNS = function (namespaceURI, localName) {
|
28180 | throw new Error("This DOM method is not implemented.");
|
28181 | };
|
28182 |
|
28183 | XMLNamedNodeMap.prototype.setNamedItemNS = function (node) {
|
28184 | throw new Error("This DOM method is not implemented.");
|
28185 | };
|
28186 |
|
28187 | XMLNamedNodeMap.prototype.removeNamedItemNS = function (namespaceURI, localName) {
|
28188 | throw new Error("This DOM method is not implemented.");
|
28189 | };
|
28190 |
|
28191 | return XMLNamedNodeMap;
|
28192 | }();
|
28193 | }).call(undefined);
|
28194 |
|
28195 | },{"babel-runtime/core-js/object/keys":55}],317:[function(require,module,exports){
|
28196 | 'use strict';
|
28197 |
|
28198 |
|
28199 | (function () {
|
28200 | var DocumentPosition,
|
28201 | NodeType,
|
28202 | XMLCData,
|
28203 | XMLComment,
|
28204 | XMLDeclaration,
|
28205 | XMLDocType,
|
28206 | XMLDummy,
|
28207 | XMLElement,
|
28208 | XMLNamedNodeMap,
|
28209 | XMLNode,
|
28210 | XMLNodeList,
|
28211 | XMLProcessingInstruction,
|
28212 | XMLRaw,
|
28213 | XMLText,
|
28214 | getValue,
|
28215 | isEmpty,
|
28216 | isFunction,
|
28217 | isObject,
|
28218 | ref1,
|
28219 | hasProp = {}.hasOwnProperty;
|
28220 |
|
28221 | ref1 = require('./Utility'), isObject = ref1.isObject, isFunction = ref1.isFunction, isEmpty = ref1.isEmpty, getValue = ref1.getValue;
|
28222 |
|
28223 | XMLElement = null;
|
28224 |
|
28225 | XMLCData = null;
|
28226 |
|
28227 | XMLComment = null;
|
28228 |
|
28229 | XMLDeclaration = null;
|
28230 |
|
28231 | XMLDocType = null;
|
28232 |
|
28233 | XMLRaw = null;
|
28234 |
|
28235 | XMLText = null;
|
28236 |
|
28237 | XMLProcessingInstruction = null;
|
28238 |
|
28239 | XMLDummy = null;
|
28240 |
|
28241 | NodeType = null;
|
28242 |
|
28243 | XMLNodeList = null;
|
28244 |
|
28245 | XMLNamedNodeMap = null;
|
28246 |
|
28247 | DocumentPosition = null;
|
28248 |
|
28249 | module.exports = XMLNode = function () {
|
28250 | function XMLNode(parent1) {
|
28251 | this.parent = parent1;
|
28252 | if (this.parent) {
|
28253 | this.options = this.parent.options;
|
28254 | this.stringify = this.parent.stringify;
|
28255 | }
|
28256 | this.value = null;
|
28257 | this.children = [];
|
28258 | this.baseURI = null;
|
28259 | if (!XMLElement) {
|
28260 | XMLElement = require('./XMLElement');
|
28261 | XMLCData = require('./XMLCData');
|
28262 | XMLComment = require('./XMLComment');
|
28263 | XMLDeclaration = require('./XMLDeclaration');
|
28264 | XMLDocType = require('./XMLDocType');
|
28265 | XMLRaw = require('./XMLRaw');
|
28266 | XMLText = require('./XMLText');
|
28267 | XMLProcessingInstruction = require('./XMLProcessingInstruction');
|
28268 | XMLDummy = require('./XMLDummy');
|
28269 | NodeType = require('./NodeType');
|
28270 | XMLNodeList = require('./XMLNodeList');
|
28271 | XMLNamedNodeMap = require('./XMLNamedNodeMap');
|
28272 | DocumentPosition = require('./DocumentPosition');
|
28273 | }
|
28274 | }
|
28275 |
|
28276 | Object.defineProperty(XMLNode.prototype, 'nodeName', {
|
28277 | get: function get() {
|
28278 | return this.name;
|
28279 | }
|
28280 | });
|
28281 |
|
28282 | Object.defineProperty(XMLNode.prototype, 'nodeType', {
|
28283 | get: function get() {
|
28284 | return this.type;
|
28285 | }
|
28286 | });
|
28287 |
|
28288 | Object.defineProperty(XMLNode.prototype, 'nodeValue', {
|
28289 | get: function get() {
|
28290 | return this.value;
|
28291 | }
|
28292 | });
|
28293 |
|
28294 | Object.defineProperty(XMLNode.prototype, 'parentNode', {
|
28295 | get: function get() {
|
28296 | return this.parent;
|
28297 | }
|
28298 | });
|
28299 |
|
28300 | Object.defineProperty(XMLNode.prototype, 'childNodes', {
|
28301 | get: function get() {
|
28302 | if (!this.childNodeList || !this.childNodeList.nodes) {
|
28303 | this.childNodeList = new XMLNodeList(this.children);
|
28304 | }
|
28305 | return this.childNodeList;
|
28306 | }
|
28307 | });
|
28308 |
|
28309 | Object.defineProperty(XMLNode.prototype, 'firstChild', {
|
28310 | get: function get() {
|
28311 | return this.children[0] || null;
|
28312 | }
|
28313 | });
|
28314 |
|
28315 | Object.defineProperty(XMLNode.prototype, 'lastChild', {
|
28316 | get: function get() {
|
28317 | return this.children[this.children.length - 1] || null;
|
28318 | }
|
28319 | });
|
28320 |
|
28321 | Object.defineProperty(XMLNode.prototype, 'previousSibling', {
|
28322 | get: function get() {
|
28323 | var i;
|
28324 | i = this.parent.children.indexOf(this);
|
28325 | return this.parent.children[i - 1] || null;
|
28326 | }
|
28327 | });
|
28328 |
|
28329 | Object.defineProperty(XMLNode.prototype, 'nextSibling', {
|
28330 | get: function get() {
|
28331 | var i;
|
28332 | i = this.parent.children.indexOf(this);
|
28333 | return this.parent.children[i + 1] || null;
|
28334 | }
|
28335 | });
|
28336 |
|
28337 | Object.defineProperty(XMLNode.prototype, 'ownerDocument', {
|
28338 | get: function get() {
|
28339 | return this.document() || null;
|
28340 | }
|
28341 | });
|
28342 |
|
28343 | Object.defineProperty(XMLNode.prototype, 'textContent', {
|
28344 | get: function get() {
|
28345 | var child, j, len, ref2, str;
|
28346 | if (this.nodeType === NodeType.Element || this.nodeType === NodeType.DocumentFragment) {
|
28347 | str = '';
|
28348 | ref2 = this.children;
|
28349 | for (j = 0, len = ref2.length; j < len; j++) {
|
28350 | child = ref2[j];
|
28351 | if (child.textContent) {
|
28352 | str += child.textContent;
|
28353 | }
|
28354 | }
|
28355 | return str;
|
28356 | } else {
|
28357 | return null;
|
28358 | }
|
28359 | },
|
28360 | set: function set(value) {
|
28361 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
28362 | }
|
28363 | });
|
28364 |
|
28365 | XMLNode.prototype.setParent = function (parent) {
|
28366 | var child, j, len, ref2, results;
|
28367 | this.parent = parent;
|
28368 | if (parent) {
|
28369 | this.options = parent.options;
|
28370 | this.stringify = parent.stringify;
|
28371 | }
|
28372 | ref2 = this.children;
|
28373 | results = [];
|
28374 | for (j = 0, len = ref2.length; j < len; j++) {
|
28375 | child = ref2[j];
|
28376 | results.push(child.setParent(this));
|
28377 | }
|
28378 | return results;
|
28379 | };
|
28380 |
|
28381 | XMLNode.prototype.element = function (name, attributes, text) {
|
28382 | var childNode, item, j, k, key, lastChild, len, len1, ref2, ref3, val;
|
28383 | lastChild = null;
|
28384 | if (attributes === null && text == null) {
|
28385 | ref2 = [{}, null], attributes = ref2[0], text = ref2[1];
|
28386 | }
|
28387 | if (attributes == null) {
|
28388 | attributes = {};
|
28389 | }
|
28390 | attributes = getValue(attributes);
|
28391 | if (!isObject(attributes)) {
|
28392 | ref3 = [attributes, text], text = ref3[0], attributes = ref3[1];
|
28393 | }
|
28394 | if (name != null) {
|
28395 | name = getValue(name);
|
28396 | }
|
28397 | if (Array.isArray(name)) {
|
28398 | for (j = 0, len = name.length; j < len; j++) {
|
28399 | item = name[j];
|
28400 | lastChild = this.element(item);
|
28401 | }
|
28402 | } else if (isFunction(name)) {
|
28403 | lastChild = this.element(name.apply());
|
28404 | } else if (isObject(name)) {
|
28405 | for (key in name) {
|
28406 | if (!hasProp.call(name, key)) continue;
|
28407 | val = name[key];
|
28408 | if (isFunction(val)) {
|
28409 | val = val.apply();
|
28410 | }
|
28411 | if (!this.options.ignoreDecorators && this.stringify.convertAttKey && key.indexOf(this.stringify.convertAttKey) === 0) {
|
28412 | lastChild = this.attribute(key.substr(this.stringify.convertAttKey.length), val);
|
28413 | } else if (!this.options.separateArrayItems && Array.isArray(val) && isEmpty(val)) {
|
28414 | lastChild = this.dummy();
|
28415 | } else if (isObject(val) && isEmpty(val)) {
|
28416 | lastChild = this.element(key);
|
28417 | } else if (!this.options.keepNullNodes && val == null) {
|
28418 | lastChild = this.dummy();
|
28419 | } else if (!this.options.separateArrayItems && Array.isArray(val)) {
|
28420 | for (k = 0, len1 = val.length; k < len1; k++) {
|
28421 | item = val[k];
|
28422 | childNode = {};
|
28423 | childNode[key] = item;
|
28424 | lastChild = this.element(childNode);
|
28425 | }
|
28426 | } else if (isObject(val)) {
|
28427 | if (!this.options.ignoreDecorators && this.stringify.convertTextKey && key.indexOf(this.stringify.convertTextKey) === 0) {
|
28428 | lastChild = this.element(val);
|
28429 | } else {
|
28430 | lastChild = this.element(key);
|
28431 | lastChild.element(val);
|
28432 | }
|
28433 | } else {
|
28434 | lastChild = this.element(key, val);
|
28435 | }
|
28436 | }
|
28437 | } else if (!this.options.keepNullNodes && text === null) {
|
28438 | lastChild = this.dummy();
|
28439 | } else {
|
28440 | if (!this.options.ignoreDecorators && this.stringify.convertTextKey && name.indexOf(this.stringify.convertTextKey) === 0) {
|
28441 | lastChild = this.text(text);
|
28442 | } else if (!this.options.ignoreDecorators && this.stringify.convertCDataKey && name.indexOf(this.stringify.convertCDataKey) === 0) {
|
28443 | lastChild = this.cdata(text);
|
28444 | } else if (!this.options.ignoreDecorators && this.stringify.convertCommentKey && name.indexOf(this.stringify.convertCommentKey) === 0) {
|
28445 | lastChild = this.comment(text);
|
28446 | } else if (!this.options.ignoreDecorators && this.stringify.convertRawKey && name.indexOf(this.stringify.convertRawKey) === 0) {
|
28447 | lastChild = this.raw(text);
|
28448 | } else if (!this.options.ignoreDecorators && this.stringify.convertPIKey && name.indexOf(this.stringify.convertPIKey) === 0) {
|
28449 | lastChild = this.instruction(name.substr(this.stringify.convertPIKey.length), text);
|
28450 | } else {
|
28451 | lastChild = this.node(name, attributes, text);
|
28452 | }
|
28453 | }
|
28454 | if (lastChild == null) {
|
28455 | throw new Error("Could not create any elements with: " + name + ". " + this.debugInfo());
|
28456 | }
|
28457 | return lastChild;
|
28458 | };
|
28459 |
|
28460 | XMLNode.prototype.insertBefore = function (name, attributes, text) {
|
28461 | var child, i, newChild, refChild, removed;
|
28462 | if (name != null ? name.type : void 0) {
|
28463 | newChild = name;
|
28464 | refChild = attributes;
|
28465 | newChild.setParent(this);
|
28466 | if (refChild) {
|
28467 | i = children.indexOf(refChild);
|
28468 | removed = children.splice(i);
|
28469 | children.push(newChild);
|
28470 | Array.prototype.push.apply(children, removed);
|
28471 | } else {
|
28472 | children.push(newChild);
|
28473 | }
|
28474 | return newChild;
|
28475 | } else {
|
28476 | if (this.isRoot) {
|
28477 | throw new Error("Cannot insert elements at root level. " + this.debugInfo(name));
|
28478 | }
|
28479 | i = this.parent.children.indexOf(this);
|
28480 | removed = this.parent.children.splice(i);
|
28481 | child = this.parent.element(name, attributes, text);
|
28482 | Array.prototype.push.apply(this.parent.children, removed);
|
28483 | return child;
|
28484 | }
|
28485 | };
|
28486 |
|
28487 | XMLNode.prototype.insertAfter = function (name, attributes, text) {
|
28488 | var child, i, removed;
|
28489 | if (this.isRoot) {
|
28490 | throw new Error("Cannot insert elements at root level. " + this.debugInfo(name));
|
28491 | }
|
28492 | i = this.parent.children.indexOf(this);
|
28493 | removed = this.parent.children.splice(i + 1);
|
28494 | child = this.parent.element(name, attributes, text);
|
28495 | Array.prototype.push.apply(this.parent.children, removed);
|
28496 | return child;
|
28497 | };
|
28498 |
|
28499 | XMLNode.prototype.remove = function () {
|
28500 | var i, ref2;
|
28501 | if (this.isRoot) {
|
28502 | throw new Error("Cannot remove the root element. " + this.debugInfo());
|
28503 | }
|
28504 | i = this.parent.children.indexOf(this);
|
28505 | [].splice.apply(this.parent.children, [i, i - i + 1].concat(ref2 = [])), ref2;
|
28506 | return this.parent;
|
28507 | };
|
28508 |
|
28509 | XMLNode.prototype.node = function (name, attributes, text) {
|
28510 | var child, ref2;
|
28511 | if (name != null) {
|
28512 | name = getValue(name);
|
28513 | }
|
28514 | attributes || (attributes = {});
|
28515 | attributes = getValue(attributes);
|
28516 | if (!isObject(attributes)) {
|
28517 | ref2 = [attributes, text], text = ref2[0], attributes = ref2[1];
|
28518 | }
|
28519 | child = new XMLElement(this, name, attributes);
|
28520 | if (text != null) {
|
28521 | child.text(text);
|
28522 | }
|
28523 | this.children.push(child);
|
28524 | return child;
|
28525 | };
|
28526 |
|
28527 | XMLNode.prototype.text = function (value) {
|
28528 | var child;
|
28529 | if (isObject(value)) {
|
28530 | this.element(value);
|
28531 | }
|
28532 | child = new XMLText(this, value);
|
28533 | this.children.push(child);
|
28534 | return this;
|
28535 | };
|
28536 |
|
28537 | XMLNode.prototype.cdata = function (value) {
|
28538 | var child;
|
28539 | child = new XMLCData(this, value);
|
28540 | this.children.push(child);
|
28541 | return this;
|
28542 | };
|
28543 |
|
28544 | XMLNode.prototype.comment = function (value) {
|
28545 | var child;
|
28546 | child = new XMLComment(this, value);
|
28547 | this.children.push(child);
|
28548 | return this;
|
28549 | };
|
28550 |
|
28551 | XMLNode.prototype.commentBefore = function (value) {
|
28552 | var child, i, removed;
|
28553 | i = this.parent.children.indexOf(this);
|
28554 | removed = this.parent.children.splice(i);
|
28555 | child = this.parent.comment(value);
|
28556 | Array.prototype.push.apply(this.parent.children, removed);
|
28557 | return this;
|
28558 | };
|
28559 |
|
28560 | XMLNode.prototype.commentAfter = function (value) {
|
28561 | var child, i, removed;
|
28562 | i = this.parent.children.indexOf(this);
|
28563 | removed = this.parent.children.splice(i + 1);
|
28564 | child = this.parent.comment(value);
|
28565 | Array.prototype.push.apply(this.parent.children, removed);
|
28566 | return this;
|
28567 | };
|
28568 |
|
28569 | XMLNode.prototype.raw = function (value) {
|
28570 | var child;
|
28571 | child = new XMLRaw(this, value);
|
28572 | this.children.push(child);
|
28573 | return this;
|
28574 | };
|
28575 |
|
28576 | XMLNode.prototype.dummy = function () {
|
28577 | var child;
|
28578 | child = new XMLDummy(this);
|
28579 | return child;
|
28580 | };
|
28581 |
|
28582 | XMLNode.prototype.instruction = function (target, value) {
|
28583 | var insTarget, insValue, instruction, j, len;
|
28584 | if (target != null) {
|
28585 | target = getValue(target);
|
28586 | }
|
28587 | if (value != null) {
|
28588 | value = getValue(value);
|
28589 | }
|
28590 | if (Array.isArray(target)) {
|
28591 | for (j = 0, len = target.length; j < len; j++) {
|
28592 | insTarget = target[j];
|
28593 | this.instruction(insTarget);
|
28594 | }
|
28595 | } else if (isObject(target)) {
|
28596 | for (insTarget in target) {
|
28597 | if (!hasProp.call(target, insTarget)) continue;
|
28598 | insValue = target[insTarget];
|
28599 | this.instruction(insTarget, insValue);
|
28600 | }
|
28601 | } else {
|
28602 | if (isFunction(value)) {
|
28603 | value = value.apply();
|
28604 | }
|
28605 | instruction = new XMLProcessingInstruction(this, target, value);
|
28606 | this.children.push(instruction);
|
28607 | }
|
28608 | return this;
|
28609 | };
|
28610 |
|
28611 | XMLNode.prototype.instructionBefore = function (target, value) {
|
28612 | var child, i, removed;
|
28613 | i = this.parent.children.indexOf(this);
|
28614 | removed = this.parent.children.splice(i);
|
28615 | child = this.parent.instruction(target, value);
|
28616 | Array.prototype.push.apply(this.parent.children, removed);
|
28617 | return this;
|
28618 | };
|
28619 |
|
28620 | XMLNode.prototype.instructionAfter = function (target, value) {
|
28621 | var child, i, removed;
|
28622 | i = this.parent.children.indexOf(this);
|
28623 | removed = this.parent.children.splice(i + 1);
|
28624 | child = this.parent.instruction(target, value);
|
28625 | Array.prototype.push.apply(this.parent.children, removed);
|
28626 | return this;
|
28627 | };
|
28628 |
|
28629 | XMLNode.prototype.declaration = function (version, encoding, standalone) {
|
28630 | var doc, xmldec;
|
28631 | doc = this.document();
|
28632 | xmldec = new XMLDeclaration(doc, version, encoding, standalone);
|
28633 | if (doc.children.length === 0) {
|
28634 | doc.children.unshift(xmldec);
|
28635 | } else if (doc.children[0].type === NodeType.Declaration) {
|
28636 | doc.children[0] = xmldec;
|
28637 | } else {
|
28638 | doc.children.unshift(xmldec);
|
28639 | }
|
28640 | return doc.root() || doc;
|
28641 | };
|
28642 |
|
28643 | XMLNode.prototype.dtd = function (pubID, sysID) {
|
28644 | var child, doc, doctype, i, j, k, len, len1, ref2, ref3;
|
28645 | doc = this.document();
|
28646 | doctype = new XMLDocType(doc, pubID, sysID);
|
28647 | ref2 = doc.children;
|
28648 | for (i = j = 0, len = ref2.length; j < len; i = ++j) {
|
28649 | child = ref2[i];
|
28650 | if (child.type === NodeType.DocType) {
|
28651 | doc.children[i] = doctype;
|
28652 | return doctype;
|
28653 | }
|
28654 | }
|
28655 | ref3 = doc.children;
|
28656 | for (i = k = 0, len1 = ref3.length; k < len1; i = ++k) {
|
28657 | child = ref3[i];
|
28658 | if (child.isRoot) {
|
28659 | doc.children.splice(i, 0, doctype);
|
28660 | return doctype;
|
28661 | }
|
28662 | }
|
28663 | doc.children.push(doctype);
|
28664 | return doctype;
|
28665 | };
|
28666 |
|
28667 | XMLNode.prototype.up = function () {
|
28668 | if (this.isRoot) {
|
28669 | throw new Error("The root node has no parent. Use doc() if you need to get the document object.");
|
28670 | }
|
28671 | return this.parent;
|
28672 | };
|
28673 |
|
28674 | XMLNode.prototype.root = function () {
|
28675 | var node;
|
28676 | node = this;
|
28677 | while (node) {
|
28678 | if (node.type === NodeType.Document) {
|
28679 | return node.rootObject;
|
28680 | } else if (node.isRoot) {
|
28681 | return node;
|
28682 | } else {
|
28683 | node = node.parent;
|
28684 | }
|
28685 | }
|
28686 | };
|
28687 |
|
28688 | XMLNode.prototype.document = function () {
|
28689 | var node;
|
28690 | node = this;
|
28691 | while (node) {
|
28692 | if (node.type === NodeType.Document) {
|
28693 | return node;
|
28694 | } else {
|
28695 | node = node.parent;
|
28696 | }
|
28697 | }
|
28698 | };
|
28699 |
|
28700 | XMLNode.prototype.end = function (options) {
|
28701 | return this.document().end(options);
|
28702 | };
|
28703 |
|
28704 | XMLNode.prototype.prev = function () {
|
28705 | var i;
|
28706 | i = this.parent.children.indexOf(this);
|
28707 | if (i < 1) {
|
28708 | throw new Error("Already at the first node. " + this.debugInfo());
|
28709 | }
|
28710 | return this.parent.children[i - 1];
|
28711 | };
|
28712 |
|
28713 | XMLNode.prototype.next = function () {
|
28714 | var i;
|
28715 | i = this.parent.children.indexOf(this);
|
28716 | if (i === -1 || i === this.parent.children.length - 1) {
|
28717 | throw new Error("Already at the last node. " + this.debugInfo());
|
28718 | }
|
28719 | return this.parent.children[i + 1];
|
28720 | };
|
28721 |
|
28722 | XMLNode.prototype.importDocument = function (doc) {
|
28723 | var clonedRoot;
|
28724 | clonedRoot = doc.root().clone();
|
28725 | clonedRoot.parent = this;
|
28726 | clonedRoot.isRoot = false;
|
28727 | this.children.push(clonedRoot);
|
28728 | return this;
|
28729 | };
|
28730 |
|
28731 | XMLNode.prototype.debugInfo = function (name) {
|
28732 | var ref2, ref3;
|
28733 | name = name || this.name;
|
28734 | if (name == null && !((ref2 = this.parent) != null ? ref2.name : void 0)) {
|
28735 | return "";
|
28736 | } else if (name == null) {
|
28737 | return "parent: <" + this.parent.name + ">";
|
28738 | } else if (!((ref3 = this.parent) != null ? ref3.name : void 0)) {
|
28739 | return "node: <" + name + ">";
|
28740 | } else {
|
28741 | return "node: <" + name + ">, parent: <" + this.parent.name + ">";
|
28742 | }
|
28743 | };
|
28744 |
|
28745 | XMLNode.prototype.ele = function (name, attributes, text) {
|
28746 | return this.element(name, attributes, text);
|
28747 | };
|
28748 |
|
28749 | XMLNode.prototype.nod = function (name, attributes, text) {
|
28750 | return this.node(name, attributes, text);
|
28751 | };
|
28752 |
|
28753 | XMLNode.prototype.txt = function (value) {
|
28754 | return this.text(value);
|
28755 | };
|
28756 |
|
28757 | XMLNode.prototype.dat = function (value) {
|
28758 | return this.cdata(value);
|
28759 | };
|
28760 |
|
28761 | XMLNode.prototype.com = function (value) {
|
28762 | return this.comment(value);
|
28763 | };
|
28764 |
|
28765 | XMLNode.prototype.ins = function (target, value) {
|
28766 | return this.instruction(target, value);
|
28767 | };
|
28768 |
|
28769 | XMLNode.prototype.doc = function () {
|
28770 | return this.document();
|
28771 | };
|
28772 |
|
28773 | XMLNode.prototype.dec = function (version, encoding, standalone) {
|
28774 | return this.declaration(version, encoding, standalone);
|
28775 | };
|
28776 |
|
28777 | XMLNode.prototype.e = function (name, attributes, text) {
|
28778 | return this.element(name, attributes, text);
|
28779 | };
|
28780 |
|
28781 | XMLNode.prototype.n = function (name, attributes, text) {
|
28782 | return this.node(name, attributes, text);
|
28783 | };
|
28784 |
|
28785 | XMLNode.prototype.t = function (value) {
|
28786 | return this.text(value);
|
28787 | };
|
28788 |
|
28789 | XMLNode.prototype.d = function (value) {
|
28790 | return this.cdata(value);
|
28791 | };
|
28792 |
|
28793 | XMLNode.prototype.c = function (value) {
|
28794 | return this.comment(value);
|
28795 | };
|
28796 |
|
28797 | XMLNode.prototype.r = function (value) {
|
28798 | return this.raw(value);
|
28799 | };
|
28800 |
|
28801 | XMLNode.prototype.i = function (target, value) {
|
28802 | return this.instruction(target, value);
|
28803 | };
|
28804 |
|
28805 | XMLNode.prototype.u = function () {
|
28806 | return this.up();
|
28807 | };
|
28808 |
|
28809 | XMLNode.prototype.importXMLBuilder = function (doc) {
|
28810 | return this.importDocument(doc);
|
28811 | };
|
28812 |
|
28813 | XMLNode.prototype.replaceChild = function (newChild, oldChild) {
|
28814 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
28815 | };
|
28816 |
|
28817 | XMLNode.prototype.removeChild = function (oldChild) {
|
28818 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
28819 | };
|
28820 |
|
28821 | XMLNode.prototype.appendChild = function (newChild) {
|
28822 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
28823 | };
|
28824 |
|
28825 | XMLNode.prototype.hasChildNodes = function () {
|
28826 | return this.children.length !== 0;
|
28827 | };
|
28828 |
|
28829 | XMLNode.prototype.cloneNode = function (deep) {
|
28830 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
28831 | };
|
28832 |
|
28833 | XMLNode.prototype.normalize = function () {
|
28834 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
28835 | };
|
28836 |
|
28837 | XMLNode.prototype.isSupported = function (feature, version) {
|
28838 | return true;
|
28839 | };
|
28840 |
|
28841 | XMLNode.prototype.hasAttributes = function () {
|
28842 | return this.attribs.length !== 0;
|
28843 | };
|
28844 |
|
28845 | XMLNode.prototype.compareDocumentPosition = function (other) {
|
28846 | var ref, res;
|
28847 | ref = this;
|
28848 | if (ref === other) {
|
28849 | return 0;
|
28850 | } else if (this.document() !== other.document()) {
|
28851 | res = DocumentPosition.Disconnected | DocumentPosition.ImplementationSpecific;
|
28852 | if (Math.random() < 0.5) {
|
28853 | res |= DocumentPosition.Preceding;
|
28854 | } else {
|
28855 | res |= DocumentPosition.Following;
|
28856 | }
|
28857 | return res;
|
28858 | } else if (ref.isAncestor(other)) {
|
28859 | return DocumentPosition.Contains | DocumentPosition.Preceding;
|
28860 | } else if (ref.isDescendant(other)) {
|
28861 | return DocumentPosition.Contains | DocumentPosition.Following;
|
28862 | } else if (ref.isPreceding(other)) {
|
28863 | return DocumentPosition.Preceding;
|
28864 | } else {
|
28865 | return DocumentPosition.Following;
|
28866 | }
|
28867 | };
|
28868 |
|
28869 | XMLNode.prototype.isSameNode = function (other) {
|
28870 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
28871 | };
|
28872 |
|
28873 | XMLNode.prototype.lookupPrefix = function (namespaceURI) {
|
28874 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
28875 | };
|
28876 |
|
28877 | XMLNode.prototype.isDefaultNamespace = function (namespaceURI) {
|
28878 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
28879 | };
|
28880 |
|
28881 | XMLNode.prototype.lookupNamespaceURI = function (prefix) {
|
28882 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
28883 | };
|
28884 |
|
28885 | XMLNode.prototype.isEqualNode = function (node) {
|
28886 | var i, j, ref2;
|
28887 | if (node.nodeType !== this.nodeType) {
|
28888 | return false;
|
28889 | }
|
28890 | if (node.children.length !== this.children.length) {
|
28891 | return false;
|
28892 | }
|
28893 | for (i = j = 0, ref2 = this.children.length - 1; 0 <= ref2 ? j <= ref2 : j >= ref2; i = 0 <= ref2 ? ++j : --j) {
|
28894 | if (!this.children[i].isEqualNode(node.children[i])) {
|
28895 | return false;
|
28896 | }
|
28897 | }
|
28898 | return true;
|
28899 | };
|
28900 |
|
28901 | XMLNode.prototype.getFeature = function (feature, version) {
|
28902 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
28903 | };
|
28904 |
|
28905 | XMLNode.prototype.setUserData = function (key, data, handler) {
|
28906 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
28907 | };
|
28908 |
|
28909 | XMLNode.prototype.getUserData = function (key) {
|
28910 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
28911 | };
|
28912 |
|
28913 | XMLNode.prototype.contains = function (other) {
|
28914 | if (!other) {
|
28915 | return false;
|
28916 | }
|
28917 | return other === this || this.isDescendant(other);
|
28918 | };
|
28919 |
|
28920 | XMLNode.prototype.isDescendant = function (node) {
|
28921 | var child, isDescendantChild, j, len, ref2;
|
28922 | ref2 = this.children;
|
28923 | for (j = 0, len = ref2.length; j < len; j++) {
|
28924 | child = ref2[j];
|
28925 | if (node === child) {
|
28926 | return true;
|
28927 | }
|
28928 | isDescendantChild = child.isDescendant(node);
|
28929 | if (isDescendantChild) {
|
28930 | return true;
|
28931 | }
|
28932 | }
|
28933 | return false;
|
28934 | };
|
28935 |
|
28936 | XMLNode.prototype.isAncestor = function (node) {
|
28937 | return node.isDescendant(this);
|
28938 | };
|
28939 |
|
28940 | XMLNode.prototype.isPreceding = function (node) {
|
28941 | var nodePos, thisPos;
|
28942 | nodePos = this.treePosition(node);
|
28943 | thisPos = this.treePosition(this);
|
28944 | if (nodePos === -1 || thisPos === -1) {
|
28945 | return false;
|
28946 | } else {
|
28947 | return nodePos < thisPos;
|
28948 | }
|
28949 | };
|
28950 |
|
28951 | XMLNode.prototype.isFollowing = function (node) {
|
28952 | var nodePos, thisPos;
|
28953 | nodePos = this.treePosition(node);
|
28954 | thisPos = this.treePosition(this);
|
28955 | if (nodePos === -1 || thisPos === -1) {
|
28956 | return false;
|
28957 | } else {
|
28958 | return nodePos > thisPos;
|
28959 | }
|
28960 | };
|
28961 |
|
28962 | XMLNode.prototype.treePosition = function (node) {
|
28963 | var found, pos;
|
28964 | pos = 0;
|
28965 | found = false;
|
28966 | this.foreachTreeNode(this.document(), function (childNode) {
|
28967 | pos++;
|
28968 | if (!found && childNode === node) {
|
28969 | return found = true;
|
28970 | }
|
28971 | });
|
28972 | if (found) {
|
28973 | return pos;
|
28974 | } else {
|
28975 | return -1;
|
28976 | }
|
28977 | };
|
28978 |
|
28979 | XMLNode.prototype.foreachTreeNode = function (node, func) {
|
28980 | var child, j, len, ref2, res;
|
28981 | node || (node = this.document());
|
28982 | ref2 = node.children;
|
28983 | for (j = 0, len = ref2.length; j < len; j++) {
|
28984 | child = ref2[j];
|
28985 | if (res = func(child)) {
|
28986 | return res;
|
28987 | } else {
|
28988 | res = this.foreachTreeNode(child, func);
|
28989 | if (res) {
|
28990 | return res;
|
28991 | }
|
28992 | }
|
28993 | }
|
28994 | };
|
28995 |
|
28996 | return XMLNode;
|
28997 | }();
|
28998 | }).call(undefined);
|
28999 |
|
29000 | },{"./DocumentPosition":294,"./NodeType":295,"./Utility":296,"./XMLCData":299,"./XMLComment":301,"./XMLDeclaration":310,"./XMLDocType":311,"./XMLDummy":314,"./XMLElement":315,"./XMLNamedNodeMap":316,"./XMLNodeList":318,"./XMLProcessingInstruction":319,"./XMLRaw":320,"./XMLText":324}],318:[function(require,module,exports){
|
29001 | 'use strict';
|
29002 |
|
29003 |
|
29004 | (function () {
|
29005 | var XMLNodeList;
|
29006 |
|
29007 | module.exports = XMLNodeList = function () {
|
29008 | function XMLNodeList(nodes) {
|
29009 | this.nodes = nodes;
|
29010 | }
|
29011 |
|
29012 | Object.defineProperty(XMLNodeList.prototype, 'length', {
|
29013 | get: function get() {
|
29014 | return this.nodes.length || 0;
|
29015 | }
|
29016 | });
|
29017 |
|
29018 | XMLNodeList.prototype.clone = function () {
|
29019 | return this.nodes = null;
|
29020 | };
|
29021 |
|
29022 | XMLNodeList.prototype.item = function (index) {
|
29023 | return this.nodes[index] || null;
|
29024 | };
|
29025 |
|
29026 | return XMLNodeList;
|
29027 | }();
|
29028 | }).call(undefined);
|
29029 |
|
29030 | },{}],319:[function(require,module,exports){
|
29031 | 'use strict';
|
29032 |
|
29033 | var _create = require('babel-runtime/core-js/object/create');
|
29034 |
|
29035 | var _create2 = _interopRequireDefault(_create);
|
29036 |
|
29037 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
29038 |
|
29039 |
|
29040 | (function () {
|
29041 | var NodeType,
|
29042 | XMLCharacterData,
|
29043 | XMLProcessingInstruction,
|
29044 | extend = function extend(child, parent) {
|
29045 | for (var key in parent) {
|
29046 | if (hasProp.call(parent, key)) child[key] = parent[key];
|
29047 | }function ctor() {
|
29048 | this.constructor = child;
|
29049 | }ctor.prototype = parent.prototype;child.prototype = new ctor();child.__super__ = parent.prototype;return child;
|
29050 | },
|
29051 | hasProp = {}.hasOwnProperty;
|
29052 |
|
29053 | NodeType = require('./NodeType');
|
29054 |
|
29055 | XMLCharacterData = require('./XMLCharacterData');
|
29056 |
|
29057 | module.exports = XMLProcessingInstruction = function (superClass) {
|
29058 | extend(XMLProcessingInstruction, superClass);
|
29059 |
|
29060 | function XMLProcessingInstruction(parent, target, value) {
|
29061 | XMLProcessingInstruction.__super__.constructor.call(this, parent);
|
29062 | if (target == null) {
|
29063 | throw new Error("Missing instruction target. " + this.debugInfo());
|
29064 | }
|
29065 | this.type = NodeType.ProcessingInstruction;
|
29066 | this.target = this.stringify.insTarget(target);
|
29067 | this.name = this.target;
|
29068 | if (value) {
|
29069 | this.value = this.stringify.insValue(value);
|
29070 | }
|
29071 | }
|
29072 |
|
29073 | XMLProcessingInstruction.prototype.clone = function () {
|
29074 | return (0, _create2.default)(this);
|
29075 | };
|
29076 |
|
29077 | XMLProcessingInstruction.prototype.toString = function (options) {
|
29078 | return this.options.writer.processingInstruction(this, this.options.writer.filterOptions(options));
|
29079 | };
|
29080 |
|
29081 | XMLProcessingInstruction.prototype.isEqualNode = function (node) {
|
29082 | if (!XMLProcessingInstruction.__super__.isEqualNode.apply(this, arguments).isEqualNode(node)) {
|
29083 | return false;
|
29084 | }
|
29085 | if (node.target !== this.target) {
|
29086 | return false;
|
29087 | }
|
29088 | return true;
|
29089 | };
|
29090 |
|
29091 | return XMLProcessingInstruction;
|
29092 | }(XMLCharacterData);
|
29093 | }).call(undefined);
|
29094 |
|
29095 | },{"./NodeType":295,"./XMLCharacterData":300,"babel-runtime/core-js/object/create":50}],320:[function(require,module,exports){
|
29096 | 'use strict';
|
29097 |
|
29098 | var _create = require('babel-runtime/core-js/object/create');
|
29099 |
|
29100 | var _create2 = _interopRequireDefault(_create);
|
29101 |
|
29102 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
29103 |
|
29104 |
|
29105 | (function () {
|
29106 | var NodeType,
|
29107 | XMLNode,
|
29108 | XMLRaw,
|
29109 | extend = function extend(child, parent) {
|
29110 | for (var key in parent) {
|
29111 | if (hasProp.call(parent, key)) child[key] = parent[key];
|
29112 | }function ctor() {
|
29113 | this.constructor = child;
|
29114 | }ctor.prototype = parent.prototype;child.prototype = new ctor();child.__super__ = parent.prototype;return child;
|
29115 | },
|
29116 | hasProp = {}.hasOwnProperty;
|
29117 |
|
29118 | NodeType = require('./NodeType');
|
29119 |
|
29120 | XMLNode = require('./XMLNode');
|
29121 |
|
29122 | module.exports = XMLRaw = function (superClass) {
|
29123 | extend(XMLRaw, superClass);
|
29124 |
|
29125 | function XMLRaw(parent, text) {
|
29126 | XMLRaw.__super__.constructor.call(this, parent);
|
29127 | if (text == null) {
|
29128 | throw new Error("Missing raw text. " + this.debugInfo());
|
29129 | }
|
29130 | this.type = NodeType.Raw;
|
29131 | this.value = this.stringify.raw(text);
|
29132 | }
|
29133 |
|
29134 | XMLRaw.prototype.clone = function () {
|
29135 | return (0, _create2.default)(this);
|
29136 | };
|
29137 |
|
29138 | XMLRaw.prototype.toString = function (options) {
|
29139 | return this.options.writer.raw(this, this.options.writer.filterOptions(options));
|
29140 | };
|
29141 |
|
29142 | return XMLRaw;
|
29143 | }(XMLNode);
|
29144 | }).call(undefined);
|
29145 |
|
29146 | },{"./NodeType":295,"./XMLNode":317,"babel-runtime/core-js/object/create":50}],321:[function(require,module,exports){
|
29147 | 'use strict';
|
29148 |
|
29149 |
|
29150 | (function () {
|
29151 | var NodeType,
|
29152 | WriterState,
|
29153 | XMLStreamWriter,
|
29154 | XMLWriterBase,
|
29155 | extend = function extend(child, parent) {
|
29156 | for (var key in parent) {
|
29157 | if (hasProp.call(parent, key)) child[key] = parent[key];
|
29158 | }function ctor() {
|
29159 | this.constructor = child;
|
29160 | }ctor.prototype = parent.prototype;child.prototype = new ctor();child.__super__ = parent.prototype;return child;
|
29161 | },
|
29162 | hasProp = {}.hasOwnProperty;
|
29163 |
|
29164 | NodeType = require('./NodeType');
|
29165 |
|
29166 | XMLWriterBase = require('./XMLWriterBase');
|
29167 |
|
29168 | WriterState = require('./WriterState');
|
29169 |
|
29170 | module.exports = XMLStreamWriter = function (superClass) {
|
29171 | extend(XMLStreamWriter, superClass);
|
29172 |
|
29173 | function XMLStreamWriter(stream, options) {
|
29174 | this.stream = stream;
|
29175 | XMLStreamWriter.__super__.constructor.call(this, options);
|
29176 | }
|
29177 |
|
29178 | XMLStreamWriter.prototype.endline = function (node, options, level) {
|
29179 | if (node.isLastRootNode && options.state === WriterState.CloseTag) {
|
29180 | return '';
|
29181 | } else {
|
29182 | return XMLStreamWriter.__super__.endline.call(this, node, options, level);
|
29183 | }
|
29184 | };
|
29185 |
|
29186 | XMLStreamWriter.prototype.document = function (doc, options) {
|
29187 | var child, i, j, k, len, len1, ref, ref1, results;
|
29188 | ref = doc.children;
|
29189 | for (i = j = 0, len = ref.length; j < len; i = ++j) {
|
29190 | child = ref[i];
|
29191 | child.isLastRootNode = i === doc.children.length - 1;
|
29192 | }
|
29193 | options = this.filterOptions(options);
|
29194 | ref1 = doc.children;
|
29195 | results = [];
|
29196 | for (k = 0, len1 = ref1.length; k < len1; k++) {
|
29197 | child = ref1[k];
|
29198 | results.push(this.writeChildNode(child, options, 0));
|
29199 | }
|
29200 | return results;
|
29201 | };
|
29202 |
|
29203 | XMLStreamWriter.prototype.attribute = function (att, options, level) {
|
29204 | return this.stream.write(XMLStreamWriter.__super__.attribute.call(this, att, options, level));
|
29205 | };
|
29206 |
|
29207 | XMLStreamWriter.prototype.cdata = function (node, options, level) {
|
29208 | return this.stream.write(XMLStreamWriter.__super__.cdata.call(this, node, options, level));
|
29209 | };
|
29210 |
|
29211 | XMLStreamWriter.prototype.comment = function (node, options, level) {
|
29212 | return this.stream.write(XMLStreamWriter.__super__.comment.call(this, node, options, level));
|
29213 | };
|
29214 |
|
29215 | XMLStreamWriter.prototype.declaration = function (node, options, level) {
|
29216 | return this.stream.write(XMLStreamWriter.__super__.declaration.call(this, node, options, level));
|
29217 | };
|
29218 |
|
29219 | XMLStreamWriter.prototype.docType = function (node, options, level) {
|
29220 | var child, j, len, ref;
|
29221 | level || (level = 0);
|
29222 | this.openNode(node, options, level);
|
29223 | options.state = WriterState.OpenTag;
|
29224 | this.stream.write(this.indent(node, options, level));
|
29225 | this.stream.write('<!DOCTYPE ' + node.root().name);
|
29226 | if (node.pubID && node.sysID) {
|
29227 | this.stream.write(' PUBLIC "' + node.pubID + '" "' + node.sysID + '"');
|
29228 | } else if (node.sysID) {
|
29229 | this.stream.write(' SYSTEM "' + node.sysID + '"');
|
29230 | }
|
29231 | if (node.children.length > 0) {
|
29232 | this.stream.write(' [');
|
29233 | this.stream.write(this.endline(node, options, level));
|
29234 | options.state = WriterState.InsideTag;
|
29235 | ref = node.children;
|
29236 | for (j = 0, len = ref.length; j < len; j++) {
|
29237 | child = ref[j];
|
29238 | this.writeChildNode(child, options, level + 1);
|
29239 | }
|
29240 | options.state = WriterState.CloseTag;
|
29241 | this.stream.write(']');
|
29242 | }
|
29243 | options.state = WriterState.CloseTag;
|
29244 | this.stream.write(options.spaceBeforeSlash + '>');
|
29245 | this.stream.write(this.endline(node, options, level));
|
29246 | options.state = WriterState.None;
|
29247 | return this.closeNode(node, options, level);
|
29248 | };
|
29249 |
|
29250 | XMLStreamWriter.prototype.element = function (node, options, level) {
|
29251 | var att, child, childNodeCount, firstChildNode, j, len, name, prettySuppressed, ref, ref1;
|
29252 | level || (level = 0);
|
29253 | this.openNode(node, options, level);
|
29254 | options.state = WriterState.OpenTag;
|
29255 | this.stream.write(this.indent(node, options, level) + '<' + node.name);
|
29256 | ref = node.attribs;
|
29257 | for (name in ref) {
|
29258 | if (!hasProp.call(ref, name)) continue;
|
29259 | att = ref[name];
|
29260 | this.attribute(att, options, level);
|
29261 | }
|
29262 | childNodeCount = node.children.length;
|
29263 | firstChildNode = childNodeCount === 0 ? null : node.children[0];
|
29264 | if (childNodeCount === 0 || node.children.every(function (e) {
|
29265 | return (e.type === NodeType.Text || e.type === NodeType.Raw) && e.value === '';
|
29266 | })) {
|
29267 | if (options.allowEmpty) {
|
29268 | this.stream.write('>');
|
29269 | options.state = WriterState.CloseTag;
|
29270 | this.stream.write('</' + node.name + '>');
|
29271 | } else {
|
29272 | options.state = WriterState.CloseTag;
|
29273 | this.stream.write(options.spaceBeforeSlash + '/>');
|
29274 | }
|
29275 | } else if (options.pretty && childNodeCount === 1 && (firstChildNode.type === NodeType.Text || firstChildNode.type === NodeType.Raw) && firstChildNode.value != null) {
|
29276 | this.stream.write('>');
|
29277 | options.state = WriterState.InsideTag;
|
29278 | options.suppressPrettyCount++;
|
29279 | prettySuppressed = true;
|
29280 | this.writeChildNode(firstChildNode, options, level + 1);
|
29281 | options.suppressPrettyCount--;
|
29282 | prettySuppressed = false;
|
29283 | options.state = WriterState.CloseTag;
|
29284 | this.stream.write('</' + node.name + '>');
|
29285 | } else {
|
29286 | this.stream.write('>' + this.endline(node, options, level));
|
29287 | options.state = WriterState.InsideTag;
|
29288 | ref1 = node.children;
|
29289 | for (j = 0, len = ref1.length; j < len; j++) {
|
29290 | child = ref1[j];
|
29291 | this.writeChildNode(child, options, level + 1);
|
29292 | }
|
29293 | options.state = WriterState.CloseTag;
|
29294 | this.stream.write(this.indent(node, options, level) + '</' + node.name + '>');
|
29295 | }
|
29296 | this.stream.write(this.endline(node, options, level));
|
29297 | options.state = WriterState.None;
|
29298 | return this.closeNode(node, options, level);
|
29299 | };
|
29300 |
|
29301 | XMLStreamWriter.prototype.processingInstruction = function (node, options, level) {
|
29302 | return this.stream.write(XMLStreamWriter.__super__.processingInstruction.call(this, node, options, level));
|
29303 | };
|
29304 |
|
29305 | XMLStreamWriter.prototype.raw = function (node, options, level) {
|
29306 | return this.stream.write(XMLStreamWriter.__super__.raw.call(this, node, options, level));
|
29307 | };
|
29308 |
|
29309 | XMLStreamWriter.prototype.text = function (node, options, level) {
|
29310 | return this.stream.write(XMLStreamWriter.__super__.text.call(this, node, options, level));
|
29311 | };
|
29312 |
|
29313 | XMLStreamWriter.prototype.dtdAttList = function (node, options, level) {
|
29314 | return this.stream.write(XMLStreamWriter.__super__.dtdAttList.call(this, node, options, level));
|
29315 | };
|
29316 |
|
29317 | XMLStreamWriter.prototype.dtdElement = function (node, options, level) {
|
29318 | return this.stream.write(XMLStreamWriter.__super__.dtdElement.call(this, node, options, level));
|
29319 | };
|
29320 |
|
29321 | XMLStreamWriter.prototype.dtdEntity = function (node, options, level) {
|
29322 | return this.stream.write(XMLStreamWriter.__super__.dtdEntity.call(this, node, options, level));
|
29323 | };
|
29324 |
|
29325 | XMLStreamWriter.prototype.dtdNotation = function (node, options, level) {
|
29326 | return this.stream.write(XMLStreamWriter.__super__.dtdNotation.call(this, node, options, level));
|
29327 | };
|
29328 |
|
29329 | return XMLStreamWriter;
|
29330 | }(XMLWriterBase);
|
29331 | }).call(undefined);
|
29332 |
|
29333 | },{"./NodeType":295,"./WriterState":297,"./XMLWriterBase":325}],322:[function(require,module,exports){
|
29334 | 'use strict';
|
29335 |
|
29336 |
|
29337 | (function () {
|
29338 | var XMLStringWriter,
|
29339 | XMLWriterBase,
|
29340 | extend = function extend(child, parent) {
|
29341 | for (var key in parent) {
|
29342 | if (hasProp.call(parent, key)) child[key] = parent[key];
|
29343 | }function ctor() {
|
29344 | this.constructor = child;
|
29345 | }ctor.prototype = parent.prototype;child.prototype = new ctor();child.__super__ = parent.prototype;return child;
|
29346 | },
|
29347 | hasProp = {}.hasOwnProperty;
|
29348 |
|
29349 | XMLWriterBase = require('./XMLWriterBase');
|
29350 |
|
29351 | module.exports = XMLStringWriter = function (superClass) {
|
29352 | extend(XMLStringWriter, superClass);
|
29353 |
|
29354 | function XMLStringWriter(options) {
|
29355 | XMLStringWriter.__super__.constructor.call(this, options);
|
29356 | }
|
29357 |
|
29358 | XMLStringWriter.prototype.document = function (doc, options) {
|
29359 | var child, i, len, r, ref;
|
29360 | options = this.filterOptions(options);
|
29361 | r = '';
|
29362 | ref = doc.children;
|
29363 | for (i = 0, len = ref.length; i < len; i++) {
|
29364 | child = ref[i];
|
29365 | r += this.writeChildNode(child, options, 0);
|
29366 | }
|
29367 | if (options.pretty && r.slice(-options.newline.length) === options.newline) {
|
29368 | r = r.slice(0, -options.newline.length);
|
29369 | }
|
29370 | return r;
|
29371 | };
|
29372 |
|
29373 | return XMLStringWriter;
|
29374 | }(XMLWriterBase);
|
29375 | }).call(undefined);
|
29376 |
|
29377 | },{"./XMLWriterBase":325}],323:[function(require,module,exports){
|
29378 | 'use strict';
|
29379 |
|
29380 |
|
29381 | (function () {
|
29382 | var XMLStringifier,
|
29383 | bind = function bind(fn, me) {
|
29384 | return function () {
|
29385 | return fn.apply(me, arguments);
|
29386 | };
|
29387 | },
|
29388 | hasProp = {}.hasOwnProperty;
|
29389 |
|
29390 | module.exports = XMLStringifier = function () {
|
29391 | function XMLStringifier(options) {
|
29392 | this.assertLegalName = bind(this.assertLegalName, this);
|
29393 | this.assertLegalChar = bind(this.assertLegalChar, this);
|
29394 | var key, ref, value;
|
29395 | options || (options = {});
|
29396 | this.options = options;
|
29397 | if (!this.options.version) {
|
29398 | this.options.version = '1.0';
|
29399 | }
|
29400 | ref = options.stringify || {};
|
29401 | for (key in ref) {
|
29402 | if (!hasProp.call(ref, key)) continue;
|
29403 | value = ref[key];
|
29404 | this[key] = value;
|
29405 | }
|
29406 | }
|
29407 |
|
29408 | XMLStringifier.prototype.name = function (val) {
|
29409 | if (this.options.noValidation) {
|
29410 | return val;
|
29411 | }
|
29412 | return this.assertLegalName('' + val || '');
|
29413 | };
|
29414 |
|
29415 | XMLStringifier.prototype.text = function (val) {
|
29416 | if (this.options.noValidation) {
|
29417 | return val;
|
29418 | }
|
29419 | return this.assertLegalChar(this.textEscape('' + val || ''));
|
29420 | };
|
29421 |
|
29422 | XMLStringifier.prototype.cdata = function (val) {
|
29423 | if (this.options.noValidation) {
|
29424 | return val;
|
29425 | }
|
29426 | val = '' + val || '';
|
29427 | val = val.replace(']]>', ']]]]><![CDATA[>');
|
29428 | return this.assertLegalChar(val);
|
29429 | };
|
29430 |
|
29431 | XMLStringifier.prototype.comment = function (val) {
|
29432 | if (this.options.noValidation) {
|
29433 | return val;
|
29434 | }
|
29435 | val = '' + val || '';
|
29436 | if (val.match(/--/)) {
|
29437 | throw new Error("Comment text cannot contain double-hypen: " + val);
|
29438 | }
|
29439 | return this.assertLegalChar(val);
|
29440 | };
|
29441 |
|
29442 | XMLStringifier.prototype.raw = function (val) {
|
29443 | if (this.options.noValidation) {
|
29444 | return val;
|
29445 | }
|
29446 | return '' + val || '';
|
29447 | };
|
29448 |
|
29449 | XMLStringifier.prototype.attValue = function (val) {
|
29450 | if (this.options.noValidation) {
|
29451 | return val;
|
29452 | }
|
29453 | return this.assertLegalChar(this.attEscape(val = '' + val || ''));
|
29454 | };
|
29455 |
|
29456 | XMLStringifier.prototype.insTarget = function (val) {
|
29457 | if (this.options.noValidation) {
|
29458 | return val;
|
29459 | }
|
29460 | return this.assertLegalChar('' + val || '');
|
29461 | };
|
29462 |
|
29463 | XMLStringifier.prototype.insValue = function (val) {
|
29464 | if (this.options.noValidation) {
|
29465 | return val;
|
29466 | }
|
29467 | val = '' + val || '';
|
29468 | if (val.match(/\?>/)) {
|
29469 | throw new Error("Invalid processing instruction value: " + val);
|
29470 | }
|
29471 | return this.assertLegalChar(val);
|
29472 | };
|
29473 |
|
29474 | XMLStringifier.prototype.xmlVersion = function (val) {
|
29475 | if (this.options.noValidation) {
|
29476 | return val;
|
29477 | }
|
29478 | val = '' + val || '';
|
29479 | if (!val.match(/1\.[0-9]+/)) {
|
29480 | throw new Error("Invalid version number: " + val);
|
29481 | }
|
29482 | return val;
|
29483 | };
|
29484 |
|
29485 | XMLStringifier.prototype.xmlEncoding = function (val) {
|
29486 | if (this.options.noValidation) {
|
29487 | return val;
|
29488 | }
|
29489 | val = '' + val || '';
|
29490 | if (!val.match(/^[A-Za-z](?:[A-Za-z0-9._-])*$/)) {
|
29491 | throw new Error("Invalid encoding: " + val);
|
29492 | }
|
29493 | return this.assertLegalChar(val);
|
29494 | };
|
29495 |
|
29496 | XMLStringifier.prototype.xmlStandalone = function (val) {
|
29497 | if (this.options.noValidation) {
|
29498 | return val;
|
29499 | }
|
29500 | if (val) {
|
29501 | return "yes";
|
29502 | } else {
|
29503 | return "no";
|
29504 | }
|
29505 | };
|
29506 |
|
29507 | XMLStringifier.prototype.dtdPubID = function (val) {
|
29508 | if (this.options.noValidation) {
|
29509 | return val;
|
29510 | }
|
29511 | return this.assertLegalChar('' + val || '');
|
29512 | };
|
29513 |
|
29514 | XMLStringifier.prototype.dtdSysID = function (val) {
|
29515 | if (this.options.noValidation) {
|
29516 | return val;
|
29517 | }
|
29518 | return this.assertLegalChar('' + val || '');
|
29519 | };
|
29520 |
|
29521 | XMLStringifier.prototype.dtdElementValue = function (val) {
|
29522 | if (this.options.noValidation) {
|
29523 | return val;
|
29524 | }
|
29525 | return this.assertLegalChar('' + val || '');
|
29526 | };
|
29527 |
|
29528 | XMLStringifier.prototype.dtdAttType = function (val) {
|
29529 | if (this.options.noValidation) {
|
29530 | return val;
|
29531 | }
|
29532 | return this.assertLegalChar('' + val || '');
|
29533 | };
|
29534 |
|
29535 | XMLStringifier.prototype.dtdAttDefault = function (val) {
|
29536 | if (this.options.noValidation) {
|
29537 | return val;
|
29538 | }
|
29539 | return this.assertLegalChar('' + val || '');
|
29540 | };
|
29541 |
|
29542 | XMLStringifier.prototype.dtdEntityValue = function (val) {
|
29543 | if (this.options.noValidation) {
|
29544 | return val;
|
29545 | }
|
29546 | return this.assertLegalChar('' + val || '');
|
29547 | };
|
29548 |
|
29549 | XMLStringifier.prototype.dtdNData = function (val) {
|
29550 | if (this.options.noValidation) {
|
29551 | return val;
|
29552 | }
|
29553 | return this.assertLegalChar('' + val || '');
|
29554 | };
|
29555 |
|
29556 | XMLStringifier.prototype.convertAttKey = '@';
|
29557 |
|
29558 | XMLStringifier.prototype.convertPIKey = '?';
|
29559 |
|
29560 | XMLStringifier.prototype.convertTextKey = '#text';
|
29561 |
|
29562 | XMLStringifier.prototype.convertCDataKey = '#cdata';
|
29563 |
|
29564 | XMLStringifier.prototype.convertCommentKey = '#comment';
|
29565 |
|
29566 | XMLStringifier.prototype.convertRawKey = '#raw';
|
29567 |
|
29568 | XMLStringifier.prototype.assertLegalChar = function (str) {
|
29569 | var regex, res;
|
29570 | if (this.options.noValidation) {
|
29571 | return str;
|
29572 | }
|
29573 | regex = '';
|
29574 | if (this.options.version === '1.0') {
|
29575 | regex = /[\0-\x08\x0B\f\x0E-\x1F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/;
|
29576 | if (res = str.match(regex)) {
|
29577 | throw new Error("Invalid character in string: " + str + " at index " + res.index);
|
29578 | }
|
29579 | } else if (this.options.version === '1.1') {
|
29580 | regex = /[\0\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/;
|
29581 | if (res = str.match(regex)) {
|
29582 | throw new Error("Invalid character in string: " + str + " at index " + res.index);
|
29583 | }
|
29584 | }
|
29585 | return str;
|
29586 | };
|
29587 |
|
29588 | XMLStringifier.prototype.assertLegalName = function (str) {
|
29589 | var regex;
|
29590 | if (this.options.noValidation) {
|
29591 | return str;
|
29592 | }
|
29593 | this.assertLegalChar(str);
|
29594 | 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])*$/;
|
29595 | if (!str.match(regex)) {
|
29596 | throw new Error("Invalid character in name");
|
29597 | }
|
29598 | return str;
|
29599 | };
|
29600 |
|
29601 | XMLStringifier.prototype.textEscape = function (str) {
|
29602 | var ampregex;
|
29603 | if (this.options.noValidation) {
|
29604 | return str;
|
29605 | }
|
29606 | ampregex = this.options.noDoubleEncoding ? /(?!&\S+;)&/g : /&/g;
|
29607 | return str.replace(ampregex, '&').replace(/</g, '<').replace(/>/g, '>').replace(/\r/g, '
');
|
29608 | };
|
29609 |
|
29610 | XMLStringifier.prototype.attEscape = function (str) {
|
29611 | var ampregex;
|
29612 | if (this.options.noValidation) {
|
29613 | return str;
|
29614 | }
|
29615 | ampregex = this.options.noDoubleEncoding ? /(?!&\S+;)&/g : /&/g;
|
29616 | return str.replace(ampregex, '&').replace(/</g, '<').replace(/"/g, '"').replace(/\t/g, '	').replace(/\n/g, '
').replace(/\r/g, '
');
|
29617 | };
|
29618 |
|
29619 | return XMLStringifier;
|
29620 | }();
|
29621 | }).call(undefined);
|
29622 |
|
29623 | },{}],324:[function(require,module,exports){
|
29624 | 'use strict';
|
29625 |
|
29626 | var _create = require('babel-runtime/core-js/object/create');
|
29627 |
|
29628 | var _create2 = _interopRequireDefault(_create);
|
29629 |
|
29630 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
29631 |
|
29632 |
|
29633 | (function () {
|
29634 | var NodeType,
|
29635 | XMLCharacterData,
|
29636 | XMLText,
|
29637 | extend = function extend(child, parent) {
|
29638 | for (var key in parent) {
|
29639 | if (hasProp.call(parent, key)) child[key] = parent[key];
|
29640 | }function ctor() {
|
29641 | this.constructor = child;
|
29642 | }ctor.prototype = parent.prototype;child.prototype = new ctor();child.__super__ = parent.prototype;return child;
|
29643 | },
|
29644 | hasProp = {}.hasOwnProperty;
|
29645 |
|
29646 | NodeType = require('./NodeType');
|
29647 |
|
29648 | XMLCharacterData = require('./XMLCharacterData');
|
29649 |
|
29650 | module.exports = XMLText = function (superClass) {
|
29651 | extend(XMLText, superClass);
|
29652 |
|
29653 | function XMLText(parent, text) {
|
29654 | XMLText.__super__.constructor.call(this, parent);
|
29655 | if (text == null) {
|
29656 | throw new Error("Missing element text. " + this.debugInfo());
|
29657 | }
|
29658 | this.name = "#text";
|
29659 | this.type = NodeType.Text;
|
29660 | this.value = this.stringify.text(text);
|
29661 | }
|
29662 |
|
29663 | Object.defineProperty(XMLText.prototype, 'isElementContentWhitespace', {
|
29664 | get: function get() {
|
29665 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
29666 | }
|
29667 | });
|
29668 |
|
29669 | Object.defineProperty(XMLText.prototype, 'wholeText', {
|
29670 | get: function get() {
|
29671 | var next, prev, str;
|
29672 | str = '';
|
29673 | prev = this.previousSibling;
|
29674 | while (prev) {
|
29675 | str = prev.data + str;
|
29676 | prev = prev.previousSibling;
|
29677 | }
|
29678 | str += this.data;
|
29679 | next = this.nextSibling;
|
29680 | while (next) {
|
29681 | str = str + next.data;
|
29682 | next = next.nextSibling;
|
29683 | }
|
29684 | return str;
|
29685 | }
|
29686 | });
|
29687 |
|
29688 | XMLText.prototype.clone = function () {
|
29689 | return (0, _create2.default)(this);
|
29690 | };
|
29691 |
|
29692 | XMLText.prototype.toString = function (options) {
|
29693 | return this.options.writer.text(this, this.options.writer.filterOptions(options));
|
29694 | };
|
29695 |
|
29696 | XMLText.prototype.splitText = function (offset) {
|
29697 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
29698 | };
|
29699 |
|
29700 | XMLText.prototype.replaceWholeText = function (content) {
|
29701 | throw new Error("This DOM method is not implemented." + this.debugInfo());
|
29702 | };
|
29703 |
|
29704 | return XMLText;
|
29705 | }(XMLCharacterData);
|
29706 | }).call(undefined);
|
29707 |
|
29708 | },{"./NodeType":295,"./XMLCharacterData":300,"babel-runtime/core-js/object/create":50}],325:[function(require,module,exports){
|
29709 | 'use strict';
|
29710 |
|
29711 |
|
29712 | (function () {
|
29713 | var NodeType,
|
29714 | WriterState,
|
29715 | XMLCData,
|
29716 | XMLComment,
|
29717 | XMLDTDAttList,
|
29718 | XMLDTDElement,
|
29719 | XMLDTDEntity,
|
29720 | XMLDTDNotation,
|
29721 | XMLDeclaration,
|
29722 | XMLDocType,
|
29723 | XMLDummy,
|
29724 | XMLElement,
|
29725 | XMLProcessingInstruction,
|
29726 | XMLRaw,
|
29727 | XMLText,
|
29728 | XMLWriterBase,
|
29729 | assign,
|
29730 | hasProp = {}.hasOwnProperty;
|
29731 |
|
29732 | assign = require('./Utility').assign;
|
29733 |
|
29734 | NodeType = require('./NodeType');
|
29735 |
|
29736 | XMLDeclaration = require('./XMLDeclaration');
|
29737 |
|
29738 | XMLDocType = require('./XMLDocType');
|
29739 |
|
29740 | XMLCData = require('./XMLCData');
|
29741 |
|
29742 | XMLComment = require('./XMLComment');
|
29743 |
|
29744 | XMLElement = require('./XMLElement');
|
29745 |
|
29746 | XMLRaw = require('./XMLRaw');
|
29747 |
|
29748 | XMLText = require('./XMLText');
|
29749 |
|
29750 | XMLProcessingInstruction = require('./XMLProcessingInstruction');
|
29751 |
|
29752 | XMLDummy = require('./XMLDummy');
|
29753 |
|
29754 | XMLDTDAttList = require('./XMLDTDAttList');
|
29755 |
|
29756 | XMLDTDElement = require('./XMLDTDElement');
|
29757 |
|
29758 | XMLDTDEntity = require('./XMLDTDEntity');
|
29759 |
|
29760 | XMLDTDNotation = require('./XMLDTDNotation');
|
29761 |
|
29762 | WriterState = require('./WriterState');
|
29763 |
|
29764 | module.exports = XMLWriterBase = function () {
|
29765 | function XMLWriterBase(options) {
|
29766 | var key, ref, value;
|
29767 | options || (options = {});
|
29768 | this.options = options;
|
29769 | ref = options.writer || {};
|
29770 | for (key in ref) {
|
29771 | if (!hasProp.call(ref, key)) continue;
|
29772 | value = ref[key];
|
29773 | this["_" + key] = this[key];
|
29774 | this[key] = value;
|
29775 | }
|
29776 | }
|
29777 |
|
29778 | XMLWriterBase.prototype.filterOptions = function (options) {
|
29779 | var filteredOptions, ref, ref1, ref2, ref3, ref4, ref5, ref6;
|
29780 | options || (options = {});
|
29781 | options = assign({}, this.options, options);
|
29782 | filteredOptions = {
|
29783 | writer: this
|
29784 | };
|
29785 | filteredOptions.pretty = options.pretty || false;
|
29786 | filteredOptions.allowEmpty = options.allowEmpty || false;
|
29787 | filteredOptions.indent = (ref = options.indent) != null ? ref : ' ';
|
29788 | filteredOptions.newline = (ref1 = options.newline) != null ? ref1 : '\n';
|
29789 | filteredOptions.offset = (ref2 = options.offset) != null ? ref2 : 0;
|
29790 | filteredOptions.dontPrettyTextNodes = (ref3 = (ref4 = options.dontPrettyTextNodes) != null ? ref4 : options.dontprettytextnodes) != null ? ref3 : 0;
|
29791 | filteredOptions.spaceBeforeSlash = (ref5 = (ref6 = options.spaceBeforeSlash) != null ? ref6 : options.spacebeforeslash) != null ? ref5 : '';
|
29792 | if (filteredOptions.spaceBeforeSlash === true) {
|
29793 | filteredOptions.spaceBeforeSlash = ' ';
|
29794 | }
|
29795 | filteredOptions.suppressPrettyCount = 0;
|
29796 | filteredOptions.user = {};
|
29797 | filteredOptions.state = WriterState.None;
|
29798 | return filteredOptions;
|
29799 | };
|
29800 |
|
29801 | XMLWriterBase.prototype.indent = function (node, options, level) {
|
29802 | var indentLevel;
|
29803 | if (!options.pretty || options.suppressPrettyCount) {
|
29804 | return '';
|
29805 | } else if (options.pretty) {
|
29806 | indentLevel = (level || 0) + options.offset + 1;
|
29807 | if (indentLevel > 0) {
|
29808 | return new Array(indentLevel).join(options.indent);
|
29809 | }
|
29810 | }
|
29811 | return '';
|
29812 | };
|
29813 |
|
29814 | XMLWriterBase.prototype.endline = function (node, options, level) {
|
29815 | if (!options.pretty || options.suppressPrettyCount) {
|
29816 | return '';
|
29817 | } else {
|
29818 | return options.newline;
|
29819 | }
|
29820 | };
|
29821 |
|
29822 | XMLWriterBase.prototype.attribute = function (att, options, level) {
|
29823 | var r;
|
29824 | this.openAttribute(att, options, level);
|
29825 | r = ' ' + att.name + '="' + att.value + '"';
|
29826 | this.closeAttribute(att, options, level);
|
29827 | return r;
|
29828 | };
|
29829 |
|
29830 | XMLWriterBase.prototype.cdata = function (node, options, level) {
|
29831 | var r;
|
29832 | this.openNode(node, options, level);
|
29833 | options.state = WriterState.OpenTag;
|
29834 | r = this.indent(node, options, level) + '<![CDATA[';
|
29835 | options.state = WriterState.InsideTag;
|
29836 | r += node.value;
|
29837 | options.state = WriterState.CloseTag;
|
29838 | r += ']]>' + this.endline(node, options, level);
|
29839 | options.state = WriterState.None;
|
29840 | this.closeNode(node, options, level);
|
29841 | return r;
|
29842 | };
|
29843 |
|
29844 | XMLWriterBase.prototype.comment = function (node, options, level) {
|
29845 | var r;
|
29846 | this.openNode(node, options, level);
|
29847 | options.state = WriterState.OpenTag;
|
29848 | r = this.indent(node, options, level) + '<!-- ';
|
29849 | options.state = WriterState.InsideTag;
|
29850 | r += node.value;
|
29851 | options.state = WriterState.CloseTag;
|
29852 | r += ' -->' + this.endline(node, options, level);
|
29853 | options.state = WriterState.None;
|
29854 | this.closeNode(node, options, level);
|
29855 | return r;
|
29856 | };
|
29857 |
|
29858 | XMLWriterBase.prototype.declaration = function (node, options, level) {
|
29859 | var r;
|
29860 | this.openNode(node, options, level);
|
29861 | options.state = WriterState.OpenTag;
|
29862 | r = this.indent(node, options, level) + '<?xml';
|
29863 | options.state = WriterState.InsideTag;
|
29864 | r += ' version="' + node.version + '"';
|
29865 | if (node.encoding != null) {
|
29866 | r += ' encoding="' + node.encoding + '"';
|
29867 | }
|
29868 | if (node.standalone != null) {
|
29869 | r += ' standalone="' + node.standalone + '"';
|
29870 | }
|
29871 | options.state = WriterState.CloseTag;
|
29872 | r += options.spaceBeforeSlash + '?>';
|
29873 | r += this.endline(node, options, level);
|
29874 | options.state = WriterState.None;
|
29875 | this.closeNode(node, options, level);
|
29876 | return r;
|
29877 | };
|
29878 |
|
29879 | XMLWriterBase.prototype.docType = function (node, options, level) {
|
29880 | var child, i, len, r, ref;
|
29881 | level || (level = 0);
|
29882 | this.openNode(node, options, level);
|
29883 | options.state = WriterState.OpenTag;
|
29884 | r = this.indent(node, options, level);
|
29885 | r += '<!DOCTYPE ' + node.root().name;
|
29886 | if (node.pubID && node.sysID) {
|
29887 | r += ' PUBLIC "' + node.pubID + '" "' + node.sysID + '"';
|
29888 | } else if (node.sysID) {
|
29889 | r += ' SYSTEM "' + node.sysID + '"';
|
29890 | }
|
29891 | if (node.children.length > 0) {
|
29892 | r += ' [';
|
29893 | r += this.endline(node, options, level);
|
29894 | options.state = WriterState.InsideTag;
|
29895 | ref = node.children;
|
29896 | for (i = 0, len = ref.length; i < len; i++) {
|
29897 | child = ref[i];
|
29898 | r += this.writeChildNode(child, options, level + 1);
|
29899 | }
|
29900 | options.state = WriterState.CloseTag;
|
29901 | r += ']';
|
29902 | }
|
29903 | options.state = WriterState.CloseTag;
|
29904 | r += options.spaceBeforeSlash + '>';
|
29905 | r += this.endline(node, options, level);
|
29906 | options.state = WriterState.None;
|
29907 | this.closeNode(node, options, level);
|
29908 | return r;
|
29909 | };
|
29910 |
|
29911 | XMLWriterBase.prototype.element = function (node, options, level) {
|
29912 | var att, child, childNodeCount, firstChildNode, i, j, len, len1, name, prettySuppressed, r, ref, ref1, ref2;
|
29913 | level || (level = 0);
|
29914 | prettySuppressed = false;
|
29915 | r = '';
|
29916 | this.openNode(node, options, level);
|
29917 | options.state = WriterState.OpenTag;
|
29918 | r += this.indent(node, options, level) + '<' + node.name;
|
29919 | ref = node.attribs;
|
29920 | for (name in ref) {
|
29921 | if (!hasProp.call(ref, name)) continue;
|
29922 | att = ref[name];
|
29923 | r += this.attribute(att, options, level);
|
29924 | }
|
29925 | childNodeCount = node.children.length;
|
29926 | firstChildNode = childNodeCount === 0 ? null : node.children[0];
|
29927 | if (childNodeCount === 0 || node.children.every(function (e) {
|
29928 | return (e.type === NodeType.Text || e.type === NodeType.Raw) && e.value === '';
|
29929 | })) {
|
29930 | if (options.allowEmpty) {
|
29931 | r += '>';
|
29932 | options.state = WriterState.CloseTag;
|
29933 | r += '</' + node.name + '>' + this.endline(node, options, level);
|
29934 | } else {
|
29935 | options.state = WriterState.CloseTag;
|
29936 | r += options.spaceBeforeSlash + '/>' + this.endline(node, options, level);
|
29937 | }
|
29938 | } else if (options.pretty && childNodeCount === 1 && (firstChildNode.type === NodeType.Text || firstChildNode.type === NodeType.Raw) && firstChildNode.value != null) {
|
29939 | r += '>';
|
29940 | options.state = WriterState.InsideTag;
|
29941 | options.suppressPrettyCount++;
|
29942 | prettySuppressed = true;
|
29943 | r += this.writeChildNode(firstChildNode, options, level + 1);
|
29944 | options.suppressPrettyCount--;
|
29945 | prettySuppressed = false;
|
29946 | options.state = WriterState.CloseTag;
|
29947 | r += '</' + node.name + '>' + this.endline(node, options, level);
|
29948 | } else {
|
29949 | if (options.dontPrettyTextNodes) {
|
29950 | ref1 = node.children;
|
29951 | for (i = 0, len = ref1.length; i < len; i++) {
|
29952 | child = ref1[i];
|
29953 | if ((child.type === NodeType.Text || child.type === NodeType.Raw) && child.value != null) {
|
29954 | options.suppressPrettyCount++;
|
29955 | prettySuppressed = true;
|
29956 | break;
|
29957 | }
|
29958 | }
|
29959 | }
|
29960 | r += '>' + this.endline(node, options, level);
|
29961 | options.state = WriterState.InsideTag;
|
29962 | ref2 = node.children;
|
29963 | for (j = 0, len1 = ref2.length; j < len1; j++) {
|
29964 | child = ref2[j];
|
29965 | r += this.writeChildNode(child, options, level + 1);
|
29966 | }
|
29967 | options.state = WriterState.CloseTag;
|
29968 | r += this.indent(node, options, level) + '</' + node.name + '>';
|
29969 | if (prettySuppressed) {
|
29970 | options.suppressPrettyCount--;
|
29971 | }
|
29972 | r += this.endline(node, options, level);
|
29973 | options.state = WriterState.None;
|
29974 | }
|
29975 | this.closeNode(node, options, level);
|
29976 | return r;
|
29977 | };
|
29978 |
|
29979 | XMLWriterBase.prototype.writeChildNode = function (node, options, level) {
|
29980 | switch (node.type) {
|
29981 | case NodeType.CData:
|
29982 | return this.cdata(node, options, level);
|
29983 | case NodeType.Comment:
|
29984 | return this.comment(node, options, level);
|
29985 | case NodeType.Element:
|
29986 | return this.element(node, options, level);
|
29987 | case NodeType.Raw:
|
29988 | return this.raw(node, options, level);
|
29989 | case NodeType.Text:
|
29990 | return this.text(node, options, level);
|
29991 | case NodeType.ProcessingInstruction:
|
29992 | return this.processingInstruction(node, options, level);
|
29993 | case NodeType.Dummy:
|
29994 | return '';
|
29995 | case NodeType.Declaration:
|
29996 | return this.declaration(node, options, level);
|
29997 | case NodeType.DocType:
|
29998 | return this.docType(node, options, level);
|
29999 | case NodeType.AttributeDeclaration:
|
30000 | return this.dtdAttList(node, options, level);
|
30001 | case NodeType.ElementDeclaration:
|
30002 | return this.dtdElement(node, options, level);
|
30003 | case NodeType.EntityDeclaration:
|
30004 | return this.dtdEntity(node, options, level);
|
30005 | case NodeType.NotationDeclaration:
|
30006 | return this.dtdNotation(node, options, level);
|
30007 | default:
|
30008 | throw new Error("Unknown XML node type: " + node.constructor.name);
|
30009 | }
|
30010 | };
|
30011 |
|
30012 | XMLWriterBase.prototype.processingInstruction = function (node, options, level) {
|
30013 | var r;
|
30014 | this.openNode(node, options, level);
|
30015 | options.state = WriterState.OpenTag;
|
30016 | r = this.indent(node, options, level) + '<?';
|
30017 | options.state = WriterState.InsideTag;
|
30018 | r += node.target;
|
30019 | if (node.value) {
|
30020 | r += ' ' + node.value;
|
30021 | }
|
30022 | options.state = WriterState.CloseTag;
|
30023 | r += options.spaceBeforeSlash + '?>';
|
30024 | r += this.endline(node, options, level);
|
30025 | options.state = WriterState.None;
|
30026 | this.closeNode(node, options, level);
|
30027 | return r;
|
30028 | };
|
30029 |
|
30030 | XMLWriterBase.prototype.raw = function (node, options, level) {
|
30031 | var r;
|
30032 | this.openNode(node, options, level);
|
30033 | options.state = WriterState.OpenTag;
|
30034 | r = this.indent(node, options, level);
|
30035 | options.state = WriterState.InsideTag;
|
30036 | r += node.value;
|
30037 | options.state = WriterState.CloseTag;
|
30038 | r += this.endline(node, options, level);
|
30039 | options.state = WriterState.None;
|
30040 | this.closeNode(node, options, level);
|
30041 | return r;
|
30042 | };
|
30043 |
|
30044 | XMLWriterBase.prototype.text = function (node, options, level) {
|
30045 | var r;
|
30046 | this.openNode(node, options, level);
|
30047 | options.state = WriterState.OpenTag;
|
30048 | r = this.indent(node, options, level);
|
30049 | options.state = WriterState.InsideTag;
|
30050 | r += node.value;
|
30051 | options.state = WriterState.CloseTag;
|
30052 | r += this.endline(node, options, level);
|
30053 | options.state = WriterState.None;
|
30054 | this.closeNode(node, options, level);
|
30055 | return r;
|
30056 | };
|
30057 |
|
30058 | XMLWriterBase.prototype.dtdAttList = function (node, options, level) {
|
30059 | var r;
|
30060 | this.openNode(node, options, level);
|
30061 | options.state = WriterState.OpenTag;
|
30062 | r = this.indent(node, options, level) + '<!ATTLIST';
|
30063 | options.state = WriterState.InsideTag;
|
30064 | r += ' ' + node.elementName + ' ' + node.attributeName + ' ' + node.attributeType;
|
30065 | if (node.defaultValueType !== '#DEFAULT') {
|
30066 | r += ' ' + node.defaultValueType;
|
30067 | }
|
30068 | if (node.defaultValue) {
|
30069 | r += ' "' + node.defaultValue + '"';
|
30070 | }
|
30071 | options.state = WriterState.CloseTag;
|
30072 | r += options.spaceBeforeSlash + '>' + this.endline(node, options, level);
|
30073 | options.state = WriterState.None;
|
30074 | this.closeNode(node, options, level);
|
30075 | return r;
|
30076 | };
|
30077 |
|
30078 | XMLWriterBase.prototype.dtdElement = function (node, options, level) {
|
30079 | var r;
|
30080 | this.openNode(node, options, level);
|
30081 | options.state = WriterState.OpenTag;
|
30082 | r = this.indent(node, options, level) + '<!ELEMENT';
|
30083 | options.state = WriterState.InsideTag;
|
30084 | r += ' ' + node.name + ' ' + node.value;
|
30085 | options.state = WriterState.CloseTag;
|
30086 | r += options.spaceBeforeSlash + '>' + this.endline(node, options, level);
|
30087 | options.state = WriterState.None;
|
30088 | this.closeNode(node, options, level);
|
30089 | return r;
|
30090 | };
|
30091 |
|
30092 | XMLWriterBase.prototype.dtdEntity = function (node, options, level) {
|
30093 | var r;
|
30094 | this.openNode(node, options, level);
|
30095 | options.state = WriterState.OpenTag;
|
30096 | r = this.indent(node, options, level) + '<!ENTITY';
|
30097 | options.state = WriterState.InsideTag;
|
30098 | if (node.pe) {
|
30099 | r += ' %';
|
30100 | }
|
30101 | r += ' ' + node.name;
|
30102 | if (node.value) {
|
30103 | r += ' "' + node.value + '"';
|
30104 | } else {
|
30105 | if (node.pubID && node.sysID) {
|
30106 | r += ' PUBLIC "' + node.pubID + '" "' + node.sysID + '"';
|
30107 | } else if (node.sysID) {
|
30108 | r += ' SYSTEM "' + node.sysID + '"';
|
30109 | }
|
30110 | if (node.nData) {
|
30111 | r += ' NDATA ' + node.nData;
|
30112 | }
|
30113 | }
|
30114 | options.state = WriterState.CloseTag;
|
30115 | r += options.spaceBeforeSlash + '>' + this.endline(node, options, level);
|
30116 | options.state = WriterState.None;
|
30117 | this.closeNode(node, options, level);
|
30118 | return r;
|
30119 | };
|
30120 |
|
30121 | XMLWriterBase.prototype.dtdNotation = function (node, options, level) {
|
30122 | var r;
|
30123 | this.openNode(node, options, level);
|
30124 | options.state = WriterState.OpenTag;
|
30125 | r = this.indent(node, options, level) + '<!NOTATION';
|
30126 | options.state = WriterState.InsideTag;
|
30127 | r += ' ' + node.name;
|
30128 | if (node.pubID && node.sysID) {
|
30129 | r += ' PUBLIC "' + node.pubID + '" "' + node.sysID + '"';
|
30130 | } else if (node.pubID) {
|
30131 | r += ' PUBLIC "' + node.pubID + '"';
|
30132 | } else if (node.sysID) {
|
30133 | r += ' SYSTEM "' + node.sysID + '"';
|
30134 | }
|
30135 | options.state = WriterState.CloseTag;
|
30136 | r += options.spaceBeforeSlash + '>' + this.endline(node, options, level);
|
30137 | options.state = WriterState.None;
|
30138 | this.closeNode(node, options, level);
|
30139 | return r;
|
30140 | };
|
30141 |
|
30142 | XMLWriterBase.prototype.openNode = function (node, options, level) {};
|
30143 |
|
30144 | XMLWriterBase.prototype.closeNode = function (node, options, level) {};
|
30145 |
|
30146 | XMLWriterBase.prototype.openAttribute = function (att, options, level) {};
|
30147 |
|
30148 | XMLWriterBase.prototype.closeAttribute = function (att, options, level) {};
|
30149 |
|
30150 | return XMLWriterBase;
|
30151 | }();
|
30152 | }).call(undefined);
|
30153 |
|
30154 | },{"./NodeType":295,"./Utility":296,"./WriterState":297,"./XMLCData":299,"./XMLComment":301,"./XMLDTDAttList":306,"./XMLDTDElement":307,"./XMLDTDEntity":308,"./XMLDTDNotation":309,"./XMLDeclaration":310,"./XMLDocType":311,"./XMLDummy":314,"./XMLElement":315,"./XMLProcessingInstruction":319,"./XMLRaw":320,"./XMLText":324}],326:[function(require,module,exports){
|
30155 | 'use strict';
|
30156 |
|
30157 |
|
30158 | (function () {
|
30159 | var NodeType, WriterState, XMLDOMImplementation, XMLDocument, XMLDocumentCB, XMLStreamWriter, XMLStringWriter, assign, isFunction, ref;
|
30160 |
|
30161 | ref = require('./Utility'), assign = ref.assign, isFunction = ref.isFunction;
|
30162 |
|
30163 | XMLDOMImplementation = require('./XMLDOMImplementation');
|
30164 |
|
30165 | XMLDocument = require('./XMLDocument');
|
30166 |
|
30167 | XMLDocumentCB = require('./XMLDocumentCB');
|
30168 |
|
30169 | XMLStringWriter = require('./XMLStringWriter');
|
30170 |
|
30171 | XMLStreamWriter = require('./XMLStreamWriter');
|
30172 |
|
30173 | NodeType = require('./NodeType');
|
30174 |
|
30175 | WriterState = require('./WriterState');
|
30176 |
|
30177 | module.exports.create = function (name, xmldec, doctype, options) {
|
30178 | var doc, root;
|
30179 | if (name == null) {
|
30180 | throw new Error("Root element needs a name.");
|
30181 | }
|
30182 | options = assign({}, xmldec, doctype, options);
|
30183 | doc = new XMLDocument(options);
|
30184 | root = doc.element(name);
|
30185 | if (!options.headless) {
|
30186 | doc.declaration(options);
|
30187 | if (options.pubID != null || options.sysID != null) {
|
30188 | doc.dtd(options);
|
30189 | }
|
30190 | }
|
30191 | return root;
|
30192 | };
|
30193 |
|
30194 | module.exports.begin = function (options, onData, onEnd) {
|
30195 | var ref1;
|
30196 | if (isFunction(options)) {
|
30197 | ref1 = [options, onData], onData = ref1[0], onEnd = ref1[1];
|
30198 | options = {};
|
30199 | }
|
30200 | if (onData) {
|
30201 | return new XMLDocumentCB(options, onData, onEnd);
|
30202 | } else {
|
30203 | return new XMLDocument(options);
|
30204 | }
|
30205 | };
|
30206 |
|
30207 | module.exports.stringWriter = function (options) {
|
30208 | return new XMLStringWriter(options);
|
30209 | };
|
30210 |
|
30211 | module.exports.streamWriter = function (stream, options) {
|
30212 | return new XMLStreamWriter(stream, options);
|
30213 | };
|
30214 |
|
30215 | module.exports.implementation = new XMLDOMImplementation();
|
30216 |
|
30217 | module.exports.nodeType = NodeType;
|
30218 |
|
30219 | module.exports.writerState = WriterState;
|
30220 | }).call(undefined);
|
30221 |
|
30222 | },{"./NodeType":295,"./Utility":296,"./WriterState":297,"./XMLDOMImplementation":304,"./XMLDocument":312,"./XMLDocumentCB":313,"./XMLStreamWriter":321,"./XMLStringWriter":322}],327:[function(require,module,exports){
|
30223 | module.exports = extend
|
30224 |
|
30225 | var hasOwnProperty = Object.prototype.hasOwnProperty;
|
30226 |
|
30227 | function extend() {
|
30228 | var target = {}
|
30229 |
|
30230 | for (var i = 0; i < arguments.length; i++) {
|
30231 | var source = arguments[i]
|
30232 |
|
30233 | for (var key in source) {
|
30234 | if (hasOwnProperty.call(source, key)) {
|
30235 | target[key] = source[key]
|
30236 | }
|
30237 | }
|
30238 | }
|
30239 |
|
30240 | return target
|
30241 | }
|
30242 |
|
30243 | },{}],328:[function(require,module,exports){
|
30244 | 'use strict';
|
30245 |
|
30246 | var Buffer = require('buffer').Buffer;
|
30247 | var sha = require('./sha');
|
30248 | var md5 = require('./md5');
|
30249 |
|
30250 | var algorithms = {
|
30251 | sha1: sha,
|
30252 | md5: md5
|
30253 | };
|
30254 |
|
30255 | var blocksize = 64;
|
30256 | var zeroBuffer = Buffer.alloc(blocksize);
|
30257 | zeroBuffer.fill(0);
|
30258 |
|
30259 | function hmac(fn, key, data) {
|
30260 | if (!Buffer.isBuffer(key)) key = Buffer.from(key);
|
30261 | if (!Buffer.isBuffer(data)) data = Buffer.from(data);
|
30262 |
|
30263 | if (key.length > blocksize) {
|
30264 | key = fn(key);
|
30265 | } else if (key.length < blocksize) {
|
30266 | key = Buffer.concat([key, zeroBuffer], blocksize);
|
30267 | }
|
30268 |
|
30269 | var ipad = Buffer.alloc(blocksize),
|
30270 | opad = Buffer.alloc(blocksize);
|
30271 | for (var i = 0; i < blocksize; i++) {
|
30272 | ipad[i] = key[i] ^ 0x36;
|
30273 | opad[i] = key[i] ^ 0x5C;
|
30274 | }
|
30275 |
|
30276 | var hash = fn(Buffer.concat([ipad, data]));
|
30277 | return fn(Buffer.concat([opad, hash]));
|
30278 | }
|
30279 |
|
30280 | function hash(alg, key) {
|
30281 | alg = alg || 'sha1';
|
30282 | var fn = algorithms[alg];
|
30283 | var bufs = [];
|
30284 | var length = 0;
|
30285 | if (!fn) error('algorithm:', alg, 'is not yet supported');
|
30286 | return {
|
30287 | update: function update(data) {
|
30288 | if (!Buffer.isBuffer(data)) data = Buffer.from(data);
|
30289 |
|
30290 | bufs.push(data);
|
30291 | length += data.length;
|
30292 | return this;
|
30293 | },
|
30294 | digest: function digest(enc) {
|
30295 | var buf = Buffer.concat(bufs);
|
30296 | var r = key ? hmac(fn, key, buf) : fn(buf);
|
30297 | bufs = null;
|
30298 | return enc ? r.toString(enc) : r;
|
30299 | }
|
30300 | };
|
30301 | }
|
30302 |
|
30303 | function error() {
|
30304 | var m = [].slice.call(arguments).join(' ');
|
30305 | throw new Error([m, 'we accept pull requests', 'http://github.com/dominictarr/crypto-browserify'].join('\n'));
|
30306 | }
|
30307 |
|
30308 | exports.createHash = function (alg) {
|
30309 | return hash(alg);
|
30310 | };
|
30311 | exports.createHmac = function (alg, key) {
|
30312 | return hash(alg, key);
|
30313 | };
|
30314 |
|
30315 | function each(a, f) {
|
30316 | for (var i in a) {
|
30317 | f(a[i], i);
|
30318 | }
|
30319 | }
|
30320 |
|
30321 |
|
30322 | each(['createCredentials', 'createCipher', 'createCipheriv', 'createDecipher', 'createDecipheriv', 'createSign', 'createVerify', 'createDiffieHellman', 'pbkdf2'], function (name) {
|
30323 | exports[name] = function () {
|
30324 | error('sorry,', name, 'is not implemented yet');
|
30325 | };
|
30326 | });
|
30327 |
|
30328 | },{"./md5":330,"./sha":331,"buffer":70}],329:[function(require,module,exports){
|
30329 | 'use strict';
|
30330 |
|
30331 | var Buffer = require('buffer').Buffer;
|
30332 | var intSize = 4;
|
30333 | var zeroBuffer = Buffer.alloc(intSize);zeroBuffer.fill(0);
|
30334 | var chrsz = 8;
|
30335 |
|
30336 | function toArray(buf, bigEndian) {
|
30337 | if (buf.length % intSize !== 0) {
|
30338 | var len = buf.length + (intSize - buf.length % intSize);
|
30339 | buf = Buffer.concat([buf, zeroBuffer], len);
|
30340 | }
|
30341 |
|
30342 | var arr = [];
|
30343 | var fn = bigEndian ? buf.readInt32BE : buf.readInt32LE;
|
30344 | for (var i = 0; i < buf.length; i += intSize) {
|
30345 | arr.push(fn.call(buf, i));
|
30346 | }
|
30347 | return arr;
|
30348 | }
|
30349 |
|
30350 | function toBuffer(arr, size, bigEndian) {
|
30351 | var buf = Buffer.alloc(size);
|
30352 | var fn = bigEndian ? buf.writeInt32BE : buf.writeInt32LE;
|
30353 | for (var i = 0; i < arr.length; i++) {
|
30354 | fn.call(buf, arr[i], i * 4, true);
|
30355 | }
|
30356 | return buf;
|
30357 | }
|
30358 |
|
30359 | function hash(buf, fn, hashSize, bigEndian) {
|
30360 | if (!Buffer.isBuffer(buf)) buf = Buffer.from(buf);
|
30361 | var arr = fn(toArray(buf, bigEndian), buf.length * chrsz);
|
30362 | return toBuffer(arr, hashSize, bigEndian);
|
30363 | }
|
30364 |
|
30365 | module.exports = { hash: hash };
|
30366 |
|
30367 | },{"buffer":70}],330:[function(require,module,exports){
|
30368 | "use strict";
|
30369 |
|
30370 |
|
30371 |
|
30372 |
|
30373 |
|
30374 |
|
30375 |
|
30376 |
|
30377 |
|
30378 |
|
30379 | var helpers = require('./helpers');
|
30380 |
|
30381 |
|
30382 |
|
30383 |
|
30384 | function md5_vm_test() {
|
30385 | return hex_md5("abc") == "900150983cd24fb0d6963f7d28e17f72";
|
30386 | }
|
30387 |
|
30388 |
|
30389 |
|
30390 |
|
30391 | function core_md5(x, len) {
|
30392 |
|
30393 | x[len >> 5] |= 0x80 << len % 32;
|
30394 | x[(len + 64 >>> 9 << 4) + 14] = len;
|
30395 |
|
30396 | var a = 1732584193;
|
30397 | var b = -271733879;
|
30398 | var c = -1732584194;
|
30399 | var d = 271733878;
|
30400 |
|
30401 | for (var i = 0; i < x.length; i += 16) {
|
30402 | var olda = a;
|
30403 | var oldb = b;
|
30404 | var oldc = c;
|
30405 | var oldd = d;
|
30406 |
|
30407 | a = md5_ff(a, b, c, d, x[i + 0], 7, -680876936);
|
30408 | d = md5_ff(d, a, b, c, x[i + 1], 12, -389564586);
|
30409 | c = md5_ff(c, d, a, b, x[i + 2], 17, 606105819);
|
30410 | b = md5_ff(b, c, d, a, x[i + 3], 22, -1044525330);
|
30411 | a = md5_ff(a, b, c, d, x[i + 4], 7, -176418897);
|
30412 | d = md5_ff(d, a, b, c, x[i + 5], 12, 1200080426);
|
30413 | c = md5_ff(c, d, a, b, x[i + 6], 17, -1473231341);
|
30414 | b = md5_ff(b, c, d, a, x[i + 7], 22, -45705983);
|
30415 | a = md5_ff(a, b, c, d, x[i + 8], 7, 1770035416);
|
30416 | d = md5_ff(d, a, b, c, x[i + 9], 12, -1958414417);
|
30417 | c = md5_ff(c, d, a, b, x[i + 10], 17, -42063);
|
30418 | b = md5_ff(b, c, d, a, x[i + 11], 22, -1990404162);
|
30419 | a = md5_ff(a, b, c, d, x[i + 12], 7, 1804603682);
|
30420 | d = md5_ff(d, a, b, c, x[i + 13], 12, -40341101);
|
30421 | c = md5_ff(c, d, a, b, x[i + 14], 17, -1502002290);
|
30422 | b = md5_ff(b, c, d, a, x[i + 15], 22, 1236535329);
|
30423 |
|
30424 | a = md5_gg(a, b, c, d, x[i + 1], 5, -165796510);
|
30425 | d = md5_gg(d, a, b, c, x[i + 6], 9, -1069501632);
|
30426 | c = md5_gg(c, d, a, b, x[i + 11], 14, 643717713);
|
30427 | b = md5_gg(b, c, d, a, x[i + 0], 20, -373897302);
|
30428 | a = md5_gg(a, b, c, d, x[i + 5], 5, -701558691);
|
30429 | d = md5_gg(d, a, b, c, x[i + 10], 9, 38016083);
|
30430 | c = md5_gg(c, d, a, b, x[i + 15], 14, -660478335);
|
30431 | b = md5_gg(b, c, d, a, x[i + 4], 20, -405537848);
|
30432 | a = md5_gg(a, b, c, d, x[i + 9], 5, 568446438);
|
30433 | d = md5_gg(d, a, b, c, x[i + 14], 9, -1019803690);
|
30434 | c = md5_gg(c, d, a, b, x[i + 3], 14, -187363961);
|
30435 | b = md5_gg(b, c, d, a, x[i + 8], 20, 1163531501);
|
30436 | a = md5_gg(a, b, c, d, x[i + 13], 5, -1444681467);
|
30437 | d = md5_gg(d, a, b, c, x[i + 2], 9, -51403784);
|
30438 | c = md5_gg(c, d, a, b, x[i + 7], 14, 1735328473);
|
30439 | b = md5_gg(b, c, d, a, x[i + 12], 20, -1926607734);
|
30440 |
|
30441 | a = md5_hh(a, b, c, d, x[i + 5], 4, -378558);
|
30442 | d = md5_hh(d, a, b, c, x[i + 8], 11, -2022574463);
|
30443 | c = md5_hh(c, d, a, b, x[i + 11], 16, 1839030562);
|
30444 | b = md5_hh(b, c, d, a, x[i + 14], 23, -35309556);
|
30445 | a = md5_hh(a, b, c, d, x[i + 1], 4, -1530992060);
|
30446 | d = md5_hh(d, a, b, c, x[i + 4], 11, 1272893353);
|
30447 | c = md5_hh(c, d, a, b, x[i + 7], 16, -155497632);
|
30448 | b = md5_hh(b, c, d, a, x[i + 10], 23, -1094730640);
|
30449 | a = md5_hh(a, b, c, d, x[i + 13], 4, 681279174);
|
30450 | d = md5_hh(d, a, b, c, x[i + 0], 11, -358537222);
|
30451 | c = md5_hh(c, d, a, b, x[i + 3], 16, -722521979);
|
30452 | b = md5_hh(b, c, d, a, x[i + 6], 23, 76029189);
|
30453 | a = md5_hh(a, b, c, d, x[i + 9], 4, -640364487);
|
30454 | d = md5_hh(d, a, b, c, x[i + 12], 11, -421815835);
|
30455 | c = md5_hh(c, d, a, b, x[i + 15], 16, 530742520);
|
30456 | b = md5_hh(b, c, d, a, x[i + 2], 23, -995338651);
|
30457 |
|
30458 | a = md5_ii(a, b, c, d, x[i + 0], 6, -198630844);
|
30459 | d = md5_ii(d, a, b, c, x[i + 7], 10, 1126891415);
|
30460 | c = md5_ii(c, d, a, b, x[i + 14], 15, -1416354905);
|
30461 | b = md5_ii(b, c, d, a, x[i + 5], 21, -57434055);
|
30462 | a = md5_ii(a, b, c, d, x[i + 12], 6, 1700485571);
|
30463 | d = md5_ii(d, a, b, c, x[i + 3], 10, -1894986606);
|
30464 | c = md5_ii(c, d, a, b, x[i + 10], 15, -1051523);
|
30465 | b = md5_ii(b, c, d, a, x[i + 1], 21, -2054922799);
|
30466 | a = md5_ii(a, b, c, d, x[i + 8], 6, 1873313359);
|
30467 | d = md5_ii(d, a, b, c, x[i + 15], 10, -30611744);
|
30468 | c = md5_ii(c, d, a, b, x[i + 6], 15, -1560198380);
|
30469 | b = md5_ii(b, c, d, a, x[i + 13], 21, 1309151649);
|
30470 | a = md5_ii(a, b, c, d, x[i + 4], 6, -145523070);
|
30471 | d = md5_ii(d, a, b, c, x[i + 11], 10, -1120210379);
|
30472 | c = md5_ii(c, d, a, b, x[i + 2], 15, 718787259);
|
30473 | b = md5_ii(b, c, d, a, x[i + 9], 21, -343485551);
|
30474 |
|
30475 | a = safe_add(a, olda);
|
30476 | b = safe_add(b, oldb);
|
30477 | c = safe_add(c, oldc);
|
30478 | d = safe_add(d, oldd);
|
30479 | }
|
30480 | return Array(a, b, c, d);
|
30481 | }
|
30482 |
|
30483 |
|
30484 |
|
30485 |
|
30486 | function md5_cmn(q, a, b, x, s, t) {
|
30487 | return safe_add(bit_rol(safe_add(safe_add(a, q), safe_add(x, t)), s), b);
|
30488 | }
|
30489 | function md5_ff(a, b, c, d, x, s, t) {
|
30490 | return md5_cmn(b & c | ~b & d, a, b, x, s, t);
|
30491 | }
|
30492 | function md5_gg(a, b, c, d, x, s, t) {
|
30493 | return md5_cmn(b & d | c & ~d, a, b, x, s, t);
|
30494 | }
|
30495 | function md5_hh(a, b, c, d, x, s, t) {
|
30496 | return md5_cmn(b ^ c ^ d, a, b, x, s, t);
|
30497 | }
|
30498 | function md5_ii(a, b, c, d, x, s, t) {
|
30499 | return md5_cmn(c ^ (b | ~d), a, b, x, s, t);
|
30500 | }
|
30501 |
|
30502 |
|
30503 |
|
30504 |
|
30505 |
|
30506 | function safe_add(x, y) {
|
30507 | var lsw = (x & 0xFFFF) + (y & 0xFFFF);
|
30508 | var msw = (x >> 16) + (y >> 16) + (lsw >> 16);
|
30509 | return msw << 16 | lsw & 0xFFFF;
|
30510 | }
|
30511 |
|
30512 |
|
30513 |
|
30514 |
|
30515 | function bit_rol(num, cnt) {
|
30516 | return num << cnt | num >>> 32 - cnt;
|
30517 | }
|
30518 |
|
30519 | module.exports = function md5(buf) {
|
30520 | return helpers.hash(buf, core_md5, 16);
|
30521 | };
|
30522 |
|
30523 | },{"./helpers":329}],331:[function(require,module,exports){
|
30524 | 'use strict';
|
30525 |
|
30526 |
|
30527 |
|
30528 |
|
30529 |
|
30530 |
|
30531 |
|
30532 |
|
30533 |
|
30534 |
|
30535 | var helpers = require('./helpers');
|
30536 |
|
30537 |
|
30538 |
|
30539 |
|
30540 | function core_sha1(x, len) {
|
30541 |
|
30542 | x[len >> 5] |= 0x80 << 24 - len % 32;
|
30543 | x[(len + 64 >> 9 << 4) + 15] = len;
|
30544 |
|
30545 | var w = Array(80);
|
30546 | var a = 1732584193;
|
30547 | var b = -271733879;
|
30548 | var c = -1732584194;
|
30549 | var d = 271733878;
|
30550 | var e = -1009589776;
|
30551 |
|
30552 | for (var i = 0; i < x.length; i += 16) {
|
30553 | var olda = a;
|
30554 | var oldb = b;
|
30555 | var oldc = c;
|
30556 | var oldd = d;
|
30557 | var olde = e;
|
30558 |
|
30559 | for (var j = 0; j < 80; j++) {
|
30560 | 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);
|
30561 | 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)));
|
30562 | e = d;
|
30563 | d = c;
|
30564 | c = rol(b, 30);
|
30565 | b = a;
|
30566 | a = t;
|
30567 | }
|
30568 |
|
30569 | a = safe_add(a, olda);
|
30570 | b = safe_add(b, oldb);
|
30571 | c = safe_add(c, oldc);
|
30572 | d = safe_add(d, oldd);
|
30573 | e = safe_add(e, olde);
|
30574 | }
|
30575 | return Array(a, b, c, d, e);
|
30576 | }
|
30577 |
|
30578 |
|
30579 |
|
30580 |
|
30581 |
|
30582 | function sha1_ft(t, b, c, d) {
|
30583 | if (t < 20) return b & c | ~b & d;
|
30584 | if (t < 40) return b ^ c ^ d;
|
30585 | if (t < 60) return b & c | b & d | c & d;
|
30586 | return b ^ c ^ d;
|
30587 | }
|
30588 |
|
30589 |
|
30590 |
|
30591 |
|
30592 | function sha1_kt(t) {
|
30593 | return t < 20 ? 1518500249 : t < 40 ? 1859775393 : t < 60 ? -1894007588 : -899497514;
|
30594 | }
|
30595 |
|
30596 |
|
30597 |
|
30598 |
|
30599 |
|
30600 | function safe_add(x, y) {
|
30601 | var lsw = (x & 0xFFFF) + (y & 0xFFFF);
|
30602 | var msw = (x >> 16) + (y >> 16) + (lsw >> 16);
|
30603 | return msw << 16 | lsw & 0xFFFF;
|
30604 | }
|
30605 |
|
30606 |
|
30607 |
|
30608 |
|
30609 | function rol(num, cnt) {
|
30610 | return num << cnt | num >>> 32 - cnt;
|
30611 | }
|
30612 |
|
30613 | module.exports = function sha1(buf) {
|
30614 | return helpers.hash(buf, core_sha1, 20, true);
|
30615 | };
|
30616 |
|
30617 | },{"./helpers":329}],332:[function(require,module,exports){
|
30618 | (function (global){
|
30619 | "use strict";
|
30620 |
|
30621 | var _create = require("babel-runtime/core-js/object/create");
|
30622 |
|
30623 | var _create2 = _interopRequireDefault(_create);
|
30624 |
|
30625 | var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck");
|
30626 |
|
30627 | var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
|
30628 |
|
30629 | var _createClass2 = require("babel-runtime/helpers/createClass");
|
30630 |
|
30631 | var _createClass3 = _interopRequireDefault(_createClass2);
|
30632 |
|
30633 | var _typeof2 = require("babel-runtime/helpers/typeof");
|
30634 |
|
30635 | var _typeof3 = _interopRequireDefault(_typeof2);
|
30636 |
|
30637 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
30638 |
|
30639 | (function (f) {
|
30640 | if ((typeof exports === "undefined" ? "undefined" : (0, _typeof3.default)(exports)) === "object" && typeof module !== "undefined") {
|
30641 | module.exports = f();
|
30642 | } else if (typeof define === "function" && define.amd) {
|
30643 | define([], f);
|
30644 | } else {
|
30645 | var g;if (typeof window !== "undefined") {
|
30646 | g = window;
|
30647 | } else if (typeof global !== "undefined") {
|
30648 | g = global;
|
30649 | } else if (typeof self !== "undefined") {
|
30650 | g = self;
|
30651 | } else {
|
30652 | g = this;
|
30653 | }g.mime = f();
|
30654 | }
|
30655 | })(function () {
|
30656 | var define, module, exports;return function e(t, n, r) {
|
30657 | function s(o, u) {
|
30658 | if (!n[o]) {
|
30659 | if (!t[o]) {
|
30660 | var a = typeof require == "function" && require;if (!u && a) return a(o, !0);if (i) return i(o, !0);var f = new Error("Cannot find module '" + o + "'");throw f.code = "MODULE_NOT_FOUND", f;
|
30661 | }var l = n[o] = { exports: {} };t[o][0].call(l.exports, function (e) {
|
30662 | var n = t[o][1][e];return s(n ? n : e);
|
30663 | }, l, l.exports, e, t, n, r);
|
30664 | }return n[o].exports;
|
30665 | }var i = typeof require == "function" && require;for (var o = 0; o < r.length; o++) {
|
30666 | s(r[o]);
|
30667 | }return s;
|
30668 | }({ 1: [function (require, module, exports) {
|
30669 | 'use strict';
|
30670 |
|
30671 | |
30672 |
|
30673 |
|
30674 |
|
30675 |
|
30676 | var Mime = function () {
|
30677 | function Mime() {
|
30678 | (0, _classCallCheck3.default)(this, Mime);
|
30679 |
|
30680 | this._types = (0, _create2.default)(null);
|
30681 | this._extensions = (0, _create2.default)(null);
|
30682 |
|
30683 | for (var i = 0; i < arguments.length; i++) {
|
30684 | this.define(arguments[i]);
|
30685 | }
|
30686 | }
|
30687 |
|
30688 | |
30689 |
|
30690 |
|
30691 |
|
30692 |
|
30693 |
|
30694 |
|
30695 |
|
30696 |
|
30697 |
|
30698 |
|
30699 | (0, _createClass3.default)(Mime, [{
|
30700 | key: "define",
|
30701 | value: function define(typeMap, force) {
|
30702 | for (var type in typeMap) {
|
30703 | var extensions = typeMap[type];
|
30704 | for (var i = 0; i < extensions.length; i++) {
|
30705 | var ext = extensions[i];
|
30706 | if (!force && ext in this._types) {
|
30707 | throw new Error("Attempt to change mapping for \"" + ext + "\" extension from \"" + this._types[ext] + "\" to \"" + type + "\". Pass `force=true` to allow this, otherwise remove \"" + ext + "\" from the list of extensions for \"" + type + "\".");
|
30708 | }
|
30709 |
|
30710 | this._types[ext] = type;
|
30711 | }
|
30712 |
|
30713 |
|
30714 | if (force || !this._extensions[type]) {
|
30715 | this._extensions[type] = extensions[0];
|
30716 | }
|
30717 | }
|
30718 | }
|
30719 |
|
30720 | |
30721 |
|
30722 |
|
30723 |
|
30724 | }, {
|
30725 | key: "getType",
|
30726 | value: function getType(path) {
|
30727 | path = String(path);
|
30728 | var last = path.replace(/^.*[/\\]/, '').toLowerCase();
|
30729 | var ext = last.replace(/^.*\./, '').toLowerCase();
|
30730 |
|
30731 | var hasPath = last.length < path.length;
|
30732 | var hasDot = ext.length < last.length - 1;
|
30733 |
|
30734 | return (hasDot || !hasPath) && this._types[ext] || null;
|
30735 | }
|
30736 |
|
30737 | |
30738 |
|
30739 |
|
30740 |
|
30741 | }, {
|
30742 | key: "getExtension",
|
30743 | value: function getExtension(type) {
|
30744 | type = /^\s*([^;\s]*)/.test(type) && RegExp.$1;
|
30745 | return type && this._extensions[type.toLowerCase()] || null;
|
30746 | }
|
30747 | }]);
|
30748 | return Mime;
|
30749 | }();
|
30750 |
|
30751 | module.exports = Mime;
|
30752 | }, {}], 2: [function (r, module, exports) {
|
30753 | 'use strict';
|
30754 |
|
30755 | var Mime = r('./Mime');
|
30756 | module.exports = new Mime(r('./types/standard'), r('./types/other'));
|
30757 | }, { "./Mime": 1, "./types/other": 3, "./types/standard": 4 }], 3: [function (require, module, exports) {
|
30758 | module.exports = { "application/prs.cww": ["cww"], "application/vnd.3gpp.pic-bw-large": ["plb"], "application/vnd.3gpp.pic-bw-small": ["psb"], "application/vnd.3gpp.pic-bw-var": ["pvb"], "application/vnd.3gpp2.tcap": ["tcap"], "application/vnd.3m.post-it-notes": ["pwn"], "application/vnd.accpac.simply.aso": ["aso"], "application/vnd.accpac.simply.imp": ["imp"], "application/vnd.acucobol": ["acu"], "application/vnd.acucorp": ["atc", "acutc"], "application/vnd.adobe.air-application-installer-package+zip": ["air"], "application/vnd.adobe.formscentral.fcdt": ["fcdt"], "application/vnd.adobe.fxp": ["fxp", "fxpl"], "application/vnd.adobe.xdp+xml": ["xdp"], "application/vnd.adobe.xfdf": ["xfdf"], "application/vnd.ahead.space": ["ahead"], "application/vnd.airzip.filesecure.azf": ["azf"], "application/vnd.airzip.filesecure.azs": ["azs"], "application/vnd.amazon.ebook": ["azw"], "application/vnd.americandynamics.acc": ["acc"], "application/vnd.amiga.ami": ["ami"], "application/vnd.android.package-archive": ["apk"], "application/vnd.anser-web-certificate-issue-initiation": ["cii"], "application/vnd.anser-web-funds-transfer-initiation": ["fti"], "application/vnd.antix.game-component": ["atx"], "application/vnd.apple.installer+xml": ["mpkg"], "application/vnd.apple.mpegurl": ["m3u8"], "application/vnd.apple.pkpass": ["pkpass"], "application/vnd.aristanetworks.swi": ["swi"], "application/vnd.astraea-software.iota": ["iota"], "application/vnd.audiograph": ["aep"], "application/vnd.blueice.multipass": ["mpm"], "application/vnd.bmi": ["bmi"], "application/vnd.businessobjects": ["rep"], "application/vnd.chemdraw+xml": ["cdxml"], "application/vnd.chipnuts.karaoke-mmd": ["mmd"], "application/vnd.cinderella": ["cdy"], "application/vnd.claymore": ["cla"], "application/vnd.cloanto.rp9": ["rp9"], "application/vnd.clonk.c4group": ["c4g", "c4d", "c4f", "c4p", "c4u"], "application/vnd.cluetrust.cartomobile-config": ["c11amc"], "application/vnd.cluetrust.cartomobile-config-pkg": ["c11amz"], "application/vnd.commonspace": ["csp"], "application/vnd.contact.cmsg": ["cdbcmsg"], "application/vnd.cosmocaller": ["cmc"], "application/vnd.crick.clicker": ["clkx"], "application/vnd.crick.clicker.keyboard": ["clkk"], "application/vnd.crick.clicker.palette": ["clkp"], "application/vnd.crick.clicker.template": ["clkt"], "application/vnd.crick.clicker.wordbank": ["clkw"], "application/vnd.criticaltools.wbs+xml": ["wbs"], "application/vnd.ctc-posml": ["pml"], "application/vnd.cups-ppd": ["ppd"], "application/vnd.curl.car": ["car"], "application/vnd.curl.pcurl": ["pcurl"], "application/vnd.dart": ["dart"], "application/vnd.data-vision.rdz": ["rdz"], "application/vnd.dece.data": ["uvf", "uvvf", "uvd", "uvvd"], "application/vnd.dece.ttml+xml": ["uvt", "uvvt"], "application/vnd.dece.unspecified": ["uvx", "uvvx"], "application/vnd.dece.zip": ["uvz", "uvvz"], "application/vnd.denovo.fcselayout-link": ["fe_launch"], "application/vnd.dna": ["dna"], "application/vnd.dolby.mlp": ["mlp"], "application/vnd.dpgraph": ["dpg"], "application/vnd.dreamfactory": ["dfac"], "application/vnd.ds-keypoint": ["kpxx"], "application/vnd.dvb.ait": ["ait"], "application/vnd.dvb.service": ["svc"], "application/vnd.dynageo": ["geo"], "application/vnd.ecowin.chart": ["mag"], "application/vnd.enliven": ["nml"], "application/vnd.epson.esf": ["esf"], "application/vnd.epson.msf": ["msf"], "application/vnd.epson.quickanime": ["qam"], "application/vnd.epson.salt": ["slt"], "application/vnd.epson.ssf": ["ssf"], "application/vnd.eszigno3+xml": ["es3", "et3"], "application/vnd.ezpix-album": ["ez2"], "application/vnd.ezpix-package": ["ez3"], "application/vnd.fdf": ["fdf"], "application/vnd.fdsn.mseed": ["mseed"], "application/vnd.fdsn.seed": ["seed", "dataless"], "application/vnd.flographit": ["gph"], "application/vnd.fluxtime.clip": ["ftc"], "application/vnd.framemaker": ["fm", "frame", "maker", "book"], "application/vnd.frogans.fnc": ["fnc"], "application/vnd.frogans.ltf": ["ltf"], "application/vnd.fsc.weblaunch": ["fsc"], "application/vnd.fujitsu.oasys": ["oas"], "application/vnd.fujitsu.oasys2": ["oa2"], "application/vnd.fujitsu.oasys3": ["oa3"], "application/vnd.fujitsu.oasysgp": ["fg5"], "application/vnd.fujitsu.oasysprs": ["bh2"], "application/vnd.fujixerox.ddd": ["ddd"], "application/vnd.fujixerox.docuworks": ["xdw"], "application/vnd.fujixerox.docuworks.binder": ["xbd"], "application/vnd.fuzzysheet": ["fzs"], "application/vnd.genomatix.tuxedo": ["txd"], "application/vnd.geogebra.file": ["ggb"], "application/vnd.geogebra.tool": ["ggt"], "application/vnd.geometry-explorer": ["gex", "gre"], "application/vnd.geonext": ["gxt"], "application/vnd.geoplan": ["g2w"], "application/vnd.geospace": ["g3w"], "application/vnd.gmx": ["gmx"], "application/vnd.google-apps.document": ["gdoc"], "application/vnd.google-apps.presentation": ["gslides"], "application/vnd.google-apps.spreadsheet": ["gsheet"], "application/vnd.google-earth.kml+xml": ["kml"], "application/vnd.google-earth.kmz": ["kmz"], "application/vnd.grafeq": ["gqf", "gqs"], "application/vnd.groove-account": ["gac"], "application/vnd.groove-help": ["ghf"], "application/vnd.groove-identity-message": ["gim"], "application/vnd.groove-injector": ["grv"], "application/vnd.groove-tool-message": ["gtm"], "application/vnd.groove-tool-template": ["tpl"], "application/vnd.groove-vcard": ["vcg"], "application/vnd.hal+xml": ["hal"], "application/vnd.handheld-entertainment+xml": ["zmm"], "application/vnd.hbci": ["hbci"], "application/vnd.hhe.lesson-player": ["les"], "application/vnd.hp-hpgl": ["hpgl"], "application/vnd.hp-hpid": ["hpid"], "application/vnd.hp-hps": ["hps"], "application/vnd.hp-jlyt": ["jlt"], "application/vnd.hp-pcl": ["pcl"], "application/vnd.hp-pclxl": ["pclxl"], "application/vnd.hydrostatix.sof-data": ["sfd-hdstx"], "application/vnd.ibm.minipay": ["mpy"], "application/vnd.ibm.modcap": ["afp", "listafp", "list3820"], "application/vnd.ibm.rights-management": ["irm"], "application/vnd.ibm.secure-container": ["sc"], "application/vnd.iccprofile": ["icc", "icm"], "application/vnd.igloader": ["igl"], "application/vnd.immervision-ivp": ["ivp"], "application/vnd.immervision-ivu": ["ivu"], "application/vnd.insors.igm": ["igm"], "application/vnd.intercon.formnet": ["xpw", "xpx"], "application/vnd.intergeo": ["i2g"], "application/vnd.intu.qbo": ["qbo"], "application/vnd.intu.qfx": ["qfx"], "application/vnd.ipunplugged.rcprofile": ["rcprofile"], "application/vnd.irepository.package+xml": ["irp"], "application/vnd.is-xpr": ["xpr"], "application/vnd.isac.fcs": ["fcs"], "application/vnd.jam": ["jam"], "application/vnd.jcp.javame.midlet-rms": ["rms"], "application/vnd.jisp": ["jisp"], "application/vnd.joost.joda-archive": ["joda"], "application/vnd.kahootz": ["ktz", "ktr"], "application/vnd.kde.karbon": ["karbon"], "application/vnd.kde.kchart": ["chrt"], "application/vnd.kde.kformula": ["kfo"], "application/vnd.kde.kivio": ["flw"], "application/vnd.kde.kontour": ["kon"], "application/vnd.kde.kpresenter": ["kpr", "kpt"], "application/vnd.kde.kspread": ["ksp"], "application/vnd.kde.kword": ["kwd", "kwt"], "application/vnd.kenameaapp": ["htke"], "application/vnd.kidspiration": ["kia"], "application/vnd.kinar": ["kne", "knp"], "application/vnd.koan": ["skp", "skd", "skt", "skm"], "application/vnd.kodak-descriptor": ["sse"], "application/vnd.las.las+xml": ["lasxml"], "application/vnd.llamagraphics.life-balance.desktop": ["lbd"], "application/vnd.llamagraphics.life-balance.exchange+xml": ["lbe"], "application/vnd.lotus-1-2-3": ["123"], "application/vnd.lotus-approach": ["apr"], "application/vnd.lotus-freelance": ["pre"], "application/vnd.lotus-notes": ["nsf"], "application/vnd.lotus-organizer": ["org"], "application/vnd.lotus-screencam": ["scm"], "application/vnd.lotus-wordpro": ["lwp"], "application/vnd.macports.portpkg": ["portpkg"], "application/vnd.mcd": ["mcd"], "application/vnd.medcalcdata": ["mc1"], "application/vnd.mediastation.cdkey": ["cdkey"], "application/vnd.mfer": ["mwf"], "application/vnd.mfmp": ["mfm"], "application/vnd.micrografx.flo": ["flo"], "application/vnd.micrografx.igx": ["igx"], "application/vnd.mif": ["mif"], "application/vnd.mobius.daf": ["daf"], "application/vnd.mobius.dis": ["dis"], "application/vnd.mobius.mbk": ["mbk"], "application/vnd.mobius.mqy": ["mqy"], "application/vnd.mobius.msl": ["msl"], "application/vnd.mobius.plc": ["plc"], "application/vnd.mobius.txf": ["txf"], "application/vnd.mophun.application": ["mpn"], "application/vnd.mophun.certificate": ["mpc"], "application/vnd.mozilla.xul+xml": ["xul"], "application/vnd.ms-artgalry": ["cil"], "application/vnd.ms-cab-compressed": ["cab"], "application/vnd.ms-excel": ["xls", "xlm", "xla", "xlc", "xlt", "xlw"], "application/vnd.ms-excel.addin.macroenabled.12": ["xlam"], "application/vnd.ms-excel.sheet.binary.macroenabled.12": ["xlsb"], "application/vnd.ms-excel.sheet.macroenabled.12": ["xlsm"], "application/vnd.ms-excel.template.macroenabled.12": ["xltm"], "application/vnd.ms-fontobject": ["eot"], "application/vnd.ms-htmlhelp": ["chm"], "application/vnd.ms-ims": ["ims"], "application/vnd.ms-lrm": ["lrm"], "application/vnd.ms-officetheme": ["thmx"], "application/vnd.ms-outlook": ["msg"], "application/vnd.ms-pki.seccat": ["cat"], "application/vnd.ms-pki.stl": ["stl"], "application/vnd.ms-powerpoint": ["ppt", "pps", "pot"], "application/vnd.ms-powerpoint.addin.macroenabled.12": ["ppam"], "application/vnd.ms-powerpoint.presentation.macroenabled.12": ["pptm"], "application/vnd.ms-powerpoint.slide.macroenabled.12": ["sldm"], "application/vnd.ms-powerpoint.slideshow.macroenabled.12": ["ppsm"], "application/vnd.ms-powerpoint.template.macroenabled.12": ["potm"], "application/vnd.ms-project": ["mpp", "mpt"], "application/vnd.ms-word.document.macroenabled.12": ["docm"], "application/vnd.ms-word.template.macroenabled.12": ["dotm"], "application/vnd.ms-works": ["wps", "wks", "wcm", "wdb"], "application/vnd.ms-wpl": ["wpl"], "application/vnd.ms-xpsdocument": ["xps"], "application/vnd.mseq": ["mseq"], "application/vnd.musician": ["mus"], "application/vnd.muvee.style": ["msty"], "application/vnd.mynfc": ["taglet"], "application/vnd.neurolanguage.nlu": ["nlu"], "application/vnd.nitf": ["ntf", "nitf"], "application/vnd.noblenet-directory": ["nnd"], "application/vnd.noblenet-sealer": ["nns"], "application/vnd.noblenet-web": ["nnw"], "application/vnd.nokia.n-gage.data": ["ngdat"], "application/vnd.nokia.n-gage.symbian.install": ["n-gage"], "application/vnd.nokia.radio-preset": ["rpst"], "application/vnd.nokia.radio-presets": ["rpss"], "application/vnd.novadigm.edm": ["edm"], "application/vnd.novadigm.edx": ["edx"], "application/vnd.novadigm.ext": ["ext"], "application/vnd.oasis.opendocument.chart": ["odc"], "application/vnd.oasis.opendocument.chart-template": ["otc"], "application/vnd.oasis.opendocument.database": ["odb"], "application/vnd.oasis.opendocument.formula": ["odf"], "application/vnd.oasis.opendocument.formula-template": ["odft"], "application/vnd.oasis.opendocument.graphics": ["odg"], "application/vnd.oasis.opendocument.graphics-template": ["otg"], "application/vnd.oasis.opendocument.image": ["odi"], "application/vnd.oasis.opendocument.image-template": ["oti"], "application/vnd.oasis.opendocument.presentation": ["odp"], "application/vnd.oasis.opendocument.presentation-template": ["otp"], "application/vnd.oasis.opendocument.spreadsheet": ["ods"], "application/vnd.oasis.opendocument.spreadsheet-template": ["ots"], "application/vnd.oasis.opendocument.text": ["odt"], "application/vnd.oasis.opendocument.text-master": ["odm"], "application/vnd.oasis.opendocument.text-template": ["ott"], "application/vnd.oasis.opendocument.text-web": ["oth"], "application/vnd.olpc-sugar": ["xo"], "application/vnd.oma.dd2+xml": ["dd2"], "application/vnd.openofficeorg.extension": ["oxt"], "application/vnd.openxmlformats-officedocument.presentationml.presentation": ["pptx"], "application/vnd.openxmlformats-officedocument.presentationml.slide": ["sldx"], "application/vnd.openxmlformats-officedocument.presentationml.slideshow": ["ppsx"], "application/vnd.openxmlformats-officedocument.presentationml.template": ["potx"], "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": ["xlsx"], "application/vnd.openxmlformats-officedocument.spreadsheetml.template": ["xltx"], "application/vnd.openxmlformats-officedocument.wordprocessingml.document": ["docx"], "application/vnd.openxmlformats-officedocument.wordprocessingml.template": ["dotx"], "application/vnd.osgeo.mapguide.package": ["mgp"], "application/vnd.osgi.dp": ["dp"], "application/vnd.osgi.subsystem": ["esa"], "application/vnd.palm": ["pdb", "pqa", "oprc"], "application/vnd.pawaafile": ["paw"], "application/vnd.pg.format": ["str"], "application/vnd.pg.osasli": ["ei6"], "application/vnd.picsel": ["efif"], "application/vnd.pmi.widget": ["wg"], "application/vnd.pocketlearn": ["plf"], "application/vnd.powerbuilder6": ["pbd"], "application/vnd.previewsystems.box": ["box"], "application/vnd.proteus.magazine": ["mgz"], "application/vnd.publishare-delta-tree": ["qps"], "application/vnd.pvi.ptid1": ["ptid"], "application/vnd.quark.quarkxpress": ["qxd", "qxt", "qwd", "qwt", "qxl", "qxb"], "application/vnd.realvnc.bed": ["bed"], "application/vnd.recordare.musicxml": ["mxl"], "application/vnd.recordare.musicxml+xml": ["musicxml"], "application/vnd.rig.cryptonote": ["cryptonote"], "application/vnd.rim.cod": ["cod"], "application/vnd.rn-realmedia": ["rm"], "application/vnd.rn-realmedia-vbr": ["rmvb"], "application/vnd.route66.link66+xml": ["link66"], "application/vnd.sailingtracker.track": ["st"], "application/vnd.seemail": ["see"], "application/vnd.sema": ["sema"], "application/vnd.semd": ["semd"], "application/vnd.semf": ["semf"], "application/vnd.shana.informed.formdata": ["ifm"], "application/vnd.shana.informed.formtemplate": ["itp"], "application/vnd.shana.informed.interchange": ["iif"], "application/vnd.shana.informed.package": ["ipk"], "application/vnd.simtech-mindmapper": ["twd", "twds"], "application/vnd.smaf": ["mmf"], "application/vnd.smart.teacher": ["teacher"], "application/vnd.solent.sdkm+xml": ["sdkm", "sdkd"], "application/vnd.spotfire.dxp": ["dxp"], "application/vnd.spotfire.sfs": ["sfs"], "application/vnd.stardivision.calc": ["sdc"], "application/vnd.stardivision.draw": ["sda"], "application/vnd.stardivision.impress": ["sdd"], "application/vnd.stardivision.math": ["smf"], "application/vnd.stardivision.writer": ["sdw", "vor"], "application/vnd.stardivision.writer-global": ["sgl"], "application/vnd.stepmania.package": ["smzip"], "application/vnd.stepmania.stepchart": ["sm"], "application/vnd.sun.wadl+xml": ["wadl"], "application/vnd.sun.xml.calc": ["sxc"], "application/vnd.sun.xml.calc.template": ["stc"], "application/vnd.sun.xml.draw": ["sxd"], "application/vnd.sun.xml.draw.template": ["std"], "application/vnd.sun.xml.impress": ["sxi"], "application/vnd.sun.xml.impress.template": ["sti"], "application/vnd.sun.xml.math": ["sxm"], "application/vnd.sun.xml.writer": ["sxw"], "application/vnd.sun.xml.writer.global": ["sxg"], "application/vnd.sun.xml.writer.template": ["stw"], "application/vnd.sus-calendar": ["sus", "susp"], "application/vnd.svd": ["svd"], "application/vnd.symbian.install": ["sis", "sisx"], "application/vnd.syncml+xml": ["xsm"], "application/vnd.syncml.dm+wbxml": ["bdm"], "application/vnd.syncml.dm+xml": ["xdm"], "application/vnd.tao.intent-module-archive": ["tao"], "application/vnd.tcpdump.pcap": ["pcap", "cap", "dmp"], "application/vnd.tmobile-livetv": ["tmo"], "application/vnd.trid.tpt": ["tpt"], "application/vnd.triscape.mxs": ["mxs"], "application/vnd.trueapp": ["tra"], "application/vnd.ufdl": ["ufd", "ufdl"], "application/vnd.uiq.theme": ["utz"], "application/vnd.umajin": ["umj"], "application/vnd.unity": ["unityweb"], "application/vnd.uoml+xml": ["uoml"], "application/vnd.vcx": ["vcx"], "application/vnd.visio": ["vsd", "vst", "vss", "vsw"], "application/vnd.visionary": ["vis"], "application/vnd.vsf": ["vsf"], "application/vnd.wap.wbxml": ["wbxml"], "application/vnd.wap.wmlc": ["wmlc"], "application/vnd.wap.wmlscriptc": ["wmlsc"], "application/vnd.webturbo": ["wtb"], "application/vnd.wolfram.player": ["nbp"], "application/vnd.wordperfect": ["wpd"], "application/vnd.wqd": ["wqd"], "application/vnd.wt.stf": ["stf"], "application/vnd.xara": ["xar"], "application/vnd.xfdl": ["xfdl"], "application/vnd.yamaha.hv-dic": ["hvd"], "application/vnd.yamaha.hv-script": ["hvs"], "application/vnd.yamaha.hv-voice": ["hvp"], "application/vnd.yamaha.openscoreformat": ["osf"], "application/vnd.yamaha.openscoreformat.osfpvg+xml": ["osfpvg"], "application/vnd.yamaha.smaf-audio": ["saf"], "application/vnd.yamaha.smaf-phrase": ["spf"], "application/vnd.yellowriver-custom-menu": ["cmp"], "application/vnd.zul": ["zir", "zirz"], "application/vnd.zzazz.deck+xml": ["zaz"], "application/x-7z-compressed": ["7z"], "application/x-abiword": ["abw"], "application/x-ace-compressed": ["ace"], "application/x-apple-diskimage": [], "application/x-arj": ["arj"], "application/x-authorware-bin": ["aab", "x32", "u32", "vox"], "application/x-authorware-map": ["aam"], "application/x-authorware-seg": ["aas"], "application/x-bcpio": ["bcpio"], "application/x-bdoc": [], "application/x-bittorrent": ["torrent"], "application/x-blorb": ["blb", "blorb"], "application/x-bzip": ["bz"], "application/x-bzip2": ["bz2", "boz"], "application/x-cbr": ["cbr", "cba", "cbt", "cbz", "cb7"], "application/x-cdlink": ["vcd"], "application/x-cfs-compressed": ["cfs"], "application/x-chat": ["chat"], "application/x-chess-pgn": ["pgn"], "application/x-chrome-extension": ["crx"], "application/x-cocoa": ["cco"], "application/x-conference": ["nsc"], "application/x-cpio": ["cpio"], "application/x-csh": ["csh"], "application/x-debian-package": ["udeb"], "application/x-dgc-compressed": ["dgc"], "application/x-director": ["dir", "dcr", "dxr", "cst", "cct", "cxt", "w3d", "fgd", "swa"], "application/x-doom": ["wad"], "application/x-dtbncx+xml": ["ncx"], "application/x-dtbook+xml": ["dtb"], "application/x-dtbresource+xml": ["res"], "application/x-dvi": ["dvi"], "application/x-envoy": ["evy"], "application/x-eva": ["eva"], "application/x-font-bdf": ["bdf"], "application/x-font-ghostscript": ["gsf"], "application/x-font-linux-psf": ["psf"], "application/x-font-otf": [], "application/x-font-pcf": ["pcf"], "application/x-font-snf": ["snf"], "application/x-font-ttf": ["ttf", "ttc"], "application/x-font-type1": ["pfa", "pfb", "pfm", "afm"], "application/x-freearc": ["arc"], "application/x-futuresplash": ["spl"], "application/x-gca-compressed": ["gca"], "application/x-glulx": ["ulx"], "application/x-gnumeric": ["gnumeric"], "application/x-gramps-xml": ["gramps"], "application/x-gtar": ["gtar"], "application/x-hdf": ["hdf"], "application/x-httpd-php": ["php"], "application/x-install-instructions": ["install"], "application/x-iso9660-image": [], "application/x-java-archive-diff": ["jardiff"], "application/x-java-jnlp-file": ["jnlp"], "application/x-latex": ["latex"], "application/x-lua-bytecode": ["luac"], "application/x-lzh-compressed": ["lzh", "lha"], "application/x-makeself": ["run"], "application/x-mie": ["mie"], "application/x-mobipocket-ebook": ["prc", "mobi"], "application/x-ms-application": ["application"], "application/x-ms-shortcut": ["lnk"], "application/x-ms-wmd": ["wmd"], "application/x-ms-wmz": ["wmz"], "application/x-ms-xbap": ["xbap"], "application/x-msaccess": ["mdb"], "application/x-msbinder": ["obd"], "application/x-mscardfile": ["crd"], "application/x-msclip": ["clp"], "application/x-msdos-program": [], "application/x-msdownload": ["com", "bat"], "application/x-msmediaview": ["mvb", "m13", "m14"], "application/x-msmetafile": ["wmf", "emf", "emz"], "application/x-msmoney": ["mny"], "application/x-mspublisher": ["pub"], "application/x-msschedule": ["scd"], "application/x-msterminal": ["trm"], "application/x-mswrite": ["wri"], "application/x-netcdf": ["nc", "cdf"], "application/x-ns-proxy-autoconfig": ["pac"], "application/x-nzb": ["nzb"], "application/x-perl": ["pl", "pm"], "application/x-pilot": [], "application/x-pkcs12": ["p12", "pfx"], "application/x-pkcs7-certificates": ["p7b", "spc"], "application/x-pkcs7-certreqresp": ["p7r"], "application/x-rar-compressed": ["rar"], "application/x-redhat-package-manager": ["rpm"], "application/x-research-info-systems": ["ris"], "application/x-sea": ["sea"], "application/x-sh": ["sh"], "application/x-shar": ["shar"], "application/x-shockwave-flash": ["swf"], "application/x-silverlight-app": ["xap"], "application/x-sql": ["sql"], "application/x-stuffit": ["sit"], "application/x-stuffitx": ["sitx"], "application/x-subrip": ["srt"], "application/x-sv4cpio": ["sv4cpio"], "application/x-sv4crc": ["sv4crc"], "application/x-t3vm-image": ["t3"], "application/x-tads": ["gam"], "application/x-tar": ["tar"], "application/x-tcl": ["tcl", "tk"], "application/x-tex": ["tex"], "application/x-tex-tfm": ["tfm"], "application/x-texinfo": ["texinfo", "texi"], "application/x-tgif": ["obj"], "application/x-ustar": ["ustar"], "application/x-virtualbox-hdd": ["hdd"], "application/x-virtualbox-ova": ["ova"], "application/x-virtualbox-ovf": ["ovf"], "application/x-virtualbox-vbox": ["vbox"], "application/x-virtualbox-vbox-extpack": ["vbox-extpack"], "application/x-virtualbox-vdi": ["vdi"], "application/x-virtualbox-vhd": ["vhd"], "application/x-virtualbox-vmdk": ["vmdk"], "application/x-wais-source": ["src"], "application/x-web-app-manifest+json": ["webapp"], "application/x-x509-ca-cert": ["der", "crt", "pem"], "application/x-xfig": ["fig"], "application/x-xliff+xml": ["xlf"], "application/x-xpinstall": ["xpi"], "application/x-xz": ["xz"], "application/x-zmachine": ["z1", "z2", "z3", "z4", "z5", "z6", "z7", "z8"], "audio/vnd.dece.audio": ["uva", "uvva"], "audio/vnd.digital-winds": ["eol"], "audio/vnd.dra": ["dra"], "audio/vnd.dts": ["dts"], "audio/vnd.dts.hd": ["dtshd"], "audio/vnd.lucent.voice": ["lvp"], "audio/vnd.ms-playready.media.pya": ["pya"], "audio/vnd.nuera.ecelp4800": ["ecelp4800"], "audio/vnd.nuera.ecelp7470": ["ecelp7470"], "audio/vnd.nuera.ecelp9600": ["ecelp9600"], "audio/vnd.rip": ["rip"], "audio/x-aac": ["aac"], "audio/x-aiff": ["aif", "aiff", "aifc"], "audio/x-caf": ["caf"], "audio/x-flac": ["flac"], "audio/x-m4a": [], "audio/x-matroska": ["mka"], "audio/x-mpegurl": ["m3u"], "audio/x-ms-wax": ["wax"], "audio/x-ms-wma": ["wma"], "audio/x-pn-realaudio": ["ram", "ra"], "audio/x-pn-realaudio-plugin": ["rmp"], "audio/x-realaudio": [], "audio/x-wav": [], "chemical/x-cdx": ["cdx"], "chemical/x-cif": ["cif"], "chemical/x-cmdf": ["cmdf"], "chemical/x-cml": ["cml"], "chemical/x-csml": ["csml"], "chemical/x-xyz": ["xyz"], "image/prs.btif": ["btif"], "image/vnd.adobe.photoshop": ["psd"], "image/vnd.dece.graphic": ["uvi", "uvvi", "uvg", "uvvg"], "image/vnd.djvu": ["djvu", "djv"], "image/vnd.dvb.subtitle": [], "image/vnd.dwg": ["dwg"], "image/vnd.dxf": ["dxf"], "image/vnd.fastbidsheet": ["fbs"], "image/vnd.fpx": ["fpx"], "image/vnd.fst": ["fst"], "image/vnd.fujixerox.edmics-mmr": ["mmr"], "image/vnd.fujixerox.edmics-rlc": ["rlc"], "image/vnd.ms-modi": ["mdi"], "image/vnd.ms-photo": ["wdp"], "image/vnd.net-fpx": ["npx"], "image/vnd.wap.wbmp": ["wbmp"], "image/vnd.xiff": ["xif"], "image/x-3ds": ["3ds"], "image/x-cmu-raster": ["ras"], "image/x-cmx": ["cmx"], "image/x-freehand": ["fh", "fhc", "fh4", "fh5", "fh7"], "image/x-icon": ["ico"], "image/x-jng": ["jng"], "image/x-mrsid-image": ["sid"], "image/x-ms-bmp": [], "image/x-pcx": ["pcx"], "image/x-pict": ["pic", "pct"], "image/x-portable-anymap": ["pnm"], "image/x-portable-bitmap": ["pbm"], "image/x-portable-graymap": ["pgm"], "image/x-portable-pixmap": ["ppm"], "image/x-rgb": ["rgb"], "image/x-tga": ["tga"], "image/x-xbitmap": ["xbm"], "image/x-xpixmap": ["xpm"], "image/x-xwindowdump": ["xwd"], "model/vnd.collada+xml": ["dae"], "model/vnd.dwf": ["dwf"], "model/vnd.gdl": ["gdl"], "model/vnd.gtw": ["gtw"], "model/vnd.mts": ["mts"], "model/vnd.vtu": ["vtu"], "text/prs.lines.tag": ["dsc"], "text/vnd.curl": ["curl"], "text/vnd.curl.dcurl": ["dcurl"], "text/vnd.curl.mcurl": ["mcurl"], "text/vnd.curl.scurl": ["scurl"], "text/vnd.dvb.subtitle": ["sub"], "text/vnd.fly": ["fly"], "text/vnd.fmi.flexstor": ["flx"], "text/vnd.graphviz": ["gv"], "text/vnd.in3d.3dml": ["3dml"], "text/vnd.in3d.spot": ["spot"], "text/vnd.sun.j2me.app-descriptor": ["jad"], "text/vnd.wap.wml": ["wml"], "text/vnd.wap.wmlscript": ["wmls"], "text/x-asm": ["s", "asm"], "text/x-c": ["c", "cc", "cxx", "cpp", "h", "hh", "dic"], "text/x-component": ["htc"], "text/x-fortran": ["f", "for", "f77", "f90"], "text/x-handlebars-template": ["hbs"], "text/x-java-source": ["java"], "text/x-lua": ["lua"], "text/x-markdown": ["mkd"], "text/x-nfo": ["nfo"], "text/x-opml": ["opml"], "text/x-org": [], "text/x-pascal": ["p", "pas"], "text/x-processing": ["pde"], "text/x-sass": ["sass"], "text/x-scss": ["scss"], "text/x-setext": ["etx"], "text/x-sfv": ["sfv"], "text/x-suse-ymp": ["ymp"], "text/x-uuencode": ["uu"], "text/x-vcalendar": ["vcs"], "text/x-vcard": ["vcf"], "video/vnd.dece.hd": ["uvh", "uvvh"], "video/vnd.dece.mobile": ["uvm", "uvvm"], "video/vnd.dece.pd": ["uvp", "uvvp"], "video/vnd.dece.sd": ["uvs", "uvvs"], "video/vnd.dece.video": ["uvv", "uvvv"], "video/vnd.dvb.file": ["dvb"], "video/vnd.fvt": ["fvt"], "video/vnd.mpegurl": ["mxu", "m4u"], "video/vnd.ms-playready.media.pyv": ["pyv"], "video/vnd.uvvu.mp4": ["uvu", "uvvu"], "video/vnd.vivo": ["viv"], "video/x-f4v": ["f4v"], "video/x-fli": ["fli"], "video/x-flv": ["flv"], "video/x-m4v": ["m4v"], "video/x-matroska": ["mkv", "mk3d", "mks"], "video/x-mng": ["mng"], "video/x-ms-asf": ["asf", "asx"], "video/x-ms-vob": ["vob"], "video/x-ms-wm": ["wm"], "video/x-ms-wmv": ["wmv"], "video/x-ms-wmx": ["wmx"], "video/x-ms-wvx": ["wvx"], "video/x-msvideo": ["avi"], "video/x-sgi-movie": ["movie"], "video/x-smv": ["smv"], "x-conference/x-cooltalk": ["ice"] };
|
30759 | }, {}], 4: [function (require, module, exports) {
|
30760 | module.exports = { "application/andrew-inset": ["ez"], "application/applixware": ["aw"], "application/atom+xml": ["atom"], "application/atomcat+xml": ["atomcat"], "application/atomsvc+xml": ["atomsvc"], "application/bdoc": ["bdoc"], "application/ccxml+xml": ["ccxml"], "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"], "application/emma+xml": ["emma"], "application/epub+zip": ["epub"], "application/exi": ["exi"], "application/font-tdpfr": ["pfr"], "application/font-woff": ["woff"], "application/font-woff2": ["woff2"], "application/geo+json": ["geojson"], "application/gml+xml": ["gml"], "application/gpx+xml": ["gpx"], "application/gxf": ["gxf"], "application/gzip": ["gz"], "application/hyperstudio": ["stk"], "application/inkml+xml": ["ink", "inkml"], "application/ipfix": ["ipfix"], "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/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/mods+xml": ["mods"], "application/mp21": ["m21", "mp21"], "application/mp4": ["mp4s", "m4p"], "application/msword": ["doc", "dot"], "application/mxf": ["mxf"], "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/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/pskc+xml": ["pskcxml"], "application/rdf+xml": ["rdf"], "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/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/set-payment-initiation": ["setpay"], "application/set-registration-initiation": ["setreg"], "application/shf+xml": ["shf"], "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/tei+xml": ["tei", "teicorpus"], "application/thraud+xml": ["tfi"], "application/timestamped-data": ["tsd"], "application/voicexml+xml": ["vxml"], "application/widget": ["wgt"], "application/winhlp": ["hlp"], "application/wsdl+xml": ["wsdl"], "application/wspolicy+xml": ["wspolicy"], "application/xaml+xml": ["xaml"], "application/xcap-diff+xml": ["xdf"], "application/xenc+xml": ["xenc"], "application/xhtml+xml": ["xhtml", "xht"], "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": [], "audio/adpcm": ["adp"], "audio/basic": ["au", "snd"], "audio/midi": ["mid", "midi", "kar", "rmi"], "audio/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": [], "audio/webm": ["weba"], "audio/xm": ["xm"], "font/otf": ["otf"], "image/apng": ["apng"], "image/bmp": ["bmp"], "image/cgm": ["cgm"], "image/g3fax": ["g3"], "image/gif": ["gif"], "image/ief": ["ief"], "image/jpeg": ["jpeg", "jpg", "jpe"], "image/ktx": ["ktx"], "image/png": ["png"], "image/sgi": ["sgi"], "image/svg+xml": ["svg", "svgz"], "image/tiff": ["tiff", "tif"], "image/webp": ["webp"], "message/rfc822": ["eml", "mime"], "model/gltf+json": ["gltf"], "model/gltf-binary": ["glb"], "model/iges": ["igs", "iges"], "model/mesh": ["msh", "mesh", "silo"], "model/vrml": ["wrl", "vrml"], "model/x3d+binary": ["x3db", "x3dbz"], "model/x3d+vrml": ["x3dv", "x3dvz"], "model/x3d+xml": ["x3d", "x3dz"], "text/cache-manifest": ["appcache", "manifest"], "text/calendar": ["ics", "ifb"], "text/coffeescript": ["coffee", "litcoffee"], "text/css": ["css"], "text/csv": ["csv"], "text/hjson": ["hjson"], "text/html": ["html", "htm", "shtml"], "text/jade": ["jade"], "text/jsx": ["jsx"], "text/less": ["less"], "text/markdown": ["markdown", "md"], "text/mathml": ["mml"], "text/n3": ["n3"], "text/plain": ["txt", "text", "conf", "def", "list", "log", "in", "ini"], "text/richtext": ["rtx"], "text/rtf": [], "text/sgml": ["sgml", "sgm"], "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": [], "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"] };
|
30761 | }, {}] }, {}, [2])(2);
|
30762 | });
|
30763 |
|
30764 | }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
30765 | },{"babel-runtime/core-js/object/create":50,"babel-runtime/helpers/classCallCheck":62,"babel-runtime/helpers/createClass":63,"babel-runtime/helpers/typeof":64}],333:[function(require,module,exports){
|
30766 | 'use strict';
|
30767 |
|
30768 |
|
30769 |
|
30770 | exports.encodeURIComponent = function (text) {
|
30771 | try {
|
30772 | return encodeURIComponent(text);
|
30773 | } catch (e) {
|
30774 | return text;
|
30775 | }
|
30776 | };
|
30777 |
|
30778 | exports.escape = require('escape-html');
|
30779 |
|
30780 | exports.timestamp = function timestamp(t) {
|
30781 | if (t) {
|
30782 | var v = t;
|
30783 | if (typeof v === 'string') {
|
30784 | v = Number(v);
|
30785 | }
|
30786 | if (String(t).length === 10) {
|
30787 | v *= 1000;
|
30788 | }
|
30789 | return new Date(v);
|
30790 | }
|
30791 | return Math.round(Date.now() / 1000);
|
30792 | };
|
30793 |
|
30794 | },{"escape-html":215}],334:[function(require,module,exports){
|
30795 | (function (process,Buffer){
|
30796 | 'use strict';
|
30797 |
|
30798 | var _stringify = require('babel-runtime/core-js/json/stringify');
|
30799 |
|
30800 | var _stringify2 = _interopRequireDefault(_stringify);
|
30801 |
|
30802 | var _typeof2 = require('babel-runtime/helpers/typeof');
|
30803 |
|
30804 | var _typeof3 = _interopRequireDefault(_typeof2);
|
30805 |
|
30806 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
30807 |
|
30808 | var util = require('util');
|
30809 | var urlutil = require('url');
|
30810 | var http = require('http');
|
30811 | var https = require('https');
|
30812 | var debug = require('debug')('urllib');
|
30813 | var ms = require('humanize-ms');
|
30814 |
|
30815 | var _Promise;
|
30816 |
|
30817 | var REQUEST_ID = 0;
|
30818 | var MAX_VALUE = Math.pow(2, 31) - 10;
|
30819 | var PROTO_RE = /^https?:\/\//i;
|
30820 |
|
30821 | function getAgent(agent, defaultAgent) {
|
30822 | return agent === undefined ? defaultAgent : agent;
|
30823 | }
|
30824 |
|
30825 | function makeCallback(resolve, reject) {
|
30826 | return function (err, data, res) {
|
30827 | if (err) {
|
30828 | return reject(err);
|
30829 | }
|
30830 | resolve({
|
30831 | data: data,
|
30832 | status: res.statusCode,
|
30833 | headers: res.headers,
|
30834 | res: res
|
30835 | });
|
30836 | };
|
30837 | }
|
30838 |
|
30839 |
|
30840 | exports.TIMEOUTS = [ms('300s'), ms('300s')];
|
30841 |
|
30842 | var TEXT_DATA_TYPES = ['json', 'text'];
|
30843 |
|
30844 | exports.request = function request(url, args, callback) {
|
30845 |
|
30846 | if (arguments.length === 2 && typeof args === 'function') {
|
30847 | callback = args;
|
30848 | args = null;
|
30849 | }
|
30850 | if (typeof callback === 'function') {
|
30851 | return exports.requestWithCallback(url, args, callback);
|
30852 | }
|
30853 |
|
30854 |
|
30855 | if (!_Promise) {
|
30856 | _Promise = require('any-promise');
|
30857 | }
|
30858 | return new _Promise(function (resolve, reject) {
|
30859 | exports.requestWithCallback(url, args, makeCallback(resolve, reject));
|
30860 | });
|
30861 | };
|
30862 |
|
30863 | exports.requestWithCallback = function requestWithCallback(url, args, callback) {
|
30864 |
|
30865 | if (!url || typeof url !== 'string' && (typeof url === 'undefined' ? 'undefined' : (0, _typeof3.default)(url)) !== 'object') {
|
30866 | var msg = util.format('expect request url to be a string or a http request options, but got %j', url);
|
30867 | throw new Error(msg);
|
30868 | }
|
30869 |
|
30870 | if (arguments.length === 2 && typeof args === 'function') {
|
30871 | callback = args;
|
30872 | args = null;
|
30873 | }
|
30874 |
|
30875 | args = args || {};
|
30876 | if (REQUEST_ID >= MAX_VALUE) {
|
30877 | REQUEST_ID = 0;
|
30878 | }
|
30879 | var reqId = ++REQUEST_ID;
|
30880 |
|
30881 | args.requestUrls = args.requestUrls || [];
|
30882 |
|
30883 | var reqMeta = {
|
30884 | requestId: reqId,
|
30885 | url: url,
|
30886 | args: args,
|
30887 | ctx: args.ctx
|
30888 | };
|
30889 | if (args.emitter) {
|
30890 | args.emitter.emit('request', reqMeta);
|
30891 | }
|
30892 |
|
30893 | args.timeout = args.timeout || exports.TIMEOUTS;
|
30894 | args.maxRedirects = args.maxRedirects || 10;
|
30895 | args.streaming = args.streaming || args.customResponse;
|
30896 | var requestStartTime = Date.now();
|
30897 | var parsedUrl;
|
30898 |
|
30899 | if (typeof url === 'string') {
|
30900 | if (!PROTO_RE.test(url)) {
|
30901 |
|
30902 | url = 'http://' + url;
|
30903 | }
|
30904 | parsedUrl = urlutil.parse(url);
|
30905 | } else {
|
30906 | parsedUrl = url;
|
30907 | }
|
30908 |
|
30909 | var method = (args.type || args.method || parsedUrl.method || 'GET').toUpperCase();
|
30910 | var port = parsedUrl.port || 80;
|
30911 | var httplib = http;
|
30912 | var agent = getAgent(args.agent, exports.agent);
|
30913 | var fixJSONCtlChars = args.fixJSONCtlChars;
|
30914 |
|
30915 | if (parsedUrl.protocol === 'https:') {
|
30916 | httplib = https;
|
30917 | agent = getAgent(args.httpsAgent, exports.httpsAgent);
|
30918 |
|
30919 | if (!parsedUrl.port) {
|
30920 | port = 443;
|
30921 | }
|
30922 | }
|
30923 |
|
30924 |
|
30925 |
|
30926 |
|
30927 |
|
30928 |
|
30929 |
|
30930 | var options = {
|
30931 | host: parsedUrl.hostname || parsedUrl.host || 'localhost',
|
30932 | path: parsedUrl.path || '/',
|
30933 | method: method,
|
30934 | port: port,
|
30935 | agent: agent,
|
30936 | headers: args.headers || {},
|
30937 |
|
30938 |
|
30939 |
|
30940 |
|
30941 | lookup: args.lookup
|
30942 | };
|
30943 |
|
30944 | if (Array.isArray(args.timeout)) {
|
30945 | options.requestTimeout = args.timeout[args.timeout.length - 1];
|
30946 | } else if (typeof args.timeout !== 'undefined') {
|
30947 | options.requestTimeout = args.timeout;
|
30948 | }
|
30949 |
|
30950 | var sslNames = ['pfx', 'key', 'passphrase', 'cert', 'ca', 'ciphers', 'rejectUnauthorized', 'secureProtocol', 'secureOptions'];
|
30951 | for (var i = 0; i < sslNames.length; i++) {
|
30952 | var name = sslNames[i];
|
30953 | if (args.hasOwnProperty(name)) {
|
30954 | options[name] = args[name];
|
30955 | }
|
30956 | }
|
30957 |
|
30958 |
|
30959 | if (options.rejectUnauthorized === false && !options.hasOwnProperty('secureOptions')) {
|
30960 | options.secureOptions = require('constants').SSL_OP_NO_TLSv1_2;
|
30961 | }
|
30962 |
|
30963 | var auth = args.auth || parsedUrl.auth;
|
30964 | if (auth) {
|
30965 | options.auth = auth;
|
30966 | }
|
30967 |
|
30968 | var body = args.content || args.data;
|
30969 | var dataAsQueryString = method === 'GET' || method === 'HEAD' || args.dataAsQueryString;
|
30970 | if (!args.content) {
|
30971 | if (body && !(typeof body === 'string' || Buffer.isBuffer(body))) {
|
30972 | if (dataAsQueryString) {
|
30973 |
|
30974 | body = args.nestedQuerystring ? qs.stringify(body) : querystring.stringify(body);
|
30975 | } else {
|
30976 | var contentType = options.headers['Content-Type'] || options.headers['content-type'];
|
30977 |
|
30978 | if (!contentType) {
|
30979 | if (args.contentType === 'json') {
|
30980 | contentType = 'application/json';
|
30981 | } else {
|
30982 | contentType = 'application/x-www-form-urlencoded';
|
30983 | }
|
30984 | options.headers['Content-Type'] = contentType;
|
30985 | }
|
30986 |
|
30987 | if (parseContentType(contentType).type === 'application/json') {
|
30988 | body = (0, _stringify2.default)(body);
|
30989 | } else {
|
30990 |
|
30991 | body = args.nestedQuerystring ? qs.stringify(body) : querystring.stringify(body);
|
30992 | }
|
30993 | }
|
30994 | }
|
30995 | }
|
30996 |
|
30997 |
|
30998 | if (dataAsQueryString && body) {
|
30999 | options.path += (parsedUrl.query ? '&' : '?') + body;
|
31000 | body = null;
|
31001 | }
|
31002 |
|
31003 | var requestSize = 0;
|
31004 | if (body) {
|
31005 | var length = body.length;
|
31006 | if (!Buffer.isBuffer(body)) {
|
31007 | length = Buffer.byteLength(body);
|
31008 | }
|
31009 | requestSize = options.headers['Content-Length'] = length;
|
31010 | }
|
31011 |
|
31012 | if (args.dataType === 'json') {
|
31013 | options.headers.Accept = 'application/json';
|
31014 | }
|
31015 |
|
31016 | if (typeof args.beforeRequest === 'function') {
|
31017 |
|
31018 | args.beforeRequest(options);
|
31019 | }
|
31020 | var connectTimer = null;
|
31021 | var responseTimer = null;
|
31022 | var __err = null;
|
31023 | var connected = false;
|
31024 | var keepAliveSocket = false;
|
31025 | var responseSize = 0;
|
31026 | var statusCode = -1;
|
31027 | var responseAborted = false;
|
31028 | var remoteAddress = '';
|
31029 | var remotePort = '';
|
31030 | var timing = null;
|
31031 | if (args.timing) {
|
31032 | timing = {
|
31033 |
|
31034 | queuing: 0,
|
31035 |
|
31036 | dnslookup: 0,
|
31037 |
|
31038 | connected: 0,
|
31039 |
|
31040 | requestSent: 0,
|
31041 |
|
31042 | waiting: 0,
|
31043 | contentDownload: 0
|
31044 | };
|
31045 | }
|
31046 |
|
31047 | function cancelConnectTimer() {
|
31048 | if (connectTimer) {
|
31049 | clearTimeout(connectTimer);
|
31050 | connectTimer = null;
|
31051 | }
|
31052 | }
|
31053 | function cancelResponseTimer() {
|
31054 | if (responseTimer) {
|
31055 | clearTimeout(responseTimer);
|
31056 | responseTimer = null;
|
31057 | }
|
31058 | }
|
31059 |
|
31060 | function done(err, data, res) {
|
31061 | cancelResponseTimer();
|
31062 | if (!callback) {
|
31063 | console.warn('[urllib:warn] [%s] [%s] [worker:%s] %s %s callback twice!!!', Date(), reqId, process.pid, options.method, url);
|
31064 |
|
31065 | if (err) {
|
31066 | console.warn('[urllib:warn] [%s] [%s] [worker:%s] %s: %s\nstack: %s', Date(), reqId, process.pid, err.name, err.message, err.stack);
|
31067 | }
|
31068 | return;
|
31069 | }
|
31070 | var cb = callback;
|
31071 | callback = null;
|
31072 | var headers = {};
|
31073 | if (res) {
|
31074 | statusCode = res.statusCode;
|
31075 | headers = res.headers;
|
31076 | }
|
31077 |
|
31078 |
|
31079 | if (statusCode === 401 && headers['www-authenticate'] && (!args.headers || !args.headers.Authorization) && args.digestAuth) {
|
31080 | var authenticate = headers['www-authenticate'];
|
31081 | if (authenticate.indexOf('Digest ') >= 0) {
|
31082 | debug('Request#%d %s: got digest auth header WWW-Authenticate: %s', reqId, url, authenticate);
|
31083 | args.headers = args.headers || {};
|
31084 | args.headers.Authorization = digestAuthHeader(options.method, options.path, authenticate, args.digestAuth);
|
31085 | debug('Request#%d %s: auth with digest header: %s', reqId, url, args.headers.Authorization);
|
31086 | if (res.headers['set-cookie']) {
|
31087 | args.headers.Cookie = res.headers['set-cookie'].join(';');
|
31088 | }
|
31089 | return exports.requestWithCallback(url, args, cb);
|
31090 | }
|
31091 | }
|
31092 |
|
31093 | var requestUseTime = Date.now() - requestStartTime;
|
31094 | if (timing) {
|
31095 | timing.contentDownload = requestUseTime;
|
31096 | }
|
31097 |
|
31098 | 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);
|
31099 |
|
31100 | var response = {
|
31101 | status: statusCode,
|
31102 | statusCode: statusCode,
|
31103 | headers: headers,
|
31104 | size: responseSize,
|
31105 | aborted: responseAborted,
|
31106 | rt: requestUseTime,
|
31107 | keepAliveSocket: keepAliveSocket,
|
31108 | data: data,
|
31109 | requestUrls: args.requestUrls,
|
31110 | timing: timing,
|
31111 | remoteAddress: remoteAddress,
|
31112 | remotePort: remotePort
|
31113 | };
|
31114 |
|
31115 | if (err) {
|
31116 | var agentStatus = '';
|
31117 | if (agent && typeof agent.getCurrentStatus === 'function') {
|
31118 |
|
31119 | agentStatus = ', agent status: ' + (0, _stringify2.default)(agent.getCurrentStatus());
|
31120 | }
|
31121 | err.message += ', ' + options.method + ' ' + url + ' ' + statusCode + ' (connected: ' + connected + ', keepalive socket: ' + keepAliveSocket + agentStatus + ')' + '\nheaders: ' + (0, _stringify2.default)(headers);
|
31122 | err.data = data;
|
31123 | err.path = options.path;
|
31124 | err.status = statusCode;
|
31125 | err.headers = headers;
|
31126 | err.res = response;
|
31127 | }
|
31128 |
|
31129 | cb(err, data, args.streaming ? res : response);
|
31130 |
|
31131 | if (args.emitter) {
|
31132 |
|
31133 | reqMeta.url = url;
|
31134 | reqMeta.socket = req && req.connection;
|
31135 | reqMeta.options = options;
|
31136 | reqMeta.size = requestSize;
|
31137 |
|
31138 | args.emitter.emit('response', {
|
31139 | requestId: reqId,
|
31140 | error: err,
|
31141 | ctx: args.ctx,
|
31142 | req: reqMeta,
|
31143 | res: response
|
31144 | });
|
31145 | }
|
31146 | }
|
31147 |
|
31148 | function handleRedirect(res) {
|
31149 | var err = null;
|
31150 | if (args.followRedirect && statuses.redirect[res.statusCode]) {
|
31151 |
|
31152 | args._followRedirectCount = (args._followRedirectCount || 0) + 1;
|
31153 | var location = res.headers.location;
|
31154 | if (!location) {
|
31155 | err = new Error('Got statusCode ' + res.statusCode + ' but cannot resolve next location from headers');
|
31156 | err.name = 'FollowRedirectError';
|
31157 | } else if (args._followRedirectCount > args.maxRedirects) {
|
31158 | err = new Error('Exceeded maxRedirects. Probably stuck in a redirect loop ' + url);
|
31159 | err.name = 'MaxRedirectError';
|
31160 | } else {
|
31161 | var newUrl = args.formatRedirectUrl ? args.formatRedirectUrl(url, location) : urlutil.resolve(url, location);
|
31162 | debug('Request#%d %s: `redirected` from %s to %s', reqId, options.path, url, newUrl);
|
31163 |
|
31164 | cancelResponseTimer();
|
31165 |
|
31166 | if (args.headers && args.headers.Host && PROTO_RE.test(location)) {
|
31167 | args.headers.Host = null;
|
31168 | }
|
31169 |
|
31170 | var cb = callback;
|
31171 | callback = null;
|
31172 | exports.requestWithCallback(newUrl, args, cb);
|
31173 | return {
|
31174 | redirect: true,
|
31175 | error: null
|
31176 | };
|
31177 | }
|
31178 | }
|
31179 | return {
|
31180 | redirect: false,
|
31181 | error: err
|
31182 | };
|
31183 | }
|
31184 |
|
31185 |
|
31186 | if (!options.headers['User-Agent'] && !options.headers['user-agent']) {
|
31187 | options.headers['User-Agent'] = navigator.userAgent;
|
31188 | }
|
31189 |
|
31190 | if (args.gzip) {
|
31191 | if (!options.headers['Accept-Encoding'] && !options.headers['accept-encoding']) {
|
31192 | options.headers['Accept-Encoding'] = 'gzip';
|
31193 | }
|
31194 | }
|
31195 |
|
31196 | function decodeContent(res, body, cb) {
|
31197 | var encoding = res.headers['content-encoding'];
|
31198 |
|
31199 |
|
31200 |
|
31201 |
|
31202 |
|
31203 | return cb(null, body, encoding);
|
31204 |
|
31205 |
|
31206 |
|
31207 |
|
31208 | }
|
31209 |
|
31210 | var writeStream = args.writeStream;
|
31211 |
|
31212 | debug('Request#%d %s %s with headers %j, options.path: %s', reqId, method, url, options.headers, options.path);
|
31213 |
|
31214 | args.requestUrls.push(url);
|
31215 |
|
31216 | function onResponse(res) {
|
31217 | if (timing) {
|
31218 | timing.waiting = Date.now() - requestStartTime;
|
31219 | }
|
31220 | debug('Request#%d %s `req response` event emit: status %d, headers: %j', reqId, url, res.statusCode, res.headers);
|
31221 |
|
31222 | if (args.streaming) {
|
31223 | var result = handleRedirect(res);
|
31224 | if (result.redirect) {
|
31225 | res.resume();
|
31226 | return;
|
31227 | }
|
31228 | if (result.error) {
|
31229 | res.resume();
|
31230 | return done(result.error, null, res);
|
31231 | }
|
31232 |
|
31233 | return done(null, null, res);
|
31234 | }
|
31235 |
|
31236 | res.on('close', function () {
|
31237 | debug('Request#%d %s: `res close` event emit, total size %d', reqId, url, responseSize);
|
31238 | });
|
31239 |
|
31240 | res.on('error', function () {
|
31241 | debug('Request#%d %s: `res error` event emit, total size %d', reqId, url, responseSize);
|
31242 | });
|
31243 |
|
31244 | res.on('aborted', function () {
|
31245 | responseAborted = true;
|
31246 | debug('Request#%d %s: `res aborted` event emit, total size %d', reqId, url, responseSize);
|
31247 | });
|
31248 |
|
31249 | if (writeStream) {
|
31250 |
|
31251 |
|
31252 |
|
31253 |
|
31254 |
|
31255 |
|
31256 |
|
31257 |
|
31258 |
|
31259 |
|
31260 |
|
31261 |
|
31262 |
|
31263 |
|
31264 |
|
31265 |
|
31266 | var result = handleRedirect(res);
|
31267 | if (result.redirect) {
|
31268 | res.resume();
|
31269 | return;
|
31270 | }
|
31271 | if (result.error) {
|
31272 | res.resume();
|
31273 |
|
31274 | writeStream.end();
|
31275 | return done(result.error, null, res);
|
31276 | }
|
31277 |
|
31278 | if (args.consumeWriteStream === false) {
|
31279 | res.on('end', done.bind(null, null, null, res));
|
31280 | } else {
|
31281 |
|
31282 | if (isNode010 || isNode012) {
|
31283 | first([[writeStream, 'close'], [res, 'aborted']], function (_, stream, event) {
|
31284 | debug('Request#%d %s: writeStream or res %s event emitted', reqId, url, event);
|
31285 | done(__err || null, null, res);
|
31286 | });
|
31287 | } else {
|
31288 | writeStream.on('close', function () {
|
31289 | debug('Request#%d %s: writeStream close event emitted', reqId, url);
|
31290 | done(__err || null, null, res);
|
31291 | });
|
31292 | }
|
31293 | }
|
31294 | return res.pipe(writeStream);
|
31295 | }
|
31296 |
|
31297 |
|
31298 |
|
31299 |
|
31300 |
|
31301 |
|
31302 |
|
31303 |
|
31304 |
|
31305 |
|
31306 |
|
31307 |
|
31308 |
|
31309 |
|
31310 | var chunks = [];
|
31311 |
|
31312 | res.on('data', function (chunk) {
|
31313 | debug('Request#%d %s: `res data` event emit, size %d', reqId, url, chunk.length);
|
31314 | responseSize += chunk.length;
|
31315 | chunks.push(chunk);
|
31316 | });
|
31317 |
|
31318 | res.on('end', function () {
|
31319 | var body = Buffer.concat(chunks, responseSize);
|
31320 | debug('Request#%d %s: `res end` event emit, total size %d, _dumped: %s', reqId, url, responseSize, res._dumped);
|
31321 |
|
31322 | if (__err) {
|
31323 |
|
31324 | return done(__err, body, res);
|
31325 | }
|
31326 |
|
31327 | var result = handleRedirect(res);
|
31328 | if (result.error) {
|
31329 | return done(result.error, body, res);
|
31330 | }
|
31331 | if (result.redirect) {
|
31332 | return;
|
31333 | }
|
31334 |
|
31335 | decodeContent(res, body, function (err, data, encoding) {
|
31336 | if (err) {
|
31337 | return done(err, body, res);
|
31338 | }
|
31339 |
|
31340 | if (!encoding && TEXT_DATA_TYPES.indexOf(args.dataType) >= 0) {
|
31341 |
|
31342 | try {
|
31343 | data = decodeBodyByCharset(data, res);
|
31344 | } catch (e) {
|
31345 | debug('decodeBodyByCharset error: %s', e);
|
31346 |
|
31347 | return done(null, data, res);
|
31348 | }
|
31349 |
|
31350 | if (args.dataType === 'json') {
|
31351 | if (responseSize === 0) {
|
31352 | data = null;
|
31353 | } else {
|
31354 | var r = parseJSON(data, fixJSONCtlChars);
|
31355 | if (r.error) {
|
31356 | err = r.error;
|
31357 | } else {
|
31358 | data = r.data;
|
31359 | }
|
31360 | }
|
31361 | }
|
31362 | }
|
31363 |
|
31364 | if (responseAborted) {
|
31365 |
|
31366 |
|
31367 | debug('Request#%d %s: Remote socket was terminated before `response.end()` was called', reqId, url);
|
31368 | }
|
31369 |
|
31370 | done(err, data, res);
|
31371 | });
|
31372 | });
|
31373 | }
|
31374 |
|
31375 | var connectTimeout, responseTimeout;
|
31376 | if (Array.isArray(args.timeout)) {
|
31377 | connectTimeout = ms(args.timeout[0]);
|
31378 | responseTimeout = ms(args.timeout[1]);
|
31379 | } else {
|
31380 |
|
31381 | connectTimeout = responseTimeout = ms(args.timeout);
|
31382 | }
|
31383 | debug('ConnectTimeout: %d, ResponseTimeout: %d', connectTimeout, responseTimeout);
|
31384 |
|
31385 | function startConnectTimer() {
|
31386 | debug('Connect timer ticking, timeout: %d', connectTimeout);
|
31387 | connectTimer = setTimeout(function () {
|
31388 | connectTimer = null;
|
31389 | if (statusCode === -1) {
|
31390 | statusCode = -2;
|
31391 | }
|
31392 | var msg = 'Connect timeout for ' + connectTimeout + 'ms';
|
31393 | var errorName = 'ConnectionTimeoutError';
|
31394 | if (!req.socket) {
|
31395 | errorName = 'SocketAssignTimeoutError';
|
31396 | msg += ', working sockets is full';
|
31397 | }
|
31398 | __err = new Error(msg);
|
31399 | __err.name = errorName;
|
31400 | __err.requestId = reqId;
|
31401 | debug('ConnectTimeout: Request#%d %s %s: %s, connected: %s', reqId, url, __err.name, msg, connected);
|
31402 | abortRequest();
|
31403 | }, connectTimeout);
|
31404 | }
|
31405 |
|
31406 | function startResposneTimer() {
|
31407 | debug('Response timer ticking, timeout: %d', responseTimeout);
|
31408 | responseTimer = setTimeout(function () {
|
31409 | responseTimer = null;
|
31410 | var msg = 'Response timeout for ' + responseTimeout + 'ms';
|
31411 | var errorName = 'ResponseTimeoutError';
|
31412 | __err = new Error(msg);
|
31413 | __err.name = errorName;
|
31414 | __err.requestId = reqId;
|
31415 | debug('ResponseTimeout: Request#%d %s %s: %s, connected: %s', reqId, url, __err.name, msg, connected);
|
31416 | abortRequest();
|
31417 | }, responseTimeout);
|
31418 | }
|
31419 |
|
31420 | var req;
|
31421 |
|
31422 | options.mode = args.mode ? args.mode : '';
|
31423 | try {
|
31424 | req = httplib.request(options, onResponse);
|
31425 | } catch (err) {
|
31426 | return done(err);
|
31427 | }
|
31428 |
|
31429 |
|
31430 | if (typeof window === 'undefined') {
|
31431 |
|
31432 | startConnectTimer();
|
31433 | } else {
|
31434 | req.on('requestTimeout', function () {
|
31435 | if (statusCode === -1) {
|
31436 | statusCode = -2;
|
31437 | }
|
31438 | var msg = 'Connect timeout for ' + connectTimeout + 'ms';
|
31439 | var errorName = 'ConnectionTimeoutError';
|
31440 | __err = new Error(msg);
|
31441 | __err.name = errorName;
|
31442 | __err.requestId = reqId;
|
31443 | abortRequest();
|
31444 | });
|
31445 | }
|
31446 |
|
31447 | function abortRequest() {
|
31448 | debug('Request#%d %s abort, connected: %s', reqId, url, connected);
|
31449 |
|
31450 | if (!req.socket) {
|
31451 | __err.noSocket = true;
|
31452 | done(__err);
|
31453 | }
|
31454 | req.abort();
|
31455 | }
|
31456 |
|
31457 | if (timing) {
|
31458 |
|
31459 | req.on('finish', function () {
|
31460 | timing.requestSent = Date.now() - requestStartTime;
|
31461 | });
|
31462 | }
|
31463 |
|
31464 | req.once('socket', function (socket) {
|
31465 | if (timing) {
|
31466 |
|
31467 | timing.queuing = Date.now() - requestStartTime;
|
31468 | }
|
31469 |
|
31470 |
|
31471 |
|
31472 |
|
31473 | if (isNode010 && socket.socket) {
|
31474 | socket = socket.socket;
|
31475 | }
|
31476 |
|
31477 | var readyState = socket.readyState;
|
31478 | if (readyState === 'opening') {
|
31479 | socket.once('lookup', function (err, ip, addressType) {
|
31480 | debug('Request#%d %s lookup: %s, %s, %s', reqId, url, err, ip, addressType);
|
31481 | if (timing) {
|
31482 | timing.dnslookup = Date.now() - requestStartTime;
|
31483 | }
|
31484 | if (ip) {
|
31485 | remoteAddress = ip;
|
31486 | }
|
31487 | });
|
31488 | socket.once('connect', function () {
|
31489 | if (timing) {
|
31490 |
|
31491 | timing.connected = Date.now() - requestStartTime;
|
31492 | }
|
31493 |
|
31494 |
|
31495 | cancelConnectTimer();
|
31496 | startResposneTimer();
|
31497 |
|
31498 | debug('Request#%d %s new socket connected', reqId, url);
|
31499 | connected = true;
|
31500 | if (!remoteAddress) {
|
31501 | remoteAddress = socket.remoteAddress;
|
31502 | }
|
31503 | remotePort = socket.remotePort;
|
31504 | });
|
31505 | return;
|
31506 | }
|
31507 |
|
31508 | debug('Request#%d %s reuse socket connected, readyState: %s', reqId, url, readyState);
|
31509 | connected = true;
|
31510 | keepAliveSocket = true;
|
31511 | if (!remoteAddress) {
|
31512 | remoteAddress = socket.remoteAddress;
|
31513 | }
|
31514 | remotePort = socket.remotePort;
|
31515 |
|
31516 |
|
31517 | cancelConnectTimer();
|
31518 | startResposneTimer();
|
31519 | });
|
31520 |
|
31521 | req.on('error', function (err) {
|
31522 |
|
31523 | if (err.name === 'Error' || err.name === 'TypeError') {
|
31524 | err.name = connected ? 'ResponseError' : 'RequestError';
|
31525 | }
|
31526 | err.message += ' (req "error")';
|
31527 | debug('Request#%d %s `req error` event emit, %s: %s', reqId, url, err.name, err.message);
|
31528 | done(__err || err);
|
31529 | });
|
31530 |
|
31531 | if (writeStream) {
|
31532 | writeStream.once('error', function (err) {
|
31533 | err.message += ' (writeStream "error")';
|
31534 | __err = err;
|
31535 | debug('Request#%d %s `writeStream error` event emit, %s: %s', reqId, url, err.name, err.message);
|
31536 | abortRequest();
|
31537 | });
|
31538 | }
|
31539 |
|
31540 | if (args.stream) {
|
31541 | args.stream.pipe(req);
|
31542 | args.stream.once('error', function (err) {
|
31543 | err.message += ' (stream "error")';
|
31544 | __err = err;
|
31545 | debug('Request#%d %s `readStream error` event emit, %s: %s', reqId, url, err.name, err.message);
|
31546 | abortRequest();
|
31547 | });
|
31548 | } else {
|
31549 | req.end(body);
|
31550 | }
|
31551 |
|
31552 | req.requestId = reqId;
|
31553 | return req;
|
31554 | };
|
31555 |
|
31556 | }).call(this,require('_process'),require("buffer").Buffer)
|
31557 | },{"_process":249,"any-promise":44,"babel-runtime/core-js/json/stringify":48,"babel-runtime/helpers/typeof":64,"buffer":70,"constants":72,"debug":188,"http":272,"https":223,"humanize-ms":224,"url":279,"util":287}]},{},[1])(1)
|
31558 | });
|
31559 |
|