@mjhls/mjh-framework 1.0.6 → 1.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -9,10 +9,6 @@ var React__default = _interopDefault(React);
9
9
  var url = _interopDefault(require('url'));
10
10
  var PropTypes = _interopDefault(require('prop-types'));
11
11
  var ReactDOM = _interopDefault(require('react-dom'));
12
- var tty = _interopDefault(require('tty'));
13
- var util = _interopDefault(require('util'));
14
- var fs = _interopDefault(require('fs'));
15
- var net = _interopDefault(require('net'));
16
12
 
17
13
  function _extends() {
18
14
  _extends = Object.assign || function (target) {
@@ -5173,7 +5169,7 @@ var LeftNav = function LeftNav(props) {
5173
5169
  row.subQuery && row.subQuery.map(function (subRow, subIndex) {
5174
5170
  if (subIndex === 0) {
5175
5171
  return React__default.createElement(
5176
- React__default.Fragment,
5172
+ 'enclosed',
5177
5173
  { key: subIndex },
5178
5174
  React__default.createElement(
5179
5175
  ListGroup.Item,
@@ -5194,20 +5190,25 @@ var LeftNav = function LeftNav(props) {
5194
5190
  )
5195
5191
  )
5196
5192
  );
5197
- }
5198
- return React__default.createElement(
5199
- ListGroup.Item,
5200
- { as: 'li', key: subIndex },
5201
- React__default.createElement(
5202
- link$2,
5203
- { href: subRow.url },
5193
+ } else {
5194
+ return React__default.createElement(
5195
+ 'enclosed',
5196
+ { key: subIndex },
5204
5197
  React__default.createElement(
5205
- 'a',
5206
- null,
5207
- subRow.name
5198
+ ListGroup.Item,
5199
+ { as: 'li' },
5200
+ React__default.createElement(
5201
+ link$2,
5202
+ { href: subRow.url },
5203
+ React__default.createElement(
5204
+ 'a',
5205
+ null,
5206
+ subRow.name
5207
+ )
5208
+ )
5208
5209
  )
5209
- )
5210
- );
5210
+ );
5211
+ }
5211
5212
  })
5212
5213
  );
5213
5214
  })
@@ -11237,1902 +11238,6 @@ var Normal = function Normal(props) {
11237
11238
  );
11238
11239
  };
11239
11240
 
