@serifpersia/dango 3.4.2 → 3.4.4

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 (93) hide show
  1. package/README.md +1 -1
  2. package/client/dist/assets/{AnimeCard-CIwTZI3D.js → AnimeCard-4CEz8Buu.js} +1 -1
  3. package/client/dist/assets/AnimeInfo-DyX9qTwg.js +1 -0
  4. package/client/dist/assets/AnimeInfoPage-Dvp_c8vK.js +2 -0
  5. package/client/dist/assets/Asmr-qg3lMAJn.js +2 -0
  6. package/client/dist/assets/{AsmrResetProgressModal-BDpA07Fa.js → AsmrResetProgressModal-BpPlg_Vv.js} +1 -1
  7. package/client/dist/assets/AvSyncCalibrator-C2wu1ydI.css +1 -0
  8. package/client/dist/assets/AvSyncCalibrator-FJllOgOH.js +10 -0
  9. package/client/dist/assets/Home-A7gCeEST.js +1 -0
  10. package/client/dist/assets/Insights-G9IXepHJ.js +1 -0
  11. package/client/dist/assets/{LibraryListPage-DWbcek1i.js → LibraryListPage-Bh2qCJPh.js} +1 -1
  12. package/client/dist/assets/{ListeningList-CcuxBzy1.js → ListeningList-Czv4cTRl.js} +1 -1
  13. package/client/dist/assets/{Manga-DpLaW39C.js → Manga-qdAAS1z7.js} +1 -1
  14. package/client/dist/assets/MangaInfoPage-1rTgZzf2.js +1 -0
  15. package/client/dist/assets/MangaReadPage-CeyxPG6w.js +1 -0
  16. package/client/dist/assets/{MangaResetProgressModal-CYguBG2f.js → MangaResetProgressModal-C_ppotmh.js} +1 -1
  17. package/client/dist/assets/Mature-Bkhxnr3K.js +1 -0
  18. package/client/dist/assets/{MediaCard-p29DqyKX.js → MediaCard-BQZsutEo.js} +1 -1
  19. package/client/dist/assets/Music-C0rGzSbi.js +1 -0
  20. package/client/dist/assets/{OptionListMenu-C1pvpu8X.js → OptionListMenu-CyfpCBEy.js} +1 -1
  21. package/client/dist/assets/Player-yhiTlpYU.js +56 -0
  22. package/client/dist/assets/PlayerSettings-icy4SfQa.js +1 -0
  23. package/client/dist/assets/{QueueOptionsButton-CWdoe1_I.js → QueueOptionsButton-5eloKF5J.js} +1 -1
  24. package/client/dist/assets/{QueueRail-BBpn9CII.js → QueueRail-DaMjlKL4.js} +1 -1
  25. package/client/dist/assets/Radio-FxGqCxR4.js +1 -0
  26. package/client/dist/assets/{ReadingList-D4xQ9tlw.js → ReadingList-CCm3IAbt.js} +1 -1
  27. package/client/dist/assets/{ResetProgressModal-JFlbXy7W.js → ResetProgressModal-CeI4V3Y5.js} +1 -1
  28. package/client/dist/assets/{Search-D-ocogP-.js → Search-qpILaAiQ.js} +1 -1
  29. package/client/dist/assets/Settings-Bw9M3NGz.js +21 -0
  30. package/client/dist/assets/{SkeletonGrid-N67HqYXx.js → SkeletonGrid-0dY_xMq3.js} +1 -1
  31. package/client/dist/assets/{Trackers-C_SPMGKx.js → Trackers-Zy5GOs0P.js} +2 -2
  32. package/client/dist/assets/Tv-Bx7tGS57.css +1 -0
  33. package/client/dist/assets/Tv-DREwc7BX.js +4 -0
  34. package/client/dist/assets/TvInfo-CHIsVzZ0.js +1 -0
  35. package/client/dist/assets/{TvPopup-DEB6Ufq4.js → TvPopup-D_tVTyZ2.js} +1 -1
  36. package/client/dist/assets/{TvSearch-grOUL0Bc.js → TvSearch-BVxedBW-.js} +1 -1
  37. package/client/dist/assets/{TvWatchlist-CBI21Vge.js → TvWatchlist-BEIwq9R9.js} +1 -1
  38. package/client/dist/assets/{Watchlist-5cDHUoC8.js → Watchlist-CSngjqlz.js} +1 -1
  39. package/client/dist/assets/{hls-DySVERd_.js → hls-D48GVTkk.js} +1 -1
  40. package/client/dist/assets/index-CVB5dYhT.js +178 -0
  41. package/client/dist/assets/{useAnimeInfoData-BMwVSGhZ.js → useAnimeInfoData-DxdOg_B7.js} +1 -1
  42. package/client/dist/assets/useAsmr-ClckxnPe.js +1 -0
  43. package/client/dist/assets/{useAsmrPopup-CY-6b88q.js → useAsmrPopup-Bbgxefy_.js} +1 -1
  44. package/client/dist/assets/useMangaLibrary-B3_BUKVk.js +1 -0
  45. package/client/dist/assets/{useMangaPopup-_pNXvRYJ.js → useMangaPopup-Celk4lzf.js} +1 -1
  46. package/client/dist/assets/{useProviders-CKSedfqb.js → useProviders-pwxPZPHh.js} +1 -1
  47. package/client/dist/assets/useTv-D9sQrDop.js +1 -0
  48. package/client/dist/assets/useTvLibrary-UsQpgBTB.js +1 -0
  49. package/client/dist/index.html +1 -1
  50. package/package.json +3 -3
  51. package/server/dist/app-hono.js +15 -37
  52. package/server/dist/db/drizzle.js +2 -18
  53. package/server/dist/db.js +3 -2
  54. package/server/dist/hono/tv.js +9 -5
  55. package/server/dist/hono/watchlist.js +10 -108
  56. package/server/dist/lib/migration.js +0 -5
  57. package/server/dist/providers/remote-loader.js +40 -1
  58. package/server/dist/providers/remote-types.js +9 -2
  59. package/server/dist/server.js +50 -182
  60. package/server/dist/sync.js +173 -704
  61. package/server/dist/trpc/routers/auth.js +2 -71
  62. package/server/dist/trpc/routers/continue-watching.js +0 -2
  63. package/server/dist/trpc/routers/data.js +0 -1
  64. package/server/dist/trpc/routers/discord.js +8 -0
  65. package/server/dist/trpc/routers/progress.js +95 -1
  66. package/server/dist/trpc/routers/queue.js +0 -2
  67. package/server/dist/trpc/routers/watchlist.js +0 -7
  68. package/server/dist/trpc/validation.js +64 -0
  69. package/server/package.json +2 -2
  70. package/client/dist/assets/AnimeInfo-DlfvDaR8.js +0 -1
  71. package/client/dist/assets/AnimeInfoPage-B3EPwtzx.js +0 -2
  72. package/client/dist/assets/Asmr-DCirAWM6.js +0 -2
  73. package/client/dist/assets/AvSyncCalibrator-BPa6KaGC.css +0 -1
  74. package/client/dist/assets/AvSyncCalibrator-BroSW86T.js +0 -10
  75. package/client/dist/assets/Home-DEjYtHbs.js +0 -1
  76. package/client/dist/assets/Insights-B3b6u8RW.js +0 -1
  77. package/client/dist/assets/MangaInfoPage-B7FPC4a_.js +0 -1
  78. package/client/dist/assets/MangaReadPage-Dx0qAAFe.js +0 -1
  79. package/client/dist/assets/Mature-AScDPmWW.js +0 -1
  80. package/client/dist/assets/Music-DFInMskb.js +0 -1
  81. package/client/dist/assets/Player-D-8zY3cx.js +0 -56
  82. package/client/dist/assets/PlayerSettings-CfJjs_0Q.js +0 -1
  83. package/client/dist/assets/Radio-DCgO5hAS.js +0 -1
  84. package/client/dist/assets/Settings-BsFbgkdy.js +0 -21
  85. package/client/dist/assets/Tv-D7s0Kqqx.js +0 -4
  86. package/client/dist/assets/Tv-ZEA45gXK.css +0 -1
  87. package/client/dist/assets/TvInfo-CrmCSFDF.js +0 -1
  88. package/client/dist/assets/index-HZNJp28e.js +0 -178
  89. package/client/dist/assets/useAsmr-BLc7FwPm.js +0 -1
  90. package/client/dist/assets/useMangaLibrary-XFRTq5Qg.js +0 -1
  91. package/client/dist/assets/useMatureConsent-Cra09TA0.js +0 -1
  92. package/client/dist/assets/useTv-Dizj6G4R.js +0 -1
  93. package/client/dist/assets/useTvLibrary-twjHQ89n.js +0 -1
