@trii/components 2.0.27 → 2.0.28

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 (30) hide show
  1. package/dist/cjs/index.js +2773 -100
  2. package/dist/cjs/index.js.map +1 -1
  3. package/dist/cjs/types/components/EditContactModal/EditContactModal.d.ts +3 -2
  4. package/dist/cjs/types/components/EditContactModal/components/Header/Header.d.ts +13 -2
  5. package/dist/cjs/types/components/EditContactModal/components/Header/components/AvatarWithActions/AvatarWithActions.d.ts +12 -0
  6. package/dist/cjs/types/components/EditContactModal/components/Header/components/Tags/Tags.d.ts +8 -0
  7. package/dist/cjs/types/components/EditContactModal/components/Header/components/Tags/index.d.ts +1 -0
  8. package/dist/cjs/types/components/EditContactModal/components/Header/components/index.d.ts +1 -0
  9. package/dist/cjs/types/components/EditContactModal/components/TagsEditor/TagsEditor.d.ts +12 -0
  10. package/dist/cjs/types/components/EditContactModal/hooks/useEditContactModalController.d.ts +9 -2
  11. package/dist/cjs/types/components/EditContactModal/hooks/useImage.d.ts +27 -0
  12. package/dist/cjs/types/components/EditContactModal/services/api.d.ts +46 -3
  13. package/dist/cjs/types/components/EditContactModal/services/http.d.ts +8 -0
  14. package/dist/cjs/types/components/EditContactModal/services/urls.d.ts +6 -0
  15. package/dist/esm/index.js +2775 -102
  16. package/dist/esm/index.js.map +1 -1
  17. package/dist/esm/types/components/EditContactModal/EditContactModal.d.ts +3 -2
  18. package/dist/esm/types/components/EditContactModal/components/Header/Header.d.ts +13 -2
  19. package/dist/esm/types/components/EditContactModal/components/Header/components/AvatarWithActions/AvatarWithActions.d.ts +12 -0
  20. package/dist/esm/types/components/EditContactModal/components/Header/components/Tags/Tags.d.ts +8 -0
  21. package/dist/esm/types/components/EditContactModal/components/Header/components/Tags/index.d.ts +1 -0
  22. package/dist/esm/types/components/EditContactModal/components/Header/components/index.d.ts +1 -0
  23. package/dist/esm/types/components/EditContactModal/components/TagsEditor/TagsEditor.d.ts +12 -0
  24. package/dist/esm/types/components/EditContactModal/hooks/useEditContactModalController.d.ts +9 -2
  25. package/dist/esm/types/components/EditContactModal/hooks/useImage.d.ts +27 -0
  26. package/dist/esm/types/components/EditContactModal/services/api.d.ts +46 -3
  27. package/dist/esm/types/components/EditContactModal/services/http.d.ts +8 -0
  28. package/dist/esm/types/components/EditContactModal/services/urls.d.ts +6 -0
  29. package/dist/index.d.ts +3 -2
  30. package/package.json +2 -2
