rolldown-build-4YnQkA76.mjs 149 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319
  1. import { n as __toESM, t as require_binding } from "./binding-C5G6_6ql.mjs";
  2. import { i as logInputHookInOutputPlugin, n as error } from "./logs-D80CXhvg.mjs";
  3. import { n as BuiltinPlugin } from "./normalize-string-or-regex-C5RWbu3O.mjs";
  4. import { c as __decorate, d as PlainObjectLike, f as MinimalPluginContextImpl, h as LOG_LEVEL_DEBUG, i as transformModuleInfo, l as transformAssetSource, m as normalizeLog, o as transformToRollupOutput, p as normalizeHook, s as transformRenderedChunk, t as bindingifyInputOptions, u as lazyProp, v as LOG_LEVEL_WARN, x as VERSION, y as logLevelPriority } from "./bindingify-input-options-Cu7pt6SZ.mjs";
  5. import { i as unimplemented } from "./misc-DJYbNKZX.mjs";
  6. import { i as unwrapBindingResult } from "./error-CP8smW_P.mjs";
  7. import { Worker } from "node:worker_threads";
  8. import path, { sep } from "node:path";
  9. import { formatWithOptions, styleText } from "node:util";
  10. import process$1 from "node:process";
  11. import * as tty from "node:tty";
  12. import os from "node:os";
  13. //#region src/log/logger.ts
  14. function getLogger(plugins, onLog, logLevel, watchMode) {
  15. const minimalPriority = logLevelPriority[logLevel];
  16. const logger = (level, log, skipped = /* @__PURE__ */ new Set()) => {
  17. if (logLevelPriority[level] < minimalPriority) return;
  18. for (const plugin of getSortedPlugins("onLog", plugins)) {
  19. if (skipped.has(plugin)) continue;
  20. const { onLog: pluginOnLog } = plugin;
  21. if (pluginOnLog) {
  22. const getLogHandler = (level) => {
  23. if (logLevelPriority[level] < minimalPriority) return () => {};
  24. return (log) => logger(level, normalizeLog(log), new Set(skipped).add(plugin));
  25. };
  26. if (("handler" in pluginOnLog ? pluginOnLog.handler : pluginOnLog).call({
  27. debug: getLogHandler("debug"),
  28. error: (log) => error(normalizeLog(log)),
  29. info: getLogHandler("info"),
  30. meta: {
  31. rollupVersion: "4.23.0",
  32. rolldownVersion: VERSION,
  33. watchMode
  34. },
  35. warn: getLogHandler("warn"),
  36. pluginName: plugin.name || "unknown"
  37. }, level, log) === false) return;
  38. }
  39. }
  40. onLog(level, log);
  41. };
  42. return logger;
  43. }
  44. const getOnLog = (config, logLevel, printLog = defaultPrintLog) => {
  45. const { onwarn, onLog } = config;
  46. const defaultOnLog = getDefaultOnLog(printLog, onwarn);
  47. if (onLog) {
  48. const minimalPriority = logLevelPriority[logLevel];
  49. return (level, log) => onLog(level, addLogToString(log), (level, handledLog) => {
  50. if (level === "error") return error(normalizeLog(handledLog));
  51. if (logLevelPriority[level] >= minimalPriority) defaultOnLog(level, normalizeLog(handledLog));
  52. });
  53. }
  54. return defaultOnLog;
  55. };
  56. const getDefaultOnLog = (printLog, onwarn) => onwarn ? (level, log) => {
  57. if (level === "warn") onwarn(addLogToString(log), (warning) => printLog(LOG_LEVEL_WARN, normalizeLog(warning)));
  58. else printLog(level, log);
  59. } : printLog;
  60. const addLogToString = (log) => {
  61. Object.defineProperty(log, "toString", {
  62. value: () => getExtendedLogMessage(log),
  63. writable: true
  64. });
  65. return log;
  66. };
  67. const defaultPrintLog = (level, log) => {
  68. const message = getExtendedLogMessage(log);
  69. switch (level) {
  70. case LOG_LEVEL_WARN: return console.warn(message);
  71. case LOG_LEVEL_DEBUG: return console.debug(message);
  72. default: return console.info(message);
  73. }
  74. };
  75. const getExtendedLogMessage = (log) => {
  76. let prefix = "";
  77. if (log.plugin) prefix += `(${log.plugin} plugin) `;
  78. if (log.loc) prefix += `${relativeId(log.loc.file)} (${log.loc.line}:${log.loc.column}) `;
  79. return prefix + log.message;
  80. };
  81. function relativeId(id) {
  82. if (!path.isAbsolute(id)) return id;
  83. return path.relative(path.resolve(), id);
  84. }
  85. //#endregion
  86. //#region src/constants/plugin.ts
  87. const ENUMERATED_INPUT_PLUGIN_HOOK_NAMES = [
  88. "options",
  89. "buildStart",
  90. "resolveId",
  91. "load",
  92. "transform",
  93. "moduleParsed",
  94. "buildEnd",
  95. "onLog",
  96. "resolveDynamicImport",
  97. "closeBundle",
  98. "closeWatcher",
  99. "watchChange"
  100. ];
  101. const ENUMERATED_OUTPUT_PLUGIN_HOOK_NAMES = [
  102. "augmentChunkHash",
  103. "outputOptions",
  104. "renderChunk",
  105. "renderStart",
  106. "renderError",
  107. "writeBundle",
  108. "generateBundle"
  109. ];
  110. const ENUMERATED_PLUGIN_HOOK_NAMES = [
  111. ...ENUMERATED_INPUT_PLUGIN_HOOK_NAMES,
  112. ...ENUMERATED_OUTPUT_PLUGIN_HOOK_NAMES,
  113. "footer",
  114. "banner",
  115. "intro",
  116. "outro"
  117. ];
  118. ENUMERATED_PLUGIN_HOOK_NAMES[0], ENUMERATED_PLUGIN_HOOK_NAMES[0], ENUMERATED_PLUGIN_HOOK_NAMES[1], ENUMERATED_PLUGIN_HOOK_NAMES[1], ENUMERATED_PLUGIN_HOOK_NAMES[2], ENUMERATED_PLUGIN_HOOK_NAMES[2], ENUMERATED_PLUGIN_HOOK_NAMES[3], ENUMERATED_PLUGIN_HOOK_NAMES[3], ENUMERATED_PLUGIN_HOOK_NAMES[4], ENUMERATED_PLUGIN_HOOK_NAMES[4], ENUMERATED_PLUGIN_HOOK_NAMES[5], ENUMERATED_PLUGIN_HOOK_NAMES[5], ENUMERATED_PLUGIN_HOOK_NAMES[6], ENUMERATED_PLUGIN_HOOK_NAMES[6], ENUMERATED_PLUGIN_HOOK_NAMES[7], ENUMERATED_PLUGIN_HOOK_NAMES[7], ENUMERATED_PLUGIN_HOOK_NAMES[8], ENUMERATED_PLUGIN_HOOK_NAMES[8], ENUMERATED_PLUGIN_HOOK_NAMES[9], ENUMERATED_PLUGIN_HOOK_NAMES[9], ENUMERATED_PLUGIN_HOOK_NAMES[10], ENUMERATED_PLUGIN_HOOK_NAMES[10], ENUMERATED_PLUGIN_HOOK_NAMES[11], ENUMERATED_PLUGIN_HOOK_NAMES[11], ENUMERATED_PLUGIN_HOOK_NAMES[12], ENUMERATED_PLUGIN_HOOK_NAMES[12], ENUMERATED_PLUGIN_HOOK_NAMES[13], ENUMERATED_PLUGIN_HOOK_NAMES[13], ENUMERATED_PLUGIN_HOOK_NAMES[14], ENUMERATED_PLUGIN_HOOK_NAMES[14], ENUMERATED_PLUGIN_HOOK_NAMES[15], ENUMERATED_PLUGIN_HOOK_NAMES[15], ENUMERATED_PLUGIN_HOOK_NAMES[16], ENUMERATED_PLUGIN_HOOK_NAMES[16], ENUMERATED_PLUGIN_HOOK_NAMES[17], ENUMERATED_PLUGIN_HOOK_NAMES[17], ENUMERATED_PLUGIN_HOOK_NAMES[18], ENUMERATED_PLUGIN_HOOK_NAMES[18], ENUMERATED_PLUGIN_HOOK_NAMES[19], ENUMERATED_PLUGIN_HOOK_NAMES[19], ENUMERATED_PLUGIN_HOOK_NAMES[20], ENUMERATED_PLUGIN_HOOK_NAMES[20], ENUMERATED_PLUGIN_HOOK_NAMES[21], ENUMERATED_PLUGIN_HOOK_NAMES[21], ENUMERATED_PLUGIN_HOOK_NAMES[22], ENUMERATED_PLUGIN_HOOK_NAMES[22];
  119. //#endregion
  120. //#region src/utils/async-flatten.ts
  121. async function asyncFlatten(array) {
  122. do
  123. array = (await Promise.all(array)).flat(Infinity);
  124. while (array.some((v) => v?.then));
  125. return array;
  126. }
  127. //#endregion
  128. //#region src/utils/normalize-plugin-option.ts
  129. const normalizePluginOption = async (plugins) => (await asyncFlatten([plugins])).filter(Boolean);
  130. function checkOutputPluginOption(plugins, onLog) {
  131. for (const plugin of plugins) for (const hook of ENUMERATED_INPUT_PLUGIN_HOOK_NAMES) if (hook in plugin) {
  132. delete plugin[hook];
  133. onLog(LOG_LEVEL_WARN, logInputHookInOutputPlugin(plugin.name, hook));
  134. }
  135. return plugins;
  136. }
  137. function normalizePlugins(plugins, anonymousPrefix) {
  138. for (const [index, plugin] of plugins.entries()) {
  139. if ("_parallel" in plugin) continue;
  140. if (plugin instanceof BuiltinPlugin) continue;
  141. if (!plugin.name) plugin.name = `${anonymousPrefix}${index + 1}`;
  142. }
  143. return plugins;
  144. }
  145. const ANONYMOUS_PLUGIN_PREFIX = "at position ";
  146. const ANONYMOUS_OUTPUT_PLUGIN_PREFIX = "at output position ";
  147. //#endregion
  148. //#region src/plugin/plugin-driver.ts
  149. var PluginDriver = class {
  150. static async callOptionsHook(inputOptions, watchMode = false) {
  151. const logLevel = inputOptions.logLevel || "info";
  152. const plugins = getSortedPlugins("options", getObjectPlugins(await normalizePluginOption(inputOptions.plugins)));
  153. const logger = getLogger(plugins, getOnLog(inputOptions, logLevel), logLevel, watchMode);
  154. for (const plugin of plugins) {
  155. const name = plugin.name || "unknown";
  156. const options = plugin.options;
  157. if (options) {
  158. const { handler } = normalizeHook(options);
  159. const result = await handler.call(new MinimalPluginContextImpl(logger, logLevel, name, watchMode, "onLog"), inputOptions);
  160. if (result) inputOptions = result;
  161. }
  162. }
  163. return inputOptions;
  164. }
  165. static callOutputOptionsHook(rawPlugins, outputOptions, onLog, logLevel, watchMode) {
  166. const sortedPlugins = getSortedPlugins("outputOptions", getObjectPlugins(rawPlugins));
  167. for (const plugin of sortedPlugins) {
  168. const name = plugin.name || "unknown";
  169. const options = plugin.outputOptions;
  170. if (options) {
  171. const { handler } = normalizeHook(options);
  172. const result = handler.call(new MinimalPluginContextImpl(onLog, logLevel, name, watchMode), outputOptions);
  173. if (result) outputOptions = result;
  174. }
  175. }
  176. return outputOptions;
  177. }
  178. };
  179. function getObjectPlugins(plugins) {
  180. return plugins.filter((plugin) => {
  181. if (!plugin) return;
  182. if ("_parallel" in plugin) return;
  183. if (plugin instanceof BuiltinPlugin) return;
  184. return plugin;
  185. });
  186. }
  187. function getSortedPlugins(hookName, plugins) {
  188. const pre = [];
  189. const normal = [];
  190. const post = [];
  191. for (const plugin of plugins) {
  192. const hook = plugin[hookName];
  193. if (hook) {
  194. if (typeof hook === "object") {
  195. if (hook.order === "pre") {
  196. pre.push(plugin);
  197. continue;
  198. }
  199. if (hook.order === "post") {
  200. post.push(plugin);
  201. continue;
  202. }
  203. }
  204. normal.push(plugin);
  205. }
  206. }
  207. return [
  208. ...pre,
  209. ...normal,
  210. ...post
  211. ];
  212. }
  213. //#endregion
  214. //#region ../../node_modules/.pnpm/valibot@1.2.0_typescript@5.9.3/node_modules/valibot/dist/index.mjs
  215. let store$4;
  216. /**
  217. * Returns the global configuration.
  218. *
  219. * @param config The config to merge.
  220. *
  221. * @returns The configuration.
  222. */
  223. /* @__NO_SIDE_EFFECTS__ */
  224. function getGlobalConfig(config$1) {
  225. return {
  226. lang: config$1?.lang ?? store$4?.lang,
  227. message: config$1?.message,
  228. abortEarly: config$1?.abortEarly ?? store$4?.abortEarly,
  229. abortPipeEarly: config$1?.abortPipeEarly ?? store$4?.abortPipeEarly
  230. };
  231. }
  232. let store$3;
  233. /**
  234. * Returns a global error message.
  235. *
  236. * @param lang The language of the message.
  237. *
  238. * @returns The error message.
  239. */
  240. /* @__NO_SIDE_EFFECTS__ */
  241. function getGlobalMessage(lang) {
  242. return store$3?.get(lang);
  243. }
  244. let store$2;
  245. /**
  246. * Returns a schema error message.
  247. *
  248. * @param lang The language of the message.
  249. *
  250. * @returns The error message.
  251. */
  252. /* @__NO_SIDE_EFFECTS__ */
  253. function getSchemaMessage(lang) {
  254. return store$2?.get(lang);
  255. }
  256. let store$1;
  257. /**
  258. * Returns a specific error message.
  259. *
  260. * @param reference The identifier reference.
  261. * @param lang The language of the message.
  262. *
  263. * @returns The error message.
  264. */
  265. /* @__NO_SIDE_EFFECTS__ */
  266. function getSpecificMessage(reference, lang) {
  267. return store$1?.get(reference)?.get(lang);
  268. }
  269. /**
  270. * Stringifies an unknown input to a literal or type string.
  271. *
  272. * @param input The unknown input.
  273. *
  274. * @returns A literal or type string.
  275. *
  276. * @internal
  277. */
  278. /* @__NO_SIDE_EFFECTS__ */
  279. function _stringify(input) {
  280. const type = typeof input;
  281. if (type === "string") return `"${input}"`;
  282. if (type === "number" || type === "bigint" || type === "boolean") return `${input}`;
  283. if (type === "object" || type === "function") return (input && Object.getPrototypeOf(input)?.constructor?.name) ?? "null";
  284. return type;
  285. }
  286. /**
  287. * Adds an issue to the dataset.
  288. *
  289. * @param context The issue context.
  290. * @param label The issue label.
  291. * @param dataset The input dataset.
  292. * @param config The configuration.
  293. * @param other The optional props.
  294. *
  295. * @internal
  296. */
  297. function _addIssue(context, label, dataset, config$1, other) {
  298. const input = other && "input" in other ? other.input : dataset.value;
  299. const expected = other?.expected ?? context.expects ?? null;
  300. const received = other?.received ?? /* @__PURE__ */ _stringify(input);
  301. const issue = {
  302. kind: context.kind,
  303. type: context.type,
  304. input,
  305. expected,
  306. received,
  307. message: `Invalid ${label}: ${expected ? `Expected ${expected} but r` : "R"}eceived ${received}`,
  308. requirement: context.requirement,
  309. path: other?.path,
  310. issues: other?.issues,
  311. lang: config$1.lang,
  312. abortEarly: config$1.abortEarly,
  313. abortPipeEarly: config$1.abortPipeEarly
  314. };
  315. const isSchema = context.kind === "schema";
  316. const message$1 = other?.message ?? context.message ?? /* @__PURE__ */ getSpecificMessage(context.reference, issue.lang) ?? (isSchema ? /* @__PURE__ */ getSchemaMessage(issue.lang) : null) ?? config$1.message ?? /* @__PURE__ */ getGlobalMessage(issue.lang);
  317. if (message$1 !== void 0) issue.message = typeof message$1 === "function" ? message$1(issue) : message$1;
  318. if (isSchema) dataset.typed = false;
  319. if (dataset.issues) dataset.issues.push(issue);
  320. else dataset.issues = [issue];
  321. }
  322. /**
  323. * Returns the Standard Schema properties.
  324. *
  325. * @param context The schema context.
  326. *
  327. * @returns The Standard Schema properties.
  328. */
  329. /* @__NO_SIDE_EFFECTS__ */
  330. function _getStandardProps(context) {
  331. return {
  332. version: 1,
  333. vendor: "valibot",
  334. validate(value$1) {
  335. return context["~run"]({ value: value$1 }, /* @__PURE__ */ getGlobalConfig());
  336. }
  337. };
  338. }
  339. /**
  340. * Disallows inherited object properties and prevents object prototype
  341. * pollution by disallowing certain keys.
  342. *
  343. * @param object The object to check.
  344. * @param key The key to check.
  345. *
  346. * @returns Whether the key is allowed.
  347. *
  348. * @internal
  349. */
  350. /* @__NO_SIDE_EFFECTS__ */
  351. function _isValidObjectKey(object$1, key) {
  352. return Object.hasOwn(object$1, key) && key !== "__proto__" && key !== "prototype" && key !== "constructor";
  353. }
  354. /**
  355. * Joins multiple `expects` values with the given separator.
  356. *
  357. * @param values The `expects` values.
  358. * @param separator The separator.
  359. *
  360. * @returns The joined `expects` property.
  361. *
  362. * @internal
  363. */
  364. /* @__NO_SIDE_EFFECTS__ */
  365. function _joinExpects(values$1, separator) {
  366. const list = [...new Set(values$1)];
  367. if (list.length > 1) return `(${list.join(` ${separator} `)})`;
  368. return list[0] ?? "never";
  369. }
  370. /**
  371. * A Valibot error with useful information.
  372. */
  373. var ValiError = class extends Error {
  374. /**
  375. * Creates a Valibot error with useful information.
  376. *
  377. * @param issues The error issues.
  378. */
  379. constructor(issues) {
  380. super(issues[0].message);
  381. this.name = "ValiError";
  382. this.issues = issues;
  383. }
  384. };
  385. /* @__NO_SIDE_EFFECTS__ */
  386. function args(schema) {
  387. return {
  388. kind: "transformation",
  389. type: "args",
  390. reference: args,
  391. async: false,
  392. schema,
  393. "~run"(dataset, config$1) {
  394. const func = dataset.value;
  395. dataset.value = (...args_) => {
  396. const argsDataset = this.schema["~run"]({ value: args_ }, config$1);
  397. if (argsDataset.issues) throw new ValiError(argsDataset.issues);
  398. return func(...argsDataset.value);
  399. };
  400. return dataset;
  401. }
  402. };
  403. }
  404. /**
  405. * Creates an await transformation action.
  406. *
  407. * @returns An await action.
  408. */
  409. /* @__NO_SIDE_EFFECTS__ */
  410. function awaitAsync() {
  411. return {
  412. kind: "transformation",
  413. type: "await",
  414. reference: awaitAsync,
  415. async: true,
  416. async "~run"(dataset) {
  417. dataset.value = await dataset.value;
  418. return dataset;
  419. }
  420. };
  421. }
  422. /**
  423. * Creates a description metadata action.
  424. *
  425. * @param description_ The description text.
  426. *
  427. * @returns A description action.
  428. */
  429. /* @__NO_SIDE_EFFECTS__ */
  430. function description(description_) {
  431. return {
  432. kind: "metadata",
  433. type: "description",
  434. reference: description,
  435. description: description_
  436. };
  437. }
  438. /* @__NO_SIDE_EFFECTS__ */
  439. function returns(schema) {
  440. return {
  441. kind: "transformation",
  442. type: "returns",
  443. reference: returns,
  444. async: false,
  445. schema,
  446. "~run"(dataset, config$1) {
  447. const func = dataset.value;
  448. dataset.value = (...args_) => {
  449. const returnsDataset = this.schema["~run"]({ value: func(...args_) }, config$1);
  450. if (returnsDataset.issues) throw new ValiError(returnsDataset.issues);
  451. return returnsDataset.value;
  452. };
  453. return dataset;
  454. }
  455. };
  456. }
  457. /* @__NO_SIDE_EFFECTS__ */
  458. function returnsAsync(schema) {
  459. return {
  460. kind: "transformation",
  461. type: "returns",
  462. reference: returnsAsync,
  463. async: false,
  464. schema,
  465. "~run"(dataset, config$1) {
  466. const func = dataset.value;
  467. dataset.value = async (...args_) => {
  468. const returnsDataset = await this.schema["~run"]({ value: await func(...args_) }, config$1);
  469. if (returnsDataset.issues) throw new ValiError(returnsDataset.issues);
  470. return returnsDataset.value;
  471. };
  472. return dataset;
  473. }
  474. };
  475. }
  476. /**
  477. * Returns the fallback value of the schema.
  478. *
  479. * @param schema The schema to get it from.
  480. * @param dataset The output dataset if available.
  481. * @param config The config if available.
  482. *
  483. * @returns The fallback value.
  484. */
  485. /* @__NO_SIDE_EFFECTS__ */
  486. function getFallback(schema, dataset, config$1) {
  487. return typeof schema.fallback === "function" ? schema.fallback(dataset, config$1) : schema.fallback;
  488. }
  489. /**
  490. * Returns the default value of the schema.
  491. *
  492. * @param schema The schema to get it from.
  493. * @param dataset The input dataset if available.
  494. * @param config The config if available.
  495. *
  496. * @returns The default value.
  497. */
  498. /* @__NO_SIDE_EFFECTS__ */
  499. function getDefault(schema, dataset, config$1) {
  500. return typeof schema.default === "function" ? schema.default(dataset, config$1) : schema.default;
  501. }
  502. /**
  503. * Checks if the input matches the schema. By using a type predicate, this
  504. * function can be used as a type guard.
  505. *
  506. * @param schema The schema to be used.
  507. * @param input The input to be tested.
  508. *
  509. * @returns Whether the input matches the schema.
  510. */
  511. /* @__NO_SIDE_EFFECTS__ */
  512. function is(schema, input) {
  513. return !schema["~run"]({ value: input }, { abortEarly: true }).issues;
  514. }
  515. /**
  516. * Creates an any schema.
  517. *
  518. * Hint: This schema function exists only for completeness and is not
  519. * recommended in practice. Instead, `unknown` should be used to accept
  520. * unknown data.
  521. *
  522. * @returns An any schema.
  523. */
  524. /* @__NO_SIDE_EFFECTS__ */
  525. function any() {
  526. return {
  527. kind: "schema",
  528. type: "any",
  529. reference: any,
  530. expects: "any",
  531. async: false,
  532. get "~standard"() {
  533. return /* @__PURE__ */ _getStandardProps(this);
  534. },
  535. "~run"(dataset) {
  536. dataset.typed = true;
  537. return dataset;
  538. }
  539. };
  540. }
  541. /* @__NO_SIDE_EFFECTS__ */
  542. function array(item, message$1) {
  543. return {
  544. kind: "schema",
  545. type: "array",
  546. reference: array,
  547. expects: "Array",
  548. async: false,
  549. item,
  550. message: message$1,
  551. get "~standard"() {
  552. return /* @__PURE__ */ _getStandardProps(this);
  553. },
  554. "~run"(dataset, config$1) {
  555. const input = dataset.value;
  556. if (Array.isArray(input)) {
  557. dataset.typed = true;
  558. dataset.value = [];
  559. for (let key = 0; key < input.length; key++) {
  560. const value$1 = input[key];
  561. const itemDataset = this.item["~run"]({ value: value$1 }, config$1);
  562. if (itemDataset.issues) {
  563. const pathItem = {
  564. type: "array",
  565. origin: "value",
  566. input,
  567. key,
  568. value: value$1
  569. };
  570. for (const issue of itemDataset.issues) {
  571. if (issue.path) issue.path.unshift(pathItem);
  572. else issue.path = [pathItem];
  573. dataset.issues?.push(issue);
  574. }
  575. if (!dataset.issues) dataset.issues = itemDataset.issues;
  576. if (config$1.abortEarly) {
  577. dataset.typed = false;
  578. break;
  579. }
  580. }
  581. if (!itemDataset.typed) dataset.typed = false;
  582. dataset.value.push(itemDataset.value);
  583. }
  584. } else _addIssue(this, "type", dataset, config$1);
  585. return dataset;
  586. }
  587. };
  588. }
  589. /* @__NO_SIDE_EFFECTS__ */
  590. function boolean(message$1) {
  591. return {
  592. kind: "schema",
  593. type: "boolean",
  594. reference: boolean,
  595. expects: "boolean",
  596. async: false,
  597. message: message$1,
  598. get "~standard"() {
  599. return /* @__PURE__ */ _getStandardProps(this);
  600. },
  601. "~run"(dataset, config$1) {
  602. if (typeof dataset.value === "boolean") dataset.typed = true;
  603. else _addIssue(this, "type", dataset, config$1);
  604. return dataset;
  605. }
  606. };
  607. }
  608. /* @__NO_SIDE_EFFECTS__ */
  609. function custom(check$1, message$1) {
  610. return {
  611. kind: "schema",
  612. type: "custom",
  613. reference: custom,
  614. expects: "unknown",
  615. async: false,
  616. check: check$1,
  617. message: message$1,
  618. get "~standard"() {
  619. return /* @__PURE__ */ _getStandardProps(this);
  620. },
  621. "~run"(dataset, config$1) {
  622. if (this.check(dataset.value)) dataset.typed = true;
  623. else _addIssue(this, "type", dataset, config$1);
  624. return dataset;
  625. }
  626. };
  627. }
  628. /* @__NO_SIDE_EFFECTS__ */
  629. function function_(message$1) {
  630. return {
  631. kind: "schema",
  632. type: "function",
  633. reference: function_,
  634. expects: "Function",
  635. async: false,
  636. message: message$1,
  637. get "~standard"() {
  638. return /* @__PURE__ */ _getStandardProps(this);
  639. },
  640. "~run"(dataset, config$1) {
  641. if (typeof dataset.value === "function") dataset.typed = true;
  642. else _addIssue(this, "type", dataset, config$1);
  643. return dataset;
  644. }
  645. };
  646. }
  647. /* @__NO_SIDE_EFFECTS__ */
  648. function instance(class_, message$1) {
  649. return {
  650. kind: "schema",
  651. type: "instance",
  652. reference: instance,
  653. expects: class_.name,
  654. async: false,
  655. class: class_,
  656. message: message$1,
  657. get "~standard"() {
  658. return /* @__PURE__ */ _getStandardProps(this);
  659. },
  660. "~run"(dataset, config$1) {
  661. if (dataset.value instanceof this.class) dataset.typed = true;
  662. else _addIssue(this, "type", dataset, config$1);
  663. return dataset;
  664. }
  665. };
  666. }
  667. /* @__NO_SIDE_EFFECTS__ */
  668. function literal(literal_, message$1) {
  669. return {
  670. kind: "schema",
  671. type: "literal",
  672. reference: literal,
  673. expects: /* @__PURE__ */ _stringify(literal_),
  674. async: false,
  675. literal: literal_,
  676. message: message$1,
  677. get "~standard"() {
  678. return /* @__PURE__ */ _getStandardProps(this);
  679. },
  680. "~run"(dataset, config$1) {
  681. if (dataset.value === this.literal) dataset.typed = true;
  682. else _addIssue(this, "type", dataset, config$1);
  683. return dataset;
  684. }
  685. };
  686. }
  687. /* @__NO_SIDE_EFFECTS__ */
  688. function never(message$1) {
  689. return {
  690. kind: "schema",
  691. type: "never",
  692. reference: never,
  693. expects: "never",
  694. async: false,
  695. message: message$1,
  696. get "~standard"() {
  697. return /* @__PURE__ */ _getStandardProps(this);
  698. },
  699. "~run"(dataset, config$1) {
  700. _addIssue(this, "type", dataset, config$1);
  701. return dataset;
  702. }
  703. };
  704. }
  705. /* @__NO_SIDE_EFFECTS__ */
  706. function nullish(wrapped, default_) {
  707. return {
  708. kind: "schema",
  709. type: "nullish",
  710. reference: nullish,
  711. expects: `(${wrapped.expects} | null | undefined)`,
  712. async: false,
  713. wrapped,
  714. default: default_,
  715. get "~standard"() {
  716. return /* @__PURE__ */ _getStandardProps(this);
  717. },
  718. "~run"(dataset, config$1) {
  719. if (dataset.value === null || dataset.value === void 0) {
  720. if (this.default !== void 0) dataset.value = /* @__PURE__ */ getDefault(this, dataset, config$1);
  721. if (dataset.value === null || dataset.value === void 0) {
  722. dataset.typed = true;
  723. return dataset;
  724. }
  725. }
  726. return this.wrapped["~run"](dataset, config$1);
  727. }
  728. };
  729. }
  730. /* @__NO_SIDE_EFFECTS__ */
  731. function number(message$1) {
  732. return {
  733. kind: "schema",
  734. type: "number",
  735. reference: number,
  736. expects: "number",
  737. async: false,
  738. message: message$1,
  739. get "~standard"() {
  740. return /* @__PURE__ */ _getStandardProps(this);
  741. },
  742. "~run"(dataset, config$1) {
  743. if (typeof dataset.value === "number" && !isNaN(dataset.value)) dataset.typed = true;
  744. else _addIssue(this, "type", dataset, config$1);
  745. return dataset;
  746. }
  747. };
  748. }
  749. /* @__NO_SIDE_EFFECTS__ */
  750. function object(entries$1, message$1) {
  751. return {
  752. kind: "schema",
  753. type: "object",
  754. reference: object,
  755. expects: "Object",
  756. async: false,
  757. entries: entries$1,
  758. message: message$1,
  759. get "~standard"() {
  760. return /* @__PURE__ */ _getStandardProps(this);
  761. },
  762. "~run"(dataset, config$1) {
  763. const input = dataset.value;
  764. if (input && typeof input === "object") {
  765. dataset.typed = true;
  766. dataset.value = {};
  767. for (const key in this.entries) {
  768. const valueSchema = this.entries[key];
  769. if (key in input || (valueSchema.type === "exact_optional" || valueSchema.type === "optional" || valueSchema.type === "nullish") && valueSchema.default !== void 0) {
  770. const value$1 = key in input ? input[key] : /* @__PURE__ */ getDefault(valueSchema);
  771. const valueDataset = valueSchema["~run"]({ value: value$1 }, config$1);
  772. if (valueDataset.issues) {
  773. const pathItem = {
  774. type: "object",
  775. origin: "value",
  776. input,
  777. key,
  778. value: value$1
  779. };
  780. for (const issue of valueDataset.issues) {
  781. if (issue.path) issue.path.unshift(pathItem);
  782. else issue.path = [pathItem];
  783. dataset.issues?.push(issue);
  784. }
  785. if (!dataset.issues) dataset.issues = valueDataset.issues;
  786. if (config$1.abortEarly) {
  787. dataset.typed = false;
  788. break;
  789. }
  790. }
  791. if (!valueDataset.typed) dataset.typed = false;
  792. dataset.value[key] = valueDataset.value;
  793. } else if (valueSchema.fallback !== void 0) dataset.value[key] = /* @__PURE__ */ getFallback(valueSchema);
  794. else if (valueSchema.type !== "exact_optional" && valueSchema.type !== "optional" && valueSchema.type !== "nullish") {
  795. _addIssue(this, "key", dataset, config$1, {
  796. input: void 0,
  797. expected: `"${key}"`,
  798. path: [{
  799. type: "object",
  800. origin: "key",
  801. input,
  802. key,
  803. value: input[key]
  804. }]
  805. });
  806. if (config$1.abortEarly) break;
  807. }
  808. }
  809. } else _addIssue(this, "type", dataset, config$1);
  810. return dataset;
  811. }
  812. };
  813. }
  814. /* @__NO_SIDE_EFFECTS__ */
  815. function optional(wrapped, default_) {
  816. return {
  817. kind: "schema",
  818. type: "optional",
  819. reference: optional,
  820. expects: `(${wrapped.expects} | undefined)`,
  821. async: false,
  822. wrapped,
  823. default: default_,
  824. get "~standard"() {
  825. return /* @__PURE__ */ _getStandardProps(this);
  826. },
  827. "~run"(dataset, config$1) {
  828. if (dataset.value === void 0) {
  829. if (this.default !== void 0) dataset.value = /* @__PURE__ */ getDefault(this, dataset, config$1);
  830. if (dataset.value === void 0) {
  831. dataset.typed = true;
  832. return dataset;
  833. }
  834. }
  835. return this.wrapped["~run"](dataset, config$1);
  836. }
  837. };
  838. }
  839. /* @__NO_SIDE_EFFECTS__ */
  840. function picklist(options, message$1) {
  841. return {
  842. kind: "schema",
  843. type: "picklist",
  844. reference: picklist,
  845. expects: /* @__PURE__ */ _joinExpects(options.map(_stringify), "|"),
  846. async: false,
  847. options,
  848. message: message$1,
  849. get "~standard"() {
  850. return /* @__PURE__ */ _getStandardProps(this);
  851. },
  852. "~run"(dataset, config$1) {
  853. if (this.options.includes(dataset.value)) dataset.typed = true;
  854. else _addIssue(this, "type", dataset, config$1);
  855. return dataset;
  856. }
  857. };
  858. }
  859. /* @__NO_SIDE_EFFECTS__ */
  860. function promise(message$1) {
  861. return {
  862. kind: "schema",
  863. type: "promise",
  864. reference: promise,
  865. expects: "Promise",
  866. async: false,
  867. message: message$1,
  868. get "~standard"() {
  869. return /* @__PURE__ */ _getStandardProps(this);
  870. },
  871. "~run"(dataset, config$1) {
  872. if (dataset.value instanceof Promise) dataset.typed = true;
  873. else _addIssue(this, "type", dataset, config$1);
  874. return dataset;
  875. }
  876. };
  877. }
  878. /* @__NO_SIDE_EFFECTS__ */
  879. function record(key, value$1, message$1) {
  880. return {
  881. kind: "schema",
  882. type: "record",
  883. reference: record,
  884. expects: "Object",
  885. async: false,
  886. key,
  887. value: value$1,
  888. message: message$1,
  889. get "~standard"() {
  890. return /* @__PURE__ */ _getStandardProps(this);
  891. },
  892. "~run"(dataset, config$1) {
  893. const input = dataset.value;
  894. if (input && typeof input === "object") {
  895. dataset.typed = true;
  896. dataset.value = {};
  897. for (const entryKey in input) if (/* @__PURE__ */ _isValidObjectKey(input, entryKey)) {
  898. const entryValue = input[entryKey];
  899. const keyDataset = this.key["~run"]({ value: entryKey }, config$1);
  900. if (keyDataset.issues) {
  901. const pathItem = {
  902. type: "object",
  903. origin: "key",
  904. input,
  905. key: entryKey,
  906. value: entryValue
  907. };
  908. for (const issue of keyDataset.issues) {
  909. issue.path = [pathItem];
  910. dataset.issues?.push(issue);
  911. }
  912. if (!dataset.issues) dataset.issues = keyDataset.issues;
  913. if (config$1.abortEarly) {
  914. dataset.typed = false;
  915. break;
  916. }
  917. }
  918. const valueDataset = this.value["~run"]({ value: entryValue }, config$1);
  919. if (valueDataset.issues) {
  920. const pathItem = {
  921. type: "object",
  922. origin: "value",
  923. input,
  924. key: entryKey,
  925. value: entryValue
  926. };
  927. for (const issue of valueDataset.issues) {
  928. if (issue.path) issue.path.unshift(pathItem);
  929. else issue.path = [pathItem];
  930. dataset.issues?.push(issue);
  931. }
  932. if (!dataset.issues) dataset.issues = valueDataset.issues;
  933. if (config$1.abortEarly) {
  934. dataset.typed = false;
  935. break;
  936. }
  937. }
  938. if (!keyDataset.typed || !valueDataset.typed) dataset.typed = false;
  939. if (keyDataset.typed) dataset.value[keyDataset.value] = valueDataset.value;
  940. }
  941. } else _addIssue(this, "type", dataset, config$1);
  942. return dataset;
  943. }
  944. };
  945. }
  946. /* @__NO_SIDE_EFFECTS__ */
  947. function strictObject(entries$1, message$1) {
  948. return {
  949. kind: "schema",
  950. type: "strict_object",
  951. reference: strictObject,
  952. expects: "Object",
  953. async: false,
  954. entries: entries$1,
  955. message: message$1,
  956. get "~standard"() {
  957. return /* @__PURE__ */ _getStandardProps(this);
  958. },
  959. "~run"(dataset, config$1) {
  960. const input = dataset.value;
  961. if (input && typeof input === "object") {
  962. dataset.typed = true;
  963. dataset.value = {};
  964. for (const key in this.entries) {
  965. const valueSchema = this.entries[key];
  966. if (key in input || (valueSchema.type === "exact_optional" || valueSchema.type === "optional" || valueSchema.type === "nullish") && valueSchema.default !== void 0) {
  967. const value$1 = key in input ? input[key] : /* @__PURE__ */ getDefault(valueSchema);
  968. const valueDataset = valueSchema["~run"]({ value: value$1 }, config$1);
  969. if (valueDataset.issues) {
  970. const pathItem = {
  971. type: "object",
  972. origin: "value",
  973. input,
  974. key,
  975. value: value$1
  976. };
  977. for (const issue of valueDataset.issues) {
  978. if (issue.path) issue.path.unshift(pathItem);
  979. else issue.path = [pathItem];
  980. dataset.issues?.push(issue);
  981. }
  982. if (!dataset.issues) dataset.issues = valueDataset.issues;
  983. if (config$1.abortEarly) {
  984. dataset.typed = false;
  985. break;
  986. }
  987. }
  988. if (!valueDataset.typed) dataset.typed = false;
  989. dataset.value[key] = valueDataset.value;
  990. } else if (valueSchema.fallback !== void 0) dataset.value[key] = /* @__PURE__ */ getFallback(valueSchema);
  991. else if (valueSchema.type !== "exact_optional" && valueSchema.type !== "optional" && valueSchema.type !== "nullish") {
  992. _addIssue(this, "key", dataset, config$1, {
  993. input: void 0,
  994. expected: `"${key}"`,
  995. path: [{
  996. type: "object",
  997. origin: "key",
  998. input,
  999. key,
  1000. value: input[key]
  1001. }]
  1002. });
  1003. if (config$1.abortEarly) break;
  1004. }
  1005. }
  1006. if (!dataset.issues || !config$1.abortEarly) {
  1007. for (const key in input) if (!(key in this.entries)) {
  1008. _addIssue(this, "key", dataset, config$1, {
  1009. input: key,
  1010. expected: "never",
  1011. path: [{
  1012. type: "object",
  1013. origin: "key",
  1014. input,
  1015. key,
  1016. value: input[key]
  1017. }]
  1018. });
  1019. break;
  1020. }
  1021. }
  1022. } else _addIssue(this, "type", dataset, config$1);
  1023. return dataset;
  1024. }
  1025. };
  1026. }
  1027. /* @__NO_SIDE_EFFECTS__ */
  1028. function string(message$1) {
  1029. return {
  1030. kind: "schema",
  1031. type: "string",
  1032. reference: string,
  1033. expects: "string",
  1034. async: false,
  1035. message: message$1,
  1036. get "~standard"() {
  1037. return /* @__PURE__ */ _getStandardProps(this);
  1038. },
  1039. "~run"(dataset, config$1) {
  1040. if (typeof dataset.value === "string") dataset.typed = true;
  1041. else _addIssue(this, "type", dataset, config$1);
  1042. return dataset;
  1043. }
  1044. };
  1045. }
  1046. /* @__NO_SIDE_EFFECTS__ */
  1047. function tuple(items, message$1) {
  1048. return {
  1049. kind: "schema",
  1050. type: "tuple",
  1051. reference: tuple,
  1052. expects: "Array",
  1053. async: false,
  1054. items,
  1055. message: message$1,
  1056. get "~standard"() {
  1057. return /* @__PURE__ */ _getStandardProps(this);
  1058. },
  1059. "~run"(dataset, config$1) {
  1060. const input = dataset.value;
  1061. if (Array.isArray(input)) {
  1062. dataset.typed = true;
  1063. dataset.value = [];
  1064. for (let key = 0; key < this.items.length; key++) {
  1065. const value$1 = input[key];
  1066. const itemDataset = this.items[key]["~run"]({ value: value$1 }, config$1);
  1067. if (itemDataset.issues) {
  1068. const pathItem = {
  1069. type: "array",
  1070. origin: "value",
  1071. input,
  1072. key,
  1073. value: value$1
  1074. };
  1075. for (const issue of itemDataset.issues) {
  1076. if (issue.path) issue.path.unshift(pathItem);
  1077. else issue.path = [pathItem];
  1078. dataset.issues?.push(issue);
  1079. }
  1080. if (!dataset.issues) dataset.issues = itemDataset.issues;
  1081. if (config$1.abortEarly) {
  1082. dataset.typed = false;
  1083. break;
  1084. }
  1085. }
  1086. if (!itemDataset.typed) dataset.typed = false;
  1087. dataset.value.push(itemDataset.value);
  1088. }
  1089. } else _addIssue(this, "type", dataset, config$1);
  1090. return dataset;
  1091. }
  1092. };
  1093. }
  1094. /* @__NO_SIDE_EFFECTS__ */
  1095. function undefined_(message$1) {
  1096. return {
  1097. kind: "schema",
  1098. type: "undefined",
  1099. reference: undefined_,
  1100. expects: "undefined",
  1101. async: false,
  1102. message: message$1,
  1103. get "~standard"() {
  1104. return /* @__PURE__ */ _getStandardProps(this);
  1105. },
  1106. "~run"(dataset, config$1) {
  1107. if (dataset.value === void 0) dataset.typed = true;
  1108. else _addIssue(this, "type", dataset, config$1);
  1109. return dataset;
  1110. }
  1111. };
  1112. }
  1113. /**
  1114. * Returns the sub issues of the provided datasets for the union issue.
  1115. *
  1116. * @param datasets The datasets.
  1117. *
  1118. * @returns The sub issues.
  1119. *
  1120. * @internal
  1121. */
  1122. /* @__NO_SIDE_EFFECTS__ */
  1123. function _subIssues(datasets) {
  1124. let issues;
  1125. if (datasets) for (const dataset of datasets) if (issues) issues.push(...dataset.issues);
  1126. else issues = dataset.issues;
  1127. return issues;
  1128. }
  1129. /* @__NO_SIDE_EFFECTS__ */
  1130. function union(options, message$1) {
  1131. return {
  1132. kind: "schema",
  1133. type: "union",
  1134. reference: union,
  1135. expects: /* @__PURE__ */ _joinExpects(options.map((option) => option.expects), "|"),
  1136. async: false,
  1137. options,
  1138. message: message$1,
  1139. get "~standard"() {
  1140. return /* @__PURE__ */ _getStandardProps(this);
  1141. },
  1142. "~run"(dataset, config$1) {
  1143. let validDataset;
  1144. let typedDatasets;
  1145. let untypedDatasets;
  1146. for (const schema of this.options) {
  1147. const optionDataset = schema["~run"]({ value: dataset.value }, config$1);
  1148. if (optionDataset.typed) if (optionDataset.issues) if (typedDatasets) typedDatasets.push(optionDataset);
  1149. else typedDatasets = [optionDataset];
  1150. else {
  1151. validDataset = optionDataset;
  1152. break;
  1153. }
  1154. else if (untypedDatasets) untypedDatasets.push(optionDataset);
  1155. else untypedDatasets = [optionDataset];
  1156. }
  1157. if (validDataset) return validDataset;
  1158. if (typedDatasets) {
  1159. if (typedDatasets.length === 1) return typedDatasets[0];
  1160. _addIssue(this, "type", dataset, config$1, { issues: /* @__PURE__ */ _subIssues(typedDatasets) });
  1161. dataset.typed = true;
  1162. } else if (untypedDatasets?.length === 1) return untypedDatasets[0];
  1163. else _addIssue(this, "type", dataset, config$1, { issues: /* @__PURE__ */ _subIssues(untypedDatasets) });
  1164. return dataset;
  1165. }
  1166. };
  1167. }
  1168. /* @__NO_SIDE_EFFECTS__ */
  1169. function unionAsync(options, message$1) {
  1170. return {
  1171. kind: "schema",
  1172. type: "union",
  1173. reference: unionAsync,
  1174. expects: /* @__PURE__ */ _joinExpects(options.map((option) => option.expects), "|"),
  1175. async: true,
  1176. options,
  1177. message: message$1,
  1178. get "~standard"() {
  1179. return /* @__PURE__ */ _getStandardProps(this);
  1180. },
  1181. async "~run"(dataset, config$1) {
  1182. let validDataset;
  1183. let typedDatasets;
  1184. let untypedDatasets;
  1185. for (const schema of this.options) {
  1186. const optionDataset = await schema["~run"]({ value: dataset.value }, config$1);
  1187. if (optionDataset.typed) if (optionDataset.issues) if (typedDatasets) typedDatasets.push(optionDataset);
  1188. else typedDatasets = [optionDataset];
  1189. else {
  1190. validDataset = optionDataset;
  1191. break;
  1192. }
  1193. else if (untypedDatasets) untypedDatasets.push(optionDataset);
  1194. else untypedDatasets = [optionDataset];
  1195. }
  1196. if (validDataset) return validDataset;
  1197. if (typedDatasets) {
  1198. if (typedDatasets.length === 1) return typedDatasets[0];
  1199. _addIssue(this, "type", dataset, config$1, { issues: /* @__PURE__ */ _subIssues(typedDatasets) });
  1200. dataset.typed = true;
  1201. } else if (untypedDatasets?.length === 1) return untypedDatasets[0];
  1202. else _addIssue(this, "type", dataset, config$1, { issues: /* @__PURE__ */ _subIssues(untypedDatasets) });
  1203. return dataset;
  1204. }
  1205. };
  1206. }
  1207. /* @__NO_SIDE_EFFECTS__ */
  1208. function void_(message$1) {
  1209. return {
  1210. kind: "schema",
  1211. type: "void",
  1212. reference: void_,
  1213. expects: "void",
  1214. async: false,
  1215. message: message$1,
  1216. get "~standard"() {
  1217. return /* @__PURE__ */ _getStandardProps(this);
  1218. },
  1219. "~run"(dataset, config$1) {
  1220. if (dataset.value === void 0) dataset.typed = true;
  1221. else _addIssue(this, "type", dataset, config$1);
  1222. return dataset;
  1223. }
  1224. };
  1225. }
  1226. /* @__NO_SIDE_EFFECTS__ */
  1227. function keyof(schema, message$1) {
  1228. return /* @__PURE__ */ picklist(Object.keys(schema.entries), message$1);
  1229. }
  1230. /**
  1231. * Creates a modified copy of an object schema that does not contain the
  1232. * selected entries.
  1233. *
  1234. * @param schema The schema to omit from.
  1235. * @param keys The selected entries.
  1236. *
  1237. * @returns An object schema.
  1238. */
  1239. /* @__NO_SIDE_EFFECTS__ */
  1240. function omit(schema, keys) {
  1241. const entries$1 = { ...schema.entries };
  1242. for (const key of keys) delete entries$1[key];
  1243. return {
  1244. ...schema,
  1245. entries: entries$1,
  1246. get "~standard"() {
  1247. return /* @__PURE__ */ _getStandardProps(this);
  1248. }
  1249. };
  1250. }
  1251. /* @__NO_SIDE_EFFECTS__ */
  1252. function partial(schema, keys) {
  1253. const entries$1 = {};
  1254. for (const key in schema.entries) entries$1[key] = !keys || keys.includes(key) ? /* @__PURE__ */ optional(schema.entries[key]) : schema.entries[key];
  1255. return {
  1256. ...schema,
  1257. entries: entries$1,
  1258. get "~standard"() {
  1259. return /* @__PURE__ */ _getStandardProps(this);
  1260. }
  1261. };
  1262. }
  1263. /* @__NO_SIDE_EFFECTS__ */
  1264. function pipe(...pipe$1) {
  1265. return {
  1266. ...pipe$1[0],
  1267. pipe: pipe$1,
  1268. get "~standard"() {
  1269. return /* @__PURE__ */ _getStandardProps(this);
  1270. },
  1271. "~run"(dataset, config$1) {
  1272. for (const item of pipe$1) if (item.kind !== "metadata") {
  1273. if (dataset.issues && (item.kind === "schema" || item.kind === "transformation")) {
  1274. dataset.typed = false;
  1275. break;
  1276. }
  1277. if (!dataset.issues || !config$1.abortEarly && !config$1.abortPipeEarly) dataset = item["~run"](dataset, config$1);
  1278. }
  1279. return dataset;
  1280. }
  1281. };
  1282. }
  1283. /* @__NO_SIDE_EFFECTS__ */
  1284. function pipeAsync(...pipe$1) {
  1285. return {
  1286. ...pipe$1[0],
  1287. pipe: pipe$1,
  1288. async: true,
  1289. get "~standard"() {
  1290. return /* @__PURE__ */ _getStandardProps(this);
  1291. },
  1292. async "~run"(dataset, config$1) {
  1293. for (const item of pipe$1) if (item.kind !== "metadata") {
  1294. if (dataset.issues && (item.kind === "schema" || item.kind === "transformation")) {
  1295. dataset.typed = false;
  1296. break;
  1297. }
  1298. if (!dataset.issues || !config$1.abortEarly && !config$1.abortPipeEarly) dataset = await item["~run"](dataset, config$1);
  1299. }
  1300. return dataset;
  1301. }
  1302. };
  1303. }
  1304. /**
  1305. * Parses an unknown input based on a schema.
  1306. *
  1307. * @param schema The schema to be used.
  1308. * @param input The input to be parsed.
  1309. * @param config The parse configuration.
  1310. *
  1311. * @returns The parse result.
  1312. */
  1313. /* @__NO_SIDE_EFFECTS__ */
  1314. function safeParse(schema, input, config$1) {
  1315. const dataset = schema["~run"]({ value: input }, /* @__PURE__ */ getGlobalConfig(config$1));
  1316. return {
  1317. typed: dataset.typed,
  1318. success: !dataset.issues,
  1319. output: dataset.value,
  1320. issues: dataset.issues
  1321. };
  1322. }
  1323. //#endregion
  1324. //#region src/utils/flatten-valibot-schema.ts
  1325. function unwrapSchema(schema) {
  1326. if (!schema) return schema;
  1327. if (schema.type === "optional" && schema.wrapped) return unwrapSchema(schema.wrapped);
  1328. if (schema.type === "nullable" && schema.wrapped) return unwrapSchema(schema.wrapped);
  1329. if (schema.type === "nullish" && schema.wrapped) return unwrapSchema(schema.wrapped);
  1330. return schema;
  1331. }
  1332. function getValibotSchemaType(schema) {
  1333. if (!schema) return "any";
  1334. if (schema.type) switch (schema.type) {
  1335. case "string": return "string";
  1336. case "number": return "number";
  1337. case "boolean": return "boolean";
  1338. case "array": return "array";
  1339. case "object":
  1340. case "strict_object":
  1341. case "loose_object": return "object";
  1342. case "union": return "union";
  1343. case "literal": return typeof schema.literal;
  1344. case "record": return "object";
  1345. case "optional": return getValibotSchemaType(schema.wrapped);
  1346. case "nullable": return getValibotSchemaType(schema.wrapped);
  1347. case "nullish": return getValibotSchemaType(schema.wrapped);
  1348. case "never": return "never";
  1349. case "any": return "any";
  1350. case "custom": return "any";
  1351. case "function": return "never";
  1352. case "instance": return "object";
  1353. default: return "any";
  1354. }
  1355. return "any";
  1356. }
  1357. function getValibotDescription(schema) {
  1358. if (!schema) return void 0;
  1359. if (schema.pipe && Array.isArray(schema.pipe)) {
  1360. for (const action of schema.pipe) if (action.type === "description" && action.description) return action.description;
  1361. }
  1362. if (schema.type === "optional" && schema.wrapped) return getValibotDescription(schema.wrapped);
  1363. }
  1364. function flattenValibotSchema(schema, result = {}, prefix = "") {
  1365. if (!schema || typeof schema !== "object") return result;
  1366. if (schema.type === "strict_object" || schema.type === "object" || schema.type === "loose_object") {
  1367. if (schema.entries && typeof schema.entries === "object") for (const [key, value] of Object.entries(schema.entries)) {
  1368. const fullKey = prefix ? `${prefix}.${key}` : key;
  1369. const valueSchema = value;
  1370. const type = getValibotSchemaType(valueSchema);
  1371. const description = getValibotDescription(valueSchema);
  1372. if (type === "object") {
  1373. const unwrappedSchema = unwrapSchema(valueSchema);
  1374. if (unwrappedSchema && unwrappedSchema.entries) flattenValibotSchema(unwrappedSchema, result, fullKey);
  1375. else result[fullKey] = {
  1376. type,
  1377. description
  1378. };
  1379. } else result[fullKey] = {
  1380. type,
  1381. description
  1382. };
  1383. }
  1384. }
  1385. return result;
  1386. }
  1387. //#endregion
  1388. //#region src/utils/style-text.ts
  1389. /**
  1390. * Cross-platform styleText utility that works in both Node.js and browser environments
  1391. * In Node.js, it uses the native `styleText` from `node:util`
  1392. * In browser, it provides empty styling functions for compatibility
  1393. */
  1394. function styleText$1(...args) {
  1395. return styleText(...args);
  1396. }
  1397. //#endregion
  1398. //#region src/utils/validator.ts
  1399. function isTypeTrue() {}
  1400. const StringOrRegExpSchema = /* @__PURE__ */ union([/* @__PURE__ */ string(), /* @__PURE__ */ instance(RegExp)]);
  1401. isTypeTrue();
  1402. function vFunction() {
  1403. return /* @__PURE__ */ function_();
  1404. }
  1405. const LogLevelSchema = /* @__PURE__ */ union([
  1406. /* @__PURE__ */ literal("debug"),
  1407. /* @__PURE__ */ literal("info"),
  1408. /* @__PURE__ */ literal("warn")
  1409. ]);
  1410. isTypeTrue();
  1411. const LogLevelOptionSchema = /* @__PURE__ */ union([LogLevelSchema, /* @__PURE__ */ literal("silent")]);
  1412. isTypeTrue();
  1413. const LogLevelWithErrorSchema = /* @__PURE__ */ union([LogLevelSchema, /* @__PURE__ */ literal("error")]);
  1414. isTypeTrue();
  1415. const RollupLogSchema = /* @__PURE__ */ any();
  1416. const RollupLogWithStringSchema = /* @__PURE__ */ union([RollupLogSchema, /* @__PURE__ */ string()]);
  1417. isTypeTrue();
  1418. const InputOptionSchema = /* @__PURE__ */ union([
  1419. /* @__PURE__ */ string(),
  1420. /* @__PURE__ */ array(/* @__PURE__ */ string()),
  1421. /* @__PURE__ */ record(/* @__PURE__ */ string(), /* @__PURE__ */ string())
  1422. ]);
  1423. isTypeTrue();
  1424. const ExternalOptionFunctionSchema = /* @__PURE__ */ pipe(vFunction(), /* @__PURE__ */ args(/* @__PURE__ */ tuple([
  1425. /* @__PURE__ */ string(),
  1426. /* @__PURE__ */ optional(/* @__PURE__ */ string()),
  1427. /* @__PURE__ */ boolean()
  1428. ])), /* @__PURE__ */ returns(/* @__PURE__ */ nullish(/* @__PURE__ */ boolean())));
  1429. isTypeTrue();
  1430. const ExternalOptionSchema = /* @__PURE__ */ union([
  1431. StringOrRegExpSchema,
  1432. /* @__PURE__ */ array(StringOrRegExpSchema),
  1433. ExternalOptionFunctionSchema
  1434. ]);
  1435. isTypeTrue();
  1436. const ModuleTypesSchema = /* @__PURE__ */ record(/* @__PURE__ */ string(), /* @__PURE__ */ union([
  1437. /* @__PURE__ */ literal("asset"),
  1438. /* @__PURE__ */ literal("base64"),
  1439. /* @__PURE__ */ literal("binary"),
  1440. /* @__PURE__ */ literal("copy"),
  1441. /* @__PURE__ */ literal("css"),
  1442. /* @__PURE__ */ literal("dataurl"),
  1443. /* @__PURE__ */ literal("empty"),
  1444. /* @__PURE__ */ literal("js"),
  1445. /* @__PURE__ */ literal("json"),
  1446. /* @__PURE__ */ literal("jsx"),
  1447. /* @__PURE__ */ literal("text"),
  1448. /* @__PURE__ */ literal("ts"),
  1449. /* @__PURE__ */ literal("tsx")
  1450. ]));
  1451. isTypeTrue();
  1452. const JsxOptionsSchema = /* @__PURE__ */ strictObject({
  1453. runtime: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ union([/* @__PURE__ */ literal("classic"), /* @__PURE__ */ literal("automatic")])), /* @__PURE__ */ description("Which runtime to use")),
  1454. development: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Development specific information")),
  1455. throwIfNamespace: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Toggles whether to throw an error when a tag name uses an XML namespace")),
  1456. pure: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Mark JSX elements and top-level React method calls as pure for tree shaking.")),
  1457. importSource: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ string()), /* @__PURE__ */ description("Import the factory of element and fragment if mode is classic")),
  1458. pragma: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ string()), /* @__PURE__ */ description("Jsx element transformation")),
  1459. pragmaFrag: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ string()), /* @__PURE__ */ description("Jsx fragment transformation")),
  1460. refresh: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ union([/* @__PURE__ */ boolean(), /* @__PURE__ */ any()])), /* @__PURE__ */ description("Enable react fast refresh"))
  1461. });
  1462. isTypeTrue();
  1463. const HelperModeSchema = /* @__PURE__ */ union([/* @__PURE__ */ literal("Runtime"), /* @__PURE__ */ literal("External")]);
  1464. const DecoratorOptionSchema = /* @__PURE__ */ object({
  1465. legacy: /* @__PURE__ */ optional(/* @__PURE__ */ boolean()),
  1466. emitDecoratorMetadata: /* @__PURE__ */ optional(/* @__PURE__ */ boolean())
  1467. });
  1468. isTypeTrue();
  1469. const HelpersSchema = /* @__PURE__ */ object({ mode: /* @__PURE__ */ optional(HelperModeSchema) });
  1470. isTypeTrue();
  1471. const TypescriptSchema = /* @__PURE__ */ object({
  1472. jsxPragma: /* @__PURE__ */ optional(/* @__PURE__ */ string()),
  1473. jsxPragmaFrag: /* @__PURE__ */ optional(/* @__PURE__ */ string()),
  1474. onlyRemoveTypeImports: /* @__PURE__ */ optional(/* @__PURE__ */ boolean()),
  1475. allowNamespaces: /* @__PURE__ */ optional(/* @__PURE__ */ boolean()),
  1476. allowDeclareFields: /* @__PURE__ */ optional(/* @__PURE__ */ boolean()),
  1477. removeClassFieldsWithoutInitializer: /* @__PURE__ */ optional(/* @__PURE__ */ boolean()),
  1478. declaration: /* @__PURE__ */ optional(/* @__PURE__ */ object({
  1479. stripInternal: /* @__PURE__ */ optional(/* @__PURE__ */ boolean()),
  1480. sourcemap: /* @__PURE__ */ optional(/* @__PURE__ */ boolean())
  1481. })),
  1482. rewriteImportExtensions: /* @__PURE__ */ optional(/* @__PURE__ */ union([
  1483. /* @__PURE__ */ literal("rewrite"),
  1484. /* @__PURE__ */ literal("remove"),
  1485. /* @__PURE__ */ boolean()
  1486. ]))
  1487. });
  1488. isTypeTrue();
  1489. const AssumptionsSchema = /* @__PURE__ */ object({
  1490. ignoreFunctionLength: /* @__PURE__ */ optional(/* @__PURE__ */ boolean()),
  1491. noDocumentAll: /* @__PURE__ */ optional(/* @__PURE__ */ boolean()),
  1492. objectRestNoSymbols: /* @__PURE__ */ optional(/* @__PURE__ */ boolean()),
  1493. pureGetters: /* @__PURE__ */ optional(/* @__PURE__ */ boolean()),
  1494. setPublicClassFields: /* @__PURE__ */ optional(/* @__PURE__ */ boolean())
  1495. });
  1496. isTypeTrue();
  1497. const TransformPluginsSchema = /* @__PURE__ */ object({
  1498. styledComponents: /* @__PURE__ */ optional(/* @__PURE__ */ any()),
  1499. taggedTemplateEscape: /* @__PURE__ */ optional(/* @__PURE__ */ boolean())
  1500. });
  1501. isTypeTrue();
  1502. const TransformOptionsSchema = /* @__PURE__ */ object({
  1503. assumptions: /* @__PURE__ */ optional(AssumptionsSchema),
  1504. typescript: /* @__PURE__ */ optional(TypescriptSchema),
  1505. helpers: /* @__PURE__ */ optional(HelpersSchema),
  1506. decorator: /* @__PURE__ */ optional(DecoratorOptionSchema),
  1507. jsx: /* @__PURE__ */ optional(/* @__PURE__ */ union([
  1508. /* @__PURE__ */ literal(false),
  1509. /* @__PURE__ */ literal("preserve"),
  1510. /* @__PURE__ */ literal("react"),
  1511. /* @__PURE__ */ literal("react-jsx"),
  1512. JsxOptionsSchema
  1513. ])),
  1514. target: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ union([/* @__PURE__ */ string(), /* @__PURE__ */ array(/* @__PURE__ */ string())])), /* @__PURE__ */ description("The JavaScript target environment")),
  1515. define: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ record(/* @__PURE__ */ string(), /* @__PURE__ */ string())), /* @__PURE__ */ description("Define global variables (syntax: key:value,key2:value2)")),
  1516. inject: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ record(/* @__PURE__ */ string(), /* @__PURE__ */ union([/* @__PURE__ */ string(), /* @__PURE__ */ tuple([/* @__PURE__ */ string(), /* @__PURE__ */ string()])]))), /* @__PURE__ */ description("Inject import statements on demand")),
  1517. dropLabels: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ array(/* @__PURE__ */ string())), /* @__PURE__ */ description("Remove labeled statements with these label names")),
  1518. plugins: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(TransformPluginsSchema), /* @__PURE__ */ description("Third-party plugins to use"))
  1519. });
  1520. isTypeTrue();
  1521. const WatcherFileWatcherOptionsSchema = /* @__PURE__ */ strictObject({
  1522. usePolling: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Use polling-based file watching instead of native OS events")),
  1523. pollInterval: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ number()), /* @__PURE__ */ description("Poll interval in milliseconds (only used when usePolling is true)")),
  1524. compareContentsForPolling: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Compare file contents for poll-based watchers (only used when usePolling is true)")),
  1525. useDebounce: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Use debounced event delivery at the filesystem level")),
  1526. debounceDelay: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ number()), /* @__PURE__ */ description("Debounce delay in milliseconds (only used when useDebounce is true)")),
  1527. debounceTickRate: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ number()), /* @__PURE__ */ description("Tick rate in milliseconds for debouncer (only used when useDebounce is true)"))
  1528. });
  1529. const WatcherOptionsSchema = /* @__PURE__ */ strictObject({
  1530. chokidar: /* @__PURE__ */ optional(/* @__PURE__ */ never(`The "watch.chokidar" option is deprecated, please use "watch.watcher" instead of it`)),
  1531. exclude: /* @__PURE__ */ optional(/* @__PURE__ */ union([StringOrRegExpSchema, /* @__PURE__ */ array(StringOrRegExpSchema)])),
  1532. include: /* @__PURE__ */ optional(/* @__PURE__ */ union([StringOrRegExpSchema, /* @__PURE__ */ array(StringOrRegExpSchema)])),
  1533. watcher: /* @__PURE__ */ optional(WatcherFileWatcherOptionsSchema),
  1534. notify: /* @__PURE__ */ optional(WatcherFileWatcherOptionsSchema),
  1535. skipWrite: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Skip the bundle.write() step")),
  1536. buildDelay: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ number()), /* @__PURE__ */ description("Throttle watch rebuilds")),
  1537. clearScreen: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Whether to clear the screen when a rebuild is triggered")),
  1538. onInvalidate: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(vFunction()), /* @__PURE__ */ description("An optional function that will be called immediately every time a module changes that is part of the build."))
  1539. });
  1540. isTypeTrue();
  1541. const ChecksOptionsSchema = /* @__PURE__ */ strictObject({
  1542. circularDependency: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Whether to emit warnings when detecting circular dependency")),
  1543. eval: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Whether to emit warnings when detecting uses of direct `eval`s")),
  1544. missingGlobalName: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Whether to emit warnings when the `output.globals` option is missing when needed")),
  1545. missingNameOptionForIifeExport: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Whether to emit warnings when the `output.name` option is missing when needed")),
  1546. mixedExports: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Whether to emit warnings when the way to export values is ambiguous")),
  1547. unresolvedEntry: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Whether to emit warnings when an entrypoint cannot be resolved")),
  1548. unresolvedImport: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Whether to emit warnings when an import cannot be resolved")),
  1549. filenameConflict: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Whether to emit warnings when files generated have the same name with different contents")),
  1550. commonJsVariableInEsm: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Whether to emit warnings when a CommonJS variable is used in an ES module")),
  1551. importIsUndefined: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Whether to emit warnings when an imported variable is not exported")),
  1552. emptyImportMeta: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Whether to emit warnings when `import.meta` is not supported with the output format and is replaced with an empty object (`{}`)")),
  1553. toleratedTransform: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Whether to emit warnings when detecting tolerated transform")),
  1554. cannotCallNamespace: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Whether to emit warnings when a namespace is called as a function")),
  1555. configurationFieldConflict: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Whether to emit warnings when a config value is overridden by another config value with a higher priority")),
  1556. preferBuiltinFeature: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Whether to emit warnings when a plugin that is covered by a built-in feature is used")),
  1557. couldNotCleanDirectory: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Whether to emit warnings when Rolldown could not clean the output directory")),
  1558. pluginTimings: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Whether to emit warnings when plugins take significant time during the build process")),
  1559. duplicateShebang: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Whether to emit warnings when both the code and postBanner contain shebang")),
  1560. unsupportedTsconfigOption: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Whether to emit warnings when a tsconfig option or combination of options is not supported")),
  1561. ineffectiveDynamicImport: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Whether to emit warnings when a module is dynamically imported but also statically imported, making the dynamic import ineffective for code splitting"))
  1562. });
  1563. isTypeTrue();
  1564. const CompressOptionsKeepNamesSchema = /* @__PURE__ */ strictObject({
  1565. function: /* @__PURE__ */ boolean(),
  1566. class: /* @__PURE__ */ boolean()
  1567. });
  1568. isTypeTrue();
  1569. const CompressTreeshakeOptionsSchema = /* @__PURE__ */ strictObject({
  1570. annotations: /* @__PURE__ */ optional(/* @__PURE__ */ boolean()),
  1571. manualPureFunctions: /* @__PURE__ */ optional(/* @__PURE__ */ array(/* @__PURE__ */ string())),
  1572. propertyReadSideEffects: /* @__PURE__ */ optional(/* @__PURE__ */ union([/* @__PURE__ */ boolean(), /* @__PURE__ */ literal("always")])),
  1573. unknownGlobalSideEffects: /* @__PURE__ */ optional(/* @__PURE__ */ boolean()),
  1574. invalidImportSideEffects: /* @__PURE__ */ optional(/* @__PURE__ */ boolean())
  1575. });
  1576. isTypeTrue();
  1577. const CompressOptionsSchema = /* @__PURE__ */ strictObject({
  1578. target: /* @__PURE__ */ optional(/* @__PURE__ */ union([/* @__PURE__ */ string(), /* @__PURE__ */ array(/* @__PURE__ */ string())])),
  1579. dropConsole: /* @__PURE__ */ optional(/* @__PURE__ */ boolean()),
  1580. dropDebugger: /* @__PURE__ */ optional(/* @__PURE__ */ boolean()),
  1581. keepNames: /* @__PURE__ */ optional(CompressOptionsKeepNamesSchema),
  1582. unused: /* @__PURE__ */ optional(/* @__PURE__ */ union([/* @__PURE__ */ boolean(), /* @__PURE__ */ literal("keep_assign")])),
  1583. joinVars: /* @__PURE__ */ optional(/* @__PURE__ */ boolean()),
  1584. sequences: /* @__PURE__ */ optional(/* @__PURE__ */ boolean()),
  1585. dropLabels: /* @__PURE__ */ optional(/* @__PURE__ */ array(/* @__PURE__ */ string())),
  1586. maxIterations: /* @__PURE__ */ optional(/* @__PURE__ */ number()),
  1587. treeshake: /* @__PURE__ */ optional(CompressTreeshakeOptionsSchema)
  1588. });
  1589. isTypeTrue();
  1590. const MangleOptionsKeepNamesSchema = /* @__PURE__ */ strictObject({
  1591. function: /* @__PURE__ */ boolean(),
  1592. class: /* @__PURE__ */ boolean()
  1593. });
  1594. isTypeTrue();
  1595. const MangleOptionsSchema = /* @__PURE__ */ strictObject({
  1596. toplevel: /* @__PURE__ */ optional(/* @__PURE__ */ boolean()),
  1597. keepNames: /* @__PURE__ */ optional(/* @__PURE__ */ union([/* @__PURE__ */ boolean(), MangleOptionsKeepNamesSchema])),
  1598. debug: /* @__PURE__ */ optional(/* @__PURE__ */ boolean())
  1599. });
  1600. isTypeTrue();
  1601. const CodegenOptionsSchema = /* @__PURE__ */ strictObject({ removeWhitespace: /* @__PURE__ */ optional(/* @__PURE__ */ boolean()) });
  1602. isTypeTrue();
  1603. const MinifyOptionsSchema = /* @__PURE__ */ strictObject({
  1604. compress: /* @__PURE__ */ optional(/* @__PURE__ */ union([/* @__PURE__ */ boolean(), CompressOptionsSchema])),
  1605. mangle: /* @__PURE__ */ optional(/* @__PURE__ */ union([/* @__PURE__ */ boolean(), MangleOptionsSchema])),
  1606. codegen: /* @__PURE__ */ optional(/* @__PURE__ */ union([/* @__PURE__ */ boolean(), CodegenOptionsSchema]))
  1607. });
  1608. isTypeTrue();
  1609. const ResolveOptionsSchema = /* @__PURE__ */ strictObject({
  1610. alias: /* @__PURE__ */ optional(/* @__PURE__ */ record(/* @__PURE__ */ string(), /* @__PURE__ */ union([
  1611. /* @__PURE__ */ literal(false),
  1612. /* @__PURE__ */ string(),
  1613. /* @__PURE__ */ array(/* @__PURE__ */ string())
  1614. ]))),
  1615. aliasFields: /* @__PURE__ */ optional(/* @__PURE__ */ array(/* @__PURE__ */ array(/* @__PURE__ */ string()))),
  1616. conditionNames: /* @__PURE__ */ optional(/* @__PURE__ */ array(/* @__PURE__ */ string())),
  1617. extensionAlias: /* @__PURE__ */ optional(/* @__PURE__ */ record(/* @__PURE__ */ string(), /* @__PURE__ */ array(/* @__PURE__ */ string()))),
  1618. exportsFields: /* @__PURE__ */ optional(/* @__PURE__ */ array(/* @__PURE__ */ array(/* @__PURE__ */ string()))),
  1619. extensions: /* @__PURE__ */ optional(/* @__PURE__ */ array(/* @__PURE__ */ string())),
  1620. mainFields: /* @__PURE__ */ optional(/* @__PURE__ */ array(/* @__PURE__ */ string())),
  1621. mainFiles: /* @__PURE__ */ optional(/* @__PURE__ */ array(/* @__PURE__ */ string())),
  1622. modules: /* @__PURE__ */ optional(/* @__PURE__ */ array(/* @__PURE__ */ string())),
  1623. symlinks: /* @__PURE__ */ optional(/* @__PURE__ */ boolean()),
  1624. tsconfigFilename: /* @__PURE__ */ optional(/* @__PURE__ */ string())
  1625. });
  1626. isTypeTrue();
  1627. const TreeshakingOptionsSchema = /* @__PURE__ */ strictObject({
  1628. moduleSideEffects: /* @__PURE__ */ optional(/* @__PURE__ */ any()),
  1629. annotations: /* @__PURE__ */ optional(/* @__PURE__ */ boolean()),
  1630. manualPureFunctions: /* @__PURE__ */ optional(/* @__PURE__ */ custom((input) => /* @__PURE__ */ is(/* @__PURE__ */ array(/* @__PURE__ */ string()), input), "string array")),
  1631. unknownGlobalSideEffects: /* @__PURE__ */ optional(/* @__PURE__ */ boolean()),
  1632. invalidImportSideEffects: /* @__PURE__ */ optional(/* @__PURE__ */ boolean()),
  1633. commonjs: /* @__PURE__ */ optional(/* @__PURE__ */ boolean()),
  1634. propertyReadSideEffects: /* @__PURE__ */ optional(/* @__PURE__ */ union([/* @__PURE__ */ literal(false), /* @__PURE__ */ literal("always")])),
  1635. propertyWriteSideEffects: /* @__PURE__ */ optional(/* @__PURE__ */ union([/* @__PURE__ */ literal(false), /* @__PURE__ */ literal("always")]))
  1636. });
  1637. isTypeTrue();
  1638. const OptimizationOptionsSchema = /* @__PURE__ */ strictObject({
  1639. inlineConst: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ union([/* @__PURE__ */ boolean(), /* @__PURE__ */ strictObject({
  1640. mode: /* @__PURE__ */ optional(/* @__PURE__ */ union([/* @__PURE__ */ literal("all"), /* @__PURE__ */ literal("smart")])),
  1641. pass: /* @__PURE__ */ optional(/* @__PURE__ */ number())
  1642. })])), /* @__PURE__ */ description("Enable crossmodule constant inlining")),
  1643. pifeForModuleWrappers: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Use PIFE pattern for module wrappers"))
  1644. });
  1645. isTypeTrue();
  1646. const LogOrStringHandlerSchema = /* @__PURE__ */ pipe(vFunction(), /* @__PURE__ */ args(/* @__PURE__ */ tuple([LogLevelWithErrorSchema, RollupLogWithStringSchema])));
  1647. isTypeTrue();
  1648. const OnLogSchema = /* @__PURE__ */ pipe(vFunction(), /* @__PURE__ */ args(/* @__PURE__ */ tuple([
  1649. LogLevelSchema,
  1650. RollupLogSchema,
  1651. LogOrStringHandlerSchema
  1652. ])));
  1653. isTypeTrue();
  1654. const OnwarnSchema = /* @__PURE__ */ pipe(vFunction(), /* @__PURE__ */ args(/* @__PURE__ */ tuple([RollupLogSchema, /* @__PURE__ */ pipe(vFunction(), /* @__PURE__ */ args(/* @__PURE__ */ tuple([/* @__PURE__ */ union([RollupLogWithStringSchema, /* @__PURE__ */ pipe(vFunction(), /* @__PURE__ */ returns(RollupLogWithStringSchema))])])))])));
  1655. isTypeTrue();
  1656. const DevModeSchema = /* @__PURE__ */ union([/* @__PURE__ */ boolean(), /* @__PURE__ */ strictObject({
  1657. port: /* @__PURE__ */ optional(/* @__PURE__ */ number()),
  1658. host: /* @__PURE__ */ optional(/* @__PURE__ */ string()),
  1659. implement: /* @__PURE__ */ optional(/* @__PURE__ */ string()),
  1660. lazy: /* @__PURE__ */ optional(/* @__PURE__ */ boolean())
  1661. })]);
  1662. isTypeTrue();
  1663. const InputOptionsSchema = /* @__PURE__ */ strictObject({
  1664. input: /* @__PURE__ */ optional(InputOptionSchema),
  1665. plugins: /* @__PURE__ */ optional(/* @__PURE__ */ custom(() => true)),
  1666. external: /* @__PURE__ */ optional(ExternalOptionSchema),
  1667. makeAbsoluteExternalsRelative: /* @__PURE__ */ optional(/* @__PURE__ */ union([/* @__PURE__ */ boolean(), /* @__PURE__ */ literal("ifRelativeSource")])),
  1668. resolve: /* @__PURE__ */ optional(ResolveOptionsSchema),
  1669. cwd: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ string()), /* @__PURE__ */ description("Current working directory")),
  1670. platform: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ union([
  1671. /* @__PURE__ */ literal("browser"),
  1672. /* @__PURE__ */ literal("neutral"),
  1673. /* @__PURE__ */ literal("node")
  1674. ])), /* @__PURE__ */ description(`Platform for which the code should be generated (node, ${styleText$1("underline", "browser")}, neutral)`)),
  1675. shimMissingExports: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Create shim variables for missing exports")),
  1676. treeshake: /* @__PURE__ */ optional(/* @__PURE__ */ union([/* @__PURE__ */ boolean(), TreeshakingOptionsSchema])),
  1677. optimization: /* @__PURE__ */ optional(OptimizationOptionsSchema),
  1678. logLevel: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(LogLevelOptionSchema), /* @__PURE__ */ description(`Log level (${styleText$1("dim", "silent")}, ${styleText$1(["underline", "gray"], "info")}, debug, ${styleText$1("yellow", "warn")})`)),
  1679. onLog: /* @__PURE__ */ optional(OnLogSchema),
  1680. onwarn: /* @__PURE__ */ optional(OnwarnSchema),
  1681. moduleTypes: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(ModuleTypesSchema), /* @__PURE__ */ description("Module types for customized extensions")),
  1682. experimental: /* @__PURE__ */ optional(/* @__PURE__ */ strictObject({
  1683. viteMode: /* @__PURE__ */ optional(/* @__PURE__ */ boolean()),
  1684. resolveNewUrlToAsset: /* @__PURE__ */ optional(/* @__PURE__ */ boolean()),
  1685. devMode: /* @__PURE__ */ optional(DevModeSchema),
  1686. chunkModulesOrder: /* @__PURE__ */ optional(/* @__PURE__ */ union([/* @__PURE__ */ literal("module-id"), /* @__PURE__ */ literal("exec-order")])),
  1687. attachDebugInfo: /* @__PURE__ */ optional(/* @__PURE__ */ union([
  1688. /* @__PURE__ */ literal("none"),
  1689. /* @__PURE__ */ literal("simple"),
  1690. /* @__PURE__ */ literal("full")
  1691. ])),
  1692. chunkImportMap: /* @__PURE__ */ optional(/* @__PURE__ */ union([/* @__PURE__ */ boolean(), /* @__PURE__ */ object({
  1693. baseUrl: /* @__PURE__ */ optional(/* @__PURE__ */ string()),
  1694. fileName: /* @__PURE__ */ optional(/* @__PURE__ */ string())
  1695. })])),
  1696. onDemandWrapping: /* @__PURE__ */ optional(/* @__PURE__ */ boolean()),
  1697. incrementalBuild: /* @__PURE__ */ optional(/* @__PURE__ */ boolean()),
  1698. nativeMagicString: /* @__PURE__ */ optional(/* @__PURE__ */ boolean()),
  1699. chunkOptimization: /* @__PURE__ */ optional(/* @__PURE__ */ boolean()),
  1700. lazyBarrel: /* @__PURE__ */ optional(/* @__PURE__ */ boolean())
  1701. })),
  1702. transform: /* @__PURE__ */ optional(TransformOptionsSchema),
  1703. watch: /* @__PURE__ */ optional(/* @__PURE__ */ union([WatcherOptionsSchema, /* @__PURE__ */ literal(false)])),
  1704. checks: /* @__PURE__ */ optional(ChecksOptionsSchema),
  1705. devtools: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ object({ sessionId: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ string()), /* @__PURE__ */ description("Used to name the build.")) })), /* @__PURE__ */ description("Enable debug mode. Emit debug information to disk. This might slow down the build process significantly.")),
  1706. preserveEntrySignatures: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ union([
  1707. /* @__PURE__ */ literal("strict"),
  1708. /* @__PURE__ */ literal("allow-extension"),
  1709. /* @__PURE__ */ literal("exports-only"),
  1710. /* @__PURE__ */ literal(false)
  1711. ]))),
  1712. context: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ string()), /* @__PURE__ */ description("The value of `this` at the top level of each module.")),
  1713. tsconfig: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ union([/* @__PURE__ */ boolean(), /* @__PURE__ */ string()])), /* @__PURE__ */ description("Path to the tsconfig.json file."))
  1714. });
  1715. isTypeTrue();
  1716. const InputCliOverrideSchema = /* @__PURE__ */ strictObject({
  1717. input: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ array(/* @__PURE__ */ string())), /* @__PURE__ */ description("Entry file")),
  1718. external: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ array(/* @__PURE__ */ string())), /* @__PURE__ */ description("Comma-separated list of module ids to exclude from the bundle `<module-id>,...`")),
  1719. treeshake: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("enable treeshaking")),
  1720. makeAbsoluteExternalsRelative: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Prevent normalization of external imports")),
  1721. preserveEntrySignatures: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ literal(false)), /* @__PURE__ */ description("Avoid facade chunks for entry points")),
  1722. context: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ string()), /* @__PURE__ */ description("The entity top-level `this` represents."))
  1723. });
  1724. const InputCliOptionsSchema = /* @__PURE__ */ omit(/* @__PURE__ */ strictObject({
  1725. ...InputOptionsSchema.entries,
  1726. ...InputCliOverrideSchema.entries
  1727. }), [
  1728. "plugins",
  1729. "onwarn",
  1730. "onLog",
  1731. "resolve",
  1732. "experimental",
  1733. "watch"
  1734. ]);
  1735. const ModuleFormatSchema = /* @__PURE__ */ union([
  1736. /* @__PURE__ */ literal("es"),
  1737. /* @__PURE__ */ literal("cjs"),
  1738. /* @__PURE__ */ literal("esm"),
  1739. /* @__PURE__ */ literal("module"),
  1740. /* @__PURE__ */ literal("commonjs"),
  1741. /* @__PURE__ */ literal("iife"),
  1742. /* @__PURE__ */ literal("umd")
  1743. ]);
  1744. isTypeTrue();
  1745. const AddonFunctionSchema = /* @__PURE__ */ pipe(vFunction(), /* @__PURE__ */ args(/* @__PURE__ */ tuple([/* @__PURE__ */ custom(() => true)])), /* @__PURE__ */ returnsAsync(/* @__PURE__ */ unionAsync([/* @__PURE__ */ string(), /* @__PURE__ */ pipeAsync(/* @__PURE__ */ promise(), /* @__PURE__ */ awaitAsync(), /* @__PURE__ */ string())])));
  1746. isTypeTrue();
  1747. const ChunkFileNamesFunctionSchema = /* @__PURE__ */ pipe(vFunction(), /* @__PURE__ */ args(/* @__PURE__ */ tuple([/* @__PURE__ */ custom(() => true)])), /* @__PURE__ */ returns(/* @__PURE__ */ string()));
  1748. isTypeTrue();
  1749. const ChunkFileNamesSchema = /* @__PURE__ */ union([/* @__PURE__ */ string(), ChunkFileNamesFunctionSchema]);
  1750. const AssetFileNamesFunctionSchema = /* @__PURE__ */ pipe(vFunction(), /* @__PURE__ */ args(/* @__PURE__ */ tuple([/* @__PURE__ */ custom(() => true)])), /* @__PURE__ */ returns(/* @__PURE__ */ string()));
  1751. isTypeTrue();
  1752. const AssetFileNamesSchema = /* @__PURE__ */ union([/* @__PURE__ */ string(), AssetFileNamesFunctionSchema]);
  1753. const SanitizeFileNameFunctionSchema = /* @__PURE__ */ pipe(vFunction(), /* @__PURE__ */ args(/* @__PURE__ */ tuple([/* @__PURE__ */ string()])), /* @__PURE__ */ returns(/* @__PURE__ */ string()));
  1754. isTypeTrue();
  1755. const SanitizeFileNameSchema = /* @__PURE__ */ union([/* @__PURE__ */ boolean(), SanitizeFileNameFunctionSchema]);
  1756. const GlobalsFunctionSchema = /* @__PURE__ */ pipe(vFunction(), /* @__PURE__ */ args(/* @__PURE__ */ tuple([/* @__PURE__ */ string()])), /* @__PURE__ */ returns(/* @__PURE__ */ string()));
  1757. isTypeTrue();
  1758. const PathsFunctionSchema = /* @__PURE__ */ pipe(vFunction(), /* @__PURE__ */ args(/* @__PURE__ */ tuple([/* @__PURE__ */ string()])), /* @__PURE__ */ returns(/* @__PURE__ */ string()));
  1759. isTypeTrue();
  1760. const ManualChunksFunctionSchema = /* @__PURE__ */ pipe(vFunction(), /* @__PURE__ */ args(/* @__PURE__ */ tuple([/* @__PURE__ */ string(), /* @__PURE__ */ object({})])), /* @__PURE__ */ returns(/* @__PURE__ */ nullish(/* @__PURE__ */ string())));
  1761. isTypeTrue();
  1762. const AdvancedChunksNameFunctionSchema = /* @__PURE__ */ pipe(vFunction(), /* @__PURE__ */ args(/* @__PURE__ */ tuple([/* @__PURE__ */ string(), /* @__PURE__ */ object({})])), /* @__PURE__ */ returns(/* @__PURE__ */ nullish(/* @__PURE__ */ string())));
  1763. isTypeTrue();
  1764. const AdvancedChunksTestFunctionSchema = /* @__PURE__ */ pipe(vFunction(), /* @__PURE__ */ args(/* @__PURE__ */ tuple([/* @__PURE__ */ string()])), /* @__PURE__ */ returns(/* @__PURE__ */ union([
  1765. /* @__PURE__ */ boolean(),
  1766. /* @__PURE__ */ void_(),
  1767. /* @__PURE__ */ undefined_()
  1768. ])));
  1769. isTypeTrue();
  1770. const AdvancedChunksSchema = /* @__PURE__ */ strictObject({
  1771. includeDependenciesRecursively: /* @__PURE__ */ optional(/* @__PURE__ */ boolean()),
  1772. minSize: /* @__PURE__ */ optional(/* @__PURE__ */ number()),
  1773. maxSize: /* @__PURE__ */ optional(/* @__PURE__ */ number()),
  1774. minModuleSize: /* @__PURE__ */ optional(/* @__PURE__ */ number()),
  1775. maxModuleSize: /* @__PURE__ */ optional(/* @__PURE__ */ number()),
  1776. minShareCount: /* @__PURE__ */ optional(/* @__PURE__ */ number()),
  1777. groups: /* @__PURE__ */ optional(/* @__PURE__ */ array(/* @__PURE__ */ strictObject({
  1778. name: /* @__PURE__ */ union([/* @__PURE__ */ string(), AdvancedChunksNameFunctionSchema]),
  1779. test: /* @__PURE__ */ optional(/* @__PURE__ */ union([StringOrRegExpSchema, AdvancedChunksTestFunctionSchema])),
  1780. priority: /* @__PURE__ */ optional(/* @__PURE__ */ number()),
  1781. minSize: /* @__PURE__ */ optional(/* @__PURE__ */ number()),
  1782. minShareCount: /* @__PURE__ */ optional(/* @__PURE__ */ number()),
  1783. maxSize: /* @__PURE__ */ optional(/* @__PURE__ */ number()),
  1784. minModuleSize: /* @__PURE__ */ optional(/* @__PURE__ */ number()),
  1785. maxModuleSize: /* @__PURE__ */ optional(/* @__PURE__ */ number()),
  1786. entriesAware: /* @__PURE__ */ optional(/* @__PURE__ */ boolean()),
  1787. entriesAwareMergeThreshold: /* @__PURE__ */ optional(/* @__PURE__ */ number())
  1788. })))
  1789. });
  1790. isTypeTrue();
  1791. const GeneratedCodePresetSchema = /* @__PURE__ */ union([/* @__PURE__ */ literal("es5"), /* @__PURE__ */ literal("es2015")]);
  1792. isTypeTrue();
  1793. const GeneratedCodeOptionsSchema = /* @__PURE__ */ strictObject({
  1794. symbols: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Whether to use Symbol.toStringTag for namespace objects")),
  1795. preset: /* @__PURE__ */ optional(GeneratedCodePresetSchema),
  1796. profilerNames: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Whether to add readable names to internal variables for profiling purposes"))
  1797. });
  1798. isTypeTrue();
  1799. const OutputOptionsSchema = /* @__PURE__ */ strictObject({
  1800. dir: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ string()), /* @__PURE__ */ description("Output directory, defaults to `dist` if `file` is not set")),
  1801. file: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ string()), /* @__PURE__ */ description("Single output file")),
  1802. exports: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ union([
  1803. /* @__PURE__ */ literal("auto"),
  1804. /* @__PURE__ */ literal("named"),
  1805. /* @__PURE__ */ literal("default"),
  1806. /* @__PURE__ */ literal("none")
  1807. ])), /* @__PURE__ */ description(`Specify a export mode (${styleText$1("underline", "auto")}, named, default, none)`)),
  1808. hashCharacters: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ union([
  1809. /* @__PURE__ */ literal("base64"),
  1810. /* @__PURE__ */ literal("base36"),
  1811. /* @__PURE__ */ literal("hex")
  1812. ])), /* @__PURE__ */ description("Use the specified character set for file hashes")),
  1813. format: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(ModuleFormatSchema), /* @__PURE__ */ description(`Output format of the generated bundle (supports ${styleText$1("underline", "esm")}, cjs, and iife)`)),
  1814. sourcemap: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ union([
  1815. /* @__PURE__ */ boolean(),
  1816. /* @__PURE__ */ literal("inline"),
  1817. /* @__PURE__ */ literal("hidden")
  1818. ])), /* @__PURE__ */ description(`Generate sourcemap (\`-s inline\` for inline, or \`-s\` for \`.map\` file)`)),
  1819. sourcemapBaseUrl: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ string()), /* @__PURE__ */ description("Base URL used to prefix sourcemap paths")),
  1820. sourcemapDebugIds: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Inject sourcemap debug IDs")),
  1821. sourcemapIgnoreList: /* @__PURE__ */ optional(/* @__PURE__ */ union([
  1822. /* @__PURE__ */ boolean(),
  1823. /* @__PURE__ */ custom(() => true),
  1824. StringOrRegExpSchema
  1825. ])),
  1826. sourcemapPathTransform: /* @__PURE__ */ optional(/* @__PURE__ */ custom(() => true)),
  1827. banner: /* @__PURE__ */ optional(/* @__PURE__ */ union([/* @__PURE__ */ string(), AddonFunctionSchema])),
  1828. footer: /* @__PURE__ */ optional(/* @__PURE__ */ union([/* @__PURE__ */ string(), AddonFunctionSchema])),
  1829. postBanner: /* @__PURE__ */ optional(/* @__PURE__ */ union([/* @__PURE__ */ string(), AddonFunctionSchema])),
  1830. postFooter: /* @__PURE__ */ optional(/* @__PURE__ */ union([/* @__PURE__ */ string(), AddonFunctionSchema])),
  1831. intro: /* @__PURE__ */ optional(/* @__PURE__ */ union([/* @__PURE__ */ string(), AddonFunctionSchema])),
  1832. outro: /* @__PURE__ */ optional(/* @__PURE__ */ union([/* @__PURE__ */ string(), AddonFunctionSchema])),
  1833. extend: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Extend global variable defined by name in IIFE / UMD formats")),
  1834. esModule: /* @__PURE__ */ optional(/* @__PURE__ */ union([/* @__PURE__ */ boolean(), /* @__PURE__ */ literal("if-default-prop")])),
  1835. assetFileNames: /* @__PURE__ */ optional(AssetFileNamesSchema),
  1836. entryFileNames: /* @__PURE__ */ optional(ChunkFileNamesSchema),
  1837. chunkFileNames: /* @__PURE__ */ optional(ChunkFileNamesSchema),
  1838. sanitizeFileName: /* @__PURE__ */ optional(SanitizeFileNameSchema),
  1839. minify: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ union([
  1840. /* @__PURE__ */ boolean(),
  1841. /* @__PURE__ */ literal("dce-only"),
  1842. MinifyOptionsSchema
  1843. ])), /* @__PURE__ */ description("Minify the bundled file")),
  1844. name: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ string()), /* @__PURE__ */ description("Name for UMD / IIFE format outputs")),
  1845. globals: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ union([/* @__PURE__ */ record(/* @__PURE__ */ string(), /* @__PURE__ */ string()), GlobalsFunctionSchema])), /* @__PURE__ */ description("Global variable of UMD / IIFE dependencies (syntax: `key:value`)")),
  1846. paths: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ union([/* @__PURE__ */ record(/* @__PURE__ */ string(), /* @__PURE__ */ string()), PathsFunctionSchema])), /* @__PURE__ */ description("Maps external module IDs to paths")),
  1847. generatedCode: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ partial(GeneratedCodeOptionsSchema)), /* @__PURE__ */ description("Generated code options")),
  1848. externalLiveBindings: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("external live bindings")),
  1849. inlineDynamicImports: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Inline dynamic imports")),
  1850. dynamicImportInCjs: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Dynamic import in CJS output")),
  1851. manualChunks: /* @__PURE__ */ optional(ManualChunksFunctionSchema),
  1852. codeSplitting: /* @__PURE__ */ optional(/* @__PURE__ */ union([/* @__PURE__ */ boolean(), AdvancedChunksSchema])),
  1853. advancedChunks: /* @__PURE__ */ optional(AdvancedChunksSchema),
  1854. legalComments: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ union([/* @__PURE__ */ literal("none"), /* @__PURE__ */ literal("inline")])), /* @__PURE__ */ description("Control legal comments in the output")),
  1855. comments: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ union([/* @__PURE__ */ boolean(), /* @__PURE__ */ strictObject({
  1856. legal: /* @__PURE__ */ optional(/* @__PURE__ */ boolean()),
  1857. annotation: /* @__PURE__ */ optional(/* @__PURE__ */ boolean()),
  1858. jsdoc: /* @__PURE__ */ optional(/* @__PURE__ */ boolean())
  1859. })])), /* @__PURE__ */ description("Control comments in the output")),
  1860. plugins: /* @__PURE__ */ optional(/* @__PURE__ */ custom(() => true)),
  1861. polyfillRequire: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Disable require polyfill injection")),
  1862. hoistTransitiveImports: /* @__PURE__ */ optional(/* @__PURE__ */ literal(false)),
  1863. preserveModules: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Preserve module structure")),
  1864. preserveModulesRoot: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ string()), /* @__PURE__ */ description("Put preserved modules under this path at root level")),
  1865. virtualDirname: /* @__PURE__ */ optional(/* @__PURE__ */ string()),
  1866. minifyInternalExports: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Minify internal exports")),
  1867. topLevelVar: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Rewrite top-level declarations to use `var`.")),
  1868. cleanDir: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Clean output directory before emitting output")),
  1869. keepNames: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Keep function and class names after bundling")),
  1870. strictExecutionOrder: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Lets modules be executed in the order they are declared.")),
  1871. strict: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ union([/* @__PURE__ */ boolean(), /* @__PURE__ */ literal("auto")])), /* @__PURE__ */ description("Whether to always output `\"use strict\"` directive in non-ES module outputs."))
  1872. });
  1873. isTypeTrue();
  1874. const getAddonDescription = (placement, wrapper) => {
  1875. return `Code to insert the ${styleText$1("bold", placement)} of the bundled file (${styleText$1("bold", wrapper)} the wrapper function)`;
  1876. };
  1877. const OutputCliOverrideSchema = /* @__PURE__ */ strictObject({
  1878. assetFileNames: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ string()), /* @__PURE__ */ description("Name pattern for asset files")),
  1879. entryFileNames: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ string()), /* @__PURE__ */ description("Name pattern for emitted entry chunks")),
  1880. chunkFileNames: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ string()), /* @__PURE__ */ description("Name pattern for emitted secondary chunks")),
  1881. sanitizeFileName: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Sanitize file name")),
  1882. banner: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ string()), /* @__PURE__ */ description(getAddonDescription("top", "outside"))),
  1883. footer: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ string()), /* @__PURE__ */ description(getAddonDescription("bottom", "outside"))),
  1884. postBanner: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ string()), /* @__PURE__ */ description("A string to prepend to the top of each chunk. Applied after the `renderChunk` hook and minification")),
  1885. postFooter: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ string()), /* @__PURE__ */ description("A string to append to the bottom of each chunk. Applied after the `renderChunk` hook and minification")),
  1886. intro: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ string()), /* @__PURE__ */ description(getAddonDescription("top", "inside"))),
  1887. outro: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ string()), /* @__PURE__ */ description(getAddonDescription("bottom", "inside"))),
  1888. esModule: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Always generate `__esModule` marks in non-ESM formats, defaults to `if-default-prop` (use `--no-esModule` to always disable)")),
  1889. globals: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ record(/* @__PURE__ */ string(), /* @__PURE__ */ string())), /* @__PURE__ */ description("Global variable of UMD / IIFE dependencies (syntax: `key:value`)")),
  1890. codeSplitting: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ union([/* @__PURE__ */ boolean(), /* @__PURE__ */ strictObject({
  1891. minSize: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ number()), /* @__PURE__ */ description("Minimum size of the chunk")),
  1892. minShareCount: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ number()), /* @__PURE__ */ description("Minimum share count of the chunk"))
  1893. })])), /* @__PURE__ */ description("Code splitting options (true, false, or object)")),
  1894. advancedChunks: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ strictObject({
  1895. minSize: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ number()), /* @__PURE__ */ description("Minimum size of the chunk")),
  1896. minShareCount: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ number()), /* @__PURE__ */ description("Minimum share count of the chunk"))
  1897. })), /* @__PURE__ */ description("Deprecated: use codeSplitting instead")),
  1898. minify: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Minify the bundled file"))
  1899. });
  1900. const OutputCliOptionsSchema = /* @__PURE__ */ omit(/* @__PURE__ */ strictObject({
  1901. ...OutputOptionsSchema.entries,
  1902. ...OutputCliOverrideSchema.entries
  1903. }), [
  1904. "sourcemapIgnoreList",
  1905. "sourcemapPathTransform",
  1906. "plugins",
  1907. "hoistTransitiveImports"
  1908. ]);
  1909. const CliOptionsSchema = /* @__PURE__ */ strictObject({
  1910. config: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ union([/* @__PURE__ */ string(), /* @__PURE__ */ boolean()])), /* @__PURE__ */ description("Path to the config file (default: `rolldown.config.js`)")),
  1911. help: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Show help")),
  1912. environment: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ union([/* @__PURE__ */ string(), /* @__PURE__ */ array(/* @__PURE__ */ string())])), /* @__PURE__ */ description("Pass additional settings to the config file via process.ENV.")),
  1913. version: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Show version number")),
  1914. watch: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Watch files in bundle and rebuild on changes")),
  1915. ...InputCliOptionsSchema.entries,
  1916. ...OutputCliOptionsSchema.entries
  1917. });
  1918. function validateCliOptions(options) {
  1919. let parsed = /* @__PURE__ */ safeParse(CliOptionsSchema, options);
  1920. return [parsed.output, parsed.issues?.map((issue) => {
  1921. return `Invalid value for option ${issue.path?.map((pathItem) => pathItem.key).join(" ")}: ${issue.message}`;
  1922. })];
  1923. }
  1924. const inputHelperMsgRecord = {
  1925. output: { ignored: true },
  1926. "resolve.tsconfigFilename": { issueMsg: "It is deprecated. Please use the top-level `tsconfig` option instead." }
  1927. };
  1928. const outputHelperMsgRecord = {};
  1929. function validateOption(key, options) {
  1930. if (typeof options !== "object") throw new Error(`Invalid ${key} options. Expected an Object but received ${JSON.stringify(options)}.`);
  1931. if (globalThis.process?.env?.ROLLUP_TEST) return;
  1932. let parsed = /* @__PURE__ */ safeParse(key === "input" ? InputOptionsSchema : OutputOptionsSchema, options);
  1933. if (!parsed.success) {
  1934. const errors = parsed.issues.map((issue) => {
  1935. let issueMsg = issue.message;
  1936. const issuePaths = issue.path.map((path) => path.key);
  1937. if (issue.type === "union") {
  1938. const subIssue = issue.issues?.find((i) => !(i.type !== issue.received && i.input === issue.input));
  1939. if (subIssue) {
  1940. if (subIssue.path) issuePaths.push(subIssue.path.map((path) => path.key));
  1941. issueMsg = subIssue.message;
  1942. }
  1943. }
  1944. const stringPath = issuePaths.join(".");
  1945. const helper = key === "input" ? inputHelperMsgRecord[stringPath] : outputHelperMsgRecord[stringPath];
  1946. if (helper && helper.ignored) return "";
  1947. return `- For the "${stringPath}". ${helper?.issueMsg || issueMsg + "."} ${helper?.help ? `\n Help: ${helper.help}` : ""}`;
  1948. }).filter(Boolean);
  1949. if (errors.length) console.warn(`\x1b[33mWarning: Invalid ${key} options (${errors.length} issue${errors.length === 1 ? "" : "s"} found)\n${errors.join("\n")}\x1b[0m`);
  1950. }
  1951. }
  1952. function getInputCliKeys() {
  1953. return (/* @__PURE__ */ keyof(InputCliOptionsSchema)).options;
  1954. }
  1955. function getOutputCliKeys() {
  1956. return (/* @__PURE__ */ keyof(OutputCliOptionsSchema)).options;
  1957. }
  1958. function getCliSchemaInfo() {
  1959. return flattenValibotSchema(CliOptionsSchema);
  1960. }
  1961. //#endregion
  1962. //#region src/types/rolldown-output-impl.ts
  1963. var RolldownOutputImpl = class extends PlainObjectLike {
  1964. constructor(bindingOutputs) {
  1965. super();
  1966. this.bindingOutputs = bindingOutputs;
  1967. }
  1968. get output() {
  1969. return transformToRollupOutput(this.bindingOutputs).output;
  1970. }
  1971. __rolldown_external_memory_handle__(keepDataAlive) {
  1972. const results = this.output.map((item) => item.__rolldown_external_memory_handle__(keepDataAlive));
  1973. if (!results.every((r) => r.freed)) {
  1974. const reasons = results.filter((r) => !r.freed).map((r) => r.reason).filter(Boolean);
  1975. return {
  1976. freed: false,
  1977. reason: `Failed to free ${reasons.length} item(s): ${reasons.join("; ")}`
  1978. };
  1979. }
  1980. return { freed: true };
  1981. }
  1982. };
  1983. __decorate([lazyProp], RolldownOutputImpl.prototype, "output", null);
  1984. //#endregion
  1985. //#region src/types/chunking-context.ts
  1986. var ChunkingContextImpl = class {
  1987. constructor(context) {
  1988. this.context = context;
  1989. }
  1990. getModuleInfo(moduleId) {
  1991. const bindingInfo = this.context.getModuleInfo(moduleId);
  1992. if (bindingInfo) return transformModuleInfo(bindingInfo, {
  1993. moduleSideEffects: null,
  1994. meta: {}
  1995. });
  1996. return null;
  1997. }
  1998. };
  1999. //#endregion
  2000. //#region ../../node_modules/.pnpm/consola@3.4.2/node_modules/consola/dist/core.mjs
  2001. const LogLevels = {
  2002. silent: Number.NEGATIVE_INFINITY,
  2003. fatal: 0,
  2004. error: 0,
  2005. warn: 1,
  2006. log: 2,
  2007. info: 3,
  2008. success: 3,
  2009. fail: 3,
  2010. ready: 3,
  2011. start: 3,
  2012. box: 3,
  2013. debug: 4,
  2014. trace: 5,
  2015. verbose: Number.POSITIVE_INFINITY
  2016. };
  2017. const LogTypes = {
  2018. silent: { level: -1 },
  2019. fatal: { level: LogLevels.fatal },
  2020. error: { level: LogLevels.error },
  2021. warn: { level: LogLevels.warn },
  2022. log: { level: LogLevels.log },
  2023. info: { level: LogLevels.info },
  2024. success: { level: LogLevels.success },
  2025. fail: { level: LogLevels.fail },
  2026. ready: { level: LogLevels.info },
  2027. start: { level: LogLevels.info },
  2028. box: { level: LogLevels.info },
  2029. debug: { level: LogLevels.debug },
  2030. trace: { level: LogLevels.trace },
  2031. verbose: { level: LogLevels.verbose }
  2032. };
  2033. function isPlainObject$1(value) {
  2034. if (value === null || typeof value !== "object") return false;
  2035. const prototype = Object.getPrototypeOf(value);
  2036. if (prototype !== null && prototype !== Object.prototype && Object.getPrototypeOf(prototype) !== null) return false;
  2037. if (Symbol.iterator in value) return false;
  2038. if (Symbol.toStringTag in value) return Object.prototype.toString.call(value) === "[object Module]";
  2039. return true;
  2040. }
  2041. function _defu(baseObject, defaults, namespace = ".", merger) {
  2042. if (!isPlainObject$1(defaults)) return _defu(baseObject, {}, namespace, merger);
  2043. const object = Object.assign({}, defaults);
  2044. for (const key in baseObject) {
  2045. if (key === "__proto__" || key === "constructor") continue;
  2046. const value = baseObject[key];
  2047. if (value === null || value === void 0) continue;
  2048. if (merger && merger(object, key, value, namespace)) continue;
  2049. if (Array.isArray(value) && Array.isArray(object[key])) object[key] = [...value, ...object[key]];
  2050. else if (isPlainObject$1(value) && isPlainObject$1(object[key])) object[key] = _defu(value, object[key], (namespace ? `${namespace}.` : "") + key.toString(), merger);
  2051. else object[key] = value;
  2052. }
  2053. return object;
  2054. }
  2055. function createDefu(merger) {
  2056. return (...arguments_) => arguments_.reduce((p, c) => _defu(p, c, "", merger), {});
  2057. }
  2058. const defu = createDefu();
  2059. function isPlainObject(obj) {
  2060. return Object.prototype.toString.call(obj) === "[object Object]";
  2061. }
  2062. function isLogObj(arg) {
  2063. if (!isPlainObject(arg)) return false;
  2064. if (!arg.message && !arg.args) return false;
  2065. if (arg.stack) return false;
  2066. return true;
  2067. }
  2068. let paused = false;
  2069. const queue = [];
  2070. var Consola = class Consola {
  2071. options;
  2072. _lastLog;
  2073. _mockFn;
  2074. /**
  2075. * Creates an instance of Consola with specified options or defaults.
  2076. *
  2077. * @param {Partial<ConsolaOptions>} [options={}] - Configuration options for the Consola instance.
  2078. */
  2079. constructor(options = {}) {
  2080. const types = options.types || LogTypes;
  2081. this.options = defu({
  2082. ...options,
  2083. defaults: { ...options.defaults },
  2084. level: _normalizeLogLevel(options.level, types),
  2085. reporters: [...options.reporters || []]
  2086. }, {
  2087. types: LogTypes,
  2088. throttle: 1e3,
  2089. throttleMin: 5,
  2090. formatOptions: {
  2091. date: true,
  2092. colors: false,
  2093. compact: true
  2094. }
  2095. });
  2096. for (const type in types) {
  2097. const defaults = {
  2098. type,
  2099. ...this.options.defaults,
  2100. ...types[type]
  2101. };
  2102. this[type] = this._wrapLogFn(defaults);
  2103. this[type].raw = this._wrapLogFn(defaults, true);
  2104. }
  2105. if (this.options.mockFn) this.mockTypes();
  2106. this._lastLog = {};
  2107. }
  2108. /**
  2109. * Gets the current log level of the Consola instance.
  2110. *
  2111. * @returns {number} The current log level.
  2112. */
  2113. get level() {
  2114. return this.options.level;
  2115. }
  2116. /**
  2117. * Sets the minimum log level that will be output by the instance.
  2118. *
  2119. * @param {number} level - The new log level to set.
  2120. */
  2121. set level(level) {
  2122. this.options.level = _normalizeLogLevel(level, this.options.types, this.options.level);
  2123. }
  2124. /**
  2125. * Displays a prompt to the user and returns the response.
  2126. * Throw an error if `prompt` is not supported by the current configuration.
  2127. *
  2128. * @template T
  2129. * @param {string} message - The message to display in the prompt.
  2130. * @param {T} [opts] - Optional options for the prompt. See {@link PromptOptions}.
  2131. * @returns {promise<T>} A promise that infer with the prompt options. See {@link PromptOptions}.
  2132. */
  2133. prompt(message, opts) {
  2134. if (!this.options.prompt) throw new Error("prompt is not supported!");
  2135. return this.options.prompt(message, opts);
  2136. }
  2137. /**
  2138. * Creates a new instance of Consola, inheriting options from the current instance, with possible overrides.
  2139. *
  2140. * @param {Partial<ConsolaOptions>} options - Optional overrides for the new instance. See {@link ConsolaOptions}.
  2141. * @returns {ConsolaInstance} A new Consola instance. See {@link ConsolaInstance}.
  2142. */
  2143. create(options) {
  2144. const instance = new Consola({
  2145. ...this.options,
  2146. ...options
  2147. });
  2148. if (this._mockFn) instance.mockTypes(this._mockFn);
  2149. return instance;
  2150. }
  2151. /**
  2152. * Creates a new Consola instance with the specified default log object properties.
  2153. *
  2154. * @param {InputLogObject} defaults - Default properties to include in any log from the new instance. See {@link InputLogObject}.
  2155. * @returns {ConsolaInstance} A new Consola instance. See {@link ConsolaInstance}.
  2156. */
  2157. withDefaults(defaults) {
  2158. return this.create({
  2159. ...this.options,
  2160. defaults: {
  2161. ...this.options.defaults,
  2162. ...defaults
  2163. }
  2164. });
  2165. }
  2166. /**
  2167. * Creates a new Consola instance with a specified tag, which will be included in every log.
  2168. *
  2169. * @param {string} tag - The tag to include in each log of the new instance.
  2170. * @returns {ConsolaInstance} A new Consola instance. See {@link ConsolaInstance}.
  2171. */
  2172. withTag(tag) {
  2173. return this.withDefaults({ tag: this.options.defaults.tag ? this.options.defaults.tag + ":" + tag : tag });
  2174. }
  2175. /**
  2176. * Adds a custom reporter to the Consola instance.
  2177. * Reporters will be called for each log message, depending on their implementation and log level.
  2178. *
  2179. * @param {ConsolaReporter} reporter - The reporter to add. See {@link ConsolaReporter}.
  2180. * @returns {Consola} The current Consola instance.
  2181. */
  2182. addReporter(reporter) {
  2183. this.options.reporters.push(reporter);
  2184. return this;
  2185. }
  2186. /**
  2187. * Removes a custom reporter from the Consola instance.
  2188. * If no reporter is specified, all reporters will be removed.
  2189. *
  2190. * @param {ConsolaReporter} reporter - The reporter to remove. See {@link ConsolaReporter}.
  2191. * @returns {Consola} The current Consola instance.
  2192. */
  2193. removeReporter(reporter) {
  2194. if (reporter) {
  2195. const i = this.options.reporters.indexOf(reporter);
  2196. if (i !== -1) return this.options.reporters.splice(i, 1);
  2197. } else this.options.reporters.splice(0);
  2198. return this;
  2199. }
  2200. /**
  2201. * Replaces all reporters of the Consola instance with the specified array of reporters.
  2202. *
  2203. * @param {ConsolaReporter[]} reporters - The new reporters to set. See {@link ConsolaReporter}.
  2204. * @returns {Consola} The current Consola instance.
  2205. */
  2206. setReporters(reporters) {
  2207. this.options.reporters = Array.isArray(reporters) ? reporters : [reporters];
  2208. return this;
  2209. }
  2210. wrapAll() {
  2211. this.wrapConsole();
  2212. this.wrapStd();
  2213. }
  2214. restoreAll() {
  2215. this.restoreConsole();
  2216. this.restoreStd();
  2217. }
  2218. /**
  2219. * Overrides console methods with Consola logging methods for consistent logging.
  2220. */
  2221. wrapConsole() {
  2222. for (const type in this.options.types) {
  2223. if (!console["__" + type]) console["__" + type] = console[type];
  2224. console[type] = this[type].raw;
  2225. }
  2226. }
  2227. /**
  2228. * Restores the original console methods, removing Consola overrides.
  2229. */
  2230. restoreConsole() {
  2231. for (const type in this.options.types) if (console["__" + type]) {
  2232. console[type] = console["__" + type];
  2233. delete console["__" + type];
  2234. }
  2235. }
  2236. /**
  2237. * Overrides standard output and error streams to redirect them through Consola.
  2238. */
  2239. wrapStd() {
  2240. this._wrapStream(this.options.stdout, "log");
  2241. this._wrapStream(this.options.stderr, "log");
  2242. }
  2243. _wrapStream(stream, type) {
  2244. if (!stream) return;
  2245. if (!stream.__write) stream.__write = stream.write;
  2246. stream.write = (data) => {
  2247. this[type].raw(String(data).trim());
  2248. };
  2249. }
  2250. /**
  2251. * Restores the original standard output and error streams, removing the Consola redirection.
  2252. */
  2253. restoreStd() {
  2254. this._restoreStream(this.options.stdout);
  2255. this._restoreStream(this.options.stderr);
  2256. }
  2257. _restoreStream(stream) {
  2258. if (!stream) return;
  2259. if (stream.__write) {
  2260. stream.write = stream.__write;
  2261. delete stream.__write;
  2262. }
  2263. }
  2264. /**
  2265. * Pauses logging, queues incoming logs until resumed.
  2266. */
  2267. pauseLogs() {
  2268. paused = true;
  2269. }
  2270. /**
  2271. * Resumes logging, processing any queued logs.
  2272. */
  2273. resumeLogs() {
  2274. paused = false;
  2275. const _queue = queue.splice(0);
  2276. for (const item of _queue) item[0]._logFn(item[1], item[2]);
  2277. }
  2278. /**
  2279. * Replaces logging methods with mocks if a mock function is provided.
  2280. *
  2281. * @param {ConsolaOptions["mockFn"]} mockFn - The function to use for mocking logging methods. See {@link ConsolaOptions["mockFn"]}.
  2282. */
  2283. mockTypes(mockFn) {
  2284. const _mockFn = mockFn || this.options.mockFn;
  2285. this._mockFn = _mockFn;
  2286. if (typeof _mockFn !== "function") return;
  2287. for (const type in this.options.types) {
  2288. this[type] = _mockFn(type, this.options.types[type]) || this[type];
  2289. this[type].raw = this[type];
  2290. }
  2291. }
  2292. _wrapLogFn(defaults, isRaw) {
  2293. return (...args) => {
  2294. if (paused) {
  2295. queue.push([
  2296. this,
  2297. defaults,
  2298. args,
  2299. isRaw
  2300. ]);
  2301. return;
  2302. }
  2303. return this._logFn(defaults, args, isRaw);
  2304. };
  2305. }
  2306. _logFn(defaults, args, isRaw) {
  2307. if ((defaults.level || 0) > this.level) return false;
  2308. const logObj = {
  2309. date: /* @__PURE__ */ new Date(),
  2310. args: [],
  2311. ...defaults,
  2312. level: _normalizeLogLevel(defaults.level, this.options.types)
  2313. };
  2314. if (!isRaw && args.length === 1 && isLogObj(args[0])) Object.assign(logObj, args[0]);
  2315. else logObj.args = [...args];
  2316. if (logObj.message) {
  2317. logObj.args.unshift(logObj.message);
  2318. delete logObj.message;
  2319. }
  2320. if (logObj.additional) {
  2321. if (!Array.isArray(logObj.additional)) logObj.additional = logObj.additional.split("\n");
  2322. logObj.args.push("\n" + logObj.additional.join("\n"));
  2323. delete logObj.additional;
  2324. }
  2325. logObj.type = typeof logObj.type === "string" ? logObj.type.toLowerCase() : "log";
  2326. logObj.tag = typeof logObj.tag === "string" ? logObj.tag : "";
  2327. const resolveLog = (newLog = false) => {
  2328. const repeated = (this._lastLog.count || 0) - this.options.throttleMin;
  2329. if (this._lastLog.object && repeated > 0) {
  2330. const args2 = [...this._lastLog.object.args];
  2331. if (repeated > 1) args2.push(`(repeated ${repeated} times)`);
  2332. this._log({
  2333. ...this._lastLog.object,
  2334. args: args2
  2335. });
  2336. this._lastLog.count = 1;
  2337. }
  2338. if (newLog) {
  2339. this._lastLog.object = logObj;
  2340. this._log(logObj);
  2341. }
  2342. };
  2343. clearTimeout(this._lastLog.timeout);
  2344. const diffTime = this._lastLog.time && logObj.date ? logObj.date.getTime() - this._lastLog.time.getTime() : 0;
  2345. this._lastLog.time = logObj.date;
  2346. if (diffTime < this.options.throttle) try {
  2347. const serializedLog = JSON.stringify([
  2348. logObj.type,
  2349. logObj.tag,
  2350. logObj.args
  2351. ]);
  2352. const isSameLog = this._lastLog.serialized === serializedLog;
  2353. this._lastLog.serialized = serializedLog;
  2354. if (isSameLog) {
  2355. this._lastLog.count = (this._lastLog.count || 0) + 1;
  2356. if (this._lastLog.count > this.options.throttleMin) {
  2357. this._lastLog.timeout = setTimeout(resolveLog, this.options.throttle);
  2358. return;
  2359. }
  2360. }
  2361. } catch {}
  2362. resolveLog(true);
  2363. }
  2364. _log(logObj) {
  2365. for (const reporter of this.options.reporters) reporter.log(logObj, { options: this.options });
  2366. }
  2367. };
  2368. function _normalizeLogLevel(input, types = {}, defaultLevel = 3) {
  2369. if (input === void 0) return defaultLevel;
  2370. if (typeof input === "number") return input;
  2371. if (types[input] && types[input].level !== void 0) return types[input].level;
  2372. return defaultLevel;
  2373. }
  2374. Consola.prototype.add = Consola.prototype.addReporter;
  2375. Consola.prototype.remove = Consola.prototype.removeReporter;
  2376. Consola.prototype.clear = Consola.prototype.removeReporter;
  2377. Consola.prototype.withScope = Consola.prototype.withTag;
  2378. Consola.prototype.mock = Consola.prototype.mockTypes;
  2379. Consola.prototype.pause = Consola.prototype.pauseLogs;
  2380. Consola.prototype.resume = Consola.prototype.resumeLogs;
  2381. function createConsola$1(options = {}) {
  2382. return new Consola(options);
  2383. }
  2384. //#endregion
  2385. //#region ../../node_modules/.pnpm/consola@3.4.2/node_modules/consola/dist/shared/consola.DRwqZj3T.mjs
  2386. function parseStack(stack, message) {
  2387. const cwd = process.cwd() + sep;
  2388. return stack.split("\n").splice(message.split("\n").length).map((l) => l.trim().replace("file://", "").replace(cwd, ""));
  2389. }
  2390. function writeStream(data, stream) {
  2391. return (stream.__write || stream.write).call(stream, data);
  2392. }
  2393. const bracket = (x) => x ? `[${x}]` : "";
  2394. var BasicReporter = class {
  2395. formatStack(stack, message, opts) {
  2396. const indent = " ".repeat((opts?.errorLevel || 0) + 1);
  2397. return indent + parseStack(stack, message).join(`
  2398. ${indent}`);
  2399. }
  2400. formatError(err, opts) {
  2401. const message = err.message ?? formatWithOptions(opts, err);
  2402. const stack = err.stack ? this.formatStack(err.stack, message, opts) : "";
  2403. const level = opts?.errorLevel || 0;
  2404. const causedPrefix = level > 0 ? `${" ".repeat(level)}[cause]: ` : "";
  2405. const causedError = err.cause ? "\n\n" + this.formatError(err.cause, {
  2406. ...opts,
  2407. errorLevel: level + 1
  2408. }) : "";
  2409. return causedPrefix + message + "\n" + stack + causedError;
  2410. }
  2411. formatArgs(args, opts) {
  2412. return formatWithOptions(opts, ...args.map((arg) => {
  2413. if (arg && typeof arg.stack === "string") return this.formatError(arg, opts);
  2414. return arg;
  2415. }));
  2416. }
  2417. formatDate(date, opts) {
  2418. return opts.date ? date.toLocaleTimeString() : "";
  2419. }
  2420. filterAndJoin(arr) {
  2421. return arr.filter(Boolean).join(" ");
  2422. }
  2423. formatLogObj(logObj, opts) {
  2424. const message = this.formatArgs(logObj.args, opts);
  2425. if (logObj.type === "box") return "\n" + [
  2426. bracket(logObj.tag),
  2427. logObj.title && logObj.title,
  2428. ...message.split("\n")
  2429. ].filter(Boolean).map((l) => " > " + l).join("\n") + "\n";
  2430. return this.filterAndJoin([
  2431. bracket(logObj.type),
  2432. bracket(logObj.tag),
  2433. message
  2434. ]);
  2435. }
  2436. log(logObj, ctx) {
  2437. return writeStream(this.formatLogObj(logObj, {
  2438. columns: ctx.options.stdout.columns || 0,
  2439. ...ctx.options.formatOptions
  2440. }) + "\n", logObj.level < 2 ? ctx.options.stderr || process.stderr : ctx.options.stdout || process.stdout);
  2441. }
  2442. };
  2443. //#endregion
  2444. //#region ../../node_modules/.pnpm/consola@3.4.2/node_modules/consola/dist/shared/consola.DXBYu-KD.mjs
  2445. const { env = {}, argv = [], platform = "" } = typeof process === "undefined" ? {} : process;
  2446. const isDisabled = "NO_COLOR" in env || argv.includes("--no-color");
  2447. const isForced = "FORCE_COLOR" in env || argv.includes("--color");
  2448. const isWindows = platform === "win32";
  2449. const isDumbTerminal = env.TERM === "dumb";
  2450. const isCompatibleTerminal = tty && tty.isatty && tty.isatty(1) && env.TERM && !isDumbTerminal;
  2451. const isCI = "CI" in env && ("GITHUB_ACTIONS" in env || "GITLAB_CI" in env || "CIRCLECI" in env);
  2452. const isColorSupported = !isDisabled && (isForced || isWindows && !isDumbTerminal || isCompatibleTerminal || isCI);
  2453. function replaceClose(index, string, close, replace, head = string.slice(0, Math.max(0, index)) + replace, tail = string.slice(Math.max(0, index + close.length)), next = tail.indexOf(close)) {
  2454. return head + (next < 0 ? tail : replaceClose(next, tail, close, replace));
  2455. }
  2456. function clearBleed(index, string, open, close, replace) {
  2457. return index < 0 ? open + string + close : open + replaceClose(index, string, close, replace) + close;
  2458. }
  2459. function filterEmpty(open, close, replace = open, at = open.length + 1) {
  2460. return (string) => string || !(string === "" || string === void 0) ? clearBleed(("" + string).indexOf(close, at), string, open, close, replace) : "";
  2461. }
  2462. function init(open, close, replace) {
  2463. return filterEmpty(`\x1B[${open}m`, `\x1B[${close}m`, replace);
  2464. }
  2465. const colorDefs = {
  2466. reset: init(0, 0),
  2467. bold: init(1, 22, "\x1B[22m\x1B[1m"),
  2468. dim: init(2, 22, "\x1B[22m\x1B[2m"),
  2469. italic: init(3, 23),
  2470. underline: init(4, 24),
  2471. inverse: init(7, 27),
  2472. hidden: init(8, 28),
  2473. strikethrough: init(9, 29),
  2474. black: init(30, 39),
  2475. red: init(31, 39),
  2476. green: init(32, 39),
  2477. yellow: init(33, 39),
  2478. blue: init(34, 39),
  2479. magenta: init(35, 39),
  2480. cyan: init(36, 39),
  2481. white: init(37, 39),
  2482. gray: init(90, 39),
  2483. bgBlack: init(40, 49),
  2484. bgRed: init(41, 49),
  2485. bgGreen: init(42, 49),
  2486. bgYellow: init(43, 49),
  2487. bgBlue: init(44, 49),
  2488. bgMagenta: init(45, 49),
  2489. bgCyan: init(46, 49),
  2490. bgWhite: init(47, 49),
  2491. blackBright: init(90, 39),
  2492. redBright: init(91, 39),
  2493. greenBright: init(92, 39),
  2494. yellowBright: init(93, 39),
  2495. blueBright: init(94, 39),
  2496. magentaBright: init(95, 39),
  2497. cyanBright: init(96, 39),
  2498. whiteBright: init(97, 39),
  2499. bgBlackBright: init(100, 49),
  2500. bgRedBright: init(101, 49),
  2501. bgGreenBright: init(102, 49),
  2502. bgYellowBright: init(103, 49),
  2503. bgBlueBright: init(104, 49),
  2504. bgMagentaBright: init(105, 49),
  2505. bgCyanBright: init(106, 49),
  2506. bgWhiteBright: init(107, 49)
  2507. };
  2508. function createColors(useColor = isColorSupported) {
  2509. return useColor ? colorDefs : Object.fromEntries(Object.keys(colorDefs).map((key) => [key, String]));
  2510. }
  2511. const colors = createColors();
  2512. function getColor$1(color, fallback = "reset") {
  2513. return colors[color] || colors[fallback];
  2514. }
  2515. const ansiRegex$1 = [String.raw`[\u001B\u009B][[\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\d\/#&.:=?%@~_]+)*|[a-zA-Z\d]+(?:;[-a-zA-Z\d\/#&.:=?%@~_]*)*)?\u0007)`, String.raw`(?:(?:\d{1,4}(?:;\d{0,4})*)?[\dA-PR-TZcf-nq-uy=><~]))`].join("|");
  2516. function stripAnsi$1(text) {
  2517. return text.replace(new RegExp(ansiRegex$1, "g"), "");
  2518. }
  2519. const boxStylePresets = {
  2520. solid: {
  2521. tl: "┌",
  2522. tr: "┐",
  2523. bl: "└",
  2524. br: "┘",
  2525. h: "─",
  2526. v: "│"
  2527. },
  2528. double: {
  2529. tl: "╔",
  2530. tr: "╗",
  2531. bl: "╚",
  2532. br: "╝",
  2533. h: "═",
  2534. v: "║"
  2535. },
  2536. doubleSingle: {
  2537. tl: "╓",
  2538. tr: "╖",
  2539. bl: "╙",
  2540. br: "╜",
  2541. h: "─",
  2542. v: "║"
  2543. },
  2544. doubleSingleRounded: {
  2545. tl: "╭",
  2546. tr: "╮",
  2547. bl: "╰",
  2548. br: "╯",
  2549. h: "─",
  2550. v: "║"
  2551. },
  2552. singleThick: {
  2553. tl: "┏",
  2554. tr: "┓",
  2555. bl: "┗",
  2556. br: "┛",
  2557. h: "━",
  2558. v: "┃"
  2559. },
  2560. singleDouble: {
  2561. tl: "╒",
  2562. tr: "╕",
  2563. bl: "╘",
  2564. br: "╛",
  2565. h: "═",
  2566. v: "│"
  2567. },
  2568. singleDoubleRounded: {
  2569. tl: "╭",
  2570. tr: "╮",
  2571. bl: "╰",
  2572. br: "╯",
  2573. h: "═",
  2574. v: "│"
  2575. },
  2576. rounded: {
  2577. tl: "╭",
  2578. tr: "╮",
  2579. bl: "╰",
  2580. br: "╯",
  2581. h: "─",
  2582. v: "│"
  2583. }
  2584. };
  2585. const defaultStyle = {
  2586. borderColor: "white",
  2587. borderStyle: "rounded",
  2588. valign: "center",
  2589. padding: 2,
  2590. marginLeft: 1,
  2591. marginTop: 1,
  2592. marginBottom: 1
  2593. };
  2594. function box(text, _opts = {}) {
  2595. const opts = {
  2596. ..._opts,
  2597. style: {
  2598. ...defaultStyle,
  2599. ..._opts.style
  2600. }
  2601. };
  2602. const textLines = text.split("\n");
  2603. const boxLines = [];
  2604. const _color = getColor$1(opts.style.borderColor);
  2605. const borderStyle = { ...typeof opts.style.borderStyle === "string" ? boxStylePresets[opts.style.borderStyle] || boxStylePresets.solid : opts.style.borderStyle };
  2606. if (_color) for (const key in borderStyle) borderStyle[key] = _color(borderStyle[key]);
  2607. const paddingOffset = opts.style.padding % 2 === 0 ? opts.style.padding : opts.style.padding + 1;
  2608. const height = textLines.length + paddingOffset;
  2609. const width = Math.max(...textLines.map((line) => stripAnsi$1(line).length), opts.title ? stripAnsi$1(opts.title).length : 0) + paddingOffset;
  2610. const widthOffset = width + paddingOffset;
  2611. const leftSpace = opts.style.marginLeft > 0 ? " ".repeat(opts.style.marginLeft) : "";
  2612. if (opts.style.marginTop > 0) boxLines.push("".repeat(opts.style.marginTop));
  2613. if (opts.title) {
  2614. const title = _color ? _color(opts.title) : opts.title;
  2615. const left = borderStyle.h.repeat(Math.floor((width - stripAnsi$1(opts.title).length) / 2));
  2616. const right = borderStyle.h.repeat(width - stripAnsi$1(opts.title).length - stripAnsi$1(left).length + paddingOffset);
  2617. boxLines.push(`${leftSpace}${borderStyle.tl}${left}${title}${right}${borderStyle.tr}`);
  2618. } else boxLines.push(`${leftSpace}${borderStyle.tl}${borderStyle.h.repeat(widthOffset)}${borderStyle.tr}`);
  2619. const valignOffset = opts.style.valign === "center" ? Math.floor((height - textLines.length) / 2) : opts.style.valign === "top" ? height - textLines.length - paddingOffset : height - textLines.length;
  2620. for (let i = 0; i < height; i++) if (i < valignOffset || i >= valignOffset + textLines.length) boxLines.push(`${leftSpace}${borderStyle.v}${" ".repeat(widthOffset)}${borderStyle.v}`);
  2621. else {
  2622. const line = textLines[i - valignOffset];
  2623. const left = " ".repeat(paddingOffset);
  2624. const right = " ".repeat(width - stripAnsi$1(line).length);
  2625. boxLines.push(`${leftSpace}${borderStyle.v}${left}${line}${right}${borderStyle.v}`);
  2626. }
  2627. boxLines.push(`${leftSpace}${borderStyle.bl}${borderStyle.h.repeat(widthOffset)}${borderStyle.br}`);
  2628. if (opts.style.marginBottom > 0) boxLines.push("".repeat(opts.style.marginBottom));
  2629. return boxLines.join("\n");
  2630. }
  2631. //#endregion
  2632. //#region ../../node_modules/.pnpm/consola@3.4.2/node_modules/consola/dist/index.mjs
  2633. const r = Object.create(null), i = (e) => globalThis.process?.env || import.meta.env || globalThis.Deno?.env.toObject() || globalThis.__env__ || (e ? r : globalThis), o = new Proxy(r, {
  2634. get(e, s) {
  2635. return i()[s] ?? r[s];
  2636. },
  2637. has(e, s) {
  2638. return s in i() || s in r;
  2639. },
  2640. set(e, s, E) {
  2641. const B = i(true);
  2642. return B[s] = E, true;
  2643. },
  2644. deleteProperty(e, s) {
  2645. if (!s) return false;
  2646. const E = i(true);
  2647. return delete E[s], true;
  2648. },
  2649. ownKeys() {
  2650. const e = i(true);
  2651. return Object.keys(e);
  2652. }
  2653. }), t = typeof process < "u" && process.env && process.env.NODE_ENV || "", f = [
  2654. ["APPVEYOR"],
  2655. [
  2656. "AWS_AMPLIFY",
  2657. "AWS_APP_ID",
  2658. { ci: true }
  2659. ],
  2660. ["AZURE_PIPELINES", "SYSTEM_TEAMFOUNDATIONCOLLECTIONURI"],
  2661. ["AZURE_STATIC", "INPUT_AZURE_STATIC_WEB_APPS_API_TOKEN"],
  2662. ["APPCIRCLE", "AC_APPCIRCLE"],
  2663. ["BAMBOO", "bamboo_planKey"],
  2664. ["BITBUCKET", "BITBUCKET_COMMIT"],
  2665. ["BITRISE", "BITRISE_IO"],
  2666. ["BUDDY", "BUDDY_WORKSPACE_ID"],
  2667. ["BUILDKITE"],
  2668. ["CIRCLE", "CIRCLECI"],
  2669. ["CIRRUS", "CIRRUS_CI"],
  2670. [
  2671. "CLOUDFLARE_PAGES",
  2672. "CF_PAGES",
  2673. { ci: true }
  2674. ],
  2675. ["CODEBUILD", "CODEBUILD_BUILD_ARN"],
  2676. ["CODEFRESH", "CF_BUILD_ID"],
  2677. ["DRONE"],
  2678. ["DRONE", "DRONE_BUILD_EVENT"],
  2679. ["DSARI"],
  2680. ["GITHUB_ACTIONS"],
  2681. ["GITLAB", "GITLAB_CI"],
  2682. ["GITLAB", "CI_MERGE_REQUEST_ID"],
  2683. ["GOCD", "GO_PIPELINE_LABEL"],
  2684. ["LAYERCI"],
  2685. ["HUDSON", "HUDSON_URL"],
  2686. ["JENKINS", "JENKINS_URL"],
  2687. ["MAGNUM"],
  2688. ["NETLIFY"],
  2689. [
  2690. "NETLIFY",
  2691. "NETLIFY_LOCAL",
  2692. { ci: false }
  2693. ],
  2694. ["NEVERCODE"],
  2695. ["RENDER"],
  2696. ["SAIL", "SAILCI"],
  2697. ["SEMAPHORE"],
  2698. ["SCREWDRIVER"],
  2699. ["SHIPPABLE"],
  2700. ["SOLANO", "TDDIUM"],
  2701. ["STRIDER"],
  2702. ["TEAMCITY", "TEAMCITY_VERSION"],
  2703. ["TRAVIS"],
  2704. ["VERCEL", "NOW_BUILDER"],
  2705. [
  2706. "VERCEL",
  2707. "VERCEL",
  2708. { ci: false }
  2709. ],
  2710. [
  2711. "VERCEL",
  2712. "VERCEL_ENV",
  2713. { ci: false }
  2714. ],
  2715. ["APPCENTER", "APPCENTER_BUILD_ID"],
  2716. [
  2717. "CODESANDBOX",
  2718. "CODESANDBOX_SSE",
  2719. { ci: false }
  2720. ],
  2721. [
  2722. "CODESANDBOX",
  2723. "CODESANDBOX_HOST",
  2724. { ci: false }
  2725. ],
  2726. ["STACKBLITZ"],
  2727. ["STORMKIT"],
  2728. ["CLEAVR"],
  2729. ["ZEABUR"],
  2730. [
  2731. "CODESPHERE",
  2732. "CODESPHERE_APP_ID",
  2733. { ci: true }
  2734. ],
  2735. ["RAILWAY", "RAILWAY_PROJECT_ID"],
  2736. ["RAILWAY", "RAILWAY_SERVICE_ID"],
  2737. ["DENO-DEPLOY", "DENO_DEPLOYMENT_ID"],
  2738. [
  2739. "FIREBASE_APP_HOSTING",
  2740. "FIREBASE_APP_HOSTING",
  2741. { ci: true }
  2742. ]
  2743. ];
  2744. function b() {
  2745. if (globalThis.process?.env) for (const e of f) {
  2746. const s = e[1] || e[0];
  2747. if (globalThis.process?.env[s]) return {
  2748. name: e[0].toLowerCase(),
  2749. ...e[2]
  2750. };
  2751. }
  2752. return globalThis.process?.env?.SHELL === "/bin/jsh" && globalThis.process?.versions?.webcontainer ? {
  2753. name: "stackblitz",
  2754. ci: false
  2755. } : {
  2756. name: "",
  2757. ci: false
  2758. };
  2759. }
  2760. const l = b();
  2761. l.name;
  2762. function n(e) {
  2763. return e ? e !== "false" : false;
  2764. }
  2765. const I = globalThis.process?.platform || "", T = n(o.CI) || l.ci !== false, a = n(globalThis.process?.stdout && globalThis.process?.stdout.isTTY), g = n(o.DEBUG), R = t === "test" || n(o.TEST);
  2766. n(o.MINIMAL);
  2767. const A = /^win/i.test(I);
  2768. !n(o.NO_COLOR) && (n(o.FORCE_COLOR) || (a || A) && o.TERM);
  2769. const C = (globalThis.process?.versions?.node || "").replace(/^v/, "") || null;
  2770. Number(C?.split(".")[0]);
  2771. const y = globalThis.process || Object.create(null), _ = { versions: {} };
  2772. new Proxy(y, { get(e, s) {
  2773. if (s === "env") return o;
  2774. if (s in e) return e[s];
  2775. if (s in _) return _[s];
  2776. } });
  2777. const c = globalThis.process?.release?.name === "node", O = !!globalThis.Bun || !!globalThis.process?.versions?.bun, D = !!globalThis.Deno, L = !!globalThis.fastly, S = !!globalThis.Netlify, u = !!globalThis.EdgeRuntime, N = globalThis.navigator?.userAgent === "Cloudflare-Workers", F = [
  2778. [S, "netlify"],
  2779. [u, "edge-light"],
  2780. [N, "workerd"],
  2781. [L, "fastly"],
  2782. [D, "deno"],
  2783. [O, "bun"],
  2784. [c, "node"]
  2785. ];
  2786. function G() {
  2787. const e = F.find((s) => s[0]);
  2788. if (e) return { name: e[1] };
  2789. }
  2790. G()?.name;
  2791. function ansiRegex({ onlyFirst = false } = {}) {
  2792. const pattern = [`[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))`, "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");
  2793. return new RegExp(pattern, onlyFirst ? void 0 : "g");
  2794. }
  2795. const regex = ansiRegex();
  2796. function stripAnsi(string) {
  2797. if (typeof string !== "string") throw new TypeError(`Expected a \`string\`, got \`${typeof string}\``);
  2798. return string.replace(regex, "");
  2799. }
  2800. function isAmbiguous(x) {
  2801. return x === 161 || x === 164 || x === 167 || x === 168 || x === 170 || x === 173 || x === 174 || x >= 176 && x <= 180 || x >= 182 && x <= 186 || x >= 188 && x <= 191 || x === 198 || x === 208 || x === 215 || x === 216 || x >= 222 && x <= 225 || x === 230 || x >= 232 && x <= 234 || x === 236 || x === 237 || x === 240 || x === 242 || x === 243 || x >= 247 && x <= 250 || x === 252 || x === 254 || x === 257 || x === 273 || x === 275 || x === 283 || x === 294 || x === 295 || x === 299 || x >= 305 && x <= 307 || x === 312 || x >= 319 && x <= 322 || x === 324 || x >= 328 && x <= 331 || x === 333 || x === 338 || x === 339 || x === 358 || x === 359 || x === 363 || x === 462 || x === 464 || x === 466 || x === 468 || x === 470 || x === 472 || x === 474 || x === 476 || x === 593 || x === 609 || x === 708 || x === 711 || x >= 713 && x <= 715 || x === 717 || x === 720 || x >= 728 && x <= 731 || x === 733 || x === 735 || x >= 768 && x <= 879 || x >= 913 && x <= 929 || x >= 931 && x <= 937 || x >= 945 && x <= 961 || x >= 963 && x <= 969 || x === 1025 || x >= 1040 && x <= 1103 || x === 1105 || x === 8208 || x >= 8211 && x <= 8214 || x === 8216 || x === 8217 || x === 8220 || x === 8221 || x >= 8224 && x <= 8226 || x >= 8228 && x <= 8231 || x === 8240 || x === 8242 || x === 8243 || x === 8245 || x === 8251 || x === 8254 || x === 8308 || x === 8319 || x >= 8321 && x <= 8324 || x === 8364 || x === 8451 || x === 8453 || x === 8457 || x === 8467 || x === 8470 || x === 8481 || x === 8482 || x === 8486 || x === 8491 || x === 8531 || x === 8532 || x >= 8539 && x <= 8542 || x >= 8544 && x <= 8555 || x >= 8560 && x <= 8569 || x === 8585 || x >= 8592 && x <= 8601 || x === 8632 || x === 8633 || x === 8658 || x === 8660 || x === 8679 || x === 8704 || x === 8706 || x === 8707 || x === 8711 || x === 8712 || x === 8715 || x === 8719 || x === 8721 || x === 8725 || x === 8730 || x >= 8733 && x <= 8736 || x === 8739 || x === 8741 || x >= 8743 && x <= 8748 || x === 8750 || x >= 8756 && x <= 8759 || x === 8764 || x === 8765 || x === 8776 || x === 8780 || x === 8786 || x === 8800 || x === 8801 || x >= 8804 && x <= 8807 || x === 8810 || x === 8811 || x === 8814 || x === 8815 || x === 8834 || x === 8835 || x === 8838 || x === 8839 || x === 8853 || x === 8857 || x === 8869 || x === 8895 || x === 8978 || x >= 9312 && x <= 9449 || x >= 9451 && x <= 9547 || x >= 9552 && x <= 9587 || x >= 9600 && x <= 9615 || x >= 9618 && x <= 9621 || x === 9632 || x === 9633 || x >= 9635 && x <= 9641 || x === 9650 || x === 9651 || x === 9654 || x === 9655 || x === 9660 || x === 9661 || x === 9664 || x === 9665 || x >= 9670 && x <= 9672 || x === 9675 || x >= 9678 && x <= 9681 || x >= 9698 && x <= 9701 || x === 9711 || x === 9733 || x === 9734 || x === 9737 || x === 9742 || x === 9743 || x === 9756 || x === 9758 || x === 9792 || x === 9794 || x === 9824 || x === 9825 || x >= 9827 && x <= 9829 || x >= 9831 && x <= 9834 || x === 9836 || x === 9837 || x === 9839 || x === 9886 || x === 9887 || x === 9919 || x >= 9926 && x <= 9933 || x >= 9935 && x <= 9939 || x >= 9941 && x <= 9953 || x === 9955 || x === 9960 || x === 9961 || x >= 9963 && x <= 9969 || x === 9972 || x >= 9974 && x <= 9977 || x === 9979 || x === 9980 || x === 9982 || x === 9983 || x === 10045 || x >= 10102 && x <= 10111 || x >= 11094 && x <= 11097 || x >= 12872 && x <= 12879 || x >= 57344 && x <= 63743 || x >= 65024 && x <= 65039 || x === 65533 || x >= 127232 && x <= 127242 || x >= 127248 && x <= 127277 || x >= 127280 && x <= 127337 || x >= 127344 && x <= 127373 || x === 127375 || x === 127376 || x >= 127387 && x <= 127404 || x >= 917760 && x <= 917999 || x >= 983040 && x <= 1048573 || x >= 1048576 && x <= 1114109;
  2802. }
  2803. function isFullWidth(x) {
  2804. return x === 12288 || x >= 65281 && x <= 65376 || x >= 65504 && x <= 65510;
  2805. }
  2806. function isWide(x) {
  2807. return x >= 4352 && x <= 4447 || x === 8986 || x === 8987 || x === 9001 || x === 9002 || x >= 9193 && x <= 9196 || x === 9200 || x === 9203 || x === 9725 || x === 9726 || x === 9748 || x === 9749 || x >= 9776 && x <= 9783 || x >= 9800 && x <= 9811 || x === 9855 || x >= 9866 && x <= 9871 || x === 9875 || x === 9889 || x === 9898 || x === 9899 || x === 9917 || x === 9918 || x === 9924 || x === 9925 || x === 9934 || x === 9940 || x === 9962 || x === 9970 || x === 9971 || x === 9973 || x === 9978 || x === 9981 || x === 9989 || x === 9994 || x === 9995 || x === 10024 || x === 10060 || x === 10062 || x >= 10067 && x <= 10069 || x === 10071 || x >= 10133 && x <= 10135 || x === 10160 || x === 10175 || x === 11035 || x === 11036 || x === 11088 || x === 11093 || x >= 11904 && x <= 11929 || x >= 11931 && x <= 12019 || x >= 12032 && x <= 12245 || x >= 12272 && x <= 12287 || x >= 12289 && x <= 12350 || x >= 12353 && x <= 12438 || x >= 12441 && x <= 12543 || x >= 12549 && x <= 12591 || x >= 12593 && x <= 12686 || x >= 12688 && x <= 12773 || x >= 12783 && x <= 12830 || x >= 12832 && x <= 12871 || x >= 12880 && x <= 42124 || x >= 42128 && x <= 42182 || x >= 43360 && x <= 43388 || x >= 44032 && x <= 55203 || x >= 63744 && x <= 64255 || x >= 65040 && x <= 65049 || x >= 65072 && x <= 65106 || x >= 65108 && x <= 65126 || x >= 65128 && x <= 65131 || x >= 94176 && x <= 94180 || x === 94192 || x === 94193 || x >= 94208 && x <= 100343 || x >= 100352 && x <= 101589 || x >= 101631 && x <= 101640 || x >= 110576 && x <= 110579 || x >= 110581 && x <= 110587 || x === 110589 || x === 110590 || x >= 110592 && x <= 110882 || x === 110898 || x >= 110928 && x <= 110930 || x === 110933 || x >= 110948 && x <= 110951 || x >= 110960 && x <= 111355 || x >= 119552 && x <= 119638 || x >= 119648 && x <= 119670 || x === 126980 || x === 127183 || x === 127374 || x >= 127377 && x <= 127386 || x >= 127488 && x <= 127490 || x >= 127504 && x <= 127547 || x >= 127552 && x <= 127560 || x === 127568 || x === 127569 || x >= 127584 && x <= 127589 || x >= 127744 && x <= 127776 || x >= 127789 && x <= 127797 || x >= 127799 && x <= 127868 || x >= 127870 && x <= 127891 || x >= 127904 && x <= 127946 || x >= 127951 && x <= 127955 || x >= 127968 && x <= 127984 || x === 127988 || x >= 127992 && x <= 128062 || x === 128064 || x >= 128066 && x <= 128252 || x >= 128255 && x <= 128317 || x >= 128331 && x <= 128334 || x >= 128336 && x <= 128359 || x === 128378 || x === 128405 || x === 128406 || x === 128420 || x >= 128507 && x <= 128591 || x >= 128640 && x <= 128709 || x === 128716 || x >= 128720 && x <= 128722 || x >= 128725 && x <= 128727 || x >= 128732 && x <= 128735 || x === 128747 || x === 128748 || x >= 128756 && x <= 128764 || x >= 128992 && x <= 129003 || x === 129008 || x >= 129292 && x <= 129338 || x >= 129340 && x <= 129349 || x >= 129351 && x <= 129535 || x >= 129648 && x <= 129660 || x >= 129664 && x <= 129673 || x >= 129679 && x <= 129734 || x >= 129742 && x <= 129756 || x >= 129759 && x <= 129769 || x >= 129776 && x <= 129784 || x >= 131072 && x <= 196605 || x >= 196608 && x <= 262141;
  2808. }
  2809. function validate(codePoint) {
  2810. if (!Number.isSafeInteger(codePoint)) throw new TypeError(`Expected a code point, got \`${typeof codePoint}\`.`);
  2811. }
  2812. function eastAsianWidth(codePoint, { ambiguousAsWide = false } = {}) {
  2813. validate(codePoint);
  2814. if (isFullWidth(codePoint) || isWide(codePoint) || ambiguousAsWide && isAmbiguous(codePoint)) return 2;
  2815. return 1;
  2816. }
  2817. const emojiRegex = () => {
  2818. return /[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE])))?))?|\uDC6F(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE89\uDE8F-\uDEC2\uDEC6\uDECE-\uDEDC\uDEDF-\uDEE9]|\uDD3C(?:\u200D[\u2640\u2642]\uFE0F?|\uD83C[\uDFFB-\uDFFF])?|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g;
  2819. };
  2820. const segmenter = globalThis.Intl?.Segmenter ? new Intl.Segmenter() : { segment: (str) => str.split("") };
  2821. const defaultIgnorableCodePointRegex = /^\p{Default_Ignorable_Code_Point}$/u;
  2822. function stringWidth$1(string, options = {}) {
  2823. if (typeof string !== "string" || string.length === 0) return 0;
  2824. const { ambiguousIsNarrow = true, countAnsiEscapeCodes = false } = options;
  2825. if (!countAnsiEscapeCodes) string = stripAnsi(string);
  2826. if (string.length === 0) return 0;
  2827. let width = 0;
  2828. const eastAsianWidthOptions = { ambiguousAsWide: !ambiguousIsNarrow };
  2829. for (const { segment: character } of segmenter.segment(string)) {
  2830. const codePoint = character.codePointAt(0);
  2831. if (codePoint <= 31 || codePoint >= 127 && codePoint <= 159) continue;
  2832. if (codePoint >= 8203 && codePoint <= 8207 || codePoint === 65279) continue;
  2833. if (codePoint >= 768 && codePoint <= 879 || codePoint >= 6832 && codePoint <= 6911 || codePoint >= 7616 && codePoint <= 7679 || codePoint >= 8400 && codePoint <= 8447 || codePoint >= 65056 && codePoint <= 65071) continue;
  2834. if (codePoint >= 55296 && codePoint <= 57343) continue;
  2835. if (codePoint >= 65024 && codePoint <= 65039) continue;
  2836. if (defaultIgnorableCodePointRegex.test(character)) continue;
  2837. if (emojiRegex().test(character)) {
  2838. width += 2;
  2839. continue;
  2840. }
  2841. width += eastAsianWidth(codePoint, eastAsianWidthOptions);
  2842. }
  2843. return width;
  2844. }
  2845. function isUnicodeSupported() {
  2846. const { env } = process$1;
  2847. const { TERM, TERM_PROGRAM } = env;
  2848. if (process$1.platform !== "win32") return TERM !== "linux";
  2849. return Boolean(env.WT_SESSION) || Boolean(env.TERMINUS_SUBLIME) || env.ConEmuTask === "{cmd::Cmder}" || TERM_PROGRAM === "Terminus-Sublime" || TERM_PROGRAM === "vscode" || TERM === "xterm-256color" || TERM === "alacritty" || TERM === "rxvt-unicode" || TERM === "rxvt-unicode-256color" || env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
  2850. }
  2851. const TYPE_COLOR_MAP = {
  2852. info: "cyan",
  2853. fail: "red",
  2854. success: "green",
  2855. ready: "green",
  2856. start: "magenta"
  2857. };
  2858. const LEVEL_COLOR_MAP = {
  2859. 0: "red",
  2860. 1: "yellow"
  2861. };
  2862. const unicode = isUnicodeSupported();
  2863. const s = (c, fallback) => unicode ? c : fallback;
  2864. const TYPE_ICONS = {
  2865. error: s("✖", "×"),
  2866. fatal: s("✖", "×"),
  2867. ready: s("✔", "√"),
  2868. warn: s("⚠", "‼"),
  2869. info: s("ℹ", "i"),
  2870. success: s("✔", "√"),
  2871. debug: s("⚙", "D"),
  2872. trace: s("→", "→"),
  2873. fail: s("✖", "×"),
  2874. start: s("◐", "o"),
  2875. log: ""
  2876. };
  2877. function stringWidth(str) {
  2878. if (!(typeof Intl === "object") || !Intl.Segmenter) return stripAnsi$1(str).length;
  2879. return stringWidth$1(str);
  2880. }
  2881. var FancyReporter = class extends BasicReporter {
  2882. formatStack(stack, message, opts) {
  2883. const indent = " ".repeat((opts?.errorLevel || 0) + 1);
  2884. return `
  2885. ${indent}` + parseStack(stack, message).map((line) => " " + line.replace(/^at +/, (m) => colors.gray(m)).replace(/\((.+)\)/, (_, m) => `(${colors.cyan(m)})`)).join(`
  2886. ${indent}`);
  2887. }
  2888. formatType(logObj, isBadge, opts) {
  2889. const typeColor = TYPE_COLOR_MAP[logObj.type] || LEVEL_COLOR_MAP[logObj.level] || "gray";
  2890. if (isBadge) return getBgColor(typeColor)(colors.black(` ${logObj.type.toUpperCase()} `));
  2891. const _type = typeof TYPE_ICONS[logObj.type] === "string" ? TYPE_ICONS[logObj.type] : logObj.icon || logObj.type;
  2892. return _type ? getColor(typeColor)(_type) : "";
  2893. }
  2894. formatLogObj(logObj, opts) {
  2895. const [message, ...additional] = this.formatArgs(logObj.args, opts).split("\n");
  2896. if (logObj.type === "box") return box(characterFormat(message + (additional.length > 0 ? "\n" + additional.join("\n") : "")), {
  2897. title: logObj.title ? characterFormat(logObj.title) : void 0,
  2898. style: logObj.style
  2899. });
  2900. const date = this.formatDate(logObj.date, opts);
  2901. const coloredDate = date && colors.gray(date);
  2902. const isBadge = logObj.badge ?? logObj.level < 2;
  2903. const type = this.formatType(logObj, isBadge, opts);
  2904. const tag = logObj.tag ? colors.gray(logObj.tag) : "";
  2905. let line;
  2906. const left = this.filterAndJoin([type, characterFormat(message)]);
  2907. const right = this.filterAndJoin(opts.columns ? [tag, coloredDate] : [tag]);
  2908. const space = (opts.columns || 0) - stringWidth(left) - stringWidth(right) - 2;
  2909. line = space > 0 && (opts.columns || 0) >= 80 ? left + " ".repeat(space) + right : (right ? `${colors.gray(`[${right}]`)} ` : "") + left;
  2910. line += characterFormat(additional.length > 0 ? "\n" + additional.join("\n") : "");
  2911. if (logObj.type === "trace") {
  2912. const _err = /* @__PURE__ */ new Error("Trace: " + logObj.message);
  2913. line += this.formatStack(_err.stack || "", _err.message);
  2914. }
  2915. return isBadge ? "\n" + line + "\n" : line;
  2916. }
  2917. };
  2918. function characterFormat(str) {
  2919. return str.replace(/`([^`]+)`/gm, (_, m) => colors.cyan(m)).replace(/\s+_([^_]+)_\s+/gm, (_, m) => ` ${colors.underline(m)} `);
  2920. }
  2921. function getColor(color = "white") {
  2922. return colors[color] || colors.white;
  2923. }
  2924. function getBgColor(color = "bgWhite") {
  2925. return colors[`bg${color[0].toUpperCase()}${color.slice(1)}`] || colors.bgWhite;
  2926. }
  2927. function createConsola(options = {}) {
  2928. let level = _getDefaultLogLevel();
  2929. if (process.env.CONSOLA_LEVEL) level = Number.parseInt(process.env.CONSOLA_LEVEL) ?? level;
  2930. return createConsola$1({
  2931. level,
  2932. defaults: { level },
  2933. stdout: process.stdout,
  2934. stderr: process.stderr,
  2935. prompt: (...args) => import("./prompt-BYQIwEjg.mjs").then((m) => m.prompt(...args)),
  2936. reporters: options.reporters || [options.fancy ?? !(T || R) ? new FancyReporter() : new BasicReporter()],
  2937. ...options
  2938. });
  2939. }
  2940. function _getDefaultLogLevel() {
  2941. if (g) return LogLevels.debug;
  2942. if (R) return LogLevels.warn;
  2943. return LogLevels.info;
  2944. }
  2945. createConsola();
  2946. //#endregion
  2947. //#region src/cli/logger.ts
  2948. /**
  2949. * Console logger
  2950. */
  2951. const logger = process.env.ROLLDOWN_TEST ? createTestingLogger() : createConsola({ formatOptions: { date: false } });
  2952. function createTestingLogger() {
  2953. const types = [
  2954. "silent",
  2955. "fatal",
  2956. "error",
  2957. "warn",
  2958. "log",
  2959. "info",
  2960. "success",
  2961. "fail",
  2962. "ready",
  2963. "start",
  2964. "box",
  2965. "debug",
  2966. "trace",
  2967. "verbose"
  2968. ];
  2969. const ret = Object.create(null);
  2970. for (const type of types) ret[type] = (...args) => console.log(...args);
  2971. return ret;
  2972. }
  2973. //#endregion
  2974. //#region src/utils/bindingify-output-options.ts
  2975. function bindingifyOutputOptions(outputOptions) {
  2976. const { dir, format, exports, hashCharacters, sourcemap, sourcemapBaseUrl, sourcemapDebugIds, sourcemapIgnoreList, sourcemapPathTransform, name, assetFileNames, entryFileNames, chunkFileNames, banner, footer, postBanner, postFooter, intro, outro, esModule, globals, paths, generatedCode, file, sanitizeFileName, preserveModules, virtualDirname, legalComments, comments, preserveModulesRoot, manualChunks, topLevelVar, cleanDir, strictExecutionOrder } = outputOptions;
  2977. if (legalComments != null) logger.warn("`legalComments` option is deprecated, please use `comments.legal` instead.");
  2978. const { inlineDynamicImports, advancedChunks } = bindingifyCodeSplitting(outputOptions.codeSplitting, outputOptions.inlineDynamicImports, outputOptions.advancedChunks, manualChunks);
  2979. return {
  2980. dir,
  2981. file: file == null ? void 0 : file,
  2982. format: bindingifyFormat(format),
  2983. exports,
  2984. hashCharacters,
  2985. sourcemap: bindingifySourcemap(sourcemap),
  2986. sourcemapBaseUrl,
  2987. sourcemapDebugIds,
  2988. sourcemapIgnoreList: sourcemapIgnoreList ?? /node_modules/,
  2989. sourcemapPathTransform,
  2990. banner: bindingifyAddon(banner),
  2991. footer: bindingifyAddon(footer),
  2992. postBanner: bindingifyAddon(postBanner),
  2993. postFooter: bindingifyAddon(postFooter),
  2994. intro: bindingifyAddon(intro),
  2995. outro: bindingifyAddon(outro),
  2996. extend: outputOptions.extend,
  2997. globals,
  2998. paths,
  2999. generatedCode,
  3000. esModule,
  3001. name,
  3002. assetFileNames: bindingifyAssetFilenames(assetFileNames),
  3003. entryFileNames,
  3004. chunkFileNames,
  3005. plugins: [],
  3006. minify: outputOptions.minify,
  3007. externalLiveBindings: outputOptions.externalLiveBindings,
  3008. inlineDynamicImports,
  3009. dynamicImportInCjs: outputOptions.dynamicImportInCjs,
  3010. manualCodeSplitting: advancedChunks,
  3011. polyfillRequire: outputOptions.polyfillRequire,
  3012. sanitizeFileName,
  3013. preserveModules,
  3014. virtualDirname,
  3015. legalComments,
  3016. comments: bindingifyComments(comments),
  3017. preserveModulesRoot,
  3018. topLevelVar,
  3019. minifyInternalExports: outputOptions.minifyInternalExports,
  3020. cleanDir,
  3021. strictExecutionOrder,
  3022. strict: outputOptions.strict
  3023. };
  3024. }
  3025. function bindingifyAddon(configAddon) {
  3026. if (configAddon == null || configAddon === "") return;
  3027. if (typeof configAddon === "function") return async (chunk) => configAddon(transformRenderedChunk(chunk));
  3028. return configAddon;
  3029. }
  3030. function bindingifyFormat(format) {
  3031. switch (format) {
  3032. case void 0:
  3033. case "es":
  3034. case "esm":
  3035. case "module": return "es";
  3036. case "cjs":
  3037. case "commonjs": return "cjs";
  3038. case "iife": return "iife";
  3039. case "umd": return "umd";
  3040. default: unimplemented(`output.format: ${format}`);
  3041. }
  3042. }
  3043. function bindingifySourcemap(sourcemap) {
  3044. switch (sourcemap) {
  3045. case true: return "file";
  3046. case "inline": return "inline";
  3047. case false:
  3048. case void 0: return;
  3049. case "hidden": return "hidden";
  3050. default: throw new Error(`unknown sourcemap: ${sourcemap}`);
  3051. }
  3052. }
  3053. function bindingifyAssetFilenames(assetFileNames) {
  3054. if (typeof assetFileNames === "function") return (asset) => {
  3055. return assetFileNames({
  3056. name: asset.name,
  3057. names: asset.names,
  3058. originalFileName: asset.originalFileName,
  3059. originalFileNames: asset.originalFileNames,
  3060. source: transformAssetSource(asset.source),
  3061. type: "asset"
  3062. });
  3063. };
  3064. return assetFileNames;
  3065. }
  3066. function bindingifyComments(comments) {
  3067. if (comments == null) return;
  3068. if (typeof comments === "boolean") return comments;
  3069. return comments;
  3070. }
  3071. function bindingifyCodeSplitting(codeSplitting, inlineDynamicImportsOption, advancedChunks, manualChunks) {
  3072. let inlineDynamicImports;
  3073. let effectiveChunksOption;
  3074. if (codeSplitting === false) {
  3075. if (inlineDynamicImportsOption != null) logger.warn("`inlineDynamicImports` option is ignored because `codeSplitting: false` is set.");
  3076. if (manualChunks != null) throw new Error("Invalid configuration: \"output.manualChunks\" cannot be used when \"output.codeSplitting\" is set to false.");
  3077. if (advancedChunks != null) logger.warn("`advancedChunks` option is ignored because `codeSplitting` is set to `false`.");
  3078. return {
  3079. inlineDynamicImports: true,
  3080. advancedChunks: void 0
  3081. };
  3082. } else if (codeSplitting === true) {
  3083. if (inlineDynamicImportsOption != null) logger.warn("`inlineDynamicImports` option is ignored because `codeSplitting: true` is set.");
  3084. } else if (codeSplitting == null) {
  3085. if (inlineDynamicImportsOption != null) {
  3086. logger.warn("`inlineDynamicImports` option is deprecated, please use `codeSplitting: false` instead.");
  3087. inlineDynamicImports = inlineDynamicImportsOption;
  3088. }
  3089. } else {
  3090. effectiveChunksOption = codeSplitting;
  3091. if (inlineDynamicImportsOption != null) logger.warn("`inlineDynamicImports` option is ignored because the `codeSplitting` option is specified.");
  3092. }
  3093. if (inlineDynamicImports === true && manualChunks != null) throw new Error("Invalid value \"true\" for option \"output.inlineDynamicImports\" - this option is not supported for \"output.manualChunks\".");
  3094. if (effectiveChunksOption == null) {
  3095. if (advancedChunks != null) {
  3096. logger.warn("`advancedChunks` option is deprecated, please use `codeSplitting` instead.");
  3097. effectiveChunksOption = advancedChunks;
  3098. }
  3099. } else if (advancedChunks != null) logger.warn("`advancedChunks` option is ignored because the `codeSplitting` option is specified.");
  3100. if (manualChunks != null && effectiveChunksOption != null) logger.warn("`manualChunks` option is ignored because the `codeSplitting` option is specified.");
  3101. else if (manualChunks != null) effectiveChunksOption = { groups: [{ name(moduleId, ctx) {
  3102. return manualChunks(moduleId, { getModuleInfo: (id) => ctx.getModuleInfo(id) });
  3103. } }] };
  3104. let advancedChunksResult;
  3105. if (effectiveChunksOption != null) {
  3106. const { groups, ...restOptions } = effectiveChunksOption;
  3107. advancedChunksResult = {
  3108. ...restOptions,
  3109. groups: groups?.map((group) => {
  3110. const { name, ...restGroup } = group;
  3111. return {
  3112. ...restGroup,
  3113. name: typeof name === "function" ? (id, ctx) => name(id, new ChunkingContextImpl(ctx)) : name
  3114. };
  3115. })
  3116. };
  3117. }
  3118. return {
  3119. inlineDynamicImports,
  3120. advancedChunks: advancedChunksResult
  3121. };
  3122. }
  3123. //#endregion
  3124. //#region src/utils/initialize-parallel-plugins.ts
  3125. var import_binding = /* @__PURE__ */ __toESM(require_binding(), 1);
  3126. async function initializeParallelPlugins(plugins) {
  3127. const pluginInfos = [];
  3128. for (const [index, plugin] of plugins.entries()) if ("_parallel" in plugin) {
  3129. const { fileUrl, options } = plugin._parallel;
  3130. pluginInfos.push({
  3131. index,
  3132. fileUrl,
  3133. options
  3134. });
  3135. }
  3136. if (pluginInfos.length <= 0) return;
  3137. const count = availableParallelism();
  3138. const parallelJsPluginRegistry = new import_binding.ParallelJsPluginRegistry(count);
  3139. const registryId = parallelJsPluginRegistry.id;
  3140. const workers = await initializeWorkers(registryId, count, pluginInfos);
  3141. const stopWorkers = async () => {
  3142. await Promise.all(workers.map((worker) => worker.terminate()));
  3143. };
  3144. return {
  3145. registry: parallelJsPluginRegistry,
  3146. stopWorkers
  3147. };
  3148. }
  3149. function initializeWorkers(registryId, count, pluginInfos) {
  3150. return Promise.all(Array.from({ length: count }, (_, i) => initializeWorker(registryId, pluginInfos, i)));
  3151. }
  3152. async function initializeWorker(registryId, pluginInfos, threadNumber) {
  3153. const urlString = import.meta.resolve("#parallel-plugin-worker");
  3154. const workerData = {
  3155. registryId,
  3156. pluginInfos,
  3157. threadNumber
  3158. };
  3159. let worker;
  3160. try {
  3161. worker = new Worker(new URL(urlString), { workerData });
  3162. worker.unref();
  3163. await new Promise((resolve, reject) => {
  3164. worker.once("message", async (message) => {
  3165. if (message.type === "error") reject(message.error);
  3166. else resolve();
  3167. });
  3168. });
  3169. return worker;
  3170. } catch (e) {
  3171. worker?.terminate();
  3172. throw e;
  3173. }
  3174. }
  3175. const availableParallelism = () => {
  3176. let availableParallelism = 1;
  3177. try {
  3178. availableParallelism = os.availableParallelism();
  3179. } catch {
  3180. const cpus = os.cpus();
  3181. if (Array.isArray(cpus) && cpus.length > 0) availableParallelism = cpus.length;
  3182. }
  3183. return Math.min(availableParallelism, 8);
  3184. };
  3185. //#endregion
  3186. //#region src/utils/create-bundler-option.ts
  3187. async function createBundlerOptions(inputOptions, outputOptions, watchMode) {
  3188. const inputPlugins = await normalizePluginOption(inputOptions.plugins);
  3189. const outputPlugins = await normalizePluginOption(outputOptions.plugins);
  3190. const logLevel = inputOptions.logLevel || "info";
  3191. const onLog = getLogger(getObjectPlugins(inputPlugins), getOnLog(inputOptions, logLevel), logLevel, watchMode);
  3192. outputOptions = PluginDriver.callOutputOptionsHook([...inputPlugins, ...outputPlugins], outputOptions, onLog, logLevel, watchMode);
  3193. const hookOutputPlugins = await normalizePluginOption(outputOptions.plugins);
  3194. const normalizedInputPlugins = normalizePlugins(inputPlugins, ANONYMOUS_PLUGIN_PREFIX);
  3195. const normalizedOutputPlugins = normalizePlugins(hookOutputPlugins, ANONYMOUS_OUTPUT_PLUGIN_PREFIX);
  3196. let plugins = [...normalizedInputPlugins, ...checkOutputPluginOption(normalizedOutputPlugins, onLog)];
  3197. const parallelPluginInitResult = await initializeParallelPlugins(plugins);
  3198. if (inputOptions.experimental?.strictExecutionOrder !== void 0) console.warn("`experimental.strictExecutionOrder` has been stabilized and moved to `output.strictExecutionOrder`. Please update your configuration.");
  3199. try {
  3200. return {
  3201. bundlerOptions: {
  3202. inputOptions: bindingifyInputOptions(plugins, inputOptions, outputOptions, normalizedInputPlugins, normalizedOutputPlugins, onLog, logLevel, watchMode),
  3203. outputOptions: bindingifyOutputOptions(outputOptions),
  3204. parallelPluginsRegistry: parallelPluginInitResult?.registry
  3205. },
  3206. inputOptions,
  3207. onLog,
  3208. stopWorkers: parallelPluginInitResult?.stopWorkers
  3209. };
  3210. } catch (e) {
  3211. await parallelPluginInitResult?.stopWorkers();
  3212. throw e;
  3213. }
  3214. }
  3215. //#endregion
  3216. //#region src/api/rolldown/rolldown-build.ts
  3217. Symbol.asyncDispose ??= Symbol("Symbol.asyncDispose");
  3218. /**
  3219. * The bundle object returned by {@linkcode rolldown} function.
  3220. *
  3221. * @category Programmatic APIs
  3222. */
  3223. var RolldownBuild = class RolldownBuild {
  3224. #inputOptions;
  3225. #bundler;
  3226. #stopWorkers;
  3227. /** @internal */
  3228. static asyncRuntimeShutdown = false;
  3229. /** @hidden should not be used directly */
  3230. constructor(inputOptions) {
  3231. this.#inputOptions = inputOptions;
  3232. this.#bundler = new import_binding.BindingBundler();
  3233. }
  3234. /**
  3235. * Whether the bundle has been closed.
  3236. *
  3237. * If the bundle is closed, calling other methods will throw an error.
  3238. */
  3239. get closed() {
  3240. return this.#bundler.closed;
  3241. }
  3242. /**
  3243. * Generate bundles in-memory.
  3244. *
  3245. * If you directly want to write bundles to disk, use the {@linkcode write} method instead.
  3246. *
  3247. * @param outputOptions The output options.
  3248. * @returns The generated bundle.
  3249. * @throws {@linkcode BundleError} When an error occurs during the build.
  3250. */
  3251. async generate(outputOptions = {}) {
  3252. return this.#build(false, outputOptions);
  3253. }
  3254. /**
  3255. * Generate and write bundles to disk.
  3256. *
  3257. * If you want to generate bundles in-memory, use the {@linkcode generate} method instead.
  3258. *
  3259. * @param outputOptions The output options.
  3260. * @returns The generated bundle.
  3261. * @throws {@linkcode BundleError} When an error occurs during the build.
  3262. */
  3263. async write(outputOptions = {}) {
  3264. return this.#build(true, outputOptions);
  3265. }
  3266. /**
  3267. * Close the bundle and free resources.
  3268. *
  3269. * This method is called automatically when using `using` syntax.
  3270. *
  3271. * @example
  3272. * ```js
  3273. * import { rolldown } from 'rolldown';
  3274. *
  3275. * {
  3276. * using bundle = await rolldown({ input: 'src/main.js' });
  3277. * const output = await bundle.generate({ format: 'esm' });
  3278. * console.log(output);
  3279. * // bundle.close() is called automatically here
  3280. * }
  3281. * ```
  3282. */
  3283. async close() {
  3284. await this.#stopWorkers?.();
  3285. await this.#bundler.close();
  3286. (0, import_binding.shutdownAsyncRuntime)();
  3287. RolldownBuild.asyncRuntimeShutdown = true;
  3288. this.#stopWorkers = void 0;
  3289. }
  3290. /** @hidden documented in close method */
  3291. async [Symbol.asyncDispose]() {
  3292. await this.close();
  3293. }
  3294. /**
  3295. * @experimental
  3296. * @hidden not ready for public usage yet
  3297. */
  3298. get watchFiles() {
  3299. return Promise.resolve(this.#bundler.getWatchFiles());
  3300. }
  3301. async #build(isWrite, outputOptions) {
  3302. validateOption("output", outputOptions);
  3303. await this.#stopWorkers?.();
  3304. const option = await createBundlerOptions(this.#inputOptions, outputOptions, false);
  3305. if (RolldownBuild.asyncRuntimeShutdown) (0, import_binding.startAsyncRuntime)();
  3306. try {
  3307. this.#stopWorkers = option.stopWorkers;
  3308. let output;
  3309. if (isWrite) output = await this.#bundler.write(option.bundlerOptions);
  3310. else output = await this.#bundler.generate(option.bundlerOptions);
  3311. return new RolldownOutputImpl(unwrapBindingResult(output));
  3312. } catch (e) {
  3313. await option.stopWorkers?.();
  3314. throw e;
  3315. }
  3316. }
  3317. };
  3318. //#endregion
  3319. export { getInputCliKeys as a, validateOption as c, getCliSchemaInfo as i, styleText$1 as l, createBundlerOptions as n, getOutputCliKeys as o, logger as r, validateCliOptions as s, RolldownBuild as t, PluginDriver as u };