var uniqueName = "<%- _unique_name %>";
function handleCssComposes(exports, composes) {
for (var i = 0; i < composes.length; i += 3) {
var moduleId = composes[i];
var composeFrom = composes[i + 1];
var composeVar = composes[i + 2];
var composedId = <%- REQUIRE %>(composeFrom)[composeVar];
exports[moduleId] = exports[moduleId] + " " + composedId
}
}
var loadCssChunkData = <%- _css_chunk_data %>
var loadingAttribute = "data-rspack-loading";
var loadStylesheet = <%- basicFunction("chunkId, url, done, hmr, fetchPriority") %> {
var link,
needAttach,
key = "chunk-" + chunkId;
if (!hmr) {
var links = document.getElementsByTagName("link");
for (var i = 0; i < links.length; i++) {
var l = links[i];
var href = l.getAttribute("href") || l.href;
if (href && !href.startsWith(<%- PUBLIC_PATH %>)) {
href =
<%- PUBLIC_PATH %> + (href.startsWith("/") ? href.slice(1) : href);
}
if (
l.rel == "stylesheet" &&
((href && href.startsWith(url)) ||
l.getAttribute("data-rspack") == uniqueName + ":" + key)
) {
link = l;
break;
}
}
if (!done) return link;
}
if (!link) {
needAttach = true;
<%- _create_link %>
}
var onLinkComplete = <%- basicFunction("prev, event") %> {
link.onerror = link.onload = null;
link.removeAttribute(loadingAttribute);
clearTimeout(timeout);
if (event && event.type != "load") link.parentNode.removeChild(link);
done(event);
if (prev) return prev(event);
};
if (link.getAttribute(loadingAttribute)) {
var timeout = setTimeout(
onLinkComplete.bind(null, undefined, { type: "timeout", target: link }),
<%- _chunk_load_timeout %>
);
link.onerror = onLinkComplete.bind(null, link.onerror);
link.onload = onLinkComplete.bind(null, link.onload);
} else onLinkComplete(undefined, { type: "load", target: link });
if (hmr && hmr.getAttribute("fetchpriority")) link.setAttribute("fetchpriority", hmr.getAttribute("fetchpriority"));
hmr ? document.head.insertBefore(link, hmr) : needAttach && document.head.appendChild(link);
return link;
};
<%- _initial_css_chunk_data %>