@pubid/pubid 0.1.71 → 0.1.72

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 (438) hide show
  1. package/artifact/corpus.json.gz +0 -0
  2. package/dist/flavors/ansi/generated/substrate.d.ts +78 -0
  3. package/dist/flavors/ansi/generated/substrate.js +105 -0
  4. package/dist/flavors/ansi/implementation.d.ts +5 -0
  5. package/dist/flavors/ansi/implementation.js +125 -0
  6. package/dist/flavors/ansi/index.js +14 -117
  7. package/dist/flavors/api/generated/substrate.d.ts +78 -0
  8. package/dist/flavors/api/generated/substrate.js +105 -0
  9. package/dist/flavors/api/grammar.worker.d.ts +6 -0
  10. package/dist/flavors/api/{grammar.js → grammar.worker.js} +60 -16
  11. package/dist/flavors/api/implementation.d.ts +11 -0
  12. package/dist/flavors/api/implementation.js +106 -0
  13. package/dist/flavors/api/index.d.ts +1 -3
  14. package/dist/flavors/api/index.js +14 -98
  15. package/dist/flavors/arxiv/generated/substrate.d.ts +75 -0
  16. package/dist/flavors/arxiv/generated/substrate.js +102 -0
  17. package/dist/flavors/arxiv/index.js +17 -11
  18. package/dist/flavors/ashrae/generated/substrate.d.ts +78 -0
  19. package/dist/flavors/ashrae/generated/substrate.js +105 -0
  20. package/dist/flavors/ashrae/grammar.worker.d.ts +6 -0
  21. package/dist/flavors/ashrae/{grammar.js → grammar.worker.js} +76 -39
  22. package/dist/flavors/ashrae/implementation.d.ts +7 -0
  23. package/dist/flavors/ashrae/implementation.js +316 -0
  24. package/dist/flavors/ashrae/index.d.ts +1 -3
  25. package/dist/flavors/ashrae/index.js +14 -304
  26. package/dist/flavors/asme/generated/substrate.d.ts +78 -0
  27. package/dist/flavors/asme/generated/substrate.js +105 -0
  28. package/dist/flavors/asme/grammar.worker.d.ts +6 -0
  29. package/dist/flavors/asme/{grammar.js → grammar.worker.js} +41 -2
  30. package/dist/flavors/asme/implementation.d.ts +7 -0
  31. package/dist/flavors/asme/implementation.js +152 -0
  32. package/dist/flavors/asme/index.d.ts +1 -3
  33. package/dist/flavors/asme/index.js +14 -136
  34. package/dist/flavors/astm/generated/substrate.d.ts +78 -0
  35. package/dist/flavors/astm/generated/substrate.js +105 -0
  36. package/dist/flavors/astm/grammar.worker.d.ts +6 -0
  37. package/dist/flavors/astm/{grammar.js → grammar.worker.js} +39 -5
  38. package/dist/flavors/astm/implementation.d.ts +6 -0
  39. package/dist/flavors/astm/implementation.js +135 -0
  40. package/dist/flavors/astm/index.js +14 -125
  41. package/dist/flavors/bipm/generated/substrate.d.ts +78 -0
  42. package/dist/flavors/bipm/generated/substrate.js +105 -0
  43. package/dist/flavors/bipm/grammar.worker.d.ts +6 -0
  44. package/dist/flavors/bipm/grammar.worker.js +180 -0
  45. package/dist/flavors/bipm/implementation.d.ts +6 -0
  46. package/dist/flavors/bipm/implementation.js +244 -0
  47. package/dist/flavors/bipm/index.d.ts +1 -28
  48. package/dist/flavors/bipm/index.js +16 -650
  49. package/dist/flavors/bipm/model.d.ts +80 -0
  50. package/dist/flavors/bipm/model.js +271 -0
  51. package/dist/flavors/bipm/worker.d.ts +2 -0
  52. package/dist/flavors/bipm/worker.js +19 -0
  53. package/dist/flavors/bsi/generated/substrate.d.ts +78 -0
  54. package/dist/flavors/bsi/generated/substrate.js +105 -0
  55. package/dist/flavors/bsi/grammar.worker.d.ts +6 -0
  56. package/dist/flavors/bsi/{grammar.js → grammar.worker.js} +36 -7
  57. package/dist/flavors/bsi/implementation.d.ts +12 -0
  58. package/dist/flavors/bsi/implementation.js +967 -0
  59. package/dist/flavors/bsi/index.d.ts +1 -3
  60. package/dist/flavors/bsi/index.js +15 -940
  61. package/dist/flavors/bsi/model.js +16 -0
  62. package/dist/flavors/bsi/worker.js +11 -4
  63. package/dist/flavors/bsi_pfs/index.d.ts +25 -0
  64. package/dist/flavors/bsi_pfs/index.js +73 -10
  65. package/dist/flavors/calconnect/generated/substrate.d.ts +75 -0
  66. package/dist/flavors/calconnect/generated/substrate.js +102 -0
  67. package/dist/flavors/calconnect/grammar.worker.d.ts +6 -0
  68. package/dist/flavors/calconnect/grammar.worker.js +60 -0
  69. package/dist/flavors/calconnect/implementation.d.ts +6 -0
  70. package/dist/flavors/calconnect/implementation.js +69 -0
  71. package/dist/flavors/calconnect/index.d.ts +1 -19
  72. package/dist/flavors/calconnect/index.js +15 -111
  73. package/dist/flavors/calconnect/model.d.ts +26 -0
  74. package/dist/flavors/calconnect/model.js +52 -0
  75. package/dist/flavors/ccsds/generated/substrate.d.ts +75 -0
  76. package/dist/flavors/ccsds/generated/substrate.js +102 -0
  77. package/dist/flavors/ccsds/implementation.d.ts +5 -0
  78. package/dist/flavors/ccsds/implementation.js +67 -0
  79. package/dist/flavors/ccsds/index.js +13 -57
  80. package/dist/flavors/cen_cenelec/generated/substrate.d.ts +78 -0
  81. package/dist/flavors/cen_cenelec/generated/substrate.js +105 -0
  82. package/dist/flavors/cen_cenelec/grammar.worker.d.ts +6 -0
  83. package/dist/flavors/cen_cenelec/{grammar.js → grammar.worker.js} +41 -13
  84. package/dist/flavors/cen_cenelec/implementation.d.ts +15 -0
  85. package/dist/flavors/cen_cenelec/implementation.js +322 -0
  86. package/dist/flavors/cen_cenelec/index.d.ts +2 -4
  87. package/dist/flavors/cen_cenelec/index.js +16 -286
  88. package/dist/flavors/cen_cenelec/model.js +16 -1
  89. package/dist/flavors/cen_cenelec/worker.js +10 -4
  90. package/dist/flavors/cen_pfs/index.d.ts +5 -0
  91. package/dist/flavors/cen_pfs/index.js +28 -2
  92. package/dist/flavors/cie/generated/substrate.d.ts +78 -0
  93. package/dist/flavors/cie/generated/substrate.js +105 -0
  94. package/dist/flavors/cie/grammar.worker.d.ts +6 -0
  95. package/dist/flavors/cie/{grammar.js → grammar.worker.js} +71 -18
  96. package/dist/flavors/cie/implementation.d.ts +9 -0
  97. package/dist/flavors/cie/implementation.js +331 -0
  98. package/dist/flavors/cie/index.js +14 -309
  99. package/dist/flavors/csa/generated/substrate.d.ts +78 -0
  100. package/dist/flavors/csa/generated/substrate.js +105 -0
  101. package/dist/flavors/csa/grammar.worker.d.ts +12 -0
  102. package/dist/flavors/csa/{grammar.js → grammar.worker.js} +143 -27
  103. package/dist/flavors/csa/implementation.d.ts +9 -0
  104. package/dist/flavors/csa/implementation.js +661 -0
  105. package/dist/flavors/csa/index.js +14 -631
  106. package/dist/flavors/csa/worker.js +10 -4
  107. package/dist/flavors/easc/generated/substrate.d.ts +75 -0
  108. package/dist/flavors/easc/generated/substrate.js +102 -0
  109. package/dist/flavors/easc/grammar.worker.d.ts +6 -0
  110. package/dist/flavors/easc/grammar.worker.js +66 -0
  111. package/dist/flavors/easc/implementation.d.ts +6 -0
  112. package/dist/flavors/easc/implementation.js +58 -0
  113. package/dist/flavors/easc/index.d.ts +1 -2
  114. package/dist/flavors/easc/index.js +15 -105
  115. package/dist/flavors/easc/model.d.ts +10 -0
  116. package/dist/flavors/easc/model.js +43 -0
  117. package/dist/flavors/ecma/generated/substrate.d.ts +75 -0
  118. package/dist/flavors/ecma/generated/substrate.js +102 -0
  119. package/dist/flavors/ecma/grammar.worker.d.ts +6 -0
  120. package/dist/flavors/ecma/grammar.worker.js +63 -0
  121. package/dist/flavors/ecma/implementation.d.ts +6 -0
  122. package/dist/flavors/ecma/implementation.js +95 -0
  123. package/dist/flavors/ecma/index.d.ts +1 -2
  124. package/dist/flavors/ecma/index.js +15 -152
  125. package/dist/flavors/ecma/model.d.ts +10 -0
  126. package/dist/flavors/ecma/model.js +61 -0
  127. package/dist/flavors/etsi/generated/substrate.d.ts +75 -0
  128. package/dist/flavors/etsi/generated/substrate.js +102 -0
  129. package/dist/flavors/etsi/grammar.worker.d.ts +6 -0
  130. package/dist/flavors/etsi/grammar.worker.js +86 -0
  131. package/dist/flavors/etsi/implementation.d.ts +6 -0
  132. package/dist/flavors/etsi/implementation.js +110 -0
  133. package/dist/flavors/etsi/index.d.ts +2 -12
  134. package/dist/flavors/etsi/index.js +16 -305
  135. package/dist/flavors/etsi/model.d.ts +37 -0
  136. package/dist/flavors/etsi/model.js +169 -0
  137. package/dist/flavors/eu/generated/substrate.d.ts +75 -0
  138. package/dist/flavors/eu/generated/substrate.js +102 -0
  139. package/dist/flavors/eu/implementation.d.ts +7 -0
  140. package/dist/flavors/eu/implementation.js +150 -0
  141. package/dist/flavors/eu/index.js +14 -141
  142. package/dist/flavors/evs/generated/substrate.d.ts +78 -0
  143. package/dist/flavors/evs/generated/substrate.js +105 -0
  144. package/dist/flavors/evs/grammar.worker.d.ts +6 -0
  145. package/dist/flavors/evs/grammar.worker.js +98 -0
  146. package/dist/flavors/evs/implementation.d.ts +7 -0
  147. package/dist/flavors/evs/implementation.js +114 -0
  148. package/dist/flavors/evs/index.d.ts +1 -1
  149. package/dist/flavors/evs/index.js +14 -89
  150. package/dist/flavors/evs/worker.js +10 -4
  151. package/dist/flavors/gb/generated/substrate.d.ts +75 -0
  152. package/dist/flavors/gb/generated/substrate.js +102 -0
  153. package/dist/flavors/gb/grammar.worker.d.ts +6 -0
  154. package/dist/flavors/gb/grammar.worker.js +73 -0
  155. package/dist/flavors/gb/implementation.d.ts +6 -0
  156. package/dist/flavors/gb/implementation.js +87 -0
  157. package/dist/flavors/gb/index.d.ts +1 -29
  158. package/dist/flavors/gb/index.js +15 -157
  159. package/dist/flavors/gb/model.d.ts +36 -0
  160. package/dist/flavors/gb/model.js +79 -0
  161. package/dist/flavors/gost/generated/substrate.d.ts +78 -0
  162. package/dist/flavors/gost/generated/substrate.js +105 -0
  163. package/dist/flavors/gost/grammar.worker.d.ts +6 -0
  164. package/dist/flavors/gost/grammar.worker.js +82 -0
  165. package/dist/flavors/gost/implementation.d.ts +7 -0
  166. package/dist/flavors/gost/implementation.js +177 -0
  167. package/dist/flavors/gost/index.js +14 -162
  168. package/dist/flavors/gost/worker.js +12 -5
  169. package/dist/flavors/iala/generated/substrate.d.ts +78 -0
  170. package/dist/flavors/iala/generated/substrate.js +105 -0
  171. package/dist/flavors/iala/grammar.worker.d.ts +6 -0
  172. package/dist/flavors/iala/grammar.worker.js +127 -0
  173. package/dist/flavors/iala/implementation.d.ts +6 -0
  174. package/dist/flavors/iala/implementation.js +250 -0
  175. package/dist/flavors/iala/index.d.ts +1 -56
  176. package/dist/flavors/iala/index.js +17 -484
  177. package/dist/flavors/iala/model.d.ts +93 -0
  178. package/dist/flavors/iala/model.js +194 -0
  179. package/dist/flavors/iana/generated/substrate.d.ts +75 -0
  180. package/dist/flavors/iana/generated/substrate.js +102 -0
  181. package/dist/flavors/iana/grammar.worker.d.ts +6 -0
  182. package/dist/flavors/iana/grammar.worker.js +51 -0
  183. package/dist/flavors/iana/implementation.d.ts +6 -0
  184. package/dist/flavors/iana/implementation.js +47 -0
  185. package/dist/flavors/iana/index.d.ts +1 -17
  186. package/dist/flavors/iana/index.js +15 -69
  187. package/dist/flavors/iana/model.d.ts +22 -0
  188. package/dist/flavors/iana/model.js +33 -0
  189. package/dist/flavors/idf/generated/substrate.d.ts +78 -0
  190. package/dist/flavors/idf/generated/substrate.js +105 -0
  191. package/dist/flavors/idf/grammar.worker.d.ts +6 -0
  192. package/dist/flavors/idf/{grammar.js → grammar.worker.js} +58 -2
  193. package/dist/flavors/idf/implementation.d.ts +6 -0
  194. package/dist/flavors/idf/implementation.js +129 -0
  195. package/dist/flavors/idf/index.js +14 -98
  196. package/dist/flavors/iec/generated/substrate.d.ts +78 -0
  197. package/dist/flavors/iec/generated/substrate.js +105 -0
  198. package/dist/flavors/iec/grammar.worker.d.ts +6 -0
  199. package/dist/flavors/iec/grammar.worker.js +231 -0
  200. package/dist/flavors/iec/implementation.d.ts +15 -0
  201. package/dist/flavors/iec/implementation.js +956 -0
  202. package/dist/flavors/iec/index.d.ts +1 -2
  203. package/dist/flavors/iec/index.js +16 -869
  204. package/dist/flavors/iec/model.js +13 -1
  205. package/dist/flavors/iec/worker.d.ts +2 -0
  206. package/dist/flavors/iec/worker.js +19 -0
  207. package/dist/flavors/ieee/generated/substrate.d.ts +78 -0
  208. package/dist/flavors/ieee/generated/substrate.js +105 -0
  209. package/dist/flavors/ieee/implementation.d.ts +4 -0
  210. package/dist/flavors/ieee/implementation.js +48 -10
  211. package/dist/flavors/ieee/index.d.ts +3 -2
  212. package/dist/flavors/ieee/index.js +30 -12
  213. package/dist/flavors/ieee/model.js +3 -0
  214. package/dist/flavors/ieee/preprocessor.js +10 -10
  215. package/dist/flavors/ieee/worker.js +33 -11
  216. package/dist/flavors/ietf/generated/substrate.d.ts +75 -0
  217. package/dist/flavors/ietf/generated/substrate.js +102 -0
  218. package/dist/flavors/ietf/grammar.worker.d.ts +6 -0
  219. package/dist/flavors/ietf/grammar.worker.js +63 -0
  220. package/dist/flavors/ietf/implementation.d.ts +6 -0
  221. package/dist/flavors/ietf/implementation.js +60 -0
  222. package/dist/flavors/ietf/index.d.ts +1 -28
  223. package/dist/flavors/ietf/index.js +15 -149
  224. package/dist/flavors/ietf/model.d.ts +47 -0
  225. package/dist/flavors/ietf/model.js +92 -0
  226. package/dist/flavors/iho/generated/substrate.d.ts +78 -0
  227. package/dist/flavors/iho/generated/substrate.js +105 -0
  228. package/dist/flavors/iho/grammar.worker.d.ts +6 -0
  229. package/dist/flavors/iho/grammar.worker.js +150 -0
  230. package/dist/flavors/iho/implementation.d.ts +6 -0
  231. package/dist/flavors/iho/implementation.js +221 -0
  232. package/dist/flavors/iho/index.d.ts +1 -2
  233. package/dist/flavors/iho/index.js +15 -619
  234. package/dist/flavors/iho/model.d.ts +11 -0
  235. package/dist/flavors/iho/model.js +315 -0
  236. package/dist/flavors/index.js +3 -0
  237. package/dist/flavors/iso/generated/substrate.d.ts +93 -0
  238. package/dist/flavors/iso/generated/substrate.js +133 -0
  239. package/dist/flavors/iso/grammar.worker.d.ts +7 -0
  240. package/dist/flavors/iso/grammar.worker.js +406 -0
  241. package/dist/flavors/iso/implementation.d.ts +4 -0
  242. package/dist/flavors/iso/implementation.js +880 -0
  243. package/dist/flavors/iso/index.js +16 -706
  244. package/dist/flavors/iso/model.js +21 -2
  245. package/dist/flavors/iso/worker.d.ts +2 -0
  246. package/dist/flavors/iso/worker.js +19 -0
  247. package/dist/flavors/itu/generated/substrate.d.ts +78 -0
  248. package/dist/flavors/itu/generated/substrate.js +105 -0
  249. package/dist/flavors/itu/grammar.worker.d.ts +6 -0
  250. package/dist/flavors/itu/grammar.worker.js +306 -0
  251. package/dist/flavors/itu/implementation.d.ts +10 -0
  252. package/dist/flavors/itu/implementation.js +285 -0
  253. package/dist/flavors/itu/index.js +15 -246
  254. package/dist/flavors/itu/worker.d.ts +2 -0
  255. package/dist/flavors/itu/worker.js +19 -0
  256. package/dist/flavors/jcgm/generated/substrate.d.ts +78 -0
  257. package/dist/flavors/jcgm/generated/substrate.js +105 -0
  258. package/dist/flavors/jcgm/grammar.worker.d.ts +6 -0
  259. package/dist/flavors/jcgm/grammar.worker.js +98 -0
  260. package/dist/flavors/jcgm/implementation.d.ts +6 -0
  261. package/dist/flavors/jcgm/implementation.js +187 -0
  262. package/dist/flavors/jcgm/index.d.ts +1 -5
  263. package/dist/flavors/jcgm/index.js +16 -364
  264. package/dist/flavors/jcgm/model.d.ts +43 -0
  265. package/dist/flavors/jcgm/model.js +168 -0
  266. package/dist/flavors/jis/generated/substrate.d.ts +78 -0
  267. package/dist/flavors/jis/generated/substrate.js +105 -0
  268. package/dist/flavors/jis/grammar.worker.d.ts +6 -0
  269. package/dist/flavors/jis/grammar.worker.js +132 -0
  270. package/dist/flavors/jis/implementation.d.ts +6 -0
  271. package/dist/flavors/jis/implementation.js +129 -0
  272. package/dist/flavors/jis/index.d.ts +0 -2
  273. package/dist/flavors/jis/index.js +15 -390
  274. package/dist/flavors/jis/model.d.ts +30 -0
  275. package/dist/flavors/jis/model.js +205 -0
  276. package/dist/flavors/jis/worker.d.ts +2 -0
  277. package/dist/flavors/jis/worker.js +19 -0
  278. package/dist/flavors/nist/generated/substrate.d.ts +78 -0
  279. package/dist/flavors/nist/generated/substrate.js +105 -0
  280. package/dist/flavors/nist/index.js +18 -11
  281. package/dist/flavors/nist/worker.js +8 -4
  282. package/dist/flavors/oasis/generated/substrate.d.ts +75 -0
  283. package/dist/flavors/oasis/generated/substrate.js +102 -0
  284. package/dist/flavors/oasis/grammar.worker.d.ts +6 -0
  285. package/dist/flavors/oasis/grammar.worker.js +50 -0
  286. package/dist/flavors/oasis/implementation.d.ts +6 -0
  287. package/dist/flavors/oasis/implementation.js +80 -0
  288. package/dist/flavors/oasis/index.d.ts +1 -21
  289. package/dist/flavors/oasis/index.js +16 -108
  290. package/dist/flavors/oasis/model.d.ts +27 -0
  291. package/dist/flavors/oasis/model.js +34 -0
  292. package/dist/flavors/ogc/generated/substrate.d.ts +75 -0
  293. package/dist/flavors/ogc/generated/substrate.js +102 -0
  294. package/dist/flavors/ogc/grammar.worker.d.ts +6 -0
  295. package/dist/flavors/ogc/grammar.worker.js +55 -0
  296. package/dist/flavors/ogc/implementation.d.ts +6 -0
  297. package/dist/flavors/ogc/implementation.js +49 -0
  298. package/dist/flavors/ogc/index.d.ts +1 -18
  299. package/dist/flavors/ogc/index.js +15 -73
  300. package/dist/flavors/ogc/model.d.ts +23 -0
  301. package/dist/flavors/ogc/model.js +32 -0
  302. package/dist/flavors/oiml/generated/substrate.d.ts +78 -0
  303. package/dist/flavors/oiml/generated/substrate.js +105 -0
  304. package/dist/flavors/oiml/grammar.worker.d.ts +6 -0
  305. package/dist/flavors/oiml/grammar.worker.js +239 -0
  306. package/dist/flavors/oiml/implementation.d.ts +2 -1
  307. package/dist/flavors/oiml/implementation.js +16 -7
  308. package/dist/flavors/oiml/index.js +15 -6
  309. package/dist/flavors/oiml/model.js +19 -19
  310. package/dist/flavors/oiml/worker.js +14 -6
  311. package/dist/flavors/omg/generated/substrate.d.ts +78 -0
  312. package/dist/flavors/omg/generated/substrate.js +105 -0
  313. package/dist/flavors/omg/grammar.worker.d.ts +6 -0
  314. package/dist/flavors/omg/grammar.worker.js +64 -0
  315. package/dist/flavors/omg/implementation.d.ts +7 -0
  316. package/dist/flavors/omg/implementation.js +33 -0
  317. package/dist/flavors/omg/index.d.ts +1 -12
  318. package/dist/flavors/omg/index.js +15 -71
  319. package/dist/flavors/omg/model.d.ts +16 -0
  320. package/dist/flavors/omg/model.js +26 -0
  321. package/dist/flavors/plateau/generated/substrate.d.ts +78 -0
  322. package/dist/flavors/plateau/generated/substrate.js +105 -0
  323. package/dist/flavors/plateau/grammar.worker.d.ts +6 -0
  324. package/dist/flavors/plateau/grammar.worker.js +78 -0
  325. package/dist/flavors/plateau/implementation.d.ts +6 -0
  326. package/dist/flavors/plateau/implementation.js +74 -0
  327. package/dist/flavors/plateau/index.d.ts +1 -2
  328. package/dist/flavors/plateau/index.js +18 -114
  329. package/dist/flavors/plateau/model.d.ts +11 -0
  330. package/dist/flavors/plateau/model.js +51 -0
  331. package/dist/flavors/register-types.d.ts +20 -19
  332. package/dist/flavors/register-types.js +44 -19
  333. package/dist/flavors/sae/generated/substrate.d.ts +75 -0
  334. package/dist/flavors/sae/generated/substrate.js +102 -0
  335. package/dist/flavors/sae/grammar.worker.d.ts +6 -0
  336. package/dist/flavors/sae/grammar.worker.js +84 -0
  337. package/dist/flavors/sae/implementation.d.ts +11 -0
  338. package/dist/flavors/sae/implementation.js +109 -0
  339. package/dist/flavors/sae/index.d.ts +3 -0
  340. package/dist/flavors/sae/index.js +19 -0
  341. package/dist/flavors/sae/model.d.ts +86 -0
  342. package/dist/flavors/sae/model.js +185 -0
  343. package/dist/flavors/tgpp/generated/substrate.d.ts +78 -0
  344. package/dist/flavors/tgpp/generated/substrate.js +105 -0
  345. package/dist/flavors/tgpp/grammar.worker.d.ts +6 -0
  346. package/dist/flavors/tgpp/grammar.worker.js +69 -0
  347. package/dist/flavors/tgpp/implementation.d.ts +8 -0
  348. package/dist/flavors/tgpp/implementation.js +56 -0
  349. package/dist/flavors/tgpp/index.d.ts +1 -2
  350. package/dist/flavors/tgpp/index.js +15 -120
  351. package/dist/flavors/tgpp/model.d.ts +13 -0
  352. package/dist/flavors/tgpp/model.js +52 -0
  353. package/dist/flavors/w3c/generated/substrate.d.ts +78 -0
  354. package/dist/flavors/w3c/generated/substrate.js +105 -0
  355. package/dist/flavors/w3c/grammar.worker.d.ts +6 -0
  356. package/dist/flavors/w3c/grammar.worker.js +55 -0
  357. package/dist/flavors/w3c/implementation.d.ts +7 -0
  358. package/dist/flavors/w3c/implementation.js +49 -0
  359. package/dist/flavors/w3c/index.d.ts +1 -12
  360. package/dist/flavors/w3c/index.js +15 -146
  361. package/dist/flavors/w3c/model.d.ts +15 -0
  362. package/dist/flavors/w3c/model.js +103 -0
  363. package/dist/flavors/wmo/generated/substrate.d.ts +78 -0
  364. package/dist/flavors/wmo/generated/substrate.js +105 -0
  365. package/dist/flavors/wmo/implementation.d.ts +5 -0
  366. package/dist/flavors/wmo/implementation.js +79 -0
  367. package/dist/flavors/wmo/index.js +14 -68
  368. package/dist/flavors/worker-registry.js +246 -68
  369. package/dist/flavors/xsf/generated/substrate.d.ts +75 -0
  370. package/dist/flavors/xsf/generated/substrate.js +102 -0
  371. package/dist/flavors/xsf/grammar.worker.d.ts +6 -0
  372. package/dist/flavors/xsf/grammar.worker.js +53 -0
  373. package/dist/flavors/xsf/implementation.d.ts +6 -0
  374. package/dist/flavors/xsf/implementation.js +34 -0
  375. package/dist/flavors/xsf/index.d.ts +1 -16
  376. package/dist/flavors/xsf/index.js +16 -63
  377. package/dist/flavors/xsf/model.d.ts +20 -0
  378. package/dist/flavors/xsf/model.js +26 -0
  379. package/dist/model/identifier.d.ts +13 -1
  380. package/dist/model/identifier.js +71 -9
  381. package/dist/model/relation.d.ts +36 -0
  382. package/dist/model/relation.js +93 -0
  383. package/dist/parg/artifacts/ieee.d.ts +1 -1
  384. package/dist/parg/artifacts/ieee.js +1 -1
  385. package/dist/parg/worker.d.ts +4 -2
  386. package/dist/parg/worker.js +5 -3
  387. package/dist/parse-surface.js +4 -2
  388. package/dist/pubid-urn/decoder.d.ts +8 -0
  389. package/dist/pubid-urn/decoder.js +43 -0
  390. package/dist/pubid-urn/encoder.js +31 -0
  391. package/dist/pubid-urn/schema.d.ts +1 -1
  392. package/dist/pubid-urn/schema.js +1 -1
  393. package/dist/pubid-urn/schemas/bsi.js +1 -0
  394. package/dist/pubid-urn/schemas/bsi_pfs.js +9 -7
  395. package/dist/pubid-urn/schemas/cen_pfs.js +1 -0
  396. package/dist/pubid-urn/schemas/cencenelec.js +1 -0
  397. package/dist/pubid-urn/schemas/iec.js +1 -0
  398. package/dist/pubid-urn/schemas/ieee.js +1 -0
  399. package/dist/pubid-urn/schemas/iso.js +1 -0
  400. package/package.json +1 -1
  401. package/vendor/parg/bsi_pfs.json +1 -1
  402. package/vendor/parg/calconnect_pfs.json +1 -1
  403. package/vendor/parg/cen_pfs.json +1 -1
  404. package/vendor/parg/doi_pfs.json +1 -1
  405. package/vendor/parg/etsi_pfs.json +1 -1
  406. package/vendor/parg/ieee.json +1 -1
  407. package/vendor/parg/iho.json +1 -1
  408. package/vendor/parg/plateau.json +1 -1
  409. package/dist/flavors/api/grammar.d.ts +0 -4
  410. package/dist/flavors/ashrae/grammar.d.ts +0 -2
  411. package/dist/flavors/asme/grammar.d.ts +0 -2
  412. package/dist/flavors/astm/grammar.d.ts +0 -2
  413. package/dist/flavors/bsi/grammar.d.ts +0 -4
  414. package/dist/flavors/cen_cenelec/grammar.d.ts +0 -4
  415. package/dist/flavors/cie/grammar.d.ts +0 -5
  416. package/dist/flavors/csa/grammar.d.ts +0 -6
  417. package/dist/flavors/evs/grammar.d.ts +0 -2
  418. package/dist/flavors/evs/grammar.js +0 -68
  419. package/dist/flavors/gost/grammar.d.ts +0 -2
  420. package/dist/flavors/gost/grammar.js +0 -46
  421. package/dist/flavors/idf/grammar.d.ts +0 -2
  422. package/dist/flavors/iec/grammar.d.ts +0 -3
  423. package/dist/flavors/iec/grammar.js +0 -234
  424. package/dist/flavors/ieee/grammar.d.ts +0 -2
  425. package/dist/flavors/ieee/grammar.js +0 -777
  426. package/dist/flavors/iso/grammar.d.ts +0 -7
  427. package/dist/flavors/iso/grammar.js +0 -282
  428. package/dist/flavors/itu/grammar.d.ts +0 -4
  429. package/dist/flavors/itu/grammar.js +0 -276
  430. package/dist/flavors/nist/grammar.d.ts +0 -2
  431. package/dist/flavors/nist/grammar.js +0 -342
  432. package/dist/flavors/oiml/grammar.d.ts +0 -2
  433. package/dist/flavors/oiml/grammar.js +0 -206
  434. package/vendor/parg/csv.json +0 -1
  435. package/vendor/parg/ini.json +0 -1
  436. package/vendor/parg/json.json +0 -1
  437. package/vendor/parg/lua.json +0 -1
  438. package/vendor/parg/toml.json +0 -1
