· 6 years ago · Sep 06, 2019, 11:02 PM
1'use strict';
2!function(m) {
3 /**
4 * @param {string} i
5 * @return {?}
6 */
7 function t(i) {
8 if (n[i]) {
9 return n[i].exports;
10 }
11 var module = n[i] = {
12 i : i,
13 l : false,
14 exports : {}
15 };
16 return m[i].call(module.exports, module, module.exports, t), module.l = true, module.exports;
17 }
18 var n = {};
19 /** @type {!Array} */
20 t.m = m;
21 t.c = n;
22 /**
23 * @param {!Function} d
24 * @param {string} name
25 * @param {!Function} n
26 * @return {undefined}
27 */
28 t.d = function(d, name, n) {
29 if (!t.o(d, name)) {
30 Object.defineProperty(d, name, {
31 enumerable : true,
32 get : n
33 });
34 }
35 };
36 /**
37 * @param {!Object} x
38 * @return {undefined}
39 */
40 t.r = function(x) {
41 if ("undefined" != typeof Symbol && Symbol.toStringTag) {
42 Object.defineProperty(x, Symbol.toStringTag, {
43 value : "Module"
44 });
45 }
46 Object.defineProperty(x, "__esModule", {
47 value : true
48 });
49 };
50 /**
51 * @param {!Object} a
52 * @param {number} b
53 * @return {?}
54 */
55 t.t = function(a, b) {
56 if (1 & b && (a = t(a)), 8 & b) {
57 return a;
58 }
59 if (4 & b && "object" == typeof a && a && a.__esModule) {
60 return a;
61 }
62 /** @type {!Object} */
63 var d = Object.create(null);
64 if (t.r(d), Object.defineProperty(d, "default", {
65 enumerable : true,
66 value : a
67 }), 2 & b && "string" != typeof a) {
68 var key;
69 for (key in a) {
70 t.d(d, key, function(howMany) {
71 return a[howMany];
72 }.bind(null, key));
73 }
74 }
75 return d;
76 };
77 /**
78 * @param {!Object} module
79 * @return {?}
80 */
81 t.n = function(module) {
82 /** @type {function(): ?} */
83 var n = module && module.__esModule ? function() {
84 return module.default;
85 } : function() {
86 return module;
87 };
88 return t.d(n, "a", n), n;
89 };
90 /**
91 * @param {!Function} arg
92 * @param {string} str
93 * @return {?}
94 */
95 t.o = function(arg, str) {
96 return Object.prototype.hasOwnProperty.call(arg, str);
97 };
98 /** @type {string} */
99 t.p = "";
100 t(t.s = 5);
101}([function(canCreateDiscussions, exports, n) {
102 /**
103 * @param {!Object} metapakModulesSequence
104 * @return {?}
105 */
106 function render(metapakModulesSequence) {
107 return metapakModulesSequence.reduce(function(webstrates, wrappersTemplates) {
108 return wrappersTemplates.forEach(function(mappedSubSystem, webstrateId) {
109 if (!webstrates[webstrateId].includes(mappedSubSystem)) {
110 webstrates[webstrateId].push(mappedSubSystem);
111 }
112 }), webstrates;
113 }, Array.from(new Array(Math.max.apply(Math, add_prefix(metapakModulesSequence.map(function(inRevIdx) {
114 return inRevIdx.length;
115 }))))).map(function() {
116 return [];
117 }));
118 }
119 var r = this && this.__read || function(target, optionsValue) {
120 var value = "function" == typeof Symbol && target[Symbol.iterator];
121 if (!value) {
122 return target;
123 }
124 var result;
125 var mockConsole;
126 var cell = value.call(target);
127 /** @type {!Array} */
128 var linksArr = [];
129 try {
130 for (; (void 0 === optionsValue || optionsValue-- > 0) && !(result = cell.next()).done;) {
131 linksArr.push(result.value);
132 }
133 } catch (Console_error) {
134 mockConsole = {
135 error : Console_error
136 };
137 } finally {
138 try {
139 if (result && !result.done && (value = cell.return)) {
140 value.call(cell);
141 }
142 } finally {
143 if (mockConsole) {
144 throw mockConsole.error;
145 }
146 }
147 }
148 return linksArr;
149 };
150 var add_prefix = this && this.__spread || function() {
151 /** @type {!Array} */
152 var bytes = [];
153 /** @type {number} */
154 var i = 0;
155 for (; i < arguments.length; i++) {
156 /** @type {!Array<?>} */
157 bytes = bytes.concat(r(arguments[i]));
158 }
159 return bytes;
160 };
161 Object.defineProperty(exports, "__esModule", {
162 value : true
163 });
164 /**
165 * @param {!Node} node
166 * @return {?}
167 */
168 exports.buildLineage = function(node) {
169 var ancestor = node.ancestor;
170 /** @type {!Array} */
171 var els = [node.descendant];
172 for (; els[0] !== ancestor;) {
173 els.unshift(els[0].parentElement);
174 }
175 return els;
176 };
177 /** @type {!RegExp} */
178 var regJsonFormat = /[A-Z]?[a-z]+/g;
179 /**
180 * @param {!Object} obj
181 * @return {?}
182 */
183 exports.findWordsInAttributes = function(obj) {
184 return ((obj.id + " " + obj.classList.value).match(regJsonFormat) || []).map(function(p_Interval) {
185 return p_Interval.toLowerCase();
186 });
187 };
188 /**
189 * @param {!Object} node
190 * @return {?}
191 */
192 exports.isElement = function(node) {
193 return node.nodeType === Node.ELEMENT_NODE;
194 };
195 /**
196 * @param {!HTMLElement} o
197 * @return {?}
198 */
199 exports.isImageContainerElement = function(o) {
200 return "FIGURE" === o.nodeName || "IMG" === o.nodeName || "PICTURE" === o.nodeName;
201 };
202 /**
203 * @param {!Object} el
204 * @return {?}
205 */
206 exports.isValidImgElement = function(el) {
207 return el.naturalWidth <= 1 && el.naturalHeight <= 1 || el.naturalWidth >= 200 && el.naturalHeight >= 100 || el.naturalWidth >= 100 && el.naturalHeight >= 200;
208 };
209 /**
210 * @param {!Object} metapakModulesSequence
211 * @return {?}
212 */
213 exports.zipContentLineages = function(metapakModulesSequence) {
214 return render(metapakModulesSequence.reduce(function(callsites, n) {
215 return callsites.concat(n.contentLineages);
216 }, []));
217 };
218 /** @type {function(!Object): ?} */
219 exports.zipLineages = render;
220}, function(canCreateDiscussions, t, require) {
221 var r = this && this.__extends || function() {
222 /**
223 * @param {!Function} pos
224 * @param {!Object} script
225 * @return {?}
226 */
227 var fn = function(pos, script) {
228 return (fn = Object.setPrototypeOf || {
229 __proto__ : []
230 } instanceof Array && function(uri, src) {
231 /** @type {!Object} */
232 uri.__proto__ = src;
233 } || function(dst, values) {
234 var i;
235 for (i in values) {
236 if (values.hasOwnProperty(i)) {
237 dst[i] = values[i];
238 }
239 }
240 })(pos, script);
241 };
242 return function(c, value) {
243 /**
244 * @return {undefined}
245 */
246 function data() {
247 /** @type {!Function} */
248 this.constructor = c;
249 }
250 fn(c, value);
251 c.prototype = null === value ? Object.create(value) : (data.prototype = value.prototype, new data);
252 };
253 }();
254 Object.defineProperty(t, "__esModule", {
255 value : true
256 });
257 var offsetFromCenter = function(d) {
258 /**
259 * @param {?} user
260 * @param {?} token
261 * @param {string} key
262 * @param {?} value
263 * @return {?}
264 */
265 function t(user, token, key, value) {
266 var that = d.call(this, user, token) || this;
267 return that._caption = key, that._credit = value, that;
268 }
269 return r(t, d), Object.defineProperty(t.prototype, "caption", {
270 get : function() {
271 return this._caption;
272 },
273 enumerable : true,
274 configurable : true
275 }), Object.defineProperty(t.prototype, "credit", {
276 get : function() {
277 return this._credit;
278 },
279 enumerable : true,
280 configurable : true
281 }), t;
282 }(require(2).default);
283 t.default = offsetFromCenter;
284}, function(canCreateDiscussions, t, n) {
285 Object.defineProperty(t, "__esModule", {
286 value : true
287 });
288 var offsetFromCenter = function() {
289 /**
290 * @param {!Object} isSlidingUp
291 * @param {!Object} $cont
292 * @return {undefined}
293 */
294 function WorkerDomAdapter(isSlidingUp, $cont) {
295 /** @type {!Array} */
296 this._containerLineage = [];
297 /** @type {!Array} */
298 this._contentLineages = [];
299 /** @type {!Object} */
300 this._containerLineage = isSlidingUp;
301 /** @type {!Object} */
302 this._contentLineages = $cont;
303 }
304 return Object.defineProperty(WorkerDomAdapter.prototype, "containerElement", {
305 get : function() {
306 return this._containerLineage.length ? this._containerLineage[this._containerLineage.length - 1] : null;
307 },
308 enumerable : true,
309 configurable : true
310 }), Object.defineProperty(WorkerDomAdapter.prototype, "containerLineage", {
311 get : function() {
312 return this._containerLineage;
313 },
314 enumerable : true,
315 configurable : true
316 }), Object.defineProperty(WorkerDomAdapter.prototype, "contentLineages", {
317 get : function() {
318 return this._contentLineages;
319 },
320 enumerable : true,
321 configurable : true
322 }), WorkerDomAdapter;
323 }();
324 t.default = offsetFromCenter;
325}, function(canCreateDiscussions, that, norm) {
326 var $ = this && this.__values || function(value) {
327 var func = "function" == typeof Symbol && value[Symbol.iterator];
328 /** @type {number} */
329 var pos = 0;
330 return func ? func.call(value) : {
331 next : function() {
332 return value && pos >= value.length && (value = void 0), {
333 value : value && value[pos++],
334 done : !value
335 };
336 }
337 };
338 };
339 Object.defineProperty(that, "__esModule", {
340 value : true
341 });
342 var n = norm(0);
343 /**
344 * @param {!Object} node
345 * @param {?} obj
346 * @return {?}
347 */
348 that.isValidContent = function(node, obj) {
349 return !obj.nodeNameBlacklist.some(function(match) {
350 return node.nodeName === match;
351 }) && (obj.nodeNameWhitelist.some(function(name) {
352 return node.nodeName === name || !!node.getElementsByTagName(name).length;
353 }) || !function(node) {
354 var mockConsole;
355 var value;
356 /** @type {string} */
357 var buffer = "";
358 try {
359 var entry = $(node.childNodes);
360 var arg = entry.next();
361 for (; !arg.done; arg = entry.next()) {
362 var node = arg.value;
363 if (node.nodeType === Node.TEXT_NODE) {
364 /** @type {string} */
365 buffer = buffer + node.textContent;
366 }
367 }
368 } catch (Console_error) {
369 mockConsole = {
370 error : Console_error
371 };
372 } finally {
373 try {
374 if (arg && !arg.done && (value = entry.return)) {
375 value.call(entry);
376 }
377 } finally {
378 if (mockConsole) {
379 throw mockConsole.error;
380 }
381 }
382 }
383 return buffer;
384 }(node).trim()) && !n.findWordsInAttributes(node).some(function(newScaleKey) {
385 return obj.attributeBlacklist.includes(newScaleKey);
386 }) && ("IMG" !== node.nodeName || n.isValidImgElement(node));
387 };
388}, function(canCreateDiscussions, t, floor) {
389 var r = this && this.__read || function(target, optionsValue) {
390 var value = "function" == typeof Symbol && target[Symbol.iterator];
391 if (!value) {
392 return target;
393 }
394 var result;
395 var mockConsole;
396 var cell = value.call(target);
397 /** @type {!Array} */
398 var linksArr = [];
399 try {
400 for (; (void 0 === optionsValue || optionsValue-- > 0) && !(result = cell.next()).done;) {
401 linksArr.push(result.value);
402 }
403 } catch (Console_error) {
404 mockConsole = {
405 error : Console_error
406 };
407 } finally {
408 try {
409 if (result && !result.done && (value = cell.return)) {
410 value.call(cell);
411 }
412 } finally {
413 if (mockConsole) {
414 throw mockConsole.error;
415 }
416 }
417 }
418 return linksArr;
419 };
420 var rej = this && this.__spread || function() {
421 /** @type {!Array} */
422 var bytes = [];
423 /** @type {number} */
424 var i = 0;
425 for (; i < arguments.length; i++) {
426 /** @type {!Array<?>} */
427 bytes = bytes.concat(r(arguments[i]));
428 }
429 return bytes;
430 };
431 Object.defineProperty(t, "__esModule", {
432 value : true
433 });
434 var startYNew = floor(13);
435 t.default = {
436 universal : {
437 textContainerSearch : {
438 additionalContentNodeNameBlacklist : ["ASIDE", "FOOTER", "HEADER"],
439 additionalContentMaxDepthDecrease : 1,
440 additionalContentMaxDepthIncrease : 1,
441 descendantNodeNameBlacklist : ["FORM"],
442 nodeNameBlacklist : ["BUTTON", "FIGURE", "FORM", "HEAD", "IFRAME", "NAV", "NOSCRIPT", "PICTURE", "SCRIPT", "STYLE"],
443 selectorBlacklist : ['[itemprop="author"], [itemprop="datePublished"]']
444 },
445 textContainerFilter : {
446 attributeFullWordBlacklist : ["ad", "carousel", "gallery", "related", "share", "subscribe", "subscription"],
447 attributeWordPartBlacklist : ["byline", "caption", "comment", "download", "interlude", "image", "meta", "newsletter", "photo", "promo", "pullquote", "recirc", "video"],
448 blacklistSelectors : [],
449 regexBlacklist : [/^\[[^\]]+\]$/],
450 singleSentenceOpenerBlacklist : ["\u25ba", "click here", "check out", "don't miss", "listen to this story", "read more", "related article:", "sign up for", "sponsored:", "this article appears in", "watch:"]
451 },
452 imageContainerSearch : {
453 descendantNodeNameBlacklist : ["FORM", "IFRAME"],
454 nodeNameBlacklist : ["FORM", "HEAD", "IFRAME", "NAV", "NOSCRIPT", "SCRIPT", "STYLE"],
455 selectorBlacklist : []
456 },
457 imageContainerFilter : {
458 attributeFullWordBlacklist : ["ad", "related", "share", "subscribe", "subscription"],
459 attributeWordPartBlacklist : ["interlude", "newsletter", "promo", "recirc", "video"],
460 blacklistSelectors : []
461 },
462 imageContainerMetadata : {
463 contentRegexBlacklist : [/audm/i],
464 contentRegexWhitelist : [],
465 captionSelectors : ["figcaption", '[class*="caption"i]', '[itemProp*="caption"i]', '[itemProp*="description"i]'],
466 creditSelectors : ['[class*="credit"i]', '[class*="source"i]', '[itemProp*="copyrightHolder"i]'],
467 imageWrapperAttributeWordParts : ["image", "img", "photo"]
468 },
469 imageContainerContent : {
470 nodeNameBlacklist : ["BUTTON"],
471 nodeNameWhitelist : ["IMG", "META", "PICTURE", "SOURCE"],
472 attributeBlacklist : ["expand", "icon", "share"]
473 },
474 textContainerSelection : {
475 nodeNameWhitelist : ["ASIDE", "BLOCKQUOTE", "DIV", "H1", "H2", "H3", "H4", "H5", "H6", "OL", "P", "PRE", "TABLE", "UL"],
476 ancestorNodeNameBlacklist : ["BLOCKQUOTE", "LI", "P"]
477 },
478 wordCountTraversalPathSearchLimitMultiplier : .75
479 },
480 publishers : [{
481 hostname : "ablogtowatch.com",
482 textContainerSearch : {
483 selectorBlacklist : [".ablog-adlabel"]
484 }
485 }, {
486 hostname : "99u.adobe.com",
487 textContainerFilter : {
488 attributeFullWordBlacklist : ["blockquote"]
489 }
490 }, {
491 hostname : "bostonglobe.com",
492 transpositions : [{
493 elementSelectors : [".article > .lead > *"],
494 parentElementSelector : ".article > .body"
495 }]
496 }, {
497 hostname : "cnn.com",
498 transpositions : [{
499 elementSelectors : [".el__leafmedia--sourced-paragraph > .zn-body__paragraph", ".l-container > .zn-body__paragraph:not(.zn-body__footer)", ".l-container > .zn-body__paragraph > h3"],
500 parentElementSelector : ".zn-body__read-all"
501 }]
502 }, {
503 hostname : "abcnews.go.com",
504 textContainerSearch : {
505 selectorBlacklist : ['[class*="insert"]']
506 }
507 }, {
508 hostname : "huffpost.com",
509 transpositions : [{
510 elementSelectors : ['#entry-text [data-rapid-subsec="paragraph"] > :not([data-rapid-subsec="paragraph"])'],
511 parentElementSelector : "#entry-text"
512 }]
513 }, {
514 hostname : "insider.com",
515 imageStrategy : startYNew.LazyImageStrategy.PostLoadImgTag
516 }, {
517 hostname : "invisionapp.com",
518 imageContainerSearch : {
519 selectorBlacklist : ['div[class^="TweetQuotecomponent"]']
520 }
521 }, {
522 hostname : "kotaku.com",
523 imageStrategy : startYNew.LazyImageStrategy.FigureImgDataSrc
524 }, {
525 hostname : "medium.com",
526 textContainerFilter : {
527 attributeFullWordWhitelist : ["ad"]
528 },
529 imageStrategy : startYNew.LazyImageStrategy.MediumScaleUp
530 }, {
531 hostname : "nytimes.com",
532 transpositions : [{
533 elementSelectors : [".story-body-1 > .story-body-text"],
534 parentElementSelector : ".story-body-2"
535 }],
536 imageStrategy : startYNew.LazyImageStrategy.NytFigureImageObject,
537 textContainerSearch : {
538 selectorBlacklist : ['[id*="ad"], .epkadsg3, .etfikam0, .ez3869y0']
539 },
540 imageContainerSearch : {
541 selectorBlacklist : ['[id*="ad"], .epkadsg3, .etfikam0, .ez3869y0']
542 }
543 }, {
544 hostname : "article-test.dev.readup.com",
545 transpositions : [{
546 elementSelectors : [".lead"],
547 parentElementSelector : ".lead + div"
548 }],
549 imageStrategy : startYNew.LazyImageStrategy.PostLoadImgTag
550 }, {
551 hostname : "sciencedaily.com",
552 transpositions : [{
553 elementSelectors : ["p.lead"],
554 parentElementSelector : "div#text"
555 }]
556 }, {
557 hostname : "sinocism.com",
558 textContainerFilter : {
559 blacklistSelectors : [function() {
560 var e = Array.from(document.getElementsByTagName("p")).find(function(oDom) {
561 return oDom.textContent.toLowerCase().startsWith("this week\u2019s issues of sinocism");
562 });
563 return e ? rej([e], Array.from(e.parentElement.children).filter(function(b) {
564 return e.compareDocumentPosition(b) & Node.DOCUMENT_POSITION_FOLLOWING;
565 })) : [];
566 }]
567 }
568 }, {
569 hostname : "theatlantic.com",
570 imageContainerSearch : {
571 selectorBlacklist : [".callout"]
572 },
573 imageStrategy : startYNew.LazyImageStrategy.AtlanticFigureImgDataSrcset
574 }, {
575 hostname : "thenewatlantis.com",
576 textContainerSearch : {
577 selectorBlacklist : ['.author, .epigraph, [style*="BellMT"], h2']
578 },
579 imageContainerSearch : {
580 selectorBlacklist : ['[style*="BellMT"]']
581 }
582 }, {
583 hostname : "variety.com",
584 contentSearchRootElementSelector : "article.c-content"
585 }, {
586 hostname : "wired.com",
587 textContainerFilter : {
588 attributeFullWordBlacklist : ["inset"],
589 blacklistSelectors : [function() {
590 var file = Array.from(document.getElementsByTagName("h3")).find(function(oDom) {
591 return oDom.textContent.toLowerCase().startsWith("more great wired stories");
592 });
593 return file && file.nextElementSibling ? [file, file.nextElementSibling] : [];
594 }]
595 },
596 imageContainerSearch : {
597 selectorBlacklist : [".inset"]
598 }
599 }, {
600 hostname : "news.harvard.edu",
601 textContainerFilter : {
602 attributeFullWordBlacklist : ["explore"]
603 }
604 }, {
605 hostname : "dark-mountain.net",
606 transpositions : [{
607 elementSelectors : [".entry-content > div > .component--drop-cap", ".entry-content > div > p"],
608 parentElementSelector : ".entry-content"
609 }]
610 }, {
611 hostname : "churchofjesuschrist.org",
612 transpositions : [{
613 elementSelectors : [".body-block > p", ".body-block > section:first-of-type > header > h2"],
614 parentElementSelector : ".body-block > section:first-of-type"
615 }]
616 }, {
617 hostname : "cjr.org",
618 textContainerFilter : {
619 blacklistSelectors : [function() {
620 return Array.from(document.getElementsByTagName("p")).filter(function(childNode) {
621 return childNode.textContent.startsWith("ICYMI:");
622 });
623 }]
624 }
625 }, {
626 hostname : "telegraph.co.uk",
627 transpositions : [{
628 elementSelectors : ['#mainBodyArea > div[class$="Par"] > *'],
629 parentElementSelector : "#mainBodyArea > .body"
630 }]
631 }]
632 };
633}, function(canCreateDiscussions, BeautifulProperties, createElement) {
634 Object.defineProperty(BeautifulProperties, "__esModule", {
635 value : true
636 });
637 var a = createElement(6);
638 var o = createElement(15);
639 window.reallyreadit.extension.contentScript.contentParser.set({
640 parse : function() {
641 return a.default();
642 },
643 prune : function(tree) {
644 o.default(tree);
645 }
646 });
647}, function(canCreateDiscussions, t, require) {
648 /**
649 * @param {!HTMLElement} document
650 * @param {?} features
651 * @return {?}
652 */
653 function get(document, features) {
654 return features.map(function(queryScope) {
655 return document.querySelectorAll(queryScope);
656 }).reduce(function(proxies, line) {
657 return proxies.concat(Array.from(line));
658 }, []);
659 }
660 /**
661 * @param {string} e
662 * @param {!Function} n
663 * @return {?}
664 */
665 function fn(e, n) {
666 /** @type {number} */
667 var s = e.length - 1;
668 for (; s >= 0; s--) {
669 var t = e[s];
670 if (n(t, s)) {
671 return t;
672 }
673 }
674 return null;
675 }
676 /**
677 * @param {!Object} data
678 * @return {?}
679 */
680 function next(data) {
681 return Array.isArray(data) ? data.reduce(function(header, name) {
682 return header.concat(next(name));
683 }, []) : "string" == typeof data ? Array.from(document.querySelectorAll(data)) : data();
684 }
685 /**
686 * @param {!Object} e
687 * @param {?} cmd
688 * @return {?}
689 */
690 function resolve(e, cmd) {
691 var n = utils.findWordsInAttributes(e);
692 return !n.some(function(e) {
693 return (cmd.attributeFullWordBlacklist.includes(e) || cmd.attributeWordPartBlacklist.some(function(t) {
694 return e.includes(t);
695 })) && !n.some(function(newScaleKey) {
696 return cmd.attributeFullWordWhitelist.includes(newScaleKey);
697 });
698 });
699 }
700 /**
701 * @param {!Node} b
702 * @param {?} m
703 * @return {?}
704 */
705 function find(b, m) {
706 var currentPageLinks = b.getElementsByTagName("a");
707 if (!currentPageLinks.length) {
708 return true;
709 }
710 if (1 === currentPageLinks.length && currentPageLinks[0].textContent === b.textContent && b.textContent.toUpperCase() === b.textContent) {
711 return false;
712 }
713 var r = b.textContent.trim();
714 if (m.regexBlacklist.some(function(e) {
715 return e.test(r);
716 })) {
717 return false;
718 }
719 if (r.match(rpregex)) {
720 var o = r.toLowerCase();
721 return !m.singleSentenceOpenerBlacklist.some(function(e) {
722 return o.startsWith(e);
723 });
724 }
725 return true;
726 }
727 /**
728 * @param {!Object} node
729 * @param {?} callback
730 * @return {?}
731 */
732 function filter(node, callback) {
733 return !callback.nodeNameBlacklist.some(function(match) {
734 return node.nodeName === match;
735 }) && !callback.selectorBlacklist.some(function(a) {
736 return node.matches(a);
737 });
738 }
739 /**
740 * @param {!Object} b
741 * @param {number} c
742 * @param {number} type
743 * @param {!NodeList} test
744 * @return {?}
745 */
746 function f(b, c, type, test) {
747 /** @type {!Array<?>} */
748 var pStates = Array.from(b.childNodes);
749 if (type !== api.default.None && c < test.length - 1) {
750 var t;
751 var a;
752 var input = test[c + 1];
753 return type & api.default.Left && (t = pStates.findIndex(function(e) {
754 return input.includes(e);
755 })), type & api.default.Right && (a = pStates.length - 1 - pStates.reverse().findIndex(function(e) {
756 return input.includes(e);
757 }), pStates.reverse()), pStates.filter(function(canCreateDiscussions, b) {
758 return (null == t || b >= t) && (null == a || b <= a);
759 }).map(function(screens_block, boardManager, inRevIdx) {
760 var modifiers = api.default.None;
761 return type & api.default.Left && 0 === boardManager && (modifiers = modifiers | api.default.Left), type & api.default.Right && boardManager === inRevIdx.length - 1 && (modifiers = modifiers | api.default.Right), {
762 node : screens_block,
763 edge : modifiers
764 };
765 });
766 }
767 return pStates.map(function(screens_block) {
768 return {
769 node : screens_block,
770 edge : api.default.None
771 };
772 });
773 }
774 var _ = this && this.__values || function(value) {
775 var func = "function" == typeof Symbol && value[Symbol.iterator];
776 /** @type {number} */
777 var pos = 0;
778 return func ? func.call(value) : {
779 next : function() {
780 return value && pos >= value.length && (value = void 0), {
781 value : value && value[pos++],
782 done : !value
783 };
784 }
785 };
786 };
787 var collectRefsFromPathitem = this && this.__read || function(target, optionsValue) {
788 var value = "function" == typeof Symbol && target[Symbol.iterator];
789 if (!value) {
790 return target;
791 }
792 var result;
793 var mockConsole;
794 var cell = value.call(target);
795 /** @type {!Array} */
796 var linksArr = [];
797 try {
798 for (; (void 0 === optionsValue || optionsValue-- > 0) && !(result = cell.next()).done;) {
799 linksArr.push(result.value);
800 }
801 } catch (Console_error) {
802 mockConsole = {
803 error : Console_error
804 };
805 } finally {
806 try {
807 if (result && !result.done && (value = cell.return)) {
808 value.call(cell);
809 }
810 } finally {
811 if (mockConsole) {
812 throw mockConsole.error;
813 }
814 }
815 }
816 return linksArr;
817 };
818 var merge = this && this.__spread || function() {
819 /** @type {!Array} */
820 var followedKeys = [];
821 /** @type {number} */
822 var i = 0;
823 for (; i < arguments.length; i++) {
824 /** @type {!Array<?>} */
825 followedKeys = followedKeys.concat(collectRefsFromPathitem(arguments[i]));
826 }
827 return followedKeys;
828 };
829 Object.defineProperty(t, "__esModule", {
830 value : true
831 });
832 var types = require(7);
833 var exports = require(8);
834 var Tone = require(9);
835 var Handlebars = require(1);
836 var api = require(10);
837 var App = require(11);
838 var utils = require(0);
839 var Strings = require(3);
840 var JS = require(12);
841 var settings = require(4);
842 var webServer = require(14);
843 /** @type {!RegExp} */
844 var _digitExpr = /\S+/g;
845 /** @type {!RegExp} */
846 var rpregex = /^[^.!?]+[.!?'"]*$/;
847 var build = function() {
848 /**
849 * @param {!Node} t
850 * @param {string} e
851 * @param {string} win
852 * @param {!Array} options
853 * @return {undefined}
854 */
855 function run(t, e, win, options) {
856 var b = function(e, pDependency) {
857 return fn(e, function(parent, i) {
858 return utils.isElement(parent) && pDependency.nodeNameWhitelist.includes(parent.nodeName) && !e.slice(0, i).some(function(h) {
859 return pDependency.ancestorNodeNameBlacklist.includes(h.nodeName);
860 });
861 });
862 }(e, win.textContainerSelection);
863 if (b && !win.textContainerSearch.descendantNodeNameBlacklist.some(function(o) {
864 return !!b.getElementsByTagName(o).length;
865 })) {
866 var element = void 0;
867 var pattern = win ? win.transpositions.find(function(classObject) {
868 return classObject.elements.some(function(a) {
869 return a === b;
870 });
871 }) : null;
872 element = pattern ? pattern.lineage.concat(b) : e.slice(0, e.indexOf(b) + 1);
873 var c = new App.default(element, [e.concat(t)], function(result) {
874 return (result.textContent.match(_digitExpr) || []).length;
875 }(t));
876 var brightColors = options.find(function(a) {
877 return a.containerElement === b;
878 });
879 if (brightColors) {
880 brightColors.mergeContent(c);
881 } else {
882 options.push(c);
883 }
884 }
885 }
886 return function(node, n, value, options) {
887 var mockConsole;
888 var msg;
889 if (void 0 === options && (options = []), utils.isElement(node) && (!n.length || filter(node, value.textContainerSearch))) {
890 var data = n.concat(node);
891 try {
892 var data = _(node.childNodes);
893 var coordinate = data.next();
894 for (; !coordinate.done; coordinate = data.next()) {
895 var el = coordinate.value;
896 if (el.nodeType === Node.TEXT_NODE) {
897 run(el, data, value, options);
898 } else {
899 build(el, data, value, options);
900 }
901 }
902 } catch (Console_error) {
903 mockConsole = {
904 error : Console_error
905 };
906 } finally {
907 try {
908 if (coordinate && !coordinate.done && (msg = data.return)) {
909 msg.call(data);
910 }
911 } finally {
912 if (mockConsole) {
913 throw mockConsole.error;
914 }
915 }
916 }
917 }
918 return options;
919 };
920 }();
921 var callback = function() {
922 /**
923 * @param {!Arguments} name
924 * @return {?}
925 */
926 function f(name) {
927 var mockConsole;
928 var msg;
929 try {
930 var data = _(name);
931 var entry = data.next();
932 for (; !entry.done; entry = data.next()) {
933 var label = entry.value;
934 if (label instanceof HTMLElement) {
935 var parsedPreludeMacros = label.innerText.trim();
936 if (parsedPreludeMacros) {
937 return parsedPreludeMacros;
938 }
939 }
940 }
941 } catch (Console_error) {
942 mockConsole = {
943 error : Console_error
944 };
945 } finally {
946 try {
947 if (entry && !entry.done && (msg = data.return)) {
948 msg.call(data);
949 }
950 } finally {
951 if (mockConsole) {
952 throw mockConsole.error;
953 }
954 }
955 }
956 return null;
957 }
958 /**
959 * @param {!Object} obj
960 * @param {?} name
961 * @param {!Array} options
962 * @return {?}
963 */
964 function filter(obj, name, options) {
965 var mockConsole;
966 var a;
967 if (void 0 === options && (options = []), Strings.isValidContent(obj, name)) {
968 options.push(obj);
969 try {
970 var s = _(obj.children);
971 var item = s.next();
972 for (; !item.done; item = s.next()) {
973 filter(item.value, name, options);
974 }
975 } catch (Console_error) {
976 mockConsole = {
977 error : Console_error
978 };
979 } finally {
980 try {
981 if (item && !item.done && (a = s.return)) {
982 a.call(s);
983 }
984 } finally {
985 if (mockConsole) {
986 throw mockConsole.error;
987 }
988 }
989 }
990 }
991 return options;
992 }
993 return function(a, tpl, height, context, error, options) {
994 if (void 0 === options && (options = []), utils.isElement(a) && filter(a, error.imageContainerSearch)) {
995 var s = tpl.concat(a);
996 f(a, tpl.length, height, context).forEach(function(result) {
997 if (utils.isImageContainerElement(result.node)) {
998 (function(node, item, error, reverts) {
999 var mockConsole;
1000 var a;
1001 if (filter(node, error.imageContainerSearch) && !error.imageContainerSearch.descendantNodeNameBlacklist.some(function(n) {
1002 return !!node.getElementsByTagName(n).length;
1003 })) {
1004 /** @type {!Array<?>} */
1005 var successRates = Array.from("IMG" === node.nodeName ? [node] : node.getElementsByTagName("img"));
1006 /** @type {!Array<?>} */
1007 var expRecords = successRates.filter(function(e) {
1008 return utils.isValidImgElement(e);
1009 });
1010 if (!successRates.length || expRecords.length) {
1011 var val = void 0;
1012 var group = void 0;
1013 switch(node.nodeName) {
1014 case "PICTURE":
1015 /** @type {!Object} */
1016 val = node;
1017 /** @type {!Array<?>} */
1018 group = Array.from(node.children).filter(function(innerDOMObject) {
1019 return "SOURCE" === innerDOMObject.nodeName || "META" === innerDOMObject.nodeName || "IMG" === innerDOMObject.nodeName;
1020 });
1021 break;
1022 case "FIGURE":
1023 /** @type {!Object} */
1024 val = node;
1025 /** @type {!Array} */
1026 group = [];
1027 try {
1028 var s = _(node.children);
1029 var item = s.next();
1030 for (; !item.done; item = s.next()) {
1031 filter(item.value, error.imageContainerContent, group);
1032 }
1033 } catch (Console_error) {
1034 mockConsole = {
1035 error : Console_error
1036 };
1037 } finally {
1038 try {
1039 if (item && !item.done && (a = s.return)) {
1040 a.call(s);
1041 }
1042 } finally {
1043 if (mockConsole) {
1044 throw mockConsole.error;
1045 }
1046 }
1047 }
1048 break;
1049 case "IMG":
1050 /** @type {!Object} */
1051 val = node;
1052 /** @type {!Array} */
1053 group = [node];
1054 }
1055 var id = fn(item, function(canCreateDiscussions, i) {
1056 if (0 === i) {
1057 return false;
1058 }
1059 var element = item[i - 1];
1060 return (element.previousElementSibling || element.nextElementSibling) && !utils.findWordsInAttributes(element).some(function(e) {
1061 return error.imageContainerMetadata.imageWrapperAttributeWordParts.some(function(t) {
1062 return e.includes(t);
1063 });
1064 });
1065 }) || node;
1066 reverts.push(new Handlebars.default(val ? item.concat(val) : [], group.map(function(descendant) {
1067 return item.concat(utils.buildLineage({
1068 descendant : descendant,
1069 ancestor : node
1070 }));
1071 }), f(get(id, error.imageContainerMetadata.captionSelectors)), f(get(id, error.imageContainerMetadata.creditSelectors))));
1072 }
1073 }
1074 })(result.node, s, error, options);
1075 } else {
1076 callback(result.node, s, result.edge, context, error, options);
1077 }
1078 });
1079 }
1080 return options;
1081 };
1082 }();
1083 /**
1084 * @return {?}
1085 */
1086 t.default = function() {
1087 var block;
1088 var args = webServer.findPublisherConfig(settings.default.publishers, window.location.hostname);
1089 if (args && args.contentSearchRootElementSelector) {
1090 /** @type {(Element|null)} */
1091 block = document.querySelector(args.contentSearchRootElementSelector);
1092 }
1093 if (!block) {
1094 /** @type {!HTMLBodyElement} */
1095 block = document.body;
1096 }
1097 var opts = new JS.default(settings.default.universal, args, block);
1098 var row = next(opts.textContainerFilter.blacklistSelectors);
1099 var o = build(block, [], opts).filter(function(data) {
1100 return data.wordCount > 0 && !row.some(function(withPlayer) {
1101 return withPlayer === data.containerElement;
1102 }) && find(data.containerElement, opts.textContainerFilter);
1103 });
1104 var self = o.filter(function(options) {
1105 return resolve(options.containerElement, opts.textContainerFilter);
1106 });
1107 if (self.length / o.length > .5) {
1108 o = self;
1109 }
1110 var keys = function(cond) {
1111 return cond.reduce(function(devices, name) {
1112 var l = name.containerLineage.length;
1113 var chain = devices.find(function(b) {
1114 return b.depth === l;
1115 });
1116 return chain ? chain.add(name) : devices.push(new types.default(l, name)), devices;
1117 }, []);
1118 }(o);
1119 var b = keys.sort(function(a, b) {
1120 return b.wordCount - a.wordCount;
1121 })[0];
1122 var $words = function(self) {
1123 return self.members.map(function(obj, n, swimlanes) {
1124 var results = swimlanes.filter(function(tmp) {
1125 return tmp !== obj;
1126 });
1127 /** @type {!Array} */
1128 var args = [new Tone.default({
1129 hops : 0,
1130 frequency : 1,
1131 wordCount : obj.wordCount
1132 })];
1133 /**
1134 * @param {number} value
1135 * @return {undefined}
1136 */
1137 var link = function(value) {
1138 /** @type {number} */
1139 var i = self.depth - value;
1140 var trips = results.filter(function(contractFunction) {
1141 return contractFunction.containerLineage[i] === obj.containerLineage[i];
1142 });
1143 if (trips.length) {
1144 args.push(new Tone.default({
1145 hops : 2 * value,
1146 frequency : trips.length,
1147 wordCount : trips.reduce(function(ctrlpath, config) {
1148 return ctrlpath + config.wordCount;
1149 }, 0)
1150 }));
1151 trips.forEach(function(file) {
1152 results.splice(results.indexOf(file), 1);
1153 });
1154 }
1155 };
1156 /** @type {number} */
1157 var i = 1;
1158 for (; i <= self.depth && results.length; i++) {
1159 link(i);
1160 }
1161 return new exports.default(obj, args);
1162 });
1163 }(b);
1164 var line = $words.reduce(function(self, post) {
1165 var that = self.find(function(canCreateDiscussions) {
1166 return canCreateDiscussions.preferredPathHopCount === post.getPreferredPath().hops;
1167 });
1168 return that ? (that.searchResults.push(post), that.wordCount += post.textContainer.wordCount) : self.push({
1169 preferredPathHopCount : post.getPreferredPath().hops,
1170 searchResults : [post],
1171 wordCount : post.textContainer.wordCount
1172 }), self;
1173 }, []).sort(function(a, b) {
1174 return b.wordCount - a.wordCount;
1175 }).reduce(function(e, t) {
1176 return e.reduce(function(ctrlpath, config) {
1177 return ctrlpath + config.wordCount;
1178 }, 0) < b.wordCount * opts.wordCountTraversalPathSearchLimitMultiplier && e.push(t), e;
1179 }, []).reduce(function(res, state) {
1180 return res.concat(state.searchResults);
1181 }, []);
1182 var identifierPositions = line[0].textContainer.containerLineage[line[0].textContainer.containerLineage.length - Math.max(Math.max.apply(Math, merge(line.map(function(canCreateDiscussions) {
1183 return canCreateDiscussions.getPreferredPath().hops;
1184 }))) / 2, 1)];
1185 var teamMembers = utils.zipContentLineages(line.map(function(canCreateDiscussions) {
1186 return canCreateDiscussions.textContainer;
1187 })).slice(utils.buildLineage({
1188 ancestor : block,
1189 descendant : identifierPositions
1190 }).length - 1);
1191 var found = next(opts.imageContainerFilter.blacklistSelectors);
1192 var navLinksArr = callback(identifierPositions, [], api.default.Left | api.default.Right, teamMembers, opts).filter(function(container) {
1193 return !found.some(function(context) {
1194 return context === container.containerElement;
1195 }) && resolve(container.containerElement, opts.imageContainerFilter) && function(value, acctsSlice) {
1196 /** @type {string} */
1197 var n = (value.caption || "") + " " + (value.credit || "");
1198 return !(acctsSlice.contentRegexBlacklist.some(function(e) {
1199 return e.test(n);
1200 }) && !acctsSlice.contentRegexWhitelist.some(function(e) {
1201 return e.test(n);
1202 }));
1203 }(container, opts.imageContainerMetadata);
1204 });
1205 var imageDataArr = function format(a, d, type, name, count, items, data, index) {
1206 return void 0 === index && (index = []), utils.isElement(a) && !data.additionalContentNodeNameBlacklist.includes(a.nodeName) && filter(a, data) && !items.includes(a) && f(a, d.length, type, name).forEach(function(options) {
1207 var apiPath;
1208 if (utils.isElement(options.node) && (apiPath = count.find(function(p) {
1209 return p.containerElement === options.node;
1210 }))) {
1211 if (!items.some(function(val) {
1212 return val === options.node || options.node.contains(val);
1213 })) {
1214 index.push(apiPath);
1215 }
1216 } else {
1217 format(options.node, merge([a], d), options.edge, name, count, items, data, index);
1218 }
1219 }), index;
1220 }(identifierPositions, [], api.default.Left | api.default.Right, teamMembers, keys.filter(function(a) {
1221 return a.depth !== b.depth && a.depth >= b.depth - opts.textContainerSearch.additionalContentMaxDepthDecrease && a.depth <= b.depth + opts.textContainerSearch.additionalContentMaxDepthIncrease;
1222 }).reduce(function(value, rel) {
1223 return value.concat(rel.members);
1224 }, []).concat($words.filter(function(e) {
1225 return !line.includes(e);
1226 }).map(function(canCreateDiscussions) {
1227 return canCreateDiscussions.textContainer;
1228 })), navLinksArr.map(function(options) {
1229 return options.containerElement;
1230 }), opts.textContainerSearch).filter(function(container) {
1231 return find(container.containerElement, opts.textContainerFilter);
1232 });
1233 return {
1234 contentSearchRootElement : block,
1235 depthGroupWithMostWords : b,
1236 primaryTextContainerSearchResults : line,
1237 additionalPrimaryTextContainers : imageDataArr,
1238 primaryTextRootNode : identifierPositions,
1239 primaryTextContainers : line.map(function(canCreateDiscussions) {
1240 return canCreateDiscussions.textContainer;
1241 }).concat(imageDataArr),
1242 imageContainers : navLinksArr
1243 };
1244 };
1245}, function(canCreateDiscussions, t, n) {
1246 Object.defineProperty(t, "__esModule", {
1247 value : true
1248 });
1249 var offsetFromCenter = function() {
1250 /**
1251 * @param {number} value
1252 * @return {undefined}
1253 */
1254 function Group(value) {
1255 /** @type {!Array} */
1256 var effects = [];
1257 /** @type {number} */
1258 var i = 1;
1259 for (; i < arguments.length; i++) {
1260 effects[i - 1] = arguments[i];
1261 }
1262 /** @type {number} */
1263 this._wordCount = 0;
1264 /** @type {number} */
1265 this._depth = value;
1266 /** @type {!Array} */
1267 this._members = effects;
1268 this._wordCount = effects.reduce(function(ctrlpath, config) {
1269 return ctrlpath + config.wordCount;
1270 }, 0);
1271 }
1272 return Group.prototype.add = function(that) {
1273 var emitZoom = this._members.find(function(config) {
1274 return config.containerElement === that.containerElement;
1275 });
1276 if (emitZoom) {
1277 emitZoom.mergeContent(that);
1278 } else {
1279 this._members.push(that);
1280 }
1281 this._wordCount += that.wordCount;
1282 }, Object.defineProperty(Group.prototype, "depth", {
1283 get : function() {
1284 return this._depth;
1285 },
1286 enumerable : true,
1287 configurable : true
1288 }), Object.defineProperty(Group.prototype, "members", {
1289 get : function() {
1290 return this._members;
1291 },
1292 enumerable : true,
1293 configurable : true
1294 }), Object.defineProperty(Group.prototype, "wordCount", {
1295 get : function() {
1296 return this._wordCount;
1297 },
1298 enumerable : true,
1299 configurable : true
1300 }), Group;
1301 }();
1302 t.default = offsetFromCenter;
1303}, function(canCreateDiscussions, t, n) {
1304 Object.defineProperty(t, "__esModule", {
1305 value : true
1306 });
1307 var offsetFromCenter = function() {
1308 /**
1309 * @param {?} logger
1310 * @param {!Object} $http
1311 * @return {undefined}
1312 */
1313 function Generator(logger, $http) {
1314 this._textContainer = logger;
1315 /** @type {!Object} */
1316 this._paths = $http;
1317 }
1318 return Generator.prototype.getPreferredPath = function() {
1319 return this._preferredPath || (this._preferredPath = this._paths.sort(function(a, b) {
1320 return a.wordCount !== b.wordCount ? b.wordCount - a.wordCount : a.hops - b.hops;
1321 })[0]), this._preferredPath;
1322 }, Object.defineProperty(Generator.prototype, "textContainer", {
1323 get : function() {
1324 return this._textContainer;
1325 },
1326 enumerable : true,
1327 configurable : true
1328 }), Generator;
1329 }();
1330 t.default = offsetFromCenter;
1331}, function(canCreateDiscussions, t, n) {
1332 Object.defineProperty(t, "__esModule", {
1333 value : true
1334 });
1335 var offsetFromCenter = function() {
1336 /**
1337 * @param {!Object} data
1338 * @return {undefined}
1339 */
1340 function Vector(data) {
1341 var hops = data.hops;
1342 var param = data.frequency;
1343 var open = data.wordCount;
1344 this._hops = hops;
1345 this._frequency = param;
1346 this._wordCount = open;
1347 }
1348 return Vector.prototype.add = function(data) {
1349 var param = data.frequency;
1350 var open = data.wordCount;
1351 return new Vector({
1352 hops : this._hops,
1353 frequency : this._frequency + param,
1354 wordCount : this._wordCount + open
1355 });
1356 }, Object.defineProperty(Vector.prototype, "frequency", {
1357 get : function() {
1358 return this._frequency;
1359 },
1360 enumerable : true,
1361 configurable : true
1362 }), Object.defineProperty(Vector.prototype, "hops", {
1363 get : function() {
1364 return this._hops;
1365 },
1366 enumerable : true,
1367 configurable : true
1368 }), Object.defineProperty(Vector.prototype, "wordCount", {
1369 get : function() {
1370 return this._wordCount;
1371 },
1372 enumerable : true,
1373 configurable : true
1374 }), Vector;
1375 }();
1376 t.default = offsetFromCenter;
1377}, function(canCreateDiscussions, res, n) {
1378 var r;
1379 Object.defineProperty(res, "__esModule", {
1380 value : true
1381 });
1382 (function(Direction) {
1383 /** @type {string} */
1384 Direction[Direction.None = 0] = "None";
1385 /** @type {string} */
1386 Direction[Direction.Left = 1] = "Left";
1387 /** @type {string} */
1388 Direction[Direction.Right = 2] = "Right";
1389 })(r || (r = {}));
1390 /** @type {(undefined|{Left: number, None: number, Right: number})} */
1391 res.default = r;
1392}, function(canCreateDiscussions, t, require) {
1393 var r = this && this.__extends || function() {
1394 /**
1395 * @param {!Function} pos
1396 * @param {!Object} script
1397 * @return {?}
1398 */
1399 var fn = function(pos, script) {
1400 return (fn = Object.setPrototypeOf || {
1401 __proto__ : []
1402 } instanceof Array && function(layer, test) {
1403 /** @type {!Object} */
1404 layer.__proto__ = test;
1405 } || function(dst, values) {
1406 var i;
1407 for (i in values) {
1408 if (values.hasOwnProperty(i)) {
1409 dst[i] = values[i];
1410 }
1411 }
1412 })(pos, script);
1413 };
1414 return function(c, value) {
1415 /**
1416 * @return {undefined}
1417 */
1418 function data() {
1419 /** @type {!Function} */
1420 this.constructor = c;
1421 }
1422 fn(c, value);
1423 c.prototype = null === value ? Object.create(value) : (data.prototype = value.prototype, new data);
1424 };
1425 }();
1426 var collectRefsFromPathitem = this && this.__read || function(target, optionsValue) {
1427 var value = "function" == typeof Symbol && target[Symbol.iterator];
1428 if (!value) {
1429 return target;
1430 }
1431 var result;
1432 var mockConsole;
1433 var cell = value.call(target);
1434 /** @type {!Array} */
1435 var linksArr = [];
1436 try {
1437 for (; (void 0 === optionsValue || optionsValue-- > 0) && !(result = cell.next()).done;) {
1438 linksArr.push(result.value);
1439 }
1440 } catch (Console_error) {
1441 mockConsole = {
1442 error : Console_error
1443 };
1444 } finally {
1445 try {
1446 if (result && !result.done && (value = cell.return)) {
1447 value.call(cell);
1448 }
1449 } finally {
1450 if (mockConsole) {
1451 throw mockConsole.error;
1452 }
1453 }
1454 }
1455 return linksArr;
1456 };
1457 var get = this && this.__spread || function() {
1458 /** @type {!Array} */
1459 var followedKeys = [];
1460 /** @type {number} */
1461 var i = 0;
1462 for (; i < arguments.length; i++) {
1463 /** @type {!Array<?>} */
1464 followedKeys = followedKeys.concat(collectRefsFromPathitem(arguments[i]));
1465 }
1466 return followedKeys;
1467 };
1468 Object.defineProperty(t, "__esModule", {
1469 value : true
1470 });
1471 var offsetFromCenter = function(d) {
1472 /**
1473 * @param {?} right
1474 * @param {?} parent
1475 * @param {number} type
1476 * @return {?}
1477 */
1478 function type(right, parent, type) {
1479 var array = d.call(this, right, parent) || this;
1480 return array._wordCount = type, array;
1481 }
1482 return r(type, d), type.prototype.mergeContent = function(child) {
1483 var _selectedKeys;
1484 (_selectedKeys = this._contentLineages).push.apply(_selectedKeys, get(child._contentLineages));
1485 this._wordCount += child.wordCount;
1486 }, Object.defineProperty(type.prototype, "wordCount", {
1487 get : function() {
1488 return this._wordCount;
1489 },
1490 enumerable : true,
1491 configurable : true
1492 }), type;
1493 }(require(2).default);
1494 t.default = offsetFromCenter;
1495}, function(canCreateDiscussions, t, floor) {
1496 var j = this && this.__assign || function() {
1497 return (j = Object.assign || function(data) {
1498 var v;
1499 /** @type {number} */
1500 var j = 1;
1501 /** @type {number} */
1502 var argsLength = arguments.length;
1503 for (; j < argsLength; j++) {
1504 var i;
1505 for (i in v = arguments[j]) {
1506 if (Object.prototype.hasOwnProperty.call(v, i)) {
1507 data[i] = v[i];
1508 }
1509 }
1510 }
1511 return data;
1512 }).apply(this, arguments);
1513 };
1514 Object.defineProperty(t, "__esModule", {
1515 value : true
1516 });
1517 var startYNew = floor(0);
1518 var offsetFromCenter = function() {
1519 /**
1520 * @param {?} item
1521 * @param {?} options
1522 * @param {!Object} block
1523 * @return {undefined}
1524 */
1525 function setup(item, options, block) {
1526 this._textContainerFilter = item.textContainerFilter;
1527 this._imageContainerMetadata = item.imageContainerMetadata;
1528 this._imageContainerContent = item.imageContainerContent;
1529 this._textContainerSelection = item.textContainerSelection;
1530 this._wordCountTraversalPathSearchLimitMultiplier = item.wordCountTraversalPathSearchLimitMultiplier;
1531 if (options) {
1532 if (options.textContainerSearch) {
1533 this._textContainerSearch = j({}, item.textContainerSearch, {
1534 selectorBlacklist : item.textContainerSearch.selectorBlacklist.concat(options.textContainerSearch.selectorBlacklist || [])
1535 });
1536 } else {
1537 this._textContainerSearch = item.textContainerSearch;
1538 }
1539 if (options.textContainerFilter) {
1540 this._textContainerFilter = j({}, item.textContainerFilter, {
1541 attributeFullWordBlacklist : item.textContainerFilter.attributeFullWordBlacklist.concat(options.textContainerFilter.attributeFullWordBlacklist || []),
1542 attributeFullWordWhitelist : options.textContainerFilter.attributeFullWordWhitelist || [],
1543 blacklistSelectors : item.textContainerFilter.blacklistSelectors.concat(options.textContainerFilter.blacklistSelectors || [])
1544 });
1545 } else {
1546 this._textContainerFilter = j({}, item.textContainerFilter, {
1547 attributeFullWordWhitelist : []
1548 });
1549 }
1550 if (options.imageContainerSearch) {
1551 this._imageContainerSearch = j({}, item.imageContainerSearch, {
1552 selectorBlacklist : item.imageContainerSearch.selectorBlacklist.concat(options.imageContainerSearch.selectorBlacklist || [])
1553 });
1554 } else {
1555 this._imageContainerSearch = item.imageContainerSearch;
1556 }
1557 if (options.imageContainerFilter) {
1558 this._imageContainerFilter = j({}, item.imageContainerFilter, {
1559 attributeFullWordBlacklist : item.imageContainerFilter.attributeFullWordBlacklist.concat(options.imageContainerFilter.attributeFullWordBlacklist || []),
1560 attributeFullWordWhitelist : options.imageContainerFilter.attributeFullWordWhitelist || [],
1561 blacklistSelectors : item.imageContainerFilter.blacklistSelectors.concat(options.imageContainerFilter.blacklistSelectors || [])
1562 });
1563 } else {
1564 this._imageContainerFilter = j({}, item.imageContainerFilter, {
1565 attributeFullWordWhitelist : []
1566 });
1567 }
1568 this._contentSearchRootElementSelector = options.contentSearchRootElementSelector;
1569 if (options.transpositions) {
1570 this._transpositions = options.transpositions.map(function(s) {
1571 /** @type {(Element|null)} */
1572 var descendant = document.querySelector(s.parentElementSelector);
1573 var injections = s.elementSelectors.reduce(function(requestValuesAggs, selector) {
1574 return requestValuesAggs.concat(Array.from(document.querySelectorAll(selector)));
1575 }, []);
1576 return descendant && injections.length ? {
1577 elements : injections,
1578 lineage : startYNew.buildLineage({
1579 ancestor : block,
1580 descendant : descendant
1581 })
1582 } : null;
1583 }).filter(function(canCreateDiscussions) {
1584 return !!canCreateDiscussions;
1585 });
1586 } else {
1587 /** @type {!Array} */
1588 this._transpositions = [];
1589 }
1590 this._imageStrategy = options.imageStrategy;
1591 } else {
1592 this._textContainerSearch = item.textContainerSearch;
1593 this._textContainerFilter = j({}, item.textContainerFilter, {
1594 attributeFullWordWhitelist : []
1595 });
1596 this._imageContainerSearch = item.imageContainerSearch;
1597 this._imageContainerFilter = j({}, item.imageContainerFilter, {
1598 attributeFullWordWhitelist : []
1599 });
1600 /** @type {!Array} */
1601 this._transpositions = [];
1602 }
1603 }
1604 return Object.defineProperty(setup.prototype, "textContainerSearch", {
1605 get : function() {
1606 return this._textContainerSearch;
1607 },
1608 enumerable : true,
1609 configurable : true
1610 }), Object.defineProperty(setup.prototype, "textContainerFilter", {
1611 get : function() {
1612 return this._textContainerFilter;
1613 },
1614 enumerable : true,
1615 configurable : true
1616 }), Object.defineProperty(setup.prototype, "imageContainerSearch", {
1617 get : function() {
1618 return this._imageContainerSearch;
1619 },
1620 enumerable : true,
1621 configurable : true
1622 }), Object.defineProperty(setup.prototype, "imageContainerFilter", {
1623 get : function() {
1624 return this._imageContainerFilter;
1625 },
1626 enumerable : true,
1627 configurable : true
1628 }), Object.defineProperty(setup.prototype, "imageContainerMetadata", {
1629 get : function() {
1630 return this._imageContainerMetadata;
1631 },
1632 enumerable : true,
1633 configurable : true
1634 }), Object.defineProperty(setup.prototype, "imageContainerContent", {
1635 get : function() {
1636 return this._imageContainerContent;
1637 },
1638 enumerable : true,
1639 configurable : true
1640 }), Object.defineProperty(setup.prototype, "textContainerSelection", {
1641 get : function() {
1642 return this._textContainerSelection;
1643 },
1644 enumerable : true,
1645 configurable : true
1646 }), Object.defineProperty(setup.prototype, "contentSearchRootElementSelector", {
1647 get : function() {
1648 return this._contentSearchRootElementSelector;
1649 },
1650 enumerable : true,
1651 configurable : true
1652 }), Object.defineProperty(setup.prototype, "transpositions", {
1653 get : function() {
1654 return this._transpositions;
1655 },
1656 enumerable : true,
1657 configurable : true
1658 }), Object.defineProperty(setup.prototype, "wordCountTraversalPathSearchLimitMultiplier", {
1659 get : function() {
1660 return this._wordCountTraversalPathSearchLimitMultiplier;
1661 },
1662 enumerable : true,
1663 configurable : true
1664 }), Object.defineProperty(setup.prototype, "imageStrategy", {
1665 get : function() {
1666 return this._imageStrategy;
1667 },
1668 enumerable : true,
1669 configurable : true
1670 }), setup;
1671 }();
1672 t.default = offsetFromCenter;
1673}, function(canCreateDiscussions, t, n) {
1674 /**
1675 * @param {?} max
1676 * @param {!Function} check
1677 * @return {undefined}
1678 */
1679 function start(max, check) {
1680 /** @type {!IntersectionObserver} */
1681 var intersectionObserver = new IntersectionObserver(function(wrappersTemplates, self) {
1682 wrappersTemplates.forEach(function(binding) {
1683 if (binding.isIntersecting) {
1684 self.unobserve(binding.target);
1685 check(binding.target);
1686 }
1687 });
1688 }, {
1689 rootMargin : "0px 0px 200px 0px"
1690 });
1691 Array.from(max).forEach(function(container) {
1692 intersectionObserver.observe(container);
1693 });
1694 }
1695 var namespace;
1696 var collectRefsFromPathitem = this && this.__read || function(target, optionsValue) {
1697 var value = "function" == typeof Symbol && target[Symbol.iterator];
1698 if (!value) {
1699 return target;
1700 }
1701 var result;
1702 var mockConsole;
1703 var cell = value.call(target);
1704 /** @type {!Array} */
1705 var linksArr = [];
1706 try {
1707 for (; (void 0 === optionsValue || optionsValue-- > 0) && !(result = cell.next()).done;) {
1708 linksArr.push(result.value);
1709 }
1710 } catch (Console_error) {
1711 mockConsole = {
1712 error : Console_error
1713 };
1714 } finally {
1715 try {
1716 if (result && !result.done && (value = cell.return)) {
1717 value.call(cell);
1718 }
1719 } finally {
1720 if (mockConsole) {
1721 throw mockConsole.error;
1722 }
1723 }
1724 }
1725 return linksArr;
1726 };
1727 var transform = this && this.__spread || function() {
1728 /** @type {!Array} */
1729 var followedKeys = [];
1730 /** @type {number} */
1731 var i = 0;
1732 for (; i < arguments.length; i++) {
1733 /** @type {!Array<?>} */
1734 followedKeys = followedKeys.concat(collectRefsFromPathitem(arguments[i]));
1735 }
1736 return followedKeys;
1737 };
1738 Object.defineProperty(t, "__esModule", {
1739 value : true
1740 });
1741 (function(canCreateDiscussions) {
1742 /** @type {string} */
1743 canCreateDiscussions[canCreateDiscussions.AtlanticFigureImgDataSrcset = 0] = "AtlanticFigureImgDataSrcset";
1744 /** @type {string} */
1745 canCreateDiscussions[canCreateDiscussions.FigureImgDataSrc = 1] = "FigureImgDataSrc";
1746 /** @type {string} */
1747 canCreateDiscussions[canCreateDiscussions.MediumScaleUp = 2] = "MediumScaleUp";
1748 /** @type {string} */
1749 canCreateDiscussions[canCreateDiscussions.NytFigureImageObject = 3] = "NytFigureImageObject";
1750 /** @type {string} */
1751 canCreateDiscussions[canCreateDiscussions.PostLoadImgTag = 4] = "PostLoadImgTag";
1752 })(namespace = t.LazyImageStrategy || (t.LazyImageStrategy = {}));
1753 /**
1754 * @param {?} second
1755 * @return {?}
1756 */
1757 t.default = function init(second) {
1758 switch(second) {
1759 case namespace.AtlanticFigureImgDataSrcset:
1760 start(document.querySelectorAll("figure"), function(e) {
1761 var element = e.getElementsByTagName("img")[0];
1762 if (!element.hasAttribute("srcset") && element.hasAttribute("data-srcset")) {
1763 element.srcset = element.getAttribute("data-srcset");
1764 }
1765 });
1766 break;
1767 case namespace.FigureImgDataSrc:
1768 start(document.querySelectorAll("figure"), function(rootDOMTravelScope) {
1769 Array.from(rootDOMTravelScope.querySelectorAll("[data-src], [data-srcset]")).forEach(function(element) {
1770 if (element.hasAttribute("data-src") && element.getAttribute("data-src") !== element.getAttribute("src")) {
1771 element.setAttribute("src", element.getAttribute("data-src"));
1772 }
1773 if (element.hasAttribute("data-srcset") && element.getAttribute("data-srcset") !== element.getAttribute("srcset")) {
1774 element.setAttribute("srcset", element.getAttribute("data-srcset"));
1775 }
1776 if (element.hasAttribute("src") && element.getAttribute("src").startsWith("data:")) {
1777 element.removeAttribute("src");
1778 }
1779 });
1780 });
1781 break;
1782 case namespace.MediumScaleUp:
1783 start(document.querySelectorAll("figure"), function(e) {
1784 var t = e.getElementsByTagName("img")[0];
1785 if (t.src) {
1786 var compressedRadii = t.src.match(/(https:\/\/[^\/]+)\/.*\/([^\/?]+)/);
1787 if (compressedRadii) {
1788 t.src = compressedRadii[1] + "/max/" + t.getAttribute("width") + "/" + compressedRadii[2];
1789 }
1790 }
1791 });
1792 break;
1793 case namespace.NytFigureImageObject:
1794 start(document.querySelectorAll('figure[itemType="http://schema.org/ImageObject"]'), function(s) {
1795 if (!s.getElementsByTagName("img").length) {
1796 /** @type {!Element} */
1797 var a = document.createElement("img");
1798 a.src = s.getAttribute("itemID");
1799 s.prepend(a);
1800 }
1801 });
1802 break;
1803 case namespace.PostLoadImgTag:
1804 start(document.getElementsByTagName("postload-img"), function(span) {
1805 /** @type {!Element} */
1806 var t = document.createElement("img");
1807 (function(e, tab) {
1808 /** @type {!Array} */
1809 var effects = [];
1810 /** @type {number} */
1811 var i = 2;
1812 for (; i < arguments.length; i++) {
1813 effects[i - 2] = arguments[i];
1814 }
1815 effects.forEach(function(n) {
1816 var i;
1817 var node;
1818 if ("string" == typeof n) {
1819 /** @type {!Object} */
1820 i = n;
1821 /** @type {!Object} */
1822 node = n;
1823 } else {
1824 i = n[0];
1825 node = n[1];
1826 }
1827 if (e.hasAttribute(i)) {
1828 tab.setAttribute(node, e.getAttribute(i));
1829 }
1830 });
1831 }).apply(void 0, transform([span, t], ["data-alt", "data-class", "data-sizes", "data-src", "data-srcset", "data-title"].map(function(lanName) {
1832 return [lanName, lanName.split("-")[1]];
1833 })));
1834 span.replaceWith(t);
1835 });
1836 break;
1837 default:
1838 if (document.querySelectorAll('figure img[src^="https://miro.medium.com"]').length) {
1839 return init(namespace.MediumScaleUp);
1840 }
1841 if (document.querySelectorAll("figure [data-src], figure [data-srcset]").length) {
1842 return init(namespace.FigureImgDataSrc);
1843 }
1844 }
1845 };
1846}, function(canCreateDiscussions, BeautifulProperties, n) {
1847 Object.defineProperty(BeautifulProperties, "__esModule", {
1848 value : true
1849 });
1850 /**
1851 * @param {!Object} case_
1852 * @param {string} message
1853 * @return {?}
1854 */
1855 BeautifulProperties.findPublisherConfig = function(case_, message) {
1856 return case_.find(function(err) {
1857 return message.endsWith(err.hostname);
1858 });
1859 };
1860}, function(canCreateDiscussions, t, require) {
1861 /**
1862 * @param {string} baseName
1863 * @return {?}
1864 */
1865 function normalize(baseName) {
1866 return baseName.split("\n").map(function(commentToCheck) {
1867 return commentToCheck.trim();
1868 }).filter(function(canCreateDiscussions) {
1869 return !!canCreateDiscussions;
1870 }).join("<br /><br />");
1871 }
1872 var r = this && this.__read || function(target, optionsValue) {
1873 var value = "function" == typeof Symbol && target[Symbol.iterator];
1874 if (!value) {
1875 return target;
1876 }
1877 var result;
1878 var mockConsole;
1879 var cell = value.call(target);
1880 /** @type {!Array} */
1881 var linksArr = [];
1882 try {
1883 for (; (void 0 === optionsValue || optionsValue-- > 0) && !(result = cell.next()).done;) {
1884 linksArr.push(result.value);
1885 }
1886 } catch (Console_error) {
1887 mockConsole = {
1888 error : Console_error
1889 };
1890 } finally {
1891 try {
1892 if (result && !result.done && (value = cell.return)) {
1893 value.call(cell);
1894 }
1895 } finally {
1896 if (mockConsole) {
1897 throw mockConsole.error;
1898 }
1899 }
1900 }
1901 return linksArr;
1902 };
1903 var getProps = this && this.__spread || function() {
1904 /** @type {!Array} */
1905 var bytes = [];
1906 /** @type {number} */
1907 var i = 0;
1908 for (; i < arguments.length; i++) {
1909 /** @type {!Array<?>} */
1910 bytes = bytes.concat(r(arguments[i]));
1911 }
1912 return bytes;
1913 };
1914 Object.defineProperty(t, "__esModule", {
1915 value : true
1916 });
1917 var utils = require(0);
1918 var _Sprite2 = require(1);
1919 var that = require(3);
1920 var settings = require(4);
1921 /** @type {!Array} */
1922 var mimeTypes = ["application/json", "application/ld+json", "text/x-readup-disabled-javascript"];
1923 /**
1924 * @param {?} target
1925 * @return {undefined}
1926 */
1927 t.default = function(target) {
1928 var args = target.imageContainers;
1929 if (target.primaryTextRootNode !== target.contentSearchRootElement) {
1930 var row = utils.buildLineage({
1931 descendant : target.primaryTextRootNode.parentElement,
1932 ancestor : target.contentSearchRootElement
1933 });
1934 args = args.map(function(options) {
1935 return new _Sprite2.default(row.concat(options.containerLineage), options.contentLineages.map(function(cellValue) {
1936 return row.concat(cellValue);
1937 }), options.caption, options.credit);
1938 });
1939 }
1940 var result = utils.zipContentLineages(target.primaryTextContainers.concat(args));
1941 if (target.contentSearchRootElement !== document.body) {
1942 result = utils.buildLineage({
1943 descendant : target.contentSearchRootElement.parentElement,
1944 ancestor : document.body
1945 }).map(function(canCreateDiscussions) {
1946 return [canCreateDiscussions];
1947 }).concat(result);
1948 }
1949 /** @type {!Array<?>} */
1950 var d = Array.from(document.querySelectorAll("body script")).filter(function(options) {
1951 return mimeTypes.includes(options.type);
1952 });
1953 if (d.length) {
1954 Array.from(d).forEach(function(srcBody) {
1955 utils.buildLineage({
1956 descendant : srcBody.hasChildNodes() ? srcBody.childNodes[0] : srcBody,
1957 ancestor : document.body
1958 }).forEach(function(name, i) {
1959 if (i < result.length) {
1960 if (!result[i].includes(name)) {
1961 result[i].push(name);
1962 }
1963 } else {
1964 result.push([name]);
1965 }
1966 });
1967 });
1968 }
1969 Array.from(document.documentElement.children).forEach(function(elem) {
1970 if ("HEAD" !== elem.nodeName && "BODY" !== elem.nodeName) {
1971 elem.remove();
1972 }
1973 });
1974 /** @type {(number|string)} */
1975 var opacity = document.body.style.opacity;
1976 /** @type {string} */
1977 var transition = document.body.style.transition;
1978 if (function render(obj, i, result, data, target, value) {
1979 if (!utils.isElement(obj) || !obj.id.startsWith("com_readup_")) {
1980 if (!(i > data.length - 1) && data[i].includes(obj) || result && utils.isElement(obj) && that.isValidContent(obj, value)) {
1981 var updateModel = !result && utils.isImageContainerElement(obj);
1982 if (updateModel) {
1983 var options = target.find(function(options) {
1984 return options.containerElement === obj;
1985 });
1986 if (options) {
1987 if (options.containerElement.classList.add("com_readup_article_image_container"), options.credit && (!options.caption || options.credit !== options.caption)) {
1988 /** @type {!Element} */
1989 var header = document.createElement("div");
1990 header.classList.add("com_readup_article_image_credit");
1991 header.textContent = options.credit;
1992 if (options.caption) {
1993 /** @type {string} */
1994 header.textContent = header.textContent.replace(options.caption, "");
1995 }
1996 header.innerHTML = normalize(header.textContent);
1997 obj.insertAdjacentElement("afterend", header);
1998 }
1999 if (options.caption) {
2000 /** @type {!Element} */
2001 var header = document.createElement("div");
2002 header.classList.add("com_readup_article_image_caption");
2003 header.textContent = options.caption;
2004 if (options.credit && options.caption !== options.credit) {
2005 /** @type {string} */
2006 header.textContent = header.textContent.replace(options.credit, "");
2007 }
2008 header.innerHTML = normalize(header.textContent);
2009 obj.insertAdjacentElement("afterend", header);
2010 }
2011 }
2012 }
2013 if (utils.isElement(obj)) {
2014 obj.removeAttribute("style");
2015 }
2016 Array.from(obj.childNodes).forEach(function(renderer) {
2017 render(renderer, i + 1, updateModel || result, data, target, value);
2018 });
2019 } else {
2020 obj.remove();
2021 }
2022 }
2023 }(document.body, 0, false, result, args, settings.default.universal.imageContainerContent), document.body.classList.contains("com_readup_activating_reader_mode") && (document.body.style.opacity = opacity, document.body.style.transition = transition), 1 === document.body.children.length) {
2024 /** @type {!Element} */
2025 var dummyEl = document.body.children[0];
2026 for (; 1 === dummyEl.children.length && !target.primaryTextContainers.some(function(options) {
2027 return options.containerElement === dummyEl;
2028 });) {
2029 /** @type {!Element} */
2030 dummyEl = dummyEl.children[0];
2031 }
2032 if (dummyEl !== document.body.children[0]) {
2033 document.body.replaceChild(dummyEl, document.body.children[0]);
2034 }
2035 }
2036 /** @type {!Element} */
2037 var p = document.createElement("div");
2038 /** @type {string} */
2039 p.id = "com_readup_article_content";
2040 p.append.apply(p, getProps(Array.from(document.body.children).filter(function(currentTab) {
2041 return !currentTab.id.startsWith("com_readup_");
2042 })));
2043 document.body.prepend(p);
2044 };
2045}]);