@corva/ui 3.75.0-13 → 3.75.0-14

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 (203) hide show
  1. package/cjs-bundle/components/AddComment/Popover.js +1 -1
  2. package/cjs-bundle/components/AddComment/Popover.js.map +1 -1
  3. package/cjs-bundle/components/AddComment/components/Content.js +1 -1
  4. package/cjs-bundle/components/AddComment/components/Content.js.map +1 -1
  5. package/cjs-bundle/components/BICOffsetPickerDialog/components/Map/Map.js +1 -1
  6. package/cjs-bundle/components/BICOffsetPickerDialog/components/Map/Map.js.map +1 -1
  7. package/cjs-bundle/components/BICOffsetPickerDialog/index.js +1 -1
  8. package/cjs-bundle/components/BICOffsetPickerDialog/index.js.map +1 -1
  9. package/cjs-bundle/components/Casing/CasingTableV2/components/CasingJoints/Editor.js +1 -1
  10. package/cjs-bundle/components/Casing/CasingTableV2/components/CasingJoints/Editor.js.map +1 -1
  11. package/cjs-bundle/components/Casing/CasingTableV2/components/Component.js +1 -1
  12. package/cjs-bundle/components/Casing/CasingTableV2/components/Component.js.map +1 -1
  13. package/cjs-bundle/components/Casing/CasingTableV2/components/DrillPipe/Editor.js +1 -1
  14. package/cjs-bundle/components/Casing/CasingTableV2/components/DrillPipe/Editor.js.map +1 -1
  15. package/cjs-bundle/components/DocumentViewer/DocumentViewer.js +1 -1
  16. package/cjs-bundle/components/DocumentViewer/DocumentViewer.js.map +1 -1
  17. package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Agitator/Editor.js +1 -1
  18. package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Agitator/Editor.js.map +1 -1
  19. package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Bit/Editor.js +1 -1
  20. package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Bit/Editor.js.map +1 -1
  21. package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Component.js +1 -1
  22. package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Component.js.map +1 -1
  23. package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/DrillCollar/Editor.js +1 -1
  24. package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/DrillCollar/Editor.js.map +1 -1
  25. package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/DrillPipe/Editor.js +1 -1
  26. package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/DrillPipe/Editor.js.map +1 -1
  27. package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Jar/Editor.js +1 -1
  28. package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Jar/Editor.js.map +1 -1
  29. package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Lwd/Editor.js +1 -1
  30. package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Lwd/Editor.js.map +1 -1
  31. package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Mwd/Editor.js +1 -1
  32. package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Mwd/Editor.js.map +1 -1
  33. package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Pdm/Editor.js +1 -1
  34. package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Pdm/Editor.js.map +1 -1
  35. package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Rss/Editor.js +1 -1
  36. package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Rss/Editor.js.map +1 -1
  37. package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Stabilizer/Editor.js +1 -1
  38. package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Stabilizer/Editor.js.map +1 -1
  39. package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Sub/Editor.js +1 -1
  40. package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Sub/Editor.js.map +1 -1
  41. package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Ur/Editor.js +1 -1
  42. package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Ur/Editor.js.map +1 -1
  43. package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/shared/ConfirmationPopup.js +1 -1
  44. package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/shared/ConfirmationPopup.js.map +1 -1
  45. package/cjs-bundle/components/OffsetWellMap/OffsetWellMap.js +1 -1
  46. package/cjs-bundle/components/OffsetWellMap/OffsetWellMap.js.map +1 -1
  47. package/cjs-bundle/components/OffsetWellPickerV2/components/Filter/ToggleMapButton.js +1 -1
  48. package/cjs-bundle/components/OffsetWellPickerV2/components/Filter/ToggleMapButton.js.map +1 -1
  49. package/cjs-bundle/components/OffsetWellPickerV2/components/Map/Map.js +1 -1
  50. package/cjs-bundle/components/OffsetWellPickerV2/components/Map/Map.js.map +1 -1
  51. package/cjs-bundle/components/OffsetWellPickerV2/components/Table/MetricsAddMenu.js +1 -1
  52. package/cjs-bundle/components/OffsetWellPickerV2/components/Table/MetricsAddMenu.js.map +1 -1
  53. package/cjs-bundle/components/OffsetWellPickerV2/effects/index.js +1 -1
  54. package/cjs-bundle/components/OffsetWellPickerV2/effects/index.js.map +1 -1
  55. package/cjs-bundle/components/OffsetWellPickerV3/components/CustomSelectionView/components/Map/Map.js +1 -1
  56. package/cjs-bundle/components/OffsetWellPickerV3/components/CustomSelectionView/components/Map/Map.js.map +1 -1
  57. package/cjs-bundle/components/OffsetWellPickerV3/components/CustomSelectionView/components/Table/MetricsAddMenu.js +1 -1
  58. package/cjs-bundle/components/OffsetWellPickerV3/components/CustomSelectionView/components/Table/MetricsAddMenu.js.map +1 -1
  59. package/cjs-bundle/components/OffsetWellPickerV3/components/CustomSelectionView/effects/index.js +1 -1
  60. package/cjs-bundle/components/OffsetWellPickerV3/components/CustomSelectionView/effects/index.js.map +1 -1
  61. package/cjs-bundle/components/OffsetWellPickerV3/components/CustomSelectionView/index.js +1 -1
  62. package/cjs-bundle/components/OffsetWellPickerV3/components/CustomSelectionView/index.js.map +1 -1
  63. package/cjs-bundle/components/OffsetWellPickerV3/components/OffsetWellSelectionView/index.js +1 -1
  64. package/cjs-bundle/components/OffsetWellPickerV3/components/OffsetWellSelectionView/index.js.map +1 -1
  65. package/cjs-bundle/components/OffsetWellPickerV3/components/TabSelection/ToggleMapButton.js +1 -1
  66. package/cjs-bundle/components/OffsetWellPickerV3/components/TabSelection/ToggleMapButton.js.map +1 -1
  67. package/cjs-bundle/components/OffsetWellPickerV3/components/TabSelection/index.js +1 -1
  68. package/cjs-bundle/components/OffsetWellPickerV3/components/TabSelection/index.js.map +1 -1
  69. package/cjs-bundle/components/OffsetWellPickerV3/components/WellHubView/index.js +1 -1
  70. package/cjs-bundle/components/OffsetWellPickerV3/components/WellHubView/index.js.map +1 -1
  71. package/cjs-bundle/components/OffsetWellPickerV3/components/shared/OffsetWellTableHead.js +1 -1
  72. package/cjs-bundle/components/OffsetWellPickerV3/components/shared/OffsetWellTableHead.js.map +1 -1
  73. package/cjs-bundle/components/OffsetWellPickerV5/components/Filter/components/CustomDateFields/CustomDateFields.js +1 -1
  74. package/cjs-bundle/components/OffsetWellPickerV5/components/Filter/components/CustomDateFields/CustomDateFields.js.map +1 -1
  75. package/cjs-bundle/components/OffsetWellPickerV5/components/Map/OffsetWellMap/hooks/useMapTooltipState.js +1 -1
  76. package/cjs-bundle/components/OffsetWellPickerV5/components/Map/OffsetWellMap/hooks/useMapTooltipState.js.map +1 -1
  77. package/cjs-bundle/components/OffsetWellPickerV5/components/Map/OffsetWellMap/hooks/useSelectionToolOrchestration.js +1 -1
  78. package/cjs-bundle/components/OffsetWellPickerV5/components/Map/OffsetWellMap/hooks/useSelectionToolOrchestration.js.map +1 -1
  79. package/cjs-bundle/components/OffsetWellPickerV5/components/Map/OffsetWellMap/hooks/utils/well-markers-utils.js +1 -1
  80. package/cjs-bundle/components/OffsetWellPickerV5/components/Map/OffsetWellMap/hooks/utils/well-markers-utils.js.map +1 -1
  81. package/cjs-bundle/components/OffsetWellPickerV5/components/OffsetWellPickerContent/OffsetWellPickerContent.js +1 -1
  82. package/cjs-bundle/components/OffsetWellPickerV5/components/OffsetWellPickerContent/OffsetWellPickerContent.js.map +1 -1
  83. package/cjs-bundle/components/OffsetWellPickerV5/components/OffsetWellPickerV5WithStore/components/CompanySafeguardWrapper/CompanySafeguardWrapper.js +1 -1
  84. package/cjs-bundle/components/OffsetWellPickerV5/components/OffsetWellPickerV5WithStore/components/CompanySafeguardWrapper/CompanySafeguardWrapper.js.map +1 -1
  85. package/cjs-bundle/components/OffsetWellPickerV5/hooks/use-well-data-pipeline/wellTransformations.js +1 -1
  86. package/cjs-bundle/components/OffsetWellPickerV5/hooks/use-well-data-pipeline/wellTransformations.js.map +1 -1
  87. package/cjs-bundle/components/OffsetWellPickerV5/utils/getCoordinatedWells.js +1 -1
  88. package/cjs-bundle/components/OffsetWellPickerV5/utils/getCoordinatedWells.js.map +1 -1
  89. package/cjs-bundle/components/PadOffsetsPicker/StagesSelector.js +1 -1
  90. package/cjs-bundle/components/PadOffsetsPicker/StagesSelector.js.map +1 -1
  91. package/cjs-bundle/components/PadOffsetsPickerV2/PadOffsetsPickerV2.js +1 -1
  92. package/cjs-bundle/components/PadOffsetsPickerV2/PadOffsetsPickerV2.js.map +1 -1
  93. package/cjs-bundle/componentsV2/CompletionsOffsetWellPicker/hooks/usePadsByRadius.js +1 -1
  94. package/cjs-bundle/componentsV2/CompletionsOffsetWellPicker/hooks/usePadsByRadius.js.map +1 -1
  95. package/components/AddComment/Popover.js +1 -1
  96. package/components/AddComment/Popover.js.map +1 -1
  97. package/components/AddComment/components/Content.js +1 -1
  98. package/components/AddComment/components/Content.js.map +1 -1
  99. package/components/BICOffsetPickerDialog/components/Map/Map.d.ts.map +1 -1
  100. package/components/BICOffsetPickerDialog/components/Map/Map.js +1 -1
  101. package/components/BICOffsetPickerDialog/components/Map/Map.js.map +1 -1
  102. package/components/BICOffsetPickerDialog/index.js +1 -1
  103. package/components/BICOffsetPickerDialog/index.js.map +1 -1
  104. package/components/Casing/CasingTableV2/components/CasingJoints/Editor.js +1 -1
  105. package/components/Casing/CasingTableV2/components/CasingJoints/Editor.js.map +1 -1
  106. package/components/Casing/CasingTableV2/components/Component.js +1 -1
  107. package/components/Casing/CasingTableV2/components/Component.js.map +1 -1
  108. package/components/Casing/CasingTableV2/components/DrillPipe/Editor.js +1 -1
  109. package/components/Casing/CasingTableV2/components/DrillPipe/Editor.js.map +1 -1
  110. package/components/DocumentViewer/DocumentViewer.js +1 -1
  111. package/components/DocumentViewer/DocumentViewer.js.map +1 -1
  112. package/components/Drillstring/BHAComponentsTable/components/Agitator/Editor.js +1 -1
  113. package/components/Drillstring/BHAComponentsTable/components/Agitator/Editor.js.map +1 -1
  114. package/components/Drillstring/BHAComponentsTable/components/Bit/Editor.js +1 -1
  115. package/components/Drillstring/BHAComponentsTable/components/Bit/Editor.js.map +1 -1
  116. package/components/Drillstring/BHAComponentsTable/components/Component.js +1 -1
  117. package/components/Drillstring/BHAComponentsTable/components/Component.js.map +1 -1
  118. package/components/Drillstring/BHAComponentsTable/components/DrillCollar/Editor.js +1 -1
  119. package/components/Drillstring/BHAComponentsTable/components/DrillCollar/Editor.js.map +1 -1
  120. package/components/Drillstring/BHAComponentsTable/components/DrillPipe/Editor.js +1 -1
  121. package/components/Drillstring/BHAComponentsTable/components/DrillPipe/Editor.js.map +1 -1
  122. package/components/Drillstring/BHAComponentsTable/components/Jar/Editor.js +1 -1
  123. package/components/Drillstring/BHAComponentsTable/components/Jar/Editor.js.map +1 -1
  124. package/components/Drillstring/BHAComponentsTable/components/Lwd/Editor.js +1 -1
  125. package/components/Drillstring/BHAComponentsTable/components/Lwd/Editor.js.map +1 -1
  126. package/components/Drillstring/BHAComponentsTable/components/Mwd/Editor.js +1 -1
  127. package/components/Drillstring/BHAComponentsTable/components/Mwd/Editor.js.map +1 -1
  128. package/components/Drillstring/BHAComponentsTable/components/Pdm/Editor.js +1 -1
  129. package/components/Drillstring/BHAComponentsTable/components/Pdm/Editor.js.map +1 -1
  130. package/components/Drillstring/BHAComponentsTable/components/Rss/Editor.js +1 -1
  131. package/components/Drillstring/BHAComponentsTable/components/Rss/Editor.js.map +1 -1
  132. package/components/Drillstring/BHAComponentsTable/components/Stabilizer/Editor.js +1 -1
  133. package/components/Drillstring/BHAComponentsTable/components/Stabilizer/Editor.js.map +1 -1
  134. package/components/Drillstring/BHAComponentsTable/components/Sub/Editor.js +1 -1
  135. package/components/Drillstring/BHAComponentsTable/components/Sub/Editor.js.map +1 -1
  136. package/components/Drillstring/BHAComponentsTable/components/Ur/Editor.js +1 -1
  137. package/components/Drillstring/BHAComponentsTable/components/Ur/Editor.js.map +1 -1
  138. package/components/Drillstring/BHAComponentsTable/components/shared/ConfirmationPopup.js +1 -1
  139. package/components/Drillstring/BHAComponentsTable/components/shared/ConfirmationPopup.js.map +1 -1
  140. package/components/OffsetWellMap/OffsetWellMap.d.ts.map +1 -1
  141. package/components/OffsetWellMap/OffsetWellMap.js +1 -1
  142. package/components/OffsetWellMap/OffsetWellMap.js.map +1 -1
  143. package/components/OffsetWellPickerV2/components/Filter/ToggleMapButton.js +1 -1
  144. package/components/OffsetWellPickerV2/components/Filter/ToggleMapButton.js.map +1 -1
  145. package/components/OffsetWellPickerV2/components/Map/Map.d.ts.map +1 -1
  146. package/components/OffsetWellPickerV2/components/Map/Map.js +1 -1
  147. package/components/OffsetWellPickerV2/components/Map/Map.js.map +1 -1
  148. package/components/OffsetWellPickerV2/components/Table/MetricsAddMenu.js +1 -1
  149. package/components/OffsetWellPickerV2/components/Table/MetricsAddMenu.js.map +1 -1
  150. package/components/OffsetWellPickerV2/effects/index.d.ts.map +1 -1
  151. package/components/OffsetWellPickerV2/effects/index.js +1 -1
  152. package/components/OffsetWellPickerV2/effects/index.js.map +1 -1
  153. package/components/OffsetWellPickerV3/components/CustomSelectionView/components/Map/Map.d.ts.map +1 -1
  154. package/components/OffsetWellPickerV3/components/CustomSelectionView/components/Map/Map.js +1 -1
  155. package/components/OffsetWellPickerV3/components/CustomSelectionView/components/Map/Map.js.map +1 -1
  156. package/components/OffsetWellPickerV3/components/CustomSelectionView/components/Table/MetricsAddMenu.js +1 -1
  157. package/components/OffsetWellPickerV3/components/CustomSelectionView/components/Table/MetricsAddMenu.js.map +1 -1
  158. package/components/OffsetWellPickerV3/components/CustomSelectionView/effects/index.d.ts.map +1 -1
  159. package/components/OffsetWellPickerV3/components/CustomSelectionView/effects/index.js +1 -1
  160. package/components/OffsetWellPickerV3/components/CustomSelectionView/effects/index.js.map +1 -1
  161. package/components/OffsetWellPickerV3/components/CustomSelectionView/index.js +1 -1
  162. package/components/OffsetWellPickerV3/components/CustomSelectionView/index.js.map +1 -1
  163. package/components/OffsetWellPickerV3/components/OffsetWellSelectionView/index.js +1 -1
  164. package/components/OffsetWellPickerV3/components/OffsetWellSelectionView/index.js.map +1 -1
  165. package/components/OffsetWellPickerV3/components/TabSelection/ToggleMapButton.js +1 -1
  166. package/components/OffsetWellPickerV3/components/TabSelection/ToggleMapButton.js.map +1 -1
  167. package/components/OffsetWellPickerV3/components/TabSelection/index.js +1 -1
  168. package/components/OffsetWellPickerV3/components/TabSelection/index.js.map +1 -1
  169. package/components/OffsetWellPickerV3/components/WellHubView/index.js +1 -1
  170. package/components/OffsetWellPickerV3/components/WellHubView/index.js.map +1 -1
  171. package/components/OffsetWellPickerV3/components/shared/OffsetWellTableHead.js +1 -1
  172. package/components/OffsetWellPickerV3/components/shared/OffsetWellTableHead.js.map +1 -1
  173. package/components/OffsetWellPickerV4/effects/useAdvancedWells.d.ts.map +1 -1
  174. package/components/OffsetWellPickerV4/utils/index.d.ts.map +1 -1
  175. package/components/OffsetWellPickerV5/components/Filter/components/CustomDateFields/CustomDateFields.js +1 -1
  176. package/components/OffsetWellPickerV5/components/Filter/components/CustomDateFields/CustomDateFields.js.map +1 -1
  177. package/components/OffsetWellPickerV5/components/Map/OffsetWellMap/hooks/useMapTooltipState.js +1 -1
  178. package/components/OffsetWellPickerV5/components/Map/OffsetWellMap/hooks/useMapTooltipState.js.map +1 -1
  179. package/components/OffsetWellPickerV5/components/Map/OffsetWellMap/hooks/useSelectionToolOrchestration.js +1 -1
  180. package/components/OffsetWellPickerV5/components/Map/OffsetWellMap/hooks/useSelectionToolOrchestration.js.map +1 -1
  181. package/components/OffsetWellPickerV5/components/Map/OffsetWellMap/hooks/utils/well-markers-utils.d.ts.map +1 -1
  182. package/components/OffsetWellPickerV5/components/Map/OffsetWellMap/hooks/utils/well-markers-utils.js +1 -1
  183. package/components/OffsetWellPickerV5/components/Map/OffsetWellMap/hooks/utils/well-markers-utils.js.map +1 -1
  184. package/components/OffsetWellPickerV5/components/OffsetWellPickerContent/OffsetWellPickerContent.js +1 -1
  185. package/components/OffsetWellPickerV5/components/OffsetWellPickerContent/OffsetWellPickerContent.js.map +1 -1
  186. package/components/OffsetWellPickerV5/components/OffsetWellPickerV5WithStore/components/CompanySafeguardWrapper/CompanySafeguardWrapper.js +1 -1
  187. package/components/OffsetWellPickerV5/components/OffsetWellPickerV5WithStore/components/CompanySafeguardWrapper/CompanySafeguardWrapper.js.map +1 -1
  188. package/components/OffsetWellPickerV5/hooks/use-well-data-pipeline/wellTransformations.d.ts.map +1 -1
  189. package/components/OffsetWellPickerV5/hooks/use-well-data-pipeline/wellTransformations.js +1 -1
  190. package/components/OffsetWellPickerV5/hooks/use-well-data-pipeline/wellTransformations.js.map +1 -1
  191. package/components/OffsetWellPickerV5/utils/getCoordinatedWells.d.ts.map +1 -1
  192. package/components/OffsetWellPickerV5/utils/getCoordinatedWells.js +1 -1
  193. package/components/OffsetWellPickerV5/utils/getCoordinatedWells.js.map +1 -1
  194. package/components/PadOffsetsPicker/StagesSelector.js +1 -1
  195. package/components/PadOffsetsPicker/StagesSelector.js.map +1 -1
  196. package/components/PadOffsetsPickerV2/PadOffsetsPickerV2.js +1 -1
  197. package/components/PadOffsetsPickerV2/PadOffsetsPickerV2.js.map +1 -1
  198. package/componentsV2/CompletionsOffsetWellPicker/hooks/usePadsByRadius.d.ts.map +1 -1
  199. package/componentsV2/CompletionsOffsetWellPicker/hooks/usePadsByRadius.js +1 -1
  200. package/componentsV2/CompletionsOffsetWellPicker/hooks/usePadsByRadius.js.map +1 -1
  201. package/mcp-server/server.mjs +4 -4
  202. package/package.json +1 -1
  203. package/tsconfig.tsbuildinfo +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"Map.js","sources":["../../../../../../../src/components/OffsetWellPickerV3/components/CustomSelectionView/components/Map/Map.js"],"sourcesContent":["import { createElement, memo, useRef, useEffect, useMemo, useState } from 'react';\nimport PropTypes from 'prop-types';\nimport { get, sortBy } from 'lodash';\n\nimport styles from './Map.css';\n\nimport { mapbox } from '~/utils';\nimport { createAdaptiveRoot } from '~/utils/createAdaptiveRoot';\nimport mapboxgl from '~/config/mapboxGl';\nimport { IS_MAPBOX_ENABLED } from '~/config/mapbox';\nimport 'mapbox-gl/dist/mapbox-gl.css';\n\nconst { isValidCoordinates } = mapbox;\n\nconst DEFAULT_COORDS = [29.749907, -95.358421]; // TX coordinates\nconst RADIUS_CIRCLE_COLOR = '#03BCD4';\nconst METERS_IN_MILE = 1609.34;\nconst DEFAULT_SUBJECT_WELL_MARKER_SIZE = 10;\nconst DEFAULT_WELL_MARKER_SIZE = 5;\nconst OFFSET_WELL_COLOR = '#00FFFF';\n\nconst RADIUS_CIRCLE_ID = 'radius-circle';\nconst WELLS_ID = 'wells';\nconst EMPTY_FEATURE_COLLECTION = { type: 'FeatureCollection', features: [] };\n\nconst toLngLat = ([lat, lng]) => [lng, lat];\n\n// NOTE: mapbox-gl has no geographic-radius circle primitive, so approximate it with a polygon\nconst makeCirclePolygon = ([lat, lng], radiusMeters, points = 64) => {\n const ring = [];\n const distanceX = radiusMeters / (111320 * Math.cos((lat * Math.PI) / 180));\n const distanceY = radiusMeters / 110574;\n for (let i = 0; i <= points; i += 1) {\n const theta = (i / points) * (2 * Math.PI);\n ring.push([lng + distanceX * Math.cos(theta), lat + distanceY * Math.sin(theta)]);\n }\n return ring;\n};\n\n// eslint-disable-next-line no-unused-vars\nfunction WellsMap({\n open,\n subjectWell = null,\n wells,\n offsetWells = null,\n radius,\n formationColors,\n popUpFormatter = null,\n coordsDataPath = 'settings.top_hole.coordinates',\n onAddOffsetWell,\n onDeleteOffsetWell,\n}) {\n const mapContainerRef = useRef(null);\n const mapRef = useRef();\n const radiusCircleBoundsRef = useRef(null);\n const markersBoundsRef = useRef(null);\n const popupRef = useRef(null);\n const tooltipRootRef = useRef(null);\n const tooltipContainerRef = useRef(null);\n const prevWellsRef = useRef();\n const [isMapReady, setIsMapReady] = useState(false);\n\n const subjectWellCoords = useMemo(() => {\n return subjectWell && get(subjectWell, coordsDataPath);\n }, [subjectWell, coordsDataPath]);\n\n // NOTE: Initialize map\n useEffect(() => {\n if (!IS_MAPBOX_ENABLED || !open || mapRef.current) return;\n\n mapRef.current = new mapboxgl.Map({\n container: mapContainerRef.current,\n style: 'mapbox://styles/mapbox/dark-v9',\n center: toLngLat(DEFAULT_COORDS),\n zoom: 1,\n attributionControl: false,\n scrollZoom: false,\n });\n\n mapRef.current.addControl(\n new mapboxgl.NavigationControl({ showCompass: false }),\n 'bottom-right'\n );\n\n // NOTE: Sources/layers can only be added once the style has loaded.\n // The radius circle layer is added first so well markers render above it (was bringToBack)\n mapRef.current.on('load', () => {\n mapRef.current.addSource(RADIUS_CIRCLE_ID, {\n type: 'geojson',\n data: EMPTY_FEATURE_COLLECTION,\n });\n mapRef.current.addLayer({\n id: RADIUS_CIRCLE_ID,\n type: 'fill',\n source: RADIUS_CIRCLE_ID,\n paint: {\n 'fill-color': RADIUS_CIRCLE_COLOR,\n 'fill-opacity': 0.2,\n },\n });\n\n mapRef.current.addSource(WELLS_ID, { type: 'geojson', data: EMPTY_FEATURE_COLLECTION });\n mapRef.current.addLayer({\n id: WELLS_ID,\n type: 'circle',\n source: WELLS_ID,\n layout: {\n 'circle-sort-key': ['get', 'sortKey'],\n },\n paint: {\n 'circle-radius': ['get', 'radius'],\n 'circle-color': ['get', 'color'],\n 'circle-opacity': ['get', 'opacity'],\n },\n });\n\n setIsMapReady(true);\n });\n }, [open]);\n\n useEffect(\n () => () => {\n tooltipRootRef.current?.unmount();\n tooltipRootRef.current = null;\n tooltipContainerRef.current = null;\n\n if (mapRef.current) {\n mapRef.current.remove();\n mapRef.current = null;\n radiusCircleBoundsRef.current = null;\n markersBoundsRef.current = null;\n }\n },\n []\n );\n\n // NOTE: Radius circle\n useEffect(() => {\n if (!mapRef.current || !isMapReady || !open) {\n return;\n }\n\n if (!subjectWellCoords) {\n mapRef.current.getSource(RADIUS_CIRCLE_ID).setData(EMPTY_FEATURE_COLLECTION);\n radiusCircleBoundsRef.current = null;\n return;\n }\n\n const ring = makeCirclePolygon(subjectWellCoords, radius * METERS_IN_MILE);\n mapRef.current.getSource(RADIUS_CIRCLE_ID).setData({\n type: 'Feature',\n geometry: { type: 'Polygon', coordinates: [ring] },\n });\n radiusCircleBoundsRef.current = ring.reduce(\n (bounds, coord) => bounds.extend(coord),\n new mapboxgl.LngLatBounds()\n );\n }, [radius, subjectWellCoords, open, isMapReady]);\n\n // NOTE: Well markers\n useEffect(() => {\n if (!mapRef.current || !isMapReady || !open) {\n return undefined;\n }\n\n const prevWells = prevWellsRef.current;\n prevWellsRef.current = wells;\n\n const offsetWellIds = offsetWells.map(well => well.id);\n const sortedWells = sortBy(wells, well => offsetWellIds.includes(well.id));\n\n const features = [];\n const wellsById = {};\n const bounds = new mapboxgl.LngLatBounds();\n sortedWells.forEach(well => {\n const coords = get(well, coordsDataPath);\n\n if (coords && isValidCoordinates(coords)) {\n const isWellSubject = subjectWell && subjectWell.id === well.id;\n const isWellOffset = offsetWellIds.includes(well.id);\n const r = isWellSubject ? DEFAULT_SUBJECT_WELL_MARKER_SIZE : DEFAULT_WELL_MARKER_SIZE;\n const color =\n isWellSubject || isWellOffset\n ? OFFSET_WELL_COLOR\n : get(formationColors, well.formation, '#BDBDBD');\n const opacity = isWellSubject || isWellOffset ? 1 : 0.3;\n\n wellsById[well.id] = well;\n bounds.extend(toLngLat(coords));\n features.push({\n type: 'Feature',\n geometry: { type: 'Point', coordinates: toLngLat(coords) },\n // NOTE: sortKey keeps offset wells rendered on top (was sortedWells insertion order)\n properties: { wellId: well.id, radius: r, color, opacity, sortKey: isWellOffset ? 1 : 0 },\n });\n }\n });\n\n mapRef.current.getSource(WELLS_ID).setData({ type: 'FeatureCollection', features });\n markersBoundsRef.current = features.length ? bounds : null;\n\n const map = mapRef.current;\n let hoveredWellId = null;\n\n const handleMouseMove = e => {\n map.getCanvas().style.cursor = 'pointer';\n\n const well = wellsById[e.features[0].properties.wellId];\n if (!well || well.id === hoveredWellId) {\n return;\n }\n hoveredWellId = well.id;\n\n if (popUpFormatter) {\n const popUpContent = createElement(popUpFormatter, {\n well,\n color: get(formationColors, well.formation, '#BDBDBD'),\n });\n // NOTE: Custom popup may have buttons. Reuse a single container/root and update its content.\n if (!tooltipContainerRef.current) {\n tooltipContainerRef.current = document.createElement('div');\n tooltipRootRef.current = createAdaptiveRoot(tooltipContainerRef.current);\n }\n tooltipRootRef.current.render(<>{popUpContent}</>);\n\n if (!popupRef.current) {\n popupRef.current = new mapboxgl.Popup({ closeButton: false, maxWidth: 'none' });\n }\n popupRef.current\n .setLngLat(toLngLat(get(well, coordsDataPath)))\n .setDOMContent(tooltipContainerRef.current)\n .addTo(map);\n }\n };\n\n const handleMouseLeave = () => {\n hoveredWellId = null;\n map.getCanvas().style.cursor = '';\n popupRef.current?.remove();\n };\n\n const handleClick = e => {\n const { wellId } = e.features[0].properties;\n const isWellSubject = subjectWell && subjectWell.id === wellId;\n const isWellOffset = offsetWellIds.includes(wellId);\n\n if (isWellOffset && !isWellSubject) {\n onDeleteOffsetWell(wellId);\n } else {\n onAddOffsetWell(wellId);\n }\n };\n\n map.on('mousemove', WELLS_ID, handleMouseMove);\n map.on('mouseleave', WELLS_ID, handleMouseLeave);\n map.on('click', WELLS_ID, handleClick);\n\n setTimeout(() => {\n if (mapRef.current && radiusCircleBoundsRef.current && wells !== prevWells) {\n mapRef.current.fitBounds(radiusCircleBoundsRef.current, { padding: 5 });\n }\n }, 500);\n\n return () => {\n map.off('mousemove', WELLS_ID, handleMouseMove);\n map.off('mouseleave', WELLS_ID, handleMouseLeave);\n map.off('click', WELLS_ID, handleClick);\n };\n }, [subjectWell, wells, offsetWells, open, isMapReady]);\n\n useEffect(() => {\n if (!open) return;\n\n setTimeout(() => {\n if (subjectWell) {\n if (mapRef.current && radiusCircleBoundsRef.current) {\n mapRef.current.fitBounds(radiusCircleBoundsRef.current, {\n padding: 5,\n });\n }\n } else if (mapRef.current && markersBoundsRef.current) {\n mapRef.current.fitBounds(markersBoundsRef.current);\n }\n }, 500);\n }, [radius, subjectWell, open, isMapReady]);\n\n return (\n <div className={styles.map}>\n <div className={styles.mapMain} ref={mapContainerRef} />\n </div>\n );\n}\n\nWellsMap.propTypes = {\n open: PropTypes.bool.isRequired,\n subjectWell: PropTypes.shape({\n id: PropTypes.number,\n formation: PropTypes.string,\n }),\n wells: PropTypes.arrayOf(PropTypes.shape({})).isRequired,\n offsetWells: PropTypes.arrayOf(PropTypes.shape({})),\n radius: PropTypes.number.isRequired,\n formationColors: PropTypes.shape({}).isRequired,\n popUpFormatter: PropTypes.func,\n coordsDataPath: PropTypes.string,\n onAddOffsetWell: PropTypes.func.isRequired,\n onDeleteOffsetWell: PropTypes.func.isRequired,\n};\n\nexport default memo(WellsMap);\n"],"names":["isValidCoordinates","mapbox","DEFAULT_COORDS","EMPTY_FEATURE_COLLECTION","type","features","toLngLat","_ref","_ref2","_slicedToArray","lat","WellsMap","_ref5","open","_ref5$subjectWell","subjectWell","wells","_ref5$offsetWells","offsetWells","radius","formationColors","_ref5$popUpFormatter","popUpFormatter","_ref5$coordsDataPath","coordsDataPath","onAddOffsetWell","onDeleteOffsetWell","mapContainerRef","useRef","mapRef","radiusCircleBoundsRef","markersBoundsRef","popupRef","tooltipRootRef","tooltipContainerRef","prevWellsRef","useState","_useState2","_useState","isMapReady","setIsMapReady","subjectWellCoords","useMemo","get","useEffect","IS_MAPBOX_ENABLED","current","mapboxgl","Map","container","style","center","zoom","attributionControl","scrollZoom","addControl","NavigationControl","showCompass","on","addSource","data","addLayer","id","source","paint","layout","_tooltipRootRef$curre","unmount","remove","getSource","setData","ring","_ref3","radiusMeters","_ref4","lng","points","distanceX","Math","cos","PI","distanceY","i","theta","push","sin","makeCirclePolygon","geometry","coordinates","reduce","bounds","coord","extend","LngLatBounds","prevWells","offsetWellIds","map","well","sortedWells","sortBy","includes","wellsById","forEach","coords","isWellSubject","isWellOffset","r","color","formation","opacity","properties","wellId","sortKey","length","hoveredWellId","handleMouseMove","e","getCanvas","cursor","popUpContent","createElement","document","createAdaptiveRoot","render","_jsx","_Fragment","children","Popup","closeButton","maxWidth","setLngLat","setDOMContent","addTo","handleMouseLeave","_popupRef$current","handleClick","setTimeout","fitBounds","padding","off","className","styles","mapMain","ref","propTypes","PropTypes","bool","isRequired","shape","number","string","arrayOf","func","memo"],"mappings":"0nBAYA,IAAQA,EAAuBC,EAAvBD,mBAEFE,EAAiB,CAAC,WAAY,WAS9BC,EAA2B,CAAEC,KAAM,oBAAqBC,SAAU,IAElEC,EAAW,SAAHC,GAAA,IAAAC,EAAAC,EAAAF,EAAA,GAAKG,EAAGF,EAAA,GAAK,MAAM,CAANA,EAAA,GAAYE,EAAI,EAe3C,SAASC,EAWNC,GAAA,IAVDC,IAAAA,KAAIC,EAAAF,EACJG,YAAAA,aAAc,KAAID,EAClBE,IAAAA,MAAKC,EAAAL,EACLM,YAAAA,aAAc,KAAID,EAClBE,IAAAA,OACAC,IAAAA,gBAAeC,EAAAT,EACfU,eAAAA,aAAiB,KAAID,EAAAE,EAAAX,EACrBY,eAAAA,aAAiB,gCAA+BD,EAChDE,IAAAA,gBACAC,IAAAA,mBAEMC,EAAkBC,EAAO,MACzBC,EAASD,IACTE,EAAwBF,EAAO,MAC/BG,EAAmBH,EAAO,MAC1BI,EAAWJ,EAAO,MAClBK,EAAiBL,EAAO,MACxBM,EAAsBN,EAAO,MAC7BO,EAAeP,IAC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iBe,QAE7C,GAAE,IACJ,GAAE,CAAC3B,EAAQJ,EAAaF,EAAM0B,IAG7BqF,EAAA,MAAA,CAAKgB,UAAWC,EAAO7C,IAAI8B,SACzBF,EAAA,MAAA,CAAKgB,UAAWC,EAAOC,QAASC,IAAKpH,KAG3C,CAEAhB,EAASqI,UAAY,CACnBnI,KAAMoI,EAAUC,KAAKC,WACrBpI,YAAakI,EAAUG,MAAM,CAC3BtF,GAAImF,EAAUI,OACdzC,UAAWqC,EAAUK,SAEvBtI,MAAOiI,EAAUM,QAAQN,EAAUG,MAAM,CAAA,IAAKD,WAC9CjI,YAAa+H,EAAUM,QAAQN,EAAUG,MAAM,CAAE,IACjDjI,OAAQ8H,EAAUI,OAAOF,WACzB/H,gBAAiB6H,EAAUG,MAAM,CAAA,GAAID,WACrC7H,eAAgB2H,EAAUO,KAC1BhI,eAAgByH,EAAUK,OAC1B7H,gBAAiBwH,EAAUO,KAAKL,WAChCzH,mBAAoBuH,EAAUO,KAAKL,YAGrC,IAAeM,EAAAA,EAAK9I"}
