@seliseblocks/genesis-os 4.3.8 → 4.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/dist/{chunk-OVQEP63V.cjs → chunk-DXITHNQR.cjs} +245 -145
  2. package/dist/chunk-DXITHNQR.cjs.map +1 -0
  3. package/dist/{chunk-QN6HLQ67.cjs → chunk-HBVSAOTQ.cjs} +53 -38
  4. package/dist/chunk-HBVSAOTQ.cjs.map +1 -0
  5. package/dist/{chunk-LNQUCEQU.js → chunk-SAY5K2GJ.js} +25 -11
  6. package/dist/chunk-SAY5K2GJ.js.map +1 -0
  7. package/dist/{chunk-46ZGVJEX.js → chunk-SG6FH72W.js} +69 -5
  8. package/dist/chunk-SG6FH72W.js.map +1 -0
  9. package/dist/{chunk-PSJHGD3M.js → chunk-SWHGCT72.js} +162 -62
  10. package/dist/chunk-SWHGCT72.js.map +1 -0
  11. package/dist/{chunk-4QKE3WAW.cjs → chunk-VAWEXEJZ.cjs} +73 -4
  12. package/dist/chunk-VAWEXEJZ.cjs.map +1 -0
  13. package/dist/components/index.cjs +342 -342
  14. package/dist/components/index.js +3 -3
  15. package/dist/guards/index.cjs +9 -9
  16. package/dist/guards/index.js +3 -3
  17. package/dist/hooks/index.cjs +58 -54
  18. package/dist/hooks/index.d.cts +12 -1
  19. package/dist/hooks/index.d.ts +12 -1
  20. package/dist/hooks/index.js +2 -2
  21. package/dist/index.cjs +452 -428
  22. package/dist/index.d.cts +2 -2
  23. package/dist/index.d.ts +2 -2
  24. package/dist/index.js +3 -3
  25. package/dist/layouts/index.cjs +10 -10
  26. package/dist/layouts/index.js +3 -3
  27. package/dist/lib/index.cjs +37 -17
  28. package/dist/lib/index.d.cts +44 -3
  29. package/dist/lib/index.d.ts +44 -3
  30. package/dist/lib/index.js +1 -1
  31. package/dist/pages/index.cjs +8 -8
  32. package/dist/pages/index.js +3 -3
  33. package/dist/utils/index.cjs +1 -1
  34. package/dist/utils/index.js +1 -1
  35. package/package.json +1 -1
  36. package/dist/chunk-46ZGVJEX.js.map +0 -1
  37. package/dist/chunk-4QKE3WAW.cjs.map +0 -1
  38. package/dist/chunk-LNQUCEQU.js.map +0 -1
  39. package/dist/chunk-OVQEP63V.cjs.map +0 -1
  40. package/dist/chunk-PSJHGD3M.js.map +0 -1
  41. package/dist/chunk-QN6HLQ67.cjs.map +0 -1
@@ -1,9 +1,9 @@
1
1
  'use strict';
2
2
 
3
3
  var chunkXJ6DPUCV_cjs = require('./chunk-XJ6DPUCV.cjs');
4
- var chunkQN6HLQ67_cjs = require('./chunk-QN6HLQ67.cjs');
4
+ var chunkHBVSAOTQ_cjs = require('./chunk-HBVSAOTQ.cjs');
5
5
  var chunkQTSTAWK3_cjs = require('./chunk-QTSTAWK3.cjs');
6
- var chunk4QKE3WAW_cjs = require('./chunk-4QKE3WAW.cjs');
6
+ var chunkVAWEXEJZ_cjs = require('./chunk-VAWEXEJZ.cjs');
7
7
  var chunkX4YCRWXO_cjs = require('./chunk-X4YCRWXO.cjs');
8
8
  var chunkIJMKS4XG_cjs = require('./chunk-IJMKS4XG.cjs');
9
9
  var chunkBPJM3L7O_cjs = require('./chunk-BPJM3L7O.cjs');
