@headless-lms/server 0.2.0 → 0.4.0

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 (351) hide show
  1. package/dist/_virtual/_rolldown/runtime.js +5 -0
  2. package/dist/app/community-mail.d.ts +24 -0
  3. package/dist/app/community-mail.js +92 -0
  4. package/dist/app/community-mail.js.map +1 -0
  5. package/dist/app/container.d.ts +40 -19
  6. package/dist/app/container.js +294 -45
  7. package/dist/app/container.js.map +1 -1
  8. package/dist/app/mcp-endpoints.d.ts +13 -0
  9. package/dist/app/mcp-endpoints.js +25 -0
  10. package/dist/app/mcp-endpoints.js.map +1 -0
  11. package/dist/app/notification-channels.d.ts +47 -0
  12. package/dist/app/notification-channels.js +174 -0
  13. package/dist/app/notification-channels.js.map +1 -0
  14. package/dist/app/notification-reads.d.ts +23 -0
  15. package/dist/app/notification-reads.js +95 -0
  16. package/dist/app/notification-reads.js.map +1 -0
  17. package/dist/http/config.d.ts +2 -1
  18. package/dist/http/errors.d.ts +15 -0
  19. package/dist/http/errors.js +162 -0
  20. package/dist/http/errors.js.map +1 -0
  21. package/dist/http/mcp/catalogue.d.ts +37 -0
  22. package/dist/http/mcp/catalogue.js +69 -0
  23. package/dist/http/mcp/catalogue.js.map +1 -0
  24. package/dist/http/mcp/challenge.d.ts +7 -0
  25. package/dist/http/mcp/challenge.js +35 -0
  26. package/dist/http/mcp/challenge.js.map +1 -0
  27. package/dist/http/mcp/input-schema.d.ts +7 -0
  28. package/dist/http/mcp/input-schema.js +28 -0
  29. package/dist/http/mcp/input-schema.js.map +1 -0
  30. package/dist/http/mcp/route.d.ts +8 -0
  31. package/dist/http/mcp/route.js +75 -0
  32. package/dist/http/mcp/route.js.map +1 -0
  33. package/dist/http/mcp/server.d.ts +8 -0
  34. package/dist/http/mcp/server.js +31 -0
  35. package/dist/http/mcp/server.js.map +1 -0
  36. package/dist/http/mcp/test-support.d.ts +55 -0
  37. package/dist/http/mcp/test-support.js +151 -0
  38. package/dist/http/mcp/test-support.js.map +1 -0
  39. package/dist/http/mcp/tool.d.ts +48 -0
  40. package/dist/http/mcp/tool.js +58 -0
  41. package/dist/http/mcp/tool.js.map +1 -0
  42. package/dist/http/mcp/tools/automations.d.ts +6 -0
  43. package/dist/http/mcp/tools/automations.js +120 -0
  44. package/dist/http/mcp/tools/automations.js.map +1 -0
  45. package/dist/http/mcp/tools/catalog.d.ts +6 -0
  46. package/dist/http/mcp/tools/catalog.js +200 -0
  47. package/dist/http/mcp/tools/catalog.js.map +1 -0
  48. package/dist/http/mcp/tools/comments.d.ts +6 -0
  49. package/dist/http/mcp/tools/comments.js +70 -0
  50. package/dist/http/mcp/tools/comments.js.map +1 -0
  51. package/dist/http/mcp/tools/communities.d.ts +6 -0
  52. package/dist/http/mcp/tools/communities.js +175 -0
  53. package/dist/http/mcp/tools/communities.js.map +1 -0
  54. package/dist/http/mcp/tools/community-members.d.ts +6 -0
  55. package/dist/http/mcp/tools/community-members.js +89 -0
  56. package/dist/http/mcp/tools/community-members.js.map +1 -0
  57. package/dist/http/mcp/tools/community-moderation.d.ts +6 -0
  58. package/dist/http/mcp/tools/community-moderation.js +144 -0
  59. package/dist/http/mcp/tools/community-moderation.js.map +1 -0
  60. package/dist/http/mcp/tools/courses.d.ts +6 -0
  61. package/dist/http/mcp/tools/courses.js +121 -0
  62. package/dist/http/mcp/tools/courses.js.map +1 -0
  63. package/dist/http/mcp/tools/index.d.ts +6 -0
  64. package/dist/http/mcp/tools/index.js +23 -0
  65. package/dist/http/mcp/tools/index.js.map +1 -0
  66. package/dist/http/mcp/tools/people.d.ts +6 -0
  67. package/dist/http/mcp/tools/people.js +145 -0
  68. package/dist/http/mcp/tools/people.js.map +1 -0
  69. package/dist/http/plugins/auth.js +13 -5
  70. package/dist/http/plugins/auth.js.map +1 -1
  71. package/dist/http/plugins/error-handler.d.ts +2 -1
  72. package/dist/http/plugins/error-handler.js +51 -65
  73. package/dist/http/plugins/error-handler.js.map +1 -1
  74. package/dist/http/plugins/openapi.js +49 -2
  75. package/dist/http/plugins/openapi.js.map +1 -1
  76. package/dist/http/routes/access.d.ts +7 -0
  77. package/dist/http/routes/access.js +140 -0
  78. package/dist/http/routes/access.js.map +1 -0
  79. package/dist/http/routes/activities.js +68 -23
  80. package/dist/http/routes/activities.js.map +1 -1
  81. package/dist/http/routes/assets.js +60 -55
  82. package/dist/http/routes/assets.js.map +1 -1
  83. package/dist/http/routes/automations.js +44 -24
  84. package/dist/http/routes/automations.js.map +1 -1
  85. package/dist/http/routes/bundles.js +29 -18
  86. package/dist/http/routes/bundles.js.map +1 -1
  87. package/dist/http/routes/communities.d.ts +7 -0
  88. package/dist/http/routes/communities.js +522 -0
  89. package/dist/http/routes/communities.js.map +1 -0
  90. package/dist/http/routes/community-moderation.d.ts +7 -0
  91. package/dist/http/routes/community-moderation.js +425 -0
  92. package/dist/http/routes/community-moderation.js.map +1 -0
  93. package/dist/http/routes/course-analytics.js +9 -7
  94. package/dist/http/routes/course-analytics.js.map +1 -1
  95. package/dist/http/routes/courses.js +30 -15
  96. package/dist/http/routes/courses.js.map +1 -1
  97. package/dist/http/routes/dashboard.js +15 -6
  98. package/dist/http/routes/dashboard.js.map +1 -1
  99. package/dist/http/routes/discussion.js +34 -26
  100. package/dist/http/routes/discussion.js.map +1 -1
  101. package/dist/http/routes/downloads.js +48 -30
  102. package/dist/http/routes/downloads.js.map +1 -1
  103. package/dist/http/routes/entitlements.js +16 -7
  104. package/dist/http/routes/entitlements.js.map +1 -1
  105. package/dist/http/routes/integrations.js +38 -41
  106. package/dist/http/routes/integrations.js.map +1 -1
  107. package/dist/http/routes/member/actor.d.ts +14 -0
  108. package/dist/http/routes/member/actor.js +11 -0
  109. package/dist/http/routes/member/actor.js.map +1 -0
  110. package/dist/http/routes/member/assets.d.ts +7 -0
  111. package/dist/http/routes/member/assets.js +79 -0
  112. package/dist/http/routes/member/assets.js.map +1 -0
  113. package/dist/http/routes/member/chats.d.ts +7 -0
  114. package/dist/http/routes/member/chats.js +435 -0
  115. package/dist/http/routes/member/chats.js.map +1 -0
  116. package/dist/http/routes/member/comments.d.ts +7 -0
  117. package/dist/http/routes/member/comments.js +187 -0
  118. package/dist/http/routes/member/comments.js.map +1 -0
  119. package/dist/http/routes/member/community.d.ts +7 -0
  120. package/dist/http/routes/member/community.js +312 -0
  121. package/dist/http/routes/member/community.js.map +1 -0
  122. package/dist/http/routes/member/courses.d.ts +7 -0
  123. package/dist/http/routes/member/courses.js +101 -0
  124. package/dist/http/routes/member/courses.js.map +1 -0
  125. package/dist/http/routes/member/devices.d.ts +7 -0
  126. package/dist/http/routes/member/devices.js +98 -0
  127. package/dist/http/routes/member/devices.js.map +1 -0
  128. package/dist/http/routes/member/downloads.d.ts +7 -0
  129. package/dist/http/routes/member/downloads.js +56 -0
  130. package/dist/http/routes/member/downloads.js.map +1 -0
  131. package/dist/http/routes/member/files.d.ts +7 -0
  132. package/dist/http/routes/member/files.js +184 -0
  133. package/dist/http/routes/member/files.js.map +1 -0
  134. package/dist/http/routes/member/index.d.ts +7 -0
  135. package/dist/http/routes/member/index.js +35 -0
  136. package/dist/http/routes/member/index.js.map +1 -0
  137. package/dist/http/routes/member/notification-settings.d.ts +7 -0
  138. package/dist/http/routes/member/notification-settings.js +108 -0
  139. package/dist/http/routes/member/notification-settings.js.map +1 -0
  140. package/dist/http/routes/member/notifications.d.ts +7 -0
  141. package/dist/http/routes/member/notifications.js +125 -0
  142. package/dist/http/routes/member/notifications.js.map +1 -0
  143. package/dist/http/routes/member/org.d.ts +7 -0
  144. package/dist/http/routes/member/org.js +56 -0
  145. package/dist/http/routes/member/org.js.map +1 -0
  146. package/dist/http/routes/member/posts.d.ts +7 -0
  147. package/dist/http/routes/member/posts.js +612 -0
  148. package/dist/http/routes/member/posts.js.map +1 -0
  149. package/dist/http/routes/member/profile.d.ts +7 -0
  150. package/dist/http/routes/member/profile.js +48 -0
  151. package/dist/http/routes/member/profile.js.map +1 -0
  152. package/dist/http/routes/member/progress.d.ts +7 -0
  153. package/dist/http/routes/member/progress.js +60 -0
  154. package/dist/http/routes/member/progress.js.map +1 -0
  155. package/dist/http/routes/organizations.js +171 -25
  156. package/dist/http/routes/organizations.js.map +1 -1
  157. package/dist/http/routes/students.js +32 -47
  158. package/dist/http/routes/students.js.map +1 -1
  159. package/dist/http/routes/webhooks.js +26 -18
  160. package/dist/http/routes/webhooks.js.map +1 -1
  161. package/dist/http/routes.js +8 -2
  162. package/dist/http/routes.js.map +1 -1
  163. package/dist/http/schemas/access.d.ts +146 -0
  164. package/dist/http/schemas/access.js +36 -0
  165. package/dist/http/schemas/access.js.map +1 -0
  166. package/dist/http/schemas/activities.d.ts +3 -1
  167. package/dist/http/schemas/activities.js +4 -4
  168. package/dist/http/schemas/activities.js.map +1 -1
  169. package/dist/http/schemas/assets.d.ts +79 -80
  170. package/dist/http/schemas/assets.js +23 -13
  171. package/dist/http/schemas/assets.js.map +1 -1
  172. package/dist/http/schemas/automations.d.ts +6 -0
  173. package/dist/http/schemas/bundles.js +6 -6
  174. package/dist/http/schemas/bundles.js.map +1 -1
  175. package/dist/http/schemas/chats.d.ts +409 -0
  176. package/dist/http/schemas/chats.js +56 -0
  177. package/dist/http/schemas/chats.js.map +1 -0
  178. package/dist/http/schemas/community.d.ts +597 -0
  179. package/dist/http/schemas/community.js +132 -0
  180. package/dist/http/schemas/community.js.map +1 -0
  181. package/dist/http/schemas/content.d.ts +4 -2
  182. package/dist/http/schemas/content.js +11 -8
  183. package/dist/http/schemas/content.js.map +1 -1
  184. package/dist/http/schemas/discussion.d.ts +98 -14
  185. package/dist/http/schemas/discussion.js +25 -12
  186. package/dist/http/schemas/discussion.js.map +1 -1
  187. package/dist/http/schemas/downloads.d.ts +11 -5
  188. package/dist/http/schemas/downloads.js +14 -11
  189. package/dist/http/schemas/downloads.js.map +1 -1
  190. package/dist/http/schemas/entitlements.d.ts +6 -6
  191. package/dist/http/schemas/entitlements.js +6 -6
  192. package/dist/http/schemas/entitlements.js.map +1 -1
  193. package/dist/http/schemas/files.d.ts +45 -0
  194. package/dist/http/schemas/files.js +25 -0
  195. package/dist/http/schemas/files.js.map +1 -0
  196. package/dist/http/schemas/index.d.ts +15 -8
  197. package/dist/http/schemas/index.js +15 -8
  198. package/dist/http/schemas/integrations.d.ts +4 -4
  199. package/dist/http/schemas/invites.d.ts +4 -0
  200. package/dist/http/schemas/invites.js +1 -0
  201. package/dist/http/schemas/invites.js.map +1 -1
  202. package/dist/http/schemas/{learn.d.ts → member.d.ts} +31 -18
  203. package/dist/http/schemas/{learn.js → member.js} +17 -13
  204. package/dist/http/schemas/member.js.map +1 -0
  205. package/dist/http/schemas/members.d.ts +35 -2
  206. package/dist/http/schemas/members.js +17 -3
  207. package/dist/http/schemas/members.js.map +1 -1
  208. package/dist/http/schemas/notifications.d.ts +550 -0
  209. package/dist/http/schemas/notifications.js +164 -0
  210. package/dist/http/schemas/notifications.js.map +1 -0
  211. package/dist/http/schemas/posts.d.ts +350 -0
  212. package/dist/http/schemas/posts.js +47 -0
  213. package/dist/http/schemas/posts.js.map +1 -0
  214. package/dist/http/schemas/profile.d.ts +23 -0
  215. package/dist/http/schemas/profile.js +15 -0
  216. package/dist/http/schemas/profile.js.map +1 -0
  217. package/dist/http/schemas/shared.d.ts +32 -1
  218. package/dist/http/schemas/shared.js +20 -2
  219. package/dist/http/schemas/shared.js.map +1 -1
  220. package/dist/http/schemas/students.d.ts +1 -7
  221. package/dist/http/schemas/students.js +1 -7
  222. package/dist/http/schemas/students.js.map +1 -1
  223. package/dist/http/scope.d.ts +3 -1
  224. package/dist/http/scope.js +26 -4
  225. package/dist/http/scope.js.map +1 -1
  226. package/dist/http/server.js +6 -1
  227. package/dist/http/server.js.map +1 -1
  228. package/dist/http/web-bridge.d.ts +1 -1
  229. package/dist/http/web-bridge.js +2 -2
  230. package/dist/http/web-bridge.js.map +1 -1
  231. package/dist/http/well-known.d.ts +7 -0
  232. package/dist/http/well-known.js +22 -0
  233. package/dist/http/well-known.js.map +1 -0
  234. package/dist/index.d.ts +3 -1
  235. package/dist/index.js +4 -2
  236. package/dist/index.js.map +1 -1
  237. package/dist/node_modules/.pnpm/@jridgewell_sourcemap-codec@1.5.5/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.js +78 -0
  238. package/dist/node_modules/.pnpm/@jridgewell_sourcemap-codec@1.5.5/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.js.map +1 -0
  239. package/dist/node_modules/.pnpm/@vitest_expect@2.1.9/node_modules/@vitest/expect/dist/index.js +1267 -0
  240. package/dist/node_modules/.pnpm/@vitest_expect@2.1.9/node_modules/@vitest/expect/dist/index.js.map +1 -0
  241. package/dist/node_modules/.pnpm/@vitest_pretty-format@2.1.9/node_modules/@vitest/pretty-format/dist/index.js +814 -0
  242. package/dist/node_modules/.pnpm/@vitest_pretty-format@2.1.9/node_modules/@vitest/pretty-format/dist/index.js.map +1 -0
  243. package/dist/node_modules/.pnpm/@vitest_runner@2.1.9/node_modules/@vitest/runner/dist/chunk-tasks.js +43 -0
  244. package/dist/node_modules/.pnpm/@vitest_runner@2.1.9/node_modules/@vitest/runner/dist/chunk-tasks.js.map +1 -0
  245. package/dist/node_modules/.pnpm/@vitest_runner@2.1.9/node_modules/@vitest/runner/dist/index.js +527 -0
  246. package/dist/node_modules/.pnpm/@vitest_runner@2.1.9/node_modules/@vitest/runner/dist/index.js.map +1 -0
  247. package/dist/node_modules/.pnpm/@vitest_runner@2.1.9/node_modules/@vitest/runner/dist/utils.js +2 -0
  248. package/dist/node_modules/.pnpm/@vitest_snapshot@2.1.9/node_modules/@vitest/snapshot/dist/index.js +1737 -0
  249. package/dist/node_modules/.pnpm/@vitest_snapshot@2.1.9/node_modules/@vitest/snapshot/dist/index.js.map +1 -0
  250. package/dist/node_modules/.pnpm/@vitest_spy@2.1.9/node_modules/@vitest/spy/dist/index.js +137 -0
  251. package/dist/node_modules/.pnpm/@vitest_spy@2.1.9/node_modules/@vitest/spy/dist/index.js.map +1 -0
  252. package/dist/node_modules/.pnpm/@vitest_utils@2.1.9/node_modules/@vitest/utils/dist/chunk-_commonjsHelpers.js +118 -0
  253. package/dist/node_modules/.pnpm/@vitest_utils@2.1.9/node_modules/@vitest/utils/dist/chunk-_commonjsHelpers.js.map +1 -0
  254. package/dist/node_modules/.pnpm/@vitest_utils@2.1.9/node_modules/@vitest/utils/dist/diff.js +1222 -0
  255. package/dist/node_modules/.pnpm/@vitest_utils@2.1.9/node_modules/@vitest/utils/dist/diff.js.map +1 -0
  256. package/dist/node_modules/.pnpm/@vitest_utils@2.1.9/node_modules/@vitest/utils/dist/error.js +91 -0
  257. package/dist/node_modules/.pnpm/@vitest_utils@2.1.9/node_modules/@vitest/utils/dist/error.js.map +1 -0
  258. package/dist/node_modules/.pnpm/@vitest_utils@2.1.9/node_modules/@vitest/utils/dist/helpers.js +113 -0
  259. package/dist/node_modules/.pnpm/@vitest_utils@2.1.9/node_modules/@vitest/utils/dist/helpers.js.map +1 -0
  260. package/dist/node_modules/.pnpm/@vitest_utils@2.1.9/node_modules/@vitest/utils/dist/index.js +449 -0
  261. package/dist/node_modules/.pnpm/@vitest_utils@2.1.9/node_modules/@vitest/utils/dist/index.js.map +1 -0
  262. package/dist/node_modules/.pnpm/@vitest_utils@2.1.9/node_modules/@vitest/utils/dist/source-map.js +163 -0
  263. package/dist/node_modules/.pnpm/@vitest_utils@2.1.9/node_modules/@vitest/utils/dist/source-map.js.map +1 -0
  264. package/dist/node_modules/.pnpm/chai@5.3.3/node_modules/chai/index.js +3187 -0
  265. package/dist/node_modules/.pnpm/chai@5.3.3/node_modules/chai/index.js.map +1 -0
  266. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/arguments.js +11 -0
  267. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/arguments.js.map +1 -0
  268. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/array.js +16 -0
  269. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/array.js.map +1 -0
  270. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/bigint.js +11 -0
  271. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/bigint.js.map +1 -0
  272. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/class.js +15 -0
  273. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/class.js.map +1 -0
  274. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/date.js +13 -0
  275. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/date.js.map +1 -0
  276. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/error.js +34 -0
  277. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/error.js.map +1 -0
  278. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/function.js +12 -0
  279. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/function.js.map +1 -0
  280. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/helpers.js +122 -0
  281. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/helpers.js.map +1 -0
  282. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/html.js +39 -0
  283. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/html.js.map +1 -0
  284. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/index.js +99 -0
  285. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/index.js.map +1 -0
  286. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/map.js +25 -0
  287. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/map.js.map +1 -0
  288. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/number.js +14 -0
  289. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/number.js.map +1 -0
  290. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/object.js +21 -0
  291. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/object.js.map +1 -0
  292. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/promise.js +6 -0
  293. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/promise.js.map +1 -0
  294. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/regexp.js +12 -0
  295. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/regexp.js.map +1 -0
  296. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/set.js +18 -0
  297. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/set.js.map +1 -0
  298. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/string.js +24 -0
  299. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/string.js.map +1 -0
  300. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/symbol.js +9 -0
  301. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/symbol.js.map +1 -0
  302. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/typedarray.js +30 -0
  303. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/typedarray.js.map +1 -0
  304. package/dist/node_modules/.pnpm/magic-string@0.30.21/node_modules/magic-string/dist/magic-string.es.js +939 -0
  305. package/dist/node_modules/.pnpm/magic-string@0.30.21/node_modules/magic-string/dist/magic-string.es.js.map +1 -0
  306. package/dist/node_modules/.pnpm/pathe@1.1.2/node_modules/pathe/dist/shared/pathe.ff20891b.js +82 -0
  307. package/dist/node_modules/.pnpm/pathe@1.1.2/node_modules/pathe/dist/shared/pathe.ff20891b.js.map +1 -0
  308. package/dist/node_modules/.pnpm/tinyrainbow@1.2.0/node_modules/tinyrainbow/dist/chunk-BVHSVHOK.js +82 -0
  309. package/dist/node_modules/.pnpm/tinyrainbow@1.2.0/node_modules/tinyrainbow/dist/chunk-BVHSVHOK.js.map +1 -0
  310. package/dist/node_modules/.pnpm/tinyrainbow@1.2.0/node_modules/tinyrainbow/dist/node.js +8 -0
  311. package/dist/node_modules/.pnpm/tinyrainbow@1.2.0/node_modules/tinyrainbow/dist/node.js.map +1 -0
  312. package/dist/node_modules/.pnpm/tinyspy@3.0.2/node_modules/tinyspy/dist/index.js +83 -0
  313. package/dist/node_modules/.pnpm/tinyspy@3.0.2/node_modules/tinyspy/dist/index.js.map +1 -0
  314. package/dist/node_modules/.pnpm/vitest@2.1.9_@types_node@22.20.0_jsdom@25.0.1_lightningcss@1.32.0/node_modules/vitest/dist/chunks/_commonjsHelpers.BFTU3MAI.js +9 -0
  315. package/dist/node_modules/.pnpm/vitest@2.1.9_@types_node@22.20.0_jsdom@25.0.1_lightningcss@1.32.0/node_modules/vitest/dist/chunks/_commonjsHelpers.BFTU3MAI.js.map +1 -0
  316. package/dist/node_modules/.pnpm/vitest@2.1.9_@types_node@22.20.0_jsdom@25.0.1_lightningcss@1.32.0/node_modules/vitest/dist/chunks/date.W2xKR2qe.js +51 -0
  317. package/dist/node_modules/.pnpm/vitest@2.1.9_@types_node@22.20.0_jsdom@25.0.1_lightningcss@1.32.0/node_modules/vitest/dist/chunks/date.W2xKR2qe.js.map +1 -0
  318. package/dist/node_modules/.pnpm/vitest@2.1.9_@types_node@22.20.0_jsdom@25.0.1_lightningcss@1.32.0/node_modules/vitest/dist/chunks/utils.C8RiOc4B.js +48 -0
  319. package/dist/node_modules/.pnpm/vitest@2.1.9_@types_node@22.20.0_jsdom@25.0.1_lightningcss@1.32.0/node_modules/vitest/dist/chunks/utils.C8RiOc4B.js.map +1 -0
  320. package/dist/node_modules/.pnpm/vitest@2.1.9_@types_node@22.20.0_jsdom@25.0.1_lightningcss@1.32.0/node_modules/vitest/dist/chunks/vi.DgezovHB.js +2426 -0
  321. package/dist/node_modules/.pnpm/vitest@2.1.9_@types_node@22.20.0_jsdom@25.0.1_lightningcss@1.32.0/node_modules/vitest/dist/chunks/vi.DgezovHB.js.map +1 -0
  322. package/dist/packages/server/package.js +6 -0
  323. package/dist/packages/server/package.js.map +1 -0
  324. package/package.json +9 -7
  325. package/dist/app/notifications.d.ts +0 -7
  326. package/dist/app/notifications.js +0 -26
  327. package/dist/app/notifications.js.map +0 -1
  328. package/dist/http/routes/learn/assets.d.ts +0 -8
  329. package/dist/http/routes/learn/assets.js +0 -32
  330. package/dist/http/routes/learn/assets.js.map +0 -1
  331. package/dist/http/routes/learn/comments.d.ts +0 -7
  332. package/dist/http/routes/learn/comments.js +0 -175
  333. package/dist/http/routes/learn/comments.js.map +0 -1
  334. package/dist/http/routes/learn/courses.d.ts +0 -7
  335. package/dist/http/routes/learn/courses.js +0 -98
  336. package/dist/http/routes/learn/courses.js.map +0 -1
  337. package/dist/http/routes/learn/downloads.d.ts +0 -7
  338. package/dist/http/routes/learn/downloads.js +0 -76
  339. package/dist/http/routes/learn/downloads.js.map +0 -1
  340. package/dist/http/routes/learn/index.d.ts +0 -7
  341. package/dist/http/routes/learn/index.js +0 -19
  342. package/dist/http/routes/learn/index.js.map +0 -1
  343. package/dist/http/routes/learn/org.d.ts +0 -7
  344. package/dist/http/routes/learn/org.js +0 -50
  345. package/dist/http/routes/learn/org.js.map +0 -1
  346. package/dist/http/routes/learn/progress.d.ts +0 -7
  347. package/dist/http/routes/learn/progress.js +0 -63
  348. package/dist/http/routes/learn/progress.js.map +0 -1
  349. package/dist/http/schemas/learn.js.map +0 -1
  350. package/dist/package.js +0 -6
  351. package/dist/package.js.map +0 -1
