@archivist-gg/dnd5e 0.1.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 (322) hide show
  1. package/LICENSE +21 -0
  2. package/LICENSES/SRD.md +37 -0
  3. package/README.md +65 -0
  4. package/dist/armor/armor.codec.d.ts +10 -0
  5. package/dist/armor/armor.codec.js +8 -0
  6. package/dist/armor/armor.entity-type.d.ts +2 -0
  7. package/dist/armor/armor.parser.d.ts +3 -0
  8. package/dist/armor/armor.parser.js +7 -0
  9. package/dist/armor/armor.schema.d.ts +25 -0
  10. package/dist/armor/armor.schema.js +6 -0
  11. package/dist/armor/armor.types.d.ts +26 -0
  12. package/dist/armor/armor.types.js +0 -0
  13. package/dist/background/background.codec.d.ts +9 -0
  14. package/dist/background/background.codec.js +11 -0
  15. package/dist/background/background.entity-type.d.ts +2 -0
  16. package/dist/background/background.parser.d.ts +3 -0
  17. package/dist/background/background.parser.js +10 -0
  18. package/dist/background/background.schema.d.ts +74 -0
  19. package/dist/background/background.schema.js +9 -0
  20. package/dist/background/background.types.d.ts +52 -0
  21. package/dist/background/background.types.js +0 -0
  22. package/dist/chunk-24GFQU7T.js +18 -0
  23. package/dist/chunk-3DZ74AKK.js +28 -0
  24. package/dist/chunk-3TM34RSJ.js +23 -0
  25. package/dist/chunk-3TRGRSCH.js +8 -0
  26. package/dist/chunk-4C2KOKLF.js +185 -0
  27. package/dist/chunk-4F6AIZ36.js +19 -0
  28. package/dist/chunk-4SSDYJS2.js +86 -0
  29. package/dist/chunk-4TIJKN6O.js +37 -0
  30. package/dist/chunk-537BHVSH.js +18 -0
  31. package/dist/chunk-5INR4NSL.js +18 -0
  32. package/dist/chunk-5XUXXAQJ.js +30 -0
  33. package/dist/chunk-656QCX4U.js +22 -0
  34. package/dist/chunk-66XXW2Z2.js +133 -0
  35. package/dist/chunk-6NK2MUD3.js +114 -0
  36. package/dist/chunk-6PXE7T7C.js +79 -0
  37. package/dist/chunk-7P65Q426.js +158 -0
  38. package/dist/chunk-A7T5L7SS.js +83 -0
  39. package/dist/chunk-AFKTJXRA.js +39 -0
  40. package/dist/chunk-B7UXKNLD.js +46 -0
  41. package/dist/chunk-BAXWWGFJ.js +45 -0
  42. package/dist/chunk-BH6AMZVY.js +25 -0
  43. package/dist/chunk-CDW7R2QT.js +62 -0
  44. package/dist/chunk-DABBCYTT.js +68 -0
  45. package/dist/chunk-DC74TZNA.js +46 -0
  46. package/dist/chunk-DNAJRMNN.js +68 -0
  47. package/dist/chunk-DRNZJNJP.js +19 -0
  48. package/dist/chunk-FEOB24KP.js +18 -0
  49. package/dist/chunk-FFULAF2P.js +63 -0
  50. package/dist/chunk-FUK7QSN5.js +19 -0
  51. package/dist/chunk-GIOH5JB5.js +19 -0
  52. package/dist/chunk-GJOI2GHP.js +25 -0
  53. package/dist/chunk-GZ46OVGZ.js +31 -0
  54. package/dist/chunk-HCP3GMHS.js +44 -0
  55. package/dist/chunk-IDTDACM6.js +19 -0
  56. package/dist/chunk-IKSMX4TN.js +0 -0
  57. package/dist/chunk-IXZXFFFW.js +269 -0
  58. package/dist/chunk-J2RYSZMQ.js +16 -0
  59. package/dist/chunk-JEYQU3JT.js +36 -0
  60. package/dist/chunk-LSLSG67V.js +31 -0
  61. package/dist/chunk-LWFTHJIE.js +24 -0
  62. package/dist/chunk-MDEJHMKK.js +52 -0
  63. package/dist/chunk-N2JE7BWL.js +81 -0
  64. package/dist/chunk-NAEPSZAM.js +88 -0
  65. package/dist/chunk-NXR3BD2V.js +90 -0
  66. package/dist/chunk-PKC77VZP.js +18 -0
  67. package/dist/chunk-PMADYMUI.js +19 -0
  68. package/dist/chunk-PTXBIDG7.js +63 -0
  69. package/dist/chunk-PZOWBI3B.js +49 -0
  70. package/dist/chunk-QQ5W2AZP.js +515 -0
  71. package/dist/chunk-QS5L5YTJ.js +24 -0
  72. package/dist/chunk-QYZV2MQA.js +97 -0
  73. package/dist/chunk-R2ZV233X.js +233 -0
  74. package/dist/chunk-RAWJTA45.js +271 -0
  75. package/dist/chunk-RSDRMH54.js +18 -0
  76. package/dist/chunk-RVYYKYFL.js +18 -0
  77. package/dist/chunk-SSXBYF3P.js +18 -0
  78. package/dist/chunk-TJCNX6UZ.js +521 -0
  79. package/dist/chunk-TZK36BU7.js +38 -0
  80. package/dist/chunk-UC4FE5X3.js +65 -0
  81. package/dist/chunk-WP2CX2JO.js +235 -0
  82. package/dist/chunk-WYGD2UGN.js +14 -0
  83. package/dist/chunk-XJNECUPT.js +31 -0
  84. package/dist/chunk-XURS6Q6Q.js +127 -0
  85. package/dist/chunk-Y4I74YEG.js +33 -0
  86. package/dist/chunk-Z4TL2V7S.js +18 -0
  87. package/dist/chunk-Z6GXV2GO.js +121 -0
  88. package/dist/chunk-ZLG6FQFB.js +237 -0
  89. package/dist/chunk-ZMR77DDL.js +18 -0
  90. package/dist/class/class.codec.d.ts +10 -0
  91. package/dist/class/class.codec.js +15 -0
  92. package/dist/class/class.entity-type.d.ts +2 -0
  93. package/dist/class/class.parser.d.ts +3 -0
  94. package/dist/class/class.parser.js +14 -0
  95. package/dist/class/class.schema.d.ts +202 -0
  96. package/dist/class/class.schema.js +13 -0
  97. package/dist/class/class.slug.d.ts +11 -0
  98. package/dist/class/class.slug.js +8 -0
  99. package/dist/class/class.types.d.ts +74 -0
  100. package/dist/class/class.types.js +0 -0
  101. package/dist/data-srd/index.generated.d.ts +7 -0
  102. package/dist/data-srd/index.generated.js +146 -0
  103. package/dist/dnd/constants.d.ts +16 -0
  104. package/dist/dnd/constants.js +36 -0
  105. package/dist/dnd/formula-tags.d.ts +16 -0
  106. package/dist/dnd/formula-tags.js +119 -0
  107. package/dist/dnd/math.d.ts +24 -0
  108. package/dist/dnd/math.js +35 -0
  109. package/dist/dnd/prose-tags.d.ts +16 -0
  110. package/dist/dnd/prose-tags.js +18 -0
  111. package/dist/dnd/resource-die.d.ts +6 -0
  112. package/dist/dnd/resource-die.js +17 -0
  113. package/dist/dnd/resource-formula.d.ts +41 -0
  114. package/dist/dnd/resource-formula.js +159 -0
  115. package/dist/dnd/srd-tag-converter.d.ts +44 -0
  116. package/dist/dnd/srd-tag-converter.js +12 -0
  117. package/dist/dnd/tag-grammar.d.ts +19 -0
  118. package/dist/dnd/tag-grammar.js +12 -0
  119. package/dist/encounter/encounter.ai-schema.d.ts +29 -0
  120. package/dist/encounter/encounter.ai-schema.js +8 -0
  121. package/dist/encounter/encounter.entity-type.d.ts +2 -0
  122. package/dist/encounter/encounter.generatable.d.ts +2 -0
  123. package/dist/entities/base-item-resolver.d.ts +21 -0
  124. package/dist/entities/base-item-resolver.js +9 -0
  125. package/dist/entities/slug.d.ts +5 -0
  126. package/dist/entities/slug.js +6 -0
  127. package/dist/feat/feat.codec.d.ts +9 -0
  128. package/dist/feat/feat.codec.js +10 -0
  129. package/dist/feat/feat.entity-type.d.ts +2 -0
  130. package/dist/feat/feat.parser.d.ts +3 -0
  131. package/dist/feat/feat.parser.js +9 -0
  132. package/dist/feat/feat.schema.d.ts +194 -0
  133. package/dist/feat/feat.schema.js +8 -0
  134. package/dist/feat/feat.types.d.ts +42 -0
  135. package/dist/feat/feat.types.js +0 -0
  136. package/dist/index.d.ts +12 -0
  137. package/dist/index.js +139149 -0
  138. package/dist/inline-tag-parser.d.ts +11 -0
  139. package/dist/inline-tag-parser.js +6 -0
  140. package/dist/item/item.actions-map.d.ts +41 -0
  141. package/dist/item/item.actions-map.js +85 -0
  142. package/dist/item/item.ai-schema.d.ts +35 -0
  143. package/dist/item/item.ai-schema.js +6 -0
  144. package/dist/item/item.attunement.d.ts +18 -0
  145. package/dist/item/item.attunement.js +12 -0
  146. package/dist/item/item.bonuses.d.ts +2 -0
  147. package/dist/item/item.bonuses.js +7 -0
  148. package/dist/item/item.codec.d.ts +3 -0
  149. package/dist/item/item.codec.js +8 -0
  150. package/dist/item/item.conditions.d.ts +10 -0
  151. package/dist/item/item.conditions.js +8 -0
  152. package/dist/item/item.conditions.types.d.ts +28 -0
  153. package/dist/item/item.conditions.types.js +0 -0
  154. package/dist/item/item.enrichment.d.ts +4 -0
  155. package/dist/item/item.enrichment.js +9 -0
  156. package/dist/item/item.entity-type.d.ts +2 -0
  157. package/dist/item/item.generatable.d.ts +2 -0
  158. package/dist/item/item.parser.d.ts +3 -0
  159. package/dist/item/item.parser.js +7 -0
  160. package/dist/item/item.schema.d.ts +174 -0
  161. package/dist/item/item.schema.js +8 -0
  162. package/dist/item/item.types.d.ts +108 -0
  163. package/dist/item/item.types.js +0 -0
  164. package/dist/monster/monster.ai-schema.d.ts +67 -0
  165. package/dist/monster/monster.ai-schema.js +6 -0
  166. package/dist/monster/monster.codec.d.ts +13 -0
  167. package/dist/monster/monster.enrichment.d.ts +10 -0
  168. package/dist/monster/monster.enrichment.js +19 -0
  169. package/dist/monster/monster.entity-type.d.ts +2 -0
  170. package/dist/monster/monster.generatable.d.ts +2 -0
  171. package/dist/monster/monster.parser.d.ts +3 -0
  172. package/dist/monster/monster.parser.js +6 -0
  173. package/dist/monster/monster.resolve.d.ts +10 -0
  174. package/dist/monster/monster.types.d.ts +29 -0
  175. package/dist/monster/monster.types.js +1 -0
  176. package/dist/npc/npc.ai-schema.d.ts +6 -0
  177. package/dist/npc/npc.entity-type.d.ts +2 -0
  178. package/dist/npc/npc.generatable.d.ts +2 -0
  179. package/dist/optional-feature/optional-feature.codec.d.ts +14 -0
  180. package/dist/optional-feature/optional-feature.codec.js +11 -0
  181. package/dist/optional-feature/optional-feature.entity-type.d.ts +2 -0
  182. package/dist/optional-feature/optional-feature.parser.d.ts +3 -0
  183. package/dist/optional-feature/optional-feature.parser.js +10 -0
  184. package/dist/optional-feature/optional-feature.schema.d.ts +236 -0
  185. package/dist/optional-feature/optional-feature.schema.js +9 -0
  186. package/dist/pack.d.ts +11 -0
  187. package/dist/pc/conditions.constants.d.ts +3 -0
  188. package/dist/pc/conditions.constants.js +8 -0
  189. package/dist/pc/decision-recognizer.d.ts +4 -0
  190. package/dist/pc/decision-recognizer.js +8 -0
  191. package/dist/pc/pc.conditions.d.ts +3 -0
  192. package/dist/pc/pc.conditions.js +6 -0
  193. package/dist/pc/pc.decision-engine.d.ts +97 -0
  194. package/dist/pc/pc.decision-engine.js +19 -0
  195. package/dist/pc/pc.equipment.d.ts +12 -0
  196. package/dist/pc/pc.equipment.js +15 -0
  197. package/dist/pc/pc.feature-effects.d.ts +95 -0
  198. package/dist/pc/pc.feature-effects.js +9 -0
  199. package/dist/pc/pc.formula-context.d.ts +4 -0
  200. package/dist/pc/pc.formula-context.js +11 -0
  201. package/dist/pc/pc.parser.d.ts +3 -0
  202. package/dist/pc/pc.parser.js +41 -0
  203. package/dist/pc/pc.pools.d.ts +12 -0
  204. package/dist/pc/pc.pools.js +15 -0
  205. package/dist/pc/pc.proficiencies.d.ts +8 -0
  206. package/dist/pc/pc.proficiencies.js +47 -0
  207. package/dist/pc/pc.proficiency-query.d.ts +11 -0
  208. package/dist/pc/pc.proficiency-query.js +17 -0
  209. package/dist/pc/pc.recalc.d.ts +105 -0
  210. package/dist/pc/pc.recalc.js +662 -0
  211. package/dist/pc/pc.resolver.d.ts +34 -0
  212. package/dist/pc/pc.resolver.js +267 -0
  213. package/dist/pc/pc.resource-seed.d.ts +10 -0
  214. package/dist/pc/pc.resource-seed.js +40 -0
  215. package/dist/pc/pc.rest.d.ts +23 -0
  216. package/dist/pc/pc.rest.js +128 -0
  217. package/dist/pc/pc.schema.d.ts +294 -0
  218. package/dist/pc/pc.schema.js +7 -0
  219. package/dist/pc/pc.slotting.d.ts +22 -0
  220. package/dist/pc/pc.slotting.js +20 -0
  221. package/dist/pc/pc.spellcasting.d.ts +56 -0
  222. package/dist/pc/pc.spellcasting.js +16 -0
  223. package/dist/pc/pc.table-column.d.ts +12 -0
  224. package/dist/pc/pc.table-column.js +8 -0
  225. package/dist/pc/pc.types.d.ts +514 -0
  226. package/dist/pc/pc.types.js +0 -0
  227. package/dist/race/race.codec.d.ts +9 -0
  228. package/dist/race/race.codec.js +13 -0
  229. package/dist/race/race.entity-type.d.ts +2 -0
  230. package/dist/race/race.parser.d.ts +3 -0
  231. package/dist/race/race.parser.js +12 -0
  232. package/dist/race/race.schema.d.ts +67 -0
  233. package/dist/race/race.schema.js +11 -0
  234. package/dist/race/race.types.d.ts +44 -0
  235. package/dist/race/race.types.js +0 -0
  236. package/dist/schemas/attack-schema.d.ts +38 -0
  237. package/dist/schemas/choice-schema.d.ts +5 -0
  238. package/dist/schemas/choice-schema.js +7 -0
  239. package/dist/schemas/duration-schema.d.ts +13 -0
  240. package/dist/schemas/duration-schema.js +6 -0
  241. package/dist/schemas/equipment-grant-schema.d.ts +6 -0
  242. package/dist/schemas/equipment-grant-schema.js +12 -0
  243. package/dist/schemas/feature-effect-schema.d.ts +131 -0
  244. package/dist/schemas/feature-effect-schema.js +6 -0
  245. package/dist/schemas/feature-schema.d.ts +2 -0
  246. package/dist/schemas/feature-schema.js +10 -0
  247. package/dist/schemas/index.d.ts +6 -0
  248. package/dist/schemas/resource-schema.d.ts +95 -0
  249. package/dist/schemas/resource-schema.js +12 -0
  250. package/dist/schemas/selection-pool-schema.d.ts +34 -0
  251. package/dist/schemas/selection-pool-schema.js +10 -0
  252. package/dist/spell/spell.access.d.ts +15 -0
  253. package/dist/spell/spell.access.js +25 -0
  254. package/dist/spell/spell.ai-schema.d.ts +24 -0
  255. package/dist/spell/spell.ai-schema.js +6 -0
  256. package/dist/spell/spell.codec.d.ts +3 -0
  257. package/dist/spell/spell.codec.js +8 -0
  258. package/dist/spell/spell.enrichment.d.ts +2 -0
  259. package/dist/spell/spell.enrichment.js +9 -0
  260. package/dist/spell/spell.entity-type.d.ts +2 -0
  261. package/dist/spell/spell.filter.d.ts +15 -0
  262. package/dist/spell/spell.filter.js +87 -0
  263. package/dist/spell/spell.generatable.d.ts +2 -0
  264. package/dist/spell/spell.parser.d.ts +3 -0
  265. package/dist/spell/spell.parser.js +7 -0
  266. package/dist/spell/spell.scaling.d.ts +14 -0
  267. package/dist/spell/spell.scaling.js +28 -0
  268. package/dist/spell/spell.schema.d.ts +31 -0
  269. package/dist/spell/spell.schema.js +6 -0
  270. package/dist/spell/spell.types.d.ts +25 -0
  271. package/dist/spell/spell.types.js +0 -0
  272. package/dist/srd-store.d.ts +53 -0
  273. package/dist/subclass/subclass.codec.d.ts +11 -0
  274. package/dist/subclass/subclass.codec.js +14 -0
  275. package/dist/subclass/subclass.entity-type.d.ts +2 -0
  276. package/dist/subclass/subclass.parser.d.ts +3 -0
  277. package/dist/subclass/subclass.parser.js +13 -0
  278. package/dist/subclass/subclass.schema.d.ts +118 -0
  279. package/dist/subclass/subclass.schema.js +12 -0
  280. package/dist/subclass/subclass.types.d.ts +20 -0
  281. package/dist/subclass/subclass.types.js +0 -0
  282. package/dist/types/abilities.d.ts +8 -0
  283. package/dist/types/abilities.js +0 -0
  284. package/dist/types/ac.d.ts +5 -0
  285. package/dist/types/attack.d.ts +22 -0
  286. package/dist/types/attack.js +0 -0
  287. package/dist/types/casting-option.d.ts +14 -0
  288. package/dist/types/casting-option.js +0 -0
  289. package/dist/types/choice.d.ts +66 -0
  290. package/dist/types/choice.js +6 -0
  291. package/dist/types/edition.d.ts +4 -0
  292. package/dist/types/edition.js +0 -0
  293. package/dist/types/equipment-grant.d.ts +41 -0
  294. package/dist/types/equipment-grant.js +0 -0
  295. package/dist/types/feature-effect.d.ts +79 -0
  296. package/dist/types/feature-effect.js +0 -0
  297. package/dist/types/feature.d.ts +41 -0
  298. package/dist/types/feature.js +0 -0
  299. package/dist/types/formula-context.d.ts +7 -0
  300. package/dist/types/formula-context.js +0 -0
  301. package/dist/types/hp.d.ts +4 -0
  302. package/dist/types/index.d.ts +10 -0
  303. package/dist/types/item-conditions.types.d.ts +63 -0
  304. package/dist/types/item-conditions.types.js +0 -0
  305. package/dist/types/optional-feature.types.d.ts +60 -0
  306. package/dist/types/optional-feature.types.js +0 -0
  307. package/dist/types/resource.d.ts +44 -0
  308. package/dist/types/resource.js +0 -0
  309. package/dist/types/selection-pool.d.ts +37 -0
  310. package/dist/types/selection-pool.js +0 -0
  311. package/dist/types/speed.d.ts +8 -0
  312. package/dist/weapon/weapon.codec.d.ts +12 -0
  313. package/dist/weapon/weapon.codec.js +8 -0
  314. package/dist/weapon/weapon.entity-type.d.ts +2 -0
  315. package/dist/weapon/weapon.parser.d.ts +3 -0
  316. package/dist/weapon/weapon.parser.js +7 -0
  317. package/dist/weapon/weapon.schema.d.ts +34 -0
  318. package/dist/weapon/weapon.schema.js +6 -0
  319. package/dist/weapon/weapon.types.d.ts +36 -0
  320. package/dist/weapon/weapon.types.js +0 -0
  321. package/package.json +32 -0
  322. package/src/data-srd/ATTRIBUTION.md +2 -0
