'use strict'
function indexHtml (opts) {
const hasLeadingSlash = /^\//.test(opts.prefix)
return (url) => {
const hasTrailingSlash = /\/$/.test(url)
const prefix = hasTrailingSlash ? `.${opts.staticPrefix}` : `${hasLeadingSlash ? '.' : ''}${opts.prefix}${opts.staticPrefix}`
return `
${opts.theme?.title || 'Swagger UI'}
${opts.theme && opts.theme.css ? opts.theme.css.map(css => `\n`).join('') : ''}
${opts.theme && opts.theme.favicon
? opts.theme.favicon.map(favicon => `\n`).join('')
: `
`}
${opts.theme && opts.theme.js ? opts.theme.js.map(js => `\n`).join('') : ''}
`
}
}
module.exports = indexHtml