@epic-web/workshop-app 4.15.0 → 4.16.1

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 (35) hide show
  1. package/build/client/assets/{_exerciseNumber-Ccwr4LZw.js → _exerciseNumber-BLQUCLPr.js} +2 -2
  2. package/build/client/assets/{_exerciseNumber-Ccwr4LZw.js.map → _exerciseNumber-BLQUCLPr.js.map} +1 -1
  3. package/build/client/assets/{_exerciseNumber_.finished-gEWcHsfL.js → _exerciseNumber_.finished-C9TSc48F.js} +2 -2
  4. package/build/client/assets/{_exerciseNumber_.finished-gEWcHsfL.js.map → _exerciseNumber_.finished-C9TSc48F.js.map} +1 -1
  5. package/build/client/assets/_layout-B789acDk.js +6 -0
  6. package/build/client/assets/_layout-B789acDk.js.map +1 -0
  7. package/build/client/assets/{_layout-0urSK0i1.js → _layout-DMuKczTu.js} +2 -2
  8. package/build/client/assets/{_layout-0urSK0i1.js.map → _layout-DMuKczTu.js.map} +1 -1
  9. package/build/client/assets/{diff-CpG96hGZ.js → diff-4FQLirNf.js} +2 -2
  10. package/build/client/assets/{diff-CpG96hGZ.js.map → diff-4FQLirNf.js.map} +1 -1
  11. package/build/client/assets/{diff-Bd9WnUnR.js → diff-CPrD1rHd.js} +2 -2
  12. package/build/client/assets/{diff-Bd9WnUnR.js.map → diff-CPrD1rHd.js.map} +1 -1
  13. package/build/client/assets/{epic-video-DJN9_SUj.js → epic-video-CfelX9-n.js} +2 -2
  14. package/build/client/assets/{epic-video-DJN9_SUj.js.map → epic-video-CfelX9-n.js.map} +1 -1
  15. package/build/client/assets/{finished-DRjILUr_.js → finished-C0mN8TiU.js} +2 -2
  16. package/build/client/assets/{finished-DRjILUr_.js.map → finished-C0mN8TiU.js.map} +1 -1
  17. package/build/client/assets/{index-3HxjMIAS.js → index-De7yI02n.js} +2 -2
  18. package/build/client/assets/{index-3HxjMIAS.js.map → index-De7yI02n.js.map} +1 -1
  19. package/build/client/assets/{manifest-fcdcf131.js → manifest-a24c7823.js} +1 -1
  20. package/build/client/assets/mdx-CQW0I4So.js +2 -0
  21. package/build/client/assets/mdx-CQW0I4So.js.map +1 -0
  22. package/build/client/assets/{onboarding-CxyD6D0I.js → onboarding-BXGyEPXy.js} +2 -2
  23. package/build/client/assets/{onboarding-CxyD6D0I.js.map → onboarding-BXGyEPXy.js.map} +1 -1
  24. package/build/client/assets/root-BUqeXmeK.js.map +1 -1
  25. package/build/client/assets/{support-DZyqD0NL.js → support-DilzTPHE.js} +2 -2
  26. package/build/client/assets/{support-DZyqD0NL.js.map → support-DilzTPHE.js.map} +1 -1
  27. package/build/server/index.js +2178 -2203
  28. package/build/server/index.js.map +1 -1
  29. package/dist/server/index.js +6 -1
  30. package/package.json +3 -3
  31. package/start.js +1 -23
  32. package/build/client/assets/_layout-dHX2Hcew.js +0 -6
  33. package/build/client/assets/_layout-dHX2Hcew.js.map +0 -1
  34. package/build/client/assets/mdx-BENF-kTQ.js +0 -2
  35. package/build/client/assets/mdx-BENF-kTQ.js.map +0 -1
