@equinor/videx-3d 5.1.0-beta

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 (235) hide show
  1. package/LICENSE.md +21 -0
  2. package/README.md +120 -0
  3. package/dist/chunk-BX-cez1_.js +23 -0
  4. package/dist/chunk-CnY6Tmof.js +358 -0
  5. package/dist/chunk-MFzFdEWm.js +591 -0
  6. package/dist/chunk-iY0wQ9Z6.js +887 -0
  7. package/dist/generators.js +711 -0
  8. package/dist/main.js +8405 -0
  9. package/dist/sdk.js +610 -0
  10. package/dist/shaderLib/color-conversion.glsl +33 -0
  11. package/dist/shaderLib/colors.glsl +8 -0
  12. package/dist/shaderLib/glyphs.glsl +78 -0
  13. package/dist/shaderLib/random.glsl +3 -0
  14. package/dist/shaderLib/remap.glsl +13 -0
  15. package/dist/shaderLib/render-number.glsl +74 -0
  16. package/dist/shaderLib/render-text.glsl +66 -0
  17. package/dist/shaderLib/rotation.glsl +19 -0
  18. package/dist/shaderLib/sdf-functions.glsl +18 -0
  19. package/dist/textures/normal_map.jpg +0 -0
  20. package/dist/types/common/color-ramps.d.ts +5 -0
  21. package/dist/types/common/types.d.ts +25 -0
  22. package/dist/types/components/Annotations/Annotations.d.ts +42 -0
  23. package/dist/types/components/Annotations/AnnotationsHMTL.d.ts +1 -0
  24. package/dist/types/components/Annotations/AnnotationsLayer.d.ts +46 -0
  25. package/dist/types/components/Annotations/AutoUpdate.d.ts +3 -0
  26. package/dist/types/components/Annotations/DefaultLabelComponent.d.ts +11 -0
  27. package/dist/types/components/Annotations/TestAnnotations.d.ts +12 -0
  28. package/dist/types/components/Annotations/annotations-renderer.d.ts +26 -0
  29. package/dist/types/components/Annotations/annotations-state.d.ts +88 -0
  30. package/dist/types/components/Annotations/helpers.d.ts +11 -0
  31. package/dist/types/components/Annotations/index.d.ts +8 -0
  32. package/dist/types/components/Annotations/types.d.ts +80 -0
  33. package/dist/types/components/Annotations/update-annotations.d.ts +12 -0
  34. package/dist/types/components/CameraTargetMarker/CameraTargetMarker.d.ts +29 -0
  35. package/dist/types/components/Distance/Distance.d.ts +35 -0
  36. package/dist/types/components/Distance/DistanceContext.d.ts +12 -0
  37. package/dist/types/components/Distance/index.d.ts +2 -0
  38. package/dist/types/components/EventEmitter/EventEmitter.d.ts +20 -0
  39. package/dist/types/components/EventEmitter/EventEmitterContext.d.ts +90 -0
  40. package/dist/types/components/EventEmitter/index.d.ts +3 -0
  41. package/dist/types/components/EventEmitter/picking-helper.d.ts +32 -0
  42. package/dist/types/components/EventEmitter/picking-material.d.ts +11 -0
  43. package/dist/types/components/Grids/BoxGrid/BoxGrid.d.ts +52 -0
  44. package/dist/types/components/Grids/Grid/Grid.d.ts +62 -0
  45. package/dist/types/components/Grids/Grid/GridAxesLabels.d.ts +24 -0
  46. package/dist/types/components/Grids/Grid/UtmGrid.d.ts +30 -0
  47. package/dist/types/components/Grids/Grid/grid-helpers.d.ts +2 -0
  48. package/dist/types/components/Grids/index.d.ts +5 -0
  49. package/dist/types/components/Highlighter/Highlighter.d.ts +23 -0
  50. package/dist/types/components/Highlighter/highlight-state.d.ts +43 -0
  51. package/dist/types/components/Highlighter/index.d.ts +2 -0
  52. package/dist/types/components/Html/DepthSelector.d.ts +1 -0
  53. package/dist/types/components/Html/OutputPanel/OutputPanel.d.ts +10 -0
  54. package/dist/types/components/Html/OutputPanel/index.d.ts +2 -0
  55. package/dist/types/components/Html/OutputPanel/output-panel-state.d.ts +38 -0
  56. package/dist/types/components/Html/Panel/Panel.d.ts +20 -0
  57. package/dist/types/components/Html/WellMap/ActiveTrack.d.ts +9 -0
  58. package/dist/types/components/Html/WellMap/DepthCursor.d.ts +8 -0
  59. package/dist/types/components/Html/WellMap/DepthReadout.d.ts +6 -0
  60. package/dist/types/components/Html/WellMap/Schematic.d.ts +15 -0
  61. package/dist/types/components/Html/WellMap/Track.d.ts +13 -0
  62. package/dist/types/components/Html/WellMap/WellMap.d.ts +47 -0
  63. package/dist/types/components/Html/WellMap/addons/WellMapCasingShoes.d.ts +14 -0
  64. package/dist/types/components/Html/WellMap/addons/WellMapCompletionIntervals.d.ts +15 -0
  65. package/dist/types/components/Html/WellMap/addons/WellMapFormations.d.ts +14 -0
  66. package/dist/types/components/Html/WellMap/addons/WellMapTvd.d.ts +14 -0
  67. package/dist/types/components/Html/WellMap/addons/index.d.ts +4 -0
  68. package/dist/types/components/Html/WellMap/index.d.ts +4 -0
  69. package/dist/types/components/Html/WellMap/themes.d.ts +13 -0
  70. package/dist/types/components/Html/WellMap/well-map-context.d.ts +34 -0
  71. package/dist/types/components/Html/WellMap/well-map-state.d.ts +38 -0
  72. package/dist/types/components/Html/index.d.ts +5 -0
  73. package/dist/types/components/ObservableGroup/ObservableGroup.d.ts +38 -0
  74. package/dist/types/components/SDFTest/SDFTest.d.ts +12 -0
  75. package/dist/types/components/Surfaces/Surface.d.ts +46 -0
  76. package/dist/types/components/Surfaces/SurfaceMaterial.d.ts +53 -0
  77. package/dist/types/components/Surfaces/index.d.ts +4 -0
  78. package/dist/types/components/Surfaces/surface-defs.d.ts +7 -0
  79. package/dist/types/components/Symbol/Symbol.d.ts +45 -0
  80. package/dist/types/components/Symbol/index.d.ts +1 -0
  81. package/dist/types/components/UtmArea/UtmArea.d.ts +37 -0
  82. package/dist/types/components/UtmArea/UtmAreaContext.d.ts +32 -0
  83. package/dist/types/components/UtmArea/UtmPosition.d.ts +26 -0
  84. package/dist/types/components/UtmArea/Wgs84Position.d.ts +26 -0
  85. package/dist/types/components/UtmArea/index.d.ts +4 -0
  86. package/dist/types/components/Wellbores/BasicTrajectory/BasicTrajectory.d.ts +27 -0
  87. package/dist/types/components/Wellbores/BasicTrajectory/basic-trajectory-defs.d.ts +3 -0
  88. package/dist/types/components/Wellbores/BasicTrajectory/index.d.ts +2 -0
  89. package/dist/types/components/Wellbores/Casings/CasingAnnotations/CasingAnnotations.d.ts +9 -0
  90. package/dist/types/components/Wellbores/Casings/CasingAnnotations/CasingLabel.d.ts +9 -0
  91. package/dist/types/components/Wellbores/Casings/CasingAnnotations/casing-annotations-defs.d.ts +1 -0
  92. package/dist/types/components/Wellbores/Casings/Casings.d.ts +42 -0
  93. package/dist/types/components/Wellbores/Casings/casings-defs.d.ts +6 -0
  94. package/dist/types/components/Wellbores/Casings/index.d.ts +5 -0
  95. package/dist/types/components/Wellbores/CompletionTools/CompletionAnnotations/CompletionAnnotations.d.ts +9 -0
  96. package/dist/types/components/Wellbores/CompletionTools/CompletionAnnotations/completion-annotations-defs.d.ts +1 -0
  97. package/dist/types/components/Wellbores/CompletionTools/CompletionTools.d.ts +31 -0
  98. package/dist/types/components/Wellbores/CompletionTools/Screen/screen-material.d.ts +8 -0
  99. package/dist/types/components/Wellbores/CompletionTools/completion-tools-defs.d.ts +4 -0
  100. package/dist/types/components/Wellbores/CompletionTools/index.d.ts +5 -0
  101. package/dist/types/components/Wellbores/DepthMarkers/DepthMarkerLabel.d.ts +11 -0
  102. package/dist/types/components/Wellbores/DepthMarkers/DepthMarkers.d.ts +27 -0
  103. package/dist/types/components/Wellbores/DepthMarkers/depth-markers-defs.d.ts +1 -0
  104. package/dist/types/components/Wellbores/DepthMarkers/index.d.ts +3 -0
  105. package/dist/types/components/Wellbores/FormationMarkers/FormationMarkerLabel.d.ts +10 -0
  106. package/dist/types/components/Wellbores/FormationMarkers/FormationMarkers.d.ts +33 -0
  107. package/dist/types/components/Wellbores/FormationMarkers/formation-markers-defs.d.ts +3 -0
  108. package/dist/types/components/Wellbores/FormationMarkers/index.d.ts +3 -0
  109. package/dist/types/components/Wellbores/Perforations/Perforations.d.ts +32 -0
  110. package/dist/types/components/Wellbores/Perforations/index.d.ts +2 -0
  111. package/dist/types/components/Wellbores/Perforations/perforations-defs.d.ts +3 -0
  112. package/dist/types/components/Wellbores/Perimeter/Perimeter.d.ts +29 -0
  113. package/dist/types/components/Wellbores/Perimeter/index.d.ts +2 -0
  114. package/dist/types/components/Wellbores/Perimeter/perimeter-defs.d.ts +3 -0
  115. package/dist/types/components/Wellbores/PositionMarkers/PositionMarkers.d.ts +12 -0
  116. package/dist/types/components/Wellbores/PositionMarkers/position-markers-defs.d.ts +3 -0
  117. package/dist/types/components/Wellbores/Shoes/Shoes.d.ts +34 -0
  118. package/dist/types/components/Wellbores/Shoes/index.d.ts +2 -0
  119. package/dist/types/components/Wellbores/Shoes/shoes-defs.d.ts +3 -0
  120. package/dist/types/components/Wellbores/TubeTrajectory/TubeTrajectory.d.ts +25 -0
  121. package/dist/types/components/Wellbores/TubeTrajectory/index.d.ts +2 -0
  122. package/dist/types/components/Wellbores/TubeTrajectory/tube-geometry-defs.d.ts +3 -0
  123. package/dist/types/components/Wellbores/Wellbore/Wellbore.d.ts +45 -0
  124. package/dist/types/components/Wellbores/Wellbore/WellboreContext.d.ts +19 -0
  125. package/dist/types/components/Wellbores/Wellbore/index.d.ts +2 -0
  126. package/dist/types/components/Wellbores/WellboreBounds/WellboreBounds.d.ts +47 -0
  127. package/dist/types/components/Wellbores/WellboreBounds/index.d.ts +2 -0
  128. package/dist/types/components/Wellbores/WellboreBounds/wellbore-bounds-defs.d.ts +1 -0
  129. package/dist/types/components/Wellbores/WellboreFormationColumn/WellboreFormationColumn.d.ts +30 -0
  130. package/dist/types/components/Wellbores/WellboreFormationColumn/index.d.ts +2 -0
  131. package/dist/types/components/Wellbores/WellboreFormationColumn/wellbore-formation-column-defs.d.ts +3 -0
  132. package/dist/types/components/Wellbores/WellboreLabel/WellboreAnnotationLabel.d.ts +10 -0
  133. package/dist/types/components/Wellbores/WellboreLabel/WellboreLabel.d.ts +25 -0
  134. package/dist/types/components/Wellbores/WellboreLabel/index.d.ts +3 -0
  135. package/dist/types/components/Wellbores/WellboreLabel/wellbore-label-defs.d.ts +1 -0
  136. package/dist/types/components/Wellbores/WellboreRibbon/WellboreRibbon.d.ts +22 -0
  137. package/dist/types/components/Wellbores/WellboreRibbon/WellboreRibbonContext.d.ts +16 -0
  138. package/dist/types/components/Wellbores/WellboreRibbon/index.d.ts +4 -0
  139. package/dist/types/components/Wellbores/WellboreRibbon/stripes/FormationsStripe.d.ts +30 -0
  140. package/dist/types/components/Wellbores/WellboreRibbon/stripes/MeasuredDepthStripe.d.ts +28 -0
  141. package/dist/types/components/Wellbores/WellboreSeismicSection/WellboreSeismicSection.d.ts +34 -0
  142. package/dist/types/components/Wellbores/WellboreSeismicSection/index.d.ts +2 -0
  143. package/dist/types/components/Wellbores/WellboreSeismicSection/wellbore-seismic-section-defs.d.ts +12 -0
  144. package/dist/types/components/Wellbores/Wells/Wells.d.ts +43 -0
  145. package/dist/types/components/Wellbores/Wells/index.d.ts +1 -0
  146. package/dist/types/contexts/DataContext.d.ts +15 -0
  147. package/dist/types/contexts/DataContextProvider.d.ts +33 -0
  148. package/dist/types/contexts/GeneratorsContext.d.ts +13 -0
  149. package/dist/types/contexts/GeneratorsContextProvider.d.ts +34 -0
  150. package/dist/types/contexts/GlyphsContext.d.ts +19 -0
  151. package/dist/types/contexts/GlyphsContextProvider.d.ts +29 -0
  152. package/dist/types/events/camera-events.d.ts +34 -0
  153. package/dist/types/events/depth-events.d.ts +22 -0
  154. package/dist/types/events/interaction-events.d.ts +7 -0
  155. package/dist/types/events/wellbore-events.d.ts +46 -0
  156. package/dist/types/generators/basic-trajectory-generator.d.ts +2 -0
  157. package/dist/types/generators/casing-annotations-generator.d.ts +8 -0
  158. package/dist/types/generators/casings-generator.d.ts +4 -0
  159. package/dist/types/generators/completion-annotations-generator.d.ts +7 -0
  160. package/dist/types/generators/completion-tools-generator.d.ts +2 -0
  161. package/dist/types/generators/depth-markers-generator.d.ts +3 -0
  162. package/dist/types/generators/formation-markers-generator.d.ts +2 -0
  163. package/dist/types/generators/index.d.ts +20 -0
  164. package/dist/types/generators/perforations-generator.d.ts +2 -0
  165. package/dist/types/generators/perimieter-generator.d.ts +2 -0
  166. package/dist/types/generators/position-markers-generator.d.ts +2 -0
  167. package/dist/types/generators/shoes-generator.d.ts +2 -0
  168. package/dist/types/generators/surface-generator.d.ts +4 -0
  169. package/dist/types/generators/tube-trajectory-generator.d.ts +2 -0
  170. package/dist/types/generators/wellbore-bounds-generator.d.ts +2 -0
  171. package/dist/types/generators/wellbore-formation-column-generator.d.ts +2 -0
  172. package/dist/types/generators/wellbore-label-generator.d.ts +7 -0
  173. package/dist/types/generators/wellbore-seismic-section-generator.d.ts +3 -0
  174. package/dist/types/hooks/useData.d.ts +25 -0
  175. package/dist/types/hooks/useGenerator.d.ts +43 -0
  176. package/dist/types/hooks/useWellboreContext.d.ts +13 -0
  177. package/dist/types/layers/layers.d.ts +6 -0
  178. package/dist/types/main.d.ts +48 -0
  179. package/dist/types/rendering/fullscreen-renderer.d.ts +9 -0
  180. package/dist/types/rendering/index.d.ts +2 -0
  181. package/dist/types/rendering/render-passes.d.ts +16 -0
  182. package/dist/types/sdk/data/DataLoader.d.ts +54 -0
  183. package/dist/types/sdk/data/GeneratorRegistry.d.ts +15 -0
  184. package/dist/types/sdk/data/Store.d.ts +29 -0
  185. package/dist/types/sdk/data/helpers/formations-helpers.d.ts +24 -0
  186. package/dist/types/sdk/data/helpers/well-helpers.d.ts +9 -0
  187. package/dist/types/sdk/data/types/Casing.d.ts +8 -0
  188. package/dist/types/sdk/data/types/CompletionTool.d.ts +11 -0
  189. package/dist/types/sdk/data/types/DepthReferencePoint.d.ts +1 -0
  190. package/dist/types/sdk/data/types/Formation.d.ts +32 -0
  191. package/dist/types/sdk/data/types/PerforationInterval.d.ts +9 -0
  192. package/dist/types/sdk/data/types/Pick.d.ts +8 -0
  193. package/dist/types/sdk/data/types/PositionLog.d.ts +17 -0
  194. package/dist/types/sdk/data/types/StratColumn.d.ts +18 -0
  195. package/dist/types/sdk/data/types/SurfaceMeta.d.ts +23 -0
  196. package/dist/types/sdk/data/types/SurfaceValues.d.ts +1 -0
  197. package/dist/types/sdk/data/types/Symbol.d.ts +6 -0
  198. package/dist/types/sdk/data/types/VerticalSlice.d.ts +9 -0
  199. package/dist/types/sdk/data/types/WellboreHeader.d.ts +15 -0
  200. package/dist/types/sdk/data/types/index.d.ts +11 -0
  201. package/dist/types/sdk/geometries/curve/curve-3d.d.ts +46 -0
  202. package/dist/types/sdk/geometries/curve/tube-geometry.d.ts +34 -0
  203. package/dist/types/sdk/geometries/delatin.d.ts +44 -0
  204. package/dist/types/sdk/geometries/fence.d.ts +3 -0
  205. package/dist/types/sdk/geometries/packing.d.ts +46 -0
  206. package/dist/types/sdk/geometries/triangulate-grid-delaunay.d.ts +8 -0
  207. package/dist/types/sdk/geometries/triangulate-grid.d.ts +28 -0
  208. package/dist/types/sdk/index.d.ts +39 -0
  209. package/dist/types/sdk/managers/CameraManager.d.ts +11 -0
  210. package/dist/types/sdk/managers/WellboreManager.d.ts +18 -0
  211. package/dist/types/sdk/materials/depth-material.d.ts +4 -0
  212. package/dist/types/sdk/materials/ribbon-material.d.ts +24 -0
  213. package/dist/types/sdk/materials/tube-material.d.ts +7 -0
  214. package/dist/types/sdk/materials/uv-material.d.ts +2 -0
  215. package/dist/types/sdk/projection/crs.d.ts +37 -0
  216. package/dist/types/sdk/types/common.d.ts +4 -0
  217. package/dist/types/sdk/utils/array.d.ts +0 -0
  218. package/dist/types/sdk/utils/colors.d.ts +2 -0
  219. package/dist/types/sdk/utils/conversions.d.ts +5 -0
  220. package/dist/types/sdk/utils/depth-reader.d.ts +5 -0
  221. package/dist/types/sdk/utils/elevation-map.d.ts +15 -0
  222. package/dist/types/sdk/utils/glyphs.d.ts +50 -0
  223. package/dist/types/sdk/utils/irapbin-parser.d.ts +17 -0
  224. package/dist/types/sdk/utils/num-array.d.ts +2 -0
  225. package/dist/types/sdk/utils/numbers.d.ts +5 -0
  226. package/dist/types/sdk/utils/packing.d.ts +1 -0
  227. package/dist/types/sdk/utils/scene.d.ts +2 -0
  228. package/dist/types/sdk/utils/segments.d.ts +4 -0
  229. package/dist/types/sdk/utils/strings.d.ts +2 -0
  230. package/dist/types/sdk/utils/trajectory.d.ts +59 -0
  231. package/dist/types/sdk/utils/trigonometry.d.ts +12 -0
  232. package/dist/types/sdk/utils/typed-2d-array.d.ts +52 -0
  233. package/dist/types/sdk/utils/typed-array.d.ts +2 -0
  234. package/dist/types/sdk/utils/vector-operations.d.ts +29 -0
  235. package/package.json +127 -0
