{"version":3,"sources":["jsdelivr-header.js","/npm/fastify-plugin@5.1.0/plugin.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,ACNA,aAEA,MAAM,cAAgB,QAAQ,uBACxB,YAAc,QAAQ,qBAE5B,IAAI,MAAQ,EAEZ,SAAS,OAAQ,EAAI,EAAU,CAAC,GAC9B,IAAI,GAAW,EAOf,QALmB,IAAf,EAAG,UAEL,EAAK,EAAG,SAGQ,mBAAP,EACT,MAAM,IAAI,UACR,4DAA4D,MAUhE,GANuB,iBAAZ,IACT,EAAU,CACR,QAAS,IAKQ,iBAAZ,GACP,MAAM,QAAQ,IACF,OAAZ,EAEA,MAAM,IAAI,UAAU,0CAGtB,QAAwB,IAApB,EAAQ,SAAoD,iBAApB,EAAQ,QAClD,MAAM,IAAI,UAAU,gEAAgE,EAAQ,YAGzF,EAAQ,OACX,GAAW,EACX,EAAQ,KAAO,cAAc,GAAM,SAAW,SAGhD,EAAG,OAAO,IAAI,mBAA4C,IAAxB,EAAQ,YAC1C,EAAG,OAAO,IAAI,yBAA2B,EAAQ,KACjD,EAAG,OAAO,IAAI,gBAAkB,EAG3B,EAAG,UACN,EAAG,QAAU,GAMf,MAAM,EAAY,YAAY,EAAQ,MAKtC,OAJK,GAAa,EAAG,KACnB,EAAG,GAAa,GAGX,CACT,CAEA,OAAO,QAAU,OACjB,OAAO,QAAQ,QAAU,OACzB,OAAO,QAAQ,cAAgB","file":"/npm/fastify-plugin@5.1.0/plugin.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/fastify-plugin@5.1.0/plugin.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","'use strict'\n\nconst getPluginName = require('./lib/getPluginName')\nconst toCamelCase = require('./lib/toCamelCase')\n\nlet count = 0\n\nfunction plugin (fn, options = {}) {\n  let autoName = false\n\n  if (fn.default !== undefined) {\n    // Support for 'export default' behaviour in transpiled ECMAScript module\n    fn = fn.default\n  }\n\n  if (typeof fn !== 'function') {\n    throw new TypeError(\n      `fastify-plugin expects a function, instead got a '${typeof fn}'`\n    )\n  }\n\n  if (typeof options === 'string') {\n    options = {\n      fastify: options\n    }\n  }\n\n  if (\n    typeof options !== 'object' ||\n    Array.isArray(options) ||\n    options === null\n  ) {\n    throw new TypeError('The options object should be an object')\n  }\n\n  if (options.fastify !== undefined && typeof options.fastify !== 'string') {\n    throw new TypeError(`fastify-plugin expects a version string, instead got '${typeof options.fastify}'`)\n  }\n\n  if (!options.name) {\n    autoName = true\n    options.name = getPluginName(fn) + '-auto-' + count++\n  }\n\n  fn[Symbol.for('skip-override')] = options.encapsulate !== true\n  fn[Symbol.for('fastify.display-name')] = options.name\n  fn[Symbol.for('plugin-meta')] = options\n\n  // Faux modules support\n  if (!fn.default) {\n    fn.default = fn\n  }\n\n  // TypeScript support for named imports\n  // See https://github.com/fastify/fastify/issues/2404 for more details\n  // The type definitions would have to be update to match this.\n  const camelCase = toCamelCase(options.name)\n  if (!autoName && !fn[camelCase]) {\n    fn[camelCase] = fn\n  }\n\n  return fn\n}\n\nmodule.exports = plugin\nmodule.exports.default = plugin\nmodule.exports.fastifyPlugin = plugin\n"]}