Flow Youtube Chat

Youtubeのチャットをニコニコ風に画面上へ流すスクリプトです(再アップ,絵文字バグ修正済み)

当前为 2021-03-09 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Flow Youtube Chat
  3. // @version 1.14.12
  4. // @description Youtubeのチャットをニコニコ風に画面上へ流すスクリプトです(再アップ,絵文字バグ修正済み)
  5. // @match https://www.youtube.com/*
  6. // @namespace FlowYoutubeChatScript
  7. // @run-at document-end
  8. // @grant GM.setValue
  9. // @grant GM.getValue
  10. // @grant GM.deleteValue
  11. // @grant GM.listValues
  12. // @noframes
  13. // @license AGPL-3.0-or-later
  14. // @require https://cdn.jsdelivr.net/npm/sweetalert2@10.10.1/dist/sweetalert2.all.min.js#sha384-OCBhaEdUu7BFgaeRVey2PDeHof2MSQRFe/e6S8Q3XrmSV7wrKpLmhPj8FOldGiaF
  15. // @require https://unpkg.com/loglevel@1.7.0/dist/loglevel.min.js#sha384-7gGuWfek8Ql6j/uNDFrS0BCe4x2ZihD4B68w9Eu580OVHJBV+bl3rZmEWC7q5/Gj
  16. // @require https://unpkg.com/rxjs@7.0.0-beta.10/dist/bundles/rxjs.umd.min.js#sha384-+BwV2u+ZJFwj586/3PlpsZdYS1U/+hT/zpjYSznHH4XzUJqgshDzZITJ+zGeWl//
  17. // @require https://unpkg.com/mithril@2.0.4/mithril.min.js#sha384-vo9crXih40MlEv6JWHqS7SsPiFp+76csaWQFOF2UU0/xI58Jm/ZvK/1UtpaicJT9
  18. // @require https://cdn.jsdelivr.net/npm/check-types@11.1.2/src/check-types.min.js#sha384-KGnImnhVjA5llfqKEbjBiY+1Mp6oa+NvW/TEY1XTPAKWNgrAwa3Qvn//MXL07wBM
  19. // ==/UserScript==
  20.  
  21. /* jshint esversion: 6 */
  22.  
  23. ;(() => {
  24. var __webpack_modules__ = {
  25. 228: module => {
  26. "use strict"
  27. const createAbortError = () => {
  28. const error = new Error("Delay aborted")
  29. return (error.name = "AbortError"), error
  30. },
  31. createDelay = ({
  32. clearTimeout: defaultClear,
  33. setTimeout: set,
  34. willResolve,
  35. }) => (ms, { value, signal } = {}) => {
  36. if (signal && signal.aborted)
  37. return Promise.reject(createAbortError())
  38. let timeoutId, settle, rejectFn
  39. const clear = defaultClear || clearTimeout,
  40. signalListener = () => {
  41. clear(timeoutId), rejectFn(createAbortError())
  42. },
  43. delayPromise = new Promise((resolve, reject) => {
  44. ;(settle = () => {
  45. signal && signal.removeEventListener("abort", signalListener),
  46. willResolve ? resolve(value) : reject(value)
  47. }),
  48. (rejectFn = reject),
  49. (timeoutId = (set || setTimeout)(settle, ms))
  50. })
  51. return (
  52. signal &&
  53. signal.addEventListener("abort", signalListener, { once: !0 }),
  54. (delayPromise.clear = () => {
  55. clear(timeoutId), (timeoutId = null), settle()
  56. }),
  57. delayPromise
  58. )
  59. },
  60. delay = createDelay({ willResolve: !0 })
  61. ;(delay.reject = createDelay({ willResolve: !1 })),
  62. (delay.range = (minimum, maximum, options) =>
  63. delay(
  64. ((minimum, maximum) =>
  65. Math.floor(Math.random() * (maximum - minimum + 1) + minimum))(
  66. minimum,
  67. maximum
  68. ),
  69. options
  70. )),
  71. (delay.createWithTimers = ({ clearTimeout, setTimeout }) => {
  72. const delay = createDelay({
  73. clearTimeout,
  74. setTimeout,
  75. willResolve: !0,
  76. })
  77. return (
  78. (delay.reject = createDelay({
  79. clearTimeout,
  80. setTimeout,
  81. willResolve: !1,
  82. })),
  83. delay
  84. )
  85. }),
  86. (module.exports = delay),
  87. (module.exports.default = delay)
  88. },
  89. 238: module => {
  90. function monadic(fn, cache, serializer, arg) {
  91. var value,
  92. cacheKey =
  93. null == (value = arg) ||
  94. "number" == typeof value ||
  95. "boolean" == typeof value
  96. ? arg
  97. : serializer(arg),
  98. computedValue = cache.get(cacheKey)
  99. return (
  100. void 0 === computedValue &&
  101. ((computedValue = fn.call(this, arg)),
  102. cache.set(cacheKey, computedValue)),
  103. computedValue
  104. )
  105. }
  106. function variadic(fn, cache, serializer) {
  107. var args = Array.prototype.slice.call(arguments, 3),
  108. cacheKey = serializer(args),
  109. computedValue = cache.get(cacheKey)
  110. return (
  111. void 0 === computedValue &&
  112. ((computedValue = fn.apply(this, args)),
  113. cache.set(cacheKey, computedValue)),
  114. computedValue
  115. )
  116. }
  117. function assemble(fn, context, strategy, cache, serialize) {
  118. return strategy.bind(context, fn, cache, serialize)
  119. }
  120. function strategyDefault(fn, options) {
  121. return assemble(
  122. fn,
  123. this,
  124. 1 === fn.length ? monadic : variadic,
  125. options.cache.create(),
  126. options.serializer
  127. )
  128. }
  129. function serializerDefault() {
  130. return JSON.stringify(arguments)
  131. }
  132. function ObjectWithoutPrototypeCache() {
  133. this.cache = Object.create(null)
  134. }
  135. ;(ObjectWithoutPrototypeCache.prototype.has = function (key) {
  136. return key in this.cache
  137. }),
  138. (ObjectWithoutPrototypeCache.prototype.get = function (key) {
  139. return this.cache[key]
  140. }),
  141. (ObjectWithoutPrototypeCache.prototype.set = function (key, value) {
  142. this.cache[key] = value
  143. })
  144. var cacheDefault = {
  145. create: function () {
  146. return new ObjectWithoutPrototypeCache()
  147. },
  148. }
  149. ;(module.exports = function (fn, options) {
  150. var cache = options && options.cache ? options.cache : cacheDefault,
  151. serializer =
  152. options && options.serializer
  153. ? options.serializer
  154. : serializerDefault
  155. return (options && options.strategy
  156. ? options.strategy
  157. : strategyDefault)(fn, { cache, serializer })
  158. }),
  159. (module.exports.strategies = {
  160. variadic: function (fn, options) {
  161. return assemble(
  162. fn,
  163. this,
  164. variadic,
  165. options.cache.create(),
  166. options.serializer
  167. )
  168. },
  169. monadic: function (fn, options) {
  170. return assemble(
  171. fn,
  172. this,
  173. monadic,
  174. options.cache.create(),
  175. options.serializer
  176. )
  177. },
  178. })
  179. },
  180. },
  181. __webpack_module_cache__ = {}
  182. function __webpack_require__(moduleId) {
  183. if (__webpack_module_cache__[moduleId])
  184. return __webpack_module_cache__[moduleId].exports
  185. var module = (__webpack_module_cache__[moduleId] = { exports: {} })
  186. return (
  187. __webpack_modules__[moduleId](
  188. module,
  189. module.exports,
  190. __webpack_require__
  191. ),
  192. module.exports
  193. )
  194. }
  195. ;(__webpack_require__.n = module => {
  196. var getter =
  197. module && module.__esModule ? () => module.default : () => module
  198. return __webpack_require__.d(getter, { a: getter }), getter
  199. }),
  200. (__webpack_require__.d = (exports, definition) => {
  201. for (var key in definition)
  202. __webpack_require__.o(definition, key) &&
  203. !__webpack_require__.o(exports, key) &&
  204. Object.defineProperty(exports, key, {
  205. enumerable: !0,
  206. get: definition[key],
  207. })
  208. }),
  209. (__webpack_require__.o = (obj, prop) =>
  210. Object.prototype.hasOwnProperty.call(obj, prop)),
  211. (() => {
  212. "use strict"
  213. const external_log_namespaceObject = log
  214. var external_log_default = __webpack_require__.n(
  215. external_log_namespaceObject
  216. )
  217. const lib = observer => value => {
  218. observer.next(value)
  219. }
  220. var delay = __webpack_require__(228),
  221. delay_default = __webpack_require__.n(delay)
  222. function function_identity(a) {
  223. return a
  224. }
  225. function constant(a) {
  226. return function () {
  227. return a
  228. }
  229. }
  230. function function_pipe(
  231. a,
  232. ab,
  233. bc,
  234. cd,
  235. de,
  236. ef,
  237. fg,
  238. gh,
  239. hi,
  240. ij,
  241. jk,
  242. kl,
  243. lm,
  244. mn,
  245. no,
  246. op,
  247. pq,
  248. qr,
  249. rs,
  250. st
  251. ) {
  252. switch (arguments.length) {
  253. case 1:
  254. return a
  255. case 2:
  256. return ab(a)
  257. case 3:
  258. return bc(ab(a))
  259. case 4:
  260. return cd(bc(ab(a)))
  261. case 5:
  262. return de(cd(bc(ab(a))))
  263. case 6:
  264. return ef(de(cd(bc(ab(a)))))
  265. case 7:
  266. return fg(ef(de(cd(bc(ab(a))))))
  267. case 8:
  268. return gh(fg(ef(de(cd(bc(ab(a)))))))
  269. case 9:
  270. return hi(gh(fg(ef(de(cd(bc(ab(a))))))))
  271. case 10:
  272. return ij(hi(gh(fg(ef(de(cd(bc(ab(a)))))))))
  273. case 11:
  274. return jk(ij(hi(gh(fg(ef(de(cd(bc(ab(a))))))))))
  275. case 12:
  276. return kl(jk(ij(hi(gh(fg(ef(de(cd(bc(ab(a)))))))))))
  277. case 13:
  278. return lm(kl(jk(ij(hi(gh(fg(ef(de(cd(bc(ab(a))))))))))))
  279. case 14:
  280. return mn(lm(kl(jk(ij(hi(gh(fg(ef(de(cd(bc(ab(a)))))))))))))
  281. case 15:
  282. return no(mn(lm(kl(jk(ij(hi(gh(fg(ef(de(cd(bc(ab(a))))))))))))))
  283. case 16:
  284. return op(no(mn(lm(kl(jk(ij(hi(gh(fg(ef(de(cd(bc(ab(a)))))))))))))))
  285. case 17:
  286. return pq(
  287. op(no(mn(lm(kl(jk(ij(hi(gh(fg(ef(de(cd(bc(ab(a)))))))))))))))
  288. )
  289. case 18:
  290. return qr(
  291. pq(op(no(mn(lm(kl(jk(ij(hi(gh(fg(ef(de(cd(bc(ab(a))))))))))))))))
  292. )
  293. case 19:
  294. return rs(
  295. qr(
  296. pq(
  297. op(no(mn(lm(kl(jk(ij(hi(gh(fg(ef(de(cd(bc(ab(a)))))))))))))))
  298. )
  299. )
  300. )
  301. case 20:
  302. return st(
  303. rs(
  304. qr(
  305. pq(
  306. op(
  307. no(mn(lm(kl(jk(ij(hi(gh(fg(ef(de(cd(bc(ab(a))))))))))))))
  308. )
  309. )
  310. )
  311. )
  312. )
  313. }
  314. }
  315. var eqStrict = {
  316. equals: function (a, b) {
  317. return a === b
  318. },
  319. }
  320. function flap(F) {
  321. return function (a) {
  322. return function (fab) {
  323. return F.map(fab, function (f) {
  324. return f(a)
  325. })
  326. }
  327. }
  328. }
  329. var _map = function (ma, f) {
  330. return function () {
  331. return f(ma())
  332. }
  333. },
  334. of = constant,
  335. Functor = { URI: "IO", map: _map },
  336. sequenceArray =
  337. (flap(Functor),
  338. (function (f) {
  339. return (function (f) {
  340. return function (as) {
  341. return function () {
  342. return as.map(function (a, i) {
  343. return f(i, a)()
  344. })
  345. }
  346. }
  347. })(function (_, a) {
  348. return f(a)
  349. })
  350. })(function_identity)),
  351. separated = function (left, right) {
  352. return { left, right }
  353. },
  354. es6_Separated_map = function (f) {
  355. return function (fa) {
  356. return separated(left(fa), f(right(fa)))
  357. }
  358. },
  359. left =
  360. (flap({
  361. URI: "Separated",
  362. map: function (fa, f) {
  363. return function_pipe(fa, es6_Separated_map(f))
  364. },
  365. }),
  366. function (s) {
  367. return s.left
  368. }),
  369. right = function (s) {
  370. return s.right
  371. },
  372. isSome = function (fa) {
  373. return "Some" === fa._tag
  374. },
  375. isNone = function (fa) {
  376. return "None" === fa._tag
  377. },
  378. none = { _tag: "None" },
  379. some = function (a) {
  380. return { _tag: "Some", value: a }
  381. },
  382. fromNullable = function (a) {
  383. return null == a ? none : some(a)
  384. }
  385. var matchW = function (onNone, onSome) {
  386. return function (ma) {
  387. return isNone(ma) ? onNone() : onSome(ma.value)
  388. }
  389. },
  390. match = matchW,
  391. getOrElse = function (onNone) {
  392. return function (ma) {
  393. return isNone(ma) ? onNone() : ma.value
  394. }
  395. },
  396. chainNullableK = function (f) {
  397. return function (ma) {
  398. return isNone(ma) ? none : fromNullable(f(ma.value))
  399. }
  400. },
  401. es6_Option_map = function (f) {
  402. return function (fa) {
  403. return isNone(fa) ? none : some(f(fa.value))
  404. }
  405. },
  406. alt = function (that) {
  407. return function (fa) {
  408. return isNone(fa) ? that() : fa
  409. }
  410. },
  411. filter = function (predicate) {
  412. return function (fa) {
  413. return isNone(fa) ? none : predicate(fa.value) ? fa : none
  414. }
  415. }
  416. function getEq(E) {
  417. return {
  418. equals: function (x, y) {
  419. return (
  420. x === y ||
  421. (isNone(x) ? isNone(y) : !isNone(y) && E.equals(x.value, y.value))
  422. )
  423. },
  424. }
  425. }
  426. var head = ReadonlyNonEmptyArray_head
  427. var NonEmptyArray_map = function (fa, f) {
  428. return function_pipe(fa, es6_NonEmptyArray_map(f))
  429. },
  430. es6_NonEmptyArray_map = function (f) {
  431. return mapWithIndex(function (_, a) {
  432. return f(a)
  433. })
  434. },
  435. mapWithIndex = function (f) {
  436. return function (as) {
  437. for (var out = [f(0, head(as))], i = 1; i < as.length; i++)
  438. out.push(f(i, as[i]))
  439. return out
  440. }
  441. },
  442. NonEmptyArray_Functor = { URI: "NonEmptyArray", map: NonEmptyArray_map }
  443. flap(NonEmptyArray_Functor)
  444. var a
  445. a = void 0
  446. var ReadonlyNonEmptyArray_empty = [],
  447. ReadonlyNonEmptyArray_append = function (end) {
  448. return function (init) {
  449. return ReadonlyNonEmptyArray_concat(init, [end])
  450. }
  451. }
  452. function ReadonlyNonEmptyArray_concat(first, second) {
  453. return first.concat(second)
  454. }
  455. var ReadonlyNonEmptyArray_map = function (fa, f) {
  456. return function_pipe(fa, es6_ReadonlyNonEmptyArray_map(f))
  457. },
  458. es6_ReadonlyNonEmptyArray_map = function (f) {
  459. return es6_ReadonlyNonEmptyArray_mapWithIndex(function (_, a) {
  460. return f(a)
  461. })
  462. },
  463. es6_ReadonlyNonEmptyArray_mapWithIndex = function (f) {
  464. return function (as) {
  465. for (
  466. var out = [f(0, ReadonlyNonEmptyArray_head(as))], i = 1;
  467. i < as.length;
  468. i++
  469. )
  470. out.push(f(i, as[i]))
  471. return out
  472. }
  473. },
  474. ReadonlyNonEmptyArray_extract = function (as) {
  475. return as[0]
  476. },
  477. ReadonlyNonEmptyArray_Functor = {
  478. URI: "ReadonlyNonEmptyArray",
  479. map: ReadonlyNonEmptyArray_map,
  480. },
  481. ReadonlyNonEmptyArray_head =
  482. (flap(ReadonlyNonEmptyArray_Functor), ReadonlyNonEmptyArray_extract)
  483. var ReadonlyArray_append = ReadonlyNonEmptyArray_append,
  484. isEmpty = function (as) {
  485. return 0 === as.length
  486. }
  487. var ReadonlyArray_map = function (fa, f) {
  488. return function_pipe(fa, es6_ReadonlyArray_map(f))
  489. },
  490. es6_ReadonlyArray_map = function (f) {
  491. return function (fa) {
  492. return fa.map(function (a) {
  493. return f(a)
  494. })
  495. }
  496. },
  497. ReadonlyArray_Functor = {
  498. URI: "ReadonlyArray",
  499. map: ReadonlyArray_map,
  500. },
  501. ReadonlyArray_empty =
  502. (flap(ReadonlyArray_Functor), ReadonlyNonEmptyArray_empty)
  503. const external_m_namespaceObject = m
  504. var external_m_default = __webpack_require__.n(external_m_namespaceObject)
  505. const external_rxjs_namespaceObject = rxjs,
  506. external_rxjs_operators_namespaceObject = rxjs.operators,
  507. package_namespaceObject_i8 = "1.14.12"
  508. class IndirectConfigItem {
  509. constructor(x) {
  510. ;(this.gmKey = x.gmKey),
  511. (this.defaultVal = x.defaultVal),
  512. (this.val = x.val),
  513. (this.toGm = x.toGm)
  514. }
  515. get() {
  516. return this.val
  517. }
  518. async set(val, setGm = !0) {
  519. ;(this.val = val), setGm && GM.setValue(this.gmKey, this.toGm(val))
  520. }
  521. }
  522. const makeConfigItem = async (gmKey, defaultVal, toItem, toGm) => {
  523. const val = await GM.getValue(gmKey)
  524. return new IndirectConfigItem({
  525. gmKey,
  526. val: void 0 !== val ? toItem(val) : defaultVal,
  527. defaultVal,
  528. toGm,
  529. })
  530. },
  531. simpleConfigItem = async (gmKey, defaultVal) => {
  532. var _a
  533. return new IndirectConfigItem({
  534. gmKey,
  535. val:
  536. null !== (_a = await GM.getValue(gmKey)) && void 0 !== _a
  537. ? _a
  538. : defaultVal,
  539. defaultVal,
  540. toGm: x => x,
  541. })
  542. },
  543. lineConfigArgs = [
  544. [],
  545. x => x.split(/\r\n|\n/).filter(s => "" !== s),
  546. x => x.join("\n"),
  547. ],
  548. external_Swal_namespaceObject = Swal
  549. var external_Swal_default = __webpack_require__.n(
  550. external_Swal_namespaceObject
  551. )
  552. const channel = new BroadcastChannel("fyc-0615654655528523"),
  553. setUserConfig = config => (key, value) => {
  554. channel.postMessage([key, value]), config[key].set(value)
  555. },
  556. createBanButton = (chat, id, userConfig, mainLog) => {
  557. var _a, _b
  558. if (chat.children.namedItem("card")) return
  559. const button = document.createElement("button")
  560. button.classList.add(
  561. "style-scope",
  562. "yt-icon-button",
  563. "fyc_button",
  564. "fyc_ngbutton"
  565. ),
  566. (button.style.padding = "0px"),
  567. (button.style.width = "20px"),
  568. (button.style.height = "20px"),
  569. (button.style.fill = "#fff"),
  570. button.setAttribute("aria-label", "NGに入れる(Ban this user)"),
  571. (button.innerHTML =
  572. '<div style="width: 100%; height: 75%;fill: var(--yt-spec-text-secondary);"><svg class="style-scope yt-icon" width="100%" height="100%" version="1.1" viewBox="0 0 512 512" x="0px" y="0px"><path d="m437.02 74.977c-99.984-99.969-262.06-99.969-362.05 0-99.969 99.984-99.969 262.06 0 362.05 99.969 99.969 262.08 99.969 362.05 0s99.969-262.08 0-362.05zm-299.81 62.234c54.391-54.391 137.02-63.453 201.02-27.531l-228.55 228.55c-35.922-64-26.86-146.62 27.531-201.02zm237.59 237.58c-54.391 54.391-137.03 63.469-201.03 27.547l228.56-228.56c35.921 64 26.843 146.64-27.532 201.02z" fill-rule="evenodd"></path></svg></div>'),
  573. (button.onclick = () => {
  574. mainLog(`Added to Banned Users: ${id}`),
  575. setUserConfig(userConfig)("bannedUsers", [
  576. ...userConfig.bannedUsers.get().slice(),
  577. id,
  578. ]),
  579. external_m_default().redraw(),
  580. (chat.style.display = "none"),
  581. external_Swal_default()
  582. .mixin({
  583. toast: !0,
  584. position: "bottom-left",
  585. timer: 2500,
  586. timerProgressBar: !0,
  587. showConfirmButton: !1,
  588. didOpen: toast => {
  589. toast.addEventListener(
  590. "mouseenter",
  591. external_Swal_default().stopTimer
  592. ),
  593. toast.addEventListener(
  594. "mouseleave",
  595. external_Swal_default().resumeTimer
  596. )
  597. },
  598. })
  599. .fire({ title: `Added Banned User: ${id}`, icon: "success" })
  600. }),
  601. null ===
  602. (_b =
  603. null === (_a = chat.querySelector("#content")) || void 0 === _a
  604. ? void 0
  605. : _a.querySelector("#message")) ||
  606. void 0 === _b ||
  607. _b.append(button)
  608. }
  609. var src = __webpack_require__(238),
  610. src_default = __webpack_require__.n(src)
  611. const getChatLane = (
  612. flowChat,
  613. progress,
  614. flowChats,
  615. mainState,
  616. userConfig
  617. ) => {
  618. const chatIndex = flowChats.indexOf(flowChat),
  619. playerWidth = mainState.playerRect.width,
  620. playerX = mainState.playerRect.x,
  621. chatRect = flowChat.element.getBoundingClientRect(),
  622. chatWidth = chatRect.width,
  623. chatHeight = chatRect.height,
  624. chatX = progress ? chatRect.x - playerX : playerWidth,
  625. movingChats =
  626. ((as = flowChats
  627. .slice(0, chatIndex >= 0 ? chatIndex : void 0)
  628. .filter(chat => !chat.animationEnded)
  629. .sort((a, b) => a.lane - b.lane)),
  630. isEmpty(as) ? ReadonlyArray_empty : as.slice())
  631. var as
  632. const tooCloseTo = src_default()(i => {
  633. const otherRect = movingChats[i].element.getBoundingClientRect(),
  634. otherWidth = otherRect.width,
  635. otherX = otherRect.x - playerX,
  636. gap =
  637. (chatHeight * otherWidth * chatWidth) ** 0.333 *
  638. userConfig.minSpacing.get()
  639. return (
  640. (playerWidth - otherX) / (playerWidth + otherWidth) - progress <
  641. (chatWidth + gap) / (playerWidth + chatWidth) ||
  642. otherX + otherWidth + gap > chatX
  643. )
  644. }),
  645. occupyInfo = [
  646. ...movingChats.map((x, i) => ({
  647. tooClose: () => tooCloseTo(i),
  648. lane: x.lane,
  649. })),
  650. { tooClose: () => !0, lane: userConfig.laneCount.get() },
  651. ],
  652. index = occupyInfo.findIndex(x => x.lane >= flowChat.lane),
  653. rightFreeLane = occupyInfo
  654. .slice(index)
  655. .findIndex(x => x.tooClose()),
  656. leftFreeLane = function_pipe(
  657. occupyInfo.slice(0, index),
  658. ((predicate = x => x.tooClose()),
  659. function (as) {
  660. for (var i = as.length - 1; i >= 0; i--)
  661. if (predicate(as[i])) return some(i)
  662. return none
  663. }),
  664. getOrElse(() => -1)
  665. )
  666. var predicate
  667. let formerLaneInterval = 0
  668. leftFreeLane < flowChat.lane &&
  669. flowChat.lane < rightFreeLane &&
  670. (formerLaneInterval = Math.min(
  671. Math.max(
  672. formerLaneInterval,
  673. Math.min(
  674. flowChat.lane - leftFreeLane,
  675. rightFreeLane - flowChat.lane
  676. )
  677. ),
  678. 1
  679. ))
  680. let maxInterval = 0,
  681. maxIntervalLane = 0,
  682. lastLane = -1
  683. for (let i = 0; i < occupyInfo.length; i += 1)
  684. if (occupyInfo[i].tooClose()) {
  685. const nextLane = occupyInfo[i].lane,
  686. interLane = Math.min(
  687. Math.max((lastLane + nextLane) / 2, 0),
  688. userConfig.laneCount.get() - 1
  689. ),
  690. newInterval = Math.min(
  691. interLane - lastLane,
  692. nextLane - interLane,
  693. 1
  694. )
  695. if (
  696. newInterval - maxInterval > 0.001 &&
  697. ((maxIntervalLane = Math.max(lastLane + newInterval, 0)),
  698. (maxInterval = newInterval),
  699. maxInterval > 0.999)
  700. )
  701. break
  702. lastLane = nextLane
  703. }
  704. return {
  705. lane:
  706. Math.abs(formerLaneInterval - maxInterval) < 0.001
  707. ? flowChat.lane
  708. : maxIntervalLane,
  709. interval: maxInterval,
  710. }
  711. },
  712. setChatPlayState = (flowChat, mainState, userConfig) => {
  713. !flowChat.animationEnded &&
  714. flowChat.animation &&
  715. (mainState.chatPlaying
  716. ? flowChat.animation.play()
  717. : flowChat.animation.pause(),
  718. (flowChat.animation.playbackRate = userConfig.flowSpeed.get() / 15))
  719. },
  720. setChatAnimation = (flowChat, flowChats, mainState, userConfig) => {
  721. var _a, _b, _c
  722. if (flowChat.animationEnded) return !1
  723. const time =
  724. null !==
  725. (_b =
  726. null === (_a = flowChat.animation) || void 0 === _a
  727. ? void 0
  728. : _a.currentTime) && void 0 !== _b
  729. ? _b
  730. : void 0,
  731. progress = void 0 !== time ? time / flowChat.animationDuration : 0,
  732. { lane, interval } = getChatLane(
  733. flowChat,
  734. progress,
  735. flowChats,
  736. mainState,
  737. userConfig
  738. )
  739. if (userConfig.noOverlap.get() && interval < 0.999)
  740. return (
  741. null === (_c = flowChat.animation) ||
  742. void 0 === _c ||
  743. _c.finish(),
  744. (flowChat.animation = void 0),
  745. !1
  746. )
  747. flowChat.lane = lane
  748. const laneY = ((lane, mainState, userConfig) => {
  749. const laneCount = userConfig.laneCount.get(),
  750. laneR = lane % (2 * laneCount - 1),
  751. playerHeight = mainState.playerRect.height
  752. return (
  753. Math.round(
  754. 100 *
  755. (laneR < laneCount
  756. ? (playerHeight * (laneR % laneCount)) / laneCount + 4
  757. : playerHeight *
  758. ((laneR % laneCount) / laneCount + 1 / (2 * laneCount)))
  759. ) / 100
  760. )
  761. })(flowChat.lane, mainState, userConfig)
  762. flowChat.animation && flowChat.animation.cancel(),
  763. (flowChat.animationDuration = 6400),
  764. (flowChat.animation = flowChat.element.animate(
  765. [
  766. {
  767. transform: `translate(${mainState.playerRect.width}px, ${laneY}px)`,
  768. },
  769. {
  770. transform: `translate(${-flowChat.element.getBoundingClientRect()
  771. .width}px, ${laneY}px)`,
  772. },
  773. ],
  774. { duration: 6400, easing: userConfig.timingFunction.get() }
  775. )),
  776. (flowChat.animation.onfinish = () => {
  777. flowChat.animationEnded = !0
  778. })
  779. const newTime = void 0 !== time ? 6400 * progress : 0
  780. return (
  781. (flowChat.animation.currentTime = newTime),
  782. setChatPlayState(flowChat, mainState, userConfig),
  783. !0
  784. )
  785. },
  786. setChatStyle = (flowChat, mainState, userConfig) => {
  787. const fontSize = ((mainState, userConfig) =>
  788. Math.round(
  789. Math.max(userConfig.fontSize.get() - 0.2, 0.01) *
  790. (mainState.playerRect.height / userConfig.laneCount.get()) *
  791. 100
  792. ) / 100)(mainState, userConfig),
  793. { style } = flowChat.element
  794. ;(style.visibility = userConfig.displayChats.get()
  795. ? "visible"
  796. : "hidden"),
  797. (style.color =
  798. "owner" === flowChat.authorType
  799. ? userConfig.ownerColor.get()
  800. : "moderator" === flowChat.authorType
  801. ? userConfig.moderatorColor.get()
  802. : "member" === flowChat.authorType
  803. ? userConfig.memberColor.get()
  804. : userConfig.color.get()),
  805. (style.fontSize = `${fontSize}px`),
  806. (style.fontWeight = userConfig.fontWeight.get().toString()),
  807. (style.fontFamily = userConfig.font.get()),
  808. (style.opacity = userConfig.chatOpacity.get().toString())
  809. const offset = userConfig.shadowFontWeight.get()
  810. ;(style.textShadow = `-${offset}px -${offset}px #0009, ${offset}px -${offset}px #0009, -${offset}px ${offset}px #0009, ${offset}px ${offset}px #0009`),
  811. (style.transform = `translate(${mainState.playerRect.width}px, -${
  812. 2 * fontSize
  813. }px)`)
  814. },
  815. assert_lib = check.assert,
  816. tapNonNull = x => (assert_lib(null != x), x),
  817. textStyle = { fontFamily: "inherit" },
  818. parseMessage = (lengthBefore, message, userConfig) => {
  819. var _a
  820. const eleWin =
  821. null !== (_a = message.ownerDocument.defaultView) && void 0 !== _a
  822. ? _a
  823. : window,
  824. maxChatLength = userConfig.maxChatLength.get(),
  825. vnodes = []
  826. let semantic = "",
  827. length = lengthBefore
  828. return (
  829. Array.from(message.childNodes).some(node => {
  830. var _a, _b
  831. if (
  832. !userConfig.textOnly.get() &&
  833. node instanceof eleWin.HTMLImageElement
  834. ) {
  835. const { src, alt } = node
  836. vnodes.push(
  837. external_m_default()("img", {
  838. style: { height: "1em", width: "1em" },
  839. src,
  840. alt,
  841. })
  842. ),
  843. (semantic += `<img alt="${alt}">`),
  844. (length += 1)
  845. } else if (node instanceof eleWin.HTMLAnchorElement) {
  846. const { href } = node,
  847. text =
  848. null !== (_a = node.textContent) && void 0 !== _a ? _a : "",
  849. beginning = text.slice(0, maxChatLength)
  850. vnodes.push(
  851. external_m_default()(
  852. "span",
  853. {
  854. style: {
  855. fontSize: "smaller",
  856. textDecoration: "underline",
  857. ...textStyle,
  858. },
  859. },
  860. beginning
  861. )
  862. ),
  863. (semantic += `<a href="${href}">${text}</a>`),
  864. (length += beginning.length)
  865. } else {
  866. const text =
  867. null !== (_b = node.textContent) && void 0 !== _b ? _b : "",
  868. beginning = text.slice(0, maxChatLength)
  869. vnodes.push(external_m_default().fragment({}, beginning)),
  870. (semantic += text),
  871. (length += beginning.length)
  872. }
  873. return length >= maxChatLength
  874. }),
  875. { vnodes, semantic, length }
  876. )
  877. },
  878. handleChatFieldMutation = (
  879. chatScrn,
  880. flowChats,
  881. mainState,
  882. userConfig,
  883. mainLog
  884. ) => mutations => {
  885. mutations.forEach(e => {
  886. Array.from(e.addedNodes)
  887. .filter(x => x.children.length > 0)
  888. .forEach(chat => {
  889. var _a
  890. const chatData = ((chat, userConfig) => {
  891. let semantic = "",
  892. length = 0
  893. const vnodes = []
  894. let authorID
  895. const authorType = chat.querySelector(".owner")
  896. ? "owner"
  897. : chat.querySelector(".moderator")
  898. ? "moderator"
  899. : chat.querySelector(".member")
  900. ? "member"
  901. : "normal"
  902. return (
  903. Array.from(chat.children).forEach(child => {
  904. var _a, _b, _c, _d
  905. const childID = child.id,
  906. message = child.querySelector("#message"),
  907. authorName = child.querySelector("#author-name")
  908. if ("content" === childID) {
  909. if (
  910. (chat.querySelector(".moderator") &&
  911. userConfig.displayModName.get() &&
  912. vnodes.push(
  913. external_m_default()(
  914. "span",
  915. {
  916. style: {
  917. fontSize: "smaller",
  918. ...textStyle,
  919. },
  920. },
  921. `${
  922. null !==
  923. (_a =
  924. null == authorName
  925. ? void 0
  926. : authorName.innerText) &&
  927. void 0 !== _a
  928. ? _a
  929. : ""
  930. }: `
  931. )
  932. ),
  933. message)
  934. ) {
  935. const result = parseMessage(
  936. length,
  937. message,
  938. userConfig
  939. )
  940. vnodes.push(...result.vnodes),
  941. (semantic += result.semantic),
  942. (length += result.length)
  943. }
  944. } else if ("author-photo" === childID) {
  945. const matches = (null !==
  946. (_c =
  947. null === (_b = child.lastElementChild) ||
  948. void 0 === _b
  949. ? void 0
  950. : _b.getAttribute("src")) && void 0 !== _c
  951. ? _c
  952. : ""
  953. ).match(/ytc\/(.*)=/)
  954. authorID =
  955. null == matches
  956. ? void 0
  957. : matches[matches.length - 1]
  958. } else if ("card" === childID) {
  959. const normalChat = child.matches(
  960. [
  961. ".style-scope",
  962. ".yt-live-chat-paid-message-renderer",
  963. ].join("")
  964. ),
  965. stickerChat = child.matches(
  966. [
  967. ".style-scope",
  968. ".yt-live-chat-paid-sticker-renderer",
  969. ].join("")
  970. )
  971. if (normalChat || stickerChat) {
  972. const paidAmount = tapNonNull(
  973. child.querySelector("#purchase-amount") ||
  974. child.querySelector("#purchase-amount-chip")
  975. )
  976. authorID = void 0
  977. const headerColor = normalChat
  978. ? window
  979. .getComputedStyle(
  980. tapNonNull(child.querySelector("#header"))
  981. )
  982. .getPropertyValue("background-color")
  983. : window
  984. .getComputedStyle(chat)
  985. .getPropertyValue(
  986. "--yt-live-chat-paid-sticker-chip-background-color"
  987. ),
  988. paidColor = normalChat
  989. ? window
  990. .getComputedStyle(
  991. tapNonNull(
  992. child.querySelector("#content")
  993. )
  994. )
  995. .getPropertyValue("background-color")
  996. : window
  997. .getComputedStyle(chat)
  998. .getPropertyValue(
  999. "--yt-live-chat-paid-sticker-background-color"
  1000. )
  1001. if (
  1002. (userConfig.displaySuperChatAuthor.get() &&
  1003. vnodes.push(
  1004. external_m_default()(
  1005. "span",
  1006. {
  1007. style: {
  1008. color: headerColor,
  1009. fontSize: "smaller",
  1010. ...textStyle,
  1011. },
  1012. },
  1013. `${
  1014. null !==
  1015. (_d =
  1016. null == authorName
  1017. ? void 0
  1018. : authorName.innerText) &&
  1019. void 0 !== _d
  1020. ? _d
  1021. : ""
  1022. }: `
  1023. )
  1024. ),
  1025. normalChat && message)
  1026. ) {
  1027. const result = parseMessage(
  1028. length,
  1029. message,
  1030. userConfig
  1031. )
  1032. vnodes.push(
  1033. external_m_default()(
  1034. "span",
  1035. {
  1036. style: { color: headerColor, ...textStyle },
  1037. },
  1038. result.vnodes
  1039. )
  1040. ),
  1041. (semantic += result.semantic),
  1042. (length += result.length)
  1043. }
  1044. ;(length += paidAmount.innerText.length),
  1045. vnodes.push(
  1046. external_m_default()(
  1047. "span",
  1048. {
  1049. style: {
  1050. color: paidColor,
  1051. fontSize: "smaller",
  1052. ...textStyle,
  1053. },
  1054. },
  1055. external_m_default()(
  1056. "strong",
  1057. { style: { ...textStyle } },
  1058. paidAmount.innerText
  1059. )
  1060. )
  1061. )
  1062. }
  1063. }
  1064. }),
  1065. { vnodes, semantic, authorType, authorID }
  1066. )
  1067. })(chat, userConfig),
  1068. semanticTextContent =
  1069. null !==
  1070. (_a = new DOMParser().parseFromString(
  1071. `<span>${chatData.semantic}<span>`,
  1072. "text/html"
  1073. ).body.textContent) && void 0 !== _a
  1074. ? _a
  1075. : ""
  1076. ;((content, userConfig, mainLog) =>
  1077. userConfig.bannedWords
  1078. .get()
  1079. .some(
  1080. word =>
  1081. !!content.includes(word) &&
  1082. (mainLog(`Banned Word: "${word}" in "${content}"`), !0)
  1083. ))(semanticTextContent, userConfig, mainLog) ||
  1084. ((content, userConfig, mainLog) =>
  1085. userConfig.bannedWordRegexs.get().some(word => {
  1086. const result = content.match(RegExp(word, "u"))
  1087. return (
  1088. !!result &&
  1089. (mainLog(
  1090. `Banned Word: "${result.toString()}" in "${content}"`
  1091. ),
  1092. !0)
  1093. )
  1094. }))(semanticTextContent, userConfig, mainLog) ||
  1095. (void 0 !== chatData.authorID &&
  1096. ((authorID, userConfig, mainLog) =>
  1097. userConfig.bannedUsers
  1098. .get()
  1099. .some(
  1100. user =>
  1101. !(
  1102. authorID !== user ||
  1103. (mainLog(`Banned User: "${authorID}"`), 0)
  1104. )
  1105. ))(chatData.authorID, userConfig, mainLog))
  1106. ? (chat.style.display = "none")
  1107. : (userConfig.createChats.get() &&
  1108. ((
  1109. chatData,
  1110. flowChats,
  1111. chatScrn,
  1112. mainState,
  1113. userConfig
  1114. ) => {
  1115. var _a
  1116. let element
  1117. const offScreenChatIndex = flowChats.findIndex(
  1118. chat =>
  1119. chat.animationEnded ||
  1120. flowChats.length >= userConfig.maxChatCount.get()
  1121. )
  1122. if (-1 !== offScreenChatIndex) {
  1123. element = flowChats[offScreenChatIndex].element
  1124. const [oldChat] = flowChats.splice(
  1125. offScreenChatIndex,
  1126. 1
  1127. )
  1128. null === (_a = oldChat.animation) ||
  1129. void 0 === _a ||
  1130. _a.cancel()
  1131. } else
  1132. external_log_default().debug("CreateFlowChat"),
  1133. (element = document.createElement("span")),
  1134. chatScrn.append(element)
  1135. element.classList.add("fyc_chat")
  1136. const flowChat = {
  1137. element,
  1138. lane: -1,
  1139. animation: void 0,
  1140. animationDuration: 0,
  1141. animationEnded: !1,
  1142. authorType: chatData.authorType,
  1143. }
  1144. external_m_default().render(element, chatData.vnodes),
  1145. setChatStyle(flowChat, mainState, userConfig),
  1146. setChatAnimation(
  1147. flowChat,
  1148. flowChats,
  1149. mainState,
  1150. userConfig
  1151. )
  1152. ? flowChats.push(flowChat)
  1153. : flowChat.element.remove()
  1154. })(chatData, flowChats, chatScrn, mainState, userConfig),
  1155. userConfig.createBanButton.get() &&
  1156. void 0 !== chatData.authorID &&
  1157. !chat.querySelector(".owner") &&
  1158. createBanButton(
  1159. chat,
  1160. chatData.authorID,
  1161. userConfig,
  1162. mainLog
  1163. ),
  1164. userConfig.simplifyChatField.get() &&
  1165. (chat => {
  1166. if (
  1167. chat.querySelector(
  1168. ".style-scope.yt-live-chat-paid-message-renderer"
  1169. ) ||
  1170. chat.querySelector(".owner")
  1171. )
  1172. return
  1173. chat.style.borderBottom =
  1174. "1px solid var(--yt-spec-text-secondary)"
  1175. const authorPhoto = chat.querySelector("#author-photo")
  1176. authorPhoto && (authorPhoto.style.display = "none")
  1177. const authorChip = chat.querySelector(
  1178. "yt-live-chat-author-chip.style-scope.yt-live-chat-text-message-renderer"
  1179. )
  1180. authorChip && (authorChip.style.display = "none")
  1181. })(chat))
  1182. })
  1183. })
  1184. },
  1185. chatApp = () =>
  1186. function_pipe(
  1187. fromNullable(document.querySelector("#chatframe")),
  1188. filter(x => {
  1189. var _a
  1190. const state =
  1191. null === (_a = x.contentDocument) || void 0 === _a
  1192. ? void 0
  1193. : _a.readyState
  1194. return "loading" === state || "complete" === state
  1195. }),
  1196. chainNullableK(x => x.contentDocument),
  1197. alt(() => some(document)),
  1198. chainNullableK(x => x.querySelector("yt-live-chat-app"))
  1199. ),
  1200. mountComponent = x => {
  1201. ;(x.root.style.display = "contents"),
  1202. external_m_default().mount(x.root, x.comp)
  1203. },
  1204. removeOldChats = (flowChats, maxChatCount) => {
  1205. flowChats.sort((a, b) =>
  1206. a.animationEnded === b.animationEnded
  1207. ? 0
  1208. : a.animationEnded
  1209. ? -1
  1210. : 1
  1211. ),
  1212. flowChats
  1213. .splice(0, Math.max(0, flowChats.length - maxChatCount))
  1214. .forEach(x => {
  1215. external_log_default().debug("RemoveChat"), x.element.remove()
  1216. })
  1217. },
  1218. setChatAppCss = chatApp =>
  1219. function_pipe(
  1220. fromNullable(
  1221. chatApp.querySelector(
  1222. "#item-scroller.animated.yt-live-chat-item-list-renderer #item-offset.yt-live-chat-item-list-renderer"
  1223. )
  1224. ),
  1225. match(
  1226. () => () => {},
  1227. x => () => {
  1228. x.style.overflow = "unset"
  1229. }
  1230. )
  1231. ),
  1232. settingPanel_option = (value, label) =>
  1233. external_m_default()("option", { value }, label),
  1234. settingRow = (label, content) =>
  1235. external_m_default()("div", [
  1236. external_m_default()("span", label),
  1237. external_m_default()("div", content),
  1238. ]),
  1239. textColorRow = (color, textStyle, oninput) =>
  1240. external_m_default()("div", [
  1241. external_m_default()("input", {
  1242. style: { width: "36px", verticalAlign: "middle" },
  1243. type: "color",
  1244. value: color,
  1245. oninput,
  1246. }),
  1247. external_m_default()("input", {
  1248. style: { verticalAlign: "middle", width: "5.5em" },
  1249. type: "text",
  1250. maxlength: 20,
  1251. value: color,
  1252. oninput,
  1253. }),
  1254. external_m_default()(
  1255. "span",
  1256. { style: { ...textStyle, color } },
  1257. "Aa1あア亜"
  1258. ),
  1259. ]),
  1260. rangeRow = (min, max, step, value, oninput) =>
  1261. external_m_default()("div", [
  1262. external_m_default()("input", {
  1263. style: { width: "150px", verticalAlign: "middle" },
  1264. type: "range",
  1265. min,
  1266. max,
  1267. step,
  1268. value,
  1269. oninput,
  1270. }),
  1271. external_m_default()("input", {
  1272. style: {
  1273. width: "30px",
  1274. backgroundColor: "transparent",
  1275. color: "inherit",
  1276. borderWidth: "1px",
  1277. verticalAlign: "middle",
  1278. },
  1279. inputmode: "decimal",
  1280. value,
  1281. onchange: oninput,
  1282. }),
  1283. ]),
  1284. checkboxRow = (label, checked, onchange) =>
  1285. external_m_default()(
  1286. "div",
  1287. external_m_default()("label", [
  1288. label,
  1289. external_m_default()("input", {
  1290. type: "checkbox",
  1291. checked,
  1292. onchange,
  1293. }),
  1294. ])
  1295. ),
  1296. getInputValue = e => {
  1297. const target = e.currentTarget
  1298. if (
  1299. target instanceof HTMLSelectElement ||
  1300. target instanceof HTMLTextAreaElement ||
  1301. target instanceof HTMLInputElement
  1302. )
  1303. return target.value
  1304. throw Error(
  1305. "Event target isn't an Input or TextArea or Input element"
  1306. )
  1307. },
  1308. getInputChecked = e => {
  1309. return ((constructor = HTMLInputElement),
  1310. (x = e.currentTarget),
  1311. assert_lib(x instanceof constructor),
  1312. x).checked
  1313. var constructor, x
  1314. },
  1315. langOptions = [
  1316. ["FYC_EN", "English"],
  1317. ["FYC_JA", "日本語"],
  1318. ],
  1319. fontOptions = [
  1320. ["", "Default", "デフォルト"],
  1321. ["arial", "Arial", "Arial"],
  1322. ["arial black", "Arial Black", "Arial Black"],
  1323. ["arial narrow", "Arial Narrow", "Arial Narrow"],
  1324. ["Century", "Century", "Century"],
  1325. ["Comic Sans MS", "Comic Sans MS", "Comic Sans MS"],
  1326. ["Courier", "Courier", "Courier"],
  1327. ["cursive", "cursive", "cursive"],
  1328. ["fantasy", "fantasy", "fantasy"],
  1329. ["Impact", "Impact", "Impact"],
  1330. ["Meiryo", "Meiryo", "メイリオ"],
  1331. ["Meiryo UI", "Meiryo UI", "メイリオ UI"],
  1332. ["monospace", "monospace", "monospace"],
  1333. ["Monotype Corsiva", "Monotype Corsiva", "Monotype Corsiva"],
  1334. ["MS PGothic", "MS PGothic", "MS Pゴシック"],
  1335. ["MS Gothic", "MS Gothic", "MS ゴシック"],
  1336. ["MS Sans Serif", "MS Sans Serif", "MS Sans Serif"],
  1337. ["MS Serif", "MS Serif", "MS Serif"],
  1338. ["MS UI Gothic", "MS UI Gothic", "MS UI Gothic"],
  1339. ["sans-serif", "Sans-serif", "Sans-serif"],
  1340. ["serif", "Serif", "Serif"],
  1341. ["Times New Roman", "Times New Roman", "Times New Roman"],
  1342. ["Yu Gothic", "Yu Gothic", "遊ゴシック"],
  1343. ["YuGothic", "YuGothic", "游ゴシック体"],
  1344. ],
  1345. settingPanel = (flowChats, mainState, state, userConfig, mainLog) => {
  1346. var _a, _b
  1347. const panelState = {
  1348. bannedWordRegexs: userConfig.bannedWordRegexs.get(),
  1349. bannedWordRegexsValid: !0,
  1350. bannedWordRegexsError: "",
  1351. currentTab: 0,
  1352. timingStepCount: parseInt(
  1353. null !==
  1354. (_b =
  1355. null ===
  1356. (_a = userConfig.timingFunction
  1357. .get()
  1358. .match(/^steps\((\d+),.+/)) || void 0 === _a
  1359. ? void 0
  1360. : _a[1]) && void 0 !== _b
  1361. ? _b
  1362. : "150",
  1363. 10
  1364. ),
  1365. },
  1366. stepTiming = stepCount => `steps(${stepCount}, jump-end)`,
  1367. useStepTiming = () =>
  1368. Boolean(userConfig.timingFunction.get().match(/^steps\(.+/)),
  1369. panelBoxStyle = width => ({
  1370. flex: `0 0 ${width}px`,
  1371. margin: "2px",
  1372. }),
  1373. textAreaStyle = {
  1374. resize: "horizontal",
  1375. boxSizing: "border-box",
  1376. width: "100%",
  1377. },
  1378. textRecord = {
  1379. font: ["Font", "フォント"],
  1380. color: ["Color(Normal)", "色(通常)"],
  1381. ownerColor: ["Color(Owner)", "色(オーナー)"],
  1382. moderatorColor: ["Color(Moderator)", "色(モデレーター)"],
  1383. memberColor: ["Color(Member)", "色(メンバー)"],
  1384. feedback: ["Feedback", "バグ報告と要望"],
  1385. eventLog: ["Event log", "イベントログ"],
  1386. giveFeedback: [
  1387. "Give your feedbacks here(Please attach the event log if they're bug related)",
  1388. "バグ報告、要望はこちら(バグの場合は、イベントログを添付してください)",
  1389. ],
  1390. chatOpacity: ["Opacity", "不透明度"],
  1391. fontSize: ["Size", "サイズ"],
  1392. fontWeight: ["Weight", "太さ"],
  1393. shadowFontWeight: ["Weight(Shadow)", "太さ(影)"],
  1394. flowSpeed: ["Speed", "速度"],
  1395. maxChatCount: ["Max number of chats", "最大表示数"],
  1396. maxChatLength: ["Max number of characters", "最大文字数"],
  1397. laneCount: ["Number of rows", "行数"],
  1398. bannedWords: ["Banned Words", "NGワード"],
  1399. bannedWordRegexs: ["Banned Words(Regex)", "NGワード(正規表現)"],
  1400. bannedUsers: ["Banned Users", "NGユーザー"],
  1401. simplifyChatField: ["Simplify", "簡略化する"],
  1402. createBanButton: ["Show ban button", "NGボタンを表示する"],
  1403. displayModName: [
  1404. "Show moderator's name",
  1405. "モデレータの名前を表示する",
  1406. ],
  1407. displaySuperChatAuthor: [
  1408. "Show super chat author",
  1409. "スパチャの作成者を表示する",
  1410. ],
  1411. createChats: ["Display flowing chats", "チャットを流す"],
  1412. textOnly: [
  1413. "Text only(ignore emojis)",
  1414. "文字のみ(絵文字を無視する)",
  1415. ],
  1416. error: ["Error", "エラー"],
  1417. video: ["Video", "画面"],
  1418. chatField: ["Chat Window", "チャット欄"],
  1419. useStepTiming: ["Move chat in steps", "チャットを段階的に動かす"],
  1420. timingStepCount: ["└Step Count", "└段階数"],
  1421. chatFilter: ["Chat Filter", "チャットフィルター"],
  1422. flowChat: ["Flow Chat", "チャット流れ"],
  1423. clearFlowChats: [
  1424. "Clear Flowing Chats",
  1425. "流れるチャットをクリアする",
  1426. ],
  1427. flowNewChatIf: [
  1428. "A new chat will appear if all of the followings are met:",
  1429. "新しいチャットは以下のすべてを満たす場合に流れます:",
  1430. ],
  1431. noOverlap: ["└Chats won't overlap", "└他のチャットと重ならない"],
  1432. minSpacing: ["Min spacing between chats", "チャットの最小間隔"],
  1433. },
  1434. getLang = key => {
  1435. const lang = userConfig.lang.get()
  1436. return textRecord[key]["FYC_EN" === lang ? 0 : 1]
  1437. },
  1438. ss = {
  1439. str: {
  1440. lang: new external_rxjs_namespaceObject.Subject(),
  1441. font: new external_rxjs_namespaceObject.Subject(),
  1442. color: new external_rxjs_namespaceObject.Subject(),
  1443. ownerColor: new external_rxjs_namespaceObject.Subject(),
  1444. moderatorColor: new external_rxjs_namespaceObject.Subject(),
  1445. memberColor: new external_rxjs_namespaceObject.Subject(),
  1446. },
  1447. num: {
  1448. chatOpacity: new external_rxjs_namespaceObject.Subject(),
  1449. fontSize: new external_rxjs_namespaceObject.Subject(),
  1450. fontWeight: new external_rxjs_namespaceObject.Subject(),
  1451. shadowFontWeight: new external_rxjs_namespaceObject.Subject(),
  1452. flowSpeed: new external_rxjs_namespaceObject.Subject(),
  1453. minSpacing: new external_rxjs_namespaceObject.Subject(),
  1454. },
  1455. int: {
  1456. maxChatCount: new external_rxjs_namespaceObject.Subject(),
  1457. maxChatLength: new external_rxjs_namespaceObject.Subject(),
  1458. laneCount: new external_rxjs_namespaceObject.Subject(),
  1459. },
  1460. tabChange: new external_rxjs_namespaceObject.Subject(),
  1461. bannedWords: new external_rxjs_namespaceObject.Subject(),
  1462. bannedWordRegexs: new external_rxjs_namespaceObject.Subject(),
  1463. bannedUsers: new external_rxjs_namespaceObject.Subject(),
  1464. bl: {
  1465. createChats: new external_rxjs_namespaceObject.Subject(),
  1466. textOnly: new external_rxjs_namespaceObject.Subject(),
  1467. displayModName: new external_rxjs_namespaceObject.Subject(),
  1468. displaySuperChatAuthor: new external_rxjs_namespaceObject.Subject(),
  1469. noOverlap: new external_rxjs_namespaceObject.Subject(),
  1470. simplifyChatField: new external_rxjs_namespaceObject.Subject(),
  1471. createBanButton: new external_rxjs_namespaceObject.Subject(),
  1472. },
  1473. useStepTiming: new external_rxjs_namespaceObject.Subject(),
  1474. timingStepCount: new external_rxjs_namespaceObject.Subject(),
  1475. clearFlowChats: new external_rxjs_namespaceObject.Subject(),
  1476. },
  1477. checkboxNode = label =>
  1478. checkboxRow(
  1479. getLang(label),
  1480. userConfig[label].get(),
  1481. lib(ss.bl[label])
  1482. ),
  1483. textColorNode = label =>
  1484. settingRow(getLang(label), [
  1485. textColorRow(
  1486. userConfig[label].get(),
  1487. {
  1488. fontFamily: userConfig.font.get(),
  1489. fontWeight: userConfig.fontWeight.get().toString(),
  1490. },
  1491. lib(ss.str[label])
  1492. ),
  1493. ]),
  1494. rangeNode = (label, streams, min, max, step) =>
  1495. settingRow(getLang(label), [
  1496. rangeRow(
  1497. min,
  1498. max,
  1499. step,
  1500. userConfig[label].get(),
  1501. lib(streams[label])
  1502. ),
  1503. ]),
  1504. setConfig = setUserConfig(userConfig),
  1505. updateStringMacro = key => {
  1506. return (
  1507. (stream = ss.str[key]),
  1508. (configKey = key),
  1509. stream.pipe(
  1510. (0, external_rxjs_operators_namespaceObject.map)(
  1511. getInputValue
  1512. ),
  1513. (0, external_rxjs_operators_namespaceObject.tap)(x => {
  1514. setConfig(configKey, x)
  1515. })
  1516. )
  1517. )
  1518. var stream, configKey
  1519. },
  1520. updateNumberMacro = key => {
  1521. return (
  1522. (stream = ss.num[key]),
  1523. (configKey = key),
  1524. stream.pipe(
  1525. (0, external_rxjs_operators_namespaceObject.map)(
  1526. getInputValue
  1527. ),
  1528. (0, external_rxjs_operators_namespaceObject.map)(parseFloat),
  1529. (0, external_rxjs_operators_namespaceObject.tap)(x => {
  1530. setConfig(configKey, x)
  1531. })
  1532. )
  1533. )
  1534. var stream, configKey
  1535. },
  1536. updateIntMacro = key => {
  1537. return (
  1538. (stream = ss.int[key]),
  1539. (configKey = key),
  1540. stream.pipe(
  1541. (0, external_rxjs_operators_namespaceObject.map)(
  1542. getInputValue
  1543. ),
  1544. (0, external_rxjs_operators_namespaceObject.map)(x =>
  1545. parseInt(x, 10)
  1546. ),
  1547. (0, external_rxjs_operators_namespaceObject.tap)(x => {
  1548. setConfig(configKey, x)
  1549. })
  1550. )
  1551. )
  1552. var stream, configKey
  1553. },
  1554. updateBoolMacro = key => {
  1555. return (
  1556. (stream = ss.bl[key]),
  1557. (configKey = key),
  1558. stream.pipe(
  1559. (0, external_rxjs_operators_namespaceObject.map)(
  1560. getInputChecked
  1561. ),
  1562. (0, external_rxjs_operators_namespaceObject.tap)(x => {
  1563. setConfig(configKey, x)
  1564. })
  1565. )
  1566. )
  1567. var stream, configKey
  1568. }
  1569. return (
  1570. (0, external_rxjs_namespaceObject.merge)(
  1571. (0, external_rxjs_namespaceObject.merge)(
  1572. (0, external_rxjs_namespaceObject.merge)(
  1573. updateStringMacro("font"),
  1574. updateNumberMacro("fontSize"),
  1575. updateNumberMacro("fontWeight"),
  1576. updateIntMacro("laneCount"),
  1577. updateNumberMacro("minSpacing")
  1578. ).pipe(
  1579. (0, external_rxjs_operators_namespaceObject.mapTo)({
  1580. setStyle: !0,
  1581. setAnimation: !0,
  1582. })
  1583. ),
  1584. (0, external_rxjs_namespaceObject.merge)(
  1585. updateStringMacro("color"),
  1586. updateStringMacro("ownerColor"),
  1587. updateStringMacro("moderatorColor"),
  1588. updateStringMacro("memberColor"),
  1589. updateNumberMacro("chatOpacity"),
  1590. updateNumberMacro("shadowFontWeight")
  1591. ).pipe(
  1592. (0, external_rxjs_operators_namespaceObject.mapTo)({
  1593. setStyle: !0,
  1594. })
  1595. ),
  1596. (0, external_rxjs_namespaceObject.merge)(
  1597. updateNumberMacro("flowSpeed")
  1598. ).pipe(
  1599. (0, external_rxjs_operators_namespaceObject.mapTo)({
  1600. setPlayState: !0,
  1601. })
  1602. ),
  1603. (0, external_rxjs_namespaceObject.merge)(
  1604. updateIntMacro("maxChatCount").pipe(
  1605. (0, external_rxjs_operators_namespaceObject.tap)(x =>
  1606. removeOldChats(flowChats, x)
  1607. )
  1608. ),
  1609. updateBoolMacro("noOverlap"),
  1610. ss.useStepTiming.pipe(
  1611. (0, external_rxjs_operators_namespaceObject.map)(
  1612. getInputChecked
  1613. ),
  1614. (0, external_rxjs_operators_namespaceObject.tap)(x => {
  1615. setConfig(
  1616. "timingFunction",
  1617. x ? stepTiming(panelState.timingStepCount) : "linear"
  1618. )
  1619. })
  1620. ),
  1621. ss.timingStepCount.pipe(
  1622. (0, external_rxjs_operators_namespaceObject.map)(
  1623. getInputValue
  1624. ),
  1625. (0, external_rxjs_operators_namespaceObject.map)(x =>
  1626. parseInt(x, 10)
  1627. ),
  1628. (0, external_rxjs_operators_namespaceObject.tap)(x => {
  1629. ;(panelState.timingStepCount = x),
  1630. setConfig("timingFunction", stepTiming(x))
  1631. })
  1632. )
  1633. ).pipe(
  1634. (0, external_rxjs_operators_namespaceObject.mapTo)({
  1635. setAnimation: !0,
  1636. })
  1637. )
  1638. ).pipe(
  1639. (0, external_rxjs_operators_namespaceObject.throttleTime)(
  1640. 180,
  1641. void 0,
  1642. { leading: !0, trailing: !0 }
  1643. ),
  1644. (0, external_rxjs_operators_namespaceObject.tap)(x => {
  1645. flowChats
  1646. .filter(chat => !chat.animationEnded)
  1647. .forEach(chat => {
  1648. const config = {
  1649. setStyle: !1,
  1650. setAnimation: !1,
  1651. setPlayState: !1,
  1652. ...x,
  1653. }
  1654. config.setStyle &&
  1655. setChatStyle(chat, mainState, userConfig),
  1656. config.setAnimation
  1657. ? setChatAnimation(
  1658. chat,
  1659. flowChats,
  1660. mainState,
  1661. userConfig
  1662. )
  1663. : config.setPlayState &&
  1664. setChatPlayState(chat, mainState, userConfig)
  1665. })
  1666. })
  1667. ),
  1668. updateStringMacro("lang"),
  1669. ss.tabChange.pipe(
  1670. (0, external_rxjs_operators_namespaceObject.tap)(x => {
  1671. panelState.currentTab = x
  1672. })
  1673. ),
  1674. updateIntMacro("maxChatLength"),
  1675. updateBoolMacro("simplifyChatField"),
  1676. updateBoolMacro("createBanButton"),
  1677. updateBoolMacro("createChats"),
  1678. updateBoolMacro("displayModName"),
  1679. updateBoolMacro("displaySuperChatAuthor"),
  1680. updateBoolMacro("textOnly"),
  1681. ss.bannedWords.pipe(
  1682. (0, external_rxjs_operators_namespaceObject.map)(getInputValue),
  1683. (0, external_rxjs_operators_namespaceObject.map)(x =>
  1684. x.split(/\r\n|\n/).filter(word => "" !== word)
  1685. ),
  1686. (0, external_rxjs_operators_namespaceObject.tap)(x => {
  1687. setConfig("bannedWords", x)
  1688. })
  1689. ),
  1690. ss.bannedWordRegexs.pipe(
  1691. (0, external_rxjs_operators_namespaceObject.map)(getInputValue),
  1692. (0, external_rxjs_operators_namespaceObject.map)(x =>
  1693. x.split(/\r\n|\n/).filter(regex => "" !== regex)
  1694. ),
  1695. (0, external_rxjs_operators_namespaceObject.tap)(x => {
  1696. panelState.bannedWordRegexs = x
  1697. let valid = !0
  1698. ;(panelState.bannedWordRegexsError = ""),
  1699. panelState.bannedWordRegexs.forEach(regex => {
  1700. try {
  1701. RegExp(regex, "u")
  1702. } catch (error) {
  1703. mainLog("Invalid Regex", regex),
  1704. external_log_default().warn(error),
  1705. (panelState.bannedWordRegexsError += `${error} in ${regex};`),
  1706. (valid = !1)
  1707. }
  1708. }),
  1709. valid && setConfig("bannedWordRegexs", x),
  1710. (panelState.bannedWordRegexsValid = valid)
  1711. })
  1712. ),
  1713. ss.bannedUsers.pipe(
  1714. (0, external_rxjs_operators_namespaceObject.map)(getInputValue),
  1715. (0, external_rxjs_operators_namespaceObject.map)(x =>
  1716. x.split(/\r\n|\n/).filter(user => "" !== user)
  1717. ),
  1718. (0, external_rxjs_operators_namespaceObject.tap)(x => {
  1719. setConfig("bannedUsers", x)
  1720. })
  1721. ),
  1722. ss.clearFlowChats.pipe(
  1723. (0, external_rxjs_operators_namespaceObject.tap)(() =>
  1724. removeOldChats(flowChats, 0)
  1725. )
  1726. )
  1727. ).subscribe(),
  1728. {
  1729. view: () => {
  1730. return external_m_default()(
  1731. "div",
  1732. {
  1733. className: "fyc_panel",
  1734. style: {
  1735. visibility: state.showPanel ? "visible" : "hidden",
  1736. backgroundColor: "rgba(30,30,30,0.9)",
  1737. zIndex: 5,
  1738. position: "absolute",
  1739. bottom: "40px",
  1740. right: "0px",
  1741. color: "#fff",
  1742. fontSize: "14px",
  1743. width: "660px",
  1744. border: "solid 1px #666",
  1745. fontFamily: "MS PGothic",
  1746. lineHeight: "1.2",
  1747. },
  1748. },
  1749. [
  1750. external_m_default()(
  1751. "div",
  1752. { style: { float: "right", margin: "3px 3px 0 0" } },
  1753. [
  1754. "🌐",
  1755. external_m_default()(
  1756. "select",
  1757. {
  1758. selectedIndex: langOptions.findIndex(
  1759. x => x[0] === userConfig.lang.get()
  1760. ),
  1761. onchange: lib(ss.str.lang),
  1762. },
  1763. langOptions.map(x => settingPanel_option(...x))
  1764. ),
  1765. ]
  1766. ),
  1767. ((style = {
  1768. container: { height: "364px" },
  1769. label: { padding: "6px" },
  1770. labelFocus: { background: "#666" },
  1771. tab: { display: "flex", padding: "6px" },
  1772. }),
  1773. (labels = [
  1774. getLang("flowChat"),
  1775. getLang("chatFilter"),
  1776. getLang("chatField"),
  1777. getLang("feedback"),
  1778. ]),
  1779. (tabs = [
  1780. [
  1781. external_m_default()(
  1782. "div",
  1783. { style: panelBoxStyle(212) },
  1784. [
  1785. settingRow(getLang("font"), [
  1786. external_m_default()(
  1787. "select",
  1788. {
  1789. style: { width: "60%" },
  1790. selectedIndex: fontOptions.findIndex(
  1791. x => x[0] === userConfig.font.get()
  1792. ),
  1793. onchange: lib(ss.str.font),
  1794. },
  1795. fontOptions.map(x =>
  1796. settingPanel_option(
  1797. x[0],
  1798. "FYC_JA" === userConfig.lang.get()
  1799. ? x[2]
  1800. : x[1]
  1801. )
  1802. )
  1803. ),
  1804. ]),
  1805. textColorNode("color"),
  1806. textColorNode("ownerColor"),
  1807. textColorNode("moderatorColor"),
  1808. textColorNode("memberColor"),
  1809. ]
  1810. ),
  1811. external_m_default()(
  1812. "div",
  1813. { style: panelBoxStyle(212) },
  1814. [
  1815. rangeNode("chatOpacity", ss.num, 0, 1, 0.05),
  1816. rangeNode("fontSize", ss.num, 0.3, 2, 0.05),
  1817. rangeNode("fontWeight", ss.num, 10, 1e3, 10),
  1818. rangeNode("shadowFontWeight", ss.num, 0, 3, 0.1),
  1819. rangeNode("flowSpeed", ss.num, 1, 50, 1),
  1820. rangeNode("maxChatCount", ss.int, 5, 200, 5),
  1821. rangeNode("maxChatLength", ss.int, 5, 200, 5),
  1822. rangeNode("laneCount", ss.int, 1, 25, 1),
  1823. ]
  1824. ),
  1825. external_m_default()(
  1826. "div",
  1827. { style: panelBoxStyle(212) },
  1828. [
  1829. rangeNode("minSpacing", ss.num, 0, 2.5, 0.1),
  1830. checkboxRow(
  1831. getLang("useStepTiming"),
  1832. useStepTiming(),
  1833. lib(ss.useStepTiming)
  1834. ),
  1835. external_m_default()(
  1836. "div",
  1837. {
  1838. style: {
  1839. ...(useStepTiming()
  1840. ? {}
  1841. : { opacity: "0.5" }),
  1842. },
  1843. },
  1844. settingRow(getLang("timingStepCount"), [
  1845. rangeRow(
  1846. 1,
  1847. 400,
  1848. 1,
  1849. panelState.timingStepCount,
  1850. lib(ss.timingStepCount)
  1851. ),
  1852. ])
  1853. ),
  1854. checkboxNode("createChats"),
  1855. checkboxNode("displayModName"),
  1856. checkboxNode("displaySuperChatAuthor"),
  1857. checkboxNode("textOnly"),
  1858. external_m_default()(
  1859. "span",
  1860. getLang("flowNewChatIf")
  1861. ),
  1862. checkboxNode("noOverlap"),
  1863. external_m_default()(
  1864. "button",
  1865. {
  1866. type: "button",
  1867. onclick: lib(ss.clearFlowChats),
  1868. },
  1869. getLang("clearFlowChats")
  1870. ),
  1871. ]
  1872. ),
  1873. ],
  1874. [
  1875. external_m_default()(
  1876. "div",
  1877. { style: panelBoxStyle(212) },
  1878. [
  1879. settingRow(getLang("bannedWords"), [
  1880. external_m_default()(
  1881. "textarea",
  1882. {
  1883. rows: 18,
  1884. style: textAreaStyle,
  1885. onchange: lib(ss.bannedWords),
  1886. },
  1887. userConfig.bannedWords.get().join("\n")
  1888. ),
  1889. ]),
  1890. ]
  1891. ),
  1892. external_m_default()(
  1893. "div",
  1894. { style: panelBoxStyle(212) },
  1895. [
  1896. settingRow(getLang("bannedWordRegexs"), [
  1897. external_m_default()(
  1898. "span",
  1899. panelState.bannedWordRegexsValid
  1900. ? ""
  1901. : `${getLang("error")}: ${
  1902. panelState.bannedWordRegexsError
  1903. }`
  1904. ),
  1905. external_m_default()(
  1906. "textarea",
  1907. {
  1908. rows: 18,
  1909. style: textAreaStyle,
  1910. onchange: lib(ss.bannedWordRegexs),
  1911. },
  1912. panelState.bannedWordRegexs.join("\n")
  1913. ),
  1914. ]),
  1915. ]
  1916. ),
  1917. external_m_default()(
  1918. "div",
  1919. { style: panelBoxStyle(212) },
  1920. [
  1921. settingRow(getLang("bannedUsers"), [
  1922. external_m_default()(
  1923. "textarea",
  1924. {
  1925. rows: 18,
  1926. style: textAreaStyle,
  1927. onchange: lib(ss.bannedUsers),
  1928. },
  1929. userConfig.bannedUsers.get().join("\n")
  1930. ),
  1931. ]),
  1932. ]
  1933. ),
  1934. ],
  1935. [
  1936. external_m_default()(
  1937. "div",
  1938. { style: panelBoxStyle(644) },
  1939. [
  1940. checkboxNode("simplifyChatField"),
  1941. checkboxNode("createBanButton"),
  1942. ]
  1943. ),
  1944. ],
  1945. [
  1946. external_m_default()(
  1947. "div",
  1948. { style: panelBoxStyle(644) },
  1949. [
  1950. external_m_default()(
  1951. "div",
  1952. { style: { float: "right" } },
  1953. external_m_default()(
  1954. "a",
  1955. {
  1956. style: { color: "#f0f" },
  1957. href:
  1958. "https://greasyfork.org/en/scripts/411442-flow-youtube-chat/feedback",
  1959. target: "_blank",
  1960. },
  1961. getLang("giveFeedback")
  1962. )
  1963. ),
  1964. settingRow(getLang("eventLog"), [
  1965. external_m_default()(
  1966. "textarea",
  1967. {
  1968. rows: 18,
  1969. style: textAreaStyle,
  1970. readOnly: !0,
  1971. onclick: () => {},
  1972. },
  1973. mainState.log
  1974. ),
  1975. ]),
  1976. ]
  1977. ),
  1978. ],
  1979. ]),
  1980. (currentTab = panelState.currentTab),
  1981. (ontabSelect = lib(ss.tabChange)),
  1982. external_m_default()("div", [
  1983. external_m_default()(
  1984. "div",
  1985. ...labels.map((x, i) =>
  1986. external_m_default()(
  1987. "span",
  1988. {
  1989. style: {
  1990. ...style.label,
  1991. ...(currentTab === i ? style.labelFocus : {}),
  1992. display: "inline-block",
  1993. },
  1994. onclick: () => ontabSelect(i),
  1995. },
  1996. x
  1997. )
  1998. )
  1999. ),
  2000. external_m_default()(
  2001. "div",
  2002. {
  2003. style: {
  2004. ...style.container,
  2005. overflow: "hidden auto",
  2006. },
  2007. },
  2008. ...tabs.map((x, i) => {
  2009. var _a
  2010. return external_m_default()(
  2011. "div",
  2012. {
  2013. style: {
  2014. ...style.tab,
  2015. display:
  2016. i === currentTab
  2017. ? null !== (_a = style.tab.display) &&
  2018. void 0 !== _a
  2019. ? _a
  2020. : "block"
  2021. : "none",
  2022. },
  2023. },
  2024. x
  2025. )
  2026. })
  2027. ),
  2028. ])),
  2029. ]
  2030. )
  2031. var style, labels, tabs, currentTab, ontabSelect
  2032. },
  2033. }
  2034. )
  2035. },
  2036. settingComponent = (flowChats, mainState, userConfig, mainLog) => {
  2037. const state = { showPanel: !1 },
  2038. panel = settingPanel(
  2039. flowChats,
  2040. mainState,
  2041. state,
  2042. userConfig,
  2043. mainLog
  2044. ),
  2045. toggleButton = ((state, userConfig) => {
  2046. const click$ = new external_rxjs_namespaceObject.Subject()
  2047. return (
  2048. click$
  2049. .pipe(
  2050. (0, external_rxjs_operators_namespaceObject.tap)(() => {
  2051. state.showPanel = !state.showPanel
  2052. })
  2053. )
  2054. .subscribe(),
  2055. {
  2056. view: () =>
  2057. external_m_default()(
  2058. "button",
  2059. {
  2060. className: "fyc_button",
  2061. style: {
  2062. background: "rgba(0,0,0,0)",
  2063. marginLeft: "10px",
  2064. whiteSpace: "nowrap",
  2065. },
  2066. onclick: lib(click$),
  2067. },
  2068. [
  2069. external_m_default()(
  2070. "svg",
  2071. {
  2072. preserveAspectRatio: "xMidYMid meet",
  2073. viewBox: "0 0 640 640",
  2074. width: "15",
  2075. height: "15",
  2076. style: { position: "relative", top: "1px" },
  2077. },
  2078. [
  2079. external_m_default()(
  2080. "defs",
  2081. external_m_default()("path", {
  2082. id: "d1TbzTC1zI",
  2083. d:
  2084. "m135.38 58.17 0.64 0.05 0.63 0.07 0.65 0.1 0.65 0.13 0.66 0.14 0.66 0.17 0.67 0.18 0.67 0.21 0.68 0.23 0.69 0.25 0.68 0.26 0.69 0.29 0.7 0.3 0.69 0.32 0.7 0.33 0.71 0.35 0.7 0.37 0.71 0.38 0.71 0.39 0.7 0.41 0.72 0.42 0.71 0.43 0.71 0.45 45.87 26.91 0.9-0.5 8.92-4.47 9.12-4.12 0.92-0.38v142.27l-2.42 2.55-3.53 4.01-3.38 4.15-3.22 4.28-3.06 4.41-2.9 4.53-2.73 4.65-2.55 4.76-2.37 4.87-2.19 4.97-2 5.07-1.82 5.17-1.61 5.26-1.41 5.35-1.21 5.43-1 5.51-0.78 5.57-0.57 5.65-0.34 5.71-0.12 5.77 0.12 5.78 0.34 5.71 0.57 5.64 0.78 5.58 1 5.51 1.21 5.43 1.41 5.34 1.61 5.27 1.82 5.16 2 5.08 2.19 4.97 2.37 4.87 2.55 4.76 2.73 4.65 2.9 4.53 3.06 4.41 3.22 4.28 3.38 4.14 3.53 4.02 3.68 3.87 3.82 3.73 3.96 3.57 4.09 3.43 4.23 3.26 4.34 3.1 4.47 2.94 4.59 2.76 4.7 2.59 4.8 2.4 4.91 2.22 5.01 2.03 5.1 1.84 5.19 1.63 5.28 1.44 5.36 1.22 5.43 1.01 5.51 0.8 5.57 0.57 5.63 0.35 5.7 0.11 5.69-0.11 5.64-0.35 5.57-0.57 5.51-0.8 5.43-1.01 5.36-1.22 5.28-1.44 5.19-1.63 5.1-1.84 5.01-2.03 4.91-2.22 4.8-2.4 4.7-2.59 4.59-2.76 4.46-2.94 4.35-3.1 4.23-3.26 4.09-3.43 3.96-3.57 3.82-3.73 3.68-3.87 3.53-4.02 3.38-4.14 3.22-4.28 3.06-4.41 2.9-4.53 2.72-4.65 2.56-4.76 2.37-4.87 2.19-4.97 2-5.08 1.81-5.16 1.62-5.27 1.41-5.34 1.21-5.43 1-5.51 0.78-5.58 0.57-5.64 0.34-5.71 0.12-5.78-0.12-5.77-0.06-1.06h33.29l140.27 63.64-0.02 0.01-0.48 0.4-0.51 0.38-0.52 0.37-0.55 0.36-0.57 0.36-0.58 0.34-0.6 0.34-0.63 0.33-0.63 0.32-0.66 0.31-0.67 0.31-0.69 0.3-0.7 0.29-0.71 0.3-0.73 0.28-0.74 0.28-1.52 0.56-0.78 0.27-0.78 0.28-1.6 0.54-0.82 0.26-51.23 13.84-1.32 4.34-3.37 9.6-3.71 9.43-4.07 9.24-4.41 9.04-0.5 0.91 26.56 46.48 0.44 0.72 0.84 1.44 0.4 0.72 0.39 0.72 0.38 0.72 0.36 0.71 0.34 0.71 0.33 0.71 0.32 0.71 0.3 0.7 0.28 0.7 0.26 0.7 0.24 0.69 0.23 0.69 0.2 0.68 0.19 0.67 0.16 0.68 0.14 0.66 0.12 0.66 0.1 0.66 0.08 0.65 0.05 0.64 0.02 0.63 0.01 0.62-0.03 0.62-0.05 0.61-0.08 0.6-0.1 0.59-0.13 0.59-0.16 0.57-0.2 0.57-0.22 0.55-0.25 0.54-0.28 0.54-0.31 0.52-0.35 0.51-0.37 0.5-0.41 0.48-0.45 0.48-66.99 67.88-0.47 0.45-0.47 0.41-0.49 0.38-0.49 0.34-0.51 0.31-0.51 0.27-0.53 0.24-0.53 0.21-0.54 0.18-0.55 0.14-0.56 0.12-0.56 0.09-0.58 0.06-0.58 0.03-0.59 0.01-0.6-0.02-0.61-0.04-0.62-0.07-0.62-0.09-0.63-0.12-0.64-0.13-0.65-0.16-0.65-0.17-0.66-0.2-0.67-0.21-0.68-0.23-0.68-0.25-0.69-0.26-0.69-0.28-0.71-0.3-0.7-0.3-0.72-0.32-0.72-0.33-0.73-0.34-0.73-0.36-0.74-0.36-0.75-0.37-0.75-0.38-1.52-0.78-45.87-26.91-0.9 0.5-8.92 4.47-9.12 4.12-9.3 3.77-9.47 3.41-4.29 1.34-13.65 51.91-0.27 0.83-0.26 0.81-0.27 0.81-0.27 0.8-0.54 1.56-0.28 0.76-0.28 0.75-0.28 0.74-0.29 0.73-0.29 0.71-0.3 0.69-0.3 0.68-0.31 0.67-0.32 0.64-0.32 0.63-0.33 0.61-0.34 0.6-0.35 0.57-0.36 0.55-0.36 0.54-0.38 0.51-0.39 0.49-0.4 0.46-0.41 0.45-0.42 0.42-0.44 0.39-0.45 0.37-0.46 0.34-0.48 0.32-0.49 0.29-0.5 0.26-0.52 0.24-0.54 0.2-0.56 0.18-0.57 0.14-0.59 0.12-0.6 0.08-0.63 0.05-0.64 0.01h-94.74l-0.64-0.01-0.64-0.05-0.61-0.08-0.6-0.12-0.59-0.14-0.57-0.18-0.55-0.2-0.54-0.24-0.53-0.26-0.52-0.29-0.5-0.32-0.49-0.34-0.47-0.37-0.46-0.39-0.45-0.42-0.43-0.45-0.43-0.46-0.41-0.49-0.4-0.51-0.38-0.54-0.38-0.55-0.36-0.57-0.36-0.6-0.34-0.61-0.33-0.63-0.32-0.64-0.31-0.67-0.3-0.68-0.29-0.69-0.28-0.71-0.27-0.73-0.26-0.74-0.25-0.75-0.25-0.76-0.46-1.56-0.21-0.8-0.42-1.62-0.19-0.83-13.65-51.91-4.29-1.34-9.47-3.41-9.3-3.77-9.12-4.12-8.92-4.47-1.08-0.59-45.69 26.81-1.42 0.88-0.72 0.42-0.7 0.4-0.71 0.4-0.71 0.38-0.7 0.37-0.71 0.35-0.7 0.33-0.69 0.32-0.7 0.3-0.69 0.29-0.68 0.26-0.69 0.25-0.68 0.23-0.67 0.2-0.67 0.19-0.66 0.17-0.66 0.14-0.65 0.12-0.65 0.1-0.63 0.08-0.64 0.05-0.62 0.03h-0.62l-0.61-0.03-0.6-0.05-0.59-0.08-0.59-0.1-0.57-0.14-0.57-0.16-0.56-0.19-0.54-0.23-0.54-0.25-0.52-0.28-0.52-0.32-0.5-0.35-0.49-0.38-0.48-0.42-0.47-0.45-66.99-67.88-0.45-0.48-0.4-0.48-0.37-0.49-0.34-0.5-0.3-0.52-0.27-0.52-0.24-0.53-0.21-0.54-0.17-0.54-0.15-0.56-0.11-0.57-0.09-0.57-0.06-0.58-0.03-0.6-0.01-0.6 0.02-0.6 0.04-0.62 0.07-0.62 0.09-0.64 0.11-0.64 0.14-0.64 0.15-0.66 0.17-0.66 0.19-0.67 0.44-1.36 0.25-0.69 0.26-0.7 0.27-0.71 0.29-0.71 0.3-0.72 0.32-0.72 0.33-0.73 0.33-0.74 0.35-0.74 0.36-0.75 0.74-1.52 0.38-0.77 0.39-0.77 26.5-46.38-0.44-0.82-4.41-9.04-4.07-9.24-3.72-9.43-3.36-9.6-1.33-4.34-51.22-13.84-0.82-0.26-1.6-0.54-0.78-0.28-0.78-0.27-1.52-0.56-0.74-0.28-0.73-0.28-0.71-0.3-0.7-0.29-0.69-0.3-0.67-0.31-0.66-0.31-0.64-0.32-0.62-0.33-0.6-0.34-0.58-0.34-0.57-0.36-0.55-0.36-0.52-0.37-0.51-0.38-0.48-0.4-0.46-0.4-0.44-0.42-0.41-0.43-0.39-0.44-0.37-0.45-0.33-0.47-0.32-0.48-0.28-0.5-0.26-0.51-0.23-0.53-0.21-0.55-0.17-0.56-0.14-0.58-0.11-0.6-0.08-0.61-0.05-0.63-0.02-0.66v-96l0.02-0.65 0.05-0.64 0.08-0.62 0.11-0.61 0.14-0.59 0.17-0.58 0.21-0.57 0.23-0.54 0.26-0.54 0.28-0.52 0.32-0.51 0.33-0.49 0.37-0.48 0.39-0.47 0.41-0.45 0.44-0.45 0.46-0.42 0.48-0.42 0.51-0.4 0.52-0.4 0.55-0.38 0.57-0.37 0.58-0.35 0.6-0.35 0.62-0.34 0.64-0.32 0.66-0.32 0.67-0.3 0.69-0.29 0.7-0.29 0.71-0.27 0.73-0.27 0.74-0.25 0.76-0.25 0.76-0.24 1.56-0.44 0.8-0.22 0.8-0.2 0.82-0.2 51.22-13.83 1.33-4.35 3.36-9.6 3.72-9.42 4.07-9.24 4.41-9.04 0.5-0.91-26.56-46.48-0.77-1.54-0.74-1.52-0.36-0.75-0.35-0.74-0.33-0.74-0.33-0.73-0.32-0.73-0.3-0.71-0.29-0.72-0.27-0.7-0.26-0.7-0.25-0.69-0.44-1.36-0.19-0.67-0.17-0.66-0.15-0.66-0.14-0.65-0.11-0.64-0.09-0.63-0.07-0.62-0.04-0.62-0.02-0.61 0.01-0.6 0.03-0.59 0.06-0.58 0.09-0.58 0.11-0.56 0.15-0.56 0.17-0.55 0.21-0.54 0.24-0.53 0.27-0.52 0.3-0.51 0.34-0.5 0.37-0.49 0.4-0.49 0.45-0.47 66.99-67.88 0.47-0.45 0.48-0.42 0.49-0.38 0.5-0.35 0.52-0.32 0.52-0.28 0.54-0.26 0.54-0.22 0.56-0.19 0.57-0.17 0.57-0.13 0.59-0.11 0.59-0.08 0.6-0.05 0.61-0.02h0.62l0.62 0.03zm441.37-56.16 2.78 0.28 2.75 0.4 2.71 0.49 2.67 0.61 2.63 0.7 2.59 0.81 2.54 0.9 2.5 1 2.45 1.09 2.39 1.18 2.35 1.28 2.28 1.36 2.23 1.44 2.17 1.53 2.11 1.6 2.04 1.69 1.97 1.76 1.91 1.83 1.83 1.91 1.76 1.97 1.69 2.05 1.61 2.1 1.52 2.17 1.45 2.23 1.36 2.29 1.27 2.34 1.18 2.4 1.1 2.44 0.99 2.5 0.91 2.55 0.8 2.58 0.71 2.64 0.6 2.67 0.5 2.71 0.39 2.74 0.28 2.78 0.17 2.81 0.06 2.84v137.8l-0.06 2.84-0.17 2.81-0.28 2.78-0.39 2.75-0.5 2.71-0.6 2.67-0.71 2.63-0.8 2.59-0.91 2.54-0.99 2.5-1.1 2.45-1.18 2.39-1.27 2.35-1.36 2.28-1.45 2.23-1.52 2.17-1.61 2.11-1.69 2.04-1.76 1.97-1.83 1.91-1.91 1.83-1.97 1.76-2.04 1.69-2.11 1.61-2.17 1.52-2.23 1.45-2.28 1.36-2.35 1.27-0.98 0.49 21.81 70.8-141.75-63.6h-155.05l-2.84-0.06-2.81-0.17-2.78-0.28-2.74-0.39-2.71-0.5-2.67-0.6-2.64-0.71-2.58-0.8-2.55-0.91-2.5-1-2.44-1.09-2.4-1.18-2.34-1.27-2.29-1.36-2.23-1.45-2.17-1.52-2.1-1.61-2.05-1.69-1.97-1.76-1.91-1.83-1.83-1.91-1.76-1.97-1.68-2.04-1.61-2.11-1.53-2.17-1.44-2.23-1.36-2.28-1.27-2.35-1.19-2.39-1.09-2.45-1-2.5-0.9-2.54-0.81-2.59-0.7-2.63-0.61-2.67-0.49-2.71-0.39-2.75-0.29-2.78-0.17-2.81-0.06-2.84v-137.8l0.06-2.84 0.17-2.81 0.29-2.78 0.39-2.74 0.49-2.71 0.61-2.67 0.7-2.64 0.81-2.58 0.9-2.55 1-2.5 1.09-2.44 1.19-2.4 1.27-2.34 1.36-2.29 1.44-2.23 1.53-2.17 1.61-2.1 1.68-2.05 1.76-1.97 1.83-1.91 1.91-1.83 1.97-1.76 2.05-1.69 2.1-1.6 2.17-1.53 2.23-1.44 2.29-1.36 2.34-1.28 2.4-1.18 2.44-1.09 2.5-1 2.55-0.9 2.58-0.81 2.64-0.7 2.67-0.61 2.71-0.49 2.74-0.4 2.78-0.28 2.81-0.17 2.84-0.06h244.31l2.84 0.06 2.81 0.17z",
  2085. })
  2086. ),
  2087. external_m_default()("use", {
  2088. "xlink:href": "#d1TbzTC1zI",
  2089. opacity: "1",
  2090. fill: "var(--iron-icon-fill-color, currentcolor)",
  2091. "fill-opacity": "1",
  2092. }),
  2093. ]
  2094. ),
  2095. external_m_default()(
  2096. "span",
  2097. {
  2098. style: {
  2099. position: "relative",
  2100. top: "-2px",
  2101. marginLeft: "8px,",
  2102. },
  2103. },
  2104. "FYC_JA" === userConfig.lang.get()
  2105. ? "設定"
  2106. : "Settings"
  2107. ),
  2108. ]
  2109. ),
  2110. }
  2111. )
  2112. })(state, userConfig)
  2113. return {
  2114. view: () => [
  2115. external_m_default()(panel),
  2116. external_m_default()(toggleButton),
  2117. ],
  2118. }
  2119. },
  2120. initialize = async (mainState, mainLog) => {
  2121. const consoleLog = (a, ...b) => {
  2122. mainLog(a, ...b),
  2123. external_log_default().info(`【FYC ${a}`),
  2124. b.length > 0 && external_log_default().info(...b)
  2125. }
  2126. mainLog("Version", package_namespaceObject_i8),
  2127. mainLog("User Agent", window.navigator.userAgent)
  2128. const userConfig = await (async () => ({
  2129. lang: await simpleConfigItem("FYC_LANG", "FYC_EN"),
  2130. font: await simpleConfigItem("FYC_FONT", "MS PGothic"),
  2131. chatOpacity: await simpleConfigItem("FYC_OPACITY", 0.8),
  2132. color: await simpleConfigItem("FYC_COLOR", "#ffffff"),
  2133. ownerColor: await simpleConfigItem("FYC_COLOR_OWNER", "#ffd600"),
  2134. moderatorColor: await simpleConfigItem(
  2135. "FYC_COLOR_MODERATOR",
  2136. "#a74fff"
  2137. ),
  2138. memberColor: await simpleConfigItem(
  2139. "FYC_COLOR_MEMBER",
  2140. "#9fffff"
  2141. ),
  2142. fontSize: await simpleConfigItem("FYC_SIZE", 1),
  2143. fontWeight: await simpleConfigItem("FYC_WEIGHT", 730),
  2144. shadowFontWeight: await simpleConfigItem("FYC_WEIGHT_SHADOW", 1),
  2145. maxChatCount: await simpleConfigItem("FYC_LIMIT", 40),
  2146. flowSpeed: await simpleConfigItem("FYC_SPEED", 18),
  2147. maxChatLength: await simpleConfigItem("FYC_MAX", 100),
  2148. laneCount: await simpleConfigItem("FYC_LANE_DIV", 12),
  2149. bannedWords: await makeConfigItem(
  2150. "FYC_NG_WORDS",
  2151. ...lineConfigArgs
  2152. ),
  2153. bannedWordRegexs: await makeConfigItem(
  2154. "FYC_NG_REG_WORDS",
  2155. ...lineConfigArgs
  2156. ),
  2157. bannedUsers: await makeConfigItem(
  2158. "FYC_NG_USERS",
  2159. ...lineConfigArgs
  2160. ),
  2161. createChats: await simpleConfigItem(
  2162. "FYC_TOGGLE_CREATE_COMMENTS",
  2163. !0
  2164. ),
  2165. noOverlap: await simpleConfigItem("FYC_NO_OVERLAP", !0),
  2166. createBanButton: await simpleConfigItem("FYC_NG_BUTTON", !0),
  2167. simplifyChatField: await simpleConfigItem(
  2168. "FYC_SIMPLE_CHAT_FIELD",
  2169. !1
  2170. ),
  2171. displayModName: await simpleConfigItem(
  2172. "FYC_DISPLAY_MODERATOR_NAME",
  2173. !0
  2174. ),
  2175. displaySuperChatAuthor: await simpleConfigItem(
  2176. "FYC_DISPLAY_SUPER_CHAT_AUTHOR",
  2177. !0
  2178. ),
  2179. textOnly: await simpleConfigItem("FYC_TEXT_ONLY", !1),
  2180. timingFunction: await simpleConfigItem(
  2181. "FYC_TIMING_FUNCTION",
  2182. "linear"
  2183. ),
  2184. displayChats: await simpleConfigItem("FYC_DISPLAY_COMMENTS", !0),
  2185. minSpacing: await simpleConfigItem("FYC_MIN_SPACING", 0.5),
  2186. }))(),
  2187. channel = new BroadcastChannel("fyc-0615654655528523")
  2188. mainLog("UserConfig", JSON.stringify(userConfig))
  2189. const reinitSubject = new external_rxjs_namespaceObject.Subject(),
  2190. reinitialize = lib(reinitSubject),
  2191. chatScrn = (() => {
  2192. const element = document.createElement("div")
  2193. return (
  2194. (element.style.pointerEvents = "none"),
  2195. (element.style.zIndex = "30"),
  2196. element
  2197. )
  2198. })(),
  2199. css = (() => {
  2200. const element = document.createElement("style")
  2201. return (
  2202. (element.innerHTML =
  2203. ".fyc_chat {\n line-height: 1;\n z-index: 30;\n position: absolute;\n user-select: none;\n white-space: nowrap;\n will-change: transform;\n }\n .fyc_chat > img {\n vertical-align: text-top;\n }\n .fyc_button {\n display: inline-block;\n border-style: none;\n z-index: 4;\n font-weight: 500;\n color: var(--yt-spec-text-secondary);\n }"),
  2204. element
  2205. )
  2206. })(),
  2207. flowChats = [],
  2208. storedHref = window.location.href,
  2209. observePair = con => {
  2210. const subject = new external_rxjs_namespaceObject.Subject()
  2211. return { subject, observer: new con(lib(subject)) }
  2212. },
  2213. documentMutationPair = observePair(MutationObserver),
  2214. chatFieldMutationPair = observePair(MutationObserver),
  2215. playerResizePair = observePair(ResizeObserver),
  2216. simpleWrap = comp => ({
  2217. comp,
  2218. root: document.createElement("span"),
  2219. }),
  2220. wrappedToggleChatBtn = simpleWrap(
  2221. ((flowChats, userConfig) => {
  2222. const click$ = new external_rxjs_namespaceObject.Subject()
  2223. click$
  2224. .pipe(
  2225. (0, external_rxjs_operators_namespaceObject.tap)(() => {
  2226. const newDisplay = !userConfig.displayChats.get()
  2227. flowChats.forEach(x => {
  2228. x.element.style.visibility = newDisplay
  2229. ? "visible"
  2230. : "hidden"
  2231. }),
  2232. setUserConfig(userConfig)("displayChats", newDisplay)
  2233. })
  2234. )
  2235. .subscribe()
  2236. const label = () =>
  2237. "チャット" +
  2238. (userConfig.displayChats.get() ? "非表示" : "表示")
  2239. return {
  2240. view: () =>
  2241. external_m_default()(
  2242. "button",
  2243. {
  2244. className: ["ytp-button"].join(" "),
  2245. style: {
  2246. background: "none",
  2247. border: "none",
  2248. cursor: "pointer",
  2249. float: "left",
  2250. fontSize: "1em",
  2251. height: "4em",
  2252. outline: "none",
  2253. overflow: "visible",
  2254. padding: "0 0 0em",
  2255. position: "relative",
  2256. width: "3em",
  2257. },
  2258. type: "button",
  2259. "aria-label": label(),
  2260. title: label(),
  2261. onclick: lib(click$),
  2262. },
  2263. [
  2264. external_m_default()(
  2265. "svg",
  2266. { style: { width: "100%" }, viewBox: "0 0 36 36" },
  2267. [
  2268. external_m_default()("path", {
  2269. className: ["chat-button-path"].join(" "),
  2270. d:
  2271. "m11 12h17q1 0 1 1v9q0 1-1 1h-1v2l-4-2h-12q-1 0-1-1v-9q0-1 1-1z",
  2272. fill: "#fff",
  2273. "fill-opacity": userConfig.displayChats.get()
  2274. ? "1"
  2275. : "0",
  2276. stroke: "#fff",
  2277. "stroke-width": "2",
  2278. }),
  2279. ]
  2280. ),
  2281. ]
  2282. ),
  2283. }
  2284. })(flowChats, userConfig)
  2285. ),
  2286. wrappedSetting = simpleWrap(
  2287. settingComponent(flowChats, mainState, userConfig, mainLog)
  2288. ),
  2289. livePage = {
  2290. toggleChatBtnParent: () =>
  2291. fromNullable(document.querySelector(".ytp-right-controls")),
  2292. settingNextElement: () =>
  2293. fromNullable(
  2294. document.querySelector(
  2295. "#menu-container .dropdown-trigger.style-scope.ytd-menu-renderer"
  2296. )
  2297. ),
  2298. player: () =>
  2299. fromNullable(document.querySelector("#movie_player")),
  2300. video: () =>
  2301. fromNullable(
  2302. document.querySelector("video.video-stream.html5-main-video")
  2303. ),
  2304. chatApp,
  2305. chatField: () =>
  2306. function_pipe(
  2307. chatApp(),
  2308. chainNullableK(x =>
  2309. x.querySelector(
  2310. "#items.style-scope.yt-live-chat-item-list-renderer"
  2311. )
  2312. )
  2313. ),
  2314. offlineSlate: () =>
  2315. fromNullable(document.querySelector(".ytp-offline-slate")),
  2316. },
  2317. liveElementKeys = [
  2318. "chatApp",
  2319. "chatField",
  2320. "video",
  2321. "player",
  2322. "toggleChatBtnParent",
  2323. "settingNextElement",
  2324. "offlineSlate",
  2325. ],
  2326. live = function_pipe(
  2327. liveElementKeys,
  2328. es6_ReadonlyArray_map(x => {
  2329. return [x, ((key = x), { ele: none, read: livePage[key] })]
  2330. var key
  2331. }),
  2332. Object.fromEntries
  2333. ),
  2334. eq = getEq(eqStrict).equals
  2335. reinitSubject
  2336. .pipe(
  2337. (0, external_rxjs_operators_namespaceObject.observeOn)(
  2338. external_rxjs_namespaceObject.asyncScheduler
  2339. ),
  2340. (0, external_rxjs_operators_namespaceObject.delay)(300),
  2341. (0, external_rxjs_operators_namespaceObject.switchMap)(() =>
  2342. (0, external_rxjs_namespaceObject.interval)(500).pipe(
  2343. (0, external_rxjs_operators_namespaceObject.filter)(() => {
  2344. return function_pipe(
  2345. liveElementKeys,
  2346. es6_ReadonlyArray_map(key => {
  2347. return function_pipe(
  2348. live[key].read(),
  2349. ((predicate = newEle => !eq(live[key].ele, newEle)),
  2350. function (a) {
  2351. return predicate(a) ? some(a) : none
  2352. }),
  2353. es6_Option_map(x => () => (
  2354. (live[key].ele = x),
  2355. consoleLog(`${key} changed`),
  2356. !0
  2357. )),
  2358. getOrElse(() => of(!1))
  2359. )
  2360. var predicate
  2361. }),
  2362. sequenceArray,
  2363. (function (f) {
  2364. return function (fa) {
  2365. return _map(fa, f)
  2366. }
  2367. })(
  2368. ((predicate = Boolean),
  2369. function (as) {
  2370. return as.some(predicate)
  2371. })
  2372. )
  2373. )()
  2374. var predicate
  2375. }),
  2376. (0, external_rxjs_operators_namespaceObject.startWith)(0)
  2377. )
  2378. ),
  2379. (0, external_rxjs_operators_namespaceObject.tap)(() => {
  2380. consoleLog("Loading..."),
  2381. removeOldChats(flowChats, 0),
  2382. documentMutationPair.observer.disconnect(),
  2383. documentMutationPair.observer.observe(document, {
  2384. childList: !0,
  2385. subtree: !0,
  2386. }),
  2387. chatFieldMutationPair.observer.disconnect(),
  2388. playerResizePair.observer.disconnect(),
  2389. document.head.append(css),
  2390. function_pipe(
  2391. [
  2392. function_pipe(
  2393. live.chatApp.ele,
  2394. es6_Option_map(setChatAppCss)
  2395. ),
  2396. function_pipe(
  2397. live.chatField.ele,
  2398. es6_Option_map(x => () => {
  2399. chatFieldMutationPair.observer.observe(x, {
  2400. childList: !0,
  2401. })
  2402. })
  2403. ),
  2404. function_pipe(
  2405. live.player.ele,
  2406. es6_Option_map(x => () => {
  2407. playerResizePair.observer.observe(x),
  2408. x.insertAdjacentElement("afterbegin", chatScrn)
  2409. })
  2410. ),
  2411. function_pipe(
  2412. live.toggleChatBtnParent.ele,
  2413. es6_Option_map(x => () => {
  2414. x.append(wrappedToggleChatBtn.root),
  2415. mountComponent(wrappedToggleChatBtn)
  2416. })
  2417. ),
  2418. function_pipe(
  2419. live.settingNextElement.ele,
  2420. es6_Option_map(x => () => {
  2421. x.insertAdjacentElement(
  2422. "beforebegin",
  2423. wrappedSetting.root
  2424. ),
  2425. mountComponent(wrappedSetting)
  2426. })
  2427. ),
  2428. ],
  2429. es6_ReadonlyArray_map(getOrElse(() => () => {})),
  2430. ReadonlyArray_append(
  2431. function_pipe(
  2432. live.video.ele,
  2433. filter(x => !x.paused),
  2434. alt(() => live.offlineSlate.ele),
  2435. isSome,
  2436. x => () => {
  2437. mainState.chatPlaying = x
  2438. }
  2439. )
  2440. ),
  2441. sequenceArray
  2442. )()
  2443. }),
  2444. (0, external_rxjs_operators_namespaceObject.switchMap)(() =>
  2445. (0, external_rxjs_namespaceObject.merge)(
  2446. (0, external_rxjs_namespaceObject.fromEvent)(
  2447. channel,
  2448. "message"
  2449. ).pipe(
  2450. (0, external_rxjs_operators_namespaceObject.pluck)("data"),
  2451. (0, external_rxjs_operators_namespaceObject.tap)(
  2452. ([key, val]) => {
  2453. ;[
  2454. "bannedWords",
  2455. "bannedWordRegexs",
  2456. "bannedUsers",
  2457. "simplifyChatField",
  2458. "createBanButton",
  2459. ].includes(key) &&
  2460. (external_m_default().redraw(),
  2461. userConfig[key].set(val, !1))
  2462. }
  2463. )
  2464. ),
  2465. function_pipe(
  2466. live.video.ele,
  2467. match(
  2468. () => external_rxjs_namespaceObject.EMPTY,
  2469. x => {
  2470. return ((video = x),
  2471. (0, external_rxjs_namespaceObject.merge)(
  2472. (0, external_rxjs_namespaceObject.fromEvent)(
  2473. video,
  2474. "playing"
  2475. ).pipe(
  2476. (0, external_rxjs_operators_namespaceObject.mapTo)(
  2477. !0
  2478. )
  2479. ),
  2480. (0, external_rxjs_namespaceObject.fromEvent)(
  2481. video,
  2482. "waiting"
  2483. ).pipe(
  2484. (0, external_rxjs_operators_namespaceObject.mapTo)(
  2485. !1
  2486. )
  2487. ),
  2488. (0, external_rxjs_namespaceObject.fromEvent)(
  2489. video,
  2490. "pause"
  2491. ).pipe(
  2492. (0, external_rxjs_operators_namespaceObject.mapTo)(
  2493. !1
  2494. )
  2495. )
  2496. )).pipe(
  2497. (0, external_rxjs_operators_namespaceObject.map)(
  2498. playing => playing || isSome(live.offlineSlate.ele)
  2499. ),
  2500. (0, external_rxjs_operators_namespaceObject.tap)(
  2501. chatPlaying => {
  2502. ;(mainState.chatPlaying = chatPlaying),
  2503. flowChats.forEach(chat => {
  2504. setChatPlayState(chat, mainState, userConfig)
  2505. })
  2506. }
  2507. )
  2508. )
  2509. var video
  2510. }
  2511. )
  2512. ),
  2513. chatFieldMutationPair.subject.pipe(
  2514. (0, external_rxjs_operators_namespaceObject.tap)(
  2515. handleChatFieldMutation(
  2516. chatScrn,
  2517. flowChats,
  2518. mainState,
  2519. userConfig,
  2520. mainLog
  2521. )
  2522. )
  2523. ),
  2524. documentMutationPair.subject.pipe(
  2525. (0, external_rxjs_operators_namespaceObject.map)(
  2526. () => window.location.href
  2527. ),
  2528. (0,
  2529. external_rxjs_operators_namespaceObject.distinctUntilChanged)(),
  2530. (0, external_rxjs_operators_namespaceObject.skip)(1),
  2531. (0, external_rxjs_operators_namespaceObject.tap)(
  2532. async () => {
  2533. consoleLog("URL Changed", storedHref),
  2534. consoleLog("Wait for 1700ms..."),
  2535. removeOldChats(flowChats, 0),
  2536. await delay_default()(1700),
  2537. reinitialize()
  2538. }
  2539. )
  2540. ),
  2541. playerResizePair.subject.pipe(
  2542. (0,
  2543. external_rxjs_operators_namespaceObject.throttleTime)(
  2544. 500,
  2545. void 0,
  2546. { leading: !0, trailing: !0 }
  2547. ),
  2548. (0, external_rxjs_operators_namespaceObject.startWith)([]),
  2549. (0, external_rxjs_operators_namespaceObject.map)(() =>
  2550. function_pipe(
  2551. live.player.ele,
  2552. match(
  2553. () => () => {},
  2554. x => () => {
  2555. mainLog("Resize detected"),
  2556. (mainState.playerRect = x.getBoundingClientRect()),
  2557. flowChats.forEach(chat => {
  2558. setChatStyle(chat, mainState, userConfig),
  2559. setChatAnimation(
  2560. chat,
  2561. flowChats,
  2562. mainState,
  2563. userConfig
  2564. )
  2565. })
  2566. }
  2567. )
  2568. )
  2569. ),
  2570. (0, external_rxjs_operators_namespaceObject.tap)(x => x())
  2571. )
  2572. )
  2573. ),
  2574. (0, external_rxjs_operators_namespaceObject.retryWhen)(
  2575. (0, external_rxjs_operators_namespaceObject.tap)(x =>
  2576. consoleLog("Errored", x)
  2577. )
  2578. )
  2579. )
  2580. .subscribe(),
  2581. reinitialize()
  2582. }
  2583. ;(async () => {
  2584. external_log_namespaceObject.setLevel("info")
  2585. const mainState = {
  2586. chatPlaying: !0,
  2587. playerRect: new DOMRect(24, 80, 839, 472),
  2588. log: "",
  2589. },
  2590. mainLog = (mainState => (a, ...b) => {
  2591. ;(mainState.log += `${a}${b.length > 0 ? ": " : ""}${b.join(
  2592. ", "
  2593. )}\n`),
  2594. mainState.log.length > 22e3 &&
  2595. (mainState.log = `${mainState.log.slice(0, 6e3)}\n`)
  2596. })(mainState)
  2597. try {
  2598. await initialize(mainState, mainLog)
  2599. } catch (error) {
  2600. mainLog("Errored", error)
  2601. }
  2602. })()
  2603. })()
  2604. })()