@genome-spy/core 0.65.0 → 0.67.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (249) 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 +15821 -14601
  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/flowHandle.d.ts +2 -0
  16. package/dist/src/data/flowHandle.d.ts.map +1 -1
  17. package/dist/src/data/flowHandle.js +1 -0
  18. package/dist/src/data/flowInit.d.ts +12 -4
  19. package/dist/src/data/flowInit.d.ts.map +1 -1
  20. package/dist/src/data/flowInit.js +115 -16
  21. package/dist/src/data/sources/lazy/axisTickSource.js +1 -1
  22. package/dist/src/data/sources/lazy/singleAxisLazySource.d.ts +1 -1
  23. package/dist/src/data/sources/lazy/singleAxisLazySource.d.ts.map +1 -1
  24. package/dist/src/data/sources/lazy/singleAxisLazySource.js +10 -3
  25. package/dist/src/data/sources/lazy/singleAxisWindowedSource.d.ts.map +1 -1
  26. package/dist/src/data/sources/lazy/singleAxisWindowedSource.js +5 -1
  27. package/dist/src/data/transforms/filterScoredLabels.d.ts +1 -1
  28. package/dist/src/data/transforms/filterScoredLabels.d.ts.map +1 -1
  29. package/dist/src/data/transforms/filterScoredLabels.js +1 -1
  30. package/dist/src/data/transforms/linearizeGenomicCoordinate.d.ts.map +1 -1
  31. package/dist/src/data/transforms/linearizeGenomicCoordinate.js +2 -1
  32. package/dist/src/encoder/encoder.d.ts +1 -1
  33. package/dist/src/encoder/encoder.d.ts.map +1 -1
  34. package/dist/src/encoder/encoder.js +1 -1
  35. package/dist/src/genome/scaleLocus.d.ts +39 -0
  36. package/dist/src/genome/scaleLocus.d.ts.map +1 -1
  37. package/dist/src/genome/scaleLocus.js +76 -0
  38. package/dist/src/genomeSpy/canvasExport.d.ts +19 -0
  39. package/dist/src/genomeSpy/canvasExport.d.ts.map +1 -0
  40. package/dist/src/genomeSpy/canvasExport.js +66 -0
  41. package/dist/src/genomeSpy/containerUi.d.ts +17 -0
  42. package/dist/src/genomeSpy/containerUi.d.ts.map +1 -0
  43. package/dist/src/genomeSpy/containerUi.js +78 -0
  44. package/dist/src/genomeSpy/eventListenerRegistry.d.ts +19 -0
  45. package/dist/src/genomeSpy/eventListenerRegistry.d.ts.map +1 -0
  46. package/dist/src/genomeSpy/eventListenerRegistry.js +38 -0
  47. package/dist/src/genomeSpy/inputBindingManager.d.ts +14 -0
  48. package/dist/src/genomeSpy/inputBindingManager.d.ts.map +1 -0
  49. package/dist/src/genomeSpy/inputBindingManager.js +63 -0
  50. package/dist/src/genomeSpy/interactionController.d.ts +40 -0
  51. package/dist/src/genomeSpy/interactionController.d.ts.map +1 -0
  52. package/dist/src/genomeSpy/interactionController.js +371 -0
  53. package/dist/src/genomeSpy/keyboardListenerManager.d.ts +10 -0
  54. package/dist/src/genomeSpy/keyboardListenerManager.d.ts.map +1 -0
  55. package/dist/src/genomeSpy/keyboardListenerManager.js +31 -0
  56. package/dist/src/genomeSpy/loadingIndicatorManager.d.ts +15 -0
  57. package/dist/src/genomeSpy/loadingIndicatorManager.d.ts.map +1 -0
  58. package/dist/src/genomeSpy/loadingIndicatorManager.js +92 -0
  59. package/dist/src/genomeSpy/renderCoordinator.d.ts +22 -0
  60. package/dist/src/genomeSpy/renderCoordinator.d.ts.map +1 -0
  61. package/dist/src/genomeSpy/renderCoordinator.js +118 -0
  62. package/dist/src/genomeSpy/viewContextFactory.d.ts +18 -0
  63. package/dist/src/genomeSpy/viewContextFactory.d.ts.map +1 -0
  64. package/dist/src/genomeSpy/viewContextFactory.js +79 -0
  65. package/dist/src/genomeSpy/viewDataInit.d.ts +22 -0
  66. package/dist/src/genomeSpy/viewDataInit.d.ts.map +1 -0
  67. package/dist/src/genomeSpy/viewDataInit.js +160 -0
  68. package/dist/src/genomeSpy/viewDataInit.test.d.ts +2 -0
  69. package/dist/src/genomeSpy/viewDataInit.test.d.ts.map +1 -0
  70. package/dist/src/genomeSpy/viewHierarchyConfig.d.ts +14 -0
  71. package/dist/src/genomeSpy/viewHierarchyConfig.d.ts.map +1 -0
  72. package/dist/src/genomeSpy/viewHierarchyConfig.js +24 -0
  73. package/dist/src/genomeSpy/viewHighlight.d.ts +5 -0
  74. package/dist/src/genomeSpy/viewHighlight.d.ts.map +1 -0
  75. package/dist/src/genomeSpy/viewHighlight.js +30 -0
  76. package/dist/src/genomeSpy.d.ts +17 -71
  77. package/dist/src/genomeSpy.d.ts.map +1 -1
  78. package/dist/src/genomeSpy.js +197 -741
  79. package/dist/src/gl/dataToVertices.d.ts.map +1 -1
  80. package/dist/src/gl/dataToVertices.js +16 -4
  81. package/dist/src/gl/glslScaleGenerator.d.ts +1 -1
  82. package/dist/src/gl/webGLHelper.d.ts +2 -2
  83. package/dist/src/gl/webGLHelper.d.ts.map +1 -1
  84. package/dist/src/gl/webGLHelper.js +4 -4
  85. package/dist/src/index.d.ts.map +1 -1
  86. package/dist/src/index.js +2 -12
  87. package/dist/src/marks/mark.d.ts.map +1 -1
  88. package/dist/src/marks/mark.js +4 -2
  89. package/dist/src/{view → scales}/axisResolution.d.ts +9 -16
  90. package/dist/src/scales/axisResolution.d.ts.map +1 -0
  91. package/dist/src/{view → scales}/axisResolution.js +29 -18
  92. package/dist/src/scales/axisResolution.test.d.ts.map +1 -0
  93. package/dist/src/scales/scaleDomainAggregator.d.ts +57 -0
  94. package/dist/src/scales/scaleDomainAggregator.d.ts.map +1 -0
  95. package/dist/src/scales/scaleDomainAggregator.js +167 -0
  96. package/dist/src/scales/scaleDomainAggregator.test.d.ts +2 -0
  97. package/dist/src/scales/scaleDomainAggregator.test.d.ts.map +1 -0
  98. package/dist/src/scales/scaleInstanceManager.d.ts +40 -0
  99. package/dist/src/scales/scaleInstanceManager.d.ts.map +1 -0
  100. package/dist/src/scales/scaleInstanceManager.js +317 -0
  101. package/dist/src/scales/scaleInstanceManager.test.d.ts +2 -0
  102. package/dist/src/scales/scaleInstanceManager.test.d.ts.map +1 -0
  103. package/dist/src/scales/scaleInteractionController.d.ts +73 -0
  104. package/dist/src/scales/scaleInteractionController.d.ts.map +1 -0
  105. package/dist/src/scales/scaleInteractionController.js +336 -0
  106. package/dist/src/scales/scaleInteractionController.test.d.ts +2 -0
  107. package/dist/src/scales/scaleInteractionController.test.d.ts.map +1 -0
  108. package/dist/src/scales/scalePropsResolver.d.ts +23 -0
  109. package/dist/src/scales/scalePropsResolver.d.ts.map +1 -0
  110. package/dist/src/scales/scalePropsResolver.js +74 -0
  111. package/dist/src/{view → scales}/scaleResolution.d.ts +53 -35
  112. package/dist/src/scales/scaleResolution.d.ts.map +1 -0
  113. package/dist/src/scales/scaleResolution.js +732 -0
  114. package/dist/src/scales/scaleResolution.test.d.ts.map +1 -0
  115. package/dist/src/scales/scaleResolutionConstants.d.ts +6 -0
  116. package/dist/src/scales/scaleResolutionConstants.d.ts.map +1 -0
  117. package/dist/src/scales/scaleResolutionConstants.js +5 -0
  118. package/dist/src/scales/scaleRules.d.ts +16 -0
  119. package/dist/src/scales/scaleRules.d.ts.map +1 -0
  120. package/dist/src/scales/scaleRules.js +103 -0
  121. package/dist/src/scales/scaleRules.test.d.ts +2 -0
  122. package/dist/src/scales/scaleRules.test.d.ts.map +1 -0
  123. package/dist/src/spec/channel.d.ts +13 -18
  124. package/dist/src/spec/scale.d.ts +6 -0
  125. package/dist/src/types/embedApi.d.ts +5 -0
  126. package/dist/src/types/scaleResolutionApi.d.ts +1 -1
  127. package/dist/src/utils/domainArray.d.ts.map +1 -1
  128. package/dist/src/utils/domainArray.js +3 -0
  129. package/dist/src/utils/indexer.d.ts +3 -0
  130. package/dist/src/utils/indexer.d.ts.map +1 -1
  131. package/dist/src/utils/indexer.js +3 -0
  132. package/dist/src/view/concatView.d.ts +18 -0
  133. package/dist/src/view/concatView.d.ts.map +1 -1
  134. package/dist/src/view/concatView.js +73 -0
  135. package/dist/src/view/concatView.test.d.ts +2 -0
  136. package/dist/src/view/concatView.test.d.ts.map +1 -0
  137. package/dist/src/view/containerMutationHelper.d.ts +74 -0
  138. package/dist/src/view/containerMutationHelper.d.ts.map +1 -0
  139. package/dist/src/view/containerMutationHelper.js +118 -0
  140. package/dist/src/view/containerView.d.ts +0 -7
  141. package/dist/src/view/containerView.d.ts.map +1 -1
  142. package/dist/src/view/containerView.js +0 -10
  143. package/dist/src/view/facetView.d.ts.map +1 -1
  144. package/dist/src/view/facetView.js +0 -15
  145. package/dist/src/view/flowBuilder.d.ts +5 -3
  146. package/dist/src/view/flowBuilder.d.ts.map +1 -1
  147. package/dist/src/view/flowBuilder.js +69 -6
  148. package/dist/src/view/gridView/gridChild.d.ts +11 -0
  149. package/dist/src/view/gridView/gridChild.d.ts.map +1 -1
  150. package/dist/src/view/gridView/gridChild.js +32 -6
  151. package/dist/src/view/gridView/gridView.d.ts +39 -1
  152. package/dist/src/view/gridView/gridView.d.ts.map +1 -1
  153. package/dist/src/view/gridView/gridView.js +106 -48
  154. package/dist/src/view/gridView/gridView.test.d.ts +2 -0
  155. package/dist/src/view/gridView/gridView.test.d.ts.map +1 -0
  156. package/dist/src/view/gridView/scrollbar.d.ts +39 -8
  157. package/dist/src/view/gridView/scrollbar.d.ts.map +1 -1
  158. package/dist/src/view/gridView/scrollbar.js +184 -69
  159. package/dist/src/view/layerView.d.ts +14 -0
  160. package/dist/src/view/layerView.d.ts.map +1 -1
  161. package/dist/src/view/layerView.js +66 -0
  162. package/dist/src/view/layerView.test.d.ts +2 -0
  163. package/dist/src/view/layerView.test.d.ts.map +1 -0
  164. package/dist/src/view/testUtils.d.ts.map +1 -1
  165. package/dist/src/view/testUtils.js +7 -1
  166. package/dist/src/view/unitView.d.ts.map +1 -1
  167. package/dist/src/view/unitView.js +41 -36
  168. package/dist/src/view/view.d.ts +18 -6
  169. package/dist/src/view/view.d.ts.map +1 -1
  170. package/dist/src/view/view.js +30 -4
  171. package/package.json +2 -2
  172. package/dist/bundle/browser-txUcLy2H.js +0 -123
  173. package/dist/bundle/index-BQpbYrv4.js +0 -1712
  174. package/dist/bundle/index-BhtHKLUo.js +0 -73
  175. package/dist/bundle/index-CCe8rnZz.js +0 -716
  176. package/dist/bundle/index-DhcU-Gk-.js +0 -1487
  177. package/dist/src/data/collector.test.js +0 -138
  178. package/dist/src/data/dataFlow.test.js +0 -38
  179. package/dist/src/data/flow.test.js +0 -81
  180. package/dist/src/data/flowInit.test.js +0 -413
  181. package/dist/src/data/flowNode.test.js +0 -50
  182. package/dist/src/data/flowOptimizer.test.js +0 -209
  183. package/dist/src/data/formats/fasta.test.js +0 -27
  184. package/dist/src/data/sources/inlineSource.test.js +0 -63
  185. package/dist/src/data/sources/sequenceSource.test.js +0 -81
  186. package/dist/src/data/transforms/aggregate.test.js +0 -134
  187. package/dist/src/data/transforms/clone.test.js +0 -11
  188. package/dist/src/data/transforms/coverage.test.js +0 -238
  189. package/dist/src/data/transforms/filter.test.js +0 -20
  190. package/dist/src/data/transforms/flatten.test.js +0 -96
  191. package/dist/src/data/transforms/flattenDelimited.test.js +0 -90
  192. package/dist/src/data/transforms/flattenSequence.test.js +0 -34
  193. package/dist/src/data/transforms/formula.test.js +0 -25
  194. package/dist/src/data/transforms/identifier.test.js +0 -92
  195. package/dist/src/data/transforms/pileup.test.js +0 -70
  196. package/dist/src/data/transforms/project.test.js +0 -32
  197. package/dist/src/data/transforms/regexExtract.test.js +0 -70
  198. package/dist/src/data/transforms/regexFold.test.js +0 -201
  199. package/dist/src/data/transforms/sample.test.js +0 -38
  200. package/dist/src/data/transforms/stack.test.js +0 -91
  201. package/dist/src/encoder/accessor.test.js +0 -162
  202. package/dist/src/encoder/encoder.test.js +0 -105
  203. package/dist/src/genome/genome.test.js +0 -268
  204. package/dist/src/genome/genomes.test.js +0 -8
  205. package/dist/src/genome/scaleIndex.test.js +0 -78
  206. package/dist/src/genome/scaleLocus.test.js +0 -4
  207. package/dist/src/scale/scale.test.js +0 -326
  208. package/dist/src/scale/ticks.test.js +0 -46
  209. package/dist/src/selection/selection.test.js +0 -14
  210. package/dist/src/utils/addBaseUrl.test.js +0 -30
  211. package/dist/src/utils/binnedIndex.test.js +0 -201
  212. package/dist/src/utils/cloner.test.js +0 -35
  213. package/dist/src/utils/coalesce.test.js +0 -16
  214. package/dist/src/utils/concatIterables.test.js +0 -8
  215. package/dist/src/utils/domainArray.test.js +0 -130
  216. package/dist/src/utils/indexer.test.js +0 -49
  217. package/dist/src/utils/interactionEvent.test.js +0 -35
  218. package/dist/src/utils/iterateNestedMaps.test.js +0 -33
  219. package/dist/src/utils/kWayMerge.test.js +0 -30
  220. package/dist/src/utils/mergeObjects.test.js +0 -42
  221. package/dist/src/utils/numberExtractor.test.js +0 -6
  222. package/dist/src/utils/propertyCacher.test.js +0 -89
  223. package/dist/src/utils/propertyCoalescer.test.js +0 -25
  224. package/dist/src/utils/radixSort.test.js +0 -51
  225. package/dist/src/utils/reservationMap.test.js +0 -20
  226. package/dist/src/utils/ringBuffer.test.js +0 -39
  227. package/dist/src/utils/topK.test.js +0 -54
  228. package/dist/src/utils/trees.test.js +0 -135
  229. package/dist/src/utils/url.test.js +0 -28
  230. package/dist/src/utils/variableTools.test.js +0 -13
  231. package/dist/src/view/axisResolution.d.ts.map +0 -1
  232. package/dist/src/view/axisResolution.test.d.ts.map +0 -1
  233. package/dist/src/view/axisResolution.test.js +0 -206
  234. package/dist/src/view/flowBuilder.test.js +0 -125
  235. package/dist/src/view/gridView/selectionRect.test.js +0 -87
  236. package/dist/src/view/layout/flexLayout.test.js +0 -323
  237. package/dist/src/view/layout/grid.test.js +0 -71
  238. package/dist/src/view/layout/rectangle.test.js +0 -192
  239. package/dist/src/view/paramMediator.test.js +0 -282
  240. package/dist/src/view/scaleResolution.d.ts.map +0 -1
  241. package/dist/src/view/scaleResolution.js +0 -1059
  242. package/dist/src/view/scaleResolution.test.d.ts.map +0 -1
  243. package/dist/src/view/scaleResolution.test.js +0 -645
  244. package/dist/src/view/view.test.js +0 -245
  245. package/dist/src/view/viewDispose.test.js +0 -110
  246. package/dist/src/view/viewFactory.test.js +0 -25
  247. package/dist/src/view/viewUtils.test.js +0 -87
  248. /package/dist/src/{view → scales}/axisResolution.test.d.ts +0 -0
  249. /package/dist/src/{view → scales}/scaleResolution.test.d.ts +0 -0
