@yui540/comimi 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +44 -0
- package/dist/components/arrow-buttons.d.ts +8 -0
- package/dist/components/arrow-buttons.d.ts.map +1 -0
- package/dist/components/arrow-buttons.styles.d.ts +2 -0
- package/dist/components/arrow-buttons.styles.d.ts.map +1 -0
- package/dist/components/center-message.d.ts +4 -0
- package/dist/components/center-message.d.ts.map +1 -0
- package/dist/components/center-message.styles.d.ts +2 -0
- package/dist/components/center-message.styles.d.ts.map +1 -0
- package/dist/components/controls-dock.d.ts +44 -0
- package/dist/components/controls-dock.d.ts.map +1 -0
- package/dist/components/controls-dock.styles.d.ts +2 -0
- package/dist/components/controls-dock.styles.d.ts.map +1 -0
- package/dist/components/error-icon.d.ts +3 -0
- package/dist/components/error-icon.d.ts.map +1 -0
- package/dist/components/error-icon.styles.d.ts +2 -0
- package/dist/components/error-icon.styles.d.ts.map +1 -0
- package/dist/components/icons.d.ts +3 -0
- package/dist/components/icons.d.ts.map +1 -0
- package/dist/components/icons.styles.d.ts +2 -0
- package/dist/components/icons.styles.d.ts.map +1 -0
- package/dist/components/inputs.d.ts +36 -0
- package/dist/components/inputs.d.ts.map +1 -0
- package/dist/components/inputs.styles.d.ts +2 -0
- package/dist/components/inputs.styles.d.ts.map +1 -0
- package/dist/components/loading-icon.d.ts +3 -0
- package/dist/components/loading-icon.d.ts.map +1 -0
- package/dist/components/loading-icon.styles.d.ts +2 -0
- package/dist/components/loading-icon.styles.d.ts.map +1 -0
- package/dist/components/menu-panel.d.ts +36 -0
- package/dist/components/menu-panel.d.ts.map +1 -0
- package/dist/components/menu-panel.styles.d.ts +2 -0
- package/dist/components/menu-panel.styles.d.ts.map +1 -0
- package/dist/components/notifications.d.ts +3 -0
- package/dist/components/notifications.d.ts.map +1 -0
- package/dist/components/notifications.styles.d.ts +2 -0
- package/dist/components/notifications.styles.d.ts.map +1 -0
- package/dist/components/page-layout.d.ts +15 -0
- package/dist/components/page-layout.d.ts.map +1 -0
- package/dist/components/page-stage.d.ts +28 -0
- package/dist/components/page-stage.d.ts.map +1 -0
- package/dist/components/page-stage.styles.d.ts +2 -0
- package/dist/components/page-stage.styles.d.ts.map +1 -0
- package/dist/components/rabbit-mascot.d.ts +2 -0
- package/dist/components/rabbit-mascot.d.ts.map +1 -0
- package/dist/components/rabbit-mascot.styles.d.ts +2 -0
- package/dist/components/rabbit-mascot.styles.d.ts.map +1 -0
- package/dist/components/settings-panel.d.ts +28 -0
- package/dist/components/settings-panel.d.ts.map +1 -0
- package/dist/components/settings-panel.styles.d.ts +2 -0
- package/dist/components/settings-panel.styles.d.ts.map +1 -0
- package/dist/components/splash-screen.d.ts +3 -0
- package/dist/components/splash-screen.d.ts.map +1 -0
- package/dist/components/splash-screen.styles.d.ts +2 -0
- package/dist/components/splash-screen.styles.d.ts.map +1 -0
- package/dist/components/tooltip.styles.d.ts +2 -0
- package/dist/components/tooltip.styles.d.ts.map +1 -0
- package/dist/components/view-mode-switcher.d.ts +16 -0
- package/dist/components/view-mode-switcher.d.ts.map +1 -0
- package/dist/components/view-mode-switcher.styles.d.ts +2 -0
- package/dist/components/view-mode-switcher.styles.d.ts.map +1 -0
- package/dist/components/viewer-root.d.ts +5 -0
- package/dist/components/viewer-root.d.ts.map +1 -0
- package/dist/components/viewer-root.styles.d.ts +2 -0
- package/dist/components/viewer-root.styles.d.ts.map +1 -0
- package/dist/core/asset-loader.d.ts +7 -0
- package/dist/core/asset-loader.d.ts.map +1 -0
- package/dist/core/event-emitter.d.ts +8 -0
- package/dist/core/event-emitter.d.ts.map +1 -0
- package/dist/core/manga-viewer-core.d.ts +41 -0
- package/dist/core/manga-viewer-core.d.ts.map +1 -0
- package/dist/defaults.d.ts +9 -0
- package/dist/defaults.d.ts.map +1 -0
- package/dist/i18n/i18n.d.ts +9 -0
- package/dist/i18n/i18n.d.ts.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1820 -0
- package/dist/manga-viewer.global.js +2344 -0
- package/dist/renderer/renderer-callbacks.d.ts +18 -0
- package/dist/renderer/renderer-callbacks.d.ts.map +1 -0
- package/dist/renderer/viewer-renderer.d.ts +51 -0
- package/dist/renderer/viewer-renderer.d.ts.map +1 -0
- package/dist/storage/indexed-db-storage.d.ts +23 -0
- package/dist/storage/indexed-db-storage.d.ts.map +1 -0
- package/dist/store/reducer.d.ts +3 -0
- package/dist/store/reducer.d.ts.map +1 -0
- package/dist/store/store.d.ts +11 -0
- package/dist/store/store.d.ts.map +1 -0
- package/dist/styles/media.d.ts +13 -0
- package/dist/styles/media.d.ts.map +1 -0
- package/dist/styles/style-registry.d.ts +2 -0
- package/dist/styles/style-registry.d.ts.map +1 -0
- package/dist/types.d.ts +163 -0
- package/dist/types.d.ts.map +1 -0
- package/docs/USAGE.md +248 -0
- package/locales/en.json +37 -0
- package/locales/ja.json +37 -0
- package/package.json +42 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,1820 @@
|
|
|
1
|
+
var e = {
|
|
2
|
+
locale: "ja",
|
|
3
|
+
hasCover: !0,
|
|
4
|
+
readingDirection: "rtl",
|
|
5
|
+
pageTurnMode: "single",
|
|
6
|
+
layoutMode: "inline",
|
|
7
|
+
autoPageTurnIntervalMs: 5e3,
|
|
8
|
+
pageTurnAnimation: !0,
|
|
9
|
+
zoom: {
|
|
10
|
+
min: 1,
|
|
11
|
+
max: 4,
|
|
12
|
+
step: .25
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
function t(e, t, n = 0) {
|
|
16
|
+
let i = r(n, e.pages.length);
|
|
17
|
+
return {
|
|
18
|
+
manga: e,
|
|
19
|
+
currentPageIndex: i,
|
|
20
|
+
visiblePageIndexes: a(i, e.pages.length, t),
|
|
21
|
+
overlayVisible: !1,
|
|
22
|
+
autoPageTurnEnabled: !1,
|
|
23
|
+
zoomScale: 1,
|
|
24
|
+
panX: 0,
|
|
25
|
+
panY: 0,
|
|
26
|
+
settings: t,
|
|
27
|
+
layout: { mode: t.layoutMode },
|
|
28
|
+
notifications: [],
|
|
29
|
+
panel: "none"
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
function n(e, t) {
|
|
33
|
+
return {
|
|
34
|
+
...e,
|
|
35
|
+
...t,
|
|
36
|
+
zoom: {
|
|
37
|
+
...e.zoom,
|
|
38
|
+
...t?.zoom
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
function r(e, t) {
|
|
43
|
+
return t <= 0 ? 0 : Math.min(Math.max(Math.round(e), 0), t - 1);
|
|
44
|
+
}
|
|
45
|
+
function i(e, t) {
|
|
46
|
+
return e.pageTurnMode === "single" || e.hasCover && t === 0 ? 1 : 2;
|
|
47
|
+
}
|
|
48
|
+
function a(e, t, n) {
|
|
49
|
+
let r = /* @__PURE__ */ new Set(), i = Math.max(0, e - 1), a = Math.min(t - 1, e + 1);
|
|
50
|
+
for (let e = i; e <= a; e += 1) r.add(e);
|
|
51
|
+
if (n.pageTurnMode === "spread" && !(n.hasCover && e === 0)) {
|
|
52
|
+
let i = n.hasCover && e > 0 ? e + (e % 2 == 1 ? 1 : -1) : e + (e % 2 == 0 ? 1 : -1);
|
|
53
|
+
i >= 0 && i < t && r.add(i);
|
|
54
|
+
}
|
|
55
|
+
return [...r].sort((e, t) => e - t);
|
|
56
|
+
}
|
|
57
|
+
var o = {
|
|
58
|
+
"overlay.autoPageTurn": "Auto play",
|
|
59
|
+
"overlay.layout": "Layout",
|
|
60
|
+
"overlay.settings": "Settings",
|
|
61
|
+
"overlay.menu": "Menu",
|
|
62
|
+
"overlay.centerHint.desktop": "Click the center to close",
|
|
63
|
+
"overlay.centerHint.mobile": "Tap the center to close",
|
|
64
|
+
"splash.loading": "Starting viewer",
|
|
65
|
+
"autoplay.start": "Auto play started",
|
|
66
|
+
"autoplay.stop": "Auto play stopped",
|
|
67
|
+
"pageMode.single": "Single",
|
|
68
|
+
"pageMode.spread": "Spread",
|
|
69
|
+
"layout.inline": "Standard",
|
|
70
|
+
"layout.theater": "Wide",
|
|
71
|
+
"layout.browserFullscreen": "Fullscreen",
|
|
72
|
+
"settings.title": "Settings",
|
|
73
|
+
"settings.cover": "Has cover",
|
|
74
|
+
"settings.direction": "Page turn direction",
|
|
75
|
+
"settings.interval": "Auto play interval",
|
|
76
|
+
"settings.interval.unit": "s",
|
|
77
|
+
"settings.animation": "Page turn animation",
|
|
78
|
+
"settings.direction.rtl": "Right to left",
|
|
79
|
+
"settings.direction.ltr": "Left to right",
|
|
80
|
+
"menu.openShortcuts": "Keyboard shortcuts",
|
|
81
|
+
"menu.openPages": "Page list",
|
|
82
|
+
"menu.back": "Back",
|
|
83
|
+
"shortcut.section.page": "Page navigation",
|
|
84
|
+
"shortcut.section.viewMode": "View mode",
|
|
85
|
+
"shortcut.section.general": "General",
|
|
86
|
+
"shortcut.moveLeft": "Move left",
|
|
87
|
+
"shortcut.moveRight": "Move right",
|
|
88
|
+
"shortcut.autoPageTurnLabel": "Auto play",
|
|
89
|
+
"shortcut.pageModeToggle": "Toggle spread",
|
|
90
|
+
"seek.previewAlt": "Preview of page {{page}}",
|
|
91
|
+
loading: "Loading",
|
|
92
|
+
"error.pageRequestFailed": "Request failed for page {{page}}"
|
|
93
|
+
}, s = {
|
|
94
|
+
"overlay.autoPageTurn": "自動再生",
|
|
95
|
+
"overlay.layout": "表示モード",
|
|
96
|
+
"overlay.settings": "設定",
|
|
97
|
+
"overlay.menu": "メニュー",
|
|
98
|
+
"overlay.centerHint.desktop": "閉じるには画面中央をクリック",
|
|
99
|
+
"overlay.centerHint.mobile": "閉じるには画面中央をタップ",
|
|
100
|
+
"splash.loading": "ビューワーを起動中",
|
|
101
|
+
"autoplay.start": "自動再生を開始",
|
|
102
|
+
"autoplay.stop": "自動再生を停止",
|
|
103
|
+
"pageMode.single": "1ページ",
|
|
104
|
+
"pageMode.spread": "見開き",
|
|
105
|
+
"layout.inline": "標準",
|
|
106
|
+
"layout.theater": "ワイド",
|
|
107
|
+
"layout.browserFullscreen": "全画面",
|
|
108
|
+
"settings.title": "設定",
|
|
109
|
+
"settings.cover": "表紙あり",
|
|
110
|
+
"settings.direction": "ページ移動方向",
|
|
111
|
+
"settings.interval": "自動再生の秒数",
|
|
112
|
+
"settings.interval.unit": "秒",
|
|
113
|
+
"settings.animation": "ページ移動アニメーション",
|
|
114
|
+
"settings.direction.rtl": "右",
|
|
115
|
+
"settings.direction.ltr": "左",
|
|
116
|
+
"menu.openShortcuts": "キーボードショートカット",
|
|
117
|
+
"menu.openPages": "ページ一覧",
|
|
118
|
+
"menu.back": "もどる",
|
|
119
|
+
"shortcut.section.page": "ページ移動",
|
|
120
|
+
"shortcut.section.viewMode": "表示モード",
|
|
121
|
+
"shortcut.section.general": "全般",
|
|
122
|
+
"shortcut.moveLeft": "左に移動",
|
|
123
|
+
"shortcut.moveRight": "右に移動",
|
|
124
|
+
"shortcut.autoPageTurnLabel": "自動再生",
|
|
125
|
+
"shortcut.pageModeToggle": "見開き切り替え",
|
|
126
|
+
"seek.previewAlt": "{{page}}ページのプレビュー",
|
|
127
|
+
loading: "読み込み中",
|
|
128
|
+
"error.pageRequestFailed": "{{page}}ページのリクエストに失敗しました"
|
|
129
|
+
}, c = class {
|
|
130
|
+
locale;
|
|
131
|
+
translations;
|
|
132
|
+
constructor(e, t) {
|
|
133
|
+
this.locale = e, this.translations = {
|
|
134
|
+
ja: s,
|
|
135
|
+
en: o
|
|
136
|
+
}, t && (this.translations[e] = {
|
|
137
|
+
...this.translations[e] ?? {},
|
|
138
|
+
...t
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
setLocale(e) {
|
|
142
|
+
this.locale = e;
|
|
143
|
+
}
|
|
144
|
+
t(e, t = {}) {
|
|
145
|
+
return (this.translations[this.locale]?.[e] ?? this.translations.ja[e] ?? e).replace(/\{\{(\w+)\}\}/g, (e, n) => String(t[n] ?? ""));
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
//#endregion
|
|
149
|
+
//#region src/components/icons.ts
|
|
150
|
+
function l(e, t) {
|
|
151
|
+
switch (e) {
|
|
152
|
+
case "arrow": return u("0 0 20 20", [d("M7.28685 6.64194L10.7742 10.0838L7.3011 13.3098C7.06547 13.5391 6.9336 13.8467 6.9336 14.1669C6.9336 14.4871 7.06547 14.7945 7.3011 15.0239C7.41902 15.1378 7.55971 15.2282 7.7149 15.29C7.87009 15.3517 8.03669 15.3835 8.20498 15.3835C8.37328 15.3835 8.53987 15.3517 8.69506 15.29C8.85025 15.2282 8.99095 15.1378 9.10887 15.0239L13.4787 10.9746C13.7134 10.7475 13.845 10.4422 13.845 10.1243C13.845 9.80629 13.7134 9.50107 13.4787 9.27399L9.10886 4.96826C8.86878 4.74159 8.54377 4.61426 8.20498 4.61426C7.86619 4.61426 7.54118 4.74159 7.3011 4.96826C7.18102 5.08007 7.08568 5.2134 7.02057 5.36056C6.95546 5.50772 6.92188 5.6657 6.92188 5.82528C6.92188 5.98487 6.95546 6.14293 7.02057 6.29009C7.08568 6.43725 7.18102 6.57058 7.3011 6.68239L7.28685 6.64194Z")], t);
|
|
153
|
+
case "default": return u("0 0 20 20", [f("1", "4", "18", "12", "3")], t);
|
|
154
|
+
case "wide": return u("0 0 20 20", [f("1", "2.5", "18", "15", "3"), d("M5.5719 6.31811C5.88754 6.00907 6.39381 6.01422 6.70294 6.3298C7.01206 6.64539 7.00674 7.15165 6.69124 7.46084L5.06993 9.04896L14.7642 9.16988L13.1761 7.54857C12.867 7.23293 12.8722 6.72667 13.1878 6.41754C13.5034 6.10841 14.0096 6.11374 14.3188 6.42923L17.2579 9.42977C17.5671 9.7454 17.5619 10.2516 17.2462 10.5608L14.2457 13.4999C13.93 13.809 13.4238 13.8038 13.1146 13.4882C12.8055 13.1726 12.8109 12.6664 13.1263 12.3572L14.7477 10.7691L5.0534 10.6481L6.64152 12.2695C6.95055 12.5851 6.94541 13.0914 6.62982 13.4005C6.31424 13.7096 5.80797 13.7043 5.49879 13.3888L2.55967 10.3883C2.2505 10.0726 2.25573 9.5664 2.57136 9.25723L5.5719 6.31811Z")], t);
|
|
155
|
+
case "fullscreen": return u("0 0 20 20", [f("1", "1", "18", "18", "3"), d("M8.69922 3.7002C9.14096 3.7003 9.49902 4.05824 9.49902 4.5C9.49902 4.94176 9.14096 5.2997 8.69922 5.2998H6.42969L14.6992 13.5693V11.2998C14.6993 10.8581 15.0573 10.5 15.499 10.5C15.9408 10.5 16.2987 10.8581 16.2988 11.2998V15.5C16.2988 15.9418 15.9409 16.2998 15.499 16.2998H11.2988C10.8571 16.2997 10.499 15.9418 10.499 15.5C10.499 15.0582 10.8571 14.7003 11.2988 14.7002H13.5684L5.29883 6.43066V8.7002C5.29872 9.14193 4.94079 9.5 4.49902 9.5C4.05726 9.5 3.69932 9.14193 3.69922 8.7002V4.5C3.69922 4.05817 4.0572 3.7002 4.49902 3.7002H8.69922Z")], t);
|
|
156
|
+
case "one": return u("0 0 20 20", [f("1", "2", "18", "16", "3"), ee("6", "4", "8", "12", "1.5")], t);
|
|
157
|
+
case "two": return u("0 0 20 20", [
|
|
158
|
+
f("1", "2", "18", "16", "3"),
|
|
159
|
+
d("M3 5.5C3 4.67157 3.67157 4 4.5 4H9.5V16H4.5C3.67157 16 3 15.3284 3 14.5V5.5Z"),
|
|
160
|
+
d("M10.5 4H15.5C16.3284 4 17 4.67157 17 5.5V14.5C17 15.3284 16.3284 16 15.5 16H10.5V4Z")
|
|
161
|
+
], t);
|
|
162
|
+
case "play": return u("0 0 20 20", [d("M17.0385 7.78428L6.49809 1.19667C4.68077 0.190227 2.5 1.37966 2.5 3.48403V16.5678C2.5 18.5806 4.68077 19.8616 6.49809 18.7636L17.0385 12.176C18.7649 11.1696 18.7649 8.79072 17.0385 7.78428Z")], t);
|
|
163
|
+
case "pause": return u("0 0 20 20", [d("M6.14289 18.3332H4.68573C3.47144 18.3332 2.5 17.3332 2.5 16.0832V3.9165C2.5 2.6665 3.47144 1.6665 4.68573 1.6665H6.14289C7.35718 1.6665 8.32862 2.6665 8.32862 3.9165V15.9998C8.40957 17.3332 7.43814 18.3332 6.14289 18.3332Z"), d("M15.3138 18.3332H13.8555C12.6402 18.3332 11.668 17.3332 11.668 16.0832V3.9165C11.668 2.6665 12.6402 1.6665 13.8555 1.6665H15.3138C16.5291 1.6665 17.5013 2.6665 17.5013 3.9165V15.9998C17.5013 17.3332 16.5291 18.3332 15.3138 18.3332Z")], t);
|
|
164
|
+
case "settings": return u("0 0 24 24", [d("M10.0144 1.34782C11.2164 0.658798 12.6836 0.658798 13.8856 1.34782C13.8947 1.35299 13.9036 1.35831 13.9125 1.36376L20.1001 5.17383C21.3211 5.88071 22 7.15791 22 8.54376V15.56C22 16.9 21.3552 18.2127 20.1836 18.8369L14.0125 22.6368C14.0036 22.6423 13.9947 22.6476 13.9856 22.6527C12.7836 23.3418 11.3164 23.3418 10.1144 22.6527C10.1053 22.6476 10.0964 22.6423 10.0875 22.6368L3.89984 18.8267C2.67884 18.1198 2 16.8426 2 15.4568V8.54376C2 7.15919 2.6776 5.88306 3.8965 5.17578L9.98139 1.36758C9.99225 1.36078 10.0032 1.35419 10.0144 1.34782ZM11.0006 3.14323L4.91861 6.94964C4.90775 6.95644 4.89675 6.96302 4.88564 6.96939C4.31578 7.29605 4 7.87148 4 8.54376V15.4568C4 16.1291 4.31578 16.7045 4.88564 17.0312C4.89466 17.0364 4.9036 17.0417 4.91246 17.0471L11.0978 20.8558C11.6895 21.1893 12.4105 21.1893 13.0022 20.8558L19.1875 17.0471C19.2088 17.034 19.2306 17.0217 19.2528 17.0103C19.6582 16.8011 20 16.2698 20 15.56V8.54376C20 7.87148 19.6842 7.29605 19.1144 6.96939C19.1053 6.96422 19.0964 6.95891 19.0875 6.95346L12.9022 3.14482C12.3115 2.8118 11.5918 2.81127 11.0006 3.14323ZM12 9.8851C10.8402 9.8851 9.89999 10.8552 9.89999 12.0519C9.89999 13.2486 10.8402 14.2187 12 14.2187C13.1598 14.2187 14.1 13.2486 14.1 12.0519C14.1 10.8552 13.1598 9.8851 12 9.8851ZM7.89999 12.0519C7.89999 9.7155 9.73563 7.8215 12 7.8215C14.2644 7.8215 16.1 9.7155 16.1 12.0519C16.1 14.3883 14.2644 16.2823 12 16.2823C9.73563 16.2823 7.89999 14.3883 7.89999 12.0519Z")], t);
|
|
165
|
+
case "menu": return p(t);
|
|
166
|
+
case "close": return te(t);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
function u(e, t, n) {
|
|
170
|
+
let r = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
171
|
+
return r.setAttribute("viewBox", e), r.setAttribute("fill", "none"), r.classList.add("comimi-icon"), n && r.classList.add(n), r.append(...t), r;
|
|
172
|
+
}
|
|
173
|
+
function d(e) {
|
|
174
|
+
let t = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
175
|
+
return t.setAttribute("d", e), t.classList.add("comimi-icon-fill"), t;
|
|
176
|
+
}
|
|
177
|
+
function f(e, t, n, r, i) {
|
|
178
|
+
let a = document.createElementNS("http://www.w3.org/2000/svg", "rect");
|
|
179
|
+
return a.setAttribute("x", e), a.setAttribute("y", t), a.setAttribute("width", n), a.setAttribute("height", r), a.setAttribute("rx", i), a.classList.add("comimi-icon-stroke"), a;
|
|
180
|
+
}
|
|
181
|
+
function ee(e, t, n, r, i) {
|
|
182
|
+
let a = document.createElementNS("http://www.w3.org/2000/svg", "rect");
|
|
183
|
+
return a.setAttribute("x", e), a.setAttribute("y", t), a.setAttribute("width", n), a.setAttribute("height", r), a.setAttribute("rx", i), a.classList.add("comimi-icon-fill"), a;
|
|
184
|
+
}
|
|
185
|
+
function p(e) {
|
|
186
|
+
let t = document.createElement("span");
|
|
187
|
+
t.className = `comimi-menu-svg ${e ?? ""}`.trim();
|
|
188
|
+
for (let e = 0; e < 3; e += 1) t.append(document.createElement("span"));
|
|
189
|
+
return t;
|
|
190
|
+
}
|
|
191
|
+
function te(e) {
|
|
192
|
+
let t = document.createElement("span");
|
|
193
|
+
return t.className = `comimi-close-svg ${e ?? ""}`.trim(), t.append(document.createElement("span"), document.createElement("span")), t;
|
|
194
|
+
}
|
|
195
|
+
//#endregion
|
|
196
|
+
//#region src/components/arrow-buttons.ts
|
|
197
|
+
function m({ state: e, callbacks: t }) {
|
|
198
|
+
let n = document.createElement("div");
|
|
199
|
+
return n.className = "comimi-arrows", n.dataset.overlay = String(e.overlayVisible), n.append(h("prev", () => g(e, t, "left")), h("next", () => g(e, t, "right"))), n;
|
|
200
|
+
}
|
|
201
|
+
function h(e, t) {
|
|
202
|
+
let n = document.createElement("button");
|
|
203
|
+
n.type = "button", n.className = `comimi-arrow-button comimi-arrow-${e}`, n.setAttribute("aria-label", e === "next" ? "Next page" : "Previous page"), n.addEventListener("click", (e) => {
|
|
204
|
+
e.stopPropagation(), t();
|
|
205
|
+
});
|
|
206
|
+
let r = document.createElement("span");
|
|
207
|
+
r.className = "comimi-arrow-inner";
|
|
208
|
+
let i = document.createElement("span");
|
|
209
|
+
i.className = "comimi-arrow-bg";
|
|
210
|
+
let a = l("arrow");
|
|
211
|
+
return a.classList.add("comimi-arrow-icon"), r.append(i, a), n.append(r), n;
|
|
212
|
+
}
|
|
213
|
+
function g(e, t, n) {
|
|
214
|
+
ne(n, e.settings.readingDirection) ? t.nextPage() : t.previousPage();
|
|
215
|
+
}
|
|
216
|
+
function ne(e, t) {
|
|
217
|
+
return t === "rtl" ? e === "left" : e === "right";
|
|
218
|
+
}
|
|
219
|
+
//#endregion
|
|
220
|
+
//#region src/components/center-message.ts
|
|
221
|
+
function re(e, t) {
|
|
222
|
+
let n = document.createElement("div");
|
|
223
|
+
n.className = "comimi-center-message", n.dataset.overlay = String(e.overlayVisible);
|
|
224
|
+
let r = document.createElement("div");
|
|
225
|
+
r.className = "comimi-center-message-text comimi-center-message-desktop", r.textContent = t.t("overlay.centerHint.desktop");
|
|
226
|
+
let i = document.createElement("div");
|
|
227
|
+
return i.className = "comimi-center-message-text comimi-center-message-mobile", i.textContent = t.t("overlay.centerHint.mobile"), n.append(r, i), n;
|
|
228
|
+
}
|
|
229
|
+
//#endregion
|
|
230
|
+
//#region src/components/rabbit-mascot.ts
|
|
231
|
+
function _() {
|
|
232
|
+
let e = document.createElement("div");
|
|
233
|
+
return e.className = "comimi-rabbit", e.innerHTML = "<svg viewBox=\"0 0 50 42\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" class=\"comimi-rabbit-svg\">\n <mask id=\"comimi-rabbit-mask\" style=\"mask-type:alpha\" maskUnits=\"userSpaceOnUse\" x=\"0\" y=\"0\" width=\"50\" height=\"42\">\n <rect width=\"50\" height=\"42\" fill=\"#D9D9D9\"/>\n </mask>\n <g mask=\"url(#comimi-rabbit-mask)\">\n <path d=\"M3 33V42H47L48 38.5L47.5 33.5L46 28L42.5 24V21.5L43 15L41 6L36 2.5L29 4L25 8.5L21 4L15 2.5L9.5 6L7.5 14L7 25L3 33Z\" fill=\"white\"/>\n <path d=\"M44.4296 22.6958C44.6658 21.2364 44.8262 19.5939 44.9287 17.6301C45.1827 12.7786 44.6212 8.87326 43.2531 6.01234C41.4929 2.32572 38.3601 0.259256 34.1979 0.0405582C30.3119 -0.155823 27.1881 1.20546 24.9822 4.0396C22.3752 0.562755 18.828 -0.129044 16.0027 0.0182422C11.5152 0.254792 4.09982 2.85685 4.87077 17.6301C4.98218 19.759 5.1426 21.4372 5.37433 22.9011C1.8984 26.6592 0 31.3143 0 36.1301C0 38.2814 0.374332 40.4103 1.11854 42.4589C1.44831 43.365 2.30392 43.9318 3.21301 43.9318C3.46702 43.9318 3.72103 43.8872 3.97504 43.7979C5.13369 43.3784 5.73084 42.0974 5.31194 40.937C4.74599 39.3793 4.46078 37.7636 4.46078 36.1301C4.46078 32.1534 6.18984 28.2838 9.32709 25.2399C9.87077 24.7087 10.1114 23.9411 9.95989 23.1957C9.65241 21.6827 9.46078 19.8929 9.32709 17.398C9.16667 14.3005 8.67202 4.87422 16.2433 4.47699C19.3717 4.31185 21.4349 5.80703 22.7139 9.1589V19.4689C22.7139 20.7008 23.7121 21.7005 24.9421 21.7005C26.172 21.7005 27.1702 20.7008 27.1702 19.4689V9.18122C28.5294 5.82042 30.6907 4.32971 33.9706 4.49931C36.5107 4.63321 38.1863 5.72669 39.2424 7.94045C40.2807 10.1185 40.6996 13.2963 40.4857 17.398C40.3699 19.6608 40.1604 21.4952 39.8529 23.0038C39.697 23.7581 39.9465 24.5436 40.5036 25.0703C43.7522 28.1454 45.5392 32.073 45.5392 36.1301C45.5392 37.7592 45.254 39.3793 44.6881 40.937C44.2692 42.0974 44.8663 43.3739 46.025 43.7979C47.1836 44.2174 48.4581 43.6194 48.8815 42.4589C49.6212 40.4103 50 38.2814 50 36.1301C50 31.2161 48.0348 26.4896 44.4385 22.6958H44.4296Z\" fill=\"#E0E0E0\"/>\n <path d=\"M15.6152 37.4779C17.0919 37.4779 18.289 36.279 18.289 34.8C18.289 33.321 17.0919 32.1221 15.6152 32.1221C14.1385 32.1221 12.9414 33.321 12.9414 34.8C12.9414 36.279 14.1385 37.4779 15.6152 37.4779Z\" fill=\"#E0E0E0\"/>\n <path d=\"M29.6113 37.4779C31.088 37.4779 32.2851 36.279 32.2851 34.8C32.2851 33.321 31.088 32.1221 29.6113 32.1221C28.1346 32.1221 26.9375 33.321 26.9375 34.8C26.9375 36.279 28.1346 37.4779 29.6113 37.4779Z\" fill=\"#E0E0E0\"/>\n </g>\n</svg>", e;
|
|
234
|
+
}
|
|
235
|
+
//#endregion
|
|
236
|
+
//#region src/components/inputs.ts
|
|
237
|
+
var v = class {
|
|
238
|
+
root;
|
|
239
|
+
constructor(e) {
|
|
240
|
+
this.root = document.createElement("button"), this.root.type = "button", this.root.className = "comimi-toggle-switch", this.root.dataset.checked = "false";
|
|
241
|
+
let t = document.createElement("span");
|
|
242
|
+
t.className = "comimi-toggle-track";
|
|
243
|
+
let n = document.createElement("span");
|
|
244
|
+
n.className = "comimi-toggle-knob", t.append(n);
|
|
245
|
+
let r = document.createElement("span");
|
|
246
|
+
r.className = "comimi-toggle-label-wrap";
|
|
247
|
+
let i = document.createElement("span");
|
|
248
|
+
i.className = "comimi-toggle-label-inner";
|
|
249
|
+
let a = document.createElement("span");
|
|
250
|
+
a.className = "comimi-toggle-label comimi-toggle-label-on", a.textContent = "ON";
|
|
251
|
+
let o = document.createElement("span");
|
|
252
|
+
o.className = "comimi-toggle-label comimi-toggle-label-off", o.textContent = "OFF", i.append(a, o), r.append(i), this.root.append(t, r), this.root.addEventListener("click", (t) => {
|
|
253
|
+
t.stopPropagation(), e(this.root.dataset.checked !== "true");
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
setChecked(e) {
|
|
257
|
+
this.root.dataset.checked = String(e);
|
|
258
|
+
}
|
|
259
|
+
getElement() {
|
|
260
|
+
return this.root;
|
|
261
|
+
}
|
|
262
|
+
}, y = class {
|
|
263
|
+
root;
|
|
264
|
+
select;
|
|
265
|
+
label;
|
|
266
|
+
options = [];
|
|
267
|
+
constructor(e) {
|
|
268
|
+
this.root = document.createElement("div"), this.root.className = "comimi-selectbox";
|
|
269
|
+
let t = document.createElement("span");
|
|
270
|
+
t.className = "comimi-selectbox-bg", this.select = document.createElement("select"), this.select.className = "comimi-selectbox-select", this.select.addEventListener("change", () => {
|
|
271
|
+
let t = this.options.find((e) => String(e.value) === this.select.value);
|
|
272
|
+
t && e(t.value);
|
|
273
|
+
}), this.label = document.createElement("span"), this.label.className = "comimi-selectbox-label";
|
|
274
|
+
let n = l("arrow");
|
|
275
|
+
n.classList.add("comimi-selectbox-arrow"), this.root.append(t, this.select, this.label, n);
|
|
276
|
+
}
|
|
277
|
+
setOptions(e) {
|
|
278
|
+
let t = this.select.value;
|
|
279
|
+
this.options = e, this.select.replaceChildren();
|
|
280
|
+
for (let t of e) {
|
|
281
|
+
let e = document.createElement("option");
|
|
282
|
+
e.value = String(t.value), e.textContent = t.label, this.select.append(e);
|
|
283
|
+
}
|
|
284
|
+
t && this.setValue(t);
|
|
285
|
+
}
|
|
286
|
+
setValue(e) {
|
|
287
|
+
this.select.value = String(e);
|
|
288
|
+
let t = this.options.find((t) => String(t.value) === String(e));
|
|
289
|
+
this.label.textContent = t?.label ?? "";
|
|
290
|
+
}
|
|
291
|
+
getElement() {
|
|
292
|
+
return this.root;
|
|
293
|
+
}
|
|
294
|
+
}, b = class {
|
|
295
|
+
root;
|
|
296
|
+
input;
|
|
297
|
+
fill;
|
|
298
|
+
valueLabel;
|
|
299
|
+
unit = "";
|
|
300
|
+
min = 0;
|
|
301
|
+
max = 100;
|
|
302
|
+
constructor(e) {
|
|
303
|
+
this.root = document.createElement("div"), this.root.className = "comimi-range-slider";
|
|
304
|
+
let t = document.createElement("div");
|
|
305
|
+
t.className = "comimi-range-slider-wrap";
|
|
306
|
+
let n = document.createElement("div");
|
|
307
|
+
n.className = "comimi-range-slider-track", this.fill = document.createElement("div"), this.fill.className = "comimi-range-slider-fill", this.fill.style.width = "0%", n.append(this.fill), this.input = document.createElement("input"), this.input.className = "comimi-range-slider-input", this.input.type = "range", this.input.addEventListener("input", () => e(Number(this.input.value))), t.append(n, this.input), this.valueLabel = document.createElement("span"), this.valueLabel.className = "comimi-range-slider-value", this.root.append(t, this.valueLabel);
|
|
308
|
+
}
|
|
309
|
+
setRange(e, t, n = 1) {
|
|
310
|
+
this.min = e, this.max = t, this.input.min = String(e), this.input.max = String(t), this.input.step = String(n);
|
|
311
|
+
}
|
|
312
|
+
setUnit(e) {
|
|
313
|
+
this.unit = e, this.refreshLabel();
|
|
314
|
+
}
|
|
315
|
+
setValue(e) {
|
|
316
|
+
this.input.value = String(e);
|
|
317
|
+
let t = this.max === this.min ? 0 : (e - this.min) / (this.max - this.min) * 100;
|
|
318
|
+
this.fill.style.width = `${Math.min(Math.max(t, 0), 100)}%`, this.refreshLabel();
|
|
319
|
+
}
|
|
320
|
+
refreshLabel() {
|
|
321
|
+
this.valueLabel.textContent = `${this.input.value}${this.unit}`;
|
|
322
|
+
}
|
|
323
|
+
getElement() {
|
|
324
|
+
return this.root;
|
|
325
|
+
}
|
|
326
|
+
}, ie = class {
|
|
327
|
+
callbacks;
|
|
328
|
+
i18n;
|
|
329
|
+
root;
|
|
330
|
+
body;
|
|
331
|
+
inner;
|
|
332
|
+
titleEl;
|
|
333
|
+
localeLabel;
|
|
334
|
+
coverLabel;
|
|
335
|
+
directionLabel;
|
|
336
|
+
animationLabel;
|
|
337
|
+
intervalLabel;
|
|
338
|
+
localeSelect;
|
|
339
|
+
coverToggle;
|
|
340
|
+
directionSelect;
|
|
341
|
+
animationToggle;
|
|
342
|
+
intervalSlider;
|
|
343
|
+
constructor(e, t) {
|
|
344
|
+
this.callbacks = e, this.i18n = t, this.root = document.createElement("div"), this.root.className = "comimi-settings-panel", this.root.dataset.open = "false", this.root.setAttribute("role", "dialog"), this.root.addEventListener("click", (e) => e.stopPropagation()), this.body = document.createElement("div"), this.body.className = "comimi-settings-panel-body", this.inner = document.createElement("div"), this.inner.className = "comimi-settings-panel-inner", this.titleEl = document.createElement("div"), this.titleEl.className = "comimi-settings-panel-title", this.localeSelect = new y((e) => this.callbacks.updateSettings({ locale: String(e) })), this.coverToggle = new v((e) => this.callbacks.updateSettings({ hasCover: e })), this.directionSelect = new y((e) => this.callbacks.updateSettings({ readingDirection: e })), this.animationToggle = new v((e) => this.callbacks.updateSettings({ pageTurnAnimation: e })), this.intervalSlider = new b((e) => this.callbacks.updateSettings({ autoPageTurnIntervalMs: Math.max(1, e) * 1e3 })), this.intervalSlider.setRange(3, 30, 1), this.localeLabel = this.createLabel(), this.coverLabel = this.createLabel(), this.directionLabel = this.createLabel(), this.animationLabel = this.createLabel(), this.intervalLabel = this.createLabel(), this.inner.append(this.titleEl, this.section(this.localeLabel, this.localeSelect.getElement()), this.section(this.coverLabel, this.coverToggle.getElement()), this.section(this.directionLabel, this.directionSelect.getElement()), this.section(this.animationLabel, this.animationToggle.getElement()), this.section(this.intervalLabel, this.intervalSlider.getElement())), this.body.append(this.inner), this.root.append(this.body);
|
|
345
|
+
}
|
|
346
|
+
update(e) {
|
|
347
|
+
this.titleEl.textContent = this.i18n.t("settings.title"), this.localeLabel.textContent = "Language", this.coverLabel.textContent = this.i18n.t("settings.cover"), this.directionLabel.textContent = this.i18n.t("settings.direction"), this.animationLabel.textContent = this.i18n.t("settings.animation"), this.intervalLabel.textContent = this.i18n.t("settings.interval"), this.localeSelect.setOptions([{
|
|
348
|
+
label: "日本語",
|
|
349
|
+
value: "ja"
|
|
350
|
+
}, {
|
|
351
|
+
label: "English",
|
|
352
|
+
value: "en"
|
|
353
|
+
}]), this.directionSelect.setOptions([{
|
|
354
|
+
label: this.i18n.t("settings.direction.rtl"),
|
|
355
|
+
value: "rtl"
|
|
356
|
+
}, {
|
|
357
|
+
label: this.i18n.t("settings.direction.ltr"),
|
|
358
|
+
value: "ltr"
|
|
359
|
+
}]), this.intervalSlider.setUnit(this.i18n.t("settings.interval.unit")), this.localeSelect.setValue(e.settings.locale), this.coverToggle.setChecked(e.settings.hasCover), this.directionSelect.setValue(e.settings.readingDirection), this.animationToggle.setChecked(e.settings.pageTurnAnimation), this.intervalSlider.setValue(Math.round(e.settings.autoPageTurnIntervalMs / 1e3)), this.root.dataset.open = String(e.panel === "settings"), this.scheduleHeightUpdate();
|
|
360
|
+
}
|
|
361
|
+
getElement() {
|
|
362
|
+
return this.root;
|
|
363
|
+
}
|
|
364
|
+
createLabel() {
|
|
365
|
+
let e = document.createElement("div");
|
|
366
|
+
return e.className = "comimi-settings-label", e;
|
|
367
|
+
}
|
|
368
|
+
section(e, t) {
|
|
369
|
+
let n = document.createElement("div");
|
|
370
|
+
return n.className = "comimi-settings-section", n.append(e, t), n;
|
|
371
|
+
}
|
|
372
|
+
scheduleHeightUpdate() {
|
|
373
|
+
let e = () => {
|
|
374
|
+
this.root.style.setProperty("--comimi-settings-height", `${this.body.offsetHeight}px`);
|
|
375
|
+
};
|
|
376
|
+
typeof requestAnimationFrame == "function" ? requestAnimationFrame(() => requestAnimationFrame(e)) : setTimeout(e, 0);
|
|
377
|
+
}
|
|
378
|
+
}, x = class {
|
|
379
|
+
callbacks;
|
|
380
|
+
i18n;
|
|
381
|
+
root;
|
|
382
|
+
seekCurrent;
|
|
383
|
+
seekTotal;
|
|
384
|
+
seekBar;
|
|
385
|
+
seekFill;
|
|
386
|
+
seekInput;
|
|
387
|
+
autoplayContainer;
|
|
388
|
+
autoplayButton;
|
|
389
|
+
autoplaySlider;
|
|
390
|
+
autoplayTooltip;
|
|
391
|
+
autoplayProgress;
|
|
392
|
+
autoplayProgressBar;
|
|
393
|
+
side;
|
|
394
|
+
pageMode;
|
|
395
|
+
pageModeSingleBtn;
|
|
396
|
+
pageModeSpreadBtn;
|
|
397
|
+
pageModeSingleIcon;
|
|
398
|
+
pageModeSpreadIcon;
|
|
399
|
+
pageModeSingleTooltip;
|
|
400
|
+
pageModeSpreadTooltip;
|
|
401
|
+
settings;
|
|
402
|
+
settingsContainer;
|
|
403
|
+
settingsButton;
|
|
404
|
+
settingsIcon;
|
|
405
|
+
settingsTooltip;
|
|
406
|
+
prevPageTurnMode;
|
|
407
|
+
constructor(e, t) {
|
|
408
|
+
this.callbacks = e, this.i18n = t, this.root = document.createElement("div"), this.root.className = "comimi-controls-dock", this.root.dataset.overlay = "false", this.root.dataset.autoplay = "false";
|
|
409
|
+
let n = document.createElement("div");
|
|
410
|
+
n.className = "comimi-controls-bg", this.root.append(n, this.buildSeek(), this.buildRow(), _());
|
|
411
|
+
}
|
|
412
|
+
getElement() {
|
|
413
|
+
return this.root;
|
|
414
|
+
}
|
|
415
|
+
update(e, t) {
|
|
416
|
+
this.root.dataset.autoplay = String(e.autoPageTurnEnabled);
|
|
417
|
+
let n = e.manga.pages.length, r = Math.max(1, n), i = e.currentPageIndex + 1, a = n <= 1 ? 0 : e.currentPageIndex / (n - 1);
|
|
418
|
+
this.seekCurrent.textContent = String(i), this.seekTotal.textContent = ` / ${r}`, this.seekFill.style.width = `${a * 100}%`, this.seekBar.dataset.direction = e.settings.readingDirection, this.seekInput.max = String(Math.max(0, n - 1)), document.activeElement !== this.seekInput && (this.seekInput.value = String(e.currentPageIndex)), this.seekInput.dataset.direction = e.settings.readingDirection, this.autoplaySlider.dataset.active = String(e.autoPageTurnEnabled);
|
|
419
|
+
let o = this.i18n.t("overlay.autoPageTurn");
|
|
420
|
+
this.autoplayButton.setAttribute("aria-label", o), this.autoplayTooltip.textContent = o, e.autoPageTurnEnabled ? (this.autoplayProgress || (this.autoplayProgress = document.createElement("div"), this.autoplayProgress.className = "comimi-autoplay-progress", this.autoplayProgressBar = document.createElement("span"), this.autoplayProgressBar.className = "comimi-autoplay-progress-bar", this.autoplayProgress.append(this.autoplayProgressBar), this.autoplayContainer.append(this.autoplayProgress)), this.autoplayProgressBar.style.animationDuration = `${e.settings.autoPageTurnIntervalMs}ms`) : this.autoplayProgress && (this.autoplayProgress.remove(), this.autoplayProgress = void 0, this.autoplayProgressBar = void 0);
|
|
421
|
+
let s = e.settings.pageTurnMode === "spread";
|
|
422
|
+
if (this.pageModeSingleBtn.dataset.selected = String(!s), this.pageModeSpreadBtn.dataset.selected = String(s), this.prevPageTurnMode !== void 0 && this.prevPageTurnMode !== e.settings.pageTurnMode) {
|
|
423
|
+
let e = s ? this.pageModeSpreadIcon : this.pageModeSingleIcon;
|
|
424
|
+
this.applyPopAnimation(e);
|
|
425
|
+
}
|
|
426
|
+
this.pageModeSingleTooltip.textContent = this.i18n.t("pageMode.single"), this.pageModeSpreadTooltip.textContent = this.i18n.t("pageMode.spread"), this.pageMode.style.display = t ? "none" : "";
|
|
427
|
+
let c = this.i18n.t("overlay.settings");
|
|
428
|
+
this.settingsButton.setAttribute("aria-label", c), this.settingsTooltip.textContent = c, this.settingsContainer.dataset.open = String(e.panel === "settings"), this.settings.update(e), this.prevPageTurnMode = e.settings.pageTurnMode;
|
|
429
|
+
}
|
|
430
|
+
buildSeek() {
|
|
431
|
+
let e = document.createElement("div");
|
|
432
|
+
e.className = "comimi-seek";
|
|
433
|
+
let t = document.createElement("div");
|
|
434
|
+
t.className = "comimi-seek-text", this.seekCurrent = document.createElement("span"), this.seekCurrent.className = "comimi-seek-current", this.seekTotal = document.createElement("span"), this.seekTotal.className = "comimi-seek-total", t.append(this.seekCurrent, this.seekTotal), this.seekBar = document.createElement("div"), this.seekBar.className = "comimi-seek-bar", this.seekBar.dataset.direction = "rtl";
|
|
435
|
+
let n = document.createElement("div");
|
|
436
|
+
return n.className = "comimi-seek-track", this.seekFill = document.createElement("div"), this.seekFill.className = "comimi-seek-fill", this.seekFill.style.width = "0%", n.append(this.seekFill), this.seekInput = document.createElement("input"), this.seekInput.className = "comimi-seek-input", this.seekInput.type = "range", this.seekInput.min = "0", this.seekInput.max = "0", this.seekInput.step = "1", this.seekInput.value = "0", this.seekInput.setAttribute("aria-label", "Seek bar"), this.seekInput.addEventListener("input", () => {
|
|
437
|
+
this.callbacks.goToPage(Number(this.seekInput.value));
|
|
438
|
+
}), this.seekBar.append(n, this.seekInput), e.append(t, this.seekBar), e;
|
|
439
|
+
}
|
|
440
|
+
buildRow() {
|
|
441
|
+
let e = document.createElement("div");
|
|
442
|
+
return e.className = "comimi-controls-row", e.append(this.buildAutoplay(), this.buildSide()), e;
|
|
443
|
+
}
|
|
444
|
+
buildAutoplay() {
|
|
445
|
+
this.autoplayContainer = document.createElement("div"), this.autoplayContainer.className = "comimi-autoplay", this.autoplayButton = document.createElement("button"), this.autoplayButton.type = "button", this.autoplayButton.className = "comimi-autoplay-button comimi-has-tooltip", this.autoplayButton.addEventListener("click", (e) => {
|
|
446
|
+
e.stopPropagation(), this.callbacks.toggleAutoPageTurn();
|
|
447
|
+
});
|
|
448
|
+
let e = document.createElement("span");
|
|
449
|
+
e.className = "comimi-autoplay-window", this.autoplaySlider = document.createElement("span"), this.autoplaySlider.className = "comimi-autoplay-slider", this.autoplaySlider.dataset.active = "false";
|
|
450
|
+
let t = l("play");
|
|
451
|
+
t.classList.add("comimi-autoplay-icon", "comimi-autoplay-icon-play");
|
|
452
|
+
let n = l("pause");
|
|
453
|
+
return n.classList.add("comimi-autoplay-icon", "comimi-autoplay-icon-pause"), this.autoplaySlider.append(t, n), e.append(this.autoplaySlider), this.autoplayTooltip = document.createElement("span"), this.autoplayTooltip.className = "comimi-tooltip", this.autoplayButton.append(e, this.autoplayTooltip), this.autoplayContainer.append(this.autoplayButton), this.autoplayContainer;
|
|
454
|
+
}
|
|
455
|
+
buildSide() {
|
|
456
|
+
this.side = document.createElement("div"), this.side.className = "comimi-controls-side", this.pageMode = document.createElement("div"), this.pageMode.className = "comimi-page-mode";
|
|
457
|
+
let e = document.createElement("div");
|
|
458
|
+
return e.className = "comimi-page-mode-wrapper", [this.pageModeSingleBtn, this.pageModeSingleIcon, this.pageModeSingleTooltip] = this.buildPageModeButton("single", "one"), [this.pageModeSpreadBtn, this.pageModeSpreadIcon, this.pageModeSpreadTooltip] = this.buildPageModeButton("spread", "two"), e.append(this.pageModeSingleBtn, this.pageModeSpreadBtn), this.pageMode.append(e), [this.settingsContainer, this.settingsButton, this.settingsIcon, this.settingsTooltip] = this.buildSettings(), this.settings = new ie(this.callbacks, this.i18n), this.settingsContainer.append(this.settings.getElement()), this.side.append(this.pageMode, this.settingsContainer), this.side;
|
|
459
|
+
}
|
|
460
|
+
buildPageModeButton(e, t) {
|
|
461
|
+
let n = document.createElement("button");
|
|
462
|
+
n.type = "button", n.className = "comimi-page-mode-button comimi-has-tooltip", n.dataset.selected = "false", n.addEventListener("click", (t) => {
|
|
463
|
+
t.stopPropagation(), this.callbacks.updateSettings({ pageTurnMode: e });
|
|
464
|
+
});
|
|
465
|
+
let r = l(t);
|
|
466
|
+
r.classList.add("comimi-page-mode-icon");
|
|
467
|
+
let i = document.createElement("span");
|
|
468
|
+
return i.className = "comimi-tooltip", n.append(r, i), [
|
|
469
|
+
n,
|
|
470
|
+
r,
|
|
471
|
+
i
|
|
472
|
+
];
|
|
473
|
+
}
|
|
474
|
+
buildSettings() {
|
|
475
|
+
let e = document.createElement("div");
|
|
476
|
+
e.className = "comimi-settings", e.dataset.open = "false";
|
|
477
|
+
let t = document.createElement("button");
|
|
478
|
+
t.type = "button", t.className = "comimi-settings-button comimi-has-tooltip", t.addEventListener("click", (t) => {
|
|
479
|
+
t.stopPropagation();
|
|
480
|
+
let n = e.dataset.open === "true";
|
|
481
|
+
this.callbacks.setPanel(n ? "none" : "settings");
|
|
482
|
+
});
|
|
483
|
+
let n = l("settings");
|
|
484
|
+
n.classList.add("comimi-settings-icon");
|
|
485
|
+
let r = document.createElement("span");
|
|
486
|
+
return r.className = "comimi-tooltip", t.append(n, r), e.append(t), [
|
|
487
|
+
e,
|
|
488
|
+
t,
|
|
489
|
+
n,
|
|
490
|
+
r
|
|
491
|
+
];
|
|
492
|
+
}
|
|
493
|
+
applyPopAnimation(e) {
|
|
494
|
+
e.classList.remove("comimi-pop-animate"), e.offsetWidth, e.classList.add("comimi-pop-animate");
|
|
495
|
+
}
|
|
496
|
+
}, S = class {
|
|
497
|
+
callbacks;
|
|
498
|
+
i18n;
|
|
499
|
+
root;
|
|
500
|
+
titleEl;
|
|
501
|
+
authorEl;
|
|
502
|
+
bottomEl;
|
|
503
|
+
viewMenu;
|
|
504
|
+
viewShortcut;
|
|
505
|
+
viewPageList;
|
|
506
|
+
pageListInner;
|
|
507
|
+
pageListCacheKey;
|
|
508
|
+
currentState;
|
|
509
|
+
currentView = "menu";
|
|
510
|
+
i18nTexts = [];
|
|
511
|
+
constructor(e, t) {
|
|
512
|
+
this.callbacks = e, this.i18n = t, this.root = document.createElement("div"), this.root.className = "comimi-menu-panel", this.root.setAttribute("role", "dialog"), this.root.dataset.open = "false", this.root.dataset.view = "menu", this.root.dataset.overlay = "false";
|
|
513
|
+
let n = document.createElement("div");
|
|
514
|
+
n.className = "comimi-menu-bg";
|
|
515
|
+
let r = this.buildTop();
|
|
516
|
+
[this.titleEl, this.authorEl] = this.findTitleNodes(r), this.bottomEl = document.createElement("div"), this.bottomEl.className = "comimi-menu-bottom", this.bottomEl.style.height = "0px";
|
|
517
|
+
let i = document.createElement("div");
|
|
518
|
+
i.className = "comimi-menu-border", this.viewMenu = this.buildMenuView(), this.viewShortcut = this.buildShortcutView(), [this.viewPageList, this.pageListInner] = this.buildPageListView(), this.bottomEl.append(i, this.viewMenu, this.viewShortcut, this.viewPageList), this.root.append(n, r, this.bottomEl, _());
|
|
519
|
+
}
|
|
520
|
+
getElement() {
|
|
521
|
+
return this.root;
|
|
522
|
+
}
|
|
523
|
+
bindI18nText(e, t) {
|
|
524
|
+
e.textContent = this.i18n.t(t), this.i18nTexts.push({
|
|
525
|
+
el: e,
|
|
526
|
+
key: t
|
|
527
|
+
});
|
|
528
|
+
}
|
|
529
|
+
refreshI18nTexts() {
|
|
530
|
+
for (let { el: e, key: t } of this.i18nTexts) e.textContent = this.i18n.t(t);
|
|
531
|
+
}
|
|
532
|
+
update(e) {
|
|
533
|
+
let t = e.panel === "menu" || e.panel === "pages" || e.panel === "shortcuts", n = e.panel === "pages" ? "pageList" : e.panel === "shortcuts" ? "shortcut" : "menu";
|
|
534
|
+
this.root.dataset.open = String(t), this.root.dataset.view = n, this.root.dataset.overlay = String(e.overlayVisible), this.titleEl.textContent = e.manga.title, e.manga.author ? (this.authorEl.textContent = `@${e.manga.author}`, this.authorEl.style.display = "") : (this.authorEl.textContent = "", this.authorEl.style.display = "none"), this.refreshI18nTexts(), this.refreshPageList(e), this.applyHeight(t, n), this.currentState = e, this.currentView = n;
|
|
535
|
+
}
|
|
536
|
+
applyHeight(e, t) {
|
|
537
|
+
if (!e) {
|
|
538
|
+
this.bottomEl.style.height = "0px";
|
|
539
|
+
return;
|
|
540
|
+
}
|
|
541
|
+
let n = (t === "menu" ? this.viewMenu : t === "shortcut" ? this.viewShortcut : this.viewPageList).offsetHeight;
|
|
542
|
+
this.bottomEl.style.height = `${n}px`;
|
|
543
|
+
}
|
|
544
|
+
refreshPageList(e) {
|
|
545
|
+
let t = `${e.manga.id}:${e.manga.pages.length}`;
|
|
546
|
+
this.pageListCacheKey !== t && (this.pageListCacheKey = t, this.pageListInner.replaceChildren(), e.manga.pages.forEach((e, t) => {
|
|
547
|
+
let n = document.createElement("button");
|
|
548
|
+
n.type = "button", n.className = "comimi-page-list-item", n.addEventListener("click", (e) => {
|
|
549
|
+
e.stopPropagation(), this.callbacks.goToPage(t), this.callbacks.setPanel("none");
|
|
550
|
+
});
|
|
551
|
+
let r = document.createElement("span");
|
|
552
|
+
if (r.className = "comimi-page-list-thumb", e.type === "image") {
|
|
553
|
+
let n = document.createElement("img");
|
|
554
|
+
n.alt = e.alt ?? e.label ?? this.i18n.t("seek.previewAlt", { page: t + 1 }), n.draggable = !1, n.src = e.thumbnailSrc ?? e.src, r.append(n);
|
|
555
|
+
}
|
|
556
|
+
let i = document.createElement("span");
|
|
557
|
+
i.className = "comimi-page-list-text", i.textContent = e.label ?? String(t + 1), n.append(r, i), this.pageListInner.append(n);
|
|
558
|
+
}));
|
|
559
|
+
}
|
|
560
|
+
buildTop() {
|
|
561
|
+
let e = document.createElement("button");
|
|
562
|
+
e.type = "button", e.className = "comimi-menu-top", e.addEventListener("click", (e) => {
|
|
563
|
+
e.stopPropagation();
|
|
564
|
+
let t = this.currentState, n = t?.panel === "menu" || t?.panel === "pages" || t?.panel === "shortcuts";
|
|
565
|
+
this.callbacks.setPanel(n ? "none" : "menu");
|
|
566
|
+
});
|
|
567
|
+
let t = document.createElement("span");
|
|
568
|
+
t.className = "comimi-menu-button";
|
|
569
|
+
let n = document.createElement("span");
|
|
570
|
+
n.className = "comimi-menu-button-inner", n.append(l("menu"), l("close")), t.append(n);
|
|
571
|
+
let r = document.createElement("span");
|
|
572
|
+
r.className = "comimi-menu-title-wrap";
|
|
573
|
+
let i = document.createElement("span");
|
|
574
|
+
i.className = "comimi-menu-title";
|
|
575
|
+
let a = document.createElement("span");
|
|
576
|
+
return a.className = "comimi-menu-author", r.append(i, a), e.append(t, r), e;
|
|
577
|
+
}
|
|
578
|
+
findTitleNodes(e) {
|
|
579
|
+
let t = e.querySelector(".comimi-menu-title"), n = e.querySelector(".comimi-menu-author");
|
|
580
|
+
if (!t || !n) throw Error("MenuPanel title nodes missing");
|
|
581
|
+
return [t, n];
|
|
582
|
+
}
|
|
583
|
+
buildMenuView() {
|
|
584
|
+
let e = document.createElement("div");
|
|
585
|
+
e.className = "comimi-menu-view comimi-menu-view-menu";
|
|
586
|
+
let t = document.createElement("div");
|
|
587
|
+
return t.className = "comimi-menu-list", t.append(this.renderMenuLink("menu.openPages", () => this.callbacks.setPanel("pages")), this.renderMenuLink("menu.openShortcuts", () => this.callbacks.setPanel("shortcuts"))), e.append(t), e;
|
|
588
|
+
}
|
|
589
|
+
renderMenuLink(e, t) {
|
|
590
|
+
let n = document.createElement("button");
|
|
591
|
+
n.type = "button", n.className = "comimi-menu-link", n.addEventListener("click", (e) => {
|
|
592
|
+
e.stopPropagation(), t();
|
|
593
|
+
});
|
|
594
|
+
let r = document.createElement("span");
|
|
595
|
+
r.className = "comimi-menu-link-text", this.bindI18nText(r, e);
|
|
596
|
+
let i = document.createElement("span");
|
|
597
|
+
return i.className = "comimi-menu-link-arrow", i.append(l("arrow")), n.append(r, i), n;
|
|
598
|
+
}
|
|
599
|
+
buildShortcutView() {
|
|
600
|
+
let e = document.createElement("div");
|
|
601
|
+
e.className = "comimi-menu-view comimi-menu-view-shortcut";
|
|
602
|
+
let t = document.createElement("div");
|
|
603
|
+
return t.className = "comimi-shortcut-inner", t.append(this.shortcutSection("shortcut.section.page", [
|
|
604
|
+
[["←", "Space"], "shortcut.moveLeft"],
|
|
605
|
+
[["→", "Space + Shift"], "shortcut.moveRight"],
|
|
606
|
+
[["A"], "shortcut.autoPageTurnLabel"]
|
|
607
|
+
]), this.shortcutSection("shortcut.section.viewMode", [
|
|
608
|
+
[["N"], "layout.inline"],
|
|
609
|
+
[["W"], "layout.theater"],
|
|
610
|
+
[["F"], "layout.browserFullscreen"]
|
|
611
|
+
], !0), this.shortcutSection("shortcut.section.general", [
|
|
612
|
+
[["M"], "overlay.menu"],
|
|
613
|
+
[["P"], "shortcut.pageModeToggle"],
|
|
614
|
+
[["S"], "overlay.settings"]
|
|
615
|
+
], !0)), e.append(t, this.renderBackButton()), e;
|
|
616
|
+
}
|
|
617
|
+
buildPageListView() {
|
|
618
|
+
let e = document.createElement("div");
|
|
619
|
+
e.className = "comimi-menu-view comimi-menu-view-page-list";
|
|
620
|
+
let t = document.createElement("div");
|
|
621
|
+
return t.className = "comimi-page-list-inner", e.append(t, this.renderBackButton()), [e, t];
|
|
622
|
+
}
|
|
623
|
+
shortcutSection(e, t, n = !1) {
|
|
624
|
+
let r = document.createElement("div");
|
|
625
|
+
r.className = "comimi-shortcut-section";
|
|
626
|
+
let i = document.createElement("div");
|
|
627
|
+
i.className = "comimi-shortcut-heading", this.bindI18nText(i, e);
|
|
628
|
+
let a = document.createElement("div");
|
|
629
|
+
a.className = n ? "comimi-shortcut-column" : "comimi-shortcut-list";
|
|
630
|
+
for (let [e, n] of t) a.append(this.shortcutItem(e, n));
|
|
631
|
+
return r.append(i, a), r;
|
|
632
|
+
}
|
|
633
|
+
shortcutItem(e, t) {
|
|
634
|
+
let n = document.createElement("div");
|
|
635
|
+
n.className = "comimi-shortcut-item";
|
|
636
|
+
let r = document.createElement("span");
|
|
637
|
+
r.className = "comimi-shortcut-badge", e.forEach((e, t) => {
|
|
638
|
+
if (t > 0) {
|
|
639
|
+
let e = document.createElement("span");
|
|
640
|
+
e.className = "comimi-shortcut-or", r.append(e);
|
|
641
|
+
}
|
|
642
|
+
let n = document.createElement("span");
|
|
643
|
+
n.className = "comimi-shortcut-key", n.textContent = e, r.append(n);
|
|
644
|
+
});
|
|
645
|
+
let i = document.createElement("span");
|
|
646
|
+
return i.className = "comimi-shortcut-label", this.bindI18nText(i, t), n.append(r, i), n;
|
|
647
|
+
}
|
|
648
|
+
renderBackButton() {
|
|
649
|
+
let e = document.createElement("button");
|
|
650
|
+
e.type = "button", e.className = "comimi-back-button", e.addEventListener("click", (e) => {
|
|
651
|
+
e.stopPropagation(), this.callbacks.setPanel("menu");
|
|
652
|
+
});
|
|
653
|
+
let t = document.createElement("span");
|
|
654
|
+
t.className = "comimi-back-inner";
|
|
655
|
+
let n = document.createElement("span");
|
|
656
|
+
n.className = "comimi-back-bg";
|
|
657
|
+
let r = document.createElement("span");
|
|
658
|
+
r.className = "comimi-back-text", this.bindI18nText(r, "menu.back");
|
|
659
|
+
let i = document.createElement("span");
|
|
660
|
+
return i.className = "comimi-back-arrow", i.append(l("arrow")), t.append(n, r, i), e.append(t), e;
|
|
661
|
+
}
|
|
662
|
+
}, ae = class {
|
|
663
|
+
callbacks;
|
|
664
|
+
i18n;
|
|
665
|
+
root;
|
|
666
|
+
indicator;
|
|
667
|
+
tooltip;
|
|
668
|
+
entries;
|
|
669
|
+
prevMode;
|
|
670
|
+
constructor(e, t) {
|
|
671
|
+
this.callbacks = e, this.i18n = t, this.root = document.createElement("div"), this.root.className = "comimi-view-switcher comimi-has-tooltip", this.root.dataset.overlay = "false", this.indicator = document.createElement("span"), this.indicator.className = "comimi-view-switcher-indicator", this.indicator.style.transform = "translateX(0px)", this.root.append(this.indicator);
|
|
672
|
+
let n = [
|
|
673
|
+
[
|
|
674
|
+
"inline",
|
|
675
|
+
"layout.inline",
|
|
676
|
+
"default"
|
|
677
|
+
],
|
|
678
|
+
[
|
|
679
|
+
"theater",
|
|
680
|
+
"layout.theater",
|
|
681
|
+
"wide"
|
|
682
|
+
],
|
|
683
|
+
[
|
|
684
|
+
"browserFullscreen",
|
|
685
|
+
"layout.browserFullscreen",
|
|
686
|
+
"fullscreen"
|
|
687
|
+
]
|
|
688
|
+
];
|
|
689
|
+
this.entries = n.map(([e, n, r]) => {
|
|
690
|
+
let i = document.createElement("button");
|
|
691
|
+
i.type = "button", i.className = "comimi-view-switcher-button", i.dataset.selected = "false", i.addEventListener("click", (t) => {
|
|
692
|
+
t.stopPropagation(), this.callbacks.setLayoutMode(e);
|
|
693
|
+
});
|
|
694
|
+
let a = document.createElement("span");
|
|
695
|
+
a.className = "comimi-view-switcher-icon-wrap";
|
|
696
|
+
let o = l(r);
|
|
697
|
+
o.classList.add("comimi-view-switcher-icon"), a.append(o);
|
|
698
|
+
let s = document.createElement("span");
|
|
699
|
+
return s.className = "comimi-view-switcher-label", s.textContent = t.t(n), i.append(a, s), this.root.append(i), {
|
|
700
|
+
mode: e,
|
|
701
|
+
iconName: r,
|
|
702
|
+
labelKey: n,
|
|
703
|
+
button: i,
|
|
704
|
+
iconWrap: a
|
|
705
|
+
};
|
|
706
|
+
}), this.tooltip = document.createElement("span"), this.tooltip.className = "comimi-tooltip", this.tooltip.textContent = t.t("overlay.layout"), this.root.append(this.tooltip);
|
|
707
|
+
}
|
|
708
|
+
getElement() {
|
|
709
|
+
return this.root;
|
|
710
|
+
}
|
|
711
|
+
update(e) {
|
|
712
|
+
this.root.dataset.overlay = String(e.overlayVisible);
|
|
713
|
+
let t = Math.max(0, this.entries.findIndex((t) => t.mode === e.layout.mode));
|
|
714
|
+
this.indicator.style.transform = `translateX(${t * 60}px)`;
|
|
715
|
+
let n = this.prevMode !== void 0 && this.prevMode !== e.layout.mode;
|
|
716
|
+
for (let t of this.entries) {
|
|
717
|
+
let r = t.mode === e.layout.mode;
|
|
718
|
+
t.button.dataset.selected = String(r), t.iconWrap.classList.toggle("comimi-pop-animate", n && r), t.button.querySelector(".comimi-view-switcher-label").textContent = this.i18n.t(t.labelKey);
|
|
719
|
+
}
|
|
720
|
+
this.tooltip.textContent = this.i18n.t("overlay.layout"), this.prevMode = e.layout.mode;
|
|
721
|
+
}
|
|
722
|
+
};
|
|
723
|
+
//#endregion
|
|
724
|
+
//#region src/components/page-layout.ts
|
|
725
|
+
function C(e, t) {
|
|
726
|
+
return A(e, e.currentPageIndex, t);
|
|
727
|
+
}
|
|
728
|
+
function w(e, t, n) {
|
|
729
|
+
let r = C(e, n), i = t === "previous" ? Math.min(...r) - 1 : Math.max(...r) + 1;
|
|
730
|
+
return i < 0 || i >= e.manga.pages.length ? [] : A(e, i, n);
|
|
731
|
+
}
|
|
732
|
+
function T(e, t) {
|
|
733
|
+
let n = [];
|
|
734
|
+
for (let r = 1; r >= 1; --r) {
|
|
735
|
+
let i = k(e, "previous", r, t);
|
|
736
|
+
i.length > 0 && n.push({
|
|
737
|
+
indexes: i,
|
|
738
|
+
placement: "previous",
|
|
739
|
+
offset: E(e, "previous", r)
|
|
740
|
+
});
|
|
741
|
+
}
|
|
742
|
+
n.push({
|
|
743
|
+
indexes: C(e, t),
|
|
744
|
+
placement: "current",
|
|
745
|
+
offset: 0
|
|
746
|
+
});
|
|
747
|
+
for (let r = 1; r <= 1; r += 1) {
|
|
748
|
+
let i = k(e, "next", r, t);
|
|
749
|
+
i.length > 0 && n.push({
|
|
750
|
+
indexes: i,
|
|
751
|
+
placement: "next",
|
|
752
|
+
offset: E(e, "next", r)
|
|
753
|
+
});
|
|
754
|
+
}
|
|
755
|
+
return n;
|
|
756
|
+
}
|
|
757
|
+
function E(e, t, n) {
|
|
758
|
+
let r = e.settings.readingDirection === "rtl" ? -1 : 1;
|
|
759
|
+
return (t === "next" ? r : -r) * n;
|
|
760
|
+
}
|
|
761
|
+
function D(e, t) {
|
|
762
|
+
if (t === "current") return "center";
|
|
763
|
+
let n = e.settings.readingDirection === "rtl" ? "left" : "right";
|
|
764
|
+
return t === "next" ? n : n === "left" ? "right" : "left";
|
|
765
|
+
}
|
|
766
|
+
function O(e, t) {
|
|
767
|
+
return t === "rtl" ? e > 0 : e < 0;
|
|
768
|
+
}
|
|
769
|
+
function k(e, t, n, r) {
|
|
770
|
+
let i = C(e, r);
|
|
771
|
+
for (let a = 0; a < n; a += 1) {
|
|
772
|
+
let n = t === "previous" ? Math.min(...i) - 1 : Math.max(...i) + 1;
|
|
773
|
+
if (n < 0 || n >= e.manga.pages.length) return [];
|
|
774
|
+
i = A(e, n, r);
|
|
775
|
+
}
|
|
776
|
+
return i;
|
|
777
|
+
}
|
|
778
|
+
function A(e, t, n) {
|
|
779
|
+
let { manga: r, settings: i } = e;
|
|
780
|
+
if (n || i.pageTurnMode !== "spread" || i.hasCover && t === 0) return [t];
|
|
781
|
+
let a = [t, oe(e, t)].filter((e) => e >= 0 && e < r.pages.length), o = [...new Set(a)].sort((e, t) => e - t);
|
|
782
|
+
return i.readingDirection === "rtl" ? o.reverse() : o;
|
|
783
|
+
}
|
|
784
|
+
function oe(e, t) {
|
|
785
|
+
return e.settings.hasCover ? t % 2 == 1 ? t + 1 : t - 1 : t % 2 == 0 ? t + 1 : t - 1;
|
|
786
|
+
}
|
|
787
|
+
//#endregion
|
|
788
|
+
//#region src/components/error-icon.ts
|
|
789
|
+
var j = "\n<svg viewBox=\"0 0 112.19 99.01\" class=\"comimi-error-svg\" xmlns=\"http://www.w3.org/2000/svg\">\n <g>\n <path class=\"comimi-error-stroke\" d=\"M17.43,53.54c-7.74,7.51-12.43,17.29-12.43,27.99,0,4.34.78,8.53,2.21,12.48\" />\n <path class=\"comimi-error-stroke\" d=\"M104.98,94.01c1.43-3.95,2.21-8.14,2.21-12.48,0-10.91-4.87-20.85-12.87-28.42\" />\n <path class=\"comimi-error-stroke comimi-error-mimi comimi-error-mimi-left\" d=\"M55.79,43.81v-24.02c3.43-9.18,9.81-15.08,20.52-14.52,16.12.84,20.31,15.9,19.35,34.15-.25,4.75-.69,9.25-1.51,13.3\" />\n <path class=\"comimi-error-stroke comimi-error-mimi comimi-error-mimi-right\" d=\"M55.79,43.62v-24.02c-3.25-9.2-9.34-15.11-19.78-14.56-16.53.87-21.21,15.95-20.25,34.2.26,4.91.67,9.56,1.51,13.72\" />\n <path fill=\"#fff\" d=\"M80.44,49.41H31.46c-12.97,6.71-21.6,18.57-21.6,32.1,0,5.8,1.59,11.3,4.43,16.21h83.34c2.83-4.92,4.43-10.41,4.43-16.21,0-13.53-8.63-25.4-21.6-32.1Z\" />\n <g class=\"comimi-error-eyes\">\n <path class=\"comimi-error-eye\" d=\"M45.85,75.85c1.92,1.92,1.92,5.05,0,6.97s-5.05,1.92-6.97,0l-1.74-1.74-1.74,1.74c-1.92,1.92-5.05,1.92-6.97,0-1.92-1.92-1.92-5.05,0-6.97l1.74-1.74-1.74-1.74c-1.92-1.92-1.92-5.05,0-6.97s5.05-1.92,6.97,0l1.74,1.74,1.74-1.74c1.92-1.92,5.05-1.92,6.97,0,1.93,1.92,1.93,5.05,0,6.97l-1.74,1.74,1.74,1.74Z\" />\n <path class=\"comimi-error-eye\" d=\"M77.89,75.85c1.92,1.92,1.92,5.05,0,6.97-1.92,1.92-5.05,1.92-6.97,0l-1.74-1.74-1.74,1.74c-1.92,1.92-5.05,1.92-6.97,0-1.92-1.92-1.92-5.05,0-6.97l1.74-1.74-1.74-1.74c-1.92-1.92-1.92-5.05,0-6.97,1.92-1.92,5.05-1.92,6.97,0l1.74,1.74,1.74-1.74c1.92-1.92,5.05-1.92,6.97,0,1.92,1.92,1.92,5.05,0,6.97l-1.74,1.74,1.74,1.74Z\" />\n </g>\n </g>\n</svg>\n";
|
|
790
|
+
function M(e, t) {
|
|
791
|
+
let n = document.createElement("div");
|
|
792
|
+
n.className = "comimi-error-icon";
|
|
793
|
+
let r = document.createElement("div");
|
|
794
|
+
r.className = "comimi-error-icon-svg", r.innerHTML = j;
|
|
795
|
+
let i = document.createElement("div");
|
|
796
|
+
return i.className = "comimi-error-icon-text", i.textContent = e.t("error.pageRequestFailed", { page: t }), n.append(r, i), n;
|
|
797
|
+
}
|
|
798
|
+
//#endregion
|
|
799
|
+
//#region src/components/loading-icon.ts
|
|
800
|
+
var N = "\n<svg viewBox=\"0 0 112.19 99.01\" class=\"comimi-loading-svg\" xmlns=\"http://www.w3.org/2000/svg\">\n <g>\n <path class=\"comimi-loading-stroke\" d=\"M17.43,53.54c-7.74,7.51-12.43,17.29-12.43,27.99,0,4.34.78,8.53,2.21,12.48\" />\n <path class=\"comimi-loading-stroke\" d=\"M104.98,94.01c1.43-3.95,2.21-8.14,2.21-12.48,0-10.91-4.87-20.85-12.87-28.42\" />\n <path class=\"comimi-loading-stroke comimi-loading-mimi comimi-loading-mimi-left\" d=\"M55.79,43.81v-24.02c3.43-9.18,9.81-15.08,20.52-14.52,16.12.84,20.31,15.9,19.35,34.15-.25,4.75-.69,9.25-1.51,13.3\" />\n <path class=\"comimi-loading-stroke comimi-loading-mimi comimi-loading-mimi-right\" d=\"M55.79,43.62v-24.02c-3.25-9.2-9.34-15.11-19.78-14.56-16.53.87-21.21,15.95-20.25,34.2.26,4.91.67,9.56,1.51,13.72\" />\n <path fill=\"#fff\" d=\"M80.44,49.41H31.46c-12.97,6.71-21.6,18.57-21.6,32.1,0,5.8,1.59,11.3,4.43,16.21h83.34c2.83-4.92,4.43-10.41,4.43-16.21,0-13.53-8.63-25.4-21.6-32.1Z\" />\n <g class=\"comimi-loading-eyes\">\n <circle class=\"comimi-loading-eye\" cx=\"40.17\" cy=\"78.21\" r=\"6\" />\n <circle class=\"comimi-loading-eye\" cx=\"71.58\" cy=\"78.21\" r=\"6\" />\n </g>\n </g>\n</svg>\n", P = 3e3;
|
|
801
|
+
function F(e) {
|
|
802
|
+
let t = document.createElement("div");
|
|
803
|
+
t.className = "comimi-loading-icon";
|
|
804
|
+
let n = document.createElement("div");
|
|
805
|
+
n.className = "comimi-loading-icon-svg", n.innerHTML = N;
|
|
806
|
+
let r = document.createElement("div");
|
|
807
|
+
r.className = "comimi-loading-icon-text", r.append(document.createTextNode(e.t("loading")));
|
|
808
|
+
for (let e = 0; e < 3; e += 1) {
|
|
809
|
+
let e = document.createElement("span");
|
|
810
|
+
e.textContent = ".", r.append(e);
|
|
811
|
+
}
|
|
812
|
+
t.append(n, r);
|
|
813
|
+
let i = window.setInterval(() => {
|
|
814
|
+
if (!t.isConnected) {
|
|
815
|
+
window.clearInterval(i);
|
|
816
|
+
return;
|
|
817
|
+
}
|
|
818
|
+
n.innerHTML = N;
|
|
819
|
+
}, P);
|
|
820
|
+
return t;
|
|
821
|
+
}
|
|
822
|
+
//#endregion
|
|
823
|
+
//#region src/components/page-stage.ts
|
|
824
|
+
var I = class {
|
|
825
|
+
options;
|
|
826
|
+
root;
|
|
827
|
+
imageSources = /* @__PURE__ */ new Map();
|
|
828
|
+
resolvePromises = /* @__PURE__ */ new Map();
|
|
829
|
+
slots = /* @__PURE__ */ new Map();
|
|
830
|
+
constructor(e) {
|
|
831
|
+
this.options = e, this.root = document.createElement("div"), this.root.className = "comimi-stage";
|
|
832
|
+
}
|
|
833
|
+
getElement() {
|
|
834
|
+
return this.root;
|
|
835
|
+
}
|
|
836
|
+
setDragOffset(e, t = !1) {
|
|
837
|
+
this.root.dataset.dragging = t ? "false" : String(e !== 0), this.root.style.transform = e === 0 ? "" : `translateX(${e}px)`;
|
|
838
|
+
}
|
|
839
|
+
snapTransform() {
|
|
840
|
+
this.root.dataset.dragging = "false", this.root.style.transition = "none", this.root.style.transform = "", typeof requestAnimationFrame == "function" ? requestAnimationFrame(() => {
|
|
841
|
+
this.root.style.transition = "";
|
|
842
|
+
}) : this.root.style.transition = "";
|
|
843
|
+
}
|
|
844
|
+
update(e, t) {
|
|
845
|
+
let n = T(e, t), r = [];
|
|
846
|
+
for (let t of n) {
|
|
847
|
+
let n = document.createElement("div");
|
|
848
|
+
n.className = "comimi-page-group", n.dataset.placement = t.placement, n.dataset.side = D(e, t.placement), n.style.transform = `translateX(${t.offset * 100}%)`;
|
|
849
|
+
let i = t.indexes.length > 1;
|
|
850
|
+
for (let [r, a] of t.indexes.entries()) {
|
|
851
|
+
let t = e.manga.pages[a];
|
|
852
|
+
if (!t) continue;
|
|
853
|
+
let o = this.getOrBuildSlot(e, t, a);
|
|
854
|
+
o.slot.dataset.spread = String(i), o.slot.dataset.position = i ? r === 0 ? "left" : "right" : "single", o.slot.dataset.pageIndex = String(a), o.img && (o.img.style.transform = L(e)), n.append(o.slot);
|
|
855
|
+
}
|
|
856
|
+
r.push(n);
|
|
857
|
+
}
|
|
858
|
+
this.root.replaceChildren(...r);
|
|
859
|
+
}
|
|
860
|
+
getOrBuildSlot(e, t, n) {
|
|
861
|
+
let r = this.slots.get(t.id);
|
|
862
|
+
if (r) return r;
|
|
863
|
+
let i = this.buildSlot(e, t, n);
|
|
864
|
+
return this.slots.set(t.id, i), i;
|
|
865
|
+
}
|
|
866
|
+
buildSlot(e, t, n) {
|
|
867
|
+
let r = document.createElement("div");
|
|
868
|
+
if (r.className = "comimi-page", t.type === "html") {
|
|
869
|
+
let n = document.createElement("div");
|
|
870
|
+
return n.className = "comimi-html-page", n.innerHTML = t.html, n.style.transform = L(e), r.append(n), {
|
|
871
|
+
slot: r,
|
|
872
|
+
img: null
|
|
873
|
+
};
|
|
874
|
+
}
|
|
875
|
+
let i = document.createElement("img");
|
|
876
|
+
i.alt = t.alt ?? t.label ?? `${n + 1}`, i.draggable = !1, i.style.transform = L(e), i.addEventListener("error", () => {
|
|
877
|
+
r.replaceChildren(M(this.options.i18n, n + 1));
|
|
878
|
+
}), r.append(i);
|
|
879
|
+
let a = `${e.manga.id}:${t.id}`, o = this.imageSources.get(a);
|
|
880
|
+
if (o) return i.src = o, {
|
|
881
|
+
slot: r,
|
|
882
|
+
img: i
|
|
883
|
+
};
|
|
884
|
+
let s = F(this.options.i18n);
|
|
885
|
+
r.append(s), i.style.visibility = "hidden";
|
|
886
|
+
let c = this.resolvePromises.get(a);
|
|
887
|
+
return c || (c = this.options.assetLoader.resolveImageSource(e.manga.id, t), this.resolvePromises.set(a, c), c.then((e) => {
|
|
888
|
+
this.imageSources.set(a, e);
|
|
889
|
+
}).finally(() => {
|
|
890
|
+
this.resolvePromises.delete(a);
|
|
891
|
+
})), c.then((e) => {
|
|
892
|
+
i.addEventListener("load", () => {
|
|
893
|
+
i.style.visibility = "", s.remove();
|
|
894
|
+
}, { once: !0 }), i.src = e;
|
|
895
|
+
}).catch(() => {
|
|
896
|
+
s.remove(), r.replaceChildren(M(this.options.i18n, n + 1));
|
|
897
|
+
}), {
|
|
898
|
+
slot: r,
|
|
899
|
+
img: i
|
|
900
|
+
};
|
|
901
|
+
}
|
|
902
|
+
};
|
|
903
|
+
function L(e) {
|
|
904
|
+
return `translate(${e.panX}px, ${e.panY}px) scale(${e.zoomScale})`;
|
|
905
|
+
}
|
|
906
|
+
//#endregion
|
|
907
|
+
//#region src/components/notifications.ts
|
|
908
|
+
function R(e) {
|
|
909
|
+
let t = document.createElement("div");
|
|
910
|
+
t.className = "comimi-notifications";
|
|
911
|
+
for (let n of e.notifications) {
|
|
912
|
+
let e = document.createElement("div");
|
|
913
|
+
e.className = "comimi-toast", e.dataset.tone = n.tone ?? "info";
|
|
914
|
+
let r = document.createElement("span");
|
|
915
|
+
r.className = "comimi-toast-dot";
|
|
916
|
+
let i = document.createElement("span");
|
|
917
|
+
i.className = "comimi-toast-text", i.textContent = n.message, e.append(r, i), t.append(e);
|
|
918
|
+
}
|
|
919
|
+
return t;
|
|
920
|
+
}
|
|
921
|
+
//#endregion
|
|
922
|
+
//#region src/components/splash-screen.ts
|
|
923
|
+
var z = "http://www.w3.org/2000/svg";
|
|
924
|
+
function B(e) {
|
|
925
|
+
let t = document.createElement("div");
|
|
926
|
+
t.className = "comimi-splash";
|
|
927
|
+
let n = document.createElement("div");
|
|
928
|
+
n.className = "comimi-splash-logo-wrap";
|
|
929
|
+
let r = document.createElement("div");
|
|
930
|
+
r.className = "comimi-splash-logo", r.append(V(), H());
|
|
931
|
+
let i = document.createElement("div");
|
|
932
|
+
i.className = "comimi-splash-text", i.append(document.createTextNode(e.t("splash.loading")));
|
|
933
|
+
for (let e = 0; e < 3; e += 1) {
|
|
934
|
+
let e = document.createElement("span");
|
|
935
|
+
e.textContent = ".", i.append(e);
|
|
936
|
+
}
|
|
937
|
+
return n.append(r, i), t.append(n), t;
|
|
938
|
+
}
|
|
939
|
+
function V() {
|
|
940
|
+
let e = document.createElementNS(z, "svg");
|
|
941
|
+
e.setAttribute("viewBox", "0 0 112.19 99.01"), e.setAttribute("class", "comimi-splash-symbol"), U(e, "M17.43,53.54c-7.74,7.51-12.43,17.29-12.43,27.99,0,4.34.78,8.53,2.21,12.48"), U(e, "M104.98,94.01c1.43-3.95,2.21-8.14,2.21-12.48,0-10.91-4.87-20.85-12.87-28.42"), U(e, "M55.79,43.81v-24.02c3.43-9.18,9.81-15.08,20.52-14.52,16.12.84,20.31,15.9,19.35,34.15-.25,4.75-.69,9.25-1.51,13.3", "comimi-splash-mimi comimi-splash-mimi-left"), U(e, "M55.79,43.62v-24.02c-3.25-9.2-9.34-15.11-19.78-14.56-16.53.87-21.21,15.95-20.25,34.2.26,4.91.67,9.56,1.51,13.72", "comimi-splash-mimi comimi-splash-mimi-right");
|
|
942
|
+
let t = document.createElementNS(z, "path");
|
|
943
|
+
t.setAttribute("d", "M80.44,49.41H31.46c-12.97,6.71-21.6,18.57-21.6,32.1,0,5.8,1.59,11.3,4.43,16.21h83.34c2.83-4.92,4.43-10.41,4.43-16.21,0-13.53-8.63-25.4-21.6-32.1Z"), t.setAttribute("fill", "#e0e0e0"), e.append(t);
|
|
944
|
+
let n = document.createElementNS(z, "g");
|
|
945
|
+
n.setAttribute("class", "comimi-splash-eyes");
|
|
946
|
+
for (let e of ["40.17", "71.58"]) {
|
|
947
|
+
let t = document.createElementNS(z, "circle");
|
|
948
|
+
t.setAttribute("class", "comimi-splash-eye"), t.setAttribute("cx", e), t.setAttribute("cy", "78.21"), t.setAttribute("r", "6"), t.setAttribute("fill", "#fff"), n.append(t);
|
|
949
|
+
}
|
|
950
|
+
return e.append(n), e;
|
|
951
|
+
}
|
|
952
|
+
function H() {
|
|
953
|
+
let e = document.createElement("div");
|
|
954
|
+
e.className = "comimi-splash-typo-wrap";
|
|
955
|
+
let t = document.createElementNS(z, "svg");
|
|
956
|
+
t.setAttribute("viewBox", "0 0 227.74 38.52"), t.setAttribute("class", "comimi-splash-typo");
|
|
957
|
+
for (let e of [
|
|
958
|
+
"M12.53,14.42c-3.15,3.27-3.15,8.45,0,11.6,1.58,1.58,3.6,2.36,5.74,2.36,2.25,0,4.28-.79,5.86-2.36,1.91-1.91,5.18-1.91,7.21,0,1.91,2.03,1.91,5.18,0,7.21-3.49,3.49-8.11,5.29-13.07,5.29s-9.46-1.8-12.95-5.29C-1.77,26.02-1.77,14.42,5.32,7.32,12.53.11,24.13.11,31.34,7.32c1.91,1.91,1.91,5.18,0,7.1-2.03,2.03-5.29,2.03-7.21,0-3.15-3.15-8.45-3.15-11.6,0Z",
|
|
959
|
+
"M76.15,20.27c0,10.02-8.22,18.25-18.36,18.25-4.96,0-9.57-1.8-12.95-5.29-3.49-3.49-5.41-8.11-5.41-12.95,0-10.14,8.22-18.36,18.36-18.36s18.36,8.22,18.36,18.36ZM66.01,20.27c0-4.5-3.72-8.22-8.22-8.22s-8.22,3.72-8.22,8.22c0,2.14.9,4.17,2.36,5.74,1.58,1.58,3.6,2.36,5.86,2.36,4.5,0,8.22-3.6,8.22-8.11Z",
|
|
960
|
+
"M131.42,15.88v17.57c0,2.82-2.25,5.07-5.07,5.07s-5.07-2.25-5.07-5.07V15.88c0-2.36-2.03-4.39-4.51-4.39-1.13,0-2.25.45-3.15,1.24-.79.9-1.24,2.03-1.24,3.15v14.57c0,2.82-2.25,5.07-5.07,5.07s-5.07-2.25-5.07-5.07v-14.57c0-2.36-2.03-4.39-4.5-4.39s-4.39,1.92-4.39,4.39v17.68c0,2.7-2.25,4.96-5.07,4.96s-5.07-2.25-5.07-5.07V15.88c0-8,6.53-14.53,14.53-14.53,3.72,0,6.98,1.35,9.57,3.49,2.59-2.25,5.97-3.49,9.46-3.49,8.11,0,14.64,6.53,14.64,14.53Z",
|
|
961
|
+
"M150.98,5.07v28.38c0,2.82-2.25,5.07-5.07,5.07s-5.07-2.25-5.07-5.07V5.07c0-2.7,2.25-5.07,5.07-5.07s5.07,2.36,5.07,5.07Z",
|
|
962
|
+
"M208.61,15.88v17.57c0,2.82-2.25,5.07-5.07,5.07s-5.07-2.25-5.07-5.07V15.88c0-2.36-2.03-4.39-4.51-4.39-1.13,0-2.25.45-3.15,1.24-.79.9-1.24,2.03-1.24,3.15v14.57c0,2.82-2.25,5.07-5.07,5.07s-5.07-2.25-5.07-5.07v-14.57c0-2.36-2.03-4.39-4.5-4.39s-4.39,1.92-4.39,4.39v17.68c0,2.7-2.25,4.96-5.07,4.96s-5.07-2.25-5.07-5.07V15.88c0-8,6.53-14.53,14.53-14.53,3.72,0,6.98,1.35,9.57,3.49,2.59-2.25,5.97-3.49,9.46-3.49,8.11,0,14.64,6.53,14.64,14.53Z",
|
|
963
|
+
"M227.74,5.07v28.38c0,2.82-2.25,5.07-5.07,5.07s-5.07-2.25-5.07-5.07V5.07c0-2.7,2.25-5.07,5.07-5.07s5.07,2.36,5.07,5.07Z"
|
|
964
|
+
]) {
|
|
965
|
+
let n = document.createElementNS(z, "path");
|
|
966
|
+
n.setAttribute("d", e), n.setAttribute("fill", "#fff"), t.append(n);
|
|
967
|
+
}
|
|
968
|
+
e.append(t);
|
|
969
|
+
let n = document.createElement("div");
|
|
970
|
+
n.className = "comimi-splash-heart comimi-splash-heart-1";
|
|
971
|
+
let r = document.createElement("div");
|
|
972
|
+
return r.className = "comimi-splash-heart comimi-splash-heart-2", e.append(n, r), e;
|
|
973
|
+
}
|
|
974
|
+
function U(e, t, n) {
|
|
975
|
+
let r = document.createElementNS(z, "path");
|
|
976
|
+
r.setAttribute("d", t), r.setAttribute("class", `comimi-splash-stroke ${n ?? ""}`.trim()), e.append(r);
|
|
977
|
+
}
|
|
978
|
+
//#endregion
|
|
979
|
+
//#region src/components/viewer-root.ts
|
|
980
|
+
function W({ className: e } = {}) {
|
|
981
|
+
let t = document.createElement("div");
|
|
982
|
+
return t.className = e ? `comimi-root ${e}` : "comimi-root", t.tabIndex = 0, t.setAttribute("role", "region"), t.setAttribute("aria-label", "Manga viewer"), t;
|
|
983
|
+
}
|
|
984
|
+
//#endregion
|
|
985
|
+
//#region src/components/arrow-buttons.styles.ts
|
|
986
|
+
var G = "\n.comimi-arrows {\n position: absolute;\n inset: 0;\n pointer-events: none;\n z-index: 30;\n}\n\n.comimi-arrow-button {\n position: absolute;\n top: 50%;\n width: 46px;\n height: 46px;\n padding: 0;\n border: 0;\n background: transparent;\n cursor: pointer;\n pointer-events: auto;\n transform: translateY(-50%);\n}\n\n.comimi-arrow-next {\n right: 24px;\n}\n\n.comimi-arrow-prev {\n left: 24px;\n}\n\n.comimi-arrow-inner {\n position: absolute;\n inset: 0;\n transition:\n transform 0.6s var(--comimi-spring),\n opacity 0.3s linear;\n}\n\n.comimi-arrows[data-overlay=\"false\"] .comimi-arrow-next .comimi-arrow-inner {\n transform: translateX(35px);\n opacity: 0;\n transition:\n transform 0.3s var(--comimi-spring),\n opacity 0.15s linear;\n}\n\n.comimi-arrows[data-overlay=\"false\"] .comimi-arrow-prev .comimi-arrow-inner {\n transform: translateX(-35px);\n opacity: 0;\n transition:\n transform 0.3s var(--comimi-spring),\n opacity 0.15s linear;\n}\n\n.comimi-arrows[data-overlay=\"false\"] {\n pointer-events: none;\n}\n\n.comimi-arrow-bg {\n position: absolute;\n inset: 0;\n border-radius: 16px;\n background: var(--comimi-glass);\n box-shadow: var(--comimi-shadow);\n backdrop-filter: blur(5px);\n transition: inset 0.36s var(--comimi-spring), border-radius 0.36s var(--comimi-spring);\n}\n\n.comimi-arrow-icon {\n position: absolute;\n top: 50%;\n left: 50%;\n width: 20px;\n height: 20px;\n color: #666;\n transform: translate(-50%, -50%);\n pointer-events: none;\n}\n\n.comimi-arrow-prev .comimi-arrow-icon {\n transform: translate(-50%, -50%) scaleX(-1);\n}\n\n@keyframes comimi-arrow-bounce {\n from, to {\n transform: translate(-50%, -50%);\n }\n 40% {\n transform: translate(calc(-50% + 3px), -50%);\n }\n 70% {\n transform: translate(calc(-50% - 1.5px), -50%);\n }\n}\n\n@keyframes comimi-arrow-bounce-prev {\n from, to {\n transform: translate(-50%, -50%) scaleX(-1);\n }\n 40% {\n transform: translate(calc(-50% - 3px), -50%) scaleX(-1);\n }\n 70% {\n transform: translate(calc(-50% + 1.5px), -50%) scaleX(-1);\n }\n}\n\n@media (hover: hover) {\n .comimi-arrow-button:hover .comimi-arrow-bg {\n inset: -3px;\n border-radius: 20px;\n }\n\n .comimi-arrow-next:hover .comimi-arrow-icon {\n animation: comimi-arrow-bounce 0.5s ease-in-out 0.1s both;\n }\n\n .comimi-arrow-prev:hover .comimi-arrow-icon {\n animation: comimi-arrow-bounce-prev 0.5s ease-in-out 0.1s both;\n }\n}\n\n@media (max-width: 767px) {\n .comimi-arrow-button {\n width: 36px;\n height: 50px;\n }\n\n .comimi-arrow-next {\n right: 0;\n }\n\n .comimi-arrow-prev {\n left: 0;\n }\n\n .comimi-arrow-next .comimi-arrow-bg {\n border-radius: 16px 0 0 16px;\n }\n\n .comimi-arrow-prev .comimi-arrow-bg {\n border-radius: 0 16px 16px 0;\n }\n}\n", K = "\n.comimi-center-message {\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n pointer-events: none;\n z-index: 20;\n transition: opacity 0.3s linear;\n}\n\n.comimi-center-message[data-overlay=\"false\"] {\n opacity: 0;\n transition: opacity 0.15s linear;\n}\n\n.comimi-center-message-text {\n box-sizing: border-box;\n padding: 6px 12px;\n border-radius: 8px;\n background: rgba(255, 255, 255, 0.5);\n box-shadow: var(--comimi-shadow);\n backdrop-filter: blur(5px);\n color: #bbb;\n font-size: 12px;\n font-weight: 400;\n line-height: 1.45;\n text-align: center;\n white-space: nowrap;\n}\n\n.comimi-center-message-mobile {\n display: none;\n}\n\n@media (max-width: 767px) {\n .comimi-center-message {\n width: calc(100% - 60px * 2);\n max-width: max-content;\n }\n\n .comimi-center-message-desktop {\n display: none;\n }\n\n .comimi-center-message-mobile {\n display: block;\n }\n}\n", q = "\n/* --- Controls dock (bottom) ------------------------------------------- */\n\n.comimi-controls-dock {\n box-sizing: border-box;\n position: absolute;\n bottom: 24px;\n left: 24px;\n width: calc(100% - 48px);\n padding: 20px 24px;\n z-index: 40;\n pointer-events: auto;\n transition:\n transform 0.6s var(--comimi-spring),\n opacity 0.3s linear;\n}\n\n.comimi-controls-dock[data-overlay=\"false\"] {\n transform: translateY(35px);\n opacity: 0;\n pointer-events: none;\n transition:\n transform 0.3s var(--comimi-spring),\n opacity 0.15s linear;\n}\n\n.comimi-controls-bg {\n position: absolute;\n inset: 0;\n border-radius: 20px;\n background: var(--comimi-glass);\n box-shadow: var(--comimi-shadow);\n backdrop-filter: blur(5px);\n transition: inset 0.36s var(--comimi-spring), border-radius 0.36s var(--comimi-spring);\n}\n\n@media (hover: hover) {\n .comimi-controls-dock:hover > .comimi-controls-bg {\n inset: -4px -4px 0 -4px;\n border-radius: 20px;\n }\n}\n\n.comimi-controls-row {\n position: relative;\n display: grid;\n grid-template-columns: auto auto;\n justify-content: space-between;\n align-items: center;\n}\n\n.comimi-controls-side {\n display: grid;\n grid-auto-flow: column;\n column-gap: 16px;\n justify-content: end;\n align-items: center;\n transition:\n opacity 0.2s ease-in-out,\n visibility 0.2s ease-in-out;\n}\n\n.comimi-controls-dock[data-autoplay=\"true\"] .comimi-controls-side {\n opacity: 0;\n visibility: hidden;\n}\n\n/* --- Seek bar --------------------------------------------------------- */\n\n.comimi-seek {\n position: relative;\n display: grid;\n grid-template-columns: auto 1fr;\n column-gap: 10px;\n align-items: center;\n margin-bottom: 10px;\n}\n\n.comimi-seek-text {\n display: grid;\n grid-template-columns: repeat(2, auto);\n justify-content: start;\n align-items: end;\n line-height: 14px;\n}\n\n.comimi-seek-current {\n color: #333;\n font-size: 12px;\n font-weight: 700;\n}\n\n.comimi-seek-total {\n color: #999;\n font-size: 12px;\n font-weight: 400;\n margin-left: 0.4em;\n}\n\n.comimi-seek-bar {\n position: relative;\n width: 100%;\n height: 18px;\n}\n\n.comimi-seek-track {\n position: absolute;\n top: 50%;\n left: 0;\n right: 0;\n height: 8px;\n border-radius: 999px;\n background: #e0e0e0;\n overflow: hidden;\n transform: translateY(-50%);\n transition: height 0.36s var(--comimi-spring);\n}\n\n@media (hover: hover) {\n .comimi-seek-bar:hover .comimi-seek-track {\n height: 12px;\n }\n}\n\n.comimi-seek-fill {\n position: absolute;\n top: 0;\n height: 100%;\n border-radius: 999px;\n background: #666;\n}\n\n.comimi-seek-bar[data-direction=\"rtl\"] .comimi-seek-fill {\n right: 0;\n border-top-left-radius: 0;\n border-bottom-left-radius: 0;\n}\n\n.comimi-seek-bar[data-direction=\"ltr\"] .comimi-seek-fill {\n left: 0;\n border-top-right-radius: 0;\n border-bottom-right-radius: 0;\n}\n\n.comimi-seek-input {\n position: absolute;\n inset: 0;\n z-index: 1;\n width: 100%;\n height: 18px;\n margin: 0;\n padding: 0;\n border: 0;\n background: transparent;\n appearance: none;\n -webkit-appearance: none;\n cursor: pointer;\n}\n\n.comimi-seek-input::-webkit-slider-runnable-track {\n height: 8px;\n background: transparent;\n border: 0;\n}\n\n.comimi-seek-input::-webkit-slider-thumb {\n appearance: none;\n -webkit-appearance: none;\n width: 18px;\n height: 18px;\n margin-top: -5px;\n border: 0;\n border-radius: 50%;\n background: #666;\n box-shadow: none;\n transition:\n transform 0.36s var(--comimi-spring),\n background-color 0.2s ease-in-out;\n}\n\n.comimi-seek-input:hover::-webkit-slider-thumb {\n transform: scale(1.15);\n}\n\n.comimi-seek-input::-moz-range-track {\n height: 8px;\n background: transparent;\n border: 0;\n}\n\n.comimi-seek-input::-moz-range-thumb {\n width: 18px;\n height: 18px;\n border: 0;\n border-radius: 50%;\n background: #666;\n box-shadow: none;\n transition:\n transform 0.36s var(--comimi-spring),\n background-color 0.2s ease-in-out;\n}\n\n.comimi-seek-input:hover::-moz-range-thumb {\n transform: scale(1.15);\n}\n\n.comimi-seek-input:focus-visible {\n outline: none;\n}\n\n.comimi-seek-input:focus-visible::-webkit-slider-thumb {\n box-shadow: none;\n}\n\n.comimi-seek-input:focus-visible::-moz-range-thumb {\n box-shadow: none;\n}\n\n.comimi-seek-input[data-direction=\"rtl\"] {\n direction: rtl;\n}\n\n/* --- Auto Play -------------------------------------------------------- */\n\n.comimi-autoplay {\n position: relative;\n display: grid;\n grid-template-columns: auto auto;\n column-gap: 12px;\n justify-content: start;\n align-items: center;\n}\n\n.comimi-autoplay-button {\n position: relative;\n width: 24px;\n height: 24px;\n padding: 0;\n border: 0;\n background: transparent;\n color: #666;\n cursor: pointer;\n}\n\n.comimi-autoplay-window {\n position: absolute;\n top: 50%;\n left: 50%;\n width: 20px;\n height: 20px;\n overflow: hidden;\n transform: translate(-50%, -50%);\n}\n\n.comimi-autoplay-slider {\n position: absolute;\n top: 0;\n right: 0;\n width: 200%;\n height: 100%;\n transition: transform 0.36s var(--comimi-spring);\n}\n\n.comimi-autoplay-slider[data-active=\"true\"] {\n transform: translateX(50%);\n}\n\n.comimi-autoplay-icon {\n position: absolute;\n top: 0;\n width: 50%;\n height: 100%;\n display: block;\n}\n\n.comimi-autoplay-icon-play {\n right: 0;\n}\n\n.comimi-autoplay-icon-pause {\n left: 0;\n}\n\n.comimi-autoplay-progress {\n position: relative;\n width: 140px;\n height: 6px;\n border-radius: 999px;\n background: #e0e0e0;\n overflow: hidden;\n}\n\n.comimi-autoplay-progress-bar {\n display: block;\n position: absolute;\n inset: 0;\n border-radius: 999px;\n background: #666;\n animation: comimi-autoplay-progress 3s linear 0s infinite;\n}\n\n/* --- Page Mode Toggle (single / spread) ------------------------------ */\n\n.comimi-page-mode {\n position: relative;\n width: 80px;\n height: 30px;\n}\n\n.comimi-page-mode-wrapper {\n position: absolute;\n top: 50%;\n left: 50%;\n width: 80px;\n height: 30px;\n display: grid;\n grid-template-columns: 1fr 1fr;\n background: #eeeeee;\n border-radius: 8px;\n transform: translate(-50%, -50%);\n transition: width 0.36s var(--comimi-spring);\n}\n\n@media (hover: hover) {\n .comimi-page-mode-wrapper:hover {\n width: 95px;\n }\n}\n\n.comimi-page-mode-button {\n position: relative;\n display: grid;\n place-content: center;\n width: 100%;\n height: 100%;\n padding: 0;\n border: 0;\n background: transparent;\n color: #666;\n cursor: pointer;\n}\n\n.comimi-page-mode-icon {\n display: block;\n width: 20px;\n opacity: 0.3;\n transform-origin: center bottom;\n transition: opacity 0.2s ease-in-out;\n}\n\n.comimi-page-mode-button[data-selected=\"true\"] .comimi-page-mode-icon {\n opacity: 1;\n}\n\n.comimi-page-mode-icon.comimi-pop-animate {\n animation: comimi-pop 0.5s ease-in-out 0s both;\n}\n\n/* --- Settings (button + popover panel) ------------------------------- */\n\n.comimi-settings {\n position: relative;\n width: 24px;\n height: 24px;\n}\n\n.comimi-settings-button {\n position: absolute;\n inset: 0;\n padding: 0;\n border: 0;\n background: transparent;\n cursor: pointer;\n}\n\n.comimi-settings-icon {\n display: block;\n width: 100%;\n height: 100%;\n color: #666;\n transition: transform 0.36s var(--comimi-spring);\n}\n\n.comimi-settings[data-open=\"true\"] .comimi-settings-icon {\n transform: rotate(30deg);\n}\n\n@keyframes comimi-pop {\n from, to {\n transform: scale(1, 1);\n }\n 50% {\n transform: scale(0.95, 1.15);\n }\n 75% {\n transform: scale(1.15, 0.95);\n }\n}\n\n@keyframes comimi-autoplay-progress {\n from {\n transform: translateX(-100%);\n }\n to {\n transform: translateX(0);\n }\n}\n\n@media (max-width: 767px) {\n .comimi-controls-dock {\n bottom: 0;\n left: 0;\n width: 100%;\n padding: 20px 16px calc(20px + env(safe-area-inset-bottom, 0px));\n }\n\n .comimi-controls-bg {\n border-radius: 20px 20px 0 0;\n }\n}\n", se = "\n.comimi-error-icon {\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n display: grid;\n gap: 10px;\n justify-items: center;\n width: 80px;\n}\n\n.comimi-error-icon-svg {\n width: 80px;\n}\n\n.comimi-error-svg {\n display: block;\n width: 100%;\n transform-origin: center bottom;\n animation: comimi-error-fall 0.8s ease-in-out 0s both;\n}\n\n.comimi-error-stroke {\n fill: none;\n stroke: #ccc;\n stroke-linecap: round;\n stroke-linejoin: round;\n stroke-width: 10px;\n}\n\n.comimi-error-mimi {\n transform-origin: 56px 43px;\n}\n\n.comimi-error-mimi-left {\n animation:\n comimi-error-mimi-left-intro 0.8s ease-in-out 0s both,\n comimi-error-mimi-left-loop 1.5s ease-in-out 0.8s infinite forwards;\n}\n\n.comimi-error-mimi-right {\n animation:\n comimi-error-mimi-right-intro 0.8s ease-in-out 0s both,\n comimi-error-mimi-right-loop 1.5s ease-in-out 0.8s infinite forwards;\n}\n\n.comimi-error-eye {\n fill: #ccc;\n transform-origin: center;\n transform-box: fill-box;\n animation: comimi-error-eye 1.5s ease-in-out 0.8s infinite forwards;\n}\n\n.comimi-error-icon-text {\n color: #aaa;\n font-size: 12px;\n font-weight: 700;\n line-height: 1.45;\n text-align: center;\n}\n\n@keyframes comimi-error-fall {\n from {\n opacity: 0;\n transform: translateY(-40%) rotate(10deg);\n }\n 20% {\n opacity: 1;\n }\n 40% {\n transform: translateY(0) rotate(0);\n }\n 60% {\n transform: translateY(0) scale(1.1, 0.95);\n }\n 80% {\n transform: translateY(0) scale(0.95, 1.1);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n}\n\n@keyframes comimi-error-mimi-left-intro {\n from {\n transform: rotate(0deg);\n }\n 60% {\n transform: rotate(20deg);\n }\n to {\n transform: rotate(10deg);\n }\n}\n\n@keyframes comimi-error-mimi-left-loop {\n from, to {\n transform: rotate(10deg);\n }\n 50% {\n transform: rotate(30deg);\n }\n}\n\n@keyframes comimi-error-mimi-right-intro {\n from {\n transform: rotate(0deg);\n }\n 60% {\n transform: rotate(-20deg);\n }\n to {\n transform: rotate(-10deg);\n }\n}\n\n@keyframes comimi-error-mimi-right-loop {\n from, to {\n transform: rotate(-10deg);\n }\n 50% {\n transform: rotate(-30deg);\n }\n}\n\n@keyframes comimi-error-eye {\n from, to {\n transform: translateY(0);\n }\n 50% {\n transform: translateY(4px);\n }\n}\n", ce = "\n.comimi-icon {\n display: block;\n width: 100%;\n height: 100%;\n}\n\n.comimi-icon-fill {\n fill: currentColor;\n transition: fill .2s linear;\n}\n\n.comimi-icon-stroke {\n fill: none;\n stroke: currentColor;\n stroke-width: 1.6;\n transition: stroke .2s linear;\n}\n\n.comimi-menu-svg,\n.comimi-close-svg {\n display: block;\n position: relative;\n width: 34px;\n height: 34px;\n}\n\n.comimi-menu-svg span,\n.comimi-close-svg span {\n position: absolute;\n left: 50%;\n width: 17px;\n height: 3px;\n border-radius: 999px;\n background: #666;\n}\n\n.comimi-menu-svg span:nth-child(1) {\n top: 9px;\n transform: translateX(-50%);\n}\n\n.comimi-menu-svg span:nth-child(2) {\n top: 50%;\n transform: translate(-50%, -50%);\n}\n\n.comimi-menu-svg span:nth-child(3) {\n bottom: 9px;\n transform: translateX(-50%);\n}\n\n.comimi-close-svg span {\n top: 50%;\n}\n\n.comimi-close-svg span:nth-child(1) {\n transform: translate(-50%, -50%) rotate(45deg);\n}\n\n.comimi-close-svg span:nth-child(2) {\n transform: translate(-50%, -50%) rotate(-45deg);\n}\n", le = "\n.comimi-selectbox {\n position: relative;\n display: inline-block;\n width: 100%;\n}\n\n.comimi-selectbox-bg {\n position: absolute;\n inset: 0;\n border-radius: 8px;\n background: #eeeeee;\n transition: inset 0.36s var(--comimi-spring);\n}\n\n@media (hover: hover) {\n .comimi-selectbox:hover .comimi-selectbox-bg {\n inset: -3px;\n }\n}\n\n.comimi-selectbox-select {\n position: absolute;\n inset: 0;\n z-index: 2;\n width: 100%;\n height: 100%;\n box-sizing: border-box;\n margin: 0;\n padding: 0;\n border: 0;\n background: transparent;\n appearance: none;\n -webkit-appearance: none;\n color: transparent;\n font: inherit;\n cursor: pointer;\n opacity: 0;\n}\n\n.comimi-selectbox-select:disabled {\n cursor: not-allowed;\n}\n\n.comimi-selectbox-label {\n position: relative;\n display: block;\n box-sizing: border-box;\n width: 100%;\n padding: 8px 32px 8px 12px;\n color: #333;\n font-size: 12px;\n font-weight: 400;\n line-height: 1.45;\n cursor: pointer;\n pointer-events: none;\n}\n\n.comimi-selectbox-arrow {\n position: absolute;\n top: 50%;\n right: 12px;\n z-index: 1;\n width: 16px;\n height: 16px;\n color: #aaa;\n transform: translateY(-50%) rotate(90deg);\n pointer-events: none;\n}\n\n@media (hover: hover) {\n .comimi-selectbox:hover .comimi-selectbox-arrow {\n animation: comimi-selectbox-arrow 0.5s ease-in-out 0s both;\n }\n}\n\n@keyframes comimi-selectbox-arrow {\n from, to {\n transform: translateY(-50%) rotate(90deg);\n }\n 40% {\n transform: translateY(calc(-50% + 3px)) rotate(90deg);\n }\n 70% {\n transform: translateY(calc(-50% - 1.5px)) rotate(90deg);\n }\n}\n\n.comimi-toggle-switch {\n display: grid;\n grid-template-columns: repeat(2, auto);\n column-gap: 6px;\n justify-content: start;\n align-items: center;\n width: 100%;\n padding: 2px;\n border: 0;\n background: transparent;\n cursor: pointer;\n}\n\n.comimi-toggle-track {\n position: relative;\n width: 32px;\n height: 18px;\n border-radius: 999px;\n background: #eeeeee;\n transition: background-color 0.2s linear;\n}\n\n.comimi-toggle-switch[data-checked=\"true\"] .comimi-toggle-track {\n background: #666;\n}\n\n.comimi-toggle-knob {\n position: absolute;\n top: 2px;\n left: 2px;\n width: 14px;\n height: 14px;\n border-radius: 50%;\n background: #666;\n transition:\n transform 0.36s var(--comimi-spring),\n background-color 0.2s linear;\n}\n\n.comimi-toggle-switch[data-checked=\"true\"] .comimi-toggle-knob {\n background: #fff;\n transform: translateX(100%);\n}\n\n.comimi-toggle-label-wrap {\n position: relative;\n width: 22px;\n height: 12px;\n overflow: hidden;\n}\n\n.comimi-toggle-label-inner {\n position: absolute;\n inset: 0;\n transition: transform 0.36s var(--comimi-spring);\n}\n\n.comimi-toggle-switch[data-checked=\"false\"] .comimi-toggle-label-inner {\n transform: translateX(-100%);\n}\n\n.comimi-toggle-label {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n font-size: 11px;\n font-weight: 400;\n line-height: 12px;\n text-align: center;\n}\n\n.comimi-toggle-label-on {\n color: #333;\n}\n\n.comimi-toggle-label-off {\n color: #aaa;\n transform: translateX(100%);\n}\n\n.comimi-range-slider {\n display: grid;\n grid-template-columns: 1fr auto;\n column-gap: 8px;\n align-items: center;\n width: 100%;\n}\n\n.comimi-range-slider[data-disabled=\"true\"] {\n opacity: 0.6;\n}\n\n.comimi-range-slider-wrap {\n position: relative;\n display: grid;\n align-items: center;\n min-width: 0;\n height: 18px;\n}\n\n.comimi-range-slider-track {\n position: absolute;\n top: 50%;\n left: 0;\n right: 0;\n height: 6px;\n border-radius: 999px;\n background: #eeeeee;\n overflow: hidden;\n transform: translateY(-50%);\n transition: height 0.36s var(--comimi-spring);\n}\n\n@media (hover: hover) {\n .comimi-range-slider-wrap:hover .comimi-range-slider-track {\n height: 10px;\n }\n}\n\n.comimi-range-slider-fill {\n display: block;\n height: 100%;\n background: #666;\n border-radius: inherit;\n}\n\n.comimi-range-slider-input {\n position: relative;\n z-index: 1;\n width: 100%;\n height: 18px;\n margin: 0;\n padding: 0;\n border: 0;\n background: transparent;\n appearance: none;\n -webkit-appearance: none;\n cursor: pointer;\n}\n\n.comimi-range-slider-input::-webkit-slider-runnable-track {\n height: 6px;\n background: transparent;\n border: 0;\n}\n\n.comimi-range-slider-input::-webkit-slider-thumb {\n appearance: none;\n -webkit-appearance: none;\n width: 18px;\n height: 18px;\n margin-top: -6px;\n border: 0;\n border-radius: 50%;\n background: #666;\n box-shadow: none;\n transition:\n transform 0.36s var(--comimi-spring),\n background-color 0.2s ease-in-out;\n}\n\n.comimi-range-slider-input:hover:not(:disabled)::-webkit-slider-thumb {\n transform: scale(1.15);\n}\n\n.comimi-range-slider-input::-moz-range-track {\n height: 6px;\n background: transparent;\n border: 0;\n}\n\n.comimi-range-slider-input::-moz-range-thumb {\n width: 18px;\n height: 18px;\n border: 0;\n border-radius: 50%;\n background: #666;\n box-shadow: none;\n transition:\n transform 0.36s var(--comimi-spring),\n background-color 0.2s ease-in-out;\n}\n\n.comimi-range-slider-input:hover:not(:disabled)::-moz-range-thumb {\n transform: scale(1.15);\n}\n\n.comimi-range-slider-input:focus-visible {\n outline: none;\n}\n\n.comimi-range-slider-input:focus-visible::-webkit-slider-thumb {\n box-shadow: none;\n}\n\n.comimi-range-slider-input:focus-visible::-moz-range-thumb {\n box-shadow: none;\n}\n\n.comimi-range-slider-value {\n width: 36px;\n color: #666;\n font-size: 11px;\n font-weight: 400;\n line-height: 1;\n text-align: right;\n white-space: nowrap;\n}\n", ue = "\n.comimi-loading-icon {\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n display: grid;\n gap: 10px;\n justify-items: center;\n width: 80px;\n}\n\n.comimi-loading-icon-svg {\n width: 80px;\n}\n\n.comimi-loading-svg {\n display: block;\n width: 100%;\n transform-origin: center bottom;\n}\n\n.comimi-loading-stroke {\n fill: none;\n stroke: #ccc;\n stroke-linecap: round;\n stroke-linejoin: round;\n stroke-width: 10px;\n}\n\n.comimi-loading-mimi {\n transform-origin: 56px 43px;\n}\n\n.comimi-loading-mimi-left {\n animation:\n comimi-loading-mimi-left 0.4s ease-in-out 0.1s 2 forwards,\n comimi-loading-mimi-left 0.4s ease-in-out 1.7s 2 forwards;\n}\n\n.comimi-loading-mimi-right {\n animation:\n comimi-loading-mimi-right 0.4s ease-in-out 0.1s 2 forwards,\n comimi-loading-mimi-right 0.4s ease-in-out 1.7s 2 forwards;\n}\n\n.comimi-loading-eyes {\n transform: translateX(-7px);\n animation:\n comimi-loading-eyes-move 0.4s ease-in-out 1.2s both,\n comimi-loading-eyes-move 0.4s ease-in-out 2.6s reverse forwards;\n}\n\n.comimi-loading-eye {\n fill: #ccc;\n transform-origin: center;\n transform-box: fill-box;\n animation:\n comimi-loading-eye 0.4s ease-in-out 0s forwards,\n comimi-loading-eye 0.4s ease-in-out 1.6s forwards;\n}\n\n.comimi-loading-icon-text {\n color: #aaa;\n font-size: 12px;\n font-weight: 700;\n line-height: 1.45;\n text-align: center;\n}\n\n.comimi-loading-icon-text span {\n display: inline-block;\n animation: comimi-loading-dot 0.8s ease-in-out 0s infinite both;\n}\n\n.comimi-loading-icon-text span:nth-child(1) {\n animation-delay: 0s;\n}\n\n.comimi-loading-icon-text span:nth-child(2) {\n animation-delay: 0.15s;\n}\n\n.comimi-loading-icon-text span:nth-child(3) {\n animation-delay: 0.3s;\n}\n\n@keyframes comimi-loading-mimi-left {\n from, to {\n transform: rotate(0deg);\n }\n 50% {\n transform: rotate(20deg);\n }\n}\n\n@keyframes comimi-loading-mimi-right {\n from, to {\n transform: rotate(0deg);\n }\n 50% {\n transform: rotate(-20deg);\n }\n}\n\n@keyframes comimi-loading-eyes-move {\n from {\n transform: translateX(-7px);\n }\n to {\n transform: translateX(7px);\n }\n}\n\n@keyframes comimi-loading-eye {\n from, to {\n transform: scaleY(1);\n }\n 50% {\n transform: scaleY(0.2);\n }\n}\n\n@keyframes comimi-loading-dot {\n from, 50%, to {\n opacity: 1;\n }\n 25% {\n opacity: 0;\n }\n}\n", de = "\n.comimi-menu-panel {\n position: absolute;\n top: 24px;\n left: 24px;\n width: 420px;\n z-index: 45;\n pointer-events: auto;\n transition:\n transform 0.6s var(--comimi-spring),\n opacity 0.3s linear;\n}\n\n.comimi-menu-panel[data-overlay=\"false\"] {\n transform: translateY(-35px);\n opacity: 0;\n pointer-events: none;\n transition:\n transform 0.3s var(--comimi-spring),\n opacity 0.15s linear;\n}\n\n.comimi-menu-bg {\n position: absolute;\n inset: 0;\n border-radius: 16px;\n background: var(--comimi-glass);\n box-shadow: var(--comimi-shadow);\n backdrop-filter: blur(5px);\n transition: inset 0.36s var(--comimi-spring);\n}\n\n@media (hover: hover) {\n .comimi-menu-panel:hover > .comimi-menu-bg {\n inset: -5px;\n }\n}\n\n.comimi-menu-top {\n position: relative;\n display: grid;\n grid-template-columns: auto 1fr;\n column-gap: 13px;\n align-items: center;\n box-sizing: border-box;\n width: 100%;\n height: 62px;\n padding: 0 13px;\n border: 0;\n background: transparent;\n color: inherit;\n text-align: left;\n cursor: pointer;\n}\n\n.comimi-menu-button {\n position: relative;\n width: 34px;\n height: 34px;\n overflow: hidden;\n}\n\n.comimi-menu-button-inner {\n display: block;\n position: absolute;\n inset: 0;\n transition: transform 0.4s var(--comimi-spring);\n}\n\n.comimi-menu-panel[data-open=\"true\"] .comimi-menu-button-inner {\n transform: translateY(100%);\n}\n\n.comimi-menu-button-inner > * {\n position: absolute;\n inset: 0;\n}\n\n.comimi-menu-button-inner > *:nth-child(2) {\n transform: translateY(-100%);\n}\n\n.comimi-menu-title-wrap {\n min-width: 0;\n}\n\n.comimi-menu-title {\n display: block;\n width: 100%;\n color: #333;\n font-size: 15px;\n font-weight: 700;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n.comimi-menu-author {\n display: block;\n width: 100%;\n color: #666;\n font-size: 12px;\n font-weight: 400;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n.comimi-menu-bottom {\n position: relative;\n width: 100%;\n overflow: hidden;\n transition: height 0.24s ease-in-out;\n}\n\n.comimi-menu-border {\n width: 100%;\n height: 1px;\n background: #e0e0e0;\n}\n\n.comimi-menu-view {\n position: absolute;\n top: 1px;\n left: 0;\n width: 100%;\n transition: all 0.28s ease-in-out;\n opacity: 0;\n visibility: hidden;\n transform: scale(0.92);\n filter: blur(5px);\n}\n\n.comimi-menu-view-menu {\n position: relative;\n}\n\n.comimi-menu-panel[data-view=\"menu\"] .comimi-menu-view-menu,\n.comimi-menu-panel[data-view=\"shortcut\"] .comimi-menu-view-shortcut,\n.comimi-menu-panel[data-view=\"pageList\"] .comimi-menu-view-page-list {\n opacity: 1;\n visibility: visible;\n transform: scale(1);\n filter: blur(0);\n}\n\n.comimi-menu-list {\n position: relative;\n width: 100%;\n padding: 10px 0;\n}\n\n.comimi-menu-link {\n box-sizing: border-box;\n display: grid;\n grid-template-columns: 1fr auto;\n column-gap: 8px;\n align-items: center;\n width: 100%;\n padding: 10px 16px 10px 22px;\n border: 0;\n border-radius: 10px;\n background: transparent;\n color: #666;\n cursor: pointer;\n transition: background-color 0.24s linear;\n}\n\n.comimi-menu-link:hover {\n background: #f1f1f1;\n}\n\n.comimi-menu-link-text {\n color: #666;\n font-size: 14px;\n font-weight: 700;\n line-height: 1.45;\n text-align: left;\n}\n\n.comimi-menu-link-arrow {\n display: block;\n width: 20px;\n height: 20px;\n color: #aaa;\n}\n\n.comimi-menu-link-arrow > svg {\n display: block;\n width: 100%;\n height: 100%;\n}\n\n.comimi-page-list-inner {\n display: grid;\n grid-template-columns: repeat(3, 1fr);\n gap: 20px;\n box-sizing: border-box;\n padding: 22px;\n max-height: 315px;\n overflow-y: auto;\n -webkit-overflow-scrolling: touch;\n}\n\n.comimi-page-list-item {\n display: grid;\n row-gap: 4px;\n padding: 0;\n border: 0;\n background: transparent;\n color: #666;\n cursor: pointer;\n text-align: center;\n}\n\n.comimi-page-list-thumb {\n position: relative;\n display: block;\n width: 100%;\n aspect-ratio: 100 / 141;\n background: #fff;\n border-radius: 6px;\n outline: 3px solid #e0e0e0;\n}\n\n.comimi-page-list-thumb img {\n display: block;\n width: 100%;\n height: 100%;\n object-fit: contain;\n border-radius: 4px;\n user-select: none;\n -webkit-user-drag: none;\n}\n\n.comimi-page-list-text {\n color: #666;\n font-size: 14px;\n font-weight: 700;\n}\n\n.comimi-shortcut-inner {\n display: grid;\n row-gap: 22px;\n box-sizing: border-box;\n padding: 22px;\n max-height: 315px;\n overflow-y: auto;\n -webkit-overflow-scrolling: touch;\n}\n\n.comimi-shortcut-section {\n display: grid;\n row-gap: 8px;\n}\n\n.comimi-shortcut-heading {\n color: #666;\n font-size: 12px;\n font-weight: 700;\n line-height: 1.45;\n}\n\n.comimi-shortcut-list {\n display: grid;\n row-gap: 8px;\n justify-items: start;\n}\n\n.comimi-shortcut-column {\n display: flex;\n flex-wrap: wrap;\n gap: 8px 16px;\n align-items: center;\n}\n\n.comimi-shortcut-item {\n display: grid;\n grid-template-columns: repeat(2, auto);\n column-gap: 8px;\n align-items: center;\n width: fit-content;\n}\n\n.comimi-shortcut-badge {\n display: grid;\n grid-auto-flow: column;\n column-gap: 6px;\n align-items: center;\n padding: 4px 8px;\n border-radius: 7px;\n background: #eeeeee;\n}\n\n.comimi-shortcut-key {\n color: #666;\n font-size: 13px;\n font-weight: 700;\n line-height: 1.45;\n}\n\n.comimi-shortcut-or::before {\n content: \"or\";\n display: block;\n color: #666;\n font-size: 11px;\n font-weight: 400;\n line-height: 1.45;\n}\n\n.comimi-shortcut-label {\n color: #666;\n font-size: 13px;\n font-weight: 400;\n line-height: 1.45;\n}\n\n.comimi-back-button {\n position: relative;\n width: 100%;\n height: 56px;\n padding: 0;\n border: 0;\n background: transparent;\n cursor: pointer;\n}\n\n.comimi-back-inner {\n position: absolute;\n inset: 8px;\n}\n\n.comimi-back-bg {\n position: absolute;\n inset: 0;\n border-radius: 8px;\n background: #eeeeee;\n transition: inset 0.36s var(--comimi-spring), border-radius 0.36s var(--comimi-spring);\n}\n\n.comimi-back-button:hover .comimi-back-bg {\n inset: -4px;\n border-radius: 10px;\n}\n\n.comimi-back-text {\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n color: #666;\n font-size: 14px;\n font-weight: 700;\n line-height: 1.45;\n pointer-events: none;\n}\n\n.comimi-back-arrow {\n position: absolute;\n top: 50%;\n left: 8px;\n width: 22px;\n height: 22px;\n color: #aaa;\n transform: translateY(-50%) scaleX(-1);\n pointer-events: none;\n}\n\n.comimi-back-arrow > svg {\n display: block;\n width: 100%;\n height: 100%;\n}\n\n@media (max-width: 767px) {\n .comimi-menu-panel {\n top: 0;\n left: 0;\n width: 100%;\n }\n\n .comimi-menu-bg {\n border-radius: 0 0 16px 16px;\n }\n\n .comimi-menu-top {\n width: 100%;\n }\n\n .comimi-page-list-inner,\n .comimi-shortcut-inner {\n max-height: calc(var(--view-height, 100vh) - 62px - 56px);\n }\n}\n", fe = "\n.comimi-notifications {\n position: absolute;\n bottom: 140px;\n left: 50%;\n transform: translateX(-50%);\n display: grid;\n row-gap: 8px;\n justify-items: center;\n pointer-events: none;\n z-index: 35;\n}\n\n.comimi-toast {\n display: grid;\n grid-template-columns: auto auto;\n gap: 5px;\n align-items: center;\n justify-content: center;\n width: fit-content;\n padding: 6px 13px 6px 8px;\n border-radius: 999px;\n background-color: #666;\n animation: comimi-toast-popup 0.37s ease-in-out 0s both;\n}\n\n.comimi-toast-dot {\n display: block;\n width: 10px;\n height: 10px;\n border-radius: 50%;\n background: #888;\n}\n\n.comimi-toast-text {\n color: #fff;\n font-size: 12px;\n font-weight: 700;\n line-height: 1.45;\n}\n\n@keyframes comimi-toast-popup {\n from {\n transform: translateY(6px) scale(0.2, 0.8);\n opacity: 0;\n }\n 60% {\n transform: translateY(-1px) scale(1.1, 1.05);\n opacity: 1;\n }\n to {\n transform: scale(1, 1);\n opacity: 1;\n }\n}\n\n@media (max-width: 767px) {\n .comimi-notifications {\n bottom: calc(120px + env(safe-area-inset-bottom, 0px));\n }\n}\n", pe = "\n.comimi-stage {\n position: absolute;\n inset: 0;\n will-change: transform;\n transition: transform .18s ease;\n}\n\n.comimi-stage[data-dragging=\"true\"] {\n transition: none;\n}\n\n.comimi-page-group {\n position: absolute;\n inset: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 0;\n box-sizing: border-box;\n}\n\n.comimi-page {\n position: relative;\n display: flex;\n align-items: center;\n justify-content: center;\n width: 100%;\n height: 100%;\n max-width: 100%;\n max-height: 100%;\n min-width: 0;\n min-height: 0;\n background: transparent;\n overflow: hidden;\n flex: 0 0 auto;\n}\n\n.comimi-page[data-spread=\"true\"] {\n width: 50%;\n height: 100%;\n}\n\n.comimi-page[data-spread=\"false\"] {\n width: 100%;\n height: 100%;\n}\n\n.comimi-page[data-position=\"left\"] {\n justify-content: flex-end;\n}\n\n.comimi-page[data-position=\"right\"] {\n justify-content: flex-start;\n}\n\n.comimi-page img,\n.comimi-html-page {\n display: block;\n max-width: 100%;\n max-height: 100%;\n width: 100%;\n height: 100%;\n object-fit: contain;\n transform-origin: center center;\n user-select: none;\n -webkit-user-select: none;\n -webkit-user-drag: none;\n -webkit-touch-callout: none;\n}\n\n.comimi-page[data-spread=\"true\"] img,\n.comimi-page[data-spread=\"true\"] .comimi-html-page {\n width: 100%;\n height: 100%;\n}\n\n.comimi-page[data-position=\"left\"] img,\n.comimi-page[data-position=\"left\"] .comimi-html-page {\n object-position: right center;\n}\n\n.comimi-page[data-position=\"right\"] img,\n.comimi-page[data-position=\"right\"] .comimi-html-page {\n object-position: left center;\n}\n\n.comimi-html-page {\n width: min(100%, 960px);\n height: min(100%, 680px);\n background: #fff;\n color: #111;\n overflow: auto;\n}\n\n", me = "\n.comimi-rabbit {\n position: absolute;\n width: 50px;\n pointer-events: none;\n}\n\n.comimi-rabbit-svg {\n display: block;\n width: 100%;\n height: auto;\n}\n\n.comimi-controls-dock > .comimi-rabbit {\n bottom: 0;\n left: 50%;\n transform: translateX(-50%);\n}\n\n.comimi-menu-panel > .comimi-rabbit {\n top: 20px;\n right: 20px;\n}\n\n@media (max-width: 767px) {\n .comimi-controls-dock > .comimi-rabbit {\n display: none;\n }\n}\n\n@media (min-width: 768px) {\n .comimi-menu-panel > .comimi-rabbit {\n display: none;\n }\n}\n", he = "\n.comimi-settings-panel {\n position: absolute;\n top: 0;\n right: -16px;\n width: 250px;\n height: 0;\n border-radius: 20px;\n overflow: hidden;\n background: var(--comimi-glass-strong);\n box-shadow: var(--comimi-shadow);\n backdrop-filter: blur(5px);\n opacity: 0;\n transform: translateY(calc(-100% - 8px));\n transition:\n height 0.38s cubic-bezier(0.12, 1.06, 0.56, 1.02),\n opacity 0.38s cubic-bezier(0.12, 1.06, 0.56, 1.02);\n z-index: 10;\n}\n\n.comimi-settings-panel[data-open=\"true\"] {\n opacity: 1;\n height: var(--comimi-settings-height, 460px);\n}\n\n.comimi-settings-panel-body {\n position: relative;\n width: 100%;\n}\n\n.comimi-settings-panel-inner {\n box-sizing: border-box;\n position: relative;\n padding: 16px 20px 22px;\n}\n\n.comimi-settings-panel-title {\n color: #333;\n font-size: 14px;\n font-weight: 700;\n text-align: center;\n}\n\n.comimi-settings-section {\n display: grid;\n row-gap: 8px;\n margin-top: 18px;\n}\n\n.comimi-settings-label {\n color: #333;\n font-size: 12px;\n font-weight: 400;\n}\n\n@media (max-width: 767px) {\n .comimi-settings-panel-body {\n max-height: calc(var(--view-height, 100vh) - 62px - 56px);\n overflow-y: auto;\n -webkit-overflow-scrolling: touch;\n }\n}\n", ge = "\n.comimi-splash {\n position: absolute;\n inset: 0;\n z-index: 100;\n background-color: #e0e0e0;\n overflow: hidden;\n animation: comimi-splash-clip 1s cubic-bezier(0.82, 0.01, 0.48, 1.02) 1s both;\n pointer-events: none;\n}\n\n.comimi-splash-logo-wrap {\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -60%);\n width: 260px;\n aspect-ratio: 290 / 99;\n}\n\n.comimi-splash-logo {\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%) scale(0.72);\n width: 360px;\n aspect-ratio: 360 / 99;\n}\n\n.comimi-splash-symbol {\n position: absolute;\n top: 0;\n left: 0;\n width: 113px;\n display: block;\n transform-origin: center bottom;\n}\n\n.comimi-splash-typo-wrap {\n position: absolute;\n right: 7px;\n bottom: 11px;\n width: 229.5px;\n}\n\n.comimi-splash-typo {\n display: block;\n width: 100%;\n overflow: visible;\n}\n\n.comimi-splash-stroke {\n fill: none;\n stroke: #fff;\n stroke-linecap: round;\n stroke-linejoin: round;\n stroke-width: 10px;\n}\n\n.comimi-splash-mimi {\n transform-origin: 56px 43px;\n}\n\n.comimi-splash-mimi-left {\n animation: comimi-splash-mimi-left 0.4s ease-in-out 0.3s 2 forwards;\n}\n\n.comimi-splash-mimi-right {\n animation: comimi-splash-mimi-right 0.4s ease-in-out 0.3s 2 forwards;\n}\n\n.comimi-splash-eyes {\n transform: translateX(-7px);\n}\n\n.comimi-splash-eye {\n transform-origin: center;\n transform-box: fill-box;\n animation: comimi-splash-eye 0.4s ease-in-out 0.2s forwards;\n}\n\n.comimi-splash-heart {\n --size: 14px;\n position: absolute;\n top: -20px;\n width: var(--size);\n height: var(--size);\n}\n\n.comimi-splash-heart::before,\n.comimi-splash-heart::after {\n content: \"\";\n display: block;\n position: absolute;\n bottom: 0;\n left: 0;\n width: 100%;\n height: 150%;\n border-radius: 999px;\n transform-origin: center bottom;\n}\n\n.comimi-splash-heart::before {\n transform: translateX(-32%) rotate(45deg);\n background-color: #eee;\n}\n\n.comimi-splash-heart::after {\n transform: translateX(32%) rotate(-45deg);\n background-color: #fff;\n}\n\n.comimi-splash-heart-1 {\n right: -2px;\n}\n\n.comimi-splash-heart-2 {\n right: 76px;\n}\n\n.comimi-splash-text {\n position: absolute;\n bottom: 0;\n left: 50%;\n transform: translate(-50%, 120%);\n color: #fff;\n font-size: 16px;\n font-weight: 700;\n line-height: 1.45;\n text-align: center;\n white-space: nowrap;\n}\n\n.comimi-splash-text span {\n display: inline-block;\n animation: comimi-splash-dot 0.8s ease-in-out 0s infinite both;\n}\n\n.comimi-splash-text span:nth-child(1) {\n animation-delay: 0s;\n}\n\n.comimi-splash-text span:nth-child(2) {\n animation-delay: 0.15s;\n}\n\n.comimi-splash-text span:nth-child(3) {\n animation-delay: 0.3s;\n}\n\n@keyframes comimi-splash-clip {\n from {\n clip-path: circle(70%);\n }\n to {\n clip-path: circle(0%);\n }\n}\n\n@keyframes comimi-splash-mimi-left {\n from, to {\n transform: rotate(0deg);\n }\n 50% {\n transform: rotate(20deg);\n }\n}\n\n@keyframes comimi-splash-mimi-right {\n from, to {\n transform: rotate(0deg);\n }\n 50% {\n transform: rotate(-20deg);\n }\n}\n\n@keyframes comimi-splash-eye {\n from, to {\n transform: scaleY(1);\n }\n 50% {\n transform: scaleY(0.2);\n }\n}\n\n@keyframes comimi-splash-dot {\n from, 50%, to {\n opacity: 1;\n }\n 25% {\n opacity: 0;\n }\n}\n", _e = "\n.comimi-tooltip {\n position: absolute;\n bottom: 0;\n left: 50%;\n padding: 6px 10px;\n border-radius: 8px;\n background: rgba(255, 255, 255, 0.5);\n box-shadow: var(--comimi-shadow);\n backdrop-filter: blur(5px);\n color: #333;\n font-size: 12px;\n font-weight: 600;\n line-height: 1.45;\n white-space: nowrap;\n pointer-events: none;\n user-select: none;\n opacity: 0;\n transform: translate(-50%, calc(100% + 6px)) scale(0.88);\n transform-origin: center top;\n transition:\n opacity 0.1s ease-in-out,\n transform 0.16s ease-in-out;\n z-index: 5;\n}\n\n@media (hover: hover) {\n .comimi-has-tooltip:hover > .comimi-tooltip {\n opacity: 1;\n transform: translate(-50%, calc(100% + 6px)) scale(1);\n }\n}\n", ve = "\n.comimi-root {\n --comimi-bg: #fff;\n --comimi-surface: #f7f7f7;\n --comimi-surface-2: #eeeeee;\n --comimi-fg: #333;\n --comimi-muted: #666;\n --comimi-soft: #999;\n --comimi-line: #e0e0e0;\n --comimi-shadow: 0 0 8px rgba(0, 0, 0, 0.1);\n --comimi-glass: rgba(255, 255, 255, 0.8);\n --comimi-glass-strong: rgba(255, 255, 255, 0.8);\n --comimi-spring: cubic-bezier(0.34, 1.56, 0.64, 1);\n background: var(--comimi-bg);\n color: var(--comimi-fg);\n font-family: system-ui, -apple-system, BlinkMacSystemFont, \"Segoe UI\", sans-serif;\n position: relative;\n width: calc(100% - 24px * 2);\n max-width: 900px;\n aspect-ratio: 900 / 636;\n margin: 0 auto;\n border-radius: 16px;\n box-shadow: 0 0 16px 0 rgba(0, 0, 0, 0.06);\n overflow: hidden;\n user-select: none;\n touch-action: none;\n transition: box-shadow 0.24s ease-out;\n}\n\n.comimi-root:focus {\n outline: none;\n box-shadow: 0 0 24px 0 rgba(0, 0, 0, 0.14);\n}\n\n@media (max-width: 767px) {\n .comimi-root {\n max-width: 500px;\n aspect-ratio: 390 / 490;\n }\n}\n\n.comimi-root[data-layout=\"theater\"] {\n width: 100%;\n max-width: none;\n aspect-ratio: auto;\n min-height: 320px;\n margin: 0;\n border-radius: 0;\n box-shadow: none;\n}\n\n.comimi-root[data-layout=\"browserFullscreen\"],\n.comimi-root[data-layout=\"nativeFullscreen\"] {\n position: fixed;\n inset: 0;\n z-index: 999;\n width: 100vw;\n height: 100dvh;\n max-width: none;\n aspect-ratio: auto;\n margin: 0;\n border-radius: 0;\n box-shadow: none;\n}\n\n.comimi-resize-handle {\n position: relative;\n width: 100%;\n height: 20px;\n background: #fff;\n cursor: ns-resize;\n touch-action: none;\n}\n\n.comimi-resize-handle::after {\n content: \"\";\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n width: 40px;\n height: 3px;\n border-radius: 999px;\n background: #bbb;\n transition:\n width 0.36s cubic-bezier(0.34, 1.56, 0.64, 1),\n height 0.36s cubic-bezier(0.34, 1.56, 0.64, 1),\n background-color 0.2s linear;\n}\n\n@media (hover: hover) {\n .comimi-resize-handle:hover::after {\n width: 52px;\n height: 5px;\n background: #888;\n }\n}\n\n", ye = "\n.comimi-view-switcher {\n position: absolute;\n top: 20px;\n right: 20px;\n display: grid;\n grid-template-columns: repeat(3, 60px);\n width: 180px;\n border-radius: 16px;\n background: var(--comimi-glass);\n box-shadow: var(--comimi-shadow);\n backdrop-filter: blur(5px);\n pointer-events: auto;\n transition:\n transform 0.6s var(--comimi-spring),\n opacity 0.3s linear;\n}\n\n.comimi-view-switcher[data-overlay=\"false\"] {\n transform: translateY(-35px);\n opacity: 0;\n pointer-events: none;\n transition:\n transform 0.3s var(--comimi-spring),\n opacity 0.15s linear;\n}\n\n@media (hover: hover) {\n .comimi-view-switcher:hover {\n transform: scaleX(1.03);\n }\n}\n\n.comimi-view-switcher-indicator {\n position: absolute;\n top: 0;\n left: 0;\n width: 60px;\n height: 100%;\n border-radius: 16px;\n background: #666;\n transition: transform 0.36s var(--comimi-spring);\n}\n\n.comimi-view-switcher-button {\n position: relative;\n display: grid;\n row-gap: 5px;\n justify-items: center;\n align-content: center;\n height: 58px;\n padding: 0;\n border: 0;\n background: transparent;\n color: #666;\n cursor: pointer;\n transition: color 0.2s linear;\n}\n\n.comimi-view-switcher-button[data-selected=\"true\"] {\n color: #fff;\n}\n\n.comimi-view-switcher-icon-wrap {\n width: 20px;\n height: 20px;\n transform-origin: center bottom;\n}\n\n.comimi-view-switcher-icon {\n display: block;\n width: 100%;\n height: 100%;\n color: currentColor;\n}\n\n.comimi-view-switcher-icon-wrap.comimi-pop-animate {\n animation: comimi-pop 0.5s ease-in-out 0.1s both;\n}\n\n.comimi-view-switcher-label {\n color: currentColor;\n font-size: 10px;\n font-weight: 500;\n text-align: center;\n transition: color 0.2s linear;\n}\n\n@media (max-width: 767px) {\n .comimi-view-switcher {\n top: 70px;\n right: auto;\n left: calc(50% - 90px);\n }\n}\n", J = !1, be = [
|
|
987
|
+
ve,
|
|
988
|
+
ce,
|
|
989
|
+
_e,
|
|
990
|
+
pe,
|
|
991
|
+
ue,
|
|
992
|
+
se,
|
|
993
|
+
G,
|
|
994
|
+
K,
|
|
995
|
+
ye,
|
|
996
|
+
q,
|
|
997
|
+
le,
|
|
998
|
+
he,
|
|
999
|
+
de,
|
|
1000
|
+
fe,
|
|
1001
|
+
me,
|
|
1002
|
+
ge
|
|
1003
|
+
].join("\n");
|
|
1004
|
+
function xe() {
|
|
1005
|
+
if (J || typeof document > "u") return;
|
|
1006
|
+
let e = document.createElement("style");
|
|
1007
|
+
e.dataset.comimiViewer = "true", e.textContent = be, document.head.append(e), J = !0;
|
|
1008
|
+
}
|
|
1009
|
+
//#endregion
|
|
1010
|
+
//#region src/renderer/viewer-renderer.ts
|
|
1011
|
+
var Se = 180, Ce = 2e3, we = class {
|
|
1012
|
+
container;
|
|
1013
|
+
callbacks;
|
|
1014
|
+
assetLoader;
|
|
1015
|
+
i18n;
|
|
1016
|
+
root;
|
|
1017
|
+
cleanup = [];
|
|
1018
|
+
mouseStart;
|
|
1019
|
+
touchStart;
|
|
1020
|
+
pinchStart;
|
|
1021
|
+
pageStage;
|
|
1022
|
+
pageTurnTimer;
|
|
1023
|
+
splashRemoveTimer;
|
|
1024
|
+
splash;
|
|
1025
|
+
isPageTurnAnimating = !1;
|
|
1026
|
+
suppressNextClick = !1;
|
|
1027
|
+
prevOverlayVisible = !1;
|
|
1028
|
+
overlayApplyRaf;
|
|
1029
|
+
menuPanel;
|
|
1030
|
+
viewModeSwitcher;
|
|
1031
|
+
controlsDock;
|
|
1032
|
+
resizeHandle;
|
|
1033
|
+
viewSizeObserver;
|
|
1034
|
+
constructor(e, t, n, r, i) {
|
|
1035
|
+
this.container = e, this.callbacks = t, this.assetLoader = n, this.i18n = r, xe(), this.pageStage = new I({
|
|
1036
|
+
assetLoader: this.assetLoader,
|
|
1037
|
+
i18n: this.i18n,
|
|
1038
|
+
isMobileViewport: () => this.isMobileViewport()
|
|
1039
|
+
}), this.root = W({ className: i }), this.container.replaceChildren(this.root), this.observeViewSize();
|
|
1040
|
+
}
|
|
1041
|
+
observeViewSize() {
|
|
1042
|
+
let e = () => {
|
|
1043
|
+
this.root.style.setProperty("--view-width", `${this.root.offsetWidth}px`), this.root.style.setProperty("--view-height", `${this.root.offsetHeight}px`);
|
|
1044
|
+
};
|
|
1045
|
+
e(), typeof ResizeObserver < "u" ? (this.viewSizeObserver = new ResizeObserver(e), this.viewSizeObserver.observe(this.root)) : (window.addEventListener("resize", e), this.cleanup.push(() => window.removeEventListener("resize", e)));
|
|
1046
|
+
}
|
|
1047
|
+
update(e) {
|
|
1048
|
+
if (this.isPageTurnAnimating) return;
|
|
1049
|
+
this.cleanup.forEach((e) => e()), this.cleanup = [], this.i18n.setLocale(e.settings.locale), this.root.dataset.layout = e.layout.mode, e.layout.mode === "theater" && e.layout.theaterHeightPx ? this.root.style.height = `${e.layout.theaterHeightPx}px` : this.root.style.height = "";
|
|
1050
|
+
let t = this.prevOverlayVisible !== e.overlayVisible, n = t ? {
|
|
1051
|
+
...e,
|
|
1052
|
+
overlayVisible: this.prevOverlayVisible
|
|
1053
|
+
} : e;
|
|
1054
|
+
this.menuPanel ||= new S(this.callbacks, this.i18n), this.viewModeSwitcher ||= new ae(this.callbacks, this.i18n), this.controlsDock ||= new x(this.callbacks, this.i18n);
|
|
1055
|
+
let r = this.pageStage.getElement(), i = this.menuPanel.getElement(), a = this.viewModeSwitcher.getElement(), o = this.controlsDock.getElement();
|
|
1056
|
+
Array.from(this.root.children).forEach((e) => {
|
|
1057
|
+
e !== r && e !== i && e !== a && e !== o && e !== this.splash && e.remove();
|
|
1058
|
+
}), r.parentNode !== this.root && this.root.prepend(r), this.pageStage.update(e, this.isMobileViewport()), this.pageStage.snapTransform();
|
|
1059
|
+
let s = [
|
|
1060
|
+
re(n, this.i18n),
|
|
1061
|
+
m({
|
|
1062
|
+
state: n,
|
|
1063
|
+
callbacks: this.callbacks
|
|
1064
|
+
}),
|
|
1065
|
+
R(e)
|
|
1066
|
+
];
|
|
1067
|
+
this.syncResizeHandle(e.layout.mode === "theater");
|
|
1068
|
+
let c = i.parentNode === this.root ? i : null;
|
|
1069
|
+
if (c ? s.forEach((e) => this.root.insertBefore(e, c)) : (s.forEach((e) => this.root.appendChild(e)), this.root.appendChild(i)), a.parentNode !== this.root && this.root.appendChild(a), o.parentNode !== this.root && this.root.appendChild(o), this.menuPanel.update(n), this.viewModeSwitcher.update(n), this.controlsDock.update(n, this.isMobileViewport()), this.splash && this.splash.parentNode !== this.root && this.root.append(this.splash), this.bindGestures(e), this.overlayApplyRaf !== void 0 && (cancelAnimationFrame(this.overlayApplyRaf), this.overlayApplyRaf = void 0), t) {
|
|
1070
|
+
let t = e.overlayVisible;
|
|
1071
|
+
this.root.offsetWidth, this.overlayApplyRaf = requestAnimationFrame(() => {
|
|
1072
|
+
this.overlayApplyRaf = void 0, this.applyOverlayVisibility(t);
|
|
1073
|
+
});
|
|
1074
|
+
}
|
|
1075
|
+
this.prevOverlayVisible = e.overlayVisible;
|
|
1076
|
+
}
|
|
1077
|
+
applyOverlayVisibility(e) {
|
|
1078
|
+
let t = String(e);
|
|
1079
|
+
this.root.querySelectorAll(".comimi-arrows, .comimi-center-message, .comimi-menu-panel, .comimi-view-switcher, .comimi-controls-dock").forEach((e) => {
|
|
1080
|
+
e.dataset.overlay = t;
|
|
1081
|
+
});
|
|
1082
|
+
}
|
|
1083
|
+
showSplash() {
|
|
1084
|
+
this.splash || (this.splash = B(this.i18n), this.root.append(this.splash), this.splashRemoveTimer = window.setTimeout(() => {
|
|
1085
|
+
this.splash?.remove(), this.splash = void 0;
|
|
1086
|
+
}, Ce));
|
|
1087
|
+
}
|
|
1088
|
+
destroy() {
|
|
1089
|
+
window.clearTimeout(this.pageTurnTimer), window.clearTimeout(this.splashRemoveTimer), this.overlayApplyRaf !== void 0 && (cancelAnimationFrame(this.overlayApplyRaf), this.overlayApplyRaf = void 0), this.cleanup.forEach((e) => e()), this.cleanup = [], this.viewSizeObserver?.disconnect(), this.viewSizeObserver = void 0, this.resizeHandle?.remove(), this.resizeHandle = void 0, this.root.remove();
|
|
1090
|
+
}
|
|
1091
|
+
getElement() {
|
|
1092
|
+
return this.root;
|
|
1093
|
+
}
|
|
1094
|
+
isAnimatingPageTurn() {
|
|
1095
|
+
return this.isPageTurnAnimating;
|
|
1096
|
+
}
|
|
1097
|
+
animatePageTurn(e, t, n) {
|
|
1098
|
+
return window.clearTimeout(this.pageTurnTimer), !e.settings.pageTurnAnimation || this.isPageTurnAnimating || w(e, t, this.isMobileViewport()).length === 0 ? !1 : (this.isPageTurnAnimating = !0, this.setStageDragOffset(this.getPageTurnTargetOffset(e, t), !0), this.pageTurnTimer = window.setTimeout(() => {
|
|
1099
|
+
this.isPageTurnAnimating = !1, n();
|
|
1100
|
+
}, Se), !0);
|
|
1101
|
+
}
|
|
1102
|
+
isMobileViewport() {
|
|
1103
|
+
return window.matchMedia("(max-width: 767px)").matches;
|
|
1104
|
+
}
|
|
1105
|
+
clampPan(e, t, n, r) {
|
|
1106
|
+
if (n <= 1) return {
|
|
1107
|
+
x: 0,
|
|
1108
|
+
y: 0
|
|
1109
|
+
};
|
|
1110
|
+
let i = C(r, this.isMobileViewport()).length > 1 ? this.root.offsetWidth / 2 : this.root.offsetWidth, a = this.root.offsetHeight, o = i * (n - 1) / 2, s = a * (n - 1) / 2;
|
|
1111
|
+
return {
|
|
1112
|
+
x: Math.min(Math.max(e, -o), o),
|
|
1113
|
+
y: Math.min(Math.max(t, -s), s)
|
|
1114
|
+
};
|
|
1115
|
+
}
|
|
1116
|
+
clampedZoom(e, t) {
|
|
1117
|
+
return Math.min(Math.max(e, t.settings.zoom.min), t.settings.zoom.max);
|
|
1118
|
+
}
|
|
1119
|
+
syncResizeHandle(e) {
|
|
1120
|
+
e ? (this.resizeHandle ||= this.createResizeHandle(), this.resizeHandle.parentNode !== this.container && this.container.appendChild(this.resizeHandle)) : this.resizeHandle && this.resizeHandle.remove();
|
|
1121
|
+
}
|
|
1122
|
+
createResizeHandle() {
|
|
1123
|
+
let e = document.createElement("div");
|
|
1124
|
+
e.className = "comimi-resize-handle", e.setAttribute("role", "separator"), e.setAttribute("aria-orientation", "horizontal");
|
|
1125
|
+
let t = 0, n = 0, r, i = (e) => {
|
|
1126
|
+
e.pointerId === r && this.callbacks.setTheaterHeight(n + e.clientY - t);
|
|
1127
|
+
}, a = (e) => {
|
|
1128
|
+
e.pointerId === r && (window.removeEventListener("pointermove", i), window.removeEventListener("pointerup", a), window.removeEventListener("pointercancel", a), r = void 0);
|
|
1129
|
+
};
|
|
1130
|
+
return e.addEventListener("pointerdown", (e) => {
|
|
1131
|
+
e.preventDefault(), r = e.pointerId, t = e.clientY, n = this.root.getBoundingClientRect().height, window.addEventListener("pointermove", i), window.addEventListener("pointerup", a), window.addEventListener("pointercancel", a);
|
|
1132
|
+
}), e;
|
|
1133
|
+
}
|
|
1134
|
+
bindGestures(e) {
|
|
1135
|
+
let t = (e) => {
|
|
1136
|
+
if (this.suppressNextClick || this.isPageTurnAnimating) {
|
|
1137
|
+
this.suppressNextClick = !1, e.preventDefault(), e.stopPropagation();
|
|
1138
|
+
return;
|
|
1139
|
+
}
|
|
1140
|
+
this.isInteractiveTarget(e.target) || this.callbacks.toggleOverlay();
|
|
1141
|
+
}, n = (t) => {
|
|
1142
|
+
if (this.isInteractiveTarget(t.target) || !t.ctrlKey && !t.metaKey) return;
|
|
1143
|
+
t.preventDefault();
|
|
1144
|
+
let n = t.deltaY > 0 ? -e.settings.zoom.step : e.settings.zoom.step, r = this.clampedZoom(e.zoomScale + n, e), i = this.clampPan(e.panX, e.panY, r, e);
|
|
1145
|
+
this.callbacks.setZoom(r, i.x, i.y);
|
|
1146
|
+
}, r = (t) => {
|
|
1147
|
+
this.isPageTurnAnimating || this.isInteractiveTarget(t.target) || t.button === 0 && (this.mouseStart = {
|
|
1148
|
+
x: t.clientX,
|
|
1149
|
+
y: t.clientY,
|
|
1150
|
+
panX: e.panX,
|
|
1151
|
+
panY: e.panY
|
|
1152
|
+
});
|
|
1153
|
+
}, i = (t) => {
|
|
1154
|
+
if (!this.mouseStart) return;
|
|
1155
|
+
t.preventDefault();
|
|
1156
|
+
let n = t.clientX - this.mouseStart.x, r = t.clientY - this.mouseStart.y;
|
|
1157
|
+
if ((Math.abs(n) > 6 || Math.abs(r) > 6) && (this.suppressNextClick = !0), e.zoomScale <= 1) {
|
|
1158
|
+
this.setStageDragOffset(this.constrainDragOffset(n, r, e));
|
|
1159
|
+
return;
|
|
1160
|
+
}
|
|
1161
|
+
let i = this.mouseStart.panX + t.clientX - this.mouseStart.x, a = this.mouseStart.panY + t.clientY - this.mouseStart.y, o = this.clampPan(i, a, e.zoomScale, e);
|
|
1162
|
+
this.callbacks.setPan(o.x, o.y);
|
|
1163
|
+
}, a = (t) => {
|
|
1164
|
+
if (!this.mouseStart) return;
|
|
1165
|
+
let n = t.clientX - this.mouseStart.x, r = t.clientY - this.mouseStart.y;
|
|
1166
|
+
this.handleSwipeEnd(n, r, e), this.mouseStart = void 0;
|
|
1167
|
+
}, o = (t) => {
|
|
1168
|
+
if (this.isPageTurnAnimating) return;
|
|
1169
|
+
if (t.touches.length === 2) {
|
|
1170
|
+
t.preventDefault(), this.touchStart = void 0, this.pinchStart = {
|
|
1171
|
+
distance: Y(t),
|
|
1172
|
+
scale: e.zoomScale
|
|
1173
|
+
};
|
|
1174
|
+
return;
|
|
1175
|
+
}
|
|
1176
|
+
if (this.isInteractiveTarget(t.target)) return;
|
|
1177
|
+
let n = t.touches[0];
|
|
1178
|
+
n && (this.touchStart = {
|
|
1179
|
+
x: n.clientX,
|
|
1180
|
+
y: n.clientY,
|
|
1181
|
+
panX: e.panX,
|
|
1182
|
+
panY: e.panY
|
|
1183
|
+
});
|
|
1184
|
+
}, s = (t) => {
|
|
1185
|
+
if (this.pinchStart && t.touches.length === 2) {
|
|
1186
|
+
t.preventDefault();
|
|
1187
|
+
let n = this.pinchStart.scale * (Y(t) / this.pinchStart.distance), r = this.clampedZoom(n, e), i = this.clampPan(e.panX, e.panY, r, e);
|
|
1188
|
+
this.callbacks.setZoom(r, i.x, i.y);
|
|
1189
|
+
return;
|
|
1190
|
+
}
|
|
1191
|
+
if (this.isInteractiveTarget(t.target)) return;
|
|
1192
|
+
let n = t.touches[0];
|
|
1193
|
+
if (!n || !this.touchStart) return;
|
|
1194
|
+
t.preventDefault();
|
|
1195
|
+
let r = n.clientX - this.touchStart.x, i = n.clientY - this.touchStart.y;
|
|
1196
|
+
if ((Math.abs(r) > 6 || Math.abs(i) > 6) && (this.suppressNextClick = !0), e.zoomScale <= 1) {
|
|
1197
|
+
this.setStageDragOffset(this.constrainDragOffset(r, i, e));
|
|
1198
|
+
return;
|
|
1199
|
+
}
|
|
1200
|
+
let a = this.touchStart.panX + n.clientX - this.touchStart.x, o = this.touchStart.panY + n.clientY - this.touchStart.y, s = this.clampPan(a, o, e.zoomScale, e);
|
|
1201
|
+
this.callbacks.setPan(s.x, s.y);
|
|
1202
|
+
}, c = (t) => {
|
|
1203
|
+
t.touches.length < 2 && (this.pinchStart = void 0);
|
|
1204
|
+
let n = t.changedTouches[0];
|
|
1205
|
+
if (!n || !this.touchStart) {
|
|
1206
|
+
this.touchStart = void 0;
|
|
1207
|
+
return;
|
|
1208
|
+
}
|
|
1209
|
+
let r = n.clientX - this.touchStart.x, i = n.clientY - this.touchStart.y;
|
|
1210
|
+
this.handleSwipeEnd(r, i, e), this.touchStart = void 0;
|
|
1211
|
+
}, l = (t) => {
|
|
1212
|
+
this.isInteractiveTarget(t.target) || (e.zoomScale > 1 ? this.callbacks.resetZoom() : this.callbacks.setZoom(2));
|
|
1213
|
+
}, u = (t) => {
|
|
1214
|
+
if (this.suppressNextClick || this.isPageTurnAnimating || e.panel !== "settings") return;
|
|
1215
|
+
let n = t.target;
|
|
1216
|
+
n instanceof Element && (n.closest(".comimi-settings") || this.callbacks.setPanel("none"));
|
|
1217
|
+
};
|
|
1218
|
+
this.root.addEventListener("click", u, !0), this.root.addEventListener("click", t), this.root.addEventListener("wheel", n, { passive: !1 }), this.root.addEventListener("mousedown", r), window.addEventListener("mousemove", i), window.addEventListener("mouseup", a), this.root.addEventListener("touchstart", o, { passive: !1 }), this.root.addEventListener("touchmove", s, { passive: !1 }), this.root.addEventListener("touchend", c), this.root.addEventListener("dblclick", l), this.cleanup.push(() => this.root.removeEventListener("click", u, !0), () => this.root.removeEventListener("click", t), () => this.root.removeEventListener("wheel", n), () => this.root.removeEventListener("mousedown", r), () => window.removeEventListener("mousemove", i), () => window.removeEventListener("mouseup", a), () => this.root.removeEventListener("touchstart", o), () => this.root.removeEventListener("touchmove", s), () => this.root.removeEventListener("touchend", c), () => this.root.removeEventListener("dblclick", l));
|
|
1219
|
+
}
|
|
1220
|
+
handleSwipeEnd(e, t, n) {
|
|
1221
|
+
if (window.clearTimeout(this.pageTurnTimer), !(n.zoomScale <= 1 && Math.abs(e) > 64 && Math.abs(e) > Math.abs(t))) {
|
|
1222
|
+
this.setStageDragOffset(0, !0);
|
|
1223
|
+
return;
|
|
1224
|
+
}
|
|
1225
|
+
let r = O(e, n.settings.readingDirection) ? "next" : "previous";
|
|
1226
|
+
if (!(w(n, r, this.isMobileViewport()).length > 0)) {
|
|
1227
|
+
this.setStageDragOffset(0, !0);
|
|
1228
|
+
return;
|
|
1229
|
+
}
|
|
1230
|
+
this.requestPageTurn(n, r) || (r === "next" ? this.callbacks.commitNextPage() : this.callbacks.commitPreviousPage());
|
|
1231
|
+
}
|
|
1232
|
+
requestPageTurn(e, t) {
|
|
1233
|
+
return this.animatePageTurn(e, t, () => {
|
|
1234
|
+
t === "next" ? this.callbacks.commitNextPage() : this.callbacks.commitPreviousPage();
|
|
1235
|
+
});
|
|
1236
|
+
}
|
|
1237
|
+
constrainDragOffset(e, t, n) {
|
|
1238
|
+
return Math.abs(t) > Math.abs(e) ? 0 : w(n, O(e, n.settings.readingDirection) ? "next" : "previous", this.isMobileViewport()).length > 0 ? e : this.applyEdgeResistance(e);
|
|
1239
|
+
}
|
|
1240
|
+
applyEdgeResistance(e) {
|
|
1241
|
+
let t = Math.sign(e), n = Math.abs(e), r = Math.max(this.root.clientWidth, 1), i = Math.min(r * .22, 140);
|
|
1242
|
+
return t * (i * (1 - Math.exp(-n / i)));
|
|
1243
|
+
}
|
|
1244
|
+
setStageDragOffset(e, t = !1) {
|
|
1245
|
+
this.pageStage.setDragOffset(e, t);
|
|
1246
|
+
}
|
|
1247
|
+
getPageTurnTargetOffset(e, t) {
|
|
1248
|
+
return D(e, t) === "left" ? this.root.clientWidth : -this.root.clientWidth;
|
|
1249
|
+
}
|
|
1250
|
+
isInteractiveTarget(e) {
|
|
1251
|
+
return e instanceof Element ? !!e.closest([
|
|
1252
|
+
".comimi-arrow-button",
|
|
1253
|
+
".comimi-view-switcher",
|
|
1254
|
+
".comimi-controls-dock",
|
|
1255
|
+
".comimi-menu-panel",
|
|
1256
|
+
".comimi-settings-panel",
|
|
1257
|
+
"button",
|
|
1258
|
+
"input",
|
|
1259
|
+
"select",
|
|
1260
|
+
"textarea",
|
|
1261
|
+
"a",
|
|
1262
|
+
"iframe"
|
|
1263
|
+
].join(",")) : !1;
|
|
1264
|
+
}
|
|
1265
|
+
};
|
|
1266
|
+
function Y(e) {
|
|
1267
|
+
let [t, n] = Array.from(e.touches);
|
|
1268
|
+
return !t || !n ? 1 : Math.hypot(t.clientX - n.clientX, t.clientY - n.clientY);
|
|
1269
|
+
}
|
|
1270
|
+
//#endregion
|
|
1271
|
+
//#region src/storage/indexed-db-storage.ts
|
|
1272
|
+
var Te = class {
|
|
1273
|
+
enabled;
|
|
1274
|
+
databaseName;
|
|
1275
|
+
dbPromise;
|
|
1276
|
+
constructor(e = {}) {
|
|
1277
|
+
this.enabled = e.enabled !== !1 && typeof indexedDB < "u", this.databaseName = e.databaseName ?? "manga-viewer";
|
|
1278
|
+
}
|
|
1279
|
+
async getSettings() {
|
|
1280
|
+
return (await this.get("settings", "global"))?.value;
|
|
1281
|
+
}
|
|
1282
|
+
async saveSettings(e) {
|
|
1283
|
+
await this.put("settings", {
|
|
1284
|
+
id: "global",
|
|
1285
|
+
value: e,
|
|
1286
|
+
updatedAt: Date.now()
|
|
1287
|
+
});
|
|
1288
|
+
}
|
|
1289
|
+
async getProgress(e) {
|
|
1290
|
+
return (await this.get("readingProgress", e))?.pageIndex;
|
|
1291
|
+
}
|
|
1292
|
+
async saveProgress(e, t) {
|
|
1293
|
+
await this.put("readingProgress", {
|
|
1294
|
+
mangaId: e,
|
|
1295
|
+
pageIndex: t,
|
|
1296
|
+
updatedAt: Date.now()
|
|
1297
|
+
});
|
|
1298
|
+
}
|
|
1299
|
+
async saveLayout(e) {
|
|
1300
|
+
await this.put("layout", {
|
|
1301
|
+
id: "global",
|
|
1302
|
+
value: e,
|
|
1303
|
+
updatedAt: Date.now()
|
|
1304
|
+
});
|
|
1305
|
+
}
|
|
1306
|
+
async getLayout() {
|
|
1307
|
+
return (await this.get("layout", "global"))?.value;
|
|
1308
|
+
}
|
|
1309
|
+
async get(e, t) {
|
|
1310
|
+
if (this.enabled) return Z((await this.store(e, "readonly")).get(t));
|
|
1311
|
+
}
|
|
1312
|
+
async put(e, t) {
|
|
1313
|
+
this.enabled && await Z((await this.store(e, "readwrite")).put(t));
|
|
1314
|
+
}
|
|
1315
|
+
async delete(e, t) {
|
|
1316
|
+
this.enabled && await Z((await this.store(e, "readwrite")).delete(t));
|
|
1317
|
+
}
|
|
1318
|
+
async store(e, t) {
|
|
1319
|
+
return (await this.open()).transaction(e, t).objectStore(e);
|
|
1320
|
+
}
|
|
1321
|
+
open() {
|
|
1322
|
+
return this.enabled ? (this.dbPromise ??= new Promise((e, t) => {
|
|
1323
|
+
let n = indexedDB.open(this.databaseName, 1);
|
|
1324
|
+
n.onupgradeneeded = () => {
|
|
1325
|
+
let e = n.result;
|
|
1326
|
+
X(e, "settings", "id"), X(e, "readingProgress", "mangaId"), X(e, "layout", "id");
|
|
1327
|
+
}, n.onsuccess = () => e(n.result), n.onerror = () => t(n.error);
|
|
1328
|
+
}), this.dbPromise) : Promise.reject(/* @__PURE__ */ Error("IndexedDB is not available"));
|
|
1329
|
+
}
|
|
1330
|
+
};
|
|
1331
|
+
function X(e, t, n) {
|
|
1332
|
+
e.objectStoreNames.contains(t) || e.createObjectStore(t, { keyPath: n });
|
|
1333
|
+
}
|
|
1334
|
+
function Z(e) {
|
|
1335
|
+
return new Promise((t, n) => {
|
|
1336
|
+
e.onsuccess = () => t(e.result), e.onerror = () => n(e.error);
|
|
1337
|
+
});
|
|
1338
|
+
}
|
|
1339
|
+
//#endregion
|
|
1340
|
+
//#region src/store/reducer.ts
|
|
1341
|
+
function Q(e, t) {
|
|
1342
|
+
switch (t.type) {
|
|
1343
|
+
case "setManga": {
|
|
1344
|
+
let n = r(t.pageIndex ?? 0, t.manga.pages.length);
|
|
1345
|
+
return $({
|
|
1346
|
+
...e,
|
|
1347
|
+
manga: t.manga,
|
|
1348
|
+
currentPageIndex: n,
|
|
1349
|
+
zoomScale: 1,
|
|
1350
|
+
panX: 0,
|
|
1351
|
+
panY: 0
|
|
1352
|
+
});
|
|
1353
|
+
}
|
|
1354
|
+
case "goToPage": {
|
|
1355
|
+
let n = r(t.pageIndex, e.manga.pages.length), i = e.zoomScale === 1 && e.panX === 0 && e.panY === 0;
|
|
1356
|
+
return n === e.currentPageIndex && i ? e : $({
|
|
1357
|
+
...e,
|
|
1358
|
+
currentPageIndex: n,
|
|
1359
|
+
zoomScale: 1,
|
|
1360
|
+
panX: 0,
|
|
1361
|
+
panY: 0
|
|
1362
|
+
});
|
|
1363
|
+
}
|
|
1364
|
+
case "nextPage": {
|
|
1365
|
+
let t = i(e.settings, e.currentPageIndex);
|
|
1366
|
+
return Q(e, {
|
|
1367
|
+
type: "goToPage",
|
|
1368
|
+
pageIndex: e.currentPageIndex + t
|
|
1369
|
+
});
|
|
1370
|
+
}
|
|
1371
|
+
case "previousPage": {
|
|
1372
|
+
let t = i(e.settings, e.currentPageIndex);
|
|
1373
|
+
return Q(e, {
|
|
1374
|
+
type: "goToPage",
|
|
1375
|
+
pageIndex: e.currentPageIndex - t
|
|
1376
|
+
});
|
|
1377
|
+
}
|
|
1378
|
+
case "setOverlayVisible": return {
|
|
1379
|
+
...e,
|
|
1380
|
+
overlayVisible: t.visible,
|
|
1381
|
+
panel: t.visible ? e.panel : "none"
|
|
1382
|
+
};
|
|
1383
|
+
case "toggleAutoPageTurn": return {
|
|
1384
|
+
...e,
|
|
1385
|
+
autoPageTurnEnabled: !e.autoPageTurnEnabled
|
|
1386
|
+
};
|
|
1387
|
+
case "updateSettings": {
|
|
1388
|
+
let r = n(e.settings, t.settings);
|
|
1389
|
+
return $({
|
|
1390
|
+
...e,
|
|
1391
|
+
settings: r,
|
|
1392
|
+
layout: {
|
|
1393
|
+
...e.layout,
|
|
1394
|
+
mode: r.layoutMode
|
|
1395
|
+
}
|
|
1396
|
+
});
|
|
1397
|
+
}
|
|
1398
|
+
case "setLayoutMode": return Q(e, {
|
|
1399
|
+
type: "updateSettings",
|
|
1400
|
+
settings: { layoutMode: t.layoutMode }
|
|
1401
|
+
});
|
|
1402
|
+
case "setTheaterHeight": return {
|
|
1403
|
+
...e,
|
|
1404
|
+
layout: {
|
|
1405
|
+
...e.layout,
|
|
1406
|
+
theaterHeightPx: Math.max(240, Math.round(t.heightPx))
|
|
1407
|
+
}
|
|
1408
|
+
};
|
|
1409
|
+
case "setZoom": return {
|
|
1410
|
+
...e,
|
|
1411
|
+
zoomScale: Ee(t.scale, e),
|
|
1412
|
+
panX: t.panX ?? e.panX,
|
|
1413
|
+
panY: t.panY ?? e.panY
|
|
1414
|
+
};
|
|
1415
|
+
case "setPan": return {
|
|
1416
|
+
...e,
|
|
1417
|
+
panX: t.panX,
|
|
1418
|
+
panY: t.panY
|
|
1419
|
+
};
|
|
1420
|
+
case "resetZoom": return {
|
|
1421
|
+
...e,
|
|
1422
|
+
zoomScale: 1,
|
|
1423
|
+
panX: 0,
|
|
1424
|
+
panY: 0
|
|
1425
|
+
};
|
|
1426
|
+
case "setPanel": return {
|
|
1427
|
+
...e,
|
|
1428
|
+
panel: t.panel,
|
|
1429
|
+
overlayVisible: t.panel === "none" ? e.overlayVisible : !0
|
|
1430
|
+
};
|
|
1431
|
+
case "pushNotification": return {
|
|
1432
|
+
...e,
|
|
1433
|
+
notifications: [t.notification]
|
|
1434
|
+
};
|
|
1435
|
+
case "removeNotification": return {
|
|
1436
|
+
...e,
|
|
1437
|
+
notifications: e.notifications.filter((e) => e.id !== t.id)
|
|
1438
|
+
};
|
|
1439
|
+
}
|
|
1440
|
+
}
|
|
1441
|
+
function $(e) {
|
|
1442
|
+
return {
|
|
1443
|
+
...e,
|
|
1444
|
+
visiblePageIndexes: a(e.currentPageIndex, e.manga.pages.length, e.settings)
|
|
1445
|
+
};
|
|
1446
|
+
}
|
|
1447
|
+
function Ee(e, t) {
|
|
1448
|
+
return Math.min(Math.max(e, t.settings.zoom.min), t.settings.zoom.max);
|
|
1449
|
+
}
|
|
1450
|
+
//#endregion
|
|
1451
|
+
//#region src/store/store.ts
|
|
1452
|
+
var De = class {
|
|
1453
|
+
state;
|
|
1454
|
+
listeners = /* @__PURE__ */ new Set();
|
|
1455
|
+
constructor(e) {
|
|
1456
|
+
this.state = e;
|
|
1457
|
+
}
|
|
1458
|
+
getState() {
|
|
1459
|
+
return this.state;
|
|
1460
|
+
}
|
|
1461
|
+
dispatch(e) {
|
|
1462
|
+
let t = this.state, n = Q(t, e);
|
|
1463
|
+
if (n !== t) {
|
|
1464
|
+
this.state = n;
|
|
1465
|
+
for (let e of this.listeners) e(n, t);
|
|
1466
|
+
}
|
|
1467
|
+
}
|
|
1468
|
+
subscribe(e) {
|
|
1469
|
+
return this.listeners.add(e), () => {
|
|
1470
|
+
this.listeners.delete(e);
|
|
1471
|
+
};
|
|
1472
|
+
}
|
|
1473
|
+
}, Oe = class {
|
|
1474
|
+
objectUrls = /* @__PURE__ */ new Set();
|
|
1475
|
+
async resolveImageSource(e, t) {
|
|
1476
|
+
return t.src;
|
|
1477
|
+
}
|
|
1478
|
+
revokeAll() {
|
|
1479
|
+
for (let e of this.objectUrls) URL.revokeObjectURL(e);
|
|
1480
|
+
this.objectUrls.clear();
|
|
1481
|
+
}
|
|
1482
|
+
}, ke = class {
|
|
1483
|
+
handlers = /* @__PURE__ */ new Map();
|
|
1484
|
+
on(e, t) {
|
|
1485
|
+
let n = this.handlers.get(e);
|
|
1486
|
+
return n || (n = /* @__PURE__ */ new Set(), this.handlers.set(e, n)), n.add(t), () => {
|
|
1487
|
+
n.delete(t);
|
|
1488
|
+
};
|
|
1489
|
+
}
|
|
1490
|
+
emit(e, t) {
|
|
1491
|
+
let n = this.handlers.get(e);
|
|
1492
|
+
if (n) for (let e of n) try {
|
|
1493
|
+
e(t);
|
|
1494
|
+
} catch (e) {
|
|
1495
|
+
console.error(e);
|
|
1496
|
+
}
|
|
1497
|
+
}
|
|
1498
|
+
clear() {
|
|
1499
|
+
this.handlers.clear();
|
|
1500
|
+
}
|
|
1501
|
+
}, Ae = class {
|
|
1502
|
+
container;
|
|
1503
|
+
store;
|
|
1504
|
+
storage;
|
|
1505
|
+
assetLoader;
|
|
1506
|
+
renderer;
|
|
1507
|
+
i18n;
|
|
1508
|
+
events = new ke();
|
|
1509
|
+
unsubscribers = [];
|
|
1510
|
+
notificationTimers = /* @__PURE__ */ new Map();
|
|
1511
|
+
autoTimer;
|
|
1512
|
+
mobileMediaQuery;
|
|
1513
|
+
constructor(r, i) {
|
|
1514
|
+
this.container = r;
|
|
1515
|
+
let a = n(e, {
|
|
1516
|
+
...i.settings,
|
|
1517
|
+
locale: i.locale ?? i.settings?.locale ?? e.locale
|
|
1518
|
+
});
|
|
1519
|
+
this.storage = new Te(i.storage), this.assetLoader = new Oe(), this.i18n = new c(a.locale, i.translations), this.store = new De(t(i.manga, a, i.initialPageIndex));
|
|
1520
|
+
let o = {
|
|
1521
|
+
goToPage: (e) => this.goToPage(e),
|
|
1522
|
+
nextPage: () => this.nextPage(),
|
|
1523
|
+
previousPage: () => this.previousPage(),
|
|
1524
|
+
commitNextPage: () => this.commitNextPage(),
|
|
1525
|
+
commitPreviousPage: () => this.commitPreviousPage(),
|
|
1526
|
+
toggleOverlay: (e) => this.toggleOverlay(e),
|
|
1527
|
+
toggleAutoPageTurn: () => this.toggleAutoPageTurn(),
|
|
1528
|
+
updateSettings: (e) => {
|
|
1529
|
+
this.updateSettings(e);
|
|
1530
|
+
},
|
|
1531
|
+
setLayoutMode: (e) => void this.setLayoutMode(e),
|
|
1532
|
+
setTheaterHeight: (e) => this.setTheaterHeight(e),
|
|
1533
|
+
setPanel: (e) => {
|
|
1534
|
+
this.store.dispatch({
|
|
1535
|
+
type: "setPanel",
|
|
1536
|
+
panel: e
|
|
1537
|
+
});
|
|
1538
|
+
},
|
|
1539
|
+
setZoom: (e, t, n) => this.store.dispatch({
|
|
1540
|
+
type: "setZoom",
|
|
1541
|
+
scale: e,
|
|
1542
|
+
panX: t,
|
|
1543
|
+
panY: n
|
|
1544
|
+
}),
|
|
1545
|
+
setPan: (e, t) => this.store.dispatch({
|
|
1546
|
+
type: "setPan",
|
|
1547
|
+
panX: e,
|
|
1548
|
+
panY: t
|
|
1549
|
+
}),
|
|
1550
|
+
resetZoom: () => this.store.dispatch({ type: "resetZoom" })
|
|
1551
|
+
};
|
|
1552
|
+
this.renderer = new we(this.container, o, this.assetLoader, this.i18n, i.className);
|
|
1553
|
+
for (let [e, t] of Object.entries(i.events ?? {})) this.on(e, t);
|
|
1554
|
+
this.unsubscribers.push(this.store.subscribe((e, t) => {
|
|
1555
|
+
this.renderer.update(e), this.afterStateChange(e, t);
|
|
1556
|
+
})), this.bindKeyboard(), this.bindViewportChange(), this.bootstrap();
|
|
1557
|
+
}
|
|
1558
|
+
destroy() {
|
|
1559
|
+
window.clearInterval(this.autoTimer);
|
|
1560
|
+
for (let e of this.notificationTimers.values()) window.clearTimeout(e);
|
|
1561
|
+
this.notificationTimers.clear(), this.unsubscribers.forEach((e) => e()), this.assetLoader.revokeAll(), this.renderer.destroy(), this.events.emit("destroy", void 0), this.events.clear();
|
|
1562
|
+
}
|
|
1563
|
+
async setManga(e) {
|
|
1564
|
+
let t = await this.storage.getProgress(e.id) ?? 0;
|
|
1565
|
+
this.store.dispatch({
|
|
1566
|
+
type: "setManga",
|
|
1567
|
+
manga: e,
|
|
1568
|
+
pageIndex: t
|
|
1569
|
+
});
|
|
1570
|
+
}
|
|
1571
|
+
async setPages(e) {
|
|
1572
|
+
await this.setManga({
|
|
1573
|
+
...this.store.getState().manga,
|
|
1574
|
+
pages: e
|
|
1575
|
+
});
|
|
1576
|
+
}
|
|
1577
|
+
getState() {
|
|
1578
|
+
return this.store.getState();
|
|
1579
|
+
}
|
|
1580
|
+
async updateSettings(e) {
|
|
1581
|
+
this.store.dispatch({
|
|
1582
|
+
type: "updateSettings",
|
|
1583
|
+
settings: e
|
|
1584
|
+
});
|
|
1585
|
+
let t = this.store.getState().settings;
|
|
1586
|
+
this.i18n.setLocale(t.locale), await this.storage.saveSettings(t), this.events.emit("settingsChange", { settings: t });
|
|
1587
|
+
}
|
|
1588
|
+
goToPage(e) {
|
|
1589
|
+
let t = this.store.getState().currentPageIndex;
|
|
1590
|
+
this.store.dispatch({
|
|
1591
|
+
type: "goToPage",
|
|
1592
|
+
pageIndex: e
|
|
1593
|
+
});
|
|
1594
|
+
let n = this.store.getState().currentPageIndex;
|
|
1595
|
+
if (t !== n) {
|
|
1596
|
+
let e = this.store.getState();
|
|
1597
|
+
this.storage.saveProgress(e.manga.id, n), this.events.emit("pageChange", {
|
|
1598
|
+
pageIndex: n,
|
|
1599
|
+
page: e.manga.pages[n]
|
|
1600
|
+
});
|
|
1601
|
+
}
|
|
1602
|
+
}
|
|
1603
|
+
nextPage() {
|
|
1604
|
+
if (this.renderer.isAnimatingPageTurn()) return;
|
|
1605
|
+
let e = this.store.getState();
|
|
1606
|
+
this.renderer.animatePageTurn(e, "next", () => this.commitNextPage()) || this.commitNextPage();
|
|
1607
|
+
}
|
|
1608
|
+
previousPage() {
|
|
1609
|
+
if (this.renderer.isAnimatingPageTurn()) return;
|
|
1610
|
+
let e = this.store.getState();
|
|
1611
|
+
this.renderer.animatePageTurn(e, "previous", () => this.commitPreviousPage()) || this.commitPreviousPage();
|
|
1612
|
+
}
|
|
1613
|
+
commitNextPage() {
|
|
1614
|
+
if (this.renderer.isMobileViewport()) {
|
|
1615
|
+
this.goToPage(this.store.getState().currentPageIndex + 1);
|
|
1616
|
+
return;
|
|
1617
|
+
}
|
|
1618
|
+
let e = this.store.getState().currentPageIndex;
|
|
1619
|
+
this.store.dispatch({ type: "nextPage" }), this.emitPageChangeIfNeeded(e);
|
|
1620
|
+
}
|
|
1621
|
+
commitPreviousPage() {
|
|
1622
|
+
if (this.renderer.isMobileViewport()) {
|
|
1623
|
+
this.goToPage(this.store.getState().currentPageIndex - 1);
|
|
1624
|
+
return;
|
|
1625
|
+
}
|
|
1626
|
+
let e = this.store.getState().currentPageIndex;
|
|
1627
|
+
this.store.dispatch({ type: "previousPage" }), this.emitPageChangeIfNeeded(e);
|
|
1628
|
+
}
|
|
1629
|
+
toggleOverlay(e) {
|
|
1630
|
+
let t = this.store.getState().overlayVisible, n = e ?? !t;
|
|
1631
|
+
this.store.dispatch({
|
|
1632
|
+
type: "setOverlayVisible",
|
|
1633
|
+
visible: n
|
|
1634
|
+
});
|
|
1635
|
+
}
|
|
1636
|
+
toggleAutoPageTurn() {
|
|
1637
|
+
this.store.dispatch({ type: "toggleAutoPageTurn" }), this.syncAutoTimer();
|
|
1638
|
+
let e = this.store.getState().autoPageTurnEnabled;
|
|
1639
|
+
this.notify(this.i18n.t(e ? "autoplay.start" : "autoplay.stop"));
|
|
1640
|
+
}
|
|
1641
|
+
async toggleFullscreen() {
|
|
1642
|
+
let e = this.store.getState();
|
|
1643
|
+
if (document.fullscreenElement) {
|
|
1644
|
+
await document.exitFullscreen(), await this.setLayoutMode("inline");
|
|
1645
|
+
return;
|
|
1646
|
+
}
|
|
1647
|
+
await this.setLayoutMode(e.layout.mode === "nativeFullscreen" ? "inline" : "nativeFullscreen");
|
|
1648
|
+
}
|
|
1649
|
+
on(e, t) {
|
|
1650
|
+
return this.events.on(e, t);
|
|
1651
|
+
}
|
|
1652
|
+
async bootstrap() {
|
|
1653
|
+
let e = await this.storage.getSettings(), t = await this.storage.getLayout(), n = this.store.getState().manga.id, r = await this.storage.getProgress(n);
|
|
1654
|
+
e && this.store.dispatch({
|
|
1655
|
+
type: "updateSettings",
|
|
1656
|
+
settings: e
|
|
1657
|
+
}), t?.mode && this.store.dispatch({
|
|
1658
|
+
type: "setLayoutMode",
|
|
1659
|
+
layoutMode: t.mode
|
|
1660
|
+
}), t?.theaterHeightPx && this.store.dispatch({
|
|
1661
|
+
type: "setTheaterHeight",
|
|
1662
|
+
heightPx: t.theaterHeightPx
|
|
1663
|
+
}), typeof r == "number" && this.store.dispatch({
|
|
1664
|
+
type: "goToPage",
|
|
1665
|
+
pageIndex: r
|
|
1666
|
+
}), this.renderer.update(this.store.getState()), this.renderer.showSplash(), window.setTimeout(() => {
|
|
1667
|
+
this.toggleOverlay(!0);
|
|
1668
|
+
}, 1550), this.events.emit("ready", { manga: this.store.getState().manga });
|
|
1669
|
+
}
|
|
1670
|
+
bindKeyboard() {
|
|
1671
|
+
this.renderer.getElement();
|
|
1672
|
+
let e = (e) => {
|
|
1673
|
+
if (this.shouldHandleKeyboardEvent(e)) switch (e.key) {
|
|
1674
|
+
case "ArrowLeft":
|
|
1675
|
+
e.preventDefault(), this.moveFromKey("left");
|
|
1676
|
+
break;
|
|
1677
|
+
case "ArrowRight":
|
|
1678
|
+
e.preventDefault(), this.moveFromKey("right");
|
|
1679
|
+
break;
|
|
1680
|
+
case " ":
|
|
1681
|
+
e.preventDefault(), this.moveFromKey(e.shiftKey ? "right" : "left");
|
|
1682
|
+
break;
|
|
1683
|
+
case "a":
|
|
1684
|
+
case "A":
|
|
1685
|
+
e.preventDefault(), this.toggleAutoPageTurn();
|
|
1686
|
+
break;
|
|
1687
|
+
case "n":
|
|
1688
|
+
case "N":
|
|
1689
|
+
e.preventDefault(), this.setLayoutMode("inline");
|
|
1690
|
+
break;
|
|
1691
|
+
case "w":
|
|
1692
|
+
case "W":
|
|
1693
|
+
e.preventDefault(), this.setLayoutMode("theater");
|
|
1694
|
+
break;
|
|
1695
|
+
case "f":
|
|
1696
|
+
case "F":
|
|
1697
|
+
e.preventDefault(), this.setLayoutMode("browserFullscreen");
|
|
1698
|
+
break;
|
|
1699
|
+
case "m":
|
|
1700
|
+
case "M": {
|
|
1701
|
+
e.preventDefault();
|
|
1702
|
+
let t = this.store.getState().panel, n = t === "menu" || t === "pages" || t === "shortcuts";
|
|
1703
|
+
this.store.dispatch({
|
|
1704
|
+
type: "setPanel",
|
|
1705
|
+
panel: n ? "none" : "menu"
|
|
1706
|
+
}), n || this.toggleOverlay(!0);
|
|
1707
|
+
break;
|
|
1708
|
+
}
|
|
1709
|
+
case "p":
|
|
1710
|
+
case "P":
|
|
1711
|
+
e.preventDefault(), this.updateSettings({ pageTurnMode: this.store.getState().settings.pageTurnMode === "spread" ? "single" : "spread" });
|
|
1712
|
+
break;
|
|
1713
|
+
case "s":
|
|
1714
|
+
case "S": {
|
|
1715
|
+
e.preventDefault();
|
|
1716
|
+
let t = this.store.getState().panel === "settings";
|
|
1717
|
+
this.store.dispatch({
|
|
1718
|
+
type: "setPanel",
|
|
1719
|
+
panel: t ? "none" : "settings"
|
|
1720
|
+
}), t || this.toggleOverlay(!0);
|
|
1721
|
+
break;
|
|
1722
|
+
}
|
|
1723
|
+
case "Escape":
|
|
1724
|
+
e.preventDefault(), this.store.dispatch({
|
|
1725
|
+
type: "setPanel",
|
|
1726
|
+
panel: "none"
|
|
1727
|
+
}), document.fullscreenElement && document.exitFullscreen();
|
|
1728
|
+
break;
|
|
1729
|
+
}
|
|
1730
|
+
};
|
|
1731
|
+
window.addEventListener("keydown", e), this.unsubscribers.push(() => window.removeEventListener("keydown", e));
|
|
1732
|
+
}
|
|
1733
|
+
shouldHandleKeyboardEvent(e) {
|
|
1734
|
+
let t = e.target;
|
|
1735
|
+
return t instanceof Element ? !t.closest("input, select, textarea, [contenteditable='true']") : !0;
|
|
1736
|
+
}
|
|
1737
|
+
bindViewportChange() {
|
|
1738
|
+
this.mobileMediaQuery = window.matchMedia("(max-width: 676px)");
|
|
1739
|
+
let e = () => {
|
|
1740
|
+
this.renderer.update(this.store.getState());
|
|
1741
|
+
};
|
|
1742
|
+
this.mobileMediaQuery.addEventListener("change", e), this.unsubscribers.push(() => this.mobileMediaQuery?.removeEventListener("change", e));
|
|
1743
|
+
}
|
|
1744
|
+
moveFromKey(e) {
|
|
1745
|
+
this.store.getState().settings.readingDirection === "rtl" ? e === "left" ? this.nextPage() : this.previousPage() : e === "left" ? this.previousPage() : this.nextPage();
|
|
1746
|
+
}
|
|
1747
|
+
async setLayoutMode(e) {
|
|
1748
|
+
if (e === "nativeFullscreen") try {
|
|
1749
|
+
await this.renderer.getElement().requestFullscreen();
|
|
1750
|
+
} catch {
|
|
1751
|
+
e = "browserFullscreen";
|
|
1752
|
+
}
|
|
1753
|
+
else document.fullscreenElement && await document.exitFullscreen();
|
|
1754
|
+
if (e === "theater" && !this.store.getState().layout.theaterHeightPx) {
|
|
1755
|
+
let e = this.renderer.getElement().offsetHeight;
|
|
1756
|
+
e > 0 && this.store.dispatch({
|
|
1757
|
+
type: "setTheaterHeight",
|
|
1758
|
+
heightPx: e
|
|
1759
|
+
});
|
|
1760
|
+
}
|
|
1761
|
+
this.store.dispatch({
|
|
1762
|
+
type: "setLayoutMode",
|
|
1763
|
+
layoutMode: e
|
|
1764
|
+
}), await this.storage.saveSettings(this.store.getState().settings), await this.storage.saveLayout(this.store.getState().layout), this.events.emit("layoutChange", { layoutMode: e });
|
|
1765
|
+
}
|
|
1766
|
+
setTheaterHeight(e) {
|
|
1767
|
+
this.store.dispatch({
|
|
1768
|
+
type: "setTheaterHeight",
|
|
1769
|
+
heightPx: e
|
|
1770
|
+
}), this.storage.saveLayout(this.store.getState().layout);
|
|
1771
|
+
}
|
|
1772
|
+
afterStateChange(e, t) {
|
|
1773
|
+
e.autoPageTurnEnabled !== t.autoPageTurnEnabled && this.syncAutoTimer();
|
|
1774
|
+
}
|
|
1775
|
+
syncAutoTimer() {
|
|
1776
|
+
window.clearInterval(this.autoTimer), this.store.getState().autoPageTurnEnabled && (this.autoTimer = window.setInterval(() => {
|
|
1777
|
+
let e = this.store.getState(), t = i(e.settings, e.currentPageIndex);
|
|
1778
|
+
if (e.currentPageIndex + t >= e.manga.pages.length) {
|
|
1779
|
+
this.toggleAutoPageTurn();
|
|
1780
|
+
return;
|
|
1781
|
+
}
|
|
1782
|
+
this.nextPage();
|
|
1783
|
+
}, this.store.getState().settings.autoPageTurnIntervalMs));
|
|
1784
|
+
}
|
|
1785
|
+
emitPageChangeIfNeeded(e) {
|
|
1786
|
+
let t = this.store.getState();
|
|
1787
|
+
t.currentPageIndex !== e && (this.storage.saveProgress(t.manga.id, t.currentPageIndex), this.events.emit("pageChange", {
|
|
1788
|
+
pageIndex: t.currentPageIndex,
|
|
1789
|
+
page: t.manga.pages[t.currentPageIndex]
|
|
1790
|
+
}));
|
|
1791
|
+
}
|
|
1792
|
+
notify(e, t = "info") {
|
|
1793
|
+
for (let e of this.notificationTimers.values()) window.clearTimeout(e);
|
|
1794
|
+
this.notificationTimers.clear();
|
|
1795
|
+
let n = `${Date.now()}-${Math.random().toString(36).slice(2)}`;
|
|
1796
|
+
this.store.dispatch({
|
|
1797
|
+
type: "pushNotification",
|
|
1798
|
+
notification: {
|
|
1799
|
+
id: n,
|
|
1800
|
+
message: e,
|
|
1801
|
+
tone: t,
|
|
1802
|
+
createdAt: Date.now()
|
|
1803
|
+
}
|
|
1804
|
+
});
|
|
1805
|
+
let r = window.setTimeout(() => {
|
|
1806
|
+
this.store.dispatch({
|
|
1807
|
+
type: "removeNotification",
|
|
1808
|
+
id: n
|
|
1809
|
+
}), this.notificationTimers.delete(n);
|
|
1810
|
+
}, 3e3);
|
|
1811
|
+
this.notificationTimers.set(n, r);
|
|
1812
|
+
}
|
|
1813
|
+
};
|
|
1814
|
+
//#endregion
|
|
1815
|
+
//#region src/index.ts
|
|
1816
|
+
function je(e, t) {
|
|
1817
|
+
return new Ae(e, t);
|
|
1818
|
+
}
|
|
1819
|
+
//#endregion
|
|
1820
|
+
export { je as createMangaViewer };
|