From 9f15f21f9d76b6c21fb52d67383851f358ecb89d Mon Sep 17 00:00:00 2001 From: sim1222 Date: Thu, 17 Apr 2025 12:48:49 +0900 Subject: [PATCH] initial commit --- .gitignore | 34 + README.md | 15 + biome.json | 30 + bun.lock | 64 ++ index.ts | 1 + package.json | 23 + ..._Player_Ove-59cc90.a810eba2a0194c5f16e6.ts | 738 ++++++++++++++++++ tsconfig.json | 29 + 8 files changed, 934 insertions(+) create mode 100644 .gitignore create mode 100644 README.md create mode 100644 biome.json create mode 100644 bun.lock create mode 100644 index.ts create mode 100644 package.json create mode 100644 src/cdn.nnn.ed.nico/tenjin_pc/assets/ohtomi/src_components_faceRecognition_FaceRecognition_tsx-src_components_shared_organisms_Player_Ove-59cc90.a810eba2a0194c5f16e6.ts create mode 100644 tsconfig.json diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a14702c --- /dev/null +++ b/.gitignore @@ -0,0 +1,34 @@ +# dependencies (bun install) +node_modules + +# output +out +dist +*.tgz + +# code coverage +coverage +*.lcov + +# logs +logs +_.log +report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json + +# dotenv environment variable files +.env +.env.development.local +.env.test.local +.env.production.local +.env.local + +# caches +.eslintcache +.cache +*.tsbuildinfo + +# IntelliJ based IDEs +.idea + +# Finder (MacOS) folder config +.DS_Store diff --git a/README.md b/README.md new file mode 100644 index 0000000..2b317aa --- /dev/null +++ b/README.md @@ -0,0 +1,15 @@ +# zen-study-decompile + +To install dependencies: + +```bash +bun install +``` + +To run: + +```bash +bun run index.ts +``` + +This project was created using `bun init` in bun v1.2.9. [Bun](https://bun.sh) is a fast all-in-one JavaScript runtime. diff --git a/biome.json b/biome.json new file mode 100644 index 0000000..2eb0751 --- /dev/null +++ b/biome.json @@ -0,0 +1,30 @@ +{ + "$schema": "https://biomejs.dev/schemas/1.9.4/schema.json", + "vcs": { + "enabled": false, + "clientKind": "git", + "useIgnoreFile": false + }, + "files": { + "ignoreUnknown": false, + "ignore": [] + }, + "formatter": { + "enabled": true, + "indentStyle": "tab" + }, + "organizeImports": { + "enabled": true + }, + "linter": { + "enabled": true, + "rules": { + "recommended": true + } + }, + "javascript": { + "formatter": { + "quoteStyle": "double" + } + } +} diff --git a/bun.lock b/bun.lock new file mode 100644 index 0000000..9f446f3 --- /dev/null +++ b/bun.lock @@ -0,0 +1,64 @@ +{ + "lockfileVersion": 1, + "workspaces": { + "": { + "name": "zen-study-decompile", + "dependencies": { + "@types/react": "^19.1.2", + "@types/react-dom": "^19.1.2", + "react": "^19.1.0", + "react-dom": "^19.1.0", + }, + "devDependencies": { + "@biomejs/biome": "^1.9.4", + "@types/bun": "latest", + }, + "peerDependencies": { + "typescript": "^5", + }, + }, + }, + "packages": { + "@biomejs/biome": ["@biomejs/biome@1.9.4", "", { "optionalDependencies": { "@biomejs/cli-darwin-arm64": "1.9.4", "@biomejs/cli-darwin-x64": "1.9.4", "@biomejs/cli-linux-arm64": "1.9.4", "@biomejs/cli-linux-arm64-musl": "1.9.4", "@biomejs/cli-linux-x64": "1.9.4", "@biomejs/cli-linux-x64-musl": "1.9.4", "@biomejs/cli-win32-arm64": "1.9.4", "@biomejs/cli-win32-x64": "1.9.4" }, "bin": { "biome": "bin/biome" } }, "sha512-1rkd7G70+o9KkTn5KLmDYXihGoTaIGO9PIIN2ZB7UJxFrWw04CZHPYiMRjYsaDvVV7hP1dYNRLxSANLaBFGpog=="], + + "@biomejs/cli-darwin-arm64": ["@biomejs/cli-darwin-arm64@1.9.4", "", { "os": "darwin", "cpu": "arm64" }, "sha512-bFBsPWrNvkdKrNCYeAp+xo2HecOGPAy9WyNyB/jKnnedgzl4W4Hb9ZMzYNbf8dMCGmUdSavlYHiR01QaYR58cw=="], + + "@biomejs/cli-darwin-x64": ["@biomejs/cli-darwin-x64@1.9.4", "", { "os": "darwin", "cpu": "x64" }, "sha512-ngYBh/+bEedqkSevPVhLP4QfVPCpb+4BBe2p7Xs32dBgs7rh9nY2AIYUL6BgLw1JVXV8GlpKmb/hNiuIxfPfZg=="], + + "@biomejs/cli-linux-arm64": ["@biomejs/cli-linux-arm64@1.9.4", "", { "os": "linux", "cpu": "arm64" }, "sha512-fJIW0+LYujdjUgJJuwesP4EjIBl/N/TcOX3IvIHJQNsAqvV2CHIogsmA94BPG6jZATS4Hi+xv4SkBBQSt1N4/g=="], + + "@biomejs/cli-linux-arm64-musl": ["@biomejs/cli-linux-arm64-musl@1.9.4", "", { "os": "linux", "cpu": "arm64" }, "sha512-v665Ct9WCRjGa8+kTr0CzApU0+XXtRgwmzIf1SeKSGAv+2scAlW6JR5PMFo6FzqqZ64Po79cKODKf3/AAmECqA=="], + + "@biomejs/cli-linux-x64": ["@biomejs/cli-linux-x64@1.9.4", "", { "os": "linux", "cpu": "x64" }, "sha512-lRCJv/Vi3Vlwmbd6K+oQ0KhLHMAysN8lXoCI7XeHlxaajk06u7G+UsFSO01NAs5iYuWKmVZjmiOzJ0OJmGsMwg=="], + + "@biomejs/cli-linux-x64-musl": ["@biomejs/cli-linux-x64-musl@1.9.4", "", { "os": "linux", "cpu": "x64" }, "sha512-gEhi/jSBhZ2m6wjV530Yy8+fNqG8PAinM3oV7CyO+6c3CEh16Eizm21uHVsyVBEB6RIM8JHIl6AGYCv6Q6Q9Tg=="], + + "@biomejs/cli-win32-arm64": ["@biomejs/cli-win32-arm64@1.9.4", "", { "os": "win32", "cpu": "arm64" }, "sha512-tlbhLk+WXZmgwoIKwHIHEBZUwxml7bRJgk0X2sPyNR3S93cdRq6XulAZRQJ17FYGGzWne0fgrXBKpl7l4M87Hg=="], + + "@biomejs/cli-win32-x64": ["@biomejs/cli-win32-x64@1.9.4", "", { "os": "win32", "cpu": "x64" }, "sha512-8Y5wMhVIPaWe6jw2H+KlEm4wP/f7EW3810ZLmDlrEEy5KvBsb9ECEfu/kMWD484ijfQ8+nIi0giMgu9g1UAuuA=="], + + "@types/bun": ["@types/bun@1.2.9", "", { "dependencies": { "bun-types": "1.2.9" } }, "sha512-epShhLGQYc4Bv/aceHbmBhOz1XgUnuTZgcxjxk+WXwNyDXavv5QHD1QEFV0FwbTSQtNq6g4ZcV6y0vZakTjswg=="], + + "@types/node": ["@types/node@22.14.1", "", { "dependencies": { "undici-types": "~6.21.0" } }, "sha512-u0HuPQwe/dHrItgHHpmw3N2fYCR6x4ivMNbPHRkBVP4CvN+kiRrKHWk3i8tXiO/joPwXLMYvF9TTF0eqgHIuOw=="], + + "@types/react": ["@types/react@19.1.2", "", { "dependencies": { "csstype": "^3.0.2" } }, "sha512-oxLPMytKchWGbnQM9O7D67uPa9paTNxO7jVoNMXgkkErULBPhPARCfkKL9ytcIJJRGjbsVwW4ugJzyFFvm/Tiw=="], + + "@types/react-dom": ["@types/react-dom@19.1.2", "", { "peerDependencies": { "@types/react": "^19.0.0" } }, "sha512-XGJkWF41Qq305SKWEILa1O8vzhb3aOo3ogBlSmiqNko/WmRb6QIaweuZCXjKygVDXpzXb5wyxKTSOsmkuqj+Qw=="], + + "@types/ws": ["@types/ws@8.18.1", "", { "dependencies": { "@types/node": "*" } }, "sha512-ThVF6DCVhA8kUGy+aazFQ4kXQ7E1Ty7A3ypFOe0IcJV8O/M511G99AW24irKrW56Wt44yG9+ij8FaqoBGkuBXg=="], + + "bun-types": ["bun-types@1.2.9", "", { "dependencies": { "@types/node": "*", "@types/ws": "*" } }, "sha512-dk/kOEfQbajENN/D6FyiSgOKEuUi9PWfqKQJEgwKrCMWbjS/S6tEXp178mWvWAcUSYm9ArDlWHZKO3T/4cLXiw=="], + + "csstype": ["csstype@3.1.3", "", {}, "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw=="], + + "react": ["react@19.1.0", "", {}, "sha512-FS+XFBNvn3GTAWq26joslQgWNoFu08F4kl0J4CgdNKADkdSGXQyTCnKteIAJy96Br6YbpEU1LSzV5dYtjMkMDg=="], + + "react-dom": ["react-dom@19.1.0", "", { "dependencies": { "scheduler": "^0.26.0" }, "peerDependencies": { "react": "^19.1.0" } }, "sha512-Xs1hdnE+DyKgeHJeJznQmYMIBG3TKIHJJT95Q58nHLSrElKlGQqDTR2HQ9fx5CN/Gk6Vh/kupBTDLU11/nDk/g=="], + + "scheduler": ["scheduler@0.26.0", "", {}, "sha512-NlHwttCI/l5gCPR3D1nNXtWABUmBwvZpEQiD4IXSbIDq8BzLIK/7Ir5gTFSGZDUu37K5cMNp0hFtzO38sC7gWA=="], + + "typescript": ["typescript@5.8.3", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-p1diW6TqL9L07nNxvRMM7hMMw4c5XOo/1ibL4aAIGmSAt9slTE1Xgw5KWuof2uTOvCg9BY7ZRi+GaF+7sfgPeQ=="], + + "undici-types": ["undici-types@6.21.0", "", {}, "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ=="], + } +} diff --git a/index.ts b/index.ts new file mode 100644 index 0000000..2a5e4b8 --- /dev/null +++ b/index.ts @@ -0,0 +1 @@ +console.log("Hello via Bun!"); diff --git a/package.json b/package.json new file mode 100644 index 0000000..b01a73c --- /dev/null +++ b/package.json @@ -0,0 +1,23 @@ +{ + "name": "zen-study-decompile", + "module": "index.ts", + "type": "module", + "private": true, + "scripts": { + "check": "biome check", + "check:fix": "biome check --fix" + }, + "devDependencies": { + "@biomejs/biome": "^1.9.4", + "@types/bun": "latest" + }, + "peerDependencies": { + "typescript": "^5" + }, + "dependencies": { + "@types/react": "^19.1.2", + "@types/react-dom": "^19.1.2", + "react": "^19.1.0", + "react-dom": "^19.1.0" + } +} diff --git a/src/cdn.nnn.ed.nico/tenjin_pc/assets/ohtomi/src_components_faceRecognition_FaceRecognition_tsx-src_components_shared_organisms_Player_Ove-59cc90.a810eba2a0194c5f16e6.ts b/src/cdn.nnn.ed.nico/tenjin_pc/assets/ohtomi/src_components_faceRecognition_FaceRecognition_tsx-src_components_shared_organisms_Player_Ove-59cc90.a810eba2a0194c5f16e6.ts new file mode 100644 index 0000000..0f9e2d7 --- /dev/null +++ b/src/cdn.nnn.ed.nico/tenjin_pc/assets/ohtomi/src_components_faceRecognition_FaceRecognition_tsx-src_components_shared_organisms_Player_Ove-59cc90.a810eba2a0194c5f16e6.ts @@ -0,0 +1,738 @@ +/*! For license information please see src_components_faceRecognition_FaceRecognition_tsx-src_components_shared_organisms_Player_Ove-59cc90.a810eba2a0194c5f16e6.js.LICENSE.txt */ +/*! @ohtomi-preamble version: 8.1.0, name:src_components_faceRecognition_FaceRecognition_tsx-src_components_shared_organisms_Player_Ove-59cc90 */ +try { + const e = + "undefined" != typeof window + ? window + : "undefined" != typeof global + ? global + : "undefined" != typeof globalThis + ? globalThis + : "undefined" != typeof self + ? self + : {}, + t = new e.Error().stack; + t && + ((e._sentryDebugIds = e._sentryDebugIds || {}), + (e._sentryDebugIds[t] = "78ff2760-29f1-40c0-a35f-3f4f11d9a7f9"), + (e._sentryDebugIdIdentifier = + "sentry-dbid-78ff2760-29f1-40c0-a35f-3f4f11d9a7f9")); +} catch (e) {} +("undefined" != typeof window + ? window + : "undefined" != typeof global + ? global + : "undefined" != typeof globalThis + ? globalThis + : "undefined" != typeof self + ? self + : {}).SENTRY_RELEASE = { id: "ohtomi@8.1.0" }; +(self.webpackChunkOhtomi = self.webpackChunkOhtomi || []).push([ + [ + "src_components_faceRecognition_FaceRecognition_tsx-src_components_shared_organisms_Player_Ove-59cc90", + ], + { + 98024: (e, t, n) => { + n.d(t, { B: () => o }); + var a = n(96540); + function o({ disabled: e = !1, storedDevice: t } = {}) { + const [n, o] = (0, a.useState)(null), + [inputDevices, setInputDevices] = (0, a.useState)([]), + [s, c] = (0, a.useState)(), + l = (0, a.useCallback)(async () => { + try { + await navigator.mediaDevices + .getUserMedia({ video: !0 }) + .then((mediaStream) => { + mediaStream.getTracks().forEach((mediaTrack) => { + mediaStream.removeTrack(mediaTrack), mediaTrack.stop(); + }); + }), + await navigator.mediaDevices + .enumerateDevices() + .then((MediaDevices) => { + o(null); + const videoInputDevices = MediaDevices.filter( + (mediaDevice) => mediaDevice.kind === "videoinput" && mediaDevice.label !== "", + ); + if ( + (setInputDevices(videoInputDevices), + !s || + !videoInputDevices.some( + (e) => + e.deviceId === s.deviceId || e.label === s.label, + )) + ) { + var a, r; + const e = + null !== + (a = + null !== + (r = videoInputDevices.find( + ({ deviceId: e }) => + e === (null == t ? void 0 : t.deviceId), + )) && void 0 !== r + ? r + : videoInputDevices.find( + ({ label: e }) => + e === (null == t ? void 0 : t.label), + )) && void 0 !== a + ? a + : videoInputDevices[0]; + if (null == e) + throw new Error( + "利用可能なカメラデバイスが存在しません", + ); + c(e); + } + }); + } catch (e) { + o(e); + } + }, [ + s, + null == t ? void 0 : t.deviceId, + null == t ? void 0 : t.label, + ]), + d = (0, a.useCallback)( + (e) => { + c(null == inputDevices ? void 0 : inputDevices.find((t) => t.deviceId === e)); + }, + [inputDevices], + ); + return ( + (0, a.useEffect)( + () => + e + ? (o(null), setInputDevices([]), c(void 0), () => {}) + : (l(), + navigator.mediaDevices.addEventListener("devicechange", l), + () => + navigator.mediaDevices.removeEventListener( + "devicechange", + l, + )), + [e, l], + ), + { error: n, availableDevices: inputDevices, currentDevice: s, select: d } + ); + } + }, + 81801: (e, t, n) => { + n.d(t, { y: () => i }); + var a = n(96540), + o = n(78685); + const r = "camera-device"; + function i() { + const [e, t] = (0, o.A)(r, void 0, { + raw: !1, + serializer: (e) => JSON.stringify(e), + deserializer: (e) => JSON.parse(e), + }), + n = (0, a.useCallback)((e) => t(e), [t]); + return { device: e, save: n }; + } + }, + 77177: (e, t, n) => { + n.d(t, { j: () => C }); + var a = n(96540), + o = n(98024), + r = n(81801); + const i = Math.floor(25.5); + const s = { width: 440, height: 440, type: "image/jpeg" }; + function c({ status: e, onStatusChanged: t, onCapture: n, onError: c }) { + const { device: l } = (0, r.y)(), + { currentDevice: d } = (0, o.B)({ storedDevice: l }), + { captureImage: u } = (({ deviceId: e }) => ({ + captureImage: (0, a.useCallback)( + async ({ width: t, height: n, type: a, quality: o }) => { + const r = await navigator.mediaDevices.getUserMedia({ + video: { + deviceId: e ? { exact: e } : void 0, + width: t, + height: n, + }, + }), + s = r.getVideoTracks()[0]; + if (null == s) + throw new Error("映像トラックを取得できませんでした"); + const { width: c, height: l } = s.getSettings(); + if (null == c || null == l) + throw new Error("映像の幅と高さを取得できませんでした"); + try { + const e = document.createElement("video"); + (e.width = c), + (e.height = l), + (e.srcObject = r), + await e.play(); + const s = document.createElement("canvas"); + (s.width = t), (s.height = n); + const d = s.getContext("2d", { willReadFrequently: !0 }); + if (!d) + throw new Error("Canvasの2Dコンテキスト取得に失敗しました"); + const u = performance.now() + 1e3, + h = { x: Math.floor(t / 2), y: Math.floor(n / 2) }, + p = (([e, t], [n, a]) => { + const o = { src: e / t, dest: n / a }; + return o.src < o.dest + ? { + x: 0, + y: (t - e / o.dest) / 2, + width: e, + height: e / o.dest, + } + : { + x: (e - t * o.dest) / 2, + y: 0, + width: t * o.dest, + height: t, + }; + })([c, l], [t, n]); + for (;;) { + if (u <= performance.now()) + throw new Error( + "カメラからの映像を待機する処理がタイムアウトしました", + ); + if ( + (d.drawImage(e, p.x, p.y, p.width, p.height), + Array.from(d.getImageData(h.x, h.y, 1, 1).data) + .slice(0, 3) + .some((e) => i <= e)) + ) + break; + await new Promise((e) => setTimeout(e, 100)); + } + const f = await new Promise((e) => s.toBlob(e, a, o)); + if (!f) throw new Error("Blobデータの生成に失敗しました"); + return f; + } finally { + r.getTracks().forEach((e) => { + e.stop(), r.removeTrack(e); + }); + } + }, + [e], + ), + }))({ deviceId: null == d ? void 0 : d.deviceId }), + [h, p] = (0, a.useState)(!1); + return ( + (0, a.useEffect)(() => { + null == (null == d ? void 0 : d.deviceId) || + "progress" !== e || + h || + u(s) + .then((e) => { + t("success"), n(e); + }) + .catch((e) => { + t("failed"), c(e); + }) + .finally(() => { + p(!0); + }); + }, [u, null == d ? void 0 : d.deviceId, h, n, c, t, e]), + null + ); + } + var l = n(35830), + d = n(73305), + u = n(74848); + function h({ status: e, horizontalAlign: t }) { + return (0, u.jsxs)(p, { + horizontalAlign: t, + children: [ + "failed" !== e && + (0, u.jsxs)(u.Fragment, { + children: [ + (0, u.jsx)(v, {}), + (0, u.jsx)(f, { children: "認証中" }), + ], + }), + "failed" === e && + (0, u.jsxs)(u.Fragment, { + children: [ + (0, u.jsx)(g, {}), + (0, u.jsx)(f, { children: "認証不可" }), + ], + }), + ], + }); + } + const p = l.default.div.withConfig({ componentId: "sc-1rzrjyt-0" })( + [ + "position:fixed;left:", + ";right:", + ";bottom:", + "px;z-index:1;display:inline-flex;padding:", + "px ", + "px;justify-content:center;align-items:center;gap:", + "px;border-radius:99px;color:", + ";background-color:", + ";", + ], + ({ horizontalAlign: e, theme: t }) => + "left" === e ? `${t.space[4]}px` : void 0, + ({ horizontalAlign: e, theme: t }) => + "right" === e ? `${t.space[4]}px` : void 0, + ({ theme: e }) => e.space[4], + ({ theme: e }) => e.space[1], + ({ theme: e }) => e.space[2], + ({ theme: e }) => e.space[1], + ({ theme: e }) => e.colors.white, + ({ theme: e }) => e.colors.transparent.blackClear20, + ), + f = l.default.div.withConfig({ componentId: "sc-1rzrjyt-1" })( + ["color:", ";font-size:1.2rem;"], + ({ theme: e }) => e.colors.white, + ), + v = (0, l.default)(d.A) + .attrs({ type: "capture-face-progress", size: "8px" }) + .withConfig({ componentId: "sc-1rzrjyt-2" })( + ["color:", ";"], + ({ theme: e }) => e.colors.accent5, + ), + g = (0, l.default)(d.A) + .attrs({ type: "capture-face-error", size: "8px" }) + .withConfig({ componentId: "sc-1rzrjyt-3" })( + ["color:", ";"], + ({ theme: e }) => e.colors.warning, + ), + m = Symbol("result"); + var w = n(71083), + y = n(53110), + x = n(78776); + const b = w.A.create({ baseURL: x.A.horusApiEndPoint }), + k = { + uploadImageAsync: async ({ sessionId: e, image: t }) => { + const n = w.A.toFormData({ image: t }); + return await b + .post(`/sessions/${e}/images/async`, n, { + headers: { "Content-Type": "multipart/form-data" }, + }) + .then((e) => { + return (0, y.F0)(e) + ? ((t = e), { [m]: "failure", error: t }) + : ((e) => ({ [m]: "success", data: e }))(e.data); + var t; + }); + }, + }; + var I = n(80724); + function C({ capture: e, horizontalAlign: t, contextDetail: n }) { + const [i, s] = (0, a.useState)(void 0), + { device: l } = (0, r.y)(), + { currentDevice: d, error: p } = (0, o.B)({ storedDevice: l }), + [f, v] = (0, a.useState)(), + [g, w] = (0, a.useState)(""), + y = (0, a.useRef)(!1); + (0, a.useEffect)(() => { + null == i && (null == p ? null != d && s("progress") : s("failed")); + }, [d, p, i]), + (0, a.useEffect)(() => { + switch (i) { + case "progress": + case "success": + null == f && + navigator.mediaDevices + .getUserMedia({ video: !0 }) + .then((e) => v(e)); + } + }, [i, f]), + (0, a.useEffect)( + () => () => { + f && + (f.getTracks().forEach((e) => { + null == f || f.removeTrack(e), e.stop(); + }), + v(void 0)); + }, + [f], + ); + const x = (0, I.R)(); + (0, a.useEffect)(() => { + var e; + (null == (null == d ? void 0 : d.deviceId) && null == p) || + g || + y.current || + ((y.current = !0), + (async (e, t, n) => { + try { + return await e + .postV3RecognitionFacesSession({ camera: t, detail: n }) + .then((e) => { + if (!e.data.recognitionSessionId) throw new Error(); + return e.data.recognitionSessionId; + }); + } catch { + return ""; + } + })( + x, + null !== (e = null == d ? void 0 : d.label) && void 0 !== e + ? e + : "", + n, + ).then((e) => { + w(e), e || s("failed"); + })); + }, [ + x, + n, + null == d ? void 0 : d.deviceId, + null == d ? void 0 : d.label, + p, + g, + ]); + const b = (0, a.useCallback)( + async (e) => { + if (!g) + throw ( + (s("failed"), new Error("本人認証のセッションIDが不正です")) + ); + e && + (await (async (e, t) => { + try { + return await k + .uploadImageAsync({ sessionId: e, image: t }) + .then((e) => ((e) => "success" === e[m])(e)); + } catch { + return !1; + } + })(g, e).then((e) => { + s(e ? "success" : "failed"); + })); + }, + [g], + ), + C = (0, a.useCallback)(() => {}, []), + _ = (0, a.useMemo)( + () => + e && "progress" === i && g + ? (0, u.jsx)(c, { + status: i, + onStatusChanged: s, + onCapture: b, + onError: C, + }) + : null, + [e, b, C, g, i], + ); + return (0, u.jsxs)(u.Fragment, { + children: [_, i && (0, u.jsx)(h, { status: i, horizontalAlign: t })], + }); + } + }, + 60616: (e, t, n) => { + n.d(t, { v: () => r }); + var a = n(35830), + o = n(62851); + const r = (0, a.default)(o.A).withConfig({ componentId: "sc-131fzem-0" })( + ["font-size:40px;opacity:1;&:hover{cursor:pointer;}"], + ); + }, + 21721: (e, t, n) => { + n.d(t, { b: () => p }); + var a = n(63998), + o = n(35830), + r = n(96540), + i = n(74848); + const s = ({ rate: e, currentRate: t, onClick: n }) => { + const a = (0, r.useCallback)(() => { + n(e); + }, [e, n]), + o = Math.abs(e - t) < 0.001; + return (0, i.jsx)(c, { selected: o, onClick: a, children: `x${e}` }); + }, + c = o.default.button.withConfig({ componentId: "sc-1iiy24x-0" })( + [ + "display:flex;width:48px;height:27px;font-size:13px;font-weight:700;align-items:center;color:", + ";justify-content:center;border-radius:2px;padding:2px;margin:2px;background-color:", + ";border:", + ";&:hover{background-color:", + ";cursor:pointer;}", + ], + ({ theme: e }) => e.colors.white, + ({ theme: e }) => e.colors.black, + ({ selected: e, theme: t }) => + e + ? `2px solid ${t.colors.white}` + : `1px solid ${t.colors.gray.darkness2}`, + ({ theme: e }) => e.colors.primary, + ); + function l({ + currentPlaybackRate: e, + isHover: t, + isOpenRateList: n, + onChangeRateItem: r, + onMouseEnter: c, + onMouseLeave: l, + ...u + }) { + const h = (0, o.useTheme)(); + return (0, i.jsxs)(d, { + width: "108px", + height: "128px", + justifyContent: "center", + py: "2px", + px: "2px", + bg: h.colors.black, + sx: { borderRadius: "4px" }, + onMouseEnter: c, + onMouseLeave: l, + ...u, + $_css: t && n ? "flex" : "none", + children: [ + (0, i.jsxs)(a.so, { + flexDirection: "column", + children: [ + (0, i.jsx)(s, { rate: 1, currentRate: e, onClick: r }), + (0, i.jsx)(s, { rate: 0.75, currentRate: e, onClick: r }), + (0, i.jsx)(s, { rate: 0.5, currentRate: e, onClick: r }), + ], + }), + (0, i.jsxs)(a.so, { + flexDirection: "column", + children: [ + (0, i.jsx)(s, { rate: 1.25, currentRate: e, onClick: r }), + (0, i.jsx)(s, { rate: 1.5, currentRate: e, onClick: r }), + (0, i.jsx)(s, { rate: 1.75, currentRate: e, onClick: r }), + (0, i.jsx)(s, { rate: 2, currentRate: e, onClick: r }), + ], + }), + ], + }); + } + var d = (0, o.default)(a.so).withConfig({ componentId: "sc-v2jbux-0" })( + (e) => ({ display: e.$_css }), + ), + u = n(60616); + const h = (0, o.default)(u.v).withConfig({ componentId: "sc-16km7w-0" })( + ["color:", ";&:hover{color:", ";}"], + ({ theme: e }) => e.colors.white, + ({ theme: e }) => e.colors.primary, + ), + p = ({ playbackRate: e, playbackRatesDropdownMenuProps: t }) => { + const { + isHover: n, + isOpenRateList: o, + handleMouseEnter: r, + handleMouseLeave: s, + handleRateItemButton: c, + handleRateIcon: d, + } = t; + return (0, i.jsxs)(a.so, { + sx: { position: "relative" }, + children: [ + (0, i.jsxs)(a.az, { + width: "80px", + height: "80px", + p: 5, + children: [ + (0, i.jsx)(a.az, { + width: "20px", + height: "20px", + sx: { position: "absolute", left: "0", top: "40px" }, + onMouseEnter: r, + onMouseLeave: s, + }), + (0, i.jsx)(h, { + type: `playback-rate-${`${e}`.replace(".", "-")}`, + onClick: d, + onMouseEnter: r, + onMouseLeave: s, + }), + (0, i.jsx)(a.az, { + width: "20px", + height: "20px", + sx: { position: "absolute", right: "0", top: "40px" }, + onMouseEnter: r, + onMouseLeave: s, + }), + ], + }), + (0, i.jsx)(l, { + currentPlaybackRate: e, + isHover: n, + isOpenRateList: o, + onChangeRateItem: c, + onMouseEnter: r, + onMouseLeave: s, + sx: { position: "absolute", left: "-12px", top: "60px" }, + }), + ], + }); + }; + }, + 41233: (e, t, n) => { + n.d(t, { y: () => o }); + var a = n(96540); + function o({ changePlaybackRate: e }) { + const [t, n] = (0, a.useState)(!1), + [o, r] = (0, a.useState)(!1); + return { + isHover: t, + isOpenRateList: o, + handleMouseEnter: (0, a.useCallback)(() => { + n(!0), r(!0); + }, []), + handleMouseLeave: (0, a.useCallback)(() => { + n(!1), r(!1); + }, []), + handleRateItemButton: (0, a.useCallback)( + (t) => { + e(t), r(!1); + }, + [e], + ), + handleRateIcon: (0, a.useCallback)(() => { + r(!0); + }, []), + }; + } + }, + 58169: (e, t, n) => { + n.d(t, { A: () => c }); + var a = n(57097), + o = n(53110), + r = n(80724), + i = n(70195), + s = n(21137); + const c = () => { + const e = (0, r.R)(), + { showSnackbar: t } = (0, i.d)(s), + { mutate: n } = (0, a.n)({ + mutationFn: e.postLearningAmounts, + retry: (e, n) => { + if (e > 2) + return ( + t({ + id: Date.now(), + type: "info", + message: "学習数を記録できませんでした", + actionLabel: "学習数とは", + onClick: () => { + window.open( + "/help#learning_amount", + "_blank", + "noopener", + ); + }, + }), + !1 + ); + const a = !n.response, + r = n.code === o.pe.ECONNABORTED; + return a || r; + }, + retryDelay: 1e3, + }); + return { addLearningAmounts: n }; + }; + }, + 49474: (e, t, n) => { + n.d(t, { J: () => o }); + var a = n(96540); + function o(e) { + const [t, n] = (0, a.useState)("prompt"); + return ( + (0, a.useEffect)(() => { + null != e && + (e + ? navigator.mediaDevices + .getUserMedia({ video: !0 }) + .then((e) => { + e.getTracks().forEach((t) => { + t.stop(), e.removeTrack(t); + }), + n("granted"); + }) + .catch(() => { + n("denied"); + }) + : n("granted")); + }, [e]), + !1 === e || "prompt" !== t + ); + } + }, + 26237: (e, t, n) => { + function a({ + courseId: e, + chapterId: t, + materialId: n, + title: a, + courseType: r, + materialType: i, + }) { + var s; + if (void 0 === e && void 0 === t) + (window.dataLayer = + null !== (s = window.dataLayer) && void 0 !== s ? s : []), + window.dataLayer.push({ + event: "video_view", + zane_analytics: { + material_id: String(n), + title: a, + content_type: o(r), + material_type: i, + }, + }); + else if (void 0 === e) { + var c; + (window.dataLayer = + null !== (c = window.dataLayer) && void 0 !== c ? c : []), + window.dataLayer.push({ + event: "video_view", + zane_analytics: { + chapter_id: String(t), + material_id: String(n), + title: a, + content_type: o(r), + material_type: i, + }, + }); + } else if (void 0 === t) { + var l; + (window.dataLayer = + null !== (l = window.dataLayer) && void 0 !== l ? l : []), + window.dataLayer.push({ + event: "video_view", + zane_analytics: { + course_id: String(e), + material_id: String(n), + title: a, + content_type: o(r), + material_type: i, + }, + }); + } else { + var d; + (window.dataLayer = + null !== (d = window.dataLayer) && void 0 !== d ? d : []), + window.dataLayer.push({ + event: "video_view", + zane_analytics: { + course_id: String(e), + chapter_id: String(t), + material_id: String(n), + title: a, + content_type: o(r), + material_type: i, + }, + }); + } + } + function o(e) { + switch (e) { + case "basic": + return "高校必修"; + case "advanced": + return "課外"; + case "zen_univ": + return "大学履修"; + } + } + n.d(t, { d: () => a }); + }, + }, +]); diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..de42b3a --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,29 @@ +{ + "compilerOptions": { + // Environment setup & latest features + "lib": ["ESNext", "DOM", "DOM.Iterable"], + "target": "ESNext", + "module": "ESNext", + "moduleDetection": "force", + "jsx": "react-jsx", + "allowJs": true, + + // Bundler mode + "moduleResolution": "bundler", + "allowImportingTsExtensions": true, + "verbatimModuleSyntax": true, + "noEmit": true, + + // Best practices + "strict": true, + "skipLibCheck": true, + "noFallthroughCasesInSwitch": true, + "noUncheckedIndexedAccess": true, + + // Some stricter flags (disabled by default) + "noUnusedLocals": false, + "noUnusedParameters": false, + "noPropertyAccessFromIndexSignature": false + }, + "include": ["src/**/*"] +}