Flow Youtube Chat

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

目前为 2021-02-19 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name Flow Youtube Chat
  3. // @version 1.14.10
  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. external_rxjs_namespaceObject = rxjs,
  221. external_rxjs_operators_namespaceObject = rxjs.operators,
  222. package_namespaceObject_i8 = "1.14.10",
  223. addMainCss = () => {
  224. let styleHtml = ""
  225. ;(styleHtml +=
  226. ".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 }"),
  227. (styleHtml +=
  228. ".fyc_chat > img {\n vertical-align: text-top;\n }"),
  229. (styleHtml +=
  230. ".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 }"),
  231. external_log_default().debug("AppendCss")
  232. const existedElement = document.querySelector(".fyc_style"),
  233. styleElement =
  234. null != existedElement
  235. ? existedElement
  236. : document.createElement("style")
  237. existedElement ||
  238. (document.head.append(styleElement),
  239. styleElement.classList.add(".fyc_style")),
  240. (styleElement.innerHTML =
  241. ".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 }.fyc_chat > img {\n vertical-align: text-top;\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 }")
  242. },
  243. external_m_namespaceObject = m
  244. var external_m_default = __webpack_require__.n(external_m_namespaceObject)
  245. const external_Swal_namespaceObject = Swal
  246. var external_Swal_default = __webpack_require__.n(
  247. external_Swal_namespaceObject
  248. )
  249. const createBanButton = (chat, id, userConfig, mainLog) => {
  250. var _a, _b
  251. if (chat.children.namedItem("card")) return
  252. const button = document.createElement("button")
  253. button.classList.add(
  254. "style-scope",
  255. "yt-icon-button",
  256. "fyc_button",
  257. "fyc_ngbutton"
  258. ),
  259. (button.style.padding = "0px"),
  260. (button.style.width = "20px"),
  261. (button.style.height = "20px"),
  262. (button.style.fill = "#fff"),
  263. button.setAttribute("aria-label", "NGに入れる"),
  264. (button.innerHTML =
  265. '<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>'),
  266. (button.onclick = () => {
  267. mainLog(`Added to Banned Users: ${id}`),
  268. userConfig.bannedUsers.set([
  269. ...userConfig.bannedUsers.get().slice(),
  270. id,
  271. ]),
  272. external_m_default().redraw(),
  273. (chat.style.display = "none"),
  274. external_Swal_default()
  275. .mixin({
  276. toast: !0,
  277. position: "bottom-left",
  278. timer: 2500,
  279. timerProgressBar: !0,
  280. showConfirmButton: !1,
  281. didOpen: toast => {
  282. toast.addEventListener(
  283. "mouseenter",
  284. external_Swal_default().stopTimer
  285. ),
  286. toast.addEventListener(
  287. "mouseleave",
  288. external_Swal_default().resumeTimer
  289. )
  290. },
  291. })
  292. .fire({ title: `Added Banned User: ${id}`, icon: "success" })
  293. }),
  294. external_log_default().debug("AppendNgButton"),
  295. null ===
  296. (_b =
  297. null === (_a = chat.querySelector("#content")) || void 0 === _a
  298. ? void 0
  299. : _a.querySelector("#message")) ||
  300. void 0 === _b ||
  301. _b.append(button)
  302. }
  303. var src = __webpack_require__(238),
  304. src_default = __webpack_require__.n(src)
  305. function function_pipe(
  306. a,
  307. ab,
  308. bc,
  309. cd,
  310. de,
  311. ef,
  312. fg,
  313. gh,
  314. hi,
  315. ij,
  316. jk,
  317. kl,
  318. lm,
  319. mn,
  320. no,
  321. op,
  322. pq,
  323. qr,
  324. rs,
  325. st
  326. ) {
  327. switch (arguments.length) {
  328. case 1:
  329. return a
  330. case 2:
  331. return ab(a)
  332. case 3:
  333. return bc(ab(a))
  334. case 4:
  335. return cd(bc(ab(a)))
  336. case 5:
  337. return de(cd(bc(ab(a))))
  338. case 6:
  339. return ef(de(cd(bc(ab(a)))))
  340. case 7:
  341. return fg(ef(de(cd(bc(ab(a))))))
  342. case 8:
  343. return gh(fg(ef(de(cd(bc(ab(a)))))))
  344. case 9:
  345. return hi(gh(fg(ef(de(cd(bc(ab(a))))))))
  346. case 10:
  347. return ij(hi(gh(fg(ef(de(cd(bc(ab(a)))))))))
  348. case 11:
  349. return jk(ij(hi(gh(fg(ef(de(cd(bc(ab(a))))))))))
  350. case 12:
  351. return kl(jk(ij(hi(gh(fg(ef(de(cd(bc(ab(a)))))))))))
  352. case 13:
  353. return lm(kl(jk(ij(hi(gh(fg(ef(de(cd(bc(ab(a))))))))))))
  354. case 14:
  355. return mn(lm(kl(jk(ij(hi(gh(fg(ef(de(cd(bc(ab(a)))))))))))))
  356. case 15:
  357. return no(mn(lm(kl(jk(ij(hi(gh(fg(ef(de(cd(bc(ab(a))))))))))))))
  358. case 16:
  359. return op(no(mn(lm(kl(jk(ij(hi(gh(fg(ef(de(cd(bc(ab(a)))))))))))))))
  360. case 17:
  361. return pq(
  362. op(no(mn(lm(kl(jk(ij(hi(gh(fg(ef(de(cd(bc(ab(a)))))))))))))))
  363. )
  364. case 18:
  365. return qr(
  366. pq(op(no(mn(lm(kl(jk(ij(hi(gh(fg(ef(de(cd(bc(ab(a))))))))))))))))
  367. )
  368. case 19:
  369. return rs(
  370. qr(
  371. pq(
  372. op(no(mn(lm(kl(jk(ij(hi(gh(fg(ef(de(cd(bc(ab(a)))))))))))))))
  373. )
  374. )
  375. )
  376. case 20:
  377. return st(
  378. rs(
  379. qr(
  380. pq(
  381. op(
  382. no(mn(lm(kl(jk(ij(hi(gh(fg(ef(de(cd(bc(ab(a))))))))))))))
  383. )
  384. )
  385. )
  386. )
  387. )
  388. }
  389. }
  390. var isNone = function (fa) {
  391. return "None" === fa._tag
  392. },
  393. none = { _tag: "None" },
  394. some = function (a) {
  395. return { _tag: "Some", value: a }
  396. }
  397. var getOrElse = function (onNone) {
  398. return function (ma) {
  399. return isNone(ma) ? onNone() : ma.value
  400. }
  401. }
  402. var empty = []
  403. const getChatLane = (
  404. flowChat,
  405. progress,
  406. flowChats,
  407. mainState,
  408. userConfig
  409. ) => {
  410. const chatIndex = flowChats.indexOf(flowChat),
  411. playerWidth = mainState.playerRect.width,
  412. playerX = mainState.playerRect.x,
  413. chatRect = flowChat.element.getBoundingClientRect(),
  414. chatWidth = chatRect.width,
  415. chatHeight = chatRect.height,
  416. chatX = progress ? chatRect.x - playerX : playerWidth,
  417. movingChats = (function (as) {
  418. var l = as.length
  419. if (0 === l) return empty
  420. for (var ras = Array(l), i = 0; i < l; i++) ras[i] = as[i]
  421. return ras
  422. })(
  423. flowChats
  424. .slice(0, chatIndex >= 0 ? chatIndex : void 0)
  425. .filter(chat => !chat.animationEnded)
  426. .sort((a, b) => a.lane - b.lane)
  427. ),
  428. tooCloseTo = src_default()(i => {
  429. const otherRect = movingChats[i].element.getBoundingClientRect(),
  430. otherWidth = otherRect.width,
  431. otherX = otherRect.x - playerX,
  432. gap =
  433. (chatHeight * otherWidth * chatWidth) ** 0.333 *
  434. userConfig.minSpacing.get()
  435. return (
  436. (playerWidth - otherX) / (playerWidth + otherWidth) - progress <
  437. (chatWidth + gap) / (playerWidth + chatWidth) ||
  438. otherX + otherWidth + gap > chatX
  439. )
  440. }),
  441. occupyInfo = [
  442. ...movingChats.map((x, i) => ({
  443. tooClose: () => tooCloseTo(i),
  444. lane: x.lane,
  445. })),
  446. { tooClose: () => !0, lane: userConfig.laneCount.get() },
  447. ],
  448. index = occupyInfo.findIndex(x => x.lane >= flowChat.lane),
  449. rightFreeLane = occupyInfo
  450. .slice(index)
  451. .findIndex(x => x.tooClose()),
  452. leftFreeLane = function_pipe(
  453. occupyInfo.slice(0, index),
  454. ((predicate = x => x.tooClose()),
  455. function (as) {
  456. for (var i = as.length - 1; i >= 0; i--)
  457. if (predicate(as[i])) return some(i)
  458. return none
  459. }),
  460. getOrElse(() => -1)
  461. )
  462. var predicate
  463. let formerLaneInterval = 0
  464. leftFreeLane < flowChat.lane &&
  465. flowChat.lane < rightFreeLane &&
  466. (formerLaneInterval = Math.min(
  467. Math.max(
  468. formerLaneInterval,
  469. Math.min(
  470. flowChat.lane - leftFreeLane,
  471. rightFreeLane - flowChat.lane
  472. )
  473. ),
  474. 1
  475. ))
  476. let maxInterval = 0,
  477. maxIntervalLane = 0,
  478. lastLane = -1
  479. for (let i = 0; i < occupyInfo.length; i += 1)
  480. if (occupyInfo[i].tooClose()) {
  481. const nextLane = occupyInfo[i].lane,
  482. interLane = Math.min(
  483. Math.max((lastLane + nextLane) / 2, 0),
  484. userConfig.laneCount.get() - 1
  485. ),
  486. newInterval = Math.min(
  487. interLane - lastLane,
  488. nextLane - interLane,
  489. 1
  490. )
  491. if (
  492. newInterval - maxInterval > 0.001 &&
  493. ((maxIntervalLane = Math.max(lastLane + newInterval, 0)),
  494. (maxInterval = newInterval),
  495. maxInterval > 0.999)
  496. )
  497. break
  498. lastLane = nextLane
  499. }
  500. return {
  501. lane:
  502. Math.abs(formerLaneInterval - maxInterval) < 0.001
  503. ? flowChat.lane
  504. : maxIntervalLane,
  505. interval: maxInterval,
  506. }
  507. },
  508. setChatPlayState = (flowChat, mainState, userConfig) => {
  509. !flowChat.animationEnded &&
  510. flowChat.animation &&
  511. (mainState.chatPlaying
  512. ? flowChat.animation.play()
  513. : flowChat.animation.pause(),
  514. (flowChat.animation.playbackRate = userConfig.flowSpeed.get() / 15))
  515. },
  516. setChatAnimation = (flowChat, flowChats, mainState, userConfig) => {
  517. var _a, _b, _c
  518. if (flowChat.animationEnded) return !1
  519. const time =
  520. null !==
  521. (_b =
  522. null === (_a = flowChat.animation) || void 0 === _a
  523. ? void 0
  524. : _a.currentTime) && void 0 !== _b
  525. ? _b
  526. : void 0,
  527. progress = void 0 !== time ? time / flowChat.animationDuration : 0,
  528. { lane, interval } = getChatLane(
  529. flowChat,
  530. progress,
  531. flowChats,
  532. mainState,
  533. userConfig
  534. )
  535. if (userConfig.noOverlap.get() && interval < 0.999)
  536. return (
  537. null === (_c = flowChat.animation) ||
  538. void 0 === _c ||
  539. _c.finish(),
  540. (flowChat.animation = void 0),
  541. !1
  542. )
  543. flowChat.lane = lane
  544. const laneY = ((lane, mainState, userConfig) => {
  545. const laneCount = userConfig.laneCount.get(),
  546. laneR = lane % (2 * laneCount - 1),
  547. playerHeight = mainState.playerRect.height
  548. return (
  549. Math.round(
  550. 100 *
  551. (laneR < laneCount
  552. ? (playerHeight * (laneR % laneCount)) / laneCount + 4
  553. : playerHeight *
  554. ((laneR % laneCount) / laneCount + 1 / (2 * laneCount)))
  555. ) / 100
  556. )
  557. })(flowChat.lane, mainState, userConfig)
  558. flowChat.animation && flowChat.animation.cancel(),
  559. (flowChat.animationDuration = 6400),
  560. (flowChat.animation = flowChat.element.animate(
  561. [
  562. {
  563. transform: `translate(${mainState.playerRect.width}px, ${laneY}px)`,
  564. },
  565. {
  566. transform: `translate(${-flowChat.element.getBoundingClientRect()
  567. .width}px, ${laneY}px)`,
  568. },
  569. ],
  570. { duration: 6400, easing: userConfig.timingFunction.get() }
  571. )),
  572. (flowChat.animation.onfinish = () => {
  573. flowChat.animationEnded = !0
  574. })
  575. const newTime = void 0 !== time ? 6400 * progress : 0
  576. return (
  577. (flowChat.animation.currentTime = newTime),
  578. setChatPlayState(flowChat, mainState, userConfig),
  579. !0
  580. )
  581. },
  582. setChatStyle = (flowChat, mainState, userConfig) => {
  583. const fontSize = ((mainState, userConfig) =>
  584. Math.round(
  585. Math.max(userConfig.fontSize.get() - 0.2, 0.01) *
  586. (mainState.playerRect.height / userConfig.laneCount.get()) *
  587. 100
  588. ) / 100)(mainState, userConfig),
  589. { style } = flowChat.element
  590. ;(style.visibility = userConfig.displayChats.get()
  591. ? "visible"
  592. : "hidden"),
  593. (style.color =
  594. "owner" === flowChat.authorType
  595. ? userConfig.ownerColor.get()
  596. : "moderator" === flowChat.authorType
  597. ? userConfig.moderatorColor.get()
  598. : "member" === flowChat.authorType
  599. ? userConfig.memberColor.get()
  600. : userConfig.color.get()),
  601. (style.fontSize = `${fontSize}px`),
  602. (style.fontWeight = userConfig.fontWeight.get().toString()),
  603. (style.fontFamily = userConfig.font.get()),
  604. (style.opacity = userConfig.chatOpacity.get().toString())
  605. const offset = userConfig.shadowFontWeight.get()
  606. ;(style.textShadow = `-${offset}px -${offset}px #0009, ${offset}px -${offset}px #0009, -${offset}px ${offset}px #0009, ${offset}px ${offset}px #0009`),
  607. (style.transform = `translate(${mainState.playerRect.width}px)`)
  608. },
  609. assert_lib = check.assert,
  610. tapNonNull = x => (assert_lib(null != x), x),
  611. parseMessage = (lengthBefore, message, userConfig) => {
  612. const maxChatLength = userConfig.maxChatLength.get(),
  613. vnodes = []
  614. let semantic = "",
  615. length = lengthBefore
  616. return (
  617. message.innerHTML.split(/(?=<img )|">/g).some(part => {
  618. if (part.match(/^<img /)) {
  619. if (!userConfig.textOnly.get()) {
  620. const srcMatch = part.match(
  621. /<img\s.*?src=(?:'|")([^'">]+)(?:'|")/
  622. ),
  623. altMatch = part.match(
  624. /<img\s.*?alt=(?:'|")([^'">]+)(?:'|")/
  625. ),
  626. src =
  627. null == srcMatch ? void 0 : srcMatch[srcMatch.length - 1],
  628. alt =
  629. null == altMatch ? void 0 : altMatch[altMatch.length - 1]
  630. vnodes.push(
  631. external_m_default()("img", {
  632. style: { height: "1em", width: "1em" },
  633. src,
  634. alt,
  635. })
  636. ),
  637. (semantic += `<img alt="${null != alt ? alt : ""}">`),
  638. (length += 1)
  639. }
  640. } else {
  641. const text =
  642. part.length >= maxChatLength
  643. ? part.substr(0, maxChatLength)
  644. : part
  645. vnodes.push(external_m_default().fragment({}, text)),
  646. (semantic += text),
  647. (length += text.length)
  648. }
  649. return length >= maxChatLength
  650. }),
  651. { vnodes, semantic, length }
  652. )
  653. },
  654. chatFieldObserver = (
  655. chatScrn,
  656. flowChats,
  657. mainState,
  658. userConfig,
  659. mainLog
  660. ) =>
  661. new MutationObserver(mutations => {
  662. mutations.forEach(e => {
  663. Array.from(e.addedNodes)
  664. .filter(x => x.children.length > 0)
  665. .forEach(chat => {
  666. var _a
  667. const chatData = ((chat, userConfig) => {
  668. let semantic = "",
  669. length = 0
  670. const vnodes = []
  671. let authorID
  672. const authorType = chat.querySelector(".owner")
  673. ? "owner"
  674. : chat.querySelector(".moderator")
  675. ? "moderator"
  676. : chat.querySelector(".member")
  677. ? "member"
  678. : "normal"
  679. return (
  680. Array.from(chat.children).forEach(child => {
  681. var _a, _b, _c, _d
  682. const childID = child.id,
  683. message = child.querySelector("#message"),
  684. authorName = child.querySelector("#author-name")
  685. if ("content" === childID) {
  686. if (
  687. (chat.querySelector(".moderator") &&
  688. userConfig.displayModName.get() &&
  689. vnodes.push(
  690. external_m_default()(
  691. "span",
  692. { style: { fontSize: "smaller" } },
  693. `${
  694. null !==
  695. (_a =
  696. null == authorName
  697. ? void 0
  698. : authorName.innerText) &&
  699. void 0 !== _a
  700. ? _a
  701. : ""
  702. }: `
  703. )
  704. ),
  705. message)
  706. ) {
  707. const result = parseMessage(
  708. length,
  709. message,
  710. userConfig
  711. )
  712. vnodes.push(...result.vnodes),
  713. (semantic += result.semantic),
  714. (length += result.length)
  715. }
  716. } else if ("author-photo" === childID) {
  717. const matches = (null !==
  718. (_c =
  719. null === (_b = child.lastElementChild) ||
  720. void 0 === _b
  721. ? void 0
  722. : _b.getAttribute("src")) && void 0 !== _c
  723. ? _c
  724. : ""
  725. ).match(/ytc\/(.*)=/)
  726. authorID =
  727. null == matches
  728. ? void 0
  729. : matches[matches.length - 1]
  730. } else if ("card" === childID) {
  731. const normalChat = child.matches(
  732. [
  733. ".style-scope",
  734. ".yt-live-chat-paid-message-renderer",
  735. ].join("")
  736. ),
  737. stickerChat = child.matches(
  738. [
  739. ".style-scope",
  740. ".yt-live-chat-paid-sticker-renderer",
  741. ].join("")
  742. )
  743. if (normalChat || stickerChat) {
  744. const paidAmount = tapNonNull(
  745. child.querySelector("#purchase-amount") ||
  746. child.querySelector("#purchase-amount-chip")
  747. )
  748. authorID = void 0
  749. const headerColor = normalChat
  750. ? window
  751. .getComputedStyle(
  752. tapNonNull(
  753. child.querySelector("#header")
  754. )
  755. )
  756. .getPropertyValue("background-color")
  757. : window
  758. .getComputedStyle(chat)
  759. .getPropertyValue(
  760. "--yt-live-chat-paid-sticker-chip-background-color"
  761. ),
  762. paidColor = normalChat
  763. ? window
  764. .getComputedStyle(
  765. tapNonNull(
  766. child.querySelector("#content")
  767. )
  768. )
  769. .getPropertyValue("background-color")
  770. : window
  771. .getComputedStyle(chat)
  772. .getPropertyValue(
  773. "--yt-live-chat-paid-sticker-background-color"
  774. )
  775. if (
  776. (userConfig.displaySuperChatAuthor.get() &&
  777. vnodes.push(
  778. external_m_default()(
  779. "span",
  780. {
  781. style: {
  782. color: headerColor,
  783. fontSize: "smaller",
  784. fontFamily: "inherit",
  785. },
  786. },
  787. `${
  788. null !==
  789. (_d =
  790. null == authorName
  791. ? void 0
  792. : authorName.innerText) &&
  793. void 0 !== _d
  794. ? _d
  795. : ""
  796. }: `
  797. )
  798. ),
  799. normalChat && message)
  800. ) {
  801. const result = parseMessage(
  802. length,
  803. message,
  804. userConfig
  805. )
  806. vnodes.push(
  807. external_m_default()(
  808. "span",
  809. {
  810. style: {
  811. color: headerColor,
  812. fontFamily: "inherit",
  813. },
  814. },
  815. result.vnodes
  816. )
  817. ),
  818. (semantic += result.semantic),
  819. (length += result.length)
  820. }
  821. ;(length += paidAmount.innerText.length),
  822. vnodes.push(
  823. external_m_default()(
  824. "span",
  825. {
  826. style: {
  827. color: paidColor,
  828. fontSize: "smaller",
  829. fontFamily: "inherit",
  830. },
  831. },
  832. external_m_default()(
  833. "strong",
  834. { style: { fontFamily: "inherit" } },
  835. paidAmount.innerText
  836. )
  837. )
  838. )
  839. }
  840. }
  841. }),
  842. { vnodes, semantic, authorType, authorID }
  843. )
  844. })(chat, userConfig),
  845. semanticTextContent =
  846. null !==
  847. (_a = new DOMParser().parseFromString(
  848. `<span>${chatData.semantic}<span>`,
  849. "text/html"
  850. ).body.textContent) && void 0 !== _a
  851. ? _a
  852. : ""
  853. ;((content, userConfig, mainLog) =>
  854. userConfig.bannedWords
  855. .get()
  856. .some(
  857. word =>
  858. !!content.includes(word) &&
  859. (mainLog(`Banned Word: "${word}" in "${content}"`),
  860. !0)
  861. ))(semanticTextContent, userConfig, mainLog) ||
  862. ((content, userConfig, mainLog) =>
  863. userConfig.bannedWordRegexs.get().some(word => {
  864. const result = content.match(RegExp(word, "u"))
  865. return (
  866. !!result &&
  867. (mainLog(
  868. `Banned Word: "${result.toString()}" in "${content}"`
  869. ),
  870. !0)
  871. )
  872. }))(semanticTextContent, userConfig, mainLog) ||
  873. (void 0 !== chatData.authorID &&
  874. ((authorID, userConfig, mainLog) =>
  875. userConfig.bannedUsers
  876. .get()
  877. .some(
  878. user =>
  879. !(
  880. authorID !== user ||
  881. (mainLog(`Banned User: "${authorID}"`), 0)
  882. )
  883. ))(chatData.authorID, userConfig, mainLog))
  884. ? (chat.style.display = "none")
  885. : (userConfig.createChats.get() &&
  886. ((
  887. chatData,
  888. flowChats,
  889. chatScrn,
  890. mainState,
  891. userConfig
  892. ) => {
  893. var _a
  894. let element
  895. const offScreenChatIndex = flowChats.findIndex(
  896. chat =>
  897. chat.animationEnded ||
  898. flowChats.length >= userConfig.maxChatCount.get()
  899. )
  900. if (-1 !== offScreenChatIndex) {
  901. element = flowChats[offScreenChatIndex].element
  902. const [oldChat] = flowChats.splice(
  903. offScreenChatIndex,
  904. 1
  905. )
  906. null === (_a = oldChat.animation) ||
  907. void 0 === _a ||
  908. _a.cancel()
  909. } else
  910. external_log_default().debug("CreateFlowChat"),
  911. (element = document.createElement("span")),
  912. chatScrn.append(element)
  913. element.classList.add("fyc_chat")
  914. const flowChat = {
  915. element,
  916. lane: -1,
  917. animation: void 0,
  918. animationDuration: 0,
  919. animationEnded: !1,
  920. authorType: chatData.authorType,
  921. }
  922. external_m_default().render(element, chatData.vnodes),
  923. setChatStyle(flowChat, mainState, userConfig),
  924. setChatAnimation(
  925. flowChat,
  926. flowChats,
  927. mainState,
  928. userConfig
  929. )
  930. ? flowChats.push(flowChat)
  931. : flowChat.element.remove()
  932. })(
  933. chatData,
  934. flowChats,
  935. chatScrn,
  936. mainState,
  937. userConfig
  938. ),
  939. userConfig.createBanButton.get() &&
  940. void 0 !== chatData.authorID &&
  941. !chat.querySelector(".owner") &&
  942. createBanButton(
  943. chat,
  944. chatData.authorID,
  945. userConfig,
  946. mainLog
  947. ),
  948. userConfig.simplifyChatField.get() &&
  949. (chat => {
  950. if (
  951. chat.querySelector(
  952. ".style-scope.yt-live-chat-paid-message-renderer"
  953. ) ||
  954. chat.querySelector(".owner")
  955. )
  956. return
  957. chat.style.borderBottom =
  958. "1px solid var(--yt-spec-text-secondary)"
  959. const authorPhoto = chat.querySelector(
  960. "#author-photo"
  961. )
  962. authorPhoto && (authorPhoto.style.display = "none")
  963. const authorChip = chat.querySelector(
  964. "yt-live-chat-author-chip.style-scope.yt-live-chat-text-message-renderer"
  965. )
  966. authorChip && (authorChip.style.display = "none")
  967. })(chat))
  968. })
  969. })
  970. }),
  971. componentMounter = (root, placeRoot) => component => {
  972. root.style.display = "contents"
  973. const success = placeRoot(root)
  974. return success && external_m_default().mount(root, component), success
  975. }
  976. class IndirectConfigItem {
  977. constructor(x) {
  978. ;(this.gmKey = x.gmKey),
  979. (this.defaultVal = x.defaultVal),
  980. (this.val = x.val),
  981. (this.toGm = x.toGm)
  982. }
  983. get() {
  984. return this.val
  985. }
  986. async set(val) {
  987. return (this.val = val), GM.setValue(this.gmKey, this.toGm(val))
  988. }
  989. }
  990. const makeConfigItem = async (gmKey, defaultVal, toItem, toGm) => {
  991. const val = await GM.getValue(gmKey)
  992. return new IndirectConfigItem({
  993. gmKey,
  994. val: void 0 !== val ? toItem(val) : defaultVal,
  995. defaultVal,
  996. toGm,
  997. })
  998. },
  999. simpleConfigItem = async (gmKey, defaultVal) => {
  1000. var _a
  1001. return new IndirectConfigItem({
  1002. gmKey,
  1003. val:
  1004. null !== (_a = await GM.getValue(gmKey)) && void 0 !== _a
  1005. ? _a
  1006. : defaultVal,
  1007. defaultVal,
  1008. toGm: x => x,
  1009. })
  1010. },
  1011. lineConfigArgs = [
  1012. [],
  1013. x => x.split(/\r\n|\n/).filter(s => "" !== s),
  1014. x => x.join("\n"),
  1015. ],
  1016. livePage_getPlayer = () => {
  1017. var _a
  1018. return null !== (_a = document.querySelector("#movie_player")) &&
  1019. void 0 !== _a
  1020. ? _a
  1021. : void 0
  1022. },
  1023. livePage_getMainVideo = () => {
  1024. var _a
  1025. return null !==
  1026. (_a = document.querySelector(
  1027. "video.video-stream.html5-main-video"
  1028. )) && void 0 !== _a
  1029. ? _a
  1030. : void 0
  1031. },
  1032. livePage_getChatFrame = () => {
  1033. var _a
  1034. return null !== (_a = document.querySelector("#chatframe")) &&
  1035. void 0 !== _a
  1036. ? _a
  1037. : void 0
  1038. },
  1039. livePage_getChatField = () => {
  1040. var _a, _b, _c
  1041. return null !==
  1042. (_c = (null !==
  1043. (_b =
  1044. null === (_a = document.querySelector("#chatframe")) ||
  1045. void 0 === _a
  1046. ? void 0
  1047. : _a.contentDocument) && void 0 !== _b
  1048. ? _b
  1049. : document
  1050. ).querySelector(
  1051. "#items.style-scope.yt-live-chat-item-list-renderer"
  1052. )) && void 0 !== _c
  1053. ? _c
  1054. : void 0
  1055. },
  1056. livePage_getOfflineSlate = () => {
  1057. var _a
  1058. return null !== (_a = document.querySelector(".ytp-offline-slate")) &&
  1059. void 0 !== _a
  1060. ? _a
  1061. : void 0
  1062. },
  1063. removeOldChats = (flowChats, maxChatCount) => {
  1064. flowChats.sort((a, b) =>
  1065. a.animationEnded === b.animationEnded
  1066. ? 0
  1067. : a.animationEnded
  1068. ? -1
  1069. : 1
  1070. ),
  1071. flowChats
  1072. .splice(0, Math.max(0, flowChats.length - maxChatCount))
  1073. .forEach(x => {
  1074. external_log_default().debug("RemoveChat"), x.element.remove()
  1075. })
  1076. }
  1077. var delay = __webpack_require__(228),
  1078. delay_default = __webpack_require__.n(delay)
  1079. const setChatFrameCss = async mainLog => (
  1080. await delay_default()(700),
  1081. (async (func, count, interval, mainLog) => {
  1082. let exception,
  1083. succeed = !1
  1084. for (let i = 0; i < count; i += 1) {
  1085. try {
  1086. await func(i), (succeed = !0)
  1087. break
  1088. } catch (e) {
  1089. exception = e
  1090. }
  1091. mainLog("Retry"), await delay_default()(interval)
  1092. }
  1093. if (!succeed) throw exception
  1094. })(
  1095. () => {
  1096. var _a, _b
  1097. const element =
  1098. null ===
  1099. (_b =
  1100. null === (_a = document.querySelector("#chatframe")) ||
  1101. void 0 === _a
  1102. ? void 0
  1103. : _a.contentDocument) || void 0 === _b
  1104. ? void 0
  1105. : _b.querySelector(
  1106. "#item-scroller.animated.yt-live-chat-item-list-renderer #item-offset.yt-live-chat-item-list-renderer"
  1107. )
  1108. element && (element.style.overflow = "unset")
  1109. },
  1110. 5,
  1111. 1e3,
  1112. mainLog
  1113. )
  1114. ),
  1115. settingPanel_option = (value, label) =>
  1116. external_m_default()("option", { value }, label),
  1117. settingRow = (label, content) =>
  1118. external_m_default()("div", [
  1119. external_m_default()("span", label),
  1120. external_m_default()("div", content),
  1121. ]),
  1122. rangeRow = (min, max, step, value, oninput) =>
  1123. external_m_default()("div", [
  1124. external_m_default()("input", {
  1125. style: { width: "150px", verticalAlign: "middle" },
  1126. type: "range",
  1127. min,
  1128. max,
  1129. step,
  1130. value,
  1131. oninput,
  1132. }),
  1133. external_m_default()("input", {
  1134. style: {
  1135. width: "30px",
  1136. backgroundColor: "transparent",
  1137. color: "inherit",
  1138. borderWidth: "1px",
  1139. verticalAlign: "middle",
  1140. },
  1141. inputmode: "decimal",
  1142. value,
  1143. onchange: oninput,
  1144. }),
  1145. ]),
  1146. checkboxRow = (label, checked, onchange) =>
  1147. external_m_default()(
  1148. "div",
  1149. external_m_default()("label", [
  1150. label,
  1151. external_m_default()("input", {
  1152. type: "checkbox",
  1153. checked,
  1154. onchange,
  1155. }),
  1156. ])
  1157. ),
  1158. getInputValue = e => {
  1159. const target = e.currentTarget
  1160. if (
  1161. target instanceof HTMLSelectElement ||
  1162. target instanceof HTMLTextAreaElement ||
  1163. target instanceof HTMLInputElement
  1164. )
  1165. return target.value
  1166. throw Error(
  1167. "Event target isn't an Input or TextArea or Input element"
  1168. )
  1169. },
  1170. getInputChecked = e => {
  1171. return ((constructor = HTMLInputElement),
  1172. (x = e.currentTarget),
  1173. assert_lib(x instanceof constructor),
  1174. x).checked
  1175. var constructor, x
  1176. },
  1177. langOptions = [
  1178. ["FYC_EN", "English"],
  1179. ["FYC_JA", "日本語"],
  1180. ],
  1181. fontOptions = [
  1182. ["", "Default", "デフォルト"],
  1183. ["arial", "Arial", "Arial"],
  1184. ["arial black", "Arial Black", "Arial Black"],
  1185. ["arial narrow", "Arial Narrow", "Arial Narrow"],
  1186. ["Century", "Century", "Century"],
  1187. ["Comic Sans MS", "Comic Sans MS", "Comic Sans MS"],
  1188. ["Courier", "Courier", "Courier"],
  1189. ["cursive", "cursive", "cursive"],
  1190. ["fantasy", "fantasy", "fantasy"],
  1191. ["Impact", "Impact", "Impact"],
  1192. ["Meiryo", "Meiryo", "メイリオ"],
  1193. ["Meiryo UI", "Meiryo UI", "メイリオ UI"],
  1194. ["monospace", "monospace", "monospace"],
  1195. ["Monotype Corsiva", "Monotype Corsiva", "Monotype Corsiva"],
  1196. ["MS PGothic", "MS PGothic", "MS Pゴシック"],
  1197. ["MS Gothic", "MS Gothic", "MS ゴシック"],
  1198. ["MS Sans Serif", "MS Sans Serif", "MS Sans Serif"],
  1199. ["MS Serif", "MS Serif", "MS Serif"],
  1200. ["MS UI Gothic", "MS UI Gothic", "MS UI Gothic"],
  1201. ["sans-serif", "Sans-serif", "Sans-serif"],
  1202. ["serif", "Serif", "Serif"],
  1203. ["Times New Roman", "Times New Roman", "Times New Roman"],
  1204. ["Yu Gothic", "Yu Gothic", "遊ゴシック"],
  1205. ["YuGothic", "YuGothic", "游ゴシック体"],
  1206. ],
  1207. settingPanel = (flowChats, mainState, state, userConfig, mainLog) => {
  1208. var _a, _b
  1209. const panelState = {
  1210. bannedWordRegexs: userConfig.bannedWordRegexs.get(),
  1211. bannedWordRegexsValid: !0,
  1212. bannedWordRegexsError: "",
  1213. currentTab: 0,
  1214. timingStepCount: parseInt(
  1215. null !==
  1216. (_b =
  1217. null ===
  1218. (_a = userConfig.timingFunction
  1219. .get()
  1220. .match(/^steps\((\d+),.+/)) || void 0 === _a
  1221. ? void 0
  1222. : _a[1]) && void 0 !== _b
  1223. ? _b
  1224. : "150",
  1225. 10
  1226. ),
  1227. },
  1228. stepTiming = stepCount => `steps(${stepCount}, jump-end)`,
  1229. useStepTiming = () =>
  1230. Boolean(userConfig.timingFunction.get().match(/^steps\(.+/)),
  1231. panelBoxStyle = width => ({
  1232. flex: `0 0 ${width}px`,
  1233. margin: "2px",
  1234. }),
  1235. textAreaStyle = {
  1236. resize: "horizontal",
  1237. boxSizing: "border-box",
  1238. width: "100%",
  1239. },
  1240. textRecord = {
  1241. FYC_EN: {
  1242. font: "Font",
  1243. color: "Color(Normal)",
  1244. ownerColor: "Color(Owner)",
  1245. moderatorColor: "Color(Moderator)",
  1246. memberColor: "Color(Member)",
  1247. feedback: "Feedback",
  1248. eventLog: "Event log",
  1249. giveFeedback:
  1250. "Give your feedbacks here(Please attach the event log if they're bug related)",
  1251. chatOpacity: "Opacity",
  1252. fontSize: "Size",
  1253. fontWeight: "Weight",
  1254. shadowFontWeight: "Weight(Shadow)",
  1255. flowSpeed: "Speed",
  1256. maxChatCount: "Max number of chats",
  1257. maxChatLength: "Max number of characters",
  1258. laneCount: "Number of rows",
  1259. bannedWords: "Banned Words",
  1260. bannedWordRegexs: "Banned Words(Regex)",
  1261. bannedUsers: "Banned Users",
  1262. simplifyChatField: "Simplify",
  1263. createBanButton: "Show ban button",
  1264. displayModName: "Show moderator's name",
  1265. displaySuperChatAuthor: "Show super chat author",
  1266. createChats: "Display flowing chats",
  1267. textOnly: "Text only(ignore emojis)",
  1268. error: "Error",
  1269. video: "Video",
  1270. chatField: "Chat Window",
  1271. useStepTiming: "Move chat in steps",
  1272. timingStepCount: "└Step Count",
  1273. chatFilter: "Chat Filter",
  1274. flowChat: "Flow Chat",
  1275. clearFlowChats: "Clear Flowing Chats",
  1276. flowNewChatIf:
  1277. "A new chat will appear if all of the followings are met:",
  1278. noOverlap: "└Chats won't overlap",
  1279. minSpacing: "Min spacing between chats",
  1280. },
  1281. FYC_JA: {
  1282. font: "フォント",
  1283. color: "色(通常)",
  1284. ownerColor: "色(オーナー)",
  1285. moderatorColor: "色(モデレーター)",
  1286. memberColor: "色(メンバー)",
  1287. feedback: "バグ報告と要望",
  1288. eventLog: "イベントログ",
  1289. giveFeedback:
  1290. "バグ報告、要望はこちら(バグの場合は、イベントログを添付してください)",
  1291. chatOpacity: "不透明度",
  1292. fontSize: "サイズ",
  1293. fontWeight: "太さ",
  1294. shadowFontWeight: "太さ(影)",
  1295. flowSpeed: "速度",
  1296. maxChatCount: "最大表示数",
  1297. maxChatLength: "最大文字数",
  1298. laneCount: "行数",
  1299. bannedWords: "NGワード",
  1300. bannedWordRegexs: "NGワード(正規表現)",
  1301. bannedUsers: "NGユーザー",
  1302. simplifyChatField: "簡略化する",
  1303. createBanButton: "NGボタンを表示する",
  1304. displayModName: "モデレータの名前を表示する",
  1305. displaySuperChatAuthor: "スパチャの作成者を表示する",
  1306. createChats: "チャットを流す",
  1307. textOnly: "文字のみ(絵文字を無視する)",
  1308. error: "エラー",
  1309. video: "画面",
  1310. chatField: "チャット欄",
  1311. useStepTiming: "チャットを段階的に動かす",
  1312. timingStepCount: "└段階数",
  1313. chatFilter: "チャットフィルター",
  1314. flowChat: "チャット流れ",
  1315. clearFlowChats: "流れるチャットをクリアする",
  1316. flowNewChatIf:
  1317. "新しいチャットは以下のすべてを満たす場合に流れます:",
  1318. noOverlap: "└他のチャットと重ならない",
  1319. minSpacing: "チャットの最小間隔",
  1320. },
  1321. },
  1322. getLang = () => textRecord[userConfig.lang.get()],
  1323. ss = {
  1324. str: {
  1325. lang: new external_rxjs_namespaceObject.Subject(),
  1326. font: new external_rxjs_namespaceObject.Subject(),
  1327. color: new external_rxjs_namespaceObject.Subject(),
  1328. ownerColor: new external_rxjs_namespaceObject.Subject(),
  1329. moderatorColor: new external_rxjs_namespaceObject.Subject(),
  1330. memberColor: new external_rxjs_namespaceObject.Subject(),
  1331. },
  1332. num: {
  1333. chatOpacity: new external_rxjs_namespaceObject.Subject(),
  1334. fontSize: new external_rxjs_namespaceObject.Subject(),
  1335. fontWeight: new external_rxjs_namespaceObject.Subject(),
  1336. shadowFontWeight: new external_rxjs_namespaceObject.Subject(),
  1337. flowSpeed: new external_rxjs_namespaceObject.Subject(),
  1338. minSpacing: new external_rxjs_namespaceObject.Subject(),
  1339. },
  1340. int: {
  1341. maxChatCount: new external_rxjs_namespaceObject.Subject(),
  1342. maxChatLength: new external_rxjs_namespaceObject.Subject(),
  1343. laneCount: new external_rxjs_namespaceObject.Subject(),
  1344. },
  1345. tabChange: new external_rxjs_namespaceObject.Subject(),
  1346. bannedWords: new external_rxjs_namespaceObject.Subject(),
  1347. bannedWordRegexs: new external_rxjs_namespaceObject.Subject(),
  1348. bannedUsers: new external_rxjs_namespaceObject.Subject(),
  1349. bl: {
  1350. createChats: new external_rxjs_namespaceObject.Subject(),
  1351. textOnly: new external_rxjs_namespaceObject.Subject(),
  1352. displayModName: new external_rxjs_namespaceObject.Subject(),
  1353. displaySuperChatAuthor: new external_rxjs_namespaceObject.Subject(),
  1354. noOverlap: new external_rxjs_namespaceObject.Subject(),
  1355. simplifyChatField: new external_rxjs_namespaceObject.Subject(),
  1356. createBanButton: new external_rxjs_namespaceObject.Subject(),
  1357. },
  1358. useStepTiming: new external_rxjs_namespaceObject.Subject(),
  1359. timingStepCount: new external_rxjs_namespaceObject.Subject(),
  1360. clearFlowChats: new external_rxjs_namespaceObject.Subject(),
  1361. },
  1362. checkboxNode = label =>
  1363. checkboxRow(
  1364. getLang()[label],
  1365. userConfig[label].get(),
  1366. lib(ss.bl[label])
  1367. ),
  1368. textColorNode = label => {
  1369. return settingRow(getLang()[label], [
  1370. ((color = userConfig[label].get()),
  1371. (textStyle = {
  1372. fontFamily: userConfig.font.get(),
  1373. fontWeight: userConfig.fontWeight.get().toString(),
  1374. }),
  1375. (oninput = lib(ss.str[label])),
  1376. external_m_default()("div", [
  1377. external_m_default()("input", {
  1378. style: { width: "36px", verticalAlign: "middle" },
  1379. type: "color",
  1380. value: color,
  1381. oninput,
  1382. }),
  1383. external_m_default()("input", {
  1384. style: { verticalAlign: "middle" },
  1385. type: "text",
  1386. size: 8,
  1387. maxlength: 20,
  1388. value: color,
  1389. oninput,
  1390. }),
  1391. external_m_default()(
  1392. "span",
  1393. { style: { ...textStyle, color } },
  1394. "Aa1あア亜"
  1395. ),
  1396. ])),
  1397. ])
  1398. var color, textStyle, oninput
  1399. },
  1400. rangeNode = (label, streams, min, max, step) =>
  1401. settingRow(getLang()[label], [
  1402. rangeRow(
  1403. min,
  1404. max,
  1405. step,
  1406. userConfig[label].get(),
  1407. lib(streams[label])
  1408. ),
  1409. ]),
  1410. updateStringMacro = key => {
  1411. return (
  1412. (stream = ss.str[key]),
  1413. (configKey = key),
  1414. stream.pipe(
  1415. (0, external_rxjs_operators_namespaceObject.map)(
  1416. getInputValue
  1417. ),
  1418. (0, external_rxjs_operators_namespaceObject.tap)(x => {
  1419. userConfig[configKey].set(x)
  1420. })
  1421. )
  1422. )
  1423. var stream, configKey
  1424. },
  1425. updateNumberMacro = key => {
  1426. return (
  1427. (stream = ss.num[key]),
  1428. (configKey = key),
  1429. stream.pipe(
  1430. (0, external_rxjs_operators_namespaceObject.map)(
  1431. getInputValue
  1432. ),
  1433. (0, external_rxjs_operators_namespaceObject.map)(parseFloat),
  1434. (0, external_rxjs_operators_namespaceObject.tap)(x => {
  1435. userConfig[configKey].set(x)
  1436. })
  1437. )
  1438. )
  1439. var stream, configKey
  1440. },
  1441. updateIntMacro = key => {
  1442. return (
  1443. (stream = ss.int[key]),
  1444. (configKey = key),
  1445. stream.pipe(
  1446. (0, external_rxjs_operators_namespaceObject.map)(
  1447. getInputValue
  1448. ),
  1449. (0, external_rxjs_operators_namespaceObject.map)(x =>
  1450. parseInt(x, 10)
  1451. ),
  1452. (0, external_rxjs_operators_namespaceObject.tap)(x => {
  1453. userConfig[configKey].set(x)
  1454. })
  1455. )
  1456. )
  1457. var stream, configKey
  1458. },
  1459. updateBoolMacro = key => {
  1460. return (
  1461. (stream = ss.bl[key]),
  1462. (configKey = key),
  1463. stream.pipe(
  1464. (0, external_rxjs_operators_namespaceObject.map)(
  1465. getInputChecked
  1466. ),
  1467. (0, external_rxjs_operators_namespaceObject.tap)(x => {
  1468. userConfig[configKey].set(x)
  1469. })
  1470. )
  1471. )
  1472. var stream, configKey
  1473. }
  1474. return (
  1475. (0, external_rxjs_namespaceObject.merge)(
  1476. (0, external_rxjs_namespaceObject.merge)(
  1477. (0, external_rxjs_namespaceObject.merge)(
  1478. updateStringMacro("font"),
  1479. updateNumberMacro("fontSize"),
  1480. updateNumberMacro("fontWeight"),
  1481. updateIntMacro("laneCount"),
  1482. updateNumberMacro("minSpacing")
  1483. ).pipe(
  1484. (0, external_rxjs_operators_namespaceObject.mapTo)({
  1485. setStyle: !0,
  1486. setAnimation: !0,
  1487. })
  1488. ),
  1489. (0, external_rxjs_namespaceObject.merge)(
  1490. updateStringMacro("color"),
  1491. updateStringMacro("ownerColor"),
  1492. updateStringMacro("moderatorColor"),
  1493. updateStringMacro("memberColor"),
  1494. updateNumberMacro("chatOpacity"),
  1495. updateNumberMacro("shadowFontWeight")
  1496. ).pipe(
  1497. (0, external_rxjs_operators_namespaceObject.mapTo)({
  1498. setStyle: !0,
  1499. })
  1500. ),
  1501. (0, external_rxjs_namespaceObject.merge)(
  1502. updateNumberMacro("flowSpeed")
  1503. ).pipe(
  1504. (0, external_rxjs_operators_namespaceObject.mapTo)({
  1505. setPlayState: !0,
  1506. })
  1507. ),
  1508. (0, external_rxjs_namespaceObject.merge)(
  1509. updateIntMacro("maxChatCount").pipe(
  1510. (0, external_rxjs_operators_namespaceObject.tap)(x =>
  1511. removeOldChats(flowChats, x)
  1512. )
  1513. ),
  1514. updateBoolMacro("noOverlap"),
  1515. ss.useStepTiming.pipe(
  1516. (0, external_rxjs_operators_namespaceObject.map)(
  1517. getInputChecked
  1518. ),
  1519. (0, external_rxjs_operators_namespaceObject.tap)(x => {
  1520. userConfig.timingFunction.set(
  1521. x ? stepTiming(panelState.timingStepCount) : "linear"
  1522. )
  1523. })
  1524. ),
  1525. ss.timingStepCount.pipe(
  1526. (0, external_rxjs_operators_namespaceObject.map)(
  1527. getInputValue
  1528. ),
  1529. (0, external_rxjs_operators_namespaceObject.map)(x =>
  1530. parseInt(x, 10)
  1531. ),
  1532. (0, external_rxjs_operators_namespaceObject.tap)(x => {
  1533. ;(panelState.timingStepCount = x),
  1534. userConfig.timingFunction.set(stepTiming(x))
  1535. })
  1536. )
  1537. ).pipe(
  1538. (0, external_rxjs_operators_namespaceObject.mapTo)({
  1539. setAnimation: !0,
  1540. })
  1541. )
  1542. ).pipe(
  1543. (0, external_rxjs_operators_namespaceObject.throttleTime)(
  1544. 180,
  1545. void 0,
  1546. { leading: !0, trailing: !0 }
  1547. ),
  1548. (0, external_rxjs_operators_namespaceObject.tap)(x => {
  1549. flowChats
  1550. .filter(chat => !chat.animationEnded)
  1551. .forEach(chat => {
  1552. const config = {
  1553. setStyle: !1,
  1554. setAnimation: !1,
  1555. setPlayState: !1,
  1556. ...x,
  1557. }
  1558. config.setStyle &&
  1559. setChatStyle(chat, mainState, userConfig),
  1560. config.setAnimation
  1561. ? setChatAnimation(
  1562. chat,
  1563. flowChats,
  1564. mainState,
  1565. userConfig
  1566. )
  1567. : config.setPlayState &&
  1568. setChatPlayState(chat, mainState, userConfig)
  1569. })
  1570. })
  1571. ),
  1572. updateStringMacro("lang"),
  1573. ss.tabChange.pipe(
  1574. (0, external_rxjs_operators_namespaceObject.tap)(x => {
  1575. panelState.currentTab = x
  1576. })
  1577. ),
  1578. updateIntMacro("maxChatLength"),
  1579. updateBoolMacro("simplifyChatField"),
  1580. updateBoolMacro("createBanButton"),
  1581. updateBoolMacro("createChats"),
  1582. updateBoolMacro("displayModName"),
  1583. updateBoolMacro("displaySuperChatAuthor"),
  1584. updateBoolMacro("textOnly"),
  1585. ss.bannedWords.pipe(
  1586. (0, external_rxjs_operators_namespaceObject.map)(getInputValue),
  1587. (0, external_rxjs_operators_namespaceObject.map)(x =>
  1588. x.split(/\r\n|\n/).filter(word => "" !== word)
  1589. ),
  1590. (0, external_rxjs_operators_namespaceObject.tap)(x => {
  1591. userConfig.bannedWords.set(x)
  1592. })
  1593. ),
  1594. ss.bannedWordRegexs.pipe(
  1595. (0, external_rxjs_operators_namespaceObject.map)(getInputValue),
  1596. (0, external_rxjs_operators_namespaceObject.map)(x =>
  1597. x.split(/\r\n|\n/).filter(regex => "" !== regex)
  1598. ),
  1599. (0, external_rxjs_operators_namespaceObject.tap)(x => {
  1600. panelState.bannedWordRegexs = x
  1601. let valid = !0
  1602. ;(panelState.bannedWordRegexsError = ""),
  1603. panelState.bannedWordRegexs.forEach(regex => {
  1604. try {
  1605. RegExp(regex, "u")
  1606. } catch (error) {
  1607. mainLog("Invalid Regex", regex),
  1608. external_log_default().warn(error),
  1609. (panelState.bannedWordRegexsError += `${error} in ${regex};`),
  1610. (valid = !1)
  1611. }
  1612. }),
  1613. valid && userConfig.bannedWordRegexs.set(x),
  1614. (panelState.bannedWordRegexsValid = valid)
  1615. })
  1616. ),
  1617. ss.bannedUsers.pipe(
  1618. (0, external_rxjs_operators_namespaceObject.map)(getInputValue),
  1619. (0, external_rxjs_operators_namespaceObject.map)(x =>
  1620. x.split(/\r\n|\n/).filter(user => "" !== user)
  1621. ),
  1622. (0, external_rxjs_operators_namespaceObject.tap)(x => {
  1623. userConfig.bannedUsers.set(x)
  1624. })
  1625. ),
  1626. ss.clearFlowChats.pipe(
  1627. (0, external_rxjs_operators_namespaceObject.tap)(() =>
  1628. removeOldChats(flowChats, 0)
  1629. )
  1630. )
  1631. ).subscribe(),
  1632. {
  1633. view: () => {
  1634. return external_m_default()(
  1635. "div",
  1636. {
  1637. className: "fyc_panel",
  1638. style: {
  1639. visibility: state.showPanel ? "visible" : "hidden",
  1640. backgroundColor: "rgba(30,30,30,0.9)",
  1641. zIndex: 5,
  1642. position: "absolute",
  1643. bottom: "40px",
  1644. right: "0px",
  1645. color: "#fff",
  1646. fontSize: "14px",
  1647. width: "660px",
  1648. border: "solid 1px #666",
  1649. fontFamily: "MS PGothic",
  1650. },
  1651. },
  1652. [
  1653. external_m_default()(
  1654. "div",
  1655. { style: { float: "right", margin: "6px 6px 0 0" } },
  1656. [
  1657. "🌐",
  1658. external_m_default()(
  1659. "select",
  1660. {
  1661. selectedIndex: langOptions.findIndex(
  1662. x => x[0] === userConfig.lang.get()
  1663. ),
  1664. onchange: lib(ss.str.lang),
  1665. },
  1666. langOptions.map(x => settingPanel_option(...x))
  1667. ),
  1668. ]
  1669. ),
  1670. ((style = {
  1671. container: { height: "364px" },
  1672. label: { padding: "6px" },
  1673. labelFocus: { background: "#666" },
  1674. tab: { display: "flex", padding: "6px" },
  1675. }),
  1676. (labels = [
  1677. getLang().flowChat,
  1678. getLang().chatFilter,
  1679. getLang().chatField,
  1680. getLang().feedback,
  1681. ]),
  1682. (tabs = [
  1683. [
  1684. external_m_default()(
  1685. "div",
  1686. { style: panelBoxStyle(212) },
  1687. [
  1688. settingRow(getLang().font, [
  1689. external_m_default()(
  1690. "select",
  1691. {
  1692. style: { width: "60%" },
  1693. selectedIndex: fontOptions.findIndex(
  1694. x => x[0] === userConfig.font.get()
  1695. ),
  1696. onchange: lib(ss.str.font),
  1697. },
  1698. fontOptions.map(x =>
  1699. settingPanel_option(
  1700. x[0],
  1701. "FYC_JA" === userConfig.lang.get()
  1702. ? x[2]
  1703. : x[1]
  1704. )
  1705. )
  1706. ),
  1707. ]),
  1708. textColorNode("color"),
  1709. textColorNode("ownerColor"),
  1710. textColorNode("moderatorColor"),
  1711. textColorNode("memberColor"),
  1712. ]
  1713. ),
  1714. external_m_default()(
  1715. "div",
  1716. { style: panelBoxStyle(212) },
  1717. [
  1718. rangeNode("chatOpacity", ss.num, 0, 1, 0.05),
  1719. rangeNode("fontSize", ss.num, 0.3, 2, 0.05),
  1720. rangeNode("fontWeight", ss.num, 10, 1e3, 10),
  1721. rangeNode("shadowFontWeight", ss.num, 0, 3, 0.1),
  1722. rangeNode("flowSpeed", ss.num, 1, 50, 1),
  1723. rangeNode("maxChatCount", ss.int, 5, 200, 5),
  1724. rangeNode("maxChatLength", ss.int, 5, 200, 5),
  1725. rangeNode("laneCount", ss.int, 1, 25, 1),
  1726. ]
  1727. ),
  1728. external_m_default()(
  1729. "div",
  1730. { style: panelBoxStyle(212) },
  1731. [
  1732. rangeNode("minSpacing", ss.num, 0, 2.5, 0.1),
  1733. checkboxRow(
  1734. getLang().useStepTiming,
  1735. useStepTiming(),
  1736. lib(ss.useStepTiming)
  1737. ),
  1738. external_m_default()(
  1739. "div",
  1740. {
  1741. style: {
  1742. ...(useStepTiming()
  1743. ? {}
  1744. : { opacity: "0.5" }),
  1745. },
  1746. },
  1747. settingRow(getLang().timingStepCount, [
  1748. rangeRow(
  1749. 1,
  1750. 400,
  1751. 1,
  1752. panelState.timingStepCount,
  1753. lib(ss.timingStepCount)
  1754. ),
  1755. ])
  1756. ),
  1757. checkboxNode("createChats"),
  1758. checkboxNode("displayModName"),
  1759. checkboxNode("displaySuperChatAuthor"),
  1760. checkboxNode("textOnly"),
  1761. external_m_default()(
  1762. "span",
  1763. getLang().flowNewChatIf
  1764. ),
  1765. checkboxNode("noOverlap"),
  1766. external_m_default()(
  1767. "button",
  1768. {
  1769. type: "button",
  1770. onclick: lib(ss.clearFlowChats),
  1771. },
  1772. getLang().clearFlowChats
  1773. ),
  1774. ]
  1775. ),
  1776. ],
  1777. [
  1778. external_m_default()(
  1779. "div",
  1780. { style: panelBoxStyle(212) },
  1781. [
  1782. settingRow(getLang().bannedWords, [
  1783. external_m_default()(
  1784. "textarea",
  1785. {
  1786. rows: 18,
  1787. style: textAreaStyle,
  1788. onchange: lib(ss.bannedWords),
  1789. },
  1790. userConfig.bannedWords.get().join("\n")
  1791. ),
  1792. ]),
  1793. ]
  1794. ),
  1795. external_m_default()(
  1796. "div",
  1797. { style: panelBoxStyle(212) },
  1798. [
  1799. settingRow(getLang().bannedWordRegexs, [
  1800. external_m_default()(
  1801. "span",
  1802. panelState.bannedWordRegexsValid
  1803. ? ""
  1804. : `${getLang().error}: ${
  1805. panelState.bannedWordRegexsError
  1806. }`
  1807. ),
  1808. external_m_default()(
  1809. "textarea",
  1810. {
  1811. rows: 18,
  1812. style: textAreaStyle,
  1813. onchange: lib(ss.bannedWordRegexs),
  1814. },
  1815. panelState.bannedWordRegexs.join("\n")
  1816. ),
  1817. ]),
  1818. ]
  1819. ),
  1820. external_m_default()(
  1821. "div",
  1822. { style: panelBoxStyle(212) },
  1823. [
  1824. settingRow(getLang().bannedUsers, [
  1825. external_m_default()(
  1826. "textarea",
  1827. {
  1828. rows: 18,
  1829. style: textAreaStyle,
  1830. onchange: lib(ss.bannedUsers),
  1831. },
  1832. userConfig.bannedUsers.get().join("\n")
  1833. ),
  1834. ]),
  1835. ]
  1836. ),
  1837. ],
  1838. [
  1839. external_m_default()(
  1840. "div",
  1841. { style: panelBoxStyle(644) },
  1842. [
  1843. checkboxNode("simplifyChatField"),
  1844. checkboxNode("createBanButton"),
  1845. ]
  1846. ),
  1847. ],
  1848. [
  1849. external_m_default()(
  1850. "div",
  1851. { style: panelBoxStyle(644) },
  1852. [
  1853. external_m_default()(
  1854. "div",
  1855. { style: { float: "right" } },
  1856. external_m_default()(
  1857. "a",
  1858. {
  1859. style: { color: "#f0f" },
  1860. href:
  1861. "https://gf.qytechs.cn/en/scripts/411442-flow-youtube-chat/feedback",
  1862. target: "_blank",
  1863. },
  1864. getLang().giveFeedback
  1865. )
  1866. ),
  1867. settingRow(getLang().eventLog, [
  1868. external_m_default()(
  1869. "textarea",
  1870. {
  1871. rows: 18,
  1872. style: textAreaStyle,
  1873. readOnly: !0,
  1874. onclick: () => {},
  1875. },
  1876. mainState.log
  1877. ),
  1878. ]),
  1879. ]
  1880. ),
  1881. ],
  1882. ]),
  1883. (currentTab = panelState.currentTab),
  1884. (ontabSelect = lib(ss.tabChange)),
  1885. external_m_default()("div", [
  1886. external_m_default()(
  1887. "div",
  1888. ...labels.map((x, i) =>
  1889. external_m_default()(
  1890. "span",
  1891. {
  1892. style: {
  1893. ...style.label,
  1894. ...(currentTab === i ? style.labelFocus : {}),
  1895. display: "inline-block",
  1896. },
  1897. onclick: () => ontabSelect(i),
  1898. },
  1899. x
  1900. )
  1901. )
  1902. ),
  1903. external_m_default()(
  1904. "div",
  1905. {
  1906. style: {
  1907. ...style.container,
  1908. overflow: "hidden auto",
  1909. },
  1910. },
  1911. ...tabs.map((x, i) => {
  1912. var _a
  1913. return external_m_default()(
  1914. "div",
  1915. {
  1916. style: {
  1917. ...style.tab,
  1918. display:
  1919. i === currentTab
  1920. ? null !== (_a = style.tab.display) &&
  1921. void 0 !== _a
  1922. ? _a
  1923. : "block"
  1924. : "none",
  1925. },
  1926. },
  1927. x
  1928. )
  1929. })
  1930. ),
  1931. ])),
  1932. ]
  1933. )
  1934. var style, labels, tabs, currentTab, ontabSelect
  1935. },
  1936. }
  1937. )
  1938. },
  1939. settingComponent = (flowChats, mainState, userConfig, mainLog) => {
  1940. const state = { showPanel: !1 },
  1941. panel = settingPanel(
  1942. flowChats,
  1943. mainState,
  1944. state,
  1945. userConfig,
  1946. mainLog
  1947. ),
  1948. toggleButton = ((state, userConfig) => {
  1949. const click$ = new external_rxjs_namespaceObject.Subject()
  1950. return (
  1951. click$
  1952. .pipe(
  1953. (0, external_rxjs_operators_namespaceObject.tap)(() => {
  1954. state.showPanel = !state.showPanel
  1955. })
  1956. )
  1957. .subscribe(),
  1958. {
  1959. view: () =>
  1960. external_m_default()(
  1961. "button",
  1962. {
  1963. className: "fyc_button",
  1964. style: {
  1965. background: "rgba(0,0,0,0)",
  1966. marginLeft: "10px",
  1967. whiteSpace: "nowrap",
  1968. },
  1969. onclick: lib(click$),
  1970. },
  1971. [
  1972. external_m_default()(
  1973. "svg",
  1974. {
  1975. preserveAspectRatio: "xMidYMid meet",
  1976. viewBox: "0 0 640 640",
  1977. width: "15",
  1978. height: "15",
  1979. style: { position: "relative", top: "1px" },
  1980. },
  1981. [
  1982. external_m_default()(
  1983. "defs",
  1984. external_m_default()("path", {
  1985. id: "d1TbzTC1zI",
  1986. d:
  1987. "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",
  1988. })
  1989. ),
  1990. external_m_default()("use", {
  1991. "xlink:href": "#d1TbzTC1zI",
  1992. opacity: "1",
  1993. fill: "var(--iron-icon-fill-color, currentcolor)",
  1994. "fill-opacity": "1",
  1995. }),
  1996. ]
  1997. ),
  1998. external_m_default()(
  1999. "span",
  2000. {
  2001. style: {
  2002. position: "relative",
  2003. top: "-2px",
  2004. marginLeft: "8px,",
  2005. },
  2006. },
  2007. "FYC_JA" === userConfig.lang.get()
  2008. ? "設定"
  2009. : "Settings"
  2010. ),
  2011. ]
  2012. ),
  2013. }
  2014. )
  2015. })(state, userConfig)
  2016. return {
  2017. view: () => [
  2018. external_m_default()(panel),
  2019. external_m_default()(toggleButton),
  2020. ],
  2021. }
  2022. },
  2023. videoToggleStream = video =>
  2024. (0, external_rxjs_namespaceObject.merge)(
  2025. (0, external_rxjs_namespaceObject.fromEvent)(video, "playing").pipe(
  2026. (0, external_rxjs_operators_namespaceObject.mapTo)(!0)
  2027. ),
  2028. (0, external_rxjs_namespaceObject.fromEvent)(video, "waiting").pipe(
  2029. (0, external_rxjs_operators_namespaceObject.mapTo)(!1)
  2030. ),
  2031. (0, external_rxjs_namespaceObject.fromEvent)(video, "pause").pipe(
  2032. (0, external_rxjs_operators_namespaceObject.mapTo)(!1)
  2033. )
  2034. ),
  2035. requirementMet = () =>
  2036. Boolean(
  2037. livePage_getChatFrame() &&
  2038. livePage_getChatField() &&
  2039. livePage_getPlayer()
  2040. ),
  2041. initialize = async (mainState, mainLog) => {
  2042. const consoleLog = (a, ...b) => {
  2043. mainLog(a, ...b),
  2044. external_log_default().info(`【FYC ${a}`),
  2045. b.length > 0 && external_log_default().info(...b)
  2046. }
  2047. mainLog("Version", package_namespaceObject_i8),
  2048. mainLog("User Agent", window.navigator.userAgent)
  2049. const userConfig = await (async () => ({
  2050. lang: await simpleConfigItem("FYC_LANG", "FYC_EN"),
  2051. font: await simpleConfigItem("FYC_FONT", "MS PGothic"),
  2052. chatOpacity: await simpleConfigItem("FYC_OPACITY", 0.8),
  2053. color: await simpleConfigItem("FYC_COLOR", "#ffffff"),
  2054. ownerColor: await simpleConfigItem("FYC_COLOR_OWNER", "#ffd600"),
  2055. moderatorColor: await simpleConfigItem(
  2056. "FYC_COLOR_MODERATOR",
  2057. "#a74fff"
  2058. ),
  2059. memberColor: await simpleConfigItem("FYC_COLOR_MEMBER", "#9fffff"),
  2060. fontSize: await simpleConfigItem("FYC_SIZE", 1),
  2061. fontWeight: await simpleConfigItem("FYC_WEIGHT", 730),
  2062. shadowFontWeight: await simpleConfigItem("FYC_WEIGHT_SHADOW", 1),
  2063. maxChatCount: await simpleConfigItem("FYC_LIMIT", 40),
  2064. flowSpeed: await simpleConfigItem("FYC_SPEED", 18),
  2065. maxChatLength: await simpleConfigItem("FYC_MAX", 100),
  2066. laneCount: await simpleConfigItem("FYC_LANE_DIV", 12),
  2067. bannedWords: await makeConfigItem(
  2068. "FYC_NG_WORDS",
  2069. ...lineConfigArgs
  2070. ),
  2071. bannedWordRegexs: await makeConfigItem(
  2072. "FYC_NG_REG_WORDS",
  2073. ...lineConfigArgs
  2074. ),
  2075. bannedUsers: await makeConfigItem(
  2076. "FYC_NG_USERS",
  2077. ...lineConfigArgs
  2078. ),
  2079. createChats: await simpleConfigItem(
  2080. "FYC_TOGGLE_CREATE_COMMENTS",
  2081. !0
  2082. ),
  2083. noOverlap: await simpleConfigItem("FYC_NO_OVERLAP", !0),
  2084. createBanButton: await simpleConfigItem("FYC_NG_BUTTON", !0),
  2085. simplifyChatField: await simpleConfigItem(
  2086. "FYC_SIMPLE_CHAT_FIELD",
  2087. !1
  2088. ),
  2089. displayModName: await simpleConfigItem(
  2090. "FYC_DISPLAY_MODERATOR_NAME",
  2091. !0
  2092. ),
  2093. displaySuperChatAuthor: await simpleConfigItem(
  2094. "FYC_DISPLAY_SUPER_CHAT_AUTHOR",
  2095. !0
  2096. ),
  2097. textOnly: await simpleConfigItem("FYC_TEXT_ONLY", !1),
  2098. timingFunction: await simpleConfigItem(
  2099. "FYC_TIMING_FUNCTION",
  2100. "linear"
  2101. ),
  2102. displayChats: await simpleConfigItem("FYC_DISPLAY_COMMENTS", !0),
  2103. minSpacing: await simpleConfigItem("FYC_MIN_SPACING", 0.5),
  2104. }))()
  2105. mainLog("UserConfig", JSON.stringify(userConfig))
  2106. const reinitSubject = new external_rxjs_namespaceObject.Subject(),
  2107. reinitialize = lib(reinitSubject),
  2108. chatScrn = (() => {
  2109. const element = document.createElement("div")
  2110. return (
  2111. (element.style.pointerEvents = "none"),
  2112. (element.style.zIndex = "30"),
  2113. element
  2114. )
  2115. })(),
  2116. flowChats = []
  2117. let chatField,
  2118. video,
  2119. player,
  2120. storedHref = window.location.href
  2121. new MutationObserver(async () => {
  2122. storedHref !== window.location.href &&
  2123. ((storedHref = window.location.href),
  2124. consoleLog("URL Changed", storedHref),
  2125. await reinitialize())
  2126. }).observe(document, { childList: !0, subtree: !0 })
  2127. const chatObserver = chatFieldObserver(
  2128. chatScrn,
  2129. flowChats,
  2130. mainState,
  2131. userConfig,
  2132. mainLog
  2133. ),
  2134. playerResizeSubject = new external_rxjs_namespaceObject.Subject(),
  2135. playerResizeObserver = new ResizeObserver(lib(playerResizeSubject)),
  2136. toggleChatBtn = ((flowChats, userConfig) => {
  2137. const click$ = new external_rxjs_namespaceObject.Subject()
  2138. click$
  2139. .pipe(
  2140. (0, external_rxjs_operators_namespaceObject.tap)(() => {
  2141. const newDisplay = !userConfig.displayChats.get()
  2142. flowChats.forEach(x => {
  2143. x.element.style.visibility = newDisplay
  2144. ? "visible"
  2145. : "hidden"
  2146. }),
  2147. userConfig.displayChats.set(newDisplay),
  2148. GM.setValue("FYC_DISPLAY_COMMENTS", newDisplay)
  2149. })
  2150. )
  2151. .subscribe()
  2152. const label = () =>
  2153. "チャット" + (userConfig.displayChats.get() ? "非表示" : "表示")
  2154. return {
  2155. view: () =>
  2156. external_m_default()(
  2157. "button",
  2158. {
  2159. className: ["ytp-button"].join(" "),
  2160. style: {
  2161. background: "none",
  2162. border: "none",
  2163. cursor: "pointer",
  2164. float: "left",
  2165. fontSize: "1em",
  2166. height: "4em",
  2167. outline: "none",
  2168. overflow: "visible",
  2169. padding: "0 0 0em",
  2170. position: "relative",
  2171. width: "3em",
  2172. },
  2173. type: "button",
  2174. "aria-label": label(),
  2175. title: label(),
  2176. onclick: lib(click$),
  2177. },
  2178. [
  2179. external_m_default()(
  2180. "svg",
  2181. { style: { width: "100%" }, viewBox: "0 0 36 36" },
  2182. [
  2183. external_m_default()("path", {
  2184. className: ["chat-button-path"].join(" "),
  2185. d:
  2186. "m11 12h17q1 0 1 1v9q0 1-1 1h-1v2l-4-2h-12q-1 0-1-1v-9q0-1 1-1z",
  2187. fill: "#fff",
  2188. "fill-opacity": userConfig.displayChats.get()
  2189. ? "1"
  2190. : "0",
  2191. stroke: "#fff",
  2192. "stroke-width": "2",
  2193. }),
  2194. ]
  2195. ),
  2196. ]
  2197. ),
  2198. }
  2199. })(flowChats, userConfig),
  2200. mountToggleChatBtn = componentMounter(
  2201. document.createElement("span"),
  2202. x => {
  2203. const parent = document.querySelector(".ytp-right-controls")
  2204. return parent && parent.append(x), Boolean(parent)
  2205. }
  2206. ),
  2207. settingComp = settingComponent(
  2208. flowChats,
  2209. mainState,
  2210. userConfig,
  2211. mainLog
  2212. ),
  2213. mountSettingComp = componentMounter(
  2214. document.createElement("span"),
  2215. x => {
  2216. const parent = document.querySelector(
  2217. "#menu-container .dropdown-trigger.style-scope.ytd-menu-renderer"
  2218. )
  2219. return (
  2220. parent && parent.insertAdjacentElement("beforebegin", x),
  2221. Boolean(parent)
  2222. )
  2223. }
  2224. )
  2225. external_log_default().debug("Append ToggleChatDisplayButton")
  2226. reinitSubject
  2227. .pipe(
  2228. (0, external_rxjs_operators_namespaceObject.observeOn)(
  2229. external_rxjs_namespaceObject.asyncScheduler
  2230. ),
  2231. (0, external_rxjs_operators_namespaceObject.switchMap)(() =>
  2232. (0, external_rxjs_namespaceObject.interval)(800).pipe(
  2233. (0, external_rxjs_operators_namespaceObject.startWith)(0),
  2234. (0, external_rxjs_operators_namespaceObject.map)(
  2235. requirementMet
  2236. ),
  2237. (0, external_rxjs_operators_namespaceObject.filter)(() => {
  2238. var _a, _b, _c, _d, _e, _f
  2239. const chatFieldDetached =
  2240. null !==
  2241. (_d =
  2242. chatField &&
  2243. !(
  2244. null !==
  2245. (_c =
  2246. null ===
  2247. (_b =
  2248. null === (_a = livePage_getChatFrame()) ||
  2249. void 0 === _a
  2250. ? void 0
  2251. : _a.contentDocument) || void 0 === _b
  2252. ? void 0
  2253. : _b.contains(chatField)) &&
  2254. void 0 !== _c &&
  2255. _c
  2256. ) &&
  2257. !document.contains(chatField)) &&
  2258. void 0 !== _d &&
  2259. _d,
  2260. logDetached = x => consoleLog(`${x} detached...`)
  2261. chatFieldDetached &&
  2262. (logDetached("Chat field"), (chatField = void 0))
  2263. const videoDetached =
  2264. null !== (_e = video && !document.contains(video)) &&
  2265. void 0 !== _e &&
  2266. _e
  2267. videoDetached &&
  2268. (logDetached("Video"),
  2269. (video = void 0),
  2270. (mainState.chatPlaying = Boolean(
  2271. livePage_getOfflineSlate()
  2272. )))
  2273. const playerDetached =
  2274. null !== (_f = player && !document.contains(player)) &&
  2275. void 0 !== _f &&
  2276. _f
  2277. playerDetached && (logDetached("Player"), (player = void 0))
  2278. const detached =
  2279. chatFieldDetached || videoDetached || playerDetached
  2280. return detached && reinitialize(), !detached
  2281. }),
  2282. (0, external_rxjs_operators_namespaceObject.startWith)(!1),
  2283. (0,
  2284. external_rxjs_operators_namespaceObject.distinctUntilChanged)(),
  2285. (0, external_rxjs_operators_namespaceObject.tap)(x =>
  2286. consoleLog(
  2287. x
  2288. ? "Found the chat container and the player"
  2289. : "Waiting to load..."
  2290. )
  2291. ),
  2292. (0, external_rxjs_operators_namespaceObject.filter)(Boolean)
  2293. )
  2294. ),
  2295. (0, external_rxjs_operators_namespaceObject.tap)(addMainCss),
  2296. (0, external_rxjs_operators_namespaceObject.tap)(() =>
  2297. mountSettingComp(settingComp)
  2298. ),
  2299. (0, external_rxjs_operators_namespaceObject.tap)(() =>
  2300. consoleLog("Wait for 2200ms...")
  2301. ),
  2302. (0, external_rxjs_operators_namespaceObject.delay)(2200),
  2303. (0, external_rxjs_operators_namespaceObject.tap)(() =>
  2304. consoleLog("Initializing...")
  2305. ),
  2306. (0, external_rxjs_operators_namespaceObject.tap)(() => {
  2307. removeOldChats(flowChats, 0),
  2308. chatObserver.disconnect(),
  2309. (chatField = livePage_getChatField()),
  2310. chatField &&
  2311. chatObserver.observe(chatField, { childList: !0 }),
  2312. (video = livePage_getMainVideo()),
  2313. video &&
  2314. (mainState.chatPlaying =
  2315. !video.paused || Boolean(livePage_getOfflineSlate())),
  2316. playerResizeObserver.disconnect(),
  2317. (player = livePage_getPlayer()),
  2318. player &&
  2319. (external_log_default().debug("AppendChatScreen"),
  2320. playerResizeObserver.observe(player),
  2321. player.insertAdjacentElement("afterbegin", chatScrn)),
  2322. mountToggleChatBtn(toggleChatBtn),
  2323. (chatField && video && player) || reinitialize()
  2324. }),
  2325. (0, external_rxjs_operators_namespaceObject.switchMap)(() =>
  2326. setChatFrameCss(mainLog)
  2327. ),
  2328. (0, external_rxjs_operators_namespaceObject.switchMap)(() =>
  2329. (0, external_rxjs_namespaceObject.merge)(
  2330. ...(video
  2331. ? [
  2332. videoToggleStream(video).pipe(
  2333. (0, external_rxjs_operators_namespaceObject.map)(
  2334. playing =>
  2335. playing || Boolean(livePage_getOfflineSlate())
  2336. ),
  2337. (0, external_rxjs_operators_namespaceObject.tap)(
  2338. chatPlaying => {
  2339. ;(mainState.chatPlaying = chatPlaying),
  2340. flowChats.forEach(chat => {
  2341. setChatPlayState(chat, mainState, userConfig)
  2342. })
  2343. }
  2344. )
  2345. ),
  2346. ]
  2347. : []),
  2348. playerResizeSubject.pipe(
  2349. (0,
  2350. external_rxjs_operators_namespaceObject.throttleTime)(
  2351. 500,
  2352. void 0,
  2353. { leading: !0, trailing: !0 }
  2354. ),
  2355. (0, external_rxjs_operators_namespaceObject.startWith)([]),
  2356. (0, external_rxjs_operators_namespaceObject.tap)(() => {
  2357. var _a
  2358. consoleLog("Resize detected"),
  2359. (mainState.playerRect =
  2360. null !==
  2361. (_a =
  2362. null == player
  2363. ? void 0
  2364. : player.getBoundingClientRect()) &&
  2365. void 0 !== _a
  2366. ? _a
  2367. : new DOMRect()),
  2368. flowChats.forEach(chat => {
  2369. setChatStyle(chat, mainState, userConfig),
  2370. setChatAnimation(
  2371. chat,
  2372. flowChats,
  2373. mainState,
  2374. userConfig
  2375. )
  2376. })
  2377. })
  2378. )
  2379. )
  2380. ),
  2381. (0, external_rxjs_operators_namespaceObject.retryWhen)(x =>
  2382. x.pipe(
  2383. (0, external_rxjs_operators_namespaceObject.tap)(y =>
  2384. consoleLog("Errored", y)
  2385. )
  2386. )
  2387. )
  2388. )
  2389. .subscribe(),
  2390. await reinitialize()
  2391. }
  2392. ;(async () => {
  2393. external_log_namespaceObject.setLevel("info")
  2394. const mainState = {
  2395. chatPlaying: !0,
  2396. playerRect: new DOMRect(24, 80, 839, 472),
  2397. log: "",
  2398. },
  2399. mainLog = (mainState => (a, ...b) => {
  2400. ;(mainState.log += `${a}${b.length > 0 ? ": " : ""}${b.join(
  2401. ", "
  2402. )}\n`),
  2403. mainState.log.length > 22e3 &&
  2404. (mainState.log = `${mainState.log.slice(0, 6e3)}\n`)
  2405. })(mainState)
  2406. try {
  2407. await initialize(mainState, mainLog)
  2408. } catch (error) {
  2409. mainLog("Errored", error)
  2410. }
  2411. })()
  2412. })()
  2413. })()

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址