1
+ {"version":3,"file":"Map.js","sources":["../../../../../../../src/components/OffsetWellPickerV3/components/CustomSelectionView/components/Map/Map.js"],"sourcesContent":["import { createElement, memo, useRef, useEffect, useMemo, useState } from 'react';\nimport PropTypes from 'prop-types';\nimport { get, sortBy } from 'lodash';\n\nimport styles from './Map.css';\n\nimport { mapbox } from '~/utils';\nimport { createAdaptiveRoot } from '~/utils/createAdaptiveRoot';\nimport mapboxgl from '~/config/mapboxGl';\nimport { IS_MAPBOX_ENABLED } from '~/config/mapbox';\nimport 'mapbox-gl/dist/mapbox-gl.css';\n\nconst DEFAULT_COORDS = [29.749907, -95.358421]; // TX coordinates\nconst RADIUS_CIRCLE_COLOR = '#03BCD4';\nconst METERS_IN_MILE = 1609.34;\nconst DEFAULT_SUBJECT_WELL_MARKER_SIZE = 10;\nconst DEFAULT_WELL_MARKER_SIZE = 5;\nconst OFFSET_WELL_COLOR = '#00FFFF';\n\nconst RADIUS_CIRCLE_ID = 'radius-circle';\nconst WELLS_ID = 'wells';\nconst EMPTY_FEATURE_COLLECTION = { type: 'FeatureCollection', features: [] };\n\nconst toLngLat = ([lat, lng]) => [lng, lat];\n\n// NOTE: mapbox-gl has no geographic-radius circle primitive, so approximate it with a polygon\nconst makeCirclePolygon = ([lat, lng], radiusMeters, points = 64) => {\n const ring = [];\n const distanceX = radiusMeters / (111320 * Math.cos((lat * Math.PI) / 180));\n const distanceY = radiusMeters / 110574;\n for (let i = 0; i <= points; i += 1) {\n const theta = (i / points) * (2 * Math.PI);\n ring.push([lng + distanceX * Math.cos(theta), lat + distanceY * Math.sin(theta)]);\n }\n return ring;\n};\n\n// eslint-disable-next-line no-unused-vars\nfunction WellsMap({\n open,\n subjectWell = null,\n wells,\n offsetWells = null,\n radius,\n formationColors,\n popUpFormatter = null,\n coordsDataPath = 'settings.top_hole.coordinates',\n onAddOffsetWell,\n onDeleteOffsetWell,\n}) {\n const mapContainerRef = useRef(null);\n const mapRef = useRef();\n const radiusCircleBoundsRef = useRef(null);\n const markersBoundsRef = useRef(null);\n const popupRef = useRef(null);\n const tooltipRootRef = useRef(null);\n const tooltipContainerRef = useRef(null);\n const prevWellsRef = useRef();\n const [isMapReady, setIsMapReady] = useState(false);\n\n const subjectWellCoords = useMemo(() => {\n return subjectWell && get(subjectWell, coordsDataPath);\n }, [subjectWell, coordsDataPath]);\n\n // NOTE: Initialize map\n useEffect(() => {\n if (!IS_MAPBOX_ENABLED || !open || mapRef.current) return;\n\n mapRef.current = new mapboxgl.Map({\n container: mapContainerRef.current,\n style: 'mapbox://styles/mapbox/dark-v9',\n center: toLngLat(DEFAULT_COORDS),\n zoom: 1,\n attributionControl: false,\n scrollZoom: false,\n });\n\n mapRef.current.addControl(\n new mapboxgl.NavigationControl({ showCompass: false }),\n 'bottom-right'\n );\n\n // NOTE: Sources/layers can only be added once the style has loaded.\n // The radius circle layer is added first so well markers render above it (was bringToBack)\n mapRef.current.on('load', () => {\n mapRef.current.addSource(RADIUS_CIRCLE_ID, {\n type: 'geojson',\n data: EMPTY_FEATURE_COLLECTION,\n });\n mapRef.current.addLayer({\n id: RADIUS_CIRCLE_ID,\n type: 'fill',\n source: RADIUS_CIRCLE_ID,\n paint: {\n 'fill-color': RADIUS_CIRCLE_COLOR,\n 'fill-opacity': 0.2,\n },\n });\n\n mapRef.current.addSource(WELLS_ID, { type: 'geojson', data: EMPTY_FEATURE_COLLECTION });\n mapRef.current.addLayer({\n id: WELLS_ID,\n type: 'circle',\n source: WELLS_ID,\n layout: {\n 'circle-sort-key': ['get', 'sortKey'],\n },\n paint: {\n 'circle-radius': ['get', 'radius'],\n 'circle-color': ['get', 'color'],\n 'circle-opacity': ['get', 'opacity'],\n },\n });\n\n setIsMapReady(true);\n });\n }, [open]);\n\n useEffect(\n () => () => {\n tooltipRootRef.current?.unmount();\n tooltipRootRef.current = null;\n tooltipContainerRef.current = null;\n\n if (mapRef.current) {\n mapRef.current.remove();\n mapRef.current = null;\n radiusCircleBoundsRef.current = null;\n markersBoundsRef.current = null;\n }\n },\n []\n );\n\n // NOTE: Radius circle\n useEffect(() => {\n if (!mapRef.current || !isMapReady || !open) {\n return;\n }\n\n if (!subjectWellCoords) {\n mapRef.current.getSource(RADIUS_CIRCLE_ID).setData(EMPTY_FEATURE_COLLECTION);\n radiusCircleBoundsRef.current = null;\n return;\n }\n\n const ring = makeCirclePolygon(subjectWellCoords, radius * METERS_IN_MILE);\n mapRef.current.getSource(RADIUS_CIRCLE_ID).setData({\n type: 'Feature',\n geometry: { type: 'Polygon', coordinates: [ring] },\n });\n radiusCircleBoundsRef.current = ring.reduce(\n (bounds, coord) => bounds.extend(coord),\n new mapboxgl.LngLatBounds()\n );\n }, [radius, subjectWellCoords, open, isMapReady]);\n\n // NOTE: Well markers\n useEffect(() => {\n if (!mapRef.current || !isMapReady || !open) {\n return undefined;\n }\n\n const prevWells = prevWellsRef.current;\n prevWellsRef.current = wells;\n\n const offsetWellIds = offsetWells.map(well => well.id);\n const sortedWells = sortBy(wells, well => offsetWellIds.includes(well.id));\n\n const features = [];\n const wellsById = {};\n const bounds = new mapboxgl.LngLatBounds();\n sortedWells.forEach(well => {\n const coords = get(well, coordsDataPath);\n\n if (coords && mapbox.isValidCoordinates(coords)) {\n const isWellSubject = subjectWell && subjectWell.id === well.id;\n const isWellOffset = offsetWellIds.includes(well.id);\n const r = isWellSubject ? DEFAULT_SUBJECT_WELL_MARKER_SIZE : DEFAULT_WELL_MARKER_SIZE;\n const color =\n isWellSubject || isWellOffset\n ? OFFSET_WELL_COLOR\n : get(formationColors, well.formation, '#BDBDBD');\n const opacity = isWellSubject || isWellOffset ? 1 : 0.3;\n\n wellsById[well.id] = well;\n bounds.extend(toLngLat(coords));\n features.push({\n type: 'Feature',\n geometry: { type: 'Point', coordinates: toLngLat(coords) },\n // NOTE: sortKey keeps offset wells rendered on top (was sortedWells insertion order)\n properties: { wellId: well.id, radius: r, color, opacity, sortKey: isWellOffset ? 1 : 0 },\n });\n }\n });\n\n mapRef.current.getSource(WELLS_ID).setData({ type: 'FeatureCollection', features });\n markersBoundsRef.current = features.length ? bounds : null;\n\n const map = mapRef.current;\n let hoveredWellId = null;\n\n const handleMouseMove = e => {\n map.getCanvas().style.cursor = 'pointer';\n\n const well = wellsById[e.features[0].properties.wellId];\n if (!well || well.id === hoveredWellId) {\n return;\n }\n hoveredWellId = well.id;\n\n if (popUpFormatter) {\n const popUpContent = createElement(popUpFormatter, {\n well,\n color: get(formationColors, well.formation, '#BDBDBD'),\n });\n // NOTE: Custom popup may have buttons. Reuse a single container/root and update its content.\n if (!tooltipContainerRef.current) {\n tooltipContainerRef.current = document.createElement('div');\n tooltipRootRef.current = createAdaptiveRoot(tooltipContainerRef.current);\n }\n tooltipRootRef.current.render(<>{popUpContent}</>);\n\n if (!popupRef.current) {\n popupRef.current = new mapboxgl.Popup({ closeButton: false, maxWidth: 'none' });\n }\n popupRef.current\n .setLngLat(toLngLat(get(well, coordsDataPath)))\n .setDOMContent(tooltipContainerRef.current)\n .addTo(map);\n }\n };\n\n const handleMouseLeave = () => {\n hoveredWellId = null;\n map.getCanvas().style.cursor = '';\n popupRef.current?.remove();\n };\n\n const handleClick = e => {\n const { wellId } = e.features[0].properties;\n const isWellSubject = subjectWell && subjectWell.id === wellId;\n const isWellOffset = offsetWellIds.includes(wellId);\n\n if (isWellOffset && !isWellSubject) {\n onDeleteOffsetWell(wellId);\n } else {\n onAddOffsetWell(wellId);\n }\n };\n\n map.on('mousemove', WELLS_ID, handleMouseMove);\n map.on('mouseleave', WELLS_ID, handleMouseLeave);\n map.on('click', WELLS_ID, handleClick);\n\n setTimeout(() => {\n if (mapRef.current && radiusCircleBoundsRef.current && wells !== prevWells) {\n mapRef.current.fitBounds(radiusCircleBoundsRef.current, { padding: 5 });\n }\n }, 500);\n\n return () => {\n map.off('mousemove', WELLS_ID, handleMouseMove);\n map.off('mouseleave', WELLS_ID, handleMouseLeave);\n map.off('click', WELLS_ID, handleClick);\n };\n }, [subjectWell, wells, offsetWells, open, isMapReady]);\n\n useEffect(() => {\n if (!open) return;\n\n setTimeout(() => {\n if (subjectWell) {\n if (mapRef.current && radiusCircleBoundsRef.current) {\n mapRef.current.fitBounds(radiusCircleBoundsRef.current, {\n padding: 5,\n });\n }\n } else if (mapRef.current && markersBoundsRef.current) {\n mapRef.current.fitBounds(markersBoundsRef.current);\n }\n }, 500);\n }, [radius, subjectWell, open, isMapReady]);\n\n return (\n <div className={styles.map}>\n <div className={styles.mapMain} ref={mapContainerRef} />\n </div>\n );\n}\n\nWellsMap.propTypes = {\n open: PropTypes.bool.isRequired,\n subjectWell: PropTypes.shape({\n id: PropTypes.number,\n formation: PropTypes.string,\n }),\n wells: PropTypes.arrayOf(PropTypes.shape({})).isRequired,\n offsetWells: PropTypes.arrayOf(PropTypes.shape({})),\n radius: PropTypes.number.isRequired,\n formationColors: PropTypes.shape({}).isRequired,\n popUpFormatter: PropTypes.func,\n coordsDataPath: PropTypes.string,\n onAddOffsetWell: PropTypes.func.isRequired,\n onDeleteOffsetWell: PropTypes.func.isRequired,\n};\n\nexport default memo(WellsMap);\n"],"names":["DEFAULT_COORDS","EMPTY_FEATURE_COLLECTION","type","features","toLngLat","_ref","_ref2","_slicedToArray","lat","WellsMap","_ref5","open","_ref5$subjectWell","subjectWell","wells","_ref5$offsetWells","offsetWells","radius","formationColors","_ref5$popUpFormatter","popUpFormatter","_ref5$coordsDataPath","coordsDataPath","onAddOffsetWell","onDeleteOffsetWell","mapContainerRef","useRef","mapRef","radiusCircleBoundsRef","markersBoundsRef","popupRef","tooltipRootRef","tooltipContainerRef","prevWellsRef","useState","_useState2","_useState","isMapReady","setIsMapReady","subjectWellCoords","useMemo","get","useEffect","IS_MAPBOX_ENABLED","current","mapboxgl","Map","container","style","center","zoom","attributionControl","scrollZoom","addControl","NavigationControl","showCompass","on","addSource","data","addLayer","id","source","paint","layout","_tooltipRootRef$curre","unmount","remove","getSource","setData","ring","_ref3","radiusMeters","_ref4","lng","points","distanceX","Math","cos","PI","distanceY","i","theta","push","sin","makeCirclePolygon","geometry","coordinates","reduce","bounds","coord","extend","LngLatBounds","prevWells","offsetWellIds","map","well","sortedWells","sortBy","includes","wellsById","forEach","coords","mapbox","isValidCoordinates","isWellSubject","isWellOffset","r","color","formation","opacity","properties","wellId","sortKey","length","hoveredWellId","handleMouseMove","e","getCanvas","cursor","popUpContent","createElement","document","createAdaptiveRoot","render","_jsx","_Fragment","children","Popup","closeButton","maxWidth","setLngLat","setDOMContent","addTo","handleMouseLeave","_popupRef$current","handleClick","setTimeout","fitBounds","padding","off","className","styles","mapMain","ref","propTypes","PropTypes","bool","isRequired","shape","number","string","arrayOf","func","memo"],"mappings":"0nBAYA,IAAMA,EAAiB,CAAC,WAAY,WAS9BC,EAA2B,CAAEC,KAAM,oBAAqBC,SAAU,IAElEC,EAAW,SAAHC,GAAA,IAAAC,EAAAC,EAAAF,EAAA,GAAKG,EAAGF,EAAA,GAAK,MAAM,CAANA,EAAA,GAAYE,E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AAQ6F,UAAU7G,EAAsBgB,QAAS,CAAE8F,QAAS,GAEtE,GAAE,KAEI,WACL5C,EAAI6C,IAAI,YAlPG,QAkPoBxB,GAC/BrB,EAAI6C,IAAI,aAnPG,QAmPqBN,GAChCvC,EAAI6C,IAAI,QApPG,QAoPgBJ,GAvG7B,CAyGF,GAAG,CAAC1H,EAAaC,EAAOE,EAAaL,EAAM0B,IAE3CK,GAAU,WACH/B,GAEL6H,YAAW,WACL3H,EACEc,EAAOiB,SAAWhB,EAAsBgB,SAC1CjB,EAAOiB,QAAQ6F,UAAU7G,EAAsBgB,QAAS,CACtD8F,QAAS,IAGJ/G,EAAOiB,SAAWf,EAAiBe,SAC5CjB,EAAOiB,QAAQ6F,UAAU5G,EAAiBe,QAE7C,GAAE,IACJ,GAAE,CAAC3B,EAAQJ,EAAaF,EAAM0B,IAG7BuF,EAAA,MAAA,CAAKgB,UAAWC,EAAO/C,IAAIgC,SACzBF,EAAA,MAAA,CAAKgB,UAAWC,EAAOC,QAASC,IAAKtH,KAG3C,CAEAhB,EAASuI,UAAY,CACnBrI,KAAMsI,EAAUC,KAAKC,WACrBtI,YAAaoI,EAAUG,MAAM,CAC3BxF,GAAIqF,EAAUI,OACdzC,UAAWqC,EAAUK,SAEvBxI,MAAOmI,EAAUM,QAAQN,EAAUG,MAAM,CAAA,IAAKD,WAC9CnI,YAAaiI,EAAUM,QAAQN,EAAUG,MAAM,CAAE,IACjDnI,OAAQgI,EAAUI,OAAOF,WACzBjI,gBAAiB+H,EAAUG,MAAM,CAAA,GAAID,WACrC/H,eAAgB6H,EAAUO,KAC1BlI,eAAgB2H,EAAUK,OAC1B/H,gBAAiB0H,EAAUO,KAAKL,WAChC3H,mBAAoByH,EAAUO,KAAKL,YAGrC,IAAeM,EAAAA,EAAKhJ"}
@@ -1,2 +1,2 @@
1
- import e from"@babel/runtime/helpers/slicedToArray";import{useState as o,useEffect as t}from"react";import s from"prop-types";import{withStyles as i,Menu as n,MenuItem as r,Checkbox as p,ListItemText as m}from"@material-ui/core";import c from"@material-ui/icons/Settings";import{isEqual as a}from"lodash";import{METRICS_LIST as l,MAX_METRICS_COUNT as d}from"../../constants.js";import"@babel/runtime/helpers/defineProperty";import"../../../../../DevCenter/DevCenterAppContainer/components/IsInsideIsolatedDcAppProvider.js";import"../../../../../DevCenter/DevCenterAppContainer/components/DcFullscreenElemsCoordinatorProvider/DcFullscreenElemsCoordinatorProvider.js";import"../../../../../DevCenter/DevCenterAppContainer/components/DcFullscreenElemsCoordinatorProvider/IsInsideDcFullscreenElemProvider.js";import"@babel/runtime/helpers/objectWithoutProperties";import"classnames";import"../../../../../Modal/CorvaModal.scss.js";import"@icon-park/react/es/all";import{jsxs as j,Fragment as u,jsx as C}from"react/jsx-runtime";import"../../../../../../icons/IconParkProvider.js";import"../../../../../../icons/customIcons/icons/AddMessage.js";import"../../../../../../icons/customIcons/icons/DragOne.js";import"../../../../../../icons/customIcons/icons/Attention.js";import"../../../../../../icons/customIcons/icons/Collapse.js";import"../../../../../../icons/customIcons/icons/Dashboard.js";import"../../../../../../icons/customIcons/icons/Expand.js";import"../../../../../../icons/customIcons/icons/FolderClosed.js";import"../../../../../../icons/customIcons/icons/FolderClosedFilled.js";import"../../../../../../icons/customIcons/icons/FolderOpened.js";import"../../../../../../icons/customIcons/icons/GreaterOrEqual.js";import"../../../../../../icons/customIcons/icons/LessOrEqual.js";import"../../../../../../icons/customIcons/icons/Search.js";import"../../../../../../icons/customIcons/icons/SearchOne.js";import"../../../../../../icons/customIcons/icons/Wellhub.js";import"../../../../../../icons/customIcons/icons/MultiRuler.js";import"../../../../../../icons/customIcons/icons/Checkbox.js";import"../../../../../../icons/customIcons/icons/CheckboxChecked.js";import"../../../../../../icons/customIcons/icons/CheckboxIndeterminate.js";import"../../../../../../icons/customIcons/icons/Radio.js";import"../../../../../../icons/customIcons/icons/RadioChecked.js";import"../../../../../../icons/customIcons/icons/SimulFrac.js";import"../../../../../../icons/customIcons/icons/ZipperFrac.js";import"../../../../../../icons/customIcons/icons/CautionFilled.js";import"../../../../../../icons/customIcons/icons/InfoRounded.js";import"../../../../../../icons/customIcons/icons/FlameFilled.js";import"../../../../../../icons/customIcons/icons/MoreApp.js";import"../../../../../../icons/customIcons/icons/Pad.js";import"../../../../../../icons/customIcons/icons/DrilloutUnit.js";import"../../../../../../icons/customIcons/icons/FracFleet.js";import"../../../../../../icons/customIcons/icons/Global.js";import"../../../../../../icons/customIcons/icons/Program.js";import"../../../../../../icons/customIcons/icons/Rig.js";import"../../../../../../icons/customIcons/icons/Well.js";import"../../../../../../icons/customIcons/icons/Gap.js";import"../../../../../../icons/customIcons/icons/Pin.js";import"../../../../../../icons/customIcons/icons/CloseOneFilled.js";import"../../../../../../icons/customIcons/icons/AttentionFilled.js";import"../../../../../../icons/customIcons/icons/CheckOneFilled.js";import"../../../../../../icons/customIcons/icons/Archive.js";import"../../../../../../icons/customIcons/icons/ArchiveCancel.js";import"../../../../../../icons/customIcons/icons/Unarchive.js";import"../../../../../../icons/customIcons/icons/Archived.js";import"../../../../../../icons/customIcons/icons/InterventionUnit.js";import"../../../../../../icons/customIcons/icons/CloudDelete.js";import"../../../../../../icons/customIcons/icons/Lasso.js";import"../../../../../../icons/customIcons/icons/Radius.js";import"../../../../../../icons/customIcons/icons/ErrorOps.js";import"../../../../../../icons/customIcons/icons/DataTypeOps.js";import"../../../../../../icons/customIcons/icons/FalsePositiveOps.js";import"../../../../../../icons/customIcons/icons/CalibrationOps.js";import"../../../../../../icons/customIcons/icons/CriticalOps.js";import"../../../../../../icons/customIcons/icons/Company.js";import"../../../../../../icons/customIcons/icons/ArchiveOne.js";import"../../../../../../icons/customIcons/icons/ParseBotFusion.js";import"../../../../../../icons/customIcons/icons/Connect.js";import"../../../../../../icons/customIcons/icons/PuzzleOne.js";import"../../../../../../icons/customIcons/icons/Feed.js";import"../../../../../../icons/customIcons/icons/Prompt.js";import"../../../../../../icons/customIcons/icons/Companies.js";import"../../../../../../icons/customIcons/icons/ClipboardAi.js";import"../../../../../../icons/customIcons/icons/Key.js";import"../../../../../../icons/customIcons/icons/AtSignCrossed.js";import"../../../../../../icons/customIcons/icons/MappingManual.js";import"../../../../../../icons/customIcons/icons/Mapping.js";import"../../../../../../icons/customIcons/icons/Metrics.js";import"../../../../../../icons/customIcons/icons/Drops.js";import"../../../../../../icons/customIcons/icons/ClipboardSearch.js";import"../../../../../../icons/customIcons/icons/Template.js";import"../../../../../../icons/customIcons/icons/ClipboardMetrics.js";import"../../../../../../icons/customIcons/icons/ClipboardBuilder.js";import"../../../../../../icons/customIcons/icons/UnitConversion.js";import"../../../../../../icons/customIcons/icons/NPT.js";import"../../../../../../icons/customIcons/icons/GuidedFrac.js";import"../../../../../../utils/mobileDetect.js";import I from"../../../../../IconButton/index.js";import"../../../../../../constants/goals.js";import"../../../../../../constants/segment.js";import"../../../../../../constants/alerts.js";import"../../../../../../constants/apps.js";import"../../../../../../constants/drillstring.js";import"../../../../../../constants/completion.js";import"../../../../../../constants/appPackages.js";import"../../../../../../constants/notifications.js";import"../../../../../../constants/feed.js";import"../../../../../../constants/bha.js";import"../../../../../../constants/corvaCompanyId.js";import"../../../../../GradientManager/configuration/constants.js";import"uuid";import"../../../../../IconMenu/index.js";import"../../../../../StyledMenuItem/index.js";import"../../../../../AppIcon/AppIcon.js";import"../../../../../DevCenter/AppHeader/AppHeader.js";import"../../../../../DevCenter/AppSideBar/AppSideBar.js";import"../../../../../DevCenter/AppsDataProvider/AppsDataProvider.js";import"../../../../../DevCenter/AppContext.js";import"../../../../../DevCenter/DevCenterRouterContext/DevCenterRouterContext.js";import"../../../../../DevCenter/DevCenterRouterContext/UniversalLink/UniversalLink.js";import"react-router-dom";import"query-string";import"@babel/runtime/helpers/asyncToGenerator";import"@babel/runtime/regenerator";import"../../../../../../utils/index.js";import"@material-ui/icons";import"../../../../../EmptyState/EmptyState.js";import"../../../../../DevCenter/DevCenterAppContainer/components/AppSettingsDialog/components/RemoveAppButton.js";import"../../../../../DevCenter/DevCenterAppContainer/components/AppSettingsDialog/components/SettingsAccordion.js";import"../../../../../DevCenter/DevCenterAppContainer/components/AppSettingsDialog/styles.js";import"@material-ui/pickers";import"@date-io/moment";import"moment";import"../../../../../../config/theme/index.js";import"../../../../../../hocs/withAssetEditorLockHOC.js";import"../../../../../ErrorBoundary/ErrorBoundary.js";import"../../../../../ErrorBoundary/DevCenterAppErrorView/DevCenterAppErrorView.js";import"../../../../../Button/components/Button/index.js";import"moment-timezone";import"../../../../../Button/components/LiveButton/components/LiveButtonStateIndicator/index.js";import"../../../../../Button/components/LiveButton/styles.js";import"../../../../../AssetEditorV2/index.js";import"../../../../../AppVersionsSelect/AppVersionsSelect.js";import"../../../../../DisabledSettingsMessage/DisabledSettingsMessage.js";import"../../../../../ConfirmationDialog.js";import"immutable";import"../../../../../../permissions/PermissionsContext.js";import"../../../../../../permissions/constants/index.js";import"../../../../../../permissions/withPermissionsHOC.js";import"../../../../../../clients/jsonApi/index.js";import"../../../../../../permissions/ProvidePermissions.js";import"../../../../../../componentsV2/AppHeader/V3/VersionSelect/VersionSelect.constants.js";import"../../../../../Annotations/components/AnnotationsList/index.js";import"../../../../../Annotations/components/LastAnnotation/index.js";import"../../../../../Annotations/AnnotationsContext.js";import"../../../../../../componentsV2/AppContainer/AppContainer.js";import"../../../../../../componentsV2/AppContainer/AppContainer.constants.js";import"../../../../../../componentsV2/Text/Text.js";import"../../../../../../componentsV2/Header/Header.scss.js";import"../../../../../../componentsV2/Tooltip/Tooltip.scss.js";import"../../../../../../componentsV2/TextEndTruncated/TextEndTruncated.scss.js";import"../../../../../../componentsV2/AppCommonsProvider/AppCommonsContext.js";import"../../../../../../componentsV2/AppHeader/AppHeader.constants.js";import"../../../../../../componentsV2/AppHeader/AppBadge/AppBadge.scss.js";import"../../../../../../componentsV2/Chip/Chip.js";import"../../../../../../componentsV2/TextMiddleTruncated/TextMiddleTruncated.constants.js";import"../../../../../../componentsV2/TextMiddleTruncated/TextMiddleTruncated.scss.js";import"../../../../../../componentsV2/AppHeader/AppAssets/utils.js";import"../../../../../../componentsV2/AppHeader/AppAssets/AppAssets.scss.js";import"../../../../../PadModeSelect/PadModeSelect.js";import"../../../../../../componentsV2/AppHeader/PadMode/PadMode.scss.js";import"../../../../../../constants/streamSourceType.js";import"../../../../../../componentsV2/PadModeSelect/PadModeSelect.js";import"../../../../../../componentsV2/PadModeSelect/PadModeSelect.constants.js";import"../../../../../../componentsV2/AppCommonsProvider/AppCommonsProvider.js";import"../../../../../../componentsV2/utils.js";import"../../../../../../componentsV2/AppHeader/V3/VersionSelect/VersionSelect.js";import"../../../../../../componentsV2/UniversalLink/UniversalLink.scss.js";import"../../../../../../componentsV2/AppHeader/V3/AssetChips/AssetChips.scss.js";import"../../../../../../componentsV2/Button/Button.js";import"../../../../../../componentsV2/AppHeader/V3/DqStatusIcon/DqStatusIcon.js";import"../../../../../../componentsV2/AppHeader/V3/DqStatusIcon/DqStatusIcon.constants.js";import"../../../../../../componentsV2/Popover/Popover.js";import"@babel/runtime/helpers/toConsumableArray";import"../../../../../../componentsV2/Accordion/Accordion.scss.js";import"../../../../../../componentsV2/ButtonIcon/ButtonIcon.js";import"../../../../../../componentsV2/AppFooter/DqPopover/DqStatusIcon/DqStatusIcon.js";import"../../../../../../componentsV2/AppDqPopover/DqAlertTooltip/DqAlertTooltip.scss.js";import"../../../../../../componentsV2/AppDqPopover/DqAlert/DqAlert.scss.js";import"../../../../../../componentsV2/AppDqPopover/DqAsset/DqAsset.scss.js";import"../../../../../../componentsV2/AppDqPopover/AppDqPopover.scss.js";import"../../../../../../componentsV2/Menu/Menu.js";import"../../../../../../componentsV2/ModalWindow/ModalWindow.js";import"../../../../../../componentsV2/Modal/Modal.scss.js";import"../../../../../../componentsV2/LoaderLogo/LoaderLogo.constants.js";import"../../../../../../componentsV2/LoaderLogo/LoaderLogo.scss.js";import"../../../../../../utils/getSingleAsset.js";import"../../../../../../componentsV2/AppHeader/V3/AssetSelector/AssetSelectorChip/AssetSelectorChip.js";import"../../../../../../componentsV2/TextInput/TextInput.js";import"../../../../../../componentsV2/AppHeader/V3/AssetSelector/constants.js";import"../../../../../../componentsV2/AppHeader/V3/AssetSelector/AssetSelectorSelect/AssetSelectorSelect.scss.js";import"../../../../../../componentsV2/ChipIndicator/ChipIndicator.js";import"../../../../../../componentsV2/AppHeader/V3/AssetSelector/AssetSelectorSelect/loadAssets.js";import"../../../../../../componentsV2/AppHeader/V3/AssetSelector/AssetSelector.scss.js";import"../../../../../../clients/subscriptions/constants.js";import"querystring";import"uuid/v1";import"../../../../../../clients/subscriptions.v1.js";import"../../../../../../clients/subscriptions/subscriptions-client.factory.js";import"jsona";import"../../../../../../utils/env.js";import"../../../../../StatusBadge/constants.js";import"lodash/set";import"lodash/get";import"lodash/unset";import"../../../../../../clients/api/apiCore.js";import"../../../../../../clients/constants.js";import"../../../../../../clients/sso/auth0.js";import"../../../../../../clients/sso/oauth2.js";import"../../../../../../clients/api/rateLimiter.js";import"lodash/isEmpty";import"lodash/sortBy";import"../../../../../DevCenter/DevCenterAppContainer/components/CommentsSwitch/CommentsSwitchContext.js";import"../../../../../../componentsV2/AppSettings/AppSettingsPinningContext.js";import"../../../../../../componentsV2/AppHeader/V3/AppTitle/AppTitle.constants.js";import"../../../../../../componentsV2/AppHeader/V3/AppTitle/AppTitle.scss.js";import"../../../../../../componentsV2/AppHeader/V3/constants.scss.js";import"@babel/runtime/helpers/typeof";import"../../../../../../componentsV2/AppHeader/V3/SettingsButton/SettingsButton.js";import"../../../../../../componentsV2/AppHeader/V3/SettingsButton/SettingsButton.constants.js";import"../../../../../../componentsV2/AppSettings/AppSettings.js";import"../../../../../../componentsV2/AppSettings/AppSettings.constants.js";import"../../../../../../componentsV2/AppSizeProvider/AppSizeProvider.js";import"../../../../../../componentsV2/AppHeader/V3/Actions/Actions.constants.js";import"../../../../../../componentsV2/AppHeader/V3/Actions/Actions.scss.js";import"../../../../../../componentsV2/AppHeader/V3/AppHeaderV3.scss.js";import"../../../../../../componentsV2/AppHeader/AppHeader.scss.js";import"../../../../../../componentsV2/EmptyState/EmptyState.scss.js";import"../../../../../DevCenter/DevCenterAppContainer/components/DevCenterAppView/components/ChooseAssetButton.js";import"../../../../../DevCenter/DevCenterAppContainer/components/DevCenterAppView/DevCenterAppView.scss.js";import"../../../../../DevCenter/DevCenterAppContainer/components/AppActions/AppActions.css.js";import"../../../../../DevCenter/DevCenterAppContainer/components/CommentsSwitch/CommentsSwitchButton.scss.js";import"../../../../../../componentsV2/Grid/Grid.js";import"../../../../../../componentsV2/Grid/Cell.js";import"../../../../../../componentsV2/PopoverPanel/PopoverPanel.js";import"../../../../../../componentsV2/Radio/Radio.js";import"../../../../../../componentsV2/RadioAndCheckboxGroup/RadioAndCheckboxGroup.scss.js";import"../../../../../../componentsV2/Checkbox/Checkbox.js";import"../../../../../../componentsV2/TextInputNext/TextInputNext.js";import"../../../../../../componentsV2/TextArea/TextArea.js";import"../../../../../../componentsV2/Label/Label.js";import"../../../../../../componentsV2/TextLink/TextLink.js";import"../../../../../../componentsV2/ChipAlert/ChipAlert.js";import"../../../../../../componentsV2/Avatar/Avatar.js";import"../../../../../../componentsV2/AvatarGroup/AvatarGroup.js";import"@material-ui/lab";import"../../../../../../componentsV2/ToggleButtons/ToggleButtons.scss.js";import"../../../../../../componentsV2/Paper/Paper.js";import"../../../../../../componentsV2/Hint/Hint.scss.js";import"../../../../../../componentsV2/Counter/Counter.js";import"../../../../../../componentsV2/BadgeBase/BadgeBase.scss.js";import"../../../../../../componentsV2/TemplatesControl/TemplatesControl.js";import"zustand";import"../../../../../../componentsV2/TemplatesControl/utils.js";import"../../../../../../componentsV2/TemplatesControl/icons/folder/index.js";import"../../../../../../componentsV2/TemplatesControl/Store/utils.js";import"../../../../../../componentsV2/TemplatesControl/types.js";import"../../../../../../componentsV2/BadgeDot/BadgeDot.scss.js";import"../../../../../../componentsV2/LoaderLinear/LoaderLinear.scss.js";import"../../../../../../componentsV2/Switch/Switch.js";import"../../../../../../componentsV2/Tabs/Tabs.js";import"../../../../../../componentsV2/FileIcon/FileIcon.js";import"../../../../../../componentsV2/Tag/Tag.js";import"react-dropzone";import"../../../../../../componentsV2/FilesDropzone/FilesDropzone.scss.js";import"../../../../../../componentsV2/FilesLoader/FilesLoader.scss.js";import"file-extension";import"image-extensions";import"video-extensions";import"../../../../../../componentsV2/FilesProcessor/FilesProcessor.scss.js";import"../../../../../../componentsV2/Skeleton/Skeleton.scss.js";import"../../../../../../utils/main.js";import"../../../../../../componentsV2/CopyToClipboard/CopyToClipboard.scss.js";import"../../../../../../componentsV2/Stepper/Step/Step.scss.js";import"../../../../../../componentsV2/Stepper/Stepper.scss.js";import"../../../../../../componentsV2/ButtonLive/ButtonLive.js";import"../../../../../../componentsV2/ButtonText/ButtonText.js";import"../../../../../../componentsV2/IndicatorLive/IndicatorLive.js";import"../../../../../../componentsV2/Breadcrumbs/Breadcrumbs.scss.js";import"../../../../../../componentsV2/BadgeComment/BadgeComment.js";import"../../../../../../componentsV2/AppFooter/AppFooter.js";import"../../../../../../componentsV2/OffsetWellsButton/OffsetWellsButton.js";import"../../../../../../componentsV2/ChartAxisExtreme/ChartAxisExtreme.scss.js";import"highcharts";import"../../../../../../componentsV2/ChartAxisExtreme/ChartAxisExtremeDragTracker.js";import"../../../../../../componentsV2/Autocomplete/Autocomplete.js";import"../../../../../../componentsV2/Select/Select.js";import"../../../../../../componentsV2/AppSettingsDivider/AppSettingsDivider.scss.js";import"../../../../../../componentsV2/WellArchivedMessage/WellArchivedMessage.js";import"../../../../../../componentsV2/DatePicker/DatePicker.js";import"../../../../../../componentsV2/DragHandle/DragHandle.js";import"../../../../../../componentsV2/CompletionsOffsetWellPicker/CompletionsOffsetWellPicker.js";import"../../../../../../componentsV2/Slider/constants.js";import"../../../../../../componentsV2/Slider/components/SliderThumb.js";import"../../../../../../componentsV2/Slider/Slider.scss.js";import"../../../../../../componentsV2/SliderAdvanced/SliderAdvanced.js";import"react-color";import"../../../../../../componentsV2/ColorPicker/Swatches/Swatches.scss.js";import"../../../../../../componentsV2/ColorPicker/OpacityDragtracker/OpacityDragTracker.scss.js";import"../../../../../../componentsV2/ColorPicker/ColorPicker.scss.js";import"../../../../../../componentsV2/ChartHelper/ChartHelper.scss.js";import"../../../../../../componentsV2/Hotkey/Hotkey.js";import"@tanstack/react-query";import"../../../../../../componentsV2/InterventionEventSelector/useInterventionUnitEvents.js";import"../../../../../../componentsV2/InterventionEventSelector/InterventionEventSelector.scss.js";import"../../../../../DevCenter/DevCenterAppContainer/components/FullscreenButton/FullscreenButton.css.js";import"../../../../../Icons/AnnotationIcon.js";import"../../../../../HelpCenter/HelpCenterIcon.js";import"../../../../../DevCenter/DevCenterAppContainer/components/RestoreAppSizeButton/RestoreAppSizeButton.css.js";import"../../../../../DevCenter/DevCenterAppContainer/DevCenterAppContainer.scss.js";import"../../../../../Toaster/Toaster.js";import"../../../../../DevCenter/NavigationBar/NavigationBar.js";import"../../../../../DevCenter/SideBar/SideBar.js";import"../../../../../DevCenter/AppSettingsPopover/AppSettingsPopover.js";import"../../../../../DevCenter/AppFilterPanelLayout/AppFilterPanelLayout.js";import"../../../../../DevCenter/IsolatedDevCenterAppContainer/DevCenterIsolatedAppPage.js";import"../../../../../DevCenter/IsolatedDevCenterAppContainer/DevCenterIsolatedApp.js";import"../../../../../AssetEditor/index.js";import"../../../../../LoadingIndicator/LoadingIndicator.js";import"../../../../../Typography.js";import"../../../../../RealTimeValuesSidebar/RealTimeSidebar.js";import"../../../../../CollapsableSidebar.js";import"../../../../../DateTimePicker/index.js";import"../../../../../DatePicker/index.js";import"../../../../../SlateFormattedText/SlateFormattedText.js";import"../../../../../SlateFormattedText/RenderElements.js";import"slate";import"../../../../../ParameterCharts/ParameterCharts.js";import"../../../../../ParameterCharts/AddEditTrack.js";import"../../../../../ChartActionsList/ChartActionsList.js";import"../../../../../CopyToClipboard/CopyToClipboard.js";import"../../../../../AssetEditor/AssetEditorAutocomplete.js";import"../../../../../AssetEditor/SingleAssetEditor.js";import"../../../../../SettingEditors/ColorEditor/style.css.js";import"../../../../../SettingEditors/DropdownEditor/index.js";import"../../../../../SwitchControl/index.js";import"../../../../../ColorPicker/ColorPicker.js";import"../../../../../Chart/components/ChartButton.js";import"../../../../../Chart/components/ChartButtons.js";import"../../../../../Chart/components/ChartWrapper.js";import"../../../../../Chart/components/AxisDropdown.js";import"../../../../../Chart/components/ChartSelect.js";import"../../../../../Chart/ChartWrapperContext.js";import"../../../../../Chart/effects/useChartModifier.js";import"../../../../../Chart/components/buttons/HideAxesButton.js";import"../../../../../Chart/components/buttons/ChartTypeButton.js";import"../../../../../ColorPicker/PaletteChromePicker/PaletteChromePicker.js";import"../../../../../TruncatedText/index.js";import"../../../../../MiddleTruncatedText/MiddleTruncatedText.js";import"../../../../../RangeSlider/constants.js";import"../../../../../RangeSlider/Input.css.js";import"../../../../../RangeSlider/RangeSlider.css.js";import"../../../../../AdvancedSlider/AdvancedSlider.js";import"../../../../../Breadcrumbs/index.js";import"../../../../../VirtualizedTable/index.js";import"../../../../../EmptyView/EmptyView.js";import"../../../../../EmptyView/EmptyAppView/EmptyAppView.js";import"../../../../../ContextMenuItem/index.js";import"../../../../../FolderMenuItem/index.js";import"../../../../../EditableItem/EditableItem/index.js";import"../../../../../EditableItem/EditableItemWithBadge/index.js";import"../../../../../Checkbox/index.js";import"../../../../../FolderMenuItemWithLinks/index.js";import"../../../../../TextField/index.js";import"../../../../../Chip/index.js";import"../../../../../Counter/index.js";import"../../../../../AnchorsList/AnchorsList.js";import"../../../../../Select/index.js";import"../../../../../Select/SelectFilterBy.js";import"../../../../../CustomSelect/index.js";import"../../../../../Tabs/Tabs.js";import"../../../../../Tabs/Tab.js";import"../../../../../ResizableTable/ResizableTable.js";import"../../../../../GradientPicker/GradientPicker.js";import"@babel/runtime/helpers/classCallCheck";import"@babel/runtime/helpers/createClass";import"../../../../../GradientManager/GradientPreview/GradientPreview.js";import"../../../../../GradientManager/GradientSelect.scss.js";import"../../../../../GradientManager/GradientManager.styles.js";import"../../../../../Drillstring/BHASchematic.js";import"../../../../../Drillstring/BHATable/index.js";import"../../../../../Drillstring/BHAComponentIcon.js";import"../../../../../Drillstring/BHAComponentDetail/index.js";import"../../../../../Drillstring/BHATileIcon.js";import"../../../../../Drillstring/BHATile/BHATile.js";import"../../../../../Drillstring/BHAList/BHAList.js";import"../../../../../Drillstring/BHAComponentsTable/BHAComponentsTable.js";import"../../../../../Casing/CasingTable/index.js";import"../../../../../Casing/CasingComponentIcon.js";import"../../../../../Casing/CasingTileIcon.js";import"../../../../../Casing/CasingTableV2/CasingTableV2.js";import"../../../../../Casing/CasingTile/CasingTile.js";import"../../../../../WellSummary/WellSummaryItemLabel.js";import"../../../../../WellSummary/WellSummaryItemTitle.js";import"../../../../../WellSummary/WellSummaryItemValue.js";import"../../../../../WellSummary/ActivitySummaryChart.js";import"../../../../../WellSummary/FracWirelineTimeChart.js";import"../../../../../BICOffsetPickerDialog/index.js";import"../../../../../OffsetWellButton/OffsetWellButton.js";import"../../../../../OffsetWellPickerV2/OffsetWellPickerDialog.js";import"../../../../index.js";import"../../../../../OffsetWellChips/Chip.js";import"../../../../../OffsetWellChips/ChipsContainer.js";import"../../../../../OffsetWellPickerV5/components/OffsetWellPickerV5WithStore/OffsetWellPickerV5WithStore.js";import"../../../../../OffsetWellMap/OffsetWellMap.js";import"@material-ui/core/Snackbar";import"../../../../../Notifications/Toast.js";import"../../../../../Notifications/Notifications.scss.js";import"../../../../../TextLink/index.js";import"../../../../../Avatar/index.js";import"../../../../../Template/TemplatePopover/index.js";import"../../../../../Template/TemplateSharingDialog/index.js";import"../../../../../MenuItem/index.js";import"../../../../../MiddleTruncate/MiddleTruncate.js";import"../../../../../PinnableFilters/PinnableFilters.js";import"../../../../../HeaderLayout/HeaderLayout.js";import"../../../../../PadOffsetsPicker/PadOffsetsPicker.js";import"../../../../../PadOffsetsPicker/OffsetAssetChip.js";import"../../../../../PadOffsetsPicker/OffsetAssetsListExpander.js";import"../../../../../PadOffsetsPicker/StagesSelector.js";import"../../../../../PadOffsetsPickerV2/PadOffsetsPickerV2.js";import"../../../../../Table/TableToolbar/TableToolbar.js";import"../../../../../Table/TableContainer/TableContainer.js";import"../../../../../Table/TableCell/TableCell.js";import"../../../../../Table/TablePagination/TablePagination.js";import"../../../../../Table/TablePaginationActions/TablePaginationActions.js";import"../../../../../Tooltip/ScrollableTooltip.js";import"../../../../../PriceInput/PriceInput.js";import"../../../../../LabelsCounter/LabelsCounter.js";import"../../../../../Stepper/Stepper.js";import"../../../../../Stepper/Step/Step.js";import"../../../../../Stepper/StepsWrapper.js";import"../../../../../Comment/CommentIcon/index.js";import"../../../../../FilesLoader/FilesLoader.js";import"../../../../../../componentsV2/FileIcon/icons/ArchiveFileIcon.js";import"../../../../../../componentsV2/FileIcon/icons/CSVFileIcon.js";import"../../../../../../componentsV2/FileIcon/icons/DocFileIcon.js";import"../../../../../../componentsV2/FileIcon/icons/EDMFileIcon.js";import"../../../../../../componentsV2/FileIcon/icons/ExcelFileIcon.js";import"../../../../../../componentsV2/FileIcon/icons/ImageFileIcon.js";import"../../../../../../componentsV2/FileIcon/icons/JsonFileIcon.js";import"../../../../../../componentsV2/FileIcon/icons/LasFileIcon.js";import"../../../../../../componentsV2/FileIcon/icons/OtherFileIcon.js";import"../../../../../../componentsV2/FileIcon/icons/PdfFileIcon.js";import"../../../../../../componentsV2/FileIcon/icons/PowerPointFileIcon.js";import"../../../../../../componentsV2/FileIcon/icons/TxtFileIcon.js";import"../../../../../../componentsV2/FileIcon/icons/UnknownFileIcon.js";import"../../../../../../componentsV2/FileIcon/icons/VideoFileIcon.js";import"../../../../../../componentsV2/FileIcon/icons/XmlFileIcon.js";import"../../../../../SearchInput/index.js";import"../../../../../FeedItem/FeedItem.js";import"../../../../../FeedItem/FeedItemEditProvider/FeedItemEditProvider.js";import"../../../../../PostInput/PostInput.js";import"../../../../../KeyboardDateTimePicker.js";import"../../../../../AddComment/Popover.js";import"../../../../../AddComment/Popup.js";import"../../../../../StageDesignVActual/ComparisonBar/ComparisonBar.js";import"../../../../../StageDesignVActual/ElementsComparison/ElementsComparison.js";import"../../../../../StageDesignVActual/ComparisonHeader.js";import"../../../../../StageDesignVActual/ComparisonRow.js";import"../../../../../EmbeddedApp/DevCenterEmbeddedApp.js";import"../../../../../EmbeddedApp/EmbeddedApp.js";import"../../../../../Autocomplete/Autocomplete.js";import"../../../../../DocumentViewer/DocumentViewer.js";import"../../../../../ColorPickerPalette/ColorPickerPalette.js";import"../../../../../Search/Search.js";import"../../../../../Search/components/Listbox.js";import"../../../../../Search/components/Paper.js";import"../../../../../Search/components/RecentSearches.js";import"../../../../../Search/components/Groups.js";import"../../../../../Search/components/SelectAllListItem.js";import"../../../../../StatusBadge/index.js";import"../../../../../Attachment/index.js";import"../../../../../EmojiIconButton.js";import"../../../../../FileUploadIconButton.js";import"../../../../../FilePreview/index.js";import"../../../../../FailedFileUploading.js";import"../../../../../UserMention/index.js";import"../../../../../CommentsInfo/index.js";import"../../../../../CommentInput/index.js";import"../../../../../Comment/index.js";import"../../../../../CommentLoader.js";import"../../../../../AssetNameLabel/AssetStatusBadge.js";import"../../../../../AssetEditorV2/components/PrimaryAssetSelect.js";import"../../../../../AssetEditorV2/components/SecondaryAssetSelect.js";import"../../../../../AssetEditorV2/components/SelectItem.js";import"../../../../../AssetEditorV2/components/MultipleAssetsToggle.js";import"../../../../../AssetEditorV2/components/PrimaryAssetSelectV2.js";import"../../../../../EChartsWrapper/EChartsWrapper.js";import"../../../../../AssetsMultipleSelector/AssetsMultipleSelector.js";import"@material-ui/icons/Close";import"@material-ui/icons/GetApp";import"../../../../../GoogleDocsViewer/index.js";import"../../../../../NewDocumentViewer/effects/useFileContent.js";import"../../../../../NewDocumentViewer/styles.js";import"../../../../../FilesLoaderV2/styles.js";import"../../../../../FilesDropzone/styles.js";import"../../../../../FilesProcessor/styles.js";import"../../../../../Hint/styles.js";import"@babel/runtime/helpers/taggedTemplateLiteral";import"fparser";import"../../../../../Formula/useFormulaStyles.js";import"../../../../../Formula/RootXIcon.js";import"../../../../../Formula/FormulaTextEditor.js";import"../../../../../Formula/CloseSuggestion.js";import"../../../../../Formula/SuggestionsMenu.js";import"../../../../../CommentCard/CommentCard.js";import"@material-ui/icons/AlternateEmail";import"../../../../../AttachFileButton/AttachFileButton.scss.js";import"../../../../../CommentInputNext/CommentInputNext.js";import"../../../../../UserMention/utils/index.js";import"react-s3-uploader/s3upload";import"../../../../../CommentComposer/CommentMetaLine.scss.js";import"../../../../../CommentComposer/ChatChannelSelector.scss.js";import"../../../../../CommentComposer/ShareToChatRow.scss.js";import"../../../../../CommentComposer/CommentComposer.scss.js";import"../../../../../AttachmentPreview/AttachmentPreview.js";import"../../../../../AttachmentPreview/AttachmentImage.js";import"../../../../../AttachmentPreview/AttachmentPreview.scss.js";import"../../../../../CommentPin/CommentPin.js";import"../../../../../FeedCard/FeedCard.js";import"../../../../../FeedItemCard/FeedItemCard.js";import"../../../../../NewCommentCursor/NewCommentCursor.js";import"../../../../../LinkedText/LinkedText.js";import"../../../../../FeedItem/feedItemTypes/AlertFeedItem.js";import"../../../../../FeedItem/feedItemTypes/PostFeedItem.js";import"../../../../../FeedItem/feedItemTypes/GeosteeringFeedItem.js";import"../../../../../FeedItem/feedItemTypes/DrillingOperationalNoteFeedItem.js";import"../../../../../FeedItem/feedItemTypes/DrillingOperationSummaryFeedItem.js";import"../../../../../FeedItem/feedItemTypes/DrillingDailyCostFeedItem.js";import"../../../../../FeedItem/feedItemTypes/DocumentFeedItem.js";import"../../../../../FeedItem/feedItemTypes/DrillerMemoFeedItem.js";import"../../../../../FeedItem/feedItemTypes/NptFeedItem.js";import"../../../../../FeedItem/feedItemTypes/SurveyStationFeedItem/index.js";import"../../../../../FeedItem/feedItemTypes/LessonsLearnedFeedItem/index.js";import"../../../../../FeedItem/feedItemTypes/TracesMemoFeedItem.js";import"../../../../../FeedItem/feedItemTypes/DepthCommentFeedItem.js";import"../../../../../FeedItem/feedItemTypes/CompletionOperationalNoteFeedItem.js";import"../../../../../FeedItem/feedItemTypes/CompletionOperationSummaryFeedItem.js";import"../../../../../FeedItem/feedItemTypes/CompletionDailyCostFeedItem.js";import"../../../../../FeedItem/feedItemTypes/CompletionDocumentFeedItem.js";import"../../../../../FeedItem/feedItemTypes/CompletionNptFeedItem.js";import"../../../../../FeedItem/feedItemTypes/StageOverviewFeedItem/index.js";import"../../../../../FeedItem/feedItemTypes/AppAnnotationFeedItem/index.js";import"../../../../../FeedItem/feedItemTypes/WellPlanFeedItem/index.js";import"../../../../../FeedItem/feedItemTypes/FluidReportFeedItem.js";import"../../../../../FeedItem/feedItemTypes/BhaFeedItem/BhaFeedItem.js";import"../../../../../FeedItem/feedItemTypes/DvDCommentFeedItem.js";import"../../../../../FeedItem/feedItemTypes/PCCommentFeedItem.js";import"../../../../../FeedItem/feedItemTypes/HookloadCommentFeedItem.js";import"../../../../../FeedItem/feedItemTypes/NptLessonsCommentFeedItem.js";import"../../../../../FeedItem/feedItemTypes/GenericDataCommentFeedItem.js";function A(s){var i=s.metricsKeys,A=s.onChange,V=s.classes,S=o([]),h=e(S,2),g=h[0],T=h[1],F=o(null),v=e(F,2),D=v[0],P=v[1];t((function(){T(i)}),[i]);return j(u,{children:[C(I,{tooltipProps:{title:"Add Metric"},size:"small",onClick:function(e){P(e.currentTarget)},children:C(c,{size:"small"})}),C(n,{id:"simple-menu",anchorEl:D,getContentAnchorEl:null,anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"bottom",horizontal:"right"},PaperProps:{style:{maxHeight:"300px",backgroundColor:"#414141"}},keepMounted:!0,open:Boolean(D),onClose:function(){P(null),a(g,i)||A(g)},children:l.map((function(e){return j(r,{disabled:g.length===d&&!g.includes(e.key),onClick:function(){return o=e.key,void(g.includes(o)?T((function(e){return e.filter((function(e){return e!==o}))})):T((function(e){return e.concat(o)})));var o},children:[C(p,{checked:g.includes(e.key),className:V.checkBox}),C(m,{primary:e.label,classes:{primary:V.listItemPrimaryText}})]},e.key)}))})]})}A.propTypes={metricsKeys:s.arrayOf(s.string).isRequired,onChange:s.func.isRequired,classes:s.shape({}).isRequired};var V=i({listItemPrimaryText:{color:"#fff",fontSize:"14px"},checkBox:{color:"grey",padding:"5px"}})(A);export{V as default};
1
+ import e from"@babel/runtime/helpers/slicedToArray";import{useState as o,useEffect as t}from"react";import s from"prop-types";import{withStyles as i,Menu as n,MenuItem as r,Checkbox as p,ListItemText as m}from"@material-ui/core";import c from"@material-ui/icons/Settings";import{isEqual as a}from"lodash";import{METRICS_LIST as l,MAX_METRICS_COUNT as d}from"../../constants.js";import"@babel/runtime/helpers/defineProperty";import"../../../../../DevCenter/DevCenterAppContainer/components/IsInsideIsolatedDcAppProvider.js";import"../../../../../DevCenter/DevCenterAppContainer/components/DcFullscreenElemsCoordinatorProvider/DcFullscreenElemsCoordinatorProvider.js";import"../../../../../DevCenter/DevCenterAppContainer/components/DcFullscreenElemsCoordinatorProvider/IsInsideDcFullscreenElemProvider.js";import"@babel/runtime/helpers/objectWithoutProperties";import"classnames";import"../../../../../Modal/CorvaModal.scss.js";import"@icon-park/react/es/all";import{jsxs as j,Fragment as u,jsx as C}from"react/jsx-runtime";import"../../../../../../icons/IconParkProvider.js";import"../../../../../../icons/customIcons/icons/AddMessage.js";import"../../../../../../icons/customIcons/icons/DragOne.js";import"../../../../../../icons/customIcons/icons/Attention.js";import"../../../../../../icons/customIcons/icons/Collapse.js";import"../../../../../../icons/customIcons/icons/Dashboard.js";import"../../../../../../icons/customIcons/icons/Expand.js";import"../../../../../../icons/customIcons/icons/FolderClosed.js";import"../../../../../../icons/customIcons/icons/FolderClosedFilled.js";import"../../../../../../icons/customIcons/icons/FolderOpened.js";import"../../../../../../icons/customIcons/icons/GreaterOrEqual.js";import"../../../../../../icons/customIcons/icons/LessOrEqual.js";import"../../../../../../icons/customIcons/icons/Search.js";import"../../../../../../icons/customIcons/icons/SearchOne.js";import"../../../../../../icons/customIcons/icons/Wellhub.js";import"../../../../../../icons/customIcons/icons/MultiRuler.js";import"../../../../../../icons/customIcons/icons/Checkbox.js";import"../../../../../../icons/customIcons/icons/CheckboxChecked.js";import"../../../../../../icons/customIcons/icons/CheckboxIndeterminate.js";import"../../../../../../icons/customIcons/icons/Radio.js";import"../../../../../../icons/customIcons/icons/RadioChecked.js";import"../../../../../../icons/customIcons/icons/SimulFrac.js";import"../../../../../../icons/customIcons/icons/ZipperFrac.js";import"../../../../../../icons/customIcons/icons/CautionFilled.js";import"../../../../../../icons/customIcons/icons/InfoRounded.js";import"../../../../../../icons/customIcons/icons/FlameFilled.js";import"../../../../../../icons/customIcons/icons/MoreApp.js";import"../../../../../../icons/customIcons/icons/Pad.js";import"../../../../../../icons/customIcons/icons/DrilloutUnit.js";import"../../../../../../icons/customIcons/icons/FracFleet.js";import"../../../../../../icons/customIcons/icons/Global.js";import"../../../../../../icons/customIcons/icons/Program.js";import"../../../../../../icons/customIcons/icons/Rig.js";import"../../../../../../icons/customIcons/icons/Well.js";import"../../../../../../icons/customIcons/icons/Gap.js";import"../../../../../../icons/customIcons/icons/Pin.js";import"../../../../../../icons/customIcons/icons/CloseOneFilled.js";import"../../../../../../icons/customIcons/icons/AttentionFilled.js";import"../../../../../../icons/customIcons/icons/CheckOneFilled.js";import"../../../../../../icons/customIcons/icons/Archive.js";import"../../../../../../icons/customIcons/icons/ArchiveCancel.js";import"../../../../../../icons/customIcons/icons/Unarchive.js";import"../../../../../../icons/customIcons/icons/Archived.js";import"../../../../../../icons/customIcons/icons/InterventionUnit.js";import"../../../../../../icons/customIcons/icons/CloudDelete.js";import"../../../../../../icons/customIcons/icons/Lasso.js";import"../../../../../../icons/customIcons/icons/Radius.js";import"../../../../../../icons/customIcons/icons/ErrorOps.js";import"../../../../../../icons/customIcons/icons/DataTypeOps.js";import"../../../../../../icons/customIcons/icons/FalsePositiveOps.js";import"../../../../../../icons/customIcons/icons/CalibrationOps.js";import"../../../../../../icons/customIcons/icons/CriticalOps.js";import"../../../../../../icons/customIcons/icons/Company.js";import"../../../../../../icons/customIcons/icons/ArchiveOne.js";import"../../../../../../icons/customIcons/icons/ParseBotFusion.js";import"../../../../../../icons/customIcons/icons/Connect.js";import"../../../../../../icons/customIcons/icons/PuzzleOne.js";import"../../../../../../icons/customIcons/icons/Feed.js";import"../../../../../../icons/customIcons/icons/Prompt.js";import"../../../../../../icons/customIcons/icons/Companies.js";import"../../../../../../icons/customIcons/icons/ClipboardAi.js";import"../../../../../../icons/customIcons/icons/Key.js";import"../../../../../../icons/customIcons/icons/AtSignCrossed.js";import"../../../../../../icons/customIcons/icons/MappingManual.js";import"../../../../../../icons/customIcons/icons/Mapping.js";import"../../../../../../icons/customIcons/icons/Metrics.js";import"../../../../../../icons/customIcons/icons/Drops.js";import"../../../../../../icons/customIcons/icons/ClipboardSearch.js";import"../../../../../../icons/customIcons/icons/Template.js";import"../../../../../../icons/customIcons/icons/ClipboardMetrics.js";import"../../../../../../icons/customIcons/icons/ClipboardBuilder.js";import"../../../../../../icons/customIcons/icons/UnitConversion.js";import"../../../../../../icons/customIcons/icons/NPT.js";import"../../../../../../icons/customIcons/icons/GuidedFrac.js";import"../../../../../../utils/mobileDetect.js";import I from"../../../../../IconButton/index.js";import"../../../../../../constants/goals.js";import"../../../../../../constants/segment.js";import"../../../../../../constants/alerts.js";import"../../../../../../constants/apps.js";import"../../../../../../constants/drillstring.js";import"../../../../../../constants/completion.js";import"../../../../../../constants/appPackages.js";import"../../../../../../constants/notifications.js";import"../../../../../../constants/feed.js";import"../../../../../../constants/bha.js";import"../../../../../../constants/corvaCompanyId.js";import"../../../../../GradientManager/configuration/constants.js";import"uuid";import"../../../../../IconMenu/index.js";import"../../../../../StyledMenuItem/index.js";import"../../../../../AppIcon/AppIcon.js";import"../../../../../DevCenter/AppHeader/AppHeader.js";import"../../../../../DevCenter/AppSideBar/AppSideBar.js";import"../../../../../DevCenter/AppsDataProvider/AppsDataProvider.js";import"../../../../../DevCenter/AppContext.js";import"../../../../../DevCenter/DevCenterRouterContext/DevCenterRouterContext.js";import"../../../../../DevCenter/DevCenterRouterContext/UniversalLink/UniversalLink.js";import"react-router-dom";import"query-string";import"@babel/runtime/helpers/asyncToGenerator";import"@babel/runtime/regenerator";import"../../../../../../utils/index.js";import"@material-ui/icons";import"../../../../../EmptyState/EmptyState.js";import"../../../../../DevCenter/DevCenterAppContainer/components/AppSettingsDialog/components/RemoveAppButton.js";import"../../../../../DevCenter/DevCenterAppContainer/components/AppSettingsDialog/components/SettingsAccordion.js";import"../../../../../DevCenter/DevCenterAppContainer/components/AppSettingsDialog/styles.js";import"@material-ui/pickers";import"@date-io/moment";import"moment";import"../../../../../../config/theme/index.js";import"../../../../../../hocs/withAssetEditorLockHOC.js";import"../../../../../ErrorBoundary/ErrorBoundary.js";import"../../../../../ErrorBoundary/DevCenterAppErrorView/DevCenterAppErrorView.js";import"../../../../../Button/components/Button/index.js";import"moment-timezone";import"../../../../../Button/components/LiveButton/components/LiveButtonStateIndicator/index.js";import"../../../../../Button/components/LiveButton/styles.js";import"../../../../../AssetEditorV2/index.js";import"../../../../../AppVersionsSelect/AppVersionsSelect.js";import"../../../../../DisabledSettingsMessage/DisabledSettingsMessage.js";import"../../../../../ConfirmationDialog.js";import"immutable";import"../../../../../../permissions/PermissionsContext.js";import"../../../../../../permissions/constants/index.js";import"../../../../../../permissions/withPermissionsHOC.js";import"../../../../../../clients/jsonApi/index.js";import"../../../../../../permissions/ProvidePermissions.js";import"../../../../../../componentsV2/AppHeader/V3/VersionSelect/VersionSelect.constants.js";import"../../../../../Annotations/components/AnnotationsList/index.js";import"../../../../../Annotations/components/LastAnnotation/index.js";import"../../../../../Annotations/AnnotationsContext.js";import"../../../../../../componentsV2/AppContainer/AppContainer.js";import"../../../../../../componentsV2/AppContainer/AppContainer.constants.js";import"../../../../../../componentsV2/Text/Text.js";import"../../../../../../componentsV2/Header/Header.scss.js";import"../../../../../../componentsV2/Tooltip/Tooltip.scss.js";import"../../../../../../componentsV2/TextEndTruncated/TextEndTruncated.scss.js";import"../../../../../../componentsV2/AppCommonsProvider/AppCommonsContext.js";import"../../../../../../componentsV2/AppHeader/AppHeader.constants.js";import"../../../../../../componentsV2/AppHeader/AppBadge/AppBadge.scss.js";import"../../../../../../componentsV2/Chip/Chip.js";import"../../../../../../componentsV2/TextMiddleTruncated/TextMiddleTruncated.constants.js";import"../../../../../../componentsV2/TextMiddleTruncated/TextMiddleTruncated.scss.js";import"../../../../../../componentsV2/AppHeader/AppAssets/utils.js";import"../../../../../../componentsV2/AppHeader/AppAssets/AppAssets.scss.js";import"../../../../../PadModeSelect/PadModeSelect.js";import"../../../../../../componentsV2/AppHeader/PadMode/PadMode.scss.js";import"../../../../../../constants/streamSourceType.js";import"../../../../../../componentsV2/PadModeSelect/PadModeSelect.js";import"../../../../../../componentsV2/PadModeSelect/PadModeSelect.constants.js";import"../../../../../../componentsV2/AppCommonsProvider/AppCommonsProvider.js";import"../../../../../../componentsV2/utils.js";import"../../../../../../componentsV2/AppHeader/V3/VersionSelect/VersionSelect.js";import"../../../../../../componentsV2/UniversalLink/UniversalLink.scss.js";import"../../../../../../componentsV2/AppHeader/V3/AssetChips/AssetChips.scss.js";import"../../../../../../componentsV2/Button/Button.js";import"../../../../../../componentsV2/AppHeader/V3/DqStatusIcon/DqStatusIcon.js";import"../../../../../../componentsV2/AppHeader/V3/DqStatusIcon/DqStatusIcon.constants.js";import"../../../../../../componentsV2/Popover/Popover.js";import"@babel/runtime/helpers/toConsumableArray";import"../../../../../../componentsV2/Accordion/Accordion.scss.js";import"../../../../../../componentsV2/ButtonIcon/ButtonIcon.js";import"../../../../../../componentsV2/AppFooter/DqPopover/DqStatusIcon/DqStatusIcon.js";import"../../../../../../componentsV2/AppDqPopover/DqAlertTooltip/DqAlertTooltip.scss.js";import"../../../../../../componentsV2/AppDqPopover/DqAlert/DqAlert.scss.js";import"../../../../../../componentsV2/AppDqPopover/DqAsset/DqAsset.scss.js";import"../../../../../../componentsV2/AppDqPopover/AppDqPopover.scss.js";import"../../../../../../componentsV2/Menu/Menu.js";import"../../../../../../componentsV2/ModalWindow/ModalWindow.js";import"../../../../../../componentsV2/Modal/Modal.scss.js";import"../../../../../../componentsV2/LoaderLogo/LoaderLogo.constants.js";import"../../../../../../componentsV2/LoaderLogo/LoaderLogo.scss.js";import"../../../../../../utils/getSingleAsset.js";import"../../../../../../componentsV2/AppHeader/V3/AssetSelector/AssetSelectorChip/AssetSelectorChip.js";import"../../../../../../componentsV2/TextInput/TextInput.js";import"../../../../../../componentsV2/AppHeader/V3/AssetSelector/constants.js";import"../../../../../../componentsV2/AppHeader/V3/AssetSelector/AssetSelectorSelect/AssetSelectorSelect.scss.js";import"../../../../../../componentsV2/ChipIndicator/ChipIndicator.js";import"../../../../../../componentsV2/AppHeader/V3/AssetSelector/AssetSelectorSelect/loadAssets.js";import"../../../../../../componentsV2/AppHeader/V3/AssetSelector/AssetSelector.scss.js";import"../../../../../../clients/subscriptions/constants.js";import"querystring";import"uuid/v1";import"../../../../../../clients/subscriptions.v1.js";import"../../../../../../clients/subscriptions/subscriptions-client.factory.js";import"jsona";import"../../../../../../utils/env.js";import"../../../../../StatusBadge/constants.js";import"lodash/set";import"lodash/get";import"lodash/unset";import"../../../../../../clients/api/apiCore.js";import"../../../../../../clients/constants.js";import"../../../../../../clients/sso/auth0.js";import"../../../../../../clients/sso/oauth2.js";import"../../../../../../clients/api/rateLimiter.js";import"lodash/isEmpty";import"lodash/sortBy";import"../../../../../DevCenter/DevCenterAppContainer/components/CommentsSwitch/CommentsSwitchContext.js";import"../../../../../../componentsV2/AppSettings/AppSettingsPinningContext.js";import"../../../../../../componentsV2/AppHeader/V3/AppTitle/AppTitle.constants.js";import"../../../../../../componentsV2/AppHeader/V3/AppTitle/AppTitle.scss.js";import"../../../../../../componentsV2/AppHeader/V3/constants.scss.js";import"@babel/runtime/helpers/typeof";import"../../../../../../componentsV2/AppHeader/V3/SettingsButton/SettingsButton.js";import"../../../../../../componentsV2/AppHeader/V3/SettingsButton/SettingsButton.constants.js";import"../../../../../../componentsV2/AppSettings/AppSettings.js";import"../../../../../../componentsV2/AppSettings/AppSettings.constants.js";import"../../../../../../componentsV2/AppSizeProvider/AppSizeProvider.js";import"../../../../../../componentsV2/AppHeader/V3/Actions/Actions.constants.js";import"../../../../../../componentsV2/AppHeader/V3/Actions/Actions.scss.js";import"../../../../../../componentsV2/AppHeader/V3/AppHeaderV3.scss.js";import"../../../../../../componentsV2/AppHeader/AppHeader.scss.js";import"../../../../../../componentsV2/EmptyState/EmptyState.scss.js";import"../../../../../DevCenter/DevCenterAppContainer/components/DevCenterAppView/components/ChooseAssetButton.js";import"../../../../../DevCenter/DevCenterAppContainer/components/DevCenterAppView/DevCenterAppView.scss.js";import"../../../../../DevCenter/DevCenterAppContainer/components/AppActions/AppActions.css.js";import"../../../../../DevCenter/DevCenterAppContainer/components/CommentsSwitch/CommentsSwitchButton.scss.js";import"../../../../../../componentsV2/Grid/Grid.js";import"../../../../../../componentsV2/Grid/Cell.js";import"../../../../../../componentsV2/PopoverPanel/PopoverPanel.js";import"../../../../../../componentsV2/Radio/Radio.js";import"../../../../../../componentsV2/RadioAndCheckboxGroup/RadioAndCheckboxGroup.scss.js";import"../../../../../../componentsV2/Checkbox/Checkbox.js";import"../../../../../../componentsV2/TextInputNext/TextInputNext.js";import"../../../../../../componentsV2/TextArea/TextArea.js";import"../../../../../../componentsV2/Label/Label.js";import"../../../../../../componentsV2/TextLink/TextLink.js";import"../../../../../../componentsV2/ChipAlert/ChipAlert.js";import"../../../../../../componentsV2/Avatar/Avatar.js";import"../../../../../../componentsV2/AvatarGroup/AvatarGroup.js";import"@material-ui/lab";import"../../../../../../componentsV2/ToggleButtons/ToggleButtons.scss.js";import"../../../../../../componentsV2/Paper/Paper.js";import"../../../../../../componentsV2/Hint/Hint.scss.js";import"../../../../../../componentsV2/Counter/Counter.js";import"../../../../../../componentsV2/BadgeBase/BadgeBase.scss.js";import"../../../../../../componentsV2/TemplatesControl/TemplatesControl.js";import"zustand";import"../../../../../../componentsV2/TemplatesControl/utils.js";import"../../../../../../componentsV2/TemplatesControl/icons/folder/index.js";import"../../../../../../componentsV2/TemplatesControl/Store/utils.js";import"../../../../../../componentsV2/TemplatesControl/types.js";import"../../../../../../componentsV2/BadgeDot/BadgeDot.scss.js";import"../../../../../../componentsV2/LoaderLinear/LoaderLinear.scss.js";import"../../../../../../componentsV2/Switch/Switch.js";import"../../../../../../componentsV2/Tabs/Tabs.js";import"../../../../../../componentsV2/FileIcon/FileIcon.js";import"../../../../../../componentsV2/Tag/Tag.js";import"react-dropzone";import"../../../../../../componentsV2/FilesDropzone/FilesDropzone.scss.js";import"../../../../../../componentsV2/FilesLoader/FilesLoader.scss.js";import"file-extension";import"image-extensions";import"video-extensions";import"../../../../../../componentsV2/FilesProcessor/FilesProcessor.scss.js";import"../../../../../../componentsV2/Skeleton/Skeleton.scss.js";import"../../../../../../utils/main.js";import"../../../../../../componentsV2/CopyToClipboard/CopyToClipboard.scss.js";import"../../../../../../componentsV2/Stepper/Step/Step.scss.js";import"../../../../../../componentsV2/Stepper/Stepper.scss.js";import"../../../../../../componentsV2/ButtonLive/ButtonLive.js";import"../../../../../../componentsV2/ButtonText/ButtonText.js";import"../../../../../../componentsV2/IndicatorLive/IndicatorLive.js";import"../../../../../../componentsV2/Breadcrumbs/Breadcrumbs.scss.js";import"../../../../../../componentsV2/BadgeComment/BadgeComment.js";import"../../../../../../componentsV2/AppFooter/AppFooter.js";import"../../../../../../componentsV2/OffsetWellsButton/OffsetWellsButton.js";import"../../../../../../componentsV2/ChartAxisExtreme/ChartAxisExtreme.scss.js";import"highcharts";import"../../../../../../componentsV2/ChartAxisExtreme/ChartAxisExtremeDragTracker.js";import"../../../../../../componentsV2/Autocomplete/Autocomplete.js";import"../../../../../../componentsV2/Select/Select.js";import"../../../../../../componentsV2/AppSettingsDivider/AppSettingsDivider.scss.js";import"../../../../../../componentsV2/WellArchivedMessage/WellArchivedMessage.js";import"../../../../../../componentsV2/DatePicker/DatePicker.js";import"../../../../../../componentsV2/DragHandle/DragHandle.js";import"../../../../../../componentsV2/CompletionsOffsetWellPicker/CompletionsOffsetWellPicker.js";import"../../../../../../componentsV2/Slider/constants.js";import"../../../../../../componentsV2/Slider/components/SliderThumb.js";import"../../../../../../componentsV2/Slider/Slider.scss.js";import"../../../../../../componentsV2/SliderAdvanced/SliderAdvanced.js";import"react-color";import"../../../../../../componentsV2/ColorPicker/Swatches/Swatches.scss.js";import"../../../../../../componentsV2/ColorPicker/OpacityDragtracker/OpacityDragTracker.scss.js";import"../../../../../../componentsV2/ColorPicker/ColorPicker.scss.js";import"../../../../../../componentsV2/ChartHelper/ChartHelper.scss.js";import"../../../../../../componentsV2/Hotkey/Hotkey.js";import"@tanstack/react-query";import"../../../../../../componentsV2/InterventionEventSelector/useInterventionUnitEvents.js";import"../../../../../../componentsV2/InterventionEventSelector/InterventionEventSelector.scss.js";import"../../../../../DevCenter/DevCenterAppContainer/components/FullscreenButton/FullscreenButton.css.js";import"../../../../../Icons/AnnotationIcon.js";import"../../../../../HelpCenter/HelpCenterIcon.js";import"../../../../../DevCenter/DevCenterAppContainer/components/RestoreAppSizeButton/RestoreAppSizeButton.css.js";import"../../../../../DevCenter/DevCenterAppContainer/DevCenterAppContainer.scss.js";import"../../../../../Toaster/Toaster.js";import"../../../../../DevCenter/NavigationBar/NavigationBar.js";import"../../../../../DevCenter/SideBar/SideBar.js";import"../../../../../DevCenter/AppSettingsPopover/AppSettingsPopover.js";import"../../../../../DevCenter/AppFilterPanelLayout/AppFilterPanelLayout.js";import"../../../../../DevCenter/IsolatedDevCenterAppContainer/DevCenterIsolatedAppPage.js";import"../../../../../DevCenter/IsolatedDevCenterAppContainer/DevCenterIsolatedApp.js";import"../../../../../AssetEditor/index.js";import"../../../../../LoadingIndicator/LoadingIndicator.js";import"../../../../../Typography.js";import"../../../../../RealTimeValuesSidebar/RealTimeSidebar.js";import"../../../../../CollapsableSidebar.js";import"../../../../../DateTimePicker/index.js";import"../../../../../DatePicker/index.js";import"../../../../../SlateFormattedText/SlateFormattedText.js";import"../../../../../SlateFormattedText/RenderElements.js";import"slate";import"../../../../../ParameterCharts/ParameterCharts.js";import"../../../../../ParameterCharts/AddEditTrack.js";import"../../../../../ChartActionsList/ChartActionsList.js";import"../../../../../CopyToClipboard/CopyToClipboard.js";import"../../../../../AssetEditor/AssetEditorAutocomplete.js";import"../../../../../AssetEditor/SingleAssetEditor.js";import"../../../../../SettingEditors/ColorEditor/style.css.js";import"../../../../../SettingEditors/DropdownEditor/index.js";import"../../../../../SwitchControl/index.js";import"../../../../../ColorPicker/ColorPicker.js";import"../../../../../Chart/components/ChartButton.js";import"../../../../../Chart/components/ChartButtons.js";import"../../../../../Chart/components/ChartWrapper.js";import"../../../../../Chart/components/AxisDropdown.js";import"../../../../../Chart/components/ChartSelect.js";import"../../../../../Chart/ChartWrapperContext.js";import"../../../../../Chart/effects/useChartModifier.js";import"../../../../../Chart/components/buttons/HideAxesButton.js";import"../../../../../Chart/components/buttons/ChartTypeButton.js";import"../../../../../ColorPicker/PaletteChromePicker/PaletteChromePicker.js";import"../../../../../TruncatedText/index.js";import"../../../../../MiddleTruncatedText/MiddleTruncatedText.js";import"../../../../../RangeSlider/constants.js";import"../../../../../RangeSlider/Input.css.js";import"../../../../../RangeSlider/RangeSlider.css.js";import"../../../../../AdvancedSlider/AdvancedSlider.js";import"../../../../../Breadcrumbs/index.js";import"../../../../../VirtualizedTable/index.js";import"../../../../../EmptyView/EmptyView.js";import"../../../../../EmptyView/EmptyAppView/EmptyAppView.js";import"../../../../../ContextMenuItem/index.js";import"../../../../../FolderMenuItem/index.js";import"../../../../../EditableItem/EditableItem/index.js";import"../../../../../EditableItem/EditableItemWithBadge/index.js";import"../../../../../Checkbox/index.js";import"../../../../../FolderMenuItemWithLinks/index.js";import"../../../../../TextField/index.js";import"../../../../../Chip/index.js";import"../../../../../Counter/index.js";import"../../../../../AnchorsList/AnchorsList.js";import"../../../../../Select/index.js";import"../../../../../Select/SelectFilterBy.js";import"../../../../../CustomSelect/index.js";import"../../../../../Tabs/Tabs.js";import"../../../../../Tabs/Tab.js";import"../../../../../ResizableTable/ResizableTable.js";import"../../../../../GradientPicker/GradientPicker.js";import"@babel/runtime/helpers/classCallCheck";import"@babel/runtime/helpers/createClass";import"../../../../../GradientManager/GradientPreview/GradientPreview.js";import"../../../../../GradientManager/GradientSelect.scss.js";import"../../../../../GradientManager/GradientManager.styles.js";import"../../../../../Drillstring/BHASchematic.js";import"../../../../../Drillstring/BHATable/index.js";import"../../../../../Drillstring/BHAComponentIcon.js";import"../../../../../Drillstring/BHAComponentDetail/index.js";import"../../../../../Drillstring/BHATileIcon.js";import"../../../../../Drillstring/BHATile/BHATile.js";import"../../../../../Drillstring/BHAList/BHAList.js";import"../../../../../Drillstring/BHAComponentsTable/BHAComponentsTable.js";import"../../../../../Casing/CasingTable/index.js";import"../../../../../Casing/CasingComponentIcon.js";import"../../../../../Casing/CasingTileIcon.js";import"../../../../../Casing/CasingTableV2/CasingTableV2.js";import"../../../../../Casing/CasingTile/CasingTile.js";import"../../../../../WellSummary/WellSummaryItemLabel.js";import"../../../../../WellSummary/WellSummaryItemTitle.js";import"../../../../../WellSummary/WellSummaryItemValue.js";import"../../../../../WellSummary/ActivitySummaryChart.js";import"../../../../../WellSummary/FracWirelineTimeChart.js";import"../../../../../BICOffsetPickerDialog/index.js";import"../../../../../OffsetWellButton/OffsetWellButton.js";import"../../../../../OffsetWellPickerV2/OffsetWellPickerDialog.js";import"../../../../index.js";import"../../../../../OffsetWellChips/Chip.js";import"../../../../../OffsetWellChips/ChipsContainer.js";import"../../../../../OffsetWellPickerV5/components/OffsetWellPickerV5WithStore/OffsetWellPickerV5WithStore.js";import"mapbox-gl/dist/mapbox-gl.css";import"@material-ui/icons/Info";import"@material-ui/icons/Block";import"../../../../../OffsetWellMap/WellTooltip.module.css.js";import"../../../../../OffsetWellMap/OffsetWellMap.module.css.js";import"../../../../../../config/mapboxGl/index.js";import"../../../../../../config/mapbox/index.js";import"react-dom";import"@material-ui/core/Snackbar";import"../../../../../Notifications/Toast.js";import"../../../../../Notifications/Notifications.scss.js";import"../../../../../TextLink/index.js";import"../../../../../Avatar/index.js";import"../../../../../Template/TemplatePopover/index.js";import"../../../../../Template/TemplateSharingDialog/index.js";import"../../../../../MenuItem/index.js";import"../../../../../MiddleTruncate/MiddleTruncate.js";import"../../../../../PinnableFilters/PinnableFilters.js";import"../../../../../HeaderLayout/HeaderLayout.js";import"../../../../../PadOffsetsPicker/PadOffsetsPicker.js";import"../../../../../PadOffsetsPicker/OffsetAssetChip.js";import"../../../../../PadOffsetsPicker/OffsetAssetsListExpander.js";import"../../../../../PadOffsetsPicker/StagesSelector.js";import"../../../../../PadOffsetsPickerV2/PadOffsetsPickerV2.js";import"../../../../../Table/TableToolbar/TableToolbar.js";import"../../../../../Table/TableContainer/TableContainer.js";import"../../../../../Table/TableCell/TableCell.js";import"../../../../../Table/TablePagination/TablePagination.js";import"../../../../../Table/TablePaginationActions/TablePaginationActions.js";import"../../../../../Tooltip/ScrollableTooltip.js";import"../../../../../PriceInput/PriceInput.js";import"../../../../../LabelsCounter/LabelsCounter.js";import"../../../../../Stepper/Stepper.js";import"../../../../../Stepper/Step/Step.js";import"../../../../../Stepper/StepsWrapper.js";import"../../../../../Comment/CommentIcon/index.js";import"../../../../../FilesLoader/FilesLoader.js";import"../../../../../../componentsV2/FileIcon/icons/ArchiveFileIcon.js";import"../../../../../../componentsV2/FileIcon/icons/CSVFileIcon.js";import"../../../../../../componentsV2/FileIcon/icons/DocFileIcon.js";import"../../../../../../componentsV2/FileIcon/icons/EDMFileIcon.js";import"../../../../../../componentsV2/FileIcon/icons/ExcelFileIcon.js";import"../../../../../../componentsV2/FileIcon/icons/ImageFileIcon.js";import"../../../../../../componentsV2/FileIcon/icons/JsonFileIcon.js";import"../../../../../../componentsV2/FileIcon/icons/LasFileIcon.js";import"../../../../../../componentsV2/FileIcon/icons/OtherFileIcon.js";import"../../../../../../componentsV2/FileIcon/icons/PdfFileIcon.js";import"../../../../../../componentsV2/FileIcon/icons/PowerPointFileIcon.js";import"../../../../../../componentsV2/FileIcon/icons/TxtFileIcon.js";import"../../../../../../componentsV2/FileIcon/icons/UnknownFileIcon.js";import"../../../../../../componentsV2/FileIcon/icons/VideoFileIcon.js";import"../../../../../../componentsV2/FileIcon/icons/XmlFileIcon.js";import"../../../../../SearchInput/index.js";import"../../../../../FeedItem/FeedItem.js";import"../../../../../FeedItem/FeedItemEditProvider/FeedItemEditProvider.js";import"../../../../../PostInput/PostInput.js";import"../../../../../KeyboardDateTimePicker.js";import"../../../../../AddComment/Popover.js";import"../../../../../AddComment/Popup.js";import"../../../../../StageDesignVActual/ComparisonBar/ComparisonBar.js";import"../../../../../StageDesignVActual/ElementsComparison/ElementsComparison.js";import"../../../../../StageDesignVActual/ComparisonHeader.js";import"../../../../../StageDesignVActual/ComparisonRow.js";import"../../../../../EmbeddedApp/DevCenterEmbeddedApp.js";import"../../../../../EmbeddedApp/EmbeddedApp.js";import"../../../../../Autocomplete/Autocomplete.js";import"../../../../../DocumentViewer/DocumentViewer.js";import"../../../../../ColorPickerPalette/ColorPickerPalette.js";import"../../../../../Search/Search.js";import"../../../../../Search/components/Listbox.js";import"../../../../../Search/components/Paper.js";import"../../../../../Search/components/RecentSearches.js";import"../../../../../Search/components/Groups.js";import"../../../../../Search/components/SelectAllListItem.js";import"../../../../../StatusBadge/index.js";import"../../../../../Attachment/index.js";import"../../../../../EmojiIconButton.js";import"../../../../../FileUploadIconButton.js";import"../../../../../FilePreview/index.js";import"../../../../../FailedFileUploading.js";import"../../../../../UserMention/index.js";import"../../../../../CommentsInfo/index.js";import"../../../../../CommentInput/index.js";import"../../../../../Comment/index.js";import"../../../../../CommentLoader.js";import"../../../../../AssetNameLabel/AssetStatusBadge.js";import"../../../../../AssetEditorV2/components/PrimaryAssetSelect.js";import"../../../../../AssetEditorV2/components/SecondaryAssetSelect.js";import"../../../../../AssetEditorV2/components/SelectItem.js";import"../../../../../AssetEditorV2/components/MultipleAssetsToggle.js";import"../../../../../AssetEditorV2/components/PrimaryAssetSelectV2.js";import"../../../../../EChartsWrapper/EChartsWrapper.js";import"../../../../../AssetsMultipleSelector/AssetsMultipleSelector.js";import"@material-ui/icons/Close";import"@material-ui/icons/GetApp";import"../../../../../GoogleDocsViewer/index.js";import"../../../../../NewDocumentViewer/effects/useFileContent.js";import"../../../../../NewDocumentViewer/styles.js";import"../../../../../FilesLoaderV2/styles.js";import"../../../../../FilesDropzone/styles.js";import"../../../../../FilesProcessor/styles.js";import"../../../../../Hint/styles.js";import"@babel/runtime/helpers/taggedTemplateLiteral";import"fparser";import"../../../../../Formula/useFormulaStyles.js";import"../../../../../Formula/RootXIcon.js";import"../../../../../Formula/FormulaTextEditor.js";import"../../../../../Formula/CloseSuggestion.js";import"../../../../../Formula/SuggestionsMenu.js";import"../../../../../CommentCard/CommentCard.js";import"@material-ui/icons/AlternateEmail";import"../../../../../AttachFileButton/AttachFileButton.scss.js";import"../../../../../CommentInputNext/CommentInputNext.js";import"../../../../../UserMention/utils/index.js";import"react-s3-uploader/s3upload";import"../../../../../CommentComposer/CommentMetaLine.scss.js";import"../../../../../CommentComposer/ChatChannelSelector.scss.js";import"../../../../../CommentComposer/ShareToChatRow.scss.js";import"../../../../../CommentComposer/CommentComposer.scss.js";import"../../../../../AttachmentPreview/AttachmentPreview.js";import"../../../../../AttachmentPreview/AttachmentImage.js";import"../../../../../AttachmentPreview/AttachmentPreview.scss.js";import"../../../../../CommentPin/CommentPin.js";import"../../../../../FeedCard/FeedCard.js";import"../../../../../FeedItemCard/FeedItemCard.js";import"../../../../../NewCommentCursor/NewCommentCursor.js";import"../../../../../LinkedText/LinkedText.js";import"../../../../../FeedItem/feedItemTypes/AlertFeedItem.js";import"../../../../../FeedItem/feedItemTypes/PostFeedItem.js";import"../../../../../FeedItem/feedItemTypes/GeosteeringFeedItem.js";import"../../../../../FeedItem/feedItemTypes/DrillingOperationalNoteFeedItem.js";import"../../../../../FeedItem/feedItemTypes/DrillingOperationSummaryFeedItem.js";import"../../../../../FeedItem/feedItemTypes/DrillingDailyCostFeedItem.js";import"../../../../../FeedItem/feedItemTypes/DocumentFeedItem.js";import"../../../../../FeedItem/feedItemTypes/DrillerMemoFeedItem.js";import"../../../../../FeedItem/feedItemTypes/NptFeedItem.js";import"../../../../../FeedItem/feedItemTypes/SurveyStationFeedItem/index.js";import"../../../../../FeedItem/feedItemTypes/LessonsLearnedFeedItem/index.js";import"../../../../../FeedItem/feedItemTypes/TracesMemoFeedItem.js";import"../../../../../FeedItem/feedItemTypes/DepthCommentFeedItem.js";import"../../../../../FeedItem/feedItemTypes/CompletionOperationalNoteFeedItem.js";import"../../../../../FeedItem/feedItemTypes/CompletionOperationSummaryFeedItem.js";import"../../../../../FeedItem/feedItemTypes/CompletionDailyCostFeedItem.js";import"../../../../../FeedItem/feedItemTypes/CompletionDocumentFeedItem.js";import"../../../../../FeedItem/feedItemTypes/CompletionNptFeedItem.js";import"../../../../../FeedItem/feedItemTypes/StageOverviewFeedItem/index.js";import"../../../../../FeedItem/feedItemTypes/AppAnnotationFeedItem/index.js";import"../../../../../FeedItem/feedItemTypes/WellPlanFeedItem/index.js";import"../../../../../FeedItem/feedItemTypes/FluidReportFeedItem.js";import"../../../../../FeedItem/feedItemTypes/BhaFeedItem/BhaFeedItem.js";import"../../../../../FeedItem/feedItemTypes/DvDCommentFeedItem.js";import"../../../../../FeedItem/feedItemTypes/PCCommentFeedItem.js";import"../../../../../FeedItem/feedItemTypes/HookloadCommentFeedItem.js";import"../../../../../FeedItem/feedItemTypes/NptLessonsCommentFeedItem.js";import"../../../../../FeedItem/feedItemTypes/GenericDataCommentFeedItem.js";function A(s){var i=s.metricsKeys,A=s.onChange,V=s.classes,S=o([]),g=e(S,2),h=g[0],T=g[1],F=o(null),v=e(F,2),D=v[0],P=v[1];t((function(){T(i)}),[i]);return j(u,{children:[C(I,{tooltipProps:{title:"Add Metric"},size:"small",onClick:function(e){P(e.currentTarget)},children:C(c,{size:"small"})}),C(n,{id:"simple-menu",anchorEl:D,getContentAnchorEl:null,anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"bottom",horizontal:"right"},PaperProps:{style:{maxHeight:"300px",backgroundColor:"#414141"}},keepMounted:!0,open:Boolean(D),onClose:function(){P(null),a(h,i)||A(h)},children:l.map((function(e){return j(r,{disabled:h.length===d&&!h.includes(e.key),onClick:function(){return o=e.key,void(h.includes(o)?T((function(e){return e.filter((function(e){return e!==o}))})):T((function(e){return e.concat(o)})));var o},children:[C(p,{checked:h.includes(e.key),className:V.checkBox}),C(m,{primary:e.label,classes:{primary:V.listItemPrimaryText}})]},e.key)}))})]})}A.propTypes={metricsKeys:s.arrayOf(s.string).isRequired,onChange:s.func.isRequired,classes:s.shape({}).isRequired};var V=i({listItemPrimaryText:{color:"#fff",fontSize:"14px"},checkBox:{color:"grey",padding:"5px"}})(A);export{V as default};
2
2
  //# sourceMappingURL=MetricsAddMenu.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"MetricsAddMenu.js","sources":["../../../../../../../src/components/OffsetWellPickerV3/components/CustomSelectionView/components/Table/MetricsAddMenu.js"],"sourcesContent":["import { useState, useEffect } from 'react';\nimport PropTypes from 'prop-types';\nimport { Menu, MenuItem, Checkbox, ListItemText, withStyles } from '@material-ui/core';\nimport SettingsIcon from '@material-ui/icons/Settings';\nimport { isEqual } from 'lodash';\n\nimport { METRICS_LIST, MAX_METRICS_COUNT } from '../../constants';\n\nimport { IconButton as IconButtonComponent } from '~/components';\n\nconst muiStyles = {\n listItemPrimaryText: {\n color: '#fff',\n fontSize: '14px',\n },\n checkBox: {\n color: 'grey',\n padding: '5px',\n },\n};\n\nfunction MetricsAddMenu({ metricsKeys, onChange, classes }) {\n const [selectedKeys, setSelectedKeys] = useState([]);\n const [anchorEl, setAnchorEl] = useState(null);\n\n useEffect(() => {\n // NOTE: If there are >=2 columns, metrics keys can be duplicated\n setSelectedKeys(metricsKeys);\n }, [metricsKeys]);\n\n const handleClick = event => {\n setAnchorEl(event.currentTarget);\n };\n\n const handleClose = () => {\n setAnchorEl(null);\n if (!isEqual(selectedKeys, metricsKeys)) {\n onChange(selectedKeys);\n }\n };\n\n const handleChangeMetrics = newKey => {\n if (selectedKeys.includes(newKey)) {\n setSelectedKeys(prevKeys => prevKeys.filter(key => key !== newKey));\n } else {\n setSelectedKeys(prevKeys => prevKeys.concat(newKey));\n }\n };\n\n return (\n <>\n <IconButtonComponent\n tooltipProps={{ title: 'Add Metric' }}\n size=\"small\"\n onClick={handleClick}\n >\n <SettingsIcon size=\"small\" />\n </IconButtonComponent>\n\n <Menu\n id=\"simple-menu\"\n anchorEl={anchorEl}\n getContentAnchorEl={null}\n anchorOrigin={{\n vertical: 'top',\n horizontal: 'right',\n }}\n transformOrigin={{\n vertical: 'bottom',\n horizontal: 'right',\n }}\n PaperProps={{\n style: {\n maxHeight: '300px',\n backgroundColor: '#414141',\n },\n }}\n keepMounted\n open={Boolean(anchorEl)}\n onClose={handleClose}\n >\n {METRICS_LIST.map(item => (\n <MenuItem\n disabled={selectedKeys.length === MAX_METRICS_COUNT && !selectedKeys.includes(item.key)}\n key={item.key}\n onClick={() => handleChangeMetrics(item.key)}\n >\n <Checkbox checked={selectedKeys.includes(item.key)} className={classes.checkBox} />\n <ListItemText primary={item.label} classes={{ primary: classes.listItemPrimaryText }} />\n </MenuItem>\n ))}\n </Menu>\n </>\n );\n}\n\nMetricsAddMenu.propTypes = {\n metricsKeys: PropTypes.arrayOf(PropTypes.string).isRequired,\n onChange: PropTypes.func.isRequired,\n classes: PropTypes.shape({}).isRequired,\n};\n\nexport default withStyles(muiStyles)(MetricsAddMenu);\n"],"names":["MetricsAddMenu","_ref","metricsKeys","onChange","classes","useState","_useState2","_slicedToArray","_useState","selectedKeys","setSelectedKeys","_useState4","_useState3","anchorEl","setAnchorEl","useEffect","_jsxs","_Fragment","children","_jsx","IconButtonComponent","tooltipProps","title","size","onClick","event","currentTarget","SettingsIcon","Menu","id","getContentAnchorEl","anchorOrigin","vertical","horizontal","transformOrigin","PaperProps","style","maxHeight","backgroundColor","keepMounted","open","Boolean","onClose","isEqual","METRICS_LIST","map","item","MenuItem","disabled","length","MAX_METRICS_COUNT","includes","key","newKey","prevKeys","filter","concat","Checkbox","checked","className","checkBox","ListItemText","primary","label","listItemPrimaryText","propTypes","PropTypes","arrayOf","string","isRequired","func","shape","MetricsAddMenu$1","withStyles","color","fontSize","padding"],"mappings":"i1hCAqBA,SAASA,EAAmDC,GAAA,IAAlCC,IAAAA,YAAaC,IAAAA,SAAUC,IAAAA,QACPC,EAAAA,EAAS,IAAGC,EAAAC,EAAAC,EAAA,GAA7CC,EAAYH,EAAA,GAAEI,EAAeJ,EAAA,GACJD,EAAAA,EAAS,MAAKM,EAAAJ,EAAAK,EAAA,GAAvCC,EAAQF,EAAA,GAAEG,EAAWH,EAAA,GAE5BI,GAAU,WAERL,EAAgBR,EAClB,GAAG,CAACA,IAqBJ,OACEc,EAAAC,EAAA,CAAAC,SAAA,CACEC,EAACC,EAAmB,CAClBC,aAAc,CAAEC,MAAO,cACvBC,KAAK,QACLC,QAxBc,SAAAC,GAClBX,EAAYW,EAAMC,gBAuBOR,SAErBC,EAACQ,EAAY,CAACJ,KAAK,YAGrBJ,EAACS,EAAI,CACHC,GAAG,cACHhB,SAAUA,EACViB,mBAAoB,KACpBC,aAAc,CACZC,SAAU,MACVC,WAAY,SAEdC,gBAAiB,CACfF,SAAU,SACVC,WAAY,SAEdE,WAAY,CACVC,MAAO,CACLC,UAAW,QACXC,gBAAiB,YAGrBC,aAAW,EACXC,KAAMC,QAAQ5B,GACd6B,QA7Cc,WAClB5B,EAAY,MACP6B,EAAQlC,EAAcP,IACzBC,EAASM,IA0CcS,SAEpB0B,EAAaC,KAAI,SAAAC,GAAI,OACpB9B,EAAC+B,EAAQ,CACPC,SAAUvC,EAAawC,SAAWC,IAAsBzC,EAAa0C,SAASL,EAAKM,KAEnF5B,QAAS,WAAA,OA5CS6B,EA4CiBP,EAAKM,SA3C5C3C,EAAa0C,SAASE,GACxB3C,GAAgB,SAAA4C,GAAQ,OAAIA,EAASC,QAAO,SAAAH,GAAG,OAAIA,IAAQC,QAE3D3C,GAAgB,SAAA4C,GAAQ,OAAIA,EAASE,OAAOH,OAJpB,IAAAA,CA4C2B,EAAAnC,SAAA,CAE7CC,EAACsC,EAAQ,CAACC,QAASjD,EAAa0C,SAASL,EAAKM,KAAMO,UAAWvD,EAAQwD,WACvEzC,EAAC0C,EAAY,CAACC,QAAShB,EAAKiB,MAAO3D,QAAS,CAAE0D,QAAS1D,EAAQ4D,yBAJ1DlB,EAAKM,YAUtB,CAEApD,EAAeiE,UAAY,CACzB/D,YAAagE,EAAUC,QAAQD,EAAUE,QAAQC,WACjDlE,SAAU+D,EAAUI,KAAKD,WACzBjE,QAAS8D,EAAUK,MAAM,CAAA,GAAIF,YAG/B,IAAAG,EAAeC,EA5FG,CAChBT,oBAAqB,CACnBU,MAAO,OACPC,SAAU,QAEZf,SAAU,CACRc,MAAO,OACPE,QAAS,QAqFEH,CAAsBzE"}
