@genome-spy/core 0.65.0 → 0.66.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (232) hide show
  1. package/dist/bundle/browser-BRemItdO.js +138 -0
  2. package/dist/bundle/{index-CD7FLu9x.js → index-BatuyGAI.js} +23 -21
  3. package/dist/bundle/{index-C0llXMqm.js → index-ByuE8dvu.js} +140 -88
  4. package/dist/bundle/index-Cq3QFUxX.js +1781 -0
  5. package/dist/bundle/index-D28m8tSW.js +1607 -0
  6. package/dist/bundle/index-DbJ0oeYM.js +631 -0
  7. package/dist/bundle/index.es.js +17587 -16593
  8. package/dist/bundle/index.js +214 -212
  9. package/dist/bundle/{inflate-DRgHi_KK.js → inflate-GtwLkvSP.js} +222 -224
  10. package/dist/bundle/unzip-NywezaRR.js +1492 -0
  11. package/dist/schema.json +13 -3
  12. package/dist/src/config/scaleDefaults.d.ts +8 -0
  13. package/dist/src/config/scaleDefaults.d.ts.map +1 -0
  14. package/dist/src/config/scaleDefaults.js +45 -0
  15. package/dist/src/data/flowInit.js +2 -2
  16. package/dist/src/data/sources/lazy/axisTickSource.js +1 -1
  17. package/dist/src/data/sources/lazy/singleAxisLazySource.d.ts +1 -1
  18. package/dist/src/data/sources/lazy/singleAxisLazySource.d.ts.map +1 -1
  19. package/dist/src/data/sources/lazy/singleAxisLazySource.js +10 -3
  20. package/dist/src/data/sources/lazy/singleAxisWindowedSource.d.ts.map +1 -1
  21. package/dist/src/data/sources/lazy/singleAxisWindowedSource.js +5 -1
  22. package/dist/src/data/transforms/filterScoredLabels.d.ts +1 -1
  23. package/dist/src/data/transforms/filterScoredLabels.d.ts.map +1 -1
  24. package/dist/src/data/transforms/filterScoredLabels.js +1 -1
  25. package/dist/src/data/transforms/linearizeGenomicCoordinate.d.ts.map +1 -1
  26. package/dist/src/data/transforms/linearizeGenomicCoordinate.js +2 -1
  27. package/dist/src/encoder/encoder.d.ts +1 -1
  28. package/dist/src/encoder/encoder.d.ts.map +1 -1
  29. package/dist/src/encoder/encoder.js +1 -1
  30. package/dist/src/genome/scaleLocus.d.ts +39 -0
  31. package/dist/src/genome/scaleLocus.d.ts.map +1 -1
  32. package/dist/src/genome/scaleLocus.js +76 -0
  33. package/dist/src/genomeSpy/canvasExport.d.ts +19 -0
  34. package/dist/src/genomeSpy/canvasExport.d.ts.map +1 -0
  35. package/dist/src/genomeSpy/canvasExport.js +66 -0
  36. package/dist/src/genomeSpy/containerUi.d.ts +17 -0
  37. package/dist/src/genomeSpy/containerUi.d.ts.map +1 -0
  38. package/dist/src/genomeSpy/containerUi.js +78 -0
  39. package/dist/src/genomeSpy/eventListenerRegistry.d.ts +19 -0
  40. package/dist/src/genomeSpy/eventListenerRegistry.d.ts.map +1 -0
  41. package/dist/src/genomeSpy/eventListenerRegistry.js +38 -0
  42. package/dist/src/genomeSpy/inputBindingManager.d.ts +14 -0
  43. package/dist/src/genomeSpy/inputBindingManager.d.ts.map +1 -0
  44. package/dist/src/genomeSpy/inputBindingManager.js +63 -0
  45. package/dist/src/genomeSpy/interactionController.d.ts +40 -0
  46. package/dist/src/genomeSpy/interactionController.d.ts.map +1 -0
  47. package/dist/src/genomeSpy/interactionController.js +371 -0
  48. package/dist/src/genomeSpy/keyboardListenerManager.d.ts +10 -0
  49. package/dist/src/genomeSpy/keyboardListenerManager.d.ts.map +1 -0
  50. package/dist/src/genomeSpy/keyboardListenerManager.js +31 -0
  51. package/dist/src/genomeSpy/loadingIndicatorManager.d.ts +15 -0
  52. package/dist/src/genomeSpy/loadingIndicatorManager.d.ts.map +1 -0
  53. package/dist/src/genomeSpy/loadingIndicatorManager.js +92 -0
  54. package/dist/src/genomeSpy/renderCoordinator.d.ts +22 -0
  55. package/dist/src/genomeSpy/renderCoordinator.d.ts.map +1 -0
  56. package/dist/src/genomeSpy/renderCoordinator.js +118 -0
  57. package/dist/src/genomeSpy/viewContextFactory.d.ts +18 -0
  58. package/dist/src/genomeSpy/viewContextFactory.d.ts.map +1 -0
  59. package/dist/src/genomeSpy/viewContextFactory.js +79 -0
  60. package/dist/src/genomeSpy/viewDataInit.d.ts +12 -0
  61. package/dist/src/genomeSpy/viewDataInit.d.ts.map +1 -0
  62. package/dist/src/genomeSpy/viewDataInit.js +41 -0
  63. package/dist/src/genomeSpy/viewHierarchyConfig.d.ts +14 -0
  64. package/dist/src/genomeSpy/viewHierarchyConfig.d.ts.map +1 -0
  65. package/dist/src/genomeSpy/viewHierarchyConfig.js +24 -0
  66. package/dist/src/genomeSpy/viewHighlight.d.ts +5 -0
  67. package/dist/src/genomeSpy/viewHighlight.d.ts.map +1 -0
  68. package/dist/src/genomeSpy/viewHighlight.js +30 -0
  69. package/dist/src/genomeSpy.d.ts +16 -71
  70. package/dist/src/genomeSpy.d.ts.map +1 -1
  71. package/dist/src/genomeSpy.js +179 -745
  72. package/dist/src/gl/glslScaleGenerator.d.ts +1 -1
  73. package/dist/src/gl/webGLHelper.d.ts +2 -2
  74. package/dist/src/gl/webGLHelper.d.ts.map +1 -1
  75. package/dist/src/gl/webGLHelper.js +4 -4
  76. package/dist/src/index.d.ts.map +1 -1
  77. package/dist/src/index.js +2 -12
  78. package/dist/src/marks/mark.d.ts.map +1 -1
  79. package/dist/src/marks/mark.js +4 -2
  80. package/dist/src/{view → scales}/axisResolution.d.ts +9 -16
  81. package/dist/src/scales/axisResolution.d.ts.map +1 -0
  82. package/dist/src/{view → scales}/axisResolution.js +29 -18
  83. package/dist/src/scales/axisResolution.test.d.ts.map +1 -0
  84. package/dist/src/scales/scaleDomainAggregator.d.ts +57 -0
  85. package/dist/src/scales/scaleDomainAggregator.d.ts.map +1 -0
  86. package/dist/src/scales/scaleDomainAggregator.js +162 -0
  87. package/dist/src/scales/scaleDomainAggregator.test.d.ts +2 -0
  88. package/dist/src/scales/scaleDomainAggregator.test.d.ts.map +1 -0
  89. package/dist/src/scales/scaleInstanceManager.d.ts +40 -0
  90. package/dist/src/scales/scaleInstanceManager.d.ts.map +1 -0
  91. package/dist/src/scales/scaleInstanceManager.js +313 -0
  92. package/dist/src/scales/scaleInstanceManager.test.d.ts +2 -0
  93. package/dist/src/scales/scaleInstanceManager.test.d.ts.map +1 -0
  94. package/dist/src/scales/scaleInteractionController.d.ts +73 -0
  95. package/dist/src/scales/scaleInteractionController.d.ts.map +1 -0
  96. package/dist/src/scales/scaleInteractionController.js +336 -0
  97. package/dist/src/scales/scaleInteractionController.test.d.ts +2 -0
  98. package/dist/src/scales/scaleInteractionController.test.d.ts.map +1 -0
  99. package/dist/src/scales/scalePropsResolver.d.ts +23 -0
  100. package/dist/src/scales/scalePropsResolver.d.ts.map +1 -0
  101. package/dist/src/scales/scalePropsResolver.js +74 -0
  102. package/dist/src/{view → scales}/scaleResolution.d.ts +52 -35
  103. package/dist/src/scales/scaleResolution.d.ts.map +1 -0
  104. package/dist/src/scales/scaleResolution.js +658 -0
  105. package/dist/src/scales/scaleResolution.test.d.ts.map +1 -0
  106. package/dist/src/scales/scaleResolutionConstants.d.ts +6 -0
  107. package/dist/src/scales/scaleResolutionConstants.d.ts.map +1 -0
  108. package/dist/src/scales/scaleResolutionConstants.js +5 -0
  109. package/dist/src/scales/scaleRules.d.ts +16 -0
  110. package/dist/src/scales/scaleRules.d.ts.map +1 -0
  111. package/dist/src/scales/scaleRules.js +103 -0
  112. package/dist/src/scales/scaleRules.test.d.ts +2 -0
  113. package/dist/src/scales/scaleRules.test.d.ts.map +1 -0
  114. package/dist/src/spec/channel.d.ts +13 -18
  115. package/dist/src/spec/scale.d.ts +6 -0
  116. package/dist/src/types/embedApi.d.ts +5 -0
  117. package/dist/src/types/scaleResolutionApi.d.ts +1 -1
  118. package/dist/src/view/concatView.d.ts +18 -0
  119. package/dist/src/view/concatView.d.ts.map +1 -1
  120. package/dist/src/view/concatView.js +73 -0
  121. package/dist/src/view/concatView.test.d.ts +2 -0
  122. package/dist/src/view/concatView.test.d.ts.map +1 -0
  123. package/dist/src/view/containerMutationHelper.d.ts +74 -0
  124. package/dist/src/view/containerMutationHelper.d.ts.map +1 -0
  125. package/dist/src/view/containerMutationHelper.js +114 -0
  126. package/dist/src/view/containerView.d.ts +0 -7
  127. package/dist/src/view/containerView.d.ts.map +1 -1
  128. package/dist/src/view/containerView.js +0 -10
  129. package/dist/src/view/facetView.d.ts.map +1 -1
  130. package/dist/src/view/facetView.js +0 -15
  131. package/dist/src/view/gridView/gridChild.d.ts +11 -0
  132. package/dist/src/view/gridView/gridChild.d.ts.map +1 -1
  133. package/dist/src/view/gridView/gridChild.js +32 -6
  134. package/dist/src/view/gridView/gridView.d.ts +39 -1
  135. package/dist/src/view/gridView/gridView.d.ts.map +1 -1
  136. package/dist/src/view/gridView/gridView.js +106 -48
  137. package/dist/src/view/gridView/gridView.test.d.ts +2 -0
  138. package/dist/src/view/gridView/gridView.test.d.ts.map +1 -0
  139. package/dist/src/view/gridView/scrollbar.d.ts +39 -8
  140. package/dist/src/view/gridView/scrollbar.d.ts.map +1 -1
  141. package/dist/src/view/gridView/scrollbar.js +184 -69
  142. package/dist/src/view/layerView.d.ts +14 -0
  143. package/dist/src/view/layerView.d.ts.map +1 -1
  144. package/dist/src/view/layerView.js +66 -0
  145. package/dist/src/view/layerView.test.d.ts +2 -0
  146. package/dist/src/view/layerView.test.d.ts.map +1 -0
  147. package/dist/src/view/testUtils.d.ts.map +1 -1
  148. package/dist/src/view/testUtils.js +2 -1
  149. package/dist/src/view/unitView.d.ts.map +1 -1
  150. package/dist/src/view/unitView.js +24 -34
  151. package/dist/src/view/view.d.ts +6 -6
  152. package/dist/src/view/view.d.ts.map +1 -1
  153. package/dist/src/view/view.js +4 -4
  154. package/package.json +2 -2
  155. package/dist/bundle/browser-txUcLy2H.js +0 -123
  156. package/dist/bundle/index-BQpbYrv4.js +0 -1712
  157. package/dist/bundle/index-BhtHKLUo.js +0 -73
  158. package/dist/bundle/index-CCe8rnZz.js +0 -716
  159. package/dist/bundle/index-DhcU-Gk-.js +0 -1487
  160. package/dist/src/data/collector.test.js +0 -138
  161. package/dist/src/data/dataFlow.test.js +0 -38
  162. package/dist/src/data/flow.test.js +0 -81
  163. package/dist/src/data/flowInit.test.js +0 -413
  164. package/dist/src/data/flowNode.test.js +0 -50
  165. package/dist/src/data/flowOptimizer.test.js +0 -209
  166. package/dist/src/data/formats/fasta.test.js +0 -27
  167. package/dist/src/data/sources/inlineSource.test.js +0 -63
  168. package/dist/src/data/sources/sequenceSource.test.js +0 -81
  169. package/dist/src/data/transforms/aggregate.test.js +0 -134
  170. package/dist/src/data/transforms/clone.test.js +0 -11
  171. package/dist/src/data/transforms/coverage.test.js +0 -238
  172. package/dist/src/data/transforms/filter.test.js +0 -20
  173. package/dist/src/data/transforms/flatten.test.js +0 -96
  174. package/dist/src/data/transforms/flattenDelimited.test.js +0 -90
  175. package/dist/src/data/transforms/flattenSequence.test.js +0 -34
  176. package/dist/src/data/transforms/formula.test.js +0 -25
  177. package/dist/src/data/transforms/identifier.test.js +0 -92
  178. package/dist/src/data/transforms/pileup.test.js +0 -70
  179. package/dist/src/data/transforms/project.test.js +0 -32
  180. package/dist/src/data/transforms/regexExtract.test.js +0 -70
  181. package/dist/src/data/transforms/regexFold.test.js +0 -201
  182. package/dist/src/data/transforms/sample.test.js +0 -38
  183. package/dist/src/data/transforms/stack.test.js +0 -91
  184. package/dist/src/encoder/accessor.test.js +0 -162
  185. package/dist/src/encoder/encoder.test.js +0 -105
  186. package/dist/src/genome/genome.test.js +0 -268
  187. package/dist/src/genome/genomes.test.js +0 -8
  188. package/dist/src/genome/scaleIndex.test.js +0 -78
  189. package/dist/src/genome/scaleLocus.test.js +0 -4
  190. package/dist/src/scale/scale.test.js +0 -326
  191. package/dist/src/scale/ticks.test.js +0 -46
  192. package/dist/src/selection/selection.test.js +0 -14
  193. package/dist/src/utils/addBaseUrl.test.js +0 -30
  194. package/dist/src/utils/binnedIndex.test.js +0 -201
  195. package/dist/src/utils/cloner.test.js +0 -35
  196. package/dist/src/utils/coalesce.test.js +0 -16
  197. package/dist/src/utils/concatIterables.test.js +0 -8
  198. package/dist/src/utils/domainArray.test.js +0 -130
  199. package/dist/src/utils/indexer.test.js +0 -49
  200. package/dist/src/utils/interactionEvent.test.js +0 -35
  201. package/dist/src/utils/iterateNestedMaps.test.js +0 -33
  202. package/dist/src/utils/kWayMerge.test.js +0 -30
  203. package/dist/src/utils/mergeObjects.test.js +0 -42
  204. package/dist/src/utils/numberExtractor.test.js +0 -6
  205. package/dist/src/utils/propertyCacher.test.js +0 -89
  206. package/dist/src/utils/propertyCoalescer.test.js +0 -25
  207. package/dist/src/utils/radixSort.test.js +0 -51
  208. package/dist/src/utils/reservationMap.test.js +0 -20
  209. package/dist/src/utils/ringBuffer.test.js +0 -39
  210. package/dist/src/utils/topK.test.js +0 -54
  211. package/dist/src/utils/trees.test.js +0 -135
  212. package/dist/src/utils/url.test.js +0 -28
  213. package/dist/src/utils/variableTools.test.js +0 -13
  214. package/dist/src/view/axisResolution.d.ts.map +0 -1
  215. package/dist/src/view/axisResolution.test.d.ts.map +0 -1
  216. package/dist/src/view/axisResolution.test.js +0 -206
  217. package/dist/src/view/flowBuilder.test.js +0 -125
  218. package/dist/src/view/gridView/selectionRect.test.js +0 -87
  219. package/dist/src/view/layout/flexLayout.test.js +0 -323
  220. package/dist/src/view/layout/grid.test.js +0 -71
  221. package/dist/src/view/layout/rectangle.test.js +0 -192
  222. package/dist/src/view/paramMediator.test.js +0 -282
  223. package/dist/src/view/scaleResolution.d.ts.map +0 -1
  224. package/dist/src/view/scaleResolution.js +0 -1059
  225. package/dist/src/view/scaleResolution.test.d.ts.map +0 -1
  226. package/dist/src/view/scaleResolution.test.js +0 -645
  227. package/dist/src/view/view.test.js +0 -245
  228. package/dist/src/view/viewDispose.test.js +0 -110
  229. package/dist/src/view/viewFactory.test.js +0 -25
  230. package/dist/src/view/viewUtils.test.js +0 -87
  231. /package/dist/src/{view → scales}/axisResolution.test.d.ts +0 -0
  232. /package/dist/src/{view → scales}/scaleResolution.test.d.ts +0 -0
