@epic-web/workshop-app 5.22.4 → 5.22.5

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 (30) hide show
  1. package/build/client/assets/{_exerciseNumber-3uq8PYSd.js → _exerciseNumber-CoBfhQjJ.js} +2 -2
  2. package/build/client/assets/{_exerciseNumber-3uq8PYSd.js.map → _exerciseNumber-CoBfhQjJ.js.map} +1 -1
  3. package/build/client/assets/{_exerciseNumber_.finished-3Iv9ikNq.js → _exerciseNumber_.finished-Y4uCc3KH.js} +2 -2
  4. package/build/client/assets/{_exerciseNumber_.finished-3Iv9ikNq.js.map → _exerciseNumber_.finished-Y4uCc3KH.js.map} +1 -1
  5. package/build/client/assets/{_layout-Brb3LPqZ.js → _layout-D25fx677.js} +2 -2
  6. package/build/client/assets/{_layout-Brb3LPqZ.js.map → _layout-D25fx677.js.map} +1 -1
  7. package/build/client/assets/{diff-CTHVtVGQ.js → diff-DX_Noxwr.js} +2 -2
  8. package/build/client/assets/{diff-CTHVtVGQ.js.map → diff-DX_Noxwr.js.map} +1 -1
  9. package/build/client/assets/{diff-CVrsnWqw.js → diff-KLlexrTJ.js} +2 -2
  10. package/build/client/assets/{diff-CVrsnWqw.js.map → diff-KLlexrTJ.js.map} +1 -1
  11. package/build/client/assets/{epic-video-BQtjG_Y0.js → epic-video-CqPr1EqP.js} +2 -2
  12. package/build/client/assets/{epic-video-BQtjG_Y0.js.map → epic-video-CqPr1EqP.js.map} +1 -1
  13. package/build/client/assets/{finished-9PhQncNF.js → finished-B4dkglFg.js} +2 -2
  14. package/build/client/assets/{finished-9PhQncNF.js.map → finished-B4dkglFg.js.map} +1 -1
  15. package/build/client/assets/{index-mZJ8sz9i.js → index-BZ4hC2RQ.js} +2 -2
  16. package/build/client/assets/{index-mZJ8sz9i.js.map → index-BZ4hC2RQ.js.map} +1 -1
  17. package/build/client/assets/{index-qo6WmPUa.js → index-BmmH8jFA.js} +2 -2
  18. package/build/client/assets/{index-qo6WmPUa.js.map → index-BmmH8jFA.js.map} +1 -1
  19. package/build/client/assets/{manifest-4acdd3e2.js → manifest-a707abb0.js} +1 -1
  20. package/build/client/assets/{mdx-CnaWQCDw.js → mdx-6d6l1jm2.js} +2 -2
  21. package/build/client/assets/{mdx-CnaWQCDw.js.map → mdx-6d6l1jm2.js.map} +1 -1
  22. package/build/client/assets/{onboarding-DzfDHJg_.js → onboarding-Cr6zRXFc.js} +2 -2
  23. package/build/client/assets/{onboarding-DzfDHJg_.js.map → onboarding-Cr6zRXFc.js.map} +1 -1
  24. package/build/client/assets/{test-B8jDo0X4.js → test-BLgbkpIE.js} +2 -2
  25. package/build/client/assets/{test-B8jDo0X4.js.map → test-BLgbkpIE.js.map} +1 -1
  26. package/build/client/assets/{tests-y-atkhWB.js → tests-CtkPy7b6.js} +2 -2
  27. package/build/client/assets/{tests-y-atkhWB.js.map → tests-CtkPy7b6.js.map} +1 -1
  28. package/build/server/index.js +7 -3
  29. package/build/server/index.js.map +1 -1
  30. package/package.json +3 -3
