@macrostrat/column-views 2.3.1 → 2.3.3

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 (131) hide show
  1. package/CHANGELOG.md +9 -2
  2. package/dist/esm/{column-views.479f68bd.js → column-views.029ea8f1.js} +2 -2
  3. package/dist/esm/{column-views.479f68bd.js.map → column-views.029ea8f1.js.map} +1 -1
  4. package/dist/esm/{column-views.5eb4e6ff.js → column-views.0a010643.js} +2 -2
  5. package/dist/esm/column-views.0a010643.js.map +1 -0
  6. package/dist/esm/{column-views.44373a90.js → column-views.18aac6a5.js} +2 -2
  7. package/dist/esm/{column-views.44373a90.js.map → column-views.18aac6a5.js.map} +1 -1
  8. package/dist/esm/{column-views.322790f3.js → column-views.24060b85.js} +5 -9
  9. package/dist/esm/column-views.24060b85.js.map +1 -0
  10. package/dist/esm/{column-views.de433f18.js → column-views.26e0e0b6.js} +3 -3
  11. package/dist/esm/column-views.26e0e0b6.js.map +1 -0
  12. package/dist/esm/{column-views.92575b87.js → column-views.2f979aee.js} +2 -2
  13. package/dist/esm/{column-views.92575b87.js.map → column-views.2f979aee.js.map} +1 -1
  14. package/dist/esm/{column-views.2bac03a2.js → column-views.3f1cdc18.js} +2 -2
  15. package/dist/esm/{column-views.2bac03a2.js.map → column-views.3f1cdc18.js.map} +1 -1
  16. package/dist/esm/{column-views.40094dd9.js → column-views.4685ea28.js} +15 -14
  17. package/dist/esm/column-views.4685ea28.js.map +1 -0
  18. package/dist/esm/column-views.4b259f9e.js.map +1 -1
  19. package/dist/esm/{column-views.dc195174.js → column-views.4e6eead3.js} +2 -2
  20. package/dist/esm/{column-views.dc195174.js.map → column-views.4e6eead3.js.map} +1 -1
  21. package/dist/esm/{column-views.107b47b4.js → column-views.6f96d1c3.js} +6 -6
  22. package/dist/esm/{column-views.107b47b4.js.map → column-views.6f96d1c3.js.map} +1 -1
  23. package/dist/esm/{column-views.343fc926.js → column-views.6fff7602.js} +5 -10
  24. package/dist/esm/column-views.6fff7602.js.map +1 -0
  25. package/dist/esm/{column-views.5ca2b219.js → column-views.73fc96cb.js} +3 -3
  26. package/dist/esm/{column-views.5ca2b219.js.map → column-views.73fc96cb.js.map} +1 -1
  27. package/dist/esm/column-views.75b83110.js +13 -0
  28. package/dist/esm/{column-views.fba36cbb.js.map → column-views.75b83110.js.map} +1 -1
  29. package/dist/esm/{column-views.d524075b.js → column-views.82a5112b.js} +4 -4
  30. package/dist/esm/{column-views.d524075b.js.map → column-views.82a5112b.js.map} +1 -1
  31. package/dist/esm/column-views.82eb5026.js.map +1 -1
  32. package/dist/esm/{column-views.6df65dab.js → column-views.8d972657.js} +3 -3
  33. package/dist/esm/{column-views.6df65dab.js.map → column-views.8d972657.js.map} +1 -1
  34. package/dist/esm/column-views.9ffc089b.js.map +1 -1
  35. package/dist/esm/{column-views.63d40878.js → column-views.a665cbb2.js} +2 -2
  36. package/dist/esm/{column-views.63d40878.js.map → column-views.a665cbb2.js.map} +1 -1
  37. package/dist/esm/{column-views.565b193a.js → column-views.b9265595.js} +2 -2
  38. package/dist/esm/{column-views.565b193a.js.map → column-views.b9265595.js.map} +1 -1
  39. package/dist/esm/{column-views.afe0bb48.js → column-views.b977da35.js} +3 -3
  40. package/dist/esm/{column-views.afe0bb48.js.map → column-views.b977da35.js.map} +1 -1
  41. package/dist/esm/{column-views.7fa0d026.js → column-views.d5fff9b8.js} +4 -5
  42. package/dist/esm/column-views.d5fff9b8.js.map +1 -0
  43. package/dist/esm/column-views.e075af15.js.map +1 -1
  44. package/dist/esm/{column-views.2708e176.js → column-views.e3f0cd7b.js} +6 -6
  45. package/dist/esm/{column-views.2708e176.js.map → column-views.e3f0cd7b.js.map} +1 -1
  46. package/dist/esm/{column-views.6c9e5069.js → column-views.ee9d71ba.js} +4 -5
  47. package/dist/esm/column-views.ee9d71ba.js.map +1 -0
  48. package/dist/esm/index.d.ts +68 -48
  49. package/dist/esm/index.d.ts.map +1 -1
  50. package/dist/esm/index.js +8 -8
  51. package/dist/node/{column-views.b40c1b9c.js → column-views.00ad98fa.js} +2 -2
  52. package/dist/node/{column-views.b40c1b9c.js.map → column-views.00ad98fa.js.map} +1 -1
  53. package/dist/node/{column-views.7cc1a14f.js → column-views.02869dc5.js} +2 -2
  54. package/dist/node/{column-views.7cc1a14f.js.map → column-views.02869dc5.js.map} +1 -1
  55. package/dist/node/{column-views.c9880a4d.js → column-views.0a2596c2.js} +2 -2
  56. package/dist/node/{column-views.c9880a4d.js.map → column-views.0a2596c2.js.map} +1 -1
  57. package/dist/node/{column-views.1d064426.js → column-views.3a947d58.js} +2 -2
  58. package/dist/node/{column-views.1d064426.js.map → column-views.3a947d58.js.map} +1 -1
  59. package/dist/node/{column-views.8ee8469d.js → column-views.3d0c2bea.js} +2 -2
  60. package/dist/node/{column-views.8ee8469d.js.map → column-views.3d0c2bea.js.map} +1 -1
  61. package/dist/node/column-views.46efb749.js.map +1 -1
  62. package/dist/node/column-views.4ec769a6.js +2 -0
  63. package/dist/node/column-views.4ec769a6.js.map +1 -0
  64. package/dist/node/{column-views.b103acbc.js → column-views.59ce629d.js} +2 -2
  65. package/dist/node/{column-views.b103acbc.js.map → column-views.59ce629d.js.map} +1 -1
  66. package/dist/node/column-views.5fd6e11a.js.map +1 -1
  67. package/dist/node/column-views.6556e004.js +2 -0
  68. package/dist/node/column-views.6556e004.js.map +1 -0
  69. package/dist/node/{column-views.a230263f.js → column-views.67e7a200.js} +2 -2
  70. package/dist/node/{column-views.a230263f.js.map → column-views.67e7a200.js.map} +1 -1
  71. package/dist/node/{column-views.d8821a96.js → column-views.6b391d60.js} +2 -2
  72. package/dist/node/{column-views.d8821a96.js.map → column-views.6b391d60.js.map} +1 -1
  73. package/dist/node/column-views.75456275.js.map +1 -1
  74. package/dist/node/{column-views.d77d260b.js → column-views.825d2719.js} +2 -2
  75. package/dist/node/{column-views.d77d260b.js.map → column-views.825d2719.js.map} +1 -1
  76. package/dist/node/{column-views.f577d065.js → column-views.868c04dc.js} +2 -2
  77. package/dist/node/{column-views.f577d065.js.map → column-views.868c04dc.js.map} +1 -1
  78. package/dist/node/column-views.8eae7028.js +2 -0
  79. package/dist/node/column-views.8eae7028.js.map +1 -0
  80. package/dist/node/column-views.8f540f78.js +2 -0
  81. package/dist/node/column-views.8f540f78.js.map +1 -0
  82. package/dist/node/column-views.9efa91f1.js +2 -0
  83. package/dist/node/column-views.9efa91f1.js.map +1 -0
  84. package/dist/node/column-views.c007152b.js.map +1 -1
  85. package/dist/node/{column-views.ec691859.js → column-views.c4188442.js} +2 -2
  86. package/dist/node/{column-views.ec691859.js.map → column-views.c4188442.js.map} +1 -1
  87. package/dist/node/{column-views.56f88b8c.js → column-views.dfe9a971.js} +2 -2
  88. package/dist/node/{column-views.56f88b8c.js.map → column-views.dfe9a971.js.map} +1 -1
  89. package/dist/node/column-views.e153680b.js +2 -0
  90. package/dist/node/column-views.e153680b.js.map +1 -0
  91. package/dist/node/{column-views.42bc66a8.js → column-views.ed2fd268.js} +2 -2
  92. package/dist/node/{column-views.42bc66a8.js.map → column-views.ed2fd268.js.map} +1 -1
  93. package/dist/node/{column-views.5559de6a.js → column-views.fafbc028.js} +2 -2
  94. package/dist/node/{column-views.5559de6a.js.map → column-views.fafbc028.js.map} +1 -1
  95. package/dist/node/{column-views.6c7f9245.js → column-views.fee4e65d.js} +2 -2
  96. package/dist/node/{column-views.6c7f9245.js.map → column-views.fee4e65d.js.map} +1 -1
  97. package/dist/node/index.js +1 -1
  98. package/dist/node/index.js.map +1 -1
  99. package/package.json +6 -6
  100. package/src/data-provider/base.ts +1 -0
  101. package/src/data-provider/store.ts +1 -1
  102. package/src/facets/carbon-isotopes/isotopes-column.ts +2 -2
  103. package/src/facets/fossils/index.ts +19 -12
  104. package/src/facets/fossils/provider.ts +30 -17
  105. package/src/facets/fossils/taxon-ranges.ts +14 -7
  106. package/src/facets/measurements/base.ts +7 -3
  107. package/src/facets/measurements/sgp.ts +4 -5
  108. package/src/prepare-units/index.ts +2 -0
  109. package/src/unit-details/panel.ts +12 -10
  110. package/src/units/composite.ts +4 -10
  111. package/src/units/names.ts +26 -28
  112. package/dist/esm/column-views.322790f3.js.map +0 -1
  113. package/dist/esm/column-views.343fc926.js.map +0 -1
  114. package/dist/esm/column-views.40094dd9.js.map +0 -1
  115. package/dist/esm/column-views.5eb4e6ff.js.map +0 -1
  116. package/dist/esm/column-views.6c9e5069.js.map +0 -1
  117. package/dist/esm/column-views.7fa0d026.js.map +0 -1
  118. package/dist/esm/column-views.de433f18.js.map +0 -1
  119. package/dist/esm/column-views.fba36cbb.js +0 -13
  120. package/dist/node/column-views.5cb51833.js +0 -2
  121. package/dist/node/column-views.5cb51833.js.map +0 -1
  122. package/dist/node/column-views.93bde6c1.js +0 -2
  123. package/dist/node/column-views.93bde6c1.js.map +0 -1
  124. package/dist/node/column-views.af480651.js +0 -2
  125. package/dist/node/column-views.af480651.js.map +0 -1
  126. package/dist/node/column-views.b6e86cf0.js +0 -2
  127. package/dist/node/column-views.b6e86cf0.js.map +0 -1
  128. package/dist/node/column-views.ec7cc7cc.js +0 -2
  129. package/dist/node/column-views.ec7cc7cc.js.map +0 -1
  130. package/dist/node/column-views.fac4baff.js +0 -2
  131. package/dist/node/column-views.fac4baff.js.map +0 -1