@@ -0,0 +1,79 @@
1
+ import {
2
+ readTableColumn
3
+ } from "./chunk-5XUXXAQJ.js";
4
+ import {
5
+ bareEntitySlug,
6
+ wikilinkTailSlug
7
+ } from "./chunk-TJCNX6UZ.js";
8
+
9
+ // src/pc/pc.pools.ts
10
+ function levelPrereqMax(d) {
11
+ var _a;
12
+ return ((_a = d.prerequisites) != null ? _a : []).filter((p) => p.kind === "level").reduce((m, p) => Math.max(m, p.min), 0);
13
+ }
14
+ function resolvePool(rc, classIndex, pool, registry) {
15
+ var _a, _b, _c, _d, _e, _f, _g;
16
+ const entity = rc.entity;
17
+ const level = rc.level;
18
+ const ownerBare = bareEntitySlug(entity.slug);
19
+ const col = pool.count.column;
20
+ const count = (_a = readTableColumn(entity.table, level, [col])) != null ? _a : 0;
21
+ let anchorLevel = 1;
22
+ for (let l = 1; l <= 20; l++) {
23
+ const c = readTableColumn(entity.table, l, [col]);
24
+ if (c != null && c >= 1) {
25
+ anchorLevel = l;
26
+ break;
27
+ }
28
+ }
29
+ const ft = pool.source.where.feature_type;
30
+ const all = registry.search("", "optional-feature", Number.POSITIVE_INFINITY);
31
+ const byBare = /* @__PURE__ */ new Map();
32
+ const available = [];
33
+ for (const e of all) {
34
+ const d = e.data;
35
+ const entry = { slug: e.slug, entity: d };
36
+ byBare.set(bareEntitySlug(e.slug), entry);
37
+ if (d.feature_type !== ft) continue;
38
+ if (!((_b = d.available_to) != null ? _b : []).some((l) => wikilinkTailSlug(l) === ownerBare)) continue;
39
+ if (levelPrereqMax(d) > level) continue;
40
+ available.push(entry);
41
+ }
42
+ const grantDecls = [
43
+ ...(_d = (_c = rc.entity) == null ? void 0 : _c.pool_grants) != null ? _d : [],
44
+ ...(_f = (_e = rc.subclass) == null ? void 0 : _e.pool_grants) != null ? _f : []
45
+ ];
46
+ const grantsRaw = grantDecls.filter((g) => g.pool === pool.id).flatMap((g) => g.grants).filter((g) => g.at_level <= level).map((g) => byBare.get(wikilinkTailSlug(g.feature))).filter((e) => e != null);
47
+ const grantedBare = /* @__PURE__ */ new Set();
48
+ const grants = grantsRaw.filter((e) => {
49
+ const key = bareEntitySlug(e.slug);
50
+ if (grantedBare.has(key)) return false;
51
+ grantedBare.add(key);
52
+ return true;
53
+ });
54
+ const raw = (_g = rc.choices[anchorLevel]) == null ? void 0 : _g[pool.id];
55
+ const selectedSlugs = Array.isArray(raw) ? raw : typeof raw === "string" ? [raw] : [];
56
+ const selected = selectedSlugs.map((s) => byBare.get(bareEntitySlug(s))).filter((e) => e != null).filter((e) => !grantedBare.has(bareEntitySlug(e.slug)));
57
+ return { id: pool.id, label: pool.label, classIndex, count, anchorLevel, selected, available, grants };
58
+ }
59
+ function resolveAllPools(resolved, registry) {
60
+ const out = [];
61
+ resolved.classes.forEach((rc, classIndex) => {
62
+ var _a, _b, _c;
63
+ if (!rc.entity) return;
64
+ const decls = [...(_a = rc.entity.selection_pools) != null ? _a : [], ...(_c = (_b = rc.subclass) == null ? void 0 : _b.selection_pools) != null ? _c : []];
65
+ const seen = /* @__PURE__ */ new Set();
66
+ for (const pool of decls) {
67
+ if (seen.has(pool.id)) continue;
68
+ seen.add(pool.id);
69
+ out.push(resolvePool(rc, classIndex, pool, registry));
70
+ }
71
+ });
72
+ return out;
73
+ }
74
+
75
+ export {
76
+ levelPrereqMax,
77
+ resolvePool,
78
+ resolveAllPools
79
+ };
@@ -0,0 +1,158 @@
1
+ // src/monster/monster.parser.ts
2
+ import { parseYaml, toStringSafe } from "@archivist-gg/core";
3
+ var VALID_RECHARGE_TYPES = /* @__PURE__ */ new Set([
4
+ "recharge_on_roll",
5
+ "per_day",
6
+ "per_short_rest",
7
+ "per_long_rest"
8
+ ]);
9
+ function parseMonster(source) {
10
+ var _a, _b, _c, _d, _e, _f, _g;
11
+ const result = parseYaml(source, ["name"]);
12
+ if (!result.success) return result;
13
+ const raw = result.data;
14
+ const monster = {
15
+ name: toStringSafe(raw.name)
16
+ };
17
+ if (raw.size != null) monster.size = toStringSafe(raw.size);
18
+ if (raw.type != null) monster.type = toStringSafe(raw.type);
19
+ if (raw.subtype != null) monster.subtype = toStringSafe(raw.subtype);
20
+ if (raw.alignment != null) monster.alignment = toStringSafe(raw.alignment);
21
+ if (raw.cr != null) monster.cr = toStringSafe(raw.cr);
22
+ if (Array.isArray(raw.ac)) {
23
+ monster.ac = raw.ac.map((entry) => ({
24
+ ac: Number(entry.ac),
25
+ from: Array.isArray(entry.from) ? entry.from.map(String) : void 0
26
+ }));
27
+ }
28
+ if (raw.hp && typeof raw.hp === "object") {
29
+ const hp = raw.hp;
30
+ monster.hp = {
31
+ average: Number(hp.average),
32
+ formula: hp.formula != null ? toStringSafe(hp.formula) : void 0
33
+ };
34
+ }
35
+ if (raw.speed && typeof raw.speed === "object") {
36
+ const speed = raw.speed;
37
+ monster.speed = {};
38
+ for (const key of ["walk", "fly", "swim", "climb", "burrow"]) {
39
+ if (speed[key] != null) monster.speed[key] = Number(speed[key]);
40
+ }
41
+ }
42
+ if (raw.abilities && typeof raw.abilities === "object") {
43
+ const ab = raw.abilities;
44
+ monster.abilities = {
45
+ str: Number((_a = ab.str) != null ? _a : 10),
46
+ dex: Number((_b = ab.dex) != null ? _b : 10),
47
+ con: Number((_c = ab.con) != null ? _c : 10),
48
+ int: Number((_d = ab.int) != null ? _d : 10),
49
+ wis: Number((_e = ab.wis) != null ? _e : 10),
50
+ cha: Number((_f = ab.cha) != null ? _f : 10)
51
+ };
52
+ }
53
+ if (raw.saves && typeof raw.saves === "object") {
54
+ const saves = {};
55
+ for (const [key, val] of Object.entries(raw.saves)) {
56
+ saves[key] = Number(val);
57
+ }
58
+ monster.saves = saves;
59
+ }
60
+ if (raw.skills && typeof raw.skills === "object") {
61
+ const skills = {};
62
+ for (const [key, val] of Object.entries(raw.skills)) {
63
+ skills[key] = Number(val);
64
+ }
65
+ monster.skills = skills;
66
+ }
67
+ if (Array.isArray(raw.senses)) monster.senses = raw.senses.map(String);
68
+ if (raw.passive_perception != null) monster.passive_perception = Number(raw.passive_perception);
69
+ if (Array.isArray(raw.languages)) monster.languages = raw.languages.map(String);
70
+ if (Array.isArray(raw.damage_vulnerabilities)) monster.damage_vulnerabilities = raw.damage_vulnerabilities.map(String);
71
+ if (Array.isArray(raw.damage_resistances)) monster.damage_resistances = raw.damage_resistances.map(String);
72
+ if (Array.isArray(raw.damage_immunities)) monster.damage_immunities = raw.damage_immunities.map(String);
73
+ if (Array.isArray(raw.condition_immunities)) monster.condition_immunities = raw.condition_immunities.map(String);
74
+ const parseAttack = (raw2) => {
75
+ const a = {
76
+ name: toStringSafe(raw2.name),
77
+ type: toStringSafe(raw2.type)
78
+ };
79
+ if (typeof raw2.bonus === "number") a.bonus = raw2.bonus;
80
+ if (typeof raw2.damage === "string") a.damage = raw2.damage;
81
+ if (typeof raw2.damage_type === "string") a.damage_type = raw2.damage_type;
82
+ if (typeof raw2.action === "string") a.action = raw2.action;
83
+ if (Array.isArray(raw2.properties)) a.properties = raw2.properties.map(String);
84
+ if (raw2.range && typeof raw2.range === "object") {
85
+ const r = raw2.range;
86
+ a.range = {};
87
+ if (typeof r.normal === "number") a.range.normal = r.normal;
88
+ if (typeof r.long === "number") a.range.long = r.long;
89
+ if (typeof r.reach === "number") a.range.reach = r.reach;
90
+ }
91
+ if (raw2.extra_damage && typeof raw2.extra_damage === "object") {
92
+ const ed = raw2.extra_damage;
93
+ if (typeof ed.dice === "string" && typeof ed.type === "string") {
94
+ a.extra_damage = { dice: ed.dice, type: ed.type };
95
+ }
96
+ }
97
+ if (typeof raw2.condition === "string") a.condition = raw2.condition;
98
+ return a;
99
+ };
100
+ const parseFeatures = (arr) => {
101
+ if (!Array.isArray(arr)) return void 0;
102
+ return arr.map((f) => {
103
+ const feature = {
104
+ name: toStringSafe(f.name),
105
+ // Always set entries to an array so downstream renderers/editors
106
+ // (which call .join/.map directly) keep working.
107
+ entries: Array.isArray(f.entries) ? f.entries.map(String) : []
108
+ };
109
+ if (typeof f.description === "string") feature.description = f.description;
110
+ if (Array.isArray(f.attacks)) {
111
+ feature.attacks = f.attacks.map(parseAttack);
112
+ }
113
+ if (typeof f.action === "string") feature.action = f.action;
114
+ if (f.recharge && typeof f.recharge === "object") {
115
+ const r = f.recharge;
116
+ if (typeof r.type === "string" && VALID_RECHARGE_TYPES.has(r.type) && typeof r.param === "number") {
117
+ feature.recharge = {
118
+ type: r.type,
119
+ param: r.param
120
+ };
121
+ }
122
+ }
123
+ return feature;
124
+ });
125
+ };
126
+ monster.traits = parseFeatures(raw.traits);
127
+ monster.actions = parseFeatures(raw.actions);
128
+ monster.reactions = parseFeatures(raw.reactions);
129
+ const legendaryArrayRaw = Array.isArray(raw.legendary_actions) ? raw.legendary_actions : raw.legendary;
130
+ monster.legendary_actions = parseFeatures(legendaryArrayRaw);
131
+ if (raw.legendary_action_uses != null) {
132
+ monster.legendary_action_uses = Number(raw.legendary_action_uses);
133
+ } else if (raw.legendary_actions != null && !Array.isArray(raw.legendary_actions) && typeof raw.legendary_actions !== "object") {
134
+ monster.legendary_action_uses = Number(raw.legendary_actions);
135
+ }
136
+ if (raw.legendary_resistance != null) monster.legendary_resistance = Number(raw.legendary_resistance);
137
+ if (raw.columns != null) monster.columns = Number(raw.columns);
138
+ if (!monster.legendary_resistance && monster.traits) {
139
+ const lrIndex = monster.traits.findIndex(
140
+ (t) => {
141
+ var _a2;
142
+ return /^Legendary Resistance\s*\(/i.test((_a2 = t.name) != null ? _a2 : "");
143
+ }
144
+ );
145
+ if (lrIndex !== -1) {
146
+ const match = (_g = monster.traits[lrIndex].name) == null ? void 0 : _g.match(/\((\d+)\/Day\)/i);
147
+ if (match) {
148
+ monster.legendary_resistance = parseInt(match[1], 10);
149
+ monster.traits.splice(lrIndex, 1);
150
+ }
151
+ }
152
+ }
153
+ return { success: true, data: monster };
154
+ }
155
+
156
+ export {
157
+ parseMonster
158
+ };
@@ -0,0 +1,83 @@
1
+ import {
2
+ startingEquipmentEntrySchema
3
+ } from "./chunk-3DZ74AKK.js";
4
+ import {
5
+ choiceSchema
6
+ } from "./chunk-CDW7R2QT.js";
7
+
8
+ // src/background/background.schema.ts
9
+ import { z } from "zod";
10
+ var abilityEnum = z.enum(["str", "dex", "con", "int", "wis", "cha"]);
11
+ var editionEnum = z.enum(["2014", "2024"]);
12
+ var skillEnum = z.enum([
13
+ "acrobatics",
14
+ "animal-handling",
15
+ "arcana",
16
+ "athletics",
17
+ "deception",
18
+ "history",
19
+ "insight",
20
+ "intimidation",
21
+ "investigation",
22
+ "medicine",
23
+ "nature",
24
+ "perception",
25
+ "performance",
26
+ "persuasion",
27
+ "religion",
28
+ "sleight-of-hand",
29
+ "stealth",
30
+ "survival"
31
+ ]);
32
+ var wikilinkRegex = /^\[\[[^[\]]+\]\]$/;
33
+ var toolProfSchema = z.discriminatedUnion("kind", [
34
+ z.object({ kind: z.literal("fixed"), items: z.array(z.string()).nonempty() }),
35
+ z.object({
36
+ kind: z.literal("choice"),
37
+ count: z.number().int().positive(),
38
+ from: z.array(z.string()).nonempty()
39
+ })
40
+ ]);
41
+ var langProfSchema = z.discriminatedUnion("kind", [
42
+ z.object({ kind: z.literal("fixed"), languages: z.array(z.string()).nonempty() }),
43
+ z.object({
44
+ kind: z.literal("choice"),
45
+ count: z.number().int().positive(),
46
+ from: z.union([z.string(), z.array(z.string())])
47
+ })
48
+ ]);
49
+ var suggestedCharSchema = z.object({
50
+ personality_traits: z.record(z.string(), z.string()).optional(),
51
+ ideals: z.record(z.string(), z.object({
52
+ name: z.string().optional(),
53
+ desc: z.string(),
54
+ alignment: z.string().optional()
55
+ })).optional(),
56
+ bonds: z.record(z.string(), z.string()).optional(),
57
+ flaws: z.record(z.string(), z.string()).optional()
58
+ });
59
+ var backgroundEntitySchema = z.object({
60
+ slug: z.string().min(1),
61
+ name: z.string().min(1),
62
+ edition: editionEnum,
63
+ source: z.string().min(1),
64
+ description: z.string(),
65
+ skill_proficiencies: z.array(skillEnum),
66
+ tool_proficiencies: z.array(toolProfSchema),
67
+ language_proficiencies: z.array(langProfSchema),
68
+ equipment: z.array(startingEquipmentEntrySchema),
69
+ feature: z.object({
70
+ name: z.string().min(1),
71
+ description: z.string().min(1)
72
+ }),
73
+ ability_score_increases: z.object({
74
+ pool: z.array(abilityEnum).length(3)
75
+ }).nullable(),
76
+ origin_feat: z.string().regex(wikilinkRegex).nullable(),
77
+ suggested_characteristics: suggestedCharSchema.nullable(),
78
+ choices: z.array(choiceSchema).optional()
79
+ });
80
+
81
+ export {
82
+ backgroundEntitySchema
83
+ };
@@ -0,0 +1,39 @@
1
+ // src/weapon/weapon.schema.ts
2
+ import { z } from "zod";
3
+ var conditionalPropertySchema = z.object({
4
+ kind: z.literal("conditional"),
5
+ uid: z.string(),
6
+ note: z.string()
7
+ });
8
+ var propertySchema = z.union([z.string(), conditionalPropertySchema]);
9
+ var editionEnum = z.enum(["2014", "2024"]);
10
+ var weaponEntitySchema = z.object({
11
+ name: z.string().min(1),
12
+ slug: z.string().min(1),
13
+ category: z.string(),
14
+ damage: z.object({
15
+ dice: z.string(),
16
+ type: z.string(),
17
+ versatile_dice: z.string().optional()
18
+ }),
19
+ properties: z.array(propertySchema).default([]),
20
+ range: z.object({
21
+ normal: z.number().int().nonnegative(),
22
+ long: z.number().int().nonnegative()
23
+ }).optional(),
24
+ reload: z.number().int().nonnegative().optional(),
25
+ mastery: z.array(z.string()).optional(),
26
+ type_tags: z.array(z.string()).optional(),
27
+ ammo_type: z.string().optional(),
28
+ weight: z.union([z.number(), z.string()]).optional(),
29
+ cost: z.string().optional(),
30
+ source: z.string().optional(),
31
+ page: z.number().int().optional(),
32
+ edition: editionEnum,
33
+ entries: z.array(z.unknown()).optional(),
34
+ raw: z.record(z.string(), z.unknown()).optional()
35
+ }).loose();
36
+
37
+ export {
38
+ weaponEntitySchema
39
+ };
@@ -0,0 +1,46 @@
1
+ import {
2
+ poolGrantSchema,
3
+ selectionPoolSchema,
4
+ tabDeclSchema
5
+ } from "./chunk-4TIJKN6O.js";
6
+ import {
7
+ featureSchema
8
+ } from "./chunk-DABBCYTT.js";
9
+ import {
10
+ resourceSchema
11
+ } from "./chunk-PZOWBI3B.js";
12
+
13
+ // src/subclass/subclass.schema.ts
14
+ import { z } from "zod";
15
+ var editionEnum = z.enum(["2014", "2024"]);
16
+ var wikilinkRegex = /^\[\[[^[\]]+\]\]$/;
17
+ var casterTypeEnum = z.enum(["full", "half", "third", "pact"]);
18
+ var abilityEnum = z.enum(["str", "dex", "con", "int", "wis", "cha"]);
19
+ var spellcastingSchema = z.object({
20
+ caster_type: casterTypeEnum,
21
+ ability: abilityEnum,
22
+ preparation: z.enum(["known", "prepared"]),
23
+ spell_list: z.string().min(1)
24
+ });
25
+ var subclassTableRowSchema = z.object({
26
+ columns: z.record(z.string(), z.union([z.string(), z.number()])).optional()
27
+ });
28
+ var subclassEntitySchema = z.object({
29
+ slug: z.string().min(1),
30
+ name: z.string().min(1),
31
+ parent_class: z.string().regex(wikilinkRegex, "parent_class must be a wikilink like [[rogue]]"),
32
+ edition: editionEnum,
33
+ source: z.string().min(1),
34
+ description: z.string(),
35
+ spellcasting: spellcastingSchema.nullable().optional(),
36
+ table: z.record(z.string(), subclassTableRowSchema).optional(),
37
+ features_by_level: z.record(z.string(), z.array(featureSchema)),
38
+ resources: z.array(resourceSchema),
39
+ selection_pools: z.array(selectionPoolSchema).optional(),
40
+ pool_grants: z.array(poolGrantSchema).optional(),
41
+ tabs: z.array(tabDeclSchema).optional()
42
+ });
43
+
44
+ export {
45
+ subclassEntitySchema
46
+ };
@@ -0,0 +1,45 @@
1
+ import {
2
+ choiceSchema
3
+ } from "./chunk-CDW7R2QT.js";
4
+ import {
5
+ featureEffectSchema
6
+ } from "./chunk-NXR3BD2V.js";
7
+
8
+ // src/feat/feat.schema.ts
9
+ import { z } from "zod";
10
+ var abilityEnum = z.enum(["str", "dex", "con", "int", "wis", "cha"]);
11
+ var editionEnum = z.enum(["2014", "2024"]);
12
+ var categoryEnum = z.enum(["origin", "general", "fighting-style", "epic-boon"]);
13
+ var prerequisiteSchema = z.discriminatedUnion("kind", [
14
+ z.object({ kind: z.literal("ability"), ability: abilityEnum, min: z.number().int().positive() }),
15
+ z.object({ kind: z.literal("level"), min: z.number().int().positive() }),
16
+ z.object({ kind: z.literal("spellcaster") }),
17
+ z.object({
18
+ kind: z.literal("proficiency"),
19
+ proficiency_type: z.enum(["armor", "weapon", "tool", "skill", "saving-throw"]),
20
+ value: z.string().min(1)
21
+ }),
22
+ z.object({ kind: z.literal("race"), slug: z.string().min(1) }),
23
+ z.object({ kind: z.literal("class"), slug: z.string().min(1) })
24
+ ]);
25
+ var featEntitySchema = z.object({
26
+ slug: z.string().min(1),
27
+ name: z.string().min(1),
28
+ edition: editionEnum,
29
+ source: z.string().min(1),
30
+ category: categoryEnum,
31
+ description: z.string(),
32
+ prerequisites: z.array(prerequisiteSchema),
33
+ benefits: z.array(z.string()),
34
+ effects: z.array(featureEffectSchema),
35
+ grants_asi: z.object({
36
+ amount: z.number().int().positive(),
37
+ pool: z.array(abilityEnum).optional()
38
+ }).nullable(),
39
+ repeatable: z.boolean(),
40
+ choices: z.array(choiceSchema)
41
+ });
42
+
43
+ export {
44
+ featEntitySchema
45
+ };
@@ -0,0 +1,25 @@
1
+ // src/types/choice.ts
2
+ var ALL_SKILL_SLUGS = [
3
+ "acrobatics",
4
+ "animal-handling",
5
+ "arcana",
6
+ "athletics",
7
+ "deception",
8
+ "history",
9
+ "insight",
10
+ "intimidation",
11
+ "investigation",
12
+ "medicine",
13
+ "nature",
14
+ "perception",
15
+ "performance",
16
+ "persuasion",
17
+ "religion",
18
+ "sleight-of-hand",
19
+ "stealth",
20
+ "survival"
21
+ ];
22
+
23
+ export {
24
+ ALL_SKILL_SLUGS
25
+ };
@@ -0,0 +1,62 @@
1
+ import {
2
+ featureEffectSchema
3
+ } from "./chunk-NXR3BD2V.js";
4
+
5
+ // src/schemas/choice-schema.ts
6
+ import { z } from "zod";
7
+ var abilityEnum = z.enum(["str", "dex", "con", "int", "wis", "cha"]);
8
+ var entityFilterSchema = z.object({
9
+ feature_type: z.string().min(1).optional(),
10
+ category: z.string().min(1).optional(),
11
+ parent_class: z.literal("self").optional(),
12
+ available_to: z.literal("self").optional(),
13
+ weapon_category: z.enum(["simple", "martial"]).optional(),
14
+ armor_category: z.enum(["light", "medium", "heavy", "shield"]).optional()
15
+ }).strict();
16
+ var inlineOptionSchema = z.lazy(() => z.object({
17
+ value: z.string().min(1),
18
+ label: z.string().min(1),
19
+ description: z.string().optional(),
20
+ effects: z.array(featureEffectSchema).optional(),
21
+ choices: z.array(choiceSchema).optional()
22
+ }).strict());
23
+ var choiceSchema = z.lazy(() => z.discriminatedUnion("kind", [
24
+ z.object({
25
+ kind: z.literal("select-inline"),
26
+ id: z.string().min(1),
27
+ label: z.string().optional(),
28
+ count: z.number().int().positive().optional(),
29
+ options: z.array(inlineOptionSchema).nonempty()
30
+ }).strict(),
31
+ z.object({
32
+ kind: z.literal("select-entity"),
33
+ id: z.string().min(1),
34
+ label: z.string().optional(),
35
+ count: z.number().int().positive().optional(),
36
+ entity_type: z.string().min(1),
37
+ from: z.array(z.string().min(1)).nonempty().optional(),
38
+ where: entityFilterSchema.optional()
39
+ }).strict(),
40
+ z.object({
41
+ kind: z.literal("select-proficiency"),
42
+ id: z.string().min(1),
43
+ label: z.string().optional(),
44
+ count: z.number().int().positive(),
45
+ domain: z.enum(["skill", "tool", "language", "save"]),
46
+ from: z.array(z.string().min(1)).nonempty().optional(),
47
+ from_proficient: z.boolean().optional(),
48
+ expertise: z.boolean().optional()
49
+ }).strict(),
50
+ z.object({
51
+ kind: z.literal("ability-points"),
52
+ id: z.string().min(1),
53
+ label: z.string().optional(),
54
+ points: z.number().int().positive(),
55
+ max_per: z.number().int().positive(),
56
+ pool: z.array(abilityEnum).nonempty().optional()
57
+ }).strict()
58
+ ]));
59
+
60
+ export {
61
+ choiceSchema
62
+ };
@@ -0,0 +1,68 @@
1
+ import {
2
+ durationSchema
3
+ } from "./chunk-WYGD2UGN.js";
4
+ import {
5
+ resourceConsumptionSchema,
6
+ resourceSchema
7
+ } from "./chunk-PZOWBI3B.js";
8
+ import {
9
+ choiceSchema
10
+ } from "./chunk-CDW7R2QT.js";
11
+ import {
12
+ featureEffectSchema
13
+ } from "./chunk-NXR3BD2V.js";
14
+
15
+ // src/schemas/feature-schema.ts
16
+ import { z as z2 } from "zod";
17
+
18
+ // src/schemas/attack-schema.ts
19
+ import { z } from "zod";
20
+ var abilityEnum = z.enum(["str", "dex", "con", "int", "wis", "cha"]);
21
+ var attackSchema = z.object({
22
+ name: z.string().min(1),
23
+ type: z.enum(["melee", "ranged", "spell"]),
24
+ ability: z.union([abilityEnum, z.array(abilityEnum).nonempty()]).optional(),
25
+ damage: z.string().optional(),
26
+ damage_type: z.string().optional(),
27
+ action: z.enum(["action", "bonus-action", "reaction"]).optional(),
28
+ properties: z.array(z.string()).optional(),
29
+ range: z.object({
30
+ normal: z.number().int().nonnegative().optional(),
31
+ long: z.number().int().nonnegative().optional(),
32
+ reach: z.number().int().nonnegative().optional()
33
+ }).optional(),
34
+ condition: z.string().optional()
35
+ });
36
+
37
+ // src/schemas/feature-schema.ts
38
+ var featureSchema = z2.lazy(
39
+ () => z2.object({
40
+ id: z2.string().min(1).optional(),
41
+ name: z2.string().min(1),
42
+ description: z2.string().optional(),
43
+ entries: z2.array(z2.string()).optional(),
44
+ choices: z2.array(choiceSchema).optional(),
45
+ grants_resource: z2.string().optional(),
46
+ consumes: resourceConsumptionSchema.optional(),
47
+ attacks: z2.array(attackSchema).optional(),
48
+ action: z2.enum(["action", "bonus-action", "reaction", "free", "special"]).optional(),
49
+ trigger: z2.string().optional(),
50
+ dc_formula: z2.string().optional(),
51
+ effects: z2.array(featureEffectSchema).optional(),
52
+ sub_features: z2.array(featureSchema).optional(),
53
+ resources: z2.array(resourceSchema).optional(),
54
+ // Phase 3 activatable buffs: a feature flagged `activatable` folds its effects
55
+ // only while its id is present in state.active_buffs. `passive` renders a tag;
56
+ // `duration` is a static label (no live countdown this phase).
57
+ activatable: z2.boolean().optional(),
58
+ passive: z2.boolean().optional(),
59
+ duration: durationSchema.optional()
60
+ }).refine(
61
+ (f) => f.description !== void 0 || f.entries !== void 0 && f.entries.length > 0,
62
+ { message: "feature requires either description or non-empty entries" }
63
+ )
64
+ );
65
+
66
+ export {
67
+ featureSchema
68
+ };
@@ -0,0 +1,46 @@
1
+ import {
2
+ slugify
3
+ } from "./chunk-3TRGRSCH.js";
4
+
5
+ // src/entities/base-item-resolver.ts
6
+ function unwrapWikilink(input) {
7
+ const m = /^\[\[([^\]]+)\]\]$/.exec(input.trim());
8
+ if (!m) return null;
9
+ const inner = m[1];
10
+ const pipe = inner.indexOf("|");
11
+ return pipe === -1 ? inner : inner.slice(0, pipe);
12
+ }
13
+ function vaultPathToSlug(target) {
14
+ const segments = target.split("/").map((s) => s.trim()).filter((s) => s.length > 0);
15
+ if (segments.length === 0) return "";
16
+ if (segments.length === 1) {
17
+ return slugify(segments[0]);
18
+ }
19
+ const compendiumName = segments[0];
20
+ const basename = segments[segments.length - 1];
21
+ const prefix = slugify(compendiumName);
22
+ const nameSlug = slugify(basename);
23
+ return prefix && nameSlug ? `${prefix}_${nameSlug}` : nameSlug;
24
+ }
25
+ function resolveBaseItem(baseItem, registry) {
26
+ var _a, _b;
27
+ if (typeof baseItem !== "string" || baseItem.length === 0) return null;
28
+ const target = (_a = unwrapWikilink(baseItem)) != null ? _a : baseItem.trim();
29
+ if (target.length === 0) return null;
30
+ if (!target.includes("/")) {
31
+ const direct = registry.getBySlug(target);
32
+ if (direct) return direct;
33
+ }
34
+ const slug = vaultPathToSlug(target);
35
+ if (!slug) return null;
36
+ return (_b = registry.getBySlug(slug)) != null ? _b : null;
37
+ }
38
+ function resolveBaseItemOfType(baseItem, entityType, registry) {
39
+ const found = resolveBaseItem(baseItem, registry);
40
+ return found && found.entityType === entityType ? found : null;
41
+ }
42
+
43
+ export {
44
+ resolveBaseItem,
45
+ resolveBaseItemOfType
46
+ };