gt 2.14.35 → 2.14.36

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (429) hide show
  1. package/CHANGELOG.md +16 -1
  2. package/dist/api/collectUserEditDiffs.js +112 -155
  3. package/dist/api/collectUserEditDiffs.js.map +1 -0
  4. package/dist/api/downloadFileBatch.js +164 -241
  5. package/dist/api/downloadFileBatch.js.map +1 -0
  6. package/dist/api/saveLocalEdits.js +37 -41
  7. package/dist/api/saveLocalEdits.js.map +1 -0
  8. package/dist/bin/bin-entry.js +17 -7
  9. package/dist/bin/bin-entry.js.map +1 -0
  10. package/dist/bin/bin-main.js +43 -61
  11. package/dist/bin/bin-main.js.map +1 -0
  12. package/dist/cli/base.js +382 -497
  13. package/dist/cli/base.js.map +1 -0
  14. package/dist/cli/commands/download.js +41 -49
  15. package/dist/cli/commands/download.js.map +1 -0
  16. package/dist/cli/commands/enqueue.js +26 -25
  17. package/dist/cli/commands/enqueue.js.map +1 -0
  18. package/dist/cli/commands/setupProject.js +33 -36
  19. package/dist/cli/commands/setupProject.js.map +1 -0
  20. package/dist/cli/commands/stage.js +53 -61
  21. package/dist/cli/commands/stage.js.map +1 -0
  22. package/dist/cli/commands/translate.js +75 -112
  23. package/dist/cli/commands/translate.js.map +1 -0
  24. package/dist/cli/commands/upload.js +185 -213
  25. package/dist/cli/commands/upload.js.map +1 -0
  26. package/dist/cli/commands/utils/validation.js +39 -34
  27. package/dist/cli/commands/utils/validation.js.map +1 -0
  28. package/dist/cli/flags.js +35 -62
  29. package/dist/cli/flags.js.map +1 -0
  30. package/dist/cli/inline.js +112 -137
  31. package/dist/cli/inline.js.map +1 -0
  32. package/dist/cli/next.js +17 -12
  33. package/dist/cli/next.js.map +1 -0
  34. package/dist/cli/node.js +19 -15
  35. package/dist/cli/node.js.map +1 -0
  36. package/dist/cli/python.js +13 -8
  37. package/dist/cli/python.js.map +1 -0
  38. package/dist/cli/react.js +61 -78
  39. package/dist/cli/react.js.map +1 -0
  40. package/dist/config/defaults.js +16 -11
  41. package/dist/config/defaults.js.map +1 -0
  42. package/dist/config/generateSettings.js +167 -269
  43. package/dist/config/generateSettings.js.map +1 -0
  44. package/dist/config/optionPresets.js +78 -96
  45. package/dist/config/optionPresets.js.map +1 -0
  46. package/dist/config/resolveConfig.js +27 -32
  47. package/dist/config/resolveConfig.js.map +1 -0
  48. package/dist/config/utils.js +7 -3
  49. package/dist/config/utils.js.map +1 -0
  50. package/dist/config/validateSettings.js +19 -30
  51. package/dist/config/validateSettings.js.map +1 -0
  52. package/dist/console/colors.js +18 -13
  53. package/dist/console/colors.js.map +1 -0
  54. package/dist/console/displayTranslateSummary.js +40 -37
  55. package/dist/console/displayTranslateSummary.js.map +1 -0
  56. package/dist/console/formatting.js +8 -5
  57. package/dist/console/formatting.js.map +1 -0
  58. package/dist/console/index.d.ts +11 -9
  59. package/dist/console/index.js +53 -50
  60. package/dist/console/index.js.map +1 -0
  61. package/dist/console/inkFields.d.ts +23 -0
  62. package/dist/console/inkFields.js +87 -0
  63. package/dist/console/inkFields.js.map +1 -0
  64. package/dist/console/inkLayout.d.ts +7 -0
  65. package/dist/console/inkLayout.js +139 -0
  66. package/dist/console/inkLayout.js.map +1 -0
  67. package/dist/console/inkLocaleData.d.ts +4 -0
  68. package/dist/console/inkLocaleData.js +32 -0
  69. package/dist/console/inkLocaleData.js.map +1 -0
  70. package/dist/console/inkPrompts.d.ts +8 -0
  71. package/dist/console/inkPrompts.js +496 -0
  72. package/dist/console/inkPrompts.js.map +1 -0
  73. package/dist/console/inkSession.d.ts +3 -0
  74. package/dist/console/inkSession.js +42 -0
  75. package/dist/console/inkSession.js.map +1 -0
  76. package/dist/console/inkTerminal.d.ts +4 -0
  77. package/dist/console/inkTerminal.js +15 -0
  78. package/dist/console/inkTerminal.js.map +1 -0
  79. package/dist/console/inkTypes.d.ts +66 -0
  80. package/dist/console/inkTypes.js +1 -0
  81. package/dist/console/inkUtils.d.ts +24 -0
  82. package/dist/console/inkUtils.js +87 -0
  83. package/dist/console/inkUtils.js.map +1 -0
  84. package/dist/console/logger.js +209 -249
  85. package/dist/console/logger.js.map +1 -0
  86. package/dist/console/logging.d.ts +14 -0
  87. package/dist/console/logging.js +203 -162
  88. package/dist/console/logging.js.map +1 -0
  89. package/dist/console/promptParsing.d.ts +5 -0
  90. package/dist/console/promptParsing.js +28 -0
  91. package/dist/console/promptParsing.js.map +1 -0
  92. package/dist/console/terminalSession.d.ts +5 -0
  93. package/dist/console/terminalSession.js +38 -0
  94. package/dist/console/terminalSession.js.map +1 -0
  95. package/dist/extraction/index.js +3 -2
  96. package/dist/extraction/mapToUpdates.js +19 -18
  97. package/dist/extraction/mapToUpdates.js.map +1 -0
  98. package/dist/extraction/postProcess.js +68 -86
  99. package/dist/extraction/postProcess.js.map +1 -0
  100. package/dist/formats/files/aggregateFiles.js +223 -304
  101. package/dist/formats/files/aggregateFiles.js.map +1 -0
  102. package/dist/formats/files/collectFiles.js +53 -54
  103. package/dist/formats/files/collectFiles.js.map +1 -0
  104. package/dist/formats/files/convertToFileTranslationData.js +21 -19
  105. package/dist/formats/files/convertToFileTranslationData.js.map +1 -0
  106. package/dist/formats/files/fileMapping.js +82 -119
  107. package/dist/formats/files/fileMapping.js.map +1 -0
  108. package/dist/formats/files/preprocess/mdx.js +15 -12
  109. package/dist/formats/files/preprocess/mdx.js.map +1 -0
  110. package/dist/formats/files/preprocess/mintlify.js +15 -13
  111. package/dist/formats/files/preprocess/mintlify.js.map +1 -0
  112. package/dist/formats/files/preprocessContent.js +20 -21
  113. package/dist/formats/files/preprocessContent.js.map +1 -0
  114. package/dist/formats/files/save.js +18 -15
  115. package/dist/formats/files/save.js.map +1 -0
  116. package/dist/formats/files/supportedFiles.js +27 -22
  117. package/dist/formats/files/supportedFiles.js.map +1 -0
  118. package/dist/formats/files/transformFormat.js +93 -100
  119. package/dist/formats/files/transformFormat.js.map +1 -0
  120. package/dist/formats/json/extractJson.js +83 -110
  121. package/dist/formats/json/extractJson.js.map +1 -0
  122. package/dist/formats/json/flattenJson.js +41 -48
  123. package/dist/formats/json/flattenJson.js.map +1 -0
  124. package/dist/formats/json/jsonPath.js +20 -15
  125. package/dist/formats/json/jsonPath.js.map +1 -0
  126. package/dist/formats/json/jsonPointer.js +17 -17
  127. package/dist/formats/json/jsonPointer.js.map +1 -0
  128. package/dist/formats/json/mergeJson.js +230 -371
  129. package/dist/formats/json/mergeJson.js.map +1 -0
  130. package/dist/formats/json/parseJson.js +74 -111
  131. package/dist/formats/json/parseJson.js.map +1 -0
  132. package/dist/formats/json/transformJson.js +53 -61
  133. package/dist/formats/json/transformJson.js.map +1 -0
  134. package/dist/formats/json/utils.js +158 -187
  135. package/dist/formats/json/utils.js.map +1 -0
  136. package/dist/formats/parseKeyedMetadata.js +85 -106
  137. package/dist/formats/parseKeyedMetadata.js.map +1 -0
  138. package/dist/formats/utils.js +13 -23
  139. package/dist/formats/utils.js.map +1 -0
  140. package/dist/formats/yaml/extractYaml.js +32 -31
  141. package/dist/formats/yaml/extractYaml.js.map +1 -0
  142. package/dist/formats/yaml/mergeYaml.js +43 -60
  143. package/dist/formats/yaml/mergeYaml.js.map +1 -0
  144. package/dist/formats/yaml/parseYaml.js +34 -23
  145. package/dist/formats/yaml/parseYaml.js.map +1 -0
  146. package/dist/formats/yaml/utils.js +19 -21
  147. package/dist/formats/yaml/utils.js.map +1 -0
  148. package/dist/fs/clearLocaleDirs.js +82 -114
  149. package/dist/fs/clearLocaleDirs.js.map +1 -0
  150. package/dist/fs/config/downloadedVersions.js +174 -188
  151. package/dist/fs/config/downloadedVersions.js.map +1 -0
  152. package/dist/fs/config/loadConfig.js +12 -8
  153. package/dist/fs/config/loadConfig.js.map +1 -0
  154. package/dist/fs/config/parseFilesConfig.js +166 -227
  155. package/dist/fs/config/parseFilesConfig.js.map +1 -0
  156. package/dist/fs/config/setupConfig.js +43 -52
  157. package/dist/fs/config/setupConfig.js.map +1 -0
  158. package/dist/fs/config/updateConfig.js +44 -56
  159. package/dist/fs/config/updateConfig.js.map +1 -0
  160. package/dist/fs/config/updateVersions.js +27 -28
  161. package/dist/fs/config/updateVersions.js.map +1 -0
  162. package/dist/fs/copyFile.js +33 -37
  163. package/dist/fs/copyFile.js.map +1 -0
  164. package/dist/fs/createLoadTranslationsFile.js +32 -48
  165. package/dist/fs/createLoadTranslationsFile.js.map +1 -0
  166. package/dist/fs/determineFramework/detectPythonLibrary.js +30 -34
  167. package/dist/fs/determineFramework/detectPythonLibrary.js.map +1 -0
  168. package/dist/fs/determineFramework/index.js +46 -64
  169. package/dist/fs/determineFramework/index.js.map +1 -0
  170. package/dist/fs/determineFramework/matchPyprojectDependency.js +65 -78
  171. package/dist/fs/determineFramework/matchPyprojectDependency.js.map +1 -0
  172. package/dist/fs/determineFramework/matchRequirementsTxtDependency.js +21 -19
  173. package/dist/fs/determineFramework/matchRequirementsTxtDependency.js.map +1 -0
  174. package/dist/fs/determineFramework/matchSetupPyDependency.js +60 -81
  175. package/dist/fs/determineFramework/matchSetupPyDependency.js.map +1 -0
  176. package/dist/fs/determineFramework/resolveGtDependency.js +15 -15
  177. package/dist/fs/determineFramework/resolveGtDependency.js.map +1 -0
  178. package/dist/fs/findFilepath.js +63 -78
  179. package/dist/fs/findFilepath.js.map +1 -0
  180. package/dist/fs/loadJSON.js +18 -15
  181. package/dist/fs/loadJSON.js.map +1 -0
  182. package/dist/fs/matchFiles.js +12 -7
  183. package/dist/fs/matchFiles.js.map +1 -0
  184. package/dist/fs/saveJSON.js +10 -6
  185. package/dist/fs/saveJSON.js.map +1 -0
  186. package/dist/fs/utils.js +19 -15
  187. package/dist/fs/utils.js.map +1 -0
  188. package/dist/functions.d.ts +2 -1
  189. package/dist/functions.js +3 -6
  190. package/dist/generated/version.d.ts +1 -1
  191. package/dist/generated/version.js +6 -2
  192. package/dist/generated/version.js.map +1 -0
  193. package/dist/git/branches.js +77 -83
  194. package/dist/git/branches.js.map +1 -0
  195. package/dist/hooks/postProcess.js +97 -114
  196. package/dist/hooks/postProcess.js.map +1 -0
  197. package/dist/index.js +23 -31
  198. package/dist/index.js.map +1 -0
  199. package/dist/locadex/setupFlow.js +11 -8
  200. package/dist/locadex/setupFlow.js.map +1 -0
  201. package/dist/main.js +17 -7
  202. package/dist/main.js.map +1 -0
  203. package/dist/next/config/parseNextConfig.js +32 -51
  204. package/dist/next/config/parseNextConfig.js.map +1 -0
  205. package/dist/next/jsx/utils.js +25 -37
  206. package/dist/next/jsx/utils.js.map +1 -0
  207. package/dist/next/parse/handleInitGT.js +87 -154
  208. package/dist/next/parse/handleInitGT.js.map +1 -0
  209. package/dist/next/parse/wrapContent.js +136 -158
  210. package/dist/next/parse/wrapContent.js.map +1 -0
  211. package/dist/python/parse/createPythonInlineUpdates.js +36 -33
  212. package/dist/python/parse/createPythonInlineUpdates.js.map +1 -0
  213. package/dist/react/config/createESBuildConfig.js +115 -115
  214. package/dist/react/config/createESBuildConfig.js.map +1 -0
  215. package/dist/react/jsx/evaluateJsx.js +90 -124
  216. package/dist/react/jsx/evaluateJsx.js.map +1 -0
  217. package/dist/react/jsx/utils/buildImportMap.js +24 -28
  218. package/dist/react/jsx/utils/buildImportMap.js.map +1 -0
  219. package/dist/react/jsx/utils/constants.js +79 -87
  220. package/dist/react/jsx/utils/constants.js.map +1 -0
  221. package/dist/react/jsx/utils/extractSourceCode.js +36 -37
  222. package/dist/react/jsx/utils/extractSourceCode.js.map +1 -0
  223. package/dist/react/jsx/utils/getCalleeNameFromExpression.js +30 -30
  224. package/dist/react/jsx/utils/getCalleeNameFromExpression.js.map +1 -0
  225. package/dist/react/jsx/utils/getPathsAndAliases.js +70 -105
  226. package/dist/react/jsx/utils/getPathsAndAliases.js.map +1 -0
  227. package/dist/react/jsx/utils/isNumberLiteral.js +13 -11
  228. package/dist/react/jsx/utils/isNumberLiteral.js.map +1 -0
  229. package/dist/react/jsx/utils/jsxParsing/addGTIdentifierToSyntaxTree.js +103 -148
  230. package/dist/react/jsx/utils/jsxParsing/addGTIdentifierToSyntaxTree.js.map +1 -0
  231. package/dist/react/jsx/utils/jsxParsing/autoInsertion.js +305 -389
  232. package/dist/react/jsx/utils/jsxParsing/autoInsertion.js.map +1 -0
  233. package/dist/react/jsx/utils/jsxParsing/handleChildrenWhitespace.js +122 -193
  234. package/dist/react/jsx/utils/jsxParsing/handleChildrenWhitespace.js.map +1 -0
  235. package/dist/react/jsx/utils/jsxParsing/multiplication/findMultiplicationNode.js +50 -64
  236. package/dist/react/jsx/utils/jsxParsing/multiplication/findMultiplicationNode.js.map +1 -0
  237. package/dist/react/jsx/utils/jsxParsing/multiplication/multiplyJsxTree.js +41 -68
  238. package/dist/react/jsx/utils/jsxParsing/multiplication/multiplyJsxTree.js.map +1 -0
  239. package/dist/react/jsx/utils/jsxParsing/parseJsx.js +760 -1107
  240. package/dist/react/jsx/utils/jsxParsing/parseJsx.js.map +1 -0
  241. package/dist/react/jsx/utils/jsxParsing/parseTProps.js +35 -71
  242. package/dist/react/jsx/utils/jsxParsing/parseTProps.js.map +1 -0
  243. package/dist/react/jsx/utils/jsxParsing/removeNullChildrenFields.js +39 -58
  244. package/dist/react/jsx/utils/jsxParsing/removeNullChildrenFields.js.map +1 -0
  245. package/dist/react/jsx/utils/jsxParsing/types.js +10 -24
  246. package/dist/react/jsx/utils/jsxParsing/types.js.map +1 -0
  247. package/dist/react/jsx/utils/mapAttributeName.js +13 -13
  248. package/dist/react/jsx/utils/mapAttributeName.js.map +1 -0
  249. package/dist/react/jsx/utils/parseAst.js +142 -272
  250. package/dist/react/jsx/utils/parseAst.js.map +1 -0
  251. package/dist/react/jsx/utils/parseString.js +726 -1090
  252. package/dist/react/jsx/utils/parseString.js.map +1 -0
  253. package/dist/react/jsx/utils/parseStringFunction.js +274 -401
  254. package/dist/react/jsx/utils/parseStringFunction.js.map +1 -0
  255. package/dist/react/jsx/utils/resolveImportPath.js +104 -108
  256. package/dist/react/jsx/utils/resolveImportPath.js.map +1 -0
  257. package/dist/react/jsx/utils/stringParsing/derivation/containsDeriveCall.js +18 -24
  258. package/dist/react/jsx/utils/stringParsing/derivation/containsDeriveCall.js.map +1 -0
  259. package/dist/react/jsx/utils/stringParsing/derivation/handleDerivation.js +412 -579
  260. package/dist/react/jsx/utils/stringParsing/derivation/handleDerivation.js.map +1 -0
  261. package/dist/react/jsx/utils/stringParsing/derivation/index.js +57 -67
  262. package/dist/react/jsx/utils/stringParsing/derivation/index.js.map +1 -0
  263. package/dist/react/jsx/utils/stringParsing/derivation/isDeriveCall.js +26 -36
  264. package/dist/react/jsx/utils/stringParsing/derivation/isDeriveCall.js.map +1 -0
  265. package/dist/react/jsx/utils/stringParsing/processTaggedTemplateCall/handleTaggedTemplateTranslationCall.js +29 -24
  266. package/dist/react/jsx/utils/stringParsing/processTaggedTemplateCall/handleTaggedTemplateTranslationCall.js.map +1 -0
  267. package/dist/react/jsx/utils/stringParsing/processTaggedTemplateCall/index.js +34 -32
  268. package/dist/react/jsx/utils/stringParsing/processTaggedTemplateCall/index.js.map +1 -0
  269. package/dist/react/jsx/utils/stringParsing/processTranslationCall/extractStringEntryMetadata.js +80 -117
  270. package/dist/react/jsx/utils/stringParsing/processTranslationCall/extractStringEntryMetadata.js.map +1 -0
  271. package/dist/react/jsx/utils/stringParsing/processTranslationCall/handleDeriveTranslationCall.js +24 -19
  272. package/dist/react/jsx/utils/stringParsing/processTranslationCall/handleDeriveTranslationCall.js.map +1 -0
  273. package/dist/react/jsx/utils/stringParsing/processTranslationCall/handleInvalidTranslationCall.js +18 -21
  274. package/dist/react/jsx/utils/stringParsing/processTranslationCall/handleInvalidTranslationCall.js.map +1 -0
  275. package/dist/react/jsx/utils/stringParsing/processTranslationCall/handleLiteralTranslationCall.js +45 -50
  276. package/dist/react/jsx/utils/stringParsing/processTranslationCall/handleLiteralTranslationCall.js.map +1 -0
  277. package/dist/react/jsx/utils/stringParsing/processTranslationCall/index.js +54 -59
  278. package/dist/react/jsx/utils/stringParsing/processTranslationCall/index.js.map +1 -0
  279. package/dist/react/jsx/utils/stringParsing/processTranslationCall/routeTranslationCall.js +56 -69
  280. package/dist/react/jsx/utils/stringParsing/processTranslationCall/routeTranslationCall.js.map +1 -0
  281. package/dist/react/jsx/utils/validateStringFunction.js +21 -29
  282. package/dist/react/jsx/utils/validateStringFunction.js.map +1 -0
  283. package/dist/react/jsx/wrapJsx.js +192 -375
  284. package/dist/react/jsx/wrapJsx.js.map +1 -0
  285. package/dist/react/parse/addVitePlugin/index.js +40 -34
  286. package/dist/react/parse/addVitePlugin/index.js.map +1 -0
  287. package/dist/react/parse/addVitePlugin/installCompiler.js +18 -20
  288. package/dist/react/parse/addVitePlugin/installCompiler.js.map +1 -0
  289. package/dist/react/parse/addVitePlugin/updateViteConfig.js +107 -111
  290. package/dist/react/parse/addVitePlugin/updateViteConfig.js.map +1 -0
  291. package/dist/react/parse/addVitePlugin/utils/addCompilerImport.js +23 -26
  292. package/dist/react/parse/addVitePlugin/utils/addCompilerImport.js.map +1 -0
  293. package/dist/react/parse/addVitePlugin/utils/addPluginInvocation.js +29 -43
  294. package/dist/react/parse/addVitePlugin/utils/addPluginInvocation.js.map +1 -0
  295. package/dist/react/parse/addVitePlugin/utils/checkCompilerImport.js +70 -104
  296. package/dist/react/parse/addVitePlugin/utils/checkCompilerImport.js.map +1 -0
  297. package/dist/react/parse/addVitePlugin/utils/checkPluginInvocation.js +23 -29
  298. package/dist/react/parse/addVitePlugin/utils/checkPluginInvocation.js.map +1 -0
  299. package/dist/react/parse/createDictionaryUpdates.js +121 -185
  300. package/dist/react/parse/createDictionaryUpdates.js.map +1 -0
  301. package/dist/react/parse/createInlineUpdates.js +123 -139
  302. package/dist/react/parse/createInlineUpdates.js.map +1 -0
  303. package/dist/react/parse/wrapContent.js +131 -156
  304. package/dist/react/parse/wrapContent.js.map +1 -0
  305. package/dist/react/utils/flattenDictionary.js +55 -70
  306. package/dist/react/utils/flattenDictionary.js.map +1 -0
  307. package/dist/react/utils/getEntryAndMetadata.js +14 -10
  308. package/dist/react/utils/getEntryAndMetadata.js.map +1 -0
  309. package/dist/react/utils/getVariableName.js +36 -33
  310. package/dist/react/utils/getVariableName.js.map +1 -0
  311. package/dist/setup/detectFramework.js +85 -102
  312. package/dist/setup/detectFramework.js.map +1 -0
  313. package/dist/setup/frameworkUtils.js +17 -28
  314. package/dist/setup/frameworkUtils.js.map +1 -0
  315. package/dist/setup/userInput.js +24 -31
  316. package/dist/setup/userInput.js.map +1 -0
  317. package/dist/setup/wizard.js +141 -143
  318. package/dist/setup/wizard.js.map +1 -0
  319. package/dist/state/mintlifyRefMap.js +12 -9
  320. package/dist/state/mintlifyRefMap.js.map +1 -0
  321. package/dist/state/recentDownloads.js +26 -23
  322. package/dist/state/recentDownloads.js.map +1 -0
  323. package/dist/state/translateWarnings.js +17 -8
  324. package/dist/state/translateWarnings.js.map +1 -0
  325. package/dist/translation/parse.js +77 -98
  326. package/dist/translation/parse.js.map +1 -0
  327. package/dist/translation/stage.js +28 -43
  328. package/dist/translation/stage.js.map +1 -0
  329. package/dist/translation/validate.js +68 -91
  330. package/dist/translation/validate.js.map +1 -0
  331. package/dist/types/libraries.js +93 -91
  332. package/dist/types/libraries.js.map +1 -0
  333. package/dist/types/parsing.js +19 -10
  334. package/dist/types/parsing.js.map +1 -0
  335. package/dist/utils/addExplicitAnchorIds.js +270 -389
  336. package/dist/utils/addExplicitAnchorIds.js.map +1 -0
  337. package/dist/utils/calculateTimeoutMs.js +11 -6
  338. package/dist/utils/calculateTimeoutMs.js.map +1 -0
  339. package/dist/utils/constants.js +15 -12
  340. package/dist/utils/constants.js.map +1 -0
  341. package/dist/utils/credentials.js +67 -114
  342. package/dist/utils/credentials.js.map +1 -0
  343. package/dist/utils/fetch.js +22 -20
  344. package/dist/utils/fetch.js.map +1 -0
  345. package/dist/utils/flattenJsonFiles.js +27 -34
  346. package/dist/utils/flattenJsonFiles.js.map +1 -0
  347. package/dist/utils/gitDiff.js +30 -32
  348. package/dist/utils/gitDiff.js.map +1 -0
  349. package/dist/utils/gt.js +7 -2
  350. package/dist/utils/gt.js.map +1 -0
  351. package/dist/utils/hash.js +14 -9
  352. package/dist/utils/hash.js.map +1 -0
  353. package/dist/utils/headers.js +10 -13
  354. package/dist/utils/headers.js.map +1 -0
  355. package/dist/utils/installPackage.js +70 -75
  356. package/dist/utils/installPackage.js.map +1 -0
  357. package/dist/utils/localizeRelativeAssets.js +114 -157
  358. package/dist/utils/localizeRelativeAssets.js.map +1 -0
  359. package/dist/utils/localizeStaticImports.js +229 -371
  360. package/dist/utils/localizeStaticImports.js.map +1 -0
  361. package/dist/utils/localizeStaticUrls.js +241 -424
  362. package/dist/utils/localizeStaticUrls.js.map +1 -0
  363. package/dist/utils/mintlifyTitleFallback.js +64 -72
  364. package/dist/utils/mintlifyTitleFallback.js.map +1 -0
  365. package/dist/utils/monorepoVersionCheck.js +177 -215
  366. package/dist/utils/monorepoVersionCheck.js.map +1 -0
  367. package/dist/utils/packageInfo.js +17 -16
  368. package/dist/utils/packageInfo.js.map +1 -0
  369. package/dist/utils/packageJson.js +51 -66
  370. package/dist/utils/packageJson.js.map +1 -0
  371. package/dist/utils/packageManager.js +237 -260
  372. package/dist/utils/packageManager.js.map +1 -0
  373. package/dist/utils/parse/needsCJS.js +36 -69
  374. package/dist/utils/parse/needsCJS.js.map +1 -0
  375. package/dist/utils/persistPostprocessHashes.js +30 -32
  376. package/dist/utils/persistPostprocessHashes.js.map +1 -0
  377. package/dist/utils/processAnchorIds.js +32 -54
  378. package/dist/utils/processAnchorIds.js.map +1 -0
  379. package/dist/utils/processOpenApi.js +469 -578
  380. package/dist/utils/processOpenApi.js.map +1 -0
  381. package/dist/utils/resolveMintlifyRefs.js +89 -105
  382. package/dist/utils/resolveMintlifyRefs.js.map +1 -0
  383. package/dist/utils/resolvePublish.js +46 -54
  384. package/dist/utils/resolvePublish.js.map +1 -0
  385. package/dist/utils/sanitizeFileContent.js +20 -27
  386. package/dist/utils/sanitizeFileContent.js.map +1 -0
  387. package/dist/utils/sharedStaticAssets.js +248 -366
  388. package/dist/utils/sharedStaticAssets.js.map +1 -0
  389. package/dist/utils/splitMintlifyLanguageRefs.js +208 -282
  390. package/dist/utils/splitMintlifyLanguageRefs.js.map +1 -0
  391. package/dist/utils/validateMdx.js +26 -23
  392. package/dist/utils/validateMdx.js.map +1 -0
  393. package/dist/utils/wrapPlainUrls.js +58 -70
  394. package/dist/utils/wrapPlainUrls.js.map +1 -0
  395. package/dist/workflows/download.js +92 -126
  396. package/dist/workflows/download.js.map +1 -0
  397. package/dist/workflows/enqueue.js +47 -54
  398. package/dist/workflows/enqueue.js.map +1 -0
  399. package/dist/workflows/publish.js +29 -29
  400. package/dist/workflows/publish.js.map +1 -0
  401. package/dist/workflows/setupProject.js +39 -40
  402. package/dist/workflows/setupProject.js.map +1 -0
  403. package/dist/workflows/stage.js +61 -65
  404. package/dist/workflows/stage.js.map +1 -0
  405. package/dist/workflows/steps/BranchStep.js +118 -163
  406. package/dist/workflows/steps/BranchStep.js.map +1 -0
  407. package/dist/workflows/steps/DownloadStep.js +107 -137
  408. package/dist/workflows/steps/DownloadStep.js.map +1 -0
  409. package/dist/workflows/steps/EnqueueStep.js +32 -32
  410. package/dist/workflows/steps/EnqueueStep.js.map +1 -0
  411. package/dist/workflows/steps/PollJobsStep.js +208 -292
  412. package/dist/workflows/steps/PollJobsStep.js.map +1 -0
  413. package/dist/workflows/steps/PublishStep.js +33 -38
  414. package/dist/workflows/steps/PublishStep.js.map +1 -0
  415. package/dist/workflows/steps/SetupStep.js +71 -72
  416. package/dist/workflows/steps/SetupStep.js.map +1 -0
  417. package/dist/workflows/steps/TagStep.js +39 -44
  418. package/dist/workflows/steps/TagStep.js.map +1 -0
  419. package/dist/workflows/steps/UploadSourcesStep.js +108 -140
  420. package/dist/workflows/steps/UploadSourcesStep.js.map +1 -0
  421. package/dist/workflows/steps/UploadTranslationsStep.js +61 -71
  422. package/dist/workflows/steps/UploadTranslationsStep.js.map +1 -0
  423. package/dist/workflows/steps/UserEditDiffsStep.js +32 -34
  424. package/dist/workflows/steps/UserEditDiffsStep.js.map +1 -0
  425. package/dist/workflows/steps/WorkflowStep.js +6 -2
  426. package/dist/workflows/steps/WorkflowStep.js.map +1 -0
  427. package/dist/workflows/upload.js +45 -46
  428. package/dist/workflows/upload.js.map +1 -0
  429. package/package.json +14 -7