@@ -0,0 +1,138 @@
1
+ class f {
2
+ constructor(e) {
3
+ this.blob = e;
4
+ }
5
+ async read(e, r = 0) {
6
+ if (!e)
7
+ return new Uint8Array(0);
8
+ const s = r, n = s + e, a = this.blob.slice(s, n);
9
+ return a.bytes ? a.bytes() : new Uint8Array(await a.arrayBuffer());
10
+ }
11
+ async readFile(e) {
12
+ const r = typeof e == "string" ? e : e == null ? void 0 : e.encoding;
13
+ if (r === "utf8")
14
+ return this.blob.text();
15
+ if (r)
16
+ throw new Error(`unsupported encoding: ${r}`);
17
+ return this.blob.bytes ? this.blob.bytes() : new Uint8Array(await this.blob.arrayBuffer());
18
+ }
19
+ async stat() {
20
+ return { size: this.blob.size };
21
+ }
22
+ async close() {
23
+ }
24
+ }
25
+ function d(i) {
26
+ return (typeof i == "object" && i !== null && "message" in i ? i.message : `${i}`).replace(/\.$/, "");
27
+ }
28
+ class u {
29
+ constructor(e, r = {}) {
30
+ this.baseOverrides = {}, this.url = e;
31
+ const s = r.fetch || globalThis.fetch.bind(globalThis);
32
+ r.overrides && (this.baseOverrides = r.overrides), this.fetchImplementation = s;
33
+ }
34
+ async fetch(e, r) {
35
+ const s = (a) => new Error(`${d(a)} fetching ${e}`, { cause: a });
36
+ let n;
37
+ try {
38
+ n = await this.fetchImplementation(e, r);
39
+ } catch (a) {
40
+ if (`${a}`.includes("Failed to fetch")) {
41
+ console.warn(`generic-filehandle: refetching ${e} to attempt to work around chrome CORS header caching bug`);
42
+ try {
43
+ n = await this.fetchImplementation(e, {
44
+ ...r,
45
+ cache: "reload"
46
+ });
47
+ } catch (c) {
48
+ throw s(c);
49
+ }
50
+ } else
51
+ throw s(a);
52
+ }
53
+ return n;
54
+ }
55
+ async read(e, r, s = {}) {
56
+ if (e === 0)
57
+ return new Uint8Array(0);
58
+ const { headers: n = {}, signal: a, overrides: c = {} } = s;
59
+ e < 1 / 0 ? n.range = `bytes=${r}-${r + e - 1}` : e === 1 / 0 && r !== 0 && (n.range = `bytes=${r}-`);
60
+ const t = await this.fetch(this.url, {
61
+ ...this.baseOverrides,
62
+ ...c,
63
+ headers: {
64
+ ...this.baseOverrides.headers,
65
+ ...c.headers,
66
+ ...n
67
+ },
68
+ method: "GET",
69
+ redirect: "follow",
70
+ mode: "cors",
71
+ signal: a
72
+ });
73
+ if (!t.ok)
74
+ throw new Error(`HTTP ${t.status} fetching ${this.url}`);
75
+ if (t.status === 200 && r === 0 || t.status === 206) {
76
+ const l = t.headers.get("content-range"), o = /\/(\d+)$/.exec(l || "");
77
+ o != null && o[1] && (this._stat = {
78
+ size: parseInt(o[1], 10)
79
+ });
80
+ const h = t.bytes ? await t.bytes() : new Uint8Array(await t.arrayBuffer());
81
+ return h.byteLength <= e ? h : h.subarray(0, e);
82
+ }
83
+ throw new Error(t.status === 200 ? `${this.url} fetch returned status 200, expected 206` : `HTTP ${t.status} fetching ${this.url}`);
84
+ }
85
+ async readFile(e = {}) {
86
+ let r, s;
87
+ if (typeof e == "string")
88
+ r = e, s = {};
89
+ else {
90
+ r = e.encoding;
91
+ const { encoding: l, ...o } = e;
92
+ s = o;
93
+ }
94
+ const { headers: n = {}, signal: a, overrides: c = {} } = s, t = await this.fetch(this.url, {
95
+ ...this.baseOverrides,
96
+ ...c,
97
+ headers: {
98
+ ...this.baseOverrides.headers,
99
+ ...c.headers,
100
+ ...n
101
+ },
102
+ method: "GET",
103
+ redirect: "follow",
104
+ mode: "cors",
105
+ signal: a
106
+ });
107
+ if (!t.ok)
108
+ throw new Error(`HTTP ${t.status} fetching ${this.url}`);
109
+ if (r === "utf8")
110
+ return t.text();
111
+ if (r)
112
+ throw new Error(`unsupported encoding: ${r}`);
113
+ return t.bytes ? t.bytes() : new Uint8Array(await t.arrayBuffer());
114
+ }
115
+ async stat() {
116
+ if (!this._stat && (await this.read(10, 0), !this._stat))
117
+ throw new Error(`unable to determine size of file at ${this.url}`);
118
+ return this._stat;
119
+ }
120
+ async close() {
121
+ }
122
+ }
123
+ class w {
124
+ readFile() {
125
+ throw new Error("unimplemented");
126
+ }
127
+ read() {
128
+ throw new Error("unimplemented");
129
+ }
130
+ close() {
131
+ throw new Error("unimplemented");
132
+ }
133
+ }
134
+ export {
135
+ f as BlobFile,
136
+ w as LocalFile,
137
+ u as RemoteFile
138
+ };
@@ -1,8 +1,8 @@
1
1
  var _ = Object.defineProperty;
