@kmlckj/licos-ai-cli 0.0.1

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 (734) hide show
  1. package/README.md +124 -0
  2. package/bin/main +2 -0
  3. package/lib/__templates__/expo/.licos +12 -0
  4. package/lib/__templates__/expo/.licosproj/scripts/dev_build.sh +46 -0
  5. package/lib/__templates__/expo/.licosproj/scripts/dev_run.sh +229 -0
  6. package/lib/__templates__/expo/.licosproj/scripts/prod_build.sh +47 -0
  7. package/lib/__templates__/expo/.licosproj/scripts/prod_run.sh +34 -0
  8. package/lib/__templates__/expo/.licosproj/scripts/server_dev_run.sh +46 -0
  9. package/lib/__templates__/expo/AGENTS.md +253 -0
  10. package/lib/__templates__/expo/README.md +253 -0
  11. package/lib/__templates__/expo/_gitignore +12 -0
  12. package/lib/__templates__/expo/_npmrc +24 -0
  13. package/lib/__templates__/expo/client/app/+not-found.tsx +15 -0
  14. package/lib/__templates__/expo/client/app/_layout.tsx +30 -0
  15. package/lib/__templates__/expo/client/app/index.tsx +1 -0
  16. package/lib/__templates__/expo/client/app.config.ts +76 -0
  17. package/lib/__templates__/expo/client/assets/fonts/SpaceMono-Regular.ttf +0 -0
  18. package/lib/__templates__/expo/client/assets/images/adaptive-icon.png +0 -0
  19. package/lib/__templates__/expo/client/assets/images/default-avatar.png +0 -0
  20. package/lib/__templates__/expo/client/assets/images/favicon.png +0 -0
  21. package/lib/__templates__/expo/client/assets/images/icon.png +0 -0
  22. package/lib/__templates__/expo/client/assets/images/partial-react-logo.png +0 -0
  23. package/lib/__templates__/expo/client/assets/images/react-logo.png +0 -0
  24. package/lib/__templates__/expo/client/assets/images/react-logo@2x.png +0 -0
  25. package/lib/__templates__/expo/client/assets/images/react-logo@3x.png +0 -0
  26. package/lib/__templates__/expo/client/assets/images/splash-icon.png +0 -0
  27. package/lib/__templates__/expo/client/components/ColorSchemeUpdater.tsx +43 -0
  28. package/lib/__templates__/expo/client/components/PrettyScrollbar.tsx +43 -0
  29. package/lib/__templates__/expo/client/components/Provider.tsx +24 -0
  30. package/lib/__templates__/expo/client/components/Screen.tsx +317 -0
  31. package/lib/__templates__/expo/client/components/SmartDateInput.tsx +238 -0
  32. package/lib/__templates__/expo/client/contexts/AuthContext.tsx +55 -0
  33. package/lib/__templates__/expo/client/declarations.d.ts +5 -0
  34. package/lib/__templates__/expo/client/eslint-formatter-simple.mjs +49 -0
  35. package/lib/__templates__/expo/client/eslint.config.mjs +134 -0
  36. package/lib/__templates__/expo/client/global.css +268 -0
  37. package/lib/__templates__/expo/client/heroui/components/accordion/accordion.animation.ts +178 -0
  38. package/lib/__templates__/expo/client/heroui/components/accordion/accordion.constants.ts +62 -0
  39. package/lib/__templates__/expo/client/heroui/components/accordion/accordion.md +437 -0
  40. package/lib/__templates__/expo/client/heroui/components/accordion/accordion.styles.ts +95 -0
  41. package/lib/__templates__/expo/client/heroui/components/accordion/accordion.tsx +340 -0
  42. package/lib/__templates__/expo/client/heroui/components/accordion/accordion.types.ts +267 -0
  43. package/lib/__templates__/expo/client/heroui/components/accordion/index.ts +17 -0
  44. package/lib/__templates__/expo/client/heroui/components/alert/alert.constants.ts +13 -0
  45. package/lib/__templates__/expo/client/heroui/components/alert/alert.hooks.ts +28 -0
  46. package/lib/__templates__/expo/client/heroui/components/alert/alert.md +263 -0
  47. package/lib/__templates__/expo/client/heroui/components/alert/alert.styles.ts +65 -0
  48. package/lib/__templates__/expo/client/heroui/components/alert/alert.tsx +181 -0
  49. package/lib/__templates__/expo/client/heroui/components/alert/alert.types.ts +99 -0
  50. package/lib/__templates__/expo/client/heroui/components/alert/alert.utils.tsx +25 -0
  51. package/lib/__templates__/expo/client/heroui/components/alert/default-icon.tsx +28 -0
  52. package/lib/__templates__/expo/client/heroui/components/alert/index.ts +15 -0
  53. package/lib/__templates__/expo/client/heroui/components/alert/success-icon.tsx +28 -0
  54. package/lib/__templates__/expo/client/heroui/components/alert/warning-icon.tsx +28 -0
  55. package/lib/__templates__/expo/client/heroui/components/avatar/avatar.animation.ts +123 -0
  56. package/lib/__templates__/expo/client/heroui/components/avatar/avatar.constants.ts +19 -0
  57. package/lib/__templates__/expo/client/heroui/components/avatar/avatar.context.ts +11 -0
  58. package/lib/__templates__/expo/client/heroui/components/avatar/avatar.md +386 -0
  59. package/lib/__templates__/expo/client/heroui/components/avatar/avatar.styles.ts +145 -0
  60. package/lib/__templates__/expo/client/heroui/components/avatar/avatar.tsx +307 -0
  61. package/lib/__templates__/expo/client/heroui/components/avatar/avatar.types.ts +239 -0
  62. package/lib/__templates__/expo/client/heroui/components/avatar/index.ts +13 -0
  63. package/lib/__templates__/expo/client/heroui/components/avatar/person-icon.tsx +23 -0
  64. package/lib/__templates__/expo/client/heroui/components/bottom-sheet/bottom-sheet.animation.ts +42 -0
  65. package/lib/__templates__/expo/client/heroui/components/bottom-sheet/bottom-sheet.constants.ts +13 -0
  66. package/lib/__templates__/expo/client/heroui/components/bottom-sheet/bottom-sheet.md +349 -0
  67. package/lib/__templates__/expo/client/heroui/components/bottom-sheet/bottom-sheet.styles.ts +66 -0
  68. package/lib/__templates__/expo/client/heroui/components/bottom-sheet/bottom-sheet.tsx +351 -0
  69. package/lib/__templates__/expo/client/heroui/components/bottom-sheet/bottom-sheet.types.ts +150 -0
  70. package/lib/__templates__/expo/client/heroui/components/bottom-sheet/index.ts +16 -0
  71. package/lib/__templates__/expo/client/heroui/components/button/button.constants.ts +7 -0
  72. package/lib/__templates__/expo/client/heroui/components/button/button.md +381 -0
  73. package/lib/__templates__/expo/client/heroui/components/button/button.styles.ts +89 -0
  74. package/lib/__templates__/expo/client/heroui/components/button/button.tsx +284 -0
  75. package/lib/__templates__/expo/client/heroui/components/button/button.types.ts +175 -0
  76. package/lib/__templates__/expo/client/heroui/components/button/button.utils.ts +34 -0
  77. package/lib/__templates__/expo/client/heroui/components/button/index.ts +9 -0
  78. package/lib/__templates__/expo/client/heroui/components/card/card.constants.ts +11 -0
  79. package/lib/__templates__/expo/client/heroui/components/card/card.md +186 -0
  80. package/lib/__templates__/expo/client/heroui/components/card/card.styles.ts +35 -0
  81. package/lib/__templates__/expo/client/heroui/components/card/card.tsx +153 -0
  82. package/lib/__templates__/expo/client/heroui/components/card/card.types.ts +77 -0
  83. package/lib/__templates__/expo/client/heroui/components/card/index.ts +10 -0
  84. package/lib/__templates__/expo/client/heroui/components/checkbox/checkbox.animation.ts +202 -0
  85. package/lib/__templates__/expo/client/heroui/components/checkbox/checkbox.constants.ts +6 -0
  86. package/lib/__templates__/expo/client/heroui/components/checkbox/checkbox.md +311 -0
  87. package/lib/__templates__/expo/client/heroui/components/checkbox/checkbox.styles.ts +105 -0
  88. package/lib/__templates__/expo/client/heroui/components/checkbox/checkbox.tsx +251 -0
  89. package/lib/__templates__/expo/client/heroui/components/checkbox/checkbox.types.ts +216 -0
  90. package/lib/__templates__/expo/client/heroui/components/checkbox/index.ts +3 -0
  91. package/lib/__templates__/expo/client/heroui/components/chip/chip.animation.ts +18 -0
  92. package/lib/__templates__/expo/client/heroui/components/chip/chip.constants.ts +7 -0
  93. package/lib/__templates__/expo/client/heroui/components/chip/chip.md +190 -0
  94. package/lib/__templates__/expo/client/heroui/components/chip/chip.styles.ts +234 -0
  95. package/lib/__templates__/expo/client/heroui/components/chip/chip.tsx +125 -0
  96. package/lib/__templates__/expo/client/heroui/components/chip/chip.types.ts +69 -0
  97. package/lib/__templates__/expo/client/heroui/components/chip/index.ts +3 -0
  98. package/lib/__templates__/expo/client/heroui/components/close-button/close-button.constants.ts +6 -0
  99. package/lib/__templates__/expo/client/heroui/components/close-button/close-button.md +109 -0
  100. package/lib/__templates__/expo/client/heroui/components/close-button/close-button.styles.ts +13 -0
  101. package/lib/__templates__/expo/client/heroui/components/close-button/close-button.tsx +57 -0
  102. package/lib/__templates__/expo/client/heroui/components/close-button/close-button.types.ts +30 -0
  103. package/lib/__templates__/expo/client/heroui/components/close-button/index.ts +6 -0
  104. package/lib/__templates__/expo/client/heroui/components/control-field/control-field.animation.ts +18 -0
  105. package/lib/__templates__/expo/client/heroui/components/control-field/control-field.constants.ts +7 -0
  106. package/lib/__templates__/expo/client/heroui/components/control-field/control-field.context.ts +14 -0
  107. package/lib/__templates__/expo/client/heroui/components/control-field/control-field.md +241 -0
  108. package/lib/__templates__/expo/client/heroui/components/control-field/control-field.styles.ts +15 -0
  109. package/lib/__templates__/expo/client/heroui/components/control-field/control-field.tsx +245 -0
  110. package/lib/__templates__/expo/client/heroui/components/control-field/control-field.types.ts +67 -0
  111. package/lib/__templates__/expo/client/heroui/components/control-field/index.ts +6 -0
  112. package/lib/__templates__/expo/client/heroui/components/description/description.animation.ts +53 -0
  113. package/lib/__templates__/expo/client/heroui/components/description/description.constants.ts +30 -0
  114. package/lib/__templates__/expo/client/heroui/components/description/description.md +129 -0
  115. package/lib/__templates__/expo/client/heroui/components/description/description.styles.ts +25 -0
  116. package/lib/__templates__/expo/client/heroui/components/description/description.tsx +81 -0
  117. package/lib/__templates__/expo/client/heroui/components/description/description.types.ts +77 -0
  118. package/lib/__templates__/expo/client/heroui/components/description/index.ts +3 -0
  119. package/lib/__templates__/expo/client/heroui/components/dialog/dialog.animation.ts +9 -0
  120. package/lib/__templates__/expo/client/heroui/components/dialog/dialog.constants.ts +13 -0
  121. package/lib/__templates__/expo/client/heroui/components/dialog/dialog.md +288 -0
  122. package/lib/__templates__/expo/client/heroui/components/dialog/dialog.styles.ts +77 -0
  123. package/lib/__templates__/expo/client/heroui/components/dialog/dialog.tsx +379 -0
  124. package/lib/__templates__/expo/client/heroui/components/dialog/dialog.types.ts +199 -0
  125. package/lib/__templates__/expo/client/heroui/components/dialog/index.ts +12 -0
  126. package/lib/__templates__/expo/client/heroui/components/field-error/field-error.animation.ts +50 -0
  127. package/lib/__templates__/expo/client/heroui/components/field-error/field-error.constants.ts +31 -0
  128. package/lib/__templates__/expo/client/heroui/components/field-error/field-error.md +204 -0
  129. package/lib/__templates__/expo/client/heroui/components/field-error/field-error.styles.ts +23 -0
  130. package/lib/__templates__/expo/client/heroui/components/field-error/field-error.tsx +91 -0
  131. package/lib/__templates__/expo/client/heroui/components/field-error/field-error.types.ts +79 -0
  132. package/lib/__templates__/expo/client/heroui/components/field-error/index.ts +3 -0
  133. package/lib/__templates__/expo/client/heroui/components/input/index.ts +3 -0
  134. package/lib/__templates__/expo/client/heroui/components/input/input.constants.ts +6 -0
  135. package/lib/__templates__/expo/client/heroui/components/input/input.md +193 -0
  136. package/lib/__templates__/expo/client/heroui/components/input/input.styles.ts +51 -0
  137. package/lib/__templates__/expo/client/heroui/components/input/input.tsx +96 -0
  138. package/lib/__templates__/expo/client/heroui/components/input/input.types.ts +44 -0
  139. package/lib/__templates__/expo/client/heroui/components/input-group/index.ts +9 -0
  140. package/lib/__templates__/expo/client/heroui/components/input-group/input-group.animation.ts +14 -0
  141. package/lib/__templates__/expo/client/heroui/components/input-group/input-group.constants.ts +6 -0
  142. package/lib/__templates__/expo/client/heroui/components/input-group/input-group.md +197 -0
  143. package/lib/__templates__/expo/client/heroui/components/input-group/input-group.styles.ts +31 -0
  144. package/lib/__templates__/expo/client/heroui/components/input-group/input-group.tsx +239 -0
  145. package/lib/__templates__/expo/client/heroui/components/input-group/input-group.types.ts +98 -0
  146. package/lib/__templates__/expo/client/heroui/components/input-otp/index.ts +9 -0
  147. package/lib/__templates__/expo/client/heroui/components/input-otp/input-otp.animation.ts +199 -0
  148. package/lib/__templates__/expo/client/heroui/components/input-otp/input-otp.constants.ts +12 -0
  149. package/lib/__templates__/expo/client/heroui/components/input-otp/input-otp.md +376 -0
  150. package/lib/__templates__/expo/client/heroui/components/input-otp/input-otp.styles.ts +68 -0
  151. package/lib/__templates__/expo/client/heroui/components/input-otp/input-otp.tsx +414 -0
  152. package/lib/__templates__/expo/client/heroui/components/input-otp/input-otp.types.ts +275 -0
  153. package/lib/__templates__/expo/client/heroui/components/label/index.ts +3 -0
  154. package/lib/__templates__/expo/client/heroui/components/label/label.animation.ts +18 -0
  155. package/lib/__templates__/expo/client/heroui/components/label/label.constants.ts +7 -0
  156. package/lib/__templates__/expo/client/heroui/components/label/label.md +187 -0
  157. package/lib/__templates__/expo/client/heroui/components/label/label.styles.ts +44 -0
  158. package/lib/__templates__/expo/client/heroui/components/label/label.tsx +172 -0
  159. package/lib/__templates__/expo/client/heroui/components/label/label.types.ts +86 -0
  160. package/lib/__templates__/expo/client/heroui/components/list-group/index.ts +17 -0
  161. package/lib/__templates__/expo/client/heroui/components/list-group/list-group.constants.ts +17 -0
  162. package/lib/__templates__/expo/client/heroui/components/list-group/list-group.md +387 -0
  163. package/lib/__templates__/expo/client/heroui/components/list-group/list-group.styles.ts +40 -0
  164. package/lib/__templates__/expo/client/heroui/components/list-group/list-group.tsx +206 -0
  165. package/lib/__templates__/expo/client/heroui/components/list-group/list-group.types.ts +132 -0
  166. package/lib/__templates__/expo/client/heroui/components/menu/index.ts +38 -0
  167. package/lib/__templates__/expo/client/heroui/components/menu/menu.animation.ts +121 -0
  168. package/lib/__templates__/expo/client/heroui/components/menu/menu.constants.ts +37 -0
  169. package/lib/__templates__/expo/client/heroui/components/menu/menu.md +620 -0
  170. package/lib/__templates__/expo/client/heroui/components/menu/menu.styles.ts +107 -0
  171. package/lib/__templates__/expo/client/heroui/components/menu/menu.tsx +664 -0
  172. package/lib/__templates__/expo/client/heroui/components/menu/menu.types.ts +394 -0
  173. package/lib/__templates__/expo/client/heroui/components/popover/arrow-svg.tsx +180 -0
  174. package/lib/__templates__/expo/client/heroui/components/popover/index.ts +18 -0
  175. package/lib/__templates__/expo/client/heroui/components/popover/popover.animation.ts +9 -0
  176. package/lib/__templates__/expo/client/heroui/components/popover/popover.constants.ts +34 -0
  177. package/lib/__templates__/expo/client/heroui/components/popover/popover.md +508 -0
  178. package/lib/__templates__/expo/client/heroui/components/popover/popover.styles.ts +98 -0
  179. package/lib/__templates__/expo/client/heroui/components/popover/popover.tsx +624 -0
  180. package/lib/__templates__/expo/client/heroui/components/popover/popover.types.ts +290 -0
  181. package/lib/__templates__/expo/client/heroui/components/pressable-feedback/index.ts +3 -0
  182. package/lib/__templates__/expo/client/heroui/components/pressable-feedback/pressable-feedback.animation.ts +450 -0
  183. package/lib/__templates__/expo/client/heroui/components/pressable-feedback/pressable-feedback.constants.ts +12 -0
  184. package/lib/__templates__/expo/client/heroui/components/pressable-feedback/pressable-feedback.md +328 -0
  185. package/lib/__templates__/expo/client/heroui/components/pressable-feedback/pressable-feedback.styles.ts +84 -0
  186. package/lib/__templates__/expo/client/heroui/components/pressable-feedback/pressable-feedback.tsx +330 -0
  187. package/lib/__templates__/expo/client/heroui/components/pressable-feedback/pressable-feedback.types.ts +386 -0
  188. package/lib/__templates__/expo/client/heroui/components/radio/index.ts +9 -0
  189. package/lib/__templates__/expo/client/heroui/components/radio/radio.animation.ts +92 -0
  190. package/lib/__templates__/expo/client/heroui/components/radio/radio.constants.ts +11 -0
  191. package/lib/__templates__/expo/client/heroui/components/radio/radio.md +339 -0
  192. package/lib/__templates__/expo/client/heroui/components/radio/radio.styles.ts +80 -0
  193. package/lib/__templates__/expo/client/heroui/components/radio/radio.tsx +217 -0
  194. package/lib/__templates__/expo/client/heroui/components/radio/radio.types.ts +106 -0
  195. package/lib/__templates__/expo/client/heroui/components/radio-group/index.ts +9 -0
  196. package/lib/__templates__/expo/client/heroui/components/radio-group/radio-group.animation.ts +20 -0
  197. package/lib/__templates__/expo/client/heroui/components/radio-group/radio-group.constants.ts +7 -0
  198. package/lib/__templates__/expo/client/heroui/components/radio-group/radio-group.context.ts +14 -0
  199. package/lib/__templates__/expo/client/heroui/components/radio-group/radio-group.md +273 -0
  200. package/lib/__templates__/expo/client/heroui/components/radio-group/radio-group.styles.ts +15 -0
  201. package/lib/__templates__/expo/client/heroui/components/radio-group/radio-group.tsx +220 -0
  202. package/lib/__templates__/expo/client/heroui/components/radio-group/radio-group.types.ts +64 -0
  203. package/lib/__templates__/expo/client/heroui/components/scroll-shadow/index.ts +7 -0
  204. package/lib/__templates__/expo/client/heroui/components/scroll-shadow/scroll-shadow.animation.ts +132 -0
  205. package/lib/__templates__/expo/client/heroui/components/scroll-shadow/scroll-shadow.constants.ts +21 -0
  206. package/lib/__templates__/expo/client/heroui/components/scroll-shadow/scroll-shadow.md +206 -0
  207. package/lib/__templates__/expo/client/heroui/components/scroll-shadow/scroll-shadow.styles.ts +52 -0
  208. package/lib/__templates__/expo/client/heroui/components/scroll-shadow/scroll-shadow.tsx +262 -0
  209. package/lib/__templates__/expo/client/heroui/components/scroll-shadow/scroll-shadow.types.ts +121 -0
  210. package/lib/__templates__/expo/client/heroui/components/search-field/index.ts +17 -0
  211. package/lib/__templates__/expo/client/heroui/components/search-field/search-field.animation.ts +18 -0
  212. package/lib/__templates__/expo/client/heroui/components/search-field/search-field.constants.ts +10 -0
  213. package/lib/__templates__/expo/client/heroui/components/search-field/search-field.md +231 -0
  214. package/lib/__templates__/expo/client/heroui/components/search-field/search-field.styles.ts +35 -0
  215. package/lib/__templates__/expo/client/heroui/components/search-field/search-field.tsx +253 -0
  216. package/lib/__templates__/expo/client/heroui/components/search-field/search-field.types.ts +160 -0
  217. package/lib/__templates__/expo/client/heroui/components/search-field/search-icon.tsx +37 -0
  218. package/lib/__templates__/expo/client/heroui/components/select/index.ts +28 -0
  219. package/lib/__templates__/expo/client/heroui/components/select/select.animation.ts +92 -0
  220. package/lib/__templates__/expo/client/heroui/components/select/select.constants.ts +53 -0
  221. package/lib/__templates__/expo/client/heroui/components/select/select.md +796 -0
  222. package/lib/__templates__/expo/client/heroui/components/select/select.styles.ts +149 -0
  223. package/lib/__templates__/expo/client/heroui/components/select/select.tsx +828 -0
  224. package/lib/__templates__/expo/client/heroui/components/select/select.types.ts +438 -0
  225. package/lib/__templates__/expo/client/heroui/components/separator/index.ts +7 -0
  226. package/lib/__templates__/expo/client/heroui/components/separator/separator.constants.ts +6 -0
  227. package/lib/__templates__/expo/client/heroui/components/separator/separator.md +106 -0
  228. package/lib/__templates__/expo/client/heroui/components/separator/separator.styles.ts +50 -0
  229. package/lib/__templates__/expo/client/heroui/components/separator/separator.tsx +62 -0
  230. package/lib/__templates__/expo/client/heroui/components/separator/separator.types.ts +40 -0
  231. package/lib/__templates__/expo/client/heroui/components/skeleton/index.ts +7 -0
  232. package/lib/__templates__/expo/client/heroui/components/skeleton/linear-gradient.tsx +45 -0
  233. package/lib/__templates__/expo/client/heroui/components/skeleton/skeleton.animation.ts +351 -0
  234. package/lib/__templates__/expo/client/heroui/components/skeleton/skeleton.constants.ts +39 -0
  235. package/lib/__templates__/expo/client/heroui/components/skeleton/skeleton.md +208 -0
  236. package/lib/__templates__/expo/client/heroui/components/skeleton/skeleton.styles.ts +49 -0
  237. package/lib/__templates__/expo/client/heroui/components/skeleton/skeleton.tsx +183 -0
  238. package/lib/__templates__/expo/client/heroui/components/skeleton/skeleton.types.ts +191 -0
  239. package/lib/__templates__/expo/client/heroui/components/skeleton-group/index.ts +7 -0
  240. package/lib/__templates__/expo/client/heroui/components/skeleton-group/skeleton-group.constants.ts +7 -0
  241. package/lib/__templates__/expo/client/heroui/components/skeleton-group/skeleton-group.md +247 -0
  242. package/lib/__templates__/expo/client/heroui/components/skeleton-group/skeleton-group.styles.ts +10 -0
  243. package/lib/__templates__/expo/client/heroui/components/skeleton-group/skeleton-group.tsx +94 -0
  244. package/lib/__templates__/expo/client/heroui/components/skeleton-group/skeleton-group.types.ts +28 -0
  245. package/lib/__templates__/expo/client/heroui/components/slider/index.ts +23 -0
  246. package/lib/__templates__/expo/client/heroui/components/slider/slider.animation.ts +87 -0
  247. package/lib/__templates__/expo/client/heroui/components/slider/slider.constants.ts +24 -0
  248. package/lib/__templates__/expo/client/heroui/components/slider/slider.md +348 -0
  249. package/lib/__templates__/expo/client/heroui/components/slider/slider.styles.ts +85 -0
  250. package/lib/__templates__/expo/client/heroui/components/slider/slider.tsx +413 -0
  251. package/lib/__templates__/expo/client/heroui/components/slider/slider.types.ts +120 -0
  252. package/lib/__templates__/expo/client/heroui/components/spinner/index.ts +10 -0
  253. package/lib/__templates__/expo/client/heroui/components/spinner/spinner-icon.tsx +49 -0
  254. package/lib/__templates__/expo/client/heroui/components/spinner/spinner.animation.ts +150 -0
  255. package/lib/__templates__/expo/client/heroui/components/spinner/spinner.constants.ts +36 -0
  256. package/lib/__templates__/expo/client/heroui/components/spinner/spinner.md +199 -0
  257. package/lib/__templates__/expo/client/heroui/components/spinner/spinner.styles.ts +44 -0
  258. package/lib/__templates__/expo/client/heroui/components/spinner/spinner.tsx +198 -0
  259. package/lib/__templates__/expo/client/heroui/components/spinner/spinner.types.ts +158 -0
  260. package/lib/__templates__/expo/client/heroui/components/surface/index.ts +3 -0
  261. package/lib/__templates__/expo/client/heroui/components/surface/surface.animation.ts +18 -0
  262. package/lib/__templates__/expo/client/heroui/components/surface/surface.constants.ts +6 -0
  263. package/lib/__templates__/expo/client/heroui/components/surface/surface.md +136 -0
  264. package/lib/__templates__/expo/client/heroui/components/surface/surface.styles.ts +28 -0
  265. package/lib/__templates__/expo/client/heroui/components/surface/surface.tsx +66 -0
  266. package/lib/__templates__/expo/client/heroui/components/surface/surface.types.ts +46 -0
  267. package/lib/__templates__/expo/client/heroui/components/switch/index.ts +3 -0
  268. package/lib/__templates__/expo/client/heroui/components/switch/switch.animation.ts +243 -0
  269. package/lib/__templates__/expo/client/heroui/components/switch/switch.constants.ts +26 -0
  270. package/lib/__templates__/expo/client/heroui/components/switch/switch.md +334 -0
  271. package/lib/__templates__/expo/client/heroui/components/switch/switch.styles.ts +83 -0
  272. package/lib/__templates__/expo/client/heroui/components/switch/switch.tsx +280 -0
  273. package/lib/__templates__/expo/client/heroui/components/switch/switch.types.ts +208 -0
  274. package/lib/__templates__/expo/client/heroui/components/tabs/index.ts +8 -0
  275. package/lib/__templates__/expo/client/heroui/components/tabs/tabs.animation.ts +246 -0
  276. package/lib/__templates__/expo/client/heroui/components/tabs/tabs.constants.ts +17 -0
  277. package/lib/__templates__/expo/client/heroui/components/tabs/tabs.context.ts +28 -0
  278. package/lib/__templates__/expo/client/heroui/components/tabs/tabs.md +565 -0
  279. package/lib/__templates__/expo/client/heroui/components/tabs/tabs.styles.ts +168 -0
  280. package/lib/__templates__/expo/client/heroui/components/tabs/tabs.tsx +445 -0
  281. package/lib/__templates__/expo/client/heroui/components/tabs/tabs.types.ts +341 -0
  282. package/lib/__templates__/expo/client/heroui/components/tag-group/index.ts +15 -0
  283. package/lib/__templates__/expo/client/heroui/components/tag-group/tag-group.animation.ts +17 -0
  284. package/lib/__templates__/expo/client/heroui/components/tag-group/tag-group.constants.ts +10 -0
  285. package/lib/__templates__/expo/client/heroui/components/tag-group/tag-group.md +404 -0
  286. package/lib/__templates__/expo/client/heroui/components/tag-group/tag-group.styles.ts +74 -0
  287. package/lib/__templates__/expo/client/heroui/components/tag-group/tag-group.tsx +325 -0
  288. package/lib/__templates__/expo/client/heroui/components/tag-group/tag-group.types.ts +125 -0
  289. package/lib/__templates__/expo/client/heroui/components/text-area/index.ts +3 -0
  290. package/lib/__templates__/expo/client/heroui/components/text-area/text-area.constants.ts +6 -0
  291. package/lib/__templates__/expo/client/heroui/components/text-area/text-area.md +133 -0
  292. package/lib/__templates__/expo/client/heroui/components/text-area/text-area.styles.ts +10 -0
  293. package/lib/__templates__/expo/client/heroui/components/text-area/text-area.tsx +44 -0
  294. package/lib/__templates__/expo/client/heroui/components/text-area/text-area.types.ts +6 -0
  295. package/lib/__templates__/expo/client/heroui/components/text-field/index.ts +3 -0
  296. package/lib/__templates__/expo/client/heroui/components/text-field/text-field.animation.ts +20 -0
  297. package/lib/__templates__/expo/client/heroui/components/text-field/text-field.constants.ts +6 -0
  298. package/lib/__templates__/expo/client/heroui/components/text-field/text-field.md +256 -0
  299. package/lib/__templates__/expo/client/heroui/components/text-field/text-field.styles.ts +10 -0
  300. package/lib/__templates__/expo/client/heroui/components/text-field/text-field.tsx +82 -0
  301. package/lib/__templates__/expo/client/heroui/components/text-field/text-field.types.ts +56 -0
  302. package/lib/__templates__/expo/client/heroui/components/toast/index.ts +4 -0
  303. package/lib/__templates__/expo/client/heroui/components/toast/toast.animation.ts +381 -0
  304. package/lib/__templates__/expo/client/heroui/components/toast/toast.constants.ts +10 -0
  305. package/lib/__templates__/expo/client/heroui/components/toast/toast.hooks.ts +73 -0
  306. package/lib/__templates__/expo/client/heroui/components/toast/toast.md +420 -0
  307. package/lib/__templates__/expo/client/heroui/components/toast/toast.styles.ts +89 -0
  308. package/lib/__templates__/expo/client/heroui/components/toast/toast.tsx +472 -0
  309. package/lib/__templates__/expo/client/heroui/components/toast/toast.types.ts +320 -0
  310. package/lib/__templates__/expo/client/heroui/docs.md +47 -0
  311. package/lib/__templates__/expo/client/heroui/helpers/external/hooks/index.ts +3 -0
  312. package/lib/__templates__/expo/client/heroui/helpers/external/hooks/use-is-on-surface.ts +8 -0
  313. package/lib/__templates__/expo/client/heroui/helpers/external/hooks/use-theme-color.ts +137 -0
  314. package/lib/__templates__/expo/client/heroui/helpers/external/utils/cn.ts +12 -0
  315. package/lib/__templates__/expo/client/heroui/helpers/external/utils/color-kit/index.ts +2395 -0
  316. package/lib/__templates__/expo/client/heroui/helpers/external/utils/color-kit/types.ts +212 -0
  317. package/lib/__templates__/expo/client/heroui/helpers/external/utils/index.ts +2 -0
  318. package/lib/__templates__/expo/client/heroui/helpers/internal/components/animated-check-icon.tsx +78 -0
  319. package/lib/__templates__/expo/client/heroui/helpers/internal/components/bottom-sheet-content-container.tsx +97 -0
  320. package/lib/__templates__/expo/client/heroui/helpers/internal/components/bottom-sheet-content.tsx +158 -0
  321. package/lib/__templates__/expo/client/heroui/helpers/internal/components/check-icon.tsx +28 -0
  322. package/lib/__templates__/expo/client/heroui/helpers/internal/components/chevron-down-icon.tsx +28 -0
  323. package/lib/__templates__/expo/client/heroui/helpers/internal/components/chevron-right-icon.tsx +29 -0
  324. package/lib/__templates__/expo/client/heroui/helpers/internal/components/close-icon.tsx +29 -0
  325. package/lib/__templates__/expo/client/heroui/helpers/internal/components/full-window-overlay.tsx +48 -0
  326. package/lib/__templates__/expo/client/heroui/helpers/internal/components/hero-text.tsx +71 -0
  327. package/lib/__templates__/expo/client/heroui/helpers/internal/components/index.ts +9 -0
  328. package/lib/__templates__/expo/client/heroui/helpers/internal/contexts/animation-settings-context.ts +19 -0
  329. package/lib/__templates__/expo/client/heroui/helpers/internal/contexts/bottom-sheet-is-dragging-context.ts +11 -0
  330. package/lib/__templates__/expo/client/heroui/helpers/internal/contexts/form-field-context.ts +36 -0
  331. package/lib/__templates__/expo/client/heroui/helpers/internal/contexts/index.ts +3 -0
  332. package/lib/__templates__/expo/client/heroui/helpers/internal/hooks/index.ts +14 -0
  333. package/lib/__templates__/expo/client/heroui/helpers/internal/hooks/use-augmented-ref.ts +32 -0
  334. package/lib/__templates__/expo/client/heroui/helpers/internal/hooks/use-bottom-sheet-aware-handlers.ts +94 -0
  335. package/lib/__templates__/expo/client/heroui/helpers/internal/hooks/use-bottom-sheet-gesture-handlers.ts +52 -0
  336. package/lib/__templates__/expo/client/heroui/helpers/internal/hooks/use-combined-animation-disabled-state.ts +49 -0
  337. package/lib/__templates__/expo/client/heroui/helpers/internal/hooks/use-controllable-state.ts +124 -0
  338. package/lib/__templates__/expo/client/heroui/helpers/internal/hooks/use-dev-info.ts +38 -0
  339. package/lib/__templates__/expo/client/heroui/helpers/internal/hooks/use-keyboard-status.ts +22 -0
  340. package/lib/__templates__/expo/client/heroui/helpers/internal/hooks/use-popup-bottom-sheet-content-animation.ts +67 -0
  341. package/lib/__templates__/expo/client/heroui/helpers/internal/hooks/use-popup-dialog-content-animation.ts +296 -0
  342. package/lib/__templates__/expo/client/heroui/helpers/internal/hooks/use-popup-overlay-animation.ts +91 -0
  343. package/lib/__templates__/expo/client/heroui/helpers/internal/hooks/use-popup-popover-content-animation.ts +199 -0
  344. package/lib/__templates__/expo/client/heroui/helpers/internal/hooks/use-popup-root-animation.ts +26 -0
  345. package/lib/__templates__/expo/client/heroui/helpers/internal/hooks/use-relative-position.ts +353 -0
  346. package/lib/__templates__/expo/client/heroui/helpers/internal/hooks/use-resolved-style-property.ts +118 -0
  347. package/lib/__templates__/expo/client/heroui/helpers/internal/types/animation.ts +131 -0
  348. package/lib/__templates__/expo/client/heroui/helpers/internal/types/bottom-sheet.ts +99 -0
  349. package/lib/__templates__/expo/client/heroui/helpers/internal/types/index.ts +5 -0
  350. package/lib/__templates__/expo/client/heroui/helpers/internal/types/misc.ts +10 -0
  351. package/lib/__templates__/expo/client/heroui/helpers/internal/types/primitives.ts +146 -0
  352. package/lib/__templates__/expo/client/heroui/helpers/internal/types/theme.ts +18 -0
  353. package/lib/__templates__/expo/client/heroui/helpers/internal/utils/animation.ts +266 -0
  354. package/lib/__templates__/expo/client/heroui/helpers/internal/utils/children-to-string.ts +117 -0
  355. package/lib/__templates__/expo/client/heroui/helpers/internal/utils/combine-styles.ts +17 -0
  356. package/lib/__templates__/expo/client/heroui/helpers/internal/utils/create-context.ts +60 -0
  357. package/lib/__templates__/expo/client/heroui/helpers/internal/utils/ease-gradient/create-interpolation.ts +35 -0
  358. package/lib/__templates__/expo/client/heroui/helpers/internal/utils/ease-gradient/index.ts +97 -0
  359. package/lib/__templates__/expo/client/heroui/helpers/internal/utils/get-element-by-display-name.ts +15 -0
  360. package/lib/__templates__/expo/client/heroui/helpers/internal/utils/get-element-with-default.ts +17 -0
  361. package/lib/__templates__/expo/client/heroui/helpers/internal/utils/has-prop.ts +18 -0
  362. package/lib/__templates__/expo/client/heroui/helpers/internal/utils/index.ts +8 -0
  363. package/lib/__templates__/expo/client/heroui/index.tsx +51 -0
  364. package/lib/__templates__/expo/client/heroui/primitives/README.md +27 -0
  365. package/lib/__templates__/expo/client/heroui/primitives/accordion/accordion.tsx +270 -0
  366. package/lib/__templates__/expo/client/heroui/primitives/accordion/accordion.types.ts +117 -0
  367. package/lib/__templates__/expo/client/heroui/primitives/accordion/accordion.utils.ts +12 -0
  368. package/lib/__templates__/expo/client/heroui/primitives/accordion/index.ts +2 -0
  369. package/lib/__templates__/expo/client/heroui/primitives/activity-indicator/activity-indicator.tsx +50 -0
  370. package/lib/__templates__/expo/client/heroui/primitives/activity-indicator/activity-indicator.types.ts +24 -0
  371. package/lib/__templates__/expo/client/heroui/primitives/activity-indicator/index.ts +2 -0
  372. package/lib/__templates__/expo/client/heroui/primitives/alert/alert.tsx +124 -0
  373. package/lib/__templates__/expo/client/heroui/primitives/alert/alert.types.ts +87 -0
  374. package/lib/__templates__/expo/client/heroui/primitives/alert/index.ts +2 -0
  375. package/lib/__templates__/expo/client/heroui/primitives/avatar/avatar.tsx +171 -0
  376. package/lib/__templates__/expo/client/heroui/primitives/avatar/avatar.types.ts +62 -0
  377. package/lib/__templates__/expo/client/heroui/primitives/avatar/avatar.utils.ts +102 -0
  378. package/lib/__templates__/expo/client/heroui/primitives/avatar/index.ts +2 -0
  379. package/lib/__templates__/expo/client/heroui/primitives/bottom-sheet/bottom-sheet.tsx +235 -0
  380. package/lib/__templates__/expo/client/heroui/primitives/bottom-sheet/bottom-sheet.types.ts +127 -0
  381. package/lib/__templates__/expo/client/heroui/primitives/bottom-sheet/index.ts +2 -0
  382. package/lib/__templates__/expo/client/heroui/primitives/checkbox/checkbox.tsx +119 -0
  383. package/lib/__templates__/expo/client/heroui/primitives/checkbox/checkbox.types.ts +37 -0
  384. package/lib/__templates__/expo/client/heroui/primitives/checkbox/index.ts +2 -0
  385. package/lib/__templates__/expo/client/heroui/primitives/dialog/dialog.tsx +274 -0
  386. package/lib/__templates__/expo/client/heroui/primitives/dialog/dialog.types.ts +129 -0
  387. package/lib/__templates__/expo/client/heroui/primitives/dialog/index.ts +2 -0
  388. package/lib/__templates__/expo/client/heroui/primitives/input-otp/index.ts +3 -0
  389. package/lib/__templates__/expo/client/heroui/primitives/input-otp/input-otp.tsx +431 -0
  390. package/lib/__templates__/expo/client/heroui/primitives/input-otp/input-otp.types.ts +169 -0
  391. package/lib/__templates__/expo/client/heroui/primitives/input-otp/input-otp.utils.ts +31 -0
  392. package/lib/__templates__/expo/client/heroui/primitives/label/index.ts +2 -0
  393. package/lib/__templates__/expo/client/heroui/primitives/label/label.tsx +24 -0
  394. package/lib/__templates__/expo/client/heroui/primitives/label/label.types.ts +39 -0
  395. package/lib/__templates__/expo/client/heroui/primitives/menu/index.ts +2 -0
  396. package/lib/__templates__/expo/client/heroui/primitives/menu/menu.tsx +765 -0
  397. package/lib/__templates__/expo/client/heroui/primitives/menu/menu.types.ts +401 -0
  398. package/lib/__templates__/expo/client/heroui/primitives/popover/index.ts +2 -0
  399. package/lib/__templates__/expo/client/heroui/primitives/popover/popover.tsx +382 -0
  400. package/lib/__templates__/expo/client/heroui/primitives/popover/popover.types.ts +201 -0
  401. package/lib/__templates__/expo/client/heroui/primitives/portal/index.ts +1 -0
  402. package/lib/__templates__/expo/client/heroui/primitives/portal/portal.tsx +126 -0
  403. package/lib/__templates__/expo/client/heroui/primitives/radio/index.ts +2 -0
  404. package/lib/__templates__/expo/client/heroui/primitives/radio/radio.tsx +133 -0
  405. package/lib/__templates__/expo/client/heroui/primitives/radio/radio.types.ts +47 -0
  406. package/lib/__templates__/expo/client/heroui/primitives/radio-group/index.ts +2 -0
  407. package/lib/__templates__/expo/client/heroui/primitives/radio-group/radio-group.tsx +114 -0
  408. package/lib/__templates__/expo/client/heroui/primitives/radio-group/radio-group.types.ts +65 -0
  409. package/lib/__templates__/expo/client/heroui/primitives/select/index.ts +2 -0
  410. package/lib/__templates__/expo/client/heroui/primitives/select/select.tsx +705 -0
  411. package/lib/__templates__/expo/client/heroui/primitives/select/select.types.ts +409 -0
  412. package/lib/__templates__/expo/client/heroui/primitives/select/select.utils.ts +35 -0
  413. package/lib/__templates__/expo/client/heroui/primitives/slider/index.ts +3 -0
  414. package/lib/__templates__/expo/client/heroui/primitives/slider/slider.tsx +464 -0
  415. package/lib/__templates__/expo/client/heroui/primitives/slider/slider.types.ts +208 -0
  416. package/lib/__templates__/expo/client/heroui/primitives/slider/slider.utils.ts +93 -0
  417. package/lib/__templates__/expo/client/heroui/primitives/slot/index.ts +1 -0
  418. package/lib/__templates__/expo/client/heroui/primitives/slot/slot.tsx +122 -0
  419. package/lib/__templates__/expo/client/heroui/primitives/slot/types.ts +19 -0
  420. package/lib/__templates__/expo/client/heroui/primitives/slot/utils.ts +96 -0
  421. package/lib/__templates__/expo/client/heroui/primitives/switch/index.ts +2 -0
  422. package/lib/__templates__/expo/client/heroui/primitives/switch/switch.tsx +61 -0
  423. package/lib/__templates__/expo/client/heroui/primitives/switch/switch.types.ts +55 -0
  424. package/lib/__templates__/expo/client/heroui/primitives/tabs/index.ts +2 -0
  425. package/lib/__templates__/expo/client/heroui/primitives/tabs/tabs.tsx +202 -0
  426. package/lib/__templates__/expo/client/heroui/primitives/tabs/tabs.types.ts +77 -0
  427. package/lib/__templates__/expo/client/heroui/primitives/tag-group/index.ts +2 -0
  428. package/lib/__templates__/expo/client/heroui/primitives/tag-group/tag-group.tsx +324 -0
  429. package/lib/__templates__/expo/client/heroui/primitives/tag-group/tag-group.types.ts +119 -0
  430. package/lib/__templates__/expo/client/heroui/primitives/toast/index.ts +2 -0
  431. package/lib/__templates__/expo/client/heroui/primitives/toast/toast.tsx +138 -0
  432. package/lib/__templates__/expo/client/heroui/primitives/toast/toast.types.ts +86 -0
  433. package/lib/__templates__/expo/client/heroui/providers/animation-settings/index.ts +8 -0
  434. package/lib/__templates__/expo/client/heroui/providers/animation-settings/provider.tsx +47 -0
  435. package/lib/__templates__/expo/client/heroui/providers/animation-settings/types.ts +27 -0
  436. package/lib/__templates__/expo/client/heroui/providers/hero-ui-native/index.ts +2 -0
  437. package/lib/__templates__/expo/client/heroui/providers/hero-ui-native/provider.tsx +67 -0
  438. package/lib/__templates__/expo/client/heroui/providers/hero-ui-native/types.ts +114 -0
  439. package/lib/__templates__/expo/client/heroui/providers/hero-ui-native-raw/index.ts +2 -0
  440. package/lib/__templates__/expo/client/heroui/providers/hero-ui-native-raw/provider.tsx +50 -0
  441. package/lib/__templates__/expo/client/heroui/providers/hero-ui-native-raw/types.ts +39 -0
  442. package/lib/__templates__/expo/client/heroui/providers/text-component/index.ts +2 -0
  443. package/lib/__templates__/expo/client/heroui/providers/text-component/provider.tsx +9 -0
  444. package/lib/__templates__/expo/client/heroui/providers/text-component/types.ts +52 -0
  445. package/lib/__templates__/expo/client/heroui/providers/toast/index.ts +3 -0
  446. package/lib/__templates__/expo/client/heroui/providers/toast/insets-container.tsx +87 -0
  447. package/lib/__templates__/expo/client/heroui/providers/toast/provider.tsx +431 -0
  448. package/lib/__templates__/expo/client/heroui/providers/toast/reducer.ts +34 -0
  449. package/lib/__templates__/expo/client/heroui/providers/toast/toast-config.context.ts +27 -0
  450. package/lib/__templates__/expo/client/heroui/providers/toast/toast-item-renderer.tsx +45 -0
  451. package/lib/__templates__/expo/client/heroui/providers/toast/types.ts +373 -0
  452. package/lib/__templates__/expo/client/heroui/styles/index.css +3 -0
  453. package/lib/__templates__/expo/client/heroui/styles/theme.css +112 -0
  454. package/lib/__templates__/expo/client/heroui/styles/utilities.css +8 -0
  455. package/lib/__templates__/expo/client/heroui/styles/variables.css +146 -0
  456. package/lib/__templates__/expo/client/hooks/useSafeRouter.ts +152 -0
  457. package/lib/__templates__/expo/client/metro.config.js +131 -0
  458. package/lib/__templates__/expo/client/package.json +101 -0
  459. package/lib/__templates__/expo/client/screens/demo/index.tsx +19 -0
  460. package/lib/__templates__/expo/client/scripts/formatter.mjs +78 -0
  461. package/lib/__templates__/expo/client/scripts/install-missing-deps.js +105 -0
  462. package/lib/__templates__/expo/client/scripts/reporter.mjs +1358 -0
  463. package/lib/__templates__/expo/client/scripts/stylish-formatter.mjs +153 -0
  464. package/lib/__templates__/expo/client/scripts/text-table.mjs +68 -0
  465. package/lib/__templates__/expo/client/tsconfig.json +24 -0
  466. package/lib/__templates__/expo/client/uniwind-types.d.ts +10 -0
  467. package/lib/__templates__/expo/client/utils/index.ts +76 -0
  468. package/lib/__templates__/expo/eslint-plugins/fontawesome6/index.js +9 -0
  469. package/lib/__templates__/expo/eslint-plugins/fontawesome6/names.js +1889 -0
  470. package/lib/__templates__/expo/eslint-plugins/fontawesome6/rule.js +174 -0
  471. package/lib/__templates__/expo/eslint-plugins/fontawesome6/v5-only-names.js +388 -0
  472. package/lib/__templates__/expo/eslint-plugins/forbid-emoji/index.js +9 -0
  473. package/lib/__templates__/expo/eslint-plugins/forbid-emoji/rule.js +112 -0
  474. package/lib/__templates__/expo/eslint-plugins/forbid-emoji/tech.md +94 -0
  475. package/lib/__templates__/expo/eslint-plugins/react-native/index.js +9 -0
  476. package/lib/__templates__/expo/eslint-plugins/react-native/rule.js +64 -0
  477. package/lib/__templates__/expo/eslint-plugins/reanimated/index.js +9 -0
  478. package/lib/__templates__/expo/eslint-plugins/reanimated/rule.js +88 -0
  479. package/lib/__templates__/expo/eslint-plugins/restrict-linear-gradient/index.js +9 -0
  480. package/lib/__templates__/expo/eslint-plugins/restrict-linear-gradient/rule.js +120 -0
  481. package/lib/__templates__/expo/eslint-plugins/restrict-linear-gradient/tech.md +58 -0
  482. package/lib/__templates__/expo/package.json +28 -0
  483. package/lib/__templates__/expo/patches/expo@54.0.33.patch +45 -0
  484. package/lib/__templates__/expo/pnpm-lock.yaml +13181 -0
  485. package/lib/__templates__/expo/pnpm-workspace.yaml +3 -0
  486. package/lib/__templates__/expo/server/build.js +21 -0
  487. package/lib/__templates__/expo/server/package.json +34 -0
  488. package/lib/__templates__/expo/server/src/index.ts +20 -0
  489. package/lib/__templates__/expo/server/tsconfig.json +24 -0
  490. package/lib/__templates__/expo/template.config.js +102 -0
  491. package/lib/__templates__/expo/tsconfig.json +1 -0
  492. package/lib/__templates__/native-static/.licos +11 -0
  493. package/lib/__templates__/native-static/index.html +33 -0
  494. package/lib/__templates__/native-static/styles/main.css +136 -0
  495. package/lib/__templates__/native-static/template.config.js +22 -0
  496. package/lib/__templates__/nextjs/.babelrc +15 -0
  497. package/lib/__templates__/nextjs/.licos +12 -0
  498. package/lib/__templates__/nextjs/AGENTS.md +56 -0
  499. package/lib/__templates__/nextjs/README.md +363 -0
  500. package/lib/__templates__/nextjs/_gitignore +100 -0
  501. package/lib/__templates__/nextjs/_npmrc +26 -0
  502. package/lib/__templates__/nextjs/components.json +21 -0
  503. package/lib/__templates__/nextjs/eslint.config.mjs +37 -0
  504. package/lib/__templates__/nextjs/next-env.d.ts +6 -0
  505. package/lib/__templates__/nextjs/next.config.ts +18 -0
  506. package/lib/__templates__/nextjs/package.json +92 -0
  507. package/lib/__templates__/nextjs/pnpm-lock.yaml +12401 -0
  508. package/lib/__templates__/nextjs/postcss.config.mjs +7 -0
  509. package/lib/__templates__/nextjs/public/file.svg +1 -0
  510. package/lib/__templates__/nextjs/public/globe.svg +1 -0
  511. package/lib/__templates__/nextjs/public/next.svg +1 -0
  512. package/lib/__templates__/nextjs/public/vercel.svg +1 -0
  513. package/lib/__templates__/nextjs/public/window.svg +1 -0
  514. package/lib/__templates__/nextjs/scripts/build.sh +17 -0
  515. package/lib/__templates__/nextjs/scripts/dev.sh +39 -0
  516. package/lib/__templates__/nextjs/scripts/prepare.sh +9 -0
  517. package/lib/__templates__/nextjs/scripts/start.sh +21 -0
  518. package/lib/__templates__/nextjs/src/app/favicon.ico +0 -0
  519. package/lib/__templates__/nextjs/src/app/globals.css +137 -0
  520. package/lib/__templates__/nextjs/src/app/layout.tsx +74 -0
  521. package/lib/__templates__/nextjs/src/app/page.tsx +35 -0
  522. package/lib/__templates__/nextjs/src/app/robots.ts +11 -0
  523. package/lib/__templates__/nextjs/src/components/ui/accordion.tsx +66 -0
  524. package/lib/__templates__/nextjs/src/components/ui/alert-dialog.tsx +157 -0
  525. package/lib/__templates__/nextjs/src/components/ui/alert.tsx +66 -0
  526. package/lib/__templates__/nextjs/src/components/ui/aspect-ratio.tsx +11 -0
  527. package/lib/__templates__/nextjs/src/components/ui/avatar.tsx +53 -0
  528. package/lib/__templates__/nextjs/src/components/ui/badge.tsx +46 -0
  529. package/lib/__templates__/nextjs/src/components/ui/breadcrumb.tsx +109 -0
  530. package/lib/__templates__/nextjs/src/components/ui/button-group.tsx +83 -0
  531. package/lib/__templates__/nextjs/src/components/ui/button.tsx +62 -0
  532. package/lib/__templates__/nextjs/src/components/ui/calendar.tsx +220 -0
  533. package/lib/__templates__/nextjs/src/components/ui/card.tsx +92 -0
  534. package/lib/__templates__/nextjs/src/components/ui/carousel.tsx +241 -0
  535. package/lib/__templates__/nextjs/src/components/ui/chart.tsx +357 -0
  536. package/lib/__templates__/nextjs/src/components/ui/checkbox.tsx +32 -0
  537. package/lib/__templates__/nextjs/src/components/ui/collapsible.tsx +33 -0
  538. package/lib/__templates__/nextjs/src/components/ui/command.tsx +184 -0
  539. package/lib/__templates__/nextjs/src/components/ui/context-menu.tsx +252 -0
  540. package/lib/__templates__/nextjs/src/components/ui/dialog.tsx +143 -0
  541. package/lib/__templates__/nextjs/src/components/ui/drawer.tsx +135 -0
  542. package/lib/__templates__/nextjs/src/components/ui/dropdown-menu.tsx +257 -0
  543. package/lib/__templates__/nextjs/src/components/ui/empty.tsx +104 -0
  544. package/lib/__templates__/nextjs/src/components/ui/field.tsx +248 -0
  545. package/lib/__templates__/nextjs/src/components/ui/form.tsx +167 -0
  546. package/lib/__templates__/nextjs/src/components/ui/hover-card.tsx +44 -0
  547. package/lib/__templates__/nextjs/src/components/ui/input-group.tsx +170 -0
  548. package/lib/__templates__/nextjs/src/components/ui/input-otp.tsx +77 -0
  549. package/lib/__templates__/nextjs/src/components/ui/input.tsx +21 -0
  550. package/lib/__templates__/nextjs/src/components/ui/item.tsx +193 -0
  551. package/lib/__templates__/nextjs/src/components/ui/kbd.tsx +28 -0
  552. package/lib/__templates__/nextjs/src/components/ui/label.tsx +24 -0
  553. package/lib/__templates__/nextjs/src/components/ui/menubar.tsx +276 -0
  554. package/lib/__templates__/nextjs/src/components/ui/navigation-menu.tsx +168 -0
  555. package/lib/__templates__/nextjs/src/components/ui/pagination.tsx +127 -0
  556. package/lib/__templates__/nextjs/src/components/ui/popover.tsx +48 -0
  557. package/lib/__templates__/nextjs/src/components/ui/progress.tsx +31 -0
  558. package/lib/__templates__/nextjs/src/components/ui/radio-group.tsx +45 -0
  559. package/lib/__templates__/nextjs/src/components/ui/resizable.tsx +63 -0
  560. package/lib/__templates__/nextjs/src/components/ui/scroll-area.tsx +58 -0
  561. package/lib/__templates__/nextjs/src/components/ui/select.tsx +190 -0
  562. package/lib/__templates__/nextjs/src/components/ui/separator.tsx +28 -0
  563. package/lib/__templates__/nextjs/src/components/ui/sheet.tsx +139 -0
  564. package/lib/__templates__/nextjs/src/components/ui/sidebar.tsx +724 -0
  565. package/lib/__templates__/nextjs/src/components/ui/skeleton.tsx +13 -0
  566. package/lib/__templates__/nextjs/src/components/ui/slider.tsx +63 -0
  567. package/lib/__templates__/nextjs/src/components/ui/sonner.tsx +40 -0
  568. package/lib/__templates__/nextjs/src/components/ui/spinner.tsx +16 -0
  569. package/lib/__templates__/nextjs/src/components/ui/switch.tsx +31 -0
  570. package/lib/__templates__/nextjs/src/components/ui/table.tsx +116 -0
  571. package/lib/__templates__/nextjs/src/components/ui/tabs.tsx +66 -0
  572. package/lib/__templates__/nextjs/src/components/ui/textarea.tsx +18 -0
  573. package/lib/__templates__/nextjs/src/components/ui/toggle-group.tsx +83 -0
  574. package/lib/__templates__/nextjs/src/components/ui/toggle.tsx +47 -0
  575. package/lib/__templates__/nextjs/src/components/ui/tooltip.tsx +61 -0
  576. package/lib/__templates__/nextjs/src/hooks/use-mobile.ts +19 -0
  577. package/lib/__templates__/nextjs/src/lib/utils.ts +6 -0
  578. package/lib/__templates__/nextjs/src/server.ts +35 -0
  579. package/lib/__templates__/nextjs/template.config.js +116 -0
  580. package/lib/__templates__/nextjs/tsconfig.json +34 -0
  581. package/lib/__templates__/nuxt-vue/.licos +12 -0
  582. package/lib/__templates__/nuxt-vue/AGENTS.md +42 -0
  583. package/lib/__templates__/nuxt-vue/README.md +73 -0
  584. package/lib/__templates__/nuxt-vue/_gitignore +25 -0
  585. package/lib/__templates__/nuxt-vue/_npmrc +26 -0
  586. package/lib/__templates__/nuxt-vue/app/app.vue +6 -0
  587. package/lib/__templates__/nuxt-vue/app/pages/index.vue +23 -0
  588. package/lib/__templates__/nuxt-vue/assets/css/main.css +24 -0
  589. package/lib/__templates__/nuxt-vue/nuxt.config.ts +139 -0
  590. package/lib/__templates__/nuxt-vue/package.json +34 -0
  591. package/lib/__templates__/nuxt-vue/pnpm-lock.yaml +8756 -0
  592. package/lib/__templates__/nuxt-vue/postcss.config.mjs +8 -0
  593. package/lib/__templates__/nuxt-vue/public/favicon.ico +0 -0
  594. package/lib/__templates__/nuxt-vue/public/robots.txt +2 -0
  595. package/lib/__templates__/nuxt-vue/scripts/build.sh +14 -0
  596. package/lib/__templates__/nuxt-vue/scripts/dev.sh +39 -0
  597. package/lib/__templates__/nuxt-vue/scripts/prepare.sh +14 -0
  598. package/lib/__templates__/nuxt-vue/scripts/start.sh +21 -0
  599. package/lib/__templates__/nuxt-vue/server/api/hello.ts +10 -0
  600. package/lib/__templates__/nuxt-vue/server/middleware/logger.ts +10 -0
  601. package/lib/__templates__/nuxt-vue/server/routes/health.ts +10 -0
  602. package/lib/__templates__/nuxt-vue/tailwind.config.js +13 -0
  603. package/lib/__templates__/nuxt-vue/template.config.js +87 -0
  604. package/lib/__templates__/nuxt-vue/tsconfig.json +18 -0
  605. package/lib/__templates__/taro/.licos +14 -0
  606. package/lib/__templates__/taro/.licosproj/scripts/deploy_build.sh +19 -0
  607. package/lib/__templates__/taro/.licosproj/scripts/deploy_run.sh +14 -0
  608. package/lib/__templates__/taro/.licosproj/scripts/dev_build.sh +2 -0
  609. package/lib/__templates__/taro/.licosproj/scripts/dev_run.sh +151 -0
  610. package/lib/__templates__/taro/.licosproj/scripts/init_env.sh +5 -0
  611. package/lib/__templates__/taro/.licosproj/scripts/pack.sh +23 -0
  612. package/lib/__templates__/taro/AGENTS.md +514 -0
  613. package/lib/__templates__/taro/README.md +763 -0
  614. package/lib/__templates__/taro/_gitignore +41 -0
  615. package/lib/__templates__/taro/_npmrc +21 -0
  616. package/lib/__templates__/taro/babel.config.js +12 -0
  617. package/lib/__templates__/taro/config/dev.ts +9 -0
  618. package/lib/__templates__/taro/config/index.ts +238 -0
  619. package/lib/__templates__/taro/config/prod.ts +34 -0
  620. package/lib/__templates__/taro/eslint.config.mjs +251 -0
  621. package/lib/__templates__/taro/key/private.appid.key +0 -0
  622. package/lib/__templates__/taro/package.json +113 -0
  623. package/lib/__templates__/taro/patches/@tarojs__plugin-mini-ci@4.1.9.patch +30 -0
  624. package/lib/__templates__/taro/pnpm-lock.yaml +23409 -0
  625. package/lib/__templates__/taro/pnpm-workspace.yaml +2 -0
  626. package/lib/__templates__/taro/project.config.json +16 -0
  627. package/lib/__templates__/taro/server/nest-cli.json +10 -0
  628. package/lib/__templates__/taro/server/package.json +39 -0
  629. package/lib/__templates__/taro/server/src/app.controller.ts +23 -0
  630. package/lib/__templates__/taro/server/src/app.module.ts +10 -0
  631. package/lib/__templates__/taro/server/src/app.service.ts +8 -0
  632. package/lib/__templates__/taro/server/src/interceptors/http-status.interceptor.ts +23 -0
  633. package/lib/__templates__/taro/server/src/main.ts +49 -0
  634. package/lib/__templates__/taro/server/tsconfig.json +24 -0
  635. package/lib/__templates__/taro/src/app.config.ts +11 -0
  636. package/lib/__templates__/taro/src/app.css +156 -0
  637. package/lib/__templates__/taro/src/app.tsx +16 -0
  638. package/lib/__templates__/taro/src/components/ui/accordion.tsx +159 -0
  639. package/lib/__templates__/taro/src/components/ui/alert-dialog.tsx +260 -0
  640. package/lib/__templates__/taro/src/components/ui/alert.tsx +60 -0
  641. package/lib/__templates__/taro/src/components/ui/aspect-ratio.tsx +36 -0
  642. package/lib/__templates__/taro/src/components/ui/avatar.tsx +84 -0
  643. package/lib/__templates__/taro/src/components/ui/badge.tsx +37 -0
  644. package/lib/__templates__/taro/src/components/ui/breadcrumb.tsx +117 -0
  645. package/lib/__templates__/taro/src/components/ui/button-group.tsx +83 -0
  646. package/lib/__templates__/taro/src/components/ui/button.tsx +67 -0
  647. package/lib/__templates__/taro/src/components/ui/calendar.tsx +394 -0
  648. package/lib/__templates__/taro/src/components/ui/card.tsx +108 -0
  649. package/lib/__templates__/taro/src/components/ui/carousel.tsx +228 -0
  650. package/lib/__templates__/taro/src/components/ui/checkbox.tsx +58 -0
  651. package/lib/__templates__/taro/src/components/ui/code-block.tsx +169 -0
  652. package/lib/__templates__/taro/src/components/ui/collapsible.tsx +71 -0
  653. package/lib/__templates__/taro/src/components/ui/command.tsx +385 -0
  654. package/lib/__templates__/taro/src/components/ui/context-menu.tsx +614 -0
  655. package/lib/__templates__/taro/src/components/ui/dialog.tsx +256 -0
  656. package/lib/__templates__/taro/src/components/ui/drawer.tsx +192 -0
  657. package/lib/__templates__/taro/src/components/ui/dropdown-menu.tsx +561 -0
  658. package/lib/__templates__/taro/src/components/ui/field.tsx +228 -0
  659. package/lib/__templates__/taro/src/components/ui/hover-card.tsx +282 -0
  660. package/lib/__templates__/taro/src/components/ui/input-group.tsx +197 -0
  661. package/lib/__templates__/taro/src/components/ui/input-otp.tsx +136 -0
  662. package/lib/__templates__/taro/src/components/ui/input.tsx +56 -0
  663. package/lib/__templates__/taro/src/components/ui/label.tsx +24 -0
  664. package/lib/__templates__/taro/src/components/ui/menubar.tsx +595 -0
  665. package/lib/__templates__/taro/src/components/ui/navigation-menu.tsx +266 -0
  666. package/lib/__templates__/taro/src/components/ui/pagination.tsx +118 -0
  667. package/lib/__templates__/taro/src/components/ui/popover.tsx +291 -0
  668. package/lib/__templates__/taro/src/components/ui/portal.tsx +19 -0
  669. package/lib/__templates__/taro/src/components/ui/progress.tsx +28 -0
  670. package/lib/__templates__/taro/src/components/ui/radio-group.tsx +64 -0
  671. package/lib/__templates__/taro/src/components/ui/resizable.tsx +346 -0
  672. package/lib/__templates__/taro/src/components/ui/scroll-area.tsx +34 -0
  673. package/lib/__templates__/taro/src/components/ui/select.tsx +438 -0
  674. package/lib/__templates__/taro/src/components/ui/separator.tsx +30 -0
  675. package/lib/__templates__/taro/src/components/ui/sheet.tsx +262 -0
  676. package/lib/__templates__/taro/src/components/ui/skeleton.tsx +17 -0
  677. package/lib/__templates__/taro/src/components/ui/slider.tsx +203 -0
  678. package/lib/__templates__/taro/src/components/ui/sonner.tsx +1 -0
  679. package/lib/__templates__/taro/src/components/ui/switch.tsx +55 -0
  680. package/lib/__templates__/taro/src/components/ui/table.tsx +142 -0
  681. package/lib/__templates__/taro/src/components/ui/tabs.tsx +114 -0
  682. package/lib/__templates__/taro/src/components/ui/textarea.tsx +54 -0
  683. package/lib/__templates__/taro/src/components/ui/toast.tsx +517 -0
  684. package/lib/__templates__/taro/src/components/ui/toggle-group.tsx +120 -0
  685. package/lib/__templates__/taro/src/components/ui/toggle.tsx +77 -0
  686. package/lib/__templates__/taro/src/components/ui/tooltip.tsx +455 -0
  687. package/lib/__templates__/taro/src/index.html +39 -0
  688. package/lib/__templates__/taro/src/lib/hooks/use-keyboard-offset.ts +37 -0
  689. package/lib/__templates__/taro/src/lib/measure.ts +115 -0
  690. package/lib/__templates__/taro/src/lib/platform.ts +12 -0
  691. package/lib/__templates__/taro/src/lib/utils.ts +6 -0
  692. package/lib/__templates__/taro/src/network.ts +39 -0
  693. package/lib/__templates__/taro/src/pages/index/index.config.ts +3 -0
  694. package/lib/__templates__/taro/src/pages/index/index.css +1 -0
  695. package/lib/__templates__/taro/src/pages/index/index.tsx +33 -0
  696. package/lib/__templates__/taro/src/presets/dev-debug.ts +23 -0
  697. package/lib/__templates__/taro/src/presets/env.ts +1 -0
  698. package/lib/__templates__/taro/src/presets/h5-container.tsx +16 -0
  699. package/lib/__templates__/taro/src/presets/h5-error-boundary.tsx +391 -0
  700. package/lib/__templates__/taro/src/presets/h5-navbar.tsx +239 -0
  701. package/lib/__templates__/taro/src/presets/h5-styles.ts +222 -0
  702. package/lib/__templates__/taro/src/presets/index.tsx +31 -0
  703. package/lib/__templates__/taro/stylelint.config.mjs +4 -0
  704. package/lib/__templates__/taro/template.config.js +68 -0
  705. package/lib/__templates__/taro/tsconfig.json +29 -0
  706. package/lib/__templates__/taro/types/global.d.ts +32 -0
  707. package/lib/__templates__/taro/types/lucide.d.ts +6 -0
  708. package/lib/__templates__/templates.json +162 -0
  709. package/lib/__templates__/vite/.licos +12 -0
  710. package/lib/__templates__/vite/AGENTS.md +41 -0
  711. package/lib/__templates__/vite/README.md +418 -0
  712. package/lib/__templates__/vite/_gitignore +68 -0
  713. package/lib/__templates__/vite/_npmrc +26 -0
  714. package/lib/__templates__/vite/eslint.config.mjs +14 -0
  715. package/lib/__templates__/vite/index.html +13 -0
  716. package/lib/__templates__/vite/package.json +43 -0
  717. package/lib/__templates__/vite/pnpm-lock.yaml +3462 -0
  718. package/lib/__templates__/vite/postcss.config.js +6 -0
  719. package/lib/__templates__/vite/scripts/build.sh +17 -0
  720. package/lib/__templates__/vite/scripts/dev.sh +39 -0
  721. package/lib/__templates__/vite/scripts/prepare.sh +9 -0
  722. package/lib/__templates__/vite/scripts/start.sh +21 -0
  723. package/lib/__templates__/vite/server/routes/index.ts +31 -0
  724. package/lib/__templates__/vite/server/server.ts +65 -0
  725. package/lib/__templates__/vite/server/vite.ts +67 -0
  726. package/lib/__templates__/vite/src/index.css +21 -0
  727. package/lib/__templates__/vite/src/index.ts +5 -0
  728. package/lib/__templates__/vite/src/main.ts +34 -0
  729. package/lib/__templates__/vite/tailwind.config.js +9 -0
  730. package/lib/__templates__/vite/template.config.js +123 -0
  731. package/lib/__templates__/vite/tsconfig.json +17 -0
  732. package/lib/__templates__/vite/vite.config.ts +20 -0
  733. package/lib/cli.js +9312 -0
  734. package/package.json +31 -0
