1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9804],{51296:(e,t,a)=>{"use strict";a.d(t,{default:()=>j});var s=a(95155),l=a(85998),r=a(65229),i=a(86121),d=a(5917),n=a(7620),o=a(12115),c=a(52619),m=a.n(c),h=a(77258),u=a(20063),x=a(4920),p=a(60235),w=a(95058),g=a(11131),b=a(29978),f=a(8640);let{useSession:v}=(0,g.M)(),j=e=>{let{dramaInfo:t,id:a}=e,{data:c}=v(),{onOpen:g}=(0,b.X)(),j=!!c,[N,k]=(0,o.useState)(""),[_,S]=(0,o.useState)(!0),[y,A]=(0,o.useState)(!0),[I,T]=(0,o.useState)(!1),[C,z]=(0,o.useState)(!0),[M,O]=(0,o.useState)(!1),[D,E]=(0,o.useState)("streamwish"),[P,W]=(0,o.useState)([]),R=(0,u.useSearchParams)().get("epId"),H=t.episodes.find(e=>e.episode_id===R),[L,V]=(0,o.useState)(!1),[X,B]=(0,o.useState)(!1),{addItem:F,removeItem:U}=(0,w.C)("watchlist",!1),[Y,G]=(0,o.useState)(()=>"true"===localStorage.getItem("watchHistoryPaused")),{addItem:q}=(0,w.C)("history",Y);(0,o.useEffect)(()=>{if(Y||!a||!t||!H)return;let e=setTimeout(()=>{q({mediaId:a,mediaType:"drama",title:t.title,backdrop_path:t.thumbnail,episode:H.episodeNo,addedAt:new Date().toISOString(),watchedAt:new Date().toISOString(),createdAt:new Date().toISOString()})},1e3);return()=>clearTimeout(e)},[a,t,H,Y,q]),(0,o.useEffect)(()=>{(async()=>{try{let t=await fetch("/api/drama/stream?episodeId=".concat(R)),a=await t.json();if(a.success){let t=Object.entries(a.data).map(e=>{let[t,a]=e;return{name:t,embeded_link:a.embeded_link,url:a.m3u8?a.stream||"":a.embeded_link,isM3u8:!!a.m3u8,isWorking:!!(!a.error&&(a.stream||a.embeded_link)),status:a.error?"error":a.skipped?"skipped":"working"}});W(t);let s=t.find(e=>e.embeded_link);if(s)k(s.embeded_link),E(s.name),A(!0);else{var e;k(""),E((null==(e=t[0])?void 0:e.name)||"standard")}}}catch(e){console.error("Error fetching stream URL:",e)}finally{S(!1)}})()},[R]);let J=[...t.episodes].filter(e=>void 0!==e.episodeNo&&e.episode_id).sort((e,t)=>(e.episodeNo||0)-(t.episodeNo||0)),K=J.findIndex(e=>e.episode_id===R),Q=K>0?J[K-1]:void 0,Z=K<J.length-1?J[K+1]:void 0,$=K<J.length-1;return _?(0,s.jsx)("div",{className:"h-[400px] w-full flex items-center justify-center",children:(0,s.jsx)("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-red-700"})}):N?(0,s.jsxs)("div",{className:"min-h-screen pt-16",children:[(0,s.jsxs)("div",{className:"mx-auto max-w-screen-xl px-4",children:[(0,s.jsxs)("h1",{className:"truncate pb-5 text-center text-xl font-semibold",children:["Now Watching: ",(0,s.jsx)("span",{className:"font-bold",children:t.title})]}),(0,s.jsxs)("div",{className:(0,h.cn)("mx-auto mb-2 flex w-full items-center rounded-lg bg-gradient-to-r from-amber-500 to-orange-500 text-white shadow-lg border border-amber-400/30 backdrop-blur-sm lg:w-3/4 lg:pl-6",C?"":"hidden"),children:[(0,s.jsxs)("div",{className:"flex w-full items-center justify-center gap-x-2 p-2 text-sm",children:[(0,s.jsx)(l.A,{className:"h-3 w-3 fill-white"}),(0,s.jsx)("span",{className:"text-[10px] md:text-xs lg:text-sm",children:"Please switch to other servers if default server doesnt work."})]}),(0,s.jsx)(r.A,{className:"h-8 w-8 cursor-pointer justify-end pr-2",onClick:()=>z(!1)})]}),(0,s.jsxs)("div",{className:"relative mx-auto h-[400px] w-full overflow-hidden rounded-lg bg-black shadow-lg md:aspect-video md:h-full lg:w-3/4",children:[(0,s.jsxs)("button",{onClick:()=>T(!I),className:"absolute left-0 right-0 top-0 z-20 mx-auto flex h-10 w-40 items-center justify-center gap-x-2 rounded-b-[12px] bg-gradient-to-r from-blue-600 to-purple-600 text-white transition-all hover:from-blue-700 hover:to-purple-700 shadow-lg hover:shadow-xl backdrop-blur-sm border border-white/20",children:[I?(0,s.jsx)(r.A,{}):(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5 md:h-7 md:w-7",viewBox:"0 0 24 24",children:(0,s.jsx)("path",{fill:"currentColor",d:"M20 3H4a2 2 0 0 0-2 2v4a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V5a2 2 0 0 0-2-2zm-5 5h-2V6h2zm4 0h-2V6h2zm1 5H4a2 2 0 0 0-2 2v4a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-4a2 2 0 0 0-2-2zm-5 5h-2v-2h2zm4 0h-2v-2z"})}),I?"Close":"Select a server"]}),(0,s.jsx)("div",{className:"absolute left-0 right-0 top-12 z-30 mx-auto w-fit max-w-[95vw] rounded-xl sm:rounded-2xl bg-black/95 backdrop-blur-xl border border-white/10 p-3 sm:p-4 md:p-6 text-white transition-all duration-300 shadow-2xl ".concat(I?"scale-100 opacity-100":"pointer-events-none scale-95 opacity-0"),children:(0,s.jsx)("div",{className:"max-h-[250px] sm:max-h-[300px] lg:max-h-none overflow-auto px-3 py-2 scrollbar-thin lg:scrollbar-none",onTouchStart:e=>{let t=e.touches&&e.touches[0];t&&(window.__dramaTouchStart={x:t.clientX,y:t.clientY},window.__dramaTouchMoved=!1)},onTouchMove:e=>{let t=window.__dramaTouchStart;if(!t)return;let a=e.touches&&e.touches[0];if(!a)return;let s=Math.abs(a.clientX-t.x),l=Math.abs(a.clientY-t.y);(s>8||l>8)&&(window.__dramaTouchMoved=!0)},onTouchEnd:()=>{window.__dramaTouchStart=null},style:{scrollbarWidth:"thin",scrollbarColor:"#6b7280 transparent",touchAction:"pan-y"},children:(0,s.jsx)("div",{className:"grid grid-cols-3 gap-2 sm:grid-cols-4 md:grid-cols-5 lg:grid-cols-6",children:P.map(e=>(0,s.jsxs)("button",{onClick:t=>{t.preventDefault(),t.stopPropagation(),k(e.embeded_link),E(e.name),T(!1),A(!0)},onTouchEnd:t=>{window.__dramaTouchMoved||(t.preventDefault(),t.stopPropagation(),k(e.embeded_link),E(e.name),T(!1),A(!0))},className:(0,h.cn)("group relative w-full rounded-lg sm:rounded-xl px-2 py-2 sm:px-3 sm:py-3 text-xs sm:text-sm font-medium transition-all duration-200 hover:scale-105 active:scale-95 touch-manipulation select-none",D===e.name?"bg-gradient-to-r from-blue-600 to-purple-600 shadow-lg shadow-blue-500/25 ring-1 sm:ring-2 ring-blue-400/50":"bg-white/5 border border-white/10 hover:bg-white/10 hover:border-white/20 hover:shadow-lg hover:shadow-white/5"),children:[(0,s.jsxs)("div",{className:"flex flex-col items-center gap-1 sm:gap-2",children:[(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)("div",{className:"w-4 h-3 sm:w-5 sm:h-4 md:w-6 md:h-4 roun
1ded-sm bg-gradient-to-r from-blue-500 to-purple-500 flex items-center justify-center",children:(0,s.jsx)("span",{className:"text-[8px] sm:text-xs font-bold text-white",children:"S"})}),D===e.name&&(0,s.jsx)("div",{className:"absolute -top-0.5 -right-0.5 sm:-top-1 sm:-right-1 w-3 h-3 sm:w-4 sm:h-4 bg-green-500 rounded-full flex items-center justify-center",children:(0,s.jsx)("svg",{className:"w-2 h-2 sm:w-2.5 sm:h-2.5 text-white",fill:"currentColor",viewBox:"0 0 20 20",children:(0,s.jsx)("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})})})]}),(0,s.jsx)("span",{className:"text-[10px] sm:text-xs font-semibold text-center leading-tight",children:e.name})]}),D===e.name&&(0,s.jsx)("div",{className:"absolute inset-0 rounded-lg sm:rounded-xl bg-gradient-to-r from-red-600/20 to-red-700/20 animate-pulse"})]},e.name))})})}),y&&N&&t&&(0,s.jsx)(f.G,{posterUrl:t.thumbnail||"/placeholder.png",title:t.title}),N&&(0,s.jsx)("iframe",{src:N,onLoad:()=>A(!1),className:"absolute left-0 top-0 h-full w-full bg-black z-10 ".concat(I?"pointer-events-none":"pointer-events-auto"),allowFullScreen:!0,allow:"autoplay; encrypted-media; picture-in-picture"})]}),(0,s.jsxs)("div",{className:"relative z-10 mx-auto -mt-[5px] flex w-full items-center justify-center gap-x-4 rounded-b-lg bg-gray-900 py-1 text-sm text-white lg:w-3/4",children:[K>0&&(0,s.jsx)(m(),{href:"/watch/drama/".concat(a,"?epId=").concat(null==Q?void 0:Q.episode_id),children:(0,s.jsxs)("label",{className:"flex cursor-pointer items-center gap-x-1 rounded-md transition-all",children:[(0,s.jsx)(i.A,{className:"h-4 w-4 rotate-180 fill-white"}),(0,s.jsx)("span",{className:"hidden lg:block",children:"Previous"})]})}),$&&(0,s.jsx)(s.Fragment,{children:(0,s.jsx)(m(),{href:"/watch/drama/".concat(a,"?epId=").concat(null==Z?void 0:Z.episode_id),children:(0,s.jsxs)("label",{className:"flex cursor-pointer items-center gap-x-1 rounded-md transition-all",children:[(0,s.jsx)(i.A,{className:"h-4 w-4 fill-white"}),(0,s.jsx)("span",{className:"hidden lg:block",children:"Next"})]})})}),j?(0,s.jsxs)("label",{className:"flex cursor-pointer items-center gap-x-1 rounded-md transition-all",onClick:()=>{j&&(X?(U(a,"drama"),B(!1)):(F({mediaId:a,mediaType:"drama",title:t.title,backdrop_path:t.thumbnail,_id:"",addedAt:new Date().toISOString(),createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()}),B(!0)))},children:[(0,s.jsx)(p.A,{className:(0,h.cn)("h-4 w-4 rounded",X&&"fill-white")}),(0,s.jsx)("span",{className:"hidden lg:block",children:X?"Remove from Watchlist":"Add to Watchlist"})]}):(0,s.jsxs)("button",{onClick:g,className:"flex cursor-pointer items-center gap-x-1 rounded-md transition-all",children:[(0,s.jsx)(p.A,{className:"h-4 w-4"}),(0,s.jsx)("span",{className:"hidden lg:block",children:"Add to Watchlist"})]}),(0,s.jsxs)("label",{className:"flex cursor-pointer items-center gap-x-1 rounded-md transition-all",onClick:()=>{let e=window.location.href;navigator.share?navigator.share({title:t.title,url:e}).catch(console.error):navigator.clipboard.writeText(e).then(()=>{O(!0),setTimeout(()=>O(!1),2e3)})},children:[M?(0,s.jsx)(d.A,{className:"h-4 w-4 text-green-500"}):(0,s.jsx)(n.A,{className:"h-4 w-4"}),(0,s.jsx)("span",{className:"hidden lg:block",children:"Share"})]})]})]}),(0,s.jsx)("div",{className:"mx-auto mt-8 w-full lg:w-3/4",children:(0,s.jsx)("div",{className:"mt-6 px-4 md:px-8 lg:px-12 xl:px-16",children:(0,s.jsx)(x.b,{data:{title:t.title,thumbnail:t.thumbnail,episodes:t.episodes},id:a})})})]}):(0,s.jsxs)("div",{className:"h-[400px] w-full flex items-center justify-center flex-col gap-4",children:[(0,s.jsx)("p",{className:"text-red-500",children:"No available streams found"}),P.length>0&&(0,s.jsx)("div",{className:"flex flex-wrap gap-2",children:P.map(e=>(0,s.jsx)("button",{onClick:()=>{e.embeded_link&&(k(e.embeded_link),E(e.name))},className:(0,h.cn)("px-4 py-2 rounded-md text-sm",e.embeded_link?"bg-red-700 hover:bg-red-800 text-white":"bg-gray-700 text-gray-300 cursor-not-allowed"),disabled:!e.embeded_link,children:e.name},e.name))})]})}},91620:(e,t,a)=>{Promise.resolve().then(a.bind(a,51296))}},e=>{e.O(0,[7405,2076,8096,7358],()=>e(e.s=91620)),_N_E=e.O()}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.