@@ -1 +1 @@
1
- {"mappings":"A,M,6C,A,Q,U,C,K,mB,A,Q,iB,C,K,2B,A,Q,M,mB,C,I,E,W,E,C,E,E,C,E,E,E,iB,A,O,I,A,C,E,S,C,E,G,K,E,O,C,C,E,C,O,C,G,K,E,C,I,E,C,C,E,A,Q,C,C,E,C,I,E,C,G,E,Q,C,C,E,O,C,C,E,C,E,E,I,C,E,O,C,E,E,O,E,E,O,A,C,I,E,A,M,uB,E,I,O,E,I,C,mB,C,C,E,Q,C,S,C,C,C,E,C,C,E,C,C,E,E,iB,C,G,E,Q,C,O,c,C,C,E,iC,C,I,I,E,I,K,E,W,C,E,a,C,C,G,I,E,E,SCKO,SAAS,EAA+B,CAAK,EAClD,GAAM,CAAA,SAAE,CAAQ,CAAA,UAAE,CAAS,CAAA,aAAE,CAAY,CAAA,aAAE,CAAY,CAAA,SAAE,CAAQ,CAAE,GAAG,EAAM,CAC1E,EAEI,EAAK,GAAU,UACnB,AAAC,GAAS,EAAK,OAAO,GAAK,GAAc,SAGrC,EAAS,CACb,GAAI,EAAK,EACT,GAAI,EAAK,CACX,EAYA,GAVA,AAAA,EACE,AAAC,IACC,IAAM,EAAS,CAAM,CAAC,EAAM,OAAO,CAAC,AACtB,OAAV,GAAkB,EAAS,GAAK,GAAU,EAAS,MAAM,GAC7D,EAAa,CAAQ,CAAC,EAAO,CAAC,OAAO,EACrC,EAAM,eAAe,GACvB,EACA,CAAC,EAAU,EAAG,EAGZ,AAAgB,MAAhB,EAAsB,OAAO,KAEjC,IAAM,EAAU,AAAA,EAAE,CAChB,AAAA,EAAE,EAAQ,CACR,KAAM,WACN,SAAU,AAAO,IAAP,EACV,UACE,EAAa,CAAQ,CAAC,EAAK,EAAE,EAAE,QACjC,CACF,GACA,AAAA,EAAE,EAAQ,CACR,KAAM,aACN,SAAU,IAAO,EAAS,MAAM,CAAG,EACnC,UACE,EAAa,CAAQ,CAAC,EAAK,EAAE,EAAE,QACjC,CACF,GACD,EAED,OAAO,AAAA,EAAE,EAAA,gBAAe,CAAG,CACzB,KAAM,EACN,QAAQ,CAAK,EACX,EAAa,KACf,EACA,UAAA,EACA,QAAA,EACA,yBAA0B,CAAA,EAC1B,WAAY,EACZ,YAAa,EACb,SAAA,EACA,GAAG,CAAI,AACT,EACF,Q,K,8B","sources":["<anon>","packages/column-views/src/unit-details/modal-panel.ts"],"sourcesContent":["import \"./column-views.6c7f9245.js\";\nimport {Button as $cvq79$Button} from \"@blueprintjs/core\";\nimport {useKeyHandler as $cvq79$useKeyHandler} from \"@macrostrat/ui-components\";\nimport $cvq79$macrostrathyper from \"@macrostrat/hyper\";\n\n\nfunction $parcel$export(e, n, v, s) {\n Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});\n}\n\n var $parcel$global = globalThis;\n \nvar $parcel$modules = {};\nvar $parcel$inits = {};\n\nvar parcelRequire = $parcel$global[\"parcelRequirea149\"];\n\nif (parcelRequire == null) {\n parcelRequire = function(id) {\n if (id in $parcel$modules) {\n return $parcel$modules[id].exports;\n }\n if (id in $parcel$inits) {\n var init = $parcel$inits[id];\n delete $parcel$inits[id];\n var module = {id: id, exports: {}};\n $parcel$modules[id] = module;\n init.call(module.exports, module, module.exports);\n return module.exports;\n }\n var err = new Error(\"Cannot find module '\" + id + \"'\");\n err.code = 'MODULE_NOT_FOUND';\n throw err;\n };\n\n parcelRequire.register = function register(id, init) {\n $parcel$inits[id] = init;\n };\n\n $parcel$global[\"parcelRequirea149\"] = parcelRequire;\n}\n\nvar parcelRegister = parcelRequire.register;\nvar $a8b0b0b16d1f0073$exports = {};\n\n$parcel$export($a8b0b0b16d1f0073$exports, \"UnitDetailsPanelWithNavigation\", () => $a8b0b0b16d1f0073$export$cfdbe8496aa51962);\n\n\nvar $iYfAq = parcelRequire(\"iYfAq\");\n\n\nfunction $a8b0b0b16d1f0073$export$cfdbe8496aa51962(props) {\n const { unitData: unitData, className: className, selectedUnit: selectedUnit, onSelectUnit: onSelectUnit, features: features, ...rest } = props;\n const ix = unitData?.findIndex((unit)=>unit.unit_id === selectedUnit?.unit_id);\n const keyMap = {\n 38: ix - 1,\n 40: ix + 1\n };\n (0, $cvq79$useKeyHandler)((event)=>{\n const nextIx = keyMap[event.keyCode];\n if (nextIx == null || nextIx < 0 || nextIx >= unitData.length) return;\n onSelectUnit(unitData[nextIx].unit_id);\n event.stopPropagation();\n }, [\n unitData,\n ix\n ]);\n if (selectedUnit == null) return null;\n const actions = (0, $cvq79$macrostrathyper)([\n (0, $cvq79$macrostrathyper)((0, $cvq79$Button), {\n icon: \"arrow-up\",\n disabled: ix === 0,\n onClick () {\n onSelectUnit(unitData[ix - 1]?.unit_id);\n }\n }),\n (0, $cvq79$macrostrathyper)((0, $cvq79$Button), {\n icon: \"arrow-down\",\n disabled: ix === unitData.length - 1,\n onClick () {\n onSelectUnit(unitData[ix + 1]?.unit_id);\n }\n })\n ]);\n return (0, $cvq79$macrostrathyper)((0, $iYfAq.UnitDetailsPanel), {\n unit: selectedUnit,\n onClose (event) {\n onSelectUnit(null);\n },\n className: className,\n actions: actions,\n showLithologyProportions: true,\n selectUnit: onSelectUnit,\n columnUnits: unitData,\n features: features,\n ...rest\n });\n}\n\n\nexport {$a8b0b0b16d1f0073$export$cfdbe8496aa51962 as UnitDetailsPanelWithNavigation};\n//# sourceMappingURL=column-views.c9880a4d.js.map\n","import { Button } from \"@blueprintjs/core\";\nimport { UnitDetailsPanel } from \"./panel\";\nimport { useKeyHandler } from \"@macrostrat/ui-components\";\nimport h from \"@macrostrat/hyper\";\n\nexport function UnitDetailsPanelWithNavigation(props) {\n const { unitData, className, selectedUnit, onSelectUnit, features, ...rest } =\n props;\n\n const ix = unitData?.findIndex(\n (unit) => unit.unit_id === selectedUnit?.unit_id,\n );\n\n const keyMap = {\n 38: ix - 1,\n 40: ix + 1,\n };\n\n useKeyHandler(\n (event) => {\n const nextIx = keyMap[event.keyCode];\n if (nextIx == null || nextIx < 0 || nextIx >= unitData.length) return;\n onSelectUnit(unitData[nextIx].unit_id);\n event.stopPropagation();\n },\n [unitData, ix],\n );\n\n if (selectedUnit == null) return null;\n\n const actions = h([\n h(Button, {\n icon: \"arrow-up\",\n disabled: ix === 0,\n onClick() {\n onSelectUnit(unitData[ix - 1]?.unit_id);\n },\n }),\n h(Button, {\n icon: \"arrow-down\",\n disabled: ix === unitData.length - 1,\n onClick() {\n onSelectUnit(unitData[ix + 1]?.unit_id);\n },\n }),\n ]);\n\n return h(UnitDetailsPanel, {\n unit: selectedUnit,\n onClose(event) {\n onSelectUnit(null);\n },\n className,\n actions,\n showLithologyProportions: true,\n selectUnit: onSelectUnit,\n columnUnits: unitData,\n features,\n ...rest,\n });\n}\n"],"names":["Button","$cvq79$Button","useKeyHandler","$cvq79$useKeyHandler","$cvq79$macrostrathyper","$parcel$global","globalThis","$parcel$modules","$parcel$inits","parcelRequire","id","exports","init","module","call","err","Error","code","register","Object","defineProperty","get","$a8b0b0b16d1f0073$export$cfdbe8496aa51962","set","s","enumerable","configurable","$iYfAq","props","unitData","className","selectedUnit","onSelectUnit","features","rest","ix","findIndex","unit","unit_id","keyMap","event","nextIx","keyCode","length","stopPropagation","actions","icon","disabled","onClick","UnitDetailsPanel","onClose","showLithologyProportions","selectUnit","columnUnits","UnitDetailsPanelWithNavigation"],"version":3,"file":"column-views.c9880a4d.js.map","sourceRoot":"../../../../"}
1
+ {"mappings":"A,M,6C,A,Q,U,C,K,mB,A,Q,iB,C,K,2B,A,Q,M,mB,C,I,E,W,E,C,E,E,C,E,E,E,iB,A,O,I,A,C,E,S,C,E,G,K,E,O,C,C,E,C,O,C,G,K,E,C,I,E,C,C,E,A,Q,C,C,E,C,I,E,C,G,E,Q,C,C,E,O,C,C,E,C,E,E,I,C,E,O,C,E,E,O,E,E,O,A,C,I,E,A,M,uB,E,I,O,E,I,C,mB,C,C,E,Q,C,S,C,C,C,E,C,C,E,C,C,E,E,iB,C,G,E,Q,C,O,c,C,C,E,iC,C,I,I,E,I,K,E,W,C,E,a,C,C,G,I,E,E,SCKO,SAAS,EAA+B,CAAK,EAClD,GAAM,CAAA,SAAE,CAAQ,CAAA,UAAE,CAAS,CAAA,aAAE,CAAY,CAAA,aAAE,CAAY,CAAA,SAAE,CAAQ,CAAE,GAAG,EAAM,CAC1E,EAEI,EAAK,GAAU,UACnB,AAAC,GAAS,EAAK,OAAO,GAAK,GAAc,SAGrC,EAAS,CACb,GAAI,EAAK,EACT,GAAI,EAAK,CACX,EAYA,GAVA,AAAA,EACE,AAAC,IACC,IAAM,EAAS,CAAM,CAAC,EAAM,OAAO,CAAC,AACtB,OAAV,GAAkB,EAAS,GAAK,GAAU,EAAS,MAAM,GAC7D,EAAa,CAAQ,CAAC,EAAO,CAAC,OAAO,EACrC,EAAM,eAAe,GACvB,EACA,CAAC,EAAU,EAAG,EAGZ,AAAgB,MAAhB,EAAsB,OAAO,KAEjC,IAAM,EAAU,AAAA,EAAE,CAChB,AAAA,EAAE,EAAQ,CACR,KAAM,WACN,SAAU,AAAO,IAAP,EACV,UACE,EAAa,CAAQ,CAAC,EAAK,EAAE,EAAE,QACjC,CACF,GACA,AAAA,EAAE,EAAQ,CACR,KAAM,aACN,SAAU,IAAO,EAAS,MAAM,CAAG,EACnC,UACE,EAAa,CAAQ,CAAC,EAAK,EAAE,EAAE,QACjC,CACF,GACD,EAED,OAAO,AAAA,EAAE,EAAA,gBAAe,CAAG,CACzB,KAAM,EACN,QAAQ,CAAK,EACX,EAAa,KACf,EACA,UAAA,EACA,QAAA,EACA,yBAA0B,CAAA,EAC1B,WAAY,EACZ,YAAa,EACb,SAAA,EACA,GAAG,CAAI,AACT,EACF,Q,K,8B","sources":["<anon>","packages/column-views/src/unit-details/modal-panel.ts"],"sourcesContent":["import \"./column-views.fee4e65d.js\";\nimport {Button as $cvq79$Button} from \"@blueprintjs/core\";\nimport {useKeyHandler as $cvq79$useKeyHandler} from \"@macrostrat/ui-components\";\nimport $cvq79$macrostrathyper from \"@macrostrat/hyper\";\n\n\nfunction $parcel$export(e, n, v, s) {\n Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});\n}\n\n var $parcel$global = globalThis;\n \nvar $parcel$modules = {};\nvar $parcel$inits = {};\n\nvar parcelRequire = $parcel$global[\"parcelRequirea149\"];\n\nif (parcelRequire == null) {\n parcelRequire = function(id) {\n if (id in $parcel$modules) {\n return $parcel$modules[id].exports;\n }\n if (id in $parcel$inits) {\n var init = $parcel$inits[id];\n delete $parcel$inits[id];\n var module = {id: id, exports: {}};\n $parcel$modules[id] = module;\n init.call(module.exports, module, module.exports);\n return module.exports;\n }\n var err = new Error(\"Cannot find module '\" + id + \"'\");\n err.code = 'MODULE_NOT_FOUND';\n throw err;\n };\n\n parcelRequire.register = function register(id, init) {\n $parcel$inits[id] = init;\n };\n\n $parcel$global[\"parcelRequirea149\"] = parcelRequire;\n}\n\nvar parcelRegister = parcelRequire.register;\nvar $a8b0b0b16d1f0073$exports = {};\n\n$parcel$export($a8b0b0b16d1f0073$exports, \"UnitDetailsPanelWithNavigation\", () => $a8b0b0b16d1f0073$export$cfdbe8496aa51962);\n\n\nvar $iYfAq = parcelRequire(\"iYfAq\");\n\n\nfunction $a8b0b0b16d1f0073$export$cfdbe8496aa51962(props) {\n const { unitData: unitData, className: className, selectedUnit: selectedUnit, onSelectUnit: onSelectUnit, features: features, ...rest } = props;\n const ix = unitData?.findIndex((unit)=>unit.unit_id === selectedUnit?.unit_id);\n const keyMap = {\n 38: ix - 1,\n 40: ix + 1\n };\n (0, $cvq79$useKeyHandler)((event)=>{\n const nextIx = keyMap[event.keyCode];\n if (nextIx == null || nextIx < 0 || nextIx >= unitData.length) return;\n onSelectUnit(unitData[nextIx].unit_id);\n event.stopPropagation();\n }, [\n unitData,\n ix\n ]);\n if (selectedUnit == null) return null;\n const actions = (0, $cvq79$macrostrathyper)([\n (0, $cvq79$macrostrathyper)((0, $cvq79$Button), {\n icon: \"arrow-up\",\n disabled: ix === 0,\n onClick () {\n onSelectUnit(unitData[ix - 1]?.unit_id);\n }\n }),\n (0, $cvq79$macrostrathyper)((0, $cvq79$Button), {\n icon: \"arrow-down\",\n disabled: ix === unitData.length - 1,\n onClick () {\n onSelectUnit(unitData[ix + 1]?.unit_id);\n }\n })\n ]);\n return (0, $cvq79$macrostrathyper)((0, $iYfAq.UnitDetailsPanel), {\n unit: selectedUnit,\n onClose (event) {\n onSelectUnit(null);\n },\n className: className,\n actions: actions,\n showLithologyProportions: true,\n selectUnit: onSelectUnit,\n columnUnits: unitData,\n features: features,\n ...rest\n });\n}\n\n\nexport {$a8b0b0b16d1f0073$export$cfdbe8496aa51962 as UnitDetailsPanelWithNavigation};\n//# sourceMappingURL=column-views.0a2596c2.js.map\n","import { Button } from \"@blueprintjs/core\";\nimport { UnitDetailsPanel } from \"./panel\";\nimport { useKeyHandler } from \"@macrostrat/ui-components\";\nimport h from \"@macrostrat/hyper\";\n\nexport function UnitDetailsPanelWithNavigation(props) {\n const { unitData, className, selectedUnit, onSelectUnit, features, ...rest } =\n props;\n\n const ix = unitData?.findIndex(\n (unit) => unit.unit_id === selectedUnit?.unit_id,\n );\n\n const keyMap = {\n 38: ix - 1,\n 40: ix + 1,\n };\n\n useKeyHandler(\n (event) => {\n const nextIx = keyMap[event.keyCode];\n if (nextIx == null || nextIx < 0 || nextIx >= unitData.length) return;\n onSelectUnit(unitData[nextIx].unit_id);\n event.stopPropagation();\n },\n [unitData, ix],\n );\n\n if (selectedUnit == null) return null;\n\n const actions = h([\n h(Button, {\n icon: \"arrow-up\",\n disabled: ix === 0,\n onClick() {\n onSelectUnit(unitData[ix - 1]?.unit_id);\n },\n }),\n h(Button, {\n icon: \"arrow-down\",\n disabled: ix === unitData.length - 1,\n onClick() {\n onSelectUnit(unitData[ix + 1]?.unit_id);\n },\n }),\n ]);\n\n return h(UnitDetailsPanel, {\n unit: selectedUnit,\n onClose(event) {\n onSelectUnit(null);\n },\n className,\n actions,\n showLithologyProportions: true,\n selectUnit: onSelectUnit,\n columnUnits: unitData,\n features,\n ...rest,\n });\n}\n"],"names":["Button","$cvq79$Button","useKeyHandler","$cvq79$useKeyHandler","$cvq79$macrostrathyper","$parcel$global","globalThis","$parcel$modules","$parcel$inits","parcelRequire","id","exports","init","module","call","err","Error","code","register","Object","defineProperty","get","$a8b0b0b16d1f0073$export$cfdbe8496aa51962","set","s","enumerable","configurable","$iYfAq","props","unitData","className","selectedUnit","onSelectUnit","features","rest","ix","findIndex","unit","unit_id","keyMap","event","nextIx","keyCode","length","stopPropagation","actions","icon","disabled","onClick","UnitDetailsPanel","onClose","showLithologyProportions","selectUnit","columnUnits","UnitDetailsPanelWithNavigation"],"version":3,"file":"column-views.0a2596c2.js.map","sourceRoot":"../../../../"}
@@ -1,2 +1,2 @@
1
- import"./column-views.012fa10c.js";import"./column-views.dbb4a46b.js";import"./column-views.7cc1a14f.js";import e from"@macrostrat/hyper";import{ColumnAxisType as t}from"@macrostrat/column-components";function n(e,t,n,i){Object.defineProperty(e,t,{get:n,set:i,enumerable:!0,configurable:!0})}var i=globalThis,o={},r={},a=i.parcelRequirea149;null==a&&((a=function(e){if(e in o)return o[e].exports;if(e in r){var t=r[e];delete r[e];var n={id:e,exports:{}};return o[e]=n,t.call(n.exports,n,n.exports),n.exports}var i=Error("Cannot find module '"+e+"'");throw i.code="MODULE_NOT_FOUND",i}).register=function(e,t){r[e]=t},i.parcelRequirea149=a),a.register;var h={};n(h,"standardizeMeasurementHeight",()=>m),n(h,"mergeHeightRanges",()=>g),n(h,"BaseMeasurementsColumn",()=>p),n(h,"TruncatedList",()=>c),n(h,"groupNotesByPixelDistance",()=>f);var l=a("ff1AM"),s=a("iWhRv"),u=a("6KYbn");let d=e.styled(l&&l.__esModule?l.default:l);function m(e,t,n){if("height"in e)return e;let i=t.find(t=>t.unit_id===e.unit_id);if(null==i)return null;if(null!=e.unit_rel_pos){let t=(0,s.getPositionWithinUnit)(e.unit_rel_pos,i,n);return null==t?null:{height:t}}{let[e,t]=(0,s.getUnitHeightRange)(i,n);return{height:e,top_height:t}}}function g(e,n){let i,o,r=[];for(let t of e)r.push(t.height),null!=t.top_height&&r.push(t.top_height);return(n===t.AGE||n===t.DEPTH?(i=Math.max(...r),o=Math.min(...r)):(i=Math.min(...r),o=Math.max(...r)),o===i)?{height:i}:{height:i,top_height:o}}function p({data:e,noteComponent:t,width:n=500,paddingLeft:i=40,className:o,deltaConnectorAttachment:r,focusedNoteComponent:a}){return null==e?null:d("div.measurements-column",{className:o},d(u.ColumnNotes,{width:n,paddingLeft:i,notes:e,noteComponent:t,deltaConnectorAttachment:r,focusedNoteComponent:a}))}function c({data:e,className:t,maxItems:n=5,itemRenderer:i=e=>d("span",e.data)}){let o=null,r=e;if(e.length>n){let t=e.length-n;r=e.slice(0,n),o=d("li.too-many",`and ${t} more`)}return d("ul.truncated-list",{className:t},[r.map((e,t)=>d("li.element",{key:t},d(i,{data:e}))),o])}function f(e,n,i,o){if(0===e.length||o<=0)return e;i===t.AGE||i===t.DEPTH?e.sort((e,t)=>t.height-e.height):e.sort((e,t)=>e.height-t.height);let r=[],a=null,h=1/0;for(let l of e)if(h-n(l.top_height??l.height)<=o){if(null==a)throw Error("Current group is null when it shouldn't be");a.data.push(...l.data);let e=l.top_height??l.height;i===t.AGE||i===t.DEPTH?a.top_height=Math.min(a.top_height,e):a.top_height=Math.max(a.top_height,e),a.key=`${a.height}-${a.top_height}`}else h=n((a={...l,data:[...l.data]}).height)??n(a.top_height)??1/0,r.push(a);return r}export{m as standardizeMeasurementHeight,g as mergeHeightRanges,p as BaseMeasurementsColumn,c as TruncatedList,f as groupNotesByPixelDistance};
2
- //# sourceMappingURL=column-views.1d064426.js.map
1
+ import"./column-views.012fa10c.js";import"./column-views.dbb4a46b.js";import"./column-views.02869dc5.js";import e from"@macrostrat/hyper";import{ColumnAxisType as t}from"@macrostrat/column-components";function n(e,t,n,i){Object.defineProperty(e,t,{get:n,set:i,enumerable:!0,configurable:!0})}var i=globalThis,o={},r={},a=i.parcelRequirea149;null==a&&((a=function(e){if(e in o)return o[e].exports;if(e in r){var t=r[e];delete r[e];var n={id:e,exports:{}};return o[e]=n,t.call(n.exports,n,n.exports),n.exports}var i=Error("Cannot find module '"+e+"'");throw i.code="MODULE_NOT_FOUND",i}).register=function(e,t){r[e]=t},i.parcelRequirea149=a),a.register;var h={};n(h,"standardizeMeasurementHeight",()=>m),n(h,"mergeHeightRanges",()=>g),n(h,"BaseMeasurementsColumn",()=>p),n(h,"TruncatedList",()=>c),n(h,"groupNotesByPixelDistance",()=>f);var l=a("ff1AM"),s=a("iWhRv"),u=a("6KYbn");let d=e.styled(l&&l.__esModule?l.default:l);function m(e,t,n){if("height"in e)return e;let i=t.find(t=>t.unit_id===e.unit_id);if(null==i)return null;if(null!=e.unit_rel_pos){let t=(0,s.getPositionWithinUnit)(e.unit_rel_pos,i,n);return null==t?null:{height:t}}{let[e,t]=(0,s.getUnitHeightRange)(i,n);return{height:e,top_height:t}}}function g(e,n){let i,o,r=[];for(let t of e)r.push(t.height),null!=t.top_height&&r.push(t.top_height);return(n===t.AGE||n===t.DEPTH?(i=Math.max(...r),o=Math.min(...r)):(i=Math.min(...r),o=Math.max(...r)),o===i)?{height:i}:{height:i,top_height:o}}function p({data:e,noteComponent:t,width:n=500,paddingLeft:i=40,className:o,deltaConnectorAttachment:r,focusedNoteComponent:a}){return null==e?null:d("div.measurements-column",{className:o},d(u.ColumnNotes,{width:n,paddingLeft:i,notes:e,noteComponent:t,deltaConnectorAttachment:r,focusedNoteComponent:a}))}function c({data:e,className:t,maxItems:n=5,itemRenderer:i=e=>d("span",e.data)}){let o=null,r=e;if(e.length>n){let t=e.length-n;r=e.slice(0,n),o=d("li.too-many",`and ${t} more`)}return d("ul.truncated-list",{className:t},[r.map((e,t)=>d("li.element",{key:t},d(i,{data:e}))),o])}function f(e,n,i,o){if(0===e.length||o<=0)return e;i===t.AGE||i===t.DEPTH?e.sort((e,t)=>t.height-e.height):e.sort((e,t)=>e.height-t.height);let r=[],a=null,h=1/0;for(let l of e)if(h-n(l.top_height??l.height)<=o){if(null==a)throw Error("Current group is null when it shouldn't be");a.data.push(...l.data);let e=l.top_height??l.height;i===t.AGE||i===t.DEPTH?a.top_height=Math.min(a.top_height,e):a.top_height=Math.max(a.top_height,e),a.id=`${a.height}-${a.top_height}`}else h=n((a={...l,data:[...l.data]}).height)??n(a.top_height)??1/0,r.push(a);return r}export{m as standardizeMeasurementHeight,g as mergeHeightRanges,p as BaseMeasurementsColumn,c as TruncatedList,f as groupNotesByPixelDistance};
2
+ //# sourceMappingURL=column-views.3a947d58.js.map
@@ -1 +1 @@
1
- {"mappings":"A,M,6C,A,O,6C,A,O,6C,A,Q,M,mB,A,Q,kB,C,K,+B,C,S,E,C,C,C,C,C,C,C,E,O,c,C,E,E,C,I,E,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,EAAG,OAAO,CAChD,CAAA,IAAa,AAAA,EAAe,GAAG,EAAI,IAAa,AAAA,EAAe,KAAK,CACtE,EAAK,IAAI,CAAC,CAAC,EAAG,IAAM,EAAE,MAAM,CAAG,EAAE,MAAM,EAGvC,EAAK,IAAI,CAAC,CAAC,EAAG,IAAM,EAAE,MAAM,CAAG,EAAE,MAAM,EAGzC,IAAM,EAA4C,EAAE,CAChD,EAAkD,KAClD,EAA+B,IAEnC,IAAK,IAAM,KAAK,EASd,GAAI,AAFa,EAAuB,EAAM,EAAE,UAAU,EAAI,EAAE,MAAM,GAEtD,EAAe,CAC7B,GAAI,AAAgB,MAAhB,EACF,MAAM,AAAI,MAAM,8CAGlB,EAAa,IAAI,CAAC,IAAI,IAAI,EAAE,IAAI,EAEhC,IAAM,EAAa,EAAE,UAAU,EAAI,EAAE,MAAM,AAEzC,CAAA,IAAa,AAAA,EAAe,GAAG,EAC/B,IAAa,AAAA,EAAe,KAAK,CAGjC,EAAa,UAAU,CAAG,KAAK,GAAG,CAAC,EAAa,UAAU,CAAE,GAE5D,EAAa,UAAU,CAAG,KAAK,GAAG,CAAC,EAAa,UAAU,CAAE,GAE9D,EAAa,GAAG,CAAG,CAAA,EAAG,EAAa,MAAM,CAAC,CAAC,EAAE,EAAa,UAAU,CAAA,CAAE,AACxE,MAGE,EACE,EAAM,AAFR,CAAA,EAAe,CAAE,GAAG,CAAC,CAAE,KAAM,IAAI,EAAE,IAAI,CAAC,AAAC,CAAA,EAEpB,MAAM,GACzB,EAAM,EAAa,UAAU,GAC7B,IACF,EAAY,IAAI,CAAC,GAIrB,OAAO,CACT,Q,K,4B,C,K,iB,C,K,sB,C,K,a,C,K,yB","sources":["<anon>","packages/column-views/src/facets/measurements/base.ts"],"sourcesContent":["import \"./column-views.012fa10c.js\";\nimport \"./column-views.dbb4a46b.js\";\nimport \"./column-views.7cc1a14f.js\";\nimport $7Z3it$macrostrathyper from \"@macrostrat/hyper\";\nimport {ColumnAxisType as $7Z3it$ColumnAxisType} from \"@macrostrat/column-components\";\n\n\nfunction $parcel$interopDefault(a) {\n return a && a.__esModule ? a.default : a;\n}\n\nfunction $parcel$export(e, n, v, s) {\n Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});\n}\n\n var $parcel$global = globalThis;\n \nvar $parcel$modules = {};\nvar $parcel$inits = {};\n\nvar parcelRequire = $parcel$global[\"parcelRequirea149\"];\n\nif (parcelRequire == null) {\n parcelRequire = function(id) {\n if (id in $parcel$modules) {\n return $parcel$modules[id].exports;\n }\n if (id in $parcel$inits) {\n var init = $parcel$inits[id];\n delete $parcel$inits[id];\n var module = {id: id, exports: {}};\n $parcel$modules[id] = module;\n init.call(module.exports, module, module.exports);\n return module.exports;\n }\n var err = new Error(\"Cannot find module '\" + id + \"'\");\n err.code = 'MODULE_NOT_FOUND';\n throw err;\n };\n\n parcelRequire.register = function register(id, init) {\n $parcel$inits[id] = init;\n };\n\n $parcel$global[\"parcelRequirea149\"] = parcelRequire;\n}\n\nvar parcelRegister = parcelRequire.register;\nvar $7e05644cbb5d2dbb$exports = {};\n\n$parcel$export($7e05644cbb5d2dbb$exports, \"standardizeMeasurementHeight\", () => $7e05644cbb5d2dbb$export$9d101e1fcb2166a6);\n$parcel$export($7e05644cbb5d2dbb$exports, \"mergeHeightRanges\", () => $7e05644cbb5d2dbb$export$8f2afa8ddee7317e);\n$parcel$export($7e05644cbb5d2dbb$exports, \"BaseMeasurementsColumn\", () => $7e05644cbb5d2dbb$export$ce5c4f2fdf4e644d);\n$parcel$export($7e05644cbb5d2dbb$exports, \"TruncatedList\", () => $7e05644cbb5d2dbb$export$653e47a7a0da0f0d);\n$parcel$export($7e05644cbb5d2dbb$exports, \"groupNotesByPixelDistance\", () => $7e05644cbb5d2dbb$export$4e649f790614b299);\n\n\nvar $ff1AM = parcelRequire(\"ff1AM\");\n\nvar $iWhRv = parcelRequire(\"iWhRv\");\n\nvar $6KYbn = parcelRequire(\"6KYbn\");\n\nconst $7e05644cbb5d2dbb$var$h = (0, $7Z3it$macrostrathyper).styled((0, (/*@__PURE__*/$parcel$interopDefault($ff1AM))));\nfunction $7e05644cbb5d2dbb$export$9d101e1fcb2166a6(pos, units, axisType) {\n /** Get a standardized height representation from position information for\n * a measurement\n */ if (\"height\" in pos) return pos;\n const unit = units.find((u)=>u.unit_id === pos.unit_id);\n if (unit == null) return null;\n if (pos.unit_rel_pos != null) {\n const res = (0, $iWhRv.getPositionWithinUnit)(pos.unit_rel_pos, unit, axisType);\n if (res == null) return null;\n return {\n height: res\n };\n } else {\n const [height, top_height] = (0, $iWhRv.getUnitHeightRange)(unit, axisType);\n return {\n height: height,\n top_height: top_height\n };\n }\n}\nfunction $7e05644cbb5d2dbb$export$8f2afa8ddee7317e(data, axisType) {\n /** Merge multiple height ranges into a single range */ const heights = [];\n for (const d of data){\n heights.push(d.height);\n if (d.top_height != null) heights.push(d.top_height);\n }\n let height;\n let top_height;\n if (axisType === (0, $7Z3it$ColumnAxisType).AGE || axisType === (0, $7Z3it$ColumnAxisType).DEPTH) {\n height = Math.max(...heights);\n top_height = Math.min(...heights);\n } else {\n height = Math.min(...heights);\n top_height = Math.max(...heights);\n }\n if (top_height === height) return {\n height: height\n };\n return {\n height: height,\n top_height: top_height\n };\n}\nfunction $7e05644cbb5d2dbb$export$ce5c4f2fdf4e644d({ data: data, noteComponent: noteComponent, width: width = 500, paddingLeft: paddingLeft = 40, className: className, deltaConnectorAttachment: deltaConnectorAttachment, focusedNoteComponent: focusedNoteComponent }) {\n if (data == null) return null;\n return $7e05644cbb5d2dbb$var$h(\"div.measurements-column\", {\n className: className\n }, $7e05644cbb5d2dbb$var$h((0, $6KYbn.ColumnNotes), {\n width: width,\n paddingLeft: paddingLeft,\n notes: data,\n noteComponent: noteComponent,\n deltaConnectorAttachment: deltaConnectorAttachment,\n focusedNoteComponent: focusedNoteComponent\n }));\n}\nfunction $7e05644cbb5d2dbb$export$653e47a7a0da0f0d({ data: data, className: className, maxItems: maxItems = 5, itemRenderer: itemRenderer = (p)=>$7e05644cbb5d2dbb$var$h(\"span\", p.data) }) {\n let tooMany = null;\n let d1 = data;\n if (data.length > maxItems) {\n const n = data.length - maxItems;\n d1 = data.slice(0, maxItems);\n tooMany = $7e05644cbb5d2dbb$var$h(\"li.too-many\", `and ${n} more`);\n }\n return $7e05644cbb5d2dbb$var$h(\"ul.truncated-list\", {\n className: className\n }, [\n d1.map((d, i)=>{\n return $7e05644cbb5d2dbb$var$h(\"li.element\", {\n key: i\n }, $7e05644cbb5d2dbb$var$h(itemRenderer, {\n data: d\n }));\n }),\n tooMany\n ]);\n}\nfunction $7e05644cbb5d2dbb$export$4e649f790614b299(data, scale, axisType, groupDistance) {\n /** Group notes that are within a certain pixel distance of each other\n * in display space\n */ if (data.length === 0 || groupDistance <= 0) return data;\n if (axisType === (0, $7Z3it$ColumnAxisType).AGE || axisType === (0, $7Z3it$ColumnAxisType).DEPTH) data.sort((a, b)=>b.height - a.height);\n else // Sort data by height (ascending up the column)\n data.sort((a, b)=>a.height - b.height);\n const groupedData = [];\n let currentGroup = null;\n let currentGroupPosition = Infinity;\n for (const d of data){\n // Check distance from current max position\n // Pixels go up as we go down in the section\n // The _top_ of the next group must be within groupDistance of the\n // _bottom_ of the current group. This makes sure that we don't collapse\n // groups that are separated by a large distance\n const distance = currentGroupPosition - scale(d.top_height ?? d.height);\n if (distance <= groupDistance) {\n if (currentGroup == null) throw new Error(\"Current group is null when it shouldn't be\");\n // Merge into current group\n currentGroup.data.push(...d.data);\n // Update height range\n const top_height = d.top_height ?? d.height;\n if (axisType === (0, $7Z3it$ColumnAxisType).AGE || axisType === (0, $7Z3it$ColumnAxisType).DEPTH) // Inverted axis\n currentGroup.top_height = Math.min(currentGroup.top_height, top_height);\n else currentGroup.top_height = Math.max(currentGroup.top_height, top_height);\n currentGroup.key = `${currentGroup.height}-${currentGroup.top_height}`;\n } else {\n // Start a new group\n currentGroup = {\n ...d,\n data: [\n ...d.data\n ]\n };\n currentGroupPosition = scale(currentGroup.height) ?? scale(currentGroup.top_height) ?? Infinity;\n groupedData.push(currentGroup);\n }\n }\n return groupedData;\n}\n\n\nexport {$7e05644cbb5d2dbb$export$9d101e1fcb2166a6 as standardizeMeasurementHeight, $7e05644cbb5d2dbb$export$8f2afa8ddee7317e as mergeHeightRanges, $7e05644cbb5d2dbb$export$ce5c4f2fdf4e644d as BaseMeasurementsColumn, $7e05644cbb5d2dbb$export$653e47a7a0da0f0d as TruncatedList, $7e05644cbb5d2dbb$export$4e649f790614b299 as groupNotesByPixelDistance};\n//# sourceMappingURL=column-views.1d064426.js.map\n","import hyper from \"@macrostrat/hyper\";\nimport styles from \"./base.module.sass\";\nimport { getPositionWithinUnit, getUnitHeightRange } from \"../../prepare-units\";\nimport { ColumnNotes } from \"../../notes\";\nimport { UnitLong } from \"@macrostrat/api-types\";\nimport { ColumnAxisType } from \"@macrostrat/column-components\";\nimport type { CompositeColumnScale } from \"../../units\";\nconst h = hyper.styled(styles);\n\ntype GetHeightRangeFn<T> = (\n data: T,\n unit: UnitLong | null,\n axisType: ColumnAxisType,\n) => MeasurementHeightData;\n\nexport interface BaseMeasurementsColumnProps<T> {\n data: T[];\n noteComponent?: any;\n width?: number;\n paddingLeft?: number;\n className?: string;\n // TODO: these props are confusing\n getUnitID?: (d: T) => number | string;\n isMatchingUnit?: (d: T, unit: UnitLong) => boolean;\n getHeightRange?: GetHeightRangeFn<T>;\n deltaConnectorAttachment?: number;\n}\n\nexport interface ColumnMeasurementData<T = any> extends MeasurementHeightData {\n data: T;\n id: string | number;\n}\n\ntype MeasurementPositionInformation =\n | MeasurementHeightData\n | {\n unit_id: number;\n unit_rel_pos?: number;\n };\n\nexport function standardizeMeasurementHeight(\n pos: MeasurementPositionInformation,\n units: UnitLong[],\n axisType: ColumnAxisType,\n): MeasurementHeightData | null {\n /** Get a standardized height representation from position information for\n * a measurement\n */\n if (\"height\" in pos) {\n return pos;\n }\n const unit = units.find((u) => u.unit_id === pos.unit_id);\n if (unit == null) {\n return null;\n }\n if (pos.unit_rel_pos != null) {\n const res = getPositionWithinUnit(pos.unit_rel_pos, unit, axisType);\n if (res == null) return null;\n return { height: res };\n } else {\n const [height, top_height] = getUnitHeightRange(unit, axisType);\n return { height, top_height };\n }\n}\n\nexport function mergeHeightRanges(\n data: MeasurementHeightData[],\n axisType: ColumnAxisType,\n): MeasurementHeightData {\n /** Merge multiple height ranges into a single range */\n const heights = [];\n\n for (const d of data) {\n heights.push(d.height);\n if (d.top_height != null) {\n heights.push(d.top_height);\n }\n }\n\n let height: number;\n let top_height: number;\n if (axisType === ColumnAxisType.AGE || axisType === ColumnAxisType.DEPTH) {\n height = Math.max(...heights);\n top_height = Math.min(...heights);\n } else {\n height = Math.min(...heights);\n top_height = Math.max(...heights);\n }\n\n if (top_height === height) {\n return { height };\n }\n return { height, top_height };\n}\n\nexport type MeasurementHeightData = {\n height: number;\n top_height?: number | null;\n};\n\nexport function BaseMeasurementsColumn({\n data,\n noteComponent,\n width = 500,\n paddingLeft = 40,\n className,\n deltaConnectorAttachment,\n focusedNoteComponent,\n}: BaseMeasurementsColumnProps<any>) {\n if (data == null) return null;\n\n return h(\n \"div.measurements-column\",\n { className },\n h(ColumnNotes, {\n width,\n paddingLeft,\n notes: data,\n noteComponent,\n deltaConnectorAttachment,\n focusedNoteComponent,\n }),\n );\n}\n\ninterface TruncatedListProps {\n data: any[];\n className?: string;\n maxItems?: number;\n itemRenderer?: (props: { data: any }) => any;\n}\n\nexport function TruncatedList({\n data,\n className,\n maxItems = 5,\n itemRenderer = (p) => h(\"span\", p.data),\n}: TruncatedListProps) {\n let tooMany = null;\n let d1 = data;\n if (data.length > maxItems) {\n const n = data.length - maxItems;\n d1 = data.slice(0, maxItems);\n tooMany = h(\"li.too-many\", `and ${n} more`);\n }\n\n return h(\"ul.truncated-list\", { className }, [\n d1.map((d, i) => {\n return h(\"li.element\", { key: i }, h(itemRenderer, { data: d }));\n }),\n tooMany,\n ]);\n}\n\nexport function groupNotesByPixelDistance<T = any>(\n data: ColumnMeasurementData<T[]>[],\n scale: CompositeColumnScale,\n axisType: ColumnAxisType,\n groupDistance: number,\n) {\n /** Group notes that are within a certain pixel distance of each other\n * in display space\n */\n if (data.length === 0 || groupDistance <= 0) return data;\n if (axisType === ColumnAxisType.AGE || axisType === ColumnAxisType.DEPTH) {\n data.sort((a, b) => b.height - a.height);\n } else {\n // Sort data by height (ascending up the column)\n data.sort((a, b) => a.height - b.height);\n }\n\n const groupedData: ColumnMeasurementData<T[]>[] = [];\n let currentGroup: ColumnMeasurementData<T[]> | null = null;\n let currentGroupPosition: number = Infinity;\n\n for (const d of data) {\n // Check distance from current max position\n // Pixels go up as we go down in the section\n\n // The _top_ of the next group must be within groupDistance of the\n // _bottom_ of the current group. This makes sure that we don't collapse\n // groups that are separated by a large distance\n const distance = currentGroupPosition - scale(d.top_height ?? d.height);\n\n if (distance <= groupDistance) {\n if (currentGroup == null) {\n throw new Error(\"Current group is null when it shouldn't be\");\n }\n // Merge into current group\n currentGroup.data.push(...d.data);\n // Update height range\n const top_height = d.top_height ?? d.height;\n if (\n axisType === ColumnAxisType.AGE ||\n axisType === ColumnAxisType.DEPTH\n ) {\n // Inverted axis\n currentGroup.top_height = Math.min(currentGroup.top_height, top_height);\n } else {\n currentGroup.top_height = Math.max(currentGroup.top_height, top_height);\n }\n currentGroup.key = `${currentGroup.height}-${currentGroup.top_height}`;\n } else {\n // Start a new group\n currentGroup = { ...d, data: [...d.data] };\n currentGroupPosition =\n scale(currentGroup.height) ??\n scale(currentGroup.top_height) ??\n Infinity;\n groupedData.push(currentGroup);\n }\n }\n\n return groupedData;\n}\n"],"names":["$7Z3it$macrostrathyper","ColumnAxisType","$7Z3it$ColumnAxisType","$parcel$export","e","n","v","s","Object","defineProperty","get","set","enumerable","configurable","$parcel$global","globalThis","$parcel$modules","$parcel$inits","parcelRequire","id","exports","init","module","call","err","Error","code","register","$7e05644cbb5d2dbb$exports","$7e05644cbb5d2dbb$export$9d101e1fcb2166a6","$7e05644cbb5d2dbb$export$8f2afa8ddee7317e","$7e05644cbb5d2dbb$export$ce5c4f2fdf4e644d","$7e05644cbb5d2dbb$export$653e47a7a0da0f0d","$7e05644cbb5d2dbb$export$4e649f790614b299","$ff1AM","$iWhRv","$6KYbn","$7e05644cbb5d2dbb$var$h","styled","a","__esModule","default","pos","units","axisType","unit","find","u","unit_id","unit_rel_pos","res","getPositionWithinUnit","height","top_height","getUnitHeightRange","data","heights","d","push","AGE","DEPTH","Math","max","min","noteComponent","width","paddingLeft","className","deltaConnectorAttachment","focusedNoteComponent","ColumnNotes","notes","maxItems","itemRenderer","p","tooMany","d1","length","slice","map","i","key","scale","groupDistance","sort","b","groupedData","currentGroup","currentGroupPosition","Infinity","distance","standardizeMeasurementHeight","mergeHeightRanges","BaseMeasurementsColumn","TruncatedList","groupNotesByPixelDistance"],"version":3,"file":"column-views.1d064426.js.map","sourceRoot":"../../../../"}
1
+ {"mappings":"A,M,6C,A,O,6C,A,O,6C,A,Q,M,mB,A,Q,kB,C,K,+B,C,S,E,C,C,C,C,C,C,C,E,O,c,C,E,E,C,I,E,I,E,W,C,E,a,C,C,E,C,I,E,W,E,C,E,E,C,E,E,E,iB,A,O,I,A,C,E,S,C,E,G,K,E,O,C,C,E,C,O,C,G,K,E,C,I,E,C,C,E,A,Q,C,C,E,C,I,E,C,G,E,Q,C,C,E,O,C,C,E,C,E,E,I,C,E,O,C,E,E,O,E,E,O,A,C,I,E,A,M,uB,E,I,O,E,I,C,mB,C,C,E,Q,C,S,C,C,C,E,C,C,E,C,C,E,E,iB,C,G,E,Q,C,I,E,C,E,E,E,+B,I,G,E,E,oB,I,G,E,E,yB,I,G,E,E,gB,I,G,E,E,4B,I,G,I,E,E,S,E,E,S,E,E,SCUA,IAAM,EAAI,AAAA,EAAM,MAAM,C,AAAC,G,AAAA,E,U,C,AAAA,E,O,CAAA,GAkChB,SAAS,EACd,CAAmC,CACnC,CAAiB,CACjB,CAAwB,EAKxB,GAAI,WAAY,EACd,OAAO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AAe,GAAG,EAC/B,IAAa,AAAA,EAAe,KAAK,CAGjC,EAAa,UAAU,CAAG,KAAK,GAAG,CAAC,EAAa,UAAU,CAAE,GAE5D,EAAa,UAAU,CAAG,KAAK,GAAG,CAAC,EAAa,UAAU,CAAE,GAE9D,EAAa,EAAE,CAAG,CAAA,EAAG,EAAa,MAAM,CAAC,CAAC,EAAE,EAAa,UAAU,CAAA,CAAE,AACvE,MAGE,EACE,EAAM,AAFR,CAAA,EAAe,CAAE,GAAG,CAAC,CAAE,KAAM,IAAI,EAAE,IAAI,CAAC,AAAC,CAAA,EAEpB,MAAM,GACzB,EAAM,EAAa,UAAU,GAC7B,IACF,EAAY,IAAI,CAAC,GAIrB,OAAO,CACT,Q,K,4B,C,K,iB,C,K,sB,C,K,a,C,K,yB","sources":["<anon>","packages/column-views/src/facets/measurements/base.ts"],"sourcesContent":["import \"./column-views.012fa10c.js\";\nimport \"./column-views.dbb4a46b.js\";\nimport \"./column-views.02869dc5.js\";\nimport $7Z3it$macrostrathyper from \"@macrostrat/hyper\";\nimport {ColumnAxisType as $7Z3it$ColumnAxisType} from \"@macrostrat/column-components\";\n\n\nfunction $parcel$interopDefault(a) {\n return a && a.__esModule ? a.default : a;\n}\n\nfunction $parcel$export(e, n, v, s) {\n Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});\n}\n\n var $parcel$global = globalThis;\n \nvar $parcel$modules = {};\nvar $parcel$inits = {};\n\nvar parcelRequire = $parcel$global[\"parcelRequirea149\"];\n\nif (parcelRequire == null) {\n parcelRequire = function(id) {\n if (id in $parcel$modules) {\n return $parcel$modules[id].exports;\n }\n if (id in $parcel$inits) {\n var init = $parcel$inits[id];\n delete $parcel$inits[id];\n var module = {id: id, exports: {}};\n $parcel$modules[id] = module;\n init.call(module.exports, module, module.exports);\n return module.exports;\n }\n var err = new Error(\"Cannot find module '\" + id + \"'\");\n err.code = 'MODULE_NOT_FOUND';\n throw err;\n };\n\n parcelRequire.register = function register(id, init) {\n $parcel$inits[id] = init;\n };\n\n $parcel$global[\"parcelRequirea149\"] = parcelRequire;\n}\n\nvar parcelRegister = parcelRequire.register;\nvar $7e05644cbb5d2dbb$exports = {};\n\n$parcel$export($7e05644cbb5d2dbb$exports, \"standardizeMeasurementHeight\", () => $7e05644cbb5d2dbb$export$9d101e1fcb2166a6);\n$parcel$export($7e05644cbb5d2dbb$exports, \"mergeHeightRanges\", () => $7e05644cbb5d2dbb$export$8f2afa8ddee7317e);\n$parcel$export($7e05644cbb5d2dbb$exports, \"BaseMeasurementsColumn\", () => $7e05644cbb5d2dbb$export$ce5c4f2fdf4e644d);\n$parcel$export($7e05644cbb5d2dbb$exports, \"TruncatedList\", () => $7e05644cbb5d2dbb$export$653e47a7a0da0f0d);\n$parcel$export($7e05644cbb5d2dbb$exports, \"groupNotesByPixelDistance\", () => $7e05644cbb5d2dbb$export$4e649f790614b299);\n\n\nvar $ff1AM = parcelRequire(\"ff1AM\");\n\nvar $iWhRv = parcelRequire(\"iWhRv\");\n\nvar $6KYbn = parcelRequire(\"6KYbn\");\n\nconst $7e05644cbb5d2dbb$var$h = (0, $7Z3it$macrostrathyper).styled((0, (/*@__PURE__*/$parcel$interopDefault($ff1AM))));\nfunction $7e05644cbb5d2dbb$export$9d101e1fcb2166a6(pos, units, axisType) {\n /** Get a standardized height representation from position information for\n * a measurement\n */ if (\"height\" in pos) return pos;\n const unit = units.find((u)=>u.unit_id === pos.unit_id);\n if (unit == null) return null;\n if (pos.unit_rel_pos != null) {\n const res = (0, $iWhRv.getPositionWithinUnit)(pos.unit_rel_pos, unit, axisType);\n if (res == null) return null;\n return {\n height: res\n };\n } else {\n const [height, top_height] = (0, $iWhRv.getUnitHeightRange)(unit, axisType);\n return {\n height: height,\n top_height: top_height\n };\n }\n}\nfunction $7e05644cbb5d2dbb$export$8f2afa8ddee7317e(data, axisType) {\n /** Merge multiple height ranges into a single range */ const heights = [];\n for (const d of data){\n heights.push(d.height);\n if (d.top_height != null) heights.push(d.top_height);\n }\n let height;\n let top_height;\n if (axisType === (0, $7Z3it$ColumnAxisType).AGE || axisType === (0, $7Z3it$ColumnAxisType).DEPTH) {\n height = Math.max(...heights);\n top_height = Math.min(...heights);\n } else {\n height = Math.min(...heights);\n top_height = Math.max(...heights);\n }\n if (top_height === height) return {\n height: height\n };\n return {\n height: height,\n top_height: top_height\n };\n}\nfunction $7e05644cbb5d2dbb$export$ce5c4f2fdf4e644d({ data: data, noteComponent: noteComponent, width: width = 500, paddingLeft: paddingLeft = 40, className: className, deltaConnectorAttachment: deltaConnectorAttachment, focusedNoteComponent: focusedNoteComponent }) {\n if (data == null) return null;\n return $7e05644cbb5d2dbb$var$h(\"div.measurements-column\", {\n className: className\n }, $7e05644cbb5d2dbb$var$h((0, $6KYbn.ColumnNotes), {\n width: width,\n paddingLeft: paddingLeft,\n notes: data,\n noteComponent: noteComponent,\n deltaConnectorAttachment: deltaConnectorAttachment,\n focusedNoteComponent: focusedNoteComponent\n }));\n}\nfunction $7e05644cbb5d2dbb$export$653e47a7a0da0f0d({ data: data, className: className, maxItems: maxItems = 5, itemRenderer: itemRenderer = (p)=>$7e05644cbb5d2dbb$var$h(\"span\", p.data) }) {\n let tooMany = null;\n let d1 = data;\n if (data.length > maxItems) {\n const n = data.length - maxItems;\n d1 = data.slice(0, maxItems);\n tooMany = $7e05644cbb5d2dbb$var$h(\"li.too-many\", `and ${n} more`);\n }\n return $7e05644cbb5d2dbb$var$h(\"ul.truncated-list\", {\n className: className\n }, [\n d1.map((d, i)=>{\n return $7e05644cbb5d2dbb$var$h(\"li.element\", {\n key: i\n }, $7e05644cbb5d2dbb$var$h(itemRenderer, {\n data: d\n }));\n }),\n tooMany\n ]);\n}\nfunction $7e05644cbb5d2dbb$export$4e649f790614b299(data, scale, axisType, groupDistance) {\n /** Group notes that are within a certain pixel distance of each other\n * in display space\n */ if (data.length === 0 || groupDistance <= 0) return data;\n if (axisType === (0, $7Z3it$ColumnAxisType).AGE || axisType === (0, $7Z3it$ColumnAxisType).DEPTH) data.sort((a, b)=>b.height - a.height);\n else // Sort data by height (ascending up the column)\n data.sort((a, b)=>a.height - b.height);\n const groupedData = [];\n let currentGroup = null;\n let currentGroupPosition = Infinity;\n for (const d of data){\n // Check distance from current max position\n // Pixels go up as we go down in the section\n // The _top_ of the next group must be within groupDistance of the\n // _bottom_ of the current group. This makes sure that we don't collapse\n // groups that are separated by a large distance\n const distance = currentGroupPosition - scale(d.top_height ?? d.height);\n if (distance <= groupDistance) {\n if (currentGroup == null) throw new Error(\"Current group is null when it shouldn't be\");\n // Merge into current group\n currentGroup.data.push(...d.data);\n // Update height range\n const top_height = d.top_height ?? d.height;\n if (axisType === (0, $7Z3it$ColumnAxisType).AGE || axisType === (0, $7Z3it$ColumnAxisType).DEPTH) // Inverted axis\n currentGroup.top_height = Math.min(currentGroup.top_height, top_height);\n else currentGroup.top_height = Math.max(currentGroup.top_height, top_height);\n currentGroup.id = `${currentGroup.height}-${currentGroup.top_height}`;\n } else {\n // Start a new group\n currentGroup = {\n ...d,\n data: [\n ...d.data\n ]\n };\n currentGroupPosition = scale(currentGroup.height) ?? scale(currentGroup.top_height) ?? Infinity;\n groupedData.push(currentGroup);\n }\n }\n return groupedData;\n}\n\n\nexport {$7e05644cbb5d2dbb$export$9d101e1fcb2166a6 as standardizeMeasurementHeight, $7e05644cbb5d2dbb$export$8f2afa8ddee7317e as mergeHeightRanges, $7e05644cbb5d2dbb$export$ce5c4f2fdf4e644d as BaseMeasurementsColumn, $7e05644cbb5d2dbb$export$653e47a7a0da0f0d as TruncatedList, $7e05644cbb5d2dbb$export$4e649f790614b299 as groupNotesByPixelDistance};\n//# sourceMappingURL=column-views.3a947d58.js.map\n","import hyper from \"@macrostrat/hyper\";\nimport styles from \"./base.module.sass\";\nimport {\n type CompositeColumnScale,\n getPositionWithinUnit,\n getUnitHeightRange,\n} from \"../../prepare-units\";\nimport { ColumnNotes } from \"../../notes\";\nimport { UnitLong } from \"@macrostrat/api-types\";\nimport { ColumnAxisType } from \"@macrostrat/column-components\";\nconst h = hyper.styled(styles);\n\ntype GetHeightRangeFn<T> = (\n data: T,\n unit: UnitLong | null,\n axisType: ColumnAxisType,\n) => MeasurementHeightData;\n\nexport interface BaseMeasurementsColumnProps<T> {\n data: T[];\n noteComponent?: any;\n width?: number;\n paddingLeft?: number;\n className?: string;\n // TODO: these props are confusing\n getUnitID?: (d: T) => number | string;\n isMatchingUnit?: (d: T, unit: UnitLong) => boolean;\n getHeightRange?: GetHeightRangeFn<T>;\n deltaConnectorAttachment?: number;\n focusedNoteComponent?: any;\n}\n\nexport interface ColumnMeasurementData<T = any> extends MeasurementHeightData {\n data: T;\n id: string | number;\n}\n\ntype MeasurementPositionInformation =\n | MeasurementHeightData\n | {\n unit_id: number;\n unit_rel_pos?: number;\n };\n\nexport function standardizeMeasurementHeight(\n pos: MeasurementPositionInformation,\n units: UnitLong[],\n axisType: ColumnAxisType,\n): MeasurementHeightData | null {\n /** Get a standardized height representation from position information for\n * a measurement\n */\n if (\"height\" in pos) {\n return pos;\n }\n const unit = units.find((u) => u.unit_id === pos.unit_id);\n if (unit == null) {\n return null;\n }\n if (pos.unit_rel_pos != null) {\n const res = getPositionWithinUnit(pos.unit_rel_pos, unit, axisType);\n if (res == null) return null;\n return { height: res };\n } else {\n const [height, top_height] = getUnitHeightRange(unit, axisType);\n return { height, top_height };\n }\n}\n\nexport function mergeHeightRanges(\n data: MeasurementHeightData[],\n axisType: ColumnAxisType,\n): MeasurementHeightData {\n /** Merge multiple height ranges into a single range */\n const heights = [];\n\n for (const d of data) {\n heights.push(d.height);\n if (d.top_height != null) {\n heights.push(d.top_height);\n }\n }\n\n let height: number;\n let top_height: number;\n if (axisType === ColumnAxisType.AGE || axisType === ColumnAxisType.DEPTH) {\n height = Math.max(...heights);\n top_height = Math.min(...heights);\n } else {\n height = Math.min(...heights);\n top_height = Math.max(...heights);\n }\n\n if (top_height === height) {\n return { height };\n }\n return { height, top_height };\n}\n\nexport type MeasurementHeightData = {\n height: number;\n top_height?: number | null;\n};\n\nexport function BaseMeasurementsColumn({\n data,\n noteComponent,\n width = 500,\n paddingLeft = 40,\n className,\n deltaConnectorAttachment,\n focusedNoteComponent,\n}: BaseMeasurementsColumnProps<any>) {\n if (data == null) return null;\n\n return h(\n \"div.measurements-column\",\n { className },\n h(ColumnNotes, {\n width,\n paddingLeft,\n notes: data,\n noteComponent,\n deltaConnectorAttachment,\n focusedNoteComponent,\n }),\n );\n}\n\ninterface TruncatedListProps {\n data: any[];\n className?: string;\n maxItems?: number;\n itemRenderer?: (props: { data: any }) => any;\n}\n\nexport function TruncatedList({\n data,\n className,\n maxItems = 5,\n itemRenderer = (p) => h(\"span\", p.data),\n}: TruncatedListProps) {\n let tooMany = null;\n let d1 = data;\n if (data.length > maxItems) {\n const n = data.length - maxItems;\n d1 = data.slice(0, maxItems);\n tooMany = h(\"li.too-many\", `and ${n} more`);\n }\n\n return h(\"ul.truncated-list\", { className }, [\n d1.map((d, i) => {\n return h(\"li.element\", { key: i }, h(itemRenderer, { data: d }));\n }),\n tooMany,\n ]);\n}\n\nexport function groupNotesByPixelDistance<T = any>(\n data: ColumnMeasurementData<T[]>[],\n scale: CompositeColumnScale,\n axisType: ColumnAxisType,\n groupDistance: number,\n) {\n /** Group notes that are within a certain pixel distance of each other\n * in display space\n */\n if (data.length === 0 || groupDistance <= 0) return data;\n if (axisType === ColumnAxisType.AGE || axisType === ColumnAxisType.DEPTH) {\n data.sort((a, b) => b.height - a.height);\n } else {\n // Sort data by height (ascending up the column)\n data.sort((a, b) => a.height - b.height);\n }\n\n const groupedData: ColumnMeasurementData<T[]>[] = [];\n let currentGroup: ColumnMeasurementData<T[]> | null = null;\n let currentGroupPosition: number = Infinity;\n\n for (const d of data) {\n // Check distance from current max position\n // Pixels go up as we go down in the section\n\n // The _top_ of the next group must be within groupDistance of the\n // _bottom_ of the current group. This makes sure that we don't collapse\n // groups that are separated by a large distance\n const distance = currentGroupPosition - scale(d.top_height ?? d.height);\n\n if (distance <= groupDistance) {\n if (currentGroup == null) {\n throw new Error(\"Current group is null when it shouldn't be\");\n }\n // Merge into current group\n currentGroup.data.push(...d.data);\n // Update height range\n const top_height = d.top_height ?? d.height;\n if (\n axisType === ColumnAxisType.AGE ||\n axisType === ColumnAxisType.DEPTH\n ) {\n // Inverted axis\n currentGroup.top_height = Math.min(currentGroup.top_height, top_height);\n } else {\n currentGroup.top_height = Math.max(currentGroup.top_height, top_height);\n }\n currentGroup.id = `${currentGroup.height}-${currentGroup.top_height}`;\n } else {\n // Start a new group\n currentGroup = { ...d, data: [...d.data] };\n currentGroupPosition =\n scale(currentGroup.height) ??\n scale(currentGroup.top_height) ??\n Infinity;\n groupedData.push(currentGroup);\n }\n }\n\n return groupedData;\n}\n"],"names":["$7Z3it$macrostrathyper","ColumnAxisType","$7Z3it$ColumnAxisType","$parcel$export","e","n","v","s","Object","defineProperty","get","set","enumerable","configurable","$parcel$global","globalThis","$parcel$modules","$parcel$inits","parcelRequire","id","exports","init","module","call","err","Error","code","register","$7e05644cbb5d2dbb$exports","$7e05644cbb5d2dbb$export$9d101e1fcb2166a6","$7e05644cbb5d2dbb$export$8f2afa8ddee7317e","$7e05644cbb5d2dbb$export$ce5c4f2fdf4e644d","$7e05644cbb5d2dbb$export$653e47a7a0da0f0d","$7e05644cbb5d2dbb$export$4e649f790614b299","$ff1AM","$iWhRv","$6KYbn","$7e05644cbb5d2dbb$var$h","styled","a","__esModule","default","pos","units","axisType","unit","find","u","unit_id","unit_rel_pos","res","getPositionWithinUnit","height","top_height","getUnitHeightRange","data","heights","d","push","AGE","DEPTH","Math","max","min","noteComponent","width","paddingLeft","className","deltaConnectorAttachment","focusedNoteComponent","ColumnNotes","notes","maxItems","itemRenderer","p","tooMany","d1","length","slice","map","i","key","scale","groupDistance","sort","b","groupedData","currentGroup","currentGroupPosition","Infinity","distance","standardizeMeasurementHeight","mergeHeightRanges","BaseMeasurementsColumn","TruncatedList","groupNotesByPixelDistance"],"version":3,"file":"column-views.3a947d58.js.map","sourceRoot":"../../../../"}
@@ -1,2 +1,2 @@
1
- import"./column-views.93bde6c1.js";import"./column-views.c921fa1a.js";import"./column-views.6bba8c57.js";import"./column-views.5559de6a.js";import"./column-views.c007152b.js";import"./column-views.e7e26765.js";import"./column-views.e6720522.js";import e from"@macrostrat/hyper";import{LithologyColumn as o,useColumnLayout as n,useGeologicPattern as t}from"@macrostrat/column-components";import{useInDarkMode as i}from"@macrostrat/ui-components";import{useMemo as r}from"react";function a(e,o){return Object.keys(o).forEach(function(n){"default"===n||"__esModule"===n||Object.prototype.hasOwnProperty.call(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:function(){return o[n]}})}),e}function d(e,o,n,t){Object.defineProperty(e,o,{get:n,set:t,enumerable:!0,configurable:!0})}var l=globalThis,s={},c={},u=l.parcelRequirea149;null==u&&((u=function(e){if(e in s)return s[e].exports;if(e in c){var o=c[e];delete c[e];var n={id:e,exports:{}};return s[e]=n,o.call(n.exports,n,n.exports),n.exports}var t=Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}).register=function(e,o){c[e]=o},l.parcelRequirea149=u),u.register;var m={};d(m,"UnitsColumn",()=>x),d(m,"SimpleUnitsColumn",()=>g),d(m,"BasicUnitComponent",()=>_),d(m,"UnitComponent",()=>h),d(m,"useUnitColor",()=>w),d(m,"ColoredUnitComponent",()=>E),d(m,"useUnitColorByEnvironment",()=>H),d(m,"EnvironmentColoredUnitComponent",()=>y);var f=u("jiUaC"),p=u("1n4Pb"),b=u("bfmPX"),$=u("4Abge"),C=u("lgTAP"),v=u("5VyZI"),U=u("lI6Sf");function x({width:n=100}){return e(o,{width:n},e(p.UnitBoxes))}function g(o){let{columnWidth:n,width:t,gutterWidth:i=0,labelOffset:r=30}=o;return e([e(x,{width:n}),e(f.UnitNamesColumn,{transform:`translate(${n+i})`,paddingLeft:r,width:t-n-i})])}function _({division:o,...n}){return e(h,{division:o,...n,backgroundColor:o.color,patternID:o.patternID})}function h({division:o,nColumns:t=2,...i}){let r=i.width??n()?.width,a=0==(o.overlappingUnits?.length??0)?1:t,d=(o.column??0)%a;return e($.TrackedLabeledUnit,{division:o,...i,width:r/a,x:d*r/a})}function w(e,o={}){let n=(0,C.useLithologies)(),t=i(),{asBackground:a=!0}=o;return r(()=>null==e||null==n?null:(0,b.getMixedUnitColor)(e,n,t,a),[e?.unit_id,n,t,a])}function E(o){let n=w(o.division);return e(h,{fill:t(r(()=>(0,v.resolveID)(o.division),[o.division?.unit_id])),backgroundColor:n,...o})}function H(e,o={}){let n=(0,C.useEnvironments)(),t=(0,C.useLithologies)(),a=i(),{asBackground:d=!0}=o;return r(()=>{if(null==e||null==n)return null;let o=(0,b.getMixedUnitColor)(e,n,a,d,{key:"environ",id_key:"environ_id"});return null!=o?o:(0,b.getMixedUnitColor)(e,t,a,d)},[e?.unit_id,n,t,a,d])}function y(o){let n=H(o.division);return e(h,{fill:t(r(()=>(0,v.resolveID)(o.division),[o.division?.unit_id])),backgroundColor:n,...o})}a(m,b),a(m,$),a(m,U);export{x as UnitsColumn,g as SimpleUnitsColumn,_ as BasicUnitComponent,h as UnitComponent,w as useUnitColor,E as ColoredUnitComponent,H as useUnitColorByEnvironment,y as EnvironmentColoredUnitComponent,$0557c7dbdd54c055$export$175d3e927f1a9860 as getMixedUnitColor,$6b7af672ec278734$export$e4e89ab6c86ac513 as LabelTrackerProvider,$6b7af672ec278734$export$f613830566442374 as TrackedLabeledUnit,$6b7af672ec278734$export$1dfa200d57964eee as CompositeUnitComponent,$6b7af672ec278734$export$a6684360fef0406e as CompositeUnitsColumn,$6b7af672ec278734$export$d8c3f2fdd653a082 as AnnotatedUnitsColumn,$6b7af672ec278734$export$13984e34afdbb040 as SectionLabelsColumn,$6b7af672ec278734$export$6cc7a9df4edde18 as ColumnNotesProvider};
2
- //# sourceMappingURL=column-views.8ee8469d.js.map
1
+ import"./column-views.e153680b.js";import"./column-views.c921fa1a.js";import"./column-views.6bba8c57.js";import"./column-views.fafbc028.js";import"./column-views.c007152b.js";import"./column-views.e7e26765.js";import"./column-views.e6720522.js";import e from"@macrostrat/hyper";import{LithologyColumn as o,useColumnLayout as n,useGeologicPattern as t}from"@macrostrat/column-components";import{useInDarkMode as i}from"@macrostrat/ui-components";import{useMemo as r}from"react";function a(e,o){return Object.keys(o).forEach(function(n){"default"===n||"__esModule"===n||Object.prototype.hasOwnProperty.call(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:function(){return o[n]}})}),e}function d(e,o,n,t){Object.defineProperty(e,o,{get:n,set:t,enumerable:!0,configurable:!0})}var l=globalThis,s={},c={},u=l.parcelRequirea149;null==u&&((u=function(e){if(e in s)return s[e].exports;if(e in c){var o=c[e];delete c[e];var n={id:e,exports:{}};return s[e]=n,o.call(n.exports,n,n.exports),n.exports}var t=Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}).register=function(e,o){c[e]=o},l.parcelRequirea149=u),u.register;var m={};d(m,"UnitsColumn",()=>x),d(m,"SimpleUnitsColumn",()=>g),d(m,"BasicUnitComponent",()=>_),d(m,"UnitComponent",()=>h),d(m,"useUnitColor",()=>w),d(m,"ColoredUnitComponent",()=>E),d(m,"useUnitColorByEnvironment",()=>H),d(m,"EnvironmentColoredUnitComponent",()=>y);var f=u("jiUaC"),p=u("1n4Pb"),b=u("bfmPX"),$=u("4Abge"),C=u("lgTAP"),v=u("5VyZI"),U=u("lI6Sf");function x({width:n=100}){return e(o,{width:n},e(p.UnitBoxes))}function g(o){let{columnWidth:n,width:t,gutterWidth:i=0,labelOffset:r=30}=o;return e([e(x,{width:n}),e(f.UnitNamesColumn,{transform:`translate(${n+i})`,paddingLeft:r,width:t-n-i})])}function _({division:o,...n}){return e(h,{division:o,...n,backgroundColor:o.color,patternID:o.patternID})}function h({division:o,nColumns:t=2,...i}){let r=i.width??n()?.width,a=0==(o.overlappingUnits?.length??0)?1:t,d=(o.column??0)%a;return e($.TrackedLabeledUnit,{division:o,...i,width:r/a,x:d*r/a})}function w(e,o={}){let n=(0,C.useLithologies)(),t=i(),{asBackground:a=!0}=o;return r(()=>null==e||null==n?null:(0,b.getMixedUnitColor)(e,n,t,a),[e?.unit_id,n,t,a])}function E(o){let n=w(o.division);return e(h,{fill:t(r(()=>(0,v.resolveID)(o.division),[o.division?.unit_id])),backgroundColor:n,...o})}function H(e,o={}){let n=(0,C.useEnvironments)(),t=(0,C.useLithologies)(),a=i(),{asBackground:d=!0}=o;return r(()=>{if(null==e||null==n)return null;let o=(0,b.getMixedUnitColor)(e,n,a,d,{key:"environ",id_key:"environ_id"});return null!=o?o:(0,b.getMixedUnitColor)(e,t,a,d)},[e?.unit_id,n,t,a,d])}function y(o){let n=H(o.division);return e(h,{fill:t(r(()=>(0,v.resolveID)(o.division),[o.division?.unit_id])),backgroundColor:n,...o})}a(m,b),a(m,$),a(m,U);export{x as UnitsColumn,g as SimpleUnitsColumn,_ as BasicUnitComponent,h as UnitComponent,w as useUnitColor,E as ColoredUnitComponent,H as useUnitColorByEnvironment,y as EnvironmentColoredUnitComponent,$0557c7dbdd54c055$export$175d3e927f1a9860 as getMixedUnitColor,$6b7af672ec278734$export$e4e89ab6c86ac513 as LabelTrackerProvider,$6b7af672ec278734$export$f613830566442374 as TrackedLabeledUnit,$6b7af672ec278734$export$1dfa200d57964eee as CompositeUnitComponent,$6b7af672ec278734$export$a6684360fef0406e as CompositeUnitsColumn,$6b7af672ec278734$export$d8c3f2fdd653a082 as AnnotatedUnitsColumn,$6b7af672ec278734$export$13984e34afdbb040 as SectionLabelsColumn,$6b7af672ec278734$export$6cc7a9df4edde18 as ColumnNotesProvider};
2
+ //# sourceMappingURL=column-views.3d0c2bea.js.map
@@ -1 +1 @@
1
- {"mappings":"A,M,6C,A,O,6C,A,O,6C,A,O,6C,A,O,6C,A,O,6C,A,O,6C,A,Q,M,mB,A,Q,mB,C,C,mB,C,C,sB,C,K,+B,A,Q,iB,C,K,2B,A,Q,W,C,K,O,C,S,E,C,C,C,E,O,O,I,C,G,O,C,S,C,E,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E,EAAe,CAAA,CAAA,CAAM,CAAG,EAEhC,OAAO,AAAA,EAAQ,KACb,GAAI,AAAQ,MAAR,GAAgB,AAAkB,MAAlB,EAAwB,OAAO,KACnD,IAAI,EAAI,AAAA,CAAA,EAAA,EAAA,iBAAgB,AAAhB,EAAkB,EAAM,EAAgB,EAAY,EAAc,CACxE,IAAK,UACL,OAAQ,YACV,UACA,AAAI,AAAK,MAAL,EACK,EAGF,AAAA,CAAA,EAAA,EAAA,iBAAgB,AAAhB,EAAkB,EAAM,EAAS,EAAY,EACtD,EAAG,CAAC,GAAM,QAAS,EAAgB,EAAS,EAAY,EAAa,CACvE,CAEO,SAAS,EAAgC,CAAK,EAGnD,IAAM,EAAkB,EAA0B,EAAM,QAAQ,EAQhE,OAAO,AAAA,EAAE,EAAe,CACtB,KAHW,AAAA,EAJK,AAAA,EAAQ,IACjB,AAAA,CAAA,EAAA,EAAA,SAAQ,AAAR,EAAU,EAAM,QAAQ,EAC9B,CAAC,EAAM,QAAQ,EAAE,QAAQ,GAM1B,gBAAA,EACA,GAAG,CAAK,AACV,EACF,C,E,E,G,E,E,G,E,E,U,K,W,C,K,iB,C,K,kB,C,K,a,C,K,Y,C,K,oB,C,K,yB,C,K,+B,C,6C,iB,C,6C,oB,C,6C,kB,C,6C,sB,C,6C,oB,C,6C,oB,C,6C,mB,C,4C,mB","sources":["<anon>","packages/column-views/src/units/index.ts"],"sourcesContent":["import \"./column-views.93bde6c1.js\";\nimport \"./column-views.c921fa1a.js\";\nimport \"./column-views.6bba8c57.js\";\nimport \"./column-views.5559de6a.js\";\nimport \"./column-views.c007152b.js\";\nimport \"./column-views.e7e26765.js\";\nimport \"./column-views.e6720522.js\";\nimport $6u7Ut$macrostrathyper from \"@macrostrat/hyper\";\nimport {LithologyColumn as $6u7Ut$LithologyColumn, useColumnLayout as $6u7Ut$useColumnLayout, useGeologicPattern as $6u7Ut$useGeologicPattern} from \"@macrostrat/column-components\";\nimport {useInDarkMode as $6u7Ut$useInDarkMode} from \"@macrostrat/ui-components\";\nimport {useMemo as $6u7Ut$useMemo} from \"react\";\n\n\nfunction $parcel$exportWildcard(dest, source) {\n Object.keys(source).forEach(function(key) {\n if (key === 'default' || key === '__esModule' || Object.prototype.hasOwnProperty.call(dest, key)) {\n return;\n }\n\n Object.defineProperty(dest, key, {\n enumerable: true,\n get: function get() {\n return source[key];\n }\n });\n });\n\n return dest;\n}\n\nfunction $parcel$export(e, n, v, s) {\n Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});\n}\n\n var $parcel$global = globalThis;\n \nvar $parcel$modules = {};\nvar $parcel$inits = {};\n\nvar parcelRequire = $parcel$global[\"parcelRequirea149\"];\n\nif (parcelRequire == null) {\n parcelRequire = function(id) {\n if (id in $parcel$modules) {\n return $parcel$modules[id].exports;\n }\n if (id in $parcel$inits) {\n var init = $parcel$inits[id];\n delete $parcel$inits[id];\n var module = {id: id, exports: {}};\n $parcel$modules[id] = module;\n init.call(module.exports, module, module.exports);\n return module.exports;\n }\n var err = new Error(\"Cannot find module '\" + id + \"'\");\n err.code = 'MODULE_NOT_FOUND';\n throw err;\n };\n\n parcelRequire.register = function register(id, init) {\n $parcel$inits[id] = init;\n };\n\n $parcel$global[\"parcelRequirea149\"] = parcelRequire;\n}\n\nvar parcelRegister = parcelRequire.register;\nvar $1da06db49d2262cb$exports = {};\n\n$parcel$export($1da06db49d2262cb$exports, \"UnitsColumn\", () => $1da06db49d2262cb$export$3750278673318c9a);\n$parcel$export($1da06db49d2262cb$exports, \"SimpleUnitsColumn\", () => $1da06db49d2262cb$export$2006342ddaa547c6);\n$parcel$export($1da06db49d2262cb$exports, \"BasicUnitComponent\", () => $1da06db49d2262cb$export$600691a8e9d13a7);\n$parcel$export($1da06db49d2262cb$exports, \"UnitComponent\", () => $1da06db49d2262cb$export$48a4cacf2b7a4441);\n$parcel$export($1da06db49d2262cb$exports, \"useUnitColor\", () => $1da06db49d2262cb$export$62c7735c72801c19);\n$parcel$export($1da06db49d2262cb$exports, \"ColoredUnitComponent\", () => $1da06db49d2262cb$export$6012fd1584b5d0c0);\n$parcel$export($1da06db49d2262cb$exports, \"useUnitColorByEnvironment\", () => $1da06db49d2262cb$export$4830e703a903113);\n$parcel$export($1da06db49d2262cb$exports, \"EnvironmentColoredUnitComponent\", () => $1da06db49d2262cb$export$c2fe8a14da82d570);\n\n\n\nvar $jiUaC = parcelRequire(\"jiUaC\");\n\nvar $1n4Pb = parcelRequire(\"1n4Pb\");\n\n\nvar $bfmPX = parcelRequire(\"bfmPX\");\n\nvar $4Abge = parcelRequire(\"4Abge\");\n\nvar $lgTAP = parcelRequire(\"lgTAP\");\n\n\nvar $5VyZI = parcelRequire(\"5VyZI\");\n\nvar $lI6Sf = parcelRequire(\"lI6Sf\");\nfunction $1da06db49d2262cb$export$3750278673318c9a({ width: width = 100 }) {\n /*\n A column showing units with USGS color fill\n */ return (0, $6u7Ut$macrostrathyper)((0, $6u7Ut$LithologyColumn), {\n width: width\n }, (0, $6u7Ut$macrostrathyper)((0, $1n4Pb.UnitBoxes)));\n}\nfunction $1da06db49d2262cb$export$2006342ddaa547c6(props) {\n /*\n A column with units and names either\n overlapping or offset to the right\n */ const { columnWidth: columnWidth, width: width, gutterWidth: gutterWidth = 0, labelOffset: labelOffset = 30 } = props;\n return (0, $6u7Ut$macrostrathyper)([\n (0, $6u7Ut$macrostrathyper)($1da06db49d2262cb$export$3750278673318c9a, {\n width: columnWidth\n }),\n (0, $6u7Ut$macrostrathyper)((0, $jiUaC.UnitNamesColumn), {\n transform: `translate(${columnWidth + gutterWidth})`,\n paddingLeft: labelOffset,\n width: width - columnWidth - gutterWidth\n })\n ]);\n}\nfunction $1da06db49d2262cb$export$600691a8e9d13a7({ division: division, ...rest }) {\n /** A unit that allows directly setting colors and patterns. */ return (0, $6u7Ut$macrostrathyper)($1da06db49d2262cb$export$48a4cacf2b7a4441, {\n division: division,\n ...rest,\n backgroundColor: division.color,\n patternID: division.patternID\n });\n}\nfunction $1da06db49d2262cb$export$48a4cacf2b7a4441({ division: division, nColumns: nColumns = 2, ...rest }) {\n const width = rest.width ?? (0, $6u7Ut$useColumnLayout)()?.width;\n const nOverlappingUnits = division.overlappingUnits?.length ?? 0;\n const _nColumns = nOverlappingUnits == 0 ? 1 : nColumns;\n const columnIx = (division.column ?? 0) % _nColumns;\n const reducedWidth = width / _nColumns;\n const x = columnIx * width / _nColumns;\n return (0, $6u7Ut$macrostrathyper)((0, $4Abge.TrackedLabeledUnit), {\n division: division,\n ...rest,\n width: reducedWidth,\n x: x\n });\n}\nfunction $1da06db49d2262cb$export$62c7735c72801c19(unit, opts = {}) {\n /** Get the color for a unit based on its lithology */ const lithMap = (0, $lgTAP.useLithologies)();\n const inDarkMode = (0, $6u7Ut$useInDarkMode)();\n const { asBackground: asBackground = true } = opts;\n return (0, $6u7Ut$useMemo)(()=>{\n if (unit == null || lithMap == null) return null;\n return (0, $bfmPX.getMixedUnitColor)(unit, lithMap, inDarkMode, asBackground);\n }, [\n unit?.unit_id,\n lithMap,\n inDarkMode,\n asBackground\n ]);\n}\nfunction $1da06db49d2262cb$export$6012fd1584b5d0c0(props) {\n /** A unit component that is colored using a mixture of lithologies.\n * This is a separate component because it depends on more providers/contexts to determine coloring. */ const backgroundColor = $1da06db49d2262cb$export$62c7735c72801c19(props.division);\n const patternID = (0, $6u7Ut$useMemo)(()=>{\n return (0, $5VyZI.resolveID)(props.division); // ?? getPatternID(props.division.lith, lithMap);\n }, [\n props.division?.unit_id\n ]);\n const fill = (0, $6u7Ut$useGeologicPattern)(patternID);\n return (0, $6u7Ut$macrostrathyper)($1da06db49d2262cb$export$48a4cacf2b7a4441, {\n fill: fill,\n backgroundColor: backgroundColor,\n ...props\n });\n}\nfunction $1da06db49d2262cb$export$4830e703a903113(unit, opts = {}) {\n /** Get the color for a unit based on its lithology */ const environmentMap = (0, $lgTAP.useEnvironments)();\n const lithMap = (0, $lgTAP.useLithologies)();\n const inDarkMode = (0, $6u7Ut$useInDarkMode)();\n const { asBackground: asBackground = true } = opts;\n return (0, $6u7Ut$useMemo)(()=>{\n if (unit == null || environmentMap == null) return null;\n let c = (0, $bfmPX.getMixedUnitColor)(unit, environmentMap, inDarkMode, asBackground, {\n key: \"environ\",\n id_key: \"environ_id\"\n });\n if (c != null) return c;\n // Fallback to lithology color if no environment color is found\n return (0, $bfmPX.getMixedUnitColor)(unit, lithMap, inDarkMode, asBackground);\n }, [\n unit?.unit_id,\n environmentMap,\n lithMap,\n inDarkMode,\n asBackground\n ]);\n}\nfunction $1da06db49d2262cb$export$c2fe8a14da82d570(props) {\n /** A unit component that is colored using a mixture of lithologies.\n * This is a separate component because it depends on more providers/contexts to determine coloring. */ const backgroundColor = $1da06db49d2262cb$export$4830e703a903113(props.division);\n const patternID = (0, $6u7Ut$useMemo)(()=>{\n return (0, $5VyZI.resolveID)(props.division); // ?? getPatternID(props.division.lith, lithMap);\n }, [\n props.division?.unit_id\n ]);\n const fill = (0, $6u7Ut$useGeologicPattern)(patternID);\n return (0, $6u7Ut$macrostrathyper)($1da06db49d2262cb$export$48a4cacf2b7a4441, {\n fill: fill,\n backgroundColor: backgroundColor,\n ...props\n });\n}\nfunction $1da06db49d2262cb$var$getPatternID(liths, lithMap) {\n if (lithMap == null || liths == null || liths.length == 0) return null;\n const patternIDs = new Set();\n for (const lith of liths){\n const lithData = lithMap.get(lith.lith_id);\n if (lithData) patternIDs.add(`${lithData.fill}`);\n }\n let id = patternIDs.values()[0];\n if (id == \"0\") return null;\n return id;\n}\n$parcel$exportWildcard($1da06db49d2262cb$exports, $bfmPX);\n$parcel$exportWildcard($1da06db49d2262cb$exports, $4Abge);\n$parcel$exportWildcard($1da06db49d2262cb$exports, $lI6Sf);\n\n\nexport {$1da06db49d2262cb$export$3750278673318c9a as UnitsColumn, $1da06db49d2262cb$export$2006342ddaa547c6 as SimpleUnitsColumn, $1da06db49d2262cb$export$600691a8e9d13a7 as BasicUnitComponent, $1da06db49d2262cb$export$48a4cacf2b7a4441 as UnitComponent, $1da06db49d2262cb$export$62c7735c72801c19 as useUnitColor, $1da06db49d2262cb$export$6012fd1584b5d0c0 as ColoredUnitComponent, $1da06db49d2262cb$export$4830e703a903113 as useUnitColorByEnvironment, $1da06db49d2262cb$export$c2fe8a14da82d570 as EnvironmentColoredUnitComponent, $0557c7dbdd54c055$export$175d3e927f1a9860 as getMixedUnitColor, $6b7af672ec278734$export$e4e89ab6c86ac513 as LabelTrackerProvider, $6b7af672ec278734$export$f613830566442374 as TrackedLabeledUnit, $6b7af672ec278734$export$1dfa200d57964eee as CompositeUnitComponent, $6b7af672ec278734$export$a6684360fef0406e as CompositeUnitsColumn, $6b7af672ec278734$export$d8c3f2fdd653a082 as AnnotatedUnitsColumn, $6b7af672ec278734$export$13984e34afdbb040 as SectionLabelsColumn, $6b7af672ec278734$export$6cc7a9df4edde18 as ColumnNotesProvider};\n//# sourceMappingURL=column-views.8ee8469d.js.map\n","import h from \"@macrostrat/hyper\";\nimport {\n LithologyColumn,\n useGeologicPattern,\n} from \"@macrostrat/column-components\";\nimport { UnitNamesColumn } from \"./names\";\nimport { ICompositeUnitProps } from \"./composite\";\nimport { UnitBoxes, UnitProps } from \"./boxes\";\nimport { useColumnLayout } from \"@macrostrat/column-components\";\nimport { useInDarkMode } from \"@macrostrat/ui-components\";\nimport { getMixedUnitColor } from \"./colors\";\nimport { TrackedLabeledUnit } from \"./composite\";\nimport { useEnvironments, useLithologies } from \"../data-provider\";\nimport { useMemo } from \"react\";\nimport { resolveID } from \"./resolvers\";\nimport { Lithology } from \"@macrostrat/api-types\";\n\nexport * from \"./composite\";\nexport * from \"./types\";\nexport * from \"./colors\";\n\nexport function UnitsColumn({ width = 100 }) {\n /*\n A column showing units with USGS color fill\n */\n return h(LithologyColumn, { width }, h(UnitBoxes));\n}\n\nexport function SimpleUnitsColumn(props: ICompositeUnitProps) {\n /*\n A column with units and names either\n overlapping or offset to the right\n */\n const { columnWidth, width, gutterWidth = 0, labelOffset = 30 } = props;\n\n return h([\n h(UnitsColumn, {\n width: columnWidth,\n }),\n h(UnitNamesColumn, {\n transform: `translate(${columnWidth + gutterWidth})`,\n paddingLeft: labelOffset,\n width: width - columnWidth - gutterWidth,\n }),\n ]);\n}\n\nexport function BasicUnitComponent({ division, ...rest }) {\n /** A unit that allows directly setting colors and patterns. */\n\n return h(UnitComponent, {\n division,\n ...rest,\n backgroundColor: division.color,\n patternID: division.patternID,\n });\n}\n\nexport function UnitComponent({ division, nColumns = 2, ...rest }) {\n const width = rest.width ?? useColumnLayout()?.width;\n\n const nOverlappingUnits = division.overlappingUnits?.length ?? 0;\n const _nColumns = nOverlappingUnits == 0 ? 1 : nColumns;\n const columnIx = (division.column ?? 0) % _nColumns;\n const reducedWidth = width / _nColumns;\n const x = (columnIx * width) / _nColumns;\n\n return h(TrackedLabeledUnit, {\n division,\n ...rest,\n width: reducedWidth,\n x,\n });\n}\n\ninterface UnitColorOptions {\n asBackground?: boolean;\n}\n\nexport function useUnitColor(unit, opts: UnitColorOptions = {}): string | null {\n /** Get the color for a unit based on its lithology */\n const lithMap = useLithologies();\n const inDarkMode = useInDarkMode();\n const { asBackground = true } = opts;\n\n return useMemo(() => {\n if (unit == null || lithMap == null) return null;\n return getMixedUnitColor(unit, lithMap, inDarkMode, asBackground);\n }, [unit?.unit_id, lithMap, inDarkMode, asBackground]);\n}\n\nexport function ColoredUnitComponent(props) {\n /** A unit component that is colored using a mixture of lithologies.\n * This is a separate component because it depends on more providers/contexts to determine coloring. */\n const backgroundColor = useUnitColor(props.division);\n\n const patternID = useMemo(() => {\n return resolveID(props.division); // ?? getPatternID(props.division.lith, lithMap);\n }, [props.division?.unit_id]);\n\n const fill = useGeologicPattern(patternID);\n\n return h(UnitComponent, {\n fill,\n backgroundColor,\n ...props,\n });\n}\n\nexport function useUnitColorByEnvironment(\n unit,\n opts: UnitColorOptions = {},\n): string | null {\n /** Get the color for a unit based on its lithology */\n const environmentMap = useEnvironments();\n const lithMap = useLithologies();\n const inDarkMode = useInDarkMode();\n const { asBackground = true } = opts;\n\n return useMemo(() => {\n if (unit == null || environmentMap == null) return null;\n let c = getMixedUnitColor(unit, environmentMap, inDarkMode, asBackground, {\n key: \"environ\",\n id_key: \"environ_id\",\n });\n if (c != null) {\n return c;\n }\n // Fallback to lithology color if no environment color is found\n return getMixedUnitColor(unit, lithMap, inDarkMode, asBackground);\n }, [unit?.unit_id, environmentMap, lithMap, inDarkMode, asBackground]);\n}\n\nexport function EnvironmentColoredUnitComponent(props) {\n /** A unit component that is colored using a mixture of lithologies.\n * This is a separate component because it depends on more providers/contexts to determine coloring. */\n const backgroundColor = useUnitColorByEnvironment(props.division);\n\n const patternID = useMemo(() => {\n return resolveID(props.division); // ?? getPatternID(props.division.lith, lithMap);\n }, [props.division?.unit_id]);\n\n const fill = useGeologicPattern(patternID);\n\n return h(UnitComponent, {\n fill,\n backgroundColor,\n ...props,\n });\n}\n\nfunction getPatternID(\n liths: Array<Lithology>,\n lithMap: Map<number, Lithology>,\n): string | null {\n if (lithMap == null || liths == null || liths.length == 0) {\n return null;\n }\n const patternIDs = new Set<string>();\n for (const lith of liths) {\n const lithData = lithMap.get(lith.lith_id);\n if (lithData) {\n patternIDs.add(`${lithData.fill}`);\n }\n }\n let id = patternIDs.values()[0];\n if (id == \"0\") return null;\n return id;\n}\n"],"names":["$6u7Ut$macrostrathyper","LithologyColumn","$6u7Ut$LithologyColumn","useColumnLayout","$6u7Ut$useColumnLayout","useGeologicPattern","$6u7Ut$useGeologicPattern","useInDarkMode","$6u7Ut$useInDarkMode","useMemo","$6u7Ut$useMemo","$parcel$exportWildcard","dest","source","Object","keys","forEach","key","prototype","hasOwnProperty","call","defineProperty","enumerable","get","$parcel$export","e","n","v","s","set","configurable","$parcel$global","globalThis","$parcel$modules","$parcel$inits","parcelRequire","id","exports","init","module","err","Error","code","register","$1da06db49d2262cb$exports","$1da06db49d2262cb$export$3750278673318c9a","$1da06db49d2262cb$export$2006342ddaa547c6","$1da06db49d2262cb$export$600691a8e9d13a7","$1da06db49d2262cb$export$48a4cacf2b7a4441","$1da06db49d2262cb$export$62c7735c72801c19","$1da06db49d2262cb$export$6012fd1584b5d0c0","$1da06db49d2262cb$export$4830e703a903113","$1da06db49d2262cb$export$c2fe8a14da82d570","$jiUaC","$1n4Pb","$bfmPX","$4Abge","$lgTAP","$5VyZI","$lI6Sf","width","UnitBoxes","props","columnWidth","gutterWidth","labelOffset","UnitNamesColumn","transform","paddingLeft","division","rest","backgroundColor","color","patternID","nColumns","_nColumns","nOverlappingUnits","overlappingUnits","length","columnIx","column","TrackedLabeledUnit","x","unit","opts","lithMap","useLithologies","inDarkMode","asBackground","getMixedUnitColor","unit_id","fill","resolveID","environmentMap","useEnvironments","c","id_key","UnitsColumn","SimpleUnitsColumn","BasicUnitComponent","UnitComponent","useUnitColor","ColoredUnitComponent","useUnitColorByEnvironment","EnvironmentColoredUnitComponent","$0557c7dbdd54c055$export$175d3e927f1a9860","$6b7af672ec278734$export$e4e89ab6c86ac513","LabelTrackerProvider","$6b7af672ec278734$export$f613830566442374","$6b7af672ec278734$export$1dfa200d57964eee","CompositeUnitComponent","$6b7af672ec278734$export$a6684360fef0406e","CompositeUnitsColumn","$6b7af672ec278734$export$d8c3f2fdd653a082","AnnotatedUnitsColumn","$6b7af672ec278734$export$13984e34afdbb040","SectionLabelsColumn","$6b7af672ec278734$export$6cc7a9df4edde18","ColumnNotesProvider"],"version":3,"file":"column-views.8ee8469d.js.map","sourceRoot":"../../../../"}
1
+ {"mappings":"A,M,6C,A,O,6C,A,O,6C,A,O,6C,A,O,6C,A,O,6C,A,O,6C,A,Q,M,mB,A,Q,mB,C,C,mB,C,C,sB,C,K,+B,A,Q,iB,C,K,2B,A,Q,W,C,K,O,C,S,E,C,C,C,E,O,O,I,C,G,O,C,S,C,E,Y,G,A,e,G,O,S,C,c,C,I,C,E,I,O,c,C,E,E,C,W,C,E,I,W,O,C,C,E,A,C,E,G,C,C,S,E,C,C,C,C,C,C,C,E,O,c,C,E,E,C,I,E,I,E,W,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,AAAA,CAAA,EAAA,EAAA,iBAAgB,AAAhB,EAAkB,EAAM,EAAgB,EAAY,EAAc,CACxE,IAAK,UACL,OAAQ,YACV,UACA,AAAI,AAAK,MAAL,EACK,EAGF,AAAA,CAAA,EAAA,EAAA,iBAAgB,AAAhB,EAAkB,EAAM,EAAS,EAAY,EACtD,EAAG,CAAC,GAAM,QAAS,EAAgB,EAAS,EAAY,EAAa,CACvE,CAEO,SAAS,EAAgC,CAAK,EAGnD,IAAM,EAAkB,EAA0B,EAAM,QAAQ,EAQhE,OAAO,AAAA,EAAE,EAAe,CACtB,KAHW,AAAA,EAJK,AAAA,EAAQ,IACjB,AAAA,CAAA,EAAA,EAAA,SAAQ,AAAR,EAAU,EAAM,QAAQ,EAC9B,CAAC,EAAM,QAAQ,EAAE,QAAQ,GAM1B,gBAAA,EACA,GAAG,CAAK,AACV,EACF,C,E,E,G,E,E,G,E,E,U,K,W,C,K,iB,C,K,kB,C,K,a,C,K,Y,C,K,oB,C,K,yB,C,K,+B,C,6C,iB,C,6C,oB,C,6C,kB,C,6C,sB,C,6C,oB,C,6C,oB,C,6C,mB,C,4C,mB","sources":["<anon>","packages/column-views/src/units/index.ts"],"sourcesContent":["import \"./column-views.e153680b.js\";\nimport \"./column-views.c921fa1a.js\";\nimport \"./column-views.6bba8c57.js\";\nimport \"./column-views.fafbc028.js\";\nimport \"./column-views.c007152b.js\";\nimport \"./column-views.e7e26765.js\";\nimport \"./column-views.e6720522.js\";\nimport $6u7Ut$macrostrathyper from \"@macrostrat/hyper\";\nimport {LithologyColumn as $6u7Ut$LithologyColumn, useColumnLayout as $6u7Ut$useColumnLayout, useGeologicPattern as $6u7Ut$useGeologicPattern} from \"@macrostrat/column-components\";\nimport {useInDarkMode as $6u7Ut$useInDarkMode} from \"@macrostrat/ui-components\";\nimport {useMemo as $6u7Ut$useMemo} from \"react\";\n\n\nfunction $parcel$exportWildcard(dest, source) {\n Object.keys(source).forEach(function(key) {\n if (key === 'default' || key === '__esModule' || Object.prototype.hasOwnProperty.call(dest, key)) {\n return;\n }\n\n Object.defineProperty(dest, key, {\n enumerable: true,\n get: function get() {\n return source[key];\n }\n });\n });\n\n return dest;\n}\n\nfunction $parcel$export(e, n, v, s) {\n Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});\n}\n\n var $parcel$global = globalThis;\n \nvar $parcel$modules = {};\nvar $parcel$inits = {};\n\nvar parcelRequire = $parcel$global[\"parcelRequirea149\"];\n\nif (parcelRequire == null) {\n parcelRequire = function(id) {\n if (id in $parcel$modules) {\n return $parcel$modules[id].exports;\n }\n if (id in $parcel$inits) {\n var init = $parcel$inits[id];\n delete $parcel$inits[id];\n var module = {id: id, exports: {}};\n $parcel$modules[id] = module;\n init.call(module.exports, module, module.exports);\n return module.exports;\n }\n var err = new Error(\"Cannot find module '\" + id + \"'\");\n err.code = 'MODULE_NOT_FOUND';\n throw err;\n };\n\n parcelRequire.register = function register(id, init) {\n $parcel$inits[id] = init;\n };\n\n $parcel$global[\"parcelRequirea149\"] = parcelRequire;\n}\n\nvar parcelRegister = parcelRequire.register;\nvar $1da06db49d2262cb$exports = {};\n\n$parcel$export($1da06db49d2262cb$exports, \"UnitsColumn\", () => $1da06db49d2262cb$export$3750278673318c9a);\n$parcel$export($1da06db49d2262cb$exports, \"SimpleUnitsColumn\", () => $1da06db49d2262cb$export$2006342ddaa547c6);\n$parcel$export($1da06db49d2262cb$exports, \"BasicUnitComponent\", () => $1da06db49d2262cb$export$600691a8e9d13a7);\n$parcel$export($1da06db49d2262cb$exports, \"UnitComponent\", () => $1da06db49d2262cb$export$48a4cacf2b7a4441);\n$parcel$export($1da06db49d2262cb$exports, \"useUnitColor\", () => $1da06db49d2262cb$export$62c7735c72801c19);\n$parcel$export($1da06db49d2262cb$exports, \"ColoredUnitComponent\", () => $1da06db49d2262cb$export$6012fd1584b5d0c0);\n$parcel$export($1da06db49d2262cb$exports, \"useUnitColorByEnvironment\", () => $1da06db49d2262cb$export$4830e703a903113);\n$parcel$export($1da06db49d2262cb$exports, \"EnvironmentColoredUnitComponent\", () => $1da06db49d2262cb$export$c2fe8a14da82d570);\n\n\n\nvar $jiUaC = parcelRequire(\"jiUaC\");\n\nvar $1n4Pb = parcelRequire(\"1n4Pb\");\n\n\nvar $bfmPX = parcelRequire(\"bfmPX\");\n\nvar $4Abge = parcelRequire(\"4Abge\");\n\nvar $lgTAP = parcelRequire(\"lgTAP\");\n\n\nvar $5VyZI = parcelRequire(\"5VyZI\");\n\nvar $lI6Sf = parcelRequire(\"lI6Sf\");\nfunction $1da06db49d2262cb$export$3750278673318c9a({ width: width = 100 }) {\n /*\n A column showing units with USGS color fill\n */ return (0, $6u7Ut$macrostrathyper)((0, $6u7Ut$LithologyColumn), {\n width: width\n }, (0, $6u7Ut$macrostrathyper)((0, $1n4Pb.UnitBoxes)));\n}\nfunction $1da06db49d2262cb$export$2006342ddaa547c6(props) {\n /*\n A column with units and names either\n overlapping or offset to the right\n */ const { columnWidth: columnWidth, width: width, gutterWidth: gutterWidth = 0, labelOffset: labelOffset = 30 } = props;\n return (0, $6u7Ut$macrostrathyper)([\n (0, $6u7Ut$macrostrathyper)($1da06db49d2262cb$export$3750278673318c9a, {\n width: columnWidth\n }),\n (0, $6u7Ut$macrostrathyper)((0, $jiUaC.UnitNamesColumn), {\n transform: `translate(${columnWidth + gutterWidth})`,\n paddingLeft: labelOffset,\n width: width - columnWidth - gutterWidth\n })\n ]);\n}\nfunction $1da06db49d2262cb$export$600691a8e9d13a7({ division: division, ...rest }) {\n /** A unit that allows directly setting colors and patterns. */ return (0, $6u7Ut$macrostrathyper)($1da06db49d2262cb$export$48a4cacf2b7a4441, {\n division: division,\n ...rest,\n backgroundColor: division.color,\n patternID: division.patternID\n });\n}\nfunction $1da06db49d2262cb$export$48a4cacf2b7a4441({ division: division, nColumns: nColumns = 2, ...rest }) {\n const width = rest.width ?? (0, $6u7Ut$useColumnLayout)()?.width;\n const nOverlappingUnits = division.overlappingUnits?.length ?? 0;\n const _nColumns = nOverlappingUnits == 0 ? 1 : nColumns;\n const columnIx = (division.column ?? 0) % _nColumns;\n const reducedWidth = width / _nColumns;\n const x = columnIx * width / _nColumns;\n return (0, $6u7Ut$macrostrathyper)((0, $4Abge.TrackedLabeledUnit), {\n division: division,\n ...rest,\n width: reducedWidth,\n x: x\n });\n}\nfunction $1da06db49d2262cb$export$62c7735c72801c19(unit, opts = {}) {\n /** Get the color for a unit based on its lithology */ const lithMap = (0, $lgTAP.useLithologies)();\n const inDarkMode = (0, $6u7Ut$useInDarkMode)();\n const { asBackground: asBackground = true } = opts;\n return (0, $6u7Ut$useMemo)(()=>{\n if (unit == null || lithMap == null) return null;\n return (0, $bfmPX.getMixedUnitColor)(unit, lithMap, inDarkMode, asBackground);\n }, [\n unit?.unit_id,\n lithMap,\n inDarkMode,\n asBackground\n ]);\n}\nfunction $1da06db49d2262cb$export$6012fd1584b5d0c0(props) {\n /** A unit component that is colored using a mixture of lithologies.\n * This is a separate component because it depends on more providers/contexts to determine coloring. */ const backgroundColor = $1da06db49d2262cb$export$62c7735c72801c19(props.division);\n const patternID = (0, $6u7Ut$useMemo)(()=>{\n return (0, $5VyZI.resolveID)(props.division); // ?? getPatternID(props.division.lith, lithMap);\n }, [\n props.division?.unit_id\n ]);\n const fill = (0, $6u7Ut$useGeologicPattern)(patternID);\n return (0, $6u7Ut$macrostrathyper)($1da06db49d2262cb$export$48a4cacf2b7a4441, {\n fill: fill,\n backgroundColor: backgroundColor,\n ...props\n });\n}\nfunction $1da06db49d2262cb$export$4830e703a903113(unit, opts = {}) {\n /** Get the color for a unit based on its lithology */ const environmentMap = (0, $lgTAP.useEnvironments)();\n const lithMap = (0, $lgTAP.useLithologies)();\n const inDarkMode = (0, $6u7Ut$useInDarkMode)();\n const { asBackground: asBackground = true } = opts;\n return (0, $6u7Ut$useMemo)(()=>{\n if (unit == null || environmentMap == null) return null;\n let c = (0, $bfmPX.getMixedUnitColor)(unit, environmentMap, inDarkMode, asBackground, {\n key: \"environ\",\n id_key: \"environ_id\"\n });\n if (c != null) return c;\n // Fallback to lithology color if no environment color is found\n return (0, $bfmPX.getMixedUnitColor)(unit, lithMap, inDarkMode, asBackground);\n }, [\n unit?.unit_id,\n environmentMap,\n lithMap,\n inDarkMode,\n asBackground\n ]);\n}\nfunction $1da06db49d2262cb$export$c2fe8a14da82d570(props) {\n /** A unit component that is colored using a mixture of lithologies.\n * This is a separate component because it depends on more providers/contexts to determine coloring. */ const backgroundColor = $1da06db49d2262cb$export$4830e703a903113(props.division);\n const patternID = (0, $6u7Ut$useMemo)(()=>{\n return (0, $5VyZI.resolveID)(props.division); // ?? getPatternID(props.division.lith, lithMap);\n }, [\n props.division?.unit_id\n ]);\n const fill = (0, $6u7Ut$useGeologicPattern)(patternID);\n return (0, $6u7Ut$macrostrathyper)($1da06db49d2262cb$export$48a4cacf2b7a4441, {\n fill: fill,\n backgroundColor: backgroundColor,\n ...props\n });\n}\nfunction $1da06db49d2262cb$var$getPatternID(liths, lithMap) {\n if (lithMap == null || liths == null || liths.length == 0) return null;\n const patternIDs = new Set();\n for (const lith of liths){\n const lithData = lithMap.get(lith.lith_id);\n if (lithData) patternIDs.add(`${lithData.fill}`);\n }\n let id = patternIDs.values()[0];\n if (id == \"0\") return null;\n return id;\n}\n$parcel$exportWildcard($1da06db49d2262cb$exports, $bfmPX);\n$parcel$exportWildcard($1da06db49d2262cb$exports, $4Abge);\n$parcel$exportWildcard($1da06db49d2262cb$exports, $lI6Sf);\n\n\nexport {$1da06db49d2262cb$export$3750278673318c9a as UnitsColumn, $1da06db49d2262cb$export$2006342ddaa547c6 as SimpleUnitsColumn, $1da06db49d2262cb$export$600691a8e9d13a7 as BasicUnitComponent, $1da06db49d2262cb$export$48a4cacf2b7a4441 as UnitComponent, $1da06db49d2262cb$export$62c7735c72801c19 as useUnitColor, $1da06db49d2262cb$export$6012fd1584b5d0c0 as ColoredUnitComponent, $1da06db49d2262cb$export$4830e703a903113 as useUnitColorByEnvironment, $1da06db49d2262cb$export$c2fe8a14da82d570 as EnvironmentColoredUnitComponent, $0557c7dbdd54c055$export$175d3e927f1a9860 as getMixedUnitColor, $6b7af672ec278734$export$e4e89ab6c86ac513 as LabelTrackerProvider, $6b7af672ec278734$export$f613830566442374 as TrackedLabeledUnit, $6b7af672ec278734$export$1dfa200d57964eee as CompositeUnitComponent, $6b7af672ec278734$export$a6684360fef0406e as CompositeUnitsColumn, $6b7af672ec278734$export$d8c3f2fdd653a082 as AnnotatedUnitsColumn, $6b7af672ec278734$export$13984e34afdbb040 as SectionLabelsColumn, $6b7af672ec278734$export$6cc7a9df4edde18 as ColumnNotesProvider};\n//# sourceMappingURL=column-views.3d0c2bea.js.map\n","import h from \"@macrostrat/hyper\";\nimport {\n LithologyColumn,\n useGeologicPattern,\n} from \"@macrostrat/column-components\";\nimport { UnitNamesColumn } from \"./names\";\nimport { ICompositeUnitProps } from \"./composite\";\nimport { UnitBoxes, UnitProps } from \"./boxes\";\nimport { useColumnLayout } from \"@macrostrat/column-components\";\nimport { useInDarkMode } from \"@macrostrat/ui-components\";\nimport { getMixedUnitColor } from \"./colors\";\nimport { TrackedLabeledUnit } from \"./composite\";\nimport { useEnvironments, useLithologies } from \"../data-provider\";\nimport { useMemo } from \"react\";\nimport { resolveID } from \"./resolvers\";\nimport { Lithology } from \"@macrostrat/api-types\";\n\nexport * from \"./composite\";\nexport * from \"./types\";\nexport * from \"./colors\";\n\nexport function UnitsColumn({ width = 100 }) {\n /*\n A column showing units with USGS color fill\n */\n return h(LithologyColumn, { width }, h(UnitBoxes));\n}\n\nexport function SimpleUnitsColumn(props: ICompositeUnitProps) {\n /*\n A column with units and names either\n overlapping or offset to the right\n */\n const { columnWidth, width, gutterWidth = 0, labelOffset = 30 } = props;\n\n return h([\n h(UnitsColumn, {\n width: columnWidth,\n }),\n h(UnitNamesColumn, {\n transform: `translate(${columnWidth + gutterWidth})`,\n paddingLeft: labelOffset,\n width: width - columnWidth - gutterWidth,\n }),\n ]);\n}\n\nexport function BasicUnitComponent({ division, ...rest }) {\n /** A unit that allows directly setting colors and patterns. */\n\n return h(UnitComponent, {\n division,\n ...rest,\n backgroundColor: division.color,\n patternID: division.patternID,\n });\n}\n\nexport function UnitComponent({ division, nColumns = 2, ...rest }) {\n const width = rest.width ?? useColumnLayout()?.width;\n\n const nOverlappingUnits = division.overlappingUnits?.length ?? 0;\n const _nColumns = nOverlappingUnits == 0 ? 1 : nColumns;\n const columnIx = (division.column ?? 0) % _nColumns;\n const reducedWidth = width / _nColumns;\n const x = (columnIx * width) / _nColumns;\n\n return h(TrackedLabeledUnit, {\n division,\n ...rest,\n width: reducedWidth,\n x,\n });\n}\n\ninterface UnitColorOptions {\n asBackground?: boolean;\n}\n\nexport function useUnitColor(unit, opts: UnitColorOptions = {}): string | null {\n /** Get the color for a unit based on its lithology */\n const lithMap = useLithologies();\n const inDarkMode = useInDarkMode();\n const { asBackground = true } = opts;\n\n return useMemo(() => {\n if (unit == null || lithMap == null) return null;\n return getMixedUnitColor(unit, lithMap, inDarkMode, asBackground);\n }, [unit?.unit_id, lithMap, inDarkMode, asBackground]);\n}\n\nexport function ColoredUnitComponent(props) {\n /** A unit component that is colored using a mixture of lithologies.\n * This is a separate component because it depends on more providers/contexts to determine coloring. */\n const backgroundColor = useUnitColor(props.division);\n\n const patternID = useMemo(() => {\n return resolveID(props.division); // ?? getPatternID(props.division.lith, lithMap);\n }, [props.division?.unit_id]);\n\n const fill = useGeologicPattern(patternID);\n\n return h(UnitComponent, {\n fill,\n backgroundColor,\n ...props,\n });\n}\n\nexport function useUnitColorByEnvironment(\n unit,\n opts: UnitColorOptions = {},\n): string | null {\n /** Get the color for a unit based on its lithology */\n const environmentMap = useEnvironments();\n const lithMap = useLithologies();\n const inDarkMode = useInDarkMode();\n const { asBackground = true } = opts;\n\n return useMemo(() => {\n if (unit == null || environmentMap == null) return null;\n let c = getMixedUnitColor(unit, environmentMap, inDarkMode, asBackground, {\n key: \"environ\",\n id_key: \"environ_id\",\n });\n if (c != null) {\n return c;\n }\n // Fallback to lithology color if no environment color is found\n return getMixedUnitColor(unit, lithMap, inDarkMode, asBackground);\n }, [unit?.unit_id, environmentMap, lithMap, inDarkMode, asBackground]);\n}\n\nexport function EnvironmentColoredUnitComponent(props) {\n /** A unit component that is colored using a mixture of lithologies.\n * This is a separate component because it depends on more providers/contexts to determine coloring. */\n const backgroundColor = useUnitColorByEnvironment(props.division);\n\n const patternID = useMemo(() => {\n return resolveID(props.division); // ?? getPatternID(props.division.lith, lithMap);\n }, [props.division?.unit_id]);\n\n const fill = useGeologicPattern(patternID);\n\n return h(UnitComponent, {\n fill,\n backgroundColor,\n ...props,\n });\n}\n\nfunction getPatternID(\n liths: Array<Lithology>,\n lithMap: Map<number, Lithology>,\n): string | null {\n if (lithMap == null || liths == null || liths.length == 0) {\n return null;\n }\n const patternIDs = new Set<string>();\n for (const lith of liths) {\n const lithData = lithMap.get(lith.lith_id);\n if (lithData) {\n patternIDs.add(`${lithData.fill}`);\n }\n }\n let id = patternIDs.values()[0];\n if (id == \"0\") return null;\n return id;\n}\n"],"names":["$6u7Ut$macrostrathyper","LithologyColumn","$6u7Ut$LithologyColumn","useColumnLayout","$6u7Ut$useColumnLayout","useGeologicPattern","$6u7Ut$useGeologicPattern","useInDarkMode","$6u7Ut$useInDarkMode","useMemo","$6u7Ut$useMemo","$parcel$exportWildcard","dest","source","Object","keys","forEach","key","prototype","hasOwnProperty","call","defineProperty","enumerable","get","$parcel$export","e","n","v","s","set","configurable","$parcel$global","globalThis","$parcel$modules","$parcel$inits","parcelRequire","id","exports","init","module","err","Error","code","register","$1da06db49d2262cb$exports","$1da06db49d2262cb$export$3750278673318c9a","$1da06db49d2262cb$export$2006342ddaa547c6","$1da06db49d2262cb$export$600691a8e9d13a7","$1da06db49d2262cb$export$48a4cacf2b7a4441","$1da06db49d2262cb$export$62c7735c72801c19","$1da06db49d2262cb$export$6012fd1584b5d0c0","$1da06db49d2262cb$export$4830e703a903113","$1da06db49d2262cb$export$c2fe8a14da82d570","$jiUaC","$1n4Pb","$bfmPX","$4Abge","$lgTAP","$5VyZI","$lI6Sf","width","UnitBoxes","props","columnWidth","gutterWidth","labelOffset","UnitNamesColumn","transform","paddingLeft","division","rest","backgroundColor","color","patternID","nColumns","_nColumns","nOverlappingUnits","overlappingUnits","length","columnIx","column","TrackedLabeledUnit","x","unit","opts","lithMap","useLithologies","inDarkMode","asBackground","getMixedUnitColor","unit_id","fill","resolveID","environmentMap","useEnvironments","c","id_key","UnitsColumn","SimpleUnitsColumn","BasicUnitComponent","UnitComponent","useUnitColor","ColoredUnitComponent","useUnitColorByEnvironment","EnvironmentColoredUnitComponent","$0557c7dbdd54c055$export$175d3e927f1a9860","$6b7af672ec278734$export$e4e89ab6c86ac513","LabelTrackerProvider","$6b7af672ec278734$export$f613830566442374","$6b7af672ec278734$export$1dfa200d57964eee","CompositeUnitComponent","$6b7af672ec278734$export$a6684360fef0406e","CompositeUnitsColumn","$6b7af672ec278734$export$d8c3f2fdd653a082","AnnotatedUnitsColumn","$6b7af672ec278734$export$13984e34afdbb040","SectionLabelsColumn","$6b7af672ec278734$export$6cc7a9df4edde18","ColumnNotesProvider"],"version":3,"file":"column-views.3d0c2bea.js.map","sourceRoot":"../../../../"}
@@ -1 +1 @@
1
- {"mappings":"A,M,6C,A,Q,iB,C,C,W,C,C,c,C,C,U,C,C,a,C,K,O,A,Q,M,mB,A,Q,mB,C,K,a,A,Q,Q,C,K,O,C,S,E,C,C,C,C,C,C,C,E,O,c,C,E,E,C,I,E,I,E,W,C,E,a,C,C,E,C,I,E,W,E,C,E,E,C,E,E,E,iB,A,O,I,A,C,E,S,C,E,G,K,E,O,C,C,E,C,O,C,G,K,E,C,I,E,C,C,E,A,Q,C,C,E,C,I,E,C,G,E,Q,C,C,E,O,C,C,E,C,E,E,I,C,E,O,C,E,E,O,E,E,O,A,C,I,E,A,M,uB,E,I,O,E,I,C,mB,C,C,E,Q,C,S,C,C,C,E,C,C,E,C,C,E,E,iB,C,G,E,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AAE,CAAE,MAAA,CAAM,EAAG,GAEvD,CAEO,SAAS,IACd,IAAM,EAAM,AAAA,EAAW,GACvB,GAAI,CAAC,EACH,MAAM,AAAI,MACR,8EAGJ,OAAO,CACT,CAEO,SAAS,IACd,OAAO,EAAa,EACtB,CAEO,SAAS,IACd,GAAI,CACF,OAAO,EAAa,EACtB,CAAE,KAAM,CACN,OAAO,IACT,CACF,CAEO,SAAS,IACd,IAAM,EAAM,IACZ,OAAO,AAAA,EACL,IAAM,AAAA,CAAA,EAAA,EAAA,oBAAmB,AAAnB,EAAqB,EAAI,QAAQ,CAAE,CAAA,GACzC,CAAC,EAAI,QAAQ,CAAC,CAElB,CAEA,SAAS,EAAY,CAAA,MACnB,CAAK,CAGN,EAQC,IAAM,EAAQ,IAGR,EAAgB,AAAA,EAAO,EAAM,MAAM,EAQzC,IAAK,GAAM,CAAC,EAAM,EAAM,GAPxB,AAAA,EAAU,KACJ,EAAc,OAAO,GAAK,EAAM,MAAM,GACxC,QAAQ,KAAK,CAAC,4DACd,EAAc,OAAO,CAAG,EAAM,MAAM,CAExC,EAAG,CAAC,EAAM,MAAM,CAAC,EAEW,GAC1B,AAAA,EAAU,KACR,EAAM,GAAG,CAAC,EAAM,EAClB,EAAG,CAAC,EAAO,EAAM,EAEnB,OAAO,IACT,Q,K,6B,C,K,4B,C,K,uB,C,K,kB,C,K,iB,C,K,iB","sources":["<anon>","packages/column-views/src/data-provider/store.ts"],"sourcesContent":["import \"./column-views.a596b1f5.js\";\nimport {createContext as $eJc70$createContext, useMemo as $eJc70$useMemo, useContext as $eJc70$useContext, useRef as $eJc70$useRef, useEffect as $eJc70$useEffect} from \"react\";\nimport $eJc70$macrostrathyper from \"@macrostrat/hyper\";\nimport {createIsolation as $eJc70$createIsolation} from \"jotai-scope\";\nimport {atom as $eJc70$atom} from \"jotai\";\n\n\nfunction $parcel$export(e, n, v, s) {\n Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});\n}\n\n var $parcel$global = globalThis;\n \nvar $parcel$modules = {};\nvar $parcel$inits = {};\n\nvar parcelRequire = $parcel$global[\"parcelRequirea149\"];\n\nif (parcelRequire == null) {\n parcelRequire = function(id) {\n if (id in $parcel$modules) {\n return $parcel$modules[id].exports;\n }\n if (id in $parcel$inits) {\n var init = $parcel$inits[id];\n delete $parcel$inits[id];\n var module = {id: id, exports: {}};\n $parcel$modules[id] = module;\n init.call(module.exports, module, module.exports);\n return module.exports;\n }\n var err = new Error(\"Cannot find module '\" + id + \"'\");\n err.code = 'MODULE_NOT_FOUND';\n throw err;\n };\n\n parcelRequire.register = function register(id, init) {\n $parcel$inits[id] = init;\n };\n\n $parcel$global[\"parcelRequirea149\"] = parcelRequire;\n}\n\nvar parcelRegister = parcelRequire.register;\nvar $91525b65c57a1e5d$exports = {};\n\n$parcel$export($91525b65c57a1e5d$exports, \"MacrostratColumnStateProvider\", () => $91525b65c57a1e5d$export$ef5395089200109b);\n$parcel$export($91525b65c57a1e5d$exports, \"MacrostratColumnDataProvider\", () => $91525b65c57a1e5d$export$7fec7bd80ff9c10e);\n$parcel$export($91525b65c57a1e5d$exports, \"useMacrostratColumnData\", () => $91525b65c57a1e5d$export$f8509b7cce386c7d);\n$parcel$export($91525b65c57a1e5d$exports, \"useMacrostratUnits\", () => $91525b65c57a1e5d$export$6fb40844db555b2);\n$parcel$export($91525b65c57a1e5d$exports, \"useColumnUnitsMap\", () => $91525b65c57a1e5d$export$7513be0cfd10d9cc);\n$parcel$export($91525b65c57a1e5d$exports, \"useCompositeScale\", () => $91525b65c57a1e5d$export$a7fc62995ec4f76);\n\n\n\nvar $bBAza = parcelRequire(\"bBAza\");\n\n\nconst { Provider: $91525b65c57a1e5d$var$Provider, useSetAtom: $91525b65c57a1e5d$var$useSetAtom, useAtomValue: $91525b65c57a1e5d$var$useAtomValue, useStore: $91525b65c57a1e5d$var$useStore } = (0, $eJc70$createIsolation)();\nconst $91525b65c57a1e5d$var$columnUnitsAtom = (0, $eJc70$atom)();\nconst $91525b65c57a1e5d$var$columnUnitsMapAtom = (0, $eJc70$atom)((get)=>{\n const units = get($91525b65c57a1e5d$var$columnUnitsAtom);\n if (!units) return null;\n const unitMap = new Map();\n units.forEach((unit)=>{\n unitMap.set(unit.unit_id, unit);\n });\n return unitMap;\n});\nfunction $91525b65c57a1e5d$var$ScopedProvider({ children: children, ...rest }) {\n // Always use the same store instance in this tree\n let val = null;\n try {\n val = $91525b65c57a1e5d$var$useStore();\n } catch {\n // No store found, create a new one\n val = null;\n }\n return (0, $eJc70$macrostrathyper)($91525b65c57a1e5d$var$Provider, {\n store: val,\n ...rest\n }, children);\n}\nfunction $91525b65c57a1e5d$export$ef5395089200109b({ children: children, units: units }) {\n /** Top-level provider for Macrostrat column data.\n * It is either provided by the Column component itself, or\n * can be hoisted higher in the tree to provide a common data context\n */ const atomMap = [\n [\n $91525b65c57a1e5d$var$columnUnitsAtom,\n units\n ]\n ];\n return (0, $eJc70$macrostrathyper)($91525b65c57a1e5d$var$ScopedProvider, {\n initialValues: atomMap\n }, [\n (0, $eJc70$macrostrathyper)($91525b65c57a1e5d$var$AtomUpdater, {\n atoms: atomMap\n }),\n children\n ]);\n}\nconst $91525b65c57a1e5d$var$MacrostratColumnDataContext = (0, $eJc70$createContext)(null);\nfunction $91525b65c57a1e5d$export$7fec7bd80ff9c10e({ children: children, units: units, sections: sections, totalHeight: totalHeight, axisType: axisType }) {\n /** Internal provider for Macrostrat column data.\n * As a general rule, we want to provide data and column-axis\n * height calculations through the context, since these need to\n * be accessed by any component that lays out information on the\n * column.\n *\n * Cross-axis layout and view configuration (e.g., showing and hiding\n * of different components or labels) should be handled through passing\n * props to the components themselves.\n * */ const value = (0, $eJc70$useMemo)(()=>{\n // For now, change ordinal axis types to age axis types\n return {\n units: units,\n sections: sections,\n totalHeight: totalHeight,\n axisType: axisType\n };\n }, [\n units,\n sections,\n totalHeight,\n axisType\n ]);\n return (0, $eJc70$macrostrathyper)($91525b65c57a1e5d$export$ef5395089200109b, {\n units: units\n }, (0, $eJc70$macrostrathyper)($91525b65c57a1e5d$var$MacrostratColumnDataContext.Provider, {\n value: value\n }, children));\n}\nfunction $91525b65c57a1e5d$export$f8509b7cce386c7d() {\n const ctx = (0, $eJc70$useContext)($91525b65c57a1e5d$var$MacrostratColumnDataContext);\n if (!ctx) throw new Error(\"useMacrostratColumnData must be used within a MacrostratColumnDataProvider\");\n return ctx;\n}\nfunction $91525b65c57a1e5d$export$6fb40844db555b2() {\n return $91525b65c57a1e5d$var$useAtomValue($91525b65c57a1e5d$var$columnUnitsAtom);\n}\nfunction $91525b65c57a1e5d$export$7513be0cfd10d9cc() {\n try {\n return $91525b65c57a1e5d$var$useAtomValue($91525b65c57a1e5d$var$columnUnitsMapAtom);\n } catch {\n return null;\n }\n}\nfunction $91525b65c57a1e5d$export$a7fc62995ec4f76() {\n const ctx = $91525b65c57a1e5d$export$f8509b7cce386c7d();\n return (0, $eJc70$useMemo)(()=>(0, $bBAza.createCompositeScale)(ctx.sections, true), [\n ctx.sections\n ]);\n}\nfunction $91525b65c57a1e5d$var$AtomUpdater({ atoms: atoms }) {\n /**\n * A generic updater to sync Jotai atoms with state passed as props.\n * Useful for scoped providers where state needs to be synced outside\n * of the current context.\n */ /** TODO: this is an awkward way to keep atoms updated */ // The scoped store\n const store = $91525b65c57a1e5d$var$useStore();\n // Warn on atoms changing length\n const prevLengthRef = (0, $eJc70$useRef)(atoms.length);\n (0, $eJc70$useEffect)(()=>{\n if (prevLengthRef.current !== atoms.length) {\n console.error(\"Error: number of atoms in ScopedAtomUpdater has changed.\");\n prevLengthRef.current = atoms.length;\n }\n }, [\n atoms.length\n ]);\n for (const [atom, value] of atoms)(0, $eJc70$useEffect)(()=>{\n store.set(atom, value);\n }, [\n store,\n value\n ]);\n return null;\n}\n\n\nexport {$91525b65c57a1e5d$export$ef5395089200109b as MacrostratColumnStateProvider, $91525b65c57a1e5d$export$7fec7bd80ff9c10e as MacrostratColumnDataProvider, $91525b65c57a1e5d$export$f8509b7cce386c7d as useMacrostratColumnData, $91525b65c57a1e5d$export$6fb40844db555b2 as useMacrostratUnits, $91525b65c57a1e5d$export$7513be0cfd10d9cc as useColumnUnitsMap, $91525b65c57a1e5d$export$a7fc62995ec4f76 as useCompositeScale};\n//# sourceMappingURL=column-views.46efb749.js.map\n","import {\n createContext,\n ReactNode,\n useContext,\n useEffect,\n useMemo,\n useRef,\n} from \"react\";\nimport h from \"@macrostrat/hyper\";\nimport {\n CompositeColumnScale,\n createCompositeScale,\n} from \"../prepare-units/composite-scale\";\nimport { ColumnAxisType } from \"@macrostrat/column-components\";\nimport type { ExtUnit, PackageLayoutData } from \"../prepare-units\";\n// An isolated jotai store for Macrostrat column usage\n// TODO: there might be a better way to do this using the MacrostratDataProvider or similar\nimport { createIsolation } from \"jotai-scope\";\nimport { atom, PrimitiveAtom, type WritableAtom } from \"jotai\";\n\nconst { Provider, useSetAtom, useAtomValue, useStore } = createIsolation();\n\ntype ProviderProps = {\n children: ReactNode;\n initialValues?: Iterable<[WritableAtom<any, any, any>, any]>;\n};\n\nconst columnUnitsAtom = atom<ExtUnit[]>();\n\nconst columnUnitsMapAtom = atom<Map<number, ExtUnit> | null>((get) => {\n const units = get(columnUnitsAtom);\n if (!units) return null;\n const unitMap = new Map<number, ExtUnit>();\n units.forEach((unit) => {\n unitMap.set(unit.unit_id, unit);\n });\n return unitMap;\n});\n\nfunction ScopedProvider({ children, ...rest }: ProviderProps) {\n // Always use the same store instance in this tree\n let val = null;\n try {\n val = useStore();\n } catch {\n // No store found, create a new one\n val = null;\n }\n return h(Provider, { store: val, ...rest }, children);\n}\n\nexport function MacrostratColumnStateProvider({\n children,\n units,\n}: {\n children: ReactNode;\n units: ExtUnit[];\n}) {\n /** Top-level provider for Macrostrat column data.\n * It is either provided by the Column component itself, or\n * can be hoisted higher in the tree to provide a common data context\n */\n\n const atomMap: [[PrimitiveAtom<ExtUnit[]>, ExtUnit[]]] = [\n [columnUnitsAtom, units],\n ];\n\n return h(\n ScopedProvider,\n {\n initialValues: atomMap,\n },\n [h(AtomUpdater, { atoms: atomMap }), children],\n );\n}\n\nexport interface MacrostratColumnDataContext {\n units: ExtUnit[];\n sections: PackageLayoutData[];\n totalHeight?: number;\n axisType?: ColumnAxisType;\n}\n\nconst MacrostratColumnDataContext =\n createContext<MacrostratColumnDataContext>(null);\n\nexport function MacrostratColumnDataProvider({\n children,\n units,\n sections,\n totalHeight,\n axisType,\n}: MacrostratColumnDataContext & { children: ReactNode }) {\n /** Internal provider for Macrostrat column data.\n * As a general rule, we want to provide data and column-axis\n * height calculations through the context, since these need to\n * be accessed by any component that lays out information on the\n * column.\n *\n * Cross-axis layout and view configuration (e.g., showing and hiding\n * of different components or labels) should be handled through passing\n * props to the components themselves.\n * */\n\n const value = useMemo(() => {\n // For now, change ordinal axis types to age axis types\n return {\n units,\n sections,\n totalHeight,\n axisType,\n };\n }, [units, sections, totalHeight, axisType]);\n\n return h(\n MacrostratColumnStateProvider,\n { units },\n h(MacrostratColumnDataContext.Provider, { value }, children),\n );\n}\n\nexport function useMacrostratColumnData() {\n const ctx = useContext(MacrostratColumnDataContext);\n if (!ctx) {\n throw new Error(\n \"useMacrostratColumnData must be used within a MacrostratColumnDataProvider\",\n );\n }\n return ctx;\n}\n\nexport function useMacrostratUnits() {\n return useAtomValue(columnUnitsAtom);\n}\n\nexport function useColumnUnitsMap(): Map<number, ExtUnit> | null {\n try {\n return useAtomValue(columnUnitsMapAtom);\n } catch {\n return null;\n }\n}\n\nexport function useCompositeScale(): CompositeColumnScale {\n const ctx = useMacrostratColumnData();\n return useMemo(\n () => createCompositeScale(ctx.sections, true),\n [ctx.sections],\n );\n}\n\nfunction AtomUpdater({\n atoms,\n}: {\n atoms: [WritableAtom<any, any, any>, any][];\n}) {\n /**\n * A generic updater to sync Jotai atoms with state passed as props.\n * Useful for scoped providers where state needs to be synced outside\n * of the current context.\n */\n /** TODO: this is an awkward way to keep atoms updated */\n // The scoped store\n const store = useStore();\n\n // Warn on atoms changing length\n const prevLengthRef = useRef(atoms.length);\n useEffect(() => {\n if (prevLengthRef.current !== atoms.length) {\n console.error(\"Error: number of atoms in ScopedAtomUpdater has changed.\");\n prevLengthRef.current = atoms.length;\n }\n }, [atoms.length]);\n\n for (const [atom, value] of atoms) {\n useEffect(() => {\n store.set(atom, value);\n }, [store, value]);\n }\n return null;\n}\n"],"names":["createContext","$eJc70$createContext","useMemo","$eJc70$useMemo","useContext","$eJc70$useContext","useRef","$eJc70$useRef","useEffect","$eJc70$useEffect","$eJc70$macrostrathyper","createIsolation","$eJc70$createIsolation","atom","$eJc70$atom","$parcel$export","e","n","v","s","Object","defineProperty","get","set","enumerable","configurable","$parcel$global","globalThis","$parcel$modules","$parcel$inits","parcelRequire","id","exports","init","module","call","err","Error","code","register","$91525b65c57a1e5d$exports","$91525b65c57a1e5d$export$ef5395089200109b","$91525b65c57a1e5d$export$7fec7bd80ff9c10e","$91525b65c57a1e5d$export$f8509b7cce386c7d","$91525b65c57a1e5d$export$6fb40844db555b2","$91525b65c57a1e5d$export$7513be0cfd10d9cc","$91525b65c57a1e5d$export$a7fc62995ec4f76","$bBAza","Provider","$91525b65c57a1e5d$var$Provider","useSetAtom","$91525b65c57a1e5d$var$useSetAtom","useAtomValue","$91525b65c57a1e5d$var$useAtomValue","useStore","$91525b65c57a1e5d$var$useStore","$91525b65c57a1e5d$var$columnUnitsAtom","$91525b65c57a1e5d$var$columnUnitsMapAtom","units","unitMap","Map","forEach","unit","unit_id","$91525b65c57a1e5d$var$ScopedProvider","children","rest","val","store","atomMap","initialValues","$91525b65c57a1e5d$var$AtomUpdater","atoms","$91525b65c57a1e5d$var$MacrostratColumnDataContext","sections","totalHeight","axisType","value","ctx","createCompositeScale","prevLengthRef","length","current","console","error","MacrostratColumnStateProvider","MacrostratColumnDataProvider","useMacrostratColumnData","useMacrostratUnits","useColumnUnitsMap","useCompositeScale"],"version":3,"file":"column-views.46efb749.js.map","sourceRoot":"../../../../"}
1
+ {"mappings":"A,M,6C,A,Q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Q,K,6B,C,K,4B,C,K,uB,C,K,kB,C,K,iB,C,K,iB","sources":["<anon>","packages/column-views/src/data-provider/store.ts"],"sourcesContent":["import \"./column-views.a596b1f5.js\";\nimport {createContext as $eJc70$createContext, useMemo as $eJc70$useMemo, useContext as $eJc70$useContext, useRef as $eJc70$useRef, useEffect as $eJc70$useEffect} from \"react\";\nimport $eJc70$macrostrathyper from \"@macrostrat/hyper\";\nimport {createIsolation as $eJc70$createIsolation} from \"jotai-scope\";\nimport {atom as $eJc70$atom} from \"jotai\";\n\n\nfunction $parcel$export(e, n, v, s) {\n Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});\n}\n\n var $parcel$global = globalThis;\n \nvar $parcel$modules = {};\nvar $parcel$inits = {};\n\nvar parcelRequire = $parcel$global[\"parcelRequirea149\"];\n\nif (parcelRequire == null) {\n parcelRequire = function(id) {\n if (id in $parcel$modules) {\n return $parcel$modules[id].exports;\n }\n if (id in $parcel$inits) {\n var init = $parcel$inits[id];\n delete $parcel$inits[id];\n var module = {id: id, exports: {}};\n $parcel$modules[id] = module;\n init.call(module.exports, module, module.exports);\n return module.exports;\n }\n var err = new Error(\"Cannot find module '\" + id + \"'\");\n err.code = 'MODULE_NOT_FOUND';\n throw err;\n };\n\n parcelRequire.register = function register(id, init) {\n $parcel$inits[id] = init;\n };\n\n $parcel$global[\"parcelRequirea149\"] = parcelRequire;\n}\n\nvar parcelRegister = parcelRequire.register;\nvar $91525b65c57a1e5d$exports = {};\n\n$parcel$export($91525b65c57a1e5d$exports, \"MacrostratColumnStateProvider\", () => $91525b65c57a1e5d$export$ef5395089200109b);\n$parcel$export($91525b65c57a1e5d$exports, \"MacrostratColumnDataProvider\", () => $91525b65c57a1e5d$export$7fec7bd80ff9c10e);\n$parcel$export($91525b65c57a1e5d$exports, \"useMacrostratColumnData\", () => $91525b65c57a1e5d$export$f8509b7cce386c7d);\n$parcel$export($91525b65c57a1e5d$exports, \"useMacrostratUnits\", () => $91525b65c57a1e5d$export$6fb40844db555b2);\n$parcel$export($91525b65c57a1e5d$exports, \"useColumnUnitsMap\", () => $91525b65c57a1e5d$export$7513be0cfd10d9cc);\n$parcel$export($91525b65c57a1e5d$exports, \"useCompositeScale\", () => $91525b65c57a1e5d$export$a7fc62995ec4f76);\n\n\n\nvar $bBAza = parcelRequire(\"bBAza\");\n\n\nconst { Provider: $91525b65c57a1e5d$var$Provider, useSetAtom: $91525b65c57a1e5d$var$useSetAtom, useAtomValue: $91525b65c57a1e5d$var$useAtomValue, useStore: $91525b65c57a1e5d$var$useStore } = (0, $eJc70$createIsolation)();\nconst $91525b65c57a1e5d$var$columnUnitsAtom = (0, $eJc70$atom)();\nconst $91525b65c57a1e5d$var$columnUnitsMapAtom = (0, $eJc70$atom)((get)=>{\n const units = get($91525b65c57a1e5d$var$columnUnitsAtom);\n if (!units) return null;\n const unitMap = new Map();\n units.forEach((unit)=>{\n unitMap.set(unit.unit_id, unit);\n });\n return unitMap;\n});\nfunction $91525b65c57a1e5d$var$ScopedProvider({ children: children, ...rest }) {\n // Always use the same store instance in this tree\n let val = null;\n try {\n val = $91525b65c57a1e5d$var$useStore();\n } catch {\n // No store found, create a new one\n val = null;\n }\n return (0, $eJc70$macrostrathyper)($91525b65c57a1e5d$var$Provider, {\n store: val,\n ...rest\n }, children);\n}\nfunction $91525b65c57a1e5d$export$ef5395089200109b({ children: children, units: units }) {\n /** Top-level provider for Macrostrat column data.\n * It is either provided by the Column component itself, or\n * can be hoisted higher in the tree to provide a common data context\n */ const atomMap = [\n [\n $91525b65c57a1e5d$var$columnUnitsAtom,\n units\n ]\n ];\n return (0, $eJc70$macrostrathyper)($91525b65c57a1e5d$var$ScopedProvider, {\n initialValues: atomMap\n }, [\n (0, $eJc70$macrostrathyper)($91525b65c57a1e5d$var$AtomUpdater, {\n atoms: atomMap\n }),\n children\n ]);\n}\nconst $91525b65c57a1e5d$var$MacrostratColumnDataContext = (0, $eJc70$createContext)(null);\nfunction $91525b65c57a1e5d$export$7fec7bd80ff9c10e({ children: children, units: units, sections: sections, totalHeight: totalHeight, axisType: axisType }) {\n /** Internal provider for Macrostrat column data.\n * As a general rule, we want to provide data and column-axis\n * height calculations through the context, since these need to\n * be accessed by any component that lays out information on the\n * column.\n *\n * Cross-axis layout and view configuration (e.g., showing and hiding\n * of different components or labels) should be handled through passing\n * props to the components themselves.\n * */ const value = (0, $eJc70$useMemo)(()=>{\n // For now, change ordinal axis types to age axis types\n return {\n units: units,\n sections: sections,\n totalHeight: totalHeight,\n axisType: axisType\n };\n }, [\n units,\n sections,\n totalHeight,\n axisType\n ]);\n return (0, $eJc70$macrostrathyper)($91525b65c57a1e5d$export$ef5395089200109b, {\n units: units\n }, (0, $eJc70$macrostrathyper)($91525b65c57a1e5d$var$MacrostratColumnDataContext.Provider, {\n value: value\n }, children));\n}\nfunction $91525b65c57a1e5d$export$f8509b7cce386c7d() {\n const ctx = (0, $eJc70$useContext)($91525b65c57a1e5d$var$MacrostratColumnDataContext);\n if (!ctx) throw new Error(\"useMacrostratColumnData must be used within a MacrostratColumnDataProvider\");\n return ctx;\n}\nfunction $91525b65c57a1e5d$export$6fb40844db555b2() {\n return $91525b65c57a1e5d$var$useAtomValue($91525b65c57a1e5d$var$columnUnitsAtom);\n}\nfunction $91525b65c57a1e5d$export$7513be0cfd10d9cc() {\n try {\n return $91525b65c57a1e5d$var$useAtomValue($91525b65c57a1e5d$var$columnUnitsMapAtom);\n } catch {\n return null;\n }\n}\nfunction $91525b65c57a1e5d$export$a7fc62995ec4f76() {\n const ctx = $91525b65c57a1e5d$export$f8509b7cce386c7d();\n return (0, $eJc70$useMemo)(()=>(0, $bBAza.createCompositeScale)(ctx.sections, true), [\n ctx.sections\n ]);\n}\nfunction $91525b65c57a1e5d$var$AtomUpdater({ atoms: atoms }) {\n /**\n * A generic updater to sync Jotai atoms with state passed as props.\n * Useful for scoped providers where state needs to be synced outside\n * of the current context.\n */ /** TODO: this is an awkward way to keep atoms updated */ // The scoped store\n const store = $91525b65c57a1e5d$var$useStore();\n // Warn on atoms changing length\n const prevLengthRef = (0, $eJc70$useRef)(atoms.length);\n (0, $eJc70$useEffect)(()=>{\n if (prevLengthRef.current !== atoms.length) {\n console.error(\"Error: number of atoms in ScopedAtomUpdater has changed.\");\n prevLengthRef.current = atoms.length;\n }\n }, [\n atoms.length\n ]);\n for (const [atom, value] of atoms)(0, $eJc70$useEffect)(()=>{\n store.set(atom, value);\n }, [\n store,\n value\n ]);\n return null;\n}\n\n\nexport {$91525b65c57a1e5d$export$ef5395089200109b as MacrostratColumnStateProvider, $91525b65c57a1e5d$export$7fec7bd80ff9c10e as MacrostratColumnDataProvider, $91525b65c57a1e5d$export$f8509b7cce386c7d as useMacrostratColumnData, $91525b65c57a1e5d$export$6fb40844db555b2 as useMacrostratUnits, $91525b65c57a1e5d$export$7513be0cfd10d9cc as useColumnUnitsMap, $91525b65c57a1e5d$export$a7fc62995ec4f76 as useCompositeScale};\n//# sourceMappingURL=column-views.46efb749.js.map\n","import {\n createContext,\n ReactNode,\n useContext,\n useEffect,\n useMemo,\n useRef,\n} from \"react\";\nimport h from \"@macrostrat/hyper\";\nimport {\n CompositeColumnScale,\n createCompositeScale,\n} from \"../prepare-units/composite-scale\";\nimport { ColumnAxisType } from \"@macrostrat/column-components\";\nimport type { ExtUnit, PackageLayoutData } from \"../prepare-units\";\n// An isolated jotai store for Macrostrat column usage\n// TODO: there might be a better way to do this using the MacrostratDataProvider or similar\nimport { createIsolation } from \"jotai-scope\";\nimport { atom, PrimitiveAtom, type WritableAtom } from \"jotai\";\n\nconst { Provider, useSetAtom, useAtomValue, useStore } = createIsolation();\n\ntype ProviderProps = {\n children: ReactNode;\n initialValues?: Iterable<[WritableAtom<any, any, any>, any]>;\n};\n\nconst columnUnitsAtom = atom<ExtUnit[]>();\n\nconst columnUnitsMapAtom = atom<Map<number, ExtUnit> | null>((get) => {\n const units = get(columnUnitsAtom);\n if (!units) return null;\n const unitMap = new Map<number, ExtUnit>();\n units.forEach((unit) => {\n unitMap.set(unit.unit_id, unit);\n });\n return unitMap;\n});\n\nfunction ScopedProvider({ children, ...rest }: ProviderProps) {\n // Always use the same store instance in this tree\n let val = null;\n try {\n val = useStore();\n } catch {\n // No store found, create a new one\n val = null;\n }\n return h(Provider, { store: val, ...rest }, children);\n}\n\nexport function MacrostratColumnStateProvider({\n children,\n units,\n}: {\n children?: ReactNode;\n units: ExtUnit[];\n}) {\n /** Top-level provider for Macrostrat column data.\n * It is either provided by the Column component itself, or\n * can be hoisted higher in the tree to provide a common data context\n */\n\n const atomMap: [[PrimitiveAtom<ExtUnit[]>, ExtUnit[]]] = [\n [columnUnitsAtom, units],\n ];\n\n return h(\n ScopedProvider,\n {\n initialValues: atomMap,\n },\n [h(AtomUpdater, { atoms: atomMap }), children],\n );\n}\n\nexport interface MacrostratColumnDataContext {\n units: ExtUnit[];\n sections: PackageLayoutData[];\n totalHeight?: number;\n axisType?: ColumnAxisType;\n}\n\nconst MacrostratColumnDataContext =\n createContext<MacrostratColumnDataContext>(null);\n\nexport function MacrostratColumnDataProvider({\n children,\n units,\n sections,\n totalHeight,\n axisType,\n}: MacrostratColumnDataContext & { children: ReactNode }) {\n /** Internal provider for Macrostrat column data.\n * As a general rule, we want to provide data and column-axis\n * height calculations through the context, since these need to\n * be accessed by any component that lays out information on the\n * column.\n *\n * Cross-axis layout and view configuration (e.g., showing and hiding\n * of different components or labels) should be handled through passing\n * props to the components themselves.\n * */\n\n const value = useMemo(() => {\n // For now, change ordinal axis types to age axis types\n return {\n units,\n sections,\n totalHeight,\n axisType,\n };\n }, [units, sections, totalHeight, axisType]);\n\n return h(\n MacrostratColumnStateProvider,\n { units },\n h(MacrostratColumnDataContext.Provider, { value }, children),\n );\n}\n\nexport function useMacrostratColumnData() {\n const ctx = useContext(MacrostratColumnDataContext);\n if (!ctx) {\n throw new Error(\n \"useMacrostratColumnData must be used within a MacrostratColumnDataProvider\",\n );\n }\n return ctx;\n}\n\nexport function useMacrostratUnits() {\n return useAtomValue(columnUnitsAtom);\n}\n\nexport function useColumnUnitsMap(): Map<number, ExtUnit> | null {\n try {\n return useAtomValue(columnUnitsMapAtom);\n } catch {\n return null;\n }\n}\n\nexport function useCompositeScale(): CompositeColumnScale {\n const ctx = useMacrostratColumnData();\n return useMemo(\n () => createCompositeScale(ctx.sections, true),\n [ctx.sections],\n );\n}\n\nfunction AtomUpdater({\n atoms,\n}: {\n atoms: [WritableAtom<any, any, any>, any][];\n}) {\n /**\n * A generic updater to sync Jotai atoms with state passed as props.\n * Useful for scoped providers where state needs to be synced outside\n * of the current context.\n */\n /** TODO: this is an awkward way to keep atoms updated */\n // The scoped store\n const store = useStore();\n\n // Warn on atoms changing length\n const prevLengthRef = useRef(atoms.length);\n useEffect(() => {\n if (prevLengthRef.current !== atoms.length) {\n console.error(\"Error: number of atoms in ScopedAtomUpdater has changed.\");\n prevLengthRef.current = atoms.length;\n }\n }, [atoms.length]);\n\n for (const [atom, value] of atoms) {\n useEffect(() => {\n store.set(atom, value);\n }, [store, value]);\n }\n return null;\n}\n"],"names":["createContext","$eJc70$createContext","useMemo","$eJc70$useMemo","useContext","$eJc70$useContext","useRef","$eJc70$useRef","useEffect","$eJc70$useEffect","$eJc70$macrostrathyper","createIsolation","$eJc70$createIsolation","atom","$eJc70$atom","$parcel$export","e","n","v","s","Object","defineProperty","get","set","enumerable","configurable","$parcel$global","globalThis","$parcel$modules","$parcel$inits","parcelRequire","id","exports","init","module","call","err","Error","code","register","$91525b65c57a1e5d$exports","$91525b65c57a1e5d$export$ef5395089200109b","$91525b65c57a1e5d$export$7fec7bd80ff9c10e","$91525b65c57a1e5d$export$f8509b7cce386c7d","$91525b65c57a1e5d$export$6fb40844db555b2","$91525b65c57a1e5d$export$7513be0cfd10d9cc","$91525b65c57a1e5d$export$a7fc62995ec4f76","$bBAza","Provider","$91525b65c57a1e5d$var$Provider","useSetAtom","$91525b65c57a1e5d$var$useSetAtom","useAtomValue","$91525b65c57a1e5d$var$useAtomValue","useStore","$91525b65c57a1e5d$var$useStore","$91525b65c57a1e5d$var$columnUnitsAtom","$91525b65c57a1e5d$var$columnUnitsMapAtom","units","unitMap","Map","forEach","unit","unit_id","$91525b65c57a1e5d$var$ScopedProvider","children","rest","val","store","atomMap","initialValues","$91525b65c57a1e5d$var$AtomUpdater","atoms","$91525b65c57a1e5d$var$MacrostratColumnDataContext","sections","totalHeight","axisType","value","ctx","createCompositeScale","prevLengthRef","length","current","console","error","MacrostratColumnStateProvider","MacrostratColumnDataProvider","useMacrostratColumnData","useMacrostratUnits","useColumnUnitsMap","useCompositeScale"],"version":3,"file":"column-views.46efb749.js.map","sourceRoot":"../../../../"}
@@ -0,0 +1,2 @@
1
+ import{useAsyncMemo as a}from"@macrostrat/ui-components";var t,e=((t={}).Occurrences="occs",t.Collections="colls",t);function n(t,e="colls"){return a(async()=>null==t?null:await s(t,e),[t,e])}async function c(a,t){if("colls"!==t)return[];let e=await fetch(`https://macrostrat.org/api/fossils?col_id=${a}`);return(await e.json()).success.data}async function l(a,t){let e=await fetch(`https://paleobiodb.org/data1.2/${t}/list.json?ms_column=${a}&show=mslink,stratext`);return(await e.json()).records.map("colls"==t?r:o)}async function s(a,t){let[e,n]=await Promise.all([c(a,t),l(a,t)]);return[...e,...n]}function o(a){if(null==a.msu||null==a.msc)return a;let t=parseInt(a.msu.replace(/^\w+:/,"")),e=parseInt(a.msc.replace(/^\w+:/,"")),n=parseInt(a.oid.replace(/^occ:/,"")),c=parseInt(a.cid.replace(/^col:/,""));return{...a,unit_id:t,col_id:e,taxon_name:a.tna,best_name:a.idn??a.tna,occ_id:n,cltn_id:c,cltn_name:a.nam}}function r(a){let t=null,e=null;null!=a.msu&&(t=parseInt(a.msu.replace(/^\w+:/,""))),null!=a.msc&&(e=parseInt(a.msc.replace(/^\w+:/,"")));let n=a.tna,c=null;null!=a.oid&&a.oid.startsWith("occ:")&&(c=parseInt(a.oid.replace(/^occ:/,""))),null!=a.idn&&(n=a.idn);let l=a.cltn_id;return null!=a.oid&&a.oid.startsWith("col:")?l=parseInt(a.oid.replace(/^col:/,"")):null!=a.cid&&a.cid.startsWith("col:")&&(l=parseInt(a.cid.replace(/^col:/,""))),{...a,unit_id:t,col_id:e,taxon_name:n,occ_id:c,cltn_id:l,cltn_name:a.nam,t_age:a.t_age,b_age:a.b_age}}export{e as FossilDataType,n as useFossilData,s as fetchFossilData};
2
+ //# sourceMappingURL=column-views.4ec769a6.js.map
@@ -0,0 +1 @@
1
+ {"mappings":"A,O,gB,C,K,2B,CCIO,IAAK,EAAA,G,CAAA,E,C,G,W,C,O,E,W,C,QAAA,GA+BL,SAAS,EACd,CAAc,CACd,EAAA,OAAiC,EAIjC,OAAO,AAAA,EAAa,SAClB,AAAI,AAAU,MAAV,EAAuB,KACpB,MAAM,EAAgB,EAAQ,GACpC,CAAC,EAAQ,EAAK,CACnB,CAEA,eAAe,EACb,CAAc,CACd,CAAoB,EAEpB,GAAI,AAAA,UAAA,EAEF,MAAO,EAAE,CAIX,IAAM,EAAO,MAAM,MACjB,CAAC,0CAA0C,EAAE,EAAA,CAAQ,EAIvD,MAAO,AAFK,CAAA,MAAM,EAAK,IAAI,EAA3B,EAEW,OAAO,CAAC,IAAI,AACzB,CAcA,eAAe,EACb,CAAc,CACd,CAAoB,EAGpB,IAAM,EAAO,MAAM,MACH,CAAC,+BAAC,EAAE,EAAK,qBAAqB,EAAE,EAAO,qBAAqB,CAAC,EAG7E,MAAO,AADK,CAAA,MAAM,EAAK,IAAI,EAA3B,EACW,OAAO,CAAC,GAAG,CACpB,AAAA,SAAA,EACI,EACA,EAER,CAcO,eAAe,EACpB,CAAa,CACb,CAAoB,EAEpB,GAAM,CAAC,EAAgB,EAAS,CAAG,MAAM,QAAQ,GAAG,CAAC,CACnD,EAA0B,EAAO,GACjC,EAAoB,EAAO,GAC5B,EACD,MAAO,IAAI,KAAmB,EAAS,AACzC,CAEA,SAAS,EAAqB,CAAC,EAC7B,GAAI,AAAS,MAAT,EAAE,GAAG,EAAY,AAAS,MAA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QAAA,EACA,OAAA,EACA,WAAA,EACA,OAAA,EACA,QAAA,EACA,UAAW,EAAE,GAAG,CAChB,MAAO,EAAE,KAAK,CACd,MAAO,EAAE,KAAK,AAChB,CACF,Q,K,c,C,K,a,C,K,e","sources":["<anon>","packages/column-views/src/facets/fossils/provider.ts"],"sourcesContent":["import {useAsyncMemo as $lb6L3$useAsyncMemo} from \"@macrostrat/ui-components\";\n\n\nconst $8e174c7ae24a4598$var$pbdbAPIBase = \"https://paleobiodb.org/data1.2\";\nvar $8e174c7ae24a4598$export$a990c76b38782f57 = /*#__PURE__*/ function(FossilDataType) {\n FossilDataType[\"Occurrences\"] = \"occs\";\n FossilDataType[\"Collections\"] = \"colls\";\n return FossilDataType;\n}({});\nfunction $8e174c7ae24a4598$export$e6af757fa9780077(col_id, type = \"colls\") {\n // Fossil links are stored in both Macrostrat and PBDB, depending on how the link was assembled. Here\n // we create a unified view of data over both sources.\n return (0, $lb6L3$useAsyncMemo)(async ()=>{\n if (col_id == null) return null;\n return await $8e174c7ae24a4598$export$c55bae8485305c57(col_id, type);\n }, [\n col_id,\n type\n ]);\n}\nasync function $8e174c7ae24a4598$var$fetchMacrostratFossilData(col_id, type) {\n if (type !== \"colls\") // Macrostrat API only supports collections\n return [];\n // Fetch fossil collections linked to columns from the Macrostrat API\n const resp = await fetch(`https://macrostrat.org/api/fossils?col_id=${col_id}`);\n const res = await resp.json();\n // Create collections from Macrostrat data\n return res.success.data;\n}\nasync function $8e174c7ae24a4598$var$fetchPDBDFossilData(col_id, type) {\n // Note: show=rank does not work on training PBDB server\n const resp = await fetch($8e174c7ae24a4598$var$pbdbAPIBase + `/${type}/list.json?ms_column=${col_id}&show=mslink,stratext`);\n const res = await resp.json();\n return res.records.map(type == \"colls\" ? $8e174c7ae24a4598$var$createMacrostratCollection : $8e174c7ae24a4598$var$preprocessOccurrence);\n}\nasync function $8e174c7ae24a4598$export$c55bae8485305c57(colID, type) {\n const [macrostratData, pbdbData] = await Promise.all([\n $8e174c7ae24a4598$var$fetchMacrostratFossilData(colID, type),\n $8e174c7ae24a4598$var$fetchPDBDFossilData(colID, type)\n ]);\n return [\n ...macrostratData,\n ...pbdbData\n ];\n}\nfunction $8e174c7ae24a4598$var$preprocessOccurrence(d) {\n if (d.msu == null || d.msc == null) return d;\n /* Preprocess data for an occurrence into a Macrostrat-like format */ // Standardize names of Macrostrat units and columns\n const unit_id = parseInt(d.msu.replace(/^\\w+:/, \"\"));\n const col_id = parseInt(d.msc.replace(/^\\w+:/, \"\"));\n // taxon names may be stored in different fields\n const occ_id = parseInt(d.oid.replace(/^occ:/, \"\"));\n const cltn_id = parseInt(d.cid.replace(/^col:/, \"\"));\n return {\n ...d,\n unit_id: unit_id,\n col_id: col_id,\n taxon_name: d.tna,\n best_name: d.idn ?? d.tna,\n occ_id: occ_id,\n cltn_id: cltn_id,\n cltn_name: d.nam\n };\n}\nfunction $8e174c7ae24a4598$var$createMacrostratCollection(d) {\n /* Preprocess data for a collection into a Macrostrat-like format */ let unit_id = null;\n let col_id = null;\n // Standardize names of Macrostrat units and columns\n if (d.msu != null) unit_id = parseInt(d.msu.replace(/^\\w+:/, \"\"));\n if (d.msc != null) col_id = parseInt(d.msc.replace(/^\\w+:/, \"\"));\n // taxon names may be stored in different fields\n let taxon_name = d.tna;\n let occ_id = null;\n if (d.oid != null && d.oid.startsWith(\"occ:\")) occ_id = parseInt(d.oid.replace(/^occ:/, \"\"));\n if (d.idn != null) taxon_name = d.idn;\n let cltn_id = d.cltn_id;\n if (d.oid != null && d.oid.startsWith(\"col:\")) cltn_id = parseInt(d.oid.replace(/^col:/, \"\"));\n else if (d.cid != null && d.cid.startsWith(\"col:\")) cltn_id = parseInt(d.cid.replace(/^col:/, \"\"));\n return {\n ...d,\n unit_id: unit_id,\n col_id: col_id,\n taxon_name: taxon_name,\n occ_id: occ_id,\n cltn_id: cltn_id,\n cltn_name: d.nam,\n t_age: d.t_age,\n b_age: d.b_age\n };\n}\n\n\nexport {$8e174c7ae24a4598$export$a990c76b38782f57 as FossilDataType, $8e174c7ae24a4598$export$e6af757fa9780077 as useFossilData, $8e174c7ae24a4598$export$c55bae8485305c57 as fetchFossilData};\n//# sourceMappingURL=column-views.4ec769a6.js.map\n","import { useAsyncMemo } from \"@macrostrat/ui-components\";\n\nconst pbdbAPIBase = \"https://paleobiodb.org/data1.2\";\n\nexport enum FossilDataType {\n Occurrences = \"occs\",\n Collections = \"colls\",\n}\n\nexport interface PBDBEntity {\n unit_id: number;\n col_id: number;\n cltn_id: number;\n // For eODP, slb/slu are used to store the heights of fossil locations found in measured sections.\n // They may have a more general set of uses as well but these are not currently explored.\n slb?: string; // The local bed in which the fossil was found\n slu?: string; // The unit of measurement used to designate the local bed\n}\n\nexport interface PBDBCollection extends PBDBEntity {\n cltn_name: string;\n pbdb_occs: number;\n t_age: number;\n b_age: number;\n [key: string]: any; // Allow for additional properties\n}\n\nexport interface PBDBOccurrence extends PBDBEntity {\n occ_id: number;\n cltn_id: number;\n taxon_name: string;\n best_name: string;\n [key: string]: any; // Allow for additional properties\n}\n\nexport function useFossilData<T extends PBDBEntity>(\n col_id: number,\n type = FossilDataType.Collections,\n): T[] {\n // Fossil links are stored in both Macrostrat and PBDB, depending on how the link was assembled. Here\n // we create a unified view of data over both sources.\n return useAsyncMemo(async () => {\n if (col_id == null) return null;\n return await fetchFossilData(col_id, type);\n }, [col_id, type]);\n}\n\nasync function fetchMacrostratFossilData(\n col_id: number,\n type: FossilDataType,\n): Promise<PBDBCollection[]> {\n if (type !== FossilDataType.Collections) {\n // Macrostrat API only supports collections\n return [];\n }\n\n // Fetch fossil collections linked to columns from the Macrostrat API\n const resp = await fetch(\n `https://macrostrat.org/api/fossils?col_id=${col_id}`,\n );\n const res = await resp.json();\n // Create collections from Macrostrat data\n return res.success.data;\n}\n\nasync function fetchPDBDFossilData(\n col_id: number,\n type: FossilDataType.Collections,\n): Promise<PBDBCollection[]>;\nasync function fetchPDBDFossilData(\n col_id: number,\n type: FossilDataType.Occurrences,\n): Promise<PBDBOccurrence[]>;\nasync function fetchPDBDFossilData<T extends PBDBEntity>(\n col_id: number,\n type: FossilDataType,\n): Promise<T[]>;\nasync function fetchPDBDFossilData(\n col_id: number,\n type: FossilDataType,\n): Promise<PBDBEntity[]> {\n // Note: show=rank does not work on training PBDB server\n const resp = await fetch(\n pbdbAPIBase + `/${type}/list.json?ms_column=${col_id}&show=mslink,stratext`,\n );\n const res = await resp.json();\n return res.records.map(\n type == FossilDataType.Collections\n ? createMacrostratCollection\n : preprocessOccurrence,\n );\n}\n\nexport async function fetchFossilData(\n colID: number,\n type: FossilDataType.Collections,\n): Promise<PBDBCollection[]>;\nexport async function fetchFossilData(\n colID: number,\n type: FossilDataType.Occurrences,\n): Promise<PBDBOccurrence[]>;\nexport async function fetchFossilData<T extends PBDBEntity>(\n colID: number,\n type: FossilDataType,\n): Promise<T[]>;\nexport async function fetchFossilData(\n colID: number,\n type: FossilDataType,\n): Promise<PBDBEntity[]> {\n const [macrostratData, pbdbData] = await Promise.all([\n fetchMacrostratFossilData(colID, type),\n fetchPDBDFossilData(colID, type),\n ]);\n return [...macrostratData, ...pbdbData];\n}\n\nfunction preprocessOccurrence(d): PBDBOccurrence {\n if (d.msu == null || d.msc == null) {\n return d;\n }\n /* Preprocess data for an occurrence into a Macrostrat-like format */\n // Standardize names of Macrostrat units and columns\n const unit_id = parseInt(d.msu.replace(/^\\w+:/, \"\"));\n const col_id = parseInt(d.msc.replace(/^\\w+:/, \"\"));\n\n // taxon names may be stored in different fields\n const occ_id = parseInt(d.oid.replace(/^occ:/, \"\"));\n const cltn_id = parseInt(d.cid.replace(/^col:/, \"\"));\n\n return {\n ...d,\n unit_id,\n col_id,\n taxon_name: d.tna,\n best_name: d.idn ?? d.tna,\n occ_id,\n cltn_id,\n cltn_name: d.nam,\n };\n}\n\nfunction createMacrostratCollection(d): PBDBCollection {\n /* Preprocess data for a collection into a Macrostrat-like format */\n let unit_id = null;\n let col_id = null;\n // Standardize names of Macrostrat units and columns\n if (d.msu != null) {\n unit_id = parseInt(d.msu.replace(/^\\w+:/, \"\"));\n }\n if (d.msc != null) {\n col_id = parseInt(d.msc.replace(/^\\w+:/, \"\"));\n }\n\n // taxon names may be stored in different fields\n let taxon_name = d.tna;\n let occ_id = null;\n if (d.oid != null && d.oid.startsWith(\"occ:\")) {\n occ_id = parseInt(d.oid.replace(/^occ:/, \"\"));\n }\n if (d.idn != null) {\n taxon_name = d.idn;\n }\n\n let cltn_id = d.cltn_id;\n if (d.oid != null && d.oid.startsWith(\"col:\")) {\n cltn_id = parseInt(d.oid.replace(/^col:/, \"\"));\n } else if (d.cid != null && d.cid.startsWith(\"col:\")) {\n cltn_id = parseInt(d.cid.replace(/^col:/, \"\"));\n }\n\n return {\n ...d,\n unit_id,\n col_id,\n taxon_name,\n occ_id,\n cltn_id,\n cltn_name: d.nam,\n t_age: d.t_age,\n b_age: d.b_age,\n };\n}\n"],"names":["useAsyncMemo","$lb6L3$useAsyncMemo","FossilDataType","$8e174c7ae24a4598$export$a990c76b38782f57","$8e174c7ae24a4598$export$e6af757fa9780077","col_id","type","$8e174c7ae24a4598$export$c55bae8485305c57","$8e174c7ae24a4598$var$fetchMacrostratFossilData","resp","fetch","res","json","success","data","$8e174c7ae24a4598$var$fetchPDBDFossilData","records","map","$8e174c7ae24a4598$var$createMacrostratCollection","$8e174c7ae24a4598$var$preprocessOccurrence","colID","macrostratData","pbdbData","Promise","all","d","msu","msc","unit_id","parseInt","replace","occ_id","oid","cltn_id","cid","taxon_name","tna","best_name","idn","cltn_name","nam","startsWith","t_age","b_age","useFossilData","fetchFossilData"],"version":3,"file":"column-views.4ec769a6.js.map","sourceRoot":"../../../../"}
@@ -1,2 +1,2 @@
1
- import"./column-views.1d064426.js";import"./column-views.ec7cc7cc.js";function e(e,r){return Object.keys(r).forEach(function(t){"default"===t||"__esModule"===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return r[t]}})}),e}var r=globalThis,t={},a={},o=r.parcelRequirea149;null==o&&((o=function(e){if(e in t)return t[e].exports;if(e in a){var r=a[e];delete a[e];var o={id:e,exports:{}};return t[e]=o,r.call(o.exports,o,o.exports),o.exports}var n=Error("Cannot find module '"+e+"'");throw n.code="MODULE_NOT_FOUND",n}).register=function(e,r){a[e]=r},r.parcelRequirea149=o),o.register;var n={},c=o("kIQUG"),d=o("grgdF");e(n,c),e(n,d);export{$7e05644cbb5d2dbb$export$9d101e1fcb2166a6 as standardizeMeasurementHeight,$7e05644cbb5d2dbb$export$8f2afa8ddee7317e as mergeHeightRanges,$7e05644cbb5d2dbb$export$ce5c4f2fdf4e644d as BaseMeasurementsColumn,$7e05644cbb5d2dbb$export$653e47a7a0da0f0d as TruncatedList,$7e05644cbb5d2dbb$export$4e649f790614b299 as groupNotesByPixelDistance,$48680a4cd2abcbe4$export$c49cf57576706bab as SGPMeasurementsColumn};
2
- //# sourceMappingURL=column-views.b103acbc.js.map
1
+ import"./column-views.3a947d58.js";import"./column-views.8eae7028.js";function e(e,r){return Object.keys(r).forEach(function(t){"default"===t||"__esModule"===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return r[t]}})}),e}var r=globalThis,t={},a={},o=r.parcelRequirea149;null==o&&((o=function(e){if(e in t)return t[e].exports;if(e in a){var r=a[e];delete a[e];var o={id:e,exports:{}};return t[e]=o,r.call(o.exports,o,o.exports),o.exports}var n=Error("Cannot find module '"+e+"'");throw n.code="MODULE_NOT_FOUND",n}).register=function(e,r){a[e]=r},r.parcelRequirea149=o),o.register;var n={},c=o("kIQUG"),d=o("grgdF");e(n,c),e(n,d);export{$7e05644cbb5d2dbb$export$9d101e1fcb2166a6 as standardizeMeasurementHeight,$7e05644cbb5d2dbb$export$8f2afa8ddee7317e as mergeHeightRanges,$7e05644cbb5d2dbb$export$ce5c4f2fdf4e644d as BaseMeasurementsColumn,$7e05644cbb5d2dbb$export$653e47a7a0da0f0d as TruncatedList,$7e05644cbb5d2dbb$export$4e649f790614b299 as groupNotesByPixelDistance,$48680a4cd2abcbe4$export$c49cf57576706bab as SGPMeasurementsColumn};
2
+ //# sourceMappingURL=column-views.59ce629d.js.map
@@ -1 +1 @@
1
- {"mappings":"A,M,6C,A,O,6C,C,S,E,C,C,C,E,O,O,I,C,G,O,C,S,C,E,Y,G,A,e,G,O,S,C,c,C,I,C,E,I,O,c,C,E,E,C,W,C,E,I,W,O,C,C,E,A,C,E,G,C,C,I,E,W,E,C,E,E,C,E,E,E,iB,A,O,I,A,C,E,S,C,E,G,K,E,O,C,C,E,C,O,C,G,K,E,C,I,E,C,C,E,A,Q,C,C,E,C,I,E,C,G,E,Q,C,C,E,O,C,C,E,C,E,E,I,C,E,O,C,E,E,O,E,E,O,A,C,I,E,A,M,uB,E,I,O,E,I,C,mB,C,C,E,Q,C,S,C,C,C,E,C,C,E,C,C,E,E,iB,C,G,E,Q,C,I,E,C,E,E,E,S,E,E,S,E,E,G,E,E,U,6C,4B,C,6C,iB,C,6C,sB,C,6C,a,C,6C,yB,C,6C,qB","sources":["<anon>","packages/column-views/src/facets/measurements/index.ts"],"sourcesContent":["import \"./column-views.1d064426.js\";\nimport \"./column-views.ec7cc7cc.js\";\n\n\nfunction $parcel$exportWildcard(dest, source) {\n Object.keys(source).forEach(function(key) {\n if (key === 'default' || key === '__esModule' || Object.prototype.hasOwnProperty.call(dest, key)) {\n return;\n }\n\n Object.defineProperty(dest, key, {\n enumerable: true,\n get: function get() {\n return source[key];\n }\n });\n });\n\n return dest;\n}\n\n var $parcel$global = globalThis;\n \nvar $parcel$modules = {};\nvar $parcel$inits = {};\n\nvar parcelRequire = $parcel$global[\"parcelRequirea149\"];\n\nif (parcelRequire == null) {\n parcelRequire = function(id) {\n if (id in $parcel$modules) {\n return $parcel$modules[id].exports;\n }\n if (id in $parcel$inits) {\n var init = $parcel$inits[id];\n delete $parcel$inits[id];\n var module = {id: id, exports: {}};\n $parcel$modules[id] = module;\n init.call(module.exports, module, module.exports);\n return module.exports;\n }\n var err = new Error(\"Cannot find module '\" + id + \"'\");\n err.code = 'MODULE_NOT_FOUND';\n throw err;\n };\n\n parcelRequire.register = function register(id, init) {\n $parcel$inits[id] = init;\n };\n\n $parcel$global[\"parcelRequirea149\"] = parcelRequire;\n}\n\nvar parcelRegister = parcelRequire.register;\nvar $30f674067bcc490b$exports = {};\n\nvar $kIQUG = parcelRequire(\"kIQUG\");\n\nvar $grgdF = parcelRequire(\"grgdF\");\n$parcel$exportWildcard($30f674067bcc490b$exports, $kIQUG);\n$parcel$exportWildcard($30f674067bcc490b$exports, $grgdF);\n\n\nexport {$7e05644cbb5d2dbb$export$9d101e1fcb2166a6 as standardizeMeasurementHeight, $7e05644cbb5d2dbb$export$8f2afa8ddee7317e as mergeHeightRanges, $7e05644cbb5d2dbb$export$ce5c4f2fdf4e644d as BaseMeasurementsColumn, $7e05644cbb5d2dbb$export$653e47a7a0da0f0d as TruncatedList, $7e05644cbb5d2dbb$export$4e649f790614b299 as groupNotesByPixelDistance, $48680a4cd2abcbe4$export$c49cf57576706bab as SGPMeasurementsColumn};\n//# sourceMappingURL=column-views.b103acbc.js.map\n","export * from \"./base\";\nexport * from \"./sgp\";\n"],"names":["$parcel$exportWildcard","dest","source","Object","keys","forEach","key","prototype","hasOwnProperty","call","defineProperty","enumerable","get","$parcel$global","globalThis","$parcel$modules","$parcel$inits","parcelRequire","id","exports","init","module","err","Error","code","register","$30f674067bcc490b$exports","$kIQUG","$grgdF","$7e05644cbb5d2dbb$export$9d101e1fcb2166a6","standardizeMeasurementHeight","$7e05644cbb5d2dbb$export$8f2afa8ddee7317e","mergeHeightRanges","$7e05644cbb5d2dbb$export$ce5c4f2fdf4e644d","BaseMeasurementsColumn","$7e05644cbb5d2dbb$export$653e47a7a0da0f0d","TruncatedList","$7e05644cbb5d2dbb$export$4e649f790614b299","groupNotesByPixelDistance","$48680a4cd2abcbe4$export$c49cf57576706bab","SGPMeasurementsColumn"],"version":3,"file":"column-views.b103acbc.js.map","sourceRoot":"../../../../"}
1
+ {"mappings":"A,M,6C,A,O,6C,C,S,E,C,C,C,E,O,O,I,C,G,O,C,S,C,E,Y,G,A,e,G,O,S,C,c,C,I,C,E,I,O,c,C,E,E,C,W,C,E,I,W,O,C,C,E,A,C,E,G,C,C,I,E,W,E,C,E,E,C,E,E,E,iB,A,O,I,A,C,E,S,C,E,G,K,E,O,C,C,E,C,O,C,G,K,E,C,I,E,C,C,E,A,Q,C,C,E,C,I,E,C,G,E,Q,C,C,E,O,C,C,E,C,E,E,I,C,E,O,C,E,E,O,E,E,O,A,C,I,E,A,M,uB,E,I,O,E,I,C,mB,C,C,E,Q,C,S,C,C,C,E,C,C,E,C,C,E,E,iB,C,G,E,Q,C,I,E,C,E,E,E,S,E,E,S,E,E,G,E,E,U,6C,4B,C,6C,iB,C,6C,sB,C,6C,a,C,6C,yB,C,6C,qB","sources":["<anon>","packages/column-views/src/facets/measurements/index.ts"],"sourcesContent":["import \"./column-views.3a947d58.js\";\nimport \"./column-views.8eae7028.js\";\n\n\nfunction $parcel$exportWildcard(dest, source) {\n Object.keys(source).forEach(function(key) {\n if (key === 'default' || key === '__esModule' || Object.prototype.hasOwnProperty.call(dest, key)) {\n return;\n }\n\n Object.defineProperty(dest, key, {\n enumerable: true,\n get: function get() {\n return source[key];\n }\n });\n });\n\n return dest;\n}\n\n var $parcel$global = globalThis;\n \nvar $parcel$modules = {};\nvar $parcel$inits = {};\n\nvar parcelRequire = $parcel$global[\"parcelRequirea149\"];\n\nif (parcelRequire == null) {\n parcelRequire = function(id) {\n if (id in $parcel$modules) {\n return $parcel$modules[id].exports;\n }\n if (id in $parcel$inits) {\n var init = $parcel$inits[id];\n delete $parcel$inits[id];\n var module = {id: id, exports: {}};\n $parcel$modules[id] = module;\n init.call(module.exports, module, module.exports);\n return module.exports;\n }\n var err = new Error(\"Cannot find module '\" + id + \"'\");\n err.code = 'MODULE_NOT_FOUND';\n throw err;\n };\n\n parcelRequire.register = function register(id, init) {\n $parcel$inits[id] = init;\n };\n\n $parcel$global[\"parcelRequirea149\"] = parcelRequire;\n}\n\nvar parcelRegister = parcelRequire.register;\nvar $30f674067bcc490b$exports = {};\n\nvar $kIQUG = parcelRequire(\"kIQUG\");\n\nvar $grgdF = parcelRequire(\"grgdF\");\n$parcel$exportWildcard($30f674067bcc490b$exports, $kIQUG);\n$parcel$exportWildcard($30f674067bcc490b$exports, $grgdF);\n\n\nexport {$7e05644cbb5d2dbb$export$9d101e1fcb2166a6 as standardizeMeasurementHeight, $7e05644cbb5d2dbb$export$8f2afa8ddee7317e as mergeHeightRanges, $7e05644cbb5d2dbb$export$ce5c4f2fdf4e644d as BaseMeasurementsColumn, $7e05644cbb5d2dbb$export$653e47a7a0da0f0d as TruncatedList, $7e05644cbb5d2dbb$export$4e649f790614b299 as groupNotesByPixelDistance, $48680a4cd2abcbe4$export$c49cf57576706bab as SGPMeasurementsColumn};\n//# sourceMappingURL=column-views.59ce629d.js.map\n","export * from \"./base\";\nexport * from \"./sgp\";\n"],"names":["$parcel$exportWildcard","dest","source","Object","keys","forEach","key","prototype","hasOwnProperty","call","defineProperty","enumerable","get","$parcel$global","globalThis","$parcel$modules","$parcel$inits","parcelRequire","id","exports","init","module","err","Error","code","register","$30f674067bcc490b$exports","$kIQUG","$grgdF","$7e05644cbb5d2dbb$export$9d101e1fcb2166a6","standardizeMeasurementHeight","$7e05644cbb5d2dbb$export$8f2afa8ddee7317e","mergeHeightRanges","$7e05644cbb5d2dbb$export$ce5c4f2fdf4e644d","BaseMeasurementsColumn","$7e05644cbb5d2dbb$export$653e47a7a0da0f0d","TruncatedList","$7e05644cbb5d2dbb$export$4e649f790614b299","groupNotesByPixelDistance","$48680a4cd2abcbe4$export$c49cf57576706bab","SGPMeasurementsColumn"],"version":3,"file":"column-views.59ce629d.js.map","sourceRoot":"../../../../"}
@@ -1 +1 @@
1
- {"mappings":"A,M,6C,A,O,6C,A,O,6C,A,O,6C,A,Q,kB,C,K,+B,A,Q,W,C,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GAEX,OAAO,CACT,EAAG,EAAE,EAIH,YAAa,GAAgB,EAC7B,SAAU,CACZ,CACF,C,E,E,G,E,E,U,K,sB,C,K,kB,C,6C,e,C,6C,iB,C,4C,Y,C,4C,kB,C,6C,W,C,6C,qB,C,6C,gB,C,6C,W,C,6C,e,C,6C,e,C,6C,Y","sources":["<anon>","packages/column-views/src/prepare-units/index.ts"],"sourcesContent":["import \"./column-views.021a6961.js\";\nimport \"./column-views.a596b1f5.js\";\nimport \"./column-views.dbb4a46b.js\";\nimport \"./column-views.7f9c7448.js\";\nimport {ColumnAxisType as $7dPhe$ColumnAxisType} from \"@macrostrat/column-components\";\nimport {useMemo as $7dPhe$useMemo} from \"react\";\n\n\nfunction $parcel$exportWildcard(dest, source) {\n Object.keys(source).forEach(function(key) {\n if (key === 'default' || key === '__esModule' || Object.prototype.hasOwnProperty.call(dest, key)) {\n return;\n }\n\n Object.defineProperty(dest, key, {\n enumerable: true,\n get: function get() {\n return source[key];\n }\n });\n });\n\n return dest;\n}\n\nfunction $parcel$export(e, n, v, s) {\n Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});\n}\n\n var $parcel$global = globalThis;\n \nvar $parcel$modules = {};\nvar $parcel$inits = {};\n\nvar parcelRequire = $parcel$global[\"parcelRequirea149\"];\n\nif (parcelRequire == null) {\n parcelRequire = function(id) {\n if (id in $parcel$modules) {\n return $parcel$modules[id].exports;\n }\n if (id in $parcel$inits) {\n var init = $parcel$inits[id];\n delete $parcel$inits[id];\n var module = {id: id, exports: {}};\n $parcel$modules[id] = module;\n init.call(module.exports, module, module.exports);\n return module.exports;\n }\n var err = new Error(\"Cannot find module '\" + id + \"'\");\n err.code = 'MODULE_NOT_FOUND';\n throw err;\n };\n\n parcelRequire.register = function register(id, init) {\n $parcel$inits[id] = init;\n };\n\n $parcel$global[\"parcelRequirea149\"] = parcelRequire;\n}\n\nvar parcelRegister = parcelRequire.register;\nvar $031426a894870747$exports = {};\n\n$parcel$export($031426a894870747$exports, \"usePreparedColumnUnits\", () => $031426a894870747$export$206a0cb85295e433);\n$parcel$export($031426a894870747$exports, \"prepareColumnUnits\", () => $031426a894870747$export$be8c5a449df4bde4);\n$parcel$export($031426a894870747$exports, \"preprocessUnits\", () => (parcelRequire(\"ickj2\")).preprocessUnits);\n\nvar $ickj2 = parcelRequire(\"ickj2\");\n\n\n\nvar $bBAza = parcelRequire(\"bBAza\");\n\nvar $iWhRv = parcelRequire(\"iWhRv\");\n\nvar $76iYI = parcelRequire(\"76iYI\");\nfunction $031426a894870747$export$206a0cb85295e433(data, options) {\n /** This function wraps and memoizes all preparation steps for converting\n * an array of units from the /units route to a form ready for usage.\n */ return (0, $7dPhe$useMemo)(()=>{\n return $031426a894870747$export$be8c5a449df4bde4(data, options);\n }, [\n data,\n ...Object.values(options)\n ]);\n}\nfunction $031426a894870747$export$be8c5a449df4bde4(units, options) {\n /** Prepare units for rendering into Macrostrat columns */ let { t_age: t_age, b_age: b_age, t_pos: t_pos, b_pos: b_pos } = options;\n const { mergeSections: mergeSections = (0, $iWhRv.MergeSectionsMode).OVERLAPPING, axisType: axisType, unconformityHeight: unconformityHeight, collapseSmallUnconformities: collapseSmallUnconformities = false, hybridScale: hybridScale, scale: scale } = options;\n let _totalHeight = null;\n if (scale != null) {\n // Set t_age and b_age based on scale domain if not already set\n const domain = scale.domain();\n if (axisType == (0, $7dPhe$ColumnAxisType).AGE) {\n if (t_age == null) t_age = Math.min(...domain);\n if (b_age == null) b_age = Math.max(...domain);\n _totalHeight = Math.abs(scale(b_age) - scale(t_age));\n } else {\n if (t_pos == null) t_pos = Math.min(...domain);\n if (b_pos == null) b_pos = Math.max(...domain);\n _totalHeight = Math.abs(scale(b_pos) - scale(t_pos));\n }\n }\n // Start by ensuring that ages and positions are numbers\n // also set up some values for eODP-style columns\n let units1 = units.map((0, $ickj2.preprocessSectionUnit));\n /** Prototype filtering to age range */ units1 = units1.filter((d)=>{\n // Filter units by t_age and b_age, inclusive\n if (axisType == (0, $7dPhe$ColumnAxisType).AGE) return (0, $iWhRv.agesOverlap)(d, {\n t_age: t_age,\n b_age: b_age\n });\n else return (0, $iWhRv.unitsOverlap)(d, {\n t_pos: t_pos,\n b_pos: b_pos\n }, axisType);\n });\n let mergeMode = mergeSections;\n // if (axisType != ColumnAxisType.AGE) {\n // // For non-age columns, we always merge sections.\n // // This is because the \"groupUnitsIntoSections\" function is not well-defined\n // // for non-age columns.\n // mergeMode = MergeSectionsMode.ALL;\n // }\n let sections0;\n if (mergeMode == (0, $iWhRv.MergeSectionsMode).ALL) {\n // For the \"merge sections\" mode, we need to create a single section\n const [b_unit_pos, t_unit_pos] = (0, $ickj2.getSectionPosRange)(units1, axisType);\n const [b_unit_age, t_unit_age] = (0, $ickj2.getSectionAgeRange)(units1);\n sections0 = [\n {\n section_id: 0,\n /**\n * If ages limits are directly specified, use them to define the section bounds.\n * */ t_pos: t_unit_pos,\n b_pos: b_unit_pos,\n t_age: t_unit_age,\n b_age: b_unit_age,\n units: units1\n }\n ];\n } else if (axisType == (0, $7dPhe$ColumnAxisType).AGE) sections0 = (0, $ickj2.groupUnitsIntoSectionsBySectionID)(units1, axisType);\n else sections0 = (0, $ickj2.groupUnitsIntoSectionsByOverlap)(units1, axisType);\n // Limit sections to the range specified by t_age/b_age or t_pos/b_pos global options\n for (let section of sections0){\n if (axisType == (0, $7dPhe$ColumnAxisType).AGE) {\n section.t_age = Math.max(section.t_age, t_age ?? -Infinity);\n section.b_age = Math.min(section.b_age, b_age ?? Infinity);\n } else if (axisType == (0, $7dPhe$ColumnAxisType).DEPTH) {\n section.t_pos = Math.max(section.t_pos, t_pos ?? -Infinity);\n section.b_pos = Math.min(section.b_pos, b_pos ?? Infinity);\n } else if (axisType == (0, $7dPhe$ColumnAxisType).HEIGHT) {\n section.t_pos = Math.max(section.t_pos, t_pos ?? -Infinity);\n section.b_pos = Math.min(section.b_pos, b_pos ?? Infinity);\n }\n }\n /** Merging overlapping sections really only makes sense for age/height/depth\n * columns. Ordinal columns are numbered by section so merging them\n * results in collisions.\n */ let sections = sections0;\n if (mergeSections == (0, $iWhRv.MergeSectionsMode).OVERLAPPING && axisType == (0, $7dPhe$ColumnAxisType).AGE) sections = (0, $ickj2.mergeOverlappingSections)(sections);\n // Filter out undefined sections just in case\n sections = sections.filter((d)=>d != null);\n // SCALES\n /* Compute pixel scales etc. for sections\n * We need to do this now to determine which unconformities\n * are small enough to collapse.\n */ let sectionsWithScales = (0, $bBAza.computeSectionHeights)(sections, options);\n if (collapseSmallUnconformities && hybridScale == null) {\n // Collapse small unconformities in pixel height space\n // TODO: this doesn't seem to work properly for non-age columns?\n let threshold = unconformityHeight ?? 30;\n if (typeof collapseSmallUnconformities == \"number\") threshold = collapseSmallUnconformities;\n sectionsWithScales = (0, $bBAza.collapseUnconformitiesByPixelHeight)(sectionsWithScales, threshold, options);\n }\n /** Prepare section scale information using groups.\n * Total height is computed from section scales.\n * */ let { totalHeight: totalHeight, sections: sections2 } = (0, $bBAza.finalizeSectionHeights)(sectionsWithScales, unconformityHeight);\n /** For each section, find units that are overlapping.\n * We do this after merging sections so that we can\n * handle cases where there are overlapping units across sections\n * */ const sectionsOut = sections2.map((section)=>{\n return {\n ...section,\n units: (0, $ickj2.preprocessUnits)(section, axisType)\n };\n });\n /** Reconstitute the units so that they are sorted by section and properly enhanced.\n * This is mostly important so that unit keyboard navigation\n * predictably selects adjacent units.\n */ const units2 = sectionsOut.reduce((acc, group)=>{\n const { units: units } = group;\n for (const unit of units)acc.push(unit);\n return acc;\n }, []);\n return {\n units: units2,\n totalHeight: _totalHeight ?? totalHeight,\n sections: sectionsOut\n };\n}\n$parcel$exportWildcard($031426a894870747$exports, $iWhRv);\n$parcel$exportWildcard($031426a894870747$exports, $76iYI);\n\n\nexport {$031426a894870747$export$206a0cb85295e433 as usePreparedColumnUnits, $031426a894870747$export$be8c5a449df4bde4 as prepareColumnUnits, $57278f42f24b59e5$export$55543e159517d62d as preprocessUnits, $f811753598b339f3$export$e1644389ce074058 as MergeSectionsMode, $f811753598b339f3$export$f1a15f539858307 as unitsOverlap, $f811753598b339f3$export$70e712e2ac0237a as getUnitHeightRange, $f811753598b339f3$export$d92a67740c050efb as agesOverlap, $f811753598b339f3$export$441710fb21b4ae09 as getPositionWithinUnit, $f811753598b339f3$export$ab14c04795685c55 as createUnitSorter, $f811753598b339f3$export$d0c8ecbd4ed8940c as ensureArray, $f811753598b339f3$export$97de5b0a6b4e4dac as ensureRealFloat, $6a8fb6360a4f5dac$export$45e8e2d7a1794c23 as HybridScaleType, $6a8fb6360a4f5dac$export$e40aae6f0de9bb95 as HeightMethod};\n//# sourceMappingURL=column-views.5fd6e11a.js.map\n","import {\n getSectionAgeRange,\n getSectionPosRange,\n groupUnitsIntoSectionsByOverlap,\n groupUnitsIntoSectionsBySectionID,\n mergeOverlappingSections,\n preprocessSectionUnit,\n preprocessUnits,\n} from \"./helpers\";\nimport { ColumnAxisType } from \"@macrostrat/column-components\";\nimport { useMemo } from \"react\";\nimport { UnitLong } from \"@macrostrat/api-types\";\nimport {\n collapseUnconformitiesByPixelHeight,\n computeSectionHeights,\n finalizeSectionHeights,\n} from \"./composite-scale\";\nimport {\n agesOverlap,\n MergeSectionsMode,\n PrepareColumnOptions,\n PreparedColumnData,\n unitsOverlap,\n} from \"./utils\";\nimport { SectionInfo } from \"./types\";\n\nexport * from \"./utils\";\nexport * from \"./types\";\nexport { preprocessUnits };\n\nexport function usePreparedColumnUnits(\n data: UnitLong[],\n options: PrepareColumnOptions,\n): PreparedColumnData {\n /** This function wraps and memoizes all preparation steps for converting\n * an array of units from the /units route to a form ready for usage.\n */\n return useMemo(() => {\n return prepareColumnUnits(data, options);\n }, [data, ...Object.values(options)]);\n}\n\nexport function prepareColumnUnits(\n units: UnitLong[],\n options: PrepareColumnOptions,\n): PreparedColumnData {\n /** Prepare units for rendering into Macrostrat columns */\n\n let { t_age, b_age, t_pos, b_pos } = options;\n\n const {\n mergeSections = MergeSectionsMode.OVERLAPPING,\n axisType,\n unconformityHeight,\n collapseSmallUnconformities = false,\n hybridScale,\n scale,\n } = options;\n\n let _totalHeight = null;\n\n if (scale != null) {\n // Set t_age and b_age based on scale domain if not already set\n const domain = scale.domain();\n if (axisType == ColumnAxisType.AGE) {\n if (t_age == null) t_age = Math.min(...domain);\n if (b_age == null) b_age = Math.max(...domain);\n _totalHeight = Math.abs(scale(b_age) - scale(t_age));\n } else {\n if (t_pos == null) t_pos = Math.min(...domain);\n if (b_pos == null) b_pos = Math.max(...domain);\n _totalHeight = Math.abs(scale(b_pos) - scale(t_pos));\n }\n }\n\n // Start by ensuring that ages and positions are numbers\n // also set up some values for eODP-style columns\n let units1 = units.map(preprocessSectionUnit);\n\n /** Prototype filtering to age range */\n units1 = units1.filter((d) => {\n // Filter units by t_age and b_age, inclusive\n if (axisType == ColumnAxisType.AGE) {\n return agesOverlap(d, { t_age, b_age });\n } else {\n return unitsOverlap(d, { t_pos, b_pos } as any, axisType);\n }\n });\n\n let mergeMode = mergeSections;\n // if (axisType != ColumnAxisType.AGE) {\n // // For non-age columns, we always merge sections.\n // // This is because the \"groupUnitsIntoSections\" function is not well-defined\n // // for non-age columns.\n // mergeMode = MergeSectionsMode.ALL;\n // }\n\n let sections0: SectionInfo<UnitLong>[];\n if (mergeMode == MergeSectionsMode.ALL) {\n // For the \"merge sections\" mode, we need to create a single section\n const [b_unit_pos, t_unit_pos] = getSectionPosRange(units1, axisType);\n const [b_unit_age, t_unit_age] = getSectionAgeRange(units1);\n sections0 = [\n {\n section_id: 0,\n /**\n * If ages limits are directly specified, use them to define the section bounds.\n * */\n t_pos: t_unit_pos,\n b_pos: b_unit_pos,\n t_age: t_unit_age,\n b_age: b_unit_age,\n units: units1,\n },\n ];\n } else if (axisType == ColumnAxisType.AGE) {\n sections0 = groupUnitsIntoSectionsBySectionID(units1, axisType);\n } else {\n sections0 = groupUnitsIntoSectionsByOverlap(units1, axisType);\n }\n\n // Limit sections to the range specified by t_age/b_age or t_pos/b_pos global options\n for (let section of sections0) {\n if (axisType == ColumnAxisType.AGE) {\n section.t_age = Math.max(section.t_age, t_age ?? -Infinity);\n section.b_age = Math.min(section.b_age, b_age ?? Infinity);\n } else if (axisType == ColumnAxisType.DEPTH) {\n section.t_pos = Math.max(section.t_pos, t_pos ?? -Infinity);\n section.b_pos = Math.min(section.b_pos, b_pos ?? Infinity);\n } else if (axisType == ColumnAxisType.HEIGHT) {\n section.t_pos = Math.max(section.t_pos, t_pos ?? -Infinity);\n section.b_pos = Math.min(section.b_pos, b_pos ?? Infinity);\n }\n }\n\n /** Merging overlapping sections really only makes sense for age/height/depth\n * columns. Ordinal columns are numbered by section so merging them\n * results in collisions.\n */\n let sections = sections0;\n if (\n mergeSections == MergeSectionsMode.OVERLAPPING &&\n axisType == ColumnAxisType.AGE\n ) {\n sections = mergeOverlappingSections(sections);\n }\n // Filter out undefined sections just in case\n sections = sections.filter((d) => d != null);\n\n // SCALES\n\n /* Compute pixel scales etc. for sections\n * We need to do this now to determine which unconformities\n * are small enough to collapse.\n */\n let sectionsWithScales = computeSectionHeights(sections, options);\n\n if (collapseSmallUnconformities && hybridScale == null) {\n // Collapse small unconformities in pixel height space\n // TODO: this doesn't seem to work properly for non-age columns?\n let threshold = unconformityHeight ?? 30;\n if (typeof collapseSmallUnconformities == \"number\") {\n threshold = collapseSmallUnconformities;\n }\n\n sectionsWithScales = collapseUnconformitiesByPixelHeight(\n sectionsWithScales,\n threshold,\n options,\n );\n }\n\n /** Prepare section scale information using groups.\n * Total height is computed from section scales.\n * */\n let { totalHeight, sections: sections2 } = finalizeSectionHeights(\n sectionsWithScales,\n unconformityHeight,\n );\n\n /** For each section, find units that are overlapping.\n * We do this after merging sections so that we can\n * handle cases where there are overlapping units across sections\n * */\n const sectionsOut = sections2.map((section) => {\n return {\n ...section,\n units: preprocessUnits(section, axisType),\n };\n });\n\n /** Reconstitute the units so that they are sorted by section and properly enhanced.\n * This is mostly important so that unit keyboard navigation\n * predictably selects adjacent units.\n */\n const units2 = sectionsOut.reduce((acc, group) => {\n const { units } = group;\n for (const unit of units) {\n acc.push(unit);\n }\n return acc;\n }, []);\n\n return {\n units: units2,\n totalHeight: _totalHeight ?? totalHeight,\n sections: sectionsOut,\n };\n}\n"],"names":["ColumnAxisType","$7dPhe$ColumnAxisType","useMemo","$7dPhe$useMemo","$parcel$exportWildcard","dest","source","Object","keys","forEach","key","prototype","hasOwnProperty","call","defineProperty","enumerable","get","$parcel$export","e","n","v","s","set","configurable","$parcel$global","globalThis","$parcel$modules","$parcel$inits","parcelRequire","id","exports","init","module","err","Error","code","register","$031426a894870747$exports","$031426a894870747$export$206a0cb85295e433","$031426a894870747$export$be8c5a449df4bde4","preprocessUnits","$ickj2","$bBAza","$iWhRv","$76iYI","data","options","values","units","sections0","t_age","b_age","t_pos","b_pos","mergeSections","MergeSectionsMode","OVERLAPPING","axisType","unconformityHeight","collapseSmallUnconformities","hybridScale","scale","_totalHeight","domain","AGE","Math","min","max","abs","units1","map","preprocessSectionUnit","filter","d","agesOverlap","unitsOverlap","mergeMode","ALL","b_unit_pos","t_unit_pos","getSectionPosRange","b_unit_age","t_unit_age","getSectionAgeRange","section_id","groupUnitsIntoSectionsBySectionID","groupUnitsIntoSectionsByOverlap","section","Infinity","DEPTH","HEIGHT","sections","mergeOverlappingSections","sectionsWithScales","computeSectionHeights","threshold","collapseUnconformitiesByPixelHeight","totalHeight","sections2","finalizeSectionHeights","sectionsOut","reduce","acc","group","unit","push","usePreparedColumnUnits","prepareColumnUnits","$57278f42f24b59e5$export$55543e159517d62d","$f811753598b339f3$export$e1644389ce074058","$f811753598b339f3$export$f1a15f539858307","$f811753598b339f3$export$70e712e2ac0237a","getUnitHeightRange","$f811753598b339f3$export$d92a67740c050efb","$f811753598b339f3$export$441710fb21b4ae09","getPositionWithinUnit","$f811753598b339f3$export$ab14c04795685c55","createUnitSorter","$f811753598b339f3$export$d0c8ecbd4ed8940c","ensureArray","$f811753598b339f3$export$97de5b0a6b4e4dac","ensureRealFloat","$6a8fb6360a4f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AA,CAAA,EAAA,EAAA,eAAc,AAAd,EAAgB,EAAS,EAClC,CAAA,GAeF,MAAO,CACL,MATa,EAAY,MAAM,CAAC,CAAC,EAAK,KACtC,GAAM,CAAA,MAAE,CAAK,CAAE,CAAG,EAClB,IAAK,IAAM,KAAQ,EACjB,EAAI,IAAI,CAAC,GAEX,OAAO,CACT,EAAG,EAAE,EAIH,YAAa,GAAgB,EAC7B,SAAU,CACZ,CACF,C,E,E,G,E,E,U,K,sB,C,K,kB,C,6C,e,C,6C,iB,C,4C,Y,C,4C,kB,C,6C,W,C,6C,qB,C,6C,gB,C,6C,W,C,6C,e,C,6C,e,C,6C,Y","sources":["<anon>","packages/column-views/src/prepare-units/index.ts"],"sourcesContent":["import \"./column-views.021a6961.js\";\nimport \"./column-views.a596b1f5.js\";\nimport \"./column-views.dbb4a46b.js\";\nimport \"./column-views.7f9c7448.js\";\nimport {ColumnAxisType as $7dPhe$ColumnAxisType} from \"@macrostrat/column-components\";\nimport {useMemo as $7dPhe$useMemo} from \"react\";\n\n\nfunction $parcel$exportWildcard(dest, source) {\n Object.keys(source).forEach(function(key) {\n if (key === 'default' || key === '__esModule' || Object.prototype.hasOwnProperty.call(dest, key)) {\n return;\n }\n\n Object.defineProperty(dest, key, {\n enumerable: true,\n get: function get() {\n return source[key];\n }\n });\n });\n\n return dest;\n}\n\nfunction $parcel$export(e, n, v, s) {\n Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});\n}\n\n var $parcel$global = globalThis;\n \nvar $parcel$modules = {};\nvar $parcel$inits = {};\n\nvar parcelRequire = $parcel$global[\"parcelRequirea149\"];\n\nif (parcelRequire == null) {\n parcelRequire = function(id) {\n if (id in $parcel$modules) {\n return $parcel$modules[id].exports;\n }\n if (id in $parcel$inits) {\n var init = $parcel$inits[id];\n delete $parcel$inits[id];\n var module = {id: id, exports: {}};\n $parcel$modules[id] = module;\n init.call(module.exports, module, module.exports);\n return module.exports;\n }\n var err = new Error(\"Cannot find module '\" + id + \"'\");\n err.code = 'MODULE_NOT_FOUND';\n throw err;\n };\n\n parcelRequire.register = function register(id, init) {\n $parcel$inits[id] = init;\n };\n\n $parcel$global[\"parcelRequirea149\"] = parcelRequire;\n}\n\nvar parcelRegister = parcelRequire.register;\nvar $031426a894870747$exports = {};\n\n$parcel$export($031426a894870747$exports, \"usePreparedColumnUnits\", () => $031426a894870747$export$206a0cb85295e433);\n$parcel$export($031426a894870747$exports, \"prepareColumnUnits\", () => $031426a894870747$export$be8c5a449df4bde4);\n$parcel$export($031426a894870747$exports, \"preprocessUnits\", () => (parcelRequire(\"ickj2\")).preprocessUnits);\n\nvar $ickj2 = parcelRequire(\"ickj2\");\n\n\n\nvar $bBAza = parcelRequire(\"bBAza\");\n\nvar $iWhRv = parcelRequire(\"iWhRv\");\n\nvar $76iYI = parcelRequire(\"76iYI\");\nfunction $031426a894870747$export$206a0cb85295e433(data, options) {\n /** This function wraps and memoizes all preparation steps for converting\n * an array of units from the /units route to a form ready for usage.\n */ return (0, $7dPhe$useMemo)(()=>{\n return $031426a894870747$export$be8c5a449df4bde4(data, options);\n }, [\n data,\n ...Object.values(options)\n ]);\n}\nfunction $031426a894870747$export$be8c5a449df4bde4(units, options) {\n /** Prepare units for rendering into Macrostrat columns */ let { t_age: t_age, b_age: b_age, t_pos: t_pos, b_pos: b_pos } = options;\n const { mergeSections: mergeSections = (0, $iWhRv.MergeSectionsMode).OVERLAPPING, axisType: axisType, unconformityHeight: unconformityHeight, collapseSmallUnconformities: collapseSmallUnconformities = false, hybridScale: hybridScale, scale: scale } = options;\n let _totalHeight = null;\n if (scale != null) {\n // Set t_age and b_age based on scale domain if not already set\n const domain = scale.domain();\n if (axisType == (0, $7dPhe$ColumnAxisType).AGE) {\n if (t_age == null) t_age = Math.min(...domain);\n if (b_age == null) b_age = Math.max(...domain);\n _totalHeight = Math.abs(scale(b_age) - scale(t_age));\n } else {\n if (t_pos == null) t_pos = Math.min(...domain);\n if (b_pos == null) b_pos = Math.max(...domain);\n _totalHeight = Math.abs(scale(b_pos) - scale(t_pos));\n }\n }\n // Start by ensuring that ages and positions are numbers\n // also set up some values for eODP-style columns\n let units1 = units.map((0, $ickj2.preprocessSectionUnit));\n /** Prototype filtering to age range */ units1 = units1.filter((d)=>{\n // Filter units by t_age and b_age, inclusive\n if (axisType == (0, $7dPhe$ColumnAxisType).AGE) return (0, $iWhRv.agesOverlap)(d, {\n t_age: t_age,\n b_age: b_age\n });\n else return (0, $iWhRv.unitsOverlap)(d, {\n t_pos: t_pos,\n b_pos: b_pos\n }, axisType);\n });\n let mergeMode = mergeSections;\n // if (axisType != ColumnAxisType.AGE) {\n // // For non-age columns, we always merge sections.\n // // This is because the \"groupUnitsIntoSections\" function is not well-defined\n // // for non-age columns.\n // mergeMode = MergeSectionsMode.ALL;\n // }\n let sections0;\n if (mergeMode == (0, $iWhRv.MergeSectionsMode).ALL) {\n // For the \"merge sections\" mode, we need to create a single section\n const [b_unit_pos, t_unit_pos] = (0, $ickj2.getSectionPosRange)(units1, axisType);\n const [b_unit_age, t_unit_age] = (0, $ickj2.getSectionAgeRange)(units1);\n sections0 = [\n {\n section_id: 0,\n /**\n * If ages limits are directly specified, use them to define the section bounds.\n * */ t_pos: t_unit_pos,\n b_pos: b_unit_pos,\n t_age: t_unit_age,\n b_age: b_unit_age,\n units: units1\n }\n ];\n } else if (axisType == (0, $7dPhe$ColumnAxisType).AGE) sections0 = (0, $ickj2.groupUnitsIntoSectionsBySectionID)(units1, axisType);\n else sections0 = (0, $ickj2.groupUnitsIntoSectionsByOverlap)(units1, axisType);\n // Limit sections to the range specified by t_age/b_age or t_pos/b_pos global options\n for (let section of sections0){\n if (axisType == (0, $7dPhe$ColumnAxisType).AGE) {\n section.t_age = Math.max(section.t_age, t_age ?? -Infinity);\n section.b_age = Math.min(section.b_age, b_age ?? Infinity);\n } else if (axisType == (0, $7dPhe$ColumnAxisType).DEPTH) {\n section.t_pos = Math.max(section.t_pos, t_pos ?? -Infinity);\n section.b_pos = Math.min(section.b_pos, b_pos ?? Infinity);\n } else if (axisType == (0, $7dPhe$ColumnAxisType).HEIGHT) {\n section.t_pos = Math.max(section.t_pos, t_pos ?? -Infinity);\n section.b_pos = Math.min(section.b_pos, b_pos ?? Infinity);\n }\n }\n /** Merging overlapping sections really only makes sense for age/height/depth\n * columns. Ordinal columns are numbered by section so merging them\n * results in collisions.\n */ let sections = sections0;\n if (mergeSections == (0, $iWhRv.MergeSectionsMode).OVERLAPPING && axisType == (0, $7dPhe$ColumnAxisType).AGE) sections = (0, $ickj2.mergeOverlappingSections)(sections);\n // Filter out undefined sections just in case\n sections = sections.filter((d)=>d != null);\n // SCALES\n /* Compute pixel scales etc. for sections\n * We need to do this now to determine which unconformities\n * are small enough to collapse.\n */ let sectionsWithScales = (0, $bBAza.computeSectionHeights)(sections, options);\n if (collapseSmallUnconformities && hybridScale == null) {\n // Collapse small unconformities in pixel height space\n // TODO: this doesn't seem to work properly for non-age columns?\n let threshold = unconformityHeight ?? 30;\n if (typeof collapseSmallUnconformities == \"number\") threshold = collapseSmallUnconformities;\n sectionsWithScales = (0, $bBAza.collapseUnconformitiesByPixelHeight)(sectionsWithScales, threshold, options);\n }\n /** Prepare section scale information using groups.\n * Total height is computed from section scales.\n * */ let { totalHeight: totalHeight, sections: sections2 } = (0, $bBAza.finalizeSectionHeights)(sectionsWithScales, unconformityHeight);\n /** For each section, find units that are overlapping.\n * We do this after merging sections so that we can\n * handle cases where there are overlapping units across sections\n * */ const sectionsOut = sections2.map((section)=>{\n return {\n ...section,\n units: (0, $ickj2.preprocessUnits)(section, axisType)\n };\n });\n /** Reconstitute the units so that they are sorted by section and properly enhanced.\n * This is mostly important so that unit keyboard navigation\n * predictably selects adjacent units.\n */ const units2 = sectionsOut.reduce((acc, group)=>{\n const { units: units } = group;\n for (const unit of units)acc.push(unit);\n return acc;\n }, []);\n return {\n units: units2,\n totalHeight: _totalHeight ?? totalHeight,\n sections: sectionsOut\n };\n}\n$parcel$exportWildcard($031426a894870747$exports, $iWhRv);\n$parcel$exportWildcard($031426a894870747$exports, $76iYI);\n\n\nexport {$031426a894870747$export$206a0cb85295e433 as usePreparedColumnUnits, $031426a894870747$export$be8c5a449df4bde4 as prepareColumnUnits, $57278f42f24b59e5$export$55543e159517d62d as preprocessUnits, $f811753598b339f3$export$e1644389ce074058 as MergeSectionsMode, $f811753598b339f3$export$f1a15f539858307 as unitsOverlap, $f811753598b339f3$export$70e712e2ac0237a as getUnitHeightRange, $f811753598b339f3$export$d92a67740c050efb as agesOverlap, $f811753598b339f3$export$441710fb21b4ae09 as getPositionWithinUnit, $f811753598b339f3$export$ab14c04795685c55 as createUnitSorter, $f811753598b339f3$export$d0c8ecbd4ed8940c as ensureArray, $f811753598b339f3$export$97de5b0a6b4e4dac as ensureRealFloat, $6a8fb6360a4f5dac$export$45e8e2d7a1794c23 as HybridScaleType, $6a8fb6360a4f5dac$export$e40aae6f0de9bb95 as HeightMethod};\n//# sourceMappingURL=column-views.5fd6e11a.js.map\n","import {\n getSectionAgeRange,\n getSectionPosRange,\n groupUnitsIntoSectionsByOverlap,\n groupUnitsIntoSectionsBySectionID,\n mergeOverlappingSections,\n preprocessSectionUnit,\n preprocessUnits,\n} from \"./helpers\";\nimport { ColumnAxisType } from \"@macrostrat/column-components\";\nimport { useMemo } from \"react\";\nimport { UnitLong } from \"@macrostrat/api-types\";\nimport {\n collapseUnconformitiesByPixelHeight,\n computeSectionHeights,\n finalizeSectionHeights,\n type CompositeColumnScale,\n} from \"./composite-scale\";\nimport {\n agesOverlap,\n MergeSectionsMode,\n PrepareColumnOptions,\n PreparedColumnData,\n unitsOverlap,\n} from \"./utils\";\nimport { SectionInfo } from \"./types\";\n\nexport * from \"./utils\";\nexport * from \"./types\";\nexport { preprocessUnits };\nexport type { CompositeColumnScale };\n\nexport function usePreparedColumnUnits(\n data: UnitLong[],\n options: PrepareColumnOptions,\n): PreparedColumnData {\n /** This function wraps and memoizes all preparation steps for converting\n * an array of units from the /units route to a form ready for usage.\n */\n return useMemo(() => {\n return prepareColumnUnits(data, options);\n }, [data, ...Object.values(options)]);\n}\n\nexport function prepareColumnUnits(\n units: UnitLong[],\n options: PrepareColumnOptions,\n): PreparedColumnData {\n /** Prepare units for rendering into Macrostrat columns */\n\n let { t_age, b_age, t_pos, b_pos } = options;\n\n const {\n mergeSections = MergeSectionsMode.OVERLAPPING,\n axisType,\n unconformityHeight,\n collapseSmallUnconformities = false,\n hybridScale,\n scale,\n } = options;\n\n let _totalHeight = null;\n\n if (scale != null) {\n // Set t_age and b_age based on scale domain if not already set\n const domain = scale.domain();\n if (axisType == ColumnAxisType.AGE) {\n if (t_age == null) t_age = Math.min(...domain);\n if (b_age == null) b_age = Math.max(...domain);\n _totalHeight = Math.abs(scale(b_age) - scale(t_age));\n } else {\n if (t_pos == null) t_pos = Math.min(...domain);\n if (b_pos == null) b_pos = Math.max(...domain);\n _totalHeight = Math.abs(scale(b_pos) - scale(t_pos));\n }\n }\n\n // Start by ensuring that ages and positions are numbers\n // also set up some values for eODP-style columns\n let units1 = units.map(preprocessSectionUnit);\n\n /** Prototype filtering to age range */\n units1 = units1.filter((d) => {\n // Filter units by t_age and b_age, inclusive\n if (axisType == ColumnAxisType.AGE) {\n return agesOverlap(d, { t_age, b_age });\n } else {\n return unitsOverlap(d, { t_pos, b_pos } as any, axisType);\n }\n });\n\n let mergeMode = mergeSections;\n // if (axisType != ColumnAxisType.AGE) {\n // // For non-age columns, we always merge sections.\n // // This is because the \"groupUnitsIntoSections\" function is not well-defined\n // // for non-age columns.\n // mergeMode = MergeSectionsMode.ALL;\n // }\n\n let sections0: SectionInfo<UnitLong>[];\n if (mergeMode == MergeSectionsMode.ALL) {\n // For the \"merge sections\" mode, we need to create a single section\n const [b_unit_pos, t_unit_pos] = getSectionPosRange(units1, axisType);\n const [b_unit_age, t_unit_age] = getSectionAgeRange(units1);\n sections0 = [\n {\n section_id: 0,\n /**\n * If ages limits are directly specified, use them to define the section bounds.\n * */\n t_pos: t_unit_pos,\n b_pos: b_unit_pos,\n t_age: t_unit_age,\n b_age: b_unit_age,\n units: units1,\n },\n ];\n } else if (axisType == ColumnAxisType.AGE) {\n sections0 = groupUnitsIntoSectionsBySectionID(units1, axisType);\n } else {\n sections0 = groupUnitsIntoSectionsByOverlap(units1, axisType);\n }\n\n // Limit sections to the range specified by t_age/b_age or t_pos/b_pos global options\n for (let section of sections0) {\n if (axisType == ColumnAxisType.AGE) {\n section.t_age = Math.max(section.t_age, t_age ?? -Infinity);\n section.b_age = Math.min(section.b_age, b_age ?? Infinity);\n } else if (axisType == ColumnAxisType.DEPTH) {\n section.t_pos = Math.max(section.t_pos, t_pos ?? -Infinity);\n section.b_pos = Math.min(section.b_pos, b_pos ?? Infinity);\n } else if (axisType == ColumnAxisType.HEIGHT) {\n section.t_pos = Math.max(section.t_pos, t_pos ?? -Infinity);\n section.b_pos = Math.min(section.b_pos, b_pos ?? Infinity);\n }\n }\n\n /** Merging overlapping sections really only makes sense for age/height/depth\n * columns. Ordinal columns are numbered by section so merging them\n * results in collisions.\n */\n let sections = sections0;\n if (\n mergeSections == MergeSectionsMode.OVERLAPPING &&\n axisType == ColumnAxisType.AGE\n ) {\n sections = mergeOverlappingSections(sections);\n }\n // Filter out undefined sections just in case\n sections = sections.filter((d) => d != null);\n\n // SCALES\n\n /* Compute pixel scales etc. for sections\n * We need to do this now to determine which unconformities\n * are small enough to collapse.\n */\n let sectionsWithScales = computeSectionHeights(sections, options);\n\n if (collapseSmallUnconformities && hybridScale == null) {\n // Collapse small unconformities in pixel height space\n // TODO: this doesn't seem to work properly for non-age columns?\n let threshold = unconformityHeight ?? 30;\n if (typeof collapseSmallUnconformities == \"number\") {\n threshold = collapseSmallUnconformities;\n }\n\n sectionsWithScales = collapseUnconformitiesByPixelHeight(\n sectionsWithScales,\n threshold,\n options,\n );\n }\n\n /** Prepare section scale information using groups.\n * Total height is computed from section scales.\n * */\n let { totalHeight, sections: sections2 } = finalizeSectionHeights(\n sectionsWithScales,\n unconformityHeight,\n );\n\n /** For each section, find units that are overlapping.\n * We do this after merging sections so that we can\n * handle cases where there are overlapping units across sections\n * */\n const sectionsOut = sections2.map((section) => {\n return {\n ...section,\n units: preprocessUnits(section, axisType),\n };\n });\n\n /** Reconstitute the units so that they are sorted by section and properly enhanced.\n * This is mostly important so that unit keyboard navigation\n * predictably selects adjacent units.\n */\n const units2 = sectionsOut.reduce((acc, group) => {\n const { units } = group;\n for (const unit of units) {\n acc.push(unit);\n }\n return acc;\n }, []);\n\n return {\n units: units2,\n totalHeight: _totalHeight ?? totalHeight,\n sections: sectionsOut,\n };\n}\n"],"names":["ColumnAxisType","$7dPhe$ColumnAxisType","useMemo","$7dPhe$useMemo","$parcel$exportWildcard","dest","source","Object","keys","forEach","key","prototype","hasOwnProperty","call","defineProperty","enumerable","get","$parcel$export","e","n","v","s","set","configurable","$parcel$global","globalThis","$parcel$modules","$parcel$inits","parcelRequire","id","exports","init","module","err","Error","code","register","$031426a894870747$exports","$031426a894870747$export$206a0cb85295e433","$031426a894870747$export$be8c5a449df4bde4","preprocessUnits","$ickj2","$bBAza","$iWhRv","$76iYI","data","options","values","units","sections0","t_age","b_age","t_pos","b_pos","mergeSections","MergeSectionsMode","OVERLAPPING","axisType","unconformityHeight","collapseSmallUnconformities","hybridScale","scale","_totalHeight","domain","AGE","Math","min","max","abs","units1","map","preprocessSectionUnit","filter","d","agesOverlap","unitsOverlap","mergeMode","ALL","b_unit_pos","t_unit_pos","getSectionPosRange","b_unit_age","t_unit_age","getSectionAgeRange","section_id","groupUnitsIntoSectionsBySectionID","groupUnitsIntoSectionsByOverlap","section","Infinity","DEPTH","HEIGHT","sections","mergeOverlappingSections","sectionsWithScales","computeSectionHeights","threshold","collapseUnconformitiesByPixelHeight","totalHeight","sections2","finalizeSectionHeights","sectionsOut","reduce","acc","group","unit","push","usePreparedColumnUnits","prepareColumnUnits","$57278f42f24b59e5$export$55543e159517d62d","$f811753598b339f3$export$e1644389ce074058","$f811753598b339f3$export$f1a15f539858307","$f811753598b339f3$export$70e712e2ac0237a","getUnitHeightRange","$f811753598b339f3$export$d92a67740c050efb","$f811753598b339f3$export$441710fb21b4ae09","getPositionWithinUnit","$f811753598b339f3$export$ab14c04795685c55","createUnitSorter","$f811753598b339f3$export$d0c8ecbd4ed8940c","ensureArray","$f811753598b339f3$export$97de5b0a6b4e4dac","ensureRealFloat","$6a8fb6360a4f5dac$export$45e8e2d7a1794c23","HybridScaleType","$6a8fb6360a4f5dac$export$e40aae6f0de9bb95","HeightMethod"],"version":3,"file":"column-views.5fd6e11a.js.map","sourceRoot":"../../../../"}
@@ -0,0 +1,2 @@
1
+ import"./column-views.4ec769a6.js";import"./column-views.46efb749.js";import"./column-views.672b683c.js";import e from"@macrostrat/hyper";import{Box as t,useElementSize as a}from"@macrostrat/ui-components";import{group as r}from"d3-array";import{ColumnSVG as n,ColumnAxisType as o}from"@macrostrat/column-components";import{useRef as s}from"react";var l=globalThis,i={},u={},c=l.parcelRequirea149;null==c&&((c=function(e){if(e in i)return i[e].exports;if(e in u){var t=u[e];delete u[e];var a={id:e,exports:{}};return i[e]=a,t.call(a.exports,a,a.exports),a.exports}var r=Error("Cannot find module '"+e+"'");throw r.code="MODULE_NOT_FOUND",r}).register=function(e,t){u[e]=t},l.parcelRequirea149=c),c.register,Object.defineProperty({},"PBDBOccurrencesMatrix",{get:()=>d,set:void 0,enumerable:!0,configurable:!0});var p=c("dx7no"),m=c("wtIgl"),f=c("f7qDU");let x=e.styled(f&&f.__esModule?f.default:f);function d({columnID:e}){let a=(0,p.useFossilData)(e,p.FossilDataType.Occurrences),s=(0,m.useMacrostratColumnData)(),l=(0,m.useCompositeScale)();if(null==a)return null;let i=new Map(r(a,e=>e.unit_id)),{taxonRanges:u}=function(e,t,a=o.AGE){let r=new Map,n=new Map;for(let[e,a]of t.entries())for(let t of a){let a=t.best_name??t.taxon_name;r.has(a)||(r.set(a,new Set),n.set(a,[])),r.get(a).add(e),n.get(a).push(t)}let s=Array.from(r.entries()).sort((e,t)=>t[0].localeCompare(e[0])),l=new Map;for(let[t,n]of r.entries())l.set(t,function(e,t,a){let r=[],n=null;for(let s of e)t.has(s.unit_id)?null==n?n=a==o.DEPTH||a==o.HEIGHT?[s.t_pos,s.b_pos]:[s.t_age,s.b_age]:a==o.DEPTH||a==o.HEIGHT?n[1]=s.b_pos:n[1]=s.b_age:null!=n&&(r.push(n),n=null);return null!=n&&r.push(n),r}(e,n,a));return{occurrenceMap:t,taxonUnitMap:new Map(s),taxonOccurrenceMap:n,taxonRanges:l}}(s.units,i,s.axisType),c=Array.from(u.entries());return x(t,{className:"taxon-ranges",width:32+16*c.length,height:s.totalHeight},[x(g,{taxonEntries:c,padding:16,spacing:16,scale:l}),x(n,{width:32+16*c.length},x("g.taxa-occurrences-matrix",c.map(([e,t],a)=>x("g",{transform:`translate(${16+16*a})`},[t.map(([e,t])=>x("line",{y1:l(e),y2:l(t)}))]))))])}function g({taxonEntries:e,padding:t,spacing:a,scale:r}){return x("div.taxon-labels",[e.map(([e,n],o)=>{let s=r(n[0]?.[0]??0)-20;return s<200&&(s=0),x(_,{top:s,left:t+o*a,taxonName:e})})])}function _({top:e,left:t,taxonName:r}){let n=s(),o=a(n),l=o?.height??200;return x("div.taxon-label",{style:{top:`${e}px`,marginLeft:`${t}px`,"--label-width":`${l}px`}},x("div.taxon-label-inner",x("div.taxon-label-text",{ref:n},r)))}export{d as PBDBOccurrencesMatrix};
2
+ //# sourceMappingURL=column-views.6556e004.js.map