{"version":3,"file":"index.cjs","sources":["../node_modules/clsx/dist/clsx.mjs","../node_modules/class-variance-authority/dist/index.mjs","../node_modules/tailwind-merge/dist/bundle-mjs.mjs","../src/lib/utils.ts","../src/components/ui/button.tsx","../src/hooks/use-toast.ts","../src/types/config.ts","../src/api/factorcloud.ts","../src/api/portalduct.ts","../src/api/connectionSync.ts","../src/services/orchestration.ts","../src/components/ui/dialog.tsx","../src/components/ui/input.tsx","../src/components/ui/label.tsx","../src/components/UpdateCredentialsModal.tsx","../src/components/ui/alert-dialog.tsx","../src/components/ui/tabs.tsx","../src/components/ui/separator.tsx","../src/components/SyncProgressModal.tsx","../src/components/ui/scroll-area.tsx","../src/components/ui/badge.tsx","../src/components/ConnectDebtorModal.tsx","../src/components/RequestPortalModal.tsx","../src/hooks/use-customer-status.ts","../src/components/SyncWorkflow.tsx","../src/components/PortalIntegration.tsx","../src/components/SyncBanner.tsx","../src/components/ui/alert.tsx","../src/components/ConfigModal.tsx","../src/components/ui/card.tsx","../src/components/ClientSelectionModal.tsx","../src/sdk/index.ts"],"sourcesContent":["function r(e){var t,f,n=\"\";if(\"string\"==typeof e||\"number\"==typeof e)n+=e;else if(\"object\"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=\" \"),n+=f)}else for(f in e)e[f]&&(n&&(n+=\" \"),n+=f);return n}export function clsx(){for(var e,t,f=0,n=\"\",o=arguments.length;f<o;f++)(e=arguments[f])&&(t=r(e))&&(n&&(n+=\" \"),n+=t);return n}export default clsx;","/**\n * Copyright 2022 Joe Bell. All rights reserved.\n *\n * This file is licensed to you under the Apache License, Version 2.0\n * (the \"License\"); you may not use this file except in compliance with the\n * License. You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations under\n * the License.\n */ import { clsx } from \"clsx\";\nconst falsyToString = (value)=>typeof value === \"boolean\" ? `${value}` : value === 0 ? \"0\" : value;\nexport const cx = clsx;\nexport const cva = (base, config)=>(props)=>{\n        var _config_compoundVariants;\n        if ((config === null || config === void 0 ? void 0 : config.variants) == null) return cx(base, props === null || props === void 0 ? void 0 : props.class, props === null || props === void 0 ? void 0 : props.className);\n        const { variants, defaultVariants } = config;\n        const getVariantClassNames = Object.keys(variants).map((variant)=>{\n            const variantProp = props === null || props === void 0 ? void 0 : props[variant];\n            const defaultVariantProp = defaultVariants === null || defaultVariants === void 0 ? void 0 : defaultVariants[variant];\n            if (variantProp === null) return null;\n            const variantKey = falsyToString(variantProp) || falsyToString(defaultVariantProp);\n            return variants[variant][variantKey];\n        });\n        const propsWithoutUndefined = props && Object.entries(props).reduce((acc, param)=>{\n            let [key, value] = param;\n            if (value === undefined) {\n                return acc;\n            }\n            acc[key] = value;\n            return acc;\n        }, {});\n        const getCompoundVariantClassNames = config === null || config === void 0 ? void 0 : (_config_compoundVariants = config.compoundVariants) === null || _config_compoundVariants === void 0 ? void 0 : _config_compoundVariants.reduce((acc, param)=>{\n            let { class: cvClass, className: cvClassName, ...compoundVariantOptions } = param;\n            return Object.entries(compoundVariantOptions).every((param)=>{\n                let [key, value] = param;\n                return Array.isArray(value) ? value.includes({\n                    ...defaultVariants,\n                    ...propsWithoutUndefined\n                }[key]) : ({\n                    ...defaultVariants,\n                    ...propsWithoutUndefined\n                })[key] === value;\n            }) ? [\n                ...acc,\n                cvClass,\n                cvClassName\n            ] : acc;\n        }, []);\n        return cx(base, getVariantClassNames, getCompoundVariantClassNames, props === null || props === void 0 ? void 0 : props.class, props === null || props === void 0 ? void 0 : props.className);\n    };\n\n","const CLASS_PART_SEPARATOR = '-';\nconst createClassGroupUtils = config => {\n  const classMap = createClassMap(config);\n  const {\n    conflictingClassGroups,\n    conflictingClassGroupModifiers\n  } = config;\n  const getClassGroupId = className => {\n    const classParts = className.split(CLASS_PART_SEPARATOR);\n    // Classes like `-inset-1` produce an empty string as first classPart. We assume that classes for negative values are used correctly and remove it from classParts.\n    if (classParts[0] === '' && classParts.length !== 1) {\n      classParts.shift();\n    }\n    return getGroupRecursive(classParts, classMap) || getGroupIdForArbitraryProperty(className);\n  };\n  const getConflictingClassGroupIds = (classGroupId, hasPostfixModifier) => {\n    const conflicts = conflictingClassGroups[classGroupId] || [];\n    if (hasPostfixModifier && conflictingClassGroupModifiers[classGroupId]) {\n      return [...conflicts, ...conflictingClassGroupModifiers[classGroupId]];\n    }\n    return conflicts;\n  };\n  return {\n    getClassGroupId,\n    getConflictingClassGroupIds\n  };\n};\nconst getGroupRecursive = (classParts, classPartObject) => {\n  if (classParts.length === 0) {\n    return classPartObject.classGroupId;\n  }\n  const currentClassPart = classParts[0];\n  const nextClassPartObject = classPartObject.nextPart.get(currentClassPart);\n  const classGroupFromNextClassPart = nextClassPartObject ? getGroupRecursive(classParts.slice(1), nextClassPartObject) : undefined;\n  if (classGroupFromNextClassPart) {\n    return classGroupFromNextClassPart;\n  }\n  if (classPartObject.validators.length === 0) {\n    return undefined;\n  }\n  const classRest = classParts.join(CLASS_PART_SEPARATOR);\n  return classPartObject.validators.find(({\n    validator\n  }) => validator(classRest))?.classGroupId;\n};\nconst arbitraryPropertyRegex = /^\\[(.+)\\]$/;\nconst getGroupIdForArbitraryProperty = className => {\n  if (arbitraryPropertyRegex.test(className)) {\n    const arbitraryPropertyClassName = arbitraryPropertyRegex.exec(className)[1];\n    const property = arbitraryPropertyClassName?.substring(0, arbitraryPropertyClassName.indexOf(':'));\n    if (property) {\n      // I use two dots here because one dot is used as prefix for class groups in plugins\n      return 'arbitrary..' + property;\n    }\n  }\n};\n/**\n * Exported for testing only\n */\nconst createClassMap = config => {\n  const {\n    theme,\n    prefix\n  } = config;\n  const classMap = {\n    nextPart: new Map(),\n    validators: []\n  };\n  const prefixedClassGroupEntries = getPrefixedClassGroupEntries(Object.entries(config.classGroups), prefix);\n  prefixedClassGroupEntries.forEach(([classGroupId, classGroup]) => {\n    processClassesRecursively(classGroup, classMap, classGroupId, theme);\n  });\n  return classMap;\n};\nconst processClassesRecursively = (classGroup, classPartObject, classGroupId, theme) => {\n  classGroup.forEach(classDefinition => {\n    if (typeof classDefinition === 'string') {\n      const classPartObjectToEdit = classDefinition === '' ? classPartObject : getPart(classPartObject, classDefinition);\n      classPartObjectToEdit.classGroupId = classGroupId;\n      return;\n    }\n    if (typeof classDefinition === 'function') {\n      if (isThemeGetter(classDefinition)) {\n        processClassesRecursively(classDefinition(theme), classPartObject, classGroupId, theme);\n        return;\n      }\n      classPartObject.validators.push({\n        validator: classDefinition,\n        classGroupId\n      });\n      return;\n    }\n    Object.entries(classDefinition).forEach(([key, classGroup]) => {\n      processClassesRecursively(classGroup, getPart(classPartObject, key), classGroupId, theme);\n    });\n  });\n};\nconst getPart = (classPartObject, path) => {\n  let currentClassPartObject = classPartObject;\n  path.split(CLASS_PART_SEPARATOR).forEach(pathPart => {\n    if (!currentClassPartObject.nextPart.has(pathPart)) {\n      currentClassPartObject.nextPart.set(pathPart, {\n        nextPart: new Map(),\n        validators: []\n      });\n    }\n    currentClassPartObject = currentClassPartObject.nextPart.get(pathPart);\n  });\n  return currentClassPartObject;\n};\nconst isThemeGetter = func => func.isThemeGetter;\nconst getPrefixedClassGroupEntries = (classGroupEntries, prefix) => {\n  if (!prefix) {\n    return classGroupEntries;\n  }\n  return classGroupEntries.map(([classGroupId, classGroup]) => {\n    const prefixedClassGroup = classGroup.map(classDefinition => {\n      if (typeof classDefinition === 'string') {\n        return prefix + classDefinition;\n      }\n      if (typeof classDefinition === 'object') {\n        return Object.fromEntries(Object.entries(classDefinition).map(([key, value]) => [prefix + key, value]));\n      }\n      return classDefinition;\n    });\n    return [classGroupId, prefixedClassGroup];\n  });\n};\n\n// LRU cache inspired from hashlru (https://github.com/dominictarr/hashlru/blob/v1.0.4/index.js) but object replaced with Map to improve performance\nconst createLruCache = maxCacheSize => {\n  if (maxCacheSize < 1) {\n    return {\n      get: () => undefined,\n      set: () => {}\n    };\n  }\n  let cacheSize = 0;\n  let cache = new Map();\n  let previousCache = new Map();\n  const update = (key, value) => {\n    cache.set(key, value);\n    cacheSize++;\n    if (cacheSize > maxCacheSize) {\n      cacheSize = 0;\n      previousCache = cache;\n      cache = new Map();\n    }\n  };\n  return {\n    get(key) {\n      let value = cache.get(key);\n      if (value !== undefined) {\n        return value;\n      }\n      if ((value = previousCache.get(key)) !== undefined) {\n        update(key, value);\n        return value;\n      }\n    },\n    set(key, value) {\n      if (cache.has(key)) {\n        cache.set(key, value);\n      } else {\n        update(key, value);\n      }\n    }\n  };\n};\nconst IMPORTANT_MODIFIER = '!';\nconst createParseClassName = config => {\n  const {\n    separator,\n    experimentalParseClassName\n  } = config;\n  const isSeparatorSingleCharacter = separator.length === 1;\n  const firstSeparatorCharacter = separator[0];\n  const separatorLength = separator.length;\n  // parseClassName inspired by https://github.com/tailwindlabs/tailwindcss/blob/v3.2.2/src/util/splitAtTopLevelOnly.js\n  const parseClassName = className => {\n    const modifiers = [];\n    let bracketDepth = 0;\n    let modifierStart = 0;\n    let postfixModifierPosition;\n    for (let index = 0; index < className.length; index++) {\n      let currentCharacter = className[index];\n      if (bracketDepth === 0) {\n        if (currentCharacter === firstSeparatorCharacter && (isSeparatorSingleCharacter || className.slice(index, index + separatorLength) === separator)) {\n          modifiers.push(className.slice(modifierStart, index));\n          modifierStart = index + separatorLength;\n          continue;\n        }\n        if (currentCharacter === '/') {\n          postfixModifierPosition = index;\n          continue;\n        }\n      }\n      if (currentCharacter === '[') {\n        bracketDepth++;\n      } else if (currentCharacter === ']') {\n        bracketDepth--;\n      }\n    }\n    const baseClassNameWithImportantModifier = modifiers.length === 0 ? className : className.substring(modifierStart);\n    const hasImportantModifier = baseClassNameWithImportantModifier.startsWith(IMPORTANT_MODIFIER);\n    const baseClassName = hasImportantModifier ? baseClassNameWithImportantModifier.substring(1) : baseClassNameWithImportantModifier;\n    const maybePostfixModifierPosition = postfixModifierPosition && postfixModifierPosition > modifierStart ? postfixModifierPosition - modifierStart : undefined;\n    return {\n      modifiers,\n      hasImportantModifier,\n      baseClassName,\n      maybePostfixModifierPosition\n    };\n  };\n  if (experimentalParseClassName) {\n    return className => experimentalParseClassName({\n      className,\n      parseClassName\n    });\n  }\n  return parseClassName;\n};\n/**\n * Sorts modifiers according to following schema:\n * - Predefined modifiers are sorted alphabetically\n * - When an arbitrary variant appears, it must be preserved which modifiers are before and after it\n */\nconst sortModifiers = modifiers => {\n  if (modifiers.length <= 1) {\n    return modifiers;\n  }\n  const sortedModifiers = [];\n  let unsortedModifiers = [];\n  modifiers.forEach(modifier => {\n    const isArbitraryVariant = modifier[0] === '[';\n    if (isArbitraryVariant) {\n      sortedModifiers.push(...unsortedModifiers.sort(), modifier);\n      unsortedModifiers = [];\n    } else {\n      unsortedModifiers.push(modifier);\n    }\n  });\n  sortedModifiers.push(...unsortedModifiers.sort());\n  return sortedModifiers;\n};\nconst createConfigUtils = config => ({\n  cache: createLruCache(config.cacheSize),\n  parseClassName: createParseClassName(config),\n  ...createClassGroupUtils(config)\n});\nconst SPLIT_CLASSES_REGEX = /\\s+/;\nconst mergeClassList = (classList, configUtils) => {\n  const {\n    parseClassName,\n    getClassGroupId,\n    getConflictingClassGroupIds\n  } = configUtils;\n  /**\n   * Set of classGroupIds in following format:\n   * `{importantModifier}{variantModifiers}{classGroupId}`\n   * @example 'float'\n   * @example 'hover:focus:bg-color'\n   * @example 'md:!pr'\n   */\n  const classGroupsInConflict = [];\n  const classNames = classList.trim().split(SPLIT_CLASSES_REGEX);\n  let result = '';\n  for (let index = classNames.length - 1; index >= 0; index -= 1) {\n    const originalClassName = classNames[index];\n    const {\n      modifiers,\n      hasImportantModifier,\n      baseClassName,\n      maybePostfixModifierPosition\n    } = parseClassName(originalClassName);\n    let hasPostfixModifier = Boolean(maybePostfixModifierPosition);\n    let classGroupId = getClassGroupId(hasPostfixModifier ? baseClassName.substring(0, maybePostfixModifierPosition) : baseClassName);\n    if (!classGroupId) {\n      if (!hasPostfixModifier) {\n        // Not a Tailwind class\n        result = originalClassName + (result.length > 0 ? ' ' + result : result);\n        continue;\n      }\n      classGroupId = getClassGroupId(baseClassName);\n      if (!classGroupId) {\n        // Not a Tailwind class\n        result = originalClassName + (result.length > 0 ? ' ' + result : result);\n        continue;\n      }\n      hasPostfixModifier = false;\n    }\n    const variantModifier = sortModifiers(modifiers).join(':');\n    const modifierId = hasImportantModifier ? variantModifier + IMPORTANT_MODIFIER : variantModifier;\n    const classId = modifierId + classGroupId;\n    if (classGroupsInConflict.includes(classId)) {\n      // Tailwind class omitted due to conflict\n      continue;\n    }\n    classGroupsInConflict.push(classId);\n    const conflictGroups = getConflictingClassGroupIds(classGroupId, hasPostfixModifier);\n    for (let i = 0; i < conflictGroups.length; ++i) {\n      const group = conflictGroups[i];\n      classGroupsInConflict.push(modifierId + group);\n    }\n    // Tailwind class not in conflict\n    result = originalClassName + (result.length > 0 ? ' ' + result : result);\n  }\n  return result;\n};\n\n/**\n * The code in this file is copied from https://github.com/lukeed/clsx and modified to suit the needs of tailwind-merge better.\n *\n * Specifically:\n * - Runtime code from https://github.com/lukeed/clsx/blob/v1.2.1/src/index.js\n * - TypeScript types from https://github.com/lukeed/clsx/blob/v1.2.1/clsx.d.ts\n *\n * Original code has MIT license: Copyright (c) Luke Edwards <luke.edwards05@gmail.com> (lukeed.com)\n */\nfunction twJoin() {\n  let index = 0;\n  let argument;\n  let resolvedValue;\n  let string = '';\n  while (index < arguments.length) {\n    if (argument = arguments[index++]) {\n      if (resolvedValue = toValue(argument)) {\n        string && (string += ' ');\n        string += resolvedValue;\n      }\n    }\n  }\n  return string;\n}\nconst toValue = mix => {\n  if (typeof mix === 'string') {\n    return mix;\n  }\n  let resolvedValue;\n  let string = '';\n  for (let k = 0; k < mix.length; k++) {\n    if (mix[k]) {\n      if (resolvedValue = toValue(mix[k])) {\n        string && (string += ' ');\n        string += resolvedValue;\n      }\n    }\n  }\n  return string;\n};\nfunction createTailwindMerge(createConfigFirst, ...createConfigRest) {\n  let configUtils;\n  let cacheGet;\n  let cacheSet;\n  let functionToCall = initTailwindMerge;\n  function initTailwindMerge(classList) {\n    const config = createConfigRest.reduce((previousConfig, createConfigCurrent) => createConfigCurrent(previousConfig), createConfigFirst());\n    configUtils = createConfigUtils(config);\n    cacheGet = configUtils.cache.get;\n    cacheSet = configUtils.cache.set;\n    functionToCall = tailwindMerge;\n    return tailwindMerge(classList);\n  }\n  function tailwindMerge(classList) {\n    const cachedResult = cacheGet(classList);\n    if (cachedResult) {\n      return cachedResult;\n    }\n    const result = mergeClassList(classList, configUtils);\n    cacheSet(classList, result);\n    return result;\n  }\n  return function callTailwindMerge() {\n    return functionToCall(twJoin.apply(null, arguments));\n  };\n}\nconst fromTheme = key => {\n  const themeGetter = theme => theme[key] || [];\n  themeGetter.isThemeGetter = true;\n  return themeGetter;\n};\nconst arbitraryValueRegex = /^\\[(?:([a-z-]+):)?(.+)\\]$/i;\nconst fractionRegex = /^\\d+\\/\\d+$/;\nconst stringLengths = /*#__PURE__*/new Set(['px', 'full', 'screen']);\nconst tshirtUnitRegex = /^(\\d+(\\.\\d+)?)?(xs|sm|md|lg|xl)$/;\nconst lengthUnitRegex = /\\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\\b(calc|min|max|clamp)\\(.+\\)|^0$/;\nconst colorFunctionRegex = /^(rgba?|hsla?|hwb|(ok)?(lab|lch))\\(.+\\)$/;\n// Shadow always begins with x and y offset separated by underscore optionally prepended by inset\nconst shadowRegex = /^(inset_)?-?((\\d+)?\\.?(\\d+)[a-z]+|0)_-?((\\d+)?\\.?(\\d+)[a-z]+|0)/;\nconst imageRegex = /^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\\(.+\\)$/;\nconst isLength = value => isNumber(value) || stringLengths.has(value) || fractionRegex.test(value);\nconst isArbitraryLength = value => getIsArbitraryValue(value, 'length', isLengthOnly);\nconst isNumber = value => Boolean(value) && !Number.isNaN(Number(value));\nconst isArbitraryNumber = value => getIsArbitraryValue(value, 'number', isNumber);\nconst isInteger = value => Boolean(value) && Number.isInteger(Number(value));\nconst isPercent = value => value.endsWith('%') && isNumber(value.slice(0, -1));\nconst isArbitraryValue = value => arbitraryValueRegex.test(value);\nconst isTshirtSize = value => tshirtUnitRegex.test(value);\nconst sizeLabels = /*#__PURE__*/new Set(['length', 'size', 'percentage']);\nconst isArbitrarySize = value => getIsArbitraryValue(value, sizeLabels, isNever);\nconst isArbitraryPosition = value => getIsArbitraryValue(value, 'position', isNever);\nconst imageLabels = /*#__PURE__*/new Set(['image', 'url']);\nconst isArbitraryImage = value => getIsArbitraryValue(value, imageLabels, isImage);\nconst isArbitraryShadow = value => getIsArbitraryValue(value, '', isShadow);\nconst isAny = () => true;\nconst getIsArbitraryValue = (value, label, testValue) => {\n  const result = arbitraryValueRegex.exec(value);\n  if (result) {\n    if (result[1]) {\n      return typeof label === 'string' ? result[1] === label : label.has(result[1]);\n    }\n    return testValue(result[2]);\n  }\n  return false;\n};\nconst isLengthOnly = value =>\n// `colorFunctionRegex` check is necessary because color functions can have percentages in them which which would be incorrectly classified as lengths.\n// For example, `hsl(0 0% 0%)` would be classified as a length without this check.\n// I could also use lookbehind assertion in `lengthUnitRegex` but that isn't supported widely enough.\nlengthUnitRegex.test(value) && !colorFunctionRegex.test(value);\nconst isNever = () => false;\nconst isShadow = value => shadowRegex.test(value);\nconst isImage = value => imageRegex.test(value);\nconst validators = /*#__PURE__*/Object.defineProperty({\n  __proto__: null,\n  isAny,\n  isArbitraryImage,\n  isArbitraryLength,\n  isArbitraryNumber,\n  isArbitraryPosition,\n  isArbitraryShadow,\n  isArbitrarySize,\n  isArbitraryValue,\n  isInteger,\n  isLength,\n  isNumber,\n  isPercent,\n  isTshirtSize\n}, Symbol.toStringTag, {\n  value: 'Module'\n});\nconst getDefaultConfig = () => {\n  const colors = fromTheme('colors');\n  const spacing = fromTheme('spacing');\n  const blur = fromTheme('blur');\n  const brightness = fromTheme('brightness');\n  const borderColor = fromTheme('borderColor');\n  const borderRadius = fromTheme('borderRadius');\n  const borderSpacing = fromTheme('borderSpacing');\n  const borderWidth = fromTheme('borderWidth');\n  const contrast = fromTheme('contrast');\n  const grayscale = fromTheme('grayscale');\n  const hueRotate = fromTheme('hueRotate');\n  const invert = fromTheme('invert');\n  const gap = fromTheme('gap');\n  const gradientColorStops = fromTheme('gradientColorStops');\n  const gradientColorStopPositions = fromTheme('gradientColorStopPositions');\n  const inset = fromTheme('inset');\n  const margin = fromTheme('margin');\n  const opacity = fromTheme('opacity');\n  const padding = fromTheme('padding');\n  const saturate = fromTheme('saturate');\n  const scale = fromTheme('scale');\n  const sepia = fromTheme('sepia');\n  const skew = fromTheme('skew');\n  const space = fromTheme('space');\n  const translate = fromTheme('translate');\n  const getOverscroll = () => ['auto', 'contain', 'none'];\n  const getOverflow = () => ['auto', 'hidden', 'clip', 'visible', 'scroll'];\n  const getSpacingWithAutoAndArbitrary = () => ['auto', isArbitraryValue, spacing];\n  const getSpacingWithArbitrary = () => [isArbitraryValue, spacing];\n  const getLengthWithEmptyAndArbitrary = () => ['', isLength, isArbitraryLength];\n  const getNumberWithAutoAndArbitrary = () => ['auto', isNumber, isArbitraryValue];\n  const getPositions = () => ['bottom', 'center', 'left', 'left-bottom', 'left-top', 'right', 'right-bottom', 'right-top', 'top'];\n  const getLineStyles = () => ['solid', 'dashed', 'dotted', 'double', 'none'];\n  const getBlendModes = () => ['normal', 'multiply', 'screen', 'overlay', 'darken', 'lighten', 'color-dodge', 'color-burn', 'hard-light', 'soft-light', 'difference', 'exclusion', 'hue', 'saturation', 'color', 'luminosity'];\n  const getAlign = () => ['start', 'end', 'center', 'between', 'around', 'evenly', 'stretch'];\n  const getZeroAndEmpty = () => ['', '0', isArbitraryValue];\n  const getBreaks = () => ['auto', 'avoid', 'all', 'avoid-page', 'page', 'left', 'right', 'column'];\n  const getNumberAndArbitrary = () => [isNumber, isArbitraryValue];\n  return {\n    cacheSize: 500,\n    separator: ':',\n    theme: {\n      colors: [isAny],\n      spacing: [isLength, isArbitraryLength],\n      blur: ['none', '', isTshirtSize, isArbitraryValue],\n      brightness: getNumberAndArbitrary(),\n      borderColor: [colors],\n      borderRadius: ['none', '', 'full', isTshirtSize, isArbitraryValue],\n      borderSpacing: getSpacingWithArbitrary(),\n      borderWidth: getLengthWithEmptyAndArbitrary(),\n      contrast: getNumberAndArbitrary(),\n      grayscale: getZeroAndEmpty(),\n      hueRotate: getNumberAndArbitrary(),\n      invert: getZeroAndEmpty(),\n      gap: getSpacingWithArbitrary(),\n      gradientColorStops: [colors],\n      gradientColorStopPositions: [isPercent, isArbitraryLength],\n      inset: getSpacingWithAutoAndArbitrary(),\n      margin: getSpacingWithAutoAndArbitrary(),\n      opacity: getNumberAndArbitrary(),\n      padding: getSpacingWithArbitrary(),\n      saturate: getNumberAndArbitrary(),\n      scale: getNumberAndArbitrary(),\n      sepia: getZeroAndEmpty(),\n      skew: getNumberAndArbitrary(),\n      space: getSpacingWithArbitrary(),\n      translate: getSpacingWithArbitrary()\n    },\n    classGroups: {\n      // Layout\n      /**\n       * Aspect Ratio\n       * @see https://tailwindcss.com/docs/aspect-ratio\n       */\n      aspect: [{\n        aspect: ['auto', 'square', 'video', isArbitraryValue]\n      }],\n      /**\n       * Container\n       * @see https://tailwindcss.com/docs/container\n       */\n      container: ['container'],\n      /**\n       * Columns\n       * @see https://tailwindcss.com/docs/columns\n       */\n      columns: [{\n        columns: [isTshirtSize]\n      }],\n      /**\n       * Break After\n       * @see https://tailwindcss.com/docs/break-after\n       */\n      'break-after': [{\n        'break-after': getBreaks()\n      }],\n      /**\n       * Break Before\n       * @see https://tailwindcss.com/docs/break-before\n       */\n      'break-before': [{\n        'break-before': getBreaks()\n      }],\n      /**\n       * Break Inside\n       * @see https://tailwindcss.com/docs/break-inside\n       */\n      'break-inside': [{\n        'break-inside': ['auto', 'avoid', 'avoid-page', 'avoid-column']\n      }],\n      /**\n       * Box Decoration Break\n       * @see https://tailwindcss.com/docs/box-decoration-break\n       */\n      'box-decoration': [{\n        'box-decoration': ['slice', 'clone']\n      }],\n      /**\n       * Box Sizing\n       * @see https://tailwindcss.com/docs/box-sizing\n       */\n      box: [{\n        box: ['border', 'content']\n      }],\n      /**\n       * Display\n       * @see https://tailwindcss.com/docs/display\n       */\n      display: ['block', 'inline-block', 'inline', 'flex', 'inline-flex', 'table', 'inline-table', 'table-caption', 'table-cell', 'table-column', 'table-column-group', 'table-footer-group', 'table-header-group', 'table-row-group', 'table-row', 'flow-root', 'grid', 'inline-grid', 'contents', 'list-item', 'hidden'],\n      /**\n       * Floats\n       * @see https://tailwindcss.com/docs/float\n       */\n      float: [{\n        float: ['right', 'left', 'none', 'start', 'end']\n      }],\n      /**\n       * Clear\n       * @see https://tailwindcss.com/docs/clear\n       */\n      clear: [{\n        clear: ['left', 'right', 'both', 'none', 'start', 'end']\n      }],\n      /**\n       * Isolation\n       * @see https://tailwindcss.com/docs/isolation\n       */\n      isolation: ['isolate', 'isolation-auto'],\n      /**\n       * Object Fit\n       * @see https://tailwindcss.com/docs/object-fit\n       */\n      'object-fit': [{\n        object: ['contain', 'cover', 'fill', 'none', 'scale-down']\n      }],\n      /**\n       * Object Position\n       * @see https://tailwindcss.com/docs/object-position\n       */\n      'object-position': [{\n        object: [...getPositions(), isArbitraryValue]\n      }],\n      /**\n       * Overflow\n       * @see https://tailwindcss.com/docs/overflow\n       */\n      overflow: [{\n        overflow: getOverflow()\n      }],\n      /**\n       * Overflow X\n       * @see https://tailwindcss.com/docs/overflow\n       */\n      'overflow-x': [{\n        'overflow-x': getOverflow()\n      }],\n      /**\n       * Overflow Y\n       * @see https://tailwindcss.com/docs/overflow\n       */\n      'overflow-y': [{\n        'overflow-y': getOverflow()\n      }],\n      /**\n       * Overscroll Behavior\n       * @see https://tailwindcss.com/docs/overscroll-behavior\n       */\n      overscroll: [{\n        overscroll: getOverscroll()\n      }],\n      /**\n       * Overscroll Behavior X\n       * @see https://tailwindcss.com/docs/overscroll-behavior\n       */\n      'overscroll-x': [{\n        'overscroll-x': getOverscroll()\n      }],\n      /**\n       * Overscroll Behavior Y\n       * @see https://tailwindcss.com/docs/overscroll-behavior\n       */\n      'overscroll-y': [{\n        'overscroll-y': getOverscroll()\n      }],\n      /**\n       * Position\n       * @see https://tailwindcss.com/docs/position\n       */\n      position: ['static', 'fixed', 'absolute', 'relative', 'sticky'],\n      /**\n       * Top / Right / Bottom / Left\n       * @see https://tailwindcss.com/docs/top-right-bottom-left\n       */\n      inset: [{\n        inset: [inset]\n      }],\n      /**\n       * Right / Left\n       * @see https://tailwindcss.com/docs/top-right-bottom-left\n       */\n      'inset-x': [{\n        'inset-x': [inset]\n      }],\n      /**\n       * Top / Bottom\n       * @see https://tailwindcss.com/docs/top-right-bottom-left\n       */\n      'inset-y': [{\n        'inset-y': [inset]\n      }],\n      /**\n       * Start\n       * @see https://tailwindcss.com/docs/top-right-bottom-left\n       */\n      start: [{\n        start: [inset]\n      }],\n      /**\n       * End\n       * @see https://tailwindcss.com/docs/top-right-bottom-left\n       */\n      end: [{\n        end: [inset]\n      }],\n      /**\n       * Top\n       * @see https://tailwindcss.com/docs/top-right-bottom-left\n       */\n      top: [{\n        top: [inset]\n      }],\n      /**\n       * Right\n       * @see https://tailwindcss.com/docs/top-right-bottom-left\n       */\n      right: [{\n        right: [inset]\n      }],\n      /**\n       * Bottom\n       * @see https://tailwindcss.com/docs/top-right-bottom-left\n       */\n      bottom: [{\n        bottom: [inset]\n      }],\n      /**\n       * Left\n       * @see https://tailwindcss.com/docs/top-right-bottom-left\n       */\n      left: [{\n        left: [inset]\n      }],\n      /**\n       * Visibility\n       * @see https://tailwindcss.com/docs/visibility\n       */\n      visibility: ['visible', 'invisible', 'collapse'],\n      /**\n       * Z-Index\n       * @see https://tailwindcss.com/docs/z-index\n       */\n      z: [{\n        z: ['auto', isInteger, isArbitraryValue]\n      }],\n      // Flexbox and Grid\n      /**\n       * Flex Basis\n       * @see https://tailwindcss.com/docs/flex-basis\n       */\n      basis: [{\n        basis: getSpacingWithAutoAndArbitrary()\n      }],\n      /**\n       * Flex Direction\n       * @see https://tailwindcss.com/docs/flex-direction\n       */\n      'flex-direction': [{\n        flex: ['row', 'row-reverse', 'col', 'col-reverse']\n      }],\n      /**\n       * Flex Wrap\n       * @see https://tailwindcss.com/docs/flex-wrap\n       */\n      'flex-wrap': [{\n        flex: ['wrap', 'wrap-reverse', 'nowrap']\n      }],\n      /**\n       * Flex\n       * @see https://tailwindcss.com/docs/flex\n       */\n      flex: [{\n        flex: ['1', 'auto', 'initial', 'none', isArbitraryValue]\n      }],\n      /**\n       * Flex Grow\n       * @see https://tailwindcss.com/docs/flex-grow\n       */\n      grow: [{\n        grow: getZeroAndEmpty()\n      }],\n      /**\n       * Flex Shrink\n       * @see https://tailwindcss.com/docs/flex-shrink\n       */\n      shrink: [{\n        shrink: getZeroAndEmpty()\n      }],\n      /**\n       * Order\n       * @see https://tailwindcss.com/docs/order\n       */\n      order: [{\n        order: ['first', 'last', 'none', isInteger, isArbitraryValue]\n      }],\n      /**\n       * Grid Template Columns\n       * @see https://tailwindcss.com/docs/grid-template-columns\n       */\n      'grid-cols': [{\n        'grid-cols': [isAny]\n      }],\n      /**\n       * Grid Column Start / End\n       * @see https://tailwindcss.com/docs/grid-column\n       */\n      'col-start-end': [{\n        col: ['auto', {\n          span: ['full', isInteger, isArbitraryValue]\n        }, isArbitraryValue]\n      }],\n      /**\n       * Grid Column Start\n       * @see https://tailwindcss.com/docs/grid-column\n       */\n      'col-start': [{\n        'col-start': getNumberWithAutoAndArbitrary()\n      }],\n      /**\n       * Grid Column End\n       * @see https://tailwindcss.com/docs/grid-column\n       */\n      'col-end': [{\n        'col-end': getNumberWithAutoAndArbitrary()\n      }],\n      /**\n       * Grid Template Rows\n       * @see https://tailwindcss.com/docs/grid-template-rows\n       */\n      'grid-rows': [{\n        'grid-rows': [isAny]\n      }],\n      /**\n       * Grid Row Start / End\n       * @see https://tailwindcss.com/docs/grid-row\n       */\n      'row-start-end': [{\n        row: ['auto', {\n          span: [isInteger, isArbitraryValue]\n        }, isArbitraryValue]\n      }],\n      /**\n       * Grid Row Start\n       * @see https://tailwindcss.com/docs/grid-row\n       */\n      'row-start': [{\n        'row-start': getNumberWithAutoAndArbitrary()\n      }],\n      /**\n       * Grid Row End\n       * @see https://tailwindcss.com/docs/grid-row\n       */\n      'row-end': [{\n        'row-end': getNumberWithAutoAndArbitrary()\n      }],\n      /**\n       * Grid Auto Flow\n       * @see https://tailwindcss.com/docs/grid-auto-flow\n       */\n      'grid-flow': [{\n        'grid-flow': ['row', 'col', 'dense', 'row-dense', 'col-dense']\n      }],\n      /**\n       * Grid Auto Columns\n       * @see https://tailwindcss.com/docs/grid-auto-columns\n       */\n      'auto-cols': [{\n        'auto-cols': ['auto', 'min', 'max', 'fr', isArbitraryValue]\n      }],\n      /**\n       * Grid Auto Rows\n       * @see https://tailwindcss.com/docs/grid-auto-rows\n       */\n      'auto-rows': [{\n        'auto-rows': ['auto', 'min', 'max', 'fr', isArbitraryValue]\n      }],\n      /**\n       * Gap\n       * @see https://tailwindcss.com/docs/gap\n       */\n      gap: [{\n        gap: [gap]\n      }],\n      /**\n       * Gap X\n       * @see https://tailwindcss.com/docs/gap\n       */\n      'gap-x': [{\n        'gap-x': [gap]\n      }],\n      /**\n       * Gap Y\n       * @see https://tailwindcss.com/docs/gap\n       */\n      'gap-y': [{\n        'gap-y': [gap]\n      }],\n      /**\n       * Justify Content\n       * @see https://tailwindcss.com/docs/justify-content\n       */\n      'justify-content': [{\n        justify: ['normal', ...getAlign()]\n      }],\n      /**\n       * Justify Items\n       * @see https://tailwindcss.com/docs/justify-items\n       */\n      'justify-items': [{\n        'justify-items': ['start', 'end', 'center', 'stretch']\n      }],\n      /**\n       * Justify Self\n       * @see https://tailwindcss.com/docs/justify-self\n       */\n      'justify-self': [{\n        'justify-self': ['auto', 'start', 'end', 'center', 'stretch']\n      }],\n      /**\n       * Align Content\n       * @see https://tailwindcss.com/docs/align-content\n       */\n      'align-content': [{\n        content: ['normal', ...getAlign(), 'baseline']\n      }],\n      /**\n       * Align Items\n       * @see https://tailwindcss.com/docs/align-items\n       */\n      'align-items': [{\n        items: ['start', 'end', 'center', 'baseline', 'stretch']\n      }],\n      /**\n       * Align Self\n       * @see https://tailwindcss.com/docs/align-self\n       */\n      'align-self': [{\n        self: ['auto', 'start', 'end', 'center', 'stretch', 'baseline']\n      }],\n      /**\n       * Place Content\n       * @see https://tailwindcss.com/docs/place-content\n       */\n      'place-content': [{\n        'place-content': [...getAlign(), 'baseline']\n      }],\n      /**\n       * Place Items\n       * @see https://tailwindcss.com/docs/place-items\n       */\n      'place-items': [{\n        'place-items': ['start', 'end', 'center', 'baseline', 'stretch']\n      }],\n      /**\n       * Place Self\n       * @see https://tailwindcss.com/docs/place-self\n       */\n      'place-self': [{\n        'place-self': ['auto', 'start', 'end', 'center', 'stretch']\n      }],\n      // Spacing\n      /**\n       * Padding\n       * @see https://tailwindcss.com/docs/padding\n       */\n      p: [{\n        p: [padding]\n      }],\n      /**\n       * Padding X\n       * @see https://tailwindcss.com/docs/padding\n       */\n      px: [{\n        px: [padding]\n      }],\n      /**\n       * Padding Y\n       * @see https://tailwindcss.com/docs/padding\n       */\n      py: [{\n        py: [padding]\n      }],\n      /**\n       * Padding Start\n       * @see https://tailwindcss.com/docs/padding\n       */\n      ps: [{\n        ps: [padding]\n      }],\n      /**\n       * Padding End\n       * @see https://tailwindcss.com/docs/padding\n       */\n      pe: [{\n        pe: [padding]\n      }],\n      /**\n       * Padding Top\n       * @see https://tailwindcss.com/docs/padding\n       */\n      pt: [{\n        pt: [padding]\n      }],\n      /**\n       * Padding Right\n       * @see https://tailwindcss.com/docs/padding\n       */\n      pr: [{\n        pr: [padding]\n      }],\n      /**\n       * Padding Bottom\n       * @see https://tailwindcss.com/docs/padding\n       */\n      pb: [{\n        pb: [padding]\n      }],\n      /**\n       * Padding Left\n       * @see https://tailwindcss.com/docs/padding\n       */\n      pl: [{\n        pl: [padding]\n      }],\n      /**\n       * Margin\n       * @see https://tailwindcss.com/docs/margin\n       */\n      m: [{\n        m: [margin]\n      }],\n      /**\n       * Margin X\n       * @see https://tailwindcss.com/docs/margin\n       */\n      mx: [{\n        mx: [margin]\n      }],\n      /**\n       * Margin Y\n       * @see https://tailwindcss.com/docs/margin\n       */\n      my: [{\n        my: [margin]\n      }],\n      /**\n       * Margin Start\n       * @see https://tailwindcss.com/docs/margin\n       */\n      ms: [{\n        ms: [margin]\n      }],\n      /**\n       * Margin End\n       * @see https://tailwindcss.com/docs/margin\n       */\n      me: [{\n        me: [margin]\n      }],\n      /**\n       * Margin Top\n       * @see https://tailwindcss.com/docs/margin\n       */\n      mt: [{\n        mt: [margin]\n      }],\n      /**\n       * Margin Right\n       * @see https://tailwindcss.com/docs/margin\n       */\n      mr: [{\n        mr: [margin]\n      }],\n      /**\n       * Margin Bottom\n       * @see https://tailwindcss.com/docs/margin\n       */\n      mb: [{\n        mb: [margin]\n      }],\n      /**\n       * Margin Left\n       * @see https://tailwindcss.com/docs/margin\n       */\n      ml: [{\n        ml: [margin]\n      }],\n      /**\n       * Space Between X\n       * @see https://tailwindcss.com/docs/space\n       */\n      'space-x': [{\n        'space-x': [space]\n      }],\n      /**\n       * Space Between X Reverse\n       * @see https://tailwindcss.com/docs/space\n       */\n      'space-x-reverse': ['space-x-reverse'],\n      /**\n       * Space Between Y\n       * @see https://tailwindcss.com/docs/space\n       */\n      'space-y': [{\n        'space-y': [space]\n      }],\n      /**\n       * Space Between Y Reverse\n       * @see https://tailwindcss.com/docs/space\n       */\n      'space-y-reverse': ['space-y-reverse'],\n      // Sizing\n      /**\n       * Width\n       * @see https://tailwindcss.com/docs/width\n       */\n      w: [{\n        w: ['auto', 'min', 'max', 'fit', 'svw', 'lvw', 'dvw', isArbitraryValue, spacing]\n      }],\n      /**\n       * Min-Width\n       * @see https://tailwindcss.com/docs/min-width\n       */\n      'min-w': [{\n        'min-w': [isArbitraryValue, spacing, 'min', 'max', 'fit']\n      }],\n      /**\n       * Max-Width\n       * @see https://tailwindcss.com/docs/max-width\n       */\n      'max-w': [{\n        'max-w': [isArbitraryValue, spacing, 'none', 'full', 'min', 'max', 'fit', 'prose', {\n          screen: [isTshirtSize]\n        }, isTshirtSize]\n      }],\n      /**\n       * Height\n       * @see https://tailwindcss.com/docs/height\n       */\n      h: [{\n        h: [isArbitraryValue, spacing, 'auto', 'min', 'max', 'fit', 'svh', 'lvh', 'dvh']\n      }],\n      /**\n       * Min-Height\n       * @see https://tailwindcss.com/docs/min-height\n       */\n      'min-h': [{\n        'min-h': [isArbitraryValue, spacing, 'min', 'max', 'fit', 'svh', 'lvh', 'dvh']\n      }],\n      /**\n       * Max-Height\n       * @see https://tailwindcss.com/docs/max-height\n       */\n      'max-h': [{\n        'max-h': [isArbitraryValue, spacing, 'min', 'max', 'fit', 'svh', 'lvh', 'dvh']\n      }],\n      /**\n       * Size\n       * @see https://tailwindcss.com/docs/size\n       */\n      size: [{\n        size: [isArbitraryValue, spacing, 'auto', 'min', 'max', 'fit']\n      }],\n      // Typography\n      /**\n       * Font Size\n       * @see https://tailwindcss.com/docs/font-size\n       */\n      'font-size': [{\n        text: ['base', isTshirtSize, isArbitraryLength]\n      }],\n      /**\n       * Font Smoothing\n       * @see https://tailwindcss.com/docs/font-smoothing\n       */\n      'font-smoothing': ['antialiased', 'subpixel-antialiased'],\n      /**\n       * Font Style\n       * @see https://tailwindcss.com/docs/font-style\n       */\n      'font-style': ['italic', 'not-italic'],\n      /**\n       * Font Weight\n       * @see https://tailwindcss.com/docs/font-weight\n       */\n      'font-weight': [{\n        font: ['thin', 'extralight', 'light', 'normal', 'medium', 'semibold', 'bold', 'extrabold', 'black', isArbitraryNumber]\n      }],\n      /**\n       * Font Family\n       * @see https://tailwindcss.com/docs/font-family\n       */\n      'font-family': [{\n        font: [isAny]\n      }],\n      /**\n       * Font Variant Numeric\n       * @see https://tailwindcss.com/docs/font-variant-numeric\n       */\n      'fvn-normal': ['normal-nums'],\n      /**\n       * Font Variant Numeric\n       * @see https://tailwindcss.com/docs/font-variant-numeric\n       */\n      'fvn-ordinal': ['ordinal'],\n      /**\n       * Font Variant Numeric\n       * @see https://tailwindcss.com/docs/font-variant-numeric\n       */\n      'fvn-slashed-zero': ['slashed-zero'],\n      /**\n       * Font Variant Numeric\n       * @see https://tailwindcss.com/docs/font-variant-numeric\n       */\n      'fvn-figure': ['lining-nums', 'oldstyle-nums'],\n      /**\n       * Font Variant Numeric\n       * @see https://tailwindcss.com/docs/font-variant-numeric\n       */\n      'fvn-spacing': ['proportional-nums', 'tabular-nums'],\n      /**\n       * Font Variant Numeric\n       * @see https://tailwindcss.com/docs/font-variant-numeric\n       */\n      'fvn-fraction': ['diagonal-fractions', 'stacked-fractons'],\n      /**\n       * Letter Spacing\n       * @see https://tailwindcss.com/docs/letter-spacing\n       */\n      tracking: [{\n        tracking: ['tighter', 'tight', 'normal', 'wide', 'wider', 'widest', isArbitraryValue]\n      }],\n      /**\n       * Line Clamp\n       * @see https://tailwindcss.com/docs/line-clamp\n       */\n      'line-clamp': [{\n        'line-clamp': ['none', isNumber, isArbitraryNumber]\n      }],\n      /**\n       * Line Height\n       * @see https://tailwindcss.com/docs/line-height\n       */\n      leading: [{\n        leading: ['none', 'tight', 'snug', 'normal', 'relaxed', 'loose', isLength, isArbitraryValue]\n      }],\n      /**\n       * List Style Image\n       * @see https://tailwindcss.com/docs/list-style-image\n       */\n      'list-image': [{\n        'list-image': ['none', isArbitraryValue]\n      }],\n      /**\n       * List Style Type\n       * @see https://tailwindcss.com/docs/list-style-type\n       */\n      'list-style-type': [{\n        list: ['none', 'disc', 'decimal', isArbitraryValue]\n      }],\n      /**\n       * List Style Position\n       * @see https://tailwindcss.com/docs/list-style-position\n       */\n      'list-style-position': [{\n        list: ['inside', 'outside']\n      }],\n      /**\n       * Placeholder Color\n       * @deprecated since Tailwind CSS v3.0.0\n       * @see https://tailwindcss.com/docs/placeholder-color\n       */\n      'placeholder-color': [{\n        placeholder: [colors]\n      }],\n      /**\n       * Placeholder Opacity\n       * @see https://tailwindcss.com/docs/placeholder-opacity\n       */\n      'placeholder-opacity': [{\n        'placeholder-opacity': [opacity]\n      }],\n      /**\n       * Text Alignment\n       * @see https://tailwindcss.com/docs/text-align\n       */\n      'text-alignment': [{\n        text: ['left', 'center', 'right', 'justify', 'start', 'end']\n      }],\n      /**\n       * Text Color\n       * @see https://tailwindcss.com/docs/text-color\n       */\n      'text-color': [{\n        text: [colors]\n      }],\n      /**\n       * Text Opacity\n       * @see https://tailwindcss.com/docs/text-opacity\n       */\n      'text-opacity': [{\n        'text-opacity': [opacity]\n      }],\n      /**\n       * Text Decoration\n       * @see https://tailwindcss.com/docs/text-decoration\n       */\n      'text-decoration': ['underline', 'overline', 'line-through', 'no-underline'],\n      /**\n       * Text Decoration Style\n       * @see https://tailwindcss.com/docs/text-decoration-style\n       */\n      'text-decoration-style': [{\n        decoration: [...getLineStyles(), 'wavy']\n      }],\n      /**\n       * Text Decoration Thickness\n       * @see https://tailwindcss.com/docs/text-decoration-thickness\n       */\n      'text-decoration-thickness': [{\n        decoration: ['auto', 'from-font', isLength, isArbitraryLength]\n      }],\n      /**\n       * Text Underline Offset\n       * @see https://tailwindcss.com/docs/text-underline-offset\n       */\n      'underline-offset': [{\n        'underline-offset': ['auto', isLength, isArbitraryValue]\n      }],\n      /**\n       * Text Decoration Color\n       * @see https://tailwindcss.com/docs/text-decoration-color\n       */\n      'text-decoration-color': [{\n        decoration: [colors]\n      }],\n      /**\n       * Text Transform\n       * @see https://tailwindcss.com/docs/text-transform\n       */\n      'text-transform': ['uppercase', 'lowercase', 'capitalize', 'normal-case'],\n      /**\n       * Text Overflow\n       * @see https://tailwindcss.com/docs/text-overflow\n       */\n      'text-overflow': ['truncate', 'text-ellipsis', 'text-clip'],\n      /**\n       * Text Wrap\n       * @see https://tailwindcss.com/docs/text-wrap\n       */\n      'text-wrap': [{\n        text: ['wrap', 'nowrap', 'balance', 'pretty']\n      }],\n      /**\n       * Text Indent\n       * @see https://tailwindcss.com/docs/text-indent\n       */\n      indent: [{\n        indent: getSpacingWithArbitrary()\n      }],\n      /**\n       * Vertical Alignment\n       * @see https://tailwindcss.com/docs/vertical-align\n       */\n      'vertical-align': [{\n        align: ['baseline', 'top', 'middle', 'bottom', 'text-top', 'text-bottom', 'sub', 'super', isArbitraryValue]\n      }],\n      /**\n       * Whitespace\n       * @see https://tailwindcss.com/docs/whitespace\n       */\n      whitespace: [{\n        whitespace: ['normal', 'nowrap', 'pre', 'pre-line', 'pre-wrap', 'break-spaces']\n      }],\n      /**\n       * Word Break\n       * @see https://tailwindcss.com/docs/word-break\n       */\n      break: [{\n        break: ['normal', 'words', 'all', 'keep']\n      }],\n      /**\n       * Hyphens\n       * @see https://tailwindcss.com/docs/hyphens\n       */\n      hyphens: [{\n        hyphens: ['none', 'manual', 'auto']\n      }],\n      /**\n       * Content\n       * @see https://tailwindcss.com/docs/content\n       */\n      content: [{\n        content: ['none', isArbitraryValue]\n      }],\n      // Backgrounds\n      /**\n       * Background Attachment\n       * @see https://tailwindcss.com/docs/background-attachment\n       */\n      'bg-attachment': [{\n        bg: ['fixed', 'local', 'scroll']\n      }],\n      /**\n       * Background Clip\n       * @see https://tailwindcss.com/docs/background-clip\n       */\n      'bg-clip': [{\n        'bg-clip': ['border', 'padding', 'content', 'text']\n      }],\n      /**\n       * Background Opacity\n       * @deprecated since Tailwind CSS v3.0.0\n       * @see https://tailwindcss.com/docs/background-opacity\n       */\n      'bg-opacity': [{\n        'bg-opacity': [opacity]\n      }],\n      /**\n       * Background Origin\n       * @see https://tailwindcss.com/docs/background-origin\n       */\n      'bg-origin': [{\n        'bg-origin': ['border', 'padding', 'content']\n      }],\n      /**\n       * Background Position\n       * @see https://tailwindcss.com/docs/background-position\n       */\n      'bg-position': [{\n        bg: [...getPositions(), isArbitraryPosition]\n      }],\n      /**\n       * Background Repeat\n       * @see https://tailwindcss.com/docs/background-repeat\n       */\n      'bg-repeat': [{\n        bg: ['no-repeat', {\n          repeat: ['', 'x', 'y', 'round', 'space']\n        }]\n      }],\n      /**\n       * Background Size\n       * @see https://tailwindcss.com/docs/background-size\n       */\n      'bg-size': [{\n        bg: ['auto', 'cover', 'contain', isArbitrarySize]\n      }],\n      /**\n       * Background Image\n       * @see https://tailwindcss.com/docs/background-image\n       */\n      'bg-image': [{\n        bg: ['none', {\n          'gradient-to': ['t', 'tr', 'r', 'br', 'b', 'bl', 'l', 'tl']\n        }, isArbitraryImage]\n      }],\n      /**\n       * Background Color\n       * @see https://tailwindcss.com/docs/background-color\n       */\n      'bg-color': [{\n        bg: [colors]\n      }],\n      /**\n       * Gradient Color Stops From Position\n       * @see https://tailwindcss.com/docs/gradient-color-stops\n       */\n      'gradient-from-pos': [{\n        from: [gradientColorStopPositions]\n      }],\n      /**\n       * Gradient Color Stops Via Position\n       * @see https://tailwindcss.com/docs/gradient-color-stops\n       */\n      'gradient-via-pos': [{\n        via: [gradientColorStopPositions]\n      }],\n      /**\n       * Gradient Color Stops To Position\n       * @see https://tailwindcss.com/docs/gradient-color-stops\n       */\n      'gradient-to-pos': [{\n        to: [gradientColorStopPositions]\n      }],\n      /**\n       * Gradient Color Stops From\n       * @see https://tailwindcss.com/docs/gradient-color-stops\n       */\n      'gradient-from': [{\n        from: [gradientColorStops]\n      }],\n      /**\n       * Gradient Color Stops Via\n       * @see https://tailwindcss.com/docs/gradient-color-stops\n       */\n      'gradient-via': [{\n        via: [gradientColorStops]\n      }],\n      /**\n       * Gradient Color Stops To\n       * @see https://tailwindcss.com/docs/gradient-color-stops\n       */\n      'gradient-to': [{\n        to: [gradientColorStops]\n      }],\n      // Borders\n      /**\n       * Border Radius\n       * @see https://tailwindcss.com/docs/border-radius\n       */\n      rounded: [{\n        rounded: [borderRadius]\n      }],\n      /**\n       * Border Radius Start\n       * @see https://tailwindcss.com/docs/border-radius\n       */\n      'rounded-s': [{\n        'rounded-s': [borderRadius]\n      }],\n      /**\n       * Border Radius End\n       * @see https://tailwindcss.com/docs/border-radius\n       */\n      'rounded-e': [{\n        'rounded-e': [borderRadius]\n      }],\n      /**\n       * Border Radius Top\n       * @see https://tailwindcss.com/docs/border-radius\n       */\n      'rounded-t': [{\n        'rounded-t': [borderRadius]\n      }],\n      /**\n       * Border Radius Right\n       * @see https://tailwindcss.com/docs/border-radius\n       */\n      'rounded-r': [{\n        'rounded-r': [borderRadius]\n      }],\n      /**\n       * Border Radius Bottom\n       * @see https://tailwindcss.com/docs/border-radius\n       */\n      'rounded-b': [{\n        'rounded-b': [borderRadius]\n      }],\n      /**\n       * Border Radius Left\n       * @see https://tailwindcss.com/docs/border-radius\n       */\n      'rounded-l': [{\n        'rounded-l': [borderRadius]\n      }],\n      /**\n       * Border Radius Start Start\n       * @see https://tailwindcss.com/docs/border-radius\n       */\n      'rounded-ss': [{\n        'rounded-ss': [borderRadius]\n      }],\n      /**\n       * Border Radius Start End\n       * @see https://tailwindcss.com/docs/border-radius\n       */\n      'rounded-se': [{\n        'rounded-se': [borderRadius]\n      }],\n      /**\n       * Border Radius End End\n       * @see https://tailwindcss.com/docs/border-radius\n       */\n      'rounded-ee': [{\n        'rounded-ee': [borderRadius]\n      }],\n      /**\n       * Border Radius End Start\n       * @see https://tailwindcss.com/docs/border-radius\n       */\n      'rounded-es': [{\n        'rounded-es': [borderRadius]\n      }],\n      /**\n       * Border Radius Top Left\n       * @see https://tailwindcss.com/docs/border-radius\n       */\n      'rounded-tl': [{\n        'rounded-tl': [borderRadius]\n      }],\n      /**\n       * Border Radius Top Right\n       * @see https://tailwindcss.com/docs/border-radius\n       */\n      'rounded-tr': [{\n        'rounded-tr': [borderRadius]\n      }],\n      /**\n       * Border Radius Bottom Right\n       * @see https://tailwindcss.com/docs/border-radius\n       */\n      'rounded-br': [{\n        'rounded-br': [borderRadius]\n      }],\n      /**\n       * Border Radius Bottom Left\n       * @see https://tailwindcss.com/docs/border-radius\n       */\n      'rounded-bl': [{\n        'rounded-bl': [borderRadius]\n      }],\n      /**\n       * Border Width\n       * @see https://tailwindcss.com/docs/border-width\n       */\n      'border-w': [{\n        border: [borderWidth]\n      }],\n      /**\n       * Border Width X\n       * @see https://tailwindcss.com/docs/border-width\n       */\n      'border-w-x': [{\n        'border-x': [borderWidth]\n      }],\n      /**\n       * Border Width Y\n       * @see https://tailwindcss.com/docs/border-width\n       */\n      'border-w-y': [{\n        'border-y': [borderWidth]\n      }],\n      /**\n       * Border Width Start\n       * @see https://tailwindcss.com/docs/border-width\n       */\n      'border-w-s': [{\n        'border-s': [borderWidth]\n      }],\n      /**\n       * Border Width End\n       * @see https://tailwindcss.com/docs/border-width\n       */\n      'border-w-e': [{\n        'border-e': [borderWidth]\n      }],\n      /**\n       * Border Width Top\n       * @see https://tailwindcss.com/docs/border-width\n       */\n      'border-w-t': [{\n        'border-t': [borderWidth]\n      }],\n      /**\n       * Border Width Right\n       * @see https://tailwindcss.com/docs/border-width\n       */\n      'border-w-r': [{\n        'border-r': [borderWidth]\n      }],\n      /**\n       * Border Width Bottom\n       * @see https://tailwindcss.com/docs/border-width\n       */\n      'border-w-b': [{\n        'border-b': [borderWidth]\n      }],\n      /**\n       * Border Width Left\n       * @see https://tailwindcss.com/docs/border-width\n       */\n      'border-w-l': [{\n        'border-l': [borderWidth]\n      }],\n      /**\n       * Border Opacity\n       * @see https://tailwindcss.com/docs/border-opacity\n       */\n      'border-opacity': [{\n        'border-opacity': [opacity]\n      }],\n      /**\n       * Border Style\n       * @see https://tailwindcss.com/docs/border-style\n       */\n      'border-style': [{\n        border: [...getLineStyles(), 'hidden']\n      }],\n      /**\n       * Divide Width X\n       * @see https://tailwindcss.com/docs/divide-width\n       */\n      'divide-x': [{\n        'divide-x': [borderWidth]\n      }],\n      /**\n       * Divide Width X Reverse\n       * @see https://tailwindcss.com/docs/divide-width\n       */\n      'divide-x-reverse': ['divide-x-reverse'],\n      /**\n       * Divide Width Y\n       * @see https://tailwindcss.com/docs/divide-width\n       */\n      'divide-y': [{\n        'divide-y': [borderWidth]\n      }],\n      /**\n       * Divide Width Y Reverse\n       * @see https://tailwindcss.com/docs/divide-width\n       */\n      'divide-y-reverse': ['divide-y-reverse'],\n      /**\n       * Divide Opacity\n       * @see https://tailwindcss.com/docs/divide-opacity\n       */\n      'divide-opacity': [{\n        'divide-opacity': [opacity]\n      }],\n      /**\n       * Divide Style\n       * @see https://tailwindcss.com/docs/divide-style\n       */\n      'divide-style': [{\n        divide: getLineStyles()\n      }],\n      /**\n       * Border Color\n       * @see https://tailwindcss.com/docs/border-color\n       */\n      'border-color': [{\n        border: [borderColor]\n      }],\n      /**\n       * Border Color X\n       * @see https://tailwindcss.com/docs/border-color\n       */\n      'border-color-x': [{\n        'border-x': [borderColor]\n      }],\n      /**\n       * Border Color Y\n       * @see https://tailwindcss.com/docs/border-color\n       */\n      'border-color-y': [{\n        'border-y': [borderColor]\n      }],\n      /**\n       * Border Color S\n       * @see https://tailwindcss.com/docs/border-color\n       */\n      'border-color-s': [{\n        'border-s': [borderColor]\n      }],\n      /**\n       * Border Color E\n       * @see https://tailwindcss.com/docs/border-color\n       */\n      'border-color-e': [{\n        'border-e': [borderColor]\n      }],\n      /**\n       * Border Color Top\n       * @see https://tailwindcss.com/docs/border-color\n       */\n      'border-color-t': [{\n        'border-t': [borderColor]\n      }],\n      /**\n       * Border Color Right\n       * @see https://tailwindcss.com/docs/border-color\n       */\n      'border-color-r': [{\n        'border-r': [borderColor]\n      }],\n      /**\n       * Border Color Bottom\n       * @see https://tailwindcss.com/docs/border-color\n       */\n      'border-color-b': [{\n        'border-b': [borderColor]\n      }],\n      /**\n       * Border Color Left\n       * @see https://tailwindcss.com/docs/border-color\n       */\n      'border-color-l': [{\n        'border-l': [borderColor]\n      }],\n      /**\n       * Divide Color\n       * @see https://tailwindcss.com/docs/divide-color\n       */\n      'divide-color': [{\n        divide: [borderColor]\n      }],\n      /**\n       * Outline Style\n       * @see https://tailwindcss.com/docs/outline-style\n       */\n      'outline-style': [{\n        outline: ['', ...getLineStyles()]\n      }],\n      /**\n       * Outline Offset\n       * @see https://tailwindcss.com/docs/outline-offset\n       */\n      'outline-offset': [{\n        'outline-offset': [isLength, isArbitraryValue]\n      }],\n      /**\n       * Outline Width\n       * @see https://tailwindcss.com/docs/outline-width\n       */\n      'outline-w': [{\n        outline: [isLength, isArbitraryLength]\n      }],\n      /**\n       * Outline Color\n       * @see https://tailwindcss.com/docs/outline-color\n       */\n      'outline-color': [{\n        outline: [colors]\n      }],\n      /**\n       * Ring Width\n       * @see https://tailwindcss.com/docs/ring-width\n       */\n      'ring-w': [{\n        ring: getLengthWithEmptyAndArbitrary()\n      }],\n      /**\n       * Ring Width Inset\n       * @see https://tailwindcss.com/docs/ring-width\n       */\n      'ring-w-inset': ['ring-inset'],\n      /**\n       * Ring Color\n       * @see https://tailwindcss.com/docs/ring-color\n       */\n      'ring-color': [{\n        ring: [colors]\n      }],\n      /**\n       * Ring Opacity\n       * @see https://tailwindcss.com/docs/ring-opacity\n       */\n      'ring-opacity': [{\n        'ring-opacity': [opacity]\n      }],\n      /**\n       * Ring Offset Width\n       * @see https://tailwindcss.com/docs/ring-offset-width\n       */\n      'ring-offset-w': [{\n        'ring-offset': [isLength, isArbitraryLength]\n      }],\n      /**\n       * Ring Offset Color\n       * @see https://tailwindcss.com/docs/ring-offset-color\n       */\n      'ring-offset-color': [{\n        'ring-offset': [colors]\n      }],\n      // Effects\n      /**\n       * Box Shadow\n       * @see https://tailwindcss.com/docs/box-shadow\n       */\n      shadow: [{\n        shadow: ['', 'inner', 'none', isTshirtSize, isArbitraryShadow]\n      }],\n      /**\n       * Box Shadow Color\n       * @see https://tailwindcss.com/docs/box-shadow-color\n       */\n      'shadow-color': [{\n        shadow: [isAny]\n      }],\n      /**\n       * Opacity\n       * @see https://tailwindcss.com/docs/opacity\n       */\n      opacity: [{\n        opacity: [opacity]\n      }],\n      /**\n       * Mix Blend Mode\n       * @see https://tailwindcss.com/docs/mix-blend-mode\n       */\n      'mix-blend': [{\n        'mix-blend': [...getBlendModes(), 'plus-lighter', 'plus-darker']\n      }],\n      /**\n       * Background Blend Mode\n       * @see https://tailwindcss.com/docs/background-blend-mode\n       */\n      'bg-blend': [{\n        'bg-blend': getBlendModes()\n      }],\n      // Filters\n      /**\n       * Filter\n       * @deprecated since Tailwind CSS v3.0.0\n       * @see https://tailwindcss.com/docs/filter\n       */\n      filter: [{\n        filter: ['', 'none']\n      }],\n      /**\n       * Blur\n       * @see https://tailwindcss.com/docs/blur\n       */\n      blur: [{\n        blur: [blur]\n      }],\n      /**\n       * Brightness\n       * @see https://tailwindcss.com/docs/brightness\n       */\n      brightness: [{\n        brightness: [brightness]\n      }],\n      /**\n       * Contrast\n       * @see https://tailwindcss.com/docs/contrast\n       */\n      contrast: [{\n        contrast: [contrast]\n      }],\n      /**\n       * Drop Shadow\n       * @see https://tailwindcss.com/docs/drop-shadow\n       */\n      'drop-shadow': [{\n        'drop-shadow': ['', 'none', isTshirtSize, isArbitraryValue]\n      }],\n      /**\n       * Grayscale\n       * @see https://tailwindcss.com/docs/grayscale\n       */\n      grayscale: [{\n        grayscale: [grayscale]\n      }],\n      /**\n       * Hue Rotate\n       * @see https://tailwindcss.com/docs/hue-rotate\n       */\n      'hue-rotate': [{\n        'hue-rotate': [hueRotate]\n      }],\n      /**\n       * Invert\n       * @see https://tailwindcss.com/docs/invert\n       */\n      invert: [{\n        invert: [invert]\n      }],\n      /**\n       * Saturate\n       * @see https://tailwindcss.com/docs/saturate\n       */\n      saturate: [{\n        saturate: [saturate]\n      }],\n      /**\n       * Sepia\n       * @see https://tailwindcss.com/docs/sepia\n       */\n      sepia: [{\n        sepia: [sepia]\n      }],\n      /**\n       * Backdrop Filter\n       * @deprecated since Tailwind CSS v3.0.0\n       * @see https://tailwindcss.com/docs/backdrop-filter\n       */\n      'backdrop-filter': [{\n        'backdrop-filter': ['', 'none']\n      }],\n      /**\n       * Backdrop Blur\n       * @see https://tailwindcss.com/docs/backdrop-blur\n       */\n      'backdrop-blur': [{\n        'backdrop-blur': [blur]\n      }],\n      /**\n       * Backdrop Brightness\n       * @see https://tailwindcss.com/docs/backdrop-brightness\n       */\n      'backdrop-brightness': [{\n        'backdrop-brightness': [brightness]\n      }],\n      /**\n       * Backdrop Contrast\n       * @see https://tailwindcss.com/docs/backdrop-contrast\n       */\n      'backdrop-contrast': [{\n        'backdrop-contrast': [contrast]\n      }],\n      /**\n       * Backdrop Grayscale\n       * @see https://tailwindcss.com/docs/backdrop-grayscale\n       */\n      'backdrop-grayscale': [{\n        'backdrop-grayscale': [grayscale]\n      }],\n      /**\n       * Backdrop Hue Rotate\n       * @see https://tailwindcss.com/docs/backdrop-hue-rotate\n       */\n      'backdrop-hue-rotate': [{\n        'backdrop-hue-rotate': [hueRotate]\n      }],\n      /**\n       * Backdrop Invert\n       * @see https://tailwindcss.com/docs/backdrop-invert\n       */\n      'backdrop-invert': [{\n        'backdrop-invert': [invert]\n      }],\n      /**\n       * Backdrop Opacity\n       * @see https://tailwindcss.com/docs/backdrop-opacity\n       */\n      'backdrop-opacity': [{\n        'backdrop-opacity': [opacity]\n      }],\n      /**\n       * Backdrop Saturate\n       * @see https://tailwindcss.com/docs/backdrop-saturate\n       */\n      'backdrop-saturate': [{\n        'backdrop-saturate': [saturate]\n      }],\n      /**\n       * Backdrop Sepia\n       * @see https://tailwindcss.com/docs/backdrop-sepia\n       */\n      'backdrop-sepia': [{\n        'backdrop-sepia': [sepia]\n      }],\n      // Tables\n      /**\n       * Border Collapse\n       * @see https://tailwindcss.com/docs/border-collapse\n       */\n      'border-collapse': [{\n        border: ['collapse', 'separate']\n      }],\n      /**\n       * Border Spacing\n       * @see https://tailwindcss.com/docs/border-spacing\n       */\n      'border-spacing': [{\n        'border-spacing': [borderSpacing]\n      }],\n      /**\n       * Border Spacing X\n       * @see https://tailwindcss.com/docs/border-spacing\n       */\n      'border-spacing-x': [{\n        'border-spacing-x': [borderSpacing]\n      }],\n      /**\n       * Border Spacing Y\n       * @see https://tailwindcss.com/docs/border-spacing\n       */\n      'border-spacing-y': [{\n        'border-spacing-y': [borderSpacing]\n      }],\n      /**\n       * Table Layout\n       * @see https://tailwindcss.com/docs/table-layout\n       */\n      'table-layout': [{\n        table: ['auto', 'fixed']\n      }],\n      /**\n       * Caption Side\n       * @see https://tailwindcss.com/docs/caption-side\n       */\n      caption: [{\n        caption: ['top', 'bottom']\n      }],\n      // Transitions and Animation\n      /**\n       * Tranisition Property\n       * @see https://tailwindcss.com/docs/transition-property\n       */\n      transition: [{\n        transition: ['none', 'all', '', 'colors', 'opacity', 'shadow', 'transform', isArbitraryValue]\n      }],\n      /**\n       * Transition Duration\n       * @see https://tailwindcss.com/docs/transition-duration\n       */\n      duration: [{\n        duration: getNumberAndArbitrary()\n      }],\n      /**\n       * Transition Timing Function\n       * @see https://tailwindcss.com/docs/transition-timing-function\n       */\n      ease: [{\n        ease: ['linear', 'in', 'out', 'in-out', isArbitraryValue]\n      }],\n      /**\n       * Transition Delay\n       * @see https://tailwindcss.com/docs/transition-delay\n       */\n      delay: [{\n        delay: getNumberAndArbitrary()\n      }],\n      /**\n       * Animation\n       * @see https://tailwindcss.com/docs/animation\n       */\n      animate: [{\n        animate: ['none', 'spin', 'ping', 'pulse', 'bounce', isArbitraryValue]\n      }],\n      // Transforms\n      /**\n       * Transform\n       * @see https://tailwindcss.com/docs/transform\n       */\n      transform: [{\n        transform: ['', 'gpu', 'none']\n      }],\n      /**\n       * Scale\n       * @see https://tailwindcss.com/docs/scale\n       */\n      scale: [{\n        scale: [scale]\n      }],\n      /**\n       * Scale X\n       * @see https://tailwindcss.com/docs/scale\n       */\n      'scale-x': [{\n        'scale-x': [scale]\n      }],\n      /**\n       * Scale Y\n       * @see https://tailwindcss.com/docs/scale\n       */\n      'scale-y': [{\n        'scale-y': [scale]\n      }],\n      /**\n       * Rotate\n       * @see https://tailwindcss.com/docs/rotate\n       */\n      rotate: [{\n        rotate: [isInteger, isArbitraryValue]\n      }],\n      /**\n       * Translate X\n       * @see https://tailwindcss.com/docs/translate\n       */\n      'translate-x': [{\n        'translate-x': [translate]\n      }],\n      /**\n       * Translate Y\n       * @see https://tailwindcss.com/docs/translate\n       */\n      'translate-y': [{\n        'translate-y': [translate]\n      }],\n      /**\n       * Skew X\n       * @see https://tailwindcss.com/docs/skew\n       */\n      'skew-x': [{\n        'skew-x': [skew]\n      }],\n      /**\n       * Skew Y\n       * @see https://tailwindcss.com/docs/skew\n       */\n      'skew-y': [{\n        'skew-y': [skew]\n      }],\n      /**\n       * Transform Origin\n       * @see https://tailwindcss.com/docs/transform-origin\n       */\n      'transform-origin': [{\n        origin: ['center', 'top', 'top-right', 'right', 'bottom-right', 'bottom', 'bottom-left', 'left', 'top-left', isArbitraryValue]\n      }],\n      // Interactivity\n      /**\n       * Accent Color\n       * @see https://tailwindcss.com/docs/accent-color\n       */\n      accent: [{\n        accent: ['auto', colors]\n      }],\n      /**\n       * Appearance\n       * @see https://tailwindcss.com/docs/appearance\n       */\n      appearance: [{\n        appearance: ['none', 'auto']\n      }],\n      /**\n       * Cursor\n       * @see https://tailwindcss.com/docs/cursor\n       */\n      cursor: [{\n        cursor: ['auto', 'default', 'pointer', 'wait', 'text', 'move', 'help', 'not-allowed', 'none', 'context-menu', 'progress', 'cell', 'crosshair', 'vertical-text', 'alias', 'copy', 'no-drop', 'grab', 'grabbing', 'all-scroll', 'col-resize', 'row-resize', 'n-resize', 'e-resize', 's-resize', 'w-resize', 'ne-resize', 'nw-resize', 'se-resize', 'sw-resize', 'ew-resize', 'ns-resize', 'nesw-resize', 'nwse-resize', 'zoom-in', 'zoom-out', isArbitraryValue]\n      }],\n      /**\n       * Caret Color\n       * @see https://tailwindcss.com/docs/just-in-time-mode#caret-color-utilities\n       */\n      'caret-color': [{\n        caret: [colors]\n      }],\n      /**\n       * Pointer Events\n       * @see https://tailwindcss.com/docs/pointer-events\n       */\n      'pointer-events': [{\n        'pointer-events': ['none', 'auto']\n      }],\n      /**\n       * Resize\n       * @see https://tailwindcss.com/docs/resize\n       */\n      resize: [{\n        resize: ['none', 'y', 'x', '']\n      }],\n      /**\n       * Scroll Behavior\n       * @see https://tailwindcss.com/docs/scroll-behavior\n       */\n      'scroll-behavior': [{\n        scroll: ['auto', 'smooth']\n      }],\n      /**\n       * Scroll Margin\n       * @see https://tailwindcss.com/docs/scroll-margin\n       */\n      'scroll-m': [{\n        'scroll-m': getSpacingWithArbitrary()\n      }],\n      /**\n       * Scroll Margin X\n       * @see https://tailwindcss.com/docs/scroll-margin\n       */\n      'scroll-mx': [{\n        'scroll-mx': getSpacingWithArbitrary()\n      }],\n      /**\n       * Scroll Margin Y\n       * @see https://tailwindcss.com/docs/scroll-margin\n       */\n      'scroll-my': [{\n        'scroll-my': getSpacingWithArbitrary()\n      }],\n      /**\n       * Scroll Margin Start\n       * @see https://tailwindcss.com/docs/scroll-margin\n       */\n      'scroll-ms': [{\n        'scroll-ms': getSpacingWithArbitrary()\n      }],\n      /**\n       * Scroll Margin End\n       * @see https://tailwindcss.com/docs/scroll-margin\n       */\n      'scroll-me': [{\n        'scroll-me': getSpacingWithArbitrary()\n      }],\n      /**\n       * Scroll Margin Top\n       * @see https://tailwindcss.com/docs/scroll-margin\n       */\n      'scroll-mt': [{\n        'scroll-mt': getSpacingWithArbitrary()\n      }],\n      /**\n       * Scroll Margin Right\n       * @see https://tailwindcss.com/docs/scroll-margin\n       */\n      'scroll-mr': [{\n        'scroll-mr': getSpacingWithArbitrary()\n      }],\n      /**\n       * Scroll Margin Bottom\n       * @see https://tailwindcss.com/docs/scroll-margin\n       */\n      'scroll-mb': [{\n        'scroll-mb': getSpacingWithArbitrary()\n      }],\n      /**\n       * Scroll Margin Left\n       * @see https://tailwindcss.com/docs/scroll-margin\n       */\n      'scroll-ml': [{\n        'scroll-ml': getSpacingWithArbitrary()\n      }],\n      /**\n       * Scroll Padding\n       * @see https://tailwindcss.com/docs/scroll-padding\n       */\n      'scroll-p': [{\n        'scroll-p': getSpacingWithArbitrary()\n      }],\n      /**\n       * Scroll Padding X\n       * @see https://tailwindcss.com/docs/scroll-padding\n       */\n      'scroll-px': [{\n        'scroll-px': getSpacingWithArbitrary()\n      }],\n      /**\n       * Scroll Padding Y\n       * @see https://tailwindcss.com/docs/scroll-padding\n       */\n      'scroll-py': [{\n        'scroll-py': getSpacingWithArbitrary()\n      }],\n      /**\n       * Scroll Padding Start\n       * @see https://tailwindcss.com/docs/scroll-padding\n       */\n      'scroll-ps': [{\n        'scroll-ps': getSpacingWithArbitrary()\n      }],\n      /**\n       * Scroll Padding End\n       * @see https://tailwindcss.com/docs/scroll-padding\n       */\n      'scroll-pe': [{\n        'scroll-pe': getSpacingWithArbitrary()\n      }],\n      /**\n       * Scroll Padding Top\n       * @see https://tailwindcss.com/docs/scroll-padding\n       */\n      'scroll-pt': [{\n        'scroll-pt': getSpacingWithArbitrary()\n      }],\n      /**\n       * Scroll Padding Right\n       * @see https://tailwindcss.com/docs/scroll-padding\n       */\n      'scroll-pr': [{\n        'scroll-pr': getSpacingWithArbitrary()\n      }],\n      /**\n       * Scroll Padding Bottom\n       * @see https://tailwindcss.com/docs/scroll-padding\n       */\n      'scroll-pb': [{\n        'scroll-pb': getSpacingWithArbitrary()\n      }],\n      /**\n       * Scroll Padding Left\n       * @see https://tailwindcss.com/docs/scroll-padding\n       */\n      'scroll-pl': [{\n        'scroll-pl': getSpacingWithArbitrary()\n      }],\n      /**\n       * Scroll Snap Align\n       * @see https://tailwindcss.com/docs/scroll-snap-align\n       */\n      'snap-align': [{\n        snap: ['start', 'end', 'center', 'align-none']\n      }],\n      /**\n       * Scroll Snap Stop\n       * @see https://tailwindcss.com/docs/scroll-snap-stop\n       */\n      'snap-stop': [{\n        snap: ['normal', 'always']\n      }],\n      /**\n       * Scroll Snap Type\n       * @see https://tailwindcss.com/docs/scroll-snap-type\n       */\n      'snap-type': [{\n        snap: ['none', 'x', 'y', 'both']\n      }],\n      /**\n       * Scroll Snap Type Strictness\n       * @see https://tailwindcss.com/docs/scroll-snap-type\n       */\n      'snap-strictness': [{\n        snap: ['mandatory', 'proximity']\n      }],\n      /**\n       * Touch Action\n       * @see https://tailwindcss.com/docs/touch-action\n       */\n      touch: [{\n        touch: ['auto', 'none', 'manipulation']\n      }],\n      /**\n       * Touch Action X\n       * @see https://tailwindcss.com/docs/touch-action\n       */\n      'touch-x': [{\n        'touch-pan': ['x', 'left', 'right']\n      }],\n      /**\n       * Touch Action Y\n       * @see https://tailwindcss.com/docs/touch-action\n       */\n      'touch-y': [{\n        'touch-pan': ['y', 'up', 'down']\n      }],\n      /**\n       * Touch Action Pinch Zoom\n       * @see https://tailwindcss.com/docs/touch-action\n       */\n      'touch-pz': ['touch-pinch-zoom'],\n      /**\n       * User Select\n       * @see https://tailwindcss.com/docs/user-select\n       */\n      select: [{\n        select: ['none', 'text', 'all', 'auto']\n      }],\n      /**\n       * Will Change\n       * @see https://tailwindcss.com/docs/will-change\n       */\n      'will-change': [{\n        'will-change': ['auto', 'scroll', 'contents', 'transform', isArbitraryValue]\n      }],\n      // SVG\n      /**\n       * Fill\n       * @see https://tailwindcss.com/docs/fill\n       */\n      fill: [{\n        fill: [colors, 'none']\n      }],\n      /**\n       * Stroke Width\n       * @see https://tailwindcss.com/docs/stroke-width\n       */\n      'stroke-w': [{\n        stroke: [isLength, isArbitraryLength, isArbitraryNumber]\n      }],\n      /**\n       * Stroke\n       * @see https://tailwindcss.com/docs/stroke\n       */\n      stroke: [{\n        stroke: [colors, 'none']\n      }],\n      // Accessibility\n      /**\n       * Screen Readers\n       * @see https://tailwindcss.com/docs/screen-readers\n       */\n      sr: ['sr-only', 'not-sr-only'],\n      /**\n       * Forced Color Adjust\n       * @see https://tailwindcss.com/docs/forced-color-adjust\n       */\n      'forced-color-adjust': [{\n        'forced-color-adjust': ['auto', 'none']\n      }]\n    },\n    conflictingClassGroups: {\n      overflow: ['overflow-x', 'overflow-y'],\n      overscroll: ['overscroll-x', 'overscroll-y'],\n      inset: ['inset-x', 'inset-y', 'start', 'end', 'top', 'right', 'bottom', 'left'],\n      'inset-x': ['right', 'left'],\n      'inset-y': ['top', 'bottom'],\n      flex: ['basis', 'grow', 'shrink'],\n      gap: ['gap-x', 'gap-y'],\n      p: ['px', 'py', 'ps', 'pe', 'pt', 'pr', 'pb', 'pl'],\n      px: ['pr', 'pl'],\n      py: ['pt', 'pb'],\n      m: ['mx', 'my', 'ms', 'me', 'mt', 'mr', 'mb', 'ml'],\n      mx: ['mr', 'ml'],\n      my: ['mt', 'mb'],\n      size: ['w', 'h'],\n      'font-size': ['leading'],\n      'fvn-normal': ['fvn-ordinal', 'fvn-slashed-zero', 'fvn-figure', 'fvn-spacing', 'fvn-fraction'],\n      'fvn-ordinal': ['fvn-normal'],\n      'fvn-slashed-zero': ['fvn-normal'],\n      'fvn-figure': ['fvn-normal'],\n      'fvn-spacing': ['fvn-normal'],\n      'fvn-fraction': ['fvn-normal'],\n      'line-clamp': ['display', 'overflow'],\n      rounded: ['rounded-s', 'rounded-e', 'rounded-t', 'rounded-r', 'rounded-b', 'rounded-l', 'rounded-ss', 'rounded-se', 'rounded-ee', 'rounded-es', 'rounded-tl', 'rounded-tr', 'rounded-br', 'rounded-bl'],\n      'rounded-s': ['rounded-ss', 'rounded-es'],\n      'rounded-e': ['rounded-se', 'rounded-ee'],\n      'rounded-t': ['rounded-tl', 'rounded-tr'],\n      'rounded-r': ['rounded-tr', 'rounded-br'],\n      'rounded-b': ['rounded-br', 'rounded-bl'],\n      'rounded-l': ['rounded-tl', 'rounded-bl'],\n      'border-spacing': ['border-spacing-x', 'border-spacing-y'],\n      'border-w': ['border-w-s', 'border-w-e', 'border-w-t', 'border-w-r', 'border-w-b', 'border-w-l'],\n      'border-w-x': ['border-w-r', 'border-w-l'],\n      'border-w-y': ['border-w-t', 'border-w-b'],\n      'border-color': ['border-color-s', 'border-color-e', 'border-color-t', 'border-color-r', 'border-color-b', 'border-color-l'],\n      'border-color-x': ['border-color-r', 'border-color-l'],\n      'border-color-y': ['border-color-t', 'border-color-b'],\n      'scroll-m': ['scroll-mx', 'scroll-my', 'scroll-ms', 'scroll-me', 'scroll-mt', 'scroll-mr', 'scroll-mb', 'scroll-ml'],\n      'scroll-mx': ['scroll-mr', 'scroll-ml'],\n      'scroll-my': ['scroll-mt', 'scroll-mb'],\n      'scroll-p': ['scroll-px', 'scroll-py', 'scroll-ps', 'scroll-pe', 'scroll-pt', 'scroll-pr', 'scroll-pb', 'scroll-pl'],\n      'scroll-px': ['scroll-pr', 'scroll-pl'],\n      'scroll-py': ['scroll-pt', 'scroll-pb'],\n      touch: ['touch-x', 'touch-y', 'touch-pz'],\n      'touch-x': ['touch'],\n      'touch-y': ['touch'],\n      'touch-pz': ['touch']\n    },\n    conflictingClassGroupModifiers: {\n      'font-size': ['leading']\n    }\n  };\n};\n\n/**\n * @param baseConfig Config where other config will be merged into. This object will be mutated.\n * @param configExtension Partial config to merge into the `baseConfig`.\n */\nconst mergeConfigs = (baseConfig, {\n  cacheSize,\n  prefix,\n  separator,\n  experimentalParseClassName,\n  extend = {},\n  override = {}\n}) => {\n  overrideProperty(baseConfig, 'cacheSize', cacheSize);\n  overrideProperty(baseConfig, 'prefix', prefix);\n  overrideProperty(baseConfig, 'separator', separator);\n  overrideProperty(baseConfig, 'experimentalParseClassName', experimentalParseClassName);\n  for (const configKey in override) {\n    overrideConfigProperties(baseConfig[configKey], override[configKey]);\n  }\n  for (const key in extend) {\n    mergeConfigProperties(baseConfig[key], extend[key]);\n  }\n  return baseConfig;\n};\nconst overrideProperty = (baseObject, overrideKey, overrideValue) => {\n  if (overrideValue !== undefined) {\n    baseObject[overrideKey] = overrideValue;\n  }\n};\nconst overrideConfigProperties = (baseObject, overrideObject) => {\n  if (overrideObject) {\n    for (const key in overrideObject) {\n      overrideProperty(baseObject, key, overrideObject[key]);\n    }\n  }\n};\nconst mergeConfigProperties = (baseObject, mergeObject) => {\n  if (mergeObject) {\n    for (const key in mergeObject) {\n      const mergeValue = mergeObject[key];\n      if (mergeValue !== undefined) {\n        baseObject[key] = (baseObject[key] || []).concat(mergeValue);\n      }\n    }\n  }\n};\nconst extendTailwindMerge = (configExtension, ...createConfig) => typeof configExtension === 'function' ? createTailwindMerge(getDefaultConfig, configExtension, ...createConfig) : createTailwindMerge(() => mergeConfigs(getDefaultConfig(), configExtension), ...createConfig);\nconst twMerge = /*#__PURE__*/createTailwindMerge(getDefaultConfig);\nexport { createTailwindMerge, extendTailwindMerge, fromTheme, getDefaultConfig, mergeConfigs, twJoin, twMerge, validators };\n//# sourceMappingURL=bundle-mjs.mjs.map\n","import { clsx, type ClassValue } from \"clsx\"\nimport { twMerge } from \"tailwind-merge\"\n\nexport function cn(...inputs: ClassValue[]) {\n  return twMerge(clsx(inputs))\n}\n\nexport function formatLastSync(lastSync: string | null | undefined): string {\n  if (!lastSync) return \"Never\";\n  \n  const date = new Date(lastSync);\n  const now = new Date();\n  const diffMs = now.getTime() - date.getTime();\n  const diffMins = Math.floor(diffMs / 60000);\n  const diffHours = Math.floor(diffMs / 3600000);\n  const diffDays = Math.floor(diffMs / 86400000);\n  \n  if (diffMins < 1) return \"Just now\";\n  if (diffMins < 60) return `${diffMins} minute${diffMins > 1 ? 's' : ''} ago`;\n  if (diffHours < 24) return `${diffHours} hour${diffHours > 1 ? 's' : ''} ago`;\n  if (diffDays < 7) return `${diffDays} day${diffDays > 1 ? 's' : ''} ago`;\n  \n  return date.toLocaleDateString('en-US', { month: 'short', day: 'numeric', year: 'numeric' });\n}\n","import * as React from \"react\"\nimport { Slot } from \"@radix-ui/react-slot\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\n\nimport { cn } from \"@/lib/utils\"\n\nconst buttonVariants = cva(\n  \"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0\",\n  {\n    variants: {\n      variant: {\n        default: \"bg-primary text-primary-foreground hover:bg-primary/90\",\n        destructive:\n          \"bg-destructive text-destructive-foreground hover:bg-destructive/90\",\n        outline:\n          \"border border-input bg-background hover:bg-accent hover:text-accent-foreground\",\n        secondary:\n          \"bg-secondary text-secondary-foreground hover:bg-secondary/80\",\n        ghost: \"hover:bg-accent hover:text-accent-foreground\",\n        link: \"text-primary underline-offset-4 hover:underline\",\n        factorcloud: \"bg-factorcloud-primary text-factorcloud-primary-foreground hover:bg-factorcloud-primary/90\",\n        success: \"bg-factorcloud-success text-factorcloud-success-foreground hover:bg-factorcloud-success/90\",\n        tab: \"bg-transparent border-b-2 border-transparent hover:bg-muted/50 data-[state=active]:border-factorcloud-primary data-[state=active]:bg-background data-[state=active]:shadow-sm rounded-b-none\",\n      },\n      size: {\n        default: \"h-10 px-4 py-2\",\n        sm: \"h-9 rounded-md px-3\",\n        lg: \"h-11 rounded-md px-8\",\n        icon: \"h-10 w-10\",\n        tab: \"h-12 px-6 rounded-t-lg\",\n      },\n    },\n    defaultVariants: {\n      variant: \"default\",\n      size: \"default\",\n    },\n  }\n)\n\nexport interface ButtonProps\n  extends React.ButtonHTMLAttributes<HTMLButtonElement>,\n    VariantProps<typeof buttonVariants> {\n  asChild?: boolean\n}\n\nconst Button = React.forwardRef<HTMLButtonElement, ButtonProps>(\n  ({ className, variant, size, asChild = false, ...props }, ref) => {\n    const Comp = asChild ? Slot : \"button\"\n    return (\n      <Comp\n        className={cn(buttonVariants({ variant, size, className }))}\n        ref={ref}\n        {...props}\n      />\n    )\n  }\n)\nButton.displayName = \"Button\"\n\nexport { Button, buttonVariants }\n","import * as React from \"react\"\n\nimport type {\n  ToastActionElement,\n  ToastProps,\n} from \"@/components/ui/toast\"\n\nconst TOAST_LIMIT = 1\nconst TOAST_REMOVE_DELAY = 1000000\n\ntype ToasterToast = ToastProps & {\n  id: string\n  title?: React.ReactNode\n  description?: React.ReactNode\n  action?: ToastActionElement\n}\n\nconst actionTypes = {\n  ADD_TOAST: \"ADD_TOAST\",\n  UPDATE_TOAST: \"UPDATE_TOAST\",\n  DISMISS_TOAST: \"DISMISS_TOAST\",\n  REMOVE_TOAST: \"REMOVE_TOAST\",\n} as const\n\nlet count = 0\n\nfunction genId() {\n  count = (count + 1) % Number.MAX_SAFE_INTEGER\n  return count.toString()\n}\n\ntype ActionType = typeof actionTypes\n\ntype Action =\n  | {\n      type: ActionType[\"ADD_TOAST\"]\n      toast: ToasterToast\n    }\n  | {\n      type: ActionType[\"UPDATE_TOAST\"]\n      toast: Partial<ToasterToast>\n    }\n  | {\n      type: ActionType[\"DISMISS_TOAST\"]\n      toastId?: ToasterToast[\"id\"]\n    }\n  | {\n      type: ActionType[\"REMOVE_TOAST\"]\n      toastId?: ToasterToast[\"id\"]\n    }\n\ninterface State {\n  toasts: ToasterToast[]\n}\n\nconst toastTimeouts = new Map<string, ReturnType<typeof setTimeout>>()\n\nconst addToRemoveQueue = (toastId: string) => {\n  if (toastTimeouts.has(toastId)) {\n    return\n  }\n\n  const timeout = setTimeout(() => {\n    toastTimeouts.delete(toastId)\n    dispatch({\n      type: \"REMOVE_TOAST\",\n      toastId: toastId,\n    })\n  }, TOAST_REMOVE_DELAY)\n\n  toastTimeouts.set(toastId, timeout)\n}\n\nexport const reducer = (state: State, action: Action): State => {\n  switch (action.type) {\n    case \"ADD_TOAST\":\n      return {\n        ...state,\n        toasts: [action.toast, ...state.toasts].slice(0, TOAST_LIMIT),\n      }\n\n    case \"UPDATE_TOAST\":\n      return {\n        ...state,\n        toasts: state.toasts.map((t) =>\n          t.id === action.toast.id ? { ...t, ...action.toast } : t\n        ),\n      }\n\n    case \"DISMISS_TOAST\": {\n      const { toastId } = action\n\n      // ! Side effects ! - This could be extracted into a dismissToast() action,\n      // but I'll keep it here for simplicity\n      if (toastId) {\n        addToRemoveQueue(toastId)\n      } else {\n        state.toasts.forEach((toast) => {\n          addToRemoveQueue(toast.id)\n        })\n      }\n\n      return {\n        ...state,\n        toasts: state.toasts.map((t) =>\n          t.id === toastId || toastId === undefined\n            ? {\n                ...t,\n                open: false,\n              }\n            : t\n        ),\n      }\n    }\n    case \"REMOVE_TOAST\":\n      if (action.toastId === undefined) {\n        return {\n          ...state,\n          toasts: [],\n        }\n      }\n      return {\n        ...state,\n        toasts: state.toasts.filter((t) => t.id !== action.toastId),\n      }\n  }\n}\n\nconst listeners: Array<(state: State) => void> = []\n\nlet memoryState: State = { toasts: [] }\n\nfunction dispatch(action: Action) {\n  memoryState = reducer(memoryState, action)\n  listeners.forEach((listener) => {\n    listener(memoryState)\n  })\n}\n\ntype Toast = Omit<ToasterToast, \"id\">\n\nfunction toast({ ...props }: Toast) {\n  const id = genId()\n\n  const update = (props: ToasterToast) =>\n    dispatch({\n      type: \"UPDATE_TOAST\",\n      toast: { ...props, id },\n    })\n  const dismiss = () => dispatch({ type: \"DISMISS_TOAST\", toastId: id })\n\n  dispatch({\n    type: \"ADD_TOAST\",\n    toast: {\n      ...props,\n      id,\n      open: true,\n      onOpenChange: (open) => {\n        if (!open) dismiss()\n      },\n    },\n  })\n\n  return {\n    id: id,\n    dismiss,\n    update,\n  }\n}\n\nfunction useToast() {\n  const [state, setState] = React.useState<State>(memoryState)\n\n  React.useEffect(() => {\n    listeners.push(setState)\n    return () => {\n      const index = listeners.indexOf(setState)\n      if (index > -1) {\n        listeners.splice(index, 1)\n      }\n    }\n  }, [state])\n\n  return {\n    ...state,\n    toast,\n    dismiss: (toastId?: string) => dispatch({ type: \"DISMISS_TOAST\", toastId }),\n  }\n}\n\nexport { useToast, toast }\n","export interface SDKConfig {\n  // PortalDuct Configuration\n  portalduct: {\n    bearer_token: string;\n    env_url: string;  // e.g., \"https://sandbox.portalduct.com\"\n    customer_id: string;\n    /**\n     * Dedicated bearer token used exclusively for Supabase webhook calls.\n     */\n    webhook_bearer_token?: string;\n    /**\n     * Deployment environment identifier used by webhook integrations.\n     * Defaults to \"sandbox\" when the PortalDuct environment URL contains\n     * \"sandbox\" and \"production\" otherwise.\n     */\n    environment?: string;\n    /**\n     * Optional override for the webhook endpoint used to trigger connection syncs.\n     */\n    sync_webhook_url?: string;\n    /**\n     * Optional override for the webhook endpoint used to trigger connection verification.\n     */\n    verify_webhook_url?: string;\n  };\n  \n  // FactorCloud Configuration\n  factorcloud: {\n    bearer_token: string;\n    factorId: string;\n    env_url: string;  // e.g., \"https://api.int.factorcloud.com\"\n    client_id?: string;  // Optional - if not provided, user selects from list\n  };\n}\n\nexport interface CustomerStatusPayload {\n  active: boolean;\n  customer?: {\n    portalduct_customer_uuid?: string | null;\n  } | null;\n  factorcloud?: {\n    bearer_token?: string | null;\n    api_url?: string | null;\n  } | null;\n  portalduct?: {\n    bearer_token?: string | null;\n    api_url?: string | null;\n  } | null;\n}\n\nconst deriveEnvironmentFromUrl = (url?: string): string | undefined => {\n  if (!url) {\n    return undefined;\n  }\n\n  return url.toLowerCase().includes(\"sandbox\") ? \"sandbox\" : \"production\";\n};\n\nexport const isConfigComplete = (config: Partial<SDKConfig> | null): config is SDKConfig => {\n  if (!config) return false;\n\n  return !!(\n    config.portalduct?.bearer_token &&\n    config.portalduct?.env_url &&\n    config.portalduct?.customer_id &&\n    config.factorcloud?.bearer_token &&\n    config.factorcloud?.factorId &&\n    config.factorcloud?.env_url\n  );\n};\n\nexport const mergeCustomerStatusWithConfig = (\n  config: Partial<SDKConfig> | null | undefined,\n  status: CustomerStatusPayload\n): SDKConfig | null => {\n  if (!config?.factorcloud?.factorId) {\n    return null;\n  }\n\n  const portalductApiUrl =\n    status.portalduct?.api_url ?? config.portalduct?.env_url ?? \"\";\n  const portalductEnvironment =\n    config.portalduct?.environment ?? deriveEnvironmentFromUrl(portalductApiUrl);\n\n  return {\n    portalduct: {\n      bearer_token:\n        status.portalduct?.bearer_token ?? config.portalduct?.bearer_token ?? \"\",\n      env_url: portalductApiUrl,\n      customer_id:\n        status.customer?.portalduct_customer_uuid ??\n        config.portalduct?.customer_id ??\n        \"\",\n      webhook_bearer_token: config.portalduct?.webhook_bearer_token,\n      environment: portalductEnvironment,\n      sync_webhook_url: config.portalduct?.sync_webhook_url,\n      verify_webhook_url: config.portalduct?.verify_webhook_url,\n    },\n    factorcloud: {\n      bearer_token:\n        status.factorcloud?.bearer_token ?? config.factorcloud?.bearer_token ?? \"\",\n      factorId: config.factorcloud.factorId,\n      env_url:\n        status.factorcloud?.api_url ?? config.factorcloud?.env_url ?? \"\",\n      client_id: config.factorcloud?.client_id,\n    },\n  };\n};\n","import {\n  FactorCloudClient,\n  FactorCloudClientDetail,\n  FactorCloudClientsResponse,\n  FactorCloudClientDetailResponse,\n  FactorCloudDebtor,\n  FactorCloudDebtorsResponse,\n} from \"@/types/factorcloud\";\n\nexport class FactorCloudAPI {\n  private baseUrl: string;\n  private factorId: string;\n  private token: string;\n\n  constructor(baseUrl: string, factorId: string, bearerToken: string) {\n    this.baseUrl = baseUrl;\n    this.factorId = factorId;\n    this.token = bearerToken;\n  }\n\n  async getClients(limit = 100, page = 0): Promise<FactorCloudClient[]> {\n    if (!this.token) {\n      throw new Error(\"No bearer token provided.\");\n    }\n\n    const response = await fetch(\n      `${this.baseUrl}/companies?active=true&type=client`,\n      {\n        method: \"GET\",\n        headers: {\n          \"Authorization\": `Bearer ${this.token}`,\n          \"X-PAGINATION-LIMIT\": limit.toString(),\n          \"X-PAGINATION-NUM\": page.toString(),\n          \"accept\": \"application/json\",\n          \"factorId\": this.factorId,\n        },\n      }\n    );\n\n    if (!response.ok) {\n      throw new Error(`Failed to fetch clients: ${response.statusText}`);\n    }\n\n    const data: FactorCloudClientsResponse = await response.json();\n    return data.companies;\n  }\n\n  async getClientById(clientId: string): Promise<FactorCloudClientDetail> {\n    if (!this.token) {\n      throw new Error(\"No bearer token provided.\");\n    }\n\n    const response = await fetch(`${this.baseUrl}/clients/${clientId}`, {\n      method: \"GET\",\n      headers: {\n        \"Authorization\": `Bearer ${this.token}`,\n        \"accept\": \"application/json\",\n        \"factorId\": this.factorId,\n      },\n    });\n\n    if (!response.ok) {\n      throw new Error(`Failed to fetch client details: ${response.statusText}`);\n    }\n\n    const data: FactorCloudClientDetailResponse = await response.json();\n    return data.client;\n  }\n\n  async getDebtors(clientId: string, limit = 100, page = 0): Promise<FactorCloudDebtor[]> {\n    if (!this.token) {\n      throw new Error(\"No bearer token provided.\");\n    }\n\n    const response = await fetch(\n      `${this.baseUrl}/clients/${clientId}/debtors`,\n      {\n        method: \"GET\",\n        headers: {\n          \"Authorization\": `Bearer ${this.token}`,\n          \"X-PAGINATION-LIMIT\": limit.toString(),\n          \"X-PAGINATION-NUM\": page.toString(),\n          \"accept\": \"application/json\",\n          \"factorId\": this.factorId,\n        },\n      }\n    );\n\n    if (!response.ok) {\n      throw new Error(`Failed to fetch debtors: ${response.statusText}`);\n    }\n\n    const data: FactorCloudDebtorsResponse = await response.json();\n    return data.clientDebtors;\n  }\n\n  setToken(token: string) {\n    this.token = token;\n  }\n\n  getToken(): string {\n    return this.token;\n  }\n}\n","import {\n  PortalDuctCompany,\n  PortalDuctCompaniesResponse,\n  PortalDuctCompanyResponse,\n  PortalDuctConnection,\n  PortalDuctConnectionsResponse,\n  PortalDuctConnectionResponse,\n  CreateCompanyRequest,\n  CreateConnectionRequest,\n  UpdateConnectionRequest,\n  ActivationRequest,\n  PortalMapping,\n  PortalMappingsResponse,\n  PortalMappingResponse,\n  CreatePortalMappingRequest,\n} from \"@/types/portalduct\";\n\nexport class PortalDuctAPIError extends Error {\n  status: number;\n  code?: string;\n  type?: string;\n  requestId?: string;\n\n  constructor({\n    message,\n    status,\n    code,\n    type,\n    requestId,\n  }: {\n    message: string;\n    status: number;\n    code?: string;\n    type?: string;\n    requestId?: string;\n  }) {\n    super(message);\n    this.name = \"PortalDuctAPIError\";\n    this.status = status;\n    this.code = code;\n    this.type = type;\n    this.requestId = requestId;\n  }\n}\n\nexport class PortalDuctAPI {\n  private baseUrl: string;\n  private token: string;\n\n  constructor(\n    baseUrl: string,\n    bearerToken: string\n  ) {\n    this.baseUrl = baseUrl;\n    this.token = bearerToken;\n  }\n\n  private async buildError(\n    response: Response,\n    fallbackMessage: string\n  ): Promise<PortalDuctAPIError> {\n    let message = fallbackMessage;\n    let code: string | undefined;\n    let type: string | undefined;\n    let requestId: string | undefined;\n\n    try {\n      const body = await response.json();\n      if (body && typeof body === \"object\") {\n        message =\n          (\"error_message\" in body && typeof body.error_message === \"string\"\n            ? body.error_message\n            : undefined) ??\n          (\"message\" in body && typeof body.message === \"string\"\n            ? body.message\n            : undefined) ??\n          message;\n        code =\n          (\"error_code\" in body && typeof body.error_code === \"string\"\n            ? body.error_code\n            : undefined) ??\n          (\"code\" in body && typeof body.code === \"string\"\n            ? body.code\n            : undefined) ??\n          code;\n        type =\n          (\"error_type\" in body && typeof body.error_type === \"string\"\n            ? body.error_type\n            : undefined) ??\n          (\"type\" in body && typeof body.type === \"string\"\n            ? body.type\n            : undefined) ??\n          type;\n        requestId =\n          (\"request_id\" in body && typeof body.request_id === \"string\"\n            ? body.request_id\n            : undefined) ??\n          (\"requestId\" in body && typeof body.requestId === \"string\"\n            ? body.requestId\n            : undefined) ??\n          requestId;\n      }\n    } catch (error) {\n      console.debug(\"Failed to parse PortalDuct error response\", error);\n    }\n\n    return new PortalDuctAPIError({\n      message,\n      status: response.status,\n      code,\n      type,\n      requestId,\n    });\n  }\n\n  async getCompanies(customerId: string): Promise<PortalDuctCompany[]> {\n    if (!this.token) {\n      throw new Error(\"No bearer token provided.\");\n    }\n\n    const filter = encodeURIComponent(`customer_id eq ${customerId}`);\n    const response = await fetch(`${this.baseUrl}/v2/companies?filter=${filter}`, {\n      method: \"GET\",\n      headers: {\n        \"accept\": \"application/json\",\n        \"authorization\": `Bearer ${this.token}`,\n      },\n    });\n\n    if (!response.ok) {\n      throw await this.buildError(response, \"Failed to fetch companies\");\n    }\n\n    const data: PortalDuctCompaniesResponse = await response.json();\n    return data.data;\n  }\n\n  async createCompany(request: CreateCompanyRequest): Promise<PortalDuctCompany> {\n    if (!this.token) {\n      throw new Error(\"No bearer token provided.\");\n    }\n\n    const response = await fetch(`${this.baseUrl}/v2/companies`, {\n      method: \"POST\",\n      headers: {\n        \"accept\": \"application/json\",\n        \"authorization\": `Bearer ${this.token}`,\n        \"content-type\": \"application/json\",\n      },\n      body: JSON.stringify(request),\n    });\n\n    if (!response.ok) {\n      throw await this.buildError(response, \"Failed to create company\");\n    }\n\n    const data: PortalDuctCompanyResponse = await response.json();\n    return data.data;\n  }\n\n  async getConnections(companyId: string): Promise<PortalDuctConnection[]> {\n    if (!this.token) {\n      throw new Error(\"No bearer token provided.\");\n    }\n\n    const filter = encodeURIComponent(`company.company_id eq '${companyId}'`);\n    const response = await fetch(`${this.baseUrl}/v2/connections?filter=${filter}`, {\n      method: \"GET\",\n      headers: {\n        \"accept\": \"application/json\",\n        \"authorization\": `Bearer ${this.token}`,\n      },\n    });\n\n    if (!response.ok) {\n      throw await this.buildError(response, \"Failed to fetch connections\");\n    }\n\n    const data: PortalDuctConnectionsResponse = await response.json();\n    return data.data;\n  }\n\n  async createConnection(request: CreateConnectionRequest): Promise<PortalDuctConnection> {\n    if (!this.token) {\n      throw new Error(\"No bearer token provided.\");\n    }\n\n    const response = await fetch(`${this.baseUrl}/v2/connections`, {\n      method: \"POST\",\n      headers: {\n        \"accept\": \"application/json\",\n        \"authorization\": `Bearer ${this.token}`,\n        \"content-type\": \"application/json\",\n      },\n      body: JSON.stringify(request),\n    });\n\n    if (!response.ok) {\n      throw await this.buildError(response, \"Failed to create connection\");\n    }\n\n    const data: PortalDuctConnectionResponse = await response.json();\n    return data.data;\n  }\n\n  async updateConnection(\n    connectionId: string,\n    request: UpdateConnectionRequest\n  ): Promise<PortalDuctConnection> {\n    if (!this.token) {\n      throw new Error(\"No bearer token provided.\");\n    }\n\n    const response = await fetch(`${this.baseUrl}/v2/connections/${connectionId}`, {\n      method: \"PATCH\",\n      headers: {\n        \"accept\": \"application/json\",\n        \"authorization\": `Bearer ${this.token}`,\n        \"content-type\": \"application/json\",\n      },\n      body: JSON.stringify(request),\n    });\n\n    if (!response.ok) {\n      throw await this.buildError(response, \"Failed to update connection\");\n    }\n\n    const data: PortalDuctConnectionResponse = await response.json();\n    return data.data;\n  }\n\n  async activateConnection(connectionId: string): Promise<PortalDuctConnection> {\n    return this.updateActivationStatus(connectionId, \"activate\");\n  }\n\n  async deactivateConnection(connectionId: string): Promise<PortalDuctConnection> {\n    return this.updateActivationStatus(connectionId, \"deactivate\");\n  }\n\n  private async updateActivationStatus(\n    connectionId: string,\n    status: \"activate\" | \"deactivate\"\n  ): Promise<PortalDuctConnection> {\n    if (!this.token) {\n      throw new Error(\"No bearer token provided.\");\n    }\n\n    const request: ActivationRequest = { activation_status: status };\n    const response = await fetch(\n      `${this.baseUrl}/v2/connections/${connectionId}/activation`,\n      {\n        method: \"POST\",\n        headers: {\n          \"accept\": \"application/json\",\n          \"authorization\": `Bearer ${this.token}`,\n          \"content-type\": \"application/json\",\n        },\n        body: JSON.stringify(request),\n      }\n    );\n\n    if (!response.ok) {\n      throw await this.buildError(\n        response,\n        `Failed to ${status} connection`\n      );\n    }\n\n    const data: PortalDuctConnectionResponse = await response.json();\n    return data.data;\n  }\n\n  setToken(token: string) {\n    this.token = token;\n  }\n\n  getToken(): string {\n    return this.token;\n  }\n\n  async getPortalMappings(): Promise<PortalMapping[]> {\n    if (!this.token) {\n      throw new Error(\"No bearer token provided.\");\n    }\n\n    const response = await fetch(`${this.baseUrl}/v2/portal_mappings`, {\n      method: \"GET\",\n      headers: {\n        \"accept\": \"application/json\",\n        \"authorization\": `Bearer ${this.token}`,\n      },\n    });\n\n    if (!response.ok) {\n      throw await this.buildError(response, \"Failed to fetch portal mappings\");\n    }\n\n    const data: PortalMappingsResponse = await response.json();\n    return data.data;\n  }\n\n  async createPortalMapping(request: CreatePortalMappingRequest): Promise<PortalMapping> {\n    if (!this.token) {\n      throw new Error(\"No bearer token provided.\");\n    }\n\n    const response = await fetch(`${this.baseUrl}/v2/portal_mappings`, {\n      method: \"POST\",\n      headers: {\n        \"accept\": \"application/json\",\n        \"authorization\": `Bearer ${this.token}`,\n        \"content-type\": \"application/json\",\n      },\n      body: JSON.stringify(request),\n    });\n\n    if (!response.ok) {\n      throw await this.buildError(response, \"Failed to create portal mapping\");\n    }\n\n    const data: PortalMappingResponse = await response.json();\n    return data.data;\n  }\n}\n","import { CustomerStatusPayload } from \"@/types/config\";\nimport { ResyncResponse } from \"@/types/portalduct\";\n\nconst DEFAULT_SYNC_WEBHOOK_URL =\n  \"https://khzfuhxnbjlyjvdvxdeg.supabase.co/functions/v1/webhook-sync-connection\";\nconst DEFAULT_VERIFY_WEBHOOK_URL =\n  \"https://khzfuhxnbjlyjvdvxdeg.supabase.co/functions/v1/webhook-verify-connection\";\nconst DEFAULT_CUSTOMER_STATUS_WEBHOOK_URL =\n  \"https://khzfuhxnbjlyjvdvxdeg.supabase.co/functions/v1/check-customer-status\";\n\ntype Environment = \"sandbox\" | \"production\" | string;\n\ninterface ConnectionSyncOptions {\n  webhookToken?: string;\n  customerId?: string;\n  /**\n   * Optional override for the sync webhook URL. Defaults to the Supabase function.\n   */\n  webhookUrl?: string;\n  /**\n   * Optional override for the verification webhook URL. Defaults to the Supabase function.\n   */\n  verifyWebhookUrl?: string;\n  /**\n   * Explicit environment identifier to send to the webhook.\n   */\n  environment?: Environment;\n  /**\n   * PortalDuct environment URL, used for automatic environment detection when\n   * an explicit environment value isn't provided.\n   */\n  portalductBaseUrl?: string;\n  /**\n   * Optional override for the customer status webhook URL. Defaults to the Supabase function.\n   */\n  customerStatusUrl?: string;\n}\n\nexport class ConnectionSyncAPI {\n  private syncWebhookUrl: string;\n  private verifyWebhookUrl: string;\n  private webhookToken?: string;\n  private customerId?: string;\n  private environment: Environment;\n  private customerStatusUrl: string;\n\n  constructor({\n    webhookToken,\n    customerId,\n    webhookUrl = DEFAULT_SYNC_WEBHOOK_URL,\n    verifyWebhookUrl = DEFAULT_VERIFY_WEBHOOK_URL,\n    environment,\n    portalductBaseUrl,\n    customerStatusUrl = DEFAULT_CUSTOMER_STATUS_WEBHOOK_URL,\n  }: ConnectionSyncOptions) {\n    this.syncWebhookUrl = webhookUrl;\n    this.verifyWebhookUrl = verifyWebhookUrl;\n    this.webhookToken = webhookToken;\n    this.customerId = customerId;\n    this.environment =\n      environment ?? this.deriveEnvironmentFromBaseUrl(portalductBaseUrl);\n    this.customerStatusUrl = customerStatusUrl;\n  }\n\n  setWebhookToken(token: string) {\n    this.webhookToken = token;\n  }\n\n  setCustomerId(customerId: string) {\n    this.customerId = customerId;\n  }\n\n  setEnvironment(environment: Environment) {\n    this.environment = environment;\n  }\n\n  setWebhookUrl(webhookUrl: string) {\n    this.syncWebhookUrl = webhookUrl;\n  }\n\n  setVerifyWebhookUrl(webhookUrl: string) {\n    this.verifyWebhookUrl = webhookUrl;\n  }\n\n  setCustomerStatusUrl(webhookUrl: string) {\n    this.customerStatusUrl = webhookUrl;\n  }\n\n  async triggerConnectionSync(connectionId: string): Promise<ResyncResponse> {\n    return this.callWebhook(this.syncWebhookUrl, connectionId, \"Resync\");\n  }\n\n  async triggerConnectionVerification(\n    connectionId: string\n  ): Promise<ResyncResponse> {\n    return this.callWebhook(\n      this.verifyWebhookUrl,\n      connectionId,\n      \"Verification\"\n    );\n  }\n\n  private async callWebhook(\n    url: string,\n    connectionId: string,\n    operationLabel: string\n  ): Promise<ResyncResponse> {\n    if (!this.customerId) {\n      throw new Error(\n        `No PortalDuct customer ID provided for ${operationLabel.toLowerCase()} webhook.`\n      );\n    }\n\n    if (!this.webhookToken) {\n      throw new Error(\n        `No webhook bearer token provided for ${operationLabel.toLowerCase()} webhook.`\n      );\n    }\n\n    const response = await fetch(url, {\n      method: \"POST\",\n      headers: {\n        accept: \"application/json\",\n        authorization: `Bearer ${this.webhookToken}`,\n        \"content-type\": \"application/json\",\n      },\n      body: JSON.stringify({\n        portalductCustomerId: this.customerId,\n        connectionId,\n        environment: this.environment,\n      }),\n    });\n\n    if (!response.ok) {\n      const errorText = await response.text();\n      throw new Error(\n        `${operationLabel} failed: ${response.status} ${errorText}`\n      );\n    }\n\n    const data: ResyncResponse = await response.json();\n    return data;\n  }\n\n  private deriveEnvironmentFromBaseUrl(baseUrl?: string): Environment {\n    if (!baseUrl) {\n      return \"production\";\n    }\n\n    return baseUrl.toLowerCase().includes(\"sandbox\") ? \"sandbox\" : \"production\";\n  }\n\n  async fetchCustomerStatus(factorId: string): Promise<CustomerStatusPayload> {\n    if (!this.webhookToken) {\n      throw new Error(\n        \"No webhook bearer token provided for customer status webhook.\"\n      );\n    }\n\n    const response = await fetch(this.customerStatusUrl, {\n      method: \"POST\",\n      headers: {\n        accept: \"application/json\",\n        authorization: `Bearer ${this.webhookToken}`,\n        \"content-type\": \"application/json\",\n      },\n      body: JSON.stringify({\n        factorId,\n        environment: this.environment,\n      }),\n    });\n\n    if (!response.ok) {\n      const errorText = await response.text();\n      throw new Error(\n        `Customer status check failed: ${response.status} ${errorText}`\n      );\n    }\n\n    const data = (await response.json()) as CustomerStatusPayload;\n    if (typeof data.active !== \"boolean\") {\n      throw new Error(\"Customer status webhook returned an invalid response.\");\n    }\n\n    return data;\n  }\n\n  async isCustomerActive(factorId: string): Promise<boolean> {\n    const status = await this.fetchCustomerStatus(factorId);\n    return status.active;\n  }\n}\n","import { FactorCloudAPI } from \"@/api/factorcloud\";\nimport { PortalDuctAPI } from \"@/api/portalduct\";\nimport { ConnectionSyncAPI } from \"@/api/connectionSync\";\nimport { SDKConfig } from \"@/types/config\";\nimport { FactorCloudClient, FactorCloudClientDetail, FactorCloudDebtor } from \"@/types/factorcloud\";\nimport { PortalDuctCompany, PortalDuctConnection, ResyncResponse } from \"@/types/portalduct\";\nimport { MergedDebtor } from \"@/types/merged\";\n\nexport class DataOrchestrationService {\n  private factorcloudAPI: FactorCloudAPI;\n  private portalductAPI: PortalDuctAPI;\n  private connectionSyncAPI: ConnectionSyncAPI;\n  private config: SDKConfig;\n\n  constructor(config: SDKConfig) {\n    this.config = config;\n    this.factorcloudAPI = new FactorCloudAPI(\n      config.factorcloud.env_url,\n      config.factorcloud.factorId,\n      config.factorcloud.bearer_token\n    );\n    this.portalductAPI = new PortalDuctAPI(\n      config.portalduct.env_url,\n      config.portalduct.bearer_token\n    );\n    this.connectionSyncAPI = new ConnectionSyncAPI({\n      webhookToken: config.portalduct.webhook_bearer_token,\n      customerId: config.portalduct.customer_id,\n      environment: config.portalduct.environment,\n      webhookUrl: config.portalduct.sync_webhook_url,\n      verifyWebhookUrl: config.portalduct.verify_webhook_url,\n      portalductBaseUrl: config.portalduct.env_url,\n    });\n  }\n\n  async getFactorCloudClients(): Promise<FactorCloudClient[]> {\n    return this.factorcloudAPI.getClients();\n  }\n\n  async getFactorCloudClient(clientId?: string): Promise<FactorCloudClient> {\n    if (clientId) {\n      const clientDetail = await this.factorcloudAPI.getClientById(clientId);\n      return clientDetail as FactorCloudClient;\n    }\n\n    const clients = await this.factorcloudAPI.getClients();\n    if (clients.length === 0) {\n      throw new Error(\"No FactorCloud clients found\");\n    }\n\n    return clients[0];\n  }\n\n  async ensurePortalDuctCompany(\n    fcClient: FactorCloudClient | FactorCloudClientDetail\n  ): Promise<PortalDuctCompany> {\n    const companies = await this.portalductAPI.getCompanies(\n      this.config.portalduct.customer_id\n    );\n\n    const existingCompany = companies.find(\n      (company) => company.tags.factorcloud_id === fcClient.id\n    );\n\n    if (existingCompany) {\n      return existingCompany;\n    }\n\n    const clientDetail = await this.factorcloudAPI.getClientById(fcClient.id);\n\n    const newCompany = await this.portalductAPI.createCompany({\n      name: clientDetail.companyName,\n      email: clientDetail.email,\n      customer_id: this.config.portalduct.customer_id,\n      tags: {\n        factorcloud_id: clientDetail.id,\n      },\n    });\n\n    return newCompany;\n  }\n\n  async fetchMergedDebtors(\n    fcClientId: string,\n    pdCompanyId: string\n  ): Promise<MergedDebtor[]> {\n    const [debtors, connections] = await Promise.all([\n      this.factorcloudAPI.getDebtors(fcClientId),\n      this.portalductAPI.getConnections(pdCompanyId),\n    ]);\n\n    return this.matchConnectionsToDebtors(debtors, connections);\n  }\n\n  private matchConnectionsToDebtors(\n    debtors: FactorCloudDebtor[],\n    connections: PortalDuctConnection[]\n  ): MergedDebtor[] {\n    return debtors.map((debtor) => {\n      const connection = connections.find(\n        (conn) => conn.tags.factorcloud_debtor_id === debtor.companyDebtorId\n      );\n\n      let status: MergedDebtor[\"status\"] = \"not_connected\";\n      if (connection) {\n        if (connection.activation_status === \"deactivated\") {\n          status = \"deactivated\";\n        } else if (connection.activation_status === \"pending\") {\n          status = \"pending\";\n        } else {\n          status = \"connected\";\n        }\n      }\n\n      return {\n        factorcloudDebtorId: debtor.companyDebtorId,\n        factorcloudClientId: debtor.companyClientId,\n        debtorName: debtor.companyDebtorName,\n        creditLimit: debtor.creditLimit,\n        termName: debtor.termName,\n        connection,\n        status,\n        portalName: connection?.portal_name || undefined,\n        lastSync: connection?.last_sync || undefined,\n        autoSyncEnabled: connection?.auto_sync_status === \"enabled\",\n        lastSyncSummary: undefined,\n      };\n    });\n  }\n\n  getFactorCloudAPI(): FactorCloudAPI {\n    return this.factorcloudAPI;\n  }\n\n  getPortalDuctAPI(): PortalDuctAPI {\n    return this.portalductAPI;\n  }\n\n  getConnectionSyncAPI(): ConnectionSyncAPI {\n    return this.connectionSyncAPI;\n  }\n\n  async isCustomerActive(): Promise<boolean> {\n    return this.connectionSyncAPI.isCustomerActive(\n      this.config.factorcloud.factorId\n    );\n  }\n\n  async triggerConnectionSync(connectionId: string): Promise<ResyncResponse> {\n    return this.connectionSyncAPI.triggerConnectionSync(connectionId);\n  }\n\n  async triggerConnectionVerification(\n    connectionId: string\n  ): Promise<ResyncResponse> {\n    return this.connectionSyncAPI.triggerConnectionVerification(connectionId);\n  }\n}\n","import * as React from \"react\"\nimport * as DialogPrimitive from \"@radix-ui/react-dialog\"\nimport { X } from \"lucide-react\"\n\nimport { cn } from \"@/lib/utils\"\n\nconst Dialog = DialogPrimitive.Root\n\nconst DialogTrigger = DialogPrimitive.Trigger\n\nconst DialogPortal = DialogPrimitive.Portal\n\nconst DialogClose = DialogPrimitive.Close\n\nconst DialogOverlay = React.forwardRef<\n  React.ElementRef<typeof DialogPrimitive.Overlay>,\n  React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>\n>(({ className, ...props }, ref) => (\n  <DialogPrimitive.Overlay\n    ref={ref}\n    className={cn(\n      \"fixed inset-0 z-50 bg-black/80  data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0\",\n      className\n    )}\n    {...props}\n  />\n))\nDialogOverlay.displayName = DialogPrimitive.Overlay.displayName\n\nconst DialogContent = React.forwardRef<\n  React.ElementRef<typeof DialogPrimitive.Content>,\n  React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>\n>(({ className, children, ...props }, ref) => (\n  <DialogPortal>\n    <DialogOverlay />\n    <DialogPrimitive.Content\n      ref={ref}\n      className={cn(\n        \"fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg\",\n        className\n      )}\n      {...props}\n    >\n      {children}\n      <DialogPrimitive.Close className=\"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground\">\n        <X className=\"h-4 w-4\" />\n        <span className=\"sr-only\">Close</span>\n      </DialogPrimitive.Close>\n    </DialogPrimitive.Content>\n  </DialogPortal>\n))\nDialogContent.displayName = DialogPrimitive.Content.displayName\n\nconst DialogHeader = ({\n  className,\n  ...props\n}: React.HTMLAttributes<HTMLDivElement>) => (\n  <div\n    className={cn(\n      \"flex flex-col space-y-1.5 text-center sm:text-left\",\n      className\n    )}\n    {...props}\n  />\n)\nDialogHeader.displayName = \"DialogHeader\"\n\nconst DialogFooter = ({\n  className,\n  ...props\n}: React.HTMLAttributes<HTMLDivElement>) => (\n  <div\n    className={cn(\n      \"flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2\",\n      className\n    )}\n    {...props}\n  />\n)\nDialogFooter.displayName = \"DialogFooter\"\n\nconst DialogTitle = React.forwardRef<\n  React.ElementRef<typeof DialogPrimitive.Title>,\n  React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>\n>(({ className, ...props }, ref) => (\n  <DialogPrimitive.Title\n    ref={ref}\n    className={cn(\n      \"text-lg font-semibold leading-none tracking-tight\",\n      className\n    )}\n    {...props}\n  />\n))\nDialogTitle.displayName = DialogPrimitive.Title.displayName\n\nconst DialogDescription = React.forwardRef<\n  React.ElementRef<typeof DialogPrimitive.Description>,\n  React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>\n>(({ className, ...props }, ref) => (\n  <DialogPrimitive.Description\n    ref={ref}\n    className={cn(\"text-sm text-muted-foreground\", className)}\n    {...props}\n  />\n))\nDialogDescription.displayName = DialogPrimitive.Description.displayName\n\nexport {\n  Dialog,\n  DialogPortal,\n  DialogOverlay,\n  DialogClose,\n  DialogTrigger,\n  DialogContent,\n  DialogHeader,\n  DialogFooter,\n  DialogTitle,\n  DialogDescription,\n}\n","import * as React from \"react\"\n\nimport { cn } from \"@/lib/utils\"\n\nconst Input = React.forwardRef<HTMLInputElement, React.ComponentProps<\"input\">>(\n  ({ className, type, ...props }, ref) => {\n    return (\n      <input\n        type={type}\n        className={cn(\n          \"flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm\",\n          className\n        )}\n        ref={ref}\n        {...props}\n      />\n    )\n  }\n)\nInput.displayName = \"Input\"\n\nexport { Input }\n","import * as React from \"react\"\nimport * as LabelPrimitive from \"@radix-ui/react-label\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\n\nimport { cn } from \"@/lib/utils\"\n\nconst labelVariants = cva(\n  \"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70\"\n)\n\nconst Label = React.forwardRef<\n  React.ElementRef<typeof LabelPrimitive.Root>,\n  React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root> &\n    VariantProps<typeof labelVariants>\n>(({ className, ...props }, ref) => (\n  <LabelPrimitive.Root\n    ref={ref}\n    className={cn(labelVariants(), className)}\n    {...props}\n  />\n))\nLabel.displayName = LabelPrimitive.Root.displayName\n\nexport { Label }\n","import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from \"@/components/ui/dialog\";\nimport { Button } from \"@/components/ui/button\";\nimport { Input } from \"@/components/ui/input\";\nimport { Label } from \"@/components/ui/label\";\nimport { useState } from \"react\";\nimport { MergedDebtor } from \"@/types/merged\";\n\ninterface UpdateCredentialsModalProps {\n  open: boolean;\n  onOpenChange: (open: boolean) => void;\n  debtor: MergedDebtor | null;\n  onUpdate: (username: string, password: string) => void;\n  loading?: boolean;\n}\n\nexport function UpdateCredentialsModal({\n  open,\n  onOpenChange,\n  debtor,\n  onUpdate,\n  loading = false,\n}: UpdateCredentialsModalProps) {\n  const [username, setUsername] = useState(\"\");\n  const [password, setPassword] = useState(\"\");\n\n  const handleSubmit = () => {\n    if (username.trim() || password.trim()) {\n      onUpdate(username, password);\n      setUsername(\"\");\n      setPassword(\"\");\n    }\n  };\n\n  return (\n    <Dialog open={open} onOpenChange={onOpenChange}>\n      <DialogContent>\n        <DialogHeader>\n          <DialogTitle>Update Portal Credentials</DialogTitle>\n          <DialogDescription>\n            Update the login credentials for {debtor?.debtorName}\n          </DialogDescription>\n        </DialogHeader>\n\n        <div className=\"space-y-4\">\n          <div className=\"space-y-2\">\n            <Label htmlFor=\"update-username\">Username</Label>\n            <Input\n              id=\"update-username\"\n              type=\"email\"\n              value={username}\n              onChange={(e) => setUsername(e.target.value)}\n              placeholder=\"Enter new username (leave empty to keep current)\"\n            />\n          </div>\n\n          <div className=\"space-y-2\">\n            <Label htmlFor=\"update-password\">Password</Label>\n            <Input\n              id=\"update-password\"\n              type=\"password\"\n              value={password}\n              onChange={(e) => setPassword(e.target.value)}\n              placeholder=\"Enter new password (leave empty to keep current)\"\n            />\n          </div>\n\n          <div className=\"text-sm text-muted-foreground\">\n            Leave fields empty to keep existing values. Only fields with values will be updated.\n          </div>\n        </div>\n\n        <div className=\"flex justify-end gap-2 pt-4\">\n          <Button variant=\"outline\" onClick={() => onOpenChange(false)} disabled={loading}>\n            Cancel\n          </Button>\n          <Button onClick={handleSubmit} disabled={loading || (!username && !password)}>\n            {loading ? \"Updating...\" : \"Update Credentials\"}\n          </Button>\n        </div>\n      </DialogContent>\n    </Dialog>\n  );\n}\n","import * as React from \"react\"\nimport * as AlertDialogPrimitive from \"@radix-ui/react-alert-dialog\"\n\nimport { cn } from \"@/lib/utils\"\nimport { buttonVariants } from \"@/components/ui/button\"\n\nconst AlertDialog = AlertDialogPrimitive.Root\n\nconst AlertDialogTrigger = AlertDialogPrimitive.Trigger\n\nconst AlertDialogPortal = AlertDialogPrimitive.Portal\n\nconst AlertDialogOverlay = React.forwardRef<\n  React.ElementRef<typeof AlertDialogPrimitive.Overlay>,\n  React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Overlay>\n>(({ className, ...props }, ref) => (\n  <AlertDialogPrimitive.Overlay\n    className={cn(\n      \"fixed inset-0 z-50 bg-black/80  data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0\",\n      className\n    )}\n    {...props}\n    ref={ref}\n  />\n))\nAlertDialogOverlay.displayName = AlertDialogPrimitive.Overlay.displayName\n\nconst AlertDialogContent = React.forwardRef<\n  React.ElementRef<typeof AlertDialogPrimitive.Content>,\n  React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Content>\n>(({ className, ...props }, ref) => (\n  <AlertDialogPortal>\n    <AlertDialogOverlay />\n    <AlertDialogPrimitive.Content\n      ref={ref}\n      className={cn(\n        \"fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg\",\n        className\n      )}\n      {...props}\n    />\n  </AlertDialogPortal>\n))\nAlertDialogContent.displayName = AlertDialogPrimitive.Content.displayName\n\nconst AlertDialogHeader = ({\n  className,\n  ...props\n}: React.HTMLAttributes<HTMLDivElement>) => (\n  <div\n    className={cn(\n      \"flex flex-col space-y-2 text-center sm:text-left\",\n      className\n    )}\n    {...props}\n  />\n)\nAlertDialogHeader.displayName = \"AlertDialogHeader\"\n\nconst AlertDialogFooter = ({\n  className,\n  ...props\n}: React.HTMLAttributes<HTMLDivElement>) => (\n  <div\n    className={cn(\n      \"flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2\",\n      className\n    )}\n    {...props}\n  />\n)\nAlertDialogFooter.displayName = \"AlertDialogFooter\"\n\nconst AlertDialogTitle = React.forwardRef<\n  React.ElementRef<typeof AlertDialogPrimitive.Title>,\n  React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Title>\n>(({ className, ...props }, ref) => (\n  <AlertDialogPrimitive.Title\n    ref={ref}\n    className={cn(\"text-lg font-semibold\", className)}\n    {...props}\n  />\n))\nAlertDialogTitle.displayName = AlertDialogPrimitive.Title.displayName\n\nconst AlertDialogDescription = React.forwardRef<\n  React.ElementRef<typeof AlertDialogPrimitive.Description>,\n  React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Description>\n>(({ className, ...props }, ref) => (\n  <AlertDialogPrimitive.Description\n    ref={ref}\n    className={cn(\"text-sm text-muted-foreground\", className)}\n    {...props}\n  />\n))\nAlertDialogDescription.displayName =\n  AlertDialogPrimitive.Description.displayName\n\nconst AlertDialogAction = React.forwardRef<\n  React.ElementRef<typeof AlertDialogPrimitive.Action>,\n  React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Action>\n>(({ className, ...props }, ref) => (\n  <AlertDialogPrimitive.Action\n    ref={ref}\n    className={cn(buttonVariants(), className)}\n    {...props}\n  />\n))\nAlertDialogAction.displayName = AlertDialogPrimitive.Action.displayName\n\nconst AlertDialogCancel = React.forwardRef<\n  React.ElementRef<typeof AlertDialogPrimitive.Cancel>,\n  React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Cancel>\n>(({ className, ...props }, ref) => (\n  <AlertDialogPrimitive.Cancel\n    ref={ref}\n    className={cn(\n      buttonVariants({ variant: \"outline\" }),\n      \"mt-2 sm:mt-0\",\n      className\n    )}\n    {...props}\n  />\n))\nAlertDialogCancel.displayName = AlertDialogPrimitive.Cancel.displayName\n\nexport {\n  AlertDialog,\n  AlertDialogPortal,\n  AlertDialogOverlay,\n  AlertDialogTrigger,\n  AlertDialogContent,\n  AlertDialogHeader,\n  AlertDialogFooter,\n  AlertDialogTitle,\n  AlertDialogDescription,\n  AlertDialogAction,\n  AlertDialogCancel,\n}\n","import * as React from \"react\"\nimport * as TabsPrimitive from \"@radix-ui/react-tabs\"\n\nimport { cn } from \"@/lib/utils\"\n\nconst Tabs = TabsPrimitive.Root\n\nconst TabsList = React.forwardRef<\n  React.ElementRef<typeof TabsPrimitive.List>,\n  React.ComponentPropsWithoutRef<typeof TabsPrimitive.List>\n>(({ className, ...props }, ref) => (\n  <TabsPrimitive.List\n    ref={ref}\n    className={cn(\n      \"inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground\",\n      className\n    )}\n    {...props}\n  />\n))\nTabsList.displayName = TabsPrimitive.List.displayName\n\nconst TabsTrigger = React.forwardRef<\n  React.ElementRef<typeof TabsPrimitive.Trigger>,\n  React.ComponentPropsWithoutRef<typeof TabsPrimitive.Trigger>\n>(({ className, ...props }, ref) => (\n  <TabsPrimitive.Trigger\n    ref={ref}\n    className={cn(\n      \"inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm\",\n      className\n    )}\n    {...props}\n  />\n))\nTabsTrigger.displayName = TabsPrimitive.Trigger.displayName\n\nconst TabsContent = React.forwardRef<\n  React.ElementRef<typeof TabsPrimitive.Content>,\n  React.ComponentPropsWithoutRef<typeof TabsPrimitive.Content>\n>(({ className, ...props }, ref) => (\n  <TabsPrimitive.Content\n    ref={ref}\n    className={cn(\n      \"mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2\",\n      className\n    )}\n    {...props}\n  />\n))\nTabsContent.displayName = TabsPrimitive.Content.displayName\n\nexport { Tabs, TabsList, TabsTrigger, TabsContent }\n","import * as React from \"react\"\nimport * as SeparatorPrimitive from \"@radix-ui/react-separator\"\n\nimport { cn } from \"@/lib/utils\"\n\nconst Separator = React.forwardRef<\n  React.ElementRef<typeof SeparatorPrimitive.Root>,\n  React.ComponentPropsWithoutRef<typeof SeparatorPrimitive.Root>\n>(\n  (\n    { className, orientation = \"horizontal\", decorative = true, ...props },\n    ref\n  ) => (\n    <SeparatorPrimitive.Root\n      ref={ref}\n      decorative={decorative}\n      orientation={orientation}\n      className={cn(\n        \"shrink-0 bg-border\",\n        orientation === \"horizontal\" ? \"h-[1px] w-full\" : \"h-full w-[1px]\",\n        className\n      )}\n      {...props}\n    />\n  )\n)\nSeparator.displayName = SeparatorPrimitive.Root.displayName\n\nexport { Separator }\n","import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from \"@/components/ui/dialog\";\nimport { AlertDialog, AlertDialogAction, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle } from \"@/components/ui/alert-dialog\";\nimport { Button } from \"@/components/ui/button\";\nimport { Tabs, TabsContent, TabsList, TabsTrigger } from \"@/components/ui/tabs\";\nimport { Input } from \"@/components/ui/input\";\nimport { Separator } from \"@/components/ui/separator\";\nimport {\n  Loader2,\n  CheckCircle2,\n  XCircle,\n  FileText,\n  Building2,\n  Mail,\n  ArrowLeft,\n  RefreshCw,\n  ShieldCheck,\n} from \"lucide-react\";\nimport type { FactorCloudClient } from \"@/types/factorcloud\";\nimport type { MergedDebtor } from \"@/types/merged\";\nimport { useMemo, useState, useDeferredValue, useCallback } from \"react\";\nimport { formatLastSync } from \"@/lib/utils\";\n\nexport type SyncStep =\n    | \"idle\"\n    | \"checking-config\"\n    | \"authenticating\"\n    | \"loading-clients\"\n    | \"selecting-client\"\n    | \"selecting-debtor\"\n    | \"loading-data\"\n    | \"review\"\n    | \"complete\"\n    | \"error\";\n\ninterface SyncProgressModalProps {\n  open: boolean;\n  onOpenChange: (open: boolean) => void;\n  currentStep: SyncStep;\n  error?: string;\n  clients?: FactorCloudClient[];\n  debtors?: MergedDebtor[];\n  selectedDebtor?: MergedDebtor | null;\n  selectedClient?: FactorCloudClient | null;\n  onSelectClient?: (client: FactorCloudClient) => void;\n  onSelectDebtor?: (debtor: MergedDebtor) => void;\n  onConnectDebtor?: (debtor: MergedDebtor) => void;\n  onEditCredentials?: (debtor: MergedDebtor) => void;\n  onChangePortal?: (debtor: MergedDebtor) => void;\n  onToggleActivation?: (debtor: MergedDebtor) => void;\n  onSyncDebtor?: (debtor: MergedDebtor) => void;\n  onVerifyDebtor?: (debtor: MergedDebtor) => void;\n  togglingDebtorId?: string | null;\n  syncingDebtorId?: string | null;\n  verifyingDebtorId?: string | null;\n  allowBackToClientSelection?: boolean;\n  onBackToClientSelection?: () => void;\n  activeTab?: MergedDebtor[\"status\"];\n  onActiveTabChange?: (tab: MergedDebtor[\"status\"]) => void;\n}\n\nconst stepLabels: Record<SyncStep, string> = {\n  idle: \"Ready to sync\",\n  \"checking-config\": \"Checking configuration...\",\n  \"authenticating\": \"Authenticating with services...\",\n  \"loading-clients\": \"Loading clients...\",\n  \"selecting-client\": \"Choose which client to manage\",\n  \"selecting-debtor\": \"Connect debtor portals to sync invoices\",\n  \"loading-data\": \"Loading debtors...\",\n  \"review\": \"Review invoices\",\n  \"complete\": \"Sync complete!\",\n  \"error\": \"Sync failed\",\n};\n\nexport function SyncProgressModal({\n                                    open,\n                                    onOpenChange,\n                                    currentStep,\n                                    error,\n                                    clients = [],\n                                    debtors = [],\n                                    selectedDebtor = null,\n                                    selectedClient = null,\n                                    onSelectClient,\n                                    onSelectDebtor,\n                                    onConnectDebtor,\n                                    onEditCredentials,\n                                    onChangePortal,\n                                    onToggleActivation,\n                                    onSyncDebtor,\n                                    onVerifyDebtor,\n                                    togglingDebtorId,\n                                    syncingDebtorId,\n                                    verifyingDebtorId,\n                                    allowBackToClientSelection = false,\n                                    onBackToClientSelection,\n                                    activeTab,\n                                    onActiveTabChange,\n                                  }: SyncProgressModalProps) {\n  const isLoading = [\"checking-config\", \"authenticating\", \"loading-clients\", \"loading-data\"].includes(currentStep);\n  const isError = currentStep === \"error\";\n  const isComplete = currentStep === \"complete\";\n  const isSelectingClient = currentStep === \"selecting-client\";\n  const isSelectingDebtor = currentStep === \"selecting-debtor\";\n  const isReviewing = currentStep === \"review\";\n\n  // Debtor selection UI state\n  const [localActiveTab, setLocalActiveTab] = useState<MergedDebtor[\"status\"]>(\"not_connected\");\n  const activeDebtorTab = activeTab ?? localActiveTab;\n  const setActiveDebtorTab = onActiveTabChange ?? setLocalActiveTab;\n\n  // Sync confirmation modal\n  const [syncConfirmOpen, setSyncConfirmOpen] = useState(false);\n  const [debtorToSync, setDebtorToSync] = useState<MergedDebtor | null>(null);\n  const [verifyConfirmOpen, setVerifyConfirmOpen] = useState(false);\n  const [debtorToVerify, setDebtorToVerify] = useState<MergedDebtor | null>(null);\n\n  const [searchTerm, setSearchTerm] = useState(\"\");\n  const deferredSearch = useDeferredValue(searchTerm);\n\n  const filteredDebtors = useMemo(() => {\n    const q = deferredSearch.trim().toLowerCase();\n    if (!q) return debtors;\n    return debtors.filter((d) => d.debtorName.toLowerCase().includes(q));\n  }, [debtors, deferredSearch]);\n\n  const groups = useMemo(() => ({\n    not_connected: filteredDebtors.filter((d) => d.status === \"not_connected\"),\n    pending: filteredDebtors.filter((d) => d.status === \"pending\"),\n    connected: filteredDebtors.filter((d) => d.status === \"connected\"),\n    deactivated: filteredDebtors.filter((d) => d.status === \"deactivated\"),\n  }), [filteredDebtors]);\n\n  const counts = {\n    not_connected: groups.not_connected.length,\n    pending: groups.pending.length,\n    connected: groups.connected.length,\n    deactivated: groups.deactivated.length,\n  };\n\n  const handleConnect = useCallback((debtor: MergedDebtor) => {\n    onConnectDebtor?.(debtor);\n  }, [onConnectDebtor]);\n\n  const handleSyncClick = useCallback((debtor: MergedDebtor) => {\n    setDebtorToSync(debtor);\n    setSyncConfirmOpen(true);\n  }, []);\n\n  const handleSyncConfirm = useCallback(() => {\n    if (debtorToSync) {\n      onSyncDebtor?.(debtorToSync);\n      setSyncConfirmOpen(false);\n      setDebtorToSync(null);\n    }\n  }, [debtorToSync, onSyncDebtor]);\n\n  const handleVerifyClick = useCallback((debtor: MergedDebtor) => {\n    setDebtorToVerify(debtor);\n    setVerifyConfirmOpen(true);\n  }, []);\n\n  const handleVerifyConfirm = useCallback(() => {\n    if (debtorToVerify) {\n      onVerifyDebtor?.(debtorToVerify);\n      setVerifyConfirmOpen(false);\n      setDebtorToVerify(null);\n    }\n  }, [debtorToVerify, onVerifyDebtor]);\n\n  const marketingHighlights = [\n    \"Instantly sync invoices without downloading files\",\n    \"Save countless hours with automated data pulls\",\n    \"Keep your buyer portals connected and up to date\",\n  ];\n\n  return (\n      <Dialog open={open} onOpenChange={onOpenChange}>\n        <DialogContent className=\"sm:max-w-5xl max-h-[90vh] overflow-hidden p-0\">\n          <div className=\"flex h-full flex-col md:flex-row\">\n            <aside\n                className=\"md:w-1/3 bg-black text-white p-8 flex flex-col justify-between relative overflow-hidden\">\n\n              {/* Decorative Gradient Overlay */}\n              <div\n                  className=\"absolute inset-0 bg-[radial-gradient(circle_at_top_right,rgba(255,255,255,0.1),transparent_70%)] pointer-events-none\"/>\n\n              <div className=\"space-y-8 relative z-10\">\n                {/* Headline */}\n                <div className=\"space-y-3\">\n                  <h2 className=\"text-3xl font-bold leading-snug tracking-tight\">\n                    Connect & Sync your Invoices\n                  </h2>\n                  <p className=\"text-base text-white/90 leading-relaxed max-w-sm\">\n                    Connect your debtor portals once and we’ll sync your invoices automatically\n                  </p>\n                </div>\n\n                {/* Highlights */}\n                <ul className=\"space-y-5 text-sm\">\n                  {[\n                    \"Connect once, stay synced forever. No more uploads.\",\n                    \"Free your team to focus on what matters - not repetitive invoice uploads.\",\n                    \"Verify invoices faster – get funding quicker.\"\n                  ].map((text, idx) => (\n                      <li key={idx} className=\"flex items-start gap-3\">\n                        <CheckCircle2 className=\"mt-0.5 h-5 w-5 text-emerald-300 flex-shrink-0\"/>\n                        <span className=\"leading-relaxed\">{text}</span>\n                      </li>\n                  ))}\n                </ul>\n              </div>\n\n              {/* Support Box */}\n              <div\n                  className=\"relative z-10 mt-10 rounded-lg border border-white/15 bg-white/10 p-4 text-xs text-white/80 backdrop-blur-sm shadow-inner\">\n                <p className=\"font-semibold text-white\">Need help connecting your portals?</p>\n                <p className=\"mt-1\">\n                  Our support team can guide you through setup.\n                </p>\n              </div>\n            </aside>\n\n            <div className=\"flex-1 md:w-2/3\">\n              <div className=\"flex h-full flex-col\">\n                <div className=\"p-6 pb-4\">\n                  <DialogHeader className=\"text-left\">\n                    <DialogTitle>\n                      {isSelectingDebtor && selectedClient\n                          ? `Connect Debtor Portals for ${selectedClient.companyName}`\n                          : \"Connect Debtor Portals to Sync Invoices\"}\n                    </DialogTitle>\n                    <DialogDescription>\n                      {isError\n                          ? \"An error occurred during sync\"\n                          : isSelectingDebtor && selectedClient\n                              ? \"Connect debtor portals to automatically sync invoices\"\n                              : \"Connect debtor portals to automatically sync invoices and save time\"}\n                    </DialogDescription>\n                  </DialogHeader>\n                  {!isSelectingDebtor && <Separator className=\"mt-4\"/>}\n                </div>\n\n                <div className=\"flex-1 overflow-y-auto px-6 pb-6\">\n                  {(isLoading || isComplete || isError) && (\n                      <div className=\"flex items-center gap-3\">\n                        {isLoading && <Loader2 className=\"w-5 h-5 animate-spin text-primary\"/>}\n                        {isComplete && <CheckCircle2 className=\"w-5 h-5 text-primary\"/>}\n                        {isError && <XCircle className=\"w-5 h-5 text-destructive\"/>}\n                        <span className=\"text-sm text-muted-foreground\">\n                      {currentStep === \"loading-data\" && selectedClient\n                          ? `Loading debtors for ${selectedClient.companyName}...`\n                          : stepLabels[currentStep]\n                      }\n                    </span>\n                      </div>\n                  )}\n\n                  {isSelectingClient && (\n                      <div className=\"mt-6 space-y-4\">\n                        <div className=\"text-base font-medium\">Step 1 : Select a Client</div>\n\n                        <div className=\"max-h-64 overflow-auto rounded-md border\">\n                          <ul className=\"divide-y\">\n                            {clients.length === 0 && (\n                                <li className=\"p-3 text-sm text-muted-foreground\">No clients found.</li>\n                            )}\n                            {clients.map((client) => (\n                                <li key={client.id}>\n                                  <button\n                                      className=\"w-full text-left p-3 transition-colors hover:bg-muted/70\"\n                                      onClick={() => onSelectClient?.(client)}\n                                  >\n                                    <div className=\"flex items-center gap-2\">\n                                      <Building2 className=\"h-5 w-5 flex-shrink-0 text-primary\"/>\n                                      <div className=\"flex-1\">\n                                        <div className=\"flex items-center justify-between\">\n                                          <span className=\"font-medium\">{client.companyName}</span>\n                                          {client.active && (\n                                              <span\n                                                  className=\"rounded bg-green-500/10 px-2 py-1 text-xs text-green-500\">\n                                        Active\n                                      </span>\n                                          )}\n                                        </div>\n                                        <div className=\"mt-1 flex items-center gap-1 text-xs text-muted-foreground\">\n                                          <Mail className=\"h-3 w-3\"/>\n                                          {client.email}\n                                        </div>\n                                      </div>\n                                    </div>\n                                  </button>\n                                </li>\n                            ))}\n                          </ul>\n                        </div>\n                      </div>\n                  )}\n\n                  {isSelectingDebtor && (\n                      <div className=\"mt-6 space-y-4\">\n                        <Input\n                            value={searchTerm}\n                            onChange={(e) => setSearchTerm(e.target.value)}\n                            placeholder=\"Search debtors...\"\n                            className=\"w-full\"\n                        />\n\n                        <Tabs value={activeDebtorTab}\n                              onValueChange={(v) => setActiveDebtorTab(v as MergedDebtor[\"status\"])} className=\"w-full\">\n                          <TabsList className=\"grid w-full grid-cols-4 gap-2 bg-muted\">\n                            <TabsTrigger value=\"not_connected\">Not Connected ({counts.not_connected})</TabsTrigger>\n                            <TabsTrigger value=\"pending\">Pending ({counts.pending})</TabsTrigger>\n                            <TabsTrigger value=\"connected\">Connected ({counts.connected})</TabsTrigger>\n                            <TabsTrigger value=\"deactivated\">Deactivated ({counts.deactivated})</TabsTrigger>\n                          </TabsList>\n\n                          {([\"not_connected\", \"pending\", \"connected\", \"deactivated\"] as MergedDebtor[\"status\"][]).map((status) => (\n                              <TabsContent key={status} value={status} className=\"mt-4\">\n                                <div className=\"max-h-64 overflow-auto rounded-md border\">\n                                  <ul className=\"divide-y\">\n                                    {groups[status].length === 0 && (\n                                        <li className=\"p-3 text-sm text-muted-foreground\">No debtors found.</li>\n                                    )}\n                                    {groups[status].map((debtor) => (\n                                        <li key={debtor.factorcloudDebtorId}\n                                            className=\"flex items-center justify-between gap-4 p-3 transition-colors hover:bg-muted/70\">\n                                          <div className=\"flex-1\">\n                                            <div className=\"font-medium\">{debtor.debtorName}</div>\n                                            <div className=\"mt-1 space-y-0.5 text-xs text-muted-foreground\">\n                                              <div>Last Sync: {formatLastSync(debtor.lastSync)}</div>\n                                              {debtor.lastSyncSummary && (\n                                                  <div>\n                                                    Last Sync Records: {debtor.lastSyncSummary.synced} synced /\n                                                    {\" \"}\n                                                    {debtor.lastSyncSummary.processed} processed\n                                                    {debtor.lastSyncSummary.failed > 0\n                                                        ? ` (${debtor.lastSyncSummary.failed} failed)`\n                                                        : \"\"}\n                                                  </div>\n                                              )}\n                                              {debtor.lastVerificationSummary && (\n                                                  <div>\n                                                    Last\n                                                    Verification: {formatLastSync(debtor.lastVerificationSummary.timestamp)} —\n                                                    {\" \"}\n                                                    {debtor.lastVerificationSummary.synced} verified /\n                                                    {\" \"}\n                                                    {debtor.lastVerificationSummary.processed} processed\n                                                    {debtor.lastVerificationSummary.failed > 0\n                                                        ? ` (${debtor.lastVerificationSummary.failed} failed)`\n                                                        : \"\"}\n                                                  </div>\n                                              )}\n                                              {debtor.portalName && (\n                                                  <div>Portal: {debtor.portalName}</div>\n                                              )}\n                                            </div>\n                                          </div>\n                                          <div className=\"flex flex-wrap gap-2\">\n                                            {status === \"not_connected\" && (\n                                                <Button onClick={() => handleConnect(debtor)}>\n                                                  CONNECT\n                                                </Button>\n                                            )}\n                                            {status === \"connected\" && (\n                                                <>\n                                                  <Button\n                                                      variant=\"success\"\n                                                      size=\"sm\"\n                                                      onClick={() => handleSyncClick(debtor)}\n                                                      disabled={syncingDebtorId === debtor.factorcloudDebtorId}\n                                                  >\n                                                    {syncingDebtorId === debtor.factorcloudDebtorId ? (\n                                                        <>\n                                                          <Loader2 className=\"mr-2 h-4 w-4 animate-spin\"/>\n                                                          Syncing...\n                                                        </>\n                                                    ) : (\n                                                        <>\n                                                          <RefreshCw className=\"mr-2 h-4 w-4\"/>\n                                                          Sync Now\n                                                        </>\n                                                    )}\n                                                  </Button>\n                                                  <Button\n                                                      variant=\"outline\"\n                                                      size=\"sm\"\n                                                      onClick={() => handleVerifyClick(debtor)}\n                                                      disabled={verifyingDebtorId === debtor.factorcloudDebtorId}\n                                                  >\n                                                    {verifyingDebtorId === debtor.factorcloudDebtorId ? (\n                                                        <>\n                                                          <Loader2 className=\"mr-2 h-4 w-4 animate-spin\"/>\n                                                          Verifying...\n                                                        </>\n                                                    ) : (\n                                                        <>\n                                                          <ShieldCheck className=\"mr-2 h-4 w-4\"/>\n                                                          Verify Invoices\n                                                        </>\n                                                    )}\n                                                  </Button>\n                                                  <Button variant=\"outline\" size=\"sm\"\n                                                          onClick={() => onEditCredentials?.(debtor)}>\n                                                    Edit Credentials\n                                                  </Button>\n                                                  <Button\n                                                      variant=\"outline\"\n                                                      size=\"sm\"\n                                                      onClick={() => onToggleActivation?.(debtor)}\n                                                      disabled={togglingDebtorId === debtor.factorcloudDebtorId}\n                                                  >\n                                                    {togglingDebtorId === debtor.factorcloudDebtorId ? (\n                                                        <>\n                                                          <Loader2 className=\"mr-2 h-4 w-4 animate-spin\"/>\n                                                          Deactivating...\n                                                        </>\n                                                    ) : (\n                                                        \"Deactivate\"\n                                                    )}\n                                                  </Button>\n                                                </>\n                                            )}\n                                            {(status === \"pending\" || status === \"deactivated\") && (\n                                                <>\n                                                  <Button variant=\"outline\" size=\"sm\"\n                                                          onClick={() => onEditCredentials?.(debtor)}>\n                                                    Edit Credentials\n                                                  </Button>\n                                                  <Button\n                                                      variant={status === \"deactivated\" ? \"default\" : \"outline\"}\n                                                      size=\"sm\"\n                                                      onClick={() => onToggleActivation?.(debtor)}\n                                                      disabled={togglingDebtorId === debtor.factorcloudDebtorId}\n                                                  >\n                                                    {togglingDebtorId === debtor.factorcloudDebtorId ? (\n                                                        <>\n                                                          <Loader2 className=\"mr-2 h-4 w-4 animate-spin\"/>\n                                                          {status === \"deactivated\" ? \"Activating...\" : \"Deactivating...\"}\n                                                        </>\n                                                    ) : (\n                                                        status === \"deactivated\" ? \"Activate\" : \"Deactivate\"\n                                                    )}\n                                                  </Button>\n                                                </>\n                                            )}\n                                          </div>\n                                        </li>\n                                    ))}\n                                  </ul>\n                                </div>\n                              </TabsContent>\n                          ))}\n                        </Tabs>\n                      </div>\n                  )}\n\n                  {isReviewing && (\n                      <div className=\"mt-6 space-y-4\">\n                        <div className=\"text-sm\">\n                          Selected debtor: <span className=\"font-medium\">{selectedDebtor?.debtorName}</span>\n                        </div>\n                        <Tabs defaultValue=\"pending\" className=\"w-full\">\n                          <TabsList className=\"bg-muted\">\n                            <TabsTrigger value=\"pending\">Pending</TabsTrigger>\n                            <TabsTrigger value=\"approved\">Approved</TabsTrigger>\n                            <TabsTrigger value=\"funded\">Funded</TabsTrigger>\n                            <TabsTrigger value=\"closed\">Closed</TabsTrigger>\n                            <TabsTrigger value=\"rejected\">Rejected</TabsTrigger>\n                            <TabsTrigger value=\"all\">All</TabsTrigger>\n                          </TabsList>\n                          <TabsContent value=\"pending\" className=\"mt-4\">\n                            <div\n                                className=\"flex flex-col items-center rounded-lg border p-8 text-center text-sm text-muted-foreground\">\n                              <div className=\"mb-3 flex h-10 w-10 items-center justify-center rounded-full bg-muted\">\n                                <FileText className=\"h-5 w-5\"/>\n                              </div>\n                              No records found for Pending\n                            </div>\n                          </TabsContent>\n                          <TabsContent value=\"approved\" className=\"mt-4\">\n                            <div className=\"rounded-lg border p-8 text-center text-sm text-muted-foreground\">No records\n                              found for Approved\n                            </div>\n                          </TabsContent>\n                          <TabsContent value=\"funded\" className=\"mt-4\">\n                            <div className=\"rounded-lg border p-8 text-center text-sm text-muted-foreground\">No records\n                              found for Funded\n                            </div>\n                          </TabsContent>\n                          <TabsContent value=\"closed\" className=\"mt-4\">\n                            <div className=\"rounded-lg border p-8 text-center text-sm text-muted-foreground\">No records\n                              found for Closed\n                            </div>\n                          </TabsContent>\n                          <TabsContent value=\"rejected\" className=\"mt-4\">\n                            <div className=\"rounded-lg border p-8 text-center text-sm text-muted-foreground\">No records\n                              found for Rejected\n                            </div>\n                          </TabsContent>\n                          <TabsContent value=\"all\" className=\"mt-4\">\n                            <div className=\"rounded-lg border p-8 text-center text-sm text-muted-foreground\">No records\n                              found\n                            </div>\n                          </TabsContent>\n                        </Tabs>\n                      </div>\n                  )}\n\n                  {error && (\n                      <div className=\"mt-6 rounded-lg bg-destructive/10 p-3 text-sm text-destructive\">\n                        {error}\n                      </div>\n                  )}\n                </div>\n\n                <div className=\"flex items-center justify-between border-t px-6 py-4\">\n                  {isSelectingDebtor && allowBackToClientSelection ? (\n                      <Button variant=\"outline\" onClick={onBackToClientSelection}>\n                        <ArrowLeft className=\"mr-2 h-4 w-4\"/>\n                        Change Client\n                      </Button>\n                  ) : (\n                      <div/>\n                  )}\n                  <Button variant=\"outline\" onClick={() => onOpenChange(false)}>\n                    Close\n                  </Button>\n                </div>\n              </div>\n            </div>\n          </div>\n        </DialogContent>\n\n        <AlertDialog open={syncConfirmOpen} onOpenChange={setSyncConfirmOpen}>\n          <AlertDialogContent>\n            <AlertDialogHeader>\n              <AlertDialogTitle>Sync Scheduled Successfully!</AlertDialogTitle>\n              <AlertDialogDescription>\n                We're syncing invoices for <span className=\"font-medium\">{debtorToSync?.debtorName}</span> in the\n                background.\n                This usually takes a few minutes. You'll receive an email notification once the sync is complete and\n                your invoices are ready to review.\n              </AlertDialogDescription>\n            </AlertDialogHeader>\n            <AlertDialogFooter>\n              <AlertDialogAction onClick={handleSyncConfirm}>Got it!</AlertDialogAction>\n            </AlertDialogFooter>\n          </AlertDialogContent>\n        </AlertDialog>\n\n        <AlertDialog open={verifyConfirmOpen} onOpenChange={setVerifyConfirmOpen}>\n          <AlertDialogContent>\n            <AlertDialogHeader>\n              <AlertDialogTitle>Verification Started!</AlertDialogTitle>\n              <AlertDialogDescription>\n                We're verifying invoices for <span className=\"font-medium\">{debtorToVerify?.debtorName}</span>. We'll\n                let you know if any issues come up during the verification.\n              </AlertDialogDescription>\n            </AlertDialogHeader>\n            <AlertDialogFooter>\n              <AlertDialogAction onClick={handleVerifyConfirm}>Understood</AlertDialogAction>\n            </AlertDialogFooter>\n          </AlertDialogContent>\n        </AlertDialog>\n      </Dialog>\n  );\n}","import * as React from \"react\"\nimport * as ScrollAreaPrimitive from \"@radix-ui/react-scroll-area\"\n\nimport { cn } from \"@/lib/utils\"\n\nconst ScrollArea = React.forwardRef<\n  React.ElementRef<typeof ScrollAreaPrimitive.Root>,\n  React.ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.Root>\n>(({ className, children, ...props }, ref) => (\n  <ScrollAreaPrimitive.Root\n    ref={ref}\n    className={cn(\"relative overflow-hidden\", className)}\n    {...props}\n  >\n    <ScrollAreaPrimitive.Viewport className=\"h-full w-full rounded-[inherit]\">\n      {children}\n    </ScrollAreaPrimitive.Viewport>\n    <ScrollBar />\n    <ScrollAreaPrimitive.Corner />\n  </ScrollAreaPrimitive.Root>\n))\nScrollArea.displayName = ScrollAreaPrimitive.Root.displayName\n\nconst ScrollBar = React.forwardRef<\n  React.ElementRef<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>,\n  React.ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>\n>(({ className, orientation = \"vertical\", ...props }, ref) => (\n  <ScrollAreaPrimitive.ScrollAreaScrollbar\n    ref={ref}\n    orientation={orientation}\n    className={cn(\n      \"flex touch-none select-none transition-colors\",\n      orientation === \"vertical\" &&\n        \"h-full w-2.5 border-l border-l-transparent p-[1px]\",\n      orientation === \"horizontal\" &&\n        \"h-2.5 flex-col border-t border-t-transparent p-[1px]\",\n      className\n    )}\n    {...props}\n  >\n    <ScrollAreaPrimitive.ScrollAreaThumb className=\"relative flex-1 rounded-full bg-border\" />\n  </ScrollAreaPrimitive.ScrollAreaScrollbar>\n))\nScrollBar.displayName = ScrollAreaPrimitive.ScrollAreaScrollbar.displayName\n\nexport { ScrollArea, ScrollBar }\n","import * as React from \"react\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\n\nimport { cn } from \"@/lib/utils\"\n\nconst badgeVariants = cva(\n  \"inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2\",\n  {\n    variants: {\n      variant: {\n        default:\n          \"border-transparent bg-primary text-primary-foreground hover:bg-primary/80\",\n        secondary:\n          \"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80\",\n        destructive:\n          \"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80\",\n        outline: \"text-foreground\",\n      },\n    },\n    defaultVariants: {\n      variant: \"default\",\n    },\n  }\n)\n\nexport interface BadgeProps\n  extends React.HTMLAttributes<HTMLDivElement>,\n    VariantProps<typeof badgeVariants> {}\n\nfunction Badge({ className, variant, ...props }: BadgeProps) {\n  return (\n    <div className={cn(badgeVariants({ variant }), className)} {...props} />\n  )\n}\n\nexport { Badge, badgeVariants }\n","import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from \"@/components/ui/dialog\";\nimport { Button } from \"@/components/ui/button\";\nimport { Input } from \"@/components/ui/input\";\nimport { Label } from \"@/components/ui/label\";\nimport { ScrollArea } from \"@/components/ui/scroll-area\";\nimport { Badge } from \"@/components/ui/badge\";\nimport { MergedDebtor } from \"@/types/merged\";\nimport { PortalMapping } from \"@/types/portalduct\";\nimport { useState, useEffect } from \"react\";\nimport { Loader2, Search, ArrowLeft } from \"lucide-react\";\n\ninterface ConnectDebtorModalProps {\n  open: boolean;\n  onOpenChange: (open: boolean) => void;\n  debtor: MergedDebtor | null;\n  availablePortals: PortalMapping[];\n  loadingPortals?: boolean;\n  loading?: boolean;\n  isChangingPortal?: boolean;\n  onConnect: (portalId: string, username: string, password: string) => void;\n  onRequestNewPortal: () => void;\n}\n\nexport function ConnectDebtorModal({ \n  open, \n  onOpenChange, \n  debtor,\n  availablePortals,\n  loadingPortals = false,\n  loading = false,\n  isChangingPortal = false,\n  onConnect,\n  onRequestNewPortal\n}: ConnectDebtorModalProps) {\n  const [step, setStep] = useState<\"selecting-portal\" | \"entering-credentials\">(\"selecting-portal\");\n  const [selectedPortal, setSelectedPortal] = useState<PortalMapping | null>(null);\n  const [searchQuery, setSearchQuery] = useState(\"\");\n  const [username, setUsername] = useState(\"\");\n  const [password, setPassword] = useState(\"\");\n\n  useEffect(() => {\n    if (!open) {\n      setStep(\"selecting-portal\");\n      setSelectedPortal(null);\n      setSearchQuery(\"\");\n      setUsername(\"\");\n      setPassword(\"\");\n    }\n  }, [open]);\n\n  const filteredPortals = availablePortals\n    .filter(portal => \n      portal.description !== \"Failed\" &&\n      (portal.name.toLowerCase().includes(searchQuery.toLowerCase()) ||\n       portal.host.toLowerCase().includes(searchQuery.toLowerCase()))\n    )\n    .sort((a, b) => {\n      // Active portals first\n      if (a.is_active && !b.is_active) return -1;\n      if (!a.is_active && b.is_active) return 1;\n      return 0;\n    });\n\n  const handlePortalSelect = (portal: PortalMapping) => {\n    setSelectedPortal(portal);\n    setStep(\"entering-credentials\");\n  };\n\n  const handleBack = () => {\n    setStep(\"selecting-portal\");\n    setSelectedPortal(null);\n    setUsername(\"\");\n    setPassword(\"\");\n  };\n\n  const handleConnect = () => {\n    if (selectedPortal && username && password) {\n      onConnect(selectedPortal.portal_id, username, password);\n    }\n  };\n\n  const canSubmit = username.trim().length > 0 && password.trim().length > 0;\n\n  return (\n    <Dialog open={open} onOpenChange={onOpenChange}>\n      <DialogContent className=\"sm:max-w-2xl h-[85vh] min-h-0 flex flex-col gap-4 overflow-hidden\">\n        {step === \"selecting-portal\" ? (\n          <>\n            <DialogHeader>\n              <DialogTitle>{isChangingPortal ? 'Change Portal' : 'Select Portal'}</DialogTitle>\n              <DialogDescription>\n                Choose the portal you want to {isChangingPortal ? 'change to' : 'connect to'} for {debtor?.debtorName}.\n              </DialogDescription>\n            </DialogHeader>\n\n            {loadingPortals ? (\n              <div className=\"flex items-center justify-center py-8\">\n                <Loader2 className=\"w-8 h-8 animate-spin text-primary\" />\n              </div>\n            ) : (\n              <>\n                <div className=\"relative flex-shrink-0\">\n                  <Search className=\"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground\" />\n                  <Input\n                    placeholder=\"Search portals...\"\n                    value={searchQuery}\n                    onChange={(e) => setSearchQuery(e.target.value)}\n                    className=\"pl-9\"\n                  />\n                </div>\n\n                <ScrollArea className=\"flex-1 min-h-0 -mx-6 px-6\">\n                  <div className=\"grid grid-cols-2 gap-4 pb-4\">\n                    {filteredPortals.map((portal) => (\n                      <button\n                        key={portal.mapping_id}\n                        onClick={() => handlePortalSelect(portal)}\n                        className=\"flex flex-col items-center gap-3 p-4 border rounded-lg hover:bg-muted/50 transition-colors relative\"\n                      >\n                        <Badge \n                          variant=\"secondary\"\n                          className={`absolute top-2 right-2 ${portal.is_active ? 'bg-green-100 text-green-700 hover:bg-green-200' : 'bg-yellow-100 text-yellow-700 hover:bg-yellow-200'}`}\n                        >\n                          {portal.is_active ? \"Active\" : \"Pending\"}\n                        </Badge>\n                        <div className=\"w-16 h-16 flex items-center justify-center bg-muted rounded-lg\">\n                          {portal.logo && portal.logo !== \"NA\" ? (\n                            <img \n                              src={portal.logo} \n                              alt={portal.name}\n                              className=\"w-12 h-12 object-contain\"\n                              onError={(e) => {\n                                e.currentTarget.style.display = 'none';\n                              }}\n                            />\n                          ) : (\n                            <span className=\"text-2xl font-bold text-muted-foreground\">\n                              {portal.name.charAt(0)}\n                            </span>\n                          )}\n                        </div>\n                        <div className=\"text-sm font-medium text-center\">{portal.name}</div>\n                        <div className=\"text-xs text-muted-foreground truncate w-full text-center\">\n                          {portal.host}\n                        </div>\n                      </button>\n                    ))}\n                  </div>\n                </ScrollArea>\n\n                <div className=\"flex items-center justify-between gap-3 pt-4 border-t flex-shrink-0\">\n                  <p className=\"text-sm text-muted-foreground\">Can't find your portal?</p>\n                  <Button variant=\"outline\" onClick={onRequestNewPortal} size=\"sm\">\n                    Request New Portal\n                  </Button>\n                </div>\n              </>\n            )}\n\n            <div className=\"flex justify-end pt-2 flex-shrink-0\">\n              <Button variant=\"outline\" onClick={() => onOpenChange(false)}>\n                Cancel\n              </Button>\n            </div>\n          </>\n        ) : (\n          <>\n            <DialogHeader>\n              <DialogTitle>{isChangingPortal ? 'Change Portal' : 'Enter Credentials'}</DialogTitle>\n              <DialogDescription>\n                Enter your credentials for {selectedPortal?.name} to {isChangingPortal ? 'update' : 'connect'} {debtor?.debtorName}.\n              </DialogDescription>\n            </DialogHeader>\n\n            <div className=\"space-y-4\">\n              <div className=\"flex items-center gap-3 p-3 border rounded-lg bg-muted/50\">\n                {selectedPortal?.logo && selectedPortal.logo !== \"NA\" && (\n                  <img \n                    src={selectedPortal.logo} \n                    alt={selectedPortal.name}\n                    className=\"w-10 h-10 object-contain\"\n                  />\n                )}\n                <div>\n                  <div className=\"font-medium\">{selectedPortal?.name}</div>\n                  <div className=\"text-xs text-muted-foreground\">{selectedPortal?.host}</div>\n                </div>\n              </div>\n\n              <div className=\"space-y-2\">\n                <Label htmlFor=\"portal-username\">Username</Label>\n                <Input \n                  id=\"portal-username\" \n                  value={username} \n                  onChange={(e) => setUsername(e.target.value)} \n                  placeholder=\"Enter portal username\" \n                />\n              </div>\n              <div className=\"space-y-2\">\n                <Label htmlFor=\"portal-password\">Password</Label>\n                <Input \n                  id=\"portal-password\" \n                  type=\"password\" \n                  value={password} \n                  onChange={(e) => setPassword(e.target.value)} \n                  placeholder=\"Enter portal password\" \n                />\n              </div>\n            </div>\n\n            <div className=\"flex justify-between gap-2 pt-4\">\n              <Button variant=\"outline\" onClick={handleBack} disabled={loading}>\n                <ArrowLeft className=\"w-4 h-4 mr-2\" />\n                Back\n              </Button>\n              <div className=\"flex gap-2\">\n                <Button variant=\"outline\" onClick={() => onOpenChange(false)} disabled={loading}>\n                  Cancel\n                </Button>\n                <Button onClick={handleConnect} disabled={loading || !canSubmit}>\n                  {loading ? (isChangingPortal ? \"Updating...\" : \"Connecting...\") : (isChangingPortal ? \"Update Portal\" : \"Connect\")}\n                </Button>\n              </div>\n            </div>\n          </>\n        )}\n      </DialogContent>\n    </Dialog>\n  );\n}\n","import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from \"@/components/ui/dialog\";\nimport { Button } from \"@/components/ui/button\";\nimport { Input } from \"@/components/ui/input\";\nimport { Label } from \"@/components/ui/label\";\nimport { useState, useEffect } from \"react\";\n\ninterface RequestPortalModalProps {\n  open: boolean;\n  onOpenChange: (open: boolean) => void;\n  loading?: boolean;\n  onSubmit: (name: string, host: string) => void;\n}\n\nexport function RequestPortalModal({ open, onOpenChange, loading = false, onSubmit }: RequestPortalModalProps) {\n  const [name, setName] = useState(\"\");\n  const [host, setHost] = useState(\"\");\n\n  useEffect(() => {\n    if (!open) {\n      setName(\"\");\n      setHost(\"\");\n    }\n  }, [open]);\n\n  const canSubmit = name.trim().length > 0 && host.trim().length > 0;\n\n  return (\n    <Dialog open={open} onOpenChange={onOpenChange}>\n      <DialogContent>\n        <DialogHeader>\n          <DialogTitle>Request New Portal</DialogTitle>\n          <DialogDescription>\n            Enter the details of the portal you'd like to connect to.\n          </DialogDescription>\n        </DialogHeader>\n\n        <div className=\"space-y-4\">\n          <div className=\"space-y-2\">\n            <Label htmlFor=\"portal-name\">Portal Name</Label>\n            <Input \n              id=\"portal-name\" \n              value={name} \n              onChange={(e) => setName(e.target.value)} \n              placeholder=\"e.g. My Portal Name\" \n            />\n          </div>\n          <div className=\"space-y-2\">\n            <Label htmlFor=\"portal-host\">Portal URL</Label>\n            <Input \n              id=\"portal-host\" \n              value={host} \n              onChange={(e) => setHost(e.target.value)} \n              placeholder=\"e.g. https://portal.example.com\" \n            />\n          </div>\n        </div>\n\n        <div className=\"flex justify-end gap-2 pt-4\">\n          <Button variant=\"outline\" onClick={() => onOpenChange(false)} disabled={loading}>\n            Cancel\n          </Button>\n          <Button onClick={() => onSubmit(name, host)} disabled={loading || !canSubmit}>\n            {loading ? \"Creating...\" : \"Create Portal\"}\n          </Button>\n        </div>\n      </DialogContent>\n    </Dialog>\n  );\n}\n","import { useCallback, useEffect, useMemo, useRef, useState } from \"react\";\n\nimport { ConnectionSyncAPI } from \"@/api/connectionSync\";\nimport {\n  CustomerStatusPayload,\n  SDKConfig,\n  isConfigComplete,\n  mergeCustomerStatusWithConfig,\n} from \"@/types/config\";\n\nexport interface CustomerStatusState {\n  isActive: boolean | null;\n  loading: boolean;\n  error: Error | null;\n  resolvedConfig: SDKConfig | null;\n  refetch: () => Promise<CustomerStatusPayload | null>;\n}\n\ninterface UseCustomerStatusOptions {\n  skip?: boolean;\n  customerStatusUrl?: string;\n}\n\nexport function useCustomerStatus(\n  config?: SDKConfig | null,\n  options?: UseCustomerStatusOptions\n): CustomerStatusState {\n  const skip = options?.skip ?? false;\n  const customerStatusUrl = options?.customerStatusUrl;\n\n  const isMountedRef = useRef(true);\n  const [isActive, setIsActive] = useState<boolean | null>(null);\n  const [loading, setLoading] = useState<boolean>(false);\n  const [error, setError] = useState<Error | null>(null);\n  const [resolvedConfig, setResolvedConfig] = useState<SDKConfig | null>(\n    config && isConfigComplete(config) ? config : null\n  );\n\n  useEffect(() => {\n    if (!config) {\n      setResolvedConfig(null);\n      return;\n    }\n\n    if (isConfigComplete(config)) {\n      setResolvedConfig(config);\n    }\n  }, [config]);\n\n  const combinedConfig = useMemo<Partial<SDKConfig> | undefined>(() => {\n    if (!config && !resolvedConfig) {\n      return undefined;\n    }\n\n    return {\n      portalduct: {\n        ...(resolvedConfig?.portalduct ?? {}),\n        ...(config?.portalduct ?? {}),\n      },\n      factorcloud: {\n        ...(resolvedConfig?.factorcloud ?? {}),\n        ...(config?.factorcloud ?? {}),\n      },\n    };\n  }, [config, resolvedConfig]);\n\n  const factorId = combinedConfig?.factorcloud?.factorId;\n  const webhookToken = combinedConfig?.portalduct?.webhook_bearer_token;\n  const customerId = combinedConfig?.portalduct?.customer_id;\n  const environment = combinedConfig?.portalduct?.environment;\n  const portalductEnvUrl = combinedConfig?.portalduct?.env_url;\n  const syncWebhookUrl = combinedConfig?.portalduct?.sync_webhook_url;\n  const verifyWebhookUrl = combinedConfig?.portalduct?.verify_webhook_url;\n\n  const latestConfigRef = useRef<Partial<SDKConfig> | undefined>(combinedConfig);\n\n  useEffect(() => {\n    latestConfigRef.current = combinedConfig;\n  }, [combinedConfig]);\n\n  useEffect(() => {\n    isMountedRef.current = true;\n    return () => {\n      isMountedRef.current = false;\n    };\n  }, []);\n\n  const refetch = useCallback(async () => {\n    if (skip) {\n      return null;\n    }\n\n    const latestConfig = latestConfigRef.current;\n    const latestFactorId = latestConfig?.factorcloud?.factorId;\n    const latestWebhookToken = latestConfig?.portalduct?.webhook_bearer_token;\n    const latestCustomerId = latestConfig?.portalduct?.customer_id;\n    const latestEnvironment = latestConfig?.portalduct?.environment;\n    const latestPortalductEnvUrl = latestConfig?.portalduct?.env_url;\n    const latestSyncWebhookUrl = latestConfig?.portalduct?.sync_webhook_url;\n    const latestVerifyWebhookUrl = latestConfig?.portalduct?.verify_webhook_url;\n\n    if (!latestFactorId) {\n      if (isMountedRef.current) {\n        setIsActive(null);\n        setLoading(false);\n        setError(null);\n      }\n      return null;\n    }\n\n    if (!latestWebhookToken) {\n      if (isMountedRef.current) {\n        setIsActive(false);\n        setLoading(false);\n        setError(\n          new Error(\n            \"Missing webhook bearer token required for customer status checks.\"\n          )\n        );\n      }\n      return null;\n    }\n\n    if (isMountedRef.current) {\n      setLoading(true);\n      setError(null);\n    }\n\n    try {\n      const api = new ConnectionSyncAPI({\n        webhookToken: latestWebhookToken,\n        customerId: latestCustomerId,\n        environment: latestEnvironment,\n        webhookUrl: latestSyncWebhookUrl,\n        verifyWebhookUrl: latestVerifyWebhookUrl,\n        portalductBaseUrl: latestPortalductEnvUrl,\n        customerStatusUrl,\n      });\n\n      const status = await api.fetchCustomerStatus(latestFactorId);\n      const mergedConfig = mergeCustomerStatusWithConfig(\n        latestConfig,\n        status\n      );\n\n      if (isMountedRef.current) {\n        setIsActive(status.active);\n        if (mergedConfig) {\n          setResolvedConfig(mergedConfig);\n        }\n      }\n\n      return status;\n    } catch (err) {\n      const errorInstance =\n        err instanceof Error\n          ? err\n          : new Error(\"Unable to determine FactorCloud customer status.\");\n\n      if (isMountedRef.current) {\n        setIsActive(false);\n        setError(errorInstance);\n      }\n\n      return null;\n    } finally {\n      if (isMountedRef.current) {\n        setLoading(false);\n      }\n    }\n  }, [customerStatusUrl, skip]);\n\n  useEffect(() => {\n    if (skip) {\n      return;\n    }\n\n    if (!factorId || !webhookToken) {\n      return;\n    }\n\n    refetch();\n  }, [\n    customerStatusUrl,\n    factorId,\n    portalductEnvUrl,\n    refetch,\n    skip,\n    syncWebhookUrl,\n    verifyWebhookUrl,\n    webhookToken,\n  ]);\n\n  return {\n    isActive,\n    loading,\n    error,\n    resolvedConfig,\n    refetch,\n  };\n}\n","import { useState, useEffect, ReactNode } from \"react\";\nimport { Button } from \"@/components/ui/button\";\nimport { useToast } from \"@/hooks/use-toast\";\nimport { SDKConfig, isConfigComplete } from \"@/types/config\";\nimport { FactorCloudClient } from \"@/types/factorcloud\";\nimport { PortalDuctCompany } from \"@/types/portalduct\";\nimport { MergedDebtor } from \"@/types/merged\";\nimport { DataOrchestrationService } from \"@/services/orchestration\";\nimport { PortalDuctAPIError } from \"@/api/portalduct\";\nimport { UpdateCredentialsModal } from \"./UpdateCredentialsModal\";\nimport { SyncProgressModal, SyncStep } from \"./SyncProgressModal\";\nimport { ConnectDebtorModal } from \"./ConnectDebtorModal\";\nimport { RequestPortalModal } from \"./RequestPortalModal\";\nimport { PortalMapping } from \"@/types/portalduct\";\nimport {\n    CustomerStatusState,\n    useCustomerStatus,\n} from \"@/hooks/use-customer-status\";\n\nexport interface SyncWorkflowProps {\n    config: SDKConfig;\n    onTokenExpired?: (service: 'factorcloud' | 'portalduct') => void;\n    trigger?: ReactNode;\n    onSyncComplete?: (debtors: MergedDebtor[]) => void;\n    onSyncError?: (error: Error) => void;\n    autoStart?: boolean;\n    customerStatus?: CustomerStatusState;\n}\n\nexport const SyncWorkflow = ({\n                                 config,\n                                 onTokenExpired,\n                                 trigger,\n                                 onSyncComplete,\n                                 onSyncError,\n                                 autoStart = false,\n                                 customerStatus,\n                             }: SyncWorkflowProps) => {\n    // Orchestration Service State\n    const [orchestrationService, setOrchestrationService] = useState<DataOrchestrationService | null>(null);\n\n    // Client Selection State\n    const [factorcloudClient, setFactorcloudClient] = useState<FactorCloudClient | null>(null);\n    const [portalductCompany, setPortalductCompany] = useState<PortalDuctCompany | null>(null);\n    const [availableClients, setAvailableClients] = useState<FactorCloudClient[]>([]);\n\n    // Debtor & Connection State\n    const [mergedDebtors, setMergedDebtors] = useState<MergedDebtor[]>([]);\n    const [selectedDebtor, setSelectedDebtor] = useState<MergedDebtor | null>(null);\n    const [loading, setLoading] = useState(false);\n\n    // Portal & Connection State\n    const [availablePortals, setAvailablePortals] = useState<PortalMapping[]>([]);\n    const [loadingPortals, setLoadingPortals] = useState(false);\n    const [connectOpen, setConnectOpen] = useState(false);\n    const [debtorToConnect, setDebtorToConnect] = useState<MergedDebtor | null>(null);\n    const [connecting, setConnecting] = useState(false);\n    const [isChangingPortal, setIsChangingPortal] = useState(false);\n\n    // Request Portal Modal State\n    const [requestPortalOpen, setRequestPortalOpen] = useState(false);\n    const [creatingPortal, setCreatingPortal] = useState(false);\n\n    // Edit Credentials State\n    const [editCredentialsOpen, setEditCredentialsOpen] = useState(false);\n    const [debtorToEdit, setDebtorToEdit] = useState<MergedDebtor | null>(null);\n    const [updatingCredentials, setUpdatingCredentials] = useState(false);\n\n    // Toggle Activation State\n    const [togglingDebtorId, setTogglingDebtorId] = useState<string | null>(null);\n\n    // Sync State\n    const [syncingDebtorId, setSyncingDebtorId] = useState<string | null>(null);\n    const [syncTimeouts, setSyncTimeouts] = useState<Map<string, number>>(new Map());\n\n    // Verification State\n    const [verifyingDebtorId, setVerifyingDebtorId] = useState<string | null>(null);\n    const [verifyTimeouts, setVerifyTimeouts] = useState<Map<string, number>>(new Map());\n\n    // Sync Progress State\n    const [showSyncModal, setShowSyncModal] = useState(false);\n    const [syncStep, setSyncStep] = useState<SyncStep>(\"idle\");\n    const [syncError, setSyncError] = useState<string>();\n    const [activeDebtorTab, setActiveDebtorTab] = useState<MergedDebtor[\"status\"]>(\"not_connected\");\n\n    const { toast } = useToast();\n\n    // Customer status state\n    const localCustomerStatus = useCustomerStatus(config, {\n        skip: !!customerStatus,\n    });\n    const resolvedCustomerStatus = customerStatus ?? localCustomerStatus;\n    const isCustomerActive = resolvedCustomerStatus.isActive;\n    const customerStatusLoading = resolvedCustomerStatus.loading;\n    const customerStatusError = resolvedCustomerStatus.error;\n    const resolvedConfigFromStatus = resolvedCustomerStatus.resolvedConfig;\n    const fallbackConfig = isConfigComplete(config) ? config : null;\n    const runtimeConfig = resolvedConfigFromStatus ?? fallbackConfig;\n    const configuredClientId =\n        runtimeConfig?.factorcloud?.client_id ?? config?.factorcloud?.client_id;\n\n    // Initialize orchestration service when config is provided\n    useEffect(() => {\n        if (runtimeConfig && isConfigComplete(runtimeConfig)) {\n            const service = new DataOrchestrationService(runtimeConfig);\n            setOrchestrationService(service);\n        } else {\n            setOrchestrationService(null);\n        }\n    }, [runtimeConfig]);\n\n    // Auto-start sync if enabled\n    useEffect(() => {\n        if (\n            autoStart &&\n            orchestrationService &&\n            !showSyncModal &&\n            isCustomerActive === true &&\n            !customerStatusLoading\n        ) {\n            handleAutoSync();\n        }\n    }, [\n        autoStart,\n        orchestrationService,\n        showSyncModal,\n        isCustomerActive,\n        customerStatusLoading,\n    ]);\n\n    // Cleanup sync/verify timeouts on unmount\n    useEffect(() => {\n        return () => {\n            syncTimeouts.forEach((timeoutId) => {\n                window.clearTimeout(timeoutId);\n            });\n            verifyTimeouts.forEach((timeoutId) => {\n                window.clearTimeout(timeoutId);\n            });\n        };\n    }, [syncTimeouts, verifyTimeouts]);\n\n    // Load Data Handler\n    const loadDebtorData = async (service?: DataOrchestrationService) => {\n        const svc = service || orchestrationService;\n        if (!svc || !runtimeConfig) return;\n\n        setLoading(true);\n        try {\n            // If no client_id configured, show client selection in sync modal\n            if (!runtimeConfig.factorcloud?.client_id) {\n                setSyncStep(\"loading-clients\");\n                const clients = await svc.getFactorCloudClients();\n                setAvailableClients(clients);\n                setSyncStep(\"selecting-client\");\n                return;\n            }\n\n            setSyncStep(\"loading-data\");\n\n            // Get or create client\n            const fcClient = await svc.getFactorCloudClient(\n                runtimeConfig.factorcloud.client_id\n            );\n            setFactorcloudClient(fcClient);\n\n            // Ensure PortalDuct company exists\n            const pdCompany = await svc.ensurePortalDuctCompany(fcClient);\n            setPortalductCompany(pdCompany);\n\n            // Fetch merged debtors\n            const debtors = await svc.fetchMergedDebtors(fcClient.id, pdCompany.company_id);\n            setMergedDebtors(debtors);\n\n            setSyncStep(\"selecting-debtor\");\n\n            toast({\n                title: \"Data Loaded\",\n                description: `Loaded ${debtors.length} debtors. Select a debtor to continue.`,\n            });\n\n            onSyncComplete?.(debtors);\n        } catch (error) {\n            console.error(\"Failed to load data:\", error);\n            const err = error instanceof Error ? error : new Error(\"An error occurred\");\n\n            if (\n                error instanceof PortalDuctAPIError &&\n                error.status === 401 &&\n                error.type === \"authentication_error\"\n            ) {\n                onTokenExpired?.(\"portalduct\");\n            }\n\n            setSyncStep(\"error\");\n            setSyncError(err.message);\n\n            toast({\n                title: \"Failed to Load Data\",\n                description: err.message,\n                variant: \"destructive\",\n            });\n            onSyncError?.(err);\n        } finally {\n            setLoading(false);\n        }\n    };\n\n    // Auto-Sync Handler\n    const handleAutoSync = async () => {\n        if (!orchestrationService) {\n            toast({\n                title: \"Service Not Ready\",\n                description: \"Please wait for the service to initialize.\",\n                variant: \"destructive\",\n            });\n            return;\n        }\n\n        if (customerStatusLoading) {\n            toast({\n                title: \"Checking Customer Status\",\n                description:\n                    \"Please wait while we confirm your FactorCloud account is active.\",\n            });\n            return;\n        }\n\n        if (isCustomerActive !== true) {\n            toast({\n                title: \"Sync Unavailable\",\n                description:\n                    customerStatusError?.message ??\n                    \"This FactorCloud account is not active yet.\",\n                variant: \"destructive\",\n            });\n            return;\n        }\n\n        setShowSyncModal(true);\n        setSyncStep(\"checking-config\");\n        setSyncError(undefined);\n\n        try {\n            await loadDebtorData(orchestrationService);\n        } catch (error) {\n            setSyncStep(\"error\");\n            const err = error instanceof Error ? error : new Error(\"An unexpected error occurred\");\n            setSyncError(err.message);\n            onSyncError?.(err);\n        }\n    };\n\n    // Client Selection Handler\n    const handleClientSelection = async (client: FactorCloudClient) => {\n        setFactorcloudClient(client);\n\n        if (!orchestrationService) return;\n\n        setSyncStep(\"loading-data\");\n        setLoading(true);\n        try {\n            const pdCompany = await orchestrationService.ensurePortalDuctCompany(client);\n            setPortalductCompany(pdCompany);\n\n            const debtors = await orchestrationService.fetchMergedDebtors(client.id, pdCompany.company_id);\n            setMergedDebtors(debtors);\n\n            setSyncStep(\"selecting-debtor\");\n            toast({\n                title: \"Client Selected\",\n                description: `Loaded ${debtors.length} debtors for ${client.companyName}. Select a debtor to continue.`,\n            });\n        } catch (error) {\n            console.error(\"Failed to load client data:\", error);\n            const err = error instanceof Error ? error : new Error(\"Failed to load client data\");\n\n            if (\n                error instanceof PortalDuctAPIError &&\n                error.status === 401 &&\n                error.type === \"authentication_error\"\n            ) {\n                onTokenExpired?.(\"portalduct\");\n            }\n\n            setSyncStep(\"error\");\n            setSyncError(err.message);\n            toast({\n                title: \"Failed to load client data\",\n                description: err.message,\n                variant: \"destructive\",\n            });\n            onSyncError?.(err);\n        } finally {\n            setLoading(false);\n        }\n    };\n\n    // Debtor Selection Handler\n    const handleDebtorSelection = async (debtor: MergedDebtor) => {\n        setSelectedDebtor(debtor);\n        setSyncStep(\"review\");\n        toast({\n            title: \"Debtor Selected\",\n            description: `${debtor.debtorName} selected. Review invoices in the tabs below.`,\n        });\n    };\n\n    // Request connect from modal flow - fetch portals and open modal\n    const requestConnectDebtor = async (debtor: MergedDebtor) => {\n        if (!orchestrationService) return;\n\n        setDebtorToConnect(debtor);\n        setIsChangingPortal(false);\n        setLoadingPortals(true);\n        setShowSyncModal(false);\n        setConnectOpen(true);\n\n        try {\n            const pd = orchestrationService.getPortalDuctAPI();\n            const portals = await pd.getPortalMappings();\n            setAvailablePortals(portals);\n        } catch (error) {\n            console.error(\"Failed to fetch portals\", error);\n            const err = error instanceof Error ? error : new Error(\"Unable to fetch portals.\");\n\n            if (\n                error instanceof PortalDuctAPIError &&\n                error.status === 401 &&\n                error.type === \"authentication_error\"\n            ) {\n                onTokenExpired?.(\"portalduct\");\n            }\n\n            setSyncStep(\"error\");\n            setSyncError(err.message);\n            toast({\n                title: \"Failed to fetch portals\",\n                description: err.message,\n                variant: \"destructive\"\n            });\n            setShowSyncModal(true);\n            setConnectOpen(false);\n        } finally {\n            setLoadingPortals(false);\n        }\n    };\n\n    // Request change portal - fetch portals and open modal\n    const requestChangePortal = async (debtor: MergedDebtor) => {\n        if (!orchestrationService) return;\n\n        setDebtorToConnect(debtor);\n        setIsChangingPortal(true);\n        setLoadingPortals(true);\n        setShowSyncModal(false);\n        setConnectOpen(true);\n\n        try {\n            const pd = orchestrationService.getPortalDuctAPI();\n            const portals = await pd.getPortalMappings();\n            setAvailablePortals(portals);\n        } catch (error) {\n            console.error(\"Failed to fetch portals\", error);\n            const err = error instanceof Error ? error : new Error(\"Unable to fetch portals.\");\n\n            if (\n                error instanceof PortalDuctAPIError &&\n                error.status === 401 &&\n                error.type === \"authentication_error\"\n            ) {\n                onTokenExpired?.(\"portalduct\");\n            }\n\n            setSyncStep(\"error\");\n            setSyncError(err.message);\n            toast({\n                title: \"Failed to fetch portals\",\n                description: err.message,\n                variant: \"destructive\"\n            });\n            setShowSyncModal(true);\n            setConnectOpen(false);\n        } finally {\n            setLoadingPortals(false);\n        }\n    };\n\n    // Handle connect modal close - reopen sync modal\n    const handleConnectModalClose = (open: boolean) => {\n        setConnectOpen(open);\n        if (!open) {\n            setShowSyncModal(true);\n        }\n    };\n\n    // Request new portal from ConnectDebtorModal\n    const handleRequestNewPortal = () => {\n        setConnectOpen(false);\n        setRequestPortalOpen(true);\n    };\n\n    // Create new portal mapping\n    const handleCreatePortal = async (name: string, host: string) => {\n        if (!orchestrationService || !runtimeConfig?.portalduct?.customer_id) return;\n\n        try {\n            setCreatingPortal(true);\n            const pd = orchestrationService.getPortalDuctAPI();\n            const newPortal = await pd.createPortalMapping({\n                customer_id: runtimeConfig.portalduct.customer_id,\n                name,\n                host,\n            });\n\n            // Refresh portals list\n            const portals = await pd.getPortalMappings();\n            setAvailablePortals(portals);\n\n            setRequestPortalOpen(false);\n            setConnectOpen(true);\n\n            toast({\n                title: \"Portal created\",\n                description: `${newPortal.name} has been added to your portals.`\n            });\n        } catch (error) {\n            console.error(\"Failed to create portal\", error);\n            const err = error instanceof Error ? error : new Error(\"Unable to create portal.\");\n\n            if (\n                error instanceof PortalDuctAPIError &&\n                error.status === 401 &&\n                error.type === \"authentication_error\"\n            ) {\n                onTokenExpired?.(\"portalduct\");\n                setSyncStep(\"error\");\n                setSyncError(err.message);\n            }\n\n            toast({\n                title: \"Failed to create portal\",\n                description: err.message,\n                variant: \"destructive\"\n            });\n        } finally {\n            setCreatingPortal(false);\n        }\n    };\n\n    // Perform actual connection creation or update\n    const handlePerformConnect = async (portalId: string, username: string, password: string) => {\n        if (!orchestrationService || !portalductCompany || !factorcloudClient || !debtorToConnect) {\n            toast({ title: \"Cannot connect\", description: \"Missing context to create connection.\", variant: \"destructive\" });\n            return;\n        }\n\n        try {\n            setConnecting(true);\n            const pd = orchestrationService.getPortalDuctAPI();\n\n            const portal = availablePortals.find(p => p.portal_id === portalId);\n\n            if (isChangingPortal && debtorToConnect.connection) {\n                await pd.updateConnection(debtorToConnect.connection.connection_id, {\n                    portal_id: portalId,\n                    user_name: username,\n                    password,\n                });\n                toast({ title: \"Portal changed\", description: `${debtorToConnect.debtorName} portal updated to ${portal?.name}.` });\n            } else {\n                await pd.createConnection({\n                    company_id: portalductCompany.company_id,\n                    portal_id: portalId,\n                    user_name: username,\n                    password,\n                    tags: {\n                        factorcloud_id: factorcloudClient.id,\n                        factorcloud_debtor_id: debtorToConnect.factorcloudDebtorId,\n                    },\n                });\n                toast({ title: \"Connection created\", description: `${debtorToConnect.debtorName} is now connected (pending).` });\n            }\n\n            // Refresh merged debtors\n            const updated = await orchestrationService.fetchMergedDebtors(factorcloudClient.id, portalductCompany.company_id);\n            setMergedDebtors(updated);\n\n            setConnectOpen(false);\n            setShowSyncModal(true);\n            setActiveDebtorTab(\"connected\");\n            setDebtorToConnect(null);\n            setIsChangingPortal(false);\n        } catch (error) {\n            console.error(isChangingPortal ? \"Change portal failed\" : \"Create connection failed\", error);\n            const err =\n                error instanceof Error\n                    ? error\n                    : new Error(\n                        `Unable to ${isChangingPortal ? \"change portal\" : \"create connection\"}.`\n                    );\n\n            if (\n                error instanceof PortalDuctAPIError &&\n                error.status === 401 &&\n                error.type === \"authentication_error\"\n            ) {\n                onTokenExpired?.(\"portalduct\");\n                setSyncStep(\"error\");\n                setSyncError(err.message);\n            }\n\n            toast({\n                title: isChangingPortal ? \"Change portal failed\" : \"Connection failed\",\n                description: err.message,\n                variant: \"destructive\"\n            });\n        } finally {\n            setConnecting(false);\n        }\n    };\n\n    // Edit credentials\n    const handleEditCredentials = (debtor: MergedDebtor) => {\n        setDebtorToEdit(debtor);\n        setEditCredentialsOpen(true);\n    };\n\n    // Update credentials\n    const handleUpdateCredentials = async (username: string, password: string) => {\n        if (!orchestrationService || !portalductCompany || !factorcloudClient || !debtorToEdit?.connection) return;\n\n        try {\n            setUpdatingCredentials(true);\n            const pd = orchestrationService.getPortalDuctAPI();\n\n            const updatePayload: any = {};\n            if (username) updatePayload.user_name = username;\n            if (password) updatePayload.password = password;\n\n            await pd.updateConnection(debtorToEdit.connection.connection_id, updatePayload);\n\n            // Refresh merged debtors\n            const updated = await orchestrationService.fetchMergedDebtors(factorcloudClient.id, portalductCompany.company_id);\n            setMergedDebtors(updated);\n\n            setEditCredentialsOpen(false);\n            setDebtorToEdit(null);\n            toast({ title: \"Credentials updated\", description: `Updated credentials for ${debtorToEdit.debtorName}.` });\n        } catch (error) {\n            console.error(\"Update credentials failed\", error);\n            const err = error instanceof Error ? error : new Error(\"Unable to update credentials.\");\n\n            if (\n                error instanceof PortalDuctAPIError &&\n                error.status === 401 &&\n                error.type === \"authentication_error\"\n            ) {\n                onTokenExpired?.(\"portalduct\");\n                setSyncStep(\"error\");\n                setSyncError(err.message);\n            }\n\n            toast({ title: \"Update failed\", description: err.message, variant: \"destructive\" });\n        } finally {\n            setUpdatingCredentials(false);\n        }\n    };\n\n    // Toggle activation status\n    const handleToggleActivation = async (debtor: MergedDebtor) => {\n        if (!orchestrationService || !portalductCompany || !factorcloudClient || !debtor.connection) return;\n\n        const isDeactivated = debtor.status === \"deactivated\";\n        const action = isDeactivated ? \"activate\" : \"deactivate\";\n\n        try {\n            setTogglingDebtorId(debtor.factorcloudDebtorId);\n            const pd = orchestrationService.getPortalDuctAPI();\n\n            if (isDeactivated) {\n                await pd.activateConnection(debtor.connection.connection_id);\n            } else {\n                await pd.deactivateConnection(debtor.connection.connection_id);\n            }\n\n            // Refresh merged debtors\n            const updated = await orchestrationService.fetchMergedDebtors(factorcloudClient.id, portalductCompany.company_id);\n            setMergedDebtors(updated);\n\n            // Switch to appropriate tab\n            setActiveDebtorTab(isDeactivated ? \"connected\" : \"deactivated\");\n\n            toast({\n                title: `Connection ${action}d`,\n                description: `${debtor.debtorName} connection has been ${action}d.`\n            });\n        } catch (error) {\n            console.error(`Failed to ${action} connection`, error);\n            const err =\n                error instanceof Error\n                    ? error\n                    : new Error(`Unable to ${action} connection.`);\n\n            if (\n                error instanceof PortalDuctAPIError &&\n                error.status === 401 &&\n                error.type === \"authentication_error\"\n            ) {\n                onTokenExpired?.(\"portalduct\");\n                setSyncStep(\"error\");\n                setSyncError(err.message);\n            }\n\n            toast({\n                title: `Failed to ${action}`,\n                description: err.message,\n                variant: \"destructive\"\n            });\n        } finally {\n            setTogglingDebtorId(null);\n        }\n    };\n\n    // Handle sync debtor\n    const handleSyncDebtor = async (debtor: MergedDebtor) => {\n        if (!debtor.connection) {\n            toast({\n                title: \"Cannot Sync\",\n                description: `${debtor.debtorName} is not connected to a portal`,\n                variant: \"destructive\",\n            });\n            return;\n        }\n\n        const service = orchestrationService;\n        if (!service) {\n            toast({\n                title: \"Service Not Ready\",\n                description: \"PortalDuct service is not available yet.\",\n                variant: \"destructive\",\n            });\n            return;\n        }\n\n        setSyncingDebtorId(debtor.factorcloudDebtorId);\n\n        const timeoutId = window.setTimeout(() => {\n            setSyncingDebtorId(null);\n            setSyncTimeouts((prev) => {\n                const next = new Map(prev);\n                next.delete(debtor.factorcloudDebtorId);\n                return next;\n            });\n        }, 15 * 60 * 1000);\n\n        setSyncTimeouts((prev) => {\n            const next = new Map(prev);\n            next.set(debtor.factorcloudDebtorId, timeoutId);\n            return next;\n        });\n\n        try {\n            const result = await service.triggerConnectionSync(debtor.connection.connection_id);\n\n            const timestamp = new Date().toISOString();\n\n            setMergedDebtors((prev) => prev.map((item) => item.factorcloudDebtorId === debtor.factorcloudDebtorId\n                ? {\n                    ...item,\n                    lastSync: timestamp,\n                    lastSyncSummary: {\n                        processed: result.processed,\n                        synced: result.synced,\n                        failed: result.failed,\n                        timestamp,\n                    },\n                }\n                : item));\n\n            setSyncingDebtorId(null);\n            const timeout = syncTimeouts.get(debtor.factorcloudDebtorId);\n            if (timeout !== undefined) {\n                window.clearTimeout(timeout);\n            }\n            setSyncTimeouts((prev) => {\n                const next = new Map(prev);\n                next.delete(debtor.factorcloudDebtorId);\n                return next;\n            });\n\n            toast({\n                title: result.failed > 0 ? \"Sync Completed with Warnings\" : \"Sync Completed\",\n                description: `Processed ${result.processed} records. Synced ${result.synced}. Failed ${result.failed}.`,\n            });\n        } catch (error) {\n            setSyncingDebtorId(null);\n\n            const timeoutId = syncTimeouts.get(debtor.factorcloudDebtorId);\n            if (timeoutId) {\n                window.clearTimeout(timeoutId);\n                setSyncTimeouts((prev) => {\n                    const next = new Map(prev);\n                    next.delete(debtor.factorcloudDebtorId);\n                    return next;\n                });\n            }\n\n            console.error(\"Sync failed\", error);\n            toast({\n                title: \"Sync Failed\",\n                description: error instanceof Error ? error.message : `Unable to sync ${debtor.debtorName}`,\n                variant: \"destructive\",\n            });\n        }\n    };\n\n    const handleVerifyDebtor = async (debtor: MergedDebtor) => {\n        if (!debtor.connection) {\n            toast({\n                title: \"Cannot Verify\",\n                description: `${debtor.debtorName} is not connected to a portal`,\n                variant: \"destructive\",\n            });\n            return;\n        }\n\n        const service = orchestrationService;\n        if (!service) {\n            toast({\n                title: \"Service Not Ready\",\n                description: \"PortalDuct service is not available yet.\",\n                variant: \"destructive\",\n            });\n            return;\n        }\n\n        setVerifyingDebtorId(debtor.factorcloudDebtorId);\n\n        const timeoutId = window.setTimeout(() => {\n            setVerifyingDebtorId(null);\n            setVerifyTimeouts((prev) => {\n                const next = new Map(prev);\n                next.delete(debtor.factorcloudDebtorId);\n                return next;\n            });\n        }, 15 * 60 * 1000);\n\n        setVerifyTimeouts((prev) => {\n            const next = new Map(prev);\n            next.set(debtor.factorcloudDebtorId, timeoutId);\n            return next;\n        });\n\n        try {\n            const result = await service.triggerConnectionVerification(debtor.connection.connection_id);\n\n            const timestamp = new Date().toISOString();\n\n            setMergedDebtors((prev) => prev.map((item) => item.factorcloudDebtorId === debtor.factorcloudDebtorId\n                ? {\n                    ...item,\n                    lastVerificationSummary: {\n                        processed: result.processed,\n                        synced: result.synced,\n                        failed: result.failed,\n                        timestamp,\n                    },\n                }\n                : item));\n\n            setVerifyingDebtorId(null);\n            const timeout = verifyTimeouts.get(debtor.factorcloudDebtorId);\n            if (timeout !== undefined) {\n                window.clearTimeout(timeout);\n            }\n            setVerifyTimeouts((prev) => {\n                const next = new Map(prev);\n                next.delete(debtor.factorcloudDebtorId);\n                return next;\n            });\n\n            toast({\n                title: result.failed > 0 ? \"Verification Completed with Warnings\" : \"Verification Completed\",\n                description: `Processed ${result.processed} records. Verified ${result.synced}. Failed ${result.failed}.`,\n            });\n        } catch (error) {\n            setVerifyingDebtorId(null);\n\n            const timeoutId = verifyTimeouts.get(debtor.factorcloudDebtorId);\n            if (timeoutId) {\n                window.clearTimeout(timeoutId);\n                setVerifyTimeouts((prev) => {\n                    const next = new Map(prev);\n                    next.delete(debtor.factorcloudDebtorId);\n                    return next;\n                });\n            }\n\n            console.error(\"Verification failed\", error);\n            toast({\n                title: \"Verification Failed\",\n                description: error instanceof Error ? error.message : `Unable to verify ${debtor.debtorName}`,\n                variant: \"destructive\",\n            });\n        }\n    };\n\n    return (\n        <>\n            {/* Trigger Button or Custom Trigger */}\n            {trigger ? (\n                <div\n                    onClick={isCustomerActive === true ? handleAutoSync : undefined}\n                    style={\n                        isCustomerActive === true\n                            ? undefined\n                            : { cursor: \"not-allowed\", opacity: 0.6 }\n                    }\n                >\n                    {trigger}\n                </div>\n            ) : (\n                <Button\n                    onClick={handleAutoSync}\n                    disabled={\n                        loading ||\n                        !orchestrationService ||\n                        customerStatusLoading ||\n                        isCustomerActive !== true\n                    }\n                >\n                    {loading\n                        ? \"Loading...\"\n                        : customerStatusLoading\n                            ? \"Checking Access...\"\n                            : isCustomerActive === true\n                                ? \"Sync Invoices\"\n                                : \"Sync Unavailable\"}\n                </Button>\n            )}\n\n            {/* Modals */}\n            <SyncProgressModal\n                open={showSyncModal}\n                onOpenChange={setShowSyncModal}\n                currentStep={syncStep}\n                error={syncError}\n                clients={availableClients}\n                debtors={mergedDebtors}\n                selectedDebtor={selectedDebtor}\n                selectedClient={factorcloudClient}\n                onSelectClient={handleClientSelection}\n                onSelectDebtor={handleDebtorSelection}\n                onConnectDebtor={requestConnectDebtor}\n                onEditCredentials={handleEditCredentials}\n                onChangePortal={requestChangePortal}\n                onToggleActivation={handleToggleActivation}\n                onSyncDebtor={handleSyncDebtor}\n                onVerifyDebtor={handleVerifyDebtor}\n                togglingDebtorId={togglingDebtorId}\n                syncingDebtorId={syncingDebtorId}\n                verifyingDebtorId={verifyingDebtorId}\n                allowBackToClientSelection={!configuredClientId}\n                onBackToClientSelection={() => setSyncStep(\"selecting-client\")}\n                activeTab={activeDebtorTab}\n                onActiveTabChange={setActiveDebtorTab}\n            />\n\n            <RequestPortalModal\n                open={requestPortalOpen}\n                onOpenChange={setRequestPortalOpen}\n                loading={creatingPortal}\n                onSubmit={handleCreatePortal}\n            />\n\n            <ConnectDebtorModal\n                open={connectOpen}\n                onOpenChange={handleConnectModalClose}\n                debtor={debtorToConnect}\n                availablePortals={availablePortals}\n                loadingPortals={loadingPortals}\n                loading={connecting}\n                isChangingPortal={isChangingPortal}\n                onConnect={handlePerformConnect}\n                onRequestNewPortal={handleRequestNewPortal}\n            />\n\n            <UpdateCredentialsModal\n                open={editCredentialsOpen}\n                onOpenChange={setEditCredentialsOpen}\n                debtor={debtorToEdit}\n                loading={updatingCredentials}\n                onUpdate={handleUpdateCredentials}\n            />\n        </>\n    );\n};","import { useState, useEffect } from \"react\";\nimport { Button } from \"@/components/ui/button\";\nimport { Input } from \"@/components/ui/input\";\nimport { Tabs, TabsContent, TabsList, TabsTrigger } from \"@/components/ui/tabs\";\nimport { useToast } from \"@/hooks/use-toast\";\nimport { useCustomerStatus } from \"@/hooks/use-customer-status\";\nimport { \n  Search, Clock, Edit2, Building, DollarSign, CreditCard, \n  RefreshCw, BookOpen, Calculator, FileText\n} from \"lucide-react\";\nimport { SDKConfig, isConfigComplete } from \"@/types/config\";\nimport { FactorCloudClient } from \"@/types/factorcloud\";\nimport { PortalDuctCompany } from \"@/types/portalduct\";\nimport { MergedDebtor } from \"@/types/merged\";\nimport { DataOrchestrationService } from \"@/services/orchestration\";\nimport { PortalDuctAPIError } from \"@/api/portalduct\";\nimport { UpdateCredentialsModal } from \"./UpdateCredentialsModal\";\nimport { SyncProgressModal, SyncStep } from \"./SyncProgressModal\";\nimport { ConnectDebtorModal } from \"./ConnectDebtorModal\";\nimport { RequestPortalModal } from \"./RequestPortalModal\";\nimport { PortalMapping } from \"@/types/portalduct\";\n\ninterface PortalIntegrationProps {\n  config: SDKConfig;\n  onTokenExpired?: (service: 'factorcloud' | 'portalduct') => void;\n}\n\nexport const PortalIntegration = ({ config, onTokenExpired }: PortalIntegrationProps) => {\n  // Orchestration Service State\n  const [orchestrationService, setOrchestrationService] = useState<DataOrchestrationService | null>(null);\n\n  // Client Selection State\n  const [factorcloudClient, setFactorcloudClient] = useState<FactorCloudClient | null>(null);\n  const [portalductCompany, setPortalductCompany] = useState<PortalDuctCompany | null>(null);\n  const [showClientSelectionModal, setShowClientSelectionModal] = useState(false);\n  const [availableClients, setAvailableClients] = useState<FactorCloudClient[]>([]);\n\n  // Debtor & Connection State\n  const [mergedDebtors, setMergedDebtors] = useState<MergedDebtor[]>([]);\n  const [selectedDebtor, setSelectedDebtor] = useState<MergedDebtor | null>(null);\n  const [loading, setLoading] = useState(false);\n  const [searchQuery, setSearchQuery] = useState(\"\");\n\n  // Portal & Connection State\n  const [availablePortals, setAvailablePortals] = useState<PortalMapping[]>([]);\n  const [loadingPortals, setLoadingPortals] = useState(false);\n  const [connectOpen, setConnectOpen] = useState(false);\n  const [debtorToConnect, setDebtorToConnect] = useState<MergedDebtor | null>(null);\n  const [connecting, setConnecting] = useState(false);\n  const [isChangingPortal, setIsChangingPortal] = useState(false);\n  \n  // Request Portal Modal State\n  const [requestPortalOpen, setRequestPortalOpen] = useState(false);\n  const [creatingPortal, setCreatingPortal] = useState(false);\n  \n  // Edit Credentials State\n  const [editCredentialsOpen, setEditCredentialsOpen] = useState(false);\n  const [debtorToEdit, setDebtorToEdit] = useState<MergedDebtor | null>(null);\n  const [updatingCredentials, setUpdatingCredentials] = useState(false);\n  \n  // Toggle Activation State\n  const [togglingDebtorId, setTogglingDebtorId] = useState<string | null>(null);\n  \n  // Sync State\n  const [syncingDebtorId, setSyncingDebtorId] = useState<string | null>(null);\n  const [syncTimeouts, setSyncTimeouts] = useState<Map<string, number>>(new Map());\n\n  // Verification State\n  const [verifyingDebtorId, setVerifyingDebtorId] = useState<string | null>(null);\n  const [verifyTimeouts, setVerifyTimeouts] = useState<Map<string, number>>(new Map());\n  \n  // Sync Progress State\n  const [showSyncModal, setShowSyncModal] = useState(false);\n  const [syncStep, setSyncStep] = useState<SyncStep>(\"idle\");\n  const [syncError, setSyncError] = useState<string>();\n  const [activeDebtorTab, setActiveDebtorTab] = useState<MergedDebtor[\"status\"]>(\"not_connected\");\n\n  const { toast } = useToast();\n  const customerStatus = useCustomerStatus(config);\n  const runtimeConfig =\n    customerStatus.resolvedConfig ?? (isConfigComplete(config) ? config : null);\n  const configuredClientId =\n    runtimeConfig?.factorcloud?.client_id ?? config?.factorcloud?.client_id;\n  const isCustomerActive = customerStatus.isActive;\n  const customerStatusLoading = customerStatus.loading;\n  const customerStatusError = customerStatus.error;\n\n  // Initialize orchestration service when config is provided\n  useEffect(() => {\n    if (runtimeConfig && isConfigComplete(runtimeConfig)) {\n      const service = new DataOrchestrationService(runtimeConfig);\n      setOrchestrationService(service);\n    } else {\n      setOrchestrationService(null);\n    }\n  }, [runtimeConfig]);\n\n  // Cleanup sync timeouts on unmount\n  useEffect(() => {\n    return () => {\n      syncTimeouts.forEach((timeoutId) => {\n        window.clearTimeout(timeoutId);\n      });\n      verifyTimeouts.forEach((timeoutId) => {\n        window.clearTimeout(timeoutId);\n      });\n    };\n  }, [syncTimeouts, verifyTimeouts]);\n\n\n  // Load Data Handler\n  const loadDebtorData = async (service?: DataOrchestrationService) => {\n    const svc = service || orchestrationService;\n    if (!svc || !runtimeConfig) return;\n\n    setLoading(true);\n    try {\n        // If no client_id configured, show client selection in sync modal\n        if (!runtimeConfig.factorcloud?.client_id) {\n          setSyncStep(\"loading-clients\");\n          const clients = await svc.getFactorCloudClients();\n          setAvailableClients(clients);\n          setSyncStep(\"selecting-client\");\n          return;\n        }\n\n      setSyncStep(\"loading-data\");\n\n      // Get or create client\n      const fcClient = await svc.getFactorCloudClient(\n        runtimeConfig.factorcloud.client_id\n      );\n      setFactorcloudClient(fcClient);\n\n      // Ensure PortalDuct company exists\n      const pdCompany = await svc.ensurePortalDuctCompany(fcClient);\n      setPortalductCompany(pdCompany);\n\n      // Fetch merged debtors\n      const debtors = await svc.fetchMergedDebtors(fcClient.id, pdCompany.company_id);\n      setMergedDebtors(debtors);\n\n      setSyncStep(\"selecting-debtor\");\n\n      toast({\n        title: \"Data Loaded\",\n        description: `Loaded ${debtors.length} debtors. Select a debtor to continue.`,\n      });\n    } catch (error) {\n      console.error(\"Failed to load data:\", error);\n      const err = error instanceof Error ? error : new Error(\"An error occurred.\");\n\n      if (\n        error instanceof PortalDuctAPIError &&\n        error.status === 401 &&\n        error.type === \"authentication_error\"\n      ) {\n        onTokenExpired?.(\"portalduct\");\n      }\n\n      setSyncStep(\"error\");\n      setSyncError(err.message);\n\n      toast({\n        title: \"Failed to Load Data\",\n        description: err.message,\n        variant: \"destructive\",\n      });\n    } finally {\n      setLoading(false);\n    }\n  };\n\n  // Auto-Sync Handler\n  const handleAutoSync = async () => {\n    if (!orchestrationService) {\n      toast({\n        title: \"Service Not Ready\",\n        description: \"Please wait for the service to initialize.\",\n        variant: \"destructive\",\n      });\n      return;\n    }\n\n    if (customerStatusLoading) {\n      toast({\n        title: \"Checking Customer Status\",\n        description: \"Please wait while we confirm your FactorCloud account is active.\",\n      });\n      return;\n    }\n\n    if (isCustomerActive !== true) {\n      toast({\n        title: \"Sync Unavailable\",\n        description:\n          customerStatusError?.message ??\n          \"This FactorCloud account is not active yet.\",\n        variant: \"destructive\",\n      });\n      return;\n    }\n\n    setShowSyncModal(true);\n    setSyncStep(\"checking-config\");\n    setSyncError(undefined);\n\n    try {\n      await loadDebtorData(orchestrationService);\n    } catch (error) {\n      setSyncStep(\"error\");\n      setSyncError(error instanceof Error ? error.message : \"An unexpected error occurred\");\n    }\n  };\n\n  // Client Selection Handler\n  const handleClientSelection = async (client: FactorCloudClient) => {\n    setFactorcloudClient(client);\n\n    if (!orchestrationService) return;\n\n    setSyncStep(\"loading-data\");\n    setLoading(true);\n    try {\n      const pdCompany = await orchestrationService.ensurePortalDuctCompany(client);\n      setPortalductCompany(pdCompany);\n\n      const debtors = await orchestrationService.fetchMergedDebtors(client.id, pdCompany.company_id);\n      setMergedDebtors(debtors);\n\n      setSyncStep(\"selecting-debtor\");\n      toast({\n        title: \"Client Selected\",\n        description: `Loaded ${debtors.length} debtors for ${client.companyName}. Select a debtor to continue.`,\n      });\n    } catch (error) {\n      console.error(\"Failed to load client data:\", error);\n      const err =\n        error instanceof Error ? error : new Error(\"Failed to load client data\");\n\n      if (\n        error instanceof PortalDuctAPIError &&\n        error.status === 401 &&\n        error.type === \"authentication_error\"\n      ) {\n        onTokenExpired?.(\"portalduct\");\n      }\n\n      setSyncStep(\"error\");\n      setSyncError(err.message);\n      toast({\n        title: \"Failed to load client data\",\n        description: err.message,\n        variant: \"destructive\",\n      });\n    } finally {\n      setLoading(false);\n    }\n  };\n\n  // Debtor Selection Handler\n  const handleDebtorSelection = async (debtor: MergedDebtor) => {\n    setSelectedDebtor(debtor);\n    setSyncStep(\"review\");\n    toast({\n      title: \"Debtor Selected\",\n      description: `${debtor.debtorName} selected. Review invoices in the tabs below.`,\n    });\n  };\n\n  // Request connect from modal flow - fetch portals and open modal\n  const requestConnectDebtor = async (debtor: MergedDebtor) => {\n    if (!orchestrationService) return;\n    \n    setDebtorToConnect(debtor);\n    setIsChangingPortal(false);\n    setLoadingPortals(true);\n    setShowSyncModal(false); // Close sync modal\n    setConnectOpen(true);\n    \n    try {\n      const pd = orchestrationService.getPortalDuctAPI();\n      const portals = await pd.getPortalMappings();\n      setAvailablePortals(portals);\n    } catch (error) {\n      console.error(\"Failed to fetch portals\", error);\n      const err = error instanceof Error ? error : new Error(\"Unable to fetch portals.\");\n\n      if (\n        error instanceof PortalDuctAPIError &&\n        error.status === 401 &&\n        error.type === \"authentication_error\"\n      ) {\n        onTokenExpired?.(\"portalduct\");\n      }\n\n      setSyncStep(\"error\");\n      setSyncError(err.message);\n      toast({\n        title: \"Failed to fetch portals\",\n        description: err.message,\n        variant: \"destructive\"\n      });\n      setShowSyncModal(true); // Reopen on error\n      setConnectOpen(false);\n    } finally {\n      setLoadingPortals(false);\n    }\n  };\n\n  // Request change portal - fetch portals and open modal\n  const requestChangePortal = async (debtor: MergedDebtor) => {\n    if (!orchestrationService) return;\n    \n    setDebtorToConnect(debtor);\n    setIsChangingPortal(true);\n    setLoadingPortals(true);\n    setShowSyncModal(false); // Close sync modal\n    setConnectOpen(true);\n    \n    try {\n      const pd = orchestrationService.getPortalDuctAPI();\n      const portals = await pd.getPortalMappings();\n      setAvailablePortals(portals);\n    } catch (error) {\n      console.error(\"Failed to fetch portals\", error);\n      const err = error instanceof Error ? error : new Error(\"Unable to fetch portals.\");\n\n      if (\n        error instanceof PortalDuctAPIError &&\n        error.status === 401 &&\n        error.type === \"authentication_error\"\n      ) {\n        onTokenExpired?.(\"portalduct\");\n      }\n\n      setSyncStep(\"error\");\n      setSyncError(err.message);\n      toast({\n        title: \"Failed to fetch portals\",\n        description: err.message,\n        variant: \"destructive\"\n      });\n      setShowSyncModal(true); // Reopen on error\n      setConnectOpen(false);\n    } finally {\n      setLoadingPortals(false);\n    }\n  };\n\n  // Handle connect modal close - reopen sync modal\n  const handleConnectModalClose = (open: boolean) => {\n    setConnectOpen(open);\n    if (!open) {\n      setShowSyncModal(true); // Reopen sync modal when closing connect modal\n    }\n  };\n\n  // Request new portal from ConnectDebtorModal\n  const handleRequestNewPortal = () => {\n    setConnectOpen(false);\n    setRequestPortalOpen(true);\n  };\n\n  // Create new portal mapping\n  const handleCreatePortal = async (name: string, host: string) => {\n    if (!orchestrationService || !runtimeConfig?.portalduct?.customer_id) return;\n\n    try {\n      setCreatingPortal(true);\n      const pd = orchestrationService.getPortalDuctAPI();\n      const newPortal = await pd.createPortalMapping({\n        customer_id: runtimeConfig.portalduct.customer_id,\n        name,\n        host,\n      });\n      \n      // Refresh portals list\n      const portals = await pd.getPortalMappings();\n      setAvailablePortals(portals);\n      \n      setRequestPortalOpen(false);\n      setConnectOpen(true);\n      \n      toast({ \n        title: \"Portal created\", \n        description: `${newPortal.name} has been added to your portals.` \n      });\n    } catch (error) {\n      console.error(\"Failed to create portal\", error);\n      const err = error instanceof Error ? error : new Error(\"Unable to create portal.\");\n\n      if (\n        error instanceof PortalDuctAPIError &&\n        error.status === 401 &&\n        error.type === \"authentication_error\"\n      ) {\n        onTokenExpired?.(\"portalduct\");\n      }\n\n      setSyncStep(\"error\");\n      setSyncError(err.message);\n\n      toast({\n        title: \"Failed to create portal\",\n        description: err.message,\n        variant: \"destructive\"\n      });\n    } finally {\n      setCreatingPortal(false);\n    }\n  };\n\n  // Perform actual connection creation or update\n  const handlePerformConnect = async (portalId: string, username: string, password: string) => {\n    if (!orchestrationService || !portalductCompany || !factorcloudClient || !debtorToConnect) {\n      toast({ title: \"Cannot connect\", description: \"Missing context to create connection.\", variant: \"destructive\" });\n      return;\n    }\n\n    try {\n      setConnecting(true);\n      const pd = orchestrationService.getPortalDuctAPI();\n      \n      const portal = availablePortals.find(p => p.portal_id === portalId);\n      \n      if (isChangingPortal && debtorToConnect.connection) {\n        // Update existing connection with new portal\n        await pd.updateConnection(debtorToConnect.connection.connection_id, {\n          portal_id: portalId,\n          user_name: username,\n          password,\n        });\n        toast({ title: \"Portal changed\", description: `${debtorToConnect.debtorName} portal updated to ${portal?.name}.` });\n      } else {\n        // Create new connection\n        await pd.createConnection({\n          company_id: portalductCompany.company_id,\n          portal_id: portalId,\n          user_name: username,\n          password,\n          tags: {\n            factorcloud_id: factorcloudClient.id,\n            factorcloud_debtor_id: debtorToConnect.factorcloudDebtorId,\n          },\n        });\n        toast({ title: \"Connection created\", description: `${debtorToConnect.debtorName} is now connected (pending).` });\n      }\n\n      // Refresh merged debtors\n      const updated = await orchestrationService.fetchMergedDebtors(factorcloudClient.id, portalductCompany.company_id);\n      setMergedDebtors(updated);\n\n      setConnectOpen(false);\n      setShowSyncModal(true); // Reopen sync modal after successful connection\n      setActiveDebtorTab(\"connected\"); // Always go to connected tab\n      setDebtorToConnect(null);\n      setIsChangingPortal(false);\n    } catch (error) {\n      console.error(isChangingPortal ? \"Change portal failed\" : \"Create connection failed\", error);\n      const err =\n        error instanceof Error\n          ? error\n          : new Error(\n              `Unable to ${isChangingPortal ? \"change portal\" : \"create connection\"}.`\n            );\n\n      if (\n        error instanceof PortalDuctAPIError &&\n        error.status === 401 &&\n        error.type === \"authentication_error\"\n      ) {\n        onTokenExpired?.(\"portalduct\");\n        setSyncStep(\"error\");\n        setSyncError(err.message);\n      }\n\n      toast({\n        title: isChangingPortal ? \"Change portal failed\" : \"Connection failed\",\n        description: err.message,\n        variant: \"destructive\"\n      });\n    } finally {\n      setConnecting(false);\n    }\n  };\n\n  // Edit credentials\n  const handleEditCredentials = (debtor: MergedDebtor) => {\n    setDebtorToEdit(debtor);\n    setEditCredentialsOpen(true);\n  };\n\n  // Update credentials\n  const handleUpdateCredentials = async (username: string, password: string) => {\n    if (!orchestrationService || !portalductCompany || !factorcloudClient || !debtorToEdit?.connection) return;\n\n    try {\n      setUpdatingCredentials(true);\n      const pd = orchestrationService.getPortalDuctAPI();\n      \n      const updatePayload: any = {};\n      if (username) updatePayload.user_name = username;\n      if (password) updatePayload.password = password;\n      \n      await pd.updateConnection(debtorToEdit.connection.connection_id, updatePayload);\n\n      // Refresh merged debtors\n      const updated = await orchestrationService.fetchMergedDebtors(factorcloudClient.id, portalductCompany.company_id);\n      setMergedDebtors(updated);\n\n      setEditCredentialsOpen(false);\n      setDebtorToEdit(null);\n      toast({ title: \"Credentials updated\", description: `Updated credentials for ${debtorToEdit.debtorName}.` });\n    } catch (error) {\n      console.error(\"Update credentials failed\", error);\n      const err = error instanceof Error ? error : new Error(\"Unable to update credentials.\");\n\n      if (\n        error instanceof PortalDuctAPIError &&\n        error.status === 401 &&\n        error.type === \"authentication_error\"\n      ) {\n        onTokenExpired?.(\"portalduct\");\n        setSyncStep(\"error\");\n        setSyncError(err.message);\n      }\n\n      toast({ title: \"Update failed\", description: err.message, variant: \"destructive\" });\n    } finally {\n      setUpdatingCredentials(false);\n    }\n  };\n\n  // Toggle activation status\n  const handleToggleActivation = async (debtor: MergedDebtor) => {\n    if (!orchestrationService || !portalductCompany || !factorcloudClient || !debtor.connection) return;\n\n    const isDeactivated = debtor.status === \"deactivated\";\n    const action = isDeactivated ? \"activate\" : \"deactivate\";\n\n    try {\n      setTogglingDebtorId(debtor.factorcloudDebtorId);\n      const pd = orchestrationService.getPortalDuctAPI();\n      \n      if (isDeactivated) {\n        await pd.activateConnection(debtor.connection.connection_id);\n      } else {\n        await pd.deactivateConnection(debtor.connection.connection_id);\n      }\n\n      // Refresh merged debtors\n      const updated = await orchestrationService.fetchMergedDebtors(factorcloudClient.id, portalductCompany.company_id);\n      setMergedDebtors(updated);\n\n      // Switch to appropriate tab\n      setActiveDebtorTab(isDeactivated ? \"connected\" : \"deactivated\");\n\n      toast({ \n        title: `Connection ${action}d`, \n        description: `${debtor.debtorName} connection has been ${action}d.` \n      });\n    } catch (error) {\n      console.error(`Failed to ${action} connection`, error);\n      const err =\n        error instanceof Error\n          ? error\n          : new Error(`Unable to ${action} connection.`);\n\n      if (\n        error instanceof PortalDuctAPIError &&\n        error.status === 401 &&\n        error.type === \"authentication_error\"\n      ) {\n        onTokenExpired?.(\"portalduct\");\n        setSyncStep(\"error\");\n        setSyncError(err.message);\n      }\n\n      toast({\n        title: `Failed to ${action}`,\n        description: err.message,\n        variant: \"destructive\"\n      });\n    } finally {\n      setTogglingDebtorId(null);\n    }\n  };\n\n  // Handle sync debtor\n  const handleSyncDebtor = async (debtor: MergedDebtor) => {\n    // Validate connection exists\n    if (!debtor.connection) {\n      toast({\n        title: \"Cannot Sync\",\n        description: `${debtor.debtorName} is not connected to a portal`,\n        variant: \"destructive\",\n      });\n      return;\n    }\n\n    const service = orchestrationService;\n    if (!service) {\n      toast({\n        title: \"Service Not Ready\",\n        description: \"PortalDuct service is not available yet.\",\n        variant: \"destructive\",\n      });\n      return;\n    }\n\n    setSyncingDebtorId(debtor.factorcloudDebtorId);\n\n    // Set 15 minute timeout for UI state\n    const timeoutId = window.setTimeout(() => {\n      setSyncingDebtorId(null);\n      setSyncTimeouts((prev) => {\n        const next = new Map(prev);\n        next.delete(debtor.factorcloudDebtorId);\n        return next;\n      });\n    }, 15 * 60 * 1000); // 15 minutes\n    \n    setSyncTimeouts((prev) => {\n      const next = new Map(prev);\n      next.set(debtor.factorcloudDebtorId, timeoutId);\n      return next;\n    });\n\n    try {\n      // Call the webhook sync API\n      const result = await service.triggerConnectionSync(\n        debtor.connection.connection_id\n      );\n\n      const timestamp = new Date().toISOString();\n\n      setMergedDebtors((prev) =>\n        prev.map((item) =>\n          item.factorcloudDebtorId === debtor.factorcloudDebtorId\n            ? {\n                ...item,\n                lastSync: timestamp,\n                lastSyncSummary: {\n                  processed: result.processed,\n                  synced: result.synced,\n                  failed: result.failed,\n                  timestamp,\n                },\n              }\n            : item\n        )\n      );\n\n      setSyncingDebtorId(null);\n      const timeout = syncTimeouts.get(debtor.factorcloudDebtorId);\n      if (timeout !== undefined) {\n        window.clearTimeout(timeout);\n      }\n      setSyncTimeouts((prev) => {\n        const next = new Map(prev);\n        next.delete(debtor.factorcloudDebtorId);\n        return next;\n      });\n\n      toast({\n        title: result.failed > 0 ? \"Sync Completed with Warnings\" : \"Sync Completed\",\n        description: `Processed ${result.processed} records. Synced ${result.synced}. Failed ${result.failed}.`,\n      });\n    } catch (error) {\n      // Clear the syncing state on error\n      setSyncingDebtorId(null);\n\n      // Clear the timeout\n      const timeoutId = syncTimeouts.get(debtor.factorcloudDebtorId);\n      if (timeoutId) {\n        window.clearTimeout(timeoutId);\n        setSyncTimeouts((prev) => {\n          const next = new Map(prev);\n          next.delete(debtor.factorcloudDebtorId);\n          return next;\n        });\n      }\n      \n      console.error(\"Sync failed\", error);\n      toast({\n        title: \"Sync Failed\",\n        description: error instanceof Error ? error.message : `Unable to sync ${debtor.debtorName}`,\n        variant: \"destructive\",\n      });\n    }\n  };\n\n  const handleVerifyDebtor = async (debtor: MergedDebtor) => {\n    if (!debtor.connection) {\n      toast({\n        title: \"Cannot Verify\",\n        description: `${debtor.debtorName} is not connected to a portal`,\n        variant: \"destructive\",\n      });\n      return;\n    }\n\n    const service = orchestrationService;\n    if (!service) {\n      toast({\n        title: \"Service Not Ready\",\n        description: \"PortalDuct service is not available yet.\",\n        variant: \"destructive\",\n      });\n      return;\n    }\n\n    setVerifyingDebtorId(debtor.factorcloudDebtorId);\n\n    const timeoutId = window.setTimeout(() => {\n      setVerifyingDebtorId(null);\n      setVerifyTimeouts((prev) => {\n        const next = new Map(prev);\n        next.delete(debtor.factorcloudDebtorId);\n        return next;\n      });\n    }, 15 * 60 * 1000);\n\n    setVerifyTimeouts((prev) => {\n      const next = new Map(prev);\n      next.set(debtor.factorcloudDebtorId, timeoutId);\n      return next;\n    });\n\n    try {\n      const result = await service.triggerConnectionVerification(\n        debtor.connection.connection_id\n      );\n\n      const timestamp = new Date().toISOString();\n\n      setMergedDebtors((prev) =>\n        prev.map((item) =>\n          item.factorcloudDebtorId === debtor.factorcloudDebtorId\n            ? {\n                ...item,\n                lastVerificationSummary: {\n                  processed: result.processed,\n                  synced: result.synced,\n                  failed: result.failed,\n                  timestamp,\n                },\n              }\n            : item\n        )\n      );\n\n      setVerifyingDebtorId(null);\n      const timeout = verifyTimeouts.get(debtor.factorcloudDebtorId);\n      if (timeout !== undefined) {\n        window.clearTimeout(timeout);\n      }\n      setVerifyTimeouts((prev) => {\n        const next = new Map(prev);\n        next.delete(debtor.factorcloudDebtorId);\n        return next;\n      });\n\n      toast({\n        title:\n          result.failed > 0\n            ? \"Verification Completed with Warnings\"\n            : \"Verification Completed\",\n        description: `Processed ${result.processed} records. Verified ${result.synced}. Failed ${result.failed}.`,\n      });\n    } catch (error) {\n      setVerifyingDebtorId(null);\n\n      const timeoutId = verifyTimeouts.get(debtor.factorcloudDebtorId);\n      if (timeoutId) {\n        window.clearTimeout(timeoutId);\n        setVerifyTimeouts((prev) => {\n          const next = new Map(prev);\n          next.delete(debtor.factorcloudDebtorId);\n          return next;\n        });\n      }\n\n      console.error(\"Verification failed\", error);\n      toast({\n        title: \"Verification Failed\",\n        description:\n          error instanceof Error\n            ? error.message\n            : `Unable to verify ${debtor.debtorName}`,\n        variant: \"destructive\",\n      });\n    }\n  };\n\n  return (\n    <div className=\"flex min-h-screen bg-background\">\n      {/* Sidebar */}\n      <aside className=\"w-80 bg-[hsl(220,30%,15%)] text-white flex flex-col\">\n        {/* Logo */}\n        <div className=\"p-6 border-b border-white/10\">\n          <h1 className=\"text-2xl font-bold\">FACTORCLOUD</h1>\n          <p className=\"text-sm text-white/60 mt-1\">SANDBOX</p>\n        </div>\n\n        {/* Navigation */}\n        <nav className=\"flex-1 p-4 space-y-1\">\n          <button className=\"w-full flex items-center gap-3 px-4 py-3 rounded-lg text-white/70 hover:bg-white/5 transition-colors\">\n            <Clock className=\"w-5 h-5\" />\n            <span>Dashboard</span>\n          </button>\n          <button className=\"w-full flex items-center gap-3 px-4 py-3 rounded-lg text-white/70 hover:bg-white/5 transition-colors\">\n            <Building className=\"w-5 h-5\" />\n            <span>Companies</span>\n          </button>\n          <button className=\"w-full flex items-center gap-3 px-4 py-3 rounded-lg text-white/70 hover:bg-white/5 transition-colors\">\n            <Edit2 className=\"w-5 h-5\" />\n            <span>Terms</span>\n          </button>\n          <button className=\"w-full flex items-center gap-3 px-4 py-3 rounded-lg bg-white/10 text-white\">\n            <FileText className=\"w-5 h-5\" />\n            <span>Invoices</span>\n          </button>\n          <button className=\"w-full flex items-center gap-3 px-4 py-3 rounded-lg text-white/70 hover:bg-white/5 transition-colors\">\n            <DollarSign className=\"w-5 h-5\" />\n            <span>Funding</span>\n          </button>\n          <button className=\"w-full flex items-center gap-3 px-4 py-3 rounded-lg text-white/70 hover:bg-white/5 transition-colors\">\n            <CreditCard className=\"w-5 h-5\" />\n            <span>Payments</span>\n          </button>\n          <button className=\"w-full flex items-center gap-3 px-4 py-3 rounded-lg text-white/70 hover:bg-white/5 transition-colors\">\n            <RefreshCw className=\"w-5 h-5\" />\n            <span>Chargebacks</span>\n          </button>\n          <button className=\"w-full flex items-center gap-3 px-4 py-3 rounded-lg text-white/70 hover:bg-white/5 transition-colors\">\n            <BookOpen className=\"w-5 h-5\" />\n            <span>Ledgers</span>\n          </button>\n          <button className=\"w-full flex items-center gap-3 px-4 py-3 rounded-lg text-white/70 hover:bg-white/5 transition-colors\">\n            <Calculator className=\"w-5 h-5\" />\n            <span>Accounting</span>\n          </button>\n        </nav>\n      </aside>\n\n      {/* Main Content */}\n      <main className=\"flex-1 flex flex-col\">\n        {/* Header */}\n        <header className=\"border-b bg-background p-6\">\n          <div className=\"flex items-center justify-between\">\n            <h1 className=\"text-4xl font-bold\">Invoices</h1>\n          <div className=\"flex items-center gap-3\">\n              <Button variant=\"outline\">\n                Export Invoices\n              </Button>\n              <Button\n                variant=\"outline\"\n                onClick={handleAutoSync}\n                disabled={\n                  loading ||\n                  !orchestrationService ||\n                  customerStatusLoading ||\n                  isCustomerActive !== true\n                }\n              >\n                {loading\n                  ? \"Loading...\"\n                  : customerStatusLoading\n                    ? \"Checking Access...\"\n                    : isCustomerActive === true\n                      ? \"Sync Invoices\"\n                      : \"Sync Unavailable\"}\n              </Button>\n              <Button className=\"bg-foreground text-background hover:bg-foreground/90\">\n                Create Invoice\n              </Button>\n            </div>\n          </div>\n        </header>\n\n        {/* Content */}\n        <div className=\"flex-1 p-6\">\n          {/* Status Tabs */}\n          <Tabs defaultValue=\"pending\" className=\"w-full\">\n            <TabsList className=\"bg-muted\">\n              <TabsTrigger value=\"pending\">Pending</TabsTrigger>\n              <TabsTrigger value=\"approved\">Approved</TabsTrigger>\n              <TabsTrigger value=\"funded\">Funded</TabsTrigger>\n              <TabsTrigger value=\"closed\">Closed</TabsTrigger>\n              <TabsTrigger value=\"rejected\">Rejected</TabsTrigger>\n              <TabsTrigger value=\"all\">All</TabsTrigger>\n            </TabsList>\n\n            <TabsContent value=\"pending\" className=\"mt-6\">\n              <div className=\"border rounded-lg p-12\">\n                <div className=\"flex flex-col items-center justify-center text-center\">\n                  <div className=\"w-24 h-24 rounded-full bg-muted flex items-center justify-center mb-4\">\n                    <FileText className=\"w-12 h-12 text-muted-foreground\" />\n                  </div>\n                  <h3 className=\"text-2xl font-semibold mb-2\">No records in the table</h3>\n                  <p className=\"text-muted-foreground\">No records found</p>\n                </div>\n              </div>\n            </TabsContent>\n\n            <TabsContent value=\"approved\" className=\"mt-6\">\n              <div className=\"border rounded-lg p-12\">\n                <div className=\"flex flex-col items-center justify-center text-center\">\n                  <div className=\"w-24 h-24 rounded-full bg-muted flex items-center justify-center mb-4\">\n                    <FileText className=\"w-12 h-12 text-muted-foreground\" />\n                  </div>\n                  <h3 className=\"text-2xl font-semibold mb-2\">No records in the table</h3>\n                  <p className=\"text-muted-foreground\">No records found</p>\n                </div>\n              </div>\n            </TabsContent>\n\n            <TabsContent value=\"funded\" className=\"mt-6\">\n              <div className=\"border rounded-lg p-12\">\n                <div className=\"flex flex-col items-center justify-center text-center\">\n                  <div className=\"w-24 h-24 rounded-full bg-muted flex items-center justify-center mb-4\">\n                    <FileText className=\"w-12 h-12 text-muted-foreground\" />\n                  </div>\n                  <h3 className=\"text-2xl font-semibold mb-2\">No records in the table</h3>\n                  <p className=\"text-muted-foreground\">No records found</p>\n                </div>\n              </div>\n            </TabsContent>\n\n            <TabsContent value=\"closed\" className=\"mt-6\">\n              <div className=\"border rounded-lg p-12\">\n                <div className=\"flex flex-col items-center justify-center text-center\">\n                  <div className=\"w-24 h-24 rounded-full bg-muted flex items-center justify-center mb-4\">\n                    <FileText className=\"w-12 h-12 text-muted-foreground\" />\n                  </div>\n                  <h3 className=\"text-2xl font-semibold mb-2\">No records in the table</h3>\n                  <p className=\"text-muted-foreground\">No records found</p>\n                </div>\n              </div>\n            </TabsContent>\n\n            <TabsContent value=\"rejected\" className=\"mt-6\">\n              <div className=\"border rounded-lg p-12\">\n                <div className=\"flex flex-col items-center justify-center text-center\">\n                  <div className=\"w-24 h-24 rounded-full bg-muted flex items-center justify-center mb-4\">\n                    <FileText className=\"w-12 h-12 text-muted-foreground\" />\n                  </div>\n                  <h3 className=\"text-2xl font-semibold mb-2\">No records in the table</h3>\n                  <p className=\"text-muted-foreground\">No records found</p>\n                </div>\n              </div>\n            </TabsContent>\n\n            <TabsContent value=\"all\" className=\"mt-6\">\n              <div className=\"border rounded-lg p-12\">\n                <div className=\"flex flex-col items-center justify-center text-center\">\n                  <div className=\"w-24 h-24 rounded-full bg-muted flex items-center justify-center mb-4\">\n                    <FileText className=\"w-12 h-12 text-muted-foreground\" />\n                  </div>\n                  <h3 className=\"text-2xl font-semibold mb-2\">No records in the table</h3>\n                  <p className=\"text-muted-foreground\">No records found</p>\n                </div>\n              </div>\n            </TabsContent>\n          </Tabs>\n        </div>\n      </main>\n\n      {/* Modals */}\n      <SyncProgressModal\n          open={showSyncModal}\n          onOpenChange={setShowSyncModal}\n          currentStep={syncStep}\n          error={syncError}\n          clients={availableClients}\n          debtors={mergedDebtors}\n          selectedDebtor={selectedDebtor}\n          selectedClient={factorcloudClient}\n          onSelectClient={handleClientSelection}\n          onSelectDebtor={handleDebtorSelection}\n          onConnectDebtor={requestConnectDebtor}\n          onEditCredentials={handleEditCredentials}\n          onChangePortal={requestChangePortal}\n          onToggleActivation={handleToggleActivation}\n          onSyncDebtor={handleSyncDebtor}\n          onVerifyDebtor={handleVerifyDebtor}\n          togglingDebtorId={togglingDebtorId}\n          syncingDebtorId={syncingDebtorId}\n          verifyingDebtorId={verifyingDebtorId}\n          allowBackToClientSelection={!configuredClientId}\n          onBackToClientSelection={() => setSyncStep(\"selecting-client\")}\n          activeTab={activeDebtorTab}\n          onActiveTabChange={setActiveDebtorTab}\n        />\n\n      <RequestPortalModal\n        open={requestPortalOpen}\n        onOpenChange={setRequestPortalOpen}\n        loading={creatingPortal}\n        onSubmit={handleCreatePortal}\n      />\n\n      <ConnectDebtorModal\n        open={connectOpen}\n        onOpenChange={handleConnectModalClose}\n        debtor={debtorToConnect}\n        availablePortals={availablePortals}\n        loadingPortals={loadingPortals}\n        loading={connecting}\n        isChangingPortal={isChangingPortal}\n        onConnect={handlePerformConnect}\n        onRequestNewPortal={handleRequestNewPortal}\n      />\n\n      <UpdateCredentialsModal\n        open={editCredentialsOpen}\n        onOpenChange={setEditCredentialsOpen}\n        debtor={debtorToEdit}\n        loading={updatingCredentials}\n        onUpdate={handleUpdateCredentials}\n      />\n    </div>\n  );\n};\n","import { useMemo, ReactNode } from \"react\";\nimport { QueryClient, QueryClientProvider } from \"@tanstack/react-query\";\n\nimport { SyncWorkflow, SyncWorkflowProps } from \"./SyncWorkflow\";\nimport { useCustomerStatus } from \"@/hooks/use-customer-status\";\n\ntype SyncWorkflowPropKeys = \"config\" | \"onTokenExpired\" | \"onSyncComplete\" | \"onSyncError\" | \"autoStart\";\n\nexport interface SyncBannerProps extends Pick<SyncWorkflowProps, SyncWorkflowPropKeys> {\n  /**\n   * Provide a preconfigured React Query client. When omitted, the banner will\n   * create a singleton instance automatically.\n   */\n  queryClient?: QueryClient;\n  /**\n   * Headline displayed in the banner body.\n   */\n  title?: ReactNode;\n  /**\n   * Supporting copy displayed under the headline.\n   */\n  description?: ReactNode;\n  /**\n   * Optional badge rendered next to the headline. Hidden when empty.\n   */\n  badge?: ReactNode;\n  /**\n   * CTA label for the trigger button.\n   */\n  ctaLabel?: ReactNode;\n  /**\n   * Optional icon or decorative element displayed to the left of the content.\n   */\n  icon?: ReactNode;\n}\n\n/**\n * Pre-styled banner that wraps {@link SyncWorkflow} with a responsive CTA\n * layout. Consumers can drop this component in without needing to wire up\n * their own trigger button or React Query provider.\n */\nexport const SyncBanner = ({\n                               config,\n                               queryClient,\n                               title = \"Sync Invoices Automatically\",\n                               description = \"Connect your portals and let invoices sync themselves.\",\n                               badge = (\n                                   <span\n                                       style={{\n                                           background: \"rgba(147,197,253,0.15)\",\n                                           color: \"#93c5fd\",\n                                           fontWeight: 700,\n                                           fontSize: \"10px\",\n                                           padding: \"2px 6px\",\n                                           borderRadius: \"6px\",\n                                           textTransform: \"uppercase\",\n                                           letterSpacing: \"0.5px\",\n                                       }}\n                                   >\n      New Feature\n    </span>\n                               ),\n                               ctaLabel = \"Sync Now\",\n                               icon = (\n                                   <div\n                                       style={{\n                                           background: \"rgba(99,102,241,0.15)\",\n                                           borderRadius: \"50%\",\n                                           width: \"40px\",\n                                           height: \"40px\",\n                                           display: \"flex\",\n                                           alignItems: \"center\",\n                                           justifyContent: \"center\",\n                                           flexShrink: 0,\n                                       }}\n                                   >\n                                       <span style={{ color: \"#818cf8\", fontSize: \"18px\" }}>⚡</span>\n                                   </div>\n                               ),\n                               onTokenExpired,\n                               onSyncComplete,\n                               onSyncError,\n                               autoStart,\n                           }: SyncBannerProps) => {\n    const resolvedQueryClient = useMemo(\n        () => queryClient ?? new QueryClient(),\n        [queryClient]\n    );\n\n    const customerStatus = useCustomerStatus(config);\n\n    if (customerStatus.loading || customerStatus.isActive !== true) {\n        return null;\n    }\n\n    const trigger = (\n        <button\n            style={{\n                background:\n                    \"linear-gradient(90deg, rgba(99,102,241,1) 0%, rgba(79,70,229,1) 100%)\",\n                color: \"white\",\n                borderRadius: \"8px\",\n                padding: \"10px 18px\",\n                fontSize: \"13px\",\n                fontWeight: 500,\n                cursor: \"pointer\",\n                boxShadow: \"0 4px 10px rgba(0,0,0,0.25)\",\n                transition: \"opacity 0.2s ease\",\n                border: \"none\",\n                whiteSpace: \"nowrap\",\n                flexShrink: 0,\n            }}\n            onMouseEnter={(event) => (event.currentTarget.style.opacity = \"0.9\")}\n            onMouseLeave={(event) => (event.currentTarget.style.opacity = \"1\")}\n        >\n            {ctaLabel}\n        </button>\n    );\n\n    return (\n        <QueryClientProvider client={resolvedQueryClient}>\n            <div\n                style={{\n                    display: \"flex\",\n                    justifyContent: \"center\",\n                    alignItems: \"center\",\n                    width: \"100%\",\n                    padding: \"20px\",\n                    boxSizing: \"border-box\",\n                    background: \"transparent\",\n                }}\n            >\n                <div\n                    style={{\n                        display: \"flex\",\n                        alignItems: \"center\",\n                        justifyContent: \"space-between\",\n                        flexWrap: \"wrap\",\n                        gap: \"16px\",\n                        padding: \"20px 24px\",\n                        borderRadius: \"16px\",\n                        background:\n                            \"linear-gradient(135deg, rgba(15,15,16,1) 0%, rgba(26,26,28,1) 100%)\",\n                        color: \"white\",\n                        border: \"1px solid rgba(255,255,255,0.1)\",\n                        boxShadow: \"0 0 18px rgba(0,0,0,0.45)\",\n                        maxWidth: \"640px\",\n                        width: \"100%\",\n                        textAlign: \"left\",\n                        overflow: \"visible\",\n                        fontFamily: \"Arial, sans-serif\",\n                    }}\n                >\n                    <div\n                        style={{\n                            display: \"flex\",\n                            alignItems: \"flex-start\",\n                            gap: \"12px\",\n                            flex: \"1 1 350px\",\n                            minWidth: \"260px\",\n                        }}\n                    >\n                        {icon}\n                        <div style={{ lineHeight: 1.4 }}>\n                            <div\n                                style={{\n                                    display: \"flex\",\n                                    alignItems: \"center\",\n                                    gap: \"8px\",\n                                    flexWrap: \"wrap\",\n                                }}\n                            >\n                                <p\n                                    style={{\n                                        fontWeight: 600,\n                                        color: \"#f9fafb\",\n                                        fontSize: \"15px\",\n                                        margin: 0,\n                                    }}\n                                >\n                                    {title}\n                                </p>\n                                {badge}\n                            </div>\n                            <p\n                                style={{\n                                    fontSize: \"13px\",\n                                    color: \"rgba(255,255,255,0.75)\",\n                                    marginTop: \"4px\",\n                                    marginBottom: 0,\n                                    maxWidth: \"400px\",\n                                }}\n                            >\n                                {description}\n                            </p>\n                        </div>\n                    </div>\n\n                    <SyncWorkflow\n                        config={config}\n                        trigger={trigger}\n                        onTokenExpired={onTokenExpired}\n                        onSyncComplete={onSyncComplete}\n                        onSyncError={onSyncError}\n                        autoStart={autoStart}\n                        customerStatus={customerStatus}\n                    />\n                </div>\n            </div>\n        </QueryClientProvider>\n    );\n};\n","import * as React from \"react\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\n\nimport { cn } from \"@/lib/utils\"\n\nconst alertVariants = cva(\n  \"relative w-full rounded-lg border p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground\",\n  {\n    variants: {\n      variant: {\n        default: \"bg-background text-foreground\",\n        destructive:\n          \"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive\",\n      },\n    },\n    defaultVariants: {\n      variant: \"default\",\n    },\n  }\n)\n\nconst Alert = React.forwardRef<\n  HTMLDivElement,\n  React.HTMLAttributes<HTMLDivElement> & VariantProps<typeof alertVariants>\n>(({ className, variant, ...props }, ref) => (\n  <div\n    ref={ref}\n    role=\"alert\"\n    className={cn(alertVariants({ variant }), className)}\n    {...props}\n  />\n))\nAlert.displayName = \"Alert\"\n\nconst AlertTitle = React.forwardRef<\n  HTMLParagraphElement,\n  React.HTMLAttributes<HTMLHeadingElement>\n>(({ className, ...props }, ref) => (\n  <h5\n    ref={ref}\n    className={cn(\"mb-1 font-medium leading-none tracking-tight\", className)}\n    {...props}\n  />\n))\nAlertTitle.displayName = \"AlertTitle\"\n\nconst AlertDescription = React.forwardRef<\n  HTMLParagraphElement,\n  React.HTMLAttributes<HTMLParagraphElement>\n>(({ className, ...props }, ref) => (\n  <div\n    ref={ref}\n    className={cn(\"text-sm [&_p]:leading-relaxed\", className)}\n    {...props}\n  />\n))\nAlertDescription.displayName = \"AlertDescription\"\n\nexport { Alert, AlertTitle, AlertDescription }\n","import { useState, useEffect } from \"react\";\nimport { Button } from \"@/components/ui/button\";\nimport { Input } from \"@/components/ui/input\";\nimport { Label } from \"@/components/ui/label\";\nimport {\n  Dialog,\n  DialogContent,\n  DialogDescription,\n  DialogFooter,\n  DialogHeader,\n  DialogTitle,\n} from \"@/components/ui/dialog\";\nimport { Alert, AlertDescription } from \"@/components/ui/alert\";\nimport { SDKConfig } from \"@/types/config\";\nimport { AlertCircle } from \"lucide-react\";\n\ninterface ConfigModalProps {\n  open: boolean;\n  onOpenChange: (open: boolean) => void;\n  onSave: (config: SDKConfig) => void;\n  currentConfig?: Partial<SDKConfig>;\n}\n\nexport const ConfigModal = ({\n  open,\n  onOpenChange,\n  onSave,\n  currentConfig,\n}: ConfigModalProps) => {\n  const [config, setConfig] = useState<Partial<SDKConfig>>({\n    portalduct: {\n      bearer_token: \"\",\n      env_url: \"\",\n      customer_id: \"\",\n      webhook_bearer_token: \"\",\n    },\n    factorcloud: {\n      factorId: \"\",\n      bearer_token: \"\",\n      env_url: \"\",\n      client_id: undefined,\n    },\n  });\n\n  useEffect(() => {\n    if (currentConfig) {\n      setConfig((prev) => ({\n        portalduct: {\n          ...prev.portalduct,\n          ...currentConfig.portalduct,\n        },\n        factorcloud: {\n          ...prev.factorcloud,\n          ...currentConfig.factorcloud,\n        },\n      }));\n    }\n  }, [currentConfig]);\n\n  const canSave = Boolean(\n    config.factorcloud?.factorId && config.portalduct?.webhook_bearer_token\n  );\n\n  const handleSave = () => {\n    if (!canSave) {\n      return;\n    }\n\n    onSave(config as SDKConfig);\n    onOpenChange(false);\n  };\n\n  const missingFields: string[] = [];\n  if (!config.portalduct?.webhook_bearer_token)\n    missingFields.push(\"PortalDuct Webhook Token\");\n  if (!config.factorcloud?.factorId) missingFields.push(\"FactorCloud Factor ID\");\n\n  return (\n    <Dialog open={open} onOpenChange={onOpenChange}>\n      <DialogContent className=\"max-w-2xl max-h-[90vh] overflow-y-auto\">\n        <DialogHeader>\n          <DialogTitle>SDK Configuration (Testing)</DialogTitle>\n          <DialogDescription>\n            Configure your PortalDuct and FactorCloud credentials for testing.\n          </DialogDescription>\n        </DialogHeader>\n\n        <div className=\"space-y-6 py-4\">\n          {missingFields.length > 0 && (\n            <Alert variant=\"destructive\">\n              <AlertCircle className=\"h-4 w-4\" />\n              <AlertDescription>\n                Missing required fields: {missingFields.join(\", \")}\n              </AlertDescription>\n            </Alert>\n          )}\n\n          {/* PortalDuct Configuration */}\n          <div className=\"space-y-4\">\n            <h3 className=\"text-lg font-semibold\">PortalDuct Configuration</h3>\n\n            <div className=\"space-y-2\">\n              <Label htmlFor=\"pd-webhook-token\">Webhook Token *</Label>\n              <Input\n                id=\"pd-webhook-token\"\n                type=\"password\"\n                value={config.portalduct?.webhook_bearer_token || \"\"}\n                onChange={(e) =>\n                  setConfig({\n                    ...config,\n                    portalduct: {\n                      ...config.portalduct!,\n                      webhook_bearer_token: e.target.value,\n                    },\n                  })\n                }\n                placeholder=\"Enter PortalDuct Webhook Token\"\n              />\n              <p className=\"text-sm text-muted-foreground\">\n                Used for triggering Supabase webhooks and fetching the latest SDK\n                credentials.\n              </p>\n            </div>\n\n            <div className=\"space-y-2\">\n              <Label htmlFor=\"pd-bearer-token\">API Bearer Token</Label>\n              <Input\n                id=\"pd-bearer-token\"\n                type=\"password\"\n                value={config.portalduct?.bearer_token || \"\"}\n                readOnly\n                placeholder=\"Auto-configured after status check\"\n              />\n            </div>\n\n            <div className=\"space-y-2\">\n              <Label htmlFor=\"pd-env-url\">Environment URL</Label>\n              <Input\n                id=\"pd-env-url\"\n                value={config.portalduct?.env_url || \"\"}\n                readOnly\n                placeholder=\"Auto-configured after status check\"\n              />\n            </div>\n\n            <div className=\"space-y-2\">\n              <Label htmlFor=\"pd-customer-id\">Customer ID</Label>\n              <Input\n                id=\"pd-customer-id\"\n                value={config.portalduct?.customer_id || \"\"}\n                readOnly\n                placeholder=\"Auto-configured after status check\"\n              />\n            </div>\n          </div>\n\n          {/* FactorCloud Configuration */}\n          <div className=\"space-y-4\">\n            <h3 className=\"text-lg font-semibold\">FactorCloud Configuration</h3>\n            \n            <div className=\"space-y-2\">\n              <Label htmlFor=\"fc-bearer-token\">Bearer Token</Label>\n              <Input\n                id=\"fc-bearer-token\"\n                type=\"password\"\n                value={config.factorcloud?.bearer_token || \"\"}\n                readOnly\n                placeholder=\"Auto-configured after status check\"\n              />\n            </div>\n\n            <div className=\"space-y-2\">\n              <Label htmlFor=\"fc-factor-id\">Factor ID *</Label>\n              <Input\n                id=\"fc-factor-id\"\n                value={config.factorcloud?.factorId || \"\"}\n                onChange={(e) =>\n                  setConfig({\n                    ...config,\n                    factorcloud: {\n                      ...config.factorcloud!,\n                      factorId: e.target.value,\n                    },\n                  })\n                }\n                placeholder=\"Enter FactorCloud Factor ID\"\n              />\n            </div>\n\n            <div className=\"space-y-2\">\n              <Label htmlFor=\"fc-env-url\">Environment URL</Label>\n              <Input\n                id=\"fc-env-url\"\n                value={config.factorcloud?.env_url || \"\"}\n                readOnly\n                placeholder=\"Auto-configured after status check\"\n              />\n            </div>\n\n            <div className=\"space-y-2\">\n              <Label htmlFor=\"fc-client-id\">Client ID (Optional)</Label>\n              <Input\n                id=\"fc-client-id\"\n                value={config.factorcloud?.client_id || \"\"}\n                onChange={(e) =>\n                  setConfig({\n                    ...config,\n                    factorcloud: {\n                      ...config.factorcloud!,\n                      client_id: e.target.value || undefined,\n                    },\n                  })\n                }\n                placeholder=\"Leave empty to select from list\"\n              />\n              <p className=\"text-sm text-muted-foreground\">\n                If not provided, you'll select from available clients during sync\n              </p>\n            </div>\n          </div>\n        </div>\n\n        <DialogFooter>\n          <Button variant=\"outline\" onClick={() => onOpenChange(false)}>\n            Cancel\n          </Button>\n          <Button onClick={handleSave} disabled={!canSave}>\n            Save Configuration\n          </Button>\n        </DialogFooter>\n      </DialogContent>\n    </Dialog>\n  );\n};\n","import * as React from \"react\"\n\nimport { cn } from \"@/lib/utils\"\n\nconst Card = React.forwardRef<\n  HTMLDivElement,\n  React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => (\n  <div\n    ref={ref}\n    className={cn(\n      \"rounded-lg border bg-card text-card-foreground shadow-sm\",\n      className\n    )}\n    {...props}\n  />\n))\nCard.displayName = \"Card\"\n\nconst CardHeader = React.forwardRef<\n  HTMLDivElement,\n  React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => (\n  <div\n    ref={ref}\n    className={cn(\"flex flex-col space-y-1.5 p-6\", className)}\n    {...props}\n  />\n))\nCardHeader.displayName = \"CardHeader\"\n\nconst CardTitle = React.forwardRef<\n  HTMLParagraphElement,\n  React.HTMLAttributes<HTMLHeadingElement>\n>(({ className, ...props }, ref) => (\n  <h3\n    ref={ref}\n    className={cn(\n      \"text-2xl font-semibold leading-none tracking-tight\",\n      className\n    )}\n    {...props}\n  />\n))\nCardTitle.displayName = \"CardTitle\"\n\nconst CardDescription = React.forwardRef<\n  HTMLParagraphElement,\n  React.HTMLAttributes<HTMLParagraphElement>\n>(({ className, ...props }, ref) => (\n  <p\n    ref={ref}\n    className={cn(\"text-sm text-muted-foreground\", className)}\n    {...props}\n  />\n))\nCardDescription.displayName = \"CardDescription\"\n\nconst CardContent = React.forwardRef<\n  HTMLDivElement,\n  React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => (\n  <div ref={ref} className={cn(\"p-6 pt-0\", className)} {...props} />\n))\nCardContent.displayName = \"CardContent\"\n\nconst CardFooter = React.forwardRef<\n  HTMLDivElement,\n  React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => (\n  <div\n    ref={ref}\n    className={cn(\"flex items-center p-6 pt-0\", className)}\n    {...props}\n  />\n))\nCardFooter.displayName = \"CardFooter\"\n\nexport { Card, CardHeader, CardFooter, CardTitle, CardDescription, CardContent }\n","import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from \"@/components/ui/dialog\";\nimport { Button } from \"@/components/ui/button\";\nimport { Input } from \"@/components/ui/input\";\nimport { useState } from \"react\";\nimport { FactorCloudClient } from \"@/types/factorcloud\";\nimport { Card } from \"@/components/ui/card\";\nimport { Building2, Mail, Hash } from \"lucide-react\";\n\ninterface ClientSelectionModalProps {\n  open: boolean;\n  onOpenChange: (open: boolean) => void;\n  clients: FactorCloudClient[];\n  onSelect: (client: FactorCloudClient) => void;\n}\n\nexport function ClientSelectionModal({\n  open,\n  onOpenChange,\n  clients,\n  onSelect,\n}: ClientSelectionModalProps) {\n  const [searchQuery, setSearchQuery] = useState(\"\");\n\n  const filteredClients = clients.filter(\n    (client) =>\n      client.companyName.toLowerCase().includes(searchQuery.toLowerCase()) ||\n      client.email.toLowerCase().includes(searchQuery.toLowerCase()) ||\n      client.compCode.toLowerCase().includes(searchQuery.toLowerCase())\n  );\n\n  return (\n    <Dialog open={open} onOpenChange={onOpenChange}>\n      <DialogContent className=\"max-w-2xl max-h-[90vh] overflow-hidden flex flex-col\">\n        <DialogHeader>\n          <DialogTitle>Select FactorCloud Client</DialogTitle>\n          <DialogDescription>\n            Choose the client you want to manage portal connections for.\n          </DialogDescription>\n        </DialogHeader>\n\n        <div className=\"space-y-4\">\n          <Input\n            placeholder=\"Search by name, email, or code...\"\n            value={searchQuery}\n            onChange={(e) => setSearchQuery(e.target.value)}\n          />\n\n          <div className=\"overflow-y-auto max-h-[500px] space-y-2\">\n            {filteredClients.length === 0 ? (\n              <div className=\"text-center py-8 text-muted-foreground\">\n                No clients found matching your search.\n              </div>\n            ) : (\n              filteredClients.map((client) => (\n                <Card\n                  key={client.id}\n                  className=\"p-4 hover:bg-accent cursor-pointer transition-colors\"\n                  onClick={() => onSelect(client)}\n                >\n                  <div className=\"space-y-2\">\n                    <div className=\"flex items-center justify-between\">\n                      <div className=\"flex items-center gap-2\">\n                        <Building2 className=\"h-5 w-5 text-primary\" />\n                        <h3 className=\"font-semibold\">{client.companyName}</h3>\n                      </div>\n                      {client.active && (\n                        <span className=\"text-xs bg-green-500/10 text-green-500 px-2 py-1 rounded\">\n                          Active\n                        </span>\n                      )}\n                    </div>\n                    \n                    <div className=\"flex items-center gap-4 text-sm text-muted-foreground\">\n                      <div className=\"flex items-center gap-1\">\n                        <Mail className=\"h-4 w-4\" />\n                        <span>{client.email}</span>\n                      </div>\n                      <div className=\"flex items-center gap-1\">\n                        <Hash className=\"h-4 w-4\" />\n                        <span>{client.compCode}</span>\n                      </div>\n                    </div>\n                  </div>\n                </Card>\n              ))\n            )}\n          </div>\n        </div>\n\n        <div className=\"flex justify-end pt-4\">\n          <Button variant=\"outline\" onClick={() => onOpenChange(false)}>\n            Cancel\n          </Button>\n        </div>\n      </DialogContent>\n    </Dialog>\n  );\n}\n","import \"./styles.css\";\nimport { SyncWorkflow } from \"@/components/SyncWorkflow\";\nimport { PortalIntegration } from \"@/components/PortalIntegration\";\nimport { SDKConfig } from \"@/types/config\";\n\n/**\n * SDK Version\n */\nexport const SDK_VERSION = \"0.1.0\";\n\n/**\n * Initialize PortalSDK with configuration\n * @param config - SDK configuration object\n * @returns Object containing config and component\n */\nexport function initPortalSDK(config: SDKConfig) {\n  return {\n    config,\n    component: SyncWorkflow,\n  };\n}\n\n/**\n * Sync Workflow Component (Recommended)\n * Provides modal-based workflow for syncing invoices from portals\n * This is the primary component you should use for integrating sync functionality\n */\nexport { SyncWorkflow } from \"@/components/SyncWorkflow\";\nexport type { SyncWorkflowProps } from \"@/components/SyncWorkflow\";\n\n/**\n * Pre-built marketing banner with CTA button that launches the sync workflow.\n */\nexport { SyncBanner } from \"@/components/SyncBanner\";\nexport type { SyncBannerProps } from \"@/components/SyncBanner\";\n\n/**\n * Full Portal Integration Component (Demo/Reference)\n * Complete dashboard UI - primarily for internal demo purposes\n * External applications should use SyncWorkflow instead\n */\nexport { PortalIntegration };\n\n/**\n * Standalone Modal Components\n * Use these for custom integration workflows\n */\nexport { ConfigModal } from \"@/components/ConfigModal\";\nexport { ConnectDebtorModal } from \"@/components/ConnectDebtorModal\";\nexport { RequestPortalModal } from \"@/components/RequestPortalModal\";\nexport { UpdateCredentialsModal } from \"@/components/UpdateCredentialsModal\";\nexport { SyncProgressModal } from \"@/components/SyncProgressModal\";\nexport { ClientSelectionModal } from \"@/components/ClientSelectionModal\";\n\n/**\n * Type Exports\n */\nexport type { SDKConfig };\n\n/**\n * Export all types for external use\n */\nexport * from \"@/types/config\";\nexport * from \"@/types/factorcloud\";\nexport * from \"@/types/portalduct\";\nexport * from \"@/types/merged\";\n\n/**\n * API Clients for direct API access\n */\nexport { FactorCloudAPI } from \"@/api/factorcloud\";\nexport { PortalDuctAPI } from \"@/api/portalduct\";\nexport { ConnectionSyncAPI } from \"@/api/connectionSync\";\n\n/**\n * Data Orchestration Service\n * Handles complex data synchronization between PortalDuct and FactorCloud\n */\nexport { DataOrchestrationService } from \"@/services/orchestration\";"],"names":["r","e","f","o","clsx","falsyToString","value","cx","cva","base","config","props","_config_compoundVariants","variants","defaultVariants","getVariantClassNames","variant","variantProp","defaultVariantProp","variantKey","propsWithoutUndefined","acc","param","key","getCompoundVariantClassNames","cvClass","cvClassName","compoundVariantOptions","CLASS_PART_SEPARATOR","createClassGroupUtils","classMap","createClassMap","conflictingClassGroups","conflictingClassGroupModifiers","className","classParts","getGroupRecursive","getGroupIdForArbitraryProperty","classGroupId","hasPostfixModifier","conflicts","classPartObject","currentClassPart","nextClassPartObject","classGroupFromNextClassPart","classRest","validator","arbitraryPropertyRegex","arbitraryPropertyClassName","property","theme","prefix","getPrefixedClassGroupEntries","classGroup","processClassesRecursively","classDefinition","classPartObjectToEdit","getPart","isThemeGetter","path","currentClassPartObject","pathPart","func","classGroupEntries","prefixedClassGroup","createLruCache","maxCacheSize","cacheSize","cache","previousCache","update","IMPORTANT_MODIFIER","createParseClassName","separator","experimentalParseClassName","isSeparatorSingleCharacter","firstSeparatorCharacter","separatorLength","parseClassName","modifiers","bracketDepth","modifierStart","postfixModifierPosition","index","currentCharacter","baseClassNameWithImportantModifier","hasImportantModifier","baseClassName","maybePostfixModifierPosition","sortModifiers","sortedModifiers","unsortedModifiers","modifier","createConfigUtils","SPLIT_CLASSES_REGEX","mergeClassList","classList","configUtils","getClassGroupId","getConflictingClassGroupIds","classGroupsInConflict","classNames","result","originalClassName","variantModifier","modifierId","classId","conflictGroups","i","group","twJoin","argument","resolvedValue","string","toValue","mix","k","createTailwindMerge","createConfigFirst","createConfigRest","cacheGet","cacheSet","functionToCall","initTailwindMerge","previousConfig","createConfigCurrent","tailwindMerge","cachedResult","fromTheme","themeGetter","arbitraryValueRegex","fractionRegex","stringLengths","tshirtUnitRegex","lengthUnitRegex","colorFunctionRegex","shadowRegex","imageRegex","isLength","isNumber","isArbitraryLength","getIsArbitraryValue","isLengthOnly","isArbitraryNumber","isInteger","isPercent","isArbitraryValue","isTshirtSize","sizeLabels","isArbitrarySize","isNever","isArbitraryPosition","imageLabels","isArbitraryImage","isImage","isArbitraryShadow","isShadow","isAny","label","testValue","getDefaultConfig","colors","spacing","blur","brightness","borderColor","borderRadius","borderSpacing","borderWidth","contrast","grayscale","hueRotate","invert","gap","gradientColorStops","gradientColorStopPositions","inset","margin","opacity","padding","saturate","scale","sepia","skew","space","translate","getOverscroll","getOverflow","getSpacingWithAutoAndArbitrary","getSpacingWithArbitrary","getLengthWithEmptyAndArbitrary","getNumberWithAutoAndArbitrary","getPositions","getLineStyles","getBlendModes","getAlign","getZeroAndEmpty","getBreaks","getNumberAndArbitrary","twMerge","cn","inputs","formatLastSync","lastSync","date","diffMs","diffMins","diffHours","diffDays","buttonVariants","Button","React","size","asChild","ref","Comp","Slot","jsx","TOAST_LIMIT","TOAST_REMOVE_DELAY","count","genId","toastTimeouts","addToRemoveQueue","toastId","timeout","dispatch","reducer","state","action","t","toast","listeners","memoryState","listener","id","dismiss","open","useToast","setState","deriveEnvironmentFromUrl","url","isConfigComplete","mergeCustomerStatusWithConfig","status","portalductApiUrl","portalductEnvironment","FactorCloudAPI","baseUrl","factorId","bearerToken","limit","page","response","clientId","token","PortalDuctAPIError","message","code","type","requestId","PortalDuctAPI","fallbackMessage","body","error","customerId","filter","request","companyId","connectionId","DEFAULT_SYNC_WEBHOOK_URL","DEFAULT_VERIFY_WEBHOOK_URL","DEFAULT_CUSTOMER_STATUS_WEBHOOK_URL","ConnectionSyncAPI","webhookToken","webhookUrl","verifyWebhookUrl","environment","portalductBaseUrl","customerStatusUrl","operationLabel","errorText","data","DataOrchestrationService","clients","fcClient","existingCompany","company","clientDetail","fcClientId","pdCompanyId","debtors","connections","debtor","connection","conn","Dialog","DialogPrimitive","DialogPortal","DialogOverlay","DialogContent","children","jsxs","X","DialogHeader","DialogFooter","DialogTitle","DialogDescription","Input","labelVariants","Label","LabelPrimitive","UpdateCredentialsModal","onOpenChange","onUpdate","loading","username","setUsername","useState","password","setPassword","handleSubmit","AlertDialog","AlertDialogPrimitive","AlertDialogPortal","AlertDialogOverlay","AlertDialogContent","AlertDialogHeader","AlertDialogFooter","AlertDialogTitle","AlertDialogDescription","AlertDialogAction","AlertDialogCancel","Tabs","TabsPrimitive","TabsList","TabsTrigger","TabsContent","Separator","orientation","decorative","SeparatorPrimitive","stepLabels","SyncProgressModal","currentStep","selectedDebtor","selectedClient","onSelectClient","onSelectDebtor","onConnectDebtor","onEditCredentials","onChangePortal","onToggleActivation","onSyncDebtor","onVerifyDebtor","togglingDebtorId","syncingDebtorId","verifyingDebtorId","allowBackToClientSelection","onBackToClientSelection","activeTab","onActiveTabChange","isLoading","isError","isComplete","isSelectingClient","isSelectingDebtor","isReviewing","localActiveTab","setLocalActiveTab","activeDebtorTab","setActiveDebtorTab","syncConfirmOpen","setSyncConfirmOpen","debtorToSync","setDebtorToSync","verifyConfirmOpen","setVerifyConfirmOpen","debtorToVerify","setDebtorToVerify","searchTerm","setSearchTerm","deferredSearch","useDeferredValue","filteredDebtors","useMemo","q","d","groups","counts","handleConnect","useCallback","handleSyncClick","handleSyncConfirm","handleVerifyClick","handleVerifyConfirm","text","idx","CheckCircle2","Loader2","XCircle","client","Building2","Mail","v","Fragment","RefreshCw","ShieldCheck","FileText","ArrowLeft","ScrollArea","ScrollAreaPrimitive","ScrollBar","badgeVariants","Badge","ConnectDebtorModal","availablePortals","loadingPortals","isChangingPortal","onConnect","onRequestNewPortal","step","setStep","selectedPortal","setSelectedPortal","searchQuery","setSearchQuery","useEffect","filteredPortals","portal","a","b","handlePortalSelect","handleBack","canSubmit","Search","RequestPortalModal","onSubmit","name","setName","host","setHost","useCustomerStatus","options","skip","isMountedRef","useRef","isActive","setIsActive","setLoading","setError","resolvedConfig","setResolvedConfig","combinedConfig","portalductEnvUrl","syncWebhookUrl","latestConfigRef","refetch","latestConfig","latestFactorId","latestWebhookToken","latestCustomerId","latestEnvironment","latestPortalductEnvUrl","latestSyncWebhookUrl","latestVerifyWebhookUrl","mergedConfig","err","errorInstance","SyncWorkflow","onTokenExpired","trigger","onSyncComplete","onSyncError","autoStart","customerStatus","orchestrationService","setOrchestrationService","factorcloudClient","setFactorcloudClient","portalductCompany","setPortalductCompany","availableClients","setAvailableClients","mergedDebtors","setMergedDebtors","setSelectedDebtor","setAvailablePortals","setLoadingPortals","connectOpen","setConnectOpen","debtorToConnect","setDebtorToConnect","connecting","setConnecting","setIsChangingPortal","requestPortalOpen","setRequestPortalOpen","creatingPortal","setCreatingPortal","editCredentialsOpen","setEditCredentialsOpen","debtorToEdit","setDebtorToEdit","updatingCredentials","setUpdatingCredentials","setTogglingDebtorId","setSyncingDebtorId","syncTimeouts","setSyncTimeouts","setVerifyingDebtorId","verifyTimeouts","setVerifyTimeouts","showSyncModal","setShowSyncModal","syncStep","setSyncStep","syncError","setSyncError","localCustomerStatus","resolvedCustomerStatus","isCustomerActive","customerStatusLoading","customerStatusError","resolvedConfigFromStatus","fallbackConfig","runtimeConfig","configuredClientId","service","handleAutoSync","timeoutId","loadDebtorData","svc","pdCompany","handleClientSelection","handleDebtorSelection","requestConnectDebtor","portals","requestChangePortal","handleConnectModalClose","handleRequestNewPortal","handleCreatePortal","pd","newPortal","handlePerformConnect","portalId","p","updated","handleEditCredentials","handleUpdateCredentials","updatePayload","handleToggleActivation","isDeactivated","handleSyncDebtor","prev","next","timestamp","item","handleVerifyDebtor","PortalIntegration","showClientSelectionModal","setShowClientSelectionModal","Clock","Building","Edit2","DollarSign","CreditCard","BookOpen","Calculator","SyncBanner","queryClient","title","description","badge","ctaLabel","icon","resolvedQueryClient","QueryClient","event","QueryClientProvider","alertVariants","Alert","AlertTitle","AlertDescription","ConfigModal","onSave","currentConfig","setConfig","canSave","handleSave","missingFields","AlertCircle","Card","CardHeader","CardTitle","CardDescription","CardContent","CardFooter","ClientSelectionModal","onSelect","filteredClients","Hash","SDK_VERSION","initPortalSDK"],"m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