@gen3/frontend 0.10.54 → 0.10.56

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 (224) hide show
  1. package/dist/cjs/index.js +2013 -111
  2. package/dist/cjs/index.js.map +1 -1
  3. package/dist/dts/components/Content/TextContent.d.ts +6 -2
  4. package/dist/dts/components/Content/TextContent.d.ts.map +1 -1
  5. package/dist/dts/components/Content/TextContent.js +25 -4
  6. package/dist/dts/components/Content/TextContent.js.map +1 -1
  7. package/dist/dts/components/Login/LoginAccountButton.d.ts +4 -1
  8. package/dist/dts/components/Login/LoginAccountButton.d.ts.map +1 -1
  9. package/dist/dts/components/Login/LoginAccountButton.js +5 -2
  10. package/dist/dts/components/Login/LoginAccountButton.js.map +1 -1
  11. package/dist/dts/components/Login/LoginButton.d.ts.map +1 -1
  12. package/dist/dts/components/Login/LoginButton.js +4 -2
  13. package/dist/dts/components/Login/LoginButton.js.map +1 -1
  14. package/dist/dts/components/Login/LoginPanel.d.ts.map +1 -1
  15. package/dist/dts/components/Login/LoginPanel.js +1 -4
  16. package/dist/dts/components/Login/LoginPanel.js.map +1 -1
  17. package/dist/dts/components/MessageCards/CardContainer.d.ts +1 -0
  18. package/dist/dts/components/MessageCards/CardContainer.d.ts.map +1 -1
  19. package/dist/dts/components/MessageCards/CardContainer.js +2 -2
  20. package/dist/dts/components/MessageCards/CardContainer.js.map +1 -1
  21. package/dist/dts/components/MessageCards/MessageCard.d.ts +1 -0
  22. package/dist/dts/components/MessageCards/MessageCard.d.ts.map +1 -1
  23. package/dist/dts/components/MessageCards/MessageCard.js +2 -2
  24. package/dist/dts/components/MessageCards/MessageCard.js.map +1 -1
  25. package/dist/dts/components/NewTabLink.d.ts +8 -0
  26. package/dist/dts/components/NewTabLink.d.ts.map +1 -0
  27. package/dist/dts/components/NewTabLink.js +7 -0
  28. package/dist/dts/components/NewTabLink.js.map +1 -0
  29. package/dist/dts/components/charts/echarts/VerticalBarChart.d.ts +7 -0
  30. package/dist/dts/components/charts/echarts/VerticalBarChart.d.ts.map +1 -1
  31. package/dist/dts/components/charts/echarts/VerticalBarChart.js +7 -1
  32. package/dist/dts/components/charts/echarts/VerticalBarChart.js.map +1 -1
  33. package/dist/dts/features/Analysis/AnalysisCardEditor.d.ts.map +1 -1
  34. package/dist/dts/features/Analysis/AnalysisCardEditor.js +0 -1
  35. package/dist/dts/features/Analysis/AnalysisCardEditor.js.map +1 -1
  36. package/dist/dts/features/CohortBuilder/QueryExpressionSection.d.ts +6 -4
  37. package/dist/dts/features/CohortBuilder/QueryExpressionSection.d.ts.map +1 -1
  38. package/dist/dts/features/CohortBuilder/QueryExpressionSection.js +7 -7
  39. package/dist/dts/features/CohortBuilder/QueryExpressionSection.js.map +1 -1
  40. package/dist/dts/features/CohortBuilder/QueryRepresentation.d.ts +3 -2
  41. package/dist/dts/features/CohortBuilder/QueryRepresentation.d.ts.map +1 -1
  42. package/dist/dts/features/CohortBuilder/QueryRepresentation.js +33 -24
  43. package/dist/dts/features/CohortBuilder/QueryRepresentation.js.map +1 -1
  44. package/dist/dts/features/DataLibrary/DataLibrary.d.ts +4 -0
  45. package/dist/dts/features/DataLibrary/DataLibrary.d.ts.map +1 -0
  46. package/dist/dts/features/DataLibrary/DataLibrary.js +19 -0
  47. package/dist/dts/features/DataLibrary/DataLibrary.js.map +1 -0
  48. package/dist/dts/features/DataLibrary/DataLibraryLists.d.ts +5 -0
  49. package/dist/dts/features/DataLibrary/DataLibraryLists.d.ts.map +1 -0
  50. package/dist/dts/features/DataLibrary/DataLibraryLists.js +39 -0
  51. package/dist/dts/features/DataLibrary/DataLibraryLists.js.map +1 -0
  52. package/dist/dts/features/DataLibrary/DatalistAccordionItem.d.ts +21 -0
  53. package/dist/dts/features/DataLibrary/DatalistAccordionItem.d.ts.map +1 -0
  54. package/dist/dts/features/DataLibrary/DatalistAccordionItem.js +178 -0
  55. package/dist/dts/features/DataLibrary/DatalistAccordionItem.js.map +1 -0
  56. package/dist/dts/features/DataLibrary/DatasetAccordionControl.d.ts +16 -0
  57. package/dist/dts/features/DataLibrary/DatasetAccordionControl.d.ts.map +1 -0
  58. package/dist/dts/features/DataLibrary/DatasetAccordionControl.js +45 -0
  59. package/dist/dts/features/DataLibrary/DatasetAccordionControl.js.map +1 -0
  60. package/dist/dts/features/DataLibrary/EmptyList.d.ts +4 -0
  61. package/dist/dts/features/DataLibrary/EmptyList.d.ts.map +1 -0
  62. package/dist/dts/features/DataLibrary/EmptyList.js +8 -0
  63. package/dist/dts/features/DataLibrary/EmptyList.js.map +1 -0
  64. package/dist/dts/features/DataLibrary/QueryDetails.d.ts +5 -0
  65. package/dist/dts/features/DataLibrary/QueryDetails.d.ts.map +1 -0
  66. package/dist/dts/features/DataLibrary/QueryDetails.js +20 -0
  67. package/dist/dts/features/DataLibrary/QueryDetails.js.map +1 -0
  68. package/dist/dts/features/DataLibrary/SearchAndActions.d.ts +10 -0
  69. package/dist/dts/features/DataLibrary/SearchAndActions.d.ts.map +1 -0
  70. package/dist/dts/features/DataLibrary/SearchAndActions.js +18 -0
  71. package/dist/dts/features/DataLibrary/SearchAndActions.js.map +1 -0
  72. package/dist/dts/features/DataLibrary/index.d.ts +5 -0
  73. package/dist/dts/features/DataLibrary/index.d.ts.map +1 -0
  74. package/dist/dts/features/DataLibrary/index.js +3 -0
  75. package/dist/dts/features/DataLibrary/index.js.map +1 -0
  76. package/dist/dts/features/DataLibrary/modals/SelectedItemsModal.d.ts +9 -0
  77. package/dist/dts/features/DataLibrary/modals/SelectedItemsModal.d.ts.map +1 -0
  78. package/dist/dts/features/DataLibrary/modals/SelectedItemsModal.js +191 -0
  79. package/dist/dts/features/DataLibrary/modals/SelectedItemsModal.js.map +1 -0
  80. package/dist/dts/features/DataLibrary/modals/utils.d.ts +2 -0
  81. package/dist/dts/features/DataLibrary/modals/utils.d.ts.map +1 -0
  82. package/dist/dts/features/DataLibrary/modals/utils.js +45 -0
  83. package/dist/dts/features/DataLibrary/modals/utils.js.map +1 -0
  84. package/dist/dts/features/DataLibrary/selection/SelectionContext.d.ts +67 -0
  85. package/dist/dts/features/DataLibrary/selection/SelectionContext.d.ts.map +1 -0
  86. package/dist/dts/features/DataLibrary/selection/SelectionContext.js +151 -0
  87. package/dist/dts/features/DataLibrary/selection/SelectionContext.js.map +1 -0
  88. package/dist/dts/features/DataLibrary/selection/exportActions.d.ts +3 -0
  89. package/dist/dts/features/DataLibrary/selection/exportActions.d.ts.map +1 -0
  90. package/dist/dts/features/DataLibrary/selection/exportActions.js +119 -0
  91. package/dist/dts/features/DataLibrary/selection/exportActions.js.map +1 -0
  92. package/dist/dts/features/DataLibrary/selection/registeredActions.d.ts +12 -0
  93. package/dist/dts/features/DataLibrary/selection/registeredActions.d.ts.map +1 -0
  94. package/dist/dts/features/DataLibrary/selection/registeredActions.js +29 -0
  95. package/dist/dts/features/DataLibrary/selection/registeredActions.js.map +1 -0
  96. package/dist/dts/features/DataLibrary/selection/selectedItemActions.d.ts +16 -0
  97. package/dist/dts/features/DataLibrary/selection/selectedItemActions.d.ts.map +1 -0
  98. package/dist/dts/features/DataLibrary/selection/selectedItemActions.js +76 -0
  99. package/dist/dts/features/DataLibrary/selection/selectedItemActions.js.map +1 -0
  100. package/dist/dts/features/DataLibrary/selection/selection.d.ts +32 -0
  101. package/dist/dts/features/DataLibrary/selection/selection.d.ts.map +1 -0
  102. package/dist/dts/features/DataLibrary/selection/selection.js +88 -0
  103. package/dist/dts/features/DataLibrary/selection/selection.js.map +1 -0
  104. package/dist/dts/features/DataLibrary/selection/tests/SelectionContext.unit.test.d.ts +2 -0
  105. package/dist/dts/features/DataLibrary/selection/tests/SelectionContext.unit.test.d.ts.map +1 -0
  106. package/dist/dts/features/DataLibrary/selection/tests/SelectionContext.unit.test.js +176 -0
  107. package/dist/dts/features/DataLibrary/selection/tests/SelectionContext.unit.test.js.map +1 -0
  108. package/dist/dts/features/DataLibrary/selection/tests/utils.unit.test.d.ts +2 -0
  109. package/dist/dts/features/DataLibrary/selection/tests/utils.unit.test.d.ts.map +1 -0
  110. package/dist/dts/features/DataLibrary/selection/tests/utils.unit.test.js +79 -0
  111. package/dist/dts/features/DataLibrary/selection/tests/utils.unit.test.js.map +1 -0
  112. package/dist/dts/features/DataLibrary/selection/types.d.ts +31 -0
  113. package/dist/dts/features/DataLibrary/selection/types.d.ts.map +1 -0
  114. package/dist/dts/features/DataLibrary/selection/types.js +2 -0
  115. package/dist/dts/features/DataLibrary/selection/types.js.map +1 -0
  116. package/dist/dts/features/DataLibrary/selection/utils.d.ts +15 -0
  117. package/dist/dts/features/DataLibrary/selection/utils.d.ts.map +1 -0
  118. package/dist/dts/features/DataLibrary/selection/utils.js +85 -0
  119. package/dist/dts/features/DataLibrary/selection/utils.js.map +1 -0
  120. package/dist/dts/features/DataLibrary/tables/AdditionalDataTable.d.ts +8 -0
  121. package/dist/dts/features/DataLibrary/tables/AdditionalDataTable.d.ts.map +1 -0
  122. package/dist/dts/features/DataLibrary/tables/AdditionalDataTable.js +36 -0
  123. package/dist/dts/features/DataLibrary/tables/AdditionalDataTable.js.map +1 -0
  124. package/dist/dts/features/DataLibrary/tables/DatalistContentsPanel.d.ts +1 -0
  125. package/dist/dts/features/DataLibrary/tables/DatalistContentsPanel.d.ts.map +1 -0
  126. package/dist/dts/features/DataLibrary/tables/DatalistContentsPanel.js +130 -0
  127. package/dist/dts/features/DataLibrary/tables/DatalistContentsPanel.js.map +1 -0
  128. package/dist/dts/features/DataLibrary/tables/DatasetContentsTable.d.ts +10 -0
  129. package/dist/dts/features/DataLibrary/tables/DatasetContentsTable.d.ts.map +1 -0
  130. package/dist/dts/features/DataLibrary/tables/DatasetContentsTable.js +149 -0
  131. package/dist/dts/features/DataLibrary/tables/DatasetContentsTable.js.map +1 -0
  132. package/dist/dts/features/DataLibrary/tables/FilesTable.d.ts +11 -0
  133. package/dist/dts/features/DataLibrary/tables/FilesTable.d.ts.map +1 -0
  134. package/dist/dts/features/DataLibrary/tables/FilesTable.js +57 -0
  135. package/dist/dts/features/DataLibrary/tables/FilesTable.js.map +1 -0
  136. package/dist/dts/features/DataLibrary/tables/QueriesTable.d.ts +9 -0
  137. package/dist/dts/features/DataLibrary/tables/QueriesTable.d.ts.map +1 -0
  138. package/dist/dts/features/DataLibrary/tables/QueriesTable.js +36 -0
  139. package/dist/dts/features/DataLibrary/tables/QueriesTable.js.map +1 -0
  140. package/dist/dts/features/DataLibrary/tables/SelectedItemsTable.d.ts +12 -0
  141. package/dist/dts/features/DataLibrary/tables/SelectedItemsTable.d.ts.map +1 -0
  142. package/dist/dts/features/DataLibrary/tables/SelectedItemsTable.js +156 -0
  143. package/dist/dts/features/DataLibrary/tables/SelectedItemsTable.js.map +1 -0
  144. package/dist/dts/features/DataLibrary/tables/tableSettings.d.ts +3 -0
  145. package/dist/dts/features/DataLibrary/tables/tableSettings.d.ts.map +1 -0
  146. package/dist/dts/features/DataLibrary/tables/tableSettings.js +64 -0
  147. package/dist/dts/features/DataLibrary/tables/tableSettings.js.map +1 -0
  148. package/dist/dts/features/DataLibrary/tests/utils.unit.test.d.ts +2 -0
  149. package/dist/dts/features/DataLibrary/tests/utils.unit.test.d.ts.map +1 -0
  150. package/dist/dts/features/DataLibrary/tests/utils.unit.test.js +43 -0
  151. package/dist/dts/features/DataLibrary/tests/utils.unit.test.js.map +1 -0
  152. package/dist/dts/features/DataLibrary/types.d.ts +48 -0
  153. package/dist/dts/features/DataLibrary/types.d.ts.map +1 -0
  154. package/dist/dts/features/DataLibrary/types.js +25 -0
  155. package/dist/dts/features/DataLibrary/types.js.map +1 -0
  156. package/dist/dts/features/DataLibrary/utils.d.ts +28 -0
  157. package/dist/dts/features/DataLibrary/utils.d.ts.map +1 -0
  158. package/dist/dts/features/DataLibrary/utils.js +68 -0
  159. package/dist/dts/features/DataLibrary/utils.js.map +1 -0
  160. package/dist/dts/features/Discovery/ActionBar/DownloadAsZipButton.d.ts.map +1 -1
  161. package/dist/dts/features/Discovery/ActionBar/DownloadAsZipButton.js +0 -1
  162. package/dist/dts/features/Discovery/ActionBar/DownloadAsZipButton.js.map +1 -1
  163. package/dist/dts/features/Discovery/TableRenderers/DataAccessCellRenderers.d.ts.map +1 -1
  164. package/dist/dts/features/Discovery/TableRenderers/DataAccessCellRenderers.js +3 -3
  165. package/dist/dts/features/Discovery/TableRenderers/DataAccessCellRenderers.js.map +1 -1
  166. package/dist/dts/features/Navigation/Footer/FooterColumn.d.ts.map +1 -1
  167. package/dist/dts/features/Navigation/Footer/FooterColumn.js +3 -2
  168. package/dist/dts/features/Navigation/Footer/FooterColumn.js.map +1 -1
  169. package/dist/dts/features/Navigation/Header.d.ts.map +1 -1
  170. package/dist/dts/features/Navigation/Header.js +1 -0
  171. package/dist/dts/features/Navigation/Header.js.map +1 -1
  172. package/dist/dts/features/Navigation/NavigationBar.d.ts.map +1 -1
  173. package/dist/dts/features/Navigation/NavigationBar.js +1 -1
  174. package/dist/dts/features/Navigation/NavigationBar.js.map +1 -1
  175. package/dist/dts/features/Navigation/NavigationBarButton.d.ts +2 -1
  176. package/dist/dts/features/Navigation/NavigationBarButton.d.ts.map +1 -1
  177. package/dist/dts/features/Navigation/NavigationBarButton.js +5 -4
  178. package/dist/dts/features/Navigation/NavigationBarButton.js.map +1 -1
  179. package/dist/dts/features/Navigation/NavigationLogo.js +1 -1
  180. package/dist/dts/features/Navigation/TopBar.d.ts.map +1 -1
  181. package/dist/dts/features/Navigation/TopBar.js +2 -1
  182. package/dist/dts/features/Navigation/TopBar.js.map +1 -1
  183. package/dist/dts/features/Navigation/types.d.ts +7 -6
  184. package/dist/dts/features/Navigation/types.d.ts.map +1 -1
  185. package/dist/dts/features/Workspace/NotebookCard.d.ts.map +1 -1
  186. package/dist/dts/features/Workspace/NotebookCard.js +0 -1
  187. package/dist/dts/features/Workspace/NotebookCard.js.map +1 -1
  188. package/dist/dts/index.d.ts +2 -1
  189. package/dist/dts/index.d.ts.map +1 -1
  190. package/dist/dts/index.js +2 -1
  191. package/dist/dts/index.js.map +1 -1
  192. package/dist/dts/lib/content/filesystem.js +1 -1
  193. package/dist/dts/lib/content/filesystem.js.map +1 -1
  194. package/dist/dts/pages/DataLibrary/DataLibrary.d.ts +8 -0
  195. package/dist/dts/pages/DataLibrary/DataLibrary.d.ts.map +1 -0
  196. package/dist/dts/pages/DataLibrary/DataLibrary.js +24 -0
  197. package/dist/dts/pages/DataLibrary/DataLibrary.js.map +1 -0
  198. package/dist/dts/pages/DataLibrary/data.d.ts +4 -0
  199. package/dist/dts/pages/DataLibrary/data.d.ts.map +1 -0
  200. package/dist/dts/pages/DataLibrary/data.js +81 -0
  201. package/dist/dts/pages/DataLibrary/data.js.map +1 -0
  202. package/dist/dts/pages/DataLibrary/index.d.ts +3 -0
  203. package/dist/dts/pages/DataLibrary/index.d.ts.map +1 -0
  204. package/dist/dts/pages/DataLibrary/index.js +3 -0
  205. package/dist/dts/pages/DataLibrary/index.js.map +1 -0
  206. package/dist/dts/pages/Explorer/data.d.ts.map +1 -1
  207. package/dist/dts/pages/Explorer/data.js.map +1 -1
  208. package/dist/dts/utils/date.d.ts +17 -0
  209. package/dist/dts/utils/date.d.ts.map +1 -0
  210. package/dist/dts/utils/date.js +41 -0
  211. package/dist/dts/utils/date.js.map +1 -0
  212. package/dist/dts/utils/mergeDefaultTailwindClassnames.d.ts +1 -0
  213. package/dist/dts/utils/mergeDefaultTailwindClassnames.d.ts.map +1 -1
  214. package/dist/dts/utils/mergeDefaultTailwindClassnames.js +1 -0
  215. package/dist/dts/utils/mergeDefaultTailwindClassnames.js.map +1 -1
  216. package/dist/dts/utils/tests/date.unit.test.d.ts +2 -0
  217. package/dist/dts/utils/tests/date.unit.test.d.ts.map +1 -0
  218. package/dist/dts/utils/tests/date.unit.test.js +89 -0
  219. package/dist/dts/utils/tests/date.unit.test.js.map +1 -0
  220. package/dist/esm/index.js +2017 -117
  221. package/dist/esm/index.js.map +1 -1
  222. package/dist/index.d.ts +74 -9
  223. package/dist/tsconfig.tsbuildinfo +1 -1
  224. package/package.json +5 -5