@@ -1523,7 +1523,7 @@ function RightSidePanelProvider({
1523
1523
  const close = React8__namespace.useCallback(() => {
1524
1524
  setOpen(false);
1525
1525
  }, [setOpen]);
1526
- chunkQN6HLQ67_cjs.useKeyboardShortcut(shortcut, toggle);
1526
+ chunkHBVSAOTQ_cjs.useKeyboardShortcut(shortcut, toggle);
1527
1527
  React8__namespace.useEffect(() => {
1528
1528
  if (!syncHash || isControlled || typeof window === "undefined") return;
1529
1529
  const handleHashChange = () => {
@@ -2388,7 +2388,7 @@ var WizardStepIndicator = ({
2388
2388
  color: indicatorColor,
2389
2389
  backgroundColor: isCompleted ? "hsl(var(--foreground))" : "transparent"
2390
2390
  },
2391
- transition: chunk4QKE3WAW_cjs.fadeTransition,
2391
+ transition: chunkVAWEXEJZ_cjs.fadeTransition,
2392
2392
  className: chunkYAF2X7W5_cjs.cn(
2393
2393
  "flex size-8 items-center justify-center rounded-full border text-lg font-bold",
2394
2394
  className
@@ -2399,7 +2399,7 @@ var WizardStepIndicator = ({
2399
2399
  initial: { scale: 0, opacity: 0 },
2400
2400
  animate: { scale: 1, opacity: 1 },
2401
2401
  exit: { scale: 0, opacity: 0 },
2402
- transition: chunk4QKE3WAW_cjs.fadeTransition,
2402
+ transition: chunkVAWEXEJZ_cjs.fadeTransition,
2403
2403
  children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, { className: "size-[18px]", "aria-hidden": true })
2404
2404
  },
2405
2405
  "check"
@@ -2409,7 +2409,7 @@ var WizardStepIndicator = ({
2409
2409
  initial: { scale: 0.8, opacity: 0 },
2410
2410
  animate: { scale: 1, opacity: 1 },
2411
2411
  exit: { scale: 0.8, opacity: 0 },
2412
- transition: chunk4QKE3WAW_cjs.fadeTransition,
2412
+ transition: chunkVAWEXEJZ_cjs.fadeTransition,
2413
2413
  children: stepNumber
2414
2414
  },
2415
2415
  "number"
@@ -2420,7 +2420,7 @@ var WizardStepIndicator = ({
2420
2420
  var WizardVerticalTrackBar = () => {
2421
2421
  const { currentStep, totalSteps, goToStep, completedSteps, getSteps } = useWizardStepper();
2422
2422
  const steps = getSteps();
2423
- return /* @__PURE__ */ jsxRuntime.jsx(framerMotion.motion.div, { layout: true, transition: chunk4QKE3WAW_cjs.fadeTransition, children: steps.map((step, index) => {
2423
+ return /* @__PURE__ */ jsxRuntime.jsx(framerMotion.motion.div, { layout: true, transition: chunkVAWEXEJZ_cjs.fadeTransition, children: steps.map((step, index) => {
2424
2424
  const stepNumber = index + 1;
2425
2425
  const isCompleted = completedSteps.includes(stepNumber);
2426
2426
  const isCurrent = currentStep === stepNumber;
@@ -2434,7 +2434,7 @@ var WizardVerticalTrackBar = () => {
2434
2434
  {
2435
2435
  layout: true,
2436
2436
  className: "flex items-center gap-2",
2437
- transition: chunk4QKE3WAW_cjs.fadeTransition,
2437
+ transition: chunkVAWEXEJZ_cjs.fadeTransition,
2438
2438
  children: [
2439
2439
  /* @__PURE__ */ jsxRuntime.jsx(
2440
2440
  Button,
@@ -2461,7 +2461,7 @@ var WizardVerticalTrackBar = () => {
2461
2461
  animate: {
2462
2462
  color: isCurrent || isCompleted ? "hsl(var(--foreground))" : "hsl(var(--muted-foreground))"
2463
2463
  },
2464
- transition: chunk4QKE3WAW_cjs.fadeTransition,
2464
+ transition: chunkVAWEXEJZ_cjs.fadeTransition,
2465
2465
  className: "ml-4 text-base font-medium",
2466
2466
  children: step.title
2467
2467
  }
@@ -2478,7 +2478,7 @@ var WizardVerticalTrackBar = () => {
2478
2478
  scaleY: isCompleted ? 1 : 0.35,
2479
2479
  backgroundColor: isCompleted ? "hsl(var(--foreground))" : "hsl(var(--border))"
2480
2480
  },
2481
- transition: chunk4QKE3WAW_cjs.fadeTransition
2481
+ transition: chunkVAWEXEJZ_cjs.fadeTransition
2482
2482
  }
2483
2483
  ) : null
2484
2484
  ]
@@ -2495,7 +2495,7 @@ var WizardHorizontalTrackBar = () => {
2495
2495
  {
2496
2496
  layout: true,
2497
2497
  className: "flex w-full flex-row flex-wrap justify-between",
2498
- transition: chunk4QKE3WAW_cjs.fadeTransition,
2498
+ transition: chunkVAWEXEJZ_cjs.fadeTransition,
2499
2499
  children: steps.map((step, index) => {
2500
2500
  const stepNumber = index + 1;
2501
2501
  const isCompleted = completedSteps.includes(stepNumber);
@@ -2534,7 +2534,7 @@ var WizardHorizontalTrackBar = () => {
2534
2534
  animate: {
2535
2535
  color: isCurrent || isCompleted ? "hsl(var(--foreground))" : "hsl(var(--muted-foreground))"
2536
2536
  },
2537
- transition: chunk4QKE3WAW_cjs.fadeTransition,
2537
+ transition: chunkVAWEXEJZ_cjs.fadeTransition,
2538
2538
  className: "hidden md:block",
2539
2539
  children: step.title
2540
2540
  }
@@ -2555,11 +2555,11 @@ var WizardStepViewport = ({
2555
2555
  return /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { mode: "wait", children: /* @__PURE__ */ jsxRuntime.jsx(
2556
2556
  framerMotion.motion.div,
2557
2557
  {
2558
- variants: chunk4QKE3WAW_cjs.fadeInUp,
2558
+ variants: chunkVAWEXEJZ_cjs.fadeInUp,
2559
2559
  initial: "initial",
2560
2560
  animate: "animate",
2561
2561
  exit: "exit",
2562
- transition: chunk4QKE3WAW_cjs.fadeTransition,
2562
+ transition: chunkVAWEXEJZ_cjs.fadeTransition,
2563
2563
  className,
2564
2564
  children
2565
2565
  },
@@ -3499,7 +3499,7 @@ function MultiSelect({
3499
3499
  onChange,
3500
3500
  value: selectedValues
3501
3501
  }) {
3502
- const [buttonRef, popoverWidth] = chunkQN6HLQ67_cjs.usePopoverWidth();
3502
+ const [buttonRef, popoverWidth] = chunkHBVSAOTQ_cjs.usePopoverWidth();
3503
3503
  const onSelectHandler = (value) => {
3504
3504
  const nextValues = selectedValues.includes(value) ? selectedValues.filter((item) => item !== value) : [...selectedValues, value];
3505
3505
  onChange(nextValues);
@@ -3815,7 +3815,7 @@ var CopyToClipboardButton = ({
3815
3815
  ),
3816
3816
  initial: false,
3817
3817
  animate: { opacity: isHoverable ? void 0 : 1 },
3818
- transition: chunk4QKE3WAW_cjs.fadeTransition,
3818
+ transition: chunkVAWEXEJZ_cjs.fadeTransition,
3819
3819
  children: [
3820
3820
  /* @__PURE__ */ jsxRuntime.jsx(
3821
3821
  Button,
@@ -3832,7 +3832,7 @@ var CopyToClipboardButton = ({
3832
3832
  initial: { scale: 0.6, opacity: 0 },
3833
3833
  animate: { scale: 1, opacity: 1 },
3834
3834
  exit: { scale: 0.6, opacity: 0 },
3835
- transition: chunk4QKE3WAW_cjs.fadeTransition,
3835
+ transition: chunkVAWEXEJZ_cjs.fadeTransition,
3836
3836
  children: /* @__PURE__ */ jsxRuntime.jsx(
3837
3837
  lucideReact.Check,
3838
3838
  {
@@ -3848,7 +3848,7 @@ var CopyToClipboardButton = ({
3848
3848
  initial: { scale: 0.6, opacity: 0 },
3849
3849
  animate: { scale: 1, opacity: 1 },
3850
3850
  exit: { scale: 0.6, opacity: 0 },
3851
- transition: chunk4QKE3WAW_cjs.fadeTransition,
3851
+ transition: chunkVAWEXEJZ_cjs.fadeTransition,
3852
3852
  children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Copy, { className: "size-4 text-muted-foreground", "aria-hidden": true })
3853
3853
  },
3854
3854
  "copy"
@@ -3861,7 +3861,7 @@ var CopyToClipboardButton = ({
3861
3861
  layout: true,
3862
3862
  className: "pointer-events-none absolute left-8 top-1/2 z-10 hidden -translate-y-1/2 whitespace-nowrap rounded bg-popover px-2 py-1 text-xs text-popover-foreground shadow-md peer-hover:block",
3863
3863
  animate: { opacity: isCopying ? 1 : 0.9 },
3864
- transition: chunk4QKE3WAW_cjs.fadeTransition,
3864
+ transition: chunkVAWEXEJZ_cjs.fadeTransition,
3865
3865
  children: isCopying ? copiedLabel : copyLabel
3866
3866
  }
3867
3867
  )
@@ -5228,7 +5228,7 @@ var InfiniteScroller = ({
5228
5228
  initial: { opacity: 0, height: 0 },
5229
5229
  animate: { opacity: 1, height: "auto" },
5230
5230
  exit: { opacity: 0, height: 0 },
5231
- transition: chunk4QKE3WAW_cjs.fadeTransition,
5231
+ transition: chunkVAWEXEJZ_cjs.fadeTransition,
5232
5232
  children: loadingIndicator
5233
5233
  },
5234
5234
  "loading"
@@ -5239,10 +5239,10 @@ var InfiniteScroller = ({
5239
5239
  framerMotion.motion.div,
5240
5240
  {
5241
5241
  layout: true,
5242
- variants: chunk4QKE3WAW_cjs.fadeInUp,
5242
+ variants: chunkVAWEXEJZ_cjs.fadeInUp,
5243
5243
  initial: "initial",
5244
5244
  animate: "animate",
5245
- transition: chunk4QKE3WAW_cjs.fadeTransition,
5245
+ transition: chunkVAWEXEJZ_cjs.fadeTransition,
5246
5246
  children: renderItem(item, index)
5247
5247
  },
5248
5248
  key
@@ -5254,7 +5254,7 @@ var InfiniteScroller = ({
5254
5254
  className: "flex h-full items-center justify-center text-muted-foreground",
5255
5255
  initial: { opacity: 0 },
5256
5256
  animate: { opacity: 1 },
5257
- transition: chunk4QKE3WAW_cjs.fadeTransition,
5257
+ transition: chunkVAWEXEJZ_cjs.fadeTransition,
5258
5258
  children: emptyContent ?? "No items"
5259
5259
  }
5260
5260
  ) }),
@@ -5265,7 +5265,7 @@ var InfiniteScroller = ({
5265
5265
  initial: { opacity: 0, y: 16 },
5266
5266
  animate: { opacity: 1, y: 0 },
5267
5267
  exit: { opacity: 0, y: 12 },
5268
- transition: chunk4QKE3WAW_cjs.fadeTransition,
5268
+ transition: chunkVAWEXEJZ_cjs.fadeTransition,
5269
5269
  children: /* @__PURE__ */ jsxRuntime.jsx(
5270
5270
  framerMotion.motion.div,
5271
5271
  {
@@ -5903,14 +5903,14 @@ var Timeline = ({
5903
5903
  framerMotion.motion.div,
5904
5904
  {
5905
5905
  className: chunkYAF2X7W5_cjs.cn("mt-4 flex flex-col items-start md:mt-5", className),
5906
- variants: chunk4QKE3WAW_cjs.staggerContainer,
5906
+ variants: chunkVAWEXEJZ_cjs.staggerContainer,
5907
5907
  initial: "initial",
5908
5908
  animate: "animate",
5909
5909
  children: events.map((event, index) => /* @__PURE__ */ jsxRuntime.jsxs(
5910
5910
  framerMotion.motion.div,
5911
5911
  {
5912
- variants: chunk4QKE3WAW_cjs.staggerItem,
5913
- transition: chunk4QKE3WAW_cjs.fadeTransition,
5912
+ variants: chunkVAWEXEJZ_cjs.staggerItem,
5913
+ transition: chunkVAWEXEJZ_cjs.fadeTransition,
5914
5914
  className: "flex min-h-[66px] w-full",
5915
5915
  children: [
5916
5916
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: chunkYAF2X7W5_cjs.cn("relative", isMobile ? "w-[30%]" : "w-[16%]"), children: /* @__PURE__ */ jsxRuntime.jsx(
@@ -5919,7 +5919,7 @@ var Timeline = ({
5919
5919
  className: "absolute -top-1.5 w-full pr-[18px] text-right md:pr-5",
5920
5920
  initial: { opacity: 0, x: -6 },
5921
5921
  animate: { opacity: 1, x: 0 },
5922
- transition: { ...chunk4QKE3WAW_cjs.fadeTransition, delay: index * 0.05 },
5922
+ transition: { ...chunkVAWEXEJZ_cjs.fadeTransition, delay: index * 0.05 },
5923
5923
  children: leftContent ? leftContent(event) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
5924
5924
  /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground text-xs font-medium leading-5 md:text-sm", children: event.time }),
5925
5925
  /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground text-xs font-medium leading-5 md:text-sm", children: event.date })
@@ -5936,7 +5936,7 @@ var Timeline = ({
5936
5936
  ),
5937
5937
  initial: { scaleY: 0 },
5938
5938
  animate: { scaleY: 1 },
5939
- transition: { ...chunk4QKE3WAW_cjs.fadeTransition, delay: index * 0.05 }
5939
+ transition: { ...chunkVAWEXEJZ_cjs.fadeTransition, delay: index * 0.05 }
5940
5940
  }
5941
5941
  ) : null,
5942
5942
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -5945,7 +5945,7 @@ var Timeline = ({
5945
5945
  className: "bg-primary relative z-10 size-4 rounded-full",
5946
5946
  initial: { scale: 0 },
5947
5947
  animate: { scale: 1 },
5948
- transition: { ...chunk4QKE3WAW_cjs.fadeTransition, delay: index * 0.05 + 0.04 }
5948
+ transition: { ...chunkVAWEXEJZ_cjs.fadeTransition, delay: index * 0.05 + 0.04 }
5949
5949
  }
5950
5950
  )
5951
5951
  ] }),
@@ -5998,11 +5998,11 @@ var ImportFileModalContent = ({
5998
5998
  return /* @__PURE__ */ jsxRuntime.jsx(DialogContent, { className: chunkYAF2X7W5_cjs.cn("rounded-md sm:max-w-[450px]", className), children: /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { mode: "wait", children: !showConfirmation ? /* @__PURE__ */ jsxRuntime.jsxs(
5999
5999
  framerMotion.motion.div,
6000
6000
  {
6001
- variants: chunk4QKE3WAW_cjs.fadeInScale,
6001
+ variants: chunkVAWEXEJZ_cjs.fadeInScale,
6002
6002
  initial: "initial",
6003
6003
  animate: "animate",
6004
6004
  exit: "exit",
6005
- transition: chunk4QKE3WAW_cjs.fadeTransition,
6005
+ transition: chunkVAWEXEJZ_cjs.fadeTransition,
6006
6006
  children: [
6007
6007
  /* @__PURE__ */ jsxRuntime.jsxs(DialogHeader, { children: [
6008
6008
  /* @__PURE__ */ jsxRuntime.jsx(DialogTitle, { className: "text-left", children: dialogTitle }),
@@ -6014,7 +6014,7 @@ var ImportFileModalContent = ({
6014
6014
  className: "flex flex-col rounded-md bg-muted/50 px-3 py-2",
6015
6015
  initial: { opacity: 0, y: 6 },
6016
6016
  animate: { opacity: 1, y: 0 },
6017
- transition: { ...chunk4QKE3WAW_cjs.fadeTransition, delay: 0.05 },
6017
+ transition: { ...chunkVAWEXEJZ_cjs.fadeTransition, delay: 0.05 },
6018
6018
  children: [
6019
6019
  /* @__PURE__ */ jsxRuntime.jsxs(framerMotion.motion.div, { className: "flex flex-row items-center", children: [
6020
6020
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -6051,7 +6051,7 @@ var ImportFileModalContent = ({
6051
6051
  initial: { opacity: 0, x: -8 },
6052
6052
  animate: { opacity: 1, x: 0 },
6053
6053
  exit: { opacity: 0, x: 8 },
6054
- transition: chunk4QKE3WAW_cjs.fadeTransition,
6054
+ transition: chunkVAWEXEJZ_cjs.fadeTransition,
6055
6055
  children: /* @__PURE__ */ jsxRuntime.jsxs(FileUploaderItem, { index, children: [
6056
6056
  /* @__PURE__ */ jsxRuntime.jsx(
6057
6057
  lucideReact.Paperclip,
@@ -6101,11 +6101,11 @@ var ImportFileModalContent = ({
6101
6101
  ) : /* @__PURE__ */ jsxRuntime.jsxs(
6102
6102
  framerMotion.motion.div,
6103
6103
  {
6104
- variants: chunk4QKE3WAW_cjs.fadeInScale,
6104
+ variants: chunkVAWEXEJZ_cjs.fadeInScale,
6105
6105
  initial: "initial",
6106
6106
  animate: "animate",
6107
6107
  exit: "exit",
6108
- transition: chunk4QKE3WAW_cjs.fadeTransition,
6108
+ transition: chunkVAWEXEJZ_cjs.fadeTransition,
6109
6109
  children: [
6110
6110
  /* @__PURE__ */ jsxRuntime.jsxs(DialogHeader, { children: [
6111
6111
  /* @__PURE__ */ jsxRuntime.jsx(DialogTitle, { className: "text-left", children: processingTitle }),
@@ -6481,7 +6481,12 @@ var AppTile = ({
6481
6481
  {
6482
6482
  href: isLoading ? void 0 : app.initiateUrl,
6483
6483
  "aria-disabled": isLoading,
6484
- onClick: isLoading ? (e) => e.preventDefault() : void 0,
6484
+ onClick: isLoading ? (e) => e.preventDefault() : app.markUsed,
6485
+ onAuxClick: (e) => {
6486
+ if (!isLoading && e.button === 1) app.markUsed();
6487
+ },
6488
+ onContextMenu: isLoading ? void 0 : app.markUsed,
6489
+ onDragStart: isLoading ? void 0 : app.markUsed,
6485
6490
  className: chunkYAF2X7W5_cjs.cn(
6486
6491
  "hover:bg-accent focus-visible:ring-ring group flex flex-col items-center gap-2 rounded-xl p-3 text-center transition-colors focus-visible:outline-none focus-visible:ring-2",
6487
6492
  isLoading && "pointer-events-none opacity-50 cursor-default"
@@ -6672,49 +6677,70 @@ var filteredAppSwitcherData = APP_SWITCHER_DATA.filter((app) => {
6672
6677
  if (!isAppAllowed(app)) return false;
6673
6678
  return typeof app.isDisabled === "function" ? !app.isDisabled() : !app.isDisabled;
6674
6679
  });
6680
+ var INITIATE_URL_MAX_AGE_MS = 5 * 60 * 1e3;
6681
+ var initiateQueryKey = (clientId, redirectUri, forwardedTo) => ["idp-initiate", clientId, redirectUri, forwardedTo];
6675
6682
  function useAppRedirectUrls({
6676
6683
  open,
6677
6684
  apps,
6678
6685
  resolveForwardedTo
6679
6686
  }) {
6680
- const [redirectUrls, setRedirectUrls] = React8.useState({});
6681
- const appsKey = apps.map((a) => a.id).join("|");
6682
- const stableApps = React8.useMemo(() => apps, [appsKey]);
6683
- const resolveRef = React8.useRef(resolveForwardedTo);
6684
- resolveRef.current = resolveForwardedTo;
6685
- React8.useEffect(() => {
6686
- if (!open || stableApps.length === 0) return void 0;
6687
- setRedirectUrls({});
6688
- const controller = new AbortController();
6689
- const { signal } = controller;
6690
- stableApps.forEach((app) => {
6691
- chunkQN6HLQ67_cjs.initiateService.fetchRedirectUrl({
6692
- clientId: chunkX4YCRWXO_cjs.getRuntimeEnv(app.clientId),
6693
- redirectUri: chunkX4YCRWXO_cjs.getRuntimeEnv(app.redirectUri),
6694
- forwardedTo: resolveRef.current(app)
6695
- }).then((redirectUrl) => {
6696
- if (signal.aborted || !redirectUrl) return;
6697
- setRedirectUrls((prev) => ({ ...prev, [app.id]: redirectUrl }));
6698
- }).catch((err) => {
6699
- if (signal.aborted) return;
6700
- console.error(
6701
- `[AppSwitcher] Failed to get redirect URL for ${app.id}:`,
6702
- err
6703
- );
6704
- });
6705
- });
6706
- return () => controller.abort();
6707
- }, [open, stableApps]);
6708
- if (!open || stableApps.length === 0) return [];
6709
- return stableApps.map((app) => ({
6710
- ...app,
6711
- initiateUrl: redirectUrls[app.id] ?? app.initiateUrl,
6712
- isLoading: !redirectUrls[app.id]
6713
- }));
6687
+ const queryClient = reactQuery.useQueryClient();
6688
+ const requests = apps.map((app) => {
6689
+ const clientId = chunkX4YCRWXO_cjs.getRuntimeEnv(app.clientId);
6690
+ const redirectUri = chunkX4YCRWXO_cjs.getRuntimeEnv(app.redirectUri);
6691
+ const forwardedTo = resolveForwardedTo(app);
6692
+ return {
6693
+ app,
6694
+ clientId,
6695
+ redirectUri,
6696
+ forwardedTo,
6697
+ queryKey: initiateQueryKey(clientId, redirectUri, forwardedTo)
6698
+ };
6699
+ });
6700
+ const results = reactQuery.useQueries({
6701
+ queries: requests.map(
6702
+ ({ clientId, redirectUri, forwardedTo, queryKey }) => ({
6703
+ queryKey,
6704
+ queryFn: ({ signal }) => chunkHBVSAOTQ_cjs.initiateService.fetchRedirectUrl(
6705
+ { clientId, redirectUri, forwardedTo },
6706
+ signal
6707
+ ),
6708
+ enabled: open,
6709
+ staleTime: INITIATE_URL_MAX_AGE_MS,
6710
+ gcTime: INITIATE_URL_MAX_AGE_MS,
6711
+ // Replace a URL as it ages out while the popover stays open, rather than leaving the tile on
6712
+ // "Loading…" until it is reopened.
6713
+ refetchInterval: INITIATE_URL_MAX_AGE_MS,
6714
+ refetchOnWindowFocus: false,
6715
+ refetchOnReconnect: false,
6716
+ retry: false
6717
+ })
6718
+ )
6719
+ });
6720
+ const markUsed = React8.useCallback(
6721
+ (queryKey) => {
6722
+ setTimeout(() => {
6723
+ void queryClient.resetQueries({ queryKey, exact: true });
6724
+ }, 0);
6725
+ },
6726
+ [queryClient]
6727
+ );
6728
+ if (!open || apps.length === 0) return [];
6729
+ const now = Date.now();
6730
+ return requests.map(({ app, queryKey }, index) => {
6731
+ const result = results[index];
6732
+ const url = result?.data && now - result.dataUpdatedAt < INITIATE_URL_MAX_AGE_MS ? result.data : void 0;
6733
+ return {
6734
+ ...app,
6735
+ initiateUrl: url ?? app.initiateUrl,
6736
+ isLoading: !url,
6737
+ markUsed: () => markUsed(queryKey)
6738
+ };
6739
+ });
6714
6740
  }
6715
6741
  var AppSwitcher = ({ forwardedTo }) => {
6716
6742
  const [open, setOpen] = React8.useState(false);
6717
- const config = chunkQN6HLQ67_cjs.useBlocksAppConfigStore((state) => state.getConfig());
6743
+ const config = chunkHBVSAOTQ_cjs.useBlocksAppConfigStore((state) => state.getConfig());
6718
6744
  const filteredApps = React8.useMemo(
6719
6745
  () => filteredAppSwitcherData.filter((app) => app.id !== config.name),
6720
6746
  [config.name]
@@ -6753,7 +6779,7 @@ function ThemeSwitcher({
6753
6779
  className,
6754
6780
  showChevron = true
6755
6781
  } = {}) {
6756
- const { theme, setTheme } = chunkQN6HLQ67_cjs.useTheme();
6782
+ const { theme, setTheme } = chunkHBVSAOTQ_cjs.useTheme();
6757
6783
  const { Icon: ThemeIcon } = OPTIONS[theme];
6758
6784
  return /* @__PURE__ */ jsxRuntime.jsxs(DropdownMenu, { children: [
6759
6785
  /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
@@ -6821,7 +6847,7 @@ function ThemeSwitcher({
6821
6847
  // src/services/user.service.ts
6822
6848
  var UserService = class {
6823
6849
  async getUserInfo() {
6824
- return chunk4QKE3WAW_cjs.iamClient.get(`${chunk4QKE3WAW_cjs.PROFILE_ENDPOINTS.ME}`);
6850
+ return chunkVAWEXEJZ_cjs.iamClient.get(`${chunkVAWEXEJZ_cjs.PROFILE_ENDPOINTS.ME}`);
6825
6851
  }
6826
6852
  };
6827
6853
  var userService = new UserService();
@@ -6863,14 +6889,14 @@ function UserAvatar({ size = "sm" }) {
6863
6889
  );
6864
6890
  }
6865
6891
  function UserDropdownMenu() {
6866
- const { name } = chunkQN6HLQ67_cjs.useBlocksAppConfigStore((state) => state.config);
6892
+ const { name } = chunkHBVSAOTQ_cjs.useBlocksAppConfigStore((state) => state.config);
6867
6893
  const { data } = useGetUserInfo();
6868
6894
  const userData = data?.data;
6869
- const { isPending, mutateAsync } = chunkQN6HLQ67_cjs.useLogout();
6895
+ const { isPending, mutateAsync } = chunkHBVSAOTQ_cjs.useLogout();
6870
6896
  const { resetProjectStore } = chunk6GCU5LM7_cjs.useProjectStore();
6871
6897
  const { setUnAuthenticated, clearTokens } = chunk6GCU5LM7_cjs.useAuthStore();
6872
6898
  const { resetSelectedLanguages } = chunk4QN4CYSC_cjs.useLanguageViewStore();
6873
- const { data: myOrgsData, isLoading: isOrgsLoading } = chunkQN6HLQ67_cjs.useGetMyOrganizations();
6899
+ const { data: myOrgsData, isLoading: isOrgsLoading } = chunkHBVSAOTQ_cjs.useGetMyOrganizations();
6874
6900
  const fullName = [userData?.firstName, userData?.lastName].filter(Boolean).join(" ") || "\u2014";
6875
6901
  const email = userData?.email || "";
6876
6902
  const roles = Object.values(userData?.roles || {}).flat();
@@ -7000,7 +7026,7 @@ var languages = [
7000
7026
  { key: "fr", title: "French" }
7001
7027
  ];
7002
7028
  function LanguageSelector() {
7003
- const { changeLanguage, language } = chunkQN6HLQ67_cjs.useLanguageSwitcher();
7029
+ const { changeLanguage, language } = chunkHBVSAOTQ_cjs.useLanguageSwitcher();
7004
7030
  return /* @__PURE__ */ jsxRuntime.jsxs(DropdownMenu, { children: [
7005
7031
  /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
7006
7032
  "button",
@@ -7090,7 +7116,7 @@ var notificationListenerService = new NotificationListenerService();
7090
7116
 
7091
7117
  // src/components/common/notification/use-notification-socket.ts
7092
7118
  function useNotificationSocket() {
7093
- const { data: configData } = chunkQN6HLQ67_cjs.useGetBlocksNotificationConfig(0, 100);
7119
+ const { data: configData } = chunkHBVSAOTQ_cjs.useGetBlocksNotificationConfig(0, 100);
7094
7120
  const queryClient = reactQuery.useQueryClient();
7095
7121
  notificationListenerService.connect();
7096
7122
  React8.useEffect(() => {
@@ -7105,7 +7131,7 @@ function useNotificationSocket() {
7105
7131
  notificationListenerService.connection.on(
7106
7132
  config.notifyMethod,
7107
7133
  (message) => {
7108
- chunkQN6HLQ67_cjs.notificationService.getNotificationConfig(config, message);
7134
+ chunkHBVSAOTQ_cjs.notificationService.getNotificationConfig(config, message);
7109
7135
  try {
7110
7136
  const notice = typeof message === "string" ? JSON.parse(message) : message;
7111
7137
  const denom = JSON.parse(
@@ -7129,12 +7155,12 @@ function useNotificationFeed(open) {
7129
7155
  const [notifications, setNotifications] = React8.useState([]);
7130
7156
  const [hasMore, setHasMore] = React8.useState(true);
7131
7157
  const listRef = React8.useRef(null);
7132
- const { data, isLoading, isFetching } = chunkQN6HLQ67_cjs.useGetNotifications(
7158
+ const { data, isLoading, isFetching } = chunkHBVSAOTQ_cjs.useGetNotifications(
7133
7159
  pageNumber,
7134
7160
  PAGE_SIZE
7135
7161
  );
7136
- const markAsRead = chunkQN6HLQ67_cjs.useMarkAsRead();
7137
- const markAllAsRead = chunkQN6HLQ67_cjs.useMarkAllAsRead();
7162
+ const markAsRead = chunkHBVSAOTQ_cjs.useMarkAsRead();
7163
+ const markAllAsRead = chunkHBVSAOTQ_cjs.useMarkAllAsRead();
7138
7164
  React8.useEffect(() => {
7139
7165
  if (!data?.notifications) return;
7140
7166
  setNotifications((prev) => {
@@ -7368,7 +7394,7 @@ function ConsoleHeader() {
7368
7394
  window.addEventListener("scroll", handleScroll);
7369
7395
  return () => window.removeEventListener("scroll", handleScroll);
7370
7396
  }, []);
7371
- const { appLightLogo, appDarkLogo } = chunkQN6HLQ67_cjs.useLogo();
7397
+ const { appLightLogo, appDarkLogo } = chunkHBVSAOTQ_cjs.useLogo();
7372
7398
  return /* @__PURE__ */ jsxRuntime.jsx(
7373
7399
  "div",
7374
7400
  {
@@ -7547,7 +7573,7 @@ var EnvironmentCard = ({
7547
7573
  className
7548
7574
  }) => {
7549
7575
  const { setSelectedProject, setTenantGroup } = chunk6GCU5LM7_cjs.useProjectStore();
7550
- const { mutateAsync } = chunkQN6HLQ67_cjs.useStartImpersonation();
7576
+ const { mutateAsync } = chunkHBVSAOTQ_cjs.useStartImpersonation();
7551
7577
  const navigate = reactRouter.useNavigate();
7552
7578
  const handleCardClick = async () => {
7553
7579
  try {
@@ -7601,11 +7627,11 @@ function EnvironmentList({
7601
7627
  }) {
7602
7628
  const navigate = reactRouter.useNavigate();
7603
7629
  const { pathname } = reactRouter.useLocation();
7604
- const { data: projectGroups = [], isLoading } = chunkQN6HLQ67_cjs.useGetProjects({
7630
+ const { data: projectGroups = [], isLoading } = chunkHBVSAOTQ_cjs.useGetProjects({
7605
7631
  enabled: true
7606
7632
  });
7607
7633
  const { selectedProject, setSelectedProject } = chunk6GCU5LM7_cjs.useProjectStore();
7608
- const { data: projectData } = chunkQN6HLQ67_cjs.useGetProject();
7634
+ const { data: projectData } = chunkHBVSAOTQ_cjs.useGetProject();
7609
7635
  const pendingProjectRef = React8.useRef(null);
7610
7636
  const redirectRegexMap = React8.useMemo(
7611
7637
  () => Object.entries(redirectPaths).reduce(
@@ -7769,7 +7795,7 @@ function AuthResolver({ children }) {
7769
7795
  hasResolved.current = true;
7770
7796
  async function resolve() {
7771
7797
  try {
7772
- const res = await chunk4QKE3WAW_cjs.iamClient.get(`${chunk4QKE3WAW_cjs.AUTH_ENDPOINTS.ME}`);
7798
+ const res = await chunkVAWEXEJZ_cjs.iamClient.get(`${chunkVAWEXEJZ_cjs.AUTH_ENDPOINTS.ME}`);
7773
7799
  setUser(res);
7774
7800
  setAuthenticated();
7775
7801
  } catch {
@@ -7849,10 +7875,46 @@ var AppLoadingSpinner = ({ size = 64 }) => /* @__PURE__ */ jsxRuntime.jsxs(jsxRu
7849
7875
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "bg-background fixed inset-0 z-50 flex items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "animate-breathe", children: /* @__PURE__ */ jsxRuntime.jsx(BlocksIcon, { size }) }) })
7850
7876
  ] });
7851
7877
  var projectNameFor = (projects, tenantId) => tenantId && projects.find((p) => p.tenantId === tenantId)?.name || null;
7878
+ var claimKeyOf = (claim) => claim ? `${claim.tabId}|${claim.tenantId}|${claim.ts}` : null;
7879
+ var useLiveOwnerProbe = ({
7880
+ cookieTenantId,
7881
+ ownTenantId,
7882
+ onHeldElsewhere
7883
+ }) => {
7884
+ const foreignClaim = React8.useMemo(() => {
7885
+ if (!cookieTenantId || !ownTenantId || cookieTenantId === ownTenantId) {
7886
+ return null;
7887
+ }
7888
+ const owner = chunkVAWEXEJZ_cjs.readCurrentOwner();
7889
+ return owner && owner.tabId !== chunkVAWEXEJZ_cjs.TAB_ID && owner.tenantId === cookieTenantId ? owner : null;
7890
+ }, [cookieTenantId, ownTenantId]);
7891
+ const claimKey = claimKeyOf(foreignClaim);
7892
+ const [probedKey, setProbedKey] = React8.useState(null);
7893
+ const foreignClaimRef = React8.useRef(foreignClaim);
7894
+ const onHeldElsewhereRef = React8.useRef(onHeldElsewhere);
7895
+ foreignClaimRef.current = foreignClaim;
7896
+ onHeldElsewhereRef.current = onHeldElsewhere;
7897
+ React8.useEffect(() => {
7898
+ const claim = foreignClaimRef.current;
7899
+ if (!claim || !claimKey) return;
7900
+ let cancelled = false;
7901
+ void chunkVAWEXEJZ_cjs.isTenantHeldElsewhere(claim.tenantId).then((held) => {
7902
+ if (cancelled) return;
7903
+ if (held && chunkVAWEXEJZ_cjs.isSameClaim(chunkVAWEXEJZ_cjs.readCurrentOwner(), claim)) {
7904
+ onHeldElsewhereRef.current(claim.tenantId);
7905
+ }
7906
+ setProbedKey(claimKey);
7907
+ });
7908
+ return () => {
7909
+ cancelled = true;
7910
+ };
7911
+ }, [claimKey]);
7912
+ return !!claimKey && probedKey !== claimKey;
7913
+ };
7852
7914
  var ImpersonationChecker = ({
7853
7915
  children
7854
7916
  }) => {
7855
- const { data, isLoading, isSuccess } = chunkQN6HLQ67_cjs.useImpersonationStatusChecker();
7917
+ const { data, isLoading, isSuccess } = chunkHBVSAOTQ_cjs.useImpersonationStatusChecker();
7856
7918
  const { setImpersonation, isInitialized, setInitialized } = chunk4QN4CYSC_cjs.useImpersonateStore();
7857
7919
  React8.useEffect(() => {
7858
7920
  if (!data) return;
@@ -7904,32 +7966,41 @@ function ImpersonationTerminator({
7904
7966
  const {
7905
7967
  terminate,
7906
7968
  isImpersonated,
7969
+ impersonatedTenantId,
7907
7970
  detachedReason,
7908
7971
  detachedTenantId,
7909
7972
  setDetached
7910
7973
  } = chunk4QN4CYSC_cjs.useImpersonateStore();
7911
- const { mutateAsync } = chunkQN6HLQ67_cjs.useStopImpersonation();
7974
+ const { mutateAsync } = chunkHBVSAOTQ_cjs.useStopImpersonation();
7975
+ const recordClaimedTenant = chunkHBVSAOTQ_cjs.useRecordClaimedTenant();
7912
7976
  const { projects } = chunk6GCU5LM7_cjs.useProjectStore();
7913
7977
  const isTriggering = React8.useRef(false);
7914
7978
  const [isTerminating, setIsTerminating] = React8.useState(false);
7915
7979
  const rootTenantId = window.process?.env.BLOCKS_X_BLOCKS_KEY || "";
7980
+ const isProbingOwner = useLiveOwnerProbe({
7981
+ cookieTenantId: isImpersonated ? impersonatedTenantId : null,
7982
+ ownTenantId: rootTenantId || null,
7983
+ onHeldElsewhere: (tenantId) => setDetached("another-project", tenantId)
7984
+ });
7916
7985
  React8.useEffect(() => {
7917
7986
  if (!rootTenantId) return;
7918
- const owner = chunk4QKE3WAW_cjs.readCurrentOwner();
7919
- if (owner && owner.tabId !== chunk4QKE3WAW_cjs.TAB_ID && owner.tenantId !== rootTenantId) {
7920
- setDetached("another-project", owner.tenantId);
7921
- }
7922
- return chunk4QKE3WAW_cjs.subscribeToTenantClaims((claim) => {
7987
+ return chunkVAWEXEJZ_cjs.subscribeToTenantClaims((claim) => {
7988
+ recordClaimedTenant(claim.tenantId, rootTenantId);
7923
7989
  if (claim.tenantId === rootTenantId) {
7924
7990
  setDetached(null);
7925
7991
  return;
7926
7992
  }
7927
7993
  setDetached("another-project", claim.tenantId);
7928
7994
  });
7929
- }, [rootTenantId, setDetached]);
7995
+ }, [rootTenantId, setDetached, recordClaimedTenant]);
7996
+ const isDetached = detachedReason === "another-project";
7997
+ React8.useEffect(() => {
7998
+ if (detachedReason === "console") setDetached(null);
7999
+ }, [detachedReason, setDetached]);
7930
8000
  React8.useEffect(() => {
7931
8001
  if (isTriggering.current || !isImpersonated) return;
7932
- if (detachedReason) return;
8002
+ if (isDetached) return;
8003
+ if (isProbingOwner) return;
7933
8004
  isTriggering.current = true;
7934
8005
  setIsTerminating(true);
7935
8006
  const stopImpersonation = async () => {
@@ -7944,14 +8015,21 @@ function ImpersonationTerminator({
7944
8015
  sessionIsRootScoped = error instanceof chunkX4YCRWXO_cjs.HttpError && error.status === 401;
7945
8016
  } finally {
7946
8017
  terminate(rootTenantId);
7947
- if (sessionIsRootScoped && rootTenantId) chunk4QKE3WAW_cjs.claimTenant(rootTenantId);
8018
+ if (sessionIsRootScoped && rootTenantId) chunkVAWEXEJZ_cjs.claimTenant(rootTenantId);
7948
8019
  isTriggering.current = false;
7949
8020
  setIsTerminating(false);
7950
8021
  }
7951
8022
  };
7952
8023
  void stopImpersonation();
7953
- }, [mutateAsync, terminate, isImpersonated, detachedReason, rootTenantId]);
7954
- if (detachedReason) {
8024
+ }, [
8025
+ mutateAsync,
8026
+ terminate,
8027
+ isImpersonated,
8028
+ isDetached,
8029
+ isProbingOwner,
8030
+ rootTenantId
8031
+ ]);
8032
+ if (isDetached) {
7955
8033
  const name = projectNameFor(projects, detachedTenantId);
7956
8034
  return /* @__PURE__ */ jsxRuntime.jsx(
7957
8035
  ImpersonationBlocked,
@@ -7982,8 +8060,9 @@ function ImpersonationSynchronizer({
7982
8060
  setImpersonationError,
7983
8061
  setDetached
7984
8062
  } = chunk4QN4CYSC_cjs.useImpersonateStore();
7985
- const { mutateAsync } = chunkQN6HLQ67_cjs.useStartImpersonation();
7986
- const { data: _data } = chunkQN6HLQ67_cjs.useGetProjects({ enabled: true });
8063
+ const { mutateAsync } = chunkHBVSAOTQ_cjs.useStartImpersonation();
8064
+ const recordClaimedTenant = chunkHBVSAOTQ_cjs.useRecordClaimedTenant();
8065
+ const { data: _data } = chunkHBVSAOTQ_cjs.useGetProjects({ enabled: true });
7987
8066
  const { selectedProject, setSelectedProject, projects, setTenantGroup } = chunk6GCU5LM7_cjs.useProjectStore();
7988
8067
  const isTriggering = React8.useRef(false);
7989
8068
  const [isImpersonating, setIsImpersonating] = React8.useState(false);
@@ -8018,7 +8097,7 @@ function ImpersonationSynchronizer({
8018
8097
  ]);
8019
8098
  const getImpersonatedProject = async () => {
8020
8099
  try {
8021
- const res = chunkQN6HLQ67_cjs.projectService.getProject();
8100
+ const res = chunkHBVSAOTQ_cjs.projectService.getProject();
8022
8101
  return (await res).data;
8023
8102
  } catch (error) {
8024
8103
  console.error("Error fetching projects:", error);
@@ -8067,15 +8146,23 @@ function ImpersonationSynchronizer({
8067
8146
  setDetached(null);
8068
8147
  void runImpersonation();
8069
8148
  }, [runImpersonation, setImpersonationError, setDetached]);
8149
+ const detachedHere = detachedReason === "another-project" && detachedTenantId === routeTenantId ? null : detachedReason;
8070
8150
  React8.useEffect(() => {
8071
- const owner = chunk4QKE3WAW_cjs.readCurrentOwner();
8072
- if (owner && owner.tabId !== chunk4QKE3WAW_cjs.TAB_ID && routeTenantId && owner.tenantId !== routeTenantId) {
8073
- setDetached(
8074
- owner.tenantId === rootTenantId ? "console" : "another-project",
8075
- owner.tenantId
8076
- );
8077
- }
8078
- return chunk4QKE3WAW_cjs.subscribeToTenantClaims((claim) => {
8151
+ if (detachedReason && detachedReason !== detachedHere) setDetached(null);
8152
+ }, [detachedReason, detachedHere, setDetached]);
8153
+ const isProbingOwner = useLiveOwnerProbe({
8154
+ cookieTenantId: impersonatedTenantId,
8155
+ ownTenantId: routeTenantId,
8156
+ onHeldElsewhere: (tenantId) => setDetached("another-project", tenantId)
8157
+ });
8158
+ const isAttached = !!routeTenantId && routeTenantId === impersonatedTenantId && !detachedHere && !impersonationError && !isProbingOwner;
8159
+ React8.useEffect(() => {
8160
+ if (!isAttached || !routeTenantId) return;
8161
+ return chunkVAWEXEJZ_cjs.holdTenant(routeTenantId);
8162
+ }, [isAttached, routeTenantId]);
8163
+ React8.useEffect(() => {
8164
+ return chunkVAWEXEJZ_cjs.subscribeToTenantClaims((claim) => {
8165
+ recordClaimedTenant(claim.tenantId, rootTenantId);
8079
8166
  const mine = routeTenantIdRef.current;
8080
8167
  if (!mine) return;
8081
8168
  if (claim.tenantId === mine) {
@@ -8087,11 +8174,12 @@ function ImpersonationSynchronizer({
8087
8174
  claim.tenantId
8088
8175
  );
8089
8176
  });
8090
- }, [routeTenantId, rootTenantId, setDetached]);
8177
+ }, [routeTenantId, rootTenantId, setDetached, recordClaimedTenant]);
8091
8178
  React8.useEffect(() => {
8092
8179
  if (!itemId) return;
8093
8180
  if (isTriggering.current) return;
8094
- if (impersonationError || detachedReason) return;
8181
+ if (impersonationError || detachedHere) return;
8182
+ if (isProbingOwner) return;
8095
8183
  const needsColdStart = !routeTenantId && !!impersonatedTenantId && !selectedProject;
8096
8184
  const needsRetarget = !!routeTenantId && routeTenantId !== impersonatedTenantId;
8097
8185
  if (!needsColdStart && !needsRetarget) return;
@@ -8102,7 +8190,8 @@ function ImpersonationSynchronizer({
8102
8190
  impersonatedTenantId,
8103
8191
  selectedProject,
8104
8192
  impersonationError,
8105
- detachedReason,
8193
+ detachedHere,
8194
+ isProbingOwner,
8106
8195
  runImpersonation
8107
8196
  ]);
8108
8197
  const thisProjectName = projectNameFor(projects, routeTenantId);
@@ -8118,6 +8207,14 @@ function ImpersonationSynchronizer({
8118
8207
  if (!isImpersonated || isTriggering.current) return null;
8119
8208
  return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
8120
8209
  }
8210
+ if (isProbingOwner && !detachedHere) {
8211
+ return /* @__PURE__ */ jsxRuntime.jsx(
8212
+ ImpersonationWaiting,
8213
+ {
8214
+ label: thisProjectName ? `Opening ${thisProjectName}\u2026` : "Opening project\u2026"
8215
+ }
8216
+ );
8217
+ }
8121
8218
  if (impersonationError) {
8122
8219
  const accessDenied = impersonationError instanceof chunkX4YCRWXO_cjs.HttpError && impersonationError.status === 403;
8123
8220
  return accessDenied ? /* @__PURE__ */ jsxRuntime.jsx(
@@ -8138,7 +8235,7 @@ function ImpersonationSynchronizer({
8138
8235
  }
8139
8236
  );
8140
8237
  }
8141
- if (detachedReason === "console") {
8238
+ if (detachedHere === "console") {
8142
8239
  return /* @__PURE__ */ jsxRuntime.jsx(
8143
8240
  ImpersonationBlocked,
8144
8241
  {
@@ -8150,7 +8247,7 @@ function ImpersonationSynchronizer({
8150
8247
  }
8151
8248
  );
8152
8249
  }
8153
- if (detachedReason === "another-project") {
8250
+ if (detachedHere === "another-project") {
8154
8251
  const otherName = projectNameFor(projects, detachedTenantId);
8155
8252
  return /* @__PURE__ */ jsxRuntime.jsx(
8156
8253
  ImpersonationBlocked,
@@ -8281,7 +8378,7 @@ var LoginHeader = ({
8281
8378
  }) => {
8282
8379
  const {
8283
8380
  config: { appLogoUrl }
8284
- } = chunkQN6HLQ67_cjs.useBlocksAppConfigStore((state) => state);
8381
+ } = chunkHBVSAOTQ_cjs.useBlocksAppConfigStore((state) => state);
8285
8382
  const resolveLogo = (variant) => {
8286
8383
  if (!appLogoUrl) return void 0;
8287
8384
  if (typeof appLogoUrl === "string") return appLogoUrl;
@@ -9546,10 +9643,10 @@ var BlocksLoginPage = ({
9546
9643
  ] });
9547
9644
  };
9548
9645
  var LoginPage = () => {
9549
- const config = chunkQN6HLQ67_cjs.useBlocksAppConfigStore((state) => state.getConfig());
9550
- const { start, isLoading } = chunkQN6HLQ67_cjs.useLogin();
9551
- const { canSignUp } = chunkQN6HLQ67_cjs.useSignUpAffordance();
9552
- const { start: startSignUp, isLoading: isSignUpLoading } = chunkQN6HLQ67_cjs.useSignUpRedirect();
9646
+ const config = chunkHBVSAOTQ_cjs.useBlocksAppConfigStore((state) => state.getConfig());
9647
+ const { start, isLoading } = chunkHBVSAOTQ_cjs.useLogin();
9648
+ const { canSignUp } = chunkHBVSAOTQ_cjs.useSignUpAffordance();
9649
+ const { start: startSignUp, isLoading: isSignUpLoading } = chunkHBVSAOTQ_cjs.useSignUpRedirect();
9553
9650
  return /* @__PURE__ */ jsxRuntime.jsx(
9554
9651
  BlocksLoginPage,
9555
9652
  {
@@ -9664,10 +9761,10 @@ var BentoCard = ({
9664
9761
  );
9665
9762
  var DefaultDoc = () => /* @__PURE__ */ jsxRuntime.jsx(BentoGrid, { children: resources.map((resource) => /* @__PURE__ */ jsxRuntime.jsx(BentoCard, { ...resource }, resource.url)) });
9666
9763
  function useCreateProjectRedirect() {
9667
- const { name } = chunkQN6HLQ67_cjs.useBlocksAppConfigStore((state) => state.config);
9764
+ const { name } = chunkHBVSAOTQ_cjs.useBlocksAppConfigStore((state) => state.config);
9668
9765
  const navigate = reactRouter.useNavigate();
9669
9766
  const osApp = filteredAppSwitcherData.find((app) => app.id === "blocks-os");
9670
- const { isFetching, isReady, redirect } = chunkQN6HLQ67_cjs.usePrefetchRedirect({
9767
+ const { isFetching, isReady, redirect } = chunkHBVSAOTQ_cjs.usePrefetchRedirect({
9671
9768
  clientId: osApp ? chunkX4YCRWXO_cjs.getRuntimeEnv(osApp.clientId) : "",
9672
9769
  redirectUri: osApp ? chunkX4YCRWXO_cjs.getRuntimeEnv(osApp.redirectUri) : "",
9673
9770
  forwardedTo: "/app/create-project",
@@ -9759,10 +9856,10 @@ function useProjectOverviewRedirect({
9759
9856
  tenantGroupId
9760
9857
  }) {
9761
9858
  const navigate = reactRouter.useNavigate();
9762
- const { name } = chunkQN6HLQ67_cjs.useBlocksAppConfigStore((state) => state.config);
9859
+ const { name } = chunkHBVSAOTQ_cjs.useBlocksAppConfigStore((state) => state.config);
9763
9860
  const osApp = filteredAppSwitcherData.find((app) => app.id === "blocks-os");
9764
9861
  const redirectedRoute = `/app/project/${tenantGroupId}/environments`;
9765
- const { isFetching, isReady, redirect } = chunkQN6HLQ67_cjs.usePrefetchRedirect({
9862
+ const { isFetching, isReady, redirect } = chunkHBVSAOTQ_cjs.usePrefetchRedirect({
9766
9863
  clientId: osApp ? chunkX4YCRWXO_cjs.getRuntimeEnv(osApp.clientId) : "",
9767
9864
  redirectUri: osApp ? chunkX4YCRWXO_cjs.getRuntimeEnv(osApp.redirectUri) : "",
9768
9865
  forwardedTo: redirectedRoute,
@@ -9828,6 +9925,8 @@ var ProjectActionButton = ({
9828
9925
  };
9829
9926
 
9830
9927
  // src/pages/console/project-list-utils.ts
9928
+ var MAX_OWNED_PROJECT_GROUPS = 10;
9929
+ var countOwnedProjectGroups = (groups) => groups.filter((group) => !group.isShared).length;
9831
9930
  var canOpenProject = (group) => !group.isShared || !group.accessPolicies || group.accessPolicies.length > 0;
9832
9931
  var getProjectGroupName = (group) => group.projects[0]?.name ?? "";
9833
9932
  var getLatestProjectUpdate = (group) => group.projects.reduce((latest, project) => {
@@ -10120,7 +10219,7 @@ function MultiSelect2({
10120
10219
  onChange,
10121
10220
  value: selectedValues
10122
10221
  }) {
10123
- const [buttonRef, popoverWidth] = chunkQN6HLQ67_cjs.usePopoverWidth();
10222
+ const [buttonRef, popoverWidth] = chunkHBVSAOTQ_cjs.usePopoverWidth();
10124
10223
  const onSelectHandler = (value) => {
10125
10224
  const nextValues = selectedValues.includes(value) ? selectedValues.filter((item) => item !== value) : [...selectedValues, value];
10126
10225
  onChange(nextValues);
@@ -10401,7 +10500,7 @@ var useProjectListState = (projectGroups) => {
10401
10500
  })),
10402
10501
  [projectGroups]
10403
10502
  );
10404
- const searchedGroups = chunkQN6HLQ67_cjs.useDebouncedFuseFilter(
10503
+ const searchedGroups = chunkHBVSAOTQ_cjs.useDebouncedFuseFilter(
10405
10504
  searchableGroups,
10406
10505
  searchText,
10407
10506
  SEARCH_OPTIONS
@@ -10471,7 +10570,7 @@ var SelfProjectLoading = ({ viewMode }) => {
10471
10570
  ) });
10472
10571
  };
10473
10572
  var SelfProject = ({ canCreateProject = false }) => {
10474
- const { data, isLoading, isFetching } = chunkQN6HLQ67_cjs.useGetProjects({ enabled: true });
10573
+ const { data, isLoading, isFetching } = chunkHBVSAOTQ_cjs.useGetProjects({ enabled: true });
10475
10574
  const isPending = isLoading || isFetching;
10476
10575
  const projectGroups = data || [];
10477
10576
  const {
@@ -10487,7 +10586,8 @@ var SelfProject = ({ canCreateProject = false }) => {
10487
10586
  } = useProjectListState(projectGroups);
10488
10587
  if (!isPending && !projectGroups.length && canCreateProject)
10489
10588
  return /* @__PURE__ */ jsxRuntime.jsx(ConsoleCreateProject, {});
10490
- const showAddProject = projectGroups.length < 10 && searchText.trim().length === 0;
10589
+ const hasReachedProjectLimit = countOwnedProjectGroups(projectGroups) >= MAX_OWNED_PROJECT_GROUPS;
10590
+ const showAddProject = !hasReachedProjectLimit && searchText.trim().length === 0;
10491
10591
  const hasNoMatches = projectGroups.length > 0 && visibleProjectGroups.length === 0;
10492
10592
  let projectsContent;
10493
10593
  if (isPending) {
@@ -10539,7 +10639,7 @@ var SelfProject = ({ canCreateProject = false }) => {
10539
10639
  /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "shrink-0 text-base font-semibold text-[hsl(var(--high-emphasis))]", children: "Your Blocks Projects" }),
10540
10640
  isPending ? /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { className: "h-5 w-8 rounded-full" }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "bg-primary/10 text-primary shrink-0 rounded-full px-2 py-0.5 text-xs font-semibold", children: projectGroups.length })
10541
10641
  ] }),
10542
- !isPending && canCreateProject && projectGroups.length > 9 && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-[hsl(var(--medium-emphasis))]", children: "Please delete an existing project to create a new one." })
10642
+ !isPending && canCreateProject && hasReachedProjectLimit && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-[hsl(var(--medium-emphasis))]", children: "Please delete an existing project to create a new one." })
10543
10643
  ] }),
10544
10644
  (isPending || projectGroups.length > 0) && /* @__PURE__ */ jsxRuntime.jsx(
10545
10645
  ProjectToolbar,
@@ -10629,7 +10729,7 @@ var CallbackPage = ({ defaultRedirectUrl }) => {
10629
10729
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex min-h-screen items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader, { className: "h-12 w-12 animate-spin text-gray-500" }) });
10630
10730
  };
10631
10731
  function ProfilePage() {
10632
- const { isLoading, error } = chunkQN6HLQ67_cjs.useInitiateRedirect({
10732
+ const { isLoading, error } = chunkHBVSAOTQ_cjs.useInitiateRedirect({
10633
10733
  clientId: chunkX4YCRWXO_cjs.getRuntimeEnv("BLOCKS_IAM_CLIENT_ID"),
10634
10734
  redirectUri: chunkX4YCRWXO_cjs.getRuntimeEnv("BLOCKS_IAM_CALLBACK_URL"),
10635
10735
  forwardedTo: "/app/profile"
@@ -10907,8 +11007,8 @@ var ConfirmationModal = ({
10907
11007
  ] })
10908
11008
  ] });
10909
11009
  var DashboardOverview = () => {
10910
- const { name } = chunkQN6HLQ67_cjs.useBlocksAppConfigStore((state) => state.config);
10911
- const { data, isFetching } = chunkQN6HLQ67_cjs.useGetProject();
11010
+ const { name } = chunkHBVSAOTQ_cjs.useBlocksAppConfigStore((state) => state.config);
11011
+ const { data, isFetching } = chunkHBVSAOTQ_cjs.useGetProject();
10912
11012
  const {
10913
11013
  endpoints,
10914
11014
  isLoading: isLoadingEndpoints,
@@ -11002,11 +11102,11 @@ function ProjectList2({
11002
11102
  }) {
11003
11103
  const navigate = reactRouter.useNavigate();
11004
11104
  const { pathname } = reactRouter.useLocation();
11005
- const { data: projectGroups = [], isLoading } = chunkQN6HLQ67_cjs.useGetProjects({
11105
+ const { data: projectGroups = [], isLoading } = chunkHBVSAOTQ_cjs.useGetProjects({
11006
11106
  enabled: true
11007
11107
  });
11008
11108
  const { selectedProject, setSelectedProject } = chunk6GCU5LM7_cjs.useProjectStore();
11009
- const { data: projectData } = chunkQN6HLQ67_cjs.useGetProject();
11109
+ const { data: projectData } = chunkHBVSAOTQ_cjs.useGetProject();
11010
11110
  const pendingProjectRef = React8.useRef(null);
11011
11111
  const redirectRegexMap = React8.useMemo(
11012
11112
  () => Object.entries(redirectPaths).reduce(
@@ -11155,7 +11255,7 @@ var SetCustomDomainDialog = ({
11155
11255
  projectKey,
11156
11256
  projectEnv
11157
11257
  }) => {
11158
- const { mutateAsync, isPending } = chunkQN6HLQ67_cjs.useUpdateRepositories();
11258
+ const { mutateAsync, isPending } = chunkHBVSAOTQ_cjs.useUpdateRepositories();
11159
11259
  const verifiedDomains = React8.useMemo(
11160
11260
  () => Array.from(
11161
11261
  new Set(domains.filter((d) => d.isDomainVerified).map((d) => d.domain))
@@ -11339,7 +11439,7 @@ var ProjectRepoList = ({
11339
11439
  data: envRepositoriesResponse,
11340
11440
  isLoading: isLoadingEnvRepos,
11341
11441
  isFetching: isFetchingEnvRepos
11342
- } = chunkQN6HLQ67_cjs.useGetEnvRepositories(project?.tenantId || "");
11442
+ } = chunkHBVSAOTQ_cjs.useGetEnvRepositories(project?.tenantId || "");
11343
11443
  if (isLoading || isLoadingEnvRepos || isFetchingEnvRepos) {
11344
11444
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-6 rounded-lg border bg-card px-2 py-2 shadow-sm md:mt-0", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid-col-1 grid gap-3 px-2 py-4 md:grid-cols-2 md:gap-4 lg:gap-6", children: ["sk-1", "sk-2", "sk-3", "sk-4", "sk-5", "sk-6"].map((itemKey) => /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
11345
11445
  /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { className: "h-5 w-1/2" }),
@@ -11439,7 +11539,7 @@ var EditProjectForm = ({
11439
11539
  onAfterSubmit
11440
11540
  }) => {
11441
11541
  const queryClient = reactQuery.useQueryClient();
11442
- const { mutateAsync, isPending } = chunkQN6HLQ67_cjs.useUpdateTenantGroup();
11542
+ const { mutateAsync, isPending } = chunkHBVSAOTQ_cjs.useUpdateTenantGroup();
11443
11543
  const form = reactHookForm.useForm({
11444
11544
  resolver: zod$1.zodResolver(editProjectFormSchema),
11445
11545
  defaultValues: {
@@ -11575,7 +11675,7 @@ function SidebarMobileView({
11575
11675
  navigationMenus
11576
11676
  }) {
11577
11677
  const [open, setOpen] = React8.useState(false);
11578
- const { appLightLogo, appDarkLogo } = chunkQN6HLQ67_cjs.useLogo();
11678
+ const { appLightLogo, appDarkLogo } = chunkHBVSAOTQ_cjs.useLogo();
11579
11679
  const allowedMenu = chunkBPJM3L7O_cjs.useFilteredMenus(navigationMenus);
11580
11680
  return /* @__PURE__ */ jsxRuntime.jsxs(Sheet, { open, onOpenChange: setOpen, children: [
11581
11681
  /* @__PURE__ */ jsxRuntime.jsx(SheetTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(Button, { variant: "outline", size: "icon", className: "shrink-0", children: [
@@ -11625,8 +11725,8 @@ function SidebarMenuDesktop({
11625
11725
  navigationMenus
11626
11726
  }) {
11627
11727
  const { isSidebarOpen, toggleSidebar } = React8.useContext(chunkIJMKS4XG_cjs.SidebarContext);
11628
- const { appLightLogo, appDarkLogo } = chunkQN6HLQ67_cjs.useLogo();
11629
- const icon = chunkQN6HLQ67_cjs.useIcon();
11728
+ const { appLightLogo, appDarkLogo } = chunkHBVSAOTQ_cjs.useLogo();
11729
+ const icon = chunkHBVSAOTQ_cjs.useIcon();
11630
11730
  const allowedMenu = chunkBPJM3L7O_cjs.useFilteredMenus(navigationMenus);
11631
11731
  const { isActivePath: isProjectOverviewRoute } = chunkBPJM3L7O_cjs.useIsActiveMenu("/app/project");
11632
11732
  return /* @__PURE__ */ jsxRuntime.jsxs(
@@ -11755,7 +11855,7 @@ var ErrorBoundary = class extends React8.Component {
11755
11855
  var ArchiveProject = () => {
11756
11856
  const navigate = reactRouter.useNavigate();
11757
11857
  const projectKey = chunk6GCU5LM7_cjs.useProjectStore().selectedProject?.tenantId || "";
11758
- const { mutateAsync, isPending } = chunkQN6HLQ67_cjs.useDisableProject({ projectKey });
11858
+ const { mutateAsync, isPending } = chunkHBVSAOTQ_cjs.useDisableProject({ projectKey });
11759
11859
  const onClickHandler = async () => {
11760
11860
  try {
11761
11861
  const res = await mutateAsync();
@@ -12725,7 +12825,7 @@ var ClearButton = ({ onClear }) => {
12725
12825
  };
12726
12826
  function Radio({ label, options, onChange, value }) {
12727
12827
  const [search, setSearch] = React8.useState("");
12728
- const [buttonRef, popoverWidth] = chunkQN6HLQ67_cjs.usePopoverWidth();
12828
+ const [buttonRef, popoverWidth] = chunkHBVSAOTQ_cjs.usePopoverWidth();
12729
12829
  const isMobile = chunkBPJM3L7O_cjs.useIsMobile();
12730
12830
  const selected = React8.useMemo(
12731
12831
  () => options.find((item) => item.value === value) || null,
@@ -13734,5 +13834,5 @@ exports.usePaginationQueryParams = usePaginationQueryParams;
13734
13834
  exports.useRightSidePanel = useRightSidePanel;
13735
13835
  exports.useSortQueryParams = useSortQueryParams;
13736
13836
  exports.useWizardStepper = useWizardStepper;
13737
- //# sourceMappingURL=chunk-OVQEP63V.cjs.map
13738
- //# sourceMappingURL=chunk-OVQEP63V.cjs.map
13837
+ //# sourceMappingURL=chunk-DXITHNQR.cjs.map
13838
+ //# sourceMappingURL=chunk-DXITHNQR.cjs.map