@portalduct/react-sdk-factorcloud-legacy 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1,10 +1,60 @@
1
1
  (function(){"use strict";try{if(typeof document<"u"){var t=document.createElement("style");t.appendChild(document.createTextNode(`*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}:root{--background: 0 0% 100%;--foreground: 222.2 84% 4.9%;--card: 0 0% 100%;--card-foreground: 222.2 84% 4.9%;--popover: 0 0% 100%;--popover-foreground: 222.2 84% 4.9%;--primary: 222.2 47.4% 11.2%;--primary-foreground: 210 40% 98%;--secondary: 210 40% 96.1%;--secondary-foreground: 222.2 47.4% 11.2%;--muted: 210 40% 96.1%;--muted-foreground: 215.4 16.3% 46.9%;--accent: 210 40% 96.1%;--accent-foreground: 222.2 47.4% 11.2%;--destructive: 0 84.2% 60.2%;--destructive-foreground: 210 40% 98%;--border: 214.3 31.8% 91.4%;--input: 214.3 31.8% 91.4%;--ring: 222.2 84% 4.9%}.__factorcloud-sdk.dark{--background: 222.2 84% 4.9%;--foreground: 210 40% 98%;--card: 222.2 84% 4.9%;--card-foreground: 210 40% 98%;--popover: 222.2 84% 4.9%;--popover-foreground: 210 40% 98%;--primary: 210 40% 98%;--primary-foreground: 222.2 47.4% 11.2%;--secondary: 217.2 32.6% 17.5%;--secondary-foreground: 210 40% 98%;--muted: 217.2 32.6% 17.5%;--muted-foreground: 215 20.2% 65.1%;--accent: 217.2 32.6% 17.5%;--accent-foreground: 210 40% 98%;--destructive: 0 62.8% 30.6%;--destructive-foreground: 210 40% 98%;--border: 217.2 32.6% 17.5%;--input: 217.2 32.6% 17.5%;--ring: 212.7 26.8% 83.9%;--sidebar-background: 240 5.9% 10%;--sidebar-foreground: 240 4.8% 95.9%;--sidebar-primary: 224.3 76.3% 48%;--sidebar-primary-foreground: 0 0% 100%;--sidebar-accent: 240 3.7% 15.9%;--sidebar-accent-foreground: 240 4.8% 95.9%;--sidebar-border: 240 3.7% 15.9%;--sidebar-ring: 217.2 91.2% 59.8%}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.pointer-events-none{pointer-events:none}.pointer-events-auto{pointer-events:auto}.visible{visibility:visible}.invisible{visibility:hidden}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.inset-0{inset:0}.inset-x-0{left:0;right:0}.inset-y-0{top:0;bottom:0}.-bottom-12{bottom:-3rem}.-left-12{left:-3rem}.-right-12{right:-3rem}.-top-12{top:-3rem}.bottom-0{bottom:0}.left-0{left:0}.left-1{left:.25rem}.left-1\\/2{left:50%}.left-2{left:.5rem}.left-3{left:.75rem}.left-\\[50\\%\\]{left:50%}.right-0{right:0}.right-1{right:.25rem}.right-2{right:.5rem}.right-3{right:.75rem}.right-4{right:1rem}.top-0{top:0}.top-1\\.5{top:.375rem}.top-1\\/2{top:50%}.top-2{top:.5rem}.top-3\\.5{top:.875rem}.top-4{top:1rem}.top-\\[1px\\]{top:1px}.top-\\[50\\%\\]{top:50%}.top-\\[60\\%\\]{top:60%}.top-full{top:100%}.z-10{z-index:10}.z-20{z-index:20}.z-50{z-index:50}.z-\\[100\\]{z-index:100}.z-\\[1\\]{z-index:1}.-mx-1{margin-left:-.25rem;margin-right:-.25rem}.-mx-6{margin-left:-1.5rem;margin-right:-1.5rem}.mx-2{margin-left:.5rem;margin-right:.5rem}.mx-3\\.5{margin-left:.875rem;margin-right:.875rem}.mx-auto{margin-left:auto;margin-right:auto}.my-0\\.5{margin-top:.125rem;margin-bottom:.125rem}.my-1{margin-top:.25rem;margin-bottom:.25rem}.-ml-4{margin-left:-1rem}.-mt-4{margin-top:-1rem}.mb-1{margin-bottom:.25rem}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.ml-1{margin-left:.25rem}.ml-auto{margin-left:auto}.mr-2{margin-right:.5rem}.mt-0\\.5{margin-top:.125rem}.mt-1{margin-top:.25rem}.mt-1\\.5{margin-top:.375rem}.mt-10{margin-top:2.5rem}.mt-2{margin-top:.5rem}.mt-24{margin-top:6rem}.mt-4{margin-top:1rem}.mt-6{margin-top:1.5rem}.mt-auto{margin-top:auto}.block{display:block}.inline-block{display:inline-block}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.grid{display:grid}.hidden{display:none}.aspect-square{aspect-ratio:1 / 1}.aspect-video{aspect-ratio:16 / 9}.size-4{width:1rem;height:1rem}.h-1\\.5{height:.375rem}.h-10{height:2.5rem}.h-11{height:2.75rem}.h-12{height:3rem}.h-16{height:4rem}.h-2{height:.5rem}.h-2\\.5{height:.625rem}.h-24{height:6rem}.h-3{height:.75rem}.h-3\\.5{height:.875rem}.h-4{height:1rem}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-7{height:1.75rem}.h-8{height:2rem}.h-9{height:2.25rem}.h-\\[1px\\]{height:1px}.h-\\[85vh\\]{height:85vh}.h-\\[var\\(--radix-navigation-menu-viewport-height\\)\\]{height:var(--radix-navigation-menu-viewport-height)}.h-\\[var\\(--radix-select-trigger-height\\)\\]{height:var(--radix-select-trigger-height)}.h-auto{height:auto}.h-full{height:100%}.h-px{height:1px}.h-svh{height:100svh}.max-h-64{max-height:16rem}.max-h-96{max-height:24rem}.max-h-\\[300px\\]{max-height:300px}.max-h-\\[500px\\]{max-height:500px}.max-h-\\[90vh\\]{max-height:90vh}.max-h-screen{max-height:100vh}.min-h-0{min-height:0px}.min-h-\\[80px\\]{min-height:80px}.min-h-screen{min-height:100vh}.min-h-svh{min-height:100svh}.w-0{width:0px}.w-1{width:.25rem}.w-10{width:2.5rem}.w-11{width:2.75rem}.w-12{width:3rem}.w-16{width:4rem}.w-2{width:.5rem}.w-2\\.5{width:.625rem}.w-24{width:6rem}.w-3{width:.75rem}.w-3\\.5{width:.875rem}.w-3\\/4{width:75%}.w-4{width:1rem}.w-5{width:1.25rem}.w-64{width:16rem}.w-7{width:1.75rem}.w-72{width:18rem}.w-8{width:2rem}.w-80{width:20rem}.w-9{width:2.25rem}.w-\\[--sidebar-width\\]{width:var(--sidebar-width)}.w-\\[100px\\]{width:100px}.w-\\[1px\\]{width:1px}.w-auto{width:auto}.w-full{width:100%}.w-max{width:-moz-max-content;width:max-content}.w-px{width:1px}.min-w-0{min-width:0px}.min-w-5{min-width:1.25rem}.min-w-\\[12rem\\]{min-width:12rem}.min-w-\\[8rem\\]{min-width:8rem}.min-w-\\[var\\(--radix-select-trigger-width\\)\\]{min-width:var(--radix-select-trigger-width)}.max-w-2xl{max-width:42rem}.max-w-4xl{max-width:56rem}.max-w-\\[--skeleton-width\\]{max-width:var(--skeleton-width)}.max-w-lg{max-width:32rem}.max-w-max{max-width:-moz-max-content;max-width:max-content}.max-w-sm{max-width:24rem}.flex-1{flex:1 1 0%}.flex-shrink-0,.shrink-0{flex-shrink:0}.grow{flex-grow:1}.grow-0{flex-grow:0}.basis-full{flex-basis:100%}.caption-bottom{caption-side:bottom}.border-collapse{border-collapse:collapse}.-translate-x-1\\/2{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-x-px{--tw-translate-x: -1px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-y-1\\/2{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-\\[-50\\%\\]{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-px{--tw-translate-x: 1px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-y-\\[-50\\%\\]{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-45{--tw-rotate: 45deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-90{--tw-rotate: 90deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes pulse{50%{opacity:.5}}.animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}.cursor-default{cursor:default}.cursor-pointer{cursor:pointer}.touch-none{touch-action:none}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.list-none{list-style-type:none}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.flex-row{flex-direction:row}.flex-col{flex-direction:column}.flex-col-reverse{flex-direction:column-reverse}.flex-wrap{flex-wrap:wrap}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.items-stretch{align-items:stretch}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-1{gap:.25rem}.gap-1\\.5{gap:.375rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.space-x-1>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.25rem * var(--tw-space-x-reverse));margin-left:calc(.25rem * calc(1 - var(--tw-space-x-reverse)))}.space-x-4>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(1rem * var(--tw-space-x-reverse));margin-left:calc(1rem * calc(1 - var(--tw-space-x-reverse)))}.space-y-0\\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.125rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.125rem * var(--tw-space-y-reverse))}.space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.space-y-1\\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.375rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.375rem * var(--tw-space-y-reverse))}.space-y-10>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(2.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(2.5rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.space-y-5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.25rem * var(--tw-space-y-reverse))}.space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.space-y-8>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(2rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(2rem * var(--tw-space-y-reverse))}.divide-y>:not([hidden])~:not([hidden]){--tw-divide-y-reverse: 0;border-top-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)));border-bottom-width:calc(1px * var(--tw-divide-y-reverse))}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-y-auto{overflow-y:auto}.overflow-x-hidden{overflow-x:hidden}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.whitespace-nowrap{white-space:nowrap}.break-words{overflow-wrap:break-word}.rounded{border-radius:.25rem}.rounded-\\[2px\\]{border-radius:2px}.rounded-\\[inherit\\]{border-radius:inherit}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:var(--radius)}.rounded-md{border-radius:calc(var(--radius) - 2px)}.rounded-sm{border-radius:calc(var(--radius) - 4px)}.rounded-b-none{border-bottom-right-radius:0;border-bottom-left-radius:0}.rounded-t-\\[10px\\]{border-top-left-radius:10px;border-top-right-radius:10px}.rounded-t-lg{border-top-left-radius:var(--radius);border-top-right-radius:var(--radius)}.rounded-tl-sm{border-top-left-radius:calc(var(--radius) - 4px)}.border{border-width:1px}.border-2{border-width:2px}.border-\\[1\\.5px\\]{border-width:1.5px}.border-y{border-top-width:1px;border-bottom-width:1px}.border-b{border-bottom-width:1px}.border-b-2{border-bottom-width:2px}.border-l{border-left-width:1px}.border-r{border-right-width:1px}.border-t{border-top-width:1px}.border-dashed{border-style:dashed}.border-\\[--color-border\\]{border-color:var(--color-border)}.border-border\\/50{border-color:hsl(var(--border) / .5)}.border-destructive{border-color:hsl(var(--destructive))}.border-destructive\\/50{border-color:hsl(var(--destructive) / .5)}.border-input{border-color:hsl(var(--input))}.border-primary{border-color:hsl(var(--primary))}.border-sidebar-border{border-color:hsl(var(--sidebar-border))}.border-transparent{border-color:transparent}.border-white\\/10{border-color:#ffffff1a}.border-white\\/15{border-color:#ffffff26}.border-l-transparent{border-left-color:transparent}.border-t-transparent{border-top-color:transparent}.bg-\\[--color-bg\\]{background-color:var(--color-bg)}.bg-\\[hsl\\(220\\,30\\%\\,15\\%\\)\\]{--tw-bg-opacity: 1;background-color:hsl(220 30% 15% / var(--tw-bg-opacity, 1))}.bg-accent{background-color:hsl(var(--accent))}.bg-background{background-color:hsl(var(--background))}.bg-black{--tw-bg-opacity: 1;background-color:rgb(0 0 0 / var(--tw-bg-opacity, 1))}.bg-black\\/80{background-color:#000c}.bg-border{background-color:hsl(var(--border))}.bg-card{background-color:hsl(var(--card))}.bg-destructive{background-color:hsl(var(--destructive))}.bg-destructive\\/10{background-color:hsl(var(--destructive) / .1)}.bg-factorcloud-primary{background-color:hsl(var(--factorcloud-primary))}.bg-factorcloud-success{background-color:hsl(var(--factorcloud-success))}.bg-foreground{background-color:hsl(var(--foreground))}.bg-gray-100{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.bg-green-100{--tw-bg-opacity: 1;background-color:rgb(220 252 231 / var(--tw-bg-opacity, 1))}.bg-green-500\\/10{background-color:#22c55e1a}.bg-muted{background-color:hsl(var(--muted))}.bg-muted\\/50{background-color:hsl(var(--muted) / .5)}.bg-popover{background-color:hsl(var(--popover))}.bg-primary{background-color:hsl(var(--primary))}.bg-secondary{background-color:hsl(var(--secondary))}.bg-sidebar{background-color:hsl(var(--sidebar-background))}.bg-sidebar-border{background-color:hsl(var(--sidebar-border))}.bg-transparent{background-color:transparent}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.bg-white\\/10{background-color:#ffffff1a}.bg-yellow-100{--tw-bg-opacity: 1;background-color:rgb(254 249 195 / var(--tw-bg-opacity, 1))}.bg-\\[radial-gradient\\(circle_at_top_right\\,rgba\\(255\\,255\\,255\\,0\\.1\\)\\,transparent_70\\%\\)\\]{background-image:radial-gradient(circle at top right,rgba(255,255,255,.1),transparent 70%)}.fill-current{fill:currentColor}.object-contain{-o-object-fit:contain;object-fit:contain}.p-0{padding:0}.p-1{padding:.25rem}.p-12{padding:3rem}.p-2{padding:.5rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-6{padding:1.5rem}.p-8{padding:2rem}.p-\\[1px\\]{padding:1px}.px-1{padding-left:.25rem;padding-right:.25rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-2\\.5{padding-left:.625rem;padding-right:.625rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-5{padding-left:1.25rem;padding-right:1.25rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.px-8{padding-left:2rem;padding-right:2rem}.py-0\\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\\.5{padding-top:.375rem;padding-bottom:.375rem}.py-12{padding-top:3rem;padding-bottom:3rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-6{padding-top:1.5rem;padding-bottom:1.5rem}.py-8{padding-top:2rem;padding-bottom:2rem}.pb-3{padding-bottom:.75rem}.pb-4{padding-bottom:1rem}.pb-6{padding-bottom:1.5rem}.pl-2\\.5{padding-left:.625rem}.pl-4{padding-left:1rem}.pl-8{padding-left:2rem}.pl-9{padding-left:2.25rem}.pr-2{padding-right:.5rem}.pr-2\\.5{padding-right:.625rem}.pr-8{padding-right:2rem}.pt-0{padding-top:0}.pt-1{padding-top:.25rem}.pt-2{padding-top:.5rem}.pt-3{padding-top:.75rem}.pt-4{padding-top:1rem}.text-left{text-align:left}.text-center{text-align:center}.align-middle{vertical-align:middle}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.text-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-4xl{font-size:2.25rem;line-height:2.5rem}.text-\\[0\\.8rem\\]{font-size:.8rem}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-normal{font-weight:400}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.tabular-nums{--tw-numeric-spacing: tabular-nums;font-variant-numeric:var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction)}.leading-none{line-height:1}.leading-relaxed{line-height:1.625}.leading-snug{line-height:1.375}.tracking-tight{letter-spacing:-.025em}.tracking-widest{letter-spacing:.1em}.text-accent-foreground{color:hsl(var(--accent-foreground))}.text-background{color:hsl(var(--background))}.text-blue-500{--tw-text-opacity: 1;color:rgb(59 130 246 / var(--tw-text-opacity, 1))}.text-card-foreground{color:hsl(var(--card-foreground))}.text-current{color:currentColor}.text-destructive{color:hsl(var(--destructive))}.text-destructive-foreground{color:hsl(var(--destructive-foreground))}.text-emerald-300{--tw-text-opacity: 1;color:rgb(110 231 183 / var(--tw-text-opacity, 1))}.text-factorcloud-primary-foreground{color:hsl(var(--factorcloud-primary-foreground))}.text-factorcloud-success-foreground{color:hsl(var(--factorcloud-success-foreground))}.text-foreground{color:hsl(var(--foreground))}.text-foreground\\/50{color:hsl(var(--foreground) / .5)}.text-gray-600{--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.text-green-500{--tw-text-opacity: 1;color:rgb(34 197 94 / var(--tw-text-opacity, 1))}.text-green-700{--tw-text-opacity: 1;color:rgb(21 128 61 / var(--tw-text-opacity, 1))}.text-muted-foreground{color:hsl(var(--muted-foreground))}.text-popover-foreground{color:hsl(var(--popover-foreground))}.text-primary{color:hsl(var(--primary))}.text-primary-foreground{color:hsl(var(--primary-foreground))}.text-secondary-foreground{color:hsl(var(--secondary-foreground))}.text-sidebar-foreground{color:hsl(var(--sidebar-foreground))}.text-sidebar-foreground\\/70{color:hsl(var(--sidebar-foreground) / .7)}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.text-white\\/60{color:#fff9}.text-white\\/70{color:#ffffffb3}.text-white\\/80{color:#fffc}.text-white\\/90{color:#ffffffe6}.text-yellow-700{--tw-text-opacity: 1;color:rgb(161 98 7 / var(--tw-text-opacity, 1))}.underline{text-decoration-line:underline}.underline-offset-4{text-underline-offset:4px}.opacity-0{opacity:0}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.opacity-70{opacity:.7}.opacity-90{opacity:.9}.shadow-\\[0_0_0_1px_hsl\\(var\\(--sidebar-border\\)\\)\\]{--tw-shadow: 0 0 0 1px hsl(var(--sidebar-border));--tw-shadow-colored: 0 0 0 1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-inner{--tw-shadow: inset 0 2px 4px 0 rgb(0 0 0 / .05);--tw-shadow-colored: inset 0 2px 4px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-md{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-none{--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-xl{--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.outline-none{outline:2px solid transparent;outline-offset:2px}.outline{outline-style:solid}.ring-0{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-2{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-ring{--tw-ring-color: hsl(var(--ring))}.ring-sidebar-ring{--tw-ring-color: hsl(var(--sidebar-ring))}.ring-offset-background{--tw-ring-offset-color: hsl(var(--background))}.blur{--tw-blur: blur(8px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-blur-sm{--tw-backdrop-blur: blur(4px);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-\\[left\\,right\\,width\\]{transition-property:left,right,width;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-\\[margin\\,opa\\]{transition-property:margin,opa;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-\\[width\\,height\\,padding\\]{transition-property:width,height,padding;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-\\[width\\]{transition-property:width;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-1000{transition-duration:1s}.duration-200{transition-duration:.2s}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}.ease-linear{transition-timing-function:linear}.ease-out{transition-timing-function:cubic-bezier(0,0,.2,1)}@keyframes enter{0%{opacity:var(--tw-enter-opacity, 1);transform:translate3d(var(--tw-enter-translate-x, 0),var(--tw-enter-translate-y, 0),0) scale3d(var(--tw-enter-scale, 1),var(--tw-enter-scale, 1),var(--tw-enter-scale, 1)) rotate(var(--tw-enter-rotate, 0))}}@keyframes exit{to{opacity:var(--tw-exit-opacity, 1);transform:translate3d(var(--tw-exit-translate-x, 0),var(--tw-exit-translate-y, 0),0) scale3d(var(--tw-exit-scale, 1),var(--tw-exit-scale, 1),var(--tw-exit-scale, 1)) rotate(var(--tw-exit-rotate, 0))}}.animate-in{animation-name:enter;animation-duration:.15s;--tw-enter-opacity: initial;--tw-enter-scale: initial;--tw-enter-rotate: initial;--tw-enter-translate-x: initial;--tw-enter-translate-y: initial}.fade-in-0{--tw-enter-opacity: 0}.fade-in-80{--tw-enter-opacity: .8}.zoom-in-95{--tw-enter-scale: .95}.duration-1000{animation-duration:1s}.duration-200{animation-duration:.2s}.ease-in-out{animation-timing-function:cubic-bezier(.4,0,.2,1)}.ease-linear{animation-timing-function:linear}.ease-out{animation-timing-function:cubic-bezier(0,0,.2,1)}.file\\:border-0::file-selector-button{border-width:0px}.file\\:bg-transparent::file-selector-button{background-color:transparent}.file\\:text-sm::file-selector-button{font-size:.875rem;line-height:1.25rem}.file\\:font-medium::file-selector-button{font-weight:500}.file\\:text-foreground::file-selector-button{color:hsl(var(--foreground))}.placeholder\\:text-muted-foreground::-moz-placeholder{color:hsl(var(--muted-foreground))}.placeholder\\:text-muted-foreground::placeholder{color:hsl(var(--muted-foreground))}.after\\:absolute:after{content:var(--tw-content);position:absolute}.after\\:-inset-2:after{content:var(--tw-content);inset:-.5rem}.after\\:inset-y-0:after{content:var(--tw-content);top:0;bottom:0}.after\\:left-1\\/2:after{content:var(--tw-content);left:50%}.after\\:w-1:after{content:var(--tw-content);width:.25rem}.after\\:w-\\[2px\\]:after{content:var(--tw-content);width:2px}.after\\:-translate-x-1\\/2:after{content:var(--tw-content);--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.first\\:rounded-l-md:first-child{border-top-left-radius:calc(var(--radius) - 2px);border-bottom-left-radius:calc(var(--radius) - 2px)}.first\\:border-l:first-child{border-left-width:1px}.last\\:rounded-r-md:last-child{border-top-right-radius:calc(var(--radius) - 2px);border-bottom-right-radius:calc(var(--radius) - 2px)}.focus-within\\:relative:focus-within{position:relative}.focus-within\\:z-20:focus-within{z-index:20}.hover\\:bg-accent:hover{background-color:hsl(var(--accent))}.hover\\:bg-destructive\\/80:hover{background-color:hsl(var(--destructive) / .8)}.hover\\:bg-destructive\\/90:hover{background-color:hsl(var(--destructive) / .9)}.hover\\:bg-factorcloud-primary\\/90:hover{background-color:hsl(var(--factorcloud-primary) / .9)}.hover\\:bg-factorcloud-success\\/90:hover{background-color:hsl(var(--factorcloud-success) / .9)}.hover\\:bg-foreground\\/90:hover{background-color:hsl(var(--foreground) / .9)}.hover\\:bg-green-200:hover{--tw-bg-opacity: 1;background-color:rgb(187 247 208 / var(--tw-bg-opacity, 1))}.hover\\:bg-muted:hover{background-color:hsl(var(--muted))}.hover\\:bg-muted\\/50:hover{background-color:hsl(var(--muted) / .5)}.hover\\:bg-muted\\/70:hover{background-color:hsl(var(--muted) / .7)}.hover\\:bg-primary:hover{background-color:hsl(var(--primary))}.hover\\:bg-primary\\/80:hover{background-color:hsl(var(--primary) / .8)}.hover\\:bg-primary\\/90:hover{background-color:hsl(var(--primary) / .9)}.hover\\:bg-secondary:hover{background-color:hsl(var(--secondary))}.hover\\:bg-secondary\\/80:hover{background-color:hsl(var(--secondary) / .8)}.hover\\:bg-sidebar-accent:hover{background-color:hsl(var(--sidebar-accent))}.hover\\:bg-white\\/5:hover{background-color:#ffffff0d}.hover\\:bg-yellow-200:hover{--tw-bg-opacity: 1;background-color:rgb(254 240 138 / var(--tw-bg-opacity, 1))}.hover\\:text-accent-foreground:hover{color:hsl(var(--accent-foreground))}.hover\\:text-blue-700:hover{--tw-text-opacity: 1;color:rgb(29 78 216 / var(--tw-text-opacity, 1))}.hover\\:text-foreground:hover{color:hsl(var(--foreground))}.hover\\:text-muted-foreground:hover{color:hsl(var(--muted-foreground))}.hover\\:text-primary-foreground:hover{color:hsl(var(--primary-foreground))}.hover\\:text-sidebar-accent-foreground:hover{color:hsl(var(--sidebar-accent-foreground))}.hover\\:underline:hover{text-decoration-line:underline}.hover\\:opacity-100:hover{opacity:1}.hover\\:shadow-\\[0_0_0_1px_hsl\\(var\\(--sidebar-accent\\)\\)\\]:hover{--tw-shadow: 0 0 0 1px hsl(var(--sidebar-accent));--tw-shadow-colored: 0 0 0 1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.hover\\:after\\:bg-sidebar-border:hover:after{content:var(--tw-content);background-color:hsl(var(--sidebar-border))}.focus\\:bg-accent:focus{background-color:hsl(var(--accent))}.focus\\:bg-primary:focus{background-color:hsl(var(--primary))}.focus\\:text-accent-foreground:focus{color:hsl(var(--accent-foreground))}.focus\\:text-primary-foreground:focus{color:hsl(var(--primary-foreground))}.focus\\:opacity-100:focus{opacity:1}.focus\\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\\:ring-2:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\\:ring-ring:focus{--tw-ring-color: hsl(var(--ring))}.focus\\:ring-offset-2:focus{--tw-ring-offset-width: 2px}.focus-visible\\:outline-none:focus-visible{outline:2px solid transparent;outline-offset:2px}.focus-visible\\:ring-1:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\\:ring-2:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\\:ring-ring:focus-visible{--tw-ring-color: hsl(var(--ring))}.focus-visible\\:ring-sidebar-ring:focus-visible{--tw-ring-color: hsl(var(--sidebar-ring))}.focus-visible\\:ring-offset-1:focus-visible{--tw-ring-offset-width: 1px}.focus-visible\\:ring-offset-2:focus-visible{--tw-ring-offset-width: 2px}.focus-visible\\:ring-offset-background:focus-visible{--tw-ring-offset-color: hsl(var(--background))}.active\\:bg-sidebar-accent:active{background-color:hsl(var(--sidebar-accent))}.active\\:text-sidebar-accent-foreground:active{color:hsl(var(--sidebar-accent-foreground))}.disabled\\:pointer-events-none:disabled{pointer-events:none}.disabled\\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\\:opacity-50:disabled{opacity:.5}.group\\/menu-item:focus-within .group-focus-within\\/menu-item\\:opacity-100{opacity:1}.group\\/menu-item:hover .group-hover\\/menu-item\\:opacity-100,.group:hover .group-hover\\:opacity-100{opacity:1}.group.destructive .group-\\[\\.destructive\\]\\:border-muted\\/40{border-color:hsl(var(--muted) / .4)}.group.toaster .group-\\[\\.toaster\\]\\:border-border{border-color:hsl(var(--border))}.group.toast .group-\\[\\.toast\\]\\:bg-muted{background-color:hsl(var(--muted))}.group.toast .group-\\[\\.toast\\]\\:bg-primary{background-color:hsl(var(--primary))}.group.toaster .group-\\[\\.toaster\\]\\:bg-background{background-color:hsl(var(--background))}.group.destructive .group-\\[\\.destructive\\]\\:text-red-300{--tw-text-opacity: 1;color:rgb(252 165 165 / var(--tw-text-opacity, 1))}.group.toast .group-\\[\\.toast\\]\\:text-muted-foreground{color:hsl(var(--muted-foreground))}.group.toast .group-\\[\\.toast\\]\\:text-primary-foreground{color:hsl(var(--primary-foreground))}.group.toaster .group-\\[\\.toaster\\]\\:text-foreground{color:hsl(var(--foreground))}.group.toaster .group-\\[\\.toaster\\]\\:shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.group.destructive .group-\\[\\.destructive\\]\\:hover\\:border-destructive\\/30:hover{border-color:hsl(var(--destructive) / .3)}.group.destructive .group-\\[\\.destructive\\]\\:hover\\:bg-destructive:hover{background-color:hsl(var(--destructive))}.group.destructive .group-\\[\\.destructive\\]\\:hover\\:text-destructive-foreground:hover{color:hsl(var(--destructive-foreground))}.group.destructive .group-\\[\\.destructive\\]\\:hover\\:text-red-50:hover{--tw-text-opacity: 1;color:rgb(254 242 242 / var(--tw-text-opacity, 1))}.group.destructive .group-\\[\\.destructive\\]\\:focus\\:ring-destructive:focus{--tw-ring-color: hsl(var(--destructive))}.group.destructive .group-\\[\\.destructive\\]\\:focus\\:ring-red-400:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(248 113 113 / var(--tw-ring-opacity, 1))}.group.destructive .group-\\[\\.destructive\\]\\:focus\\:ring-offset-red-600:focus{--tw-ring-offset-color: #dc2626}.peer\\/menu-button:hover~.peer-hover\\/menu-button\\:text-sidebar-accent-foreground{color:hsl(var(--sidebar-accent-foreground))}.peer:disabled~.peer-disabled\\:cursor-not-allowed{cursor:not-allowed}.peer:disabled~.peer-disabled\\:opacity-70{opacity:.7}.has-\\[\\[data-variant\\=inset\\]\\]\\:bg-sidebar:has([data-variant=inset]){background-color:hsl(var(--sidebar-background))}.has-\\[\\:disabled\\]\\:opacity-50:has(:disabled){opacity:.5}.group\\/menu-item:has([data-sidebar=menu-action]) .group-has-\\[\\[data-sidebar\\=menu-action\\]\\]\\/menu-item\\:pr-8{padding-right:2rem}.aria-disabled\\:pointer-events-none[aria-disabled=true]{pointer-events:none}.aria-disabled\\:opacity-50[aria-disabled=true]{opacity:.5}.aria-selected\\:bg-accent[aria-selected=true]{background-color:hsl(var(--accent))}.aria-selected\\:bg-accent\\/50[aria-selected=true]{background-color:hsl(var(--accent) / .5)}.aria-selected\\:text-accent-foreground[aria-selected=true]{color:hsl(var(--accent-foreground))}.aria-selected\\:text-muted-foreground[aria-selected=true]{color:hsl(var(--muted-foreground))}.aria-selected\\:opacity-100[aria-selected=true]{opacity:1}.aria-selected\\:opacity-30[aria-selected=true]{opacity:.3}.data-\\[disabled\\=true\\]\\:pointer-events-none[data-disabled=true],.data-\\[disabled\\]\\:pointer-events-none[data-disabled]{pointer-events:none}.data-\\[panel-group-direction\\=vertical\\]\\:h-px[data-panel-group-direction=vertical]{height:1px}.data-\\[panel-group-direction\\=vertical\\]\\:w-full[data-panel-group-direction=vertical]{width:100%}.data-\\[side\\=bottom\\]\\:translate-y-1[data-side=bottom]{--tw-translate-y: .25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\\[side\\=left\\]\\:-translate-x-1[data-side=left]{--tw-translate-x: -.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\\[side\\=right\\]\\:translate-x-1[data-side=right]{--tw-translate-x: .25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\\[side\\=top\\]\\:-translate-y-1[data-side=top]{--tw-translate-y: -.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\\[state\\=checked\\]\\:translate-x-5[data-state=checked]{--tw-translate-x: 1.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\\[state\\=unchecked\\]\\:translate-x-0[data-state=unchecked],.data-\\[swipe\\=cancel\\]\\:translate-x-0[data-swipe=cancel]{--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\\[swipe\\=end\\]\\:translate-x-\\[var\\(--radix-toast-swipe-end-x\\)\\][data-swipe=end]{--tw-translate-x: var(--radix-toast-swipe-end-x);transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\\[swipe\\=move\\]\\:translate-x-\\[var\\(--radix-toast-swipe-move-x\\)\\][data-swipe=move]{--tw-translate-x: var(--radix-toast-swipe-move-x);transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes accordion-up{0%{height:var(--radix-accordion-content-height)}to{height:0}}.data-\\[state\\=closed\\]\\:animate-accordion-up[data-state=closed]{animation:accordion-up .2s ease-out}@keyframes accordion-down{0%{height:0}to{height:var(--radix-accordion-content-height)}}.data-\\[state\\=open\\]\\:animate-accordion-down[data-state=open]{animation:accordion-down .2s ease-out}.data-\\[panel-group-direction\\=vertical\\]\\:flex-col[data-panel-group-direction=vertical]{flex-direction:column}.data-\\[state\\=active\\]\\:border-factorcloud-primary[data-state=active]{border-color:hsl(var(--factorcloud-primary))}.data-\\[active\\=true\\]\\:bg-sidebar-accent[data-active=true]{background-color:hsl(var(--sidebar-accent))}.data-\\[active\\]\\:bg-accent\\/50[data-active]{background-color:hsl(var(--accent) / .5)}.data-\\[selected\\=\\'true\\'\\]\\:bg-accent[data-selected=true]{background-color:hsl(var(--accent))}.data-\\[state\\=active\\]\\:bg-background[data-state=active]{background-color:hsl(var(--background))}.data-\\[state\\=checked\\]\\:bg-primary[data-state=checked]{background-color:hsl(var(--primary))}.data-\\[state\\=on\\]\\:bg-accent[data-state=on],.data-\\[state\\=open\\]\\:bg-accent[data-state=open]{background-color:hsl(var(--accent))}.data-\\[state\\=open\\]\\:bg-accent\\/50[data-state=open]{background-color:hsl(var(--accent) / .5)}.data-\\[state\\=open\\]\\:bg-secondary[data-state=open]{background-color:hsl(var(--secondary))}.data-\\[state\\=selected\\]\\:bg-muted[data-state=selected]{background-color:hsl(var(--muted))}.data-\\[state\\=unchecked\\]\\:bg-input[data-state=unchecked]{background-color:hsl(var(--input))}.data-\\[active\\=true\\]\\:font-medium[data-active=true]{font-weight:500}.data-\\[active\\=true\\]\\:text-sidebar-accent-foreground[data-active=true]{color:hsl(var(--sidebar-accent-foreground))}.data-\\[selected\\=true\\]\\:text-accent-foreground[data-selected=true]{color:hsl(var(--accent-foreground))}.data-\\[state\\=active\\]\\:text-foreground[data-state=active]{color:hsl(var(--foreground))}.data-\\[state\\=checked\\]\\:text-primary-foreground[data-state=checked]{color:hsl(var(--primary-foreground))}.data-\\[state\\=on\\]\\:text-accent-foreground[data-state=on],.data-\\[state\\=open\\]\\:text-accent-foreground[data-state=open]{color:hsl(var(--accent-foreground))}.data-\\[state\\=open\\]\\:text-muted-foreground[data-state=open]{color:hsl(var(--muted-foreground))}.data-\\[disabled\\=true\\]\\:opacity-50[data-disabled=true],.data-\\[disabled\\]\\:opacity-50[data-disabled]{opacity:.5}.data-\\[state\\=open\\]\\:opacity-100[data-state=open]{opacity:1}.data-\\[state\\=active\\]\\:shadow-sm[data-state=active]{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.data-\\[swipe\\=move\\]\\:transition-none[data-swipe=move]{transition-property:none}.data-\\[state\\=closed\\]\\:duration-300[data-state=closed]{transition-duration:.3s}.data-\\[state\\=open\\]\\:duration-500[data-state=open]{transition-duration:.5s}.data-\\[motion\\^\\=from-\\]\\:animate-in[data-motion^=from-],.data-\\[state\\=open\\]\\:animate-in[data-state=open],.data-\\[state\\=visible\\]\\:animate-in[data-state=visible]{animation-name:enter;animation-duration:.15s;--tw-enter-opacity: initial;--tw-enter-scale: initial;--tw-enter-rotate: initial;--tw-enter-translate-x: initial;--tw-enter-translate-y: initial}.data-\\[motion\\^\\=to-\\]\\:animate-out[data-motion^=to-],.data-\\[state\\=closed\\]\\:animate-out[data-state=closed],.data-\\[state\\=hidden\\]\\:animate-out[data-state=hidden],.data-\\[swipe\\=end\\]\\:animate-out[data-swipe=end]{animation-name:exit;animation-duration:.15s;--tw-exit-opacity: initial;--tw-exit-scale: initial;--tw-exit-rotate: initial;--tw-exit-translate-x: initial;--tw-exit-translate-y: initial}.data-\\[motion\\^\\=from-\\]\\:fade-in[data-motion^=from-]{--tw-enter-opacity: 0}.data-\\[motion\\^\\=to-\\]\\:fade-out[data-motion^=to-],.data-\\[state\\=closed\\]\\:fade-out-0[data-state=closed]{--tw-exit-opacity: 0}.data-\\[state\\=closed\\]\\:fade-out-80[data-state=closed]{--tw-exit-opacity: .8}.data-\\[state\\=hidden\\]\\:fade-out[data-state=hidden]{--tw-exit-opacity: 0}.data-\\[state\\=open\\]\\:fade-in-0[data-state=open],.data-\\[state\\=visible\\]\\:fade-in[data-state=visible]{--tw-enter-opacity: 0}.data-\\[state\\=closed\\]\\:zoom-out-95[data-state=closed]{--tw-exit-scale: .95}.data-\\[state\\=open\\]\\:zoom-in-90[data-state=open]{--tw-enter-scale: .9}.data-\\[state\\=open\\]\\:zoom-in-95[data-state=open]{--tw-enter-scale: .95}.data-\\[motion\\=from-end\\]\\:slide-in-from-right-52[data-motion=from-end]{--tw-enter-translate-x: 13rem}.data-\\[motion\\=from-start\\]\\:slide-in-from-left-52[data-motion=from-start]{--tw-enter-translate-x: -13rem}.data-\\[motion\\=to-end\\]\\:slide-out-to-right-52[data-motion=to-end]{--tw-exit-translate-x: 13rem}.data-\\[motion\\=to-start\\]\\:slide-out-to-left-52[data-motion=to-start]{--tw-exit-translate-x: -13rem}.data-\\[side\\=bottom\\]\\:slide-in-from-top-2[data-side=bottom]{--tw-enter-translate-y: -.5rem}.data-\\[side\\=left\\]\\:slide-in-from-right-2[data-side=left]{--tw-enter-translate-x: .5rem}.data-\\[side\\=right\\]\\:slide-in-from-left-2[data-side=right]{--tw-enter-translate-x: -.5rem}.data-\\[side\\=top\\]\\:slide-in-from-bottom-2[data-side=top]{--tw-enter-translate-y: .5rem}.data-\\[state\\=closed\\]\\:slide-out-to-bottom[data-state=closed]{--tw-exit-translate-y: 100%}.data-\\[state\\=closed\\]\\:slide-out-to-left[data-state=closed]{--tw-exit-translate-x: -100%}.data-\\[state\\=closed\\]\\:slide-out-to-left-1\\/2[data-state=closed]{--tw-exit-translate-x: -50%}.data-\\[state\\=closed\\]\\:slide-out-to-right[data-state=closed],.data-\\[state\\=closed\\]\\:slide-out-to-right-full[data-state=closed]{--tw-exit-translate-x: 100%}.data-\\[state\\=closed\\]\\:slide-out-to-top[data-state=closed]{--tw-exit-translate-y: -100%}.data-\\[state\\=closed\\]\\:slide-out-to-top-\\[48\\%\\][data-state=closed]{--tw-exit-translate-y: -48%}.data-\\[state\\=open\\]\\:slide-in-from-bottom[data-state=open]{--tw-enter-translate-y: 100%}.data-\\[state\\=open\\]\\:slide-in-from-left[data-state=open]{--tw-enter-translate-x: -100%}.data-\\[state\\=open\\]\\:slide-in-from-left-1\\/2[data-state=open]{--tw-enter-translate-x: -50%}.data-\\[state\\=open\\]\\:slide-in-from-right[data-state=open]{--tw-enter-translate-x: 100%}.data-\\[state\\=open\\]\\:slide-in-from-top[data-state=open]{--tw-enter-translate-y: -100%}.data-\\[state\\=open\\]\\:slide-in-from-top-\\[48\\%\\][data-state=open]{--tw-enter-translate-y: -48%}.data-\\[state\\=open\\]\\:slide-in-from-top-full[data-state=open]{--tw-enter-translate-y: -100%}.data-\\[state\\=closed\\]\\:duration-300[data-state=closed]{animation-duration:.3s}.data-\\[state\\=open\\]\\:duration-500[data-state=open]{animation-duration:.5s}.data-\\[panel-group-direction\\=vertical\\]\\:after\\:left-0[data-panel-group-direction=vertical]:after{content:var(--tw-content);left:0}.data-\\[panel-group-direction\\=vertical\\]\\:after\\:h-1[data-panel-group-direction=vertical]:after{content:var(--tw-content);height:.25rem}.data-\\[panel-group-direction\\=vertical\\]\\:after\\:w-full[data-panel-group-direction=vertical]:after{content:var(--tw-content);width:100%}.data-\\[panel-group-direction\\=vertical\\]\\:after\\:-translate-y-1\\/2[data-panel-group-direction=vertical]:after{content:var(--tw-content);--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\\[panel-group-direction\\=vertical\\]\\:after\\:translate-x-0[data-panel-group-direction=vertical]:after{content:var(--tw-content);--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\\[state\\=open\\]\\:hover\\:bg-sidebar-accent:hover[data-state=open]{background-color:hsl(var(--sidebar-accent))}.data-\\[state\\=open\\]\\:hover\\:text-sidebar-accent-foreground:hover[data-state=open]{color:hsl(var(--sidebar-accent-foreground))}.group[data-collapsible=offcanvas] .group-data-\\[collapsible\\=offcanvas\\]\\:left-\\[calc\\(var\\(--sidebar-width\\)\\*-1\\)\\]{left:calc(var(--sidebar-width) * -1)}.group[data-collapsible=offcanvas] .group-data-\\[collapsible\\=offcanvas\\]\\:right-\\[calc\\(var\\(--sidebar-width\\)\\*-1\\)\\]{right:calc(var(--sidebar-width) * -1)}.group[data-side=left] .group-data-\\[side\\=left\\]\\:-right-4{right:-1rem}.group[data-side=right] .group-data-\\[side\\=right\\]\\:left-0{left:0}.group[data-collapsible=icon] .group-data-\\[collapsible\\=icon\\]\\:-mt-8{margin-top:-2rem}.group[data-collapsible=icon] .group-data-\\[collapsible\\=icon\\]\\:hidden{display:none}.group[data-collapsible=icon] .group-data-\\[collapsible\\=icon\\]\\:\\!size-8{width:2rem!important;height:2rem!important}.group[data-collapsible=icon] .group-data-\\[collapsible\\=icon\\]\\:w-\\[--sidebar-width-icon\\]{width:var(--sidebar-width-icon)}.group[data-collapsible=icon] .group-data-\\[collapsible\\=icon\\]\\:w-\\[calc\\(var\\(--sidebar-width-icon\\)_\\+_theme\\(spacing\\.4\\)\\)\\]{width:calc(var(--sidebar-width-icon) + 1rem)}.group[data-collapsible=icon] .group-data-\\[collapsible\\=icon\\]\\:w-\\[calc\\(var\\(--sidebar-width-icon\\)_\\+_theme\\(spacing\\.4\\)_\\+2px\\)\\]{width:calc(var(--sidebar-width-icon) + 1rem + 2px)}.group[data-collapsible=offcanvas] .group-data-\\[collapsible\\=offcanvas\\]\\:w-0{width:0px}.group[data-collapsible=offcanvas] .group-data-\\[collapsible\\=offcanvas\\]\\:translate-x-0{--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group[data-side=right] .group-data-\\[side\\=right\\]\\:rotate-180,.group[data-state=open] .group-data-\\[state\\=open\\]\\:rotate-180{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group[data-collapsible=icon] .group-data-\\[collapsible\\=icon\\]\\:overflow-hidden{overflow:hidden}.group[data-variant=floating] .group-data-\\[variant\\=floating\\]\\:rounded-lg{border-radius:var(--radius)}.group[data-variant=floating] .group-data-\\[variant\\=floating\\]\\:border{border-width:1px}.group[data-side=left] .group-data-\\[side\\=left\\]\\:border-r{border-right-width:1px}.group[data-side=right] .group-data-\\[side\\=right\\]\\:border-l{border-left-width:1px}.group[data-variant=floating] .group-data-\\[variant\\=floating\\]\\:border-sidebar-border{border-color:hsl(var(--sidebar-border))}.group[data-collapsible=icon] .group-data-\\[collapsible\\=icon\\]\\:\\!p-0{padding:0!important}.group[data-collapsible=icon] .group-data-\\[collapsible\\=icon\\]\\:\\!p-2{padding:.5rem!important}.group[data-collapsible=icon] .group-data-\\[collapsible\\=icon\\]\\:opacity-0{opacity:0}.group[data-variant=floating] .group-data-\\[variant\\=floating\\]\\:shadow{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.group[data-collapsible=offcanvas] .group-data-\\[collapsible\\=offcanvas\\]\\:after\\:left-full:after{content:var(--tw-content);left:100%}.group[data-collapsible=offcanvas] .group-data-\\[collapsible\\=offcanvas\\]\\:hover\\:bg-sidebar:hover{background-color:hsl(var(--sidebar-background))}.peer\\/menu-button[data-size=default]~.peer-data-\\[size\\=default\\]\\/menu-button\\:top-1\\.5{top:.375rem}.peer\\/menu-button[data-size=lg]~.peer-data-\\[size\\=lg\\]\\/menu-button\\:top-2\\.5{top:.625rem}.peer\\/menu-button[data-size=sm]~.peer-data-\\[size\\=sm\\]\\/menu-button\\:top-1{top:.25rem}.peer[data-variant=inset]~.peer-data-\\[variant\\=inset\\]\\:min-h-\\[calc\\(100svh-theme\\(spacing\\.4\\)\\)\\]{min-height:calc(100svh - 1rem)}.peer\\/menu-button[data-active=true]~.peer-data-\\[active\\=true\\]\\/menu-button\\:text-sidebar-accent-foreground{color:hsl(var(--sidebar-accent-foreground))}.dark\\:border-destructive:is(.dark *){border-color:hsl(var(--destructive))}@media (min-width: 640px){.sm\\:bottom-0{bottom:0}.sm\\:right-0{right:0}.sm\\:top-auto{top:auto}.sm\\:mt-0{margin-top:0}.sm\\:flex{display:flex}.sm\\:max-w-2xl{max-width:42rem}.sm\\:max-w-5xl{max-width:64rem}.sm\\:max-w-sm{max-width:24rem}.sm\\:flex-row{flex-direction:row}.sm\\:flex-col{flex-direction:column}.sm\\:justify-end{justify-content:flex-end}.sm\\:gap-2\\.5{gap:.625rem}.sm\\:space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.sm\\:space-x-4>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(1rem * var(--tw-space-x-reverse));margin-left:calc(1rem * calc(1 - var(--tw-space-x-reverse)))}.sm\\:space-y-0>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(0px * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(0px * var(--tw-space-y-reverse))}.sm\\:rounded-lg{border-radius:var(--radius)}.sm\\:text-left{text-align:left}.data-\\[state\\=open\\]\\:sm\\:slide-in-from-bottom-full[data-state=open]{--tw-enter-translate-y: 100%}}@media (min-width: 768px){.md\\:absolute{position:absolute}.md\\:block{display:block}.md\\:flex{display:flex}.md\\:w-1\\/2{width:50%}.md\\:w-1\\/3{width:33.333333%}.md\\:w-2\\/3{width:66.666667%}.md\\:w-\\[var\\(--radix-navigation-menu-viewport-width\\)\\]{width:var(--radix-navigation-menu-viewport-width)}.md\\:w-auto{width:auto}.md\\:max-w-\\[420px\\]{max-width:420px}.md\\:flex-row{flex-direction:row}.md\\:text-sm{font-size:.875rem;line-height:1.25rem}.md\\:opacity-0{opacity:0}.after\\:md\\:hidden:after{content:var(--tw-content);display:none}.peer[data-variant=inset]~.md\\:peer-data-\\[variant\\=inset\\]\\:m-2{margin:.5rem}.peer[data-state=collapsed][data-variant=inset]~.md\\:peer-data-\\[state\\=collapsed\\]\\:peer-data-\\[variant\\=inset\\]\\:ml-2{margin-left:.5rem}.peer[data-variant=inset]~.md\\:peer-data-\\[variant\\=inset\\]\\:ml-0{margin-left:0}.peer[data-variant=inset]~.md\\:peer-data-\\[variant\\=inset\\]\\:rounded-xl{border-radius:.75rem}.peer[data-variant=inset]~.md\\:peer-data-\\[variant\\=inset\\]\\:shadow{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}}.\\[\\&\\:has\\(\\[aria-selected\\]\\)\\]\\:bg-accent:has([aria-selected]){background-color:hsl(var(--accent))}.first\\:\\[\\&\\:has\\(\\[aria-selected\\]\\)\\]\\:rounded-l-md:has([aria-selected]):first-child{border-top-left-radius:calc(var(--radius) - 2px);border-bottom-left-radius:calc(var(--radius) - 2px)}.last\\:\\[\\&\\:has\\(\\[aria-selected\\]\\)\\]\\:rounded-r-md:has([aria-selected]):last-child{border-top-right-radius:calc(var(--radius) - 2px);border-bottom-right-radius:calc(var(--radius) - 2px)}.\\[\\&\\:has\\(\\[aria-selected\\]\\.day-outside\\)\\]\\:bg-accent\\/50:has([aria-selected].day-outside){background-color:hsl(var(--accent) / .5)}.\\[\\&\\:has\\(\\[aria-selected\\]\\.day-range-end\\)\\]\\:rounded-r-md:has([aria-selected].day-range-end){border-top-right-radius:calc(var(--radius) - 2px);border-bottom-right-radius:calc(var(--radius) - 2px)}.\\[\\&\\:has\\(\\[role\\=checkbox\\]\\)\\]\\:pr-0:has([role=checkbox]){padding-right:0}.\\[\\&\\>button\\]\\:hidden>button{display:none}.\\[\\&\\>span\\:last-child\\]\\:truncate>span:last-child{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.\\[\\&\\>span\\]\\:line-clamp-1>span{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.\\[\\&\\>svg\\+div\\]\\:translate-y-\\[-3px\\]>svg+div{--tw-translate-y: -3px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.\\[\\&\\>svg\\]\\:absolute>svg{position:absolute}.\\[\\&\\>svg\\]\\:left-4>svg{left:1rem}.\\[\\&\\>svg\\]\\:top-4>svg{top:1rem}.\\[\\&\\>svg\\]\\:size-3\\.5>svg{width:.875rem;height:.875rem}.\\[\\&\\>svg\\]\\:size-4>svg{width:1rem;height:1rem}.\\[\\&\\>svg\\]\\:h-2\\.5>svg{height:.625rem}.\\[\\&\\>svg\\]\\:h-3>svg{height:.75rem}.\\[\\&\\>svg\\]\\:w-2\\.5>svg{width:.625rem}.\\[\\&\\>svg\\]\\:w-3>svg{width:.75rem}.\\[\\&\\>svg\\]\\:shrink-0>svg{flex-shrink:0}.\\[\\&\\>svg\\]\\:text-destructive>svg{color:hsl(var(--destructive))}.\\[\\&\\>svg\\]\\:text-foreground>svg{color:hsl(var(--foreground))}.\\[\\&\\>svg\\]\\:text-muted-foreground>svg{color:hsl(var(--muted-foreground))}.\\[\\&\\>svg\\]\\:text-sidebar-accent-foreground>svg{color:hsl(var(--sidebar-accent-foreground))}.\\[\\&\\>svg\\~\\*\\]\\:pl-7>svg~*{padding-left:1.75rem}.\\[\\&\\>tr\\]\\:last\\:border-b-0:last-child>tr{border-bottom-width:0px}.\\[\\&\\[data-panel-group-direction\\=vertical\\]\\>div\\]\\:rotate-90[data-panel-group-direction=vertical]>div{--tw-rotate: 90deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.\\[\\&\\[data-state\\=open\\]\\>svg\\]\\:rotate-180[data-state=open]>svg{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.\\[\\&_\\.recharts-cartesian-axis-tick_text\\]\\:fill-muted-foreground .recharts-cartesian-axis-tick text{fill:hsl(var(--muted-foreground))}.\\[\\&_\\.recharts-cartesian-grid_line\\[stroke\\=\\'\\#ccc\\'\\]\\]\\:stroke-border\\/50 .recharts-cartesian-grid line[stroke="#ccc"]{stroke:hsl(var(--border) / .5)}.\\[\\&_\\.recharts-curve\\.recharts-tooltip-cursor\\]\\:stroke-border .recharts-curve.recharts-tooltip-cursor{stroke:hsl(var(--border))}.\\[\\&_\\.recharts-dot\\[stroke\\=\\'\\#fff\\'\\]\\]\\:stroke-transparent .recharts-dot[stroke="#fff"]{stroke:transparent}.\\[\\&_\\.recharts-layer\\]\\:outline-none .recharts-layer{outline:2px solid transparent;outline-offset:2px}.\\[\\&_\\.recharts-polar-grid_\\[stroke\\=\\'\\#ccc\\'\\]\\]\\:stroke-border .recharts-polar-grid [stroke="#ccc"]{stroke:hsl(var(--border))}.\\[\\&_\\.recharts-radial-bar-background-sector\\]\\:fill-muted .recharts-radial-bar-background-sector,.\\[\\&_\\.recharts-rectangle\\.recharts-tooltip-cursor\\]\\:fill-muted .recharts-rectangle.recharts-tooltip-cursor{fill:hsl(var(--muted))}.\\[\\&_\\.recharts-reference-line_\\[stroke\\=\\'\\#ccc\\'\\]\\]\\:stroke-border .recharts-reference-line [stroke="#ccc"]{stroke:hsl(var(--border))}.\\[\\&_\\.recharts-sector\\[stroke\\=\\'\\#fff\\'\\]\\]\\:stroke-transparent .recharts-sector[stroke="#fff"]{stroke:transparent}.\\[\\&_\\.recharts-sector\\]\\:outline-none .recharts-sector,.\\[\\&_\\.recharts-surface\\]\\:outline-none .recharts-surface{outline:2px solid transparent;outline-offset:2px}.\\[\\&_\\[cmdk-group-heading\\]\\]\\:px-2 [cmdk-group-heading]{padding-left:.5rem;padding-right:.5rem}.\\[\\&_\\[cmdk-group-heading\\]\\]\\:py-1\\.5 [cmdk-group-heading]{padding-top:.375rem;padding-bottom:.375rem}.\\[\\&_\\[cmdk-group-heading\\]\\]\\:text-xs [cmdk-group-heading]{font-size:.75rem;line-height:1rem}.\\[\\&_\\[cmdk-group-heading\\]\\]\\:font-medium [cmdk-group-heading]{font-weight:500}.\\[\\&_\\[cmdk-group-heading\\]\\]\\:text-muted-foreground [cmdk-group-heading]{color:hsl(var(--muted-foreground))}.\\[\\&_\\[cmdk-group\\]\\:not\\(\\[hidden\\]\\)_\\~\\[cmdk-group\\]\\]\\:pt-0 [cmdk-group]:not([hidden])~[cmdk-group]{padding-top:0}.\\[\\&_\\[cmdk-group\\]\\]\\:px-2 [cmdk-group]{padding-left:.5rem;padding-right:.5rem}.\\[\\&_\\[cmdk-input-wrapper\\]_svg\\]\\:h-5 [cmdk-input-wrapper] svg{height:1.25rem}.\\[\\&_\\[cmdk-input-wrapper\\]_svg\\]\\:w-5 [cmdk-input-wrapper] svg{width:1.25rem}.\\[\\&_\\[cmdk-input\\]\\]\\:h-12 [cmdk-input]{height:3rem}.\\[\\&_\\[cmdk-item\\]\\]\\:px-2 [cmdk-item]{padding-left:.5rem;padding-right:.5rem}.\\[\\&_\\[cmdk-item\\]\\]\\:py-3 [cmdk-item]{padding-top:.75rem;padding-bottom:.75rem}.\\[\\&_\\[cmdk-item\\]_svg\\]\\:h-5 [cmdk-item] svg{height:1.25rem}.\\[\\&_\\[cmdk-item\\]_svg\\]\\:w-5 [cmdk-item] svg{width:1.25rem}.\\[\\&_p\\]\\:leading-relaxed p{line-height:1.625}.\\[\\&_svg\\]\\:pointer-events-none svg{pointer-events:none}.\\[\\&_svg\\]\\:size-4 svg{width:1rem;height:1rem}.\\[\\&_svg\\]\\:shrink-0 svg{flex-shrink:0}.\\[\\&_tr\\:last-child\\]\\:border-0 tr:last-child{border-width:0px}.\\[\\&_tr\\]\\:border-b tr{border-bottom-width:1px}[data-side=left][data-collapsible=offcanvas] .\\[\\[data-side\\=left\\]\\[data-collapsible\\=offcanvas\\]_\\&\\]\\:-right-2{right:-.5rem}[data-side=left][data-state=collapsed] .\\[\\[data-side\\=left\\]\\[data-state\\=collapsed\\]_\\&\\]\\:cursor-e-resize{cursor:e-resize}[data-side=left] .\\[\\[data-side\\=left\\]_\\&\\]\\:cursor-w-resize{cursor:w-resize}[data-side=right][data-collapsible=offcanvas] .\\[\\[data-side\\=right\\]\\[data-collapsible\\=offcanvas\\]_\\&\\]\\:-left-2{left:-.5rem}[data-side=right][data-state=collapsed] .\\[\\[data-side\\=right\\]\\[data-state\\=collapsed\\]_\\&\\]\\:cursor-w-resize{cursor:w-resize}[data-side=right] .\\[\\[data-side\\=right\\]_\\&\\]\\:cursor-e-resize{cursor:e-resize}`)),document.head.appendChild(t)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();
2
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),l=require("react"),to=require("@radix-ui/react-slot"),ro=require("@radix-ui/react-dialog"),O=require("lucide-react"),oo=require("@radix-ui/react-label"),so=require("@radix-ui/react-alert-dialog"),no=require("@radix-ui/react-tabs"),ao=require("@radix-ui/react-separator"),io=require("@radix-ui/react-scroll-area"),Mt=require("@tanstack/react-query");function st(e){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const o in e)if(o!=="default"){const s=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(r,o,s.get?s:{enumerable:!0,get:()=>e[o]})}}return r.default=e,Object.freeze(r)}const W=st(l),ze=st(ro),vr=st(oo),_e=st(so),nt=st(no),wr=st(ao),tt=st(io);function jr(e){var r,o,s="";if(typeof e=="string"||typeof e=="number")s+=e;else if(typeof e=="object")if(Array.isArray(e)){var n=e.length;for(r=0;r<n;r++)e[r]&&(o=jr(e[r]))&&(s&&(s+=" "),s+=o)}else for(o in e)e[o]&&(s&&(s+=" "),s+=o);return s}function Nr(){for(var e,r,o=0,s="",n=arguments.length;o<n;o++)(e=arguments[o])&&(r=jr(e))&&(s&&(s+=" "),s+=r);return s}const cr=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,lr=Nr,kt=(e,r)=>o=>{var s;if(r?.variants==null)return lr(e,o?.class,o?.className);const{variants:n,defaultVariants:a}=r,c=Object.keys(n).map(d=>{const y=o?.[d],j=a?.[d];if(y===null)return null;const F=cr(y)||cr(j);return n[d][F]}),i=o&&Object.entries(o).reduce((d,y)=>{let[j,F]=y;return F===void 0||(d[j]=F),d},{}),f=r==null||(s=r.compoundVariants)===null||s===void 0?void 0:s.reduce((d,y)=>{let{class:j,className:F,...A}=y;return Object.entries(A).every(z=>{let[M,C]=z;return Array.isArray(C)?C.includes({...a,...i}[M]):{...a,...i}[M]===C})?[...d,j,F]:d},[]);return lr(e,c,f,o?.class,o?.className)},co=(e,r)=>{const o=new Array(e.length+r.length);for(let s=0;s<e.length;s++)o[s]=e[s];for(let s=0;s<r.length;s++)o[e.length+s]=r[s];return o},lo=(e,r)=>({classGroupId:e,validator:r}),kr=(e=new Map,r=null,o)=>({nextPart:e,validators:r,classGroupId:o}),wt="-",dr=[],uo="arbitrary..",fo=e=>{const r=po(e),{conflictingClassGroups:o,conflictingClassGroupModifiers:s}=e;return{getClassGroupId:c=>{if(c.startsWith("[")&&c.endsWith("]"))return mo(c);const i=c.split(wt),f=i[0]===""&&i.length>1?1:0;return Cr(i,f,r)},getConflictingClassGroupIds:(c,i)=>{if(i){const f=s[c],d=o[c];return f?d?co(d,f):f:d||dr}return o[c]||dr}}},Cr=(e,r,o)=>{if(e.length-r===0)return o.classGroupId;const n=e[r],a=o.nextPart.get(n);if(a){const d=Cr(e,r+1,a);if(d)return d}const c=o.validators;if(c===null)return;const i=r===0?e.join(wt):e.slice(r).join(wt),f=c.length;for(let d=0;d<f;d++){const y=c[d];if(y.validator(i))return y.classGroupId}},mo=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const r=e.slice(1,-1),o=r.indexOf(":"),s=r.slice(0,o);return s?uo+s:void 0})(),po=e=>{const{theme:r,classGroups:o}=e;return ho(o,r)},ho=(e,r)=>{const o=kr();for(const s in e){const n=e[s];Jt(n,o,s,r)}return o},Jt=(e,r,o,s)=>{const n=e.length;for(let a=0;a<n;a++){const c=e[a];go(c,r,o,s)}},go=(e,r,o,s)=>{if(typeof e=="string"){bo(e,r,o);return}if(typeof e=="function"){xo(e,r,o,s);return}yo(e,r,o,s)},bo=(e,r,o)=>{const s=e===""?r:Sr(r,e);s.classGroupId=o},xo=(e,r,o,s)=>{if(vo(e)){Jt(e(s),r,o,s);return}r.validators===null&&(r.validators=[]),r.validators.push(lo(o,e))},yo=(e,r,o,s)=>{const n=Object.entries(e),a=n.length;for(let c=0;c<a;c++){const[i,f]=n[c];Jt(f,Sr(r,i),o,s)}},Sr=(e,r)=>{let o=e;const s=r.split(wt),n=s.length;for(let a=0;a<n;a++){const c=s[a];let i=o.nextPart.get(c);i||(i=kr(),o.nextPart.set(c,i)),o=i}return o},vo=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,wo=e=>{if(e<1)return{get:()=>{},set:()=>{}};let r=0,o=Object.create(null),s=Object.create(null);const n=(a,c)=>{o[a]=c,r++,r>e&&(r=0,s=o,o=Object.create(null))};return{get(a){let c=o[a];if(c!==void 0)return c;if((c=s[a])!==void 0)return n(a,c),c},set(a,c){a in o?o[a]=c:n(a,c)}}},Bt="!",ur=":",jo=[],fr=(e,r,o,s,n)=>({modifiers:e,hasImportantModifier:r,baseClassName:o,maybePostfixModifierPosition:s,isExternal:n}),No=e=>{const{prefix:r,experimentalParseClassName:o}=e;let s=n=>{const a=[];let c=0,i=0,f=0,d;const y=n.length;for(let M=0;M<y;M++){const C=n[M];if(c===0&&i===0){if(C===ur){a.push(n.slice(f,M)),f=M+1;continue}if(C==="/"){d=M;continue}}C==="["?c++:C==="]"?c--:C==="("?i++:C===")"&&i--}const j=a.length===0?n:n.slice(f);let F=j,A=!1;j.endsWith(Bt)?(F=j.slice(0,-1),A=!0):j.startsWith(Bt)&&(F=j.slice(1),A=!0);const z=d&&d>f?d-f:void 0;return fr(a,A,F,z)};if(r){const n=r+ur,a=s;s=c=>c.startsWith(n)?a(c.slice(n.length)):fr(jo,!1,c,void 0,!0)}if(o){const n=s;s=a=>o({className:a,parseClassName:n})}return s},ko=e=>{const r=new Map;return e.orderSensitiveModifiers.forEach((o,s)=>{r.set(o,1e6+s)}),o=>{const s=[];let n=[];for(let a=0;a<o.length;a++){const c=o[a],i=c[0]==="[",f=r.has(c);i||f?(n.length>0&&(n.sort(),s.push(...n),n=[]),s.push(c)):n.push(c)}return n.length>0&&(n.sort(),s.push(...n)),s}},Co=e=>({cache:wo(e.cacheSize),parseClassName:No(e),sortModifiers:ko(e),...fo(e)}),So=/\s+/,_o=(e,r)=>{const{parseClassName:o,getClassGroupId:s,getConflictingClassGroupIds:n,sortModifiers:a}=r,c=[],i=e.trim().split(So);let f="";for(let d=i.length-1;d>=0;d-=1){const y=i[d],{isExternal:j,modifiers:F,hasImportantModifier:A,baseClassName:z,maybePostfixModifierPosition:M}=o(y);if(j){f=y+(f.length>0?" "+f:f);continue}let C=!!M,G=s(C?z.substring(0,M):z);if(!G){if(!C){f=y+(f.length>0?" "+f:f);continue}if(G=s(z),!G){f=y+(f.length>0?" "+f:f);continue}C=!1}const ne=F.length===0?"":F.length===1?F[0]:a(F).join(":"),X=A?ne+Bt:ne,Y=X+G;if(c.indexOf(Y)>-1)continue;c.push(Y);const P=n(G,C);for(let L=0;L<P.length;++L){const J=P[L];c.push(X+J)}f=y+(f.length>0?" "+f:f)}return f},Ao=(...e)=>{let r=0,o,s,n="";for(;r<e.length;)(o=e[r++])&&(s=_r(o))&&(n&&(n+=" "),n+=s);return n},_r=e=>{if(typeof e=="string")return e;let r,o="";for(let s=0;s<e.length;s++)e[s]&&(r=_r(e[s]))&&(o&&(o+=" "),o+=r);return o},Do=(e,...r)=>{let o,s,n,a;const c=f=>{const d=r.reduce((y,j)=>j(y),e());return o=Co(d),s=o.cache.get,n=o.cache.set,a=i,i(f)},i=f=>{const d=s(f);if(d)return d;const y=_o(f,o);return n(f,y),y};return a=c,(...f)=>a(Ao(...f))},Io=[],oe=e=>{const r=o=>o[e]||Io;return r.isThemeGetter=!0,r},Ar=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Dr=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Po=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,To=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Eo=/\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$/,Ro=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Fo=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Oo=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ye=e=>Po.test(e),R=e=>!!e&&!Number.isNaN(Number(e)),Xe=e=>!!e&&Number.isInteger(Number(e)),Ut=e=>e.endsWith("%")&&R(e.slice(0,-1)),Ve=e=>To.test(e),Ir=()=>!0,Mo=e=>Eo.test(e)&&!Ro.test(e),Kt=()=>!1,Uo=e=>Fo.test(e),zo=e=>Oo.test(e),$o=e=>!b(e)&&!x(e),Lo=e=>Je(e,Er,Kt),b=e=>Ar.test(e),Ze=e=>Je(e,Rr,Mo),mr=e=>Je(e,Xo,R),Bo=e=>Je(e,Or,Ir),Vo=e=>Je(e,Fr,Kt),pr=e=>Je(e,Pr,Kt),Wo=e=>Je(e,Tr,zo),bt=e=>Je(e,Mr,Uo),x=e=>Dr.test(e),ht=e=>at(e,Rr),qo=e=>at(e,Fr),hr=e=>at(e,Pr),Go=e=>at(e,Er),Ho=e=>at(e,Tr),xt=e=>at(e,Mr,!0),Yo=e=>at(e,Or,!0),Je=(e,r,o)=>{const s=Ar.exec(e);return s?s[1]?r(s[1]):o(s[2]):!1},at=(e,r,o=!1)=>{const s=Dr.exec(e);return s?s[1]?r(s[1]):o:!1},Pr=e=>e==="position"||e==="percentage",Tr=e=>e==="image"||e==="url",Er=e=>e==="length"||e==="size"||e==="bg-size",Rr=e=>e==="length",Xo=e=>e==="number",Fr=e=>e==="family-name",Or=e=>e==="number"||e==="weight",Mr=e=>e==="shadow",Jo=()=>{const e=oe("color"),r=oe("font"),o=oe("text"),s=oe("font-weight"),n=oe("tracking"),a=oe("leading"),c=oe("breakpoint"),i=oe("container"),f=oe("spacing"),d=oe("radius"),y=oe("shadow"),j=oe("inset-shadow"),F=oe("text-shadow"),A=oe("drop-shadow"),z=oe("blur"),M=oe("perspective"),C=oe("aspect"),G=oe("ease"),ne=oe("animate"),X=()=>["auto","avoid","all","avoid-page","page","left","right","column"],Y=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],P=()=>[...Y(),x,b],L=()=>["auto","hidden","clip","visible","scroll"],J=()=>["auto","contain","none"],u=()=>[x,b,f],U=()=>[Ye,"full","auto",...u()],Z=()=>[Xe,"none","subgrid",x,b],K=()=>["auto",{span:["full",Xe,x,b]},Xe,x,b],ve=()=>[Xe,"auto",x,b],we=()=>["auto","min","max","fr",x,b],ue=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],te=()=>["start","end","center","stretch","center-safe","end-safe"],re=()=>["auto",...u()],je=()=>[Ye,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...u()],Ae=()=>[Ye,"screen","full","dvw","lvw","svw","min","max","fit",...u()],Ne=()=>[Ye,"screen","full","lh","dvh","lvh","svh","min","max","fit",...u()],v=()=>[e,x,b],Be=()=>[...Y(),hr,pr,{position:[x,b]}],Ee=()=>["no-repeat",{repeat:["","x","y","space","round"]}],Re=()=>["auto","cover","contain",Go,Lo,{size:[x,b]}],Fe=()=>[Ut,ht,Ze],H=()=>["","none","full",d,x,b],Q=()=>["",R,ht,Ze],ke=()=>["solid","dashed","dotted","double"],fe=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],B=()=>[R,Ut,hr,pr],Oe=()=>["","none",z,x,b],De=()=>["none",R,x,b],me=()=>["none",R,x,b],pe=()=>[R,x,b],Ie=()=>[Ye,"full",...u()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Ve],breakpoint:[Ve],color:[Ir],container:[Ve],"drop-shadow":[Ve],ease:["in","out","in-out"],font:[$o],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Ve],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Ve],shadow:[Ve],spacing:["px",R],text:[Ve],"text-shadow":[Ve],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Ye,b,x,C]}],container:["container"],columns:[{columns:[R,b,x,i]}],"break-after":[{"break-after":X()}],"break-before":[{"break-before":X()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],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"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:P()}],overflow:[{overflow:L()}],"overflow-x":[{"overflow-x":L()}],"overflow-y":[{"overflow-y":L()}],overscroll:[{overscroll:J()}],"overscroll-x":[{"overscroll-x":J()}],"overscroll-y":[{"overscroll-y":J()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:U()}],"inset-x":[{"inset-x":U()}],"inset-y":[{"inset-y":U()}],start:[{"inset-s":U(),start:U()}],end:[{"inset-e":U(),end:U()}],"inset-bs":[{"inset-bs":U()}],"inset-be":[{"inset-be":U()}],top:[{top:U()}],right:[{right:U()}],bottom:[{bottom:U()}],left:[{left:U()}],visibility:["visible","invisible","collapse"],z:[{z:[Xe,"auto",x,b]}],basis:[{basis:[Ye,"full","auto",i,...u()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[R,Ye,"auto","initial","none",b]}],grow:[{grow:["",R,x,b]}],shrink:[{shrink:["",R,x,b]}],order:[{order:[Xe,"first","last","none",x,b]}],"grid-cols":[{"grid-cols":Z()}],"col-start-end":[{col:K()}],"col-start":[{"col-start":ve()}],"col-end":[{"col-end":ve()}],"grid-rows":[{"grid-rows":Z()}],"row-start-end":[{row:K()}],"row-start":[{"row-start":ve()}],"row-end":[{"row-end":ve()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":we()}],"auto-rows":[{"auto-rows":we()}],gap:[{gap:u()}],"gap-x":[{"gap-x":u()}],"gap-y":[{"gap-y":u()}],"justify-content":[{justify:[...ue(),"normal"]}],"justify-items":[{"justify-items":[...te(),"normal"]}],"justify-self":[{"justify-self":["auto",...te()]}],"align-content":[{content:["normal",...ue()]}],"align-items":[{items:[...te(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...te(),{baseline:["","last"]}]}],"place-content":[{"place-content":ue()}],"place-items":[{"place-items":[...te(),"baseline"]}],"place-self":[{"place-self":["auto",...te()]}],p:[{p:u()}],px:[{px:u()}],py:[{py:u()}],ps:[{ps:u()}],pe:[{pe:u()}],pbs:[{pbs:u()}],pbe:[{pbe:u()}],pt:[{pt:u()}],pr:[{pr:u()}],pb:[{pb:u()}],pl:[{pl:u()}],m:[{m:re()}],mx:[{mx:re()}],my:[{my:re()}],ms:[{ms:re()}],me:[{me:re()}],mbs:[{mbs:re()}],mbe:[{mbe:re()}],mt:[{mt:re()}],mr:[{mr:re()}],mb:[{mb:re()}],ml:[{ml:re()}],"space-x":[{"space-x":u()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":u()}],"space-y-reverse":["space-y-reverse"],size:[{size:je()}],"inline-size":[{inline:["auto",...Ae()]}],"min-inline-size":[{"min-inline":["auto",...Ae()]}],"max-inline-size":[{"max-inline":["none",...Ae()]}],"block-size":[{block:["auto",...Ne()]}],"min-block-size":[{"min-block":["auto",...Ne()]}],"max-block-size":[{"max-block":["none",...Ne()]}],w:[{w:[i,"screen",...je()]}],"min-w":[{"min-w":[i,"screen","none",...je()]}],"max-w":[{"max-w":[i,"screen","none","prose",{screen:[c]},...je()]}],h:[{h:["screen","lh",...je()]}],"min-h":[{"min-h":["screen","lh","none",...je()]}],"max-h":[{"max-h":["screen","lh",...je()]}],"font-size":[{text:["base",o,ht,Ze]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[s,Yo,Bo]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Ut,b]}],"font-family":[{font:[qo,Vo,r]}],"font-features":[{"font-features":[b]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[n,x,b]}],"line-clamp":[{"line-clamp":[R,"none",x,mr]}],leading:[{leading:[a,...u()]}],"list-image":[{"list-image":["none",x,b]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",x,b]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:v()}],"text-color":[{text:v()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ke(),"wavy"]}],"text-decoration-thickness":[{decoration:[R,"from-font","auto",x,Ze]}],"text-decoration-color":[{decoration:v()}],"underline-offset":[{"underline-offset":[R,"auto",x,b]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:u()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",x,b]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",x,b]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:Be()}],"bg-repeat":[{bg:Ee()}],"bg-size":[{bg:Re()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Xe,x,b],radial:["",x,b],conic:[Xe,x,b]},Ho,Wo]}],"bg-color":[{bg:v()}],"gradient-from-pos":[{from:Fe()}],"gradient-via-pos":[{via:Fe()}],"gradient-to-pos":[{to:Fe()}],"gradient-from":[{from:v()}],"gradient-via":[{via:v()}],"gradient-to":[{to:v()}],rounded:[{rounded:H()}],"rounded-s":[{"rounded-s":H()}],"rounded-e":[{"rounded-e":H()}],"rounded-t":[{"rounded-t":H()}],"rounded-r":[{"rounded-r":H()}],"rounded-b":[{"rounded-b":H()}],"rounded-l":[{"rounded-l":H()}],"rounded-ss":[{"rounded-ss":H()}],"rounded-se":[{"rounded-se":H()}],"rounded-ee":[{"rounded-ee":H()}],"rounded-es":[{"rounded-es":H()}],"rounded-tl":[{"rounded-tl":H()}],"rounded-tr":[{"rounded-tr":H()}],"rounded-br":[{"rounded-br":H()}],"rounded-bl":[{"rounded-bl":H()}],"border-w":[{border:Q()}],"border-w-x":[{"border-x":Q()}],"border-w-y":[{"border-y":Q()}],"border-w-s":[{"border-s":Q()}],"border-w-e":[{"border-e":Q()}],"border-w-bs":[{"border-bs":Q()}],"border-w-be":[{"border-be":Q()}],"border-w-t":[{"border-t":Q()}],"border-w-r":[{"border-r":Q()}],"border-w-b":[{"border-b":Q()}],"border-w-l":[{"border-l":Q()}],"divide-x":[{"divide-x":Q()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":Q()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...ke(),"hidden","none"]}],"divide-style":[{divide:[...ke(),"hidden","none"]}],"border-color":[{border:v()}],"border-color-x":[{"border-x":v()}],"border-color-y":[{"border-y":v()}],"border-color-s":[{"border-s":v()}],"border-color-e":[{"border-e":v()}],"border-color-bs":[{"border-bs":v()}],"border-color-be":[{"border-be":v()}],"border-color-t":[{"border-t":v()}],"border-color-r":[{"border-r":v()}],"border-color-b":[{"border-b":v()}],"border-color-l":[{"border-l":v()}],"divide-color":[{divide:v()}],"outline-style":[{outline:[...ke(),"none","hidden"]}],"outline-offset":[{"outline-offset":[R,x,b]}],"outline-w":[{outline:["",R,ht,Ze]}],"outline-color":[{outline:v()}],shadow:[{shadow:["","none",y,xt,bt]}],"shadow-color":[{shadow:v()}],"inset-shadow":[{"inset-shadow":["none",j,xt,bt]}],"inset-shadow-color":[{"inset-shadow":v()}],"ring-w":[{ring:Q()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:v()}],"ring-offset-w":[{"ring-offset":[R,Ze]}],"ring-offset-color":[{"ring-offset":v()}],"inset-ring-w":[{"inset-ring":Q()}],"inset-ring-color":[{"inset-ring":v()}],"text-shadow":[{"text-shadow":["none",F,xt,bt]}],"text-shadow-color":[{"text-shadow":v()}],opacity:[{opacity:[R,x,b]}],"mix-blend":[{"mix-blend":[...fe(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":fe()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[R]}],"mask-image-linear-from-pos":[{"mask-linear-from":B()}],"mask-image-linear-to-pos":[{"mask-linear-to":B()}],"mask-image-linear-from-color":[{"mask-linear-from":v()}],"mask-image-linear-to-color":[{"mask-linear-to":v()}],"mask-image-t-from-pos":[{"mask-t-from":B()}],"mask-image-t-to-pos":[{"mask-t-to":B()}],"mask-image-t-from-color":[{"mask-t-from":v()}],"mask-image-t-to-color":[{"mask-t-to":v()}],"mask-image-r-from-pos":[{"mask-r-from":B()}],"mask-image-r-to-pos":[{"mask-r-to":B()}],"mask-image-r-from-color":[{"mask-r-from":v()}],"mask-image-r-to-color":[{"mask-r-to":v()}],"mask-image-b-from-pos":[{"mask-b-from":B()}],"mask-image-b-to-pos":[{"mask-b-to":B()}],"mask-image-b-from-color":[{"mask-b-from":v()}],"mask-image-b-to-color":[{"mask-b-to":v()}],"mask-image-l-from-pos":[{"mask-l-from":B()}],"mask-image-l-to-pos":[{"mask-l-to":B()}],"mask-image-l-from-color":[{"mask-l-from":v()}],"mask-image-l-to-color":[{"mask-l-to":v()}],"mask-image-x-from-pos":[{"mask-x-from":B()}],"mask-image-x-to-pos":[{"mask-x-to":B()}],"mask-image-x-from-color":[{"mask-x-from":v()}],"mask-image-x-to-color":[{"mask-x-to":v()}],"mask-image-y-from-pos":[{"mask-y-from":B()}],"mask-image-y-to-pos":[{"mask-y-to":B()}],"mask-image-y-from-color":[{"mask-y-from":v()}],"mask-image-y-to-color":[{"mask-y-to":v()}],"mask-image-radial":[{"mask-radial":[x,b]}],"mask-image-radial-from-pos":[{"mask-radial-from":B()}],"mask-image-radial-to-pos":[{"mask-radial-to":B()}],"mask-image-radial-from-color":[{"mask-radial-from":v()}],"mask-image-radial-to-color":[{"mask-radial-to":v()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":Y()}],"mask-image-conic-pos":[{"mask-conic":[R]}],"mask-image-conic-from-pos":[{"mask-conic-from":B()}],"mask-image-conic-to-pos":[{"mask-conic-to":B()}],"mask-image-conic-from-color":[{"mask-conic-from":v()}],"mask-image-conic-to-color":[{"mask-conic-to":v()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:Be()}],"mask-repeat":[{mask:Ee()}],"mask-size":[{mask:Re()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",x,b]}],filter:[{filter:["","none",x,b]}],blur:[{blur:Oe()}],brightness:[{brightness:[R,x,b]}],contrast:[{contrast:[R,x,b]}],"drop-shadow":[{"drop-shadow":["","none",A,xt,bt]}],"drop-shadow-color":[{"drop-shadow":v()}],grayscale:[{grayscale:["",R,x,b]}],"hue-rotate":[{"hue-rotate":[R,x,b]}],invert:[{invert:["",R,x,b]}],saturate:[{saturate:[R,x,b]}],sepia:[{sepia:["",R,x,b]}],"backdrop-filter":[{"backdrop-filter":["","none",x,b]}],"backdrop-blur":[{"backdrop-blur":Oe()}],"backdrop-brightness":[{"backdrop-brightness":[R,x,b]}],"backdrop-contrast":[{"backdrop-contrast":[R,x,b]}],"backdrop-grayscale":[{"backdrop-grayscale":["",R,x,b]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[R,x,b]}],"backdrop-invert":[{"backdrop-invert":["",R,x,b]}],"backdrop-opacity":[{"backdrop-opacity":[R,x,b]}],"backdrop-saturate":[{"backdrop-saturate":[R,x,b]}],"backdrop-sepia":[{"backdrop-sepia":["",R,x,b]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":u()}],"border-spacing-x":[{"border-spacing-x":u()}],"border-spacing-y":[{"border-spacing-y":u()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",x,b]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[R,"initial",x,b]}],ease:[{ease:["linear","initial",G,x,b]}],delay:[{delay:[R,x,b]}],animate:[{animate:["none",ne,x,b]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[M,x,b]}],"perspective-origin":[{"perspective-origin":P()}],rotate:[{rotate:De()}],"rotate-x":[{"rotate-x":De()}],"rotate-y":[{"rotate-y":De()}],"rotate-z":[{"rotate-z":De()}],scale:[{scale:me()}],"scale-x":[{"scale-x":me()}],"scale-y":[{"scale-y":me()}],"scale-z":[{"scale-z":me()}],"scale-3d":["scale-3d"],skew:[{skew:pe()}],"skew-x":[{"skew-x":pe()}],"skew-y":[{"skew-y":pe()}],transform:[{transform:[x,b,"","none","gpu","cpu"]}],"transform-origin":[{origin:P()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Ie()}],"translate-x":[{"translate-x":Ie()}],"translate-y":[{"translate-y":Ie()}],"translate-z":[{"translate-z":Ie()}],"translate-none":["translate-none"],accent:[{accent:v()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:v()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{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",x,b]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":u()}],"scroll-mx":[{"scroll-mx":u()}],"scroll-my":[{"scroll-my":u()}],"scroll-ms":[{"scroll-ms":u()}],"scroll-me":[{"scroll-me":u()}],"scroll-mbs":[{"scroll-mbs":u()}],"scroll-mbe":[{"scroll-mbe":u()}],"scroll-mt":[{"scroll-mt":u()}],"scroll-mr":[{"scroll-mr":u()}],"scroll-mb":[{"scroll-mb":u()}],"scroll-ml":[{"scroll-ml":u()}],"scroll-p":[{"scroll-p":u()}],"scroll-px":[{"scroll-px":u()}],"scroll-py":[{"scroll-py":u()}],"scroll-ps":[{"scroll-ps":u()}],"scroll-pe":[{"scroll-pe":u()}],"scroll-pbs":[{"scroll-pbs":u()}],"scroll-pbe":[{"scroll-pbe":u()}],"scroll-pt":[{"scroll-pt":u()}],"scroll-pr":[{"scroll-pr":u()}],"scroll-pb":[{"scroll-pb":u()}],"scroll-pl":[{"scroll-pl":u()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",x,b]}],fill:[{fill:["none",...v()]}],"stroke-w":[{stroke:[R,ht,Ze,mr]}],stroke:[{stroke:["none",...v()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],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"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},Ko=Do(Jo);function $(...e){return Ko(Nr(e))}function gr(e){if(!e)return"Never";const r=new Date(e),s=new Date().getTime()-r.getTime(),n=Math.floor(s/6e4),a=Math.floor(s/36e5),c=Math.floor(s/864e5);return n<1?"Just now":n<60?`${n} minute${n>1?"s":""} ago`:a<24?`${a} hour${a>1?"s":""} ago`:c<7?`${c} day${c>1?"s":""} ago`:r.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}const Qt=kt("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",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline",factorcloud:"bg-factorcloud-primary text-factorcloud-primary-foreground hover:bg-factorcloud-primary/90",success:"bg-factorcloud-success text-factorcloud-success-foreground hover:bg-factorcloud-success/90",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"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10",tab:"h-12 px-6 rounded-t-lg"}},defaultVariants:{variant:"default",size:"default"}}),q=W.forwardRef(({className:e,variant:r,size:o,asChild:s=!1,...n},a)=>{const c=s?to.Slot:"button";return t.jsx(c,{className:$(Qt({variant:r,size:o,className:e})),ref:a,...n})});q.displayName="Button";const Qo=1,Zo=1e6;let zt=0;function es(){return zt=(zt+1)%Number.MAX_SAFE_INTEGER,zt.toString()}const $t=new Map,br=e=>{if($t.has(e))return;const r=setTimeout(()=>{$t.delete(e),gt({type:"REMOVE_TOAST",toastId:e})},Zo);$t.set(e,r)},ts=(e,r)=>{switch(r.type){case"ADD_TOAST":return{...e,toasts:[r.toast,...e.toasts].slice(0,Qo)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(o=>o.id===r.toast.id?{...o,...r.toast}:o)};case"DISMISS_TOAST":{const{toastId:o}=r;return o?br(o):e.toasts.forEach(s=>{br(s.id)}),{...e,toasts:e.toasts.map(s=>s.id===o||o===void 0?{...s,open:!1}:s)}}case"REMOVE_TOAST":return r.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(o=>o.id!==r.toastId)}}},yt=[];let vt={toasts:[]};function gt(e){vt=ts(vt,e),yt.forEach(r=>{r(vt)})}function rs({...e}){const r=es(),o=n=>gt({type:"UPDATE_TOAST",toast:{...n,id:r}}),s=()=>gt({type:"DISMISS_TOAST",toastId:r});return gt({type:"ADD_TOAST",toast:{...e,id:r,open:!0,onOpenChange:n=>{n||s()}}}),{id:r,dismiss:s,update:o}}function Ur(){const[e,r]=W.useState(vt);return W.useEffect(()=>(yt.push(r),()=>{const o=yt.indexOf(r);o>-1&&yt.splice(o,1)}),[e]),{...e,toast:rs,dismiss:o=>gt({type:"DISMISS_TOAST",toastId:o})}}const os=e=>{if(e)return e.toLowerCase().includes("sandbox")?"sandbox":"production"},rt=e=>e?!!(e.portalduct?.bearer_token&&e.portalduct?.env_url&&e.portalduct?.customer_id&&e.factorcloud?.bearer_token&&e.factorcloud?.factorId&&e.factorcloud?.env_url):!1,zr=(e,r)=>{if(!e?.factorcloud?.factorId)return null;const o=r.portalduct?.api_url??e.portalduct?.env_url??"",s=e.portalduct?.environment??os(o);return{portalduct:{bearer_token:r.portalduct?.bearer_token??e.portalduct?.bearer_token??"",env_url:o,customer_id:r.customer?.portalduct_customer_uuid??e.portalduct?.customer_id??"",webhook_bearer_token:e.portalduct?.webhook_bearer_token,environment:s,sync_webhook_url:e.portalduct?.sync_webhook_url,verify_webhook_url:e.portalduct?.verify_webhook_url},factorcloud:{bearer_token:r.factorcloud?.bearer_token??e.factorcloud?.bearer_token??"",factorId:e.factorcloud.factorId,env_url:r.factorcloud?.api_url??e.factorcloud?.env_url??"",client_id:e.factorcloud?.client_id}}};class $r{constructor(r,o,s){this.baseUrl=r,this.factorId=o,this.token=s}async getClients(r=100,o=0){if(!this.token)throw new Error("No bearer token provided.");const s=await fetch(`${this.baseUrl}/companies?active=true&type=client`,{method:"GET",headers:{Authorization:`Bearer ${this.token}`,"X-PAGINATION-LIMIT":r.toString(),"X-PAGINATION-NUM":o.toString(),accept:"application/json",factorId:this.factorId}});if(!s.ok)throw new Error(`Failed to fetch clients: ${s.statusText}`);return(await s.json()).companies}async getClientById(r){if(!this.token)throw new Error("No bearer token provided.");const o=await fetch(`${this.baseUrl}/clients/${r}`,{method:"GET",headers:{Authorization:`Bearer ${this.token}`,accept:"application/json",factorId:this.factorId}});if(!o.ok)throw new Error(`Failed to fetch client details: ${o.statusText}`);return(await o.json()).client}async getDebtors(r,o=100,s=0){if(!this.token)throw new Error("No bearer token provided.");const n=await fetch(`${this.baseUrl}/clients/${r}/debtors`,{method:"GET",headers:{Authorization:`Bearer ${this.token}`,"X-PAGINATION-LIMIT":o.toString(),"X-PAGINATION-NUM":s.toString(),accept:"application/json",factorId:this.factorId}});if(!n.ok)throw new Error(`Failed to fetch debtors: ${n.statusText}`);return(await n.json()).clientDebtors}setToken(r){this.token=r}getToken(){return this.token}}class le extends Error{constructor({message:r,status:o,code:s,type:n,requestId:a}){super(r),this.name="PortalDuctAPIError",this.status=o,this.code=s,this.type=n,this.requestId=a}}class Lr{constructor(r,o){this.baseUrl=r,this.token=o}async buildError(r,o){let s=o,n,a,c;try{const i=await r.json();i&&typeof i=="object"&&(s=("error_message"in i&&typeof i.error_message=="string"?i.error_message:void 0)??("message"in i&&typeof i.message=="string"?i.message:void 0)??s,n=("error_code"in i&&typeof i.error_code=="string"?i.error_code:void 0)??("code"in i&&typeof i.code=="string"?i.code:void 0)??n,a=("error_type"in i&&typeof i.error_type=="string"?i.error_type:void 0)??("type"in i&&typeof i.type=="string"?i.type:void 0)??a,c=("request_id"in i&&typeof i.request_id=="string"?i.request_id:void 0)??("requestId"in i&&typeof i.requestId=="string"?i.requestId:void 0)??c)}catch(i){console.debug("Failed to parse PortalDuct error response",i)}return new le({message:s,status:r.status,code:n,type:a,requestId:c})}async getCompanies(r){if(!this.token)throw new Error("No bearer token provided.");const o=encodeURIComponent(`customer_id eq ${r}`),s=await fetch(`${this.baseUrl}/v2/companies?filter=${o}`,{method:"GET",headers:{accept:"application/json",authorization:`Bearer ${this.token}`}});if(!s.ok)throw await this.buildError(s,"Failed to fetch companies");return(await s.json()).data}async createCompany(r){if(!this.token)throw new Error("No bearer token provided.");const o=await fetch(`${this.baseUrl}/v2/companies`,{method:"POST",headers:{accept:"application/json",authorization:`Bearer ${this.token}`,"content-type":"application/json"},body:JSON.stringify(r)});if(!o.ok)throw await this.buildError(o,"Failed to create company");return(await o.json()).data}async getConnections(r){if(!this.token)throw new Error("No bearer token provided.");const o=encodeURIComponent(`company.company_id eq '${r}'`),s=await fetch(`${this.baseUrl}/v2/connections?filter=${o}`,{method:"GET",headers:{accept:"application/json",authorization:`Bearer ${this.token}`}});if(!s.ok)throw await this.buildError(s,"Failed to fetch connections");return(await s.json()).data}async createConnection(r){if(!this.token)throw new Error("No bearer token provided.");const o=await fetch(`${this.baseUrl}/v2/connections`,{method:"POST",headers:{accept:"application/json",authorization:`Bearer ${this.token}`,"content-type":"application/json"},body:JSON.stringify(r)});if(!o.ok)throw await this.buildError(o,"Failed to create connection");return(await o.json()).data}async updateConnection(r,o){if(!this.token)throw new Error("No bearer token provided.");const s=await fetch(`${this.baseUrl}/v2/connections/${r}`,{method:"PATCH",headers:{accept:"application/json",authorization:`Bearer ${this.token}`,"content-type":"application/json"},body:JSON.stringify(o)});if(!s.ok)throw await this.buildError(s,"Failed to update connection");return(await s.json()).data}async activateConnection(r){return this.updateActivationStatus(r,"activate")}async deactivateConnection(r){return this.updateActivationStatus(r,"deactivate")}async updateActivationStatus(r,o){if(!this.token)throw new Error("No bearer token provided.");const s={activation_status:o},n=await fetch(`${this.baseUrl}/v2/connections/${r}/activation`,{method:"POST",headers:{accept:"application/json",authorization:`Bearer ${this.token}`,"content-type":"application/json"},body:JSON.stringify(s)});if(!n.ok)throw await this.buildError(n,`Failed to ${o} connection`);return(await n.json()).data}setToken(r){this.token=r}getToken(){return this.token}async getPortalMappings(){if(!this.token)throw new Error("No bearer token provided.");const r=await fetch(`${this.baseUrl}/v2/portal_mappings`,{method:"GET",headers:{accept:"application/json",authorization:`Bearer ${this.token}`}});if(!r.ok)throw await this.buildError(r,"Failed to fetch portal mappings");return(await r.json()).data}async createPortalMapping(r){if(!this.token)throw new Error("No bearer token provided.");const o=await fetch(`${this.baseUrl}/v2/portal_mappings`,{method:"POST",headers:{accept:"application/json",authorization:`Bearer ${this.token}`,"content-type":"application/json"},body:JSON.stringify(r)});if(!o.ok)throw await this.buildError(o,"Failed to create portal mapping");return(await o.json()).data}}const ss="https://khzfuhxnbjlyjvdvxdeg.supabase.co/functions/v1/webhook-sync-connection",ns="https://khzfuhxnbjlyjvdvxdeg.supabase.co/functions/v1/webhook-verify-connection",as="https://khzfuhxnbjlyjvdvxdeg.supabase.co/functions/v1/check-customer-status";class Zt{constructor({webhookToken:r,customerId:o,webhookUrl:s=ss,verifyWebhookUrl:n=ns,environment:a,portalductBaseUrl:c,customerStatusUrl:i=as}){this.syncWebhookUrl=s,this.verifyWebhookUrl=n,this.webhookToken=r,this.customerId=o,this.environment=a??this.deriveEnvironmentFromBaseUrl(c),this.customerStatusUrl=i}setWebhookToken(r){this.webhookToken=r}setCustomerId(r){this.customerId=r}setEnvironment(r){this.environment=r}setWebhookUrl(r){this.syncWebhookUrl=r}setVerifyWebhookUrl(r){this.verifyWebhookUrl=r}setCustomerStatusUrl(r){this.customerStatusUrl=r}async triggerConnectionSync(r){return this.callWebhook(this.syncWebhookUrl,r,"Resync")}async triggerConnectionVerification(r){return this.callWebhook(this.verifyWebhookUrl,r,"Verification")}async callWebhook(r,o,s){if(!this.customerId)throw new Error(`No PortalDuct customer ID provided for ${s.toLowerCase()} webhook.`);if(!this.webhookToken)throw new Error(`No webhook bearer token provided for ${s.toLowerCase()} webhook.`);const n=await fetch(r,{method:"POST",headers:{accept:"application/json",authorization:`Bearer ${this.webhookToken}`,"content-type":"application/json"},body:JSON.stringify({portalductCustomerId:this.customerId,connectionId:o,environment:this.environment})});if(!n.ok){const c=await n.text();throw new Error(`${s} failed: ${n.status} ${c}`)}return await n.json()}deriveEnvironmentFromBaseUrl(r){return r&&r.toLowerCase().includes("sandbox")?"sandbox":"production"}async fetchCustomerStatus(r){if(!this.webhookToken)throw new Error("No webhook bearer token provided for customer status webhook.");const o=await fetch(this.customerStatusUrl,{method:"POST",headers:{accept:"application/json",authorization:`Bearer ${this.webhookToken}`,"content-type":"application/json"},body:JSON.stringify({factorId:r,environment:this.environment})});if(!o.ok){const n=await o.text();throw new Error(`Customer status check failed: ${o.status} ${n}`)}const s=await o.json();if(typeof s.active!="boolean")throw new Error("Customer status webhook returned an invalid response.");return s}async isCustomerActive(r){return(await this.fetchCustomerStatus(r)).active}}class er{constructor(r){this.config=r,this.factorcloudAPI=new $r(r.factorcloud.env_url,r.factorcloud.factorId,r.factorcloud.bearer_token),this.portalductAPI=new Lr(r.portalduct.env_url,r.portalduct.bearer_token),this.connectionSyncAPI=new Zt({webhookToken:r.portalduct.webhook_bearer_token,customerId:r.portalduct.customer_id,environment:r.portalduct.environment,webhookUrl:r.portalduct.sync_webhook_url,verifyWebhookUrl:r.portalduct.verify_webhook_url,portalductBaseUrl:r.portalduct.env_url})}async getFactorCloudClients(){return this.factorcloudAPI.getClients()}async getFactorCloudClient(r){if(r)return await this.factorcloudAPI.getClientById(r);const o=await this.factorcloudAPI.getClients();if(o.length===0)throw new Error("No FactorCloud clients found");return o[0]}async ensurePortalDuctCompany(r){const s=(await this.portalductAPI.getCompanies(this.config.portalduct.customer_id)).find(c=>c.tags.factorcloud_id===r.id);if(s)return s;const n=await this.factorcloudAPI.getClientById(r.id);return await this.portalductAPI.createCompany({name:n.companyName,email:n.email,customer_id:this.config.portalduct.customer_id,tags:{factorcloud_id:n.id}})}async fetchMergedDebtors(r,o){const[s,n]=await Promise.all([this.factorcloudAPI.getDebtors(r),this.portalductAPI.getConnections(o)]);return this.matchConnectionsToDebtors(s,n)}matchConnectionsToDebtors(r,o){return r.map(s=>{const n=o.find(c=>c.tags.factorcloud_debtor_id===s.companyDebtorId);let a="not_connected";return n&&(n.activation_status==="deactivated"?a="deactivated":n.activation_status==="pending"?a="pending":a="connected"),{factorcloudDebtorId:s.companyDebtorId,factorcloudClientId:s.companyClientId,debtorName:s.companyDebtorName,creditLimit:s.creditLimit,termName:s.termName,connection:n,status:a,portalName:n?.portal_name||void 0,lastSync:n?.last_sync||void 0,autoSyncEnabled:n?.auto_sync_status==="enabled",lastSyncSummary:void 0}})}getFactorCloudAPI(){return this.factorcloudAPI}getPortalDuctAPI(){return this.portalductAPI}getConnectionSyncAPI(){return this.connectionSyncAPI}async isCustomerActive(){return this.connectionSyncAPI.isCustomerActive(this.config.factorcloud.factorId)}async triggerConnectionSync(r){return this.connectionSyncAPI.triggerConnectionSync(r)}async triggerConnectionVerification(r){return this.connectionSyncAPI.triggerConnectionVerification(r)}}const it=ze.Root,is=ze.Portal,Br=W.forwardRef(({className:e,...r},o)=>t.jsx(ze.Overlay,{ref:o,className:$("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",e),...r}));Br.displayName=ze.Overlay.displayName;const Ke=W.forwardRef(({className:e,children:r,...o},s)=>t.jsxs(is,{children:[t.jsx(Br,{}),t.jsxs(ze.Content,{ref:s,className:$("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",e),...o,children:[r,t.jsxs(ze.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",children:[t.jsx(O.X,{className:"h-4 w-4"}),t.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Ke.displayName=ze.Content.displayName;const We=({className:e,...r})=>t.jsx("div",{className:$("flex flex-col space-y-1.5 text-center sm:text-left",e),...r});We.displayName="DialogHeader";const Vr=({className:e,...r})=>t.jsx("div",{className:$("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...r});Vr.displayName="DialogFooter";const qe=W.forwardRef(({className:e,...r},o)=>t.jsx(ze.Title,{ref:o,className:$("text-lg font-semibold leading-none tracking-tight",e),...r}));qe.displayName=ze.Title.displayName;const Ge=W.forwardRef(({className:e,...r},o)=>t.jsx(ze.Description,{ref:o,className:$("text-sm text-muted-foreground",e),...r}));Ge.displayName=ze.Description.displayName;var de=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof global<"u"&&global||{},xe={searchParams:"URLSearchParams"in de,iterable:"Symbol"in de&&"iterator"in Symbol,blob:"FileReader"in de&&"Blob"in de&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in de,arrayBuffer:"ArrayBuffer"in de};function cs(e){return e&&DataView.prototype.isPrototypeOf(e)}if(xe.arrayBuffer)var ls=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],ds=ArrayBuffer.isView||function(e){return e&&ls.indexOf(Object.prototype.toString.call(e))>-1};function ft(e){if(typeof e!="string"&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(e)||e==="")throw new TypeError('Invalid character in header field name: "'+e+'"');return e.toLowerCase()}function tr(e){return typeof e!="string"&&(e=String(e)),e}function rr(e){var r={next:function(){var o=e.shift();return{done:o===void 0,value:o}}};return xe.iterable&&(r[Symbol.iterator]=function(){return r}),r}function se(e){this.map={},e instanceof se?e.forEach(function(r,o){this.append(o,r)},this):Array.isArray(e)?e.forEach(function(r){if(r.length!=2)throw new TypeError("Headers constructor: expected name/value pair to be length 2, found"+r.length);this.append(r[0],r[1])},this):e&&Object.getOwnPropertyNames(e).forEach(function(r){this.append(r,e[r])},this)}se.prototype.append=function(e,r){e=ft(e),r=tr(r);var o=this.map[e];this.map[e]=o?o+", "+r:r};se.prototype.delete=function(e){delete this.map[ft(e)]};se.prototype.get=function(e){return e=ft(e),this.has(e)?this.map[e]:null};se.prototype.has=function(e){return this.map.hasOwnProperty(ft(e))};se.prototype.set=function(e,r){this.map[ft(e)]=tr(r)};se.prototype.forEach=function(e,r){for(var o in this.map)this.map.hasOwnProperty(o)&&e.call(r,this.map[o],o,this)};se.prototype.keys=function(){var e=[];return this.forEach(function(r,o){e.push(o)}),rr(e)};se.prototype.values=function(){var e=[];return this.forEach(function(r){e.push(r)}),rr(e)};se.prototype.entries=function(){var e=[];return this.forEach(function(r,o){e.push([o,r])}),rr(e)};xe.iterable&&(se.prototype[Symbol.iterator]=se.prototype.entries);function Lt(e){if(!e._noBody){if(e.bodyUsed)return Promise.reject(new TypeError("Already read"));e.bodyUsed=!0}}function Wr(e){return new Promise(function(r,o){e.onload=function(){r(e.result)},e.onerror=function(){o(e.error)}})}function us(e){var r=new FileReader,o=Wr(r);return r.readAsArrayBuffer(e),o}function fs(e){var r=new FileReader,o=Wr(r),s=/charset=([A-Za-z0-9_-]+)/.exec(e.type),n=s?s[1]:"utf-8";return r.readAsText(e,n),o}function ms(e){for(var r=new Uint8Array(e),o=new Array(r.length),s=0;s<r.length;s++)o[s]=String.fromCharCode(r[s]);return o.join("")}function xr(e){if(e.slice)return e.slice(0);var r=new Uint8Array(e.byteLength);return r.set(new Uint8Array(e)),r.buffer}function qr(){return this.bodyUsed=!1,this._initBody=function(e){this.bodyUsed=this.bodyUsed,this._bodyInit=e,e?typeof e=="string"?this._bodyText=e:xe.blob&&Blob.prototype.isPrototypeOf(e)?this._bodyBlob=e:xe.formData&&FormData.prototype.isPrototypeOf(e)?this._bodyFormData=e:xe.searchParams&&URLSearchParams.prototype.isPrototypeOf(e)?this._bodyText=e.toString():xe.arrayBuffer&&xe.blob&&cs(e)?(this._bodyArrayBuffer=xr(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):xe.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(e)||ds(e))?this._bodyArrayBuffer=xr(e):this._bodyText=e=Object.prototype.toString.call(e):(this._noBody=!0,this._bodyText=""),this.headers.get("content-type")||(typeof e=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):xe.searchParams&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},xe.blob&&(this.blob=function(){var e=Lt(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))}),this.arrayBuffer=function(){if(this._bodyArrayBuffer){var e=Lt(this);return e||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}else{if(xe.blob)return this.blob().then(us);throw new Error("could not read as ArrayBuffer")}},this.text=function(){var e=Lt(this);if(e)return e;if(this._bodyBlob)return fs(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(ms(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},xe.formData&&(this.formData=function(){return this.text().then(gs)}),this.json=function(){return this.text().then(JSON.parse)},this}var ps=["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"];function hs(e){var r=e.toUpperCase();return ps.indexOf(r)>-1?r:e}function ot(e,r){if(!(this instanceof ot))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');r=r||{};var o=r.body;if(e instanceof ot){if(e.bodyUsed)throw new TypeError("Already read");this.url=e.url,this.credentials=e.credentials,r.headers||(this.headers=new se(e.headers)),this.method=e.method,this.mode=e.mode,this.signal=e.signal,!o&&e._bodyInit!=null&&(o=e._bodyInit,e.bodyUsed=!0)}else this.url=String(e);if(this.credentials=r.credentials||this.credentials||"same-origin",(r.headers||!this.headers)&&(this.headers=new se(r.headers)),this.method=hs(r.method||this.method||"GET"),this.mode=r.mode||this.mode||null,this.signal=r.signal||this.signal||function(){if("AbortController"in de){var a=new AbortController;return a.signal}}(),this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&o)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(o),(this.method==="GET"||this.method==="HEAD")&&(r.cache==="no-store"||r.cache==="no-cache")){var s=/([?&])_=[^&]*/;if(s.test(this.url))this.url=this.url.replace(s,"$1_="+new Date().getTime());else{var n=/\?/;this.url+=(n.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}ot.prototype.clone=function(){return new ot(this,{body:this._bodyInit})};function gs(e){var r=new FormData;return e.trim().split("&").forEach(function(o){if(o){var s=o.split("="),n=s.shift().replace(/\+/g," "),a=s.join("=").replace(/\+/g," ");r.append(decodeURIComponent(n),decodeURIComponent(a))}}),r}function bs(e){var r=new se,o=e.replace(/\r?\n[\t ]+/g," ");return o.split("\r").map(function(s){return s.indexOf(`
3
- `)===0?s.substr(1,s.length):s}).forEach(function(s){var n=s.split(":"),a=n.shift().trim();if(a){var c=n.join(":").trim();try{r.append(a,c)}catch(i){console.warn("Response "+i.message)}}}),r}qr.call(ot.prototype);function Le(e,r){if(!(this instanceof Le))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');if(r||(r={}),this.type="default",this.status=r.status===void 0?200:r.status,this.status<200||this.status>599)throw new RangeError("Failed to construct 'Response': The status provided (0) is outside the range [200, 599].");this.ok=this.status>=200&&this.status<300,this.statusText=r.statusText===void 0?"":""+r.statusText,this.headers=new se(r.headers),this.url=r.url||"",this._initBody(e)}qr.call(Le.prototype);Le.prototype.clone=function(){return new Le(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new se(this.headers),url:this.url})};Le.error=function(){var e=new Le(null,{status:200,statusText:""});return e.ok=!1,e.status=0,e.type="error",e};var xs=[301,302,303,307,308];Le.redirect=function(e,r){if(xs.indexOf(r)===-1)throw new RangeError("Invalid status code");return new Le(null,{status:r,headers:{location:e}})};var et=de.DOMException;try{new et}catch{et=function(r,o){this.message=r,this.name=o;var s=Error(r);this.stack=s.stack},et.prototype=Object.create(Error.prototype),et.prototype.constructor=et}function Gr(e,r){return new Promise(function(o,s){var n=new ot(e,r);if(n.signal&&n.signal.aborted)return s(new et("Aborted","AbortError"));var a=new XMLHttpRequest;function c(){a.abort()}a.onload=function(){var d={statusText:a.statusText,headers:bs(a.getAllResponseHeaders()||"")};n.url.indexOf("file://")===0&&(a.status<200||a.status>599)?d.status=200:d.status=a.status,d.url="responseURL"in a?a.responseURL:d.headers.get("X-Request-URL");var y="response"in a?a.response:a.responseText;setTimeout(function(){o(new Le(y,d))},0)},a.onerror=function(){setTimeout(function(){s(new TypeError("Network request failed"))},0)},a.ontimeout=function(){setTimeout(function(){s(new TypeError("Network request timed out"))},0)},a.onabort=function(){setTimeout(function(){s(new et("Aborted","AbortError"))},0)};function i(d){try{return d===""&&de.location.href?de.location.href:d}catch{return d}}if(a.open(n.method,i(n.url),!0),n.credentials==="include"?a.withCredentials=!0:n.credentials==="omit"&&(a.withCredentials=!1),"responseType"in a&&(xe.blob?a.responseType="blob":xe.arrayBuffer&&(a.responseType="arraybuffer")),r&&typeof r.headers=="object"&&!(r.headers instanceof se||de.Headers&&r.headers instanceof de.Headers)){var f=[];Object.getOwnPropertyNames(r.headers).forEach(function(d){f.push(ft(d)),a.setRequestHeader(d,tr(r.headers[d]))}),n.headers.forEach(function(d,y){f.indexOf(y)===-1&&a.setRequestHeader(y,d)})}else n.headers.forEach(function(d,y){a.setRequestHeader(y,d)});n.signal&&(n.signal.addEventListener("abort",c),a.onreadystatechange=function(){a.readyState===4&&n.signal.removeEventListener("abort",c)}),a.send(typeof n._bodyInit>"u"?null:n._bodyInit)})}Gr.polyfill=!0;de.fetch||(de.fetch=Gr,de.Headers=se,de.Request=ot,de.Response=Le);var ys="https://submit-form.com",vs=function(r){var o=l.useState(!1),s=o[0],n=o[1],a=function(i){return new Promise(function(f,d){var y=ys+"/"+r.formId,j="POST",F={Accept:"application/json","Content-Type":"application/json"},A=JSON.stringify(i);n(!0),fetch(y,{method:j,headers:F,body:A}).then(function(z){return z.json()}).then(function(z){f(z)}).catch(function(z){d(z)}).finally(function(){n(!1)})})};return[a,s]};const ws="wXZIqo61i";function Hr({open:e,onOpenChange:r}){const[o,s]=vs({formId:ws}),[n,a]=l.useState(""),[c,i]=l.useState(""),[f,d]=l.useState(""),[y,j]=l.useState(!1),F=async A=>{A.preventDefault(),await o({name:n,email:c,company:f}),j(!0)};return t.jsx(it,{open:e,onOpenChange:r,children:t.jsxs(Ke,{className:"max-w-4xl p-0 overflow-hidden",children:[t.jsxs(We,{className:"sr-only",children:[t.jsx(qe,{children:"Register your interest"}),t.jsx(Ge,{children:"Submit your details for invoice syncing."})]}),t.jsxs("div",{className:"flex flex-col md:flex-row h-full",children:[t.jsxs("aside",{className:"w-full md:w-1/2 bg-black text-white p-8 flex flex-col justify-center space-y-10 relative overflow-hidden",children:[t.jsxs("div",{className:"space-y-3",children:[t.jsx("h2",{className:"text-3xl font-bold leading-snug tracking-tight",children:"Connect & Sync your Invoices"}),t.jsx("p",{className:"text-base text-white/90 leading-relaxed max-w-sm",children:"Connect your debtor portals once and we’ll sync your invoices automatically"})]}),t.jsx("ul",{className:"space-y-5 text-sm",children:["Connect once, stay synced forever. No more uploads.","Work smarter, not harder. Automate the boring stuff and focus on what moves the needle.","Always up to date. Every debtor portal, every invoice — perfectly in sync."].map((A,z)=>t.jsxs("li",{className:"flex items-start gap-3",children:[t.jsx(O.CheckCircle2,{className:"mt-0.5 h-5 w-5 text-emerald-300 flex-shrink-0"}),t.jsx("span",{className:"leading-relaxed",children:A})]},z))})]}),t.jsx("div",{className:"w-full md:w-1/2 p-8 bg-white",children:y?t.jsxs("div",{className:"text-center py-12",children:[t.jsx("h3",{className:"text-xl font-semibold mb-3",children:"Thank you!"}),t.jsx("p",{className:"text-gray-600",children:"We've received your interest. Our team will be in touch in the coming days."}),t.jsx(q,{className:"mt-6",onClick:()=>r(!1),children:"Close"})]}):t.jsxs(t.Fragment,{children:[t.jsx("h3",{className:"text-lg font-semibold mb-2",children:"Register your interest"}),t.jsxs("form",{onSubmit:F,className:"space-y-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"text-sm font-medium",children:"Name"}),t.jsx("input",{required:!0,type:"text",className:"w-full border p-2 rounded mt-1",value:n,onChange:A=>a(A.target.value)})]}),t.jsxs("div",{children:[t.jsx("label",{className:"text-sm font-medium",children:"Email"}),t.jsx("input",{required:!0,type:"email",className:"w-full border p-2 rounded mt-1",value:c,onChange:A=>i(A.target.value)})]}),t.jsxs("div",{children:[t.jsx("label",{className:"text-sm font-medium",children:"Company Name"}),t.jsx("input",{required:!0,type:"text",className:"w-full border p-2 rounded mt-1",value:f,onChange:A=>d(A.target.value)})]}),t.jsx(q,{type:"submit",className:"w-full",disabled:s,children:s?"Submitting…":"Register interest"})]})]})})]})]})})}const ae=W.forwardRef(({className:e,type:r,...o},s)=>t.jsx("input",{type:r,className:$("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",e),ref:s,...o}));ae.displayName="Input";const js=kt("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),ye=W.forwardRef(({className:e,...r},o)=>t.jsx(vr.Root,{ref:o,className:$(js(),e),...r}));ye.displayName=vr.Root.displayName;function or({open:e,onOpenChange:r,debtor:o,onUpdate:s,loading:n=!1}){const[a,c]=l.useState(""),[i,f]=l.useState(""),d=()=>{(a.trim()||i.trim())&&(s(a,i),c(""),f(""))};return t.jsx(it,{open:e,onOpenChange:r,children:t.jsxs(Ke,{children:[t.jsxs(We,{children:[t.jsx(qe,{children:"Update Portal Credentials"}),t.jsxs(Ge,{children:["Update the login credentials for ",o?.debtorName]})]}),t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx(ye,{htmlFor:"update-username",children:"Username"}),t.jsx(ae,{id:"update-username",type:"email",value:a,onChange:y=>c(y.target.value),placeholder:"Enter new username (leave empty to keep current)"})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(ye,{htmlFor:"update-password",children:"Password"}),t.jsx(ae,{id:"update-password",type:"password",value:i,onChange:y=>f(y.target.value),placeholder:"Enter new password (leave empty to keep current)"})]}),t.jsx("div",{className:"text-sm text-muted-foreground",children:"Leave fields empty to keep existing values. Only fields with values will be updated."})]}),t.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[t.jsx(q,{variant:"outline",onClick:()=>r(!1),disabled:n,children:"Cancel"}),t.jsx(q,{onClick:d,disabled:n||!a&&!i,children:n?"Updating...":"Update Credentials"})]})]})})}const yr=_e.Root,Ns=_e.Portal,Yr=W.forwardRef(({className:e,...r},o)=>t.jsx(_e.Overlay,{className:$("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",e),...r,ref:o}));Yr.displayName=_e.Overlay.displayName;const Vt=W.forwardRef(({className:e,...r},o)=>t.jsxs(Ns,{children:[t.jsx(Yr,{}),t.jsx(_e.Content,{ref:o,className:$("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",e),...r})]}));Vt.displayName=_e.Content.displayName;const Wt=({className:e,...r})=>t.jsx("div",{className:$("flex flex-col space-y-2 text-center sm:text-left",e),...r});Wt.displayName="AlertDialogHeader";const qt=({className:e,...r})=>t.jsx("div",{className:$("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...r});qt.displayName="AlertDialogFooter";const Gt=W.forwardRef(({className:e,...r},o)=>t.jsx(_e.Title,{ref:o,className:$("text-lg font-semibold",e),...r}));Gt.displayName=_e.Title.displayName;const Ht=W.forwardRef(({className:e,...r},o)=>t.jsx(_e.Description,{ref:o,className:$("text-sm text-muted-foreground",e),...r}));Ht.displayName=_e.Description.displayName;const Yt=W.forwardRef(({className:e,...r},o)=>t.jsx(_e.Action,{ref:o,className:$(Qt(),e),...r}));Yt.displayName=_e.Action.displayName;const ks=W.forwardRef(({className:e,...r},o)=>t.jsx(_e.Cancel,{ref:o,className:$(Qt({variant:"outline"}),"mt-2 sm:mt-0",e),...r}));ks.displayName=_e.Cancel.displayName;const Xt=nt.Root,jt=W.forwardRef(({className:e,...r},o)=>t.jsx(nt.List,{ref:o,className:$("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",e),...r}));jt.displayName=nt.List.displayName;const ce=W.forwardRef(({className:e,...r},o)=>t.jsx(nt.Trigger,{ref:o,className:$("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",e),...r}));ce.displayName=nt.Trigger.displayName;const Se=W.forwardRef(({className:e,...r},o)=>t.jsx(nt.Content,{ref:o,className:$("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...r}));Se.displayName=nt.Content.displayName;const Xr=W.forwardRef(({className:e,orientation:r="horizontal",decorative:o=!0,...s},n)=>t.jsx(wr.Root,{ref:n,decorative:o,orientation:r,className:$("shrink-0 bg-border",r==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",e),...s}));Xr.displayName=wr.Root.displayName;const Cs={idle:"Ready to sync","checking-config":"Checking configuration...",authenticating:"Authenticating with services...","loading-clients":"Loading clients...","selecting-client":"Choose which client to manage","selecting-debtor":"Connect debtor portals to sync invoices","loading-data":"Loading debtors...",review:"Review invoices",complete:"Sync complete!",error:"Sync failed"};function sr({open:e,onOpenChange:r,currentStep:o,error:s,clients:n=[],debtors:a=[],selectedDebtor:c=null,selectedClient:i=null,onSelectClient:f,onSelectDebtor:d,onConnectDebtor:y,onEditCredentials:j,onChangePortal:F,onToggleActivation:A,onSyncDebtor:z,onVerifyDebtor:M,togglingDebtorId:C,syncingDebtorId:G,verifyingDebtorId:ne,allowBackToClientSelection:X=!1,onBackToClientSelection:Y,activeTab:P,onActiveTabChange:L}){const J=["checking-config","authenticating","loading-clients","loading-data"].includes(o),u=o==="error",U=o==="complete",Z=o==="selecting-client",K=o==="selecting-debtor",ve=o==="review",[we,ue]=l.useState("not_connected"),te=P??we,re=L??ue,[je,Ae]=l.useState(!1),[Ne,v]=l.useState(null),[Be,Ee]=l.useState(!1),[Re,Fe]=l.useState(null),[H,Q]=l.useState(""),ke=l.useDeferredValue(H),fe=l.useMemo(()=>{const D=ke.trim().toLowerCase();return D?a.filter(N=>N.debtorName.toLowerCase().includes(D)):a},[a,ke]),B=l.useMemo(()=>({not_connected:fe.filter(D=>D.status==="not_connected"),pending:fe.filter(D=>D.status==="pending"),connected:fe.filter(D=>D.status==="connected"),deactivated:fe.filter(D=>D.status==="deactivated")}),[fe]),Oe={not_connected:B.not_connected.length,pending:B.pending.length,connected:B.connected.length,deactivated:B.deactivated.length},De=l.useCallback(D=>{y?.(D)},[y]),me=l.useCallback(D=>{v(D),Ae(!0)},[]),pe=l.useCallback(()=>{Ne&&(z?.(Ne),Ae(!1),v(null))},[Ne,z]),Ie=l.useCallback(D=>{Fe(D),Ee(!0)},[]),Me=l.useCallback(()=>{Re&&(M?.(Re),Ee(!1),Fe(null))},[Re,M]);return t.jsxs(it,{open:e,onOpenChange:r,children:[t.jsx(Ke,{className:"sm:max-w-5xl max-h-[90vh] overflow-hidden p-0",children:t.jsxs("div",{className:"flex h-full flex-col md:flex-row",children:[t.jsxs("aside",{className:"md:w-1/3 bg-black text-white p-8 flex flex-col justify-between relative overflow-hidden",children:[t.jsx("div",{className:"absolute inset-0 bg-[radial-gradient(circle_at_top_right,rgba(255,255,255,0.1),transparent_70%)] pointer-events-none"}),t.jsxs("div",{className:"space-y-8 relative z-10",children:[t.jsxs("div",{className:"space-y-3",children:[t.jsx("h2",{className:"text-3xl font-bold leading-snug tracking-tight",children:"Connect & Sync your Invoices"}),t.jsx("p",{className:"text-base text-white/90 leading-relaxed max-w-sm",children:"Connect your debtor portals once and we’ll sync your invoices automatically"})]}),t.jsx("ul",{className:"space-y-5 text-sm",children:["Connect once, stay synced forever. No more uploads.","Work smarter, not harder. Automate the boring stuff and focus on what moves the needle.","Always up to date. Every debtor portal, every invoice — perfectly in sync."].map((D,N)=>t.jsxs("li",{className:"flex items-start gap-3",children:[t.jsx(O.CheckCircle2,{className:"mt-0.5 h-5 w-5 text-emerald-300 flex-shrink-0"}),t.jsx("span",{className:"leading-relaxed",children:D})]},N))})]}),t.jsxs("div",{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",children:[t.jsx("p",{className:"font-semibold text-white",children:"Need help connecting your portals?"}),t.jsx("p",{className:"mt-1",children:"Our support team can guide you through setup — or do it for you."})]})]}),t.jsx("div",{className:"flex-1 md:w-2/3",children:t.jsxs("div",{className:"flex h-full flex-col",children:[t.jsxs("div",{className:"p-6 pb-4",children:[t.jsxs(We,{className:"text-left",children:[t.jsx(qe,{children:K&&i?`Connect Debtor Portals for ${i.companyName}`:"Connect Debtor Portals to Sync Invoices"}),t.jsx(Ge,{children:u?"An error occurred during sync":K&&i?"Connect debtor portals to automatically sync invoices":"Connect debtor portals to automatically sync invoices and save time"})]}),!K&&t.jsx(Xr,{className:"mt-4"})]}),t.jsxs("div",{className:"flex-1 overflow-y-auto px-6 pb-6",children:[(J||U||u)&&t.jsxs("div",{className:"flex items-center gap-3",children:[J&&t.jsx(O.Loader2,{className:"w-5 h-5 animate-spin text-primary"}),U&&t.jsx(O.CheckCircle2,{className:"w-5 h-5 text-primary"}),u&&t.jsx(O.XCircle,{className:"w-5 h-5 text-destructive"}),t.jsx("span",{className:"text-sm text-muted-foreground",children:o==="loading-data"&&i?`Loading debtors for ${i.companyName}...`:Cs[o]})]}),Z&&t.jsxs("div",{className:"mt-6 space-y-4",children:[t.jsx("div",{className:"text-base font-medium",children:"Step 1 : Select a Client"}),t.jsx("div",{className:"max-h-64 overflow-auto rounded-md border",children:t.jsxs("ul",{className:"divide-y",children:[n.length===0&&t.jsx("li",{className:"p-3 text-sm text-muted-foreground",children:"No clients found."}),n.map(D=>t.jsx("li",{children:t.jsx("button",{className:"w-full text-left p-3 transition-colors hover:bg-muted/70",onClick:()=>f?.(D),children:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(O.Building2,{className:"h-5 w-5 flex-shrink-0 text-primary"}),t.jsxs("div",{className:"flex-1",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("span",{className:"font-medium",children:D.companyName}),D.active&&t.jsx("span",{className:"rounded bg-green-500/10 px-2 py-1 text-xs text-green-500",children:"Active"})]}),t.jsxs("div",{className:"mt-1 flex items-center gap-1 text-xs text-muted-foreground",children:[t.jsx(O.Mail,{className:"h-3 w-3"}),D.email]})]})]})})},D.id))]})})]}),K&&t.jsxs("div",{className:"mt-6 space-y-4",children:[t.jsx(ae,{value:H,onChange:D=>Q(D.target.value),placeholder:"Search debtors...",className:"w-full"}),t.jsxs(Xt,{value:te,onValueChange:D=>re(D),className:"w-full",children:[t.jsxs(jt,{className:"grid w-full grid-cols-4 gap-2 bg-muted",children:[t.jsxs(ce,{value:"not_connected",children:["Not Connected (",Oe.not_connected,")"]}),t.jsxs(ce,{value:"pending",children:["Pending (",Oe.pending,")"]}),t.jsxs(ce,{value:"connected",children:["Connected (",Oe.connected,")"]}),t.jsxs(ce,{value:"deactivated",children:["Deactivated (",Oe.deactivated,")"]})]}),["not_connected","pending","connected","deactivated"].map(D=>t.jsx(Se,{value:D,className:"mt-4",children:t.jsx("div",{className:"max-h-64 overflow-auto rounded-md border",children:t.jsxs("ul",{className:"divide-y",children:[B[D].length===0&&t.jsx("li",{className:"p-3 text-sm text-muted-foreground",children:"No debtors found."}),B[D].map(N=>t.jsxs("li",{className:"flex items-center justify-between gap-4 p-3 transition-colors hover:bg-muted/70",children:[t.jsxs("div",{className:"flex-1",children:[t.jsx("div",{className:"font-medium",children:N.debtorName}),t.jsxs("div",{className:"mt-1 space-y-0.5 text-xs text-muted-foreground",children:[t.jsxs("div",{children:["Last Sync: ",gr(N.lastSync)]}),N.lastSyncSummary&&t.jsxs("div",{children:["Last Sync Records: ",N.lastSyncSummary.synced," synced /"," ",N.lastSyncSummary.processed," processed",N.lastSyncSummary.failed>0?` (${N.lastSyncSummary.failed} failed)`:""]}),N.lastVerificationSummary&&t.jsxs("div",{children:["Last Verification: ",gr(N.lastVerificationSummary.timestamp)," —"," ",N.lastVerificationSummary.synced," verified /"," ",N.lastVerificationSummary.processed," processed",N.lastVerificationSummary.failed>0?` (${N.lastVerificationSummary.failed} failed)`:""]}),N.portalName&&t.jsxs("div",{children:["Portal: ",N.portalName]})]})]}),t.jsxs("div",{className:"flex flex-wrap gap-2",children:[D==="not_connected"&&t.jsx(q,{onClick:()=>De(N),children:"CONNECT"}),D==="connected"&&t.jsxs(t.Fragment,{children:[t.jsx(q,{variant:"success",size:"sm",onClick:()=>me(N),disabled:G===N.factorcloudDebtorId,children:G===N.factorcloudDebtorId?t.jsxs(t.Fragment,{children:[t.jsx(O.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}),"Syncing..."]}):t.jsxs(t.Fragment,{children:[t.jsx(O.RefreshCw,{className:"mr-2 h-4 w-4"}),"Sync Now"]})}),t.jsx(q,{variant:"outline",size:"sm",onClick:()=>Ie(N),disabled:ne===N.factorcloudDebtorId,children:ne===N.factorcloudDebtorId?t.jsxs(t.Fragment,{children:[t.jsx(O.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}),"Verifying..."]}):t.jsxs(t.Fragment,{children:[t.jsx(O.ShieldCheck,{className:"mr-2 h-4 w-4"}),"Verify Invoices"]})}),t.jsx(q,{variant:"outline",size:"sm",onClick:()=>j?.(N),children:"Edit Credentials"}),t.jsx(q,{variant:"outline",size:"sm",onClick:()=>A?.(N),disabled:C===N.factorcloudDebtorId,children:C===N.factorcloudDebtorId?t.jsxs(t.Fragment,{children:[t.jsx(O.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}),"Deactivating..."]}):"Deactivate"})]}),(D==="pending"||D==="deactivated")&&t.jsxs(t.Fragment,{children:[t.jsx(q,{variant:"outline",size:"sm",onClick:()=>j?.(N),children:"Edit Credentials"}),t.jsx(q,{variant:D==="deactivated"?"default":"outline",size:"sm",onClick:()=>A?.(N),disabled:C===N.factorcloudDebtorId,children:C===N.factorcloudDebtorId?t.jsxs(t.Fragment,{children:[t.jsx(O.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}),D==="deactivated"?"Activating...":"Deactivating..."]}):D==="deactivated"?"Activate":"Deactivate"})]})]})]},N.factorcloudDebtorId))]})})},D))]})]}),ve&&t.jsxs("div",{className:"mt-6 space-y-4",children:[t.jsxs("div",{className:"text-sm",children:["Selected debtor: ",t.jsx("span",{className:"font-medium",children:c?.debtorName})]}),t.jsxs(Xt,{defaultValue:"pending",className:"w-full",children:[t.jsxs(jt,{className:"bg-muted",children:[t.jsx(ce,{value:"pending",children:"Pending"}),t.jsx(ce,{value:"approved",children:"Approved"}),t.jsx(ce,{value:"funded",children:"Funded"}),t.jsx(ce,{value:"closed",children:"Closed"}),t.jsx(ce,{value:"rejected",children:"Rejected"}),t.jsx(ce,{value:"all",children:"All"})]}),t.jsx(Se,{value:"pending",className:"mt-4",children:t.jsxs("div",{className:"flex flex-col items-center rounded-lg border p-8 text-center text-sm text-muted-foreground",children:[t.jsx("div",{className:"mb-3 flex h-10 w-10 items-center justify-center rounded-full bg-muted",children:t.jsx(O.FileText,{className:"h-5 w-5"})}),"No records found for Pending"]})}),t.jsx(Se,{value:"approved",className:"mt-4",children:t.jsx("div",{className:"rounded-lg border p-8 text-center text-sm text-muted-foreground",children:"No records found for Approved"})}),t.jsx(Se,{value:"funded",className:"mt-4",children:t.jsx("div",{className:"rounded-lg border p-8 text-center text-sm text-muted-foreground",children:"No records found for Funded"})}),t.jsx(Se,{value:"closed",className:"mt-4",children:t.jsx("div",{className:"rounded-lg border p-8 text-center text-sm text-muted-foreground",children:"No records found for Closed"})}),t.jsx(Se,{value:"rejected",className:"mt-4",children:t.jsx("div",{className:"rounded-lg border p-8 text-center text-sm text-muted-foreground",children:"No records found for Rejected"})}),t.jsx(Se,{value:"all",className:"mt-4",children:t.jsx("div",{className:"rounded-lg border p-8 text-center text-sm text-muted-foreground",children:"No records found"})})]})]}),s&&t.jsx("div",{className:"mt-6 rounded-lg bg-destructive/10 p-3 text-sm text-destructive",children:s})]}),t.jsxs("div",{className:"flex items-center justify-between border-t px-6 py-4",children:[K&&X?t.jsxs(q,{variant:"outline",onClick:Y,children:[t.jsx(O.ArrowLeft,{className:"mr-2 h-4 w-4"}),"Change Client"]}):t.jsx("div",{}),t.jsx(q,{variant:"outline",onClick:()=>r(!1),children:"Close"})]})]})})]})}),t.jsx(yr,{open:je,onOpenChange:Ae,children:t.jsxs(Vt,{children:[t.jsxs(Wt,{children:[t.jsx(Gt,{children:"Sync Scheduled Successfully!"}),t.jsxs(Ht,{children:["We're syncing invoices for ",t.jsx("span",{className:"font-medium",children:Ne?.debtorName})," in the background. This usually takes a few minutes. You'll receive an email notification once the sync is complete and your invoices are ready to review."]})]}),t.jsx(qt,{children:t.jsx(Yt,{onClick:pe,children:"Got it!"})})]})}),t.jsx(yr,{open:Be,onOpenChange:Ee,children:t.jsxs(Vt,{children:[t.jsxs(Wt,{children:[t.jsx(Gt,{children:"Verification Started!"}),t.jsxs(Ht,{children:["We're verifying invoices for ",t.jsx("span",{className:"font-medium",children:Re?.debtorName}),". We'll let you know if any issues come up during the verification."]})]}),t.jsx(qt,{children:t.jsx(Yt,{onClick:Me,children:"Understood"})})]})})]})}const Jr=W.forwardRef(({className:e,children:r,...o},s)=>t.jsxs(tt.Root,{ref:s,className:$("relative overflow-hidden",e),...o,children:[t.jsx(tt.Viewport,{className:"h-full w-full rounded-[inherit]",children:r}),t.jsx(Kr,{}),t.jsx(tt.Corner,{})]}));Jr.displayName=tt.Root.displayName;const Kr=W.forwardRef(({className:e,orientation:r="vertical",...o},s)=>t.jsx(tt.ScrollAreaScrollbar,{ref:s,orientation:r,className:$("flex touch-none select-none transition-colors",r==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",r==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",e),...o,children:t.jsx(tt.ScrollAreaThumb,{className:"relative flex-1 rounded-full bg-border"})}));Kr.displayName=tt.ScrollAreaScrollbar.displayName;const Ss=kt("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",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function _s({className:e,variant:r,...o}){return t.jsx("div",{className:$(Ss({variant:r}),e),...o})}function nr({open:e,onOpenChange:r,debtor:o,availablePortals:s,loadingPortals:n=!1,loading:a=!1,isChangingPortal:c=!1,onConnect:i,onRequestNewPortal:f}){const[d,y]=l.useState("selecting-portal"),[j,F]=l.useState(null),[A,z]=l.useState(""),[M,C]=l.useState(""),[G,ne]=l.useState("");l.useEffect(()=>{e||(y("selecting-portal"),F(null),z(""),C(""),ne(""))},[e]);const X=s.filter(u=>u.description!=="Failed"&&(u.name.toLowerCase().includes(A.toLowerCase())||u.host.toLowerCase().includes(A.toLowerCase()))).sort((u,U)=>u.is_active&&!U.is_active?-1:!u.is_active&&U.is_active?1:0),Y=u=>{F(u),y("entering-credentials")},P=()=>{y("selecting-portal"),F(null),C(""),ne("")},L=()=>{j&&M&&G&&i(j.portal_id,M,G)},J=M.trim().length>0&&G.trim().length>0;return t.jsx(it,{open:e,onOpenChange:r,children:t.jsx(Ke,{className:"sm:max-w-2xl h-[85vh] min-h-0 flex flex-col gap-4 overflow-hidden",children:d==="selecting-portal"?t.jsxs(t.Fragment,{children:[t.jsxs(We,{children:[t.jsx(qe,{children:c?"Change Portal":"Select Portal"}),t.jsxs(Ge,{children:["Choose the portal you want to ",c?"change to":"connect to"," for ",o?.debtorName,"."]})]}),n?t.jsx("div",{className:"flex items-center justify-center py-8",children:t.jsx(O.Loader2,{className:"w-8 h-8 animate-spin text-primary"})}):t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"relative flex-shrink-0",children:[t.jsx(O.Search,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),t.jsx(ae,{placeholder:"Search portals...",value:A,onChange:u=>z(u.target.value),className:"pl-9"})]}),t.jsx(Jr,{className:"flex-1 min-h-0 -mx-6 px-6",children:t.jsx("div",{className:"grid grid-cols-2 gap-4 pb-4",children:X.map(u=>t.jsxs("button",{onClick:()=>Y(u),className:"flex flex-col items-center gap-3 p-4 border rounded-lg hover:bg-muted/50 transition-colors relative",children:[t.jsx(_s,{variant:"secondary",className:`absolute top-2 right-2 ${u.is_active?"bg-green-100 text-green-700 hover:bg-green-200":"bg-yellow-100 text-yellow-700 hover:bg-yellow-200"}`,children:u.is_active?"Active":"Pending"}),t.jsx("div",{className:"w-16 h-16 flex items-center justify-center bg-muted rounded-lg",children:u.logo&&u.logo!=="NA"?t.jsx("img",{src:u.logo,alt:u.name,className:"w-12 h-12 object-contain",onError:U=>{U.currentTarget.style.display="none"}}):t.jsx("span",{className:"text-2xl font-bold text-muted-foreground",children:u.name.charAt(0)})}),t.jsx("div",{className:"text-sm font-medium text-center",children:u.name}),t.jsx("div",{className:"text-xs text-muted-foreground truncate w-full text-center",children:u.host})]},u.mapping_id))})}),t.jsxs("div",{className:"flex items-center justify-between gap-3 pt-4 border-t flex-shrink-0",children:[t.jsx("p",{className:"text-sm text-muted-foreground",children:"Can't find your portal?"}),t.jsx(q,{variant:"outline",onClick:f,size:"sm",children:"Request New Portal"})]})]}),t.jsx("div",{className:"flex justify-end pt-2 flex-shrink-0",children:t.jsx(q,{variant:"outline",onClick:()=>r(!1),children:"Cancel"})})]}):t.jsxs(t.Fragment,{children:[t.jsxs(We,{children:[t.jsx(qe,{children:c?"Change Portal":"Enter Credentials"}),t.jsxs(Ge,{children:["Enter your credentials for ",j?.name," to ",c?"update":"connect"," ",o?.debtorName,"."]})]}),t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{className:"flex items-center gap-3 p-3 border rounded-lg bg-muted/50",children:[j?.logo&&j.logo!=="NA"&&t.jsx("img",{src:j.logo,alt:j.name,className:"w-10 h-10 object-contain"}),t.jsxs("div",{children:[t.jsx("div",{className:"font-medium",children:j?.name}),t.jsx("div",{className:"text-xs text-muted-foreground",children:j?.host})]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(ye,{htmlFor:"portal-username",children:"Username"}),t.jsx(ae,{id:"portal-username",value:M,onChange:u=>C(u.target.value),placeholder:"Enter portal username"})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(ye,{htmlFor:"portal-password",children:"Password"}),t.jsx(ae,{id:"portal-password",type:"password",value:G,onChange:u=>ne(u.target.value),placeholder:"Enter portal password"})]})]}),t.jsxs("div",{className:"flex justify-between gap-2 pt-4",children:[t.jsxs(q,{variant:"outline",onClick:P,disabled:a,children:[t.jsx(O.ArrowLeft,{className:"w-4 h-4 mr-2"}),"Back"]}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx(q,{variant:"outline",onClick:()=>r(!1),disabled:a,children:"Cancel"}),t.jsx(q,{onClick:L,disabled:a||!J,children:a?c?"Updating...":"Connecting...":c?"Update Portal":"Connect"})]})]})]})})})}function ar({open:e,onOpenChange:r,loading:o=!1,onSubmit:s}){const[n,a]=l.useState(""),[c,i]=l.useState("");l.useEffect(()=>{e||(a(""),i(""))},[e]);const f=n.trim().length>0&&c.trim().length>0;return t.jsx(it,{open:e,onOpenChange:r,children:t.jsxs(Ke,{children:[t.jsxs(We,{children:[t.jsx(qe,{children:"Request New Portal"}),t.jsx(Ge,{children:"Enter the details of the portal you'd like to connect to."})]}),t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx(ye,{htmlFor:"portal-name",children:"Portal Name"}),t.jsx(ae,{id:"portal-name",value:n,onChange:d=>a(d.target.value),placeholder:"e.g. My Portal Name"})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(ye,{htmlFor:"portal-host",children:"Portal URL"}),t.jsx(ae,{id:"portal-host",value:c,onChange:d=>i(d.target.value),placeholder:"e.g. https://portal.example.com"})]})]}),t.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[t.jsx(q,{variant:"outline",onClick:()=>r(!1),disabled:o,children:"Cancel"}),t.jsx(q,{onClick:()=>s(n,c),disabled:o||!f,children:o?"Creating...":"Create Portal"})]})]})})}function ir(e,r){const o=r?.skip??!1,s=r?.customerStatusUrl,n=l.useRef(!0),[a,c]=l.useState(null),[i,f]=l.useState(!1),[d,y]=l.useState(null),[j,F]=l.useState(e&&rt(e)?e:null);l.useEffect(()=>{if(!e){F(null);return}rt(e)&&F(e)},[e]);const A=l.useMemo(()=>{if(!(!e&&!j))return{portalduct:{...j?.portalduct??{},...e?.portalduct??{}},factorcloud:{...j?.factorcloud??{},...e?.factorcloud??{}}}},[e,j]),z=A?.factorcloud?.factorId,M=A?.portalduct?.webhook_bearer_token;A?.portalduct?.customer_id,A?.portalduct?.environment;const C=A?.portalduct?.env_url,G=A?.portalduct?.sync_webhook_url,ne=A?.portalduct?.verify_webhook_url,X=l.useRef(A);l.useEffect(()=>{X.current=A},[A]),l.useEffect(()=>(n.current=!0,()=>{n.current=!1}),[]);const Y=l.useCallback(async()=>{if(o)return null;const P=X.current,L=P?.factorcloud?.factorId,J=P?.portalduct?.webhook_bearer_token,u=P?.portalduct?.customer_id,U=P?.portalduct?.environment,Z=P?.portalduct?.env_url,K=P?.portalduct?.sync_webhook_url,ve=P?.portalduct?.verify_webhook_url;if(!L)return n.current&&(c(null),f(!1),y(null)),null;if(!J)return n.current&&(c(!1),f(!1),y(null)),null;n.current&&(f(!0),y(null));try{const ue=await new Zt({webhookToken:J,customerId:u,environment:U,webhookUrl:K,verifyWebhookUrl:ve,portalductBaseUrl:Z,customerStatusUrl:s}).fetchCustomerStatus(L),te=zr(P,ue);return n.current&&(c(ue.active),te&&F(te)),ue}catch(we){const ue=we instanceof Error?we:new Error("Unable to determine FactorCloud customer status.");return n.current&&(c(!1),y(ue)),null}finally{n.current&&f(!1)}},[s,o]);return l.useEffect(()=>{o||!z||!M||Y()},[s,z,C,Y,o,G,ne,M]),{isActive:a,loading:i,error:d,resolvedConfig:j,refetch:Y}}const Nt=({config:e,onTokenExpired:r,trigger:o,onSyncComplete:s,onSyncError:n,autoStart:a=!1,customerStatus:c})=>{const[i,f]=l.useState(null),[d,y]=l.useState(null),[j,F]=l.useState(null),[A,z]=l.useState([]),[M,C]=l.useState([]),[G,ne]=l.useState(null),[X,Y]=l.useState(!1),[P,L]=l.useState([]),[J,u]=l.useState(!1),[U,Z]=l.useState(!1),[K,ve]=l.useState(null),[we,ue]=l.useState(!1),[te,re]=l.useState(!1),[je,Ae]=l.useState(!1),[Ne,v]=l.useState(!1),[Be,Ee]=l.useState(!1),[Re,Fe]=l.useState(!1),[H,Q]=l.useState(null),[ke,fe]=l.useState(!1),[B,Oe]=l.useState(null),[De,me]=l.useState(null),[pe,Ie]=l.useState(new Map),[Me,D]=l.useState(null),[N,ct]=l.useState(new Map),[Ce,$e]=l.useState(!1),[mt,I]=l.useState("idle"),[lt,ee]=l.useState(),[Ct,He]=l.useState("not_connected"),{toast:V}=Ur(),St=ir(e,{skip:!!c}),dt=c??St,Qe=dt.isActive,ut=dt.loading,_t=dt.error,At=dt.resolvedConfig,Dt=rt(e)?e:null,Ue=At??Dt,It=Ue?.factorcloud?.client_id??e?.factorcloud?.client_id;l.useEffect(()=>{if(Ue&&rt(Ue)){const g=new er(Ue);f(g)}else f(null)},[Ue]),l.useEffect(()=>{a&&i&&!Ce&&Qe===!0&&!ut&&pt()},[a,i,Ce,Qe,ut]),l.useEffect(()=>()=>{pe.forEach(g=>{window.clearTimeout(g)}),N.forEach(g=>{window.clearTimeout(g)})},[pe,N]);const Pt=async g=>{const S=g||i;if(!(!S||!Ue)){Y(!0);try{if(!Ue.factorcloud?.client_id){I("loading-clients");const Pe=await S.getFactorCloudClients();z(Pe),I("selecting-client");return}I("loading-data");const k=await S.getFactorCloudClient(Ue.factorcloud.client_id);y(k);const h=await S.ensurePortalDuctCompany(k);F(h);const E=await S.fetchMergedDebtors(k.id,h.company_id);C(E),I("selecting-debtor"),V({title:"Data Loaded",description:`Loaded ${E.length} debtors. Select a debtor to continue.`}),s?.(E)}catch(k){console.error("Failed to load data:",k);const h=k instanceof Error?k:new Error("An error occurred");k instanceof le&&k.status===401&&k.type==="authentication_error"&&r?.("portalduct"),I("error"),ee(h.message),V({title:"Failed to Load Data",description:h.message,variant:"destructive"}),n?.(h)}finally{Y(!1)}}},pt=async()=>{if(!i){V({title:"Service Not Ready",description:"Please wait for the service to initialize.",variant:"destructive"});return}if(ut){V({title:"Checking Customer Status",description:"Please wait while we confirm your FactorCloud account is active."});return}if(Qe!==!0){V({title:"Sync Unavailable",description:_t?.message??"This FactorCloud account is not active yet.",variant:"destructive"});return}$e(!0),I("checking-config"),ee(void 0);try{await Pt(i)}catch(g){I("error");const S=g instanceof Error?g:new Error("An unexpected error occurred");ee(S.message),n?.(S)}},Tt=async g=>{if(y(g),!!i){I("loading-data"),Y(!0);try{const S=await i.ensurePortalDuctCompany(g);F(S);const k=await i.fetchMergedDebtors(g.id,S.company_id);C(k),I("selecting-debtor"),V({title:"Client Selected",description:`Loaded ${k.length} debtors for ${g.companyName}. Select a debtor to continue.`})}catch(S){console.error("Failed to load client data:",S);const k=S instanceof Error?S:new Error("Failed to load client data");S instanceof le&&S.status===401&&S.type==="authentication_error"&&r?.("portalduct"),I("error"),ee(k.message),V({title:"Failed to load client data",description:k.message,variant:"destructive"}),n?.(k)}finally{Y(!1)}}},Et=async g=>{ne(g),I("review"),V({title:"Debtor Selected",description:`${g.debtorName} selected. Review invoices in the tabs below.`})},Rt=async g=>{if(i){ve(g),re(!1),u(!0),$e(!1),Z(!0);try{const k=await i.getPortalDuctAPI().getPortalMappings();L(k)}catch(S){console.error("Failed to fetch portals",S);const k=S instanceof Error?S:new Error("Unable to fetch portals.");S instanceof le&&S.status===401&&S.type==="authentication_error"&&r?.("portalduct"),I("error"),ee(k.message),V({title:"Failed to fetch portals",description:k.message,variant:"destructive"}),$e(!0),Z(!1)}finally{u(!1)}}},Ft=async g=>{if(i){ve(g),re(!0),u(!0),$e(!1),Z(!0);try{const k=await i.getPortalDuctAPI().getPortalMappings();L(k)}catch(S){console.error("Failed to fetch portals",S);const k=S instanceof Error?S:new Error("Unable to fetch portals.");S instanceof le&&S.status===401&&S.type==="authentication_error"&&r?.("portalduct"),I("error"),ee(k.message),V({title:"Failed to fetch portals",description:k.message,variant:"destructive"}),$e(!0),Z(!1)}finally{u(!1)}}},Ot=g=>{Z(g),g||$e(!0)},m=()=>{Z(!1),Ae(!0)},_=async(g,S)=>{if(!(!i||!Ue?.portalduct?.customer_id))try{v(!0);const k=i.getPortalDuctAPI(),h=await k.createPortalMapping({customer_id:Ue.portalduct.customer_id,name:g,host:S}),E=await k.getPortalMappings();L(E),Ae(!1),Z(!0),V({title:"Portal created",description:`${h.name} has been added to your portals.`})}catch(k){console.error("Failed to create portal",k);const h=k instanceof Error?k:new Error("Unable to create portal.");k instanceof le&&k.status===401&&k.type==="authentication_error"&&(r?.("portalduct"),I("error"),ee(h.message)),V({title:"Failed to create portal",description:h.message,variant:"destructive"})}finally{v(!1)}},w=async(g,S,k)=>{if(!i||!j||!d||!K){V({title:"Cannot connect",description:"Missing context to create connection.",variant:"destructive"});return}try{ue(!0);const h=i.getPortalDuctAPI(),E=P.find(be=>be.portal_id===g);te&&K.connection?(await h.updateConnection(K.connection.connection_id,{portal_id:g,user_name:S,password:k}),V({title:"Portal changed",description:`${K.debtorName} portal updated to ${E?.name}.`})):(await h.createConnection({company_id:j.company_id,portal_id:g,user_name:S,password:k,tags:{factorcloud_id:d.id,factorcloud_debtor_id:K.factorcloudDebtorId}}),V({title:"Connection created",description:`${K.debtorName} is now connected (pending).`}));const Pe=await i.fetchMergedDebtors(d.id,j.company_id);C(Pe),Z(!1),$e(!0),He("connected"),ve(null),re(!1)}catch(h){console.error(te?"Change portal failed":"Create connection failed",h);const E=h instanceof Error?h:new Error(`Unable to ${te?"change portal":"create connection"}.`);h instanceof le&&h.status===401&&h.type==="authentication_error"&&(r?.("portalduct"),I("error"),ee(E.message)),V({title:te?"Change portal failed":"Connection failed",description:E.message,variant:"destructive"})}finally{ue(!1)}},p=g=>{Q(g),Fe(!0)},T=async(g,S)=>{if(!(!i||!j||!d||!H?.connection))try{fe(!0);const k=i.getPortalDuctAPI(),h={};g&&(h.user_name=g),S&&(h.password=S),await k.updateConnection(H.connection.connection_id,h);const E=await i.fetchMergedDebtors(d.id,j.company_id);C(E),Fe(!1),Q(null),V({title:"Credentials updated",description:`Updated credentials for ${H.debtorName}.`})}catch(k){console.error("Update credentials failed",k);const h=k instanceof Error?k:new Error("Unable to update credentials.");k instanceof le&&k.status===401&&k.type==="authentication_error"&&(r?.("portalduct"),I("error"),ee(h.message)),V({title:"Update failed",description:h.message,variant:"destructive"})}finally{fe(!1)}},he=async g=>{if(!i||!j||!d||!g.connection)return;const S=g.status==="deactivated",k=S?"activate":"deactivate";try{Oe(g.factorcloudDebtorId);const h=i.getPortalDuctAPI();S?await h.activateConnection(g.connection.connection_id):await h.deactivateConnection(g.connection.connection_id);const E=await i.fetchMergedDebtors(d.id,j.company_id);C(E),He(S?"connected":"deactivated"),V({title:`Connection ${k}d`,description:`${g.debtorName} connection has been ${k}d.`})}catch(h){console.error(`Failed to ${k} connection`,h);const E=h instanceof Error?h:new Error(`Unable to ${k} connection.`);h instanceof le&&h.status===401&&h.type==="authentication_error"&&(r?.("portalduct"),I("error"),ee(E.message)),V({title:`Failed to ${k}`,description:E.message,variant:"destructive"})}finally{Oe(null)}},ie=async g=>{if(!g.connection){V({title:"Cannot Sync",description:`${g.debtorName} is not connected to a portal`,variant:"destructive"});return}const S=i;if(!S){V({title:"Service Not Ready",description:"PortalDuct service is not available yet.",variant:"destructive"});return}me(g.factorcloudDebtorId);const k=window.setTimeout(()=>{me(null),Ie(h=>{const E=new Map(h);return E.delete(g.factorcloudDebtorId),E})},15*60*1e3);Ie(h=>{const E=new Map(h);return E.set(g.factorcloudDebtorId,k),E});try{const h=await S.triggerConnectionSync(g.connection.connection_id),E=new Date().toISOString();C(be=>be.map(Te=>Te.factorcloudDebtorId===g.factorcloudDebtorId?{...Te,lastSync:E,lastSyncSummary:{processed:h.processed,synced:h.synced,failed:h.failed,timestamp:E}}:Te)),me(null);const Pe=pe.get(g.factorcloudDebtorId);Pe!==void 0&&window.clearTimeout(Pe),Ie(be=>{const Te=new Map(be);return Te.delete(g.factorcloudDebtorId),Te}),V({title:h.failed>0?"Sync Completed with Warnings":"Sync Completed",description:`Processed ${h.processed} records. Synced ${h.synced}. Failed ${h.failed}.`})}catch(h){me(null);const E=pe.get(g.factorcloudDebtorId);E&&(window.clearTimeout(E),Ie(Pe=>{const be=new Map(Pe);return be.delete(g.factorcloudDebtorId),be})),console.error("Sync failed",h),V({title:"Sync Failed",description:h instanceof Error?h.message:`Unable to sync ${g.debtorName}`,variant:"destructive"})}},ge=async g=>{if(!g.connection){V({title:"Cannot Verify",description:`${g.debtorName} is not connected to a portal`,variant:"destructive"});return}const S=i;if(!S){V({title:"Service Not Ready",description:"PortalDuct service is not available yet.",variant:"destructive"});return}D(g.factorcloudDebtorId);const k=window.setTimeout(()=>{D(null),ct(h=>{const E=new Map(h);return E.delete(g.factorcloudDebtorId),E})},15*60*1e3);ct(h=>{const E=new Map(h);return E.set(g.factorcloudDebtorId,k),E});try{const h=await S.triggerConnectionVerification(g.connection.connection_id),E=new Date().toISOString();C(be=>be.map(Te=>Te.factorcloudDebtorId===g.factorcloudDebtorId?{...Te,lastVerificationSummary:{processed:h.processed,synced:h.synced,failed:h.failed,timestamp:E}}:Te)),D(null);const Pe=N.get(g.factorcloudDebtorId);Pe!==void 0&&window.clearTimeout(Pe),ct(be=>{const Te=new Map(be);return Te.delete(g.factorcloudDebtorId),Te}),V({title:h.failed>0?"Verification Completed with Warnings":"Verification Completed",description:`Processed ${h.processed} records. Verified ${h.synced}. Failed ${h.failed}.`})}catch(h){D(null);const E=N.get(g.factorcloudDebtorId);E&&(window.clearTimeout(E),ct(Pe=>{const be=new Map(Pe);return be.delete(g.factorcloudDebtorId),be})),console.error("Verification failed",h),V({title:"Verification Failed",description:h instanceof Error?h.message:`Unable to verify ${g.debtorName}`,variant:"destructive"})}};return t.jsxs(t.Fragment,{children:[o?t.jsx("div",{onClick:()=>{Qe===!0?pt():Ee(!0)},style:{cursor:"pointer"},children:o}):t.jsx(q,{onClick:()=>{Qe===!0?pt():Ee(!0)},children:X?"Loading...":ut?"Checking Access...":"Sync Invoices"}),t.jsx(Hr,{open:Be,onOpenChange:Ee}),t.jsx(sr,{open:Ce,onOpenChange:$e,currentStep:mt,error:lt,clients:A,debtors:M,selectedDebtor:G,selectedClient:d,onSelectClient:Tt,onSelectDebtor:Et,onConnectDebtor:Rt,onEditCredentials:p,onChangePortal:Ft,onToggleActivation:he,onSyncDebtor:ie,onVerifyDebtor:ge,togglingDebtorId:B,syncingDebtorId:De,verifyingDebtorId:Me,allowBackToClientSelection:!It,onBackToClientSelection:()=>I("selecting-client"),activeTab:Ct,onActiveTabChange:He}),t.jsx(ar,{open:je,onOpenChange:Ae,loading:Ne,onSubmit:_}),t.jsx(nr,{open:U,onOpenChange:Ot,debtor:K,availablePortals:P,loadingPortals:J,loading:we,isChangingPortal:te,onConnect:w,onRequestNewPortal:m}),t.jsx(or,{open:Re,onOpenChange:Fe,debtor:H,loading:ke,onUpdate:T})]})},As=({config:e,onTokenExpired:r})=>{const[o,s]=l.useState(null),[n,a]=l.useState(null),[c,i]=l.useState(null);l.useState(!1);const[f,d]=l.useState([]),[y,j]=l.useState([]),[F,A]=l.useState(null),[z,M]=l.useState(!1);l.useState("");const[C,G]=l.useState([]),[ne,X]=l.useState(!1),[Y,P]=l.useState(!1),[L,J]=l.useState(null),[u,U]=l.useState(!1),[Z,K]=l.useState(!1),[ve,we]=l.useState(!1),[ue,te]=l.useState(!1),[re,je]=l.useState(!1),[Ae,Ne]=l.useState(!1),[v,Be]=l.useState(null),[Ee,Re]=l.useState(!1),[Fe,H]=l.useState(null),[Q,ke]=l.useState(null),[fe,B]=l.useState(new Map),[Oe,De]=l.useState(null),[me,pe]=l.useState(new Map),[Ie,Me]=l.useState(!1),[D,N]=l.useState("idle"),[ct,Ce]=l.useState(),[$e,mt]=l.useState("not_connected"),{toast:I}=Ur(),lt=ir(e),ee=lt.resolvedConfig??(rt(e)?e:null),Ct=ee?.factorcloud?.client_id??e?.factorcloud?.client_id,He=lt.isActive,V=lt.loading,St=lt.error;l.useEffect(()=>{if(ee&&rt(ee)){const m=new er(ee);s(m)}else s(null)},[ee]),l.useEffect(()=>()=>{fe.forEach(m=>{window.clearTimeout(m)}),me.forEach(m=>{window.clearTimeout(m)})},[fe,me]);const dt=async m=>{const _=m||o;if(!(!_||!ee)){M(!0);try{if(!ee.factorcloud?.client_id){N("loading-clients");const he=await _.getFactorCloudClients();d(he),N("selecting-client");return}N("loading-data");const w=await _.getFactorCloudClient(ee.factorcloud.client_id);a(w);const p=await _.ensurePortalDuctCompany(w);i(p);const T=await _.fetchMergedDebtors(w.id,p.company_id);j(T),N("selecting-debtor"),I({title:"Data Loaded",description:`Loaded ${T.length} debtors. Select a debtor to continue.`})}catch(w){console.error("Failed to load data:",w);const p=w instanceof Error?w:new Error("An error occurred.");w instanceof le&&w.status===401&&w.type==="authentication_error"&&r?.("portalduct"),N("error"),Ce(p.message),I({title:"Failed to Load Data",description:p.message,variant:"destructive"})}finally{M(!1)}}},Qe=async()=>{if(!o){I({title:"Service Not Ready",description:"Please wait for the service to initialize.",variant:"destructive"});return}if(V){I({title:"Checking Customer Status",description:"Please wait while we confirm your FactorCloud account is active."});return}if(He!==!0){I({title:"Sync Unavailable",description:St?.message??"This FactorCloud account is not active yet.",variant:"destructive"});return}Me(!0),N("checking-config"),Ce(void 0);try{await dt(o)}catch(m){N("error"),Ce(m instanceof Error?m.message:"An unexpected error occurred")}},ut=async m=>{if(a(m),!!o){N("loading-data"),M(!0);try{const _=await o.ensurePortalDuctCompany(m);i(_);const w=await o.fetchMergedDebtors(m.id,_.company_id);j(w),N("selecting-debtor"),I({title:"Client Selected",description:`Loaded ${w.length} debtors for ${m.companyName}. Select a debtor to continue.`})}catch(_){console.error("Failed to load client data:",_);const w=_ instanceof Error?_:new Error("Failed to load client data");_ instanceof le&&_.status===401&&_.type==="authentication_error"&&r?.("portalduct"),N("error"),Ce(w.message),I({title:"Failed to load client data",description:w.message,variant:"destructive"})}finally{M(!1)}}},_t=async m=>{A(m),N("review"),I({title:"Debtor Selected",description:`${m.debtorName} selected. Review invoices in the tabs below.`})},At=async m=>{if(o){J(m),K(!1),X(!0),Me(!1),P(!0);try{const w=await o.getPortalDuctAPI().getPortalMappings();G(w)}catch(_){console.error("Failed to fetch portals",_);const w=_ instanceof Error?_:new Error("Unable to fetch portals.");_ instanceof le&&_.status===401&&_.type==="authentication_error"&&r?.("portalduct"),N("error"),Ce(w.message),I({title:"Failed to fetch portals",description:w.message,variant:"destructive"}),Me(!0),P(!1)}finally{X(!1)}}},Dt=async m=>{if(o){J(m),K(!0),X(!0),Me(!1),P(!0);try{const w=await o.getPortalDuctAPI().getPortalMappings();G(w)}catch(_){console.error("Failed to fetch portals",_);const w=_ instanceof Error?_:new Error("Unable to fetch portals.");_ instanceof le&&_.status===401&&_.type==="authentication_error"&&r?.("portalduct"),N("error"),Ce(w.message),I({title:"Failed to fetch portals",description:w.message,variant:"destructive"}),Me(!0),P(!1)}finally{X(!1)}}},Ue=m=>{P(m),m||Me(!0)},It=()=>{P(!1),we(!0)},Pt=async(m,_)=>{if(!(!o||!ee?.portalduct?.customer_id))try{je(!0);const w=o.getPortalDuctAPI(),p=await w.createPortalMapping({customer_id:ee.portalduct.customer_id,name:m,host:_}),T=await w.getPortalMappings();G(T),we(!1),P(!0),I({title:"Portal created",description:`${p.name} has been added to your portals.`})}catch(w){console.error("Failed to create portal",w);const p=w instanceof Error?w:new Error("Unable to create portal.");w instanceof le&&w.status===401&&w.type==="authentication_error"&&r?.("portalduct"),N("error"),Ce(p.message),I({title:"Failed to create portal",description:p.message,variant:"destructive"})}finally{je(!1)}},pt=async(m,_,w)=>{if(!o||!c||!n||!L){I({title:"Cannot connect",description:"Missing context to create connection.",variant:"destructive"});return}try{U(!0);const p=o.getPortalDuctAPI(),T=C.find(ie=>ie.portal_id===m);Z&&L.connection?(await p.updateConnection(L.connection.connection_id,{portal_id:m,user_name:_,password:w}),I({title:"Portal changed",description:`${L.debtorName} portal updated to ${T?.name}.`})):(await p.createConnection({company_id:c.company_id,portal_id:m,user_name:_,password:w,tags:{factorcloud_id:n.id,factorcloud_debtor_id:L.factorcloudDebtorId}}),I({title:"Connection created",description:`${L.debtorName} is now connected (pending).`}));const he=await o.fetchMergedDebtors(n.id,c.company_id);j(he),P(!1),Me(!0),mt("connected"),J(null),K(!1)}catch(p){console.error(Z?"Change portal failed":"Create connection failed",p);const T=p instanceof Error?p:new Error(`Unable to ${Z?"change portal":"create connection"}.`);p instanceof le&&p.status===401&&p.type==="authentication_error"&&(r?.("portalduct"),N("error"),Ce(T.message)),I({title:Z?"Change portal failed":"Connection failed",description:T.message,variant:"destructive"})}finally{U(!1)}},Tt=m=>{Be(m),Ne(!0)},Et=async(m,_)=>{if(!(!o||!c||!n||!v?.connection))try{Re(!0);const w=o.getPortalDuctAPI(),p={};m&&(p.user_name=m),_&&(p.password=_),await w.updateConnection(v.connection.connection_id,p);const T=await o.fetchMergedDebtors(n.id,c.company_id);j(T),Ne(!1),Be(null),I({title:"Credentials updated",description:`Updated credentials for ${v.debtorName}.`})}catch(w){console.error("Update credentials failed",w);const p=w instanceof Error?w:new Error("Unable to update credentials.");w instanceof le&&w.status===401&&w.type==="authentication_error"&&(r?.("portalduct"),N("error"),Ce(p.message)),I({title:"Update failed",description:p.message,variant:"destructive"})}finally{Re(!1)}},Rt=async m=>{if(!o||!c||!n||!m.connection)return;const _=m.status==="deactivated",w=_?"activate":"deactivate";try{H(m.factorcloudDebtorId);const p=o.getPortalDuctAPI();_?await p.activateConnection(m.connection.connection_id):await p.deactivateConnection(m.connection.connection_id);const T=await o.fetchMergedDebtors(n.id,c.company_id);j(T),mt(_?"connected":"deactivated"),I({title:`Connection ${w}d`,description:`${m.debtorName} connection has been ${w}d.`})}catch(p){console.error(`Failed to ${w} connection`,p);const T=p instanceof Error?p:new Error(`Unable to ${w} connection.`);p instanceof le&&p.status===401&&p.type==="authentication_error"&&(r?.("portalduct"),N("error"),Ce(T.message)),I({title:`Failed to ${w}`,description:T.message,variant:"destructive"})}finally{H(null)}},Ft=async m=>{if(!m.connection){I({title:"Cannot Sync",description:`${m.debtorName} is not connected to a portal`,variant:"destructive"});return}const _=o;if(!_){I({title:"Service Not Ready",description:"PortalDuct service is not available yet.",variant:"destructive"});return}ke(m.factorcloudDebtorId);const w=window.setTimeout(()=>{ke(null),B(p=>{const T=new Map(p);return T.delete(m.factorcloudDebtorId),T})},15*60*1e3);B(p=>{const T=new Map(p);return T.set(m.factorcloudDebtorId,w),T});try{const p=await _.triggerConnectionSync(m.connection.connection_id),T=new Date().toISOString();j(ie=>ie.map(ge=>ge.factorcloudDebtorId===m.factorcloudDebtorId?{...ge,lastSync:T,lastSyncSummary:{processed:p.processed,synced:p.synced,failed:p.failed,timestamp:T}}:ge)),ke(null);const he=fe.get(m.factorcloudDebtorId);he!==void 0&&window.clearTimeout(he),B(ie=>{const ge=new Map(ie);return ge.delete(m.factorcloudDebtorId),ge}),I({title:p.failed>0?"Sync Completed with Warnings":"Sync Completed",description:`Processed ${p.processed} records. Synced ${p.synced}. Failed ${p.failed}.`})}catch(p){ke(null);const T=fe.get(m.factorcloudDebtorId);T&&(window.clearTimeout(T),B(he=>{const ie=new Map(he);return ie.delete(m.factorcloudDebtorId),ie})),console.error("Sync failed",p),I({title:"Sync Failed",description:p instanceof Error?p.message:`Unable to sync ${m.debtorName}`,variant:"destructive"})}},Ot=async m=>{if(!m.connection){I({title:"Cannot Verify",description:`${m.debtorName} is not connected to a portal`,variant:"destructive"});return}const _=o;if(!_){I({title:"Service Not Ready",description:"PortalDuct service is not available yet.",variant:"destructive"});return}De(m.factorcloudDebtorId);const w=window.setTimeout(()=>{De(null),pe(p=>{const T=new Map(p);return T.delete(m.factorcloudDebtorId),T})},15*60*1e3);pe(p=>{const T=new Map(p);return T.set(m.factorcloudDebtorId,w),T});try{const p=await _.triggerConnectionVerification(m.connection.connection_id),T=new Date().toISOString();j(ie=>ie.map(ge=>ge.factorcloudDebtorId===m.factorcloudDebtorId?{...ge,lastVerificationSummary:{processed:p.processed,synced:p.synced,failed:p.failed,timestamp:T}}:ge)),De(null);const he=me.get(m.factorcloudDebtorId);he!==void 0&&window.clearTimeout(he),pe(ie=>{const ge=new Map(ie);return ge.delete(m.factorcloudDebtorId),ge}),I({title:p.failed>0?"Verification Completed with Warnings":"Verification Completed",description:`Processed ${p.processed} records. Verified ${p.synced}. Failed ${p.failed}.`})}catch(p){De(null);const T=me.get(m.factorcloudDebtorId);T&&(window.clearTimeout(T),pe(he=>{const ie=new Map(he);return ie.delete(m.factorcloudDebtorId),ie})),console.error("Verification failed",p),I({title:"Verification Failed",description:p instanceof Error?p.message:`Unable to verify ${m.debtorName}`,variant:"destructive"})}};return t.jsxs("div",{className:"flex min-h-screen bg-background",children:[t.jsxs("aside",{className:"w-80 bg-[hsl(220,30%,15%)] text-white flex flex-col",children:[t.jsxs("div",{className:"p-6 border-b border-white/10",children:[t.jsx("h1",{className:"text-2xl font-bold",children:"FACTORCLOUD"}),t.jsx("p",{className:"text-sm text-white/60 mt-1",children:"SANDBOX"})]}),t.jsxs("nav",{className:"flex-1 p-4 space-y-1",children:[t.jsxs("button",{className:"w-full flex items-center gap-3 px-4 py-3 rounded-lg text-white/70 hover:bg-white/5 transition-colors",children:[t.jsx(O.Clock,{className:"w-5 h-5"}),t.jsx("span",{children:"Dashboard"})]}),t.jsxs("button",{className:"w-full flex items-center gap-3 px-4 py-3 rounded-lg text-white/70 hover:bg-white/5 transition-colors",children:[t.jsx(O.Building,{className:"w-5 h-5"}),t.jsx("span",{children:"Companies"})]}),t.jsxs("button",{className:"w-full flex items-center gap-3 px-4 py-3 rounded-lg text-white/70 hover:bg-white/5 transition-colors",children:[t.jsx(O.Edit2,{className:"w-5 h-5"}),t.jsx("span",{children:"Terms"})]}),t.jsxs("button",{className:"w-full flex items-center gap-3 px-4 py-3 rounded-lg bg-white/10 text-white",children:[t.jsx(O.FileText,{className:"w-5 h-5"}),t.jsx("span",{children:"Invoices"})]}),t.jsxs("button",{className:"w-full flex items-center gap-3 px-4 py-3 rounded-lg text-white/70 hover:bg-white/5 transition-colors",children:[t.jsx(O.DollarSign,{className:"w-5 h-5"}),t.jsx("span",{children:"Funding"})]}),t.jsxs("button",{className:"w-full flex items-center gap-3 px-4 py-3 rounded-lg text-white/70 hover:bg-white/5 transition-colors",children:[t.jsx(O.CreditCard,{className:"w-5 h-5"}),t.jsx("span",{children:"Payments"})]}),t.jsxs("button",{className:"w-full flex items-center gap-3 px-4 py-3 rounded-lg text-white/70 hover:bg-white/5 transition-colors",children:[t.jsx(O.RefreshCw,{className:"w-5 h-5"}),t.jsx("span",{children:"Chargebacks"})]}),t.jsxs("button",{className:"w-full flex items-center gap-3 px-4 py-3 rounded-lg text-white/70 hover:bg-white/5 transition-colors",children:[t.jsx(O.BookOpen,{className:"w-5 h-5"}),t.jsx("span",{children:"Ledgers"})]}),t.jsxs("button",{className:"w-full flex items-center gap-3 px-4 py-3 rounded-lg text-white/70 hover:bg-white/5 transition-colors",children:[t.jsx(O.Calculator,{className:"w-5 h-5"}),t.jsx("span",{children:"Accounting"})]})]})]}),t.jsxs("main",{className:"flex-1 flex flex-col",children:[t.jsx("header",{className:"border-b bg-background p-6",children:t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("h1",{className:"text-4xl font-bold",children:"Invoices"}),t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(q,{variant:"outline",children:"Export Invoices"}),t.jsx(q,{variant:"outline",onClick:()=>{He?Qe():te(!0)},disabled:z||V||He===!0&&!o,children:z?"Loading...":V?"Checking Access...":He===!0?"Sync Invoices":"Sync Unavailable"}),t.jsx(q,{className:"bg-foreground text-background hover:bg-foreground/90",children:"Create Invoice"})]})]})}),t.jsx("div",{className:"flex-1 p-6",children:t.jsxs(Xt,{defaultValue:"pending",className:"w-full",children:[t.jsxs(jt,{className:"bg-muted",children:[t.jsx(ce,{value:"pending",children:"Pending"}),t.jsx(ce,{value:"approved",children:"Approved"}),t.jsx(ce,{value:"funded",children:"Funded"}),t.jsx(ce,{value:"closed",children:"Closed"}),t.jsx(ce,{value:"rejected",children:"Rejected"}),t.jsx(ce,{value:"all",children:"All"})]}),t.jsx(Se,{value:"pending",className:"mt-6",children:t.jsx("div",{className:"border rounded-lg p-12",children:t.jsxs("div",{className:"flex flex-col items-center justify-center text-center",children:[t.jsx("div",{className:"w-24 h-24 rounded-full bg-muted flex items-center justify-center mb-4",children:t.jsx(O.FileText,{className:"w-12 h-12 text-muted-foreground"})}),t.jsx("h3",{className:"text-2xl font-semibold mb-2",children:"No records in the table"}),t.jsx("p",{className:"text-muted-foreground",children:"No records found"})]})})}),t.jsx(Se,{value:"approved",className:"mt-6",children:t.jsx("div",{className:"border rounded-lg p-12",children:t.jsxs("div",{className:"flex flex-col items-center justify-center text-center",children:[t.jsx("div",{className:"w-24 h-24 rounded-full bg-muted flex items-center justify-center mb-4",children:t.jsx(O.FileText,{className:"w-12 h-12 text-muted-foreground"})}),t.jsx("h3",{className:"text-2xl font-semibold mb-2",children:"No records in the table"}),t.jsx("p",{className:"text-muted-foreground",children:"No records found"})]})})}),t.jsx(Se,{value:"funded",className:"mt-6",children:t.jsx("div",{className:"border rounded-lg p-12",children:t.jsxs("div",{className:"flex flex-col items-center justify-center text-center",children:[t.jsx("div",{className:"w-24 h-24 rounded-full bg-muted flex items-center justify-center mb-4",children:t.jsx(O.FileText,{className:"w-12 h-12 text-muted-foreground"})}),t.jsx("h3",{className:"text-2xl font-semibold mb-2",children:"No records in the table"}),t.jsx("p",{className:"text-muted-foreground",children:"No records found"})]})})}),t.jsx(Se,{value:"closed",className:"mt-6",children:t.jsx("div",{className:"border rounded-lg p-12",children:t.jsxs("div",{className:"flex flex-col items-center justify-center text-center",children:[t.jsx("div",{className:"w-24 h-24 rounded-full bg-muted flex items-center justify-center mb-4",children:t.jsx(O.FileText,{className:"w-12 h-12 text-muted-foreground"})}),t.jsx("h3",{className:"text-2xl font-semibold mb-2",children:"No records in the table"}),t.jsx("p",{className:"text-muted-foreground",children:"No records found"})]})})}),t.jsx(Se,{value:"rejected",className:"mt-6",children:t.jsx("div",{className:"border rounded-lg p-12",children:t.jsxs("div",{className:"flex flex-col items-center justify-center text-center",children:[t.jsx("div",{className:"w-24 h-24 rounded-full bg-muted flex items-center justify-center mb-4",children:t.jsx(O.FileText,{className:"w-12 h-12 text-muted-foreground"})}),t.jsx("h3",{className:"text-2xl font-semibold mb-2",children:"No records in the table"}),t.jsx("p",{className:"text-muted-foreground",children:"No records found"})]})})}),t.jsx(Se,{value:"all",className:"mt-6",children:t.jsx("div",{className:"border rounded-lg p-12",children:t.jsxs("div",{className:"flex flex-col items-center justify-center text-center",children:[t.jsx("div",{className:"w-24 h-24 rounded-full bg-muted flex items-center justify-center mb-4",children:t.jsx(O.FileText,{className:"w-12 h-12 text-muted-foreground"})}),t.jsx("h3",{className:"text-2xl font-semibold mb-2",children:"No records in the table"}),t.jsx("p",{className:"text-muted-foreground",children:"No records found"})]})})})]})})]}),t.jsx(sr,{open:Ie,onOpenChange:Me,currentStep:D,error:ct,clients:f,debtors:y,selectedDebtor:F,selectedClient:n,onSelectClient:ut,onSelectDebtor:_t,onConnectDebtor:At,onEditCredentials:Tt,onChangePortal:Dt,onToggleActivation:Rt,onSyncDebtor:Ft,onVerifyDebtor:Ot,togglingDebtorId:Fe,syncingDebtorId:Q,verifyingDebtorId:Oe,allowBackToClientSelection:!Ct,onBackToClientSelection:()=>N("selecting-client"),activeTab:$e,onActiveTabChange:mt}),t.jsx(ar,{open:ve,onOpenChange:we,loading:re,onSubmit:Pt}),t.jsx(nr,{open:Y,onOpenChange:Ue,debtor:L,availablePortals:C,loadingPortals:ne,loading:u,isChangingPortal:Z,onConnect:pt,onRequestNewPortal:It}),t.jsx(or,{open:Ae,onOpenChange:Ne,debtor:v,loading:Ee,onUpdate:Et}),t.jsx(Hr,{open:ue,onOpenChange:m=>!m&&te(!1)})]})},Ds=({config:e,queryClient:r,variant:o="full",theme:s="auto",title:n="Sync invoices automatically",badge:a,ctaLabel:c="Sync Now",icon:i=t.jsxs("div",{style:{position:"relative",width:"26px",height:"26px",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:[t.jsx("span",{className:"fc-icon-orbit",style:{position:"absolute",top:"-6px",left:"-6px",width:"38px",height:"38px",borderRadius:"50%",pointerEvents:"none"}}),t.jsx("div",{style:{background:"rgba(99,102,241,0.15)",borderRadius:"50%",width:"26px",height:"26px",display:"flex",alignItems:"center",justifyContent:"center"},children:t.jsx("span",{style:{color:"#818cf8",fontSize:"14px"},children:"⚡"})})]}),onTokenExpired:f,onSyncComplete:d,onSyncError:y,autoStart:j})=>{const F=l.useMemo(()=>r??new Mt.QueryClient,[r]),A=ir(e),[z,M]=l.useState("light");if(l.useEffect(()=>{if(s!=="auto"){M(s);return}const P=window.matchMedia("(prefers-color-scheme: dark)"),L=()=>M(P.matches?"dark":"light");return L(),P.addEventListener("change",L),()=>P.removeEventListener("change",L)},[s]),A.loading)return null;const C=z==="dark",G=t.jsx("button",{style:{background:"linear-gradient(90deg, rgba(99,102,241,1) 0%, rgba(79,70,229,1) 100%)",color:"white",borderRadius:o==="compact"?"14px":"8px",padding:o==="compact"?"6px 14px":"10px 18px",fontSize:"12px",fontWeight:600,cursor:"pointer",border:"none",whiteSpace:"nowrap",boxShadow:C?"0 4px 8px rgba(0,0,0,0.25)":"0 3px 6px rgba(0,0,0,0.15)",transition:"transform 0.25s ease, opacity 0.2s"},onMouseEnter:P=>{P.currentTarget.style.opacity="0.9",P.currentTarget.style.transform="translateY(-1px)"},onMouseLeave:P=>{P.currentTarget.style.opacity="1",P.currentTarget.style.transform="translateY(0px)"},children:c}),X=a??t.jsxs("span",{className:"fc-enhanced-badge",style:{fontSize:"9px",fontWeight:700,textTransform:"uppercase",padding:"2px 6px",borderRadius:"6px",background:C?"rgba(99,102,241,0.22)":"rgba(147,197,253,0.20)",color:C?"#c7d2fe":"#3b82f6",border:C?"1px solid rgba(255,255,255,0.08)":"1px solid rgba(59,130,246,0.15)",position:"relative",overflow:"hidden",display:"inline-block"},children:["NEW",t.jsx("span",{className:"sparkle",style:{position:"absolute",top:"0px",right:"-2px",width:"3px",height:"3px",background:C?"white":"#3b82f6",borderRadius:"50%",opacity:0}}),t.jsx("span",{className:"sparkle",style:{position:"absolute",top:"4px",right:"6px",width:"2px",height:"2px",background:C?"white":"#3b82f6",borderRadius:"50%",opacity:0}}),t.jsx("span",{className:"sparkle",style:{position:"absolute",top:"10px",right:"2px",width:"2px",height:"2px",background:C?"white":"#3b82f6",borderRadius:"50%",opacity:0}}),t.jsx("span",{className:"sparkle",style:{position:"absolute",top:"7px",right:"10px",width:"3px",height:"3px",background:C?"white":"#3b82f6",borderRadius:"50%",opacity:0}})]}),Y=t.jsx("style",{children:`
2
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),v=require("react"),Go=require("react-dom"),Y=require("lucide-react"),vr=require("@tanstack/react-query");function Ho(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const o=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,o.get?o:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const l=Ho(v),ca=Ho(Go);function go(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function It(...e){return t=>{let r=!1;const o=e.map(s=>{const a=go(s,t);return!r&&typeof a=="function"&&(r=!0),a});if(r)return()=>{for(let s=0;s<o.length;s++){const a=o[s];typeof a=="function"?a():go(e[s],null)}}}}function de(...e){return l.useCallback(It(...e),e)}var la=Symbol.for("react.lazy"),Ht=l[" use ".trim().toString()];function da(e){return typeof e=="object"&&e!==null&&"then"in e}function qo(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===la&&"_payload"in e&&da(e._payload)}function Br(e){const t=fa(e),r=l.forwardRef((o,s)=>{let{children:a,...c}=o;qo(a)&&typeof Ht=="function"&&(a=Ht(a._payload));const i=l.Children.toArray(a),u=i.find(ma);if(u){const d=u.props.children,f=i.map(p=>p===u?l.Children.count(d)>1?l.Children.only(null):l.isValidElement(d)?d.props.children:null:p);return n.jsx(t,{...c,ref:s,children:l.isValidElement(d)?l.cloneElement(d,void 0,f):null})}return n.jsx(t,{...c,ref:s,children:a})});return r.displayName=`${e}.Slot`,r}var ua=Br("Slot");function fa(e){const t=l.forwardRef((r,o)=>{let{children:s,...a}=r;if(qo(s)&&typeof Ht=="function"&&(s=Ht(s._payload)),l.isValidElement(s)){const c=ga(s),i=ha(a,s.props);return s.type!==l.Fragment&&(i.ref=o?It(o,c):c),l.cloneElement(s,i)}return l.Children.count(s)>1?l.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var pa=Symbol("radix.slottable");function ma(e){return l.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===pa}function ha(e,t){const r={...t};for(const o in t){const s=e[o],a=t[o];/^on[A-Z]/.test(o)?s&&a?r[o]=(...i)=>{const u=a(...i);return s(...i),u}:s&&(r[o]=s):o==="style"?r[o]={...s,...a}:o==="className"&&(r[o]=[s,a].filter(Boolean).join(" "))}return{...e,...r}}function ga(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}function Yo(e){var t,r,o="";if(typeof e=="string"||typeof e=="number")o+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(t=0;t<s;t++)e[t]&&(r=Yo(e[t]))&&(o&&(o+=" "),o+=r)}else for(r in e)e[r]&&(o&&(o+=" "),o+=r);return o}function Xo(){for(var e,t,r=0,o="",s=arguments.length;r<s;r++)(e=arguments[r])&&(t=Yo(e))&&(o&&(o+=" "),o+=t);return o}const vo=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,bo=Xo,Jt=(e,t)=>r=>{var o;if(t?.variants==null)return bo(e,r?.class,r?.className);const{variants:s,defaultVariants:a}=t,c=Object.keys(s).map(d=>{const f=r?.[d],p=a?.[d];if(f===null)return null;const m=vo(f)||vo(p);return s[d][m]}),i=r&&Object.entries(r).reduce((d,f)=>{let[p,m]=f;return m===void 0||(d[p]=m),d},{}),u=t==null||(o=t.compoundVariants)===null||o===void 0?void 0:o.reduce((d,f)=>{let{class:p,className:m,...y}=f;return Object.entries(y).every(S=>{let[g,h]=S;return Array.isArray(h)?h.includes({...a,...i}[g]):{...a,...i}[g]===h})?[...d,p,m]:d},[]);return bo(e,c,u,r?.class,r?.className)},va=(e,t)=>{const r=new Array(e.length+t.length);for(let o=0;o<e.length;o++)r[o]=e[o];for(let o=0;o<t.length;o++)r[e.length+o]=t[o];return r},ba=(e,t)=>({classGroupId:e,validator:t}),Ko=(e=new Map,t=null,r)=>({nextPart:e,validators:t,classGroupId:r}),qt="-",yo=[],ya="arbitrary..",xa=e=>{const t=Sa(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:o}=e;return{getClassGroupId:c=>{if(c.startsWith("[")&&c.endsWith("]"))return wa(c);const i=c.split(qt),u=i[0]===""&&i.length>1?1:0;return Qo(i,u,t)},getConflictingClassGroupIds:(c,i)=>{if(i){const u=o[c],d=r[c];return u?d?va(d,u):u:d||yo}return r[c]||yo}}},Qo=(e,t,r)=>{if(e.length-t===0)return r.classGroupId;const s=e[t],a=r.nextPart.get(s);if(a){const d=Qo(e,t+1,a);if(d)return d}const c=r.validators;if(c===null)return;const i=t===0?e.join(qt):e.slice(t).join(qt),u=c.length;for(let d=0;d<u;d++){const f=c[d];if(f.validator(i))return f.classGroupId}},wa=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),r=t.indexOf(":"),o=t.slice(0,r);return o?ya+o:void 0})(),Sa=e=>{const{theme:t,classGroups:r}=e;return Ca(r,t)},Ca=(e,t)=>{const r=Ko();for(const o in e){const s=e[o];Wr(s,r,o,t)}return r},Wr=(e,t,r,o)=>{const s=e.length;for(let a=0;a<s;a++){const c=e[a];ja(c,t,r,o)}},ja=(e,t,r,o)=>{if(typeof e=="string"){Na(e,t,r);return}if(typeof e=="function"){Ea(e,t,r,o);return}ka(e,t,r,o)},Na=(e,t,r)=>{const o=e===""?t:Zo(t,e);o.classGroupId=r},Ea=(e,t,r,o)=>{if(Aa(e)){Wr(e(o),t,r,o);return}t.validators===null&&(t.validators=[]),t.validators.push(ba(r,e))},ka=(e,t,r,o)=>{const s=Object.entries(e),a=s.length;for(let c=0;c<a;c++){const[i,u]=s[c];Wr(u,Zo(t,i),r,o)}},Zo=(e,t)=>{let r=e;const o=t.split(qt),s=o.length;for(let a=0;a<s;a++){const c=o[a];let i=r.nextPart.get(c);i||(i=Ko(),r.nextPart.set(c,i)),r=i}return r},Aa=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,Pa=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=Object.create(null),o=Object.create(null);const s=(a,c)=>{r[a]=c,t++,t>e&&(t=0,o=r,r=Object.create(null))};return{get(a){let c=r[a];if(c!==void 0)return c;if((c=o[a])!==void 0)return s(a,c),c},set(a,c){a in r?r[a]=c:s(a,c)}}},_r="!",xo=":",_a=[],wo=(e,t,r,o,s)=>({modifiers:e,hasImportantModifier:t,baseClassName:r,maybePostfixModifierPosition:o,isExternal:s}),Da=e=>{const{prefix:t,experimentalParseClassName:r}=e;let o=s=>{const a=[];let c=0,i=0,u=0,d;const f=s.length;for(let g=0;g<f;g++){const h=s[g];if(c===0&&i===0){if(h===xo){a.push(s.slice(u,g)),u=g+1;continue}if(h==="/"){d=g;continue}}h==="["?c++:h==="]"?c--:h==="("?i++:h===")"&&i--}const p=a.length===0?s:s.slice(u);let m=p,y=!1;p.endsWith(_r)?(m=p.slice(0,-1),y=!0):p.startsWith(_r)&&(m=p.slice(1),y=!0);const S=d&&d>u?d-u:void 0;return wo(a,y,m,S)};if(t){const s=t+xo,a=o;o=c=>c.startsWith(s)?a(c.slice(s.length)):wo(_a,!1,c,void 0,!0)}if(r){const s=o;o=a=>r({className:a,parseClassName:s})}return o},Ta=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((r,o)=>{t.set(r,1e6+o)}),r=>{const o=[];let s=[];for(let a=0;a<r.length;a++){const c=r[a],i=c[0]==="[",u=t.has(c);i||u?(s.length>0&&(s.sort(),o.push(...s),s=[]),o.push(c)):s.push(c)}return s.length>0&&(s.sort(),o.push(...s)),o}},Ia=e=>({cache:Pa(e.cacheSize),parseClassName:Da(e),sortModifiers:Ta(e),...xa(e)}),Ra=/\s+/,Oa=(e,t)=>{const{parseClassName:r,getClassGroupId:o,getConflictingClassGroupIds:s,sortModifiers:a}=t,c=[],i=e.trim().split(Ra);let u="";for(let d=i.length-1;d>=0;d-=1){const f=i[d],{isExternal:p,modifiers:m,hasImportantModifier:y,baseClassName:S,maybePostfixModifierPosition:g}=r(f);if(p){u=f+(u.length>0?" "+u:u);continue}let h=!!g,x=o(h?S.substring(0,g):S);if(!x){if(!h){u=f+(u.length>0?" "+u:u);continue}if(x=o(S),!x){u=f+(u.length>0?" "+u:u);continue}h=!1}const T=m.length===0?"":m.length===1?m[0]:a(m).join(":"),j=y?T+_r:T,E=j+x;if(c.indexOf(E)>-1)continue;c.push(E);const w=s(x,h);for(let L=0;L<w.length;++L){const I=w[L];c.push(j+I)}u=f+(u.length>0?" "+u:u)}return u},Fa=(...e)=>{let t=0,r,o,s="";for(;t<e.length;)(r=e[t++])&&(o=Jo(r))&&(s&&(s+=" "),s+=o);return s},Jo=e=>{if(typeof e=="string")return e;let t,r="";for(let o=0;o<e.length;o++)e[o]&&(t=Jo(e[o]))&&(r&&(r+=" "),r+=t);return r},Ma=(e,...t)=>{let r,o,s,a;const c=u=>{const d=t.reduce((f,p)=>p(f),e());return r=Ia(d),o=r.cache.get,s=r.cache.set,a=i,i(u)},i=u=>{const d=o(u);if(d)return d;const f=Oa(u,r);return s(u,f),f};return a=c,(...u)=>a(Fa(...u))},La=[],ie=e=>{const t=r=>r[e]||La;return t.isThemeGetter=!0,t},en=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,tn=/^\((?:(\w[\w-]*):)?(.+)\)$/i,$a=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Ua=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Ba=/\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$/,Wa=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,za=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Va=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,rt=e=>$a.test(e),H=e=>!!e&&!Number.isNaN(Number(e)),ot=e=>!!e&&Number.isInteger(Number(e)),br=e=>e.endsWith("%")&&H(e.slice(0,-1)),Xe=e=>Ua.test(e),rn=()=>!0,Ga=e=>Ba.test(e)&&!Wa.test(e),zr=()=>!1,Ha=e=>za.test(e),qa=e=>Va.test(e),Ya=e=>!P(e)&&!_(e),Xa=e=>st(e,sn,zr),P=e=>en.test(e),ct=e=>st(e,an,Ga),So=e=>st(e,oi,H),Ka=e=>st(e,ln,rn),Qa=e=>st(e,cn,zr),Co=e=>st(e,on,zr),Za=e=>st(e,nn,qa),Ot=e=>st(e,dn,Ha),_=e=>tn.test(e),_t=e=>pt(e,an),Ja=e=>pt(e,cn),jo=e=>pt(e,on),ei=e=>pt(e,sn),ti=e=>pt(e,nn),Ft=e=>pt(e,dn,!0),ri=e=>pt(e,ln,!0),st=(e,t,r)=>{const o=en.exec(e);return o?o[1]?t(o[1]):r(o[2]):!1},pt=(e,t,r=!1)=>{const o=tn.exec(e);return o?o[1]?t(o[1]):r:!1},on=e=>e==="position"||e==="percentage",nn=e=>e==="image"||e==="url",sn=e=>e==="length"||e==="size"||e==="bg-size",an=e=>e==="length",oi=e=>e==="number",cn=e=>e==="family-name",ln=e=>e==="number"||e==="weight",dn=e=>e==="shadow",ni=()=>{const e=ie("color"),t=ie("font"),r=ie("text"),o=ie("font-weight"),s=ie("tracking"),a=ie("leading"),c=ie("breakpoint"),i=ie("container"),u=ie("spacing"),d=ie("radius"),f=ie("shadow"),p=ie("inset-shadow"),m=ie("text-shadow"),y=ie("drop-shadow"),S=ie("blur"),g=ie("perspective"),h=ie("aspect"),x=ie("ease"),T=ie("animate"),j=()=>["auto","avoid","all","avoid-page","page","left","right","column"],E=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],w=()=>[...E(),_,P],L=()=>["auto","hidden","clip","visible","scroll"],I=()=>["auto","contain","none"],b=()=>[_,P,u],D=()=>[rt,"full","auto",...b()],z=()=>[ot,"none","subgrid",_,P],q=()=>["auto",{span:["full",ot,_,P]},ot,_,P],se=()=>[ot,"auto",_,P],ge=()=>["auto","min","max","fr",_,P],ue=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],re=()=>["start","end","center","stretch","center-safe","end-safe"],J=()=>["auto",...b()],Ne=()=>[rt,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...b()],_e=()=>[rt,"screen","full","dvw","lvw","svw","min","max","fit",...b()],Ee=()=>[rt,"screen","full","lh","dvh","lvh","svh","min","max","fit",...b()],R=()=>[e,_,P],Ye=()=>[...E(),jo,Co,{position:[_,P]}],Fe=()=>["no-repeat",{repeat:["","x","y","space","round"]}],Me=()=>["auto","cover","contain",ei,Xa,{size:[_,P]}],Le=()=>[br,_t,ct],ee=()=>["","none","full",d,_,P],oe=()=>["",H,_t,ct],ke=()=>["solid","dashed","dotted","double"],ve=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],K=()=>[H,br,jo,Co],$e=()=>["","none",S,_,P],De=()=>["none",H,_,P],be=()=>["none",H,_,P],ye=()=>[H,_,P],Te=()=>[rt,"full",...b()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Xe],breakpoint:[Xe],color:[rn],container:[Xe],"drop-shadow":[Xe],ease:["in","out","in-out"],font:[Ya],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Xe],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Xe],shadow:[Xe],spacing:["px",H],text:[Xe],"text-shadow":[Xe],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",rt,P,_,h]}],container:["container"],columns:[{columns:[H,P,_,i]}],"break-after":[{"break-after":j()}],"break-before":[{"break-before":j()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],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"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:w()}],overflow:[{overflow:L()}],"overflow-x":[{"overflow-x":L()}],"overflow-y":[{"overflow-y":L()}],overscroll:[{overscroll:I()}],"overscroll-x":[{"overscroll-x":I()}],"overscroll-y":[{"overscroll-y":I()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:D()}],"inset-x":[{"inset-x":D()}],"inset-y":[{"inset-y":D()}],start:[{"inset-s":D(),start:D()}],end:[{"inset-e":D(),end:D()}],"inset-bs":[{"inset-bs":D()}],"inset-be":[{"inset-be":D()}],top:[{top:D()}],right:[{right:D()}],bottom:[{bottom:D()}],left:[{left:D()}],visibility:["visible","invisible","collapse"],z:[{z:[ot,"auto",_,P]}],basis:[{basis:[rt,"full","auto",i,...b()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[H,rt,"auto","initial","none",P]}],grow:[{grow:["",H,_,P]}],shrink:[{shrink:["",H,_,P]}],order:[{order:[ot,"first","last","none",_,P]}],"grid-cols":[{"grid-cols":z()}],"col-start-end":[{col:q()}],"col-start":[{"col-start":se()}],"col-end":[{"col-end":se()}],"grid-rows":[{"grid-rows":z()}],"row-start-end":[{row:q()}],"row-start":[{"row-start":se()}],"row-end":[{"row-end":se()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":ge()}],"auto-rows":[{"auto-rows":ge()}],gap:[{gap:b()}],"gap-x":[{"gap-x":b()}],"gap-y":[{"gap-y":b()}],"justify-content":[{justify:[...ue(),"normal"]}],"justify-items":[{"justify-items":[...re(),"normal"]}],"justify-self":[{"justify-self":["auto",...re()]}],"align-content":[{content:["normal",...ue()]}],"align-items":[{items:[...re(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...re(),{baseline:["","last"]}]}],"place-content":[{"place-content":ue()}],"place-items":[{"place-items":[...re(),"baseline"]}],"place-self":[{"place-self":["auto",...re()]}],p:[{p:b()}],px:[{px:b()}],py:[{py:b()}],ps:[{ps:b()}],pe:[{pe:b()}],pbs:[{pbs:b()}],pbe:[{pbe:b()}],pt:[{pt:b()}],pr:[{pr:b()}],pb:[{pb:b()}],pl:[{pl:b()}],m:[{m:J()}],mx:[{mx:J()}],my:[{my:J()}],ms:[{ms:J()}],me:[{me:J()}],mbs:[{mbs:J()}],mbe:[{mbe:J()}],mt:[{mt:J()}],mr:[{mr:J()}],mb:[{mb:J()}],ml:[{ml:J()}],"space-x":[{"space-x":b()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":b()}],"space-y-reverse":["space-y-reverse"],size:[{size:Ne()}],"inline-size":[{inline:["auto",..._e()]}],"min-inline-size":[{"min-inline":["auto",..._e()]}],"max-inline-size":[{"max-inline":["none",..._e()]}],"block-size":[{block:["auto",...Ee()]}],"min-block-size":[{"min-block":["auto",...Ee()]}],"max-block-size":[{"max-block":["none",...Ee()]}],w:[{w:[i,"screen",...Ne()]}],"min-w":[{"min-w":[i,"screen","none",...Ne()]}],"max-w":[{"max-w":[i,"screen","none","prose",{screen:[c]},...Ne()]}],h:[{h:["screen","lh",...Ne()]}],"min-h":[{"min-h":["screen","lh","none",...Ne()]}],"max-h":[{"max-h":["screen","lh",...Ne()]}],"font-size":[{text:["base",r,_t,ct]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[o,ri,Ka]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",br,P]}],"font-family":[{font:[Ja,Qa,t]}],"font-features":[{"font-features":[P]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[s,_,P]}],"line-clamp":[{"line-clamp":[H,"none",_,So]}],leading:[{leading:[a,...b()]}],"list-image":[{"list-image":["none",_,P]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",_,P]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:R()}],"text-color":[{text:R()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ke(),"wavy"]}],"text-decoration-thickness":[{decoration:[H,"from-font","auto",_,ct]}],"text-decoration-color":[{decoration:R()}],"underline-offset":[{"underline-offset":[H,"auto",_,P]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:b()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",_,P]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",_,P]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:Ye()}],"bg-repeat":[{bg:Fe()}],"bg-size":[{bg:Me()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},ot,_,P],radial:["",_,P],conic:[ot,_,P]},ti,Za]}],"bg-color":[{bg:R()}],"gradient-from-pos":[{from:Le()}],"gradient-via-pos":[{via:Le()}],"gradient-to-pos":[{to:Le()}],"gradient-from":[{from:R()}],"gradient-via":[{via:R()}],"gradient-to":[{to:R()}],rounded:[{rounded:ee()}],"rounded-s":[{"rounded-s":ee()}],"rounded-e":[{"rounded-e":ee()}],"rounded-t":[{"rounded-t":ee()}],"rounded-r":[{"rounded-r":ee()}],"rounded-b":[{"rounded-b":ee()}],"rounded-l":[{"rounded-l":ee()}],"rounded-ss":[{"rounded-ss":ee()}],"rounded-se":[{"rounded-se":ee()}],"rounded-ee":[{"rounded-ee":ee()}],"rounded-es":[{"rounded-es":ee()}],"rounded-tl":[{"rounded-tl":ee()}],"rounded-tr":[{"rounded-tr":ee()}],"rounded-br":[{"rounded-br":ee()}],"rounded-bl":[{"rounded-bl":ee()}],"border-w":[{border:oe()}],"border-w-x":[{"border-x":oe()}],"border-w-y":[{"border-y":oe()}],"border-w-s":[{"border-s":oe()}],"border-w-e":[{"border-e":oe()}],"border-w-bs":[{"border-bs":oe()}],"border-w-be":[{"border-be":oe()}],"border-w-t":[{"border-t":oe()}],"border-w-r":[{"border-r":oe()}],"border-w-b":[{"border-b":oe()}],"border-w-l":[{"border-l":oe()}],"divide-x":[{"divide-x":oe()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":oe()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...ke(),"hidden","none"]}],"divide-style":[{divide:[...ke(),"hidden","none"]}],"border-color":[{border:R()}],"border-color-x":[{"border-x":R()}],"border-color-y":[{"border-y":R()}],"border-color-s":[{"border-s":R()}],"border-color-e":[{"border-e":R()}],"border-color-bs":[{"border-bs":R()}],"border-color-be":[{"border-be":R()}],"border-color-t":[{"border-t":R()}],"border-color-r":[{"border-r":R()}],"border-color-b":[{"border-b":R()}],"border-color-l":[{"border-l":R()}],"divide-color":[{divide:R()}],"outline-style":[{outline:[...ke(),"none","hidden"]}],"outline-offset":[{"outline-offset":[H,_,P]}],"outline-w":[{outline:["",H,_t,ct]}],"outline-color":[{outline:R()}],shadow:[{shadow:["","none",f,Ft,Ot]}],"shadow-color":[{shadow:R()}],"inset-shadow":[{"inset-shadow":["none",p,Ft,Ot]}],"inset-shadow-color":[{"inset-shadow":R()}],"ring-w":[{ring:oe()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:R()}],"ring-offset-w":[{"ring-offset":[H,ct]}],"ring-offset-color":[{"ring-offset":R()}],"inset-ring-w":[{"inset-ring":oe()}],"inset-ring-color":[{"inset-ring":R()}],"text-shadow":[{"text-shadow":["none",m,Ft,Ot]}],"text-shadow-color":[{"text-shadow":R()}],opacity:[{opacity:[H,_,P]}],"mix-blend":[{"mix-blend":[...ve(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ve()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[H]}],"mask-image-linear-from-pos":[{"mask-linear-from":K()}],"mask-image-linear-to-pos":[{"mask-linear-to":K()}],"mask-image-linear-from-color":[{"mask-linear-from":R()}],"mask-image-linear-to-color":[{"mask-linear-to":R()}],"mask-image-t-from-pos":[{"mask-t-from":K()}],"mask-image-t-to-pos":[{"mask-t-to":K()}],"mask-image-t-from-color":[{"mask-t-from":R()}],"mask-image-t-to-color":[{"mask-t-to":R()}],"mask-image-r-from-pos":[{"mask-r-from":K()}],"mask-image-r-to-pos":[{"mask-r-to":K()}],"mask-image-r-from-color":[{"mask-r-from":R()}],"mask-image-r-to-color":[{"mask-r-to":R()}],"mask-image-b-from-pos":[{"mask-b-from":K()}],"mask-image-b-to-pos":[{"mask-b-to":K()}],"mask-image-b-from-color":[{"mask-b-from":R()}],"mask-image-b-to-color":[{"mask-b-to":R()}],"mask-image-l-from-pos":[{"mask-l-from":K()}],"mask-image-l-to-pos":[{"mask-l-to":K()}],"mask-image-l-from-color":[{"mask-l-from":R()}],"mask-image-l-to-color":[{"mask-l-to":R()}],"mask-image-x-from-pos":[{"mask-x-from":K()}],"mask-image-x-to-pos":[{"mask-x-to":K()}],"mask-image-x-from-color":[{"mask-x-from":R()}],"mask-image-x-to-color":[{"mask-x-to":R()}],"mask-image-y-from-pos":[{"mask-y-from":K()}],"mask-image-y-to-pos":[{"mask-y-to":K()}],"mask-image-y-from-color":[{"mask-y-from":R()}],"mask-image-y-to-color":[{"mask-y-to":R()}],"mask-image-radial":[{"mask-radial":[_,P]}],"mask-image-radial-from-pos":[{"mask-radial-from":K()}],"mask-image-radial-to-pos":[{"mask-radial-to":K()}],"mask-image-radial-from-color":[{"mask-radial-from":R()}],"mask-image-radial-to-color":[{"mask-radial-to":R()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":E()}],"mask-image-conic-pos":[{"mask-conic":[H]}],"mask-image-conic-from-pos":[{"mask-conic-from":K()}],"mask-image-conic-to-pos":[{"mask-conic-to":K()}],"mask-image-conic-from-color":[{"mask-conic-from":R()}],"mask-image-conic-to-color":[{"mask-conic-to":R()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:Ye()}],"mask-repeat":[{mask:Fe()}],"mask-size":[{mask:Me()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",_,P]}],filter:[{filter:["","none",_,P]}],blur:[{blur:$e()}],brightness:[{brightness:[H,_,P]}],contrast:[{contrast:[H,_,P]}],"drop-shadow":[{"drop-shadow":["","none",y,Ft,Ot]}],"drop-shadow-color":[{"drop-shadow":R()}],grayscale:[{grayscale:["",H,_,P]}],"hue-rotate":[{"hue-rotate":[H,_,P]}],invert:[{invert:["",H,_,P]}],saturate:[{saturate:[H,_,P]}],sepia:[{sepia:["",H,_,P]}],"backdrop-filter":[{"backdrop-filter":["","none",_,P]}],"backdrop-blur":[{"backdrop-blur":$e()}],"backdrop-brightness":[{"backdrop-brightness":[H,_,P]}],"backdrop-contrast":[{"backdrop-contrast":[H,_,P]}],"backdrop-grayscale":[{"backdrop-grayscale":["",H,_,P]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[H,_,P]}],"backdrop-invert":[{"backdrop-invert":["",H,_,P]}],"backdrop-opacity":[{"backdrop-opacity":[H,_,P]}],"backdrop-saturate":[{"backdrop-saturate":[H,_,P]}],"backdrop-sepia":[{"backdrop-sepia":["",H,_,P]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":b()}],"border-spacing-x":[{"border-spacing-x":b()}],"border-spacing-y":[{"border-spacing-y":b()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",_,P]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[H,"initial",_,P]}],ease:[{ease:["linear","initial",x,_,P]}],delay:[{delay:[H,_,P]}],animate:[{animate:["none",T,_,P]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[g,_,P]}],"perspective-origin":[{"perspective-origin":w()}],rotate:[{rotate:De()}],"rotate-x":[{"rotate-x":De()}],"rotate-y":[{"rotate-y":De()}],"rotate-z":[{"rotate-z":De()}],scale:[{scale:be()}],"scale-x":[{"scale-x":be()}],"scale-y":[{"scale-y":be()}],"scale-z":[{"scale-z":be()}],"scale-3d":["scale-3d"],skew:[{skew:ye()}],"skew-x":[{"skew-x":ye()}],"skew-y":[{"skew-y":ye()}],transform:[{transform:[_,P,"","none","gpu","cpu"]}],"transform-origin":[{origin:w()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Te()}],"translate-x":[{"translate-x":Te()}],"translate-y":[{"translate-y":Te()}],"translate-z":[{"translate-z":Te()}],"translate-none":["translate-none"],accent:[{accent:R()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:R()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{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",_,P]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":b()}],"scroll-mx":[{"scroll-mx":b()}],"scroll-my":[{"scroll-my":b()}],"scroll-ms":[{"scroll-ms":b()}],"scroll-me":[{"scroll-me":b()}],"scroll-mbs":[{"scroll-mbs":b()}],"scroll-mbe":[{"scroll-mbe":b()}],"scroll-mt":[{"scroll-mt":b()}],"scroll-mr":[{"scroll-mr":b()}],"scroll-mb":[{"scroll-mb":b()}],"scroll-ml":[{"scroll-ml":b()}],"scroll-p":[{"scroll-p":b()}],"scroll-px":[{"scroll-px":b()}],"scroll-py":[{"scroll-py":b()}],"scroll-ps":[{"scroll-ps":b()}],"scroll-pe":[{"scroll-pe":b()}],"scroll-pbs":[{"scroll-pbs":b()}],"scroll-pbe":[{"scroll-pbe":b()}],"scroll-pt":[{"scroll-pt":b()}],"scroll-pr":[{"scroll-pr":b()}],"scroll-pb":[{"scroll-pb":b()}],"scroll-pl":[{"scroll-pl":b()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",_,P]}],fill:[{fill:["none",...R()]}],"stroke-w":[{stroke:[H,_t,ct,So]}],stroke:[{stroke:["none",...R()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],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"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},si=Ma(ni);function X(...e){return si(Xo(e))}function No(e){if(!e)return"Never";const t=new Date(e),o=new Date().getTime()-t.getTime(),s=Math.floor(o/6e4),a=Math.floor(o/36e5),c=Math.floor(o/864e5);return s<1?"Just now":s<60?`${s} minute${s>1?"s":""} ago`:a<24?`${a} hour${a>1?"s":""} ago`:c<7?`${c} day${c>1?"s":""} ago`:t.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}const Vr=Jt("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",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline",factorcloud:"bg-factorcloud-primary text-factorcloud-primary-foreground hover:bg-factorcloud-primary/90",success:"bg-factorcloud-success text-factorcloud-success-foreground hover:bg-factorcloud-success/90",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"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10",tab:"h-12 px-6 rounded-t-lg"}},defaultVariants:{variant:"default",size:"default"}}),Z=l.forwardRef(({className:e,variant:t,size:r,asChild:o=!1,...s},a)=>{const c=o?ua:"button";return n.jsx(c,{className:X(Vr({variant:t,size:r,className:e})),ref:a,...s})});Z.displayName="Button";const ai=1,ii=1e6;let yr=0;function ci(){return yr=(yr+1)%Number.MAX_SAFE_INTEGER,yr.toString()}const xr=new Map,Eo=e=>{if(xr.has(e))return;const t=setTimeout(()=>{xr.delete(e),Dt({type:"REMOVE_TOAST",toastId:e})},ii);xr.set(e,t)},li=(e,t)=>{switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,ai)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(r=>r.id===t.toast.id?{...r,...t.toast}:r)};case"DISMISS_TOAST":{const{toastId:r}=t;return r?Eo(r):e.toasts.forEach(o=>{Eo(o.id)}),{...e,toasts:e.toasts.map(o=>o.id===r||r===void 0?{...o,open:!1}:o)}}case"REMOVE_TOAST":return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(r=>r.id!==t.toastId)}}},Wt=[];let zt={toasts:[]};function Dt(e){zt=li(zt,e),Wt.forEach(t=>{t(zt)})}function di({...e}){const t=ci(),r=s=>Dt({type:"UPDATE_TOAST",toast:{...s,id:t}}),o=()=>Dt({type:"DISMISS_TOAST",toastId:t});return Dt({type:"ADD_TOAST",toast:{...e,id:t,open:!0,onOpenChange:s=>{s||o()}}}),{id:t,dismiss:o,update:r}}function un(){const[e,t]=l.useState(zt);return l.useEffect(()=>(Wt.push(t),()=>{const r=Wt.indexOf(t);r>-1&&Wt.splice(r,1)}),[e]),{...e,toast:di,dismiss:r=>Dt({type:"DISMISS_TOAST",toastId:r})}}const ui=e=>{if(e)return e.toLowerCase().includes("sandbox")?"sandbox":"production"},dt=e=>e?!!(e.portalduct?.bearer_token&&e.portalduct?.env_url&&e.portalduct?.customer_id&&e.factorcloud?.bearer_token&&e.factorcloud?.factorId&&e.factorcloud?.env_url):!1,fn=(e,t)=>{if(!e?.factorcloud?.factorId)return null;const r=t.portalduct?.api_url??e.portalduct?.env_url??"",o=e.portalduct?.environment??ui(r);return{portalduct:{bearer_token:t.portalduct?.bearer_token??e.portalduct?.bearer_token??"",env_url:r,customer_id:t.customer?.portalduct_customer_uuid??e.portalduct?.customer_id??"",webhook_bearer_token:e.portalduct?.webhook_bearer_token,environment:o,sync_webhook_url:e.portalduct?.sync_webhook_url,verify_webhook_url:e.portalduct?.verify_webhook_url},factorcloud:{bearer_token:t.factorcloud?.bearer_token??e.factorcloud?.bearer_token??"",factorId:e.factorcloud.factorId,env_url:t.factorcloud?.api_url??e.factorcloud?.env_url??"",client_id:e.factorcloud?.client_id}}};class pn{constructor(t,r,o){this.baseUrl=t,this.factorId=r,this.token=o}async getClients(t=100,r=0){if(!this.token)throw new Error("No bearer token provided.");const o=await fetch(`${this.baseUrl}/companies?active=true&type=client`,{method:"GET",headers:{Authorization:`Bearer ${this.token}`,"X-PAGINATION-LIMIT":t.toString(),"X-PAGINATION-NUM":r.toString(),accept:"application/json",factorId:this.factorId}});if(!o.ok)throw new Error(`Failed to fetch clients: ${o.statusText}`);return(await o.json()).companies}async getClientById(t){if(!this.token)throw new Error("No bearer token provided.");const r=await fetch(`${this.baseUrl}/clients/${t}`,{method:"GET",headers:{Authorization:`Bearer ${this.token}`,accept:"application/json",factorId:this.factorId}});if(!r.ok)throw new Error(`Failed to fetch client details: ${r.statusText}`);return(await r.json()).client}async getDebtors(t,r=100,o=0){if(!this.token)throw new Error("No bearer token provided.");const s=await fetch(`${this.baseUrl}/clients/${t}/debtors`,{method:"GET",headers:{Authorization:`Bearer ${this.token}`,"X-PAGINATION-LIMIT":r.toString(),"X-PAGINATION-NUM":o.toString(),accept:"application/json",factorId:this.factorId}});if(!s.ok)throw new Error(`Failed to fetch debtors: ${s.statusText}`);return(await s.json()).clientDebtors}setToken(t){this.token=t}getToken(){return this.token}}class me extends Error{constructor({message:t,status:r,code:o,type:s,requestId:a}){super(t),this.name="PortalDuctAPIError",this.status=r,this.code=o,this.type=s,this.requestId=a}}class mn{constructor(t,r){this.baseUrl=t,this.token=r}async buildError(t,r){let o=r,s,a,c;try{const i=await t.json();i&&typeof i=="object"&&(o=("error_message"in i&&typeof i.error_message=="string"?i.error_message:void 0)??("message"in i&&typeof i.message=="string"?i.message:void 0)??o,s=("error_code"in i&&typeof i.error_code=="string"?i.error_code:void 0)??("code"in i&&typeof i.code=="string"?i.code:void 0)??s,a=("error_type"in i&&typeof i.error_type=="string"?i.error_type:void 0)??("type"in i&&typeof i.type=="string"?i.type:void 0)??a,c=("request_id"in i&&typeof i.request_id=="string"?i.request_id:void 0)??("requestId"in i&&typeof i.requestId=="string"?i.requestId:void 0)??c)}catch(i){console.debug("Failed to parse PortalDuct error response",i)}return new me({message:o,status:t.status,code:s,type:a,requestId:c})}async getCompanies(t){if(!this.token)throw new Error("No bearer token provided.");const r=encodeURIComponent(`customer_id eq ${t}`),o=await fetch(`${this.baseUrl}/v2/companies?filter=${r}`,{method:"GET",headers:{accept:"application/json",authorization:`Bearer ${this.token}`}});if(!o.ok)throw await this.buildError(o,"Failed to fetch companies");return(await o.json()).data}async createCompany(t){if(!this.token)throw new Error("No bearer token provided.");const r=await fetch(`${this.baseUrl}/v2/companies`,{method:"POST",headers:{accept:"application/json",authorization:`Bearer ${this.token}`,"content-type":"application/json"},body:JSON.stringify(t)});if(!r.ok)throw await this.buildError(r,"Failed to create company");return(await r.json()).data}async getConnections(t){if(!this.token)throw new Error("No bearer token provided.");const r=encodeURIComponent(`company.company_id eq '${t}'`),o=await fetch(`${this.baseUrl}/v2/connections?filter=${r}`,{method:"GET",headers:{accept:"application/json",authorization:`Bearer ${this.token}`}});if(!o.ok)throw await this.buildError(o,"Failed to fetch connections");return(await o.json()).data}async createConnection(t){if(!this.token)throw new Error("No bearer token provided.");const r=await fetch(`${this.baseUrl}/v2/connections`,{method:"POST",headers:{accept:"application/json",authorization:`Bearer ${this.token}`,"content-type":"application/json"},body:JSON.stringify(t)});if(!r.ok)throw await this.buildError(r,"Failed to create connection");return(await r.json()).data}async updateConnection(t,r){if(!this.token)throw new Error("No bearer token provided.");const o=await fetch(`${this.baseUrl}/v2/connections/${t}`,{method:"PATCH",headers:{accept:"application/json",authorization:`Bearer ${this.token}`,"content-type":"application/json"},body:JSON.stringify(r)});if(!o.ok)throw await this.buildError(o,"Failed to update connection");return(await o.json()).data}async activateConnection(t){return this.updateActivationStatus(t,"activate")}async deactivateConnection(t){return this.updateActivationStatus(t,"deactivate")}async updateActivationStatus(t,r){if(!this.token)throw new Error("No bearer token provided.");const o={activation_status:r},s=await fetch(`${this.baseUrl}/v2/connections/${t}/activation`,{method:"POST",headers:{accept:"application/json",authorization:`Bearer ${this.token}`,"content-type":"application/json"},body:JSON.stringify(o)});if(!s.ok)throw await this.buildError(s,`Failed to ${r} connection`);return(await s.json()).data}setToken(t){this.token=t}getToken(){return this.token}async getPortalMappings(){if(!this.token)throw new Error("No bearer token provided.");const t=await fetch(`${this.baseUrl}/v2/portal_mappings`,{method:"GET",headers:{accept:"application/json",authorization:`Bearer ${this.token}`}});if(!t.ok)throw await this.buildError(t,"Failed to fetch portal mappings");return(await t.json()).data}async createPortalMapping(t){if(!this.token)throw new Error("No bearer token provided.");const r=await fetch(`${this.baseUrl}/v2/portal_mappings`,{method:"POST",headers:{accept:"application/json",authorization:`Bearer ${this.token}`,"content-type":"application/json"},body:JSON.stringify(t)});if(!r.ok)throw await this.buildError(r,"Failed to create portal mapping");return(await r.json()).data}}const fi="https://khzfuhxnbjlyjvdvxdeg.supabase.co/functions/v1/webhook-sync-connection",pi="https://khzfuhxnbjlyjvdvxdeg.supabase.co/functions/v1/webhook-verify-connection",mi="https://khzfuhxnbjlyjvdvxdeg.supabase.co/functions/v1/check-customer-status";class Gr{constructor({webhookToken:t,customerId:r,webhookUrl:o=fi,verifyWebhookUrl:s=pi,environment:a,portalductBaseUrl:c,customerStatusUrl:i=mi}){this.syncWebhookUrl=o,this.verifyWebhookUrl=s,this.webhookToken=t,this.customerId=r,this.environment=a??this.deriveEnvironmentFromBaseUrl(c),this.customerStatusUrl=i}setWebhookToken(t){this.webhookToken=t}setCustomerId(t){this.customerId=t}setEnvironment(t){this.environment=t}setWebhookUrl(t){this.syncWebhookUrl=t}setVerifyWebhookUrl(t){this.verifyWebhookUrl=t}setCustomerStatusUrl(t){this.customerStatusUrl=t}async triggerConnectionSync(t){return this.callWebhook(this.syncWebhookUrl,t,"Resync")}async triggerConnectionVerification(t){return this.callWebhook(this.verifyWebhookUrl,t,"Verification")}async callWebhook(t,r,o){if(!this.customerId)throw new Error(`No PortalDuct customer ID provided for ${o.toLowerCase()} webhook.`);if(!this.webhookToken)throw new Error(`No webhook bearer token provided for ${o.toLowerCase()} webhook.`);const s=await fetch(t,{method:"POST",headers:{accept:"application/json",authorization:`Bearer ${this.webhookToken}`,"content-type":"application/json"},body:JSON.stringify({portalductCustomerId:this.customerId,connectionId:r,environment:this.environment})});if(!s.ok){const c=await s.text();throw new Error(`${o} failed: ${s.status} ${c}`)}return await s.json()}deriveEnvironmentFromBaseUrl(t){return t&&t.toLowerCase().includes("sandbox")?"sandbox":"production"}async fetchCustomerStatus(t){if(!this.webhookToken)throw new Error("No webhook bearer token provided for customer status webhook.");const r=await fetch(this.customerStatusUrl,{method:"POST",headers:{accept:"application/json",authorization:`Bearer ${this.webhookToken}`,"content-type":"application/json"},body:JSON.stringify({factorId:t,environment:this.environment})});if(!r.ok){const s=await r.text();throw new Error(`Customer status check failed: ${r.status} ${s}`)}const o=await r.json();if(typeof o.active!="boolean")throw new Error("Customer status webhook returned an invalid response.");return o}async isCustomerActive(t){return(await this.fetchCustomerStatus(t)).active}}class Hr{constructor(t){this.config=t,this.factorcloudAPI=new pn(t.factorcloud.env_url,t.factorcloud.factorId,t.factorcloud.bearer_token),this.portalductAPI=new mn(t.portalduct.env_url,t.portalduct.bearer_token),this.connectionSyncAPI=new Gr({webhookToken:t.portalduct.webhook_bearer_token,customerId:t.portalduct.customer_id,environment:t.portalduct.environment,webhookUrl:t.portalduct.sync_webhook_url,verifyWebhookUrl:t.portalduct.verify_webhook_url,portalductBaseUrl:t.portalduct.env_url})}async getFactorCloudClients(){return this.factorcloudAPI.getClients()}async getFactorCloudClient(t){if(t)return await this.factorcloudAPI.getClientById(t);const r=await this.factorcloudAPI.getClients();if(r.length===0)throw new Error("No FactorCloud clients found");return r[0]}async ensurePortalDuctCompany(t){const o=(await this.portalductAPI.getCompanies(this.config.portalduct.customer_id)).find(c=>c.tags.factorcloud_id===t.id);if(o)return o;const s=await this.factorcloudAPI.getClientById(t.id);return await this.portalductAPI.createCompany({name:s.companyName,email:s.email,customer_id:this.config.portalduct.customer_id,tags:{factorcloud_id:s.id}})}async fetchMergedDebtors(t,r){const[o,s]=await Promise.all([this.factorcloudAPI.getDebtors(t),this.portalductAPI.getConnections(r)]);return this.matchConnectionsToDebtors(o,s)}matchConnectionsToDebtors(t,r){return t.map(o=>{const s=r.find(c=>c.tags.factorcloud_debtor_id===o.companyDebtorId);let a="not_connected";return s&&(s.activation_status==="deactivated"?a="deactivated":s.activation_status==="pending"?a="pending":a="connected"),{factorcloudDebtorId:o.companyDebtorId,factorcloudClientId:o.companyClientId,debtorName:o.companyDebtorName,creditLimit:o.creditLimit,termName:o.termName,connection:s,status:a,portalName:s?.portal_name||void 0,lastSync:s?.last_sync||void 0,autoSyncEnabled:s?.auto_sync_status==="enabled",lastSyncSummary:void 0}})}getFactorCloudAPI(){return this.factorcloudAPI}getPortalDuctAPI(){return this.portalductAPI}getConnectionSyncAPI(){return this.connectionSyncAPI}async isCustomerActive(){return this.connectionSyncAPI.isCustomerActive(this.config.factorcloud.factorId)}async triggerConnectionSync(t){return this.connectionSyncAPI.triggerConnectionSync(t)}async triggerConnectionVerification(t){return this.connectionSyncAPI.triggerConnectionVerification(t)}}function te(e,t,{checkForDefaultPrevented:r=!0}={}){return function(s){if(e?.(s),r===!1||!s.defaultPrevented)return t?.(s)}}function hi(e,t){const r=l.createContext(t),o=a=>{const{children:c,...i}=a,u=l.useMemo(()=>i,Object.values(i));return n.jsx(r.Provider,{value:u,children:c})};o.displayName=e+"Provider";function s(a){const c=l.useContext(r);if(c)return c;if(t!==void 0)return t;throw new Error(`\`${a}\` must be used within \`${e}\``)}return[o,s]}function Et(e,t=[]){let r=[];function o(a,c){const i=l.createContext(c),u=r.length;r=[...r,c];const d=p=>{const{scope:m,children:y,...S}=p,g=m?.[e]?.[u]||i,h=l.useMemo(()=>S,Object.values(S));return n.jsx(g.Provider,{value:h,children:y})};d.displayName=a+"Provider";function f(p,m){const y=m?.[e]?.[u]||i,S=l.useContext(y);if(S)return S;if(c!==void 0)return c;throw new Error(`\`${p}\` must be used within \`${a}\``)}return[d,f]}const s=()=>{const a=r.map(c=>l.createContext(c));return function(i){const u=i?.[e]||a;return l.useMemo(()=>({[`__scope${e}`]:{...i,[e]:u}}),[i,u])}};return s.scopeName=e,[o,gi(s,...t)]}function gi(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const o=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(a){const c=o.reduce((i,{useScope:u,scopeName:d})=>{const p=u(a)[`__scope${d}`];return{...i,...p}},{});return l.useMemo(()=>({[`__scope${t.scopeName}`]:c}),[c])}};return r.scopeName=t.scopeName,r}var jt=globalThis?.document?l.useLayoutEffect:()=>{},vi=l[" useId ".trim().toString()]||(()=>{}),bi=0;function Tt(e){const[t,r]=l.useState(vi());return jt(()=>{e||r(o=>o??String(bi++))},[e]),e||(t?`radix-${t}`:"")}var yi=l[" useInsertionEffect ".trim().toString()]||jt;function qr({prop:e,defaultProp:t,onChange:r=()=>{},caller:o}){const[s,a,c]=xi({defaultProp:t,onChange:r}),i=e!==void 0,u=i?e:s;{const f=l.useRef(e!==void 0);l.useEffect(()=>{const p=f.current;p!==i&&console.warn(`${o} is changing from ${p?"controlled":"uncontrolled"} to ${i?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),f.current=i},[i,o])}const d=l.useCallback(f=>{if(i){const p=wi(f)?f(e):f;p!==e&&c.current?.(p)}else a(f)},[i,e,a,c]);return[u,d]}function xi({defaultProp:e,onChange:t}){const[r,o]=l.useState(e),s=l.useRef(r),a=l.useRef(t);return yi(()=>{a.current=t},[t]),l.useEffect(()=>{s.current!==r&&(a.current?.(r),s.current=r)},[r,s]),[r,o,a]}function wi(e){return typeof e=="function"}function Si(e){const t=Ci(e),r=l.forwardRef((o,s)=>{const{children:a,...c}=o,i=l.Children.toArray(a),u=i.find(Ni);if(u){const d=u.props.children,f=i.map(p=>p===u?l.Children.count(d)>1?l.Children.only(null):l.isValidElement(d)?d.props.children:null:p);return n.jsx(t,{...c,ref:s,children:l.isValidElement(d)?l.cloneElement(d,void 0,f):null})}return n.jsx(t,{...c,ref:s,children:a})});return r.displayName=`${e}.Slot`,r}function Ci(e){const t=l.forwardRef((r,o)=>{const{children:s,...a}=r;if(l.isValidElement(s)){const c=ki(s),i=Ei(a,s.props);return s.type!==l.Fragment&&(i.ref=o?It(o,c):c),l.cloneElement(s,i)}return l.Children.count(s)>1?l.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var ji=Symbol("radix.slottable");function Ni(e){return l.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===ji}function Ei(e,t){const r={...t};for(const o in t){const s=e[o],a=t[o];/^on[A-Z]/.test(o)?s&&a?r[o]=(...i)=>{const u=a(...i);return s(...i),u}:s&&(r[o]=s):o==="style"?r[o]={...s,...a}:o==="className"&&(r[o]=[s,a].filter(Boolean).join(" "))}return{...e,...r}}function ki(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var Ai=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ae=Ai.reduce((e,t)=>{const r=Si(`Primitive.${t}`),o=l.forwardRef((s,a)=>{const{asChild:c,...i}=s,u=c?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),n.jsx(u,{...i,ref:a})});return o.displayName=`Primitive.${t}`,{...e,[t]:o}},{});function Pi(e,t){e&&ca.flushSync(()=>e.dispatchEvent(t))}function Oe(e){const t=l.useRef(e);return l.useEffect(()=>{t.current=e}),l.useMemo(()=>(...r)=>t.current?.(...r),[])}function _i(e,t=globalThis?.document){const r=Oe(e);l.useEffect(()=>{const o=s=>{s.key==="Escape"&&r(s)};return t.addEventListener("keydown",o,{capture:!0}),()=>t.removeEventListener("keydown",o,{capture:!0})},[r,t])}var Di="DismissableLayer",Dr="dismissableLayer.update",Ti="dismissableLayer.pointerDownOutside",Ii="dismissableLayer.focusOutside",ko,hn=l.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),gn=l.forwardRef((e,t)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:o,onPointerDownOutside:s,onFocusOutside:a,onInteractOutside:c,onDismiss:i,...u}=e,d=l.useContext(hn),[f,p]=l.useState(null),m=f?.ownerDocument??globalThis?.document,[,y]=l.useState({}),S=de(t,I=>p(I)),g=Array.from(d.layers),[h]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),x=g.indexOf(h),T=f?g.indexOf(f):-1,j=d.layersWithOutsidePointerEventsDisabled.size>0,E=T>=x,w=Fi(I=>{const b=I.target,D=[...d.branches].some(z=>z.contains(b));!E||D||(s?.(I),c?.(I),I.defaultPrevented||i?.())},m),L=Mi(I=>{const b=I.target;[...d.branches].some(z=>z.contains(b))||(a?.(I),c?.(I),I.defaultPrevented||i?.())},m);return _i(I=>{T===d.layers.size-1&&(o?.(I),!I.defaultPrevented&&i&&(I.preventDefault(),i()))},m),l.useEffect(()=>{if(f)return r&&(d.layersWithOutsidePointerEventsDisabled.size===0&&(ko=m.body.style.pointerEvents,m.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(f)),d.layers.add(f),Ao(),()=>{r&&d.layersWithOutsidePointerEventsDisabled.size===1&&(m.body.style.pointerEvents=ko)}},[f,m,r,d]),l.useEffect(()=>()=>{f&&(d.layers.delete(f),d.layersWithOutsidePointerEventsDisabled.delete(f),Ao())},[f,d]),l.useEffect(()=>{const I=()=>y({});return document.addEventListener(Dr,I),()=>document.removeEventListener(Dr,I)},[]),n.jsx(ae.div,{...u,ref:S,style:{pointerEvents:j?E?"auto":"none":void 0,...e.style},onFocusCapture:te(e.onFocusCapture,L.onFocusCapture),onBlurCapture:te(e.onBlurCapture,L.onBlurCapture),onPointerDownCapture:te(e.onPointerDownCapture,w.onPointerDownCapture)})});gn.displayName=Di;var Ri="DismissableLayerBranch",Oi=l.forwardRef((e,t)=>{const r=l.useContext(hn),o=l.useRef(null),s=de(t,o);return l.useEffect(()=>{const a=o.current;if(a)return r.branches.add(a),()=>{r.branches.delete(a)}},[r.branches]),n.jsx(ae.div,{...e,ref:s})});Oi.displayName=Ri;function Fi(e,t=globalThis?.document){const r=Oe(e),o=l.useRef(!1),s=l.useRef(()=>{});return l.useEffect(()=>{const a=i=>{if(i.target&&!o.current){let u=function(){vn(Ti,r,d,{discrete:!0})};const d={originalEvent:i};i.pointerType==="touch"?(t.removeEventListener("click",s.current),s.current=u,t.addEventListener("click",s.current,{once:!0})):u()}else t.removeEventListener("click",s.current);o.current=!1},c=window.setTimeout(()=>{t.addEventListener("pointerdown",a)},0);return()=>{window.clearTimeout(c),t.removeEventListener("pointerdown",a),t.removeEventListener("click",s.current)}},[t,r]),{onPointerDownCapture:()=>o.current=!0}}function Mi(e,t=globalThis?.document){const r=Oe(e),o=l.useRef(!1);return l.useEffect(()=>{const s=a=>{a.target&&!o.current&&vn(Ii,r,{originalEvent:a},{discrete:!1})};return t.addEventListener("focusin",s),()=>t.removeEventListener("focusin",s)},[t,r]),{onFocusCapture:()=>o.current=!0,onBlurCapture:()=>o.current=!1}}function Ao(){const e=new CustomEvent(Dr);document.dispatchEvent(e)}function vn(e,t,r,{discrete:o}){const s=r.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});t&&s.addEventListener(e,t,{once:!0}),o?Pi(s,a):s.dispatchEvent(a)}var wr="focusScope.autoFocusOnMount",Sr="focusScope.autoFocusOnUnmount",Po={bubbles:!1,cancelable:!0},Li="FocusScope",bn=l.forwardRef((e,t)=>{const{loop:r=!1,trapped:o=!1,onMountAutoFocus:s,onUnmountAutoFocus:a,...c}=e,[i,u]=l.useState(null),d=Oe(s),f=Oe(a),p=l.useRef(null),m=de(t,g=>u(g)),y=l.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;l.useEffect(()=>{if(o){let g=function(j){if(y.paused||!i)return;const E=j.target;i.contains(E)?p.current=E:nt(p.current,{select:!0})},h=function(j){if(y.paused||!i)return;const E=j.relatedTarget;E!==null&&(i.contains(E)||nt(p.current,{select:!0}))},x=function(j){if(document.activeElement===document.body)for(const w of j)w.removedNodes.length>0&&nt(i)};document.addEventListener("focusin",g),document.addEventListener("focusout",h);const T=new MutationObserver(x);return i&&T.observe(i,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",g),document.removeEventListener("focusout",h),T.disconnect()}}},[o,i,y.paused]),l.useEffect(()=>{if(i){Do.add(y);const g=document.activeElement;if(!i.contains(g)){const x=new CustomEvent(wr,Po);i.addEventListener(wr,d),i.dispatchEvent(x),x.defaultPrevented||($i(Vi(yn(i)),{select:!0}),document.activeElement===g&&nt(i))}return()=>{i.removeEventListener(wr,d),setTimeout(()=>{const x=new CustomEvent(Sr,Po);i.addEventListener(Sr,f),i.dispatchEvent(x),x.defaultPrevented||nt(g??document.body,{select:!0}),i.removeEventListener(Sr,f),Do.remove(y)},0)}}},[i,d,f,y]);const S=l.useCallback(g=>{if(!r&&!o||y.paused)return;const h=g.key==="Tab"&&!g.altKey&&!g.ctrlKey&&!g.metaKey,x=document.activeElement;if(h&&x){const T=g.currentTarget,[j,E]=Ui(T);j&&E?!g.shiftKey&&x===E?(g.preventDefault(),r&&nt(j,{select:!0})):g.shiftKey&&x===j&&(g.preventDefault(),r&&nt(E,{select:!0})):x===T&&g.preventDefault()}},[r,o,y.paused]);return n.jsx(ae.div,{tabIndex:-1,...c,ref:m,onKeyDown:S})});bn.displayName=Li;function $i(e,{select:t=!1}={}){const r=document.activeElement;for(const o of e)if(nt(o,{select:t}),document.activeElement!==r)return}function Ui(e){const t=yn(e),r=_o(t,e),o=_o(t.reverse(),e);return[r,o]}function yn(e){const t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:o=>{const s=o.tagName==="INPUT"&&o.type==="hidden";return o.disabled||o.hidden||s?NodeFilter.FILTER_SKIP:o.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)t.push(r.currentNode);return t}function _o(e,t){for(const r of e)if(!Bi(r,{upTo:t}))return r}function Bi(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function Wi(e){return e instanceof HTMLInputElement&&"select"in e}function nt(e,{select:t=!1}={}){if(e&&e.focus){const r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&Wi(e)&&t&&e.select()}}var Do=zi();function zi(){let e=[];return{add(t){const r=e[0];t!==r&&r?.pause(),e=To(e,t),e.unshift(t)},remove(t){e=To(e,t),e[0]?.resume()}}}function To(e,t){const r=[...e],o=r.indexOf(t);return o!==-1&&r.splice(o,1),r}function Vi(e){return e.filter(t=>t.tagName!=="A")}var Gi="Portal",xn=l.forwardRef((e,t)=>{const{container:r,...o}=e,[s,a]=l.useState(!1);jt(()=>a(!0),[]);const c=r||s&&globalThis?.document?.body;return c?Go.createPortal(n.jsx(ae.div,{...o,ref:t}),c):null});xn.displayName=Gi;function Hi(e,t){return l.useReducer((r,o)=>t[r][o]??r,e)}var Je=e=>{const{present:t,children:r}=e,o=qi(t),s=typeof r=="function"?r({present:o.isPresent}):l.Children.only(r),a=de(o.ref,Yi(s));return typeof r=="function"||o.isPresent?l.cloneElement(s,{ref:a}):null};Je.displayName="Presence";function qi(e){const[t,r]=l.useState(),o=l.useRef(null),s=l.useRef(e),a=l.useRef("none"),c=e?"mounted":"unmounted",[i,u]=Hi(c,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return l.useEffect(()=>{const d=Mt(o.current);a.current=i==="mounted"?d:"none"},[i]),jt(()=>{const d=o.current,f=s.current;if(f!==e){const m=a.current,y=Mt(d);e?u("MOUNT"):y==="none"||d?.display==="none"?u("UNMOUNT"):u(f&&m!==y?"ANIMATION_OUT":"UNMOUNT"),s.current=e}},[e,u]),jt(()=>{if(t){let d;const f=t.ownerDocument.defaultView??window,p=y=>{const g=Mt(o.current).includes(CSS.escape(y.animationName));if(y.target===t&&g&&(u("ANIMATION_END"),!s.current)){const h=t.style.animationFillMode;t.style.animationFillMode="forwards",d=f.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=h)})}},m=y=>{y.target===t&&(a.current=Mt(o.current))};return t.addEventListener("animationstart",m),t.addEventListener("animationcancel",p),t.addEventListener("animationend",p),()=>{f.clearTimeout(d),t.removeEventListener("animationstart",m),t.removeEventListener("animationcancel",p),t.removeEventListener("animationend",p)}}else u("ANIMATION_END")},[t,u]),{isPresent:["mounted","unmountSuspended"].includes(i),ref:l.useCallback(d=>{o.current=d?getComputedStyle(d):null,r(d)},[])}}function Mt(e){return e?.animationName||"none"}function Yi(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var Cr=0;function Xi(){l.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??Io()),document.body.insertAdjacentElement("beforeend",e[1]??Io()),Cr++,()=>{Cr===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Cr--}},[])}function Io(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var Ge=function(){return Ge=Object.assign||function(t){for(var r,o=1,s=arguments.length;o<s;o++){r=arguments[o];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(t[a]=r[a])}return t},Ge.apply(this,arguments)};function wn(e,t){var r={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(r[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,o=Object.getOwnPropertySymbols(e);s<o.length;s++)t.indexOf(o[s])<0&&Object.prototype.propertyIsEnumerable.call(e,o[s])&&(r[o[s]]=e[o[s]]);return r}function Ki(e,t,r){if(r||arguments.length===2)for(var o=0,s=t.length,a;o<s;o++)(a||!(o in t))&&(a||(a=Array.prototype.slice.call(t,0,o)),a[o]=t[o]);return e.concat(a||Array.prototype.slice.call(t))}var Vt="right-scroll-bar-position",Gt="width-before-scroll-bar",Qi="with-scroll-bars-hidden",Zi="--removed-body-scroll-bar-size";function jr(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function Ji(e,t){var r=v.useState(function(){return{value:e,callback:t,facade:{get current(){return r.value},set current(o){var s=r.value;s!==o&&(r.value=o,r.callback(o,s))}}}})[0];return r.callback=t,r.facade}var ec=typeof window<"u"?l.useLayoutEffect:l.useEffect,Ro=new WeakMap;function tc(e,t){var r=Ji(t||null,function(o){return e.forEach(function(s){return jr(s,o)})});return ec(function(){var o=Ro.get(r);if(o){var s=new Set(o),a=new Set(e),c=r.current;s.forEach(function(i){a.has(i)||jr(i,null)}),a.forEach(function(i){s.has(i)||jr(i,c)})}Ro.set(r,e)},[e]),r}function rc(e){return e}function oc(e,t){t===void 0&&(t=rc);var r=[],o=!1,s={read:function(){if(o)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return r.length?r[r.length-1]:e},useMedium:function(a){var c=t(a,o);return r.push(c),function(){r=r.filter(function(i){return i!==c})}},assignSyncMedium:function(a){for(o=!0;r.length;){var c=r;r=[],c.forEach(a)}r={push:function(i){return a(i)},filter:function(){return r}}},assignMedium:function(a){o=!0;var c=[];if(r.length){var i=r;r=[],i.forEach(a),c=r}var u=function(){var f=c;c=[],f.forEach(a)},d=function(){return Promise.resolve().then(u)};d(),r={push:function(f){c.push(f),d()},filter:function(f){return c=c.filter(f),r}}}};return s}function nc(e){e===void 0&&(e={});var t=oc(null);return t.options=Ge({async:!0,ssr:!1},e),t}var Sn=function(e){var t=e.sideCar,r=wn(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var o=t.read();if(!o)throw new Error("Sidecar medium not found");return l.createElement(o,Ge({},r))};Sn.isSideCarExport=!0;function sc(e,t){return e.useMedium(t),Sn}var Cn=nc(),Nr=function(){},er=l.forwardRef(function(e,t){var r=l.useRef(null),o=l.useState({onScrollCapture:Nr,onWheelCapture:Nr,onTouchMoveCapture:Nr}),s=o[0],a=o[1],c=e.forwardProps,i=e.children,u=e.className,d=e.removeScrollBar,f=e.enabled,p=e.shards,m=e.sideCar,y=e.noRelative,S=e.noIsolation,g=e.inert,h=e.allowPinchZoom,x=e.as,T=x===void 0?"div":x,j=e.gapMode,E=wn(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),w=m,L=tc([r,t]),I=Ge(Ge({},E),s);return l.createElement(l.Fragment,null,f&&l.createElement(w,{sideCar:Cn,removeScrollBar:d,shards:p,noRelative:y,noIsolation:S,inert:g,setCallbacks:a,allowPinchZoom:!!h,lockRef:r,gapMode:j}),c?l.cloneElement(l.Children.only(i),Ge(Ge({},I),{ref:L})):l.createElement(T,Ge({},I,{className:u,ref:L}),i))});er.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};er.classNames={fullWidth:Gt,zeroRight:Vt};var Oo,ac=function(){if(Oo)return Oo;if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function ic(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=ac();return t&&e.setAttribute("nonce",t),e}function cc(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function lc(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var dc=function(){var e=0,t=null;return{add:function(r){e==0&&(t=ic())&&(cc(t,r),lc(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},uc=function(){var e=dc();return function(t,r){l.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&r])}},jn=function(){var e=uc(),t=function(r){var o=r.styles,s=r.dynamic;return e(o,s),null};return t},fc={left:0,top:0,right:0,gap:0},Er=function(e){return parseInt(e||"",10)||0},pc=function(e){var t=window.getComputedStyle(document.body),r=t[e==="padding"?"paddingLeft":"marginLeft"],o=t[e==="padding"?"paddingTop":"marginTop"],s=t[e==="padding"?"paddingRight":"marginRight"];return[Er(r),Er(o),Er(s)]},mc=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return fc;var t=pc(e),r=document.documentElement.clientWidth,o=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,o-r+t[2]-t[0])}},hc=jn(),St="data-scroll-locked",gc=function(e,t,r,o){var s=e.left,a=e.top,c=e.right,i=e.gap;return r===void 0&&(r="margin"),`
3
+ .`.concat(Qi,` {
4
+ overflow: hidden `).concat(o,`;
5
+ padding-right: `).concat(i,"px ").concat(o,`;
6
+ }
7
+ body[`).concat(St,`] {
8
+ overflow: hidden `).concat(o,`;
9
+ overscroll-behavior: contain;
10
+ `).concat([t&&"position: relative ".concat(o,";"),r==="margin"&&`
11
+ padding-left: `.concat(s,`px;
12
+ padding-top: `).concat(a,`px;
13
+ padding-right: `).concat(c,`px;
14
+ margin-left:0;
15
+ margin-top:0;
16
+ margin-right: `).concat(i,"px ").concat(o,`;
17
+ `),r==="padding"&&"padding-right: ".concat(i,"px ").concat(o,";")].filter(Boolean).join(""),`
18
+ }
19
+
20
+ .`).concat(Vt,` {
21
+ right: `).concat(i,"px ").concat(o,`;
22
+ }
23
+
24
+ .`).concat(Gt,` {
25
+ margin-right: `).concat(i,"px ").concat(o,`;
26
+ }
27
+
28
+ .`).concat(Vt," .").concat(Vt,` {
29
+ right: 0 `).concat(o,`;
30
+ }
31
+
32
+ .`).concat(Gt," .").concat(Gt,` {
33
+ margin-right: 0 `).concat(o,`;
34
+ }
35
+
36
+ body[`).concat(St,`] {
37
+ `).concat(Zi,": ").concat(i,`px;
38
+ }
39
+ `)},Fo=function(){var e=parseInt(document.body.getAttribute(St)||"0",10);return isFinite(e)?e:0},vc=function(){l.useEffect(function(){return document.body.setAttribute(St,(Fo()+1).toString()),function(){var e=Fo()-1;e<=0?document.body.removeAttribute(St):document.body.setAttribute(St,e.toString())}},[])},bc=function(e){var t=e.noRelative,r=e.noImportant,o=e.gapMode,s=o===void 0?"margin":o;vc();var a=l.useMemo(function(){return mc(s)},[s]);return l.createElement(hc,{styles:gc(a,!t,s,r?"":"!important")})},Tr=!1;if(typeof window<"u")try{var Lt=Object.defineProperty({},"passive",{get:function(){return Tr=!0,!0}});window.addEventListener("test",Lt,Lt),window.removeEventListener("test",Lt,Lt)}catch{Tr=!1}var yt=Tr?{passive:!1}:!1,yc=function(e){return e.tagName==="TEXTAREA"},Nn=function(e,t){if(!(e instanceof Element))return!1;var r=window.getComputedStyle(e);return r[t]!=="hidden"&&!(r.overflowY===r.overflowX&&!yc(e)&&r[t]==="visible")},xc=function(e){return Nn(e,"overflowY")},wc=function(e){return Nn(e,"overflowX")},Mo=function(e,t){var r=t.ownerDocument,o=t;do{typeof ShadowRoot<"u"&&o instanceof ShadowRoot&&(o=o.host);var s=En(e,o);if(s){var a=kn(e,o),c=a[1],i=a[2];if(c>i)return!0}o=o.parentNode}while(o&&o!==r.body);return!1},Sc=function(e){var t=e.scrollTop,r=e.scrollHeight,o=e.clientHeight;return[t,r,o]},Cc=function(e){var t=e.scrollLeft,r=e.scrollWidth,o=e.clientWidth;return[t,r,o]},En=function(e,t){return e==="v"?xc(t):wc(t)},kn=function(e,t){return e==="v"?Sc(t):Cc(t)},jc=function(e,t){return e==="h"&&t==="rtl"?-1:1},Nc=function(e,t,r,o,s){var a=jc(e,window.getComputedStyle(t).direction),c=a*o,i=r.target,u=t.contains(i),d=!1,f=c>0,p=0,m=0;do{if(!i)break;var y=kn(e,i),S=y[0],g=y[1],h=y[2],x=g-h-a*S;(S||x)&&En(e,i)&&(p+=x,m+=S);var T=i.parentNode;i=T&&T.nodeType===Node.DOCUMENT_FRAGMENT_NODE?T.host:T}while(!u&&i!==document.body||u&&(t.contains(i)||t===i));return(f&&(s&&Math.abs(p)<1||!s&&c>p)||!f&&(s&&Math.abs(m)<1||!s&&-c>m))&&(d=!0),d},$t=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Lo=function(e){return[e.deltaX,e.deltaY]},$o=function(e){return e&&"current"in e?e.current:e},Ec=function(e,t){return e[0]===t[0]&&e[1]===t[1]},kc=function(e){return`
40
+ .block-interactivity-`.concat(e,` {pointer-events: none;}
41
+ .allow-interactivity-`).concat(e,` {pointer-events: all;}
42
+ `)},Ac=0,xt=[];function Pc(e){var t=l.useRef([]),r=l.useRef([0,0]),o=l.useRef(),s=l.useState(Ac++)[0],a=l.useState(jn)[0],c=l.useRef(e);l.useEffect(function(){c.current=e},[e]),l.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(s));var g=Ki([e.lockRef.current],(e.shards||[]).map($o),!0).filter(Boolean);return g.forEach(function(h){return h.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),g.forEach(function(h){return h.classList.remove("allow-interactivity-".concat(s))})}}},[e.inert,e.lockRef.current,e.shards]);var i=l.useCallback(function(g,h){if("touches"in g&&g.touches.length===2||g.type==="wheel"&&g.ctrlKey)return!c.current.allowPinchZoom;var x=$t(g),T=r.current,j="deltaX"in g?g.deltaX:T[0]-x[0],E="deltaY"in g?g.deltaY:T[1]-x[1],w,L=g.target,I=Math.abs(j)>Math.abs(E)?"h":"v";if("touches"in g&&I==="h"&&L.type==="range")return!1;var b=window.getSelection(),D=b&&b.anchorNode,z=D?D===L||D.contains(L):!1;if(z)return!1;var q=Mo(I,L);if(!q)return!0;if(q?w=I:(w=I==="v"?"h":"v",q=Mo(I,L)),!q)return!1;if(!o.current&&"changedTouches"in g&&(j||E)&&(o.current=w),!w)return!0;var se=o.current||w;return Nc(se,h,g,se==="h"?j:E,!0)},[]),u=l.useCallback(function(g){var h=g;if(!(!xt.length||xt[xt.length-1]!==a)){var x="deltaY"in h?Lo(h):$t(h),T=t.current.filter(function(w){return w.name===h.type&&(w.target===h.target||h.target===w.shadowParent)&&Ec(w.delta,x)})[0];if(T&&T.should){h.cancelable&&h.preventDefault();return}if(!T){var j=(c.current.shards||[]).map($o).filter(Boolean).filter(function(w){return w.contains(h.target)}),E=j.length>0?i(h,j[0]):!c.current.noIsolation;E&&h.cancelable&&h.preventDefault()}}},[]),d=l.useCallback(function(g,h,x,T){var j={name:g,delta:h,target:x,should:T,shadowParent:_c(x)};t.current.push(j),setTimeout(function(){t.current=t.current.filter(function(E){return E!==j})},1)},[]),f=l.useCallback(function(g){r.current=$t(g),o.current=void 0},[]),p=l.useCallback(function(g){d(g.type,Lo(g),g.target,i(g,e.lockRef.current))},[]),m=l.useCallback(function(g){d(g.type,$t(g),g.target,i(g,e.lockRef.current))},[]);l.useEffect(function(){return xt.push(a),e.setCallbacks({onScrollCapture:p,onWheelCapture:p,onTouchMoveCapture:m}),document.addEventListener("wheel",u,yt),document.addEventListener("touchmove",u,yt),document.addEventListener("touchstart",f,yt),function(){xt=xt.filter(function(g){return g!==a}),document.removeEventListener("wheel",u,yt),document.removeEventListener("touchmove",u,yt),document.removeEventListener("touchstart",f,yt)}},[]);var y=e.removeScrollBar,S=e.inert;return l.createElement(l.Fragment,null,S?l.createElement(a,{styles:kc(s)}):null,y?l.createElement(bc,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function _c(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const Dc=sc(Cn,Pc);var An=l.forwardRef(function(e,t){return l.createElement(er,Ge({},e,{ref:t,sideCar:Dc}))});An.classNames=er.classNames;const Tc=An;var Ic=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},wt=new WeakMap,Ut=new WeakMap,Bt={},kr=0,Pn=function(e){return e&&(e.host||Pn(e.parentNode))},Rc=function(e,t){return t.map(function(r){if(e.contains(r))return r;var o=Pn(r);return o&&e.contains(o)?o:(console.error("aria-hidden",r,"in not contained inside",e,". Doing nothing"),null)}).filter(function(r){return!!r})},Oc=function(e,t,r,o){var s=Rc(t,Array.isArray(e)?e:[e]);Bt[r]||(Bt[r]=new WeakMap);var a=Bt[r],c=[],i=new Set,u=new Set(s),d=function(p){!p||i.has(p)||(i.add(p),d(p.parentNode))};s.forEach(d);var f=function(p){!p||u.has(p)||Array.prototype.forEach.call(p.children,function(m){if(i.has(m))f(m);else try{var y=m.getAttribute(o),S=y!==null&&y!=="false",g=(wt.get(m)||0)+1,h=(a.get(m)||0)+1;wt.set(m,g),a.set(m,h),c.push(m),g===1&&S&&Ut.set(m,!0),h===1&&m.setAttribute(r,"true"),S||m.setAttribute(o,"true")}catch(x){console.error("aria-hidden: cannot operate on ",m,x)}})};return f(t),i.clear(),kr++,function(){c.forEach(function(p){var m=wt.get(p)-1,y=a.get(p)-1;wt.set(p,m),a.set(p,y),m||(Ut.has(p)||p.removeAttribute(o),Ut.delete(p)),y||p.removeAttribute(r)}),kr--,kr||(wt=new WeakMap,wt=new WeakMap,Ut=new WeakMap,Bt={})}},Fc=function(e,t,r){r===void 0&&(r="data-aria-hidden");var o=Array.from(Array.isArray(e)?e:[e]),s=t||Ic(e);return s?(o.push.apply(o,Array.from(s.querySelectorAll("[aria-live], script"))),Oc(o,s,r,"aria-hidden")):function(){return null}};function Mc(e){const t=Lc(e),r=l.forwardRef((o,s)=>{const{children:a,...c}=o,i=l.Children.toArray(a),u=i.find(Uc);if(u){const d=u.props.children,f=i.map(p=>p===u?l.Children.count(d)>1?l.Children.only(null):l.isValidElement(d)?d.props.children:null:p);return n.jsx(t,{...c,ref:s,children:l.isValidElement(d)?l.cloneElement(d,void 0,f):null})}return n.jsx(t,{...c,ref:s,children:a})});return r.displayName=`${e}.Slot`,r}function Lc(e){const t=l.forwardRef((r,o)=>{const{children:s,...a}=r;if(l.isValidElement(s)){const c=Wc(s),i=Bc(a,s.props);return s.type!==l.Fragment&&(i.ref=o?It(o,c):c),l.cloneElement(s,i)}return l.Children.count(s)>1?l.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var $c=Symbol("radix.slottable");function Uc(e){return l.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===$c}function Bc(e,t){const r={...t};for(const o in t){const s=e[o],a=t[o];/^on[A-Z]/.test(o)?s&&a?r[o]=(...i)=>{const u=a(...i);return s(...i),u}:s&&(r[o]=s):o==="style"?r[o]={...s,...a}:o==="className"&&(r[o]=[s,a].filter(Boolean).join(" "))}return{...e,...r}}function Wc(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var tr="Dialog",[_n,Dn]=Et(tr),[zc,ze]=_n(tr),Tn=e=>{const{__scopeDialog:t,children:r,open:o,defaultOpen:s,onOpenChange:a,modal:c=!0}=e,i=l.useRef(null),u=l.useRef(null),[d,f]=qr({prop:o,defaultProp:s??!1,onChange:a,caller:tr});return n.jsx(zc,{scope:t,triggerRef:i,contentRef:u,contentId:Tt(),titleId:Tt(),descriptionId:Tt(),open:d,onOpenChange:f,onOpenToggle:l.useCallback(()=>f(p=>!p),[f]),modal:c,children:r})};Tn.displayName=tr;var In="DialogTrigger",Rn=l.forwardRef((e,t)=>{const{__scopeDialog:r,...o}=e,s=ze(In,r),a=de(t,s.triggerRef);return n.jsx(ae.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":Kr(s.open),...o,ref:a,onClick:te(e.onClick,s.onOpenToggle)})});Rn.displayName=In;var Yr="DialogPortal",[Vc,On]=_n(Yr,{forceMount:void 0}),Fn=e=>{const{__scopeDialog:t,forceMount:r,children:o,container:s}=e,a=ze(Yr,t);return n.jsx(Vc,{scope:t,forceMount:r,children:l.Children.map(o,c=>n.jsx(Je,{present:r||a.open,children:n.jsx(xn,{asChild:!0,container:s,children:c})}))})};Fn.displayName=Yr;var Yt="DialogOverlay",Mn=l.forwardRef((e,t)=>{const r=On(Yt,e.__scopeDialog),{forceMount:o=r.forceMount,...s}=e,a=ze(Yt,e.__scopeDialog);return a.modal?n.jsx(Je,{present:o||a.open,children:n.jsx(Hc,{...s,ref:t})}):null});Mn.displayName=Yt;var Gc=Mc("DialogOverlay.RemoveScroll"),Hc=l.forwardRef((e,t)=>{const{__scopeDialog:r,...o}=e,s=ze(Yt,r);return n.jsx(Tc,{as:Gc,allowPinchZoom:!0,shards:[s.contentRef],children:n.jsx(ae.div,{"data-state":Kr(s.open),...o,ref:t,style:{pointerEvents:"auto",...o.style}})})}),ut="DialogContent",Ln=l.forwardRef((e,t)=>{const r=On(ut,e.__scopeDialog),{forceMount:o=r.forceMount,...s}=e,a=ze(ut,e.__scopeDialog);return n.jsx(Je,{present:o||a.open,children:a.modal?n.jsx(qc,{...s,ref:t}):n.jsx(Yc,{...s,ref:t})})});Ln.displayName=ut;var qc=l.forwardRef((e,t)=>{const r=ze(ut,e.__scopeDialog),o=l.useRef(null),s=de(t,r.contentRef,o);return l.useEffect(()=>{const a=o.current;if(a)return Fc(a)},[]),n.jsx($n,{...e,ref:s,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:te(e.onCloseAutoFocus,a=>{a.preventDefault(),r.triggerRef.current?.focus()}),onPointerDownOutside:te(e.onPointerDownOutside,a=>{const c=a.detail.originalEvent,i=c.button===0&&c.ctrlKey===!0;(c.button===2||i)&&a.preventDefault()}),onFocusOutside:te(e.onFocusOutside,a=>a.preventDefault())})}),Yc=l.forwardRef((e,t)=>{const r=ze(ut,e.__scopeDialog),o=l.useRef(!1),s=l.useRef(!1);return n.jsx($n,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:a=>{e.onCloseAutoFocus?.(a),a.defaultPrevented||(o.current||r.triggerRef.current?.focus(),a.preventDefault()),o.current=!1,s.current=!1},onInteractOutside:a=>{e.onInteractOutside?.(a),a.defaultPrevented||(o.current=!0,a.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const c=a.target;r.triggerRef.current?.contains(c)&&a.preventDefault(),a.detail.originalEvent.type==="focusin"&&s.current&&a.preventDefault()}})}),$n=l.forwardRef((e,t)=>{const{__scopeDialog:r,trapFocus:o,onOpenAutoFocus:s,onCloseAutoFocus:a,...c}=e,i=ze(ut,r),u=l.useRef(null),d=de(t,u);return Xi(),n.jsxs(n.Fragment,{children:[n.jsx(bn,{asChild:!0,loop:!0,trapped:o,onMountAutoFocus:s,onUnmountAutoFocus:a,children:n.jsx(gn,{role:"dialog",id:i.contentId,"aria-describedby":i.descriptionId,"aria-labelledby":i.titleId,"data-state":Kr(i.open),...c,ref:d,onDismiss:()=>i.onOpenChange(!1)})}),n.jsxs(n.Fragment,{children:[n.jsx(Kc,{titleId:i.titleId}),n.jsx(Zc,{contentRef:u,descriptionId:i.descriptionId})]})]})}),Xr="DialogTitle",Un=l.forwardRef((e,t)=>{const{__scopeDialog:r,...o}=e,s=ze(Xr,r);return n.jsx(ae.h2,{id:s.titleId,...o,ref:t})});Un.displayName=Xr;var Bn="DialogDescription",Wn=l.forwardRef((e,t)=>{const{__scopeDialog:r,...o}=e,s=ze(Bn,r);return n.jsx(ae.p,{id:s.descriptionId,...o,ref:t})});Wn.displayName=Bn;var zn="DialogClose",Vn=l.forwardRef((e,t)=>{const{__scopeDialog:r,...o}=e,s=ze(zn,r);return n.jsx(ae.button,{type:"button",...o,ref:t,onClick:te(e.onClick,()=>s.onOpenChange(!1))})});Vn.displayName=zn;function Kr(e){return e?"open":"closed"}var Gn="DialogTitleWarning",[Xc,Hn]=hi(Gn,{contentName:ut,titleName:Xr,docsSlug:"dialog"}),Kc=({titleId:e})=>{const t=Hn(Gn),r=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
43
+
44
+ If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
45
+
46
+ For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return l.useEffect(()=>{e&&(document.getElementById(e)||console.error(r))},[r,e]),null},Qc="DialogDescriptionWarning",Zc=({contentRef:e,descriptionId:t})=>{const o=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Hn(Qc).contentName}}.`;return l.useEffect(()=>{const s=e.current?.getAttribute("aria-describedby");t&&s&&(document.getElementById(t)||console.warn(o))},[o,e,t]),null},qn=Tn,Jc=Rn,Yn=Fn,Qr=Mn,Zr=Ln,Jr=Un,eo=Wn,to=Vn;const mt=qn,el=Yn,Xn=l.forwardRef(({className:e,...t},r)=>n.jsx(Qr,{ref:r,className:X("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",e),...t}));Xn.displayName=Qr.displayName;const at=l.forwardRef(({className:e,children:t,...r},o)=>n.jsxs(el,{children:[n.jsx(Xn,{}),n.jsxs(Zr,{ref:o,className:X("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",e),...r,children:[t,n.jsxs(to,{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",children:[n.jsx(Y.X,{className:"h-4 w-4"}),n.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));at.displayName=Zr.displayName;const Ke=({className:e,...t})=>n.jsx("div",{className:X("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});Ke.displayName="DialogHeader";const Kn=({className:e,...t})=>n.jsx("div",{className:X("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});Kn.displayName="DialogFooter";const Qe=l.forwardRef(({className:e,...t},r)=>n.jsx(Jr,{ref:r,className:X("text-lg font-semibold leading-none tracking-tight",e),...t}));Qe.displayName=Jr.displayName;const Ze=l.forwardRef(({className:e,...t},r)=>n.jsx(eo,{ref:r,className:X("text-sm text-muted-foreground",e),...t}));Ze.displayName=eo.displayName;var he=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof global<"u"&&global||{},Ce={searchParams:"URLSearchParams"in he,iterable:"Symbol"in he&&"iterator"in Symbol,blob:"FileReader"in he&&"Blob"in he&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in he,arrayBuffer:"ArrayBuffer"in he};function tl(e){return e&&DataView.prototype.isPrototypeOf(e)}if(Ce.arrayBuffer)var rl=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],ol=ArrayBuffer.isView||function(e){return e&&rl.indexOf(Object.prototype.toString.call(e))>-1};function kt(e){if(typeof e!="string"&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(e)||e==="")throw new TypeError('Invalid character in header field name: "'+e+'"');return e.toLowerCase()}function ro(e){return typeof e!="string"&&(e=String(e)),e}function oo(e){var t={next:function(){var r=e.shift();return{done:r===void 0,value:r}}};return Ce.iterable&&(t[Symbol.iterator]=function(){return t}),t}function ce(e){this.map={},e instanceof ce?e.forEach(function(t,r){this.append(r,t)},this):Array.isArray(e)?e.forEach(function(t){if(t.length!=2)throw new TypeError("Headers constructor: expected name/value pair to be length 2, found"+t.length);this.append(t[0],t[1])},this):e&&Object.getOwnPropertyNames(e).forEach(function(t){this.append(t,e[t])},this)}ce.prototype.append=function(e,t){e=kt(e),t=ro(t);var r=this.map[e];this.map[e]=r?r+", "+t:t};ce.prototype.delete=function(e){delete this.map[kt(e)]};ce.prototype.get=function(e){return e=kt(e),this.has(e)?this.map[e]:null};ce.prototype.has=function(e){return this.map.hasOwnProperty(kt(e))};ce.prototype.set=function(e,t){this.map[kt(e)]=ro(t)};ce.prototype.forEach=function(e,t){for(var r in this.map)this.map.hasOwnProperty(r)&&e.call(t,this.map[r],r,this)};ce.prototype.keys=function(){var e=[];return this.forEach(function(t,r){e.push(r)}),oo(e)};ce.prototype.values=function(){var e=[];return this.forEach(function(t){e.push(t)}),oo(e)};ce.prototype.entries=function(){var e=[];return this.forEach(function(t,r){e.push([r,t])}),oo(e)};Ce.iterable&&(ce.prototype[Symbol.iterator]=ce.prototype.entries);function Ar(e){if(!e._noBody){if(e.bodyUsed)return Promise.reject(new TypeError("Already read"));e.bodyUsed=!0}}function Qn(e){return new Promise(function(t,r){e.onload=function(){t(e.result)},e.onerror=function(){r(e.error)}})}function nl(e){var t=new FileReader,r=Qn(t);return t.readAsArrayBuffer(e),r}function sl(e){var t=new FileReader,r=Qn(t),o=/charset=([A-Za-z0-9_-]+)/.exec(e.type),s=o?o[1]:"utf-8";return t.readAsText(e,s),r}function al(e){for(var t=new Uint8Array(e),r=new Array(t.length),o=0;o<t.length;o++)r[o]=String.fromCharCode(t[o]);return r.join("")}function Uo(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function Zn(){return this.bodyUsed=!1,this._initBody=function(e){this.bodyUsed=this.bodyUsed,this._bodyInit=e,e?typeof e=="string"?this._bodyText=e:Ce.blob&&Blob.prototype.isPrototypeOf(e)?this._bodyBlob=e:Ce.formData&&FormData.prototype.isPrototypeOf(e)?this._bodyFormData=e:Ce.searchParams&&URLSearchParams.prototype.isPrototypeOf(e)?this._bodyText=e.toString():Ce.arrayBuffer&&Ce.blob&&tl(e)?(this._bodyArrayBuffer=Uo(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):Ce.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(e)||ol(e))?this._bodyArrayBuffer=Uo(e):this._bodyText=e=Object.prototype.toString.call(e):(this._noBody=!0,this._bodyText=""),this.headers.get("content-type")||(typeof e=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):Ce.searchParams&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},Ce.blob&&(this.blob=function(){var e=Ar(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))}),this.arrayBuffer=function(){if(this._bodyArrayBuffer){var e=Ar(this);return e||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}else{if(Ce.blob)return this.blob().then(nl);throw new Error("could not read as ArrayBuffer")}},this.text=function(){var e=Ar(this);if(e)return e;if(this._bodyBlob)return sl(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(al(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},Ce.formData&&(this.formData=function(){return this.text().then(ll)}),this.json=function(){return this.text().then(JSON.parse)},this}var il=["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"];function cl(e){var t=e.toUpperCase();return il.indexOf(t)>-1?t:e}function ft(e,t){if(!(this instanceof ft))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');t=t||{};var r=t.body;if(e instanceof ft){if(e.bodyUsed)throw new TypeError("Already read");this.url=e.url,this.credentials=e.credentials,t.headers||(this.headers=new ce(e.headers)),this.method=e.method,this.mode=e.mode,this.signal=e.signal,!r&&e._bodyInit!=null&&(r=e._bodyInit,e.bodyUsed=!0)}else this.url=String(e);if(this.credentials=t.credentials||this.credentials||"same-origin",(t.headers||!this.headers)&&(this.headers=new ce(t.headers)),this.method=cl(t.method||this.method||"GET"),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal||function(){if("AbortController"in he){var a=new AbortController;return a.signal}}(),this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&r)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(r),(this.method==="GET"||this.method==="HEAD")&&(t.cache==="no-store"||t.cache==="no-cache")){var o=/([?&])_=[^&]*/;if(o.test(this.url))this.url=this.url.replace(o,"$1_="+new Date().getTime());else{var s=/\?/;this.url+=(s.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}ft.prototype.clone=function(){return new ft(this,{body:this._bodyInit})};function ll(e){var t=new FormData;return e.trim().split("&").forEach(function(r){if(r){var o=r.split("="),s=o.shift().replace(/\+/g," "),a=o.join("=").replace(/\+/g," ");t.append(decodeURIComponent(s),decodeURIComponent(a))}}),t}function dl(e){var t=new ce,r=e.replace(/\r?\n[\t ]+/g," ");return r.split("\r").map(function(o){return o.indexOf(`
47
+ `)===0?o.substr(1,o.length):o}).forEach(function(o){var s=o.split(":"),a=s.shift().trim();if(a){var c=s.join(":").trim();try{t.append(a,c)}catch(i){console.warn("Response "+i.message)}}}),t}Zn.call(ft.prototype);function He(e,t){if(!(this instanceof He))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');if(t||(t={}),this.type="default",this.status=t.status===void 0?200:t.status,this.status<200||this.status>599)throw new RangeError("Failed to construct 'Response': The status provided (0) is outside the range [200, 599].");this.ok=this.status>=200&&this.status<300,this.statusText=t.statusText===void 0?"":""+t.statusText,this.headers=new ce(t.headers),this.url=t.url||"",this._initBody(e)}Zn.call(He.prototype);He.prototype.clone=function(){return new He(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new ce(this.headers),url:this.url})};He.error=function(){var e=new He(null,{status:200,statusText:""});return e.ok=!1,e.status=0,e.type="error",e};var ul=[301,302,303,307,308];He.redirect=function(e,t){if(ul.indexOf(t)===-1)throw new RangeError("Invalid status code");return new He(null,{status:t,headers:{location:e}})};var lt=he.DOMException;try{new lt}catch{lt=function(t,r){this.message=t,this.name=r;var o=Error(t);this.stack=o.stack},lt.prototype=Object.create(Error.prototype),lt.prototype.constructor=lt}function Jn(e,t){return new Promise(function(r,o){var s=new ft(e,t);if(s.signal&&s.signal.aborted)return o(new lt("Aborted","AbortError"));var a=new XMLHttpRequest;function c(){a.abort()}a.onload=function(){var d={statusText:a.statusText,headers:dl(a.getAllResponseHeaders()||"")};s.url.indexOf("file://")===0&&(a.status<200||a.status>599)?d.status=200:d.status=a.status,d.url="responseURL"in a?a.responseURL:d.headers.get("X-Request-URL");var f="response"in a?a.response:a.responseText;setTimeout(function(){r(new He(f,d))},0)},a.onerror=function(){setTimeout(function(){o(new TypeError("Network request failed"))},0)},a.ontimeout=function(){setTimeout(function(){o(new TypeError("Network request timed out"))},0)},a.onabort=function(){setTimeout(function(){o(new lt("Aborted","AbortError"))},0)};function i(d){try{return d===""&&he.location.href?he.location.href:d}catch{return d}}if(a.open(s.method,i(s.url),!0),s.credentials==="include"?a.withCredentials=!0:s.credentials==="omit"&&(a.withCredentials=!1),"responseType"in a&&(Ce.blob?a.responseType="blob":Ce.arrayBuffer&&(a.responseType="arraybuffer")),t&&typeof t.headers=="object"&&!(t.headers instanceof ce||he.Headers&&t.headers instanceof he.Headers)){var u=[];Object.getOwnPropertyNames(t.headers).forEach(function(d){u.push(kt(d)),a.setRequestHeader(d,ro(t.headers[d]))}),s.headers.forEach(function(d,f){u.indexOf(f)===-1&&a.setRequestHeader(f,d)})}else s.headers.forEach(function(d,f){a.setRequestHeader(f,d)});s.signal&&(s.signal.addEventListener("abort",c),a.onreadystatechange=function(){a.readyState===4&&s.signal.removeEventListener("abort",c)}),a.send(typeof s._bodyInit>"u"?null:s._bodyInit)})}Jn.polyfill=!0;he.fetch||(he.fetch=Jn,he.Headers=ce,he.Request=ft,he.Response=He);var fl="https://submit-form.com",pl=function(t){var r=v.useState(!1),o=r[0],s=r[1],a=function(i){return new Promise(function(u,d){var f=fl+"/"+t.formId,p="POST",m={Accept:"application/json","Content-Type":"application/json"},y=JSON.stringify(i);s(!0),fetch(f,{method:p,headers:m,body:y}).then(function(S){return S.json()}).then(function(S){u(S)}).catch(function(S){d(S)}).finally(function(){s(!1)})})};return[a,o]};const ml="wXZIqo61i";function es({open:e,onOpenChange:t}){const[r,o]=pl({formId:ml}),[s,a]=v.useState(""),[c,i]=v.useState(""),[u,d]=v.useState(""),[f,p]=v.useState(!1),m=async y=>{y.preventDefault(),await r({name:s,email:c,company:u}),p(!0)};return n.jsx(mt,{open:e,onOpenChange:t,children:n.jsxs(at,{className:"max-w-4xl p-0 overflow-hidden",children:[n.jsxs(Ke,{className:"sr-only",children:[n.jsx(Qe,{children:"Register your interest"}),n.jsx(Ze,{children:"Submit your details for invoice syncing."})]}),n.jsxs("div",{className:"flex flex-col md:flex-row h-full",children:[n.jsxs("aside",{className:"w-full md:w-1/2 bg-black text-white p-8 flex flex-col justify-center space-y-10 relative overflow-hidden",children:[n.jsxs("div",{className:"space-y-3",children:[n.jsx("h2",{className:"text-3xl font-bold leading-snug tracking-tight",children:"Connect & Sync your Invoices"}),n.jsx("p",{className:"text-base text-white/90 leading-relaxed max-w-sm",children:"Connect your debtor portals once and we’ll sync your invoices automatically"})]}),n.jsx("ul",{className:"space-y-5 text-sm",children:["Connect once, stay synced forever. No more uploads.","Work smarter, not harder. Automate the boring stuff and focus on what moves the needle.","Always up to date. Every debtor portal, every invoice — perfectly in sync."].map((y,S)=>n.jsxs("li",{className:"flex items-start gap-3",children:[n.jsx(Y.CheckCircle2,{className:"mt-0.5 h-5 w-5 text-emerald-300 flex-shrink-0"}),n.jsx("span",{className:"leading-relaxed",children:y})]},S))})]}),n.jsx("div",{className:"w-full md:w-1/2 p-8 bg-white",children:f?n.jsxs("div",{className:"text-center py-12",children:[n.jsx("h3",{className:"text-xl font-semibold mb-3",children:"Thank you!"}),n.jsx("p",{className:"text-gray-600",children:"We've received your interest. Our team will be in touch in the coming days."}),n.jsx(Z,{className:"mt-6",onClick:()=>t(!1),children:"Close"})]}):n.jsxs(n.Fragment,{children:[n.jsx("h3",{className:"text-lg font-semibold mb-2",children:"Register your interest"}),n.jsxs("form",{onSubmit:m,className:"space-y-4",children:[n.jsxs("div",{children:[n.jsx("label",{className:"text-sm font-medium",children:"Name"}),n.jsx("input",{required:!0,type:"text",className:"w-full border p-2 rounded mt-1",value:s,onChange:y=>a(y.target.value)})]}),n.jsxs("div",{children:[n.jsx("label",{className:"text-sm font-medium",children:"Email"}),n.jsx("input",{required:!0,type:"email",className:"w-full border p-2 rounded mt-1",value:c,onChange:y=>i(y.target.value)})]}),n.jsxs("div",{children:[n.jsx("label",{className:"text-sm font-medium",children:"Company Name"}),n.jsx("input",{required:!0,type:"text",className:"w-full border p-2 rounded mt-1",value:u,onChange:y=>d(y.target.value)})]}),n.jsx(Z,{type:"submit",className:"w-full",disabled:o,children:o?"Submitting…":"Register interest"})]})]})})]})]})})}const le=l.forwardRef(({className:e,type:t,...r},o)=>n.jsx("input",{type:t,className:X("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",e),ref:o,...r}));le.displayName="Input";var hl=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],gl=hl.reduce((e,t)=>{const r=Br(`Primitive.${t}`),o=l.forwardRef((s,a)=>{const{asChild:c,...i}=s,u=c?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),n.jsx(u,{...i,ref:a})});return o.displayName=`Primitive.${t}`,{...e,[t]:o}},{}),vl="Label",ts=l.forwardRef((e,t)=>n.jsx(gl.label,{...e,ref:t,onMouseDown:r=>{r.target.closest("button, input, select, textarea")||(e.onMouseDown?.(r),!r.defaultPrevented&&r.detail>1&&r.preventDefault())}}));ts.displayName=vl;var rs=ts;const bl=Jt("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),je=l.forwardRef(({className:e,...t},r)=>n.jsx(rs,{ref:r,className:X(bl(),e),...t}));je.displayName=rs.displayName;function no({open:e,onOpenChange:t,debtor:r,onUpdate:o,loading:s=!1}){const[a,c]=v.useState(""),[i,u]=v.useState(""),d=()=>{(a.trim()||i.trim())&&(o(a,i),c(""),u(""))};return n.jsx(mt,{open:e,onOpenChange:t,children:n.jsxs(at,{children:[n.jsxs(Ke,{children:[n.jsx(Qe,{children:"Update Portal Credentials"}),n.jsxs(Ze,{children:["Update the login credentials for ",r?.debtorName]})]}),n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"space-y-2",children:[n.jsx(je,{htmlFor:"update-username",children:"Username"}),n.jsx(le,{id:"update-username",type:"email",value:a,onChange:f=>c(f.target.value),placeholder:"Enter new username (leave empty to keep current)"})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx(je,{htmlFor:"update-password",children:"Password"}),n.jsx(le,{id:"update-password",type:"password",value:i,onChange:f=>u(f.target.value),placeholder:"Enter new password (leave empty to keep current)"})]}),n.jsx("div",{className:"text-sm text-muted-foreground",children:"Leave fields empty to keep existing values. Only fields with values will be updated."})]}),n.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[n.jsx(Z,{variant:"outline",onClick:()=>t(!1),disabled:s,children:"Cancel"}),n.jsx(Z,{onClick:d,disabled:s||!a&&!i,children:s?"Updating...":"Update Credentials"})]})]})})}var yl=Symbol("radix.slottable");function xl(e){const t=({children:r})=>n.jsx(n.Fragment,{children:r});return t.displayName=`${e}.Slottable`,t.__radixId=yl,t}var os="AlertDialog",[wl,Ld]=Et(os,[Dn]),et=Dn(),ns=e=>{const{__scopeAlertDialog:t,...r}=e,o=et(t);return n.jsx(qn,{...o,...r,modal:!0})};ns.displayName=os;var Sl="AlertDialogTrigger",Cl=l.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...o}=e,s=et(r);return n.jsx(Jc,{...s,...o,ref:t})});Cl.displayName=Sl;var jl="AlertDialogPortal",ss=e=>{const{__scopeAlertDialog:t,...r}=e,o=et(t);return n.jsx(Yn,{...o,...r})};ss.displayName=jl;var Nl="AlertDialogOverlay",as=l.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...o}=e,s=et(r);return n.jsx(Qr,{...s,...o,ref:t})});as.displayName=Nl;var Ct="AlertDialogContent",[El,kl]=wl(Ct),Al=xl("AlertDialogContent"),is=l.forwardRef((e,t)=>{const{__scopeAlertDialog:r,children:o,...s}=e,a=et(r),c=l.useRef(null),i=de(t,c),u=l.useRef(null);return n.jsx(Xc,{contentName:Ct,titleName:cs,docsSlug:"alert-dialog",children:n.jsx(El,{scope:r,cancelRef:u,children:n.jsxs(Zr,{role:"alertdialog",...a,...s,ref:i,onOpenAutoFocus:te(s.onOpenAutoFocus,d=>{d.preventDefault(),u.current?.focus({preventScroll:!0})}),onPointerDownOutside:d=>d.preventDefault(),onInteractOutside:d=>d.preventDefault(),children:[n.jsx(Al,{children:o}),n.jsx(_l,{contentRef:c})]})})})});is.displayName=Ct;var cs="AlertDialogTitle",ls=l.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...o}=e,s=et(r);return n.jsx(Jr,{...s,...o,ref:t})});ls.displayName=cs;var ds="AlertDialogDescription",us=l.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...o}=e,s=et(r);return n.jsx(eo,{...s,...o,ref:t})});us.displayName=ds;var Pl="AlertDialogAction",fs=l.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...o}=e,s=et(r);return n.jsx(to,{...s,...o,ref:t})});fs.displayName=Pl;var ps="AlertDialogCancel",ms=l.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...o}=e,{cancelRef:s}=kl(ps,r),a=et(r),c=de(t,s);return n.jsx(to,{...a,...o,ref:c})});ms.displayName=ps;var _l=({contentRef:e})=>{const t=`\`${Ct}\` requires a description for the component to be accessible for screen reader users.
48
+
49
+ You can add a description to the \`${Ct}\` by passing a \`${ds}\` component as a child, which also benefits sighted users by adding visible context to the dialog.
50
+
51
+ Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${Ct}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component.
52
+
53
+ For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return l.useEffect(()=>{document.getElementById(e.current?.getAttribute("aria-describedby"))||console.warn(t)},[t,e]),null},Dl=ns,Tl=ss,hs=as,gs=is,vs=fs,bs=ms,ys=ls,xs=us;const Bo=Dl,Il=Tl,ws=l.forwardRef(({className:e,...t},r)=>n.jsx(hs,{className:X("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",e),...t,ref:r}));ws.displayName=hs.displayName;const Ir=l.forwardRef(({className:e,...t},r)=>n.jsxs(Il,{children:[n.jsx(ws,{}),n.jsx(gs,{ref:r,className:X("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",e),...t})]}));Ir.displayName=gs.displayName;const Rr=({className:e,...t})=>n.jsx("div",{className:X("flex flex-col space-y-2 text-center sm:text-left",e),...t});Rr.displayName="AlertDialogHeader";const Or=({className:e,...t})=>n.jsx("div",{className:X("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});Or.displayName="AlertDialogFooter";const Fr=l.forwardRef(({className:e,...t},r)=>n.jsx(ys,{ref:r,className:X("text-lg font-semibold",e),...t}));Fr.displayName=ys.displayName;const Mr=l.forwardRef(({className:e,...t},r)=>n.jsx(xs,{ref:r,className:X("text-sm text-muted-foreground",e),...t}));Mr.displayName=xs.displayName;const Lr=l.forwardRef(({className:e,...t},r)=>n.jsx(vs,{ref:r,className:X(Vr(),e),...t}));Lr.displayName=vs.displayName;const Rl=l.forwardRef(({className:e,...t},r)=>n.jsx(bs,{ref:r,className:X(Vr({variant:"outline"}),"mt-2 sm:mt-0",e),...t}));Rl.displayName=bs.displayName;function Wo(e){const t=Ol(e),r=l.forwardRef((o,s)=>{const{children:a,...c}=o,i=l.Children.toArray(a),u=i.find(Ml);if(u){const d=u.props.children,f=i.map(p=>p===u?l.Children.count(d)>1?l.Children.only(null):l.isValidElement(d)?d.props.children:null:p);return n.jsx(t,{...c,ref:s,children:l.isValidElement(d)?l.cloneElement(d,void 0,f):null})}return n.jsx(t,{...c,ref:s,children:a})});return r.displayName=`${e}.Slot`,r}function Ol(e){const t=l.forwardRef((r,o)=>{const{children:s,...a}=r;if(l.isValidElement(s)){const c=$l(s),i=Ll(a,s.props);return s.type!==l.Fragment&&(i.ref=o?It(o,c):c),l.cloneElement(s,i)}return l.Children.count(s)>1?l.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Fl=Symbol("radix.slottable");function Ml(e){return l.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Fl}function Ll(e,t){const r={...t};for(const o in t){const s=e[o],a=t[o];/^on[A-Z]/.test(o)?s&&a?r[o]=(...i)=>{const u=a(...i);return s(...i),u}:s&&(r[o]=s):o==="style"?r[o]={...s,...a}:o==="className"&&(r[o]=[s,a].filter(Boolean).join(" "))}return{...e,...r}}function $l(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}function Ul(e){const t=e+"CollectionProvider",[r,o]=Et(t),[s,a]=r(t,{collectionRef:{current:null},itemMap:new Map}),c=g=>{const{scope:h,children:x}=g,T=v.useRef(null),j=v.useRef(new Map).current;return n.jsx(s,{scope:h,itemMap:j,collectionRef:T,children:x})};c.displayName=t;const i=e+"CollectionSlot",u=Wo(i),d=v.forwardRef((g,h)=>{const{scope:x,children:T}=g,j=a(i,x),E=de(h,j.collectionRef);return n.jsx(u,{ref:E,children:T})});d.displayName=i;const f=e+"CollectionItemSlot",p="data-radix-collection-item",m=Wo(f),y=v.forwardRef((g,h)=>{const{scope:x,children:T,...j}=g,E=v.useRef(null),w=de(h,E),L=a(f,x);return v.useEffect(()=>(L.itemMap.set(E,{ref:E,...j}),()=>void L.itemMap.delete(E))),n.jsx(m,{[p]:"",ref:w,children:T})});y.displayName=f;function S(g){const h=a(e+"CollectionConsumer",g);return v.useCallback(()=>{const T=h.collectionRef.current;if(!T)return[];const j=Array.from(T.querySelectorAll(`[${p}]`));return Array.from(h.itemMap.values()).sort((L,I)=>j.indexOf(L.ref.current)-j.indexOf(I.ref.current))},[h.collectionRef,h.itemMap])}return[{Provider:c,Slot:d,ItemSlot:y},S,o]}var Bl=l.createContext(void 0);function so(e){const t=l.useContext(Bl);return e||t||"ltr"}var Pr="rovingFocusGroup.onEntryFocus",Wl={bubbles:!1,cancelable:!0},Rt="RovingFocusGroup",[$r,Ss,zl]=Ul(Rt),[Vl,Cs]=Et(Rt,[zl]),[Gl,Hl]=Vl(Rt),js=l.forwardRef((e,t)=>n.jsx($r.Provider,{scope:e.__scopeRovingFocusGroup,children:n.jsx($r.Slot,{scope:e.__scopeRovingFocusGroup,children:n.jsx(ql,{...e,ref:t})})}));js.displayName=Rt;var ql=l.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:r,orientation:o,loop:s=!1,dir:a,currentTabStopId:c,defaultCurrentTabStopId:i,onCurrentTabStopIdChange:u,onEntryFocus:d,preventScrollOnEntryFocus:f=!1,...p}=e,m=l.useRef(null),y=de(t,m),S=so(a),[g,h]=qr({prop:c,defaultProp:i??null,onChange:u,caller:Rt}),[x,T]=l.useState(!1),j=Oe(d),E=Ss(r),w=l.useRef(!1),[L,I]=l.useState(0);return l.useEffect(()=>{const b=m.current;if(b)return b.addEventListener(Pr,j),()=>b.removeEventListener(Pr,j)},[j]),n.jsx(Gl,{scope:r,orientation:o,dir:S,loop:s,currentTabStopId:g,onItemFocus:l.useCallback(b=>h(b),[h]),onItemShiftTab:l.useCallback(()=>T(!0),[]),onFocusableItemAdd:l.useCallback(()=>I(b=>b+1),[]),onFocusableItemRemove:l.useCallback(()=>I(b=>b-1),[]),children:n.jsx(ae.div,{tabIndex:x||L===0?-1:0,"data-orientation":o,...p,ref:y,style:{outline:"none",...e.style},onMouseDown:te(e.onMouseDown,()=>{w.current=!0}),onFocus:te(e.onFocus,b=>{const D=!w.current;if(b.target===b.currentTarget&&D&&!x){const z=new CustomEvent(Pr,Wl);if(b.currentTarget.dispatchEvent(z),!z.defaultPrevented){const q=E().filter(J=>J.focusable),se=q.find(J=>J.active),ge=q.find(J=>J.id===g),re=[se,ge,...q].filter(Boolean).map(J=>J.ref.current);ks(re,f)}}w.current=!1}),onBlur:te(e.onBlur,()=>T(!1))})})}),Ns="RovingFocusGroupItem",Es=l.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:r,focusable:o=!0,active:s=!1,tabStopId:a,children:c,...i}=e,u=Tt(),d=a||u,f=Hl(Ns,r),p=f.currentTabStopId===d,m=Ss(r),{onFocusableItemAdd:y,onFocusableItemRemove:S,currentTabStopId:g}=f;return l.useEffect(()=>{if(o)return y(),()=>S()},[o,y,S]),n.jsx($r.ItemSlot,{scope:r,id:d,focusable:o,active:s,children:n.jsx(ae.span,{tabIndex:p?0:-1,"data-orientation":f.orientation,...i,ref:t,onMouseDown:te(e.onMouseDown,h=>{o?f.onItemFocus(d):h.preventDefault()}),onFocus:te(e.onFocus,()=>f.onItemFocus(d)),onKeyDown:te(e.onKeyDown,h=>{if(h.key==="Tab"&&h.shiftKey){f.onItemShiftTab();return}if(h.target!==h.currentTarget)return;const x=Kl(h,f.orientation,f.dir);if(x!==void 0){if(h.metaKey||h.ctrlKey||h.altKey||h.shiftKey)return;h.preventDefault();let j=m().filter(E=>E.focusable).map(E=>E.ref.current);if(x==="last")j.reverse();else if(x==="prev"||x==="next"){x==="prev"&&j.reverse();const E=j.indexOf(h.currentTarget);j=f.loop?Ql(j,E+1):j.slice(E+1)}setTimeout(()=>ks(j))}}),children:typeof c=="function"?c({isCurrentTabStop:p,hasTabStop:g!=null}):c})})});Es.displayName=Ns;var Yl={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Xl(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function Kl(e,t,r){const o=Xl(e.key,r);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(o))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(o)))return Yl[o]}function ks(e,t=!1){const r=document.activeElement;for(const o of e)if(o===r||(o.focus({preventScroll:t}),document.activeElement!==r))return}function Ql(e,t){return e.map((r,o)=>e[(t+o)%e.length])}var Zl=js,Jl=Es,rr="Tabs",[ed,$d]=Et(rr,[Cs]),As=Cs(),[td,ao]=ed(rr),Ps=l.forwardRef((e,t)=>{const{__scopeTabs:r,value:o,onValueChange:s,defaultValue:a,orientation:c="horizontal",dir:i,activationMode:u="automatic",...d}=e,f=so(i),[p,m]=qr({prop:o,onChange:s,defaultProp:a??"",caller:rr});return n.jsx(td,{scope:r,baseId:Tt(),value:p,onValueChange:m,orientation:c,dir:f,activationMode:u,children:n.jsx(ae.div,{dir:f,"data-orientation":c,...d,ref:t})})});Ps.displayName=rr;var _s="TabsList",Ds=l.forwardRef((e,t)=>{const{__scopeTabs:r,loop:o=!0,...s}=e,a=ao(_s,r),c=As(r);return n.jsx(Zl,{asChild:!0,...c,orientation:a.orientation,dir:a.dir,loop:o,children:n.jsx(ae.div,{role:"tablist","aria-orientation":a.orientation,...s,ref:t})})});Ds.displayName=_s;var Ts="TabsTrigger",Is=l.forwardRef((e,t)=>{const{__scopeTabs:r,value:o,disabled:s=!1,...a}=e,c=ao(Ts,r),i=As(r),u=Fs(c.baseId,o),d=Ms(c.baseId,o),f=o===c.value;return n.jsx(Jl,{asChild:!0,...i,focusable:!s,active:f,children:n.jsx(ae.button,{type:"button",role:"tab","aria-selected":f,"aria-controls":d,"data-state":f?"active":"inactive","data-disabled":s?"":void 0,disabled:s,id:u,...a,ref:t,onMouseDown:te(e.onMouseDown,p=>{!s&&p.button===0&&p.ctrlKey===!1?c.onValueChange(o):p.preventDefault()}),onKeyDown:te(e.onKeyDown,p=>{[" ","Enter"].includes(p.key)&&c.onValueChange(o)}),onFocus:te(e.onFocus,()=>{const p=c.activationMode!=="manual";!f&&!s&&p&&c.onValueChange(o)})})})});Is.displayName=Ts;var Rs="TabsContent",Os=l.forwardRef((e,t)=>{const{__scopeTabs:r,value:o,forceMount:s,children:a,...c}=e,i=ao(Rs,r),u=Fs(i.baseId,o),d=Ms(i.baseId,o),f=o===i.value,p=l.useRef(f);return l.useEffect(()=>{const m=requestAnimationFrame(()=>p.current=!1);return()=>cancelAnimationFrame(m)},[]),n.jsx(Je,{present:s||f,children:({present:m})=>n.jsx(ae.div,{"data-state":f?"active":"inactive","data-orientation":i.orientation,role:"tabpanel","aria-labelledby":u,hidden:!m,id:d,tabIndex:0,...c,ref:t,style:{...e.style,animationDuration:p.current?"0s":void 0},children:m&&a})})});Os.displayName=Rs;function Fs(e,t){return`${e}-trigger-${t}`}function Ms(e,t){return`${e}-content-${t}`}var rd=Ps,Ls=Ds,$s=Is,Us=Os;const Ur=rd,Xt=l.forwardRef(({className:e,...t},r)=>n.jsx(Ls,{ref:r,className:X("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",e),...t}));Xt.displayName=Ls.displayName;const pe=l.forwardRef(({className:e,...t},r)=>n.jsx($s,{ref:r,className:X("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",e),...t}));pe.displayName=$s.displayName;const Pe=l.forwardRef(({className:e,...t},r)=>n.jsx(Us,{ref:r,className:X("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...t}));Pe.displayName=Us.displayName;var od=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],nd=od.reduce((e,t)=>{const r=Br(`Primitive.${t}`),o=l.forwardRef((s,a)=>{const{asChild:c,...i}=s,u=c?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),n.jsx(u,{...i,ref:a})});return o.displayName=`Primitive.${t}`,{...e,[t]:o}},{}),sd="Separator",zo="horizontal",ad=["horizontal","vertical"],Bs=l.forwardRef((e,t)=>{const{decorative:r,orientation:o=zo,...s}=e,a=id(o)?o:zo,i=r?{role:"none"}:{"aria-orientation":a==="vertical"?a:void 0,role:"separator"};return n.jsx(nd.div,{"data-orientation":a,...i,...s,ref:t})});Bs.displayName=sd;function id(e){return ad.includes(e)}var Ws=Bs;const zs=l.forwardRef(({className:e,orientation:t="horizontal",decorative:r=!0,...o},s)=>n.jsx(Ws,{ref:s,decorative:r,orientation:t,className:X("shrink-0 bg-border",t==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",e),...o}));zs.displayName=Ws.displayName;const cd={idle:"Ready to sync","checking-config":"Checking configuration...",authenticating:"Authenticating with services...","loading-clients":"Loading clients...","selecting-client":"Choose which client to manage","selecting-debtor":"Connect debtor portals to sync invoices","loading-data":"Loading debtors...",review:"Review invoices",complete:"Sync complete!",error:"Sync failed"};function io({open:e,onOpenChange:t,currentStep:r,error:o,clients:s=[],debtors:a=[],selectedDebtor:c=null,selectedClient:i=null,onSelectClient:u,onSelectDebtor:d,onConnectDebtor:f,onEditCredentials:p,onChangePortal:m,onToggleActivation:y,onSyncDebtor:S,onVerifyDebtor:g,togglingDebtorId:h,syncingDebtorId:x,verifyingDebtorId:T,allowBackToClientSelection:j=!1,onBackToClientSelection:E,activeTab:w,onActiveTabChange:L}){const I=["checking-config","authenticating","loading-clients","loading-data"].includes(r),b=r==="error",D=r==="complete",z=r==="selecting-client",q=r==="selecting-debtor",se=r==="review",[ge,ue]=v.useState("not_connected"),re=w??ge,J=L??ue,[Ne,_e]=v.useState(!1),[Ee,R]=v.useState(null),[Ye,Fe]=v.useState(!1),[Me,Le]=v.useState(null),[ee,oe]=v.useState(""),ke=v.useDeferredValue(ee),ve=v.useMemo(()=>{const B=ke.trim().toLowerCase();return B?a.filter(F=>F.debtorName.toLowerCase().includes(B)):a},[a,ke]),K=v.useMemo(()=>({not_connected:ve.filter(B=>B.status==="not_connected"),pending:ve.filter(B=>B.status==="pending"),connected:ve.filter(B=>B.status==="connected"),deactivated:ve.filter(B=>B.status==="deactivated")}),[ve]),$e={not_connected:K.not_connected.length,pending:K.pending.length,connected:K.connected.length,deactivated:K.deactivated.length},De=v.useCallback(B=>{f?.(B)},[f]),be=v.useCallback(B=>{R(B),_e(!0)},[]),ye=v.useCallback(()=>{Ee&&(S?.(Ee),_e(!1),R(null))},[Ee,S]),Te=v.useCallback(B=>{Le(B),Fe(!0)},[]),Ue=v.useCallback(()=>{Me&&(g?.(Me),Fe(!1),Le(null))},[Me,g]);return n.jsxs(mt,{open:e,onOpenChange:t,children:[n.jsx(at,{className:"sm:max-w-5xl max-h-[90vh] overflow-hidden p-0",children:n.jsxs("div",{className:"flex h-full flex-col md:flex-row",children:[n.jsxs("aside",{className:"md:w-1/3 bg-black text-white p-8 flex flex-col justify-between relative overflow-hidden",children:[n.jsx("div",{className:"absolute inset-0 bg-[radial-gradient(circle_at_top_right,rgba(255,255,255,0.1),transparent_70%)] pointer-events-none"}),n.jsxs("div",{className:"space-y-8 relative z-10",children:[n.jsxs("div",{className:"space-y-3",children:[n.jsx("h2",{className:"text-3xl font-bold leading-snug tracking-tight",children:"Connect & Sync your Invoices"}),n.jsx("p",{className:"text-base text-white/90 leading-relaxed max-w-sm",children:"Connect your debtor portals once and we’ll sync your invoices automatically"})]}),n.jsx("ul",{className:"space-y-5 text-sm",children:["Connect once, stay synced forever. No more uploads.","Work smarter, not harder. Automate the boring stuff and focus on what moves the needle.","Always up to date. Every debtor portal, every invoice — perfectly in sync."].map((B,F)=>n.jsxs("li",{className:"flex items-start gap-3",children:[n.jsx(Y.CheckCircle2,{className:"mt-0.5 h-5 w-5 text-emerald-300 flex-shrink-0"}),n.jsx("span",{className:"leading-relaxed",children:B})]},F))})]}),n.jsxs("div",{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",children:[n.jsx("p",{className:"font-semibold text-white",children:"Need help connecting your portals?"}),n.jsx("p",{className:"mt-1",children:"Our support team can guide you through setup — or do it for you."})]})]}),n.jsx("div",{className:"flex-1 md:w-2/3",children:n.jsxs("div",{className:"flex h-full flex-col",children:[n.jsxs("div",{className:"p-6 pb-4",children:[n.jsxs(Ke,{className:"text-left",children:[n.jsx(Qe,{children:q&&i?`Connect Debtor Portals for ${i.companyName}`:"Connect Debtor Portals to Sync Invoices"}),n.jsx(Ze,{children:b?"An error occurred during sync":q&&i?"Connect debtor portals to automatically sync invoices":"Connect debtor portals to automatically sync invoices and save time"})]}),!q&&n.jsx(zs,{className:"mt-4"})]}),n.jsxs("div",{className:"flex-1 overflow-y-auto px-6 pb-6",children:[(I||D||b)&&n.jsxs("div",{className:"flex items-center gap-3",children:[I&&n.jsx(Y.Loader2,{className:"w-5 h-5 animate-spin text-primary"}),D&&n.jsx(Y.CheckCircle2,{className:"w-5 h-5 text-primary"}),b&&n.jsx(Y.XCircle,{className:"w-5 h-5 text-destructive"}),n.jsx("span",{className:"text-sm text-muted-foreground",children:r==="loading-data"&&i?`Loading debtors for ${i.companyName}...`:cd[r]})]}),z&&n.jsxs("div",{className:"mt-6 space-y-4",children:[n.jsx("div",{className:"text-base font-medium",children:"Step 1 : Select a Client"}),n.jsx("div",{className:"max-h-64 overflow-auto rounded-md border",children:n.jsxs("ul",{className:"divide-y",children:[s.length===0&&n.jsx("li",{className:"p-3 text-sm text-muted-foreground",children:"No clients found."}),s.map(B=>n.jsx("li",{children:n.jsx("button",{className:"w-full text-left p-3 transition-colors hover:bg-muted/70",onClick:()=>u?.(B),children:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(Y.Building2,{className:"h-5 w-5 flex-shrink-0 text-primary"}),n.jsxs("div",{className:"flex-1",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:"font-medium",children:B.companyName}),B.active&&n.jsx("span",{className:"rounded bg-green-500/10 px-2 py-1 text-xs text-green-500",children:"Active"})]}),n.jsxs("div",{className:"mt-1 flex items-center gap-1 text-xs text-muted-foreground",children:[n.jsx(Y.Mail,{className:"h-3 w-3"}),B.email]})]})]})})},B.id))]})})]}),q&&n.jsxs("div",{className:"mt-6 space-y-4",children:[n.jsx(le,{value:ee,onChange:B=>oe(B.target.value),placeholder:"Search debtors...",className:"w-full"}),n.jsxs(Ur,{value:re,onValueChange:B=>J(B),className:"w-full",children:[n.jsxs(Xt,{className:"grid w-full grid-cols-4 gap-2 bg-muted",children:[n.jsxs(pe,{value:"not_connected",children:["Not Connected (",$e.not_connected,")"]}),n.jsxs(pe,{value:"pending",children:["Pending (",$e.pending,")"]}),n.jsxs(pe,{value:"connected",children:["Connected (",$e.connected,")"]}),n.jsxs(pe,{value:"deactivated",children:["Deactivated (",$e.deactivated,")"]})]}),["not_connected","pending","connected","deactivated"].map(B=>n.jsx(Pe,{value:B,className:"mt-4",children:n.jsx("div",{className:"max-h-64 overflow-auto rounded-md border",children:n.jsxs("ul",{className:"divide-y",children:[K[B].length===0&&n.jsx("li",{className:"p-3 text-sm text-muted-foreground",children:"No debtors found."}),K[B].map(F=>n.jsxs("li",{className:"flex items-center justify-between gap-4 p-3 transition-colors hover:bg-muted/70",children:[n.jsxs("div",{className:"flex-1",children:[n.jsx("div",{className:"font-medium",children:F.debtorName}),n.jsxs("div",{className:"mt-1 space-y-0.5 text-xs text-muted-foreground",children:[n.jsxs("div",{children:["Last Sync: ",No(F.lastSync)]}),F.lastSyncSummary&&n.jsxs("div",{children:["Last Sync Records: ",F.lastSyncSummary.synced," synced /"," ",F.lastSyncSummary.processed," processed",F.lastSyncSummary.failed>0?` (${F.lastSyncSummary.failed} failed)`:""]}),F.lastVerificationSummary&&n.jsxs("div",{children:["Last Verification: ",No(F.lastVerificationSummary.timestamp)," —"," ",F.lastVerificationSummary.synced," verified /"," ",F.lastVerificationSummary.processed," processed",F.lastVerificationSummary.failed>0?` (${F.lastVerificationSummary.failed} failed)`:""]}),F.portalName&&n.jsxs("div",{children:["Portal: ",F.portalName]})]})]}),n.jsxs("div",{className:"flex flex-wrap gap-2",children:[B==="not_connected"&&n.jsx(Z,{onClick:()=>De(F),children:"CONNECT"}),B==="connected"&&n.jsxs(n.Fragment,{children:[n.jsx(Z,{variant:"success",size:"sm",onClick:()=>be(F),disabled:x===F.factorcloudDebtorId,children:x===F.factorcloudDebtorId?n.jsxs(n.Fragment,{children:[n.jsx(Y.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}),"Syncing..."]}):n.jsxs(n.Fragment,{children:[n.jsx(Y.RefreshCw,{className:"mr-2 h-4 w-4"}),"Sync Now"]})}),n.jsx(Z,{variant:"outline",size:"sm",onClick:()=>Te(F),disabled:T===F.factorcloudDebtorId,children:T===F.factorcloudDebtorId?n.jsxs(n.Fragment,{children:[n.jsx(Y.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}),"Verifying..."]}):n.jsxs(n.Fragment,{children:[n.jsx(Y.ShieldCheck,{className:"mr-2 h-4 w-4"}),"Verify Invoices"]})}),n.jsx(Z,{variant:"outline",size:"sm",onClick:()=>p?.(F),children:"Edit Credentials"}),n.jsx(Z,{variant:"outline",size:"sm",onClick:()=>y?.(F),disabled:h===F.factorcloudDebtorId,children:h===F.factorcloudDebtorId?n.jsxs(n.Fragment,{children:[n.jsx(Y.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}),"Deactivating..."]}):"Deactivate"})]}),(B==="pending"||B==="deactivated")&&n.jsxs(n.Fragment,{children:[n.jsx(Z,{variant:"outline",size:"sm",onClick:()=>p?.(F),children:"Edit Credentials"}),n.jsx(Z,{variant:B==="deactivated"?"default":"outline",size:"sm",onClick:()=>y?.(F),disabled:h===F.factorcloudDebtorId,children:h===F.factorcloudDebtorId?n.jsxs(n.Fragment,{children:[n.jsx(Y.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}),B==="deactivated"?"Activating...":"Deactivating..."]}):B==="deactivated"?"Activate":"Deactivate"})]})]})]},F.factorcloudDebtorId))]})})},B))]})]}),se&&n.jsxs("div",{className:"mt-6 space-y-4",children:[n.jsxs("div",{className:"text-sm",children:["Selected debtor: ",n.jsx("span",{className:"font-medium",children:c?.debtorName})]}),n.jsxs(Ur,{defaultValue:"pending",className:"w-full",children:[n.jsxs(Xt,{className:"bg-muted",children:[n.jsx(pe,{value:"pending",children:"Pending"}),n.jsx(pe,{value:"approved",children:"Approved"}),n.jsx(pe,{value:"funded",children:"Funded"}),n.jsx(pe,{value:"closed",children:"Closed"}),n.jsx(pe,{value:"rejected",children:"Rejected"}),n.jsx(pe,{value:"all",children:"All"})]}),n.jsx(Pe,{value:"pending",className:"mt-4",children:n.jsxs("div",{className:"flex flex-col items-center rounded-lg border p-8 text-center text-sm text-muted-foreground",children:[n.jsx("div",{className:"mb-3 flex h-10 w-10 items-center justify-center rounded-full bg-muted",children:n.jsx(Y.FileText,{className:"h-5 w-5"})}),"No records found for Pending"]})}),n.jsx(Pe,{value:"approved",className:"mt-4",children:n.jsx("div",{className:"rounded-lg border p-8 text-center text-sm text-muted-foreground",children:"No records found for Approved"})}),n.jsx(Pe,{value:"funded",className:"mt-4",children:n.jsx("div",{className:"rounded-lg border p-8 text-center text-sm text-muted-foreground",children:"No records found for Funded"})}),n.jsx(Pe,{value:"closed",className:"mt-4",children:n.jsx("div",{className:"rounded-lg border p-8 text-center text-sm text-muted-foreground",children:"No records found for Closed"})}),n.jsx(Pe,{value:"rejected",className:"mt-4",children:n.jsx("div",{className:"rounded-lg border p-8 text-center text-sm text-muted-foreground",children:"No records found for Rejected"})}),n.jsx(Pe,{value:"all",className:"mt-4",children:n.jsx("div",{className:"rounded-lg border p-8 text-center text-sm text-muted-foreground",children:"No records found"})})]})]}),o&&n.jsx("div",{className:"mt-6 rounded-lg bg-destructive/10 p-3 text-sm text-destructive",children:o})]}),n.jsxs("div",{className:"flex items-center justify-between border-t px-6 py-4",children:[q&&j?n.jsxs(Z,{variant:"outline",onClick:E,children:[n.jsx(Y.ArrowLeft,{className:"mr-2 h-4 w-4"}),"Change Client"]}):n.jsx("div",{}),n.jsx(Z,{variant:"outline",onClick:()=>t(!1),children:"Close"})]})]})})]})}),n.jsx(Bo,{open:Ne,onOpenChange:_e,children:n.jsxs(Ir,{children:[n.jsxs(Rr,{children:[n.jsx(Fr,{children:"Sync Scheduled Successfully!"}),n.jsxs(Mr,{children:["We're syncing invoices for ",n.jsx("span",{className:"font-medium",children:Ee?.debtorName})," in the background. This usually takes a few minutes. You'll receive an email notification once the sync is complete and your invoices are ready to review."]})]}),n.jsx(Or,{children:n.jsx(Lr,{onClick:ye,children:"Got it!"})})]})}),n.jsx(Bo,{open:Ye,onOpenChange:Fe,children:n.jsxs(Ir,{children:[n.jsxs(Rr,{children:[n.jsx(Fr,{children:"Verification Started!"}),n.jsxs(Mr,{children:["We're verifying invoices for ",n.jsx("span",{className:"font-medium",children:Me?.debtorName}),". We'll let you know if any issues come up during the verification."]})]}),n.jsx(Or,{children:n.jsx(Lr,{onClick:Ue,children:"Understood"})})]})})]})}function ld(e,[t,r]){return Math.min(r,Math.max(t,e))}function dd(e,t){return l.useReducer((r,o)=>t[r][o]??r,e)}var co="ScrollArea",[Vs,Ud]=Et(co),[ud,We]=Vs(co),Gs=l.forwardRef((e,t)=>{const{__scopeScrollArea:r,type:o="hover",dir:s,scrollHideDelay:a=600,...c}=e,[i,u]=l.useState(null),[d,f]=l.useState(null),[p,m]=l.useState(null),[y,S]=l.useState(null),[g,h]=l.useState(null),[x,T]=l.useState(0),[j,E]=l.useState(0),[w,L]=l.useState(!1),[I,b]=l.useState(!1),D=de(t,q=>u(q)),z=so(s);return n.jsx(ud,{scope:r,type:o,dir:z,scrollHideDelay:a,scrollArea:i,viewport:d,onViewportChange:f,content:p,onContentChange:m,scrollbarX:y,onScrollbarXChange:S,scrollbarXEnabled:w,onScrollbarXEnabledChange:L,scrollbarY:g,onScrollbarYChange:h,scrollbarYEnabled:I,onScrollbarYEnabledChange:b,onCornerWidthChange:T,onCornerHeightChange:E,children:n.jsx(ae.div,{dir:z,...c,ref:D,style:{position:"relative","--radix-scroll-area-corner-width":x+"px","--radix-scroll-area-corner-height":j+"px",...e.style}})})});Gs.displayName=co;var Hs="ScrollAreaViewport",qs=l.forwardRef((e,t)=>{const{__scopeScrollArea:r,children:o,nonce:s,...a}=e,c=We(Hs,r),i=l.useRef(null),u=de(t,i,c.onViewportChange);return n.jsxs(n.Fragment,{children:[n.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:s}),n.jsx(ae.div,{"data-radix-scroll-area-viewport":"",...a,ref:u,style:{overflowX:c.scrollbarXEnabled?"scroll":"hidden",overflowY:c.scrollbarYEnabled?"scroll":"hidden",...e.style},children:n.jsx("div",{ref:c.onContentChange,style:{minWidth:"100%",display:"table"},children:o})})]})});qs.displayName=Hs;var qe="ScrollAreaScrollbar",lo=l.forwardRef((e,t)=>{const{forceMount:r,...o}=e,s=We(qe,e.__scopeScrollArea),{onScrollbarXEnabledChange:a,onScrollbarYEnabledChange:c}=s,i=e.orientation==="horizontal";return l.useEffect(()=>(i?a(!0):c(!0),()=>{i?a(!1):c(!1)}),[i,a,c]),s.type==="hover"?n.jsx(fd,{...o,ref:t,forceMount:r}):s.type==="scroll"?n.jsx(pd,{...o,ref:t,forceMount:r}):s.type==="auto"?n.jsx(Ys,{...o,ref:t,forceMount:r}):s.type==="always"?n.jsx(uo,{...o,ref:t}):null});lo.displayName=qe;var fd=l.forwardRef((e,t)=>{const{forceMount:r,...o}=e,s=We(qe,e.__scopeScrollArea),[a,c]=l.useState(!1);return l.useEffect(()=>{const i=s.scrollArea;let u=0;if(i){const d=()=>{window.clearTimeout(u),c(!0)},f=()=>{u=window.setTimeout(()=>c(!1),s.scrollHideDelay)};return i.addEventListener("pointerenter",d),i.addEventListener("pointerleave",f),()=>{window.clearTimeout(u),i.removeEventListener("pointerenter",d),i.removeEventListener("pointerleave",f)}}},[s.scrollArea,s.scrollHideDelay]),n.jsx(Je,{present:r||a,children:n.jsx(Ys,{"data-state":a?"visible":"hidden",...o,ref:t})})}),pd=l.forwardRef((e,t)=>{const{forceMount:r,...o}=e,s=We(qe,e.__scopeScrollArea),a=e.orientation==="horizontal",c=nr(()=>u("SCROLL_END"),100),[i,u]=dd("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return l.useEffect(()=>{if(i==="idle"){const d=window.setTimeout(()=>u("HIDE"),s.scrollHideDelay);return()=>window.clearTimeout(d)}},[i,s.scrollHideDelay,u]),l.useEffect(()=>{const d=s.viewport,f=a?"scrollLeft":"scrollTop";if(d){let p=d[f];const m=()=>{const y=d[f];p!==y&&(u("SCROLL"),c()),p=y};return d.addEventListener("scroll",m),()=>d.removeEventListener("scroll",m)}},[s.viewport,a,u,c]),n.jsx(Je,{present:r||i!=="hidden",children:n.jsx(uo,{"data-state":i==="hidden"?"hidden":"visible",...o,ref:t,onPointerEnter:te(e.onPointerEnter,()=>u("POINTER_ENTER")),onPointerLeave:te(e.onPointerLeave,()=>u("POINTER_LEAVE"))})})}),Ys=l.forwardRef((e,t)=>{const r=We(qe,e.__scopeScrollArea),{forceMount:o,...s}=e,[a,c]=l.useState(!1),i=e.orientation==="horizontal",u=nr(()=>{if(r.viewport){const d=r.viewport.offsetWidth<r.viewport.scrollWidth,f=r.viewport.offsetHeight<r.viewport.scrollHeight;c(i?d:f)}},10);return Nt(r.viewport,u),Nt(r.content,u),n.jsx(Je,{present:o||a,children:n.jsx(uo,{"data-state":a?"visible":"hidden",...s,ref:t})})}),uo=l.forwardRef((e,t)=>{const{orientation:r="vertical",...o}=e,s=We(qe,e.__scopeScrollArea),a=l.useRef(null),c=l.useRef(0),[i,u]=l.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),d=Js(i.viewport,i.content),f={...o,sizes:i,onSizesChange:u,hasThumb:d>0&&d<1,onThumbChange:m=>a.current=m,onThumbPointerUp:()=>c.current=0,onThumbPointerDown:m=>c.current=m};function p(m,y){return yd(m,c.current,i,y)}return r==="horizontal"?n.jsx(md,{...f,ref:t,onThumbPositionChange:()=>{if(s.viewport&&a.current){const m=s.viewport.scrollLeft,y=Vo(m,i,s.dir);a.current.style.transform=`translate3d(${y}px, 0, 0)`}},onWheelScroll:m=>{s.viewport&&(s.viewport.scrollLeft=m)},onDragScroll:m=>{s.viewport&&(s.viewport.scrollLeft=p(m,s.dir))}}):r==="vertical"?n.jsx(hd,{...f,ref:t,onThumbPositionChange:()=>{if(s.viewport&&a.current){const m=s.viewport.scrollTop,y=Vo(m,i);a.current.style.transform=`translate3d(0, ${y}px, 0)`}},onWheelScroll:m=>{s.viewport&&(s.viewport.scrollTop=m)},onDragScroll:m=>{s.viewport&&(s.viewport.scrollTop=p(m))}}):null}),md=l.forwardRef((e,t)=>{const{sizes:r,onSizesChange:o,...s}=e,a=We(qe,e.__scopeScrollArea),[c,i]=l.useState(),u=l.useRef(null),d=de(t,u,a.onScrollbarXChange);return l.useEffect(()=>{u.current&&i(getComputedStyle(u.current))},[u]),n.jsx(Ks,{"data-orientation":"horizontal",...s,ref:d,sizes:r,style:{bottom:0,left:a.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:a.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":or(r)+"px",...e.style},onThumbPointerDown:f=>e.onThumbPointerDown(f.x),onDragScroll:f=>e.onDragScroll(f.x),onWheelScroll:(f,p)=>{if(a.viewport){const m=a.viewport.scrollLeft+f.deltaX;e.onWheelScroll(m),ta(m,p)&&f.preventDefault()}},onResize:()=>{u.current&&a.viewport&&c&&o({content:a.viewport.scrollWidth,viewport:a.viewport.offsetWidth,scrollbar:{size:u.current.clientWidth,paddingStart:Qt(c.paddingLeft),paddingEnd:Qt(c.paddingRight)}})}})}),hd=l.forwardRef((e,t)=>{const{sizes:r,onSizesChange:o,...s}=e,a=We(qe,e.__scopeScrollArea),[c,i]=l.useState(),u=l.useRef(null),d=de(t,u,a.onScrollbarYChange);return l.useEffect(()=>{u.current&&i(getComputedStyle(u.current))},[u]),n.jsx(Ks,{"data-orientation":"vertical",...s,ref:d,sizes:r,style:{top:0,right:a.dir==="ltr"?0:void 0,left:a.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":or(r)+"px",...e.style},onThumbPointerDown:f=>e.onThumbPointerDown(f.y),onDragScroll:f=>e.onDragScroll(f.y),onWheelScroll:(f,p)=>{if(a.viewport){const m=a.viewport.scrollTop+f.deltaY;e.onWheelScroll(m),ta(m,p)&&f.preventDefault()}},onResize:()=>{u.current&&a.viewport&&c&&o({content:a.viewport.scrollHeight,viewport:a.viewport.offsetHeight,scrollbar:{size:u.current.clientHeight,paddingStart:Qt(c.paddingTop),paddingEnd:Qt(c.paddingBottom)}})}})}),[gd,Xs]=Vs(qe),Ks=l.forwardRef((e,t)=>{const{__scopeScrollArea:r,sizes:o,hasThumb:s,onThumbChange:a,onThumbPointerUp:c,onThumbPointerDown:i,onThumbPositionChange:u,onDragScroll:d,onWheelScroll:f,onResize:p,...m}=e,y=We(qe,r),[S,g]=l.useState(null),h=de(t,D=>g(D)),x=l.useRef(null),T=l.useRef(""),j=y.viewport,E=o.content-o.viewport,w=Oe(f),L=Oe(u),I=nr(p,10);function b(D){if(x.current){const z=D.clientX-x.current.left,q=D.clientY-x.current.top;d({x:z,y:q})}}return l.useEffect(()=>{const D=z=>{const q=z.target;S?.contains(q)&&w(z,E)};return document.addEventListener("wheel",D,{passive:!1}),()=>document.removeEventListener("wheel",D,{passive:!1})},[j,S,E,w]),l.useEffect(L,[o,L]),Nt(S,I),Nt(y.content,I),n.jsx(gd,{scope:r,scrollbar:S,hasThumb:s,onThumbChange:Oe(a),onThumbPointerUp:Oe(c),onThumbPositionChange:L,onThumbPointerDown:Oe(i),children:n.jsx(ae.div,{...m,ref:h,style:{position:"absolute",...m.style},onPointerDown:te(e.onPointerDown,D=>{D.button===0&&(D.target.setPointerCapture(D.pointerId),x.current=S.getBoundingClientRect(),T.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",y.viewport&&(y.viewport.style.scrollBehavior="auto"),b(D))}),onPointerMove:te(e.onPointerMove,b),onPointerUp:te(e.onPointerUp,D=>{const z=D.target;z.hasPointerCapture(D.pointerId)&&z.releasePointerCapture(D.pointerId),document.body.style.webkitUserSelect=T.current,y.viewport&&(y.viewport.style.scrollBehavior=""),x.current=null})})})}),Kt="ScrollAreaThumb",Qs=l.forwardRef((e,t)=>{const{forceMount:r,...o}=e,s=Xs(Kt,e.__scopeScrollArea);return n.jsx(Je,{present:r||s.hasThumb,children:n.jsx(vd,{ref:t,...o})})}),vd=l.forwardRef((e,t)=>{const{__scopeScrollArea:r,style:o,...s}=e,a=We(Kt,r),c=Xs(Kt,r),{onThumbPositionChange:i}=c,u=de(t,p=>c.onThumbChange(p)),d=l.useRef(void 0),f=nr(()=>{d.current&&(d.current(),d.current=void 0)},100);return l.useEffect(()=>{const p=a.viewport;if(p){const m=()=>{if(f(),!d.current){const y=xd(p,i);d.current=y,i()}};return i(),p.addEventListener("scroll",m),()=>p.removeEventListener("scroll",m)}},[a.viewport,f,i]),n.jsx(ae.div,{"data-state":c.hasThumb?"visible":"hidden",...s,ref:u,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...o},onPointerDownCapture:te(e.onPointerDownCapture,p=>{const y=p.target.getBoundingClientRect(),S=p.clientX-y.left,g=p.clientY-y.top;c.onThumbPointerDown({x:S,y:g})}),onPointerUp:te(e.onPointerUp,c.onThumbPointerUp)})});Qs.displayName=Kt;var fo="ScrollAreaCorner",Zs=l.forwardRef((e,t)=>{const r=We(fo,e.__scopeScrollArea),o=!!(r.scrollbarX&&r.scrollbarY);return r.type!=="scroll"&&o?n.jsx(bd,{...e,ref:t}):null});Zs.displayName=fo;var bd=l.forwardRef((e,t)=>{const{__scopeScrollArea:r,...o}=e,s=We(fo,r),[a,c]=l.useState(0),[i,u]=l.useState(0),d=!!(a&&i);return Nt(s.scrollbarX,()=>{const f=s.scrollbarX?.offsetHeight||0;s.onCornerHeightChange(f),u(f)}),Nt(s.scrollbarY,()=>{const f=s.scrollbarY?.offsetWidth||0;s.onCornerWidthChange(f),c(f)}),d?n.jsx(ae.div,{...o,ref:t,style:{width:a,height:i,position:"absolute",right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:0,...e.style}}):null});function Qt(e){return e?parseInt(e,10):0}function Js(e,t){const r=e/t;return isNaN(r)?0:r}function or(e){const t=Js(e.viewport,e.content),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,o=(e.scrollbar.size-r)*t;return Math.max(o,18)}function yd(e,t,r,o="ltr"){const s=or(r),a=s/2,c=t||a,i=s-c,u=r.scrollbar.paddingStart+c,d=r.scrollbar.size-r.scrollbar.paddingEnd-i,f=r.content-r.viewport,p=o==="ltr"?[0,f]:[f*-1,0];return ea([u,d],p)(e)}function Vo(e,t,r="ltr"){const o=or(t),s=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,a=t.scrollbar.size-s,c=t.content-t.viewport,i=a-o,u=r==="ltr"?[0,c]:[c*-1,0],d=ld(e,u);return ea([0,c],[0,i])(d)}function ea(e,t){return r=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const o=(t[1]-t[0])/(e[1]-e[0]);return t[0]+o*(r-e[0])}}function ta(e,t){return e>0&&e<t}var xd=(e,t=()=>{})=>{let r={left:e.scrollLeft,top:e.scrollTop},o=0;return function s(){const a={left:e.scrollLeft,top:e.scrollTop},c=r.left!==a.left,i=r.top!==a.top;(c||i)&&t(),r=a,o=window.requestAnimationFrame(s)}(),()=>window.cancelAnimationFrame(o)};function nr(e,t){const r=Oe(e),o=l.useRef(0);return l.useEffect(()=>()=>window.clearTimeout(o.current),[]),l.useCallback(()=>{window.clearTimeout(o.current),o.current=window.setTimeout(r,t)},[r,t])}function Nt(e,t){const r=Oe(t);jt(()=>{let o=0;if(e){const s=new ResizeObserver(()=>{cancelAnimationFrame(o),o=window.requestAnimationFrame(r)});return s.observe(e),()=>{window.cancelAnimationFrame(o),s.unobserve(e)}}},[e,r])}var ra=Gs,wd=qs,Sd=Zs;const oa=l.forwardRef(({className:e,children:t,...r},o)=>n.jsxs(ra,{ref:o,className:X("relative overflow-hidden",e),...r,children:[n.jsx(wd,{className:"h-full w-full rounded-[inherit]",children:t}),n.jsx(na,{}),n.jsx(Sd,{})]}));oa.displayName=ra.displayName;const na=l.forwardRef(({className:e,orientation:t="vertical",...r},o)=>n.jsx(lo,{ref:o,orientation:t,className:X("flex touch-none select-none transition-colors",t==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",t==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",e),...r,children:n.jsx(Qs,{className:"relative flex-1 rounded-full bg-border"})}));na.displayName=lo.displayName;const Cd=Jt("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",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function jd({className:e,variant:t,...r}){return n.jsx("div",{className:X(Cd({variant:t}),e),...r})}function po({open:e,onOpenChange:t,debtor:r,availablePortals:o,loadingPortals:s=!1,loading:a=!1,isChangingPortal:c=!1,onConnect:i,onRequestNewPortal:u}){const[d,f]=v.useState("selecting-portal"),[p,m]=v.useState(null),[y,S]=v.useState(""),[g,h]=v.useState(""),[x,T]=v.useState("");v.useEffect(()=>{e||(f("selecting-portal"),m(null),S(""),h(""),T(""))},[e]);const j=o.filter(b=>b.description!=="Failed"&&(b.name.toLowerCase().includes(y.toLowerCase())||b.host.toLowerCase().includes(y.toLowerCase()))).sort((b,D)=>b.is_active&&!D.is_active?-1:!b.is_active&&D.is_active?1:0),E=b=>{m(b),f("entering-credentials")},w=()=>{f("selecting-portal"),m(null),h(""),T("")},L=()=>{p&&g&&x&&i(p.portal_id,g,x)},I=g.trim().length>0&&x.trim().length>0;return n.jsx(mt,{open:e,onOpenChange:t,children:n.jsx(at,{className:"sm:max-w-2xl h-[85vh] min-h-0 flex flex-col gap-4 overflow-hidden",children:d==="selecting-portal"?n.jsxs(n.Fragment,{children:[n.jsxs(Ke,{children:[n.jsx(Qe,{children:c?"Change Portal":"Select Portal"}),n.jsxs(Ze,{children:["Choose the portal you want to ",c?"change to":"connect to"," for ",r?.debtorName,"."]})]}),s?n.jsx("div",{className:"flex items-center justify-center py-8",children:n.jsx(Y.Loader2,{className:"w-8 h-8 animate-spin text-primary"})}):n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"relative flex-shrink-0",children:[n.jsx(Y.Search,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),n.jsx(le,{placeholder:"Search portals...",value:y,onChange:b=>S(b.target.value),className:"pl-9"})]}),n.jsx(oa,{className:"flex-1 min-h-0 -mx-6 px-6",children:n.jsx("div",{className:"grid grid-cols-2 gap-4 pb-4",children:j.map(b=>n.jsxs("button",{onClick:()=>E(b),className:"flex flex-col items-center gap-3 p-4 border rounded-lg hover:bg-muted/50 transition-colors relative",children:[n.jsx(jd,{variant:"secondary",className:`absolute top-2 right-2 ${b.is_active?"bg-green-100 text-green-700 hover:bg-green-200":"bg-yellow-100 text-yellow-700 hover:bg-yellow-200"}`,children:b.is_active?"Active":"Pending"}),n.jsx("div",{className:"w-16 h-16 flex items-center justify-center bg-muted rounded-lg",children:b.logo&&b.logo!=="NA"?n.jsx("img",{src:b.logo,alt:b.name,className:"w-12 h-12 object-contain",onError:D=>{D.currentTarget.style.display="none"}}):n.jsx("span",{className:"text-2xl font-bold text-muted-foreground",children:b.name.charAt(0)})}),n.jsx("div",{className:"text-sm font-medium text-center",children:b.name}),n.jsx("div",{className:"text-xs text-muted-foreground truncate w-full text-center",children:b.host})]},b.mapping_id))})}),n.jsxs("div",{className:"flex items-center justify-between gap-3 pt-4 border-t flex-shrink-0",children:[n.jsx("p",{className:"text-sm text-muted-foreground",children:"Can't find your portal?"}),n.jsx(Z,{variant:"outline",onClick:u,size:"sm",children:"Request New Portal"})]})]}),n.jsx("div",{className:"flex justify-end pt-2 flex-shrink-0",children:n.jsx(Z,{variant:"outline",onClick:()=>t(!1),children:"Cancel"})})]}):n.jsxs(n.Fragment,{children:[n.jsxs(Ke,{children:[n.jsx(Qe,{children:c?"Change Portal":"Enter Credentials"}),n.jsxs(Ze,{children:["Enter your credentials for ",p?.name," to ",c?"update":"connect"," ",r?.debtorName,"."]})]}),n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"flex items-center gap-3 p-3 border rounded-lg bg-muted/50",children:[p?.logo&&p.logo!=="NA"&&n.jsx("img",{src:p.logo,alt:p.name,className:"w-10 h-10 object-contain"}),n.jsxs("div",{children:[n.jsx("div",{className:"font-medium",children:p?.name}),n.jsx("div",{className:"text-xs text-muted-foreground",children:p?.host})]})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx(je,{htmlFor:"portal-username",children:"Username"}),n.jsx(le,{id:"portal-username",value:g,onChange:b=>h(b.target.value),placeholder:"Enter portal username"})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx(je,{htmlFor:"portal-password",children:"Password"}),n.jsx(le,{id:"portal-password",type:"password",value:x,onChange:b=>T(b.target.value),placeholder:"Enter portal password"})]})]}),n.jsxs("div",{className:"flex justify-between gap-2 pt-4",children:[n.jsxs(Z,{variant:"outline",onClick:w,disabled:a,children:[n.jsx(Y.ArrowLeft,{className:"w-4 h-4 mr-2"}),"Back"]}),n.jsxs("div",{className:"flex gap-2",children:[n.jsx(Z,{variant:"outline",onClick:()=>t(!1),disabled:a,children:"Cancel"}),n.jsx(Z,{onClick:L,disabled:a||!I,children:a?c?"Updating...":"Connecting...":c?"Update Portal":"Connect"})]})]})]})})})}function mo({open:e,onOpenChange:t,loading:r=!1,onSubmit:o}){const[s,a]=v.useState(""),[c,i]=v.useState("");v.useEffect(()=>{e||(a(""),i(""))},[e]);const u=s.trim().length>0&&c.trim().length>0;return n.jsx(mt,{open:e,onOpenChange:t,children:n.jsxs(at,{children:[n.jsxs(Ke,{children:[n.jsx(Qe,{children:"Request New Portal"}),n.jsx(Ze,{children:"Enter the details of the portal you'd like to connect to."})]}),n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"space-y-2",children:[n.jsx(je,{htmlFor:"portal-name",children:"Portal Name"}),n.jsx(le,{id:"portal-name",value:s,onChange:d=>a(d.target.value),placeholder:"e.g. My Portal Name"})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx(je,{htmlFor:"portal-host",children:"Portal URL"}),n.jsx(le,{id:"portal-host",value:c,onChange:d=>i(d.target.value),placeholder:"e.g. https://portal.example.com"})]})]}),n.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[n.jsx(Z,{variant:"outline",onClick:()=>t(!1),disabled:r,children:"Cancel"}),n.jsx(Z,{onClick:()=>o(s,c),disabled:r||!u,children:r?"Creating...":"Create Portal"})]})]})})}function ho(e,t){const r=t?.skip??!1,o=t?.customerStatusUrl,s=v.useRef(!0),[a,c]=v.useState(null),[i,u]=v.useState(!1),[d,f]=v.useState(null),[p,m]=v.useState(e&&dt(e)?e:null);v.useEffect(()=>{if(!e){m(null);return}dt(e)&&m(e)},[e]);const y=v.useMemo(()=>{if(!(!e&&!p))return{portalduct:{...p?.portalduct??{},...e?.portalduct??{}},factorcloud:{...p?.factorcloud??{},...e?.factorcloud??{}}}},[e,p]),S=y?.factorcloud?.factorId,g=y?.portalduct?.webhook_bearer_token;y?.portalduct?.customer_id,y?.portalduct?.environment;const h=y?.portalduct?.env_url,x=y?.portalduct?.sync_webhook_url,T=y?.portalduct?.verify_webhook_url,j=v.useRef(y);v.useEffect(()=>{j.current=y},[y]),v.useEffect(()=>(s.current=!0,()=>{s.current=!1}),[]);const E=v.useCallback(async()=>{if(r)return null;const w=j.current,L=w?.factorcloud?.factorId,I=w?.portalduct?.webhook_bearer_token,b=w?.portalduct?.customer_id,D=w?.portalduct?.environment,z=w?.portalduct?.env_url,q=w?.portalduct?.sync_webhook_url,se=w?.portalduct?.verify_webhook_url;if(!L)return s.current&&(c(null),u(!1),f(null)),null;if(!I)return s.current&&(c(!1),u(!1),f(null)),null;s.current&&(u(!0),f(null));try{const ue=await new Gr({webhookToken:I,customerId:b,environment:D,webhookUrl:q,verifyWebhookUrl:se,portalductBaseUrl:z,customerStatusUrl:o}).fetchCustomerStatus(L),re=fn(w,ue);return s.current&&(c(ue.active),re&&m(re)),ue}catch(ge){const ue=ge instanceof Error?ge:new Error("Unable to determine FactorCloud customer status.");return s.current&&(c(!1),f(ue)),null}finally{s.current&&u(!1)}},[o,r]);return v.useEffect(()=>{r||!S||!g||E()},[o,S,h,E,r,x,T,g]),{isActive:a,loading:i,error:d,resolvedConfig:p,refetch:E}}const Zt=({config:e,onTokenExpired:t,trigger:r,onSyncComplete:o,onSyncError:s,autoStart:a=!1,customerStatus:c})=>{const[i,u]=v.useState(null),[d,f]=v.useState(null),[p,m]=v.useState(null),[y,S]=v.useState([]),[g,h]=v.useState([]),[x,T]=v.useState(null),[j,E]=v.useState(!1),[w,L]=v.useState([]),[I,b]=v.useState(!1),[D,z]=v.useState(!1),[q,se]=v.useState(null),[ge,ue]=v.useState(!1),[re,J]=v.useState(!1),[Ne,_e]=v.useState(!1),[Ee,R]=v.useState(!1),[Ye,Fe]=v.useState(!1),[Me,Le]=v.useState(!1),[ee,oe]=v.useState(null),[ke,ve]=v.useState(!1),[K,$e]=v.useState(null),[De,be]=v.useState(null),[ye,Te]=v.useState(new Map),[Ue,B]=v.useState(null),[F,ht]=v.useState(new Map),[Ae,Ve]=v.useState(!1),[At,W]=v.useState("idle"),[gt,ne]=v.useState(),[sr,tt]=v.useState("not_connected"),{toast:Q}=un(),ar=ho(e,{skip:!!c}),vt=c??ar,it=vt.isActive,bt=vt.loading,ir=vt.error,cr=vt.resolvedConfig,lr=dt(e)?e:null,Be=cr??lr,dr=Be?.factorcloud?.client_id??e?.factorcloud?.client_id;v.useEffect(()=>{if(Be&&dt(Be)){const A=new Hr(Be);u(A)}else u(null)},[Be]),v.useEffect(()=>{a&&i&&!Ae&&it===!0&&!bt&&Pt()},[a,i,Ae,it,bt]),v.useEffect(()=>()=>{ye.forEach(A=>{window.clearTimeout(A)}),F.forEach(A=>{window.clearTimeout(A)})},[ye,F]);const ur=async A=>{const $=A||i;if(!(!$||!Be)){E(!0);try{if(!Be.factorcloud?.client_id){W("loading-clients");const Ie=await $.getFactorCloudClients();S(Ie),W("selecting-client");return}W("loading-data");const M=await $.getFactorCloudClient(Be.factorcloud.client_id);f(M);const k=await $.ensurePortalDuctCompany(M);m(k);const G=await $.fetchMergedDebtors(M.id,k.company_id);h(G),W("selecting-debtor"),Q({title:"Data Loaded",description:`Loaded ${G.length} debtors. Select a debtor to continue.`}),o?.(G)}catch(M){console.error("Failed to load data:",M);const k=M instanceof Error?M:new Error("An error occurred");M instanceof me&&M.status===401&&M.type==="authentication_error"&&t?.("portalduct"),W("error"),ne(k.message),Q({title:"Failed to Load Data",description:k.message,variant:"destructive"}),s?.(k)}finally{E(!1)}}},Pt=async()=>{if(!i){Q({title:"Service Not Ready",description:"Please wait for the service to initialize.",variant:"destructive"});return}if(bt){Q({title:"Checking Customer Status",description:"Please wait while we confirm your FactorCloud account is active."});return}if(it!==!0){Q({title:"Sync Unavailable",description:ir?.message??"This FactorCloud account is not active yet.",variant:"destructive"});return}Ve(!0),W("checking-config"),ne(void 0);try{await ur(i)}catch(A){W("error");const $=A instanceof Error?A:new Error("An unexpected error occurred");ne($.message),s?.($)}},fr=async A=>{if(f(A),!!i){W("loading-data"),E(!0);try{const $=await i.ensurePortalDuctCompany(A);m($);const M=await i.fetchMergedDebtors(A.id,$.company_id);h(M),W("selecting-debtor"),Q({title:"Client Selected",description:`Loaded ${M.length} debtors for ${A.companyName}. Select a debtor to continue.`})}catch($){console.error("Failed to load client data:",$);const M=$ instanceof Error?$:new Error("Failed to load client data");$ instanceof me&&$.status===401&&$.type==="authentication_error"&&t?.("portalduct"),W("error"),ne(M.message),Q({title:"Failed to load client data",description:M.message,variant:"destructive"}),s?.(M)}finally{E(!1)}}},pr=async A=>{T(A),W("review"),Q({title:"Debtor Selected",description:`${A.debtorName} selected. Review invoices in the tabs below.`})},mr=async A=>{if(i){se(A),J(!1),b(!0),Ve(!1),z(!0);try{const M=await i.getPortalDuctAPI().getPortalMappings();L(M)}catch($){console.error("Failed to fetch portals",$);const M=$ instanceof Error?$:new Error("Unable to fetch portals.");$ instanceof me&&$.status===401&&$.type==="authentication_error"&&t?.("portalduct"),W("error"),ne(M.message),Q({title:"Failed to fetch portals",description:M.message,variant:"destructive"}),Ve(!0),z(!1)}finally{b(!1)}}},hr=async A=>{if(i){se(A),J(!0),b(!0),Ve(!1),z(!0);try{const M=await i.getPortalDuctAPI().getPortalMappings();L(M)}catch($){console.error("Failed to fetch portals",$);const M=$ instanceof Error?$:new Error("Unable to fetch portals.");$ instanceof me&&$.status===401&&$.type==="authentication_error"&&t?.("portalduct"),W("error"),ne(M.message),Q({title:"Failed to fetch portals",description:M.message,variant:"destructive"}),Ve(!0),z(!1)}finally{b(!1)}}},gr=A=>{z(A),A||Ve(!0)},C=()=>{z(!1),_e(!0)},U=async(A,$)=>{if(!(!i||!Be?.portalduct?.customer_id))try{R(!0);const M=i.getPortalDuctAPI(),k=await M.createPortalMapping({customer_id:Be.portalduct.customer_id,name:A,host:$}),G=await M.getPortalMappings();L(G),_e(!1),z(!0),Q({title:"Portal created",description:`${k.name} has been added to your portals.`})}catch(M){console.error("Failed to create portal",M);const k=M instanceof Error?M:new Error("Unable to create portal.");M instanceof me&&M.status===401&&M.type==="authentication_error"&&(t?.("portalduct"),W("error"),ne(k.message)),Q({title:"Failed to create portal",description:k.message,variant:"destructive"})}finally{R(!1)}},O=async(A,$,M)=>{if(!i||!p||!d||!q){Q({title:"Cannot connect",description:"Missing context to create connection.",variant:"destructive"});return}try{ue(!0);const k=i.getPortalDuctAPI(),G=w.find(Se=>Se.portal_id===A);re&&q.connection?(await k.updateConnection(q.connection.connection_id,{portal_id:A,user_name:$,password:M}),Q({title:"Portal changed",description:`${q.debtorName} portal updated to ${G?.name}.`})):(await k.createConnection({company_id:p.company_id,portal_id:A,user_name:$,password:M,tags:{factorcloud_id:d.id,factorcloud_debtor_id:q.factorcloudDebtorId}}),Q({title:"Connection created",description:`${q.debtorName} is now connected (pending).`}));const Ie=await i.fetchMergedDebtors(d.id,p.company_id);h(Ie),z(!1),Ve(!0),tt("connected"),se(null),J(!1)}catch(k){console.error(re?"Change portal failed":"Create connection failed",k);const G=k instanceof Error?k:new Error(`Unable to ${re?"change portal":"create connection"}.`);k instanceof me&&k.status===401&&k.type==="authentication_error"&&(t?.("portalduct"),W("error"),ne(G.message)),Q({title:re?"Change portal failed":"Connection failed",description:G.message,variant:"destructive"})}finally{ue(!1)}},N=A=>{oe(A),Le(!0)},V=async(A,$)=>{if(!(!i||!p||!d||!ee?.connection))try{ve(!0);const M=i.getPortalDuctAPI(),k={};A&&(k.user_name=A),$&&(k.password=$),await M.updateConnection(ee.connection.connection_id,k);const G=await i.fetchMergedDebtors(d.id,p.company_id);h(G),Le(!1),oe(null),Q({title:"Credentials updated",description:`Updated credentials for ${ee.debtorName}.`})}catch(M){console.error("Update credentials failed",M);const k=M instanceof Error?M:new Error("Unable to update credentials.");M instanceof me&&M.status===401&&M.type==="authentication_error"&&(t?.("portalduct"),W("error"),ne(k.message)),Q({title:"Update failed",description:k.message,variant:"destructive"})}finally{ve(!1)}},xe=async A=>{if(!i||!p||!d||!A.connection)return;const $=A.status==="deactivated",M=$?"activate":"deactivate";try{$e(A.factorcloudDebtorId);const k=i.getPortalDuctAPI();$?await k.activateConnection(A.connection.connection_id):await k.deactivateConnection(A.connection.connection_id);const G=await i.fetchMergedDebtors(d.id,p.company_id);h(G),tt($?"connected":"deactivated"),Q({title:`Connection ${M}d`,description:`${A.debtorName} connection has been ${M}d.`})}catch(k){console.error(`Failed to ${M} connection`,k);const G=k instanceof Error?k:new Error(`Unable to ${M} connection.`);k instanceof me&&k.status===401&&k.type==="authentication_error"&&(t?.("portalduct"),W("error"),ne(G.message)),Q({title:`Failed to ${M}`,description:G.message,variant:"destructive"})}finally{$e(null)}},fe=async A=>{if(!A.connection){Q({title:"Cannot Sync",description:`${A.debtorName} is not connected to a portal`,variant:"destructive"});return}const $=i;if(!$){Q({title:"Service Not Ready",description:"PortalDuct service is not available yet.",variant:"destructive"});return}be(A.factorcloudDebtorId);const M=window.setTimeout(()=>{be(null),Te(k=>{const G=new Map(k);return G.delete(A.factorcloudDebtorId),G})},15*60*1e3);Te(k=>{const G=new Map(k);return G.set(A.factorcloudDebtorId,M),G});try{const k=await $.triggerConnectionSync(A.connection.connection_id),G=new Date().toISOString();h(Se=>Se.map(Re=>Re.factorcloudDebtorId===A.factorcloudDebtorId?{...Re,lastSync:G,lastSyncSummary:{processed:k.processed,synced:k.synced,failed:k.failed,timestamp:G}}:Re)),be(null);const Ie=ye.get(A.factorcloudDebtorId);Ie!==void 0&&window.clearTimeout(Ie),Te(Se=>{const Re=new Map(Se);return Re.delete(A.factorcloudDebtorId),Re}),Q({title:k.failed>0?"Sync Completed with Warnings":"Sync Completed",description:`Processed ${k.processed} records. Synced ${k.synced}. Failed ${k.failed}.`})}catch(k){be(null);const G=ye.get(A.factorcloudDebtorId);G&&(window.clearTimeout(G),Te(Ie=>{const Se=new Map(Ie);return Se.delete(A.factorcloudDebtorId),Se})),console.error("Sync failed",k),Q({title:"Sync Failed",description:k instanceof Error?k.message:`Unable to sync ${A.debtorName}`,variant:"destructive"})}},we=async A=>{if(!A.connection){Q({title:"Cannot Verify",description:`${A.debtorName} is not connected to a portal`,variant:"destructive"});return}const $=i;if(!$){Q({title:"Service Not Ready",description:"PortalDuct service is not available yet.",variant:"destructive"});return}B(A.factorcloudDebtorId);const M=window.setTimeout(()=>{B(null),ht(k=>{const G=new Map(k);return G.delete(A.factorcloudDebtorId),G})},15*60*1e3);ht(k=>{const G=new Map(k);return G.set(A.factorcloudDebtorId,M),G});try{const k=await $.triggerConnectionVerification(A.connection.connection_id),G=new Date().toISOString();h(Se=>Se.map(Re=>Re.factorcloudDebtorId===A.factorcloudDebtorId?{...Re,lastVerificationSummary:{processed:k.processed,synced:k.synced,failed:k.failed,timestamp:G}}:Re)),B(null);const Ie=F.get(A.factorcloudDebtorId);Ie!==void 0&&window.clearTimeout(Ie),ht(Se=>{const Re=new Map(Se);return Re.delete(A.factorcloudDebtorId),Re}),Q({title:k.failed>0?"Verification Completed with Warnings":"Verification Completed",description:`Processed ${k.processed} records. Verified ${k.synced}. Failed ${k.failed}.`})}catch(k){B(null);const G=F.get(A.factorcloudDebtorId);G&&(window.clearTimeout(G),ht(Ie=>{const Se=new Map(Ie);return Se.delete(A.factorcloudDebtorId),Se})),console.error("Verification failed",k),Q({title:"Verification Failed",description:k instanceof Error?k.message:`Unable to verify ${A.debtorName}`,variant:"destructive"})}};return n.jsxs(n.Fragment,{children:[r?n.jsx("div",{onClick:()=>{it===!0?Pt():Fe(!0)},style:{cursor:"pointer"},children:r}):n.jsx(Z,{onClick:()=>{it===!0?Pt():Fe(!0)},children:j?"Loading...":bt?"Checking Access...":"Sync Invoices"}),n.jsx(es,{open:Ye,onOpenChange:Fe}),n.jsx(io,{open:Ae,onOpenChange:Ve,currentStep:At,error:gt,clients:y,debtors:g,selectedDebtor:x,selectedClient:d,onSelectClient:fr,onSelectDebtor:pr,onConnectDebtor:mr,onEditCredentials:N,onChangePortal:hr,onToggleActivation:xe,onSyncDebtor:fe,onVerifyDebtor:we,togglingDebtorId:K,syncingDebtorId:De,verifyingDebtorId:Ue,allowBackToClientSelection:!dr,onBackToClientSelection:()=>W("selecting-client"),activeTab:sr,onActiveTabChange:tt}),n.jsx(mo,{open:Ne,onOpenChange:_e,loading:Ee,onSubmit:U}),n.jsx(po,{open:D,onOpenChange:gr,debtor:q,availablePortals:w,loadingPortals:I,loading:ge,isChangingPortal:re,onConnect:O,onRequestNewPortal:C}),n.jsx(no,{open:Me,onOpenChange:Le,debtor:ee,loading:ke,onUpdate:V})]})},Nd=({config:e,onTokenExpired:t})=>{const[r,o]=v.useState(null),[s,a]=v.useState(null),[c,i]=v.useState(null);v.useState(!1);const[u,d]=v.useState([]),[f,p]=v.useState([]),[m,y]=v.useState(null),[S,g]=v.useState(!1);v.useState("");const[h,x]=v.useState([]),[T,j]=v.useState(!1),[E,w]=v.useState(!1),[L,I]=v.useState(null),[b,D]=v.useState(!1),[z,q]=v.useState(!1),[se,ge]=v.useState(!1),[ue,re]=v.useState(!1),[J,Ne]=v.useState(!1),[_e,Ee]=v.useState(!1),[R,Ye]=v.useState(null),[Fe,Me]=v.useState(!1),[Le,ee]=v.useState(null),[oe,ke]=v.useState(null),[ve,K]=v.useState(new Map),[$e,De]=v.useState(null),[be,ye]=v.useState(new Map),[Te,Ue]=v.useState(!1),[B,F]=v.useState("idle"),[ht,Ae]=v.useState(),[Ve,At]=v.useState("not_connected"),{toast:W}=un(),gt=ho(e),ne=gt.resolvedConfig??(dt(e)?e:null),sr=ne?.factorcloud?.client_id??e?.factorcloud?.client_id,tt=gt.isActive,Q=gt.loading,ar=gt.error;v.useEffect(()=>{if(ne&&dt(ne)){const C=new Hr(ne);o(C)}else o(null)},[ne]),v.useEffect(()=>()=>{ve.forEach(C=>{window.clearTimeout(C)}),be.forEach(C=>{window.clearTimeout(C)})},[ve,be]);const vt=async C=>{const U=C||r;if(!(!U||!ne)){g(!0);try{if(!ne.factorcloud?.client_id){F("loading-clients");const xe=await U.getFactorCloudClients();d(xe),F("selecting-client");return}F("loading-data");const O=await U.getFactorCloudClient(ne.factorcloud.client_id);a(O);const N=await U.ensurePortalDuctCompany(O);i(N);const V=await U.fetchMergedDebtors(O.id,N.company_id);p(V),F("selecting-debtor"),W({title:"Data Loaded",description:`Loaded ${V.length} debtors. Select a debtor to continue.`})}catch(O){console.error("Failed to load data:",O);const N=O instanceof Error?O:new Error("An error occurred.");O instanceof me&&O.status===401&&O.type==="authentication_error"&&t?.("portalduct"),F("error"),Ae(N.message),W({title:"Failed to Load Data",description:N.message,variant:"destructive"})}finally{g(!1)}}},it=async()=>{if(!r){W({title:"Service Not Ready",description:"Please wait for the service to initialize.",variant:"destructive"});return}if(Q){W({title:"Checking Customer Status",description:"Please wait while we confirm your FactorCloud account is active."});return}if(tt!==!0){W({title:"Sync Unavailable",description:ar?.message??"This FactorCloud account is not active yet.",variant:"destructive"});return}Ue(!0),F("checking-config"),Ae(void 0);try{await vt(r)}catch(C){F("error"),Ae(C instanceof Error?C.message:"An unexpected error occurred")}},bt=async C=>{if(a(C),!!r){F("loading-data"),g(!0);try{const U=await r.ensurePortalDuctCompany(C);i(U);const O=await r.fetchMergedDebtors(C.id,U.company_id);p(O),F("selecting-debtor"),W({title:"Client Selected",description:`Loaded ${O.length} debtors for ${C.companyName}. Select a debtor to continue.`})}catch(U){console.error("Failed to load client data:",U);const O=U instanceof Error?U:new Error("Failed to load client data");U instanceof me&&U.status===401&&U.type==="authentication_error"&&t?.("portalduct"),F("error"),Ae(O.message),W({title:"Failed to load client data",description:O.message,variant:"destructive"})}finally{g(!1)}}},ir=async C=>{y(C),F("review"),W({title:"Debtor Selected",description:`${C.debtorName} selected. Review invoices in the tabs below.`})},cr=async C=>{if(r){I(C),q(!1),j(!0),Ue(!1),w(!0);try{const O=await r.getPortalDuctAPI().getPortalMappings();x(O)}catch(U){console.error("Failed to fetch portals",U);const O=U instanceof Error?U:new Error("Unable to fetch portals.");U instanceof me&&U.status===401&&U.type==="authentication_error"&&t?.("portalduct"),F("error"),Ae(O.message),W({title:"Failed to fetch portals",description:O.message,variant:"destructive"}),Ue(!0),w(!1)}finally{j(!1)}}},lr=async C=>{if(r){I(C),q(!0),j(!0),Ue(!1),w(!0);try{const O=await r.getPortalDuctAPI().getPortalMappings();x(O)}catch(U){console.error("Failed to fetch portals",U);const O=U instanceof Error?U:new Error("Unable to fetch portals.");U instanceof me&&U.status===401&&U.type==="authentication_error"&&t?.("portalduct"),F("error"),Ae(O.message),W({title:"Failed to fetch portals",description:O.message,variant:"destructive"}),Ue(!0),w(!1)}finally{j(!1)}}},Be=C=>{w(C),C||Ue(!0)},dr=()=>{w(!1),ge(!0)},ur=async(C,U)=>{if(!(!r||!ne?.portalduct?.customer_id))try{Ne(!0);const O=r.getPortalDuctAPI(),N=await O.createPortalMapping({customer_id:ne.portalduct.customer_id,name:C,host:U}),V=await O.getPortalMappings();x(V),ge(!1),w(!0),W({title:"Portal created",description:`${N.name} has been added to your portals.`})}catch(O){console.error("Failed to create portal",O);const N=O instanceof Error?O:new Error("Unable to create portal.");O instanceof me&&O.status===401&&O.type==="authentication_error"&&t?.("portalduct"),F("error"),Ae(N.message),W({title:"Failed to create portal",description:N.message,variant:"destructive"})}finally{Ne(!1)}},Pt=async(C,U,O)=>{if(!r||!c||!s||!L){W({title:"Cannot connect",description:"Missing context to create connection.",variant:"destructive"});return}try{D(!0);const N=r.getPortalDuctAPI(),V=h.find(fe=>fe.portal_id===C);z&&L.connection?(await N.updateConnection(L.connection.connection_id,{portal_id:C,user_name:U,password:O}),W({title:"Portal changed",description:`${L.debtorName} portal updated to ${V?.name}.`})):(await N.createConnection({company_id:c.company_id,portal_id:C,user_name:U,password:O,tags:{factorcloud_id:s.id,factorcloud_debtor_id:L.factorcloudDebtorId}}),W({title:"Connection created",description:`${L.debtorName} is now connected (pending).`}));const xe=await r.fetchMergedDebtors(s.id,c.company_id);p(xe),w(!1),Ue(!0),At("connected"),I(null),q(!1)}catch(N){console.error(z?"Change portal failed":"Create connection failed",N);const V=N instanceof Error?N:new Error(`Unable to ${z?"change portal":"create connection"}.`);N instanceof me&&N.status===401&&N.type==="authentication_error"&&(t?.("portalduct"),F("error"),Ae(V.message)),W({title:z?"Change portal failed":"Connection failed",description:V.message,variant:"destructive"})}finally{D(!1)}},fr=C=>{Ye(C),Ee(!0)},pr=async(C,U)=>{if(!(!r||!c||!s||!R?.connection))try{Me(!0);const O=r.getPortalDuctAPI(),N={};C&&(N.user_name=C),U&&(N.password=U),await O.updateConnection(R.connection.connection_id,N);const V=await r.fetchMergedDebtors(s.id,c.company_id);p(V),Ee(!1),Ye(null),W({title:"Credentials updated",description:`Updated credentials for ${R.debtorName}.`})}catch(O){console.error("Update credentials failed",O);const N=O instanceof Error?O:new Error("Unable to update credentials.");O instanceof me&&O.status===401&&O.type==="authentication_error"&&(t?.("portalduct"),F("error"),Ae(N.message)),W({title:"Update failed",description:N.message,variant:"destructive"})}finally{Me(!1)}},mr=async C=>{if(!r||!c||!s||!C.connection)return;const U=C.status==="deactivated",O=U?"activate":"deactivate";try{ee(C.factorcloudDebtorId);const N=r.getPortalDuctAPI();U?await N.activateConnection(C.connection.connection_id):await N.deactivateConnection(C.connection.connection_id);const V=await r.fetchMergedDebtors(s.id,c.company_id);p(V),At(U?"connected":"deactivated"),W({title:`Connection ${O}d`,description:`${C.debtorName} connection has been ${O}d.`})}catch(N){console.error(`Failed to ${O} connection`,N);const V=N instanceof Error?N:new Error(`Unable to ${O} connection.`);N instanceof me&&N.status===401&&N.type==="authentication_error"&&(t?.("portalduct"),F("error"),Ae(V.message)),W({title:`Failed to ${O}`,description:V.message,variant:"destructive"})}finally{ee(null)}},hr=async C=>{if(!C.connection){W({title:"Cannot Sync",description:`${C.debtorName} is not connected to a portal`,variant:"destructive"});return}const U=r;if(!U){W({title:"Service Not Ready",description:"PortalDuct service is not available yet.",variant:"destructive"});return}ke(C.factorcloudDebtorId);const O=window.setTimeout(()=>{ke(null),K(N=>{const V=new Map(N);return V.delete(C.factorcloudDebtorId),V})},15*60*1e3);K(N=>{const V=new Map(N);return V.set(C.factorcloudDebtorId,O),V});try{const N=await U.triggerConnectionSync(C.connection.connection_id),V=new Date().toISOString();p(fe=>fe.map(we=>we.factorcloudDebtorId===C.factorcloudDebtorId?{...we,lastSync:V,lastSyncSummary:{processed:N.processed,synced:N.synced,failed:N.failed,timestamp:V}}:we)),ke(null);const xe=ve.get(C.factorcloudDebtorId);xe!==void 0&&window.clearTimeout(xe),K(fe=>{const we=new Map(fe);return we.delete(C.factorcloudDebtorId),we}),W({title:N.failed>0?"Sync Completed with Warnings":"Sync Completed",description:`Processed ${N.processed} records. Synced ${N.synced}. Failed ${N.failed}.`})}catch(N){ke(null);const V=ve.get(C.factorcloudDebtorId);V&&(window.clearTimeout(V),K(xe=>{const fe=new Map(xe);return fe.delete(C.factorcloudDebtorId),fe})),console.error("Sync failed",N),W({title:"Sync Failed",description:N instanceof Error?N.message:`Unable to sync ${C.debtorName}`,variant:"destructive"})}},gr=async C=>{if(!C.connection){W({title:"Cannot Verify",description:`${C.debtorName} is not connected to a portal`,variant:"destructive"});return}const U=r;if(!U){W({title:"Service Not Ready",description:"PortalDuct service is not available yet.",variant:"destructive"});return}De(C.factorcloudDebtorId);const O=window.setTimeout(()=>{De(null),ye(N=>{const V=new Map(N);return V.delete(C.factorcloudDebtorId),V})},15*60*1e3);ye(N=>{const V=new Map(N);return V.set(C.factorcloudDebtorId,O),V});try{const N=await U.triggerConnectionVerification(C.connection.connection_id),V=new Date().toISOString();p(fe=>fe.map(we=>we.factorcloudDebtorId===C.factorcloudDebtorId?{...we,lastVerificationSummary:{processed:N.processed,synced:N.synced,failed:N.failed,timestamp:V}}:we)),De(null);const xe=be.get(C.factorcloudDebtorId);xe!==void 0&&window.clearTimeout(xe),ye(fe=>{const we=new Map(fe);return we.delete(C.factorcloudDebtorId),we}),W({title:N.failed>0?"Verification Completed with Warnings":"Verification Completed",description:`Processed ${N.processed} records. Verified ${N.synced}. Failed ${N.failed}.`})}catch(N){De(null);const V=be.get(C.factorcloudDebtorId);V&&(window.clearTimeout(V),ye(xe=>{const fe=new Map(xe);return fe.delete(C.factorcloudDebtorId),fe})),console.error("Verification failed",N),W({title:"Verification Failed",description:N instanceof Error?N.message:`Unable to verify ${C.debtorName}`,variant:"destructive"})}};return n.jsxs("div",{className:"flex min-h-screen bg-background",children:[n.jsxs("aside",{className:"w-80 bg-[hsl(220,30%,15%)] text-white flex flex-col",children:[n.jsxs("div",{className:"p-6 border-b border-white/10",children:[n.jsx("h1",{className:"text-2xl font-bold",children:"FACTORCLOUD"}),n.jsx("p",{className:"text-sm text-white/60 mt-1",children:"SANDBOX"})]}),n.jsxs("nav",{className:"flex-1 p-4 space-y-1",children:[n.jsxs("button",{className:"w-full flex items-center gap-3 px-4 py-3 rounded-lg text-white/70 hover:bg-white/5 transition-colors",children:[n.jsx(Y.Clock,{className:"w-5 h-5"}),n.jsx("span",{children:"Dashboard"})]}),n.jsxs("button",{className:"w-full flex items-center gap-3 px-4 py-3 rounded-lg text-white/70 hover:bg-white/5 transition-colors",children:[n.jsx(Y.Building,{className:"w-5 h-5"}),n.jsx("span",{children:"Companies"})]}),n.jsxs("button",{className:"w-full flex items-center gap-3 px-4 py-3 rounded-lg text-white/70 hover:bg-white/5 transition-colors",children:[n.jsx(Y.Edit2,{className:"w-5 h-5"}),n.jsx("span",{children:"Terms"})]}),n.jsxs("button",{className:"w-full flex items-center gap-3 px-4 py-3 rounded-lg bg-white/10 text-white",children:[n.jsx(Y.FileText,{className:"w-5 h-5"}),n.jsx("span",{children:"Invoices"})]}),n.jsxs("button",{className:"w-full flex items-center gap-3 px-4 py-3 rounded-lg text-white/70 hover:bg-white/5 transition-colors",children:[n.jsx(Y.DollarSign,{className:"w-5 h-5"}),n.jsx("span",{children:"Funding"})]}),n.jsxs("button",{className:"w-full flex items-center gap-3 px-4 py-3 rounded-lg text-white/70 hover:bg-white/5 transition-colors",children:[n.jsx(Y.CreditCard,{className:"w-5 h-5"}),n.jsx("span",{children:"Payments"})]}),n.jsxs("button",{className:"w-full flex items-center gap-3 px-4 py-3 rounded-lg text-white/70 hover:bg-white/5 transition-colors",children:[n.jsx(Y.RefreshCw,{className:"w-5 h-5"}),n.jsx("span",{children:"Chargebacks"})]}),n.jsxs("button",{className:"w-full flex items-center gap-3 px-4 py-3 rounded-lg text-white/70 hover:bg-white/5 transition-colors",children:[n.jsx(Y.BookOpen,{className:"w-5 h-5"}),n.jsx("span",{children:"Ledgers"})]}),n.jsxs("button",{className:"w-full flex items-center gap-3 px-4 py-3 rounded-lg text-white/70 hover:bg-white/5 transition-colors",children:[n.jsx(Y.Calculator,{className:"w-5 h-5"}),n.jsx("span",{children:"Accounting"})]})]})]}),n.jsxs("main",{className:"flex-1 flex flex-col",children:[n.jsx("header",{className:"border-b bg-background p-6",children:n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("h1",{className:"text-4xl font-bold",children:"Invoices"}),n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx(Z,{variant:"outline",children:"Export Invoices"}),n.jsx(Z,{variant:"outline",onClick:()=>{tt?it():re(!0)},disabled:S||Q||tt===!0&&!r,children:S?"Loading...":Q?"Checking Access...":tt===!0?"Sync Invoices":"Sync Unavailable"}),n.jsx(Z,{className:"bg-foreground text-background hover:bg-foreground/90",children:"Create Invoice"})]})]})}),n.jsx("div",{className:"flex-1 p-6",children:n.jsxs(Ur,{defaultValue:"pending",className:"w-full",children:[n.jsxs(Xt,{className:"bg-muted",children:[n.jsx(pe,{value:"pending",children:"Pending"}),n.jsx(pe,{value:"approved",children:"Approved"}),n.jsx(pe,{value:"funded",children:"Funded"}),n.jsx(pe,{value:"closed",children:"Closed"}),n.jsx(pe,{value:"rejected",children:"Rejected"}),n.jsx(pe,{value:"all",children:"All"})]}),n.jsx(Pe,{value:"pending",className:"mt-6",children:n.jsx("div",{className:"border rounded-lg p-12",children:n.jsxs("div",{className:"flex flex-col items-center justify-center text-center",children:[n.jsx("div",{className:"w-24 h-24 rounded-full bg-muted flex items-center justify-center mb-4",children:n.jsx(Y.FileText,{className:"w-12 h-12 text-muted-foreground"})}),n.jsx("h3",{className:"text-2xl font-semibold mb-2",children:"No records in the table"}),n.jsx("p",{className:"text-muted-foreground",children:"No records found"})]})})}),n.jsx(Pe,{value:"approved",className:"mt-6",children:n.jsx("div",{className:"border rounded-lg p-12",children:n.jsxs("div",{className:"flex flex-col items-center justify-center text-center",children:[n.jsx("div",{className:"w-24 h-24 rounded-full bg-muted flex items-center justify-center mb-4",children:n.jsx(Y.FileText,{className:"w-12 h-12 text-muted-foreground"})}),n.jsx("h3",{className:"text-2xl font-semibold mb-2",children:"No records in the table"}),n.jsx("p",{className:"text-muted-foreground",children:"No records found"})]})})}),n.jsx(Pe,{value:"funded",className:"mt-6",children:n.jsx("div",{className:"border rounded-lg p-12",children:n.jsxs("div",{className:"flex flex-col items-center justify-center text-center",children:[n.jsx("div",{className:"w-24 h-24 rounded-full bg-muted flex items-center justify-center mb-4",children:n.jsx(Y.FileText,{className:"w-12 h-12 text-muted-foreground"})}),n.jsx("h3",{className:"text-2xl font-semibold mb-2",children:"No records in the table"}),n.jsx("p",{className:"text-muted-foreground",children:"No records found"})]})})}),n.jsx(Pe,{value:"closed",className:"mt-6",children:n.jsx("div",{className:"border rounded-lg p-12",children:n.jsxs("div",{className:"flex flex-col items-center justify-center text-center",children:[n.jsx("div",{className:"w-24 h-24 rounded-full bg-muted flex items-center justify-center mb-4",children:n.jsx(Y.FileText,{className:"w-12 h-12 text-muted-foreground"})}),n.jsx("h3",{className:"text-2xl font-semibold mb-2",children:"No records in the table"}),n.jsx("p",{className:"text-muted-foreground",children:"No records found"})]})})}),n.jsx(Pe,{value:"rejected",className:"mt-6",children:n.jsx("div",{className:"border rounded-lg p-12",children:n.jsxs("div",{className:"flex flex-col items-center justify-center text-center",children:[n.jsx("div",{className:"w-24 h-24 rounded-full bg-muted flex items-center justify-center mb-4",children:n.jsx(Y.FileText,{className:"w-12 h-12 text-muted-foreground"})}),n.jsx("h3",{className:"text-2xl font-semibold mb-2",children:"No records in the table"}),n.jsx("p",{className:"text-muted-foreground",children:"No records found"})]})})}),n.jsx(Pe,{value:"all",className:"mt-6",children:n.jsx("div",{className:"border rounded-lg p-12",children:n.jsxs("div",{className:"flex flex-col items-center justify-center text-center",children:[n.jsx("div",{className:"w-24 h-24 rounded-full bg-muted flex items-center justify-center mb-4",children:n.jsx(Y.FileText,{className:"w-12 h-12 text-muted-foreground"})}),n.jsx("h3",{className:"text-2xl font-semibold mb-2",children:"No records in the table"}),n.jsx("p",{className:"text-muted-foreground",children:"No records found"})]})})})]})})]}),n.jsx(io,{open:Te,onOpenChange:Ue,currentStep:B,error:ht,clients:u,debtors:f,selectedDebtor:m,selectedClient:s,onSelectClient:bt,onSelectDebtor:ir,onConnectDebtor:cr,onEditCredentials:fr,onChangePortal:lr,onToggleActivation:mr,onSyncDebtor:hr,onVerifyDebtor:gr,togglingDebtorId:Le,syncingDebtorId:oe,verifyingDebtorId:$e,allowBackToClientSelection:!sr,onBackToClientSelection:()=>F("selecting-client"),activeTab:Ve,onActiveTabChange:At}),n.jsx(mo,{open:se,onOpenChange:ge,loading:J,onSubmit:ur}),n.jsx(po,{open:E,onOpenChange:Be,debtor:L,availablePortals:h,loadingPortals:T,loading:b,isChangingPortal:z,onConnect:Pt,onRequestNewPortal:dr}),n.jsx(no,{open:_e,onOpenChange:Ee,debtor:R,loading:Fe,onUpdate:pr}),n.jsx(es,{open:ue,onOpenChange:C=>!C&&re(!1)})]})},Ed=({config:e,queryClient:t,variant:r="full",theme:o="auto",title:s="Sync invoices automatically",badge:a,ctaLabel:c="Sync Now",icon:i=n.jsxs("div",{style:{position:"relative",width:"26px",height:"26px",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:[n.jsx("span",{className:"fc-icon-orbit",style:{position:"absolute",top:"-6px",left:"-6px",width:"38px",height:"38px",borderRadius:"50%",pointerEvents:"none"}}),n.jsx("div",{style:{background:"rgba(99,102,241,0.15)",borderRadius:"50%",width:"26px",height:"26px",display:"flex",alignItems:"center",justifyContent:"center"},children:n.jsx("span",{style:{color:"#818cf8",fontSize:"14px"},children:"⚡"})})]}),onTokenExpired:u,onSyncComplete:d,onSyncError:f,autoStart:p})=>{const m=v.useMemo(()=>t??new vr.QueryClient,[t]),y=ho(e),[S,g]=v.useState("light");if(v.useEffect(()=>{if(o!=="auto"){g(o);return}const w=window.matchMedia("(prefers-color-scheme: dark)"),L=()=>g(w.matches?"dark":"light");return L(),w.addEventListener("change",L),()=>w.removeEventListener("change",L)},[o]),y.loading)return null;const h=S==="dark",x=n.jsx("button",{style:{background:"linear-gradient(90deg, rgba(99,102,241,1) 0%, rgba(79,70,229,1) 100%)",color:"white",borderRadius:r==="compact"?"14px":"8px",padding:r==="compact"?"6px 14px":"10px 18px",fontSize:"12px",fontWeight:600,cursor:"pointer",border:"none",whiteSpace:"nowrap",boxShadow:h?"0 4px 8px rgba(0,0,0,0.25)":"0 3px 6px rgba(0,0,0,0.15)",transition:"transform 0.25s ease, opacity 0.2s"},onMouseEnter:w=>{w.currentTarget.style.opacity="0.9",w.currentTarget.style.transform="translateY(-1px)"},onMouseLeave:w=>{w.currentTarget.style.opacity="1",w.currentTarget.style.transform="translateY(0px)"},children:c}),j=a??n.jsxs("span",{className:"fc-enhanced-badge",style:{fontSize:"9px",fontWeight:700,textTransform:"uppercase",padding:"2px 6px",borderRadius:"6px",background:h?"rgba(99,102,241,0.22)":"rgba(147,197,253,0.20)",color:h?"#c7d2fe":"#3b82f6",border:h?"1px solid rgba(255,255,255,0.08)":"1px solid rgba(59,130,246,0.15)",position:"relative",overflow:"hidden",display:"inline-block"},children:["NEW",n.jsx("span",{className:"sparkle",style:{position:"absolute",top:"0px",right:"-2px",width:"3px",height:"3px",background:h?"white":"#3b82f6",borderRadius:"50%",opacity:0}}),n.jsx("span",{className:"sparkle",style:{position:"absolute",top:"4px",right:"6px",width:"2px",height:"2px",background:h?"white":"#3b82f6",borderRadius:"50%",opacity:0}}),n.jsx("span",{className:"sparkle",style:{position:"absolute",top:"10px",right:"2px",width:"2px",height:"2px",background:h?"white":"#3b82f6",borderRadius:"50%",opacity:0}}),n.jsx("span",{className:"sparkle",style:{position:"absolute",top:"7px",right:"10px",width:"3px",height:"3px",background:h?"white":"#3b82f6",borderRadius:"50%",opacity:0}})]}),E=n.jsx("style",{children:`
4
54
  @keyframes pulseGlow {
5
- 0% { box-shadow: ${C?"0 0 10px rgba(99,102,241,0.25)":"0 0 8px rgba(99,102,241,0.15)"}; }
55
+ 0% { box-shadow: ${h?"0 0 10px rgba(99,102,241,0.25)":"0 0 8px rgba(99,102,241,0.15)"}; }
6
56
  50% { box-shadow: 0 0 16px rgba(99,102,241,0.4); }
7
- 100% { box-shadow: ${C?"0 0 10px rgba(99,102,241,0.25)":"0 0 8px rgba(99,102,241,0.15)"}; }
57
+ 100% { box-shadow: ${h?"0 0 10px rgba(99,102,241,0.25)":"0 0 8px rgba(99,102,241,0.15)"}; }
8
58
  }
9
59
 
10
60
  @keyframes fadeIn {
@@ -109,5 +159,5 @@
109
159
  opacity: 0.35;
110
160
  }
111
161
  }
112
- `});if(o==="compact"){const P=C?"rgba(17,17,20,0.85)":"rgba(255,255,255,0.85)",L=C?"1px solid rgba(255,255,255,0.08)":"1px solid rgba(0,0,0,0.08)",J=C?"0 0 10px rgba(99,102,241,0.25)":"0 0 8px rgba(99,102,241,0.15)",u=C?"#f9fafb":"#111827";return t.jsxs(Mt.QueryClientProvider,{client:F,children:[Y,t.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:"6px",padding:"6px 10px",background:P,border:L,borderRadius:"20px",backdropFilter:"blur(4px)",whiteSpace:"nowrap",cursor:"pointer",animation:"pulseGlow 12s infinite ease-in-out, fadeIn 0.4s ease-out",boxShadow:J,transition:"transform 0.25s ease, box-shadow 0.25s ease"},onMouseEnter:U=>{U.currentTarget.style.transform="translateY(-1px)",U.currentTarget.style.boxShadow="0 0 16px rgba(99,102,241,0.45)"},onMouseLeave:U=>{U.currentTarget.style.transform="translateY(0)",U.currentTarget.style.boxShadow=J},children:[i,t.jsxs("span",{style:{fontWeight:600,fontSize:"13px",display:"flex",alignItems:"center",gap:"4px",color:u,position:"relative"},children:[n,X]}),t.jsx(Nt,{config:e,trigger:G,onTokenExpired:f,onSyncComplete:d,onSyncError:y,autoStart:j,customerStatus:A})]})]})}return t.jsxs(Mt.QueryClientProvider,{client:F,children:[Y,t.jsx("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",width:"100%",padding:"16px",background:"transparent"},children:t.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"16px",padding:"14px 20px",borderRadius:"14px",background:"linear-gradient(135deg, rgba(15,15,16,1) 0%, rgba(26,26,28,1) 100%)",color:"white",border:"1px solid rgba(255,255,255,0.1)",boxShadow:"0 0 15px rgba(0,0,0,0.45)",maxWidth:"640px",width:"100%"},children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",flex:"1 1 auto",minWidth:"240px"},children:[i,t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[t.jsx("p",{style:{fontWeight:600,color:"#f9fafb",fontSize:"15px",margin:0},children:n}),X]})]}),t.jsx(Nt,{config:e,trigger:G,onTokenExpired:f,onSyncComplete:d,onSyncError:y,autoStart:j,customerStatus:A})]})})]})},Is=kt("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",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),Qr=W.forwardRef(({className:e,variant:r,...o},s)=>t.jsx("div",{ref:s,role:"alert",className:$(Is({variant:r}),e),...o}));Qr.displayName="Alert";const Ps=W.forwardRef(({className:e,...r},o)=>t.jsx("h5",{ref:o,className:$("mb-1 font-medium leading-none tracking-tight",e),...r}));Ps.displayName="AlertTitle";const Zr=W.forwardRef(({className:e,...r},o)=>t.jsx("div",{ref:o,className:$("text-sm [&_p]:leading-relaxed",e),...r}));Zr.displayName="AlertDescription";const Ts=({open:e,onOpenChange:r,onSave:o,currentConfig:s})=>{const[n,a]=l.useState({portalduct:{bearer_token:"",env_url:"",customer_id:"",webhook_bearer_token:""},factorcloud:{factorId:"",bearer_token:"",env_url:"",client_id:void 0}});l.useEffect(()=>{s&&a(d=>({portalduct:{...d.portalduct,...s.portalduct},factorcloud:{...d.factorcloud,...s.factorcloud}}))},[s]);const c=!!(n.factorcloud?.factorId&&n.portalduct?.webhook_bearer_token),i=()=>{c&&(o(n),r(!1))},f=[];return n.portalduct?.webhook_bearer_token||f.push("PortalDuct Webhook Token"),n.factorcloud?.factorId||f.push("FactorCloud Factor ID"),t.jsx(it,{open:e,onOpenChange:r,children:t.jsxs(Ke,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[t.jsxs(We,{children:[t.jsx(qe,{children:"SDK Configuration (Testing)"}),t.jsx(Ge,{children:"Configure your PortalDuct and FactorCloud credentials for testing."})]}),t.jsxs("div",{className:"space-y-6 py-4",children:[f.length>0&&t.jsxs(Qr,{variant:"destructive",children:[t.jsx(O.AlertCircle,{className:"h-4 w-4"}),t.jsxs(Zr,{children:["Missing required fields: ",f.join(", ")]})]}),t.jsxs("div",{className:"space-y-4",children:[t.jsx("h3",{className:"text-lg font-semibold",children:"PortalDuct Configuration"}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(ye,{htmlFor:"pd-webhook-token",children:"Webhook Token *"}),t.jsx(ae,{id:"pd-webhook-token",type:"password",value:n.portalduct?.webhook_bearer_token||"",onChange:d=>a({...n,portalduct:{...n.portalduct,webhook_bearer_token:d.target.value}}),placeholder:"Enter PortalDuct Webhook Token"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"Used for triggering Supabase webhooks and fetching the latest SDK credentials."})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(ye,{htmlFor:"pd-bearer-token",children:"API Bearer Token"}),t.jsx(ae,{id:"pd-bearer-token",type:"password",value:n.portalduct?.bearer_token||"",readOnly:!0,placeholder:"Auto-configured after status check"})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(ye,{htmlFor:"pd-env-url",children:"Environment URL"}),t.jsx(ae,{id:"pd-env-url",value:n.portalduct?.env_url||"",readOnly:!0,placeholder:"Auto-configured after status check"})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(ye,{htmlFor:"pd-customer-id",children:"Customer ID"}),t.jsx(ae,{id:"pd-customer-id",value:n.portalduct?.customer_id||"",readOnly:!0,placeholder:"Auto-configured after status check"})]})]}),t.jsxs("div",{className:"space-y-4",children:[t.jsx("h3",{className:"text-lg font-semibold",children:"FactorCloud Configuration"}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(ye,{htmlFor:"fc-bearer-token",children:"Bearer Token"}),t.jsx(ae,{id:"fc-bearer-token",type:"password",value:n.factorcloud?.bearer_token||"",readOnly:!0,placeholder:"Auto-configured after status check"})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(ye,{htmlFor:"fc-factor-id",children:"Factor ID *"}),t.jsx(ae,{id:"fc-factor-id",value:n.factorcloud?.factorId||"",onChange:d=>a({...n,factorcloud:{...n.factorcloud,factorId:d.target.value}}),placeholder:"Enter FactorCloud Factor ID"})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(ye,{htmlFor:"fc-env-url",children:"Environment URL"}),t.jsx(ae,{id:"fc-env-url",value:n.factorcloud?.env_url||"",readOnly:!0,placeholder:"Auto-configured after status check"})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(ye,{htmlFor:"fc-client-id",children:"Client ID (Optional)"}),t.jsx(ae,{id:"fc-client-id",value:n.factorcloud?.client_id||"",onChange:d=>a({...n,factorcloud:{...n.factorcloud,client_id:d.target.value||void 0}}),placeholder:"Leave empty to select from list"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"If not provided, you'll select from available clients during sync"})]})]})]}),t.jsxs(Vr,{children:[t.jsx(q,{variant:"outline",onClick:()=>r(!1),children:"Cancel"}),t.jsx(q,{onClick:i,disabled:!c,children:"Save Configuration"})]})]})})},eo=W.forwardRef(({className:e,...r},o)=>t.jsx("div",{ref:o,className:$("rounded-lg border bg-card text-card-foreground shadow-sm",e),...r}));eo.displayName="Card";const Es=W.forwardRef(({className:e,...r},o)=>t.jsx("div",{ref:o,className:$("flex flex-col space-y-1.5 p-6",e),...r}));Es.displayName="CardHeader";const Rs=W.forwardRef(({className:e,...r},o)=>t.jsx("h3",{ref:o,className:$("text-2xl font-semibold leading-none tracking-tight",e),...r}));Rs.displayName="CardTitle";const Fs=W.forwardRef(({className:e,...r},o)=>t.jsx("p",{ref:o,className:$("text-sm text-muted-foreground",e),...r}));Fs.displayName="CardDescription";const Os=W.forwardRef(({className:e,...r},o)=>t.jsx("div",{ref:o,className:$("p-6 pt-0",e),...r}));Os.displayName="CardContent";const Ms=W.forwardRef(({className:e,...r},o)=>t.jsx("div",{ref:o,className:$("flex items-center p-6 pt-0",e),...r}));Ms.displayName="CardFooter";function Us({open:e,onOpenChange:r,clients:o,onSelect:s}){const[n,a]=l.useState(""),c=o.filter(i=>i.companyName.toLowerCase().includes(n.toLowerCase())||i.email.toLowerCase().includes(n.toLowerCase())||i.compCode.toLowerCase().includes(n.toLowerCase()));return t.jsx(it,{open:e,onOpenChange:r,children:t.jsxs(Ke,{className:"max-w-2xl max-h-[90vh] overflow-hidden flex flex-col",children:[t.jsxs(We,{children:[t.jsx(qe,{children:"Select FactorCloud Client"}),t.jsx(Ge,{children:"Choose the client you want to manage portal connections for."})]}),t.jsxs("div",{className:"space-y-4",children:[t.jsx(ae,{placeholder:"Search by name, email, or code...",value:n,onChange:i=>a(i.target.value)}),t.jsx("div",{className:"overflow-y-auto max-h-[500px] space-y-2",children:c.length===0?t.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"No clients found matching your search."}):c.map(i=>t.jsx(eo,{className:"p-4 hover:bg-accent cursor-pointer transition-colors",onClick:()=>s(i),children:t.jsxs("div",{className:"space-y-2",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(O.Building2,{className:"h-5 w-5 text-primary"}),t.jsx("h3",{className:"font-semibold",children:i.companyName})]}),i.active&&t.jsx("span",{className:"text-xs bg-green-500/10 text-green-500 px-2 py-1 rounded",children:"Active"})]}),t.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx(O.Mail,{className:"h-4 w-4"}),t.jsx("span",{children:i.email})]}),t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx(O.Hash,{className:"h-4 w-4"}),t.jsx("span",{children:i.compCode})]})]})]})},i.id))})]}),t.jsx("div",{className:"flex justify-end pt-4",children:t.jsx(q,{variant:"outline",onClick:()=>r(!1),children:"Cancel"})})]})})}const zs="0.1.0";function $s(e){return{config:e,component:Nt}}exports.ClientSelectionModal=Us;exports.ConfigModal=Ts;exports.ConnectDebtorModal=nr;exports.ConnectionSyncAPI=Zt;exports.DataOrchestrationService=er;exports.FactorCloudAPI=$r;exports.PortalDuctAPI=Lr;exports.PortalIntegration=As;exports.RequestPortalModal=ar;exports.SDK_VERSION=zs;exports.SyncBanner=Ds;exports.SyncProgressModal=sr;exports.SyncWorkflow=Nt;exports.UpdateCredentialsModal=or;exports.initPortalSDK=$s;exports.isConfigComplete=rt;exports.mergeCustomerStatusWithConfig=zr;
162
+ `});if(r==="compact"){const w=h?"rgba(17,17,20,0.85)":"rgba(255,255,255,0.85)",L=h?"1px solid rgba(255,255,255,0.08)":"1px solid rgba(0,0,0,0.08)",I=h?"0 0 10px rgba(99,102,241,0.25)":"0 0 8px rgba(99,102,241,0.15)",b=h?"#f9fafb":"#111827";return n.jsxs(vr.QueryClientProvider,{client:m,children:[E,n.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:"6px",padding:"6px 10px",background:w,border:L,borderRadius:"20px",backdropFilter:"blur(4px)",whiteSpace:"nowrap",cursor:"pointer",animation:"pulseGlow 12s infinite ease-in-out, fadeIn 0.4s ease-out",boxShadow:I,transition:"transform 0.25s ease, box-shadow 0.25s ease"},onMouseEnter:D=>{D.currentTarget.style.transform="translateY(-1px)",D.currentTarget.style.boxShadow="0 0 16px rgba(99,102,241,0.45)"},onMouseLeave:D=>{D.currentTarget.style.transform="translateY(0)",D.currentTarget.style.boxShadow=I},children:[i,n.jsxs("span",{style:{fontWeight:600,fontSize:"13px",display:"flex",alignItems:"center",gap:"4px",color:b,position:"relative"},children:[s,j]}),n.jsx(Zt,{config:e,trigger:x,onTokenExpired:u,onSyncComplete:d,onSyncError:f,autoStart:p,customerStatus:y})]})]})}return n.jsxs(vr.QueryClientProvider,{client:m,children:[E,n.jsx("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",width:"100%",padding:"16px",background:"transparent"},children:n.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"16px",padding:"14px 20px",borderRadius:"14px",background:"linear-gradient(135deg, rgba(15,15,16,1) 0%, rgba(26,26,28,1) 100%)",color:"white",border:"1px solid rgba(255,255,255,0.1)",boxShadow:"0 0 15px rgba(0,0,0,0.45)",maxWidth:"640px",width:"100%"},children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",flex:"1 1 auto",minWidth:"240px"},children:[i,n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[n.jsx("p",{style:{fontWeight:600,color:"#f9fafb",fontSize:"15px",margin:0},children:s}),j]})]}),n.jsx(Zt,{config:e,trigger:x,onTokenExpired:u,onSyncComplete:d,onSyncError:f,autoStart:p,customerStatus:y})]})})]})},kd=Jt("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",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),sa=l.forwardRef(({className:e,variant:t,...r},o)=>n.jsx("div",{ref:o,role:"alert",className:X(kd({variant:t}),e),...r}));sa.displayName="Alert";const Ad=l.forwardRef(({className:e,...t},r)=>n.jsx("h5",{ref:r,className:X("mb-1 font-medium leading-none tracking-tight",e),...t}));Ad.displayName="AlertTitle";const aa=l.forwardRef(({className:e,...t},r)=>n.jsx("div",{ref:r,className:X("text-sm [&_p]:leading-relaxed",e),...t}));aa.displayName="AlertDescription";const Pd=({open:e,onOpenChange:t,onSave:r,currentConfig:o})=>{const[s,a]=v.useState({portalduct:{bearer_token:"",env_url:"",customer_id:"",webhook_bearer_token:""},factorcloud:{factorId:"",bearer_token:"",env_url:"",client_id:void 0}});v.useEffect(()=>{o&&a(d=>({portalduct:{...d.portalduct,...o.portalduct},factorcloud:{...d.factorcloud,...o.factorcloud}}))},[o]);const c=!!(s.factorcloud?.factorId&&s.portalduct?.webhook_bearer_token),i=()=>{c&&(r(s),t(!1))},u=[];return s.portalduct?.webhook_bearer_token||u.push("PortalDuct Webhook Token"),s.factorcloud?.factorId||u.push("FactorCloud Factor ID"),n.jsx(mt,{open:e,onOpenChange:t,children:n.jsxs(at,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[n.jsxs(Ke,{children:[n.jsx(Qe,{children:"SDK Configuration (Testing)"}),n.jsx(Ze,{children:"Configure your PortalDuct and FactorCloud credentials for testing."})]}),n.jsxs("div",{className:"space-y-6 py-4",children:[u.length>0&&n.jsxs(sa,{variant:"destructive",children:[n.jsx(Y.AlertCircle,{className:"h-4 w-4"}),n.jsxs(aa,{children:["Missing required fields: ",u.join(", ")]})]}),n.jsxs("div",{className:"space-y-4",children:[n.jsx("h3",{className:"text-lg font-semibold",children:"PortalDuct Configuration"}),n.jsxs("div",{className:"space-y-2",children:[n.jsx(je,{htmlFor:"pd-webhook-token",children:"Webhook Token *"}),n.jsx(le,{id:"pd-webhook-token",type:"password",value:s.portalduct?.webhook_bearer_token||"",onChange:d=>a({...s,portalduct:{...s.portalduct,webhook_bearer_token:d.target.value}}),placeholder:"Enter PortalDuct Webhook Token"}),n.jsx("p",{className:"text-sm text-muted-foreground",children:"Used for triggering Supabase webhooks and fetching the latest SDK credentials."})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx(je,{htmlFor:"pd-bearer-token",children:"API Bearer Token"}),n.jsx(le,{id:"pd-bearer-token",type:"password",value:s.portalduct?.bearer_token||"",readOnly:!0,placeholder:"Auto-configured after status check"})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx(je,{htmlFor:"pd-env-url",children:"Environment URL"}),n.jsx(le,{id:"pd-env-url",value:s.portalduct?.env_url||"",readOnly:!0,placeholder:"Auto-configured after status check"})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx(je,{htmlFor:"pd-customer-id",children:"Customer ID"}),n.jsx(le,{id:"pd-customer-id",value:s.portalduct?.customer_id||"",readOnly:!0,placeholder:"Auto-configured after status check"})]})]}),n.jsxs("div",{className:"space-y-4",children:[n.jsx("h3",{className:"text-lg font-semibold",children:"FactorCloud Configuration"}),n.jsxs("div",{className:"space-y-2",children:[n.jsx(je,{htmlFor:"fc-bearer-token",children:"Bearer Token"}),n.jsx(le,{id:"fc-bearer-token",type:"password",value:s.factorcloud?.bearer_token||"",readOnly:!0,placeholder:"Auto-configured after status check"})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx(je,{htmlFor:"fc-factor-id",children:"Factor ID *"}),n.jsx(le,{id:"fc-factor-id",value:s.factorcloud?.factorId||"",onChange:d=>a({...s,factorcloud:{...s.factorcloud,factorId:d.target.value}}),placeholder:"Enter FactorCloud Factor ID"})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx(je,{htmlFor:"fc-env-url",children:"Environment URL"}),n.jsx(le,{id:"fc-env-url",value:s.factorcloud?.env_url||"",readOnly:!0,placeholder:"Auto-configured after status check"})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx(je,{htmlFor:"fc-client-id",children:"Client ID (Optional)"}),n.jsx(le,{id:"fc-client-id",value:s.factorcloud?.client_id||"",onChange:d=>a({...s,factorcloud:{...s.factorcloud,client_id:d.target.value||void 0}}),placeholder:"Leave empty to select from list"}),n.jsx("p",{className:"text-sm text-muted-foreground",children:"If not provided, you'll select from available clients during sync"})]})]})]}),n.jsxs(Kn,{children:[n.jsx(Z,{variant:"outline",onClick:()=>t(!1),children:"Cancel"}),n.jsx(Z,{onClick:i,disabled:!c,children:"Save Configuration"})]})]})})},ia=l.forwardRef(({className:e,...t},r)=>n.jsx("div",{ref:r,className:X("rounded-lg border bg-card text-card-foreground shadow-sm",e),...t}));ia.displayName="Card";const _d=l.forwardRef(({className:e,...t},r)=>n.jsx("div",{ref:r,className:X("flex flex-col space-y-1.5 p-6",e),...t}));_d.displayName="CardHeader";const Dd=l.forwardRef(({className:e,...t},r)=>n.jsx("h3",{ref:r,className:X("text-2xl font-semibold leading-none tracking-tight",e),...t}));Dd.displayName="CardTitle";const Td=l.forwardRef(({className:e,...t},r)=>n.jsx("p",{ref:r,className:X("text-sm text-muted-foreground",e),...t}));Td.displayName="CardDescription";const Id=l.forwardRef(({className:e,...t},r)=>n.jsx("div",{ref:r,className:X("p-6 pt-0",e),...t}));Id.displayName="CardContent";const Rd=l.forwardRef(({className:e,...t},r)=>n.jsx("div",{ref:r,className:X("flex items-center p-6 pt-0",e),...t}));Rd.displayName="CardFooter";function Od({open:e,onOpenChange:t,clients:r,onSelect:o}){const[s,a]=v.useState(""),c=r.filter(i=>i.companyName.toLowerCase().includes(s.toLowerCase())||i.email.toLowerCase().includes(s.toLowerCase())||i.compCode.toLowerCase().includes(s.toLowerCase()));return n.jsx(mt,{open:e,onOpenChange:t,children:n.jsxs(at,{className:"max-w-2xl max-h-[90vh] overflow-hidden flex flex-col",children:[n.jsxs(Ke,{children:[n.jsx(Qe,{children:"Select FactorCloud Client"}),n.jsx(Ze,{children:"Choose the client you want to manage portal connections for."})]}),n.jsxs("div",{className:"space-y-4",children:[n.jsx(le,{placeholder:"Search by name, email, or code...",value:s,onChange:i=>a(i.target.value)}),n.jsx("div",{className:"overflow-y-auto max-h-[500px] space-y-2",children:c.length===0?n.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"No clients found matching your search."}):c.map(i=>n.jsx(ia,{className:"p-4 hover:bg-accent cursor-pointer transition-colors",onClick:()=>o(i),children:n.jsxs("div",{className:"space-y-2",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(Y.Building2,{className:"h-5 w-5 text-primary"}),n.jsx("h3",{className:"font-semibold",children:i.companyName})]}),i.active&&n.jsx("span",{className:"text-xs bg-green-500/10 text-green-500 px-2 py-1 rounded",children:"Active"})]}),n.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx(Y.Mail,{className:"h-4 w-4"}),n.jsx("span",{children:i.email})]}),n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx(Y.Hash,{className:"h-4 w-4"}),n.jsx("span",{children:i.compCode})]})]})]})},i.id))})]}),n.jsx("div",{className:"flex justify-end pt-4",children:n.jsx(Z,{variant:"outline",onClick:()=>t(!1),children:"Cancel"})})]})})}const Fd="0.1.0";function Md(e){return{config:e,component:Zt}}exports.ClientSelectionModal=Od;exports.ConfigModal=Pd;exports.ConnectDebtorModal=po;exports.ConnectionSyncAPI=Gr;exports.DataOrchestrationService=Hr;exports.FactorCloudAPI=pn;exports.PortalDuctAPI=mn;exports.PortalIntegration=Nd;exports.RequestPortalModal=mo;exports.SDK_VERSION=Fd;exports.SyncBanner=Ed;exports.SyncProgressModal=io;exports.SyncWorkflow=Zt;exports.UpdateCredentialsModal=no;exports.initPortalSDK=Md;exports.isConfigComplete=dt;exports.mergeCustomerStatusWithConfig=fn;
113
163
  //# sourceMappingURL=index.cjs.map