2
2
  var I = (r, e, t) => e in r ? _(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
3
3
  var h = (r, e, t) => I(r, typeof e != "symbol" ? e + "" : e, t);
4
- import { LocalFile as d } from "./browser-txUcLy2H.js";
5
- import { I as b, Z as F } from "./inflate-DRgHi_KK.js";
4
+ import { LocalFile as d } from "./browser-BRemItdO.js";
5
+ import { I as b, Z as F } from "./inflate-GtwLkvSP.js";
6
6
  const w = 65536, S = w * w;
7
7
  function g(r, e = 0) {
8
8
  const t = r[e] | r[e + 1] << 8 | r[e + 2] << 16 | r[e + 3] << 24;
@@ -30,7 +30,7 @@ class B {
30
30
  return [[0, 0]];
31
31
  const n = new Array(t + 1);
32
32
  n[0] = [0, 0];
33
- const s = 8 * 2 * t;
33
+ const s = 16 * t;
34
34
  if (s > Number.MAX_SAFE_INTEGER)
35
35
  throw new TypeError("integer overflow");
36
36
  const i = await this.filehandle.read(s, 8);
@@ -58,20 +58,20 @@ class B {
58
58
  return i[i.length - 1][u] < n && i.push([]), i;
59
59
  }
60
60
  }
61
- function k(r) {
61
+ function E(r) {
62
62
  let e = 0;
63
63
  for (const t of r)
64
64
  e += t.length;
65
65
  return e;
66
66
  }
67
- function x(r, e) {
68
- const t = new Uint8Array(e ?? k(r));
67
+ function y(r, e) {
68
+ const t = new Uint8Array(e ?? E(r));
69
69
  let n = 0;
70
70
  for (const s of r)
71
71
  t.set(s, n), n += s.length;
72
72
  return t;
73
73
  }
74
- async function E(r) {
74
+ async function k(r) {
75
75
  try {
76
76
  let e, t = 0, n;
77
77
  const s = [];
@@ -84,7 +84,7 @@ async function E(r) {
84
84
  const o = n.result;
85
85
  s.push(o), i += o.length;
86
86
  } while (e.avail_in);
87
- return x(s, i);
87
+ return y(s, i);
88
88
  } catch (e) {
89
89
  throw /incorrect header check/.exec(`${e}`) ? new Error("problem decompressing block: incorrect gzip header check") : e;
90
90
  }
@@ -101,7 +101,7 @@ class p {
101
101
  let n = t;
102
102
  n || (n = (await this.filehandle.stat()).size);
103
103
  const s = n - e, i = await this.filehandle.read(s, e);
104
- return E(i);
104
+ return k(i);
105
105
  }
106
106
  async read(e, t) {
107
107
  const n = await this.gzi.getRelevantBlocksForRead(e, t), s = [];
@@ -109,13 +109,13 @@ class p {
109
109
  const a = await this._readAndUncompressBlock(n[i][0], n[i + 1][0]), [, o] = n[i], c = o >= t ? 0 : t - o, l = Math.min(t + e, o + a.length) - o;
110
110
  c >= 0 && c < a.length && s.push(a.subarray(c, l));
111
111
  }
112
- return x(s);
112
+ return y(s);
113
113
  }
114
114
  }
115
- function y(r, e) {
115
+ function x(r, e) {
116
116
  return r.offset + r.lineBytes * Math.floor(e / r.lineLength) + e % r.lineLength;
117
117
  }
118
- async function N(r, e = {}) {
118
+ async function z(r, e = {}) {
119
119
  const t = new TextDecoder("utf8");
120
120
  return Object.fromEntries(t.decode(await r.readFile(e)).split(/\r?\n/).map((n) => n.trim()).filter((n) => !!n).map((n) => n.split(" ")).map((n) => {
121
121
  var s;
@@ -135,7 +135,7 @@ async function N(r, e = {}) {
135
135
  ];
136
136
  }));
137
137
  }
138
- class A {
138
+ class N {
139
139
  constructor({ fasta: e, fai: t, path: n, faiPath: s }) {
140
140
  if (e)
141
141
  this.fasta = e;
@@ -153,7 +153,7 @@ class A {
153
153
  throw new Error("Need to pass filehandle for or path to localfile");
154
154
  }
155
155
  async _getIndexes(e) {
156
- return this.indexes || (this.indexes = N(this.fai, e).catch((t) => {
156
+ return this.indexes || (this.indexes = z(this.fai, e).catch((t) => {
157
157
  throw this.indexes = void 0, t;
158
158
  })), this.indexes;
159
159
  }
@@ -212,11 +212,13 @@ class A {
212
212
  throw new TypeError("regionStart cannot be less than 0");
213
213
  if ((i === void 0 || i > e.length) && (i = e.length), t >= i)
214
214
  return "";
215
- const a = y(e, t), o = y(e, i) - a;
216
- return new TextDecoder("utf8").decode(await this.fasta.read(o, a, s)).replace(/\s+/g, "");
215
+ const a = x(e, t), o = x(e, i) - a, l = new TextDecoder("utf8").decode(await this.fasta.read(o, a, s)).replace(/\s+/g, "");
216
+ if (/[^\x20-\x7e]/.test(l.slice(0, 1e3)))
217
+ throw new Error("Non-ASCII characters detected in sequence. The file may be gzip compressed. Use BgzipIndexedFasta for bgzip files, or decompress the file.");
218
+ return l;
217
219
  }
218
220
  }
219
- class O extends A {
221
+ class O extends N {
220
222
  constructor({ fasta: e, path: t, fai: n, faiPath: s, gzi: i, gziPath: a }) {
221
223
  super({ fasta: e, path: t, fai: n, faiPath: s }), e && i ? this.fasta = new p({
222
224
  filehandle: e,
@@ -227,7 +229,7 @@ class O extends A {
227
229
  }));
228
230
  }
229
231
  }
230
- function z(r) {
232
+ function A(r) {
231
233
  return r.split(">").filter((e) => /\S/.test(e)).map((e) => {
232
234
  const [t, ...n] = e.split(`
233
235
  `), [s, ...i] = t.split(" "), a = n.join("").replace(/\s/g, "");
@@ -248,7 +250,7 @@ class R {
248
250
  throw new Error("Need to pass fasta or path");
249
251
  this.data = this.fasta.readFile().then((n) => {
250
252
  const i = new TextDecoder("utf8").decode(n);
251
- return z(i);
253
+ return A(i);
252
254
  });
253
255
  }
254
256
  async fetch(e, t, n) {
@@ -264,6 +266,6 @@ class R {
264
266
  export {
265
267
  O as BgzipIndexedFasta,
266
268
  R as FetchableSmallFasta,
267
- A as IndexedFasta,
268
- z as parseSmallFasta
269
+ N as IndexedFasta,
270
+ A as parseSmallFasta
269
271
  };
@@ -1,11 +1,11 @@
1
1
  var v = Object.defineProperty;
2
- var R = (n, e, t) => e in n ? v(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
3
- var a = (n, e, t) => R(n, typeof e != "symbol" ? e + "" : e, t);
4
- const k = /%([0-9A-Fa-f]{2})/g, y = /^\s*##\s*(\S+)\s*(.*)/, g = /\r?\n$/, _ = /\s+/, b = /\D/g;
5
- function m(n) {
6
- return n.includes("%") ? n.replaceAll(k, (e, t) => String.fromCharCode(parseInt(t, 16))) : n;
2
+ var F = (n, e, t) => e in n ? v(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
3
+ var f = (n, e, t) => F(n, typeof e != "symbol" ? e + "" : e, t);
4
+ const y = /%([0-9A-Fa-f]{2})/g, R = /^\s*##\s*(\S+)\s*(.*)/, g = /\r?\n$/, b = /\s+/, C = /\D/g;
5
+ function p(n) {
6
+ return n.includes("%") ? n.replaceAll(y, (e, t) => String.fromCharCode(parseInt(t, 16))) : n;
7
7
  }
8
- function F(n) {
8
+ function k(n) {
9
9
  if (!n.length || n === ".")
10
10
  return {};
11
11
  const e = {};
@@ -20,78 +20,115 @@ function F(n) {
20
20
  const c = r.slice(s + 1);
21
21
  if (!c.length)
22
22
  continue;
23
- const o = r.slice(0, s).trim();
24
- let i = e[o];
25
- i || (i = [], e[o] = i);
23
+ const i = r.slice(0, s).trim();
24
+ let o = e[i];
25
+ o || (o = [], e[i] = o);
26
26
  for (const l of c.split(","))
27
- i.push(m(l.trim()));
27
+ o.push(p(l.trim()));
28
28
  }
29
29
  return e;
30
30
  }
31
31
  function I(n) {
32
- return C(n.split(" "));
32
+ if (!n.length || n === ".")
33
+ return {};
34
+ const e = {};
35
+ let t = n;
36
+ t.endsWith(`
37
+ `) && (t = t.slice(0, t.endsWith(`\r
38
+ `) ? -2 : -1));
39
+ for (const r of t.split(";")) {
40
+ const s = r.indexOf("=");
41
+ if (s === -1)
42
+ continue;
43
+ const c = r.slice(s + 1);
44
+ if (!c.length)
45
+ continue;
46
+ const i = r.slice(0, s).trim();
47
+ let o = e[i];
48
+ o || (o = [], e[i] = o);
49
+ for (const l of c.split(","))
50
+ o.push(l.trim());
51
+ }
52
+ return e;
53
+ }
54
+ function L(n) {
55
+ return _(n.split(" "));
33
56
  }
34
- function f(n) {
57
+ function a(n) {
35
58
  return n === "." || n === "" || n === void 0 ? null : n;
36
59
  }
37
- function C(n) {
38
- const e = f(n[0]), t = f(n[1]), r = f(n[2]), s = f(n[3]), c = f(n[4]), o = f(n[5]), i = f(n[6]), l = f(n[7]), u = f(n[8]);
60
+ function _(n) {
61
+ const e = a(n[0]), t = a(n[1]), r = a(n[2]), s = a(n[3]), c = a(n[4]), i = a(n[5]), o = a(n[6]), l = a(n[7]), u = a(n[8]);
39
62
  return {
40
- seq_id: e ? m(e) : null,
41
- source: t ? m(t) : null,
42
- type: r ? m(r) : null,
63
+ seq_id: e ? p(e) : null,
64
+ source: t ? p(t) : null,
65
+ type: r ? p(r) : null,
43
66
  start: s === null ? null : parseInt(s, 10),
44
67
  end: c === null ? null : parseInt(c, 10),
45
- score: o === null ? null : parseFloat(o),
46
- strand: i,
68
+ score: i === null ? null : parseFloat(i),
69
+ strand: o,
47
70
  phase: l,
48
- attributes: u === null ? null : F(u)
71
+ attributes: u === null ? null : k(u)
49
72
  };
50
73
  }
51
- function L(n) {
52
- var c, o;
53
- const e = y.exec(n);
74
+ function D(n) {
75
+ const e = a(n[0]), t = a(n[1]), r = a(n[2]), s = a(n[3]), c = a(n[4]), i = a(n[5]), o = a(n[6]), l = a(n[7]), u = a(n[8]);
76
+ return {
77
+ seq_id: e,
78
+ source: t,
79
+ type: r,
80
+ start: s === null ? null : parseInt(s, 10),
81
+ end: c === null ? null : parseInt(c, 10),
82
+ score: i === null ? null : parseFloat(i),
83
+ strand: o,
84
+ phase: l,
85
+ attributes: u === null ? null : I(u)
86
+ };
87
+ }
88
+ function A(n) {
89
+ var c, i;
90
+ const e = R.exec(n);
54
91
  if (!e)
55
92
  return null;
56
93
  const [, t] = e;
57
94
  let [, , r] = e;
58
95
  const s = { directive: t };
59
96
  if (r.length && (r = r.replace(g, ""), s.value = r), t === "sequence-region") {
60
- const i = r.split(_, 3);
97
+ const o = r.split(b, 3);
61
98
  return {
62
99
  ...s,
63
- seq_id: i[0],
64
- start: (c = i[1]) == null ? void 0 : c.replaceAll(b, ""),
65
- end: (o = i[2]) == null ? void 0 : o.replaceAll(b, "")
100
+ seq_id: o[0],
101
+ start: (c = o[1]) == null ? void 0 : c.replaceAll(C, ""),
102
+ end: (i = o[2]) == null ? void 0 : i.replaceAll(C, "")
66
103
  };
67
104
  } else if (t === "genome-build") {
68
- const [i, l] = r.split(_, 2);
105
+ const [o, l] = r.split(b, 2);
69
106
  return {
70
107
  ...s,
71
- source: i,
108
+ source: o,
72
109
  buildName: l
73
110
  };
74
111
  }
75
112
  return s;
76
113
  }
77
- const D = /^\s*[^#\s>]/, A = /^\s*(#+)(.*)/, x = /^\s*$/, S = /^\s*>/, w = /\r?\n?$/g;
78
- class p {
114
+ const x = /^\s*[^#\s>]/, w = /^\s*(#+)(.*)/, S = /^\s*$/, E = /^\s*>/, P = /\r?\n?$/g;
115
+ class m {
79
116
  constructor(e) {
80
- a(this, "featureCallback");
81
- a(this, "endCallback");
82
- a(this, "commentCallback");
83
- a(this, "errorCallback");
84
- a(this, "disableDerivesFromReferences");
85
- a(this, "directiveCallback");
86
- a(this, "bufferSize");
87
- a(this, "eof", !1);
88
- a(this, "lineNumber", 0);
117
+ f(this, "featureCallback");
118
+ f(this, "endCallback");
119
+ f(this, "commentCallback");
120
+ f(this, "errorCallback");
121
+ f(this, "disableDerivesFromReferences");
122
+ f(this, "directiveCallback");
123
+ f(this, "bufferSize");
124
+ f(this, "eof", !1);
125
+ f(this, "lineNumber", 0);
89
126
  // features that we have to keep on hand for now because they
90
127
  // might be referenced by something else
91
- a(this, "_underConstructionTopLevel", []);
128
+ f(this, "_underConstructionTopLevel", []);
92
129
  // index of the above by ID
93
- a(this, "_underConstructionById", {});
94
- a(this, "_completedReferences", {});
130
+ f(this, "_underConstructionById", {});
131
+ f(this, "_completedReferences", {});
95
132
  // features that reference something we have not seen yet
96
133
  // structured as:
97
134
  // { 'some_id' : {
@@ -99,7 +136,7 @@ class p {
99
136
  // 'Derives_from' : [ orphans that have a Derives_from attr referencing it ],
100
137
  // }
101
138
  // }
102
- a(this, "_underConstructionOrphans", {});
139
+ f(this, "_underConstructionOrphans", {});
103
140
  const t = () => {
104
141
  };
105
142
  this.featureCallback = e.featureCallback || t, this.endCallback = e.endCallback || t, this.commentCallback = e.commentCallback || t, this.errorCallback = e.errorCallback || t, this.directiveCallback = e.directiveCallback || t, this.disableDerivesFromReferences = e.disableDerivesFromReferences || !1, this.bufferSize = e.bufferSize === void 0 ? 1 / 0 : e.bufferSize;
@@ -107,25 +144,25 @@ class p {
107
144
  addLine(e) {
108
145
  if (this.eof)
109
146
  return;
110
- if (this.lineNumber += 1, D.test(e)) {
147
+ if (this.lineNumber += 1, x.test(e)) {
111
148
  this._bufferLine(e);
112
149
  return;
113
150
  }
114
- const t = A.exec(e);
151
+ const t = w.exec(e);
115
152
  if (t) {
116
153
  const [, r] = t;
117
154
  let [, , s] = t;
118
155
  if (r.length === 3)
119
156
  this._emitAllUnderConstructionFeatures();
120
157
  else if (r.length === 2) {
121
- const c = L(e);
158
+ const c = A(e);
122
159
  c && (c.directive === "FASTA" ? (this._emitAllUnderConstructionFeatures(), this.eof = !0) : this._emitItem(c));
123
160
  } else
124
161
  this._emitItem({ comment: s.trimStart() });
125
- } else if (!x.test(e)) if (S.test(e))
162
+ } else if (!S.test(e)) if (E.test(e))
126
163
  this._emitAllUnderConstructionFeatures(), this.eof = !0;
127
164
  else {
128
- const r = e.replaceAll(w, "");
165
+ const r = e.replaceAll(P, "");
129
166
  throw new Error(`GFF3 parse error. Cannot parse '${r}'.`);
130
167
  }
131
168
  }
@@ -141,12 +178,12 @@ class p {
141
178
  _enforceBufferSizeLimit(e = 0) {
142
179
  const t = (r) => {
143
180
  var s, c;
144
- r && Array.isArray(r) && ((c = (s = r[0].attributes) == null ? void 0 : s.ID) != null && c[0]) && (r[0].attributes.ID.forEach((i) => {
145
- delete this._underConstructionById[i], delete this._completedReferences[i];
146
- }), r.forEach((i) => {
147
- i.child_features && i.child_features.forEach((l) => {
181
+ r && Array.isArray(r) && ((c = (s = r[0].attributes) == null ? void 0 : s.ID) != null && c[0]) && (r[0].attributes.ID.forEach((o) => {
182
+ delete this._underConstructionById[o], delete this._completedReferences[o];
183
+ }), r.forEach((o) => {
184
+ o.child_features && o.child_features.forEach((l) => {
148
185
  t(l);
149
- }), i.derived_features && i.derived_features.forEach((l) => {
186
+ }), o.derived_features && o.derived_features.forEach((l) => {
150
187
  t(l);
151
188
  });
152
189
  }));
@@ -167,24 +204,24 @@ class p {
167
204
  throw new Error(`some features reference other features that do not exist in the file (or in the same '###' scope). ${e.join(",")}`);
168
205
  }
169
206
  _bufferLine(e) {
170
- this._bufferParsedLine(I(e));
207
+ this._bufferParsedLine(L(e));
171
208
  }
172
209
  _bufferParsedLine(e) {
173
- var i, l, u;
210
+ var o, l, u;
174
211
  const t = e;
175
212
  t.child_features = [], t.derived_features = [];
176
- const r = ((i = t.attributes) == null ? void 0 : i.ID) || [], s = ((l = t.attributes) == null ? void 0 : l.Parent) || [], c = this.disableDerivesFromReferences ? [] : ((u = t.attributes) == null ? void 0 : u.Derives_from) || [];
213
+ const r = ((o = t.attributes) == null ? void 0 : o.ID) || [], s = ((l = t.attributes) == null ? void 0 : l.Parent) || [], c = this.disableDerivesFromReferences ? [] : ((u = t.attributes) == null ? void 0 : u.Derives_from) || [];
177
214
  if (!r.length && !s.length && !c.length) {
178
215
  this._emitItem([t]);
179
216
  return;
180
217
  }
181
- let o;
218
+ let i;
182
219
  r.forEach((d) => {
183
220
  const h = this._underConstructionById[d];
184
- h ? (h[h.length - 1].type !== t.type && this._parseError(`multi-line feature "${d}" has inconsistent types: "${t.type}", "${h[h.length - 1].type}"`), h.push(t), o = h) : (o = [t], this._enforceBufferSizeLimit(1), !s.length && !c.length && this._underConstructionTopLevel.push(o), this._underConstructionById[d] = o, this._resolveReferencesTo(o, d));
221
+ h ? (h[h.length - 1].type !== t.type && this._parseError(`multi-line feature "${d}" has inconsistent types: "${t.type}", "${h[h.length - 1].type}"`), h.push(t), i = h) : (i = [t], this._enforceBufferSizeLimit(1), !s.length && !c.length && this._underConstructionTopLevel.push(i), this._underConstructionById[d] = i, this._resolveReferencesTo(i, d));
185
222
  }), this._resolveReferencesFrom(
186
223
  // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
187
- o || [t],
224
+ i || [t],
188
225
  { Parent: s, Derives_from: c },
189
226
  r
190
227
  );
@@ -204,39 +241,39 @@ class p {
204
241
  for (const s of t.Parent) {
205
242
  const c = this._underConstructionById[s];
206
243
  if (c) {
207
- let o = !1;
208
- for (const i of r) {
209
- const l = `Parent,${s}`, u = this._completedReferences[i] || (this._completedReferences[i] = {});
210
- u[l] && (o = !0), u[l] = !0;
244
+ let i = !1;
245
+ for (const o of r) {
246
+ const l = `Parent,${s}`, u = this._completedReferences[o] || (this._completedReferences[o] = {});
247
+ u[l] && (i = !0), u[l] = !0;
211
248
  }
212
- if (!o)
213
- for (const i of c)
214
- i.child_features.push(e);
249
+ if (!i)
250
+ for (const o of c)
251
+ o.child_features.push(e);
215
252
  } else {
216
- let o = this._underConstructionOrphans[s];
217
- o || (o = { Parent: [], Derives_from: [] }, this._underConstructionOrphans[s] = o), o.Parent.push(e);
253
+ let i = this._underConstructionOrphans[s];
254
+ i || (i = { Parent: [], Derives_from: [] }, this._underConstructionOrphans[s] = i), i.Parent.push(e);
218
255
  }
219
256
  }
220
257
  for (const s of t.Derives_from) {
221
258
  const c = this._underConstructionById[s];
222
259
  if (c) {
223
- let o = !1;
224
- for (const i of r) {
225
- const l = `Derives_from,${s}`, u = this._completedReferences[i] || (this._completedReferences[i] = {});
226
- u[l] && (o = !0), u[l] = !0;
260
+ let i = !1;
261
+ for (const o of r) {
262
+ const l = `Derives_from,${s}`, u = this._completedReferences[o] || (this._completedReferences[o] = {});
263
+ u[l] && (i = !0), u[l] = !0;
227
264
  }
228
- if (!o)
229
- for (const i of c)
230
- i.derived_features.push(e);
265
+ if (!i)
266
+ for (const o of c)
267
+ o.derived_features.push(e);
231
268
  } else {
232
- let o = this._underConstructionOrphans[s];
233
- o || (o = { Parent: [], Derives_from: [] }, this._underConstructionOrphans[s] = o), o.Derives_from.push(e);
269
+ let i = this._underConstructionOrphans[s];
270
+ i || (i = { Parent: [], Derives_from: [] }, this._underConstructionOrphans[s] = i), i.Derives_from.push(e);
234
271
  }
235
272
  }
236
273
  }
237
274
  }
238
- function P(n) {
239
- const e = [], t = new p({
275
+ function $(n) {
276
+ const e = [], t = new m({
240
277
  featureCallback: (r) => e.push(r),
241
278
  disableDerivesFromReferences: !0,
242
279
  errorCallback: (r) => {
@@ -247,8 +284,8 @@ function P(n) {
247
284
  t.addLine(r);
248
285
  return t.finish(), e;
249
286
  }
250
- function $(n) {
251
- const e = [], t = new p({
287
+ function B(n) {
288
+ const e = [], t = new m({
252
289
  featureCallback: (r) => e.push(r),
253
290
  disableDerivesFromReferences: !0,
254
291
  errorCallback: (r) => {
@@ -259,8 +296,8 @@ function $(n) {
259
296
  t.addLine(r);
260
297
  return t.finish(), e;
261
298
  }
262
- function O(n) {
263
- const e = [], t = new p({
299
+ function T(n) {
300
+ const e = [], t = new m({
264
301
  featureCallback: (r) => e.push(r),
265
302
  disableDerivesFromReferences: !0,
266
303
  errorCallback: (r) => {
@@ -268,13 +305,28 @@ function O(n) {
268
305
  }
269
306
  });
270
307
  for (const r of n) {
271
- const s = C(r.fields);
308
+ const s = _(r.fields);
272
309
  r.lineHash !== void 0 && (s.attributes || (s.attributes = {}), s.attributes._lineHash = [String(r.lineHash)]), t.addParsedFeatureLine(s);
273
310
  }
274
311
  return t.finish(), e;
275
312
  }
313
+ function q(n, e) {
314
+ const t = [], r = new m({
315
+ featureCallback: (c) => t.push(c),
316
+ disableDerivesFromReferences: !0,
317
+ errorCallback: (c) => {
318
+ throw new Error(c);
319
+ }
320
+ }), s = e ? _ : D;
321
+ for (const c of n) {
322
+ const i = s(c.fields);
323
+ c.lineHash !== void 0 && (i.attributes || (i.attributes = {}), i.attributes._lineHash = [String(c.lineHash)]), r.addParsedFeatureLine(i);
324
+ }
325
+ return r.finish(), t;
326
+ }
276
327
  export {
277
- $ as parseArraySync,
278
- O as parseRecordsSync,
279
- P as parseStringSync
328
+ B as parseArraySync,
329
+ T as parseRecordsSync,
330
+ q as parseRecordsSyncFast,
331
+ $ as parseStringSync
280
332
  };