@@ -1,1712 +0,0 @@
1
- var Ct = Object.defineProperty;
2
- var Nt = (t, e, n) => e in t ? Ct(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
3
- var T = (t, e, n) => Nt(t, typeof e != "symbol" ? e + "" : e, n);
4
- import { RemoteFile as zt, LocalFile as Lt } from "./browser-txUcLy2H.js";
5
- import { A as ut } from "./AbortablePromiseCache-CcuMrnn7.js";
6
- import { L as ft } from "./index-BhtHKLUo.js";
7
- import { i as Mt } from "./inflate-DRgHi_KK.js";
8
- const lt = BigInt(32);
9
- function Ht(t, e, n) {
10
- const r = +!!n, o = +!n;
11
- return BigInt(t.getInt32(e, n) * o + t.getInt32(e + 4, n) * r) << lt | BigInt(t.getUint32(e, n) * r + t.getUint32(e + 4, n) * o);
12
- }
13
- function $t(t, e, n) {
14
- const r = t.getUint32(e, n), o = t.getUint32(e + 4, n), i = +!!n, s = +!n;
15
- return BigInt(r * s + o * i) << lt | BigInt(r * i + o * s);
16
- }
17
- "getBigInt64" in DataView || (DataView.prototype.getBigInt64 = function(t, e) {
18
- return Ht(this, t, e);
19
- });
20
- "getBigUint64" in DataView || (DataView.prototype.getBigUint64 = function(t, e) {
21
- return $t(this, t, e);
22
- });
23
- var K = function(t, e) {
24
- return K = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(n, r) {
25
- n.__proto__ = r;
26
- } || function(n, r) {
27
- for (var o in r) Object.prototype.hasOwnProperty.call(r, o) && (n[o] = r[o]);
28
- }, K(t, e);
29
- };
30
- function tt(t, e) {
31
- if (typeof e != "function" && e !== null)
32
- throw new TypeError("Class extends value " + String(e) + " is not a constructor or null");
33
- K(t, e);
34
- function n() {
35
- this.constructor = t;
36
- }
37
- t.prototype = e === null ? Object.create(e) : (n.prototype = e.prototype, new n());
38
- }
39
- function jt(t, e, n, r) {
40
- function o(i) {
41
- return i instanceof n ? i : new n(function(s) {
42
- s(i);
43
- });
44
- }
45
- return new (n || (n = Promise))(function(i, s) {
46
- function u(d) {
47
- try {
48
- c(r.next(d));
49
- } catch (y) {
50
- s(y);
51
- }
52
- }
53
- function a(d) {
54
- try {
55
- c(r.throw(d));
56
- } catch (y) {
57
- s(y);
58
- }
59
- }
60
- function c(d) {
61
- d.done ? i(d.value) : o(d.value).then(u, a);
62
- }
63
- c((r = r.apply(t, e || [])).next());
64
- });
65
- }
66
- function ht(t, e) {
67
- var n = { label: 0, sent: function() {
68
- if (i[0] & 1) throw i[1];
69
- return i[1];
70
- }, trys: [], ops: [] }, r, o, i, s = Object.create((typeof Iterator == "function" ? Iterator : Object).prototype);
71
- return s.next = u(0), s.throw = u(1), s.return = u(2), typeof Symbol == "function" && (s[Symbol.iterator] = function() {
72
- return this;
73
- }), s;
74
- function u(c) {
75
- return function(d) {
76
- return a([c, d]);
77
- };
78
- }
79
- function a(c) {
80
- if (r) throw new TypeError("Generator is already executing.");
81
- for (; s && (s = 0, c[0] && (n = 0)), n; ) try {
82
- if (r = 1, o && (i = c[0] & 2 ? o.return : c[0] ? o.throw || ((i = o.return) && i.call(o), 0) : o.next) && !(i = i.call(o, c[1])).done) return i;
83
- switch (o = 0, i && (c = [c[0] & 2, i.value]), c[0]) {
84
- case 0:
85
- case 1:
86
- i = c;
87
- break;
88
- case 4:
89
- return n.label++, { value: c[1], done: !1 };
90
- case 5:
91
- n.label++, o = c[1], c = [0];
92
- continue;
93
- case 7:
94
- c = n.ops.pop(), n.trys.pop();
95
- continue;
96
- default:
97
- if (i = n.trys, !(i = i.length > 0 && i[i.length - 1]) && (c[0] === 6 || c[0] === 2)) {
98
- n = 0;
99
- continue;
100
- }
101
- if (c[0] === 3 && (!i || c[1] > i[0] && c[1] < i[3])) {
102
- n.label = c[1];
103
- break;
104
- }
105
- if (c[0] === 6 && n.label < i[1]) {
106
- n.label = i[1], i = c;
107
- break;
108
- }
109
- if (i && n.label < i[2]) {
110
- n.label = i[2], n.ops.push(c);
111
- break;
112
- }
113
- i[2] && n.ops.pop(), n.trys.pop();
114
- continue;
115
- }
116
- c = e.call(t, n);
117
- } catch (d) {
118
- c = [6, d], o = 0;
119
- } finally {
120
- r = i = 0;
121
- }
122
- if (c[0] & 5) throw c[1];
123
- return { value: c[0] ? c[1] : void 0, done: !0 };
124
- }
125
- }
126
- function M(t) {
127
- var e = typeof Symbol == "function" && Symbol.iterator, n = e && t[e], r = 0;
128
- if (n) return n.call(t);
129
- if (t && typeof t.length == "number") return {
130
- next: function() {
131
- return t && r >= t.length && (t = void 0), { value: t && t[r++], done: !t };
132
- }
133
- };
134
- throw new TypeError(e ? "Object is not iterable." : "Symbol.iterator is not defined.");
135
- }
136
- function Q(t, e) {
137
- var n = typeof Symbol == "function" && t[Symbol.iterator];
138
- if (!n) return t;
139
- var r = n.call(t), o, i = [], s;
140
- try {
141
- for (; (e === void 0 || e-- > 0) && !(o = r.next()).done; ) i.push(o.value);
142
- } catch (u) {
143
- s = { error: u };
144
- } finally {
145
- try {
146
- o && !o.done && (n = r.return) && n.call(r);
147
- } finally {
148
- if (s) throw s.error;
149
- }
150
- }
151
- return i;
152
- }
153
- function X(t, e, n) {
154
- if (n || arguments.length === 2) for (var r = 0, o = e.length, i; r < o; r++)
155
- (i || !(r in e)) && (i || (i = Array.prototype.slice.call(e, 0, r)), i[r] = e[r]);
156
- return t.concat(i || Array.prototype.slice.call(e));
157
- }
158
- function C(t) {
159
- return this instanceof C ? (this.v = t, this) : new C(t);
160
- }
161
- function Gt(t, e, n) {
162
- if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
163
- var r = n.apply(t, e || []), o, i = [];
164
- return o = Object.create((typeof AsyncIterator == "function" ? AsyncIterator : Object).prototype), u("next"), u("throw"), u("return", s), o[Symbol.asyncIterator] = function() {
165
- return this;
166
- }, o;
167
- function s(f) {
168
- return function(m) {
169
- return Promise.resolve(m).then(f, y);
170
- };
171
- }
172
- function u(f, m) {
173
- r[f] && (o[f] = function(l) {
174
- return new Promise(function(v, b) {
175
- i.push([f, l, v, b]) > 1 || a(f, l);
176
- });
177
- }, m && (o[f] = m(o[f])));
178
- }
179
- function a(f, m) {
180
- try {
181
- c(r[f](m));
182
- } catch (l) {
183
- g(i[0][3], l);
184
- }
185
- }
186
- function c(f) {
187
- f.value instanceof C ? Promise.resolve(f.value.v).then(d, y) : g(i[0][2], f);
188
- }
189
- function d(f) {
190
- a("next", f);
191
- }
192
- function y(f) {
193
- a("throw", f);
194
- }
195
- function g(f, m) {
196
- f(m), i.shift(), i.length && a(i[0][0], i[0][1]);
197
- }
198
- }
199
- function Wt(t) {
200
- if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
201
- var e = t[Symbol.asyncIterator], n;
202
- return e ? e.call(t) : (t = typeof M == "function" ? M(t) : t[Symbol.iterator](), n = {}, r("next"), r("throw"), r("return"), n[Symbol.asyncIterator] = function() {
203
- return this;
204
- }, n);
205
- function r(i) {
206
- n[i] = t[i] && function(s) {
207
- return new Promise(function(u, a) {
208
- s = t[i](s), o(u, a, s.done, s.value);
209
- });
210
- };
211
- }
212
- function o(i, s, u, a) {
213
- Promise.resolve(a).then(function(c) {
214
- i({ value: c, done: u });
215
- }, s);
216
- }
217
- }
218
- function k(t) {
219
- return typeof t == "function";
220
- }
221
- function dt(t) {
222
- var e = function(r) {
223
- Error.call(r), r.stack = new Error().stack;
224
- }, n = t(e);
225
- return n.prototype = Object.create(Error.prototype), n.prototype.constructor = n, n;
226
- }
227
- var q = dt(function(t) {
228
- return function(n) {
229
- t(this), this.message = n ? n.length + ` errors occurred during unsubscription:
230
- ` + n.map(function(r, o) {
231
- return o + 1 + ") " + r.toString();
232
- }).join(`
233
- `) : "", this.name = "UnsubscriptionError", this.errors = n;
234
- };
235
- });
236
- function ot(t, e) {
237
- if (t) {
238
- var n = t.indexOf(e);
239
- 0 <= n && t.splice(n, 1);
240
- }
241
- }
242
- var et = function() {
243
- function t(e) {
244
- this.initialTeardown = e, this.closed = !1, this._parentage = null, this._finalizers = null;
245
- }
246
- return t.prototype.unsubscribe = function() {
247
- var e, n, r, o, i;
248
- if (!this.closed) {
249
- this.closed = !0;
250
- var s = this._parentage;
251
- if (s)
252
- if (this._parentage = null, Array.isArray(s))
253
- try {
254
- for (var u = M(s), a = u.next(); !a.done; a = u.next()) {
255
- var c = a.value;
256
- c.remove(this);
257
- }
258
- } catch (l) {
259
- e = { error: l };
260
- } finally {
261
- try {
262
- a && !a.done && (n = u.return) && n.call(u);
263
- } finally {
264
- if (e) throw e.error;
265
- }
266
- }
267
- else
268
- s.remove(this);
269
- var d = this.initialTeardown;
270
- if (k(d))
271
- try {
272
- d();
273
- } catch (l) {
274
- i = l instanceof q ? l.errors : [l];
275
- }
276
- var y = this._finalizers;
277
- if (y) {
278
- this._finalizers = null;
279
- try {
280
- for (var g = M(y), f = g.next(); !f.done; f = g.next()) {
281
- var m = f.value;
282
- try {
283
- it(m);
284
- } catch (l) {
285
- i = i ?? [], l instanceof q ? i = X(X([], Q(i)), Q(l.errors)) : i.push(l);
286
- }
287
- }
288
- } catch (l) {
289
- r = { error: l };
290
- } finally {
291
- try {
292
- f && !f.done && (o = g.return) && o.call(g);
293
- } finally {
294
- if (r) throw r.error;
295
- }
296
- }
297
- }
298
- if (i)
299
- throw new q(i);
300
- }
301
- }, t.prototype.add = function(e) {
302
- var n;
303
- if (e && e !== this)
304
- if (this.closed)
305
- it(e);
306
- else {
307
- if (e instanceof t) {
308
- if (e.closed || e._hasParent(this))
309
- return;
310
- e._addParent(this);
311
- }
312
- (this._finalizers = (n = this._finalizers) !== null && n !== void 0 ? n : []).push(e);
313
- }
314
- }, t.prototype._hasParent = function(e) {
315
- var n = this._parentage;
316
- return n === e || Array.isArray(n) && n.includes(e);
317
- }, t.prototype._addParent = function(e) {
318
- var n = this._parentage;
319
- this._parentage = Array.isArray(n) ? (n.push(e), n) : n ? [n, e] : e;
320
- }, t.prototype._removeParent = function(e) {
321
- var n = this._parentage;
322
- n === e ? this._parentage = null : Array.isArray(n) && ot(n, e);
323
- }, t.prototype.remove = function(e) {
324
- var n = this._finalizers;
325
- n && ot(n, e), e instanceof t && e._removeParent(this);
326
- }, t.EMPTY = function() {
327
- var e = new t();
328
- return e.closed = !0, e;
329
- }(), t;
330
- }();
331
- et.EMPTY;
332
- function mt(t) {
333
- return t instanceof et || t && "closed" in t && k(t.remove) && k(t.add) && k(t.unsubscribe);
334
- }
335
- function it(t) {
336
- k(t) ? t() : t.unsubscribe();
337
- }
338
- var Yt = {
339
- Promise: void 0
340
- }, qt = {
341
- setTimeout: function(t, e) {
342
- for (var n = [], r = 2; r < arguments.length; r++)
343
- n[r - 2] = arguments[r];
344
- return setTimeout.apply(void 0, X([t, e], Q(n)));
345
- },
346
- clearTimeout: function(t) {
347
- return clearTimeout(t);
348
- },
349
- delegate: void 0
350
- };
351
- function gt(t) {
352
- qt.setTimeout(function() {
353
- throw t;
354
- });
355
- }
356
- function st() {
357
- }
358
- function Jt(t) {
359
- t();
360
- }
361
- var nt = function(t) {
362
- tt(e, t);
363
- function e(n) {
364
- var r = t.call(this) || this;
365
- return r.isStopped = !1, n ? (r.destination = n, mt(n) && n.add(r)) : r.destination = Qt, r;
366
- }
367
- return e.create = function(n, r, o) {
368
- return new G(n, r, o);
369
- }, e.prototype.next = function(n) {
370
- this.isStopped || this._next(n);
371
- }, e.prototype.error = function(n) {
372
- this.isStopped || (this.isStopped = !0, this._error(n));
373
- }, e.prototype.complete = function() {
374
- this.isStopped || (this.isStopped = !0, this._complete());
375
- }, e.prototype.unsubscribe = function() {
376
- this.closed || (this.isStopped = !0, t.prototype.unsubscribe.call(this), this.destination = null);
377
- }, e.prototype._next = function(n) {
378
- this.destination.next(n);
379
- }, e.prototype._error = function(n) {
380
- try {
381
- this.destination.error(n);
382
- } finally {
383
- this.unsubscribe();
384
- }
385
- }, e.prototype._complete = function() {
386
- try {
387
- this.destination.complete();
388
- } finally {
389
- this.unsubscribe();
390
- }
391
- }, e;
392
- }(et), Zt = function() {
393
- function t(e) {
394
- this.partialObserver = e;
395
- }
396
- return t.prototype.next = function(e) {
397
- var n = this.partialObserver;
398
- if (n.next)
399
- try {
400
- n.next(e);
401
- } catch (r) {
402
- $(r);
403
- }
404
- }, t.prototype.error = function(e) {
405
- var n = this.partialObserver;
406
- if (n.error)
407
- try {
408
- n.error(e);
409
- } catch (r) {
410
- $(r);
411
- }
412
- else
413
- $(e);
414
- }, t.prototype.complete = function() {
415
- var e = this.partialObserver;
416
- if (e.complete)
417
- try {
418
- e.complete();
419
- } catch (n) {
420
- $(n);
421
- }
422
- }, t;
423
- }(), G = function(t) {
424
- tt(e, t);
425
- function e(n, r, o) {
426
- var i = t.call(this) || this, s;
427
- return k(n) || !n ? s = {
428
- next: n ?? void 0,
429
- error: r ?? void 0,
430
- complete: o ?? void 0
431
- } : s = n, i.destination = new Zt(s), i;
432
- }
433
- return e;
434
- }(nt);
435
- function $(t) {
436
- gt(t);
437
- }
438
- function Kt(t) {
439
- throw t;
440
- }
441
- var Qt = {
442
- closed: !0,
443
- next: st,
444
- error: Kt,
445
- complete: st
446
- }, rt = function() {
447
- return typeof Symbol == "function" && Symbol.observable || "@@observable";
448
- }();
449
- function yt(t) {
450
- return t;
451
- }
452
- function Xt(t) {
453
- return t.length === 0 ? yt : t.length === 1 ? t[0] : function(n) {
454
- return t.reduce(function(r, o) {
455
- return o(r);
456
- }, n);
457
- };
458
- }
459
- var A = function() {
460
- function t(e) {
461
- e && (this._subscribe = e);
462
- }
463
- return t.prototype.lift = function(e) {
464
- var n = new t();
465
- return n.source = this, n.operator = e, n;
466
- }, t.prototype.subscribe = function(e, n, r) {
467
- var o = this, i = ee(e) ? e : new G(e, n, r);
468
- return Jt(function() {
469
- var s = o, u = s.operator, a = s.source;
470
- i.add(u ? u.call(i, a) : a ? o._subscribe(i) : o._trySubscribe(i));
471
- }), i;
472
- }, t.prototype._trySubscribe = function(e) {
473
- try {
474
- return this._subscribe(e);
475
- } catch (n) {
476
- e.error(n);
477
- }
478
- }, t.prototype.forEach = function(e, n) {
479
- var r = this;
480
- return n = ct(n), new n(function(o, i) {
481
- var s = new G({
482
- next: function(u) {
483
- try {
484
- e(u);
485
- } catch (a) {
486
- i(a), s.unsubscribe();
487
- }
488
- },
489
- error: i,
490
- complete: o
491
- });
492
- r.subscribe(s);
493
- });
494
- }, t.prototype._subscribe = function(e) {
495
- var n;
496
- return (n = this.source) === null || n === void 0 ? void 0 : n.subscribe(e);
497
- }, t.prototype[rt] = function() {
498
- return this;
499
- }, t.prototype.pipe = function() {
500
- for (var e = [], n = 0; n < arguments.length; n++)
501
- e[n] = arguments[n];
502
- return Xt(e)(this);
503
- }, t.prototype.toPromise = function(e) {
504
- var n = this;
505
- return e = ct(e), new e(function(r, o) {
506
- var i;
507
- n.subscribe(function(s) {
508
- return i = s;
509
- }, function(s) {
510
- return o(s);
511
- }, function() {
512
- return r(i);
513
- });
514
- });
515
- }, t.create = function(e) {
516
- return new t(e);
517
- }, t;
518
- }();
519
- function ct(t) {
520
- var e;
521
- return (e = t ?? Yt.Promise) !== null && e !== void 0 ? e : Promise;
522
- }
523
- function te(t) {
524
- return t && k(t.next) && k(t.error) && k(t.complete);
525
- }
526
- function ee(t) {
527
- return t && t instanceof nt || te(t) && mt(t);
528
- }
529
- function ne(t) {
530
- return k(t == null ? void 0 : t.lift);
531
- }
532
- function z(t) {
533
- return function(e) {
534
- if (ne(e))
535
- return e.lift(function(n) {
536
- try {
537
- return t(n, this);
538
- } catch (r) {
539
- this.error(r);
540
- }
541
- });
542
- throw new TypeError("Unable to lift unknown Observable type");
543
- };
544
- }
545
- function H(t, e, n, r, o) {
546
- return new re(t, e, n, r, o);
547
- }
548
- var re = function(t) {
549
- tt(e, t);
550
- function e(n, r, o, i, s, u) {
551
- var a = t.call(this, n) || this;
552
- return a.onFinalize = s, a.shouldUnsubscribe = u, a._next = r ? function(c) {
553
- try {
554
- r(c);
555
- } catch (d) {
556
- n.error(d);
557
- }
558
- } : t.prototype._next, a._error = i ? function(c) {
559
- try {
560
- i(c);
561
- } catch (d) {
562
- n.error(d);
563
- } finally {
564
- this.unsubscribe();
565
- }
566
- } : t.prototype._error, a._complete = o ? function() {
567
- try {
568
- o();
569
- } catch (c) {
570
- n.error(c);
571
- } finally {
572
- this.unsubscribe();
573
- }
574
- } : t.prototype._complete, a;
575
- }
576
- return e.prototype.unsubscribe = function() {
577
- var n;
578
- if (!this.shouldUnsubscribe || this.shouldUnsubscribe()) {
579
- var r = this.closed;
580
- t.prototype.unsubscribe.call(this), !r && ((n = this.onFinalize) === null || n === void 0 || n.call(this));
581
- }
582
- }, e;
583
- }(nt), oe = new A(function(t) {
584
- return t.complete();
585
- });
586
- function ie(t) {
587
- return t && k(t.schedule);
588
- }
589
- function bt(t) {
590
- return t[t.length - 1];
591
- }
592
- function se(t) {
593
- return ie(bt(t)) ? t.pop() : void 0;
594
- }
595
- function ce(t, e) {
596
- return typeof bt(t) == "number" ? t.pop() : e;
597
- }
598
- var pt = function(t) {
599
- return t && typeof t.length == "number" && typeof t != "function";
600
- };
601
- function wt(t) {
602
- return k(t == null ? void 0 : t.then);
603
- }
604
- function vt(t) {
605
- return k(t[rt]);
606
- }
607
- function xt(t) {
608
- return Symbol.asyncIterator && k(t == null ? void 0 : t[Symbol.asyncIterator]);
609
- }
610
- function St(t) {
611
- return new TypeError("You provided " + (t !== null && typeof t == "object" ? "an invalid object" : "'" + t + "'") + " where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.");
612
- }
613
- function ae() {
614
- return typeof Symbol != "function" || !Symbol.iterator ? "@@iterator" : Symbol.iterator;
615
- }
616
- var It = ae();
617
- function Bt(t) {
618
- return k(t == null ? void 0 : t[It]);
619
- }
620
- function Ut(t) {
621
- return Gt(this, arguments, function() {
622
- var n, r, o, i;
623
- return ht(this, function(s) {
624
- switch (s.label) {
625
- case 0:
626
- n = t.getReader(), s.label = 1;
627
- case 1:
628
- s.trys.push([1, , 9, 10]), s.label = 2;
629
- case 2:
630
- return [4, C(n.read())];
631
- case 3:
632
- return r = s.sent(), o = r.value, i = r.done, i ? [4, C(void 0)] : [3, 5];
633
- case 4:
634
- return [2, s.sent()];
635
- case 5:
636
- return [4, C(o)];
637
- case 6:
638
- return [4, s.sent()];
639
- case 7:
640
- return s.sent(), [3, 2];
641
- case 8:
642
- return [3, 10];
643
- case 9:
644
- return n.releaseLock(), [7];
645
- case 10:
646
- return [2];
647
- }
648
- });
649
- });
650
- }
651
- function kt(t) {
652
- return k(t == null ? void 0 : t.getReader);
653
- }
654
- function L(t) {
655
- if (t instanceof A)
656
- return t;
657
- if (t != null) {
658
- if (vt(t))
659
- return ue(t);
660
- if (pt(t))
661
- return fe(t);
662
- if (wt(t))
663
- return le(t);
664
- if (xt(t))
665
- return Ot(t);
666
- if (Bt(t))
667
- return he(t);
668
- if (kt(t))
669
- return de(t);
670
- }
671
- throw St(t);
672
- }
673
- function ue(t) {
674
- return new A(function(e) {
675
- var n = t[rt]();
676
- if (k(n.subscribe))
677
- return n.subscribe(e);
678
- throw new TypeError("Provided object does not correctly implement Symbol.observable");
679
- });
680
- }
681
- function fe(t) {
682
- return new A(function(e) {
683
- for (var n = 0; n < t.length && !e.closed; n++)
684
- e.next(t[n]);
685
- e.complete();
686
- });
687
- }
688
- function le(t) {
689
- return new A(function(e) {
690
- t.then(function(n) {
691
- e.closed || (e.next(n), e.complete());
692
- }, function(n) {
693
- return e.error(n);
694
- }).then(null, gt);
695
- });
696
- }
697
- function he(t) {
698
- return new A(function(e) {
699
- var n, r;
700
- try {
701
- for (var o = M(t), i = o.next(); !i.done; i = o.next()) {
702
- var s = i.value;
703
- if (e.next(s), e.closed)
704
- return;
705
- }
706
- } catch (u) {
707
- n = { error: u };
708
- } finally {
709
- try {
710
- i && !i.done && (r = o.return) && r.call(o);
711
- } finally {
712
- if (n) throw n.error;
713
- }
714
- }
715
- e.complete();
716
- });
717
- }
718
- function Ot(t) {
719
- return new A(function(e) {
720
- me(t, e).catch(function(n) {
721
- return e.error(n);
722
- });
723
- });
724
- }
725
- function de(t) {
726
- return Ot(Ut(t));
727
- }
728
- function me(t, e) {
729
- var n, r, o, i;
730
- return jt(this, void 0, void 0, function() {
731
- var s, u;
732
- return ht(this, function(a) {
733
- switch (a.label) {
734
- case 0:
735
- a.trys.push([0, 5, 6, 11]), n = Wt(t), a.label = 1;
736
- case 1:
737
- return [4, n.next()];
738
- case 2:
739
- if (r = a.sent(), !!r.done) return [3, 4];
740
- if (s = r.value, e.next(s), e.closed)
741
- return [2];
742
- a.label = 3;
743
- case 3:
744
- return [3, 1];
745
- case 4:
746
- return [3, 11];
747
- case 5:
748
- return u = a.sent(), o = { error: u }, [3, 11];
749
- case 6:
750
- return a.trys.push([6, , 9, 10]), r && !r.done && (i = n.return) ? [4, i.call(n)] : [3, 8];
751
- case 7:
752
- a.sent(), a.label = 8;
753
- case 8:
754
- return [3, 10];
755
- case 9:
756
- if (o) throw o.error;
757
- return [7];
758
- case 10:
759
- return [7];
760
- case 11:
761
- return e.complete(), [2];
762
- }
763
- });
764
- });
765
- }
766
- function D(t, e, n, r, o) {
767
- r === void 0 && (r = 0), o === void 0 && (o = !1);
768
- var i = e.schedule(function() {
769
- n(), o ? t.add(this.schedule(null, r)) : this.unsubscribe();
770
- }, r);
771
- if (t.add(i), !o)
772
- return i;
773
- }
774
- function Tt(t, e) {
775
- return e === void 0 && (e = 0), z(function(n, r) {
776
- n.subscribe(H(r, function(o) {
777
- return D(r, t, function() {
778
- return r.next(o);
779
- }, e);
780
- }, function() {
781
- return D(r, t, function() {
782
- return r.complete();
783
- }, e);
784
- }, function(o) {
785
- return D(r, t, function() {
786
- return r.error(o);
787
- }, e);
788
- }));
789
- });
790
- }
791
- function Et(t, e) {
792
- return e === void 0 && (e = 0), z(function(n, r) {
793
- r.add(t.schedule(function() {
794
- return n.subscribe(r);
795
- }, e));
796
- });
797
- }
798
- function ge(t, e) {
799
- return L(t).pipe(Et(e), Tt(e));
800
- }
801
- function ye(t, e) {
802
- return L(t).pipe(Et(e), Tt(e));
803
- }
804
- function be(t, e) {
805
- return new A(function(n) {
806
- var r = 0;
807
- return e.schedule(function() {
808
- r === t.length ? n.complete() : (n.next(t[r++]), n.closed || this.schedule());
809
- });
810
- });
811
- }
812
- function pe(t, e) {
813
- return new A(function(n) {
814
- var r;
815
- return D(n, e, function() {
816
- r = t[It](), D(n, e, function() {
817
- var o, i, s;
818
- try {
819
- o = r.next(), i = o.value, s = o.done;
820
- } catch (u) {
821
- n.error(u);
822
- return;
823
- }
824
- s ? n.complete() : n.next(i);
825
- }, 0, !0);
826
- }), function() {
827
- return k(r == null ? void 0 : r.return) && r.return();
828
- };
829
- });
830
- }
831
- function Pt(t, e) {
832
- if (!t)
833
- throw new Error("Iterable cannot be null");
834
- return new A(function(n) {
835
- D(n, e, function() {
836
- var r = t[Symbol.asyncIterator]();
837
- D(n, e, function() {
838
- r.next().then(function(o) {
839
- o.done ? n.complete() : n.next(o.value);
840
- });
841
- }, 0, !0);
842
- });
843
- });
844
- }
845
- function we(t, e) {
846
- return Pt(Ut(t), e);
847
- }
848
- function ve(t, e) {
849
- if (t != null) {
850
- if (vt(t))
851
- return ge(t, e);
852
- if (pt(t))
853
- return be(t, e);
854
- if (wt(t))
855
- return ye(t, e);
856
- if (xt(t))
857
- return Pt(t, e);
858
- if (Bt(t))
859
- return pe(t, e);
860
- if (kt(t))
861
- return we(t, e);
862
- }
863
- throw St(t);
864
- }
865
- function xe(t, e) {
866
- return e ? ve(t, e) : L(t);
867
- }
868
- var Se = dt(function(t) {
869
- return function() {
870
- t(this), this.name = "EmptyError", this.message = "no elements in sequence";
871
- };
872
- });
873
- function Vt(t, e) {
874
- return new Promise(function(n, r) {
875
- var o = new G({
876
- next: function(i) {
877
- n(i), o.unsubscribe();
878
- },
879
- error: r,
880
- complete: function() {
881
- r(new Se());
882
- }
883
- });
884
- t.subscribe(o);
885
- });
886
- }
887
- function At(t, e) {
888
- return z(function(n, r) {
889
- var o = 0;
890
- n.subscribe(H(r, function(i) {
891
- r.next(t.call(e, i, o++));
892
- }));
893
- });
894
- }
895
- function Ie(t, e, n, r, o, i, s, u) {
896
- var a = [], c = 0, d = 0, y = !1, g = function() {
897
- y && !a.length && !c && e.complete();
898
- }, f = function(l) {
899
- return c < r ? m(l) : a.push(l);
900
- }, m = function(l) {
901
- c++;
902
- var v = !1;
903
- L(n(l, d++)).subscribe(H(e, function(b) {
904
- e.next(b);
905
- }, function() {
906
- v = !0;
907
- }, void 0, function() {
908
- if (v)
909
- try {
910
- c--;
911
- for (var b = function() {
912
- var x = a.shift();
913
- s || m(x);
914
- }; a.length && c < r; )
915
- b();
916
- g();
917
- } catch (x) {
918
- e.error(x);
919
- }
920
- }));
921
- };
922
- return t.subscribe(H(e, f, function() {
923
- y = !0, g();
924
- })), function() {
925
- };
926
- }
927
- function _t(t, e, n) {
928
- return n === void 0 && (n = 1 / 0), k(e) ? _t(function(r, o) {
929
- return At(function(i, s) {
930
- return e(r, i, o, s);
931
- })(L(t(r, o)));
932
- }, n) : (typeof e == "number" && (n = e), z(function(r, o) {
933
- return Ie(r, o, t, n);
934
- }));
935
- }
936
- function Be(t) {
937
- return t === void 0 && (t = 1 / 0), _t(yt, t);
938
- }
939
- function Ue() {
940
- for (var t = [], e = 0; e < arguments.length; e++)
941
- t[e] = arguments[e];
942
- var n = se(t), r = ce(t, 1 / 0), o = t;
943
- return o.length ? o.length === 1 ? L(o[0]) : Be(r)(xe(o, n)) : oe;
944
- }
945
- function ke(t, e, n, r, o) {
946
- return function(i, s) {
947
- var u = n, a = e, c = 0;
948
- i.subscribe(H(s, function(d) {
949
- var y = c++;
950
- a = u ? t(a, d, y) : (u = !0, d);
951
- }, function() {
952
- u && s.next(a), s.complete();
953
- }));
954
- };
955
- }
956
- function Ft(t, e) {
957
- return z(ke(t, e, arguments.length >= 2, !1, !0));
958
- }
959
- var Oe = function(t, e) {
960
- return t.push(e), t;
961
- };
962
- function Te() {
963
- return z(function(t, e) {
964
- Ft(Oe, [])(t).subscribe(e);
965
- });
966
- }
967
- class N {
968
- constructor(e) {
969
- T(this, "ranges");
970
- this.ranges = e;
971
- }
972
- get min() {
973
- return this.ranges[0].min;
974
- }
975
- get max() {
976
- return this.ranges.at(-1).max;
977
- }
978
- contains(e) {
979
- for (const n of this.ranges)
980
- if (n.min <= e && n.max >= e)
981
- return !0;
982
- return !1;
983
- }
984
- isContiguous() {
985
- return this.ranges.length > 1;
986
- }
987
- getRanges() {
988
- return this.ranges.map((e) => new N([{ min: e.min, max: e.max }]));
989
- }
990
- toString() {
991
- return this.ranges.map((e) => `[${e.min}-${e.max}]`).join(",");
992
- }
993
- union(e) {
994
- const n = [...this.getRanges(), ...e.getRanges()].sort((i, s) => i.min < s.min ? -1 : i.min > s.min ? 1 : i.max < s.max ? -1 : s.max > i.max ? 1 : 0), r = [];
995
- let o = n[0];
996
- for (const i of n)
997
- i.min > o.max + 1 ? (r.push(o), o = i) : i.max > o.max && (o = new N([{ min: o.min, max: i.max }]));
998
- return r.push(o), r.length === 1 ? r[0] : new N(r);
999
- }
1000
- }
1001
- function Ee(t) {
1002
- return Mt(t.subarray(2), void 0);
1003
- }
1004
- class Pe extends Error {
1005
- constructor(n) {
1006
- super(n);
1007
- T(this, "code");
1008
- this.code = "ERR_ABORTED";
1009
- }
1010
- }
1011
- function Ve(t) {
1012
- t.sort((o, i) => o.offset - i.offset);
1013
- const e = [];
1014
- let n, r;
1015
- for (const o of t)
1016
- n && r && o.offset - r <= 2e3 ? (n.length = n.length + o.length - r + o.offset, n.blocks.push(o)) : e.push(n = {
1017
- blocks: [o],
1018
- length: o.length,
1019
- offset: o.offset
1020
- }), r = n.offset + n.length;
1021
- return e;
1022
- }
1023
- function j(t) {
1024
- if (t && t.aborted)
1025
- if (typeof DOMException > "u") {
1026
- const e = new Pe("aborted");
1027
- throw e.code = "ERR_ABORTED", e;
1028
- } else
1029
- throw new DOMException("aborted", "AbortError");
1030
- }
1031
- const J = typeof TextDecoder < "u" ? new TextDecoder("utf8") : void 0;
1032
- function Z(t, e, n, r) {
1033
- return t < r && e >= n;
1034
- }
1035
- class Dt {
1036
- constructor(e, n, r, o, i) {
1037
- T(this, "bbi");
1038
- T(this, "refsByName");
1039
- T(this, "cirTreeOffset");
1040
- T(this, "isCompressed");
1041
- T(this, "blockType");
1042
- T(this, "cirTreePromise");
1043
- T(this, "featureCache", new ut({
1044
- cache: new ft({ maxSize: 1e3 }),
1045
- fill: async ({ length: e, offset: n }, r) => this.bbi.read(e, n, { signal: r })
1046
- }));
1047
- if (this.bbi = e, this.refsByName = n, this.cirTreeOffset = r, this.isCompressed = o, this.blockType = i, !(r >= 0))
1048
- throw new Error("invalid cirTreeOffset!");
1049
- }
1050
- async readWigData(e, n, r, o, i) {
1051
- try {
1052
- const s = this.refsByName[e];
1053
- s === void 0 && o.complete();
1054
- const u = { chrId: s, start: n, end: r };
1055
- this.cirTreePromise || (this.cirTreePromise = this.bbi.read(48, this.cirTreeOffset, i));
1056
- const a = await this.cirTreePromise, d = new DataView(a.buffer).getUint32(4, !0);
1057
- let y = [], g = 0;
1058
- const f = (b, x, B) => {
1059
- try {
1060
- const p = b.subarray(x), w = new DataView(p.buffer, p.byteOffset, p.length);
1061
- let h = 0;
1062
- const U = w.getUint8(h);
1063
- h += 2;
1064
- const E = w.getUint16(h, !0);
1065
- if (h += 2, U === 1) {
1066
- const P = [];
1067
- for (let I = 0; I < E; I++) {
1068
- const O = w.getUint32(h, !0);
1069
- h += 4;
1070
- const V = w.getUint32(h, !0);
1071
- h += 4;
1072
- const _ = w.getUint32(h, !0);
1073
- h += 4;
1074
- const F = w.getUint32(h, !0);
1075
- h += 4;
1076
- const W = Number(w.getBigUint64(h, !0));
1077
- h += 8;
1078
- const Y = Number(w.getBigUint64(h, !0));
1079
- h += 8, P.push({
1080
- startChrom: O,
1081
- startBase: V,
1082
- endBase: F,
1083
- endChrom: _,
1084
- blockOffset: W,
1085
- blockSize: Y,
1086
- offset: h
1087
- });
1088
- }
1089
- y = y.concat(P.filter((I) => m(I)).map((I) => ({
1090
- offset: I.blockOffset,
1091
- length: I.blockSize
1092
- })));
1093
- } else if (U === 0) {
1094
- const P = [];
1095
- for (let O = 0; O < E; O++) {
1096
- const V = w.getUint32(h, !0);
1097
- h += 4;
1098
- const _ = w.getUint32(h, !0);
1099
- h += 4;
1100
- const F = w.getUint32(h, !0);
1101
- h += 4;
1102
- const W = w.getUint32(h, !0);
1103
- h += 4;
1104
- const Y = Number(w.getBigUint64(h, !0));
1105
- h += 8, P.push({
1106
- startChrom: V,
1107
- startBase: _,
1108
- endChrom: F,
1109
- endBase: W,
1110
- blockOffset: Y,
1111
- offset: h
1112
- });
1113
- }
1114
- const I = P.filter((O) => m(O)).map((O) => O.blockOffset);
1115
- I.length > 0 && v(I, B + 1);
1116
- }
1117
- } catch (S) {
1118
- o.error(S);
1119
- }
1120
- }, m = (b) => {
1121
- const { startChrom: x, startBase: B, endChrom: S, endBase: p } = b;
1122
- return (x < s || x === s && B <= r) && (S > s || S === s && p >= n);
1123
- }, l = async (b, x, B) => {
1124
- try {
1125
- const S = x.max - x.min, p = x.min, w = await this.featureCache.get(`${S}_${p}`, { length: S, offset: p }, i == null ? void 0 : i.signal);
1126
- for (const h of b)
1127
- x.contains(h) && (f(w, h - p, B), g -= 1, g === 0 && this.readFeatures(o, y, {
1128
- ...i,
1129
- request: u
1130
- }).catch((U) => {
1131
- o.error(U);
1132
- }));
1133
- } catch (S) {
1134
- o.error(S);
1135
- }
1136
- }, v = (b, x) => {
1137
- try {
1138
- g += b.length;
1139
- const B = 4 + d * 32;
1140
- let S = new N([
1141
- {
1142
- min: b[0],
1143
- max: b[0] + B
1144
- }
1145
- ]);
1146
- for (let p = 1; p < b.length; p += 1) {
1147
- const w = new N([
1148
- {
1149
- min: b[p],
1150
- max: b[p] + B
1151
- }
1152
- ]);
1153
- S = S.union(w);
1154
- }
1155
- S.getRanges().map((p) => l(b, p, x));
1156
- } catch (B) {
1157
- o.error(B);
1158
- }
1159
- };
1160
- v([this.cirTreeOffset + 48], 1);
1161
- return;
1162
- } catch (s) {
1163
- o.error(s);
1164
- }
1165
- }
1166
- parseSummaryBlock(e, n, r) {
1167
- const o = [];
1168
- let i = n;
1169
- const s = new DataView(e.buffer, e.byteOffset, e.length);
1170
- for (; i < e.byteLength; ) {
1171
- const u = s.getUint32(i, !0);
1172
- i += 4;
1173
- const a = s.getUint32(i, !0);
1174
- i += 4;
1175
- const c = s.getUint32(i, !0);
1176
- i += 4;
1177
- const d = s.getUint32(i, !0);
1178
- i += 4;
1179
- const y = s.getFloat32(i, !0);
1180
- i += 4;
1181
- const g = s.getFloat32(i, !0);
1182
- i += 4;
1183
- const f = s.getFloat32(i, !0);
1184
- i += 4, i += 4, (!r || u === r.chrId && Z(a, c, r.start, r.end)) && o.push({
1185
- start: a,
1186
- end: c,
1187
- maxScore: g,
1188
- minScore: y,
1189
- summary: !0,
1190
- score: f / (d || 1)
1191
- });
1192
- }
1193
- return o;
1194
- }
1195
- parseBigBedBlock(e, n, r, o) {
1196
- const i = [];
1197
- let s = n;
1198
- const u = e, a = new DataView(u.buffer, u.byteOffset, u.length);
1199
- for (; s < e.byteLength; ) {
1200
- const c = s, d = a.getUint32(s, !0);
1201
- s += 4;
1202
- const y = a.getInt32(s, !0);
1203
- s += 4;
1204
- const g = a.getInt32(s, !0);
1205
- s += 4;
1206
- let f = s;
1207
- for (; f < e.length && e[f] !== 0; f++)
1208
- ;
1209
- const m = e.subarray(s, f), l = (J == null ? void 0 : J.decode(m)) ?? m.toString();
1210
- s = f + 1, i.push({
1211
- chromId: d,
1212
- start: y,
1213
- end: g,
1214
- rest: l,
1215
- uniqueId: `bb-${r + c}`
1216
- });
1217
- }
1218
- return o ? i.filter((c) => Z(c.start, c.end, o.start, o.end)) : i;
1219
- }
1220
- parseBigWigBlock(e, n, r) {
1221
- const o = e.subarray(n), i = new DataView(o.buffer, o.byteOffset, o.length);
1222
- let s = 0;
1223
- s += 4;
1224
- const u = i.getInt32(s, !0);
1225
- s += 8;
1226
- const a = i.getUint32(s, !0);
1227
- s += 4;
1228
- const c = i.getUint32(s, !0);
1229
- s += 4;
1230
- const d = i.getUint8(s);
1231
- s += 2;
1232
- const y = i.getUint16(s, !0);
1233
- s += 2;
1234
- const g = new Array(y);
1235
- switch (d) {
1236
- case 1: {
1237
- for (let f = 0; f < y; f++) {
1238
- const m = i.getInt32(s, !0);
1239
- s += 4;
1240
- const l = i.getInt32(s, !0);
1241
- s += 4;
1242
- const v = i.getFloat32(s, !0);
1243
- s += 4, g[f] = {
1244
- start: m,
1245
- end: l,
1246
- score: v
1247
- };
1248
- }
1249
- break;
1250
- }
1251
- case 2: {
1252
- for (let f = 0; f < y; f++) {
1253
- const m = i.getInt32(s, !0);
1254
- s += 4;
1255
- const l = i.getFloat32(s, !0);
1256
- s += 4, g[f] = {
1257
- score: l,
1258
- start: m,
1259
- end: m + c
1260
- };
1261
- }
1262
- break;
1263
- }
1264
- case 3: {
1265
- for (let f = 0; f < y; f++) {
1266
- const m = i.getFloat32(s, !0);
1267
- s += 4;
1268
- const l = u + f * a;
1269
- g[f] = {
1270
- score: m,
1271
- start: l,
1272
- end: l + c
1273
- };
1274
- }
1275
- break;
1276
- }
1277
- }
1278
- return r ? g.filter((f) => Z(f.start, f.end, r.start, r.end)) : g;
1279
- }
1280
- async readFeatures(e, n, r = {}) {
1281
- try {
1282
- const { blockType: o, isCompressed: i } = this, { signal: s, request: u } = r, a = Ve(n);
1283
- j(s), await Promise.all(a.map(async (c) => {
1284
- j(s);
1285
- const { length: d, offset: y } = c, g = await this.featureCache.get(`${d}_${y}`, c, s);
1286
- for (const f of c.blocks) {
1287
- j(s);
1288
- let m = g.subarray(f.offset - c.offset);
1289
- switch (i && (m = Ee(m)), j(s), o) {
1290
- case "summary": {
1291
- e.next(this.parseSummaryBlock(m, 0, u));
1292
- break;
1293
- }
1294
- case "bigwig": {
1295
- e.next(this.parseBigWigBlock(m, 0, u));
1296
- break;
1297
- }
1298
- case "bigbed": {
1299
- e.next(this.parseBigBedBlock(m, 0, f.offset * 256, u));
1300
- break;
1301
- }
1302
- default:
1303
- console.warn(`Don't know what to do with ${o}`);
1304
- }
1305
- }
1306
- })), e.complete();
1307
- } catch (o) {
1308
- e.error(o);
1309
- }
1310
- }
1311
- }
1312
- const Ae = -2003829722, at = -2021002517;
1313
- function R(t) {
1314
- return new DataView(t.buffer, t.byteOffset, t.length);
1315
- }
1316
- class Rt {
1317
- /*
1318
- * @param filehandle - a filehandle from generic-filehandle2
1319
- *
1320
- * @param path - a Local file path as a string
1321
- *
1322
- * @param url - a URL string
1323
- *
1324
- * @param renameRefSeqs - an optional method to rename the internal reference
1325
- * sequences using a mapping function
1326
- */
1327
- constructor(e) {
1328
- T(this, "bbi");
1329
- T(this, "headerP");
1330
- T(this, "renameRefSeqs");
1331
- const { filehandle: n, renameRefSeqs: r = (s) => s, path: o, url: i } = e;
1332
- if (this.renameRefSeqs = r, n)
1333
- this.bbi = n;
1334
- else if (i)
1335
- this.bbi = new zt(i);
1336
- else if (o)
1337
- this.bbi = new Lt(o);
1338
- else
1339
- throw new Error("no file given");
1340
- }
1341
- getHeader(e) {
1342
- return this.headerP || (this.headerP = this._getHeader(e).catch((n) => {
1343
- throw this.headerP = void 0, n;
1344
- })), this.headerP;
1345
- }
1346
- async _getHeader(e) {
1347
- const n = await this._getMainHeader(e), r = await this._readChromTree(n, e);
1348
- return {
1349
- ...n,
1350
- ...r
1351
- };
1352
- }
1353
- async _getMainHeader(e, n = 2e3) {
1354
- const r = await this.bbi.read(n, 0, e), o = R(r), i = o.getInt32(0, !0);
1355
- if (i !== Ae && i !== at)
1356
- throw new Error("not a BigWig/BigBed file");
1357
- let s = 0;
1358
- const u = o.getInt32(s, !0);
1359
- s += 4;
1360
- const a = o.getUint16(s, !0);
1361
- s += 2;
1362
- const c = o.getUint16(s, !0);
1363
- s += 2;
1364
- const d = Number(o.getBigUint64(s, !0));
1365
- s += 8;
1366
- const y = Number(o.getBigUint64(s, !0));
1367
- s += 8;
1368
- const g = Number(o.getBigUint64(s, !0));
1369
- s += 8;
1370
- const f = o.getUint16(s, !0);
1371
- s += 2;
1372
- const m = o.getUint16(s, !0);
1373
- s += 2;
1374
- const l = Number(o.getBigUint64(s, !0));
1375
- s += 8;
1376
- const v = Number(o.getBigUint64(s, !0));
1377
- s += 8;
1378
- const b = o.getUint32(s, !0);
1379
- s += 4;
1380
- const x = Number(o.getBigUint64(s, !0));
1381
- s += 8;
1382
- const B = [];
1383
- for (let h = 0; h < c; h++) {
1384
- const U = o.getUint32(s, !0);
1385
- s += 4;
1386
- const E = o.getUint32(s, !0);
1387
- s += 4;
1388
- const P = Number(o.getBigUint64(s, !0));
1389
- s += 8;
1390
- const I = Number(o.getBigUint64(s, !0));
1391
- s += 8, B.push({
1392
- reductionLevel: U,
1393
- reserved: E,
1394
- dataOffset: P,
1395
- indexOffset: I
1396
- });
1397
- }
1398
- const S = u === at ? "bigbed" : "bigwig";
1399
- if (l > n || v > n - 8 * 5)
1400
- return this._getMainHeader(e, n * 2);
1401
- let p;
1402
- if (v) {
1403
- const h = r.subarray(v);
1404
- let U = 0;
1405
- const E = R(h), P = Number(E.getBigUint64(U, !0));
1406
- U += 8;
1407
- const I = E.getFloat64(U, !0);
1408
- U += 8;
1409
- const O = E.getFloat64(U, !0);
1410
- U += 8;
1411
- const V = E.getFloat64(U, !0);
1412
- U += 8;
1413
- const _ = E.getFloat64(U, !0);
1414
- U += 8, p = {
1415
- scoreMin: I,
1416
- scoreMax: O,
1417
- scoreSum: V,
1418
- scoreSumSquares: _,
1419
- basesCovered: P
1420
- };
1421
- } else
1422
- throw new Error("no stats");
1423
- const w = new TextDecoder("utf8");
1424
- return {
1425
- zoomLevels: B,
1426
- magic: u,
1427
- extHeaderOffset: x,
1428
- numZoomLevels: c,
1429
- fieldCount: f,
1430
- totalSummary: p,
1431
- definedFieldCount: m,
1432
- uncompressBufSize: b,
1433
- asOffset: l,
1434
- chromTreeOffset: d,
1435
- totalSummaryOffset: v,
1436
- unzoomedDataOffset: y,
1437
- unzoomedIndexOffset: g,
1438
- fileType: S,
1439
- version: a,
1440
- autoSql: l ? w.decode(r.subarray(l, r.indexOf(0, l))) : ""
1441
- };
1442
- }
1443
- async _readChromTree(e, n) {
1444
- const r = [], o = {}, i = e.chromTreeOffset, s = R(await this.bbi.read(32, i, n));
1445
- let u = 0;
1446
- u += 4, u += 4;
1447
- const a = s.getUint32(u, !0);
1448
- u += 4;
1449
- const c = s.getUint32(u, !0);
1450
- u += 4, u += 8;
1451
- const d = new TextDecoder("utf8"), y = async (g) => {
1452
- const f = await this.bbi.read(4, g), m = R(f);
1453
- let l = 0;
1454
- const v = m.getUint8(l);
1455
- l += 1, l += 1;
1456
- const b = m.getUint16(l, !0);
1457
- if (l += 2, v) {
1458
- const x = await this.bbi.read(b * (a + c), g + l), B = R(x);
1459
- l = 0;
1460
- for (let S = 0; S < b; S++) {
1461
- const p = d.decode(x.subarray(l, l + a)).replaceAll("\0", "");
1462
- l += a;
1463
- const w = B.getUint32(l, !0);
1464
- l += 4;
1465
- const h = B.getUint32(l, !0);
1466
- l += 4, o[this.renameRefSeqs(p)] = w, r[w] = {
1467
- name: p,
1468
- id: w,
1469
- length: h
1470
- };
1471
- }
1472
- } else {
1473
- const x = [], B = R(await this.bbi.read(b * (a + 8), g + l));
1474
- l = 0;
1475
- for (let S = 0; S < b; S++) {
1476
- l += a;
1477
- const p = Number(B.getBigUint64(l, !0));
1478
- l += 8, x.push(y(p));
1479
- }
1480
- await Promise.all(x);
1481
- }
1482
- };
1483
- return await y(i + 32), {
1484
- refsByName: o,
1485
- refsByNumber: r
1486
- };
1487
- }
1488
- /*
1489
- * fetches the "unzoomed" view of the bigwig data. this is the default for bigbed
1490
- * @param abortSignal - a signal to optionally abort this operation
1491
- */
1492
- async getUnzoomedView(e) {
1493
- const { unzoomedIndexOffset: n, refsByName: r, uncompressBufSize: o, fileType: i } = await this.getHeader(e);
1494
- return new Dt(this.bbi, r, n, o > 0, i);
1495
- }
1496
- /**
1497
- * Gets features from a BigWig file
1498
- *
1499
- * @param refName - The chromosome name
1500
- *
1501
- * @param start - The start of a region
1502
- *
1503
- * @param end - The end of a region
1504
- *
1505
- * @param opts - An object containing basesPerSpan (e.g. pixels per basepair)
1506
- * or scale used to infer the zoomLevel to use
1507
- */
1508
- async getFeatureStream(e, n, r, o) {
1509
- await this.getHeader(o);
1510
- const i = this.renameRefSeqs(e);
1511
- let s;
1512
- const { basesPerSpan: u, scale: a } = o || {};
1513
- return u ? s = await this.getView(1 / u, o) : a ? s = await this.getView(a, o) : s = await this.getView(1, o), new A((c) => {
1514
- s.readWigData(i, n, r, c, o).catch((d) => {
1515
- c.error(d);
1516
- });
1517
- });
1518
- }
1519
- async getFeatures(e, n, r, o) {
1520
- const i = await this.getFeatureStream(e, n, r, o);
1521
- return (await Vt(i.pipe(Te()))).flat();
1522
- }
1523
- }
1524
- class ze extends Rt {
1525
- /**
1526
- * Retrieves a BlockView of a specific zoomLevel
1527
- *
1528
- * @param scale - number
1529
- *
1530
- * @param opts - An object containing basesPerSpan (e.g. pixels per basepair)
1531
- * or scale used to infer the zoomLevel to use
1532
- */
1533
- async getView(e, n) {
1534
- const { zoomLevels: r, refsByName: o, uncompressBufSize: i } = await this.getHeader(n), s = 1 / e, u = r.length - 1;
1535
- for (let a = u; a >= 0; a -= 1) {
1536
- const c = r[a];
1537
- if (c && c.reductionLevel <= 2 * s)
1538
- return new Dt(this.bbi, o, c.indexOffset, i > 0, "summary");
1539
- }
1540
- return this.getUnzoomedView(n);
1541
- }
1542
- }
1543
- function _e(t) {
1544
- return t.filter((e) => !!e);
1545
- }
1546
- class Le extends Rt {
1547
- constructor() {
1548
- super(...arguments);
1549
- T(this, "readIndicesCache", new ut({
1550
- cache: new ft({ maxSize: 1 }),
1551
- fill: (n, r) => this._readIndices({ ...n, signal: r })
1552
- }));
1553
- }
1554
- readIndices(n = {}) {
1555
- const { signal: r, ...o } = n;
1556
- return this.readIndicesCache.get(JSON.stringify(o), n, r);
1557
- }
1558
- /*
1559
- * retrieve unzoomed view for any scale
1560
- */
1561
- async getView(n, r) {
1562
- return this.getUnzoomedView(r);
1563
- }
1564
- /*
1565
- * parse the bigbed extraIndex fields
1566
- *
1567
- *
1568
- * @return a Promise for an array of Index data structure since there can be
1569
- * multiple extraIndexes in a bigbed, see bedToBigBed documentation
1570
- */
1571
- async _readIndices(n) {
1572
- const { extHeaderOffset: r } = await this.getHeader(n), o = await this.bbi.read(64, r), i = new DataView(o.buffer, o.byteOffset, o.length);
1573
- let s = 0;
1574
- s += 2;
1575
- const u = i.getUint16(s, !0);
1576
- s += 2;
1577
- const a = Number(i.getBigUint64(s, !0));
1578
- if (s += 8, u === 0)
1579
- return [];
1580
- const c = 20, d = c * u, y = await this.bbi.read(d, a), g = [];
1581
- for (let f = 0; f < u; f += 1) {
1582
- const m = y.subarray(f * c), l = new DataView(m.buffer, m.byteOffset, m.length);
1583
- let v = 0;
1584
- const b = l.getInt16(v, !0);
1585
- v += 2;
1586
- const x = l.getInt16(v, !0);
1587
- v += 2;
1588
- const B = Number(l.getBigUint64(v, !0));
1589
- v += 12;
1590
- const S = l.getInt16(v, !0);
1591
- g.push({
1592
- type: b,
1593
- fieldcount: x,
1594
- offset: B,
1595
- field: S
1596
- });
1597
- }
1598
- return g;
1599
- }
1600
- /*
1601
- * perform a search in the bigbed extraIndex to find which blocks in the
1602
- * bigbed data to look for the actual feature data
1603
- *
1604
- * @param name - the name to search for
1605
- *
1606
- * @param opts - a SearchOptions argument with optional signal
1607
- *
1608
- * @return a Promise for an array of bigbed block Loc entries
1609
- */
1610
- async searchExtraIndexBlocks(n, r = {}) {
1611
- const o = await this.readIndices(r);
1612
- if (o.length === 0)
1613
- return [];
1614
- const i = new TextDecoder("utf8"), s = o.map(async (u) => {
1615
- const { offset: a, field: c } = u, d = await this.bbi.read(32, a, r), y = new DataView(d.buffer, d.byteOffset, d.length);
1616
- let g = 0;
1617
- g += 4;
1618
- const f = y.getInt32(g, !0);
1619
- g += 4;
1620
- const m = y.getInt32(g, !0);
1621
- g += 4;
1622
- const l = y.getInt32(g, !0);
1623
- g += 4, g += 8;
1624
- const v = async (b) => {
1625
- const x = b, B = 4 + f * (m + l), p = await this.bbi.read(B, x, r), w = new DataView(p.buffer, p.byteOffset, p.length);
1626
- let h = 0;
1627
- const U = w.getInt8(h);
1628
- h += 2;
1629
- const E = w.getInt16(h, !0);
1630
- h += 2;
1631
- const P = [];
1632
- if (U === 0) {
1633
- const I = [];
1634
- for (let V = 0; V < E; V++) {
1635
- const _ = i.decode(p.subarray(h, h + m)).replaceAll("\0", "");
1636
- h += m;
1637
- const F = Number(w.getBigUint64(h, !0));
1638
- h += 8, I.push({
1639
- key: _,
1640
- offset: F
1641
- });
1642
- }
1643
- let O = 0;
1644
- for (const { key: V, offset: _ } of I) {
1645
- if (n.localeCompare(V) < 0 && O)
1646
- return v(O);
1647
- O = _;
1648
- }
1649
- return v(O);
1650
- } else if (U === 1) {
1651
- for (let I = 0; I < E; I++) {
1652
- const O = i.decode(p.subarray(h, h + m)).replaceAll("\0", "");
1653
- h += m;
1654
- const V = Number(w.getBigUint64(h, !0));
1655
- h += 8;
1656
- const _ = w.getUint32(h, !0);
1657
- h += 4;
1658
- const F = w.getUint32(h, !0);
1659
- h += 4, P.push({
1660
- key: O,
1661
- offset: V,
1662
- length: _,
1663
- reserved: F
1664
- });
1665
- }
1666
- for (const I of P)
1667
- if (I.key === n)
1668
- return {
1669
- ...I,
1670
- field: c
1671
- };
1672
- return;
1673
- }
1674
- };
1675
- return v(a + 32);
1676
- });
1677
- return _e(await Promise.all(s));
1678
- }
1679
- /*
1680
- * retrieve the features from the bigbed data that were found through the
1681
- * lookup of the extraIndex note that there can be multiple extraIndex, see
1682
- * the BigBed specification and the -extraIndex argument to bedToBigBed
1683
- *
1684
- * @param name - the name to search for
1685
- *
1686
- * @param opts - options object with optional AboutSignal
1687
- *
1688
- * @return array of Feature
1689
- */
1690
- async searchExtraIndex(n, r = {}) {
1691
- const o = await this.searchExtraIndexBlocks(n, r);
1692
- if (o.length === 0)
1693
- return [];
1694
- const i = await this.getUnzoomedView(r), s = o.map((a) => new A((c) => {
1695
- i.readFeatures(c, [a], r).catch((d) => {
1696
- c.error(d);
1697
- });
1698
- }).pipe(Ft((c, d) => c.concat(d)), At((c) => {
1699
- for (const d of c)
1700
- d.field = a.field;
1701
- return c;
1702
- })));
1703
- return (await Vt(Ue(...s))).filter((a) => {
1704
- var c;
1705
- return ((c = a.rest) == null ? void 0 : c.split(" ")[(a.field || 0) - 3]) === n;
1706
- });
1707
- }
1708
- }
1709
- export {
1710
- Le as BigBed,
1711
- ze as BigWig
1712
- };