1import{an as b,r as a,aF as m,b as _,j as e,bG as p,ag as H,aW as O}from"./index-DJFkwTtV.js";/** 2 * @license lucide-react v0.462.0 - ISC 3 * 4 * This source code is licensed under the ISC license. 5 * See the LICENSE file in the root directory of this source tree. 6 */const I=b("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/** 7 * @license lucide-react v0.462.0 - ISC 8 * 9 * This source code is licensed under the ISC license. 10 * See the LICENSE file in the root directory of this source tree. 11 */const q=b("Cookie",[["path",{d:"M12 2a10 10 0 1 0 10 10 4 4 0 0 1-5-5 4 4 0 0 1-5-5",key:"laymnq"}],["path",{d:"M8.5 8.5v.01",key:"ue8clq"}],["path",{d:"M16 15.5v.01",key:"14dtrp"}],["path",{d:"M12 12v.01",key:"u5ubse"}],["path",{d:"M11 17v.01",key:"1hyl5a"}],["path",{d:"M7 14v.01",key:"uct60s"}]]);/** 12 * @license lucide-react v0.462.0 - ISC 13 * 14 * This source code is licensed under the ISC license. 15 * See the LICENSE file in the root directory of this source tree. 16 */const F=b("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);/** 17 * @license lucide-react v0.462.0 - ISC 18 * 19 * This source code is licensed under the ISC license. 20 * See the LICENSE file in the root directory of this source tree. 21 */const U=b("ShieldX",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m14.5 9.5-5 5",key:"17q4r4"}],["path",{d:"m9.5 9.5 5 5",key:"18nt4w"}]]),f="https://a.media.plotpix.ai/series/7gmhzv8eey/delivery/episodes/EP_20260811_110312657_qeuw/v1/hls/index.m3u8";function W(i){return i?JSON.stringify(i,null,2):"No endpoint response yet."}function $(i){return i==="success"?"border-emerald-500/40 bg-emerald-500/10 text-emerald-100":i==="error"?"border-red-500/40 bg-red-500/10 text-red-100":i==="running"?"border-sky-500/40 bg-sky-500/10 text-sky-100":"border-white/10 bg-white/[0.04] text-white/70"}function D(){const i=a.useRef(null),w=a.useRef(null),j=a.useRef(0),[v,d]=a.useState("idle"),[N,l]=a.useState("idle"),[M,x]=a.useState(null),[S,C]=a.useState([]),[R,g]=a.useState(null),[A,u]=a.useState("Not checked"),k=a.useMemo(()=>m.isSupported(),[]),o=a.useCallback((s,t)=>{j.current+=1,C(n=>[{id:j.current,level:s,message:t},...n].slice(0,20))},[]),c=a.useCallback(()=>{w.current?.destroy(),w.current=null;const s=i.current;s&&(s.pause(),s.removeAttribute("src"),s.load()),l("idle")},[]);a.useEffect(()=>c,[c]);const h=a.useCallback(async s=>{u(`Checking manifest with credentials: ${s}`);try{const t=await fetch(f,{method:"GET",credentials:s,cache:"no-store"}),r=(await t.text().catch(()=>"")).slice(0,140).replace(/\s+/g," ");u(`${t.status} ${t.statusText}${r?` - ${r}`:""}`),o(t.ok?"success":"error",`Manifest probe (${s}) returned ${t.status}.`)}catch(t){const n=t instanceof Error?t.message:"Unknown fetch error";u(`Fetch failed: ${n}`),o("error",`Manifest probe (${s}) failed: ${n}`)}},[o]),y=a.useCallback(()=>{const s=i.current;if(s){if(c(),l("running"),k){const t=new m({xhrSetup:n=>{n.withCredentials=!0}});w.current=t,t.on(m.Events.MANIFEST_PARSED,()=>{l("success"),o("success","HLS.js loaded the manifest with xhr.withCredentials = true."),s.play().catch(n=>{const r=n instanceof Error?n.message:"Autoplay blocked";o("info",`Tap play if autoplay is blocked: ${r}`)})}),t.on(m.Events.ERROR,(n,r)=>{const P=`${r.type} / ${r.details}${r.response?.code?` / ${r.response.code}`:""}`;o(r.fatal?"error":"info",`HLS.js error: ${P}`),r.fatal&&l("error")}),t.loadSource(f),t.attachMedia(s);return}if(s.canPlayType("application/vnd.apple.mpegurl")){s.crossOrigin="use-credentials",s.src=f,s.play().catch(t=>{const n=t instanceof Error?t.message:"Autoplay blocked";o("info",`Native HLS is in use; tap play if needed: ${n}`)}),l("success"),o("info","Native HLS is in use with video.crossOrigin = use-credentials.");return}l("error"),o("error","This browser does not support HLS.js or native HLS.")}},[o,k,c]),E=a.useCallback(async s=>{g(s),d("running"),x(null),c(),o("info",`POST /media/aws-cookie-test with mode: ${s}`);try{const t=await _("MEDIA_AWS_COOKIE_TEST",{method:"POST",body:{mode:s},failAction:s==="with_cookies"?"block":"moveon"});x(t),d("success"),o("success",`Endpoint call succeeded for ${s}.`),await h("include"),y()}catch(t){const n=typeof t=="object"&&t&&"status"in t?` (${String(t.status)})`:"",r=t instanceof Error?t.message:"Unknown endpoint error";d("error"),o("error",`Endpoint call failed${n}: ${r}`),await h("include"),y()}},[o,c,y,h]),T=a.useCallback(async()=>{g("direct"),x(null),d("idle"),c(),o("info","Checking the media URL with credentials omitted."),await h("omit")},[o,c,h]),L=a.useCallback(()=>{c(),g(null),d("idle"),x(null),u("Not checked"),C([])},[c]);return e.jsx("main",{className:"min-h-screen bg-[#08080A] px-4 py-6 text-white sm:px-6 lg:px-8",children:e.jsxs("div",{className:"mx-auto flex max-w-6xl flex-col gap-6",children:[e.jsxs("header",{className:"flex flex-col gap-3 border-b border-white/10 pb-5 sm:flex-row sm:items-end sm:justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-mono text-xs uppercase tracking-[0.18em] text-[#E6007A]",children:"CloudFront Signed Cookie Test"}),e.jsx("h1",{className:"mt-2 font-heading text-2xl font-bold sm:text-3xl",children:"AWS Cookie Media Access"})]}),e.jsxs(p,{type:"button",variant:"outline",onClick:L,className:"border-white/15 bg-white/[0.04] text-white hover:bg-white/10 hover:text-white",children:[e.jsx(F,{}),"Reset"]})]}),e.jsxs("section",{className:"grid gap-6 lg:grid-cols-[minmax(0,1.15fr)_minmax(340px,0.85fr)]",children:[e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"aspect-[9/16] max-h-[76vh] overflow-hidden rounded-md border border-white/10 bg-black sm:aspect-video sm:max-h-none",children:e.jsx("video",{ref:i,className:"h-full w-full bg-black object-contain",controls:!0,playsInl
21ine:!0})}),e.jsxs("div",{className:"grid gap-3 sm:grid-cols-3",children:[e.jsxs(p,{type:"button",variant:"outline",onClick:T,className:"border-white/15 bg-white/[0.04] text-white hover:bg-white/10 hover:text-white",children:[e.jsx(U,{}),"Probe No Cookies"]}),e.jsxs(p,{type:"button",onClick:()=>E("without_cookies"),className:"bg-white text-black hover:bg-white/90",children:[e.jsx(I,{}),"Test Without"]}),e.jsxs(p,{type:"button",onClick:()=>E("with_cookies"),className:"bg-[#E6007A] text-white hover:bg-[#c80069]",children:[e.jsx(q,{}),"Test With Cookies"]})]})]}),e.jsxs("aside",{className:"space-y-4",children:[e.jsxs("div",{className:`rounded-md border p-4 ${$(v)}`,children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("h2",{className:"font-heading text-base font-bold",children:"Endpoint"}),e.jsx("span",{className:"font-mono text-xs uppercase",children:v})]}),e.jsx("p",{className:"mt-2 break-all font-mono text-xs text-white/70",children:"POST /media/aws-cookie-test"}),e.jsxs("p",{className:"mt-1 font-mono text-xs text-white/70",children:["mode: ",R??"none"]})]}),e.jsxs("div",{className:`rounded-md border p-4 ${$(N)}`,children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("h2",{className:"font-heading text-base font-bold",children:"Player"}),e.jsx("span",{className:"font-mono text-xs uppercase",children:N})]}),e.jsx("p",{className:"mt-2 font-mono text-xs text-white/70",children:k?"HLS.js xhr.withCredentials = true":"Native HLS fallback"})]}),e.jsxs("div",{className:"rounded-md border border-white/10 bg-white/[0.04] p-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(H,{className:"h-4 w-4 text-emerald-300"}),e.jsx("h2",{className:"font-heading text-base font-bold",children:"Manifest Probe"})]}),e.jsx("p",{className:"mt-2 break-words font-mono text-xs text-white/70",children:A})]}),e.jsxs("div",{className:"rounded-md border border-white/10 bg-white/[0.04] p-4",children:[e.jsx("h2",{className:"font-heading text-base font-bold",children:"Endpoint Response"}),e.jsx("pre",{className:"mt-3 max-h-44 overflow-auto whitespace-pre-wrap rounded bg-black/60 p-3 font-mono text-xs text-white/70",children:W(M)})]}),e.jsxs("div",{className:"rounded-md border border-white/10 bg-white/[0.04] p-4",children:[e.jsx("h2",{className:"font-heading text-base font-bold",children:"Log"}),e.jsx("div",{className:"mt-3 max-h-56 space-y-2 overflow-auto font-mono text-xs",children:S.length===0?e.jsx("p",{className:"text-white/50",children:"No runs yet."}):S.map(s=>e.jsx("p",{className:s.level==="success"?"text-emerald-200":s.level==="error"?"text-red-200":"text-white/70",children:s.message},s.id))}),e.jsx("p",{className:"mt-4 text-xs leading-5 text-white/45",children:"After a successful cookie-setting run, browser cookies can make later no-cookie cases appear to pass until those cookies expire or are cleared."})]})]})]}),e.jsx("section",{className:"rounded-md border border-white/10 bg-white/[0.04] p-4",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(O,{className:"mt-0.5 h-4 w-4 text-[#E6007A]"}),e.jsx("p",{className:"break-all font-mono text-xs leading-5 text-white/65",children:f})]})})]})})}export{D as default};
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.