@@ -1,2 +1,2 @@
1
- import{c as o,j as r}from"./index-Czg1ruVn.js";import{d as e,c as m}from"./misc-S5ZD98sI.js";import{D as p}from"./diff-CpG96hGZ.js";import{N as n}from"./nav-chevrons-DaXg0NPS.js";import{u as f,b as c}from"./components-wgHiPsTg.js";import"./clsx-B-dksMZM.js";import"./tooltip-BtzSIxlB.js";import"./index-C6ToujzV.js";import"./mdx-BENF-kTQ.js";import"./epic-video-DJN9_SUj.js";import"./index-yEAxvbDV.js";import"./request-info-DHtGM4FI.js";import"./client-hints-DLYDs4RF.js";import"./loading-B0uKxERz.js";import"./user-CdUDQ7a8.js";import"./progress-bar-wMXWRGq0.js";function k(){const i=f(),[s]=c();new URLSearchParams(s).set("forceFresh","diff");const a=o(),t=e.useSpinDelay(a.state!=="idle",{delay:200,minDuration:200});return r.jsxs("div",{className:m("grid h-full grid-rows-[1fr,auto]",{"cursor-wait opacity-30":t}),children:[r.jsx("div",{className:"overflow-y-auto",children:r.jsx(p,{diff:i.diff,allApps:i.allApps})}),r.jsx("div",{className:"flex h-16 items-center justify-end border-t",children:r.jsx(n,{prev:i.prevLink,next:i.nextLink})})]})}export{k as default};
2
- //# sourceMappingURL=diff-Bd9WnUnR.js.map
1
+ import{c as o,j as r}from"./index-Czg1ruVn.js";import{d as e,c as m}from"./misc-S5ZD98sI.js";import{D as p}from"./diff-4FQLirNf.js";import{N as n}from"./nav-chevrons-DaXg0NPS.js";import{u as f,b as c}from"./components-wgHiPsTg.js";import"./clsx-B-dksMZM.js";import"./tooltip-BtzSIxlB.js";import"./index-C6ToujzV.js";import"./mdx-CQW0I4So.js";import"./epic-video-CfelX9-n.js";import"./index-yEAxvbDV.js";import"./request-info-DHtGM4FI.js";import"./client-hints-DLYDs4RF.js";import"./loading-B0uKxERz.js";import"./user-CdUDQ7a8.js";import"./progress-bar-wMXWRGq0.js";function k(){const i=f(),[s]=c();new URLSearchParams(s).set("forceFresh","diff");const a=o(),t=e.useSpinDelay(a.state!=="idle",{delay:200,minDuration:200});return r.jsxs("div",{className:m("grid h-full grid-rows-[1fr,auto]",{"cursor-wait opacity-30":t}),children:[r.jsx("div",{className:"overflow-y-auto",children:r.jsx(p,{diff:i.diff,allApps:i.allApps})}),r.jsx("div",{className:"flex h-16 items-center justify-end border-t",children:r.jsx(n,{prev:i.prevLink,next:i.nextLink})})]})}export{k as default};
2
+ //# sourceMappingURL=diff-CPrD1rHd.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"diff-Bd9WnUnR.js","sources":["../../../app/routes/diff.tsx"],"sourcesContent":["import {\n\tgetAppByName,\n\tgetAppDisplayName,\n\tgetApps,\n\tisExerciseStepApp,\n} from '@epic-web/workshop-utils/apps.server'\nimport { makeTimings } from '@epic-web/workshop-utils/timing.server'\nimport { defer, type LoaderFunctionArgs } from '@remix-run/node'\nimport { useLoaderData, useNavigation, useSearchParams } from '@remix-run/react'\nimport { useSpinDelay } from 'spin-delay'\nimport { Diff } from '#app/components/diff.tsx'\nimport { NavChevrons } from '#app/components/nav-chevrons.tsx'\nimport { getDiffCode } from '#app/utils/diff.server.ts'\nimport { cn } from '#app/utils/misc.tsx'\n\nexport async function loader({ request }: LoaderFunctionArgs) {\n\tconst reqUrl = new URL(request.url)\n\tconst searchParams = reqUrl.searchParams\n\tconst timings = makeTimings('diffLoader')\n\tconst cacheOptions = { request, timings }\n\tconst allAppsFull = await getApps()\n\tconst app1Name = reqUrl.searchParams.get('app1')\n\tconst app2Name = reqUrl.searchParams.get('app2')\n\n\tconst usingDefaultApp1 = !app1Name\n\n\t// defaults to first problem app\n\tconst app1 = app1Name\n\t\t? await getAppByName(app1Name)\n\t\t: allAppsFull.filter(isExerciseStepApp).at(0)\n\n\t// defaults to last exercise step app\n\tconst app2 = app2Name\n\t\t? await getAppByName(app2Name)\n\t\t: allAppsFull.filter(isExerciseStepApp).at(-1)\n\n\tasync function getDiffProp() {\n\t\tif (!app1 || !app2) {\n\t\t\treturn {\n\t\t\t\tapp1: app1?.name,\n\t\t\t\tapp2: app2?.name,\n\t\t\t\tdiffCode: null,\n\t\t\t}\n\t\t}\n\t\tconst diffCode = await getDiffCode(app1, app2, {\n\t\t\t...cacheOptions,\n\t\t\tforceFresh: searchParams.get('forceFresh') === 'diff',\n\t\t}).catch((e) => {\n\t\t\tconsole.error(e)\n\t\t\treturn null\n\t\t})\n\t\treturn {\n\t\t\tapp1: app1.name,\n\t\t\tapp2: app2.name,\n\t\t\tdiffCode,\n\t\t}\n\t}\n\n\tconst allApps = allAppsFull\n\t\t.filter((a, i, ar) => ar.findIndex((b) => a.name === b.name) === i)\n\t\t.map((a) => ({\n\t\t\tdisplayName: getAppDisplayName(a, allAppsFull),\n\t\t\tname: a.name,\n\t\t\ttitle: a.title,\n\t\t\ttype: a.type,\n\t\t}))\n\n\tconst diff = getDiffProp()\n\tconst app1Index = allApps.findIndex((a) => a.name === app1?.name)\n\tconst prevApp1Index = usingDefaultApp1\n\t\t? allApps.length - 2\n\t\t: app1Index === 0\n\t\t\t? -2\n\t\t\t: app1Index - 1\n\tconst prevApp2Index = prevApp1Index + 1\n\tconst nextApp1Index = usingDefaultApp1\n\t\t? 0\n\t\t: app1Index + 1 < allApps.length\n\t\t\t? app1Index + 1\n\t\t\t: -2\n\tconst nextApp2Index = nextApp1Index + 1\n\tconst prevApp1 = allAppsFull[prevApp1Index]?.name\n\tconst prevApp2 = allAppsFull[prevApp2Index]?.name\n\tconst nextApp1 = allAppsFull[nextApp1Index]?.name\n\tconst nextApp2 = allAppsFull[nextApp2Index]?.name\n\tconst prevSearchParams = new URLSearchParams(reqUrl.searchParams)\n\tprevSearchParams.set('app1', prevApp1 ?? '')\n\tprevSearchParams.set('app2', prevApp2 ?? '')\n\tconst nextSearchParams = new URLSearchParams(reqUrl.searchParams)\n\tnextSearchParams.set('app1', nextApp1 ?? '')\n\tnextSearchParams.set('app2', nextApp2 ?? '')\n\treturn defer({\n\t\tallApps,\n\t\tdiff,\n\t\tprevLink:\n\t\t\tprevApp1 && prevApp2\n\t\t\t\t? { to: `/diff?${prevSearchParams}`, 'aria-label': 'Previous App' }\n\t\t\t\t: { to: '/diff' },\n\t\tnextLink:\n\t\t\tnextApp1 && nextApp2\n\t\t\t\t? { to: `/diff?${nextSearchParams}`, 'aria-label': 'Next App' }\n\t\t\t\t: { to: '/diff' },\n\t})\n}\n\nexport default function DiffViewer() {\n\tconst data = useLoaderData<typeof loader>()\n\tconst [params] = useSearchParams()\n\tconst paramsWithForcedRefresh = new URLSearchParams(params)\n\tparamsWithForcedRefresh.set('forceFresh', 'diff')\n\tconst navigation = useNavigation()\n\tconst isNavigating = useSpinDelay(navigation.state !== 'idle', {\n\t\tdelay: 200,\n\t\tminDuration: 200,\n\t})\n\n\treturn (\n\t\t<div\n\t\t\tclassName={cn('grid h-full grid-rows-[1fr,auto]', {\n\t\t\t\t'cursor-wait opacity-30': isNavigating,\n\t\t\t})}\n\t\t>\n\t\t\t<div className=\"overflow-y-auto\">\n\t\t\t\t<Diff diff={data.diff} allApps={data.allApps} />\n\t\t\t</div>\n\t\t\t<div className=\"flex h-16 items-center justify-end border-t\">\n\t\t\t\t<NavChevrons prev={data.prevLink} next={data.nextLink} />\n\t\t\t</div>\n\t\t</div>\n\t)\n}\n"],"names":["DiffViewer","data","useLoaderData","params","useSearchParams","URLSearchParams","set","navigation","useNavigation","isNavigating","useSpinDelay","state","delay","minDuration","jsxs","className","cn","children","jsx","Diff","diff","allApps","NavChevrons","prev","prevLink","next","nextLink"],"mappings":"qjBAyGA,SAAwBA,GAAa,CACpC,MAAMC,EAAOC,IACP,CAACC,CAAM,EAAIC,IACe,IAAIC,gBAAgBF,CAAM,EAClCG,IAAI,aAAc,MAAM,EAChD,MAAMC,EAAaC,IACbC,EAAeC,EAAA,aAAaH,EAAWI,QAAU,OAAQ,CAC9DC,MAAO,IACPC,YAAa,GACd,CAAC,EAGA,OAAAC,EAAAA,KAAC,MAAA,CACAC,UAAWC,EAAG,mCAAoC,CACjD,yBAA0BP,CAC3B,CAAC,EAEDQ,SAAA,CAACC,EAAA,IAAA,MAAA,CAAIH,UAAU,kBACdE,SAACC,EAAA,IAAAC,EAAA,CAAKC,KAAMnB,EAAKmB,KAAMC,QAASpB,EAAKoB,QAAS,CAC/C,CAAA,EACCH,EAAA,IAAA,MAAA,CAAIH,UAAU,8CACdE,SAACC,EAAA,IAAAI,EAAA,CAAYC,KAAMtB,EAAKuB,SAAUC,KAAMxB,EAAKyB,SAAU,CACxD,CAAA,CAAA,CAAA,CACD,CAEF"}
1
+ {"version":3,"file":"diff-CPrD1rHd.js","sources":["../../../app/routes/diff.tsx"],"sourcesContent":["import {\n\tgetAppByName,\n\tgetAppDisplayName,\n\tgetApps,\n\tisExerciseStepApp,\n} from '@epic-web/workshop-utils/apps.server'\nimport { makeTimings } from '@epic-web/workshop-utils/timing.server'\nimport { defer, type LoaderFunctionArgs } from '@remix-run/node'\nimport { useLoaderData, useNavigation, useSearchParams } from '@remix-run/react'\nimport { useSpinDelay } from 'spin-delay'\nimport { Diff } from '#app/components/diff.tsx'\nimport { NavChevrons } from '#app/components/nav-chevrons.tsx'\nimport { getDiffCode } from '#app/utils/diff.server.ts'\nimport { cn } from '#app/utils/misc.tsx'\n\nexport async function loader({ request }: LoaderFunctionArgs) {\n\tconst reqUrl = new URL(request.url)\n\tconst searchParams = reqUrl.searchParams\n\tconst timings = makeTimings('diffLoader')\n\tconst cacheOptions = { request, timings }\n\tconst allAppsFull = await getApps()\n\tconst app1Name = reqUrl.searchParams.get('app1')\n\tconst app2Name = reqUrl.searchParams.get('app2')\n\n\tconst usingDefaultApp1 = !app1Name\n\n\t// defaults to first problem app\n\tconst app1 = app1Name\n\t\t? await getAppByName(app1Name)\n\t\t: allAppsFull.filter(isExerciseStepApp).at(0)\n\n\t// defaults to last exercise step app\n\tconst app2 = app2Name\n\t\t? await getAppByName(app2Name)\n\t\t: allAppsFull.filter(isExerciseStepApp).at(-1)\n\n\tasync function getDiffProp() {\n\t\tif (!app1 || !app2) {\n\t\t\treturn {\n\t\t\t\tapp1: app1?.name,\n\t\t\t\tapp2: app2?.name,\n\t\t\t\tdiffCode: null,\n\t\t\t}\n\t\t}\n\t\tconst diffCode = await getDiffCode(app1, app2, {\n\t\t\t...cacheOptions,\n\t\t\tforceFresh: searchParams.get('forceFresh') === 'diff',\n\t\t}).catch((e) => {\n\t\t\tconsole.error(e)\n\t\t\treturn null\n\t\t})\n\t\treturn {\n\t\t\tapp1: app1.name,\n\t\t\tapp2: app2.name,\n\t\t\tdiffCode,\n\t\t}\n\t}\n\n\tconst allApps = allAppsFull\n\t\t.filter((a, i, ar) => ar.findIndex((b) => a.name === b.name) === i)\n\t\t.map((a) => ({\n\t\t\tdisplayName: getAppDisplayName(a, allAppsFull),\n\t\t\tname: a.name,\n\t\t\ttitle: a.title,\n\t\t\ttype: a.type,\n\t\t}))\n\n\tconst diff = getDiffProp()\n\tconst app1Index = allApps.findIndex((a) => a.name === app1?.name)\n\tconst prevApp1Index = usingDefaultApp1\n\t\t? allApps.length - 2\n\t\t: app1Index === 0\n\t\t\t? -2\n\t\t\t: app1Index - 1\n\tconst prevApp2Index = prevApp1Index + 1\n\tconst nextApp1Index = usingDefaultApp1\n\t\t? 0\n\t\t: app1Index + 1 < allApps.length\n\t\t\t? app1Index + 1\n\t\t\t: -2\n\tconst nextApp2Index = nextApp1Index + 1\n\tconst prevApp1 = allAppsFull[prevApp1Index]?.name\n\tconst prevApp2 = allAppsFull[prevApp2Index]?.name\n\tconst nextApp1 = allAppsFull[nextApp1Index]?.name\n\tconst nextApp2 = allAppsFull[nextApp2Index]?.name\n\tconst prevSearchParams = new URLSearchParams(reqUrl.searchParams)\n\tprevSearchParams.set('app1', prevApp1 ?? '')\n\tprevSearchParams.set('app2', prevApp2 ?? '')\n\tconst nextSearchParams = new URLSearchParams(reqUrl.searchParams)\n\tnextSearchParams.set('app1', nextApp1 ?? '')\n\tnextSearchParams.set('app2', nextApp2 ?? '')\n\treturn defer({\n\t\tallApps,\n\t\tdiff,\n\t\tprevLink:\n\t\t\tprevApp1 && prevApp2\n\t\t\t\t? { to: `/diff?${prevSearchParams}`, 'aria-label': 'Previous App' }\n\t\t\t\t: { to: '/diff' },\n\t\tnextLink:\n\t\t\tnextApp1 && nextApp2\n\t\t\t\t? { to: `/diff?${nextSearchParams}`, 'aria-label': 'Next App' }\n\t\t\t\t: { to: '/diff' },\n\t})\n}\n\nexport default function DiffViewer() {\n\tconst data = useLoaderData<typeof loader>()\n\tconst [params] = useSearchParams()\n\tconst paramsWithForcedRefresh = new URLSearchParams(params)\n\tparamsWithForcedRefresh.set('forceFresh', 'diff')\n\tconst navigation = useNavigation()\n\tconst isNavigating = useSpinDelay(navigation.state !== 'idle', {\n\t\tdelay: 200,\n\t\tminDuration: 200,\n\t})\n\n\treturn (\n\t\t<div\n\t\t\tclassName={cn('grid h-full grid-rows-[1fr,auto]', {\n\t\t\t\t'cursor-wait opacity-30': isNavigating,\n\t\t\t})}\n\t\t>\n\t\t\t<div className=\"overflow-y-auto\">\n\t\t\t\t<Diff diff={data.diff} allApps={data.allApps} />\n\t\t\t</div>\n\t\t\t<div className=\"flex h-16 items-center justify-end border-t\">\n\t\t\t\t<NavChevrons prev={data.prevLink} next={data.nextLink} />\n\t\t\t</div>\n\t\t</div>\n\t)\n}\n"],"names":["DiffViewer","data","useLoaderData","params","useSearchParams","URLSearchParams","set","navigation","useNavigation","isNavigating","useSpinDelay","state","delay","minDuration","jsxs","className","cn","children","jsx","Diff","diff","allApps","NavChevrons","prev","prevLink","next","nextLink"],"mappings":"qjBAyGA,SAAwBA,GAAa,CACpC,MAAMC,EAAOC,IACP,CAACC,CAAM,EAAIC,IACe,IAAIC,gBAAgBF,CAAM,EAClCG,IAAI,aAAc,MAAM,EAChD,MAAMC,EAAaC,IACbC,EAAeC,EAAA,aAAaH,EAAWI,QAAU,OAAQ,CAC9DC,MAAO,IACPC,YAAa,GACd,CAAC,EAGA,OAAAC,EAAAA,KAAC,MAAA,CACAC,UAAWC,EAAG,mCAAoC,CACjD,yBAA0BP,CAC3B,CAAC,EAEDQ,SAAA,CAACC,EAAA,IAAA,MAAA,CAAIH,UAAU,kBACdE,SAACC,EAAA,IAAAC,EAAA,CAAKC,KAAMnB,EAAKmB,KAAMC,QAASpB,EAAKoB,QAAS,CAC/C,CAAA,EACCH,EAAA,IAAA,MAAA,CAAIH,UAAU,8CACdE,SAACC,EAAA,IAAAI,EAAA,CAAYC,KAAMtB,EAAKuB,SAAUC,KAAMxB,EAAKyB,SAAU,CACxD,CAAA,CAAA,CAAA,CACD,CAEF"}
@@ -2984,5 +2984,5 @@ media-poster-image:not([src]):not([placeholdersrc]) {
2984
2984
  </media-controller>
2985
2985
  </template>
2986
2986
  `,zf=As.createElement("template");"innerHTML"in zf&&(zf.innerHTML=VM);var zg,Xg,JT=class extends go{};JT.template=(Xg=(zg=zf.content)==null?void 0:zg.children)==null?void 0:Xg[0];lt.customElements.get("media-theme-gerwig")||lt.customElements.define("media-theme-gerwig",JT);var qM="gerwig",qi={SRC:"src",POSTER:"poster"},$={STYLE:"style",DEFAULT_HIDDEN_CAPTIONS:"default-hidden-captions",PRIMARY_COLOR:"primary-color",SECONDARY_COLOR:"secondary-color",ACCENT_COLOR:"accent-color",FORWARD_SEEK_OFFSET:"forward-seek-offset",BACKWARD_SEEK_OFFSET:"backward-seek-offset",PLAYBACK_TOKEN:"playback-token",THUMBNAIL_TOKEN:"thumbnail-token",STORYBOARD_TOKEN:"storyboard-token",STORYBOARD_SRC:"storyboard-src",THUMBNAIL_TIME:"thumbnail-time",AUDIO:"audio",NOHOTKEYS:"nohotkeys",HOTKEYS:"hotkeys",PLAYBACK_RATES:"playbackrates",DEFAULT_SHOW_REMAINING_TIME:"default-show-remaining-time",DEFAULT_DURATION:"default-duration",TITLE:"title",PLACEHOLDER:"placeholder",THEME:"theme",DEFAULT_STREAM_TYPE:"default-stream-type",TARGET_LIVE_WINDOW:"target-live-window",EXTRA_SOURCE_PARAMS:"extra-source-params",NO_VOLUME_PREF:"no-volume-pref"},Xf=["audio","backwardseekoffset","defaultduration","defaultshowremainingtime","defaultsubtitles","noautoseektolive","disabled","exportparts","forwardseekoffset","hideduration","hotkeys","nohotkeys","playbackrates","defaultstreamtype","streamtype","style","targetlivewindow","template","title","novolumepref"];function YM(i,e){var t;return{src:!i.playbackId&&i.src,playbackId:i.playbackId,hasSrc:!!i.playbackId||!!i.src,poster:i.poster,storyboard:i.storyboard,storyboardSrc:i.getAttribute($.STORYBOARD_SRC),placeholder:i.getAttribute("placeholder"),themeTemplate:jM(i),thumbnailTime:!i.tokens.thumbnail&&i.thumbnailTime,autoplay:i.autoplay,crossOrigin:i.crossOrigin,loop:i.loop,noHotKeys:i.hasAttribute($.NOHOTKEYS),hotKeys:i.getAttribute($.HOTKEYS),muted:i.muted,paused:i.paused,preload:i.preload,envKey:i.envKey,preferCmcd:i.preferCmcd,debug:i.debug,disableTracking:i.disableTracking,disableCookies:i.disableCookies,tokens:i.tokens,beaconCollectionDomain:i.beaconCollectionDomain,maxResolution:i.maxResolution,minResolution:i.minResolution,programStartTime:i.programStartTime,programEndTime:i.programEndTime,renditionOrder:i.renditionOrder,metadata:i.metadata,playerSoftwareName:i.playerSoftwareName,playerSoftwareVersion:i.playerSoftwareVersion,startTime:i.startTime,preferPlayback:i.preferPlayback,audio:i.audio,defaultStreamType:i.defaultStreamType,targetLiveWindow:i.getAttribute(P.TARGET_LIVE_WINDOW),streamType:_p(i.getAttribute(P.STREAM_TYPE)),primaryColor:i.getAttribute($.PRIMARY_COLOR),secondaryColor:i.getAttribute($.SECONDARY_COLOR),accentColor:i.getAttribute($.ACCENT_COLOR),forwardSeekOffset:i.forwardSeekOffset,backwardSeekOffset:i.backwardSeekOffset,defaultHiddenCaptions:i.defaultHiddenCaptions,defaultDuration:i.defaultDuration,defaultShowRemainingTime:i.defaultShowRemainingTime,hideDuration:zM(i),playbackRates:i.getAttribute($.PLAYBACK_RATES),customDomain:(t=i.getAttribute(P.CUSTOM_DOMAIN))!=null?t:void 0,title:i.getAttribute($.TITLE),novolumepref:i.hasAttribute($.NO_VOLUME_PREF),...e,extraSourceParams:i.extraSourceParams}}function jM(i){var e,t;let s=i.theme;if(s){let r=(t=(e=i.getRootNode())==null?void 0:e.getElementById)==null?void 0:t.call(e,s);if(r&&r instanceof HTMLTemplateElement)return r;s.startsWith("media-theme-")||(s=`media-theme-${s}`);let n=lt.customElements.get(s);if(n!=null&&n.template)return n.template}}function zM(i){var e;let t=(e=i.mediaController)==null?void 0:e.querySelector("media-time-display");return t&&getComputedStyle(t).getPropertyValue("--media-duration-display-display").trim()==="none"}function Qg(i){let e=i.hasAttribute($.TITLE)?{video_title:i.getAttribute($.TITLE)}:{};return i.getAttributeNames().filter(t=>t.startsWith("metadata-")).reduce((t,s)=>{let r=i.getAttribute(s);return r!==null&&(t[s.replace(/^metadata-/,"").replace(/-/g,"_")]=r),t},e)}var XM=Object.values(P),QM=Object.values(qi),ZM=Object.values($),JM=WT(),e2="mux-player",Zg={dialog:void 0,isDialogOpen:!1},t2={redundant_streams:!0},Rd,wd,Js,Cd,In,Yi,fs,Qf,e_,Ac,Zf,tr,hn,Jf,Jg,em,ev,tm,tv,im,iv,sv=class extends Vg{constructor(){super(),ht(this,Yi),ht(this,Qf),ht(this,Ac),ht(this,tr),ht(this,Jf),ht(this,em),ht(this,tm),ht(this,im),ht(this,Rd,!1),ht(this,wd,{}),ht(this,Js,!0),ht(this,Cd,new TM(this,"hotkeys")),ht(this,In,{...Zg,onCloseErrorDialog:()=>ze(this,Ac,Zf).call(this,{dialog:void 0,isDialogOpen:!1}),onInitFocusDialog:e=>{GT(this,As.activeElement)||e.preventDefault()}}),this.attachShadow({mode:"open"}),ze(this,Qf,e_).call(this),this.isConnected&&ze(this,Yi,fs).call(this)}static get observedAttributes(){var e;return[...(e=Vg.observedAttributes)!=null?e:[],...QM,...XM,...ZM]}get mediaTheme(){var e;return(e=this.shadowRoot)==null?void 0:e.querySelector("media-theme")}get mediaController(){var e,t;return(t=(e=this.mediaTheme)==null?void 0:e.shadowRoot)==null?void 0:t.querySelector("media-controller")}connectedCallback(){var e;let t=(e=this.shadowRoot)==null?void 0:e.querySelector("mux-video");t&&(t.metadata=Qg(this))}attributeChangedCallback(e,t,s){switch(ze(this,Yi,fs).call(this),super.attributeChangedCallback(e,t,s),e){case $.HOTKEYS:Te(this,Cd).value=s;break;case $.THUMBNAIL_TIME:{s!=null&&this.tokens.thumbnail&&cr(fe("Use of thumbnail-time with thumbnail-token is currently unsupported. Ignore thumbnail-time.").format({}));break}case $.THUMBNAIL_TOKEN:{let{aud:r}=lo(s);s&&r!=="t"&&cr(fe("The provided thumbnail-token should have audience value 't' instead of '{aud}'.").format({aud:r}));break}case $.STORYBOARD_TOKEN:{let{aud:r}=lo(s);s&&r!=="s"&&cr(fe("The provided storyboard-token should have audience value 's' instead of '{aud}'.").format({aud:r}));break}case P.PLAYBACK_ID:{s!=null&&s.includes("?token")&&ri(fe("The specificed playback ID {playbackId} contains a token which must be provided via the playback-token attribute.").format({playbackId:s}));break}case P.STREAM_TYPE:s&&![_e.LIVE,_e.ON_DEMAND,_e.UNKNOWN].includes(s)?["ll-live","live:dvr","ll-live:dvr"].includes(this.streamType)?this.targetLiveWindow=s.includes("dvr")?Number.POSITIVE_INFINITY:0:VT({file:"invalid-stream-type.md",message:fe("Invalid stream-type value supplied: `{streamType}`. Please provide stream-type as either: `on-demand` or `live`").format({streamType:this.streamType})}):s===_e.LIVE?this.getAttribute($.TARGET_LIVE_WINDOW)==null&&(this.targetLiveWindow=0):this.targetLiveWindow=Number.NaN}[P.PLAYBACK_ID,qi.SRC,$.PLAYBACK_TOKEN].includes(e)&&t!==s&&Zi(this,In,{...Te(this,In),...Zg}),ze(this,tr,hn).call(this,{[yM(e)]:s})}get preferCmcd(){var e;return(e=this.getAttribute(P.PREFER_CMCD))!=null?e:void 0}set preferCmcd(e){e!==this.preferCmcd&&(e?jd.includes(e)?this.setAttribute(P.PREFER_CMCD,e):cr(`Invalid value for preferCmcd. Must be one of ${jd.join()}`):this.removeAttribute(P.PREFER_CMCD))}get hasPlayed(){var e,t;return(t=(e=this.mediaController)==null?void 0:e.hasAttribute(T.MEDIA_HAS_PLAYED))!=null?t:!1}get inLiveWindow(){var e;return(e=this.mediaController)==null?void 0:e.hasAttribute(T.MEDIA_TIME_IS_LIVE)}get _hls(){var e;return(e=this.media)==null?void 0:e._hls}get mux(){var e;return(e=this.media)==null?void 0:e.mux}get theme(){var e;return(e=this.getAttribute($.THEME))!=null?e:qM}set theme(e){this.setAttribute($.THEME,`${e}`)}get themeProps(){let e=this.mediaTheme;if(!e)return;let t={};for(let s of e.getAttributeNames()){if(Xf.includes(s))continue;let r=e.getAttribute(s);t[$T(s)]=r===""?!0:r}return t}set themeProps(e){var t,s;ze(this,Yi,fs).call(this);let r={...this.themeProps,...e};for(let n in r){if(Xf.includes(n))continue;let a=e==null?void 0:e[n];typeof a=="boolean"||a==null?(t=this.mediaTheme)==null||t.toggleAttribute(qf(n),!!a):(s=this.mediaTheme)==null||s.setAttribute(qf(n),a)}}get playbackId(){var e;return(e=this.getAttribute(P.PLAYBACK_ID))!=null?e:void 0}set playbackId(e){e?this.setAttribute(P.PLAYBACK_ID,e):this.removeAttribute(P.PLAYBACK_ID)}get src(){var e,t;return this.playbackId?(e=Ds(this,qi.SRC))!=null?e:void 0:(t=this.getAttribute(qi.SRC))!=null?t:void 0}set src(e){e?this.setAttribute(qi.SRC,e):this.removeAttribute(qi.SRC)}get poster(){var e;let t=this.getAttribute(qi.POSTER);if(t!=null)return t;if(this.playbackId&&!this.audio)return vM(this.playbackId,{customDomain:this.customDomain,thumbnailTime:(e=this.thumbnailTime)!=null?e:this.startTime,programTime:this.programStartTime,token:this.tokens.thumbnail})}set poster(e){e||e===""?this.setAttribute(qi.POSTER,e):this.removeAttribute(qi.POSTER)}get storyboardSrc(){var e;return(e=this.getAttribute($.STORYBOARD_SRC))!=null?e:void 0}set storyboardSrc(e){e?this.setAttribute($.STORYBOARD_SRC,e):this.removeAttribute($.STORYBOARD_SRC)}get storyboard(){if(this.storyboardSrc&&!this.tokens.storyboard)return this.storyboardSrc;if(!(this.audio||!this.playbackId||!this.streamType||[_e.LIVE,_e.UNKNOWN].includes(this.streamType)))return EM(this.playbackId,{customDomain:this.customDomain,token:this.tokens.storyboard,programStartTime:this.programStartTime,programEndTime:this.programEndTime})}get audio(){return this.hasAttribute($.AUDIO)}set audio(e){if(!e){this.removeAttribute($.AUDIO);return}this.setAttribute($.AUDIO,"")}get hotkeys(){return Te(this,Cd)}get nohotkeys(){return this.hasAttribute($.NOHOTKEYS)}set nohotkeys(e){if(!e){this.removeAttribute($.NOHOTKEYS);return}this.setAttribute($.NOHOTKEYS,"")}get thumbnailTime(){return xi(this.getAttribute($.THUMBNAIL_TIME))}set thumbnailTime(e){this.setAttribute($.THUMBNAIL_TIME,`${e}`)}get title(){var e;return(e=this.getAttribute($.TITLE))!=null?e:""}set title(e){e!==this.title&&(e?this.setAttribute($.TITLE,e):this.removeAttribute("title"),super.title=e)}get placeholder(){var e;return(e=Ds(this,$.PLACEHOLDER))!=null?e:""}set placeholder(e){this.setAttribute($.PLACEHOLDER,`${e}`)}get primaryColor(){var e,t;let s=this.getAttribute($.PRIMARY_COLOR);if(s!=null||this.mediaTheme&&(s=(t=(e=lt.getComputedStyle(this.mediaTheme))==null?void 0:e.getPropertyValue("--_primary-color"))==null?void 0:t.trim(),s))return s}set primaryColor(e){this.setAttribute($.PRIMARY_COLOR,`${e}`)}get secondaryColor(){var e,t;let s=this.getAttribute($.SECONDARY_COLOR);if(s!=null||this.mediaTheme&&(s=(t=(e=lt.getComputedStyle(this.mediaTheme))==null?void 0:e.getPropertyValue("--_secondary-color"))==null?void 0:t.trim(),s))return s}set secondaryColor(e){this.setAttribute($.SECONDARY_COLOR,`${e}`)}get accentColor(){var e,t;let s=this.getAttribute($.ACCENT_COLOR);if(s!=null||this.mediaTheme&&(s=(t=(e=lt.getComputedStyle(this.mediaTheme))==null?void 0:e.getPropertyValue("--_accent-color"))==null?void 0:t.trim(),s))return s}set accentColor(e){this.setAttribute($.ACCENT_COLOR,`${e}`)}get defaultShowRemainingTime(){return this.hasAttribute($.DEFAULT_SHOW_REMAINING_TIME)}set defaultShowRemainingTime(e){e?this.setAttribute($.DEFAULT_SHOW_REMAINING_TIME,""):this.removeAttribute($.DEFAULT_SHOW_REMAINING_TIME)}get playbackRates(){if(this.hasAttribute($.PLAYBACK_RATES))return this.getAttribute($.PLAYBACK_RATES).trim().split(/\s*,?\s+/).map(e=>Number(e)).filter(e=>!Number.isNaN(e)).sort((e,t)=>e-t)}set playbackRates(e){if(!e){this.removeAttribute($.PLAYBACK_RATES);return}this.setAttribute($.PLAYBACK_RATES,e.join(" "))}get forwardSeekOffset(){var e;return(e=xi(this.getAttribute($.FORWARD_SEEK_OFFSET)))!=null?e:10}set forwardSeekOffset(e){this.setAttribute($.FORWARD_SEEK_OFFSET,`${e}`)}get backwardSeekOffset(){var e;return(e=xi(this.getAttribute($.BACKWARD_SEEK_OFFSET)))!=null?e:10}set backwardSeekOffset(e){this.setAttribute($.BACKWARD_SEEK_OFFSET,`${e}`)}get defaultHiddenCaptions(){return this.hasAttribute($.DEFAULT_HIDDEN_CAPTIONS)}set defaultHiddenCaptions(e){e?this.setAttribute($.DEFAULT_HIDDEN_CAPTIONS,""):this.removeAttribute($.DEFAULT_HIDDEN_CAPTIONS)}get defaultDuration(){return xi(this.getAttribute($.DEFAULT_DURATION))}set defaultDuration(e){e==null?this.removeAttribute($.DEFAULT_DURATION):this.setAttribute($.DEFAULT_DURATION,`${e}`)}get playerSoftwareName(){var e;return(e=this.getAttribute(P.PLAYER_SOFTWARE_NAME))!=null?e:e2}get playerSoftwareVersion(){var e;return(e=this.getAttribute(P.PLAYER_SOFTWARE_VERSION))!=null?e:JM}get beaconCollectionDomain(){var e;return(e=this.getAttribute(P.BEACON_COLLECTION_DOMAIN))!=null?e:void 0}set beaconCollectionDomain(e){e!==this.beaconCollectionDomain&&(e?this.setAttribute(P.BEACON_COLLECTION_DOMAIN,e):this.removeAttribute(P.BEACON_COLLECTION_DOMAIN))}get maxResolution(){var e;return(e=this.getAttribute(P.MAX_RESOLUTION))!=null?e:void 0}set maxResolution(e){e!==this.maxResolution&&(e?this.setAttribute(P.MAX_RESOLUTION,e):this.removeAttribute(P.MAX_RESOLUTION))}get minResolution(){var e;return(e=this.getAttribute(P.MIN_RESOLUTION))!=null?e:void 0}set minResolution(e){e!==this.minResolution&&(e?this.setAttribute(P.MIN_RESOLUTION,e):this.removeAttribute(P.MIN_RESOLUTION))}get renditionOrder(){var e;return(e=this.getAttribute(P.RENDITION_ORDER))!=null?e:void 0}set renditionOrder(e){e!==this.renditionOrder&&(e?this.setAttribute(P.RENDITION_ORDER,e):this.removeAttribute(P.RENDITION_ORDER))}get programStartTime(){return xi(this.getAttribute(P.PROGRAM_START_TIME))}set programStartTime(e){e==null?this.removeAttribute(P.PROGRAM_START_TIME):this.setAttribute(P.PROGRAM_START_TIME,`${e}`)}get programEndTime(){return xi(this.getAttribute(P.PROGRAM_END_TIME))}set programEndTime(e){e==null?this.removeAttribute(P.PROGRAM_END_TIME):this.setAttribute(P.PROGRAM_END_TIME,`${e}`)}get extraSourceParams(){return this.hasAttribute($.EXTRA_SOURCE_PARAMS)?[...new URLSearchParams(this.getAttribute($.EXTRA_SOURCE_PARAMS)).entries()].reduce((e,[t,s])=>(e[t]=s,e),{}):t2}set extraSourceParams(e){e==null?this.removeAttribute($.EXTRA_SOURCE_PARAMS):this.setAttribute($.EXTRA_SOURCE_PARAMS,new URLSearchParams(e).toString())}get customDomain(){var e;return(e=this.getAttribute(P.CUSTOM_DOMAIN))!=null?e:void 0}set customDomain(e){e!==this.customDomain&&(e?this.setAttribute(P.CUSTOM_DOMAIN,e):this.removeAttribute(P.CUSTOM_DOMAIN))}get envKey(){var e;return(e=Ds(this,P.ENV_KEY))!=null?e:void 0}set envKey(e){this.setAttribute(P.ENV_KEY,`${e}`)}get noVolumePref(){return this.hasAttribute($.NO_VOLUME_PREF)}set noVolumePref(e){e?this.setAttribute($.NO_VOLUME_PREF,""):this.removeAttribute($.NO_VOLUME_PREF)}get debug(){return Ds(this,P.DEBUG)!=null}set debug(e){e?this.setAttribute(P.DEBUG,""):this.removeAttribute(P.DEBUG)}get disableTracking(){return Ds(this,P.DISABLE_TRACKING)!=null}set disableTracking(e){this.toggleAttribute(P.DISABLE_TRACKING,!!e)}get disableCookies(){return Ds(this,P.DISABLE_COOKIES)!=null}set disableCookies(e){e?this.setAttribute(P.DISABLE_COOKIES,""):this.removeAttribute(P.DISABLE_COOKIES)}get streamType(){var e,t,s;return(s=(t=this.getAttribute(P.STREAM_TYPE))!=null?t:(e=this.media)==null?void 0:e.streamType)!=null?s:_e.UNKNOWN}set streamType(e){this.setAttribute(P.STREAM_TYPE,`${e}`)}get defaultStreamType(){var e,t,s;return(s=(t=this.getAttribute($.DEFAULT_STREAM_TYPE))!=null?t:(e=this.mediaController)==null?void 0:e.getAttribute($.DEFAULT_STREAM_TYPE))!=null?s:_e.ON_DEMAND}set defaultStreamType(e){e?this.setAttribute($.DEFAULT_STREAM_TYPE,e):this.removeAttribute($.DEFAULT_STREAM_TYPE)}get targetLiveWindow(){var e,t;return this.hasAttribute($.TARGET_LIVE_WINDOW)?+this.getAttribute($.TARGET_LIVE_WINDOW):(t=(e=this.media)==null?void 0:e.targetLiveWindow)!=null?t:Number.NaN}set targetLiveWindow(e){e==this.targetLiveWindow||Number.isNaN(e)&&Number.isNaN(this.targetLiveWindow)||(e==null?this.removeAttribute($.TARGET_LIVE_WINDOW):this.setAttribute($.TARGET_LIVE_WINDOW,`${+e}`))}get liveEdgeStart(){var e;return(e=this.media)==null?void 0:e.liveEdgeStart}get startTime(){return xi(Ds(this,P.START_TIME))}set startTime(e){this.setAttribute(P.START_TIME,`${e}`)}get preferPlayback(){let e=this.getAttribute(P.PREFER_PLAYBACK);if(e===Ci.MSE||e===Ci.NATIVE)return e}set preferPlayback(e){e!==this.preferPlayback&&(e===Ci.MSE||e===Ci.NATIVE?this.setAttribute(P.PREFER_PLAYBACK,e):this.removeAttribute(P.PREFER_PLAYBACK))}get metadata(){var e;return(e=this.media)==null?void 0:e.metadata}set metadata(e){if(ze(this,Yi,fs).call(this),!this.media){ri("underlying media element missing when trying to set metadata. metadata will not be set.");return}this.media.metadata={...Qg(this),...e}}get _hlsConfig(){var e;return(e=this.media)==null?void 0:e._hlsConfig}set _hlsConfig(e){if(ze(this,Yi,fs).call(this),!this.media){ri("underlying media element missing when trying to set _hlsConfig. _hlsConfig will not be set.");return}this.media._hlsConfig=e}async addCuePoints(e){var t;if(ze(this,Yi,fs).call(this),!this.media){ri("underlying media element missing when trying to addCuePoints. cuePoints will not be added.");return}return(t=this.media)==null?void 0:t.addCuePoints(e)}get activeCuePoint(){var e;return(e=this.media)==null?void 0:e.activeCuePoint}get cuePoints(){var e,t;return(t=(e=this.media)==null?void 0:e.cuePoints)!=null?t:[]}addChapters(e){var t;if(ze(this,Yi,fs).call(this),!this.media){ri("underlying media element missing when trying to addChapters. chapters will not be added.");return}return(t=this.media)==null?void 0:t.addChapters(e)}get activeChapter(){var e;return(e=this.media)==null?void 0:e.activeChapter}get chapters(){var e,t;return(t=(e=this.media)==null?void 0:e.chapters)!=null?t:[]}getStartDate(){var e;return(e=this.media)==null?void 0:e.getStartDate()}get currentPdt(){var e;return(e=this.media)==null?void 0:e.currentPdt}get tokens(){let e=this.getAttribute($.PLAYBACK_TOKEN),t=this.getAttribute($.THUMBNAIL_TOKEN),s=this.getAttribute($.STORYBOARD_TOKEN);return{...Te(this,wd),...e!=null?{playback:e}:{},...t!=null?{thumbnail:t}:{},...s!=null?{storyboard:s}:{}}}set tokens(e){Zi(this,wd,e??{})}get playbackToken(){var e;return(e=this.getAttribute($.PLAYBACK_TOKEN))!=null?e:void 0}set playbackToken(e){this.setAttribute($.PLAYBACK_TOKEN,`${e}`)}get thumbnailToken(){var e;return(e=this.getAttribute($.THUMBNAIL_TOKEN))!=null?e:void 0}set thumbnailToken(e){this.setAttribute($.THUMBNAIL_TOKEN,`${e}`)}get storyboardToken(){var e;return(e=this.getAttribute($.STORYBOARD_TOKEN))!=null?e:void 0}set storyboardToken(e){this.setAttribute($.STORYBOARD_TOKEN,`${e}`)}addTextTrack(e,t,s,r){var n;let a=(n=this.media)==null?void 0:n.nativeEl;if(a)return Lm(a,e,t,s,r)}removeTextTrack(e){var t;let s=(t=this.media)==null?void 0:t.nativeEl;if(s)return lI(s,e)}get textTracks(){var e;return(e=this.media)==null?void 0:e.textTracks}};Rd=new WeakMap,wd=new WeakMap,Js=new WeakMap,Cd=new WeakMap,In=new WeakMap,Yi=new WeakSet,fs=function(){var i,e,t;if(!Te(this,Rd)){Zi(this,Rd,!0),ze(this,tr,hn).call(this);try{if(customElements.upgrade(this.mediaTheme),!(this.mediaTheme instanceof lt.HTMLElement))throw""}catch{ri("<media-theme> failed to upgrade!")}try{if(customElements.upgrade(this.media),!(this.media instanceof VD))throw""}catch{ri("<mux-video> failed to upgrade!")}try{if(customElements.upgrade(this.mediaController),!(this.mediaController instanceof MR))throw""}catch{ri("<media-controller> failed to upgrade!")}xM(this),ze(this,Jf,Jg).call(this),ze(this,em,ev).call(this),ze(this,tm,tv).call(this),Zi(this,Js,(e=(i=this.mediaController)==null?void 0:i.hasAttribute(ge.USER_INACTIVE))!=null?e:!0),ze(this,im,iv).call(this),(t=this.media)==null||t.addEventListener("streamtypechange",()=>{ze(this,tr,hn).call(this)})}},Qf=new WeakSet,e_=function(){var i,e;try{(i=window==null?void 0:window.CSS)==null||i.registerProperty({name:"--media-primary-color",syntax:"<color>",inherits:!0}),(e=window==null?void 0:window.CSS)==null||e.registerProperty({name:"--media-secondary-color",syntax:"<color>",inherits:!0})}catch{}},Ac=new WeakSet,Zf=function(i){Object.assign(Te(this,In),i),ze(this,tr,hn).call(this)},tr=new WeakSet,hn=function(i={}){$M(BM(YM(this,{...Te(this,In),...i})),this.shadowRoot)},Jf=new WeakSet,Jg=function(){let i=e=>{var t,s;if(!(e!=null&&e.startsWith("theme-")))return;let r=e.replace(/^theme-/,"");if(Xf.includes(r))return;let n=this.getAttribute(e);n!=null?(t=this.mediaTheme)==null||t.setAttribute(r,n):(s=this.mediaTheme)==null||s.removeAttribute(r)};new MutationObserver(e=>{for(let{attributeName:t}of e)i(t)}).observe(this,{attributes:!0}),this.getAttributeNames().forEach(i)},em=new WeakSet,ev=function(){var i;let e=t=>{let{detail:s}=t;if(s instanceof Ct||(s=new Ct(s.message,s.code,s.fatal)),!(s!=null&&s.fatal)){cr(s),s.data&&cr(`${s.name} data:`,s.data);return}let{dialog:r,devlog:n}=jf(s,!window.navigator.onLine,this.playbackId,this.playbackToken);n.message&&VT(n),ri(s),s.data&&ri(`${s.name} data:`,s.data),ze(this,Ac,Zf).call(this,{isDialogOpen:!0,dialog:r})};this.addEventListener("error",e),this.media&&(this.media.errorTranslator=(t={})=>{var s,r,n;if(!(((s=this.media)==null?void 0:s.error)instanceof Ct))return t;let{devlog:a}=jf((r=this.media)==null?void 0:r.error,!window.navigator.onLine,this.playbackId,this.playbackToken,!1);return{player_error_code:(n=this.media)==null?void 0:n.error.code,player_error_message:a.message?String(a.message):t.player_error_message,player_error_context:a.context?String(a.context):t.player_error_context}}),(i=this.media)==null||i.addEventListener("error",t=>{var s,r;let{detail:n}=t;if(!n){let{message:a,code:o}=(r=(s=this.media)==null?void 0:s.error)!=null?r:{};n=new Ct(a,o)}n!=null&&n.fatal&&this.dispatchEvent(new CustomEvent("error",{detail:n}))})},tm=new WeakSet,tv=function(){var i,e,t,s;let r=()=>ze(this,tr,hn).call(this);(e=(i=this.media)==null?void 0:i.textTracks)==null||e.addEventListener("addtrack",r),(s=(t=this.media)==null?void 0:t.textTracks)==null||s.addEventListener("removetrack",r)},im=new WeakSet,iv=function(){var i,e;if(!/Firefox/i.test(navigator.userAgent))return;let t,s=new WeakMap,r=()=>this.streamType===_e.LIVE&&!this.secondaryColor&&this.offsetWidth>=800,n=(l,d,c=!1)=>{r()||Array.from(l&&l.activeCues||[]).forEach(u=>{if(!(!u.snapToLines||u.line<-5||u.line>=0&&u.line<10))if(!d||this.paused){let h=u.text.split(`
2987
- `).length,f=-3;this.streamType===_e.LIVE&&(f=-2);let m=f-h;if(u.line===m&&!c)return;s.has(u)||s.set(u,u.line),u.line=m}else setTimeout(()=>{u.line=s.get(u)||"auto"},500)})},a=()=>{var l,d;n(t,(d=(l=this.mediaController)==null?void 0:l.hasAttribute(ge.USER_INACTIVE))!=null?d:!1)},o=()=>{var l,d;let c=Array.from(((d=(l=this.mediaController)==null?void 0:l.media)==null?void 0:d.textTracks)||[]).filter(u=>["subtitles","captions"].includes(u.kind)&&u.mode==="showing")[0];c!==t&&(t==null||t.removeEventListener("cuechange",a)),t=c,t==null||t.addEventListener("cuechange",a),n(t,Te(this,Js))};o(),(i=this.textTracks)==null||i.addEventListener("change",o),(e=this.textTracks)==null||e.addEventListener("addtrack",o),this.addEventListener("userinactivechange",()=>{var l,d;let c=(d=(l=this.mediaController)==null?void 0:l.hasAttribute(ge.USER_INACTIVE))!=null?d:!0;Te(this,Js)!==c&&(Zi(this,Js,c),n(t,Te(this,Js)))})};function Ds(i,e){return i.media?i.media.getAttribute(e):i.getAttribute(e)}lt.customElements.get("mux-player")||(lt.customElements.define("mux-player",sv),lt.MuxPlayerElement=sv);var rv={className:"class",classname:"class",htmlFor:"for",crossOrigin:"crossorigin",viewBox:"viewBox",playsInline:"playsinline",autoPlay:"autoplay",playbackRate:"playbackrate"},i2=i=>i==null,s2=(i,e)=>i2(e)?!1:i in e,r2=i=>i.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`),n2=(i,e)=>{if(!(typeof e=="boolean"&&!e)){if(s2(i,rv))return rv[i];if(typeof e!=null)return/[A-Z]/.test(i)?r2(i):i}},a2=(i,e)=>typeof i=="boolean"?"":i,o2=(i={})=>Object.entries(i).reduce((e,[t,s])=>{let r=n2(t,s);if(!r)return e;let n=a2(s);return e[r]=n,e},{}),l2=(...i)=>{let e=pt.useRef(null);return pt.useEffect(()=>{i.forEach(t=>{t&&(typeof t=="function"?t(e.current):t.current=e.current)})},[i]),e},d2=Object.prototype.hasOwnProperty,c2=(i,e)=>{if(Object.is(i,e))return!0;if(typeof i!="object"||i===null||typeof e!="object"||e===null)return!1;if(Array.isArray(i))return!Array.isArray(e)||i.length!==e.length?!1:i.some((r,n)=>e[n]===r);let t=Object.keys(i),s=Object.keys(e);if(t.length!==s.length)return!1;for(let r=0;r<t.length;r++)if(!d2.call(e,t[r])||!Object.is(i[t[r]],e[t[r]]))return!1;return!0},t_=(i,e,t)=>!c2(e,i[t]),u2=(i,e,t)=>{i[t]=e},h2=(i,e,t,s=u2,r=t_)=>pt.useEffect(()=>{let n=t==null?void 0:t.current;n&&r(n,e,i)&&s(n,e,i)},[t==null?void 0:t.current,e]),Wi=h2,f2=()=>{try{return"2.7.0"}catch{}return"UNKNOWN"},m2=f2(),p2=()=>m2,g2=Dd.forwardRef(({children:i,...e},t)=>Dd.createElement("mux-player",o2({...e,ref:t}),i)),ke=(i,e,t)=>pt.useEffect(()=>{let s=e==null?void 0:e.current;if(!(!s||!t))return s.addEventListener(i,t),()=>{s.removeEventListener(i,t)}},[e==null?void 0:e.current,t]),v2=(i,e)=>{let{onAbort:t,onCanPlay:s,onCanPlayThrough:r,onEmptied:n,onLoadStart:a,onLoadedData:o,onLoadedMetadata:l,onProgress:d,onDurationChange:c,onVolumeChange:u,onRateChange:h,onResize:f,onWaiting:m,onPlay:p,onPlaying:g,onTimeUpdate:v,onPause:y,onSeeking:b,onSeeked:x,onStalled:_,onSuspend:S,onEnded:A,onError:D,onCuePointChange:O,onCuePointsChange:L,onChapterChange:C,metadata:H,tokens:U,paused:Q,playbackId:q,playbackRates:Y,currentTime:oe,themeProps:ae,extraSourceParams:G,_hlsConfig:F,...re}=e;return Wi("playbackRates",Y,i),Wi("metadata",H,i),Wi("extraSourceParams",G,i),Wi("_hlsConfig",F,i),Wi("themeProps",ae,i),Wi("tokens",U,i),Wi("playbackId",q,i),Wi("paused",Q,i,(J,de)=>{de!=null&&(de?J.pause():J.play())},(J,de,Ae)=>J.hasAttribute("autoplay")&&!J.hasPlayed?!1:t_(J,de,Ae)),Wi("currentTime",oe,i,(J,de)=>{de!=null&&(J.currentTime=de)}),ke("abort",i,t),ke("canplay",i,s),ke("canplaythrough",i,r),ke("emptied",i,n),ke("loadstart",i,a),ke("loadeddata",i,o),ke("loadedmetadata",i,l),ke("progress",i,d),ke("durationchange",i,c),ke("volumechange",i,u),ke("ratechange",i,h),ke("resize",i,f),ke("waiting",i,m),ke("play",i,p),ke("playing",i,g),ke("timeupdate",i,v),ke("pause",i,y),ke("seeking",i,b),ke("seeked",i,x),ke("stalled",i,_),ke("suspend",i,S),ke("ended",i,A),ke("error",i,D),ke("cuepointchange",i,O),ke("cuepointschange",i,L),ke("chapterchange",i,C),[re]},E2=p2(),b2="mux-player-react",y2=Dd.forwardRef((i,e)=>{let t=pt.useRef(null),s=l2(t,e),[r]=v2(t,i);return Dd.createElement(g2,{ref:s,playerSoftwareName:b2,playerSoftwareVersion:E2,...r})}),T2=y2;const _2=Gc.object({time:Gc.number(),expiresAt:Gc.string()}).transform(i=>({time:Number(i.time),expiresAt:new Date(i.expiresAt)}));function A2(){var e;const i=v_("root");return((e=i==null?void 0:i.preferences)==null?void 0:e.player)??null}const S2=["input","select","button","textarea","mux-player","summary"];function nv(i){const e=pt.useRef(i);return pt.useEffect(()=>{e.current=i},[i]),e}function x2({muxPlayerRef:i,...e}){const t=A2(),s=g_(),[r,n]=pt.useState(!1),a=`${e.playbackId}:currentTime`,[o,l]=pt.useState(0),d=nv(s),c=nv(t);pt.useEffect(()=>{if(typeof document>"u")return;const h=sessionStorage.getItem(a);if(h)try{const{time:f,expiresAt:m}=_2.parse(JSON.parse(h));if(m.getTime()<Date.now())throw new Error("Time expired");l(f)}catch{sessionStorage.removeItem(a)}},[a]),pt.useEffect(()=>{function h(f){if(!i.current)return;const m=document.activeElement,p=m instanceof HTMLElement?m.contentEditable==="true":!1;m&&!S2.includes(m.tagName.toLowerCase())&&!p&&(f.key===" "&&(f.preventDefault(),i.current.paused?i.current.play():i.current.pause()),f.key==="ArrowRight"&&(f.preventDefault(),i.current.currentTime=i.current.currentTime+(i.current.forwardSeekOffset||10)),f.key==="ArrowLeft"&&(f.preventDefault(),i.current.currentTime=i.current.currentTime-(i.current.forwardSeekOffset||10)),f.key==="f"&&!f.metaKey&&!f.ctrlKey&&(f.preventDefault(),document.fullscreenElement?document.exitFullscreen():i.current.requestFullscreen()))}return window.document.addEventListener("keydown",h),()=>{window.document.removeEventListener("keydown",h)}},[i]);const u=f_(()=>{const h=i.current;if(!h)return;const f=Array.from(h.textTracks??[]).find(p=>p.kind==="subtitles"),m={playbackRate:h.playbackRate,volumeRate:h.volume,subtitle:f?{id:f.id,mode:f.mode}:{id:null,mode:"disabled"}};sm(m,c.current)||d.current.submit(m,{method:"POST",action:"/video-player",encType:"application/json"})},300);return pt.useEffect(()=>{var m,p;if(!r)return;const h=(m=i.current)==null?void 0:m.textTracks;if(!h)return;const f=(p=c.current)==null?void 0:p.subtitle;if(f!=null&&f.id){const g=h.getTrackById(f.id);g&&(g.mode=f.mode??"hidden")}return h.addEventListener("change",u),()=>{h.removeEventListener("change",u)}},[r,i,c,u]),W.jsx("div",{className:"flex aspect-video flex-col",children:W.jsx(T2,{ref:i,playbackRates:[.5,.75,1,1.25,1.5,1.75,2,2.5,3,3.5,4],volume:(t==null?void 0:t.volumeRate)??1,playbackRate:(t==null?void 0:t.playbackRate)??1,thumbnailTime:o,onRateChange:u,onVolumeChange:u,streamType:"on-demand",defaultHiddenCaptions:!0,currentTime:o,onTimeUpdate:()=>{var h;return sessionStorage.setItem(a,JSON.stringify({time:(h=i.current)==null?void 0:h.currentTime,expiresAt:new Date(Date.now()+1e3*60*30).toISOString()}))},accentColor:"#427cf0",targetLiveWindow:NaN,onLoadedMetadata:()=>n(!0),...e})})}function sm(i,e){if(i===e)return!0;if(typeof i!=typeof e||typeof i!="object"||typeof e!="object"||i===null||e===null||Array.isArray(i)!==Array.isArray(e))return!1;if(Array.isArray(i)&&Array.isArray(e)){if(i.length!==e.length)return!1;for(let r=0;r<i.length;r++)if(!sm(i[r],e[r]))return!1;return!0}const t=Object.keys(i),s=Object.keys(e);if(t.length!==s.length)return!1;for(const r of t)if(!sm(i[r],e[r]))return!1;return!0}const i_=pt.createContext(null);function rO({children:i,epicVideoInfosPromise:e}){return W.jsx(i_.Provider,{value:e,children:i})}function s_(i){let e=new URL("https://epicweb.dev");try{e=new URL(i)}catch(u){return console.error(u),"EpicWeb.dev Video"}const t=e.pathname.split("/").filter(Boolean),s=t.includes("solution");let r=t.pop();const n=["problem","solution","embed","exercise"],a=u=>u&&!n.includes(u);for(;!a(r);)r=t.pop();if(!r)return"EpicWeb.dev Video";const o=r.split("-"),l=["the","a","an","and","but","or","for","nor","on","at","to","from","by","of","in","with","as","npm","git","ssh","cli"],d=["OAuth","UI","UX","API","CSS","HTML","JS","TS","SVG","AI","CSRF","CORS","HTTP","HTTPS","URL","URI","DB","SQL","JSON","YAML","YML","useActionData","useAsyncError","useAsyncValue","useBeforeUnload","useFetcher","useFetchers","useFormAction","useHref","useLoaderData","useLocation","useMatches","useNavigate","useNavigation","useNavigationType","useOutlet","useOutletContext","useParams","useResolvedPath","useRevalidator","useRouteError","useRouteLoaderData","useSearchParams","useSubmit","useCallback","useContext","useDebugValue","useDeferredValue","useEffect","useId","useImperativeHandle","useInsertionEffect","useLayoutEffect","useMemo","useReducer","useRef","useState","useSyncExternalStore","useTransition","useForm","useFieldset","useFieldList","useEventSource","useHydrated","useAuthenticityToken","useShouldHydrate","useGlobalNavigationState","useLocales","useDelegatedAnchors","useDebounceFetcher","useFetcherType"],c=o.filter(Boolean).map((u,h)=>{var p;const f=u.toLowerCase(),m=d.find(g=>g.toLowerCase()===f);return m||(l.includes(f)&&h>0?f:((p=f[0])==null?void 0:p.toUpperCase())+f.slice(1))}).join(" ");return s?`${c} (🏁 solution)`:c}function k2({url:i,title:e="Video Embed",loadingContent:t=W.jsx(rm,{children:W.jsxs("span",{children:['Loading "',e,'"']})})}){const[s,r]=pt.useState(!1);return W.jsxs("div",{className:"relative aspect-video w-full flex-shrink-0 shadow-lg dark:shadow-gray-800",children:[s?null:W.jsx("div",{className:"absolute inset-0 z-10 flex items-center justify-center",children:t}),W.jsx("iframe",{onLoad:()=>r(!0),onError:()=>r(!0),src:i,className:m_("absolute inset-0 flex h-full w-full transition-opacity duration-300",s?"opacity-100":"opacity-0"),title:e,sandbox:"allow-forms allow-scripts allow-same-origin allow-popups allow-popups-to-escape-sandbox",allowFullScreen:!0})]})}function r_({url:i,title:e}){return W.jsxs("a",{href:i,target:"_blank",className:"flex items-center gap-1 text-base no-underline opacity-70 transition hover:underline hover:opacity-100",rel:"noreferrer",children:[W.jsx(p_,{className:"flex-shrink-0",name:"Video",size:"lg"}),e," ",W.jsx("span",{"aria-hidden":!0,children:"↗︎"})]})}function nO({url:i,title:e=s_(i)}){const t=b_(),s=pt.useContext(i_),r=W.jsx("div",{children:W.jsx(r_,{url:i,title:e})});return W.jsx("div",{children:W.jsx(pt.Suspense,{fallback:W.jsxs("div",{children:[W.jsx("div",{className:"flex aspect-video w-full items-center justify-center",children:W.jsx(rm,{children:e})}),W.jsxs("div",{className:"mt-4 flex flex-col gap-2",children:[r,W.jsx("div",{className:"h-[32px]"})]})]}),children:W.jsx(E_,{errorElement:W.jsx("div",{children:"Sorry, failed loading videos. Check the terminal output?"}),resolve:s,children:n=>{const a=n==null?void 0:n[i],o=ENV.EPICSHOP_DEPLOYED?W.jsxs("div",{children:[ENV.EPICSHOP_GITHUB_ROOT?W.jsx(vo,{to:ENV.EPICSHOP_GITHUB_ROOT,className:"underline",children:"Run locally"}):"Run locally"," for transcripts"]}):W.jsxs("div",{children:[W.jsx(vo,{to:"/login",className:"underline",children:t?"Upgrade":"Login"})," for transcripts"]});if(!a)return W.jsxs("div",{children:[W.jsx(na,{url:i,title:e}),W.jsxs("div",{className:"mt-4 flex flex-col gap-2",children:[r,o]})]});const l=a;return l.status==="success"?W.jsx(L2,{url:i,title:e,muxPlaybackId:l.muxPlaybackId,transcript:l.transcript}):l.type==="region-restricted"?W.jsxs("div",{children:[W.jsxs("div",{className:"flex aspect-video min-h-full min-w-full flex-col items-center justify-start gap-2 overflow-y-scroll border-2 p-4 lg:justify-center lg:gap-4 lg:text-xl",children:[W.jsx("div",{className:"!text-foreground-danger",children:"Error: Region Restricted"}),W.jsxs("div",{children:["We've detected you're connecting from"," ",l.requestCountry," but your license has restricted access to ",l.restrictedCountry]}),W.jsxs("div",{children:["To continue watching uninterrupted, please"," ",W.jsx("a",{href:"https://www.epicweb.dev/products/full-stack-vol-1",className:"underline",children:"upgrade your EpicWeb.dev license"})," ","to a full Pro license."]})]}),W.jsxs("div",{className:"mt-4 flex flex-col gap-2",children:[r,W.jsxs("div",{children:[W.jsx(vo,{to:"https://www.epicweb.dev/products",className:"underline",children:"Upgrade"})," for transcripts"]})]})]}):l.statusCode===401?W.jsxs("div",{children:[W.jsx(na,{url:i,title:e}),W.jsxs("div",{className:"mt-4 flex flex-col gap-2",children:[r,o]})]}):l.statusCode===403?W.jsxs("div",{children:[W.jsx(na,{url:i,title:e}),W.jsxs("div",{className:"mt-4 flex flex-col gap-2",children:[r,W.jsxs("div",{children:[W.jsx(vo,{to:"https://www.epicweb.dev/products",className:"underline",children:"Upgrade"})," for transcripts"]})]})]}):l.statusCode===404?W.jsxs("div",{children:[W.jsx(na,{url:i,title:e}),W.jsxs("div",{className:"mt-4 flex flex-col gap-2",children:[r,W.jsx("div",{children:"Transcripts not found"})]})]}):(console.error(l),W.jsxs("div",{children:[W.jsx(na,{url:i,title:e}),W.jsxs("div",{className:"mt-4 flex flex-col gap-2",children:[r,W.jsx("div",{className:"!text-foreground-danger",children:"Unknown error (check console)"})]})]}))}})})})}function L2({url:i,title:e=s_(i),muxPlaybackId:t,transcript:s}){const r=pt.useRef(null),n=/(\d+:\d+)/g,a=[];let o,l=0;for(;o=n.exec(s);){const d=o[1];if(!n.lastIndex||!d)break;const c=o.index,u=n.lastIndex,h=s.slice(l+1,c-1);a.push(W.jsx("span",{children:h},c)),a.push(W.jsx("button",{className:"underline",onClick:f=>{r.current&&(r.current.currentTime=I2(d),r.current.play(),r.current.scrollIntoView({behavior:"smooth",inline:"center",block:"start"}),f.currentTarget.blur())},children:d},d)),l=u}return a.push(W.jsx("span",{children:s.slice(l+1,s.length)},s.length)),W.jsxs("div",{children:[W.jsx("div",{className:"shadow-lg dark:shadow-gray-800",children:W.jsx(x2,{playbackId:t,muxPlayerRef:r,title:e})}),W.jsxs("div",{className:"mt-4 flex flex-col gap-2",children:[W.jsx(r_,{url:i,title:e}),W.jsxs("details",{children:[W.jsx("summary",{children:"Transcript"}),W.jsx("div",{className:"whitespace-pre-line rounded-md bg-accent p-2 text-accent-foreground",children:a})]})]})]})}function I2(i){const e=i.split(":");let t=0,s=1;for(;e.length>0;)t+=s*parseInt(e.pop()??"0",10),s*=60;return t}function na({url:i,title:e}){const t=h_();let s=new URL("https://epicweb.dev");try{s=new URL(i)}catch(r){return console.error(r),W.jsxs("div",{children:['Invalid URL: "',i,'"']})}return s.pathname=s.pathname.endsWith("/")?`${s.pathname}embed`:`${s.pathname}/embed`,s.searchParams.set("theme",t),W.jsx(k2,{url:s.toString(),title:e,loadingContent:W.jsx(rm,{children:W.jsxs("span",{children:['Loading "',W.jsx("a",{className:"underline",href:i,children:e}),'"']})})})}export{nO as D,rO as E,k2 as V};
2988
- //# sourceMappingURL=epic-video-DJN9_SUj.js.map
2987
+ `).length,f=-3;this.streamType===_e.LIVE&&(f=-2);let m=f-h;if(u.line===m&&!c)return;s.has(u)||s.set(u,u.line),u.line=m}else setTimeout(()=>{u.line=s.get(u)||"auto"},500)})},a=()=>{var l,d;n(t,(d=(l=this.mediaController)==null?void 0:l.hasAttribute(ge.USER_INACTIVE))!=null?d:!1)},o=()=>{var l,d;let c=Array.from(((d=(l=this.mediaController)==null?void 0:l.media)==null?void 0:d.textTracks)||[]).filter(u=>["subtitles","captions"].includes(u.kind)&&u.mode==="showing")[0];c!==t&&(t==null||t.removeEventListener("cuechange",a)),t=c,t==null||t.addEventListener("cuechange",a),n(t,Te(this,Js))};o(),(i=this.textTracks)==null||i.addEventListener("change",o),(e=this.textTracks)==null||e.addEventListener("addtrack",o),this.addEventListener("userinactivechange",()=>{var l,d;let c=(d=(l=this.mediaController)==null?void 0:l.hasAttribute(ge.USER_INACTIVE))!=null?d:!0;Te(this,Js)!==c&&(Zi(this,Js,c),n(t,Te(this,Js)))})};function Ds(i,e){return i.media?i.media.getAttribute(e):i.getAttribute(e)}lt.customElements.get("mux-player")||(lt.customElements.define("mux-player",sv),lt.MuxPlayerElement=sv);var rv={className:"class",classname:"class",htmlFor:"for",crossOrigin:"crossorigin",viewBox:"viewBox",playsInline:"playsinline",autoPlay:"autoplay",playbackRate:"playbackrate"},i2=i=>i==null,s2=(i,e)=>i2(e)?!1:i in e,r2=i=>i.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`),n2=(i,e)=>{if(!(typeof e=="boolean"&&!e)){if(s2(i,rv))return rv[i];if(typeof e!=null)return/[A-Z]/.test(i)?r2(i):i}},a2=(i,e)=>typeof i=="boolean"?"":i,o2=(i={})=>Object.entries(i).reduce((e,[t,s])=>{let r=n2(t,s);if(!r)return e;let n=a2(s);return e[r]=n,e},{}),l2=(...i)=>{let e=pt.useRef(null);return pt.useEffect(()=>{i.forEach(t=>{t&&(typeof t=="function"?t(e.current):t.current=e.current)})},[i]),e},d2=Object.prototype.hasOwnProperty,c2=(i,e)=>{if(Object.is(i,e))return!0;if(typeof i!="object"||i===null||typeof e!="object"||e===null)return!1;if(Array.isArray(i))return!Array.isArray(e)||i.length!==e.length?!1:i.some((r,n)=>e[n]===r);let t=Object.keys(i),s=Object.keys(e);if(t.length!==s.length)return!1;for(let r=0;r<t.length;r++)if(!d2.call(e,t[r])||!Object.is(i[t[r]],e[t[r]]))return!1;return!0},t_=(i,e,t)=>!c2(e,i[t]),u2=(i,e,t)=>{i[t]=e},h2=(i,e,t,s=u2,r=t_)=>pt.useEffect(()=>{let n=t==null?void 0:t.current;n&&r(n,e,i)&&s(n,e,i)},[t==null?void 0:t.current,e]),Wi=h2,f2=()=>{try{return"2.7.0"}catch{}return"UNKNOWN"},m2=f2(),p2=()=>m2,g2=Dd.forwardRef(({children:i,...e},t)=>Dd.createElement("mux-player",o2({...e,ref:t}),i)),ke=(i,e,t)=>pt.useEffect(()=>{let s=e==null?void 0:e.current;if(!(!s||!t))return s.addEventListener(i,t),()=>{s.removeEventListener(i,t)}},[e==null?void 0:e.current,t]),v2=(i,e)=>{let{onAbort:t,onCanPlay:s,onCanPlayThrough:r,onEmptied:n,onLoadStart:a,onLoadedData:o,onLoadedMetadata:l,onProgress:d,onDurationChange:c,onVolumeChange:u,onRateChange:h,onResize:f,onWaiting:m,onPlay:p,onPlaying:g,onTimeUpdate:v,onPause:y,onSeeking:b,onSeeked:x,onStalled:_,onSuspend:S,onEnded:A,onError:D,onCuePointChange:O,onCuePointsChange:L,onChapterChange:C,metadata:H,tokens:U,paused:Q,playbackId:q,playbackRates:Y,currentTime:oe,themeProps:ae,extraSourceParams:G,_hlsConfig:F,...re}=e;return Wi("playbackRates",Y,i),Wi("metadata",H,i),Wi("extraSourceParams",G,i),Wi("_hlsConfig",F,i),Wi("themeProps",ae,i),Wi("tokens",U,i),Wi("playbackId",q,i),Wi("paused",Q,i,(J,de)=>{de!=null&&(de?J.pause():J.play())},(J,de,Ae)=>J.hasAttribute("autoplay")&&!J.hasPlayed?!1:t_(J,de,Ae)),Wi("currentTime",oe,i,(J,de)=>{de!=null&&(J.currentTime=de)}),ke("abort",i,t),ke("canplay",i,s),ke("canplaythrough",i,r),ke("emptied",i,n),ke("loadstart",i,a),ke("loadeddata",i,o),ke("loadedmetadata",i,l),ke("progress",i,d),ke("durationchange",i,c),ke("volumechange",i,u),ke("ratechange",i,h),ke("resize",i,f),ke("waiting",i,m),ke("play",i,p),ke("playing",i,g),ke("timeupdate",i,v),ke("pause",i,y),ke("seeking",i,b),ke("seeked",i,x),ke("stalled",i,_),ke("suspend",i,S),ke("ended",i,A),ke("error",i,D),ke("cuepointchange",i,O),ke("cuepointschange",i,L),ke("chapterchange",i,C),[re]},E2=p2(),b2="mux-player-react",y2=Dd.forwardRef((i,e)=>{let t=pt.useRef(null),s=l2(t,e),[r]=v2(t,i);return Dd.createElement(g2,{ref:s,playerSoftwareName:b2,playerSoftwareVersion:E2,...r})}),T2=y2;const _2=Gc.object({time:Gc.number(),expiresAt:Gc.string()}).transform(i=>({time:Number(i.time),expiresAt:new Date(i.expiresAt)}));function A2(){var e;const i=v_("root");return((e=i==null?void 0:i.preferences)==null?void 0:e.player)??null}const S2=["input","select","button","textarea","mux-player","summary"];function nv(i){const e=pt.useRef(i);return pt.useEffect(()=>{e.current=i},[i]),e}function x2({muxPlayerRef:i,...e}){const t=A2(),s=g_(),[r,n]=pt.useState(!1),a=`${e.playbackId}:currentTime`,[o,l]=pt.useState(0),d=nv(s),c=nv(t);pt.useEffect(()=>{if(typeof document>"u")return;const h=sessionStorage.getItem(a);if(h)try{const{time:f,expiresAt:m}=_2.parse(JSON.parse(h));if(m.getTime()<Date.now())throw new Error("Time expired");l(f)}catch{sessionStorage.removeItem(a)}},[a]),pt.useEffect(()=>{function h(f){if(!i.current)return;const m=document.activeElement,p=m instanceof HTMLElement?m.contentEditable==="true":!1;m&&!S2.includes(m.tagName.toLowerCase())&&!p&&(f.key===" "&&(f.preventDefault(),i.current.paused?i.current.play():i.current.pause()),f.key==="ArrowRight"&&(f.preventDefault(),i.current.currentTime=i.current.currentTime+(i.current.forwardSeekOffset||10)),f.key==="ArrowLeft"&&(f.preventDefault(),i.current.currentTime=i.current.currentTime-(i.current.forwardSeekOffset||10)),f.key==="f"&&!f.metaKey&&!f.ctrlKey&&(f.preventDefault(),document.fullscreenElement?document.exitFullscreen():i.current.requestFullscreen()))}return window.document.addEventListener("keydown",h),()=>{window.document.removeEventListener("keydown",h)}},[i]);const u=f_(()=>{const h=i.current;if(!h)return;const f=Array.from(h.textTracks??[]).find(p=>p.kind==="subtitles"),m={playbackRate:h.playbackRate,volumeRate:h.volume,subtitle:f?{id:f.id,mode:f.mode}:{id:null,mode:"disabled"}};sm(m,c.current)||d.current.submit(m,{method:"POST",action:"/video-player",encType:"application/json"})},300);return pt.useEffect(()=>{var m,p;if(!r)return;const h=(m=i.current)==null?void 0:m.textTracks;if(!h)return;const f=(p=c.current)==null?void 0:p.subtitle;if(f!=null&&f.id){const g=h.getTrackById(f.id);g&&(g.mode=f.mode??"hidden")}return h.addEventListener("change",u),()=>{h.removeEventListener("change",u)}},[r,i,c,u]),W.jsx("div",{className:"flex aspect-video flex-col",children:W.jsx(T2,{ref:i,playbackRates:[.5,.75,1,1.25,1.5,1.75,2,2.5,3,3.5,4],volume:(t==null?void 0:t.volumeRate)??1,playbackRate:(t==null?void 0:t.playbackRate)??1,thumbnailTime:o,onRateChange:u,onVolumeChange:u,streamType:"on-demand",defaultHiddenCaptions:!0,currentTime:o,onTimeUpdate:()=>{var h;return sessionStorage.setItem(a,JSON.stringify({time:(h=i.current)==null?void 0:h.currentTime,expiresAt:new Date(Date.now()+1e3*60*30).toISOString()}))},accentColor:"#427cf0",targetLiveWindow:NaN,onLoadedMetadata:()=>n(!0),...e})})}function sm(i,e){if(i===e)return!0;if(typeof i!=typeof e||typeof i!="object"||typeof e!="object"||i===null||e===null||Array.isArray(i)!==Array.isArray(e))return!1;if(Array.isArray(i)&&Array.isArray(e)){if(i.length!==e.length)return!1;for(let r=0;r<i.length;r++)if(!sm(i[r],e[r]))return!1;return!0}const t=Object.keys(i),s=Object.keys(e);if(t.length!==s.length)return!1;for(const r of t)if(!sm(i[r],e[r]))return!1;return!0}const i_=pt.createContext(null);function rO({children:i,epicVideoInfosPromise:e}){return W.jsx(i_.Provider,{value:e,children:i})}function s_(i){let e=new URL("https://epicweb.dev");try{e=new URL(i)}catch(u){return console.error(u),"EpicWeb.dev Video"}const t=e.pathname.split("/").filter(Boolean),s=t.includes("solution");let r=t.pop();const n=["problem","solution","embed","exercise"],a=u=>u&&!n.includes(u);for(;!a(r);)r=t.pop();if(!r)return"EpicWeb.dev Video";const o=r.split("-"),l=["the","a","an","and","but","or","for","nor","on","at","to","from","by","of","in","with","as","npm","git","ssh","cli"],d=["OAuth","UI","UX","API","CSS","HTML","JS","TS","SVG","AI","CSRF","CORS","HTTP","HTTPS","URL","URI","DB","SQL","JSON","YAML","YML","useActionData","useAsyncError","useAsyncValue","useBeforeUnload","useFetcher","useFetchers","useFormAction","useHref","useLoaderData","useLocation","useMatches","useNavigate","useNavigation","useNavigationType","useOutlet","useOutletContext","useParams","useResolvedPath","useRevalidator","useRouteError","useRouteLoaderData","useSearchParams","useSubmit","useCallback","useContext","useDebugValue","useDeferredValue","useEffect","useId","useImperativeHandle","useInsertionEffect","useLayoutEffect","useMemo","useReducer","useRef","useState","useSyncExternalStore","useTransition","useForm","useFieldset","useFieldList","useEventSource","useHydrated","useAuthenticityToken","useShouldHydrate","useGlobalNavigationState","useLocales","useDelegatedAnchors","useDebounceFetcher","useFetcherType"],c=o.filter(Boolean).map((u,h)=>{var p;const f=u.toLowerCase(),m=d.find(g=>g.toLowerCase()===f);return m||(l.includes(f)&&h>0?f:((p=f[0])==null?void 0:p.toUpperCase())+f.slice(1))}).join(" ");return s?`${c} (🏁 solution)`:c}function k2({url:i,title:e="Video Embed",loadingContent:t=W.jsx(rm,{children:W.jsxs("span",{children:['Loading "',e,'"']})})}){const[s,r]=pt.useState(!1);return W.jsxs("div",{className:"relative aspect-video w-full flex-shrink-0 shadow-lg dark:shadow-gray-800",children:[s?null:W.jsx("div",{className:"absolute inset-0 z-10 flex items-center justify-center",children:t}),W.jsx("iframe",{onLoad:()=>r(!0),onError:()=>r(!0),src:i,className:m_("absolute inset-0 flex h-full w-full transition-opacity duration-300",s?"opacity-100":"opacity-0"),title:e,sandbox:"allow-forms allow-scripts allow-same-origin allow-popups allow-popups-to-escape-sandbox",allowFullScreen:!0})]})}function r_({url:i,title:e}){return W.jsxs("a",{href:i,target:"_blank",className:"flex items-center gap-1 text-base no-underline opacity-70 transition hover:underline hover:opacity-100",rel:"noreferrer",children:[W.jsx(p_,{className:"flex-shrink-0",name:"Video",size:"lg"}),e," ",W.jsx("span",{"aria-hidden":!0,children:"↗︎"})]})}function nO({url:i,title:e=s_(i)}){const t=b_(),s=pt.useContext(i_),r=W.jsx("div",{children:W.jsx(r_,{url:i,title:e})});return W.jsx("div",{children:W.jsx(pt.Suspense,{fallback:W.jsxs("div",{children:[W.jsx("div",{className:"flex aspect-video w-full items-center justify-center",children:W.jsx(rm,{children:e})}),W.jsxs("div",{className:"mt-4 flex flex-col gap-2",children:[r,W.jsx("div",{className:"h-[32px]"})]})]}),children:W.jsx(E_,{errorElement:W.jsx("div",{children:"Sorry, failed loading videos. Check the terminal output?"}),resolve:s,children:n=>{const a=n==null?void 0:n[i],o=ENV.EPICSHOP_DEPLOYED?W.jsxs("div",{children:[W.jsx(vo,{to:ENV.EPICSHOP_GITHUB_REPO,className:"underline",children:"Run locally"})," for transcripts"]}):W.jsxs("div",{children:[W.jsx(vo,{to:"/login",className:"underline",children:t?"Upgrade":"Login"})," for transcripts"]});if(!a)return W.jsxs("div",{children:[W.jsx(na,{url:i,title:e}),W.jsxs("div",{className:"mt-4 flex flex-col gap-2",children:[r,o]})]});const l=a;return l.status==="success"?W.jsx(L2,{url:i,title:e,muxPlaybackId:l.muxPlaybackId,transcript:l.transcript}):l.type==="region-restricted"?W.jsxs("div",{children:[W.jsxs("div",{className:"flex aspect-video min-h-full min-w-full flex-col items-center justify-start gap-2 overflow-y-scroll border-2 p-4 lg:justify-center lg:gap-4 lg:text-xl",children:[W.jsx("div",{className:"!text-foreground-danger",children:"Error: Region Restricted"}),W.jsxs("div",{children:["We've detected you're connecting from"," ",l.requestCountry," but your license has restricted access to ",l.restrictedCountry]}),W.jsxs("div",{children:["To continue watching uninterrupted, please"," ",W.jsx("a",{href:"https://www.epicweb.dev/products/full-stack-vol-1",className:"underline",children:"upgrade your EpicWeb.dev license"})," ","to a full Pro license."]})]}),W.jsxs("div",{className:"mt-4 flex flex-col gap-2",children:[r,W.jsxs("div",{children:[W.jsx(vo,{to:"https://www.epicweb.dev/products",className:"underline",children:"Upgrade"})," for transcripts"]})]})]}):l.statusCode===401?W.jsxs("div",{children:[W.jsx(na,{url:i,title:e}),W.jsxs("div",{className:"mt-4 flex flex-col gap-2",children:[r,o]})]}):l.statusCode===403?W.jsxs("div",{children:[W.jsx(na,{url:i,title:e}),W.jsxs("div",{className:"mt-4 flex flex-col gap-2",children:[r,W.jsxs("div",{children:[W.jsx(vo,{to:"https://www.epicweb.dev/products",className:"underline",children:"Upgrade"})," for transcripts"]})]})]}):l.statusCode===404?W.jsxs("div",{children:[W.jsx(na,{url:i,title:e}),W.jsxs("div",{className:"mt-4 flex flex-col gap-2",children:[r,W.jsx("div",{children:"Transcripts not found"})]})]}):(console.error(l),W.jsxs("div",{children:[W.jsx(na,{url:i,title:e}),W.jsxs("div",{className:"mt-4 flex flex-col gap-2",children:[r,W.jsx("div",{className:"!text-foreground-danger",children:"Unknown error (check console)"})]})]}))}})})})}function L2({url:i,title:e=s_(i),muxPlaybackId:t,transcript:s}){const r=pt.useRef(null),n=/(\d+:\d+)/g,a=[];let o,l=0;for(;o=n.exec(s);){const d=o[1];if(!n.lastIndex||!d)break;const c=o.index,u=n.lastIndex,h=s.slice(l+1,c-1);a.push(W.jsx("span",{children:h},c)),a.push(W.jsx("button",{className:"underline",onClick:f=>{r.current&&(r.current.currentTime=I2(d),r.current.play(),r.current.scrollIntoView({behavior:"smooth",inline:"center",block:"start"}),f.currentTarget.blur())},children:d},d)),l=u}return a.push(W.jsx("span",{children:s.slice(l+1,s.length)},s.length)),W.jsxs("div",{children:[W.jsx("div",{className:"shadow-lg dark:shadow-gray-800",children:W.jsx(x2,{playbackId:t,muxPlayerRef:r,title:e})}),W.jsxs("div",{className:"mt-4 flex flex-col gap-2",children:[W.jsx(r_,{url:i,title:e}),W.jsxs("details",{children:[W.jsx("summary",{children:"Transcript"}),W.jsx("div",{className:"whitespace-pre-line rounded-md bg-accent p-2 text-accent-foreground",children:a})]})]})]})}function I2(i){const e=i.split(":");let t=0,s=1;for(;e.length>0;)t+=s*parseInt(e.pop()??"0",10),s*=60;return t}function na({url:i,title:e}){const t=h_();let s=new URL("https://epicweb.dev");try{s=new URL(i)}catch(r){return console.error(r),W.jsxs("div",{children:['Invalid URL: "',i,'"']})}return s.pathname=s.pathname.endsWith("/")?`${s.pathname}embed`:`${s.pathname}/embed`,s.searchParams.set("theme",t),W.jsx(k2,{url:s.toString(),title:e,loadingContent:W.jsx(rm,{children:W.jsxs("span",{children:['Loading "',W.jsx("a",{className:"underline",href:i,children:e}),'"']})})})}export{nO as D,rO as E,k2 as V};
2988
+ //# sourceMappingURL=epic-video-CfelX9-n.js.map