{"version":3,"sources":["jsdelivr-header.js","/npm/vuepress-plugin-code-demo-block@1.9.0/index.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,ACNA,MAAM,KAAO,QAAQ,SACf,cAAE,cAAa,cAAE,cAAa,gBAAE,iBAAoB,QAAQ,WAClE,OAAO,QAAU,CAAC,EAAS,KAClB,CACL,KAAM,kCACN,gBAAiB,CACf,KAAK,QAAQ,UAAW,wBAE1B,QAAS,CACP,CACE,YACA,CACE,KAAM,YACN,MAAA,CAAO,EAAQ,GACb,MAAM,EAAW,EAAQ,eAAY,EAC/B,EAAY,EAAQ,WAAa,IACjC,EAAO,EAAQ,MAAQ,MACvB,EAAU,EAAO,GAAK,KACtB,EAAW,EAAQ,MAAM,KACzB,EAAa,EAAQ,SAAS,oBAC9B,EAAa,EAAQ,SAAS,oBAC9B,EAAW,EAAS,MAAK,GAAQ,EAAK,SAAS,eAAgB,GAE/D,GADa,EAAS,MAAK,GAAQ,EAAK,SAAS,WAAY,IACxC,OACrB,EAAQ,EAAS,QAAQ,WAAY,IAAI,OACzC,EAAO,EAAU,cAAc,EAAI,UAAW,GAAW,GACzD,EAAU,cAAc,EAAM,GAC9B,EAAW,gBAAgB,GACjC,OAA4B,IAAxB,EAAO,GAAK,QACV,EACK,8DAEI,mCACG,yCACM,oCACL,+BACL,mBAAmB,yBAC1B,eAEE,8DAEM,oCACI,mCACD,yCACM,oCACL,+BACL,mBAAmB,yBAC1B,eAEA,QACT","file":"/npm/vuepress-plugin-code-demo-block@1.9.0/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/vuepress-plugin-code-demo-block@1.9.0/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","const path = require('path')\r\nconst { getComContent, highlightCode, resolveCompName } = require('./utils')\r\nmodule.exports = (options, ctx) => {\r\n  return {\r\n    name: 'vuepress-plugin-code-demo-block',\r\n    enhanceAppFiles: [\r\n      path.resolve(__dirname, './enhanceAppFile.js')\r\n    ],\r\n    plugins: [\r\n      [\r\n        'container',\r\n        {\r\n          type: 'code-demo',\r\n          render(tokens, ids) {\r\n            const copyTips = options.copyTips || undefined\r\n            const tipsTimes = options.tipsTimes || 1000\r\n            const type = options.type || 'vue'\r\n            const infoStr = tokens[ids].info\r\n            const infoList = infoStr.split(' ')\r\n            const isOnlyCode = infoStr.includes('--isOnlyShowCode')\r\n            const isOnlyComp = infoStr.includes('--isOnlyShowComp')\r\n            const dirTitle = infoList.find(item => item.includes('--title:')) || ''\r\n            const dirComPath = infoList.find(item => item.includes('.vue')) || ''\r\n            const comPath = dirComPath.trim()\r\n            const title = dirTitle.replace(/--title:/, '').trim()\r\n            const code = comPath ? getComContent(ctx.sourceDir, comPath) : ''\r\n            const newCode = highlightCode(code, type)\r\n            const compName = resolveCompName(comPath)\r\n            if (tokens[ids].nesting === 1) {\r\n              if (isOnlyCode) {\r\n                return `<div>\r\n                <CodeView\r\n                  title=\"${title}\"\r\n                  copyTips=\"${copyTips}\"\r\n                  isOnlyShowComp=\"${isOnlyComp}\"\r\n                  tipsTimes=\"${tipsTimes}\"\r\n                  code=\"${encodeURIComponent(code)}\"\r\n                >${newCode}</CodeView>`\r\n              }\r\n              return `<div>\r\n                <CodeView\r\n                  title=\"${title}\"\r\n                  component=\"${compName}\"\r\n                  copyTips=\"${copyTips}\"\r\n                  isOnlyShowComp=\"${isOnlyComp}\"\r\n                  tipsTimes=\"${tipsTimes}\"\r\n                  code=\"${encodeURIComponent(code)}\"\r\n                >${newCode}</CodeView>`\r\n            }\r\n            return `</div>`\r\n          }\r\n        }\r\n      ]\r\n    ]\r\n  }\r\n}\r\n"]}