@@ -1,2 +1,2 @@
1
- import{j as r,a as l,i as c}from"./index-CGzylDPY.js";import{E as a}from"./index-egcHQOpF.js";import{E as m}from"./epic-video-BQtjG_Y0.js";import{u as d}from"./revalidation-ws-BoJZTvOQ.js";import{M as x,E as p}from"./mdx-CnaWQCDw.js";import{P as u}from"./progress-DwE8EkAa.js";import{g as f}from"./misc-CQmANiHr.js";import{g as h}from"./seo-pBpFCWsy.js";import{u as b,L as j}from"./components-DrvY4pal.js";import"./index-CMYl882D.js";import"./tooltip-Cd0yJoQb.js";import"./pe-DXT2FOp1.js";import"./online-BsTX44az.js";import"./loading-CPEkK5hO.js";import"./user-C0j04V55.js";import"./workshop-config-oL_FWDKq.js";import"./progress-bar-ZCHf2Y4W.js";const B=({data:e,matches:o})=>{var i;const t=e==null?void 0:e.exercise.exerciseNumber.toString().padStart(2,"0"),s=(i=o.find(n=>n.id==="root"))==null?void 0:i.data;return!e||!s?[{title:"🦉 | Error"}]:h({title:`📝 | ${t}. ${e.exercise.title} | ${s==null?void 0:s.workshopTitle}`,description:`Introduction for ${t}. ${e.exercise.title}`,ogTitle:e.exercise.title,ogDescription:`Introduction for exercise ${Number(t)}`,instructor:s.instructor,requestInfo:s.requestInfo})},g={h1:()=>null};function D(){var t;const e=b();d({watchPaths:[e.exerciseReadme.file]});const o=String(((t=e.firstStep)==null?void 0:t.stepNumber)??"01").padStart(2,"0");return r.jsxs("main",{className:"relative flex h-full w-full max-w-5xl flex-col justify-between border-r md:w-3/4 xl:w-2/3",children:[r.jsxs("article",{id:e.articleId,className:"shadow-on-scrollbox flex w-full flex-1 flex-col gap-12 overflow-y-scroll px-3 py-4 pt-6 scrollbar-thin scrollbar-thumb-scrollbar md:px-10 md:py-12 md:pt-16",children:[r.jsx("div",{children:r.jsx("h1",{className:"text-[clamp(3rem,6vw,7.5rem)] font-extrabold leading-none",children:e.exercise.title})}),r.jsx("div",{children:e.exercise.instructionsCode?r.jsx(m,{epicVideoInfosPromise:e.epicVideoInfosPromise,children:r.jsx("div",{className:"prose dark:prose-invert sm:prose-lg",children:r.jsx(x,{code:e.exercise.instructionsCode,components:g})})}):"No instructions yet..."})]},e.articleId),r.jsx(a,{elementQuery:`#${e.articleId}`},`scroll-${e.articleId}`),r.jsx(u,{type:"instructions",exerciseNumber:e.exerciseNumber,className:"h-14 border-t px-6"}),r.jsxs("div",{className:"flex h-16 justify-between border-b-4 border-t lg:border-b-0",children:[r.jsx("div",{}),r.jsx(p,{file:e.exerciseReadme.file,relativePath:e.exerciseReadme.relativePath}),r.jsx(j,{to:`${o}/${e.firstType}`,prefetch:"intent",className:"flex h-full items-center justify-center bg-foreground px-7 text-background",children:"Start Learning"})]})]})}function F(){const e=l();return typeof document<"u"&&console.error(e),c(e)?e.status===404?r.jsx("p",{children:"Sorry, we couldn't find that step."}):r.jsxs("p",{children:[e.status," ",e.data]}):r.jsx("p",{children:f(e)})}export{F as ErrorBoundary,D as default,B as meta};
2
- //# sourceMappingURL=_exerciseNumber-3uq8PYSd.js.map
1
+ import{j as r,a as l,i as c}from"./index-CGzylDPY.js";import{E as a}from"./index-egcHQOpF.js";import{E as m}from"./epic-video-CqPr1EqP.js";import{u as d}from"./revalidation-ws-BoJZTvOQ.js";import{M as x,E as p}from"./mdx-6d6l1jm2.js";import{P as u}from"./progress-DwE8EkAa.js";import{g as f}from"./misc-CQmANiHr.js";import{g as h}from"./seo-pBpFCWsy.js";import{u as b,L as j}from"./components-DrvY4pal.js";import"./index-CMYl882D.js";import"./tooltip-Cd0yJoQb.js";import"./pe-DXT2FOp1.js";import"./online-BsTX44az.js";import"./loading-CPEkK5hO.js";import"./user-C0j04V55.js";import"./workshop-config-oL_FWDKq.js";import"./progress-bar-ZCHf2Y4W.js";const B=({data:e,matches:o})=>{var i;const t=e==null?void 0:e.exercise.exerciseNumber.toString().padStart(2,"0"),s=(i=o.find(n=>n.id==="root"))==null?void 0:i.data;return!e||!s?[{title:"🦉 | Error"}]:h({title:`📝 | ${t}. ${e.exercise.title} | ${s==null?void 0:s.workshopTitle}`,description:`Introduction for ${t}. ${e.exercise.title}`,ogTitle:e.exercise.title,ogDescription:`Introduction for exercise ${Number(t)}`,instructor:s.instructor,requestInfo:s.requestInfo})},g={h1:()=>null};function D(){var t;const e=b();d({watchPaths:[e.exerciseReadme.file]});const o=String(((t=e.firstStep)==null?void 0:t.stepNumber)??"01").padStart(2,"0");return r.jsxs("main",{className:"relative flex h-full w-full max-w-5xl flex-col justify-between border-r md:w-3/4 xl:w-2/3",children:[r.jsxs("article",{id:e.articleId,className:"shadow-on-scrollbox flex w-full flex-1 flex-col gap-12 overflow-y-scroll px-3 py-4 pt-6 scrollbar-thin scrollbar-thumb-scrollbar md:px-10 md:py-12 md:pt-16",children:[r.jsx("div",{children:r.jsx("h1",{className:"text-[clamp(3rem,6vw,7.5rem)] font-extrabold leading-none",children:e.exercise.title})}),r.jsx("div",{children:e.exercise.instructionsCode?r.jsx(m,{epicVideoInfosPromise:e.epicVideoInfosPromise,children:r.jsx("div",{className:"prose dark:prose-invert sm:prose-lg",children:r.jsx(x,{code:e.exercise.instructionsCode,components:g})})}):"No instructions yet..."})]},e.articleId),r.jsx(a,{elementQuery:`#${e.articleId}`},`scroll-${e.articleId}`),r.jsx(u,{type:"instructions",exerciseNumber:e.exerciseNumber,className:"h-14 border-t px-6"}),r.jsxs("div",{className:"flex h-16 justify-between border-b-4 border-t lg:border-b-0",children:[r.jsx("div",{}),r.jsx(p,{file:e.exerciseReadme.file,relativePath:e.exerciseReadme.relativePath}),r.jsx(j,{to:`${o}/${e.firstType}`,prefetch:"intent",className:"flex h-full items-center justify-center bg-foreground px-7 text-background",children:"Start Learning"})]})]})}function F(){const e=l();return typeof document<"u"&&console.error(e),c(e)?e.status===404?r.jsx("p",{children:"Sorry, we couldn't find that step."}):r.jsxs("p",{children:[e.status," ",e.data]}):r.jsx("p",{children:f(e)})}export{F as ErrorBoundary,D as default,B as meta};
2
+ //# sourceMappingURL=_exerciseNumber-CoBfhQjJ.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"_exerciseNumber-3uq8PYSd.js","sources":["../../../app/routes/_app+/exercise+/$exerciseNumber.tsx"],"sourcesContent":["import path from 'path'\nimport { invariantResponse } from '@epic-web/invariant'\nimport { ElementScrollRestoration } from '@epic-web/restore-scroll'\nimport {\n\tgetExercises,\n\tgetWorkshopRoot,\n} from '@epic-web/workshop-utils/apps.server'\nimport { getWorkshopConfig } from '@epic-web/workshop-utils/config.server'\nimport { getEpicVideoInfos } from '@epic-web/workshop-utils/epic-api.server'\nimport {\n\tcombineServerTimings,\n\tgetServerTimeHeader,\n\tmakeTimings,\n\ttime,\n} from '@epic-web/workshop-utils/timing.server'\nimport {\n\tunstable_data as data,\n\ttype HeadersFunction,\n\ttype LoaderFunctionArgs,\n\ttype MetaFunction,\n} from '@remix-run/node'\nimport {\n\tLink,\n\tisRouteErrorResponse,\n\tuseLoaderData,\n\tuseRouteError,\n} from '@remix-run/react'\nimport slugify from '@sindresorhus/slugify'\nimport { EpicVideoInfoProvider } from '#app/components/epic-video.tsx'\nimport { useRevalidationWS } from '#app/components/revalidation-ws.js'\nimport { type loader as rootLoader } from '#app/root.tsx'\nimport { EditFileOnGitHub } from '#app/routes/launch-editor.tsx'\nimport { ProgressToggle } from '#app/routes/progress.tsx'\nimport { Mdx } from '#app/utils/mdx.tsx'\nimport { getErrorMessage } from '#app/utils/misc.tsx'\nimport { getSeoMetaTags } from '#app/utils/seo.js'\n\nexport const meta: MetaFunction<typeof loader, { root: typeof rootLoader }> = ({\n\tdata,\n\tmatches,\n}) => {\n\tconst number = data?.exercise.exerciseNumber.toString().padStart(2, '0')\n\n\tconst rootData = matches.find((m) => m.id === 'root')?.data\n\tif (!data || !rootData) return [{ title: '🦉 | Error' }]\n\n\treturn getSeoMetaTags({\n\t\ttitle: `📝 | ${number}. ${data.exercise.title} | ${rootData?.workshopTitle}`,\n\t\tdescription: `Introduction for ${number}. ${data.exercise.title}`,\n\t\togTitle: data.exercise.title,\n\t\togDescription: `Introduction for exercise ${Number(number)}`,\n\t\tinstructor: rootData.instructor,\n\t\trequestInfo: rootData.requestInfo,\n\t})\n}\n\nexport async function loader({ request, params }: LoaderFunctionArgs) {\n\tconst timings = makeTimings('exerciseNumberLoader')\n\tinvariantResponse(params.exerciseNumber, 'exerciseNumber is required')\n\tconst { title: workshopTitle } = getWorkshopConfig()\n\tconst exercises = await time(() => getExercises({ request, timings }), {\n\t\ttimings,\n\t\ttype: 'getExercises',\n\t\tdesc: 'getExercises in $exerciseNumber.tsx',\n\t})\n\tconst exercise = exercises.find(\n\t\t(e) => e.exerciseNumber === Number(params.exerciseNumber),\n\t)\n\tif (!exercise) {\n\t\tthrow new Response('Not found', { status: 404 })\n\t}\n\n\tconst readmeFilepath = path.join(\n\t\tgetWorkshopRoot(),\n\t\t'exercises',\n\t\texercise.dirName,\n\t\t'README.mdx',\n\t)\n\n\tconst firstStep = exercise.steps.find(Boolean)\n\n\tconst articleId = `workshop-${slugify(workshopTitle)}-${\n\t\texercise.exerciseNumber\n\t}-instructions`\n\n\treturn data(\n\t\t{\n\t\t\tarticleId,\n\t\t\texercise,\n\t\t\texerciseNumber: exercise.exerciseNumber,\n\t\t\texerciseReadme: {\n\t\t\t\tfile: readmeFilepath,\n\t\t\t\trelativePath: `exercises/${exercise.dirName}`,\n\t\t\t},\n\t\t\texerciseTitle: exercise.title,\n\t\t\tfirstStep,\n\t\t\tfirstType: firstStep?.problem ? 'problem' : 'solution',\n\t\t\ttitle: workshopTitle,\n\t\t\tepicVideoInfosPromise: getEpicVideoInfos(\n\t\t\t\texercise.instructionsEpicVideoEmbeds,\n\t\t\t\t{ request },\n\t\t\t),\n\t\t},\n\t\t{\n\t\t\theaders: {\n\t\t\t\t'Server-Timing': getServerTimeHeader(timings),\n\t\t\t},\n\t\t},\n\t)\n}\n\nexport const headers: HeadersFunction = ({ loaderHeaders, parentHeaders }) => {\n\tconst headers = {\n\t\t'Cache-Control': loaderHeaders.get('Cache-Control') ?? '',\n\t\t'Server-Timing': combineServerTimings(loaderHeaders, parentHeaders),\n\t}\n\treturn headers\n}\n\n// we'll render the title ourselves thank you\nconst mdxComponents = { h1: () => null }\n\nexport default function ExerciseNumberRoute() {\n\tconst data = useLoaderData<typeof loader>()\n\tuseRevalidationWS({\n\t\twatchPaths: [data.exerciseReadme.file],\n\t})\n\n\tconst firstStepNumber = String(data.firstStep?.stepNumber ?? '01').padStart(\n\t\t2,\n\t\t'0',\n\t)\n\treturn (\n\t\t<main className=\"relative flex h-full w-full max-w-5xl flex-col justify-between border-r md:w-3/4 xl:w-2/3\">\n\t\t\t<article\n\t\t\t\tid={data.articleId}\n\t\t\t\tkey={data.articleId}\n\t\t\t\tclassName=\"shadow-on-scrollbox flex w-full flex-1 flex-col gap-12 overflow-y-scroll px-3 py-4 pt-6 scrollbar-thin scrollbar-thumb-scrollbar md:px-10 md:py-12 md:pt-16\"\n\t\t\t>\n\t\t\t\t<div>\n\t\t\t\t\t<h1 className=\"text-[clamp(3rem,6vw,7.5rem)] font-extrabold leading-none\">\n\t\t\t\t\t\t{data.exercise.title}\n\t\t\t\t\t</h1>\n\t\t\t\t</div>\n\t\t\t\t<div>\n\t\t\t\t\t{data.exercise.instructionsCode ? (\n\t\t\t\t\t\t<EpicVideoInfoProvider\n\t\t\t\t\t\t\tepicVideoInfosPromise={data.epicVideoInfosPromise}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<div className=\"prose dark:prose-invert sm:prose-lg\">\n\t\t\t\t\t\t\t\t<Mdx\n\t\t\t\t\t\t\t\t\tcode={data.exercise.instructionsCode}\n\t\t\t\t\t\t\t\t\tcomponents={mdxComponents}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</EpicVideoInfoProvider>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t'No instructions yet...'\n\t\t\t\t\t)}\n\t\t\t\t</div>\n\t\t\t</article>\n\t\t\t<ElementScrollRestoration\n\t\t\t\telementQuery={`#${data.articleId}`}\n\t\t\t\tkey={`scroll-${data.articleId}`}\n\t\t\t/>\n\t\t\t<ProgressToggle\n\t\t\t\ttype=\"instructions\"\n\t\t\t\texerciseNumber={data.exerciseNumber}\n\t\t\t\tclassName=\"h-14 border-t px-6\"\n\t\t\t/>\n\t\t\t<div className=\"flex h-16 justify-between border-b-4 border-t lg:border-b-0\">\n\t\t\t\t<div />\n\t\t\t\t<EditFileOnGitHub\n\t\t\t\t\tfile={data.exerciseReadme.file}\n\t\t\t\t\trelativePath={data.exerciseReadme.relativePath}\n\t\t\t\t/>\n\t\t\t\t<Link\n\t\t\t\t\tto={`${firstStepNumber}/${data.firstType}`}\n\t\t\t\t\tprefetch=\"intent\"\n\t\t\t\t\tclassName=\"flex h-full items-center justify-center bg-foreground px-7 text-background\"\n\t\t\t\t>\n\t\t\t\t\tStart Learning\n\t\t\t\t</Link>\n\t\t\t</div>\n\t\t</main>\n\t)\n}\n\nexport function ErrorBoundary() {\n\tconst error = useRouteError()\n\n\tif (typeof document !== 'undefined') {\n\t\tconsole.error(error)\n\t}\n\n\treturn isRouteErrorResponse(error) ? (\n\t\terror.status === 404 ? (\n\t\t\t<p>Sorry, we couldn't find that step.</p>\n\t\t) : (\n\t\t\t<p>\n\t\t\t\t{error.status} {error.data}\n\t\t\t</p>\n\t\t)\n\t) : (\n\t\t<p>{getErrorMessage(error)}</p>\n\t)\n}\n"],"names":["meta","data","matches","number","exercise","exerciseNumber","toString","padStart","rootData","find","m","id","title","getSeoMetaTags","workshopTitle","description","ogTitle","ogDescription","Number","instructor","requestInfo","mdxComponents","h1","ExerciseNumberRoute","useLoaderData","useRevalidationWS","watchPaths","exerciseReadme","file","firstStepNumber","String","firstStep","stepNumber","jsxs","className","children","articleId","jsx","instructionsCode","EpicVideoInfoProvider","epicVideoInfosPromise","Mdx","code","components","ElementScrollRestoration","elementQuery","ProgressToggle","type","EditFileOnGitHub","relativePath","Link","to","firstType","prefetch","ErrorBoundary","error","useRouteError","document","console","isRouteErrorResponse","status","getErrorMessage"],"mappings":"woBAqCO,MAAMA,EAAiEA,CAAC,CAC9EC,KAAAA,EACAC,QAAAA,CACD,IAAM,OACC,MAAAC,EAASF,GAAAA,YAAAA,EAAMG,SAASC,eAAeC,WAAWC,SAAS,EAAG,KAE9DC,GAAWN,EAAAA,EAAQO,KAAMC,GAAMA,EAAEC,KAAO,MAAM,IAAnCT,YAAAA,EAAsCD,KACnD,MAAA,CAACA,GAAQ,CAACO,EAAiB,CAAC,CAAEI,MAAO,YAAa,CAAC,EAEhDC,EAAe,CACrBD,MAAO,QAAQT,CAAM,KAAKF,EAAKG,SAASQ,KAAK,MAAMJ,GAAAA,YAAAA,EAAUM,aAAa,GAC1EC,YAAa,oBAAoBZ,CAAM,KAAKF,EAAKG,SAASQ,KAAK,GAC/DI,QAASf,EAAKG,SAASQ,MACvBK,cAAe,6BAA6BC,OAAOf,CAAM,CAAC,GAC1DgB,WAAYX,EAASW,WACrBC,YAAaZ,EAASY,WACvB,CAAC,CACF,EAkEMC,EAAgB,CAAEC,GAAIA,IAAM,IAAK,EAEvC,SAAwBC,GAAsB,OAC7C,MAAMtB,EAAOuB,IACKC,EAAA,CACjBC,WAAY,CAACzB,EAAK0B,eAAeC,IAAI,CACtC,CAAC,EAED,MAAMC,EAAkBC,SAAO7B,EAAAA,EAAK8B,YAAL9B,YAAAA,EAAgB+B,aAAc,IAAI,EAAEzB,SAClE,EACA,GACD,EAEC,OAAA0B,EAAAA,KAAC,OAAK,CAAAC,UAAU,4FACfC,SAAA,CAAAF,EAAA,KAAC,UAAA,CACAtB,GAAIV,EAAKmC,UAETF,UAAU,8JAEVC,SAAA,CAACE,EAAA,IAAA,MAAA,CACAF,eAAC,KAAG,CAAAD,UAAU,4DACZC,SAAAlC,EAAKG,SAASQ,MAChB,CACD,CAAA,EACCyB,EAAA,IAAA,MAAA,CACCF,SAAAlC,EAAKG,SAASkC,iBACdD,EAAAA,IAACE,EAAA,CACAC,sBAAuBvC,EAAKuC,sBAE5BL,SAAAE,EAAA,IAAC,MAAI,CAAAH,UAAU,sCACdC,SAAAE,EAAA,IAACI,EAAA,CACAC,KAAMzC,EAAKG,SAASkC,iBACpBK,WAAYtB,EACb,EACD,CACD,CAAA,EAEA,wBAEF,CAAA,CAAA,CAAA,EAvBKpB,EAAKmC,SAwBX,EACAC,EAAAA,IAACO,EAAA,CACAC,aAAc,IAAI5C,EAAKmC,SAAS,EAAA,EAC3B,UAAUnC,EAAKmC,SAAS,EAC9B,EACAC,EAAA,IAACS,EAAA,CACAC,KAAK,eACL1C,eAAgBJ,EAAKI,eACrB6B,UAAU,oBAAA,CACX,EACAD,EAAA,KAAC,MAAI,CAAAC,UAAU,8DACdC,SAAA,CAAAE,EAAAA,IAAC,MAAI,CAAA,CAAA,EACLA,EAAA,IAACW,EAAA,CACApB,KAAM3B,EAAK0B,eAAeC,KAC1BqB,aAAchD,EAAK0B,eAAesB,YAAA,CACnC,EACAZ,EAAA,IAACa,EAAA,CACAC,GAAI,GAAGtB,CAAe,IAAI5B,EAAKmD,SAAS,GACxCC,SAAS,SACTnB,UAAU,6EACVC,SAAA,gBAAA,CAED,CAAA,CACD,CAAA,CAAA,CACD,CAAA,CAEF,CAEO,SAASmB,GAAgB,CAC/B,MAAMC,EAAQC,IAEV,OAAA,OAAOC,SAAa,KACvBC,QAAQH,MAAMA,CAAK,EAGbI,EAAqBJ,CAAK,EAChCA,EAAMK,SAAW,IAChBvB,EAAA,IAAC,IAAE,CAAAF,SAAA,oCAAA,CAAkC,EAErCF,EAAA,KAAC,IACC,CAAAE,SAAA,CAAMoB,EAAAK,OAAO,IAAEL,EAAMtD,IAAA,CAAA,CACvB,EAGDoC,EAAA,IAAC,IAAG,CAAAF,SAAA0B,EAAgBN,CAAK,CAAE,CAAA,CAE7B"}
1
+ {"version":3,"file":"_exerciseNumber-CoBfhQjJ.js","sources":["../../../app/routes/_app+/exercise+/$exerciseNumber.tsx"],"sourcesContent":["import path from 'path'\nimport { invariantResponse } from '@epic-web/invariant'\nimport { ElementScrollRestoration } from '@epic-web/restore-scroll'\nimport {\n\tgetExercises,\n\tgetWorkshopRoot,\n} from '@epic-web/workshop-utils/apps.server'\nimport { getWorkshopConfig } from '@epic-web/workshop-utils/config.server'\nimport { getEpicVideoInfos } from '@epic-web/workshop-utils/epic-api.server'\nimport {\n\tcombineServerTimings,\n\tgetServerTimeHeader,\n\tmakeTimings,\n\ttime,\n} from '@epic-web/workshop-utils/timing.server'\nimport {\n\tunstable_data as data,\n\ttype HeadersFunction,\n\ttype LoaderFunctionArgs,\n\ttype MetaFunction,\n} from '@remix-run/node'\nimport {\n\tLink,\n\tisRouteErrorResponse,\n\tuseLoaderData,\n\tuseRouteError,\n} from '@remix-run/react'\nimport slugify from '@sindresorhus/slugify'\nimport { EpicVideoInfoProvider } from '#app/components/epic-video.tsx'\nimport { useRevalidationWS } from '#app/components/revalidation-ws.js'\nimport { type loader as rootLoader } from '#app/root.tsx'\nimport { EditFileOnGitHub } from '#app/routes/launch-editor.tsx'\nimport { ProgressToggle } from '#app/routes/progress.tsx'\nimport { Mdx } from '#app/utils/mdx.tsx'\nimport { getErrorMessage } from '#app/utils/misc.tsx'\nimport { getSeoMetaTags } from '#app/utils/seo.js'\n\nexport const meta: MetaFunction<typeof loader, { root: typeof rootLoader }> = ({\n\tdata,\n\tmatches,\n}) => {\n\tconst number = data?.exercise.exerciseNumber.toString().padStart(2, '0')\n\n\tconst rootData = matches.find((m) => m.id === 'root')?.data\n\tif (!data || !rootData) return [{ title: '🦉 | Error' }]\n\n\treturn getSeoMetaTags({\n\t\ttitle: `📝 | ${number}. ${data.exercise.title} | ${rootData?.workshopTitle}`,\n\t\tdescription: `Introduction for ${number}. ${data.exercise.title}`,\n\t\togTitle: data.exercise.title,\n\t\togDescription: `Introduction for exercise ${Number(number)}`,\n\t\tinstructor: rootData.instructor,\n\t\trequestInfo: rootData.requestInfo,\n\t})\n}\n\nexport async function loader({ request, params }: LoaderFunctionArgs) {\n\tconst timings = makeTimings('exerciseNumberLoader')\n\tinvariantResponse(params.exerciseNumber, 'exerciseNumber is required')\n\tconst { title: workshopTitle } = getWorkshopConfig()\n\tconst exercises = await time(() => getExercises({ request, timings }), {\n\t\ttimings,\n\t\ttype: 'getExercises',\n\t\tdesc: 'getExercises in $exerciseNumber.tsx',\n\t})\n\tconst exercise = exercises.find(\n\t\t(e) => e.exerciseNumber === Number(params.exerciseNumber),\n\t)\n\tif (!exercise) {\n\t\tthrow new Response('Not found', { status: 404 })\n\t}\n\n\tconst readmeFilepath = path.join(\n\t\tgetWorkshopRoot(),\n\t\t'exercises',\n\t\texercise.dirName,\n\t\t'README.mdx',\n\t)\n\n\tconst firstStep = exercise.steps.find(Boolean)\n\n\tconst articleId = `workshop-${slugify(workshopTitle)}-${\n\t\texercise.exerciseNumber\n\t}-instructions`\n\n\treturn data(\n\t\t{\n\t\t\tarticleId,\n\t\t\texercise,\n\t\t\texerciseNumber: exercise.exerciseNumber,\n\t\t\texerciseReadme: {\n\t\t\t\tfile: readmeFilepath,\n\t\t\t\trelativePath: `exercises/${exercise.dirName}`,\n\t\t\t},\n\t\t\texerciseTitle: exercise.title,\n\t\t\tfirstStep,\n\t\t\tfirstType: firstStep?.problem ? 'problem' : 'solution',\n\t\t\ttitle: workshopTitle,\n\t\t\tepicVideoInfosPromise: getEpicVideoInfos(\n\t\t\t\texercise.instructionsEpicVideoEmbeds,\n\t\t\t\t{ request },\n\t\t\t),\n\t\t},\n\t\t{\n\t\t\theaders: {\n\t\t\t\t'Server-Timing': getServerTimeHeader(timings),\n\t\t\t},\n\t\t},\n\t)\n}\n\nexport const headers: HeadersFunction = ({ loaderHeaders, parentHeaders }) => {\n\tconst headers = {\n\t\t'Cache-Control': loaderHeaders.get('Cache-Control') ?? '',\n\t\t'Server-Timing': combineServerTimings(loaderHeaders, parentHeaders),\n\t}\n\treturn headers\n}\n\n// we'll render the title ourselves thank you\nconst mdxComponents = { h1: () => null }\n\nexport default function ExerciseNumberRoute() {\n\tconst data = useLoaderData<typeof loader>()\n\tuseRevalidationWS({\n\t\twatchPaths: [data.exerciseReadme.file],\n\t})\n\n\tconst firstStepNumber = String(data.firstStep?.stepNumber ?? '01').padStart(\n\t\t2,\n\t\t'0',\n\t)\n\treturn (\n\t\t<main className=\"relative flex h-full w-full max-w-5xl flex-col justify-between border-r md:w-3/4 xl:w-2/3\">\n\t\t\t<article\n\t\t\t\tid={data.articleId}\n\t\t\t\tkey={data.articleId}\n\t\t\t\tclassName=\"shadow-on-scrollbox flex w-full flex-1 flex-col gap-12 overflow-y-scroll px-3 py-4 pt-6 scrollbar-thin scrollbar-thumb-scrollbar md:px-10 md:py-12 md:pt-16\"\n\t\t\t>\n\t\t\t\t<div>\n\t\t\t\t\t<h1 className=\"text-[clamp(3rem,6vw,7.5rem)] font-extrabold leading-none\">\n\t\t\t\t\t\t{data.exercise.title}\n\t\t\t\t\t</h1>\n\t\t\t\t</div>\n\t\t\t\t<div>\n\t\t\t\t\t{data.exercise.instructionsCode ? (\n\t\t\t\t\t\t<EpicVideoInfoProvider\n\t\t\t\t\t\t\tepicVideoInfosPromise={data.epicVideoInfosPromise}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<div className=\"prose dark:prose-invert sm:prose-lg\">\n\t\t\t\t\t\t\t\t<Mdx\n\t\t\t\t\t\t\t\t\tcode={data.exercise.instructionsCode}\n\t\t\t\t\t\t\t\t\tcomponents={mdxComponents}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</EpicVideoInfoProvider>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t'No instructions yet...'\n\t\t\t\t\t)}\n\t\t\t\t</div>\n\t\t\t</article>\n\t\t\t<ElementScrollRestoration\n\t\t\t\telementQuery={`#${data.articleId}`}\n\t\t\t\tkey={`scroll-${data.articleId}`}\n\t\t\t/>\n\t\t\t<ProgressToggle\n\t\t\t\ttype=\"instructions\"\n\t\t\t\texerciseNumber={data.exerciseNumber}\n\t\t\t\tclassName=\"h-14 border-t px-6\"\n\t\t\t/>\n\t\t\t<div className=\"flex h-16 justify-between border-b-4 border-t lg:border-b-0\">\n\t\t\t\t<div />\n\t\t\t\t<EditFileOnGitHub\n\t\t\t\t\tfile={data.exerciseReadme.file}\n\t\t\t\t\trelativePath={data.exerciseReadme.relativePath}\n\t\t\t\t/>\n\t\t\t\t<Link\n\t\t\t\t\tto={`${firstStepNumber}/${data.firstType}`}\n\t\t\t\t\tprefetch=\"intent\"\n\t\t\t\t\tclassName=\"flex h-full items-center justify-center bg-foreground px-7 text-background\"\n\t\t\t\t>\n\t\t\t\t\tStart Learning\n\t\t\t\t</Link>\n\t\t\t</div>\n\t\t</main>\n\t)\n}\n\nexport function ErrorBoundary() {\n\tconst error = useRouteError()\n\n\tif (typeof document !== 'undefined') {\n\t\tconsole.error(error)\n\t}\n\n\treturn isRouteErrorResponse(error) ? (\n\t\terror.status === 404 ? (\n\t\t\t<p>Sorry, we couldn't find that step.</p>\n\t\t) : (\n\t\t\t<p>\n\t\t\t\t{error.status} {error.data}\n\t\t\t</p>\n\t\t)\n\t) : (\n\t\t<p>{getErrorMessage(error)}</p>\n\t)\n}\n"],"names":["meta","data","matches","number","exercise","exerciseNumber","toString","padStart","rootData","find","m","id","title","getSeoMetaTags","workshopTitle","description","ogTitle","ogDescription","Number","instructor","requestInfo","mdxComponents","h1","ExerciseNumberRoute","useLoaderData","useRevalidationWS","watchPaths","exerciseReadme","file","firstStepNumber","String","firstStep","stepNumber","jsxs","className","children","articleId","jsx","instructionsCode","EpicVideoInfoProvider","epicVideoInfosPromise","Mdx","code","components","ElementScrollRestoration","elementQuery","ProgressToggle","type","EditFileOnGitHub","relativePath","Link","to","firstType","prefetch","ErrorBoundary","error","useRouteError","document","console","isRouteErrorResponse","status","getErrorMessage"],"mappings":"woBAqCO,MAAMA,EAAiEA,CAAC,CAC9EC,KAAAA,EACAC,QAAAA,CACD,IAAM,OACC,MAAAC,EAASF,GAAAA,YAAAA,EAAMG,SAASC,eAAeC,WAAWC,SAAS,EAAG,KAE9DC,GAAWN,EAAAA,EAAQO,KAAMC,GAAMA,EAAEC,KAAO,MAAM,IAAnCT,YAAAA,EAAsCD,KACnD,MAAA,CAACA,GAAQ,CAACO,EAAiB,CAAC,CAAEI,MAAO,YAAa,CAAC,EAEhDC,EAAe,CACrBD,MAAO,QAAQT,CAAM,KAAKF,EAAKG,SAASQ,KAAK,MAAMJ,GAAAA,YAAAA,EAAUM,aAAa,GAC1EC,YAAa,oBAAoBZ,CAAM,KAAKF,EAAKG,SAASQ,KAAK,GAC/DI,QAASf,EAAKG,SAASQ,MACvBK,cAAe,6BAA6BC,OAAOf,CAAM,CAAC,GAC1DgB,WAAYX,EAASW,WACrBC,YAAaZ,EAASY,WACvB,CAAC,CACF,EAkEMC,EAAgB,CAAEC,GAAIA,IAAM,IAAK,EAEvC,SAAwBC,GAAsB,OAC7C,MAAMtB,EAAOuB,IACKC,EAAA,CACjBC,WAAY,CAACzB,EAAK0B,eAAeC,IAAI,CACtC,CAAC,EAED,MAAMC,EAAkBC,SAAO7B,EAAAA,EAAK8B,YAAL9B,YAAAA,EAAgB+B,aAAc,IAAI,EAAEzB,SAClE,EACA,GACD,EAEC,OAAA0B,EAAAA,KAAC,OAAK,CAAAC,UAAU,4FACfC,SAAA,CAAAF,EAAA,KAAC,UAAA,CACAtB,GAAIV,EAAKmC,UAETF,UAAU,8JAEVC,SAAA,CAACE,EAAA,IAAA,MAAA,CACAF,eAAC,KAAG,CAAAD,UAAU,4DACZC,SAAAlC,EAAKG,SAASQ,MAChB,CACD,CAAA,EACCyB,EAAA,IAAA,MAAA,CACCF,SAAAlC,EAAKG,SAASkC,iBACdD,EAAAA,IAACE,EAAA,CACAC,sBAAuBvC,EAAKuC,sBAE5BL,SAAAE,EAAA,IAAC,MAAI,CAAAH,UAAU,sCACdC,SAAAE,EAAA,IAACI,EAAA,CACAC,KAAMzC,EAAKG,SAASkC,iBACpBK,WAAYtB,EACb,EACD,CACD,CAAA,EAEA,wBAEF,CAAA,CAAA,CAAA,EAvBKpB,EAAKmC,SAwBX,EACAC,EAAAA,IAACO,EAAA,CACAC,aAAc,IAAI5C,EAAKmC,SAAS,EAAA,EAC3B,UAAUnC,EAAKmC,SAAS,EAC9B,EACAC,EAAA,IAACS,EAAA,CACAC,KAAK,eACL1C,eAAgBJ,EAAKI,eACrB6B,UAAU,oBAAA,CACX,EACAD,EAAA,KAAC,MAAI,CAAAC,UAAU,8DACdC,SAAA,CAAAE,EAAAA,IAAC,MAAI,CAAA,CAAA,EACLA,EAAA,IAACW,EAAA,CACApB,KAAM3B,EAAK0B,eAAeC,KAC1BqB,aAAchD,EAAK0B,eAAesB,YAAA,CACnC,EACAZ,EAAA,IAACa,EAAA,CACAC,GAAI,GAAGtB,CAAe,IAAI5B,EAAKmD,SAAS,GACxCC,SAAS,SACTnB,UAAU,6EACVC,SAAA,gBAAA,CAED,CAAA,CACD,CAAA,CAAA,CACD,CAAA,CAEF,CAEO,SAASmB,GAAgB,CAC/B,MAAMC,EAAQC,IAEV,OAAA,OAAOC,SAAa,KACvBC,QAAQH,MAAMA,CAAK,EAGbI,EAAqBJ,CAAK,EAChCA,EAAMK,SAAW,IAChBvB,EAAA,IAAC,IAAE,CAAAF,SAAA,oCAAA,CAAkC,EAErCF,EAAA,KAAC,IACC,CAAAE,SAAA,CAAMoB,EAAAK,OAAO,IAAEL,EAAMtD,IAAA,CAAA,CACvB,EAGDoC,EAAA,IAAC,IAAG,CAAAF,SAAA0B,EAAgBN,CAAK,CAAE,CAAA,CAE7B"}
@@ -1,2 +1,2 @@
1
- import{j as e,r as n}from"./index-CGzylDPY.js";import{E as a}from"./index-egcHQOpF.js";import{E as c}from"./epic-video-BQtjG_Y0.js";import{I as m,a as d}from"./misc-CQmANiHr.js";import{L as x}from"./loading-CPEkK5hO.js";import{N as f}from"./nav-chevrons-DCuva9-Q.js";import{u as h}from"./revalidation-ws-BoJZTvOQ.js";import{M as u,E as p}from"./mdx-CnaWQCDw.js";import{P as j}from"./progress-DwE8EkAa.js";import{u as b}from"./index-CMYl882D.js";import{u as g}from"./online-BsTX44az.js";import{g as N}from"./seo-pBpFCWsy.js";import{u as v,L as E}from"./components-DrvY4pal.js";import"./user-C0j04V55.js";import"./workshop-config-oL_FWDKq.js";import"./progress-bar-ZCHf2Y4W.js";import"./pe-DXT2FOp1.js";import"./tooltip-Cd0yJoQb.js";const W=({data:s,matches:i})=>{var o;const t=s==null?void 0:s.exercise.exerciseNumber.toString().padStart(2,"0"),r=(o=i.find(l=>l.id==="root"))==null?void 0:o.data;return!s||!r?[{title:"🦉 | Error"}]:N({title:`🦉 | ${t}. ${s.exercise.title} | ${r==null?void 0:r.workshopTitle}`,description:`Elaboration for ${t}. ${s.exercise.title}`,ogTitle:`Finished: ${s.exercise.title}`,ogDescription:`Elaboration for exercise ${Number(t)}`,instructor:r.instructor,requestInfo:r.requestInfo})},w={h1:()=>null};function G(){const s=v(),i=s.exercise.exerciseNumber.toString().padStart(2,"0");return h({watchPaths:[`./exercises/${i}/FINISHED.mdx`]}),e.jsx("div",{className:"flex max-w-full flex-grow flex-col",children:e.jsxs("main",{className:"flex flex-grow flex-col sm:grid sm:h-full sm:min-h-[800px] sm:grid-cols-1 sm:grid-rows-2 md:min-h-[unset] lg:grid-cols-2 lg:grid-rows-1",children:[e.jsxs("div",{className:"relative flex flex-col sm:col-span-1 sm:row-span-1 sm:h-full lg:border-r",children:[e.jsx("h1",{className:"h-14 border-b pl-10 pr-5 text-sm font-medium leading-tight",children:e.jsx("div",{className:"flex h-14 flex-wrap items-center justify-between gap-x-2 py-2",children:e.jsxs("div",{className:"flex items-center justify-start gap-x-2",children:[e.jsx(E,{to:`/${i}`,className:"hover:underline",children:`${i}. ${s.exercise.title}`}),e.jsx("span",{children:"/"}),e.jsx("span",{children:"Elaboration"})]})})}),e.jsx("article",{className:"shadow-on-scrollbox h-full w-full max-w-none flex-1 scroll-pt-6 space-y-6 overflow-y-auto p-2 scrollbar-thin scrollbar-thumb-scrollbar sm:p-10 sm:pt-8",id:s.articleId,children:s.exercise.finishedCode?e.jsx(c,{epicVideoInfosPromise:s.epicVideoInfosPromise,children:e.jsx("div",{className:"prose dark:prose-invert sm:prose-lg",children:e.jsx(u,{code:s.exercise.finishedCode,components:w})})}):"No finished instructions yet..."}),e.jsx(a,{elementQuery:`#${s.articleId}`}),e.jsx(j,{type:"finished",exerciseNumber:s.exercise.exerciseNumber,className:"h-14 border-t px-6"}),e.jsxs("div",{className:"flex h-16 justify-between border-b-4 border-t lg:border-b-0",children:[e.jsx("div",{}),e.jsx(p,{file:s.exerciseFinished.file,relativePath:s.exerciseFinished.relativePath}),e.jsx(f,{prev:s.prevStepLink,next:s.nextStepLink})]})]}),e.jsx(y,{exerciseFormEmbedUrl:s.exerciseFormEmbedUrl,exerciseTitle:s.exercise.title})]})})}function y({exerciseFormEmbedUrl:s,exerciseTitle:i}){const t=b(),[r,o]=n.useState(!1);return g()?e.jsxs("div",{className:"relative min-h-full sm:min-h-[unset] sm:flex-shrink-0",children:[r?null:e.jsx("div",{className:"absolute inset-0 z-10 flex items-center justify-center",children:e.jsx(x,{children:e.jsxs("span",{children:["Loading ",i," Elaboration form"]})})}),e.jsx("iframe",{onLoad:()=>o(!0),onError:()=>o(!0),title:"Elaboration",src:s,className:d("absolute inset-0 flex h-full w-full transition-opacity duration-300",r?"opacity-100":"opacity-0"),style:{colorScheme:t}})]}):e.jsx("div",{className:"relative flex-shrink-0",children:e.jsx("div",{className:"absolute inset-0 z-10 flex items-center justify-center text-body-md text-foreground-destructive",children:e.jsx(m,{name:"WifiNoConnection",size:"xl",children:e.jsxs("span",{children:["Unable to load the ",e.jsx("a",{href:s,className:"underline",children:`${i} feedback form`})," when offline"]})})})})}export{G as default,W as meta};
2
- //# sourceMappingURL=_exerciseNumber_.finished-3Iv9ikNq.js.map
1
+ import{j as e,r as n}from"./index-CGzylDPY.js";import{E as a}from"./index-egcHQOpF.js";import{E as c}from"./epic-video-CqPr1EqP.js";import{I as m,a as d}from"./misc-CQmANiHr.js";import{L as x}from"./loading-CPEkK5hO.js";import{N as f}from"./nav-chevrons-DCuva9-Q.js";import{u as h}from"./revalidation-ws-BoJZTvOQ.js";import{M as u,E as p}from"./mdx-6d6l1jm2.js";import{P as j}from"./progress-DwE8EkAa.js";import{u as b}from"./index-CMYl882D.js";import{u as g}from"./online-BsTX44az.js";import{g as N}from"./seo-pBpFCWsy.js";import{u as v,L as E}from"./components-DrvY4pal.js";import"./user-C0j04V55.js";import"./workshop-config-oL_FWDKq.js";import"./progress-bar-ZCHf2Y4W.js";import"./pe-DXT2FOp1.js";import"./tooltip-Cd0yJoQb.js";const W=({data:s,matches:i})=>{var o;const t=s==null?void 0:s.exercise.exerciseNumber.toString().padStart(2,"0"),r=(o=i.find(l=>l.id==="root"))==null?void 0:o.data;return!s||!r?[{title:"🦉 | Error"}]:N({title:`🦉 | ${t}. ${s.exercise.title} | ${r==null?void 0:r.workshopTitle}`,description:`Elaboration for ${t}. ${s.exercise.title}`,ogTitle:`Finished: ${s.exercise.title}`,ogDescription:`Elaboration for exercise ${Number(t)}`,instructor:r.instructor,requestInfo:r.requestInfo})},w={h1:()=>null};function G(){const s=v(),i=s.exercise.exerciseNumber.toString().padStart(2,"0");return h({watchPaths:[`./exercises/${i}/FINISHED.mdx`]}),e.jsx("div",{className:"flex max-w-full flex-grow flex-col",children:e.jsxs("main",{className:"flex flex-grow flex-col sm:grid sm:h-full sm:min-h-[800px] sm:grid-cols-1 sm:grid-rows-2 md:min-h-[unset] lg:grid-cols-2 lg:grid-rows-1",children:[e.jsxs("div",{className:"relative flex flex-col sm:col-span-1 sm:row-span-1 sm:h-full lg:border-r",children:[e.jsx("h1",{className:"h-14 border-b pl-10 pr-5 text-sm font-medium leading-tight",children:e.jsx("div",{className:"flex h-14 flex-wrap items-center justify-between gap-x-2 py-2",children:e.jsxs("div",{className:"flex items-center justify-start gap-x-2",children:[e.jsx(E,{to:`/${i}`,className:"hover:underline",children:`${i}. ${s.exercise.title}`}),e.jsx("span",{children:"/"}),e.jsx("span",{children:"Elaboration"})]})})}),e.jsx("article",{className:"shadow-on-scrollbox h-full w-full max-w-none flex-1 scroll-pt-6 space-y-6 overflow-y-auto p-2 scrollbar-thin scrollbar-thumb-scrollbar sm:p-10 sm:pt-8",id:s.articleId,children:s.exercise.finishedCode?e.jsx(c,{epicVideoInfosPromise:s.epicVideoInfosPromise,children:e.jsx("div",{className:"prose dark:prose-invert sm:prose-lg",children:e.jsx(u,{code:s.exercise.finishedCode,components:w})})}):"No finished instructions yet..."}),e.jsx(a,{elementQuery:`#${s.articleId}`}),e.jsx(j,{type:"finished",exerciseNumber:s.exercise.exerciseNumber,className:"h-14 border-t px-6"}),e.jsxs("div",{className:"flex h-16 justify-between border-b-4 border-t lg:border-b-0",children:[e.jsx("div",{}),e.jsx(p,{file:s.exerciseFinished.file,relativePath:s.exerciseFinished.relativePath}),e.jsx(f,{prev:s.prevStepLink,next:s.nextStepLink})]})]}),e.jsx(y,{exerciseFormEmbedUrl:s.exerciseFormEmbedUrl,exerciseTitle:s.exercise.title})]})})}function y({exerciseFormEmbedUrl:s,exerciseTitle:i}){const t=b(),[r,o]=n.useState(!1);return g()?e.jsxs("div",{className:"relative min-h-full sm:min-h-[unset] sm:flex-shrink-0",children:[r?null:e.jsx("div",{className:"absolute inset-0 z-10 flex items-center justify-center",children:e.jsx(x,{children:e.jsxs("span",{children:["Loading ",i," Elaboration form"]})})}),e.jsx("iframe",{onLoad:()=>o(!0),onError:()=>o(!0),title:"Elaboration",src:s,className:d("absolute inset-0 flex h-full w-full transition-opacity duration-300",r?"opacity-100":"opacity-0"),style:{colorScheme:t}})]}):e.jsx("div",{className:"relative flex-shrink-0",children:e.jsx("div",{className:"absolute inset-0 z-10 flex items-center justify-center text-body-md text-foreground-destructive",children:e.jsx(m,{name:"WifiNoConnection",size:"xl",children:e.jsxs("span",{children:["Unable to load the ",e.jsx("a",{href:s,className:"underline",children:`${i} feedback form`})," when offline"]})})})})}export{G as default,W as meta};
2
+ //# sourceMappingURL=_exerciseNumber_.finished-Y4uCc3KH.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"_exerciseNumber_.finished-3Iv9ikNq.js","sources":["../../../app/routes/_app+/exercise+/$exerciseNumber_.finished.tsx"],"sourcesContent":["import path from 'path'\nimport { invariantResponse } from '@epic-web/invariant'\nimport { ElementScrollRestoration } from '@epic-web/restore-scroll'\nimport {\n\tgetAppPageRoute,\n\tgetApps,\n\tgetExercise,\n\tgetWorkshopRoot,\n\tisExerciseStepApp,\n} from '@epic-web/workshop-utils/apps.server'\nimport { getWorkshopConfig } from '@epic-web/workshop-utils/config.server'\nimport { getEpicVideoInfos } from '@epic-web/workshop-utils/epic-api.server'\nimport {\n\tcombineServerTimings,\n\tgetServerTimeHeader,\n\tmakeTimings,\n} from '@epic-web/workshop-utils/timing.server'\nimport {\n\tunstable_data as data,\n\ttype HeadersFunction,\n\ttype LoaderFunctionArgs,\n\ttype MetaFunction,\n} from '@remix-run/node'\nimport { Link, useLoaderData } from '@remix-run/react'\nimport slugify from '@sindresorhus/slugify'\nimport * as React from 'react'\nimport { EpicVideoInfoProvider } from '#app/components/epic-video.tsx'\nimport { Icon } from '#app/components/icons.tsx'\nimport { Loading } from '#app/components/loading.tsx'\nimport { NavChevrons } from '#app/components/nav-chevrons.tsx'\nimport { useRevalidationWS } from '#app/components/revalidation-ws.js'\nimport { type loader as rootLoader } from '#app/root.tsx'\nimport { EditFileOnGitHub } from '#app/routes/launch-editor.tsx'\nimport { ProgressToggle } from '#app/routes/progress.tsx'\nimport { useTheme } from '#app/routes/theme/index.tsx'\nimport { Mdx } from '#app/utils/mdx.tsx'\nimport { cn } from '#app/utils/misc.tsx'\nimport { useIsOnline } from '#app/utils/online.ts'\nimport { getSeoMetaTags } from '#app/utils/seo.js'\n\nexport const meta: MetaFunction<typeof loader, { root: typeof rootLoader }> = ({\n\tdata,\n\tmatches,\n}) => {\n\tconst number = data?.exercise.exerciseNumber.toString().padStart(2, '0')\n\n\tconst rootData = matches.find((m) => m.id === 'root')?.data\n\tif (!data || !rootData) return [{ title: '🦉 | Error' }]\n\n\treturn getSeoMetaTags({\n\t\ttitle: `🦉 | ${number}. ${data.exercise.title} | ${rootData?.workshopTitle}`,\n\t\tdescription: `Elaboration for ${number}. ${data.exercise.title}`,\n\t\togTitle: `Finished: ${data.exercise.title}`,\n\t\togDescription: `Elaboration for exercise ${Number(number)}`,\n\t\tinstructor: rootData.instructor,\n\t\trequestInfo: rootData.requestInfo,\n\t})\n}\n\nexport async function loader({ request, params }: LoaderFunctionArgs) {\n\tconst timings = makeTimings('exerciseFinishedLoader')\n\tinvariantResponse(params.exerciseNumber, 'exerciseNumber is required')\n\tconst exercise = await getExercise(params.exerciseNumber, {\n\t\ttimings,\n\t\trequest,\n\t})\n\tif (!exercise) {\n\t\tthrow new Response('Not found', { status: 404 })\n\t}\n\tconst workshopConfig = getWorkshopConfig()\n\tconst exerciseFormTemplate = workshopConfig.forms.exercise\n\tconst exerciseFormEmbedUrl = exerciseFormTemplate\n\t\t.replace('{workshopTitle}', encodeURIComponent(workshopConfig.title))\n\t\t.replace('{exerciseTitle}', encodeURIComponent(exercise.title))\n\tconst nextExercise = await getExercise(exercise.exerciseNumber + 1, {\n\t\ttimings,\n\t\trequest,\n\t})\n\n\tconst finishedFilepath = path.join(\n\t\tgetWorkshopRoot(),\n\t\t'exercises',\n\t\texercise.dirName,\n\t\t'FINISHED.mdx',\n\t)\n\n\tconst apps = await getApps({ request, timings })\n\tconst exerciseApps = apps\n\t\t.filter(isExerciseStepApp)\n\t\t.filter((app) => app.exerciseNumber === exercise.exerciseNumber)\n\tconst prevApp = exerciseApps[exerciseApps.length - 1]\n\n\tconst articleId = `workshop-${slugify(workshopConfig.title)}-${\n\t\texercise.exerciseNumber\n\t}-finished`\n\n\treturn data(\n\t\t{\n\t\t\tarticleId,\n\t\t\tworkshopTitle: workshopConfig.title,\n\t\t\texercise,\n\t\t\texerciseFormEmbedUrl,\n\t\t\tepicVideoInfosPromise: getEpicVideoInfos(\n\t\t\t\texercise.finishedEpicVideoEmbeds,\n\t\t\t\t{ request },\n\t\t\t),\n\t\t\texerciseFinished: {\n\t\t\t\tfile: finishedFilepath,\n\t\t\t\trelativePath: `exercises/${exercise.dirName}/FINISHED.mdx`,\n\t\t\t},\n\t\t\tprevStepLink: prevApp\n\t\t\t\t? {\n\t\t\t\t\t\tto: getAppPageRoute(prevApp),\n\t\t\t\t\t\t'aria-label': `${prevApp.title} (${prevApp.type})`,\n\t\t\t\t\t}\n\t\t\t\t: null,\n\t\t\tnextStepLink: nextExercise\n\t\t\t\t? {\n\t\t\t\t\t\tto: `/exercise/${nextExercise.exerciseNumber.toString().padStart(2, '0')}`,\n\t\t\t\t\t\t'aria-label': `${nextExercise.title}`,\n\t\t\t\t\t}\n\t\t\t\t: {\n\t\t\t\t\t\tto: '/finished',\n\t\t\t\t\t\t'aria-label': 'Finished! 🎉',\n\t\t\t\t\t},\n\t\t},\n\t\t{\n\t\t\theaders: {\n\t\t\t\t'Server-Timing': getServerTimeHeader(timings),\n\t\t\t},\n\t\t},\n\t)\n}\n\nexport const headers: HeadersFunction = ({ loaderHeaders, parentHeaders }) => {\n\tconst headers = {\n\t\t'Cache-Control': loaderHeaders.get('Cache-Control') ?? '',\n\t\t'Server-Timing': combineServerTimings(loaderHeaders, parentHeaders),\n\t}\n\treturn headers\n}\n\nconst mdxComponents = { h1: () => null }\nexport default function ExerciseFinished() {\n\tconst data = useLoaderData<typeof loader>()\n\tconst exerciseNumber = data.exercise.exerciseNumber\n\t\t.toString()\n\t\t.padStart(2, '0')\n\n\tuseRevalidationWS({\n\t\twatchPaths: [`./exercises/${exerciseNumber}/FINISHED.mdx`],\n\t})\n\n\treturn (\n\t\t<div className=\"flex max-w-full flex-grow flex-col\">\n\t\t\t<main className=\"flex flex-grow flex-col sm:grid sm:h-full sm:min-h-[800px] sm:grid-cols-1 sm:grid-rows-2 md:min-h-[unset] lg:grid-cols-2 lg:grid-rows-1\">\n\t\t\t\t<div className=\"relative flex flex-col sm:col-span-1 sm:row-span-1 sm:h-full lg:border-r\">\n\t\t\t\t\t<h1 className=\"h-14 border-b pl-10 pr-5 text-sm font-medium leading-tight\">\n\t\t\t\t\t\t<div className=\"flex h-14 flex-wrap items-center justify-between gap-x-2 py-2\">\n\t\t\t\t\t\t\t<div className=\"flex items-center justify-start gap-x-2\">\n\t\t\t\t\t\t\t\t<Link to={`/${exerciseNumber}`} className=\"hover:underline\">\n\t\t\t\t\t\t\t\t\t{`${exerciseNumber}. ${data.exercise.title}`}\n\t\t\t\t\t\t\t\t</Link>\n\t\t\t\t\t\t\t\t<span>/</span>\n\t\t\t\t\t\t\t\t<span>Elaboration</span>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</h1>\n\n\t\t\t\t\t<article\n\t\t\t\t\t\tclassName=\"shadow-on-scrollbox h-full w-full max-w-none flex-1 scroll-pt-6 space-y-6 overflow-y-auto p-2 scrollbar-thin scrollbar-thumb-scrollbar sm:p-10 sm:pt-8\"\n\t\t\t\t\t\tid={data.articleId}\n\t\t\t\t\t>\n\t\t\t\t\t\t{data.exercise.finishedCode ? (\n\t\t\t\t\t\t\t<EpicVideoInfoProvider\n\t\t\t\t\t\t\t\tepicVideoInfosPromise={data.epicVideoInfosPromise}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<div className=\"prose dark:prose-invert sm:prose-lg\">\n\t\t\t\t\t\t\t\t\t<Mdx\n\t\t\t\t\t\t\t\t\t\tcode={data.exercise.finishedCode}\n\t\t\t\t\t\t\t\t\t\tcomponents={mdxComponents}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</EpicVideoInfoProvider>\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t// TODO: render a random dad joke...\n\t\t\t\t\t\t\t'No finished instructions yet...'\n\t\t\t\t\t\t)}\n\t\t\t\t\t</article>\n\t\t\t\t\t<ElementScrollRestoration elementQuery={`#${data.articleId}`} />\n\t\t\t\t\t<ProgressToggle\n\t\t\t\t\t\ttype=\"finished\"\n\t\t\t\t\t\texerciseNumber={data.exercise.exerciseNumber}\n\t\t\t\t\t\tclassName=\"h-14 border-t px-6\"\n\t\t\t\t\t/>\n\t\t\t\t\t<div className=\"flex h-16 justify-between border-b-4 border-t lg:border-b-0\">\n\t\t\t\t\t\t<div />\n\t\t\t\t\t\t<EditFileOnGitHub\n\t\t\t\t\t\t\tfile={data.exerciseFinished.file}\n\t\t\t\t\t\t\trelativePath={data.exerciseFinished.relativePath}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<NavChevrons prev={data.prevStepLink} next={data.nextStepLink} />\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t\t<Survey\n\t\t\t\t\texerciseFormEmbedUrl={data.exerciseFormEmbedUrl}\n\t\t\t\t\texerciseTitle={data.exercise.title}\n\t\t\t\t/>\n\t\t\t</main>\n\t\t</div>\n\t)\n}\n\nfunction Survey({\n\texerciseFormEmbedUrl,\n\texerciseTitle,\n}: {\n\texerciseFormEmbedUrl: string\n\texerciseTitle: string\n}) {\n\tconst theme = useTheme()\n\tconst [iframeLoaded, setIframeLoaded] = React.useState(false)\n\tconst isOnline = useIsOnline()\n\tif (!isOnline) {\n\t\treturn (\n\t\t\t<div className=\"relative flex-shrink-0\">\n\t\t\t\t<div className=\"absolute inset-0 z-10 flex items-center justify-center text-body-md text-foreground-destructive\">\n\t\t\t\t\t<Icon name=\"WifiNoConnection\" size=\"xl\">\n\t\t\t\t\t\t<span>\n\t\t\t\t\t\t\t{'Unable to load the '}\n\t\t\t\t\t\t\t<a href={exerciseFormEmbedUrl} className=\"underline\">\n\t\t\t\t\t\t\t\t{`${exerciseTitle} feedback form`}\n\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t\t{' when offline'}\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</Icon>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t)\n\t}\n\treturn (\n\t\t<div className=\"relative min-h-full sm:min-h-[unset] sm:flex-shrink-0\">\n\t\t\t{!iframeLoaded ? (\n\t\t\t\t<div className=\"absolute inset-0 z-10 flex items-center justify-center\">\n\t\t\t\t\t<Loading>\n\t\t\t\t\t\t<span>Loading {exerciseTitle} Elaboration form</span>\n\t\t\t\t\t</Loading>\n\t\t\t\t</div>\n\t\t\t) : null}\n\t\t\t<iframe\n\t\t\t\tonLoad={() => setIframeLoaded(true)}\n\t\t\t\t// show what would have shown if there is an error\n\t\t\t\tonError={() => setIframeLoaded(true)}\n\t\t\t\ttitle=\"Elaboration\"\n\t\t\t\tsrc={exerciseFormEmbedUrl}\n\t\t\t\tclassName={cn(\n\t\t\t\t\t'absolute inset-0 flex h-full w-full transition-opacity duration-300',\n\t\t\t\t\tiframeLoaded ? 'opacity-100' : 'opacity-0',\n\t\t\t\t)}\n\t\t\t\tstyle={{ colorScheme: theme }}\n\t\t\t/>\n\t\t</div>\n\t)\n}\n"],"names":["meta","data","matches","number","exercise","exerciseNumber","toString","padStart","rootData","find","m","id","title","getSeoMetaTags","workshopTitle","description","ogTitle","ogDescription","Number","instructor","requestInfo","mdxComponents","h1","ExerciseFinished","useLoaderData","useRevalidationWS","watchPaths","className","children","jsxs","jsx","Link","to","articleId","finishedCode","EpicVideoInfoProvider","epicVideoInfosPromise","Mdx","code","components","ElementScrollRestoration","elementQuery","ProgressToggle","type","EditFileOnGitHub","file","exerciseFinished","relativePath","NavChevrons","prev","prevStepLink","next","nextStepLink","Survey","exerciseFormEmbedUrl","exerciseTitle","theme","useTheme","iframeLoaded","setIframeLoaded","React","useIsOnline","Loading","onLoad","onError","src","cn","style","colorScheme","Icon","name","size","href"],"mappings":"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"}
1
+ {"version":3,"file":"_exerciseNumber_.finished-Y4uCc3KH.js","sources":["../../../app/routes/_app+/exercise+/$exerciseNumber_.finished.tsx"],"sourcesContent":["import path from 'path'\nimport { invariantResponse } from '@epic-web/invariant'\nimport { ElementScrollRestoration } from '@epic-web/restore-scroll'\nimport {\n\tgetAppPageRoute,\n\tgetApps,\n\tgetExercise,\n\tgetWorkshopRoot,\n\tisExerciseStepApp,\n} from '@epic-web/workshop-utils/apps.server'\nimport { getWorkshopConfig } from '@epic-web/workshop-utils/config.server'\nimport { getEpicVideoInfos } from '@epic-web/workshop-utils/epic-api.server'\nimport {\n\tcombineServerTimings,\n\tgetServerTimeHeader,\n\tmakeTimings,\n} from '@epic-web/workshop-utils/timing.server'\nimport {\n\tunstable_data as data,\n\ttype HeadersFunction,\n\ttype LoaderFunctionArgs,\n\ttype MetaFunction,\n} from '@remix-run/node'\nimport { Link, useLoaderData } from '@remix-run/react'\nimport slugify from '@sindresorhus/slugify'\nimport * as React from 'react'\nimport { EpicVideoInfoProvider } from '#app/components/epic-video.tsx'\nimport { Icon } from '#app/components/icons.tsx'\nimport { Loading } from '#app/components/loading.tsx'\nimport { NavChevrons } from '#app/components/nav-chevrons.tsx'\nimport { useRevalidationWS } from '#app/components/revalidation-ws.js'\nimport { type loader as rootLoader } from '#app/root.tsx'\nimport { EditFileOnGitHub } from '#app/routes/launch-editor.tsx'\nimport { ProgressToggle } from '#app/routes/progress.tsx'\nimport { useTheme } from '#app/routes/theme/index.tsx'\nimport { Mdx } from '#app/utils/mdx.tsx'\nimport { cn } from '#app/utils/misc.tsx'\nimport { useIsOnline } from '#app/utils/online.ts'\nimport { getSeoMetaTags } from '#app/utils/seo.js'\n\nexport const meta: MetaFunction<typeof loader, { root: typeof rootLoader }> = ({\n\tdata,\n\tmatches,\n}) => {\n\tconst number = data?.exercise.exerciseNumber.toString().padStart(2, '0')\n\n\tconst rootData = matches.find((m) => m.id === 'root')?.data\n\tif (!data || !rootData) return [{ title: '🦉 | Error' }]\n\n\treturn getSeoMetaTags({\n\t\ttitle: `🦉 | ${number}. ${data.exercise.title} | ${rootData?.workshopTitle}`,\n\t\tdescription: `Elaboration for ${number}. ${data.exercise.title}`,\n\t\togTitle: `Finished: ${data.exercise.title}`,\n\t\togDescription: `Elaboration for exercise ${Number(number)}`,\n\t\tinstructor: rootData.instructor,\n\t\trequestInfo: rootData.requestInfo,\n\t})\n}\n\nexport async function loader({ request, params }: LoaderFunctionArgs) {\n\tconst timings = makeTimings('exerciseFinishedLoader')\n\tinvariantResponse(params.exerciseNumber, 'exerciseNumber is required')\n\tconst exercise = await getExercise(params.exerciseNumber, {\n\t\ttimings,\n\t\trequest,\n\t})\n\tif (!exercise) {\n\t\tthrow new Response('Not found', { status: 404 })\n\t}\n\tconst workshopConfig = getWorkshopConfig()\n\tconst exerciseFormTemplate = workshopConfig.forms.exercise\n\tconst exerciseFormEmbedUrl = exerciseFormTemplate\n\t\t.replace('{workshopTitle}', encodeURIComponent(workshopConfig.title))\n\t\t.replace('{exerciseTitle}', encodeURIComponent(exercise.title))\n\tconst nextExercise = await getExercise(exercise.exerciseNumber + 1, {\n\t\ttimings,\n\t\trequest,\n\t})\n\n\tconst finishedFilepath = path.join(\n\t\tgetWorkshopRoot(),\n\t\t'exercises',\n\t\texercise.dirName,\n\t\t'FINISHED.mdx',\n\t)\n\n\tconst apps = await getApps({ request, timings })\n\tconst exerciseApps = apps\n\t\t.filter(isExerciseStepApp)\n\t\t.filter((app) => app.exerciseNumber === exercise.exerciseNumber)\n\tconst prevApp = exerciseApps[exerciseApps.length - 1]\n\n\tconst articleId = `workshop-${slugify(workshopConfig.title)}-${\n\t\texercise.exerciseNumber\n\t}-finished`\n\n\treturn data(\n\t\t{\n\t\t\tarticleId,\n\t\t\tworkshopTitle: workshopConfig.title,\n\t\t\texercise,\n\t\t\texerciseFormEmbedUrl,\n\t\t\tepicVideoInfosPromise: getEpicVideoInfos(\n\t\t\t\texercise.finishedEpicVideoEmbeds,\n\t\t\t\t{ request },\n\t\t\t),\n\t\t\texerciseFinished: {\n\t\t\t\tfile: finishedFilepath,\n\t\t\t\trelativePath: `exercises/${exercise.dirName}/FINISHED.mdx`,\n\t\t\t},\n\t\t\tprevStepLink: prevApp\n\t\t\t\t? {\n\t\t\t\t\t\tto: getAppPageRoute(prevApp),\n\t\t\t\t\t\t'aria-label': `${prevApp.title} (${prevApp.type})`,\n\t\t\t\t\t}\n\t\t\t\t: null,\n\t\t\tnextStepLink: nextExercise\n\t\t\t\t? {\n\t\t\t\t\t\tto: `/exercise/${nextExercise.exerciseNumber.toString().padStart(2, '0')}`,\n\t\t\t\t\t\t'aria-label': `${nextExercise.title}`,\n\t\t\t\t\t}\n\t\t\t\t: {\n\t\t\t\t\t\tto: '/finished',\n\t\t\t\t\t\t'aria-label': 'Finished! 🎉',\n\t\t\t\t\t},\n\t\t},\n\t\t{\n\t\t\theaders: {\n\t\t\t\t'Server-Timing': getServerTimeHeader(timings),\n\t\t\t},\n\t\t},\n\t)\n}\n\nexport const headers: HeadersFunction = ({ loaderHeaders, parentHeaders }) => {\n\tconst headers = {\n\t\t'Cache-Control': loaderHeaders.get('Cache-Control') ?? '',\n\t\t'Server-Timing': combineServerTimings(loaderHeaders, parentHeaders),\n\t}\n\treturn headers\n}\n\nconst mdxComponents = { h1: () => null }\nexport default function ExerciseFinished() {\n\tconst data = useLoaderData<typeof loader>()\n\tconst exerciseNumber = data.exercise.exerciseNumber\n\t\t.toString()\n\t\t.padStart(2, '0')\n\n\tuseRevalidationWS({\n\t\twatchPaths: [`./exercises/${exerciseNumber}/FINISHED.mdx`],\n\t})\n\n\treturn (\n\t\t<div className=\"flex max-w-full flex-grow flex-col\">\n\t\t\t<main className=\"flex flex-grow flex-col sm:grid sm:h-full sm:min-h-[800px] sm:grid-cols-1 sm:grid-rows-2 md:min-h-[unset] lg:grid-cols-2 lg:grid-rows-1\">\n\t\t\t\t<div className=\"relative flex flex-col sm:col-span-1 sm:row-span-1 sm:h-full lg:border-r\">\n\t\t\t\t\t<h1 className=\"h-14 border-b pl-10 pr-5 text-sm font-medium leading-tight\">\n\t\t\t\t\t\t<div className=\"flex h-14 flex-wrap items-center justify-between gap-x-2 py-2\">\n\t\t\t\t\t\t\t<div className=\"flex items-center justify-start gap-x-2\">\n\t\t\t\t\t\t\t\t<Link to={`/${exerciseNumber}`} className=\"hover:underline\">\n\t\t\t\t\t\t\t\t\t{`${exerciseNumber}. ${data.exercise.title}`}\n\t\t\t\t\t\t\t\t</Link>\n\t\t\t\t\t\t\t\t<span>/</span>\n\t\t\t\t\t\t\t\t<span>Elaboration</span>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</h1>\n\n\t\t\t\t\t<article\n\t\t\t\t\t\tclassName=\"shadow-on-scrollbox h-full w-full max-w-none flex-1 scroll-pt-6 space-y-6 overflow-y-auto p-2 scrollbar-thin scrollbar-thumb-scrollbar sm:p-10 sm:pt-8\"\n\t\t\t\t\t\tid={data.articleId}\n\t\t\t\t\t>\n\t\t\t\t\t\t{data.exercise.finishedCode ? (\n\t\t\t\t\t\t\t<EpicVideoInfoProvider\n\t\t\t\t\t\t\t\tepicVideoInfosPromise={data.epicVideoInfosPromise}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<div className=\"prose dark:prose-invert sm:prose-lg\">\n\t\t\t\t\t\t\t\t\t<Mdx\n\t\t\t\t\t\t\t\t\t\tcode={data.exercise.finishedCode}\n\t\t\t\t\t\t\t\t\t\tcomponents={mdxComponents}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</EpicVideoInfoProvider>\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t// TODO: render a random dad joke...\n\t\t\t\t\t\t\t'No finished instructions yet...'\n\t\t\t\t\t\t)}\n\t\t\t\t\t</article>\n\t\t\t\t\t<ElementScrollRestoration elementQuery={`#${data.articleId}`} />\n\t\t\t\t\t<ProgressToggle\n\t\t\t\t\t\ttype=\"finished\"\n\t\t\t\t\t\texerciseNumber={data.exercise.exerciseNumber}\n\t\t\t\t\t\tclassName=\"h-14 border-t px-6\"\n\t\t\t\t\t/>\n\t\t\t\t\t<div className=\"flex h-16 justify-between border-b-4 border-t lg:border-b-0\">\n\t\t\t\t\t\t<div />\n\t\t\t\t\t\t<EditFileOnGitHub\n\t\t\t\t\t\t\tfile={data.exerciseFinished.file}\n\t\t\t\t\t\t\trelativePath={data.exerciseFinished.relativePath}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<NavChevrons prev={data.prevStepLink} next={data.nextStepLink} />\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t\t<Survey\n\t\t\t\t\texerciseFormEmbedUrl={data.exerciseFormEmbedUrl}\n\t\t\t\t\texerciseTitle={data.exercise.title}\n\t\t\t\t/>\n\t\t\t</main>\n\t\t</div>\n\t)\n}\n\nfunction Survey({\n\texerciseFormEmbedUrl,\n\texerciseTitle,\n}: {\n\texerciseFormEmbedUrl: string\n\texerciseTitle: string\n}) {\n\tconst theme = useTheme()\n\tconst [iframeLoaded, setIframeLoaded] = React.useState(false)\n\tconst isOnline = useIsOnline()\n\tif (!isOnline) {\n\t\treturn (\n\t\t\t<div className=\"relative flex-shrink-0\">\n\t\t\t\t<div className=\"absolute inset-0 z-10 flex items-center justify-center text-body-md text-foreground-destructive\">\n\t\t\t\t\t<Icon name=\"WifiNoConnection\" size=\"xl\">\n\t\t\t\t\t\t<span>\n\t\t\t\t\t\t\t{'Unable to load the '}\n\t\t\t\t\t\t\t<a href={exerciseFormEmbedUrl} className=\"underline\">\n\t\t\t\t\t\t\t\t{`${exerciseTitle} feedback form`}\n\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t\t{' when offline'}\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</Icon>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t)\n\t}\n\treturn (\n\t\t<div className=\"relative min-h-full sm:min-h-[unset] sm:flex-shrink-0\">\n\t\t\t{!iframeLoaded ? (\n\t\t\t\t<div className=\"absolute inset-0 z-10 flex items-center justify-center\">\n\t\t\t\t\t<Loading>\n\t\t\t\t\t\t<span>Loading {exerciseTitle} Elaboration form</span>\n\t\t\t\t\t</Loading>\n\t\t\t\t</div>\n\t\t\t) : null}\n\t\t\t<iframe\n\t\t\t\tonLoad={() => setIframeLoaded(true)}\n\t\t\t\t// show what would have shown if there is an error\n\t\t\t\tonError={() => setIframeLoaded(true)}\n\t\t\t\ttitle=\"Elaboration\"\n\t\t\t\tsrc={exerciseFormEmbedUrl}\n\t\t\t\tclassName={cn(\n\t\t\t\t\t'absolute inset-0 flex h-full w-full transition-opacity duration-300',\n\t\t\t\t\tiframeLoaded ? 'opacity-100' : 'opacity-0',\n\t\t\t\t)}\n\t\t\t\tstyle={{ colorScheme: theme }}\n\t\t\t/>\n\t\t</div>\n\t)\n}\n"],"names":["meta","data","matches","number","exercise","exerciseNumber","toString","padStart","rootData","find","m","id","title","getSeoMetaTags","workshopTitle","description","ogTitle","ogDescription","Number","instructor","requestInfo","mdxComponents","h1","ExerciseFinished","useLoaderData","useRevalidationWS","watchPaths","className","children","jsxs","jsx","Link","to","articleId","finishedCode","EpicVideoInfoProvider","epicVideoInfosPromise","Mdx","code","components","ElementScrollRestoration","elementQuery","ProgressToggle","type","EditFileOnGitHub","file","exerciseFinished","relativePath","NavChevrons","prev","prevStepLink","next","nextStepLink","Survey","exerciseFormEmbedUrl","exerciseTitle","theme","useTheme","iframeLoaded","setIframeLoaded","React","useIsOnline","Loading","onLoad","onError","src","cn","style","colorScheme","Icon","name","size","href"],"mappings":"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"}
@@ -1,5 +1,5 @@
1
- import{r as i,j as c,B as ke,O as kt}from"./index-CGzylDPY.js";import{E as Ft}from"./index-egcHQOpF.js";import{G as Mt}from"./error-boundary-CAu3AmhN.js";import{N as $t}from"./nav-chevrons-DCuva9-Q.js";import{u as Bt}from"./revalidation-ws-BoJZTvOQ.js";import{M as Ut,L as Q,E as Wt}from"./mdx-CnaWQCDw.js";import{P as Ht}from"./progress-DwE8EkAa.js";import{S as Fe}from"./set-playground-IUJCGVu2.js";import{b as Vt,a as Se,I as se,i as Yt,f as zt}from"./misc-CQmANiHr.js";import{g as Kt}from"./seo-pBpFCWsy.js";import{E as Xt}from"./epic-video-BQtjG_Y0.js";import{S as ce,u as Gt,d as Zt,o as qt,s as Qt,f as Jt,e as en,g as tn,h as nn,l as rn}from"./tooltip-Cd0yJoQb.js";import{a as on}from"./index-CMYl882D.js";import{u as U,L as M,e as sn,r as an,R as cn,A as ln}from"./components-DrvY4pal.js";import{c as un,_ as dn,u as fn,a as F,f as pn,z as mn,s as hn,b as vn,R as gn,e as xn,h as En}from"./index-BncqUVfr.js";import"./progress-bar-ZCHf2Y4W.js";import"./pe-DXT2FOp1.js";import"./index-CSGHuBiw.js";import"./online-BsTX44az.js";import"./loading-CPEkK5hO.js";import"./user-C0j04V55.js";import"./workshop-config-oL_FWDKq.js";const Me=i.createContext(null);function bn(){const e=i.useContext(Me);if(!e)throw new Error("useStepContext must be used within a StepContext.Provider");return e}function Pn({children:e,inBrowserBrowserRef:t}){return c.jsx(Me.Provider,{value:{inBrowserBrowserRef:t},children:e})}const yn={DiffLink:le,PrevDiffLink:Cn,NextDiffLink:Sn,InlineFile:Nn,LinkToApp:An};function wn({inBrowserBrowserRef:e}){const t=U();return t.exerciseStepApp.instructionsCode?c.jsx(Pn,{inBrowserBrowserRef:e,children:c.jsx(Xt,{epicVideoInfosPromise:t.epicVideoInfosPromise,children:c.jsx("div",{className:"prose dark:prose-invert sm:prose-lg",children:c.jsx(Ut,{code:t.exerciseStepApp.instructionsCode,components:yn})})})}):null}function $e(e,t,n){const r=new URLSearchParams(e);return n===null?r.delete(t):r.set(t,n),r}function Sn({app:e=0,fullPage:t=!1,children:n}){return c.jsx(le,{app1:e,app2:e+1,fullPage:t,children:n})}function Cn({app:e=-1,fullPage:t=!1,children:n}){return c.jsx(le,{app1:e,app2:e+1,fullPage:t,children:n})}function le({app1:e=0,app2:t=1,children:n,fullPage:r=!1,to:o}){const s=U();if(!o&&!e&&!t)return c.jsx("callout-danger",{className:"notification",children:c.jsx("div",{className:"title",children:"DiffLink Error: invalid input"})});function l(p){var m;if(typeof p=="number"){const h=s.exerciseIndex+p;return(m=s.allApps[h])==null?void 0:m.name}if(!p)return null;for(const{name:h,stepName:v}of s.allApps)if(p===h||p===v)return h;return null}if(o){const p=new URLSearchParams(o);e=p.get("app1"),t=p.get("app2")}const a=l(e),d=l(t);if(!a||!d)return c.jsxs("callout-danger",{className:"notification",children:[c.jsx("div",{className:"title",children:"DiffLink Error: invalid input"}),!a&&c.jsxs("div",{children:['app1: "',e,'" is not a valid app name']}),!d&&c.jsxs("div",{children:['app2: "',t,'" is not a valid app name']})]});o||(o=`app1=${a}&app2=${d}`);const u=r?`/diff?${o}`:`?${decodeURIComponent($e(new URLSearchParams,"preview",`diff&${o}`).toString())}`;return n||(n=c.jsxs("span",{children:["Go to Diff ",r?"":"Preview"," from: ",c.jsx("code",{children:a})," to:"," ",c.jsx("code",{children:d})]})),c.jsx(M,{to:u,children:n})}function Nn({file:e,type:t="playground",children:n=c.jsx("code",{children:e}),...r}){const o=U(),s=o[t]||o[o.type],l=c.jsxs("div",{className:"launch-editor-button-wrapper flex underline underline-offset-4",children:[n," ",c.jsx("svg",{height:24,width:24,children:c.jsx("use",{href:`${Yt}#Keyboard`})})]});return ENV.EPICSHOP_DEPLOYED&&s?c.jsx("div",{className:"inline-block grow",children:c.jsx(Q,{appFile:e,appName:s.name,...r,children:l})}):s?c.jsx("div",{className:"inline-block grow",children:c.jsx(Q,{appFile:e,appName:s.name,...r,children:l})}):t==="playground"?c.jsx(ce,{content:"You must 'Set to Playground' before opening a file",children:c.jsx("div",{className:"inline-block grow cursor-not-allowed",children:l})}):c.jsx(c.Fragment,{children:"children"})}function Rn(e){return e==="problem"?"problem":e==="solution"?"solution":"playground"}function An({to:e,children:t=c.jsx("code",{children:e.toString()}),...n}){var h;const[r]=sn(),o=`?${$e(r,"pathname",e.toString()).toString()}`,s=U(),l=Rn(r.get("preview")),a=on(),d=s[l],u=(d==null?void 0:d.dev.type)==="script"?Vt({domain:a.domain,port:d.dev.portNumber}):((h=s.playground)==null?void 0:h.dev.type)==="browser"?s.playground.dev.pathname:null,{inBrowserBrowserRef:p}=bn(),m=u?u.slice(0,-1)+e.toString():null;return c.jsxs("div",{className:"inline-flex items-center justify-between gap-1",children:[c.jsx(M,{to:o,...n,className:Se(n.className,{"cursor-not-allowed":ENV.EPICSHOP_DEPLOYED}),title:ENV.EPICSHOP_DEPLOYED?"Cannot link to app in deployed version":void 0,onClick:v=>{var E,f;ENV.EPICSHOP_DEPLOYED&&v.preventDefault(),(E=n.onClick)==null||E.call(n,v),(f=p.current)==null||f.handleExtrnalNavigation(e.toString())},children:t}),m?c.jsx(ce,{content:"Open in new tab",children:c.jsx("a",{href:m,target:"_blank",rel:"noreferrer",className:Se("flex aspect-square items-center justify-center",{"cursor-not-allowed":ENV.EPICSHOP_DEPLOYED}),title:ENV.EPICSHOP_DEPLOYED?"Cannot link to app in deployed version":"Open in new tab",onClick:v=>{ENV.EPICSHOP_DEPLOYED&&v.preventDefault()},children:c.jsx(se,{name:"ExternalLink"})})}):null]})}function j(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e==null||e(o),n===!1||!o.defaultPrevented)return t==null?void 0:t(o)}}function Ce(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Be(...e){return t=>{let n=!1;const r=e.map(o=>{const s=Ce(o,t);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let o=0;o<r.length;o++){const s=r[o];typeof s=="function"?s():Ce(e[o],null)}}}}function L(...e){return i.useCallback(Be(...e),e)}function Ue(e,t=[]){let n=[];function r(s,l){const a=i.createContext(l),d=n.length;n=[...n,l];const u=m=>{var x;const{scope:h,children:v,...E}=m,f=((x=h==null?void 0:h[e])==null?void 0:x[d])||a,g=i.useMemo(()=>E,Object.values(E));return c.jsx(f.Provider,{value:g,children:v})};u.displayName=s+"Provider";function p(m,h){var f;const v=((f=h==null?void 0:h[e])==null?void 0:f[d])||a,E=i.useContext(v);if(E)return E;if(l!==void 0)return l;throw new Error(`\`${m}\` must be used within \`${s}\``)}return[u,p]}const o=()=>{const s=n.map(l=>i.createContext(l));return function(a){const d=(a==null?void 0:a[e])||s;return i.useMemo(()=>({[`__scope${e}`]:{...a,[e]:d}}),[a,d])}};return o.scopeName=e,[r,jn(o,...t)]}function jn(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(s){const l=r.reduce((a,{useScope:d,scopeName:u})=>{const m=d(s)[`__scope${u}`];return{...a,...m}},{});return i.useMemo(()=>({[`__scope${t.scopeName}`]:l}),[l])}};return n.scopeName=t.scopeName,n}function We(e){const t=On(e),n=i.forwardRef((r,o)=>{const{children:s,...l}=r,a=i.Children.toArray(s),d=a.find(Dn);if(d){const u=d.props.children,p=a.map(m=>m===d?i.Children.count(u)>1?i.Children.only(null):i.isValidElement(u)?u.props.children:null:m);return c.jsx(t,{...l,ref:o,children:i.isValidElement(u)?i.cloneElement(u,void 0,p):null})}return c.jsx(t,{...l,ref:o,children:s})});return n.displayName=`${e}.Slot`,n}function On(e){const t=i.forwardRef((n,r)=>{const{children:o,...s}=n;if(i.isValidElement(o)){const l=In(o),a=Tn(s,o.props);return o.type!==i.Fragment&&(a.ref=r?Be(r,l):l),i.cloneElement(o,a)}return i.Children.count(o)>1?i.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Ln=Symbol("radix.slottable");function Dn(e){return i.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Ln}function Tn(e,t){const n={...t};for(const r in t){const o=e[r],s=t[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...a)=>{const d=s(...a);return o(...a),d}:o&&(n[r]=o):r==="style"?n[r]={...o,...s}:r==="className"&&(n[r]=[o,s].filter(Boolean).join(" "))}return{...e,...n}}function In(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var _n=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],R=_n.reduce((e,t)=>{const n=We(`Primitive.${t}`),r=i.forwardRef((o,s)=>{const{asChild:l,...a}=o,d=l?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),c.jsx(d,{...a,ref:s})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function kn(e,t){e&&an.flushSync(()=>e.dispatchEvent(t))}function $(e){const t=i.useRef(e);return i.useEffect(()=>{t.current=e}),i.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function Fn(e,t=globalThis==null?void 0:globalThis.document){const n=$(e);i.useEffect(()=>{const r=o=>{o.key==="Escape"&&n(o)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var Mn="DismissableLayer",ie="dismissableLayer.update",$n="dismissableLayer.pointerDownOutside",Bn="dismissableLayer.focusOutside",Ne,He=i.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Ve=i.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:s,onInteractOutside:l,onDismiss:a,...d}=e,u=i.useContext(He),[p,m]=i.useState(null),h=(p==null?void 0:p.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,v]=i.useState({}),E=L(t,P=>m(P)),f=Array.from(u.layers),[g]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),x=f.indexOf(g),b=p?f.indexOf(p):-1,w=u.layersWithOutsidePointerEventsDisabled.size>0,y=b>=x,S=Hn(P=>{const N=P.target,T=[...u.branches].some(W=>W.contains(N));!y||T||(o==null||o(P),l==null||l(P),P.defaultPrevented||a==null||a())},h),C=Vn(P=>{const N=P.target;[...u.branches].some(W=>W.contains(N))||(s==null||s(P),l==null||l(P),P.defaultPrevented||a==null||a())},h);return Fn(P=>{b===u.layers.size-1&&(r==null||r(P),!P.defaultPrevented&&a&&(P.preventDefault(),a()))},h),i.useEffect(()=>{if(p)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(Ne=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(p)),u.layers.add(p),Re(),()=>{n&&u.layersWithOutsidePointerEventsDisabled.size===1&&(h.body.style.pointerEvents=Ne)}},[p,h,n,u]),i.useEffect(()=>()=>{p&&(u.layers.delete(p),u.layersWithOutsidePointerEventsDisabled.delete(p),Re())},[p,u]),i.useEffect(()=>{const P=()=>v({});return document.addEventListener(ie,P),()=>document.removeEventListener(ie,P)},[]),c.jsx(R.div,{...d,ref:E,style:{pointerEvents:w?y?"auto":"none":void 0,...e.style},onFocusCapture:j(e.onFocusCapture,C.onFocusCapture),onBlurCapture:j(e.onBlurCapture,C.onBlurCapture),onPointerDownCapture:j(e.onPointerDownCapture,S.onPointerDownCapture)})});Ve.displayName=Mn;var Un="DismissableLayerBranch",Wn=i.forwardRef((e,t)=>{const n=i.useContext(He),r=i.useRef(null),o=L(t,r);return i.useEffect(()=>{const s=r.current;if(s)return n.branches.add(s),()=>{n.branches.delete(s)}},[n.branches]),c.jsx(R.div,{...e,ref:o})});Wn.displayName=Un;function Hn(e,t=globalThis==null?void 0:globalThis.document){const n=$(e),r=i.useRef(!1),o=i.useRef(()=>{});return i.useEffect(()=>{const s=a=>{if(a.target&&!r.current){let d=function(){Ye($n,n,u,{discrete:!0})};const u={originalEvent:a};a.pointerType==="touch"?(t.removeEventListener("click",o.current),o.current=d,t.addEventListener("click",o.current,{once:!0})):d()}else t.removeEventListener("click",o.current);r.current=!1},l=window.setTimeout(()=>{t.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(l),t.removeEventListener("pointerdown",s),t.removeEventListener("click",o.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function Vn(e,t=globalThis==null?void 0:globalThis.document){const n=$(e),r=i.useRef(!1);return i.useEffect(()=>{const o=s=>{s.target&&!r.current&&Ye(Bn,n,{originalEvent:s},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function Re(){const e=new CustomEvent(ie);document.dispatchEvent(e)}function Ye(e,t,n,{discrete:r}){const o=n.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?kn(o,s):o.dispatchEvent(s)}var te=0;function Yn(){i.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??Ae()),document.body.insertAdjacentElement("beforeend",e[1]??Ae()),te++,()=>{te===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),te--}},[])}function Ae(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var ne="focusScope.autoFocusOnMount",re="focusScope.autoFocusOnUnmount",je={bubbles:!1,cancelable:!0},zn="FocusScope",ze=i.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:s,...l}=e,[a,d]=i.useState(null),u=$(o),p=$(s),m=i.useRef(null),h=L(t,f=>d(f)),v=i.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;i.useEffect(()=>{if(r){let f=function(w){if(v.paused||!a)return;const y=w.target;a.contains(y)?m.current=y:A(m.current,{select:!0})},g=function(w){if(v.paused||!a)return;const y=w.relatedTarget;y!==null&&(a.contains(y)||A(m.current,{select:!0}))},x=function(w){if(document.activeElement===document.body)for(const S of w)S.removedNodes.length>0&&A(a)};document.addEventListener("focusin",f),document.addEventListener("focusout",g);const b=new MutationObserver(x);return a&&b.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",f),document.removeEventListener("focusout",g),b.disconnect()}}},[r,a,v.paused]),i.useEffect(()=>{if(a){Le.add(v);const f=document.activeElement;if(!a.contains(f)){const x=new CustomEvent(ne,je);a.addEventListener(ne,u),a.dispatchEvent(x),x.defaultPrevented||(Kn(Qn(Ke(a)),{select:!0}),document.activeElement===f&&A(a))}return()=>{a.removeEventListener(ne,u),setTimeout(()=>{const x=new CustomEvent(re,je);a.addEventListener(re,p),a.dispatchEvent(x),x.defaultPrevented||A(f??document.body,{select:!0}),a.removeEventListener(re,p),Le.remove(v)},0)}}},[a,u,p,v]);const E=i.useCallback(f=>{if(!n&&!r||v.paused)return;const g=f.key==="Tab"&&!f.altKey&&!f.ctrlKey&&!f.metaKey,x=document.activeElement;if(g&&x){const b=f.currentTarget,[w,y]=Xn(b);w&&y?!f.shiftKey&&x===y?(f.preventDefault(),n&&A(w,{select:!0})):f.shiftKey&&x===w&&(f.preventDefault(),n&&A(y,{select:!0})):x===b&&f.preventDefault()}},[n,r,v.paused]);return c.jsx(R.div,{tabIndex:-1,...l,ref:h,onKeyDown:E})});ze.displayName=zn;function Kn(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(A(r,{select:t}),document.activeElement!==n)return}function Xn(e){const t=Ke(e),n=Oe(t,e),r=Oe(t.reverse(),e);return[n,r]}function Ke(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const o=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||o?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Oe(e,t){for(const n of e)if(!Gn(n,{upTo:t}))return n}function Gn(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function Zn(e){return e instanceof HTMLInputElement&&"select"in e}function A(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&Zn(e)&&t&&e.select()}}var Le=qn();function qn(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=De(e,t),e.unshift(t)},remove(t){var n;e=De(e,t),(n=e[0])==null||n.resume()}}}function De(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function Qn(e){return e.filter(t=>t.tagName!=="A")}var O=globalThis!=null&&globalThis.document?i.useLayoutEffect:()=>{},Jn=ke[" useId ".trim().toString()]||(()=>{}),er=0;function tr(e){const[t,n]=i.useState(Jn());return O(()=>{e||n(r=>r??String(er++))},[e]),e||(t?`radix-${t}`:"")}var nr="Arrow",Xe=i.forwardRef((e,t)=>{const{children:n,width:r=10,height:o=5,...s}=e;return c.jsx(R.svg,{...s,ref:t,width:r,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:c.jsx("polygon",{points:"0,0 30,0 15,10"})})});Xe.displayName=nr;var rr=Xe;function or(e){const[t,n]=i.useState(void 0);return O(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const s=o[0];let l,a;if("borderBoxSize"in s){const d=s.borderBoxSize,u=Array.isArray(d)?d[0]:d;l=u.inlineSize,a=u.blockSize}else l=e.offsetWidth,a=e.offsetHeight;n({width:l,height:a})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var ue="Popper",[Ge,Ze]=Ue(ue),[sr,qe]=Ge(ue),Qe=e=>{const{__scopePopper:t,children:n}=e,[r,o]=i.useState(null);return c.jsx(sr,{scope:t,anchor:r,onAnchorChange:o,children:n})};Qe.displayName=ue;var Je="PopperAnchor",et=i.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...o}=e,s=qe(Je,n),l=i.useRef(null),a=L(t,l);return i.useEffect(()=>{s.onAnchorChange((r==null?void 0:r.current)||l.current)}),r?null:c.jsx(R.div,{...o,ref:a})});et.displayName=Je;var de="PopperContent",[ir,ar]=Ge(de),tt=i.forwardRef((e,t)=>{var ge,xe,Ee,be,Pe,ye;const{__scopePopper:n,side:r="bottom",sideOffset:o=0,align:s="center",alignOffset:l=0,arrowPadding:a=0,avoidCollisions:d=!0,collisionBoundary:u=[],collisionPadding:p=0,sticky:m="partial",hideWhenDetached:h=!1,updatePositionStrategy:v="optimized",onPlaced:E,...f}=e,g=qe(de,n),[x,b]=i.useState(null),w=L(t,H=>b(H)),[y,S]=i.useState(null),C=or(y),P=(C==null?void 0:C.width)??0,N=(C==null?void 0:C.height)??0,T=r+(s!=="center"?"-"+s:""),W=typeof p=="number"?p:{top:0,right:0,bottom:0,left:0,...p},me=Array.isArray(u)?u:[u],wt=me.length>0,Y={padding:W,boundary:me.filter(lr),altBoundary:wt},{refs:St,floatingStyles:he,placement:Ct,isPositioned:z,middlewareData:I}=Gt({strategy:"fixed",placement:T,whileElementsMounted:(...H)=>Zt(...H,{animationFrame:v==="always"}),elements:{reference:g.anchor},middleware:[qt({mainAxis:o+N,alignmentAxis:l}),d&&Qt({mainAxis:!0,crossAxis:!1,limiter:m==="partial"?rn():void 0,...Y}),d&&Jt({...Y}),en({...Y,apply:({elements:H,rects:we,availableWidth:Dt,availableHeight:Tt})=>{const{width:It,height:_t}=we.reference,X=H.floating.style;X.setProperty("--radix-popper-available-width",`${Dt}px`),X.setProperty("--radix-popper-available-height",`${Tt}px`),X.setProperty("--radix-popper-anchor-width",`${It}px`),X.setProperty("--radix-popper-anchor-height",`${_t}px`)}}),y&&tn({element:y,padding:a}),ur({arrowWidth:P,arrowHeight:N}),h&&nn({strategy:"referenceHidden",...Y})]}),[ve,Nt]=ot(Ct),K=$(E);O(()=>{z&&(K==null||K())},[z,K]);const Rt=(ge=I.arrow)==null?void 0:ge.x,At=(xe=I.arrow)==null?void 0:xe.y,jt=((Ee=I.arrow)==null?void 0:Ee.centerOffset)!==0,[Ot,Lt]=i.useState();return O(()=>{x&&Lt(window.getComputedStyle(x).zIndex)},[x]),c.jsx("div",{ref:St.setFloating,"data-radix-popper-content-wrapper":"",style:{...he,transform:z?he.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Ot,"--radix-popper-transform-origin":[(be=I.transformOrigin)==null?void 0:be.x,(Pe=I.transformOrigin)==null?void 0:Pe.y].join(" "),...((ye=I.hide)==null?void 0:ye.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:c.jsx(ir,{scope:n,placedSide:ve,onArrowChange:S,arrowX:Rt,arrowY:At,shouldHideArrow:jt,children:c.jsx(R.div,{"data-side":ve,"data-align":Nt,...f,ref:w,style:{...f.style,animation:z?void 0:"none"}})})})});tt.displayName=de;var nt="PopperArrow",cr={top:"bottom",right:"left",bottom:"top",left:"right"},rt=i.forwardRef(function(t,n){const{__scopePopper:r,...o}=t,s=ar(nt,r),l=cr[s.placedSide];return c.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[l]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:c.jsx(rr,{...o,ref:n,style:{...o.style,display:"block"}})})});rt.displayName=nt;function lr(e){return e!==null}var ur=e=>({name:"transformOrigin",options:e,fn(t){var g,x,b;const{placement:n,rects:r,middlewareData:o}=t,l=((g=o.arrow)==null?void 0:g.centerOffset)!==0,a=l?0:e.arrowWidth,d=l?0:e.arrowHeight,[u,p]=ot(n),m={start:"0%",center:"50%",end:"100%"}[p],h=(((x=o.arrow)==null?void 0:x.x)??0)+a/2,v=(((b=o.arrow)==null?void 0:b.y)??0)+d/2;let E="",f="";return u==="bottom"?(E=l?m:`${h}px`,f=`${-d}px`):u==="top"?(E=l?m:`${h}px`,f=`${r.floating.height+d}px`):u==="right"?(E=`${-d}px`,f=l?m:`${v}px`):u==="left"&&(E=`${r.floating.width+d}px`,f=l?m:`${v}px`),{data:{x:E,y:f}}}});function ot(e){const[t,n="center"]=e.split("-");return[t,n]}var dr=Qe,st=et,fr=tt,pr=rt,mr="Portal",it=i.forwardRef((e,t)=>{var a;const{container:n,...r}=e,[o,s]=i.useState(!1);O(()=>s(!0),[]);const l=n||o&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return l?cn.createPortal(c.jsx(R.div,{...r,ref:t}),l):null});it.displayName=mr;function hr(e,t){return i.useReducer((n,r)=>t[n][r]??n,e)}var fe=e=>{const{present:t,children:n}=e,r=vr(t),o=typeof n=="function"?n({present:r.isPresent}):i.Children.only(n),s=L(r.ref,gr(o));return typeof n=="function"||r.isPresent?i.cloneElement(o,{ref:s}):null};fe.displayName="Presence";function vr(e){const[t,n]=i.useState(),r=i.useRef(null),o=i.useRef(e),s=i.useRef("none"),l=e?"mounted":"unmounted",[a,d]=hr(l,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return i.useEffect(()=>{const u=G(r.current);s.current=a==="mounted"?u:"none"},[a]),O(()=>{const u=r.current,p=o.current;if(p!==e){const h=s.current,v=G(u);e?d("MOUNT"):v==="none"||(u==null?void 0:u.display)==="none"?d("UNMOUNT"):d(p&&h!==v?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,d]),O(()=>{if(t){let u;const p=t.ownerDocument.defaultView??window,m=v=>{const f=G(r.current).includes(v.animationName);if(v.target===t&&f&&(d("ANIMATION_END"),!o.current)){const g=t.style.animationFillMode;t.style.animationFillMode="forwards",u=p.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=g)})}},h=v=>{v.target===t&&(s.current=G(r.current))};return t.addEventListener("animationstart",h),t.addEventListener("animationcancel",m),t.addEventListener("animationend",m),()=>{p.clearTimeout(u),t.removeEventListener("animationstart",h),t.removeEventListener("animationcancel",m),t.removeEventListener("animationend",m)}}else d("ANIMATION_END")},[t,d]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:i.useCallback(u=>{r.current=u?getComputedStyle(u):null,n(u)},[])}}function G(e){return(e==null?void 0:e.animationName)||"none"}function gr(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var xr=ke[" useInsertionEffect ".trim().toString()]||O;function Er({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[o,s,l]=br({defaultProp:t,onChange:n}),a=e!==void 0,d=a?e:o;{const p=i.useRef(e!==void 0);i.useEffect(()=>{const m=p.current;m!==a&&console.warn(`${r} is changing from ${m?"controlled":"uncontrolled"} to ${a?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),p.current=a},[a,r])}const u=i.useCallback(p=>{var m;if(a){const h=Pr(p)?p(e):p;h!==e&&((m=l.current)==null||m.call(l,h))}else s(p)},[a,e,s,l]);return[d,u]}function br({defaultProp:e,onChange:t}){const[n,r]=i.useState(e),o=i.useRef(n),s=i.useRef(t);return xr(()=>{s.current=t},[t]),i.useEffect(()=>{var l;o.current!==n&&((l=s.current)==null||l.call(s,n),o.current=n)},[n,o]),[n,r,s]}function Pr(e){return typeof e=="function"}var at=un(),oe=function(){},J=i.forwardRef(function(e,t){var n=i.useRef(null),r=i.useState({onScrollCapture:oe,onWheelCapture:oe,onTouchMoveCapture:oe}),o=r[0],s=r[1],l=e.forwardProps,a=e.children,d=e.className,u=e.removeScrollBar,p=e.enabled,m=e.shards,h=e.sideCar,v=e.noRelative,E=e.noIsolation,f=e.inert,g=e.allowPinchZoom,x=e.as,b=x===void 0?"div":x,w=e.gapMode,y=dn(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),S=h,C=fn([n,t]),P=F(F({},y),o);return i.createElement(i.Fragment,null,p&&i.createElement(S,{sideCar:at,removeScrollBar:u,shards:m,noRelative:v,noIsolation:E,inert:f,setCallbacks:s,allowPinchZoom:!!g,lockRef:n,gapMode:w}),l?i.cloneElement(i.Children.only(a),F(F({},P),{ref:C})):i.createElement(b,F({},P,{className:d,ref:C}),a))});J.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};J.classNames={fullWidth:pn,zeroRight:mn};var ae=!1;if(typeof window<"u")try{var Z=Object.defineProperty({},"passive",{get:function(){return ae=!0,!0}});window.addEventListener("test",Z,Z),window.removeEventListener("test",Z,Z)}catch{ae=!1}var _=ae?{passive:!1}:!1,yr=function(e){return e.tagName==="TEXTAREA"},ct=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!yr(e)&&n[t]==="visible")},wr=function(e){return ct(e,"overflowY")},Sr=function(e){return ct(e,"overflowX")},Te=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var o=lt(e,r);if(o){var s=ut(e,r),l=s[1],a=s[2];if(l>a)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},Cr=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},Nr=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},lt=function(e,t){return e==="v"?wr(t):Sr(t)},ut=function(e,t){return e==="v"?Cr(t):Nr(t)},Rr=function(e,t){return e==="h"&&t==="rtl"?-1:1},Ar=function(e,t,n,r,o){var s=Rr(e,window.getComputedStyle(t).direction),l=s*r,a=n.target,d=t.contains(a),u=!1,p=l>0,m=0,h=0;do{if(!a)break;var v=ut(e,a),E=v[0],f=v[1],g=v[2],x=f-g-s*E;(E||x)&&lt(e,a)&&(m+=x,h+=E);var b=a.parentNode;a=b&&b.nodeType===Node.DOCUMENT_FRAGMENT_NODE?b.host:b}while(!d&&a!==document.body||d&&(t.contains(a)||t===a));return(p&&(Math.abs(m)<1||!o)||!p&&(Math.abs(h)<1||!o))&&(u=!0),u},q=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Ie=function(e){return[e.deltaX,e.deltaY]},_e=function(e){return e&&"current"in e?e.current:e},jr=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Or=function(e){return`
1
+ import{r as i,j as c,B as ke,O as kt}from"./index-CGzylDPY.js";import{E as Ft}from"./index-egcHQOpF.js";import{G as Mt}from"./error-boundary-CAu3AmhN.js";import{N as $t}from"./nav-chevrons-DCuva9-Q.js";import{u as Bt}from"./revalidation-ws-BoJZTvOQ.js";import{M as Ut,L as Q,E as Wt}from"./mdx-6d6l1jm2.js";import{P as Ht}from"./progress-DwE8EkAa.js";import{S as Fe}from"./set-playground-IUJCGVu2.js";import{b as Vt,a as Se,I as se,i as Yt,f as zt}from"./misc-CQmANiHr.js";import{g as Kt}from"./seo-pBpFCWsy.js";import{E as Xt}from"./epic-video-CqPr1EqP.js";import{S as ce,u as Gt,d as Zt,o as qt,s as Qt,f as Jt,e as en,g as tn,h as nn,l as rn}from"./tooltip-Cd0yJoQb.js";import{a as on}from"./index-CMYl882D.js";import{u as U,L as M,e as sn,r as an,R as cn,A as ln}from"./components-DrvY4pal.js";import{c as un,_ as dn,u as fn,a as F,f as pn,z as mn,s as hn,b as vn,R as gn,e as xn,h as En}from"./index-BncqUVfr.js";import"./progress-bar-ZCHf2Y4W.js";import"./pe-DXT2FOp1.js";import"./index-CSGHuBiw.js";import"./online-BsTX44az.js";import"./loading-CPEkK5hO.js";import"./user-C0j04V55.js";import"./workshop-config-oL_FWDKq.js";const Me=i.createContext(null);function bn(){const e=i.useContext(Me);if(!e)throw new Error("useStepContext must be used within a StepContext.Provider");return e}function Pn({children:e,inBrowserBrowserRef:t}){return c.jsx(Me.Provider,{value:{inBrowserBrowserRef:t},children:e})}const yn={DiffLink:le,PrevDiffLink:Cn,NextDiffLink:Sn,InlineFile:Nn,LinkToApp:An};function wn({inBrowserBrowserRef:e}){const t=U();return t.exerciseStepApp.instructionsCode?c.jsx(Pn,{inBrowserBrowserRef:e,children:c.jsx(Xt,{epicVideoInfosPromise:t.epicVideoInfosPromise,children:c.jsx("div",{className:"prose dark:prose-invert sm:prose-lg",children:c.jsx(Ut,{code:t.exerciseStepApp.instructionsCode,components:yn})})})}):null}function $e(e,t,n){const r=new URLSearchParams(e);return n===null?r.delete(t):r.set(t,n),r}function Sn({app:e=0,fullPage:t=!1,children:n}){return c.jsx(le,{app1:e,app2:e+1,fullPage:t,children:n})}function Cn({app:e=-1,fullPage:t=!1,children:n}){return c.jsx(le,{app1:e,app2:e+1,fullPage:t,children:n})}function le({app1:e=0,app2:t=1,children:n,fullPage:r=!1,to:o}){const s=U();if(!o&&!e&&!t)return c.jsx("callout-danger",{className:"notification",children:c.jsx("div",{className:"title",children:"DiffLink Error: invalid input"})});function l(p){var m;if(typeof p=="number"){const h=s.exerciseIndex+p;return(m=s.allApps[h])==null?void 0:m.name}if(!p)return null;for(const{name:h,stepName:v}of s.allApps)if(p===h||p===v)return h;return null}if(o){const p=new URLSearchParams(o);e=p.get("app1"),t=p.get("app2")}const a=l(e),d=l(t);if(!a||!d)return c.jsxs("callout-danger",{className:"notification",children:[c.jsx("div",{className:"title",children:"DiffLink Error: invalid input"}),!a&&c.jsxs("div",{children:['app1: "',e,'" is not a valid app name']}),!d&&c.jsxs("div",{children:['app2: "',t,'" is not a valid app name']})]});o||(o=`app1=${a}&app2=${d}`);const u=r?`/diff?${o}`:`?${decodeURIComponent($e(new URLSearchParams,"preview",`diff&${o}`).toString())}`;return n||(n=c.jsxs("span",{children:["Go to Diff ",r?"":"Preview"," from: ",c.jsx("code",{children:a})," to:"," ",c.jsx("code",{children:d})]})),c.jsx(M,{to:u,children:n})}function Nn({file:e,type:t="playground",children:n=c.jsx("code",{children:e}),...r}){const o=U(),s=o[t]||o[o.type],l=c.jsxs("div",{className:"launch-editor-button-wrapper flex underline underline-offset-4",children:[n," ",c.jsx("svg",{height:24,width:24,children:c.jsx("use",{href:`${Yt}#Keyboard`})})]});return ENV.EPICSHOP_DEPLOYED&&s?c.jsx("div",{className:"inline-block grow",children:c.jsx(Q,{appFile:e,appName:s.name,...r,children:l})}):s?c.jsx("div",{className:"inline-block grow",children:c.jsx(Q,{appFile:e,appName:s.name,...r,children:l})}):t==="playground"?c.jsx(ce,{content:"You must 'Set to Playground' before opening a file",children:c.jsx("div",{className:"inline-block grow cursor-not-allowed",children:l})}):c.jsx(c.Fragment,{children:"children"})}function Rn(e){return e==="problem"?"problem":e==="solution"?"solution":"playground"}function An({to:e,children:t=c.jsx("code",{children:e.toString()}),...n}){var h;const[r]=sn(),o=`?${$e(r,"pathname",e.toString()).toString()}`,s=U(),l=Rn(r.get("preview")),a=on(),d=s[l],u=(d==null?void 0:d.dev.type)==="script"?Vt({domain:a.domain,port:d.dev.portNumber}):((h=s.playground)==null?void 0:h.dev.type)==="browser"?s.playground.dev.pathname:null,{inBrowserBrowserRef:p}=bn(),m=u?u.slice(0,-1)+e.toString():null;return c.jsxs("div",{className:"inline-flex items-center justify-between gap-1",children:[c.jsx(M,{to:o,...n,className:Se(n.className,{"cursor-not-allowed":ENV.EPICSHOP_DEPLOYED}),title:ENV.EPICSHOP_DEPLOYED?"Cannot link to app in deployed version":void 0,onClick:v=>{var E,f;ENV.EPICSHOP_DEPLOYED&&v.preventDefault(),(E=n.onClick)==null||E.call(n,v),(f=p.current)==null||f.handleExtrnalNavigation(e.toString())},children:t}),m?c.jsx(ce,{content:"Open in new tab",children:c.jsx("a",{href:m,target:"_blank",rel:"noreferrer",className:Se("flex aspect-square items-center justify-center",{"cursor-not-allowed":ENV.EPICSHOP_DEPLOYED}),title:ENV.EPICSHOP_DEPLOYED?"Cannot link to app in deployed version":"Open in new tab",onClick:v=>{ENV.EPICSHOP_DEPLOYED&&v.preventDefault()},children:c.jsx(se,{name:"ExternalLink"})})}):null]})}function j(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e==null||e(o),n===!1||!o.defaultPrevented)return t==null?void 0:t(o)}}function Ce(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Be(...e){return t=>{let n=!1;const r=e.map(o=>{const s=Ce(o,t);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let o=0;o<r.length;o++){const s=r[o];typeof s=="function"?s():Ce(e[o],null)}}}}function L(...e){return i.useCallback(Be(...e),e)}function Ue(e,t=[]){let n=[];function r(s,l){const a=i.createContext(l),d=n.length;n=[...n,l];const u=m=>{var x;const{scope:h,children:v,...E}=m,f=((x=h==null?void 0:h[e])==null?void 0:x[d])||a,g=i.useMemo(()=>E,Object.values(E));return c.jsx(f.Provider,{value:g,children:v})};u.displayName=s+"Provider";function p(m,h){var f;const v=((f=h==null?void 0:h[e])==null?void 0:f[d])||a,E=i.useContext(v);if(E)return E;if(l!==void 0)return l;throw new Error(`\`${m}\` must be used within \`${s}\``)}return[u,p]}const o=()=>{const s=n.map(l=>i.createContext(l));return function(a){const d=(a==null?void 0:a[e])||s;return i.useMemo(()=>({[`__scope${e}`]:{...a,[e]:d}}),[a,d])}};return o.scopeName=e,[r,jn(o,...t)]}function jn(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(s){const l=r.reduce((a,{useScope:d,scopeName:u})=>{const m=d(s)[`__scope${u}`];return{...a,...m}},{});return i.useMemo(()=>({[`__scope${t.scopeName}`]:l}),[l])}};return n.scopeName=t.scopeName,n}function We(e){const t=On(e),n=i.forwardRef((r,o)=>{const{children:s,...l}=r,a=i.Children.toArray(s),d=a.find(Dn);if(d){const u=d.props.children,p=a.map(m=>m===d?i.Children.count(u)>1?i.Children.only(null):i.isValidElement(u)?u.props.children:null:m);return c.jsx(t,{...l,ref:o,children:i.isValidElement(u)?i.cloneElement(u,void 0,p):null})}return c.jsx(t,{...l,ref:o,children:s})});return n.displayName=`${e}.Slot`,n}function On(e){const t=i.forwardRef((n,r)=>{const{children:o,...s}=n;if(i.isValidElement(o)){const l=In(o),a=Tn(s,o.props);return o.type!==i.Fragment&&(a.ref=r?Be(r,l):l),i.cloneElement(o,a)}return i.Children.count(o)>1?i.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Ln=Symbol("radix.slottable");function Dn(e){return i.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Ln}function Tn(e,t){const n={...t};for(const r in t){const o=e[r],s=t[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...a)=>{const d=s(...a);return o(...a),d}:o&&(n[r]=o):r==="style"?n[r]={...o,...s}:r==="className"&&(n[r]=[o,s].filter(Boolean).join(" "))}return{...e,...n}}function In(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var _n=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],R=_n.reduce((e,t)=>{const n=We(`Primitive.${t}`),r=i.forwardRef((o,s)=>{const{asChild:l,...a}=o,d=l?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),c.jsx(d,{...a,ref:s})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function kn(e,t){e&&an.flushSync(()=>e.dispatchEvent(t))}function $(e){const t=i.useRef(e);return i.useEffect(()=>{t.current=e}),i.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function Fn(e,t=globalThis==null?void 0:globalThis.document){const n=$(e);i.useEffect(()=>{const r=o=>{o.key==="Escape"&&n(o)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var Mn="DismissableLayer",ie="dismissableLayer.update",$n="dismissableLayer.pointerDownOutside",Bn="dismissableLayer.focusOutside",Ne,He=i.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Ve=i.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:s,onInteractOutside:l,onDismiss:a,...d}=e,u=i.useContext(He),[p,m]=i.useState(null),h=(p==null?void 0:p.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,v]=i.useState({}),E=L(t,P=>m(P)),f=Array.from(u.layers),[g]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),x=f.indexOf(g),b=p?f.indexOf(p):-1,w=u.layersWithOutsidePointerEventsDisabled.size>0,y=b>=x,S=Hn(P=>{const N=P.target,T=[...u.branches].some(W=>W.contains(N));!y||T||(o==null||o(P),l==null||l(P),P.defaultPrevented||a==null||a())},h),C=Vn(P=>{const N=P.target;[...u.branches].some(W=>W.contains(N))||(s==null||s(P),l==null||l(P),P.defaultPrevented||a==null||a())},h);return Fn(P=>{b===u.layers.size-1&&(r==null||r(P),!P.defaultPrevented&&a&&(P.preventDefault(),a()))},h),i.useEffect(()=>{if(p)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(Ne=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(p)),u.layers.add(p),Re(),()=>{n&&u.layersWithOutsidePointerEventsDisabled.size===1&&(h.body.style.pointerEvents=Ne)}},[p,h,n,u]),i.useEffect(()=>()=>{p&&(u.layers.delete(p),u.layersWithOutsidePointerEventsDisabled.delete(p),Re())},[p,u]),i.useEffect(()=>{const P=()=>v({});return document.addEventListener(ie,P),()=>document.removeEventListener(ie,P)},[]),c.jsx(R.div,{...d,ref:E,style:{pointerEvents:w?y?"auto":"none":void 0,...e.style},onFocusCapture:j(e.onFocusCapture,C.onFocusCapture),onBlurCapture:j(e.onBlurCapture,C.onBlurCapture),onPointerDownCapture:j(e.onPointerDownCapture,S.onPointerDownCapture)})});Ve.displayName=Mn;var Un="DismissableLayerBranch",Wn=i.forwardRef((e,t)=>{const n=i.useContext(He),r=i.useRef(null),o=L(t,r);return i.useEffect(()=>{const s=r.current;if(s)return n.branches.add(s),()=>{n.branches.delete(s)}},[n.branches]),c.jsx(R.div,{...e,ref:o})});Wn.displayName=Un;function Hn(e,t=globalThis==null?void 0:globalThis.document){const n=$(e),r=i.useRef(!1),o=i.useRef(()=>{});return i.useEffect(()=>{const s=a=>{if(a.target&&!r.current){let d=function(){Ye($n,n,u,{discrete:!0})};const u={originalEvent:a};a.pointerType==="touch"?(t.removeEventListener("click",o.current),o.current=d,t.addEventListener("click",o.current,{once:!0})):d()}else t.removeEventListener("click",o.current);r.current=!1},l=window.setTimeout(()=>{t.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(l),t.removeEventListener("pointerdown",s),t.removeEventListener("click",o.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function Vn(e,t=globalThis==null?void 0:globalThis.document){const n=$(e),r=i.useRef(!1);return i.useEffect(()=>{const o=s=>{s.target&&!r.current&&Ye(Bn,n,{originalEvent:s},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function Re(){const e=new CustomEvent(ie);document.dispatchEvent(e)}function Ye(e,t,n,{discrete:r}){const o=n.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?kn(o,s):o.dispatchEvent(s)}var te=0;function Yn(){i.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??Ae()),document.body.insertAdjacentElement("beforeend",e[1]??Ae()),te++,()=>{te===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),te--}},[])}function Ae(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var ne="focusScope.autoFocusOnMount",re="focusScope.autoFocusOnUnmount",je={bubbles:!1,cancelable:!0},zn="FocusScope",ze=i.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:s,...l}=e,[a,d]=i.useState(null),u=$(o),p=$(s),m=i.useRef(null),h=L(t,f=>d(f)),v=i.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;i.useEffect(()=>{if(r){let f=function(w){if(v.paused||!a)return;const y=w.target;a.contains(y)?m.current=y:A(m.current,{select:!0})},g=function(w){if(v.paused||!a)return;const y=w.relatedTarget;y!==null&&(a.contains(y)||A(m.current,{select:!0}))},x=function(w){if(document.activeElement===document.body)for(const S of w)S.removedNodes.length>0&&A(a)};document.addEventListener("focusin",f),document.addEventListener("focusout",g);const b=new MutationObserver(x);return a&&b.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",f),document.removeEventListener("focusout",g),b.disconnect()}}},[r,a,v.paused]),i.useEffect(()=>{if(a){Le.add(v);const f=document.activeElement;if(!a.contains(f)){const x=new CustomEvent(ne,je);a.addEventListener(ne,u),a.dispatchEvent(x),x.defaultPrevented||(Kn(Qn(Ke(a)),{select:!0}),document.activeElement===f&&A(a))}return()=>{a.removeEventListener(ne,u),setTimeout(()=>{const x=new CustomEvent(re,je);a.addEventListener(re,p),a.dispatchEvent(x),x.defaultPrevented||A(f??document.body,{select:!0}),a.removeEventListener(re,p),Le.remove(v)},0)}}},[a,u,p,v]);const E=i.useCallback(f=>{if(!n&&!r||v.paused)return;const g=f.key==="Tab"&&!f.altKey&&!f.ctrlKey&&!f.metaKey,x=document.activeElement;if(g&&x){const b=f.currentTarget,[w,y]=Xn(b);w&&y?!f.shiftKey&&x===y?(f.preventDefault(),n&&A(w,{select:!0})):f.shiftKey&&x===w&&(f.preventDefault(),n&&A(y,{select:!0})):x===b&&f.preventDefault()}},[n,r,v.paused]);return c.jsx(R.div,{tabIndex:-1,...l,ref:h,onKeyDown:E})});ze.displayName=zn;function Kn(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(A(r,{select:t}),document.activeElement!==n)return}function Xn(e){const t=Ke(e),n=Oe(t,e),r=Oe(t.reverse(),e);return[n,r]}function Ke(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const o=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||o?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Oe(e,t){for(const n of e)if(!Gn(n,{upTo:t}))return n}function Gn(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function Zn(e){return e instanceof HTMLInputElement&&"select"in e}function A(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&Zn(e)&&t&&e.select()}}var Le=qn();function qn(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=De(e,t),e.unshift(t)},remove(t){var n;e=De(e,t),(n=e[0])==null||n.resume()}}}function De(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function Qn(e){return e.filter(t=>t.tagName!=="A")}var O=globalThis!=null&&globalThis.document?i.useLayoutEffect:()=>{},Jn=ke[" useId ".trim().toString()]||(()=>{}),er=0;function tr(e){const[t,n]=i.useState(Jn());return O(()=>{e||n(r=>r??String(er++))},[e]),e||(t?`radix-${t}`:"")}var nr="Arrow",Xe=i.forwardRef((e,t)=>{const{children:n,width:r=10,height:o=5,...s}=e;return c.jsx(R.svg,{...s,ref:t,width:r,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:c.jsx("polygon",{points:"0,0 30,0 15,10"})})});Xe.displayName=nr;var rr=Xe;function or(e){const[t,n]=i.useState(void 0);return O(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const s=o[0];let l,a;if("borderBoxSize"in s){const d=s.borderBoxSize,u=Array.isArray(d)?d[0]:d;l=u.inlineSize,a=u.blockSize}else l=e.offsetWidth,a=e.offsetHeight;n({width:l,height:a})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var ue="Popper",[Ge,Ze]=Ue(ue),[sr,qe]=Ge(ue),Qe=e=>{const{__scopePopper:t,children:n}=e,[r,o]=i.useState(null);return c.jsx(sr,{scope:t,anchor:r,onAnchorChange:o,children:n})};Qe.displayName=ue;var Je="PopperAnchor",et=i.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...o}=e,s=qe(Je,n),l=i.useRef(null),a=L(t,l);return i.useEffect(()=>{s.onAnchorChange((r==null?void 0:r.current)||l.current)}),r?null:c.jsx(R.div,{...o,ref:a})});et.displayName=Je;var de="PopperContent",[ir,ar]=Ge(de),tt=i.forwardRef((e,t)=>{var ge,xe,Ee,be,Pe,ye;const{__scopePopper:n,side:r="bottom",sideOffset:o=0,align:s="center",alignOffset:l=0,arrowPadding:a=0,avoidCollisions:d=!0,collisionBoundary:u=[],collisionPadding:p=0,sticky:m="partial",hideWhenDetached:h=!1,updatePositionStrategy:v="optimized",onPlaced:E,...f}=e,g=qe(de,n),[x,b]=i.useState(null),w=L(t,H=>b(H)),[y,S]=i.useState(null),C=or(y),P=(C==null?void 0:C.width)??0,N=(C==null?void 0:C.height)??0,T=r+(s!=="center"?"-"+s:""),W=typeof p=="number"?p:{top:0,right:0,bottom:0,left:0,...p},me=Array.isArray(u)?u:[u],wt=me.length>0,Y={padding:W,boundary:me.filter(lr),altBoundary:wt},{refs:St,floatingStyles:he,placement:Ct,isPositioned:z,middlewareData:I}=Gt({strategy:"fixed",placement:T,whileElementsMounted:(...H)=>Zt(...H,{animationFrame:v==="always"}),elements:{reference:g.anchor},middleware:[qt({mainAxis:o+N,alignmentAxis:l}),d&&Qt({mainAxis:!0,crossAxis:!1,limiter:m==="partial"?rn():void 0,...Y}),d&&Jt({...Y}),en({...Y,apply:({elements:H,rects:we,availableWidth:Dt,availableHeight:Tt})=>{const{width:It,height:_t}=we.reference,X=H.floating.style;X.setProperty("--radix-popper-available-width",`${Dt}px`),X.setProperty("--radix-popper-available-height",`${Tt}px`),X.setProperty("--radix-popper-anchor-width",`${It}px`),X.setProperty("--radix-popper-anchor-height",`${_t}px`)}}),y&&tn({element:y,padding:a}),ur({arrowWidth:P,arrowHeight:N}),h&&nn({strategy:"referenceHidden",...Y})]}),[ve,Nt]=ot(Ct),K=$(E);O(()=>{z&&(K==null||K())},[z,K]);const Rt=(ge=I.arrow)==null?void 0:ge.x,At=(xe=I.arrow)==null?void 0:xe.y,jt=((Ee=I.arrow)==null?void 0:Ee.centerOffset)!==0,[Ot,Lt]=i.useState();return O(()=>{x&&Lt(window.getComputedStyle(x).zIndex)},[x]),c.jsx("div",{ref:St.setFloating,"data-radix-popper-content-wrapper":"",style:{...he,transform:z?he.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Ot,"--radix-popper-transform-origin":[(be=I.transformOrigin)==null?void 0:be.x,(Pe=I.transformOrigin)==null?void 0:Pe.y].join(" "),...((ye=I.hide)==null?void 0:ye.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:c.jsx(ir,{scope:n,placedSide:ve,onArrowChange:S,arrowX:Rt,arrowY:At,shouldHideArrow:jt,children:c.jsx(R.div,{"data-side":ve,"data-align":Nt,...f,ref:w,style:{...f.style,animation:z?void 0:"none"}})})})});tt.displayName=de;var nt="PopperArrow",cr={top:"bottom",right:"left",bottom:"top",left:"right"},rt=i.forwardRef(function(t,n){const{__scopePopper:r,...o}=t,s=ar(nt,r),l=cr[s.placedSide];return c.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[l]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:c.jsx(rr,{...o,ref:n,style:{...o.style,display:"block"}})})});rt.displayName=nt;function lr(e){return e!==null}var ur=e=>({name:"transformOrigin",options:e,fn(t){var g,x,b;const{placement:n,rects:r,middlewareData:o}=t,l=((g=o.arrow)==null?void 0:g.centerOffset)!==0,a=l?0:e.arrowWidth,d=l?0:e.arrowHeight,[u,p]=ot(n),m={start:"0%",center:"50%",end:"100%"}[p],h=(((x=o.arrow)==null?void 0:x.x)??0)+a/2,v=(((b=o.arrow)==null?void 0:b.y)??0)+d/2;let E="",f="";return u==="bottom"?(E=l?m:`${h}px`,f=`${-d}px`):u==="top"?(E=l?m:`${h}px`,f=`${r.floating.height+d}px`):u==="right"?(E=`${-d}px`,f=l?m:`${v}px`):u==="left"&&(E=`${r.floating.width+d}px`,f=l?m:`${v}px`),{data:{x:E,y:f}}}});function ot(e){const[t,n="center"]=e.split("-");return[t,n]}var dr=Qe,st=et,fr=tt,pr=rt,mr="Portal",it=i.forwardRef((e,t)=>{var a;const{container:n,...r}=e,[o,s]=i.useState(!1);O(()=>s(!0),[]);const l=n||o&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return l?cn.createPortal(c.jsx(R.div,{...r,ref:t}),l):null});it.displayName=mr;function hr(e,t){return i.useReducer((n,r)=>t[n][r]??n,e)}var fe=e=>{const{present:t,children:n}=e,r=vr(t),o=typeof n=="function"?n({present:r.isPresent}):i.Children.only(n),s=L(r.ref,gr(o));return typeof n=="function"||r.isPresent?i.cloneElement(o,{ref:s}):null};fe.displayName="Presence";function vr(e){const[t,n]=i.useState(),r=i.useRef(null),o=i.useRef(e),s=i.useRef("none"),l=e?"mounted":"unmounted",[a,d]=hr(l,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return i.useEffect(()=>{const u=G(r.current);s.current=a==="mounted"?u:"none"},[a]),O(()=>{const u=r.current,p=o.current;if(p!==e){const h=s.current,v=G(u);e?d("MOUNT"):v==="none"||(u==null?void 0:u.display)==="none"?d("UNMOUNT"):d(p&&h!==v?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,d]),O(()=>{if(t){let u;const p=t.ownerDocument.defaultView??window,m=v=>{const f=G(r.current).includes(v.animationName);if(v.target===t&&f&&(d("ANIMATION_END"),!o.current)){const g=t.style.animationFillMode;t.style.animationFillMode="forwards",u=p.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=g)})}},h=v=>{v.target===t&&(s.current=G(r.current))};return t.addEventListener("animationstart",h),t.addEventListener("animationcancel",m),t.addEventListener("animationend",m),()=>{p.clearTimeout(u),t.removeEventListener("animationstart",h),t.removeEventListener("animationcancel",m),t.removeEventListener("animationend",m)}}else d("ANIMATION_END")},[t,d]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:i.useCallback(u=>{r.current=u?getComputedStyle(u):null,n(u)},[])}}function G(e){return(e==null?void 0:e.animationName)||"none"}function gr(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var xr=ke[" useInsertionEffect ".trim().toString()]||O;function Er({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[o,s,l]=br({defaultProp:t,onChange:n}),a=e!==void 0,d=a?e:o;{const p=i.useRef(e!==void 0);i.useEffect(()=>{const m=p.current;m!==a&&console.warn(`${r} is changing from ${m?"controlled":"uncontrolled"} to ${a?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),p.current=a},[a,r])}const u=i.useCallback(p=>{var m;if(a){const h=Pr(p)?p(e):p;h!==e&&((m=l.current)==null||m.call(l,h))}else s(p)},[a,e,s,l]);return[d,u]}function br({defaultProp:e,onChange:t}){const[n,r]=i.useState(e),o=i.useRef(n),s=i.useRef(t);return xr(()=>{s.current=t},[t]),i.useEffect(()=>{var l;o.current!==n&&((l=s.current)==null||l.call(s,n),o.current=n)},[n,o]),[n,r,s]}function Pr(e){return typeof e=="function"}var at=un(),oe=function(){},J=i.forwardRef(function(e,t){var n=i.useRef(null),r=i.useState({onScrollCapture:oe,onWheelCapture:oe,onTouchMoveCapture:oe}),o=r[0],s=r[1],l=e.forwardProps,a=e.children,d=e.className,u=e.removeScrollBar,p=e.enabled,m=e.shards,h=e.sideCar,v=e.noRelative,E=e.noIsolation,f=e.inert,g=e.allowPinchZoom,x=e.as,b=x===void 0?"div":x,w=e.gapMode,y=dn(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),S=h,C=fn([n,t]),P=F(F({},y),o);return i.createElement(i.Fragment,null,p&&i.createElement(S,{sideCar:at,removeScrollBar:u,shards:m,noRelative:v,noIsolation:E,inert:f,setCallbacks:s,allowPinchZoom:!!g,lockRef:n,gapMode:w}),l?i.cloneElement(i.Children.only(a),F(F({},P),{ref:C})):i.createElement(b,F({},P,{className:d,ref:C}),a))});J.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};J.classNames={fullWidth:pn,zeroRight:mn};var ae=!1;if(typeof window<"u")try{var Z=Object.defineProperty({},"passive",{get:function(){return ae=!0,!0}});window.addEventListener("test",Z,Z),window.removeEventListener("test",Z,Z)}catch{ae=!1}var _=ae?{passive:!1}:!1,yr=function(e){return e.tagName==="TEXTAREA"},ct=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!yr(e)&&n[t]==="visible")},wr=function(e){return ct(e,"overflowY")},Sr=function(e){return ct(e,"overflowX")},Te=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var o=lt(e,r);if(o){var s=ut(e,r),l=s[1],a=s[2];if(l>a)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},Cr=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},Nr=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},lt=function(e,t){return e==="v"?wr(t):Sr(t)},ut=function(e,t){return e==="v"?Cr(t):Nr(t)},Rr=function(e,t){return e==="h"&&t==="rtl"?-1:1},Ar=function(e,t,n,r,o){var s=Rr(e,window.getComputedStyle(t).direction),l=s*r,a=n.target,d=t.contains(a),u=!1,p=l>0,m=0,h=0;do{if(!a)break;var v=ut(e,a),E=v[0],f=v[1],g=v[2],x=f-g-s*E;(E||x)&&lt(e,a)&&(m+=x,h+=E);var b=a.parentNode;a=b&&b.nodeType===Node.DOCUMENT_FRAGMENT_NODE?b.host:b}while(!d&&a!==document.body||d&&(t.contains(a)||t===a));return(p&&(Math.abs(m)<1||!o)||!p&&(Math.abs(h)<1||!o))&&(u=!0),u},q=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Ie=function(e){return[e.deltaX,e.deltaY]},_e=function(e){return e&&"current"in e?e.current:e},jr=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Or=function(e){return`
2
2
  .block-interactivity-`.concat(e,` {pointer-events: none;}
3
3
  .allow-interactivity-`).concat(e,` {pointer-events: all;}
4
4
  `)},Lr=0,k=[];function Dr(e){var t=i.useRef([]),n=i.useRef([0,0]),r=i.useRef(),o=i.useState(Lr++)[0],s=i.useState(hn)[0],l=i.useRef(e);i.useEffect(function(){l.current=e},[e]),i.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var f=vn([e.lockRef.current],(e.shards||[]).map(_e),!0).filter(Boolean);return f.forEach(function(g){return g.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),f.forEach(function(g){return g.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var a=i.useCallback(function(f,g){if("touches"in f&&f.touches.length===2||f.type==="wheel"&&f.ctrlKey)return!l.current.allowPinchZoom;var x=q(f),b=n.current,w="deltaX"in f?f.deltaX:b[0]-x[0],y="deltaY"in f?f.deltaY:b[1]-x[1],S,C=f.target,P=Math.abs(w)>Math.abs(y)?"h":"v";if("touches"in f&&P==="h"&&C.type==="range")return!1;var N=Te(P,C);if(!N)return!0;if(N?S=P:(S=P==="v"?"h":"v",N=Te(P,C)),!N)return!1;if(!r.current&&"changedTouches"in f&&(w||y)&&(r.current=S),!S)return!0;var T=r.current||S;return Ar(T,g,f,T==="h"?w:y,!0)},[]),d=i.useCallback(function(f){var g=f;if(!(!k.length||k[k.length-1]!==s)){var x="deltaY"in g?Ie(g):q(g),b=t.current.filter(function(S){return S.name===g.type&&(S.target===g.target||g.target===S.shadowParent)&&jr(S.delta,x)})[0];if(b&&b.should){g.cancelable&&g.preventDefault();return}if(!b){var w=(l.current.shards||[]).map(_e).filter(Boolean).filter(function(S){return S.contains(g.target)}),y=w.length>0?a(g,w[0]):!l.current.noIsolation;y&&g.cancelable&&g.preventDefault()}}},[]),u=i.useCallback(function(f,g,x,b){var w={name:f,delta:g,target:x,should:b,shadowParent:Tr(x)};t.current.push(w),setTimeout(function(){t.current=t.current.filter(function(y){return y!==w})},1)},[]),p=i.useCallback(function(f){n.current=q(f),r.current=void 0},[]),m=i.useCallback(function(f){u(f.type,Ie(f),f.target,a(f,e.lockRef.current))},[]),h=i.useCallback(function(f){u(f.type,q(f),f.target,a(f,e.lockRef.current))},[]);i.useEffect(function(){return k.push(s),e.setCallbacks({onScrollCapture:m,onWheelCapture:m,onTouchMoveCapture:h}),document.addEventListener("wheel",d,_),document.addEventListener("touchmove",d,_),document.addEventListener("touchstart",p,_),function(){k=k.filter(function(f){return f!==s}),document.removeEventListener("wheel",d,_),document.removeEventListener("touchmove",d,_),document.removeEventListener("touchstart",p,_)}},[]);var v=e.removeScrollBar,E=e.inert;return i.createElement(i.Fragment,null,E?i.createElement(s,{styles:Or(o)}):null,v?i.createElement(gn,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Tr(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const Ir=xn(at,Dr);var dt=i.forwardRef(function(e,t){return i.createElement(J,F({},e,{ref:t,sideCar:Ir}))});dt.classNames=J.classNames;var ee="Popover",[ft,Eo]=Ue(ee,[Ze]),V=Ze(),[_r,D]=ft(ee),pt=e=>{const{__scopePopover:t,children:n,open:r,defaultOpen:o,onOpenChange:s,modal:l=!1}=e,a=V(t),d=i.useRef(null),[u,p]=i.useState(!1),[m,h]=Er({prop:r,defaultProp:o??!1,onChange:s,caller:ee});return c.jsx(dr,{...a,children:c.jsx(_r,{scope:t,contentId:tr(),triggerRef:d,open:m,onOpenChange:h,onOpenToggle:i.useCallback(()=>h(v=>!v),[h]),hasCustomAnchor:u,onCustomAnchorAdd:i.useCallback(()=>p(!0),[]),onCustomAnchorRemove:i.useCallback(()=>p(!1),[]),modal:l,children:n})})};pt.displayName=ee;var mt="PopoverAnchor",kr=i.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=D(mt,n),s=V(n),{onCustomAnchorAdd:l,onCustomAnchorRemove:a}=o;return i.useEffect(()=>(l(),()=>a()),[l,a]),c.jsx(st,{...s,...r,ref:t})});kr.displayName=mt;var ht="PopoverTrigger",vt=i.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=D(ht,n),s=V(n),l=L(t,o.triggerRef),a=c.jsx(R.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":Pt(o.open),...r,ref:l,onClick:j(e.onClick,o.onOpenToggle)});return o.hasCustomAnchor?a:c.jsx(st,{asChild:!0,...s,children:a})});vt.displayName=ht;var pe="PopoverPortal",[Fr,Mr]=ft(pe,{forceMount:void 0}),gt=e=>{const{__scopePopover:t,forceMount:n,children:r,container:o}=e,s=D(pe,t);return c.jsx(Fr,{scope:t,forceMount:n,children:c.jsx(fe,{present:n||s.open,children:c.jsx(it,{asChild:!0,container:o,children:r})})})};gt.displayName=pe;var B="PopoverContent",xt=i.forwardRef((e,t)=>{const n=Mr(B,e.__scopePopover),{forceMount:r=n.forceMount,...o}=e,s=D(B,e.__scopePopover);return c.jsx(fe,{present:r||s.open,children:s.modal?c.jsx(Br,{...o,ref:t}):c.jsx(Ur,{...o,ref:t})})});xt.displayName=B;var $r=We("PopoverContent.RemoveScroll"),Br=i.forwardRef((e,t)=>{const n=D(B,e.__scopePopover),r=i.useRef(null),o=L(t,r),s=i.useRef(!1);return i.useEffect(()=>{const l=r.current;if(l)return En(l)},[]),c.jsx(dt,{as:$r,allowPinchZoom:!0,children:c.jsx(Et,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:j(e.onCloseAutoFocus,l=>{var a;l.preventDefault(),s.current||(a=n.triggerRef.current)==null||a.focus()}),onPointerDownOutside:j(e.onPointerDownOutside,l=>{const a=l.detail.originalEvent,d=a.button===0&&a.ctrlKey===!0,u=a.button===2||d;s.current=u},{checkForDefaultPrevented:!1}),onFocusOutside:j(e.onFocusOutside,l=>l.preventDefault(),{checkForDefaultPrevented:!1})})})}),Ur=i.forwardRef((e,t)=>{const n=D(B,e.__scopePopover),r=i.useRef(!1),o=i.useRef(!1);return c.jsx(Et,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{var l,a;(l=e.onCloseAutoFocus)==null||l.call(e,s),s.defaultPrevented||(r.current||(a=n.triggerRef.current)==null||a.focus(),s.preventDefault()),r.current=!1,o.current=!1},onInteractOutside:s=>{var d,u;(d=e.onInteractOutside)==null||d.call(e,s),s.defaultPrevented||(r.current=!0,s.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const l=s.target;((u=n.triggerRef.current)==null?void 0:u.contains(l))&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&o.current&&s.preventDefault()}})}),Et=i.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:s,disableOutsidePointerEvents:l,onEscapeKeyDown:a,onPointerDownOutside:d,onFocusOutside:u,onInteractOutside:p,...m}=e,h=D(B,n),v=V(n);return Yn(),c.jsx(ze,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:s,children:c.jsx(Ve,{asChild:!0,disableOutsidePointerEvents:l,onInteractOutside:p,onEscapeKeyDown:a,onPointerDownOutside:d,onFocusOutside:u,onDismiss:()=>h.onOpenChange(!1),children:c.jsx(fr,{"data-state":Pt(h.open),role:"dialog",id:h.contentId,...v,...m,ref:t,style:{...m.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),bt="PopoverClose",Wr=i.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=D(bt,n);return c.jsx(R.button,{type:"button",...r,ref:t,onClick:j(e.onClick,()=>o.onOpenChange(!1))})});Wr.displayName=bt;var Hr="PopoverArrow",Vr=i.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=V(n);return c.jsx(pr,{...o,...r,ref:t})});Vr.displayName=Hr;function Pt(e){return e?"open":"closed"}var Yr=pt,zr=vt,Kr=gt,Xr=xt;function Gr({diffFilesPromise:e}){var a,d;const t=U(),[n,r]=i.useState(!1),o=i.useRef(null);function s(){r(!1)}const l=(a=t.playground)==null?void 0:a.appName;return c.jsx(c.Fragment,{children:c.jsxs(Yr,{open:n,onOpenChange:r,children:[c.jsx(zr,{asChild:!0,children:c.jsxs("button",{className:"flex h-full items-center gap-1 border-r px-6 py-3 font-mono text-sm uppercase","aria-label":"Relevant Files",children:[c.jsx(se,{name:"Files"}),"Files"]})}),c.jsx(Kr,{children:c.jsx(Xr,{ref:o,className:"slideRightContent lg:slideUpContent invert-theme z-10 select-none rounded bg-background px-9 py-8 text-foreground",align:"start",sideOffset:5,children:c.jsxs("div",{className:"launch-editor-wrapper",children:[c.jsx("strong",{className:"inline-block px-2 pb-4 font-semibold uppercase",children:"Relevant Files"}),t.problem&&((d=t.playground)==null?void 0:d.appName)!==t.problem.name?c.jsx("div",{className:"mb-2 rounded p-1 font-mono font-medium",children:c.jsx(Fe,{appName:t.problem.name})}):null,c.jsx("div",{id:"files",children:c.jsx(i.Suspense,{fallback:c.jsx(ce,{content:"Loading diff",children:c.jsx("div",{className:"flex justify-center",children:c.jsx(se,{name:"Refresh",className:"h-8 w-8 animate-spin"})})}),children:c.jsx(ln,{resolve:e,errorElement:c.jsx("div",{className:"text-foreground-destructive",children:"Something went wrong."}),children:u=>{if(!u)return c.jsx("p",{className:"text-foreground-destructive",children:"Unable to determine diff"});if(typeof u=="string")return c.jsx("p",{className:"text-foreground-destructive",children:u});if(!u.length)return c.jsx("p",{children:"No files changed"});const p=l||ENV.EPICSHOP_GITHUB_ROOT?{}:{title:"You must 'Set to Playground' before opening a file",className:"not-allowed"};return c.jsxs("ul",{...p,children:[u.length>1&&!ENV.EPICSHOP_DEPLOYED?c.jsx("div",{className:"mb-2 border-b border-b-gray-50 border-opacity-50 pb-2 font-sans",children:c.jsx(Q,{appFile:u.map(m=>`${m.path},${m.line},1`),appName:"playground",onUpdate:s,children:c.jsx("p",{children:"Open All Files"})})}):null,u.map(m=>{var h;return c.jsx("li",{"data-state":m.status,children:c.jsx(Q,{appFile:`${m.path},${m.line},1`,appName:ENV.EPICSHOP_DEPLOYED?((h=t.problem)==null?void 0:h.name)??"playground":"playground",onUpdate:s,children:c.jsx("code",{children:m.path})})},m.path)})]})}})})})]})})})]})})}function yt(e,t){var l;const n=(e==null?void 0:e.exerciseStepApp.exerciseNumber.toString().padStart(2,"0"))??"00",r=(e==null?void 0:e.exerciseStepApp.stepNumber.toString().padStart(2,"0"))??"00",o={problem:"💪",solution:"🏁"}[(e==null?void 0:e.type)??"problem"],s=((l=e==null?void 0:e[e.type])==null?void 0:l.title)??"N/A";return{emoji:o,stepNumber:r,title:s,exerciseNumber:n,exerciseTitle:(e==null?void 0:e.exerciseTitle)??"Unknown exercise",workshopTitle:t,type:(e==null?void 0:e.type)??"problem"}}const bo=({data:e,matches:t,params:n})=>{var u;const r=(u=t.find(p=>p.id==="root"))==null?void 0:u.data;if(!e||!r)return[{title:"🦉 | Error"}];const{emoji:o,stepNumber:s,title:l,exerciseNumber:a,exerciseTitle:d}=yt(e);return Kt({title:`${o} | ${s}. ${l} | ${a}. ${d} | ${r.workshopTitle}`,description:`${n.type} step for exercise ${a}. ${d}`,ogTitle:l,ogDescription:`${d} step ${Number(s)} ${n.type}`,instructor:r.instructor,requestInfo:r.requestInfo})};function Po(){var r;const e=U(),t=i.useRef(null),n=yt(e);return Bt({watchPaths:[`${e.exerciseStepApp.relativePath}/README.mdx`]}),c.jsx("div",{className:"flex max-w-full flex-grow flex-col",children:c.jsxs("main",{className:"flex flex-grow flex-col sm:grid sm:h-full sm:min-h-[800px] sm:grid-cols-1 sm:grid-rows-2 md:min-h-[unset] lg:grid-cols-2 lg:grid-rows-1",children:[c.jsxs("div",{className:"relative flex flex-col sm:col-span-1 sm:row-span-1 sm:h-full lg:border-r",children:[c.jsx("h1",{className:"h-14 border-b pl-10 pr-5 text-sm font-medium leading-tight",children:c.jsxs("div",{className:"flex h-14 flex-wrap items-center justify-between gap-x-2 py-2",children:[c.jsxs("div",{className:"flex items-center justify-start gap-x-2 uppercase",children:[c.jsxs(M,{to:zt(e.exerciseStepApp.exerciseNumber),className:"hover:underline",children:[n.exerciseNumber,". ",n.exerciseTitle]}),"/",c.jsxs(M,{to:".",className:"hover:underline",children:[n.stepNumber,". ",n.title," (",n.emoji," ",n.type,")"]})]}),e.problem&&((r=e.playground)==null?void 0:r.appName)!==e.problem.name?c.jsx("div",{className:"hidden md:block",children:c.jsx(Fe,{appName:e.problem.name})}):null]})}),c.jsxs("article",{id:e.articleId,className:"shadow-on-scrollbox flex h-full w-full max-w-none flex-1 scroll-pt-6 flex-col justify-between space-y-6 overflow-y-auto p-2 scrollbar-thin scrollbar-thumb-scrollbar sm:p-10 sm:pt-8",children:[e.exerciseStepApp.instructionsCode?c.jsx(wn,{inBrowserBrowserRef:t}):c.jsx("div",{className:"flex h-full items-center justify-center text-lg",children:c.jsx("p",{children:"No instructions yet..."})}),c.jsxs("div",{className:"mt-auto flex justify-between",children:[e.prevStepLink?c.jsx(M,{to:e.prevStepLink.to,"aria-label":"Previous Step",prefetch:"intent",children:"← Previous"}):c.jsx("span",{}),e.nextStepLink?c.jsx(M,{to:e.nextStepLink.to,"aria-label":"Next Step",prefetch:"intent",children:"Next →"}):c.jsx("span",{})]})]},e.articleId),c.jsx(Ft,{elementQuery:`#${e.articleId}`},`scroll-${e.articleId}`),e.type==="solution"?c.jsx(Ht,{type:"step",exerciseNumber:e.exerciseStepApp.exerciseNumber,stepNumber:e.exerciseStepApp.stepNumber,className:"h-14 border-t px-6"}):null,c.jsxs("div",{className:"flex h-16 justify-between border-b-4 border-t lg:border-b-0",children:[c.jsx("div",{children:c.jsx("div",{className:"h-full",children:c.jsx(Gr,{diffFilesPromise:e.diffFiles})})}),c.jsx(Wt,{appName:e.exerciseStepApp.name,relativePath:e.exerciseStepApp.relativePath}),c.jsx($t,{prev:e.prevStepLink?{to:e.prevStepLink.to,"aria-label":"Previous Step"}:null,next:e.nextStepLink?{to:e.nextStepLink.to,"aria-label":"Next Step"}:null})]})]}),c.jsx(kt,{})]})})}function yo(){return c.jsx(Mt,{statusHandlers:{404:()=>c.jsx("p",{children:"Sorry, we couldn't find an app here."})}})}export{yo as ErrorBoundary,Po as default,bo as meta};
5
- //# sourceMappingURL=_layout-Brb3LPqZ.js.map
5
+ //# sourceMappingURL=_layout-D25fx677.js.map