@serifpersia/dango 3.3.8 → 3.4.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.
Files changed (180) hide show
  1. package/README.md +1 -1
  2. package/client/dist/assets/{AnimeCard-D4qo4289.js → AnimeCard-CJy1SXH3.js} +1 -1
  3. package/client/dist/assets/{AnimeInfo-BdRRm4So.js → AnimeInfo-BoXlVvZ-.js} +1 -1
  4. package/client/dist/assets/{AnimeInfoPage-DeJNAKMR.js → AnimeInfoPage-BxbA_7AV.js} +2 -2
  5. package/client/dist/assets/Asmr--Zc8G9zv.js +2 -0
  6. package/client/dist/assets/AsmrResetProgressModal-CKYm-8cp.js +1 -0
  7. package/client/dist/assets/AvSyncCalibrator-3yjZS7s6.js +10 -0
  8. package/client/dist/assets/Home-rrhOGQcg.js +1 -0
  9. package/client/dist/assets/Insights-Bay90Yeg.js +1 -0
  10. package/client/dist/assets/{LibraryListPage-D3hTqTRU.js → LibraryListPage-HzuDavbb.js} +1 -1
  11. package/client/dist/assets/{ListeningList-BgWsfu40.js → ListeningList-DYcQnnsG.js} +1 -1
  12. package/client/dist/assets/{Manga-Dn-CYins.js → Manga-D8CT9aO0.js} +1 -1
  13. package/client/dist/assets/{MangaInfoPage-EmQoK7Bv.js → MangaInfoPage-DGK6CYp1.js} +1 -1
  14. package/client/dist/assets/MangaReadPage-B9XoDKF9.js +1 -0
  15. package/client/dist/assets/{MangaResetProgressModal-Dian37PQ.js → MangaResetProgressModal-QjZyIAjl.js} +1 -1
  16. package/client/dist/assets/Mature-CHt_-Hz5.js +1 -0
  17. package/client/dist/assets/MediaCard-B5584Cq9.js +1 -0
  18. package/client/dist/assets/Music-HeLrEZ2d.js +1 -0
  19. package/client/dist/assets/OptionListMenu-CJ90CdwI.js +1 -0
  20. package/client/dist/assets/Player-BYtEax_z.js +56 -0
  21. package/client/dist/assets/PlayerSettings-4-cUAY4B.js +1 -0
  22. package/client/dist/assets/QueueOptionsButton-Ba0dg_82.js +1 -0
  23. package/client/dist/assets/{QueueRail-B7DeSFoA.js → QueueRail-O7f4RqjB.js} +1 -1
  24. package/client/dist/assets/Radio-DPZxQnyD.js +1 -0
  25. package/client/dist/assets/{ReadingList-BT8kUjCB.js → ReadingList-n6rr8ygy.js} +1 -1
  26. package/client/dist/assets/{ResetProgressModal-DWeiO-hs.js → ResetProgressModal-CcStlbhP.js} +1 -1
  27. package/client/dist/assets/Search-C2wrWOdy.js +1 -0
  28. package/client/dist/assets/Settings-CluUYs8U.js +21 -0
  29. package/client/dist/assets/{SkeletonGrid-B5loz7ii.js → SkeletonGrid-CLEPY9nP.js} +1 -1
  30. package/client/dist/assets/Trackers-CTGPxs0V.js +2 -0
  31. package/client/dist/assets/Tv-BwHlDdi8.js +4 -0
  32. package/client/dist/assets/Tv-ZEA45gXK.css +1 -0
  33. package/client/dist/assets/TvInfo-CXnrLekr.js +1 -0
  34. package/client/dist/assets/TvPopup-BekfiNcX.js +1 -0
  35. package/client/dist/assets/{TvSearch-BYwCf5kO.js → TvSearch-DuqR-z3v.js} +1 -1
  36. package/client/dist/assets/{TvWatchlist-BiJU6pKT.js → TvWatchlist-CBvgFrA0.js} +1 -1
  37. package/client/dist/assets/Watchlist-mj8mTOam.js +1 -0
  38. package/client/dist/assets/{hls-C11FOWHj.js → hls-Boje3IOE.js} +1 -1
  39. package/client/dist/assets/index-BXwhFWB_.js +178 -0
  40. package/client/dist/assets/useAnimeInfoData-DJ7A4B4T.js +1 -0
  41. package/client/dist/assets/useAsmr-DIwIsJXF.js +1 -0
  42. package/client/dist/assets/{useAsmrPopup-cT_Uu41e.js → useAsmrPopup-e4zNN9ig.js} +1 -1
  43. package/client/dist/assets/useMangaLibrary-C9Lci5N4.js +1 -0
  44. package/client/dist/assets/{useMangaPopup-PnmSctHu.js → useMangaPopup-B8nnpvyi.js} +1 -1
  45. package/client/dist/assets/useProviders-B5Qr4I1y.js +1 -0
  46. package/client/dist/assets/useTv-Dm8MCYlL.js +1 -0
  47. package/client/dist/assets/useTvLibrary-B7jEk2Q7.js +1 -0
  48. package/client/dist/assets/{vendor-query-BXRECSI6.js → vendor-query-BUTye89G.js} +1 -1
  49. package/client/dist/index.html +2 -2
  50. package/orchestrator.js +1 -2
  51. package/package.json +2 -6
  52. package/server/dist/app-auth.js +9 -29
  53. package/server/dist/app-hono.js +621 -0
  54. package/server/dist/config.js +0 -1
  55. package/server/dist/db/drizzle.js +32 -0
  56. package/server/dist/db/schema-anime.js +64 -0
  57. package/server/dist/db/schema-asmr.js +25 -0
  58. package/server/dist/db/schema-manga.js +31 -0
  59. package/server/dist/db/schema-tv.js +33 -0
  60. package/server/dist/db.js +75 -4
  61. package/server/dist/discord-gateway.js +1 -1
  62. package/server/dist/google.js +0 -7
  63. package/server/dist/hono/asmr.js +1 -0
  64. package/server/dist/hono/auth.js +56 -0
  65. package/server/dist/hono/music.js +419 -0
  66. package/server/dist/{controllers/proxy.controller.js → hono/proxy.js} +390 -394
  67. package/server/dist/hono/tv.js +197 -0
  68. package/server/dist/hono/watchlist.js +733 -0
  69. package/server/dist/lib/anilist.js +3 -3
  70. package/server/dist/lib/insights.js +185 -0
  71. package/server/dist/lib/ipc.js +1 -2
  72. package/server/dist/lib/kitsu.js +1 -28
  73. package/server/dist/lib/mal-import.js +291 -0
  74. package/server/dist/lib/migration.js +20 -34
  75. package/server/dist/lib/offline-db.js +36 -36
  76. package/server/dist/lib/tracker/manga-sync.service.js +21 -21
  77. package/server/dist/lib/tracker/sync.service.js +20 -20
  78. package/server/dist/lib/translate.js +79 -0
  79. package/server/dist/lib/ytmusic.js +15 -4
  80. package/server/dist/providers/title-matching.js +0 -1
  81. package/server/dist/repositories/asmr.repository.js +90 -87
  82. package/server/dist/repositories/insights.repository.js +24 -13
  83. package/server/dist/repositories/library.repository.js +33 -93
  84. package/server/dist/repositories/manga.repository.js +108 -116
  85. package/server/dist/repositories/notifications.repository.js +50 -31
  86. package/server/dist/repositories/queue.repository.js +36 -25
  87. package/server/dist/repositories/settings.repository.js +18 -8
  88. package/server/dist/repositories/shows-meta.repository.js +54 -41
  89. package/server/dist/repositories/temp-show-ids.repository.js +43 -31
  90. package/server/dist/repositories/tv.repository.js +98 -115
  91. package/server/dist/repositories/watched-episodes.repository.js +52 -20
  92. package/server/dist/repositories/watchlist.repository.js +36 -48
  93. package/server/dist/server.js +59 -151
  94. package/server/dist/sync.js +41 -4
  95. package/server/dist/trpc/context.js +7 -0
  96. package/server/dist/trpc/errors.js +21 -0
  97. package/server/dist/trpc/index.js +19 -0
  98. package/server/dist/trpc/router.js +49 -0
  99. package/server/dist/trpc/routers/asmr-library.js +122 -0
  100. package/server/dist/trpc/routers/asmr-progress.js +133 -0
  101. package/server/dist/trpc/routers/asmr.js +87 -0
  102. package/server/dist/trpc/routers/auth.js +247 -0
  103. package/server/dist/trpc/routers/continue-watching.js +83 -0
  104. package/server/dist/trpc/routers/data.js +1039 -0
  105. package/server/dist/trpc/routers/discord.js +288 -0
  106. package/server/dist/trpc/routers/discovery.js +15 -0
  107. package/server/dist/trpc/routers/insights.js +45 -0
  108. package/server/dist/trpc/routers/manga-library.js +280 -0
  109. package/server/dist/trpc/routers/manga-progress.js +181 -0
  110. package/server/dist/trpc/routers/manga.js +201 -0
  111. package/server/dist/{controllers/music.controller.js → trpc/routers/music.js} +235 -295
  112. package/server/dist/trpc/routers/notifications.js +80 -0
  113. package/server/dist/trpc/routers/progress.js +15 -0
  114. package/server/dist/trpc/routers/queue.js +95 -0
  115. package/server/dist/{routes/radio.routes.js → trpc/routers/radio.js} +30 -23
  116. package/server/dist/trpc/routers/settings.js +105 -0
  117. package/server/dist/trpc/routers/tracker.js +219 -0
  118. package/server/dist/trpc/routers/tv-library.js +145 -0
  119. package/server/dist/trpc/routers/tv-progress.js +171 -0
  120. package/server/dist/trpc/routers/tv.js +565 -0
  121. package/server/dist/trpc/routers/watchlist.js +564 -0
  122. package/server/dist/trpc/validation.js +159 -0
  123. package/server/dist/utils/security.utils.js +0 -18
  124. package/server/package.json +5 -10
  125. package/client/dist/assets/Asmr-D0EGRYsv.js +0 -2
  126. package/client/dist/assets/AsmrResetProgressModal-Gs0GmVaT.js +0 -1
  127. package/client/dist/assets/AvSyncCalibrator-D8hqarVB.js +0 -10
  128. package/client/dist/assets/Home-BnBzjFkW.js +0 -1
  129. package/client/dist/assets/Insights-i9QgY3nE.js +0 -1
  130. package/client/dist/assets/MangaReadPage-xJB8K2YU.js +0 -1
  131. package/client/dist/assets/Mature-DQtXKOXc.js +0 -1
  132. package/client/dist/assets/MediaCard-DpKoY-1j.js +0 -1
  133. package/client/dist/assets/Music-BP43Zqmq.js +0 -1
  134. package/client/dist/assets/OptionListMenu-Bj9ebsW3.js +0 -1
  135. package/client/dist/assets/Player-O2Cy2GF1.js +0 -56
  136. package/client/dist/assets/PlayerSettings-DYZ272Yp.js +0 -1
  137. package/client/dist/assets/QueueOptionsButton-lv26-6jp.js +0 -1
  138. package/client/dist/assets/Radio-qQBYnVfY.js +0 -1
  139. package/client/dist/assets/Search-BkvPYN33.js +0 -1
  140. package/client/dist/assets/Settings-CyZEBF6S.js +0 -21
  141. package/client/dist/assets/Trackers-JK-aXBYC.js +0 -2
  142. package/client/dist/assets/Tv-BwXWJxMy.js +0 -4
  143. package/client/dist/assets/Tv-C2SWcVzN.css +0 -1
  144. package/client/dist/assets/TvInfo-Dzyq6ucH.js +0 -1
  145. package/client/dist/assets/TvPopup-PlCU30FO.js +0 -1
  146. package/client/dist/assets/Watchlist-BOEeGXH9.js +0 -1
  147. package/client/dist/assets/index-CtoKRNLc.js +0 -178
  148. package/client/dist/assets/useAnimeInfoData-kr3WOIWH.js +0 -1
  149. package/client/dist/assets/useAsmr-CB9THf0m.js +0 -1
  150. package/client/dist/assets/useMangaLibrary-rM6z3_0E.js +0 -1
  151. package/client/dist/assets/useProviders-B3VB7A9M.js +0 -1
  152. package/client/dist/assets/useTv-BTUKMH7Q.js +0 -1
  153. package/client/dist/assets/useTvLibrary-C0sX-ilZ.js +0 -1
  154. package/server/dist/controllers/asmr-library.controller.js +0 -288
  155. package/server/dist/controllers/auth.controller.js +0 -225
  156. package/server/dist/controllers/data.controller.js +0 -767
  157. package/server/dist/controllers/insights.controller.js +0 -203
  158. package/server/dist/controllers/manga-library.controller.js +0 -350
  159. package/server/dist/controllers/settings.controller.js +0 -609
  160. package/server/dist/controllers/tv-library.controller.js +0 -314
  161. package/server/dist/controllers/watchlist.controller.js +0 -1069
  162. package/server/dist/request-logger.js +0 -16
  163. package/server/dist/routes/asmr-library.routes.js +0 -23
  164. package/server/dist/routes/asmr.routes.js +0 -81
  165. package/server/dist/routes/auth.routes.js +0 -25
  166. package/server/dist/routes/data.routes.js +0 -47
  167. package/server/dist/routes/discord-gateway.routes.js +0 -51
  168. package/server/dist/routes/insights.routes.js +0 -35
  169. package/server/dist/routes/lan-auth.routes.js +0 -46
  170. package/server/dist/routes/manga-library.routes.js +0 -25
  171. package/server/dist/routes/manga.routes.js +0 -141
  172. package/server/dist/routes/music.routes.js +0 -20
  173. package/server/dist/routes/providers.routes.js +0 -17
  174. package/server/dist/routes/proxy.routes.js +0 -12
  175. package/server/dist/routes/settings.routes.js +0 -24
  176. package/server/dist/routes/tracker.routes.js +0 -287
  177. package/server/dist/routes/translate.routes.js +0 -88
  178. package/server/dist/routes/tv-library.routes.js +0 -23
  179. package/server/dist/routes/tv.routes.js +0 -629
  180. package/server/dist/routes/watchlist.routes.js +0 -341
package/README.md CHANGED
@@ -6,7 +6,7 @@ _A local-first anime web app focused on performance, privacy, and personal libra
6
6
 