@@ -0,0 +1,1358 @@
1
+ var DEFAULT_SIZE = 10;
2
+ var DEFAULT_WAIT = 1000;
3
+ var stringifyBatch = function (list) {
4
+ return JSON.stringify({
5
+ ev_type: 'batch',
6
+ list: list,
7
+ });
8
+ };
9
+ function createBatchSender(config) {
10
+ var transport = config.transport;
11
+ var endpoint = config.endpoint, _a = config.size, size = _a === void 0 ? DEFAULT_SIZE : _a, _b = config.wait, wait = _b === void 0 ? DEFAULT_WAIT : _b;
12
+ var batch = [];
13
+ var tid = 0;
14
+ var fail;
15
+ var success;
16
+ var sender = {
17
+ getSize: function () {
18
+ return size;
19
+ },
20
+ getWait: function () {
21
+ return wait;
22
+ },
23
+ setSize: function (v) {
24
+ size = v;
25
+ },
26
+ setWait: function (v) {
27
+ wait = v;
28
+ },
29
+ getEndpoint: function () {
30
+ return endpoint;
31
+ },
32
+ setEndpoint: function (v) {
33
+ endpoint = v;
34
+ },
35
+ send: function (e) {
36
+ batch.push(e);
37
+ if (batch.length >= size) {
38
+ sendBatch.call(this);
39
+ }
40
+ clearTimeout(tid);
41
+ tid = setTimeout(sendBatch.bind(this), wait);
42
+ },
43
+ flush: function () {
44
+ clearTimeout(tid);
45
+ sendBatch.call(this);
46
+ },
47
+ getBatchData: function () {
48
+ return batch.length ? stringifyBatch(batch) : '';
49
+ },
50
+ clear: function () {
51
+ clearTimeout(tid);
52
+ batch = [];
53
+ },
54
+ fail: function (cb) {
55
+ fail = cb;
56
+ },
57
+ success: function (cb) {
58
+ success = cb;
59
+ },
60
+ };
61
+ function sendBatch() {
62
+ if (!batch.length) {
63
+ return;
64
+ }
65
+ var data = this.getBatchData();
66
+ transport.post({
67
+ url: endpoint,
68
+ data: data,
69
+ fail: function (err) {
70
+ fail && fail(err, data);
71
+ },
72
+ success: function () {
73
+ success && success(data);
74
+ },
75
+ });
76
+ batch = [];
77
+ }
78
+ return sender;
79
+ }
80
+
81
+ /*! *****************************************************************************
82
+ Copyright (c) Microsoft Corporation.
83
+
84
+ Permission to use, copy, modify, and/or distribute this software for any
85
+ purpose with or without fee is hereby granted.
86
+
87
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
88
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
89
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
90
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
91
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
92
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
93
+ PERFORMANCE OF THIS SOFTWARE.
94
+ ***************************************************************************** */
95
+
96
+ var __assign = function() {
97
+ __assign = Object.assign || function __assign(t) {
98
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
99
+ s = arguments[i];
100
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
101
+ }
102
+ return t;
103
+ };
104
+ return __assign.apply(this, arguments);
105
+ };
106
+
107
+ function __values(o) {
108
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
109
+ if (m) return m.call(o);
110
+ if (o && typeof o.length === "number") return {
111
+ next: function () {
112
+ if (o && i >= o.length) o = void 0;
113
+ return { value: o && o[i++], done: !o };
114
+ }
115
+ };
116
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
117
+ }
118
+
119
+ function __read(o, n) {
120
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
121
+ if (!m) return o;
122
+ var i = m.call(o), r, ar = [], e;
123
+ try {
124
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
125
+ }
126
+ catch (error) { e = { error: error }; }
127
+ finally {
128
+ try {
129
+ if (r && !r.done && (m = i["return"])) m.call(i);
130
+ }
131
+ finally { if (e) throw e.error; }
132
+ }
133
+ return ar;
134
+ }
135
+
136
+ function __spreadArray(to, from, pack) {
137
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
138
+ if (ar || !(i in from)) {
139
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
140
+ ar[i] = from[i];
141
+ }
142
+ }
143
+ return to.concat(ar || Array.prototype.slice.call(from));
144
+ }
145
+
146
+ var noop = function () { return ({}); };
147
+ function id(v) {
148
+ return v;
149
+ }
150
+
151
+ // eslint-disable-next-line @typescript-eslint/ban-types
152
+ function isObject(o) {
153
+ return typeof o === 'object' && o !== null;
154
+ }
155
+ var objProto = Object.prototype;
156
+ function isArray(o) {
157
+ return objProto.toString.call(o) === '[object Array]';
158
+ }
159
+ function isBoolean(o) {
160
+ return typeof o === 'boolean';
161
+ }
162
+ function isNumber(o) {
163
+ return typeof o === 'number';
164
+ }
165
+ function isString(o) {
166
+ return typeof o === 'string';
167
+ }
168
+
169
+ // 检查数组中是否有元素
170
+ function arrayIncludes(array, value) {
171
+ if (!isArray(array)) {
172
+ return false;
173
+ }
174
+ if (array.length === 0) {
175
+ return false;
176
+ }
177
+ var k = 0;
178
+ while (k < array.length) {
179
+ if (array[k] === value) {
180
+ return true;
181
+ }
182
+ k++;
183
+ }
184
+ return false;
185
+ }
186
+ var arrayRemove = function (arr, e) {
187
+ if (!isArray(arr)) {
188
+ return arr;
189
+ }
190
+ var i = arr.indexOf(e);
191
+ if (i >= 0) {
192
+ var arr_ = arr.slice();
193
+ arr_.splice(i, 1);
194
+ return arr_;
195
+ }
196
+ return arr;
197
+ };
198
+ /**
199
+ * 按路径访问对象属性
200
+ * @param target 待访问对象
201
+ * @param property 访问属性路径
202
+ * @param { (target: any, property: string): any } visitor 访问器
203
+ */
204
+ var safeVisit = function (target, path, visitor) {
205
+ var _a, _b;
206
+ var paths = path.split('.');
207
+ var _c = __read(paths), method = _c[0], rest = _c.slice(1);
208
+ while (target && rest.length > 0) {
209
+ target = target[method];
210
+ _a = rest, _b = __read(_a), method = _b[0], rest = _b.slice(1);
211
+ }
212
+ if (!target) {
213
+ return undefined;
214
+ }
215
+ return visitor(target, method);
216
+ };
217
+
218
+ function safeStringify(a) {
219
+ try {
220
+ return isString(a) ? a : JSON.stringify(a);
221
+ }
222
+ catch (err) {
223
+ return '[FAILED_TO_STRINGIFY]:' + String(err);
224
+ }
225
+ }
226
+
227
+ function createContextAgent() {
228
+ var context = {};
229
+ var stringified = {};
230
+ var contextAgent = {
231
+ set: function (k, v) {
232
+ context[k] = v;
233
+ stringified[k] = safeStringify(v);
234
+ return contextAgent;
235
+ },
236
+ merge: function (ctx) {
237
+ context = __assign(__assign({}, context), ctx);
238
+ Object.keys(ctx).forEach(function (key) {
239
+ stringified[key] = safeStringify(ctx[key]);
240
+ });
241
+ return contextAgent;
242
+ },
243
+ delete: function (k) {
244
+ delete context[k];
245
+ delete stringified[k];
246
+ return contextAgent;
247
+ },
248
+ clear: function () {
249
+ context = {};
250
+ stringified = {};
251
+ return contextAgent;
252
+ },
253
+ get: function (k) {
254
+ return stringified[k];
255
+ },
256
+ toString: function () {
257
+ return __assign({}, stringified);
258
+ },
259
+ };
260
+ return contextAgent;
261
+ }
262
+
263
+ var getPrintString = function () {
264
+ // @ts-expect-error
265
+ if (''.padStart) {
266
+ return function (str, prefixLength) {
267
+ if (prefixLength === void 0) { prefixLength = 8; }
268
+ return str.padStart(prefixLength, ' ');
269
+ };
270
+ }
271
+ return function (str) { return str; };
272
+ };
273
+ var printString = getPrintString();
274
+ var errCount = 0;
275
+ var error = function () {
276
+ var args = [];
277
+ for (var _i = 0; _i < arguments.length; _i++) {
278
+ args[_i] = arguments[_i];
279
+ }
280
+ // eslint-disable-next-line no-console
281
+ console.error.apply(console, __spreadArray(['[SDK]', Date.now(), printString("" + errCount++)], __read(args), false));
282
+ };
283
+ var warnCount = 0;
284
+ var warn = function () {
285
+ var args = [];
286
+ for (var _i = 0; _i < arguments.length; _i++) {
287
+ args[_i] = arguments[_i];
288
+ }
289
+ // eslint-disable-next-line no-console
290
+ console.warn.apply(console, __spreadArray(['[SDK]', Date.now(), printString("" + warnCount++)], __read(args), false));
291
+ };
292
+
293
+ var isHitBySampleRate = function (sampleRate) {
294
+ if (Math.random() < Number(sampleRate)) {
295
+ return true;
296
+ }
297
+ return false;
298
+ };
299
+ var isHitByRandom = function (random, sampleRate) {
300
+ if (random < Number(sampleRate)) {
301
+ return true;
302
+ }
303
+ return false;
304
+ };
305
+
306
+ var runProcessors = function (fns) {
307
+ return function (e) {
308
+ var r = e;
309
+ for (var i = 0; i < fns.length; i++) {
310
+ if (r) {
311
+ try {
312
+ r = fns[i](r);
313
+ }
314
+ catch (err) {
315
+ error(err);
316
+ }
317
+ }
318
+ else {
319
+ break;
320
+ }
321
+ }
322
+ return r;
323
+ };
324
+ };
325
+
326
+ /**
327
+ * 生成uuid
328
+ * stolen from https://github.com/kelektiv/node-uuid#readme uuid/v4
329
+ *
330
+ * @returns
331
+ */
332
+ function mathRNG() {
333
+ var rnds = new Array(16);
334
+ var r = 0;
335
+ for (var i = 0; i < 16; i++) {
336
+ if ((i & 0x03) === 0) {
337
+ r = Math.random() * 0x100000000;
338
+ }
339
+ rnds[i] = (r >>> ((i & 0x03) << 3)) & 0xff;
340
+ }
341
+ return rnds;
342
+ }
343
+ function bytesToUuid(buf) {
344
+ var byteToHex = [];
345
+ for (var index = 0; index < 256; ++index) {
346
+ byteToHex[index] = (index + 0x100).toString(16).substr(1);
347
+ }
348
+ var i = 0;
349
+ var bth = byteToHex;
350
+ // join used to fix memory issue caused by concatenation: https://bugs.chromium.org/p/v8/issues/detail?id=3175#c4
351
+ return [
352
+ bth[buf[i++]],
353
+ bth[buf[i++]],
354
+ bth[buf[i++]],
355
+ bth[buf[i++]],
356
+ '-',
357
+ bth[buf[i++]],
358
+ bth[buf[i++]],
359
+ '-',
360
+ bth[buf[i++]],
361
+ bth[buf[i++]],
362
+ '-',
363
+ bth[buf[i++]],
364
+ bth[buf[i++]],
365
+ '-',
366
+ bth[buf[i++]],
367
+ bth[buf[i++]],
368
+ bth[buf[i++]],
369
+ bth[buf[i++]],
370
+ bth[buf[i++]],
371
+ bth[buf[i++]],
372
+ ].join('');
373
+ }
374
+ function uuid() {
375
+ var rnds = mathRNG();
376
+ // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
377
+ rnds[6] = (rnds[6] & 0x0f) | 0x40;
378
+ rnds[8] = (rnds[8] & 0x3f) | 0x80;
379
+ return bytesToUuid(rnds);
380
+ }
381
+
382
+ function createDestroyAgent() {
383
+ var destroyed = false;
384
+ var data = {};
385
+ var removeTearDownGroup = function (tearDownGroup) {
386
+ tearDownGroup.length &&
387
+ tearDownGroup.forEach(function (v) {
388
+ try {
389
+ v();
390
+ // eslint-disable-next-line no-empty
391
+ }
392
+ catch (_a) { }
393
+ });
394
+ tearDownGroup.length = 0;
395
+ };
396
+ var removeByPluginName = function (pluginName) {
397
+ data[pluginName] &&
398
+ data[pluginName].forEach(function (e) {
399
+ removeTearDownGroup(e[1]);
400
+ });
401
+ data[pluginName] = undefined;
402
+ };
403
+ var removeByEvType = function (evType) {
404
+ Object.keys(data).forEach(function (k) {
405
+ data[k] &&
406
+ data[k].forEach(function (e) {
407
+ if (e[0] === evType) {
408
+ removeTearDownGroup(e[1]);
409
+ }
410
+ });
411
+ });
412
+ };
413
+ return {
414
+ /**
415
+ * register tearDownGroup for a single plugin.
416
+ */
417
+ set: function (pluginName, evType, tearDownGroup) {
418
+ if (data[pluginName])
419
+ data[pluginName].push([evType, tearDownGroup]);
420
+ else
421
+ data[pluginName] = [[evType, tearDownGroup]];
422
+ // auto remove tearDownGroup if destroyed
423
+ destroyed && removeTearDownGroup(tearDownGroup);
424
+ },
425
+ has: function (pluginName) {
426
+ return !!data[pluginName];
427
+ },
428
+ /**
429
+ * remove tearDownGroup for a single plugin.
430
+ */
431
+ remove: removeByPluginName,
432
+ /**
433
+ * remove tearDownGroup by event type
434
+ */
435
+ removeByEvType: removeByEvType,
436
+ /**
437
+ * clear all tearDownGroup
438
+ */
439
+ clear: function () {
440
+ destroyed = true;
441
+ Object.keys(data).forEach(function (k) {
442
+ removeByPluginName(k);
443
+ });
444
+ },
445
+ };
446
+ }
447
+
448
+ // max size of preStartQueue
449
+ var PRESTART_QUEUE_MAX_SIZE = 500;
450
+ // slice size to operate preStartQueue
451
+ var PRESTART_QUEUE_OP_SLICE_SIZE = 50;
452
+ function cachePreStartData(client, preStartQueue, processed) {
453
+ preStartQueue.push(processed);
454
+ if (preStartQueue.length < PRESTART_QUEUE_MAX_SIZE) {
455
+ return;
456
+ }
457
+ // delete some data to prevent OOM
458
+ var deleteData = preStartQueue.splice(0, PRESTART_QUEUE_OP_SLICE_SIZE);
459
+ if (client.savePreStartDataToDb) {
460
+ void client.savePreStartDataToDb(deleteData);
461
+ }
462
+ }
463
+ function consumePreStartData(client) {
464
+ var preStartQueue = client.getPreStartQueue();
465
+ preStartQueue.forEach(function (e) { return client.build(e); });
466
+ preStartQueue.length = 0;
467
+ }
468
+
469
+ var EVENTS = [
470
+ 'init',
471
+ 'start',
472
+ 'config',
473
+ 'beforeDestroy',
474
+ 'provide',
475
+ 'beforeReport',
476
+ 'report',
477
+ 'beforeBuild',
478
+ 'build',
479
+ 'beforeSend',
480
+ 'send',
481
+ 'beforeConfig',
482
+ ];
483
+
484
+ function createClient(creationConfig) {
485
+ var builder = creationConfig.builder, createSender = creationConfig.createSender, createDefaultConfig = creationConfig.createDefaultConfig, createConfigManager = creationConfig.createConfigManager, userConfigNormalizer = creationConfig.userConfigNormalizer, initConfigNormalizer = creationConfig.initConfigNormalizer, validateInitConfig = creationConfig.validateInitConfig;
486
+ var sender;
487
+ var configManager;
488
+ var handlers = {};
489
+ EVENTS.forEach(function (e) { return (handlers[e] = []); });
490
+ var inited = false;
491
+ var started = false;
492
+ var destroyed = false;
493
+ // 缓存 start 之前 build 的事件
494
+ var preStartQueue = [];
495
+ // 禁止通过 provide 挂载的字段名
496
+ var reservedNames = [];
497
+ var destroyAgent = createDestroyAgent();
498
+ var client = {
499
+ getBuilder: function () { return builder; },
500
+ getSender: function () { return sender; },
501
+ getPreStartQueue: function () { return preStartQueue; },
502
+ init: function (c) {
503
+ if (inited) {
504
+ warn('already inited');
505
+ return;
506
+ }
507
+ if (c && isObject(c) && validateInitConfig(c)) {
508
+ var defaultConfig = createDefaultConfig(c);
509
+ if (!defaultConfig) {
510
+ throw new Error('defaultConfig missing');
511
+ }
512
+ var initConfig = initConfigNormalizer(c);
513
+ configManager = createConfigManager(defaultConfig);
514
+ configManager.setConfig(initConfig);
515
+ configManager.onChange(function () {
516
+ handle('config');
517
+ });
518
+ sender = createSender(configManager.getConfig());
519
+ if (!sender) {
520
+ throw new Error('sender missing');
521
+ }
522
+ inited = true;
523
+ handle('init', true);
524
+ }
525
+ else {
526
+ throw new Error('invalid InitConfig, init failed');
527
+ }
528
+ },
529
+ set: function (c) {
530
+ if (!inited) {
531
+ return;
532
+ }
533
+ if (c && isObject(c)) {
534
+ handle('beforeConfig', false, c);
535
+ configManager === null || configManager === void 0 ? void 0 : configManager.setConfig(c);
536
+ }
537
+ },
538
+ config: function (c) {
539
+ if (!inited) {
540
+ return;
541
+ }
542
+ if (c && isObject(c)) {
543
+ handle('beforeConfig', false, c);
544
+ configManager === null || configManager === void 0 ? void 0 : configManager.setConfig(userConfigNormalizer(c));
545
+ }
546
+ return configManager === null || configManager === void 0 ? void 0 : configManager.getConfig();
547
+ },
548
+ provide: function (name, value) {
549
+ if (arrayIncludes(reservedNames, name)) {
550
+ warn("cannot provide " + name + ", reserved");
551
+ return;
552
+ }
553
+ client[name] = value;
554
+ handle('provide', false, name);
555
+ },
556
+ start: function () {
557
+ if (!inited) {
558
+ return;
559
+ }
560
+ if (started) {
561
+ return;
562
+ }
563
+ configManager === null || configManager === void 0 ? void 0 : configManager.onReady(function () {
564
+ started = true;
565
+ handle('start', true);
566
+ consumePreStartData(client);
567
+ });
568
+ },
569
+ report: function (data) {
570
+ if (!data) {
571
+ return;
572
+ }
573
+ var preReport = runProcessors(handlers['beforeReport'])(data);
574
+ if (!preReport) {
575
+ return;
576
+ }
577
+ var processed = runProcessors(handlers['report'])(preReport);
578
+ if (!processed) {
579
+ return;
580
+ }
581
+ if (started) {
582
+ this.build(processed);
583
+ }
584
+ else {
585
+ cachePreStartData(client, preStartQueue, processed);
586
+ }
587
+ },
588
+ build: function (data) {
589
+ if (!started) {
590
+ return;
591
+ }
592
+ var preBuild = runProcessors(handlers['beforeBuild'])(data);
593
+ if (!preBuild) {
594
+ return;
595
+ }
596
+ var built = builder.build(preBuild);
597
+ if (!built) {
598
+ return;
599
+ }
600
+ var processed = runProcessors(handlers['build'])(built);
601
+ if (!processed) {
602
+ return;
603
+ }
604
+ this.send(processed);
605
+ },
606
+ send: function (data) {
607
+ if (!started) {
608
+ return;
609
+ }
610
+ var processed = runProcessors(handlers['beforeSend'])(data);
611
+ if (processed) {
612
+ sender.send(processed);
613
+ handle('send', false, processed);
614
+ }
615
+ },
616
+ destroy: function () {
617
+ destroyAgent.clear();
618
+ destroyed = true;
619
+ preStartQueue.length = 0;
620
+ handle('beforeDestroy', true);
621
+ },
622
+ on: function (ev, handler) {
623
+ if ((ev === 'init' && inited) || (ev === 'start' && started) || (ev === 'beforeDestroy' && destroyed)) {
624
+ try {
625
+ ;
626
+ handler();
627
+ }
628
+ catch (_err) {
629
+ // ignore
630
+ }
631
+ }
632
+ else if (handlers[ev]) {
633
+ handlers[ev].push(handler);
634
+ }
635
+ },
636
+ off: function (ev, handler) {
637
+ if (handlers[ev])
638
+ handlers[ev] = arrayRemove(handlers[ev], handler);
639
+ },
640
+ destroyAgent: destroyAgent,
641
+ };
642
+ reservedNames = Object.keys(client);
643
+ return client;
644
+ function handle(ev, once) {
645
+ if (once === void 0) { once = false; }
646
+ var args = [];
647
+ for (var _i = 2; _i < arguments.length; _i++) {
648
+ args[_i - 2] = arguments[_i];
649
+ }
650
+ handlers[ev].forEach(function (f) {
651
+ try {
652
+ f.apply(void 0, __spreadArray([], __read(args), false));
653
+ }
654
+ catch (_err) {
655
+ // ignore
656
+ }
657
+ });
658
+ if (once) {
659
+ handlers[ev].length = 0;
660
+ }
661
+ }
662
+ }
663
+
664
+ var ContextPlugin = function (client) {
665
+ var contextAgent = createContextAgent();
666
+ client.provide('context', contextAgent);
667
+ client.on('report', function (ev) {
668
+ if (!ev.extra) {
669
+ ev.extra = {};
670
+ }
671
+ ev.extra.context = contextAgent.toString();
672
+ return ev;
673
+ });
674
+ };
675
+
676
+ function IntegrationPlugin(client, runAfterSetup) {
677
+ client.on('init', function () {
678
+ var nameList = [];
679
+ var applyIntegrations = function (integrations) {
680
+ integrations.forEach(function (integration) {
681
+ var integrationName = integration.name;
682
+ if (!arrayIncludes(nameList, integrationName)) {
683
+ nameList.push(integrationName);
684
+ integration.setup(client);
685
+ runAfterSetup && runAfterSetup(integrationName, integration.setup);
686
+ client.destroyAgent.set(integrationName, integrationName, [
687
+ function () {
688
+ nameList = arrayRemove(nameList, integrationName);
689
+ integration.tearDown && integration.tearDown();
690
+ },
691
+ ]);
692
+ }
693
+ });
694
+ };
695
+ client.provide('applyIntegrations', applyIntegrations);
696
+ var config = client.config();
697
+ if (config && config.integrations) {
698
+ applyIntegrations(config.integrations);
699
+ }
700
+ });
701
+ }
702
+
703
+ var DevtoolsPlugin = function (client) {
704
+ try {
705
+ if (typeof window === 'object' && isObject(window) && window.__SLARDAR_DEVTOOLS_GLOBAL_HOOK__) {
706
+ window.__SLARDAR_DEVTOOLS_GLOBAL_HOOK__.push(client);
707
+ }
708
+ }
709
+ catch (e) {
710
+ // ignore
711
+ }
712
+ };
713
+
714
+ var now = function () { return Date.now(); };
715
+
716
+ function getDefaultBrowser() {
717
+ if (typeof window === 'object' && isObject(window))
718
+ return window;
719
+ }
720
+
721
+ // 获取全局注册表
722
+ var getGlobalRegistry = function (global) {
723
+ if (!global)
724
+ return;
725
+ if (!global.__SLARDAR_REGISTRY__) {
726
+ global.__SLARDAR_REGISTRY__ = {
727
+ Slardar: {
728
+ plugins: [],
729
+ errors: [],
730
+ subject: {},
731
+ },
732
+ };
733
+ }
734
+ return global.__SLARDAR_REGISTRY__.Slardar;
735
+ };
736
+ var reportSelfError = function () {
737
+ var errorInfo = [];
738
+ for (var _i = 0; _i < arguments.length; _i++) {
739
+ errorInfo[_i] = arguments[_i];
740
+ }
741
+ var registry = getGlobalRegistry(getDefaultBrowser());
742
+ if (!registry)
743
+ return;
744
+ if (!registry.errors) {
745
+ registry.errors = [];
746
+ }
747
+ registry.errors.push(errorInfo);
748
+ };
749
+
750
+ /**
751
+ * Special support in Perfsee for analyzing call stacks of custom events and custom metrics.
752
+ */
753
+ // eslint-disable-next-line
754
+ var getStacksOnPerfsee = function (constructor) {
755
+ var _a;
756
+ // @ts-expect-error
757
+ if (typeof window !== 'object' || !window.__perfsee__) {
758
+ return;
759
+ }
760
+ var obj = {};
761
+ (_a = Error.captureStackTrace) === null || _a === void 0 ? void 0 : _a.call(Error, obj, constructor);
762
+ return obj.stack;
763
+ };
764
+
765
+ var CUSTOM_EV_TYPE = 'custom';
766
+
767
+ var CUSTOM_EVENT_TYPE = 'event';
768
+ var CUSTOM_LOG_TYPE = 'log';
769
+ var normalizeCustomEventData = function (raw) {
770
+ if (!raw || !isObject(raw)) {
771
+ return;
772
+ }
773
+ // name is required
774
+ if (!raw['name'] || !isString(raw['name'])) {
775
+ return;
776
+ }
777
+ var res = {
778
+ name: raw['name'],
779
+ type: CUSTOM_EVENT_TYPE,
780
+ };
781
+ if ('metrics' in raw && isObject(raw['metrics'])) {
782
+ var rMetrics = raw['metrics'];
783
+ var metrics = {};
784
+ for (var k in rMetrics) {
785
+ if (isNumber(rMetrics[k])) {
786
+ metrics[k] = rMetrics[k];
787
+ }
788
+ }
789
+ res.metrics = metrics;
790
+ }
791
+ if ('categories' in raw && isObject(raw['categories'])) {
792
+ var rCategories = raw['categories'];
793
+ var categories = {};
794
+ for (var k in rCategories) {
795
+ categories[k] = safeStringify(rCategories[k]);
796
+ }
797
+ res.categories = categories;
798
+ }
799
+ if ('attached_log' in raw && isString(raw['attached_log'])) {
800
+ res.attached_log = raw['attached_log'];
801
+ }
802
+ return res;
803
+ };
804
+ var normalizeCustomLogData = function (raw) {
805
+ if (!raw || !isObject(raw)) {
806
+ return;
807
+ }
808
+ // content is required
809
+ if (!raw['content'] || !isString(raw['content'])) {
810
+ return;
811
+ }
812
+ var rContent = raw['content'];
813
+ var res = {
814
+ content: safeStringify(rContent),
815
+ type: CUSTOM_LOG_TYPE,
816
+ level: 'info',
817
+ };
818
+ if ('level' in raw) {
819
+ res.level = raw['level'];
820
+ }
821
+ if ('extra' in raw && isObject(raw['extra'])) {
822
+ var rExtra = raw['extra'];
823
+ var metrics = {};
824
+ var categories = {};
825
+ for (var k in rExtra) {
826
+ if (isNumber(rExtra[k])) {
827
+ metrics[k] = rExtra[k];
828
+ }
829
+ else {
830
+ categories[k] = safeStringify(rExtra[k]);
831
+ }
832
+ }
833
+ res.metrics = metrics;
834
+ res.categories = categories;
835
+ }
836
+ if ('attached_log' in raw && isString(raw['attached_log'])) {
837
+ res.attached_log = raw['attached_log'];
838
+ }
839
+ return res;
840
+ };
841
+ var CustomPlugin = function (client) {
842
+ var sendEvent = function (data) {
843
+ var normalized = normalizeCustomEventData(data);
844
+ if (normalized) {
845
+ var stacks = getStacksOnPerfsee(sendEvent);
846
+ if (stacks) {
847
+ // @ts-expect-error
848
+ normalized.stacks = stacks;
849
+ }
850
+ client.report({
851
+ ev_type: CUSTOM_EV_TYPE,
852
+ payload: normalized,
853
+ extra: {
854
+ timestamp: now(),
855
+ },
856
+ });
857
+ }
858
+ };
859
+ var sendLog = function (data) {
860
+ var normalized = normalizeCustomLogData(data);
861
+ if (normalized) {
862
+ client.report({
863
+ ev_type: CUSTOM_EV_TYPE,
864
+ payload: normalized,
865
+ extra: {
866
+ timestamp: now(),
867
+ },
868
+ });
869
+ }
870
+ };
871
+ client.provide('sendEvent', sendEvent);
872
+ client.provide('sendLog', sendLog);
873
+ };
874
+
875
+ /* eslint-disable @typescript-eslint/prefer-for-of */
876
+ var withSampleRate = function (ev, sampleRate) {
877
+ var common = ev.common || {};
878
+ common.sample_rate = sampleRate;
879
+ ev.common = common;
880
+ return ev;
881
+ };
882
+ var hitFnWithRandom = function (preCalc, sampleRate, isHitBySampleRate, random, isHitByRandom) {
883
+ return preCalc
884
+ ? (function (h) { return function () {
885
+ return h;
886
+ }; })(isHitByRandom(random, sampleRate))
887
+ : function () { return isHitBySampleRate(sampleRate); };
888
+ };
889
+ var parseValues = function (values, type) {
890
+ return values.map(function (v) {
891
+ switch (type) {
892
+ case 'number':
893
+ return Number(v);
894
+ case 'boolean':
895
+ return v === '1';
896
+ case 'string': // default to string
897
+ default:
898
+ return String(v);
899
+ }
900
+ });
901
+ };
902
+ var checkVal = function (val, values, op) {
903
+ switch (op) {
904
+ case 'eq':
905
+ return arrayIncludes(values, val);
906
+ case 'neq':
907
+ return !arrayIncludes(values, val);
908
+ case 'gt':
909
+ return val > values[0];
910
+ case 'gte':
911
+ return val >= values[0];
912
+ case 'lt':
913
+ return val < values[0];
914
+ case 'lte':
915
+ return val <= values[0];
916
+ case 'regex':
917
+ return Boolean(val.match(new RegExp(values.join('|'))));
918
+ case 'not_regex':
919
+ return !val.match(new RegExp(values.join('|')));
920
+ default: {
921
+ // unknown op
922
+ return false;
923
+ }
924
+ }
925
+ };
926
+ var checkFilter = function (ev, field, op, values) {
927
+ var val = safeVisit(ev, field, function (t, p) {
928
+ return t[p];
929
+ });
930
+ if (val === undefined) {
931
+ return false;
932
+ }
933
+ var field_type = isBoolean(val) ? 'bool' : isNumber(val) ? 'number' : 'string';
934
+ return checkVal(val, parseValues(values, field_type), op);
935
+ };
936
+ var matchFilter = function (ev, filter) {
937
+ try {
938
+ return filter.type === 'rule'
939
+ ? checkFilter(ev, filter.field, filter.op, filter.values)
940
+ : filter.type === 'and'
941
+ ? filter.children.every(function (f) { return matchFilter(ev, f); })
942
+ : filter.children.some(function (f) { return matchFilter(ev, f); });
943
+ }
944
+ catch (e) {
945
+ reportSelfError(e);
946
+ return false;
947
+ }
948
+ };
949
+ var getHitMap = function (rules, preCalcHit, baseRate, isHitBySampleRate, random, isHitByRandom) {
950
+ var hitMap = {};
951
+ Object.keys(rules).forEach(function (name) {
952
+ var _a = rules[name], enable = _a.enable, sample_rate = _a.sample_rate, conditional_sample_rules = _a.conditional_sample_rules;
953
+ if (enable) {
954
+ hitMap[name] = {
955
+ enable: enable,
956
+ sample_rate: sample_rate,
957
+ effectiveSampleRate: sample_rate * baseRate,
958
+ hit: hitFnWithRandom(preCalcHit, sample_rate, isHitBySampleRate, random, isHitByRandom),
959
+ };
960
+ if (conditional_sample_rules) {
961
+ hitMap[name].conditional_hit_rules = conditional_sample_rules.map(function (_a) {
962
+ var s = _a.sample_rate, filter = _a.filter;
963
+ return ({
964
+ sample_rate: s,
965
+ hit: hitFnWithRandom(preCalcHit, s, isHitBySampleRate, random, isHitByRandom),
966
+ effectiveSampleRate: s * baseRate,
967
+ filter: filter,
968
+ });
969
+ });
970
+ }
971
+ }
972
+ else {
973
+ hitMap[name] = {
974
+ enable: enable,
975
+ hit: function () {
976
+ /* istanbul ignore next */
977
+ return false;
978
+ },
979
+ sample_rate: 0,
980
+ effectiveSampleRate: 0,
981
+ };
982
+ }
983
+ });
984
+ return hitMap;
985
+ };
986
+ var getSampler = function (userId, config, isHitBySampleRate, isHitByRandom, destroyFns) {
987
+ if (!config)
988
+ return id;
989
+ // r的设计是为了允许外部传入随机数,用于彻底实现按用户采样
990
+ var baseRate = config.sample_rate, include_users = config.include_users, sample_granularity = config.sample_granularity, rules = config.rules, _a = config.r, random = _a === void 0 ? Math.random() : _a;
991
+ // 用户名单采样
992
+ var userHit = arrayIncludes(include_users, userId);
993
+ if (userHit) {
994
+ return function (ev) { return withSampleRate(ev, 1); };
995
+ }
996
+ // should pre calculate hit
997
+ var preCalcHit = sample_granularity === 'session';
998
+ var baseHit = hitFnWithRandom(preCalcHit, baseRate, isHitBySampleRate, random, isHitByRandom);
999
+ var hitMap = getHitMap(rules, preCalcHit, baseRate, isHitBySampleRate, random, isHitByRandom);
1000
+ return function (ev) {
1001
+ var _a;
1002
+ // 总采样必须命中才有后续
1003
+ if (!baseHit()) {
1004
+ preCalcHit && destroyFns[0]();
1005
+ return false;
1006
+ }
1007
+ // 未配置的事件类型
1008
+ if (!(ev.ev_type in hitMap)) {
1009
+ return withSampleRate(ev, baseRate);
1010
+ }
1011
+ // 忽略未开启的事件类型
1012
+ if (!hitMap[ev.ev_type].enable) {
1013
+ preCalcHit && destroyFns[1](ev.ev_type);
1014
+ return false;
1015
+ }
1016
+ // 跳过采样配置
1017
+ if ((_a = ev.common) === null || _a === void 0 ? void 0 : _a.sample_rate) {
1018
+ return ev;
1019
+ }
1020
+ var hitConfig = hitMap[ev.ev_type];
1021
+ var conditions = hitConfig.conditional_hit_rules;
1022
+ if (conditions) {
1023
+ // 先判断条件采样
1024
+ for (var i = 0; i < conditions.length; i++) {
1025
+ if (matchFilter(ev, conditions[i].filter)) {
1026
+ if (conditions[i].hit()) {
1027
+ return withSampleRate(ev, conditions[i].effectiveSampleRate);
1028
+ }
1029
+ // 条件匹配后不再搜索
1030
+ return false;
1031
+ }
1032
+ }
1033
+ }
1034
+ // 事件类型采样
1035
+ if (!hitConfig.hit()) {
1036
+ // not hit ev_type and no condition, destroy side effect
1037
+ !(conditions && conditions.length) && preCalcHit && destroyFns[1](ev.ev_type);
1038
+ return false;
1039
+ }
1040
+ // 事件类型默认采样已经命中
1041
+ return withSampleRate(ev, hitConfig.effectiveSampleRate);
1042
+ };
1043
+ };
1044
+ var SamplePlugin = function (client) {
1045
+ client.on('start', function () {
1046
+ var _a = client.config(), userId = _a.userId, sample = _a.sample;
1047
+ var destroyFns = [
1048
+ function () {
1049
+ client.destroy();
1050
+ },
1051
+ function (ev_type) {
1052
+ client.destroyAgent.removeByEvType(ev_type);
1053
+ },
1054
+ ];
1055
+ var sampler = getSampler(userId, sample, isHitBySampleRate, isHitByRandom, destroyFns);
1056
+ client.on('build', sampler);
1057
+ });
1058
+ };
1059
+
1060
+ var builder = {
1061
+ build: function (e) {
1062
+ return {
1063
+ ev_type: e.ev_type,
1064
+ payload: e.payload,
1065
+ common: __assign(__assign({}, (e.extra || {})), (e.overrides || {})),
1066
+ };
1067
+ },
1068
+ };
1069
+
1070
+ var REPORT_DOMAIN = "mon.zijieapi.com";
1071
+ var SETTINGS_DOMAIN = REPORT_DOMAIN;
1072
+ var SDK_VERSION = "2.1.8" ;
1073
+ var SDK_NAME = 'SDK_BASE';
1074
+ var SETTINGS_PATH = '/monitor_web/settings/browser-settings';
1075
+ var BATCH_REPORT_PATH = "/monitor_browser/collect/batch/";
1076
+ var DEFAULT_SAMPLE_CONFIG = {
1077
+ sample_rate: 1,
1078
+ include_users: [],
1079
+ sample_granularity: 'session',
1080
+ rules: {},
1081
+ };
1082
+ var DEFAULT_SENDER_SIZE = 20;
1083
+ var DEFAULT_SAMPLE_GRANULARITY = 'session';
1084
+
1085
+ function normalizeStrictFields(config) {
1086
+ var e_1, _a;
1087
+ var strictFields = ['userId', 'deviceId', 'sessionId', 'env'];
1088
+ try {
1089
+ for (var strictFields_1 = __values(strictFields), strictFields_1_1 = strictFields_1.next(); !strictFields_1_1.done; strictFields_1_1 = strictFields_1.next()) {
1090
+ var k = strictFields_1_1.value;
1091
+ if (!config[k]) {
1092
+ delete config[k];
1093
+ }
1094
+ }
1095
+ }
1096
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
1097
+ finally {
1098
+ try {
1099
+ if (strictFields_1_1 && !strictFields_1_1.done && (_a = strictFields_1.return)) _a.call(strictFields_1);
1100
+ }
1101
+ finally { if (e_1) throw e_1.error; }
1102
+ }
1103
+ return config;
1104
+ }
1105
+ function normalizeInitConfig(config) {
1106
+ return normalizeStrictFields(__assign({}, config));
1107
+ }
1108
+ function validateInitConfig(config) {
1109
+ return isObject(config) && 'bid' in config && 'transport' in config;
1110
+ }
1111
+ function normalizeUserConfig(config) {
1112
+ return normalizeStrictFields(__assign({}, config));
1113
+ }
1114
+ function parseServerConfig(serverConfig) {
1115
+ if (!serverConfig) {
1116
+ return {};
1117
+ }
1118
+ var sample = serverConfig.sample, timestamp = serverConfig.timestamp, _a = serverConfig.quota_rate, quota_rate = _a === void 0 ? 1 : _a;
1119
+ if (!sample) {
1120
+ return {};
1121
+ }
1122
+ var sample_rate = sample.sample_rate, _b = sample.sample_granularity, sample_granularity = _b === void 0 ? DEFAULT_SAMPLE_GRANULARITY : _b, include_users = sample.include_users, _c = sample.rules, rules = _c === void 0 ? [] : _c;
1123
+ return {
1124
+ sample: {
1125
+ include_users: include_users,
1126
+ sample_rate: sample_rate * quota_rate,
1127
+ sample_granularity: sample_granularity,
1128
+ rules: rules.reduce(function (prev, cur) {
1129
+ var name = cur.name, enable = cur.enable, sample_rate = cur.sample_rate, conditional_sample_rules = cur.conditional_sample_rules;
1130
+ prev[name] = {
1131
+ enable: enable,
1132
+ sample_rate: sample_rate,
1133
+ conditional_sample_rules: conditional_sample_rules,
1134
+ };
1135
+ return prev;
1136
+ }, {}),
1137
+ },
1138
+ serverTimestamp: timestamp,
1139
+ };
1140
+ }
1141
+
1142
+ /* eslint-disable @typescript-eslint/prefer-nullish-coalescing */
1143
+ var getReportUrl = function (domain, path) {
1144
+ if (path === void 0) { path = BATCH_REPORT_PATH; }
1145
+ return "" + (domain && domain.indexOf('//') >= 0 ? '' : 'https://') + domain + path;
1146
+ };
1147
+ var getSettingsUrl = function (domain, path) {
1148
+ if (path === void 0) { path = SETTINGS_PATH; }
1149
+ return "" + (domain && domain.indexOf('//') >= 0 ? '' : 'https://') + domain + path;
1150
+ };
1151
+ var getDefaultUserId = function () {
1152
+ return uuid();
1153
+ };
1154
+ var getDefaultDeviceId = function () {
1155
+ return uuid();
1156
+ };
1157
+ var getViewId = function (pid) { return pid + "_" + Date.now(); };
1158
+ var getDefaultSessionId = function () {
1159
+ return uuid();
1160
+ };
1161
+
1162
+ var createConfigManager = function (defaultConfig) {
1163
+ // the merged config
1164
+ var config = defaultConfig;
1165
+ // save it so we know when initConfig is set
1166
+ var initConfig;
1167
+ // save UserConfig so we can merge with priority
1168
+ var userConfig = {};
1169
+ // save the original server config, from get_setting response
1170
+ var serverConfig;
1171
+ // cache the parsed ServerConfig, used in merge
1172
+ var parsedServerConfig;
1173
+ var onReady = noop;
1174
+ // call when config changed
1175
+ var onChange = noop;
1176
+ return {
1177
+ getConfig: function () {
1178
+ return config;
1179
+ },
1180
+ setConfig: function (c) {
1181
+ userConfig = __assign(__assign({}, userConfig), (c || {}));
1182
+ updateConfig();
1183
+ if (!initConfig) {
1184
+ // handle init
1185
+ initConfig = c;
1186
+ if (config.useLocalConfig || !config.bid) {
1187
+ parsedServerConfig = {};
1188
+ onReady();
1189
+ }
1190
+ else {
1191
+ getServerConfig(config.transport, config.domain, config.bid, function (res) {
1192
+ serverConfig = res;
1193
+ handleServerConfig();
1194
+ });
1195
+ }
1196
+ }
1197
+ return config;
1198
+ },
1199
+ onChange: function (fn) {
1200
+ onChange = fn;
1201
+ },
1202
+ onReady: function (fn) {
1203
+ onReady = fn;
1204
+ if (parsedServerConfig) {
1205
+ onReady();
1206
+ }
1207
+ },
1208
+ };
1209
+ function updateConfig() {
1210
+ var newConfig = __assign(__assign(__assign({}, defaultConfig), (parsedServerConfig || {})), userConfig);
1211
+ newConfig.sample = mergeSampleConfig(mergeSampleConfig(defaultConfig.sample, parsedServerConfig === null || parsedServerConfig === void 0 ? void 0 : parsedServerConfig.sample), userConfig.sample);
1212
+ config = newConfig;
1213
+ onChange();
1214
+ }
1215
+ function handleServerConfig() {
1216
+ parsedServerConfig = parseServerConfig(serverConfig);
1217
+ updateConfig();
1218
+ onReady();
1219
+ }
1220
+ };
1221
+ function getServerConfig(transport, domain, bid, cb) {
1222
+ if (!transport.get) {
1223
+ return cb({});
1224
+ }
1225
+ transport.get({
1226
+ withCredentials: true,
1227
+ url: getSettingsUrl(domain) + "?bid=" + bid + "&store=1",
1228
+ success: function (res) {
1229
+ cb(res.data || {});
1230
+ },
1231
+ fail: function () {
1232
+ cb({ sample: { sample_rate: 0.001 } });
1233
+ },
1234
+ });
1235
+ }
1236
+ function mergeSampleConfig(a, b) {
1237
+ if (!a || !b)
1238
+ return a || b;
1239
+ var res = __assign(__assign({}, a), b);
1240
+ res.include_users = __spreadArray(__spreadArray([], __read((a.include_users || [])), false), __read((b.include_users || [])), false);
1241
+ res.rules = __spreadArray(__spreadArray([], __read(Object.keys(a.rules || {})), false), __read(Object.keys(b.rules || {})), false).reduce(function (obj, key) {
1242
+ var _a, _b;
1243
+ if (!(key in obj)) {
1244
+ if (key in (a.rules || {}) && key in (b.rules || {})) {
1245
+ obj[key] = __assign(__assign({}, a.rules[key]), b.rules[key]);
1246
+ obj[key].conditional_sample_rules = __spreadArray(__spreadArray([], __read((a.rules[key].conditional_sample_rules || [])), false), __read((b.rules[key].conditional_sample_rules || [])), false);
1247
+ }
1248
+ else {
1249
+ obj[key] = ((_a = a.rules) === null || _a === void 0 ? void 0 : _a[key]) || ((_b = b.rules) === null || _b === void 0 ? void 0 : _b[key]);
1250
+ }
1251
+ }
1252
+ return obj;
1253
+ }, {});
1254
+ return res;
1255
+ }
1256
+
1257
+ var addEnvToSendEvent = function (ev, config) {
1258
+ var _a = config || {}, version = _a.version, name = _a.name;
1259
+ var extra = {
1260
+ url: '',
1261
+ protocol: '',
1262
+ domain: '',
1263
+ path: '',
1264
+ query: '',
1265
+ timestamp: Date.now(),
1266
+ sdk_version: version || SDK_VERSION,
1267
+ sdk_name: name || SDK_NAME,
1268
+ };
1269
+ return __assign(__assign({}, ev), { extra: __assign(__assign({}, extra), (ev.extra || {})) });
1270
+ };
1271
+ var InjectEnvPlugin = function (client) {
1272
+ client.on('report', function (ev) {
1273
+ return addEnvToSendEvent(ev, client.config());
1274
+ });
1275
+ };
1276
+
1277
+ var addConfigToReportEvent = function (ev, config) {
1278
+ var extra = {};
1279
+ extra.bid = config.bid;
1280
+ extra.pid = config.pid;
1281
+ extra.view_id = config.viewId;
1282
+ extra.user_id = config.userId;
1283
+ extra.device_id = config.deviceId;
1284
+ extra.session_id = config.sessionId;
1285
+ extra.release = config.release;
1286
+ extra.env = config.env;
1287
+ return __assign(__assign({}, ev), { extra: __assign(__assign({}, extra), (ev.extra || {})) });
1288
+ };
1289
+ var InjectConfigPlugin = function (client) {
1290
+ client.on('beforeBuild', function (ev) {
1291
+ return addConfigToReportEvent(ev, client.config());
1292
+ });
1293
+ };
1294
+
1295
+ // createSender has side effects(register onClose behaviour)
1296
+ // so it must be create lazily
1297
+ function createSender(config) {
1298
+ return createBatchSender(config);
1299
+ }
1300
+
1301
+ /* eslint-disable @typescript-eslint/prefer-nullish-coalescing */
1302
+ var getDefaultConfig = function (_c) { return ({
1303
+ bid: '',
1304
+ pid: '',
1305
+ viewId: getViewId('_'),
1306
+ userId: getDefaultUserId(),
1307
+ deviceId: getDefaultDeviceId(),
1308
+ sessionId: getDefaultSessionId(),
1309
+ domain: REPORT_DOMAIN,
1310
+ release: '',
1311
+ env: 'production',
1312
+ sample: DEFAULT_SAMPLE_CONFIG,
1313
+ plugins: {},
1314
+ transport: {
1315
+ get: noop,
1316
+ post: noop,
1317
+ },
1318
+ useLocalConfig: false,
1319
+ }); };
1320
+ var createMinimalClient = function (_a) {
1321
+ var _b = _a === void 0 ? {} : _a, _d = _b.createSender, createSender$1 = _d === void 0 ? function (config) {
1322
+ return createSender({
1323
+ size: DEFAULT_SENDER_SIZE,
1324
+ endpoint: getReportUrl(config.domain),
1325
+ transport: config.transport,
1326
+ });
1327
+ } : _d, _e = _b.builder, builder$1 = _e === void 0 ? builder : _e, _f = _b.createDefaultConfig, createDefaultConfig = _f === void 0 ? getDefaultConfig : _f;
1328
+ var client = createClient({
1329
+ validateInitConfig: validateInitConfig,
1330
+ initConfigNormalizer: normalizeInitConfig,
1331
+ userConfigNormalizer: normalizeUserConfig,
1332
+ createSender: createSender$1,
1333
+ builder: builder$1,
1334
+ createDefaultConfig: createDefaultConfig,
1335
+ createConfigManager: createConfigManager,
1336
+ });
1337
+ ContextPlugin(client);
1338
+ InjectConfigPlugin(client);
1339
+ InjectEnvPlugin(client);
1340
+ IntegrationPlugin(client);
1341
+ DevtoolsPlugin(client);
1342
+ return client;
1343
+ };
1344
+ var createBaseClient = function (config) {
1345
+ if (config === void 0) { config = {}; }
1346
+ var client = createMinimalClient(config);
1347
+ SamplePlugin(client);
1348
+ CustomPlugin(client);
1349
+ return client;
1350
+ };
1351
+
1352
+ var browserClient = createBaseClient();
1353
+
1354
+ /**
1355
+ * compat module entry
1356
+ */
1357
+
1358
+ export { BATCH_REPORT_PATH, CustomPlugin, DEFAULT_SAMPLE_CONFIG, DEFAULT_SAMPLE_GRANULARITY, DEFAULT_SENDER_SIZE, InjectConfigPlugin, InjectEnvPlugin, REPORT_DOMAIN, SDK_NAME, SDK_VERSION, SETTINGS_DOMAIN, SETTINGS_PATH, addConfigToReportEvent, addEnvToSendEvent, builder, createBaseClient, createConfigManager, createMinimalClient, browserClient as default, getDefaultConfig, getDefaultDeviceId, getDefaultSessionId, getDefaultUserId, getReportUrl, getServerConfig, getSettingsUrl, getViewId, mergeSampleConfig, normalizeInitConfig, normalizeStrictFields, normalizeUserConfig, parseServerConfig, validateInitConfig };