1
+ {"version":3,"file":"MetricsAddMenu.js","sources":["../../../../../../../src/components/OffsetWellPickerV3/components/CustomSelectionView/components/Table/MetricsAddMenu.js"],"sourcesContent":["import { useState, useEffect } from 'react';\nimport PropTypes from 'prop-types';\nimport { Menu, MenuItem, Checkbox, ListItemText, withStyles } from '@material-ui/core';\nimport SettingsIcon from '@material-ui/icons/Settings';\nimport { isEqual } from 'lodash';\n\nimport { METRICS_LIST, MAX_METRICS_COUNT } from '../../constants';\n\nimport { IconButton as IconButtonComponent } from '~/components';\n\nconst muiStyles = {\n listItemPrimaryText: {\n color: '#fff',\n fontSize: '14px',\n },\n checkBox: {\n color: 'grey',\n padding: '5px',\n },\n};\n\nfunction MetricsAddMenu({ metricsKeys, onChange, classes }) {\n const [selectedKeys, setSelectedKeys] = useState([]);\n const [anchorEl, setAnchorEl] = useState(null);\n\n useEffect(() => {\n // NOTE: If there are >=2 columns, metrics keys can be duplicated\n setSelectedKeys(metricsKeys);\n }, [metricsKeys]);\n\n const handleClick = event => {\n setAnchorEl(event.currentTarget);\n };\n\n const handleClose = () => {\n setAnchorEl(null);\n if (!isEqual(selectedKeys, metricsKeys)) {\n onChange(selectedKeys);\n }\n };\n\n const handleChangeMetrics = newKey => {\n if (selectedKeys.includes(newKey)) {\n setSelectedKeys(prevKeys => prevKeys.filter(key => key !== newKey));\n } else {\n setSelectedKeys(prevKeys => prevKeys.concat(newKey));\n }\n };\n\n return (\n <>\n <IconButtonComponent\n tooltipProps={{ title: 'Add Metric' }}\n size=\"small\"\n onClick={handleClick}\n >\n <SettingsIcon size=\"small\" />\n </IconButtonComponent>\n\n <Menu\n id=\"simple-menu\"\n anchorEl={anchorEl}\n getContentAnchorEl={null}\n anchorOrigin={{\n vertical: 'top',\n horizontal: 'right',\n }}\n transformOrigin={{\n vertical: 'bottom',\n horizontal: 'right',\n }}\n PaperProps={{\n style: {\n maxHeight: '300px',\n backgroundColor: '#414141',\n },\n }}\n keepMounted\n open={Boolean(anchorEl)}\n onClose={handleClose}\n >\n {METRICS_LIST.map(item => (\n <MenuItem\n disabled={selectedKeys.length === MAX_METRICS_COUNT && !selectedKeys.includes(item.key)}\n key={item.key}\n onClick={() => handleChangeMetrics(item.key)}\n >\n <Checkbox checked={selectedKeys.includes(item.key)} className={classes.checkBox} />\n <ListItemText primary={item.label} classes={{ primary: classes.listItemPrimaryText }} />\n </MenuItem>\n ))}\n </Menu>\n </>\n );\n}\n\nMetricsAddMenu.propTypes = {\n metricsKeys: PropTypes.arrayOf(PropTypes.string).isRequired,\n onChange: PropTypes.func.isRequired,\n classes: PropTypes.shape({}).isRequired,\n};\n\nexport default withStyles(muiStyles)(MetricsAddMenu);\n"],"names":["MetricsAddMenu","_ref","metricsKeys","onChange","classes","useState","_useState2","_slicedToArray","_useState","selectedKeys","setSelectedKeys","_useState4","_useState3","anchorEl","setAnchorEl","useEffect","_jsxs","_Fragment","children","_jsx","IconButtonComponent","tooltipProps","title","size","onClick","event","currentTarget","SettingsIcon","Menu","id","getContentAnchorEl","anchorOrigin","vertical","horizontal","transformOrigin","PaperProps","style","maxHeight","backgroundColor","keepMounted","open","Boolean","onClose","isEqual","METRICS_LIST","map","item","MenuItem","disabled","length","MAX_METRICS_COUNT","includes","key","newKey","prevKeys","filter","concat","Checkbox","checked","className","checkBox","ListItemText","primary","label","listItemPrimaryText","propTypes","PropTypes","arrayOf","string","isRequired","func","shape","MetricsAddMenu$1","withStyles","color","fontSize","padding"],"mappings":"uniCAqBA,SAASA,EAAmDC,GAAA,IAAlCC,IAAAA,YAAaC,IAAAA,SAAUC,IAAAA,QACPC,EAAAA,EAAS,IAAGC,EAAAC,EAAAC,EAAA,GAA7CC,EAAYH,EAAA,GAAEI,EAAeJ,EAAA,GACJD,EAAAA,EAAS,MAAKM,EAAAJ,EAAAK,EAAA,GAAvCC,EAAQF,EAAA,GAAEG,EAAWH,EAAA,GAE5BI,GAAU,WAERL,EAAgBR,EAClB,GAAG,CAACA,IAqBJ,OACEc,EAAAC,EAAA,CAAAC,SAAA,CACEC,EAACC,EAAmB,CAClBC,aAAc,CAAEC,MAAO,cACvBC,KAAK,QACLC,QAxBc,SAAAC,GAClBX,EAAYW,EAAMC,gBAuBOR,SAErBC,EAACQ,EAAY,CAACJ,KAAK,YAGrBJ,EAACS,EAAI,CACHC,GAAG,cACHhB,SAAUA,EACViB,mBAAoB,KACpBC,aAAc,CACZC,SAAU,MACVC,WAAY,SAEdC,gBAAiB,CACfF,SAAU,SACVC,WAAY,SAEdE,WAAY,CACVC,MAAO,CACLC,UAAW,QACXC,gBAAiB,YAGrBC,aAAW,EACXC,KAAMC,QAAQ5B,GACd6B,QA7Cc,WAClB5B,EAAY,MACP6B,EAAQlC,EAAcP,IACzBC,EAASM,IA0CcS,SAEpB0B,EAAaC,KAAI,SAAAC,GAAI,OACpB9B,EAAC+B,EAAQ,CACPC,SAAUvC,EAAawC,SAAWC,IAAsBzC,EAAa0C,SAASL,EAAKM,KAEnF5B,QAAS,WAAA,OA5CS6B,EA4CiBP,EAAKM,SA3C5C3C,EAAa0C,SAASE,GACxB3C,GAAgB,SAAA4C,GAAQ,OAAIA,EAASC,QAAO,SAAAH,GAAG,OAAIA,IAAQC,QAE3D3C,GAAgB,SAAA4C,GAAQ,OAAIA,EAASE,OAAOH,OAJpB,IAAAA,CA4C2B,EAAAnC,SAAA,CAE7CC,EAACsC,EAAQ,CAACC,QAASjD,EAAa0C,SAASL,EAAKM,KAAMO,UAAWvD,EAAQwD,WACvEzC,EAAC0C,EAAY,CAACC,QAAShB,EAAKiB,MAAO3D,QAAS,CAAE0D,QAAS1D,EAAQ4D,yBAJ1DlB,EAAKM,YAUtB,CAEApD,EAAeiE,UAAY,CACzB/D,YAAagE,EAAUC,QAAQD,EAAUE,QAAQC,WACjDlE,SAAU+D,EAAUI,KAAKD,WACzBjE,QAAS8D,EAAUK,MAAM,CAAA,GAAIF,YAG/B,IAAAG,EAAeC,EA5FG,CAChBT,oBAAqB,CACnBU,MAAO,OACPC,SAAU,QAEZf,SAAU,CACRc,MAAO,OACPE,QAAS,QAqFEH,CAAsBzE"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/OffsetWellPickerV3/components/CustomSelectionView/effects/index.js"],"names":[],"mappings":"AASA,OAAO,EAAE,OAAO,IAAI,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AAIhF,wBAAgB,WAAW,CAAC,KAAK,KAAA,aAMhC;AAED,wBAAgB,mBAAmB,CAAC,SAAS,KAAA,QAmB5C;AAED,wBAAgB,QAAQ,CAAC,SAAS,KAAA,EAAE,qBAAqB,KAAA,QAcxD;AAED,wBAAgB,gBAAgB,CAAC,cAAc,KAAA,EAAE,gBAAgB,KAAA,EAAE,QAAQ,KAAA,QA0B1E;AAED,wBAAgB,kBAAkB,CAAC,KAAK,KAAA,EAAE,WAAW,KAAA,QA8BpD;AAED,wBAAgB,cAAc,CAAC,MAAM,KAAA,EAAE,QAAQ,KAAA,EAAE,eAAe,KAAA,QAqB/D;AAED,wBAAgB,cAAc,CAAC,SAAS,KAAA,EAAE,KAAK,KAAA,sBAkE9C;AAED,wBAAgB,cAAc,CAAC,MAAM,KAAA,EAAE,uBAAuB,KAAA,EAAE,kBAAkB,KAAA,QAgBjF"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/OffsetWellPickerV3/components/CustomSelectionView/effects/index.js"],"names":[],"mappings":"AASA,OAAO,EAAE,OAAO,IAAI,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AAEhF,wBAAgB,WAAW,CAAC,KAAK,KAAA,aAMhC;AAED,wBAAgB,mBAAmB,CAAC,SAAS,KAAA,QAmB5C;AAED,wBAAgB,QAAQ,CAAC,SAAS,KAAA,EAAE,qBAAqB,KAAA,QAcxD;AAED,wBAAgB,gBAAgB,CAAC,cAAc,KAAA,EAAE,gBAAgB,KAAA,EAAE,QAAQ,KAAA,QA0B1E;AAED,wBAAgB,kBAAkB,CAAC,KAAK,KAAA,EAAE,WAAW,KAAA,QA8BpD;AAED,wBAAgB,cAAc,CAAC,MAAM,KAAA,EAAE,QAAQ,KAAA,EAAE,eAAe,KAAA,QAqB/D;AAED,wBAAgB,cAAc,CAAC,SAAS,KAAA,EAAE,KAAK,KAAA,sBAkE9C;AAED,wBAAgB,cAAc,CAAC,MAAM,KAAA,EAAE,uBAAuB,KAAA,EAAE,kBAAkB,KAAA,QAgBjF"}
@@ -1,2 +1,2 @@
1
- import t from"@babel/runtime/helpers/defineProperty";import n from"@babel/runtime/helpers/asyncToGenerator";import r from"@babel/runtime/helpers/slicedToArray";import e from"@babel/runtime/regenerator";import{useState as o,useEffect as i,useRef as s}from"react";import{get as a}from"lodash";import{fetchCompanyGoals as c,fetchWells as u,fetchMetricsData as f}from"../../../utils/apiCalls.js";import{FILTERS as l,METRICS_KEYS as p}from"../constants.js";import{mapbox as m}from"../../../../../utils/index.js";import{BENCHMARK_METRIC_GOAL as h}from"../../../../../constants/goals.js";import"../../../../../constants/segment.js";import"../../../../../constants/alerts.js";import"../../../../../constants/apps.js";import"../../../../../constants/drillstring.js";import"../../../../../constants/completion.js";import"../../../../../constants/appPackages.js";import"../../../../../constants/notifications.js";import"../../../../../constants/feed.js";import"../../../../../constants/bha.js";import"../../../../../constants/corvaCompanyId.js";import"../../../../GradientManager/configuration/constants.js";export{default as useBidirectionalFiltering}from"./biDirectionalFiltering.js";import{getCompanyGoalSetting as d}from"../../../../../utils/goals.js";function v(t,n){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var e=Object.getOwnPropertySymbols(t);n&&(e=e.filter((function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable}))),r.push.apply(r,e)}return r}function b(n){for(var r=1;r<arguments.length;r++){var e=null!=arguments[r]?arguments[r]:{};r%2?v(Object(e),!0).forEach((function(r){t(n,r,e[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(e)):v(Object(e)).forEach((function(t){Object.defineProperty(n,t,Object.getOwnPropertyDescriptor(e,t))}))}return n}var j=m.getAssetV2Coordinates,y=m.getDistanceByCoordinates;function g(t){var s=o(null),a=r(s,2),u=a[0],f=a[1];return i((function(){function r(){return(r=n(e.mark((function n(){var r,o;return e.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,c(t);case 2:r=n.sent,o=d(r,h),f(o);case 5:case"end":return n.stop()}}),n)})))).apply(this,arguments)}f(null),function(){r.apply(this,arguments)}()}),[t]),u}function O(t,s){var a=o(null),c=r(a,2),f=c[0],l=c[1];return i((function(){function r(){return(r=n(e.mark((function n(){var r;return e.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(!t){n.next=6;break}return n.next=3,u(t,s);case 3:n.t0=n.sent,n.next=7;break;case 6:n.t0=null;case 7:r=n.t0,l(r);case 9:case"end":return n.stop()}}),n)})))).apply(this,arguments)}l(null),function(){r.apply(this,arguments)}()}),[t]),f}function w(t,n,e){var s=o(null),a=r(s,2),c=a[0],u=a[1],f=/\sST0/g;return i((function(){if(e){var r=Object.values(l).reduce((function(n,r){return n.filter((function(n){return e=n[r],!(o=t[r])||0===o.length||o.includes(e);var e,o}))}),e).filter((function(t){return n&&!t.name.match(f)||!n}));u(r)}else u(null)}),[e,t,n]),c}function x(t,n){var e=o(null),s=r(e,2),a=s[0],c=s[1];return i((function(){if(t){var r=n&&j(n,"topHole");if(r){var e=[];t.forEach((function(t){var n=j(t,"topHole");if(n){var o=parseFloat(y(r,n));e.push(b(b({},t),{},{distance:o}))}else e.push(t)})),c(e)}else c(t)}else c(t)}),[t,n]),a}function P(t,n,e){var s=o(null),a=r(s,2),c=a[0],u=a[1];return i((function(){if(n){var t=[];n.forEach((function(n){e.includes(n.id)&&n.is_usable&&t.push(n)})),u(t)}else u(null)}),[t,n,e]),c}function E(t,c){var u=s({}),l=o(!0),m=r(l,2),h=m[0],d=m[1],v=o(null),j=r(v,2),y=j[0],g=j[1];return i((function(){function r(){return(r=n(e.mark((function n(r){var o,i,s;return e.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,f(t,r);case 2:o=n.sent,i={},r.forEach((function(t){var n={},r=o.filter((function(n){return a(n,"asset_id")===t}));p.forEach((function(t){var e=r.find((function(n){return a(n,"data.key")===t})),o=a(e,"data.value");n[t]=Number.isFinite(o)?parseFloat(o).toFixed(2):null})),i[t]=n})),u.current=b(b({},u.current),i),s=[],c.forEach((function(t){s.push(b(b({},t),u.current[t.id]))})),d(!1),g(s);case 10:case"end":return n.stop()}}),n)})))).apply(this,arguments)}if(c)if(0!==c.length){var o=[];c.forEach((function(t){u.current[t.id]||o.push(t.id)})),d(!0),function(t){r.apply(this,arguments)}(o)}else g([]);else g(null)}),[c]),[h,y]}function k(t,n,r){var e=s(!1);i((function(){if(n){if(e.current){var o=[];n.forEach((function(n){n.distance<=t&&o.push(n.id)})),r(o)}e.current=!0}}),[t,n])}export{g as useCompanyMetricKey,w as useFilteredWells,E as useMetricsData,P as useOffsetWells,k as useRadiusWells,O as useWells,x as useWellsWithCoords};
1
+ import t from"@babel/runtime/helpers/defineProperty";import n from"@babel/runtime/helpers/asyncToGenerator";import r from"@babel/runtime/helpers/slicedToArray";import e from"@babel/runtime/regenerator";import{useState as o,useEffect as i,useRef as s}from"react";import{get as a}from"lodash";import{fetchCompanyGoals as c,fetchWells as u,fetchMetricsData as f}from"../../../utils/apiCalls.js";import{FILTERS as l,METRICS_KEYS as p}from"../constants.js";import{mapbox as m}from"../../../../../utils/index.js";import{BENCHMARK_METRIC_GOAL as h}from"../../../../../constants/goals.js";import"../../../../../constants/segment.js";import"../../../../../constants/alerts.js";import"../../../../../constants/apps.js";import"../../../../../constants/drillstring.js";import"../../../../../constants/completion.js";import"../../../../../constants/appPackages.js";import"../../../../../constants/notifications.js";import"../../../../../constants/feed.js";import"../../../../../constants/bha.js";import"../../../../../constants/corvaCompanyId.js";import"../../../../GradientManager/configuration/constants.js";export{default as useBidirectionalFiltering}from"./biDirectionalFiltering.js";import{getCompanyGoalSetting as d}from"../../../../../utils/goals.js";function v(t,n){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var e=Object.getOwnPropertySymbols(t);n&&(e=e.filter((function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable}))),r.push.apply(r,e)}return r}function b(n){for(var r=1;r<arguments.length;r++){var e=null!=arguments[r]?arguments[r]:{};r%2?v(Object(e),!0).forEach((function(r){t(n,r,e[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(e)):v(Object(e)).forEach((function(t){Object.defineProperty(n,t,Object.getOwnPropertyDescriptor(e,t))}))}return n}function j(t){var s=o(null),a=r(s,2),u=a[0],f=a[1];return i((function(){function r(){return(r=n(e.mark((function n(){var r,o;return e.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,c(t);case 2:r=n.sent,o=d(r,h),f(o);case 5:case"end":return n.stop()}}),n)})))).apply(this,arguments)}f(null),function(){r.apply(this,arguments)}()}),[t]),u}function g(t,s){var a=o(null),c=r(a,2),f=c[0],l=c[1];return i((function(){function r(){return(r=n(e.mark((function n(){var r;return e.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(!t){n.next=6;break}return n.next=3,u(t,s);case 3:n.t0=n.sent,n.next=7;break;case 6:n.t0=null;case 7:r=n.t0,l(r);case 9:case"end":return n.stop()}}),n)})))).apply(this,arguments)}l(null),function(){r.apply(this,arguments)}()}),[t]),f}function y(t,n,e){var s=o(null),a=r(s,2),c=a[0],u=a[1],f=/\sST0/g;return i((function(){if(e){var r=Object.values(l).reduce((function(n,r){return n.filter((function(n){return e=n[r],!(o=t[r])||0===o.length||o.includes(e);var e,o}))}),e).filter((function(t){return n&&!t.name.match(f)||!n}));u(r)}else u(null)}),[e,t,n]),c}function O(t,n){var e=o(null),s=r(e,2),a=s[0],c=s[1];return i((function(){if(t){var r=n&&m.getAssetV2Coordinates(n,"topHole");if(r){var e=[];t.forEach((function(t){var n=m.getAssetV2Coordinates(t,"topHole");if(n){var o=parseFloat(m.getDistanceByCoordinates(r,n));e.push(b(b({},t),{},{distance:o}))}else e.push(t)})),c(e)}else c(t)}else c(t)}),[t,n]),a}function w(t,n,e){var s=o(null),a=r(s,2),c=a[0],u=a[1];return i((function(){if(n){var t=[];n.forEach((function(n){e.includes(n.id)&&n.is_usable&&t.push(n)})),u(t)}else u(null)}),[t,n,e]),c}function x(t,c){var u=s({}),l=o(!0),m=r(l,2),h=m[0],d=m[1],v=o(null),j=r(v,2),g=j[0],y=j[1];return i((function(){function r(){return(r=n(e.mark((function n(r){var o,i,s;return e.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,f(t,r);case 2:o=n.sent,i={},r.forEach((function(t){var n={},r=o.filter((function(n){return a(n,"asset_id")===t}));p.forEach((function(t){var e=r.find((function(n){return a(n,"data.key")===t})),o=a(e,"data.value");n[t]=Number.isFinite(o)?parseFloat(o).toFixed(2):null})),i[t]=n})),u.current=b(b({},u.current),i),s=[],c.forEach((function(t){s.push(b(b({},t),u.current[t.id]))})),d(!1),y(s);case 10:case"end":return n.stop()}}),n)})))).apply(this,arguments)}if(c)if(0!==c.length){var o=[];c.forEach((function(t){u.current[t.id]||o.push(t.id)})),d(!0),function(t){r.apply(this,arguments)}(o)}else y([]);else y(null)}),[c]),[h,g]}function P(t,n,r){var e=s(!1);i((function(){if(n){if(e.current){var o=[];n.forEach((function(n){n.distance<=t&&o.push(n.id)})),r(o)}e.current=!0}}),[t,n])}export{j as useCompanyMetricKey,y as useFilteredWells,x as useMetricsData,w as useOffsetWells,P as useRadiusWells,g as useWells,O as useWellsWithCoords};
2
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../../../src/components/OffsetWellPickerV3/components/CustomSelectionView/effects/index.js"],"sourcesContent":["import { useEffect, useState, useRef } from 'react';\nimport { get } from 'lodash';\n\nimport { fetchWells, fetchMetricsData, fetchCompanyGoals } from '../../../utils/apiCalls';\nimport { FILTERS, METRICS_KEYS } from '../constants';\n\nimport { mapbox, goals } from '~/utils';\nimport { goals as goalsConstants } from '~/constants';\n\nexport { default as useBidirectionalFiltering } from './biDirectionalFiltering';\n\nconst { getAssetV2Coordinates, getDistanceByCoordinates } = mapbox;\n\nexport function usePrevious(value) {\n const ref = useRef();\n useEffect(() => {\n ref.current = value;\n });\n return ref.current;\n}\n\nexport function useCompanyMetricKey(companyId) {\n const [metricKey, setMetricKey] = useState(null);\n\n useEffect(() => {\n async function handleFetchCompanyMetric() {\n const companyGoals = await fetchCompanyGoals(companyId);\n const companyMetricKey = goals.getCompanyGoalSetting(\n companyGoals,\n goalsConstants.BENCHMARK_METRIC_GOAL\n );\n\n setMetricKey(companyMetricKey);\n }\n\n setMetricKey(null);\n handleFetchCompanyMetric();\n }, [companyId]);\n\n return metricKey;\n}\n\nexport function useWells(companyId, addWellsUsabilityInfo) {\n const [wells, setWells] = useState(null);\n\n useEffect(() => {\n async function handleFetchWells() {\n const data = companyId ? await fetchWells(companyId, addWellsUsabilityInfo) : null;\n setWells(data);\n }\n\n setWells(null);\n handleFetchWells();\n }, [companyId]);\n\n return wells;\n}\n\nexport function useFilteredWells(dynamicFilters, excludeSideTrack, allWells) {\n const [filteredWells, setFilteredWells] = useState(null);\n const sideTrackStrRegex = /\\sST0/g;\n\n useEffect(() => {\n if (!allWells) {\n setFilteredWells(null);\n return;\n }\n\n const filterWell = (field, filter) => {\n return !filter || filter.length === 0 || filter.includes(field);\n };\n\n const filteredWells = Object.values(FILTERS).reduce((result, filterKey) => {\n return result.filter(well => filterWell(well[filterKey], dynamicFilters[filterKey]));\n }, allWells);\n\n const sideTracks = filteredWells.filter(\n well => (excludeSideTrack && !well.name.match(sideTrackStrRegex)) || !excludeSideTrack\n );\n\n setFilteredWells(sideTracks);\n }, [allWells, dynamicFilters, excludeSideTrack]);\n\n return filteredWells;\n}\n\nexport function useWellsWithCoords(wells, subjectWell) {\n const [wellsWithCoords, setWellsWithCoords] = useState(null);\n\n useEffect(() => {\n if (!wells) {\n setWellsWithCoords(wells);\n return;\n }\n\n const subjectWellCoord = subjectWell && getAssetV2Coordinates(subjectWell, 'topHole');\n\n if (!subjectWellCoord) {\n setWellsWithCoords(wells);\n return;\n }\n const result = [];\n wells.forEach(well => {\n const coord = getAssetV2Coordinates(well, 'topHole');\n if (coord) {\n const distance = parseFloat(getDistanceByCoordinates(subjectWellCoord, coord));\n result.push({ ...well, distance });\n } else {\n result.push(well);\n }\n });\n\n setWellsWithCoords(result);\n }, [wells, subjectWell]);\n\n return wellsWithCoords;\n}\n\nexport function useOffsetWells(radius, allWells, selectedWellIds) {\n const [offsetWells, setOffsetWells] = useState(null);\n\n useEffect(() => {\n if (!allWells) {\n // still loading...\n setOffsetWells(null);\n return;\n }\n\n const result = [];\n // NOTE: Add selected wells\n allWells.forEach(well => {\n if (selectedWellIds.includes(well.id) && well.is_usable) {\n result.push(well);\n }\n });\n\n setOffsetWells(result);\n }, [radius, allWells, selectedWellIds]);\n return offsetWells;\n}\n\nexport function useMetricsData(companyId, wells) {\n const fetchedData = useRef({});\n\n const [loading, setLoading] = useState(true);\n const [data, setData] = useState(null);\n\n useEffect(() => {\n async function handleFetchMetricsData(wellIdsToFetch) {\n const records = await fetchMetricsData(companyId, wellIdsToFetch);\n\n const wellsMetrics = {};\n wellIdsToFetch.forEach(wellId => {\n const wellMetrics = {};\n\n const wellRecords = records.filter(item => get(item, 'asset_id') === wellId);\n METRICS_KEYS.forEach(metricsKey => {\n const record = wellRecords.find(item => get(item, 'data.key') === metricsKey);\n const value = get(record, 'data.value');\n wellMetrics[metricsKey] = Number.isFinite(value) ? parseFloat(value).toFixed(2) : null;\n });\n\n wellsMetrics[wellId] = wellMetrics;\n });\n\n // NOTE: Store previous fetching result\n fetchedData.current = {\n ...fetchedData.current,\n ...wellsMetrics,\n };\n\n const result = [];\n wells.forEach(well => {\n result.push({\n ...well,\n ...fetchedData.current[well.id],\n });\n });\n\n setLoading(false);\n setData(result);\n }\n\n if (!wells) {\n // still loading...\n setData(null);\n return;\n }\n\n if (wells.length === 0) {\n setData([]);\n return;\n }\n\n // NOTE: Make api calls for only missing wells\n const missingWellIds = [];\n wells.forEach(well => {\n if (!fetchedData.current[well.id]) {\n missingWellIds.push(well.id);\n }\n });\n\n setLoading(true);\n handleFetchMetricsData(missingWellIds);\n }, [wells]);\n\n return [loading, data];\n}\n\nexport function useRadiusWells(radius, filteredWellsWithCoords, setSelectedWellIds) {\n const initLoadingRef = useRef(false);\n useEffect(() => {\n if (filteredWellsWithCoords) {\n if (initLoadingRef.current) {\n const radiusWellIds = [];\n filteredWellsWithCoords.forEach(well => {\n if (well.distance <= radius) {\n radiusWellIds.push(well.id);\n }\n });\n setSelectedWellIds(radiusWellIds);\n }\n initLoadingRef.current = true;\n }\n }, [radius, filteredWellsWithCoords]);\n}\n"],"names":["getAssetV2Coordinates","mapbox","getDistanceByCoordinates","useCompanyMetricKey","companyId","useState","_useState2","_slicedToArray","_useState","metricKey","setMetricKey","useEffect","_handleFetchCompanyMetric","_asyncToGenerator","_regeneratorRuntime","mark","_callee","companyGoals","companyMetricKey","wrap","_context","prev","next","fetchCompanyGoals","sent","goals","goalsConstants","stop","apply","this","arguments","handleFetchCompanyMetric","useWells","addWellsUsabilityInfo","_useState4","_useState3","wells","setWells","_handleFetchWells","_callee2","data","_context2","fetchWells","t0","handleFetchWells","useFilteredWells","dynamicFilters","excludeSideTrack","allWells","_useState6","_useState5","filteredWells","setFilteredWells","sideTrackStrRegex","sideTracks","Object","values","FILTERS","reduce","result","filterKey","filter","well","field","length","includes","name","match","useWellsWithCoords","subjectWell","_useState8","_useState7","wellsWithCoords","setWellsWithCoords","subjectWellCoord","forEach","coord","distance","parseFloat","push","_objectSpread","useOffsetWells","radius","selectedWellIds","_useState10","_useState9","offsetWells","setOffsetWells","id","is_usable","useMetricsData","fetchedData","useRef","_useState12","_useState11","loading","setLoading","_useState14","_useState13","setData","_handleFetchMetricsData","wellIdsToFetch","records","wellsMetrics","_context3","fetchMetricsData","wellId","wellMetrics","wellRecords","item","get","METRICS_KEYS","metricsKey","record","find","value","Number","isFinite","toFixed","current","_callee3","missingWellIds","_x","handleFetchMetricsData","useRadiusWells","filteredWellsWithCoords","setSelectedWellIds","initLoadingRef","radiusWellIds"],"mappings":"4xDAWA,IAAQA,EAAoDC,EAApDD,sBAAuBE,EAA6BD,EAA7BC,yBAUxB,SAASC,EAAoBC,GAClC,IAAkCC,EAAAA,EAAS,MAAKC,EAAAC,EAAAC,EAAA,GAAzCC,EAASH,EAAA,GAAEI,EAAYJ,EAAA,GAiB9B,OAfAK,GAAU,WAC+B,SAAAC,IAQtC,OARsCA,EAAvCC,EAAAC,EAAAC,MAAA,SAAAC,IAAA,IAAAC,EAAAC,EAAA,OAAAJ,EAAAK,MAAA,SAAAC,GAAA,OAAA,OAAAA,EAAAC,KAAAD,EAAAE,MAAA,KAAA,EAAA,OAAAF,EAAAE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,GACfvB,EAAMuC,SAAQ,SAAAb,GACZH,EAAOoB,KACFjB,EAAAA,EAAAA,CAAAA,EAAAA,GACA6B,EAAY4B,QAAQzD,EAAK0B,KAEhC,IAEAQ,GAAW,GACXG,EAAQxC,GAAQ,KAAA,GAAA,IAAA,MAAA,OAAA6C,EAAA7E,OAAA,GAAA6F,EACjB,MAAA5F,MAAAC,KAAAC,UAAA,CAED,GAAKM,EAML,GAAqB,IAAjBA,EAAM4B,OAAV,CAMA,IAAMyD,EAAiB,GACvBrF,EAAMuC,SAAQ,SAAAb,GACP6B,EAAY4B,QAAQzD,EAAK0B,KAC5BiC,EAAe1C,KAAKjB,EAAK0B,GAE7B,IAEAQ,GAAW,GAvDG,SACuB0B,GAAAtB,EAAAxE,MAAAC,KAAAC,UAAA,CAuDrC6F,CAAuBF,EAXvB,MAFEtB,EAAQ,SALRA,EAAQ,KAmBZ,GAAG,CAAC/D,IAEG,CAAC2D,EAASvD,EACnB,CAEO,SAASoF,EAAe1C,EAAQ2C,EAAyBC,GAC9D,IAAMC,EAAiBnC,GAAO,GAC9BjF,GAAU,WACR,GAAIkH,EAAyB,CAC3B,GAAIE,EAAeR,QAAS,CAC1B,IAAMS,EAAgB,GACtBH,EAAwBlD,SAAQ,SAAAb,GAC1BA,EAAKe,UAAYK,GACnB8C,EAAcjD,KAAKjB,EAAK0B,GAE5B,IACAsC,EAAmBE,EACrB,CACAD,EAAeR,SAAU,CAC3B,CACF,GAAG,CAACrC,EAAQ2C,GACd"}
1
+ {"version":3,"file":"index.js","sources":["../../../../../../src/components/OffsetWellPickerV3/components/CustomSelectionView/effects/index.js"],"sourcesContent":["import { useEffect, useState, useRef } from 'react';\nimport { get } from 'lodash';\n\nimport { fetchWells, fetchMetricsData, fetchCompanyGoals } from '../../../utils/apiCalls';\nimport { FILTERS, METRICS_KEYS } from '../constants';\n\nimport { mapbox, goals } from '~/utils';\nimport { goals as goalsConstants } from '~/constants';\n\nexport { default as useBidirectionalFiltering } from './biDirectionalFiltering';\n\nexport function usePrevious(value) {\n const ref = useRef();\n useEffect(() => {\n ref.current = value;\n });\n return ref.current;\n}\n\nexport function useCompanyMetricKey(companyId) {\n const [metricKey, setMetricKey] = useState(null);\n\n useEffect(() => {\n async function handleFetchCompanyMetric() {\n const companyGoals = await fetchCompanyGoals(companyId);\n const companyMetricKey = goals.getCompanyGoalSetting(\n companyGoals,\n goalsConstants.BENCHMARK_METRIC_GOAL\n );\n\n setMetricKey(companyMetricKey);\n }\n\n setMetricKey(null);\n handleFetchCompanyMetric();\n }, [companyId]);\n\n return metricKey;\n}\n\nexport function useWells(companyId, addWellsUsabilityInfo) {\n const [wells, setWells] = useState(null);\n\n useEffect(() => {\n async function handleFetchWells() {\n const data = companyId ? await fetchWells(companyId, addWellsUsabilityInfo) : null;\n setWells(data);\n }\n\n setWells(null);\n handleFetchWells();\n }, [companyId]);\n\n return wells;\n}\n\nexport function useFilteredWells(dynamicFilters, excludeSideTrack, allWells) {\n const [filteredWells, setFilteredWells] = useState(null);\n const sideTrackStrRegex = /\\sST0/g;\n\n useEffect(() => {\n if (!allWells) {\n setFilteredWells(null);\n return;\n }\n\n const filterWell = (field, filter) => {\n return !filter || filter.length === 0 || filter.includes(field);\n };\n\n const filteredWells = Object.values(FILTERS).reduce((result, filterKey) => {\n return result.filter(well => filterWell(well[filterKey], dynamicFilters[filterKey]));\n }, allWells);\n\n const sideTracks = filteredWells.filter(\n well => (excludeSideTrack && !well.name.match(sideTrackStrRegex)) || !excludeSideTrack\n );\n\n setFilteredWells(sideTracks);\n }, [allWells, dynamicFilters, excludeSideTrack]);\n\n return filteredWells;\n}\n\nexport function useWellsWithCoords(wells, subjectWell) {\n const [wellsWithCoords, setWellsWithCoords] = useState(null);\n\n useEffect(() => {\n if (!wells) {\n setWellsWithCoords(wells);\n return;\n }\n\n const subjectWellCoord = subjectWell && mapbox.getAssetV2Coordinates(subjectWell, 'topHole');\n\n if (!subjectWellCoord) {\n setWellsWithCoords(wells);\n return;\n }\n const result = [];\n wells.forEach(well => {\n const coord = mapbox.getAssetV2Coordinates(well, 'topHole');\n if (coord) {\n const distance = parseFloat(mapbox.getDistanceByCoordinates(subjectWellCoord, coord));\n result.push({ ...well, distance });\n } else {\n result.push(well);\n }\n });\n\n setWellsWithCoords(result);\n }, [wells, subjectWell]);\n\n return wellsWithCoords;\n}\n\nexport function useOffsetWells(radius, allWells, selectedWellIds) {\n const [offsetWells, setOffsetWells] = useState(null);\n\n useEffect(() => {\n if (!allWells) {\n // still loading...\n setOffsetWells(null);\n return;\n }\n\n const result = [];\n // NOTE: Add selected wells\n allWells.forEach(well => {\n if (selectedWellIds.includes(well.id) && well.is_usable) {\n result.push(well);\n }\n });\n\n setOffsetWells(result);\n }, [radius, allWells, selectedWellIds]);\n return offsetWells;\n}\n\nexport function useMetricsData(companyId, wells) {\n const fetchedData = useRef({});\n\n const [loading, setLoading] = useState(true);\n const [data, setData] = useState(null);\n\n useEffect(() => {\n async function handleFetchMetricsData(wellIdsToFetch) {\n const records = await fetchMetricsData(companyId, wellIdsToFetch);\n\n const wellsMetrics = {};\n wellIdsToFetch.forEach(wellId => {\n const wellMetrics = {};\n\n const wellRecords = records.filter(item => get(item, 'asset_id') === wellId);\n METRICS_KEYS.forEach(metricsKey => {\n const record = wellRecords.find(item => get(item, 'data.key') === metricsKey);\n const value = get(record, 'data.value');\n wellMetrics[metricsKey] = Number.isFinite(value) ? parseFloat(value).toFixed(2) : null;\n });\n\n wellsMetrics[wellId] = wellMetrics;\n });\n\n // NOTE: Store previous fetching result\n fetchedData.current = {\n ...fetchedData.current,\n ...wellsMetrics,\n };\n\n const result = [];\n wells.forEach(well => {\n result.push({\n ...well,\n ...fetchedData.current[well.id],\n });\n });\n\n setLoading(false);\n setData(result);\n }\n\n if (!wells) {\n // still loading...\n setData(null);\n return;\n }\n\n if (wells.length === 0) {\n setData([]);\n return;\n }\n\n // NOTE: Make api calls for only missing wells\n const missingWellIds = [];\n wells.forEach(well => {\n if (!fetchedData.current[well.id]) {\n missingWellIds.push(well.id);\n }\n });\n\n setLoading(true);\n handleFetchMetricsData(missingWellIds);\n }, [wells]);\n\n return [loading, data];\n}\n\nexport function useRadiusWells(radius, filteredWellsWithCoords, setSelectedWellIds) {\n const initLoadingRef = useRef(false);\n useEffect(() => {\n if (filteredWellsWithCoords) {\n if (initLoadingRef.current) {\n const radiusWellIds = [];\n filteredWellsWithCoords.forEach(well => {\n if (well.distance <= radius) {\n radiusWellIds.push(well.id);\n }\n });\n setSelectedWellIds(radiusWellIds);\n }\n initLoadingRef.current = true;\n }\n }, [radius, filteredWellsWithCoords]);\n}\n"],"names":["useCompanyMetricKey","companyId","useState","_useState2","_slicedToArray","_useState","metricKey","setMetricKey","useEffect","_handleFetchCompanyMetric","_asyncToGenerator","_regeneratorRuntime","mark","_callee","companyGoals","companyMetricKey","wrap","_context","prev","next","fetchCompanyGoals","sent","goals","goalsConstants","stop","apply","this","arguments","handleFetchCompanyMetric","useWells","addWellsUsabilityInfo","_useState4","_useState3","wells","setWells","_handleFetchWells","_callee2","data","_context2","fetchWells","t0","handleFetchWells","useFilteredWells","dynamicFilters","excludeSideTrack","allWells","_useState6","_useState5","filteredWells","setFilteredWells","sideTrackStrRegex","sideTracks","Object","values","FILTERS","reduce","result","filterKey","filter","well","field","length","includes","name","match","useWellsWithCoords","subjectWell","_useState8","_useState7","wellsWithCoords","setWellsWithCoords","subjectWellCoord","mapbox","getAssetV2Coordinates","forEach","coord","distance","parseFloat","getDistanceByCoordinates","push","_objectSpread","useOffsetWells","radius","selectedWellIds","_useState10","_useState9","offsetWells","setOffsetWells","id","is_usable","useMetricsData","fetchedData","useRef","_useState12","_useState11","loading","setLoading","_useState14","_useState13","setData","_handleFetchMetricsData","wellIdsToFetch","records","wellsMetrics","_context3","fetchMetricsData","wellId","wellMetrics","wellRecords","item","get","METRICS_KEYS","metricsKey","record","find","value","Number","isFinite","toFixed","current","_callee3","missingWellIds","_x","handleFetchMetricsData","useRadiusWells","filteredWellsWithCoords","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