7
7
  [![License: MIT](https://img.shields.io/badge/License-MIT-897cff?style=for-the-badge)](https://opensource.org/licenses/MIT)
8
8
  ![Github stars](https://img.shields.io/github/stars/serifpersia/dango.svg?style=for-the-badge&color=897cff)
9
- [![App version](https://img.shields.io/badge/dango-3.3.8-897cff?style=for-the-badge)](https://github.com/serifpersia/dango)
9
+ [![App version](https://img.shields.io/badge/dango-3.4.0-897cff?style=for-the-badge)](https://github.com/serifpersia/dango)
10
10
 
11
11
  ![Users](https://dango-users-badge.ramiserifpersia.workers.dev)
12
12
 
@@ -1 +1 @@
1
- import{T as B,d as P,A as C,u as s,S as T,L as A,N as D}from"./vendor-core-8R2fFbyN.js";import{I as o}from"./vendor-icons-CDMuNDeL.js";import{u as I}from"./useAnimeInfoData-kr3WOIWH.js";import{d as R,s as z,e as M}from"./index-CtoKRNLc.js";import{Q as _}from"./QueueOptionsButton-lv26-6jp.js";import{p as a,a as x,m as $,M as L}from"./MediaCard-DpKoY-1j.js";const O=({showId:e,anchorRect:l,onMouseEnter:v,onMouseLeave:u,onRequestClose:N})=>{const{showMeta:t,loadingMeta:i,inWatchlist:d,toggleWatchlist:f}=I(e),{titlePreference:c}=R(),r=B(()=>t?.name?c==="name"?t.name:c==="nativeName"?t.names?.native||t.name:c==="englishName"&&t.names?.english||t.name:"",[t,c]),[h,g]=P(!1),p=C(!1),b=()=>{p.current=!0,v()},y=()=>{p.current=!1,!h&&u()},w=n=>{g(n),!n&&!p.current&&u()};return s(x,{anchorRect:l,onMouseEnter:b,onMouseLeave:y,onRequestClose:N,children:i?s("div",{className:a.loading,children:[s("div",{className:a.spinner}),s("span",{children:"Fetching details..."})]}):t?s(T,{children:[s("div",{className:a.header,children:s("div",{className:a.title,children:r})}),s("div",{className:a.body,children:[s("div",{className:a.metaRow,children:[t.score&&s("div",{className:a.metaItem,children:[s(o,{name:"star",className:a.scoreIcon,size:14}),s("span",{children:t.score})]}),t.status&&s("div",{className:a.metaItem,children:[s(o,{name:"tv",size:14}),s("span",{children:t.status})]})]}),s("div",{className:a.synopsis,children:t.description?z(t.description):"No synopsis available."}),s("div",{className:a.details,children:[t.nextEpisodeAirDate&&s("div",{className:a.detailItem,children:[s("strong",{children:"Aired:"})," ",t.nextEpisodeAirDate]}),Array.isArray(t.genres)&&t.genres.length>0&&s("div",{className:a.genres,children:t.genres.filter(Boolean).slice(0,4).map(n=>{const E=typeof n=="string"?n:n?.name;return s("span",{className:a.genre,children:E},E)})})]})]}),s("div",{className:a.footer,children:[s("div",{className:a.primaryAction,children:s(A,{to:`/watch/${t?.id||e}`,className:a.watchBtn,children:[s(o,{name:"play",size:14}),"Watch now"]})}),s("div",{className:a.secondaryActions,children:[s("button",{className:`${a.watchlistBtn} ${d?a.active:""}`,onClick:n=>{n.preventDefault(),n.stopPropagation(),f()},children:[d?s(o,{name:"check",size:12}):s(o,{name:"plus",size:12}),s("span",{children:d?"Remove":"Watchlist"})]}),s(_,{showId:e,showName:t.name||t.names?.romaji,showThumbnail:t.thumbnail,nativeName:t.names?.native,englishName:t.names?.english,showType:t.type,className:a.watchlistBtn,activeClassName:a.active,align:"left",onMenuOpenChange:w}),s(A,{to:`/anime/${t?.id||e}`,className:a.detailsBtn,children:"Read more"})]})]})]}):s("div",{className:a.loading,children:"Failed to load info."})})},j=D(({anime:e,continueWatching:l=!1,onRemove:v,config:u,layout:N="vertical"})=>{const t=e.currentTime||0,i=e.duration||0,d=.8,f=t>5&&i>5&&t<i*d,c=t>0&&(i<=5||t>=i*d),r=e.episodeNumber,h=l?{pathname:r?`/watch/${e._id}/${r}`:`/watch/${e._id}`,state:{name:e.name,thumbnail:e.thumbnail,nativeName:e.nativeName,englishName:e.englishName,type:e.type}}:r?`/watch/${e._id}/${r}`:`/anime/${e._id}`,g=(()=>{if(typeof h=="string")return h.startsWith("/watch/");const m=h.pathname;return typeof m=="string"&&m.startsWith("/watch/")})(),p=l&&r?`EP ${r}`:e.watchedCount!==void 0&&e.watchedCount>0?`EP ${e.watchedCount}`:null,b=[e.airTime,e.aired===!1&&e.nextEpisodeAirDate?`· ${e.nextEpisodeAirDate.split(",")[0]}`:""].filter(Boolean).join(" "),y=e.isAdult||e.rating==="R+"||e.rating==="Rx"||e.rating?.includes("17+"),w=s(T,{children:[(e.availableEpisodesDetail?.sub||e.availableEpisodes?.sub)&&s("div",{className:$.metaItem,children:[s(o,{name:"closed-captioning",size:10}),e.availableEpisodesDetail?.sub?.length??e.availableEpisodes?.sub]}),(e.availableEpisodesDetail?.dub||e.availableEpisodes?.dub)&&s("div",{className:$.metaItem,children:[s(o,{name:"microphone",size:10}),e.availableEpisodesDetail?.dub?.length??e.availableEpisodes?.dub]})]});return s(L,{item:{id:e.id||e.showId||e._id,title:e.name,nativeName:e.nativeName,englishName:e.englishName,thumbnail:e.thumbnail,typeBadge:e.type||"TV",chapterBadge:p,airMeta:b||void 0,isAdult:y,notAired:e.aired===!1},linkTo:h,hoverIcon:g?"play":"info",progress:f?{percent:t/i*100,label:`${M(t)} / ${M(i)}`}:c?{percent:100,label:"Watched"}:void 0,showProgress:l,metaRow:w,display:u,layout:N,onRemove:v,showRemoveButton:u?.elements?.poster?.removeButton??(l&&!!v),showInfoButton:!l,enrichedId:e._id,renderPopup:(m,n)=>s(O,{showId:e._id,anchorRect:m,onMouseEnter:n.onMouseEnter,onMouseLeave:n.onMouseLeave,onRequestClose:n.close})})});export{j as A};
1
+ import{T as B,d as P,A as C,u as s,S as T,L as A,N as D}from"./vendor-core-8R2fFbyN.js";import{I as o}from"./vendor-icons-CDMuNDeL.js";import{u as I}from"./useAnimeInfoData-DJ7A4B4T.js";import{d as R,s as z,e as M}from"./index-BXwhFWB_.js";import{Q as _}from"./QueueOptionsButton-Ba0dg_82.js";import{p as a,a as x,m as $,M as L}from"./MediaCard-B5584Cq9.js";const O=({showId:e,anchorRect:l,onMouseEnter:v,onMouseLeave:u,onRequestClose:N})=>{const{showMeta:t,loadingMeta:i,inWatchlist:d,toggleWatchlist:f}=I(e),{titlePreference:c}=R(),r=B(()=>t?.name?c==="name"?t.name:c==="nativeName"?t.names?.native||t.name:c==="englishName"&&t.names?.english||t.name:"",[t,c]),[h,g]=P(!1),p=C(!1),b=()=>{p.current=!0,v()},y=()=>{p.current=!1,!h&&u()},w=n=>{g(n),!n&&!p.current&&u()};return s(x,{anchorRect:l,onMouseEnter:b,onMouseLeave:y,onRequestClose:N,children:i?s("div",{className:a.loading,children:[s("div",{className:a.spinner}),s("span",{children:"Fetching details..."})]}):t?s(T,{children:[s("div",{className:a.header,children:s("div",{className:a.title,children:r})}),s("div",{className:a.body,children:[s("div",{className:a.metaRow,children:[t.score&&s("div",{className:a.metaItem,children:[s(o,{name:"star",className:a.scoreIcon,size:14}),s("span",{children:t.score})]}),t.status&&s("div",{className:a.metaItem,children:[s(o,{name:"tv",size:14}),s("span",{children:t.status})]})]}),s("div",{className:a.synopsis,children:t.description?z(t.description):"No synopsis available."}),s("div",{className:a.details,children:[t.nextEpisodeAirDate&&s("div",{className:a.detailItem,children:[s("strong",{children:"Aired:"})," ",t.nextEpisodeAirDate]}),Array.isArray(t.genres)&&t.genres.length>0&&s("div",{className:a.genres,children:t.genres.filter(Boolean).slice(0,4).map(n=>{const E=typeof n=="string"?n:n?.name;return s("span",{className:a.genre,children:E},E)})})]})]}),s("div",{className:a.footer,children:[s("div",{className:a.primaryAction,children:s(A,{to:`/watch/${t?.id||e}`,className:a.watchBtn,children:[s(o,{name:"play",size:14}),"Watch now"]})}),s("div",{className:a.secondaryActions,children:[s("button",{className:`${a.watchlistBtn} ${d?a.active:""}`,onClick:n=>{n.preventDefault(),n.stopPropagation(),f()},children:[d?s(o,{name:"check",size:12}):s(o,{name:"plus",size:12}),s("span",{children:d?"Remove":"Watchlist"})]}),s(_,{showId:e,showName:t.name||t.names?.romaji,showThumbnail:t.thumbnail,nativeName:t.names?.native,englishName:t.names?.english,showType:t.type,className:a.watchlistBtn,activeClassName:a.active,align:"left",onMenuOpenChange:w}),s(A,{to:`/anime/${t?.id||e}`,className:a.detailsBtn,children:"Read more"})]})]})]}):s("div",{className:a.loading,children:"Failed to load info."})})},j=D(({anime:e,continueWatching:l=!1,onRemove:v,config:u,layout:N="vertical"})=>{const t=e.currentTime||0,i=e.duration||0,d=.8,f=t>5&&i>5&&t<i*d,c=t>0&&(i<=5||t>=i*d),r=e.episodeNumber,h=l?{pathname:r?`/watch/${e._id}/${r}`:`/watch/${e._id}`,state:{name:e.name,thumbnail:e.thumbnail,nativeName:e.nativeName,englishName:e.englishName,type:e.type}}:r?`/watch/${e._id}/${r}`:`/anime/${e._id}`,g=(()=>{if(typeof h=="string")return h.startsWith("/watch/");const m=h.pathname;return typeof m=="string"&&m.startsWith("/watch/")})(),p=l&&r?`EP ${r}`:e.watchedCount!==void 0&&e.watchedCount>0?`EP ${e.watchedCount}`:null,b=[e.airTime,e.aired===!1&&e.nextEpisodeAirDate?`· ${e.nextEpisodeAirDate.split(",")[0]}`:""].filter(Boolean).join(" "),y=e.isAdult||e.rating==="R+"||e.rating==="Rx"||e.rating?.includes("17+"),w=s(T,{children:[(e.availableEpisodesDetail?.sub||e.availableEpisodes?.sub)&&s("div",{className:$.metaItem,children:[s(o,{name:"closed-captioning",size:10}),e.availableEpisodesDetail?.sub?.length??e.availableEpisodes?.sub]}),(e.availableEpisodesDetail?.dub||e.availableEpisodes?.dub)&&s("div",{className:$.metaItem,children:[s(o,{name:"microphone",size:10}),e.availableEpisodesDetail?.dub?.length??e.availableEpisodes?.dub]})]});return s(L,{item:{id:e.id||e.showId||e._id,title:e.name,nativeName:e.nativeName,englishName:e.englishName,thumbnail:e.thumbnail,typeBadge:e.type||"TV",chapterBadge:p,airMeta:b||void 0,isAdult:y,notAired:e.aired===!1},linkTo:h,hoverIcon:g?"play":"info",progress:f?{percent:t/i*100,label:`${M(t)} / ${M(i)}`}:c?{percent:100,label:"Watched"}:void 0,showProgress:l,metaRow:w,display:u,layout:N,onRemove:v,showRemoveButton:u?.elements?.poster?.removeButton??(l&&!!v),showInfoButton:!l,enrichedId:e._id,renderPopup:(m,n)=>s(O,{showId:e._id,anchorRect:m,onMouseEnter:n.onMouseEnter,onMouseLeave:n.onMouseLeave,onRequestClose:n.close})})});export{j as A};
@@ -1 +1 @@
1
- import{n as C,a as I,d as S,h as p,T,u as e}from"./vendor-core-8R2fFbyN.js";import{I as s}from"./vendor-icons-CDMuNDeL.js";import{u as b}from"./useAnimeInfoData-kr3WOIWH.js";import{d as B,f as d,s as w,M,B as u}from"./index-CtoKRNLc.js";import{u as x}from"./useMatureConsent-CT7-KfzG.js";import{A}from"./AnimeMetaDetails-BPvv5xIl.js";import{S as D}from"./SynopsisText-BcpwT5iw.js";import{Q as G}from"./QueueOptionsButton-lv26-6jp.js";import"./vendor-query-BXRECSI6.js";import"./useIsMobile-Dm_b6Ob3.js";import"./vendor-ui-CUDCvRS_.js";const P="_container_1287q_1",W="_heroSection_1287q_11",O="_bannerContainer_1287q_17",$="_banner_1287q_17",U="_bannerOverlay_1287q_37",j="_heroContent_1287q_49",z="_posterContainer_1287q_62",V="_floatIn_1287q_1",Q="_poster_1287q_62",E="_infoGlass_1287q_86",H="_slideUpIn_1287q_1",F="_title_1287q_100",J="_quickMeta_1287q_109",K="_metaItem_1287q_117",L="_iconStar_1287q_126",R="_iconTv_1287q_129",X="_iconType_1287q_132",Y="_iconClock_1287q_135",Z="_genres_1287q_139",ee="_genre_1287q_139",ne="_synopsisSection_1287q_165",te="_sectionTitleSmall_1287q_170",se="_description_1287q_178",ae="_actions_1287q_186",ie="_watchBtn_1287q_192",oe="_watchlistBtn_1287q_214",le="_active_1287q_234",ce="_detailsSection_1287q_241",re="_detailsToggleBtn_1287q_247",de="_expandedContent_1287q_270",_e="_fadeIn_1287q_1",me="_detailsGridContainer_1287q_274",he="_detailItem_1287q_284",pe="_airingValue_1287q_303",ue="_loadingDetails_1287q_308",ve="_spinner_1287q_317",ge="_spin_1287q_317",ke="_heroSkeleton_1287q_332",qe="_skeletonBanner_1287q_336",fe="_skeletonPoster_1287q_337",Ne="_skeletonTitle_1287q_338",ye="_skeletonMeta_1287q_339",Ce="_skeletonDesc_1287q_340",Ie="_skeletonActions_1287q_341",Se="_skeletonContent_1287q_374",Te="_skeletonInfo_1287q_388",n={container:P,heroSection:W,bannerContainer:O,banner:$,bannerOverlay:U,heroContent:j,posterContainer:z,floatIn:V,poster:Q,infoGlass:E,slideUpIn:H,title:F,quickMeta:J,metaItem:K,iconStar:L,iconTv:R,iconType:X,iconClock:Y,genres:Z,genre:ee,synopsisSection:ne,sectionTitleSmall:te,description:se,actions:ae,watchBtn:ie,watchlistBtn:oe,active:le,detailsSection:ce,detailsToggleBtn:re,expandedContent:de,fadeIn:_e,detailsGridContainer:me,detailItem:he,airingValue:pe,loadingDetails:ue,spinner:ve,spin:ge,heroSkeleton:ke,skeletonBanner:qe,skeletonPoster:fe,skeletonTitle:Ne,skeletonMeta:ye,skeletonDesc:Ce,skeletonActions:Ie,"skeleton-wave":"_skeleton-wave_1287q_1",skeletonContent:Se,skeletonInfo:Te};function $e(){const{id:a}=C(),i=I(),{titlePreference:l}=B(),[o,v]=S(!1),{showMeta:t,loadingMeta:g,toggleWatchlist:k,inWatchlist:c}=b(a),{hasConsent:q,grant:f}=x();p(()=>{a&&t?.id&&t.id!==a&&i(`/anime/${t.id}`,{replace:!0})},[a,t,i]),p(()=>{document.title=t?.name?`${t.name} - dango`:"Anime - dango"},[t?.name]);const N=()=>t?.name?l==="name"?t.name:l==="nativeName"?t.names?.native||t.name:l==="englishName"&&t.names?.english||t.name:"",y=()=>{a&&i(`/watch/${a}`)},_=T(()=>t?.bannerImage?d(t.bannerImage):t?.thumbnail?d(t.thumbnail,1200,450):"",[t?.bannerImage,t?.thumbnail]);if(g||!t?.name)return e("div",{className:n.container,children:e("div",{className:n.heroSkeleton,children:[e("div",{className:n.skeletonBanner}),e("div",{className:n.skeletonContent,children:[e("div",{className:n.skeletonPoster}),e("div",{className:n.skeletonInfo,children:[e("div",{className:n.skeletonTitle}),e("div",{className:n.skeletonMeta}),e("div",{className:n.skeletonDesc}),e("div",{className:n.skeletonActions})]})]})]})});const m=t.isAdult===!0&&!q;return e("div",{className:n.container,style:m?{filter:"blur(14px)",pointerEvents:"none",userSelect:"none"}:void 0,children:[e("div",{className:n.heroSection,children:[e("div",{className:n.bannerContainer,children:[e("div",{className:n.banner,style:_?{backgroundImage:`url(${_})`}:void 0}),e("div",{className:n.bannerOverlay})]}),e("div",{className:n.heroContent,children:[e("div",{className:n.posterContainer,children:e("img",{src:d(t.thumbnail||"",320,480),alt:t.name,className:n.poster,decoding:"async"})}),e("div",{className:n.infoGlass,children:[e("div",{className:n.topInfo,children:[e("h1",{className:n.title,children:N()}),e("div",{className:n.quickMeta,children:[t.score&&e("div",{className:n.metaItem,children:[e(s,{name:"star",className:n.iconStar}),e("span",{children:t.score})]}),t.status&&e("div",{className:n.metaItem,children:[e(s,{name:"tv",className:n.iconTv}),e("span",{children:t.status})]}),t.type&&e("div",{className:n.metaItem,children:[e(s,{name:"layer-group",className:n.iconType}),e("span",{children:t.type})]})]}),Array.isArray(t.genres)&&t.genres.length>0&&e("div",{className:n.genres,children:t.genres.filter(Boolean).slice(0,5).map(r=>{const h=typeof r=="string"?r:r?.name;return e("span",{className:n.genre,children:h},h)})})]}),e("div",{className:n.synopsisSection,children:[e("h2",{className:n.sectionTitleSmall,children:"Synopsis"}),e(D,{text:w(t.description),emptyText:"No description available."})]}),e("div",{className:n.actions,children:[e("button",{className:n.watchBtn,onClick:y,children:[e(s,{name:"play",size:14}),"Start Watching"]}),e("button",{className:`${n.watchlistBtn} ${c?n.active:""}`,onClick:k,children:[c?e(s,{name:"check",size:14}):e(s,{name:"plus",size:14}),c?"In Watchlist":"Add to Watchlist"]}),e(G,{showId:a,showName:t.name||t.names?.romaji,showThumbnail:t.thumbnail,nativeName:t.names?.native,englishName:t.names?.english,showType:t.type,className:n.watchlistBtn,activeClassName:n.active})]})]})]})]}),e("div",{className:n.detailsSection,children:[e("button",{className:n.detailsToggleBtn,onClick:()=>{v(!o)},children:[o?e(s,{name:"chevron-up"}):e(s,{name:"chevron-down"}),o?"Hide Details":"Show Details"]}),o&&e("div",{className:n.expandedContent,children:e(A,{showMeta:t,styles:n})})]}),m&&e(M,{isOpen:!0,title:"Content Warning",onClose:()=>i("/"),children:e("div",{style:{padding:"1rem",textAlign:"center"},children:[e("p",{children:"This title contains mature content intended for adult audiences."}),e("p",{children:["By proceeding, you confirm that you are ",e("strong",{children:"18 years of age or older"})," (or the age of majority in your jurisdiction) and wish to view this content."]}),e("div",{style:{marginTop:"1rem",display:"flex",gap:"10px",justifyContent:"center"},children:[e(u,{variant:"secondary",onClick:()=>i("/"),children:"Go Back"}),e(u,{onClick:f,children:"I'm 18+, Continue"})]})]})})]})}export{$e as default};
1
+ import{n as C,a as I,d as S,h as p,T,u as e}from"./vendor-core-8R2fFbyN.js";import{I as s}from"./vendor-icons-CDMuNDeL.js";import{u as b}from"./useAnimeInfoData-DJ7A4B4T.js";import{d as B,f as d,s as w,M,B as u}from"./index-BXwhFWB_.js";import{u as x}from"./useMatureConsent-CT7-KfzG.js";import{A}from"./AnimeMetaDetails-BPvv5xIl.js";import{S as D}from"./SynopsisText-BcpwT5iw.js";import{Q as G}from"./QueueOptionsButton-Ba0dg_82.js";import"./vendor-query-BUTye89G.js";import"./useIsMobile-Dm_b6Ob3.js";import"./vendor-ui-CUDCvRS_.js";const P="_container_1287q_1",W="_heroSection_1287q_11",O="_bannerContainer_1287q_17",$="_banner_1287q_17",U="_bannerOverlay_1287q_37",j="_heroContent_1287q_49",z="_posterContainer_1287q_62",V="_floatIn_1287q_1",Q="_poster_1287q_62",E="_infoGlass_1287q_86",H="_slideUpIn_1287q_1",F="_title_1287q_100",J="_quickMeta_1287q_109",K="_metaItem_1287q_117",L="_iconStar_1287q_126",R="_iconTv_1287q_129",X="_iconType_1287q_132",Y="_iconClock_1287q_135",Z="_genres_1287q_139",ee="_genre_1287q_139",ne="_synopsisSection_1287q_165",te="_sectionTitleSmall_1287q_170",se="_description_1287q_178",ae="_actions_1287q_186",ie="_watchBtn_1287q_192",oe="_watchlistBtn_1287q_214",le="_active_1287q_234",ce="_detailsSection_1287q_241",re="_detailsToggleBtn_1287q_247",de="_expandedContent_1287q_270",_e="_fadeIn_1287q_1",me="_detailsGridContainer_1287q_274",he="_detailItem_1287q_284",pe="_airingValue_1287q_303",ue="_loadingDetails_1287q_308",ve="_spinner_1287q_317",ge="_spin_1287q_317",ke="_heroSkeleton_1287q_332",qe="_skeletonBanner_1287q_336",fe="_skeletonPoster_1287q_337",Ne="_skeletonTitle_1287q_338",ye="_skeletonMeta_1287q_339",Ce="_skeletonDesc_1287q_340",Ie="_skeletonActions_1287q_341",Se="_skeletonContent_1287q_374",Te="_skeletonInfo_1287q_388",n={container:P,heroSection:W,bannerContainer:O,banner:$,bannerOverlay:U,heroContent:j,posterContainer:z,floatIn:V,poster:Q,infoGlass:E,slideUpIn:H,title:F,quickMeta:J,metaItem:K,iconStar:L,iconTv:R,iconType:X,iconClock:Y,genres:Z,genre:ee,synopsisSection:ne,sectionTitleSmall:te,description:se,actions:ae,watchBtn:ie,watchlistBtn:oe,active:le,detailsSection:ce,detailsToggleBtn:re,expandedContent:de,fadeIn:_e,detailsGridContainer:me,detailItem:he,airingValue:pe,loadingDetails:ue,spinner:ve,spin:ge,heroSkeleton:ke,skeletonBanner:qe,skeletonPoster:fe,skeletonTitle:Ne,skeletonMeta:ye,skeletonDesc:Ce,skeletonActions:Ie,"skeleton-wave":"_skeleton-wave_1287q_1",skeletonContent:Se,skeletonInfo:Te};function $e(){const{id:a}=C(),i=I(),{titlePreference:l}=B(),[o,v]=S(!1),{showMeta:t,loadingMeta:g,toggleWatchlist:k,inWatchlist:c}=b(a),{hasConsent:q,grant:f}=x();p(()=>{a&&t?.id&&t.id!==a&&i(`/anime/${t.id}`,{replace:!0})},[a,t,i]),p(()=>{document.title=t?.name?`${t.name} - dango`:"Anime - dango"},[t?.name]);const N=()=>t?.name?l==="name"?t.name:l==="nativeName"?t.names?.native||t.name:l==="englishName"&&t.names?.english||t.name:"",y=()=>{a&&i(`/watch/${a}`)},_=T(()=>t?.bannerImage?d(t.bannerImage):t?.thumbnail?d(t.thumbnail,1200,450):"",[t?.bannerImage,t?.thumbnail]);if(g||!t?.name)return e("div",{className:n.container,children:e("div",{className:n.heroSkeleton,children:[e("div",{className:n.skeletonBanner}),e("div",{className:n.skeletonContent,children:[e("div",{className:n.skeletonPoster}),e("div",{className:n.skeletonInfo,children:[e("div",{className:n.skeletonTitle}),e("div",{className:n.skeletonMeta}),e("div",{className:n.skeletonDesc}),e("div",{className:n.skeletonActions})]})]})]})});const m=t.isAdult===!0&&!q;return e("div",{className:n.container,style:m?{filter:"blur(14px)",pointerEvents:"none",userSelect:"none"}:void 0,children:[e("div",{className:n.heroSection,children:[e("div",{className:n.bannerContainer,children:[e("div",{className:n.banner,style:_?{backgroundImage:`url(${_})`}:void 0}),e("div",{className:n.bannerOverlay})]}),e("div",{className:n.heroContent,children:[e("div",{className:n.posterContainer,children:e("img",{src:d(t.thumbnail||"",320,480),alt:t.name,className:n.poster,decoding:"async"})}),e("div",{className:n.infoGlass,children:[e("div",{className:n.topInfo,children:[e("h1",{className:n.title,children:N()}),e("div",{className:n.quickMeta,children:[t.score&&e("div",{className:n.metaItem,children:[e(s,{name:"star",className:n.iconStar}),e("span",{children:t.score})]}),t.status&&e("div",{className:n.metaItem,children:[e(s,{name:"tv",className:n.iconTv}),e("span",{children:t.status})]}),t.type&&e("div",{className:n.metaItem,children:[e(s,{name:"layer-group",className:n.iconType}),e("span",{children:t.type})]})]}),Array.isArray(t.genres)&&t.genres.length>0&&e("div",{className:n.genres,children:t.genres.filter(Boolean).slice(0,5).map(r=>{const h=typeof r=="string"?r:r?.name;return e("span",{className:n.genre,children:h},h)})})]}),e("div",{className:n.synopsisSection,children:[e("h2",{className:n.sectionTitleSmall,children:"Synopsis"}),e(D,{text:w(t.description),emptyText:"No description available."})]}),e("div",{className:n.actions,children:[e("button",{className:n.watchBtn,onClick:y,children:[e(s,{name:"play",size:14}),"Start Watching"]}),e("button",{className:`${n.watchlistBtn} ${c?n.active:""}`,onClick:k,children:[c?e(s,{name:"check",size:14}):e(s,{name:"plus",size:14}),c?"In Watchlist":"Add to Watchlist"]}),e(G,{showId:a,showName:t.name||t.names?.romaji,showThumbnail:t.thumbnail,nativeName:t.names?.native,englishName:t.names?.english,showType:t.type,className:n.watchlistBtn,activeClassName:n.active})]})]})]})]}),e("div",{className:n.detailsSection,children:[e("button",{className:n.detailsToggleBtn,onClick:()=>{v(!o)},children:[o?e(s,{name:"chevron-up"}):e(s,{name:"chevron-down"}),o?"Hide Details":"Show Details"]}),o&&e("div",{className:n.expandedContent,children:e(A,{showMeta:t,styles:n})})]}),m&&e(M,{isOpen:!0,title:"Content Warning",onClose:()=>i("/"),children:e("div",{style:{padding:"1rem",textAlign:"center"},children:[e("p",{children:"This title contains mature content intended for adult audiences."}),e("p",{children:["By proceeding, you confirm that you are ",e("strong",{children:"18 years of age or older"})," (or the age of majority in your jurisdiction) and wish to view this content."]}),e("div",{style:{marginTop:"1rem",display:"flex",gap:"10px",justifyContent:"center"},children:[e(u,{variant:"secondary",onClick:()=>i("/"),children:"Go Back"}),e(u,{onClick:f,children:"I'm 18+, Continue"})]})]})})]})}export{$e as default};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/AnimeInfo-BdRRm4So.js","assets/vendor-core-8R2fFbyN.js","assets/vendor-icons-CDMuNDeL.js","assets/useAnimeInfoData-kr3WOIWH.js","assets/vendor-query-BXRECSI6.js","assets/index-CtoKRNLc.js","assets/index-CUm1meqr.css","assets/QueueOptionsButton-lv26-6jp.js","assets/vendor-ui-CUDCvRS_.js","assets/QueueOptionsButton-CM15uQn8.css","assets/useMatureConsent-CT7-KfzG.js","assets/AnimeMetaDetails-BPvv5xIl.js","assets/AnimeMetaDetails-BwNQnRCd.css","assets/SynopsisText-BcpwT5iw.js","assets/useIsMobile-Dm_b6Ob3.js","assets/SynopsisText-CYv2W3yR.css","assets/AnimeInfo-BFWtHlPC.css"])))=>i.map(i=>d[i]);
2
- import{Y as r,_ as t}from"./index-CtoKRNLc.js";import{u as o,P as e,z as i}from"./vendor-core-8R2fFbyN.js";import"./vendor-query-BXRECSI6.js";import"./vendor-icons-CDMuNDeL.js";const a=i(()=>t(()=>import("./AnimeInfo-BdRRm4So.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16])));function p(){return o(e,{fallback:o(r,{}),children:o(a,{})})}export{p as default};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/AnimeInfo-BoXlVvZ-.js","assets/vendor-core-8R2fFbyN.js","assets/vendor-icons-CDMuNDeL.js","assets/useAnimeInfoData-DJ7A4B4T.js","assets/vendor-query-BUTye89G.js","assets/index-BXwhFWB_.js","assets/index-CUm1meqr.css","assets/QueueOptionsButton-Ba0dg_82.js","assets/vendor-ui-CUDCvRS_.js","assets/QueueOptionsButton-CM15uQn8.css","assets/useMatureConsent-CT7-KfzG.js","assets/AnimeMetaDetails-BPvv5xIl.js","assets/AnimeMetaDetails-BwNQnRCd.css","assets/SynopsisText-BcpwT5iw.js","assets/useIsMobile-Dm_b6Ob3.js","assets/SynopsisText-CYv2W3yR.css","assets/AnimeInfo-BFWtHlPC.css"])))=>i.map(i=>d[i]);
2
+ import{$ as r,_ as t}from"./index-BXwhFWB_.js";import{u as o,P as e,z as i}from"./vendor-core-8R2fFbyN.js";import"./vendor-query-BUTye89G.js";import"./vendor-icons-CDMuNDeL.js";const a=i(()=>t(()=>import("./AnimeInfo-BoXlVvZ-.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16])));function p(){return o(e,{fallback:o(r,{}),children:o(a,{})})}export{p as default};
@@ -0,0 +1,2 @@
1
+ import{T as Je,u as e,A as j,d as m,h as N,a as Ge,g as $e,q,S as F,$ as Ve,n as bt,o as vt}from"./vendor-core-8R2fFbyN.js";import{I as y}from"./vendor-icons-CDMuNDeL.js";import{u as yt}from"./vendor-query-BUTye89G.js";import{e as me,t as Ee,B as he,M as xe,U as R,z as oe,W as kt,T as ze}from"./index-BXwhFWB_.js";import{M as wt}from"./MediaCard-B5584Cq9.js";import{c as Qe,a as Ze,d as Nt,e as Xe,f as et,g as Ct,h as St,i as Tt,j as At,k as Ye,l as Re}from"./useAsmr-DIwIsJXF.js";import{a as t}from"./Asmr.module-ChUXDZKx.js";import{u as Mt,A as xt}from"./useAsmrPopup-e4zNN9ig.js";import{l as Bt}from"./hls-Boje3IOE.js";import"./vendor-ui-CUDCvRS_.js";import"./useIsMobile-Dm_b6Ob3.js";const Lt=({work:s,onClose:o,onPlay:S,t:g})=>{const{data:i,isLoading:h}=Qe(s.id||null),v=Ze(s),{data:A}=Nt(v||void 0),{toggle:k,bookmarkedIds:T}=Xe(),{data:I}=et(v||void 0),L=v?T.has(v):!!A?.inLibrary,C=Je(()=>(i?.description||s.description||"").split(`
2
+ `).map(l=>{const u=l.indexOf(":");return u===-1?null:{label:l.slice(0,u),value:l.slice(u+1).trim()}}).filter(l=>!!l&&!!l.value),[i?.description,s.description]),f=i?.tracks||[],w=Je(()=>{const l=I?.progress??[];return l.length>0?l.reduce((u,d)=>u.updatedAt>=d.updatedAt?u:d):null},[I]),M=w&&w.trackIndex<f.length?w.trackIndex:null;return e("div",{className:t.detailOverlay,onClick:o,children:e("div",{className:t.detailModal,onClick:l=>l.stopPropagation(),children:[e("button",{className:t.detailClose,onClick:o,"aria-label":"Close",children:e(y,{name:"times"})}),e("div",{className:t.detailHeader,children:[s.thumbnail?e("img",{className:t.detailCover,src:s.thumbnail,alt:s.name,decoding:"async"}):e("div",{className:`${t.detailCover} ${t.thumbPlaceholder}`}),e("div",{className:t.detailInfo,children:[e("h2",{className:t.detailTitle,children:g?g(s.name):s.name}),e("p",{className:t.detailRj,children:s.id}),C.map(l=>l.label==="Tags"?e("p",{className:t.metaRow,children:[e("span",{className:t.metaLabel,children:"Tags"}),e("span",{className:t.tagChips,children:l.value.split(", ").map(u=>e("span",{className:t.tagChip,children:u},u))})]},l.label):e("p",{className:t.metaRow,children:[e("span",{className:t.metaLabel,children:l.label}),l.value]},l.label))]})]}),e("div",{className:t.tracksSection,children:[e("h3",{className:t.tracksHeading,children:h?"Loading tracks…":`Tracks (${f.length})`}),!h&&(f.length>0?e("ul",{className:t.trackList,children:f.map((l,u)=>e("li",{children:e("button",{className:t.trackRow,onClick:()=>S(s,f,u),children:[e(y,{name:"play",className:t.trackIcon}),e("span",{className:t.trackLabel,children:l.resolutionStr}),e("span",{className:t.trackType,children:l.hls?"HLS":"MP3"})]})},l.link))}):e("p",{className:t.noTracks,children:"No audio streams available for this work."}))]}),e("div",{className:t.detailActions,children:[!h&&f.length>0&&e("button",{className:t.playAllBtn,onClick:()=>S(s,f,0),children:[e(y,{name:"play"})," Play from start"]}),!h&&M!==null&&w&&e("button",{className:t.playAllBtn,onClick:()=>S(s,f,M),children:[e(y,{name:"history"})," Resume track ",M+1," ·"," ",me(w.currentTime),w.duration>0?` / ${me(w.duration)}`:""]}),v&&e("button",{className:t.playAllBtn,onClick:()=>k({rjCode:v,title:s.name,thumbnail:s.thumbnail||"",isAdult:!!s.isAdult}),"aria-pressed":L,children:[e(y,{name:L?"check":"plus"})," ",L?"In listening list":"Add to listening list"]})]})]})})},Pt=({title:s,images:o,chapters:S,tracks:g,trackIndex:i,expanded:h,isAdult:v,rjCode:A,t:k,onTrackChange:T,onExpandedChange:I,onClose:L})=>{const C=j(null),f=j(null),[w,M]=m(!1),[l,u]=m(0),[d,P]=m(0),[p,U]=m(0),[B,Y]=m(!0),[D,_]=m(0),[ae,ie]=m(new Set),[J,ne]=m(!1),[pe,$]=m(!0),re=j("");re.current||(re.current=typeof crypto<"u"&&"randomUUID"in crypto?crypto.randomUUID():`asmr-${Date.now()}-${Math.random().toString(36).slice(2)}`);const[O,Ne]=m(()=>{const a=parseFloat(localStorage.getItem("asmrVolume")||"");return Number.isFinite(a)?a:1}),ge=j(O);N(()=>{ge.current=O},[O]);const fe=Ge(),V=$e.useMemo(()=>A?Ct(A):"",[A]),Ce=St(),ce=Tt(),{data:Se}=et(V||void 0),[Be,be]=m(!1),[H,Le]=m(0),[Pe,G]=m(!1),ve=j(""),W=j(null),K=j(0),Q=j(0),de=j(0),Z=g[i],X=Z?.link,Te=Z?.hls,n=Z?.resolutionStr||"",c=o.length>0,x=`${V}:${i}`,se=$e.useMemo(()=>(Se?.progress??[]).find(r=>r.trackIndex===i)??null,[Se,i]),ee=j({workId:"",trackIndex:0,trackLabel:""});ee.current={workId:V,trackIndex:i,trackLabel:n};const le=q((a,r,b,E=!1)=>{!a.workId||!b||b<10||!E&&Math.abs(r-K.current)<5||(K.current=r,Ce.mutate({workId:a.workId,trackIndex:a.trackIndex,trackLabel:a.trackLabel,currentTime:Math.floor(r),duration:Math.floor(b),title:s,thumbnail:o[0]||"",rjCode:a.workId,isAdult:v?1:0}))},[Ce,s,o,v]),z=q((a=!1)=>{W.current&&(clearTimeout(W.current),W.current=null),le(ee.current,Q.current,de.current,a)},[le]),ye=j(z);ye.current=z;const _e=j(le);_e.current=le;const ue=q(()=>{f.current&&(f.current.destroy(),f.current=null)},[]);N(()=>{const a=C.current;if(!a||!X)return;const r={workId:V,trackIndex:i,trackLabel:n},b=()=>{W.current&&(clearTimeout(W.current),W.current=null),_e.current(r,Q.current,de.current,!0)};if(u(0),P(0),U(0),M(!1),Q.current=0,de.current=0,K.current=0,ue(),Te){let E=!1;return(async()=>{const te=await Bt();if(!E)if(te&&te.isSupported()){const we=new te({enableWorker:!0});f.current=we,we.loadSource(X),we.attachMedia(a),a.play().catch(()=>M(!1))}else a.src=X,a.load(),a.volume=ge.current,a.play().catch(()=>M(!1))})(),()=>{E=!0,ue(),a.removeAttribute("src"),b()}}else a.src=X;return a.load(),a.volume=ge.current,a.play().catch(()=>M(!1)),()=>{ue(),a.removeAttribute("src"),b()}},[X,Te,ue,V,i,n]),N(()=>()=>ue(),[ue]),N(()=>{const a=()=>{document.visibilityState==="hidden"&&ye.current()},r=()=>ye.current();return document.addEventListener("visibilitychange",a),window.addEventListener("pagehide",r),()=>{document.removeEventListener("visibilitychange",a),window.removeEventListener("pagehide",r)}},[]),N(()=>{if(!se||ve.current===x||!(d>0))return;const a=se.currentTime||0,r=se.duration||d;a>=10&&r-a>=15&&Q.current<a?(ve.current=x,Le(a),be(!0)):ve.current=x},[se,d,x]),N(()=>{const a=C.current;a&&(a.volume=O)},[O]),N(()=>{if(h)return document.body.classList.add("asmr-player-open"),()=>document.body.classList.remove("asmr-player-open")},[h]),N(()=>{_(0)},[o]),N(()=>{h&&$(!0)},[h]),N(()=>{J&&$(!0)},[J]);const Ae=q(a=>{if(!s||g.length===0)return;const r=g[i],b=r?`${r.resolutionStr} (${i+1}/${g.length})`:"",E=C.current,te=E?E.currentTime:0,we=E&&E.duration||0,ft=o[0]||"";Ee.discord.asmrPresence.mutate({title:s,trackLabel:b,isPlaying:a,thumbnail:ft,thumbnails:o,currentTime:te,duration:we,isAdult:!!v,rjCode:A||"",sessionId:re.current}).catch(()=>{}),Ee.discord.heartbeat.mutate({sessionId:re.current}).catch(()=>{})},[s,g,i,o,v,A]);N(()=>{Ae(w)},[Ae,w,i,s,h]),N(()=>{if(!w)return;const a=window.setInterval(()=>Ae(!0),15e3);return()=>window.clearInterval(a)},[w,Ae]),N(()=>{const a=re.current,r=()=>{if(!a)return;const te=JSON.stringify({sessionId:a});navigator.sendBeacon?(navigator.sendBeacon("/api/discord/clear",new Blob([te],{type:"application/json"})),navigator.sendBeacon("/api/discord/heartbeat",new Blob([JSON.stringify({sessionId:a,bye:!0})],{type:"application/json"}))):(fetch("/api/discord/clear",{method:"POST",headers:{"Content-Type":"application/json"},body:te,keepalive:!0}).catch(()=>{}),fetch("/api/discord/heartbeat",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:a,bye:!0}),keepalive:!0}).catch(()=>{}))},b=()=>r(),E=()=>{document.visibilityState==="hidden"&&r()};return window.addEventListener("pagehide",b),window.addEventListener("beforeunload",b),document.addEventListener("visibilitychange",E),()=>{window.removeEventListener("pagehide",b),window.removeEventListener("beforeunload",b),document.removeEventListener("visibilitychange",E),r()}},[]);const Me=q(a=>{ie(r=>{if(r.has(a))return r;const b=new Set(r);return b.add(a),b})},[]),at=q((a,r)=>{a&&a.complete&&a.naturalWidth>0&&Me(r)},[Me]);N(()=>{if(!h)return;const a=r=>{if(r.key==="Escape"){J?ne(!1):I(!1);return}!B||o.length<2||(r.key==="ArrowLeft"&&_(b=>Math.max(0,b-1)),r.key==="ArrowRight"&&_(b=>Math.min(o.length-1,b+1)))};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[h,B,o.length,J,I]);const nt=()=>{const a=C.current;a&&(a.paused?a.play().catch(()=>{}):a.pause())},rt=a=>{const r=C.current;if(!r||!d)return;const b=parseFloat(a.target.value);r.currentTime=b,u(b)},st=()=>{z(!0),i<g.length-1?T(i+1):G(!0)},lt=a=>{const r=a.currentTarget.currentTime;Q.current=r,u(r),W.current&&clearTimeout(W.current),W.current=setTimeout(()=>ye.current(),5e3)},ot=()=>{M(!1),ye.current()},it=a=>{const r=a.currentTarget.duration;de.current=Number.isFinite(r)?r:0,P(a.currentTarget.duration)},ct=q(()=>{const a=C.current;a&&H>0&&(a.currentTime=H,Q.current=H,a.play().catch(()=>{})),be(!1)},[H]),je=q(()=>{be(!1)},[]),dt=q(()=>{V&&ce.mutate({rjCode:V,title:s,thumbnail:o[0]||"",status:"Completed",isAdult:!!v,silent:!0}),G(!1),L(),fe("/")},[V,ce,s,o,v,L,fe]),ut=S.reduce((a,r,b)=>l>=r.time?b:a,-1),mt=a=>{const r=C.current;r&&(r.currentTime=a,u(a))},Fe=a=>{const r=C.current;if(!r)return;const b=Number.isFinite(r.currentTime)?r.currentTime:l,E=Math.max(0,Math.min(d||1/0,b+a));r.currentTime=E,u(E),$(!0)},Oe=d?Math.min(100,l/d*100):0,ht=d?Math.min(100,Math.max(Oe,p/d*100)):0,pt=e(F,{children:[e("div",{className:t.playerButtons,children:[e("button",{className:t.playerBtn,onClick:()=>T(Math.max(0,i-1)),disabled:i===0,"aria-label":"Previous track",children:e(y,{name:"step-backward"})}),e("button",{className:`${t.playerBtn} ${t.seekBtn}`,onClick:()=>Fe(-10),"aria-label":"Seek back 10 seconds",title:"Back 10s",children:[e(y,{name:"undo"}),e("span",{className:t.seekBtnLabel,children:"10"})]}),e("button",{className:`${t.playerBtn} ${t.playBtn}`,onClick:nt,"aria-label":w?"Pause":"Play",children:w?e(y,{name:"pause"}):e(y,{name:"play"})}),e("button",{className:`${t.playerBtn} ${t.seekBtn}`,onClick:()=>Fe(10),"aria-label":"Seek forward 10 seconds",title:"Forward 10s",children:[e(y,{name:"redo"}),e("span",{className:t.seekBtnLabel,children:"10"})]}),e("button",{className:t.playerBtn,onClick:()=>T(Math.min(g.length-1,i+1)),disabled:i>=g.length-1,"aria-label":"Next track",children:e(y,{name:"step-forward"})})]}),e("div",{className:t.seekRow,children:[e("span",{className:t.timeLabel,children:me(l)}),e("input",{className:t.seekBar,type:"range",min:0,max:d||0,step:.1,value:Math.min(l,d||0),onChange:rt,style:{"--played-percent":`${Oe}%`,"--buffered-percent":`${ht}%`},"aria-label":"Seek"}),e("span",{className:t.timeLabel,children:me(d)})]})]}),He=e(F,{children:[e("button",{className:`${t.playerBtn} ${t.playerToggle}`,onClick:()=>I(!h),"aria-label":h?"Minimize player":"Expand player",title:h?"Minimize to browse":"Expand",children:h?e(y,{name:"chevron-down"}):e(y,{name:"chevron-up"})}),e("div",{className:t.playerInfo,children:[e("p",{className:t.playerTitle,title:s,children:k?k(s):s}),e("p",{className:t.playerTrack,children:[Z?.resolutionStr||"",g.length>1?` (${i+1}/${g.length})`:""]})]}),e("div",{className:t.playerControls,children:pt}),e("div",{className:t.playerRight,children:[O===0?e(y,{name:"volume-mute",className:t.volumeIcon}):O<.5?e(y,{name:"volume-down",className:t.volumeIcon}):e(y,{name:"volume-up",className:t.volumeIcon}),e("input",{className:t.volumeBar,type:"range",min:0,max:1,step:.01,value:O,onChange:a=>{const r=parseFloat(a.target.value);Ne(r),localStorage.setItem("asmrVolume",String(r))},style:{"--volume-percent":`${O*100}%`},"aria-label":"Volume"})]}),e("div",{className:t.playerActions,children:[h&&c&&e("button",{className:t.playerBtn,onClick:()=>Y(a=>!a),"aria-label":B?"Hide images":"Show images",title:B?"Hide images":"Show images",children:B?e(y,{name:"eye-slash"}):e(y,{name:"image"})}),h&&S.length>0&&e("button",{className:`${t.playerBtn} ${J?t.playerBtnActive:""}`,onClick:()=>ne(a=>!a),"aria-label":J?"Hide bookmarks":"Show bookmarks",title:"Timestamps",children:e(y,{name:"list-ol"})}),e("button",{className:t.playerBtn,onClick:L,"aria-label":"Close player",children:e(y,{name:"times"})})]})]}),Ue=e("audio",{ref:C,preload:"metadata",onPlay:()=>M(!0),onPause:ot,onTimeUpdate:lt,onLoadedMetadata:it,onProgress:a=>{const r=a.currentTarget;r.buffered.length>0&&U(r.buffered.end(r.buffered.length-1))},onEnded:st}),De=e(xe,{isOpen:Be,onClose:je,title:"Resume Listening",children:e("div",{style:{padding:"1rem",textAlign:"center"},children:[e("p",{children:["You were at ",e("strong",{children:me(H)}),Z?.resolutionStr?` in ${Z.resolutionStr}`:""]}),e("div",{style:{marginTop:"1rem",display:"flex",gap:"10px",justifyContent:"center"},children:[e(he,{variant:"secondary",onClick:je,children:"Start from Beginning"}),e(he,{onClick:ct,children:"Resume"})]})]})}),We=e(xe,{isOpen:Pe,onClose:()=>G(!1),title:"Finished!",children:e("div",{style:{padding:"1rem",textAlign:"center"},children:[e(y,{name:"check-circle",size:48,style:{color:"var(--accent-lighter)",marginBottom:"0.5rem"}}),e("p",{style:{fontSize:"1.1rem",fontWeight:600},children:k?k(s):s}),e("p",{style:{color:"var(--text-secondary)"},children:"You finished this work!"}),e("div",{style:{marginTop:"1rem",display:"flex",gap:"10px",justifyContent:"center"},children:[e(he,{variant:"secondary",onClick:()=>G(!1),children:"Close"}),e(he,{onClick:dt,children:"Mark Completed & Back to Home"})]})]})});if(!h)return Ve(e(F,{children:[Ue,e("div",{className:t.playerBar,children:He}),De,We]}),document.body);const ke=Math.min(D,Math.max(0,o.length-1)),qe=o[ke],gt=B&&c&&!!qe&&!ae.has(qe);return Ve(e(F,{children:[Ue,De,We,e("div",{className:`${t.npOverlay} ${pe?"":t.npOverlayControlsHidden}`,children:[e("div",{className:`${t.npStage} ${!B||!c?t.npStageBlank:""}`,onClick:()=>$(a=>!a),children:B&&c&&e(F,{children:[e("div",{className:t.sliderViewport,children:[e("div",{className:t.sliderTrack,style:{transform:`translateX(-${ke*100}%)`},children:o.map(a=>e("div",{className:t.slide,children:e("img",{ref:r=>at(r,a),src:a,alt:`${k?k(s):s} — work image`,loading:"lazy",decoding:"async",draggable:!1,onLoad:()=>Me(a),onError:()=>Me(a),className:`${t.slideImg} ${ae.has(a)?t.slideImgLoaded:""}`})},a))}),gt&&e("span",{className:t.slideSpinner,"aria-label":"Loading image"})]}),o.length>1&&e(F,{children:[e("button",{className:`${t.npArrow} ${t.npArrowLeft}`,onClick:a=>{a.stopPropagation(),_(r=>Math.max(0,r-1)),$(!0)},disabled:ke===0,"aria-label":"Previous image",children:e(y,{name:"chevron-left"})}),e("button",{className:`${t.npArrow} ${t.npArrowRight}`,onClick:a=>{a.stopPropagation(),_(r=>Math.min(o.length-1,r+1)),$(!0)},disabled:ke===o.length-1,"aria-label":"Next image",children:e(y,{name:"chevron-right"})}),e("span",{className:t.npImageCount,onClick:a=>a.stopPropagation(),children:[ke+1," / ",o.length]})]})]})}),e("div",{className:`${t.playerBar} ${t.playerBarDocked} ${pe?"":t.playerBarDockedHidden}`,onClick:a=>a.stopPropagation(),children:[He,J&&e(F,{children:[e("div",{className:t.npBackdrop,onClick:()=>ne(!1)}),e("div",{className:t.chapterPanel,children:S.map((a,r)=>e("button",{className:`${t.chapterRow} ${r===ut?t.chapterRowActive:""}`,title:k?k(a.label):a.label,onClick:()=>{mt(a.time),ne(!1)},children:[e("span",{className:t.chapterRowTime,children:me(a.time)}),e("span",{className:t.chapterRowLabel,title:k?k(a.label):a.label,children:k?k(a.label):a.label})]},`${a.time}-${r}`))})]})]})]})]}),document.body)},Rt="https://github.com/serifpersia/dango/releases/latest/download/dango-extension.zip",It=s=>{try{return JSON.parse(s.detail)}catch{return null}},$t=({isOpen:s,onClose:o,onSuccess:S})=>{const[g,i]=m(1),[h,v]=m(typeof navigator<"u"?navigator.userAgent:""),[A,k]=m(""),[T,I]=m(!1),[L,C]=m(!1),f=j(null),w=typeof navigator<"u"?navigator.userAgent:"",M=/android/i.test(w),l=/firefox|fxios/i.test(w)&&!M,u=!l&&!M&&/chrome|chromium|edg|brave/i.test(w),d=l||u;N(()=>{s&&(i(1),v(typeof navigator<"u"?navigator.userAgent:""),k(""),I(!1),C(!1))},[s]),N(()=>()=>{f.current&&(window.removeEventListener("dango:jasmr-cookie",f.current),f.current=null)},[]);const P=async()=>{localStorage.setItem("jasmr_ua",h),window.open("https://japaneseasmr.com","_blank","noopener,noreferrer"),i(2)},p=()=>{if(L)return;C(!0);const B=window.setTimeout(()=>{C(!1),f.current&&(window.removeEventListener("dango:jasmr-cookie",f.current),f.current=null),oe.error("Helper not detected — install it via about:debugging first.")},3e3),Y=D=>{window.clearTimeout(B),window.removeEventListener("dango:jasmr-cookie",Y),f.current=null,C(!1);const _=It(D);if(_?.ok&&_.cookie)k(_.cookie),oe.success("Cookie extracted from helper!");else if(_?.error==="NO_COOKIE"){const ae=_.debug?.stores?.length??0,ie=_.debug?.names??[];oe.error(`Helper found no cf_clearance (checked ${ae} stores, saw: ${ie.join(", ")||"none"}) — solve the challenge on the JapaneseASMR tab first.`)}else oe.error("Helper request failed — try again.")};f.current=Y,window.addEventListener("dango:jasmr-cookie",Y),window.dispatchEvent(new CustomEvent("dango:get-jasmr-cookie"))},U=async()=>{if(!A.trim()){oe.error("Please enter the cf_clearance cookie");return}I(!0);try{localStorage.setItem("jasmr_cookie",A.trim()),oe.success("Cookie updated successfully!"),S?.(),o()}catch{oe.error("Failed to save cookie")}finally{I(!1)}};return e(xe,{isOpen:s,onClose:o,title:"JapaneseASMR Verification Required",children:e("div",{className:R.container,children:g===1?e(F,{children:[e("p",{children:["JapaneseASMR is protected by a Cloudflare challenge. Solve it once in your browser and paste the ",e("strong",{children:"cf_clearance"})," cookie so the app can load the site for you."]}),e("div",{className:R.field,children:[e("label",{children:"Your User-Agent (must match the browser you solve the challenge with):"}),e("textarea",{value:h,onChange:B=>v(B.target.value),rows:3,className:R.textarea})]}),e("div",{className:R.actions,children:[e("button",{className:R.secondaryButton,onClick:o,children:"Cancel"}),e("button",{className:R.button,onClick:P,children:"Start Verification (Opens JapaneseASMR)"})]})]}):e(F,{children:[e("p",{children:["1. Solve the challenge on the ",e("strong",{children:"JapaneseASMR tab"})," (keep that tab open).",e("br",{}),"2. Copy the ",e("strong",{children:"cf_clearance"})," cookie value using one of these:",e("br",{}),e("br",{}),e("strong",{children:"Chrome / Edge — DevTools:"})," press ",e("code",{children:"F12"})," →"," ",e("strong",{children:"Application"})," → ",e("strong",{children:"Cookies"})," →"," ",e("code",{children:"https://japaneseasmr.com"}),". Find ",e("strong",{children:"cf_clearance"}),", double-click its ",e("strong",{children:"Value"})," to select it, then copy.",e("br",{}),e("br",{}),e("strong",{children:"Firefox — Storage Inspector:"})," press ",e("code",{children:"F12"})," →"," ",e("strong",{children:"Storage"})," → ",e("strong",{children:"Cookies"})," →"," ",e("code",{children:"https://japaneseasmr.com"}),". Find ",e("strong",{children:"cf_clearance"}),", right-click the value → ",e("strong",{children:"Copy Value"}),".",e("br",{}),e("br",{}),e("strong",{children:"Either browser — extension:"})," open"," ",e("strong",{children:"Cookie Manager"})," while on the JapaneseASMR tab, find"," ",e("strong",{children:"cf_clearance"}),", and copy its value (or use the extension's export).",e("br",{}),e("br",{}),"3. Paste it below. Copy ",e("strong",{children:"only the value"})," — remove any"," ",e("code",{children:"cf_clearance="})," prefix or quotes if they were included."]}),d&&e("div",{className:R.hint,children:[e("strong",{children:"Dango helper (one-time setup):"})," ",l?e(F,{children:["type ",e("code",{children:"about:debugging"})," in the address bar →"," ",e("strong",{children:"This Firefox"})," → ",e("strong",{children:"Load Temporary Add-on"})," ","→ open the ",e("code",{children:"dango-extension/firefox"})," folder and pick"," ",e("code",{children:"manifest.json"}),". (Temporary helpers unload when Firefox closes — repeat after a restart.)"]}):e(F,{children:["type ",e("code",{children:"chrome://extensions"})," in the address bar → enable"," ",e("strong",{children:"Developer mode"})," → ",e("strong",{children:"Load unpacked"})," → open the ",e("code",{children:"dango-extension/chrome"})," folder. (Unpacked helpers show a developer-mode notice — expected.)"]})," ","Use this link to download the extension and extract it:"," ",e("a",{href:Rt,target:"_blank",rel:"noreferrer",className:R.link,children:"dango-extension.zip"}),". Then click Extract below and the field fills itself.",e("div",{className:R.actions,children:e("button",{className:R.button,onClick:p,disabled:L,type:"button",children:L?"Extracting…":"Extract cookie from helper"})})]}),e("div",{className:R.field,children:[e("label",{children:"cf_clearance cookie value:"}),e("input",{type:"text",value:A,onChange:B=>k(B.target.value),placeholder:"e.g. xxxxxxxx.xxxxxxxx.xxxxxxx-xxxxxxx",className:R.input})]}),e("div",{className:R.actions,children:[e("button",{className:R.secondaryButton,onClick:o,children:"Cancel"}),e("button",{className:R.secondaryButton,onClick:()=>i(1),children:"Back"}),e("button",{className:R.button,onClick:U,disabled:T,children:T?"Saving...":"Submit"})]})]})})})},tt="asmrTranslateCache",Et=10080*60*1e3;function _t(){try{const s=localStorage.getItem(tt);if(!s)return new Map;const o=JSON.parse(s);return new Map(Object.entries(o))}catch{return new Map}}function jt(s){try{const o={};for(const[S,g]of s)o[S]=g;localStorage.setItem(tt,JSON.stringify(o))}catch{}}function Ke(s){return/[\u3040-\u309F\u30A0-\u30FF\u4E00-\u9FAF]/.test(s)}async function Ft(s){const o=s.map(i=>i.trim()).filter(Boolean);if(o.length===0)return new Map;const S=await Ee.settings.translate.mutate({texts:o,source:"ja",target:"en"}),g=new Map;for(const[i,h]of Object.entries(S.translations||{}))g.set(i,h);for(const i of o)g.has(i)||g.set(i,i);return g}function Ot(s,o){const[S,g]=m(new Map),[i,h]=m(!1),v=j(null),A=s.join("");return N(()=>{const T=A?A.split(""):[];if(!o||T.length===0){g(new Map),h(!1);return}const I=Array.from(new Set(T.map(l=>l.trim()).filter(Boolean).filter(Ke)));if(I.length===0){g(new Map);return}v.current||(v.current=_t());const L=Date.now(),C=new Map,f=[];for(const l of I){const u=v.current.get(l);u&&L-u.ts<Et?C.set(l,u.t):f.push(l)}if(f.length===0){g(C);return}let w=!1;h(!0);const M=[];for(let l=0;l<f.length;l+=15)M.push(f.slice(l,l+15));return(async()=>{const l=new Map;for(const d of M){try{const P=await Ft(d);for(const[p,U]of P)l.set(p,U)}catch{}await new Promise(P=>setTimeout(P,120))}if(w)return;if(v.current){for(const[d,P]of l)v.current.set(d,{t:P,ts:Date.now()});jt(v.current)}const u=new Map([...C,...l]);g(u),h(!1)})(),()=>{w=!0}},[o,A]),{t:T=>!o||!T||!Ke(T)?T:S.get(T.trim())||T,map:S,isTranslating:i}}const Ht=[{label:"Date",options:[{value:"latest",label:"Latest"},{value:"oldest",label:"Oldest"}]},{label:"Title",options:[{value:"title_asc",label:"A → Z"},{value:"title_desc",label:"Z → A"}]},{label:"Popular (Views)",options:[{value:"popular_recent",label:"Recent"},{value:"popular_week",label:"Week"},{value:"popular_month",label:"Month"},{value:"popular_6_months",label:"6 Months"},{value:"popular_year",label:"Year"},{value:"popular",label:"All Time"}]},{label:"Most Commented",options:[{value:"comments_week",label:"Week"},{value:"comments_month",label:"Month"},{value:"comments_year",label:"Year"},{value:"comments",label:"All Time"}]},{label:"Other",options:[{value:"random",label:"Random"}]}],Ut=[{value:"",label:"All"},{value:"sfw",label:"SFW / 全年齢"},{value:"r-15",label:"R-15"},{value:"r-18",label:"NSFW / R18"},{value:"yuri",label:"Yuri / Girls love / 百合"},{value:"otokonoko",label:"Otoko no ko / 男の娘"},{value:"futanari",label:"Futanari / フタナリ"},{value:"r-18g",label:"R-18G / グロ"}],Dt=[{value:"sfw",label:"SFW / 全年齢"}],Ie="agreedToViewMature",ea=()=>{const{rj:s}=bt(),o=Ge(),[S,g]=vt(),[i,h]=m(()=>localStorage.getItem(Ie)==="true"),[v,A]=m(!1),[k,T]=m(()=>S.get("q")||""),[I,L]=m(()=>S.get("q")||""),[C,f]=m("latest"),[w,M]=m("sfw"),[l,u]=m(1),[d,P]=m(null),[p,U]=m(null),[B,Y]=m(!0),[D,_]=m(()=>localStorage.getItem("asmrTranslateEN")==="true"),[ae,ie]=m(!1),J=yt(),{toggle:ne,bookmarkedIds:pe}=Xe(),{popup:$,openPopup:re,scheduleClose:O,cancelClose:Ne,closePopup:ge}=Mt();N(()=>kt("jasmr",()=>ie(!0)),[]),N(()=>{localStorage.setItem("asmrTranslateEN",String(D))},[D]),N(()=>{const n=()=>h(localStorage.getItem(Ie)==="true");return window.addEventListener("focus",n),window.addEventListener("storage",n),()=>{window.removeEventListener("focus",n),window.removeEventListener("storage",n)}},[]);const fe=i,V=fe?w:"sfw",Ce=fe?Ut:Dt,{data:ce,isLoading:Se,isError:Be,isFetching:be}=At(I,l,C,V),H=$e.useMemo(()=>ce?.shows??[],[ce?.shows]),Le=ce?.hasNext??!1;N(()=>{if(!s){d&&!p&&P(null);return}const n=s.toUpperCase();if(p&&(p.work.id?.toUpperCase()===n||p.work._id?.toUpperCase()===n)){d&&P(null);return}const c=H.find(x=>(x.id||x._id)?.toUpperCase()===n);c?(!d||(d.id||d._id)!==(c.id||c._id))&&P(c):(!d||(d.id||d._id)?.toUpperCase()!==n)&&P({_id:n,id:n,name:n})},[s,H,p,d]);const Pe=q(()=>{o("/asmr")},[o]);N(()=>{!s&&p&&U(null)},[s,p]);const{data:G}=Qe(p&&p.work.id||null),ve=p?[p.work.thumbnail,...G?.images||[]].filter(Boolean):[],W=[...H.map(n=>n.name),d?.name||"",p?.work.name||"",...G?.chapters?.map(n=>n.label)||[]].filter(Boolean),{t:K}=Ot(W,D);N(()=>{const n=p?p.work.name:d?d.name:s?s.toUpperCase():"",c=n?D?K(n):n:"",x=c?`${c} - dango`:"dango";document.title=x;try{window.history.replaceState(window.history.state,x,window.location.href)}catch{}},[d,p,s,D,K]);const Q=n=>{n.preventDefault(),L(k),u(1);const c=new URLSearchParams(S);k.trim()?c.set("q",k.trim()):c.delete("q"),c.delete("page"),g(c,{replace:!0})};N(()=>{const n=S.get("q")||"";T(c=>c===n?c:n),L(c=>c===n?c:n),u(1)},[S]);const de=n=>{n.target.checked&&!i&&A(!0)},Z=()=>{localStorage.setItem(Ie,"true"),h(!0),A(!1),u(1)},X=()=>{A(!1)},Te=q((n,c,x)=>{P(null),Y(!0),U({work:n,tracks:c,index:x})},[]);return e("div",{className:`${t.page} ${p?t.pageWithPlayer:""}`,children:[!(p&&B)&&e(F,{children:[e("header",{className:t.header,children:[e("h1",{className:t.pageTitle,children:[e(y,{name:"headphones"})," ASMR"]}),e("form",{className:t.searchForm,onSubmit:Q,children:[e("input",{className:t.searchInput,type:"text",value:k,onChange:n=>T(n.target.value),placeholder:"Search works, circles, CV… (-word excludes)","aria-label":"Search ASMR works"}),e("button",{className:t.searchBtn,type:"submit","aria-label":"Search",children:e(y,{name:"search"})})]})]}),e("div",{className:t.filterBar,children:[e("label",{className:t.filterLabel,htmlFor:"asmr-sort",children:"Sort"}),e("select",{id:"asmr-sort",className:t.sortSelect,value:C,onChange:n=>{f(n.target.value),u(1)},children:Ht.map(n=>e("optgroup",{label:n.label,children:n.options.map(c=>e("option",{value:c.value,children:c.label},c.value))},n.label))}),e("label",{className:t.filterLabel,htmlFor:"asmr-rating",children:"Type"}),e("select",{id:"asmr-rating",className:t.sortSelect,value:w,onChange:n=>{M(n.target.value),u(1)},children:Ce.map(n=>e("option",{value:n.value,children:n.label},n.value))}),e("div",{className:t.filterTogglesGroup,children:[e("div",{className:t.translateToggleWrap,children:[e("span",{className:t.filterLabel,children:"JP"}),e(ze,{id:"asmr-translate-toggle",isChecked:D,onChange:n=>_(n.target.checked)}),e("span",{className:t.filterLabel,children:"EN"})]}),!i&&e("div",{className:t.matureToggleWrap,children:[e("label",{className:t.matureLabel,htmlFor:"asmr-mature-toggle",children:"Mature"}),e(ze,{id:"asmr-mature-toggle",isChecked:!1,onChange:de})]})]})]}),Be?e("p",{className:t.statusMsg,children:"Failed to load works. Please try again."}):Se&&H.length===0?e("div",{className:t.grid,"aria-hidden":!0,children:Array.from({length:12}).map((n,c)=>e("div",{className:t.skeletonCard,children:[e("div",{className:`${t.skeletonThumb} ${t.shimmer}`}),e("div",{className:`${t.skeletonLine} ${t.shimmer}`,style:{width:"88%"}}),e("div",{className:`${t.skeletonLine} ${t.shimmer}`,style:{width:"55%"}})]},c))}):H.length===0?e("p",{className:t.statusMsg,children:"No works found."}):e(F,{children:[e("div",{className:`${t.grid} ${be?t.fetching:""}`,children:H.map(n=>{const c=D?{...n,name:K(n.name)}:n,x=Ze(n),se=Ye(x),ee=pe.has(se),le=`/asmr/${encodeURIComponent(x)}`;return e("div",{className:t.asmrCardWrap,children:[e(wt,{item:{id:se,title:c.name,thumbnail:n.thumbnail||"",typeBadge:x||void 0,isAdult:Re(n)},linkTo:le,hoverIcon:"info",layout:"horizontal",showInfoButton:!0,display:{elements:{poster:{typeBadge:!0,chapterBadge:!1,adultBadge:!0},info:{title:!0,mobileBadges:!0,progress:!1,meta:!1}}},onOpenDetails:z=>re(z,{rjCode:x,title:c.name,thumbnail:n.thumbnail||"",isAdult:Re(n),rating:n.rating,listenTarget:le}),onPopupHoverIntent:z=>z?Ne():O(),rawThumbnail:!0}),e("button",{className:`${t.bookmarkBtn} ${ee?t.bookmarked:""}`,onClick:z=>{z.preventDefault(),z.stopPropagation(),ne({rjCode:x,title:n.name,thumbnail:n.thumbnail||"",isAdult:Re(n)})},title:ee?"Remove from listening list":"Add to listening list","aria-label":ee?"Remove from listening list":"Add to listening list","aria-pressed":ee,children:e(y,{name:ee?"check":"plus",size:12})})]},n._id||n.id)})}),e("nav",{className:t.pagination,children:[e("button",{className:t.pageBtn,disabled:l<=1,onClick:()=>u(n=>Math.max(1,n-1)),children:"Previous"}),e("span",{className:t.pageIndicator,children:["Page ",l]}),e("button",{className:t.pageBtn,disabled:!Le,onClick:()=>u(n=>n+1),children:"Next"})]})]})]}),d&&e(Lt,{work:d,onClose:Pe,onPlay:Te,t:K}),$&&e(xt,{data:$.data,anchorRect:$.rect,bookmarked:pe.has(Ye($.data.rjCode)),onToggleBookmark:()=>ne({rjCode:$.data.rjCode,title:$.data.title,thumbnail:$.data.thumbnail||"",isAdult:$.data.isAdult}),onMouseEnter:Ne,onMouseLeave:O,onRequestClose:ge}),ae&&e($t,{isOpen:ae,onClose:()=>ie(!1),onSuccess:()=>{J.invalidateQueries({queryKey:["asmrBrowse"]}),J.invalidateQueries({queryKey:["asmrWork"]})}}),v&&e(xe,{isOpen:v,title:"Content Warning",onClose:X,children:e("div",{style:{padding:"var(--space-4)",textAlign:"center"},children:[e("p",{children:"This section contains mature content intended for adult audiences."}),e("p",{children:["By proceeding, you confirm that you are ",e("strong",{children:"18 years of age or older"})," (or the age of majority in your jurisdiction) and wish to view this content."]}),e("p",{style:{fontSize:"var(--font-size-xs)",color:"var(--text-secondary)",marginTop:"var(--space-4)"},children:["You can reset this preference at any time in the ",e("strong",{children:"Settings"})," page."]}),e("div",{style:{marginTop:"var(--space-4)",display:"flex",gap:"var(--space-2-5)",justifyContent:"center"},children:[e(he,{variant:"secondary",onClick:X,children:"Go Back"}),e(he,{onClick:Z,children:"I'm 18+, Continue"})]})]})}),p&&e(Pt,{title:p.work.name,images:ve,chapters:G?.chapters||[],tracks:p.tracks,trackIndex:p.index,expanded:B,isAdult:!!p.work.isAdult,rjCode:p.work.id||p.work._id,t:K,onTrackChange:n=>U(c=>c&&{...c,index:n}),onExpandedChange:Y,onClose:()=>{U(null),Y(!0),s&&o("/asmr")}})]})};export{ea as default};
@@ -0,0 +1 @@
1
+ import{d as a,u as i}from"./vendor-core-8R2fFbyN.js";import{R as l}from"./ResetProgressModal-CcStlbhP.js";import{s as f,n as R}from"./useAsmr-DIwIsJXF.js";const p=({workId:e,title:m,onClose:o})=>{const[r,s]=a(!1),t=f(),n=R();return i(l,{isOpen:!!e,itemName:m,progressKind:"listening",listLabel:"my listening list",alsoRemove:r,onAlsoRemoveChange:s,onClose:()=>{s(!1),o()},onConfirm:()=>{e&&(t.mutate({workId:e}),r&&n.mutate({id:e}),s(!1),o())}})};export{p as A};
@@ -0,0 +1,10 @@
1
+ import{u as t,A as y,d as S,h as P,q as I,T as ce,$ as Bt}from"./vendor-core-8R2fFbyN.js";import{I as K}from"./vendor-icons-CDMuNDeL.js";import{S as _e,g as Lt,e as Tt,B as se}from"./index-BXwhFWB_.js";import{u as Nt}from"./vendor-query-BUTye89G.js";import{f as we}from"./useProviders-B5Qr4I1y.js";const It="_controls_13898_1",Pt="_titleContainer_13898_9",Mt="_scheduleInfo_13898_15",$t="_status_13898_23",At="_nextEpisode_13898_35",Rt="_watchlistBtn_13898_45",Ft="_inList_13898_72",Dt="_queueBtn_13898_83",Ot="_queueActive_13898_95",qt="_modeToggleBtn_13898_101",Ht="_modeToggleActive_13898_108",zt="_nativeToggleBtn_13898_119",Wt="_nativeToggleActive_13898_132",Vt="_markWatchedBtn_13898_153",Ut="_markWatchedDone_13898_167",Kt="_completeSeriesBtn_13898_178",Gt="_providerAndEpisodeRow_13898_192",Jt="_episodeActions_13898_199",Qt="_desktopEpisodeActions_13898_206",Xt="_mobileEpisodeActions_13898_213",jt="_episodeNavBtn_13898_217",Yt="_primary_13898_247",Zt="_secondary_13898_257",en="_episodePickerBtn_13898_261",tn="_queueCountdown_13898_265",nn="_speedBoostBadge_13898_280",rn="_videoContainer_13898_311",on="_loadingOverlay_13898_324",sn="_loadingDots_13898_338",cn="_dot_13898_343",an="_bounce_13898_1",ln="_bufferingOverlay_13898_372",un="_bufferingSpinner_13898_381",dn="_spin_13898_920",pn="_videoIframe_13898_396",fn="_videoElementHidden_13898_419",mn="_upscalerCanvas_13898_424",_n="_upscalerActive_13898_437",hn="_upscalerStatusBadge_13898_441",gn="_subtitleOverlay_13898_456",vn="_controlsOverlay_13898_468",yn="_hidden_13898_498",bn="_centerPlayPause_13898_504",wn="_bottomControls_13898_536",Sn="_progressBarContainer_13898_553",Cn="_progressBar_13898_553",kn="_scrubbing_13898_576",xn="_watchedBar_13898_581",En="_bufferedBar_13898_582",Bn="_thumb_13898_604",Ln="_timeBubble_13898_625",Tn="_skipSegment_13898_647",Nn="_op_13898_661",In="_ed_13898_665",Pn="_recap_13898_669",Mn="_bottomControlsRow_13898_673",$n="_controlBtn_13898_681",An="_timeDisplay_13898_705",Rn="_leftControls_13898_714",Fn="_rightControls_13898_715",Dn="_middleControls_13898_716",On="_skipControls_13898_722",qn="_skipBtn_13898_728",Hn="_volumeContainer_13898_752",zn="_volumeSlider_13898_759",Wn="_settingsMenu_13898_837",Vn="_slideUp_13898_1",Un="_qualityListInMenu_13898_876",Kn="_ccOptionsContainer_13898_877",Gn="_qualityItemInMenu_13898_885",Jn="_ccItem_13898_886",Qn="_active_13898_907",Xn="_sourceLoader_13898_914",jn="_spinner_13898_920",Yn="_skipBubble_13898_971",Zn="_skipIcon_13898_975",er="_skipText_13898_978",tr="_watchBtn_13898_990",nr="_errorOverlay_13898_1036",rr="_retryButton_13898_1046",or="_skipIndicatorContainer_13898_1073",sr="_leftSkip_13898_1073",ir="_rightSkip_13898_1076",cr="_sourceSelectionContainer_13898_1081",ar="_slideUpIn_13898_1",lr="_providerSelectContainer_13898_1096",ur="_providerSelect_13898_1096",dr="_sourceSelect_13898_1081",pr="_sourceButtons_13898_1152",fr="_sourceButton_13898_1152",mr="_detailsBox_13898_1184",_r="_detailsToggleBtn_13898_1197",hr="_detailsGridContainer_13898_1221",gr="_fadeIn_13898_1",vr="_detailItem_13898_1233",yr="_animeStatus_13898_1253",br="_genresList_13898_1266",wr="_genreTag_13898_1273",Sr="_loadingDetails_13898_1291",Cr="_descriptionSection_13898_1298",kr="_description_13898_1298",xr="_epJumpControls_13898_1334",Er="_epRangeButtons_13898_1345",Br="_metaTags_13898_1351",Lr="_epRangeBtn_13898_1358",Tr="_epJumpInputGroup_13898_1373",Nr="_fullscreenActive_13898_1405",Ir="_skipRipple_13898_1",Pr="_errorSubtext_13898_1511",fs={controls:It,titleContainer:Pt,scheduleInfo:Mt,status:$t,nextEpisode:At,watchlistBtn:Rt,inList:Ft,queueBtn:Dt,queueActive:Ot,modeToggleBtn:qt,modeToggleActive:Ht,nativeToggleBtn:zt,nativeToggleActive:Wt,markWatchedBtn:Vt,markWatchedDone:Ut,completeSeriesBtn:Kt,providerAndEpisodeRow:Gt,episodeActions:Jt,desktopEpisodeActions:Qt,mobileEpisodeActions:Xt,episodeNavBtn:jt,primary:Yt,secondary:Zt,episodePickerBtn:en,queueCountdown:tn,speedBoostBadge:nn,videoContainer:rn,loadingOverlay:on,loadingDots:sn,dot:cn,bounce:an,bufferingOverlay:ln,bufferingSpinner:un,spin:dn,videoIframe:pn,videoElementHidden:fn,upscalerCanvas:mn,upscalerActive:_n,upscalerStatusBadge:hn,subtitleOverlay:gn,controlsOverlay:vn,hidden:yn,centerPlayPause:bn,bottomControls:wn,progressBarContainer:Sn,progressBar:Cn,scrubbing:kn,watchedBar:xn,bufferedBar:En,thumb:Bn,timeBubble:Ln,skipSegment:Tn,op:Nn,ed:In,recap:Pn,bottomControlsRow:Mn,controlBtn:$n,timeDisplay:An,leftControls:Rn,rightControls:Fn,middleControls:Dn,skipControls:On,skipBtn:qn,volumeContainer:Hn,volumeSlider:zn,settingsMenu:Wn,slideUp:Vn,qualityListInMenu:Un,ccOptionsContainer:Kn,qualityItemInMenu:Gn,ccItem:Jn,active:Qn,sourceLoader:Xn,spinner:jn,skipBubble:Yn,skipIcon:Zn,skipText:er,watchBtn:tr,errorOverlay:nr,retryButton:rr,skipIndicatorContainer:or,leftSkip:sr,rightSkip:ir,sourceSelectionContainer:cr,slideUpIn:ar,providerSelectContainer:lr,providerSelect:ur,sourceSelect:dr,sourceButtons:pr,sourceButton:fr,detailsBox:mr,detailsToggleBtn:_r,detailsGridContainer:hr,fadeIn:gr,detailItem:vr,animeStatus:yr,genresList:br,genreTag:wr,loadingDetails:Sr,descriptionSection:Cr,description:kr,epJumpControls:xr,epRangeButtons:Er,metaTags:Br,epRangeBtn:Lr,epJumpInputGroup:Tr,fullscreenActive:Nr,skipRipple:Ir,errorSubtext:Pr},Mr="_playerPageLayout_xfhzl_1",$r="_episodeSidebar_xfhzl_15",Ar="_playerMain_xfhzl_28",Rr="_videoPlayerWrapper_xfhzl_36",Fr="_playerInfoHeader_xfhzl_52",Dr="_playerAnimeCard_xfhzl_58",Or="_playerInfoContainer_xfhzl_70",qr="_videoTitleSection_xfhzl_94",Hr="_theaterMode_xfhzl_276",ms={playerPageLayout:Mr,episodeSidebar:$r,playerMain:Ar,videoPlayerWrapper:Rr,playerInfoHeader:Fr,playerAnimeCard:Dr,playerInfoContainer:Or,videoTitleSection:qr,theaterMode:Hr},zr="_shell_41rxp_1",Wr="_stage_41rxp_37",Vr="_shellFill_41rxp_85",Ur="_shellFullscreen_41rxp_93",Kr="_uiLayer_41rxp_107",Gr="_volumeWrap_41rxp_118",Jr="_volumeSlider_41rxp_124",Z={shell:zr,stage:Wr,shellFill:Vr,shellFullscreen:Ur,uiLayer:Kr,volumeWrap:Gr,volumeSlider:Jr},Qr=.8,Xr=5,_s=2e3,Ve="autoplayEnabled",jr=(e,n)=>n>0&&e>=n*Qr,hs=(e,n)=>e>Xr&&!jr(e,n),gs=()=>{try{return localStorage.getItem(Ve)==="true"}catch{return!1}},vs=e=>{try{localStorage.setItem(Ve,String(e))}catch{}},ys=e=>e.seekInduced?"none":e.autoplayEnabled&&e.hasNext?"advance":e.hasNext?"prompt-next":e.isFinal?"prompt-complete":"none",Yr=e=>(e.language??e.lang??"").toLowerCase(),Zr=e=>(e.label??"").toLowerCase(),eo=e=>`${e.language??e.lang??""}|||${e.label??""}`,to=e=>Yr(e).startsWith("en")||Zr(e).includes("english");function bs(e,n){if(e.length===0||n?.enabled===!1)return-1;const r=n?.lastKey??null;if(r){const o=e.findIndex(l=>eo(l)===r);if(o>=0)return o}const s=e.findIndex(to);return s>=0?s:0}const J={fontSize:1.8,position:0,bgOpacity:.5,bgColor:"#000000",textColor:"#ffffff",edge:"shadow",bold:!1},xe=(e,n,r)=>Math.max(n,Math.min(r,e)),Ee=e=>typeof e=="string"&&/^#[0-9a-fA-F]{6}$/.test(e),Se=(e,n,r,s)=>{try{const o=localStorage.getItem(e);if(o===null)return n;const l=parseFloat(o);return Number.isFinite(l)?xe(l,r,s):n}catch{return n}};function no(){let e=J.edge,n=J.bgColor,r=J.textColor,s=J.bold;try{const o=localStorage.getItem("subtitleEdge");(o==="shadow"||o==="outline"||o==="none")&&(e=o);const l=localStorage.getItem("subtitleBgColor");Ee(l)&&(n=l);const m=localStorage.getItem("subtitleTextColor");Ee(m)&&(r=m);const b=localStorage.getItem("subtitleBold");b!==null&&(s=b==="true")}catch{}return{fontSize:Se("subtitleFontSize",J.fontSize,.5,10),position:Se("subtitlePosition",J.position,0,100),bgOpacity:Se("subtitleBgOpacity",J.bgOpacity,0,1),bgColor:n,textColor:r,edge:e,bold:s}}function Ue(e,n){const r=`rgba(0, 0, 0, ${xe(n,0,1)})`;if(!Ee(e))return r;const s=parseInt(e.slice(1,3),16),o=parseInt(e.slice(3,5),16),l=parseInt(e.slice(5,7),16);return`rgba(${s}, ${o}, ${l}, ${xe(n,0,1)})`}function Ke(e,n){return e==="none"?n<=0?"0 1px 3px rgba(0, 0, 0, 0.9)":"none":e==="outline"?["-1px 0 0 black","1px 0 0 black","0 -1px 0 black","0 1px 0 black","-1px -1px 0 black","1px -1px 0 black","-1px 1px 0 black","1px 1px 0 black","0 0 6px rgba(0, 0, 0, 0.9)"].join(", "):"0 0 4px black, 0 1px 2px rgba(0, 0, 0, 0.8)"}function ws(e){return`
2
+ video::cue {
3
+ font-size: ${e.fontSize}rem !important;
4
+ color: ${e.textColor} !important;
5
+ background-color: ${Ue(e.bgColor,e.bgOpacity)} !important;
6
+ font-weight: ${e.bold?"bold":"normal"} !important;
7
+ text-shadow: ${Ke(e.edge,e.bgOpacity)} !important;
8
+ }
9
+ `}function Ss(e){return[`font-size: ${e.fontSize}rem`,`color: ${e.textColor}`,`background-color: ${Ue(e.bgColor,e.bgOpacity)}`,`font-weight: ${e.bold?"700":"400"}`,`text-shadow: ${Ke(e.edge,e.bgOpacity)}`,"padding: 0.2em 0.5em","border-radius: 0.25em","text-align: center","position: absolute","left: 50%","transform: translateX(-50%)","max-width: 92%","white-space: pre-wrap","overflow-wrap: break-word","line-height: 1.4"].join(`;
10
+ `)+";"}const ro=new Set(["b","i","u","strong","em"]);function Cs(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/&lt;(\/?)([a-zA-Z]+)&gt;/g,(r,s,o)=>ro.has(o.toLowerCase())?`<${s}${o.toLowerCase()}>`:r)}function ks(e){return e.replace(/<[^>]*>/g,"")}const xs=["#ffffff","#ffff00","#7CFC00","#00e5ff","#ff9ff3","#ffa502"],Es=["#000000","#1e272e","#2f3542","#3d0c02","#0c3d2e","#ffffff"];function Bs(e,n){const r=Number.isFinite(e)?e*16:J.fontSize*16;return!Number.isFinite(n)||n<=0?r/16:Math.min(r,Math.max(13,n*.07))/16}function Ls(e){const n=Math.abs(e/1e3).toFixed(1);return e>0?`+${n}s`:e<0?`-${n}s`:"0.0s"}function Ts(e,n){const r=e.clientWidth||0,s=e.clientHeight||0,o=e.videoWidth>0&&e.videoHeight>0?e.videoWidth/e.videoHeight:0;let l=s;o>0&&r>0&&s>0&&(l=r/s>o?s:r/o);const m=Math.max(0,(s-l)/2),b=Math.max(0,Math.min(100,Number(n)||0))/100*l;return m+b}const oo="_centerControls_61n7k_1",so="_centerSkipBtn_61n7k_15",io="_centerPlayPause_61n7k_40",co="_playIconOffset_61n7k_71",ie={centerControls:oo,centerSkipBtn:so,centerPlayPause:io,playIconOffset:co},Ns=({isPlaying:e,onTogglePlay:n,onSkipBack:r,onSkipForward:s,skipSeconds:o=10})=>t("div",{className:ie.centerControls,onClick:l=>l.stopPropagation(),children:[t("button",{className:ie.centerSkipBtn,onClick:r,title:`Skip back ${o}s`,"aria-label":`Skip back ${o} seconds`,children:t(K,{name:"replay-10"})}),t("button",{className:ie.centerPlayPause,"data-speed-boost-ignore":"true",onClick:n,"aria-label":e?"Pause":"Play",children:e?t(K,{name:"pause"}):t(K,{name:"play",className:ie.playIconOffset})}),t("button",{className:ie.centerSkipBtn,onClick:s,title:`Skip forward ${o}s`,"aria-label":`Skip forward ${o} seconds`,children:t(K,{name:"forward-10"})})]}),Is=({classes:e,videoRef:n,duration:r,formatTime:s,isScrubbing:o,buffered:l="auto",onSeek:m,onScrubStart:b,onScrubMove:i,onScrubEnd:_,timeLabelRef:d,children:T})=>{const h=y(null),L=y(null),p=y(null),f=y(null),[k,a]=S({time:0,position:null});P(()=>{const u=n.current;if(!u)return;const C=M=>{const g=M/r*100||0;L.current&&(L.current.style.width=`${g}%`),p.current&&(p.current.style.left=`${g}%`),d?.current&&(d.current.innerText=`${s(M)} / ${s(r)}`)},A=()=>{o||C(u.currentTime)},O=()=>{if(l==="auto"&&u.buffered.length>0){const g=u.buffered.end(u.buffered.length-1)/r*100||0;f.current&&(f.current.style.width=`${g}%`)}};return C(u.currentTime),O(),u.addEventListener("timeupdate",A),u.addEventListener("progress",O),()=>{u.removeEventListener("timeupdate",A),u.removeEventListener("progress",O)}},[n,r,o,l,s,d]),P(()=>{if(!o)return;const u=O=>{if(!h.current||!r)return;const M=h.current.getBoundingClientRect(),g=Math.min(1,Math.max(0,(O.clientX-M.left)/M.width));i(g),A(g)},C=()=>_();return document.addEventListener("mousemove",u),document.addEventListener("mouseup",C),()=>{document.removeEventListener("mousemove",u),document.removeEventListener("mouseup",C)};function A(O){const M=O*r,g=M/r*100||0;L.current&&(L.current.style.width=`${g}%`),p.current&&(p.current.style.left=`${g}%`),d?.current&&(d.current.innerText=`${s(M)} / ${s(r)}`);const F=h.current?.getBoundingClientRect();a({time:M,position:F?O*F.width:null})}},[o,r,i,_,s,d]);const v=u=>{if(!h.current)return 0;const C=h.current.getBoundingClientRect();return Math.min(1,Math.max(0,(u-C.left)/C.width))};return t("div",{className:`${e.container} ${o&&e.scrubbing?e.scrubbing:""}`,ref:h,onClick:u=>{!n.current||isNaN(r)||r===0||m(v(u.clientX))},onMouseMove:u=>{if(!r)return;const C=v(u.clientX);a({time:C*r,position:u.clientX-(h.current?.getBoundingClientRect().left??0)})},onMouseLeave:()=>{o||a({time:0,position:null})},children:[k.position!==null&&t("div",{className:e.timeBubble,style:{left:k.position},children:s(k.time)}),t("div",{className:e.bar,children:[t("div",{className:e.buffered,ref:f,style:l==="full"?{width:"100%"}:void 0}),t("div",{className:e.watched,ref:L}),t("div",{className:e.thumb,ref:p,onMouseDown:u=>{u.preventDefault(),n.current&&b()}}),T]})]})};function Ce(){try{if(typeof window>"u")return!1;const e=window.matchMedia?.("(pointer: coarse)").matches??!1,r=(navigator.maxTouchPoints??0)>0||"ontouchstart"in window;return e||r}catch{return!1}}function Ge(){const[e,n]=S(Ce);return P(()=>{n(Ce());let r=null;const s=()=>n(Ce());try{r=window.matchMedia("(pointer: coarse)"),r.addEventListener?r.addEventListener("change",s):r.addListener(s)}catch{}return window.addEventListener("touchstart",s,{passive:!0,once:!0}),()=>{try{r&&(r.removeEventListener?r.removeEventListener("change",s):r.removeListener(s))}catch{}window.removeEventListener("touchstart",s)}},[]),e}const We=280;function ao(e){return e?!!e.closest('button, input, select, textarea, a, [role="button"], [data-player-ui="true"]'):!1}const Ps=({player:e,topBar:n,centerControls:r,bottomBar:s,settingsPanel:o,overlays:l,isInteracting:m=!1,className:b,chromeDisabled:i=!1,children:_})=>{const{state:d,refs:T,actions:h}=e,L=T.playerContainerRef,f=Ge()?5e3:3e3,k=y(0),a=y(null),v=y(m);v.current=m;const u=I(()=>{const g=h.inactivityTimer.current;g&&(window.clearTimeout(g),h.inactivityTimer.current=null)},[h]),C=I(()=>{u(),d.isPlaying&&(v.current||d.useNativeControls||(h.inactivityTimer.current=window.setTimeout(()=>{if(v.current)return;h.setShowControls(!1);const g=L.current;g&&d.isFullscreen&&(g.style.cursor="none")},f)))},[h,u,L,f,d.isFullscreen,d.isPlaying,d.useNativeControls]),A=I(()=>{const g=L.current;g&&(g.style.cursor="default"),!d.showControls&&!d.useNativeControls&&h.setShowControls(!0),C()},[h,L,C,d.showControls,d.useNativeControls]);P(()=>{if(d.showControls){if(!d.isPlaying){u();return}if(m||d.isScrubbing||d.showSettings||d.showVolumeSlider){h.setShowControls(!0),u();return}C()}},[h,u,m,C,d.isPlaying,d.isScrubbing,d.showControls,d.showSettings,d.showVolumeSlider]),P(()=>()=>u(),[u]);const O=I(g=>{const F=g.target;if(ao(F))return;const U=Date.now(),Q=U-k.current<We;if(k.current=U,Q){a.current&&(window.clearTimeout(a.current),a.current=null),h.toggleFullscreen();return}a.current&&window.clearTimeout(a.current),a.current=window.setTimeout(()=>{a.current=null,h.setShowControls(!d.showControls),d.showControls?C():A()},We)},[h,C,d.showControls,A]);P(()=>()=>{a.current&&window.clearTimeout(a.current)},[]);const M=d.showControls||d.isScrubbing||d.showSettings||d.showVolumeSlider;return t("div",{ref:L,className:`${Z.shell} ${d.isFullscreen?Z.shellFullscreen:""} ${b??""}`,onContextMenu:g=>g.preventDefault(),onPointerMove:g=>{g.pointerType==="mouse"&&A()},onMouseLeave:()=>{window.matchMedia?.("(hover: hover) and (pointer: fine)").matches&&d.isPlaying&&!v.current&&h.setShowControls(!1)},children:[t("div",{className:Z.stage,onClick:O,onContextMenu:g=>g.preventDefault(),children:_}),l,!i&&!d.useNativeControls&&t("div",{className:Z.uiLayer,onContextMenu:g=>g.preventDefault(),children:[t("div",{"data-player-ui":"true",children:n}),M&&r&&t("div",{"data-player-ui":"true",children:r}),t("div",{"data-player-ui":"true",children:s}),o&&t("div",{"data-player-ui":"true",children:o})]})]})},lo=450,Ms=({muted:e,volume:n,volumeIcon:r,buttonClassName:s,sliderClassName:o,onToggleMute:l,onVolumeChange:m,onExpandedChange:b})=>{const i=Ge(),[_,d]=S(!1),T=y(null),h=y(!1),L=y(null),p=I(u=>{d(u),b?.(u)},[b]);P(()=>()=>{T.current&&window.clearTimeout(T.current)},[]),P(()=>{if(!_)return;const u=C=>{L.current&&!L.current.contains(C.target)&&p(!1)};return document.addEventListener("pointerdown",u),()=>document.removeEventListener("pointerdown",u)},[_,p]);const f=e?0:n,k=()=>{h.current=!1,T.current&&window.clearTimeout(T.current),T.current=window.setTimeout(()=>{h.current=!0,p(!0)},lo)},a=()=>{T.current&&(window.clearTimeout(T.current),T.current=null)},v=u=>{if(u.stopPropagation(),h.current){h.current=!1;return}if(i){_?l():p(!0);return}l()};return t("div",{ref:L,className:Z.volumeWrap,"data-expanded":_?"true":"false",onContextMenu:u=>u.preventDefault(),children:[t("button",{type:"button",className:s,onClick:v,onPointerDown:k,onPointerUp:a,onPointerLeave:a,onContextMenu:u=>u.preventDefault(),"aria-label":e?"Unmute":"Mute","aria-expanded":_,children:r}),t("input",{type:"range",min:"0",max:"1",step:"0.05",value:f,onChange:u=>m(parseFloat(u.target.value)),onClick:u=>u.stopPropagation(),onPointerDown:u=>u.stopPropagation(),onContextMenu:u=>u.preventDefault(),className:`${Z.volumeSlider} ${o??""}`,style:{"--volume-percent":`${f*100}%`},"aria-label":"Volume"})]})},uo="_statusArea_1xccu_1",po="_toggleBtn_1xccu_20",fo="_shortcuts_1xccu_46",mo="_shortcutGroup_1xccu_56",_o="_shortcut_1xccu_46",ho="_key_1xccu_70",go="_label_1xccu_91",B={statusArea:uo,toggleBtn:po,shortcuts:fo,shortcutGroup:mo,shortcut:_o,key:ho,label:go},$s=({showTheater:e=!0})=>{const[n,r]=S(!1);return t("div",{className:B.statusArea,children:[t("button",{type:"button",className:B.toggleBtn,onClick:()=>r(s=>!s),"aria-expanded":n,"aria-controls":"player-shortcuts",children:[t(K,{name:"keyboard",size:14}),t("span",{children:"Keyboard Shortcuts"}),n?t(K,{name:"chevron-up",size:12}):t(K,{name:"chevron-down",size:12})]}),n&&t("div",{id:"player-shortcuts",className:B.shortcuts,children:[t("div",{className:B.shortcutGroup,children:[t("div",{className:B.shortcut,children:[t("span",{className:B.key,children:"↑"}),t("span",{className:B.key,children:"↓"}),t("span",{className:B.label,children:"Volume"})]}),t("div",{className:B.shortcut,children:[t("span",{className:B.key,children:"←"}),t("span",{className:B.key,children:"→"}),t("span",{className:B.label,children:"Seek"})]})]}),t("div",{className:B.shortcutGroup,children:[t("div",{className:B.shortcut,children:[t("span",{className:B.key,children:"Space"}),t("span",{className:B.label,children:"Play/Pause"})]}),t("div",{className:B.shortcut,children:[t("span",{className:B.key,children:"F"}),t("span",{className:B.label,children:"Fullscreen"})]}),t("div",{className:B.shortcut,children:[t("span",{className:B.key,children:"M"}),t("span",{className:B.label,children:"Mute"})]}),e&&t("div",{className:B.shortcut,children:[t("span",{className:B.key,children:"T"}),t("span",{className:B.label,children:"Theater"})]}),t("div",{className:B.shortcut,children:[t("span",{className:B.key,children:"N"}),t("span",{className:B.label,children:"Next"})]})]})]})]})},vo="_episodeListContainer_9tyin_1",yo="_drawerContainer_9tyin_9",bo="_episodeListHeader_9tyin_14",wo="_drawerHeader_9tyin_20",So="_episodeListTitle_9tyin_29",Co="_rangeSelector_9tyin_41",ko="_rangeButton_9tyin_47",xo="_active_9tyin_70",Eo="_episodeList_9tyin_1",Bo="_drawerList_9tyin_89",Lo="_episodeItem_9tyin_118",To="_watched_9tyin_145",No="_episodeThumb_9tyin_167",Io="_episodeText_9tyin_176",Po="_episodeLabel_9tyin_184",Mo="_episodeSub_9tyin_189",N={episodeListContainer:vo,drawerContainer:yo,episodeListHeader:bo,drawerHeader:wo,episodeListTitle:So,rangeSelector:Co,rangeButton:ko,active:xo,episodeList:Eo,drawerList:Bo,episodeItem:Lo,watched:To,episodeThumb:No,episodeText:Io,episodeLabel:Po,episodeSub:Mo},$o=({episodes:e,currentEpisode:n,watchedEpisodes:r=[],onEpisodeClick:s,variant:o="sidebar",title:l="Episodes",header:m})=>{const[b,i]=S(0),_=y(null),d=ce(()=>e.map(p=>typeof p=="string"?{id:p,label:`Episode ${p}`}:p),[e]),T=ce(()=>new Set(r),[r]);P(()=>{const p=_.current;if(!p)return;let f=p.parentElement;for(;f;){const v=window.getComputedStyle(f);if((v.overflowY==="auto"||v.overflowY==="scroll")&&f.scrollHeight>f.clientHeight)break;f=f.parentElement}if(!f)return;const k=f.getBoundingClientRect(),a=p.getBoundingClientRect();f.scrollTop+=a.top+a.height/2-(k.top+f.clientHeight/2)},[n,b]);const h=ce(()=>{if(d.length<=100)return[];const p=[];for(let f=0;f<d.length;f+=100){const k=f+1,a=Math.min(f+100,d.length);p.push(`${k}-${a}`)}return p},[d]),L=ce(()=>{if(h.length===0)return d;const p=h[b];if(!p)return d;const[f,k]=p.split("-"),a=parseInt(f,10),v=parseInt(k,10);return d.slice(a-1,v)},[d,h,b]);return t("div",{className:`${N.episodeListContainer} ${o==="drawer"?N.drawerContainer:""}`,children:[t("div",{className:`${N.episodeListHeader} ${o==="drawer"?N.drawerHeader:""}`,children:[m,t("h3",{className:N.episodeListTitle,children:l}),h.length>0&&t("div",{className:N.rangeSelector,children:h.map((p,f)=>t("button",{className:`${N.rangeButton} ${b===f?N.active:""}`,onClick:()=>i(f),children:p},p))})]}),t("div",{className:`${N.episodeList} ${o==="drawer"?N.drawerList:""}`,children:L.map(p=>{const f=p.id===n,k=T.has(p.id)||p.watched===!0;return t("div",{ref:f?_:void 0,className:`${N.episodeItem} ${k?N.watched:""} ${f?N.active:""}`,onClick:()=>s(p.id),children:[p.thumbnail&&t("img",{src:p.thumbnail,alt:"",loading:"lazy",decoding:"async",className:N.episodeThumb}),t("span",{className:N.episodeText,children:[t("span",{className:N.episodeLabel,children:p.label??`Episode ${p.id}`}),p.sublabel&&t("span",{className:N.episodeSub,children:p.sublabel})]})]},p.id)})})]})},As=({variant:e="sidebar",count:n=12})=>t("div",{className:`${N.episodeListContainer} ${e==="drawer"?N.drawerContainer:""}`,children:[t("div",{className:`${N.episodeListHeader} ${e==="drawer"?N.drawerHeader:""}`,children:[t("h3",{className:N.episodeListTitle,children:"Episodes"}),t("div",{className:N.rangeSelector,children:[t(_e,{width:"60px",height:"28px",variant:"rectangular"}),t(_e,{width:"60px",height:"28px",variant:"rectangular"}),t(_e,{width:"60px",height:"28px",variant:"rectangular"})]})]}),t("div",{className:`${N.episodeList} ${e==="drawer"?N.drawerList:""}`,children:Array.from({length:n}).map((r,s)=>t("div",{className:N.episodeItem,style:{border:"none",background:"transparent"},children:t(_e,{width:"120px",height:"1.2rem",variant:"text"})},s))})]}),Ao="_shell_cys6s_1",Ro="_overlay_cys6s_10",Fo="_drawer_cys6s_21",Do="_handle_cys6s_56",Oo="_header_cys6s_64",qo="_headerCopy_cys6s_73",Ho="_kicker_cys6s_79",zo="_title_cys6s_87",Wo="_closeBtn_cys6s_94",Vo="_body_cys6s_116",V={shell:Ao,overlay:Ro,drawer:Fo,handle:Do,header:Oo,headerCopy:qo,kicker:Ho,title:zo,closeBtn:Wo,body:Vo};function Rs({isOpen:e,onClose:n,episodes:r,currentEpisode:s,watchedEpisodes:o=[],onEpisodeClick:l,title:m,header:b}){return P(()=>{if(!e)return;const i=d=>{d.key==="Escape"&&n()},_=document.body.style.overflow;return document.body.style.overflow="hidden",document.addEventListener("keydown",i),()=>{document.body.style.overflow=_,document.removeEventListener("keydown",i)}},[e,n]),e?Bt(t("div",{className:V.shell,role:"dialog","aria-modal":"true","aria-label":"Episode picker",children:[t("button",{className:V.overlay,type:"button",onClick:n,"aria-label":"Close episodes"}),t("aside",{className:V.drawer,children:[t("div",{className:V.handle}),t("div",{className:V.header,children:[t("div",{className:V.headerCopy,children:[t("span",{className:V.kicker,children:"Episode picker"}),t("h3",{className:V.title,children:"Choose an episode"})]}),t("button",{className:V.closeBtn,type:"button",onClick:n,"aria-label":"Close",children:t(K,{name:"times"})})]}),t("div",{className:V.body,children:t($o,{episodes:r,currentEpisode:s,watchedEpisodes:o,onEpisodeClick:l,variant:"drawer",title:m,header:b})})]})]}),document.body):null}function Le(){return document}function Je(e){const n=Le();if(document.fullscreenElement)return document.fullscreenElement;if(n.webkitFullscreenElement)return n.webkitFullscreenElement;const r=e;return r?.webkitDisplayingFullscreen?r:null}function ee(e){return Je(e)!==null}async function Uo(e,n){if(Je(n))return;const r=e;try{if(typeof e.requestFullscreen=="function"){await e.requestFullscreen();return}if(typeof r.webkitRequestFullscreen=="function"){await r.webkitRequestFullscreen();return}if(typeof r.webkitRequestFullScreen=="function"){await r.webkitRequestFullScreen();return}}catch{}const s=n;if(s&&typeof s.webkitEnterFullscreen=="function"){if(s.webkitSupportsFullscreen===!1)return;try{await s.webkitEnterFullscreen()}catch{}}}async function Ko(e){const n=Le();try{if(document.fullscreenElement&&typeof document.exitFullscreen=="function"){await document.exitFullscreen();return}if(n.webkitFullscreenElement&&typeof n.webkitExitFullscreen=="function"){await n.webkitExitFullscreen();return}}catch{}const r=e;if(r?.webkitDisplayingFullscreen&&typeof r.webkitExitFullscreen=="function"){try{r.webkitExitFullscreen()}catch{}return}try{typeof n.webkitCancelFullScreen=="function"?n.webkitCancelFullScreen():!document.fullscreenElement&&typeof document.exitFullscreen=="function"&&(document.fullscreenElement??n.webkitFullscreenElement)&&await document.exitFullscreen()}catch{}}async function Go(e,n){!e&&!n||(ee(n)?await Ko(n):e&&await Uo(e,n))}function Jo(e,n){const r=()=>{try{n(ee(e()))}catch{}},s=Le(),o=r;s.addEventListener("fullscreenchange",r),s.addEventListener("webkitfullscreenchange",o),s.addEventListener("webkitbeginfullscreen",o,!0),s.addEventListener("webkitendfullscreen",o,!0);const l=e();return l?.addEventListener("webkitbeginfullscreen",o),l?.addEventListener("webkitendfullscreen",o),()=>{s.removeEventListener("fullscreenchange",r),s.removeEventListener("webkitfullscreenchange",o),s.removeEventListener("webkitbeginfullscreen",o,!0),s.removeEventListener("webkitendfullscreen",o,!0),l?.removeEventListener("webkitbeginfullscreen",o),l?.removeEventListener("webkitendfullscreen",o)}}const Fs=({skipIntervals:e,showId:n,episodeNumber:r,episodeCount:s,sourceType:o,showMeta:l})=>{const m=Nt(),b=Lt(),i=y(null),_=y(null),d=y(null),T=y(null),h=y(!1),L=y(null),p=y(0),f=y(1),k=y({mouse:!1,keyboard:!1}),a=y(null),v=y(null),u=y(!1),C=y(Math.random().toString(36).substring(2)),[A,O]=S(!1),[M,g]=S(()=>{try{return localStorage.getItem("playerMuted")==="true"}catch{return!1}}),[F,U]=S(()=>{try{const c=parseFloat(localStorage.getItem("playerVolume")||"");return isNaN(c)?1:Math.max(0,Math.min(1,c))}catch{return 1}}),[Q,$]=S(!1),[ae,ge]=S(0),[Qe,W]=S(!0),[le,Te]=S(!1),[Xe,Ne]=S({time:0,position:null}),[ve,je]=S(localStorage.getItem("autoSkipEnabled")==="true"),[Ye,ye]=S(null),[Ze,et]=S(!1),[X]=S(no),[tt,nt]=S(X.fontSize),[rt,ot]=S(X.position),[st,it]=S(X.bgOpacity),[ct,at]=S(X.bgColor),[lt,ut]=S(X.textColor),[dt,pt]=S(X.edge),[ft,mt]=S(X.bold),[_t,ht]=S([]),[gt,vt]=S(null),[yt,bt]=S(!1),[wt,St]=S(!1),[Ct,te]=S(!1),[kt,ue]=S(!1),[xt,Ie]=S(()=>{try{return localStorage.getItem("playerUseNativeControls")==="true"}catch{return!1}}),ne=y(!1),be=y(-1),de=I(()=>{const c=i.current;return!n||!r||!l?.name?null:{showId:n,episodeNumber:r,episodeCount:s,currentTime:c?c.currentTime:0,duration:c?c.duration:0,showName:l.name,showThumbnail:l.thumbnail,nativeName:l.names?.native,englishName:l.names?.english,genres:Array.isArray(l.genres)?l.genres.map(w=>typeof w=="string"?w:w?.name).filter(Boolean):void 0,popularityScore:l.score,type:l.type,isPlaying:c?!c.paused:!0,sessionId:C.current,isAdult:l.isAdult}},[n,r,s,l]),R=I((c=!1,w=!1)=>{if(ne.current)return!1;const x=de();if(!x)return!1;const E=i.current;if(!E&&o!=="iframe")return!1;const D=E?E.currentTime>=E.duration*.8:!1;let H=E?E.currentTime:0;if(c&&D&&(H=E?E.duration:0),!w){if(H===0&&!D)return!1;const z=E?Math.abs(H-be.current):0;if(!c&&E&&H!==E.duration&&z<5)return!1}return x.currentTime=H,be.current=H,c?(async()=>{try{await we("/api/update-progress",{method:"POST",body:JSON.stringify(x)}),m.invalidateQueries({queryKey:["video-sources",n,r]}),m.invalidateQueries({queryKey:["allContinueWatching"]}),m.invalidateQueries({queryKey:["thisWeekSchedule"]}),m.invalidateQueries(b.continueWatching.pathFilter())}catch(z){console.error("Failed to update progress:",z)}})():we("/api/update-progress",{method:"POST",body:JSON.stringify(x),keepalive:!0}).catch(z=>console.error("Failed to update progress:",z)),!0},[de,o,m,n,r,b.continueWatching]);P(()=>{const c=i.current;c&&(c.volume=F,c.muted=M)},[i,F,M]),P(()=>{const c=()=>{ne.current||R(!0)};window.addEventListener("beforeunload",c);const w=L,x=T;return()=>{window.removeEventListener("beforeunload",c),ne.current||R(!0),w.current&&clearTimeout(w.current),x.current&&clearTimeout(x.current)}},[R]);const pe=I(()=>{const c=_.current;c&&Go(c,i.current).catch(w=>{console.error(`Error attempting to toggle full-screen mode: ${w?.message} (${w?.name})`)})},[]),fe=I(()=>{i.current&&(i.current.paused?i.current.play().catch(()=>console.warn("Autoplay was prevented.")):(i.current.pause(),W(!0)))},[W]),j=I(()=>{const c=i.current;if(!c)return;const w=k.current.mouse||k.current.keyboard;c.playbackRate=w?2:f.current},[]),re=I(c=>{k.current.mouse!==c&&(k.current.mouse=c,ue(c||k.current.keyboard),j())},[j]),Y=I(c=>{k.current.keyboard!==c&&(k.current.keyboard=c,ue(k.current.mouse||c),j())},[j]),oe=I(c=>{i.current&&(i.current.currentTime+=c,L.current&&clearTimeout(L.current),L.current=setTimeout(()=>{R(!1,!0)},1500),W(!0))},[R,W]),me=I(()=>{if(!i.current)return;const c=!i.current.muted;i.current.muted=c,g(c),localStorage.setItem("playerMuted",String(c)),!c&&i.current.volume===0&&(i.current.volume=.5,U(.5),localStorage.setItem("playerVolume",String(.5))),W(!0)},[W]);P(()=>{const c=()=>i.current,w=Jo(c,x=>{$(x),x&&W(!0)});return $(ee(c())),w},[W]),P(()=>{const c=x=>{if(!x.target.closest('input, textarea, button, select, a, [role="button"], [contenteditable="true"]')){if(x.code==="Space"){if(x.preventDefault(),u.current)return;u.current=!0,v.current&&clearTimeout(v.current),v.current=window.setTimeout(()=>{v.current=null,u.current&&Y(!0)},180);return}switch(x.key.toLowerCase()){case"f":pe();break;case"m":me();break;case"arrowright":oe(10);break;case"arrowleft":oe(-10);break;case"arrowup":if(x.preventDefault(),i.current){const D=Math.min(1,i.current.volume+.1);i.current.volume=D,U(D)}break;case"arrowdown":if(x.preventDefault(),i.current){const D=Math.max(0,i.current.volume-.1);i.current.volume=D,U(D)}break}}},w=x=>{if(x.code==="Space"){if(x.preventDefault(),u.current=!1,k.current.keyboard){Y(!1);return}v.current&&(clearTimeout(v.current),v.current=null,fe())}};return document.addEventListener("keydown",c),document.addEventListener("keyup",w),()=>{document.removeEventListener("keydown",c),document.removeEventListener("keyup",w),v.current&&(clearTimeout(v.current),v.current=null),u.current=!1,Y(!1),ue(!1)}},[Y,fe,pe,me,oe]),P(()=>{const c=H=>H?!!H.closest('[data-speed-boost-ignore="true"], [data-player-ui="true"], button, input, select, textarea, a, [role="button"], [role="slider"], [contenteditable="true"]'):!0,w=H=>{if(H.button!==0)return;const G=H.target;if(!G||c(G))return;const z=_.current;!z||!z.contains(G)||(a.current&&clearTimeout(a.current),a.current=window.setTimeout(()=>{a.current=null,re(!0)},180))},x=H=>{const G=H.target;if(!G||c(G))return;const z=_.current;!z||!z.contains(G)||(a.current&&clearTimeout(a.current),a.current=window.setTimeout(()=>{a.current=null,re(!0)},180))},E=()=>{a.current&&(clearTimeout(a.current),a.current=null),re(!1)},D=()=>{a.current&&(clearTimeout(a.current),a.current=null),u.current=!1,v.current&&(clearTimeout(v.current),v.current=null),Y(!1),re(!1),ue(!1)};return document.addEventListener("mousedown",w),document.addEventListener("mouseup",E),document.addEventListener("touchstart",x,{passive:!0}),document.addEventListener("touchend",E),document.addEventListener("touchcancel",E),document.addEventListener("pointerup",E),document.addEventListener("pointercancel",E),window.addEventListener("blur",D),()=>{document.removeEventListener("mousedown",w),document.removeEventListener("mouseup",E),document.removeEventListener("touchstart",x),document.removeEventListener("touchend",E),document.removeEventListener("touchcancel",E),document.removeEventListener("pointerup",E),document.removeEventListener("pointercancel",E),window.removeEventListener("blur",D),a.current&&(clearTimeout(a.current),a.current=null)}},[Y,re]);const Pe=I(()=>{O(!0),te(!1),setTimeout(()=>R(!1,!0),50)},[R]),Me=I(()=>{te(!1)},[]),$e=I(()=>{te(!0)},[]),Ae=I(()=>{O(!1),W(!0),setTimeout(()=>R(!1,!0),50)},[R]);P(()=>{ne.current=!1,be.current=-1,p.current=0,C.current=Math.random().toString(36).substring(2),ge(0),te(!1)},[n,r]);const Re=I(()=>{ge(0),te(!1)},[]);P(()=>{const c=C.current;return()=>{const w=JSON.stringify({sessionId:c}),x=new Blob([w],{type:"application/json"});navigator.sendBeacon("/api/discord/clear",x)}},[n,r]),P(()=>{if(o!=="iframe")return;R(!1,!0);const c=setInterval(()=>{R(!1,!0)},6e4);return()=>clearInterval(c)},[o,R]);const Fe=I(()=>{ge(i.current?.duration||0),j()},[j]),De=I(()=>{if(i.current){const c=i.current.muted,w=i.current.volume;g(c),U(w),localStorage.setItem("playerMuted",String(c)),localStorage.setItem("playerVolume",String(w))}},[]),Oe=I(()=>{},[]),qe=I(()=>{const c=i.current;if(!c)return;const w=c.currentTime||0,x=Date.now();x-p.current>6e4&&R()&&(p.current=x);const E=e.find(D=>w>=D.start_time&&w<D.end_time)||null;ye(D=>D?.skip_id!==E?.skip_id?E:D),ve&&E&&!c.paused&&(c.currentTime=E.end_time,ye(null))},[e,ve,R]),He=I(()=>{const c=de();c&&(c.currentTime=c.duration,we("/api/update-progress",{method:"POST",body:JSON.stringify(c)}).then(()=>{m.invalidateQueries({queryKey:["video-sources",n,r]}),m.invalidateQueries({queryKey:["allContinueWatching"]})}).catch(w=>console.error("Failed to send final progress:",w)))},[de,m,n,r]),ze=I(()=>{ne.current=!0,He()},[He]);P(()=>{const c=()=>{le&&(Te(!1),Ne({time:0,position:null}),h.current&&i.current?.play(),R(!1,!0))};return le&&document.addEventListener("mouseup",c),()=>{document.removeEventListener("mouseup",c)}},[le,R]);const Et=ce(()=>({togglePlay:fe,seek:oe,toggleMute:me,toggleFullscreen:pe,onPlay:Pe,onPause:Ae,onLoadedMetadata:Fe,formatTime:Tt,onVolumeChange:De,onProgress:Oe,onTimeUpdate:qe,onEnded:ze,setShowControls:W,setIsScrubbing:Te,setHoverTime:Ne,setIsAutoSkipEnabled:je,setCurrentSkipInterval:ye,setShowCCMenu:et,setSubtitleFontSize:nt,setSubtitlePosition:ot,setSubtitleBgOpacity:it,setSubtitleBgColor:at,setSubtitleTextColor:ut,setSubtitleEdge:pt,setSubtitleBold:mt,setAvailableSubtitles:ht,setActiveSubtitleTrack:vt,setShowSettings:bt,setShowVolumeSlider:St,wasPlayingBeforeScrub:h,inactivityTimer:T,setIsFullscreen:$,onWaiting:$e,onPlaying:Me,sendProgressUpdate:R,setUseNativeControls:Ie,resetMediaState:Re}),[fe,oe,me,pe,Pe,Ae,Fe,De,Oe,qe,ze,$,$e,Me,R,Ie,Re]);return{refs:{videoRef:i,playerContainerRef:_,progressBarRef:d},state:{isPlaying:A,isMuted:M,volume:F,isFullscreen:Q,duration:ae,showControls:Qe,isScrubbing:le,hoverTime:Xe,isAutoSkipEnabled:ve,currentSkipInterval:Ye,showCCMenu:Ze,subtitleFontSize:tt,subtitlePosition:rt,subtitleBgOpacity:st,subtitleBgColor:ct,subtitleTextColor:lt,subtitleEdge:dt,subtitleBold:ft,availableSubtitles:_t,activeSubtitleTrack:gt,showSettings:yt,showVolumeSlider:wt,isBuffering:Ct,isSpeedBoostActive:kt,useNativeControls:xt},actions:Et}};function Qo(){try{return typeof navigator<"u"&&/android/i.test(navigator.userAgent)}catch{return!1}}function Ds(e,n){const{refs:r,actions:s}=e,o=y(n);o.current=n;const l=y(!1),m=y(!1),b=i=>{try{if(i)return i.matches}catch{}try{return window.innerWidth>window.innerHeight}catch{return!1}};P(()=>{if(!Qo())return;let i=null;const _=()=>{const d=r.playerContainerRef.current;if(b(i)){if(!o.current||!d||ee(r.videoRef.current)||m.current)return;l.current=!0,s.toggleFullscreen()}else m.current=!1,l.current&&(l.current=!1,ee(r.videoRef.current)&&s.toggleFullscreen())};try{i=window.matchMedia("(orientation: landscape)"),i.addEventListener?i.addEventListener("change",_):i.addListener(_)}catch{}return _(),()=>{try{i&&(i.removeEventListener?i.removeEventListener("change",_):i.removeListener(_))}catch{}}},[s,r.playerContainerRef,r.videoRef,n]),P(()=>{const i=()=>{if(!ee(r.videoRef.current)){l.current=!1;try{window.matchMedia("(orientation: landscape)").matches&&(m.current=!0)}catch{m.current=!0}}};return document.addEventListener("fullscreenchange",i),document.addEventListener("webkitfullscreenchange",i),()=>{document.removeEventListener("fullscreenchange",i),document.removeEventListener("webkitfullscreenchange",i)}},[r.videoRef])}const Xo=e=>Math.max(8,Math.min(40,Math.ceil(e/16.7)+4));function Os({videoRef:e,canvasRef:n,delayMs:r,enabled:s}){const o=y(r);o.current=r;const l=y([]),m=y(-1),b=y(-1),i=y(!1),_=y(0),d=y(null);P(()=>{const T=a=>{if(a)try{a.close()}catch{}},h=()=>{for(const a of l.current)T(a.bitmap);l.current=[]};if(!s){h(),m.current=-1,b.current=-1,i.current=!1,_.current=0;return}let L=!1;const p=()=>{d.current!==null&&(cancelAnimationFrame(d.current),d.current=null)},f=()=>{L||(p(),d.current=requestAnimationFrame(()=>{k()}))};async function k(){if(L)return;const a=e.current,v=n.current;if(!a||!v||a.videoWidth===0){f();return}if(a.paused||a.ended||document.hidden||a.readyState<HTMLMediaElement.HAVE_CURRENT_DATA){f();return}const u=a.getVideoPlaybackQuality().totalVideoFrames;if(u===m.current){f();return}(a.seeking||b.current>=0&&Math.abs(a.currentTime-b.current)>.5)&&(h(),i.current=!1,_.current=0,m.current=-1),b.current=a.currentTime,(v.width!==a.videoWidth||v.height!==a.videoHeight)&&(v.width=a.videoWidth,v.height=a.videoHeight);const C=Math.max(0,o.current||0);C>_.current&&(i.current=!1);try{const A=await createImageBitmap(a);if(L){T(A);return}m.current=u;const O=performance.now(),M=v.getContext("2d"),g=$=>{M&&M.drawImage($,0,0,v.width,v.height)};if(C<=0){h(),i.current=!1,_.current=0,g(A),T(A),f();return}const F=l.current;F.push({bitmap:A,capture:O});const U=Xo(C);for(;F.length>U;)T(F.shift()?.bitmap);let Q=-1;for(let $=F.length-1;$>=0;$--)if(O-F[$].capture>=C){Q=$;break}if(Q!==-1){for(let ae=0;ae<Q;ae++)T(F.shift()?.bitmap);const $=F.shift();$?(g($.bitmap),T($.bitmap),i.current=!0,_.current=C):g(A)}else if(!i.current)g(A);else{const $=F.shift();$?(g($.bitmap),T($.bitmap)):g(A)}}catch{}f()}return f(),()=>{L=!0,p();for(const a of l.current)try{a.bitmap.close()}catch{}l.current=[]}},[s,e,n])}const jo="_row_1fq55_1",Yo="_rowHeader_1fq55_9",Zo="_rowLabel_1fq55_17",es="_rowValue_1fq55_28",ts="_slider_1fq55_36",ns="_swatches_1fq55_99",rs="_swatch_1fq55_99",os="_swatchPicked_1fq55_114",ss="_colorInput_1fq55_120",is="_segmented_1fq55_131",q={row:jo,rowHeader:Yo,rowLabel:Zo,rowValue:es,slider:ts,swatches:ns,swatch:rs,swatchPicked:os,colorInput:ss,segmented:is},cs=({label:e,display:n,min:r,max:s,step:o,value:l,percent:m,onChange:b,onCommit:i})=>t("div",{className:q.row,children:[t("div",{className:q.rowHeader,children:[t("span",{className:q.rowLabel,children:e}),t("span",{className:q.rowValue,children:n})]}),t("input",{type:"range",className:q.slider,min:r,max:s,step:o,value:l,"aria-label":e,"data-speed-boost-ignore":"true",onInput:_=>b(Number(_.target.value)),onMouseDown:_=>_.stopPropagation(),onPointerDown:_=>_.stopPropagation(),onTouchStart:_=>_.stopPropagation(),onPointerUp:i,onPointerCancel:i,onTouchEnd:i,onKeyUp:i,onBlur:i,style:{"--slider-percent":`${m}%`}})]}),qs=({label:e,colors:n,value:r,onChange:s})=>t("div",{className:q.row,children:[t("div",{className:q.rowHeader,children:t("span",{className:q.rowLabel,children:e})}),t("div",{className:q.swatches,children:[n.map(o=>t("button",{type:"button","aria-label":`${e} ${o}`,"aria-pressed":r.toLowerCase()===o.toLowerCase(),onClick:()=>s(o),className:`${q.swatch} ${r.toLowerCase()===o.toLowerCase()?q.swatchPicked:""}`,style:{backgroundColor:o}},o)),t("input",{type:"color","aria-label":`Custom ${e.toLowerCase()}`,className:q.colorInput,value:r,"data-speed-boost-ignore":"true",onInput:o=>s(o.target.value),onMouseDown:o=>o.stopPropagation(),onPointerDown:o=>o.stopPropagation(),onTouchStart:o=>o.stopPropagation()})]})]});function Hs({label:e,options:n,value:r,onChange:s}){return t("div",{className:q.row,children:[t("div",{className:q.rowHeader,children:t("span",{className:q.rowLabel,children:e})}),t("div",{className:q.segmented,role:"group","aria-label":e,children:n.map(o=>t("button",{type:"button","aria-pressed":r===o,onClick:()=>s(o),children:[t("span",{children:o}),r===o&&t(K,{name:"check",size:10})]},o))})]})}const he=10,Be=500,ke=e=>Math.max(0,Math.min(Be,Math.round(e))),zs=({isOpen:e,ms:n,onChange:r,onApply:s,onClose:o,testClipActive:l,onTestClip:m})=>e?t("div",{role:"dialog","aria-label":"Calibrate audio video sync","data-speed-boost-ignore":"true",onClick:b=>b.stopPropagation(),style:{position:"absolute",right:8,bottom:112,width:"min(260px, calc(100% - 16px))",maxHeight:"calc(100% - 124px)",overflowY:"auto",overflowX:"hidden",zIndex:60,display:"flex",flexDirection:"column",alignItems:"center",gap:8,padding:12,borderRadius:"var(--radius-lg)",border:"1px solid var(--glass-border)",background:"rgba(18, 18, 22, 0.95)",boxShadow:"var(--glass-shadow)",backdropFilter:"blur(14px)",WebkitBackdropFilter:"blur(14px)",boxSizing:"border-box"},children:[t("div",{style:{fontSize:"0.8rem",fontWeight:800,color:"var(--text-primary)"},children:"A/V sync"}),t("div",{children:t(se,{size:"sm",variant:"secondary",onClick:m,children:l?"Back to video":"Preview test clip"})}),t("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:6,flexWrap:"wrap"},children:[t(se,{size:"sm",onClick:()=>r(ke(n-he)),"aria-label":"Decrease delay by 10 milliseconds",children:["− ",he,"ms"]}),t("div",{style:{fontSize:"1.1rem",fontWeight:800,minWidth:64,textAlign:"center"},children:[n,"ms"]}),t(se,{size:"sm",onClick:()=>r(ke(n+he)),"aria-label":"Increase delay by 10 milliseconds",children:["+ ",he,"ms"]})]}),t(cs,{label:"Video delay",display:`${n}ms`,min:0,max:Be,step:5,value:n,percent:n/Be*100,onChange:b=>r(ke(b))}),t("div",{style:{display:"flex",gap:8,justifyContent:"center",flexWrap:"wrap"},children:[t(se,{size:"sm",variant:"secondary",onClick:o,children:"Cancel"}),t(se,{size:"sm",onClick:s,children:["Apply ",n,"ms"]})]})]}):null;export{zs as A,Es as B,Ns as C,J as D,As as E,cs as M,$s as P,Is as S,xs as T,Ms as U,Ps as a,Os as b,Ds as c,ws as d,Ss as e,Bs as f,Ts as g,ks as h,jr as i,ms as j,$o as k,gs as l,fs as m,Z as n,Rs as o,bs as p,vs as q,Cs as r,eo as s,Ls as t,Fs as u,ys as v,_s as w,hs as x,qs as y,Hs as z};
@@ -0,0 +1 @@
1
+ import{d as D,A as G,h as O,q as P,g as U,u as e,L as Pe,T as Y,S as ie,a as te,_ as je}from"./vendor-core-8R2fFbyN.js";import{b as Ze,u as Je,a as et}from"./vendor-query-BUTye89G.js";import{S as De,A as Ee,P as tt}from"./SkeletonGrid-CLEPY9nP.js";import{A as oe}from"./AnimeCard-CJy1SXH3.js";import{I as F}from"./vendor-icons-CDMuNDeL.js";import{u as ke,a as le,b as at,c as nt,t as rt,d as We,s as ot,f as Se,B as ze,e as re,g as st,h as Le,i as lt,j as it,k as ct,l as dt,m as ut,n as ht,o as mt,p as pt,q as gt}from"./index-BXwhFWB_.js";import{u as vt}from"./vendor-ui-CUDCvRS_.js";import{E as Ce}from"./ErrorMessage-z4f4WGgP.js";import{R as Oe}from"./ResetProgressModal-CcStlbhP.js";import{Q as _t}from"./QueueRail-O7f4RqjB.js";import{M as _e}from"./MediaCard-B5584Cq9.js";import{u as Fe,M as Ve}from"./useMangaPopup-B8nnpvyi.js";import{M as ft}from"./MangaResetProgressModal-QjZyIAjl.js";import{u as Ge,a as bt,m as we,i as Ue,b as qe,c as He,d as yt,e as Nt}from"./useMangaLibrary-C9Lci5N4.js";import{u as Tt}from"./useProviders-B5Qr4I1y.js";import{u as St}from"./useMatureConsent-CT7-KfzG.js";import{u as Qe,a as $e,T as wt}from"./useTv-Dm8MCYlL.js";import{T as kt}from"./TvPopup-BekfiNcX.js";import{u as Ct,a as It,b as At,t as Rt,i as Lt,c as $t}from"./useTvLibrary-B7jEk2Q7.js";import{A as xt}from"./AsmrResetProgressModal-CKYm-8cp.js";import{u as Mt,a as Bt,b as Pt}from"./useAsmr-DIwIsJXF.js";import"./useAnimeInfoData-DJ7A4B4T.js";import"./QueueOptionsButton-Ba0dg_82.js";import"./useIsMobile-Dm_b6Ob3.js";const Dt="_sectionWrapper_2p2l1_9",Et="_sectionTitleNoMargin_2p2l1_13",Wt="_carousel_2p2l1_178",B={"section-header":"_section-header_2p2l1_1",sectionWrapper:Dt,sectionTitleNoMargin:Et,"title-wrapper":"_title-wrapper_2p2l1_17","header-controls":"_header-controls_2p2l1_24","header-select":"_header-select_2p2l1_30","collapse-button":"_collapse-button_2p2l1_79","title-link":"_title-link_2p2l1_98","continue-watching":"_continue-watching_2p2l1_117","nav-arrows":"_nav-arrows_2p2l1_139","nav-button":"_nav-button_2p2l1_148","carousel-container":"_carousel-container_2p2l1_178",carousel:Wt,"carousel-inner":"_carousel-inner_2p2l1_187","carousel-card":"_carousel-card_2p2l1_192"};function fe({align:a="start",containScroll:o="trimSnaps",scrollFraction:i=.8,threshold:t=.6,onReachThreshold:n}={}){const[c,s]=vt({align:a,containScroll:o,dragFree:!0}),[N,p]=D(!1),v=G({scrollFraction:i,threshold:t,onReachThreshold:n}),m=G(!1);O(()=>{v.current={scrollFraction:i,threshold:t,onReachThreshold:n}});const _=P(u=>{p(u.canScrollPrev()||u.canScrollNext())},[]);O(()=>{if(!s)return;const u=()=>{const l=s.scrollProgress();l>=v.current.threshold&&!m.current?(m.current=!0,v.current.onReachThreshold?.()):l<v.current.threshold&&(m.current=!1),_(s)};return s.on("init",u),s.on("reInit",u),s.on("scroll",u),s.on("resize",u),()=>{s.off("init",u),s.off("reInit",u),s.off("scroll",u),s.off("resize",u)}},[s,_]);const b=P(u=>{const l=u.containerNode().firstElementChild;if(!l)return 1;const h=u.rootNode().getBoundingClientRect().width,I=l.getBoundingClientRect().width;return I?Math.max(1,Math.round(h/I)):1},[]),r=P((u,l=!1)=>{if(!s)return;const h=Math.max(1,Math.round(b(s)*v.current.scrollFraction)),I=s.selectedScrollSnap()+(u==="left"?-h:h);s.scrollTo(I,l)},[s,b]),k=P((u=!1)=>{s?.scrollTo(0,u)},[s]);return{emblaRef:c,api:s,canScroll:N,stepBy:r,scrollToStart:k}}const ee=({title:a,eyebrow:o,titleLink:i,loading:t,emptyState:n,carousel:c,layout:s,collapsible:N,defaultExpanded:p=!0,onReachThreshold:v,scrollThreshold:m,isFetchingNextPage:_,resetScrollOnShrink:b,itemCount:r=0,highlight:k,headerActions:u,loadingSkeleton:l,skeletonCount:h=7,children:I})=>{const{lowEndMode:R}=ke(),{emblaRef:T,stepBy:E,scrollToStart:C}=fe({onReachThreshold:v,threshold:m}),[x,W]=U.useState(p);U.useEffect(()=>{W(p)},[p]);const M=U.useRef(0);return U.useEffect(()=>{b&&r>0&&x&&(r<=M.current||M.current===0)&&C(),r>0&&(M.current=r)},[r,b,x,C]),!t&&r===0&&!n&&!N?null:e("section",{className:`${B.sectionWrapper} ${k?B["continue-watching"]:""}`,children:[e("div",{className:B["section-header"],children:[e("div",{className:B["title-wrapper"],children:[e("div",{className:"title-stack",children:[o&&e("div",{className:"section-eyebrow",children:o}),i?e(Pe,{to:i,className:B["title-link"],children:e("div",{className:`section-title ${B.sectionTitleNoMargin}`,children:a})}):e("div",{className:`section-title ${B.sectionTitleNoMargin}`,children:a})]}),c&&r>0&&x&&e("div",{className:B["nav-arrows"],children:[e("button",{className:B["nav-button"],type:"button","aria-label":"Scroll left",onClick:L=>{L.preventDefault(),E("left",R)},children:e(F,{name:"chevron-left"})}),e("button",{className:B["nav-button"],type:"button","aria-label":"Scroll right",onClick:L=>{L.preventDefault(),E("right",R)},children:e(F,{name:"chevron-right"})})]})]}),e("div",{className:B["header-controls"],children:[u,N&&e("button",{className:B["collapse-button"],type:"button",onClick:()=>W(L=>!L),"aria-expanded":x,"aria-label":x?`Collapse ${a}`:`Expand ${a}`,children:x?e(F,{name:"chevron-up"}):e(F,{name:"chevron-down"})})]})]}),x&&(c?!t&&r===0&&n?e("div",{children:n}):e("div",{className:B["carousel-container"],children:e("div",{className:B.carousel,ref:T,children:e("div",{className:B["carousel-inner"],children:[t&&r===0?Array.from({length:h}).map((L,A)=>e("div",{className:B["carousel-card"],children:l},A)):U.Children.map(I,(L,A)=>e("div",{className:B["carousel-card"],children:L},U.isValidElement(L)&&L.key!=null?L.key:`slide-${A}`)),_&&l&&e("div",{className:B["carousel-card"],children:l})]})})}):e("div",{className:"grid-container",children:t&&r===0?e(De,{count:6,layout:s}):r>0?I:t?null:e("div",{style:{gridColumn:"1 / -1"},children:n})}))]})},zt=({title:a,eyebrow:o,animeList:i,continueWatching:t,titleLink:n,onRemove:c,loading:s,emptyState:N,carousel:p,cardConfig:v,layout:m,onReachThreshold:_,scrollThreshold:b,isFetchingNextPage:r,collapsible:k,defaultExpanded:u=!0})=>{const l=m||"vertical";return e(ee,{title:a,eyebrow:o,titleLink:n,loading:s,emptyState:N,carousel:p,layout:l,collapsible:k,defaultExpanded:u,onReachThreshold:_,scrollThreshold:b,isFetchingNextPage:r,resetScrollOnShrink:t,highlight:t,itemCount:i.length,loadingSkeleton:e(Ee,{layout:l}),skeletonCount:7,children:p?i.map(h=>e(oe,{anime:h,continueWatching:t,onRemove:c,config:v,layout:l},h._id)):i.map(h=>e(oe,{anime:h,continueWatching:t,onRemove:c,config:v,layout:l},h._id))})},xe=U.memo(zt),Ot="_sectionWrapper_c8uv6_2",Ft="_sectionTitleNoMargin_c8uv6_6",Vt="_timeSelect_c8uv6_80",Gt="_carouselContainer_c8uv6_111",Ut="_carousel_c8uv6_111",qt="_carouselInner_c8uv6_122",Ht="_carouselItem_c8uv6_127",Qt="_rankCard_c8uv6_164",Yt="_rankPill_c8uv6_168",Xt="_rankGold_c8uv6_179",Kt="_rankSilver_c8uv6_183",jt="_rankBronze_c8uv6_187",Zt="_skeletonPoster_c8uv6_198",Jt="_skeletonText_c8uv6_199",f={sectionWrapper:Ot,sectionTitleNoMargin:Ft,"section-header":"_section-header_c8uv6_10","title-wrapper":"_title-wrapper_c8uv6_18","nav-arrows":"_nav-arrows_c8uv6_40","nav-button":"_nav-button_c8uv6_49",timeSelect:Vt,carouselContainer:Gt,carousel:Ut,carouselInner:qt,carouselItem:Ht,rankCard:Qt,rankPill:Yt,rankGold:Xt,rankSilver:Kt,rankBronze:jt,skeletonPoster:Zt,skeletonText:Jt},Me="TRENDING_DESC",ea="POPULARITY_DESC",ta=10;function aa({title:a,eyebrow:o}){const{lowEndMode:i}=ke(),[t,n]=le("trending_sort",Me),c=[{value:Me,label:"Trending"},{value:ea,label:"All Time"}],{data:s,fetchNextPage:N,hasNextPage:p,isFetchingNextPage:v,isLoading:m,isError:_,error:b}=at(t,ta),r=Y(()=>s?.pages.flatMap(h=>h)||[],[s]),k=P(()=>{p&&!v&&!m&&N()},[p,v,m,N]),{emblaRef:u,stepBy:l}=fe({onReachThreshold:k});return e("section",{className:f.sectionWrapper,children:[e("div",{className:f["section-header"],children:[e("div",{className:f["title-wrapper"],children:[e("div",{className:"title-stack",children:[o&&e("div",{className:"section-eyebrow",children:o}),e("div",{className:`section-title ${f.sectionTitleNoMargin}`,children:a})]}),e("div",{className:f["nav-arrows"],children:[e("button",{className:f["nav-button"],type:"button",onClick:h=>{h.preventDefault(),l("left",i)},"aria-label":"Scroll left",children:e(F,{name:"chevron-left"})}),e("button",{className:f["nav-button"],type:"button",onClick:h=>{h.preventDefault(),l("right",i)},"aria-label":"Scroll right",children:e(F,{name:"chevron-right"})})]})]}),e("div",{className:f["header-actions"],children:e("select",{className:f.timeSelect,value:t,onChange:h=>n(h.currentTarget.value),children:c.map(h=>e("option",{value:h.value,children:h.label},h.value))})})]}),m?e("div",{className:f.carouselContainer,children:e("div",{className:f.carousel,children:e("div",{className:f.carouselInner,children:Array.from({length:7}).map((h,I)=>e("div",{className:f.carouselItem,children:[e("div",{className:f.skeletonPoster}),e("div",{className:f.skeletonText})]},I))})})}):_?e(Ce,{message:b instanceof Error?b.message:"An unknown error occurred"}):e("div",{className:f.carouselContainer,children:e("div",{className:f.carousel,ref:u,children:e("div",{className:f.carouselInner,children:[r.map((h,I)=>e("div",{className:f.carouselItem,children:[e("div",{className:f.rankCard,children:e(oe,{anime:h})}),e("div",{className:`${f.rankPill} ${I===0?f.rankGold:I===1?f.rankSilver:I===2?f.rankBronze:""}`,children:I+1})]},h._id)),v&&e("div",{className:f.carouselItem,style:{minWidth:"150px",display:"flex",alignItems:"center",justifyContent:"center"},children:e("div",{className:f.skeletonPoster})})]})})})]})}const na=[{value:"TV",label:"TV"},{value:"ONA",label:"ONA"},{value:"OVA",label:"OVA"},{value:"MOVIE",label:"Movie"},{value:"ALL",label:"All"},{value:"ADULT",label:"Mature"}],ra=10;function oa({eyebrow:a}){const{lowEndMode:o}=ke(),[i,t]=le("latest_releases_format","TV"),{data:n,fetchNextPage:c,hasNextPage:s,isFetchingNextPage:N,isLoading:p,isError:v,error:m}=nt(i,ra),_=Y(()=>n?.pages.flatMap(u=>u)||[],[n]),b=P(()=>{s&&!N&&!p&&c()},[s,N,p,c]),{emblaRef:r,stepBy:k}=fe({onReachThreshold:b});return e("section",{className:f.sectionWrapper,children:[e("div",{className:f["section-header"],children:[e("div",{className:f["title-wrapper"],children:[e("div",{className:"title-stack",children:[a&&e("div",{className:"section-eyebrow",children:a}),e("div",{className:`section-title ${f.sectionTitleNoMargin}`,children:"Latest Releases"})]}),e("div",{className:f["nav-arrows"],children:[e("button",{className:f["nav-button"],type:"button",onClick:u=>{u.preventDefault(),k("left",o)},"aria-label":"Scroll left",children:e(F,{name:"chevron-left"})}),e("button",{className:f["nav-button"],type:"button",onClick:u=>{u.preventDefault(),k("right",o)},"aria-label":"Scroll right",children:e(F,{name:"chevron-right"})})]})]}),e("div",{className:f["header-actions"],children:e("select",{className:f.timeSelect,value:i,onChange:u=>t(u.currentTarget.value),children:na.map(u=>e("option",{value:u.value,children:u.label},u.value))})})]}),p?e("div",{className:f.carouselContainer,children:e("div",{className:f.carousel,children:e("div",{className:f.carouselInner,children:Array.from({length:7}).map((u,l)=>e("div",{className:f.carouselItem,children:[e("div",{className:f.skeletonPoster}),e("div",{className:f.skeletonText})]},l))})})}):v?e(Ce,{message:m instanceof Error?m.message:"An unknown error occurred"}):e("div",{className:f.carouselContainer,children:e("div",{className:f.carousel,ref:r,children:e("div",{className:f.carouselInner,children:[_.map(u=>e("div",{className:f.carouselItem,children:e(oe,{anime:u})},u._id)),N&&e("div",{className:f.carouselItem,style:{minWidth:"150px",display:"flex",alignItems:"center",justifyContent:"center"},children:e("div",{className:f.skeletonPoster})})]})})})]})}const sa="_scheduleSection_10dfe_1",la="_sectionTitleRow_10dfe_5",ia="_sectionTitleNoMargin_10dfe_11",ca="_sectionHeader_10dfe_15",da="_headerActions_10dfe_25",ua="_timeSelect_10dfe_31",ha="_daySelectorContainer_10dfe_62",ma="_daySelector_10dfe_62",pa="_daySelectorInner_10dfe_79",ga="_dayBtn_10dfe_90",va="_active_10dfe_113",_a="_dayMonth_10dfe_121",fa="_dayNum_10dfe_129",ba="_dayName_10dfe_135",ya="_navArrows_10dfe_148",Na="_navButton_10dfe_157",Ta="_carouselContainer_10dfe_181",Sa="_carousel_10dfe_181",wa="_carouselInner_10dfe_193",ka="_carouselCard_10dfe_198",$={scheduleSection:sa,sectionTitleRow:la,sectionTitleNoMargin:ia,sectionHeader:ca,headerActions:da,timeSelect:ua,daySelectorContainer:ha,daySelector:ma,daySelectorInner:pa,dayBtn:ga,active:va,dayMonth:_a,dayNum:fa,dayName:ba,navArrows:ya,navButton:Na,carouselContainer:Ta,carousel:Sa,carouselInner:wa,carouselCard:ka},ue=a=>{const o=a.getFullYear(),i=String(a.getMonth()+1).padStart(2,"0"),t=String(a.getDate()).padStart(2,"0");return`${o}-${i}-${t}`},Ca=async(a,o)=>await rt.data.schedule.query({date:a,format:o}),Ia=({eyebrow:a})=>{const[o,i]=D(()=>ue(new Date)),[t,n]=le("schedule_format","TV"),{emblaRef:c,canScroll:s,stepBy:N,scrollToStart:p}=fe(),v=G(null),m=G(!0),{data:_=[],isLoading:b,error:r}=Ze({queryKey:["schedule",o,t],queryFn:()=>Ca(o,t),staleTime:1e3*60*5}),k=Y(()=>{const l=[],h=new Date,I=ue(h),R=new Date(h);R.setDate(h.getDate()-1);const T=ue(R),E=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];for(let C=-6;C<=6;C++){const x=new Date;x.setDate(h.getDate()+C),l.push(x)}return l.map(C=>{const x=ue(C),L=x===I?"Today":x===T?"Yest":E[C.getDay()],A=C.getDate(),X=new Intl.DateTimeFormat("en-US",{month:"short"}).format(C);return{dateString:x,dayLabel:L,dayNum:A,monthName:X}})},[]);O(()=>{if(m.current){m.current=!1;return}if(v.current){const l=v.current.querySelector(`[data-date="${o}"]`);l&&l.scrollIntoView({behavior:"smooth",inline:"center",block:"nearest"})}},[o]),O(()=>{p(!0)},[o,p]);const u=[{value:"TV",label:"TV"},{value:"ONA",label:"ONA"},{value:"OVA",label:"OVA"},{value:"MOVIE",label:"Movie"},{value:"ALL",label:"All"},{value:"ADULT",label:"Mature"}];return e("div",{className:$.scheduleSection,children:[e("div",{className:$.sectionHeader,children:[e("div",{className:$.sectionTitleRow,children:[e("div",{className:"title-stack",children:[a&&e("div",{className:"section-eyebrow",children:a}),e("h2",{className:`section-title ${$.sectionTitleNoMargin}`,children:"Episode Schedule"})]}),_.length>0&&s&&e("div",{className:$.navArrows,children:[e("button",{className:$.navButton,onClick:()=>N("left"),"aria-label":"Scroll left",children:e(F,{name:"chevron-left"})}),e("button",{className:$.navButton,onClick:()=>N("right"),"aria-label":"Scroll right",children:e(F,{name:"chevron-right"})})]})]}),e("div",{className:$.headerActions,children:e("select",{className:$.timeSelect,value:t,onChange:l=>n(l.target.value),children:u.map(l=>e("option",{value:l.value,children:l.label},l.value))})})]}),e("div",{className:$.daySelectorContainer,children:e("div",{className:$.daySelector,ref:v,children:e("div",{className:$.daySelectorInner,children:k.map(l=>e("button",{type:"button","data-date":l.dateString,className:`${$.dayBtn} ${o===l.dateString?$.active:""}`,onClick:()=>i(l.dateString),children:[e("span",{className:$.dayMonth,children:l.monthName}),e("span",{className:$.dayNum,children:l.dayNum}),e("span",{className:$.dayName,children:l.dayLabel})]},l.dateString))})})}),e("div",{className:$.carouselContainer,children:e("div",{className:$.carousel,ref:c,children:e("div",{className:$.carouselInner,children:b?Array.from({length:7}).map((l,h)=>e("div",{className:$.carouselCard,children:e(Ee,{layout:"vertical"})},h)):r?e("div",{style:{width:"100%"},children:e(Ce,{message:r instanceof Error?r.message:"An unknown error occurred"})}):_.length===0?e("p",{style:{textAlign:"center",marginTop:"1rem",width:"100%"},children:"No episodes scheduled for this day."}):_.map(l=>e("div",{className:$.carouselCard,children:e(oe,{anime:l,continueWatching:!1,layout:"vertical"},l._id)},l._id))})})})]})},Aa="_bannerContainer_1r6xz_1",Ra="_hero_1r6xz_28",La="_ambient_1r6xz_37",$a="_ambientShow_1r6xz_49",xa="_scrim_1r6xz_53",Ma="_progressLine_1r6xz_69",Ba="_paused_1r6xz_89",Pa="_dots_1r6xz_103",Da="_dot_1r6xz_103",Ea="_dotActive_1r6xz_132",Wa="_viewport_1r6xz_138",za="_track_1r6xz_145",Oa="_slide_1r6xz_151",Fa="_slideInner_1r6xz_159",Va="_poster_1r6xz_169",Ga="_info_1r6xz_179",Ua="_kicker_1r6xz_183",qa="_featureLabel_1r6xz_190",Ha="_scoreChip_1r6xz_202",Qa="_rise_1r6xz_220",Ya="_active_1r6xz_224",Xa="_metaRow_1r6xz_280",Ka="_metaItem_1r6xz_291",ja="_metaDivider_1r6xz_297",Za="_title_1r6xz_304",Ja="_genres_1r6xz_320",en="_genreTag_1r6xz_328",tn="_summary_1r6xz_339",an="_actions_1r6xz_351",nn="_watchBtn_1r6xz_358",rn="_detailsBtn_1r6xz_380",on="_navArrow_1r6xz_401",sn="_prevArrow_1r6xz_434",ln="_nextArrow_1r6xz_438",y={bannerContainer:Aa,hero:Ra,ambient:La,ambientShow:$a,scrim:xa,progressLine:Ma,paused:Ba,dots:Pa,dot:Da,dotActive:Ea,viewport:Wa,track:za,slide:Oa,slideInner:Fa,poster:Va,info:Ga,kicker:Ua,featureLabel:qa,scoreChip:Ha,rise:Qa,active:Ya,metaRow:Xa,metaItem:Ka,metaDivider:ja,title:Za,genres:Ja,genreTag:en,summary:tn,actions:an,watchBtn:nn,detailsBtn:rn,navArrow:on,prevArrow:sn,nextArrow:ln},cn=8e3,he=()=>e("div",{className:"skeleton",style:{width:"100vw",maxWidth:"100vw",position:"relative",left:"50%",right:"50%",marginLeft:"-50vw",marginRight:"-50vw",height:"clamp(480px, 72vh, 660px)",marginTop:"calc(-1 * var(--header-height))",marginBottom:"2.5rem"}}),be=({slides:a,posterClassName:o})=>{const[i,t]=D(0),[n,c]=D(0),[s,N]=D(!1),[p,v]=D(null),[m,_]=D(0),[b,r]=D({front:"",back:"",flip:!1}),k=G(0),u=G(0),l=G(new Set),h=G(null),I=G(0),R=P(d=>d.bannerSrc,[]),T=P(()=>{c(d=>d+1)},[]),E=P(d=>{h.current!==null&&(window.clearTimeout(h.current),h.current=null),v(null),T();const w=R(a[d]);r(S=>S.flip?{front:w,back:S.back,flip:!1}:{front:S.front,back:w,flip:!0}),t(d)},[T,a,R]),C=P(d=>{if(a.length===0)return;const w=(d%a.length+a.length)%a.length;l.current.has(R(a[w]))?E(w):v(w)},[a,R,E]);O(()=>{let d=!1;return a.forEach(w=>{const S=R(w);if(!S||l.current.has(S))return;const g=new Image;g.src=S;const z=()=>{d||l.current.has(S)||(l.current.add(S),_(q=>q+1))};g.onload=z,g.onerror=z}),()=>{d=!0}},[a,R]),O(()=>{if(a.length!==0&&!b.front){const d=R(a[0]);r({front:d,back:"",flip:!1})}},[a,b.front,R]),O(()=>{if(p!==null){if(p<0||p>=a.length){v(null);return}l.current.has(R(a[p]))&&E(p)}},[p,m,a,R,E]),O(()=>{if(p===null)return;h.current!==null&&window.clearTimeout(h.current);const d=p;return h.current=window.setTimeout(()=>{h.current=null,E(d)},2500),()=>{h.current!==null&&(window.clearTimeout(h.current),h.current=null)}},[p,E]);const x=P(d=>{C(d)},[C]),W=P(()=>{C(I.current+1)},[C]),M=P(()=>{C(I.current-1)},[C]),L=G(null);if(O(()=>{const d=L.current;if(!d)return;const w=S=>{if(Math.abs(S.deltaY)>Math.abs(S.deltaX)&&Math.abs(S.deltaY)>5){S.preventDefault(),S.stopPropagation();const g=Date.now();if(g-k.current<300)return;k.current=g,T(),S.deltaY>0?W():M()}};return d.addEventListener("wheel",w,{passive:!1}),()=>d.removeEventListener("wheel",w)},[a.length,W,M,T]),O(()=>{if(a.length===0||s)return;const d=setTimeout(W,cn);return()=>clearTimeout(d)},[i,W,a.length,n,s]),O(()=>{const d=w=>{const S=w.target;S&&(S.tagName==="INPUT"||S.tagName==="TEXTAREA"||S.tagName==="SELECT"||S.isContentEditable)||(w.key==="ArrowRight"?(w.preventDefault(),W()):w.key==="ArrowLeft"&&(w.preventDefault(),M()))};return window.addEventListener("keydown",d),()=>window.removeEventListener("keydown",d)},[W,M]),O(()=>{i>=a.length&&t(0)},[a.length,i]),a.length===0)return null;const A=i>=a.length?0:i;I.current=A;const X=d=>{u.current=d.touches[0].clientX},j=d=>{const S=d.changedTouches[0].clientX-u.current;Math.abs(S)>50&&(T(),S>0?M():W())};return e("div",{className:y.bannerContainer,onMouseEnter:()=>N(!0),onMouseLeave:()=>N(!1),children:e("div",{className:`${y.hero} ${s?y.paused:""}`,onTouchStart:X,onTouchEnd:j,children:[b.front&&e("img",{src:b.front,alt:"","aria-hidden":"true",className:`${y.ambient} ${b.flip?"":y.ambientShow}`}),b.back&&e("img",{src:b.back,alt:"","aria-hidden":"true",className:`${y.ambient} ${b.flip?y.ambientShow:""}`}),e("div",{className:y.scrim,"aria-hidden":"true"}),a.length>1&&e("div",{className:y.progressLine,"aria-hidden":"true"},`progress-${n}-${A}`),a.length>1&&e("div",{className:y.dots,ref:L,role:"tablist","aria-label":"Spotlight slides",children:a.map((d,w)=>e("button",{role:"tab","aria-selected":w===A,"aria-label":`Go to slide ${w+1}: ${d.title}`,className:`${y.dot} ${w===A?y.dotActive:""}`,onClick:()=>x(w),tabIndex:w===A?0:-1},d.key))}),e("div",{className:y.viewport,children:e("div",{className:y.track,style:{transform:`translateX(-${A*100}%)`},children:a.map((d,w)=>e("div",{className:`${y.slide} ${w===A?y.active:""}`,"aria-hidden":w!==A,children:e("div",{className:y.slideInner,children:[e("img",{src:d.posterSrc,alt:d.posterAlt,className:o??y.poster,decoding:"async"}),e("div",{className:y.info,children:[e("div",{className:`${y.kicker} ${y.rise}`,children:[e("span",{className:y.featureLabel,children:"Spotlight"}),d.score!==void 0&&d.score!==null&&d.score!==""&&e("span",{className:y.scoreChip,children:[e(F,{name:"star",size:12}),e("span",{children:d.score})]})]}),e(Pe,{to:d.detailTo,className:`${y.title} ${y.rise}`,"aria-label":`View details for ${d.title}`,tabIndex:w===A?0:-1,children:d.title}),d.metaItems.length>0&&e("div",{className:`${y.metaRow} ${y.rise}`,children:d.metaItems.map((S,g)=>e(U.Fragment,{children:[e("span",{className:y.metaItem,children:S}),g<d.metaItems.length-1&&e("div",{className:y.metaDivider})]},g))}),d.tags.length>0&&e("div",{className:`${y.genres} ${y.rise}`,children:d.tags.slice(0,3).map(S=>e("span",{className:y.genreTag,children:S},S))}),d.synopsis&&e("p",{className:`${y.summary} ${y.rise}`,children:d.synopsis}),e("div",{className:`${y.actions} ${y.rise}`,children:[e("button",{className:y.watchBtn,onClick:d.onPrimary,tabIndex:w===A?0:-1,children:[e(F,{name:d.primaryIcon,size:14}),e("span",{children:d.primaryLabel})]}),e("button",{className:y.detailsBtn,onClick:d.onDetails,tabIndex:w===A?0:-1,children:[e(F,{name:"info-circle",size:15}),e("span",{children:"Details"})]})]})]})]})},d.key))})}),a.length>1&&e(ie,{children:[e("button",{className:`${y.navArrow} ${y.prevArrow}`,onClick:()=>{T(),M()},"aria-label":"Previous slide",children:e(F,{name:"chevron-left",size:20})}),e("button",{className:`${y.navArrow} ${y.nextArrow}`,onClick:()=>{T(),W()},"aria-label":"Next slide",children:e(F,{name:"chevron-right",size:20})})]})]})})},dn=({animeList:a})=>{const{titlePreference:o}=We(),i=te(),t=Y(()=>a.slice(0,6).map(n=>{const c=o==="nativeName"?n.nativeName||n.name:o==="englishName"&&n.englishName||n.name;return{key:n._id,bannerSrc:n.bannerImage?Se(n.bannerImage,1280,560):Se(n.thumbnail,1280,450),posterSrc:Se(n.thumbnail,460,650),posterAlt:c,title:c,detailTo:`/anime/${n._id}`,score:n.score,metaItems:[n.type||"Anime",n.status,n.episodeCount?`${n.episodeCount} Episodes`:void 0,n.rating].filter(s=>!!s),tags:(n.genres??[]).slice(0,3).map(s=>typeof s=="string"?s:s?.name).filter(s=>!!s),synopsis:ot(n.description??""),primaryLabel:"Watch Now",primaryIcon:"play",onPrimary:()=>i(`/watch/${n._id}`),onDetails:()=>i(`/anime/${n._id}`)}}),[a,o,i]);return e(be,{slides:t})},un="_emptyState_19tmt_1",hn="_emptyStateIcon_19tmt_16",mn="_emptyStateTitle_19tmt_23",pn="_emptyStateText_19tmt_30",me={emptyState:un,emptyStateIcon:hn,emptyStateTitle:mn,emptyStateText:pn},ye=({icon:a,text:o,actionLabel:i,onAction:t,title:n="Nothing is here..."})=>e("div",{className:me.emptyState,children:[e(F,{name:a,size:48,className:me.emptyStateIcon}),e("div",{children:[e("h3",{className:me.emptyStateTitle,children:n}),e("p",{className:me.emptyStateText,children:o})]}),e(ze,{variant:"primary",size:"sm",onClick:t,style:{marginTop:"1rem"},children:i})]}),gn="_select_1dw63_1",vn={select:gn},ge=({value:a,options:o,onChange:i,ariaLabel:t,width:n})=>e("select",{className:vn.select,style:n!==void 0?{width:n}:void 0,value:a,"aria-label":t,onChange:c=>i(c.currentTarget.value),children:o.map(c=>e("option",{value:c.value,children:c.label},c.value))}),_n="_tabBar_irwbm_1",fn="_tabIndicator_irwbm_24",bn="_tabButton_irwbm_38",yn="_tabActive_irwbm_64",pe={tabBar:_n,tabIndicator:fn,tabButton:bn,tabActive:yn};function Nn({options:a,value:o,onChange:i,ariaLabel:t},n){const c=G(null),s=G(new Map),[N,p]=D({left:0,width:0}),v=P(m=>{const _=s.current.get(m),b=c.current;if(_&&b){const r=b.getBoundingClientRect(),k=_.getBoundingClientRect();p({left:k.left-r.left+b.scrollLeft,width:k.width}),_.scrollIntoView({block:"nearest",inline:"nearest"})}},[]);return je(()=>{v(o)},[o,a.length,v]),O(()=>{if(v(o),typeof ResizeObserver>"u")return;let m=0;const _=c.current;if(!_)return;const b=new ResizeObserver(()=>{cancelAnimationFrame(m),m=requestAnimationFrame(()=>v(o))});b.observe(_);let r=!1;return document.fonts?.ready&&document.fonts.ready.then(()=>{r||v(o)}),()=>{r=!0,cancelAnimationFrame(m),b.disconnect()}},[o,a.length,v]),e("div",{className:pe.tabBar,ref:m=>{c.current=m,typeof n=="function"?n(m):n&&(n.current=m)},"aria-label":t,children:[e("div",{className:pe.tabIndicator,style:{left:N.left,width:N.width}}),a.map(m=>e(ze,{ref:_=>{_&&s.current.set(m.value,_)},variant:"secondary",size:"sm",className:`${pe.tabButton} ${o===m.value?pe.tabActive:""}`,onClick:()=>i(m.value),children:m.label},m.value))]})}const ve=U.forwardRef(Nn),Tn=[{value:"popular",label:"Popular"},{value:"followed",label:"Most Followed"},{value:"rating",label:"Top Rated"}];function Sn(){const{options:a}=Tt();return Y(()=>a.filter(o=>o.kind==="manga").map(o=>o.value)[0]??"",[a])}const Be=({title:a,eyebrow:o,provider:i,sort:t,mature:n,headerActions:c})=>{const{toggle:s,bookmarkedIds:N}=Ge(),{popup:p,openPopup:v,scheduleClose:m,cancelClose:_,closePopup:b}=Fe(),{data:r,isLoading:k,fetchNextPage:u,hasNextPage:l,isFetchingNextPage:h}=bt({provider:i,query:"",sort:t,status:"",type:"",rating:n?"safe,suggestive,erotica,pornographic":"safe",mature:n}),I=Y(()=>r?.pages.flatMap(T=>T.items)??[],[r]),R=P(()=>{l&&!h&&!k&&u()},[l,h,k,u]);return i?e(ie,{children:[e(ee,{title:a,eyebrow:o,loading:k,carousel:!0,itemCount:I.length,headerActions:c,onReachThreshold:R,isFetchingNextPage:h,loadingSkeleton:e("div",{className:"skeleton",style:{aspectRatio:"3 / 4"}}),skeletonCount:7,children:I.map(T=>{const E=we(T.provider,T.id);return e(_e,{item:{id:E,title:T.title,...He(T),thumbnail:qe(T.provider,T.cover),typeBadge:T.type||void 0,chapterBadge:T.latestChapter?`Ch. ${T.latestChapter}`:null,isAdult:Ue(T)},linkTo:`/manga/${T.provider}/${encodeURIComponent(T.id)}`,hoverIcon:"info",showInfoButton:!0,display:{elements:{poster:{typeBadge:!0,chapterBadge:!0,adultBadge:!0},info:{title:!0,mobileBadges:!0,progress:!1,meta:!1}}},onOpenDetails:C=>v(C,{provider:T.provider,mangaId:T.id,title:T.title,altTitle:T.altTitle,cover:T.cover,contentRating:T.contentRating,readTarget:`/manga/${T.provider}/${encodeURIComponent(T.id)}`,mature:n}),onPopupHoverIntent:C=>C?_():m(),rawThumbnail:!0},`${T.provider}-${T.id}`)})}),p&&e(Ve,{data:p.data,anchorRect:p.rect,bookmarked:N.has(we(p.data.provider,p.data.mangaId)),onToggleBookmark:()=>s({id:p.data.mangaId,provider:p.data.provider,title:p.data.title,cover:p.data.cover,altTitle:p.data.altTitle??void 0,contentRating:p.data.contentRating}),onMouseEnter:_,onMouseLeave:m,onRequestClose:b})]}):null},wn=()=>{const a=Sn(),{hasConsent:o}=St(),[i,t]=le("manga_discover_tab","latest"),[n,c]=le("manga_trending_sort","popular");return a?e(ie,{children:[e(ve,{ariaLabel:"Discover manga",options:[{value:"latest",label:"Latest Releases"},{value:"trending",label:"Trending"}],value:i,onChange:t}),i==="latest"?e(Be,{title:"Latest Releases",eyebrow:"Fresh chapters",provider:a,sort:"latest",mature:o}):e(Be,{title:"Trending",eyebrow:"Discover",provider:a,sort:n,mature:o,headerActions:e("select",{className:B["header-select"],value:n,onChange:s=>c(s.currentTarget.value),"aria-label":"Trending sort",children:Tn.map(s=>e("option",{value:s.value,children:s.label},s.value))})})]}):null},kn=()=>{const a=te(),{data:o,isLoading:i}=yt(24),[t,n]=D(null),{popup:c,openPopup:s,scheduleClose:N,cancelClose:p,closePopup:v}=Fe(),{toggle:m,bookmarkedIds:_}=Ge(),b=o?.data??[];return e("div",{style:{paddingBottom:"2rem"},children:[e(ee,{title:"Continue Reading",eyebrow:"Pick up where you left off",titleLink:"/reading-list/Continue Reading",loading:i,carousel:!0,collapsible:!0,defaultExpanded:b.length>0,highlight:!0,itemCount:b.length,loadingSkeleton:e("div",{className:"skeleton",style:{aspectRatio:"3 / 4"}}),skeletonCount:7,emptyState:e(ye,{icon:"book",text:"You haven't read anything yet. Browse manga and open a chapter to start tracking.",actionLabel:"Browse Manga",onAction:()=>a("/manga")}),children:b.map(r=>{const k=r.page??0,u=r.pageCount??0,l=r.chapterId&&r.provider?`/manga/${r.provider}/${encodeURIComponent(r.mangaId)}/read?chapter=${encodeURIComponent(r.chapterId)}`:r.provider?`/manga/${r.provider}/${encodeURIComponent(r.mangaId)}`:"#";return e(_e,{item:{id:r.id,title:r.title,...He({title:r.title,altTitle:r.altTitle}),thumbnail:r.provider?qe(r.provider,r.cover||""):r.cover||"",chapterBadge:r.chapterNumber?`Ch. ${r.chapterNumber}`:null,isAdult:Ue(r)},linkTo:l,hoverIcon:"book",progress:u>0?{percent:k/u*100,label:`Ch. ${r.chapterNumber} · p. ${k}/${u}`}:void 0,showProgress:!0,display:{elements:{poster:{typeBadge:!1,chapterBadge:!0,adultBadge:!0,removeButton:!0},info:{title:!0,mobileBadges:!0,progress:!0,meta:!1}}},onRemove:()=>n({libId:r.id,title:r.title}),onOpenDetails:h=>s(h,{provider:r.provider||"",mangaId:r.mangaId||"",title:r.title||"",altTitle:r.altTitle,cover:r.cover||"",contentRating:r.contentRating||void 0,readTarget:l}),onPopupHoverIntent:h=>h?p():N(),rawThumbnail:!0},r.id)})}),e(ft,{mangaId:t?t.libId:null,title:t?.title,onClose:()=>n(null)}),c&&c.data.provider&&e(Ve,{data:c.data,anchorRect:c.rect,bookmarked:_.has(we(c.data.provider,c.data.mangaId)),onToggleBookmark:()=>m({id:c.data.mangaId,provider:c.data.provider,title:c.data.title,cover:c.data.cover,altTitle:c.data.altTitle??void 0,contentRating:c.data.contentRating}),onMouseEnter:p,onMouseLeave:N,onRequestClose:v}),e(wn,{})]})},Cn="_seasonGrid_bt5c7_76",In="_emptyState_bt5c7_108",H={"section-header":"_section-header_bt5c7_1","title-wrapper":"_title-wrapper_bt5c7_8","pagination-controls":"_pagination-controls_bt5c7_14",seasonGrid:Cn,emptyState:In},An=[{value:"latest",label:"Latest Releases"},{value:"trending",label:"Trending"}],Rn=[{value:"trending_week",label:"Trending Now"},{value:"trending_day",label:"Trending Today"},{value:"popular",label:"Popular All Time"},{value:"top_rated",label:"Top Rated"}],Ln=()=>{const a=te(),{data:o,isLoading:i}=Ct(24),t=It(),n=At(),[c,s]=D(null),[N,p]=D(!1),[v,m]=D(()=>localStorage.getItem("tv_home_activeTab")||"latest"),[_,b]=D("tv"),[r,k]=D("trending_week"),[u,l]=D("multi"),h=o?.data??[];U.useEffect(()=>{localStorage.setItem("tv_home_activeTab",v)},[v]);const I=r.startsWith("trending_"),R=r==="trending_day"?"day":"week",T={popular:"popularity.desc",top_rated:"vote_average.desc"},{data:E,isLoading:C}=Qe(u==="multi"?"all":u,R,1,I&&v==="trending"),{data:x,isLoading:W}=$e({type:u,sort_by:T[r]||"popularity.desc",page:1}),M=I?E?.results||[]:x?.results||[],L=I?C:W,{data:A,isLoading:X}=$e({type:_,sort_by:"primary_release_date.desc",page:1}),j=A?.results||[],d=()=>{c&&(n.mutate({mediaId:c.libId}),N&&t.mutate(c.libId),s(null),p(!1))},w=P(g=>e(wt,{item:{id:g.id,title:g.title,year:g.year,type:g.type,image:g.image,vote_average:g.vote_average,adult:g.adult}},`${g.type}-${g.id}`),[]),S=()=>{switch(v){case"latest":return e("section",{children:[e("div",{className:H["section-header"],children:[e("div",{className:H["title-wrapper"],children:e("div",{className:"title-stack",children:[e("div",{className:"section-eyebrow",children:"Fresh picks"}),e("div",{className:"section-title",style:{marginBottom:0},children:"Latest Releases"})]})}),e("div",{style:{display:"flex",gap:"8px",alignItems:"center"},children:e(ge,{ariaLabel:"Latest type",value:_,onChange:g=>b(g),options:[{value:"tv",label:"TV Shows"},{value:"movie",label:"Movies"}]})})]}),X?e("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(150px, 1fr))",gap:"var(--space-6)"},children:Array.from({length:7}).map((g,z)=>e("div",{className:"skeleton",style:{aspectRatio:"3 / 4",borderRadius:"var(--radius-lg)"}},z))}):j.length>0?e(ee,{carousel:!0,itemCount:j.length,children:j.map(w)}):e("div",{className:H.emptyState,children:e("p",{children:"No latest releases available right now."})})]});case"trending":return e("section",{children:[e("div",{className:H["section-header"],children:[e("div",{className:H["title-wrapper"],children:e("div",{className:"title-stack",children:[e("div",{className:"section-eyebrow",children:"Discover"}),e("div",{className:"section-title",style:{marginBottom:0},children:"Trending"})]})}),e("div",{style:{display:"flex",gap:"8px",alignItems:"center"},children:[e(ge,{ariaLabel:"Trending sort",value:r,onChange:k,options:Rn.map(g=>({value:g.value,label:g.label}))}),e(ge,{ariaLabel:"Trending type",value:u,onChange:g=>l(g),options:[{value:"multi",label:"All"},{value:"tv",label:"TV Shows"},{value:"movie",label:"Movies"}]})]})]}),L?e("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(150px, 1fr))",gap:"var(--space-6)"},children:Array.from({length:7}).map((g,z)=>e("div",{className:"skeleton",style:{aspectRatio:"3 / 4",borderRadius:"var(--radius-lg)"}},z))}):M.length>0?e(ee,{carousel:!0,itemCount:M.length,children:M.map(w)}):e("div",{className:H.emptyState,children:e("p",{children:"No trending content available right now."})})]})}};return e("div",{style:{paddingBottom:"2rem"},children:[e(ee,{title:"Continue Watching",eyebrow:"Pick up where you left off",titleLink:"/tv-watchlist/Continue Watching",loading:i,carousel:!0,collapsible:!0,defaultExpanded:h.length>0,highlight:!0,itemCount:h.length,loadingSkeleton:e("div",{className:"skeleton",style:{aspectRatio:"3 / 4"}}),skeletonCount:7,emptyState:e(ye,{icon:"tv",text:"You haven't watched anything yet. Search TV & Movies and start watching to track progress.",actionLabel:"Browse TV & Movies",onAction:()=>a("/tv-search")}),children:h.map(g=>{const z=g.currentTime??0,q=g.duration??0,Z=g.season??g.lastSeason??1,ce=g.episode??g.lastEpisode??1,Q=g.mediaType==="movie",J=Q?"Movie":`S${Z} E${ce}`,ae=g.completed===!0||g.completed===1||q>0&&z>=q*.8,ne=ae?100:q>0&&z>0?z/q*100:0,Ne=ae?"Watched":q>0?Q?`${re(z)} / ${re(q)}`:`${J} · ${re(z)} / ${re(q)}`:J;return e(_e,{item:{id:g.id,title:g.title,thumbnail:g.poster||"",typeBadge:Q?"Movie":"TV",chapterBadge:J,isAdult:Lt({adult:g.adult===1})},linkTo:Rt(g.mediaType,g.tmdbId,Q?void 0:Z,Q?void 0:ce),hoverIcon:"play",progress:(q>0||ae)&&ne>0?{percent:ne,label:Ne}:void 0,showProgress:!0,metaRow:g.year?e("span",{style:{opacity:.75},children:g.year}):void 0,onRemove:()=>s({libId:g.id,title:g.title}),renderPopup:(de,se)=>e(kt,{item:{id:g.tmdbId??0,title:g.title||"",year:g.year||"",type:g.mediaType||"tv",image:g.poster||""},anchorRect:de,onMouseEnter:se.onMouseEnter,onMouseLeave:se.onMouseLeave,onRequestClose:se.close})},g.id)})}),e(ve,{ariaLabel:"Browse TV",options:An,value:v,onChange:m}),e("div",{className:H.tabContent,children:S()}),e(Oe,{isOpen:!!c,itemName:c?.title,progressKind:"watch",listLabel:"my TV watchlist",alsoRemove:N,onAlsoRemoveChange:p,onClose:()=>{s(null),p(!1)},onConfirm:d})]})};function $n(a){const o=a.currentTime??0,i=a.duration??0,t=(a.trackIndex??0)+1;return i>0?`Track ${t} · ${re(o)} / ${re(i)}`:a.trackLabel?`Track ${t} · ${a.trackLabel}`:`Track ${t}`}const xn=({title:a="Continue Listening",limit:o=24,titleLink:i,showEmptyState:t=!0})=>{const n=te(),{data:c,isLoading:s}=Mt(o),[N,p]=D(null),v=c?.data??[];return e(ie,{children:[e(ee,{title:a,eyebrow:"Pick up where you left off",titleLink:i??"/listening-list/Continue Listening",loading:s,carousel:!0,collapsible:!0,defaultExpanded:v.length>0,highlight:!0,itemCount:v.length,loadingSkeleton:e("div",{className:"skeleton",style:{aspectRatio:"16 / 9"}}),skeletonCount:7,emptyState:t?e(ye,{icon:"headphones",text:"You haven't listened to anything yet. Browse ASMR and play a track to start tracking.",actionLabel:"Browse ASMR",onAction:()=>n("/asmr")}):void 0,children:v.map(m=>{const _=m.currentTime??0,b=m.duration??0,r=m.rjCode||m.id;return e(_e,{item:{id:m.id,title:m.title,thumbnail:m.thumbnail||"",chapterBadge:`Track ${(m.trackIndex??0)+1}`,isAdult:!!m.isAdult},linkTo:`/asmr/${encodeURIComponent(r)}`,hoverIcon:"play",layout:"horizontal",progress:b>0?{percent:Math.min(100,_/b*100),label:$n(m)??""}:void 0,showProgress:!0,display:{elements:{poster:{typeBadge:!1,chapterBadge:!0,adultBadge:!0,removeButton:!0},info:{title:!0,mobileBadges:!0,progress:!0,meta:!1}}},onRemove:()=>p({workId:m.id,title:m.title}),rawThumbnail:!0},m.id)})}),e(xt,{workId:N?N.workId:null,title:N?.title,onClose:()=>p(null)})]})},Mn=()=>e("div",{style:{paddingBottom:"2rem"},children:e(xn,{})}),Bn={10759:"Action & Adventure",16:"Animation",35:"Comedy",80:"Crime",18:"Drama",10765:"Sci-Fi & Fantasy",9648:"Mystery",28:"Action",12:"Adventure",14:"Fantasy",27:"Horror",878:"Sci-Fi",53:"Thriller",10749:"Romance"},Pn=({items:a})=>{const o=te(),i=Y(()=>a.slice(0,6).map(t=>{const n=$t(t.type,t.id);return{key:String(t.id),bannerSrc:t.backdrop?t.backdrop:t.image,posterSrc:t.image,posterAlt:t.title,title:t.title,detailTo:n,score:t.vote_average>0?Number(t.vote_average).toFixed(1):null,metaItems:[t.type==="tv"?"TV Show":"Movie",t.year].filter(Boolean),tags:t.genre_ids.slice(0,3).map(c=>Bn[c]).filter(Boolean),synopsis:t.overview.length>200?t.overview.slice(0,200)+"...":t.overview,primaryLabel:"Watch Now",primaryIcon:"play",onPrimary:()=>o(n),onDetails:()=>o(n)}}),[a,o]);return e(be,{slides:i})},Dn=({mangaList:a})=>{const o=te(),i=Y(()=>a.slice(0,6).map(t=>({key:t.id,bannerSrc:t.cover||"",posterSrc:t.cover,posterAlt:t.title,title:t.title,detailTo:`/manga/mangadex/${t.id}`,metaItems:[t.year?String(t.year):void 0,t.status??void 0].filter(n=>!!n),tags:t.tags.slice(0,3),synopsis:t.description?.slice(0,200)||"",primaryLabel:"Read Now",primaryIcon:"book",onPrimary:()=>o(`/manga/mangadex/${t.id}`),onDetails:()=>o(`/manga/mangadex/${t.id}`)})),[a,o]);return e(be,{slides:i})},En="_posterLandscape_1smau_1",Wn={posterLandscape:En};function zn(a){const o=a.availableEpisodes?.sub;if(typeof o=="number"&&o>0)return o;const i=a.availableEpisodesDetail?.sub,t=a.availableEpisodesDetail?.dub,n=(Array.isArray(i)?i.length:0)+(Array.isArray(t)?t.length:0);return n>0?n:null}const On=({works:a})=>{const o=te(),i=Y(()=>a.slice(0,6).map((t,n)=>{const c=Bt(t),s=`/asmr/${encodeURIComponent(c)}`,N=zn(t);return{key:c||t._id||String(n),bannerSrc:t.thumbnail||"",posterSrc:t.thumbnail,posterAlt:t.name,title:t.name,detailTo:s,metaItems:[t.rating?t.rating.toUpperCase():void 0,N?`${N} track${N===1?"":"s"}`:void 0].filter(p=>!!p),tags:[],synopsis:t.description?.slice(0,160)||"",primaryLabel:"Listen Now",primaryIcon:"play",onPrimary:()=>o(s),onDetails:()=>o(s)}}),[a,o]);return e(be,{slides:i,posterClassName:Wn.posterLandscape})},Fn=[{value:"anime",label:"Anime"},{value:"manga",label:"Manga"},{value:"tv",label:"TV & Movies"},{value:"asmr",label:"ASMR"}],hr=()=>{const a=Je(),o=st(),[i,t]=U.useState(1),[n,c]=D(()=>localStorage.getItem("home_activeTab")||"latest"),[s,N]=D(()=>localStorage.getItem("season_format")||"TV"),p=G(null),{data:v}=Le(i+1,s,n==="season"),{titlePreference:m}=We(),{contentType:_,setContentType:b}=lt(),[r,k]=U.useState(null),[u,l]=U.useState(!1),h=it(),{data:I=[]}=ct(),R=dt(),T=ut(),E=ht();O(()=>{document.title="Home - dango"},[]);const{data:C,isLoading:x}=mt();O(()=>{localStorage.setItem("home_activeTab",n)},[n]),O(()=>{localStorage.setItem("season_format",s),t(1)},[s]),O(()=>{C!==void 0&&C.length===0&&n==="week"&&c("latest")},[C,n]);const{data:W,isLoading:M,fetchNextPage:L,hasNextPage:A,isFetchingNextPage:X}=pt(),j=P(()=>{A&&!X&&!M&&L()},[A,X,M,L]),{data:d,isLoading:w}=gt(),{data:S,isLoading:g}=Qe("all","week",1,_==="tv"),{data:z,isLoading:q}=Pt(_==="asmr"),{data:Z,isLoading:ce}=Nt(),Q=Y(()=>W?.pages||[],[W]),{data:J,isLoading:ae}=Le(i,s,n==="season"),ne=14,Ne=J&&J.length>=ne&&v&&v.length>0,de=et(o.continueWatching.remove.mutationOptions({onSuccess:async()=>{a.invalidateQueries(o.continueWatching.pathFilter()),await a.invalidateQueries({queryKey:["allContinueWatching"]}),A&&Q.length-1<14&&L()}})),se=P(V=>{const K=Q?.find(Te=>String(Te.id)===String(V));if(K){const Te=K[m]||K.name;k({id:V,name:Te})}},[Q,m]),Ye=P(()=>{r&&(de.mutate({showId:r.id}),u&&h.mutate({id:r.id}),k(null),l(!1))},[r,de,h,u]),Ie=[{key:"latest",label:"Latest Releases"},{key:"season",label:"Current Season"},{key:"popular",label:"Trending"}],Ae=C!==void 0&&C.length>0,Xe=Ae?[{key:"week",label:"This Week"},...Ie]:Ie,Re=n==="week"&&!Ae?"latest":n,Ke=()=>{switch(Re){case"latest":return e(oa,{eyebrow:"Fresh episodes"});case"season":return e("section",{style:{marginBottom:"2.5rem"},children:[e("div",{className:H["section-header"],ref:p,children:[e("div",{className:H["title-wrapper"],children:e("div",{className:"title-stack",children:[e("div",{className:"section-eyebrow",children:"This season"}),e("div",{className:"section-title",style:{marginBottom:0},children:"Current Season"})]})}),e("div",{style:{display:"flex",gap:"8px",alignItems:"center"},children:[e(ge,{ariaLabel:"Season format",width:90,value:s,onChange:N,options:[{value:"TV",label:"TV"},{value:"ONA",label:"ONA"},{value:"OVA",label:"OVA"},{value:"MOVIE",label:"Movie"},{value:"ALL",label:"All"},{value:"ADULT",label:"Mature"}]}),e("div",{className:H["pagination-controls"],children:e(tt,{page:i,canGoNext:Ne,onChange:V=>{if(t(V),p.current){const K=p.current.getBoundingClientRect().top+window.scrollY-120;window.scrollTo({top:K,behavior:"smooth"})}},isLoading:ae})})]})]}),e("div",{className:`grid-container ${H.seasonGrid}`,style:{minHeight:"300px",alignContent:"start"},children:ae?e(De,{count:ne}):J?.slice(0,ne).map(V=>e(oe,{anime:V},V._id))})]});case"popular":return e(aa,{title:"Trending",eyebrow:"Discover"});case"week":return e(xe,{title:"This Week",eyebrow:"Aired this week",animeList:C||[],continueWatching:!1,carousel:!0,loading:x});default:return null}};return e("div",{style:{paddingBottom:"2rem"},children:[_==="anime"&&(w&&!d?.length?e(he,{}):d&&d.length>0&&e(dn,{animeList:d})),_==="tv"&&(g&&!S?.results?.length?e(he,{}):S?.results&&S.results.length>0&&e(Pn,{items:S.results})),_==="manga"&&(ce&&!Z?.length?e(he,{}):Z&&Z.length>0&&e(Dn,{mangaList:Z})),_==="asmr"&&(q&&!z?.length?e(he,{}):z&&z.length>0&&e(On,{works:z})),e(ve,{ariaLabel:"Content type",options:Fn,value:_,onChange:b}),_==="manga"?e(kn,{}):_==="tv"?e(Ln,{}):_==="asmr"?e(Mn,{}):e(ie,{children:[e(xe,{title:"Continue Watching",eyebrow:"Pick up where you left off",titleLink:"/watchlist/Continue Watching",animeList:Q,continueWatching:!0,carousel:!0,collapsible:!0,defaultExpanded:Q.length>0,onRemove:se,loading:M,onReachThreshold:j,scrollThreshold:.7,isFetchingNextPage:X,emptyState:e(ye,{icon:"history",text:"You haven't watched anything yet. Start exploring and watch something first!",actionLabel:"Explore Trending",onAction:()=>c("popular")})}),e(_t,{title:"Queue",eyebrow:"Up next",items:I,onRemove:V=>R.mutate({showId:V.showId,episodeNumber:V.episodeNumber}),showClearAll:!0,onClear:()=>T.mutate(),onReorder:V=>E.mutate(V.map(K=>({id:K.id,showId:K.showId,episodeNumber:K.episodeNumber})))}),e(ve,{ariaLabel:"Browse anime",options:Xe.map(V=>({value:V.key,label:V.label})),value:Re,onChange:c}),e("div",{className:H.tabContent,children:Ke()}),e(Ia,{eyebrow:"Never miss an episode"}),e(Oe,{isOpen:!!r,itemName:r?.name,progressKind:"watch",listLabel:"my watchlist",alsoRemove:u,onAlsoRemoveChange:l,onClose:()=>{k(null),l(!1)},onConfirm:Ye})]})]})};export{hr as default};
@@ -0,0 +1 @@
1
+ import{h as R,T as i,d as W,u as e,L as P}from"./vendor-core-8R2fFbyN.js";import{b as C,u as O,a as A}from"./vendor-query-BUTye89G.js";import{t as p,Z as F,d as V,z as S,f as k}from"./index-BXwhFWB_.js";import{I as l}from"./vendor-icons-CDMuNDeL.js";const Y="_header_1j07c_1",q="_fadeIn_1j07c_1",H="_personaBadge_1j07c_9",z="_personaInfo_1j07c_37",E="_personaLabel_1j07c_42",U="_personaValue_1j07c_51",K="_statsGrid_1j07c_57",Q="_slideUpIn_1j07c_1",Z="_statCard_1j07c_65",J="_statIcon_1j07c_82",X="_statInfo_1j07c_98",ee="_statValue_1j07c_103",ae="_statLabel_1j07c_112",te="_wideSection_1j07c_120",se="_sectionHeader_1j07c_132",ne="_yearSelect_1j07c_147",re="_heatmapLayout_1j07c_176",ce="_dayLabels_1j07c_183",le="_heatmapWrapper_1j07c_195",oe="_heatmapMonthLabels_1j07c_201",ie="_heatmapGrid_1j07c_212",de="_heatBox_1j07c_220",he="_hiddenBox_1j07c_229",me="_level0_1j07c_240",pe="_level1_1j07c_243",_e="_level2_1j07c_247",ue="_level3_1j07c_251",ge="_level4_1j07c_255",Ne="_heatmapFooter_1j07c_260",ve="_heatLegend_1j07c_267",ye="_chartsContainer_1j07c_277",be="_chartWrapper_1j07c_285",je="_hourlyChart_1j07c_312",fe="_hourlyBarContainer_1j07c_320",Ce="_hourlyBar_1j07c_320",Se="_hourlyLabel_1j07c_346",ke="_chartSubtext_1j07c_353",Le="_popScale_1j07c_365",Be="_popTrack_1j07c_369",we="_popThumb_1j07c_377",Ie="_popLabels_1j07c_389",De="_popDescription_1j07c_399",xe="_seasonalChart_1j07c_414",Te="_seasonalBarContainer_1j07c_422",Me="_seasonalBar_1j07c_422",$e="_seasonalLabel_1j07c_444",Ge="_genreList_1j07c_452",Re="_genreRow_1j07c_459",We="_genreInfo_1j07c_465",Pe="_genreName_1j07c_472",Oe="_genreCount_1j07c_479",Ae="_genreBarBg_1j07c_486",Fe="_genreBar_1j07c_486",Ve="_warningSection_1j07c_499",Ye="_warningHeader_1j07c_510",qe="_droppedGrid_1j07c_526",He="_droppedCard_1j07c_532",ze="_droppedName_1j07c_549",Ee="_droppedDate_1j07c_556",Ue="_genreGrid_1j07c_597",Ke="_genreCard_1j07c_609",Qe="_rankBadge_1j07c_618",Ze="_rankNumber_1j07c_631",Je="_genreTitle_1j07c_637",Xe="_genreStats_1j07c_645",ea="_posterRow_1j07c_653",aa="_miniPoster_1j07c_660",ta="_genreCardSkeleton_1j07c_674",sa="_pulse_1j07c_1",na="_skeletonRank_1j07c_682",ra="_skeletonTitle_1j07c_696",ca="_skeletonStats_1j07c_709",la="_skeletonPosters_1j07c_721",oa="_recSection_1j07c_752",ia="_recSubtext_1j07c_763",da="_recGrid_1j07c_769",ha="_recCard_1j07c_775",ma="_recCover_1j07c_790",pa="_recInfo_1j07c_798",_a="_recTitle_1j07c_805",ua="_recMatch_1j07c_816",ga="_recMeta_1j07c_822",Na="_recWhy_1j07c_827",va="_recNote_1j07c_832",ya="_recAddBtn_1j07c_838",a={header:Y,fadeIn:q,personaBadge:H,personaInfo:z,personaLabel:E,personaValue:U,statsGrid:K,slideUpIn:Q,statCard:Z,statIcon:J,statInfo:X,statValue:ee,statLabel:ae,wideSection:te,sectionHeader:se,yearSelect:ne,heatmapLayout:re,dayLabels:ce,heatmapWrapper:le,heatmapMonthLabels:oe,heatmapGrid:ie,heatBox:de,hiddenBox:he,level0:me,level1:pe,level2:_e,level3:ue,level4:ge,heatmapFooter:Ne,heatLegend:ve,chartsContainer:ye,chartWrapper:be,hourlyChart:je,hourlyBarContainer:fe,hourlyBar:Ce,hourlyLabel:Se,chartSubtext:ke,popScale:Le,popTrack:Be,popThumb:we,popLabels:Ie,popDescription:De,seasonalChart:xe,seasonalBarContainer:Te,seasonalBar:Me,seasonalLabel:$e,genreList:Ge,genreRow:Re,genreInfo:We,genreName:Pe,genreCount:Oe,genreBarBg:Ae,genreBar:Fe,warningSection:Ve,warningHeader:Ye,droppedGrid:qe,droppedCard:He,droppedName:ze,droppedDate:Ee,genreGrid:Ue,genreCard:Ke,rankBadge:Qe,rankNumber:Ze,genreTitle:Je,genreStats:Xe,posterRow:ea,miniPoster:aa,genreCardSkeleton:ta,pulse:sa,skeletonRank:na,skeletonTitle:ra,skeletonStats:ca,skeletonPosters:la,recSection:oa,recSubtext:ia,recGrid:da,recCard:ha,recCover:ma,recInfo:pa,recTitle:_a,recMatch:ua,recMeta:ga,recWhy:Na,recNote:va,recAddBtn:ya},Sa=()=>{R(()=>{document.title="Insights - dango"},[]);const{data:n,isLoading:L,isError:B}=C({queryKey:["insights"],queryFn:async()=>await p.insights.summary.query()}),{data:w,isLoading:_}=F(),{titlePreference:I}=V(),u=O(),{data:g}=C({queryKey:["insights-recommendations"],queryFn:async()=>await p.insights.recommendations.query(),staleTime:300*1e3,retry:1}),N=A({mutationFn:async t=>{await p.watchlist.add.mutate({id:String(t.id),name:t.title,thumbnail:t.cover||"",status:"Plan to Watch",type:t.format})},onSuccess:()=>{u.invalidateQueries({queryKey:["watchlist"]}),u.invalidateQueries({queryKey:["insights-recommendations"]}),S.success("Added to Plan to Watch")},onError:()=>S.error("Could not add to watchlist")}),v=i(()=>[...g?.candidates||[]].sort((t,s)=>s.matchPct-t.matchPct).slice(0,6),[g]),y=t=>{const s=t.name||t.englishName||t.nativeName||"";switch(I){case"nativeName":return t.nativeName||s;case"englishName":return t.englishName||s;default:return s}},[d,D]=W(new Date().getFullYear()),x=i(()=>{if(!n?.activityGrid)return[new Date().getFullYear()];const t=new Set(n.activityGrid.map(s=>parseInt(s.day.split("-")[0])));return t.add(new Date().getFullYear()),Array.from(t).sort((s,r)=>r-s)},[n]),b=i(()=>{if(!n?.activityGrid)return[];const t=new Map(n.activityGrid.map(m=>[m.day,m.count])),s=[],r=new Date(d,0,1),o=new Date(d,11,31),h=r.getDay(),c=new Date(r);for(c.setDate(c.getDate()-h);(c<=o||c.getDay()!==0)&&!(c>o&&c.getDay()===0);){const m=c.getFullYear(),$=String(c.getMonth()+1).padStart(2,"0"),G=String(c.getDate()).padStart(2,"0"),j=`${m}-${$}-${G}`,f=c<r||c>o;s.push({date:j,count:f?0:t.get(j)||0,month:c.getMonth(),isOutOfRange:f}),c.setDate(c.getDate()+1)}return s},[n,d]),T=i(()=>n?.seasonality?.length?Math.max(...n.seasonality.map(t=>t.seconds),1):0,[n]),M=i(()=>n?.hourlyDist?.length?Math.max(...n.hourlyDist.map(t=>t.count),1):0,[n]);return L||_?e("div",{className:a.loading,children:"Analyzing your anime lifestyle..."}):B?e("div",{className:a.error,children:"Could not load insights. Data might be syncing."}):n?e("div",{className:"page-container",children:[e("div",{className:a.header,children:[e("h2",{className:"section-title",children:"Watch Insights"}),e("div",{className:a.personaBadge,children:[e(l,{name:"user-astronaut"}),e("div",{className:a.personaInfo,children:[e("span",{className:a.personaLabel,children:"Your Persona"}),e("span",{className:a.personaValue,children:n.persona})]})]})]}),e("div",{className:a.statsGrid,children:[e("div",{className:a.statCard,children:[e("div",{className:a.statIcon,style:{background:"rgba(138, 79, 255, 0.2)",color:"var(--accent)"},children:e(l,{name:"clock"})}),e("div",{className:a.statInfo,children:[e("span",{className:a.statValue,children:[n.totalHours,"h"]}),e("span",{className:a.statLabel,children:"Watch Time"})]})]}),e("div",{className:a.statCard,children:[e("div",{className:a.statIcon,style:{background:"rgba(167, 139, 250, 0.2)",color:"#a78bfa"},children:e(l,{name:"bookmark"})}),e("div",{className:a.statInfo,children:[e("span",{className:a.statValue,children:n.totalAnime}),e("span",{className:a.statLabel,children:"Total Anime"})]})]}),e("div",{className:a.statCard,children:[e("div",{className:a.statIcon,style:{background:"rgba(34, 197, 94, 0.2)",color:"#22c55e"},children:e(l,{name:"check-circle"})}),e("div",{className:a.statInfo,children:[e("span",{className:a.statValue,children:n.totalEpisodes}),e("span",{className:a.statLabel,children:"Episodes Watched"})]})]}),e("div",{className:a.statCard,children:[e("div",{className:a.statIcon,style:{background:"rgba(34, 197, 94, 0.2)",color:"#22c55e"},children:e(l,{name:"check-circle"})}),e("div",{className:a.statInfo,children:[e("span",{className:a.statValue,children:[n.completionRate,"%"]}),e("span",{className:a.statLabel,children:"Completion Rate"})]})]}),e("div",{className:a.statCard,children:[e("div",{className:a.statIcon,style:{background:"rgba(45, 212, 191, 0.2)",color:"#2dd4bf"},children:e(l,{name:"tv"})}),e("div",{className:a.statInfo,children:[e("span",{className:a.statValue,children:n.completedAnime}),e("span",{className:a.statLabel,children:"Completed Shows"})]})]}),e("div",{className:a.statCard,children:[e("div",{className:a.statIcon,style:{background:"rgba(239, 68, 68, 0.2)",color:"#ef4444"},children:e(l,{name:"fire"})}),e("div",{className:a.statInfo,children:[e("span",{className:a.statValue,children:n.bingeFactor}),e("span",{className:a.statLabel,children:"Max Daily Binge"})]})]}),e("div",{className:a.statCard,children:[e("div",{className:a.statIcon,style:{background:"rgba(59, 130, 246, 0.2)",color:"#3b82f6"},children:e(l,{name:"history"})}),e("div",{className:a.statInfo,children:[e("span",{className:a.statValue,children:[n.avgSessionMinutes,"m"]}),e("span",{className:a.statLabel,children:"Avg. Session"})]})]}),e("div",{className:a.statCard,children:[e("div",{className:a.statIcon,style:{background:"rgba(251, 191, 36, 0.2)",color:"#fbbf24"},children:e(l,{name:"layer-group"})}),e("div",{className:a.statInfo,children:[e("span",{className:a.statValue,children:[n.avgCompletionDays,"d"]}),e("span",{className:a.statLabel,children:"Avg. Speed"})]})]})]}),e("div",{className:a.wideSection,children:[e("div",{className:a.sectionHeader,children:[e("h3",{children:"Activity"}),e("select",{className:a.yearSelect,value:d,onChange:t=>D(Number(t.currentTarget.value)),children:x.map(t=>e("option",{value:t,children:t},t))})]}),e("div",{className:a.heatmapLayout,children:[e("div",{className:a.dayLabels,children:[e("span",{style:{gridRow:2},children:"Mon"}),e("span",{style:{gridRow:4},children:"Wed"}),e("span",{style:{gridRow:6},children:"Fri"})]}),e("div",{className:a.heatmapWrapper,children:[e("div",{className:a.heatmapMonthLabels,children:(()=>{const t=[];let s=-1;return b.forEach((r,o)=>{if(r.month!==s&&!r.isOutOfRange){const h=Math.floor(o/7)+1;h>(t.length>0?t[t.length-1].props.style.gridColumn+2:-1)&&(t.push(e("span",{style:{gridColumn:h,whiteSpace:"nowrap"},children:new Date(0,r.month).toLocaleString("default",{month:"short"})},o)),s=r.month)}}),t})()}),e("div",{className:a.heatmapGrid,children:b.map((t,s)=>{let r=0;return t.count>0&&!t.isOutOfRange&&(r=1),t.count>2&&!t.isOutOfRange&&(r=2),t.count>5&&!t.isOutOfRange&&(r=3),t.count>10&&!t.isOutOfRange&&(r=4),e("div",{className:`${a.heatBox} ${a[`level${r}`]} ${t.isOutOfRange?a.hiddenBox:""}`,title:t.isOutOfRange?"":`${t.count} episodes on ${t.date}`},s)})}),e("div",{className:a.heatmapFooter,children:e("div",{className:a.heatLegend,children:[e("span",{children:"Less"}),e("div",{className:`${a.heatBox} ${a.level0}`}),e("div",{className:`${a.heatBox} ${a.level1}`}),e("div",{className:`${a.heatBox} ${a.level2}`}),e("div",{className:`${a.heatBox} ${a.level3}`}),e("div",{className:`${a.heatBox} ${a.level4}`}),e("span",{children:"More"})]})})]})]})]}),e("div",{className:a.chartsContainer,children:[e("div",{className:a.chartWrapper,children:[e("h3",{children:"Time Distribution (24h)"}),e("div",{className:a.hourlyChart,children:n.hourlyDist?.map((t,s)=>e("div",{className:a.hourlyBarContainer,children:[e("div",{className:a.hourlyBar,style:{height:`${t.count/M*100||2}%`,width:"100%",maxWidth:"12px"},title:`${t.count} watches at ${t.hour}:00`}),e("span",{className:a.hourlyLabel,style:{visibility:s%4===0?"visible":"hidden"},children:t.hour})]},s))}),e("div",{className:a.chartSubtext,children:(()=>{if(!n.hourlyDist?.length)return"Watch more to see your peak hours!";const t=parseInt([...n.hourlyDist].sort((s,r)=>r.count-s.count)[0].hour);return t>=6&&t<19?"You prefer daytime watching ☀️":"You're a confirmed Night Owl 🦉"})()})]}),e("div",{className:a.chartWrapper,children:[e("h3",{children:"Popularity Bias"}),e("div",{className:a.popScale,children:[e("div",{className:a.popTrack,children:e("div",{className:a.popThumb,style:{left:`${Math.max(0,Math.min(100,100-n.popularityScore*10))}%`}})}),e("div",{className:a.popLabels,children:[e("span",{children:"Mainstream"}),e("span",{children:"Underground"})]})]}),e("p",{className:a.popDescription,children:["Your taste score is ",e("strong",{children:[n.popularityScore,"/10"]}),".",n.popularityScore>=5?" You follow the big hits!":" You're a connoisseur of the obscure!"]})]}),e("div",{className:a.chartWrapper,children:[e("h3",{children:"Monthly Activity"}),e("div",{className:a.seasonalChart,children:n.seasonality?.map((t,s)=>e("div",{className:a.seasonalBarContainer,children:[e("div",{className:a.seasonalBar,style:{height:`${t.seconds/T*100||5}%`,width:"100%",maxWidth:"24px"},title:`${Math.round(t.seconds/3600)}h in ${new Date(0,s).toLocaleString("default",{month:"long"})}`}),e("span",{className:a.seasonalLabel,children:new Date(0,s).toLocaleString("default",{month:"short"})})]},s))})]})]}),e("div",{className:a.genreGrid,children:_?Array.from({length:4}).map((t,s)=>e("div",{className:a.genreCardSkeleton,children:[e("div",{className:a.skeletonRank}),e("div",{className:a.skeletonTitle}),e("div",{className:a.skeletonStats}),e("div",{className:a.skeletonPosters})]},s)):w?.map(t=>e("div",{className:a.genreCard,children:[e("div",{className:a.rankBadge,children:e("span",{className:a.rankNumber,children:t.rank})}),e("h3",{className:a.genreTitle,children:t.name}),e("div",{className:a.genreStats,children:[e("span",{children:[t.count," episodes"]}),e("span",{children:t.meanScore>0?`${t.meanScore.toFixed(1)} avg score`:"—"}),e("span",{children:t.timeWatched})]}),e("div",{className:a.posterRow,children:t.topShows.map(s=>e("img",{src:k(s.thumbnail),alt:y(s),className:a.miniPoster,title:y(s),loading:"lazy",decoding:"async"},s.id))})]},t.name))}),v.length>0&&e("div",{className:a.recSection,children:[e("h3",{children:"Recommended For You"}),e("p",{className:a.recSubtext,children:"From your library taste — updates automatically as you watch"}),e("div",{className:a.recGrid,children:v.map(t=>e("div",{className:a.recCard,children:[t.cover&&e("img",{src:k(t.cover),alt:t.title,className:a.recCover,loading:"lazy",decoding:"async"}),e("div",{className:a.recInfo,children:[e(P,{to:`/anime/${t.id}`,className:a.recTitle,children:t.title}),e("span",{className:a.recMatch,children:[t.matchPct,"% match"]}),e("span",{className:a.recMeta,children:[t.year,t.format,t.episodes?`${t.episodes}ep`:null].filter(Boolean).join(" · ")}),e("span",{className:a.recWhy,children:["Shares ",t.sharedGenres.join(", "),t.exemplars.length>0&&` — like ${t.exemplars.join(", ")}`]}),t.kind==="continue"&&e("span",{className:a.recNote,children:"Continue — you watched the earlier part."}),t.kind==="sequel"&&t.prequelTitle&&e("span",{className:a.recNote,children:['Sequel — start with "',t.prequelTitle,'" first.']}),e("button",{className:a.recAddBtn,onClick:()=>N.mutate(t),disabled:N.isPending,children:"+ Plan to Watch"})]})]},t.id))})]}),n.droppedShows?.length>0&&e("div",{className:a.warningSection,children:[e("div",{className:a.warningHeader,children:[e(l,{name:"exclamation-triangle"}),e("h3",{children:"Dusty Watchlist (Inactive 90+ days)"})]}),e("div",{className:a.droppedGrid,children:n.droppedShows.map(t=>e("div",{className:a.droppedCard,children:[e("span",{className:a.droppedName,children:t.name}),e("span",{className:a.droppedDate,children:["Last watched: ",new Date(t.lastActivity).toLocaleDateString()]})]},t.id))})]})]}):null};export{Sa as default};
@@ -1 +1 @@
1
- import{a as ie,d as N,h as re,u as e}from"./vendor-core-8R2fFbyN.js";import{I as h}from"./vendor-icons-CDMuNDeL.js";import{P as E,S as de}from"./SkeletonGrid-B5loz7ii.js";import{E as oe}from"./ErrorMessage-z4f4WGgP.js";import{w as me,x as he,M as C,B as q}from"./index-CtoKRNLc.js";import{s as l}from"./Watchlist.module-XGtVQr1d.js";function fe({headerTitle:H,headerSubtitle:O,filters:U,filterBy:r,filterBasePath:V,continueFilter:W,statusOptions:$,entries:d,total:o,isLoading:S,error:A,page:M,pageSize:u,onPageChange:w,emptyTitle:Y,emptyFilteredText:j,emptyAllText:F,browseLabel:J,browseTarget:Q,removeListLabel:x,listNoun:f,skipConfirmKey:I,onBulkStatus:X,onBulkRemove:B,onStatusChange:Z,onRemoveItem:R,renderCard:_,modals:K}){const z=ie(),[g,P]=N(!1),[t,i]=N(new Set),[n,p]=N(null),[T,b]=N(!1),{data:y}=me(I),L=he();re(()=>{i(new Set),P(!1)},[r]);const m=r===W,G=String(y)==="true"||String(y)==="1",ee=()=>{P(a=>(a&&i(new Set),!a))},ae=a=>{i(s=>{const c=new Set(s);return c.has(a)?c.delete(a):c.add(a),c})},v=d.map(a=>a.libId),k=v.length>0&&v.every(a=>t.has(a)),le=()=>{i(a=>{const s=new Set(a);if(k)for(const c of v)s.delete(c);else for(const c of v)s.add(c);return s})},te=a=>{t.size!==0&&(X([...t],a),i(new Set))},se=()=>{t.size!==0&&(m||G?(B([...t]),i(new Set)):p({ids:[...t]}))},ne=a=>{m||G?R(a.libId):p({ids:[a.libId],title:a.title})},ce=()=>{n&&(T&&L.mutate({key:I,value:!0}),n.ids.length===1?R(n.ids[0]):B(n.ids),i(new Set),p(null),b(!1))},D=()=>{p(null),b(!1)};return e("div",{className:"page-container",children:[e("header",{className:l.header,children:[e("h2",{className:l.title,children:H}),e("p",{className:l.subtitle,children:O})]}),e("div",{className:l.controls,children:e("div",{className:l.filters,children:U.map(a=>e("button",{className:`${l.filterBtn} ${r===a?l.active:""}`,onClick:()=>z(`${V}/${a==="All"?"":a}`),children:a},a))})}),e("div",{className:l.resultsHeader,children:[e("h3",{className:l.resultsTitle,children:[r,e("span",{className:l.itemCount,children:["(",o," items)"]})]}),e("div",{className:l.headerActions,children:[e("button",{className:`${l.manageBtn} ${g?l.active:""}`,onClick:ee,children:[e(h,{name:"pencil-alt",size:13}),e("span",{children:"Bulk Manage"})]}),o>0&&e(E,{page:M,totalPages:Math.max(1,Math.ceil(o/u)),canGoNext:d.length>=u,onChange:w,isLoading:S})]})]}),g&&e("div",{className:l.manageBar,children:[e("button",{className:l.selectAllBtn,onClick:le,children:[e("span",{className:`${l.selectAllBox} ${k?l.selectAllBoxChecked:""}`,"aria-hidden":"true"}),e("span",{children:k?"Clear Page":"Select All"})]}),e("span",{className:l.manageCount,children:[t.size," selected"]}),e("div",{className:l.manageSpacer}),!m&&e("select",{className:l.manageStatusSelect,value:"",onChange:a=>{a.currentTarget.value&&te(a.currentTarget.value)},disabled:t.size===0,title:"Set status for selected items",children:[e("option",{value:"",children:"Set status…"}),$.map(a=>e("option",{value:a,children:a},a))]}),e("button",{className:l.manageRemoveBtn,onClick:se,disabled:t.size===0,children:[e(h,{name:"trash",size:13}),e("span",{children:m?"Reset Selected":"Remove Selected"})]})]}),S?e(de,{}):A?e(oe,{message:A.message}):d.length===0?e("div",{className:l.emptyState,children:[e("h3",{className:l.emptyTitle,children:Y}),e("p",{className:l.emptyText,children:r!=="All"?j:F}),e("button",{className:l.emptyBtn,onClick:()=>z(Q),children:[e(h,{name:"search",size:14}),e("span",{children:J})]})]}):e("div",{className:l.grid,children:d.map(a=>e("div",{className:`${l.itemWrapper} ${t.has(a.libId)?l.selected:""}`,children:[g&&e("div",{className:l.selectOverlay,onClick:()=>ae(a.libId),title:t.has(a.libId)?"Deselect":"Select",children:e("span",{className:l.selectBadge,children:t.has(a.libId)?e(h,{name:"check",size:12}):null})}),_(a),!m&&!g&&e("div",{className:l.cardActions,children:[e("select",{className:l.statusSelect,value:a.status,onChange:s=>Z(a.libId,s.currentTarget.value),children:$.map(s=>e("option",{value:s,children:s},s))}),e("button",{className:l.removeBtn,onClick:()=>ne(a),title:x,"aria-label":x,children:e(h,{name:"trash",size:12})})]})]},a.key))}),o>0&&e("div",{className:l.bottomPagination,children:e(E,{page:M,totalPages:Math.max(1,Math.ceil(o/u)),canGoNext:d.length>=u,onChange:w,isLoading:S,variant:"labeled"})}),K,e(C,{isOpen:!!n,onClose:D,title:`Remove from ${f}`,children:[e(C.Body,{children:[e("p",{children:n&&n.ids.length===1?`Are you sure you want to remove "${n.title}" from your ${f}?`:`Are you sure you want to remove ${n?.ids.length??0} selected items from your ${f}?`}),e("label",{children:[e("input",{type:"checkbox",checked:T,onChange:a=>b(a.target.checked)}),"Don't ask again"]})]}),e(C.Actions,{children:[e(q,{variant:"secondary",onClick:D,children:"No"}),e(q,{variant:"danger",onClick:ce,children:"Yes"})]})]})]})}export{fe as L};
1
+ import{a as ie,d as N,h as re,u as e}from"./vendor-core-8R2fFbyN.js";import{I as h}from"./vendor-icons-CDMuNDeL.js";import{P as E,S as de}from"./SkeletonGrid-CLEPY9nP.js";import{E as oe}from"./ErrorMessage-z4f4WGgP.js";import{x as me,y as he,M as C,B as q}from"./index-BXwhFWB_.js";import{s as l}from"./Watchlist.module-XGtVQr1d.js";function fe({headerTitle:H,headerSubtitle:O,filters:U,filterBy:r,filterBasePath:V,continueFilter:W,statusOptions:$,entries:d,total:o,isLoading:S,error:A,page:M,pageSize:u,onPageChange:x,emptyTitle:Y,emptyFilteredText:j,emptyAllText:F,browseLabel:J,browseTarget:Q,removeListLabel:I,listNoun:f,skipConfirmKey:w,onBulkStatus:X,onBulkRemove:B,onStatusChange:Z,onRemoveItem:R,renderCard:_,modals:K}){const z=ie(),[g,P]=N(!1),[t,i]=N(new Set),[n,p]=N(null),[T,b]=N(!1),{data:y}=me(w),L=he();re(()=>{i(new Set),P(!1)},[r]);const m=r===W,G=String(y)==="true"||String(y)==="1",ee=()=>{P(a=>(a&&i(new Set),!a))},ae=a=>{i(s=>{const c=new Set(s);return c.has(a)?c.delete(a):c.add(a),c})},v=d.map(a=>a.libId),k=v.length>0&&v.every(a=>t.has(a)),le=()=>{i(a=>{const s=new Set(a);if(k)for(const c of v)s.delete(c);else for(const c of v)s.add(c);return s})},te=a=>{t.size!==0&&(X([...t],a),i(new Set))},se=()=>{t.size!==0&&(m||G?(B([...t]),i(new Set)):p({ids:[...t]}))},ne=a=>{m||G?R(a.libId):p({ids:[a.libId],title:a.title})},ce=()=>{n&&(T&&L.mutate({key:w,value:!0}),n.ids.length===1?R(n.ids[0]):B(n.ids),i(new Set),p(null),b(!1))},D=()=>{p(null),b(!1)};return e("div",{className:"page-container",children:[e("header",{className:l.header,children:[e("h2",{className:l.title,children:H}),e("p",{className:l.subtitle,children:O})]}),e("div",{className:l.controls,children:e("div",{className:l.filters,children:U.map(a=>e("button",{className:`${l.filterBtn} ${r===a?l.active:""}`,onClick:()=>z(`${V}/${a==="All"?"":a}`),children:a},a))})}),e("div",{className:l.resultsHeader,children:[e("h3",{className:l.resultsTitle,children:[r,e("span",{className:l.itemCount,children:["(",o," items)"]})]}),e("div",{className:l.headerActions,children:[e("button",{className:`${l.manageBtn} ${g?l.active:""}`,onClick:ee,children:[e(h,{name:"pencil-alt",size:13}),e("span",{children:"Bulk Manage"})]}),o>0&&e(E,{page:M,totalPages:Math.max(1,Math.ceil(o/u)),canGoNext:d.length>=u,onChange:x,isLoading:S})]})]}),g&&e("div",{className:l.manageBar,children:[e("button",{className:l.selectAllBtn,onClick:le,children:[e("span",{className:`${l.selectAllBox} ${k?l.selectAllBoxChecked:""}`,"aria-hidden":"true"}),e("span",{children:k?"Clear Page":"Select All"})]}),e("span",{className:l.manageCount,children:[t.size," selected"]}),e("div",{className:l.manageSpacer}),!m&&e("select",{className:l.manageStatusSelect,value:"",onChange:a=>{a.currentTarget.value&&te(a.currentTarget.value)},disabled:t.size===0,title:"Set status for selected items",children:[e("option",{value:"",children:"Set status…"}),$.map(a=>e("option",{value:a,children:a},a))]}),e("button",{className:l.manageRemoveBtn,onClick:se,disabled:t.size===0,children:[e(h,{name:"trash",size:13}),e("span",{children:m?"Reset Selected":"Remove Selected"})]})]}),S?e(de,{}):A?e(oe,{message:A.message}):d.length===0?e("div",{className:l.emptyState,children:[e("h3",{className:l.emptyTitle,children:Y}),e("p",{className:l.emptyText,children:r!=="All"?j:F}),e("button",{className:l.emptyBtn,onClick:()=>z(Q),children:[e(h,{name:"search",size:14}),e("span",{children:J})]})]}):e("div",{className:l.grid,children:d.map(a=>e("div",{className:`${l.itemWrapper} ${t.has(a.libId)?l.selected:""}`,children:[g&&e("div",{className:l.selectOverlay,onClick:()=>ae(a.libId),title:t.has(a.libId)?"Deselect":"Select",children:e("span",{className:l.selectBadge,children:t.has(a.libId)?e(h,{name:"check",size:12}):null})}),_(a),!m&&!g&&e("div",{className:l.cardActions,children:[e("select",{className:l.statusSelect,value:a.status,onChange:s=>Z(a.libId,s.currentTarget.value),children:$.map(s=>e("option",{value:s,children:s},s))}),e("button",{className:l.removeBtn,onClick:()=>ne(a),title:I,"aria-label":I,children:e(h,{name:"trash",size:12})})]})]},a.key))}),o>0&&e("div",{className:l.bottomPagination,children:e(E,{page:M,totalPages:Math.max(1,Math.ceil(o/u)),canGoNext:d.length>=u,onChange:x,isLoading:S,variant:"labeled"})}),K,e(C,{isOpen:!!n,onClose:D,title:`Remove from ${f}`,children:[e(C.Body,{children:[e("p",{children:n&&n.ids.length===1?`Are you sure you want to remove "${n.title}" from your ${f}?`:`Are you sure you want to remove ${n?.ids.length??0} selected items from your ${f}?`}),e("label",{children:[e("input",{type:"checkbox",checked:T,onChange:a=>b(a.target.checked)}),"Don't ask again"]})]}),e(C.Actions,{children:[e(q,{variant:"secondary",onClick:D,children:"No"}),e(q,{variant:"danger",onClick:ce,children:"Yes"})]})]})]})}export{fe as L};
@@ -1 +1 @@
1
- import{n as U,d as k,h as L,T as E,u,S as y}from"./vendor-core-8R2fFbyN.js";import{M as F}from"./MediaCard-DpKoY-1j.js";import{L as N}from"./LibraryListPage-D3hTqTRU.js";import{u as _,A as q}from"./useAsmrPopup-cT_Uu41e.js";import{A as z}from"./AsmrResetProgressModal-Gs0GmVaT.js";import{e as h}from"./index-CtoKRNLc.js";import{m as O,u as Q,n as Y,o as D,e as G,p as H,q as K,r as Z,A as T,k as J}from"./useAsmr-CB9THf0m.js";import"./vendor-ui-CUDCvRS_.js";import"./vendor-icons-CDMuNDeL.js";import"./useIsMobile-Dm_b6Ob3.js";import"./SkeletonGrid-B5loz7ii.js";import"./ErrorMessage-z4f4WGgP.js";import"./Watchlist.module-XGtVQr1d.js";import"./Asmr.module-ChUXDZKx.js";import"./ResetProgressModal-DWeiO-hs.js";import"./vendor-query-BXRECSI6.js";const V=["All","Continue Listening",...T],A=24;function W(a){const d=a.currentTime??0,i=a.duration??0,r=(a.trackIndex??0)+1;return i>0?`Track ${r} · ${h(d)} / ${h(i)}`:`Track ${r}`}function bt(){const{filter:a="All"}=U(),[d,i]=k(1),[r,m]=k(null);L(()=>{document.title="Listening List - dango"},[]),L(()=>{i(1)},[a]);const o=a==="Continue Listening",n=O(o?"All":a,d,A),l=Q(100),f=Y(),C=D(),{toggle:v,bookmarkedIds:R}=G(),{popup:s,openPopup:I,scheduleClose:c,cancelClose:p,closePopup:B}=_(),P=H(),S=K(),j=Z(),M=E(()=>o?(l.data?.data??[]).map(t=>{const e=t.currentTime??0,g=t.duration??0,b=t.rjCode||t.id;return{key:t.id,libId:t.id,rjCode:b,title:t.title,thumbnail:t.thumbnail||"",status:t.status,isAdult:!!t.isAdult,trackLabel:`Track ${(t.trackIndex??0)+1}`,progressPercent:g>0?Math.min(100,e/g*100):0,progressLabel:W(t),detailTarget:`/asmr/${encodeURIComponent(b)}`}}):(n.data?.data??[]).map(t=>{const e=t.rjCode||t.id;return{key:t.id,libId:t.id,rjCode:e,title:t.title,thumbnail:t.thumbnail||"",status:t.status,isAdult:!!t.isAdult,trackLabel:t.lastTrackIndex!==null&&t.lastTrackIndex!==void 0?`Track ${t.lastTrackIndex+1}`:void 0,progressPercent:void 0,progressLabel:void 0,detailTarget:`/asmr/${encodeURIComponent(e)}`}}),[o,l.data,n.data]),w=o?l.data?.total??0:n.data?.total??0,x=o?l.isLoading:n.isLoading,$=o?l.error:n.error;return u(N,{headerTitle:"My Listening List",headerSubtitle:"Track and manage your ASMR collection",filters:V,filterBy:a,filterBasePath:"/listening-list",continueFilter:"Continue Listening",statusOptions:[...T],entries:M,total:w,isLoading:x,error:$,page:d,pageSize:A,onPageChange:i,emptyTitle:"Your listening list is looking a bit lonely",emptyFilteredText:"No works match this filter.",emptyAllText:"Let's find something to listen to!",browseLabel:"Browse ASMR",browseTarget:"/asmr",removeListLabel:"Remove from Listening List",listNoun:"listening list",skipConfirmKey:"asmrSkipRemoveConfirmation",onBulkStatus:(t,e)=>P.mutate({ids:t,status:e}),onBulkRemove:t=>{o?j.mutate(t):S.mutate(t)},onStatusChange:(t,e)=>C.mutate({id:t,status:e}),onRemoveItem:t=>f.mutate(t),renderCard:t=>u(F,{item:{id:t.libId,title:t.title,thumbnail:t.thumbnail,typeBadge:t.rjCode||void 0,chapterBadge:t.trackLabel??null,isAdult:t.isAdult},linkTo:t.detailTarget,hoverIcon:"info",layout:"horizontal",showInfoButton:!o,progress:t.progressPercent!==void 0&&t.progressLabel?{percent:t.progressPercent,label:t.progressLabel}:void 0,showProgress:o,display:{elements:{poster:{typeBadge:!0,chapterBadge:!0,adultBadge:!0},info:{title:!0,mobileBadges:!0,progress:!0,meta:!1}}},onRemove:o?()=>m(t):void 0,onOpenDetails:o?void 0:e=>I(e,{rjCode:t.rjCode,title:t.title,thumbnail:t.thumbnail,isAdult:t.isAdult,listenTarget:t.detailTarget,progressLabel:t.progressLabel}),onPopupHoverIntent:e=>e?p():c(),rawThumbnail:!0}),modals:u(y,{children:[u(z,{workId:r?r.libId:null,title:r?.title,onClose:()=>m(null)}),s&&u(q,{data:s.data,anchorRect:s.rect,bookmarked:R.has(J(s.data.rjCode)),onToggleBookmark:()=>v({rjCode:s.data.rjCode,title:s.data.title,thumbnail:s.data.thumbnail||"",isAdult:s.data.isAdult}),onMouseEnter:p,onMouseLeave:c,onRequestClose:B})]})})}export{bt as default};
1
+ import{n as U,d as k,h as L,T as E,u,S as y}from"./vendor-core-8R2fFbyN.js";import{M as F}from"./MediaCard-B5584Cq9.js";import{L as N}from"./LibraryListPage-HzuDavbb.js";import{u as _,A as q}from"./useAsmrPopup-e4zNN9ig.js";import{A as z}from"./AsmrResetProgressModal-CKYm-8cp.js";import{e as h}from"./index-BXwhFWB_.js";import{m as O,u as Q,n as Y,o as D,e as G,p as H,q as K,r as Z,A as T,k as J}from"./useAsmr-DIwIsJXF.js";import"./vendor-ui-CUDCvRS_.js";import"./vendor-icons-CDMuNDeL.js";import"./useIsMobile-Dm_b6Ob3.js";import"./SkeletonGrid-CLEPY9nP.js";import"./ErrorMessage-z4f4WGgP.js";import"./Watchlist.module-XGtVQr1d.js";import"./Asmr.module-ChUXDZKx.js";import"./ResetProgressModal-CcStlbhP.js";import"./vendor-query-BUTye89G.js";const V=["All","Continue Listening",...T],A=24;function W(a){const d=a.currentTime??0,i=a.duration??0,r=(a.trackIndex??0)+1;return i>0?`Track ${r} · ${h(d)} / ${h(i)}`:`Track ${r}`}function bt(){const{filter:a="All"}=U(),[d,i]=k(1),[r,m]=k(null);L(()=>{document.title="Listening List - dango"},[]),L(()=>{i(1)},[a]);const o=a==="Continue Listening",n=O(o?"All":a,d,A),l=Q(100),f=Y(),C=D(),{toggle:v,bookmarkedIds:R}=G(),{popup:s,openPopup:I,scheduleClose:c,cancelClose:p,closePopup:B}=_(),P=H(),S=K(),j=Z(),M=E(()=>o?(l.data?.data??[]).map(t=>{const e=t.currentTime??0,g=t.duration??0,b=t.rjCode||t.id;return{key:t.id,libId:t.id,rjCode:b,title:t.title,thumbnail:t.thumbnail||"",status:t.status,isAdult:!!t.isAdult,trackLabel:`Track ${(t.trackIndex??0)+1}`,progressPercent:g>0?Math.min(100,e/g*100):0,progressLabel:W(t),detailTarget:`/asmr/${encodeURIComponent(b)}`}}):(n.data?.data??[]).map(t=>{const e=t.rjCode||t.id;return{key:t.id,libId:t.id,rjCode:e,title:t.title,thumbnail:t.thumbnail||"",status:t.status,isAdult:!!t.isAdult,trackLabel:t.lastTrackIndex!==null&&t.lastTrackIndex!==void 0?`Track ${t.lastTrackIndex+1}`:void 0,progressPercent:void 0,progressLabel:void 0,detailTarget:`/asmr/${encodeURIComponent(e)}`}}),[o,l.data,n.data]),w=o?l.data?.total??0:n.data?.total??0,x=o?l.isLoading:n.isLoading,$=o?l.error:n.error;return u(N,{headerTitle:"My Listening List",headerSubtitle:"Track and manage your ASMR collection",filters:V,filterBy:a,filterBasePath:"/listening-list",continueFilter:"Continue Listening",statusOptions:[...T],entries:M,total:w,isLoading:x,error:$,page:d,pageSize:A,onPageChange:i,emptyTitle:"Your listening list is looking a bit lonely",emptyFilteredText:"No works match this filter.",emptyAllText:"Let's find something to listen to!",browseLabel:"Browse ASMR",browseTarget:"/asmr",removeListLabel:"Remove from Listening List",listNoun:"listening list",skipConfirmKey:"asmrSkipRemoveConfirmation",onBulkStatus:(t,e)=>P.mutate({ids:t,status:e}),onBulkRemove:t=>{o?j.mutate({ids:t}):S.mutate({ids:t})},onStatusChange:(t,e)=>C.mutate({id:t,status:e}),onRemoveItem:t=>f.mutate({id:t}),renderCard:t=>u(F,{item:{id:t.libId,title:t.title,thumbnail:t.thumbnail,typeBadge:t.rjCode||void 0,chapterBadge:t.trackLabel??null,isAdult:t.isAdult},linkTo:t.detailTarget,hoverIcon:"info",layout:"horizontal",showInfoButton:!o,progress:t.progressPercent!==void 0&&t.progressLabel?{percent:t.progressPercent,label:t.progressLabel}:void 0,showProgress:o,display:{elements:{poster:{typeBadge:!0,chapterBadge:!0,adultBadge:!0},info:{title:!0,mobileBadges:!0,progress:!0,meta:!1}}},onRemove:o?()=>m(t):void 0,onOpenDetails:o?void 0:e=>I(e,{rjCode:t.rjCode,title:t.title,thumbnail:t.thumbnail,isAdult:t.isAdult,listenTarget:t.detailTarget,progressLabel:t.progressLabel}),onPopupHoverIntent:e=>e?p():c(),rawThumbnail:!0}),modals:u(y,{children:[u(z,{workId:r?r.libId:null,title:r?.title,onClose:()=>m(null)}),s&&u(q,{data:s.data,anchorRect:s.rect,bookmarked:R.has(J(s.data.rjCode)),onToggleBookmark:()=>v({rjCode:s.data.rjCode,title:s.data.title,thumbnail:s.data.thumbnail||"",isAdult:s.data.isAdult}),onMouseEnter:p,onMouseLeave:c,onRequestClose:B})]})})}export{bt as default};