@@ -0,0 +1,939 @@
1
+ import { encode } from "../../../../@jridgewell_sourcemap-codec@1.5.5/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.js";
2
+ //#region ../../node_modules/.pnpm/magic-string@0.30.21/node_modules/magic-string/dist/magic-string.es.mjs
3
+ var BitSet = class BitSet {
4
+ constructor(arg) {
5
+ this.bits = arg instanceof BitSet ? arg.bits.slice() : [];
6
+ }
7
+ add(n) {
8
+ this.bits[n >> 5] |= 1 << (n & 31);
9
+ }
10
+ has(n) {
11
+ return !!(this.bits[n >> 5] & 1 << (n & 31));
12
+ }
13
+ };
14
+ var Chunk = class Chunk {
15
+ constructor(start, end, content) {
16
+ this.start = start;
17
+ this.end = end;
18
+ this.original = content;
19
+ this.intro = "";
20
+ this.outro = "";
21
+ this.content = content;
22
+ this.storeName = false;
23
+ this.edited = false;
24
+ this.previous = null;
25
+ this.next = null;
26
+ }
27
+ appendLeft(content) {
28
+ this.outro += content;
29
+ }
30
+ appendRight(content) {
31
+ this.intro = this.intro + content;
32
+ }
33
+ clone() {
34
+ const chunk = new Chunk(this.start, this.end, this.original);
35
+ chunk.intro = this.intro;
36
+ chunk.outro = this.outro;
37
+ chunk.content = this.content;
38
+ chunk.storeName = this.storeName;
39
+ chunk.edited = this.edited;
40
+ return chunk;
41
+ }
42
+ contains(index) {
43
+ return this.start < index && index < this.end;
44
+ }
45
+ eachNext(fn) {
46
+ let chunk = this;
47
+ while (chunk) {
48
+ fn(chunk);
49
+ chunk = chunk.next;
50
+ }
51
+ }
52
+ eachPrevious(fn) {
53
+ let chunk = this;
54
+ while (chunk) {
55
+ fn(chunk);
56
+ chunk = chunk.previous;
57
+ }
58
+ }
59
+ edit(content, storeName, contentOnly) {
60
+ this.content = content;
61
+ if (!contentOnly) {
62
+ this.intro = "";
63
+ this.outro = "";
64
+ }
65
+ this.storeName = storeName;
66
+ this.edited = true;
67
+ return this;
68
+ }
69
+ prependLeft(content) {
70
+ this.outro = content + this.outro;
71
+ }
72
+ prependRight(content) {
73
+ this.intro = content + this.intro;
74
+ }
75
+ reset() {
76
+ this.intro = "";
77
+ this.outro = "";
78
+ if (this.edited) {
79
+ this.content = this.original;
80
+ this.storeName = false;
81
+ this.edited = false;
82
+ }
83
+ }
84
+ split(index) {
85
+ const sliceIndex = index - this.start;
86
+ const originalBefore = this.original.slice(0, sliceIndex);
87
+ const originalAfter = this.original.slice(sliceIndex);
88
+ this.original = originalBefore;
89
+ const newChunk = new Chunk(index, this.end, originalAfter);
90
+ newChunk.outro = this.outro;
91
+ this.outro = "";
92
+ this.end = index;
93
+ if (this.edited) {
94
+ newChunk.edit("", false);
95
+ this.content = "";
96
+ } else this.content = originalBefore;
97
+ newChunk.next = this.next;
98
+ if (newChunk.next) newChunk.next.previous = newChunk;
99
+ newChunk.previous = this;
100
+ this.next = newChunk;
101
+ return newChunk;
102
+ }
103
+ toString() {
104
+ return this.intro + this.content + this.outro;
105
+ }
106
+ trimEnd(rx) {
107
+ this.outro = this.outro.replace(rx, "");
108
+ if (this.outro.length) return true;
109
+ const trimmed = this.content.replace(rx, "");
110
+ if (trimmed.length) {
111
+ if (trimmed !== this.content) {
112
+ this.split(this.start + trimmed.length).edit("", void 0, true);
113
+ if (this.edited) this.edit(trimmed, this.storeName, true);
114
+ }
115
+ return true;
116
+ } else {
117
+ this.edit("", void 0, true);
118
+ this.intro = this.intro.replace(rx, "");
119
+ if (this.intro.length) return true;
120
+ }
121
+ }
122
+ trimStart(rx) {
123
+ this.intro = this.intro.replace(rx, "");
124
+ if (this.intro.length) return true;
125
+ const trimmed = this.content.replace(rx, "");
126
+ if (trimmed.length) {
127
+ if (trimmed !== this.content) {
128
+ const newChunk = this.split(this.end - trimmed.length);
129
+ if (this.edited) newChunk.edit(trimmed, this.storeName, true);
130
+ this.edit("", void 0, true);
131
+ }
132
+ return true;
133
+ } else {
134
+ this.edit("", void 0, true);
135
+ this.outro = this.outro.replace(rx, "");
136
+ if (this.outro.length) return true;
137
+ }
138
+ }
139
+ };
140
+ function getBtoa() {
141
+ if (typeof globalThis !== "undefined" && typeof globalThis.btoa === "function") return (str) => globalThis.btoa(unescape(encodeURIComponent(str)));
142
+ else if (typeof Buffer === "function") return (str) => Buffer.from(str, "utf-8").toString("base64");
143
+ else return () => {
144
+ throw new Error("Unsupported environment: `window.btoa` or `Buffer` should be supported.");
145
+ };
146
+ }
147
+ const btoa = /*#__PURE__*/ getBtoa();
148
+ var SourceMap = class {
149
+ constructor(properties) {
150
+ this.version = 3;
151
+ this.file = properties.file;
152
+ this.sources = properties.sources;
153
+ this.sourcesContent = properties.sourcesContent;
154
+ this.names = properties.names;
155
+ this.mappings = encode(properties.mappings);
156
+ if (typeof properties.x_google_ignoreList !== "undefined") this.x_google_ignoreList = properties.x_google_ignoreList;
157
+ if (typeof properties.debugId !== "undefined") this.debugId = properties.debugId;
158
+ }
159
+ toString() {
160
+ return JSON.stringify(this);
161
+ }
162
+ toUrl() {
163
+ return "data:application/json;charset=utf-8;base64," + btoa(this.toString());
164
+ }
165
+ };
166
+ function guessIndent(code) {
167
+ const lines = code.split("\n");
168
+ const tabbed = lines.filter((line) => /^\t+/.test(line));
169
+ const spaced = lines.filter((line) => /^ {2,}/.test(line));
170
+ if (tabbed.length === 0 && spaced.length === 0) return null;
171
+ if (tabbed.length >= spaced.length) return " ";
172
+ const min = spaced.reduce((previous, current) => {
173
+ const numSpaces = /^ +/.exec(current)[0].length;
174
+ return Math.min(numSpaces, previous);
175
+ }, Infinity);
176
+ return new Array(min + 1).join(" ");
177
+ }
178
+ function getRelativePath(from, to) {
179
+ const fromParts = from.split(/[/\\]/);
180
+ const toParts = to.split(/[/\\]/);
181
+ fromParts.pop();
182
+ while (fromParts[0] === toParts[0]) {
183
+ fromParts.shift();
184
+ toParts.shift();
185
+ }
186
+ if (fromParts.length) {
187
+ let i = fromParts.length;
188
+ while (i--) fromParts[i] = "..";
189
+ }
190
+ return fromParts.concat(toParts).join("/");
191
+ }
192
+ const toString = Object.prototype.toString;
193
+ function isObject(thing) {
194
+ return toString.call(thing) === "[object Object]";
195
+ }
196
+ function getLocator(source) {
197
+ const originalLines = source.split("\n");
198
+ const lineOffsets = [];
199
+ for (let i = 0, pos = 0; i < originalLines.length; i++) {
200
+ lineOffsets.push(pos);
201
+ pos += originalLines[i].length + 1;
202
+ }
203
+ return function locate(index) {
204
+ let i = 0;
205
+ let j = lineOffsets.length;
206
+ while (i < j) {
207
+ const m = i + j >> 1;
208
+ if (index < lineOffsets[m]) j = m;
209
+ else i = m + 1;
210
+ }
211
+ const line = i - 1;
212
+ return {
213
+ line,
214
+ column: index - lineOffsets[line]
215
+ };
216
+ };
217
+ }
218
+ const wordRegex = /\w/;
219
+ var Mappings = class {
220
+ constructor(hires) {
221
+ this.hires = hires;
222
+ this.generatedCodeLine = 0;
223
+ this.generatedCodeColumn = 0;
224
+ this.raw = [];
225
+ this.rawSegments = this.raw[this.generatedCodeLine] = [];
226
+ this.pending = null;
227
+ }
228
+ addEdit(sourceIndex, content, loc, nameIndex) {
229
+ if (content.length) {
230
+ const contentLengthMinusOne = content.length - 1;
231
+ let contentLineEnd = content.indexOf("\n", 0);
232
+ let previousContentLineEnd = -1;
233
+ while (contentLineEnd >= 0 && contentLengthMinusOne > contentLineEnd) {
234
+ const segment = [
235
+ this.generatedCodeColumn,
236
+ sourceIndex,
237
+ loc.line,
238
+ loc.column
239
+ ];
240
+ if (nameIndex >= 0) segment.push(nameIndex);
241
+ this.rawSegments.push(segment);
242
+ this.generatedCodeLine += 1;
243
+ this.raw[this.generatedCodeLine] = this.rawSegments = [];
244
+ this.generatedCodeColumn = 0;
245
+ previousContentLineEnd = contentLineEnd;
246
+ contentLineEnd = content.indexOf("\n", contentLineEnd + 1);
247
+ }
248
+ const segment = [
249
+ this.generatedCodeColumn,
250
+ sourceIndex,
251
+ loc.line,
252
+ loc.column
253
+ ];
254
+ if (nameIndex >= 0) segment.push(nameIndex);
255
+ this.rawSegments.push(segment);
256
+ this.advance(content.slice(previousContentLineEnd + 1));
257
+ } else if (this.pending) {
258
+ this.rawSegments.push(this.pending);
259
+ this.advance(content);
260
+ }
261
+ this.pending = null;
262
+ }
263
+ addUneditedChunk(sourceIndex, chunk, original, loc, sourcemapLocations) {
264
+ let originalCharIndex = chunk.start;
265
+ let first = true;
266
+ let charInHiresBoundary = false;
267
+ while (originalCharIndex < chunk.end) {
268
+ if (original[originalCharIndex] === "\n") {
269
+ loc.line += 1;
270
+ loc.column = 0;
271
+ this.generatedCodeLine += 1;
272
+ this.raw[this.generatedCodeLine] = this.rawSegments = [];
273
+ this.generatedCodeColumn = 0;
274
+ first = true;
275
+ charInHiresBoundary = false;
276
+ } else {
277
+ if (this.hires || first || sourcemapLocations.has(originalCharIndex)) {
278
+ const segment = [
279
+ this.generatedCodeColumn,
280
+ sourceIndex,
281
+ loc.line,
282
+ loc.column
283
+ ];
284
+ if (this.hires === "boundary") if (wordRegex.test(original[originalCharIndex])) {
285
+ if (!charInHiresBoundary) {
286
+ this.rawSegments.push(segment);
287
+ charInHiresBoundary = true;
288
+ }
289
+ } else {
290
+ this.rawSegments.push(segment);
291
+ charInHiresBoundary = false;
292
+ }
293
+ else this.rawSegments.push(segment);
294
+ }
295
+ loc.column += 1;
296
+ this.generatedCodeColumn += 1;
297
+ first = false;
298
+ }
299
+ originalCharIndex += 1;
300
+ }
301
+ this.pending = null;
302
+ }
303
+ advance(str) {
304
+ if (!str) return;
305
+ const lines = str.split("\n");
306
+ if (lines.length > 1) {
307
+ for (let i = 0; i < lines.length - 1; i++) {
308
+ this.generatedCodeLine++;
309
+ this.raw[this.generatedCodeLine] = this.rawSegments = [];
310
+ }
311
+ this.generatedCodeColumn = 0;
312
+ }
313
+ this.generatedCodeColumn += lines[lines.length - 1].length;
314
+ }
315
+ };
316
+ const n = "\n";
317
+ const warned = {
318
+ insertLeft: false,
319
+ insertRight: false,
320
+ storeName: false
321
+ };
322
+ var MagicString = class MagicString {
323
+ constructor(string, options = {}) {
324
+ const chunk = new Chunk(0, string.length, string);
325
+ Object.defineProperties(this, {
326
+ original: {
327
+ writable: true,
328
+ value: string
329
+ },
330
+ outro: {
331
+ writable: true,
332
+ value: ""
333
+ },
334
+ intro: {
335
+ writable: true,
336
+ value: ""
337
+ },
338
+ firstChunk: {
339
+ writable: true,
340
+ value: chunk
341
+ },
342
+ lastChunk: {
343
+ writable: true,
344
+ value: chunk
345
+ },
346
+ lastSearchedChunk: {
347
+ writable: true,
348
+ value: chunk
349
+ },
350
+ byStart: {
351
+ writable: true,
352
+ value: {}
353
+ },
354
+ byEnd: {
355
+ writable: true,
356
+ value: {}
357
+ },
358
+ filename: {
359
+ writable: true,
360
+ value: options.filename
361
+ },
362
+ indentExclusionRanges: {
363
+ writable: true,
364
+ value: options.indentExclusionRanges
365
+ },
366
+ sourcemapLocations: {
367
+ writable: true,
368
+ value: new BitSet()
369
+ },
370
+ storedNames: {
371
+ writable: true,
372
+ value: {}
373
+ },
374
+ indentStr: {
375
+ writable: true,
376
+ value: void 0
377
+ },
378
+ ignoreList: {
379
+ writable: true,
380
+ value: options.ignoreList
381
+ },
382
+ offset: {
383
+ writable: true,
384
+ value: options.offset || 0
385
+ }
386
+ });
387
+ this.byStart[0] = chunk;
388
+ this.byEnd[string.length] = chunk;
389
+ }
390
+ addSourcemapLocation(char) {
391
+ this.sourcemapLocations.add(char);
392
+ }
393
+ append(content) {
394
+ if (typeof content !== "string") throw new TypeError("outro content must be a string");
395
+ this.outro += content;
396
+ return this;
397
+ }
398
+ appendLeft(index, content) {
399
+ index = index + this.offset;
400
+ if (typeof content !== "string") throw new TypeError("inserted content must be a string");
401
+ this._split(index);
402
+ const chunk = this.byEnd[index];
403
+ if (chunk) chunk.appendLeft(content);
404
+ else this.intro += content;
405
+ return this;
406
+ }
407
+ appendRight(index, content) {
408
+ index = index + this.offset;
409
+ if (typeof content !== "string") throw new TypeError("inserted content must be a string");
410
+ this._split(index);
411
+ const chunk = this.byStart[index];
412
+ if (chunk) chunk.appendRight(content);
413
+ else this.outro += content;
414
+ return this;
415
+ }
416
+ clone() {
417
+ const cloned = new MagicString(this.original, {
418
+ filename: this.filename,
419
+ offset: this.offset
420
+ });
421
+ let originalChunk = this.firstChunk;
422
+ let clonedChunk = cloned.firstChunk = cloned.lastSearchedChunk = originalChunk.clone();
423
+ while (originalChunk) {
424
+ cloned.byStart[clonedChunk.start] = clonedChunk;
425
+ cloned.byEnd[clonedChunk.end] = clonedChunk;
426
+ const nextOriginalChunk = originalChunk.next;
427
+ const nextClonedChunk = nextOriginalChunk && nextOriginalChunk.clone();
428
+ if (nextClonedChunk) {
429
+ clonedChunk.next = nextClonedChunk;
430
+ nextClonedChunk.previous = clonedChunk;
431
+ clonedChunk = nextClonedChunk;
432
+ }
433
+ originalChunk = nextOriginalChunk;
434
+ }
435
+ cloned.lastChunk = clonedChunk;
436
+ if (this.indentExclusionRanges) cloned.indentExclusionRanges = this.indentExclusionRanges.slice();
437
+ cloned.sourcemapLocations = new BitSet(this.sourcemapLocations);
438
+ cloned.intro = this.intro;
439
+ cloned.outro = this.outro;
440
+ return cloned;
441
+ }
442
+ generateDecodedMap(options) {
443
+ options = options || {};
444
+ const sourceIndex = 0;
445
+ const names = Object.keys(this.storedNames);
446
+ const mappings = new Mappings(options.hires);
447
+ const locate = getLocator(this.original);
448
+ if (this.intro) mappings.advance(this.intro);
449
+ this.firstChunk.eachNext((chunk) => {
450
+ const loc = locate(chunk.start);
451
+ if (chunk.intro.length) mappings.advance(chunk.intro);
452
+ if (chunk.edited) mappings.addEdit(sourceIndex, chunk.content, loc, chunk.storeName ? names.indexOf(chunk.original) : -1);
453
+ else mappings.addUneditedChunk(sourceIndex, chunk, this.original, loc, this.sourcemapLocations);
454
+ if (chunk.outro.length) mappings.advance(chunk.outro);
455
+ });
456
+ if (this.outro) mappings.advance(this.outro);
457
+ return {
458
+ file: options.file ? options.file.split(/[/\\]/).pop() : void 0,
459
+ sources: [options.source ? getRelativePath(options.file || "", options.source) : options.file || ""],
460
+ sourcesContent: options.includeContent ? [this.original] : void 0,
461
+ names,
462
+ mappings: mappings.raw,
463
+ x_google_ignoreList: this.ignoreList ? [sourceIndex] : void 0
464
+ };
465
+ }
466
+ generateMap(options) {
467
+ return new SourceMap(this.generateDecodedMap(options));
468
+ }
469
+ _ensureindentStr() {
470
+ if (this.indentStr === void 0) this.indentStr = guessIndent(this.original);
471
+ }
472
+ _getRawIndentString() {
473
+ this._ensureindentStr();
474
+ return this.indentStr;
475
+ }
476
+ getIndentString() {
477
+ this._ensureindentStr();
478
+ return this.indentStr === null ? " " : this.indentStr;
479
+ }
480
+ indent(indentStr, options) {
481
+ const pattern = /^[^\r\n]/gm;
482
+ if (isObject(indentStr)) {
483
+ options = indentStr;
484
+ indentStr = void 0;
485
+ }
486
+ if (indentStr === void 0) {
487
+ this._ensureindentStr();
488
+ indentStr = this.indentStr || " ";
489
+ }
490
+ if (indentStr === "") return this;
491
+ options = options || {};
492
+ const isExcluded = {};
493
+ if (options.exclude) (typeof options.exclude[0] === "number" ? [options.exclude] : options.exclude).forEach((exclusion) => {
494
+ for (let i = exclusion[0]; i < exclusion[1]; i += 1) isExcluded[i] = true;
495
+ });
496
+ let shouldIndentNextCharacter = options.indentStart !== false;
497
+ const replacer = (match) => {
498
+ if (shouldIndentNextCharacter) return `${indentStr}${match}`;
499
+ shouldIndentNextCharacter = true;
500
+ return match;
501
+ };
502
+ this.intro = this.intro.replace(pattern, replacer);
503
+ let charIndex = 0;
504
+ let chunk = this.firstChunk;
505
+ while (chunk) {
506
+ const end = chunk.end;
507
+ if (chunk.edited) {
508
+ if (!isExcluded[charIndex]) {
509
+ chunk.content = chunk.content.replace(pattern, replacer);
510
+ if (chunk.content.length) shouldIndentNextCharacter = chunk.content[chunk.content.length - 1] === "\n";
511
+ }
512
+ } else {
513
+ charIndex = chunk.start;
514
+ while (charIndex < end) {
515
+ if (!isExcluded[charIndex]) {
516
+ const char = this.original[charIndex];
517
+ if (char === "\n") shouldIndentNextCharacter = true;
518
+ else if (char !== "\r" && shouldIndentNextCharacter) {
519
+ shouldIndentNextCharacter = false;
520
+ if (charIndex === chunk.start) chunk.prependRight(indentStr);
521
+ else {
522
+ this._splitChunk(chunk, charIndex);
523
+ chunk = chunk.next;
524
+ chunk.prependRight(indentStr);
525
+ }
526
+ }
527
+ }
528
+ charIndex += 1;
529
+ }
530
+ }
531
+ charIndex = chunk.end;
532
+ chunk = chunk.next;
533
+ }
534
+ this.outro = this.outro.replace(pattern, replacer);
535
+ return this;
536
+ }
537
+ insert() {
538
+ throw new Error("magicString.insert(...) is deprecated. Use prependRight(...) or appendLeft(...)");
539
+ }
540
+ insertLeft(index, content) {
541
+ if (!warned.insertLeft) {
542
+ console.warn("magicString.insertLeft(...) is deprecated. Use magicString.appendLeft(...) instead");
543
+ warned.insertLeft = true;
544
+ }
545
+ return this.appendLeft(index, content);
546
+ }
547
+ insertRight(index, content) {
548
+ if (!warned.insertRight) {
549
+ console.warn("magicString.insertRight(...) is deprecated. Use magicString.prependRight(...) instead");
550
+ warned.insertRight = true;
551
+ }
552
+ return this.prependRight(index, content);
553
+ }
554
+ move(start, end, index) {
555
+ start = start + this.offset;
556
+ end = end + this.offset;
557
+ index = index + this.offset;
558
+ if (index >= start && index <= end) throw new Error("Cannot move a selection inside itself");
559
+ this._split(start);
560
+ this._split(end);
561
+ this._split(index);
562
+ const first = this.byStart[start];
563
+ const last = this.byEnd[end];
564
+ const oldLeft = first.previous;
565
+ const oldRight = last.next;
566
+ const newRight = this.byStart[index];
567
+ if (!newRight && last === this.lastChunk) return this;
568
+ const newLeft = newRight ? newRight.previous : this.lastChunk;
569
+ if (oldLeft) oldLeft.next = oldRight;
570
+ if (oldRight) oldRight.previous = oldLeft;
571
+ if (newLeft) newLeft.next = first;
572
+ if (newRight) newRight.previous = last;
573
+ if (!first.previous) this.firstChunk = last.next;
574
+ if (!last.next) {
575
+ this.lastChunk = first.previous;
576
+ this.lastChunk.next = null;
577
+ }
578
+ first.previous = newLeft;
579
+ last.next = newRight || null;
580
+ if (!newLeft) this.firstChunk = first;
581
+ if (!newRight) this.lastChunk = last;
582
+ return this;
583
+ }
584
+ overwrite(start, end, content, options) {
585
+ options = options || {};
586
+ return this.update(start, end, content, {
587
+ ...options,
588
+ overwrite: !options.contentOnly
589
+ });
590
+ }
591
+ update(start, end, content, options) {
592
+ start = start + this.offset;
593
+ end = end + this.offset;
594
+ if (typeof content !== "string") throw new TypeError("replacement content must be a string");
595
+ if (this.original.length !== 0) {
596
+ while (start < 0) start += this.original.length;
597
+ while (end < 0) end += this.original.length;
598
+ }
599
+ if (end > this.original.length) throw new Error("end is out of bounds");
600
+ if (start === end) throw new Error("Cannot overwrite a zero-length range – use appendLeft or prependRight instead");
601
+ this._split(start);
602
+ this._split(end);
603
+ if (options === true) {
604
+ if (!warned.storeName) {
605
+ console.warn("The final argument to magicString.overwrite(...) should be an options object. See https://github.com/rich-harris/magic-string");
606
+ warned.storeName = true;
607
+ }
608
+ options = { storeName: true };
609
+ }
610
+ const storeName = options !== void 0 ? options.storeName : false;
611
+ const overwrite = options !== void 0 ? options.overwrite : false;
612
+ if (storeName) {
613
+ const original = this.original.slice(start, end);
614
+ Object.defineProperty(this.storedNames, original, {
615
+ writable: true,
616
+ value: true,
617
+ enumerable: true
618
+ });
619
+ }
620
+ const first = this.byStart[start];
621
+ const last = this.byEnd[end];
622
+ if (first) {
623
+ let chunk = first;
624
+ while (chunk !== last) {
625
+ if (chunk.next !== this.byStart[chunk.end]) throw new Error("Cannot overwrite across a split point");
626
+ chunk = chunk.next;
627
+ chunk.edit("", false);
628
+ }
629
+ first.edit(content, storeName, !overwrite);
630
+ } else {
631
+ const newChunk = new Chunk(start, end, "").edit(content, storeName);
632
+ last.next = newChunk;
633
+ newChunk.previous = last;
634
+ }
635
+ return this;
636
+ }
637
+ prepend(content) {
638
+ if (typeof content !== "string") throw new TypeError("outro content must be a string");
639
+ this.intro = content + this.intro;
640
+ return this;
641
+ }
642
+ prependLeft(index, content) {
643
+ index = index + this.offset;
644
+ if (typeof content !== "string") throw new TypeError("inserted content must be a string");
645
+ this._split(index);
646
+ const chunk = this.byEnd[index];
647
+ if (chunk) chunk.prependLeft(content);
648
+ else this.intro = content + this.intro;
649
+ return this;
650
+ }
651
+ prependRight(index, content) {
652
+ index = index + this.offset;
653
+ if (typeof content !== "string") throw new TypeError("inserted content must be a string");
654
+ this._split(index);
655
+ const chunk = this.byStart[index];
656
+ if (chunk) chunk.prependRight(content);
657
+ else this.outro = content + this.outro;
658
+ return this;
659
+ }
660
+ remove(start, end) {
661
+ start = start + this.offset;
662
+ end = end + this.offset;
663
+ if (this.original.length !== 0) {
664
+ while (start < 0) start += this.original.length;
665
+ while (end < 0) end += this.original.length;
666
+ }
667
+ if (start === end) return this;
668
+ if (start < 0 || end > this.original.length) throw new Error("Character is out of bounds");
669
+ if (start > end) throw new Error("end must be greater than start");
670
+ this._split(start);
671
+ this._split(end);
672
+ let chunk = this.byStart[start];
673
+ while (chunk) {
674
+ chunk.intro = "";
675
+ chunk.outro = "";
676
+ chunk.edit("");
677
+ chunk = end > chunk.end ? this.byStart[chunk.end] : null;
678
+ }
679
+ return this;
680
+ }
681
+ reset(start, end) {
682
+ start = start + this.offset;
683
+ end = end + this.offset;
684
+ if (this.original.length !== 0) {
685
+ while (start < 0) start += this.original.length;
686
+ while (end < 0) end += this.original.length;
687
+ }
688
+ if (start === end) return this;
689
+ if (start < 0 || end > this.original.length) throw new Error("Character is out of bounds");
690
+ if (start > end) throw new Error("end must be greater than start");
691
+ this._split(start);
692
+ this._split(end);
693
+ let chunk = this.byStart[start];
694
+ while (chunk) {
695
+ chunk.reset();
696
+ chunk = end > chunk.end ? this.byStart[chunk.end] : null;
697
+ }
698
+ return this;
699
+ }
700
+ lastChar() {
701
+ if (this.outro.length) return this.outro[this.outro.length - 1];
702
+ let chunk = this.lastChunk;
703
+ do {
704
+ if (chunk.outro.length) return chunk.outro[chunk.outro.length - 1];
705
+ if (chunk.content.length) return chunk.content[chunk.content.length - 1];
706
+ if (chunk.intro.length) return chunk.intro[chunk.intro.length - 1];
707
+ } while (chunk = chunk.previous);
708
+ if (this.intro.length) return this.intro[this.intro.length - 1];
709
+ return "";
710
+ }
711
+ lastLine() {
712
+ let lineIndex = this.outro.lastIndexOf(n);
713
+ if (lineIndex !== -1) return this.outro.substr(lineIndex + 1);
714
+ let lineStr = this.outro;
715
+ let chunk = this.lastChunk;
716
+ do {
717
+ if (chunk.outro.length > 0) {
718
+ lineIndex = chunk.outro.lastIndexOf(n);
719
+ if (lineIndex !== -1) return chunk.outro.substr(lineIndex + 1) + lineStr;
720
+ lineStr = chunk.outro + lineStr;
721
+ }
722
+ if (chunk.content.length > 0) {
723
+ lineIndex = chunk.content.lastIndexOf(n);
724
+ if (lineIndex !== -1) return chunk.content.substr(lineIndex + 1) + lineStr;
725
+ lineStr = chunk.content + lineStr;
726
+ }
727
+ if (chunk.intro.length > 0) {
728
+ lineIndex = chunk.intro.lastIndexOf(n);
729
+ if (lineIndex !== -1) return chunk.intro.substr(lineIndex + 1) + lineStr;
730
+ lineStr = chunk.intro + lineStr;
731
+ }
732
+ } while (chunk = chunk.previous);
733
+ lineIndex = this.intro.lastIndexOf(n);
734
+ if (lineIndex !== -1) return this.intro.substr(lineIndex + 1) + lineStr;
735
+ return this.intro + lineStr;
736
+ }
737
+ slice(start = 0, end = this.original.length - this.offset) {
738
+ start = start + this.offset;
739
+ end = end + this.offset;
740
+ if (this.original.length !== 0) {
741
+ while (start < 0) start += this.original.length;
742
+ while (end < 0) end += this.original.length;
743
+ }
744
+ let result = "";
745
+ let chunk = this.firstChunk;
746
+ while (chunk && (chunk.start > start || chunk.end <= start)) {
747
+ if (chunk.start < end && chunk.end >= end) return result;
748
+ chunk = chunk.next;
749
+ }
750
+ if (chunk && chunk.edited && chunk.start !== start) throw new Error(`Cannot use replaced character ${start} as slice start anchor.`);
751
+ const startChunk = chunk;
752
+ while (chunk) {
753
+ if (chunk.intro && (startChunk !== chunk || chunk.start === start)) result += chunk.intro;
754
+ const containsEnd = chunk.start < end && chunk.end >= end;
755
+ if (containsEnd && chunk.edited && chunk.end !== end) throw new Error(`Cannot use replaced character ${end} as slice end anchor.`);
756
+ const sliceStart = startChunk === chunk ? start - chunk.start : 0;
757
+ const sliceEnd = containsEnd ? chunk.content.length + end - chunk.end : chunk.content.length;
758
+ result += chunk.content.slice(sliceStart, sliceEnd);
759
+ if (chunk.outro && (!containsEnd || chunk.end === end)) result += chunk.outro;
760
+ if (containsEnd) break;
761
+ chunk = chunk.next;
762
+ }
763
+ return result;
764
+ }
765
+ snip(start, end) {
766
+ const clone = this.clone();
767
+ clone.remove(0, start);
768
+ clone.remove(end, clone.original.length);
769
+ return clone;
770
+ }
771
+ _split(index) {
772
+ if (this.byStart[index] || this.byEnd[index]) return;
773
+ let chunk = this.lastSearchedChunk;
774
+ let previousChunk = chunk;
775
+ const searchForward = index > chunk.end;
776
+ while (chunk) {
777
+ if (chunk.contains(index)) return this._splitChunk(chunk, index);
778
+ chunk = searchForward ? this.byStart[chunk.end] : this.byEnd[chunk.start];
779
+ if (chunk === previousChunk) return;
780
+ previousChunk = chunk;
781
+ }
782
+ }
783
+ _splitChunk(chunk, index) {
784
+ if (chunk.edited && chunk.content.length) {
785
+ const loc = getLocator(this.original)(index);
786
+ throw new Error(`Cannot split a chunk that has already been edited (${loc.line}:${loc.column} – "${chunk.original}")`);
787
+ }
788
+ const newChunk = chunk.split(index);
789
+ this.byEnd[index] = chunk;
790
+ this.byStart[index] = newChunk;
791
+ this.byEnd[newChunk.end] = newChunk;
792
+ if (chunk === this.lastChunk) this.lastChunk = newChunk;
793
+ this.lastSearchedChunk = chunk;
794
+ return true;
795
+ }
796
+ toString() {
797
+ let str = this.intro;
798
+ let chunk = this.firstChunk;
799
+ while (chunk) {
800
+ str += chunk.toString();
801
+ chunk = chunk.next;
802
+ }
803
+ return str + this.outro;
804
+ }
805
+ isEmpty() {
806
+ let chunk = this.firstChunk;
807
+ do
808
+ if (chunk.intro.length && chunk.intro.trim() || chunk.content.length && chunk.content.trim() || chunk.outro.length && chunk.outro.trim()) return false;
809
+ while (chunk = chunk.next);
810
+ return true;
811
+ }
812
+ length() {
813
+ let chunk = this.firstChunk;
814
+ let length = 0;
815
+ do
816
+ length += chunk.intro.length + chunk.content.length + chunk.outro.length;
817
+ while (chunk = chunk.next);
818
+ return length;
819
+ }
820
+ trimLines() {
821
+ return this.trim("[\\r\\n]");
822
+ }
823
+ trim(charType) {
824
+ return this.trimStart(charType).trimEnd(charType);
825
+ }
826
+ trimEndAborted(charType) {
827
+ const rx = new RegExp((charType || "\\s") + "+$");
828
+ this.outro = this.outro.replace(rx, "");
829
+ if (this.outro.length) return true;
830
+ let chunk = this.lastChunk;
831
+ do {
832
+ const end = chunk.end;
833
+ const aborted = chunk.trimEnd(rx);
834
+ if (chunk.end !== end) {
835
+ if (this.lastChunk === chunk) this.lastChunk = chunk.next;
836
+ this.byEnd[chunk.end] = chunk;
837
+ this.byStart[chunk.next.start] = chunk.next;
838
+ this.byEnd[chunk.next.end] = chunk.next;
839
+ }
840
+ if (aborted) return true;
841
+ chunk = chunk.previous;
842
+ } while (chunk);
843
+ return false;
844
+ }
845
+ trimEnd(charType) {
846
+ this.trimEndAborted(charType);
847
+ return this;
848
+ }
849
+ trimStartAborted(charType) {
850
+ const rx = new RegExp("^" + (charType || "\\s") + "+");
851
+ this.intro = this.intro.replace(rx, "");
852
+ if (this.intro.length) return true;
853
+ let chunk = this.firstChunk;
854
+ do {
855
+ const end = chunk.end;
856
+ const aborted = chunk.trimStart(rx);
857
+ if (chunk.end !== end) {
858
+ if (chunk === this.lastChunk) this.lastChunk = chunk.next;
859
+ this.byEnd[chunk.end] = chunk;
860
+ this.byStart[chunk.next.start] = chunk.next;
861
+ this.byEnd[chunk.next.end] = chunk.next;
862
+ }
863
+ if (aborted) return true;
864
+ chunk = chunk.next;
865
+ } while (chunk);
866
+ return false;
867
+ }
868
+ trimStart(charType) {
869
+ this.trimStartAborted(charType);
870
+ return this;
871
+ }
872
+ hasChanged() {
873
+ return this.original !== this.toString();
874
+ }
875
+ _replaceRegexp(searchValue, replacement) {
876
+ function getReplacement(match, str) {
877
+ if (typeof replacement === "string") return replacement.replace(/\$(\$|&|\d+)/g, (_, i) => {
878
+ if (i === "$") return "$";
879
+ if (i === "&") return match[0];
880
+ if (+i < match.length) return match[+i];
881
+ return `$${i}`;
882
+ });
883
+ else return replacement(...match, match.index, str, match.groups);
884
+ }
885
+ function matchAll(re, str) {
886
+ let match;
887
+ const matches = [];
888
+ while (match = re.exec(str)) matches.push(match);
889
+ return matches;
890
+ }
891
+ if (searchValue.global) matchAll(searchValue, this.original).forEach((match) => {
892
+ if (match.index != null) {
893
+ const replacement = getReplacement(match, this.original);
894
+ if (replacement !== match[0]) this.overwrite(match.index, match.index + match[0].length, replacement);
895
+ }
896
+ });
897
+ else {
898
+ const match = this.original.match(searchValue);
899
+ if (match && match.index != null) {
900
+ const replacement = getReplacement(match, this.original);
901
+ if (replacement !== match[0]) this.overwrite(match.index, match.index + match[0].length, replacement);
902
+ }
903
+ }
904
+ return this;
905
+ }
906
+ _replaceString(string, replacement) {
907
+ const { original } = this;
908
+ const index = original.indexOf(string);
909
+ if (index !== -1) {
910
+ if (typeof replacement === "function") replacement = replacement(string, index, original);
911
+ if (string !== replacement) this.overwrite(index, index + string.length, replacement);
912
+ }
913
+ return this;
914
+ }
915
+ replace(searchValue, replacement) {
916
+ if (typeof searchValue === "string") return this._replaceString(searchValue, replacement);
917
+ return this._replaceRegexp(searchValue, replacement);
918
+ }
919
+ _replaceAllString(string, replacement) {
920
+ const { original } = this;
921
+ const stringLength = string.length;
922
+ for (let index = original.indexOf(string); index !== -1; index = original.indexOf(string, index + stringLength)) {
923
+ const previous = original.slice(index, index + stringLength);
924
+ let _replacement = replacement;
925
+ if (typeof replacement === "function") _replacement = replacement(previous, index, original);
926
+ if (previous !== _replacement) this.overwrite(index, index + stringLength, _replacement);
927
+ }
928
+ return this;
929
+ }
930
+ replaceAll(searchValue, replacement) {
931
+ if (typeof searchValue === "string") return this._replaceAllString(searchValue, replacement);
932
+ if (!searchValue.global) throw new TypeError("MagicString.prototype.replaceAll called with a non-global RegExp argument");
933
+ return this._replaceRegexp(searchValue, replacement);
934
+ }
935
+ };
936
+ //#endregion
937
+ export { SourceMap, MagicString as default };
938
+
939
+ //# sourceMappingURL=magic-string.es.js.map