package/dist/cjs/index.js CHANGED
@@ -1427,6 +1427,15 @@ if (process.env.NODE_ENV === 'production') {
1427
1427
 
1428
1428
  var jsxRuntimeExports = jsxRuntime.exports;
1429
1429
 
1430
+ function chainPropTypes(propType1, propType2) {
1431
+ if (process.env.NODE_ENV === 'production') {
1432
+ return () => null;
1433
+ }
1434
+ return function validate(...args) {
1435
+ return propType1(...args) || propType2(...args);
1436
+ };
1437
+ }
1438
+
1430
1439
  function _extends$1() {
1431
1440
  _extends$1 = Object.assign ? Object.assign.bind() : function (target) {
1432
1441
  for (var i = 1; i < arguments.length; i++) {
@@ -2672,6 +2681,45 @@ if (process.env.NODE_ENV !== 'production') {
2672
2681
  var propTypesExports = propTypes.exports;
2673
2682
  var PropTypes = /*@__PURE__*/getDefaultExportFromCjs(propTypesExports);
2674
2683
 
2684
+ function isClassComponent(elementType) {
2685
+ // elementType.prototype?.isReactComponent
2686
+ const {
2687
+ prototype = {}
2688
+ } = elementType;
2689
+ return Boolean(prototype.isReactComponent);
2690
+ }
2691
+ function elementTypeAcceptingRef(props, propName, componentName, location, propFullName) {
2692
+ const propValue = props[propName];
2693
+ const safePropName = propFullName || propName;
2694
+ if (propValue == null ||
2695
+ // When server-side rendering React doesn't warn either.
2696
+ // This is not an accurate check for SSR.
2697
+ // This is only in place for emotion compat.
2698
+ // TODO: Revisit once https://github.com/facebook/react/issues/20047 is resolved.
2699
+ typeof window === 'undefined') {
2700
+ return null;
2701
+ }
2702
+ let warningHint;
2703
+
2704
+ /**
2705
+ * Blacklisting instead of whitelisting
2706
+ *
2707
+ * Blacklisting will miss some components, such as React.Fragment. Those will at least
2708
+ * trigger a warning in React.
2709
+ * We can't whitelist because there is no safe way to detect React.forwardRef
2710
+ * or class components. "Safe" means there's no public API.
2711
+ *
2712
+ */
2713
+ if (typeof propValue === 'function' && !isClassComponent(propValue)) {
2714
+ warningHint = 'Did you accidentally provide a plain function component instead?';
2715
+ }
2716
+ if (warningHint !== undefined) {
2717
+ return new Error(`Invalid ${location} \`${safePropName}\` supplied to \`${componentName}\`. ` + `Expected an element type that can hold a ref. ${warningHint} ` + 'For more information see https://mui.com/r/caveat-with-refs-guide');
2718
+ }
2719
+ return null;
2720
+ }
2721
+ var elementTypeAcceptingRef$1 = chainPropTypes(PropTypes.elementType, elementTypeAcceptingRef);
2722
+
2675
2723
  /**
2676
2724
  * WARNING: Don't import this directly.
2677
2725
  * Use `MuiError` from `@mui/internal-babel-macros/MuiError.macro` instead.
@@ -3038,6 +3086,9 @@ var getDisplayName = /*#__PURE__*/Object.freeze({
3038
3086
  getFunctionName: getFunctionName
3039
3087
  });
3040
3088
 
3089
+ const refType = PropTypes.oneOfType([PropTypes.func, PropTypes.object]);
3090
+ var refType$1 = refType;
3091
+
3041
3092
  // It should to be noted that this function isn't equivalent to `text-transform: capitalize`.
3042
3093
  //
3043
3094
  // A strict capitalization should uppercase the first letter of each word in the sentence.
@@ -3290,6 +3341,34 @@ function useForkRef(...refs) {
3290
3341
  }, refs);
3291
3342
  }
3292
3343
 
3344
+ const UNINITIALIZED = {};
3345
+
3346
+ /**
3347
+ * A React.useRef() that is initialized lazily with a function. Note that it accepts an optional
3348
+ * initialization argument, so the initialization function doesn't need to be an inline closure.
3349
+ *
3350
+ * @usage
3351
+ * const ref = useLazyRef(sortColumns, columns)
3352
+ */
3353
+ function useLazyRef(init, initArg) {
3354
+ const ref = React__namespace.useRef(UNINITIALIZED);
3355
+ if (ref.current === UNINITIALIZED) {
3356
+ ref.current = init(initArg);
3357
+ }
3358
+ return ref;
3359
+ }
3360
+
3361
+ const EMPTY = [];
3362
+
3363
+ /**
3364
+ * A React.useEffect equivalent that runs once, when the component is mounted.
3365
+ */
3366
+ function useOnMount(fn) {
3367
+ /* eslint-disable react-hooks/exhaustive-deps */
3368
+ React__namespace.useEffect(fn, EMPTY);
3369
+ /* eslint-enable react-hooks/exhaustive-deps */
3370
+ }
3371
+
3293
3372
  class Timeout {
3294
3373
  constructor() {
3295
3374
  this.currentId = null;
@@ -3317,6 +3396,11 @@ class Timeout {
3317
3396
  }, delay);
3318
3397
  }
3319
3398
  }
3399
+ function useTimeout() {
3400
+ const timeout = useLazyRef(Timeout.create).current;
3401
+ useOnMount(timeout.disposeEffect);
3402
+ return timeout;
3403
+ }
3320
3404
 
3321
3405
  let hadKeyboardEvent = true;
3322
3406
  let hadFocusVisibleRecently = false;
@@ -5726,7 +5810,7 @@ var styledEngine = /*#__PURE__*/Object.freeze({
5726
5810
  keyframes: react.keyframes
5727
5811
  });
5728
5812
 
5729
- var require$$3 = /*@__PURE__*/getAugmentedNamespace(styledEngine);
5813
+ var require$$1$1 = /*@__PURE__*/getAugmentedNamespace(styledEngine);
5730
5814
 
5731
5815
  var require$$4 = /*@__PURE__*/getAugmentedNamespace(deepmerge);
5732
5816
 
@@ -5734,7 +5818,7 @@ var require$$5 = /*@__PURE__*/getAugmentedNamespace(capitalize);
5734
5818
 
5735
5819
  var require$$6 = /*@__PURE__*/getAugmentedNamespace(getDisplayName);
5736
5820
 
5737
- const _excluded$8 = ["values", "unit", "step"];
5821
+ const _excluded$d = ["values", "unit", "step"];
5738
5822
  const sortBreakpointsValues = values => {
5739
5823
  const breakpointsAsArray = Object.keys(values).map(key => ({
5740
5824
  key,
@@ -5768,7 +5852,7 @@ function createBreakpoints(breakpoints) {
5768
5852
  unit = 'px',
5769
5853
  step = 5
5770
5854
  } = breakpoints,
5771
- other = _objectWithoutPropertiesLoose(breakpoints, _excluded$8);
5855
+ other = _objectWithoutPropertiesLoose(breakpoints, _excluded$d);
5772
5856
  const sortedValues = sortBreakpointsValues(values);
5773
5857
  const keys = Object.keys(sortedValues);
5774
5858
  function up(key) {
@@ -5831,7 +5915,7 @@ function merge(acc, item) {
5831
5915
 
5832
5916
  // The breakpoint **start** at this value.
5833
5917
  // For instance with the first breakpoint xs: [xs, sm[.
5834
- const values = {
5918
+ const values$1 = {
5835
5919
  xs: 0,
5836
5920
  // phone
5837
5921
  sm: 600,
@@ -5846,7 +5930,7 @@ const defaultBreakpoints = {
5846
5930
  // Sorted ASC by size. That's important.
5847
5931
  // It can't be configured as it's used statically for propTypes.
5848
5932
  keys: ['xs', 'sm', 'md', 'lg', 'xl'],
5849
- up: key => `@media (min-width:${values[key]}px)`
5933
+ up: key => `@media (min-width:${values$1[key]}px)`
5850
5934
  };
5851
5935
  function handleBreakpoints(props, propValue, styleFromPropValue) {
5852
5936
  const theme = props.theme || {};
@@ -5861,7 +5945,7 @@ function handleBreakpoints(props, propValue, styleFromPropValue) {
5861
5945
  const themeBreakpoints = theme.breakpoints || defaultBreakpoints;
5862
5946
  return Object.keys(propValue).reduce((acc, breakpoint) => {
5863
5947
  // key is breakpoint
5864
- if (Object.keys(themeBreakpoints.values || values).indexOf(breakpoint) !== -1) {
5948
+ if (Object.keys(themeBreakpoints.values || values$1).indexOf(breakpoint) !== -1) {
5865
5949
  const mediaKey = themeBreakpoints.up(breakpoint);
5866
5950
  acc[mediaKey] = styleFromPropValue(propValue[breakpoint], breakpoint);
5867
5951
  } else {
@@ -6325,7 +6409,7 @@ const maxWidth = props => {
6325
6409
  if (props.maxWidth !== undefined && props.maxWidth !== null) {
6326
6410
  const styleFromPropValue = propValue => {
6327
6411
  var _props$theme, _props$theme2;
6328
- const breakpoint = ((_props$theme = props.theme) == null || (_props$theme = _props$theme.breakpoints) == null || (_props$theme = _props$theme.values) == null ? void 0 : _props$theme[propValue]) || values[propValue];
6412
+ const breakpoint = ((_props$theme = props.theme) == null || (_props$theme = _props$theme.breakpoints) == null || (_props$theme = _props$theme.values) == null ? void 0 : _props$theme[propValue]) || values$1[propValue];
6329
6413
  if (!breakpoint) {
6330
6414
  return {
6331
6415
  maxWidth: sizingTransform(propValue)
@@ -6868,7 +6952,7 @@ function applyStyles(key, styles) {
6868
6952
  return {};
6869
6953
  }
6870
6954
 
6871
- const _excluded$7 = ["breakpoints", "palette", "spacing", "shape"];
6955
+ const _excluded$c = ["breakpoints", "palette", "spacing", "shape"];
6872
6956
  function createTheme$2(options = {}, ...args) {
6873
6957
  const {
6874
6958
  breakpoints: breakpointsInput = {},
@@ -6876,7 +6960,7 @@ function createTheme$2(options = {}, ...args) {
6876
6960
  spacing: spacingInput,
6877
6961
  shape: shapeInput = {}
6878
6962
  } = options,
6879
- other = _objectWithoutPropertiesLoose(options, _excluded$7);
6963
+ other = _objectWithoutPropertiesLoose(options, _excluded$c);
6880
6964
  const breakpoints = createBreakpoints(breakpointsInput);
6881
6965
  const spacing = createSpacing(spacingInput);
6882
6966
  let muiTheme = deepmerge$1({
@@ -6911,7 +6995,7 @@ var createTheme$1 = /*#__PURE__*/Object.freeze({
6911
6995
 
6912
6996
  var require$$7 = /*@__PURE__*/getAugmentedNamespace(createTheme$1);
6913
6997
 
6914
- const _excluded$6 = ["sx"];
6998
+ const _excluded$b = ["sx"];
6915
6999
  const splitProps = props => {
6916
7000
  var _props$theme$unstable, _props$theme;
6917
7001
  const result = {
@@ -6932,7 +7016,7 @@ function extendSxProp(props) {
6932
7016
  const {
6933
7017
  sx: inSx
6934
7018
  } = props,
6935
- other = _objectWithoutPropertiesLoose(props, _excluded$6);
7019
+ other = _objectWithoutPropertiesLoose(props, _excluded$b);
6936
7020
  const {
6937
7021
  systemProps,
6938
7022
  otherProps
@@ -6966,22 +7050,22 @@ var styleFunctionSx = /*#__PURE__*/Object.freeze({
6966
7050
 
6967
7051
  var require$$8 = /*@__PURE__*/getAugmentedNamespace(styleFunctionSx);
6968
7052
 
6969
- var _interopRequireDefault$3 = interopRequireDefaultExports;
7053
+ var _interopRequireDefault$9 = interopRequireDefaultExports;
6970
7054
  Object.defineProperty(createStyled$2, "__esModule", {
6971
7055
  value: true
6972
7056
  });
6973
7057
  var _default = createStyled$2.default = createStyled;
6974
7058
  createStyled$2.shouldForwardProp = shouldForwardProp;
6975
7059
  createStyled$2.systemDefaultTheme = void 0;
6976
- var _extends2 = _interopRequireDefault$3(require_extends());
6977
- var _objectWithoutPropertiesLoose2 = _interopRequireDefault$3(requireObjectWithoutPropertiesLoose());
6978
- var _styledEngine = _interopRequireWildcard(require$$3);
7060
+ var _extends2 = _interopRequireDefault$9(require_extends());
7061
+ var _objectWithoutPropertiesLoose2 = _interopRequireDefault$9(requireObjectWithoutPropertiesLoose());
7062
+ var _styledEngine = _interopRequireWildcard(require$$1$1);
6979
7063
  var _deepmerge = require$$4;
6980
- var _capitalize = _interopRequireDefault$3(require$$5);
6981
- var _getDisplayName = _interopRequireDefault$3(require$$6);
6982
- var _createTheme = _interopRequireDefault$3(require$$7);
6983
- var _styleFunctionSx = _interopRequireDefault$3(require$$8);
6984
- const _excluded$5 = ["ownerState"],
7064
+ var _capitalize = _interopRequireDefault$9(require$$5);
7065
+ var _getDisplayName = _interopRequireDefault$9(require$$6);
7066
+ var _createTheme = _interopRequireDefault$9(require$$7);
7067
+ var _styleFunctionSx = _interopRequireDefault$9(require$$8);
7068
+ const _excluded$a = ["ownerState"],
6985
7069
  _excluded2 = ["variants"],
6986
7070
  _excluded3 = ["name", "slot", "skipVariantsResolver", "skipSx", "overridesResolver"];
6987
7071
  /* eslint-disable no-underscore-dangle */
@@ -7035,7 +7119,7 @@ function processStyleArg(callableStyle, _ref, layerName) {
7035
7119
  let {
7036
7120
  ownerState
7037
7121
  } = _ref,
7038
- props = (0, _objectWithoutPropertiesLoose2.default)(_ref, _excluded$5);
7122
+ props = (0, _objectWithoutPropertiesLoose2.default)(_ref, _excluded$a);
7039
7123
  const resolvedStylesArg = typeof callableStyle === 'function' ? callableStyle((0, _extends2.default)({
7040
7124
  ownerState
7041
7125
  }, props)) : callableStyle;
@@ -7250,11 +7334,11 @@ var require$$1 = /*@__PURE__*/getAugmentedNamespace(formatMuiErrorMessage);
7250
7334
 
7251
7335
  var require$$2 = /*@__PURE__*/getAugmentedNamespace(clamp);
7252
7336
 
7253
- var _interopRequireDefault$2 = interopRequireDefaultExports;
7337
+ var _interopRequireDefault$8 = interopRequireDefaultExports;
7254
7338
  Object.defineProperty(colorManipulator, "__esModule", {
7255
7339
  value: true
7256
7340
  });
7257
- colorManipulator.alpha = alpha;
7341
+ var alpha_1 = colorManipulator.alpha = alpha;
7258
7342
  colorManipulator.blend = blend;
7259
7343
  colorManipulator.colorChannel = void 0;
7260
7344
  var darken_1 = colorManipulator.darken = darken;
@@ -7272,8 +7356,8 @@ colorManipulator.private_safeEmphasize = private_safeEmphasize;
7272
7356
  colorManipulator.private_safeLighten = private_safeLighten;
7273
7357
  colorManipulator.recomposeColor = recomposeColor;
7274
7358
  colorManipulator.rgbToHex = rgbToHex;
7275
- var _formatMuiErrorMessage2 = _interopRequireDefault$2(require$$1);
7276
- var _clamp = _interopRequireDefault$2(require$$2);
7359
+ var _formatMuiErrorMessage2 = _interopRequireDefault$8(require$$1);
7360
+ var _clamp = _interopRequireDefault$8(require$$2);
7277
7361
  /* eslint-disable @typescript-eslint/naming-convention */
7278
7362
 
7279
7363
  /**
@@ -7753,7 +7837,7 @@ const green = {
7753
7837
  };
7754
7838
  var green$1 = green;
7755
7839
 
7756
- const _excluded$4 = ["mode", "contrastThreshold", "tonalOffset"];
7840
+ const _excluded$9 = ["mode", "contrastThreshold", "tonalOffset"];
7757
7841
  const light = {
7758
7842
  // The colors used to style the text.
7759
7843
  text: {
@@ -7922,7 +8006,7 @@ function createPalette(palette) {
7922
8006
  contrastThreshold = 3,
7923
8007
  tonalOffset = 0.2
7924
8008
  } = palette,
7925
- other = _objectWithoutPropertiesLoose(palette, _excluded$4);
8009
+ other = _objectWithoutPropertiesLoose(palette, _excluded$9);
7926
8010
  const primary = palette.primary || getDefaultPrimary(mode);
7927
8011
  const secondary = palette.secondary || getDefaultSecondary(mode);
7928
8012
  const error = palette.error || getDefaultError(mode);
@@ -8046,7 +8130,7 @@ const theme2 = createTheme({ palette: {
8046
8130
  return paletteOutput;
8047
8131
  }
8048
8132
 
8049
- const _excluded$3 = ["fontFamily", "fontSize", "fontWeightLight", "fontWeightRegular", "fontWeightMedium", "fontWeightBold", "htmlFontSize", "allVariants", "pxToRem"];
8133
+ const _excluded$8 = ["fontFamily", "fontSize", "fontWeightLight", "fontWeightRegular", "fontWeightMedium", "fontWeightBold", "htmlFontSize", "allVariants", "pxToRem"];
8050
8134
  function round(value) {
8051
8135
  return Math.round(value * 1e5) / 1e5;
8052
8136
  }
@@ -8077,7 +8161,7 @@ function createTypography(palette, typography) {
8077
8161
  allVariants,
8078
8162
  pxToRem: pxToRem2
8079
8163
  } = _ref,
8080
- other = _objectWithoutPropertiesLoose(_ref, _excluded$3);
8164
+ other = _objectWithoutPropertiesLoose(_ref, _excluded$8);
8081
8165
  if (process.env.NODE_ENV !== 'production') {
8082
8166
  if (typeof fontSize !== 'number') {
8083
8167
  console.error('MUI: `fontSize` is required to be a number.');
@@ -8145,7 +8229,7 @@ function createShadow(...px) {
8145
8229
  const shadows = ['none', createShadow(0, 2, 1, -1, 0, 1, 1, 0, 0, 1, 3, 0), createShadow(0, 3, 1, -2, 0, 2, 2, 0, 0, 1, 5, 0), createShadow(0, 3, 3, -2, 0, 3, 4, 0, 0, 1, 8, 0), createShadow(0, 2, 4, -1, 0, 4, 5, 0, 0, 1, 10, 0), createShadow(0, 3, 5, -1, 0, 5, 8, 0, 0, 1, 14, 0), createShadow(0, 3, 5, -1, 0, 6, 10, 0, 0, 1, 18, 0), createShadow(0, 4, 5, -2, 0, 7, 10, 1, 0, 2, 16, 1), createShadow(0, 5, 5, -3, 0, 8, 10, 1, 0, 3, 14, 2), createShadow(0, 5, 6, -3, 0, 9, 12, 1, 0, 3, 16, 2), createShadow(0, 6, 6, -3, 0, 10, 14, 1, 0, 4, 18, 3), createShadow(0, 6, 7, -4, 0, 11, 15, 1, 0, 4, 20, 3), createShadow(0, 7, 8, -4, 0, 12, 17, 2, 0, 5, 22, 4), createShadow(0, 7, 8, -4, 0, 13, 19, 2, 0, 5, 24, 4), createShadow(0, 7, 9, -4, 0, 14, 21, 2, 0, 5, 26, 4), createShadow(0, 8, 9, -5, 0, 15, 22, 2, 0, 6, 28, 5), createShadow(0, 8, 10, -5, 0, 16, 24, 2, 0, 6, 30, 5), createShadow(0, 8, 11, -5, 0, 17, 26, 2, 0, 6, 32, 5), createShadow(0, 9, 11, -5, 0, 18, 28, 2, 0, 7, 34, 6), createShadow(0, 9, 12, -6, 0, 19, 29, 2, 0, 7, 36, 6), createShadow(0, 10, 13, -6, 0, 20, 31, 3, 0, 8, 38, 7), createShadow(0, 10, 13, -6, 0, 21, 33, 3, 0, 8, 40, 7), createShadow(0, 10, 14, -6, 0, 22, 35, 3, 0, 8, 42, 7), createShadow(0, 11, 14, -7, 0, 23, 36, 3, 0, 9, 44, 8), createShadow(0, 11, 15, -7, 0, 24, 38, 3, 0, 9, 46, 8)];
8146
8230
  var shadows$1 = shadows;
8147
8231
 
8148
- const _excluded$2 = ["duration", "easing", "delay"];
8232
+ const _excluded$7 = ["duration", "easing", "delay"];
8149
8233
  // Follow https://material.google.com/motion/duration-easing.html#duration-easing-natural-easing-curves
8150
8234
  // to learn the context in which each easing should be used.
8151
8235
  const easing = {
@@ -8196,7 +8280,7 @@ function createTransitions(inputTransitions) {
8196
8280
  easing: easingOption = mergedEasing.easeInOut,
8197
8281
  delay = 0
8198
8282
  } = options,
8199
- other = _objectWithoutPropertiesLoose(options, _excluded$2);
8283
+ other = _objectWithoutPropertiesLoose(options, _excluded$7);
8200
8284
  if (process.env.NODE_ENV !== 'production') {
8201
8285
  const isString = value => typeof value === 'string';
8202
8286
  // IE11 support, replace with Number.isNaN
@@ -8246,7 +8330,7 @@ const zIndex = {
8246
8330
  };
8247
8331
  var zIndex$1 = zIndex;
8248
8332
 
8249
- const _excluded$1 = ["breakpoints", "mixins", "spacing", "palette", "transitions", "typography", "shape"];
8333
+ const _excluded$6 = ["breakpoints", "mixins", "spacing", "palette", "transitions", "typography", "shape"];
8250
8334
  function createTheme(options = {}, ...args) {
8251
8335
  const {
8252
8336
  mixins: mixinsInput = {},
@@ -8254,7 +8338,7 @@ function createTheme(options = {}, ...args) {
8254
8338
  transitions: transitionsInput = {},
8255
8339
  typography: typographyInput = {}
8256
8340
  } = options,
8257
- other = _objectWithoutPropertiesLoose(options, _excluded$1);
8341
+ other = _objectWithoutPropertiesLoose(options, _excluded$6);
8258
8342
  if (options.vars &&
8259
8343
  // The error should throw only for the root theme creation because user is not allowed to use a custom node `vars`.
8260
8344
  // `generateCssVars` is the closest identifier for checking that the `options` is a result of `extendTheme` with CSS variables so that user can create new theme for nested ThemeProvider.
@@ -8325,13 +8409,13 @@ function slotShouldForwardProp(prop) {
8325
8409
  return prop !== 'ownerState' && prop !== 'theme' && prop !== 'sx' && prop !== 'as';
8326
8410
  }
8327
8411
 
8328
- const rootShouldForwardProp = prop => slotShouldForwardProp(prop) && prop !== 'classes';
8329
- var rootShouldForwardProp$1 = rootShouldForwardProp;
8412
+ const rootShouldForwardProp$1 = prop => slotShouldForwardProp(prop) && prop !== 'classes';
8413
+ var rootShouldForwardProp$2 = rootShouldForwardProp$1;
8330
8414
 
8331
8415
  const styled = _default({
8332
8416
  themeId: THEME_ID,
8333
8417
  defaultTheme: defaultTheme$1,
8334
- rootShouldForwardProp: rootShouldForwardProp$1
8418
+ rootShouldForwardProp: rootShouldForwardProp$2
8335
8419
  });
8336
8420
  var styled$1 = styled;
8337
8421
 
@@ -8340,8 +8424,8 @@ function getSvgIconUtilityClass(slot) {
8340
8424
  }
8341
8425
  generateUtilityClasses('MuiSvgIcon', ['root', 'colorPrimary', 'colorSecondary', 'colorAction', 'colorError', 'colorDisabled', 'fontSizeInherit', 'fontSizeSmall', 'fontSizeMedium', 'fontSizeLarge']);
8342
8426
 
8343
- const _excluded = ["children", "className", "color", "component", "fontSize", "htmlColor", "inheritViewBox", "titleAccess", "viewBox"];
8344
- const useUtilityClasses = ownerState => {
8427
+ const _excluded$5 = ["children", "className", "color", "component", "fontSize", "htmlColor", "inheritViewBox", "titleAccess", "viewBox"];
8428
+ const useUtilityClasses$4 = ownerState => {
8345
8429
  const {
8346
8430
  color,
8347
8431
  fontSize,
@@ -8408,7 +8492,7 @@ const SvgIcon = /*#__PURE__*/React__namespace.forwardRef(function SvgIcon(inProp
8408
8492
  titleAccess,
8409
8493
  viewBox = '0 0 24 24'
8410
8494
  } = props,
8411
- other = _objectWithoutPropertiesLoose(props, _excluded);
8495
+ other = _objectWithoutPropertiesLoose(props, _excluded$5);
8412
8496
  const hasSvgAsChild = /*#__PURE__*/React__namespace.isValidElement(children) && children.type === 'svg';
8413
8497
  const ownerState = _extends$1({}, props, {
8414
8498
  color,
@@ -8423,7 +8507,7 @@ const SvgIcon = /*#__PURE__*/React__namespace.forwardRef(function SvgIcon(inProp
8423
8507
  if (!inheritViewBox) {
8424
8508
  more.viewBox = viewBox;
8425
8509
  }
8426
- const classes = useUtilityClasses(ownerState);
8510
+ const classes = useUtilityClasses$4(ownerState);
8427
8511
  return /*#__PURE__*/jsxRuntimeExports.jsxs(SvgIconRoot, _extends$1({
8428
8512
  as: component,
8429
8513
  className: clsx(classes.root, className),
@@ -8623,27 +8707,27 @@ function requireCreateSvgIcon () {
8623
8707
  return createSvgIcon;
8624
8708
  }
8625
8709
 
8626
- var _interopRequireDefault$1 = interopRequireDefaultExports;
8710
+ var _interopRequireDefault$7 = interopRequireDefaultExports;
8627
8711
  Object.defineProperty(ArrowForward, "__esModule", {
8628
8712
  value: true
8629
8713
  });
8630
- var default_1$1 = ArrowForward.default = void 0;
8631
- var _createSvgIcon$1 = _interopRequireDefault$1(requireCreateSvgIcon());
8632
- var _jsxRuntime$1 = jsxRuntimeExports;
8633
- default_1$1 = ArrowForward.default = (0, _createSvgIcon$1.default)( /*#__PURE__*/(0, _jsxRuntime$1.jsx)("path", {
8714
+ var default_1$7 = ArrowForward.default = void 0;
8715
+ var _createSvgIcon$7 = _interopRequireDefault$7(requireCreateSvgIcon());
8716
+ var _jsxRuntime$7 = jsxRuntimeExports;
8717
+ default_1$7 = ArrowForward.default = (0, _createSvgIcon$7.default)( /*#__PURE__*/(0, _jsxRuntime$7.jsx)("path", {
8634
8718
  d: "m12 4-1.41 1.41L16.17 11H4v2h12.17l-5.58 5.59L12 20l8-8z"
8635
8719
  }), 'ArrowForward');
8636
8720
 
8637
8721
  var Message = {};
8638
8722
 
8639
- var _interopRequireDefault = interopRequireDefaultExports;
8723
+ var _interopRequireDefault$6 = interopRequireDefaultExports;
8640
8724
  Object.defineProperty(Message, "__esModule", {
8641
8725
  value: true
8642
8726
  });
8643
- var default_1 = Message.default = void 0;
8644
- var _createSvgIcon = _interopRequireDefault(requireCreateSvgIcon());
8645
- var _jsxRuntime = jsxRuntimeExports;
8646
- default_1 = Message.default = (0, _createSvgIcon.default)( /*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
8727
+ var default_1$6 = Message.default = void 0;
8728
+ var _createSvgIcon$6 = _interopRequireDefault$6(requireCreateSvgIcon());
8729
+ var _jsxRuntime$6 = jsxRuntimeExports;
8730
+ default_1$6 = Message.default = (0, _createSvgIcon$6.default)( /*#__PURE__*/(0, _jsxRuntime$6.jsx)("path", {
8647
8731
  d: "M20 2H4c-1.1 0-1.99.9-1.99 2L2 22l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2m-2 12H6v-2h12zm0-3H6V9h12zm0-3H6V6h12z"
8648
8732
  }), 'Message');
8649
8733
 
@@ -8668,7 +8752,7 @@ const HeaderContainer$1 = material.styled(material.Box)({
8668
8752
  marginBottom: '16px',
8669
8753
  position: 'relative',
8670
8754
  });
8671
- const ContactAvatar$1 = material.styled(material.Avatar)({
8755
+ const ContactAvatar = material.styled(material.Avatar)({
8672
8756
  width: 60,
8673
8757
  height: 60,
8674
8758
  marginBottom: 8,
@@ -8723,7 +8807,7 @@ const Header$1 = ({ imgUrl, name, contactId, navigate, isLoading = false, onErro
8723
8807
  handleNavigateToContacts(e);
8724
8808
  onClose();
8725
8809
  }
8726
- }, disabled: !contactId, "aria-label": "View contact details", children: jsxRuntimeExports.jsx(default_1$1, { fontSize: "small" }) }), jsxRuntimeExports.jsx(SmallIconButton, { color: "info", size: "small", onClick: (e) => {
8810
+ }, disabled: !contactId, "aria-label": "View contact details", children: jsxRuntimeExports.jsx(default_1$7, { fontSize: "small" }) }), jsxRuntimeExports.jsx(SmallIconButton, { color: "info", size: "small", onClick: (e) => {
8727
8811
  handleNavigateToConversations(e);
8728
8812
  onClose();
8729
8813
  }, onMouseDown: (e) => {
@@ -8732,7 +8816,7 @@ const Header$1 = ({ imgUrl, name, contactId, navigate, isLoading = false, onErro
8732
8816
  handleNavigateToConversations(e);
8733
8817
  onClose();
8734
8818
  }
8735
- }, "aria-label": "Go to conversations", children: jsxRuntimeExports.jsx(default_1, { fontSize: "small" }) })] }), isLoading ? (jsxRuntimeExports.jsx(LoadingContainer, { children: jsxRuntimeExports.jsx(material.CircularProgress, { size: 24 }) })) : (jsxRuntimeExports.jsx(ContactAvatar$1, { src: imgUrl, alt: avatarAlt, onError: () => onError?.(new Error('Failed to load avatar')) })), jsxRuntimeExports.jsx(ContactName$1, { variant: "h6", title: displayName, children: displayName })] }));
8819
+ }, "aria-label": "Go to conversations", children: jsxRuntimeExports.jsx(default_1$6, { fontSize: "small" }) })] }), isLoading ? (jsxRuntimeExports.jsx(LoadingContainer, { children: jsxRuntimeExports.jsx(material.CircularProgress, { size: 24 }) })) : (jsxRuntimeExports.jsx(ContactAvatar, { src: imgUrl, alt: avatarAlt, onError: () => onError?.(new Error('Failed to load avatar')) })), jsxRuntimeExports.jsx(ContactName$1, { variant: "h6", title: displayName, children: displayName })] }));
8736
8820
  };
8737
8821
 
8738
8822
  const Container$1 = material.styled(material.Box)({
@@ -8797,6 +8881,12 @@ const ContactMethod = ({ icon, contactList, title, showTitle = true, }) => {
8797
8881
  return (jsxRuntimeExports.jsxs(Container$1, { children: [showTitle && (jsxRuntimeExports.jsx(TitleBox, { children: jsxRuntimeExports.jsx(material.Typography, { variant: "subtitle1", fontWeight: "bold", gutterBottom: true, mt: 2, children: title }) })), contactList?.map(renderContactInfo)] }));
8798
8882
  };
8799
8883
 
8884
+ var Contacts = {};
8885
+
8886
+ var contacts = {};
8887
+
8888
+ Object.defineProperty(contacts, "__esModule", { value: true });
8889
+ contacts.GoogleAccountInfo = contacts.GooglePeopleIntegration = contacts.IntegrationButton_format = contacts.IntegrationButton_method = contacts.ContactField_type = contacts.ContactOrigin = void 0;
8800
8890
  var ContactOrigin;
8801
8891
  (function (ContactOrigin) {
8802
8892
  ContactOrigin[ContactOrigin["MANUAL"] = 0] = "MANUAL";
@@ -8804,7 +8894,7 @@ var ContactOrigin;
8804
8894
  ContactOrigin[ContactOrigin["CALL"] = 2] = "CALL";
8805
8895
  ContactOrigin[ContactOrigin["TICKET"] = 3] = "TICKET";
8806
8896
  ContactOrigin[ContactOrigin["FORM"] = 4] = "FORM";
8807
- })(ContactOrigin || (ContactOrigin = {}));
8897
+ })(ContactOrigin || (contacts.ContactOrigin = ContactOrigin = {}));
8808
8898
  var ContactField_type;
8809
8899
  (function (ContactField_type) {
8810
8900
  ContactField_type[ContactField_type["TEXT"] = 0] = "TEXT";
@@ -8820,19 +8910,30 @@ var ContactField_type;
8820
8910
  ContactField_type[ContactField_type["NUMBER_DECIMAL"] = 22] = "NUMBER_DECIMAL";
8821
8911
  ContactField_type[ContactField_type["NUMBER_CURRENCY"] = 23] = "NUMBER_CURRENCY";
8822
8912
  ContactField_type[ContactField_type["NUMBER_ACCOUNTING"] = 24] = "NUMBER_ACCOUNTING";
8823
- })(ContactField_type || (ContactField_type = {}));
8913
+ })(ContactField_type || (contacts.ContactField_type = ContactField_type = {}));
8824
8914
  var IntegrationButton_method;
8825
8915
  (function (IntegrationButton_method) {
8826
8916
  IntegrationButton_method[IntegrationButton_method["GET"] = 1] = "GET";
8827
8917
  IntegrationButton_method[IntegrationButton_method["POST"] = 2] = "POST";
8828
- })(IntegrationButton_method || (IntegrationButton_method = {}));
8918
+ })(IntegrationButton_method || (contacts.IntegrationButton_method = IntegrationButton_method = {}));
8829
8919
  var IntegrationButton_format;
8830
8920
  (function (IntegrationButton_format) {
8831
8921
  IntegrationButton_format[IntegrationButton_format["JSON"] = 1] = "JSON";
8832
8922
  IntegrationButton_format[IntegrationButton_format["HTML"] = 2] = "HTML";
8833
8923
  IntegrationButton_format[IntegrationButton_format["HTML_newtab"] = 3] = "HTML_newtab";
8834
- })(IntegrationButton_format || (IntegrationButton_format = {}));
8924
+ })(IntegrationButton_format || (contacts.IntegrationButton_format = IntegrationButton_format = {}));
8925
+ class GooglePeopleIntegration {
8926
+ }
8927
+ contacts.GooglePeopleIntegration = GooglePeopleIntegration;
8928
+ class GoogleAccountInfo {
8929
+ }
8930
+ contacts.GoogleAccountInfo = GoogleAccountInfo;
8835
8931
 
8932
+ var segments = {};
8933
+
8934
+ Object.defineProperty(segments, "__esModule", { value: true });
8935
+ segments.Segment_Filter_Account = segments.Segment_Filter_Geography = segments.Segment_Filter_Details = segments.Segment_Filter_Operator = void 0;
8936
+ const contacts_1 = contacts;
8836
8937
  var Segment_Filter_Operator;
8837
8938
  (function (Segment_Filter_Operator) {
8838
8939
  Segment_Filter_Operator[Segment_Filter_Operator["NULL"] = 0] = "NULL";
@@ -8846,42 +8947,83 @@ var Segment_Filter_Operator;
8846
8947
  Segment_Filter_Operator[Segment_Filter_Operator["CONTAINS"] = 8] = "CONTAINS";
8847
8948
  Segment_Filter_Operator[Segment_Filter_Operator["NOT_CONTAINS"] = 9] = "NOT_CONTAINS";
8848
8949
  Segment_Filter_Operator[Segment_Filter_Operator["ANY_VALUE"] = 10] = "ANY_VALUE";
8849
- })(Segment_Filter_Operator || (Segment_Filter_Operator = {}));
8850
- [
8950
+ Segment_Filter_Operator[Segment_Filter_Operator["NOT_EQUAL"] = 11] = "NOT_EQUAL";
8951
+ })(Segment_Filter_Operator || (segments.Segment_Filter_Operator = Segment_Filter_Operator = {}));
8952
+ segments.Segment_Filter_Details = [
8851
8953
  {
8852
8954
  key: "details.name",
8853
- type: ContactField_type.TEXT
8955
+ type: contacts_1.ContactField_type.TEXT
8854
8956
  },
8855
8957
  {
8856
8958
  key: "details.email",
8857
- type: ContactField_type.TEXT
8959
+ type: contacts_1.ContactField_type.TEXT
8858
8960
  },
8859
8961
  ];
8860
- [
8962
+ segments.Segment_Filter_Geography = [
8861
8963
  {
8862
8964
  key: "geography.country",
8863
- type: ContactField_type.TEXT
8965
+ type: contacts_1.ContactField_type.TEXT
8864
8966
  },
8865
8967
  {
8866
8968
  key: "details.city",
8867
- type: ContactField_type.TEXT
8969
+ type: contacts_1.ContactField_type.TEXT
8868
8970
  }
8869
8971
  ];
8870
- [
8972
+ segments.Segment_Filter_Account = [
8871
8973
  {
8872
8974
  key: "account.name",
8873
- type: ContactField_type.TEXT
8975
+ type: contacts_1.ContactField_type.TEXT
8874
8976
  },
8875
8977
  {
8876
8978
  key: "account.email",
8877
- type: ContactField_type.TEXT
8979
+ type: contacts_1.ContactField_type.TEXT
8878
8980
  },
8879
8981
  {
8880
8982
  key: "account.numberOfEmployees",
8881
- type: ContactField_type.NUMBER_INTEGER
8983
+ type: contacts_1.ContactField_type.NUMBER_INTEGER
8882
8984
  }
8883
8985
  ];
8884
8986
 
8987
+ var Label$1 = {};
8988
+
8989
+ Object.defineProperty(Label$1, "__esModule", { value: true });
8990
+
8991
+ var Note = {};
8992
+
8993
+ Object.defineProperty(Note, "__esModule", { value: true });
8994
+
8995
+ var File = {};
8996
+
8997
+ Object.defineProperty(File, "__esModule", { value: true });
8998
+
8999
+ var Import = {};
9000
+
9001
+ Object.defineProperty(Import, "__esModule", { value: true });
9002
+
9003
+ (function (exports) {
9004
+ var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
9005
+ if (k2 === undefined) k2 = k;
9006
+ var desc = Object.getOwnPropertyDescriptor(m, k);
9007
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9008
+ desc = { enumerable: true, get: function() { return m[k]; } };
9009
+ }
9010
+ Object.defineProperty(o, k2, desc);
9011
+ }) : (function(o, m, k, k2) {
9012
+ if (k2 === undefined) k2 = k;
9013
+ o[k2] = m[k];
9014
+ }));
9015
+ var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m, exports) {
9016
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
9017
+ };
9018
+ Object.defineProperty(exports, "__esModule", { value: true });
9019
+ __exportStar(contacts, exports);
9020
+ __exportStar(segments, exports);
9021
+ __exportStar(Label$1, exports);
9022
+ __exportStar(Note, exports);
9023
+ __exportStar(File, exports);
9024
+ __exportStar(Import, exports);
9025
+ } (Contacts));
9026
+
8885
9027
  function commonjsRequire(path) {
8886
9028
  throw new Error('Could not dynamically require "' + path + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
8887
9029
  }
@@ -14610,24 +14752,24 @@ const Properties = ({ properties, title }) => {
14610
14752
  const isValidDate = moment(value, moment.ISO_8601).isValid();
14611
14753
  const format = (formatStr) => moment(value).format(formatStr);
14612
14754
  switch (type) {
14613
- case ContactField_type.TIME:
14755
+ case Contacts.ContactField_type.TIME:
14614
14756
  return isValidDate ? format('HH:mm') : value;
14615
- case ContactField_type.DATE:
14757
+ case Contacts.ContactField_type.DATE:
14616
14758
  return isValidDate ? format('DD/MM/YYYY') : value;
14617
- case ContactField_type.TIMERANGE:
14618
- case ContactField_type.DATERANGE:
14759
+ case Contacts.ContactField_type.TIMERANGE:
14760
+ case Contacts.ContactField_type.DATERANGE:
14619
14761
  if (isValidDate) {
14620
- return type === ContactField_type.TIMERANGE
14762
+ return type === Contacts.ContactField_type.TIMERANGE
14621
14763
  ? format('HH:mm')
14622
14764
  : format('DD/MM/YYYY');
14623
14765
  }
14624
14766
  const parts = value.split(' ');
14625
14767
  if (parts.length === 2) {
14626
14768
  const [start, end] = parts;
14627
- const startFormatted = type === ContactField_type.TIMERANGE
14769
+ const startFormatted = type === Contacts.ContactField_type.TIMERANGE
14628
14770
  ? moment(start).format('HH:mm')
14629
14771
  : moment(start).format('DD/MM/YYYY');
14630
- const endFormatted = type === ContactField_type.TIMERANGE
14772
+ const endFormatted = type === Contacts.ContactField_type.TIMERANGE
14631
14773
  ? moment(end).format('HH:mm')
14632
14774
  : moment(end).format('DD/MM/YYYY');
14633
14775
  return `${startFormatted} - ${endFormatted}`;
@@ -14851,6 +14993,142 @@ const ContactInfoPopup = ({ open, anchorEl, onClose, contactData, avatarImgUrl,
14851
14993
  return (jsxRuntimeExports.jsx(material.Popper, { sx: { zIndex: 1300 }, open: open, anchorEl: anchorEl, placement: "bottom-start", "data-popper-child": "true", children: jsxRuntimeExports.jsx(material.ClickAwayListener, { onClickAway: onClose, children: jsxRuntimeExports.jsx(PopupContainer, { children: jsxRuntimeExports.jsxs(material.CardContent, { children: [jsxRuntimeExports.jsx(Header$1, { navigate: navigate, contactId: contactData?.id, imgUrl: avatarImgUrl, name: contactData?.name, onClose: onClose, isBusiness: dataIsBusiness }), jsxRuntimeExports.jsx(LabelsSection, { contactData: contactData, title: t('labels') }), dataIsContact && (jsxRuntimeExports.jsx(BusinessSection, { contactData: contactData, title: t('business') })), dataIsBusiness && (jsxRuntimeExports.jsx(MembersSection, { contactData: contactData, title: t('businessMembers'), navigate: navigate })), contactMethods.map((method, index) => (jsxRuntimeExports.jsx(ContactMethod, { icon: method.icon, title: method.title, contactList: method.contactList, showTitle: method.showTitle }, index))), jsxRuntimeExports.jsx(Properties, { properties: contactData?.properties, title: t('properties') })] }) }) }) }));
14852
14994
  };
14853
14995
 
14996
+ var Edit = {};
14997
+
14998
+ var _interopRequireDefault$5 = interopRequireDefaultExports;
14999
+ Object.defineProperty(Edit, "__esModule", {
15000
+ value: true
15001
+ });
15002
+ var default_1$5 = Edit.default = void 0;
15003
+ var _createSvgIcon$5 = _interopRequireDefault$5(requireCreateSvgIcon());
15004
+ var _jsxRuntime$5 = jsxRuntimeExports;
15005
+ default_1$5 = Edit.default = (0, _createSvgIcon$5.default)( /*#__PURE__*/(0, _jsxRuntime$5.jsx)("path", {
15006
+ d: "M3 17.25V21h3.75L17.81 9.94l-3.75-3.75zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34a.9959.9959 0 0 0-1.41 0l-1.83 1.83 3.75 3.75z"
15007
+ }), 'Edit');
15008
+
15009
+ var Label = {};
15010
+
15011
+ var _interopRequireDefault$4 = interopRequireDefaultExports;
15012
+ Object.defineProperty(Label, "__esModule", {
15013
+ value: true
15014
+ });
15015
+ var default_1$4 = Label.default = void 0;
15016
+ var _createSvgIcon$4 = _interopRequireDefault$4(requireCreateSvgIcon());
15017
+ var _jsxRuntime$4 = jsxRuntimeExports;
15018
+ default_1$4 = Label.default = (0, _createSvgIcon$4.default)( /*#__PURE__*/(0, _jsxRuntime$4.jsx)("path", {
15019
+ d: "M17.63 5.84C17.27 5.33 16.67 5 16 5L5 5.01C3.9 5.01 3 5.9 3 7v10c0 1.1.9 1.99 2 1.99L16 19c.67 0 1.27-.33 1.63-.84L22 12z"
15020
+ }), 'Label');
15021
+
15022
+ const Tags = ({ tags, t, onEditTags }) => {
15023
+ const [anchorEl, setAnchorEl] = React.useState(null);
15024
+ const safeTags = React.useMemo(() => tags ?? [], [tags]);
15025
+ const MAX_VISIBLE = 4;
15026
+ const visibleTags = safeTags.slice(0, MAX_VISIBLE);
15027
+ const hiddenCount = Math.max(safeTags.length - visibleTags.length, 0);
15028
+ const handleOpen = (event) => {
15029
+ setAnchorEl(event.currentTarget);
15030
+ };
15031
+ const handleClose = () => {
15032
+ setAnchorEl(null);
15033
+ };
15034
+ const open = Boolean(anchorEl);
15035
+ return (jsxRuntimeExports.jsxs(material.Box, { sx: {
15036
+ width: '100%',
15037
+ mt: 1,
15038
+ position: 'relative',
15039
+ '&:hover .tags-action, &:focus-within .tags-action': {
15040
+ opacity: 1,
15041
+ },
15042
+ }, children: [jsxRuntimeExports.jsx(material.Box, { sx: { maxWidth: 320, mx: 'auto', pr: 4 }, children: jsxRuntimeExports.jsxs(material.Stack, { direction: "row", spacing: 1, useFlexGap: true, flexWrap: "wrap", justifyContent: "center", children: [visibleTags.map((tag) => (jsxRuntimeExports.jsx(material.Chip, { label: tag.name, size: "small", variant: "outlined", sx: {
15043
+ borderRadius: 999,
15044
+ maxWidth: 140,
15045
+ '& .MuiChip-label': {
15046
+ overflow: 'hidden',
15047
+ textOverflow: 'ellipsis',
15048
+ },
15049
+ } }, tag.id))), hiddenCount > 0 ? (jsxRuntimeExports.jsx(material.Chip, { label: `+${hiddenCount}`, size: "small", variant: "outlined", onClick: handleOpen, sx: { borderRadius: 999 } })) : null] }) }), jsxRuntimeExports.jsx(material.IconButton, { className: "tags-action", size: "small", "aria-label": safeTags.length ? t('tags.edit') : t('tags.add'), onClick: onEditTags, sx: {
15050
+ position: 'absolute',
15051
+ right: 0,
15052
+ top: '50%',
15053
+ transform: 'translateY(-50%)',
15054
+ opacity: 0,
15055
+ transition: 'opacity 0.2s ease-in-out',
15056
+ }, children: safeTags.length ? (jsxRuntimeExports.jsx(default_1$5, { fontSize: "small" })) : (jsxRuntimeExports.jsx(default_1$4, { fontSize: "small" })) }), jsxRuntimeExports.jsx(material.Popover, { open: open, anchorEl: anchorEl, onClose: handleClose, anchorOrigin: { vertical: 'bottom', horizontal: 'center' }, transformOrigin: { vertical: 'top', horizontal: 'center' }, children: jsxRuntimeExports.jsxs(material.Box, { sx: { p: 1.5, maxWidth: 320, maxHeight: 240, overflowY: 'auto' }, children: [jsxRuntimeExports.jsx(material.Typography, { variant: "subtitle2", sx: { mb: 1 }, children: t('tags') }), jsxRuntimeExports.jsx(material.Stack, { direction: "row", spacing: 1, useFlexGap: true, flexWrap: "wrap", children: safeTags.map((tag) => (jsxRuntimeExports.jsx(material.Chip, { label: tag.name, size: "small", variant: "outlined", sx: {
15057
+ borderRadius: 999,
15058
+ maxWidth: 160,
15059
+ '& .MuiChip-label': {
15060
+ overflow: 'hidden',
15061
+ textOverflow: 'ellipsis',
15062
+ },
15063
+ } }, tag.id))) })] }) })] }));
15064
+ };
15065
+
15066
+ var Delete = {};
15067
+
15068
+ var _interopRequireDefault$3 = interopRequireDefaultExports;
15069
+ Object.defineProperty(Delete, "__esModule", {
15070
+ value: true
15071
+ });
15072
+ var default_1$3 = Delete.default = void 0;
15073
+ var _createSvgIcon$3 = _interopRequireDefault$3(requireCreateSvgIcon());
15074
+ var _jsxRuntime$3 = jsxRuntimeExports;
15075
+ default_1$3 = Delete.default = (0, _createSvgIcon$3.default)( /*#__PURE__*/(0, _jsxRuntime$3.jsx)("path", {
15076
+ d: "M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6zM19 4h-3.5l-1-1h-5l-1 1H5v2h14z"
15077
+ }), 'Delete');
15078
+
15079
+ var PhotoCamera = {};
15080
+
15081
+ var _interopRequireDefault$2 = interopRequireDefaultExports;
15082
+ Object.defineProperty(PhotoCamera, "__esModule", {
15083
+ value: true
15084
+ });
15085
+ var default_1$2 = PhotoCamera.default = void 0;
15086
+ var _createSvgIcon$2 = _interopRequireDefault$2(requireCreateSvgIcon());
15087
+ var _jsxRuntime$2 = jsxRuntimeExports;
15088
+ default_1$2 = PhotoCamera.default = (0, _createSvgIcon$2.default)([/*#__PURE__*/(0, _jsxRuntime$2.jsx)("circle", {
15089
+ cx: "12",
15090
+ cy: "12",
15091
+ r: "3.2"
15092
+ }, "0"), /*#__PURE__*/(0, _jsxRuntime$2.jsx)("path", {
15093
+ d: "M9 2 7.17 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2h-3.17L15 2zm3 15c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5"
15094
+ }, "1")], 'PhotoCamera');
15095
+
15096
+ const AvatarWithActions = ({ src, alt, onError, onUpload, onDelete, isUploading, isDeleting, t, }) => {
15097
+ return (jsxRuntimeExports.jsxs(material.Box, { sx: {
15098
+ width: 60,
15099
+ height: 60,
15100
+ mb: 1,
15101
+ position: 'relative',
15102
+ '&:hover .avatar-actions, &:focus-within .avatar-actions': {
15103
+ opacity: 1,
15104
+ pointerEvents: 'auto',
15105
+ },
15106
+ }, children: [jsxRuntimeExports.jsx(material.Avatar, { src: src, alt: alt, onError: onError, sx: {
15107
+ width: 60,
15108
+ height: 60,
15109
+ } }), jsxRuntimeExports.jsxs(material.Box, { className: "avatar-actions", sx: {
15110
+ position: 'absolute',
15111
+ inset: 0,
15112
+ borderRadius: '50%',
15113
+ display: 'flex',
15114
+ alignItems: 'center',
15115
+ justifyContent: 'center',
15116
+ gap: 0.5,
15117
+ bgcolor: 'rgba(0, 0, 0, 0.35)',
15118
+ opacity: 0,
15119
+ pointerEvents: 'none',
15120
+ transition: 'opacity 0.2s ease-in-out',
15121
+ }, children: [jsxRuntimeExports.jsx(material.IconButton, { size: "small", "aria-label": t('avatar.upload'), onClick: onUpload, disabled: Boolean(isUploading), sx: {
15122
+ color: 'common.white',
15123
+ bgcolor: 'rgba(0, 0, 0, 0.25)',
15124
+ '&:hover': { bgcolor: 'rgba(0, 0, 0, 0.35)' },
15125
+ }, children: jsxRuntimeExports.jsx(default_1$2, { fontSize: "small" }) }), jsxRuntimeExports.jsx(material.IconButton, { size: "small", "aria-label": t('avatar.delete'), onClick: onDelete, disabled: Boolean(isDeleting), sx: {
15126
+ color: 'common.white',
15127
+ bgcolor: 'rgba(0, 0, 0, 0.25)',
15128
+ '&:hover': { bgcolor: 'rgba(0, 0, 0, 0.35)' },
15129
+ }, children: jsxRuntimeExports.jsx(default_1$3, { fontSize: "small" }) })] })] }));
15130
+ };
15131
+
14854
15132
  const HeaderContainer = material.styled(material.Box)({
14855
15133
  display: 'flex',
14856
15134
  flexDirection: 'column',
@@ -14858,11 +15136,6 @@ const HeaderContainer = material.styled(material.Box)({
14858
15136
  marginBottom: '16px',
14859
15137
  position: 'relative',
14860
15138
  });
14861
- const ContactAvatar = material.styled(material.Avatar)({
14862
- width: 60,
14863
- height: 60,
14864
- marginBottom: 8,
14865
- });
14866
15139
  const ContactName = material.styled(material.Typography)({
14867
15140
  whiteSpace: 'nowrap',
14868
15141
  overflow: 'hidden',
@@ -14870,9 +15143,9 @@ const ContactName = material.styled(material.Typography)({
14870
15143
  maxWidth: 200,
14871
15144
  textAlign: 'center',
14872
15145
  });
14873
- const Header = ({ imgUrl, displayName = 'Unknown Contact', onError, }) => {
15146
+ const Header = ({ imgUrl, displayName, onError, tags, t, onEditTags, onUploadPhoto, onPhotoFileChange, photoInputRef, isUploadingPhoto, onDeletePhoto, isDeletingPhoto, }) => {
14874
15147
  const avatarAlt = `Avatar for ${displayName}`;
14875
- return (jsxRuntimeExports.jsxs(HeaderContainer, { children: [jsxRuntimeExports.jsx(ContactAvatar, { src: imgUrl, alt: avatarAlt, onError: () => onError?.(new Error('Failed to load avatar')) }), jsxRuntimeExports.jsx(ContactName, { variant: "h6", title: displayName, children: displayName })] }));
15148
+ return (jsxRuntimeExports.jsxs(HeaderContainer, { children: [jsxRuntimeExports.jsx("input", { ref: photoInputRef, type: "file", accept: "image/*", onChange: onPhotoFileChange, style: { display: 'none' } }), jsxRuntimeExports.jsx(AvatarWithActions, { src: imgUrl, alt: avatarAlt, onError: () => onError?.(new Error('Failed to load avatar')), onUpload: onUploadPhoto, isUploading: isUploadingPhoto, onDelete: onDeletePhoto, isDeleting: isDeletingPhoto, t: t }), jsxRuntimeExports.jsx(ContactName, { variant: "h6", title: displayName, children: displayName }), jsxRuntimeExports.jsx(Tags, { tags: tags, t: t, onEditTags: onEditTags })] }));
14876
15149
  };
14877
15150
 
14878
15151
  class ApiError extends Error {
@@ -14906,16 +15179,79 @@ async function requestJson({ url, method = 'GET', headers, body, signal, }) {
14906
15179
  }
14907
15180
  return parsedBody;
14908
15181
  }
15182
+ async function requestFormData({ url, method = 'POST', headers, formData, signal, }) {
15183
+ const res = await globalThis.fetch(url, {
15184
+ method,
15185
+ headers: {
15186
+ ...(headers ?? {}),
15187
+ },
15188
+ body: formData,
15189
+ signal,
15190
+ });
15191
+ const contentType = res.headers.get('content-type') || '';
15192
+ const isJson = contentType.includes('application/json');
15193
+ const parsedBody = isJson ? await res.json().catch(() => null) : await res.text().catch(() => null);
15194
+ if (!res.ok) {
15195
+ const message = typeof parsedBody === 'object' && parsedBody && 'message' in parsedBody
15196
+ ? String(parsedBody.message)
15197
+ : `Request failed with status ${res.status}`;
15198
+ throw new ApiError(message, res.status, parsedBody);
15199
+ }
15200
+ return parsedBody;
15201
+ }
14909
15202
 
14910
15203
  function joinUrl(baseUrl, path) {
14911
15204
  const normalizedBase = baseUrl.endsWith('/') ? baseUrl.slice(0, -1) : baseUrl;
14912
15205
  const normalizedPath = path.startsWith('/') ? path : `/${path}`;
14913
15206
  return `${normalizedBase}${normalizedPath}`;
14914
15207
  }
14915
- async function fetchContact({ baseUrl, contactId, signal }) {
14916
- const url = joinUrl(baseUrl, `/contacts/${encodeURIComponent(contactId)}`);
15208
+ function getApiUrls(baseUrl, spaceId) {
15209
+ const encodedSpaceId = encodeURIComponent(spaceId);
15210
+ return {
15211
+ CONTACTS: joinUrl(baseUrl, `/contacts/${encodedSpaceId}`),
15212
+ MEDIA: joinUrl(baseUrl, `/media/${encodedSpaceId}`),
15213
+ SETTINGS: joinUrl(baseUrl, `/settings/${encodedSpaceId}`),
15214
+ };
15215
+ }
15216
+
15217
+ async function fetchLabels({ baseUrl, spaceId, signal }) {
15218
+ const urls = getApiUrls(baseUrl, spaceId);
15219
+ const url = joinUrl(urls.CONTACTS, '/labels');
15220
+ return requestJson({ url, signal });
15221
+ }
15222
+ async function fetchContact({ baseUrl, spaceId, contactId, signal }) {
15223
+ const urls = getApiUrls(baseUrl, spaceId);
15224
+ const url = joinUrl(urls.CONTACTS, `/${encodeURIComponent(contactId)}`);
15225
+ return requestJson({ url, signal });
15226
+ }
15227
+ async function updateEntity({ baseUrl, spaceId, entityType, entityId, body, signal }) {
15228
+ const path = entityType === 'business'
15229
+ ? `/business/${encodeURIComponent(entityId)}`
15230
+ : `/${encodeURIComponent(entityId)}`;
15231
+ const urls = getApiUrls(baseUrl, spaceId);
15232
+ const url = joinUrl(urls.CONTACTS, path);
15233
+ return requestJson({ url, method: 'PUT', body, signal });
15234
+ }
15235
+ async function deleteEntityPhoto({ baseUrl, spaceId, entityType, entityId, signal }) {
15236
+ const path = entityType === 'business'
15237
+ ? `/business/${encodeURIComponent(entityId)}/photo`
15238
+ : `/${encodeURIComponent(entityId)}/photo`;
15239
+ const urls = getApiUrls(baseUrl, spaceId);
15240
+ const url = joinUrl(urls.CONTACTS, path);
15241
+ return requestJson({ url, method: 'DELETE', signal });
15242
+ }
15243
+ async function fetchUserTrii({ baseUrl, spaceId, signal }) {
15244
+ const urls = getApiUrls(baseUrl, spaceId);
15245
+ const url = joinUrl(urls.SETTINGS, `/user`);
14917
15246
  return requestJson({ url, signal });
14918
15247
  }
15248
+ async function uploadAvatar({ baseUrl, spaceId, contactId, file, signal }) {
15249
+ const urls = getApiUrls(baseUrl, spaceId);
15250
+ const fd = new FormData();
15251
+ fd.append('file', file, file.name);
15252
+ const url = joinUrl(urls.MEDIA, `/upload?module=contacts&folderType=avatars&contactId=${encodeURIComponent(contactId)}`);
15253
+ return requestFormData({ url, formData: fd, signal });
15254
+ }
14919
15255
 
14920
15256
  /**
14921
15257
  * Type guard to check if an object is an IBusiness
@@ -14965,20 +15301,50 @@ function isContact(obj) {
14965
15301
  (!obj.businessId || typeof obj.businessId === 'string'));
14966
15302
  }
14967
15303
 
14968
- function useEditContactModalController({ open, baseUrl, contactId, }) {
15304
+ function useEditContactModalController({ open, baseUrl, spaceId, contactId, }) {
14969
15305
  const abortRef = React.useRef(null);
14970
15306
  const [state, setState] = React.useState({
14971
15307
  isLoading: false,
14972
15308
  error: null,
14973
15309
  contactData: null,
15310
+ labels: [],
15311
+ labelsLoading: false,
15312
+ labelsError: null,
14974
15313
  });
14975
- const canFetch = React.useMemo(() => Boolean(open && baseUrl && contactId), [open, baseUrl, contactId]);
15314
+ const canFetch = React.useMemo(() => Boolean(open && baseUrl && spaceId && contactId), [open, baseUrl, spaceId, contactId]);
14976
15315
  React.useEffect(() => {
14977
15316
  if (open)
14978
15317
  return;
14979
15318
  abortRef.current?.abort();
14980
- setState({ isLoading: false, error: null, contactData: null });
15319
+ setState({
15320
+ isLoading: false,
15321
+ error: null,
15322
+ contactData: null,
15323
+ labels: [],
15324
+ labelsLoading: false,
15325
+ labelsError: null,
15326
+ });
14981
15327
  }, [open]);
15328
+ const canFetchLabels = React.useMemo(() => Boolean(open && baseUrl && spaceId), [open, baseUrl, spaceId]);
15329
+ React.useEffect(() => {
15330
+ if (!canFetchLabels) {
15331
+ return;
15332
+ }
15333
+ const controller = new AbortController();
15334
+ setState((prev) => ({ ...prev, labelsLoading: true, labelsError: null }));
15335
+ fetchLabels({ baseUrl: baseUrl, spaceId: spaceId, signal: controller.signal })
15336
+ .then((labels) => {
15337
+ setState((prev) => ({ ...prev, labels, labelsLoading: false, labelsError: null }));
15338
+ })
15339
+ .catch((err) => {
15340
+ if (controller.signal.aborted)
15341
+ return;
15342
+ setState((prev) => ({ ...prev, labelsLoading: false, labelsError: err }));
15343
+ });
15344
+ return () => {
15345
+ controller.abort();
15346
+ };
15347
+ }, [canFetchLabels, baseUrl, spaceId]);
14982
15348
  React.useEffect(() => {
14983
15349
  if (!canFetch) {
14984
15350
  return;
@@ -14986,10 +15352,10 @@ function useEditContactModalController({ open, baseUrl, contactId, }) {
14986
15352
  abortRef.current?.abort();
14987
15353
  const controller = new AbortController();
14988
15354
  abortRef.current = controller;
14989
- setState({ isLoading: true, error: null, contactData: null });
14990
- fetchContact({ baseUrl: baseUrl, contactId: contactId, signal: controller.signal })
15355
+ setState((prev) => ({ ...prev, isLoading: true, error: null, contactData: null }));
15356
+ fetchContact({ baseUrl: baseUrl, spaceId: spaceId, contactId: contactId, signal: controller.signal })
14991
15357
  .then((data) => {
14992
- setState({ isLoading: false, error: null, contactData: data });
15358
+ setState((prev) => ({ ...prev, isLoading: false, error: null, contactData: data }));
14993
15359
  })
14994
15360
  .catch((err) => {
14995
15361
  if (controller.signal.aborted)
@@ -14999,7 +15365,7 @@ function useEditContactModalController({ open, baseUrl, contactId, }) {
14999
15365
  return () => {
15000
15366
  controller.abort();
15001
15367
  };
15002
- }, [canFetch, baseUrl, contactId]);
15368
+ }, [canFetch, baseUrl, spaceId, contactId]);
15003
15369
  const selectors = React.useMemo(() => {
15004
15370
  const contactData = state.contactData;
15005
15371
  const business = isBusiness(contactData);
@@ -15016,13 +15382,16 @@ function useEditContactModalController({ open, baseUrl, contactId, }) {
15016
15382
  else if (contact) {
15017
15383
  displayName = `${contactData.firstName} ${contactData.lastName}`.trim();
15018
15384
  }
15385
+ const tags = contactData?.tags ?? [];
15019
15386
  return {
15020
15387
  isBusiness: business,
15021
15388
  isContact: contact,
15022
15389
  contactType,
15023
15390
  displayName,
15391
+ tags,
15392
+ labels: state.labels,
15024
15393
  };
15025
- }, [state.contactData]);
15394
+ }, [state.contactData, state.labels]);
15026
15395
  return {
15027
15396
  state,
15028
15397
  selectors,
@@ -15033,14 +15402,2316 @@ function useEditContactModalController({ open, baseUrl, contactId, }) {
15033
15402
  };
15034
15403
  }
15035
15404
 
15036
- const EditContactModal = ({ open, onClose, baseUrl, contactId, sx,
15037
- // t
15038
- }) => {
15039
- const { state, selectors } = useEditContactModalController({
15040
- open,
15041
- baseUrl,
15042
- contactId,
15405
+ var ArrowBack = {};
15406
+
15407
+ var _interopRequireDefault$1 = interopRequireDefaultExports;
15408
+ Object.defineProperty(ArrowBack, "__esModule", {
15409
+ value: true
15410
+ });
15411
+ var default_1$1 = ArrowBack.default = void 0;
15412
+ var _createSvgIcon$1 = _interopRequireDefault$1(requireCreateSvgIcon());
15413
+ var _jsxRuntime$1 = jsxRuntimeExports;
15414
+ default_1$1 = ArrowBack.default = (0, _createSvgIcon$1.default)( /*#__PURE__*/(0, _jsxRuntime$1.jsx)("path", {
15415
+ d: "M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20z"
15416
+ }), 'ArrowBack');
15417
+
15418
+ var Save = {};
15419
+
15420
+ var _interopRequireDefault = interopRequireDefaultExports;
15421
+ Object.defineProperty(Save, "__esModule", {
15422
+ value: true
15423
+ });
15424
+ var default_1 = Save.default = void 0;
15425
+ var _createSvgIcon = _interopRequireDefault(requireCreateSvgIcon());
15426
+ var _jsxRuntime = jsxRuntimeExports;
15427
+ default_1 = Save.default = (0, _createSvgIcon.default)( /*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
15428
+ d: "M17 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V7zm-5 16c-1.66 0-3-1.34-3-3s1.34-3 3-3 3 1.34 3 3-1.34 3-3 3m3-10H5V5h10z"
15429
+ }), 'Save');
15430
+
15431
+ function _setPrototypeOf(o, p) {
15432
+ _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
15433
+ o.__proto__ = p;
15434
+ return o;
15435
+ };
15436
+ return _setPrototypeOf(o, p);
15437
+ }
15438
+
15439
+ function _inheritsLoose(subClass, superClass) {
15440
+ subClass.prototype = Object.create(superClass.prototype);
15441
+ subClass.prototype.constructor = subClass;
15442
+ _setPrototypeOf(subClass, superClass);
15443
+ }
15444
+
15445
+ var TransitionGroupContext = React.createContext(null);
15446
+
15447
+ function _assertThisInitialized(self) {
15448
+ if (self === void 0) {
15449
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
15450
+ }
15451
+ return self;
15452
+ }
15453
+
15454
+ /**
15455
+ * Given `this.props.children`, return an object mapping key to child.
15456
+ *
15457
+ * @param {*} children `this.props.children`
15458
+ * @return {object} Mapping of key to child
15459
+ */
15460
+
15461
+ function getChildMapping(children, mapFn) {
15462
+ var mapper = function mapper(child) {
15463
+ return mapFn && React.isValidElement(child) ? mapFn(child) : child;
15464
+ };
15465
+
15466
+ var result = Object.create(null);
15467
+ if (children) React.Children.map(children, function (c) {
15468
+ return c;
15469
+ }).forEach(function (child) {
15470
+ // run the map function here instead so that the key is the computed one
15471
+ result[child.key] = mapper(child);
15472
+ });
15473
+ return result;
15474
+ }
15475
+ /**
15476
+ * When you're adding or removing children some may be added or removed in the
15477
+ * same render pass. We want to show *both* since we want to simultaneously
15478
+ * animate elements in and out. This function takes a previous set of keys
15479
+ * and a new set of keys and merges them with its best guess of the correct
15480
+ * ordering. In the future we may expose some of the utilities in
15481
+ * ReactMultiChild to make this easy, but for now React itself does not
15482
+ * directly have this concept of the union of prevChildren and nextChildren
15483
+ * so we implement it here.
15484
+ *
15485
+ * @param {object} prev prev children as returned from
15486
+ * `ReactTransitionChildMapping.getChildMapping()`.
15487
+ * @param {object} next next children as returned from
15488
+ * `ReactTransitionChildMapping.getChildMapping()`.
15489
+ * @return {object} a key set that contains all keys in `prev` and all keys
15490
+ * in `next` in a reasonable order.
15491
+ */
15492
+
15493
+ function mergeChildMappings(prev, next) {
15494
+ prev = prev || {};
15495
+ next = next || {};
15496
+
15497
+ function getValueForKey(key) {
15498
+ return key in next ? next[key] : prev[key];
15499
+ } // For each key of `next`, the list of keys to insert before that key in
15500
+ // the combined list
15501
+
15502
+
15503
+ var nextKeysPending = Object.create(null);
15504
+ var pendingKeys = [];
15505
+
15506
+ for (var prevKey in prev) {
15507
+ if (prevKey in next) {
15508
+ if (pendingKeys.length) {
15509
+ nextKeysPending[prevKey] = pendingKeys;
15510
+ pendingKeys = [];
15511
+ }
15512
+ } else {
15513
+ pendingKeys.push(prevKey);
15514
+ }
15515
+ }
15516
+
15517
+ var i;
15518
+ var childMapping = {};
15519
+
15520
+ for (var nextKey in next) {
15521
+ if (nextKeysPending[nextKey]) {
15522
+ for (i = 0; i < nextKeysPending[nextKey].length; i++) {
15523
+ var pendingNextKey = nextKeysPending[nextKey][i];
15524
+ childMapping[nextKeysPending[nextKey][i]] = getValueForKey(pendingNextKey);
15525
+ }
15526
+ }
15527
+
15528
+ childMapping[nextKey] = getValueForKey(nextKey);
15529
+ } // Finally, add the keys which didn't appear before any key in `next`
15530
+
15531
+
15532
+ for (i = 0; i < pendingKeys.length; i++) {
15533
+ childMapping[pendingKeys[i]] = getValueForKey(pendingKeys[i]);
15534
+ }
15535
+
15536
+ return childMapping;
15537
+ }
15538
+
15539
+ function getProp(child, prop, props) {
15540
+ return props[prop] != null ? props[prop] : child.props[prop];
15541
+ }
15542
+
15543
+ function getInitialChildMapping(props, onExited) {
15544
+ return getChildMapping(props.children, function (child) {
15545
+ return React.cloneElement(child, {
15546
+ onExited: onExited.bind(null, child),
15547
+ in: true,
15548
+ appear: getProp(child, 'appear', props),
15549
+ enter: getProp(child, 'enter', props),
15550
+ exit: getProp(child, 'exit', props)
15551
+ });
15552
+ });
15553
+ }
15554
+ function getNextChildMapping(nextProps, prevChildMapping, onExited) {
15555
+ var nextChildMapping = getChildMapping(nextProps.children);
15556
+ var children = mergeChildMappings(prevChildMapping, nextChildMapping);
15557
+ Object.keys(children).forEach(function (key) {
15558
+ var child = children[key];
15559
+ if (!React.isValidElement(child)) return;
15560
+ var hasPrev = (key in prevChildMapping);
15561
+ var hasNext = (key in nextChildMapping);
15562
+ var prevChild = prevChildMapping[key];
15563
+ var isLeaving = React.isValidElement(prevChild) && !prevChild.props.in; // item is new (entering)
15564
+
15565
+ if (hasNext && (!hasPrev || isLeaving)) {
15566
+ // console.log('entering', key)
15567
+ children[key] = React.cloneElement(child, {
15568
+ onExited: onExited.bind(null, child),
15569
+ in: true,
15570
+ exit: getProp(child, 'exit', nextProps),
15571
+ enter: getProp(child, 'enter', nextProps)
15572
+ });
15573
+ } else if (!hasNext && hasPrev && !isLeaving) {
15574
+ // item is old (exiting)
15575
+ // console.log('leaving', key)
15576
+ children[key] = React.cloneElement(child, {
15577
+ in: false
15578
+ });
15579
+ } else if (hasNext && hasPrev && React.isValidElement(prevChild)) {
15580
+ // item hasn't changed transition states
15581
+ // copy over the last transition props;
15582
+ // console.log('unchanged', key)
15583
+ children[key] = React.cloneElement(child, {
15584
+ onExited: onExited.bind(null, child),
15585
+ in: prevChild.props.in,
15586
+ exit: getProp(child, 'exit', nextProps),
15587
+ enter: getProp(child, 'enter', nextProps)
15588
+ });
15589
+ }
15590
+ });
15591
+ return children;
15592
+ }
15593
+
15594
+ var values = Object.values || function (obj) {
15595
+ return Object.keys(obj).map(function (k) {
15596
+ return obj[k];
15597
+ });
15598
+ };
15599
+
15600
+ var defaultProps = {
15601
+ component: 'div',
15602
+ childFactory: function childFactory(child) {
15603
+ return child;
15604
+ }
15605
+ };
15606
+ /**
15607
+ * The `<TransitionGroup>` component manages a set of transition components
15608
+ * (`<Transition>` and `<CSSTransition>`) in a list. Like with the transition
15609
+ * components, `<TransitionGroup>` is a state machine for managing the mounting
15610
+ * and unmounting of components over time.
15611
+ *
15612
+ * Consider the example below. As items are removed or added to the TodoList the
15613
+ * `in` prop is toggled automatically by the `<TransitionGroup>`.
15614
+ *
15615
+ * Note that `<TransitionGroup>` does not define any animation behavior!
15616
+ * Exactly _how_ a list item animates is up to the individual transition
15617
+ * component. This means you can mix and match animations across different list
15618
+ * items.
15619
+ */
15620
+
15621
+ var TransitionGroup = /*#__PURE__*/function (_React$Component) {
15622
+ _inheritsLoose(TransitionGroup, _React$Component);
15623
+
15624
+ function TransitionGroup(props, context) {
15625
+ var _this;
15626
+
15627
+ _this = _React$Component.call(this, props, context) || this;
15628
+
15629
+ var handleExited = _this.handleExited.bind(_assertThisInitialized(_this)); // Initial children should all be entering, dependent on appear
15630
+
15631
+
15632
+ _this.state = {
15633
+ contextValue: {
15634
+ isMounting: true
15635
+ },
15636
+ handleExited: handleExited,
15637
+ firstRender: true
15638
+ };
15639
+ return _this;
15640
+ }
15641
+
15642
+ var _proto = TransitionGroup.prototype;
15643
+
15644
+ _proto.componentDidMount = function componentDidMount() {
15645
+ this.mounted = true;
15646
+ this.setState({
15647
+ contextValue: {
15648
+ isMounting: false
15649
+ }
15043
15650
  });
15651
+ };
15652
+
15653
+ _proto.componentWillUnmount = function componentWillUnmount() {
15654
+ this.mounted = false;
15655
+ };
15656
+
15657
+ TransitionGroup.getDerivedStateFromProps = function getDerivedStateFromProps(nextProps, _ref) {
15658
+ var prevChildMapping = _ref.children,
15659
+ handleExited = _ref.handleExited,
15660
+ firstRender = _ref.firstRender;
15661
+ return {
15662
+ children: firstRender ? getInitialChildMapping(nextProps, handleExited) : getNextChildMapping(nextProps, prevChildMapping, handleExited),
15663
+ firstRender: false
15664
+ };
15665
+ } // node is `undefined` when user provided `nodeRef` prop
15666
+ ;
15667
+
15668
+ _proto.handleExited = function handleExited(child, node) {
15669
+ var currentChildMapping = getChildMapping(this.props.children);
15670
+ if (child.key in currentChildMapping) return;
15671
+
15672
+ if (child.props.onExited) {
15673
+ child.props.onExited(node);
15674
+ }
15675
+
15676
+ if (this.mounted) {
15677
+ this.setState(function (state) {
15678
+ var children = _extends$1({}, state.children);
15679
+
15680
+ delete children[child.key];
15681
+ return {
15682
+ children: children
15683
+ };
15684
+ });
15685
+ }
15686
+ };
15687
+
15688
+ _proto.render = function render() {
15689
+ var _this$props = this.props,
15690
+ Component = _this$props.component,
15691
+ childFactory = _this$props.childFactory,
15692
+ props = _objectWithoutPropertiesLoose(_this$props, ["component", "childFactory"]);
15693
+
15694
+ var contextValue = this.state.contextValue;
15695
+ var children = values(this.state.children).map(childFactory);
15696
+ delete props.appear;
15697
+ delete props.enter;
15698
+ delete props.exit;
15699
+
15700
+ if (Component === null) {
15701
+ return /*#__PURE__*/React.createElement(TransitionGroupContext.Provider, {
15702
+ value: contextValue
15703
+ }, children);
15704
+ }
15705
+
15706
+ return /*#__PURE__*/React.createElement(TransitionGroupContext.Provider, {
15707
+ value: contextValue
15708
+ }, /*#__PURE__*/React.createElement(Component, props, children));
15709
+ };
15710
+
15711
+ return TransitionGroup;
15712
+ }(React.Component);
15713
+
15714
+ TransitionGroup.propTypes = process.env.NODE_ENV !== "production" ? {
15715
+ /**
15716
+ * `<TransitionGroup>` renders a `<div>` by default. You can change this
15717
+ * behavior by providing a `component` prop.
15718
+ * If you use React v16+ and would like to avoid a wrapping `<div>` element
15719
+ * you can pass in `component={null}`. This is useful if the wrapping div
15720
+ * borks your css styles.
15721
+ */
15722
+ component: PropTypes.any,
15723
+
15724
+ /**
15725
+ * A set of `<Transition>` components, that are toggled `in` and out as they
15726
+ * leave. the `<TransitionGroup>` will inject specific transition props, so
15727
+ * remember to spread them through if you are wrapping the `<Transition>` as
15728
+ * with our `<Fade>` example.
15729
+ *
15730
+ * While this component is meant for multiple `Transition` or `CSSTransition`
15731
+ * children, sometimes you may want to have a single transition child with
15732
+ * content that you want to be transitioned out and in when you change it
15733
+ * (e.g. routes, images etc.) In that case you can change the `key` prop of
15734
+ * the transition child as you change its content, this will cause
15735
+ * `TransitionGroup` to transition the child out and back in.
15736
+ */
15737
+ children: PropTypes.node,
15738
+
15739
+ /**
15740
+ * A convenience prop that enables or disables appear animations
15741
+ * for all children. Note that specifying this will override any defaults set
15742
+ * on individual children Transitions.
15743
+ */
15744
+ appear: PropTypes.bool,
15745
+
15746
+ /**
15747
+ * A convenience prop that enables or disables enter animations
15748
+ * for all children. Note that specifying this will override any defaults set
15749
+ * on individual children Transitions.
15750
+ */
15751
+ enter: PropTypes.bool,
15752
+
15753
+ /**
15754
+ * A convenience prop that enables or disables exit animations
15755
+ * for all children. Note that specifying this will override any defaults set
15756
+ * on individual children Transitions.
15757
+ */
15758
+ exit: PropTypes.bool,
15759
+
15760
+ /**
15761
+ * You may need to apply reactive updates to a child as it is exiting.
15762
+ * This is generally done by using `cloneElement` however in the case of an exiting
15763
+ * child the element has already been removed and not accessible to the consumer.
15764
+ *
15765
+ * If you do need to update a child as it leaves you can provide a `childFactory`
15766
+ * to wrap every child, even the ones that are leaving.
15767
+ *
15768
+ * @type Function(child: ReactElement) -> ReactElement
15769
+ */
15770
+ childFactory: PropTypes.func
15771
+ } : {};
15772
+ TransitionGroup.defaultProps = defaultProps;
15773
+ var TransitionGroup$1 = TransitionGroup;
15774
+
15775
+ function Ripple(props) {
15776
+ const {
15777
+ className,
15778
+ classes,
15779
+ pulsate = false,
15780
+ rippleX,
15781
+ rippleY,
15782
+ rippleSize,
15783
+ in: inProp,
15784
+ onExited,
15785
+ timeout
15786
+ } = props;
15787
+ const [leaving, setLeaving] = React__namespace.useState(false);
15788
+ const rippleClassName = clsx(className, classes.ripple, classes.rippleVisible, pulsate && classes.ripplePulsate);
15789
+ const rippleStyles = {
15790
+ width: rippleSize,
15791
+ height: rippleSize,
15792
+ top: -(rippleSize / 2) + rippleY,
15793
+ left: -(rippleSize / 2) + rippleX
15794
+ };
15795
+ const childClassName = clsx(classes.child, leaving && classes.childLeaving, pulsate && classes.childPulsate);
15796
+ if (!inProp && !leaving) {
15797
+ setLeaving(true);
15798
+ }
15799
+ React__namespace.useEffect(() => {
15800
+ if (!inProp && onExited != null) {
15801
+ // react-transition-group#onExited
15802
+ const timeoutId = setTimeout(onExited, timeout);
15803
+ return () => {
15804
+ clearTimeout(timeoutId);
15805
+ };
15806
+ }
15807
+ return undefined;
15808
+ }, [onExited, inProp, timeout]);
15809
+ return /*#__PURE__*/jsxRuntimeExports.jsx("span", {
15810
+ className: rippleClassName,
15811
+ style: rippleStyles,
15812
+ children: /*#__PURE__*/jsxRuntimeExports.jsx("span", {
15813
+ className: childClassName
15814
+ })
15815
+ });
15816
+ }
15817
+ process.env.NODE_ENV !== "production" ? Ripple.propTypes = {
15818
+ /**
15819
+ * Override or extend the styles applied to the component.
15820
+ */
15821
+ classes: PropTypes.object.isRequired,
15822
+ className: PropTypes.string,
15823
+ /**
15824
+ * @ignore - injected from TransitionGroup
15825
+ */
15826
+ in: PropTypes.bool,
15827
+ /**
15828
+ * @ignore - injected from TransitionGroup
15829
+ */
15830
+ onExited: PropTypes.func,
15831
+ /**
15832
+ * If `true`, the ripple pulsates, typically indicating the keyboard focus state of an element.
15833
+ */
15834
+ pulsate: PropTypes.bool,
15835
+ /**
15836
+ * Diameter of the ripple.
15837
+ */
15838
+ rippleSize: PropTypes.number,
15839
+ /**
15840
+ * Horizontal position of the ripple center.
15841
+ */
15842
+ rippleX: PropTypes.number,
15843
+ /**
15844
+ * Vertical position of the ripple center.
15845
+ */
15846
+ rippleY: PropTypes.number,
15847
+ /**
15848
+ * exit delay
15849
+ */
15850
+ timeout: PropTypes.number.isRequired
15851
+ } : void 0;
15852
+
15853
+ const touchRippleClasses = generateUtilityClasses('MuiTouchRipple', ['root', 'ripple', 'rippleVisible', 'ripplePulsate', 'child', 'childLeaving', 'childPulsate']);
15854
+ var touchRippleClasses$1 = touchRippleClasses;
15855
+
15856
+ const _excluded$4 = ["center", "classes", "className"];
15857
+ let _$1 = t => t,
15858
+ _t$1,
15859
+ _t2$1,
15860
+ _t3$1,
15861
+ _t4$1;
15862
+ const DURATION = 550;
15863
+ const DELAY_RIPPLE = 80;
15864
+ const enterKeyframe = react.keyframes(_t$1 || (_t$1 = _$1`
15865
+ 0% {
15866
+ transform: scale(0);
15867
+ opacity: 0.1;
15868
+ }
15869
+
15870
+ 100% {
15871
+ transform: scale(1);
15872
+ opacity: 0.3;
15873
+ }
15874
+ `));
15875
+ const exitKeyframe = react.keyframes(_t2$1 || (_t2$1 = _$1`
15876
+ 0% {
15877
+ opacity: 1;
15878
+ }
15879
+
15880
+ 100% {
15881
+ opacity: 0;
15882
+ }
15883
+ `));
15884
+ const pulsateKeyframe = react.keyframes(_t3$1 || (_t3$1 = _$1`
15885
+ 0% {
15886
+ transform: scale(1);
15887
+ }
15888
+
15889
+ 50% {
15890
+ transform: scale(0.92);
15891
+ }
15892
+
15893
+ 100% {
15894
+ transform: scale(1);
15895
+ }
15896
+ `));
15897
+ const TouchRippleRoot = styled$1('span', {
15898
+ name: 'MuiTouchRipple',
15899
+ slot: 'Root'
15900
+ })({
15901
+ overflow: 'hidden',
15902
+ pointerEvents: 'none',
15903
+ position: 'absolute',
15904
+ zIndex: 0,
15905
+ top: 0,
15906
+ right: 0,
15907
+ bottom: 0,
15908
+ left: 0,
15909
+ borderRadius: 'inherit'
15910
+ });
15911
+
15912
+ // This `styled()` function invokes keyframes. `styled-components` only supports keyframes
15913
+ // in string templates. Do not convert these styles in JS object as it will break.
15914
+ const TouchRippleRipple = styled$1(Ripple, {
15915
+ name: 'MuiTouchRipple',
15916
+ slot: 'Ripple'
15917
+ })(_t4$1 || (_t4$1 = _$1`
15918
+ opacity: 0;
15919
+ position: absolute;
15920
+
15921
+ &.${0} {
15922
+ opacity: 0.3;
15923
+ transform: scale(1);
15924
+ animation-name: ${0};
15925
+ animation-duration: ${0}ms;
15926
+ animation-timing-function: ${0};
15927
+ }
15928
+
15929
+ &.${0} {
15930
+ animation-duration: ${0}ms;
15931
+ }
15932
+
15933
+ & .${0} {
15934
+ opacity: 1;
15935
+ display: block;
15936
+ width: 100%;
15937
+ height: 100%;
15938
+ border-radius: 50%;
15939
+ background-color: currentColor;
15940
+ }
15941
+
15942
+ & .${0} {
15943
+ opacity: 0;
15944
+ animation-name: ${0};
15945
+ animation-duration: ${0}ms;
15946
+ animation-timing-function: ${0};
15947
+ }
15948
+
15949
+ & .${0} {
15950
+ position: absolute;
15951
+ /* @noflip */
15952
+ left: 0px;
15953
+ top: 0;
15954
+ animation-name: ${0};
15955
+ animation-duration: 2500ms;
15956
+ animation-timing-function: ${0};
15957
+ animation-iteration-count: infinite;
15958
+ animation-delay: 200ms;
15959
+ }
15960
+ `), touchRippleClasses$1.rippleVisible, enterKeyframe, DURATION, ({
15961
+ theme
15962
+ }) => theme.transitions.easing.easeInOut, touchRippleClasses$1.ripplePulsate, ({
15963
+ theme
15964
+ }) => theme.transitions.duration.shorter, touchRippleClasses$1.child, touchRippleClasses$1.childLeaving, exitKeyframe, DURATION, ({
15965
+ theme
15966
+ }) => theme.transitions.easing.easeInOut, touchRippleClasses$1.childPulsate, pulsateKeyframe, ({
15967
+ theme
15968
+ }) => theme.transitions.easing.easeInOut);
15969
+
15970
+ /**
15971
+ * @ignore - internal component.
15972
+ *
15973
+ * TODO v5: Make private
15974
+ */
15975
+ const TouchRipple = /*#__PURE__*/React__namespace.forwardRef(function TouchRipple(inProps, ref) {
15976
+ const props = useDefaultProps({
15977
+ props: inProps,
15978
+ name: 'MuiTouchRipple'
15979
+ });
15980
+ const {
15981
+ center: centerProp = false,
15982
+ classes = {},
15983
+ className
15984
+ } = props,
15985
+ other = _objectWithoutPropertiesLoose(props, _excluded$4);
15986
+ const [ripples, setRipples] = React__namespace.useState([]);
15987
+ const nextKey = React__namespace.useRef(0);
15988
+ const rippleCallback = React__namespace.useRef(null);
15989
+ React__namespace.useEffect(() => {
15990
+ if (rippleCallback.current) {
15991
+ rippleCallback.current();
15992
+ rippleCallback.current = null;
15993
+ }
15994
+ }, [ripples]);
15995
+
15996
+ // Used to filter out mouse emulated events on mobile.
15997
+ const ignoringMouseDown = React__namespace.useRef(false);
15998
+ // We use a timer in order to only show the ripples for touch "click" like events.
15999
+ // We don't want to display the ripple for touch scroll events.
16000
+ const startTimer = useTimeout();
16001
+
16002
+ // This is the hook called once the previous timeout is ready.
16003
+ const startTimerCommit = React__namespace.useRef(null);
16004
+ const container = React__namespace.useRef(null);
16005
+ const startCommit = React__namespace.useCallback(params => {
16006
+ const {
16007
+ pulsate,
16008
+ rippleX,
16009
+ rippleY,
16010
+ rippleSize,
16011
+ cb
16012
+ } = params;
16013
+ setRipples(oldRipples => [...oldRipples, /*#__PURE__*/jsxRuntimeExports.jsx(TouchRippleRipple, {
16014
+ classes: {
16015
+ ripple: clsx(classes.ripple, touchRippleClasses$1.ripple),
16016
+ rippleVisible: clsx(classes.rippleVisible, touchRippleClasses$1.rippleVisible),
16017
+ ripplePulsate: clsx(classes.ripplePulsate, touchRippleClasses$1.ripplePulsate),
16018
+ child: clsx(classes.child, touchRippleClasses$1.child),
16019
+ childLeaving: clsx(classes.childLeaving, touchRippleClasses$1.childLeaving),
16020
+ childPulsate: clsx(classes.childPulsate, touchRippleClasses$1.childPulsate)
16021
+ },
16022
+ timeout: DURATION,
16023
+ pulsate: pulsate,
16024
+ rippleX: rippleX,
16025
+ rippleY: rippleY,
16026
+ rippleSize: rippleSize
16027
+ }, nextKey.current)]);
16028
+ nextKey.current += 1;
16029
+ rippleCallback.current = cb;
16030
+ }, [classes]);
16031
+ const start = React__namespace.useCallback((event = {}, options = {}, cb = () => {}) => {
16032
+ const {
16033
+ pulsate = false,
16034
+ center = centerProp || options.pulsate,
16035
+ fakeElement = false // For test purposes
16036
+ } = options;
16037
+ if ((event == null ? void 0 : event.type) === 'mousedown' && ignoringMouseDown.current) {
16038
+ ignoringMouseDown.current = false;
16039
+ return;
16040
+ }
16041
+ if ((event == null ? void 0 : event.type) === 'touchstart') {
16042
+ ignoringMouseDown.current = true;
16043
+ }
16044
+ const element = fakeElement ? null : container.current;
16045
+ const rect = element ? element.getBoundingClientRect() : {
16046
+ width: 0,
16047
+ height: 0,
16048
+ left: 0,
16049
+ top: 0
16050
+ };
16051
+
16052
+ // Get the size of the ripple
16053
+ let rippleX;
16054
+ let rippleY;
16055
+ let rippleSize;
16056
+ if (center || event === undefined || event.clientX === 0 && event.clientY === 0 || !event.clientX && !event.touches) {
16057
+ rippleX = Math.round(rect.width / 2);
16058
+ rippleY = Math.round(rect.height / 2);
16059
+ } else {
16060
+ const {
16061
+ clientX,
16062
+ clientY
16063
+ } = event.touches && event.touches.length > 0 ? event.touches[0] : event;
16064
+ rippleX = Math.round(clientX - rect.left);
16065
+ rippleY = Math.round(clientY - rect.top);
16066
+ }
16067
+ if (center) {
16068
+ rippleSize = Math.sqrt((2 * rect.width ** 2 + rect.height ** 2) / 3);
16069
+
16070
+ // For some reason the animation is broken on Mobile Chrome if the size is even.
16071
+ if (rippleSize % 2 === 0) {
16072
+ rippleSize += 1;
16073
+ }
16074
+ } else {
16075
+ const sizeX = Math.max(Math.abs((element ? element.clientWidth : 0) - rippleX), rippleX) * 2 + 2;
16076
+ const sizeY = Math.max(Math.abs((element ? element.clientHeight : 0) - rippleY), rippleY) * 2 + 2;
16077
+ rippleSize = Math.sqrt(sizeX ** 2 + sizeY ** 2);
16078
+ }
16079
+
16080
+ // Touche devices
16081
+ if (event != null && event.touches) {
16082
+ // check that this isn't another touchstart due to multitouch
16083
+ // otherwise we will only clear a single timer when unmounting while two
16084
+ // are running
16085
+ if (startTimerCommit.current === null) {
16086
+ // Prepare the ripple effect.
16087
+ startTimerCommit.current = () => {
16088
+ startCommit({
16089
+ pulsate,
16090
+ rippleX,
16091
+ rippleY,
16092
+ rippleSize,
16093
+ cb
16094
+ });
16095
+ };
16096
+ // Delay the execution of the ripple effect.
16097
+ // We have to make a tradeoff with this delay value.
16098
+ startTimer.start(DELAY_RIPPLE, () => {
16099
+ if (startTimerCommit.current) {
16100
+ startTimerCommit.current();
16101
+ startTimerCommit.current = null;
16102
+ }
16103
+ });
16104
+ }
16105
+ } else {
16106
+ startCommit({
16107
+ pulsate,
16108
+ rippleX,
16109
+ rippleY,
16110
+ rippleSize,
16111
+ cb
16112
+ });
16113
+ }
16114
+ }, [centerProp, startCommit, startTimer]);
16115
+ const pulsate = React__namespace.useCallback(() => {
16116
+ start({}, {
16117
+ pulsate: true
16118
+ });
16119
+ }, [start]);
16120
+ const stop = React__namespace.useCallback((event, cb) => {
16121
+ startTimer.clear();
16122
+
16123
+ // The touch interaction occurs too quickly.
16124
+ // We still want to show ripple effect.
16125
+ if ((event == null ? void 0 : event.type) === 'touchend' && startTimerCommit.current) {
16126
+ startTimerCommit.current();
16127
+ startTimerCommit.current = null;
16128
+ startTimer.start(0, () => {
16129
+ stop(event, cb);
16130
+ });
16131
+ return;
16132
+ }
16133
+ startTimerCommit.current = null;
16134
+ setRipples(oldRipples => {
16135
+ if (oldRipples.length > 0) {
16136
+ return oldRipples.slice(1);
16137
+ }
16138
+ return oldRipples;
16139
+ });
16140
+ rippleCallback.current = cb;
16141
+ }, [startTimer]);
16142
+ React__namespace.useImperativeHandle(ref, () => ({
16143
+ pulsate,
16144
+ start,
16145
+ stop
16146
+ }), [pulsate, start, stop]);
16147
+ return /*#__PURE__*/jsxRuntimeExports.jsx(TouchRippleRoot, _extends$1({
16148
+ className: clsx(touchRippleClasses$1.root, classes.root, className),
16149
+ ref: container
16150
+ }, other, {
16151
+ children: /*#__PURE__*/jsxRuntimeExports.jsx(TransitionGroup$1, {
16152
+ component: null,
16153
+ exit: true,
16154
+ children: ripples
16155
+ })
16156
+ }));
16157
+ });
16158
+ process.env.NODE_ENV !== "production" ? TouchRipple.propTypes = {
16159
+ /**
16160
+ * If `true`, the ripple starts at the center of the component
16161
+ * rather than at the point of interaction.
16162
+ */
16163
+ center: PropTypes.bool,
16164
+ /**
16165
+ * Override or extend the styles applied to the component.
16166
+ */
16167
+ classes: PropTypes.object,
16168
+ /**
16169
+ * @ignore
16170
+ */
16171
+ className: PropTypes.string
16172
+ } : void 0;
16173
+ var TouchRipple$1 = TouchRipple;
16174
+
16175
+ function getButtonBaseUtilityClass(slot) {
16176
+ return generateUtilityClass('MuiButtonBase', slot);
16177
+ }
16178
+ const buttonBaseClasses = generateUtilityClasses('MuiButtonBase', ['root', 'disabled', 'focusVisible']);
16179
+ var buttonBaseClasses$1 = buttonBaseClasses;
16180
+
16181
+ const _excluded$3 = ["action", "centerRipple", "children", "className", "component", "disabled", "disableRipple", "disableTouchRipple", "focusRipple", "focusVisibleClassName", "LinkComponent", "onBlur", "onClick", "onContextMenu", "onDragLeave", "onFocus", "onFocusVisible", "onKeyDown", "onKeyUp", "onMouseDown", "onMouseLeave", "onMouseUp", "onTouchEnd", "onTouchMove", "onTouchStart", "tabIndex", "TouchRippleProps", "touchRippleRef", "type"];
16182
+ const useUtilityClasses$3 = ownerState => {
16183
+ const {
16184
+ disabled,
16185
+ focusVisible,
16186
+ focusVisibleClassName,
16187
+ classes
16188
+ } = ownerState;
16189
+ const slots = {
16190
+ root: ['root', disabled && 'disabled', focusVisible && 'focusVisible']
16191
+ };
16192
+ const composedClasses = composeClasses(slots, getButtonBaseUtilityClass, classes);
16193
+ if (focusVisible && focusVisibleClassName) {
16194
+ composedClasses.root += ` ${focusVisibleClassName}`;
16195
+ }
16196
+ return composedClasses;
16197
+ };
16198
+ const ButtonBaseRoot = styled$1('button', {
16199
+ name: 'MuiButtonBase',
16200
+ slot: 'Root',
16201
+ overridesResolver: (props, styles) => styles.root
16202
+ })({
16203
+ display: 'inline-flex',
16204
+ alignItems: 'center',
16205
+ justifyContent: 'center',
16206
+ position: 'relative',
16207
+ boxSizing: 'border-box',
16208
+ WebkitTapHighlightColor: 'transparent',
16209
+ backgroundColor: 'transparent',
16210
+ // Reset default value
16211
+ // We disable the focus ring for mouse, touch and keyboard users.
16212
+ outline: 0,
16213
+ border: 0,
16214
+ margin: 0,
16215
+ // Remove the margin in Safari
16216
+ borderRadius: 0,
16217
+ padding: 0,
16218
+ // Remove the padding in Firefox
16219
+ cursor: 'pointer',
16220
+ userSelect: 'none',
16221
+ verticalAlign: 'middle',
16222
+ MozAppearance: 'none',
16223
+ // Reset
16224
+ WebkitAppearance: 'none',
16225
+ // Reset
16226
+ textDecoration: 'none',
16227
+ // So we take precedent over the style of a native <a /> element.
16228
+ color: 'inherit',
16229
+ '&::-moz-focus-inner': {
16230
+ borderStyle: 'none' // Remove Firefox dotted outline.
16231
+ },
16232
+ [`&.${buttonBaseClasses$1.disabled}`]: {
16233
+ pointerEvents: 'none',
16234
+ // Disable link interactions
16235
+ cursor: 'default'
16236
+ },
16237
+ '@media print': {
16238
+ colorAdjust: 'exact'
16239
+ }
16240
+ });
16241
+
16242
+ /**
16243
+ * `ButtonBase` contains as few styles as possible.
16244
+ * It aims to be a simple building block for creating a button.
16245
+ * It contains a load of style reset and some focus/ripple logic.
16246
+ */
16247
+ const ButtonBase = /*#__PURE__*/React__namespace.forwardRef(function ButtonBase(inProps, ref) {
16248
+ const props = useDefaultProps({
16249
+ props: inProps,
16250
+ name: 'MuiButtonBase'
16251
+ });
16252
+ const {
16253
+ action,
16254
+ centerRipple = false,
16255
+ children,
16256
+ className,
16257
+ component = 'button',
16258
+ disabled = false,
16259
+ disableRipple = false,
16260
+ disableTouchRipple = false,
16261
+ focusRipple = false,
16262
+ LinkComponent = 'a',
16263
+ onBlur,
16264
+ onClick,
16265
+ onContextMenu,
16266
+ onDragLeave,
16267
+ onFocus,
16268
+ onFocusVisible,
16269
+ onKeyDown,
16270
+ onKeyUp,
16271
+ onMouseDown,
16272
+ onMouseLeave,
16273
+ onMouseUp,
16274
+ onTouchEnd,
16275
+ onTouchMove,
16276
+ onTouchStart,
16277
+ tabIndex = 0,
16278
+ TouchRippleProps,
16279
+ touchRippleRef,
16280
+ type
16281
+ } = props,
16282
+ other = _objectWithoutPropertiesLoose(props, _excluded$3);
16283
+ const buttonRef = React__namespace.useRef(null);
16284
+ const rippleRef = React__namespace.useRef(null);
16285
+ const handleRippleRef = useForkRef(rippleRef, touchRippleRef);
16286
+ const {
16287
+ isFocusVisibleRef,
16288
+ onFocus: handleFocusVisible,
16289
+ onBlur: handleBlurVisible,
16290
+ ref: focusVisibleRef
16291
+ } = useIsFocusVisible();
16292
+ const [focusVisible, setFocusVisible] = React__namespace.useState(false);
16293
+ if (disabled && focusVisible) {
16294
+ setFocusVisible(false);
16295
+ }
16296
+ React__namespace.useImperativeHandle(action, () => ({
16297
+ focusVisible: () => {
16298
+ setFocusVisible(true);
16299
+ buttonRef.current.focus();
16300
+ }
16301
+ }), []);
16302
+ const [mountedState, setMountedState] = React__namespace.useState(false);
16303
+ React__namespace.useEffect(() => {
16304
+ setMountedState(true);
16305
+ }, []);
16306
+ const enableTouchRipple = mountedState && !disableRipple && !disabled;
16307
+ React__namespace.useEffect(() => {
16308
+ if (focusVisible && focusRipple && !disableRipple && mountedState) {
16309
+ rippleRef.current.pulsate();
16310
+ }
16311
+ }, [disableRipple, focusRipple, focusVisible, mountedState]);
16312
+ function useRippleHandler(rippleAction, eventCallback, skipRippleAction = disableTouchRipple) {
16313
+ return useEventCallback(event => {
16314
+ if (eventCallback) {
16315
+ eventCallback(event);
16316
+ }
16317
+ const ignore = skipRippleAction;
16318
+ if (!ignore && rippleRef.current) {
16319
+ rippleRef.current[rippleAction](event);
16320
+ }
16321
+ return true;
16322
+ });
16323
+ }
16324
+ const handleMouseDown = useRippleHandler('start', onMouseDown);
16325
+ const handleContextMenu = useRippleHandler('stop', onContextMenu);
16326
+ const handleDragLeave = useRippleHandler('stop', onDragLeave);
16327
+ const handleMouseUp = useRippleHandler('stop', onMouseUp);
16328
+ const handleMouseLeave = useRippleHandler('stop', event => {
16329
+ if (focusVisible) {
16330
+ event.preventDefault();
16331
+ }
16332
+ if (onMouseLeave) {
16333
+ onMouseLeave(event);
16334
+ }
16335
+ });
16336
+ const handleTouchStart = useRippleHandler('start', onTouchStart);
16337
+ const handleTouchEnd = useRippleHandler('stop', onTouchEnd);
16338
+ const handleTouchMove = useRippleHandler('stop', onTouchMove);
16339
+ const handleBlur = useRippleHandler('stop', event => {
16340
+ handleBlurVisible(event);
16341
+ if (isFocusVisibleRef.current === false) {
16342
+ setFocusVisible(false);
16343
+ }
16344
+ if (onBlur) {
16345
+ onBlur(event);
16346
+ }
16347
+ }, false);
16348
+ const handleFocus = useEventCallback(event => {
16349
+ // Fix for https://github.com/facebook/react/issues/7769
16350
+ if (!buttonRef.current) {
16351
+ buttonRef.current = event.currentTarget;
16352
+ }
16353
+ handleFocusVisible(event);
16354
+ if (isFocusVisibleRef.current === true) {
16355
+ setFocusVisible(true);
16356
+ if (onFocusVisible) {
16357
+ onFocusVisible(event);
16358
+ }
16359
+ }
16360
+ if (onFocus) {
16361
+ onFocus(event);
16362
+ }
16363
+ });
16364
+ const isNonNativeButton = () => {
16365
+ const button = buttonRef.current;
16366
+ return component && component !== 'button' && !(button.tagName === 'A' && button.href);
16367
+ };
16368
+
16369
+ /**
16370
+ * IE11 shim for https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/repeat
16371
+ */
16372
+ const keydownRef = React__namespace.useRef(false);
16373
+ const handleKeyDown = useEventCallback(event => {
16374
+ // Check if key is already down to avoid repeats being counted as multiple activations
16375
+ if (focusRipple && !keydownRef.current && focusVisible && rippleRef.current && event.key === ' ') {
16376
+ keydownRef.current = true;
16377
+ rippleRef.current.stop(event, () => {
16378
+ rippleRef.current.start(event);
16379
+ });
16380
+ }
16381
+ if (event.target === event.currentTarget && isNonNativeButton() && event.key === ' ') {
16382
+ event.preventDefault();
16383
+ }
16384
+ if (onKeyDown) {
16385
+ onKeyDown(event);
16386
+ }
16387
+
16388
+ // Keyboard accessibility for non interactive elements
16389
+ if (event.target === event.currentTarget && isNonNativeButton() && event.key === 'Enter' && !disabled) {
16390
+ event.preventDefault();
16391
+ if (onClick) {
16392
+ onClick(event);
16393
+ }
16394
+ }
16395
+ });
16396
+ const handleKeyUp = useEventCallback(event => {
16397
+ // calling preventDefault in keyUp on a <button> will not dispatch a click event if Space is pressed
16398
+ // https://codesandbox.io/p/sandbox/button-keyup-preventdefault-dn7f0
16399
+ if (focusRipple && event.key === ' ' && rippleRef.current && focusVisible && !event.defaultPrevented) {
16400
+ keydownRef.current = false;
16401
+ rippleRef.current.stop(event, () => {
16402
+ rippleRef.current.pulsate(event);
16403
+ });
16404
+ }
16405
+ if (onKeyUp) {
16406
+ onKeyUp(event);
16407
+ }
16408
+
16409
+ // Keyboard accessibility for non interactive elements
16410
+ if (onClick && event.target === event.currentTarget && isNonNativeButton() && event.key === ' ' && !event.defaultPrevented) {
16411
+ onClick(event);
16412
+ }
16413
+ });
16414
+ let ComponentProp = component;
16415
+ if (ComponentProp === 'button' && (other.href || other.to)) {
16416
+ ComponentProp = LinkComponent;
16417
+ }
16418
+ const buttonProps = {};
16419
+ if (ComponentProp === 'button') {
16420
+ buttonProps.type = type === undefined ? 'button' : type;
16421
+ buttonProps.disabled = disabled;
16422
+ } else {
16423
+ if (!other.href && !other.to) {
16424
+ buttonProps.role = 'button';
16425
+ }
16426
+ if (disabled) {
16427
+ buttonProps['aria-disabled'] = disabled;
16428
+ }
16429
+ }
16430
+ const handleRef = useForkRef(ref, focusVisibleRef, buttonRef);
16431
+ if (process.env.NODE_ENV !== 'production') {
16432
+ // eslint-disable-next-line react-hooks/rules-of-hooks
16433
+ React__namespace.useEffect(() => {
16434
+ if (enableTouchRipple && !rippleRef.current) {
16435
+ console.error(['MUI: The `component` prop provided to ButtonBase is invalid.', 'Please make sure the children prop is rendered in this custom component.'].join('\n'));
16436
+ }
16437
+ }, [enableTouchRipple]);
16438
+ }
16439
+ const ownerState = _extends$1({}, props, {
16440
+ centerRipple,
16441
+ component,
16442
+ disabled,
16443
+ disableRipple,
16444
+ disableTouchRipple,
16445
+ focusRipple,
16446
+ tabIndex,
16447
+ focusVisible
16448
+ });
16449
+ const classes = useUtilityClasses$3(ownerState);
16450
+ return /*#__PURE__*/jsxRuntimeExports.jsxs(ButtonBaseRoot, _extends$1({
16451
+ as: ComponentProp,
16452
+ className: clsx(classes.root, className),
16453
+ ownerState: ownerState,
16454
+ onBlur: handleBlur,
16455
+ onClick: onClick,
16456
+ onContextMenu: handleContextMenu,
16457
+ onFocus: handleFocus,
16458
+ onKeyDown: handleKeyDown,
16459
+ onKeyUp: handleKeyUp,
16460
+ onMouseDown: handleMouseDown,
16461
+ onMouseLeave: handleMouseLeave,
16462
+ onMouseUp: handleMouseUp,
16463
+ onDragLeave: handleDragLeave,
16464
+ onTouchEnd: handleTouchEnd,
16465
+ onTouchMove: handleTouchMove,
16466
+ onTouchStart: handleTouchStart,
16467
+ ref: handleRef,
16468
+ tabIndex: disabled ? -1 : tabIndex,
16469
+ type: type
16470
+ }, buttonProps, other, {
16471
+ children: [children, enableTouchRipple ?
16472
+ /*#__PURE__*/
16473
+ /* TouchRipple is only needed client-side, x2 boost on the server. */
16474
+ jsxRuntimeExports.jsx(TouchRipple$1, _extends$1({
16475
+ ref: handleRippleRef,
16476
+ center: centerRipple
16477
+ }, TouchRippleProps)) : null]
16478
+ }));
16479
+ });
16480
+ process.env.NODE_ENV !== "production" ? ButtonBase.propTypes /* remove-proptypes */ = {
16481
+ // ┌────────────────────────────── Warning ──────────────────────────────┐
16482
+ // │ These PropTypes are generated from the TypeScript type definitions. │
16483
+ // │ To update them, edit the d.ts file and run `pnpm proptypes`. │
16484
+ // └─────────────────────────────────────────────────────────────────────┘
16485
+ /**
16486
+ * A ref for imperative actions.
16487
+ * It currently only supports `focusVisible()` action.
16488
+ */
16489
+ action: refType$1,
16490
+ /**
16491
+ * If `true`, the ripples are centered.
16492
+ * They won't start at the cursor interaction position.
16493
+ * @default false
16494
+ */
16495
+ centerRipple: PropTypes.bool,
16496
+ /**
16497
+ * The content of the component.
16498
+ */
16499
+ children: PropTypes.node,
16500
+ /**
16501
+ * Override or extend the styles applied to the component.
16502
+ */
16503
+ classes: PropTypes.object,
16504
+ /**
16505
+ * @ignore
16506
+ */
16507
+ className: PropTypes.string,
16508
+ /**
16509
+ * The component used for the root node.
16510
+ * Either a string to use a HTML element or a component.
16511
+ */
16512
+ component: elementTypeAcceptingRef$1,
16513
+ /**
16514
+ * If `true`, the component is disabled.
16515
+ * @default false
16516
+ */
16517
+ disabled: PropTypes.bool,
16518
+ /**
16519
+ * If `true`, the ripple effect is disabled.
16520
+ *
16521
+ * ⚠️ Without a ripple there is no styling for :focus-visible by default. Be sure
16522
+ * to highlight the element by applying separate styles with the `.Mui-focusVisible` class.
16523
+ * @default false
16524
+ */
16525
+ disableRipple: PropTypes.bool,
16526
+ /**
16527
+ * If `true`, the touch ripple effect is disabled.
16528
+ * @default false
16529
+ */
16530
+ disableTouchRipple: PropTypes.bool,
16531
+ /**
16532
+ * If `true`, the base button will have a keyboard focus ripple.
16533
+ * @default false
16534
+ */
16535
+ focusRipple: PropTypes.bool,
16536
+ /**
16537
+ * This prop can help identify which element has keyboard focus.
16538
+ * The class name will be applied when the element gains the focus through keyboard interaction.
16539
+ * It's a polyfill for the [CSS :focus-visible selector](https://drafts.csswg.org/selectors-4/#the-focus-visible-pseudo).
16540
+ * The rationale for using this feature [is explained here](https://github.com/WICG/focus-visible/blob/HEAD/explainer.md).
16541
+ * A [polyfill can be used](https://github.com/WICG/focus-visible) to apply a `focus-visible` class to other components
16542
+ * if needed.
16543
+ */
16544
+ focusVisibleClassName: PropTypes.string,
16545
+ /**
16546
+ * @ignore
16547
+ */
16548
+ href: PropTypes /* @typescript-to-proptypes-ignore */.any,
16549
+ /**
16550
+ * The component used to render a link when the `href` prop is provided.
16551
+ * @default 'a'
16552
+ */
16553
+ LinkComponent: PropTypes.elementType,
16554
+ /**
16555
+ * @ignore
16556
+ */
16557
+ onBlur: PropTypes.func,
16558
+ /**
16559
+ * @ignore
16560
+ */
16561
+ onClick: PropTypes.func,
16562
+ /**
16563
+ * @ignore
16564
+ */
16565
+ onContextMenu: PropTypes.func,
16566
+ /**
16567
+ * @ignore
16568
+ */
16569
+ onDragLeave: PropTypes.func,
16570
+ /**
16571
+ * @ignore
16572
+ */
16573
+ onFocus: PropTypes.func,
16574
+ /**
16575
+ * Callback fired when the component is focused with a keyboard.
16576
+ * We trigger a `onFocus` callback too.
16577
+ */
16578
+ onFocusVisible: PropTypes.func,
16579
+ /**
16580
+ * @ignore
16581
+ */
16582
+ onKeyDown: PropTypes.func,
16583
+ /**
16584
+ * @ignore
16585
+ */
16586
+ onKeyUp: PropTypes.func,
16587
+ /**
16588
+ * @ignore
16589
+ */
16590
+ onMouseDown: PropTypes.func,
16591
+ /**
16592
+ * @ignore
16593
+ */
16594
+ onMouseLeave: PropTypes.func,
16595
+ /**
16596
+ * @ignore
16597
+ */
16598
+ onMouseUp: PropTypes.func,
16599
+ /**
16600
+ * @ignore
16601
+ */
16602
+ onTouchEnd: PropTypes.func,
16603
+ /**
16604
+ * @ignore
16605
+ */
16606
+ onTouchMove: PropTypes.func,
16607
+ /**
16608
+ * @ignore
16609
+ */
16610
+ onTouchStart: PropTypes.func,
16611
+ /**
16612
+ * The system prop that allows defining system overrides as well as additional CSS styles.
16613
+ */
16614
+ sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
16615
+ /**
16616
+ * @default 0
16617
+ */
16618
+ tabIndex: PropTypes.number,
16619
+ /**
16620
+ * Props applied to the `TouchRipple` element.
16621
+ */
16622
+ TouchRippleProps: PropTypes.object,
16623
+ /**
16624
+ * A ref that points to the `TouchRipple` element.
16625
+ */
16626
+ touchRippleRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
16627
+ current: PropTypes.shape({
16628
+ pulsate: PropTypes.func.isRequired,
16629
+ start: PropTypes.func.isRequired,
16630
+ stop: PropTypes.func.isRequired
16631
+ })
16632
+ })]),
16633
+ /**
16634
+ * @ignore
16635
+ */
16636
+ type: PropTypes.oneOfType([PropTypes.oneOf(['button', 'reset', 'submit']), PropTypes.string])
16637
+ } : void 0;
16638
+ var ButtonBase$1 = ButtonBase;
16639
+
16640
+ function getButtonUtilityClass(slot) {
16641
+ return generateUtilityClass('MuiButton', slot);
16642
+ }
16643
+ const buttonClasses = generateUtilityClasses('MuiButton', ['root', 'text', 'textInherit', 'textPrimary', 'textSecondary', 'textSuccess', 'textError', 'textInfo', 'textWarning', 'outlined', 'outlinedInherit', 'outlinedPrimary', 'outlinedSecondary', 'outlinedSuccess', 'outlinedError', 'outlinedInfo', 'outlinedWarning', 'contained', 'containedInherit', 'containedPrimary', 'containedSecondary', 'containedSuccess', 'containedError', 'containedInfo', 'containedWarning', 'disableElevation', 'focusVisible', 'disabled', 'colorInherit', 'colorPrimary', 'colorSecondary', 'colorSuccess', 'colorError', 'colorInfo', 'colorWarning', 'textSizeSmall', 'textSizeMedium', 'textSizeLarge', 'outlinedSizeSmall', 'outlinedSizeMedium', 'outlinedSizeLarge', 'containedSizeSmall', 'containedSizeMedium', 'containedSizeLarge', 'sizeMedium', 'sizeSmall', 'sizeLarge', 'fullWidth', 'startIcon', 'endIcon', 'icon', 'iconSizeSmall', 'iconSizeMedium', 'iconSizeLarge']);
16644
+ var buttonClasses$1 = buttonClasses;
16645
+
16646
+ /**
16647
+ * @ignore - internal component.
16648
+ */
16649
+ const ButtonGroupContext = /*#__PURE__*/React__namespace.createContext({});
16650
+ if (process.env.NODE_ENV !== 'production') {
16651
+ ButtonGroupContext.displayName = 'ButtonGroupContext';
16652
+ }
16653
+ var ButtonGroupContext$1 = ButtonGroupContext;
16654
+
16655
+ /**
16656
+ * @ignore - internal component.
16657
+ */
16658
+ const ButtonGroupButtonContext = /*#__PURE__*/React__namespace.createContext(undefined);
16659
+ if (process.env.NODE_ENV !== 'production') {
16660
+ ButtonGroupButtonContext.displayName = 'ButtonGroupButtonContext';
16661
+ }
16662
+ var ButtonGroupButtonContext$1 = ButtonGroupButtonContext;
16663
+
16664
+ const _excluded$2 = ["children", "color", "component", "className", "disabled", "disableElevation", "disableFocusRipple", "endIcon", "focusVisibleClassName", "fullWidth", "size", "startIcon", "type", "variant"];
16665
+ const useUtilityClasses$2 = ownerState => {
16666
+ const {
16667
+ color,
16668
+ disableElevation,
16669
+ fullWidth,
16670
+ size,
16671
+ variant,
16672
+ classes
16673
+ } = ownerState;
16674
+ const slots = {
16675
+ root: ['root', variant, `${variant}${capitalize$1(color)}`, `size${capitalize$1(size)}`, `${variant}Size${capitalize$1(size)}`, `color${capitalize$1(color)}`, disableElevation && 'disableElevation', fullWidth && 'fullWidth'],
16676
+ label: ['label'],
16677
+ startIcon: ['icon', 'startIcon', `iconSize${capitalize$1(size)}`],
16678
+ endIcon: ['icon', 'endIcon', `iconSize${capitalize$1(size)}`]
16679
+ };
16680
+ const composedClasses = composeClasses(slots, getButtonUtilityClass, classes);
16681
+ return _extends$1({}, classes, composedClasses);
16682
+ };
16683
+ const commonIconStyles = ownerState => _extends$1({}, ownerState.size === 'small' && {
16684
+ '& > *:nth-of-type(1)': {
16685
+ fontSize: 18
16686
+ }
16687
+ }, ownerState.size === 'medium' && {
16688
+ '& > *:nth-of-type(1)': {
16689
+ fontSize: 20
16690
+ }
16691
+ }, ownerState.size === 'large' && {
16692
+ '& > *:nth-of-type(1)': {
16693
+ fontSize: 22
16694
+ }
16695
+ });
16696
+ const ButtonRoot = styled$1(ButtonBase$1, {
16697
+ shouldForwardProp: prop => rootShouldForwardProp$2(prop) || prop === 'classes',
16698
+ name: 'MuiButton',
16699
+ slot: 'Root',
16700
+ overridesResolver: (props, styles) => {
16701
+ const {
16702
+ ownerState
16703
+ } = props;
16704
+ return [styles.root, styles[ownerState.variant], styles[`${ownerState.variant}${capitalize$1(ownerState.color)}`], styles[`size${capitalize$1(ownerState.size)}`], styles[`${ownerState.variant}Size${capitalize$1(ownerState.size)}`], ownerState.color === 'inherit' && styles.colorInherit, ownerState.disableElevation && styles.disableElevation, ownerState.fullWidth && styles.fullWidth];
16705
+ }
16706
+ })(({
16707
+ theme,
16708
+ ownerState
16709
+ }) => {
16710
+ var _theme$palette$getCon, _theme$palette;
16711
+ const inheritContainedBackgroundColor = theme.palette.mode === 'light' ? theme.palette.grey[300] : theme.palette.grey[800];
16712
+ const inheritContainedHoverBackgroundColor = theme.palette.mode === 'light' ? theme.palette.grey.A100 : theme.palette.grey[700];
16713
+ return _extends$1({}, theme.typography.button, {
16714
+ minWidth: 64,
16715
+ padding: '6px 16px',
16716
+ borderRadius: (theme.vars || theme).shape.borderRadius,
16717
+ transition: theme.transitions.create(['background-color', 'box-shadow', 'border-color', 'color'], {
16718
+ duration: theme.transitions.duration.short
16719
+ }),
16720
+ '&:hover': _extends$1({
16721
+ textDecoration: 'none',
16722
+ backgroundColor: theme.vars ? `rgba(${theme.vars.palette.text.primaryChannel} / ${theme.vars.palette.action.hoverOpacity})` : alpha_1(theme.palette.text.primary, theme.palette.action.hoverOpacity),
16723
+ // Reset on touch devices, it doesn't add specificity
16724
+ '@media (hover: none)': {
16725
+ backgroundColor: 'transparent'
16726
+ }
16727
+ }, ownerState.variant === 'text' && ownerState.color !== 'inherit' && {
16728
+ backgroundColor: theme.vars ? `rgba(${theme.vars.palette[ownerState.color].mainChannel} / ${theme.vars.palette.action.hoverOpacity})` : alpha_1(theme.palette[ownerState.color].main, theme.palette.action.hoverOpacity),
16729
+ // Reset on touch devices, it doesn't add specificity
16730
+ '@media (hover: none)': {
16731
+ backgroundColor: 'transparent'
16732
+ }
16733
+ }, ownerState.variant === 'outlined' && ownerState.color !== 'inherit' && {
16734
+ border: `1px solid ${(theme.vars || theme).palette[ownerState.color].main}`,
16735
+ backgroundColor: theme.vars ? `rgba(${theme.vars.palette[ownerState.color].mainChannel} / ${theme.vars.palette.action.hoverOpacity})` : alpha_1(theme.palette[ownerState.color].main, theme.palette.action.hoverOpacity),
16736
+ // Reset on touch devices, it doesn't add specificity
16737
+ '@media (hover: none)': {
16738
+ backgroundColor: 'transparent'
16739
+ }
16740
+ }, ownerState.variant === 'contained' && {
16741
+ backgroundColor: theme.vars ? theme.vars.palette.Button.inheritContainedHoverBg : inheritContainedHoverBackgroundColor,
16742
+ boxShadow: (theme.vars || theme).shadows[4],
16743
+ // Reset on touch devices, it doesn't add specificity
16744
+ '@media (hover: none)': {
16745
+ boxShadow: (theme.vars || theme).shadows[2],
16746
+ backgroundColor: (theme.vars || theme).palette.grey[300]
16747
+ }
16748
+ }, ownerState.variant === 'contained' && ownerState.color !== 'inherit' && {
16749
+ backgroundColor: (theme.vars || theme).palette[ownerState.color].dark,
16750
+ // Reset on touch devices, it doesn't add specificity
16751
+ '@media (hover: none)': {
16752
+ backgroundColor: (theme.vars || theme).palette[ownerState.color].main
16753
+ }
16754
+ }),
16755
+ '&:active': _extends$1({}, ownerState.variant === 'contained' && {
16756
+ boxShadow: (theme.vars || theme).shadows[8]
16757
+ }),
16758
+ [`&.${buttonClasses$1.focusVisible}`]: _extends$1({}, ownerState.variant === 'contained' && {
16759
+ boxShadow: (theme.vars || theme).shadows[6]
16760
+ }),
16761
+ [`&.${buttonClasses$1.disabled}`]: _extends$1({
16762
+ color: (theme.vars || theme).palette.action.disabled
16763
+ }, ownerState.variant === 'outlined' && {
16764
+ border: `1px solid ${(theme.vars || theme).palette.action.disabledBackground}`
16765
+ }, ownerState.variant === 'contained' && {
16766
+ color: (theme.vars || theme).palette.action.disabled,
16767
+ boxShadow: (theme.vars || theme).shadows[0],
16768
+ backgroundColor: (theme.vars || theme).palette.action.disabledBackground
16769
+ })
16770
+ }, ownerState.variant === 'text' && {
16771
+ padding: '6px 8px'
16772
+ }, ownerState.variant === 'text' && ownerState.color !== 'inherit' && {
16773
+ color: (theme.vars || theme).palette[ownerState.color].main
16774
+ }, ownerState.variant === 'outlined' && {
16775
+ padding: '5px 15px',
16776
+ border: '1px solid currentColor'
16777
+ }, ownerState.variant === 'outlined' && ownerState.color !== 'inherit' && {
16778
+ color: (theme.vars || theme).palette[ownerState.color].main,
16779
+ border: theme.vars ? `1px solid rgba(${theme.vars.palette[ownerState.color].mainChannel} / 0.5)` : `1px solid ${alpha_1(theme.palette[ownerState.color].main, 0.5)}`
16780
+ }, ownerState.variant === 'contained' && {
16781
+ color: theme.vars ?
16782
+ // this is safe because grey does not change between default light/dark mode
16783
+ theme.vars.palette.text.primary : (_theme$palette$getCon = (_theme$palette = theme.palette).getContrastText) == null ? void 0 : _theme$palette$getCon.call(_theme$palette, theme.palette.grey[300]),
16784
+ backgroundColor: theme.vars ? theme.vars.palette.Button.inheritContainedBg : inheritContainedBackgroundColor,
16785
+ boxShadow: (theme.vars || theme).shadows[2]
16786
+ }, ownerState.variant === 'contained' && ownerState.color !== 'inherit' && {
16787
+ color: (theme.vars || theme).palette[ownerState.color].contrastText,
16788
+ backgroundColor: (theme.vars || theme).palette[ownerState.color].main
16789
+ }, ownerState.color === 'inherit' && {
16790
+ color: 'inherit',
16791
+ borderColor: 'currentColor'
16792
+ }, ownerState.size === 'small' && ownerState.variant === 'text' && {
16793
+ padding: '4px 5px',
16794
+ fontSize: theme.typography.pxToRem(13)
16795
+ }, ownerState.size === 'large' && ownerState.variant === 'text' && {
16796
+ padding: '8px 11px',
16797
+ fontSize: theme.typography.pxToRem(15)
16798
+ }, ownerState.size === 'small' && ownerState.variant === 'outlined' && {
16799
+ padding: '3px 9px',
16800
+ fontSize: theme.typography.pxToRem(13)
16801
+ }, ownerState.size === 'large' && ownerState.variant === 'outlined' && {
16802
+ padding: '7px 21px',
16803
+ fontSize: theme.typography.pxToRem(15)
16804
+ }, ownerState.size === 'small' && ownerState.variant === 'contained' && {
16805
+ padding: '4px 10px',
16806
+ fontSize: theme.typography.pxToRem(13)
16807
+ }, ownerState.size === 'large' && ownerState.variant === 'contained' && {
16808
+ padding: '8px 22px',
16809
+ fontSize: theme.typography.pxToRem(15)
16810
+ }, ownerState.fullWidth && {
16811
+ width: '100%'
16812
+ });
16813
+ }, ({
16814
+ ownerState
16815
+ }) => ownerState.disableElevation && {
16816
+ boxShadow: 'none',
16817
+ '&:hover': {
16818
+ boxShadow: 'none'
16819
+ },
16820
+ [`&.${buttonClasses$1.focusVisible}`]: {
16821
+ boxShadow: 'none'
16822
+ },
16823
+ '&:active': {
16824
+ boxShadow: 'none'
16825
+ },
16826
+ [`&.${buttonClasses$1.disabled}`]: {
16827
+ boxShadow: 'none'
16828
+ }
16829
+ });
16830
+ const ButtonStartIcon = styled$1('span', {
16831
+ name: 'MuiButton',
16832
+ slot: 'StartIcon',
16833
+ overridesResolver: (props, styles) => {
16834
+ const {
16835
+ ownerState
16836
+ } = props;
16837
+ return [styles.startIcon, styles[`iconSize${capitalize$1(ownerState.size)}`]];
16838
+ }
16839
+ })(({
16840
+ ownerState
16841
+ }) => _extends$1({
16842
+ display: 'inherit',
16843
+ marginRight: 8,
16844
+ marginLeft: -4
16845
+ }, ownerState.size === 'small' && {
16846
+ marginLeft: -2
16847
+ }, commonIconStyles(ownerState)));
16848
+ const ButtonEndIcon = styled$1('span', {
16849
+ name: 'MuiButton',
16850
+ slot: 'EndIcon',
16851
+ overridesResolver: (props, styles) => {
16852
+ const {
16853
+ ownerState
16854
+ } = props;
16855
+ return [styles.endIcon, styles[`iconSize${capitalize$1(ownerState.size)}`]];
16856
+ }
16857
+ })(({
16858
+ ownerState
16859
+ }) => _extends$1({
16860
+ display: 'inherit',
16861
+ marginRight: -4,
16862
+ marginLeft: 8
16863
+ }, ownerState.size === 'small' && {
16864
+ marginRight: -2
16865
+ }, commonIconStyles(ownerState)));
16866
+ const Button = /*#__PURE__*/React__namespace.forwardRef(function Button(inProps, ref) {
16867
+ // props priority: `inProps` > `contextProps` > `themeDefaultProps`
16868
+ const contextProps = React__namespace.useContext(ButtonGroupContext$1);
16869
+ const buttonGroupButtonContextPositionClassName = React__namespace.useContext(ButtonGroupButtonContext$1);
16870
+ const resolvedProps = resolveProps(contextProps, inProps);
16871
+ const props = useDefaultProps({
16872
+ props: resolvedProps,
16873
+ name: 'MuiButton'
16874
+ });
16875
+ const {
16876
+ children,
16877
+ color = 'primary',
16878
+ component = 'button',
16879
+ className,
16880
+ disabled = false,
16881
+ disableElevation = false,
16882
+ disableFocusRipple = false,
16883
+ endIcon: endIconProp,
16884
+ focusVisibleClassName,
16885
+ fullWidth = false,
16886
+ size = 'medium',
16887
+ startIcon: startIconProp,
16888
+ type,
16889
+ variant = 'text'
16890
+ } = props,
16891
+ other = _objectWithoutPropertiesLoose(props, _excluded$2);
16892
+ const ownerState = _extends$1({}, props, {
16893
+ color,
16894
+ component,
16895
+ disabled,
16896
+ disableElevation,
16897
+ disableFocusRipple,
16898
+ fullWidth,
16899
+ size,
16900
+ type,
16901
+ variant
16902
+ });
16903
+ const classes = useUtilityClasses$2(ownerState);
16904
+ const startIcon = startIconProp && /*#__PURE__*/jsxRuntimeExports.jsx(ButtonStartIcon, {
16905
+ className: classes.startIcon,
16906
+ ownerState: ownerState,
16907
+ children: startIconProp
16908
+ });
16909
+ const endIcon = endIconProp && /*#__PURE__*/jsxRuntimeExports.jsx(ButtonEndIcon, {
16910
+ className: classes.endIcon,
16911
+ ownerState: ownerState,
16912
+ children: endIconProp
16913
+ });
16914
+ const positionClassName = buttonGroupButtonContextPositionClassName || '';
16915
+ return /*#__PURE__*/jsxRuntimeExports.jsxs(ButtonRoot, _extends$1({
16916
+ ownerState: ownerState,
16917
+ className: clsx(contextProps.className, classes.root, className, positionClassName),
16918
+ component: component,
16919
+ disabled: disabled,
16920
+ focusRipple: !disableFocusRipple,
16921
+ focusVisibleClassName: clsx(classes.focusVisible, focusVisibleClassName),
16922
+ ref: ref,
16923
+ type: type
16924
+ }, other, {
16925
+ classes: classes,
16926
+ children: [startIcon, children, endIcon]
16927
+ }));
16928
+ });
16929
+ process.env.NODE_ENV !== "production" ? Button.propTypes /* remove-proptypes */ = {
16930
+ // ┌────────────────────────────── Warning ──────────────────────────────┐
16931
+ // │ These PropTypes are generated from the TypeScript type definitions. │
16932
+ // │ To update them, edit the d.ts file and run `pnpm proptypes`. │
16933
+ // └─────────────────────────────────────────────────────────────────────┘
16934
+ /**
16935
+ * The content of the component.
16936
+ */
16937
+ children: PropTypes.node,
16938
+ /**
16939
+ * Override or extend the styles applied to the component.
16940
+ */
16941
+ classes: PropTypes.object,
16942
+ /**
16943
+ * @ignore
16944
+ */
16945
+ className: PropTypes.string,
16946
+ /**
16947
+ * The color of the component.
16948
+ * It supports both default and custom theme colors, which can be added as shown in the
16949
+ * [palette customization guide](https://mui.com/material-ui/customization/palette/#custom-colors).
16950
+ * @default 'primary'
16951
+ */
16952
+ color: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['inherit', 'primary', 'secondary', 'success', 'error', 'info', 'warning']), PropTypes.string]),
16953
+ /**
16954
+ * The component used for the root node.
16955
+ * Either a string to use a HTML element or a component.
16956
+ */
16957
+ component: PropTypes.elementType,
16958
+ /**
16959
+ * If `true`, the component is disabled.
16960
+ * @default false
16961
+ */
16962
+ disabled: PropTypes.bool,
16963
+ /**
16964
+ * If `true`, no elevation is used.
16965
+ * @default false
16966
+ */
16967
+ disableElevation: PropTypes.bool,
16968
+ /**
16969
+ * If `true`, the keyboard focus ripple is disabled.
16970
+ * @default false
16971
+ */
16972
+ disableFocusRipple: PropTypes.bool,
16973
+ /**
16974
+ * If `true`, the ripple effect is disabled.
16975
+ *
16976
+ * ⚠️ Without a ripple there is no styling for :focus-visible by default. Be sure
16977
+ * to highlight the element by applying separate styles with the `.Mui-focusVisible` class.
16978
+ * @default false
16979
+ */
16980
+ disableRipple: PropTypes.bool,
16981
+ /**
16982
+ * Element placed after the children.
16983
+ */
16984
+ endIcon: PropTypes.node,
16985
+ /**
16986
+ * @ignore
16987
+ */
16988
+ focusVisibleClassName: PropTypes.string,
16989
+ /**
16990
+ * If `true`, the button will take up the full width of its container.
16991
+ * @default false
16992
+ */
16993
+ fullWidth: PropTypes.bool,
16994
+ /**
16995
+ * The URL to link to when the button is clicked.
16996
+ * If defined, an `a` element will be used as the root node.
16997
+ */
16998
+ href: PropTypes.string,
16999
+ /**
17000
+ * The size of the component.
17001
+ * `small` is equivalent to the dense button styling.
17002
+ * @default 'medium'
17003
+ */
17004
+ size: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['small', 'medium', 'large']), PropTypes.string]),
17005
+ /**
17006
+ * Element placed before the children.
17007
+ */
17008
+ startIcon: PropTypes.node,
17009
+ /**
17010
+ * The system prop that allows defining system overrides as well as additional CSS styles.
17011
+ */
17012
+ sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
17013
+ /**
17014
+ * @ignore
17015
+ */
17016
+ type: PropTypes.oneOfType([PropTypes.oneOf(['button', 'reset', 'submit']), PropTypes.string]),
17017
+ /**
17018
+ * The variant to use.
17019
+ * @default 'text'
17020
+ */
17021
+ variant: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['contained', 'outlined', 'text']), PropTypes.string])
17022
+ } : void 0;
17023
+ var Button$1 = Button;
17024
+
17025
+ function getCircularProgressUtilityClass(slot) {
17026
+ return generateUtilityClass('MuiCircularProgress', slot);
17027
+ }
17028
+ generateUtilityClasses('MuiCircularProgress', ['root', 'determinate', 'indeterminate', 'colorPrimary', 'colorSecondary', 'svg', 'circle', 'circleDeterminate', 'circleIndeterminate', 'circleDisableShrink']);
17029
+
17030
+ const _excluded$1 = ["className", "color", "disableShrink", "size", "style", "thickness", "value", "variant"];
17031
+ let _ = t => t,
17032
+ _t,
17033
+ _t2,
17034
+ _t3,
17035
+ _t4;
17036
+ const SIZE = 44;
17037
+ const circularRotateKeyframe = react.keyframes(_t || (_t = _`
17038
+ 0% {
17039
+ transform: rotate(0deg);
17040
+ }
17041
+
17042
+ 100% {
17043
+ transform: rotate(360deg);
17044
+ }
17045
+ `));
17046
+ const circularDashKeyframe = react.keyframes(_t2 || (_t2 = _`
17047
+ 0% {
17048
+ stroke-dasharray: 1px, 200px;
17049
+ stroke-dashoffset: 0;
17050
+ }
17051
+
17052
+ 50% {
17053
+ stroke-dasharray: 100px, 200px;
17054
+ stroke-dashoffset: -15px;
17055
+ }
17056
+
17057
+ 100% {
17058
+ stroke-dasharray: 100px, 200px;
17059
+ stroke-dashoffset: -125px;
17060
+ }
17061
+ `));
17062
+ const useUtilityClasses$1 = ownerState => {
17063
+ const {
17064
+ classes,
17065
+ variant,
17066
+ color,
17067
+ disableShrink
17068
+ } = ownerState;
17069
+ const slots = {
17070
+ root: ['root', variant, `color${capitalize$1(color)}`],
17071
+ svg: ['svg'],
17072
+ circle: ['circle', `circle${capitalize$1(variant)}`, disableShrink && 'circleDisableShrink']
17073
+ };
17074
+ return composeClasses(slots, getCircularProgressUtilityClass, classes);
17075
+ };
17076
+ const CircularProgressRoot = styled$1('span', {
17077
+ name: 'MuiCircularProgress',
17078
+ slot: 'Root',
17079
+ overridesResolver: (props, styles) => {
17080
+ const {
17081
+ ownerState
17082
+ } = props;
17083
+ return [styles.root, styles[ownerState.variant], styles[`color${capitalize$1(ownerState.color)}`]];
17084
+ }
17085
+ })(({
17086
+ ownerState,
17087
+ theme
17088
+ }) => _extends$1({
17089
+ display: 'inline-block'
17090
+ }, ownerState.variant === 'determinate' && {
17091
+ transition: theme.transitions.create('transform')
17092
+ }, ownerState.color !== 'inherit' && {
17093
+ color: (theme.vars || theme).palette[ownerState.color].main
17094
+ }), ({
17095
+ ownerState
17096
+ }) => ownerState.variant === 'indeterminate' && react.css(_t3 || (_t3 = _`
17097
+ animation: ${0} 1.4s linear infinite;
17098
+ `), circularRotateKeyframe));
17099
+ const CircularProgressSVG = styled$1('svg', {
17100
+ name: 'MuiCircularProgress',
17101
+ slot: 'Svg',
17102
+ overridesResolver: (props, styles) => styles.svg
17103
+ })({
17104
+ display: 'block' // Keeps the progress centered
17105
+ });
17106
+ const CircularProgressCircle = styled$1('circle', {
17107
+ name: 'MuiCircularProgress',
17108
+ slot: 'Circle',
17109
+ overridesResolver: (props, styles) => {
17110
+ const {
17111
+ ownerState
17112
+ } = props;
17113
+ return [styles.circle, styles[`circle${capitalize$1(ownerState.variant)}`], ownerState.disableShrink && styles.circleDisableShrink];
17114
+ }
17115
+ })(({
17116
+ ownerState,
17117
+ theme
17118
+ }) => _extends$1({
17119
+ stroke: 'currentColor'
17120
+ }, ownerState.variant === 'determinate' && {
17121
+ transition: theme.transitions.create('stroke-dashoffset')
17122
+ }, ownerState.variant === 'indeterminate' && {
17123
+ // Some default value that looks fine waiting for the animation to kicks in.
17124
+ strokeDasharray: '80px, 200px',
17125
+ strokeDashoffset: 0 // Add the unit to fix a Edge 16 and below bug.
17126
+ }), ({
17127
+ ownerState
17128
+ }) => ownerState.variant === 'indeterminate' && !ownerState.disableShrink && react.css(_t4 || (_t4 = _`
17129
+ animation: ${0} 1.4s ease-in-out infinite;
17130
+ `), circularDashKeyframe));
17131
+
17132
+ /**
17133
+ * ## ARIA
17134
+ *
17135
+ * If the progress bar is describing the loading progress of a particular region of a page,
17136
+ * you should use `aria-describedby` to point to the progress bar, and set the `aria-busy`
17137
+ * attribute to `true` on that region until it has finished loading.
17138
+ */
17139
+ const CircularProgress = /*#__PURE__*/React__namespace.forwardRef(function CircularProgress(inProps, ref) {
17140
+ const props = useDefaultProps({
17141
+ props: inProps,
17142
+ name: 'MuiCircularProgress'
17143
+ });
17144
+ const {
17145
+ className,
17146
+ color = 'primary',
17147
+ disableShrink = false,
17148
+ size = 40,
17149
+ style,
17150
+ thickness = 3.6,
17151
+ value = 0,
17152
+ variant = 'indeterminate'
17153
+ } = props,
17154
+ other = _objectWithoutPropertiesLoose(props, _excluded$1);
17155
+ const ownerState = _extends$1({}, props, {
17156
+ color,
17157
+ disableShrink,
17158
+ size,
17159
+ thickness,
17160
+ value,
17161
+ variant
17162
+ });
17163
+ const classes = useUtilityClasses$1(ownerState);
17164
+ const circleStyle = {};
17165
+ const rootStyle = {};
17166
+ const rootProps = {};
17167
+ if (variant === 'determinate') {
17168
+ const circumference = 2 * Math.PI * ((SIZE - thickness) / 2);
17169
+ circleStyle.strokeDasharray = circumference.toFixed(3);
17170
+ rootProps['aria-valuenow'] = Math.round(value);
17171
+ circleStyle.strokeDashoffset = `${((100 - value) / 100 * circumference).toFixed(3)}px`;
17172
+ rootStyle.transform = 'rotate(-90deg)';
17173
+ }
17174
+ return /*#__PURE__*/jsxRuntimeExports.jsx(CircularProgressRoot, _extends$1({
17175
+ className: clsx(classes.root, className),
17176
+ style: _extends$1({
17177
+ width: size,
17178
+ height: size
17179
+ }, rootStyle, style),
17180
+ ownerState: ownerState,
17181
+ ref: ref,
17182
+ role: "progressbar"
17183
+ }, rootProps, other, {
17184
+ children: /*#__PURE__*/jsxRuntimeExports.jsx(CircularProgressSVG, {
17185
+ className: classes.svg,
17186
+ ownerState: ownerState,
17187
+ viewBox: `${SIZE / 2} ${SIZE / 2} ${SIZE} ${SIZE}`,
17188
+ children: /*#__PURE__*/jsxRuntimeExports.jsx(CircularProgressCircle, {
17189
+ className: classes.circle,
17190
+ style: circleStyle,
17191
+ ownerState: ownerState,
17192
+ cx: SIZE,
17193
+ cy: SIZE,
17194
+ r: (SIZE - thickness) / 2,
17195
+ fill: "none",
17196
+ strokeWidth: thickness
17197
+ })
17198
+ })
17199
+ }));
17200
+ });
17201
+ process.env.NODE_ENV !== "production" ? CircularProgress.propTypes /* remove-proptypes */ = {
17202
+ // ┌────────────────────────────── Warning ──────────────────────────────┐
17203
+ // │ These PropTypes are generated from the TypeScript type definitions. │
17204
+ // │ To update them, edit the d.ts file and run `pnpm proptypes`. │
17205
+ // └─────────────────────────────────────────────────────────────────────┘
17206
+ /**
17207
+ * Override or extend the styles applied to the component.
17208
+ */
17209
+ classes: PropTypes.object,
17210
+ /**
17211
+ * @ignore
17212
+ */
17213
+ className: PropTypes.string,
17214
+ /**
17215
+ * The color of the component.
17216
+ * It supports both default and custom theme colors, which can be added as shown in the
17217
+ * [palette customization guide](https://mui.com/material-ui/customization/palette/#custom-colors).
17218
+ * @default 'primary'
17219
+ */
17220
+ color: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['inherit', 'primary', 'secondary', 'error', 'info', 'success', 'warning']), PropTypes.string]),
17221
+ /**
17222
+ * If `true`, the shrink animation is disabled.
17223
+ * This only works if variant is `indeterminate`.
17224
+ * @default false
17225
+ */
17226
+ disableShrink: chainPropTypes(PropTypes.bool, props => {
17227
+ if (props.disableShrink && props.variant && props.variant !== 'indeterminate') {
17228
+ return new Error('MUI: You have provided the `disableShrink` prop ' + 'with a variant other than `indeterminate`. This will have no effect.');
17229
+ }
17230
+ return null;
17231
+ }),
17232
+ /**
17233
+ * The size of the component.
17234
+ * If using a number, the pixel unit is assumed.
17235
+ * If using a string, you need to provide the CSS unit, for example '3rem'.
17236
+ * @default 40
17237
+ */
17238
+ size: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
17239
+ /**
17240
+ * @ignore
17241
+ */
17242
+ style: PropTypes.object,
17243
+ /**
17244
+ * The system prop that allows defining system overrides as well as additional CSS styles.
17245
+ */
17246
+ sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
17247
+ /**
17248
+ * The thickness of the circle.
17249
+ * @default 3.6
17250
+ */
17251
+ thickness: PropTypes.number,
17252
+ /**
17253
+ * The value of the progress indicator for the determinate variant.
17254
+ * Value between 0 and 100.
17255
+ * @default 0
17256
+ */
17257
+ value: PropTypes.number,
17258
+ /**
17259
+ * The variant to use.
17260
+ * Use indeterminate when there is no progress value.
17261
+ * @default 'indeterminate'
17262
+ */
17263
+ variant: PropTypes.oneOf(['determinate', 'indeterminate'])
17264
+ } : void 0;
17265
+ var CircularProgress$1 = CircularProgress;
17266
+
17267
+ function getLoadingButtonUtilityClass(slot) {
17268
+ return generateUtilityClass('MuiLoadingButton', slot);
17269
+ }
17270
+ const loadingButtonClasses = generateUtilityClasses('MuiLoadingButton', ['root', 'loading', 'loadingIndicator', 'loadingIndicatorCenter', 'loadingIndicatorStart', 'loadingIndicatorEnd', 'endIconLoadingEnd', 'startIconLoadingStart']);
17271
+ var loadingButtonClasses$1 = loadingButtonClasses;
17272
+
17273
+ const _excluded = ["children", "disabled", "id", "loading", "loadingIndicator", "loadingPosition", "variant"];
17274
+ const useUtilityClasses = ownerState => {
17275
+ const {
17276
+ loading,
17277
+ loadingPosition,
17278
+ classes
17279
+ } = ownerState;
17280
+ const slots = {
17281
+ root: ['root', loading && 'loading'],
17282
+ startIcon: [loading && `startIconLoading${capitalize$1(loadingPosition)}`],
17283
+ endIcon: [loading && `endIconLoading${capitalize$1(loadingPosition)}`],
17284
+ loadingIndicator: ['loadingIndicator', loading && `loadingIndicator${capitalize$1(loadingPosition)}`]
17285
+ };
17286
+ const composedClasses = composeClasses(slots, getLoadingButtonUtilityClass, classes);
17287
+ return _extends$1({}, classes, composedClasses);
17288
+ };
17289
+
17290
+ // TODO use `import { rootShouldForwardProp } from '../styles/styled';` once move to core
17291
+ const rootShouldForwardProp = prop => prop !== 'ownerState' && prop !== 'theme' && prop !== 'sx' && prop !== 'as' && prop !== 'classes';
17292
+ const LoadingButtonRoot = styled$1(Button$1, {
17293
+ shouldForwardProp: prop => rootShouldForwardProp(prop) || prop === 'classes',
17294
+ name: 'MuiLoadingButton',
17295
+ slot: 'Root',
17296
+ overridesResolver: (props, styles) => {
17297
+ return [styles.root, styles.startIconLoadingStart && {
17298
+ [`& .${loadingButtonClasses$1.startIconLoadingStart}`]: styles.startIconLoadingStart
17299
+ }, styles.endIconLoadingEnd && {
17300
+ [`& .${loadingButtonClasses$1.endIconLoadingEnd}`]: styles.endIconLoadingEnd
17301
+ }];
17302
+ }
17303
+ })(({
17304
+ ownerState,
17305
+ theme
17306
+ }) => _extends$1({
17307
+ [`& .${loadingButtonClasses$1.startIconLoadingStart}, & .${loadingButtonClasses$1.endIconLoadingEnd}`]: {
17308
+ transition: theme.transitions.create(['opacity'], {
17309
+ duration: theme.transitions.duration.short
17310
+ }),
17311
+ opacity: 0
17312
+ }
17313
+ }, ownerState.loadingPosition === 'center' && {
17314
+ transition: theme.transitions.create(['background-color', 'box-shadow', 'border-color'], {
17315
+ duration: theme.transitions.duration.short
17316
+ }),
17317
+ [`&.${loadingButtonClasses$1.loading}`]: {
17318
+ color: 'transparent'
17319
+ }
17320
+ }, ownerState.loadingPosition === 'start' && ownerState.fullWidth && {
17321
+ [`& .${loadingButtonClasses$1.startIconLoadingStart}, & .${loadingButtonClasses$1.endIconLoadingEnd}`]: {
17322
+ transition: theme.transitions.create(['opacity'], {
17323
+ duration: theme.transitions.duration.short
17324
+ }),
17325
+ opacity: 0,
17326
+ marginRight: -8
17327
+ }
17328
+ }, ownerState.loadingPosition === 'end' && ownerState.fullWidth && {
17329
+ [`& .${loadingButtonClasses$1.startIconLoadingStart}, & .${loadingButtonClasses$1.endIconLoadingEnd}`]: {
17330
+ transition: theme.transitions.create(['opacity'], {
17331
+ duration: theme.transitions.duration.short
17332
+ }),
17333
+ opacity: 0,
17334
+ marginLeft: -8
17335
+ }
17336
+ }));
17337
+ const LoadingButtonLoadingIndicator = styled$1('span', {
17338
+ name: 'MuiLoadingButton',
17339
+ slot: 'LoadingIndicator',
17340
+ overridesResolver: (props, styles) => {
17341
+ const {
17342
+ ownerState
17343
+ } = props;
17344
+ return [styles.loadingIndicator, styles[`loadingIndicator${capitalize$1(ownerState.loadingPosition)}`]];
17345
+ }
17346
+ })(({
17347
+ theme,
17348
+ ownerState
17349
+ }) => _extends$1({
17350
+ position: 'absolute',
17351
+ visibility: 'visible',
17352
+ display: 'flex'
17353
+ }, ownerState.loadingPosition === 'start' && (ownerState.variant === 'outlined' || ownerState.variant === 'contained') && {
17354
+ left: ownerState.size === 'small' ? 10 : 14
17355
+ }, ownerState.loadingPosition === 'start' && ownerState.variant === 'text' && {
17356
+ left: 6
17357
+ }, ownerState.loadingPosition === 'center' && {
17358
+ left: '50%',
17359
+ transform: 'translate(-50%)',
17360
+ color: (theme.vars || theme).palette.action.disabled
17361
+ }, ownerState.loadingPosition === 'end' && (ownerState.variant === 'outlined' || ownerState.variant === 'contained') && {
17362
+ right: ownerState.size === 'small' ? 10 : 14
17363
+ }, ownerState.loadingPosition === 'end' && ownerState.variant === 'text' && {
17364
+ right: 6
17365
+ }, ownerState.loadingPosition === 'start' && ownerState.fullWidth && {
17366
+ position: 'relative',
17367
+ left: -10
17368
+ }, ownerState.loadingPosition === 'end' && ownerState.fullWidth && {
17369
+ position: 'relative',
17370
+ right: -10
17371
+ }));
17372
+ const LoadingButton = /*#__PURE__*/React__namespace.forwardRef(function LoadingButton(inProps, ref) {
17373
+ const contextProps = React__namespace.useContext(ButtonGroupContext$1);
17374
+ const resolvedProps = resolveProps(contextProps, inProps);
17375
+ const props = useDefaultProps({
17376
+ props: resolvedProps,
17377
+ name: 'MuiLoadingButton'
17378
+ });
17379
+ const {
17380
+ children,
17381
+ disabled = false,
17382
+ id: idProp,
17383
+ loading = false,
17384
+ loadingIndicator: loadingIndicatorProp,
17385
+ loadingPosition = 'center',
17386
+ variant = 'text'
17387
+ } = props,
17388
+ other = _objectWithoutPropertiesLoose(props, _excluded);
17389
+ const id = useId(idProp);
17390
+ const loadingIndicator = loadingIndicatorProp != null ? loadingIndicatorProp : /*#__PURE__*/jsxRuntimeExports.jsx(CircularProgress$1, {
17391
+ "aria-labelledby": id,
17392
+ color: "inherit",
17393
+ size: 16
17394
+ });
17395
+ const ownerState = _extends$1({}, props, {
17396
+ disabled,
17397
+ loading,
17398
+ loadingIndicator,
17399
+ loadingPosition,
17400
+ variant
17401
+ });
17402
+ const classes = useUtilityClasses(ownerState);
17403
+ const loadingButtonLoadingIndicator = loading ? /*#__PURE__*/jsxRuntimeExports.jsx(LoadingButtonLoadingIndicator, {
17404
+ className: classes.loadingIndicator,
17405
+ ownerState: ownerState,
17406
+ children: loadingIndicator
17407
+ }) : null;
17408
+ return /*#__PURE__*/jsxRuntimeExports.jsxs(LoadingButtonRoot, _extends$1({
17409
+ disabled: disabled || loading,
17410
+ id: id,
17411
+ ref: ref
17412
+ }, other, {
17413
+ variant: variant,
17414
+ classes: classes,
17415
+ ownerState: ownerState,
17416
+ children: [ownerState.loadingPosition === 'end' ? children : loadingButtonLoadingIndicator, ownerState.loadingPosition === 'end' ? loadingButtonLoadingIndicator : children]
17417
+ }));
17418
+ });
17419
+ process.env.NODE_ENV !== "production" ? LoadingButton.propTypes /* remove-proptypes */ = {
17420
+ // ┌────────────────────────────── Warning ──────────────────────────────┐
17421
+ // │ These PropTypes are generated from the TypeScript type definitions. │
17422
+ // │ To update them, edit the d.ts file and run `pnpm proptypes`. │
17423
+ // └─────────────────────────────────────────────────────────────────────┘
17424
+ /**
17425
+ * The content of the component.
17426
+ */
17427
+ children: PropTypes.node,
17428
+ /**
17429
+ * Override or extend the styles applied to the component.
17430
+ */
17431
+ classes: PropTypes.object,
17432
+ /**
17433
+ * If `true`, the component is disabled.
17434
+ * @default false
17435
+ */
17436
+ disabled: PropTypes.bool,
17437
+ /**
17438
+ * @ignore
17439
+ */
17440
+ id: PropTypes.string,
17441
+ /**
17442
+ * If `true`, the loading indicator is shown and the button becomes disabled.
17443
+ * @default false
17444
+ */
17445
+ loading: PropTypes.bool,
17446
+ /**
17447
+ * Element placed before the children if the button is in loading state.
17448
+ * The node should contain an element with `role="progressbar"` with an accessible name.
17449
+ * By default we render a `CircularProgress` that is labelled by the button itself.
17450
+ * @default <CircularProgress color="inherit" size={16} />
17451
+ */
17452
+ loadingIndicator: PropTypes.node,
17453
+ /**
17454
+ * The loading indicator can be positioned on the start, end, or the center of the button.
17455
+ * @default 'center'
17456
+ */
17457
+ loadingPosition: chainPropTypes(PropTypes.oneOf(['start', 'end', 'center']), props => {
17458
+ if (props.loadingPosition === 'start' && !props.startIcon) {
17459
+ return new Error(`MUI: The loadingPosition="start" should be used in combination with startIcon.`);
17460
+ }
17461
+ if (props.loadingPosition === 'end' && !props.endIcon) {
17462
+ return new Error(`MUI: The loadingPosition="end" should be used in combination with endIcon.`);
17463
+ }
17464
+ return null;
17465
+ }),
17466
+ /**
17467
+ * The system prop that allows defining system overrides as well as additional CSS styles.
17468
+ */
17469
+ sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
17470
+ /**
17471
+ * The variant to use.
17472
+ * @default 'text'
17473
+ */
17474
+ variant: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['contained', 'outlined', 'text']), PropTypes.string])
17475
+ } : void 0;
17476
+ var LoadingButton$1 = LoadingButton;
17477
+
17478
+ const PAGE_SIZE = 20;
17479
+ const TagsEditor = ({ value, options, onChange, onBack, onSave, isSaving, t }) => {
17480
+ const [searchValue, setSearchValue] = React.useState('');
17481
+ const [limit, setLimit] = React.useState(PAGE_SIZE);
17482
+ const safeOptions = React.useMemo(() => options ?? [], [options]);
17483
+ const visibleOptions = React.useMemo(() => safeOptions.slice(0, limit), [safeOptions, limit]);
17484
+ const handleSearchChange = (_, newInputValue) => {
17485
+ setSearchValue(newInputValue ?? '');
17486
+ setLimit(PAGE_SIZE);
17487
+ };
17488
+ const onListboxScroll = (event) => {
17489
+ const element = event;
17490
+ const nearBottom = element.scrollTop + element.clientHeight >= element.scrollHeight - 24;
17491
+ if (nearBottom)
17492
+ setLimit((l) => l + PAGE_SIZE);
17493
+ };
17494
+ return (jsxRuntimeExports.jsxs(material.Box, { sx: { width: '100%' }, children: [jsxRuntimeExports.jsxs(material.Stack, { direction: "row", alignItems: "center", spacing: 1, sx: { mb: 2 }, children: [jsxRuntimeExports.jsx(material.IconButton, { size: "small", onClick: onBack, "aria-label": t('global.back'), disabled: isSaving, children: jsxRuntimeExports.jsx(default_1$1, { fontSize: "small" }) }), jsxRuntimeExports.jsx(material.Typography, { variant: "subtitle1", children: t('tags') }), jsxRuntimeExports.jsx(material.Box, { sx: { flex: 1 } }), jsxRuntimeExports.jsx(LoadingButton$1, { variant: "contained", size: "small", startIcon: jsxRuntimeExports.jsx(default_1, {}), onClick: onSave, loading: isSaving, disabled: isSaving, children: t('global.save') })] }), jsxRuntimeExports.jsx(material.Autocomplete, { multiple: true, value: value, onChange: (_, newValue) => onChange(newValue), options: visibleOptions, filterOptions: (x) => x, inputValue: searchValue, onInputChange: handleSearchChange, getOptionLabel: (option) => option?.name ?? '', isOptionEqualToValue: (o, v) => String(o?.id) === String(v?.id), renderOption: (props, option) => (jsxRuntimeExports.jsx("li", { ...props, children: option.name ?? '' })), renderTags: (tagValue, getTagProps) => tagValue.map((option, index) => (jsxRuntimeExports.jsx(material.Chip, { label: option.name ?? '', ...getTagProps({ index }) }))), size: "small", disablePortal: true, renderInput: (params) => jsxRuntimeExports.jsx(material.TextField, { ...params, size: "small" }), ListboxProps: {
17495
+ onScroll: onListboxScroll,
17496
+ sx: { maxHeight: 280, overflowY: 'auto' },
17497
+ }, noOptionsText: t('global.noOptions'), sx: { width: '100%' } })] }));
17498
+ };
17499
+
17500
+ const useImage = ({ baseUrl, spaceId, entityType, entityId, initialImageUrl, onEntityUpdated, }) => {
17501
+ const [imageUrl, setImageUrl] = React.useState(initialImageUrl ?? '');
17502
+ const [userTrii, setUserTrii] = React.useState(null);
17503
+ const [isUploading, setIsUploading] = React.useState(false);
17504
+ const [isDeleting, setIsDeleting] = React.useState(false);
17505
+ const ref = React.useRef(null);
17506
+ const canRequest = React.useMemo(() => Boolean(baseUrl && spaceId && entityType && entityId), [baseUrl, spaceId, entityType, entityId]);
17507
+ function removeSasToken(url) {
17508
+ return url.split('?sv=')[0];
17509
+ }
17510
+ function removeCacheId(url) {
17511
+ return url.split('&cacheId=')[0];
17512
+ }
17513
+ function removeParams(url) {
17514
+ let result = removeSasToken(url);
17515
+ if (!result)
17516
+ return '';
17517
+ result = removeCacheId(result);
17518
+ if (!result)
17519
+ return '';
17520
+ return result;
17521
+ }
17522
+ const ensureUserTrii = async () => {
17523
+ if (!baseUrl || !spaceId)
17524
+ return null;
17525
+ const next = await fetchUserTrii({ baseUrl, spaceId });
17526
+ setUserTrii(next);
17527
+ return next;
17528
+ };
17529
+ const getImageURLWithAccessToken = async (rawUrl) => {
17530
+ const nextUser = userTrii ?? (await ensureUserTrii());
17531
+ const storageAzureSAS = nextUser?.storageAzureSAS;
17532
+ const expireAt = storageAzureSAS?.expireAt;
17533
+ const expiredAtDate = expireAt ? new Date(expireAt) : null;
17534
+ let sas = storageAzureSAS?.sas ?? '';
17535
+ if (!sas || (expiredAtDate && expiredAtDate < new Date())) {
17536
+ const refreshed = await ensureUserTrii();
17537
+ const refreshedSas = refreshed?.storageAzureSAS?.sas;
17538
+ sas = refreshedSas ?? '';
17539
+ }
17540
+ if (!sas) {
17541
+ return rawUrl;
17542
+ }
17543
+ const cacheId = `${Date.now()}`;
17544
+ return `${rawUrl}${sas}&cacheId=${cacheId}`;
17545
+ };
17546
+ const setAccessImageUrl = async (url) => {
17547
+ if (!url) {
17548
+ setImageUrl('');
17549
+ return;
17550
+ }
17551
+ const rawUrl = removeSasToken(url);
17552
+ if (!rawUrl)
17553
+ return;
17554
+ const withSas = await getImageURLWithAccessToken(rawUrl);
17555
+ setImageUrl(withSas);
17556
+ };
17557
+ const onChange = async (event) => {
17558
+ const file = event.target.files?.[0];
17559
+ if (!file)
17560
+ return;
17561
+ if (!canRequest)
17562
+ return;
17563
+ if (ref.current) {
17564
+ ref.current.value = '';
17565
+ }
17566
+ setIsUploading(true);
17567
+ try {
17568
+ const uploadedUrl = await uploadAvatar({
17569
+ baseUrl: baseUrl,
17570
+ spaceId: spaceId,
17571
+ contactId: entityId,
17572
+ file,
17573
+ });
17574
+ const updated = await updateEntity({
17575
+ baseUrl: baseUrl,
17576
+ spaceId: spaceId,
17577
+ entityType: entityType,
17578
+ entityId: entityId,
17579
+ body: { imageUrl: uploadedUrl },
17580
+ });
17581
+ onEntityUpdated?.(updated);
17582
+ await setAccessImageUrl(uploadedUrl);
17583
+ }
17584
+ finally {
17585
+ setIsUploading(false);
17586
+ }
17587
+ };
17588
+ const uploadImage = () => {
17589
+ ref.current?.click();
17590
+ };
17591
+ const deleteImage = async () => {
17592
+ if (!canRequest)
17593
+ return;
17594
+ if (isDeleting)
17595
+ return;
17596
+ setIsDeleting(true);
17597
+ try {
17598
+ await deleteEntityPhoto({
17599
+ baseUrl: baseUrl,
17600
+ spaceId: spaceId,
17601
+ entityType: entityType,
17602
+ entityId: entityId,
17603
+ });
17604
+ onEntityUpdated?.({ imageUrl: undefined });
17605
+ setImageUrl('');
17606
+ }
17607
+ finally {
17608
+ setIsDeleting(false);
17609
+ }
17610
+ };
17611
+ React.useEffect(() => {
17612
+ if (!initialImageUrl) {
17613
+ setImageUrl('');
17614
+ return;
17615
+ }
17616
+ void setAccessImageUrl(initialImageUrl);
17617
+ }, [initialImageUrl]);
17618
+ return {
17619
+ inputAtributes: {
17620
+ onChange,
17621
+ ref,
17622
+ type: 'file',
17623
+ accept: 'image/*',
17624
+ },
17625
+ action: {
17626
+ uploadImage,
17627
+ deleteImage,
17628
+ },
17629
+ imageUrl,
17630
+ removeParams,
17631
+ isUploading,
17632
+ isDeleting,
17633
+ };
17634
+ };
17635
+
17636
+ const EditContactModal = ({ open, onClose, baseUrl, spaceId, contactId, sx, t, }) => {
17637
+ const { state, selectors, actions } = useEditContactModalController({
17638
+ open,
17639
+ baseUrl,
17640
+ spaceId,
17641
+ contactId,
17642
+ });
17643
+ const [view, setView] = React.useState("main");
17644
+ const [draftLabels, setDraftLabels] = React.useState([]);
17645
+ const [tagsEditorInitialized, setTagsEditorInitialized] = React.useState(false);
17646
+ const [isSavingTags, setIsSavingTags] = React.useState(false);
17647
+ const image = useImage({
17648
+ baseUrl,
17649
+ spaceId,
17650
+ entityType: selectors.contactType === 'business' || selectors.contactType === 'contact'
17651
+ ? selectors.contactType
17652
+ : undefined,
17653
+ entityId: state.contactData ? String(state.contactData.id) : undefined,
17654
+ initialImageUrl: state.contactData?.imageUrl,
17655
+ onEntityUpdated: (entity) => {
17656
+ if (!entity || typeof entity !== 'object')
17657
+ return;
17658
+ if (!state.contactData)
17659
+ return;
17660
+ actions.setContactData({ ...state.contactData, ...entity });
17661
+ },
17662
+ });
17663
+ React.useEffect(() => {
17664
+ if (!open) {
17665
+ setView('main');
17666
+ setDraftLabels([]);
17667
+ setTagsEditorInitialized(false);
17668
+ setIsSavingTags(false);
17669
+ }
17670
+ }, [open]);
17671
+ const handleSaveTags = async () => {
17672
+ if (isSavingTags)
17673
+ return;
17674
+ if (!baseUrl)
17675
+ return;
17676
+ if (!spaceId)
17677
+ return;
17678
+ if (!state.contactData)
17679
+ return;
17680
+ if (selectors.contactType !== 'business' && selectors.contactType !== 'contact')
17681
+ return;
17682
+ const tags = draftLabels
17683
+ .filter((l) => l?.id && l?.name)
17684
+ .map((l) => ({ id: String(l.id), name: String(l.name) }));
17685
+ setIsSavingTags(true);
17686
+ try {
17687
+ await updateEntity({
17688
+ baseUrl,
17689
+ spaceId,
17690
+ entityType: selectors.contactType,
17691
+ entityId: String(state.contactData.id),
17692
+ body: { tags },
17693
+ });
17694
+ actions.setContactData({ ...state.contactData, tags });
17695
+ setView('main');
17696
+ }
17697
+ finally {
17698
+ setIsSavingTags(false);
17699
+ }
17700
+ };
17701
+ React.useEffect(() => {
17702
+ if (view !== 'tags') {
17703
+ setTagsEditorInitialized(false);
17704
+ return;
17705
+ }
17706
+ if (tagsEditorInitialized)
17707
+ return;
17708
+ if (!selectors.labels.length)
17709
+ return;
17710
+ const selectedTagIds = new Set(selectors.tags.map((t) => String(t.id)));
17711
+ const initialSelectedLabels = selectors.labels.filter((l) => selectedTagIds.has(String(l?.id)));
17712
+ setDraftLabels(initialSelectedLabels);
17713
+ setTagsEditorInitialized(true);
17714
+ }, [view, tagsEditorInitialized, selectors.labels, selectors.tags]);
15044
17715
  const handleClose = (event, reason) => {
15045
17716
  if (reason === 'escapeKeyDown') {
15046
17717
  const maybeEvent = event;
@@ -15075,7 +17746,9 @@ const EditContactModal = ({ open, onClose, baseUrl, contactId, sx,
15075
17746
  justifyContent: 'center',
15076
17747
  alignItems: 'center',
15077
17748
  minHeight: 180,
15078
- }, children: jsxRuntimeExports.jsx(material.CircularProgress, {}) })) : state.error ? (jsxRuntimeExports.jsx(material.Box, { sx: { mb: 2 }, children: "Failed to load contact" })) : state.contactData ? (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(Header, { imgUrl: state.contactData.imageUrl, displayName: selectors.displayName }), jsxRuntimeExports.jsx(material.Box, { sx: { minHeight: 120 } })] })) : null }) }) }));
17749
+ }, children: jsxRuntimeExports.jsx(material.CircularProgress, {}) })) : state.error ? (jsxRuntimeExports.jsx(material.Box, { sx: { mb: 2 }, children: "Failed to load contact" })) : state.contactData ? (jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: jsxRuntimeExports.jsxs(material.Box, { sx: { position: 'relative', overflow: 'hidden' }, children: [jsxRuntimeExports.jsx(material.Slide, { direction: "right", in: view === 'main', mountOnEnter: true, unmountOnExit: true, children: jsxRuntimeExports.jsxs(material.Box, { children: [jsxRuntimeExports.jsx(Header, { imgUrl: image.imageUrl, displayName: selectors.displayName, tags: selectors.tags, t: t, onEditTags: () => {
17750
+ setView('tags');
17751
+ }, onUploadPhoto: image.action.uploadImage, onPhotoFileChange: image.inputAtributes.onChange, photoInputRef: image.inputAtributes.ref, isUploadingPhoto: image.isUploading, onDeletePhoto: image.action.deleteImage, isDeletingPhoto: image.isDeleting }), jsxRuntimeExports.jsx(material.Box, { sx: { minHeight: 120 } })] }) }), jsxRuntimeExports.jsx(material.Slide, { direction: "left", in: view === 'tags', mountOnEnter: true, unmountOnExit: true, children: jsxRuntimeExports.jsx(material.Box, { children: jsxRuntimeExports.jsx(TagsEditor, { value: draftLabels, options: selectors.labels, onChange: setDraftLabels, onBack: () => setView('main'), onSave: handleSaveTags, isSaving: isSavingTags, t: t }) }) })] }) })) : null }) }) }));
15079
17752
  };
15080
17753
 
15081
17754
  exports.ContactInfoPopup = ContactInfoPopup;