"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.sharedHtmlConfigSchema = exports.HtmlInjectTagDescriptorSchema = exports.HtmlInjectTagSchema = exports.CrossOriginSchema = exports.ScriptInjectSchema = exports.ScriptLoadingSchema = exports.MetaOptionsSchema = exports.MetaAttributesSchema = void 0;
const utils_1 = require("../utils");
exports.MetaAttributesSchema = utils_1.z.record(utils_1.z.union([utils_1.z.string(), utils_1.z.boolean()]));
exports.MetaOptionsSchema = utils_1.z.record(utils_1.z.union([utils_1.z.string(), utils_1.z.literal('false'), exports.MetaAttributesSchema]));
exports.ScriptLoadingSchema = utils_1.z.union([
    utils_1.z.literal('defer'),
    utils_1.z.literal('module'),
    utils_1.z.literal('blocking'),
]);
exports.ScriptInjectSchema = utils_1.z.union([
    utils_1.z.boolean(),
    utils_1.z.literal('body'),
    utils_1.z.literal('head'),
]);
exports.CrossOriginSchema = utils_1.z.literals([
    'anonymous',
    'use-credentials',
]);
exports.HtmlInjectTagSchema = utils_1.z.object({
    tag: utils_1.z.string(),
    attrs: utils_1.z
        .record(utils_1.z.union([utils_1.z.string(), utils_1.z.boolean(), utils_1.z.null(), utils_1.z.undefined()]))
        .optional(),
    children: utils_1.z.string().optional(),
    hash: utils_1.z.union([utils_1.z.string(), utils_1.z.boolean(), utils_1.z.anyFunction()]).optional(),
    publicPath: utils_1.z.union([utils_1.z.string(), utils_1.z.boolean(), utils_1.z.anyFunction()]).optional(),
    append: utils_1.z.boolean().optional(),
    head: utils_1.z.boolean().optional(),
});
exports.HtmlInjectTagDescriptorSchema = utils_1.z.union([exports.HtmlInjectTagSchema, utils_1.z.anyFunction()]);
exports.sharedHtmlConfigSchema = utils_1.z.partialObj({
    meta: exports.MetaOptionsSchema,
    metaByEntries: utils_1.z.record(exports.MetaOptionsSchema),
    title: utils_1.z.string(),
    titleByEntries: utils_1.z.record(utils_1.z.string()),
    inject: exports.ScriptInjectSchema,
    injectByEntries: utils_1.z.record(exports.ScriptInjectSchema),
    tags: utils_1.z.arrayOrNot(exports.HtmlInjectTagDescriptorSchema),
    tagsByEntries: utils_1.z.record(utils_1.z.arrayOrNot(exports.HtmlInjectTagDescriptorSchema)),
    favicon: utils_1.z.string(),
    faviconByEntries: utils_1.z.record(utils_1.z.string()),
    appIcon: utils_1.z.string(),
    mountId: utils_1.z.string(),
    crossorigin: utils_1.z.union([utils_1.z.boolean(), exports.CrossOriginSchema]),
    disableHtmlFolder: utils_1.z.boolean(),
    template: utils_1.z.string(),
    templateByEntries: utils_1.z.record(utils_1.z.string()),
    templateParameters: utils_1.z.chained(utils_1.z.record(utils_1.z.unknown())),
    templateParametersByEntries: utils_1.z.record(utils_1.z.chained(utils_1.z.record(utils_1.z.unknown()))),
    scriptLoading: exports.ScriptLoadingSchema,
});
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const _schema = exports.sharedHtmlConfigSchema;