@@ -1,31 +1,31 @@
1
- import { PublishStep } from './steps/PublishStep.js';
2
- import { gt } from '../utils/gt.js';
3
- import { hasPublishConfig } from '../utils/resolvePublish.js';
4
- import { logger } from '../console/logger.js';
1
+ import { logger } from "../console/logger.js";
2
+ import { gt } from "../utils/gt.js";
3
+ import { hasPublishConfig } from "../utils/resolvePublish.js";
4
+ import { PublishStep } from "./steps/PublishStep.js";
5
+ //#region src/workflows/publish.ts
5
6
  /**
6
- * Publishes files to the CDN if publish config exists and the publishMap is non-empty.
7
- * Shared by translate, upload, and save-local commands.
8
- */
9
- export async function runPublishWorkflow(files, publishMap, branchId, settings) {
10
- if (publishMap.size === 0 || !hasPublishConfig(settings))
11
- return;
12
- try {
13
- const allFileRefs = files
14
- .filter((file) => publishMap.has(file.fileId))
15
- .map((file) => ({
16
- fileId: file.fileId,
17
- versionId: file.versionId,
18
- branchId,
19
- publish: publishMap.get(file.fileId),
20
- fileName: file.fileName,
21
- }));
22
- if (allFileRefs.length === 0)
23
- return;
24
- const publishStep = new PublishStep(gt);
25
- await publishStep.run(allFileRefs);
26
- await publishStep.wait();
27
- }
28
- catch (error) {
29
- logger.warn(`Failed to publish files: ${error instanceof Error ? error.message : String(error)}`);
30
- }
7
+ * Publishes files to the CDN if publish config exists and the publishMap is non-empty.
8
+ * Shared by translate, upload, and save-local commands.
9
+ */
10
+ async function runPublishWorkflow(files, publishMap, branchId, settings) {
11
+ if (publishMap.size === 0 || !hasPublishConfig(settings)) return;
12
+ try {
13
+ const allFileRefs = files.filter((file) => publishMap.has(file.fileId)).map((file) => ({
14
+ fileId: file.fileId,
15
+ versionId: file.versionId,
16
+ branchId,
17
+ publish: publishMap.get(file.fileId),
18
+ fileName: file.fileName
19
+ }));
20
+ if (allFileRefs.length === 0) return;
21
+ const publishStep = new PublishStep(gt);
22
+ await publishStep.run(allFileRefs);
23
+ await publishStep.wait();
24
+ } catch (error) {
25
+ logger.warn(`Failed to publish files: ${error instanceof Error ? error.message : String(error)}`);
26
+ }
31
27
  }
28
+ //#endregion
29
+ export { runPublishWorkflow };
30
+
31
+ //# sourceMappingURL=publish.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"publish.js","names":[],"sources":["../../src/workflows/publish.ts"],"sourcesContent":["import { Settings } from '../types/index.js';\nimport { PublishStep } from './steps/PublishStep.js';\nimport { gt } from '../utils/gt.js';\nimport { hasPublishConfig } from '../utils/resolvePublish.js';\nimport { logger } from '../console/logger.js';\n\n/**\n * Publishes files to the CDN if publish config exists and the publishMap is non-empty.\n * Shared by translate, upload, and save-local commands.\n */\nexport async function runPublishWorkflow(\n files: { fileId: string; versionId: string; fileName: string }[],\n publishMap: Map<string, boolean>,\n branchId: string,\n settings: Settings\n): Promise<void> {\n if (publishMap.size === 0 || !hasPublishConfig(settings)) return;\n\n try {\n const allFileRefs = files\n .filter((file) => publishMap.has(file.fileId))\n .map((file) => ({\n fileId: file.fileId,\n versionId: file.versionId,\n branchId,\n publish: publishMap.get(file.fileId)!,\n fileName: file.fileName,\n }));\n if (allFileRefs.length === 0) return;\n const publishStep = new PublishStep(gt);\n await publishStep.run(allFileRefs);\n await publishStep.wait();\n } catch (error) {\n logger.warn(\n `Failed to publish files: ${error instanceof Error ? error.message : String(error)}`\n );\n }\n}\n"],"mappings":";;;;;;;;;AAUA,eAAsB,mBACpB,OACA,YACA,UACA,UACe;AACf,KAAI,WAAW,SAAS,KAAK,CAAC,iBAAiB,SAAS,CAAE;AAE1D,KAAI;EACF,MAAM,cAAc,MACjB,QAAQ,SAAS,WAAW,IAAI,KAAK,OAAO,CAAC,CAC7C,KAAK,UAAU;GACd,QAAQ,KAAK;GACb,WAAW,KAAK;GAChB;GACA,SAAS,WAAW,IAAI,KAAK,OAAO;GACpC,UAAU,KAAK;GAChB,EAAE;AACL,MAAI,YAAY,WAAW,EAAG;EAC9B,MAAM,cAAc,IAAI,YAAY,GAAG;AACvC,QAAM,YAAY,IAAI,YAAY;AAClC,QAAM,YAAY,MAAM;UACjB,OAAO;AACd,SAAO,KACL,4BAA4B,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM,GACnF"}
@@ -1,42 +1,41 @@
1
- import { logErrorAndExit } from '../console/logging.js';
2
- import { gt } from '../utils/gt.js';
3
- import { UploadSourcesStep } from './steps/UploadSourcesStep.js';
4
- import { SetupStep } from './steps/SetupStep.js';
5
- import { BranchStep } from './steps/BranchStep.js';
6
- import { logCollectedFiles } from '../console/logging.js';
7
- import { calculateTimeoutMs } from '../utils/calculateTimeoutMs.js';
1
+ import { gt } from "../utils/gt.js";
2
+ import { logCollectedFiles, logErrorAndExit } from "../console/logging.js";
3
+ import { branchResolutionError, withOriginalError } from "../console/index.js";
4
+ import { BranchStep } from "./steps/BranchStep.js";
5
+ import { UploadSourcesStep } from "./steps/UploadSourcesStep.js";
6
+ import { SetupStep } from "./steps/SetupStep.js";
7
+ import { calculateTimeoutMs } from "../utils/calculateTimeoutMs.js";
8
+ //#region src/workflows/setupProject.ts
8
9
  /**
9
- * Sets up a project by uploading files running the setup step
10
- * @param files - Array of file objects to upload
11
- * @param options - The options for the API call
12
- * @param settings - Settings configuration
13
- * @returns The branch data
14
- */
15
- export async function runSetupProjectWorkflow(files, options, settings) {
16
- try {
17
- // Log files to be translated
18
- logCollectedFiles(files);
19
- // Calculate timeout for setup step
20
- const timeoutMs = calculateTimeoutMs(options.timeout);
21
- // Create workflow with steps
22
- const branchStep = new BranchStep(gt, settings);
23
- const uploadStep = new UploadSourcesStep(gt, settings);
24
- const setupStep = new SetupStep(gt, settings, timeoutMs);
25
- // first run the branch step
26
- const branchData = await branchStep.run();
27
- await branchStep.wait();
28
- if (!branchData) {
29
- return logErrorAndExit('Failed to resolve git branch information.');
30
- }
31
- // then run the upload step
32
- const uploadedFiles = await uploadStep.run({ files, branchData });
33
- await uploadStep.wait();
34
- // then run the setup step
35
- await setupStep.run(uploadedFiles, options.force ?? false);
36
- await setupStep.wait();
37
- return { branchData };
38
- }
39
- catch (error) {
40
- return logErrorAndExit('Failed to run project setup. ' + error);
41
- }
10
+ * Sets up a project by uploading files running the setup step
11
+ * @param files - Array of file objects to upload
12
+ * @param options - The options for the API call
13
+ * @param settings - Settings configuration
14
+ * @returns The branch data
15
+ */
16
+ async function runSetupProjectWorkflow(files, options, settings) {
17
+ try {
18
+ logCollectedFiles(files);
19
+ const timeoutMs = calculateTimeoutMs(options.timeout);
20
+ const branchStep = new BranchStep(gt, settings);
21
+ const uploadStep = new UploadSourcesStep(gt, settings);
22
+ const setupStep = new SetupStep(gt, settings, timeoutMs);
23
+ const branchData = await branchStep.run();
24
+ await branchStep.wait();
25
+ if (!branchData) return logErrorAndExit(branchResolutionError);
26
+ const uploadedFiles = await uploadStep.run({
27
+ files,
28
+ branchData
29
+ });
30
+ await uploadStep.wait();
31
+ await setupStep.run(uploadedFiles, options.force ?? false);
32
+ await setupStep.wait();
33
+ return { branchData };
34
+ } catch (error) {
35
+ return logErrorAndExit(withOriginalError("Project setup could not be completed. Check the files, branch configuration, and API credentials, then try again.", error));
36
+ }
42
37
  }
38
+ //#endregion
39
+ export { runSetupProjectWorkflow };
40
+
41
+ //# sourceMappingURL=setupProject.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setupProject.js","names":[],"sources":["../../src/workflows/setupProject.ts"],"sourcesContent":["import { logErrorAndExit } from '../console/logging.js';\nimport { branchResolutionError, withOriginalError } from '../console/index.js';\nimport { Settings, TranslateFlags } from '../types/index.js';\nimport { gt } from '../utils/gt.js';\nimport { FileToUpload } from 'generaltranslation/types';\nimport { UploadSourcesStep } from './steps/UploadSourcesStep.js';\nimport { SetupStep } from './steps/SetupStep.js';\nimport { BranchStep } from './steps/BranchStep.js';\nimport { BranchData } from '../types/branch.js';\nimport { logCollectedFiles } from '../console/logging.js';\nimport { calculateTimeoutMs } from '../utils/calculateTimeoutMs.js';\n\n/**\n * Sets up a project by uploading files running the setup step\n * @param files - Array of file objects to upload\n * @param options - The options for the API call\n * @param settings - Settings configuration\n * @returns The branch data\n */\nexport async function runSetupProjectWorkflow(\n files: FileToUpload[],\n options: TranslateFlags,\n settings: Settings\n): Promise<{\n branchData: BranchData;\n}> {\n try {\n // Log files to be translated\n logCollectedFiles(files);\n\n // Calculate timeout for setup step\n const timeoutMs = calculateTimeoutMs(options.timeout);\n\n // Create workflow with steps\n const branchStep = new BranchStep(gt, settings);\n const uploadStep = new UploadSourcesStep(gt, settings);\n const setupStep = new SetupStep(gt, settings, timeoutMs);\n\n // first run the branch step\n const branchData = await branchStep.run();\n await branchStep.wait();\n\n if (!branchData) {\n return logErrorAndExit(branchResolutionError);\n }\n\n // then run the upload step\n const uploadedFiles = await uploadStep.run({ files, branchData });\n await uploadStep.wait();\n\n // then run the setup step\n await setupStep.run(uploadedFiles, options.force ?? false);\n await setupStep.wait();\n\n return { branchData };\n } catch (error) {\n return logErrorAndExit(\n withOriginalError(\n 'Project setup could not be completed. Check the files, branch configuration, and API credentials, then try again.',\n error\n )\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;AAmBA,eAAsB,wBACpB,OACA,SACA,UAGC;AACD,KAAI;AAEF,oBAAkB,MAAM;EAGxB,MAAM,YAAY,mBAAmB,QAAQ,QAAQ;EAGrD,MAAM,aAAa,IAAI,WAAW,IAAI,SAAS;EAC/C,MAAM,aAAa,IAAI,kBAAkB,IAAI,SAAS;EACtD,MAAM,YAAY,IAAI,UAAU,IAAI,UAAU,UAAU;EAGxD,MAAM,aAAa,MAAM,WAAW,KAAK;AACzC,QAAM,WAAW,MAAM;AAEvB,MAAI,CAAC,WACH,QAAO,gBAAgB,sBAAsB;EAI/C,MAAM,gBAAgB,MAAM,WAAW,IAAI;GAAE;GAAO;GAAY,CAAC;AACjE,QAAM,WAAW,MAAM;AAGvB,QAAM,UAAU,IAAI,eAAe,QAAQ,SAAS,MAAM;AAC1D,QAAM,UAAU,MAAM;AAEtB,SAAO,EAAE,YAAY;UACd,OAAO;AACd,SAAO,gBACL,kBACE,qHACA,MACD,CACF"}
@@ -1,67 +1,63 @@
1
- import { logCollectedFiles, logErrorAndExit } from '../console/logging.js';
2
- import { logger } from '../console/logger.js';
3
- import { gt } from '../utils/gt.js';
4
- import { UploadSourcesStep } from './steps/UploadSourcesStep.js';
5
- import { SetupStep } from './steps/SetupStep.js';
6
- import { EnqueueStep } from './steps/EnqueueStep.js';
7
- import { BranchStep } from './steps/BranchStep.js';
8
- import { TagStep } from './steps/TagStep.js';
9
- import { UserEditDiffsStep } from './steps/UserEditDiffsStep.js';
10
- import { calculateTimeoutMs } from '../utils/calculateTimeoutMs.js';
1
+ import { logger } from "../console/logger.js";
2
+ import { gt } from "../utils/gt.js";
3
+ import { logCollectedFiles, logErrorAndExit } from "../console/logging.js";
4
+ import { branchResolutionError, withOriginalError } from "../console/index.js";
5
+ import { BranchStep } from "./steps/BranchStep.js";
6
+ import { UploadSourcesStep } from "./steps/UploadSourcesStep.js";
7
+ import { SetupStep } from "./steps/SetupStep.js";
8
+ import { EnqueueStep } from "./steps/EnqueueStep.js";
9
+ import { TagStep } from "./steps/TagStep.js";
10
+ import { UserEditDiffsStep } from "./steps/UserEditDiffsStep.js";
11
+ import { calculateTimeoutMs } from "../utils/calculateTimeoutMs.js";
12
+ //#region src/workflows/stage.ts
11
13
  /**
12
- * Sends multiple files for translation to the API using a workflow pattern
13
- * @param files - Array of file objects to translate
14
- * @param options - The options for the API call
15
- * @param settings - Settings configuration
16
- * @returns The translated content or version ID
17
- */
18
- export async function runStageFilesWorkflow({ files, options, settings, }) {
19
- try {
20
- // Log files to be translated
21
- logCollectedFiles(files);
22
- // Calculate timeout for setup step
23
- const timeoutMs = calculateTimeoutMs(options.timeout);
24
- // Create workflow with steps
25
- const branchStep = new BranchStep(gt, settings);
26
- const uploadStep = new UploadSourcesStep(gt, settings);
27
- const userEditDiffsStep = new UserEditDiffsStep(settings);
28
- const setupStep = new SetupStep(gt, settings, timeoutMs);
29
- const enqueueStep = new EnqueueStep(gt, settings, options.force);
30
- // first run the branch step
31
- const branchData = await branchStep.run();
32
- await branchStep.wait();
33
- if (!branchData) {
34
- return logErrorAndExit('Failed to resolve git branch information.');
35
- }
36
- // then run the upload step
37
- const uploadedFiles = await uploadStep.run({ files, branchData });
38
- await uploadStep.wait();
39
- // optionally run the user edit diffs step
40
- if (options?.saveLocal) {
41
- await userEditDiffsStep.run(uploadedFiles);
42
- await userEditDiffsStep.wait();
43
- }
44
- // then run the tag step (non-fatal — tagging failure should not block translations)
45
- if (settings.tag) {
46
- try {
47
- const userProvidedTag = !!options.tag;
48
- const tagStep = new TagStep(gt, settings, userProvidedTag);
49
- await tagStep.run(uploadedFiles);
50
- await tagStep.wait();
51
- }
52
- catch {
53
- logger.warn('Failed to create translation tag. Continuing...');
54
- }
55
- }
56
- // then run the setup step
57
- await setupStep.run(uploadedFiles);
58
- await setupStep.wait();
59
- // then run the enqueue step
60
- const enqueueResult = await enqueueStep.run(uploadedFiles);
61
- await enqueueStep.wait();
62
- return { branchData, enqueueResult };
63
- }
64
- catch (error) {
65
- return logErrorAndExit('Failed to send files for translation. ' + error);
66
- }
14
+ * Sends multiple files for translation to the API using a workflow pattern
15
+ * @param files - Array of file objects to translate
16
+ * @param options - The options for the API call
17
+ * @param settings - Settings configuration
18
+ * @returns The translated content or version ID
19
+ */
20
+ async function runStageFilesWorkflow({ files, options, settings }) {
21
+ try {
22
+ logCollectedFiles(files);
23
+ const timeoutMs = calculateTimeoutMs(options.timeout);
24
+ const branchStep = new BranchStep(gt, settings);
25
+ const uploadStep = new UploadSourcesStep(gt, settings);
26
+ const userEditDiffsStep = new UserEditDiffsStep(settings);
27
+ const setupStep = new SetupStep(gt, settings, timeoutMs);
28
+ const enqueueStep = new EnqueueStep(gt, settings, options.force);
29
+ const branchData = await branchStep.run();
30
+ await branchStep.wait();
31
+ if (!branchData) return logErrorAndExit(branchResolutionError);
32
+ const uploadedFiles = await uploadStep.run({
33
+ files,
34
+ branchData
35
+ });
36
+ await uploadStep.wait();
37
+ if (options?.saveLocal) {
38
+ await userEditDiffsStep.run(uploadedFiles);
39
+ await userEditDiffsStep.wait();
40
+ }
41
+ if (settings.tag) try {
42
+ const tagStep = new TagStep(gt, settings, !!options.tag);
43
+ await tagStep.run(uploadedFiles);
44
+ await tagStep.wait();
45
+ } catch {
46
+ logger.warn("Failed to create translation tag. Continuing...");
47
+ }
48
+ await setupStep.run(uploadedFiles);
49
+ await setupStep.wait();
50
+ const enqueueResult = await enqueueStep.run(uploadedFiles);
51
+ await enqueueStep.wait();
52
+ return {
53
+ branchData,
54
+ enqueueResult
55
+ };
56
+ } catch (error) {
57
+ return logErrorAndExit(withOriginalError("Files could not be sent for translation. Check the files, branch configuration, and API credentials, then try again.", error));
58
+ }
67
59
  }
60
+ //#endregion
61
+ export { runStageFilesWorkflow };
62
+
63
+ //# sourceMappingURL=stage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stage.js","names":[],"sources":["../../src/workflows/stage.ts"],"sourcesContent":["import { logCollectedFiles, logErrorAndExit } from '../console/logging.js';\nimport { branchResolutionError, withOriginalError } from '../console/index.js';\nimport { logger } from '../console/logger.js';\nimport { Settings, TranslateFlags } from '../types/index.js';\nimport { gt } from '../utils/gt.js';\nimport { EnqueueFilesResult, FileToUpload } from 'generaltranslation/types';\nimport { UploadSourcesStep } from './steps/UploadSourcesStep.js';\nimport { SetupStep } from './steps/SetupStep.js';\nimport { EnqueueStep } from './steps/EnqueueStep.js';\nimport { BranchStep } from './steps/BranchStep.js';\nimport { TagStep } from './steps/TagStep.js';\nimport { UserEditDiffsStep } from './steps/UserEditDiffsStep.js';\nimport { BranchData } from '../types/branch.js';\nimport { calculateTimeoutMs } from '../utils/calculateTimeoutMs.js';\n\n/**\n * Sends multiple files for translation to the API using a workflow pattern\n * @param files - Array of file objects to translate\n * @param options - The options for the API call\n * @param settings - Settings configuration\n * @returns The translated content or version ID\n */\nexport async function runStageFilesWorkflow({\n files,\n options,\n settings,\n}: {\n files: FileToUpload[];\n options: TranslateFlags;\n settings: Settings;\n}): Promise<{\n branchData: BranchData;\n enqueueResult: EnqueueFilesResult;\n}> {\n try {\n // Log files to be translated\n logCollectedFiles(files);\n\n // Calculate timeout for setup step\n const timeoutMs = calculateTimeoutMs(options.timeout);\n\n // Create workflow with steps\n const branchStep = new BranchStep(gt, settings);\n const uploadStep = new UploadSourcesStep(gt, settings);\n const userEditDiffsStep = new UserEditDiffsStep(settings);\n const setupStep = new SetupStep(gt, settings, timeoutMs);\n const enqueueStep = new EnqueueStep(gt, settings, options.force);\n\n // first run the branch step\n const branchData = await branchStep.run();\n await branchStep.wait();\n if (!branchData) {\n return logErrorAndExit(branchResolutionError);\n }\n\n // then run the upload step\n const uploadedFiles = await uploadStep.run({ files, branchData });\n await uploadStep.wait();\n\n // optionally run the user edit diffs step\n if (options?.saveLocal) {\n await userEditDiffsStep.run(uploadedFiles);\n await userEditDiffsStep.wait();\n }\n\n // then run the tag step (non-fatal — tagging failure should not block translations)\n if (settings.tag) {\n try {\n const userProvidedTag = !!options.tag;\n const tagStep = new TagStep(gt, settings, userProvidedTag);\n await tagStep.run(uploadedFiles);\n await tagStep.wait();\n } catch {\n logger.warn('Failed to create translation tag. Continuing...');\n }\n }\n\n // then run the setup step\n await setupStep.run(uploadedFiles);\n await setupStep.wait();\n\n // then run the enqueue step\n const enqueueResult = await enqueueStep.run(uploadedFiles);\n await enqueueStep.wait();\n\n return { branchData, enqueueResult };\n } catch (error) {\n return logErrorAndExit(\n withOriginalError(\n 'Files could not be sent for translation. Check the files, branch configuration, and API credentials, then try again.',\n error\n )\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAsBA,eAAsB,sBAAsB,EAC1C,OACA,SACA,YAQC;AACD,KAAI;AAEF,oBAAkB,MAAM;EAGxB,MAAM,YAAY,mBAAmB,QAAQ,QAAQ;EAGrD,MAAM,aAAa,IAAI,WAAW,IAAI,SAAS;EAC/C,MAAM,aAAa,IAAI,kBAAkB,IAAI,SAAS;EACtD,MAAM,oBAAoB,IAAI,kBAAkB,SAAS;EACzD,MAAM,YAAY,IAAI,UAAU,IAAI,UAAU,UAAU;EACxD,MAAM,cAAc,IAAI,YAAY,IAAI,UAAU,QAAQ,MAAM;EAGhE,MAAM,aAAa,MAAM,WAAW,KAAK;AACzC,QAAM,WAAW,MAAM;AACvB,MAAI,CAAC,WACH,QAAO,gBAAgB,sBAAsB;EAI/C,MAAM,gBAAgB,MAAM,WAAW,IAAI;GAAE;GAAO;GAAY,CAAC;AACjE,QAAM,WAAW,MAAM;AAGvB,MAAI,SAAS,WAAW;AACtB,SAAM,kBAAkB,IAAI,cAAc;AAC1C,SAAM,kBAAkB,MAAM;;AAIhC,MAAI,SAAS,IACX,KAAI;GAEF,MAAM,UAAU,IAAI,QAAQ,IAAI,UAAU,CADjB,CAAC,QAAQ,IACwB;AAC1D,SAAM,QAAQ,IAAI,cAAc;AAChC,SAAM,QAAQ,MAAM;UACd;AACN,UAAO,KAAK,kDAAkD;;AAKlE,QAAM,UAAU,IAAI,cAAc;AAClC,QAAM,UAAU,MAAM;EAGtB,MAAM,gBAAgB,MAAM,YAAY,IAAI,cAAc;AAC1D,QAAM,YAAY,MAAM;AAExB,SAAO;GAAE;GAAY;GAAe;UAC7B,OAAO;AACd,SAAO,gBACL,kBACE,wHACA,MACD,CACF"}
@@ -1,163 +1,118 @@
1
- import { WorkflowStep } from './WorkflowStep.js';
2
- import { logErrorAndExit } from '../../console/logging.js';
3
- import { logger } from '../../console/logger.js';
4
- import chalk from 'chalk';
5
- import { getCurrentBranch, getIncomingBranches, getCheckedOutBranches, } from '../../git/branches.js';
6
- import { ApiError } from 'generaltranslation/errors';
7
- // Step 1: Resolve the current branch id & update API with branch information
8
- export class BranchStep extends WorkflowStep {
9
- spinner = logger.createSpinner('dots');
10
- branchData;
11
- settings;
12
- gt;
13
- constructor(gt, settings) {
14
- super();
15
- this.gt = gt;
16
- this.settings = settings;
17
- this.branchData = {
18
- currentBranch: {
19
- id: '',
20
- name: '',
21
- },
22
- incomingBranch: null,
23
- checkedOutBranch: null,
24
- };
25
- }
26
- async run() {
27
- this.spinner.start(`Resolving branch information...`);
28
- // First get some info about the branches we're working with
29
- let current = null;
30
- let incoming = [];
31
- let checkedOut = [];
32
- let useDefaultBranch = true;
33
- let detectedDefaultBranchName = 'main';
34
- let autoDetectFailed = !this.settings.branchOptions.autoDetectBranches;
35
- if (this.settings.branchOptions.enabled &&
36
- this.settings.branchOptions.autoDetectBranches) {
37
- const [currentResult, incomingResult, checkedOutResult] = await Promise.all([
38
- getCurrentBranch(this.settings.branchOptions.remoteName),
39
- getIncomingBranches(this.settings.branchOptions.remoteName),
40
- getCheckedOutBranches(this.settings.branchOptions.remoteName),
41
- ]);
42
- current = currentResult;
43
- incoming = incomingResult;
44
- checkedOut = checkedOutResult;
45
- if (currentResult) {
46
- detectedDefaultBranchName = currentResult.defaultBranchName;
47
- }
48
- // Try env var detection if git commands failed (e.g. Vercel)
49
- if (!currentResult) {
50
- autoDetectFailed = true;
51
- const vercelBranch = process.env.VERCEL_GIT_COMMIT_REF;
52
- if (vercelBranch) {
53
- current = { currentBranchName: vercelBranch, defaultBranch: false };
54
- }
55
- }
56
- // If detection succeeded, use the detected branch; otherwise fall back to default
57
- if (current) {
58
- useDefaultBranch = false;
59
- }
60
- }
61
- if (this.settings.branchOptions.enabled &&
62
- this.settings.branchOptions.currentBranch) {
63
- current = {
64
- currentBranchName: this.settings.branchOptions.currentBranch,
65
- defaultBranch: current?.defaultBranch ?? false, // we have no way of knowing if this is the default branch without using the auto-detection logic
66
- };
67
- useDefaultBranch = false;
68
- }
69
- const branchData = await this.gt.queryBranchData({
70
- branchNames: [
71
- ...(current ? [current.currentBranchName] : []),
72
- ...incoming,
73
- ...checkedOut,
74
- ],
75
- });
76
- if (useDefaultBranch) {
77
- if (autoDetectFailed) {
78
- logger.warn('Branch auto-detection failed. Falling back to the default branch. Use --branch to specify a branch manually.');
79
- }
80
- if (!branchData.defaultBranch) {
81
- const createBranchResult = await this.gt.createBranch({
82
- branchName: detectedDefaultBranchName,
83
- defaultBranch: true,
84
- });
85
- this.branchData.currentBranch = createBranchResult.branch;
86
- }
87
- else {
88
- this.branchData.currentBranch = branchData.defaultBranch;
89
- }
90
- }
91
- else {
92
- if (!current) {
93
- return logErrorAndExit('Failed to determine the current branch. Specify a custom branch or enable automatic branch detection.');
94
- }
95
- const currentBranch = branchData.branches.find((b) => b.name === current.currentBranchName);
96
- if (!currentBranch) {
97
- try {
98
- const createBranchResult = await this.gt.createBranch({
99
- branchName: current.currentBranchName,
100
- defaultBranch: current.defaultBranch,
101
- });
102
- this.branchData.currentBranch = createBranchResult.branch;
103
- }
104
- catch (error) {
105
- if (error instanceof ApiError && error.code === 403) {
106
- logger.warn('To enable translation branching, upgrade your plan. Falling back to default branch.');
107
- // retry with default branch
108
- try {
109
- const createBranchResult = await this.gt.createBranch({
110
- branchName: detectedDefaultBranchName,
111
- defaultBranch: true,
112
- });
113
- this.branchData.currentBranch = createBranchResult.branch;
114
- }
115
- catch {
116
- // The fallback branch may already exist.
117
- }
118
- }
119
- }
120
- }
121
- else {
122
- this.branchData.currentBranch = currentBranch;
123
- }
124
- }
125
- if (this.branchData.currentBranch.id === '') {
126
- return logErrorAndExit('Something went wrong while resolving branch information. Try again.');
127
- }
128
- // Now set the incoming and checked out branches (first one that exists)
129
- this.branchData.incomingBranch =
130
- incoming
131
- .map((b) => {
132
- const branch = branchData.branches.find((bb) => bb.name === b);
133
- if (branch) {
134
- return branch;
135
- }
136
- else {
137
- return null;
138
- }
139
- })
140
- .filter((b) => b !== null)[0] ?? null;
141
- this.branchData.checkedOutBranch =
142
- checkedOut
143
- .map((b) => {
144
- const branch = branchData.branches.find((bb) => bb.name === b);
145
- if (branch) {
146
- return branch;
147
- }
148
- else {
149
- return null;
150
- }
151
- })
152
- .filter((b) => b !== null)[0] ?? null;
153
- // ALWAYS fallback to default branch for checked out branch (to avoid retranslation)
154
- if (!this.branchData.checkedOutBranch && branchData.defaultBranch) {
155
- this.branchData.checkedOutBranch = branchData.defaultBranch;
156
- }
157
- this.spinner.stop(chalk.green('Branch information resolved successfully'));
158
- return this.branchData;
159
- }
160
- async wait() {
161
- return;
162
- }
163
- }
1
+ import { logger } from "../../console/logger.js";
2
+ import { logErrorAndExit } from "../../console/logging.js";
3
+ import { WorkflowStep } from "./WorkflowStep.js";
4
+ import { getCheckedOutBranches, getCurrentBranch, getIncomingBranches } from "../../git/branches.js";
5
+ import chalk from "chalk";
6
+ import { ApiError } from "generaltranslation/errors";
7
+ //#region src/workflows/steps/BranchStep.ts
8
+ var BranchStep = class extends WorkflowStep {
9
+ spinner = logger.createSpinner("dots");
10
+ branchData;
11
+ settings;
12
+ gt;
13
+ constructor(gt, settings) {
14
+ super();
15
+ this.gt = gt;
16
+ this.settings = settings;
17
+ this.branchData = {
18
+ currentBranch: {
19
+ id: "",
20
+ name: ""
21
+ },
22
+ incomingBranch: null,
23
+ checkedOutBranch: null
24
+ };
25
+ }
26
+ async run() {
27
+ this.spinner.start(`Resolving branch information...`);
28
+ let current = null;
29
+ let incoming = [];
30
+ let checkedOut = [];
31
+ let useDefaultBranch = true;
32
+ let detectedDefaultBranchName = "main";
33
+ let autoDetectFailed = !this.settings.branchOptions.autoDetectBranches;
34
+ if (this.settings.branchOptions.enabled && this.settings.branchOptions.autoDetectBranches) {
35
+ const [currentResult, incomingResult, checkedOutResult] = await Promise.all([
36
+ getCurrentBranch(this.settings.branchOptions.remoteName),
37
+ getIncomingBranches(this.settings.branchOptions.remoteName),
38
+ getCheckedOutBranches(this.settings.branchOptions.remoteName)
39
+ ]);
40
+ current = currentResult;
41
+ incoming = incomingResult;
42
+ checkedOut = checkedOutResult;
43
+ if (currentResult) detectedDefaultBranchName = currentResult.defaultBranchName;
44
+ if (!currentResult) {
45
+ autoDetectFailed = true;
46
+ const vercelBranch = process.env.VERCEL_GIT_COMMIT_REF;
47
+ if (vercelBranch) current = {
48
+ currentBranchName: vercelBranch,
49
+ defaultBranch: false
50
+ };
51
+ }
52
+ if (current) useDefaultBranch = false;
53
+ }
54
+ if (this.settings.branchOptions.enabled && this.settings.branchOptions.currentBranch) {
55
+ current = {
56
+ currentBranchName: this.settings.branchOptions.currentBranch,
57
+ defaultBranch: current?.defaultBranch ?? false
58
+ };
59
+ useDefaultBranch = false;
60
+ }
61
+ const branchData = await this.gt.queryBranchData({ branchNames: [
62
+ ...current ? [current.currentBranchName] : [],
63
+ ...incoming,
64
+ ...checkedOut
65
+ ] });
66
+ if (useDefaultBranch) {
67
+ if (autoDetectFailed) logger.warn("Branch auto-detection failed. Falling back to the default branch. Use --branch to specify a branch manually.");
68
+ if (!branchData.defaultBranch) {
69
+ const createBranchResult = await this.gt.createBranch({
70
+ branchName: detectedDefaultBranchName,
71
+ defaultBranch: true
72
+ });
73
+ this.branchData.currentBranch = createBranchResult.branch;
74
+ } else this.branchData.currentBranch = branchData.defaultBranch;
75
+ } else {
76
+ if (!current) return logErrorAndExit("The current git branch could not be determined. Specify a custom branch or enable automatic branch detection.");
77
+ const currentBranch = branchData.branches.find((b) => b.name === current.currentBranchName);
78
+ if (!currentBranch) try {
79
+ const createBranchResult = await this.gt.createBranch({
80
+ branchName: current.currentBranchName,
81
+ defaultBranch: current.defaultBranch
82
+ });
83
+ this.branchData.currentBranch = createBranchResult.branch;
84
+ } catch (error) {
85
+ if (error instanceof ApiError && error.code === 403) {
86
+ logger.warn("To enable translation branching, upgrade your plan. Falling back to default branch.");
87
+ try {
88
+ const createBranchResult = await this.gt.createBranch({
89
+ branchName: detectedDefaultBranchName,
90
+ defaultBranch: true
91
+ });
92
+ this.branchData.currentBranch = createBranchResult.branch;
93
+ } catch {}
94
+ }
95
+ }
96
+ else this.branchData.currentBranch = currentBranch;
97
+ }
98
+ if (this.branchData.currentBranch.id === "") return logErrorAndExit("Something went wrong while resolving branch information. Try again.");
99
+ this.branchData.incomingBranch = incoming.map((b) => {
100
+ const branch = branchData.branches.find((bb) => bb.name === b);
101
+ if (branch) return branch;
102
+ else return null;
103
+ }).filter((b) => b !== null)[0] ?? null;
104
+ this.branchData.checkedOutBranch = checkedOut.map((b) => {
105
+ const branch = branchData.branches.find((bb) => bb.name === b);
106
+ if (branch) return branch;
107
+ else return null;
108
+ }).filter((b) => b !== null)[0] ?? null;
109
+ if (!this.branchData.checkedOutBranch && branchData.defaultBranch) this.branchData.checkedOutBranch = branchData.defaultBranch;
110
+ this.spinner.stop(chalk.green("Branch information resolved successfully"));
111
+ return this.branchData;
112
+ }
113
+ async wait() {}
114
+ };
115
+ //#endregion
116
+ export { BranchStep };
117
+
118
+ //# sourceMappingURL=BranchStep.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BranchStep.js","names":[],"sources":["../../../src/workflows/steps/BranchStep.ts"],"sourcesContent":["import { WorkflowStep } from './WorkflowStep.js';\nimport { logErrorAndExit } from '../../console/logging.js';\nimport { logger } from '../../console/logger.js';\nimport type { GT } from 'generaltranslation';\nimport type { Settings } from '../../types/index.js';\nimport chalk from 'chalk';\nimport {\n getCurrentBranch,\n getIncomingBranches,\n getCheckedOutBranches,\n} from '../../git/branches.js';\nimport { BranchData } from '../../types/branch.js';\nimport { ApiError } from 'generaltranslation/errors';\n\ntype BranchStepClient = Pick<GT, 'queryBranchData' | 'createBranch'>;\ntype BranchStepSettings = Pick<Settings, 'branchOptions'>;\n\n// Step 1: Resolve the current branch id & update API with branch information\nexport class BranchStep extends WorkflowStep<null, BranchData | null> {\n private spinner = logger.createSpinner('dots');\n private branchData: BranchData;\n private settings: BranchStepSettings;\n private gt: BranchStepClient;\n\n constructor(gt: BranchStepClient, settings: BranchStepSettings) {\n super();\n this.gt = gt;\n this.settings = settings;\n this.branchData = {\n currentBranch: {\n id: '',\n name: '',\n },\n incomingBranch: null,\n checkedOutBranch: null,\n };\n }\n\n async run(): Promise<BranchData | null> {\n this.spinner.start(`Resolving branch information...`);\n\n // First get some info about the branches we're working with\n let current: {\n currentBranchName: string;\n defaultBranch: boolean;\n } | null = null;\n let incoming: string[] = [];\n let checkedOut: string[] = [];\n let useDefaultBranch: boolean = true;\n let detectedDefaultBranchName: string = 'main';\n let autoDetectFailed = !this.settings.branchOptions.autoDetectBranches;\n\n if (\n this.settings.branchOptions.enabled &&\n this.settings.branchOptions.autoDetectBranches\n ) {\n const [currentResult, incomingResult, checkedOutResult] =\n await Promise.all([\n getCurrentBranch(this.settings.branchOptions.remoteName),\n getIncomingBranches(this.settings.branchOptions.remoteName),\n getCheckedOutBranches(this.settings.branchOptions.remoteName),\n ]);\n current = currentResult;\n incoming = incomingResult;\n checkedOut = checkedOutResult;\n\n if (currentResult) {\n detectedDefaultBranchName = currentResult.defaultBranchName;\n }\n\n // Try env var detection if git commands failed (e.g. Vercel)\n if (!currentResult) {\n autoDetectFailed = true;\n const vercelBranch = process.env.VERCEL_GIT_COMMIT_REF;\n if (vercelBranch) {\n current = { currentBranchName: vercelBranch, defaultBranch: false };\n }\n }\n\n // If detection succeeded, use the detected branch; otherwise fall back to default\n if (current) {\n useDefaultBranch = false;\n }\n }\n if (\n this.settings.branchOptions.enabled &&\n this.settings.branchOptions.currentBranch\n ) {\n current = {\n currentBranchName: this.settings.branchOptions.currentBranch,\n defaultBranch: current?.defaultBranch ?? false, // we have no way of knowing if this is the default branch without using the auto-detection logic\n };\n useDefaultBranch = false;\n }\n\n const branchData = await this.gt.queryBranchData({\n branchNames: [\n ...(current ? [current.currentBranchName] : []),\n ...incoming,\n ...checkedOut,\n ],\n });\n\n if (useDefaultBranch) {\n if (autoDetectFailed) {\n logger.warn(\n 'Branch auto-detection failed. Falling back to the default branch. Use --branch to specify a branch manually.'\n );\n }\n if (!branchData.defaultBranch) {\n const createBranchResult = await this.gt.createBranch({\n branchName: detectedDefaultBranchName,\n defaultBranch: true,\n });\n this.branchData.currentBranch = createBranchResult.branch;\n } else {\n this.branchData.currentBranch = branchData.defaultBranch;\n }\n } else {\n if (!current) {\n return logErrorAndExit(\n 'The current git branch could not be determined. Specify a custom branch or enable automatic branch detection.'\n );\n }\n const currentBranch = branchData.branches.find(\n (b) => b.name === current.currentBranchName\n );\n if (!currentBranch) {\n try {\n const createBranchResult = await this.gt.createBranch({\n branchName: current.currentBranchName,\n defaultBranch: current.defaultBranch,\n });\n this.branchData.currentBranch = createBranchResult.branch;\n } catch (error) {\n if (error instanceof ApiError && error.code === 403) {\n logger.warn(\n 'To enable translation branching, upgrade your plan. Falling back to default branch.'\n );\n // retry with default branch\n try {\n const createBranchResult = await this.gt.createBranch({\n branchName: detectedDefaultBranchName,\n defaultBranch: true,\n });\n this.branchData.currentBranch = createBranchResult.branch;\n } catch {\n // The fallback branch may already exist.\n }\n }\n }\n } else {\n this.branchData.currentBranch = currentBranch;\n }\n }\n\n if (this.branchData.currentBranch.id === '') {\n return logErrorAndExit(\n 'Something went wrong while resolving branch information. Try again.'\n );\n }\n\n // Now set the incoming and checked out branches (first one that exists)\n this.branchData.incomingBranch =\n incoming\n .map((b) => {\n const branch = branchData.branches.find((bb) => bb.name === b);\n if (branch) {\n return branch;\n } else {\n return null;\n }\n })\n .filter((b) => b !== null)[0] ?? null;\n this.branchData.checkedOutBranch =\n checkedOut\n .map((b) => {\n const branch = branchData.branches.find((bb) => bb.name === b);\n if (branch) {\n return branch;\n } else {\n return null;\n }\n })\n .filter((b) => b !== null)[0] ?? null;\n\n // ALWAYS fallback to default branch for checked out branch (to avoid retranslation)\n if (!this.branchData.checkedOutBranch && branchData.defaultBranch) {\n this.branchData.checkedOutBranch = branchData.defaultBranch;\n }\n\n this.spinner.stop(chalk.green('Branch information resolved successfully'));\n\n return this.branchData;\n }\n\n async wait(): Promise<void> {\n return;\n }\n}\n"],"mappings":";;;;;;;AAkBA,IAAa,aAAb,cAAgC,aAAsC;CACpE,UAAkB,OAAO,cAAc,OAAO;CAC9C;CACA;CACA;CAEA,YAAY,IAAsB,UAA8B;AAC9D,SAAO;AACP,OAAK,KAAK;AACV,OAAK,WAAW;AAChB,OAAK,aAAa;GAChB,eAAe;IACb,IAAI;IACJ,MAAM;IACP;GACD,gBAAgB;GAChB,kBAAkB;GACnB;;CAGH,MAAM,MAAkC;AACtC,OAAK,QAAQ,MAAM,kCAAkC;EAGrD,IAAI,UAGO;EACX,IAAI,WAAqB,EAAE;EAC3B,IAAI,aAAuB,EAAE;EAC7B,IAAI,mBAA4B;EAChC,IAAI,4BAAoC;EACxC,IAAI,mBAAmB,CAAC,KAAK,SAAS,cAAc;AAEpD,MACE,KAAK,SAAS,cAAc,WAC5B,KAAK,SAAS,cAAc,oBAC5B;GACA,MAAM,CAAC,eAAe,gBAAgB,oBACpC,MAAM,QAAQ,IAAI;IAChB,iBAAiB,KAAK,SAAS,cAAc,WAAW;IACxD,oBAAoB,KAAK,SAAS,cAAc,WAAW;IAC3D,sBAAsB,KAAK,SAAS,cAAc,WAAW;IAC9D,CAAC;AACJ,aAAU;AACV,cAAW;AACX,gBAAa;AAEb,OAAI,cACF,6BAA4B,cAAc;AAI5C,OAAI,CAAC,eAAe;AAClB,uBAAmB;IACnB,MAAM,eAAe,QAAQ,IAAI;AACjC,QAAI,aACF,WAAU;KAAE,mBAAmB;KAAc,eAAe;KAAO;;AAKvE,OAAI,QACF,oBAAmB;;AAGvB,MACE,KAAK,SAAS,cAAc,WAC5B,KAAK,SAAS,cAAc,eAC5B;AACA,aAAU;IACR,mBAAmB,KAAK,SAAS,cAAc;IAC/C,eAAe,SAAS,iBAAiB;IAC1C;AACD,sBAAmB;;EAGrB,MAAM,aAAa,MAAM,KAAK,GAAG,gBAAgB,EAC/C,aAAa;GACX,GAAI,UAAU,CAAC,QAAQ,kBAAkB,GAAG,EAAE;GAC9C,GAAG;GACH,GAAG;GACJ,EACF,CAAC;AAEF,MAAI,kBAAkB;AACpB,OAAI,iBACF,QAAO,KACL,+GACD;AAEH,OAAI,CAAC,WAAW,eAAe;IAC7B,MAAM,qBAAqB,MAAM,KAAK,GAAG,aAAa;KACpD,YAAY;KACZ,eAAe;KAChB,CAAC;AACF,SAAK,WAAW,gBAAgB,mBAAmB;SAEnD,MAAK,WAAW,gBAAgB,WAAW;SAExC;AACL,OAAI,CAAC,QACH,QAAO,gBACL,gHACD;GAEH,MAAM,gBAAgB,WAAW,SAAS,MACvC,MAAM,EAAE,SAAS,QAAQ,kBAC3B;AACD,OAAI,CAAC,cACH,KAAI;IACF,MAAM,qBAAqB,MAAM,KAAK,GAAG,aAAa;KACpD,YAAY,QAAQ;KACpB,eAAe,QAAQ;KACxB,CAAC;AACF,SAAK,WAAW,gBAAgB,mBAAmB;YAC5C,OAAO;AACd,QAAI,iBAAiB,YAAY,MAAM,SAAS,KAAK;AACnD,YAAO,KACL,sFACD;AAED,SAAI;MACF,MAAM,qBAAqB,MAAM,KAAK,GAAG,aAAa;OACpD,YAAY;OACZ,eAAe;OAChB,CAAC;AACF,WAAK,WAAW,gBAAgB,mBAAmB;aAC7C;;;OAMZ,MAAK,WAAW,gBAAgB;;AAIpC,MAAI,KAAK,WAAW,cAAc,OAAO,GACvC,QAAO,gBACL,sEACD;AAIH,OAAK,WAAW,iBACd,SACG,KAAK,MAAM;GACV,MAAM,SAAS,WAAW,SAAS,MAAM,OAAO,GAAG,SAAS,EAAE;AAC9D,OAAI,OACF,QAAO;OAEP,QAAO;IAET,CACD,QAAQ,MAAM,MAAM,KAAK,CAAC,MAAM;AACrC,OAAK,WAAW,mBACd,WACG,KAAK,MAAM;GACV,MAAM,SAAS,WAAW,SAAS,MAAM,OAAO,GAAG,SAAS,EAAE;AAC9D,OAAI,OACF,QAAO;OAEP,QAAO;IAET,CACD,QAAQ,MAAM,MAAM,KAAK,CAAC,MAAM;AAGrC,MAAI,CAAC,KAAK,WAAW,oBAAoB,WAAW,cAClD,MAAK,WAAW,mBAAmB,WAAW;AAGhD,OAAK,QAAQ,KAAK,MAAM,MAAM,2CAA2C,CAAC;AAE1E,SAAO,KAAK;;CAGd,MAAM,OAAsB"}