/
opt
/
canhelp
/
node_modules
/
next
/
dist
/
esm
/
client
/
/opt/canhelp/node_modules/next/dist/esm/client
mkdir
upload
Name
Size
Mode
Actions
app-dir/
-
0755
rm
compat/
-
0755
rm
components/
-
0755
rm
dev/
-
0755
rm
legacy/
-
0755
rm
lib/
-
0755
rm
portal/
-
0755
rm
react-client-callbacks/
-
0755
rm
request/
-
0755
rm
tracing/
-
0755
rm
add-base-path.js
433
0644
edit
dl
rm
add-base-path.js.map
978
0644
edit
dl
rm
add-locale.js
501
0644
edit
dl
rm
add-locale.js.map
899
0644
edit
dl
rm
app-bootstrap.js
2210
0644
edit
dl
rm
app-bootstrap.js.map
3964
0644
edit
dl
rm
app-build-id.js
985
0644
edit
dl
rm
app-build-id.js.map
1418
0644
edit
dl
rm
app-call-server.js
600
0644
edit
dl
rm
app-call-server.js.map
1041
0644
edit
dl
rm
app-find-source-map-url.js
1124
0644
edit
dl
rm
app-find-source-map-url.js.map
2081
0644
edit
dl
rm
app-globals.js
301
0644
edit
dl
rm
app-globals.js.map
600
0644
edit
dl
rm
app-index.js
10228
0644
edit
dl
rm
app-index.js.map
17238
0644
edit
dl
rm
app-link-gc.js
4025
0644
edit
dl
rm
app-link-gc.js.map
5146
0644
edit
dl
rm
app-next-dev.js
733
0644
edit
dl
rm
app-next-dev.js.map
1264
0644
edit
dl
rm
app-next-turbopack.js
843
0644
edit
dl
rm
app-next-turbopack.js.map
1682
0644
edit
dl
rm
app-next.js
856
0644
edit
dl
rm
app-next.js.map
1266
0644
edit
dl
rm
app-webpack.js
2727
0644
edit
dl
rm
app-webpack.js.map
3207
0644
edit
dl
rm
assign-location.js
995
0644
edit
dl
rm
assign-location.js.map
1557
0644
edit
dl
rm
detect-domain-locale.js
380
0644
edit
dl
rm
detect-domain-locale.js.map
711
0644
edit
dl
rm
flight-data-helpers.js
5088
0644
edit
dl
rm
flight-data-helpers.js.map
8657
0644
edit
dl
rm
form-shared.js
5552
0644
edit
dl
rm
form-shared.js.map
10622
0644
edit
dl
rm
form.js
5212
0644
edit
dl
rm
form.js.map
8306
0644
edit
dl
rm
get-domain-locale.js
998
0644
edit
dl
rm
get-domain-locale.js.map
2451
0644
edit
dl
rm
has-base-path.js
257
0644
edit
dl
rm
has-base-path.js.map
598
0644
edit
dl
rm
head-manager.js
4988
0644
edit
dl
rm
head-manager.js.map
8320
0644
edit
dl
rm
image-component.js
12878
0644
edit
dl
rm
image-component.js.map
21446
0644
edit
dl
rm
index.js
31257
0644
edit
dl
rm
index.js.map
52799
0644
edit
dl
rm
link.js
18165
0644
edit
dl
rm
link.js.map
34394
0644
edit
dl
rm
next-dev-turbopack.js
1417
0644
edit
dl
rm
next-dev-turbopack.js.map
3054
0644
edit
dl
rm
next-dev.js
626
0644
edit
dl
rm
next-dev.js.map
1230
0644
edit
dl
rm
next-turbopack.js
1166
0644
edit
dl
rm
next-turbopack.js.map
2397
0644
edit
dl
rm
next.js
383
0644
edit
dl
rm
next.js.map
893
0644
edit
dl
rm
normalize-locale-path.js
339
0644
edit
dl
rm
normalize-locale-path.js.map
872
0644
edit
dl
rm
normalize-trailing-slash.js
935
0644
edit
dl
rm
normalize-trailing-slash.js.map
1736
0644
edit
dl
rm
page-bootstrap.js
6314
0644
edit
dl
rm
page-bootstrap.js.map
9025
0644
edit
dl
rm
page-loader.js
6820
0644
edit
dl
rm
page-loader.js.map
12220
0644
edit
dl
rm
remove-base-path.js
526
0644
edit
dl
rm
remove-base-path.js.map
1138
0644
edit
dl
rm
remove-locale.js
600
0644
edit
dl
rm
remove-locale.js.map
1301
0644
edit
dl
rm
request-idle-callback.js
634
0644
edit
dl
rm
request-idle-callback.js.map
1392
0644
edit
dl
rm
resolve-href.js
4816
0644
edit
dl
rm
resolve-href.js.map
7983
0644
edit
dl
rm
route-announcer.js
2346
0644
edit
dl
rm
route-announcer.js.map
3523
0644
edit
dl
rm
route-loader.js
13075
0644
edit
dl
rm
route-loader.js.map
23036
0644
edit
dl
rm
route-params.js
6815
0644
edit
dl
rm
route-params.js.map
10822
0644
edit
dl
rm
router.js
5873
0644
edit
dl
rm
router.js.map
8845
0644
edit
dl
rm
script.js
12619
0644
edit
dl
rm
script.js.map
18711
0644
edit
dl
rm
set-attributes-from-props.js
1817
0644
edit
dl
rm
set-attributes-from-props.js.map
3101
0644
edit
dl
rm
trusted-types.js
1410
0644
edit
dl
rm
trusted-types.js.map
1956
0644
edit
dl
rm
use-client-disallowed.js
476
0644
edit
dl
rm
use-client-disallowed.js.map
739
0644
edit
dl
rm
use-intersection.js
3248
0644
edit
dl
rm
use-intersection.js.map
6647
0644
edit
dl
rm
use-merged-ref.js
2345
0644
edit
dl
rm
use-merged-ref.js.map
3566
0644
edit
dl
rm
web-vitals.js
491
0644
edit
dl
rm
web-vitals.js.map
1005
0644
edit
dl
rm
webpack.js
1877
0644
edit
dl
rm
webpack.js.map
2542
0644
edit
dl
rm
with-router.js
781
0644
edit
dl
rm
with-router.js.map
1935
0644
edit
dl
rm
Edit:
/opt/canhelp/node_modules/next/dist/esm/client/script.js
(12619B)
'use client'; import { jsx as _jsx } from "react/jsx-runtime"; import ReactDOM from 'react-dom'; import React, { useEffect, useContext, useRef } from 'react'; import { HeadManagerContext } from '../shared/lib/head-manager-context.shared-runtime'; import { setAttributesFromProps } from './set-attributes-from-props'; import { requestIdleCallback } from './request-idle-callback'; const ScriptCache = new Map(); const LoadCache = new Set(); const insertStylesheets = (stylesheets)=>{ // Case 1: Styles for afterInteractive/lazyOnload with appDir injected via handleClientScriptLoad // // Using ReactDOM.preinit to feature detect appDir and inject styles // Stylesheets might have already been loaded if initialized with Script component // Re-inject styles here to handle scripts loaded via handleClientScriptLoad // ReactDOM.preinit handles dedup and ensures the styles are loaded only once if (ReactDOM.preinit) { stylesheets.forEach((stylesheet)=>{ ReactDOM.preinit(stylesheet, { as: 'style' }); }); return; } // Case 2: Styles for afterInteractive/lazyOnload with pages injected via handleClientScriptLoad // // We use this function to load styles when appdir is not detected // TODO: Use React float APIs to load styles once available for pages dir if (typeof window !== 'undefined') { let head = document.head; stylesheets.forEach((stylesheet)=>{ let link = document.createElement('link'); link.type = 'text/css'; link.rel = 'stylesheet'; link.href = stylesheet; head.appendChild(link); }); } }; const loadScript = (props)=>{ const { src, id, onLoad = ()=>{}, onReady = null, dangerouslySetInnerHTML, children = '', strategy = 'afterInteractive', onError, stylesheets } = props; const cacheKey = id || src; // Script has already loaded if (cacheKey && LoadCache.has(cacheKey)) { return; } // Contents of this script are already loading/loaded if (ScriptCache.has(src)) { LoadCache.add(cacheKey); // It is possible that multiple `next/script` components all have same "src", but has different "onLoad" // This is to make sure the same remote script will only load once, but "onLoad" are executed in order ScriptCache.get(src).then(onLoad, onError); return; } /** Execute after the script first loaded */ const afterLoad = ()=>{ // Run onReady for the first time after load event if (onReady) { onReady(); } // add cacheKey to LoadCache when load successfully LoadCache.add(cacheKey); }; const el = document.createElement('script'); const loadPromise = new Promise((resolve, reject)=>{ el.addEventListener('load', function(e) { resolve(); if (onLoad) { onLoad.call(this, e); } afterLoad(); }); el.addEventListener('error', function(e) { reject(e); }); }).catch(function(e) { if (onError) { onError(e); } }); if (dangerouslySetInnerHTML) { // Casting since lib.dom.d.ts doesn't have TrustedHTML yet. el.innerHTML = dangerouslySetInnerHTML.__html || ''; afterLoad(); } else if (children) { el.textContent = typeof children === 'string' ? children : Array.isArray(children) ? children.join('') : ''; afterLoad(); } else if (src) { el.src = src; // do not add cacheKey into LoadCache for remote script here // cacheKey will be added to LoadCache when it is actually loaded (see loadPromise above) ScriptCache.set(src, loadPromise); } setAttributesFromProps(el, props); if (strategy === 'worker') { el.setAttribute('type', 'text/partytown'); } el.setAttribute('data-nscript', strategy); // Load styles associated with this script if (stylesheets) { insertStylesheets(stylesheets); } document.body.appendChild(el); }; export function handleClientScriptLoad(props) { const { strategy = 'afterInteractive' } = props; if (strategy === 'lazyOnload') { window.addEventListener('load', ()=>{ requestIdleCallback(()=>loadScript(props)); }); } else { loadScript(props); } } function loadLazyScript(props) { if (document.readyState === 'complete') { requestIdleCallback(()=>loadScript(props)); } else { window.addEventListener('load', ()=>{ requestIdleCallback(()=>loadScript(props)); }); } } function addBeforeInteractiveToCache() { const scripts = [ ...document.querySelectorAll('[data-nscript="beforeInteractive"]'), ...document.querySelectorAll('[data-nscript="beforePageRender"]') ]; scripts.forEach((script)=>{ const cacheKey = script.id || script.getAttribute('src'); LoadCache.add(cacheKey); }); } export function initScriptLoader(scriptLoaderItems) { scriptLoaderItems.forEach(handleClientScriptLoad); addBeforeInteractiveToCache(); } /** * Load a third-party scripts in an optimized way. * * Read more: [Next.js Docs: `next/script`](https://nextjs.org/docs/app/api-reference/components/script) */ function Script(props) { const { id, src = '', onLoad = ()=>{}, onReady = null, strategy = 'afterInteractive', onError, stylesheets, ...restProps } = props; // Context is available only during SSR let { updateScripts, scripts, getIsSsr, appDir, nonce } = useContext(HeadManagerContext); // if a nonce is explicitly passed to the script tag, favor that over the automatic handling nonce = restProps.nonce || nonce; /** * - First mount: * 1. The useEffect for onReady executes * 2. hasOnReadyEffectCalled.current is false, but the script hasn't loaded yet (not in LoadCache) * onReady is skipped, set hasOnReadyEffectCalled.current to true * 3. The useEffect for loadScript executes * 4. hasLoadScriptEffectCalled.current is false, loadScript executes * Once the script is loaded, the onLoad and onReady will be called by then * [If strict mode is enabled / is wrapped in <OffScreen /> component] * 5. The useEffect for onReady executes again * 6. hasOnReadyEffectCalled.current is true, so entire effect is skipped * 7. The useEffect for loadScript executes again * 8. hasLoadScriptEffectCalled.current is true, so entire effect is skipped * * - Second mount: * 1. The useEffect for onReady executes * 2. hasOnReadyEffectCalled.current is false, but the script has already loaded (found in LoadCache) * onReady is called, set hasOnReadyEffectCalled.current to true * 3. The useEffect for loadScript executes * 4. The script is already loaded, loadScript bails out * [If strict mode is enabled / is wrapped in <OffScreen /> component] * 5. The useEffect for onReady executes again * 6. hasOnReadyEffectCalled.current is true, so entire effect is skipped * 7. The useEffect for loadScript executes again * 8. hasLoadScriptEffectCalled.current is true, so entire effect is skipped */ const hasOnReadyEffectCalled = useRef(false); useEffect(()=>{ const cacheKey = id || src; if (!hasOnReadyEffectCalled.current) { // Run onReady if script has loaded before but component is re-mounted if (onReady && cacheKey && LoadCache.has(cacheKey)) { onReady(); } hasOnReadyEffectCalled.current = true; } }, [ onReady, id, src ]); const hasLoadScriptEffectCalled = useRef(false); useEffect(()=>{ if (!hasLoadScriptEffectCalled.current) { if (strategy === 'afterInteractive') { loadScript(props); } else if (strategy === 'lazyOnload') { loadLazyScript(props); } hasLoadScriptEffectCalled.current = true; } }, [ props, strategy ]); if (strategy === 'beforeInteractive' || strategy === 'worker') { if (updateScripts) { scripts[strategy] = (scripts[strategy] || []).concat([ { id, src, onLoad, onReady, onError, ...restProps, nonce } ]); updateScripts(scripts); } else if (getIsSsr && getIsSsr()) { // Script has already loaded during SSR LoadCache.add(id || src); } else if (getIsSsr && !getIsSsr()) { loadScript({ ...props, nonce }); } } // For the app directory, we need React Float to preload these scripts. if (appDir) { // Injecting stylesheets here handles beforeInteractive and worker scripts correctly // For other strategies injecting here ensures correct stylesheet order // ReactDOM.preinit handles loading the styles in the correct order, // also ensures the stylesheet is loaded only once and in a consistent manner // // Case 1: Styles for beforeInteractive/worker with appDir - handled here // Case 2: Styles for beforeInteractive/worker with pages dir - Not handled yet // Case 3: Styles for afterInteractive/lazyOnload with appDir - handled here // Case 4: Styles for afterInteractive/lazyOnload with pages dir - handled in insertStylesheets function if (stylesheets) { stylesheets.forEach((styleSrc)=>{ ReactDOM.preinit(styleSrc, { as: 'style' }); }); } // Before interactive scripts need to be loaded by Next.js' runtime instead // of native <script> tags, because they no longer have `defer`. if (strategy === 'beforeInteractive') { if (!src) { // For inlined scripts, we put the content in `children`. if (restProps.dangerouslySetInnerHTML) { // Casting since lib.dom.d.ts doesn't have TrustedHTML yet. restProps.children = restProps.dangerouslySetInnerHTML.__html; delete restProps.dangerouslySetInnerHTML; } return /*#__PURE__*/ _jsx("script", { nonce: nonce, dangerouslySetInnerHTML: { __html: "(self.__next_s=self.__next_s||[]).push(" + JSON.stringify([ 0, { ...restProps, id } ]) + ")" } }); } else { // @ts-ignore ReactDOM.preload(src, restProps.integrity ? { as: 'script', integrity: restProps.integrity, nonce, crossOrigin: restProps.crossOrigin } : { as: 'script', nonce, crossOrigin: restProps.crossOrigin }); return /*#__PURE__*/ _jsx("script", { nonce: nonce, dangerouslySetInnerHTML: { __html: "(self.__next_s=self.__next_s||[]).push(" + JSON.stringify([ src, { ...restProps, id } ]) + ")" } }); } } else if (strategy === 'afterInteractive') { if (src) { // @ts-ignore ReactDOM.preload(src, restProps.integrity ? { as: 'script', integrity: restProps.integrity, nonce, crossOrigin: restProps.crossOrigin } : { as: 'script', nonce, crossOrigin: restProps.crossOrigin }); } } } return null; } Object.defineProperty(Script, '__nextScript', { value: true }); export default Script; //# sourceMappingURL=script.js.map
Save
cmd:
run