@epic-web/workshop-app 4.20.0 → 4.21.0
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.
- package/build/client/assets/{_-DYArYM0Z.js → _-DbrWZazo.js} +2 -2
- package/build/client/assets/_-DbrWZazo.js.map +1 -0
- package/build/client/assets/_exerciseNumber-Cq0nozYz.js +2 -0
- package/build/client/assets/_exerciseNumber-Cq0nozYz.js.map +1 -0
- package/build/client/assets/{_exerciseNumber_._stepNumber-Ct5BCuA1.js → _exerciseNumber_._stepNumber-B5pmJ29o.js} +2 -2
- package/build/client/assets/_exerciseNumber_._stepNumber-B5pmJ29o.js.map +1 -0
- package/build/client/assets/{_exerciseNumber_.finished-C9TSc48F.js → _exerciseNumber_.finished-Q9qnPuZX.js} +2 -2
- package/build/client/assets/_exerciseNumber_.finished-Q9qnPuZX.js.map +1 -0
- package/build/client/assets/_layout-AgYGL72C.js +6 -0
- package/build/client/assets/_layout-AgYGL72C.js.map +1 -0
- package/build/client/assets/{_layout-DLIzcS5v.js → _layout-BUs3av-e.js} +2 -2
- package/build/client/assets/_layout-BUs3av-e.js.map +1 -0
- package/build/client/assets/{_layout-CZ3fjUvs.js → _layout-C8uU4Hwj.js} +2 -2
- package/build/client/assets/{_layout-CZ3fjUvs.js.map → _layout-C8uU4Hwj.js.map} +1 -1
- package/build/client/assets/_layout-DLVrpOki.js +2 -0
- package/build/client/assets/_layout-DLVrpOki.js.map +1 -0
- package/build/client/assets/accordion-BroSqIct.js +2 -0
- package/build/client/assets/accordion-BroSqIct.js.map +1 -0
- package/build/client/assets/{account-LnI_Eq0t.js → account-7o6O4ruO.js} +2 -2
- package/build/client/assets/{account-LnI_Eq0t.js.map → account-7o6O4ruO.js.map} +1 -1
- package/build/client/assets/app-BiWJY58g.js +2 -0
- package/build/client/assets/app-BiWJY58g.js.map +1 -0
- package/build/client/assets/{button-BA3iiLRs.js → button-BklqyTPS.js} +2 -2
- package/build/client/assets/{button-BA3iiLRs.js.map → button-BklqyTPS.js.map} +1 -1
- package/build/client/assets/{client-hints-DLYDs4RF.js → client-hints-DNUUFGmB.js} +2 -2
- package/build/client/assets/{client-hints-DLYDs4RF.js.map → client-hints-DNUUFGmB.js.map} +1 -1
- package/build/client/assets/{components-wgHiPsTg.js → components-CME-nGId.js} +3 -3
- package/build/client/assets/{components-wgHiPsTg.js.map → components-CME-nGId.js.map} +1 -1
- package/build/client/assets/diff-CpFxuKA2.js +2 -0
- package/build/client/assets/diff-CpFxuKA2.js.map +1 -0
- package/build/client/assets/diff-Cw8ktQ1-.js +2 -0
- package/build/client/assets/{diff-CPrD1rHd.js.map → diff-Cw8ktQ1-.js.map} +1 -1
- package/build/client/assets/discord-CHP4_JLJ.js +2 -0
- package/build/client/assets/discord-CHP4_JLJ.js.map +1 -0
- package/build/client/assets/{discord-BgaWmFRC.js → discord-Dq4e30wV.js} +2 -2
- package/build/client/assets/{discord-BgaWmFRC.js.map → discord-Dq4e30wV.js.map} +1 -1
- package/build/client/assets/{entry.client-Cs8lBz8l.js → entry.client-3M2p-8I3.js} +2 -2
- package/build/client/assets/{entry.client-Cs8lBz8l.js.map → entry.client-3M2p-8I3.js.map} +1 -1
- package/build/client/assets/{epic-video-CfelX9-n.js → epic-video-iluUs1-s.js} +2 -2
- package/build/client/assets/{epic-video-CfelX9-n.js.map → epic-video-iluUs1-s.js.map} +1 -1
- package/build/client/assets/{error-boundary-BVTbN8PZ.js → error-boundary-DDTvdkB4.js} +2 -2
- package/build/client/assets/{error-boundary-BVTbN8PZ.js.map → error-boundary-DDTvdkB4.js.map} +1 -1
- package/build/client/assets/{finished-C0mN8TiU.js → finished-Bm-bCUU2.js} +2 -2
- package/build/client/assets/{finished-C0mN8TiU.js.map → finished-Bm-bCUU2.js.map} +1 -1
- package/build/client/assets/{index-Czg1ruVn.js → index-1cKOJFpX.js} +2 -2
- package/build/client/assets/{index-Czg1ruVn.js.map → index-1cKOJFpX.js.map} +1 -1
- package/build/client/assets/{index-DjzedX4O.js → index-B-hHvmeV.js} +2 -2
- package/build/client/assets/{index-DjzedX4O.js.map → index-B-hHvmeV.js.map} +1 -1
- package/build/client/assets/{index-yEAxvbDV.js → index-BATSX33w.js} +2 -2
- package/build/client/assets/{index-yEAxvbDV.js.map → index-BATSX33w.js.map} +1 -1
- package/build/client/assets/{index-C6ToujzV.js → index-BXWoOGxB.js} +4 -4
- package/build/client/assets/{index-C6ToujzV.js.map → index-BXWoOGxB.js.map} +1 -1
- package/build/client/assets/index-Dm1ll1kT.js +2 -0
- package/build/client/assets/index-Dm1ll1kT.js.map +1 -0
- package/build/client/assets/{index-D6ukHE4T.js → index-Dx5GmdYq.js} +2 -2
- package/build/client/assets/{index-D6ukHE4T.js.map → index-Dx5GmdYq.js.map} +1 -1
- package/build/client/assets/{index-De7yI02n.js → index-Tfdnz1AB.js} +2 -2
- package/build/client/assets/{index-De7yI02n.js.map → index-Tfdnz1AB.js.map} +1 -1
- package/build/client/assets/index-hogig2HK.js +2 -0
- package/build/client/assets/index-hogig2HK.js.map +1 -0
- package/build/client/assets/{loading-B0uKxERz.js → loading-C5uX0jJw.js} +2 -2
- package/build/client/assets/{loading-B0uKxERz.js.map → loading-C5uX0jJw.js.map} +1 -1
- package/build/client/assets/{login-SJlLMYmL.js → login-4cvVFzF8.js} +2 -2
- package/build/client/assets/{login-SJlLMYmL.js.map → login-4cvVFzF8.js.map} +1 -1
- package/build/client/assets/manifest-746b2907.js +1 -0
- package/build/client/assets/{mdx-CQW0I4So.js → mdx-M0kcP-mP.js} +2 -2
- package/build/client/assets/{mdx-CQW0I4So.js.map → mdx-M0kcP-mP.js.map} +1 -1
- package/build/client/assets/{misc-S5ZD98sI.js → misc-ENVX3CWf.js} +2 -2
- package/build/client/assets/{misc-S5ZD98sI.js.map → misc-ENVX3CWf.js.map} +1 -1
- package/build/client/assets/{nav-chevrons-DaXg0NPS.js → nav-chevrons-B82nbdyj.js} +2 -2
- package/build/client/assets/{nav-chevrons-DaXg0NPS.js.map → nav-chevrons-B82nbdyj.js.map} +1 -1
- package/build/client/assets/{onboarding-BXGyEPXy.js → onboarding-Bib-wh6d.js} +2 -2
- package/build/client/assets/{onboarding-BXGyEPXy.js.map → onboarding-Bib-wh6d.js.map} +1 -1
- package/build/client/assets/presence-Cr--lRCr.js +28 -0
- package/build/client/assets/{presence-CW1_eiIo.js.map → presence-Cr--lRCr.js.map} +1 -1
- package/build/client/assets/preview-CqrRe2BV.js +2 -0
- package/build/client/assets/preview-CqrRe2BV.js.map +1 -0
- package/build/client/assets/{progress-BwanvUpB.js → progress-BsY6hGPp.js} +2 -2
- package/build/client/assets/{progress-BwanvUpB.js.map → progress-BsY6hGPp.js.map} +1 -1
- package/build/client/assets/{progress-bar-wMXWRGq0.js → progress-bar-CSvo1ZXP.js} +2 -2
- package/build/client/assets/{progress-bar-wMXWRGq0.js.map → progress-bar-CSvo1ZXP.js.map} +1 -1
- package/build/client/assets/{request-info-DHtGM4FI.js → request-info-CEhUGODY.js} +2 -2
- package/build/client/assets/{request-info-DHtGM4FI.js.map → request-info-CEhUGODY.js.map} +1 -1
- package/build/client/assets/{root-BUqeXmeK.js → root-Tcnfz99O.js} +3 -3
- package/build/client/assets/root-Tcnfz99O.js.map +1 -0
- package/build/client/assets/set-playground-Cdy8VlVD.js +2 -0
- package/build/client/assets/set-playground-Cdy8VlVD.js.map +1 -0
- package/build/client/assets/{support-DilzTPHE.js → support-hcqGIpir.js} +2 -2
- package/build/client/assets/{support-DilzTPHE.js.map → support-hcqGIpir.js.map} +1 -1
- package/build/client/assets/tailwind-DTowOebn.css +1 -0
- package/build/client/assets/test-D9HsTvpe.js +2 -0
- package/build/client/assets/test-D9HsTvpe.js.map +1 -0
- package/build/client/assets/tests-CmNNBElK.js +4 -0
- package/build/client/assets/tests-CmNNBElK.js.map +1 -0
- package/build/client/assets/{tooltip-BtzSIxlB.js → tooltip-BiHTe_7F.js} +2 -2
- package/build/client/assets/{tooltip-BtzSIxlB.js.map → tooltip-BiHTe_7F.js.map} +1 -1
- package/build/client/assets/{use-event-source-ySol3hbz.js → use-event-source-A_0lEOPX.js} +2 -2
- package/build/client/assets/{use-event-source-ySol3hbz.js.map → use-event-source-A_0lEOPX.js.map} +1 -1
- package/build/client/assets/use-hydrated-Citou692.js +2 -0
- package/build/client/assets/use-hydrated-Citou692.js.map +1 -0
- package/build/client/assets/{user-CdUDQ7a8.js → user-D6tTg1yS.js} +2 -2
- package/build/client/assets/{user-CdUDQ7a8.js.map → user-D6tTg1yS.js.map} +1 -1
- package/build/client/icons.svg +1 -1
- package/build/server/index.js +6134 -5859
- package/build/server/index.js.map +1 -1
- package/package.json +3 -3
- package/build/client/assets/_-DYArYM0Z.js.map +0 -1
- package/build/client/assets/_exerciseNumber-BLQUCLPr.js +0 -2
- package/build/client/assets/_exerciseNumber-BLQUCLPr.js.map +0 -1
- package/build/client/assets/_exerciseNumber_._stepNumber-Ct5BCuA1.js.map +0 -1
- package/build/client/assets/_exerciseNumber_.finished-C9TSc48F.js.map +0 -1
- package/build/client/assets/_layout-B789acDk.js +0 -6
- package/build/client/assets/_layout-B789acDk.js.map +0 -1
- package/build/client/assets/_layout-DLIzcS5v.js.map +0 -1
- package/build/client/assets/_layout-DhP5RhPk.js +0 -4
- package/build/client/assets/_layout-DhP5RhPk.js.map +0 -1
- package/build/client/assets/diff-4FQLirNf.js +0 -2
- package/build/client/assets/diff-4FQLirNf.js.map +0 -1
- package/build/client/assets/diff-CPrD1rHd.js +0 -2
- package/build/client/assets/discord-Dk1wbXOn.js +0 -2
- package/build/client/assets/discord-Dk1wbXOn.js.map +0 -1
- package/build/client/assets/manifest-73106676.js +0 -1
- package/build/client/assets/presence-CW1_eiIo.js +0 -28
- package/build/client/assets/root-BUqeXmeK.js.map +0 -1
- package/build/client/assets/tailwind-BZciDTNv.css +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{j as e}from"./index-
|
|
2
|
-
//# sourceMappingURL=nav-chevrons-
|
|
1
|
+
import{j as e}from"./index-1cKOJFpX.js";import{I as t}from"./misc-ENVX3CWf.js";import{L as o}from"./components-CME-nGId.js";function l({prev:r,next:a}){return e.jsxs("div",{className:"relative flex h-full overflow-hidden",children:[r?e.jsx(o,{prefetch:"intent",...r,className:"group flex h-full items-center justify-center border-l px-7",children:e.jsxs(e.Fragment,{children:[e.jsx(t,{name:"ChevronLeft",className:"absolute opacity-100 transition duration-300 ease-in-out group-hover:translate-y-10 group-hover:opacity-0"}),e.jsx(t,{name:"ChevronLeft",className:"absolute -translate-y-10 opacity-0 transition duration-300 ease-in-out group-hover:translate-y-0 group-hover:opacity-100"})]})}):null,a?e.jsx(o,{prefetch:"intent",...a,className:"group flex h-full items-center justify-center border-l px-7",children:e.jsxs(e.Fragment,{children:[e.jsx(t,{name:"ChevronRight",className:"absolute opacity-100 transition duration-300 ease-in-out group-hover:translate-y-10 group-hover:opacity-0"}),e.jsx(t,{name:"ChevronRight",className:"absolute -translate-y-10 opacity-0 transition duration-300 ease-in-out group-hover:translate-y-0 group-hover:opacity-100"})]})}):null]})}export{l as N};
|
|
2
|
+
//# sourceMappingURL=nav-chevrons-B82nbdyj.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nav-chevrons-
|
|
1
|
+
{"version":3,"file":"nav-chevrons-B82nbdyj.js","sources":["../../../app/components/nav-chevrons.tsx"],"sourcesContent":["import { Link, type LinkProps } from '@remix-run/react'\nimport { Icon } from './icons.tsx'\n\nexport function NavChevrons({\n\tprev,\n\tnext,\n}: {\n\tprev?: LinkProps | null\n\tnext?: LinkProps | null\n}) {\n\treturn (\n\t\t<div className=\"relative flex h-full overflow-hidden\">\n\t\t\t{prev ? (\n\t\t\t\t<Link\n\t\t\t\t\tprefetch=\"intent\"\n\t\t\t\t\t{...prev}\n\t\t\t\t\tclassName=\"group flex h-full items-center justify-center border-l px-7\"\n\t\t\t\t\tchildren={\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\t\tname=\"ChevronLeft\"\n\t\t\t\t\t\t\t\tclassName=\"absolute opacity-100 transition duration-300 ease-in-out group-hover:translate-y-10 group-hover:opacity-0\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\t\tname=\"ChevronLeft\"\n\t\t\t\t\t\t\t\tclassName=\"absolute -translate-y-10 opacity-0 transition duration-300 ease-in-out group-hover:translate-y-0 group-hover:opacity-100\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</>\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t) : null}\n\t\t\t{next ? (\n\t\t\t\t<Link\n\t\t\t\t\tprefetch=\"intent\"\n\t\t\t\t\t{...next}\n\t\t\t\t\tclassName=\"group flex h-full items-center justify-center border-l px-7\"\n\t\t\t\t\tchildren={\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\t\tname=\"ChevronRight\"\n\t\t\t\t\t\t\t\tclassName=\"absolute opacity-100 transition duration-300 ease-in-out group-hover:translate-y-10 group-hover:opacity-0\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\t\tname=\"ChevronRight\"\n\t\t\t\t\t\t\t\tclassName=\"absolute -translate-y-10 opacity-0 transition duration-300 ease-in-out group-hover:translate-y-0 group-hover:opacity-100\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</>\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t) : null}\n\t\t</div>\n\t)\n}\n"],"names":["NavChevrons","prev","next","jsxs","jsx","Link","Fragment","Icon"],"mappings":"4HAGO,SAASA,EAAY,CAC3B,KAAAC,EACA,KAAAC,CACD,EAGG,CAED,OAAAC,EAAA,KAAC,MAAI,CAAA,UAAU,uCACb,SAAA,CACAF,EAAAG,EAAA,IAACC,EAAA,CACA,SAAS,SACR,GAAGJ,EACJ,UAAU,8DACV,SAEEE,EAAA,KAAAG,WAAA,CAAA,SAAA,CAAAF,EAAA,IAACG,EAAA,CACA,KAAK,cACL,UAAU,2GAAA,CACX,EACAH,EAAA,IAACG,EAAA,CACA,KAAK,cACL,UAAU,0HAAA,CACX,CAAA,EACD,CAAA,CAAA,EAGC,KACHL,EACAE,EAAA,IAACC,EAAA,CACA,SAAS,SACR,GAAGH,EACJ,UAAU,8DACV,SAEEC,EAAA,KAAAG,WAAA,CAAA,SAAA,CAAAF,EAAA,IAACG,EAAA,CACA,KAAK,eACL,UAAU,2GAAA,CACX,EACAH,EAAA,IAACG,EAAA,CACA,KAAK,eACL,UAAU,0HAAA,CACX,CAAA,EACD,CAAA,CAAA,EAGC,IACL,CAAA,CAAA,CAEF"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{j as e}from"./index-
|
|
2
|
-
//# sourceMappingURL=onboarding-
|
|
1
|
+
import{j as e}from"./index-1cKOJFpX.js";import{B as o}from"./button-BklqyTPS.js";import{E as r,D as s}from"./epic-video-iluUs1-s.js";import{u as i,F as l}from"./components-CME-nGId.js";import"./clsx-B-dksMZM.js";import"./index-BATSX33w.js";import"./request-info-CEhUGODY.js";import"./misc-ENVX3CWf.js";import"./tooltip-BiHTe_7F.js";import"./client-hints-DNUUFGmB.js";import"./loading-C5uX0jJw.js";import"./user-D6tTg1yS.js";const w={getSitemapEntries:()=>null};function v(){const t=i();return e.jsxs("main",{className:"flex h-full w-full flex-col items-center justify-between gap-4",children:[e.jsxs("div",{className:"container flex h-full w-full max-w-5xl flex-1 flex-col items-center gap-4 overflow-y-scroll py-12 scrollbar-thin scrollbar-thumb-scrollbar",children:[e.jsx("h1",{className:"text-5xl",children:"Onboarding"}),e.jsx("p",{className:"text-xl",children:"Welcome to EpicWeb.dev!"}),e.jsxs("p",{className:"text-lg",children:["Before you get started, ",e.jsx("strong",{children:"you must watch the tour video"}),"! You're going to be spending a lot of time in here, so it's important you understand how to work effectively in this workshop"]}),e.jsx("div",{className:"w-[780px] max-w-full",children:e.jsx(r,{epicVideoInfosPromise:t.videoInfos,children:e.jsx(s,{url:t.tourUrl})})})]}),e.jsx(l,{method:"post",className:"pb-4",children:e.jsx(o,{name:"intent",value:"complete",varient:"primary",children:"I've watched it. Let's go!"})})]})}export{v as default,w as handle};
|
|
2
|
+
//# sourceMappingURL=onboarding-Bib-wh6d.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"onboarding-
|
|
1
|
+
{"version":3,"file":"onboarding-Bib-wh6d.js","sources":["../../../app/routes/onboarding.tsx"],"sourcesContent":["import { invariantResponse } from '@epic-web/invariant'\nimport { updateOnboardingData } from '@epic-web/workshop-utils/db.server'\nimport { makeTimings } from '@epic-web/workshop-utils/timing.server'\nimport { type SEOHandle } from '@nasa-gcn/remix-seo'\nimport {\n\tdefer,\n\tredirect,\n\ttype ActionFunctionArgs,\n\ttype HeadersFunction,\n\ttype LoaderFunctionArgs,\n} from '@remix-run/node'\nimport { Form, useLoaderData } from '@remix-run/react'\nimport { Button } from '#app/components/button.tsx'\nimport {\n\tDeferredEpicVideo,\n\tEpicVideoInfoProvider,\n} from '#app/components/epic-video.tsx'\nimport { getEpicVideoInfos } from '#app/utils/epic-api.ts'\n\nexport const handle: SEOHandle = {\n\tgetSitemapEntries: () => null,\n}\n\nexport async function loader({ request }: LoaderFunctionArgs) {\n\tconst timings = makeTimings('onboarding')\n\n\tconst tourUrl =\n\t\t'https://www.epicweb.dev/tips/get-started-with-the-epic-workshop-app'\n\tconst videoInfos = getEpicVideoInfos([tourUrl], { request, timings })\n\treturn defer(\n\t\t{ tourUrl, videoInfos },\n\t\t{ headers: { 'Server-Timing': timings.toString() } },\n\t)\n}\n\nexport const headers: HeadersFunction = ({ loaderHeaders }) => {\n\tconst headers = {\n\t\t'Server-Timing': loaderHeaders.get('Server-Timing') ?? '',\n\t}\n\treturn headers\n}\n\nexport async function action({ request }: ActionFunctionArgs) {\n\tconst data = await request.formData()\n\tconst intent = data.get('intent')\n\tinvariantResponse(intent === 'complete', 'Invalid intent')\n\tawait updateOnboardingData({ finishedTourVideo: true })\n\tthrow redirect('/account')\n}\n\nexport default function Onboarding() {\n\tconst data = useLoaderData<typeof loader>()\n\treturn (\n\t\t<main className=\"flex h-full w-full flex-col items-center justify-between gap-4\">\n\t\t\t<div className=\"container flex h-full w-full max-w-5xl flex-1 flex-col items-center gap-4 overflow-y-scroll py-12 scrollbar-thin scrollbar-thumb-scrollbar\">\n\t\t\t\t<h1 className=\"text-5xl\">Onboarding</h1>\n\t\t\t\t<p className=\"text-xl\">Welcome to EpicWeb.dev!</p>\n\t\t\t\t<p className=\"text-lg\">\n\t\t\t\t\tBefore you get started, <strong>you must watch the tour video</strong>\n\t\t\t\t\t! You're going to be spending a lot of time in here, so it's important\n\t\t\t\t\tyou understand how to work effectively in this workshop\n\t\t\t\t</p>\n\t\t\t\t<div className=\"w-[780px] max-w-full\">\n\t\t\t\t\t<EpicVideoInfoProvider epicVideoInfosPromise={data.videoInfos}>\n\t\t\t\t\t\t<DeferredEpicVideo url={data.tourUrl} />\n\t\t\t\t\t</EpicVideoInfoProvider>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t<Form method=\"post\" className=\"pb-4\">\n\t\t\t\t<Button name=\"intent\" value=\"complete\" varient=\"primary\">\n\t\t\t\t\tI've watched it. Let's go!\n\t\t\t\t</Button>\n\t\t\t</Form>\n\t\t</main>\n\t)\n}\n"],"names":["handle","getSitemapEntries","Onboarding","data","useLoaderData","jsxs","className","children","jsx","EpicVideoInfoProvider","epicVideoInfosPromise","videoInfos","DeferredEpicVideo","url","tourUrl","Form","method","Button","name","value","varient"],"mappings":"waAmBO,MAAMA,EAAoB,CAChCC,kBAAmBA,IAAM,IAC1B,EA6BA,SAAwBC,GAAa,CACpC,MAAMC,EAAOC,IAEZ,OAAAC,EAAAA,KAAC,OAAK,CAAAC,UAAU,iEACfC,SAAA,CAACF,EAAA,KAAA,MAAA,CAAIC,UAAU,6IACdC,SAAA,CAACC,EAAA,IAAA,KAAA,CAAGF,UAAU,WAAWC,SAAU,YAAA,CAAA,EAClCC,EAAA,IAAA,IAAA,CAAEF,UAAU,UAAUC,SAAuB,yBAAA,CAAA,EAC9CF,EAAA,KAAC,IAAE,CAAAC,UAAU,UAAUC,SAAA,CAAA,2BACEC,EAAA,IAAC,UAAOD,SAA6B,+BAAA,CAAA,EAAS,gIAAA,CAGvE,CAAA,EACCC,EAAA,IAAA,MAAA,CAAIF,UAAU,uBACdC,eAACE,EAAsB,CAAAC,sBAAuBP,EAAKQ,WAClDJ,eAACK,EAAkB,CAAAC,IAAKV,EAAKW,QAAS,EACvC,CACD,CAAA,CAAA,CACD,CAAA,EACCN,EAAA,IAAAO,EAAA,CAAKC,OAAO,OAAOV,UAAU,OAC7BC,SAAAC,EAAA,IAACS,EAAO,CAAAC,KAAK,SAASC,MAAM,WAAWC,QAAQ,UAAUb,sCAEzD,CACD,CAAA,CAAA,CACD,CAAA,CAEF"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
var it=Object.defineProperty;var ct=(e,n,t)=>n in e?it(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t;var d=(e,n,t)=>ct(e,typeof n!="symbol"?n+"":n,t);import{n as te,r as E,j as at,b as ut}from"./index-1cKOJFpX.js";import{z as p,u as lt}from"./request-info-CEhUGODY.js";import{e as K}from"./components-CME-nGId.js";const ae="epic-web-presence",ht=`https://epic-web-presence.kentcdodds.partykit.dev/parties/main/${ae}`,X=p.object({id:p.string(),avatarUrl:p.string().nullable().optional(),name:p.string().nullable().optional(),location:p.object({workshopTitle:p.string().nullable().optional(),origin:p.string().nullable().optional(),exercise:p.object({type:p.union([p.literal("problem"),p.literal("solution")]).nullable().optional(),exerciseNumber:p.number().nullable().optional(),stepNumber:p.number().nullable().optional()}).nullable().optional()}).nullable().optional()}),ft=p.object({type:p.literal("remove-user"),payload:p.object({id:p.string()})}).or(p.object({type:p.literal("add-user"),payload:X})).or(p.object({type:p.literal("presence"),payload:p.object({users:p.array(X)})}));p.object({users:p.array(X)});var B={},y={},w={};Object.defineProperty(w,"__esModule",{value:!0});w.output=w.exists=w.hash=w.bytes=w.bool=w.number=w.isBytes=void 0;function F(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`positive integer expected, not ${e}`)}w.number=F;function ue(e){if(typeof e!="boolean")throw new Error(`boolean expected, not ${e}`)}w.bool=ue;function le(e){return e instanceof Uint8Array||e!=null&&typeof e=="object"&&e.constructor.name==="Uint8Array"}w.isBytes=le;function z(e,...n){if(!le(e))throw new Error("Uint8Array expected");if(n.length>0&&!n.includes(e.length))throw new Error(`Uint8Array expected of length ${n}, not of length=${e.length}`)}w.bytes=z;function he(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");F(e.outputLen),F(e.blockLen)}w.hash=he;function fe(e,n=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(n&&e.finished)throw new Error("Hash#digest() has already been called")}w.exists=fe;function de(e,n){z(e);const t=n.outputLen;if(e.length<t)throw new Error(`digestInto() expects output buffer of length at least ${t}`)}w.output=de;const dt={number:F,bool:ue,bytes:z,hash:he,exists:fe,output:de};w.default=dt;var u={};Object.defineProperty(u,"__esModule",{value:!0});u.add5L=u.add5H=u.add4H=u.add4L=u.add3H=u.add3L=u.add=u.rotlBL=u.rotlBH=u.rotlSL=u.rotlSH=u.rotr32L=u.rotr32H=u.rotrBL=u.rotrBH=u.rotrSL=u.rotrSH=u.shrSL=u.shrSH=u.toBig=u.split=u.fromBig=void 0;const D=BigInt(2**32-1),Q=BigInt(32);function J(e,n=!1){return n?{h:Number(e&D),l:Number(e>>Q&D)}:{h:Number(e>>Q&D)|0,l:Number(e&D)|0}}u.fromBig=J;function pe(e,n=!1){let t=new Uint32Array(e.length),s=new Uint32Array(e.length);for(let r=0;r<e.length;r++){const{h:i,l:c}=J(e[r],n);[t[r],s[r]]=[i,c]}return[t,s]}u.split=pe;const ye=(e,n)=>BigInt(e>>>0)<<Q|BigInt(n>>>0);u.toBig=ye;const _e=(e,n,t)=>e>>>t;u.shrSH=_e;const ge=(e,n,t)=>e<<32-t|n>>>t;u.shrSL=ge;const me=(e,n,t)=>e>>>t|n<<32-t;u.rotrSH=me;const be=(e,n,t)=>e<<32-t|n>>>t;u.rotrSL=be;const we=(e,n,t)=>e<<64-t|n>>>t-32;u.rotrBH=we;const Le=(e,n,t)=>e>>>t-32|n<<64-t;u.rotrBL=Le;const ke=(e,n)=>n;u.rotr32H=ke;const ve=(e,n)=>e;u.rotr32L=ve;const Ee=(e,n,t)=>e<<t|n>>>32-t;u.rotlSH=Ee;const Se=(e,n,t)=>n<<t|e>>>32-t;u.rotlSL=Se;const xe=(e,n,t)=>n<<t-32|e>>>64-t;u.rotlBH=xe;const Te=(e,n,t)=>e<<t-32|n>>>64-t;u.rotlBL=Te;function Oe(e,n,t,s){const r=(n>>>0)+(s>>>0);return{h:e+t+(r/2**32|0)|0,l:r|0}}u.add=Oe;const Ce=(e,n,t)=>(e>>>0)+(n>>>0)+(t>>>0);u.add3L=Ce;const Be=(e,n,t,s)=>n+t+s+(e/2**32|0)|0;u.add3H=Be;const Ie=(e,n,t,s)=>(e>>>0)+(n>>>0)+(t>>>0)+(s>>>0);u.add4L=Ie;const Ue=(e,n,t,s,r)=>n+t+s+r+(e/2**32|0)|0;u.add4H=Ue;const Pe=(e,n,t,s,r)=>(e>>>0)+(n>>>0)+(t>>>0)+(s>>>0)+(r>>>0);u.add5L=Pe;const Ne=(e,n,t,s,r,i)=>n+t+s+r+i+(e/2**32|0)|0;u.add5H=Ne;const pt={fromBig:J,split:pe,toBig:ye,shrSH:_e,shrSL:ge,rotrSH:me,rotrSL:be,rotrBH:we,rotrBL:Le,rotr32H:ke,rotr32L:ve,rotlSH:Ee,rotlSL:Se,rotlBH:xe,rotlBL:Te,add:Oe,add3L:Ce,add3H:Be,add4L:Ie,add4H:Ue,add5H:Ne,add5L:Pe};u.default=pt;var He={},q={};Object.defineProperty(q,"__esModule",{value:!0});q.crypto=void 0;q.crypto=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;(function(e){/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */Object.defineProperty(e,"__esModule",{value:!0}),e.randomBytes=e.wrapXOFConstructorWithOpts=e.wrapConstructorWithOpts=e.wrapConstructor=e.checkOpts=e.Hash=e.concatBytes=e.toBytes=e.utf8ToBytes=e.asyncLoop=e.nextTick=e.hexToBytes=e.bytesToHex=e.byteSwap32=e.byteSwapIfBE=e.byteSwap=e.isLE=e.rotl=e.rotr=e.createView=e.u32=e.u8=e.isBytes=void 0;const n=q,t=w;function s(o){return o instanceof Uint8Array||o!=null&&typeof o=="object"&&o.constructor.name==="Uint8Array"}e.isBytes=s;const r=o=>new Uint8Array(o.buffer,o.byteOffset,o.byteLength);e.u8=r;const i=o=>new Uint32Array(o.buffer,o.byteOffset,Math.floor(o.byteLength/4));e.u32=i;const c=o=>new DataView(o.buffer,o.byteOffset,o.byteLength);e.createView=c;const a=(o,f)=>o<<32-f|o>>>f;e.rotr=a;const h=(o,f)=>o<<f|o>>>32-f>>>0;e.rotl=h,e.isLE=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;const l=o=>o<<24&4278190080|o<<8&16711680|o>>>8&65280|o>>>24&255;e.byteSwap=l,e.byteSwapIfBE=e.isLE?o=>o:o=>(0,e.byteSwap)(o);function L(o){for(let f=0;f<o.length;f++)o[f]=(0,e.byteSwap)(o[f])}e.byteSwap32=L;const b=Array.from({length:256},(o,f)=>f.toString(16).padStart(2,"0"));function S(o){(0,t.bytes)(o);let f="";for(let m=0;m<o.length;m++)f+=b[o[m]];return f}e.bytesToHex=S;const _={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};function x(o){if(o>=_._0&&o<=_._9)return o-_._0;if(o>=_._A&&o<=_._F)return o-(_._A-10);if(o>=_._a&&o<=_._f)return o-(_._a-10)}function W(o){if(typeof o!="string")throw new Error("hex string expected, got "+typeof o);const f=o.length,m=f/2;if(f%2)throw new Error("padded hex string expected, got unpadded hex of length "+f);const g=new Uint8Array(m);for(let k=0,v=0;k<m;k++,v+=2){const Z=x(o.charCodeAt(v)),ee=x(o.charCodeAt(v+1));if(Z===void 0||ee===void 0){const ot=o[v]+o[v+1];throw new Error('hex string expected, got non-hex character "'+ot+'" at index '+v)}g[k]=Z*16+ee}return g}e.hexToBytes=W;const O=async()=>{};e.nextTick=O;async function C(o,f,m){let g=Date.now();for(let k=0;k<o;k++){m(k);const v=Date.now()-g;v>=0&&v<f||(await(0,e.nextTick)(),g+=v)}}e.asyncLoop=C;function Y(o){if(typeof o!="string")throw new Error(`utf8ToBytes expected string, got ${typeof o}`);return new Uint8Array(new TextEncoder().encode(o))}e.utf8ToBytes=Y;function j(o){return typeof o=="string"&&(o=Y(o)),(0,t.bytes)(o),o}e.toBytes=j;function Je(...o){let f=0;for(let g=0;g<o.length;g++){const k=o[g];(0,t.bytes)(k),f+=k.length}const m=new Uint8Array(f);for(let g=0,k=0;g<o.length;g++){const v=o[g];m.set(v,k),k+=v.length}return m}e.concatBytes=Je;class Ye{clone(){return this._cloneInto()}}e.Hash=Ye;const Ze={}.toString;function et(o,f){if(f!==void 0&&Ze.call(f)!=="[object Object]")throw new Error("Options should be object or undefined");return Object.assign(o,f)}e.checkOpts=et;function tt(o){const f=g=>o().update(j(g)).digest(),m=o();return f.outputLen=m.outputLen,f.blockLen=m.blockLen,f.create=()=>o(),f}e.wrapConstructor=tt;function nt(o){const f=(g,k)=>o(k).update(j(g)).digest(),m=o({});return f.outputLen=m.outputLen,f.blockLen=m.blockLen,f.create=g=>o(g),f}e.wrapConstructorWithOpts=nt;function st(o){const f=(g,k)=>o(k).update(j(g)).digest(),m=o({});return f.outputLen=m.outputLen,f.blockLen=m.blockLen,f.create=g=>o(g),f}e.wrapXOFConstructorWithOpts=st;function rt(o=32){if(n.crypto&&typeof n.crypto.getRandomValues=="function")return n.crypto.getRandomValues(new Uint8Array(o));throw new Error("crypto.getRandomValues must be defined")}e.randomBytes=rt})(He);Object.defineProperty(y,"__esModule",{value:!0});y.shake256=y.shake128=y.keccak_512=y.keccak_384=y.keccak_256=y.keccak_224=y.sha3_512=y.sha3_384=y.sha3_256=y.sha3_224=y.Keccak=y.keccakP=void 0;const N=w,R=u,T=He,Ae=[],Re=[],Me=[],yt=BigInt(0),H=BigInt(1),_t=BigInt(2),gt=BigInt(7),mt=BigInt(256),bt=BigInt(113);for(let e=0,n=H,t=1,s=0;e<24;e++){[t,s]=[s,(2*t+3*s)%5],Ae.push(2*(5*s+t)),Re.push((e+1)*(e+2)/2%64);let r=yt;for(let i=0;i<7;i++)n=(n<<H^(n>>gt)*bt)%mt,n&_t&&(r^=H<<(H<<BigInt(i))-H);Me.push(r)}const[wt,Lt]=(0,R.split)(Me,!0),ne=(e,n,t)=>t>32?(0,R.rotlBH)(e,n,t):(0,R.rotlSH)(e,n,t),se=(e,n,t)=>t>32?(0,R.rotlBL)(e,n,t):(0,R.rotlSL)(e,n,t);function We(e,n=24){const t=new Uint32Array(10);for(let s=24-n;s<24;s++){for(let c=0;c<10;c++)t[c]=e[c]^e[c+10]^e[c+20]^e[c+30]^e[c+40];for(let c=0;c<10;c+=2){const a=(c+8)%10,h=(c+2)%10,l=t[h],L=t[h+1],b=ne(l,L,1)^t[a],S=se(l,L,1)^t[a+1];for(let _=0;_<50;_+=10)e[c+_]^=b,e[c+_+1]^=S}let r=e[2],i=e[3];for(let c=0;c<24;c++){const a=Re[c],h=ne(r,i,a),l=se(r,i,a),L=Ae[c];r=e[L],i=e[L+1],e[L]=h,e[L+1]=l}for(let c=0;c<50;c+=10){for(let a=0;a<10;a++)t[a]=e[c+a];for(let a=0;a<10;a++)e[c+a]^=~t[(a+2)%10]&t[(a+4)%10]}e[0]^=wt[s],e[1]^=Lt[s]}t.fill(0)}y.keccakP=We;class M extends T.Hash{constructor(n,t,s,r=!1,i=24){if(super(),this.blockLen=n,this.suffix=t,this.outputLen=s,this.enableXOF=r,this.rounds=i,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,(0,N.number)(s),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=(0,T.u32)(this.state)}keccak(){T.isLE||(0,T.byteSwap32)(this.state32),We(this.state32,this.rounds),T.isLE||(0,T.byteSwap32)(this.state32),this.posOut=0,this.pos=0}update(n){(0,N.exists)(this);const{blockLen:t,state:s}=this;n=(0,T.toBytes)(n);const r=n.length;for(let i=0;i<r;){const c=Math.min(t-this.pos,r-i);for(let a=0;a<c;a++)s[this.pos++]^=n[i++];this.pos===t&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:n,suffix:t,pos:s,blockLen:r}=this;n[s]^=t,t&128&&s===r-1&&this.keccak(),n[r-1]^=128,this.keccak()}writeInto(n){(0,N.exists)(this,!1),(0,N.bytes)(n),this.finish();const t=this.state,{blockLen:s}=this;for(let r=0,i=n.length;r<i;){this.posOut>=s&&this.keccak();const c=Math.min(s-this.posOut,i-r);n.set(t.subarray(this.posOut,this.posOut+c),r),this.posOut+=c,r+=c}return n}xofInto(n){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(n)}xof(n){return(0,N.number)(n),this.xofInto(new Uint8Array(n))}digestInto(n){if((0,N.output)(n,this),this.finished)throw new Error("digest() was already called");return this.writeInto(n),this.destroy(),n}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(n){const{blockLen:t,suffix:s,outputLen:r,rounds:i,enableXOF:c}=this;return n||(n=new M(t,s,r,c,i)),n.state32.set(this.state32),n.pos=this.pos,n.posOut=this.posOut,n.finished=this.finished,n.rounds=i,n.suffix=s,n.outputLen=r,n.enableXOF=c,n.destroyed=this.destroyed,n}}y.Keccak=M;const I=(e,n,t)=>(0,T.wrapConstructor)(()=>new M(n,e,t));y.sha3_224=I(6,144,224/8);y.sha3_256=I(6,136,256/8);y.sha3_384=I(6,104,384/8);y.sha3_512=I(6,72,512/8);y.keccak_224=I(1,144,224/8);y.keccak_256=I(1,136,256/8);y.keccak_384=I(1,104,384/8);y.keccak_512=I(1,72,512/8);const je=(e,n,t)=>(0,T.wrapXOFConstructorWithOpts)((s={})=>new M(n,e,s.dkLen===void 0?t:s.dkLen,!0));y.shake128=je(31,168,128/8);y.shake256=je(31,136,256/8);const{sha3_512:kt}=y,De=24,A=32,V=(e=4,n=Math.random)=>{let t="";for(;t.length<e;)t=t+Math.floor(n()*36).toString(36);return t};function $e(e){let n=8n,t=0n;for(const s of e.values()){const r=BigInt(s);t=(t<<n)+r}return t}const Fe=(e="")=>$e(kt(e)).toString(36).slice(1),re=Array.from({length:26},(e,n)=>String.fromCharCode(n+97)),vt=e=>re[Math.floor(e()*re.length)],qe=({globalObj:e=typeof te<"u"?te:typeof window<"u"?window:{},random:n=Math.random}={})=>{const t=Object.keys(e).toString(),s=t.length?t+V(A,n):V(A,n);return Fe(s).substring(0,A)},Ge=e=>()=>e++,Et=476782367,Xe=({random:e=Math.random,counter:n=Ge(Math.floor(e()*Et)),length:t=De,fingerprint:s=qe({random:e})}={})=>function(){const i=vt(e),c=Date.now().toString(36),a=n().toString(36),h=V(t,e),l=`${c+h+a+s}`;return`${i+Fe(l).substring(1,t)}`},St=Xe(),xt=(e,{minLength:n=2,maxLength:t=A}={})=>{const s=e.length,r=/^[0-9a-z]+$/;try{if(typeof e=="string"&&s>=n&&s<=t&&r.test(e))return!0}finally{}return!1};B.getConstants=()=>({defaultLength:De,bigLength:A});B.init=Xe;B.createId=St;B.bufToBigInt=$e;B.createCounter=Ge;B.createFingerprint=qe;B.isCuid=xt;const{createId:Tt,init:zt,getConstants:Jt,isCuid:Yt}=B;var Ot=Tt;(!globalThis.EventTarget||!globalThis.Event)&&console.error(`
|
|
2
|
+
PartySocket requires a global 'EventTarget' class to be available!
|
|
3
|
+
You can polyfill this global by adding this to your code before any partysocket imports:
|
|
4
|
+
|
|
5
|
+
\`\`\`
|
|
6
|
+
import 'partysocket/event-target-polyfill';
|
|
7
|
+
\`\`\`
|
|
8
|
+
Please file an issue at https://github.com/partykit/partykit if you're still having trouble.
|
|
9
|
+
`);var Qe=class extends Event{constructor(n,t){super("error",t);d(this,"message");d(this,"error");this.message=n.message,this.error=n}},Ve=class extends Event{constructor(n=1e3,t="",s){super("close",s);d(this,"code");d(this,"reason");d(this,"wasClean",!0);this.code=n,this.reason=t}},G={Event,ErrorEvent:Qe,CloseEvent:Ve};function Ct(e,n){if(!e)throw new Error(n)}function Bt(e){return new e.constructor(e.type,e)}function It(e){return"data"in e?new MessageEvent(e.type,e):"code"in e||"reason"in e?new Ve(e.code||1999,e.reason||"unknown reason",e):"error"in e?new Qe(e.error,e):new Event(e.type,e)}var ce,Ut=typeof process<"u"&&typeof((ce=process.versions)==null?void 0:ce.node)<"u"&&typeof document>"u",$=Ut?It:Bt,U={maxReconnectionDelay:1e4,minReconnectionDelay:1e3+Math.random()*4e3,minUptime:5e3,reconnectionDelayGrowFactor:1.3,connectionTimeout:4e3,maxRetries:1/0,maxEnqueuedMessages:1/0,startClosed:!1,debug:!1},oe=!1,Pt=class P extends EventTarget{constructor(t,s,r={}){super();d(this,"_ws");d(this,"_retryCount",-1);d(this,"_uptimeTimeout");d(this,"_connectTimeout");d(this,"_shouldReconnect",!0);d(this,"_connectLock",!1);d(this,"_binaryType","blob");d(this,"_closeCalled",!1);d(this,"_messageQueue",[]);d(this,"_debugLogger",console.log.bind(console));d(this,"_url");d(this,"_protocols");d(this,"_options");d(this,"onclose",null);d(this,"onerror",null);d(this,"onmessage",null);d(this,"onopen",null);d(this,"_handleOpen",t=>{this._debug("open event");const{minUptime:s=U.minUptime}=this._options;clearTimeout(this._connectTimeout),this._uptimeTimeout=setTimeout(()=>this._acceptOpen(),s),Ct(this._ws,"WebSocket is not defined"),this._ws.binaryType=this._binaryType,this._messageQueue.forEach(r=>{var i;return(i=this._ws)==null?void 0:i.send(r)}),this._messageQueue=[],this.onopen&&this.onopen(t),this.dispatchEvent($(t))});d(this,"_handleMessage",t=>{this._debug("message event"),this.onmessage&&this.onmessage(t),this.dispatchEvent($(t))});d(this,"_handleError",t=>{this._debug("error event",t.message),this._disconnect(void 0,t.message==="TIMEOUT"?"timeout":void 0),this.onerror&&this.onerror(t),this._debug("exec error listeners"),this.dispatchEvent($(t)),this._connect()});d(this,"_handleClose",t=>{this._debug("close event"),this._clearTimeouts(),this._shouldReconnect&&this._connect(),this.onclose&&this.onclose(t),this.dispatchEvent($(t))});this._url=t,this._protocols=s,this._options=r,this._options.startClosed&&(this._shouldReconnect=!1),this._options.debugLogger&&(this._debugLogger=this._options.debugLogger),this._connect()}static get CONNECTING(){return 0}static get OPEN(){return 1}static get CLOSING(){return 2}static get CLOSED(){return 3}get CONNECTING(){return P.CONNECTING}get OPEN(){return P.OPEN}get CLOSING(){return P.CLOSING}get CLOSED(){return P.CLOSED}get binaryType(){return this._ws?this._ws.binaryType:this._binaryType}set binaryType(t){this._binaryType=t,this._ws&&(this._ws.binaryType=t)}get retryCount(){return Math.max(this._retryCount,0)}get bufferedAmount(){return this._messageQueue.reduce((s,r)=>(typeof r=="string"?s+=r.length:r instanceof Blob?s+=r.size:s+=r.byteLength,s),0)+(this._ws?this._ws.bufferedAmount:0)}get extensions(){return this._ws?this._ws.extensions:""}get protocol(){return this._ws?this._ws.protocol:""}get readyState(){return this._ws?this._ws.readyState:this._options.startClosed?P.CLOSED:P.CONNECTING}get url(){return this._ws?this._ws.url:""}get shouldReconnect(){return this._shouldReconnect}close(t=1e3,s){if(this._closeCalled=!0,this._shouldReconnect=!1,this._clearTimeouts(),!this._ws){this._debug("close enqueued: no ws instance");return}if(this._ws.readyState===this.CLOSED){this._debug("close: already closed");return}this._ws.close(t,s)}reconnect(t,s){this._shouldReconnect=!0,this._closeCalled=!1,this._retryCount=-1,!this._ws||this._ws.readyState===this.CLOSED?this._connect():(this._disconnect(t,s),this._connect())}send(t){if(this._ws&&this._ws.readyState===this.OPEN)this._debug("send",t),this._ws.send(t);else{const{maxEnqueuedMessages:s=U.maxEnqueuedMessages}=this._options;this._messageQueue.length<s&&(this._debug("enqueue",t),this._messageQueue.push(t))}}_debug(...t){this._options.debug&&this._debugLogger("RWS>",...t)}_getNextDelay(){const{reconnectionDelayGrowFactor:t=U.reconnectionDelayGrowFactor,minReconnectionDelay:s=U.minReconnectionDelay,maxReconnectionDelay:r=U.maxReconnectionDelay}=this._options;let i=0;return this._retryCount>0&&(i=s*Math.pow(t,this._retryCount-1),i>r&&(i=r)),this._debug("next delay",i),i}_wait(){return new Promise(t=>{setTimeout(t,this._getNextDelay())})}_getNextProtocols(t){if(!t)return Promise.resolve(null);if(typeof t=="string"||Array.isArray(t))return Promise.resolve(t);if(typeof t=="function"){const s=t();if(!s)return Promise.resolve(null);if(typeof s=="string"||Array.isArray(s))return Promise.resolve(s);if(s.then)return s}throw Error("Invalid protocols")}_getNextUrl(t){if(typeof t=="string")return Promise.resolve(t);if(typeof t=="function"){const s=t();if(typeof s=="string")return Promise.resolve(s);if(s.then)return s}throw Error("Invalid URL")}_connect(){if(this._connectLock||!this._shouldReconnect)return;this._connectLock=!0;const{maxRetries:t=U.maxRetries,connectionTimeout:s=U.connectionTimeout}=this._options;if(this._retryCount>=t){this._debug("max retries reached",this._retryCount,">=",t);return}this._retryCount++,this._debug("connect",this._retryCount),this._removeListeners(),this._wait().then(()=>Promise.all([this._getNextUrl(this._url),this._getNextProtocols(this._protocols||null)])).then(([r,i])=>{if(this._closeCalled){this._connectLock=!1;return}!this._options.WebSocket&&typeof WebSocket>"u"&&!oe&&(console.error(`‼️ No WebSocket implementation available. You should define options.WebSocket.
|
|
10
|
+
|
|
11
|
+
For example, if you're using node.js, run \`npm install ws\`, and then in your code:
|
|
12
|
+
|
|
13
|
+
import PartySocket from 'partysocket';
|
|
14
|
+
import WS from 'ws';
|
|
15
|
+
|
|
16
|
+
const partysocket = new PartySocket({
|
|
17
|
+
host: "127.0.0.1:1999",
|
|
18
|
+
room: "test-room",
|
|
19
|
+
WebSocket: WS
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
`),oe=!0);const c=this._options.WebSocket||WebSocket;this._debug("connect",{url:r,protocols:i}),this._ws=i?new c(r,i):new c(r),this._ws.binaryType=this._binaryType,this._connectLock=!1,this._addListeners(),this._connectTimeout=setTimeout(()=>this._handleTimeout(),s)}).catch(r=>{this._connectLock=!1,this._handleError(new G.ErrorEvent(Error(r.message),this))})}_handleTimeout(){this._debug("timeout event"),this._handleError(new G.ErrorEvent(Error("TIMEOUT"),this))}_disconnect(t=1e3,s){if(this._clearTimeouts(),!!this._ws){this._removeListeners();try{this._ws.close(t,s),this._handleClose(new G.CloseEvent(t,s,this))}catch{}}}_acceptOpen(){this._debug("accept open"),this._retryCount=0}_removeListeners(){this._ws&&(this._debug("removeListeners"),this._ws.removeEventListener("open",this._handleOpen),this._ws.removeEventListener("close",this._handleClose),this._ws.removeEventListener("message",this._handleMessage),this._ws.removeEventListener("error",this._handleError))}_addListeners(){this._ws&&(this._debug("addListeners"),this._ws.addEventListener("open",this._handleOpen),this._ws.addEventListener("close",this._handleClose),this._ws.addEventListener("message",this._handleMessage),this._ws.addEventListener("error",this._handleError))}_clearTimeouts(){clearTimeout(this._connectTimeout),clearTimeout(this._uptimeTimeout)}};/*!
|
|
23
|
+
* Reconnecting WebSocket
|
|
24
|
+
* by Pedro Ladaria <pedro.ladaria@gmail.com>
|
|
25
|
+
* https://github.com/pladaria/reconnecting-websocket
|
|
26
|
+
* License MIT
|
|
27
|
+
*/var Nt=e=>e[1]!==null&&e[1]!==void 0;function Ht(){if(typeof crypto<"u"&&crypto.randomUUID)return crypto.randomUUID();let e=new Date().getTime(),n=typeof performance<"u"&&performance.now&&performance.now()*1e3||0;return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){let s=Math.random()*16;return e>0?(s=(e+s)%16|0,e=Math.floor(e/16)):(s=(n+s)%16|0,n=Math.floor(n/16)),(t==="x"?s:s&3|8).toString(16)})}function Ke(e,n,t={}){const{host:s,path:r,protocol:i,room:c,party:a,query:h}=e;let l=s.replace(/^(http|https|ws|wss):\/\//,"");if(l.endsWith("/")&&(l=l.slice(0,-1)),r&&r.startsWith("/"))throw new Error("path must not start with a slash");const L=a??"main",b=r?`/${r}`:"",S=i||(l.startsWith("localhost:")||l.startsWith("127.0.0.1:")||l.startsWith("192.168.")||l.startsWith("10.")||l.startsWith("172.")&&l.split(".")[1]>="16"&&l.split(".")[1]<="31"||l.startsWith("[::ffff:7f00:1]:")?n:n+"s"),_=`${S}://${l}/${a?`parties/${a}`:"party"}/${c}${b}`,x=(O={})=>`${_}?${new URLSearchParams([...Object.entries(t),...Object.entries(O).filter(Nt)])}`,W=typeof h=="function"?async()=>x(await h()):x(h);return{host:l,path:b,room:c,name:L,protocol:S,partyUrl:_,urlProvider:W}}var At=class extends Pt{constructor(n){const t=ie(n);super(t.urlProvider,t.protocols,t.socketOptions);d(this,"_pk");d(this,"_pkurl");d(this,"name");d(this,"room");d(this,"host");d(this,"path");this.partySocketOptions=n,this.setWSProperties(t)}updateProperties(n){const t=ie({...this.partySocketOptions,...n,host:n.host??this.host,room:n.room??this.room,path:n.path??this.path});this._url=t.urlProvider,this._protocols=t.protocols,this._options=t.socketOptions,this.setWSProperties(t)}setWSProperties(n){const{_pk:t,_pkurl:s,name:r,room:i,host:c,path:a}=n;this._pk=t,this._pkurl=s,this.name=r,this.room=i,this.host=c,this.path=a}reconnect(n,t){if(!this.room||!this.host)throw new Error("The room and host must be set before connecting, use `updateProperties` method to set them or pass them to the constructor.");super.reconnect(n,t)}get id(){return this._pk}get roomUrl(){return this._pkurl}static async fetch(n,t){const s=Ke(n,"http"),r=typeof s.urlProvider=="string"?s.urlProvider:await s.urlProvider();return(n.fetch??fetch)(r,t)}};function ie(e){const{id:n,host:t,path:s,party:r,room:i,protocol:c,query:a,protocols:h,...l}=e,L=n||Ht(),b=Ke(e,"ws",{_pk:L});return{_pk:L,_pkurl:b.partyUrl,name:b.name,room:b.room,host:b.host,path:b.path,protocols:h,socketOptions:l,urlProvider:b.urlProvider}}var Rt=(e,n)=>{const t=E.useRef(n);t.current=n,E.useEffect(()=>{const s=a=>{var h,l;return(l=(h=t.current)==null?void 0:h.onOpen)==null?void 0:l.call(h,a)},r=a=>{var h,l;return(l=(h=t.current)==null?void 0:h.onMessage)==null?void 0:l.call(h,a)},i=a=>{var h,l;return(l=(h=t.current)==null?void 0:h.onClose)==null?void 0:l.call(h,a)},c=a=>{var h,l;return(l=(h=t.current)==null?void 0:h.onError)==null?void 0:l.call(h,a)};return e.addEventListener("open",s),e.addEventListener("close",i),e.addEventListener("error",c),e.addEventListener("message",r),()=>{e.removeEventListener("open",s),e.removeEventListener("close",i),e.removeEventListener("error",c),e.removeEventListener("message",r)}},[e])},Mt=e=>[e.startClosed,e.minUptime,e.maxRetries,e.connectionTimeout,e.maxEnqueuedMessages,e.maxReconnectionDelay,e.minReconnectionDelay,e.reconnectionDelayGrowFactor,e.debug];function Wt({options:e,createSocket:n,createSocketMemoKey:t}){const s=t(e),r=E.useMemo(()=>e,[s]),[i,c]=E.useState(()=>n({...r,startClosed:!0})),a=E.useRef(null),h=E.useRef(n);return h.current=n,E.useEffect(()=>{if(a.current===i){const l=h.current({...r,startClosed:!1});c(l)}else return!a.current&&r.startClosed!==!0&&i.reconnect(),a.current=i,()=>{i.close()}},[i,r]),i}function jt(e){const{host:n,...t}=e,s=Wt({options:{host:n||(typeof window<"u"?window.location.host:"dummy-domain.com"),...t},createSocket:r=>new At(r),createSocketMemoKey:r=>JSON.stringify([r.query,r.id,r.host,r.room,r.party,r.path,r.protocol,r.protocols,...Mt(r)])});return Rt(s,e),s}const ze=E.createContext(null);function Dt(){var n;const e=K("root");return((n=e==null?void 0:e.preferences)==null?void 0:n.presence)??null}function $t(){const e=K("root");return(e==null?void 0:e.workshopTitle)??null}const Ft=p.object({type:p.union([p.literal("problem"),p.literal("solution")]).optional(),exerciseNumber:p.coerce.number().finite(),stepNumber:p.coerce.number().finite().optional()});function qt(e){const n=$t(),t=lt(),s=ut(),r=Dt(),i=K("root"),[c,a]=E.useState((i==null?void 0:i.presence.users)??[]),[h]=E.useState(()=>{if(typeof document>"u")return null;if(e)return e.id;const O=sessionStorage.getItem("clientId");if(O)return O;const C=Ot();return sessionStorage.setItem("clientId",C),C}),l=jt({host:new URL(ht).host,room:ae,onMessage(O){const C=ft.safeParse(JSON.parse(String(O.data)));C.success&&C.data.type==="presence"&&a(C.data.payload.users)}}),L=Ft.safeParse(s),b=L.success?L.data:null,S={workshopTitle:n,origin:t.origin,...b?{exercise:{type:b.type,exerciseNumber:b.exerciseNumber,stepNumber:b.stepNumber}}:null};let _=null;(!e||r!=null&&r.optOut)&&h?(e&&(_={type:"remove-user",payload:{id:e.id}}),_={type:"add-user",payload:{id:h,location:S}}):e&&(_={type:"add-user",payload:{id:e.id,name:e.name,avatarUrl:e.avatarUrl,location:S}});const x=_?JSON.stringify(_):null;return E.useEffect(()=>{x&&l.send(x)},[x,l]),{users:Gt(S,c)}}function Gt(e,n){return n.map(s=>{var c,a,h,l;let r=0;const i=4;return(e==null?void 0:e.workshopTitle)===((c=s.location)==null?void 0:c.workshopTitle)&&(r+=1,(a=e==null?void 0:e.exercise)!=null&&a.exerciseNumber&&e.exercise.exerciseNumber===((l=(h=s.location)==null?void 0:h.exercise)==null?void 0:l.exerciseNumber)&&(r+=1,e.exercise.stepNumber&&e.exercise.stepNumber===s.location.exercise.stepNumber&&(r+=1,e.exercise.type&&e.exercise.type===s.location.exercise.type&&(r+=1)))),{user:s,score:Math.floor(r/i*10)/10}}).sort((s,r)=>s.score===r.score?0:s.score>r.score?-1:1)}function Zt({user:e,children:n}){return at.jsx(ze.Provider,{value:qt(e),children:n})}function en(){const e=E.useContext(ze);if(!e)throw new Error("usePresence must be used within a PresenceProvider");return e}export{Zt as P,en as a,Dt as u};
|
|
28
|
+
//# sourceMappingURL=presence-Cr--lRCr.js.map
|