@@ -1 +1 @@
1
- import{a as ie,d as N,h as re,u as e}from"./vendor-core-DfaOB3Rn.js";import{I as h}from"./vendor-icons-DrybRNxP.js";import{P as E,S as de}from"./SkeletonGrid-N67HqYXx.js";import{E as oe}from"./ErrorMessage-DAxegITP.js";import{x as me,y as he,M as C,B as q}from"./index-HZNJp28e.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
+ import{a as ie,d as N,h as re,u as e}from"./vendor-core-DfaOB3Rn.js";import{I as h}from"./vendor-icons-DrybRNxP.js";import{P as E,S as de}from"./SkeletonGrid-0dY_xMq3.js";import{E as oe}from"./ErrorMessage-DAxegITP.js";import{y as me,A as he,M as C,B as q}from"./index-CVB5dYhT.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:I,emptyTitle:Y,emptyFilteredText:j,emptyAllText:F,browseLabel:J,browseTarget:Q,removeListLabel:w,listNoun:f,skipConfirmKey:x,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(x),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:x,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:I,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:w,"aria-label":w,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:I,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{o as U,d as k,h as L,T as E,u,S as y}from"./vendor-core-DfaOB3Rn.js";import{M as F}from"./MediaCard-p29DqyKX.js";import{L as N}from"./LibraryListPage-DWbcek1i.js";import{u as _,A as q}from"./useAsmrPopup-CY-6b88q.js";import{A as z}from"./AsmrResetProgressModal-BDpA07Fa.js";import{e as h}from"./index-HZNJp28e.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-BLc7FwPm.js";import"./vendor-ui-3qrARCPr.js";import"./vendor-icons-DrybRNxP.js";import"./useIsMobile-Dvx1uJ82.js";import"./SkeletonGrid-N67HqYXx.js";import"./ErrorMessage-DAxegITP.js";import"./Watchlist.module-XGtVQr1d.js";import"./Asmr.module-ChUXDZKx.js";import"./ResetProgressModal-JFlbXy7W.js";import"./vendor-query-BBT5_sHx.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};
1
+ import{o as U,d as k,h as L,T as E,u,S as y}from"./vendor-core-DfaOB3Rn.js";import{M as F}from"./MediaCard-BQZsutEo.js";import{L as N}from"./LibraryListPage-Bh2qCJPh.js";import{u as _,A as q}from"./useAsmrPopup-Bbgxefy_.js";import{A as z}from"./AsmrResetProgressModal-BpPlg_Vv.js";import{g as h}from"./index-CVB5dYhT.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-ClckxnPe.js";import"./vendor-ui-3qrARCPr.js";import"./vendor-icons-DrybRNxP.js";import"./useIsMobile-Dvx1uJ82.js";import"./SkeletonGrid-0dY_xMq3.js";import"./ErrorMessage-DAxegITP.js";import"./Watchlist.module-XGtVQr1d.js";import"./Asmr.module-ChUXDZKx.js";import"./ResetProgressModal-CeI4V3Y5.js";import"./vendor-query-BBT5_sHx.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};
@@ -1 +1 @@
1
- import{p as te,d as N,T as le,h as C,u as a,m as ne,S as re}from"./vendor-core-DfaOB3Rn.js";import{I as T}from"./vendor-icons-DrybRNxP.js";import{T as se,M as oe,B as q,R as ie}from"./index-HZNJp28e.js";import{E as ce}from"./ErrorMessage-DAxegITP.js";import{M as de}from"./MediaCard-p29DqyKX.js";import{u as ue,M as ge}from"./useMangaPopup-_pNXvRYJ.js";import{f as pe,u as he,m as D,i as ve,b as me,c as be}from"./useMangaLibrary-XFRTq5Qg.js";import{u as fe}from"./useProviders-CKSedfqb.js";import{s as t}from"./Manga.module-BcfOdsNP.js";import"./vendor-query-BBT5_sHx.js";import"./vendor-ui-3qrARCPr.js";import"./useIsMobile-Dvx1uJ82.js";const Se=[{value:"popular",label:"Popular"},{value:"latest",label:"Latest"},{value:"rating",label:"Top Rated"},{value:"followed",label:"Most Followed"}],ye=[{value:"",label:"Any Status"},{value:"ongoing",label:"Ongoing"},{value:"completed",label:"Completed"},{value:"hiatus",label:"Hiatus"},{value:"cancelled",label:"Cancelled"}],Ne=[{value:"",label:"Any Status"},{value:"publishing",label:"Publishing"},{value:"finished",label:"Finished"},{value:"on hiatus",label:"On Hiatus"},{value:"discontinued",label:"Discontinued"}],Ce=[{value:"",label:"All Types"},{value:"manga",label:"Manga"},{value:"novel",label:"Novel"},{value:"one-shot",label:"One-Shot"},{value:"doujinshi",label:"Doujinshi"}],Te=[{value:"safe",label:"Safe"}],Me=[{value:"safe",label:"Safe"},{value:"suggestive",label:"Suggestive"},{value:"erotica",label:"Erotica"},{value:"pornographic",label:"Pornographic"}],M="agreedToViewMature";function Oe(){const[r,w]=te(),[v,I]=N(()=>localStorage.getItem(M)==="true"),[P,m]=N(!1),[k,L]=N(r.get("q")||""),{options:R,isLoading:$,refetch:z}=fe(),d=le(()=>R.filter(e=>e.kind==="manga").map(e=>({value:e.value,label:e.label})),[R]),b=r.get("provider")||"",i=d.some(e=>e.value===b)?b:d[0]?.value??b,f=r.get("q")||"",u=parseInt(r.get("page")||"1"),B=r.get("sort")||"popular",E=r.get("status")||"",x=r.get("type")||"",g=r.get("rating")||"safe",A=r.get("id")||"";C(()=>{document.title="Manga - dango"},[]),C(()=>{const e=()=>I(localStorage.getItem(M)==="true");return window.addEventListener("focus",e),window.addEventListener("storage",e),()=>{window.removeEventListener("focus",e),window.removeEventListener("storage",e)}},[]);const c=v,S=c?g:"safe",H=c?Me:Te,o=(e,l=!1)=>{const n=new URLSearchParams(r);for(const[h,j]of Object.entries(e))j?n.set(h,j):n.delete(h);l&&n.delete("page"),w(n)},p=pe({provider:i,query:f,page:u,sort:B,status:E,type:x,rating:S,mature:c}),y=p.data?.items??[],G=p.data?.hasNext??!1,{toggle:V,bookmarkedIds:Y}=he(),{popup:s,openPopup:K,scheduleClose:F,cancelClose:O,closePopup:W}=ue();if(C(()=>{L(f)},[f]),A){const e=new URLSearchParams;c&&g!=="safe"&&e.set("rating",g);const l=r.get("chapter")||"";l&&e.set("chapter",l);const n=e.toString()?`?${e.toString()}`:"",h=`/manga/${i}/${encodeURIComponent(A)}${l?`/read${n}`:n}`;return a(ne,{to:h,replace:!0})}const X=e=>{e.preventDefault(),ie(),o({q:k},!0)},Q=e=>{e.target.checked&&!v&&m(!0)},J=()=>{localStorage.setItem(M,"true"),I(!0),m(!1),o({},!0)},U=()=>{m(!1)},_=e=>{const l=new URLSearchParams;c&&g!=="safe"&&l.set("rating",g);const n=l.toString()?`?${l.toString()}`:"";return`/manga/${e.provider}/${encodeURIComponent(e.id)}${n}`},Z=i==="mangapill"?Ne:ye,ee=i==="mangapill",ae=i==="mangadex";return a("div",{className:t.page,children:[a("div",{className:t.header,children:[a("h1",{className:t.pageTitle,children:[a(T,{name:"book"})," Manga"]}),a("form",{className:t.searchForm,onSubmit:X,children:[a("input",{className:t.searchInput,value:k,onChange:e=>L(e.target.value),placeholder:"Search manga titles...","aria-label":"Search manga"}),a("button",{className:t.searchBtn,type:"submit","aria-label":"Search",children:a(T,{name:"search",size:14})})]}),a("select",{className:t.select,value:i,disabled:d.length===0,onChange:e=>{const l=new URLSearchParams(r);l.set("provider",e.target.value),l.delete("page"),l.delete("id"),l.delete("chapter"),l.delete("status"),l.delete("type"),w(l)},"aria-label":"Manga provider",children:d.length===0?a("option",{value:"",children:$?"Loading providers…":"No providers available"}):d.map(e=>a("option",{value:e.value,children:e.label},e.value))}),d.length===0&&!$&&a("button",{className:t.searchBtn,type:"button",onClick:()=>z(),"aria-label":"Retry loading providers",children:a(T,{name:"redo",size:14})})]}),a("div",{className:t.filterRow,children:[i==="mangadex"&&a("select",{className:t.select,value:B,onChange:e=>o({sort:e.target.value},!0),"aria-label":"Sort manga",children:Se.map(e=>a("option",{value:e.value,children:e.label},e.value))}),a("select",{className:t.select,value:E,onChange:e=>o({status:e.target.value},!0),"aria-label":"Filter by status",children:Z.map(e=>a("option",{value:e.value,children:e.label},e.label))}),ee&&a("select",{className:t.select,value:x,onChange:e=>o({type:e.target.value},!0),"aria-label":"Filter by type",children:Ce.filter(e=>e.value!=="doujinshi"||c).map(e=>a("option",{value:e.value,children:e.label},e.value))}),ae&&a("select",{className:t.select,value:S,onChange:e=>o({rating:e.target.value},!0),"aria-label":"Content rating",children:H.map(e=>a("option",{value:e.value,children:e.label},e.value))}),!v&&a("div",{className:t.matureToggleWrap,children:[a("label",{className:t.matureLabel,htmlFor:"manga-mature-toggle",children:"Mature"}),a(se,{id:"manga-mature-toggle",isChecked:!1,onChange:Q})]})]}),p.isError?a(ce,{message:"Failed to load manga. Please try again."}):p.isLoading&&y.length===0?a("div",{className:t.grid,"aria-hidden":!0,children:Array.from({length:12}).map((e,l)=>a("div",{className:t.skeletonCard,children:[a("div",{className:`${t.skeletonThumb} ${t.shimmer}`}),a("div",{className:`${t.skeletonLine} ${t.shimmer}`,style:{width:"88%"}}),a("div",{className:`${t.skeletonLine} ${t.shimmer}`,style:{width:"55%"}})]},l))}):y.length===0?a("p",{className:t.statusMsg,children:"No titles found. Try another search or provider."}):a(re,{children:[a("div",{className:`${t.grid} ${p.isFetching?t.fetching:""}`,children:y.map(e=>{const l=D(e.provider,e.id);return a(de,{item:{id:l,title:e.title,...be(e),thumbnail:me(e.provider,e.cover),typeBadge:e.type||void 0,chapterBadge:e.latestChapter?`Ch. ${e.latestChapter}`:null,isAdult:ve(e)},linkTo:_(e),hoverIcon:"info",display:{elements:{poster:{typeBadge:!0,chapterBadge:!0,adultBadge:!0},info:{title:!0,mobileBadges:!0,progress:!1,meta:!1}}},onOpenDetails:n=>K(n,{provider:e.provider,mangaId:e.id,title:e.title,altTitle:e.altTitle,cover:e.cover,contentRating:e.contentRating,readTarget:_(e),rating:S,mature:c}),onPopupHoverIntent:n=>n?O():F(),rawThumbnail:!0},`${e.provider}-${e.id}`)})}),a("nav",{className:t.pagination,children:[a("button",{className:t.pageBtn,disabled:u<=1,onClick:()=>o({page:String(u-1)}),children:"Previous"}),a("span",{className:t.pageIndicator,children:["Page ",u]}),a("button",{className:t.pageBtn,disabled:!G,onClick:()=>o({page:String(u+1)}),children:"Next"})]})]}),s&&a(ge,{data:s.data,anchorRect:s.rect,bookmarked:Y.has(D(s.data.provider,s.data.mangaId)),onToggleBookmark:()=>V({id:s.data.mangaId,provider:s.data.provider,title:s.data.title,cover:s.data.cover,altTitle:s.data.altTitle??void 0,contentRating:s.data.contentRating}),onMouseEnter:O,onMouseLeave:F,onRequestClose:W}),P&&a(oe,{isOpen:P,title:"Content Warning",onClose:U,children:a("div",{style:{padding:"var(--space-4)",textAlign:"center"},children:[a("p",{children:"This section contains mature content intended for adult audiences."}),a("p",{children:["By proceeding, you confirm that you are ",a("strong",{children:"18 years of age or older"})," (or the age of majority in your jurisdiction) and wish to view this content."]}),a("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 ",a("strong",{children:"Settings"})," page."]}),a("div",{style:{marginTop:"var(--space-4)",display:"flex",gap:"var(--space-2-5)",justifyContent:"center"},children:[a(q,{variant:"secondary",onClick:U,children:"Go Back"}),a(q,{onClick:J,children:"I'm 18+, Continue"})]})]})})]})}export{Oe as default};
1
+ import{p as te,d as N,T as le,h as C,u as a,m as ne,S as re}from"./vendor-core-DfaOB3Rn.js";import{I as T}from"./vendor-icons-DrybRNxP.js";import{T as se,M as oe,B as q,U as ie}from"./index-CVB5dYhT.js";import{E as ce}from"./ErrorMessage-DAxegITP.js";import{M as de}from"./MediaCard-BQZsutEo.js";import{u as ue,M as ge}from"./useMangaPopup-Celk4lzf.js";import{f as pe,u as he,m as D,i as ve,b as me,c as be}from"./useMangaLibrary-B3_BUKVk.js";import{u as fe}from"./useProviders-pwxPZPHh.js";import{s as t}from"./Manga.module-BcfOdsNP.js";import"./vendor-query-BBT5_sHx.js";import"./vendor-ui-3qrARCPr.js";import"./useIsMobile-Dvx1uJ82.js";const Se=[{value:"popular",label:"Popular"},{value:"latest",label:"Latest"},{value:"rating",label:"Top Rated"},{value:"followed",label:"Most Followed"}],ye=[{value:"",label:"Any Status"},{value:"ongoing",label:"Ongoing"},{value:"completed",label:"Completed"},{value:"hiatus",label:"Hiatus"},{value:"cancelled",label:"Cancelled"}],Ne=[{value:"",label:"Any Status"},{value:"publishing",label:"Publishing"},{value:"finished",label:"Finished"},{value:"on hiatus",label:"On Hiatus"},{value:"discontinued",label:"Discontinued"}],Ce=[{value:"",label:"All Types"},{value:"manga",label:"Manga"},{value:"novel",label:"Novel"},{value:"one-shot",label:"One-Shot"},{value:"doujinshi",label:"Doujinshi"}],Te=[{value:"safe",label:"Safe"}],Me=[{value:"safe",label:"Safe"},{value:"suggestive",label:"Suggestive"},{value:"erotica",label:"Erotica"},{value:"pornographic",label:"Pornographic"}],M="agreedToViewMature";function Fe(){const[r,w]=te(),[v,I]=N(()=>localStorage.getItem(M)==="true"),[P,m]=N(!1),[k,L]=N(r.get("q")||""),{options:R,isLoading:$,refetch:z}=fe(),d=le(()=>R.filter(e=>e.kind==="manga").map(e=>({value:e.value,label:e.label})),[R]),b=r.get("provider")||"",i=d.some(e=>e.value===b)?b:d[0]?.value??b,f=r.get("q")||"",u=parseInt(r.get("page")||"1"),B=r.get("sort")||"popular",E=r.get("status")||"",x=r.get("type")||"",g=r.get("rating")||"safe",A=r.get("id")||"";C(()=>{document.title="Manga - dango"},[]),C(()=>{const e=()=>I(localStorage.getItem(M)==="true");return window.addEventListener("focus",e),window.addEventListener("storage",e),()=>{window.removeEventListener("focus",e),window.removeEventListener("storage",e)}},[]);const c=v,S=c?g:"safe",H=c?Me:Te,o=(e,l=!1)=>{const n=new URLSearchParams(r);for(const[h,j]of Object.entries(e))j?n.set(h,j):n.delete(h);l&&n.delete("page"),w(n)},p=pe({provider:i,query:f,page:u,sort:B,status:E,type:x,rating:S,mature:c}),y=p.data?.items??[],G=p.data?.hasNext??!1,{toggle:V,bookmarkedIds:Y}=he(),{popup:s,openPopup:K,scheduleClose:U,cancelClose:F,closePopup:W}=ue();if(C(()=>{L(f)},[f]),A){const e=new URLSearchParams;c&&g!=="safe"&&e.set("rating",g);const l=r.get("chapter")||"";l&&e.set("chapter",l);const n=e.toString()?`?${e.toString()}`:"",h=`/manga/${i}/${encodeURIComponent(A)}${l?`/read${n}`:n}`;return a(ne,{to:h,replace:!0})}const X=e=>{e.preventDefault(),ie(),o({q:k},!0)},Q=e=>{e.target.checked&&!v&&m(!0)},J=()=>{localStorage.setItem(M,"true"),I(!0),m(!1),o({},!0)},O=()=>{m(!1)},_=e=>{const l=new URLSearchParams;c&&g!=="safe"&&l.set("rating",g);const n=l.toString()?`?${l.toString()}`:"";return`/manga/${e.provider}/${encodeURIComponent(e.id)}${n}`},Z=i==="mangapill"?Ne:ye,ee=i==="mangapill",ae=i==="mangadex";return a("div",{className:t.page,children:[a("div",{className:t.header,children:[a("h1",{className:t.pageTitle,children:[a(T,{name:"book"})," Manga"]}),a("form",{className:t.searchForm,onSubmit:X,children:[a("input",{className:t.searchInput,value:k,onChange:e=>L(e.target.value),placeholder:"Search manga titles...","aria-label":"Search manga"}),a("button",{className:t.searchBtn,type:"submit","aria-label":"Search",children:a(T,{name:"search",size:14})})]}),a("select",{className:t.select,value:i,disabled:d.length===0,onChange:e=>{const l=new URLSearchParams(r);l.set("provider",e.target.value),l.delete("page"),l.delete("id"),l.delete("chapter"),l.delete("status"),l.delete("type"),w(l)},"aria-label":"Manga provider",children:d.length===0?a("option",{value:"",children:$?"Loading providers…":"No providers available"}):d.map(e=>a("option",{value:e.value,children:e.label},e.value))}),d.length===0&&!$&&a("button",{className:t.searchBtn,type:"button",onClick:()=>z(),"aria-label":"Retry loading providers",children:a(T,{name:"redo",size:14})})]}),a("div",{className:t.filterRow,children:[i==="mangadex"&&a("select",{className:t.select,value:B,onChange:e=>o({sort:e.target.value},!0),"aria-label":"Sort manga",children:Se.map(e=>a("option",{value:e.value,children:e.label},e.value))}),a("select",{className:t.select,value:E,onChange:e=>o({status:e.target.value},!0),"aria-label":"Filter by status",children:Z.map(e=>a("option",{value:e.value,children:e.label},e.label))}),ee&&a("select",{className:t.select,value:x,onChange:e=>o({type:e.target.value},!0),"aria-label":"Filter by type",children:Ce.filter(e=>e.value!=="doujinshi"||c).map(e=>a("option",{value:e.value,children:e.label},e.value))}),ae&&a("select",{className:t.select,value:S,onChange:e=>o({rating:e.target.value},!0),"aria-label":"Content rating",children:H.map(e=>a("option",{value:e.value,children:e.label},e.value))}),!v&&a("div",{className:t.matureToggleWrap,children:[a("label",{className:t.matureLabel,htmlFor:"manga-mature-toggle",children:"Mature"}),a(se,{id:"manga-mature-toggle",isChecked:!1,onChange:Q})]})]}),p.isError?a(ce,{message:"Failed to load manga. Please try again."}):p.isLoading&&y.length===0?a("div",{className:t.grid,"aria-hidden":!0,children:Array.from({length:12}).map((e,l)=>a("div",{className:t.skeletonCard,children:[a("div",{className:`${t.skeletonThumb} ${t.shimmer}`}),a("div",{className:`${t.skeletonLine} ${t.shimmer}`,style:{width:"88%"}}),a("div",{className:`${t.skeletonLine} ${t.shimmer}`,style:{width:"55%"}})]},l))}):y.length===0?a("p",{className:t.statusMsg,children:"No titles found. Try another search or provider."}):a(re,{children:[a("div",{className:`${t.grid} ${p.isFetching?t.fetching:""}`,children:y.map(e=>{const l=D(e.provider,e.id);return a(de,{item:{id:l,title:e.title,...be(e),thumbnail:me(e.provider,e.cover),typeBadge:e.type||void 0,chapterBadge:e.latestChapter?`Ch. ${e.latestChapter}`:null,isAdult:ve(e)},linkTo:_(e),hoverIcon:"info",display:{elements:{poster:{typeBadge:!0,chapterBadge:!0,adultBadge:!0},info:{title:!0,mobileBadges:!0,progress:!1,meta:!1}}},onOpenDetails:n=>K(n,{provider:e.provider,mangaId:e.id,title:e.title,altTitle:e.altTitle,cover:e.cover,contentRating:e.contentRating,readTarget:_(e),rating:S,mature:c}),onPopupHoverIntent:n=>n?F():U(),rawThumbnail:!0},`${e.provider}-${e.id}`)})}),a("nav",{className:t.pagination,children:[a("button",{className:t.pageBtn,disabled:u<=1,onClick:()=>o({page:String(u-1)}),children:"Previous"}),a("span",{className:t.pageIndicator,children:["Page ",u]}),a("button",{className:t.pageBtn,disabled:!G,onClick:()=>o({page:String(u+1)}),children:"Next"})]})]}),s&&a(ge,{data:s.data,anchorRect:s.rect,bookmarked:Y.has(D(s.data.provider,s.data.mangaId)),onToggleBookmark:()=>V({id:s.data.mangaId,provider:s.data.provider,title:s.data.title,cover:s.data.cover,altTitle:s.data.altTitle??void 0,contentRating:s.data.contentRating}),onMouseEnter:F,onMouseLeave:U,onRequestClose:W}),P&&a(oe,{isOpen:P,title:"Content Warning",onClose:O,children:a("div",{style:{padding:"var(--space-4)",textAlign:"center"},children:[a("p",{children:"This section contains mature content intended for adult audiences."}),a("p",{children:["By proceeding, you confirm that you are ",a("strong",{children:"18 years of age or older"})," (or the age of majority in your jurisdiction) and wish to view this content."]}),a("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 ",a("strong",{children:"Settings"})," page."]}),a("div",{style:{marginTop:"var(--space-4)",display:"flex",gap:"var(--space-2-5)",justifyContent:"center"},children:[a(q,{variant:"secondary",onClick:O,children:"Go Back"}),a(q,{onClick:J,children:"I'm 18+, Continue"})]})]})})]})}export{Fe as default};
@@ -0,0 +1 @@
1
+ import{u as e,a as Q,d as z,S as E,o as O,p as G,T as $,h as Y}from"./vendor-core-DfaOB3Rn.js";import{I as x}from"./vendor-icons-DrybRNxP.js";import{B as M,e as H,d as J}from"./index-CVB5dYhT.js";import{E as K}from"./ErrorMessage-DAxegITP.js";import{b as D,g as V,f as U,h as j,j as X,m as A,k as Z,l as ee,n as te,r as ae,o as re,p as ne,q as se,s as ie,M as oe}from"./useMangaLibrary-B3_BUKVk.js";import{s as r}from"./Manga.module-BcfOdsNP.js";import"./vendor-query-BBT5_sHx.js";const le=({detail:a,altTitle:c,onBack:b,onOpenChapter:v,bookmarkButton:n,statusSelect:g,primaryAction:k,progressByChapter:d})=>{const h=[a.type,a.status,a.year?String(a.year):"",a.author?`by ${a.author}`:""].filter(Boolean);return e("div",{children:[e("button",{className:r.backBtn,onClick:b,children:[e(x,{name:"chevron-left",size:12})," Back to browse"]}),e("div",{className:r.detail,children:[a.cover&&e("img",{className:r.detailCover,src:D(a.provider,a.cover),alt:a.title,decoding:"async",draggable:!1}),e("div",{className:r.detailInfo,children:[e("h2",{className:r.detailTitle,children:a.title}),c&&e("p",{className:r.detailAltTitle,children:["Also known as: ",c]}),h.length>0&&e("div",{className:r.detailMeta,children:h.map(t=>e("span",{className:r.badge,children:t},t))}),a.genres&&a.genres.length>0&&e("div",{className:r.detailMeta,children:a.genres.map(t=>e("span",{className:r.badge,children:t},t))}),a.description&&e("p",{className:r.detailDesc,children:a.description}),(n||g||k)&&e("div",{className:r.detailActions,children:[k,n,g]})]})]}),e("h3",{className:r.detailTitle,style:{fontSize:"1rem"},children:["Chapters (",a.chapters.length,")"]}),a.chapters.length===0?e("p",{className:r.statusMsg,children:"No chapters found for this title on this provider."}):e("div",{className:r.chapterList,children:a.chapters.map(t=>{const o=d?.get(t.id),p=!!o&&o.pageCount>0&&o.page>=o.pageCount;return e("button",{className:`${r.chapterRow} ${p?r.chapterDone:""}`,onClick:()=>v(t),title:t.externalUrl?"External only — opens on source site":void 0,children:[e("span",{children:["Ch. ",t.number,t.title?` — ${t.title}`:""]}),e("span",{className:r.chapterMeta,children:[o&&o.pageCount>0?p?"read":`p. ${o.page}/${o.pageCount}`:"",t.group,t.externalUrl?"external":""].filter(Boolean).join(" · ")})]},t.id)})})]})},ce=({libId:a,anilistId:c})=>{const b=Q(),v=V(a),n=v.data?.item,[g,k]=z(null),[d,h]=z(null),t=g??n?.title??"",o=U({provider:"mangadex",query:t,page:1,sort:"",status:"",type:"",rating:"safe",mature:!1},!!t),p=U({provider:"mangapill",query:t,page:1,sort:"",status:"",type:"",rating:"safe",mature:!1},!!t),S=j(),y=X(),B=async s=>{const u=A(s.provider,s.id);h(u);try{await S.mutateAsync({provider:s.provider,mangaId:s.id,title:s.title,cover:s.cover,altTitle:s.altTitle,contentRating:s.contentRating,silent:!0}),await y.mutateAsync({id:u,anilistId:c}),b(`/manga/${s.provider}/${encodeURIComponent(s.id)}`)}catch{return}finally{h(null)}},C=(s,u,I)=>e("div",{style:{marginTop:"12px"},children:[e("div",{style:{fontWeight:600,textTransform:"capitalize",marginBottom:"6px"},children:s}),I?e("div",{style:{color:"var(--text-tertiary)",fontSize:"0.85rem"},children:"Searching…"}):!u||u.length===0?e("div",{style:{color:"var(--text-tertiary)",fontSize:"0.85rem"},children:"No matches."}):u.slice(0,6).map(l=>{const T=A(l.provider,l.id),N=d===T;return e("div",{style:{display:"flex",alignItems:"center",gap:"10px",padding:"6px 0",borderTop:"1px solid var(--border, #223)"},children:[l.cover&&e("img",{src:D(l.provider,l.cover),alt:"",loading:"lazy",style:{width:"34px",height:"48px",objectFit:"cover",borderRadius:"4px"}}),e("div",{style:{flex:1,minWidth:0},children:[e("div",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:l.title}),l.latestChapter&&e("div",{style:{color:"var(--text-tertiary)",fontSize:"0.75rem"},children:l.latestChapter})]}),e(M,{onClick:()=>B(l),disabled:N,children:[e(x,{name:"external-link-alt",size:12})," ",N?"Linking…":"Link"]})]},T)})]});return e("div",{children:[e("button",{onClick:()=>b("/manga"),style:{background:"none",border:"none",color:"var(--accent)",cursor:"pointer",marginBottom:"12px"},children:[e(x,{name:"chevron-left",size:12})," Back to browse"]}),v.isLoading?e("div",{style:{color:"var(--text-tertiary)"},children:"Loading library entry…"}):n?e(E,{children:[e("div",{style:{display:"flex",gap:"12px",alignItems:"center"},children:[n.cover&&e("img",{src:n.cover,alt:"",style:{width:"64px",height:"90px",objectFit:"cover",borderRadius:"6px"}}),e("div",{children:[e("h2",{style:{margin:"0 0 4px"},children:n.title}),e("div",{style:{color:"var(--text-tertiary)",fontSize:"0.85rem"},children:["Tracked on AniList",n.lastChapterNumber?` · Ch. ${n.lastChapterNumber}`:"",n.status?` · ${n.status}`:""]})]})]}),e("p",{style:{color:"var(--text-tertiary)",fontSize:"0.85rem",marginTop:"12px"},children:"AniList doesn't host chapters. Search your providers below and link the matching manga — your AniList status and chapter progress will sync to it from now on."}),e("div",{style:{display:"flex",gap:"8px",marginTop:"8px"},children:e("input",{type:"text",value:g??n.title,onChange:s=>k(s.target.value),placeholder:"Search providers…",style:{flex:1,padding:"8px 10px",borderRadius:"6px",border:"1px solid var(--border, #223)",background:"var(--bg-secondary, transparent)",color:"inherit"}})}),C("mangadex",o.data?.items,o.isLoading),C("mangapill",p.data?.items,p.isLoading)]}):e("div",{style:{color:"var(--text-tertiary)"},children:"This AniList entry is no longer in your library."})]})};function ye(){const{provider:a="",id:c=""}=O(),[b]=G(),v=Q(),{hasConsent:n}=H(),g=b.get("rating")||"safe",k=n?g:"safe",d=a&&c?A(a,c):void 0,h=Z(a||null,c||null,k,n),t=h.data,o=ee(d),p=te(d),{titlePreference:S}=J(),y=$(()=>t&&{...t,title:ae(t,S)},[t,S]),B=j(),C=re(),s=ne();Y(()=>{y&&(document.title=`${y.title} - dango`)},[y]);const u=$(()=>{const i=new Map;for(const m of p.data?.progress??[])i.set(m.chapterId,m);return i},[p.data]),I=a.toLowerCase()==="anilist"&&/^\d+$/.test(c)?parseInt(c,10):null,l=o.data?.inLibrary??!1,T=o.data?.status??"Reading",N=$(()=>(t?.chapters??[]).filter(i=>!i.externalUrl),[t]),f=$(()=>{if(!t)return null;const i=[...p.data?.progress??[]].sort((m,L)=>L.updatedAt-m.updatedAt);for(const m of i){const L=t.chapters.find(w=>w.id===m.chapterId);if(L&&!L.externalUrl)return L;const P=se(m.chapterId);if(P!=null){const w=ie(t.chapters,P);if(w&&!w.externalUrl)return w}}return N[0]??null},[t,p.data,N]),q=f?u.get(f.id):void 0,F=(p.data?.progress?.length??0)>0,W=f&&(q||F)?`Continue Ch. ${f?.number}`:"Start Reading",R=i=>{if(i.externalUrl){window.open(i.externalUrl,"_blank","noopener,noreferrer");return}const m=new URLSearchParams;m.set("chapter",i.id),n&&g!=="safe"&&m.set("rating",g),v(`/manga/${a}/${encodeURIComponent(c)}/read?${m.toString()}`)},_=()=>{!t||!d||(l?C.mutate(d):B.mutate({provider:a,mangaId:c,title:t.title,cover:t.cover,author:t.author,altTitle:t.altTitle,contentRating:t.contentRating}))};return e("div",{className:r.page,children:h.isLoading?e("div",{"aria-hidden":!0,children:[e("div",{className:`${r.skeletonThumb} ${r.shimmer}`,style:{maxWidth:"12rem"}}),e("div",{className:`${r.skeletonLine} ${r.shimmer}`,style:{width:"40%"}}),e("div",{className:`${r.skeletonLine} ${r.shimmer}`,style:{width:"70%"}})]}):h.isError||!t||!y?I!=null&&d?e(ce,{libId:d,anilistId:I}):e(E,{children:[e("button",{className:r.backBtn,onClick:()=>v("/manga"),children:[e(x,{name:"chevron-left",size:12})," Back to browse"]}),e(K,{message:"Failed to load this title. Please try again."})]}):e(le,{detail:y,altTitle:t.altTitle!==y.title?t.altTitle:void 0,onBack:()=>v("/manga"),onOpenChapter:R,progressByChapter:u,primaryAction:f?e(M,{onClick:()=>f&&R(f),children:[e(x,{name:"book",size:13})," ",W]}):void 0,bookmarkButton:e(M,{variant:l?"secondary":"primary",onClick:_,disabled:B.isPending||C.isPending,children:[e(x,{name:"bookmark",size:13})," ",l?"Bookmarked":"Bookmark"]}),statusSelect:l?e("select",{className:r.detailSelect,value:T,onChange:i=>d&&s.mutate({id:d,status:i.target.value}),"aria-label":"Reading status",children:oe.map(i=>e("option",{value:i,children:i},i))}):void 0})})}export{ye as default};
@@ -0,0 +1 @@
1
+ import{d as F,A as I,q as Z,h as u,u as e,S as J,o as ce,p as le,a as de,T as ue}from"./vendor-core-DfaOB3Rn.js";import{E as ge}from"./ErrorMessage-DAxegITP.js";import{I as x}from"./vendor-icons-DrybRNxP.js";import{u as he}from"./vendor-query-BBT5_sHx.js";import{t as me,v as pe,m as fe,k as ve,r as be,n as Ne,w as we,q as ye,s as Ce}from"./useMangaLibrary-B3_BUKVk.js";import{s as t}from"./Manga.module-BcfOdsNP.js";import{e as Ie,d as Se,t as G}from"./index-CVB5dYhT.js";const ee="mangaReadMode",te="mangaFitMode";function $e(){try{return localStorage.getItem(ee)==="page"?"page":"strip"}catch{return"strip"}}function ke(){try{return localStorage.getItem(te)==="height"?"height":"width"}catch{return"width"}}const Pe=({provider:d,mangaTitle:h,chapter:p,chapters:b,onBack:N,onOpenChapter:v,initialPage:l=0,onProgress:D,savedPage:$=0})=>{const[c,U]=F($e),[i,_]=F(ke),[g,M]=F(0),[T,m]=F(new Set),[w,S]=F(0),E=I(null),B=I([]),z=he(),{data:V,isLoading:k,isError:L}=me(d,p.id),a=V?.pages??[],K=a.map(n=>pe(d,n)),y=I(0),Q=I(0),P=I(!1);Q.current=a.length;const s=b.findIndex(n=>n.id===p.id),o=s>0?[...b.slice(0,s)].reverse().find(n=>!n.externalUrl)??null:null,C=s>=0?b.slice(s+1).find(n=>!n.externalUrl)??null:null,R=Z(n=>{P.current=!0,M(r=>{const f=r+n;return f<0?(o&&v(o),0):f>=a.length?(C&&v(C),r):f})},[a.length,o,C,v]);u(()=>{P.current=!1,y.current=Math.max(0,l),M(Math.max(0,l)),m(new Set),B.current=[],l<=0&&window.scrollTo(0,0)},[p.id,l]);const H=I(D);H.current=D;const X=I("");u(()=>{y.current=g,a.length!==0&&H.current?.(Math.min(g+1,a.length),a.length)},[g,a.length]),u(()=>{l<=0||P.current||y.current===0&&(P.current=!1,y.current=l,M(l))},[l]),u(()=>{if(c!=="strip"||a.length===0||l<=0)return;const n=`${p.id}:${l}`;if(X.current===n)return;X.current=n;const r=window.setTimeout(()=>{B.current[Math.min(l,a.length-1)]?.scrollIntoView({block:"start"})},150);return()=>window.clearTimeout(r)},[c,a.length,l,p.id]),u(()=>{document.title=`${h} Ch. ${p.number} - dango`},[h,p.number]),u(()=>{try{localStorage.setItem(ee,c)}catch{}},[c]),u(()=>{try{localStorage.setItem(te,i)}catch{}},[i]),u(()=>{c==="page"&&window.scrollTo(0,0)},[c]),u(()=>{if(c!=="page"||a.length===0)return;const n=r=>{r.key==="ArrowRight"||r.key===" "?(r.preventDefault(),R(1)):r.key==="ArrowLeft"&&(r.preventDefault(),R(-1))};return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[c,a.length,R]),u(()=>{if(c!=="strip"||a.length===0)return;const n=new IntersectionObserver(r=>{for(const f of r)if(f.isIntersecting){const W=Number(f.target.dataset.pageIndex);Number.isNaN(W)||(W!==y.current&&(P.current=!0),M(W))}},{rootMargin:"-45% 0px -45% 0px",threshold:0});return B.current.forEach(r=>r&&n.observe(r)),()=>n.disconnect()},[c,a.length,V]);const ne=n=>{E.current=n.touches[0].clientX},ae=n=>{if(E.current===null)return;const r=n.changedTouches[0].clientX-E.current;E.current=null,!(Math.abs(r)<50)&&R(r<0?1:-1)},q=n=>{n&&v(n)},O=n=>m(r=>{if(r.has(n))return r;const f=new Set(r);return f.add(n),f}),re=n=>{m(r=>{const f=new Set(r);return f.delete(n),f}),S(r=>r+1)},se=()=>{m(new Set),S(n=>n+1),z.invalidateQueries({queryKey:["mangaPages",d,p.id]})},ie=a.length>0&&T.size>=a.length,Y=n=>w>0?`${n}&n=${w}`:n,j=n=>e("div",{className:t.deadPage,role:"alert",children:[e("span",{children:["Page ",n+1," failed to load"]}),e("button",{className:t.pageBtn,onClick:()=>re(n),children:[e(x,{name:"sync-alt",size:12})," Retry"]})]}),A=i==="height",oe=$>0?$-1:-1;return e("div",{className:t.readerShell,children:[e("div",{className:t.readerBar,children:[e("button",{className:t.readerIconBtn,onClick:N,"aria-label":"Back to chapters",children:e(x,{name:"chevron-left",size:14})}),e("span",{className:t.readerTitle,children:[h," — Ch. ",p.number,p.title?` ${p.title}`:""]}),a.length>0&&e("span",{className:t.readerCounter,children:[Math.min(g+1,a.length)," / ",a.length]}),e("div",{className:t.readerSegment,role:"group","aria-label":"Reading mode",children:[e("button",{type:"button","aria-pressed":c==="strip",className:c==="strip"?t.readerSegmentActive:"",onClick:()=>U("strip"),children:"Strip"}),e("button",{type:"button","aria-pressed":c==="page",className:c==="page"?t.readerSegmentActive:"",onClick:()=>U("page"),children:"Page"})]}),e("div",{className:t.readerSegment,role:"group","aria-label":"Fit mode",children:[e("button",{type:"button","aria-pressed":!A,className:A?"":t.readerSegmentActive,onClick:()=>_("width"),title:"Fit width — best for portrait / phones",children:"Wide"}),e("button",{type:"button","aria-pressed":A,className:A?t.readerSegmentActive:"",onClick:()=>_("height"),title:"Fit height — best for landscape / desktop",children:"Tall"})]}),e("button",{className:t.readerIconBtn,disabled:!o,onClick:()=>q(o),"aria-label":"Previous chapter",children:e(x,{name:"chevron-left",size:14})}),e("button",{className:t.readerIconBtn,disabled:!C,onClick:()=>q(C),"aria-label":"Next chapter",children:e(x,{name:"chevron-right",size:14})})]}),L?e("p",{className:t.statusMsg,children:"Failed to load pages. Please try again."}):k?e("div",{className:t.readerPages,"aria-hidden":!0,children:Array.from({length:3}).map((n,r)=>e("div",{className:`${t.skeletonThumb} ${t.shimmer}`,style:{width:"100%",maxWidth:"56rem",aspectRatio:"3 / 4"}},r))}):a.length===0?e("p",{className:t.statusMsg,children:"No pages found for this chapter."}):ie?e("div",{className:t.failedBox,children:[e("p",{className:t.statusMsg,children:"Page images failed to load (expired or blocked links)."}),e("button",{className:t.pageBtn,onClick:se,children:[e(x,{name:"sync-alt",size:12})," Reload pages"]})]}):c==="strip"?e("div",{className:`${t.readerPages} ${A?t.readerPagesTall:""}`,children:K.map((n,r)=>e("div",{ref:f=>{B.current[r]=f},"data-page-index":r,className:t.readerPageWrap,children:[r===oe&&e("div",{className:t.saveMarker,role:"note","aria-label":"Saved reading position",children:[e(x,{name:"bookmark",size:12}),e("span",{children:["Saved · p. ",$]})]}),T.has(r)?j(r):e("img",{className:t.readerPage,src:Y(n),alt:`Page ${r+1}`,loading:r<3?"eager":"lazy",decoding:"async",draggable:!1,onError:()=>O(r)})]},`${r}-${a[r].slice(-32)}`))}):e(J,{children:[e("div",{className:`${t.pageView} ${A?t.pageViewTall:""}`,onTouchStart:ne,onTouchEnd:ae,children:[e("button",{className:`${t.tapZone} ${t.tapZoneLeft}`,onClick:()=>R(-1),"aria-label":"Previous page",children:e("span",{className:t.tapChevron,children:e(x,{name:"chevron-left",size:16})})}),T.has(g)?j(g):e("img",{className:t.pageImage,src:Y(K[g]),alt:`Page ${g+1} of ${a.length}`,decoding:"async",draggable:!1,onError:()=>O(g)},`${g}-${a[g].slice(-32)}`),e("button",{className:`${t.tapZone} ${t.tapZoneRight}`,onClick:()=>R(1),"aria-label":"Next page",children:e("span",{className:t.tapChevron,children:e(x,{name:"chevron-right",size:16})})})]}),e("nav",{className:t.pagination,"aria-label":"Page navigation",children:[e("button",{className:t.pageBtn,disabled:g<=0,onClick:()=>R(-1),children:"Previous page"}),e("span",{className:t.pageIndicator,children:[g+1," / ",a.length]}),e("button",{className:t.pageBtn,disabled:g>=a.length-1,onClick:()=>R(1),children:"Next page"})]})]}),(o||C)&&e("nav",{className:t.pagination,children:[e("button",{className:t.pageBtn,disabled:!o,onClick:()=>q(o),children:"Previous chapter"}),e("button",{className:t.pageBtn,disabled:!C,onClick:()=>q(C),children:"Next chapter"})]})]})},Re=800,xe=5e3;function ze(){const{provider:d="",id:h=""}=ce(),[p]=le(),b=de(),N=p.get("chapter")||"",v=p.get("rating")||"safe",{hasConsent:l}=Ie(),D=l?v:"safe",$=d&&h?fe(d,h):"",c=d.toLowerCase()==="anilist";u(()=>{c&&h&&b(`/manga/anilist/${encodeURIComponent(h)}`,{replace:!0})},[c,h,b]);const U=ve(!c&&d?d:null,!c&&h?h:null,D,l),i=U.data,{titlePreference:_}=Se(),g=i?be(i,_):"Manga",M=Ne($||void 0),T=we(),m=i&&N?i.chapters.find(s=>s.id===N)??null:null,w=ye(N),S=w!=null&&i?Ce(i.chapters,w):null;u(()=>{if(w!=null&&S&&S.id!==N){const s=new URLSearchParams;s.set("chapter",S.id),l&&v!=="safe"&&s.set("rating",v),b(`/manga/${d}/${encodeURIComponent(h)}/read?${s.toString()}`,{replace:!0})}},[w,S,N,l,v,d,h,b]);const E=w!=null&&!!i&&!!S,B=w!=null&&!!i&&!S,z=ue(()=>{const s=(M.data?.progress??[]).find(o=>o.chapterId===N);return s&&s.page>0?s.page:0},[M.data,N]),V=z>1?z-1:0,k=I(null),L=I(null),a=Z(()=>{k.current&&(clearTimeout(k.current),k.current=null);const s=L.current;L.current=null,s&&$&&T.mutate({mangaId:$,chapterId:s.chapterId,chapterNumber:s.chapterNumber,page:s.page,pageCount:s.pageCount,title:i?.title??null,cover:i?.cover??null,provider:d||null,altTitle:i?.altTitle??null,contentRating:i?.contentRating??null})},[$,T,i?.title,i?.cover,i?.altTitle,i?.contentRating,d]),K=Z((s,o)=>{m&&(L.current={chapterId:m.id,chapterNumber:m.number,page:s,pageCount:o},k.current&&clearTimeout(k.current),k.current=setTimeout(a,Re))},[m,a]);u(()=>{a()},[N,a]),u(()=>()=>a(),[a]),u(()=>{const s=window.setInterval(()=>{L.current&&a()},xe);return()=>window.clearInterval(s)},[a]),u(()=>{const s=()=>{document.visibilityState==="hidden"&&a()},o=()=>a();return document.addEventListener("visibilitychange",s),window.addEventListener("pagehide",o),()=>{document.removeEventListener("visibilitychange",s),window.removeEventListener("pagehide",o)}},[a]);const y=I("");y.current||(y.current=`manga-${Date.now()}-${Math.random().toString(36).slice(2)}`),u(()=>{if(!i||!m)return;const s=i.contentRating==="erotica"||i.contentRating==="pornographic"||i.type==="doujinshi",o=()=>{G.discord.mangaPresence.mutate({title:i.title,chapterLabel:`Chapter ${m.number}`,isPlaying:!0,thumbnail:i.cover||"",thumbnails:[i.cover].filter(Boolean),isAdult:s,sessionId:y.current}).catch(()=>{}),G.discord.heartbeat.mutate({sessionId:y.current}).catch(()=>{})};o();const C=window.setInterval(o,6e4);return()=>window.clearInterval(C)},[i,m]);const Q=s=>{if(a(),s.externalUrl){window.open(s.externalUrl,"_blank","noopener,noreferrer");return}const o=new URLSearchParams;o.set("chapter",s.id),l&&v!=="safe"&&o.set("rating",v),b(`/manga/${d}/${encodeURIComponent(h)}/read?${o.toString()}`)},P=()=>{a();const s=new URLSearchParams;l&&v!=="safe"&&s.set("rating",v);const o=s.toString()?`?${s.toString()}`:"";b(`/manga/${d}/${encodeURIComponent(h)}${o}`)};return c?null:e("div",{className:t.page,children:U.isLoading||E?e("div",{className:t.readerPages,"aria-hidden":!0,children:Array.from({length:3}).map((s,o)=>e("div",{className:`${t.skeletonThumb} ${t.shimmer}`,style:{width:"100%",maxWidth:"56rem",aspectRatio:"3 / 4"}},o))}):!i||!m?e(J,{children:[e("button",{className:t.backBtn,onClick:P,children:"Back to title"}),e(ge,{message:B?`Chapter ${w} isn't available from ${d} for this title.`:"Failed to load this chapter. Please try again."})]}):e(Pe,{provider:d,mangaTitle:g,chapter:m,chapters:i.chapters,onBack:P,onOpenChapter:Q,initialPage:V,onProgress:K,savedPage:z},m.id)})}export{ze as default};
@@ -1 +1 @@
1
- import{d as n,u as l}from"./vendor-core-DfaOB3Rn.js";import{R as i}from"./ResetProgressModal-JFlbXy7W.js";import{B as f,o as R}from"./useMangaLibrary-XFRTq5Qg.js";const p=({mangaId:e,title:a,onClose:s})=>{const[r,o]=n(!1),t=f(),m=R();return l(i,{isOpen:!!e,itemName:a,progressKind:"reading",listLabel:"my reading list",alsoRemove:r,onAlsoRemoveChange:o,onClose:()=>{o(!1),s()},onConfirm:()=>{e&&(t.mutate({mangaId:e}),r&&m.mutate(e),o(!1),s())}})};export{p as M};
1
+ import{d as n,u as l}from"./vendor-core-DfaOB3Rn.js";import{R as i}from"./ResetProgressModal-CeI4V3Y5.js";import{B as f,o as R}from"./useMangaLibrary-B3_BUKVk.js";const p=({mangaId:e,title:a,onClose:s})=>{const[r,o]=n(!1),t=f(),m=R();return l(i,{isOpen:!!e,itemName:a,progressKind:"reading",listLabel:"my reading list",alsoRemove:r,onAlsoRemoveChange:o,onClose:()=>{o(!1),s()},onConfirm:()=>{e&&(t.mutate({mangaId:e}),r&&m.mutate(e),o(!1),s())}})};export{p as M};
@@ -0,0 +1 @@
1
+ import{u as t,a as we,p as ke,h as de,d as l,T as ue,S as me}from"./vendor-core-DfaOB3Rn.js";import{b as he}from"./vendor-query-BBT5_sHx.js";import{B as O,M as $e,h as qe,e as Fe,U as xe,t as x,z as Ue}from"./index-CVB5dYhT.js";import{I as ge}from"./vendor-icons-DrybRNxP.js";import{S as Ye,P as pe}from"./SkeletonGrid-0dY_xMq3.js";import{A as Ve}from"./AnimeCard-4CEz8Buu.js";import{E as We}from"./ErrorMessage-DAxegITP.js";import{u as je}from"./useProviders-pwxPZPHh.js";import{s as a}from"./Search.module-CMEai-B-.js";import"./useAnimeInfoData-DxdOg_B7.js";import"./QueueOptionsButton-5eloKF5J.js";import"./vendor-ui-3qrARCPr.js";import"./MediaCard-BQZsutEo.js";import"./useIsMobile-Dvx1uJ82.js";const He=({isOpen:u,onClose:c,onGrant:s})=>t($e,{isOpen:u,title:"Content Warning",onClose:c,children:t("div",{style:{padding:"1rem",textAlign:"center"},children:[t("p",{children:"This title contains mature content intended for adult audiences."}),t("p",{children:["By proceeding, you confirm that you are ",t("strong",{children:"18 years of age or older"})," (or the age of majority in your jurisdiction) and wish to view this content."]}),t("div",{style:{marginTop:"1rem",display:"flex",gap:"10px",justifyContent:"center"},children:[t(O,{variant:"secondary",onClick:c,children:"Go Back"}),t(O,{onClick:s,children:"I'm 18+, Continue"})]})]})}),Ke="_shrinkSelect_130sm_1",Qe="_tightGrid_130sm_7",Q={shrinkSelect:Ke,tightGrid:Qe},ze=[{value:"anilist",label:"AniList"},{value:"mal",label:"MAL"}],Ze=[{value:"POPULARITY_DESC",label:"Popularity"},{value:"TRENDING_DESC",label:"Trending"},{value:"SCORE_DESC",label:"Score"},{value:"START_DATE_DESC",label:"Newest"},{value:"FAVOURITES_DESC",label:"Favourites"}],Je=[{value:"",label:"All Status"},{value:"RELEASING",label:"Currently Airing"},{value:"FINISHED",label:"Finished"},{value:"NOT_YET_RELEASED",label:"Not Yet Released"}],Xe=[{value:"",label:"Relevance"},{value:"visits:desc",label:"Most Visited"},{value:"title:asc",label:"Title A-Z"}],et={recent:"Latest",popular:"Popular",views:"Most Viewed",rating:"Top Rated",random:"Random"},tt=[{value:"ALL",label:"All Seasons"},{value:"Winter",label:"Winter"},{value:"Spring",label:"Spring"},{value:"Summer",label:"Summer"},{value:"Fall",label:"Fall"}],ve=u=>u.split("-").map(c=>c&&c[0].toUpperCase()+c.slice(1)).join(" "),at=new Set(["page","limit","year","minScore","minEpisodes"]),rt=new Set(["provider","query","page","limit","type","status","season","year","country","genres","genre","excludeGenres","sortBy","order","studio","blacklist","minScore","minEpisodes"]);function st(u){const c=new URLSearchParams(u),s={};for(const[y,b]of c.entries())rt.has(y)&&(at.has(y)?s[y]=Number(b)||0:s[y]=b);return s}function bt(){const u=we(),c=qe(),[s,y]=ke(),{hasConsent:b,grant:fe}=Fe();de(()=>{document.title="Mature - dango"},[]);const[i,Se]=l(s.get("provider")||"anilist"),[C,z]=l(s.get("query")||""),[T,U]=l(s.get("query")||""),[I,g]=l(parseInt(s.get("page")||"1",10)||1),[_,Y]=l(()=>{const e=s.get("sortBy");return e||(i==="mal"?"SCORE_DESC":"POPULARITY_DESC")}),[M,Z]=l(s.get("sortBy")||""),[N,ye]=l(s.get("status")||""),[D,be]=l(s.get("season")||"ALL"),[G,Ce]=l(s.get("year")||"ALL"),[p,B]=l(s.get("genre")||s.get("genres")||""),[V,Ne]=l(s.get("order")||"recent"),[W,Ae]=l(s.get("studio")||""),[w,Ee]=l(s.get("studio")||""),[J,X]=l([]),[j,Pe]=l(!1),[Re,ee]=l(null),{options:te}=je(),ae=ue(()=>te.filter(e=>e.mature&&(e.kind??"anime")==="anime"),[te]),re=ue(()=>[...ze,...ae.map(e=>({value:e.value,label:e.label}))],[ae]),{data:k}=he({...c.data.matureFilters.queryOptions(),enabled:b,staleTime:1/0}),d=i==="anilist"||i==="mal",H=d?void 0:k?.providers?.[i],P=H?.browse,R=H?.genres??[],A=H?.orders??[],se=A.length>0&&!A.includes(V)?A[0]:V,$=!d&&(P?.genre===!0||R.length>0||J.length>0),v=!d&&(P?.order===!0||A.length>0),E=!d&&P?.studio===!0,ie=!d&&P?.sort===!0,q=d?14:P?.pageSize??14,f=e=>{const r=new URLSearchParams;if(e.provider!=="anilist"&&r.set("provider",e.provider),e.query.trim()&&r.set("query",e.query.trim()),e.page>1&&r.set("page",String(e.page)),e.provider==="anilist")e.sort!=="POPULARITY_DESC"&&r.set("sortBy",e.sort),e.status&&r.set("status",e.status),e.season!=="ALL"&&r.set("season",e.season),e.year!=="ALL"&&r.set("year",e.year);else if(e.provider==="mal")e.sort!=="SCORE_DESC"&&r.set("sortBy",e.sort),e.status&&r.set("status",e.status);else{const n=k?.providers?.[e.provider]?.browse,m=k?.providers?.[e.provider]?.orders??[],o=m.length>0&&!m.includes(e.remoteOrder)?m[0]:e.remoteOrder;(!n||n.sort)&&e.remoteSort&&r.set("sortBy",e.remoteSort),(!n||n.genre)&&e.genre&&r.set("genre",e.genre),(!n||n.order)&&o!==(m[0]??"recent")&&r.set("order",o),(!n||n.studio)&&e.studio.trim()&&r.set("studio",e.studio.trim())}y(r,{replace:!0})},S=(e={})=>({provider:i,query:T,page:I,sort:_,remoteSort:M,status:N,season:D,year:G,genre:p,remoteOrder:V,studio:w,...e}),Le=(()=>{const e=new URLSearchParams;return e.set("provider",i),T.trim()&&e.set("query",T.trim()),e.set("page",String(I)),e.set("limit",String(q)),i==="anilist"&&(e.set("sortBy",_),N&&e.set("status",N),D!=="ALL"&&e.set("season",D),G!=="ALL"&&e.set("year",G)),i==="mal"?(e.set("sortBy",_),N&&e.set("status",N)):d||($&&p&&e.set("genre",p),v&&e.set("order",se),ie&&M&&e.set("sortBy",M),E&&w.trim()&&e.set("studio",w.trim())),e.toString()})(),{data:h,isLoading:Oe,isError:Te,error:Ie}=he({...c.data.matureSearch.queryOptions(st(Le)),enabled:b});de(()=>{const e=h?.genres;!d&&R.length===0&&e&&e.length>0&&X(r=>{const n=new Set(r.map(o=>o.slug)),m=[...r];for(const o of e)o.slug&&!n.has(o.slug)&&(n.add(o.slug),m.push(o));return m.length===r.length?r:m})},[h,i,d,R.length]);const F=(h?.data||[]).map(e=>({...e,isAdult:!0})),le=h?.hasMore??!1,L=()=>{xe(),g(1);let e=p;!d&&!v&&C.trim()&&(e=""),B(e),E&&Ee(W),U(C),f(S({query:C,page:1,genre:e,studio:E?W:w}))},_e=e=>{Se(e),g(1),Z(""),B(""),X([]),e==="mal"?Y("SCORE_DESC"):e==="anilist"&&Y("POPULARITY_DESC"),U(C),f(S({provider:e,page:1,remoteSort:"",genre:"",query:C}))},Me=e=>{B(e),g(1),e&&(z(""),U("")),f(S({genre:e,page:1,query:e?"":T}))},ne=e=>{g(e),f(S({page:e})),window.scrollTo({top:0,behavior:"smooth"})},De=async(e,r)=>{const n=r.id||r._id;if(i!=="mal"&&!/^\d+$/.test(n)&&(e.preventDefault(),e.stopPropagation(),!Re)){ee(n);try{if(i!=="anilist"){let o=!1;try{o=(await x.data.anilistStatus.query())?.available===!0}catch{o=!1}if(o){const ce=await x.data.matureResolve.query({title:r.name});u(`/anime/${ce.id}`);return}const oe=await x.data.matureAllocate.mutate({provider:i,nativeId:n,title:r.name,thumbnail:r.thumbnail});if(!oe?.id)throw new Error("Allocate failed");u(`/anime/${oe.id}`);return}const m=await x.data.matureResolve.query({title:r.name});u(`/anime/${m.id}`)}catch{Ue.error("Could not match this title on AniList")}finally{ee(null)}}},K=new Date().getFullYear(),Ge=[{value:"ALL",label:"All Years"},...Array.from({length:K-1980+1},(e,r)=>({value:String(K-r),label:String(K-r)}))],Be=R.length>0?R.map(e=>({value:e,label:ve(e)})):J.map(e=>({value:e.slug,label:e.name}));return b?t("div",{className:"page-container",children:[t("div",{className:a.header,children:[t("h1",{className:a.pageTitle,children:"Mature"}),t("p",{className:a.pageSubtitle,children:"Browse 18+ titles across AniList and streaming providers"})]}),t("div",{className:a.filterContainer,children:[t("div",{className:a.searchBarWrapper,children:[t("div",{className:a.inputIconWrapper,children:[t(ge,{name:"search",className:a.searchIcon}),t("input",{type:"text",placeholder:`Search ${re.find(e=>e.value===i)?.label}...`,value:C,onChange:e=>z(e.target.value),onKeyDown:e=>{e.key==="Enter"&&L()},className:a.searchInput})]}),t("div",{className:a.searchActions,children:[t("select",{value:i,onChange:e=>_e(e.target.value),className:a.providerSelect,"aria-label":"Provider",children:re.map(e=>t("option",{value:e.value,children:e.label},e.value))}),t(O,{onClick:L,className:a.searchBtn,children:"Search"}),d&&t("button",{onClick:()=>Pe(!j),className:`${a.filterToggleBtn} ${j?a.active:""}`,children:[t(ge,{name:"filter"})," Filters"]}),ie&&t("select",{value:M,onChange:e=>{Z(e.target.value),g(1),f(S({remoteSort:e.target.value,page:1}))},className:a.providerSelect,"aria-label":"Sort",children:Xe.map(e=>t("option",{value:e.value,children:e.label},e.value))})]})]}),(i==="anilist"||i==="mal")&&t("div",{className:`${a.advancedFilters} ${j?a.show:""}`,children:[t("div",{className:a.filterDivider}),t("div",{className:a.filterGrid,children:[t("div",{className:a.filterItem,children:[t("label",{children:"Sort By"}),t("select",{value:_,onChange:e=>Y(e.currentTarget.value),children:Ze.map(e=>t("option",{value:e.value,children:e.label},e.value))})]}),t("div",{className:a.filterItem,children:[t("label",{children:"Status"}),t("select",{value:N,onChange:e=>ye(e.currentTarget.value),children:Je.map(e=>t("option",{value:e.value,children:e.label},e.value))})]}),i==="anilist"&&t(me,{children:[t("div",{className:a.filterItem,children:[t("label",{children:"Season"}),t("select",{value:D,onChange:e=>be(e.currentTarget.value),children:tt.map(e=>t("option",{value:e.value,children:e.label},e.value))})]}),t("div",{className:a.filterItem,children:[t("label",{children:"Year"}),t("select",{value:G,onChange:e=>Ce(e.currentTarget.value),children:Ge.map(e=>t("option",{value:e.value,children:e.label},e.value))})]})]})]}),t("div",{className:a.filterActions,children:t(O,{onClick:L,className:a.searchBtn,children:"Apply Filters"})})]}),!d&&!!k&&($||v||E)&&t("div",{className:`${a.advancedFilters} ${a.show}`,children:[t("div",{className:a.filterDivider}),t("div",{className:`${a.filterGrid} ${Q.tightGrid}`,children:[v&&t("div",{className:`${a.filterItem} ${Q.shrinkSelect}`,children:[t("label",{children:"Order"}),t("select",{value:se,onChange:e=>{Ne(e.target.value),g(1),f(S({remoteOrder:e.target.value,page:1}))},children:(A.length>0?A:["recent"]).map(e=>t("option",{value:e,children:et[e]||e},e))})]}),$&&t("div",{className:`${a.filterItem} ${Q.shrinkSelect}`,children:[t("label",{children:"Genre"}),t("select",{value:p,onChange:e=>{v?(B(e.target.value),g(1),f(S({genre:e.target.value,page:1}))):Me(e.target.value)},children:[t("option",{value:"",children:"All Genres"}),Be.map(e=>t("option",{value:e.value,children:e.label},e.value))]})]}),E&&t("div",{className:a.filterItem,children:[t("label",{children:"Studio"}),t("input",{type:"text",placeholder:"Studio name...",value:W,onChange:e=>Ae(e.target.value),onKeyDown:e=>{e.key==="Enter"&&L()},className:a.searchInput})]})]}),p&&$&&!v&&t("p",{className:a.pageSubtitle,children:["Browsing the ",ve(p)," genre — search text is ignored while a genre is selected."]}),(v||E)&&t("div",{className:a.filterActions,children:t(O,{onClick:L,className:a.searchBtn,children:"Apply Filters"})})]})]}),Te&&t(We,{message:Ie?.message||"Search failed"}),Oe?t(Ye,{count:q}):F.length===0?t("div",{className:a.noResults,children:[t("h3",{children:"No results found"}),t("p",{children:"Try a different query, genre or provider"})]}):t(me,{children:[t("div",{className:a.resultsHeader,children:[t("h2",{className:a.resultsTitle,children:[h?.total??F.length," result",(h?.total??F.length)===1?"":"s"]}),t("div",{className:a.pagination,children:t(pe,{page:I,totalPages:Math.max(1,Math.ceil((h?.total??0)/q)),canGoNext:le,onChange:ne,variant:"labeled"})})]}),t("div",{className:a.resultsGrid,children:F.map(e=>t("div",{onClickCapture:r=>De(r,e),children:t(Ve,{anime:e})},`${i}-${e._id}`))}),t("div",{className:a.bottomPagination,children:t("div",{className:a.pagination,children:t(pe,{page:I,totalPages:Math.max(1,Math.ceil((h?.total??0)/q)),canGoNext:le,onChange:ne,variant:"labeled"})})})]})]}):t(He,{isOpen:!0,onClose:()=>u("/"),onGrant:fe})}export{bt as default};
@@ -1 +1 @@
1
- import{d as y,g as T,u as e,S as ee,$ as Ne,h as K,A as x,q as d,N as Ee,a as Se,L as Ie}from"./vendor-core-DfaOB3Rn.js";import{a as Re,b as Ae,f as Le,s as $e}from"./vendor-ui-3qrARCPr.js";import{I as v}from"./vendor-icons-DrybRNxP.js";import{t as ke,d as Oe,u as ze,a as De,f as Ue,M as Ve,B as Q}from"./index-HZNJp28e.js";import{u as Ge}from"./useIsMobile-Dvx1uJ82.js";const We="_popupPortal_7glox_1",Ye="_popupContent_7glox_6",je="_popupBackdrop_7glox_31",Fe="_mobile_7glox_38",Xe="_header_7glox_62",qe="_title_7glox_67",He="_body_7glox_87",Je="_metaRow_7glox_94",Ke="_metaItem_7glox_101",Qe="_scoreIcon_7glox_107",Ze="_synopsis_7glox_111",et="_details_7glox_121",tt="_detailItem_7glox_129",nt="_genres_7glox_133",ot="_genre_7glox_133",rt="_footer_7glox_148",st="_primaryAction_7glox_157",at="_watchBtn_7glox_161",lt="_secondaryActions_7glox_184",ct="_watchlistBtn_7glox_189",it="_detailsBtn_7glox_190",dt="_active_7glox_216",ut="_loading_7glox_227",_t="_spinner_7glox_237",R={popupPortal:We,popupContent:Ye,popupBackdrop:je,mobile:Fe,header:Xe,title:qe,body:He,metaRow:Je,metaItem:Ke,scoreIcon:Qe,synopsis:Ze,details:et,detailItem:tt,genres:nt,genre:ot,footer:rt,primaryAction:st,watchBtn:at,secondaryActions:lt,watchlistBtn:ct,detailsBtn:it,active:dt,loading:ut,spinner:_t},cn=({anchorRect:t,onMouseEnter:a,onMouseLeave:l,onRequestClose:c,children:u})=>{const[i]=y(()=>window.matchMedia("(pointer: coarse)").matches),r=T.useMemo(()=>({getBoundingClientRect:()=>t}),[t]),{refs:w,floatingStyles:b}=Re({placement:"right-start",middleware:[Le({fallbackAxisSideDirection:"start"}),$e({padding:20})],whileElementsMounted:Ae});T.useEffect(()=>{w.setPositionReference(r)},[w,r]),T.useEffect(()=>{if(!i)return;const C=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=C}},[i]);const _=e(ee,{children:[i&&e("div",{className:R.popupBackdrop,onClick:()=>c?.()}),e("div",{ref:i?void 0:w.setFloating,className:`${R.popupPortal} ${i?R.mobile:""}`,style:i?void 0:b,onMouseEnter:a,onMouseLeave:l,children:e("div",{className:R.popupContent,children:u})})]});return Ne(_,document.body)},pt=t=>!t||t.trim()===""?!0:t.includes("placeholder");function gt(t,a){const[l,c]=y(a);return K(()=>{c(a)},[a]),K(()=>{if(!pt(a)||!t)return;let u=!1;return ke.data.showMeta.query({id:t}).then(i=>{const r=i?.thumbnail;!u&&r&&r.trim()!==""&&!r.includes("placeholder")&&c(r)}).catch(()=>{}),()=>{u=!0}},[t,a]),{thumbnail:l}}const mt="_cardWrapper_w7bu0_1",ft="_card_w7bu0_1",ht="_cardButton_w7bu0_35",bt="_hoverOverlay_w7bu0_60",Bt="_matureOverlay_w7bu0_81",wt="_posterContainer_w7bu0_91",vt="_horizontal_w7bu0_100",yt="_posterImg_w7bu0_104",Ct="_blurred_w7bu0_116",Mt="_flat_w7bu0_139",xt="_loaded_w7bu0_143",Tt="_posterGradient_w7bu0_147",Pt="_progressSection_w7bu0_167",Nt="_titleSection_w7bu0_174",Et="_title_w7bu0_174",St="_titleText_w7bu0_193",It="_badge_w7bu0_205",Rt="_typeBadge_w7bu0_216 _badge_w7bu0_205",At="_epBadge_w7bu0_225 _badge_w7bu0_205",Lt="_airTime_w7bu0_234",$t="_adultBadge_w7bu0_241 _badge_w7bu0_205",kt="_gated_w7bu0_254",Ot="_notAiredBadge_w7bu0_260 _badge_w7bu0_205",zt="_metaRow_w7bu0_275",Dt="_metaItem_w7bu0_286",Ut="_progressContainer_w7bu0_303",Vt="_progressBar_w7bu0_311",Gt="_timestamp_w7bu0_318",Wt="_removeBtn_w7bu0_323",Yt="_infoBtn_w7bu0_324",jt="_mobileBadges_w7bu0_375",Ft="_mobileBadgeBase_w7bu0_382",Xt="_mobileType_w7bu0_390 _mobileBadgeBase_w7bu0_382",qt="_mobileEp_w7bu0_397 _mobileBadgeBase_w7bu0_382",Ht="_vertical_w7bu0_489",Jt="_placeholder_w7bu0_504",Kt="_placeholderText_w7bu0_513",Qt="_lowEnd_w7bu0_520",n={cardWrapper:mt,card:ft,cardButton:ht,hoverOverlay:bt,matureOverlay:Bt,posterContainer:wt,horizontal:vt,posterImg:yt,blurred:Ct,flat:Mt,loaded:xt,posterGradient:Tt,progressSection:Pt,titleSection:Nt,title:Et,titleText:St,badge:It,typeBadge:Rt,epBadge:At,airTime:Lt,adultBadge:$t,gated:kt,notAiredBadge:Ot,metaRow:zt,metaItem:Dt,progressContainer:Ut,progressBar:Vt,timestamp:Gt,removeBtn:Wt,infoBtn:Yt,mobileBadges:jt,mobileBadgeBase:Ft,mobileType:Xt,mobileEp:qt,vertical:Ht,placeholder:Jt,placeholderText:Kt,lowEnd:Qt},Zt=500,Z=20,en=300;function tn(t){const a=x(null),l=x(null),c=x(!1),u=x({x:0,y:0}),i=x(null),r=d(()=>{l.current&&(clearTimeout(l.current),l.current=null)},[]),w=d(()=>{a.current&&(clearTimeout(a.current),a.current=null)},[]),b=d(s=>{a.current&&clearTimeout(a.current),a.current=setTimeout(s,en)},[]),_=d((s,p=!1)=>{c.current=p,t(s,p)},[t]),C=d((s,p)=>{if(p||s.pointerType==="mouse")return;i.current=s.pointerType,c.current=!1,u.current={x:s.clientX,y:s.clientY};const m=s.currentTarget.getBoundingClientRect();r(),l.current=setTimeout(()=>{l.current=null,_(m,!0)},Zt)},[r,_]),B=d(s=>{if(!l.current)return;const p=Math.abs(s.clientX-u.current.x),m=Math.abs(s.clientY-u.current.y);(p>Z||m>Z)&&r()},[r]),g=d(()=>{r(),i.current=null},[r]),P=d((s,p)=>{s.preventDefault(),s.stopPropagation(),i.current==="touch"?l.current&&(clearTimeout(l.current),l.current=null,_(s.currentTarget.getBoundingClientRect(),!0)):!p&&!c.current&&_(s.currentTarget.getBoundingClientRect())},[_]),A=d(()=>c.current?(c.current=!1,!0):!1,[]);return{longPressFiredRef:c,cancelLongPress:r,clearPopupTimeout:w,schedulePopupClose:b,openViaHold:_,handlePointerDown:C,handlePointerMove:B,handlePointerUpOrCancel:g,handleContextMenu:P,consumeLongPressClick:A}}const z={elements:{poster:{typeBadge:!0,chapterBadge:!0,adultBadge:!0},info:{title:!0,mobileBadges:!0,progress:!0,meta:!0}}},dn=Ee(({item:t,linkTo:a,hoverIcon:l,progress:c,showProgress:u=!1,metaRow:i,display:r,layout:w="vertical",onRemove:b,showRemoveButton:_,showInfoButton:C=!1,onOpenDetails:B,renderPopup:g,onPopupHoverIntent:P,rawThumbnail:A,enrichedId:s})=>{const p=Se(),m=Ge(),{titlePreference:te}=Oe(),{lowEndMode:M}=ze(),[ne,oe]=y(!1),[re,D]=y(!1),{thumbnail:U}=gt(s,t.thumbnail),[L,V]=y(!1),[G,W]=y(null),Y=o=>{W(o),V(!0)},$=d(()=>{V(!1),W(null)},[]),f=tn(o=>{if(B){B(o);return}g&&Y(o)}),k=d(()=>{f.schedulePopupClose($)},[f,$]),j=f.clearPopupTimeout,se=o=>{if(m)return;const J=o.currentTarget.getBoundingClientRect();if(B){B(J);return}g&&Y(J)},ae=()=>{g&&k()},le=()=>{j()},ce=()=>{g&&k()},ie=o=>{f.handlePointerDown(o,h)},de=o=>{f.handlePointerMove(o)},F=()=>{f.handlePointerUpOrCancel()},ue=o=>{if(B){o.preventDefault(),o.stopPropagation(),B(o.currentTarget.getBoundingClientRect());return}if(g){f.handleContextMenu(o,h);return}f.handleContextMenu(o,h)},X={...r,elements:{...z.elements,...r?.elements||{},poster:{...z.elements?.poster,...r?.elements?.poster||{}},info:{...z.elements?.info,...r?.elements?.info||{}}}},O=t[te]||t.title,N=X.elements?.poster,E=X.elements?.info,_e=(N?.typeBadge??!0)&&!!t.typeBadge,pe=(N?.chapterBadge??!0)&&!!t.chapterBadge,ge=_??N?.removeButton??!!b,me=N?.adultBadge??!0,fe=E?.mobileBadges??!0,he=E?.progress??!0,be=E?.meta??!0,Be=u&&!!c&&c.percent>0,q=!!t.isAdult,[we,ve]=De("agreedToViewMature","false"),ye=we==="true",[H,S]=T.useState(!1),I=T.useRef(null),Ce=()=>{ve("true"),S(!1),I.current&&(p(I.current),I.current=null)},h=q&&!ye,Me=o=>{if(f.consumeLongPressClick()){o.preventDefault(),o.stopPropagation();return}h&&(o.preventDefault(),o.stopPropagation(),I.current=a,S(!0))},xe=l==="book"?e(v,{name:"book",size:28}):l==="play"?e(v,{name:"play",size:28}):l==="info"?e(v,{name:"info-circle",size:28}):e(v,{name:"info-circle",size:28}),Te=d(o=>{o.preventDefault(),o.stopPropagation(),b&&b(t.id)},[b,t.id]),Pe=A?U??t.thumbnail:Ue(U,M?100:150,M?150:200);return e("div",{className:`${n.cardWrapper} ${M?n.lowEnd:""}`,onMouseEnter:()=>{D(!0),P?.(!0),L&&j()},onMouseLeave:()=>{D(!1),P?.(!1),L&&k()},children:[e(Ie,{to:a,className:`${n.card} ${n[w]} ${h?n.cardButton:""}`,onClick:Me,onContextMenu:ue,onPointerDown:ie,onPointerMove:de,onPointerUp:F,onPointerCancel:F,children:[e("div",{className:n.posterContainer,children:[h&&e("div",{className:`${n.matureOverlay} ${M?n.flat:""}`}),e("img",{src:Pe,alt:O,className:`${n.posterImg} ${ne?n.loaded:""} ${h&&!M?n.blurred:""}`,loading:"lazy",decoding:"async",onLoad:()=>oe(!0)}),!m&&e(ee,{children:[_e&&e("div",{className:n.typeBadge,children:t.typeBadge}),pe&&e("div",{className:n.epBadge,children:[t.chapterBadge,t.airMeta&&e("span",{className:n.airTime,children:t.airMeta})]})]}),me&&q&&e("div",{className:`${n.adultBadge} ${h?n.gated:""}`,children:"18+"}),t.notAired&&e("div",{className:n.notAiredBadge,children:"NOT AIRED"}),!m&&re&&e("div",{className:n.hoverOverlay,children:xe})]}),he&&u&&Be&&c&&e("div",{className:n.progressSection,children:[e("div",{className:n.progressContainer,children:e("div",{className:n.progressBar,style:{width:`${c.percent}%`}})}),e("div",{className:n.timestamp,children:c.label})]}),e("div",{className:n.titleSection,children:[m&&fe&&e("div",{className:n.mobileBadges,children:[!!t.typeBadge&&e("span",{className:n.mobileType,children:t.typeBadge}),t.chapterBadge&&e("span",{className:n.mobileEp,children:t.chapterBadge})]}),E?.title!==!1&&e("div",{className:n.title,title:O,children:e("span",{className:n.titleText,children:O})}),be&&i&&e("div",{className:n.metaRow,children:i})]})]}),H&&e(Ve,{isOpen:H,title:"Content Warning",onClose:()=>S(!1),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("p",{style:{fontSize:"0.8rem",color:"var(--text-secondary)",marginTop:"1rem"},children:["You can reset this preference at any time in the ",e("strong",{children:"Settings"})," page."]}),e("div",{style:{marginTop:"1rem",display:"flex",gap:"10px",justifyContent:"center"},children:[e(Q,{variant:"secondary",onClick:()=>S(!1),children:"Go Back"}),e(Q,{onClick:Ce,children:"I'm 18+, Continue"})]})]})}),ge&&e("button",{className:n.removeBtn,onClick:Te,"aria-label":"Remove",children:e(v,{name:"times",size:10})}),C&&!m&&!h&&e("button",{className:n.infoBtn,onMouseEnter:se,onMouseLeave:ae,"aria-label":"Info",children:e(v,{name:"info",size:11})}),g&&L&&G?g(G,{close:$,onMouseEnter:le,onMouseLeave:ce}):null]})});export{dn as M,cn as a,n as m,R as p};
1
+ import{d as y,g as T,u as e,S as ee,$ as Ne,h as K,A as x,q as d,N as Ee,a as Se,L as Ie}from"./vendor-core-DfaOB3Rn.js";import{a as Re,b as Ae,f as Le,s as $e}from"./vendor-ui-3qrARCPr.js";import{I as v}from"./vendor-icons-DrybRNxP.js";import{t as ke,d as Oe,u as ze,a as De,f as Ue,M as Ve,B as Q}from"./index-CVB5dYhT.js";import{u as Ge}from"./useIsMobile-Dvx1uJ82.js";const We="_popupPortal_7glox_1",Ye="_popupContent_7glox_6",je="_popupBackdrop_7glox_31",Fe="_mobile_7glox_38",Xe="_header_7glox_62",qe="_title_7glox_67",He="_body_7glox_87",Je="_metaRow_7glox_94",Ke="_metaItem_7glox_101",Qe="_scoreIcon_7glox_107",Ze="_synopsis_7glox_111",et="_details_7glox_121",tt="_detailItem_7glox_129",nt="_genres_7glox_133",ot="_genre_7glox_133",rt="_footer_7glox_148",st="_primaryAction_7glox_157",at="_watchBtn_7glox_161",lt="_secondaryActions_7glox_184",ct="_watchlistBtn_7glox_189",it="_detailsBtn_7glox_190",dt="_active_7glox_216",ut="_loading_7glox_227",_t="_spinner_7glox_237",R={popupPortal:We,popupContent:Ye,popupBackdrop:je,mobile:Fe,header:Xe,title:qe,body:He,metaRow:Je,metaItem:Ke,scoreIcon:Qe,synopsis:Ze,details:et,detailItem:tt,genres:nt,genre:ot,footer:rt,primaryAction:st,watchBtn:at,secondaryActions:lt,watchlistBtn:ct,detailsBtn:it,active:dt,loading:ut,spinner:_t},cn=({anchorRect:t,onMouseEnter:a,onMouseLeave:l,onRequestClose:c,children:u})=>{const[i]=y(()=>window.matchMedia("(pointer: coarse)").matches),r=T.useMemo(()=>({getBoundingClientRect:()=>t}),[t]),{refs:w,floatingStyles:b}=Re({placement:"right-start",middleware:[Le({fallbackAxisSideDirection:"start"}),$e({padding:20})],whileElementsMounted:Ae});T.useEffect(()=>{w.setPositionReference(r)},[w,r]),T.useEffect(()=>{if(!i)return;const C=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=C}},[i]);const _=e(ee,{children:[i&&e("div",{className:R.popupBackdrop,onClick:()=>c?.()}),e("div",{ref:i?void 0:w.setFloating,className:`${R.popupPortal} ${i?R.mobile:""}`,style:i?void 0:b,onMouseEnter:a,onMouseLeave:l,children:e("div",{className:R.popupContent,children:u})})]});return Ne(_,document.body)},pt=t=>!t||t.trim()===""?!0:t.includes("placeholder");function gt(t,a){const[l,c]=y(a);return K(()=>{c(a)},[a]),K(()=>{if(!pt(a)||!t)return;let u=!1;return ke.data.showMeta.query({id:t}).then(i=>{const r=i?.thumbnail;!u&&r&&r.trim()!==""&&!r.includes("placeholder")&&c(r)}).catch(()=>{}),()=>{u=!0}},[t,a]),{thumbnail:l}}const mt="_cardWrapper_w7bu0_1",ft="_card_w7bu0_1",ht="_cardButton_w7bu0_35",bt="_hoverOverlay_w7bu0_60",Bt="_matureOverlay_w7bu0_81",wt="_posterContainer_w7bu0_91",vt="_horizontal_w7bu0_100",yt="_posterImg_w7bu0_104",Ct="_blurred_w7bu0_116",Mt="_flat_w7bu0_139",xt="_loaded_w7bu0_143",Tt="_posterGradient_w7bu0_147",Pt="_progressSection_w7bu0_167",Nt="_titleSection_w7bu0_174",Et="_title_w7bu0_174",St="_titleText_w7bu0_193",It="_badge_w7bu0_205",Rt="_typeBadge_w7bu0_216 _badge_w7bu0_205",At="_epBadge_w7bu0_225 _badge_w7bu0_205",Lt="_airTime_w7bu0_234",$t="_adultBadge_w7bu0_241 _badge_w7bu0_205",kt="_gated_w7bu0_254",Ot="_notAiredBadge_w7bu0_260 _badge_w7bu0_205",zt="_metaRow_w7bu0_275",Dt="_metaItem_w7bu0_286",Ut="_progressContainer_w7bu0_303",Vt="_progressBar_w7bu0_311",Gt="_timestamp_w7bu0_318",Wt="_removeBtn_w7bu0_323",Yt="_infoBtn_w7bu0_324",jt="_mobileBadges_w7bu0_375",Ft="_mobileBadgeBase_w7bu0_382",Xt="_mobileType_w7bu0_390 _mobileBadgeBase_w7bu0_382",qt="_mobileEp_w7bu0_397 _mobileBadgeBase_w7bu0_382",Ht="_vertical_w7bu0_489",Jt="_placeholder_w7bu0_504",Kt="_placeholderText_w7bu0_513",Qt="_lowEnd_w7bu0_520",n={cardWrapper:mt,card:ft,cardButton:ht,hoverOverlay:bt,matureOverlay:Bt,posterContainer:wt,horizontal:vt,posterImg:yt,blurred:Ct,flat:Mt,loaded:xt,posterGradient:Tt,progressSection:Pt,titleSection:Nt,title:Et,titleText:St,badge:It,typeBadge:Rt,epBadge:At,airTime:Lt,adultBadge:$t,gated:kt,notAiredBadge:Ot,metaRow:zt,metaItem:Dt,progressContainer:Ut,progressBar:Vt,timestamp:Gt,removeBtn:Wt,infoBtn:Yt,mobileBadges:jt,mobileBadgeBase:Ft,mobileType:Xt,mobileEp:qt,vertical:Ht,placeholder:Jt,placeholderText:Kt,lowEnd:Qt},Zt=500,Z=20,en=300;function tn(t){const a=x(null),l=x(null),c=x(!1),u=x({x:0,y:0}),i=x(null),r=d(()=>{l.current&&(clearTimeout(l.current),l.current=null)},[]),w=d(()=>{a.current&&(clearTimeout(a.current),a.current=null)},[]),b=d(s=>{a.current&&clearTimeout(a.current),a.current=setTimeout(s,en)},[]),_=d((s,p=!1)=>{c.current=p,t(s,p)},[t]),C=d((s,p)=>{if(p||s.pointerType==="mouse")return;i.current=s.pointerType,c.current=!1,u.current={x:s.clientX,y:s.clientY};const m=s.currentTarget.getBoundingClientRect();r(),l.current=setTimeout(()=>{l.current=null,_(m,!0)},Zt)},[r,_]),B=d(s=>{if(!l.current)return;const p=Math.abs(s.clientX-u.current.x),m=Math.abs(s.clientY-u.current.y);(p>Z||m>Z)&&r()},[r]),g=d(()=>{r(),i.current=null},[r]),P=d((s,p)=>{s.preventDefault(),s.stopPropagation(),i.current==="touch"?l.current&&(clearTimeout(l.current),l.current=null,_(s.currentTarget.getBoundingClientRect(),!0)):!p&&!c.current&&_(s.currentTarget.getBoundingClientRect())},[_]),A=d(()=>c.current?(c.current=!1,!0):!1,[]);return{longPressFiredRef:c,cancelLongPress:r,clearPopupTimeout:w,schedulePopupClose:b,openViaHold:_,handlePointerDown:C,handlePointerMove:B,handlePointerUpOrCancel:g,handleContextMenu:P,consumeLongPressClick:A}}const z={elements:{poster:{typeBadge:!0,chapterBadge:!0,adultBadge:!0},info:{title:!0,mobileBadges:!0,progress:!0,meta:!0}}},dn=Ee(({item:t,linkTo:a,hoverIcon:l,progress:c,showProgress:u=!1,metaRow:i,display:r,layout:w="vertical",onRemove:b,showRemoveButton:_,showInfoButton:C=!1,onOpenDetails:B,renderPopup:g,onPopupHoverIntent:P,rawThumbnail:A,enrichedId:s})=>{const p=Se(),m=Ge(),{titlePreference:te}=Oe(),{lowEndMode:M}=ze(),[ne,oe]=y(!1),[re,D]=y(!1),{thumbnail:U}=gt(s,t.thumbnail),[L,V]=y(!1),[G,W]=y(null),Y=o=>{W(o),V(!0)},$=d(()=>{V(!1),W(null)},[]),f=tn(o=>{if(B){B(o);return}g&&Y(o)}),k=d(()=>{f.schedulePopupClose($)},[f,$]),j=f.clearPopupTimeout,se=o=>{if(m)return;const J=o.currentTarget.getBoundingClientRect();if(B){B(J);return}g&&Y(J)},ae=()=>{g&&k()},le=()=>{j()},ce=()=>{g&&k()},ie=o=>{f.handlePointerDown(o,h)},de=o=>{f.handlePointerMove(o)},F=()=>{f.handlePointerUpOrCancel()},ue=o=>{if(B){o.preventDefault(),o.stopPropagation(),B(o.currentTarget.getBoundingClientRect());return}if(g){f.handleContextMenu(o,h);return}f.handleContextMenu(o,h)},X={...r,elements:{...z.elements,...r?.elements||{},poster:{...z.elements?.poster,...r?.elements?.poster||{}},info:{...z.elements?.info,...r?.elements?.info||{}}}},O=t[te]||t.title,N=X.elements?.poster,E=X.elements?.info,_e=(N?.typeBadge??!0)&&!!t.typeBadge,pe=(N?.chapterBadge??!0)&&!!t.chapterBadge,ge=_??N?.removeButton??!!b,me=N?.adultBadge??!0,fe=E?.mobileBadges??!0,he=E?.progress??!0,be=E?.meta??!0,Be=u&&!!c&&c.percent>0,q=!!t.isAdult,[we,ve]=De("agreedToViewMature","false"),ye=we==="true",[H,S]=T.useState(!1),I=T.useRef(null),Ce=()=>{ve("true"),S(!1),I.current&&(p(I.current),I.current=null)},h=q&&!ye,Me=o=>{if(f.consumeLongPressClick()){o.preventDefault(),o.stopPropagation();return}h&&(o.preventDefault(),o.stopPropagation(),I.current=a,S(!0))},xe=l==="book"?e(v,{name:"book",size:28}):l==="play"?e(v,{name:"play",size:28}):l==="info"?e(v,{name:"info-circle",size:28}):e(v,{name:"info-circle",size:28}),Te=d(o=>{o.preventDefault(),o.stopPropagation(),b&&b(t.id)},[b,t.id]),Pe=A?U??t.thumbnail:Ue(U,M?100:150,M?150:200);return e("div",{className:`${n.cardWrapper} ${M?n.lowEnd:""}`,onMouseEnter:()=>{D(!0),P?.(!0),L&&j()},onMouseLeave:()=>{D(!1),P?.(!1),L&&k()},children:[e(Ie,{to:a,className:`${n.card} ${n[w]} ${h?n.cardButton:""}`,onClick:Me,onContextMenu:ue,onPointerDown:ie,onPointerMove:de,onPointerUp:F,onPointerCancel:F,children:[e("div",{className:n.posterContainer,children:[h&&e("div",{className:`${n.matureOverlay} ${M?n.flat:""}`}),e("img",{src:Pe,alt:O,className:`${n.posterImg} ${ne?n.loaded:""} ${h&&!M?n.blurred:""}`,loading:"lazy",decoding:"async",onLoad:()=>oe(!0)}),!m&&e(ee,{children:[_e&&e("div",{className:n.typeBadge,children:t.typeBadge}),pe&&e("div",{className:n.epBadge,children:[t.chapterBadge,t.airMeta&&e("span",{className:n.airTime,children:t.airMeta})]})]}),me&&q&&e("div",{className:`${n.adultBadge} ${h?n.gated:""}`,children:"18+"}),t.notAired&&e("div",{className:n.notAiredBadge,children:"NOT AIRED"}),!m&&re&&e("div",{className:n.hoverOverlay,children:xe})]}),he&&u&&Be&&c&&e("div",{className:n.progressSection,children:[e("div",{className:n.progressContainer,children:e("div",{className:n.progressBar,style:{width:`${c.percent}%`}})}),e("div",{className:n.timestamp,children:c.label})]}),e("div",{className:n.titleSection,children:[m&&fe&&e("div",{className:n.mobileBadges,children:[!!t.typeBadge&&e("span",{className:n.mobileType,children:t.typeBadge}),t.chapterBadge&&e("span",{className:n.mobileEp,children:t.chapterBadge})]}),E?.title!==!1&&e("div",{className:n.title,title:O,children:e("span",{className:n.titleText,children:O})}),be&&i&&e("div",{className:n.metaRow,children:i})]})]}),H&&e(Ve,{isOpen:H,title:"Content Warning",onClose:()=>S(!1),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("p",{style:{fontSize:"0.8rem",color:"var(--text-secondary)",marginTop:"1rem"},children:["You can reset this preference at any time in the ",e("strong",{children:"Settings"})," page."]}),e("div",{style:{marginTop:"1rem",display:"flex",gap:"10px",justifyContent:"center"},children:[e(Q,{variant:"secondary",onClick:()=>S(!1),children:"Go Back"}),e(Q,{onClick:Ce,children:"I'm 18+, Continue"})]})]})}),ge&&e("button",{className:n.removeBtn,onClick:Te,"aria-label":"Remove",children:e(v,{name:"times",size:10})}),C&&!m&&!h&&e("button",{className:n.infoBtn,onMouseEnter:se,onMouseLeave:ae,"aria-label":"Info",children:e(v,{name:"info",size:11})}),g&&L&&G?g(G,{close:$,onMouseEnter:le,onMouseLeave:ce}):null]})});export{dn as M,cn as a,n as m,R as p};
@@ -0,0 +1 @@
1
+ import{A as L,d as b,g as _e,h as F,u as e,S as w,$ as Ve,p as Ze,T as G}from"./vendor-core-DfaOB3Rn.js";import{t as Ce,W as je,h as O,z as P}from"./index-CVB5dYhT.js";import{I as g}from"./vendor-icons-DrybRNxP.js";import{a as n}from"./Asmr.module-ChUXDZKx.js";import{r as h}from"./Radio.module-DGSZLpKM.js";import{b as J,u as Pe,a as Re}from"./vendor-query-BBT5_sHx.js";function Be(a){if(!Number.isFinite(a)||a<0)return"0:00";const s=Math.floor(a/60),f=Math.floor(a%60);return`${s}:${String(f).padStart(2,"0")}`}const Je=({track:a,shuffle:s,onToggleShuffle:f,onTrackStep:R,onTrackFailed:be,onClose:se,liked:W,likeVisible:K,likePending:re,onToggleLike:X})=>{const M=L(null),ee=L(!1),[H,I]=b(!1),[he,u]=b(!0),[k,U]=b(!1),[$,A]=b(0),[z,oe]=b(0),[T,Y]=b(()=>{const r=parseFloat(localStorage.getItem("musicVolume")||"");return Number.isFinite(r)?r:1}),[E,le]=b(()=>localStorage.getItem("musicAutoplay")!=="false"),V=L(T);V.current=T;const N=L(E);N.current=E;const y=L(0),D=L(0),B=L(null),Q=L("");Q.current||(Q.current=typeof crypto<"u"&&"randomUUID"in crypto?crypto.randomUUID():`music-${Date.now()}-${Math.random().toString(36).slice(2)}`);const te=`/api/music/audio?videoId=${encodeURIComponent(a.id)}`,q=_e.useCallback(()=>{B.current&&(window.clearTimeout(B.current),B.current=null)},[]),Z=_e.useCallback(r=>{const o=M.current;if(!o)return;q(),u(!0),U(!1);const v=()=>{if(o.removeEventListener("loadedmetadata",v),r>5&&Number.isFinite(o.duration)&&r<o.duration-5)try{o.currentTime=r}catch{}};o.addEventListener("loadedmetadata",v),o.src=te,o.load(),o.volume=V.current,o.play().catch(()=>{})},[te,q]),ve=()=>{u(!1),U(!0),be?.(a),N.current&&R(1)},ce=()=>{if(!B.current){if(D.current>=3){ve();return}D.current+=1,B.current=window.setTimeout(()=>{B.current=null,Z(y.current)},5e3)}},ke=()=>{D.current=0,Z(y.current)};F(()=>{y.current=0,D.current=0,I(!1),A(0),oe(0);const r=M.current;return Z(y.current),()=>{q(),r&&r.removeAttribute("src")}},[Z,q]),F(()=>{const r=M.current;r&&(r.volume=T)},[T]),F(()=>(document.body.classList.add("asmr-player-open"),()=>document.body.classList.remove("asmr-player-open")),[]);const _=a.thumbnails?.[a.thumbnails.length-1]?.url??null,ne=_e.useCallback(r=>{const o=M.current;Ce.discord.musicPresence.mutate({title:a.title,artistLabel:a.artists,isPlaying:r,thumbnail:_||"",currentTime:o?.currentTime??0,duration:Number.isFinite(o?.duration??NaN)?o?.duration:0,sessionId:Q.current}).catch(()=>{}),Ce.discord.heartbeat.mutate({sessionId:Q.current}).catch(()=>{})},[a,_]);F(()=>{ne(H)},[ne,H,a.id]),F(()=>{if(!H)return;const r=window.setInterval(()=>ne(!0),15e3);return()=>window.clearInterval(r)},[H,ne]),F(()=>{const r=Q.current,o=()=>je(r),v=()=>o(),ae=()=>{document.visibilityState==="hidden"&&o()};return window.addEventListener("pagehide",v),window.addEventListener("beforeunload",v),document.addEventListener("visibilitychange",ae),()=>{window.removeEventListener("pagehide",v),window.removeEventListener("beforeunload",v),document.removeEventListener("visibilitychange",ae),o()}},[]);const pe=()=>{const r=M.current;r&&(r.paused?r.play().catch(()=>{}):r.pause())},[Ne,ge]=b(!1);F(()=>{ge(!1)},[_]);const ue=`${a.title} — ${a.artists}`,we=e(w,{children:[e("div",{className:n.playerButtons,children:[e("button",{className:n.playerBtn,onClick:()=>R(-1),"aria-label":"Previous track",children:e(g,{name:"step-backward"})}),e("button",{className:`${n.playerBtn} ${n.playBtn}`,onClick:pe,"aria-label":H?"Pause":"Play",children:H?e(g,{name:"pause"}):e(g,{name:"play"})}),e("button",{className:n.playerBtn,onClick:()=>R(1),"aria-label":"Next track",children:e(g,{name:"step-forward"})}),k&&e("button",{className:n.playerBtn,onClick:ke,title:"Retry playback","aria-label":"Retry playback",children:e(g,{name:"redo"})})]}),e("div",{className:n.seekRow,children:[e("span",{className:n.timeLabel,children:Be($)}),e("input",{className:n.seekBar,type:"range",min:0,max:z||0,step:.1,value:Math.min($,z||0),onChange:r=>{const o=M.current;!o||!Number.isFinite(o.duration)||(o.currentTime=parseFloat(r.target.value),A(o.currentTime))},onPointerDown:()=>{ee.current=!0},onPointerUp:()=>{ee.current=!1},style:{"--played-percent":`${z>0?$/z*100:0}%`},"aria-label":"Seek"}),e("span",{className:n.timeLabel,children:Be(z)}),he&&!k&&e("span",{className:n.timeLabel,children:"loading…"})]})]}),fe=e(w,{children:[a.thumbnails?.[0]?.url&&!Ne&&e("img",{src:a.thumbnails[0].url,alt:"",className:h.stationThumb,loading:"lazy",decoding:"async",onError:()=>ge(!0)}),e("div",{className:n.playerInfo,children:[e("p",{className:n.playerTitle,title:ue,children:ue}),e("p",{className:n.playerTrack,children:a.artists})]}),e("div",{className:n.playerControls,children:we}),e("div",{className:n.playerRight,children:[T===0?e(g,{name:"volume-mute",className:n.volumeIcon}):T<.5?e(g,{name:"volume-down",className:n.volumeIcon}):e(g,{name:"volume-up",className:n.volumeIcon}),e("input",{className:n.volumeBar,type:"range",min:0,max:1,step:.01,value:T,onChange:r=>{const o=parseFloat(r.target.value);Y(o),localStorage.setItem("musicVolume",String(o))},style:{"--volume-percent":`${T*100}%`},"aria-label":"Volume"})]}),e("div",{className:n.playerActions,children:[K&&X&&e("button",{className:`${n.playerBtn} ${W?n.playerBtnActive:""}`,onClick:X,disabled:re,title:W?"Remove from Liked Music":"Add to Liked Music","aria-label":W?"Remove from Liked Music":"Add to Liked Music","aria-pressed":!!W,children:e(g,{name:"heart"})}),e("button",{className:`${n.playerBtn} ${s?n.playerBtnActive:""}`,onClick:f,title:s?"Shuffle on":"Shuffle off","aria-label":"Toggle shuffle","aria-pressed":s,children:e(g,{name:"shuffle"})}),e("button",{className:`${n.playerBtn} ${E?n.playerBtnActive:""}`,onClick:()=>{le(r=>(localStorage.setItem("musicAutoplay",String(!r)),!r))},title:E?"Autoplay on: next track plays automatically":"Autoplay off","aria-label":"Toggle autoplay","aria-pressed":E,children:e(g,{name:"forward"})}),e("a",{href:`https://music.youtube.com/watch?v=${encodeURIComponent(a.id)}`,target:"_blank",rel:"noreferrer",title:"Open in YouTube Music","aria-label":"Open in YouTube Music",className:n.playerBtn,style:{display:"inline-flex",alignItems:"center"},children:e(g,{name:"external-link-alt"})}),e("button",{className:n.playerBtn,onClick:se,"aria-label":"Close player",children:e(g,{name:"times"})})]})]});return Ve(e(w,{children:[e("audio",{ref:M,preload:"none",onPlay:()=>{I(!0),u(!1),U(!1),D.current=0,q()},onPause:()=>I(!1),onWaiting:()=>{k||u(!0)},onPlaying:()=>{u(!1),D.current=0,q()},onTimeUpdate:r=>{const o=r.target.currentTime;y.current=o,q(),ee.current||A(o)},onStalled:()=>{ce()},onLoadedMetadata:r=>{const o=r.target.duration;Number.isFinite(o)&&oe(o)},onDurationChange:r=>{const o=r.target.duration;Number.isFinite(o)&&oe(o)},onError:()=>{ce()},onEnded:()=>{N.current&&R(1)}}),e("div",{className:n.playerBar,children:fe})]}),document.body)},Ke=()=>e("div",{style:{marginTop:"0.9rem",paddingTop:"0.9rem",borderTop:"1px dashed var(--border-color)"},children:[e("h4",{style:{margin:"0 0 0.35rem",fontSize:"0.95rem"},children:"Where to get the cookie"}),e("p",{style:{margin:"0 0 0.6rem",fontSize:"0.85rem",color:"var(--text-secondary)"},children:"Google marks its login cookies unreadable to page scripts, so this has to come from DevTools — it takes about 20 seconds:"}),e("ol",{style:{margin:"0 0 0.75rem",paddingLeft:"1.25rem",fontSize:"0.85rem",color:"var(--text-secondary)",display:"grid",gap:"0.3rem"},children:[e("li",{children:["Open"," ",e("a",{href:"https://music.youtube.com/",target:"_blank",rel:"noopener noreferrer",children:"music.youtube.com"})," ","and make sure you are logged in."]}),e("li",{children:["Press ",e("kbd",{children:"F12"}),", go to the ",e("strong",{children:"Network"})," tab, and type ",e("kbd",{children:"browse"})," ","in the filter box."]}),e("li",{children:["Click any ",e("kbd",{children:"POST"})," browse entry, then scroll to Request Headers."]}),e("li",{children:[e("strong",{children:"Right-click"})," the ",e("kbd",{children:"Cookie"})," value and choose"," ",e("strong",{children:"Copy value"})," — right-click copies the full unwrapped value, selecting the text by hand truncates it."]}),e("li",{children:"Paste it into the sign-in box above and press Sign in."})]})]}),me=300*1e3,Xe=()=>{const a=O();return J({...a.music.authStatus.queryOptions(),staleTime:30*1e3,refetchInterval:s=>s.state.data?.authenticated?!1:3e3,retry:1})},et=()=>{const a=O(),s=Pe();return Re(a.music.authStart.mutationOptions({onSuccess:(f,R)=>{localStorage.setItem("ytmusic_cookie",R.cookie??""),s.invalidateQueries(a.music.pathFilter())}}))},tt=()=>{const a=O(),s=Pe();return Re(a.music.signOut.mutationOptions({onSuccess:()=>{s.invalidateQueries(a.music.pathFilter())}}))},nt=a=>{const s=O();return J({...s.music.search.queryOptions({q:a}),enabled:a.trim().length>0,staleTime:me,retry:1})},at=a=>{const s=O();return J({...s.music.library.queryOptions(),enabled:a,staleTime:me,retry:1})},it=a=>{const s=O();return J({...s.music.track.queryOptions({id:a||void 0}),enabled:!!a,staleTime:me,retry:1})},st=a=>{const s=O();return J({...s.music.playlist.queryOptions({id:a||void 0}),enabled:!!a,staleTime:me,retry:1})},rt=a=>{const s=O();return J({...s.music.upnext.queryOptions({id:a||void 0}),enabled:!!a,staleTime:me,retry:1})},ot=a=>{const s=O();return J({...s.music.likes.queryOptions(),enabled:a,staleTime:120*1e3,retry:1})},lt=()=>{const a=O(),s=Pe();return Re(a.music.like.mutationOptions({onSuccess:()=>{s.invalidateQueries(a.music.pathFilter())}}))},ct="_authRow_10tvv_1",ut="_btn_10tvv_9",dt="_btnGhost_10tvv_42",mt="_cookieForm_10tvv_74",ht="_cookieInput_10tvv_83",pt="_link_10tvv_99",gt="_contentLayout_10tvv_109",ft="_mainCol_10tvv_116",yt="_upnextAside_10tvv_120",bt="_upnextHeader_10tvv_131",vt="_upnextTitle_10tvv_139",kt="_upnextActions_10tvv_149",Nt="_nowPlayingLabel_10tvv_156",wt="_nowPlayingWrap_10tvv_168",St="_likeBtn_10tvv_172",Tt="_likeActive_10tvv_196",p={authRow:ct,btn:ut,btnGhost:dt,cookieForm:mt,cookieInput:ht,link:pt,contentLayout:gt,mainCol:ft,upnextAside:yt,upnextHeader:bt,upnextTitle:vt,upnextActions:kt,nowPlayingLabel:Nt,nowPlayingWrap:wt,likeBtn:St,likeActive:Tt};function Fe(a){const s=a.trim();if(!s)return null;const f=s.match(/[?&]v=([A-Za-z0-9_-]{11})/)?.[1]??s.match(/youtu\.be\/([A-Za-z0-9_-]{11})/)?.[1]??null;return f||(/^[A-Za-z0-9_-]{11}$/.test(s)?s:null)}const xt="https://github.com/serifpersia/dango/releases/latest/download/dango-extension.zip",It=()=>{const[a,s]=Ze(),f=Fe(a.get("v")??""),[R,be]=b(""),[se,W]=b(""),[K,re]=b(()=>{try{return localStorage.getItem("ytmusic_cookie")??""}catch{return""}}),[X,M]=b(!1),[ee,H]=b(()=>localStorage.getItem("musicShuffle")==="true"),[I,he]=b(()=>localStorage.getItem("musicRadio")!=="false"),[u,k]=b(null),[U,$]=b([]),[A,z]=b(null),[oe,T]=b({}),Y=L([]);Y.current=U;const E=L(null);E.current=u;const le=L(!1),V=L(new Set),{data:N}=Xe(),y=et(),D=tt(),B=typeof navigator<"u"?navigator.userAgent:"",Q=/android/i.test(B),te=/firefox|fxios/i.test(B)&&!Q,q=!te&&!Q&&/chrome|chromium|edg|brave/i.test(B),Z=te||q,ve=()=>{if(X)return;M(!0);const t=`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`,i=window.setTimeout(()=>{window.removeEventListener("dango:ytmusic-cookie",c),M(!1),P.error("Helper not detected — install the Dango Helper extension first.")},3e3),c=d=>{let m;try{m=JSON.parse(d.detail)}catch{return}if(!(!m||m.requestId!==t))if(window.clearTimeout(i),window.removeEventListener("dango:ytmusic-cookie",c),M(!1),m?.ok&&m.cookie){const l=m.cookie.replace(/^cookie\s*:\s*/i,"").replace(/^["']+|["']+$/g,"").trim();if(l.includes("…")||l.includes("...")){P.error(`Helper returned a truncated cookie (${l.length} chars) — reload music.youtube.com and Extract again.`);return}re(l),P.success("Cookie extracted from helper — signing in…"),y.mutate({cookie:l})}else m?.error==="NO_COOKIE"?P.error("Helper found no YouTube login — log in on a music.youtube.com tab first."):P.error("Helper request failed — try again.")};window.addEventListener("dango:ytmusic-cookie",c),window.dispatchEvent(new CustomEvent("dango:get-ytmusic-cookie",{detail:{requestId:t}}))},{data:ce,isLoading:ke}=nt(se),{data:_,isLoading:ne,isFetching:pe,error:Ne,refetch:ge}=at(N?.authenticated===!0),{data:ue,isLoading:we}=st(A?.id??null),{data:fe,isLoading:Se}=rt(u?.id??null),{data:r}=ot(N?.authenticated===!0),o=lt(),v=G(()=>ce?.tracks||[],[ce]),ae=G(()=>_?.playlists||[],[_]),C=G(()=>_?.tracks||[],[_]),j=G(()=>ue?.tracks||[],[ue]),S=G(()=>{const t=fe?.tracks||[];return u?t.filter(i=>i.id!==u.id):t},[fe,u]),Oe=G(()=>new Set(r?.likedIds||[]),[r]),Te=t=>oe[t.id]??(Oe.has(t.id)||t.liked===!0);F(()=>{N?.authenticated!==!0&&T({})},[N?.authenticated]);const De=G(()=>[...v,...j,...C,...S],[v,j,C,S]),qe=f&&u?.id!==f&&!De.some(t=>t.id===f)?f:null,{data:Ie}=it(qe),xe=u?.id;F(()=>{document.title=u?`${u.title} - dango`:"Music - dango"},[u]),F(()=>{if(!f){xe&&k(null);return}if(xe===f)return;const t=d=>{const m=d.find(l=>l.id===f);return m?(k(m),$(l=>l.some(ie=>ie.id===f)?l:d.length>0?d:[m]),!0):!1};if(t(v)||t(j)||t(C))return;const i=S.find(d=>d.id===f);if(i){k(i),$(d=>d.some(m=>m.id===i.id)?d:[i]);return}const c=Ie?.track;c&&c.id===f&&(k(c),$(d=>d.some(m=>m.id===c.id)?d:[c]))},[f,xe,v,j,C,S,Ie]);const Le=(t,i)=>{V.current.delete(t.id),k(t),$(i.length>0?i:[t]),s({v:t.id})},He=t=>{V.current.add(t.id),P.error(`Couldn't play “${t.title}” — skipped.`)},Ue=async()=>{if(le.current)return;const t=Y.current,i=t[t.length-1]??E.current;if(i){le.current=!0;try{const c=await Ce.music.upnext.query({id:i.id}),d=new Set(t.map(l=>l.id)),m=(c.tracks||[]).filter(l=>!d.has(l.id)&&!V.current.has(l.id));if(m.length===0){const l=Y.current[0];l&&(k(l),s({v:l.id}));return}$([...Y.current,...m]),k(m[0]),s({v:m[0].id})}catch{const c=Y.current[0];c&&(k(c),s({v:c.id}))}finally{le.current=!1}}},ze=t=>{const i=Y.current,c=E.current;if(!c||i.length===0)return;const d=i.findIndex(x=>x.id===c.id);if(t>0&&I&&(d<0||d===i.length-1)){Ue();return}const m=x=>V.current.has(x.id),l=i.length;let ie;if(ee&&l>1){let x=Math.floor(Math.random()*l);for(let Me=0;Me<l&&(x===d||m(i[x]));Me++)x=Math.floor(Math.random()*l);ie=i[x]}else{const x=t>0?1:-1;let ye=(((d<0?x>0?-1:0:d)+x)%l+l)%l;for(let Ee=1;Ee<l&&m(i[ye]);Ee++)ye=((ye+x)%l+l)%l;ie=i[ye]}k(ie),s({v:ie.id})},Ye=()=>{if(I){he(!1),localStorage.setItem("musicRadio","false");return}const t=E.current;if(!t)return;if(S.length===0){P.error("No radio suggestions for this song yet.");return}const i=new Set,c=[];for(const d of[t,...S])i.has(d.id)||(i.add(d.id),c.push(d));he(!0),localStorage.setItem("musicRadio","true"),$(c),P.success(`Radio started — ${S.length} songs queued.`)},$e=t=>{if(N?.authenticated!==!0){P.error("Sign in to like songs.");return}const i=!Te(t);T(c=>({...c,[t.id]:i})),o.mutate({id:t.id,like:i},{onError:()=>{T(c=>{const d={...c};return delete d[t.id],d}),P.error("Like action failed — try again.")}})},Qe=()=>{H(t=>(localStorage.setItem("musicShuffle",String(!t)),!t))},Ge=t=>e("button",{className:h.stationRow,onClick:()=>z(t),"aria-label":`Open ${t.title}`,children:[t.thumbnails?.[0]?.url?e("img",{src:t.thumbnails[0].url,alt:"",className:h.stationThumb,loading:"lazy",decoding:"async"}):e("span",{className:h.stationThumbPlaceholder,children:e(g,{name:"headphones"})}),e("span",{className:h.stationMeta,children:[e("span",{className:h.stationName,children:t.title}),t.subtitle&&e("span",{className:h.stationSub,children:t.subtitle})]})]},t.id),de=(t,i,c)=>{const d=u?.id===t.id,m=Te(t),l=[t.album,t.duration].filter(Boolean).join(" · ");return e("div",{className:`${h.stationRow} ${d?h.stationRowActive:""}`,style:{cursor:"default"},children:[e("button",{onClick:()=>c?c(t):Le(t,i),className:h.stationRow,style:{flex:1,minWidth:0,background:"transparent",border:0,padding:0},"aria-label":`Play ${t.title}`,children:[t.thumbnails?.[0]?.url?e("img",{src:t.thumbnails[0].url,alt:"",className:h.stationThumb,loading:"lazy",decoding:"async"}):e("span",{className:h.stationThumbPlaceholder,children:e(g,{name:"headphones"})}),e("span",{className:h.stationMeta,children:[e("span",{className:h.stationName,children:t.title}),e("span",{className:h.stationSub,children:[t.artists,l?` · ${l}`:""]})]})]}),N?.authenticated===!0&&e("button",{className:`${p.likeBtn} ${m?p.likeActive:""}`,onClick:()=>$e(t),disabled:o.isPending,title:m?"Remove from Liked Music":"Add to Liked Music","aria-label":m?`Remove ${t.title} from Liked Music`:`Add ${t.title} to Liked Music`,"aria-pressed":m,children:e(g,{name:"heart"})}),e("a",{href:`https://music.youtube.com/watch?v=${encodeURIComponent(t.id)}`,target:"_blank",rel:"noreferrer",title:"Open in YouTube Music","aria-label":`Open ${t.title} in YouTube Music`,style:{padding:8,color:"inherit",opacity:.7,flexShrink:0},children:e(g,{name:"external-link-alt"})})]},t.id)},Ae=G(()=>{if(!u)return S;const t=new Set,i=[];for(const c of[u,...S])t.has(c.id)||(t.add(c.id),i.push(c));return i},[u,S]),We=t=>{Le(t,Ae)};return e("div",{className:`${n.page} ${u?n.pageWithPlayer:""}`,children:[e("div",{className:n.header,children:[e("h1",{className:n.pageTitle,children:[e(g,{name:"headphones"})," Music"]}),e("form",{className:n.searchForm,onSubmit:t=>{t.preventDefault();const i=Fe(R);i?(W(""),s({v:i})):W(R)},children:[e("input",{className:n.searchInput,value:R,onChange:t=>be(t.target.value),placeholder:"Search YouTube Music…","aria-label":"Search music"}),e("button",{className:n.searchBtn,type:"submit","aria-label":"Search",children:e(g,{name:"search"})})]})]}),e("div",{className:p.authRow,children:[N?.authenticated?e(w,{children:[e("span",{className:n.statusMsg,children:["Signed in to YouTube Music",_&&` — ${_.tracks.length} songs, ${_.playlists.length} playlists`]}),e("button",{className:p.btnGhost,onClick:()=>D.mutate(),disabled:D.isPending,children:"Sign out"})]}):e(w,{children:[e("form",{onSubmit:t=>{t.preventDefault();const i=K.replace(/^cookie\s*:\s*/i,"").replace(/^["']+|["']+$/g,"").trim();if(i){if(i.includes("…")||i.includes("...")){P.error("That cookie is truncated (contains …). Right-click the Cookie header → Copy value, not the wrapped preview.");return}i!==K&&re(i),y.mutate({cookie:i})}},className:p.cookieForm,children:[e("input",{className:p.cookieInput,value:K,onChange:t=>re(t.target.value),placeholder:"Paste music.youtube.com Cookie header…","aria-label":"YouTube Music cookie",type:"password"}),e("button",{className:p.btn,type:"submit",disabled:y.isPending||!K.trim(),children:y.isPending?"Checking…":"Sign in"}),Z&&e("button",{className:p.btnGhost,type:"button",onClick:ve,disabled:X||y.isPending,title:"Read the YouTube Music cookie via the Dango Helper extension (same zip as AnimePahe/JapaneseASMR)",children:X?"Extracting…":"Extract from helper"})]}),Z&&e("p",{className:n.statusMsg,children:["Two ways to sign in: paste the Cookie header manually (steps below), or download"," ",e("a",{href:xt,target:"_blank",rel:"noreferrer",className:p.link,children:"dango-extension.zip"})," ","then"," ",te?e(w,{children:[e("code",{children:"about:debugging"})," → ",e("strong",{children:"This Firefox"})," →"," ",e("strong",{children:"Load Temporary Add-on"})," →"," ",e("code",{children:"dango-extension/firefox/manifest.json"})]}):e(w,{children:[e("code",{children:"chrome://extensions"})," → ",e("strong",{children:"Developer mode"})," →"," ",e("strong",{children:"Load unpacked"})," → ",e("code",{children:"dango-extension/chrome"})]}),", log in on a music.youtube.com tab, and click Extract."]}),e(Ke,{})]}),y.isSuccess&&e("p",{className:n.statusMsg,children:["Signed in — found ",y.data.tracks," songs and ",y.data.playlists," ","playlists."]}),y.isError&&e("p",{className:n.statusMsg,children:y.error?.message||"Sign-in failed. Paste a fresh Cookie header from music.youtube.com."}),!N?.authenticated&&!y.isError&&!y.isSuccess&&e("p",{className:n.statusMsg,children:"Sign in with your YouTube Music cookie to see your library. Search and playback work without sign-in."})]}),e("div",{className:u?p.contentLayout:void 0,children:[e("div",{className:p.mainCol,children:se?e(w,{children:[e("h2",{className:h.sectionTitle,children:["Results for “",se,"”"]}),ke?e("p",{className:n.statusMsg,children:"Searching…"}):v.length===0?e("p",{className:n.statusMsg,children:"No tracks found."}):e("div",{className:h.stationList,children:v.map(t=>de(t,v))})]}):N?.authenticated?e(w,{children:[e("h2",{className:h.sectionTitle,children:"Your library"}),ne?e("p",{className:n.statusMsg,children:"Loading library…"}):ae.length===0&&C.length===0&&!A?e(w,{children:[e("p",{className:n.statusMsg,children:Ne?"Library failed to load.":"Your library came back empty — YouTube sometimes drops the saved session."}),e("div",{style:{marginBottom:8},children:e("button",{className:p.btnGhost,onClick:()=>{ge()},disabled:pe,"aria-label":"Retry loading library",children:pe?"Retrying…":"Retry"})}),e("p",{className:n.statusMsg,children:"If it keeps happening, sign out and paste a fresh cookie."})]}):e(w,{children:[ae.length>0&&!A&&e(w,{children:[e("h3",{className:h.sectionTitle,children:"Playlists"}),e("div",{className:h.stationList,children:ae.map(t=>Ge(t))})]}),C.length>0&&!A&&e(w,{children:[e("h3",{className:h.sectionTitle,children:["Liked songs (",C.length,")"]}),e("div",{style:{marginBottom:8},children:e("button",{className:p.btnGhost,onClick:()=>Le(C[0],C),"aria-label":"Play all liked songs",children:[e(g,{name:"play"})," Play all"]})}),e("div",{className:h.stationList,children:C.map(t=>de(t,C))})]}),A?e(w,{children:[e("button",{className:p.btnGhost,onClick:()=>z(null),style:{marginBottom:8},children:"← Back to library"}),e("h3",{className:h.sectionTitle,children:A.title}),we?e("p",{className:n.statusMsg,children:"Loading playlist…"}):j.length===0?e("p",{className:n.statusMsg,children:"No tracks in this playlist."}):e("div",{className:h.stationList,children:j.map(t=>de(t,j))})]}):null]})]}):e("p",{className:n.statusMsg,children:"Search above, or sign in to see your library."})}),u&&e("aside",{className:p.upnextAside,"aria-label":"Up next",children:[e("div",{className:p.upnextHeader,children:e("span",{className:p.upnextTitle,children:[e(g,{name:"list-ul"})," Up Next"]})}),e("div",{className:p.nowPlayingWrap,children:[e("p",{className:p.nowPlayingLabel,children:"Now playing"}),de(u,U.length>0?U:[u])]}),e("div",{className:p.upnextActions,children:e("button",{className:p.btnGhost,onClick:Ye,disabled:!I&&(Se||S.length===0),"aria-pressed":I,title:I?"Stop the radio — the queue will loop instead of fetching more songs":"Queue these suggestions after the current song and keep the mix going",children:I?"Stop radio":"Start radio"})}),Se?e("p",{className:n.statusMsg,children:"Loading suggestions…"}):S.length===0?e("p",{className:n.statusMsg,children:"No suggestions for this song."}):e("div",{className:h.stationList,children:S.map(t=>de(t,Ae,We))})]})]}),u&&e(Je,{track:u,queue:U,shuffle:ee,onToggleShuffle:Qe,onTrackStep:ze,onTrackFailed:He,onClose:()=>{k(null),s({})},liked:u?Te(u):!1,likeVisible:N?.authenticated===!0,likePending:o.isPending,onToggleLike:()=>$e(u)})]})};export{It as default};
@@ -1 +1 @@
1
- import{u as e,S as p,d as y,h as S}from"./vendor-core-DfaOB3Rn.js";import{I as m}from"./vendor-icons-DrybRNxP.js";import{M as s,y as b,T as g,B as f,z as k,D as C}from"./AvSyncCalibrator-BroSW86T.js";const O=({classes:n,title:i,titleTag:o="span",showBack:l=!0,onBack:t,panelRef:d,onPanelClick:a,children:c})=>{const r=o;return e("div",{ref:d,className:n.panel,onClick:a,"data-speed-boost-ignore":"true",children:[e("div",{className:n.header,children:[l&&e("button",{className:n.backBtn,onClick:t,children:e(m,{name:"chevron-left"})}),e(r,{className:n.title||void 0,children:i})]}),e("div",{className:n.content,children:c})]})},z=({classes:n,values:i,onChange:o})=>{const l=()=>{const t=C;o("fontSize",t.fontSize),o("position",t.position),o("bgOpacity",t.bgOpacity),o("bgColor",t.bgColor),o("textColor",t.textColor),o("edge",t.edge),o("bold",t.bold)};return e(p,{children:[e(s,{label:"Font Size",display:i.fontSize.toFixed(1),min:.5,max:10,step:.5,value:i.fontSize,percent:(i.fontSize-.5)/9.5*100,onChange:t=>{Number.isFinite(t)&&o("fontSize",t)}}),e(s,{label:"Vertical Position",display:`${i.position}`,min:0,max:100,step:1,value:i.position,percent:i.position,onChange:t=>{Number.isFinite(t)&&o("position",Math.round(t))}}),e(s,{label:"Background Opacity",display:`${Math.round(i.bgOpacity*100)}%`,min:0,max:1,step:.05,value:i.bgOpacity,percent:i.bgOpacity*100,onChange:t=>{Number.isFinite(t)&&o("bgOpacity",t)}}),e(b,{label:"Text Color",colors:g,value:i.textColor,onChange:t=>o("textColor",t)}),e(b,{label:"Background Color",colors:f,value:i.bgColor,onChange:t=>o("bgColor",t)}),e(k,{label:"Text Edge",options:["shadow","outline","none"],value:i.edge,onChange:t=>o("edge",t)}),e("button",{type:"button",className:`${n.item} ${i.bold?n.active:""}`,onClick:()=>o("bold",!i.bold),children:[e("span",{children:"Bold Text"}),i.bold&&e(m,{name:"check",size:12})]}),e("button",{type:"button",className:n.item,onClick:l,children:e("span",{children:"Reset to Defaults"})})]})},M=({classes:n,enabled:i,delayMs:o,onToggle:l,onDelayChange:t,onCalibrate:d})=>{const[a,c]=y(null),r=a??o;S(()=>{c(null)},[o]);const u=()=>{a!==null&&(t(a),c(null))};return e(p,{children:[e("button",{type:"button",className:`${n.item} ${i?n.active:""}`,onClick:()=>l(!i),children:[e("span",{children:"Video delay"}),i&&e(m,{name:"check",size:12})]}),e(s,{label:"Video delay",display:`${r}ms`,min:0,max:500,step:5,value:r,percent:r/500*100,onChange:h=>c(Math.round(h)),onCommit:u}),e("div",{className:n.note,children:"For Bluetooth headsets where audio arrives late. Video is held back via canvas; audio plays untouched."}),d&&e("button",{type:"button",className:n.item,onClick:d,children:e("span",{children:"Calibrate…"})})]})},E=({classes:n,options:i,onSelect:o})=>e(p,{children:i.map(l=>e("button",{type:"button",className:`${n.item} ${l.selected?n.active:""}`,onClick:()=>o(l.key),children:[e("span",{children:l.label}),l.selected&&e(m,{name:"check",size:12})]},l.key))});export{M as A,E as O,O as S,z as a};
1
+ import{u as e,S as p,d as y,h as S}from"./vendor-core-DfaOB3Rn.js";import{I as m}from"./vendor-icons-DrybRNxP.js";import{M as s,y as b,T as g,B as f,z as k,D as C}from"./AvSyncCalibrator-FJllOgOH.js";const O=({classes:n,title:i,titleTag:o="span",showBack:l=!0,onBack:t,panelRef:d,onPanelClick:a,children:c})=>{const r=o;return e("div",{ref:d,className:n.panel,onClick:a,"data-speed-boost-ignore":"true",children:[e("div",{className:n.header,children:[l&&e("button",{className:n.backBtn,onClick:t,children:e(m,{name:"chevron-left"})}),e(r,{className:n.title||void 0,children:i})]}),e("div",{className:n.content,children:c})]})},z=({classes:n,values:i,onChange:o})=>{const l=()=>{const t=C;o("fontSize",t.fontSize),o("position",t.position),o("bgOpacity",t.bgOpacity),o("bgColor",t.bgColor),o("textColor",t.textColor),o("edge",t.edge),o("bold",t.bold)};return e(p,{children:[e(s,{label:"Font Size",display:i.fontSize.toFixed(1),min:.5,max:10,step:.5,value:i.fontSize,percent:(i.fontSize-.5)/9.5*100,onChange:t=>{Number.isFinite(t)&&o("fontSize",t)}}),e(s,{label:"Vertical Position",display:`${i.position}`,min:0,max:100,step:1,value:i.position,percent:i.position,onChange:t=>{Number.isFinite(t)&&o("position",Math.round(t))}}),e(s,{label:"Background Opacity",display:`${Math.round(i.bgOpacity*100)}%`,min:0,max:1,step:.05,value:i.bgOpacity,percent:i.bgOpacity*100,onChange:t=>{Number.isFinite(t)&&o("bgOpacity",t)}}),e(b,{label:"Text Color",colors:g,value:i.textColor,onChange:t=>o("textColor",t)}),e(b,{label:"Background Color",colors:f,value:i.bgColor,onChange:t=>o("bgColor",t)}),e(k,{label:"Text Edge",options:["shadow","outline","none"],value:i.edge,onChange:t=>o("edge",t)}),e("button",{type:"button",className:`${n.item} ${i.bold?n.active:""}`,onClick:()=>o("bold",!i.bold),children:[e("span",{children:"Bold Text"}),i.bold&&e(m,{name:"check",size:12})]}),e("button",{type:"button",className:n.item,onClick:l,children:e("span",{children:"Reset to Defaults"})})]})},M=({classes:n,enabled:i,delayMs:o,onToggle:l,onDelayChange:t,onCalibrate:d})=>{const[a,c]=y(null),r=a??o;S(()=>{c(null)},[o]);const u=()=>{a!==null&&(t(a),c(null))};return e(p,{children:[e("button",{type:"button",className:`${n.item} ${i?n.active:""}`,onClick:()=>l(!i),children:[e("span",{children:"Video delay"}),i&&e(m,{name:"check",size:12})]}),e(s,{label:"Video delay",display:`${r}ms`,min:0,max:500,step:5,value:r,percent:r/500*100,onChange:h=>c(Math.round(h)),onCommit:u}),e("div",{className:n.note,children:"For Bluetooth headsets where audio arrives late. Video is held back via canvas; audio plays untouched."}),d&&e("button",{type:"button",className:n.item,onClick:d,children:e("span",{children:"Calibrate…"})})]})},E=({classes:n,options:i,onSelect:o})=>e(p,{children:i.map(l=>e("button",{type:"button",className:`${n.item} ${l.selected?n.active:""}`,onClick:()=>o(l.key),children:[e("span",{children:l.label}),l.selected&&e(m,{name:"check",size:12})]},l.key))});export{M as A,E as O,O as S,z as a};
@@ -0,0 +1,56 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/PlayerSettings-icy4SfQa.js","assets/vendor-core-DfaOB3Rn.js","assets/vendor-icons-DrybRNxP.js","assets/OptionListMenu-CyfpCBEy.js","assets/AvSyncCalibrator-FJllOgOH.js","assets/index-CVB5dYhT.js","assets/vendor-query-BBT5_sHx.js","assets/index-Cc1Up_NI.css","assets/AvSyncCalibrator-C2wu1ydI.css","assets/PlayerSettings-Bj6SsmQ2.css"])))=>i.map(i=>d[i]);
2
+ import{g as Wt,h as x,u as r,P as Or,z as Wr,d as Q,A as v,q as O,y as Vr,T as ut,o as Ur,a as qr,c as Qr,_ as zr,S as kt}from"./vendor-core-DfaOB3Rn.js";import{_ as hr,S as Nt,h as Gr,t as ke,z as Ke,P as Kr,e as Hr,l as jr,m as Yr,n as Xr,o as Jr,d as Zr,u as en,M as Le,B as st,Q as tn,f as rn}from"./index-CVB5dYhT.js";import{u as fr,b as ur,a as jt}from"./vendor-query-BBT5_sHx.js";import{C as nn,S as sn,U as on,a as an,p as Yt,s as ln,l as cn,u as un,b as dn,i as pn,c as mn,d as dr,f as pr,e as hn,g as fn,h as vn,r as gn,j as Ge,E as bn,k as yn,m as u,n as Sn,A as En,P as wn,o as kn,q as Tn}from"./AvSyncCalibrator-FJllOgOH.js";import{I as q}from"./vendor-icons-DrybRNxP.js";import{l as Cn}from"./hls-D48GVTkk.js";import{u as Rn}from"./useIsMobile-Dvx1uJ82.js";import{s as ot,Q as Mn}from"./QueueRail-DaMjlKL4.js";import{u as _n,Q as Nn}from"./QueueOptionsButton-5eloKF5J.js";import{u as vr}from"./useProviders-pwxPZPHh.js";import{A as Pn}from"./AnimeMetaDetails-BogOi_bM.js";import{S as xn}from"./SynopsisText-B3Sa5pRv.js";import"./vendor-ui-3qrARCPr.js";const An={soft:"Softsub",hard:"Hardsub",mixed:"Mixed"},Bn={direct:"Direct",embed:"Embed",cookie:"Needs cookie"},Ln=["direct","cookie","embed"],In="_controlsOverlay_1b7ea_1",Dn="_hidden_1b7ea_21",$n="_topControls_1b7ea_27",Fn="_backBtn_1b7ea_47",On="_videoTitleInfo_1b7ea_67",Wn="_animeTitle_1b7ea_73",Vn="_episodeNumber_1b7ea_81",Un="_bottomControls_1b7ea_89",qn="_progressBarContainer_1b7ea_108",Qn="_progressBar_1b7ea_108",zn="_thumb_1b7ea_127",Gn="_scrubbing_1b7ea_142",Kn="_watchedBar_1b7ea_146",Hn="_bufferedBar_1b7ea_147",jn="_timeBubble_1b7ea_185",Yn="_skipSegment_1b7ea_219",Xn="_op_1b7ea_229",Jn="_ed_1b7ea_232",Zn="_recap_1b7ea_235",es="_bottomControlsRow_1b7ea_239",ts="_leftControls_1b7ea_247",rs="_rightControls_1b7ea_248",ns="_controlBtn_1b7ea_255",ss="_theaterBtn_1b7ea_296",os="_nextEpisodeBtn_1b7ea_300",as="_active_1b7ea_317",is="_timeDisplay_1b7ea_321",ls="_skipControls_1b7ea_329",cs="_skipBtn_1b7ea_335",us="_volumeContainer_1b7ea_376",ds="_volumeSlider_1b7ea_382",ps="_playerPageLayout_1b7ea_440",ms="_videoPlayerWrapper_1b7ea_444",hs="_playerInfoContainer_1b7ea_449",fs="_visible_1b7ea_566",vs="_shortcuts_1b7ea_584",w={controlsOverlay:In,hidden:Dn,topControls:$n,backBtn:Fn,videoTitleInfo:On,animeTitle:Wn,episodeNumber:Vn,bottomControls:Un,progressBarContainer:qn,progressBar:Qn,thumb:zn,scrubbing:Gn,watchedBar:Kn,bufferedBar:Hn,timeBubble:jn,skipSegment:Yn,op:Xn,ed:Jn,recap:Zn,bottomControlsRow:es,leftControls:ts,rightControls:rs,controlBtn:ns,theaterBtn:ss,nextEpisodeBtn:os,active:as,timeDisplay:is,skipControls:ls,skipBtn:cs,volumeContainer:us,volumeSlider:ds,playerPageLayout:ps,videoPlayerWrapper:ms,playerInfoContainer:hs,visible:fs,shortcuts:vs},gs=Wr(()=>hr(()=>import("./PlayerSettings-icy4SfQa.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9]))),bs=({player:n,isAutoplayEnabled:g,onAutoplayChange:k,showNextEpisodeButton:j,onNextEpisode:b,videoSources:M,selectedSource:E,selectedLink:L,onSourceChange:B,loadingVideo:z,skipIntervals:Te,animeTitle:e,episodeNumber:h,isTheaterMode:Ce,onTheaterModeToggle:N,anime4kEnabled:ae,onAnime4kToggle:Fe,anime4kSupported:W,anime4kProfile:A,onAnime4kProfileChange:$,anime4kInitializing:Oe,anime4kError:He,videoDelayEnabled:a,onVideoDelayToggle:p,videoDelayMs:T,onVideoDelayChange:pe,onCalibrateAvSync:We,fallbackChoice:je,onFallbackChoiceChange:be,children:Ye,overlays:ee,isInteractingExtra:Re=!1,className:ce,hideChrome:d=!1})=>{const{state:o,refs:l,actions:f}=n,{showSettings:D}=o,{setShowSettings:Y,setShowVolumeSlider:G}=f,V=Wt.useRef(null),ie=Wt.useRef(null);x(()=>{const m=P=>{V.current&&!V.current.contains(P.target)&&ie.current&&!ie.current.contains(P.target)&&D&&Y(!1)};return D&&document.addEventListener("mousedown",m),()=>{document.removeEventListener("mousedown",m)}},[D,Y]);const ye=Wt.useRef(null),at=m=>{l.videoRef.current&&(l.videoRef.current.volume=m,l.videoRef.current.muted=m===0,localStorage.setItem("playerVolume",m.toString()))},Xe=m=>{!l.videoRef.current||isNaN(o.duration)||o.duration===0||(l.videoRef.current.currentTime=m*o.duration,f.sendProgressUpdate(!1,!0))},bt=()=>{l.videoRef.current&&(f.setIsScrubbing(!0),f.wasPlayingBeforeScrub.current=!l.videoRef.current.paused,l.videoRef.current.pause())},K=m=>{!l.videoRef.current||!o.duration||(l.videoRef.current.currentTime=m*o.duration)},it=()=>{f.setIsScrubbing(!1),f.wasPlayingBeforeScrub.current&&l.videoRef.current?.play()},dt=m=>{if(!l.videoRef.current)return;f.setActiveSubtitleTrack(m);try{if(m===null||m==="off")localStorage.setItem("playerSubtitlesEnabled","false");else{localStorage.setItem("playerSubtitlesEnabled","true");const C=o.availableSubtitles.find(Ue=>Ue.label===m||Ue.lang===m);C?localStorage.setItem("playerLastSubtitle",ln(C)):localStorage.setItem("playerLastSubtitle",m)}}catch{}let P=!1;Array.from(l.videoRef.current.textTracks).forEach(C=>{const Ie=m!==null&&m!=="off"&&(C.language===m||C.label===m)&&!P;C.mode=Ie?"showing":"hidden",Ie&&(P=!0)})},te=o.activeSubtitleTrack!==null&&o.activeSubtitleTrack!=="off",ue=()=>{if(!l.videoRef.current)return;if(te){dt("off");return}if(o.availableSubtitles.length===0)return;let m=null;try{m=localStorage.getItem("playerLastSubtitle")}catch{}const P=Yt(o.availableSubtitles,{lastKey:m,enabled:!0});if(P<0)return;const C=o.availableSubtitles[P];dt(C.label||C.lang)},Me=()=>o.isMuted||o.volume===0?r(q,{name:"volume-mute"}):o.volume<.5?r(q,{name:"volume-down"}):r(q,{name:"volume-up"}),yt=r("div",{className:`${w.controlsOverlay} ${!o.showControls&&!D&&!o.isScrubbing?w.hidden:""} `,"data-speed-boost-ignore":"true",style:{pointerEvents:"none",background:"none"},children:r("div",{className:w.topControls,onClick:m=>m.stopPropagation(),children:[r("button",{className:w.backBtn,onClick:m=>{m.stopPropagation(),window.history.back()},title:"Back","aria-label":"Back",children:r(q,{name:"chevron-left"})}),r("div",{className:w.videoTitleInfo,children:[r("span",{className:w.animeTitle,children:e}),h&&r("span",{className:w.episodeNumber,children:["Episode ",h]})]})]})}),F=!z&&!o.isBuffering&&o.duration>0?r(nn,{isPlaying:o.isPlaying,onTogglePlay:f.togglePlay,onSkipBack:()=>f.seek(-10),onSkipForward:()=>f.seek(10)}):null,Ve=r("div",{className:`${w.controlsOverlay} ${!o.showControls&&!D&&!o.isScrubbing?w.hidden:""} `,"data-speed-boost-ignore":"true",style:{pointerEvents:"none",background:"none",justifyContent:"flex-end"},children:r("div",{className:w.bottomControls,"data-speed-boost-ignore":"true",onClick:m=>m.stopPropagation(),children:[r(sn,{classes:{container:w.progressBarContainer,scrubbing:w.scrubbing,timeBubble:w.timeBubble,bar:w.progressBar,buffered:w.bufferedBar,watched:w.watchedBar,thumb:w.thumb},videoRef:l.videoRef,duration:o.duration,formatTime:f.formatTime,isScrubbing:o.isScrubbing,onSeek:Xe,onScrubStart:bt,onScrubMove:K,onScrubEnd:it,timeLabelRef:ye,children:[o.duration>0&&n.state.currentSkipInterval&&r("div",{className:`${w.skipSegment} ${w[n.state.currentSkipInterval.skip_type]} `,style:{left:`${n.state.currentSkipInterval.start_time/o.duration*100}% `,width:`${(n.state.currentSkipInterval.end_time-n.state.currentSkipInterval.start_time)/o.duration*100}% `}}),Te.map(m=>{const P=m.start_time/o.duration*100,C=(m.end_time-m.start_time)/o.duration*100;return r("div",{className:`${w.skipSegment} ${w[m.skip_type]} `,style:{left:`${P}% `,width:`${C}% `},title:m.skip_type.toUpperCase()},m.skip_id)})]}),r("div",{className:w.bottomControlsRow,children:[r("div",{className:w.leftControls,children:[r("button",{className:w.controlBtn,onClick:f.togglePlay,"aria-label":o.isPlaying?"Pause":"Play",children:o.isPlaying?r(q,{name:"pause"}):r(q,{name:"play"})}),r(on,{muted:o.isMuted,volume:o.volume,volumeIcon:Me(),buttonClassName:w.controlBtn,onToggleMute:f.toggleMute,onVolumeChange:at,onExpandedChange:m=>G(m)}),r("span",{className:w.timeDisplay,ref:ye,children:[f.formatTime(0)," / ",f.formatTime(o.duration)]}),o.currentSkipInterval&&!o.isAutoSkipEnabled&&r("button",{className:w.controlBtn,onClick:()=>{l.videoRef.current&&o.currentSkipInterval&&(l.videoRef.current.currentTime=o.currentSkipInterval.end_time,f.setCurrentSkipInterval(null))},children:["Skip ",o.currentSkipInterval.skip_type==="op"?"Opening":"Ending"]})]}),r("div",{className:w.rightControls,children:[r("div",{className:w.skipControls,children:j&&r("button",{className:w.nextEpisodeBtn,onClick:b,title:"Play next episode",children:"Next EP"})}),r("button",{className:`${w.controlBtn} ${te?w.active:""}`,onClick:ue,title:te?"Disable Subtitles":"Enable Subtitles","aria-label":"Toggle Subtitles",children:r(q,{name:"closed-captioning",size:22})}),r("button",{ref:ie,className:`${w.controlBtn} ${D?w.active:""} `,onClick:()=>Y(!D),"aria-label":"Settings",children:r(q,{name:"cog"})}),r("button",{className:`${w.controlBtn} ${w.theaterBtn} ${Ce?w.active:""} `,onClick:m=>{m.stopPropagation(),N()},title:Ce?"Exit Theater Mode":"Theater Mode","aria-label":Ce?"Exit Theater Mode":"Theater Mode",children:r(q,{name:"tv"})}),r("button",{className:w.controlBtn,onClick:f.toggleFullscreen,"aria-label":o.isFullscreen?"Exit Fullscreen":"Fullscreen",children:o.isFullscreen?r(q,{name:"compress"}):r(q,{name:"expand"})})]})]})]})}),pt=r(Or,{fallback:null,children:r(gs,{ref:V,isOpen:D,onClose:()=>Y(!1),videoSources:M,currentSource:E,currentLink:L,onSourceChange:B,subtitles:o.availableSubtitles,activeSubtitleTrack:o.activeSubtitleTrack,onSubtitleChange:dt,subtitleSettings:{fontSize:o.subtitleFontSize,position:o.subtitlePosition,bgOpacity:o.subtitleBgOpacity,bgColor:o.subtitleBgColor,textColor:o.subtitleTextColor,edge:o.subtitleEdge,bold:o.subtitleBold},onSubtitleSettingsChange:(m,P)=>{const C=(Ue,Ie)=>{try{localStorage.setItem(Ue,String(Ie))}catch{}};switch(m){case"fontSize":f.setSubtitleFontSize(P),C("subtitleFontSize",P);break;case"position":f.setSubtitlePosition(P),C("subtitlePosition",P);break;case"bgOpacity":f.setSubtitleBgOpacity(P),C("subtitleBgOpacity",P);break;case"bgColor":f.setSubtitleBgColor(P),C("subtitleBgColor",P);break;case"textColor":f.setSubtitleTextColor(P),C("subtitleTextColor",P);break;case"edge":f.setSubtitleEdge(P),C("subtitleEdge",P);break;case"bold":f.setSubtitleBold(P),C("subtitleBold",P);break}},useNativeControls:o.useNativeControls,onNativeControlsToggle:f.setUseNativeControls,anime4kEnabled:ae,onAnime4kToggle:Fe,anime4kSupported:W,anime4kProfile:A,onAnime4kProfileChange:$,anime4kInitializing:Oe,anime4kError:He,videoDelayEnabled:a,onVideoDelayToggle:p,videoDelayMs:T,onVideoDelayChange:pe,onCalibrateAvSync:We,isAutoSkipEnabled:o.isAutoSkipEnabled,onAutoSkipChange:m=>{f.setIsAutoSkipEnabled(m);try{localStorage.setItem("autoSkipEnabled",m.toString())}catch{}},isAutoplayEnabled:g,onAutoplayChange:k,fallbackChoice:je,onFallbackChoiceChange:be})}),lt=D?r("div",{"data-speed-boost-ignore":"true",onClick:m=>m.stopPropagation(),children:pt}):null;return r(an,{player:n,topBar:yt,centerControls:F,bottomBar:!z&&o.duration>0?Ve:null,settingsPanel:lt,overlays:ee,isInteracting:Re,className:ce,chromeDisabled:d,children:Ye})},ys=({count:n=3})=>r("section",{className:ot.section,children:[r("div",{className:ot.header,children:r("button",{className:ot.headerToggle,disabled:!0,children:[r("span",{className:ot.title,children:r(Nt,{width:"60px",height:"1.2rem",variant:"text"})}),r(q,{name:"chevron-down",style:{opacity:.3}})]})}),r("div",{className:ot.list,children:Array.from({length:n}).map((g,k)=>r("div",{className:ot.item,style:{pointerEvents:"none"},children:[r("div",{className:ot.dragHandle,style:{opacity:.2},children:r(Nt,{width:"16px",height:"16px",variant:"rectangular"})}),r("div",{className:ot.thumbnail,style:{overflow:"hidden",background:"transparent"},children:r(Nt,{width:"100%",height:"100%",variant:"rectangular"})}),r("div",{className:ot.meta,children:[r(Nt,{width:"80%",height:"1.2rem",variant:"text",className:"mb-2"}),r(Nt,{width:"40%",height:"0.8rem",variant:"rectangular",style:{borderRadius:"var(--radius-sm)"}})]})]},k))})]}),Ss="_sourceSelectionContainer_c5tub_76",Es="_providerSelectContainer_c5tub_89",ws="_providerSelect_c5tub_89",ks="_sourceSelect_c5tub_76",Ts="_sourceButtons_c5tub_145",Cs="_sourceButton_c5tub_145",Rs="_active_c5tub_170",gt={sourceSelectionContainer:Ss,providerSelectContainer:Es,providerSelect:ws,sourceSelect:ks,sourceButtons:Ts,sourceButton:Cs,active:Rs},Ms=({selectedProvider:n,onProviderChange:g,isAdult:k,options:j})=>{const b=j&&j.length>0?j:[],M=k===void 0?b:b.filter(E=>E.mature===k);return r("div",{className:gt.providerSelectContainer,children:[r("h4",{children:"Provider"}),r("select",{className:gt.providerSelect,value:n,onChange:E=>g(E.target.value),children:Ln.map(E=>{const L=M.filter(B=>(B.tier??"direct")===E);return L.length===0?null:r("optgroup",{label:Bn[E],children:L.map(B=>r("option",{value:B.value,children:B.sub?`${B.label} (${An[B.sub]})`:B.label},B.value))},E)})})]})},_s=({videoSources:n,selectedSource:g,selectedLink:k,onSourceChange:j,onLinkChange:b})=>{const M=Array.isArray(n)?n:[];if(M.length===0)return null;const E=g?.type==="iframe"&&(g.links?.length??0)>1;return r("div",{className:gt.sourceSelectionContainer,children:[r("h4",{children:"Source"}),r("div",{className:gt.sourceButtons,children:M.map((L,B)=>r("button",{className:`${gt.sourceButton} ${g?.sourceName===L.sourceName?gt.active:""} `,onClick:()=>j(L),children:L.sourceName},`${L.sourceName}-${B}`))}),E&&r("select",{className:gt.sourceSelect,"aria-label":"Fallback embed quality",value:k?.link??g.links[0]?.link??"",onChange:L=>{const B=g.links.find(z=>z.link===L.target.value);B&&b(B)},children:g.links.map(L=>r("option",{value:L.link,children:L.resolutionStr},L.link))})]})},Ns=Wt.memo(_s,(n,g)=>n.selectedSource?.sourceName===g.selectedSource?.sourceName&&n.selectedLink?.link===g.selectedLink?.link&&n.videoSources===g.videoSources),Ps={low:{sd:1.5,hd:1.3,fhd:1.25},balanced:{sd:2,hd:1.5,fhd:1.25},high:{sd:2.5,hd:2,fhd:1.5},denoise:{sd:1.5,hd:1.5,fhd:1.5}},xs={low:"ModeB",balanced:"ModeA",high:"ModeAA",denoise:"ModeC"},As=5,Bs=15e3,Ls=`
3
+ @group(0) @binding(0) var extTex: texture_external;
4
+ @group(0) @binding(1) var extSamp: sampler;
5
+ struct VSOut {
6
+ @builtin(position) pos: vec4f,
7
+ @location(0) uv: vec2f,
8
+ };
9
+ @vertex
10
+ fn vs(@builtin(vertex_index) idx: u32) -> VSOut {
11
+ var positions = array<vec2f, 6>(
12
+ vec2f(-1.0, -1.0), vec2f(1.0, -1.0), vec2f(-1.0, 1.0),
13
+ vec2f(-1.0, 1.0), vec2f(1.0, -1.0), vec2f(1.0, 1.0)
14
+ );
15
+ var uvs = array<vec2f, 6>(
16
+ vec2f(0.0, 1.0), vec2f(1.0, 1.0), vec2f(0.0, 0.0),
17
+ vec2f(0.0, 0.0), vec2f(1.0, 1.0), vec2f(1.0, 0.0)
18
+ );
19
+ var out: VSOut;
20
+ out.pos = vec4f(positions[idx], 0.0, 1.0);
21
+ out.uv = uvs[idx];
22
+ return out;
23
+ }
24
+ @fragment
25
+ fn fs(@location(0) uv: vec2f) -> @location(0) vec4f {
26
+ return textureSampleBaseClampToEdge(extTex, extSamp, uv);
27
+ }
28
+ `;function Is({videoRef:n,canvasRef:g,profile:k="balanced",delayMs:j=0}){const[b,M]=Q(!1),[E,L]=Q(()=>{try{return localStorage.getItem("anime4kEnabled")==="true"}catch{return!1}}),[B,z]=Q(!1),[Te,e]=Q(null),[h,Ce]=Q(0),N=v(0),ae=v(null),Fe=v(null),W=v(null),A=v(null),$=v(null),Oe=v(null),He=v(null),a=v(null),p=v(null),T=v(!1),pe=v(-1),We=v(0),je=v(j);je.current=j;const be=v([]),Ye=v(!1),ee=v(!1),Re=v(!1),ce=v(null),d=v(-1),o=v(-1),l=v(!1),f=v(0);x(()=>{async function G(){if(typeof navigator>"u"||!navigator.gpu){M(!1);return}try{const V=await navigator.gpu.requestAdapter();M(!!V)}catch{M(!1)}}G()},[]),x(()=>{if(!E||!b)return;let G=!1;const V=++N.current,ie=K=>{if(K)try{K.close()}catch{}},ye=()=>{for(const K of be.current)ie(K.bitmap);be.current=[]},at=K=>Math.max(8,Math.min(40,Math.ceil(K/16.7)+4));function Xe(){p.current!==null&&(cancelAnimationFrame(p.current),p.current=null)}async function bt(){let K=n.current;const it=g.current;if(!K||!it||N.current!==V)return;const dt=performance.now()+Bs;for(;(!K||K.videoWidth===0)&&performance.now()<dt;){if(await new Promise(C=>requestAnimationFrame(C)),G||N.current!==V)return;K=n.current}if(!K||K.videoWidth===0){!G&&N.current===V&&(e("Timed out waiting for video metadata"),z(!1),L(!1));return}const te=K.videoWidth,ue=K.videoHeight,Me=Math.max(te,ue),yt=window.innerWidth,F=window.innerHeight,Ve=Math.max(yt,F),pt=Me<Ve?Ve/Me:1,lt=Ps[k],m=Me<=480?lt.sd:Me<=720?lt.hd:Me<=1080?lt.fhd:1,P=Math.min(m,pt);it.width=Math.round(te*P),it.height=Math.round(ue*P),z(!0),e(null),We.current=0,pe.current=-1,d.current=-1,o.current=-1,l.current=!1,f.current=0,ye(),T.current=!1;try{let C=function(){G||N.current!==V||(Xe(),p.current=requestAnimationFrame(()=>{mt()}))};const{ModeA:Ue,ModeB:Ie,ModeC:Tt,ModeAA:Jt}=await hr(async()=>{const{ModeA:I,ModeB:re,ModeC:$e,ModeAA:ne}=await import("./index-BOKlZEHq.js").then(me=>me.i);return{ModeA:I,ModeB:re,ModeC:$e,ModeAA:ne}},[]);if(!navigator.gpu)throw new Error("WebGPU not available");const Pt=await navigator.gpu.requestAdapter();if(!Pt)throw new Error("No GPU adapter found");const _=await Pt.requestDevice();if(!_)throw new Error("Failed to get GPU device");const De=it.getContext("webgpu");if(!De)throw new Error("Failed to get WebGPU context");const Je=navigator.gpu.getPreferredCanvasFormat();De.configure({device:_,format:Je,alphaMode:"premultiplied"});const Se=_.createTexture({size:[te,ue],format:"rgba16float",usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.RENDER_ATTACHMENT}),Ct=xs[k],qe=Math.round(te*P),Qe=Math.round(ue*P),Ze=(()=>{switch(Ct){case"ModeB":return new Ie({device:_,inputTexture:Se,nativeDimensions:{width:te,height:ue},targetDimensions:{width:qe,height:Qe}});case"ModeC":return new Tt({device:_,inputTexture:Se,nativeDimensions:{width:te,height:ue},targetDimensions:{width:qe,height:Qe}});case"ModeAA":return new Jt({device:_,inputTexture:Se,nativeDimensions:{width:te,height:ue},targetDimensions:{width:qe,height:Qe}});default:return new Ue({device:_,inputTexture:Se,nativeDimensions:{width:te,height:ue},targetDimensions:{width:qe,height:Qe}})}})(),ze=Ze.getOutputTexture(),_e=_.createSampler({magFilter:"linear",minFilter:"linear"}),et=_.createShaderModule({code:`
29
+ @group(0) @binding(0) var tex: texture_2d<f32>;
30
+ @group(0) @binding(1) var samp: sampler;
31
+ struct VertexOutput {
32
+ @builtin(position) pos: vec4f,
33
+ @location(0) uv: vec2f,
34
+ }
35
+ @vertex
36
+ fn vs(@builtin(vertex_index) idx: u32) -> VertexOutput {
37
+ var positions = array<vec2f, 6>(
38
+ vec2f(-1.0, -1.0), vec2f(1.0, -1.0), vec2f(-1.0, 1.0),
39
+ vec2f(-1.0, 1.0), vec2f(1.0, -1.0), vec2f(1.0, 1.0)
40
+ );
41
+ var uvs = array<vec2f, 6>(
42
+ vec2f(0.0, 1.0), vec2f(1.0, 1.0), vec2f(0.0, 0.0),
43
+ vec2f(0.0, 0.0), vec2f(1.0, 1.0), vec2f(1.0, 0.0)
44
+ );
45
+ var out: VertexOutput;
46
+ out.pos = vec4f(positions[idx], 0.0, 1.0);
47
+ out.uv = uvs[idx];
48
+ return out;
49
+ }
50
+ @fragment
51
+ fn fs(@location(0) uv: vec2f) -> @location(0) vec4f {
52
+ return textureSample(tex, samp, uv);
53
+ }
54
+ `}),St=_.createBindGroupLayout({entries:[{binding:0,visibility:GPUShaderStage.FRAGMENT,texture:{sampleType:"float"}},{binding:1,visibility:GPUShaderStage.FRAGMENT,sampler:{type:"filtering"}}]}),Ne=_.createRenderPipeline({layout:_.createPipelineLayout({bindGroupLayouts:[St]}),vertex:{module:et,entryPoint:"vs"},fragment:{module:et,entryPoint:"fs",targets:[{format:Je}]},primitive:{topology:"triangle-list"}}),xt=_.createBindGroup({layout:St,entries:[{binding:0,resource:ze.createView()},{binding:1,resource:_e}]});try{const I=_.createBindGroupLayout({entries:[{binding:0,visibility:GPUShaderStage.FRAGMENT,externalTexture:{}},{binding:1,visibility:GPUShaderStage.FRAGMENT,sampler:{type:"filtering"}}]}),re=_.createShaderModule({code:Ls}),$e=_.createRenderPipeline({layout:_.createPipelineLayout({bindGroupLayouts:[I]}),vertex:{module:re,entryPoint:"vs"},fragment:{module:re,entryPoint:"fs",targets:[{format:"rgba16float"}]},primitive:{topology:"triangle-list"}});ce.current={pipeline:$e,layout:I,inputView:Se.createView()}}catch{ce.current=null}if(N.current!==V){Se.destroy(),_.destroy();return}ae.current=_,Fe.current=De,W.current=Ze,A.current=Se,$.current=ze,Oe.current=Ne,He.current=_e,a.current=St,ee.current=!1,Re.current=!1;async function Rt(){const I=ce.current;if(!I||ee.current)return!1;const re=n.current;if(!re)return!1;const $e=!Re.current;$e&&_.pushErrorScope("validation");try{const ne=_.importExternalTexture({source:re}),me=_.createBindGroup({layout:I.layout,entries:[{binding:0,resource:ne},{binding:1,resource:_e}]}),Ee=_.createCommandEncoder(),Pe=Ee.beginRenderPass({colorAttachments:[{view:I.inputView,loadOp:"load",storeOp:"store"}]});Pe.setPipeline(I.pipeline),Pe.setBindGroup(0,me),Pe.draw(6),Pe.end(),_.queue.submit([Ee.finish()])}catch{return ee.current=!0,ce.current=null,!1}if($e){const ne=await _.popErrorScope().catch(()=>null);if(ne)return console.warn("[anime4k] blit probe failed:",ne.message),ee.current=!0,ce.current=null,!1;Re.current=!0}return!0}z(!1);async function mt(){if(G||N.current!==V)return;const I=n.current;if(!I||I.videoWidth===0){C();return}if(I!==K||I.videoWidth!==te||I.videoHeight!==ue){Ce(me=>me+1);return}if(I.paused||I.ended||document.hidden||I.readyState<HTMLMediaElement.HAVE_CURRENT_DATA){C();return}const re=I.getVideoPlaybackQuality().totalVideoFrames;if(re===o.current){C();return}if(T.current){C();return}const $e=I.currentTime;(I.seeking||d.current>=0&&Math.abs($e-d.current)>.5)&&(ye(),l.current=!1,f.current=0,o.current=-1),d.current=$e;const ne=Math.max(0,je.current||0);ne>f.current&&(l.current=!1),T.current=!0;try{const me=performance.now();let Ee=null,Pe=!1;if(ne<=0){be.current.length>0&&ye(),l.current=!1,f.current=0;let xe=!1;if(!Ye.current)try{_.queue.copyExternalImageToTexture({source:I},{texture:Se},[te,ue]),o.current=re,xe=!0}catch(y){if(y instanceof TypeError)Ye.current=!0;else throw y}if(!xe&&!ee.current&&ce.current&&await Rt()&&(o.current=re,xe=!0),!xe){const y=await createImageBitmap(I);o.current=re,_.queue.copyExternalImageToTexture({source:y},{texture:Se},[te,ue]),ie(y)}}else{const xe=await createImageBitmap(I);o.current=re;const y=be.current;y.push({bitmap:xe,capture:me});const Vt=at(ne);for(;y.length>Vt;)ie(y.shift()?.bitmap);let rt=-1;for(let he=y.length-1;he>=0;he--)if(me-y[he].capture>=ne){rt=he;break}if(rt!==-1){for(let At=0;At<rt;At++)ie(y.shift()?.bitmap);const he=y.shift();he?(Ee=he.bitmap,l.current=!0,f.current=ne):(Ee=xe,Pe=!0)}else if(!l.current)Ee=xe,Pe=!0;else{const he=y.shift();Ee=he?he.bitmap:xe,he||(Pe=!0)}if(!Ee){T.current=!1,C();return}_.queue.copyExternalImageToTexture({source:Ee},{texture:Se},[te,ue]),Pe||ie(Ee)}const ve=_.createCommandEncoder();await Ze.pass(ve);const tt=ve.beginRenderPass({colorAttachments:[{view:De.getCurrentTexture().createView(),clearValue:{r:0,g:0,b:0,a:1},loadOp:"clear",storeOp:"store"}]});tt.setPipeline(Ne),tt.setBindGroup(0,xt),tt.draw(6),tt.end(),_.queue.submit([ve.finish()]),pe.current=re,We.current=0,_.queue.onSubmittedWorkDone().then(()=>{N.current===V&&(T.current=!1)})}catch(me){if(T.current=!1,We.current+=1,We.current>=As&&!G&&N.current===V){console.error(me),e(me instanceof Error?me.message:"Render error"),L(!1);return}}C()}C()}catch(C){!G&&N.current===V&&(e(C instanceof Error?C.message:"Failed to initialize upscaler"),z(!1),L(!1))}}return bt(),()=>{G=!0,N.current+=1,Xe(),ye(),A.current&&(A.current.destroy(),A.current=null),$.current&&($.current.destroy(),$.current=null),ae.current&&(ae.current.destroy(),ae.current=null),W.current=null,Oe.current=null,He.current=null,a.current=null,ce.current=null,Fe.current=null,T.current=!1}},[E,b,n,g,k,h]);const D=O(G=>{L(G);try{localStorage.setItem("anime4kEnabled",String(G))}catch{}},[]),Y=O(()=>{L(G=>{const V=!G;try{localStorage.setItem("anime4kEnabled",String(V))}catch{}return V})},[]);return{isWebGPUSupported:b,isEnabled:E,isInitializing:B,error:Te,toggle:Y,setEnabled:D}}const Ds=()=>localStorage.getItem("preferredMode")==="dub"?"dub":"sub",$s=()=>{const n=localStorage.getItem("preferredProvider");return n&&/^[a-z0-9-]+$/i.test(n)?n:"megaplay"},gr=()=>({showMeta:{},episodes:[],watchedEpisodes:[],watchlistStatus:null,showCombinedDetails:!1,currentMode:Ds(),inWatchlist:!1,videoSources:[],selectedSource:null,selectedLink:null,forceNativePlayer:localStorage.getItem("forceNativePlayer")==="true",isAutoplayEnabled:cn(),showResumeModal:!0,resumeTime:0,resumeDuration:0,skipIntervals:[],selectedProvider:$s(),loadingShowData:!0,loadingVideo:!1,loadingDetails:!1,error:null,detailsError:null,showCookieModal:!1,cookieProvider:null});gr();function Fs(n,g){switch(g.type){case"SET_STATE":return{...n,...g.payload};case"SET_MODE":return{...n,currentMode:g.payload,videoSources:[],selectedSource:null,selectedLink:null};case"SET_PROVIDER":return{...n,selectedProvider:g.payload};case"SET_OVERRIDE_SOURCE":return{...n,selectedSource:g.payload?.source??null,selectedLink:g.payload?.link??null};default:return n}}async function mr(n,g,k,j,b=!1){if(!n||!g)throw new Error("Missing params");try{const[M,E,L,B]=await Promise.all([ke.data.video.query({showId:n,episodeNumber:g,mode:k.currentMode,provider:k.selectedProvider}).catch(()=>null),ke.progress.getEpisode.query({showId:n,episodeNumber:g}).catch(()=>null),ke.settings.getByKey.query({key:"preferredSource"}).catch(()=>null),ke.data.skipTimes.query({showId:n,episodeNumber:g}).catch(()=>[])]),z=L?.value,Te=M?.filter(A=>{const $=A.sourceName.toLowerCase();return k.currentMode==="dub"?$.includes("eng")||$.includes("dub"):$.includes("jpn")||$.includes("sub")||!$.includes("eng")&&!$.includes("dub")})??[],e=Te.length>0?Te:M??[];let h=e.length>0?e[0]:null;if(z){const A=e.find($=>$.sourceName===z);A&&(h=A)}const Ce=h&&h.links.length>0?h.links.sort((A,$)=>(parseInt($.resolutionStr)||0)-(parseInt(A.resolutionStr)||0))[0]:null,N=E?.currentTime||0,ae=E?.duration||0,W=(Array.isArray(B)?B:B?.results||[]).map(A=>({skip_id:A.skip_id||"",skip_type:A.skip_type||"",start_time:A.interval?.start_time??A.start_time??0,end_time:A.interval?.end_time??A.end_time??0})).filter(A=>A.end_time>0);return(!M||M.length===0)&&(b||Ke.error(`No video sources found for ${k.selectedProvider}`)),{videoSources:M,selectedSource:h,selectedLink:Ce,resumeTime:N,resumeDuration:ae,showResumeModal:N>5&&h?.type!=="iframe",skipIntervals:W,fetchedEpisodeNumber:g}}catch(M){const E=M;if(E.message==="AUTH_REQUIRED")return j({type:"SET_STATE",payload:{showCookieModal:!0,cookieProvider:E.provider}}),{videoSources:[],selectedSource:null,selectedLink:null,resumeTime:0,resumeDuration:0,showResumeModal:!1,skipIntervals:[],fetchedEpisodeNumber:g};throw M}}const Os=(n,g,k,j)=>{const[b,M]=Vr(Fs,k,d=>({...gr(),showMeta:d?.name?{name:d.name,thumbnail:d.thumbnail,nativeName:d.nativeName,englishName:d.englishName,names:{romaji:d.name||d.englishName,english:d.englishName||d.name,native:d.nativeName}}:{}})),E=fr(),L=Gr(),B=v(null),z=v(null),{options:Te}=vr(),e=ut(()=>Te.filter(d=>(d.kind??"anime")==="anime"),[Te]),h=g||b.initialEpisode,Ce=v(h);x(()=>{Ce.current!==h&&(Ce.current=h,M({type:"SET_STATE",payload:{selectedSource:null,selectedLink:null}}))},[h,M]),x(()=>{n&&/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(n)&&b.selectedProvider!=="animepahe"&&B.current!==n&&(B.current=n,M({type:"SET_PROVIDER",payload:"animepahe"}))},[n,b.selectedProvider]);const{data:N,isLoading:ae,error:Fe}=_n(n),{data:W}=ur({queryKey:["player-data",n,b.currentMode,b.selectedProvider],queryFn:async()=>{if(!n)throw new Error("No showId");const d=async()=>{try{const Y=await ke.data.episodes.query({showId:n,mode:b.currentMode,provider:b.selectedProvider}).catch(()=>null);if(Y?.episodes?.length)return Y}catch{}return null},[o,l,f]=await Promise.all([d(),ke.watchlist.check.query({showId:n}).catch(()=>({inWatchlist:!1,status:null})),ke.progress.getWatchedEpisodes.query({showId:n}).catch(()=>[])]),D=o?.episodes?o.episodes.sort((Y,G)=>parseFloat(Y)-parseFloat(G)):[];return{description:o?.description||"",episodes:D,inWatchlist:l.inWatchlist,watchlistStatus:l.status??null,watchedEpisodes:f}},enabled:!!n});x(()=>{!g&&W?.episodes&&W.episodes.length>0&&!g&&M({type:"SET_STATE",payload:{initialEpisode:W.episodes[0]}})},[W,g]),x(()=>{if(N?.isAdult===void 0)return;const o=new Set(e.filter(l=>l.mature).map(l=>l.value)).has(b.selectedProvider);if(z.current!==n){if(N.isAdult&&!o){const l=e.find(f=>f.mature);if(!l)return;z.current=n,M({type:"SET_PROVIDER",payload:l.value}),localStorage.setItem("preferredProvider",l.value)}if(!N.isAdult&&o){const l=e.find(f=>!f.mature);if(!l)return;z.current=n,M({type:"SET_PROVIDER",payload:l.value}),localStorage.setItem("preferredProvider",l.value)}}},[N?.isAdult,b.selectedProvider,n,e]),x(()=>{if(!n||!/^dango-mt-\d+$/.test(n)||z.current===`temp:${n}`)return;const d=N?.provider;d&&(z.current=`temp:${n}`,d!==b.selectedProvider&&M({type:"SET_PROVIDER",payload:d}))},[n,N,b.selectedProvider]);const{data:A,isLoading:$,error:Oe}=ur({queryKey:["video-sources",n,h,b.selectedProvider,b.currentMode],queryFn:()=>mr(n,h,b,M),enabled:!!n&&!!h&&!(b.showMeta?.isAdult===!0&&!j?.hasMatureConsent)}),He=!1,{mutateAsync:a}=jt({mutationFn:async({wasIn:d,showMeta:o})=>{if(!n)throw new Error("Missing showId");if(d)await ke.watchlist.remove.mutate({id:n});else{const l=o.name||o.names?.romaji;if(!l)throw new Error("Missing show name");await ke.watchlist.add.mutate({id:n,name:l,thumbnail:o.thumbnail,nativeName:o.names?.native,englishName:o.names?.english,type:o.type,isAdult:o.isAdult})}return!d},onSuccess:d=>{Ke.success(d?"Added to watchlist":"Removed from watchlist"),E.invalidateQueries({queryKey:["player-data",n]}),E.invalidateQueries({queryKey:["show-data",n]}),E.invalidateQueries({queryKey:["watchlist"]})},onError:d=>Ke.error(d instanceof Error?d.message:"Failed to update watchlist")}),p=O(async()=>{!n||!N||await a({wasIn:!!W?.inWatchlist,showMeta:N})},[n,N,W?.inWatchlist,a]),T=O(async d=>{try{await ke.settings.set.mutate({key:"preferredSource",value:d})}catch(o){console.error(o)}},[]),{mutateAsync:pe,isPending:We}=jt({mutationFn:async({status:d})=>{if(!n)throw new Error("Missing showId");return await ke.watchlist.setStatus.mutate({id:n,status:d}),d},onSuccess:d=>{M({type:"SET_STATE",payload:{inWatchlist:!0,watchlistStatus:d}}),Ke.success(`Moved to ${d}`),E.invalidateQueries({queryKey:["show-data",n]}),E.invalidateQueries({queryKey:["watchlist"]}),E.invalidateQueries({queryKey:["allContinueWatching"]})},onError:()=>Ke.error("Failed to update watchlist status")}),je=O(async()=>{await pe({status:"Completed"})},[pe]),{mutateAsync:be}=jt({mutationFn:async({episodeNumber:d,duration:o,showMeta:l,episodes:f})=>{await ke.progress.updateProgress.mutate({showId:n,episodeNumber:d,currentTime:o,duration:o,showName:l.name,showThumbnail:l.thumbnail,nativeName:l.names?.native,englishName:l.names?.english,genres:l.genres?.map(D=>D.name),popularityScore:Kr(l.score??l.stats?.averageScore),type:l.type,status:l.status,episodeCount:f.length,isAdult:l.isAdult})},onSuccess:(d,o)=>{Ke.success(`Episode ${o.episodeNumber} marked as watched`),E.invalidateQueries({queryKey:["player-data",n]}),E.invalidateQueries({queryKey:["show-meta",n]}),E.invalidateQueries({queryKey:["video-sources",n,o.episodeNumber]}),E.invalidateQueries({queryKey:["allContinueWatching"]}),E.invalidateQueries({queryKey:["thisWeekSchedule"]}),E.invalidateQueries(L.continueWatching.pathFilter())},onError:()=>Ke.error("Failed to mark episode as watched")}),Ye=O(async(d,o)=>{!n||!N||await be({episodeNumber:d,duration:o,showMeta:N,episodes:W?.episodes||[]})},[n,N,W?.episodes,be]),ee=O(async()=>{M({type:"SET_STATE",payload:{showCombinedDetails:!b.showCombinedDetails}})},[b.showCombinedDetails]),Re=ut(()=>{const d=Fe||Oe,o=d?d.message:null,l=o==="AUTH_REQUIRED"?null:o,f=A&&A.fetchedEpisodeNumber===h?A:null,D=!!A&&!f;return{...b,currentEpisode:h,showMeta:{...b.showMeta||{},...N||{}},episodes:W?.episodes||[],watchedEpisodes:W?.watchedEpisodes||[],inWatchlist:!!W?.inWatchlist,watchlistStatus:W?.watchlistStatus??b.watchlistStatus??null,videoSources:f?.videoSources||[],selectedSource:b.selectedSource||f?.selectedSource||null,selectedLink:b.selectedLink||f?.selectedLink||null,resumeTime:f?.resumeTime||0,resumeDuration:f?.resumeDuration||0,showResumeModal:b.showResumeModal&&(f?.showResumeModal??!1),skipIntervals:f?.skipIntervals||[],loadingShowData:ae,loadingVideo:$||D,loadingDetails:He,error:l,fetchedEpisodeNumber:f?.fetchedEpisodeNumber}},[b,N,W,A,ae,$,He,Fe,Oe,h]),ce=O((d,o)=>{const l=o||n;if(!l||!d||l===n&&d===h)return;const D=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(l)&&b.selectedProvider!=="animepahe"?"animepahe":b.selectedProvider,Y=["video-sources",l,d,D,b.currentMode];E.getQueryState(Y)?.status!=="success"&&E.prefetchQuery({queryKey:Y,queryFn:()=>mr(l,d,{selectedProvider:D,currentMode:b.currentMode},M,!0),staleTime:300*1e3,gcTime:1800*1e3})},[n,h,E,b,M]);return{state:Re,dispatch:M,toggleWatchlist:p,moveToCompleted:je,setPreferredSource:T,handleToggleDetails:ee,markEpisodeWatched:Ye,prefetchEpisodeSources:ce,isMarkingWatched:be.isPending,isUpdatingWatchlistStatus:We}},Xt="fallbackChoice";function Ws(){try{const n=localStorage.getItem(Xt);return n==="iframe"||n==="retry"?n:null}catch{return null}}function Vs(n){try{n===null?localStorage.removeItem(Xt):localStorage.setItem(Xt,n)}catch{}}const oo=()=>{const{id:n,episodeNumber:g}=Ur(),k=qr(),j=fr(),b=Qr(),{hasConsent:M,grant:E}=Hr(),{options:L}=vr(),B=ut(()=>L.filter(t=>(t.kind??"anime")==="anime"),[L]),z=ut(()=>B.map(t=>t.value),[B]),Te=ut(()=>new Set(B.filter(t=>t.mature).map(t=>t.value)),[B]),{state:e,dispatch:h,toggleWatchlist:Ce,moveToCompleted:N,setPreferredSource:ae,handleToggleDetails:Fe,markEpisodeWatched:W,prefetchEpisodeSources:A,isMarkingWatched:$,isUpdatingWatchlistStatus:Oe}=Os(n,g,b.state||null,{hasMatureConsent:M});x(()=>{if(n&&e.showMeta?.id&&e.showMeta.id!==n){const t=g?`/watch/${e.showMeta.id}/${g}${window.location.search}`:`/watch/${e.showMeta.id}${window.location.search}`;k(t,{replace:!0})}},[n,e.showMeta?.id,g,k]);const He=ut(()=>{if(e.showMeta.name)return{name:e.showMeta.name,thumbnail:e.showMeta.thumbnail,names:e.showMeta.names,genres:e.showMeta.genres,score:e.showMeta.score,isAdult:e.showMeta.isAdult}},[e.showMeta.name,e.showMeta.thumbnail,e.showMeta.names,e.showMeta.genres,e.showMeta.score,e.showMeta.isAdult]),a=un({skipIntervals:e.skipIntervals,showId:n,episodeNumber:e.currentEpisode?.toString(),episodeCount:e.episodes.length||void 0,sourceType:e.selectedSource?.type,showMeta:He}),{refs:p,actions:T}=a,pe=v(null),We=Rn(),je=v(null),be=v(null),Ye=v(null),ee=v(0),Re=v(e.resumeTime),ce=v(e.showResumeModal),[d,o]=Q(()=>{try{const t=localStorage.getItem("anime4kProfile");return["low","balanced","high","denoise"].includes(t)?t:"balanced"}catch{return"balanced"}}),[l,f]=Q(()=>{try{const t=Number(localStorage.getItem("playerVideoDelayMs"));if(Number.isFinite(t)&&t>=0&&t<=500)return Math.round(t)}catch{}return 180}),[D,Y]=Q(()=>{try{return localStorage.getItem("playerVideoDelayEnabled")==="true"}catch{return!1}}),[G,V]=Q(!1),[ie,ye]=Q(!1),at=v(null),Xe=v(null),bt=(t,s)=>{try{localStorage.setItem("playerVideoDelayMs",String(t)),localStorage.setItem("playerVideoDelayEnabled",String(s))}catch{}},K=t=>{const s=Math.max(0,Math.min(500,Math.round(t)));f(s);try{localStorage.setItem("playerVideoDelayMs",String(s))}catch{}},it=()=>{at.current={enabled:D,ms:l},Y(!0);try{localStorage.setItem("playerVideoDelayEnabled","true")}catch{}T.setShowSettings(!1),V(!0)},dt=()=>{const t=at.current;at.current=null,t&&(f(t.ms),Y(t.enabled),bt(t.ms,t.enabled)),ye(!1),V(!1)},te=()=>{at.current=null,Y(!0),bt(l,!0),ye(!1),V(!1)},ue=()=>{if(ie){ye(!1);return}const t=p.videoRef.current;t&&!isNaN(t.currentTime)&&(Xe.current=t.currentTime),ye(!0)},Me=D?l:0,yt=v(null),F=Is({videoRef:p.videoRef,canvasRef:be,profile:d,delayMs:Me}),Ve=F.isEnabled&&F.isWebGPUSupported,pt=`${n??""}:${e.currentEpisode??""}`,lt=v(null),m=v(!1),P=v(!1),C=v(F.setEnabled);C.current=F.setEnabled,x(()=>{const t=lt.current;lt.current=pt,!(t===null||t===pt)&&(!F.isEnabled||!F.isWebGPUSupported||(m.current=!0,P.current=!1,C.current(!1)))},[pt,F.isEnabled,F.isWebGPUSupported]),x(()=>{if(!m.current)return;if(F.isEnabled){P.current&&(m.current=!1);return}if(P.current=!0,e.loadingVideo||!e.selectedLink)return;if(e.selectedSource?.type==="iframe"){m.current=!1,C.current(!0);return}const t=p.videoRef.current;if(!t)return;let s,i=!1;const c=()=>{i||(i=!0,m.current=!1,C.current(!0))};if(t.readyState>=2)return s=window.setTimeout(c,500),()=>window.clearTimeout(s);const R=()=>{window.setTimeout(c,500)};return t.addEventListener("canplay",R,{once:!0}),t.addEventListener("playing",R,{once:!0}),s=window.setTimeout(c,5e3),()=>{window.clearTimeout(s),t.removeEventListener("canplay",R),t.removeEventListener("playing",R)}},[F.isEnabled,e.loadingVideo,e.selectedLink,e.selectedSource?.type,p.videoRef]),dn({videoRef:p.videoRef,canvasRef:yt,delayMs:Me,enabled:D&&!Ve});const Ue=D&&!Ve,Ie=Ve||Ue;x(()=>{Re.current=e.resumeTime,ce.current=e.showResumeModal},[e.resumeTime,e.showResumeModal]);const[Tt,Jt]=Q(null),[Pt,_]=Q(!1),[De,Je]=Q(!1),[Se,Ct]=Q(!1),qe=v(!1),[Qe,Ze]=Q(null),ze=v(!1),_e=v([]),et=v(!1),[St,Ne]=Q(null),[xt,Rt]=Q(!1),[mt,I]=Q(!1),[re,$e]=Q(()=>Ws()??"ask"),ne=O(t=>{$e(t),Vs(t==="ask"?null:t)},[]),me=v(re);me.current=re;const Ee=v(e.videoSources);Ee.current=e.videoSources;const Pe=v(()=>{}),[ve,tt]=Q(null),xe=v(g);x(()=>{xe.current!==g&&(xe.current=g,tt(null),Ze(null),qe.current=!1,ye(!1),V(!1))},[g]),x(()=>{ze.current=!1,_e.current=[],et.current=!1,Ne(null),Rt(!1)},[n,e.currentEpisode]),x(()=>{De||(qe.current=!1)},[De]);const{data:y=[],isLoading:Vt}=jr(),rt=Yr(),he=v(rt);he.current=rt;const At=Xr(),br=Jr(),[ge,Ut]=Q(()=>{try{return localStorage.getItem("playerTheaterMode")==="true"}catch{return!1}});x(()=>{try{ge?document.body.classList.add("theater-mode"):document.body.classList.remove("theater-mode")}catch(t){console.error(t)}return()=>{try{document.body.classList.remove("theater-mode")}catch(t){console.error(t)}}},[ge]),zr(()=>{if(a.state.isFullscreen||ge)return;const t=p.playerContainerRef.current,s=je.current;if(!t||!s)return;const i=()=>{const R=t.getBoundingClientRect().height;s.style.height=`${R}px`};i();const c=new ResizeObserver(i);return c.observe(t),()=>c.disconnect()},[a.state.isFullscreen,ge,p.playerContainerRef]);const ht=ut(()=>e.episodes.findIndex(t=>t===e.currentEpisode),[e.episodes,e.currentEpisode]),qt=ht>0?e.episodes[ht-1]:null,Ae=ht>=0&&ht<e.episodes.length-1?e.episodes[ht+1]:null,Qt=ht>-1&&ht<e.episodes.length-1,yr=e.episodes.length>0&&!!e.currentEpisode&&e.episodes[e.episodes.length-1]===e.currentEpisode,Sr=String(e.showMeta.status||"").trim().toLowerCase(),Er=["finished","completed","complete","ended"].some(t=>Sr.includes(t)),zt=pn(e.resumeTime,e.resumeDuration)||De,ct=yr&&Er&&zt,Zt=e.showResumeModal&&(ct||!zt),Bt=zt&&!ct&&y.length===0&&!ve&&(e.showResumeModal||De),ft=Zt||Bt;mn(a,!!e.selectedLink&&!ge&&!ft),x(()=>{const t=p.videoRef.current;if(!t)return;let s=!1;for(pe.current&&(pe.current.destroy(),pe.current=null),(e.loadingVideo||e.selectedSource)&&(t.pause(),t.removeAttribute("src"),t.load());t.firstChild;)t.removeChild(t.firstChild);if(ie)return t.src="/av-sync-test.mp4",t.play().catch(()=>{T.setShowControls(!0)}),()=>{s=!0};if(!e.selectedSource||!e.selectedLink)return;if(e.selectedSource.type==="iframe"){ee.current=0;return}Xe.current!=null?(ee.current=Xe.current,Xe.current=null):Re.current>5&&!ce.current?ee.current=Re.current:ce.current&&(ee.current=0);let i=e.selectedLink.link;if(i.startsWith("/api/proxy")||(i=`/api/proxy?url=${encodeURIComponent(i)}`,e.selectedLink.headers?.Referer&&(i+=`&referer=${encodeURIComponent(e.selectedLink.headers.Referer)}`)),e.selectedSource.subtitles){const de=localStorage.getItem("playerSubtitlesEnabled")!=="false";let we=null;try{we=localStorage.getItem("playerLastSubtitle")}catch{}const X=Yt(e.selectedSource.subtitles,{lastKey:we,enabled:de}),Be=X>=0?e.selectedSource.subtitles[X]:null;e.selectedSource.subtitles.forEach(fe=>{const J=document.createElement("track");J.kind="subtitles",J.label=fe.label,J.srclang=fe.lang;const S=fe.src??fe.url;if(S){let Z=`/api/subtitle-proxy?url=${encodeURIComponent(S)}`;const oe=e.selectedLink?.headers?.Referer,Et=S.includes("anilight.live")?"https://anilight.live/":"",Ot=oe||Et;Ot&&(Z+=`&referer=${encodeURIComponent(Ot)}`),J.src=Z}Be&&fe.label===Be.label&&fe.lang===Be.lang&&(J.default=!0),t.appendChild(J)}),de||T.setActiveSubtitleTrack("off"),T.setAvailableSubtitles(e.selectedSource.subtitles)}const c=ee.current;ee.current=0;const R=()=>{c>0&&(t.currentTime=c)};t.addEventListener("loadedmetadata",R,{once:!0});const le=!(ce.current&&Re.current>5),H=()=>{le&&t.play().catch(()=>{T.setShowControls(!0)})};e.selectedLink.hls?(async()=>{const de=await Cn();if(s)return;if(!de||!de.isSupported()){t.src=i,H();return}const we=document.body.classList.contains("low-end"),X=new de({maxBufferLength:we?15:30,maxMaxBufferLength:we?30:60,maxBufferSize:we?25*1e3*1e3:60*1e3*1e3,startLevel:-1,enableWorker:!0});pe.current=X,X.on(de.Events.ERROR,(J,S)=>{S.fatal&&!ze.current&&Pe.current()});const Be=(e.selectedSource?.subtitles?.length??0)>0,fe=()=>{try{Be&&typeof X.subtitleTrack=="number"&&X.subtitleTrack!==-1&&(X.subtitleTrack=-1)}catch{}};X.on(de.Events.SUBTITLE_TRACK_SWITCH,(J,S)=>{S?.id!==-1&&fe()}),fe(),X.loadSource(i),X.attachMedia(t),X.once(de.Events.MANIFEST_PARSED,()=>{s||H()})})():(t.src=i,H());const U=localStorage.getItem("playerVolume"),se=localStorage.getItem("playerMuted");return U!==null&&(t.volume=parseFloat(U)),se!==null&&(t.muted=se==="true"),()=>{s=!0,t.removeEventListener("loadedmetadata",R),pe.current&&(pe.current.destroy(),pe.current=null)}},[e.selectedSource,e.selectedLink,p.videoRef,T,e.loadingVideo,ie]);const Lt=O(t=>{if(ze.current)return;ze.current=!0;const s=t.links[0];ae(t.sourceName),h({type:"SET_STATE",payload:{selectedSource:t,selectedLink:s}}),Ne(null)},[h,ae]),It=O(()=>{const s=Ee.current.find(i=>i.type==="iframe");return s?.links?.length?s:null},[]),Dt=O(async()=>{const t=e.showMeta?.isAdult,s=z.filter(i=>{if(_e.current.includes(i))return!1;const c=Te.has(i);return t===void 0?!0:c===t});Rt(!0);try{for(const i of s){_e.current.push(i);let c=null;try{c=await ke.data.video.query({showId:n,episodeNumber:e.currentEpisode,mode:e.currentMode,provider:i})}catch{continue}const R=(c??[]).filter(U=>{const se=U.sourceName.toLowerCase();return e.currentMode==="dub"?se.includes("eng")||se.includes("dub"):se.includes("jpn")||se.includes("sub")||!se.includes("eng")&&!se.includes("dub")});if((R.length>0?R:c??[]).find(U=>U.type!=="iframe"&&U.links?.length)){_e.current=[e.selectedProvider],et.current=!1,h({type:"SET_STATE",payload:{selectedProvider:i,videoSources:[],selectedSource:null,selectedLink:null,loadingVideo:!0}}),localStorage.setItem("preferredProvider",i),Ne(null),Ke.success(`Switched to ${i} (direct stream)`);return}}Ne({retryFailed:!0}),Ke.error("No working direct stream found on other providers")}finally{Rt(!1)}},[n,e.currentEpisode,e.currentMode,e.showMeta?.isAdult,e.selectedProvider,h,z,Te]),er=O(()=>{if(ze.current||et.current||e.selectedSource?.type!=="player")return;const t=It();if(!t)return;_e.current.includes(e.selectedProvider)||_e.current.push(e.selectedProvider);const s=me.current;if(s==="iframe"){Lt(t);return}if(s==="retry"){Dt();return}T.setShowControls(!0),Ne({retryFailed:!1})},[e.selectedSource,e.selectedProvider,It,Lt,Dt,T]);Pe.current=er;const wr=O(()=>{et.current=!0,Ne(null),I(!1)},[]),kr=O(()=>{mt&&ne("iframe");const t=It();t?Lt(t):Ne(null)},[mt,ne,It,Lt]),Tr=O(()=>{mt&&ne("retry"),Dt()},[mt,ne,Dt]),Mt=(t,s,i)=>t.showId===s||!!i&&t.showId===i,$t=O(()=>{T.onEnded();const t=y.find(i=>Mt(i,n,e.showMeta?.id)&&i.episodeNumber===e.currentEpisode);if(y.length>0){const i=y.findIndex(R=>Mt(R,n,e.showMeta?.id)&&R.episodeNumber===e.currentEpisode),c=i>=0?y[i+1]||null:y[0];tt({nextItem:c,playedItem:t||null}),Ze(2)}else t&&he.current.mutate({showId:t.showId,episodeNumber:t.episodeNumber});let s=!1;if(e.isAutoplayEnabled&&y.length===0){const i=e.episodes.findIndex(c=>c===e.currentEpisode);if(i>-1&&i<e.episodes.length-1){const c=e.episodes[i+1];j.invalidateQueries({queryKey:["allContinueWatching"]}),k(`/watch/${n}/${c}`),s=!0}}if(!s&&y.length===0&&!ve&&!qe.current){const i=e.episodes.length>0&&!!e.currentEpisode&&e.episodes[e.episodes.length-1]===e.currentEpisode,c=String(e.showMeta.status||"").trim().toLowerCase(),R=["finished","completed","complete","ended"].some(le=>c.includes(le));i&&R&&h({type:"SET_STATE",payload:{showResumeModal:!0}})}},[T,k,y,n,e.showMeta?.id,e.showMeta?.status,e.currentEpisode,e.episodes,e.isAutoplayEnabled,ve,h,j]),Gt=O(()=>{if(y.length===0)return;T.onEnded();const t=y.find(c=>Mt(c,n,e.showMeta?.id)&&c.episodeNumber===e.currentEpisode),s=y.findIndex(c=>Mt(c,n,e.showMeta?.id)&&c.episodeNumber===e.currentEpisode),i=s>=0?y[s+1]||null:y[0];t&&rt.mutate({showId:t.showId,episodeNumber:t.episodeNumber}),i?k(`/watch/${i.showId}/${i.episodeNumber}`):t&&h({type:"SET_STATE",payload:{showResumeModal:!0}})},[T,k,y,rt,n,e.showMeta?.id,e.currentEpisode,h]),_t=O(()=>{Ae&&(j.invalidateQueries({queryKey:["allContinueWatching"]}),Je(!1),k(`/watch/${n}/${Ae}`)),h({type:"SET_STATE",payload:{showResumeModal:!1}})},[Ae,k,n,h,j]),tr=O(()=>{y.length>0?Gt():Ae?_t():Ke.error("No next episode available")},[y.length,Gt,_t,Ae]),Cr=()=>{qt&&k(`/watch/${n}/${qt}`)};x(()=>{const t=p.videoRef.current;if(!t)return;const s=()=>{ie||$t()};return t.addEventListener("ended",s),()=>{t&&t.removeEventListener("ended",s)}},[$t,p.videoRef,ie]),x(()=>{const t=s=>{s.origin===window.location.origin&&e.selectedSource?.type==="iframe"&&s.data?.type==="ANI_WEB_MEDIA_ENDED"&&$t()};return window.addEventListener("message",t),()=>window.removeEventListener("message",t)},[$t,e.selectedSource?.type]),x(()=>{if(!ve||Qe===null)return;if(Qe<=0){const{nextItem:s,playedItem:i}=ve;tt(null),Ze(null),i&&he.current.mutate({showId:i.showId,episodeNumber:i.episodeNumber}),s?k(`/watch/${s.showId}/${s.episodeNumber}`):i&&h({type:"SET_STATE",payload:{showResumeModal:!0}});return}const t=window.setTimeout(()=>{Ze(s=>s===null?null:s-1)},1e3);return()=>window.clearTimeout(t)},[ve,Qe,k,h]),x(()=>{ft&&a.state.isFullscreen&&a.actions.toggleFullscreen()},[ft,a.state.isFullscreen,a.actions]),x(()=>{ft&&p.videoRef.current&&p.videoRef.current.pause()},[ft,p.videoRef]);const{titlePreference:Ft}=Zr(),{lowEndMode:Rr}=en(),vt=ut(()=>{if(!e.showMeta||e.loadingShowData)return"Loading...";const{name:t,names:s}=e.showMeta;return Ft==="name"?t||"Loading...":Ft==="nativeName"?s?.native||t||"Loading...":Ft==="englishName"?s?.english||t||"Loading...":t||"Loading..."},[e.showMeta,Ft,e.loadingShowData]);x(()=>{vt&&vt!=="Loading..."&&e.currentEpisode&&(document.title=`► ${vt} Episode ${e.currentEpisode} - dango`)},[vt,e.currentEpisode]),x(()=>{const t=s=>{if(!s.target.closest('input, textarea, button, select, a, [role="button"], [contenteditable="true"]')&&(["arrowup","arrowdown","arrowleft","arrowright"].includes(s.key.toLowerCase())&&(T.setShowControls(!0),a.actions.inactivityTimer.current&&clearTimeout(a.actions.inactivityTimer.current),a.actions.inactivityTimer.current=window.setTimeout(()=>{T.setShowControls(!1)},1e3)),s.key.toLowerCase()==="n"&&tr(),s.key.toLowerCase()==="t")){const c=!ge;Ut(c),localStorage.setItem("playerTheaterMode",c.toString())}};return document.addEventListener("keydown",t),()=>{document.removeEventListener("keydown",t)}},[T,a.actions.inactivityTimer,tr,ge]);const{setAvailableSubtitles:rr,setActiveSubtitleTrack:Kt}=T;x(()=>{const t=p.videoRef.current;if(!t)return;const s=()=>{const i=Array.from(t.textTracks).map(c=>({label:c.label,lang:c.language,src:void 0,mode:c.mode}));rr(i)};return t.textTracks.addEventListener("addtrack",s),t.textTracks.addEventListener("removetrack",s),s(),()=>{t&&(t.textTracks.removeEventListener("addtrack",s),t.textTracks.removeEventListener("removetrack",s))}},[p.videoRef,rr]),x(()=>{if(a.state.activeSubtitleTrack===null&&a.state.availableSubtitles.length>0&&localStorage.getItem("playerSubtitlesEnabled")!=="false"){let t=null;try{t=localStorage.getItem("playerLastSubtitle")}catch{}const s=Yt(a.state.availableSubtitles,{lastKey:t,enabled:!0});if(s<0){Kt("off");return}const i=a.state.availableSubtitles[s];Kt(i.lang||i.label)}},[a.state.activeSubtitleTrack,a.state.availableSubtitles,Kt]),x(()=>{const t=p.videoRef.current;if(!t||a.state.availableSubtitles.length===0)return;const s=a.state.activeSubtitleTrack;if(!(localStorage.getItem("playerSubtitlesEnabled")!=="false")||s==="off"||s===null){Array.from(t.textTracks).forEach(R=>{R.mode="hidden"});return}let c=!1;if(Array.from(t.textTracks).forEach(R=>{const H=(R.language===s||R.label===s)&&!c;R.mode=H?"showing":"hidden",H&&(c=!0)}),!c&&t.textTracks.length>0){const R=Array.from(t.textTracks).find(le=>le.language==="en"||le.label==="English")||t.textTracks[0];R&&(R.mode="showing")}},[a.state.activeSubtitleTrack,a.state.availableSubtitles,p.videoRef]);const[nr,Mr]=Q(0);x(()=>{const t=p.videoRef.current;if(!t)return;const s=()=>Mr(t.clientHeight||0);s();const i=new ResizeObserver(s);return i.observe(t),()=>i.disconnect()},[p.videoRef,e.selectedSource,e.selectedLink]),x(()=>{const t="dynamic-subtitle-styles";let s=document.getElementById(t);s||(s=document.createElement("style"),s.id=t,document.head.appendChild(s));const i={fontSize:a.state.subtitleFontSize,position:a.state.subtitlePosition,bgOpacity:a.state.subtitleBgOpacity,bgColor:a.state.subtitleBgColor,textColor:a.state.subtitleTextColor,edge:a.state.subtitleEdge,bold:a.state.subtitleBold};s.textContent=dr(i);const c=p.videoRef.current;if(!c)return;const R=pr(a.state.subtitleFontSize,nr||c.clientHeight||720);s.textContent=dr({...i,fontSize:R});const le=()=>{const S=Number(a.state.subtitlePosition),Z=isNaN(S)?0:Math.max(0,Math.min(100,S));return Math.max(0,Math.min(100,100-Z))},H=(S,Z)=>{try{const oe=S;oe.snapToLines=!1,oe.line=Z}catch{}},U=()=>{const S=R*16,Z=c.videoHeight||c.clientHeight||720,oe=c.videoWidth||c.clientWidth||1280;return{step:S*1.3/Z*100,chars:Math.max(20,Math.floor(oe/(S*.55)))}},se=S=>{const Z=le(),oe=Array.from(S.activeCues??[]);if(oe.length<=1){oe.forEach(wt=>H(wt,Z));return}const{step:Et,chars:Ot}=U();let lr=Z;for(let wt=oe.length-1;wt>=0;wt--){const Dr=String(oe[wt].text??"").replace(/<[^>]*>/g,"").split(`
55
+ `).reduce(($r,Fr)=>$r+Math.max(1,Math.ceil(Fr.length/Ot)),0),cr=lr-Dr*Et;H(oe[wt],Math.max(0,cr)),lr=cr-Et*.4}},de=S=>{if(!S.cues)return;const Z=le();Array.from(S.cues).forEach(oe=>H(oe,Z)),S.mode==="showing"&&se(S)},we=()=>{Array.from(c.textTracks).forEach(de)};we();const X=S=>{const Z=S.target;Z.mode==="showing"&&se(Z)};Array.from(c.textTracks).forEach(S=>{S.addEventListener("cuechange",X)});const Be=()=>{Array.from(c.textTracks).forEach(S=>{S.removeEventListener("cuechange",X),S.addEventListener("cuechange",X)}),we()};c.textTracks.addEventListener("addtrack",Be),c.textTracks.addEventListener("removetrack",Be);const fe=Array.from(c.querySelectorAll("track")),J=()=>{we()};return fe.forEach(S=>{S.addEventListener("load",J)}),()=>{Array.from(c.textTracks).forEach(S=>{S.removeEventListener("cuechange",X)}),c.textTracks.removeEventListener("addtrack",Be),c.textTracks.removeEventListener("removetrack",Be),fe.forEach(S=>{S.removeEventListener("load",J)})}},[a.state.subtitleFontSize,a.state.subtitlePosition,a.state.subtitleBgOpacity,a.state.subtitleBgColor,a.state.subtitleTextColor,a.state.subtitleEdge,a.state.subtitleBold,a.state.activeSubtitleTrack,a.state.availableSubtitles,e.selectedSource,e.selectedLink,p.videoRef,nr]),x(()=>{if(!Ie)return;const t=p.videoRef.current,s=Ye.current;if(!t||!s)return;const i=localStorage.getItem("playerSubtitlesEnabled")!=="false",c=a.state.activeSubtitleTrack;function R(){if(s.innerHTML="",!i||c==="off"||c===null)return;const U=Array.from(t.textTracks).find(J=>J.language===c||J.label===c);if(!U||U.mode!=="showing")return;const se=Me/1e3;let de;if(se>0&&U.cues){const J=t.currentTime-se;de=Array.from(U.cues).filter(S=>S.startTime<=J&&J<=S.endTime)}else de=Array.from(U.activeCues??[]);if(de.length===0)return;const we={fontSize:pr(a.state.subtitleFontSize,t.clientHeight||0),position:a.state.subtitlePosition,bgOpacity:a.state.subtitleBgOpacity,bgColor:a.state.subtitleBgColor,textColor:a.state.subtitleTextColor,edge:a.state.subtitleEdge,bold:a.state.subtitleBold},X=hn(we),Be=fn(t,we.position),fe=Array.from(de);fe.forEach((J,S)=>{const Z=String(J.text??"");if(!vn(Z).trim())return;const oe=document.createElement("div"),Et=(fe.length-1-S)*1.7;oe.style.cssText=`${X}
56
+ bottom: calc(${Be}px + ${Et}em);`,oe.innerHTML=gn(Z),s.appendChild(oe)})}const le=()=>R(),H=()=>R();return Array.from(t.textTracks).forEach(U=>{U.addEventListener("cuechange",le)}),t.addEventListener("timeupdate",H),R(),()=>{Array.from(t.textTracks).forEach(U=>{U.removeEventListener("cuechange",le)}),t.removeEventListener("timeupdate",H),s.innerHTML=""}},[F.isEnabled,F.isWebGPUSupported,a.state.subtitleFontSize,a.state.subtitlePosition,a.state.subtitleBgOpacity,a.state.subtitleBgColor,a.state.subtitleTextColor,a.state.subtitleEdge,a.state.subtitleBold,a.state.activeSubtitleTrack,p.videoRef,Ie,Me]),x(()=>{try{localStorage.setItem("anime4kProfile",d)}catch{}},[d]);const _r=()=>{p.videoRef.current&&(p.videoRef.current.currentTime=e.resumeTime,p.videoRef.current.play()),h({type:"SET_STATE",payload:{showResumeModal:!1}})},Nr=()=>{p.videoRef.current&&(p.videoRef.current.currentTime=0,p.videoRef.current.play()),h({type:"SET_STATE",payload:{showResumeModal:!1}})},sr=O(()=>{ct&&(qe.current=!0),Bt&&Je(!1),h({type:"SET_STATE",payload:{showResumeModal:!1}})},[h,ct,Bt]),Pr=O(()=>{if(Je(!1),p.videoRef.current)try{p.videoRef.current.currentTime=0,p.videoRef.current.play().catch(()=>{})}catch{}h({type:"SET_STATE",payload:{showResumeModal:!1}})},[h,p]),xr=O(async()=>{try{await N(),h({type:"SET_STATE",payload:{showResumeModal:!1}}),k("/")}catch{}},[N,h,k]),or=(t,s)=>r("div",{className:t,children:[r("button",{className:`${u.episodeNavBtn} ${u.secondary}`,onClick:Cr,disabled:!qt,type:"button",children:[r(q,{name:"chevron-left",size:12}),"Prev EP"]}),r("button",{className:`${u.episodeNavBtn} ${u.primary}`,onClick:_t,disabled:!Ae,type:"button",children:["Next EP",r(q,{name:"chevron-right",size:12})]}),s==="mobile"&&We&&r("button",{className:`${u.episodeNavBtn} ${u.episodePickerBtn}`,onClick:()=>Ct(!0),type:"button",children:[r(q,{name:"list-ul",size:12}),"Episodes"]})]});x(()=>{De&&(e.showResumeModal||y.length>0||ve||qe.current||ct&&h({type:"SET_STATE",payload:{showResumeModal:!0}}))},[De,ct,e.showResumeModal,y.length,ve,h]);const Ar=t=>{h({type:"SET_STATE",payload:{isAutoplayEnabled:t}}),Tn(t)},ar=!!(e.currentEpisode&&e.watchedEpisodes.includes(e.currentEpisode)),Br=e.selectedProvider!=="megaplay"||e.selectedSource?.type==="iframe",Ht=v(A);Ht.current=A;const ir=v("");x(()=>{const t=p.videoRef.current;if(_(!1),Je(!1),!t||e.selectedSource?.type==="iframe")return;const s=()=>{const i=t.duration,c=t.currentTime;if(!i||Number.isNaN(i)){_(!1),Je(!1);return}const R=c/i;if(i-c<=60){const le=y.findIndex(se=>Mt(se,n,e.showMeta?.id)&&se.episodeNumber===e.currentEpisode),H=y.length>0?le>=0?y[le+1]||null:y[0]:null,U=H?`${H.showId}:${H.episodeNumber}`:Qt?`${n}:${Ae}`:"";U&&ir.current!==U&&(ir.current=U,H?Ht.current(H.episodeNumber,H.showId):Ht.current(Ae))}_(Qt&&R>=.8),Je(c>=Math.max(i*.98,i-10))};return s(),t.addEventListener("timeupdate",s),t.addEventListener("loadedmetadata",s),()=>{t.removeEventListener("timeupdate",s),t.removeEventListener("loadedmetadata",s)}},[p.videoRef,Qt,e.currentEpisode,e.selectedSource,Ae,n,y,e.showMeta?.id]);const Lr=O(async()=>{if(!n||!e.currentEpisode||!e.showMeta.name||$)return;const t=p.videoRef.current?.duration,s=Math.max(t||0,e.resumeDuration||0,(e.showMeta.lengthMin||0)*60,1);await W(e.currentEpisode,s)},[n,e.currentEpisode,e.showMeta,e.resumeDuration,W,$,p.videoRef]);if(e.error&&!e.showMeta.name&&e.videoSources.length===0&&e.episodes.length===0)return r("p",{className:"error-message",children:["Error: ",e.error]});const nt=e.loadingShowData||e.loadingVideo,Ir=t=>{ge&&t.target===t.currentTarget&&(Ut(!1),localStorage.setItem("playerTheaterMode","false"))};return e.showMeta?.isAdult===!0&&!M?r("div",{className:Ge.playerPageLayout,children:r(Le,{isOpen:!0,title:"Content Warning",onClose:()=>k("/home"),children:r("div",{style:{padding:"1rem",textAlign:"center"},children:[r("p",{children:"This title contains mature content intended for adult audiences."}),r("p",{children:["By proceeding, you confirm that you are ",r("strong",{children:"18 years of age or older"})," (or the age of majority in your jurisdiction) and wish to view this content."]}),r("div",{style:{marginTop:"1rem",display:"flex",gap:"10px",justifyContent:"center"},children:[r(st,{variant:"secondary",onClick:()=>k("/home"),children:"Go Back"}),r(st,{onClick:E,children:"I'm 18+, Continue"})]})]})})}):r("div",{className:`${Ge.playerPageLayout} ${ge?Ge.theaterMode:""}`,onClick:Ir,children:[r(Le,{isOpen:Zt,onClose:sr,title:ct?"Show Completed!":"Resume Playback?",width:"sm",children:ct?r(kt,{children:[r(Le.Body,{children:r("p",{children:"Congratulations! You've finished the final episode of this series."})}),r(Le.Actions,{children:r(st,{onClick:xr,disabled:Oe,children:Oe?"Saving...":"Move to Completed"})})]}):r(kt,{children:[r(Le.Body,{children:r("p",{children:["You were watching at ",r("strong",{children:a.actions.formatTime(e.resumeTime)}),". Would you like to continue?"]})}),r(Le.Actions,{children:[r(st,{variant:"secondary",onClick:Nr,children:"Start Over"}),r(st,{onClick:_r,children:"Resume"})]})]})}),r(Le,{isOpen:Bt,onClose:sr,title:"Episode Completed",width:"sm",children:[r(Le.Body,{children:r("p",{children:["You've already watched Episode ",r("strong",{children:e.currentEpisode}),".",Ae?" Would you like to watch the next episode?":""]})}),r(Le.Actions,{children:[r(st,{variant:"secondary",onClick:Pr,children:"Replay"}),Ae&&r(st,{onClick:_t,children:`Watch EP ${Ae}`})]})]}),r(Le,{isOpen:!!St,onClose:wr,title:"Direct stream failed",width:"sm",children:[r(Le.Body,{children:[r("p",{children:[r("strong",{children:e.selectedProvider}),"'s direct stream failed for this episode."]}),St?.retryFailed&&r("p",{children:"No working direct stream was found on the other providers either."}),r("p",{children:["You can continue with the embedded (iframe) player, but embedded players may show"," ",r("strong",{children:"ads and pop-ups"}),"."]}),r("label",{style:{display:"flex",alignItems:"center",gap:"8px",marginTop:"0.75rem",cursor:"pointer"},children:[r("input",{type:"checkbox",checked:mt,onChange:t=>I(t.target.checked)}),"Remember my choice"]})]}),r(Le.Actions,{children:[r(st,{variant:"secondary",onClick:kr,children:"Continue with iframe"}),r(st,{onClick:Tr,disabled:xt,children:xt?"Searching…":"Try another provider"})]})]}),r(tn,{isOpen:!!e.showCookieModal,onClose:()=>h({type:"SET_STATE",payload:{showCookieModal:!1}}),onSuccess:()=>{j.invalidateQueries({queryKey:["video-sources",n,e.currentEpisode,e.selectedProvider,e.currentMode]})}}),!ge&&r("aside",{ref:je,className:Ge.episodeSidebar,children:e.loadingShowData?r(bn,{variant:"sidebar"}):r(yn,{episodes:e.episodes,currentEpisode:e.currentEpisode,watchedEpisodes:e.watchedEpisodes,onEpisodeClick:t=>k(`/watch/${n}/${t}`)})}),r("div",{className:Ge.playerMain,children:[r("div",{className:`${u.videoContainer} ${a.state.isFullscreen?"":Ge.videoPlayerWrapper} ${a.state.isFullscreen?u.fullscreenActive:""}`,style:{...ft?{visibility:"hidden"}:{}},onContextMenu:t=>t.preventDefault(),children:r(bs,{player:a,isAutoplayEnabled:e.isAutoplayEnabled,onAutoplayChange:Ar,fallbackChoice:re,onFallbackChoiceChange:ne,showNextEpisodeButton:!ft&&Pt&&y.length===0,onNextEpisode:_t,videoSources:e.videoSources,selectedSource:e.selectedSource,selectedLink:e.selectedLink,onSourceChange:(t,s)=>{p.videoRef.current&&!isNaN(p.videoRef.current.currentTime)&&(ee.current=p.videoRef.current.currentTime),ae(t.sourceName),h({type:"SET_STATE",payload:{selectedSource:t,selectedLink:s,showResumeModal:e.showResumeModal&&t.type!=="iframe"}})},loadingVideo:nt,skipIntervals:e.skipIntervals,animeTitle:vt,episodeNumber:e.currentEpisode,isTheaterMode:ge,onTheaterModeToggle:()=>{const t=!ge;Ut(t),localStorage.setItem("playerTheaterMode",t.toString())},anime4kEnabled:F.isEnabled,onAnime4kToggle:F.toggle,anime4kSupported:F.isWebGPUSupported,anime4kProfile:d,onAnime4kProfileChange:o,anime4kInitializing:F.isInitializing,anime4kError:F.error,videoDelayEnabled:D,onVideoDelayToggle:t=>{Y(t);try{localStorage.setItem("playerVideoDelayEnabled",String(t))}catch{}},videoDelayMs:l,onVideoDelayChange:K,onCalibrateAvSync:it,isInteractingExtra:Se||G,className:Sn.shellFill,hideChrome:e.selectedSource?.type==="iframe",overlays:r(kt,{children:[a.state.isSpeedBoostActive&&r("div",{className:u.speedBoostBadge,"aria-hidden":"true",children:[r("span",{children:"2x"}),r(q,{name:"forward",size:12})]}),Qe!==null&&ve?.nextItem&&r("div",{className:u.queueCountdown,children:["Queue next in ",Qe,"s"]})]}),children:[Tt&&r("div",{className:`${u.skipIndicatorContainer} ${Tt.side==="left"?u.leftSkip:u.rightSkip} `,children:r("div",{className:u.skipBubble,children:[r("div",{className:u.skipIcon,children:Tt.side==="left"?r(q,{name:"backward"}):r(q,{name:"forward"})}),r("div",{className:u.skipText,children:"15s"})]})}),nt&&r("div",{className:u.loadingOverlay,children:r("div",{className:u.loadingDots,children:[r("div",{className:u.dot}),r("div",{className:u.dot}),r("div",{className:u.dot})]})}),a.state.isBuffering&&!nt&&e.selectedSource?.type!=="iframe"&&r("div",{className:u.bufferingOverlay,children:r("div",{className:u.bufferingSpinner})}),e.selectedSource?.type==="iframe"?!nt&&r("iframe",{src:e.selectedLink?.link,className:u.videoIframe,allow:"autoplay; fullscreen; picture-in-picture",allowFullScreen:!0,sandbox:e.selectedSource.sandbox?`${e.selectedSource.sandbox} allow-fullscreen allow-popups allow-popups-to-escape-sandbox`:void 0}):r(kt,{children:[!nt&&e.videoSources.length===0&&r("div",{className:u.errorOverlay,children:[r("p",{children:["No sources found for this episode with ",e.selectedProvider,"."]}),r("p",{className:u.errorSubtext,children:"Please try selecting a different provider below."}),r("button",{className:u.retryButton,onClick:()=>window.location.reload(),"data-speed-boost-ignore":"true",style:{marginTop:8},children:"Retry"})]}),!nt&&e.videoSources.length>0&&r("video",{ref:p.videoRef,controls:a.state.useNativeControls,playsInline:!0,"webkit-playsinline":"true",disablePictureInPicture:!0,disableRemotePlayback:!0,onPlay:T.onPlay,onPause:T.onPause,onLoadedMetadata:T.onLoadedMetadata,onTimeUpdate:()=>{ie||(T.onTimeUpdate(),ve&&p.videoRef.current&&p.videoRef.current.currentTime<p.videoRef.current.duration-1&&(tt(null),Ze(null)))},onProgress:T.onProgress,onVolumeChange:T.onVolumeChange,onWaiting:T.onWaiting,onPlaying:T.onPlaying,onCanPlay:T.onCanPlay,onError:er,onContextMenu:t=>t.preventDefault(),className:Ie?u.videoElementHidden:""}),F.isWebGPUSupported&&!nt&&e.videoSources.length>0&&r("canvas",{ref:be,className:`${u.upscalerCanvas} ${Ve?u.upscalerActive:""}`}),!Ve&&!nt&&e.videoSources.length>0&&r("canvas",{ref:yt,className:`${u.upscalerCanvas} ${Ue?u.upscalerActive:""}`}),F.isEnabled&&F.isWebGPUSupported&&F.isInitializing&&r("div",{className:u.upscalerStatusBadge,children:"Preparing upscaler…"}),Ie&&r("div",{ref:Ye,className:u.subtitleOverlay}),r(En,{isOpen:G,ms:l,onChange:K,onApply:te,onClose:dt,testClipActive:ie,onTestClip:ue})]})]})}),!ge&&r(wn,{}),!ge&&r(kt,{children:[Vt&&y.length===0?r(ys,{count:3}):r(Mn,{title:"Queue",items:y,currentShowId:n,currentEpisode:e.currentEpisode,onNextQueue:Gt,onRemove:t=>rt.mutate({showId:t.showId,episodeNumber:t.episodeNumber}),onClear:()=>At.mutate(),showClearAll:!0,onReorder:t=>br.mutate(t.map(s=>({id:s.id,showId:s.showId,episodeNumber:s.episodeNumber})))}),r("div",{className:u.providerAndEpisodeRow,children:[r(Ms,{selectedProvider:e.selectedProvider,isAdult:e.showMeta?.isAdult,options:B,onProviderChange:t=>{ze.current=!1,_e.current=[],et.current=!1,Ne(null),h({type:"SET_STATE",payload:{selectedProvider:t,videoSources:[],selectedSource:null,selectedLink:null,loadingVideo:!0}}),localStorage.setItem("preferredProvider",t)}}),or(`${u.episodeActions} ${u.desktopEpisodeActions}`,"desktop")]}),nt?r("div",{className:u.sourceLoader,children:r("div",{className:u.spinner})}):r(kt,{children:r(Ns,{videoSources:e.videoSources,selectedSource:e.selectedSource,selectedLink:e.selectedLink,onSourceChange:t=>{p.videoRef.current&&!isNaN(p.videoRef.current.currentTime)&&(ee.current=p.videoRef.current.currentTime);const i=(t.links||[]).sort((c,R)=>(parseInt(R.resolutionStr)||0)-(parseInt(c.resolutionStr)||0))[0]||null;ae(t.sourceName),h({type:"SET_STATE",payload:{selectedSource:t,selectedLink:i,showResumeModal:e.showResumeModal&&t.type!=="iframe"}})},onLinkChange:t=>{e.selectedSource&&(ae(e.selectedSource.sourceName),h({type:"SET_STATE",payload:{selectedLink:t}}))}})}),r("div",{className:Ge.playerInfoContainer,children:[r("div",{className:Ge.playerInfoHeader,children:[r("div",{className:Ge.playerAnimeCard,children:r("img",{src:rn(e.showMeta.thumbnail||""),alt:vt,loading:"lazy",decoding:"async",onError:t=>{t.target.src="/placeholder.svg"}})}),r("div",{className:Ge.videoTitleSection,children:[r("div",{className:u.titleContainer,children:[r("h1",{children:vt}),r("div",{className:u.scheduleInfo,children:[e.showMeta.status&&r("span",{className:u.status,children:e.showMeta.status}),e.showMeta.nextEpisodeAirDate&&r("span",{className:u.nextEpisode,children:["Next episode: ",e.showMeta.nextEpisodeAirDate]})]})]}),r("div",{className:u.controls,children:[r("button",{className:`${u.watchlistBtn} ${e.inWatchlist?u.inList:""}`,onClick:Ce,children:[e.inWatchlist?r(q,{name:"check",size:14}):r(q,{name:"plus",size:14}),e.inWatchlist?"In Watchlist":"Add to Watchlist"]}),r(Nn,{showId:n,showName:e.showMeta.name||e.showMeta.names?.romaji,showThumbnail:e.showMeta.thumbnail,nativeName:e.showMeta.names?.native,englishName:e.showMeta.names?.english,showType:e.showMeta.type,className:`${u.watchlistBtn} ${u.queueBtn}`,activeClassName:u.queueActive}),Br&&r("button",{className:`${u.watchlistBtn} ${u.markWatchedBtn} ${ar?u.markWatchedDone:""}`,onClick:Lr,disabled:$||!e.currentEpisode,children:[r(q,{name:"check",size:14}),$?"Saving...":ar?"Watched":"Mark Watched"]}),r("button",{className:`${u.watchlistBtn} ${u.modeToggleBtn} ${e.currentMode==="dub"?u.modeToggleActive:""}`,onClick:()=>{const t=e.currentMode==="dub"?"sub":"dub";ze.current=!1,_e.current=[],et.current=!1,Ne(null),h({type:"SET_MODE",payload:t}),localStorage.setItem("preferredMode",t)},type:"button","aria-pressed":e.currentMode==="dub",children:e.currentMode==="dub"?"DUB":"SUB"}),Rr&&r("button",{className:`${u.watchlistBtn} ${u.modeToggleBtn} ${a.state.useNativeControls?u.modeToggleActive:""}`,onClick:()=>{const t=!a.state.useNativeControls;a.actions.setUseNativeControls(t),localStorage.setItem("playerUseNativeControls",t.toString())},type:"button",children:a.state.useNativeControls?"NATIVE: ON":"NATIVE: OFF"})]})]})]}),or(`${u.episodeActions} ${u.mobileEpisodeActions}`,"mobile"),r("div",{className:u.descriptionSection,children:[r("h3",{children:"Synopsis"}),r(xn,{text:e.showMeta.description?e.showMeta.description.replace(/<[^>]*>?/gm,""):"",emptyText:"No description available."})]}),r("button",{className:u.detailsToggleBtn,onClick:Fe,children:[e.showCombinedDetails?r(q,{name:"chevron-up"}):r(q,{name:"chevron-down"}),e.showCombinedDetails?"Hide Details":"Show Details"]}),e.showCombinedDetails&&r(Pn,{showMeta:e.showMeta,styles:u})]})]})]}),r(kn,{isOpen:Se,onClose:()=>Ct(!1),episodes:e.episodes,currentEpisode:e.currentEpisode,watchedEpisodes:e.watchedEpisodes,onEpisodeClick:t=>{Ct(!1),k(`/watch/${n}/${t}`)}})]})};export{oo as default};