1const scriptRel = "modulepreload"; 2const assetsURL = function(dep, importerUrl) { 3 return new URL(dep, importerUrl).href; 4}; 5const seen = {}; 6const __vitePreload = function preload(baseModule, deps, importerUrl) { 7 let promise = Promise.resolve(); 8 if (deps && deps.length > 0) { 9 let allSettled2 = function(promises) { 10 return Promise.all( 11 promises.map( 12 (p) => Promise.resolve(p).then( 13 (value) => ({ status: "fulfilled", value }), 14 (reason) => ({ status: "rejected", reason }) 15 ) 16 ) 17 ); 18 }; 19 const links = document.getElementsByTagName("link"); 20 const cspNonceMeta = document.querySelector( 21 "meta[property=csp-nonce]" 22 ); 23 const cspNonce = (cspNonceMeta == null ? void 0 : cspNonceMeta.nonce) || (cspNonceMeta == null ? void 0 : cspNonceMeta.getAttribute("nonce")); 24 promise = allSettled2( 25 deps.map((dep) => { 26 dep = assetsURL(dep, importerUrl); 27 if (dep in seen) return; 28 seen[dep] = true; 29 const isCss = dep.endsWith(".css"); 30 const cssSelector = isCss ? '[rel="stylesheet"]' : ""; 31 const isBaseRelative = !!importerUrl; 32 if (isBaseRelative) { 33 for (let i = links.length - 1; i >= 0; i--) { 34 const link2 = links[i]; 35 if (link2.href === dep && (!isCss || link2.rel === "stylesheet")) { 36 return; 37 } 38 } 39 } else if (document.querySelector(`link[href="${dep}"]${cssSelector}`)) { 40 return; 41 } 42 const link = document.createElement("link"); 43 link.rel = isCss ? "stylesheet" : scriptRel; 44 if (!isCss) { 45 link.as = "script"; 46 } 47 link.crossOrigin = ""; 48 link.href = dep; 49 if (cspNonce) { 50 link.setAttribute("nonce", cspNonce); 51 } 52 document.head.appendChild(link); 53 if (isCss) { 54 return new Promise((res, rej) => { 55 link.addEventListener("load", res); 56 link.addEventListener( 57 "error", 58 () => rej(new Error(`Unable to preload CSS for ${dep}`)) 59 ); 60 }); 61 } 62 }) 63 ); 64 } 65 function handlePreloadError(err) { 66 const e = new Event("vite:preloadError", { 67 cancelable: true 68 }); 69 e.payload = err; 70 window.dispatchEvent(e); 71 if (!e.defaultPrevented) { 72 throw err; 73 } 74 } 75 return promise.then((res) => { 76 for (const item of res || []) { 77 if (item.status !== "rejected") continue; 78 handlePreloadError(item.reason); 79 } 80 return baseModule().catch(handlePreloadError); 81 }); 82}; 83export { 84 __vitePreload as _ 85};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.