11240
- var getYoutubeId = createCommonjsModule(function (module, exports) {
11241
- (function (root, factory) {
11242
- {
11243
- module.exports = factory();
11244
- }
11245
- }(commonjsGlobal, function (exports) {
11246
-
11247
- return function (url$$1, opts) {
11248
- if (opts == undefined) {
11249
- opts = {fuzzy: true};
11250
- }
11251
-
11252
- if (/youtu\.?be/.test(url$$1)) {
11253
-
11254
- // Look first for known patterns
11255
- var i;
11256
- var patterns = [
11257
- /youtu\.be\/([^#\&\?]{11})/, // youtu.be/<id>
11258
- /\?v=([^#\&\?]{11})/, // ?v=<id>
11259
- /\&v=([^#\&\?]{11})/, // &v=<id>
11260
- /embed\/([^#\&\?]{11})/, // embed/<id>
11261
- /\/v\/([^#\&\?]{11})/ // /v/<id>
11262
- ];
11263
-
11264
- // If any pattern matches, return the ID
11265
- for (i = 0; i < patterns.length; ++i) {
11266
- if (patterns[i].test(url$$1)) {
11267
- return patterns[i].exec(url$$1)[1];
11268
- }
11269
- }
11270
-
11271
- if (opts.fuzzy) {
11272
- // If that fails, break it apart by certain characters and look
11273
- // for the 11 character key
11274
- var tokens = url$$1.split(/[\/\&\?=#\.\s]/g);
11275
- for (i = 0; i < tokens.length; ++i) {
11276
- if (/^[^#\&\?]{11}$/.test(tokens[i])) {
11277
- return tokens[i];
11278
- }
11279
- }
11280
- }
11281
- }
11282
-
11283
- return null;
11284
- };
11285
-
11286
- }));
11287
- });
11288
-
11289
- var isArray = Array.isArray;
11290
- var keyList = Object.keys;
11291
- var hasProp = Object.prototype.hasOwnProperty;
11292
-
11293
- var fastDeepEqual = function equal(a, b) {
11294
- if (a === b) return true;
11295
-
11296
- if (a && b && typeof a == 'object' && typeof b == 'object') {
11297
- var arrA = isArray(a)
11298
- , arrB = isArray(b)
11299
- , i
11300
- , length
11301
- , key;
11302
-
11303
- if (arrA && arrB) {
11304
- length = a.length;
11305
- if (length != b.length) return false;
11306
- for (i = length; i-- !== 0;)
11307
- if (!equal(a[i], b[i])) return false;
11308
- return true;
11309
- }
11310
-
11311
- if (arrA != arrB) return false;
11312
-
11313
- var dateA = a instanceof Date
11314
- , dateB = b instanceof Date;
11315
- if (dateA != dateB) return false;
11316
- if (dateA && dateB) return a.getTime() == b.getTime();
11317
-
11318
- var regexpA = a instanceof RegExp
11319
- , regexpB = b instanceof RegExp;
11320
- if (regexpA != regexpB) return false;
11321
- if (regexpA && regexpB) return a.toString() == b.toString();
11322
-
11323
- var keys = keyList(a);
11324
- length = keys.length;
11325
-
11326
- if (length !== keyList(b).length)
11327
- return false;
11328
-
11329
- for (i = length; i-- !== 0;)
11330
- if (!hasProp.call(b, keys[i])) return false;
11331
-
11332
- for (i = length; i-- !== 0;) {
11333
- key = keys[i];
11334
- if (!equal(a[key], b[key])) return false;
11335
- }
11336
-
11337
- return true;
11338
- }
11339
-
11340
- return a!==a && b!==b;
11341
- };
11342
-
11343
- var Sister;
11344
-
11345
- /**
11346
- * @link https://github.com/gajus/sister for the canonical source repository
11347
- * @license https://github.com/gajus/sister/blob/master/LICENSE BSD 3-Clause
11348
- */
11349
- Sister = function () {
11350
- var sister = {},
11351
- events = {};
11352
-
11353
- /**
11354
- * @name handler
11355
- * @function
11356
- * @param {Object} data Event data.
11357
- */
11358
-
11359
- /**
11360
- * @param {String} name Event name.
11361
- * @param {handler} handler
11362
- * @return {listener}
11363
- */
11364
- sister.on = function (name, handler) {
11365
- var listener = {name: name, handler: handler};
11366
- events[name] = events[name] || [];
11367
- events[name].unshift(listener);
11368
- return listener;
11369
- };
11370
-
11371
- /**
11372
- * @param {listener}
11373
- */
11374
- sister.off = function (listener) {
11375
- var index = events[listener.name].indexOf(listener);
11376
-
11377
- if (index !== -1) {
11378
- events[listener.name].splice(index, 1);
11379
- }
11380
- };
11381
-
11382
- /**
11383
- * @param {String} name Event name.
11384
- * @param {Object} data Event data.
11385
- */
11386
- sister.trigger = function (name, data) {
11387
- var listeners = events[name],
11388
- i;
11389
-
11390
- if (listeners) {
11391
- i = listeners.length;
11392
- while (i--) {
11393
- listeners[i].handler(data);
11394
- }
11395
- }
11396
- };
11397
-
11398
- return sister;
11399
- };
11400
-
11401
- var sister = Sister;
11402
-
11403
- var loadScript = function load (src, opts, cb) {
11404
- var head = document.head || document.getElementsByTagName('head')[0];
11405
- var script = document.createElement('script');
11406
-
11407
- if (typeof opts === 'function') {
11408
- cb = opts;
11409
- opts = {};
11410
- }
11411
-
11412
- opts = opts || {};
11413
- cb = cb || function() {};
11414
-
11415
- script.type = opts.type || 'text/javascript';
11416
- script.charset = opts.charset || 'utf8';
11417
- script.async = 'async' in opts ? !!opts.async : true;
11418
- script.src = src;
11419
-
11420
- if (opts.attrs) {
11421
- setAttributes$1(script, opts.attrs);
11422
- }
11423
-
11424
- if (opts.text) {
11425
- script.text = '' + opts.text;
11426
- }
11427
-
11428
- var onend = 'onload' in script ? stdOnEnd : ieOnEnd;
11429
- onend(script, cb);
11430
-
11431
- // some good legacy browsers (firefox) fail the 'in' detection above
11432
- // so as a fallback we always set onload
11433
- // old IE will ignore this and new IE will set onload
11434
- if (!script.onload) {
11435
- stdOnEnd(script, cb);
11436
- }
11437
-
11438
- head.appendChild(script);
11439
- };
11440
-
11441
- function setAttributes$1(script, attrs) {
11442
- for (var attr in attrs) {
11443
- script.setAttribute(attr, attrs[attr]);
11444
- }
11445
- }
11446
-
11447
- function stdOnEnd (script, cb) {
11448
- script.onload = function () {
11449
- this.onerror = this.onload = null;
11450
- cb(null, script);
11451
- };
11452
- script.onerror = function () {
11453
- // this.onload = null here is necessary
11454
- // because even IE9 works not like others
11455
- this.onerror = this.onload = null;
11456
- cb(new Error('Failed to load ' + this.src), script);
11457
- };
11458
- }
11459
-
11460
- function ieOnEnd (script, cb) {
11461
- script.onreadystatechange = function () {
11462
- if (this.readyState != 'complete' && this.readyState != 'loaded') return
11463
- this.onreadystatechange = null;
11464
- cb(null, script); // there is no way to catch loading errors in IE8
11465
- };
11466
- }
11467
-
11468
- var loadYouTubeIframeApi = createCommonjsModule(function (module, exports) {
11469
-
11470
- Object.defineProperty(exports, "__esModule", {
11471
- value: true
11472
- });
11473
-
11474
-
11475
-
11476
- var _loadScript2 = _interopRequireDefault(loadScript);
11477
-
11478
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11479
-
11480
- exports.default = function (emitter) {
11481
- /**
11482
- * A promise that is resolved when window.onYouTubeIframeAPIReady is called.
11483
- * The promise is resolved with a reference to window.YT object.
11484
- */
11485
- var iframeAPIReady = new Promise(function (resolve) {
11486
- if (window.YT && window.YT.Player && window.YT.Player instanceof Function) {
11487
- resolve(window.YT);
11488
-
11489
- return;
11490
- } else {
11491
- var protocol = window.location.protocol === 'http:' ? 'http:' : 'https:';
11492
-
11493
- (0, _loadScript2.default)(protocol + '//www.youtube.com/iframe_api', function (error) {
11494
- if (error) {
11495
- emitter.trigger('error', error);
11496
- }
11497
- });
11498
- }
11499
-
11500
- var previous = window.onYouTubeIframeAPIReady;
11501
-
11502
- // The API will call this function when page has finished downloading
11503
- // the JavaScript for the player API.
11504
- window.onYouTubeIframeAPIReady = function () {
11505
- if (previous) {
11506
- previous();
11507
- }
11508
-
11509
- resolve(window.YT);
11510
- };
11511
- });
11512
-
11513
- return iframeAPIReady;
11514
- };
11515
-
11516
- module.exports = exports['default'];
11517
- });
11518
-
11519
- unwrapExports(loadYouTubeIframeApi);
11520
-
11521
- /**
11522
- * Helpers.
11523
- */
11524
-
11525
- var s = 1000;
11526
- var m = s * 60;
11527
- var h = m * 60;
11528
- var d = h * 24;
11529
- var y = d * 365.25;
11530
-
11531
- /**
11532
- * Parse or format the given `val`.
11533
- *
11534
- * Options:
11535
- *
11536
- * - `long` verbose formatting [false]
11537
- *
11538
- * @param {String|Number} val
11539
- * @param {Object} [options]
11540
- * @throws {Error} throw an error if val is not a non-empty string or a number
11541
- * @return {String|Number}
11542
- * @api public
11543
- */
11544
-
11545
- var ms = function(val, options) {
11546
- options = options || {};
11547
- var type = typeof val;
11548
- if (type === 'string' && val.length > 0) {
11549
- return parse(val);
11550
- } else if (type === 'number' && isNaN(val) === false) {
11551
- return options.long ? fmtLong(val) : fmtShort(val);
11552
- }
11553
- throw new Error(
11554
- 'val is not a non-empty string or a valid number. val=' +
11555
- JSON.stringify(val)
11556
- );
11557
- };
11558
-
11559
- /**
11560
- * Parse the given `str` and return milliseconds.
11561
- *
11562
- * @param {String} str
11563
- * @return {Number}
11564
- * @api private
11565
- */
11566
-
11567
- function parse(str) {
11568
- str = String(str);
11569
- if (str.length > 100) {
11570
- return;
11571
- }
11572
- var match = /^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(
11573
- str
11574
- );
11575
- if (!match) {
11576
- return;
11577
- }
11578
- var n = parseFloat(match[1]);
11579
- var type = (match[2] || 'ms').toLowerCase();
11580
- switch (type) {
11581
- case 'years':
11582
- case 'year':
11583
- case 'yrs':
11584
- case 'yr':
11585
- case 'y':
11586
- return n * y;
11587
- case 'days':
11588
- case 'day':
11589
- case 'd':
11590
- return n * d;
11591
- case 'hours':
11592
- case 'hour':
11593
- case 'hrs':
11594
- case 'hr':
11595
- case 'h':
11596
- return n * h;
11597
- case 'minutes':
11598
- case 'minute':
11599
- case 'mins':
11600
- case 'min':
11601
- case 'm':
11602
- return n * m;
11603
- case 'seconds':
11604
- case 'second':
11605
- case 'secs':
11606
- case 'sec':
11607
- case 's':
11608
- return n * s;
11609
- case 'milliseconds':
11610
- case 'millisecond':
11611
- case 'msecs':
11612
- case 'msec':
11613
- case 'ms':
11614
- return n;
11615
- default:
11616
- return undefined;
11617
- }
11618
- }
11619
-
11620
- /**
11621
- * Short format for `ms`.
11622
- *
11623
- * @param {Number} ms
11624
- * @return {String}
11625
- * @api private
11626
- */
11627
-
11628
- function fmtShort(ms) {
11629
- if (ms >= d) {
11630
- return Math.round(ms / d) + 'd';
11631
- }
11632
- if (ms >= h) {
11633
- return Math.round(ms / h) + 'h';
11634
- }
11635
- if (ms >= m) {
11636
- return Math.round(ms / m) + 'm';
11637
- }
11638
- if (ms >= s) {
11639
- return Math.round(ms / s) + 's';
11640
- }
11641
- return ms + 'ms';
11642
- }
11643
-
11644
- /**
11645
- * Long format for `ms`.
11646
- *
11647
- * @param {Number} ms
11648
- * @return {String}
11649
- * @api private
11650
- */
11651
-
11652
- function fmtLong(ms) {
11653
- return plural(ms, d, 'day') ||
11654
- plural(ms, h, 'hour') ||
11655
- plural(ms, m, 'minute') ||
11656
- plural(ms, s, 'second') ||
11657
- ms + ' ms';
11658
- }
11659
-
11660
- /**
11661
- * Pluralization helper.
11662
- */
11663
-
11664
- function plural(ms, n, name) {
11665
- if (ms < n) {
11666
- return;
11667
- }
11668
- if (ms < n * 1.5) {
11669
- return Math.floor(ms / n) + ' ' + name;
11670
- }
11671
- return Math.ceil(ms / n) + ' ' + name + 's';
11672
- }
11673
-
11674
- var debug = createCommonjsModule(function (module, exports) {
11675
- /**
11676
- * This is the common logic for both the Node.js and web browser
11677
- * implementations of `debug()`.
11678
- *
11679
- * Expose `debug()` as the module.
11680
- */
11681
-
11682
- exports = module.exports = createDebug.debug = createDebug['default'] = createDebug;
11683
- exports.coerce = coerce;
11684
- exports.disable = disable;
11685
- exports.enable = enable;
11686
- exports.enabled = enabled;
11687
- exports.humanize = ms;
11688
-
11689
- /**
11690
- * The currently active debug mode names, and names to skip.
11691
- */
11692
-
11693
- exports.names = [];
11694
- exports.skips = [];
11695
-
11696
- /**
11697
- * Map of special "%n" handling functions, for the debug "format" argument.
11698
- *
11699
- * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
11700
- */
11701
-
11702
- exports.formatters = {};
11703
-
11704
- /**
11705
- * Previous log timestamp.
11706
- */
11707
-
11708
- var prevTime;
11709
-
11710
- /**
11711
- * Select a color.
11712
- * @param {String} namespace
11713
- * @return {Number}
11714
- * @api private
11715
- */
11716
-
11717
- function selectColor(namespace) {
11718
- var hash = 0, i;
11719
-
11720
- for (i in namespace) {
11721
- hash = ((hash << 5) - hash) + namespace.charCodeAt(i);
11722
- hash |= 0; // Convert to 32bit integer
11723
- }
11724
-
11725
- return exports.colors[Math.abs(hash) % exports.colors.length];
11726
- }
11727
-
11728
- /**
11729
- * Create a debugger with the given `namespace`.
11730
- *
11731
- * @param {String} namespace
11732
- * @return {Function}
11733
- * @api public
11734
- */
11735
-
11736
- function createDebug(namespace) {
11737
-
11738
- function debug() {
11739
- // disabled?
11740
- if (!debug.enabled) return;
11741
-
11742
- var self = debug;
11743
-
11744
- // set `diff` timestamp
11745
- var curr = +new Date();
11746
- var ms$$1 = curr - (prevTime || curr);
11747
- self.diff = ms$$1;
11748
- self.prev = prevTime;
11749
- self.curr = curr;
11750
- prevTime = curr;
11751
-
11752
- // turn the `arguments` into a proper Array
11753
- var args = new Array(arguments.length);
11754
- for (var i = 0; i < args.length; i++) {
11755
- args[i] = arguments[i];
11756
- }
11757
-
11758
- args[0] = exports.coerce(args[0]);
11759
-
11760
- if ('string' !== typeof args[0]) {
11761
- // anything else let's inspect with %O
11762
- args.unshift('%O');
11763
- }
11764
-
11765
- // apply any `formatters` transformations
11766
- var index = 0;
11767
- args[0] = args[0].replace(/%([a-zA-Z%])/g, function(match, format) {
11768
- // if we encounter an escaped % then don't increase the array index
11769
- if (match === '%%') return match;
11770
- index++;
11771
- var formatter = exports.formatters[format];
11772
- if ('function' === typeof formatter) {
11773
- var val = args[index];
11774
- match = formatter.call(self, val);
11775
-
11776
- // now we need to remove `args[index]` since it's inlined in the `format`
11777
- args.splice(index, 1);
11778
- index--;
11779
- }
11780
- return match;
11781
- });
11782
-
11783
- // apply env-specific formatting (colors, etc.)
11784
- exports.formatArgs.call(self, args);
11785
-
11786
- var logFn = debug.log || exports.log || console.log.bind(console);
11787
- logFn.apply(self, args);
11788
- }
11789
-
11790
- debug.namespace = namespace;
11791
- debug.enabled = exports.enabled(namespace);
11792
- debug.useColors = exports.useColors();
11793
- debug.color = selectColor(namespace);
11794
-
11795
- // env-specific initialization logic for debug instances
11796
- if ('function' === typeof exports.init) {
11797
- exports.init(debug);
11798
- }
11799
-
11800
- return debug;
11801
- }
11802
-
11803
- /**
11804
- * Enables a debug mode by namespaces. This can include modes
11805
- * separated by a colon and wildcards.
11806
- *
11807
- * @param {String} namespaces
11808
- * @api public
11809
- */
11810
-
11811
- function enable(namespaces) {
11812
- exports.save(namespaces);
11813
-
11814
- exports.names = [];
11815
- exports.skips = [];
11816
-
11817
- var split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/);
11818
- var len = split.length;
11819
-
11820
- for (var i = 0; i < len; i++) {
11821
- if (!split[i]) continue; // ignore empty strings
11822
- namespaces = split[i].replace(/\*/g, '.*?');
11823
- if (namespaces[0] === '-') {
11824
- exports.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));
11825
- } else {
11826
- exports.names.push(new RegExp('^' + namespaces + '$'));
11827
- }
11828
- }
11829
- }
11830
-
11831
- /**
11832
- * Disable debug output.
11833
- *
11834
- * @api public
11835
- */
11836
-
11837
- function disable() {
11838
- exports.enable('');
11839
- }
11840
-
11841
- /**
11842
- * Returns true if the given mode name is enabled, false otherwise.
11843
- *
11844
- * @param {String} name
11845
- * @return {Boolean}
11846
- * @api public
11847
- */
11848
-
11849
- function enabled(name) {
11850
- var i, len;
11851
- for (i = 0, len = exports.skips.length; i < len; i++) {
11852
- if (exports.skips[i].test(name)) {
11853
- return false;
11854
- }
11855
- }
11856
- for (i = 0, len = exports.names.length; i < len; i++) {
11857
- if (exports.names[i].test(name)) {
11858
- return true;
11859
- }
11860
- }
11861
- return false;
11862
- }
11863
-
11864
- /**
11865
- * Coerce `val`.
11866
- *
11867
- * @param {Mixed} val
11868
- * @return {Mixed}
11869
- * @api private
11870
- */
11871
-
11872
- function coerce(val) {
11873
- if (val instanceof Error) return val.stack || val.message;
11874
- return val;
11875
- }
11876
- });
11877
- var debug_1 = debug.coerce;
11878
- var debug_2 = debug.disable;
11879
- var debug_3 = debug.enable;
11880
- var debug_4 = debug.enabled;
11881
- var debug_5 = debug.humanize;
11882
- var debug_6 = debug.names;
11883
- var debug_7 = debug.skips;
11884
- var debug_8 = debug.formatters;
11885
-
11886
- var browser = createCommonjsModule(function (module, exports) {
11887
- /**
11888
- * This is the web browser implementation of `debug()`.
11889
- *
11890
- * Expose `debug()` as the module.
11891
- */
11892
-
11893
- exports = module.exports = debug;
11894
- exports.log = log;
11895
- exports.formatArgs = formatArgs;
11896
- exports.save = save;
11897
- exports.load = load;
11898
- exports.useColors = useColors;
11899
- exports.storage = 'undefined' != typeof chrome
11900
- && 'undefined' != typeof chrome.storage
11901
- ? chrome.storage.local
11902
- : localstorage();
11903
-
11904
- /**
11905
- * Colors.
11906
- */
11907
-
11908
- exports.colors = [
11909
- 'lightseagreen',
11910
- 'forestgreen',
11911
- 'goldenrod',
11912
- 'dodgerblue',
11913
- 'darkorchid',
11914
- 'crimson'
11915
- ];
11916
-
11917
- /**
11918
- * Currently only WebKit-based Web Inspectors, Firefox >= v31,
11919
- * and the Firebug extension (any Firefox version) are known
11920
- * to support "%c" CSS customizations.
11921
- *
11922
- * TODO: add a `localStorage` variable to explicitly enable/disable colors
11923
- */
11924
-
11925
- function useColors() {
11926
- // NB: In an Electron preload script, document will be defined but not fully
11927
- // initialized. Since we know we're in Chrome, we'll just detect this case
11928
- // explicitly
11929
- if (typeof window !== 'undefined' && window.process && window.process.type === 'renderer') {
11930
- return true;
11931
- }
11932
-
11933
- // is webkit? http://stackoverflow.com/a/16459606/376773
11934
- // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
11935
- return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||
11936
- // is firebug? http://stackoverflow.com/a/398120/376773
11937
- (typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||
11938
- // is firefox >= v31?
11939
- // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
11940
- (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) ||
11941
- // double check webkit in userAgent just in case we are in a worker
11942
- (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/));
11943
- }
11944
-
11945
- /**
11946
- * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
11947
- */
11948
-
11949
- exports.formatters.j = function(v) {
11950
- try {
11951
- return JSON.stringify(v);
11952
- } catch (err) {
11953
- return '[UnexpectedJSONParseError]: ' + err.message;
11954
- }
11955
- };
11956
-
11957
-
11958
- /**
11959
- * Colorize log arguments if enabled.
11960
- *
11961
- * @api public
11962
- */
11963
-
11964
- function formatArgs(args) {
11965
- var useColors = this.useColors;
11966
-
11967
- args[0] = (useColors ? '%c' : '')
11968
- + this.namespace
11969
- + (useColors ? ' %c' : ' ')
11970
- + args[0]
11971
- + (useColors ? '%c ' : ' ')
11972
- + '+' + exports.humanize(this.diff);
11973
-
11974
- if (!useColors) return;
11975
-
11976
- var c = 'color: ' + this.color;
11977
- args.splice(1, 0, c, 'color: inherit');
11978
-
11979
- // the final "%c" is somewhat tricky, because there could be other
11980
- // arguments passed either before or after the %c, so we need to
11981
- // figure out the correct index to insert the CSS into
11982
- var index = 0;
11983
- var lastC = 0;
11984
- args[0].replace(/%[a-zA-Z%]/g, function(match) {
11985
- if ('%%' === match) return;
11986
- index++;
11987
- if ('%c' === match) {
11988
- // we only are interested in the *last* %c
11989
- // (the user may have provided their own)
11990
- lastC = index;
11991
- }
11992
- });
11993
-
11994
- args.splice(lastC, 0, c);
11995
- }
11996
-
11997
- /**
11998
- * Invokes `console.log()` when available.
11999
- * No-op when `console.log` is not a "function".
12000
- *
12001
- * @api public
12002
- */
12003
-
12004
- function log() {
12005
- // this hackery is required for IE8/9, where
12006
- // the `console.log` function doesn't have 'apply'
12007
- return 'object' === typeof console
12008
- && console.log
12009
- && Function.prototype.apply.call(console.log, console, arguments);
12010
- }
12011
-
12012
- /**
12013
- * Save `namespaces`.
12014
- *
12015
- * @param {String} namespaces
12016
- * @api private
12017
- */
12018
-
12019
- function save(namespaces) {
12020
- try {
12021
- if (null == namespaces) {
12022
- exports.storage.removeItem('debug');
12023
- } else {
12024
- exports.storage.debug = namespaces;
12025
- }
12026
- } catch(e) {}
12027
- }
12028
-
12029
- /**
12030
- * Load `namespaces`.
12031
- *
12032
- * @return {String} returns the previously persisted debug modes
12033
- * @api private
12034
- */
12035
-
12036
- function load() {
12037
- var r;
12038
- try {
12039
- r = exports.storage.debug;
12040
- } catch(e) {}
12041
-
12042
- // If debug isn't set in LS, and we're in Electron, try to load $DEBUG
12043
- if (!r && typeof process !== 'undefined' && 'env' in process) {
12044
- r = process.env.DEBUG;
12045
- }
12046
-
12047
- return r;
12048
- }
12049
-
12050
- /**
12051
- * Enable namespaces listed in `localStorage.debug` initially.
12052
- */
12053
-
12054
- exports.enable(load());
12055
-
12056
- /**
12057
- * Localstorage attempts to return the localstorage.
12058
- *
12059
- * This is necessary because safari throws
12060
- * when a user disables cookies/localstorage
12061
- * and you attempt to access it.
12062
- *
12063
- * @return {LocalStorage}
12064
- * @api private
12065
- */
12066
-
12067
- function localstorage() {
12068
- try {
12069
- return window.localStorage;
12070
- } catch (e) {}
12071
- }
12072
- });
12073
- var browser_1 = browser.log;
12074
- var browser_2 = browser.formatArgs;
12075
- var browser_3 = browser.save;
12076
- var browser_4 = browser.load;
12077
- var browser_5 = browser.useColors;
12078
- var browser_6 = browser.storage;
12079
- var browser_7 = browser.colors;
12080
-
12081
- var node = createCommonjsModule(function (module, exports) {
12082
- /**
12083
- * Module dependencies.
12084
- */
12085
-
12086
-
12087
-
12088
-
12089
- /**
12090
- * This is the Node.js implementation of `debug()`.
12091
- *
12092
- * Expose `debug()` as the module.
12093
- */
12094
-
12095
- exports = module.exports = debug;
12096
- exports.init = init;
12097
- exports.log = log;
12098
- exports.formatArgs = formatArgs;
12099
- exports.save = save;
12100
- exports.load = load;
12101
- exports.useColors = useColors;
12102
-
12103
- /**
12104
- * Colors.
12105
- */
12106
-
12107
- exports.colors = [6, 2, 3, 4, 5, 1];
12108
-
12109
- /**
12110
- * Build up the default `inspectOpts` object from the environment variables.
12111
- *
12112
- * $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js
12113
- */
12114
-
12115
- exports.inspectOpts = Object.keys(process.env).filter(function (key) {
12116
- return /^debug_/i.test(key);
12117
- }).reduce(function (obj, key) {
12118
- // camel-case
12119
- var prop = key
12120
- .substring(6)
12121
- .toLowerCase()
12122
- .replace(/_([a-z])/g, function (_, k) { return k.toUpperCase() });
12123
-
12124
- // coerce string value into JS value
12125
- var val = process.env[key];
12126
- if (/^(yes|on|true|enabled)$/i.test(val)) val = true;
12127
- else if (/^(no|off|false|disabled)$/i.test(val)) val = false;
12128
- else if (val === 'null') val = null;
12129
- else val = Number(val);
12130
-
12131
- obj[prop] = val;
12132
- return obj;
12133
- }, {});
12134
-
12135
- /**
12136
- * The file descriptor to write the `debug()` calls to.
12137
- * Set the `DEBUG_FD` env variable to override with another value. i.e.:
12138
- *
12139
- * $ DEBUG_FD=3 node script.js 3>debug.log
12140
- */
12141
-
12142
- var fd = parseInt(process.env.DEBUG_FD, 10) || 2;
12143
-
12144
- if (1 !== fd && 2 !== fd) {
12145
- util.deprecate(function(){}, 'except for stderr(2) and stdout(1), any other usage of DEBUG_FD is deprecated. Override debug.log if you want to use a different log function (https://git.io/debug_fd)')();
12146
- }
12147
-
12148
- var stream = 1 === fd ? process.stdout :
12149
- 2 === fd ? process.stderr :
12150
- createWritableStdioStream(fd);
12151
-
12152
- /**
12153
- * Is stdout a TTY? Colored output is enabled when `true`.
12154
- */
12155
-
12156
- function useColors() {
12157
- return 'colors' in exports.inspectOpts
12158
- ? Boolean(exports.inspectOpts.colors)
12159
- : tty.isatty(fd);
12160
- }
12161
-
12162
- /**
12163
- * Map %o to `util.inspect()`, all on a single line.
12164
- */
12165
-
12166
- exports.formatters.o = function(v) {
12167
- this.inspectOpts.colors = this.useColors;
12168
- return util.inspect(v, this.inspectOpts)
12169
- .split('\n').map(function(str) {
12170
- return str.trim()
12171
- }).join(' ');
12172
- };
12173
-
12174
- /**
12175
- * Map %o to `util.inspect()`, allowing multiple lines if needed.
12176
- */
12177
-
12178
- exports.formatters.O = function(v) {
12179
- this.inspectOpts.colors = this.useColors;
12180
- return util.inspect(v, this.inspectOpts);
12181
- };
12182
-
12183
- /**
12184
- * Adds ANSI color escape codes if enabled.
12185
- *
12186
- * @api public
12187
- */
12188
-
12189
- function formatArgs(args) {
12190
- var name = this.namespace;
12191
- var useColors = this.useColors;
12192
-
12193
- if (useColors) {
12194
- var c = this.color;
12195
- var prefix = ' \u001b[3' + c + ';1m' + name + ' ' + '\u001b[0m';
12196
-
12197
- args[0] = prefix + args[0].split('\n').join('\n' + prefix);
12198
- args.push('\u001b[3' + c + 'm+' + exports.humanize(this.diff) + '\u001b[0m');
12199
- } else {
12200
- args[0] = new Date().toUTCString()
12201
- + ' ' + name + ' ' + args[0];
12202
- }
12203
- }
12204
-
12205
- /**
12206
- * Invokes `util.format()` with the specified arguments and writes to `stream`.
12207
- */
12208
-
12209
- function log() {
12210
- return stream.write(util.format.apply(util, arguments) + '\n');
12211
- }
12212
-
12213
- /**
12214
- * Save `namespaces`.
12215
- *
12216
- * @param {String} namespaces
12217
- * @api private
12218
- */
12219
-
12220
- function save(namespaces) {
12221
- if (null == namespaces) {
12222
- // If you set a process.env field to null or undefined, it gets cast to the
12223
- // string 'null' or 'undefined'. Just delete instead.
12224
- delete process.env.DEBUG;
12225
- } else {
12226
- process.env.DEBUG = namespaces;
12227
- }
12228
- }
12229
-
12230
- /**
12231
- * Load `namespaces`.
12232
- *
12233
- * @return {String} returns the previously persisted debug modes
12234
- * @api private
12235
- */
12236
-
12237
- function load() {
12238
- return process.env.DEBUG;
12239
- }
12240
-
12241
- /**
12242
- * Copied from `node/src/node.js`.
12243
- *
12244
- * XXX: It's lame that node doesn't expose this API out-of-the-box. It also
12245
- * relies on the undocumented `tty_wrap.guessHandleType()` which is also lame.
12246
- */
12247
-
12248
- function createWritableStdioStream (fd) {
12249
- var stream;
12250
- var tty_wrap = process.binding('tty_wrap');
12251
-
12252
- // Note stream._type is used for test-module-load-list.js
12253
-
12254
- switch (tty_wrap.guessHandleType(fd)) {
12255
- case 'TTY':
12256
- stream = new tty.WriteStream(fd);
12257
- stream._type = 'tty';
12258
-
12259
- // Hack to have stream not keep the event loop alive.
12260
- // See https://github.com/joyent/node/issues/1726
12261
- if (stream._handle && stream._handle.unref) {
12262
- stream._handle.unref();
12263
- }
12264
- break;
12265
-
12266
- case 'FILE':
12267
- var fs$$1 = fs;
12268
- stream = new fs$$1.SyncWriteStream(fd, { autoClose: false });
12269
- stream._type = 'fs';
12270
- break;
12271
-
12272
- case 'PIPE':
12273
- case 'TCP':
12274
- var net$$1 = net;
12275
- stream = new net$$1.Socket({
12276
- fd: fd,
12277
- readable: false,
12278
- writable: true
12279
- });
12280
-
12281
- // FIXME Should probably have an option in net.Socket to create a
12282
- // stream from an existing fd which is writable only. But for now
12283
- // we'll just add this hack and set the `readable` member to false.
12284
- // Test: ./node test/fixtures/echo.js < /etc/passwd
12285
- stream.readable = false;
12286
- stream.read = null;
12287
- stream._type = 'pipe';
12288
-
12289
- // FIXME Hack to have stream not keep the event loop alive.
12290
- // See https://github.com/joyent/node/issues/1726
12291
- if (stream._handle && stream._handle.unref) {
12292
- stream._handle.unref();
12293
- }
12294
- break;
12295
-
12296
- default:
12297
- // Probably an error on in uv_guess_handle()
12298
- throw new Error('Implement me. Unknown stream file type!');
12299
- }
12300
-
12301
- // For supporting legacy API we put the FD here.
12302
- stream.fd = fd;
12303
-
12304
- stream._isStdio = true;
12305
-
12306
- return stream;
12307
- }
12308
-
12309
- /**
12310
- * Init logic for `debug` instances.
12311
- *
12312
- * Create a new `inspectOpts` object in case `useColors` is set
12313
- * differently for a particular `debug` instance.
12314
- */
12315
-
12316
- function init (debug$$1) {
12317
- debug$$1.inspectOpts = {};
12318
-
12319
- var keys = Object.keys(exports.inspectOpts);
12320
- for (var i = 0; i < keys.length; i++) {
12321
- debug$$1.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
12322
- }
12323
- }
12324
-
12325
- /**
12326
- * Enable namespaces listed in `process.env.DEBUG` initially.
12327
- */
12328
-
12329
- exports.enable(load());
12330
- });
12331
- var node_1 = node.init;
12332
- var node_2 = node.log;
12333
- var node_3 = node.formatArgs;
12334
- var node_4 = node.save;
12335
- var node_5 = node.load;
12336
- var node_6 = node.useColors;
12337
- var node_7 = node.colors;
12338
- var node_8 = node.inspectOpts;
12339
-
12340
- var src$1 = createCommonjsModule(function (module) {
12341
- /**
12342
- * Detect Electron renderer process, which is node, but we should
12343
- * treat as a browser.
12344
- */
12345
-
12346
- if (typeof process !== 'undefined' && process.type === 'renderer') {
12347
- module.exports = browser;
12348
- } else {
12349
- module.exports = node;
12350
- }
12351
- });
12352
-
12353
- var functionNames = createCommonjsModule(function (module, exports) {
12354
-
12355
- Object.defineProperty(exports, "__esModule", {
12356
- value: true
12357
- });
12358
-
12359
-
12360
- /**
12361
- * @see https://developers.google.com/youtube/iframe_api_reference#Functions
12362
- */
12363
- exports.default = ['cueVideoById', 'loadVideoById', 'cueVideoByUrl', 'loadVideoByUrl', 'playVideo', 'pauseVideo', 'stopVideo', 'getVideoLoadedFraction', 'cuePlaylist', 'loadPlaylist', 'nextVideo', 'previousVideo', 'playVideoAt', 'setShuffle', 'setLoop', 'getPlaylist', 'getPlaylistIndex', 'setOption', 'mute', 'unMute', 'isMuted', 'setVolume', 'getVolume', 'seekTo', 'getPlayerState', 'getPlaybackRate', 'setPlaybackRate', 'getAvailablePlaybackRates', 'getPlaybackQuality', 'setPlaybackQuality', 'getAvailableQualityLevels', 'getCurrentTime', 'getDuration', 'removeEventListener', 'getVideoUrl', 'getVideoEmbedCode', 'getOptions', 'getOption', 'addEventListener', 'destroy', 'setSize', 'getIframe'];
12364
- module.exports = exports['default'];
12365
- });
12366
-
12367
- unwrapExports(functionNames);
12368
-
12369
- var eventNames = createCommonjsModule(function (module, exports) {
12370
-
12371
- Object.defineProperty(exports, "__esModule", {
12372
- value: true
12373
- });
12374
-
12375
-
12376
- /**
12377
- * @see https://developers.google.com/youtube/iframe_api_reference#Events
12378
- * `volumeChange` is not officially supported but seems to work
12379
- * it emits an object: `{volume: 82.6923076923077, muted: false}`
12380
- */
12381
- exports.default = ['ready', 'stateChange', 'playbackQualityChange', 'playbackRateChange', 'error', 'apiChange', 'volumeChange'];
12382
- module.exports = exports['default'];
12383
- });
12384
-
12385
- unwrapExports(eventNames);
12386
-
12387
- var PlayerStates = createCommonjsModule(function (module, exports) {
12388
-
12389
- Object.defineProperty(exports, "__esModule", {
12390
- value: true
12391
- });
12392
- exports.default = {
12393
- BUFFERING: 3,
12394
- ENDED: 0,
12395
- PAUSED: 2,
12396
- PLAYING: 1,
12397
- UNSTARTED: -1,
12398
- VIDEO_CUED: 5
12399
- };
12400
- module.exports = exports["default"];
12401
- });
12402
-
12403
- unwrapExports(PlayerStates);
12404
-
12405
- var FunctionStateMap = createCommonjsModule(function (module, exports) {
12406
-
12407
- Object.defineProperty(exports, "__esModule", {
12408
- value: true
12409
- });
12410
-
12411
-
12412
-
12413
- var _PlayerStates2 = _interopRequireDefault(PlayerStates);
12414
-
12415
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12416
-
12417
- exports.default = {
12418
- pauseVideo: {
12419
- acceptableStates: [_PlayerStates2.default.ENDED, _PlayerStates2.default.PAUSED],
12420
- stateChangeRequired: false
12421
- },
12422
- playVideo: {
12423
- acceptableStates: [_PlayerStates2.default.ENDED, _PlayerStates2.default.PLAYING],
12424
- stateChangeRequired: false
12425
- },
12426
- seekTo: {
12427
- acceptableStates: [_PlayerStates2.default.ENDED, _PlayerStates2.default.PLAYING, _PlayerStates2.default.PAUSED],
12428
- stateChangeRequired: true,
12429
-
12430
- // TRICKY: `seekTo` may not cause a state change if no buffering is
12431
- // required.
12432
- timeout: 3000
12433
- }
12434
- };
12435
- module.exports = exports['default'];
12436
- });
12437
-
12438
- unwrapExports(FunctionStateMap);
12439
-
12440
- var YouTubePlayer_1 = createCommonjsModule(function (module, exports) {
12441
-
12442
- Object.defineProperty(exports, "__esModule", {
12443
- value: true
12444
- });
12445
-
12446
-
12447
-
12448
- var _debug2 = _interopRequireDefault(src$1);
12449
-
12450
-
12451
-
12452
- var _functionNames2 = _interopRequireDefault(functionNames);
12453
-
12454
-
12455
-
12456
- var _eventNames2 = _interopRequireDefault(eventNames);
12457
-
12458
-
12459
-
12460
- var _FunctionStateMap2 = _interopRequireDefault(FunctionStateMap);
12461
-
12462
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12463
-
12464
- /* eslint-disable promise/prefer-await-to-then */
12465
-
12466
- var debug = (0, _debug2.default)('youtube-player');
12467
-
12468
- var YouTubePlayer = {};
12469
-
12470
- /**
12471
- * Construct an object that defines an event handler for all of the YouTube
12472
- * player events. Proxy captured events through an event emitter.
12473
- *
12474
- * @todo Capture event parameters.
12475
- * @see https://developers.google.com/youtube/iframe_api_reference#Events
12476
- */
12477
- YouTubePlayer.proxyEvents = function (emitter) {
12478
- var events = {};
12479
-
12480
- var _loop = function _loop(eventName) {
12481
- var onEventName = 'on' + eventName.slice(0, 1).toUpperCase() + eventName.slice(1);
12482
-
12483
- events[onEventName] = function (event) {
12484
- debug('event "%s"', onEventName, event);
12485
-
12486
- emitter.trigger(eventName, event);
12487
- };
12488
- };
12489
-
12490
- var _iteratorNormalCompletion = true;
12491
- var _didIteratorError = false;
12492
- var _iteratorError = undefined;
12493
-
12494
- try {
12495
- for (var _iterator = _eventNames2.default[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
12496
- var eventName = _step.value;
12497
-
12498
- _loop(eventName);
12499
- }
12500
- } catch (err) {
12501
- _didIteratorError = true;
12502
- _iteratorError = err;
12503
- } finally {
12504
- try {
12505
- if (!_iteratorNormalCompletion && _iterator.return) {
12506
- _iterator.return();
12507
- }
12508
- } finally {
12509
- if (_didIteratorError) {
12510
- throw _iteratorError;
12511
- }
12512
- }
12513
- }
12514
-
12515
- return events;
12516
- };
12517
-
12518
- /**
12519
- * Delays player API method execution until player state is ready.
12520
- *
12521
- * @todo Proxy all of the methods using Object.keys.
12522
- * @todo See TRICKY below.
12523
- * @param playerAPIReady Promise that resolves when player is ready.
12524
- * @param strictState A flag designating whether or not to wait for
12525
- * an acceptable state when calling supported functions.
12526
- * @returns {Object}
12527
- */
12528
- YouTubePlayer.promisifyPlayer = function (playerAPIReady) {
12529
- var strictState = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
12530
-
12531
- var functions = {};
12532
-
12533
- var _loop2 = function _loop2(functionName) {
12534
- if (strictState && _FunctionStateMap2.default[functionName]) {
12535
- functions[functionName] = function () {
12536
- for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
12537
- args[_key] = arguments[_key];
12538
- }
12539
-
12540
- return playerAPIReady.then(function (player) {
12541
- var stateInfo = _FunctionStateMap2.default[functionName];
12542
- var playerState = player.getPlayerState();
12543
-
12544
- // eslint-disable-next-line no-warning-comments
12545
- // TODO: Just spread the args into the function once Babel is fixed:
12546
- // https://github.com/babel/babel/issues/4270
12547
- //
12548
- // eslint-disable-next-line prefer-spread
12549
- var value = player[functionName].apply(player, args);
12550
-
12551
- // TRICKY: For functions like `seekTo`, a change in state must be
12552
- // triggered given that the resulting state could match the initial
12553
- // state.
12554
- if (stateInfo.stateChangeRequired ||
12555
-
12556
- // eslint-disable-next-line no-extra-parens
12557
- Array.isArray(stateInfo.acceptableStates) && stateInfo.acceptableStates.indexOf(playerState) === -1) {
12558
- return new Promise(function (resolve) {
12559
- var onPlayerStateChange = function onPlayerStateChange() {
12560
- var playerStateAfterChange = player.getPlayerState();
12561
-
12562
- var timeout = void 0;
12563
-
12564
- if (typeof stateInfo.timeout === 'number') {
12565
- timeout = setTimeout(function () {
12566
- player.removeEventListener('onStateChange', onPlayerStateChange);
12567
-
12568
- resolve();
12569
- }, stateInfo.timeout);
12570
- }
12571
-
12572
- if (Array.isArray(stateInfo.acceptableStates) && stateInfo.acceptableStates.indexOf(playerStateAfterChange) !== -1) {
12573
- player.removeEventListener('onStateChange', onPlayerStateChange);
12574
-
12575
- clearTimeout(timeout);
12576
-
12577
- resolve();
12578
- }
12579
- };
12580
-
12581
- player.addEventListener('onStateChange', onPlayerStateChange);
12582
- }).then(function () {
12583
- return value;
12584
- });
12585
- }
12586
-
12587
- return value;
12588
- });
12589
- };
12590
- } else {
12591
- functions[functionName] = function () {
12592
- for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
12593
- args[_key2] = arguments[_key2];
12594
- }
12595
-
12596
- return playerAPIReady.then(function (player) {
12597
- // eslint-disable-next-line no-warning-comments
12598
- // TODO: Just spread the args into the function once Babel is fixed:
12599
- // https://github.com/babel/babel/issues/4270
12600
- //
12601
- // eslint-disable-next-line prefer-spread
12602
- return player[functionName].apply(player, args);
12603
- });
12604
- };
12605
- }
12606
- };
12607
-
12608
- var _iteratorNormalCompletion2 = true;
12609
- var _didIteratorError2 = false;
12610
- var _iteratorError2 = undefined;
12611
-
12612
- try {
12613
- for (var _iterator2 = _functionNames2.default[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
12614
- var functionName = _step2.value;
12615
-
12616
- _loop2(functionName);
12617
- }
12618
- } catch (err) {
12619
- _didIteratorError2 = true;
12620
- _iteratorError2 = err;
12621
- } finally {
12622
- try {
12623
- if (!_iteratorNormalCompletion2 && _iterator2.return) {
12624
- _iterator2.return();
12625
- }
12626
- } finally {
12627
- if (_didIteratorError2) {
12628
- throw _iteratorError2;
12629
- }
12630
- }
12631
- }
12632
-
12633
- return functions;
12634
- };
12635
-
12636
- exports.default = YouTubePlayer;
12637
- module.exports = exports['default'];
12638
- });
12639
-
12640
- unwrapExports(YouTubePlayer_1);
12641
-
12642
- var dist = createCommonjsModule(function (module, exports) {
12643
-
12644
- Object.defineProperty(exports, "__esModule", {
12645
- value: true
12646
- });
12647
-
12648
- var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
12649
-
12650
-
12651
-
12652
- var _sister2 = _interopRequireDefault(sister);
12653
-
12654
-
12655
-
12656
- var _loadYouTubeIframeApi2 = _interopRequireDefault(loadYouTubeIframeApi);
12657
-
12658
-
12659
-
12660
- var _YouTubePlayer2 = _interopRequireDefault(YouTubePlayer_1);
12661
-
12662
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12663
-
12664
- /**
12665
- * @typedef YT.Player
12666
- * @see https://developers.google.com/youtube/iframe_api_reference
12667
- * */
12668
-
12669
- /**
12670
- * @see https://developers.google.com/youtube/iframe_api_reference#Loading_a_Video_Player
12671
- */
12672
- var youtubeIframeAPI = void 0;
12673
-
12674
- /**
12675
- * A factory function used to produce an instance of YT.Player and queue function calls and proxy events of the resulting object.
12676
- *
12677
- * @param maybeElementId Either An existing YT.Player instance,
12678
- * the DOM element or the id of the HTML element where the API will insert an <iframe>.
12679
- * @param options See `options` (Ignored when using an existing YT.Player instance).
12680
- * @param strictState A flag designating whether or not to wait for
12681
- * an acceptable state when calling supported functions. Default: `false`.
12682
- * See `FunctionStateMap.js` for supported functions and acceptable states.
12683
- */
12684
-
12685
- exports.default = function (maybeElementId) {
12686
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
12687
- var strictState = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
12688
-
12689
- var emitter = (0, _sister2.default)();
12690
-
12691
- if (!youtubeIframeAPI) {
12692
- youtubeIframeAPI = (0, _loadYouTubeIframeApi2.default)(emitter);
12693
- }
12694
-
12695
- if (options.events) {
12696
- throw new Error('Event handlers cannot be overwritten.');
12697
- }
12698
-
12699
- if (typeof maybeElementId === 'string' && !document.getElementById(maybeElementId)) {
12700
- throw new Error('Element "' + maybeElementId + '" does not exist.');
12701
- }
12702
-
12703
- options.events = _YouTubePlayer2.default.proxyEvents(emitter);
12704
-
12705
- var playerAPIReady = new Promise(function (resolve) {
12706
- if ((typeof maybeElementId === 'undefined' ? 'undefined' : _typeof(maybeElementId)) === 'object' && maybeElementId.playVideo instanceof Function) {
12707
- var player = maybeElementId;
12708
-
12709
- resolve(player);
12710
- } else {
12711
- // asume maybeElementId can be rendered inside
12712
- // eslint-disable-next-line promise/catch-or-return
12713
- youtubeIframeAPI.then(function (YT) {
12714
- // eslint-disable-line promise/prefer-await-to-then
12715
- var player = new YT.Player(maybeElementId, options);
12716
-
12717
- emitter.on('ready', function () {
12718
- resolve(player);
12719
- });
12720
-
12721
- return null;
12722
- });
12723
- }
12724
- });
12725
-
12726
- var playerApi = _YouTubePlayer2.default.promisifyPlayer(playerAPIReady, strictState);
12727
-
12728
- playerApi.on = emitter.on;
12729
- playerApi.off = emitter.off;
12730
-
12731
- return playerApi;
12732
- };
12733
-
12734
- module.exports = exports['default'];
12735
- });
12736
-
12737
- var youTubePlayer = unwrapExports(dist);
12738
-
12739
- var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
12740
-
12741
- var _extends$3 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
12742
-
12743
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
12744
-
12745
- function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
12746
-
12747
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
12748
-
12749
- /**
12750
- * Check whether a `props` change should result in the video being updated.
12751
- *
12752
- * @param {Object} prevProps
12753
- * @param {Object} props
12754
- */
12755
- function shouldUpdateVideo(prevProps, props) {
12756
- // A changing video should always trigger an update
12757
- if (prevProps.videoId !== props.videoId) {
12758
- return true;
12759
- }
12760
-
12761
- // Otherwise, a change in the start/end time playerVars also requires a player
12762
- // update.
12763
- var prevVars = prevProps.opts.playerVars || {};
12764
- var vars = props.opts.playerVars || {};
12765
-
12766
- return prevVars.start !== vars.start || prevVars.end !== vars.end;
12767
- }
12768
-
12769
- /**
12770
- * Neutralise API options that only require a video update, leaving only options
12771
- * that require a player reset. The results can then be compared to see if a
12772
- * player reset is necessary.
12773
- *
12774
- * @param {Object} opts
12775
- */
12776
- function filterResetOptions(opts) {
12777
- return _extends$3({}, opts, {
12778
- playerVars: _extends$3({}, opts.playerVars, {
12779
- autoplay: 0,
12780
- start: 0,
12781
- end: 0
12782
- })
12783
- });
12784
- }
12785
-
12786
- /**
12787
- * Check whether a `props` change should result in the player being reset.
12788
- * The player is reset when the `props.opts` change, except if the only change
12789
- * is in the `start` and `end` playerVars, because a video update can deal with
12790
- * those.
12791
- *
12792
- * @param {Object} prevProps
12793
- * @param {Object} props
12794
- */
12795
- function shouldResetPlayer(prevProps, props) {
12796
- return !fastDeepEqual(filterResetOptions(prevProps.opts), filterResetOptions(props.opts));
12797
- }
12798
-
12799
- /**
12800
- * Check whether a props change should result in an id or className update.
12801
- *
12802
- * @param {Object} prevProps
12803
- * @param {Object} props
12804
- */
12805
- function shouldUpdatePlayer(prevProps, props) {
12806
- return prevProps.id !== props.id || prevProps.className !== props.className;
12807
- }
12808
-
12809
- var YouTube = function (_React$Component) {
12810
- _inherits(YouTube, _React$Component);
12811
-
12812
- function YouTube(props) {
12813
- _classCallCheck(this, YouTube);
12814
-
12815
- var _this = _possibleConstructorReturn(this, (YouTube.__proto__ || Object.getPrototypeOf(YouTube)).call(this, props));
12816
-
12817
- _this.onPlayerReady = function (event) {
12818
- return _this.props.onReady(event);
12819
- };
12820
-
12821
- _this.onPlayerError = function (event) {
12822
- return _this.props.onError(event);
12823
- };
12824
-
12825
- _this.onPlayerStateChange = function (event) {
12826
- _this.props.onStateChange(event);
12827
- switch (event.data) {
12828
-
12829
- case YouTube.PlayerState.ENDED:
12830
- _this.props.onEnd(event);
12831
- break;
12832
-
12833
- case YouTube.PlayerState.PLAYING:
12834
- _this.props.onPlay(event);
12835
- break;
12836
-
12837
- case YouTube.PlayerState.PAUSED:
12838
- _this.props.onPause(event);
12839
- break;
12840
-
12841
- default:
12842
- }
12843
- };
12844
-
12845
- _this.onPlayerPlaybackRateChange = function (event) {
12846
- return _this.props.onPlaybackRateChange(event);
12847
- };
12848
-
12849
- _this.onPlayerPlaybackQualityChange = function (event) {
12850
- return _this.props.onPlaybackQualityChange(event);
12851
- };
12852
-
12853
- _this.createPlayer = function () {
12854
- // do not attempt to create a player server-side, it won't work
12855
- if (typeof document === 'undefined') return;
12856
- // create player
12857
- var playerOpts = _extends$3({}, _this.props.opts, {
12858
- // preload the `videoId` video if one is already given
12859
- videoId: _this.props.videoId
12860
- });
12861
- _this.internalPlayer = youTubePlayer(_this.container, playerOpts);
12862
- // attach event handlers
12863
- _this.internalPlayer.on('ready', _this.onPlayerReady);
12864
- _this.internalPlayer.on('error', _this.onPlayerError);
12865
- _this.internalPlayer.on('stateChange', _this.onPlayerStateChange);
12866
- _this.internalPlayer.on('playbackRateChange', _this.onPlayerPlaybackRateChange);
12867
- _this.internalPlayer.on('playbackQualityChange', _this.onPlayerPlaybackQualityChange);
12868
- };
12869
-
12870
- _this.resetPlayer = function () {
12871
- return _this.internalPlayer.destroy().then(_this.createPlayer);
12872
- };
12873
-
12874
- _this.updatePlayer = function () {
12875
- _this.internalPlayer.getIframe().then(function (iframe) {
12876
- if (_this.props.id) iframe.setAttribute('id', _this.props.id);else iframe.removeAttribute('id');
12877
- if (_this.props.className) iframe.setAttribute('class', _this.props.className);else iframe.removeAttribute('class');
12878
- });
12879
- };
12880
-
12881
- _this.updateVideo = function () {
12882
- if (typeof _this.props.videoId === 'undefined' || _this.props.videoId === null) {
12883
- _this.internalPlayer.stopVideo();
12884
- return;
12885
- }
12886
-
12887
- // set queueing options
12888
- var autoplay = false;
12889
- var opts = {
12890
- videoId: _this.props.videoId
12891
- };
12892
- if ('playerVars' in _this.props.opts) {
12893
- autoplay = _this.props.opts.playerVars.autoplay === 1;
12894
- if ('start' in _this.props.opts.playerVars) {
12895
- opts.startSeconds = _this.props.opts.playerVars.start;
12896
- }
12897
- if ('end' in _this.props.opts.playerVars) {
12898
- opts.endSeconds = _this.props.opts.playerVars.end;
12899
- }
12900
- }
12901
-
12902
- // if autoplay is enabled loadVideoById
12903
- if (autoplay) {
12904
- _this.internalPlayer.loadVideoById(opts);
12905
- return;
12906
- }
12907
- // default behaviour just cues the video
12908
- _this.internalPlayer.cueVideoById(opts);
12909
- };
12910
-
12911
- _this.refContainer = function (container) {
12912
- _this.container = container;
12913
- };
12914
-
12915
- _this.container = null;
12916
- _this.internalPlayer = null;
12917
- return _this;
12918
- }
12919
-
12920
- /**
12921
- * Expose PlayerState constants for convenience. These constants can also be
12922
- * accessed through the global YT object after the YouTube IFrame API is instantiated.
12923
- * https://developers.google.com/youtube/iframe_api_reference#onStateChange
12924
- */
12925
-
12926
-
12927
- _createClass(YouTube, [{
12928
- key: 'componentDidMount',
12929
- value: function componentDidMount() {
12930
- this.createPlayer();
12931
- }
12932
- }, {
12933
- key: 'componentDidUpdate',
12934
- value: function componentDidUpdate(prevProps) {
12935
- if (shouldUpdatePlayer(prevProps, this.props)) {
12936
- this.updatePlayer();
12937
- }
12938
-
12939
- if (shouldResetPlayer(prevProps, this.props)) {
12940
- this.resetPlayer();
12941
- }
12942
-
12943
- if (shouldUpdateVideo(prevProps, this.props)) {
12944
- this.updateVideo();
12945
- }
12946
- }
12947
- }, {
12948
- key: 'componentWillUnmount',
12949
- value: function componentWillUnmount() {
12950
- /**
12951
- * Note: The `youtube-player` package that is used promisifies all Youtube
12952
- * Player API calls, which introduces a delay of a tick before it actually
12953
- * gets destroyed. Since React attempts to remove the element instantly
12954
- * this method isn't quick enough to reset the container element.
12955
- */
12956
- this.internalPlayer.destroy();
12957
- }
12958
-
12959
- /**
12960
- * https://developers.google.com/youtube/iframe_api_reference#onReady
12961
- *
12962
- * @param {Object} event
12963
- * @param {Object} target - player object
12964
- */
12965
-
12966
-
12967
- /**
12968
- * https://developers.google.com/youtube/iframe_api_reference#onError
12969
- *
12970
- * @param {Object} event
12971
- * @param {Integer} data - error type
12972
- * @param {Object} target - player object
12973
- */
12974
-
12975
-
12976
- /**
12977
- * https://developers.google.com/youtube/iframe_api_reference#onStateChange
12978
- *
12979
- * @param {Object} event
12980
- * @param {Integer} data - status change type
12981
- * @param {Object} target - actual YT player
12982
- */
12983
-
12984
-
12985
- /**
12986
- * https://developers.google.com/youtube/iframe_api_reference#onPlaybackRateChange
12987
- *
12988
- * @param {Object} event
12989
- * @param {Float} data - playback rate
12990
- * @param {Object} target - actual YT player
12991
- */
12992
-
12993
-
12994
- /**
12995
- * https://developers.google.com/youtube/iframe_api_reference#onPlaybackQualityChange
12996
- *
12997
- * @param {Object} event
12998
- * @param {String} data - playback quality
12999
- * @param {Object} target - actual YT player
13000
- */
13001
-
13002
-
13003
- /**
13004
- * Initialize the Youtube Player API on the container and attach event handlers
13005
- */
13006
-
13007
-
13008
- /**
13009
- * Shorthand for destroying and then re-creating the Youtube Player
13010
- */
13011
-
13012
-
13013
- /**
13014
- * Method to update the id and class of the Youtube Player iframe.
13015
- * React should update this automatically but since the Youtube Player API
13016
- * replaced the DIV that is mounted by React we need to do this manually.
13017
- */
13018
-
13019
-
13020
- /**
13021
- * Call Youtube Player API methods to update the currently playing video.
13022
- * Depeding on the `opts.playerVars.autoplay` this function uses one of two
13023
- * Youtube Player API methods to update the video.
13024
- */
13025
-
13026
- }, {
13027
- key: 'render',
13028
- value: function render() {
13029
- return React__default.createElement(
13030
- 'div',
13031
- { className: this.props.containerClassName },
13032
- React__default.createElement('div', { id: this.props.id, className: this.props.className, ref: this.refContainer })
13033
- );
13034
- }
13035
- }]);
13036
-
13037
- return YouTube;
13038
- }(React__default.Component);
13039
-
13040
- YouTube.propTypes = {
13041
- videoId: PropTypes.string,
13042
-
13043
- // custom ID for player element
13044
- id: PropTypes.string,
13045
-
13046
- // custom class name for player element
13047
- className: PropTypes.string,
13048
- // custom class name for player container element
13049
- containerClassName: PropTypes.string,
13050
-
13051
- // https://developers.google.com/youtube/iframe_api_reference#Loading_a_Video_Player
13052
- opts: PropTypes.objectOf(PropTypes.any),
13053
-
13054
- // event subscriptions
13055
- onReady: PropTypes.func,
13056
- onError: PropTypes.func,
13057
- onPlay: PropTypes.func,
13058
- onPause: PropTypes.func,
13059
- onEnd: PropTypes.func,
13060
- onStateChange: PropTypes.func,
13061
- onPlaybackRateChange: PropTypes.func,
13062
- onPlaybackQualityChange: PropTypes.func
13063
- };
13064
- YouTube.defaultProps = {
13065
- id: null,
13066
- className: null,
13067
- opts: {},
13068
- containerClassName: '',
13069
- onReady: function onReady() {},
13070
- onError: function onError() {},
13071
- onPlay: function onPlay() {},
13072
- onPause: function onPause() {},
13073
- onEnd: function onEnd() {},
13074
- onStateChange: function onStateChange() {},
13075
- onPlaybackRateChange: function onPlaybackRateChange() {},
13076
- onPlaybackQualityChange: function onPlaybackQualityChange() {}
13077
- };
13078
- YouTube.PlayerState = {
13079
- UNSTARTED: -1,
13080
- ENDED: 0,
13081
- PLAYING: 1,
13082
- PAUSED: 2,
13083
- BUFFERING: 3,
13084
- CUED: 5
13085
- };
13086
-
13087
- var Youtube = function Youtube(props) {
13088
- var youtubeThumbnail = require('youtube-thumbnail');
13089
- var thumbnail1 = youtubeThumbnail('https://www.youtube.com/watch?v=5AlrMieL_Gg');
13090
- var thumbnail2 = youtubeThumbnail('https://www.youtube.com/watch?v=72RUDa7HvpE');
13091
- var thumbnail3 = youtubeThumbnail('https://www.youtube.com/watch?v=GpaPNBptW2E');
13092
- var thumbnail4 = youtubeThumbnail('https://www.youtube.com/watch?v=R7WO9YuXXs4');
13093
-
13094
- var url$$1 = props.url;
13095
-
13096
- var id = getYoutubeId(url$$1);
13097
-
13098
- return React__default.createElement(
13099
- 'div',
13100
- null,
13101
- React__default.createElement(YouTube, { videoId: id, className: 'youtube' }),
13102
- React__default.createElement(
13103
- 'div',
13104
- {
13105
- style: {
13106
- display: 'flex',
13107
- flexDirection: 'row',
13108
- justifyContent: 'flex-start',
13109
- width: '100%',
13110
- overflow: 'hidden'
13111
- } },
13112
- React__default.createElement(
13113
- 'div',
13114
- { style: { flex: '1 0 25%' } },
13115
- React__default.createElement('img', { src: thumbnail1.high.url, style: { width: '100%', border: '1px solid white' } })
13116
- ),
13117
- React__default.createElement(
13118
- 'div',
13119
- { style: { flex: '1 0 25%' } },
13120
- React__default.createElement('img', { src: thumbnail2.high.url, style: { width: '100%', border: '1px solid white' } })
13121
- ),
13122
- React__default.createElement(
13123
- 'div',
13124
- { style: { flex: '1 0 25%' } },
13125
- React__default.createElement('img', { src: thumbnail3.high.url, style: { width: '100%', border: '1px solid white' } })
13126
- ),
13127
- React__default.createElement(
13128
- 'div',
13129
- { style: { flex: '1 0 25%' } },
13130
- React__default.createElement('img', { src: thumbnail4.high.url, style: { width: '100%', border: '1px solid white' } })
13131
- )
13132
- )
13133
- );
13134
- };
13135
-
13136
11241
  exports.DeckContent = Content;
13137
11242
  exports.DeckQueue = Queue;
13138
11243
  exports.Column2 = Column2;
@@ -13142,5 +11247,4 @@ exports.LeftNav = LeftNav;
13142
11247
  exports.NavMagazine = Magazine;
13143
11248
  exports.NavNative = Native;
13144
11249
  exports.NavNormal = Normal;
13145
- exports.YoutubePlayer = Youtube;
13146
11250
  //# sourceMappingURL=index.js.map