{"version":3,"sources":["jsdelivr-header.js","/npm/node-chat-bubble@1.0.3/index.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,ACNA,aAEA,MAAM,SAAW,QAAQ,aACnB,SAAW,QAAQ,aACnB,aAAe,QAAQ,iBAEvB,eAAiB,CACrB,SAAU,GACV,eAAgB,QAChB,cAAe,GACf,QAAS,SAGL,OAAS,CAAC,EAAS,KAEvB,IAAI,GADJ,EAAU,OAAO,OAAO,eAAgB,IACjB,SACnB,EAAgB,EAAQ,cAC5B,MAAM,EAAU,EAAQ,QAClB,EAAiB,EAAQ,eAE3B,aAAa,GAAW,IAAU,EAAW,aAAa,GAAW,GACrE,EAAW,IAAe,EAAgB,EAAW,GAEzD,MAAM,EAAW,SAAS,GACpB,EACJ,EAAS,QACT,EAAS,WAAW,OAAO,EAAW,GACtC,EAAS,SACL,EACJ,EAAS,WACT,EAAS,WAAW,OAAO,EAAW,GACtC,EAAS,YAEX,IAAI,EAAQ,SAAS,EAAS,EAAW,EAAG,CAAE,MAAM,IAAQ,MAAM,MAGlE,EAAQ,EAAM,KAAI,IAChB,MAAM,EAAoB,EAAW,EAAI,aAAa,GAChD,EAAe,IAAI,OAAO,KAAK,IAAI,EAAmB,IAC5D,OAAO,EAAS,SAAW,IAAM,EAAO,IAAM,EAAe,EAAS,QAAQ,IAGhF,IAAI,EAAS,EAAY,KAAO,EAAM,KAAK,MAAQ,KAAO,EAE1D,MAAM,EAA2B,UAAnB,EAA6B,KAAO,IAElD,OADA,GAAU,KAAO,IAAI,OAAO,GAAiB,EACtC,CAAM,EAGf,OAAO,QAAU,CAAE,IAAK","file":"/npm/node-chat-bubble@1.0.3/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/node-chat-bubble@1.0.3/index.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 wrapAnsi = require(\"wrap-ansi\");\nconst cliBoxes = require(\"cli-boxes\");\nconst stringLength = require(\"string-length\");\n\nconst defaultOptions = {\n  boxWidth: 30,\n  spikeDirection: \"right\",\n  spikePosition: 10,\n  boxType: \"round\"\n};\n\nconst getBox = (message, options) => {\n  options = Object.assign(defaultOptions, options);\n  let boxWidth = options.boxWidth;\n  let spikePosition = options.spikePosition;\n  const boxType = options.boxType;\n  const spikeDirection = options.spikeDirection;\n  // If there is only one line and char length is less than boxWidth, reduce the box width.\n  if (stringLength(message) < boxWidth) boxWidth = stringLength(message) + 4;\n  if (boxWidth < spikePosition) spikePosition = boxWidth / 2;\n\n  const boxChars = cliBoxes[boxType];\n  const topBorder =\n    boxChars.topLeft +\n    boxChars.horizontal.repeat(boxWidth - 2) +\n    boxChars.topRight;\n  const bottomBorder =\n    boxChars.bottomLeft +\n    boxChars.horizontal.repeat(boxWidth - 2) +\n    boxChars.bottomRight;\n\n  let lines = wrapAnsi(message, boxWidth - 4, { hard: true }).split(/\\n/);\n\n  // Add vertical borders and paddings\n  lines = lines.map(line => {\n    const rightPaddingCount = boxWidth - 4 - stringLength(line);\n    const rightPadding = \" \".repeat(Math.max(rightPaddingCount, 0));\n    return boxChars.vertical + \" \" + line + \" \" + rightPadding + boxChars.vertical;\n  });\n\n  let result = topBorder + \"\\n\" + lines.join(\"\\n\") + \"\\n\" + bottomBorder;\n\n  const spike = spikeDirection === \"right\" ? \"\\\\\" : \"/\";\n  result += \"\\n\" + \" \".repeat(spikePosition) + spike;\n  return result;\n};\n\nmodule.exports = { get: getBox };\n"]}