-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path503-b780415fc89759314db0.js.map
1 lines (1 loc) · 4.84 KB
/
503-b780415fc89759314db0.js.map
1
{"version":3,"file":"503-b780415fc89759314db0.js","mappings":"wXAgBgBA,EAAAA,EAedC,EACAC,EACAC,GAAA,IAfEC,EAAAJ,EAAAK,MACAC,EAAAN,EAAAO,QACAC,EAAAR,EAAAS,UACAC,EAAAV,EAAAW,SACAC,EAAAZ,EAAAa,eACAC,EAAAd,EAAAe,IACAC,EAAAhB,EAAAiB,aAAAC,EAAAlB,EACAmB,SAAAC,OAAA,IAAAF,EAAW,CAAC,EAADA,EACXG,EAAArB,EAAAsB,eACAC,EAAAvB,EAAAwB,gBAAAC,EAAAzB,EACA0B,UAAAC,OAAA,IAAAF,EAAA,QAAAA,EACGG,GAAAC,EAAAA,EAAAA,GAAA7B,EAAA8B,GAOHC,EAME3B,EANF4B,MACAC,EAKE7B,EALF8B,OACAC,EAIE/B,EAJFgC,OACAC,EAGEjC,EAHFkC,OACAC,EAEEnC,EAFFoC,YACiBC,EACfrC,EADFoB,gBAGIkB,EAAWC,KAAKC,UAAUP,GAEhCjB,GAAAyB,EAAAA,EAAAA,GAAA,CACEnB,UAAAC,EACAL,eAAAD,EACAG,gBAAAD,GACGH,GAGL,IAAM0B,EACJC,EAAAA,cAACC,EAAAA,EAAA,CAAcZ,OAAQD,EAAQH,MAAOD,EAAOG,OAAQD,GACnDc,EAAAA,cAACE,EAAAA,GAAAJ,EAAAA,EAAAA,GAAA,IACKK,EAAAA,EAAAA,GACFX,EACA7B,EACAyB,EACAJ,EACAE,EACAQ,EACAd,EACAN,KAIJ0B,EAAAA,cAACI,EAAAA,GAAAN,EAAAA,EAAAA,GAAA,GACMjB,EAAA,CACLI,MAAOD,EACPG,OAAQD,EACRmB,UAAWpC,IACPqC,EAAAA,EAAAA,GACF7C,EACAE,EACA2B,EACA/B,EACAM,EACA8B,EACA5B,EACAM,MA2BR,OArBInB,EAAKqD,UAGHC,EAAAA,YACGrD,EAASoD,UAEZpD,EAASoD,QAAUC,EAAAA,WAAoBtD,EAAKqD,UAI9CpD,EAASoD,QAAQE,OAAOV,MAGtB5C,EAASoD,SAAWnD,EAAamD,QAC7BC,EAAAA,OACAA,EAAAA,SACGT,EAAW7C,EAAKqD,SACzBpD,EAASoD,SAAA,IAAU,WAKjBrD,EAAKqD,UAEHC,EAAAA,WAEFrD,EAASoD,QAAQE,OAAO,MAExBD,EAAAA,OAAgB,KAAiCtD,EAAKqD,SAAA,E","sources":["webpack://personal-portfolio/../src/components/lazy-hydrate.tsx"],"sourcesContent":["import React, { MutableRefObject } from \"react\"\nimport ReactDOM from \"react-dom\"\nimport { GatsbyImageProps } from \"./gatsby-image.browser\"\nimport { LayoutWrapper } from \"./layout-wrapper\"\nimport { Placeholder } from \"./placeholder\"\nimport { MainImageProps, MainImage } from \"./main-image\"\nimport { getMainProps, getPlaceholderProps } from \"./hooks\"\nimport { ReactElement } from \"react\"\n\ntype LazyHydrateProps = Omit<GatsbyImageProps, \"as\" | \"style\" | \"className\"> & {\n isLoading: boolean\n isLoaded: boolean // alwaystype SetStateAction<S> = S | ((prevState: S) => S);\n toggleIsLoaded: (toggle: boolean) => void\n ref: MutableRefObject<HTMLImageElement | undefined>\n}\n\nexport function lazyHydrate(\n {\n image,\n loading,\n isLoading,\n isLoaded,\n toggleIsLoaded,\n ref,\n imgClassName,\n imgStyle = {},\n objectPosition,\n backgroundColor,\n objectFit = `cover`,\n ...props\n }: LazyHydrateProps,\n root: MutableRefObject<HTMLElement | undefined>,\n hydrated: MutableRefObject<boolean>,\n forceHydrate: MutableRefObject<boolean>\n): (() => void) | null {\n const {\n width,\n height,\n layout,\n images,\n placeholder,\n backgroundColor: wrapperBackgroundColor,\n } = image\n\n const cacheKey = JSON.stringify(images)\n\n imgStyle = {\n objectFit,\n objectPosition,\n backgroundColor,\n ...imgStyle,\n }\n\n const component = (\n <LayoutWrapper layout={layout} width={width} height={height}>\n <Placeholder\n {...getPlaceholderProps(\n placeholder,\n isLoaded,\n layout,\n width,\n height,\n wrapperBackgroundColor,\n objectFit,\n objectPosition\n )}\n />\n\n <MainImage\n {...(props as Omit<MainImageProps, \"images\" | \"fallback\">)}\n width={width}\n height={height}\n className={imgClassName}\n {...getMainProps(\n isLoading,\n isLoaded,\n images,\n loading,\n toggleIsLoaded,\n cacheKey,\n ref,\n imgStyle\n )}\n />\n </LayoutWrapper>\n )\n\n if (root.current) {\n // Force render to mitigate \"Expected server HTML to contain a matching\" in develop\n // @ts-ignore react 18 typings\n if (ReactDOM.createRoot) {\n if (!hydrated.current) {\n // @ts-ignore react 18 typings\n hydrated.current = ReactDOM.createRoot(root.current)\n }\n\n // @ts-ignore react 18 typings\n hydrated.current.render(component)\n } else {\n const doRender =\n hydrated.current || forceHydrate.current\n ? ReactDOM.render\n : ReactDOM.hydrate\n doRender(component, root.current)\n hydrated.current = true\n }\n }\n\n return (): void => {\n if (root.current) {\n // @ts-ignore react 18 typings\n if (ReactDOM.createRoot) {\n // @ts-ignore react 18 typings\n hydrated.current.render(null)\n } else {\n ReactDOM.render(null as unknown as ReactElement, root.current)\n }\n }\n }\n}\n"],"names":["m","g","l","u","b","image","h","loading","p","isLoading","f","isLoaded","j","toggleIsLoaded","y","ref","L","imgClassName","v","imgStyle","C","k","objectPosition","w","backgroundColor","N","objectFit","P","E","e","s","F","width","R","height","S","layout","x","images","I","placeholder","J","M","JSON","stringify","r","O","c","t","o","a","i","className","n","current","d","render"],"sourceRoot":""}