package/dist/cjs/index.js CHANGED
@@ -12,10 +12,10 @@ require('swr');
12
12
  var cookiesNext = require('cookies-next');
13
13
  var jose = require('jose');
14
14
  var notifications = require('@mantine/notifications');
15
+ var tailwindMerge = require('tailwind-merge');
15
16
  var iconsReact = require('@tabler/icons-react');
16
17
  var Markdown = require('react-markdown');
17
18
  var remarkGfm = require('remark-gfm');
18
- var tailwindMerge = require('tailwind-merge');
19
19
  var lodash = require('lodash');
20
20
  var reactCookie = require('react-cookie');
21
21
  var FileSaver = require('file-saver');
@@ -606,6 +606,36 @@ var LoginButtonVisibility;
606
606
  LoginButtonVisibility["LogoutOnly"] = "logoutOnly";
607
607
  })(LoginButtonVisibility || (LoginButtonVisibility = {}));
608
608
 
609
+ /**
610
+ * Merges default and user values for Tailwind classnames.
611
+ *
612
+ * @param {RecordType} defaultValues - The default values for the classnames.
613
+ * @param {RecordType} userValues - The user-defined values for the classnames.
614
+ * @param {StylingMergeMode} mode - Whether to merge or replace the default and user values. Default is merge.
615
+ * @returns {RecordType} - The merged default and user values for the classnames.
616
+ */ const mergeDefaultTailwindClassnames = (defaultValues, { mode = 'merge', ...userValues })=>{
617
+ const defaultKeys = Object.keys(defaultValues);
618
+ const mergedValues = {
619
+ ...defaultValues
620
+ };
621
+ if (mode === 'merge') {
622
+ defaultKeys.forEach((key)=>{
623
+ if (userValues[key]) {
624
+ mergedValues[key] = tailwindMerge.twMerge(defaultValues[key], userValues[key]);
625
+ }
626
+ });
627
+ }
628
+ if (mode === 'replace') {
629
+ defaultKeys.forEach((key)=>{
630
+ if (userValues[key]) {
631
+ mergedValues[key] = userValues[key];
632
+ }
633
+ });
634
+ }
635
+ return mergedValues;
636
+ };
637
+ const mergeTailwindClassnameWithDefault = (userValues, defaultValues)=>userValues ? tailwindMerge.twMerge(defaultValues, userValues) : defaultValues;
638
+
609
639
  const handleSelected = async (isAuthenticated, router, referrer, endSession)=>{
610
640
  if (!isAuthenticated) await router.push(`Login?redirect=${referrer}`);
611
641
  else {
@@ -615,7 +645,7 @@ const handleSelected = async (isAuthenticated, router, referrer, endSession)=>{
615
645
  const LoginButton = ({ icon = /*#__PURE__*/ jsxRuntime.jsx(md.MdLogin, {
616
646
  className: "pl-1",
617
647
  size: '1.55rem'
618
- }), hideText = false, className = 'flex flex-nowrap items-center font-content text-secondary-contrast-lighter align-middle border-b-2 hover:border-accent border-transparent mx-2', tooltip, visibility })=>{
648
+ }), hideText = false, className = undefined, tooltip, visibility })=>{
619
649
  const router$1 = router.useRouter();
620
650
  const pathname = navigation.usePathname();
621
651
  const { endSession } = React.useContext(SessionContext) ?? {
@@ -624,6 +654,7 @@ const LoginButton = ({ icon = /*#__PURE__*/ jsxRuntime.jsx(md.MdLogin, {
624
654
  const userStatus = core.useCoreSelector((state)=>core.selectUserAuthStatus(state));
625
655
  const authenticated = core.isAuthenticated(userStatus);
626
656
  if (visibility === LoginButtonVisibility.LogoutOnly && !authenticated) return null;
657
+ const mergedClassname = mergeTailwindClassnameWithDefault(className, 'flex flex-nowrap items-center font-content text-secondary-contrast-lighter align-middle border-b-2 hover:border-accent border-transparent mx-2');
627
658
  return /*#__PURE__*/ jsxRuntime.jsx(core$1.Tooltip, {
628
659
  label: tooltip,
629
660
  position: "bottom",
@@ -635,7 +666,7 @@ const LoginButton = ({ icon = /*#__PURE__*/ jsxRuntime.jsx(md.MdLogin, {
635
666
  children: /*#__PURE__*/ jsxRuntime.jsx(core$1.UnstyledButton, {
636
667
  onClick: ()=>handleSelected(authenticated, router$1, pathname, endSession),
637
668
  children: /*#__PURE__*/ jsxRuntime.jsxs("div", {
638
- className: `flex items-center font-medium font-heading ${className}`,
669
+ className: mergedClassname,
639
670
  children: [
640
671
  !hideText ? authenticated ? 'Logout' : 'Login' : null,
641
672
  icon
@@ -645,10 +676,10 @@ const LoginButton = ({ icon = /*#__PURE__*/ jsxRuntime.jsx(md.MdLogin, {
645
676
  });
646
677
  };
647
678
 
648
- const CardContainer = ({ children })=>/*#__PURE__*/ jsxRuntime.jsx("div", {
649
- className: "flex justify-center pt-2 items-center",
679
+ const CardContainer = ({ children, width = 'w-1/2' })=>/*#__PURE__*/ jsxRuntime.jsx("div", {
680
+ className: `flex justify-center pt-2 items-center m-2 ${width ?? ''}`,
650
681
  children: /*#__PURE__*/ jsxRuntime.jsx(core$1.Card, {
651
- shadow: "sm",
682
+ shadow: "xs",
652
683
  p: "md",
653
684
  className: "bg-base-lightest border-2 border-base-lighter",
654
685
  children: /*#__PURE__*/ jsxRuntime.jsx(core$1.Group, {
@@ -665,7 +696,8 @@ const MessageText = ({ message, color })=>/*#__PURE__*/ jsxRuntime.jsx(core$1.Te
665
696
  fw: 500,
666
697
  children: message
667
698
  });
668
- const MessageCard = ({ message, icon, size = 'lg', color = 'utility.5' })=>/*#__PURE__*/ jsxRuntime.jsxs(CardContainer, {
699
+ const MessageCard = ({ message, icon, size = 'lg', color = 'utility.5', width = 'w-1/2' })=>/*#__PURE__*/ jsxRuntime.jsxs(CardContainer, {
700
+ width: width,
669
701
  children: [
670
702
  /*#__PURE__*/ jsxRuntime.jsx(core$1.ThemeIcon, {
671
703
  color: color,
@@ -898,8 +930,11 @@ var ContentType;
898
930
  ContentType["TextArray"] = "textArray";
899
931
  ContentType["Html"] = "html";
900
932
  ContentType["Markdown"] = "markdown";
933
+ ContentType["TextWithEmail"] = "textWithEmail";
934
+ ContentType["TextWithLink"] = "textWithLink";
935
+ ContentType["Link"] = "link";
901
936
  })(ContentType || (ContentType = {}));
902
- const TextContent = ({ text, className = 'inline text-base-contrast color-red-500 font-medium margin-block-start-1 margin-block-end-1', type = "text" })=>{
937
+ const TextContent = ({ text, className = 'inline text-base-contrast color-red-500 font-medium margin-block-start-1 margin-block-end-1', type = "text", email = undefined, link = undefined })=>{
903
938
  switch(type){
904
939
  case "html":
905
940
  {
@@ -967,6 +1002,48 @@ const TextContent = ({ text, className = 'inline text-base-contrast color-red-50
967
1002
  })
968
1003
  });
969
1004
  }
1005
+ case "textWithEmail":
1006
+ {
1007
+ const DEFAULT_STYLE = 'inline color-ink font-medium margin-block-start-1 margin-block-end-1';
1008
+ const mergedClassname = className ? tailwindMerge.twMerge(DEFAULT_STYLE, className) : DEFAULT_STYLE;
1009
+ const textString = Array.isArray(text) ? text.join('') : text;
1010
+ return /*#__PURE__*/ jsxRuntime.jsx("div", {
1011
+ className: mergedClassname,
1012
+ children: /*#__PURE__*/ jsxRuntime.jsxs("span", {
1013
+ children: [
1014
+ textString,
1015
+ email && /*#__PURE__*/ jsxRuntime.jsx(core$1.Anchor, {
1016
+ classNames: {
1017
+ root: mergedClassname
1018
+ },
1019
+ href: `mailto:${email}`,
1020
+ children: ` ${email}.`
1021
+ })
1022
+ ]
1023
+ })
1024
+ });
1025
+ }
1026
+ case "textWithLink":
1027
+ {
1028
+ const DEFAULT_STYLE = 'inline color-ink font-medium margin-block-start-1 margin-block-end-1';
1029
+ const mergedClassname = className ? tailwindMerge.twMerge(DEFAULT_STYLE, className) : DEFAULT_STYLE;
1030
+ const textString = Array.isArray(text) ? text.join('') : text;
1031
+ return /*#__PURE__*/ jsxRuntime.jsx("div", {
1032
+ className: mergedClassname,
1033
+ children: /*#__PURE__*/ jsxRuntime.jsxs("span", {
1034
+ children: [
1035
+ textString,
1036
+ link && /*#__PURE__*/ jsxRuntime.jsx(core$1.Anchor, {
1037
+ classNames: {
1038
+ root: mergedClassname
1039
+ },
1040
+ href: link,
1041
+ children: ` ${email}.`
1042
+ })
1043
+ ]
1044
+ })
1045
+ });
1046
+ }
970
1047
  case "text":
971
1048
  default:
972
1049
  return /*#__PURE__*/ jsxRuntime.jsx("div", {
@@ -978,28 +1055,6 @@ const TextContent = ({ text, className = 'inline text-base-contrast color-red-50
978
1055
  }
979
1056
  };
980
1057
 
981
- const DEFAULT_STYLE = 'inline color-ink font-medium margin-block-start-1 margin-block-end-1';
982
- const ContactWithEmailContent = ({ text, email, className })=>{
983
- const mergedClassname = className ? tailwindMerge.twMerge(DEFAULT_STYLE, className) : DEFAULT_STYLE;
984
- const textString = Array.isArray(text) ? text.join(' ') : text;
985
- // TODO: add better support for classnames
986
- return /*#__PURE__*/ jsxRuntime.jsx("div", {
987
- className: mergedClassname,
988
- children: /*#__PURE__*/ jsxRuntime.jsxs("span", {
989
- children: [
990
- textString,
991
- email && /*#__PURE__*/ jsxRuntime.jsx(core$1.Anchor, {
992
- classNames: {
993
- root: mergedClassname
994
- },
995
- href: `mailto:${email}`,
996
- children: ` ${email}.`
997
- })
998
- ]
999
- })
1000
- });
1001
- };
1002
-
1003
1058
  const filterRedirect = (redirect)=>{
1004
1059
  let redirectPath = '';
1005
1060
  if (Array.isArray(redirect)) {
@@ -1055,10 +1110,7 @@ const LoginPanel = (loginConfig)=>{
1055
1110
  loginConfig?.showCredentialsLogin && process.env.NODE_ENV === 'development' && /*#__PURE__*/ jsxRuntime.jsx(CredentialsLogin, {
1056
1111
  handleLogin: handleCredentialsLogin
1057
1112
  }),
1058
- bottomContent?.map((content, index)=>content?.email ? /*#__PURE__*/ React.createElement(ContactWithEmailContent, {
1059
- ...content,
1060
- key: `bottomContent-${index}`
1061
- }) : /*#__PURE__*/ React.createElement(TextContent, {
1113
+ bottomContent?.map((content, index)=>/*#__PURE__*/ React.createElement(TextContent, {
1062
1114
  ...content,
1063
1115
  key: `bottomContent-${index}`
1064
1116
  }))
@@ -2395,35 +2447,6 @@ const extractClassName = (key, classNames)=>{
2395
2447
  return '';
2396
2448
  };
2397
2449
 
2398
- /**
2399
- * Merges default and user values for Tailwind classnames.
2400
- *
2401
- * @param {RecordType} defaultValues - The default values for the classnames.
2402
- * @param {RecordType} userValues - The user-defined values for the classnames.
2403
- * @param {StylingMergeMode} mode - Whether to merge or replace the default and user values. Default is merge.
2404
- * @returns {RecordType} - The merged default and user values for the classnames.
2405
- */ const mergeDefaultTailwindClassnames = (defaultValues, { mode = 'merge', ...userValues })=>{
2406
- const defaultKeys = Object.keys(defaultValues);
2407
- const mergedValues = {
2408
- ...defaultValues
2409
- };
2410
- if (mode === 'merge') {
2411
- defaultKeys.forEach((key)=>{
2412
- if (userValues[key]) {
2413
- mergedValues[key] = tailwindMerge.twMerge(defaultValues[key], userValues[key]);
2414
- }
2415
- });
2416
- }
2417
- if (mode === 'replace') {
2418
- defaultKeys.forEach((key)=>{
2419
- if (userValues[key]) {
2420
- mergedValues[key] = userValues[key];
2421
- }
2422
- });
2423
- }
2424
- return mergedValues;
2425
- };
2426
-
2427
2450
  const isPropertyKey = (value)=>{
2428
2451
  return typeof value === 'string' || typeof value === 'number' || typeof value === 'symbol';
2429
2452
  };
@@ -2474,8 +2497,9 @@ const FooterRowComponent = ({ item, rowClassname })=>{
2474
2497
  case 'Links':
2475
2498
  {
2476
2499
  const links = item[itemType];
2500
+ const mergedClassname = mergeTailwindClassnameWithDefault(className, 'flex space-x-1');
2477
2501
  return /*#__PURE__*/ jsxRuntime.jsx("div", {
2478
- className: `flex flex-no-wrap space-x-4 ${className ?? ''}`,
2502
+ className: mergedClassname,
2479
2503
  children: links?.links.map((link, i)=>{
2480
2504
  return /*#__PURE__*/ jsxRuntime.jsxs(React.Fragment, {
2481
2505
  children: [
@@ -2610,19 +2634,20 @@ const Gen3Link = ({ className, href, linkType, text, showExternalIcon = false })
2610
2634
  });
2611
2635
  };
2612
2636
 
2613
- const LoginAccountButton = ()=>{
2637
+ const LoginAccountButton = ({ className = undefined })=>{
2614
2638
  const router$1 = router.useRouter();
2615
2639
  const handleSelected = async ()=>{
2616
2640
  await router$1.push('Profile');
2617
2641
  };
2618
2642
  const userStatus = core.useCoreSelector((state)=>core.selectUserAuthStatus(state));
2619
2643
  const userInfo = core.useCoreSelector((state)=>core.selectUserDetails(state));
2644
+ const mergedClassname = mergeTailwindClassnameWithDefault(className, 'flex flex-nowrap items-center align-middle border-b-2 hover:border-accent border-transparent');
2620
2645
  if (userStatus && core.isAuthenticated(userStatus)) {
2621
2646
  return /*#__PURE__*/ jsxRuntime.jsx(core$1.UnstyledButton, {
2622
2647
  className: "mx-2",
2623
2648
  onClick: ()=>handleSelected(),
2624
2649
  children: /*#__PURE__*/ jsxRuntime.jsx("div", {
2625
- className: "flex flex-nowrap items-center align-middle border-b-2 hover:border-accent border-transparent",
2650
+ className: mergedClassname,
2626
2651
  children: userInfo?.username
2627
2652
  })
2628
2653
  });
@@ -2689,7 +2714,8 @@ const processTopBarItems = (items, showLogin)=>{
2689
2714
  };
2690
2715
  const TopBar = ({ items, loginButtonVisibility = LoginButtonVisibility.Hidden, classNames = {} })=>{
2691
2716
  const classNamesDefaults = {
2692
- root: 'flex justify-end items-center align-middle w-100 bg-secondary-lighter'
2717
+ root: 'flex justify-end items-center align-middle w-100 bg-secondary-lighter',
2718
+ login: 'font-content hover:border-accent'
2693
2719
  };
2694
2720
  const mergedClassnames = mergeDefaultTailwindClassnames(classNamesDefaults, classNames);
2695
2721
  return /*#__PURE__*/ jsxRuntime.jsx("div", {
@@ -2701,9 +2727,12 @@ const TopBar = ({ items, loginButtonVisibility = LoginButtonVisibility.Hidden, c
2701
2727
  className: "flex items-center align-middle",
2702
2728
  children: [
2703
2729
  processTopBarItems(items, loginButtonVisibility === LoginButtonVisibility.Visible),
2704
- loginButtonVisibility != LoginButtonVisibility.Hidden ? /*#__PURE__*/ jsxRuntime.jsx(LoginAccountButton, {}) : null,
2730
+ loginButtonVisibility != LoginButtonVisibility.Hidden ? /*#__PURE__*/ jsxRuntime.jsx(LoginAccountButton, {
2731
+ className: extractClassName('login', mergedClassnames)
2732
+ }) : null,
2705
2733
  loginButtonVisibility != LoginButtonVisibility.Hidden ? /*#__PURE__*/ jsxRuntime.jsx(LoginButton, {
2706
- visibility: loginButtonVisibility
2734
+ visibility: loginButtonVisibility,
2735
+ className: extractClassName('login', mergedClassnames)
2707
2736
  }) : null
2708
2737
  ]
2709
2738
  })
@@ -2732,7 +2761,7 @@ const TopBar = ({ items, loginButtonVisibility = LoginButtonVisibility.Hidden, c
2732
2761
 
2733
2762
  const NavigationLogo = ({ src, title, description, width, height, divider = false, basePath = '', classNames = {} })=>{
2734
2763
  const classNamesDefaults = {
2735
- root: 'relative flex py-2 justify-start items-center align-middle font-heading font-bold tracking-wide text-xl ml-[5px] mr-[20px]',
2764
+ root: 'relative flex py-0 justify-start items-center align-middle font-heading font-bold tracking-wide text-xl ml-[5px] mr-[20px]',
2736
2765
  link: 'relative object-contain',
2737
2766
  logo: 'px-3',
2738
2767
  title: 'border-solid border-base-darker ml-1 mr-3',
@@ -2780,9 +2809,10 @@ const NavigationLogo = ({ src, title, description, width, height, divider = fals
2780
2809
  * @param name - the name of the button
2781
2810
  * @param iconHeight - the height of the icon
2782
2811
  * @param classNames - the class names to use for root, label, icon/tooltip and arrow'
2783
- */ const NavigationBarButton = ({ tooltip, icon, href, name, iconHeight = '27px', classNames = {} })=>{
2812
+ * @param noBasePath - set to true to avoid prepending a basePath to the link
2813
+ */ const NavigationBarButton = ({ tooltip, icon, href, name, iconHeight = '27px', classNames = {}, noBasePath = false })=>{
2784
2814
  const classNamesDefaults = {
2785
- root: `flex flex-col flex-nowrap px-3 py-2 pt-4 items-center align-center text-primary hover:text-accent opacity-80 hover:opacity-100`,
2815
+ root: 'flex flex-col flex-nowrap px-3 py-2 pt-4 items-center align-center text-primary hover:text-accent opacity-80 hover:opacity-100',
2786
2816
  label: 'pt-1.5 body-typo font-heading text-sm text-nowrap',
2787
2817
  icon: 'mt-0.5 ml-1',
2788
2818
  ...TooltipStyle
@@ -2791,13 +2821,31 @@ const NavigationLogo = ({ src, title, description, width, height, divider = fals
2791
2821
  return /*#__PURE__*/ jsxRuntime.jsx(React.Fragment, {
2792
2822
  children: /*#__PURE__*/ jsxRuntime.jsx(core$1.Tooltip, {
2793
2823
  label: tooltip,
2824
+ disabled: !tooltip,
2794
2825
  multiline: true,
2795
2826
  position: "bottom",
2796
2827
  arrowSize: 8,
2797
2828
  withArrow: true,
2798
2829
  zIndex: 1000,
2799
2830
  w: 220,
2800
- children: /*#__PURE__*/ jsxRuntime.jsx(Link, {
2831
+ children: noBasePath ? /*#__PURE__*/ jsxRuntime.jsx("a", {
2832
+ href: `${href}`,
2833
+ children: /*#__PURE__*/ jsxRuntime.jsxs("div", {
2834
+ className: extractClassName('root', mergedClassnames),
2835
+ role: "navigation",
2836
+ children: [
2837
+ /*#__PURE__*/ jsxRuntime.jsx(react.Icon, {
2838
+ height: iconHeight,
2839
+ icon: icon,
2840
+ className: extractClassName('icon', mergedClassnames)
2841
+ }),
2842
+ /*#__PURE__*/ jsxRuntime.jsx("p", {
2843
+ className: extractClassName('label', mergedClassnames),
2844
+ children: name
2845
+ })
2846
+ ]
2847
+ })
2848
+ }) : /*#__PURE__*/ jsxRuntime.jsx(Link, {
2801
2849
  href: `${// need this to preserve running in hybrid mode
2802
2850
  process.env.NEXT_PUBLIC_PORTAL_BASENAME && process.env.NEXT_PUBLIC_PORTAL_BASENAME !== '/' ? process.env.NEXT_PUBLIC_PORTAL_BASENAME : ''}${href}`,
2803
2851
  children: /*#__PURE__*/ jsxRuntime.jsxs("div", {
@@ -2867,7 +2915,8 @@ const NavigationLogo = ({ src, title, description, width, height, divider = fals
2867
2915
  icon: x.icon,
2868
2916
  href: x.href,
2869
2917
  name: x.name,
2870
- classNames: x.classNames
2918
+ classNames: x.classNames,
2919
+ noBasePath: x?.noBasePath
2871
2920
  })
2872
2921
  }, `${x.name}-${index}`);
2873
2922
  })
@@ -3034,6 +3083,7 @@ const HorizontalNavigationBar = ({ actions, items, logo = undefined, loginIcon =
3034
3083
  * @param {string} props.type - The type of header to render. Default value is 'original'.
3035
3084
  * @returns {JSX.Element} - The rendered Header component.
3036
3085
  */ const Header = ({ top, navigation, banners, type = 'original' })=>{
3086
+ console.log('top', top);
3037
3087
  return type === 'horizontal' ? /*#__PURE__*/ jsxRuntime.jsxs("div", {
3038
3088
  className: "w-full",
3039
3089
  children: [
@@ -3379,14 +3429,14 @@ var AccessLevel;
3379
3429
  const DataAccessCellRenderer = ({ value })=>{
3380
3430
  if (value === AccessLevel.PENDING) {
3381
3431
  return /*#__PURE__*/ jsxRuntime.jsx(lu.LuClock, {
3382
- color: "green",
3383
- children: "You have access to this study."
3432
+ color: "yellow",
3433
+ children: "Your access to this study is pending."
3384
3434
  });
3385
3435
  }
3386
3436
  if (value === AccessLevel.NOT_AVAILABLE) {
3387
3437
  return /*#__PURE__*/ jsxRuntime.jsx(lu.LuCircleSlash, {
3388
- color: "green",
3389
- children: "You have access to this study."
3438
+ color: "red",
3439
+ children: "Cannot determine access to this study. Please contact the study owner."
3390
3440
  });
3391
3441
  }
3392
3442
  if (value === AccessLevel.ACCESSIBLE) {
@@ -3397,8 +3447,8 @@ const DataAccessCellRenderer = ({ value })=>{
3397
3447
  }
3398
3448
  if (value === AccessLevel.UNACCESSIBLE) {
3399
3449
  return /*#__PURE__*/ jsxRuntime.jsx(lu.LuLock, {
3400
- color: "green",
3401
- children: "You have access to this study."
3450
+ color: "red",
3451
+ children: "You do not have access to this study."
3402
3452
  });
3403
3453
  }
3404
3454
  return /*#__PURE__*/ jsxRuntime.jsx(React.Fragment, {});
@@ -5084,7 +5134,7 @@ const BuildSummaryStatisticPanel = (summaries = [])=>{
5084
5134
  }
5085
5135
  });
5086
5136
  };
5087
- const columns = [
5137
+ const columns$3 = [
5088
5138
  'grid-cols-0',
5089
5139
  'grid-cols-1',
5090
5140
  'grid-cols-2',
@@ -5099,7 +5149,7 @@ const columns = [
5099
5149
  ];
5100
5150
  const SummaryStatisticPanel = ({ summaries })=>{
5101
5151
  return /*#__PURE__*/ jsxRuntime.jsx("div", {
5102
- className: `grid ${columns[summaries.length]} grow shrink-0 divide-x-2 divide-accent`,
5152
+ className: `grid ${columns$3[summaries.length]} grow shrink-0 divide-x-2 divide-accent`,
5103
5153
  children: BuildSummaryStatisticPanel(summaries)
5104
5154
  });
5105
5155
  };
@@ -8048,7 +8098,7 @@ const isRangeOperation = (x)=>{
8048
8098
  const isNestedFilter = (x)=>{
8049
8099
  return 'path' in x;
8050
8100
  };
8051
- const IncludeExcludeQueryElement = ({ index, field, path, operator, operands })=>{
8101
+ const IncludeExcludeQueryElement = ({ index, field, path, operator, operands, displayOnly = false })=>{
8052
8102
  const dispatch = core.useCoreDispatch();
8053
8103
  const [queryExpressionsExpanded, setQueryExpressionsExpanded] = React.useContext(QueryExpressionsExpandedContext);
8054
8104
  const currentCohortId = core.useCoreSelector((state)=>core.selectCurrentCohortId(state));
@@ -8111,12 +8161,12 @@ const IncludeExcludeQueryElement = ({ index, field, path, operator, operands })=
8111
8161
  variant: "filled",
8112
8162
  color: "accent.5",
8113
8163
  size: "md",
8114
- pr: 0,
8115
- className: "normal-case items-center max-w-[162px] cursor-pointer pl-2 pr-0 hover:bg-accent-darker",
8116
- rightSection: /*#__PURE__*/ jsxRuntime.jsx(RemoveButton, {
8164
+ className: `normal-case items-center max-w-[162px] cursor-pointer hover:bg-accent-darker pl-2 ${displayOnly ? 'pr-3' : 'pr-0'}`,
8165
+ rightSection: !displayOnly && /*#__PURE__*/ jsxRuntime.jsx(RemoveButton, {
8117
8166
  value: value
8118
8167
  }),
8119
8168
  onClick: ()=>{
8169
+ if (displayOnly) return;
8120
8170
  const newOperands = operandsArray.filter((o)=>o !== x);
8121
8171
  const fieldToUpdate = path && path != '.' ? [
8122
8172
  path,
@@ -8158,7 +8208,7 @@ const IncludeExcludeQueryElement = ({ index, field, path, operator, operands })=
8158
8208
  ]
8159
8209
  });
8160
8210
  };
8161
- const ComparisonElement = ({ index, filter, showLabel = true })=>{
8211
+ const ComparisonElement = ({ index, filter, showLabel = true, displayOnly = false })=>{
8162
8212
  const coreDispatch = core.useCoreDispatch();
8163
8213
  // fix the code below
8164
8214
  const handleKeepMember = (keep)=>{
@@ -8178,7 +8228,10 @@ const ComparisonElement = ({ index, filter, showLabel = true })=>{
8178
8228
  children: [
8179
8229
  /*#__PURE__*/ jsxRuntime.jsx("button", {
8180
8230
  className: "h-[25px] w-[25px] mx-2 rounded-[50%] bg-accent-cool-lightest text-accent-cool-lightest-contrast pb-1",
8181
- onClick: ()=>handleKeepMember(filter),
8231
+ onClick: ()=>{
8232
+ if (displayOnly) return;
8233
+ handleKeepMember(filter);
8234
+ },
8182
8235
  children: filter.operator
8183
8236
  }),
8184
8237
  /*#__PURE__*/ jsxRuntime.jsx(QueryRepresentationText, {
@@ -8231,7 +8284,7 @@ const ClosedRangeQueryElement = ({ index, lower, upper, op = 'and' })=>{
8231
8284
  })
8232
8285
  });
8233
8286
  };
8234
- const QueryElement = ({ index, field, path, children })=>{
8287
+ const QueryElement = ({ index, field, path, children, displayOnly = false })=>{
8235
8288
  const coreDispatch = core.useCoreDispatch();
8236
8289
  const [, setQueryExpressionsExpanded] = React.useContext(QueryExpressionsExpandedContext);
8237
8290
  const currentCohortId = core.useCoreSelector((state)=>core.selectCurrentCohortId(state));
@@ -8253,7 +8306,7 @@ const QueryElement = ({ index, field, path, children })=>{
8253
8306
  return /*#__PURE__*/ jsxRuntime.jsxs(QueryItemContainer, {
8254
8307
  children: [
8255
8308
  children,
8256
- /*#__PURE__*/ jsxRuntime.jsx("button", {
8309
+ !displayOnly && /*#__PURE__*/ jsxRuntime.jsx("button", {
8257
8310
  className: "bg-accent-vivid p-0 m-0 h-full rounded-r-sm text-white hover:bg-accent-darker",
8258
8311
  onClick: handleRemoveFilter,
8259
8312
  "aria-label": `remove ${core.fieldNameToTitle(field)}`,
@@ -8268,85 +8321,102 @@ const QueryElement = ({ index, field, path, children })=>{
8268
8321
  /**
8269
8322
  * Processes a Filter into a component representation
8270
8323
  */ class CohortFilterToComponent {
8271
- constructor(index, path = '.'){
8324
+ constructor(index, path = '.', displayOnly = false){
8272
8325
  this.handleIncludes = (f)=>/*#__PURE__*/ jsxRuntime.jsx(QueryElement, {
8273
8326
  ...f,
8274
8327
  index: this.index,
8275
8328
  path: this.path,
8329
+ displayOnly: this.displayOnly,
8276
8330
  children: /*#__PURE__*/ jsxRuntime.jsx(IncludeExcludeQueryElement, {
8277
8331
  ...f,
8278
8332
  index: this.index,
8279
- path: this.path
8333
+ path: this.path,
8334
+ displayOnly: this.displayOnly
8280
8335
  })
8281
8336
  }, f.field);
8282
8337
  this.handleExcludes = (f)=>/*#__PURE__*/ jsxRuntime.jsx(QueryElement, {
8283
8338
  ...f,
8284
8339
  index: this.index,
8285
8340
  path: this.path,
8341
+ displayOnly: this.displayOnly,
8286
8342
  children: /*#__PURE__*/ jsxRuntime.jsx(IncludeExcludeQueryElement, {
8287
8343
  ...f,
8288
8344
  index: this.index,
8289
- path: this.path
8345
+ path: this.path,
8346
+ displayOnly: this.displayOnly
8290
8347
  })
8291
8348
  }, f.field);
8292
8349
  this.handleEquals = (f)=>/*#__PURE__*/ jsxRuntime.jsx(QueryElement, {
8293
8350
  ...f,
8294
8351
  index: this.index,
8295
8352
  path: this.path,
8353
+ displayOnly: this.displayOnly,
8296
8354
  children: /*#__PURE__*/ jsxRuntime.jsx(ComparisonElement, {
8297
8355
  filter: f,
8298
- index: this.index
8356
+ index: this.index,
8357
+ displayOnly: this.displayOnly
8299
8358
  })
8300
8359
  }, f.field);
8301
8360
  this.handleNotEquals = (f)=>/*#__PURE__*/ jsxRuntime.jsx(QueryElement, {
8302
8361
  ...f,
8303
8362
  index: this.index,
8304
8363
  path: this.path,
8364
+ displayOnly: this.displayOnly,
8305
8365
  children: /*#__PURE__*/ jsxRuntime.jsx(ComparisonElement, {
8306
8366
  filter: f,
8307
- index: this.index
8367
+ index: this.index,
8368
+ displayOnly: this.displayOnly
8308
8369
  })
8309
8370
  }, f.field);
8310
8371
  this.handleLessThan = (f)=>/*#__PURE__*/ jsxRuntime.jsx(QueryElement, {
8311
8372
  ...f,
8312
8373
  index: this.index,
8313
8374
  path: this.path,
8375
+ displayOnly: this.displayOnly,
8314
8376
  children: /*#__PURE__*/ jsxRuntime.jsx(ComparisonElement, {
8315
8377
  filter: f,
8316
- index: this.index
8378
+ index: this.index,
8379
+ displayOnly: this.displayOnly
8317
8380
  })
8318
8381
  }, f.field);
8319
8382
  this.handleLessThanOrEquals = (f)=>/*#__PURE__*/ jsxRuntime.jsx(QueryElement, {
8320
8383
  ...f,
8321
8384
  index: this.index,
8322
8385
  path: this.path,
8386
+ displayOnly: this.displayOnly,
8323
8387
  children: /*#__PURE__*/ jsxRuntime.jsx(ComparisonElement, {
8324
8388
  filter: f,
8325
- index: this.index
8389
+ index: this.index,
8390
+ displayOnly: this.displayOnly
8326
8391
  })
8327
8392
  }, f.field);
8328
8393
  this.handleGreaterThan = (f)=>/*#__PURE__*/ jsxRuntime.jsx(QueryElement, {
8329
8394
  ...f,
8330
8395
  index: this.index,
8331
8396
  path: this.path,
8397
+ displayOnly: this.displayOnly,
8332
8398
  children: /*#__PURE__*/ jsxRuntime.jsx(ComparisonElement, {
8333
8399
  filter: f,
8334
- index: this.index
8400
+ index: this.index,
8401
+ displayOnly: this.displayOnly
8335
8402
  })
8336
8403
  }, f.field);
8337
8404
  this.handleGreaterThanOrEquals = (f)=>/*#__PURE__*/ jsxRuntime.jsx(QueryElement, {
8338
8405
  ...f,
8339
8406
  index: this.index,
8340
8407
  path: this.path,
8408
+ displayOnly: this.displayOnly,
8341
8409
  children: /*#__PURE__*/ jsxRuntime.jsx(ComparisonElement, {
8342
8410
  filter: f,
8343
- index: this.index
8411
+ index: this.index,
8412
+ displayOnly: this.displayOnly
8344
8413
  })
8345
8414
  }, f.field);
8346
8415
  this.handleExists = (f)=>/*#__PURE__*/ jsxRuntime.jsx(QueryElement, {
8347
8416
  ...f,
8348
8417
  index: this.index,
8349
8418
  path: this.path,
8419
+ displayOnly: this.displayOnly,
8350
8420
  children: /*#__PURE__*/ jsxRuntime.jsx(ExistsElement, {
8351
8421
  ...f
8352
8422
  })
@@ -8355,6 +8425,7 @@ const QueryElement = ({ index, field, path, children })=>{
8355
8425
  ...f,
8356
8426
  index: this.index,
8357
8427
  path: this.path,
8428
+ displayOnly: this.displayOnly,
8358
8429
  children: /*#__PURE__*/ jsxRuntime.jsx(ExistsElement, {
8359
8430
  ...f
8360
8431
  })
@@ -8363,9 +8434,11 @@ const QueryElement = ({ index, field, path, children })=>{
8363
8434
  ...f,
8364
8435
  index: this.index,
8365
8436
  path: this.path,
8437
+ displayOnly: this.displayOnly,
8366
8438
  children: /*#__PURE__*/ jsxRuntime.jsx(IncludeExcludeQueryElement, {
8367
8439
  ...f,
8368
- index: this.index
8440
+ index: this.index,
8441
+ displayOnly: this.displayOnly
8369
8442
  })
8370
8443
  }, f.field);
8371
8444
  this.handleIntersection = (f)=>{
@@ -8399,17 +8472,18 @@ const QueryElement = ({ index, field, path, children })=>{
8399
8472
  return convertFilterToComponent(newOp, this.index, [
8400
8473
  op.path,
8401
8474
  op.operand.path
8402
- ].join('.'));
8475
+ ].join('.'), this.displayOnly);
8403
8476
  } else {
8404
- return convertFilterToComponent(op.operand, this.index, op.path);
8477
+ return convertFilterToComponent(op.operand, this.index, op.path, this.displayOnly);
8405
8478
  }
8406
8479
  };
8407
8480
  this.index = index;
8408
8481
  this.path = path;
8482
+ this.displayOnly = displayOnly;
8409
8483
  }
8410
8484
  }
8411
- const convertFilterToComponent = (filter, index, path = '.')=>{
8412
- const handler = new CohortFilterToComponent(index, path);
8485
+ const convertFilterToComponent = (filter, index, path = '.', displayOnly = false)=>{
8486
+ const handler = new CohortFilterToComponent(index, path, displayOnly);
8413
8487
  return core.handleOperation(handler, filter);
8414
8488
  };
8415
8489
 
@@ -8619,7 +8693,7 @@ const reducer = (state, action)=>{
8619
8693
  }
8620
8694
  }
8621
8695
  };
8622
- const QueryExpressionSection = ({ index, filters, currentCohortName, currentCohortId })=>{
8696
+ const QueryExpressionSection = ({ index, filters, currentCohortName, currentCohortId, displayOnly = false, showTitle = true })=>{
8623
8697
  const [expandedState, setExpandedState] = React.useReducer(reducer, {});
8624
8698
  const [filtersSectionCollapsed, setFiltersSectionCollapsed] = React.useState(true);
8625
8699
  const filtersRef = React.useRef(null);
@@ -8676,14 +8750,14 @@ const QueryExpressionSection = ({ index, filters, currentCohortName, currentCoho
8676
8750
  "data-testid": "text-cohort-filters-top-row",
8677
8751
  className: "flex flex-row py-2 items-center border-secondary-darkest border-b-1",
8678
8752
  children: [
8679
- /*#__PURE__*/ jsxRuntime.jsx(OverflowTooltippedLabel, {
8753
+ showTitle && /*#__PURE__*/ jsxRuntime.jsx(OverflowTooltippedLabel, {
8680
8754
  label: currentCohortName,
8681
8755
  className: "font-bold text-secondary-contrast-darkest ml-3 max-w-[260px]",
8682
8756
  children: currentCohortName
8683
8757
  }),
8684
8758
  /*#__PURE__*/ jsxRuntime.jsxs(React.Fragment, {
8685
8759
  children: [
8686
- /*#__PURE__*/ jsxRuntime.jsx("button", {
8760
+ !displayOnly && /*#__PURE__*/ jsxRuntime.jsx("button", {
8687
8761
  "data-testid": "button-clear-all-cohort-filters",
8688
8762
  className: `text-sm font-montserrat ml-2 px-1 hover:bg-primary-darkest hover:text-primary-content-lightest hover:rounded-md ${noFilters ? 'hidden' : 'cursor-pointer text-secondary-contrast-darkest'}`,
8689
8763
  onClick: clearAllFilters,
@@ -8768,7 +8842,7 @@ const QueryExpressionSection = ({ index, filters, currentCohortName, currentCoho
8768
8842
  className: "font-content",
8769
8843
  children: "No filters currently applied."
8770
8844
  }) : Object.keys(filters.root).map((k)=>{
8771
- return convertFilterToComponent(filters.root[k], index);
8845
+ return convertFilterToComponent(filters.root[k], index, '.', displayOnly);
8772
8846
  })
8773
8847
  })
8774
8848
  ]
@@ -10395,7 +10469,6 @@ const NotebookCard = ({ info })=>{
10395
10469
  const { status } = core.useCoreSelector(core.selectWorkspaceStatusFromService);
10396
10470
  const requestedStatus = core.useCoreSelector(core.selectRequestedWorkspaceStatus);
10397
10471
  const workspaceId = core.useCoreSelector(core.selectActiveWorkspaceId);
10398
- console.log('NotebookCard: ', requestedStatus, workspaceId, status);
10399
10472
  return /*#__PURE__*/ jsxRuntime.jsxs(core$1.Card, {
10400
10473
  withBorder: true,
10401
10474
  radius: "xs",
@@ -11225,7 +11298,7 @@ class FilesystemContent {
11225
11298
  }
11226
11299
  async get(filepath) {
11227
11300
  try {
11228
- return await JSON.parse(fs.readFileSync(path.join(this.rootPath, filepath)).toString('utf-8'));
11301
+ return await JSON.parse(fs.readFileSync(path.join(this.rootPath, filepath)).toString('utf8'));
11229
11302
  } catch (err) {
11230
11303
  throw new Error(`Cannot process ${filepath}`);
11231
11304
  }
@@ -16648,7 +16721,6 @@ const AnalysisCardEditor = ()=>{
16648
16721
  });
16649
16722
  if (Array.isArray(withImages)) {
16650
16723
  updateHistory(withImages);
16651
- console.log('Imported cards:', withImages);
16652
16724
  }
16653
16725
  } catch (error) {
16654
16726
  alert('Invalid file format');
@@ -17215,6 +17287,1834 @@ const NotebookLitePageGetStaticProps = async ()=>{
17215
17287
  };
17216
17288
  };
17217
17289
 
17290
+ const getDataLibraryItem = (dataLibrary, listId, dataId, fileId)=>{
17291
+ if (!(listId in dataLibrary)) return undefined;
17292
+ if (!(dataId in dataLibrary[listId].items)) return undefined;
17293
+ const datasetOrCohort = dataLibrary[listId].items[dataId];
17294
+ const { name } = datasetOrCohort;
17295
+ if (core.isCohortItem(datasetOrCohort)) {
17296
+ return {
17297
+ ...datasetOrCohort,
17298
+ datasetId: dataId,
17299
+ datasetName: name
17300
+ };
17301
+ } else {
17302
+ if (!fileId) return undefined;
17303
+ if (!(fileId in datasetOrCohort.items)) return undefined;
17304
+ if (core.isFileItem(datasetOrCohort.items[fileId])) {
17305
+ return {
17306
+ datasetName: name,
17307
+ datasetId: dataId,
17308
+ ...datasetOrCohort.items[fileId]
17309
+ };
17310
+ }
17311
+ return undefined;
17312
+ }
17313
+ };
17314
+ const getSelectionPaths = (selections)=>{
17315
+ const paths = [];
17316
+ for (const [listId, listMembers] of Object.entries(selections)){
17317
+ for (const [memberId, member] of Object.entries(listMembers)){
17318
+ if (Object.keys(member.objectIds).length === 0) {
17319
+ // If there are no objectIds, add a path with undefined objectId
17320
+ paths.push({
17321
+ listId,
17322
+ memberId
17323
+ });
17324
+ } else {
17325
+ for (const [objectId, isSelected] of Object.entries(member.objectIds)){
17326
+ if (isSelected) {
17327
+ paths.push({
17328
+ listId,
17329
+ memberId,
17330
+ objectId
17331
+ });
17332
+ }
17333
+ }
17334
+ }
17335
+ }
17336
+ }
17337
+ return paths;
17338
+ };
17339
+ const getSelectedItemsFromDataLibrary = (selections, dataLibrary)=>{
17340
+ const selectedPaths = getSelectionPaths(selections);
17341
+ const uniqueItems = new Map();
17342
+ selectedPaths.forEach((path)=>{
17343
+ const item = getDataLibraryItem(dataLibrary, path.listId, path.memberId, path.objectId);
17344
+ if (item) {
17345
+ const key = getUniqueItemKey(item);
17346
+ uniqueItems.set(key, item);
17347
+ }
17348
+ });
17349
+ return Array.from(uniqueItems.values());
17350
+ };
17351
+ const getUniqueItemKey = (item)=>{
17352
+ if (core.isCohortItem(item)) {
17353
+ // For CohortItems
17354
+ return `cohort_${item.datasetId}`;
17355
+ } else {
17356
+ // For FileItems
17357
+ return `file_${item.datasetId}_${item.id}`;
17358
+ }
17359
+ };
17360
+
17361
+ // Create the context
17362
+ const DataLibrarySelectionContext = /*#__PURE__*/ React.createContext(undefined);
17363
+ // Reducer function
17364
+ const dataLibrarySelectionReducer = (selections, action)=>{
17365
+ switch(action.type){
17366
+ case 'UPDATE_DATA_LIBRARY_SELECTION':
17367
+ return {
17368
+ ...selections,
17369
+ [action.payload.listId]: action.payload.members
17370
+ };
17371
+ case 'UPDATE_DATALIST_MEMBER_SELECTION':
17372
+ if (Object.keys(action.payload.selection).length === 0) {
17373
+ // need to remove the dataset
17374
+ const { [action.payload.listId]: { [action.payload.memberId]: _unused, ...restState } } = selections;
17375
+ if (Object.keys(restState).length === 0) {
17376
+ const { [action.payload.listId]: _unused2, ...restList } = selections;
17377
+ return restList;
17378
+ }
17379
+ return {
17380
+ ...selections,
17381
+ [action.payload.listId]: {
17382
+ ...restState
17383
+ }
17384
+ };
17385
+ }
17386
+ return {
17387
+ ...selections,
17388
+ [action.payload.listId]: {
17389
+ ...selections[action.payload.listId],
17390
+ [action.payload.memberId]: {
17391
+ id: action.payload.memberId,
17392
+ objectIds: action.payload.selection
17393
+ }
17394
+ }
17395
+ };
17396
+ case 'DELETE_DATA_LIBRARY_LIST':
17397
+ {
17398
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
17399
+ const { [action.payload.listId]: _unused, ...restState } = selections;
17400
+ return restState;
17401
+ }
17402
+ case 'DELETE_DATA_LIBRARY_LIST_MEMBER':
17403
+ {
17404
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
17405
+ if (!(action.payload.listId in selections)) return selections;
17406
+ const { [action.payload.listId]: { [action.payload.memberId]: _unused, ...restState } } = selections;
17407
+ return {
17408
+ ...selections,
17409
+ [action.payload.listId]: {
17410
+ ...restState
17411
+ }
17412
+ };
17413
+ }
17414
+ case 'CLEAR_DATA_LIBRARY_SELECTION':
17415
+ return {};
17416
+ default:
17417
+ return selections;
17418
+ }
17419
+ };
17420
+ // Provider component
17421
+ const DataLibrarySelectionProvider = ({ children })=>{
17422
+ const [selections, dispatch] = React.useReducer(dataLibrarySelectionReducer, {});
17423
+ const [gatheredItems, setGatheredItems] = React.useState([]);
17424
+ const updateSelections = (listId, members)=>{
17425
+ dispatch(updateDataLibrarySelection(listId, members));
17426
+ };
17427
+ const updateListMemberSelections = (listId, memberId, selection)=>{
17428
+ dispatch(updateDataLibraryListMemberSelection(listId, memberId, selection));
17429
+ };
17430
+ const clearSelections = ()=>{
17431
+ dispatch(clearDataLibrarySelection());
17432
+ };
17433
+ const removeList = (listId)=>{
17434
+ dispatch(removeDataLibrarySelection(listId));
17435
+ };
17436
+ const removeListMember = (listId, memberId)=>{
17437
+ dispatch(removeDataLibraryMemberSelection(listId, memberId));
17438
+ };
17439
+ const gatherSelectedItems = (dataLibrary)=>{
17440
+ if (dataLibrary) {
17441
+ const gatheredItems = getSelectedItemsFromDataLibrary(selections, dataLibrary);
17442
+ setGatheredItems(gatheredItems);
17443
+ }
17444
+ };
17445
+ return /*#__PURE__*/ jsxRuntime.jsx(DataLibrarySelectionContext.Provider, {
17446
+ value: {
17447
+ selections,
17448
+ gatheredItems,
17449
+ dispatch,
17450
+ updateSelections,
17451
+ updateListMemberSelections,
17452
+ clearSelections,
17453
+ removeList,
17454
+ removeListMember,
17455
+ gatherSelectedItems
17456
+ },
17457
+ children: children
17458
+ });
17459
+ };
17460
+ // Custom hook for using the data library
17461
+ const useDataLibrarySelection = ()=>{
17462
+ const context = React.useContext(DataLibrarySelectionContext);
17463
+ if (!context) {
17464
+ throw new Error('useDataLibrary must be used within a DataLibraryProvider');
17465
+ }
17466
+ return context;
17467
+ };
17468
+ const updateDataLibrarySelection = (listId, members)=>({
17469
+ type: 'UPDATE_DATA_LIBRARY_SELECTION',
17470
+ payload: {
17471
+ listId,
17472
+ members
17473
+ }
17474
+ });
17475
+ const updateDataLibraryListMemberSelection = (listId, memberId, selection)=>({
17476
+ type: 'UPDATE_DATALIST_MEMBER_SELECTION',
17477
+ payload: {
17478
+ listId,
17479
+ memberId,
17480
+ selection
17481
+ }
17482
+ });
17483
+ const clearDataLibrarySelection = ()=>({
17484
+ type: 'CLEAR_DATA_LIBRARY_SELECTION'
17485
+ });
17486
+ const removeDataLibrarySelection = (listId)=>({
17487
+ type: 'DELETE_DATA_LIBRARY_LIST',
17488
+ payload: {
17489
+ listId
17490
+ }
17491
+ });
17492
+ const removeDataLibraryMemberSelection = (listId, memberId)=>({
17493
+ type: 'DELETE_DATA_LIBRARY_LIST_MEMBER',
17494
+ payload: {
17495
+ listId,
17496
+ memberId
17497
+ }
17498
+ });
17499
+ const getNumberOfDataSetItemsSelected = (selections, listId, itemId)=>{
17500
+ return Object.keys(selections?.[listId]?.[itemId]?.objectIds ?? {}).length;
17501
+ };
17502
+ const getNumberOfSelectedItemsInList = (selections, listId)=>{
17503
+ if (!(listId in selections)) return -1; // return -1 indicating there is no listId in selection
17504
+ return Object.keys(selections[listId]).reduce((count, datasetId)=>{
17505
+ try {
17506
+ return count + getNumberOfDataSetItemsSelected(selections, listId, datasetId);
17507
+ } catch (error) {
17508
+ console.error(`Failed to get number of selected items for dataset ${datasetId} in list ${listId}:`, error);
17509
+ return count;
17510
+ }
17511
+ }, 0);
17512
+ };
17513
+ const isListInSelection = (listId, selections)=>listId in selections;
17514
+
17515
+ const IconSize = {
17516
+ xs: 14,
17517
+ sm: 16,
17518
+ md: 20,
17519
+ lg: 24,
17520
+ xl: 32,
17521
+ 'xl-2': 36
17522
+ };
17523
+
17524
+ const SearchAndActions = ({ createList, gatherData, size = 'sm' })=>{
17525
+ const { selections, clearSelections } = useDataLibrarySelection();
17526
+ const retrieveDisabled = Object.keys(selections).length === 0;
17527
+ const iconSize = IconSize[size] || IconSize['sm'];
17528
+ return /*#__PURE__*/ jsxRuntime.jsx("div", {
17529
+ className: "flex justify-between p-2 bg-primary-dark text-primary-contrast-dark",
17530
+ children: /*#__PURE__*/ jsxRuntime.jsxs(core$1.Group, {
17531
+ children: [
17532
+ /*#__PURE__*/ jsxRuntime.jsx(core$1.Tooltip, {
17533
+ label: "Retrieve selections",
17534
+ children: /*#__PURE__*/ jsxRuntime.jsx(core$1.Button, {
17535
+ disabled: retrieveDisabled,
17536
+ // disabled={Object.keys(selections).length === 0}
17537
+ size: `compact-${size}`,
17538
+ variant: "outline",
17539
+ onClick: ()=>gatherData(),
17540
+ "aria-label": "Retrieve Selected Data",
17541
+ classNames: {
17542
+ root: 'bg-base-max hover:bg-base-light'
17543
+ },
17544
+ children: "Retrieve Selected"
17545
+ })
17546
+ }),
17547
+ /*#__PURE__*/ jsxRuntime.jsx(core$1.Tooltip, {
17548
+ label: "Clear selections",
17549
+ children: /*#__PURE__*/ jsxRuntime.jsx(core$1.ActionIcon, {
17550
+ disabled: retrieveDisabled,
17551
+ variant: "outline",
17552
+ size: size,
17553
+ onClick: ()=>{
17554
+ clearSelections();
17555
+ },
17556
+ color: "accent-contrast.4",
17557
+ "aria-label": "clear selections",
17558
+ children: /*#__PURE__*/ jsxRuntime.jsx(react.Icon, {
17559
+ icon: "gen3:clear-list",
17560
+ width: iconSize,
17561
+ height: iconSize
17562
+ })
17563
+ })
17564
+ })
17565
+ ]
17566
+ })
17567
+ });
17568
+ };
17569
+
17570
+ const HTTPUserFriendlyErrorMessages = {
17571
+ // 4xx Client Errors
17572
+ 400: 'Sorry, there was a problem with your request. Please check the information you provided and try again.',
17573
+ 401: 'Please sign in to access this content. If you need to create an account, please contact support.',
17574
+ 402: 'This feature requires payment to continue. Please update your subscription.',
17575
+ 403: "You don't have permission to access this. If you think this is a mistake, please contact support.",
17576
+ 404: "We couldn't find what you're looking for. The link might be broken or the content may have been moved.",
17577
+ 405: 'This action is not supported. Please try a different approach.',
17578
+ 406: "Your browser sent a request that this server couldn't understand. Try updating your browser.",
17579
+ 407: 'Please authenticate with the network proxy first.',
17580
+ 408: 'The request took too long to complete. Please check your internet connection and try again.',
17581
+ 409: 'There was a conflict with your request. Someone might have modified the same content.',
17582
+ 410: 'This content has been permanently removed and is no longer available.',
17583
+ 411: 'There was a technical problem with your request. Please try again.',
17584
+ 412: "Some conditions for this request weren't met. Please try again.",
17585
+ 413: "The file you're trying to upload is too large. Please choose a smaller file.",
17586
+ 414: 'The web address is too long. Please try a shorter URL.',
17587
+ 415: 'This type of file is not supported. Please try a different format.',
17588
+ 416: 'The requested content range is not available.',
17589
+ 417: "Your request couldn't be completed as expected. Please try again.",
17590
+ 418: 'Unusual error occurred. Please try again or contact support if the problem persists.',
17591
+ 421: 'Your request was sent to the wrong server. Please try again.',
17592
+ 422: "We couldn't process your request. Please check the information and try again.",
17593
+ 423: 'This resource is temporarily locked. Please try again in a few moments.',
17594
+ 424: 'The request failed because it depends on another request that failed.',
17595
+ 425: 'Your request was processed too early. Please try again in a moment.',
17596
+ 426: 'You need to upgrade your browser or app to continue.',
17597
+ 428: "Some required conditions weren't met. Please check all requirements and try again.",
17598
+ 429: "You've made too many requests. Please wait a while before trying again.",
17599
+ 431: 'Request failed because the headers are too large. Please simplify your request.',
17600
+ 451: 'This content is not available for legal reasons.',
17601
+ // 5xx Server Errors
17602
+ 500: "Something went wrong on our end. We're working to fix it. Please try again later.",
17603
+ 501: "This feature isn't available yet. Check back later.",
17604
+ 502: "We're having trouble connecting to our servers. Please try again in a few minutes.",
17605
+ 503: "Our service is temporarily unavailable. We're working to restore it as quickly as possible.",
17606
+ 504: 'The server took too long to respond. Please try again later.',
17607
+ 505: "Your browser's HTTP version isn't supported. Please try updating your browser.",
17608
+ 506: 'We encountered a configuration error.',
17609
+ 507: "We're out of storage space.",
17610
+ 508: 'We detected an infinite loop in our servers.',
17611
+ 510: 'This server requires additional extensions to process your request.',
17612
+ 511: 'Please sign in to the network before continuing.'
17613
+ };
17614
+
17615
+ const SelectedItemsTableHeader = ({ numberOfItems, numberOfWarnings, size = 'sm' })=>{
17616
+ const iconSize = IconSize[size] || IconSize['sm'];
17617
+ return /*#__PURE__*/ jsxRuntime.jsxs("div", {
17618
+ className: "flex items-center bg-primary-darker px-4 py-2 mt-2 min-h-10 text-heading",
17619
+ children: [
17620
+ numberOfItems > 0 && /*#__PURE__*/ jsxRuntime.jsxs("div", {
17621
+ className: "flex items-center flex-nowrap overflow-ellipsis text-primary-contrast-darker",
17622
+ children: [
17623
+ /*#__PURE__*/ jsxRuntime.jsx(core$1.Text, {
17624
+ fw: 600,
17625
+ size: size,
17626
+ className: "mr-1 ",
17627
+ children: numberOfItems
17628
+ }),
17629
+ /*#__PURE__*/ jsxRuntime.jsx(core$1.Text, {
17630
+ fw: 400,
17631
+ size: size,
17632
+ className: "mr-1 text-primary-contrast-lighter",
17633
+ children: "selected"
17634
+ })
17635
+ ]
17636
+ }),
17637
+ numberOfItems > 0 && numberOfWarnings > 0 && /*#__PURE__*/ jsxRuntime.jsx(react.Icon, {
17638
+ icon: "gen3:dot",
17639
+ className: "text-primary-contrast-lighter",
17640
+ width: iconSize,
17641
+ height: iconSize
17642
+ }),
17643
+ numberOfWarnings > 0 && /*#__PURE__*/ jsxRuntime.jsxs("div", {
17644
+ className: "flex items-center flex-nowrap overflow-ellipsis",
17645
+ children: [
17646
+ /*#__PURE__*/ jsxRuntime.jsx(react.Icon, {
17647
+ icon: "gen3:warning",
17648
+ width: iconSize,
17649
+ height: iconSize,
17650
+ className: "text-utility-warning m-1"
17651
+ }),
17652
+ /*#__PURE__*/ jsxRuntime.jsx(core$1.Text, {
17653
+ fw: 600,
17654
+ size: size,
17655
+ className: "mr-1 text-primary-contrast-lighter",
17656
+ children: numberOfWarnings
17657
+ }),
17658
+ /*#__PURE__*/ jsxRuntime.jsx(core$1.Text, {
17659
+ fw: 400,
17660
+ size: size,
17661
+ className: "text-primary-contrast-lighter",
17662
+ children: `${numberOfWarnings == 1 ? 'warning' : 'warnings'}`
17663
+ })
17664
+ ]
17665
+ })
17666
+ ]
17667
+ });
17668
+ };
17669
+ const SelectedItemsTable = ({ validatedItems, rowSelection, setRowSelection, size = 'sm' })=>{
17670
+ const handleRowSelectionChange = (updater)=>{
17671
+ let value = {};
17672
+ setRowSelection((prevSelection)=>{
17673
+ value = updater instanceof Function ? updater(prevSelection) : updater;
17674
+ return value;
17675
+ });
17676
+ };
17677
+ const iconSize = IconSize[size] || IconSize['sm'];
17678
+ const columns = React.useMemo(()=>[
17679
+ {
17680
+ accessorKey: 'valid',
17681
+ enableHiding: true,
17682
+ size: 40,
17683
+ maxSize: 50,
17684
+ header: 'Valid',
17685
+ Cell: ({ row })=>{
17686
+ if (row.original.valid === undefined) return /*#__PURE__*/ jsxRuntime.jsx("span", {});
17687
+ if (!row.original.valid) {
17688
+ return /*#__PURE__*/ jsxRuntime.jsx(core$1.Tooltip, {
17689
+ label: row.original?.messages?.join('\n') ?? 'Unknown Error',
17690
+ children: /*#__PURE__*/ jsxRuntime.jsx(react.Icon, {
17691
+ icon: "gen3:warning",
17692
+ width: iconSize,
17693
+ height: iconSize,
17694
+ className: "text-utility-warning text-xl",
17695
+ children: /*#__PURE__*/ jsxRuntime.jsx(core$1.Text, {
17696
+ fw: 400,
17697
+ size: size,
17698
+ children: row.original?.messages?.length
17699
+ })
17700
+ })
17701
+ });
17702
+ } else {
17703
+ return /*#__PURE__*/ jsxRuntime.jsx(react.Icon, {
17704
+ icon: "gen3:check-fill",
17705
+ width: iconSize,
17706
+ height: iconSize,
17707
+ className: "text-utility-success"
17708
+ });
17709
+ }
17710
+ }
17711
+ },
17712
+ {
17713
+ accessorKey: 'id',
17714
+ header: 'Id'
17715
+ },
17716
+ {
17717
+ accessorKey: 'description',
17718
+ header: 'Description',
17719
+ size: 150,
17720
+ maxSize: 250,
17721
+ Cell: ({ cell })=>{
17722
+ return /*#__PURE__*/ jsxRuntime.jsx(core$1.Text, {
17723
+ fw: 400,
17724
+ size: size,
17725
+ lineClamp: 2,
17726
+ children: cell.getValue() ?? 'N/A'
17727
+ });
17728
+ }
17729
+ },
17730
+ {
17731
+ accessorKey: 'type',
17732
+ header: 'Type'
17733
+ },
17734
+ {
17735
+ accessorKey: 'size',
17736
+ header: 'Size'
17737
+ },
17738
+ {
17739
+ accessorKey: 'datasetId',
17740
+ header: 'Dataset ID'
17741
+ }
17742
+ ], [
17743
+ iconSize,
17744
+ size
17745
+ ]);
17746
+ const tableRows = useDeepCompare.useDeepCompareMemo(()=>{
17747
+ let hasInvalidRows = false;
17748
+ const rows = validatedItems.map((item)=>{
17749
+ if (!item.valid) hasInvalidRows = true;
17750
+ if (core.isCohortItem(item)) {
17751
+ return {
17752
+ id: item.id,
17753
+ name: item.name,
17754
+ description: item.description,
17755
+ type: item.itemType,
17756
+ size: undefined,
17757
+ datasetName: item.name,
17758
+ datasetId: item.datasetId,
17759
+ valid: item.valid,
17760
+ messages: item?.errorMessages
17761
+ };
17762
+ }
17763
+ return {
17764
+ id: item.id,
17765
+ name: item.name,
17766
+ description: item.description,
17767
+ type: item.type,
17768
+ size: item.size,
17769
+ datasetId: item.datasetId,
17770
+ datasetName: item.datasetName,
17771
+ valid: item.valid,
17772
+ messages: item?.errorMessages
17773
+ };
17774
+ });
17775
+ return {
17776
+ rows,
17777
+ hasInvalidRows
17778
+ };
17779
+ }, [
17780
+ validatedItems
17781
+ ]);
17782
+ const table = mantineReactTable.useMantineReactTable({
17783
+ columns,
17784
+ data: tableRows.rows,
17785
+ enableColumnResizing: false,
17786
+ icons: TableIcons,
17787
+ enableTopToolbar: false,
17788
+ enableRowSelection: true,
17789
+ enableBottomToolbar: tableRows.rows.length > 10,
17790
+ enablePagination: tableRows.rows.length > 10,
17791
+ enableRowActions: false,
17792
+ enableStickyFooter: true,
17793
+ enableStickyHeader: true,
17794
+ enableHiding: true,
17795
+ onRowSelectionChange: handleRowSelectionChange,
17796
+ state: {
17797
+ rowSelection
17798
+ },
17799
+ initialState: {
17800
+ density: 'xs',
17801
+ columnPinning: {
17802
+ left: [
17803
+ 'mrt-row-select',
17804
+ 'mrt-row-expand'
17805
+ ],
17806
+ right: [
17807
+ 'mrt-row-actions'
17808
+ ]
17809
+ }
17810
+ },
17811
+ layoutMode: 'semantic',
17812
+ mantineDetailPanelProps: {
17813
+ style: {
17814
+ boxShadow: '0 -2px 0px 0px var(--table-border-color) inset'
17815
+ }
17816
+ },
17817
+ mantineTableProps: {
17818
+ style: {
17819
+ backgroundColor: 'var(--mantine-color-base-1)',
17820
+ '--mrt-striped-row-background-color': 'var(--mantine-color-base-3)'
17821
+ }
17822
+ },
17823
+ mantineTableHeadCellProps: {
17824
+ style: {
17825
+ backgroundColor: 'var(--mantine-color-table-1)',
17826
+ color: 'var(--mantine-color-table-contrast-1)',
17827
+ textAlign: 'center',
17828
+ padding: '0.25rem 0.5rem 0.25rem 0.5rem',
17829
+ fontWeight: 600,
17830
+ fontSize: `var(--mantine-font-size-${size})`
17831
+ }
17832
+ }
17833
+ });
17834
+ return /*#__PURE__*/ jsxRuntime.jsxs("div", {
17835
+ className: "flex flex-col ml-8",
17836
+ children: [
17837
+ /*#__PURE__*/ jsxRuntime.jsx(SelectedItemsTableHeader, {
17838
+ numberOfItems: Object.keys(rowSelection).length,
17839
+ numberOfWarnings: tableRows.rows.filter((x)=>x.valid === false).length,
17840
+ size: size
17841
+ }),
17842
+ /*#__PURE__*/ jsxRuntime.jsx("div", {
17843
+ className: "mt-2",
17844
+ children: /*#__PURE__*/ jsxRuntime.jsx(mantineReactTable.MantineReactTable, {
17845
+ table: table
17846
+ })
17847
+ })
17848
+ ]
17849
+ });
17850
+ };
17851
+
17852
+ const isArrayField = (value)=>Array.isArray(value);
17853
+ const isNumeric = (value)=>typeof value === 'number' && !isNaN(value);
17854
+ const evaluateItemRule = (rule, item)=>{
17855
+ switch(rule.operator){
17856
+ case 'equals':
17857
+ case 'not':
17858
+ {
17859
+ const fieldValue = item[rule.field];
17860
+ return rule.operator === 'equals' ? fieldValue === rule.value : fieldValue !== rule.value;
17861
+ }
17862
+ case 'includes':
17863
+ case 'excludes':
17864
+ {
17865
+ const fieldValue = item[rule.field];
17866
+ if (!isArrayField(fieldValue)) return false;
17867
+ return rule.operator === 'includes' ? fieldValue.includes(rule.value) : !fieldValue.includes(rule.value);
17868
+ }
17869
+ case 'greater':
17870
+ case 'less':
17871
+ {
17872
+ const fieldValue = item[rule.field];
17873
+ if (isNumeric(fieldValue) && isNumeric(rule.value)) return rule.operator === 'greater' ? fieldValue > rule.value : fieldValue < rule.value;
17874
+ return false;
17875
+ }
17876
+ default:
17877
+ return false;
17878
+ }
17879
+ };
17880
+ const evaluateGroupRule = (rule, items)=>{
17881
+ switch(rule.operator){
17882
+ case 'count':
17883
+ {
17884
+ const fieldValue = items.map((item)=>item[rule.field]);
17885
+ return fieldValue.length === rule.total;
17886
+ }
17887
+ }
17888
+ };
17889
+ /**
17890
+ * Retrieves an action configuration from a set of actions by its unique identifier.
17891
+ *
17892
+ * @param {ActionsConfig} actions - An array of action configurations.
17893
+ * @param {string} id - The unique identifier of the desired action configuration.
17894
+ * @returns {DataLibraryActionConfig | undefined} The action configuration with the matching identifier, or undefined if not found.
17895
+ */ const getActionById = (actions, id)=>{
17896
+ if (!id) return undefined;
17897
+ return actions.find((action)=>action.id === id);
17898
+ };
17899
+ const doesItemFailRule = (item, action)=>{
17900
+ return action?.itemRules?.reduce((acc, rule)=>{
17901
+ if (!evaluateItemRule(rule, item)) {
17902
+ acc.push(rule.errorMessage);
17903
+ }
17904
+ return acc;
17905
+ }, []) ?? [];
17906
+ };
17907
+ const doesGroupFailRule = (items, action)=>{
17908
+ return action?.groupRules?.reduce((acc, rule)=>{
17909
+ if (!evaluateGroupRule(rule, items)) {
17910
+ acc.push(rule.errorMessage);
17911
+ }
17912
+ return acc;
17913
+ }, []) ?? [];
17914
+ };
17915
+
17916
+ const PRESIGNED_URL_TEMPLATE_VARIABLE = '{{PRESIGNED_URL}}';
17917
+ const isSendExistingPFBToURLParameters = (value)=>{
17918
+ if (!value || typeof value !== 'object') {
17919
+ return false;
17920
+ }
17921
+ const candidate = value;
17922
+ return 'targetURLTemplate' in candidate && typeof candidate.targetURLTemplate === 'string';
17923
+ };
17924
+ const sendExistingPFBToURL = async (validatedSelections, params, done = ()=>null, error = ()=>null, onAbort = ()=>null, signal = undefined)=>{
17925
+ if (!isSendExistingPFBToURLParameters(params)) {
17926
+ console.error('Invalid parameters for sendPFBToURL action:', params);
17927
+ return;
17928
+ }
17929
+ const { targetURLTemplate } = params;
17930
+ // get the selection
17931
+ if (validatedSelections.length !== 1 || !core.isFileItem(validatedSelections[0])) {
17932
+ notifications.notifications.show({
17933
+ id: 'data-library-send-existing-pfb-to-url-validate-length',
17934
+ position: 'bottom-center',
17935
+ withCloseButton: true,
17936
+ autoClose: 5000,
17937
+ title: 'Action Error',
17938
+ message: 'Invalid data passed to send PFB to URL',
17939
+ color: 'red',
17940
+ loading: false
17941
+ });
17942
+ return;
17943
+ }
17944
+ const { guid } = validatedSelections[0];
17945
+ // get the pre-signed URL for the selected PFB
17946
+ try {
17947
+ const presignedURL = await core.fetchFencePresignedURL({
17948
+ guid: guid,
17949
+ onAbort: onAbort,
17950
+ signal: signal
17951
+ });
17952
+ // the PFB export target URL is a template URL that should have a {{PRESIGNED_URL}} template
17953
+ // variable in it.
17954
+ const signedURL = encodeURIComponent(presignedURL);
17955
+ const targetURL = targetURLTemplate.replace(PRESIGNED_URL_TEMPLATE_VARIABLE, signedURL);
17956
+ return new Promise(()=>{
17957
+ if (window) window.open(targetURL, '_blank', 'noopener,noreferrer');
17958
+ if (done) done(targetURL);
17959
+ });
17960
+ } catch (e) {
17961
+ return new Promise(()=>{
17962
+ error(e);
17963
+ });
17964
+ }
17965
+ };
17966
+
17967
+ const registeredDataLibraryActions = {};
17968
+ const NullAction = ()=>{
17969
+ return new Promise((done)=>{
17970
+ if (done) done();
17971
+ });
17972
+ };
17973
+ const registerAction = (actionName, action)=>{
17974
+ registeredDataLibraryActions[actionName] = action;
17975
+ };
17976
+ const findAction = (actionName)=>{
17977
+ if (actionName === undefined) {
17978
+ console.error('DataLibrary: findAction: no name provided');
17979
+ return undefined;
17980
+ }
17981
+ if (!(actionName in registeredDataLibraryActions)) {
17982
+ console.error('getButtonAction: no action found for', actionName);
17983
+ return undefined;
17984
+ }
17985
+ return registeredDataLibraryActions[actionName];
17986
+ };
17987
+ const registerDefaultDataLibraryActions = ()=>{
17988
+ registerAction('export-pfb-to-url', {
17989
+ action: sendExistingPFBToURL
17990
+ });
17991
+ };
17992
+ registerDefaultDataLibraryActions();
17993
+
17994
+ const ModalHeader = ()=>{
17995
+ return /*#__PURE__*/ jsxRuntime.jsx("div", {
17996
+ className: "flex justify-between items-center",
17997
+ children: /*#__PURE__*/ jsxRuntime.jsx(core$1.Text, {
17998
+ fw: 600,
17999
+ className: "text-heading",
18000
+ children: "Retrieve Data"
18001
+ })
18002
+ });
18003
+ };
18004
+ const bindAction = (action)=>{
18005
+ const actionFunction = findAction(action.actionFunction);
18006
+ if (!actionFunction) {
18007
+ return NullAction;
18008
+ }
18009
+ return actionFunction.action;
18010
+ };
18011
+ const SelectedItemsModal = (props)=>{
18012
+ const [value, setValue] = React.useState(null);
18013
+ const { actions } = props;
18014
+ const { gatheredItems } = useDataLibrarySelection();
18015
+ const [rowSelection, setRowSelection] = React.useState({});
18016
+ const [actionFunction, setActionFunction] = React.useState({
18017
+ action: NullAction
18018
+ });
18019
+ const [actionConfig, setActionConfig] = React.useState(null);
18020
+ const [isRunning, setIsRunning] = React.useState(false);
18021
+ const destinations = React.useMemo(()=>{
18022
+ return actions.map((action)=>{
18023
+ return {
18024
+ label: action.label,
18025
+ value: action.id
18026
+ };
18027
+ });
18028
+ }, [
18029
+ actions
18030
+ ]);
18031
+ const onError = (error)=>{
18032
+ setIsRunning(false);
18033
+ if (error instanceof core.HTTPError) {
18034
+ notifications.notifications.show({
18035
+ id: 'data-library-selection-action-error',
18036
+ position: 'bottom-center',
18037
+ withCloseButton: true,
18038
+ autoClose: 5000,
18039
+ title: 'Action Error',
18040
+ message: HTTPUserFriendlyErrorMessages[error.status],
18041
+ color: 'red',
18042
+ icon: /*#__PURE__*/ jsxRuntime.jsx(react.Icon, {
18043
+ icon: "gen3:outline-error"
18044
+ }),
18045
+ loading: false
18046
+ });
18047
+ }
18048
+ };
18049
+ const onDone = (arg)=>{
18050
+ setIsRunning(false);
18051
+ notifications.notifications.show({
18052
+ id: 'data-library-selection-action-done',
18053
+ position: 'bottom-center',
18054
+ withCloseButton: true,
18055
+ autoClose: 5000,
18056
+ title: 'Submission Complete',
18057
+ message: actionConfig ? `${actionConfig.label} completed successfully` : 'Completed successfully',
18058
+ loading: false
18059
+ });
18060
+ };
18061
+ const setSelectionAction = React.useCallback((actionId)=>{
18062
+ const actionConfig = getActionById(actions, actionId);
18063
+ if (actionConfig) {
18064
+ setActionConfig(actionConfig);
18065
+ const action = bindAction(actionConfig);
18066
+ if (action) setActionFunction({
18067
+ action: action,
18068
+ parameters: actionConfig.parameters
18069
+ });
18070
+ return;
18071
+ }
18072
+ setActionFunction({
18073
+ action: NullAction
18074
+ });
18075
+ }, [
18076
+ actions
18077
+ ]);
18078
+ const validatedLibrarySelections = useDeepCompare.useDeepCompareMemo(()=>{
18079
+ // get the action
18080
+ const action = getActionById(actions, value?.value);
18081
+ // if there are no actions then everything is valid
18082
+ if (!action) return gatheredItems.map((item)=>{
18083
+ return {
18084
+ ...item,
18085
+ valid: undefined
18086
+ };
18087
+ });
18088
+ // get all selected items
18089
+ const selectedActionItems = gatheredItems.filter((_, index)=>Object.hasOwn(rowSelection, index));
18090
+ // apply group rules of action if any fail then add error message and set flag
18091
+ const groupFailsRule = doesGroupFailRule(selectedActionItems, action);
18092
+ const validItems = gatheredItems.map((item, index)=>{
18093
+ if (rowSelection[index]) {
18094
+ // if selected then validate item rules
18095
+ const itemFailsRule = doesItemFailRule(item, action);
18096
+ const itemAndGroupTestMessages = [
18097
+ ...itemFailsRule,
18098
+ ...groupFailsRule
18099
+ ];
18100
+ if (itemAndGroupTestMessages.length > 0) return {
18101
+ ...item,
18102
+ valid: false,
18103
+ errorMessages: itemAndGroupTestMessages
18104
+ };
18105
+ // defaults return true
18106
+ return {
18107
+ ...item,
18108
+ valid: true
18109
+ };
18110
+ } else return {
18111
+ ...item,
18112
+ valid: undefined
18113
+ };
18114
+ });
18115
+ return validItems;
18116
+ }, [
18117
+ gatheredItems,
18118
+ rowSelection,
18119
+ actions,
18120
+ value
18121
+ ]);
18122
+ const actionButtonDisabled = actionFunction.action === NullAction || validatedLibrarySelections.length === 0 || validatedLibrarySelections.some((x)=>x.valid === false);
18123
+ return /*#__PURE__*/ jsxRuntime.jsx(core$1.Modal, {
18124
+ ...props,
18125
+ closeOnEscape: true,
18126
+ centered: true,
18127
+ withinPortal: false,
18128
+ title: /*#__PURE__*/ jsxRuntime.jsx(ModalHeader, {}),
18129
+ classNames: {
18130
+ header: 'm-0 p-2 min-h-10 bg-primary-lightest',
18131
+ content: 'scroll-smooth'
18132
+ },
18133
+ overlayProps: {
18134
+ opacity: 0.5
18135
+ },
18136
+ children: /*#__PURE__*/ jsxRuntime.jsxs(core$1.Stack, {
18137
+ children: [
18138
+ /*#__PURE__*/ jsxRuntime.jsx(SelectedItemsTable, {
18139
+ validatedItems: validatedLibrarySelections,
18140
+ rowSelection: rowSelection,
18141
+ setRowSelection: setRowSelection
18142
+ }),
18143
+ /*#__PURE__*/ jsxRuntime.jsxs(core$1.Group, {
18144
+ justify: "space-between",
18145
+ children: [
18146
+ /*#__PURE__*/ jsxRuntime.jsxs(core$1.Group, {
18147
+ children: [
18148
+ /*#__PURE__*/ jsxRuntime.jsx(core$1.Text, {
18149
+ fw: 600,
18150
+ children: "Destination:"
18151
+ }),
18152
+ /*#__PURE__*/ jsxRuntime.jsx(core$1.Select, {
18153
+ data: destinations,
18154
+ value: value ? value.value : null,
18155
+ onChange: (value, option)=>{
18156
+ setValue(option);
18157
+ if (value) setSelectionAction(value);
18158
+ else setActionFunction({
18159
+ action: NullAction
18160
+ });
18161
+ }
18162
+ })
18163
+ ]
18164
+ }),
18165
+ /*#__PURE__*/ jsxRuntime.jsx(core$1.Button, {
18166
+ loading: isRunning,
18167
+ rightSection: actionConfig?.rightIcon ? /*#__PURE__*/ jsxRuntime.jsx(react.Icon, {
18168
+ icon: actionConfig?.rightIcon
18169
+ }) : undefined,
18170
+ disabled: actionButtonDisabled,
18171
+ onClick: async ()=>{
18172
+ setIsRunning(true);
18173
+ await actionFunction.action(validatedLibrarySelections, actionFunction.parameters, onDone, onError);
18174
+ },
18175
+ children: actionConfig ? actionConfig.buttonLabel : 'Submit'
18176
+ })
18177
+ ]
18178
+ })
18179
+ ]
18180
+ })
18181
+ });
18182
+ };
18183
+
18184
+ /**
18185
+ * Extracts and consolidates GUIDs and IDs from dataset contents into a single object.
18186
+ *
18187
+ * @param {DatasetContents} dataset - The dataset containing files and queries to extract IDs from.
18188
+ * @returns {SelectedMembers} An object where each key is a unique identifier from the dataset,
18189
+ * with a boolean value set to true.
18190
+ */ const getObjectIds = (dataset)=>{
18191
+ return [
18192
+ ...dataset.files.map((file)=>file.id),
18193
+ ...dataset.queries.map((query)=>query.id)
18194
+ ].reduce((acc, key)=>{
18195
+ acc[key] = true;
18196
+ return acc;
18197
+ }, {});
18198
+ };
18199
+ /**
18200
+ * Function that generates a mapping of dataset IDs to their respective member objects.
18201
+ *
18202
+ * @param {Array<string>} datasetIds - Array of dataset IDs to be processed.
18203
+ * @param {DatalistMembers} datasetContents - Object containing details about dataset members.
18204
+ * @returns {ListMembers} - An object mapping each dataset ID to its respective member objects.
18205
+ */ const selectAllDatasetMembers = (datasetIds, datasetContents)=>{
18206
+ return datasetIds.reduce((acc, datasetId)=>{
18207
+ acc[datasetId] = {
18208
+ id: datasetId,
18209
+ objectIds: getObjectIds(datasetContents[datasetId])
18210
+ };
18211
+ return acc;
18212
+ }, {});
18213
+ };
18214
+ /**
18215
+ * Retrieves the members of a given dataset or cohort.
18216
+ *
18217
+ * This function takes either a dataset or a cohort item and returns an
18218
+ * object representing the selected members. In the case of a cohort item,
18219
+ * it returns an object with the cohort's ID set to true. For a dataset,
18220
+ * it iterates through the dataset items and sets the keys of file items
18221
+ * to true in the returned object.
18222
+ *
18223
+ * @param {RegisteredDataListEntry | CohortItem} dataSetOrCohort - The dataset or cohort item to process.
18224
+ * @returns {SelectedMembers} An object representing the selected members.
18225
+ */ const getDatasetMembers = (dataSetOrCohort)=>{
18226
+ if (core.isCohortItem(dataSetOrCohort)) {
18227
+ return {
18228
+ [dataSetOrCohort.id]: true
18229
+ };
18230
+ }
18231
+ return Object.entries(dataSetOrCohort.items).reduce((acc, [key, item])=>{
18232
+ if (core.isFileItem(item)) acc[key] = true;
18233
+ return acc;
18234
+ }, {});
18235
+ };
18236
+ /**
18237
+ * Selects all list items from the provided data list and transforms them into a ListMembers structure.
18238
+ *
18239
+ * @param {Datalist} members - The data list containing items to be transformed.
18240
+ * @return {ListMembers} - Transformed structure containing the selected list items with dataset IDs and their corresponding object IDs.
18241
+ */ const selectAllListItems = (members)=>{
18242
+ return Object.entries(members.items).reduce((acc, [datasetId, datasetContents])=>{
18243
+ if (core.isCohortItem(datasetContents)) {
18244
+ acc[datasetId] = {
18245
+ id: datasetId,
18246
+ objectIds: {
18247
+ [datasetId]: true
18248
+ }
18249
+ };
18250
+ } else acc[datasetId] = {
18251
+ id: datasetId,
18252
+ objectIds: getDatasetMembers(datasetContents)
18253
+ };
18254
+ return acc;
18255
+ }, {});
18256
+ };
18257
+
18258
+ const EmptyList = ()=>{
18259
+ return /*#__PURE__*/ jsxRuntime.jsxs(core$1.Group, {
18260
+ gap: "xs",
18261
+ classNames: {
18262
+ root: 'w-100'
18263
+ },
18264
+ children: [
18265
+ /*#__PURE__*/ jsxRuntime.jsx("span", {
18266
+ className: "text-utility-warning",
18267
+ children: /*#__PURE__*/ jsxRuntime.jsx(io.IoMdInformationCircleOutline, {
18268
+ size: "1.5rem"
18269
+ })
18270
+ }),
18271
+ /*#__PURE__*/ jsxRuntime.jsx(core$1.Text, {
18272
+ fw: 600,
18273
+ children: "list is empty"
18274
+ })
18275
+ ]
18276
+ });
18277
+ };
18278
+
18279
+ /**
18280
+ * Formats a given date string into a specific format.
18281
+ *
18282
+ * @param {string} datestr - The date string to be formatted.
18283
+ * @returns {string} The formatted date string.
18284
+ * @throws {Error} Throws an error if the provided date string is invalid or the format is incorrect.
18285
+ *
18286
+ * The function parses the provided date string into a timestamp.
18287
+ */ const formatDate = (datestr)=>{
18288
+ const timestamp = Date.parse(datestr);
18289
+ if (isNaN(timestamp)) {
18290
+ throw new Error('Invalid date string');
18291
+ }
18292
+ const date = new Date(timestamp);
18293
+ const parts = new Intl.DateTimeFormat('en-US', {
18294
+ month: 'short',
18295
+ day: 'numeric',
18296
+ year: 'numeric',
18297
+ hour: '2-digit',
18298
+ minute: '2-digit',
18299
+ second: '2-digit',
18300
+ hour12: false,
18301
+ timeZone: 'UTC'
18302
+ }).formatToParts(date).filter((p)=>p.type !== 'literal') // Filter out literal types like spaces and commas
18303
+ .map((p)=>p.value);
18304
+ if (parts.length !== 6) throw new Error('format date wrong length');
18305
+ const day = parts.slice(0, 3).join('-');
18306
+ const time = parts.slice(3).join(':');
18307
+ return `${day} ${time}`;
18308
+ };
18309
+
18310
+ const DatasetAccordionControl = ({ listName, numberOfItems, updatedTime, createdTime, updateHandler, deleteListHandler, selectListHandler, selectedState, size = 'sm', ...props })=>{
18311
+ const [value, setValue] = React.useState(undefined);
18312
+ const handleUpdateName = ()=>{
18313
+ updateHandler({
18314
+ name: value
18315
+ });
18316
+ setValue(undefined);
18317
+ };
18318
+ const theme = core$1.useMantineTheme();
18319
+ const iconSize = IconSize[size] || IconSize['sm'];
18320
+ return /*#__PURE__*/ jsxRuntime.jsxs("div", {
18321
+ className: "flex justify-start w-full items-center px-4 group-data-[active]:bg-secondary-lightest",
18322
+ children: [
18323
+ /*#__PURE__*/ jsxRuntime.jsxs("div", {
18324
+ className: "flex items-center w-1/4",
18325
+ children: [
18326
+ /*#__PURE__*/ jsxRuntime.jsx(core$1.Checkbox, {
18327
+ size: size,
18328
+ onChange: (event)=>{
18329
+ selectListHandler(event.currentTarget.checked);
18330
+ event.stopPropagation();
18331
+ },
18332
+ checked: selectedState == 'checked',
18333
+ indeterminate: selectedState == 'indeterminate'
18334
+ }),
18335
+ /*#__PURE__*/ jsxRuntime.jsx(core$1.Accordion.Control, {
18336
+ ...props,
18337
+ className: "w-4 mr-3"
18338
+ }),
18339
+ value ? /*#__PURE__*/ jsxRuntime.jsx(core$1.TextInput, {
18340
+ size: size,
18341
+ classNames: {
18342
+ root: 'ml-2',
18343
+ input: 'font-bold'
18344
+ },
18345
+ value: value,
18346
+ onChange: (e)=>setValue(e.target.value),
18347
+ onKeyDown: hooks.getHotkeyHandler([
18348
+ [
18349
+ 'Enter',
18350
+ handleUpdateName
18351
+ ]
18352
+ ]),
18353
+ rightSection: /*#__PURE__*/ jsxRuntime.jsx(core$1.CloseButton, {
18354
+ "aria-label": "Clear input",
18355
+ onClick: ()=>setValue(undefined),
18356
+ style: {
18357
+ display: value ? undefined : 'none'
18358
+ }
18359
+ })
18360
+ }) : /*#__PURE__*/ jsxRuntime.jsxs("div", {
18361
+ className: "flex items-center justify-end",
18362
+ children: [
18363
+ /*#__PURE__*/ jsxRuntime.jsx(core$1.Text, {
18364
+ fw: 600,
18365
+ className: "ml-2 w-100 py-2 mr-2",
18366
+ "aria-label": listName,
18367
+ size: size,
18368
+ children: listName
18369
+ }),
18370
+ /*#__PURE__*/ jsxRuntime.jsx(core$1.Tooltip, {
18371
+ label: "Change name of list",
18372
+ children: /*#__PURE__*/ jsxRuntime.jsx(core$1.ActionIcon, {
18373
+ color: "accent.4",
18374
+ variant: "transparent",
18375
+ "aria-label": "Change datalist name",
18376
+ onClick: ()=>setValue(listName),
18377
+ children: /*#__PURE__*/ jsxRuntime.jsx(react.Icon, {
18378
+ icon: "gen3:edit",
18379
+ height: iconSize,
18380
+ width: iconSize,
18381
+ color: theme.colors.accent[4]
18382
+ })
18383
+ })
18384
+ })
18385
+ ]
18386
+ })
18387
+ ]
18388
+ }),
18389
+ /*#__PURE__*/ jsxRuntime.jsxs("div", {
18390
+ className: "flex items-center ml-auto space-x-2",
18391
+ children: [
18392
+ numberOfItems === 0 && /*#__PURE__*/ jsxRuntime.jsx(EmptyList, {}),
18393
+ /*#__PURE__*/ jsxRuntime.jsxs("div", {
18394
+ className: "flex items-center space-x-2",
18395
+ children: [
18396
+ /*#__PURE__*/ jsxRuntime.jsx(core$1.Text, {
18397
+ fw: 600,
18398
+ c: "base-contrast.2",
18399
+ tt: "uppercase",
18400
+ size: size,
18401
+ children: "Created:"
18402
+ }),
18403
+ /*#__PURE__*/ jsxRuntime.jsx(core$1.Text, {
18404
+ fw: 500,
18405
+ c: "base-contrast.2",
18406
+ size: size,
18407
+ children: formatDate(createdTime)
18408
+ }),
18409
+ /*#__PURE__*/ jsxRuntime.jsx(react.Icon, {
18410
+ icon: "gen3:dot",
18411
+ height: iconSize,
18412
+ width: iconSize,
18413
+ color: theme.colors.accent[4]
18414
+ }),
18415
+ /*#__PURE__*/ jsxRuntime.jsx(core$1.Text, {
18416
+ fw: 600,
18417
+ c: "base-contrast.2",
18418
+ tt: "uppercase",
18419
+ size: size,
18420
+ children: "Updated:"
18421
+ }),
18422
+ /*#__PURE__*/ jsxRuntime.jsx(core$1.Text, {
18423
+ fw: 500,
18424
+ c: "base-contrast.2",
18425
+ size: size,
18426
+ children: formatDate(updatedTime)
18427
+ })
18428
+ ]
18429
+ }),
18430
+ /*#__PURE__*/ jsxRuntime.jsx(core$1.Tooltip, {
18431
+ label: `Delete ${listName}. Will not delete dataset`,
18432
+ children: /*#__PURE__*/ jsxRuntime.jsx(core$1.ActionIcon, {
18433
+ color: "accent.4",
18434
+ variant: "transparent",
18435
+ "aria-label": "delete list",
18436
+ onClick: ()=>deleteListHandler(),
18437
+ children: /*#__PURE__*/ jsxRuntime.jsx(react.Icon, {
18438
+ icon: "gen3:delete",
18439
+ height: iconSize,
18440
+ width: iconSize,
18441
+ color: theme.colors.primary[5]
18442
+ })
18443
+ })
18444
+ })
18445
+ ]
18446
+ })
18447
+ ]
18448
+ });
18449
+ };
18450
+
18451
+ const commonTableSettings = (size = 'sm')=>{
18452
+ return {
18453
+ enableColumnResizing: false,
18454
+ icons: TableIcons,
18455
+ enableTopToolbar: false,
18456
+ enableColumnFilters: false,
18457
+ enableColumnActions: false,
18458
+ enableRowActions: true,
18459
+ enableColumnOrdering: false,
18460
+ enableFacetedValues: true,
18461
+ enableGrouping: false,
18462
+ enableColumnPinning: false,
18463
+ enableRowSelection: true,
18464
+ enablePagination: false,
18465
+ enableSelectAll: false,
18466
+ enableExpandAll: false,
18467
+ displayColumnDefOptions: {
18468
+ 'mrt-row-select': {
18469
+ size: 5,
18470
+ header: ''
18471
+ },
18472
+ 'mrt-row-expand': {
18473
+ size: 5,
18474
+ header: ''
18475
+ },
18476
+ 'mrt-row-actions': {
18477
+ header: ''
18478
+ }
18479
+ },
18480
+ initialState: {
18481
+ density: 'xs',
18482
+ columnPinning: {
18483
+ left: [
18484
+ 'mrt-row-select',
18485
+ 'mrt-row-expand'
18486
+ ],
18487
+ right: [
18488
+ 'mrt-row-actions'
18489
+ ]
18490
+ }
18491
+ },
18492
+ layoutMode: 'semantic',
18493
+ mantineDetailPanelProps: {
18494
+ style: {
18495
+ boxShadow: '0 -2px 0px 0px var(--table-border-color) inset'
18496
+ }
18497
+ },
18498
+ mantineTableProps: {
18499
+ style: {
18500
+ backgroundColor: 'var(--mantine-color-base-1)',
18501
+ '--mrt-striped-row-background-color': 'var(--mantine-color-base-3)',
18502
+ fontSize: `var(--mantine-font-size-${size})`
18503
+ }
18504
+ },
18505
+ mantineTableHeadCellProps: {
18506
+ style: {
18507
+ backgroundColor: 'var(--mantine-color-table-1)',
18508
+ color: 'var(--mantine-color-table-contrast-1)',
18509
+ textAlign: 'center',
18510
+ fontWeight: 600,
18511
+ fontSize: `var(--mantine-font-size-${size})`,
18512
+ textTransform: 'uppercase'
18513
+ }
18514
+ }
18515
+ };
18516
+ };
18517
+
18518
+ const columns$2 = [
18519
+ {
18520
+ accessorKey: 'name',
18521
+ header: 'Name'
18522
+ },
18523
+ {
18524
+ accessorKey: 'description',
18525
+ header: 'Description'
18526
+ },
18527
+ {
18528
+ accessorKey: 'documentation',
18529
+ header: 'Documentation'
18530
+ }
18531
+ ];
18532
+ const AdditionalDataTableTable = ({ data, header, size = 'sm' })=>{
18533
+ const table = mantineReactTable.useMantineReactTable({
18534
+ columns: columns$2,
18535
+ data: data,
18536
+ ...commonTableSettings(size),
18537
+ enableRowActions: false,
18538
+ enableRowSelection: false,
18539
+ enableBottomToolbar: data.length > 10,
18540
+ enablePagination: data.length > 10
18541
+ });
18542
+ return /*#__PURE__*/ jsxRuntime.jsxs("div", {
18543
+ className: "flex flex-col w-inherit gap-y-1",
18544
+ children: [
18545
+ /*#__PURE__*/ jsxRuntime.jsx(core$1.Text, {
18546
+ fw: 600,
18547
+ fs: "md",
18548
+ c: "secondary.5",
18549
+ tt: "uppercase",
18550
+ children: header
18551
+ }),
18552
+ /*#__PURE__*/ jsxRuntime.jsx(mantineReactTable.MantineReactTable, {
18553
+ table: table
18554
+ })
18555
+ ]
18556
+ });
18557
+ };
18558
+
18559
+ const columns$1 = [
18560
+ {
18561
+ accessorKey: 'name',
18562
+ header: 'Name'
18563
+ },
18564
+ {
18565
+ accessorKey: 'description',
18566
+ header: 'Description'
18567
+ },
18568
+ {
18569
+ accessorKey: 'type',
18570
+ header: 'Type'
18571
+ },
18572
+ {
18573
+ accessorKey: 'size',
18574
+ header: 'Size'
18575
+ }
18576
+ ];
18577
+ const FilesTable = ({ listId, datasetId, data, header, size = 'sm' })=>{
18578
+ const [rowSelection, setRowSelection] = React.useState({});
18579
+ const { selections, updateListMemberSelections } = useDataLibrarySelection();
18580
+ React.useEffect(()=>{
18581
+ const sel = selections?.[listId]?.[datasetId]?.objectIds ?? {};
18582
+ setRowSelection(sel);
18583
+ }, [
18584
+ listId,
18585
+ datasetId,
18586
+ selections
18587
+ ]);
18588
+ const handleRowSelectionChange = (updater)=>{
18589
+ let value = {};
18590
+ setRowSelection((prevSelection)=>{
18591
+ value = updater instanceof Function ? updater(prevSelection) : updater;
18592
+ return value;
18593
+ });
18594
+ updateListMemberSelections(listId, datasetId, value);
18595
+ };
18596
+ const table = mantineReactTable.useMantineReactTable({
18597
+ columns: columns$1,
18598
+ data: data,
18599
+ ...commonTableSettings(size),
18600
+ enableBottomToolbar: data.length > 10,
18601
+ enablePagination: data.length > 10,
18602
+ enableRowActions: true,
18603
+ enableHiding: true,
18604
+ getRowId: (originalRow)=>originalRow.id,
18605
+ onRowSelectionChange: handleRowSelectionChange,
18606
+ state: {
18607
+ rowSelection
18608
+ }
18609
+ });
18610
+ return /*#__PURE__*/ jsxRuntime.jsxs("div", {
18611
+ className: "flex flex-col gap-y-1",
18612
+ children: [
18613
+ /*#__PURE__*/ jsxRuntime.jsx(core$1.Text, {
18614
+ fw: 600,
18615
+ fs: size,
18616
+ c: "secondary.5",
18617
+ tt: "uppercase",
18618
+ children: header
18619
+ }),
18620
+ /*#__PURE__*/ jsxRuntime.jsx(mantineReactTable.MantineReactTable, {
18621
+ table: table
18622
+ })
18623
+ ]
18624
+ });
18625
+ };
18626
+
18627
+ const LabeledText = ({ label, text })=>{
18628
+ return /*#__PURE__*/ jsxRuntime.jsxs("div", {
18629
+ className: "flex p-1 space-x-2",
18630
+ children: [
18631
+ /*#__PURE__*/ jsxRuntime.jsxs(core$1.Text, {
18632
+ fw: 600,
18633
+ children: [
18634
+ label,
18635
+ ":"
18636
+ ]
18637
+ }),
18638
+ /*#__PURE__*/ jsxRuntime.jsxs(core$1.Text, {
18639
+ fw: 400,
18640
+ children: [
18641
+ " ",
18642
+ text
18643
+ ]
18644
+ })
18645
+ ]
18646
+ });
18647
+ };
18648
+ const QueryDetails = ({ name, schemaVersion, index, data, id })=>{
18649
+ if (!data) {
18650
+ return /*#__PURE__*/ jsxRuntime.jsx(ErrorCard, {
18651
+ message: "No cohort query"
18652
+ });
18653
+ }
18654
+ return /*#__PURE__*/ jsxRuntime.jsxs("div", {
18655
+ className: "flex flex-col",
18656
+ children: [
18657
+ /*#__PURE__*/ jsxRuntime.jsxs(core$1.Group, {
18658
+ classNames: {
18659
+ root: 'p-2 bg-base-lighter rounded-t-lg border-2 border-b-0 border-base-light'
18660
+ },
18661
+ children: [
18662
+ /*#__PURE__*/ jsxRuntime.jsx(core$1.Text, {
18663
+ fw: 700,
18664
+ children: name
18665
+ }),
18666
+ /*#__PURE__*/ jsxRuntime.jsx(LabeledText, {
18667
+ label: "Index:",
18668
+ text: index
18669
+ }),
18670
+ /*#__PURE__*/ jsxRuntime.jsx(LabeledText, {
18671
+ label: "Schema Version:",
18672
+ text: schemaVersion
18673
+ }),
18674
+ /*#__PURE__*/ jsxRuntime.jsx(LabeledText, {
18675
+ label: "ID:",
18676
+ text: id
18677
+ })
18678
+ ]
18679
+ }),
18680
+ /*#__PURE__*/ jsxRuntime.jsx("div", {
18681
+ className: "p-2 overflow-scroll w-full bg-base-lighter rounded-b-lg border-2 border-t-0 border-base-light",
18682
+ children: core.isFilterSet(data) ? /*#__PURE__*/ jsxRuntime.jsx(QueryExpressionSection, {
18683
+ currentCohortId: id,
18684
+ index: index,
18685
+ currentCohortName: name,
18686
+ filters: data,
18687
+ displayOnly: true,
18688
+ showTitle: false
18689
+ }) : /*#__PURE__*/ jsxRuntime.jsx(core$1.Text, {
18690
+ fw: 400,
18691
+ children: JSON.stringify(data, null, 2)
18692
+ })
18693
+ })
18694
+ ]
18695
+ });
18696
+ };
18697
+
18698
+ /**
18699
+ * Component that manages a List items, which are composed of Dataset and/or Cohorts
18700
+ */ const columns = [
18701
+ {
18702
+ accessorKey: 'name',
18703
+ header: 'Name'
18704
+ },
18705
+ {
18706
+ accessorKey: 'id',
18707
+ header: 'Id'
18708
+ },
18709
+ {
18710
+ accessorKey: 'numFiles',
18711
+ header: '# Files'
18712
+ },
18713
+ {
18714
+ accessorKey: 'isAddDataSource',
18715
+ header: 'Additional Data Sources'
18716
+ }
18717
+ ];
18718
+ const DataSetContentsTable = ({ listId, data, removeList, size = 'sm' })=>{
18719
+ const [rowSelection, setRowSelection] = React.useState({});
18720
+ const { selections, updateSelections } = useDataLibrarySelection();
18721
+ // build the rows
18722
+ const rows = useDeepCompare.useDeepCompareMemo(()=>Object.keys(data).map((key)=>{
18723
+ return {
18724
+ name: data[key].name,
18725
+ id: data[key].id,
18726
+ numFiles: data[key]?.files.length || 0,
18727
+ numItems: (data[key]?.files.length || 0) + (data[key]?.queries.length || 0),
18728
+ isAddDataSource: data[key]?.additionalData.length !== 0 ? 'True' : 'False',
18729
+ isCohort: data[key]?.queries.length !== 0 ? 'True' : 'False'
18730
+ };
18731
+ }), [
18732
+ data
18733
+ ]);
18734
+ /**
18735
+ * Handles the change in row selection.
18736
+ *
18737
+ * @param {MRT_Updater<MRT_RowSelectionState>} updater - A function or value
18738
+ * that provides the new state of row selection. If a function is provided,
18739
+ * it will be called with the previous selection state.
18740
+ *
18741
+ * This function updates the state of selected rows by transforming the
18742
+ * updater's value. It generates a mapping of selected members for each
18743
+ * dataset, containing the dataset ID and an object representing the selected
18744
+ * object IDs. It then updates the selections for a given list and filters
18745
+ * the values to indicate whether each dataset has any selected objects.
18746
+ */ const handleRowSelectionChange = (updater)=>{
18747
+ setRowSelection((prevSelection)=>{
18748
+ const value = updater instanceof Function ? updater(prevSelection) : updater;
18749
+ const members = selectAllDatasetMembers(Object.keys(value), data);
18750
+ updateSelections(listId, members);
18751
+ return Object.keys(members).reduce((acc, key)=>{
18752
+ acc[key] = Object.keys(members[key].objectIds).length > 0;
18753
+ return acc;
18754
+ }, {});
18755
+ });
18756
+ };
18757
+ useDeepCompare.useDeepCompareEffect(()=>{
18758
+ if (!selections[listId]) {
18759
+ // not found in selections, unselect all
18760
+ setRowSelection({});
18761
+ return;
18762
+ }
18763
+ const filteredValues = Object.keys(selections[listId]).reduce((acc, key)=>{
18764
+ const objectIds = selections[listId][key]?.objectIds;
18765
+ if (!objectIds) {
18766
+ console.warn(`Object IDs for key ${key} in list ${listId} are not available`);
18767
+ return acc;
18768
+ }
18769
+ acc[key] = Object.keys(objectIds).length > 0;
18770
+ return acc;
18771
+ }, {});
18772
+ setRowSelection(filteredValues);
18773
+ }, [
18774
+ setRowSelection,
18775
+ selections,
18776
+ listId
18777
+ ]);
18778
+ const table = mantineReactTable.useMantineReactTable({
18779
+ columns: columns,
18780
+ data: rows,
18781
+ ...commonTableSettings(size),
18782
+ getRowId: (originalRow)=>originalRow.id,
18783
+ onRowSelectionChange: handleRowSelectionChange,
18784
+ enableSelectAll: false,
18785
+ enableBottomToolbar: rows.length > 10,
18786
+ enablePagination: rows.length > 10,
18787
+ enableRowSelection: true,
18788
+ state: {
18789
+ rowSelection
18790
+ },
18791
+ renderEmptyRowsFallback: ()=>/*#__PURE__*/ jsxRuntime.jsx(EmptyList, {}),
18792
+ defaultColumn: {
18793
+ minSize: 2
18794
+ },
18795
+ displayColumnDefOptions: {
18796
+ 'mrt-row-select': {
18797
+ size: 5,
18798
+ maxSize: 5,
18799
+ header: ''
18800
+ },
18801
+ 'mrt-row-expand': {
18802
+ size: 5,
18803
+ maxSize: 5,
18804
+ header: ''
18805
+ },
18806
+ 'mrt-row-actions': {
18807
+ size: 10,
18808
+ header: ''
18809
+ }
18810
+ },
18811
+ mantineSelectCheckboxProps: ({ row })=>{
18812
+ const selectedCount = getNumberOfDataSetItemsSelected(selections, listId, row.id);
18813
+ const isIndeterminate = selectedCount > 0 && selectedCount != row.original.numItems;
18814
+ return {
18815
+ indeterminate: isIndeterminate,
18816
+ ...isIndeterminate ? {
18817
+ checked: false
18818
+ } : {}
18819
+ };
18820
+ },
18821
+ renderRowActions: ({ row })=>/*#__PURE__*/ jsxRuntime.jsx(core$1.Tooltip, {
18822
+ label: row.original.isCohort ? 'Remove cohort from list' : 'Remove dataset from list',
18823
+ children: /*#__PURE__*/ jsxRuntime.jsxs(core$1.Button, {
18824
+ variant: "transparent",
18825
+ "aria-label": `remove ${row.original.isCohort ? 'cohort' : 'dataset'} ${row.original.name} from list`,
18826
+ onClick: ()=>{
18827
+ removeList(row.id);
18828
+ },
18829
+ children: [
18830
+ /*#__PURE__*/ jsxRuntime.jsx(md.MdOutlineRemoveCircle, {
18831
+ size: "1.5rem"
18832
+ }),
18833
+ row.original.itemType
18834
+ ]
18835
+ })
18836
+ }),
18837
+ mantineDetailPanelProps: {
18838
+ style: {
18839
+ padding: '0px',
18840
+ margin: '0px'
18841
+ }
18842
+ },
18843
+ renderDetailPanel: ({ row })=>{
18844
+ const rowData = data[row.id];
18845
+ return /*#__PURE__*/ jsxRuntime.jsxs("div", {
18846
+ className: "flex flex-col w-full gap-y-4 pr-4",
18847
+ children: [
18848
+ rowData?.files.length > 0 && /*#__PURE__*/ jsxRuntime.jsx(FilesTable, {
18849
+ header: 'Files',
18850
+ datasetId: rowData.id,
18851
+ listId: listId,
18852
+ data: rowData?.files
18853
+ }),
18854
+ rowData.additionalData.length > 0 && /*#__PURE__*/ jsxRuntime.jsx(AdditionalDataTableTable, {
18855
+ header: 'Additional Data',
18856
+ data: rowData?.additionalData
18857
+ }),
18858
+ /*#__PURE__*/ jsxRuntime.jsx(core$1.Stack, {
18859
+ children: rowData?.queries.map((query)=>/*#__PURE__*/ React.createElement(QueryDetails, {
18860
+ header: "Queries",
18861
+ ...query,
18862
+ key: query.id
18863
+ }))
18864
+ })
18865
+ ]
18866
+ });
18867
+ }
18868
+ });
18869
+ return /*#__PURE__*/ jsxRuntime.jsx("div", {
18870
+ className: "flex flex-col w-full mr-8",
18871
+ children: /*#__PURE__*/ jsxRuntime.jsx(mantineReactTable.MantineReactTable, {
18872
+ table: table
18873
+ })
18874
+ });
18875
+ };
18876
+
18877
+ /**
18878
+ * Renders an accordion item with data list details.
18879
+ *
18880
+ * @param {Object} dataListAccordionItemParams - Parameters for the DataListAccordionItem.
18881
+ * @param {Object} dataListAccordionItemParams.dataList - The data list to be displayed in the accordion item.
18882
+ * @param {Function} dataListAccordionItemParams.updateListInDataLibrary - Function to update the list in the data library.
18883
+ * @param {Function} dataListAccordionItemParams.deleteListFromDataLibrary - Function to delete the list from the data library.
18884
+ *
18885
+ * @return {JSX.Element} A rendered accordion item component with controls for data list updates and deletions.
18886
+ */ const DatalistAccordionItem = ({ dataList, updateListInDataLibrary, deleteListFromDataLibrary, size = 'sm' })=>{
18887
+ const [selectedState, setSelectedState] = React.useState('unchecked');
18888
+ const { id: listId, name: listName } = dataList;
18889
+ const numberOfItemsInList = React.useMemo(()=>{
18890
+ return core.getNumberOfItemsInDatalist(dataList);
18891
+ }, [
18892
+ dataList
18893
+ ]);
18894
+ const { selections, updateSelections, removeListMember, removeList } = useDataLibrarySelection();
18895
+ const updateList = async (update)=>{
18896
+ await updateListInDataLibrary(listId, {
18897
+ ...dataList,
18898
+ ...update,
18899
+ updatedTime: core.getTimestamp()
18900
+ });
18901
+ };
18902
+ const tableRowData = React.useMemo(()=>Object.entries(dataList.items).reduce((acc, [datasetId, dataItem])=>{
18903
+ const [queries, files, additionalData] = [
18904
+ [],
18905
+ [],
18906
+ []
18907
+ ];
18908
+ if (core.isCohortItem(dataItem)) {
18909
+ queries.push({
18910
+ ...dataItem,
18911
+ description: '',
18912
+ index: dataItem.index,
18913
+ id: datasetId
18914
+ });
18915
+ } else {
18916
+ // handle RegisteredDataListEntry
18917
+ Object.entries(dataItem.items).forEach(([itemId, item])=>{
18918
+ if (core.isFileItem(item)) {
18919
+ files.push({
18920
+ ...item,
18921
+ id: itemId
18922
+ });
18923
+ } else if (core.isAdditionalDataItem(item)) {
18924
+ additionalData.push(item);
18925
+ } else {
18926
+ console.warn('DataLibrary: unknown item', item);
18927
+ }
18928
+ });
18929
+ }
18930
+ // return the
18931
+ acc[datasetId] = {
18932
+ id: datasetId,
18933
+ name: dataItem.name,
18934
+ queries: queries,
18935
+ files: files,
18936
+ additionalData: additionalData
18937
+ };
18938
+ return acc;
18939
+ }, {}), [
18940
+ dataList
18941
+ ]);
18942
+ React.useEffect(()=>{
18943
+ // list is not in selection
18944
+ if (!isListInSelection(listId, selections)) {
18945
+ setSelectedState('unchecked');
18946
+ return;
18947
+ }
18948
+ const numberOfSelectedItemsInList = getNumberOfSelectedItemsInList(selections, listId);
18949
+ // everything in the list is selected
18950
+ if (numberOfSelectedItemsInList == numberOfItemsInList) {
18951
+ setSelectedState('checked');
18952
+ return;
18953
+ }
18954
+ // list is not in selections
18955
+ if (numberOfSelectedItemsInList === 0) {
18956
+ setSelectedState('unchecked');
18957
+ return;
18958
+ }
18959
+ // some checked items
18960
+ if (numberOfSelectedItemsInList < numberOfItemsInList) setSelectedState('indeterminate');
18961
+ }, [
18962
+ listId,
18963
+ numberOfItemsInList,
18964
+ selections
18965
+ ]);
18966
+ const removeItemFromList = async (itemId)=>{
18967
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
18968
+ const { [itemId]: _removedKey, ...newObject } = dataList.items;
18969
+ await updateListInDataLibrary(listId, {
18970
+ ...dataList,
18971
+ items: newObject,
18972
+ updatedTime: core.getTimestamp()
18973
+ });
18974
+ // update selections
18975
+ removeListMember(listId, itemId);
18976
+ };
18977
+ const handleSelectList = (checked)=>{
18978
+ if (!checked) {
18979
+ removeList(listId);
18980
+ return;
18981
+ }
18982
+ const selectAllDatasets = selectAllListItems(dataList);
18983
+ updateSelections(listId, selectAllDatasets); // select all the datasets in the list
18984
+ };
18985
+ return /*#__PURE__*/ jsxRuntime.jsxs(core$1.Accordion.Item, {
18986
+ value: listName,
18987
+ className: "group",
18988
+ children: [
18989
+ /*#__PURE__*/ jsxRuntime.jsx(DatasetAccordionControl, {
18990
+ listName: listName,
18991
+ numberOfItems: numberOfItemsInList,
18992
+ updatedTime: dataList.updatedTime,
18993
+ createdTime: dataList.createdTime,
18994
+ updateHandler: updateList,
18995
+ deleteListHandler: ()=>deleteListFromDataLibrary(listId),
18996
+ selectListHandler: handleSelectList,
18997
+ selectedState: selectedState,
18998
+ size: size
18999
+ }),
19000
+ /*#__PURE__*/ jsxRuntime.jsx(core$1.Accordion.Panel, {
19001
+ children: /*#__PURE__*/ jsxRuntime.jsx(DataSetContentsTable, {
19002
+ listId: listId,
19003
+ data: tableRowData,
19004
+ removeList: removeItemFromList,
19005
+ size: size
19006
+ })
19007
+ })
19008
+ ]
19009
+ }, listName);
19010
+ };
19011
+
19012
+ const DataLibraryLists = ({ useAPI, actions, size })=>{
19013
+ const { dataLibrary, isError, isLoading, error: dataLibraryError, addListToDataLibrary, updateListInDataLibrary, deleteListFromDataLibrary } = core.useDataLibrary(useAPI);
19014
+ const [selectedItemsOpen, { open, close }] = hooks.useDisclosure(false);
19015
+ const { gatherSelectedItems } = useDataLibrarySelection();
19016
+ const gatherData = ()=>{
19017
+ gatherSelectedItems(dataLibrary);
19018
+ open();
19019
+ };
19020
+ if (isError) {
19021
+ let message = 'There was a error getting the library';
19022
+ if (dataLibraryError && 'data' in dataLibraryError && dataLibraryError?.status in HTTPUserFriendlyErrorMessages) {
19023
+ message = HTTPUserFriendlyErrorMessages[dataLibraryError?.status];
19024
+ }
19025
+ return /*#__PURE__*/ jsxRuntime.jsx("div", {
19026
+ className: "flex flex-col w-full ml-2",
19027
+ children: /*#__PURE__*/ jsxRuntime.jsx(core$1.Center, {
19028
+ children: /*#__PURE__*/ jsxRuntime.jsx(ErrorCard, {
19029
+ message: message
19030
+ })
19031
+ })
19032
+ });
19033
+ }
19034
+ return /*#__PURE__*/ jsxRuntime.jsxs("div", {
19035
+ className: "flex flex-col w-full ml-2",
19036
+ children: [
19037
+ /*#__PURE__*/ jsxRuntime.jsx(core$1.LoadingOverlay, {
19038
+ visible: isLoading
19039
+ }),
19040
+ /*#__PURE__*/ jsxRuntime.jsx(SelectedItemsModal, {
19041
+ opened: selectedItemsOpen,
19042
+ onClose: close,
19043
+ size: "auto",
19044
+ actions: actions
19045
+ }),
19046
+ /*#__PURE__*/ jsxRuntime.jsx(SearchAndActions, {
19047
+ createList: addListToDataLibrary,
19048
+ gatherData: gatherData
19049
+ }),
19050
+ /*#__PURE__*/ jsxRuntime.jsx("div", {
19051
+ className: "flex items-center",
19052
+ children: /*#__PURE__*/ jsxRuntime.jsx(core$1.Accordion, {
19053
+ chevronPosition: "left",
19054
+ classNames: {
19055
+ root: 'w-full',
19056
+ control: 'data-active:bg-secondary-lightest'
19057
+ },
19058
+ children: dataLibrary && Object.values(dataLibrary).map((datalist)=>{
19059
+ return /*#__PURE__*/ jsxRuntime.jsx(DatalistAccordionItem, {
19060
+ dataList: datalist,
19061
+ size: size,
19062
+ updateListInDataLibrary: updateListInDataLibrary,
19063
+ deleteListFromDataLibrary: deleteListFromDataLibrary
19064
+ }, datalist.id);
19065
+ })
19066
+ })
19067
+ })
19068
+ ]
19069
+ });
19070
+ };
19071
+
19072
+ const DataLibrary = (config)=>{
19073
+ return /*#__PURE__*/ jsxRuntime.jsx(DataLibrarySelectionProvider, {
19074
+ children: /*#__PURE__*/ jsxRuntime.jsx(DataLibraryLists, {
19075
+ ...config
19076
+ })
19077
+ });
19078
+ };
19079
+
19080
+ const DataLibraryPage = ({ headerProps, footerProps, config })=>{
19081
+ return /*#__PURE__*/ jsxRuntime.jsx(NavPageLayout, {
19082
+ headerProps,
19083
+ footerProps,
19084
+ headerData: {
19085
+ title: 'Gen3 DataLibrary Page',
19086
+ content: 'DataLibrary Data',
19087
+ key: 'gen3-data-library-page'
19088
+ },
19089
+ children: /*#__PURE__*/ jsxRuntime.jsx(DataLibrary, {
19090
+ ...config
19091
+ })
19092
+ });
19093
+ };
19094
+
19095
+ const DataLibraryPageGetServerSideProps = async ()=>{
19096
+ try {
19097
+ const datalibraryConfig = await ContentSource.get(`config/${core.GEN3_COMMONS_NAME}/dataLibrary.json`);
19098
+ return {
19099
+ props: {
19100
+ ...await getNavPageLayoutPropsFromConfig(),
19101
+ config: datalibraryConfig
19102
+ }
19103
+ };
19104
+ } catch (err) {
19105
+ console.error(err);
19106
+ return {
19107
+ props: {
19108
+ ...await getNavPageLayoutPropsFromConfig(),
19109
+ config: {
19110
+ useAPI: false,
19111
+ actions: []
19112
+ }
19113
+ }
19114
+ };
19115
+ }
19116
+ };
19117
+
17218
19118
  const CrosswalkTable = ({ mapping, data, isFetching, isError, tableMessage, showSubmittedIdInTable })=>{
17219
19119
  const cols = React.useMemo(()=>{
17220
19120
  return [
@@ -17807,6 +19707,8 @@ exports.CreateCredentialsAPIKeyModal = CreateCredentialsAPIKeyModal;
17807
19707
  exports.CrosswalkPage = CrosswalkPage;
17808
19708
  exports.CrosswalkPageGetServerSideProps = CrosswalkPageGetServerSideProps;
17809
19709
  exports.Custom404Page = Custom404Page;
19710
+ exports.DataLibraryPage = DataLibraryPage;
19711
+ exports.DataLibraryPageGetServerSideProps = DataLibraryPageGetServerSideProps;
17810
19712
  exports.DictionaryPage = DictionaryPage;
17811
19713
  exports.DictionaryPageGetServerSideProps = DictionaryPageGetServerSideProps;
17812
19714
  exports.DiscoveryCellRendererFactory = DiscoveryCellRendererFactory;