import { parseHtmlForIndexes, applyHeadToHtml } from '../parser.mjs';
export { prepareTemplate } from '../parser.mjs';
import { c as createHead } from '../shared/unhead.DGl9jcjg.mjs';
import { e as resolveHeadInput, h as hashTag, n as normalizeEntryToTags, b as normalizeProps, d as dedupeKey } from '../shared/unhead.DJuZwX9c.mjs';
import { a as callHook } from '../shared/unhead.Bm4Y6XQI.mjs';
import { DEFAULT_STREAM_KEY } from './client.mjs';
import { p as parseStreamKey } from '../shared/unhead.C_7zwq8E.mjs';
import '../shared/unhead.Bf_fPVYA.mjs';
import '../shared/unhead.D7HkBzZn.mjs';
import '../shared/unhead.CGPOfp5O.mjs';
import 'hookable';
import '../shared/unhead.C5Bksi2B.mjs';
const LT_RE = //g;
const AMP_RE = /&/g;
const SSR_OUTLET_RE = //;
let encoder;
let preparedStreamingLayouts;
// @__NO_SIDE_EFFECTS__
function createStreamableHead(options = {}) {
const { streamKey, writesBodyTags, nonce, ...rest } = options;
const parsedStreamKey = streamKey === void 0 ? void 0 : parseStreamKey(streamKey);
const head = createHead({
...rest,
experimentalStreamKey: parsedStreamKey
});
if (writesBodyTags)
streamState(head).writesBodyTags = true;
if (nonce)
streamState(head).nonce = nonce;
let resolveShellReady;
const shellReady = new Promise((resolve) => {
resolveShellReady = resolve;
});
return {
head,
onShellReady: () => resolveShellReady(),
shellReady
};
}
function getStreamKey(head) {
const key = head.resolvedOptions.experimentalStreamKey || DEFAULT_STREAM_KEY;
return parseStreamKey(key);
}
function createBootstrapScript(streamKey = DEFAULT_STREAM_KEY, nonce) {
const parsedStreamKey = parseStreamKey(streamKey);
const nonceAttr = renderNonceAttribute(nonce);
return `