@@ -0,0 +1,880 @@
1
+ //! The iso semantic delta over the generated substrate (the terminal
2
+ //! migration of docs/CODEGEN-RETIREMENT.md wave 4): the input peels
3
+ //! (the update codes, the Cyrillic table, the DAD pattern), the flat
4
+ //! wire adapter, the builder dispatch and the URN ingestion. Pure — no
5
+ //! `node:*` module, no engine import — so both entries (the node barrel
6
+ //! over the wasm artifact runtime, the worker entry over the pure-TS
7
+ //! worker engine) run the same delta.
8
+ //!
9
+ //! The parse function is injected: the entry binds it to
10
+ //! `substrate.boundToWire(substrate.parseBound(body))` (node) or the
11
+ //! worker engine's equivalent (worker), both producing the artifact's
12
+ //! declared FLAT wire — the position-scoped capture map the adapter
13
+ //! re-nests into the builder's tree (the supplement layers
14
+ //! supp_*/supp2_*/supp3_* peel into base wrappers, the bundle items
15
+ //! bs1_*/bs2_*/bs3_* into base_document + supplements, the directives
16
+ //! supplement dsupp_* into the layer over the DIR base).
17
+ import { ParseFailed } from "../../grammar/engine.js";
18
+ import { PubidDate, Language, Iteration } from "../../model/component.js";
19
+ import { IsoBundledIdentifier, IsoDirectives, IsoDirectivesSupplement, IsoEdition, IsoPublisher, IsoSupplementIdentifier, IsoTcDocument, isoClassForType, locateStage, } from "./model.js";
20
+ import { ISO_TYPED_STAGES } from "./stages.generated.js";
21
+ /**
22
+ * Port of lib/pubid/iso/{builder,normalizer}.rb. Class dispatch follows
23
+ * the Ruby Builder: joint → Combined (unreachable by the corpus),
24
+ * supplements-bundle → BundledIdentifier, tc_type → TcDocument, else
25
+ * locate_type(typed_stage.type_code) with the DIR/SUP special cases.
26
+ */
27
+ const isObj = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
28
+ const s = (v) => {
29
+ if (v === undefined || v === null)
30
+ return undefined;
31
+ const str = Array.isArray(v) ? v.join("") : String(v);
32
+ return str.length > 0 ? str : undefined;
33
+ };
34
+ function flatten(data) {
35
+ return Array.isArray(data) ? Object.assign({}, ...data) : data;
36
+ }
37
+ // --- Normalizer (lib/pubid/iso/normalizer.rb) --------------------------------
38
+ const DAD_PATTERN = /^(.+?)\/(F?DAD)\s+(\d+)(?::(\d{4}))?$/;
39
+ const UPDATE_CODE_LINES = {
40
+ "ISO/R 657/IV": "ISO/R 657-4:1969",
41
+ "ISO/IEC/IEEE 8802-22.2:2015/Amd.2:2017(E)": "ISO/IEC/IEEE 8802-22:2015/Amd.2:2017(E)",
42
+ "ISO/TR 17716.2": "ISO/TR 17716",
43
+ "ISO/TR 17716.2(E)": "ISO/TR 17716(E)",
44
+ };
45
+ const UPDATE_CODE_REGEXES = [
46
+ [/^(ISO[\w/]*) DIS (TR|TS|PAS|ISP) /, "$1 D$2 "],
47
+ [/^(ISO[\w/]*) FDIS (TR|TS|PAS|ISP) /, "$1 FD$2 "],
48
+ [/DIS Amd /, "DAM "],
49
+ [/FDIS Amd /, "FDAM "],
50
+ [/DIS Cor /, "DCOR "],
51
+ [/FDIS Cor /, "FDCOR "],
52
+ [/DIS Suppl /, "DSuppl "],
53
+ [/DIS Add /, "DAD "],
54
+ ];
55
+ const CYRILLIC_MAP = [
56
+ ["Руководства", "GUIDE"],
57
+ ["Руководство", "GUIDE"],
58
+ ["ИСО/МЭК", "ISO/IEC"],
59
+ ["ИСО/ОПМС", "ISO/FDIS"],
60
+ ["ИСО/ПМС", "ISO/DIS"],
61
+ ["ИСО/ТО", "ISO/TR"],
62
+ ["ИСО/ТС", "ISO/TS"],
63
+ ["ИСО", "ISO"],
64
+ ["МЭК", "IEC"],
65
+ ["ТО", "TR"],
66
+ ["ТС", "TS"],
67
+ ["ОПМС", "FDIS"],
68
+ ["ПМС", "DIS"],
69
+ ];
70
+ function normalizeCyrillic(input) {
71
+ if (!/[а-яА-Я]/.test(input))
72
+ return input;
73
+ let normalized = input.replace(/\s*#\s*.*$/, "");
74
+ for (const [from, to] of CYRILLIC_MAP) {
75
+ normalized = normalized.split(from).join(to);
76
+ }
77
+ return normalized.trim();
78
+ }
79
+ function applyUpdateCodes(input) {
80
+ const line = UPDATE_CODE_LINES[input];
81
+ if (line !== undefined)
82
+ return line;
83
+ let out = input;
84
+ for (const [pattern, replacement] of UPDATE_CODE_REGEXES) {
85
+ // The Ruby table keys the supplement-position regexes with a "//"
86
+ // prefix marking "after the first /"; apply those only past a slash.
87
+ out = out.replace(pattern, replacement);
88
+ }
89
+ return out;
90
+ }
91
+ // --- The flat-wire adapter ----------------------------------------------------
92
+ //
93
+ // The artifact binds one flat string per declared capture; the builder
94
+ // reads the nested tree the grammar's shapes produce. The adapter
95
+ // re-nests: the supplement layers peel into base wrappers (the LAST
96
+ // layer is the outermost identifier — "/Amd 1:2007/Cor 1:2008" builds
97
+ // Cor over Amd over the base), the bundle items into
98
+ // base_document + supplements, the directives supplement into the layer
99
+ // over the DIR base. Everything else passes through verbatim.
100
+ const LAYER_PREFIXES = ["supp3_", "supp2_", "supp_", "isor_supp_"];
101
+ function supplementLayer(d, prefix) {
102
+ const layer = {};
103
+ const pairs = [
104
+ ["type_with_stage", `${prefix}type_with_stage`],
105
+ ["number_with_part", `${prefix}number_with_part`],
106
+ ["number", `${prefix}number`],
107
+ ["stage_iteration", `${prefix}stage_iteration`],
108
+ ["date", `${prefix}date`],
109
+ ["undated_marker", `${prefix}undated_marker`],
110
+ ["edition", `${prefix}edition`],
111
+ ["languages", `${prefix}languages`],
112
+ ["all_parts", `${prefix}all_parts`],
113
+ ];
114
+ for (const [to, from] of pairs) {
115
+ const value = d[from];
116
+ if (value !== undefined && value !== null && value !== "")
117
+ layer[to] = value;
118
+ }
119
+ return Object.keys(layer).length > 0 ? layer : undefined;
120
+ }
121
+ export function artifactWireToTree(d) {
122
+ // The bare fields: everything except the position-scoped layer
123
+ // captures and the preprocess mirror (publisher_name rides the
124
+ // publisher_names lookup table; the builder never reads it).
125
+ const bare = {};
126
+ for (const [key, value] of Object.entries(d)) {
127
+ if (key === "publisher_name")
128
+ continue;
129
+ if (LAYER_PREFIXES.some((p) => key.startsWith(p)))
130
+ continue;
131
+ if (/^(dsupp_|bs[123]_|idf_)/.test(key))
132
+ continue;
133
+ bare[key] = value;
134
+ }
135
+ // The flat copublishers span ("/IEC/IEEE") splits into the
136
+ // {copublisher} array the builder reads; the empty match drops.
137
+ const copub = bare["copublishers"];
138
+ if (typeof copub === "string") {
139
+ if (copub === "") {
140
+ delete bare["copublishers"];
141
+ }
142
+ else {
143
+ bare["copublishers"] = copub
144
+ .split("/")
145
+ .filter((c) => c !== "")
146
+ .map((c) => ({ copublisher: c }));
147
+ }
148
+ }
149
+ // The bundled members (" + " faces) ride bs1_*/bs2_*/bs3_*: the base
150
+ // document keeps the plain names, each stamp builds its own
151
+ // supplement tree (publisher rides the supplement_publisher slot on
152
+ // the DIR-SUP leaf).
153
+ const stamps = [];
154
+ for (const n of [1, 2, 3]) {
155
+ const publisher = d[`bs${n}_publisher`];
156
+ if (publisher === undefined || publisher === "")
157
+ break;
158
+ const stamp = {
159
+ publisher,
160
+ type_with_stage: d[`bs${n}_type_with_stage`],
161
+ };
162
+ if (d[`bs${n}_date`] !== undefined)
163
+ stamp["date"] = d[`bs${n}_date`];
164
+ if (d[`bs${n}_undated_marker`] !== undefined)
165
+ stamp["undated_marker"] = d[`bs${n}_undated_marker`];
166
+ stamps.push(stamp);
167
+ }
168
+ // The directives supplement layer (the non-bundled "DIR x IEC SUP"
169
+ // face): the layer's fields ride the top of the wrapper tree the
170
+ // builder reads, the DIR document nests under base.
171
+ if (d["dsupp_publisher"] !== undefined || d["dsupp_type_with_stage"] !== undefined) {
172
+ const layer = {};
173
+ for (const [to, from] of [
174
+ ["type_with_stage", "dsupp_type_with_stage"],
175
+ ["publisher", "dsupp_publisher"],
176
+ ["date", "dsupp_date"],
177
+ ["undated_marker", "dsupp_undated_marker"],
178
+ ["edition", "dsupp_edition"],
179
+ ["languages", "dsupp_languages"],
180
+ ["all_parts", "dsupp_all_parts"],
181
+ ]) {
182
+ const value = d[from];
183
+ if (value !== undefined && value !== "")
184
+ layer[to] = value;
185
+ }
186
+ if (stamps.length > 0)
187
+ throw new ParseFailed("ISO: bundled directives supplement wire", 0);
188
+ return { ...layer, base: bare };
189
+ }
190
+ if (stamps.length > 0) {
191
+ return { base_document: bare, supplements: stamps.map((st) => ({ supplement: st })) };
192
+ }
193
+ // The outermost layer's own third part rides the TOP-LEVEL names
194
+ // (edition/languages/all_parts) when the outermost is the first
195
+ // layer; deeper layers carry their own supp2_*/supp3_* names.
196
+ const topThird = {};
197
+ for (const key of ["edition", "languages", "all_parts"]) {
198
+ if (bare[key] !== undefined) {
199
+ topThird[key] = bare[key];
200
+ delete bare[key];
201
+ }
202
+ }
203
+ // The supplement base's own edition captures as base_edition in the
204
+ // artifact wire; the builder reads the base tree's "edition".
205
+ if (bare["base_edition"] !== undefined) {
206
+ bare["edition"] = bare["base_edition"];
207
+ delete bare["base_edition"];
208
+ }
209
+ const l1 = supplementLayer(d, "supp_");
210
+ const l2 = supplementLayer(d, "supp2_");
211
+ const l3 = supplementLayer(d, "supp3_");
212
+ const isor = supplementLayer(d, "isor_supp_");
213
+ if (l3 !== undefined) {
214
+ return { ...l3, base: { ...(l2 ?? {}), base: { ...(l1 ?? {}), base: bare } } };
215
+ }
216
+ if (l2 !== undefined) {
217
+ return { ...l2, base: { ...(l1 ?? {}), base: bare } };
218
+ }
219
+ if (l1 !== undefined) {
220
+ return { ...l1, ...topThird, base: bare };
221
+ }
222
+ if (isor !== undefined) {
223
+ return { ...isor, ...topThird, base: bare };
224
+ }
225
+ return { ...bare, ...topThird };
226
+ }
227
+ // --- Builder -------------------------------------------------------------------
228
+ function parseLanguages(raw) {
229
+ const str = s(raw);
230
+ if (str === undefined)
231
+ return [];
232
+ return str
233
+ .split(",")
234
+ .flatMap((chunk) => chunk.split("/"))
235
+ .map((token) => token.trim())
236
+ .filter((token) => token !== "")
237
+ .map((original) => {
238
+ const code = original.length === 1 ? (Language.CHAR_MAP[original] ?? original.toLowerCase()) : original;
239
+ return new Language({ code, originalCode: original });
240
+ });
241
+ }
242
+ /**
243
+ * Builder#parse_number_with_part: em/en dashes, slashes and spaces
244
+ * normalize to "-", then number[-part[-subpart]]; a 4-digit 1900-2099
245
+ * part is a legacy year, not a part.
246
+ */
247
+ function parseNumberWithPart(raw) {
248
+ const value = s(raw)?.replace(/[‑‐/]/g, "-").replace(/ /g, "-");
249
+ if (value === undefined)
250
+ return { number: undefined, part: undefined, subpart: undefined, date: undefined };
251
+ const segments = value.split("-").filter((seg) => seg !== "");
252
+ const [number, part, ...rest] = segments;
253
+ const result = { number, part, subpart: rest.length > 0 ? rest.join("-") : undefined, date: undefined };
254
+ if (part !== undefined && /^\d{4}$/.test(part)) {
255
+ const yearValue = Number(part);
256
+ if (yearValue >= 1900 && yearValue <= 2099 && rest.length === 0) {
257
+ result.part = undefined;
258
+ result.date = new PubidDate({ year: part });
259
+ }
260
+ }
261
+ return result;
262
+ }
263
+ function parseDate(tree) {
264
+ if (tree === undefined || !isObj(tree))
265
+ return undefined;
266
+ const flat = flatten(tree);
267
+ const year = s(flat["year"]);
268
+ if (year === undefined)
269
+ return undefined;
270
+ return new PubidDate({
271
+ year,
272
+ month: s(flat["month"]),
273
+ day: s(flat["day"]),
274
+ });
275
+ }
276
+ function parseEdition(raw) {
277
+ const text = s(raw);
278
+ if (text === undefined)
279
+ return undefined;
280
+ const number = /\d+/.exec(text)?.[0];
281
+ return new IsoEdition({ ...(number !== undefined ? { number } : {}), original_text: text });
282
+ }
283
+ function typeStateFromToken(token, fallbackTypeKey) {
284
+ const abbr = s(token);
285
+ if (abbr === undefined)
286
+ return undefined;
287
+ const entry = locateStage(abbr);
288
+ if (entry === undefined)
289
+ return undefined;
290
+ return { entry, originalAbbr: abbr };
291
+ }
292
+ /** The ballot-family stage codes (the DAM family); the no-number rule
293
+ * fills Amendment 1 for a ballot face with no number anywhere. */
294
+ const BALLOT_STAGE_CODES = ["pdam", "damd", "fdamd", "fpdam"];
295
+ class IsoBuilder {
296
+ build(data) {
297
+ const tree = flatten(data);
298
+ if (tree["joint_identifier"] !== undefined) {
299
+ // The joint ISO|IDF face ("ISO 5537|IDF 26"): the artifact grammar
300
+ // parses the twin structurally and the ISO side builds; the twin
301
+ // stays unread until the Combined model ports (the artifact wins —
302
+ // the codegen differential pins this agreement).
303
+ const joint = flatten(tree["joint_identifier"]);
304
+ return this.build(joint["base"]);
305
+ }
306
+ if (tree["supplements"] !== undefined)
307
+ return this.buildBundled(tree);
308
+ // Bare TC reference (pubid-iso#285): tc_type is absent by
309
+ // construction; sc_type is the route's required segment and cannot
310
+ // appear on a standard identifier. Canonicalizes the publisher to ISO.
311
+ if (tree["tc_type"] === undefined && tree["sc_type"] !== undefined && tree["tc_number"] !== undefined) {
312
+ tree["tc_type"] = "TC";
313
+ return this.buildTc(tree);
314
+ }
315
+ if (tree["tc_type"] !== undefined)
316
+ return this.buildTc(tree);
317
+ return this.buildStandard(tree);
318
+ }
319
+ publisherOf(tree) {
320
+ const primary = s(tree["publisher"]);
321
+ const copubTree = tree["copublishers"];
322
+ const copublishers = [];
323
+ if (Array.isArray(copubTree)) {
324
+ for (const entry of copubTree) {
325
+ if (isObj(entry)) {
326
+ const cp = s(entry["copublisher"]);
327
+ if (cp !== undefined)
328
+ copublishers.push(cp);
329
+ }
330
+ }
331
+ }
332
+ else if (copubTree !== undefined) {
333
+ const cp = s(flatten(copubTree)["copublisher"]);
334
+ if (cp !== undefined)
335
+ copublishers.push(cp);
336
+ }
337
+ if (primary === undefined && copublishers.length === 0)
338
+ return undefined;
339
+ return new IsoPublisher({ publisher: primary ?? "ISO", copublisher: copublishers });
340
+ }
341
+ baseAttrs(tree) {
342
+ const attrs = {};
343
+ const numberWithPart = tree["number_with_part"] !== undefined ? flatten(tree["number_with_part"]) : {};
344
+ const rawNumber = s(numberWithPart["number"]) ?? s(tree["number"]);
345
+ const parsed = parseNumberWithPart(s(tree["number_with_part"]) ?? s(tree["number"]));
346
+ if (parsed.number !== undefined || rawNumber !== undefined) {
347
+ if (parsed.number !== undefined)
348
+ attrs["number"] = parsed.number;
349
+ if (parsed.part !== undefined)
350
+ attrs["part"] = parsed.part;
351
+ if (parsed.subpart !== undefined)
352
+ attrs["subpart"] = parsed.subpart;
353
+ if (parsed.date !== undefined)
354
+ attrs["date"] = parsed.date;
355
+ }
356
+ const date = parseDate(tree["date"]) ?? parseDate(tree["base"] !== undefined ? undefined : undefined);
357
+ if (tree["date"] !== undefined) {
358
+ if (isObj(tree["date"])) {
359
+ const flat = flatten(tree["date"]);
360
+ const year = s(flat["year"]);
361
+ if (year !== undefined) {
362
+ attrs["date"] = new PubidDate({ year, month: s(flat["month"]), day: s(flat["day"]) });
363
+ }
364
+ }
365
+ else {
366
+ const dateStr = s(tree["date"]);
367
+ if (dateStr !== undefined) {
368
+ const [year, month, day] = dateStr.split("-");
369
+ if (year !== undefined && year !== "") {
370
+ attrs["date"] = new PubidDate({ year, month, day });
371
+ }
372
+ }
373
+ }
374
+ }
375
+ if (tree["undated_marker"] !== undefined) {
376
+ attrs["date"] = new PubidDate({ undated: true });
377
+ }
378
+ const edition = parseEdition(tree["edition"]);
379
+ if (edition !== undefined)
380
+ attrs["edition"] = edition;
381
+ const languages = parseLanguages(tree["languages"]);
382
+ if (languages.length > 0)
383
+ attrs["languages"] = languages;
384
+ if (tree["all_parts"] !== undefined)
385
+ attrs["all_parts"] = true;
386
+ if (tree["stage_iteration"] !== undefined) {
387
+ attrs["stage_iteration"] = new Iteration({ string: s(tree["stage_iteration"]) });
388
+ }
389
+ return attrs;
390
+ }
391
+ buildStandard(treeIn) {
392
+ const tree = { ...treeIn };
393
+ // Historic TYPE-first ballot face ("ISO/IEC FDAM 1 14496-12:2004",
394
+ // "ISO/PDAM 19973-2", "ISO 15877-5:2009 FDAM 1"): the ballot_* keys
395
+ // are one amendment layer over the whole base, never a second
396
+ // supplement layer (the stored twins keep one level), so the layer
397
+ // is assembled here, before the supplement branch could read the
398
+ // ballot token as an outer wrapper.
399
+ if (tree["ballot_type_with_stage"] !== undefined) {
400
+ return this.buildBallotSupplement(tree);
401
+ }
402
+ // Legacy ISO/R: publisher ISO + type "R".
403
+ if (tree["iso_r_prefix"] !== undefined) {
404
+ tree["publisher"] = "ISO";
405
+ tree["type_with_stage"] = "R";
406
+ }
407
+ // NSB stage prefixes map onto typed stages.
408
+ if (tree["nsb_stage"] !== undefined) {
409
+ tree["type_with_stage"] = s(tree["nsb_stage"]) === "Fpr" ? "PRF" : "WD";
410
+ }
411
+ // French Guide/GUIDE prefix.
412
+ if (tree["type_with_stage_fr"] !== undefined) {
413
+ tree["type_with_stage"] = s(tree["type_with_stage_fr"]);
414
+ }
415
+ // Directive supplement without its own SUP keyword.
416
+ if (tree["type_with_stage"] === undefined && tree["base"] !== undefined && isObj(tree["base"])) {
417
+ const baseTree = flatten(tree["base"]);
418
+ const dirTokens = new Set(["DIR", "Directives Part", "Directives, Part", "Directives,", "Directives"]);
419
+ if (dirTokens.has(s(baseTree["type_with_stage"]) ?? "")) {
420
+ tree["type_with_stage"] = "SUP";
421
+ }
422
+ }
423
+ const state = typeStateFromToken(s(tree["type_with_stage"]), "is");
424
+ // The explicit URN type token pins the class: a stage's abbreviation
425
+ // can overwrite type_with_stage with an IS-only stage ("WDA" for
426
+ // 90.93), and the document must stay a TR/TS (the Ruby builder reads
427
+ // the same document_type hint).
428
+ const documentType = s(tree["document_type"]);
429
+ const typeKey = documentType !== undefined
430
+ ? documentType.toLowerCase()
431
+ : state?.entry.typeCode ?? "is";
432
+ if (typeKey === "dir-sup")
433
+ return this.buildDirectivesSupplement(tree, state);
434
+ if (typeKey === "dir")
435
+ return this.buildDirectives(tree, state ?? { entry: locateStage("DIR"), originalAbbr: "DIR" });
436
+ const klass = isoClassForType(typeKey);
437
+ if (klass === undefined) {
438
+ throw new ParseFailed(`ISO: unknown type key ${typeKey}`, 0);
439
+ }
440
+ const attrs = this.baseAttrs(tree);
441
+ const publisher = this.publisherOf(tree);
442
+ if (publisher !== undefined)
443
+ attrs["publisher"] = publisher;
444
+ if (state !== undefined)
445
+ attrs["typedStageState"] = state;
446
+ if ((tree["base"] !== undefined || klass.prototype instanceof IsoSupplementIdentifier) && tree["base"] !== undefined) {
447
+ attrs["base"] = this.build(tree["base"]);
448
+ }
449
+ const identifier = new klass(attrs);
450
+ // The owner's no-number rule, applied on every construction path
451
+ // that routes through this builder (parse, URN, bundle members): a
452
+ // DAM-family ballot-stage amendment token with no number anywhere
453
+ // names Amendment 1 ("ISO 19973-2/PDAM", "ISO/IEC PDAM 12207"). The
454
+ // number is identity-bearing, so the default lands at build time and
455
+ // the wire hash serializes it — parse and fromHash(toHash) agree
456
+ // because both carry the filled number. The ballot stages are
457
+ // matched by the typed stage's code (the per-typed-stage key) —
458
+ // PDAM's stageCode is "cd", the harmonized range it lives in.
459
+ if (typeKey === "amd" && attrs["number"] === undefined &&
460
+ BALLOT_STAGE_CODES.includes(attrs["typedStageState"]?.entry.code ?? "")) {
461
+ identifier["number"] = "1";
462
+ }
463
+ return identifier;
464
+ }
465
+ /**
466
+ * Historic TYPE-first ballot face (owner ruling 2026-11-12, Option B
467
+ * decode-to-modern): "[P|F]?DAM [N] BASE [stamp]" decodes to ONE
468
+ * amendment over the WHOLE base, rendered as the canonical on-base
469
+ * slash face. The stage comes from the ballot token; the number from
470
+ * the TYPE token, then the on-base stamp, then the owner's no-number
471
+ * rule (a ballot face with no number anywhere names Amendment 1); the
472
+ * stamp's date is the ballot supplement's date. The base keeps every
473
+ * component it carried: a legacy slash-part stays a part of the base
474
+ * number ("ISO/IEC FPDAM 9075/1" → base "9075-1"), and the base's own
475
+ * type token stays the base's ("ISO/IEC PDAM TR 9573-11" → base
476
+ * "TR 9573-11") — nothing migrates into the supplement slot. The
477
+ * stamp's token letters (Amd/Am/…) are decode-away: the ballot's
478
+ * stage is the TYPE token's.
479
+ */
480
+ buildBallotSupplement(tree) {
481
+ const fields = {
482
+ type_with_stage: s(tree["ballot_type_with_stage"]),
483
+ };
484
+ const number = s(tree["ballot_number"]) ??
485
+ s(tree["ballot_stamp_number"]) ??
486
+ s(tree["ballot_stamp_dot_number"]) ??
487
+ "1";
488
+ fields["number_with_part"] = number;
489
+ // The on-base stamp: its date (or undated marker) is the ballot
490
+ // supplement's; its number feeds the precedence above; its token
491
+ // letters were matched uncaptured and decode away.
492
+ const stampDate = s(tree["ballot_stamp_date"]);
493
+ if (stampDate !== undefined) {
494
+ const [year, month, day] = stampDate.split("-");
495
+ fields["date"] = new PubidDate({ year, month, day });
496
+ }
497
+ else if (tree["ballot_stamp_undated_marker"] !== undefined) {
498
+ fields["date"] = new PubidDate({ undated: true });
499
+ }
500
+ const rest = {};
501
+ for (const [key, value] of Object.entries(tree)) {
502
+ if (!key.startsWith("ballot_"))
503
+ rest[key] = value;
504
+ }
505
+ return this.build({ ...fields, base: rest });
506
+ }
507
+ buildDirectives(tree, state) {
508
+ const attrs = this.baseAttrs(tree);
509
+ const publisher = this.publisherOf(tree);
510
+ if (publisher !== undefined)
511
+ attrs["publisher"] = publisher;
512
+ attrs["typedStageState"] = state;
513
+ if (tree["subgroup"] !== undefined)
514
+ attrs["subgroup"] = s(tree["subgroup"]);
515
+ return new IsoDirectives(attrs);
516
+ }
517
+ buildDirectivesSupplement(tree, state) {
518
+ const attrs = this.baseAttrs(tree);
519
+ attrs["typedStageState"] = state;
520
+ if (tree["publisher"] !== undefined)
521
+ attrs["supplement_publisher"] = s(tree["publisher"]);
522
+ if (tree["base"] !== undefined)
523
+ attrs["base"] = this.build(tree["base"]);
524
+ return new IsoDirectivesSupplement(attrs);
525
+ }
526
+ buildTc(tree) {
527
+ const attrs = {};
528
+ const publisher = this.publisherOf(tree);
529
+ if (publisher !== undefined)
530
+ attrs["publisher"] = publisher;
531
+ for (const key of ["tc_type", "tc_number", "sc_type", "sc_number", "wg_type", "wg_number", "number"]) {
532
+ const value = s(tree[key]);
533
+ if (value !== undefined)
534
+ attrs[key] = value;
535
+ }
536
+ if (tree["year"] !== undefined) {
537
+ attrs["date"] = new PubidDate({ year: s(tree["year"]) });
538
+ }
539
+ return new IsoTcDocument(attrs);
540
+ }
541
+ buildBundled(tree) {
542
+ const baseDocument = this.build(tree["base_document"]);
543
+ const supplements = Array.isArray(tree["supplements"])
544
+ ? tree["supplements"].map((entry) => this.build(flatten(entry)["supplement"]))
545
+ : [];
546
+ return new IsoBundledIdentifier({ base_document: baseDocument, supplements });
547
+ }
548
+ }
549
+ // --- Entry points ----------------------------------------------------------------
550
+ /** The parse lane: the injected wire (the artifact's flat bound over
551
+ * either engine) re-nests through the adapter, then the builder. */
552
+ function parseFlat(wire) {
553
+ return new IsoBuilder().build(artifactWireToTree(wire));
554
+ }
555
+ // --- URN ingestion (lib/pubid/iso/urn_parser.rb) ----------------------------
556
+ // RFC 5141-bis typed-stage abbreviations → stage codes. "DIS"/"ADIS" are
557
+ // ISO ladder stages the reference maps; everything else mirrors the gem's
558
+ // TYPED_STAGE_REVERSE_MAP verbatim.
559
+ const URN_STAGE_ABBRS = {
560
+ WD: "wd", WDS: "wds", CD: "cd", CDV: "cdv", DIS: "dis", FDIS: "fdis",
561
+ PDAM: "pdam", DAM: "dam", FDAM: "fdamd", DCOR: "dcor", FDCOR: "fdcor",
562
+ CDTS: "cdts", DTS: "dts", FDTS: "fdts",
563
+ };
564
+ const URN_TYPE_TOKENS = new Set([
565
+ "tr", "ts", "pas", "guide", "dir", "dir-sup", "iwa-sup", "isp", "iwa", "r", "data",
566
+ ]);
567
+ const URN_SUPP_TYPES = new Set(["amd", "cor", "sup", "add"]);
568
+ // The URN type tokens are the gem's type keys; the ts leaf for ISO/R is
569
+ // keyed "rec".
570
+ const URN_TYPE_KEYS = { r: "rec" };
571
+ function urnStageByHarmonized(code) {
572
+ const candidates = ISO_TYPED_STAGES.filter((s) => s.harmonized?.includes(code));
573
+ // The gem prefers the IS family when a code is shared across families
574
+ // (pubid#570 — the registry order is load-order dependent there).
575
+ return candidates.find((s) => s.typeCode === "is") ?? candidates[0];
576
+ }
577
+ // When the URN gives a harmonized code and no type token, the document is
578
+ // an IS: prefer the non-published IS stages (PRF over the published IS for
579
+ // 60.00), then the stage covering the most codes (WD over WDS).
580
+ function urnIsStageByHarmonized(code) {
581
+ const candidates = ISO_TYPED_STAGES.filter((s) => s.typeCode === "is" && s.harmonized?.includes(code));
582
+ if (candidates.length === 0)
583
+ return undefined;
584
+ const nonPublished = candidates.filter((s) => s.stageCode !== "published");
585
+ const pool = nonPublished.length > 0 ? nonPublished : candidates;
586
+ let best = pool[0];
587
+ for (const candidate of pool) {
588
+ if ((candidate.harmonized?.length ?? 0) > (best.harmonized?.length ?? 0))
589
+ best = candidate;
590
+ }
591
+ return best;
592
+ }
593
+ // The URN carries parts as "10164:-5-1-1" or "9001-1"; split into
594
+ // number / part / subpart (a subpart keeps its dashes).
595
+ function parseUrnNumberPart(raw) {
596
+ if (raw === undefined)
597
+ return [undefined, undefined, undefined];
598
+ if (/^\w+:-/.test(raw)) {
599
+ const segments = raw.split(":-");
600
+ const tail = segments.slice(1).join("-").split("-");
601
+ return [
602
+ segments[0],
603
+ tail[0],
604
+ tail.length > 1 ? tail.slice(1).join("-") : undefined,
605
+ ];
606
+ }
607
+ if (raw.includes("-")) {
608
+ const segments = raw.split("-");
609
+ return [
610
+ segments[0],
611
+ segments[1],
612
+ segments.length > 2 ? segments.slice(2).join("-") : undefined,
613
+ ];
614
+ }
615
+ return [raw, undefined, undefined];
616
+ }
617
+ function parseIsoUrn(urn) {
618
+ if (!urn.startsWith("urn:iso:std:"))
619
+ throw new Error(`Invalid ISO URN: ${urn}`);
620
+ let parts = urn.slice("urn:iso:std:".length).split(":");
621
+ // A trailing "ser" marks an all-parts identifier.
622
+ let allParts = false;
623
+ if (parts[parts.length - 1] === "ser") {
624
+ parts = parts.slice(0, -1);
625
+ allParts = true;
626
+ }
627
+ const publishers = (parts.shift() ?? "").split("-").map((p) => p.toUpperCase());
628
+ let typeCode;
629
+ if (parts[0] !== undefined && URN_TYPE_TOKENS.has(parts[0].toLowerCase())) {
630
+ typeCode = parts.shift().toLowerCase();
631
+ }
632
+ // RFC 5141 requires docnumber -- "urn:iso:std:iso" is not a valid
633
+ // NSS, and building it silently produced the identity-free "ISO "
634
+ // (mirrors lib/pubid/iso/urn_parser.rb)
635
+ if (parts.length === 0)
636
+ throw new Error(`missing docnumber: ${urn}`);
637
+ let [number, part, subpart] = parseUrnNumberPart(parts.shift());
638
+ let year;
639
+ if (/^\d{4}$/.test(parts[0] ?? ""))
640
+ year = parts.shift();
641
+ // URN-style part notation can trail the year (":10164:2019:-22").
642
+ if ((parts[0] ?? "").startsWith("-")) {
643
+ const partStr = parts.shift();
644
+ [number, part, subpart] = parseUrnNumberPart(`${number}${partStr}`);
645
+ }
646
+ if (year === undefined && /^\d{4}$/.test(parts[0] ?? ""))
647
+ year = parts.shift();
648
+ let edition;
649
+ if ((parts[0] ?? "").startsWith("ed-"))
650
+ edition = parts.shift().slice(3);
651
+ let languages;
652
+ if (parts[0] !== undefined && !/^\d+$/.test(parts[0]) &&
653
+ !/^(amd|cor|sup|add|v\d+|stage-|ed-)/i.test(parts[0]) &&
654
+ !(parts[0].toUpperCase() in URN_STAGE_ABBRS) &&
655
+ !/^[A-Za-z]+\.\d+$/.test(parts[0])) {
656
+ languages = parts.shift().split(",").map((l) => l.toUpperCase()).join("/");
657
+ }
658
+ // Stage: either "stage-XX.XX[.vN]" (harmonized) or a typed abbreviation
659
+ // ("WD", "CD.2").
660
+ let stageCode;
661
+ let stageFromAbbr;
662
+ let stageIteration;
663
+ if ((parts[0] ?? "").startsWith("stage-")) {
664
+ const stageStr = parts.shift();
665
+ stageCode = stageStr.slice(6).replace(/\.v\d+$/i, "");
666
+ const iteration = /\.v(\d+)$/i.exec(stageStr);
667
+ if (iteration !== null)
668
+ stageIteration = iteration[1];
669
+ }
670
+ else if ((parts[0] !== undefined && parts[0].toUpperCase() in URN_STAGE_ABBRS) ||
671
+ (parts[0] !== undefined && /^[A-Za-z]+\.\d+$/.test(parts[0]) &&
672
+ (parts[0].toUpperCase().split(".")[0] ?? "") in URN_STAGE_ABBRS)) {
673
+ const stageAbbr = parts[0].toUpperCase();
674
+ // A supplement-family stage directly before its own supplement type
675
+ // token ("...:FDAM:amd:1:v1") names the SUPPLEMENT's stage: consuming
676
+ // it as the base's stage builds the base as a base-less supplement,
677
+ // which cannot render (the gem guards the same way).
678
+ const family = locateStage(stageAbbr.split(".")[0] ?? "")?.typeCode;
679
+ const supplementFollows = (family !== undefined &&
680
+ ["amd", "cor", "suppl", "add"].includes(family)) &&
681
+ parts.slice(1).some((token) => URN_SUPP_TYPES.has(token.toLowerCase()) &&
682
+ (URN_TYPE_KEYS[token.toLowerCase()] ?? token.toLowerCase()) === family);
683
+ if (!supplementFollows) {
684
+ parts.shift();
685
+ if (stageAbbr.includes(".")) {
686
+ const abbrPart = stageAbbr.split(".")[0];
687
+ const iterationPart = stageAbbr.split(".")[1];
688
+ stageCode = URN_STAGE_ABBRS[abbrPart];
689
+ stageFromAbbr = abbrPart;
690
+ stageIteration = iterationPart;
691
+ }
692
+ else {
693
+ stageCode = URN_STAGE_ABBRS[stageAbbr];
694
+ stageFromAbbr = stageAbbr;
695
+ }
696
+ }
697
+ }
698
+ // Supplements (amd, cor, sup, add), left-to-right: each wraps the previous.
699
+ const supplements = [];
700
+ while (parts.length > 0) {
701
+ const supp = {};
702
+ if ((parts[0] ?? "").startsWith("stage-")) {
703
+ supp.stage = parts.shift().slice(6).replace(/\.v\d+$/i, "");
704
+ }
705
+ else if (parts[0] !== undefined && parts[0].toUpperCase() in URN_STAGE_ABBRS) {
706
+ supp.stage = URN_STAGE_ABBRS[parts.shift().toUpperCase()];
707
+ }
708
+ if (parts[0] !== undefined && URN_SUPP_TYPES.has(parts[0].toLowerCase())) {
709
+ supp.type = parts.shift().toLowerCase();
710
+ }
711
+ if (/^\d+$/.test(parts[0] ?? "")) {
712
+ if (/^\d{4}$/.test(parts[0]))
713
+ supp.year = parts.shift();
714
+ else
715
+ supp.number = parts.shift();
716
+ }
717
+ // The legacy year-overloaded wire ("amd:2007:v2" -- the number rode
718
+ // the version slot): a v-token with no preceding number carries the
719
+ // NUMBER. The RFC 5141-bis order ("amd:1:2007:v2") keeps the number
720
+ // in its own slot, so a v-token after a number is the true
721
+ // <supplversion>.
722
+ const consumeV = () => {
723
+ if ((parts[0] ?? "").startsWith("v")) {
724
+ const value = parts.shift().slice(1).split(".")[0];
725
+ if (supp.number === undefined)
726
+ supp.number = value;
727
+ else
728
+ supp.version = value;
729
+ }
730
+ };
731
+ consumeV();
732
+ if (supp.year === undefined && /^\d{4}$/.test(parts[0] ?? ""))
733
+ supp.year = parts.shift();
734
+ // a v-token after the year would otherwise start a type-less wrap
735
+ consumeV();
736
+ if (parts[0] !== undefined && !/^\d+$/.test(parts[0]) &&
737
+ !/^(amd|cor|sup|add|v\d+|stage-)/i.test(parts[0])) {
738
+ supp.languages = parts.shift().split(",").map((l) => l.toUpperCase()).join("/");
739
+ }
740
+ supplements.push(supp);
741
+ }
742
+ // Builder tree, mirroring the gem's build_identifier.
743
+ const base = {};
744
+ if (publishers[0] !== undefined && publishers[0] !== "") {
745
+ base["publisher"] = publishers[0];
746
+ if (publishers.length > 1) {
747
+ base["copublishers"] = publishers.slice(1).map((c) => ({ copublisher: c }));
748
+ }
749
+ }
750
+ if (part !== undefined || subpart !== undefined) {
751
+ base["number_with_part"] = [number, part, subpart].filter((p) => p !== undefined).join("-");
752
+ }
753
+ else if (number !== undefined) {
754
+ base["number"] = number;
755
+ }
756
+ if (year !== undefined)
757
+ base["date"] = year;
758
+ if (edition !== undefined)
759
+ base["edition"] = edition;
760
+ if (typeCode !== undefined && typeCode !== "is") {
761
+ base["type_with_stage"] = typeCode.toUpperCase();
762
+ // Pin the document class against the stage block below overwriting
763
+ // type_with_stage (the Ruby builder reads the same hint).
764
+ base["document_type"] = (URN_TYPE_KEYS[typeCode] ?? typeCode).toUpperCase();
765
+ }
766
+ if (stageCode !== undefined) {
767
+ let stage;
768
+ if (stageFromAbbr !== undefined) {
769
+ stage = locateStage(stageFromAbbr) ??
770
+ ISO_TYPED_STAGES.find((s) => s.stageCode === stageCode);
771
+ }
772
+ else if (typeCode === undefined || typeCode === "is") {
773
+ stage = urnIsStageByHarmonized(stageCode);
774
+ // FCD is a legacy spelling of the DIS stage in URN form.
775
+ if (stageCode === "40.00" && stage?.stageCode === "fcd") {
776
+ stage = ISO_TYPED_STAGES.find((s) => s.stageCode === "dis" && s.harmonized?.includes("40.00")) ?? stage;
777
+ }
778
+ }
779
+ stage ??= urnStageByHarmonized(stageCode);
780
+ if (stage !== undefined)
781
+ base["type_with_stage"] = stage.abbr[0] ?? "";
782
+ else
783
+ base["stage"] = stageCode;
784
+ if (stageIteration !== undefined)
785
+ base["stage_iteration"] = stageIteration;
786
+ }
787
+ if (languages !== undefined)
788
+ base["languages"] = languages;
789
+ let tree = base;
790
+ for (const supp of supplements) {
791
+ // A bare language token with no supplement identity names the BASE
792
+ // document (the gem merges it the same way — a wrapper would drop it).
793
+ if (supp.type === undefined && supp.stage === undefined &&
794
+ supp.number === undefined && supp.year === undefined &&
795
+ supp.languages !== undefined) {
796
+ base["languages"] = supp.languages;
797
+ continue;
798
+ }
799
+ const suppTree = {};
800
+ if (supp.stage !== undefined) {
801
+ // A harmonized code resolves within the supplement's own type
802
+ // family -- the IS-family default would turn a staged Corrigendum
803
+ // into a plain IS (mirrors the gem's build_identifier).
804
+ const stage = /^\d\d\.\d\d$/.test(supp.stage)
805
+ ? ISO_TYPED_STAGES.find((st) => st.harmonized?.includes(supp.stage) && st.typeKey === supp.type) ??
806
+ ISO_TYPED_STAGES.find((st) => st.harmonized?.includes(supp.stage) && st.typeKey === "is")
807
+ : ISO_TYPED_STAGES.find((st) => st.stageCode === supp.stage);
808
+ suppTree["type_with_stage"] = stage !== undefined
809
+ ? stage.abbr[0] ?? ""
810
+ : supp.type?.toUpperCase() ?? supp.stage.toUpperCase();
811
+ }
812
+ if (supp.type !== undefined && suppTree["type_with_stage"] === undefined) {
813
+ // "sup" is the generic Supplement (type key "suppl") -- the raw
814
+ // "SUP" resolves the Directives Supplement row, whose render needs
815
+ // the supplement_publisher a guide chain never has
816
+ const typeToken = supp.type === "sup" ? "SUPPL" : supp.type.toUpperCase();
817
+ suppTree["type_with_stage"] = typeToken;
818
+ }
819
+ if (supp.number !== undefined)
820
+ suppTree["number"] = supp.number;
821
+ if (supp.year !== undefined)
822
+ suppTree["date"] = supp.year;
823
+ if (supp.version !== undefined)
824
+ suppTree["supplement_version"] = supp.version;
825
+ if (supp.languages !== undefined)
826
+ suppTree["languages"] = supp.languages;
827
+ tree = { base: tree, ...suppTree };
828
+ }
829
+ const identifier = new IsoBuilder().build(tree);
830
+ if (allParts) {
831
+ identifier.all_parts = true;
832
+ }
833
+ return identifier;
834
+ }
835
+ export function makeIsoGrammarImplementation(parseWire) {
836
+ return {
837
+ // Inverse of the ISO UrnGenerator (lib/pubid/iso/urn_parser.rb): the
838
+ // reference rebuilds a builder hash straight from the positional URN
839
+ // fields, so the port does the same against the shared IsoBuilder.
840
+ parseUrn(urn) {
841
+ return parseIsoUrn(urn);
842
+ },
843
+ parse(input) {
844
+ const dad = DAD_PATTERN.exec(input);
845
+ if (dad !== null) {
846
+ // "ISO 2631/DAD 1[:1987]" — parsed manually; the grammar treats "/"
847
+ // as a copublisher separator.
848
+ const base = parseHuman(dad[1], parseWire);
849
+ const builder = new IsoBuilder();
850
+ const attrs = {
851
+ base,
852
+ number: dad[3],
853
+ typedStageState: { entry: locateStage(dad[2]), originalAbbr: dad[2] },
854
+ };
855
+ if (dad[4] !== undefined)
856
+ attrs["date"] = new PubidDate({ year: dad[4] });
857
+ const klass = isoClassForType("add");
858
+ return new klass(attrs);
859
+ }
860
+ return parseHuman(input, parseWire);
861
+ },
862
+ };
863
+ }
864
+ function parseHuman(input, parseWire) {
865
+ const normalized = normalizeCyrillic(applyUpdateCodes(input));
866
+ let wire;
867
+ try {
868
+ wire = parseWire(normalized);
869
+ }
870
+ catch (err) {
871
+ // The artifact's rejection surfaces as the parse-failure class the
872
+ // flavor's error contract pins (the grammar lane threw ParseFailed
873
+ // before the substrate drove this lane).
874
+ throw new ParseFailed(`iso: cannot parse ${JSON.stringify(input)}: ${err.message}`, 0);
875
+ }
876
+ if (wire === null || wire === undefined) {
877
+ throw new ParseFailed(`iso: cannot parse ${JSON.stringify(input)}`, 0);
878
+ }
879
+ return parseFlat(wire);
880
+ }