rolldown-build-DtGk-m96.mjs 149 KB

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