Flow Youtube Chat

Youtubeのチャットをニコニコ風に画面上へ流す(再アップ) Make youtube chats move in danmaku-style.

当前为 2022-11-01 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Flow Youtube Chat
  3. // @version 1.15.13
  4. // @description Youtubeのチャットをニコニコ風に画面上へ流す(再アップ) Make youtube chats move in danmaku-style.
  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. // @grant GM.setClipboard
  13. // @noframes
  14. // @license AGPL-3.0-or-later
  15. // @require https://cdn.jsdelivr.net/npm/sweetalert2@11.4.29/dist/sweetalert2.all.min.js#sha384-oOcVIFjLmJbkImF/OMv4gZHmkUcQAiX1EJZt7C9siwnS9yGghuo22mPgX7a623rc
  16. // @require https://unpkg.com/loglevel@1.8.0/dist/loglevel.min.js#sha384-xnEzWQtTztbu/yV2BtSvqqZGP52iLXbnb4NJ59OYT0ZDo1fGaKCR6QBxjyRuNFJ8
  17. // @require https://unpkg.com/rxjs@7.5.6/dist/bundles/rxjs.umd.min.js#sha384-loWwI45AmzSZ93ze6KW4+6eZVsQT8PriLOVCZGZstdycw5uylV3xKkHLQh53ui6b
  18. // @require https://unpkg.com/mithril@2.2.2/mithril.min.js#sha384-60kek02kUAH+DNSgj7HCtrpcirTroG3uWnDpsdvoAl2Z9Xe3GdpXDSy4ouNMHoBZ
  19. // @require https://cdn.jsdelivr.net/npm/check-types@11.1.2/src/check-types.min.js#sha384-KGnImnhVjA5llfqKEbjBiY+1Mp6oa+NvW/TEY1XTPAKWNgrAwa3Qvn//MXL07wBM
  20. // @require https://cdn.jsdelivr.net/npm/deep-diff@1.0.2/index.min.js#sha384-Q/uiWfFlwn9XjOpL49VpFKn01EkScmaC3hh1prAn7S++WoZgXRrrjQvZ7cI7C7Zn
  21. // @require https://cdn.jsdelivr.net/npm/astring@1.8.3/dist/astring.min.js#sha384-5Ucbdr4B4nO60a/3Lv4z9adjzcDkpVPH19acFTr320dXMe+cKE5y5zV+gycjJO8N
  22. // @require https://cdn.jsdelivr.net/npm/jsep@1.3.6/dist/iife/jsep.iife.min.js#sha384-6PGvkKayYZDccXp2sQ43aTf44oUNudO3L940VBGQYHfhg3YZEgSEbuannHJk7NBe
  23. // @require https://cdn.jsdelivr.net/npm/hash-it@5.0.2/dist/hash-it.min.js#sha384-biRMep0zr/5fw/hIdnBIb56UHRgiIyhAagZrngd9dSxxQ9aDFMP0hbYR8PEj5lVu
  24. // @require https://cdn.jsdelivr.net/npm/micro-memoize@4.0.11/dist/micro-memoize.min.js#sha384-3VwqC1DvF4pyT2nI/Y2hvIoGqAwEYFLImjifWlsBHhIuISG0a28JYU7K9g3c7wI9
  25. // ==/UserScript==
  26.  
  27. /* jshint esversion: 6 */
  28.  
  29. ;(() => {
  30. var __webpack_modules__ = {
  31. 661: module => {
  32. module.exports = !1
  33. },
  34. 204: module => {
  35. "use strict"
  36. module.exports = function equal(a, b) {
  37. if (a === b) return !0
  38. if (a && b && "object" == typeof a && "object" == typeof b) {
  39. if (a.constructor !== b.constructor) return !1
  40. var length, i, keys
  41. if (Array.isArray(a)) {
  42. if ((length = a.length) != b.length) return !1
  43. for (i = length; 0 != i--; ) if (!equal(a[i], b[i])) return !1
  44. return !0
  45. }
  46. if (a.constructor === RegExp)
  47. return a.source === b.source && a.flags === b.flags
  48. if (a.valueOf !== Object.prototype.valueOf)
  49. return a.valueOf() === b.valueOf()
  50. if (a.toString !== Object.prototype.toString)
  51. return a.toString() === b.toString()
  52. if (
  53. (length = (keys = Object.keys(a)).length) !==
  54. Object.keys(b).length
  55. )
  56. return !1
  57. for (i = length; 0 != i--; )
  58. if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return !1
  59. for (i = length; 0 != i--; ) {
  60. var key = keys[i]
  61. if (!equal(a[key], b[key])) return !1
  62. }
  63. return !0
  64. }
  65. return a != a && b != b
  66. }
  67. },
  68. 90: module => {
  69. module.exports = (function (e) {
  70. var r = {}
  71. function n(t) {
  72. if (r[t]) return r[t].exports
  73. var a = (r[t] = { i: t, l: !1, exports: {} })
  74. return e[t].call(a.exports, a, a.exports, n), (a.l = !0), a.exports
  75. }
  76. return (
  77. (n.m = e),
  78. (n.c = r),
  79. (n.d = function (e, r, t) {
  80. n.o(e, r) ||
  81. Object.defineProperty(e, r, { enumerable: !0, get: t })
  82. }),
  83. (n.r = function (e) {
  84. "undefined" != typeof Symbol &&
  85. Symbol.toStringTag &&
  86. Object.defineProperty(e, Symbol.toStringTag, {
  87. value: "Module",
  88. }),
  89. Object.defineProperty(e, "__esModule", { value: !0 })
  90. }),
  91. (n.t = function (e, r) {
  92. if ((1 & r && (e = n(e)), 8 & r)) return e
  93. if (4 & r && "object" == typeof e && e && e.__esModule) return e
  94. var t = Object.create(null)
  95. if (
  96. (n.r(t),
  97. Object.defineProperty(t, "default", {
  98. enumerable: !0,
  99. value: e,
  100. }),
  101. 2 & r && "string" != typeof e)
  102. )
  103. for (var a in e)
  104. n.d(
  105. t,
  106. a,
  107. function (r) {
  108. return e[r]
  109. }.bind(null, a)
  110. )
  111. return t
  112. }),
  113. (n.n = function (e) {
  114. var r =
  115. e && e.__esModule
  116. ? function () {
  117. return e.default
  118. }
  119. : function () {
  120. return e
  121. }
  122. return n.d(r, "a", r), r
  123. }),
  124. (n.o = function (e, r) {
  125. return Object.prototype.hasOwnProperty.call(e, r)
  126. }),
  127. (n.p = ""),
  128. n((n.s = 0))
  129. )
  130. })([
  131. function (e, r, n) {
  132. "use strict"
  133. n.r(r),
  134. n.d(r, "validateHTMLColorName", function () {
  135. return l
  136. }),
  137. n.d(r, "validateHTMLColorSpecialName", function () {
  138. return i
  139. }),
  140. n.d(r, "validateHTMLColorHex", function () {
  141. return u
  142. }),
  143. n.d(r, "validateHTMLColorRgb", function () {
  144. return d
  145. }),
  146. n.d(r, "validateHTMLColorHsl", function () {
  147. return f
  148. }),
  149. n.d(r, "validateHTMLColorHwb", function () {
  150. return h
  151. }),
  152. n.d(r, "validateHTMLColorLab", function () {
  153. return g
  154. }),
  155. n.d(r, "validateHTMLColor", function () {
  156. return m
  157. })
  158. const t = e => e && "string" == typeof e,
  159. a = [
  160. "AliceBlue",
  161. "AntiqueWhite",
  162. "Aqua",
  163. "Aquamarine",
  164. "Azure",
  165. "Beige",
  166. "Bisque",
  167. "Black",
  168. "BlanchedAlmond",
  169. "Blue",
  170. "BlueViolet",
  171. "Brown",
  172. "BurlyWood",
  173. "CadetBlue",
  174. "Chartreuse",
  175. "Chocolate",
  176. "Coral",
  177. "CornflowerBlue",
  178. "Cornsilk",
  179. "Crimson",
  180. "Cyan",
  181. "DarkBlue",
  182. "DarkCyan",
  183. "DarkGoldenrod",
  184. "DarkGray",
  185. "DarkGreen",
  186. "DarkKhaki",
  187. "DarkMagenta",
  188. "DarkOliveGreen",
  189. "DarkOrange",
  190. "DarkOrchid",
  191. "DarkRed",
  192. "DarkSalmon",
  193. "DarkSeaGreen",
  194. "DarkSlateBlue",
  195. "DarkSlateGray",
  196. "DarkTurquoise",
  197. "DarkViolet",
  198. "DeepPink",
  199. "DeepSkyBlue",
  200. "DimGray",
  201. "DodgerBlue",
  202. "FireBrick",
  203. "FloralWhite",
  204. "ForestGreen",
  205. "Fuchsia",
  206. "Gainsboro",
  207. "GhostWhite",
  208. "Gold",
  209. "Goldenrod",
  210. "Gray",
  211. "Green",
  212. "GreenYellow",
  213. "HoneyDew",
  214. "HotPink",
  215. "IndianRed",
  216. "Indigo",
  217. "Ivory",
  218. "Khaki",
  219. "Lavender",
  220. "LavenderBlush",
  221. "LawnGreen",
  222. "LemonChiffon",
  223. "LightBlue",
  224. "LightCoral",
  225. "LightCyan",
  226. "LightGoldenrodYellow",
  227. "LightGray",
  228. "LightGreen",
  229. "LightPink",
  230. "LightSalmon",
  231. "LightSalmon",
  232. "LightSeaGreen",
  233. "LightSkyBlue",
  234. "LightSlateGray",
  235. "LightSteelBlue",
  236. "LightYellow",
  237. "Lime",
  238. "LimeGreen",
  239. "Linen",
  240. "Magenta",
  241. "Maroon",
  242. "MediumAquamarine",
  243. "MediumBlue",
  244. "MediumOrchid",
  245. "MediumPurple",
  246. "MediumSeaGreen",
  247. "MediumSlateBlue",
  248. "MediumSlateBlue",
  249. "MediumSpringGreen",
  250. "MediumTurquoise",
  251. "MediumVioletRed",
  252. "MidnightBlue",
  253. "MintCream",
  254. "MistyRose",
  255. "Moccasin",
  256. "NavajoWhite",
  257. "Navy",
  258. "OldLace",
  259. "Olive",
  260. "OliveDrab",
  261. "Orange",
  262. "OrangeRed",
  263. "Orchid",
  264. "PaleGoldenrod",
  265. "PaleGreen",
  266. "PaleTurquoise",
  267. "PaleVioletRed",
  268. "PapayaWhip",
  269. "PeachPuff",
  270. "Peru",
  271. "Pink",
  272. "Plum",
  273. "PowderBlue",
  274. "Purple",
  275. "RebeccaPurple",
  276. "Red",
  277. "RosyBrown",
  278. "RoyalBlue",
  279. "SaddleBrown",
  280. "Salmon",
  281. "SandyBrown",
  282. "SeaGreen",
  283. "SeaShell",
  284. "Sienna",
  285. "Silver",
  286. "SkyBlue",
  287. "SlateBlue",
  288. "SlateGray",
  289. "Snow",
  290. "SpringGreen",
  291. "SteelBlue",
  292. "Tan",
  293. "Teal",
  294. "Thistle",
  295. "Tomato",
  296. "Turquoise",
  297. "Violet",
  298. "Wheat",
  299. "White",
  300. "WhiteSmoke",
  301. "Yellow",
  302. "YellowGreen",
  303. ],
  304. o = ["currentColor", "inherit", "transparent"],
  305. l = e => {
  306. let r = !1
  307. return (
  308. t(e) &&
  309. a.map(
  310. n => (
  311. e.toLowerCase() === n.toLowerCase() && (r = !0), null
  312. )
  313. ),
  314. r
  315. )
  316. },
  317. i = e => {
  318. let r = !1
  319. return (
  320. t(e) &&
  321. o.map(
  322. n => (
  323. e.toLowerCase() === n.toLowerCase() && (r = !0), null
  324. )
  325. ),
  326. r
  327. )
  328. },
  329. u = e => {
  330. if (t(e)) {
  331. const r = /^#([\da-f]{3}){1,2}$|^#([\da-f]{4}){1,2}$/i
  332. return e && r.test(e)
  333. }
  334. },
  335. d = e => {
  336. if (t(e)) {
  337. const r =
  338. /(rgb)a?\((\s*\d+%?\s*?,?\s*){2}(\s*\d+%?\s*?,?\s*\)?)(\s*,?\s*\/?\s*(0?\.?\d+%?\s*)?|1|0)?\)$/i
  339. return e && r.test(e)
  340. }
  341. },
  342. s = "(([0-9]|[1-9][0-9]|100)%)",
  343. c = `\\s*?\\)?)(\\s*?(\\/?)\\s+(((${s}))|(0?(\\.\\d+)?)|1))?\\s*?\\)$`,
  344. f = e => {
  345. if (t(e)) {
  346. const r = new RegExp(
  347. `(hsl)a?\\((\\s*?((-?([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-9][0-9]|3[0-5][0-9]|360)(deg)?)|(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-9][0-9]|3[0-9][0-9]|400)gra)|((([0-5])?\\.\\d+|6\\.([0-9]|1[0-9]|2[0-8])|[0-6])rad)|((0?(\\.\\d+)?|1)turn))((\\s*,\\s*)|(\\s+)))(\\s*?(0|${s})((\\s*,\\s*)|(\\s+)))(\\s*?(0|${s})\\s*?\\)?)(\\s*?(\\/?|,?)\\s*?(((${s}))|(0?(\\.\\d+)?)|1))?\\)$`
  348. )
  349. return e && r.test(e)
  350. }
  351. },
  352. h = e => {
  353. if (t(e)) {
  354. const r = new RegExp(
  355. `(hwb\\(\\s*?(-?([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-9][0-9]|3[0-5][0-9]|360)(deg)?)\\s+)((0|${s})\\s+)((0|${s})${c}`
  356. )
  357. return e && r.test(e)
  358. }
  359. },
  360. g = e => {
  361. if (t(e)) {
  362. const r =
  363. "(-?(([0-9]|[1-9][0-9]|1[0-5][0-9])(\\.\\d+)??|160))",
  364. n = new RegExp(
  365. `(lab\\(\\s*?((\\d*(\\.\\d+)?)%)\\s+${r}\\s+${r}${c}`
  366. )
  367. return e && n.test(e)
  368. }
  369. },
  370. m = e => !!((e && u(e)) || d(e) || f(e) || h(e) || g(e))
  371. r.default = e =>
  372. !!((e && u(e)) || l(e) || i(e) || d(e) || f(e) || h(e) || g(e))
  373. },
  374. ])
  375. },
  376. 938: () => {},
  377. },
  378. __webpack_module_cache__ = {}
  379. function __webpack_require__(moduleId) {
  380. var cachedModule = __webpack_module_cache__[moduleId]
  381. if (void 0 !== cachedModule) return cachedModule.exports
  382. var module = (__webpack_module_cache__[moduleId] = { exports: {} })
  383. __webpack_modules__[moduleId](module, module.exports, __webpack_require__)
  384. return module.exports
  385. }
  386. __webpack_require__.n = module => {
  387. var getter =
  388. module && module.__esModule ? () => module.default : () => module
  389. __webpack_require__.d(getter, { a: getter })
  390. return getter
  391. }
  392. __webpack_require__.d = (exports, definition) => {
  393. for (var key in definition)
  394. __webpack_require__.o(definition, key) &&
  395. !__webpack_require__.o(exports, key) &&
  396. Object.defineProperty(exports, key, {
  397. enumerable: !0,
  398. get: definition[key],
  399. })
  400. }
  401. __webpack_require__.o = (obj, prop) =>
  402. Object.prototype.hasOwnProperty.call(obj, prop)
  403. ;(() => {
  404. "use strict"
  405. const external_log_namespaceObject = log
  406. var external_log_default = __webpack_require__.n(
  407. external_log_namespaceObject
  408. )
  409. const lib = observer => value => {
  410. observer.next(value)
  411. }
  412. Promise.resolve(!1)
  413. Promise.resolve(!0)
  414. var PROMISE_RESOLVED_VOID = Promise.resolve()
  415. function sleep(time, resolveWith) {
  416. time || (time = 0)
  417. return new Promise(function (res) {
  418. return setTimeout(function () {
  419. return res(resolveWith)
  420. }, time)
  421. })
  422. }
  423. function randomToken() {
  424. return Math.random().toString(36).substring(2)
  425. }
  426. var lastMs = 0,
  427. additional = 0
  428. function microSeconds() {
  429. var ms = new Date().getTime()
  430. if (ms === lastMs) return 1e3 * ms + ++additional
  431. lastMs = ms
  432. additional = 0
  433. return 1e3 * ms
  434. }
  435. var isNode =
  436. "[object process]" ===
  437. Object.prototype.toString.call(
  438. "undefined" != typeof process ? process : 0
  439. )
  440. const methods_native = {
  441. create: function (channelName) {
  442. var state = {
  443. messagesCallback: null,
  444. bc: new BroadcastChannel(channelName),
  445. subFns: [],
  446. }
  447. state.bc.onmessage = function (msg) {
  448. state.messagesCallback && state.messagesCallback(msg.data)
  449. }
  450. return state
  451. },
  452. close: function (channelState) {
  453. channelState.bc.close()
  454. channelState.subFns = []
  455. },
  456. onMessage: function (channelState, fn) {
  457. channelState.messagesCallback = fn
  458. },
  459. postMessage: function (channelState, messageJson) {
  460. try {
  461. channelState.bc.postMessage(messageJson, !1)
  462. return PROMISE_RESOLVED_VOID
  463. } catch (err) {
  464. return Promise.reject(err)
  465. }
  466. },
  467. canBeUsed: function () {
  468. if (isNode && "undefined" == typeof window) return !1
  469. if ("function" == typeof BroadcastChannel) {
  470. if (BroadcastChannel._pubkey)
  471. throw new Error(
  472. "BroadcastChannel: Do not overwrite window.BroadcastChannel with this module, this is not a polyfill"
  473. )
  474. return !0
  475. }
  476. return !1
  477. },
  478. type: "native",
  479. averageResponseTime: function () {
  480. return 150
  481. },
  482. microSeconds,
  483. }
  484. var ObliviousSet = (function () {
  485. function ObliviousSet(ttl) {
  486. this.ttl = ttl
  487. this.map = new Map()
  488. this._to = !1
  489. }
  490. ObliviousSet.prototype.has = function (value) {
  491. return this.map.has(value)
  492. }
  493. ObliviousSet.prototype.add = function (value) {
  494. var _this = this
  495. this.map.set(value, now())
  496. if (!this._to) {
  497. this._to = !0
  498. setTimeout(function () {
  499. _this._to = !1
  500. !(function (obliviousSet) {
  501. for (
  502. var olderThen = now() - obliviousSet.ttl,
  503. iterator = obliviousSet.map[Symbol.iterator]();
  504. ;
  505.  
  506. ) {
  507. var next = iterator.next().value
  508. if (!next) return
  509. var value = next[0]
  510. if (!(next[1] < olderThen)) return
  511. obliviousSet.map.delete(value)
  512. }
  513. })(_this)
  514. }, 0)
  515. }
  516. }
  517. ObliviousSet.prototype.clear = function () {
  518. this.map.clear()
  519. }
  520. return ObliviousSet
  521. })()
  522. function now() {
  523. return new Date().getTime()
  524. }
  525. function options_fillOptionsWithDefaults() {
  526. var originalOptions =
  527. arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {},
  528. options = JSON.parse(JSON.stringify(originalOptions))
  529. void 0 === options.webWorkerSupport && (options.webWorkerSupport = !0)
  530. options.idb || (options.idb = {})
  531. options.idb.ttl || (options.idb.ttl = 45e3)
  532. options.idb.fallbackInterval || (options.idb.fallbackInterval = 150)
  533. originalOptions.idb &&
  534. "function" == typeof originalOptions.idb.onclose &&
  535. (options.idb.onclose = originalOptions.idb.onclose)
  536. options.localstorage || (options.localstorage = {})
  537. options.localstorage.removeTimeout ||
  538. (options.localstorage.removeTimeout = 6e4)
  539. originalOptions.methods && (options.methods = originalOptions.methods)
  540. options.node || (options.node = {})
  541. options.node.ttl || (options.node.ttl = 12e4)
  542. options.node.maxParallelWrites || (options.node.maxParallelWrites = 2048)
  543. void 0 === options.node.useFastPath && (options.node.useFastPath = !0)
  544. return options
  545. }
  546. var TRANSACTION_SETTINGS = { durability: "relaxed" }
  547. function getIdb() {
  548. if ("undefined" != typeof indexedDB) return indexedDB
  549. if ("undefined" != typeof window) {
  550. if (void 0 !== window.mozIndexedDB) return window.mozIndexedDB
  551. if (void 0 !== window.webkitIndexedDB) return window.webkitIndexedDB
  552. if (void 0 !== window.msIndexedDB) return window.msIndexedDB
  553. }
  554. return !1
  555. }
  556. function commitIndexedDBTransaction(tx) {
  557. tx.commit && tx.commit()
  558. }
  559. function _readLoop(state) {
  560. state.closed ||
  561. readNewMessages(state)
  562. .then(function () {
  563. return sleep(state.options.idb.fallbackInterval)
  564. })
  565. .then(function () {
  566. return _readLoop(state)
  567. })
  568. }
  569. function readNewMessages(state) {
  570. return state.closed
  571. ? PROMISE_RESOLVED_VOID
  572. : state.messagesCallback
  573. ? (function (db, lastCursorId) {
  574. var tx = db.transaction(
  575. "messages",
  576. "readonly",
  577. TRANSACTION_SETTINGS
  578. ),
  579. objectStore = tx.objectStore("messages"),
  580. ret = [],
  581. keyRangeValue = IDBKeyRange.bound(lastCursorId + 1, 1 / 0)
  582. if (objectStore.getAll) {
  583. var getAllRequest = objectStore.getAll(keyRangeValue)
  584. return new Promise(function (res, rej) {
  585. getAllRequest.onerror = function (err) {
  586. return rej(err)
  587. }
  588. getAllRequest.onsuccess = function (e) {
  589. res(e.target.result)
  590. }
  591. })
  592. }
  593. return new Promise(function (res, rej) {
  594. var openCursorRequest = (function () {
  595. try {
  596. keyRangeValue = IDBKeyRange.bound(lastCursorId + 1, 1 / 0)
  597. return objectStore.openCursor(keyRangeValue)
  598. } catch (e) {
  599. return objectStore.openCursor()
  600. }
  601. })()
  602. openCursorRequest.onerror = function (err) {
  603. return rej(err)
  604. }
  605. openCursorRequest.onsuccess = function (ev) {
  606. var cursor = ev.target.result
  607. if (cursor)
  608. if (cursor.value.id < lastCursorId + 1)
  609. cursor.continue(lastCursorId + 1)
  610. else {
  611. ret.push(cursor.value)
  612. cursor.continue()
  613. }
  614. else {
  615. commitIndexedDBTransaction(tx)
  616. res(ret)
  617. }
  618. }
  619. })
  620. })(state.db, state.lastCursorId).then(function (newerMessages) {
  621. var useMessages = newerMessages
  622. .filter(function (msgObj) {
  623. return !!msgObj
  624. })
  625. .map(function (msgObj) {
  626. msgObj.id > state.lastCursorId &&
  627. (state.lastCursorId = msgObj.id)
  628. return msgObj
  629. })
  630. .filter(function (msgObj) {
  631. return (function (msgObj, state) {
  632. return !(
  633. msgObj.uuid === state.uuid ||
  634. state.eMIs.has(msgObj.id) ||
  635. msgObj.data.time < state.messagesCallbackTime
  636. )
  637. })(msgObj, state)
  638. })
  639. .sort(function (msgObjA, msgObjB) {
  640. return msgObjA.time - msgObjB.time
  641. })
  642. useMessages.forEach(function (msgObj) {
  643. if (state.messagesCallback) {
  644. state.eMIs.add(msgObj.id)
  645. state.messagesCallback(msgObj.data)
  646. }
  647. })
  648. return PROMISE_RESOLVED_VOID
  649. })
  650. : PROMISE_RESOLVED_VOID
  651. }
  652. const indexed_db = {
  653. create: function (channelName, options) {
  654. options = options_fillOptionsWithDefaults(options)
  655. return (function (channelName) {
  656. var dbName = "pubkey.broadcast-channel-0-" + channelName,
  657. openRequest = getIdb().open(dbName)
  658. openRequest.onupgradeneeded = function (ev) {
  659. ev.target.result.createObjectStore("messages", {
  660. keyPath: "id",
  661. autoIncrement: !0,
  662. })
  663. }
  664. return new Promise(function (res, rej) {
  665. openRequest.onerror = function (ev) {
  666. return rej(ev)
  667. }
  668. openRequest.onsuccess = function () {
  669. res(openRequest.result)
  670. }
  671. })
  672. })(channelName).then(function (db) {
  673. var state = {
  674. closed: !1,
  675. lastCursorId: 0,
  676. channelName,
  677. options,
  678. uuid: randomToken(),
  679. eMIs: new ObliviousSet(2 * options.idb.ttl),
  680. writeBlockPromise: PROMISE_RESOLVED_VOID,
  681. messagesCallback: null,
  682. readQueuePromises: [],
  683. db,
  684. }
  685. db.onclose = function () {
  686. state.closed = !0
  687. options.idb.onclose && options.idb.onclose()
  688. }
  689. _readLoop(state)
  690. return state
  691. })
  692. },
  693. close: function (channelState) {
  694. channelState.closed = !0
  695. channelState.db.close()
  696. },
  697. onMessage: function (channelState, fn, time) {
  698. channelState.messagesCallbackTime = time
  699. channelState.messagesCallback = fn
  700. readNewMessages(channelState)
  701. },
  702. postMessage: function (channelState, messageJson) {
  703. channelState.writeBlockPromise = channelState.writeBlockPromise
  704. .then(function () {
  705. return (function (db, readerUuid, messageJson) {
  706. var writeObject = {
  707. uuid: readerUuid,
  708. time: new Date().getTime(),
  709. data: messageJson,
  710. },
  711. tx = db.transaction(
  712. ["messages"],
  713. "readwrite",
  714. TRANSACTION_SETTINGS
  715. )
  716. return new Promise(function (res, rej) {
  717. tx.oncomplete = function () {
  718. return res()
  719. }
  720. tx.onerror = function (ev) {
  721. return rej(ev)
  722. }
  723. tx.objectStore("messages").add(writeObject)
  724. commitIndexedDBTransaction(tx)
  725. })
  726. })(channelState.db, channelState.uuid, messageJson)
  727. })
  728. .then(function () {
  729. 0 === Math.floor(11 * Math.random() + 0) &&
  730. ((db = channelState.db),
  731. (ttl = channelState.options.idb.ttl),
  732. (function (db, ttl) {
  733. var olderThen = new Date().getTime() - ttl,
  734. tx = db.transaction(
  735. "messages",
  736. "readonly",
  737. TRANSACTION_SETTINGS
  738. ),
  739. objectStore = tx.objectStore("messages"),
  740. ret = []
  741. return new Promise(function (res) {
  742. objectStore.openCursor().onsuccess = function (ev) {
  743. var cursor = ev.target.result
  744. if (cursor) {
  745. var msgObk = cursor.value
  746. if (!(msgObk.time < olderThen)) {
  747. commitIndexedDBTransaction(tx)
  748. res(ret)
  749. return
  750. }
  751. ret.push(msgObk)
  752. cursor.continue()
  753. } else res(ret)
  754. }
  755. })
  756. })(db, ttl).then(function (tooOld) {
  757. return (function (db, ids) {
  758. var objectStore = db
  759. .transaction(
  760. ["messages"],
  761. "readwrite",
  762. TRANSACTION_SETTINGS
  763. )
  764. .objectStore("messages")
  765. return Promise.all(
  766. ids.map(function (id) {
  767. var deleteRequest = objectStore.delete(id)
  768. return new Promise(function (res) {
  769. deleteRequest.onsuccess = function () {
  770. return res()
  771. }
  772. })
  773. })
  774. )
  775. })(
  776. db,
  777. tooOld.map(function (msg) {
  778. return msg.id
  779. })
  780. )
  781. }))
  782. var db, ttl
  783. })
  784. return channelState.writeBlockPromise
  785. },
  786. canBeUsed: function () {
  787. return !isNode && !!getIdb()
  788. },
  789. type: "idb",
  790. averageResponseTime: function (options) {
  791. return 2 * options.idb.fallbackInterval
  792. },
  793. microSeconds,
  794. }
  795. function getLocalStorage() {
  796. var localStorage
  797. if ("undefined" == typeof window) return null
  798. try {
  799. localStorage = window.localStorage
  800. localStorage =
  801. window["ie8-eventlistener/storage"] || window.localStorage
  802. } catch (e) {}
  803. return localStorage
  804. }
  805. function storageKey(channelName) {
  806. return "pubkey.broadcastChannel-" + channelName
  807. }
  808. function localstorage_canBeUsed() {
  809. if (isNode) return !1
  810. var ls = getLocalStorage()
  811. if (!ls) return !1
  812. try {
  813. var key = "__broadcastchannel_check"
  814. ls.setItem(key, "works")
  815. ls.removeItem(key)
  816. } catch (e) {
  817. return !1
  818. }
  819. return !0
  820. }
  821. const localstorage = {
  822. create: function (channelName, options) {
  823. options = options_fillOptionsWithDefaults(options)
  824. if (!localstorage_canBeUsed())
  825. throw new Error("BroadcastChannel: localstorage cannot be used")
  826. var uuid = randomToken(),
  827. eMIs = new ObliviousSet(options.localstorage.removeTimeout),
  828. state = { channelName, uuid, eMIs }
  829. state.listener = (function (channelName, fn) {
  830. var key = storageKey(channelName),
  831. listener = function (ev) {
  832. ev.key === key &&
  833. (function (msgObj) {
  834. if (
  835. state.messagesCallback &&
  836. msgObj.uuid !== uuid &&
  837. msgObj.token &&
  838. !eMIs.has(msgObj.token) &&
  839. !(
  840. msgObj.data.time &&
  841. msgObj.data.time < state.messagesCallbackTime
  842. )
  843. ) {
  844. eMIs.add(msgObj.token)
  845. state.messagesCallback(msgObj.data)
  846. }
  847. })(JSON.parse(ev.newValue))
  848. }
  849. window.addEventListener("storage", listener)
  850. return listener
  851. })(channelName)
  852. return state
  853. },
  854. close: function (channelState) {
  855. ;(listener = channelState.listener),
  856. window.removeEventListener("storage", listener)
  857. var listener
  858. },
  859. onMessage: function (channelState, fn, time) {
  860. channelState.messagesCallbackTime = time
  861. channelState.messagesCallback = fn
  862. },
  863. postMessage: function (channelState, messageJson) {
  864. return new Promise(function (res) {
  865. sleep().then(function () {
  866. var key = storageKey(channelState.channelName),
  867. writeObj = {
  868. token: randomToken(),
  869. time: new Date().getTime(),
  870. data: messageJson,
  871. uuid: channelState.uuid,
  872. },
  873. value = JSON.stringify(writeObj)
  874. getLocalStorage().setItem(key, value)
  875. var ev = document.createEvent("Event")
  876. ev.initEvent("storage", !0, !0)
  877. ev.key = key
  878. ev.newValue = value
  879. window.dispatchEvent(ev)
  880. res()
  881. })
  882. })
  883. },
  884. canBeUsed: localstorage_canBeUsed,
  885. type: "localstorage",
  886. averageResponseTime: function () {
  887. var userAgent = navigator.userAgent.toLowerCase()
  888. return userAgent.includes("safari") && !userAgent.includes("chrome")
  889. ? 240
  890. : 120
  891. },
  892. microSeconds,
  893. }
  894. var simulate_microSeconds = microSeconds,
  895. SIMULATE_CHANNELS = new Set()
  896. const simulate = {
  897. create: function (channelName) {
  898. var state = { name: channelName, messagesCallback: null }
  899. SIMULATE_CHANNELS.add(state)
  900. return state
  901. },
  902. close: function (channelState) {
  903. SIMULATE_CHANNELS.delete(channelState)
  904. },
  905. onMessage: function (channelState, fn) {
  906. channelState.messagesCallback = fn
  907. },
  908. postMessage: function (channelState, messageJson) {
  909. return new Promise(function (res) {
  910. return setTimeout(function () {
  911. Array.from(SIMULATE_CHANNELS)
  912. .filter(function (channel) {
  913. return channel.name === channelState.name
  914. })
  915. .filter(function (channel) {
  916. return channel !== channelState
  917. })
  918. .filter(function (channel) {
  919. return !!channel.messagesCallback
  920. })
  921. .forEach(function (channel) {
  922. return channel.messagesCallback(messageJson)
  923. })
  924. res()
  925. }, 5)
  926. })
  927. },
  928. canBeUsed: function () {
  929. return !0
  930. },
  931. type: "simulate",
  932. averageResponseTime: function () {
  933. return 5
  934. },
  935. microSeconds: simulate_microSeconds,
  936. }
  937. var METHODS = [methods_native, indexed_db, localstorage],
  938. OPEN_BROADCAST_CHANNELS = new Set(),
  939. lastId = 0,
  940. broadcast_channel_BroadcastChannel = function (name, options) {
  941. this.id = lastId++
  942. OPEN_BROADCAST_CHANNELS.add(this)
  943. this.name = name
  944. this.options = options_fillOptionsWithDefaults(options)
  945. this.method = (function (options) {
  946. var chooseMethods = []
  947. .concat(options.methods, METHODS)
  948. .filter(Boolean)
  949. if (options.type) {
  950. if ("simulate" === options.type) return simulate
  951. var ret = chooseMethods.find(function (m) {
  952. return m.type === options.type
  953. })
  954. if (ret) return ret
  955. throw new Error("method-type " + options.type + " not found")
  956. }
  957. options.webWorkerSupport ||
  958. isNode ||
  959. (chooseMethods = chooseMethods.filter(function (m) {
  960. return "idb" !== m.type
  961. }))
  962. var useMethod = chooseMethods.find(function (method) {
  963. return method.canBeUsed()
  964. })
  965. if (useMethod) return useMethod
  966. throw new Error(
  967. "No useable method found in " +
  968. JSON.stringify(
  969. METHODS.map(function (m) {
  970. return m.type
  971. })
  972. )
  973. )
  974. })(this.options)
  975. this._iL = !1
  976. this._onML = null
  977. this._addEL = { message: [], internal: [] }
  978. this._uMP = new Set()
  979. this._befC = []
  980. this._prepP = null
  981. !(function (channel) {
  982. var obj,
  983. maybePromise = channel.method.create(channel.name, channel.options)
  984. if ((obj = maybePromise) && "function" == typeof obj.then) {
  985. channel._prepP = maybePromise
  986. maybePromise.then(function (s) {
  987. channel._state = s
  988. })
  989. } else channel._state = maybePromise
  990. })(this)
  991. }
  992. broadcast_channel_BroadcastChannel._pubkey = !0
  993. broadcast_channel_BroadcastChannel.prototype = {
  994. postMessage: function (msg) {
  995. if (this.closed)
  996. throw new Error(
  997. "BroadcastChannel.postMessage(): Cannot post message after channel has closed " +
  998. JSON.stringify(msg)
  999. )
  1000. return _post(this, "message", msg)
  1001. },
  1002. postInternal: function (msg) {
  1003. return _post(this, "internal", msg)
  1004. },
  1005. set onmessage(fn) {
  1006. var listenObj = { time: this.method.microSeconds(), fn }
  1007. _removeListenerObject(this, "message", this._onML)
  1008. if (fn && "function" == typeof fn) {
  1009. this._onML = listenObj
  1010. _addListenerObject(this, "message", listenObj)
  1011. } else this._onML = null
  1012. },
  1013. addEventListener: function (type, fn) {
  1014. _addListenerObject(this, type, { time: this.method.microSeconds(), fn })
  1015. },
  1016. removeEventListener: function (type, fn) {
  1017. _removeListenerObject(
  1018. this,
  1019. type,
  1020. this._addEL[type].find(function (obj) {
  1021. return obj.fn === fn
  1022. })
  1023. )
  1024. },
  1025. close: function () {
  1026. var _this = this
  1027. if (!this.closed) {
  1028. OPEN_BROADCAST_CHANNELS.delete(this)
  1029. this.closed = !0
  1030. var awaitPrepare = this._prepP ? this._prepP : PROMISE_RESOLVED_VOID
  1031. this._onML = null
  1032. this._addEL.message = []
  1033. return awaitPrepare
  1034. .then(function () {
  1035. return Promise.all(Array.from(_this._uMP))
  1036. })
  1037. .then(function () {
  1038. return Promise.all(
  1039. _this._befC.map(function (fn) {
  1040. return fn()
  1041. })
  1042. )
  1043. })
  1044. .then(function () {
  1045. return _this.method.close(_this._state)
  1046. })
  1047. }
  1048. },
  1049. get type() {
  1050. return this.method.type
  1051. },
  1052. get isClosed() {
  1053. return this.closed
  1054. },
  1055. }
  1056. function _post(broadcastChannel, type, msg) {
  1057. var msgObj = {
  1058. time: broadcastChannel.method.microSeconds(),
  1059. type,
  1060. data: msg,
  1061. }
  1062. return (
  1063. broadcastChannel._prepP
  1064. ? broadcastChannel._prepP
  1065. : PROMISE_RESOLVED_VOID
  1066. ).then(function () {
  1067. var sendPromise = broadcastChannel.method.postMessage(
  1068. broadcastChannel._state,
  1069. msgObj
  1070. )
  1071. broadcastChannel._uMP.add(sendPromise)
  1072. sendPromise.catch().then(function () {
  1073. return broadcastChannel._uMP.delete(sendPromise)
  1074. })
  1075. return sendPromise
  1076. })
  1077. }
  1078. function _hasMessageListeners(channel) {
  1079. return (
  1080. channel._addEL.message.length > 0 || channel._addEL.internal.length > 0
  1081. )
  1082. }
  1083. function _addListenerObject(channel, type, obj) {
  1084. channel._addEL[type].push(obj)
  1085. !(function (channel) {
  1086. if (!channel._iL && _hasMessageListeners(channel)) {
  1087. var listenerFn = function (msgObj) {
  1088. channel._addEL[msgObj.type].forEach(function (listenerObject) {
  1089. var minMessageTime = listenerObject.time - 1e5
  1090. msgObj.time >= minMessageTime && listenerObject.fn(msgObj.data)
  1091. })
  1092. },
  1093. time = channel.method.microSeconds()
  1094. if (channel._prepP)
  1095. channel._prepP.then(function () {
  1096. channel._iL = !0
  1097. channel.method.onMessage(channel._state, listenerFn, time)
  1098. })
  1099. else {
  1100. channel._iL = !0
  1101. channel.method.onMessage(channel._state, listenerFn, time)
  1102. }
  1103. }
  1104. })(channel)
  1105. }
  1106. function _removeListenerObject(channel, type, obj) {
  1107. channel._addEL[type] = channel._addEL[type].filter(function (o) {
  1108. return o !== obj
  1109. })
  1110. !(function (channel) {
  1111. if (channel._iL && !_hasMessageListeners(channel)) {
  1112. channel._iL = !1
  1113. var time = channel.method.microSeconds()
  1114. channel.method.onMessage(channel._state, null, time)
  1115. }
  1116. })(channel)
  1117. }
  1118. var browser = __webpack_require__(661),
  1119. browser_default = __webpack_require__.n(browser)
  1120. const es_browser = {
  1121. add: function (fn) {
  1122. if (
  1123. "function" == typeof WorkerGlobalScope &&
  1124. self instanceof WorkerGlobalScope
  1125. );
  1126. else {
  1127. if ("function" != typeof window.addEventListener) return
  1128. window.addEventListener(
  1129. "beforeunload",
  1130. function () {
  1131. fn()
  1132. },
  1133. !0
  1134. )
  1135. window.addEventListener(
  1136. "unload",
  1137. function () {
  1138. fn()
  1139. },
  1140. !0
  1141. )
  1142. }
  1143. },
  1144. }
  1145. var node_ignored_ = __webpack_require__(938),
  1146. node_ignored_default = __webpack_require__.n(node_ignored_)
  1147. browser_default() && node_ignored_default(), new Set()
  1148. const external_DeepDiff_namespaceObject = DeepDiff
  1149. var fast_deep_equal = __webpack_require__(204),
  1150. fast_deep_equal_default = __webpack_require__.n(fast_deep_equal),
  1151. apply = function (a) {
  1152. return function (f) {
  1153. return f(a)
  1154. }
  1155. }
  1156. function function_identity(a) {
  1157. return a
  1158. }
  1159. function constant(a) {
  1160. return function () {
  1161. return a
  1162. }
  1163. }
  1164. var constNull = constant(null),
  1165. constUndefined = constant(void 0)
  1166. function function_flow(ab, bc, cd, de, ef, fg, gh, hi, ij) {
  1167. switch (arguments.length) {
  1168. case 1:
  1169. return ab
  1170. case 2:
  1171. return function () {
  1172. return bc(ab.apply(this, arguments))
  1173. }
  1174. case 3:
  1175. return function () {
  1176. return cd(bc(ab.apply(this, arguments)))
  1177. }
  1178. case 4:
  1179. return function () {
  1180. return de(cd(bc(ab.apply(this, arguments))))
  1181. }
  1182. case 5:
  1183. return function () {
  1184. return ef(de(cd(bc(ab.apply(this, arguments)))))
  1185. }
  1186. case 6:
  1187. return function () {
  1188. return fg(ef(de(cd(bc(ab.apply(this, arguments))))))
  1189. }
  1190. case 7:
  1191. return function () {
  1192. return gh(fg(ef(de(cd(bc(ab.apply(this, arguments)))))))
  1193. }
  1194. case 8:
  1195. return function () {
  1196. return hi(gh(fg(ef(de(cd(bc(ab.apply(this, arguments))))))))
  1197. }
  1198. case 9:
  1199. return function () {
  1200. return ij(hi(gh(fg(ef(de(cd(bc(ab.apply(this, arguments)))))))))
  1201. }
  1202. }
  1203. }
  1204. function function_pipe(a, ab, bc, cd, de, ef, fg, gh, hi) {
  1205. switch (arguments.length) {
  1206. case 1:
  1207. return a
  1208. case 2:
  1209. return ab(a)
  1210. case 3:
  1211. return bc(ab(a))
  1212. case 4:
  1213. return cd(bc(ab(a)))
  1214. case 5:
  1215. return de(cd(bc(ab(a))))
  1216. case 6:
  1217. return ef(de(cd(bc(ab(a)))))
  1218. case 7:
  1219. return fg(ef(de(cd(bc(ab(a))))))
  1220. case 8:
  1221. return gh(fg(ef(de(cd(bc(ab(a)))))))
  1222. case 9:
  1223. return hi(gh(fg(ef(de(cd(bc(ab(a))))))))
  1224. default:
  1225. for (var ret = arguments[0], i = 1; i < arguments.length; i++)
  1226. ret = arguments[i](ret)
  1227. return ret
  1228. }
  1229. }
  1230. var eqStrict = {
  1231. equals: function (a, b) {
  1232. return a === b
  1233. },
  1234. }
  1235. function apSecond(A) {
  1236. return function (second) {
  1237. return function (first) {
  1238. return A.ap(
  1239. A.map(first, function () {
  1240. return function (b) {
  1241. return b
  1242. }
  1243. }),
  1244. second
  1245. )
  1246. }
  1247. }
  1248. }
  1249. function apS(F) {
  1250. return function (name, fb) {
  1251. return function (fa) {
  1252. return F.ap(
  1253. F.map(fa, function (a) {
  1254. return function (b) {
  1255. var _a
  1256. return Object.assign({}, a, (((_a = {})[name] = b), _a))
  1257. }
  1258. }),
  1259. fb
  1260. )
  1261. }
  1262. }
  1263. }
  1264. function chainFirst(M) {
  1265. return function (f) {
  1266. return function (first) {
  1267. return M.chain(first, function (a) {
  1268. return M.map(f(a), function () {
  1269. return a
  1270. })
  1271. })
  1272. }
  1273. }
  1274. }
  1275. function bind(M) {
  1276. return function (name, f) {
  1277. return function (ma) {
  1278. return M.chain(ma, function (a) {
  1279. return M.map(f(a), function (b) {
  1280. var _a
  1281. return Object.assign({}, a, (((_a = {})[name] = b), _a))
  1282. })
  1283. })
  1284. }
  1285. }
  1286. }
  1287. function bindTo(F) {
  1288. return function (name) {
  1289. return function (fa) {
  1290. return F.map(fa, function (a) {
  1291. var _a
  1292. return ((_a = {})[name] = a), _a
  1293. })
  1294. }
  1295. }
  1296. }
  1297. function let_(F) {
  1298. return function (name, f) {
  1299. return function (fa) {
  1300. return F.map(fa, function (a) {
  1301. var _a
  1302. return Object.assign({}, a, (((_a = {})[name] = f(a)), _a))
  1303. })
  1304. }
  1305. }
  1306. }
  1307. var isSome = function (fa) {
  1308. return "Some" === fa._tag
  1309. },
  1310. none = { _tag: "None" },
  1311. some = function (a) {
  1312. return { _tag: "Some", value: a }
  1313. },
  1314. isNonEmpty = function (as) {
  1315. return as.length > 0
  1316. },
  1317. head = function (as) {
  1318. return as[0]
  1319. },
  1320. emptyReadonlyArray = [],
  1321. _map =
  1322. (Object.prototype.hasOwnProperty,
  1323. function (ma, f) {
  1324. return function () {
  1325. return f(ma())
  1326. }
  1327. }),
  1328. _ap = function (mab, ma) {
  1329. return function () {
  1330. return mab()(ma())
  1331. }
  1332. },
  1333. _chain = function (ma, f) {
  1334. return function () {
  1335. return f(ma())()
  1336. }
  1337. },
  1338. IO_map = function (f) {
  1339. return function (fa) {
  1340. return _map(fa, f)
  1341. }
  1342. },
  1343. of = constant,
  1344. chain = function (f) {
  1345. return function (ma) {
  1346. return _chain(ma, f)
  1347. }
  1348. },
  1349. Functor = { URI: "IO", map: _map },
  1350. Pointed = { URI: "IO", of },
  1351. Apply = { URI: "IO", map: _map, ap: _ap },
  1352. IO_apSecond = apSecond(Apply),
  1353. Chain = { URI: "IO", map: _map, ap: _ap, chain: _chain },
  1354. Monad = { URI: "IO", map: _map, ap: _ap, of, chain: _chain },
  1355. IO_chainFirst = chainFirst(Chain),
  1356. IO_bindTo = bindTo(Functor),
  1357. IO_bind = bind(Chain),
  1358. IO_apS = apS(Apply),
  1359. ApT = of(emptyReadonlyArray),
  1360. traverseArray = function (f) {
  1361. return (function (f) {
  1362. var g = (function (f) {
  1363. return function (as) {
  1364. return function () {
  1365. for (var out = [f(0, head(as))()], i = 1; i < as.length; i++)
  1366. out.push(f(i, as[i])())
  1367. return out
  1368. }
  1369. }
  1370. })(f)
  1371. return function (as) {
  1372. return isNonEmpty(as) ? g(as) : ApT
  1373. }
  1374. })(function (_, a) {
  1375. return f(a)
  1376. })
  1377. },
  1378. sequenceArray = traverseArray(function_identity),
  1379. Predicate_not = function (predicate) {
  1380. return function (a) {
  1381. return !predicate(a)
  1382. }
  1383. },
  1384. Separated_separated = function (left, right) {
  1385. return { left, right }
  1386. },
  1387. Option_none = none,
  1388. Option_some = some
  1389. function fromPredicate(predicate) {
  1390. return function (a) {
  1391. return predicate(a) ? Option_some(a) : Option_none
  1392. }
  1393. }
  1394. var Option_map = function (fa, f) {
  1395. return function_pipe(fa, es6_Option_map(f))
  1396. },
  1397. Option_ap = function (fab, fa) {
  1398. return function_pipe(fab, es6_Option_ap(fa))
  1399. },
  1400. _filter = function (fa, predicate) {
  1401. return function_pipe(fa, filter(predicate))
  1402. },
  1403. es6_Option_map = function (f) {
  1404. return function (fa) {
  1405. return Option_isNone(fa) ? Option_none : Option_some(f(fa.value))
  1406. }
  1407. },
  1408. Option_Functor = { URI: "Option", map: Option_map },
  1409. Option_of = Option_some,
  1410. es6_Option_ap = function (fa) {
  1411. return function (fab) {
  1412. return Option_isNone(fab) || Option_isNone(fa)
  1413. ? Option_none
  1414. : Option_some(fab.value(fa.value))
  1415. }
  1416. },
  1417. Option_Apply = { URI: "Option", map: Option_map, ap: Option_ap },
  1418. es6_Option_chain = function (f) {
  1419. return function (ma) {
  1420. return Option_isNone(ma) ? Option_none : f(ma.value)
  1421. }
  1422. },
  1423. Option_Chain = {
  1424. URI: "Option",
  1425. map: Option_map,
  1426. ap: Option_ap,
  1427. chain: function (ma, f) {
  1428. return function_pipe(ma, es6_Option_chain(f))
  1429. },
  1430. },
  1431. alt = function (that) {
  1432. return function (fa) {
  1433. return Option_isNone(fa) ? that() : fa
  1434. }
  1435. },
  1436. Option_compact = es6_Option_chain(function_identity),
  1437. defaultSeparated = Separated_separated(Option_none, Option_none),
  1438. Option_separate = function (ma) {
  1439. return Option_isNone(ma)
  1440. ? defaultSeparated
  1441. : Separated_separated(
  1442. (function (ma) {
  1443. return "Right" === ma._tag ? Option_none : Option_some(ma.left)
  1444. })(ma.value),
  1445. (function (ma) {
  1446. return "Left" === ma._tag ? Option_none : Option_some(ma.right)
  1447. })(ma.value)
  1448. )
  1449. },
  1450. filter = function (predicate) {
  1451. return function (fa) {
  1452. return Option_isNone(fa)
  1453. ? Option_none
  1454. : predicate(fa.value)
  1455. ? fa
  1456. : Option_none
  1457. }
  1458. },
  1459. filterMap = function (f) {
  1460. return function (fa) {
  1461. return Option_isNone(fa) ? Option_none : f(fa.value)
  1462. }
  1463. },
  1464. partition = function (predicate) {
  1465. return function (fa) {
  1466. return Separated_separated(
  1467. _filter(fa, Predicate_not(predicate)),
  1468. _filter(fa, predicate)
  1469. )
  1470. }
  1471. },
  1472. partitionMap = function (f) {
  1473. return function_flow(es6_Option_map(f), Option_separate)
  1474. },
  1475. Filterable = {
  1476. URI: "Option",
  1477. map: Option_map,
  1478. compact: Option_compact,
  1479. separate: Option_separate,
  1480. filter: _filter,
  1481. filterMap: function (fa, f) {
  1482. return function_pipe(fa, filterMap(f))
  1483. },
  1484. partition: function (fa, predicate) {
  1485. return function_pipe(fa, partition(predicate))
  1486. },
  1487. partitionMap: function (fa, f) {
  1488. return function_pipe(fa, partitionMap(f))
  1489. },
  1490. },
  1491. Option_isSome = isSome,
  1492. Option_isNone = function (fa) {
  1493. return "None" === fa._tag
  1494. },
  1495. match = function (onNone, onSome) {
  1496. return function (ma) {
  1497. return Option_isNone(ma) ? onNone() : onSome(ma.value)
  1498. }
  1499. },
  1500. getOrElseW = function (onNone) {
  1501. return function (ma) {
  1502. return Option_isNone(ma) ? onNone() : ma.value
  1503. }
  1504. },
  1505. getOrElse = getOrElseW,
  1506. fromNullable = function (a) {
  1507. return null == a ? Option_none : Option_some(a)
  1508. },
  1509. chainNullableK = function (f) {
  1510. return function (ma) {
  1511. return Option_isNone(ma) ? Option_none : fromNullable(f(ma.value))
  1512. }
  1513. },
  1514. toNullable = match(constNull, function_identity),
  1515. toUndefined = match(constUndefined, function_identity),
  1516. Option_bind = bind(Option_Chain),
  1517. Option_ApT = Option_of(emptyReadonlyArray),
  1518. Option_traverseArray = function (f) {
  1519. return (function (f) {
  1520. var g = (function (f) {
  1521. return function (as) {
  1522. var o = f(0, head(as))
  1523. if (Option_isNone(o)) return Option_none
  1524. for (var out = [o.value], i = 1; i < as.length; i++) {
  1525. var o_1 = f(i, as[i])
  1526. if (Option_isNone(o_1)) return Option_none
  1527. out.push(o_1.value)
  1528. }
  1529. return Option_some(out)
  1530. }
  1531. })(f)
  1532. return function (as) {
  1533. return isNonEmpty(as) ? g(as) : Option_ApT
  1534. }
  1535. })(function (_, a) {
  1536. return f(a)
  1537. })
  1538. },
  1539. Option_sequenceArray = Option_traverseArray(function_identity)
  1540. function Filterable_filter(F, G) {
  1541. return function (predicate) {
  1542. return function (fga) {
  1543. return F.map(fga, function (ga) {
  1544. return G.filter(ga, predicate)
  1545. })
  1546. }
  1547. }
  1548. }
  1549. function chainIOK(F, M) {
  1550. return function (f) {
  1551. var g = function_flow(f, F.fromIO)
  1552. return function (first) {
  1553. return M.chain(first, g)
  1554. }
  1555. }
  1556. }
  1557. function chainFirstIOK(F, M) {
  1558. var chainFirstM = chainFirst(M)
  1559. return function (f) {
  1560. return chainFirstM(function_flow(f, F.fromIO))
  1561. }
  1562. }
  1563. function OptionT_some(F) {
  1564. return function_flow(Option_some, F.of)
  1565. }
  1566. function fromF(F) {
  1567. return function (ma) {
  1568. return F.map(ma, Option_some)
  1569. }
  1570. }
  1571. function chainOptionK(M) {
  1572. var F,
  1573. chainM = OptionT_chain(M),
  1574. fromOptionKM =
  1575. ((F = M),
  1576. function (f) {
  1577. return function_flow(f, F.of)
  1578. })
  1579. return function (f) {
  1580. return chainM(fromOptionKM(f))
  1581. }
  1582. }
  1583. function OptionT_map(F) {
  1584. return (function (F, G) {
  1585. return function (f) {
  1586. return function (fa) {
  1587. return F.map(fa, function (ga) {
  1588. return G.map(ga, f)
  1589. })
  1590. }
  1591. }
  1592. })(F, Option_Functor)
  1593. }
  1594. function OptionT_ap(F) {
  1595. return (function (F, G) {
  1596. return function (fa) {
  1597. return function (fab) {
  1598. return F.ap(
  1599. F.map(fab, function (gab) {
  1600. return function (ga) {
  1601. return G.ap(gab, ga)
  1602. }
  1603. }),
  1604. fa
  1605. )
  1606. }
  1607. }
  1608. })(F, Option_Apply)
  1609. }
  1610. function OptionT_chain(M) {
  1611. var zeroM = constant(M.of(Option_none))
  1612. return function (f) {
  1613. return function (ma) {
  1614. return M.chain(
  1615. ma,
  1616. match(function () {
  1617. return zeroM()
  1618. }, f)
  1619. )
  1620. }
  1621. }
  1622. }
  1623. var IOOption_some = OptionT_some(Pointed),
  1624. fromOption = of,
  1625. IOOption_fromIO = fromF(Functor),
  1626. IOOption_chainOptionK =
  1627. (IO_map(toUndefined), IO_map(toNullable), chainOptionK(Monad)),
  1628. IOOption_map = OptionT_map(Functor),
  1629. IOOption_ap = OptionT_ap(Apply),
  1630. IOOption_chain = OptionT_chain(Monad),
  1631. IOOption_filter = Filterable_filter(Functor, Filterable),
  1632. IOOption_Chain = {
  1633. URI: "IOOption",
  1634. map: function (fa, f) {
  1635. return function_pipe(fa, IOOption_map(f))
  1636. },
  1637. ap: function (fab, fa) {
  1638. return function_pipe(fab, IOOption_ap(fa))
  1639. },
  1640. chain: function (ma, f) {
  1641. return function_pipe(ma, IOOption_chain(f))
  1642. },
  1643. },
  1644. IOOption_FromIO = { URI: "IOOption", fromIO: IOOption_fromIO },
  1645. IOOption_chainIOK = chainIOK(IOOption_FromIO, IOOption_Chain),
  1646. IOOption_chainFirstIOK = chainFirstIOK(IOOption_FromIO, IOOption_Chain),
  1647. es6_Reader_map = function (f) {
  1648. return function (fa) {
  1649. return function (r) {
  1650. return f(fa(r))
  1651. }
  1652. }
  1653. },
  1654. Reader_ApT = constant(emptyReadonlyArray),
  1655. Reader_traverseArray = function (f) {
  1656. return (function (f) {
  1657. var g = (function (f) {
  1658. return function (as) {
  1659. return function (r) {
  1660. for (var out = [f(0, head(as))(r)], i = 1; i < as.length; i++)
  1661. out.push(f(i, as[i])(r))
  1662. return out
  1663. }
  1664. }
  1665. })(f)
  1666. return function (as) {
  1667. return isNonEmpty(as) ? g(as) : Reader_ApT
  1668. }
  1669. })(function (_, a) {
  1670. return f(a)
  1671. })
  1672. },
  1673. Reader_sequenceArray = Reader_traverseArray(function_identity),
  1674. ReadonlyNonEmptyArray_spreadArray = function (to, from, pack) {
  1675. if (pack || 2 === arguments.length)
  1676. for (var ar, i = 0, l = from.length; i < l; i++)
  1677. if (ar || !(i in from)) {
  1678. ar || (ar = Array.prototype.slice.call(from, 0, i))
  1679. ar[i] = from[i]
  1680. }
  1681. return to.concat(ar || Array.prototype.slice.call(from))
  1682. },
  1683. ReadonlyNonEmptyArray_empty = emptyReadonlyArray,
  1684. ReadonlyNonEmptyArray_isNonEmpty = isNonEmpty,
  1685. ReadonlyNonEmptyArray_head = head,
  1686. ReadonlyNonEmptyArray_tail = function (as) {
  1687. return as.slice(1)
  1688. },
  1689. ReadonlyArray_isNonEmpty = ReadonlyNonEmptyArray_isNonEmpty,
  1690. ReadonlyArray_append = function (end) {
  1691. return function (init) {
  1692. return ReadonlyNonEmptyArray_spreadArray(
  1693. ReadonlyNonEmptyArray_spreadArray([], init, !0),
  1694. [end],
  1695. !1
  1696. )
  1697. }
  1698. },
  1699. ReadonlyArray_makeBy = function (n, f) {
  1700. return n <= 0
  1701. ? ReadonlyArray_empty
  1702. : (function (f) {
  1703. return function (n) {
  1704. for (
  1705. var j = Math.max(0, Math.floor(n)), out = [f(0)], i = 1;
  1706. i < j;
  1707. i++
  1708. )
  1709. out.push(f(i))
  1710. return out
  1711. }
  1712. })(f)(n)
  1713. },
  1714. ReadonlyArray_isOutOfBound = function (i, as) {
  1715. return i < 0 || i >= as.length
  1716. },
  1717. ReadonlyArray_head = function (as) {
  1718. return ReadonlyArray_isNonEmpty(as)
  1719. ? some(ReadonlyNonEmptyArray_head(as))
  1720. : none
  1721. },
  1722. findIndex = function (predicate) {
  1723. return function (as) {
  1724. for (var i = 0; i < as.length; i++)
  1725. if (predicate(as[i])) return some(i)
  1726. return none
  1727. }
  1728. },
  1729. ReadonlyArray_reverse = function (as) {
  1730. return as.length <= 1 ? as : as.slice().reverse()
  1731. },
  1732. ReadonlyArray_of = function (a) {
  1733. return [a]
  1734. },
  1735. es6_ReadonlyArray_chain = function (f) {
  1736. return function (ma) {
  1737. return function_pipe(
  1738. ma,
  1739. (function (f) {
  1740. return function (as) {
  1741. if (
  1742. (function (as) {
  1743. return 0 === as.length
  1744. })(as)
  1745. )
  1746. return ReadonlyArray_empty
  1747. for (var out = [], i = 0; i < as.length; i++)
  1748. out.push.apply(out, f(0, as[i]))
  1749. return out
  1750. }
  1751. })(function (_, a) {
  1752. return f(a)
  1753. })
  1754. )
  1755. }
  1756. },
  1757. es6_ReadonlyArray_map = function (f) {
  1758. return function (fa) {
  1759. return fa.map(function (a) {
  1760. return f(a)
  1761. })
  1762. }
  1763. },
  1764. es6_ReadonlyArray_mapWithIndex = function (f) {
  1765. return function (fa) {
  1766. return fa.map(function (a, i) {
  1767. return f(i, a)
  1768. })
  1769. }
  1770. },
  1771. es6_ReadonlyArray_filter = function (predicate) {
  1772. return function (as) {
  1773. return as.filter(predicate)
  1774. }
  1775. },
  1776. es6_ReadonlyArray_filterMap = function (f) {
  1777. return (function (f) {
  1778. return function (fa) {
  1779. for (var out = [], i = 0; i < fa.length; i++) {
  1780. var optionB = f(i, fa[i])
  1781. isSome(optionB) && out.push(optionB.value)
  1782. }
  1783. return out
  1784. }
  1785. })(function (_, a) {
  1786. return f(a)
  1787. })
  1788. },
  1789. ReadonlyArray_compact = es6_ReadonlyArray_filterMap(function_identity),
  1790. es6_ReadonlyArray_reduce = function (b, f) {
  1791. return es6_ReadonlyArray_reduceWithIndex(b, function (_, b, a) {
  1792. return f(b, a)
  1793. })
  1794. },
  1795. es6_ReadonlyArray_reduceWithIndex = function (b, f) {
  1796. return function (fa) {
  1797. for (var len = fa.length, out = b, i = 0; i < len; i++)
  1798. out = f(i, out, fa[i])
  1799. return out
  1800. }
  1801. },
  1802. toArray = function (as) {
  1803. return as.slice()
  1804. },
  1805. ReadonlyArray_empty = ReadonlyNonEmptyArray_empty
  1806. function every(predicate) {
  1807. return function (as) {
  1808. return as.every(predicate)
  1809. }
  1810. }
  1811. var ReadonlyArray_some = function (predicate) {
  1812. return function (as) {
  1813. return as.some(predicate)
  1814. }
  1815. },
  1816. ReadonlyArray_bindTo = bindTo({
  1817. URI: "ReadonlyArray",
  1818. map: function (fa, f) {
  1819. return function_pipe(fa, es6_ReadonlyArray_map(f))
  1820. },
  1821. }),
  1822. Task_fromIO = function (ma) {
  1823. return function () {
  1824. return Promise.resolve().then(ma)
  1825. }
  1826. },
  1827. Task_map = function (fa, f) {
  1828. return function_pipe(fa, es6_Task_map(f))
  1829. },
  1830. _apPar = function (fab, fa) {
  1831. return function_pipe(fab, Task_ap(fa))
  1832. },
  1833. es6_Task_map = function (f) {
  1834. return function (fa) {
  1835. return function () {
  1836. return Promise.resolve().then(fa).then(f)
  1837. }
  1838. }
  1839. },
  1840. Task_ap = function (fa) {
  1841. return function (fab) {
  1842. return function () {
  1843. return Promise.all([
  1844. Promise.resolve().then(fab),
  1845. Promise.resolve().then(fa),
  1846. ]).then(function (_a) {
  1847. return (0, _a[0])(_a[1])
  1848. })
  1849. }
  1850. }
  1851. },
  1852. Task_of = function (a) {
  1853. return function () {
  1854. return Promise.resolve(a)
  1855. }
  1856. },
  1857. es6_Task_chain = function (f) {
  1858. return function (ma) {
  1859. return function () {
  1860. return Promise.resolve()
  1861. .then(ma)
  1862. .then(function (a) {
  1863. return f(a)()
  1864. })
  1865. }
  1866. }
  1867. },
  1868. Task_Functor = { URI: "Task", map: Task_map },
  1869. ApplyPar = { URI: "Task", map: Task_map, ap: _apPar },
  1870. Task_Chain = {
  1871. URI: "Task",
  1872. map: Task_map,
  1873. ap: _apPar,
  1874. chain: function (ma, f) {
  1875. return function_pipe(ma, es6_Task_chain(f))
  1876. },
  1877. },
  1878. Task_chainFirstIOK = chainFirstIOK(
  1879. { URI: "Task", fromIO: Task_fromIO },
  1880. Task_Chain
  1881. ),
  1882. Task_bindTo = bindTo(Task_Functor),
  1883. Task_let_ = let_(Task_Functor),
  1884. Task_bind = bind(Task_Chain),
  1885. Task_apS = apS(ApplyPar)
  1886. const external_rxjs_namespaceObject = rxjs,
  1887. appendLog =
  1888. log =>
  1889. ([a, ...b]) =>
  1890. function_pipe(
  1891. [...log, `${a}${b.length > 0 ? ": " : ""}${b.join(", ")}`],
  1892. x => (x.length > 1e3 ? x.slice(0, 100) : x)
  1893. ),
  1894. consoleLog = (...[[a, ...b]]) =>
  1895. function_pipe(
  1896. () =>
  1897. external_log_default().info(
  1898. ...("string" == typeof a ? [`【FYC ${a}`] : ["【FYC】", a])
  1899. ),
  1900. IO_apSecond(
  1901. b.length > 0 ? () => external_log_default().info(...b) : () => {}
  1902. )
  1903. ),
  1904. createChatScreen = function_pipe(
  1905. () => document.createElement("div"),
  1906. IO_chainFirst(
  1907. x => () =>
  1908. Object.assign(x.style, {
  1909. pointerEvents: "none",
  1910. zIndex: "30",
  1911. position: "absolute",
  1912. overflow: "hidden",
  1913. height: "100%",
  1914. width: "100%",
  1915. })
  1916. )
  1917. ),
  1918. external_jsep_namespaceObject = jsep
  1919. var external_jsep_default = __webpack_require__.n(
  1920. external_jsep_namespaceObject
  1921. ),
  1922. u = {
  1923. "||": function (r, e) {
  1924. return r || e
  1925. },
  1926. "&&": function (r, e) {
  1927. return r && e
  1928. },
  1929. "|": function (r, e) {
  1930. return r | e
  1931. },
  1932. "^": function (r, e) {
  1933. return r ^ e
  1934. },
  1935. "&": function (r, e) {
  1936. return r & e
  1937. },
  1938. "==": function (r, e) {
  1939. return r == e
  1940. },
  1941. "!=": function (r, e) {
  1942. return r != e
  1943. },
  1944. "===": function (r, e) {
  1945. return r === e
  1946. },
  1947. "!==": function (r, e) {
  1948. return r !== e
  1949. },
  1950. "<": function (r, e) {
  1951. return r < e
  1952. },
  1953. ">": function (r, e) {
  1954. return r > e
  1955. },
  1956. "<=": function (r, e) {
  1957. return r <= e
  1958. },
  1959. ">=": function (r, e) {
  1960. return r >= e
  1961. },
  1962. "<<": function (r, e) {
  1963. return r << e
  1964. },
  1965. ">>": function (r, e) {
  1966. return r >> e
  1967. },
  1968. ">>>": function (r, e) {
  1969. return r >>> e
  1970. },
  1971. "+": function (r, e) {
  1972. return r + e
  1973. },
  1974. "-": function (r, e) {
  1975. return r - e
  1976. },
  1977. "*": function (r, e) {
  1978. return r * e
  1979. },
  1980. "/": function (r, e) {
  1981. return r / e
  1982. },
  1983. "%": function (r, e) {
  1984. return r % e
  1985. },
  1986. },
  1987. i = {
  1988. "-": function (r) {
  1989. return -r
  1990. },
  1991. "+": function (r) {
  1992. return +r
  1993. },
  1994. "~": function (r) {
  1995. return ~r
  1996. },
  1997. "!": function (r) {
  1998. return !r
  1999. },
  2000. }
  2001. function s(r, e) {
  2002. return r.map(function (r) {
  2003. return a(r, e)
  2004. })
  2005. }
  2006. function c(r, e) {
  2007. var n,
  2008. t = a(r.object, e)
  2009. if (
  2010. ((n = r.computed ? a(r.property, e) : r.property.name),
  2011. /^__proto__|prototype|constructor$/.test(n))
  2012. )
  2013. throw Error('Access to member "' + n + '" disallowed.')
  2014. return [t, t[n]]
  2015. }
  2016. function a(r, e) {
  2017. var n = r
  2018. switch (n.type) {
  2019. case "ArrayExpression":
  2020. return s(n.elements, e)
  2021. case "BinaryExpression":
  2022. return u[n.operator](a(n.left, e), a(n.right, e))
  2023. case "CallExpression":
  2024. var t, o, l
  2025. if (
  2026. ("MemberExpression" === n.callee.type
  2027. ? ((t = (l = c(n.callee, e))[0]), (o = l[1]))
  2028. : (o = a(n.callee, e)),
  2029. "function" != typeof o)
  2030. )
  2031. return
  2032. return o.apply(t, s(n.arguments, e))
  2033. case "ConditionalExpression":
  2034. return a(n.test, e) ? a(n.consequent, e) : a(n.alternate, e)
  2035. case "Identifier":
  2036. return e[n.name]
  2037. case "Literal":
  2038. return n.value
  2039. case "LogicalExpression":
  2040. return "||" === n.operator
  2041. ? a(n.left, e) || a(n.right, e)
  2042. : "&&" === n.operator
  2043. ? a(n.left, e) && a(n.right, e)
  2044. : u[n.operator](a(n.left, e), a(n.right, e))
  2045. case "MemberExpression":
  2046. return c(n, e)[1]
  2047. case "ThisExpression":
  2048. return e
  2049. case "UnaryExpression":
  2050. return i[n.operator](a(n.argument, e))
  2051. default:
  2052. return
  2053. }
  2054. }
  2055. const external_astring_namespaceObject = astring
  2056. var Eq = {
  2057. equals: function (first, second) {
  2058. return first === second
  2059. },
  2060. },
  2061. string_isEmpty = function (s) {
  2062. return 0 === s.length
  2063. },
  2064. split = function (separator) {
  2065. return function (s) {
  2066. var out = s.split(separator)
  2067. return ReadonlyNonEmptyArray_isNonEmpty(out) ? out : [s]
  2068. }
  2069. }
  2070. const fycKey = key => `FYC_${key}`,
  2071. languages = ["FYC_EN", "FYC_JA"],
  2072. stringsArgs = [
  2073. [],
  2074. function_flow(
  2075. split(/\r\n|\n/),
  2076. es6_ReadonlyArray_filter(Predicate_not(string_isEmpty))
  2077. ),
  2078. x => x.join("\n"),
  2079. ],
  2080. sc = (k, d) =>
  2081. (async (key, defaultVal) => ({
  2082. gmKey: key,
  2083. val: (await GM.getValue(key)) ?? defaultVal,
  2084. defaultVal,
  2085. toGm: function_identity,
  2086. }))(fycKey(k), d),
  2087. ic = (k, d, i, g) =>
  2088. (async (key, defaultVal, toItem, toGm) =>
  2089. function_pipe(
  2090. await GM.getValue(key),
  2091. x => (void 0 !== x ? toItem(x) : defaultVal),
  2092. x => ({ gmKey: key, val: x, defaultVal, toGm })
  2093. ))(fycKey(k), d, i, g),
  2094. defaultUserConfig = () =>
  2095. function_pipe(
  2096. async () => ({
  2097. lang: await ic(
  2098. "LANG",
  2099. "FYC_EN",
  2100. x => (languages.includes(x) ? x : "FYC_EN"),
  2101. x => x
  2102. ),
  2103. font: await sc("FONT", "MS PGothic"),
  2104. chatOpacity: await sc("OPACITY", 0.8),
  2105. color: await sc("COLOR", "#ffffff"),
  2106. ownerColor: await sc("COLOR_OWNER", "#ffd600"),
  2107. moderatorColor: await sc("COLOR_MODERATOR", "#c564ff"),
  2108. memberColor: await sc("COLOR_MEMBER", "#9fffff"),
  2109. fontSize: await sc("SIZE", 1),
  2110. fontWeight: await sc("WEIGHT", 730),
  2111. shadowFontWeight: await sc("WEIGHT_SHADOW", 1),
  2112. maxChatCount: await sc("LIMIT", 40),
  2113. flowSpeed: await sc("SPEED", 18),
  2114. maxChatLength: await sc("MAX", 100),
  2115. laneCount: await sc("LANE_DIV", 12),
  2116. bannedWords: await ic("NG_WORDS", ...stringsArgs),
  2117. bannedWordRegexs: await ic("NG_REG_WORDS", ...stringsArgs),
  2118. bannedUsers: await ic("NG_USERS", ...stringsArgs),
  2119. createChats: await sc("TOGGLE_CREATE_COMMENTS", !0),
  2120. noOverlap: await sc("NO_OVERLAP", !0),
  2121. createBanButton: await sc("NG_BUTTON", !0),
  2122. simplifyChatField: await sc("SIMPLE_CHAT_FIELD", !1),
  2123. displayModName: await sc("DISPLAY_MODERATOR_NAME", !0),
  2124. displaySuperChatAuthor: await sc("DISPLAY_SUPER_CHAT_AUTHOR", !0),
  2125. textOnly: await sc("TEXT_ONLY", !1),
  2126. timingFunction: await sc("TIMING_FUNCTION", "linear"),
  2127. displayChats: await sc("DISPLAY_COMMENTS", !0),
  2128. minSpacing: await sc("MIN_SPACING", 0.5),
  2129. fieldScale: await sc("FIELD_SCALE", 1),
  2130. flowY1: await sc("flowY1", 0),
  2131. flowY2: await sc("flowY2", 1),
  2132. flowX1: await sc("flowX1", 0),
  2133. flowX2: await sc("flowX2", 1),
  2134. shadowColor: await sc("shadowColor", "#000000"),
  2135. }),
  2136. Task_bind(
  2137. "filterExp",
  2138. x => () =>
  2139. ic(
  2140. "filterExp",
  2141. external_jsep_default()(
  2142. `\n or([\n RA.some(\n flip(flow([inText, RA.some]))(${JSON.stringify(
  2143. x.bannedWords.val
  2144. )})\n )(RA.compact([\n messageText,\n paymentInfo\n ])),\n RA.some(\n flip(flow([matchedByText, RA.some]))(${JSON.stringify(
  2145. x.bannedWordRegexs.val
  2146. )})\n )(RA.compact([\n messageText,\n paymentInfo\n ])),\n O.exists(\n flip(flow([eqText, RA.some]))(${JSON.stringify(
  2147. x.bannedUsers.val
  2148. )})\n )(authorID)\n ])\n `
  2149. ),
  2150. external_jsep_default(),
  2151. external_astring_namespaceObject.generate
  2152. )
  2153. )
  2154. )(),
  2155. chatApp = () =>
  2156. function_pipe(
  2157. fromNullable(document.querySelector("#chatframe")),
  2158. filter(x => {
  2159. const state = x.contentDocument?.readyState
  2160. return "loading" === state || "complete" === state
  2161. }),
  2162. chainNullableK(x => x.contentDocument),
  2163. alt(() => Option_some(document)),
  2164. chainNullableK(x => x.querySelector("yt-live-chat-app"))
  2165. ),
  2166. livePageYt = () => ({
  2167. toggleChatBtnParent: () =>
  2168. fromNullable(document.querySelector(".ytp-right-controls")),
  2169. settingsToggleNextElement: () =>
  2170. function_pipe(
  2171. document.querySelector("#menu-container"),
  2172. fromNullable,
  2173. filter(x => null !== x.offsetParent),
  2174. chainNullableK(x =>
  2175. x.querySelector(".dropdown-trigger.ytd-menu-renderer")
  2176. ),
  2177. alt(() =>
  2178. fromNullable(
  2179. document.querySelector(
  2180. "#top-row .dropdown-trigger.ytd-menu-renderer"
  2181. )
  2182. )
  2183. )
  2184. ),
  2185. settingsContainer: () => fromNullable(document.body),
  2186. player: () => fromNullable(document.querySelector("#movie_player")),
  2187. video: () =>
  2188. fromNullable(
  2189. document.querySelector("video.video-stream.html5-main-video")
  2190. ),
  2191. chatField: () =>
  2192. function_pipe(
  2193. chatApp(),
  2194. chainNullableK(x =>
  2195. x.querySelector("#items.yt-live-chat-item-list-renderer")
  2196. )
  2197. ),
  2198. chatTicker: () =>
  2199. function_pipe(
  2200. chatApp(),
  2201. chainNullableK(x =>
  2202. x.querySelector("#items.yt-live-chat-ticker-renderer")
  2203. )
  2204. ),
  2205. chatScroller: () =>
  2206. function_pipe(
  2207. chatApp(),
  2208. chainNullableK(x =>
  2209. x.querySelector("#item-scroller.yt-live-chat-item-list-renderer")
  2210. )
  2211. ),
  2212. offlineSlate: () =>
  2213. fromNullable(document.querySelector(".ytp-offline-slate")),
  2214. }),
  2215. mainCss = function_pipe(
  2216. () => document.createElement("style"),
  2217. IO_chainFirst(x => () => {
  2218. x.innerHTML =
  2219. ".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_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}"
  2220. })
  2221. ),
  2222. observePair = con =>
  2223. function_pipe(
  2224. () => new external_rxjs_namespaceObject.Subject(),
  2225. IO_bindTo("subject"),
  2226. IO_bind("observer", x => () => new con(lib(x.subject)))
  2227. ),
  2228. banButton = function_pipe(
  2229. document.createElement("button"),
  2230. of,
  2231. IO_chainFirst(
  2232. x => () =>
  2233. x.classList.add("style-scope", "yt-icon-button", "fyc_button")
  2234. ),
  2235. IO_chainFirst(
  2236. x => () =>
  2237. Object.assign(x.style, {
  2238. padding: "0px",
  2239. width: "20px",
  2240. height: "20px",
  2241. fill: "#fff",
  2242. })
  2243. ),
  2244. IO_chainFirst(
  2245. x => () => x.setAttribute("aria-label", "NGに入れる(Ban this user)")
  2246. ),
  2247. IO_chainFirst(x => () => {
  2248. x.innerHTML =
  2249. '<svg class="style-scope yt-icon" style="width: 100%; height: 75%; fill: var(--yt-spec-text-secondary);" viewBox="0 0 512 512"><path d="M440 78A256 256 0 1 0 73 435 256 256 0 0 0 440 78zm-99 35L113 341C37 179 212 44 341 113zM177 405l228-228c76 162-99 297-228 228z" fill-rule="evenodd"/></svg>'
  2250. })
  2251. )(),
  2252. external_Swal_namespaceObject = Swal
  2253. var external_Swal_default = __webpack_require__.n(
  2254. external_Swal_namespaceObject
  2255. )
  2256. const addBanButton = (chat, id, getConfig, setConfig) =>
  2257. chat.children.namedItem("card")
  2258. ? () => {}
  2259. : function_pipe(
  2260. () => banButton.cloneNode(!0),
  2261. IO_chainFirst(clone => {
  2262. return function_pipe(
  2263. getConfig.bannedUsers,
  2264. IOOption_fromIO,
  2265. IOOption_filter(x => !x.includes(id)),
  2266. IOOption_map(
  2267. function_flow(
  2268. ((f = (function (E) {
  2269. return function (as) {
  2270. if (1 === as.length) return as
  2271. for (
  2272. var out = [ReadonlyNonEmptyArray_head(as)],
  2273. _loop_1 = function (a) {
  2274. out.every(function (o) {
  2275. return !E.equals(o, a)
  2276. }) && out.push(a)
  2277. },
  2278. _i = 0,
  2279. rest_1 = ReadonlyNonEmptyArray_tail(as);
  2280. _i < rest_1.length;
  2281. _i++
  2282. )
  2283. _loop_1(rest_1[_i])
  2284. return out
  2285. }
  2286. })(Eq)),
  2287. function (as) {
  2288. return ReadonlyArray_isNonEmpty(as) ? f(as) : as
  2289. }),
  2290. ReadonlyArray_append(id)
  2291. )
  2292. ),
  2293. IOOption_chainIOK(x =>
  2294. function_pipe(
  2295. () => setConfig.bannedUsers(x),
  2296. IO_apSecond(() =>
  2297. external_Swal_default()
  2298. .mixin({
  2299. toast: !0,
  2300. position: "bottom-left",
  2301. timer: 2500,
  2302. timerProgressBar: !0,
  2303. showConfirmButton: !1,
  2304. didOpen: toast => {
  2305. toast.addEventListener(
  2306. "pointerenter",
  2307. external_Swal_default().stopTimer
  2308. )
  2309. toast.addEventListener(
  2310. "pointerleave",
  2311. external_Swal_default().resumeTimer
  2312. )
  2313. },
  2314. })
  2315. .fire({
  2316. title: `Added Banned User: ${id}`,
  2317. icon: "success",
  2318. })
  2319. )
  2320. )
  2321. ),
  2322. IO_apSecond(() => {
  2323. chat.style.display = "none"
  2324. }),
  2325. x => () => {
  2326. clone.onclick = x
  2327. }
  2328. )
  2329. var f
  2330. }),
  2331. chain(
  2332. x => () => chat.querySelector("#content #message")?.append(x)
  2333. )
  2334. ),
  2335. getChatFontSize = mainState =>
  2336. Math.round(
  2337. ((Math.max(mainState.getConfig.fontSize() - 0.2, 0.01) *
  2338. mainState.playerRect.height) /
  2339. mainState.getConfig.laneCount()) *
  2340. (mainState.getConfig.flowY2() - mainState.getConfig.flowY1()) *
  2341. 100
  2342. ) / 100
  2343. var equalsDefault = function (compare) {
  2344. return function (first, second) {
  2345. return first === second || 0 === compare(first, second)
  2346. }
  2347. },
  2348. Ord_contramap = function (f) {
  2349. return function (fa) {
  2350. return {
  2351. equals: equalsDefault(
  2352. (compare = function (first, second) {
  2353. return fa.compare(f(first), f(second))
  2354. })
  2355. ),
  2356. compare: function (first, second) {
  2357. return first === second ? 0 : compare(first, second)
  2358. },
  2359. }
  2360. var compare
  2361. }
  2362. },
  2363. number_Ord = {
  2364. equals: function (first, second) {
  2365. return first === second
  2366. },
  2367. compare: function (first, second) {
  2368. return first < second ? -1 : first > second ? 1 : 0
  2369. },
  2370. },
  2371. number_Show_show = function (n) {
  2372. return JSON.stringify(n)
  2373. }
  2374. const external_window_micro_memoize_namespaceObject =
  2375. window["micro-memoize"]
  2376. var external_window_micro_memoize_default = __webpack_require__.n(
  2377. external_window_micro_memoize_namespaceObject
  2378. )
  2379. const getFlowChatProgress = chat =>
  2380. function_pipe(
  2381. chat.animation,
  2382. chainNullableK(x => x.currentTime),
  2383. getOrElse(() => 0),
  2384. x => x / chat.animationDuration
  2385. ),
  2386. getFlowChatRect = (chat, mainState) =>
  2387. function_pipe(
  2388. mainState.getConfig,
  2389. x =>
  2390. mainState.playerRect.width * x.flowX2() -
  2391. (chat.width +
  2392. mainState.playerRect.width * (x.flowX2() - x.flowX1())) *
  2393. getFlowChatProgress(chat),
  2394. x => new DOMRect(x, chat.y, chat.width, chat.height)
  2395. ),
  2396. getChatLane = (flowChat, progress, flowChats) => mainState => {
  2397. const flowWidth =
  2398. mainState.playerRect.width *
  2399. (mainState.getConfig.flowX2() - mainState.getConfig.flowX1()),
  2400. chatRect = getFlowChatRect(flowChat, mainState),
  2401. chatWidth = chatRect.width,
  2402. chatHeight = chatRect.height,
  2403. chatX = chatRect.x,
  2404. chatIndex = flowChats.indexOf(flowChat),
  2405. movingChats = function_pipe(
  2406. flowChats,
  2407. ((n = chatIndex >= 0 ? chatIndex : -1),
  2408. function (as) {
  2409. return ReadonlyArray_isOutOfBound(n, as)
  2410. ? as
  2411. : 0 === n
  2412. ? ReadonlyArray_empty
  2413. : as.slice(0, n)
  2414. }),
  2415. es6_ReadonlyArray_filter(
  2416. chat => !chat.animationEnded && chat.width > 0
  2417. ),
  2418. ((O = Ord_contramap(x => x.lane)(number_Ord)),
  2419. function (as) {
  2420. return as.length <= 1 ? as : as.slice().sort(O.compare)
  2421. })
  2422. ),
  2423. tooCloseTo = external_window_micro_memoize_default()(
  2424. i => {
  2425. const otherRect = getFlowChatRect(movingChats[i], mainState),
  2426. otherWidth = otherRect.width,
  2427. otherX = otherRect.x,
  2428. gap =
  2429. (chatHeight * otherWidth * chatWidth) ** 0.333 *
  2430. mainState.getConfig.minSpacing()
  2431. return (
  2432. (flowWidth - otherX) / (flowWidth + otherWidth) - progress <
  2433. (chatWidth + gap) / (flowWidth + chatWidth) ||
  2434. otherX + otherWidth + gap > chatX
  2435. )
  2436. },
  2437. { maxSize: 1e3 }
  2438. ),
  2439. occupyInfo = function_pipe(
  2440. movingChats,
  2441. es6_ReadonlyArray_mapWithIndex((i, x) => ({
  2442. tooClose: () => tooCloseTo(i),
  2443. lane: x.lane,
  2444. })),
  2445. ReadonlyArray_append({
  2446. tooClose: () => !0,
  2447. lane: mainState.getConfig.laneCount(),
  2448. })
  2449. ),
  2450. index = occupyInfo.findIndex(x => x.lane >= flowChat.lane),
  2451. rightFreeLane = function_pipe(
  2452. occupyInfo.slice(index),
  2453. ((predicate = x => x.tooClose()),
  2454. function (as) {
  2455. for (var i = 0; i < as.length; i++)
  2456. if (predicate(as[i])) return some(as[i])
  2457. return none
  2458. }),
  2459. es6_Option_map(x => x.lane),
  2460. getOrElse(() => mainState.getConfig.laneCount())
  2461. )
  2462. var O, n, predicate
  2463. const leftFreeLane = function_pipe(
  2464. occupyInfo.slice(0, index),
  2465. function (as) {
  2466. for (var i = as.length - 1; i >= 0; i--)
  2467. if (as[i].tooClose()) return some(as[i])
  2468. return none
  2469. },
  2470. es6_Option_map(x => x.lane),
  2471. getOrElse(() => -1)
  2472. ),
  2473. formerLaneInterval = Math.min(
  2474. flowChat.lane - leftFreeLane,
  2475. rightFreeLane - flowChat.lane,
  2476. 1
  2477. )
  2478. return function_pipe(
  2479. occupyInfo,
  2480. es6_ReadonlyArray_reduce(
  2481. { maxInterval: 0, maxIntervalLane: 0, lastLane: -1 },
  2482. ({ maxInterval, maxIntervalLane, lastLane }, info) =>
  2483. maxInterval > 0.999 || !info.tooClose()
  2484. ? { maxInterval, maxIntervalLane, lastLane }
  2485. : (() => {
  2486. const nextLane = info.lane,
  2487. interLane = Math.min(
  2488. Math.max((lastLane + nextLane) / 2, 0),
  2489. mainState.getConfig.laneCount() - 1
  2490. ),
  2491. newInterval = Math.min(
  2492. interLane - lastLane,
  2493. nextLane - interLane,
  2494. 1
  2495. )
  2496. return newInterval - maxInterval > 0.001
  2497. ? {
  2498. maxInterval: newInterval,
  2499. maxIntervalLane: Math.max(lastLane + newInterval, 0),
  2500. lastLane: nextLane,
  2501. }
  2502. : { maxInterval, maxIntervalLane, lastLane: nextLane }
  2503. })()
  2504. ),
  2505. x => ({
  2506. lane:
  2507. Math.abs(formerLaneInterval - x.maxInterval) < 0.001
  2508. ? flowChat.lane
  2509. : x.maxIntervalLane,
  2510. interval: x.maxInterval,
  2511. })
  2512. )
  2513. },
  2514. intervalTooSmall = interval => getConfig =>
  2515. getConfig.noOverlap() && interval < 0.999,
  2516. external_m_namespaceObject = m
  2517. var external_m_default = __webpack_require__.n(external_m_namespaceObject)
  2518. const textShadow = shadowColor =>
  2519. function_flow(
  2520. x => `${x}px`,
  2521. x => (a, b) => `${a}${x} ${b}${x} ${shadowColor}99`,
  2522. x => [x("-", "-"), x("", "-"), x("-", ""), x("", "")].join(", ")
  2523. ),
  2524. textStyle = { fontFamily: "inherit" },
  2525. renderChat = chat => mainState => () =>
  2526. external_m_default().render(
  2527. chat.element,
  2528. ((chat, mainState) => {
  2529. const { getConfig } = mainState,
  2530. data = chat.getData(getConfig)
  2531. return external_m_default()(
  2532. "span",
  2533. {
  2534. style: {
  2535. fontSize: `${getChatFontSize(mainState)}px`,
  2536. visibility: getConfig.displayChats() ? "visible" : "hidden",
  2537. color:
  2538. "owner" === data.authorType
  2539. ? getConfig.ownerColor()
  2540. : "moderator" === data.authorType
  2541. ? getConfig.moderatorColor()
  2542. : "member" === data.authorType
  2543. ? getConfig.memberColor()
  2544. : getConfig.color(),
  2545. fontWeight: getConfig.fontWeight().toString(),
  2546. fontFamily: getConfig.font(),
  2547. opacity: getConfig.chatOpacity().toString(),
  2548. textShadow: textShadow(getConfig.shadowColor())(
  2549. getConfig.shadowFontWeight()
  2550. ),
  2551. },
  2552. },
  2553. function_pipe(
  2554. [
  2555. function_pipe(
  2556. data.authorName,
  2557. filter(x => x.visible),
  2558. es6_Option_map(x =>
  2559. external_m_default()(
  2560. "span",
  2561. {
  2562. style: {
  2563. color: toUndefined(data.textColor),
  2564. fontSize: "0.84em",
  2565. ...textStyle,
  2566. },
  2567. },
  2568. `${x.content}: `
  2569. )
  2570. )
  2571. ),
  2572. function_pipe(
  2573. data.messageElement,
  2574. es6_Option_map(x =>
  2575. ((message, getConfig) => {
  2576. const eleWin =
  2577. message.ownerDocument.defaultView ?? window,
  2578. maxChatLength = getConfig.maxChatLength()
  2579. return function_pipe(
  2580. Array.from(message.childNodes),
  2581. es6_ReadonlyArray_reduce(
  2582. { vnodes: [], length: 0 },
  2583. ({ vnodes, length }, node) => {
  2584. return length >= maxChatLength
  2585. ? { vnodes, length }
  2586. : !getConfig.textOnly() &&
  2587. node instanceof eleWin.HTMLImageElement
  2588. ? {
  2589. vnodes: [
  2590. ...vnodes,
  2591. external_m_default()("img", {
  2592. style: {
  2593. height: "1em",
  2594. width: "1em",
  2595. verticalAlign: "text-top",
  2596. },
  2597. src: node.src,
  2598. alt: node.alt,
  2599. }),
  2600. ],
  2601. length: length + 1,
  2602. }
  2603. : function_pipe(
  2604. node.textContent ?? "",
  2605. ((end = maxChatLength),
  2606. function (s) {
  2607. return s.slice(0, end)
  2608. }),
  2609. x =>
  2610. node instanceof eleWin.HTMLAnchorElement
  2611. ? {
  2612. vnodes: [
  2613. ...vnodes,
  2614. external_m_default()(
  2615. "span",
  2616. {
  2617. style: {
  2618. fontSize: "0.84em",
  2619. textDecoration: "underline",
  2620. ...textStyle,
  2621. },
  2622. },
  2623. x
  2624. ),
  2625. ],
  2626. length: length + x.length,
  2627. }
  2628. : {
  2629. vnodes: [
  2630. ...vnodes,
  2631. external_m_default().fragment(
  2632. {},
  2633. x
  2634. ),
  2635. ],
  2636. length: length + x.length,
  2637. }
  2638. )
  2639. var end
  2640. }
  2641. )
  2642. )
  2643. })(x, getConfig)
  2644. ),
  2645. es6_Option_map(x =>
  2646. external_m_default()(
  2647. "span",
  2648. {
  2649. style: {
  2650. color: toUndefined(data.textColor),
  2651. ...textStyle,
  2652. },
  2653. },
  2654. x.vnodes
  2655. )
  2656. )
  2657. ),
  2658. function_pipe(
  2659. data.paymentInfo,
  2660. filter(x => x.visible),
  2661. es6_Option_map(x =>
  2662. external_m_default()(
  2663. "span",
  2664. {
  2665. style: {
  2666. color: toUndefined(data.paidColor),
  2667. fontSize: "0.84em",
  2668. ...textStyle,
  2669. },
  2670. },
  2671. external_m_default()(
  2672. "strong",
  2673. { style: textStyle },
  2674. x.content
  2675. )
  2676. )
  2677. )
  2678. ),
  2679. ],
  2680. ReadonlyArray_compact,
  2681. toArray
  2682. )
  2683. )
  2684. })(chat, mainState)
  2685. ),
  2686. external_window_hash_it_namespaceObject = window["hash-it"]
  2687. var external_window_hash_it_default = __webpack_require__.n(
  2688. external_window_hash_it_namespaceObject
  2689. )
  2690. const getLaneY = (lane, mainState) =>
  2691. mainState.playerRect.height *
  2692. ((lane / mainState.getConfig.laneCount() + 0.005) *
  2693. (mainState.getConfig.flowY2() - mainState.getConfig.flowY1()) +
  2694. mainState.getConfig.flowY1()),
  2695. setChatPlayState = chat => mainState =>
  2696. function_pipe(
  2697. chat,
  2698. fromPredicate(x => !x.animationEnded),
  2699. fromOption,
  2700. IOOption_chainOptionK(x => x.animation),
  2701. IOOption_chainFirstIOK(x =>
  2702. mainState.chatPlaying ? () => x.play() : () => x.pause()
  2703. ),
  2704. IOOption_chainIOK(x => () => {
  2705. x.playbackRate = mainState.getConfig.flowSpeed() / 15
  2706. })
  2707. ),
  2708. getWidth = external_window_micro_memoize_default()(
  2709. ele => ele?.getBoundingClientRect().width ?? 0,
  2710. {
  2711. maxSize: 2e3,
  2712. transformKey: function_flow(
  2713. es6_ReadonlyArray_map(external_window_hash_it_default()),
  2714. toArray
  2715. ),
  2716. }
  2717. ),
  2718. setChatAnimation = (chat, chats) => mainState =>
  2719. function_pipe(
  2720. { fontSize: getChatFontSize(mainState) },
  2721. of,
  2722. IO_chainFirst(x => () => {
  2723. chat.element.style.transform = `translate(${
  2724. mainState.playerRect.width *
  2725. (mainState.getConfig.flowX2() - mainState.getConfig.flowX1())
  2726. }px, -${2 * x.fontSize}px)`
  2727. }),
  2728. IOOption_fromIO,
  2729. IOOption_filter(() => !chat.animationEnded),
  2730. IOOption_chainFirstIOK(x => () => {
  2731. chat.animationDuration = 6400
  2732. chat.width = getWidth(chat.element.firstElementChild)
  2733. chat.height = x.fontSize
  2734. }),
  2735. IOOption_map(() => ({ progress: getFlowChatProgress(chat) })),
  2736. IOOption_map(x => ({
  2737. ...x,
  2738. ...getChatLane(chat, x.progress, chats)(mainState),
  2739. })),
  2740. IOOption_chain(ctx =>
  2741. intervalTooSmall(ctx.interval)(mainState.getConfig)
  2742. ? function_pipe(
  2743. chat.animation,
  2744. fromOption,
  2745. IOOption_chainIOK(x => () => {
  2746. x.finish()
  2747. chat.animation = Option_none
  2748. }),
  2749. IO_map(() => Option_none)
  2750. )
  2751. : IOOption_some(ctx)
  2752. ),
  2753. IOOption_chainFirstIOK(x => () => {
  2754. chat.lane = x.lane
  2755. }),
  2756. IOOption_map(x => ({ ...x, laneY: getLaneY(chat.lane, mainState) })),
  2757. IOOption_chain(ctx =>
  2758. function_pipe(
  2759. [
  2760. function_pipe(
  2761. chat.animation,
  2762. fromOption,
  2763. IOOption_chainIOK(x => () => x.cancel())
  2764. ),
  2765. function_pipe(
  2766. [
  2767. [
  2768. mainState.playerRect.width *
  2769. (mainState.getConfig.flowX2() -
  2770. mainState.getConfig.flowX1()),
  2771. ctx.laneY,
  2772. ],
  2773. [-chat.width, ctx.laneY],
  2774. ],
  2775. es6_ReadonlyArray_map(es6_ReadonlyArray_map(x => `${x}px`)),
  2776. es6_ReadonlyArray_map(([x, y]) => `translate(${x}, ${y})`),
  2777. ReadonlyArray_bindTo("transform"),
  2778. toArray,
  2779. x =>
  2780. chat.element.animate(x, {
  2781. duration: 6400,
  2782. easing: mainState.getConfig.timingFunction(),
  2783. }),
  2784. x => {
  2785. x.onfinish = () => {
  2786. chat.animationEnded = !0
  2787. }
  2788. chat.y = ctx.laneY
  2789. const newTime = 6400 * ctx.progress
  2790. x.currentTime = newTime
  2791. return x
  2792. },
  2793. Option_some,
  2794. x => () => {
  2795. chat.animation = x
  2796. },
  2797. IO_apSecond(setChatPlayState(chat)(mainState))
  2798. ),
  2799. ],
  2800. sequenceArray,
  2801. IOOption_fromIO
  2802. )
  2803. ),
  2804. IO_map(Option_isSome)
  2805. ),
  2806. emptyElement = document.createElement("span")
  2807. var Monoid_concatAll = function (M) {
  2808. return (function (M) {
  2809. return function (startWith) {
  2810. return function (as) {
  2811. return as.reduce(function (a, acc) {
  2812. return M.concat(a, acc)
  2813. }, startWith)
  2814. }
  2815. }
  2816. })(M)(M.empty)
  2817. }
  2818. const filterOperators = {
  2819. flip: function (f) {
  2820. return function () {
  2821. for (var args = [], _i = 0; _i < arguments.length; _i++)
  2822. args[_i] = arguments[_i]
  2823. return args.length > 1
  2824. ? f(args[1], args[0])
  2825. : function (a) {
  2826. return f(a)(args[0])
  2827. }
  2828. }
  2829. },
  2830. flow: fns => function_flow(...fns),
  2831. and: Monoid_concatAll({
  2832. concat: function (first, second) {
  2833. return first && second
  2834. },
  2835. empty: !0,
  2836. }),
  2837. or: Monoid_concatAll({
  2838. concat: function (first, second) {
  2839. return first || second
  2840. },
  2841. empty: !1,
  2842. }),
  2843. RA: { some: ReadonlyArray_some, compact: ReadonlyArray_compact },
  2844. O: {
  2845. exists: function (predicate) {
  2846. return function (ma) {
  2847. return !Option_isNone(ma) && predicate(ma.value)
  2848. }
  2849. },
  2850. },
  2851. inText: text => x => {
  2852. return ((searchString = x),
  2853. function (s) {
  2854. return s.includes(searchString, undefined)
  2855. })(text.content)
  2856. var searchString
  2857. },
  2858. eqText: text => x => text.content === x,
  2859. matchedByText: text => x => Boolean(text.content.match(RegExp(x, "u"))),
  2860. isVisible: x => x.visible,
  2861. },
  2862. filter_filterOperators = filterOperators,
  2863. assert_lib = check.assert,
  2864. tapNonNull = x => {
  2865. assert_lib(null != x)
  2866. return x
  2867. },
  2868. onChatFieldMutate = (
  2869. chatScrn,
  2870. flowChats,
  2871. mainState,
  2872. setConfig,
  2873. mainLog
  2874. ) =>
  2875. function_flow(
  2876. es6_ReadonlyArray_chain(e => Array.from(e.addedNodes)),
  2877. es6_ReadonlyArray_filter(x => x.children.length > 0),
  2878. ReadonlyArray_reverse,
  2879. es6_ReadonlyArray_map(chat => () => {
  2880. const getData = (chat => {
  2881. const chatType = chat.querySelector(
  2882. ".yt-live-chat-ticker-paid-message-item-renderer"
  2883. )
  2884. ? "ticker"
  2885. : chat.querySelector(
  2886. ".yt-live-chat-membership-item-renderer"
  2887. )
  2888. ? "membership"
  2889. : chat.querySelector(
  2890. ".yt-live-chat-viewer-engagement-message-renderer"
  2891. )
  2892. ? "engagement"
  2893. : "normal",
  2894. isPaid =
  2895. "ticker" === chatType ||
  2896. Boolean(chat.querySelector("#card")),
  2897. paymentInfo = function_pipe(
  2898. fromNullable(
  2899. isPaid
  2900. ? chat.querySelector(
  2901. [
  2902. "#purchase-amount",
  2903. "#purchase-amount-chip",
  2904. "#content>#text",
  2905. ].join(",")
  2906. )?.textContent
  2907. : void 0
  2908. ),
  2909. es6_Option_map(x => ({ visible: !0, content: x }))
  2910. ),
  2911. authorType = chat.querySelector(".owner")
  2912. ? "owner"
  2913. : chat.querySelector(".moderator")
  2914. ? "moderator"
  2915. : chat.querySelector(".member")
  2916. ? "member"
  2917. : "normal",
  2918. messageElement = fromNullable(chat.querySelector("#message")),
  2919. isPaidNormal =
  2920. !!Option_isSome(paymentInfo) &&
  2921. Boolean(
  2922. chat.querySelector(".yt-live-chat-paid-message-renderer")
  2923. ),
  2924. isPaidSticker =
  2925. !(!Option_isSome(paymentInfo) || isPaidNormal) &&
  2926. Boolean(
  2927. chat.querySelector(".yt-live-chat-paid-sticker-renderer")
  2928. ),
  2929. textColor = fromNullable(
  2930. isPaidNormal
  2931. ? window
  2932. .getComputedStyle(
  2933. tapNonNull(chat.querySelector("#header"))
  2934. )
  2935. .getPropertyValue("background-color")
  2936. : isPaidSticker
  2937. ? window
  2938. .getComputedStyle(chat)
  2939. .getPropertyValue(
  2940. "--yt-live-chat-paid-sticker-chip-background-color"
  2941. )
  2942. : void 0
  2943. ),
  2944. paidColor = fromNullable(
  2945. isPaidNormal
  2946. ? window
  2947. .getComputedStyle(
  2948. tapNonNull(chat.querySelector("#content"))
  2949. )
  2950. .getPropertyValue("background-color")
  2951. : isPaidSticker
  2952. ? window
  2953. .getComputedStyle(chat)
  2954. .getPropertyValue(
  2955. "--yt-live-chat-paid-sticker-background-color"
  2956. )
  2957. : void 0
  2958. ),
  2959. authorPhotoMatches = chat
  2960. .querySelector(["#author-photo", "img"].join(" "))
  2961. ?.src.match(/ytc\/(.*)=/),
  2962. authorID = fromNullable(authorPhotoMatches?.at(-1)),
  2963. authorName = fromNullable(
  2964. chat.querySelector("#author-name")?.textContent
  2965. ),
  2966. message = function_pipe(
  2967. messageElement,
  2968. es6_Option_map(x => ({ visible: !0, content: x.innerHTML }))
  2969. ),
  2970. messageText = function_pipe(
  2971. messageElement,
  2972. es6_Option_map(x => ({
  2973. visible: !0,
  2974. content: x.textContent ?? "",
  2975. }))
  2976. )
  2977. return getConfig => ({
  2978. chatType,
  2979. authorType,
  2980. authorID,
  2981. authorName: function_pipe(
  2982. authorName,
  2983. es6_Option_map(x => ({
  2984. visible:
  2985. ("moderator" === authorType &&
  2986. getConfig.displayModName()) ||
  2987. (Option_isSome(paymentInfo) &&
  2988. getConfig.displaySuperChatAuthor()),
  2989. content: x,
  2990. }))
  2991. ),
  2992. messageElement,
  2993. message,
  2994. messageText,
  2995. paymentInfo,
  2996. textColor,
  2997. paidColor,
  2998. })
  2999. })(chat),
  3000. { getConfig } = mainState,
  3001. data = getData(getConfig)
  3002. ;(((data, getConfig, mainLog) =>
  3003. function_pipe(
  3004. data,
  3005. fromPredicate(() =>
  3006. function_pipe(getConfig.filterExp(), x =>
  3007. a(
  3008. x,
  3009. (data => ({
  3010. ...filter_filterOperators,
  3011. authorName: data.authorName,
  3012. message: data.message,
  3013. messageText: data.messageText,
  3014. paymentInfo: data.paymentInfo,
  3015. authorID: function_pipe(
  3016. data.authorID,
  3017. es6_Option_map(x => ({ visible: !1, content: x }))
  3018. ),
  3019. }))(data)
  3020. )
  3021. )
  3022. ),
  3023. es6_Option_map(x => [
  3024. function_pipe(
  3025. x.message,
  3026. es6_Option_map(m => m.content)
  3027. ),
  3028. function_pipe(
  3029. x.paymentInfo,
  3030. es6_Option_map(p => p.content)
  3031. ),
  3032. ]),
  3033. es6_Option_map(es6_ReadonlyArray_map(getOrElse(() => ""))),
  3034. es6_Option_map(JSON.stringify),
  3035. es6_Option_map(x => mainLog([`Filtered: ${x}`])),
  3036. match(
  3037. () => () => !1,
  3038. IO_map(() => !0)
  3039. )
  3040. )())(data, getConfig, mainLog)
  3041. ? () => {
  3042. chat.style.display = "none"
  3043. }
  3044. : function_pipe(
  3045. [
  3046. function_pipe(
  3047. void 0,
  3048. fromPredicate(getConfig.createChats),
  3049. filter(() => "normal" === data.chatType),
  3050. fromOption,
  3051. IOOption_chainIOK(() =>
  3052. ((getData, flowChats, chatScrn, mainState) =>
  3053. function_pipe(
  3054. {
  3055. getData,
  3056. element: emptyElement,
  3057. lane: -1,
  3058. animation: Option_none,
  3059. animationDuration: 0,
  3060. animationEnded: !1,
  3061. width: 2,
  3062. height: getChatFontSize(mainState),
  3063. y: 0,
  3064. },
  3065. x =>
  3066. getChatLane(x, 0, flowChats)(mainState).interval,
  3067. intervalTooSmall,
  3068. x => x(mainState.getConfig)
  3069. )
  3070. ? () => {}
  3071. : () => {
  3072. const offScreenIndex = function_pipe(
  3073. flowChats,
  3074. findIndex(
  3075. chat =>
  3076. chat.animationEnded ||
  3077. flowChats.length >=
  3078. mainState.getConfig.maxChatCount()
  3079. )
  3080. ),
  3081. element = function_pipe(
  3082. offScreenIndex,
  3083. es6_Option_map(x => flowChats[x].element),
  3084. getOrElseW(() =>
  3085. document.createElement("span")
  3086. )
  3087. )
  3088. function_pipe(
  3089. offScreenIndex,
  3090. match(
  3091. () => () => {
  3092. external_log_default().debug(
  3093. "CreateFlowChat"
  3094. )
  3095. chatScrn.append(element)
  3096. },
  3097. i =>
  3098. function_pipe(
  3099. () =>
  3100. flowChats.splice(i, 1)[0].animation,
  3101. IOOption_chainIOK(
  3102. oldAnimation => () =>
  3103. oldAnimation.cancel()
  3104. )
  3105. )
  3106. )
  3107. )()
  3108. const flowChat = {
  3109. getData,
  3110. element,
  3111. lane: -1,
  3112. animation: Option_none,
  3113. animationDuration: 0,
  3114. animationEnded: !1,
  3115. width: 2,
  3116. height: getChatFontSize(mainState),
  3117. y: 0,
  3118. }
  3119. element.classList.add("fyc_chat")
  3120. function_pipe(
  3121. mainState,
  3122. of,
  3123. IO_chainFirst(renderChat(flowChat)),
  3124. chain(setChatAnimation(flowChat, flowChats)),
  3125. chain(x =>
  3126. x
  3127. ? () => flowChats.push(flowChat)
  3128. : () => flowChat.element.remove()
  3129. )
  3130. )()
  3131. })(getData, flowChats, chatScrn, mainState)
  3132. )
  3133. ),
  3134. function_pipe(
  3135. data.authorID,
  3136. fromOption,
  3137. IOOption_filter(getConfig.createBanButton),
  3138. IOOption_chainIOK(x =>
  3139. addBanButton(chat, x, getConfig, setConfig)
  3140. ),
  3141. IO_map(() => Option_some(void 0)),
  3142. IOOption_filter(getConfig.simplifyChatField),
  3143. IOOption_chainIOK(() =>
  3144. (chat =>
  3145. chat.querySelector(
  3146. ".style-scope.yt-live-chat-paid-message-renderer"
  3147. )
  3148. ? () => {}
  3149. : function_pipe(
  3150. [
  3151. "#author-photo",
  3152. "yt-live-chat-author-chip.style-scope.yt-live-chat-text-message-renderer",
  3153. ],
  3154. es6_ReadonlyArray_map(x =>
  3155. fromNullable(chat.querySelector(x))
  3156. ),
  3157. ReadonlyArray_compact,
  3158. es6_ReadonlyArray_map(x => () => {
  3159. x.style.display = "none"
  3160. }),
  3161. ReadonlyArray_append(() => {
  3162. chat.style.borderBottom =
  3163. "1px solid var(--yt-spec-text-secondary)"
  3164. }),
  3165. sequenceArray
  3166. ))(chat)
  3167. )
  3168. ),
  3169. ],
  3170. sequenceArray
  3171. ))()
  3172. }),
  3173. sequenceArray
  3174. ),
  3175. removeOldChats = maxChatCount => flowChats =>
  3176. function_pipe(
  3177. () =>
  3178. flowChats.sort((a, b) =>
  3179. a.animationEnded === b.animationEnded
  3180. ? 0
  3181. : a.animationEnded
  3182. ? -1
  3183. : 1
  3184. ),
  3185. IO_apSecond(() =>
  3186. flowChats.splice(0, Math.max(0, flowChats.length - maxChatCount))
  3187. ),
  3188. chain(
  3189. removed => () =>
  3190. removed.forEach(x => {
  3191. external_log_default().debug("RemoveChat")
  3192. x.element.remove()
  3193. })
  3194. )
  3195. ),
  3196. setChatAppCss = chatField => () =>
  3197. function_pipe(
  3198. fromNullable(chatField.parentElement),
  3199. es6_Option_map(x => () => {
  3200. x.style.overflow = "unset"
  3201. })
  3202. ),
  3203. exceptions = ["timingFunction", "lang"],
  3204. isEditable = k => v =>
  3205. ("number" == typeof v ||
  3206. "string" == typeof v ||
  3207. (Array.isArray(v) && ("string" == typeof v[0] || 0 === v.length))) &&
  3208. !ReadonlyArray_some(x => x === k)(exceptions)
  3209. function fst(ea) {
  3210. return ea[0]
  3211. }
  3212. function snd(ea) {
  3213. return ea[1]
  3214. }
  3215. var mapFst = function (f) {
  3216. return function (fa) {
  3217. return [f(fst(fa)), snd(fa)]
  3218. }
  3219. },
  3220. mapSnd = function (f) {
  3221. return function (fa) {
  3222. return [fst(fa), f(snd(fa))]
  3223. }
  3224. }
  3225. const Editable_of = x => [x, Option_none],
  3226. fromValueText = v => t => [v, Option_some([t, Option_none])],
  3227. Editable_value = fst,
  3228. Editable_text = function_flow(snd, es6_Option_map(fst)),
  3229. error = function_flow(snd, es6_Option_chain(snd)),
  3230. setValue = function_flow(constant, mapFst),
  3231. setText = x =>
  3232. mapSnd(
  3233. function_flow(
  3234. es6_Option_map(mapFst(constant(x))),
  3235. alt(constant(Option_some([x, Option_none])))
  3236. )
  3237. ),
  3238. hasError = function_flow(error, Option_isSome),
  3239. identifier = function_identity,
  3240. isExpType = type => x => x.type === type,
  3241. fromJsepExp = x => {
  3242. return isExpType("Identifier")(x)
  3243. ? Option_some(identifier(x))
  3244. : isExpType("MemberExpression")(x)
  3245. ? ((f = fromJsepExp),
  3246. exp =>
  3247. function_pipe(
  3248. { type: exp.type, computed: exp.computed },
  3249. Option_of,
  3250. Option_bind("object", () => f(exp.object)),
  3251. Option_bind("property", () => f(exp.property))
  3252. ))(x)
  3253. : isExpType("CallExpression")(x)
  3254. ? (
  3255. f => exp =>
  3256. function_pipe(
  3257. { type: exp.type },
  3258. Option_of,
  3259. Option_bind("argument", () =>
  3260. function_pipe(
  3261. exp.arguments,
  3262. ReadonlyArray_head,
  3263. es6_Option_map(f)
  3264. )
  3265. ),
  3266. Option_bind("callee", () => f(exp.callee))
  3267. )
  3268. )(fromJsepExp)(x)
  3269. : isExpType("Literal")(x)
  3270. ? "string" == typeof (exp = x).value
  3271. ? Option_some({ type: "Literal", value: Editable_of(exp.value) })
  3272. : Option_none
  3273. : isExpType("ArrayExpression")(x)
  3274. ? (
  3275. f => exp =>
  3276. function_pipe(exp.elements, elements =>
  3277. function_pipe(
  3278. elements,
  3279. fromPredicate(every(x => "Literal" === x.type)),
  3280. filter(every(x => "string" == typeof x.value)),
  3281. es6_Option_map(es => ({
  3282. type: "LiteralArray",
  3283. value: Editable_of(
  3284. function_pipe(
  3285. es,
  3286. es6_ReadonlyArray_map(x => x.value)
  3287. )
  3288. ),
  3289. })),
  3290. x =>
  3291. Option_isSome(x)
  3292. ? x
  3293. : function_pipe(
  3294. { type: exp.type },
  3295. Option_of,
  3296. Option_bind("elements", () =>
  3297. function_pipe(
  3298. elements,
  3299. es6_ReadonlyArray_map(f),
  3300. Option_sequenceArray
  3301. )
  3302. )
  3303. )
  3304. )
  3305. )
  3306. )(fromJsepExp)(x)
  3307. : isExpType("Compound")(x)
  3308. ? (
  3309. f => exp =>
  3310. function_pipe(
  3311. { type: exp.type },
  3312. Option_of,
  3313. Option_bind("body", () =>
  3314. function_pipe(
  3315. exp.body,
  3316. es6_ReadonlyArray_map(f),
  3317. Option_sequenceArray
  3318. )
  3319. )
  3320. )
  3321. )(fromJsepExp)(x)
  3322. : Option_none
  3323. var f, exp
  3324. },
  3325. EditableExpression_fromJsepExp = fromJsepExp,
  3326. settingStateInit = getConfig =>
  3327. function_pipe(
  3328. Object.entries(getConfig),
  3329. es6_ReadonlyArray_map(([k, v]) => [k, v()]),
  3330. es6_ReadonlyArray_map(([k, v]) => [
  3331. k,
  3332. isEditable(k)(v)
  3333. ? Editable_of(v)
  3334. : "filterExp" === k
  3335. ? function_pipe(
  3336. EditableExpression_fromJsepExp(v),
  3337. getOrElseW(() => ({ type: "Compound", body: [] }))
  3338. )
  3339. : v,
  3340. ]),
  3341. Object.fromEntries,
  3342. x => ({
  3343. ...x,
  3344. showPanel: !1,
  3345. mainTab: 0,
  3346. logTab: 0,
  3347. timingStepCount: Editable_of(
  3348. parseInt(
  3349. getConfig.timingFunction().match(/^steps\((\d+),.+/)?.[1] ??
  3350. "150",
  3351. 10
  3352. )
  3353. ),
  3354. eventLog: [],
  3355. })
  3356. )
  3357. var EMPTY_OBJ = {},
  3358. EMPTY_ARR = [],
  3359. hyperapp_id = a => a,
  3360. hyperapp_map = EMPTY_ARR.map,
  3361. isArray = Array.isArray,
  3362. enqueue =
  3363. "undefined" != typeof requestAnimationFrame
  3364. ? requestAnimationFrame
  3365. : setTimeout,
  3366. createClass = obj => {
  3367. var out = ""
  3368. if ("string" == typeof obj) return obj
  3369. if (isArray(obj))
  3370. for (var tmp, k = 0; k < obj.length; k++)
  3371. (tmp = createClass(obj[k])) && (out += (out && " ") + tmp)
  3372. else for (var k in obj) obj[k] && (out += (out && " ") + k)
  3373. return out
  3374. },
  3375. shouldRestart = (a, b) => {
  3376. for (var k in { ...a, ...b })
  3377. if ("function" == typeof (isArray(a[k]) ? a[k][0] : a[k])) b[k] = a[k]
  3378. else if (a[k] !== b[k]) return !0
  3379. },
  3380. getKey = vdom => (null == vdom ? vdom : vdom.key),
  3381. patchProperty = (node, key, oldValue, newValue, listener, isSvg) => {
  3382. if ("style" === key)
  3383. for (var k in { ...oldValue, ...newValue }) {
  3384. oldValue =
  3385. null == newValue || null == newValue[k] ? "" : newValue[k]
  3386. "-" === k[0]
  3387. ? node[key].setProperty(k, oldValue)
  3388. : (node[key][k] = oldValue)
  3389. }
  3390. else
  3391. "o" === key[0] && "n" === key[1]
  3392. ? ((node.events || (node.events = {}))[(key = key.slice(2))] =
  3393. newValue)
  3394. ? oldValue || node.addEventListener(key, listener)
  3395. : node.removeEventListener(key, listener)
  3396. : !isSvg && "list" !== key && "form" !== key && key in node
  3397. ? (node[key] = newValue ?? "")
  3398. : null == newValue || !1 === newValue
  3399. ? node.removeAttribute(key)
  3400. : node.setAttribute(key, newValue)
  3401. },
  3402. createNode = (vdom, listener, isSvg) => {
  3403. var props = vdom.props,
  3404. node =
  3405. 3 === vdom.type
  3406. ? document.createTextNode(vdom.tag)
  3407. : (isSvg = isSvg || "svg" === vdom.tag)
  3408. ? document.createElementNS(
  3409. "http://www.w3.org/2000/svg",
  3410. vdom.tag,
  3411. props.is && props
  3412. )
  3413. : document.createElement(vdom.tag, props.is && props)
  3414. for (var k in props)
  3415. patchProperty(node, k, null, props[k], listener, isSvg)
  3416. for (var i = 0; i < vdom.children.length; i++)
  3417. node.appendChild(
  3418. createNode(
  3419. (vdom.children[i] = maybeVNode(vdom.children[i])),
  3420. listener,
  3421. isSvg
  3422. )
  3423. )
  3424. return (vdom.node = node)
  3425. },
  3426. patch = (parent, node, oldVNode, newVNode, listener, isSvg) => {
  3427. if (oldVNode === newVNode);
  3428. else if (null != oldVNode && 3 === oldVNode.type && 3 === newVNode.type)
  3429. oldVNode.tag !== newVNode.tag && (node.nodeValue = newVNode.tag)
  3430. else if (null == oldVNode || oldVNode.tag !== newVNode.tag) {
  3431. node = parent.insertBefore(
  3432. createNode((newVNode = maybeVNode(newVNode)), listener, isSvg),
  3433. node
  3434. )
  3435. null != oldVNode && parent.removeChild(oldVNode.node)
  3436. } else {
  3437. var tmpVKid,
  3438. oldVKid,
  3439. oldKey,
  3440. newKey,
  3441. oldProps = oldVNode.props,
  3442. newProps = newVNode.props,
  3443. oldVKids = oldVNode.children,
  3444. newVKids = newVNode.children,
  3445. oldHead = 0,
  3446. newHead = 0,
  3447. oldTail = oldVKids.length - 1,
  3448. newTail = newVKids.length - 1
  3449. isSvg = isSvg || "svg" === newVNode.tag
  3450. for (var i in { ...oldProps, ...newProps })
  3451. ("value" === i || "selected" === i || "checked" === i
  3452. ? node[i]
  3453. : oldProps[i]) !== newProps[i] &&
  3454. patchProperty(node, i, oldProps[i], newProps[i], listener, isSvg)
  3455. for (
  3456. ;
  3457. newHead <= newTail &&
  3458. oldHead <= oldTail &&
  3459. null != (oldKey = getKey(oldVKids[oldHead])) &&
  3460. oldKey === getKey(newVKids[newHead]);
  3461.  
  3462. )
  3463. patch(
  3464. node,
  3465. oldVKids[oldHead].node,
  3466. oldVKids[oldHead],
  3467. (newVKids[newHead] = maybeVNode(
  3468. newVKids[newHead++],
  3469. oldVKids[oldHead++]
  3470. )),
  3471. listener,
  3472. isSvg
  3473. )
  3474. for (
  3475. ;
  3476. newHead <= newTail &&
  3477. oldHead <= oldTail &&
  3478. null != (oldKey = getKey(oldVKids[oldTail])) &&
  3479. oldKey === getKey(newVKids[newTail]);
  3480.  
  3481. )
  3482. patch(
  3483. node,
  3484. oldVKids[oldTail].node,
  3485. oldVKids[oldTail],
  3486. (newVKids[newTail] = maybeVNode(
  3487. newVKids[newTail--],
  3488. oldVKids[oldTail--]
  3489. )),
  3490. listener,
  3491. isSvg
  3492. )
  3493. if (oldHead > oldTail)
  3494. for (; newHead <= newTail; )
  3495. node.insertBefore(
  3496. createNode(
  3497. (newVKids[newHead] = maybeVNode(newVKids[newHead++])),
  3498. listener,
  3499. isSvg
  3500. ),
  3501. (oldVKid = oldVKids[oldHead]) && oldVKid.node
  3502. )
  3503. else if (newHead > newTail)
  3504. for (; oldHead <= oldTail; )
  3505. node.removeChild(oldVKids[oldHead++].node)
  3506. else {
  3507. var keyed = {},
  3508. newKeyed = {}
  3509. for (i = oldHead; i <= oldTail; i++)
  3510. null != (oldKey = oldVKids[i].key) &&
  3511. (keyed[oldKey] = oldVKids[i])
  3512. for (; newHead <= newTail; ) {
  3513. oldKey = getKey((oldVKid = oldVKids[oldHead]))
  3514. newKey = getKey(
  3515. (newVKids[newHead] = maybeVNode(newVKids[newHead], oldVKid))
  3516. )
  3517. if (
  3518. newKeyed[oldKey] ||
  3519. (null != newKey && newKey === getKey(oldVKids[oldHead + 1]))
  3520. ) {
  3521. null == oldKey && node.removeChild(oldVKid.node)
  3522. oldHead++
  3523. } else if (null == newKey || 1 === oldVNode.type) {
  3524. if (null == oldKey) {
  3525. patch(
  3526. node,
  3527. oldVKid && oldVKid.node,
  3528. oldVKid,
  3529. newVKids[newHead],
  3530. listener,
  3531. isSvg
  3532. )
  3533. newHead++
  3534. }
  3535. oldHead++
  3536. } else {
  3537. if (oldKey === newKey) {
  3538. patch(
  3539. node,
  3540. oldVKid.node,
  3541. oldVKid,
  3542. newVKids[newHead],
  3543. listener,
  3544. isSvg
  3545. )
  3546. newKeyed[newKey] = !0
  3547. oldHead++
  3548. } else if (null != (tmpVKid = keyed[newKey])) {
  3549. patch(
  3550. node,
  3551. node.insertBefore(tmpVKid.node, oldVKid && oldVKid.node),
  3552. tmpVKid,
  3553. newVKids[newHead],
  3554. listener,
  3555. isSvg
  3556. )
  3557. newKeyed[newKey] = !0
  3558. } else
  3559. patch(
  3560. node,
  3561. oldVKid && oldVKid.node,
  3562. null,
  3563. newVKids[newHead],
  3564. listener,
  3565. isSvg
  3566. )
  3567. newHead++
  3568. }
  3569. }
  3570. for (; oldHead <= oldTail; )
  3571. null == getKey((oldVKid = oldVKids[oldHead++])) &&
  3572. node.removeChild(oldVKid.node)
  3573. for (var i in keyed)
  3574. null == newKeyed[i] && node.removeChild(keyed[i].node)
  3575. }
  3576. }
  3577. return (newVNode.node = node)
  3578. },
  3579. maybeVNode = (newVNode, oldVNode) =>
  3580. !0 !== newVNode && !1 !== newVNode && newVNode
  3581. ? "function" == typeof newVNode.tag
  3582. ? ((!oldVNode ||
  3583. null == oldVNode.memo ||
  3584. ((a, b) => {
  3585. for (var k in a) if (a[k] !== b[k]) return !0
  3586. for (var k in b) if (a[k] !== b[k]) return !0
  3587. })(oldVNode.memo, newVNode.memo)) &&
  3588. ((oldVNode = newVNode.tag(newVNode.memo)).memo = newVNode.memo),
  3589. oldVNode)
  3590. : newVNode
  3591. : hyperapp_text(""),
  3592. recycleNode = node =>
  3593. 3 === node.nodeType
  3594. ? hyperapp_text(node.nodeValue, node)
  3595. : createVNode(
  3596. node.nodeName.toLowerCase(),
  3597. EMPTY_OBJ,
  3598. hyperapp_map.call(node.childNodes, recycleNode),
  3599. 1,
  3600. node
  3601. ),
  3602. createVNode = (tag, { key, ...props }, children, type, node) => ({
  3603. tag,
  3604. props,
  3605. key,
  3606. children,
  3607. type,
  3608. node,
  3609. }),
  3610. hyperapp_text = (value, node) =>
  3611. createVNode(value, EMPTY_OBJ, EMPTY_ARR, 3, node),
  3612. h = (tag, { class: c, ...props }, children = EMPTY_ARR) =>
  3613. createVNode(
  3614. tag,
  3615. { ...props, ...(c ? { class: createClass(c) } : EMPTY_OBJ) },
  3616. isArray(children) ? children : [children]
  3617. ),
  3618. app = ({
  3619. node,
  3620. view,
  3621. subscriptions,
  3622. dispatch = hyperapp_id,
  3623. init = EMPTY_OBJ,
  3624. }) => {
  3625. var state,
  3626. busy,
  3627. vdom = node && recycleNode(node),
  3628. subs = [],
  3629. update = newState => {
  3630. if (state !== newState) {
  3631. null == (state = newState) &&
  3632. (dispatch = subscriptions = render = hyperapp_id)
  3633. subscriptions &&
  3634. (subs = ((oldSubs, newSubs = EMPTY_ARR, dispatch) => {
  3635. for (
  3636. var oldSub, newSub, subs = [], i = 0;
  3637. i < oldSubs.length || i < newSubs.length;
  3638. i++
  3639. ) {
  3640. oldSub = oldSubs[i]
  3641. newSub = newSubs[i]
  3642. subs.push(
  3643. newSub && !0 !== newSub
  3644. ? !oldSub ||
  3645. newSub[0] !== oldSub[0] ||
  3646. shouldRestart(newSub[1], oldSub[1])
  3647. ? [
  3648. newSub[0],
  3649. newSub[1],
  3650. (oldSub && oldSub[2](),
  3651. newSub[0](dispatch, newSub[1])),
  3652. ]
  3653. : oldSub
  3654. : oldSub && oldSub[2]()
  3655. )
  3656. }
  3657. return subs
  3658. })(subs, subscriptions(state), dispatch))
  3659. view && !busy && enqueue(render, (busy = !0))
  3660. }
  3661. },
  3662. render = () =>
  3663. (node = patch(
  3664. node.parentNode,
  3665. node,
  3666. vdom,
  3667. (vdom = view(state)),
  3668. listener,
  3669. (busy = !1)
  3670. )),
  3671. listener = function (event) {
  3672. dispatch(this.events[event.type], event)
  3673. }
  3674. return (
  3675. (dispatch = dispatch((action, props) =>
  3676. "function" == typeof action
  3677. ? dispatch(action(state, props))
  3678. : isArray(action)
  3679. ? "function" == typeof action[0]
  3680. ? dispatch(action[0], action[1])
  3681. : action
  3682. .slice(1)
  3683. .map(
  3684. fx => fx && !0 !== fx && (fx[0] || fx)(dispatch, fx[1]),
  3685. update(action[0])
  3686. )
  3687. : update(action)
  3688. ))(init),
  3689. dispatch
  3690. )
  3691. }
  3692. const makeRootComponent = x => tag => ({ tag, view: x(tag) }),
  3693. src_flip =
  3694. x =>
  3695. (...b) =>
  3696. (...a) =>
  3697. x(...a)(...b),
  3698. defaultText = {
  3699. setting: ["Settings", "設定"],
  3700. font: ["Font", "フォント"],
  3701. color: ["Color(Normal)", "色(通常)"],
  3702. ownerColor: ["Color(Owner)", "色(オーナー)"],
  3703. moderatorColor: ["Color(Moderator)", "色(モデレーター)"],
  3704. memberColor: ["Color(Member)", "色(メンバー)"],
  3705. feedback: ["Feedback", "バグ報告と要望"],
  3706. eventLog: ["Event log", "イベントログ"],
  3707. giveFeedback: [
  3708. "Give your feedbacks here(Please attach the event log if they're bug related)",
  3709. "バグ報告、要望はこちら(バグの場合は、イベントログを添付してください)",
  3710. ],
  3711. chatOpacity: ["Opacity", "不透明度"],
  3712. fontSize: ["Size", "サイズ"],
  3713. fontWeight: ["Weight", "太さ"],
  3714. shadowFontWeight: ["Weight(Shadow)", "太さ(影)"],
  3715. flowSpeed: ["Speed", "速度"],
  3716. maxChatCount: ["Max number of chats", "最大表示数"],
  3717. maxChatLength: ["Max number of characters", "最大文字数"],
  3718. laneCount: ["Number of rows", "行数"],
  3719. bannedWords: ["Banned Words", "NGワード"],
  3720. bannedWordRegexs: ["Banned Words(Regex)", "NGワード(正規表現)"],
  3721. bannedUsers: ["Banned Users", "NGユーザー"],
  3722. simplifyChatField: ["Simplify", "簡略化する"],
  3723. createBanButton: ["Show ban button", "NGボタンを表示する"],
  3724. displayModName: [
  3725. "Show moderator's name",
  3726. "モデレーターの名前を表示する",
  3727. ],
  3728. displaySuperChatAuthor: [
  3729. "Show super chat author",
  3730. "スパチャの作成者を表示する",
  3731. ],
  3732. createChats: ["Display flowing chats", "チャットを流す"],
  3733. textOnly: ["Text only(ignore emojis)", "文字のみ(絵文字を無視する)"],
  3734. error: ["Error", "エラー"],
  3735. video: ["Video", "画面"],
  3736. chatField: ["Chat Window", "チャット欄"],
  3737. useStepTiming: ["Move chat in steps", "チャットを段階的に動かす"],
  3738. timingStepCount: ["└Step Count", "└段階数"],
  3739. chatFilter: ["Chat Filter", "チャットフィルター"],
  3740. flowChat: ["Flow Chat", "チャット流れ"],
  3741. clearFlowChats: ["Clear Flowing Chats", "流れるチャットをクリアする"],
  3742. flowNewChatIf: [
  3743. "A new chat will appear if all of the followings are met:",
  3744. "新しいチャットは以下のすべてを満たす場合に流れます:",
  3745. ],
  3746. noOverlap: ["└Chats won't overlap", "└他のチャットと重ならない"],
  3747. minSpacing: ["Min spacing between chats", "チャットの最小間隔"],
  3748. fieldScale: ["Scale", "拡大率"],
  3749. copy: ["Copy", "コピーする"],
  3750. showChat: ["Show chats", "チャット非表示"],
  3751. hideChat: ["Hide chats", "チャット表示"],
  3752. flowY1: ["Flow area top edge", "流れ範囲の上端"],
  3753. flowY2: ["Flow area bottom edge", "流れ範囲の下端"],
  3754. flowX1: ["Flow area left edge", "流れ範囲の左端"],
  3755. flowX2: ["Flow area right edge", "流れ範囲の右端"],
  3756. shadowColor: ["Color(Shadow)", "色(影)"],
  3757. invalidColor: ["Invalid color", "無効な色"],
  3758. inputNonNumberic: ["Input isn't a number", "入力値が数字でない"],
  3759. invalidSetting: ["Invalid setting", "無効な設定値"],
  3760. },
  3761. getText = key => language =>
  3762. defaultText[key]["FYC_EN" === language ? 0 : 1],
  3763. languageLabels = ["English", "日本語"],
  3764. computed = {
  3765. useStepTiming: s => Boolean(s.timingFunction.match(/^steps\(.+/)),
  3766. },
  3767. getState = k => (k in computed ? computed[k] : s => s[k]),
  3768. toJsepExp_identifier = function_identity,
  3769. toJsepExp = x => {
  3770. return "Identifier" === x.type
  3771. ? toJsepExp_identifier(x)
  3772. : "ArrayExpression" === x.type
  3773. ? ((f = toJsepExp),
  3774. exp =>
  3775. function_pipe({
  3776. type: exp.type,
  3777. elements: function_pipe(
  3778. es6_ReadonlyArray_map(f)(exp.elements),
  3779. toArray
  3780. ),
  3781. }))(x)
  3782. : "MemberExpression" === x.type
  3783. ? (f => exp => ({
  3784. ...exp,
  3785. object: f(exp.object),
  3786. property: f(exp.property),
  3787. }))(toJsepExp)(x)
  3788. : "CallExpression" === x.type
  3789. ? (f => exp => ({
  3790. ...exp,
  3791. arguments: function_pipe(
  3792. exp.argument,
  3793. es6_Option_map(f),
  3794. es6_Option_map(ReadonlyArray_of),
  3795. es6_Option_map(toArray),
  3796. getOrElse(constant([]))
  3797. ),
  3798. callee: f(exp.callee),
  3799. }))(toJsepExp)(x)
  3800. : "Literal" === x.type
  3801. ? function_pipe(x.value, Editable_value, x => ({
  3802. type: "Literal",
  3803. value: x,
  3804. raw: JSON.stringify(x),
  3805. }))
  3806. : "LiteralArray" === x.type
  3807. ? {
  3808. type: "ArrayExpression",
  3809. elements: function_pipe(
  3810. x.value,
  3811. Editable_value,
  3812. es6_ReadonlyArray_map(
  3813. function_flow(x => ({
  3814. type: "Literal",
  3815. value: x,
  3816. raw: JSON.stringify(x),
  3817. }))
  3818. ),
  3819. toArray
  3820. ),
  3821. }
  3822. : (
  3823. f => exp =>
  3824. function_pipe({
  3825. type: exp.type,
  3826. body: function_pipe(
  3827. es6_ReadonlyArray_map(f)(exp.body),
  3828. toArray
  3829. ),
  3830. })
  3831. )(toJsepExp)(x)
  3832. var f
  3833. },
  3834. EditableExpression_toJsepExp = toJsepExp,
  3835. configEffect = (k, v) => setConfig => () => setConfig[k](v),
  3836. stepTiming = stepCount => `steps(${stepCount}, jump-end)`,
  3837. setComputed = {
  3838. useStepTiming: v => c => s =>
  3839. function_pipe(
  3840. v ? stepTiming(Editable_value(s.timingStepCount)) : "linear",
  3841. timingFunction => [
  3842. { ...s, timingFunction },
  3843. configEffect("timingFunction", timingFunction)(c.setConfig),
  3844. ]
  3845. ),
  3846. },
  3847. settingUI_setComputed = setComputed
  3848. var es6_Identity_map = function (f) {
  3849. return function (fa) {
  3850. return f(fa)
  3851. }
  3852. },
  3853. Identity_Functor = {
  3854. URI: "Identity",
  3855. map: function (fa, f) {
  3856. return function_pipe(fa, es6_Identity_map(f))
  3857. },
  3858. },
  3859. Identity_bindTo = bindTo(Identity_Functor),
  3860. Identity_let_ = let_(Identity_Functor)
  3861. const setRange = keyA => keyB => bFn => vA => c => s =>
  3862. function_pipe(
  3863. { a: Editable_value(vA) },
  3864. Identity_let_("b", ({ a }) => bFn(a)(Editable_value(s[keyB]))),
  3865. ({ a, b }) =>
  3866. function_pipe(
  3867. [configEffect(keyA, a), configEffect(keyB, b)],
  3868. Reader_sequenceArray,
  3869. es6_Reader_map(effects => [
  3870. { ...s, [keyA]: vA, [keyB]: setValue(b)(s[keyB]) },
  3871. ...effects,
  3872. ])
  3873. )(c.setConfig)
  3874. ),
  3875. setState = {
  3876. flowY1: setRange("flowY1")("flowY2")(a => b => Math.max(b, a + 0.05)),
  3877. flowY2: setRange("flowY2")("flowY1")(a => b => Math.min(b, a - 0.05)),
  3878. flowX1: setRange("flowX1")("flowX2")(a => b => Math.max(b, a + 0.05)),
  3879. flowX2: setRange("flowX2")("flowX1")(a => b => Math.min(b, a - 0.05)),
  3880. timingStepCount: v => c => s =>
  3881. function_pipe(stepTiming(Editable_value(v)), timingFunction => [
  3882. { ...s, timingStepCount: v, timingFunction },
  3883. configEffect("timingFunction", timingFunction)(c.setConfig),
  3884. ]),
  3885. },
  3886. settingUI_setState = setState,
  3887. settingUI_updateAt = (k, v) =>
  3888. function_pipe(
  3889. k in settingUI_setComputed
  3890. ? settingUI_setComputed[k](v)
  3891. : k in settingUI_setState
  3892. ? settingUI_setState[k](v)
  3893. : c => s =>
  3894. [
  3895. { ...s, [k]: v },
  3896. ...(k in c.setConfig
  3897. ? [
  3898. configEffect(
  3899. k,
  3900. Array.isArray(v) &&
  3901. 2 === v.length &&
  3902. isEditable(k)(v[0])
  3903. ? Editable_value(v)
  3904. : "filterExp" === k
  3905. ? EditableExpression_toJsepExp(v)
  3906. : v
  3907. )(c.setConfig),
  3908. ]
  3909. : []),
  3910. ]
  3911. ),
  3912. tapIs = constructor => x => {
  3913. assert_lib(x instanceof constructor)
  3914. return x
  3915. },
  3916. checkboxNode = label => c => s => {
  3917. return ((label, checked, onchange) =>
  3918. h(
  3919. "div",
  3920. {},
  3921. h("label", {}, [
  3922. hyperapp_text(label),
  3923. h("input", { type: "checkbox", checked, onchange }),
  3924. ])
  3925. ))(
  3926. getText(label)(s.lang),
  3927. getState(label)(s),
  3928. ((key = label),
  3929. src_flip((s, e) =>
  3930. function_pipe(
  3931. (e => tapIs(HTMLInputElement)(e.currentTarget).checked)(e),
  3932. x => settingUI_updateAt(key, x),
  3933. src_flip,
  3934. apply(s)
  3935. )
  3936. ))(c)
  3937. )
  3938. var key
  3939. },
  3940. updateInput = setter => key =>
  3941. src_flip((s, e) =>
  3942. function_pipe(
  3943. (e => {
  3944. const target = e.currentTarget ?? e.__target
  3945. if (
  3946. target instanceof HTMLSelectElement ||
  3947. target instanceof HTMLTextAreaElement ||
  3948. target instanceof HTMLInputElement
  3949. )
  3950. return target.value
  3951. throw Error("Event target type isn't acceptable.")
  3952. })(e),
  3953. setter,
  3954. apply(getState(key)(s)),
  3955. x => settingUI_updateAt(key, x),
  3956. src_flip,
  3957. apply(s)
  3958. )
  3959. ),
  3960. editAction = (key, setter) => c => ({
  3961. oninput: (s, e) => updateInput(setter(!0))(key)(c)(s, e),
  3962. onchange: (s, e) => updateInput(setter(!1))(key)(c)(s, e),
  3963. }),
  3964. setEditNumber = editing => value => state =>
  3965. function_pipe(
  3966. value,
  3967. Number.parseFloat,
  3968. editing
  3969. ? x =>
  3970. Number.isNaN(x) || "." === value.at(-1)
  3971. ? function_pipe(state, setText(value))
  3972. : fromValueText(x)(value)
  3973. : x =>
  3974. Number.isNaN(x)
  3975. ? function_pipe(
  3976. state,
  3977. mapSnd(constant(Option_some([value, Option_some("")])))
  3978. )
  3979. : Editable_of(x)
  3980. ),
  3981. errorText = subject => edit =>
  3982. function_pipe(
  3983. edit,
  3984. error,
  3985. es6_Option_map(x => `${subject}${"" === x ? "" : ": "}${x}`),
  3986. getOrElse(constant(""))
  3987. ),
  3988. rangeRow = (min, max, step, action) => value =>
  3989. h("div", {}, [
  3990. h("input", {
  3991. style: { width: "150px", verticalAlign: "middle" },
  3992. type: "range",
  3993. min,
  3994. max,
  3995. step,
  3996. value: Editable_value(value).toString(),
  3997. oninput: action.onchange,
  3998. }),
  3999. h("input", {
  4000. style: {
  4001. width: "30px",
  4002. backgroundColor: "transparent",
  4003. color: "inherit",
  4004. borderWidth: "1px",
  4005. verticalAlign: "middle",
  4006. borderColor: hasError(value) ? "#f55" : void 0,
  4007. },
  4008. inputmode: "decimal",
  4009. value: function_pipe(
  4010. value,
  4011. Editable_text,
  4012. getOrElse(
  4013. constant(
  4014. Editable_value(value)
  4015. .toFixed(4)
  4016. .replace(/\.?0+$/, "")
  4017. )
  4018. )
  4019. ),
  4020. ...action,
  4021. }),
  4022. ]),
  4023. settingRow = (label, error, content) =>
  4024. h("div", {}, [
  4025. h("span", {}, hyperapp_text(label)),
  4026. h(
  4027. "span",
  4028. {
  4029. style: {
  4030. color: "#f55",
  4031. marginLeft: "5px",
  4032. whiteSpace: "pre-wrap",
  4033. },
  4034. },
  4035. hyperapp_text(error)
  4036. ),
  4037. h("div", {}, content),
  4038. ]),
  4039. numberNode = (label, min, max, step) => c => s =>
  4040. settingRow(
  4041. getText(label)(s.lang),
  4042. errorText(getText("inputNonNumberic")(s.lang))(s[label]),
  4043. [
  4044. rangeRow(
  4045. min,
  4046. max,
  4047. step,
  4048. editAction(label, setEditNumber)(c)
  4049. )(getState(label)(s)),
  4050. ]
  4051. ),
  4052. panelBoxStyle = width => ({ flex: `0 0 ${width}px`, margin: "2px" }),
  4053. settingUI_chatFieldPanel = function_pipe(
  4054. [
  4055. function_pipe(
  4056. [
  4057. numberNode("fieldScale", 0.7, 1.5, 0.05),
  4058. checkboxNode("simplifyChatField"),
  4059. checkboxNode("createBanButton"),
  4060. ],
  4061. Reader_sequenceArray,
  4062. es6_Reader_map(Reader_sequenceArray),
  4063. es6_Reader_map(
  4064. es6_Reader_map(x => h("div", { style: panelBoxStyle(644) }, x))
  4065. )
  4066. ),
  4067. ],
  4068. Reader_sequenceArray,
  4069. es6_Reader_map(Reader_sequenceArray)
  4070. ),
  4071. action = {
  4072. copy: () => s => async () => {
  4073. GM.setClipboard(s.eventLog.join("\n"))
  4074. },
  4075. clearFlowChats: c => s => async () => {
  4076. c.act.clearFlowChats()
  4077. },
  4078. },
  4079. buttonNode = label => c => state =>
  4080. h(
  4081. "button",
  4082. { type: "button", onclick: s => [s, action[label](c)(s)] },
  4083. hyperapp_text(getText(label)(state.lang))
  4084. ),
  4085. tabContainer = style => ontabSelect => labels => tabs => mainTab =>
  4086. h("div", {}, [
  4087. h(
  4088. "div",
  4089. {},
  4090. function_pipe(
  4091. labels,
  4092. es6_ReadonlyArray_mapWithIndex((i, x) =>
  4093. h(
  4094. "span",
  4095. {
  4096. style: {
  4097. ...style.label,
  4098. ...(mainTab === i ? style.labelFocus : {}),
  4099. display: "inline-block",
  4100. },
  4101. onpointerdown: [ontabSelect, i],
  4102. },
  4103. hyperapp_text(x)
  4104. )
  4105. )
  4106. )
  4107. ),
  4108. h(
  4109. "div",
  4110. { style: { ...style.container, overflow: "hidden auto" } },
  4111. h(
  4112. "div",
  4113. { style: { ...style.tab } },
  4114. tabs.find((_, i) => i === mainTab)?.()
  4115. )
  4116. ),
  4117. ]),
  4118. feedbackPanel = c => s =>
  4119. function_pipe(
  4120. Math.trunc(getState("eventLog")(s).length / 100) + 1,
  4121. logPageLength => [
  4122. h("div", { style: panelBoxStyle(644) }, [
  4123. h(
  4124. "div",
  4125. { style: { float: "right" } },
  4126. h(
  4127. "a",
  4128. {
  4129. style: { color: "#f0f" },
  4130. href: "https://greasyfork.org/en/scripts/411442-flow-youtube-chat/feedback",
  4131. target: "_blank",
  4132. },
  4133. hyperapp_text(getText("giveFeedback")(s.lang))
  4134. )
  4135. ),
  4136. h("div", {}, [
  4137. h("span", {}, hyperapp_text(getText("eventLog")(s.lang))),
  4138. buttonNode("copy")(c)(s),
  4139. tabContainer({
  4140. container: { height: "276px" },
  4141. label: { padding: "4px", width: "2em", textAlign: "center" },
  4142. labelFocus: { background: "#666" },
  4143. tab: {
  4144. display: "flex",
  4145. flexDirection: "column",
  4146. padding: "6px",
  4147. },
  4148. })((_, n) => settingUI_updateAt("logTab", n)(c))(
  4149. function_pipe(
  4150. ReadonlyArray_makeBy(logPageLength, number_Show_show)
  4151. )
  4152. )(
  4153. function_pipe(
  4154. ReadonlyArray_makeBy(
  4155. logPageLength,
  4156. i => () =>
  4157. function_pipe(
  4158. getState("eventLog")(s).slice(100 * i, 100 * (i + 1)),
  4159. es6_ReadonlyArray_mapWithIndex((j, x) =>
  4160. h("div", { style: { display: "flex" } }, [
  4161. h(
  4162. "div",
  4163. {
  4164. style: {
  4165. userSelect: "none",
  4166. flex: "0 0 2em",
  4167. },
  4168. },
  4169. hyperapp_text(100 * i + j)
  4170. ),
  4171. h(
  4172. "div",
  4173. {
  4174. style: {
  4175. background: j % 2 == 0 ? "#fff" : "#ddd",
  4176. color: "#000",
  4177. flex: "auto",
  4178. wordBreak: "break-all",
  4179. padding: "0 2px",
  4180. },
  4181. },
  4182. hyperapp_text(x)
  4183. ),
  4184. ])
  4185. )
  4186. )
  4187. )
  4188. )
  4189. )(getState("logTab")(s)),
  4190. ]),
  4191. ]),
  4192. ]
  4193. ),
  4194. setEditRegexs = editing => value =>
  4195. function_pipe(
  4196. value,
  4197. split(/\r\n|\n/),
  4198. es6_ReadonlyArray_filter(Predicate_not(string_isEmpty)),
  4199. Identity_bindTo("regexs"),
  4200. Identity_let_("errors", ({ regexs }) => {
  4201. return function_pipe(
  4202. regexs,
  4203. es6_ReadonlyArray_mapWithIndex((i, x) => {
  4204. try {
  4205. RegExp(x, "u")
  4206. return Option_none
  4207. } catch (e) {
  4208. return Option_some(`${e} in regex number ${i}`)
  4209. }
  4210. }),
  4211. Monoid_concatAll(
  4212. ((S = { concat: (x, y) => `${x}\n${y}` }),
  4213. {
  4214. concat: function (x, y) {
  4215. return Option_isNone(x)
  4216. ? y
  4217. : Option_isNone(y)
  4218. ? x
  4219. : Option_some(S.concat(x.value, y.value))
  4220. },
  4221. empty: Option_none,
  4222. })
  4223. )
  4224. )
  4225. var S
  4226. }),
  4227. ctx =>
  4228. editing
  4229. ? setText(value)
  4230. : function_pipe(
  4231. ctx.errors,
  4232. es6_Option_map(x =>
  4233. mapSnd(() => Option_some([value, Option_some(x)]))
  4234. ),
  4235. getOrElse(constant(constant(Editable_of(ctx.regexs))))
  4236. )
  4237. ),
  4238. setEditStrings = editing => value =>
  4239. function_pipe(
  4240. value,
  4241. split(/\r\n|\n/),
  4242. es6_ReadonlyArray_filter(Predicate_not(string_isEmpty)),
  4243. x =>
  4244. constant(
  4245. editing ? [x, Option_some([value, Option_none])] : Editable_of(x)
  4246. )
  4247. ),
  4248. textAreaRow = (rows, action) => value =>
  4249. h("textarea", {
  4250. rows,
  4251. style: {
  4252. resize: "horizontal",
  4253. boxSizing: "border-box",
  4254. width: "100%",
  4255. borderColor: hasError(value) ? "#f55" : void 0,
  4256. },
  4257. value: function_pipe(
  4258. value,
  4259. Editable_text,
  4260. getOrElse(
  4261. function_pipe(Editable_value(value), x => x.join("\n"), constant)
  4262. )
  4263. ),
  4264. ...action,
  4265. }),
  4266. textAreaNode = (label, rows, setter) => c => s =>
  4267. settingRow(
  4268. getText(label)(s.lang),
  4269. errorText(getText("invalidSetting")(s.lang))(s[label]),
  4270. [textAreaRow(rows, editAction(label, setter)(c))(getState(label)(s))]
  4271. ),
  4272. filterPanelOld = c => s =>
  4273. [
  4274. h(
  4275. "div",
  4276. { style: panelBoxStyle(212) },
  4277. textAreaNode("bannedWords", 18, setEditStrings)(c)(s)
  4278. ),
  4279. h(
  4280. "div",
  4281. { style: panelBoxStyle(212) },
  4282. textAreaNode("bannedWordRegexs", 18, setEditRegexs)(c)(s)
  4283. ),
  4284. h(
  4285. "div",
  4286. { style: panelBoxStyle(212) },
  4287. textAreaNode("bannedUsers", 18, setEditStrings)(c)(s)
  4288. ),
  4289. ]
  4290. var validate_color_lib = __webpack_require__(90),
  4291. lib_default = __webpack_require__.n(validate_color_lib)
  4292. const validColor = x => lib_default()(x.replace(/grey/gi, "gray")),
  4293. setEditColor = editing => value =>
  4294. editing
  4295. ? validColor(value)
  4296. ? constant(fromValueText(value)(value))
  4297. : setText(value)
  4298. : validColor(value)
  4299. ? constant(Editable_of(value))
  4300. : mapSnd(constant(Option_some([value, Option_some("")]))),
  4301. colorPicker = action => color =>
  4302. h("input", {
  4303. style: { width: "36px", verticalAlign: "middle" },
  4304. type: "color",
  4305. value: color,
  4306. oninput: action.onchange,
  4307. }),
  4308. textInput = action => value =>
  4309. h("input", {
  4310. style: {
  4311. verticalAlign: "middle",
  4312. width: "5.5em",
  4313. borderColor: hasError(value) ? "#f55" : void 0,
  4314. },
  4315. maxlength: 20,
  4316. value: function_pipe(
  4317. value,
  4318. Editable_text,
  4319. getOrElse(constant(Editable_value(value)))
  4320. ),
  4321. ...action,
  4322. }),
  4323. setEditInt = editing => value => state =>
  4324. function_pipe(
  4325. value,
  4326. Number.parseInt,
  4327. editing
  4328. ? x =>
  4329. Number.isNaN(x) || "." === value.at(-1)
  4330. ? function_pipe(state, setText(value))
  4331. : fromValueText(x)(value)
  4332. : x =>
  4333. Number.isNaN(x)
  4334. ? function_pipe(
  4335. state,
  4336. mapSnd(constant(Option_some([value, Option_some("")])))
  4337. )
  4338. : Editable_of(x)
  4339. ),
  4340. intNode = (label, min, max, step) => c => s =>
  4341. settingRow(
  4342. getText(label)(s.lang),
  4343. errorText(getText("inputNonNumberic")(s.lang))(s[label]),
  4344. [
  4345. rangeRow(
  4346. min,
  4347. max,
  4348. step,
  4349. editAction(label, setEditInt)(c)
  4350. )(getState(label)(s)),
  4351. ]
  4352. ),
  4353. fonts = currentFont => [
  4354. ["", "Default", "デフォルト"],
  4355. ["arial", "Arial", "Arial"],
  4356. ["arial black", "Arial Black", "Arial Black"],
  4357. ["arial narrow", "Arial Narrow", "Arial Narrow"],
  4358. ["Century", "Century", "Century"],
  4359. ["Comic Sans MS", "Comic Sans MS", "Comic Sans MS"],
  4360. ["Courier", "Courier", "Courier"],
  4361. ["cursive", "cursive", "cursive"],
  4362. ["fantasy", "fantasy", "fantasy"],
  4363. ["Impact", "Impact", "Impact"],
  4364. ["Meiryo", "Meiryo", "メイリオ"],
  4365. ["Meiryo UI", "Meiryo UI", "メイリオ UI"],
  4366. ["monospace", "monospace", "monospace"],
  4367. ["Monotype Corsiva", "Monotype Corsiva", "Monotype Corsiva"],
  4368. ["MS PGothic", "MS PGothic", "MS Pゴシック"],
  4369. ["MS Gothic", "MS Gothic", "MS ゴシック"],
  4370. ["MS Sans Serif", "MS Sans Serif", "MS Sans Serif"],
  4371. ["MS Serif", "MS Serif", "MS Serif"],
  4372. ["MS UI Gothic", "MS UI Gothic", "MS UI Gothic"],
  4373. ["sans-serif", "Sans-serif", "Sans-serif"],
  4374. ["serif", "Serif", "Serif"],
  4375. ["Times New Roman", "Times New Roman", "Times New Roman"],
  4376. ["Yu Gothic", "Yu Gothic", "遊ゴシック"],
  4377. ["YuGothic", "YuGothic", "游ゴシック体"],
  4378. [currentFont, "Custom", "カスタム"],
  4379. ],
  4380. setEditString = editing =>
  4381. function_flow(x =>
  4382. constant(editing ? fromValueText(x)(x) : Editable_of(x))
  4383. ),
  4384. settingUI_textRowStyle = { width: "70%", boxSizing: "border-box" },
  4385. ui_option = (value, label, selected) =>
  4386. h("option", { value, selected }, hyperapp_text(label)),
  4387. exampleTextStyle = s => ({
  4388. fontFamily: Editable_value(s.font),
  4389. fontWeight: Editable_value(s.fontWeight).toString(),
  4390. textShadow: textShadow(Editable_value(s.shadowColor))(
  4391. Editable_value(s.shadowFontWeight)
  4392. ),
  4393. }),
  4394. colorTextOutput = textStyle => color =>
  4395. h(
  4396. "span",
  4397. { style: { ...textStyle, color } },
  4398. hyperapp_text("Aa1あア亜")
  4399. ),
  4400. textColorNode = label => c => s =>
  4401. settingRow(
  4402. getText(label)(s.lang),
  4403. errorText(getText("invalidColor")(s.lang))(s[label]),
  4404. function_pipe(
  4405. {
  4406. a: editAction(label, setEditColor)(c),
  4407. v: Editable_value(s[label]),
  4408. },
  4409. ({ a, v }) => [
  4410. colorPicker(a)(v),
  4411. textInput(a)(s[label]),
  4412. colorTextOutput(exampleTextStyle(s))(v),
  4413. ]
  4414. )
  4415. ),
  4416. flowChatPanel = function_pipe(
  4417. [
  4418. function_pipe(
  4419. [
  4420. c => s =>
  4421. function_pipe(Editable_value(s.font), font =>
  4422. settingRow(getText("font")(s.lang), "", [
  4423. h(
  4424. "select",
  4425. {
  4426. style: settingUI_textRowStyle,
  4427. onchange: updateInput(setEditString(!1))("font")(c),
  4428. },
  4429. function_pipe(
  4430. fonts(font),
  4431. findIndex(x => x[0] === font),
  4432. getOrElse(() => 0),
  4433. index =>
  4434. function_pipe(
  4435. fonts(font),
  4436. es6_ReadonlyArray_mapWithIndex((i, f) =>
  4437. ui_option(
  4438. f[0],
  4439. function_pipe(
  4440. languages,
  4441. findIndex(x => x === s.lang),
  4442. es6_Option_map(x => f[x + 1]),
  4443. getOrElse(() => "Error")
  4444. ),
  4445. i === index
  4446. )
  4447. )
  4448. )
  4449. )
  4450. ),
  4451. h("input", {
  4452. style: settingUI_textRowStyle,
  4453. maxlength: 20,
  4454. value: font,
  4455. ...editAction("font", setEditString),
  4456. }),
  4457. ])
  4458. ),
  4459. textColorNode("color"),
  4460. textColorNode("ownerColor"),
  4461. textColorNode("moderatorColor"),
  4462. textColorNode("memberColor"),
  4463. ((label = "shadowColor"),
  4464. c => s =>
  4465. settingRow(
  4466. getText(label)(s.lang),
  4467. errorText(getText("invalidColor")(s.lang))(s[label]),
  4468. function_pipe(editAction(label, setEditColor)(c), x => [
  4469. colorPicker(x)(Editable_value(s[label])),
  4470. textInput(x)(s[label]),
  4471. ])
  4472. )),
  4473. ],
  4474. Reader_sequenceArray,
  4475. es6_Reader_map(Reader_sequenceArray),
  4476. es6_Reader_map(
  4477. es6_Reader_map(x => h("div", { style: panelBoxStyle(212) }, x))
  4478. )
  4479. ),
  4480. function_pipe(
  4481. [
  4482. numberNode("chatOpacity", 0, 1, 0.05),
  4483. numberNode("fontSize", 0.3, 2, 0.05),
  4484. numberNode("fontWeight", 10, 1e3, 10),
  4485. numberNode("shadowFontWeight", 0, 3, 0.1),
  4486. numberNode("flowSpeed", 1, 50, 1),
  4487. intNode("maxChatCount", 5, 200, 5),
  4488. intNode("maxChatLength", 5, 200, 5),
  4489. intNode("laneCount", 1, 25, 1),
  4490. ],
  4491. Reader_sequenceArray,
  4492. es6_Reader_map(Reader_sequenceArray),
  4493. es6_Reader_map(
  4494. es6_Reader_map(x => h("div", { style: panelBoxStyle(212) }, x))
  4495. )
  4496. ),
  4497. function_pipe(
  4498. [
  4499. numberNode("flowY1", 0, 0.95, 0.01),
  4500. numberNode("flowY2", 0.05, 1, 0.01),
  4501. numberNode("flowX1", 0, 0.95, 0.01),
  4502. numberNode("flowX2", 0.05, 1, 0.01),
  4503. numberNode("minSpacing", 0, 2.5, 0.1),
  4504. c => s =>
  4505. h("div", {}, [
  4506. checkboxNode("useStepTiming")(c)(s),
  4507. h(
  4508. "div",
  4509. {
  4510. style: {
  4511. opacity: getState("useStepTiming")(s) ? void 0 : "0.5",
  4512. },
  4513. },
  4514. intNode("timingStepCount", 1, 400, 1)(c)(s)
  4515. ),
  4516. ]),
  4517. checkboxNode("createChats"),
  4518. checkboxNode("displayModName"),
  4519. checkboxNode("displaySuperChatAuthor"),
  4520. checkboxNode("textOnly"),
  4521. () => s => hyperapp_text(getText("flowNewChatIf")(s.lang)),
  4522. checkboxNode("noOverlap"),
  4523. buttonNode("clearFlowChats"),
  4524. ],
  4525. Reader_sequenceArray,
  4526. es6_Reader_map(Reader_sequenceArray),
  4527. es6_Reader_map(
  4528. es6_Reader_map(x => h("div", { style: panelBoxStyle(212) }, x))
  4529. )
  4530. ),
  4531. ],
  4532. Reader_sequenceArray,
  4533. es6_Reader_map(Reader_sequenceArray)
  4534. )
  4535. var label
  4536. const settingUI_flowChatPanel = flowChatPanel,
  4537. setString = function_flow(function_identity, constant),
  4538. simpleWrap = (comp, init) =>
  4539. function_pipe(
  4540. () => document.createElement(comp.tag),
  4541. chain(node => () => ({
  4542. node,
  4543. dispatch: app({ init, view: comp.view, node }),
  4544. }))
  4545. ),
  4546. toggleSettingsPanelButton = function_flow(
  4547. syncSettingState => (x, e) =>
  4548. function_pipe({ ...x, showPanel: !x.showPanel }, newState => [
  4549. newState,
  4550. x.showPanel
  4551. ? () => tapIs(HTMLElement)(e.currentTarget).blur()
  4552. : () => {},
  4553. syncSettingState(newState),
  4554. ]),
  4555. toggle => state =>
  4556. h(
  4557. "button",
  4558. {
  4559. class: "fyc_button",
  4560. style: {
  4561. background: "rgba(0,0,0,0)",
  4562. marginLeft: "10px",
  4563. whiteSpace: "nowrap",
  4564. },
  4565. onclick: toggle,
  4566. },
  4567. [
  4568. h(
  4569. "svg",
  4570. {
  4571. preserveAspectRatio: "xMidYMid meet",
  4572. viewBox: "0 0 640 640",
  4573. width: "15",
  4574. height: "15",
  4575. style: { position: "relative", top: "1px" },
  4576. },
  4577. [
  4578. h(
  4579. "defs",
  4580. {},
  4581. h("path", {
  4582. id: "d1TbzTC1zI",
  4583. d: "M135 58c25 14 67 30 82 35-7 49 16 109-15 149-50 71-19 184 64 213 74 31 165-18 183-95-3-38 23-62 58-36l120 55c-39 10-106 35-72 85 40 38 1 71-29 98-29 53-70-17-109-5-46 22-25 109-96 85h-55c-24-31-21-103-80-84-32 32-70 31-93-9l-35-36c4-40 57-96-6-120-45 5-58-32-52-68 2-19-4-41 3-59 35-15 100-22 77-79-48-43 1-84 35-115 5-6 12-12 20-14zM577 2c52 3 72 62 62 106-5 51 19 117-27 155-18 24 8 49 11 74-39-8-98-46-146-60-55-1-111 2-167-2-52-15-57-76-52-121S242 52 282 18c38-30 88-11 132-16h163z",
  4584. })
  4585. ),
  4586. h("use", {
  4587. href: "#d1TbzTC1zI",
  4588. opacity: "1",
  4589. fill: "var(--iron-icon-fill-color, currentcolor)",
  4590. "fill-opacity": "1",
  4591. }),
  4592. ]
  4593. ),
  4594. h(
  4595. "span",
  4596. {
  4597. style: {
  4598. position: "relative",
  4599. top: "-2px",
  4600. marginLeft: "8px,",
  4601. },
  4602. },
  4603. hyperapp_text(getText("setting")(state.lang))
  4604. ),
  4605. ]
  4606. )
  4607. ),
  4608. toggleSettingsPanelComponent = function_flow(
  4609. toggleSettingsPanelButton,
  4610. button =>
  4611. makeRootComponent(
  4612. tag => s => h(tag, { style: { display: "flex" } }, button(s))
  4613. )("span")
  4614. ),
  4615. initialize = () =>
  4616. function_pipe(
  4617. defaultUserConfig,
  4618. function_flow(
  4619. Task_bindTo("userConfig"),
  4620. Task_let_("configKeys", x => Object.keys(x.userConfig)),
  4621. Task_let_("getConfig", ctx =>
  4622. function_pipe(
  4623. ctx.configKeys,
  4624. es6_ReadonlyArray_map(x => [x, () => ctx.userConfig[x].val]),
  4625. Object.fromEntries
  4626. )
  4627. ),
  4628. Task_let_("mainState", x => ({
  4629. chatPlaying: !0,
  4630. playerRect: new DOMRect(0, 0, 600, 400),
  4631. getConfig: x.getConfig,
  4632. })),
  4633. Task_let_("configSubject", ctx =>
  4634. function_pipe(
  4635. ctx.configKeys,
  4636. es6_ReadonlyArray_map(x => [
  4637. x,
  4638. new external_rxjs_namespaceObject.Subject(),
  4639. ]),
  4640. Object.fromEntries
  4641. )
  4642. ),
  4643. Task_let_("setConfigPlain", ctx =>
  4644. function_pipe(
  4645. ctx.configKeys,
  4646. es6_ReadonlyArray_map(x => [
  4647. x,
  4648. async val => {
  4649. ctx.userConfig[x].val = val
  4650. ctx.configSubject[x].next(val)
  4651. },
  4652. ]),
  4653. Object.fromEntries
  4654. )
  4655. ),
  4656. Task_apS(
  4657. "channel",
  4658. Task_of(
  4659. new broadcast_channel_BroadcastChannel("fyc-0615654655528523")
  4660. )
  4661. ),
  4662. Task_let_("setConfig", ctx =>
  4663. function_pipe(
  4664. ctx.configKeys,
  4665. es6_ReadonlyArray_map(x => [
  4666. x,
  4667. async val => {
  4668. if (fast_deep_equal_default()(ctx.getConfig[x](), val))
  4669. return
  4670. ctx.setConfigPlain[x](val)
  4671. const item = ctx.userConfig[x]
  4672. ctx.channel.postMessage([x, val])
  4673. GM.setValue(item.gmKey, item.toGm(val))
  4674. },
  4675. ]),
  4676. Object.fromEntries
  4677. )
  4678. )
  4679. ),
  4680. function_flow(
  4681. function_flow(
  4682. Task_apS(
  4683. "reinitSubject",
  4684. Task_fromIO(() => new external_rxjs_namespaceObject.Subject())
  4685. ),
  4686. Task_let_("reinitialize", ctx => () => {
  4687. requestAnimationFrame(() => lib(ctx.reinitSubject)())
  4688. }),
  4689. Task_let_("toggleChatButtonInit", ctx => ({
  4690. lang: ctx.getConfig.lang(),
  4691. displayChats: ctx.getConfig.displayChats(),
  4692. })),
  4693. Task_let_("wrappedToggleChat", ctx => {
  4694. return simpleWrap(
  4695. ((setConfig = ctx.setConfig),
  4696. function_pipe(
  4697. "button",
  4698. makeRootComponent(
  4699. tag => state =>
  4700. function_pipe(
  4701. getText(state.displayChats ? "hideChat" : "showChat")(
  4702. state.lang
  4703. ),
  4704. label =>
  4705. h(
  4706. tag,
  4707. {
  4708. class: "ytp-button",
  4709. style: {
  4710. background: "none",
  4711. border: "none",
  4712. cursor: "pointer",
  4713. float: "left",
  4714. fontSize: "1em",
  4715. height: "4em",
  4716. outline: "none",
  4717. overflow: "visible",
  4718. padding: "0 0 0em",
  4719. position: "relative",
  4720. width: "3em",
  4721. },
  4722. type: "button",
  4723. "aria-label": label,
  4724. title: label,
  4725. onclick: s =>
  4726. function_pipe(
  4727. !s.displayChats,
  4728. displayChats => [
  4729. { ...s, displayChats },
  4730. () =>
  4731. setConfig.displayChats(displayChats),
  4732. ]
  4733. ),
  4734. },
  4735. [
  4736. h(
  4737. "svg",
  4738. {
  4739. style: { width: "100%" },
  4740. viewBox: "0 0 36 36",
  4741. },
  4742. [
  4743. h("path", {
  4744. class: "chat-button-path",
  4745. d: "m11 12h17q1 0 1 1v9q0 1-1 1h-1v2l-4-2h-12q-1 0-1-1v-9q0-1 1-1z",
  4746. fill: "#fff",
  4747. "fill-opacity": state.displayChats
  4748. ? "1"
  4749. : "0",
  4750. stroke: "#fff",
  4751. "stroke-width": "2",
  4752. }),
  4753. ]
  4754. ),
  4755. ]
  4756. )
  4757. )
  4758. )
  4759. )),
  4760. ctx.toggleChatButtonInit
  4761. )()
  4762. var setConfig
  4763. }),
  4764. Task_apS("flowChats", Task_of([])),
  4765. Task_apS("settingUpdateApps", Task_of([])),
  4766. Task_let_(
  4767. "updateSettingState",
  4768. ctx => dispatchable =>
  4769. function_pipe(
  4770. ctx.settingUpdateApps,
  4771. es6_ReadonlyArray_map(x => () => x(dispatchable)),
  4772. sequenceArray
  4773. )
  4774. ),
  4775. Task_let_("wrappedSettings", ctx =>
  4776. simpleWrap(
  4777. function_pipe(
  4778. (c =>
  4779. function_flow(state =>
  4780. state.showPanel
  4781. ? h(
  4782. "div",
  4783. {
  4784. class: "fyc_panel",
  4785. style: {
  4786. backgroundColor: "rgba(30,30,30,0.9)",
  4787. position: "absolute",
  4788. zIndex: "10000",
  4789. color: "#fff",
  4790. fontSize: "14px",
  4791. width: "660px",
  4792. height: "395px",
  4793. border: "solid 1px #666",
  4794. fontFamily: "MS PGothic",
  4795. lineHeight: "1.2",
  4796. colorScheme: "dark",
  4797. },
  4798. },
  4799. [
  4800. h(
  4801. "div",
  4802. {
  4803. style: {
  4804. position: "absolute",
  4805. inset: "3px 3px auto auto",
  4806. },
  4807. },
  4808. [
  4809. hyperapp_text("🌐"),
  4810. h(
  4811. "select",
  4812. {
  4813. onchange:
  4814. updateInput(setString)("lang")(c),
  4815. },
  4816. function_pipe(
  4817. languages,
  4818. es6_ReadonlyArray_mapWithIndex(
  4819. (i, lang) =>
  4820. ui_option(
  4821. lang,
  4822. languageLabels[i],
  4823. lang === state.lang
  4824. )
  4825. )
  4826. )
  4827. ),
  4828. ]
  4829. ),
  4830. tabContainer({
  4831. container: { height: "364px" },
  4832. label: { padding: "6px" },
  4833. labelFocus: { background: "#666" },
  4834. tab: { display: "flex", padding: "6px" },
  4835. })((s, n) =>
  4836. settingUI_updateAt("mainTab", n)(c)(s)
  4837. )(
  4838. function_pipe(
  4839. [
  4840. "flowChat",
  4841. "chatFilter",
  4842. "chatField",
  4843. "feedback",
  4844. ],
  4845. es6_ReadonlyArray_map(getText),
  4846. es6_ReadonlyArray_map(apply(state.lang))
  4847. )
  4848. )(
  4849. function_pipe(
  4850. [
  4851. settingUI_flowChatPanel,
  4852. filterPanelOld,
  4853. settingUI_chatFieldPanel,
  4854. feedbackPanel,
  4855. ],
  4856. es6_ReadonlyArray_map(apply(c)),
  4857. es6_ReadonlyArray_map(constant),
  4858. es6_ReadonlyArray_map(src_flip),
  4859. es6_ReadonlyArray_map(apply(state))
  4860. )
  4861. )(getState("mainTab")(state)),
  4862. ]
  4863. )
  4864. : h("div", {})
  4865. ))({
  4866. setConfig: ctx.setConfig,
  4867. act: {
  4868. clearFlowChats: Task_fromIO(
  4869. removeOldChats(0)(ctx.flowChats)
  4870. ),
  4871. },
  4872. }),
  4873. panel =>
  4874. makeRootComponent(
  4875. tag => s =>
  4876. h(tag, { style: { position: "absolute" } }, panel(s))
  4877. )("span")
  4878. ),
  4879. settingStateInit(ctx.getConfig)
  4880. )()
  4881. ),
  4882. Task_let_("wrappedToggleSettings", ctx =>
  4883. simpleWrap(
  4884. toggleSettingsPanelComponent(ctx.updateSettingState),
  4885. settingStateInit(ctx.getConfig)
  4886. )()
  4887. )
  4888. ),
  4889. Task_chainFirstIOK(
  4890. ctx => () =>
  4891. ctx.settingUpdateApps.push(
  4892. ctx.wrappedSettings.dispatch,
  4893. ctx.wrappedToggleSettings.dispatch
  4894. )
  4895. ),
  4896. Task_apS("lastSettingsPosition", Task_of({ top: 0, left: 0 })),
  4897. Task_let_(
  4898. "getNewSettingsPosition",
  4899. ctx => () =>
  4900. function_pipe(
  4901. ctx.wrappedToggleSettings.node,
  4902. fromPredicate(x => null !== x.offsetParent),
  4903. es6_Option_map(x => x.getBoundingClientRect()),
  4904. es6_Option_map(x => ({
  4905. top: x.top + window.scrollY - 395,
  4906. left: x.right + window.scrollX - 660,
  4907. })),
  4908. alt(() => Option_some({ top: -395, left: -660 })),
  4909. filter(
  4910. x =>
  4911. x.top !== ctx.lastSettingsPosition.top ||
  4912. x.left !== ctx.lastSettingsPosition.left
  4913. )
  4914. )
  4915. ),
  4916. Task_let_("updateSettingsPosition", ctx =>
  4917. function_pipe(
  4918. ctx.getNewSettingsPosition,
  4919. IOOption_chainFirstIOK(
  4920. x => () =>
  4921. Object.assign(ctx.wrappedSettings.node.style, {
  4922. top: `${x.top}px`,
  4923. left: `${x.left}px`,
  4924. })
  4925. ),
  4926. IOOption_chainFirstIOK(x => () => {
  4927. ctx.lastSettingsPosition.top = x.top
  4928. ctx.lastSettingsPosition.left = x.left
  4929. }),
  4930. chain(() => () => {})
  4931. )
  4932. ),
  4933. Task_let_(
  4934. "mainLog",
  4935. ctx => x =>
  4936. ctx.updateSettingState(s => ({
  4937. ...s,
  4938. eventLog: appendLog(s.eventLog)(x),
  4939. }))
  4940. ),
  4941. Task_let_("mixLog", ctx =>
  4942. function_pipe(
  4943. [ctx.mainLog, consoleLog],
  4944. Reader_sequenceArray,
  4945. es6_Reader_map(sequenceArray)
  4946. )
  4947. )
  4948. ),
  4949. Task_chainFirstIOK(ctx =>
  4950. function_pipe(
  4951. [
  4952. ["Version", "1.15.13"],
  4953. ["User Agent", window.navigator.userAgent],
  4954. ["UserConfig", JSON.stringify(ctx.userConfig)],
  4955. ],
  4956. es6_ReadonlyArray_map(ctx.mainLog),
  4957. sequenceArray
  4958. )
  4959. ),
  4960. Task_let_("cs", ctx =>
  4961. function_pipe(
  4962. ctx.configSubject,
  4963. x => Object.entries(x),
  4964. es6_ReadonlyArray_map(([k, value]) => [
  4965. k,
  4966. function_pipe(
  4967. value,
  4968. (0, external_rxjs_namespaceObject.tap)(v =>
  4969. function_pipe(
  4970. v,
  4971. x => s => ({ ...s, [k]: x }),
  4972. of,
  4973. IO_chainFirst(() => {
  4974. return ctx.updateSettingState(
  4975. ((key = k),
  4976. value => state => ({
  4977. ...state,
  4978. [key]: isEditable(key)(value)
  4979. ? setValue(value)(state[key])
  4980. : "filterExp" === key
  4981. ? function_pipe(
  4982. EditableExpression_fromJsepExp(value),
  4983. getOrElseW(() => ({
  4984. type: "Compound",
  4985. body: [],
  4986. }))
  4987. )
  4988. : value,
  4989. }))(v)
  4990. )
  4991. var key
  4992. }),
  4993. chain(x =>
  4994. k in ctx.toggleChatButtonInit
  4995. ? () => ctx.wrappedToggleChat.dispatch(x)
  4996. : () => {}
  4997. ),
  4998. x => () => requestAnimationFrame(x)
  4999. )()
  5000. )
  5001. ),
  5002. ]),
  5003. Object.fromEntries
  5004. )
  5005. ),
  5006. Task_apS("livePage", Task_fromIO(livePageYt)),
  5007. Task_let_("liveElementKeys", ctx => Object.keys(ctx.livePage)),
  5008. Task_let_("live", ctx =>
  5009. function_pipe(
  5010. key => ({ ele: Option_none, read: ctx.livePage[key] }),
  5011. initState =>
  5012. function_pipe(
  5013. ctx.liveElementKeys,
  5014. es6_ReadonlyArray_map(x => [x, initState(x)]),
  5015. Object.fromEntries
  5016. )
  5017. )
  5018. ),
  5019. Task_apS("chatScreen", Task_fromIO(createChatScreen)),
  5020. Task_let_("config$", ctx =>
  5021. function_pipe(ctx.cs, cs =>
  5022. (0, external_rxjs_namespaceObject.defer)(() =>
  5023. (0, external_rxjs_namespaceObject.merge)(
  5024. (0, external_rxjs_namespaceObject.merge)(
  5025. cs.bannedWordRegexs,
  5026. cs.bannedWords,
  5027. cs.bannedUsers
  5028. ),
  5029. function_pipe(
  5030. cs.fieldScale,
  5031. (0, external_rxjs_namespaceObject.startWith)(
  5032. ctx.getConfig.fieldScale()
  5033. ),
  5034. (0, external_rxjs_namespaceObject.tap)(scale =>
  5035. function_pipe(
  5036. ctx.live.chatField.ele,
  5037. fromOption,
  5038. IOOption_chainIOK(
  5039. field => () =>
  5040. function_pipe(
  5041. [
  5042. function_pipe(
  5043. fromNullable(field.parentElement),
  5044. es6_Option_map(
  5045. x => () =>
  5046. Object.assign(x.style, {
  5047. transformOrigin:
  5048. (scale >= 1 ? "top" : "bottom") +
  5049. " left",
  5050. transform: `scale(${scale})`,
  5051. width: 100 / scale + "%",
  5052. height: 100 / scale + "%",
  5053. })
  5054. )
  5055. ),
  5056. function_pipe(
  5057. ctx.live.chatScroller.ele,
  5058. es6_Option_map(scroller => () => {
  5059. scroller.scrollTop = scroller.scrollHeight
  5060. })
  5061. ),
  5062. ],
  5063. ReadonlyArray_compact,
  5064. sequenceArray
  5065. )
  5066. )
  5067. )()
  5068. )
  5069. ),
  5070. function_pipe(
  5071. (0, external_rxjs_namespaceObject.merge)(
  5072. function_pipe(
  5073. (0, external_rxjs_namespaceObject.merge)(
  5074. cs.font,
  5075. cs.fontSize,
  5076. cs.fontWeight,
  5077. cs.laneCount,
  5078. cs.minSpacing,
  5079. cs.flowY1,
  5080. cs.flowY2,
  5081. function_pipe(
  5082. cs.flowX1,
  5083. (0, external_rxjs_namespaceObject.startWith)(
  5084. ctx.getConfig.flowX1()
  5085. ),
  5086. (0, external_rxjs_namespaceObject.tap)(x =>
  5087. Object.assign(ctx.chatScreen.style, {
  5088. left: 100 * x + "%",
  5089. width: 100 * (ctx.getConfig.flowX2() - x) + "%",
  5090. })
  5091. )
  5092. ),
  5093. function_pipe(
  5094. cs.flowX2,
  5095. (0, external_rxjs_namespaceObject.tap)(x =>
  5096. Object.assign(ctx.chatScreen.style, {
  5097. left: 100 * ctx.getConfig.flowX1() + "%",
  5098. width: 100 * (x - ctx.getConfig.flowX1()) + "%",
  5099. })
  5100. )
  5101. ),
  5102. cs.textOnly
  5103. ),
  5104. (0, external_rxjs_namespaceObject.map)(() => ({
  5105. render: !0,
  5106. setAnimation: !0,
  5107. }))
  5108. ),
  5109. function_pipe(
  5110. (0, external_rxjs_namespaceObject.merge)(
  5111. cs.color,
  5112. cs.ownerColor,
  5113. cs.moderatorColor,
  5114. cs.memberColor,
  5115. cs.shadowColor,
  5116. cs.chatOpacity,
  5117. cs.shadowFontWeight,
  5118. cs.displayChats
  5119. ),
  5120. (0, external_rxjs_namespaceObject.map)(() => ({
  5121. render: !0,
  5122. }))
  5123. ),
  5124. function_pipe(
  5125. cs.flowSpeed,
  5126. (0, external_rxjs_namespaceObject.map)(() => ({
  5127. setPlayState: !0,
  5128. }))
  5129. ),
  5130. function_pipe(
  5131. (0, external_rxjs_namespaceObject.merge)(
  5132. function_pipe(
  5133. cs.maxChatCount,
  5134. (0, external_rxjs_namespaceObject.tap)(x =>
  5135. removeOldChats(x)(ctx.flowChats)()
  5136. )
  5137. ),
  5138. cs.noOverlap,
  5139. cs.timingFunction
  5140. ),
  5141. (0, external_rxjs_namespaceObject.map)(() => ({
  5142. setAnimation: !0,
  5143. }))
  5144. )
  5145. ),
  5146. (0, external_rxjs_namespaceObject.throttleTime)(
  5147. 180,
  5148. void 0,
  5149. { leading: !0, trailing: !0 }
  5150. ),
  5151. (0, external_rxjs_namespaceObject.tap)(config =>
  5152. function_pipe(
  5153. ctx.flowChats,
  5154. es6_ReadonlyArray_filter(x => !x.animationEnded),
  5155. es6_ReadonlyArray_map(chat =>
  5156. function_pipe(
  5157. {
  5158. render: !1,
  5159. setAnimation: !1,
  5160. setPlayState: !1,
  5161. ...config,
  5162. },
  5163. x =>
  5164. function_pipe(
  5165. [
  5166. function_pipe(
  5167. renderChat(chat),
  5168. fromPredicate(() => x.render)
  5169. ),
  5170. function_pipe(
  5171. setChatAnimation(chat, ctx.flowChats),
  5172. fromPredicate(() => x.setAnimation),
  5173. alt(() =>
  5174. function_pipe(
  5175. setChatPlayState(chat),
  5176. fromPredicate(() => x.setPlayState)
  5177. )
  5178. )
  5179. ),
  5180. ],
  5181. ReadonlyArray_compact,
  5182. es6_ReadonlyArray_map(apply(ctx.mainState)),
  5183. sequenceArray
  5184. )
  5185. )
  5186. ),
  5187. sequenceArray
  5188. )()
  5189. )
  5190. ),
  5191. function_pipe(
  5192. cs.lang,
  5193. (0, external_rxjs_namespaceObject.tap)(lang =>
  5194. ctx.updateSettingState(x => ({ ...x, lang }))()
  5195. )
  5196. ),
  5197. cs.maxChatLength,
  5198. cs.simplifyChatField,
  5199. cs.createBanButton,
  5200. cs.createChats,
  5201. cs.displayModName,
  5202. cs.displaySuperChatAuthor,
  5203. cs.fieldScale,
  5204. function_pipe(
  5205. (0, external_rxjs_namespaceObject.merge)(
  5206. cs.bannedWords,
  5207. cs.bannedWordRegexs,
  5208. cs.bannedUsers
  5209. ),
  5210. (0, external_rxjs_namespaceObject.tap)(() => {
  5211. return ctx.setConfig.filterExp(
  5212. ((getConfig = ctx.getConfig),
  5213. external_jsep_default()(
  5214. `\nor([\nRA.some(\n flip(flow([inText, RA.some]))(${JSON.stringify(
  5215. getConfig.bannedWords()
  5216. )})\n)(RA.compact([\n messageText,\n paymentInfo\n])),\nRA.some(\n flip(flow([matchedByText, RA.some]))(${JSON.stringify(
  5217. getConfig.bannedWordRegexs()
  5218. )})\n)(RA.compact([\n messageText,\n paymentInfo\n])),\nO.exists(\n flip(flow([eqText, RA.some]))(${JSON.stringify(
  5219. getConfig.bannedUsers()
  5220. )})\n)(authorID)\n])\n`
  5221. ))
  5222. )
  5223. var getConfig
  5224. })
  5225. )
  5226. )
  5227. )
  5228. )
  5229. ),
  5230. Task_bind("all$", ctx => {
  5231. return function_pipe(
  5232. {
  5233. eq: ((E = eqStrict),
  5234. {
  5235. equals: function (x, y) {
  5236. return (
  5237. x === y ||
  5238. (Option_isNone(x)
  5239. ? Option_isNone(y)
  5240. : !Option_isNone(y) && E.equals(x.value, y.value))
  5241. )
  5242. },
  5243. }).equals,
  5244. initDelay: 100,
  5245. urlDelay: 1700,
  5246. changeDetectInterval: 700,
  5247. bodyResizeDetectInterval: 300,
  5248. errorRetryInterval: 5e3,
  5249. },
  5250. of,
  5251. IO_apS("css", mainCss),
  5252. IO_apS("documentMutationPair", observePair(MutationObserver)),
  5253. IO_apS("chatMutationPair", observePair(MutationObserver)),
  5254. IO_apS("playerResizePair", observePair(ResizeObserver)),
  5255. IO_apS("bodyResizePair", observePair(ResizeObserver)),
  5256. IO_map(c =>
  5257. function_pipe(
  5258. ctx.reinitSubject,
  5259. (0, external_rxjs_namespaceObject.observeOn)(
  5260. external_rxjs_namespaceObject.asyncScheduler
  5261. ),
  5262. (0, external_rxjs_namespaceObject.delay)(c.initDelay),
  5263. (0, external_rxjs_namespaceObject.tap)(ctx.mixLog(["Init"])),
  5264. (0, external_rxjs_namespaceObject.switchMap)(() =>
  5265. function_pipe(
  5266. (0, external_rxjs_namespaceObject.interval)(
  5267. c.changeDetectInterval
  5268. ),
  5269. (0, external_rxjs_namespaceObject.tap)(
  5270. ctx.updateSettingsPosition
  5271. ),
  5272. (0, external_rxjs_namespaceObject.filter)(() =>
  5273. function_pipe(
  5274. ctx.liveElementKeys,
  5275. es6_ReadonlyArray_map(key =>
  5276. function_pipe(
  5277. ctx.live[key].read(),
  5278. fromPredicate(
  5279. newEle => !c.eq(ctx.live[key].ele, newEle)
  5280. ),
  5281. es6_Option_map(
  5282. function_flow(
  5283. of,
  5284. IO_chainFirst(x => () => {
  5285. ctx.live[key].ele = x
  5286. }),
  5287. IO_apSecond(ctx.mixLog([`${key} changed`]))
  5288. )
  5289. )
  5290. )
  5291. ),
  5292. ReadonlyArray_compact,
  5293. sequenceArray,
  5294. IO_map(ReadonlyArray_isNonEmpty)
  5295. )()
  5296. ),
  5297. (0, external_rxjs_namespaceObject.startWith)(0)
  5298. )
  5299. ),
  5300. (0, external_rxjs_namespaceObject.tap)(
  5301. ctx.mixLog(["Loading..."])
  5302. ),
  5303. (0, external_rxjs_namespaceObject.tap)(() => {
  5304. removeOldChats(0)(ctx.flowChats)()
  5305. c.documentMutationPair.observer.disconnect()
  5306. c.documentMutationPair.observer.observe(document, {
  5307. childList: !0,
  5308. subtree: !0,
  5309. })
  5310. c.chatMutationPair.observer.disconnect()
  5311. c.playerResizePair.observer.disconnect()
  5312. c.bodyResizePair.observer.disconnect()
  5313. document.head.append(c.css)
  5314. function_pipe(
  5315. [
  5316. function_pipe(
  5317. ctx.live.chatField.ele,
  5318. es6_Option_map(
  5319. function_flow(
  5320. of,
  5321. IO_chainFirst(setChatAppCss),
  5322. chain(
  5323. x => () =>
  5324. c.chatMutationPair.observer.observe(x, {
  5325. childList: !0,
  5326. })
  5327. )
  5328. )
  5329. )
  5330. ),
  5331. function_pipe(
  5332. ctx.live.chatTicker.ele,
  5333. es6_Option_map(
  5334. x => () =>
  5335. c.chatMutationPair.observer.observe(x, {
  5336. childList: !0,
  5337. })
  5338. )
  5339. ),
  5340. function_pipe(
  5341. ctx.live.player.ele,
  5342. es6_Option_map(
  5343. function_flow(
  5344. of,
  5345. IO_chainFirst(
  5346. x => () =>
  5347. c.playerResizePair.observer.observe(x)
  5348. ),
  5349. chain(
  5350. x => () =>
  5351. x.insertAdjacentElement(
  5352. "afterbegin",
  5353. ctx.chatScreen
  5354. )
  5355. )
  5356. )
  5357. )
  5358. ),
  5359. function_pipe(
  5360. ctx.live.toggleChatBtnParent.ele,
  5361. es6_Option_map(
  5362. x => () => x.append(ctx.wrappedToggleChat.node)
  5363. )
  5364. ),
  5365. function_pipe(
  5366. ctx.live.settingsToggleNextElement.ele,
  5367. es6_Option_map(
  5368. x => () =>
  5369. x.insertAdjacentElement(
  5370. "beforebegin",
  5371. ctx.wrappedToggleSettings.node
  5372. )
  5373. )
  5374. ),
  5375. function_pipe(
  5376. ctx.live.settingsContainer.ele,
  5377. es6_Option_map(
  5378. function_flow(
  5379. of,
  5380. IO_chainFirst(
  5381. x => () => x.append(ctx.wrappedSettings.node)
  5382. )
  5383. )
  5384. )
  5385. ),
  5386. function_pipe(
  5387. document.body,
  5388. fromNullable,
  5389. es6_Option_map(
  5390. x => () => c.bodyResizePair.observer.observe(x)
  5391. )
  5392. ),
  5393. ],
  5394. ReadonlyArray_compact,
  5395. ReadonlyArray_append(
  5396. function_pipe(
  5397. ctx.live.video.ele,
  5398. filter(x => !x.paused),
  5399. alt(() => ctx.live.offlineSlate.ele),
  5400. Option_isSome,
  5401. x => () => {
  5402. ctx.mainState.chatPlaying = x
  5403. }
  5404. )
  5405. ),
  5406. sequenceArray
  5407. )()
  5408. }),
  5409. (0, external_rxjs_namespaceObject.switchMap)(() =>
  5410. (0, external_rxjs_namespaceObject.merge)(
  5411. function_pipe(
  5412. (0, external_rxjs_namespaceObject.fromEvent)(
  5413. ctx.channel,
  5414. "message"
  5415. ),
  5416. (0, external_rxjs_namespaceObject.tap)(([key, val]) =>
  5417. function_pipe(
  5418. [
  5419. "lang",
  5420. "bannedWords",
  5421. "bannedWordRegexs",
  5422. "bannedUsers",
  5423. "filterExp",
  5424. "simplifyChatField",
  5425. "createBanButton",
  5426. "fieldScale",
  5427. ],
  5428. x => x.includes(key),
  5429. x =>
  5430. x ? () => ctx.setConfigPlain[key](val) : () => {}
  5431. )()
  5432. )
  5433. ),
  5434. ...function_pipe(
  5435. ctx.configKeys,
  5436. es6_ReadonlyArray_map(key =>
  5437. function_pipe(
  5438. ctx.cs[key],
  5439. (0, external_rxjs_namespaceObject.startWith)(
  5440. ctx.getConfig[key]()
  5441. ),
  5442. (0, external_rxjs_namespaceObject.bufferCount)(
  5443. 2,
  5444. 1
  5445. ),
  5446. (0, external_rxjs_namespaceObject.map)(([x, y]) =>
  5447. (0, external_DeepDiff_namespaceObject.diff)(x, y)
  5448. ),
  5449. (0, external_rxjs_namespaceObject.tap)(x =>
  5450. ctx.mainLog([
  5451. `Config ${key}`,
  5452. JSON.stringify(x, void 0, 2),
  5453. ])()
  5454. )
  5455. )
  5456. )
  5457. ),
  5458. ctx.config$,
  5459. function_pipe(
  5460. ctx.live.video.ele,
  5461. match(
  5462. () => external_rxjs_namespaceObject.EMPTY,
  5463. x => {
  5464. return function_pipe(
  5465. ((video = x),
  5466. function_pipe(
  5467. [["playing"], ["waiting", "pause"]],
  5468. es6_ReadonlyArray_mapWithIndex((i, x) => [
  5469. x,
  5470. 0 === i,
  5471. ]),
  5472. es6_ReadonlyArray_chain(([xs, b]) =>
  5473. function_pipe(
  5474. xs,
  5475. es6_ReadonlyArray_map(x => [x, b])
  5476. )
  5477. ),
  5478. es6_ReadonlyArray_map(([x, b]) =>
  5479. function_pipe(
  5480. (0,
  5481. external_rxjs_namespaceObject.fromEvent)(
  5482. video,
  5483. x
  5484. ),
  5485. (0, external_rxjs_namespaceObject.map)(
  5486. () => b
  5487. )
  5488. )
  5489. ),
  5490. x =>
  5491. (0, external_rxjs_namespaceObject.merge)(...x)
  5492. )),
  5493. (0, external_rxjs_namespaceObject.map)(
  5494. playing =>
  5495. playing ||
  5496. Option_isSome(ctx.live.offlineSlate.ele)
  5497. ),
  5498. (0, external_rxjs_namespaceObject.tap)(
  5499. chatPlaying => {
  5500. ctx.mainState.chatPlaying = chatPlaying
  5501. ctx.flowChats.forEach(chat =>
  5502. setChatPlayState(chat)(ctx.mainState)()
  5503. )
  5504. }
  5505. )
  5506. )
  5507. var video
  5508. }
  5509. )
  5510. ),
  5511. function_pipe(
  5512. c.chatMutationPair.subject,
  5513. (0, external_rxjs_namespaceObject.map)(
  5514. onChatFieldMutate(
  5515. ctx.chatScreen,
  5516. ctx.flowChats,
  5517. ctx.mainState,
  5518. ctx.setConfig,
  5519. ctx.mainLog
  5520. )
  5521. ),
  5522. (0, external_rxjs_namespaceObject.tap)(x => x())
  5523. ),
  5524. function_pipe(
  5525. c.documentMutationPair.subject,
  5526. (0, external_rxjs_namespaceObject.map)(
  5527. () => window.location.href
  5528. ),
  5529. (0,
  5530. external_rxjs_namespaceObject.distinctUntilChanged)(),
  5531. (0, external_rxjs_namespaceObject.skip)(1),
  5532. (0, external_rxjs_namespaceObject.tap)(
  5533. ctx.updateSettingsPosition
  5534. ),
  5535. (0, external_rxjs_namespaceObject.tap)(x => {
  5536. ctx.mixLog(["URL Changed", x])()
  5537. removeOldChats(0)(ctx.flowChats)()
  5538. ctx.mixLog([`Wait for ${c.urlDelay}ms...`])()
  5539. }),
  5540. (0, external_rxjs_namespaceObject.delay)(c.urlDelay),
  5541. (0, external_rxjs_namespaceObject.tap)(ctx.reinitialize)
  5542. ),
  5543. function_pipe(
  5544. c.playerResizePair.subject,
  5545. (0, external_rxjs_namespaceObject.throttleTime)(
  5546. 500,
  5547. void 0,
  5548. { leading: !0, trailing: !0 }
  5549. ),
  5550. (0, external_rxjs_namespaceObject.startWith)([]),
  5551. (0, external_rxjs_namespaceObject.map)(
  5552. () => ctx.live.player.ele
  5553. ),
  5554. (0, external_rxjs_namespaceObject.map)(
  5555. es6_Option_map(x => x.getBoundingClientRect())
  5556. ),
  5557. (0, external_rxjs_namespaceObject.tap)(x => {
  5558. return (
  5559. (rect = x),
  5560. (flowChats = ctx.flowChats),
  5561. (mainState = ctx.mainState),
  5562. (mainLog = ctx.mainLog),
  5563. function_pipe(
  5564. rect,
  5565. match(
  5566. () => () => {},
  5567. x => () => {
  5568. mainLog(["Resize detected"])()
  5569. mainState.playerRect = x
  5570. flowChats.forEach(chat => {
  5571. renderChat(chat)(mainState)()
  5572. setChatAnimation(
  5573. chat,
  5574. flowChats
  5575. )(mainState)()
  5576. })
  5577. }
  5578. )
  5579. )()
  5580. )
  5581. var rect, flowChats, mainState, mainLog
  5582. })
  5583. ),
  5584. function_pipe(
  5585. c.bodyResizePair.subject,
  5586. (0, external_rxjs_namespaceObject.throttleTime)(
  5587. c.bodyResizeDetectInterval,
  5588. void 0,
  5589. { leading: !0, trailing: !0 }
  5590. ),
  5591. (0, external_rxjs_namespaceObject.startWith)([]),
  5592. (0, external_rxjs_namespaceObject.tap)(
  5593. ctx.updateSettingsPosition
  5594. )
  5595. )
  5596. )
  5597. ),
  5598. (0, external_rxjs_namespaceObject.retry)({
  5599. delay: e =>
  5600. function_pipe(
  5601. e,
  5602. external_rxjs_namespaceObject.of,
  5603. (0, external_rxjs_namespaceObject.tap)(
  5604. ctx.mixLog(["Errored", e])
  5605. ),
  5606. (0, external_rxjs_namespaceObject.delay)(
  5607. c.errorRetryInterval
  5608. ),
  5609. (0, external_rxjs_namespaceObject.tap)(ctx.reinitialize)
  5610. ),
  5611. })
  5612. )
  5613. ),
  5614. Task_fromIO
  5615. )
  5616. var E
  5617. }),
  5618. Task_chainFirstIOK(
  5619. ctx => () =>
  5620. ctx.all$.subscribe({
  5621. error: x => ctx.mixLog(["Stream error", x])(),
  5622. complete: ctx.mixLog(["Stream complete"]),
  5623. })
  5624. ),
  5625. Task_chainFirstIOK(ctx => ctx.reinitialize)
  5626. )()
  5627. ;(async () => {
  5628. external_log_namespaceObject.setLevel("info")
  5629. try {
  5630. await initialize()
  5631. } catch (error) {
  5632. external_log_namespaceObject.info("【FYC】 Error", error)
  5633. }
  5634. })()
  5635. })()
  5636. })()