@@ -0,0 +1,711 @@
1
+ import { transfer as L } from "comlink";
2
+ import "p-limit";
3
+ import { i as x, d as T, o as at, a7 as it, a6 as F, b as _, g as et, O as ct, N as ut, p as mt, aa as lt, F as pt, G as gt, _ as dt, h as ft, ag as ht } from "./chunk-iY0wQ9Z6.js";
4
+ import { Vector3 as b, Matrix4 as $, Color as ot, BufferGeometry as yt, BufferAttribute as j } from "three";
5
+ import "three/src/math/MathUtils.js";
6
+ import "proj4";
7
+ import { clamp as Tt } from "curve-interpolator";
8
+ import { group as nt } from "d3-array";
9
+ import { mergeGeometries as W } from "three/examples/jsm/utils/BufferGeometryUtils.js";
10
+ import { b as O, t as wt, d as Mt, a as bt } from "./chunk-MFzFdEWm.js";
11
+ import { b as vt, d as At } from "./chunk-BX-cez1_.js";
12
+ async function Ht(o, s, u = 0, c, l = !1) {
13
+ const t = await this.get("position-logs", o), e = x(o, t);
14
+ if (!e) return null;
15
+ const a = c !== void 0 ? T(
16
+ (c - e.measuredTop) / e.measuredLength,
17
+ 0,
18
+ 1
19
+ ) : 0, m = at(
20
+ e.curve,
21
+ a,
22
+ 1,
23
+ s,
24
+ u
25
+ ), n = new Float32Array(m.length * 3), p = l ? new Float32Array(m.length) : null;
26
+ m.forEach((d, f) => {
27
+ const M = e.curve.getPointAt(d);
28
+ n[f * 3] = M[0], n[f * 3 + 1] = M[1], n[f * 3 + 2] = M[2], p && (p[f] = d);
29
+ });
30
+ const i = {
31
+ position: {
32
+ array: n,
33
+ itemSize: 3
34
+ }
35
+ };
36
+ p && (i.lengths = {
37
+ array: p,
38
+ itemSize: 1
39
+ });
40
+ const [r, g] = it({ attributes: i });
41
+ return L(r, g);
42
+ }
43
+ async function qt(o) {
44
+ const s = await this.get("casings", o);
45
+ if (!s) return null;
46
+ const u = await this.get("position-logs", o), c = x(o, u);
47
+ return c ? s.filter((t) => t.mdBottomMsl > c.measuredTop).map((t) => {
48
+ const e = T(
49
+ (t.mdTopMsl + (t.mdBottomMsl - t.mdTopMsl) / 2 - c.measuredTop) / c.measuredLength,
50
+ 0,
51
+ 1
52
+ );
53
+ return {
54
+ name: `${t.properties.Diameter} ${t.properties.Type}`,
55
+ data: t.properties,
56
+ position: c.curve.getPointAt(e),
57
+ direction: c.curve.getTangentAt(e),
58
+ priority: t.type === "Shoe" ? 50 : t.innerDiameter
59
+ };
60
+ }) : null;
61
+ }
62
+ function xt(o, s, u, c, l = 0) {
63
+ const t = T(
64
+ s.mdBottomMsl - s.mdTopMsl,
65
+ 1e-4,
66
+ o.measuredLength
67
+ ), e = 1 / o.measuredLength, a = [], m = T(
68
+ (s.mdTopMsl - o.measuredTop) / o.measuredLength,
69
+ 0,
70
+ 1
71
+ ), n = T(
72
+ (s.mdBottomMsl - o.measuredTop) / o.measuredLength,
73
+ 0,
74
+ 1
75
+ ), p = u * (s.outerDiameter / 2), i = Math.max(
76
+ (s.innerDiameter + (s.outerDiameter - s.innerDiameter) / 4) / 2 * u,
77
+ p * 0.95
78
+ );
79
+ a.push([m, i]);
80
+ const r = Math.min((p - i) * 2, t / 3) * e;
81
+ return a.push([m + r, p]), a.push([n - r, p]), a.push([n, i]), O(o.curve, {
82
+ ...c,
83
+ from: Math.max(m, l),
84
+ to: n,
85
+ innerRadius: s.innerDiameter / 2 * u,
86
+ radiusModifier: {
87
+ type: "linear",
88
+ steps: a
89
+ }
90
+ });
91
+ }
92
+ function Lt(o, s, u, c, l, t = 0) {
93
+ const e = T(
94
+ (s.mdTopMsl - o.measuredTop) / o.measuredLength,
95
+ 0,
96
+ 1
97
+ ), a = T(
98
+ (s.mdBottomMsl - o.measuredTop) / o.measuredLength,
99
+ 0,
100
+ 1
101
+ ), m = s.outerDiameter / 2 * u, n = m * l, p = s.innerDiameter / 2 * u;
102
+ return O(o.curve, {
103
+ ...c,
104
+ from: Math.max(e, t),
105
+ to: a,
106
+ radiusModifier: {
107
+ type: "linear",
108
+ steps: [
109
+ [e, m],
110
+ [e + (a - e) / 4, m],
111
+ [a, n]
112
+ ]
113
+ },
114
+ innerRadius: p
115
+ });
116
+ }
117
+ async function Jt(o, s, u = 16, c = 1, l = 2, t = 0.1, e = 0) {
118
+ const a = await this.get("casings", o);
119
+ if (!a) return null;
120
+ const m = await this.get("position-logs", o), n = x(o, m);
121
+ if (!n) return null;
122
+ const p = s !== void 0 ? T(
123
+ (s - n.measuredTop) / n.measuredLength,
124
+ 0,
125
+ 1
126
+ ) : 0, i = {
127
+ startCap: !0,
128
+ endCap: !0,
129
+ radialSegments: u,
130
+ addGroups: !0,
131
+ computeNormals: !0,
132
+ computeUvs: !0,
133
+ simplificationThreshold: e,
134
+ segmentsPerMeter: t
135
+ }, r = [], g = [], d = a.filter(
136
+ (w) => w.mdBottomMsl > n.measuredTop && (s === void 0 || w.mdBottomMsl > s)
137
+ ).sort((w, h) => w.outerDiameter - h.outerDiameter);
138
+ if (d.length === 0) return null;
139
+ nt(d, (w) => ({
140
+ category: ["Shoe", "Casing"].includes(w.type) ? w.type : "Generic",
141
+ dimmension: w.outerDiameter
142
+ })).forEach((w, h) => {
143
+ const B = w.map((D) => {
144
+ let P;
145
+ return h.category === "Shoe" ? P = Lt(
146
+ n,
147
+ D,
148
+ c,
149
+ i,
150
+ l,
151
+ p
152
+ ) : P = xt(
153
+ n,
154
+ D,
155
+ c,
156
+ i,
157
+ p
158
+ ), P;
159
+ });
160
+ g.push(vt[h.category]), r.push(W(B, !1));
161
+ });
162
+ const M = W(r, !0);
163
+ M.groups.forEach((w, h) => {
164
+ w.materialIndex = g[h];
165
+ });
166
+ const [v, y] = F(M);
167
+ return L({
168
+ geometry: v
169
+ }, y);
170
+ }
171
+ async function Kt(o) {
172
+ const s = await this.get("completion-tools", o);
173
+ if (!s) return null;
174
+ const u = await this.get("position-logs", o), c = x(o, u);
175
+ return c ? s.filter((t) => t.mdBottomMsl > c.measuredTop).map((t) => {
176
+ const e = T(
177
+ (t.mdTopMsl + t.length / 2 - c.measuredTop) / c.measuredLength,
178
+ 0,
179
+ 1
180
+ );
181
+ return {
182
+ name: t.name,
183
+ //data: d,
184
+ position: c.curve.getPointAt(e),
185
+ direction: c.curve.getTangentAt(e),
186
+ priority: t.diameterMax
187
+ };
188
+ }) : null;
189
+ }
190
+ function Bt(o, s, u, c, l) {
191
+ const t = T(s.length, 1e-4, o.measuredLength), e = 1 / o.measuredLength, a = [], m = T(
192
+ (s.mdTopMsl - o.measuredTop) / o.measuredLength,
193
+ 0,
194
+ 1
195
+ ), n = T(
196
+ (s.mdBottomMsl - o.measuredTop) / o.measuredLength,
197
+ 0,
198
+ 1
199
+ ), p = u * ((s.diameterTop || s.diameterBottom) / 2), i = u * ((s.diameterBottom || s.diameterTop) / 2), r = u * ((s.diameterMax || s.diameterTop) / 2), g = Math.min(p, i, r);
200
+ a.push([m, p]);
201
+ const d = Math.min((r - g) * 2, t / 3) * e;
202
+ return r > g && (a.push([m + d, r]), a.push([n - d, r])), a.push([n, i]), O(o.curve, {
203
+ ...l,
204
+ from: Math.max(m, c),
205
+ to: n,
206
+ computeLengths: !0,
207
+ radiusModifier: {
208
+ type: "linear",
209
+ steps: a
210
+ }
211
+ });
212
+ }
213
+ async function Qt(o, s, u = 16, c = 1, l = 0.1, t = 0) {
214
+ const e = await this.get("completion-tools", o);
215
+ if (!e) return null;
216
+ const a = await this.get("position-logs", o), m = x(o, a);
217
+ if (!m) return null;
218
+ const n = s !== void 0 ? T(
219
+ (s - m.measuredTop) / m.measuredLength,
220
+ 0,
221
+ 1
222
+ ) : 0, p = e.filter(
223
+ (y) => y.mdBottomMsl > m.measuredTop && (s === void 0 || y.mdBottomMsl > s)
224
+ ).sort((y, A) => y.mdTopMsl - A.mdTopMsl), i = nt(p, (y) => y.category), r = {
225
+ startCap: !0,
226
+ endCap: !0,
227
+ radialSegments: u,
228
+ computeNormals: !0,
229
+ computeUvs: !0,
230
+ segmentsPerMeter: l,
231
+ simplificationThreshold: t,
232
+ radius: 0
233
+ }, g = [], d = [];
234
+ if (i.forEach((y, A) => {
235
+ const w = y.map((h) => Bt(
236
+ m,
237
+ h,
238
+ c,
239
+ n,
240
+ r
241
+ ));
242
+ d.push(At[A]), g.push(W(w, !1));
243
+ }), !g.length) return null;
244
+ const f = W(g, !0);
245
+ f.groups.forEach((y, A) => {
246
+ y.materialIndex = d[A];
247
+ });
248
+ const [M, v] = F(f);
249
+ return L(M, v);
250
+ }
251
+ async function Zt(o, s, u = "MSL", c) {
252
+ const l = await this.get("position-logs", o);
253
+ if (!l || l.length < 8) return null;
254
+ let t = 0;
255
+ if (u === "RT") {
256
+ const g = await this.get("wellbore-headers", o);
257
+ g && (t = g.depthReferenceElevation);
258
+ }
259
+ const e = x(o, l);
260
+ if (!e) return null;
261
+ const a = l[l.length - 1] + t, n = Math.max(
262
+ e.measuredTop,
263
+ c && Number.isFinite(c) ? c : e.measuredTop
264
+ ) + t, p = [n];
265
+ let i = Math.floor(n / s) * s;
266
+ for (i <= n && (i += s); i < a; )
267
+ p.push(i), i += s;
268
+ return p.push(a), p.map((g) => {
269
+ const d = T(
270
+ (g - t - e.measuredTop) / e.measuredLength,
271
+ 0,
272
+ 1
273
+ ), f = e.curve.getPointAt(d), M = e.curve.getTangentAt(d);
274
+ return {
275
+ id: `${o}_${g}`,
276
+ name: (Math.round(g * 10) / 10).toString(),
277
+ direction: M,
278
+ position: f
279
+ };
280
+ });
281
+ }
282
+ const V = new b(), H = new b(), q = new b(), $t = new b(0, 1, 0), C = new $(), Dt = new $().makeRotationX(_), J = new ot();
283
+ async function zt(o, s, u, c = 10) {
284
+ const l = await et(
285
+ o,
286
+ s,
287
+ this,
288
+ u
289
+ );
290
+ if (!l) return null;
291
+ const t = ct(l);
292
+ if (!t.length) return null;
293
+ const e = await this.get("position-logs", o), a = x(o, e);
294
+ if (!a) return null;
295
+ const m = t.map((r) => {
296
+ const g = Tt(
297
+ (r.mdMsl - a.measuredTop) / a.measuredLength,
298
+ 0,
299
+ 1
300
+ );
301
+ return {
302
+ ...r,
303
+ position: a.curve.getPointAt(g),
304
+ direction: a.curve.getTangentAt(g)
305
+ };
306
+ }), n = new Float32Array(m.length * 16), p = new Float32Array(m.length * 3), i = [];
307
+ return m.forEach((r, g) => {
308
+ V.set(...r.position), C.identity();
309
+ const d = c;
310
+ q.set(d, d, d), H.set(
311
+ V.x + r.direction[0],
312
+ V.y + r.direction[1],
313
+ V.z + r.direction[2]
314
+ ), C.lookAt(V, H, $t), C.multiply(Dt), C.setPosition(V), C.scale(q), C.toArray(n, g * 16), J.set(r.color), J.toArray(p, g * 3), i[g] = {
315
+ id: `${o}_${g}`,
316
+ name: `${r.name} ${wt(r.type)}`,
317
+ depth: r.mdMsl,
318
+ tvd: r.tvdMsl,
319
+ level: r.level,
320
+ direction: r.direction
321
+ };
322
+ }), L(
323
+ {
324
+ data: i,
325
+ transformations: n,
326
+ colors: p
327
+ },
328
+ [n.buffer]
329
+ );
330
+ }
331
+ const G = new b(), K = new b(), X = new b(), Ft = new b(0, 1, 0), k = new $(), Pt = new $().makeRotationX(_);
332
+ async function te(o, s, u = 1) {
333
+ const c = await this.get(
334
+ "perforations",
335
+ o
336
+ );
337
+ if (!c) return null;
338
+ const l = await this.get("position-logs", o), t = x(o, l);
339
+ if (!t) return null;
340
+ X.set(
341
+ Math.max(1, u / 2),
342
+ u,
343
+ Math.max(1, u / 2)
344
+ );
345
+ const e = [], a = c.filter(
346
+ (i) => i.status === "Open" && i.mdBottomMsl > t.measuredTop && (s === void 0 || i.mdBottomMsl > s)
347
+ ).sort((i, r) => i.mdTopMsl - r.mdTopMsl);
348
+ for (let i = 0; i < a.length; i++) {
349
+ const r = a[i];
350
+ r.mdBottomMsl <= t.measuredTop || (!e.length || e[e.length - 1].bottom !== r.mdTopMsl ? e.push({
351
+ type: r.type,
352
+ top: Math.max(t.measuredTop, r.mdTopMsl),
353
+ bottom: r.mdBottomMsl,
354
+ density: ut(r.density || 0),
355
+ phase: r.phase || 0,
356
+ innerDiameter: 0,
357
+ outerDiameter: 0
358
+ }) : e.length && (e[e.length - 1].bottom = r.mdBottomMsl));
359
+ }
360
+ const m = [];
361
+ for (let i = 0; i < e.length; i++) {
362
+ const r = e[i], g = r.bottom - r.top, d = Math.max(
363
+ 1,
364
+ Math.floor(g * r.density)
365
+ ), f = T(
366
+ (r.top - t.measuredTop) / t.measuredLength,
367
+ 0,
368
+ 1
369
+ ), v = (T(
370
+ (r.bottom - t.measuredTop) / t.measuredLength,
371
+ 0,
372
+ 1
373
+ ) - f) / d, y = [];
374
+ for (let h = 0; h < d; h++)
375
+ y.push(f + v * h);
376
+ const A = mt(t.curve, y);
377
+ let w = _;
378
+ for (let h = 0; h < A.length; h++) {
379
+ const B = A[h], D = lt(
380
+ pt(B.tangent, [0, -1, 0]),
381
+ B.tangent,
382
+ w
383
+ );
384
+ m.push({
385
+ name: r.type,
386
+ position: B.position,
387
+ normal: D,
388
+ tangent: B.tangent
389
+ }), w += gt(r.phase);
390
+ }
391
+ }
392
+ const n = new Float32Array(m.length * 16), p = [];
393
+ for (let i = 0; i < m.length; i++) {
394
+ const r = m[i];
395
+ G.set(...r.position), K.set(
396
+ G.x + r.normal[0],
397
+ G.y + r.normal[1],
398
+ G.z + r.normal[2]
399
+ ), X.setY(
400
+ u + u * (Math.random() - 0.5) * 0.25
401
+ ), k.identity(), k.lookAt(G, K, Ft), k.multiply(Pt), k.setPosition(G), k.scale(X), k.toArray(n, i * 16), p[i] = {
402
+ id: `${o}_${i}`,
403
+ name: r.name,
404
+ direction: r.tangent
405
+ };
406
+ }
407
+ return L(
408
+ {
409
+ data: p,
410
+ transformations: n
411
+ },
412
+ [n.buffer]
413
+ );
414
+ }
415
+ async function ee(o, s, u = 0.1, c = 0) {
416
+ const l = await this.get("position-logs", o), t = x(o, l);
417
+ if (!t) return null;
418
+ const e = {
419
+ from: 0,
420
+ to: 1,
421
+ startCap: !1,
422
+ endCap: !1,
423
+ radialSegments: 32,
424
+ computeLengths: !0,
425
+ computeUvs: !0,
426
+ segmentsPerMeter: u,
427
+ simplificationThreshold: c,
428
+ radius: s
429
+ }, a = O(t.curve, e), [m, n] = F(a);
430
+ return L(m, n);
431
+ }
432
+ const R = new b(), Q = new b(), Z = new b(), Vt = new b(0, 1, 0), S = new $(), Ct = new $().makeRotationX(_);
433
+ async function oe(o, s, u, c) {
434
+ const l = await this.get("position-logs", o), t = x(o, l);
435
+ if (!t) return null;
436
+ const e = t.measuredBottom, a = t.measuredLength, n = Math.max(
437
+ t.measuredTop,
438
+ c && Number.isFinite(c) ? c : t.measuredTop
439
+ ), p = [n];
440
+ let i = Math.floor(n / u) * u;
441
+ for (i <= n && (i += u); i < e; )
442
+ p.push(i), i += u;
443
+ p.push(e);
444
+ const r = new Float32Array(p.length * 16), g = [];
445
+ return p.forEach((d, f) => {
446
+ const M = T((d - t.measuredTop) / a, 0, 1), v = t.curve.getPointAt(M), y = t.curve.getTangentAt(M);
447
+ R.set(...v), S.identity();
448
+ const A = s + 2 / s;
449
+ Z.set(A, A, A), Q.set(
450
+ R.x + y[0],
451
+ R.y + y[1],
452
+ R.z + y[2]
453
+ ), S.lookAt(R, Q, Vt), S.multiply(Ct), S.setPosition(R), S.scale(Z), S.toArray(r, f * 16), g[f] = {
454
+ id: `${o}_${f}`,
455
+ depth: d,
456
+ position: v
457
+ };
458
+ }), L(
459
+ {
460
+ data: g,
461
+ transformations: r
462
+ },
463
+ [r.buffer]
464
+ );
465
+ }
466
+ const E = new b(), z = new b(), tt = new b(), Gt = new b(0, 1, 0), I = new $(), kt = new $().makeRotationX(_);
467
+ async function ne(o, s, u) {
468
+ const c = await this.get("casings", o);
469
+ if (!c) return null;
470
+ const l = await this.get("position-logs", o), t = x(o, l);
471
+ if (!t) return null;
472
+ const e = c.filter(
473
+ (n) => n.type === "Shoe" && n.mdBottomMsl > t.measuredTop && (s === void 0 || n.mdBottomMsl > s)
474
+ ).map((n) => {
475
+ const p = T(
476
+ (n.mdBottomMsl - t.measuredTop) / t.measuredLength,
477
+ 0,
478
+ 1
479
+ );
480
+ return {
481
+ name: `${n.properties.Diameter} ${n.properties.Type}`,
482
+ data: n.properties,
483
+ position: t.curve.getPointAt(p),
484
+ direction: t.curve.getTangentAt(p),
485
+ radius: n.outerDiameter / 2
486
+ };
487
+ }), a = new Float32Array(e.length * 16), m = [];
488
+ return e.forEach((n, p) => {
489
+ E.set(...n.position), I.identity();
490
+ const i = n.radius * (u || 1);
491
+ tt.set(i, i, i), z.set(
492
+ E.x + n.direction[0],
493
+ E.y + n.direction[1],
494
+ E.z + n.direction[2]
495
+ ), I.lookAt(E, z, Gt), I.multiply(kt), I.setPosition(E), I.scale(tt), I.toArray(a, p * 16), m[p] = {
496
+ id: `${o}_${p}`,
497
+ name: n.name,
498
+ direction: n.direction
499
+ };
500
+ }), L(
501
+ {
502
+ data: m,
503
+ transformations: a
504
+ },
505
+ [a.buffer]
506
+ );
507
+ }
508
+ const Rt = -1;
509
+ async function se(o) {
510
+ if (!await this.get("surface-meta", o)) return null;
511
+ const u = await this.get("surface-values", o);
512
+ if (!u) return null;
513
+ const c = u;
514
+ return L({
515
+ elevationImageBuffer: c
516
+ }, [c.buffer]);
517
+ }
518
+ async function re(o, s = 5) {
519
+ const u = await this.get("surface-meta", o);
520
+ if (!u) return null;
521
+ const c = u.max, l = await this.get("surface-values", o);
522
+ if (!l) return null;
523
+ const { header: t } = u, e = new yt(), { positions: a, uvs: m, indices: n } = Mt(
524
+ l,
525
+ t.nx,
526
+ t.xinc,
527
+ t.yinc,
528
+ Rt,
529
+ s
530
+ );
531
+ e.setAttribute("position", new j(a, 3)), e.setAttribute("uv", new j(m, 2)), e.setIndex(new j(n, 1)), e.translate(0, 0, -(t.ny - 1) * t.yinc), e.rotateY(t.rot * (Math.PI / 180)), e.translate(0, -c, 0);
532
+ const [p, i] = F(e);
533
+ return L(p, i);
534
+ }
535
+ async function ae(o, s, u = 0, c, l = 0.5, t = 16, e = !1) {
536
+ const a = await this.get("position-logs", o), m = x(o, a);
537
+ if (!m) return null;
538
+ const p = {
539
+ from: c !== void 0 ? T(
540
+ (c - m.measuredTop) / m.measuredLength,
541
+ 0,
542
+ 1
543
+ ) : 0,
544
+ radius: l,
545
+ startCap: !0,
546
+ endCap: !0,
547
+ segmentsPerMeter: s,
548
+ simplificationThreshold: u,
549
+ computeNormals: !0,
550
+ computeUvs: !0,
551
+ computeLengths: !!e,
552
+ radialSegments: t
553
+ }, i = O(m.curve, p), [r, g] = F(i);
554
+ return L(r, g);
555
+ }
556
+ async function ie(o, s, u = 250) {
557
+ const c = await this.get("position-logs", o), l = {
558
+ main: {
559
+ center: [0, 0, 0],
560
+ radius: 10
561
+ },
562
+ sampled: []
563
+ };
564
+ if (c) {
565
+ const a = x(o, c);
566
+ if (a) {
567
+ const m = s !== void 0 ? T(
568
+ (s - a.measuredTop) / a.measuredLength,
569
+ 0,
570
+ 1
571
+ ) : 0, n = a.curve.getBoundingBox(m), p = (n.max[0] - n.min[0]) / 2, i = (n.max[1] - n.min[1]) / 2, r = (n.max[2] - n.min[2]) / 2, g = dt([p, i, r]) + u * 2, d = [
572
+ n.min[0] + p,
573
+ n.min[1] + i,
574
+ n.min[2] + r
575
+ ];
576
+ if (l.main.center = d, l.main.radius = g, u > 0) {
577
+ const f = Math.max(
578
+ 2,
579
+ Math.ceil((1 - m) * a.curve.length / u)
580
+ ), M = a.curve.getPoints(f, m, 1), v = [];
581
+ M.forEach((y) => {
582
+ v.push({
583
+ center: y,
584
+ radius: u
585
+ });
586
+ }), l.sampled = v;
587
+ }
588
+ }
589
+ }
590
+ const t = new Float32Array(4 + l.sampled.length * 4);
591
+ let e = 0;
592
+ t[e] = l.main.center[0], t[e + 1] = l.main.center[1], t[e + 2] = l.main.center[2], t[e + 3] = l.main.radius, e = 4;
593
+ for (let a = 0; a < l.sampled.length; a++, e += 4)
594
+ t[e] = l.sampled[a].center[0], t[e + 1] = l.sampled[a].center[1], t[e + 2] = l.sampled[a].center[2], t[e + 3] = l.sampled[a].radius;
595
+ return L(t, [t.buffer]);
596
+ }
597
+ async function ce(o, s, u, c, l, t, e = 0.5, a = 2, m = !0, n = 16, p = 0) {
598
+ const i = await et(
599
+ o,
600
+ s,
601
+ this
602
+ );
603
+ if (!i) return null;
604
+ const r = i.filter(
605
+ (h) => (t === void 0 || h.type && t.includes(h.type)) && (l === void 0 || l.includes(h.name))
606
+ );
607
+ if (!r.length) return null;
608
+ const g = ft(r), d = await this.get("position-logs", o), f = x(o, d);
609
+ if (!f) return null;
610
+ const M = {
611
+ startCap: m,
612
+ endCap: m,
613
+ segmentsPerMeter: u,
614
+ simplificationThreshold: p,
615
+ radialSegments: n,
616
+ computeRelativeLengths: !0
617
+ }, v = [];
618
+ if (g.forEach((h) => {
619
+ if (c === void 0 || h.mdMslTo > c) {
620
+ let B = h.mdMslFrom;
621
+ c !== void 0 && c > B && (B = c);
622
+ const D = f.getPositionAtDepth(B, !0), P = f.getPositionAtDepth(h.mdMslTo, !0);
623
+ if (D !== null && P !== null) {
624
+ const st = a + e, rt = new ot(h.color), N = O(f.curve, {
625
+ ...M,
626
+ radius: st,
627
+ from: D,
628
+ to: P
629
+ });
630
+ if (N.attributes.position.count) {
631
+ const Y = new Float32Array(
632
+ N.attributes.position.count * 3
633
+ );
634
+ for (let U = 0; U < N.attributes.position.count; U++)
635
+ rt.toArray(Y, U * 3);
636
+ N.attributes.color = new j(Y, 3), v.push(N);
637
+ }
638
+ }
639
+ }
640
+ }), !v.length) return null;
641
+ const y = W(v, !1), [A, w] = F(y);
642
+ return L(A, w);
643
+ }
644
+ async function ue(o, s, u) {
645
+ const c = await this.get("wellbore-headers", o);
646
+ if (!c) return null;
647
+ const l = await this.get("position-logs", o), t = x(o, l);
648
+ if (!t) return null;
649
+ let e = 1;
650
+ const { measuredTop: a, measuredLength: m, curve: n } = t;
651
+ if (s === "top")
652
+ e = T(
653
+ ((u || a) - a) / m,
654
+ 0,
655
+ 1
656
+ );
657
+ else if (s === "center") {
658
+ const i = (u || a) + (m - (u || a)) / 2;
659
+ e = T((i - a) / m, 0, 1);
660
+ }
661
+ return [{
662
+ id: o,
663
+ name: `${c.name.replace("NO ", "")}`,
664
+ position: n.getPointAt(e),
665
+ direction: n.getTangentAt(e)
666
+ }];
667
+ }
668
+ async function me(o, s = 3, u = 1e3, c = 1e3, l = 0) {
669
+ const t = {
670
+ stepSize: s,
671
+ minSize: u,
672
+ extension: c,
673
+ defaultExtensionAngle: l
674
+ }, e = await this.get(
675
+ "wellbore-seismic-section",
676
+ o,
677
+ t
678
+ );
679
+ if (e === null || e.trajectory === null) return null;
680
+ const { positions: a } = e.trajectory, m = -e.depthRange[0], n = -e.depthRange[1], p = ht(a), i = bt(p, m, n), [r, g] = F(i), d = {
681
+ data: {
682
+ array: e.values,
683
+ width: e.samples[0],
684
+ height: e.samples[1],
685
+ min: e.valueRange[0],
686
+ max: e.valueRange[1]
687
+ },
688
+ geometry: r
689
+ }, f = [d.data.array.buffer, ...g];
690
+ return L(d, f);
691
+ }
692
+ export {
693
+ ie as calculateWellboreBounds,
694
+ Ht as generateBasicTrajectory,
695
+ qt as generateCasingAnnotations,
696
+ Jt as generateCasings,
697
+ Kt as generateCompletionToolAnnotations,
698
+ Qt as generateCompletionTools,
699
+ Zt as generateDepthMarkers,
700
+ zt as generateFormationMarkers,
701
+ te as generatePerforations,
702
+ ee as generatePerimeterGeometry,
703
+ oe as generatePositionMarkers,
704
+ ne as generateShoes,
705
+ re as generateSurfaceGeometry,
706
+ se as generateSurfaceTexturesData,
707
+ ae as generateTubeTrajectory,
708
+ ce as generateWellboreFormationColumnGeometries,
709
+ ue as generateWellboreLabel,
710
+ me as generateWellboreSeismicSection
711
+ };