"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; function _htmlnano() { const data = _interopRequireDefault(require("htmlnano")); _htmlnano = function () { return data; }; return data; } function _plugin() { const data = require("@parcel/plugin"); _plugin = function () { return data; }; return data; } function _posthtml() { const data = _interopRequireDefault(require("posthtml")); _posthtml = function () { return data; }; return data; } function _path() { const data = _interopRequireDefault(require("path")); _path = function () { return data; }; return data; } var _svgMappings = require("./svgMappings"); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var _default = exports.default = new (_plugin().Optimizer)({ async loadConfig({ config, options }) { let userConfig = await config.getConfigFrom(_path().default.join(options.projectRoot, 'index.html'), ['.htmlnanorc', '.htmlnanorc.json', '.htmlnanorc.js', '.htmlnanorc.cjs', '.htmlnanorc.mjs', 'htmlnano.config.js', 'htmlnano.config.cjs', 'htmlnano.config.mjs'], { packageKey: 'htmlnano' }); return userConfig === null || userConfig === void 0 ? void 0 : userConfig.contents; }, async optimize({ bundle, contents, map, config }) { if (!bundle.env.shouldOptimize) { return { contents, map }; } if (typeof contents !== 'string') { throw new Error('HTMLNanoOptimizer: Only string contents are currently supported'); } const clonedConfig = config || {}; // $FlowFixMe const presets = _htmlnano().default.presets; const preset = typeof clonedConfig.preset === 'string' ? presets[clonedConfig.preset] : {}; delete clonedConfig.preset; const htmlNanoConfig = { // Inline